@@ -7,6 +7,7 @@ import { makeReaderRef } from '@endo/daemon';
7
7
import { E } from '@endo/far' ;
8
8
9
9
import { withEndoAgent } from '../context.js' ;
10
+ import { parsePetNamePath } from '../pet-name.js' ;
10
11
11
12
/**
12
13
* @param {Array<Uint8Array> } arrays
@@ -72,32 +73,34 @@ export const store = async ({
72
73
) } )`;
73
74
}
74
75
76
+ const parsedName = parsePetNamePath ( name ) ;
77
+
75
78
await withEndoAgent ( agentNames , { os, process } , async ( { agent } ) => {
76
79
if ( storeText !== undefined ) {
77
- await E ( agent ) . storeValue ( storeText , name ) ;
80
+ await E ( agent ) . storeValue ( storeText , parsedName ) ;
78
81
} else if ( storeJson !== undefined ) {
79
- await E ( agent ) . storeValue ( JSON . parse ( storeJson ) , name ) ;
82
+ await E ( agent ) . storeValue ( JSON . parse ( storeJson ) , parsedName ) ;
80
83
} else if ( storeBigInt !== undefined ) {
81
- await E ( agent ) . storeValue ( BigInt ( storeBigInt ) , name ) ;
84
+ await E ( agent ) . storeValue ( BigInt ( storeBigInt ) , parsedName ) ;
82
85
} else if ( storeTextStdin !== undefined ) {
83
86
const reader = makeNodeReader ( process . stdin ) ;
84
87
const bytes = await asyncConcat ( reader ) ;
85
88
const text = new TextDecoder ( ) . decode ( bytes ) ;
86
- await E ( agent ) . storeValue ( text , name ) ;
89
+ await E ( agent ) . storeValue ( text , parsedName ) ;
87
90
} else if ( storeJsonStdin !== undefined ) {
88
91
const reader = makeNodeReader ( process . stdin ) ;
89
92
const bytes = await asyncConcat ( reader ) ;
90
93
const text = new TextDecoder ( ) . decode ( bytes ) ;
91
- await E ( agent ) . storeValue ( JSON . parse ( text ) , name ) ;
94
+ await E ( agent ) . storeValue ( JSON . parse ( text ) , parsedName ) ;
92
95
} else if ( storeStdin !== undefined ) {
93
96
const reader = makeNodeReader ( process . stdin ) ;
94
97
const readerRef = makeReaderRef ( reader ) ;
95
- await E ( agent ) . storeBlob ( readerRef , name ) ;
98
+ await E ( agent ) . storeBlob ( readerRef , parsedName ) ;
96
99
} else if ( storePath !== undefined ) {
97
100
const nodeReadStream = fs . createReadStream ( storePath ) ;
98
101
const reader = makeNodeReader ( nodeReadStream ) ;
99
102
const readerRef = makeReaderRef ( reader ) ;
100
- await E ( agent ) . storeBlob ( readerRef , name ) ;
103
+ await E ( agent ) . storeBlob ( readerRef , parsedName ) ;
101
104
}
102
105
} ) ;
103
106
} ;
0 commit comments