@mysten-incubation/sui-agent-pass 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -202,8 +202,9 @@ account when lending is allowed, and sends SUI to the session's **address balanc
|
|
|
202
202
|
service re-reads everything that landed on chain and compares it with what you reviewed before
|
|
203
203
|
the signer serves the key.
|
|
204
204
|
|
|
205
|
-
Register the agents that may use your passes once with `connect
|
|
206
|
-
|
|
205
|
+
Register the agents that may use your passes once with `connect`. Its main menu lists detected
|
|
206
|
+
agents; **Other / manual setup** offers undetected clients and a generic MCP configuration.
|
|
207
|
+
You can also select a client directly with `--client <name>`. Then start Claude anywhere:
|
|
207
208
|
|
|
208
209
|
```sh
|
|
209
210
|
claude
|
package/dist/cli.js
CHANGED
|
@@ -14,30 +14,6 @@ import { cliInvocation, defaultRoot, forgetSession, openBrowser, servePlugin, se
|
|
|
14
14
|
import { startServer } from './server.js';
|
|
15
15
|
import { SessionStore } from './storage.js';
|
|
16
16
|
const quote = (s) => `'${s.replaceAll("'", "'\\''")}'`;
|
|
17
|
-
/**
|
|
18
|
-
* Picks several things one at a time with arrows and enter, the way a single-choice menu
|
|
19
|
-
* works, instead of a checkbox whose space key many people never find. Each pick leaves the
|
|
20
|
-
* list; the last entry ends the picking. `atLeastOne` refuses to end with nothing picked.
|
|
21
|
-
*/
|
|
22
|
-
async function pickMany(message, choices, done, atLeastOne) {
|
|
23
|
-
const picked = [];
|
|
24
|
-
let left = [...choices];
|
|
25
|
-
while (left.length) {
|
|
26
|
-
const pick = await select({
|
|
27
|
-
message: picked.length ? `${message} (${picked.length} picked so far)` : message,
|
|
28
|
-
choices: [...left, { name: done, value: null }],
|
|
29
|
-
});
|
|
30
|
-
if (pick === null) {
|
|
31
|
-
if (picked.length || !atLeastOne)
|
|
32
|
-
break;
|
|
33
|
-
console.log('Pick at least one.');
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
picked.push(pick);
|
|
37
|
-
left = left.filter((c) => c.value !== pick);
|
|
38
|
-
}
|
|
39
|
-
return picked;
|
|
40
|
-
}
|
|
41
17
|
export async function serve(store, port = 0, open = true) {
|
|
42
18
|
const server = await startServer(store, port);
|
|
43
19
|
console.log(`\nOwner page: ${server.ownerUrl}\nSession address: ${store.state.sessionAddress}\nSession directory: ${store.directory}`);
|
|
@@ -181,11 +157,26 @@ async function registerClient(client, http) {
|
|
|
181
157
|
}
|
|
182
158
|
case 'cursor':
|
|
183
159
|
return mergeJsonConfig(join(home, '.cursor/mcp.json'), http ?? stdio);
|
|
184
|
-
case 'hermes':
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
160
|
+
case 'hermes': {
|
|
161
|
+
// `hermes mcp add` writes ~/.hermes/config.yaml itself; an HTTP signer's bearer header
|
|
162
|
+
// has no plain flag there, so that form is printed to paste.
|
|
163
|
+
if (http) {
|
|
164
|
+
console.log(`Add to ~/.hermes/config.yaml under mcp_servers:\n\n agent-pass:\n url: "${http.url}"\n headers:\n Authorization: "${http.headers.Authorization}"\n\nThen restart Hermes; the tools appear in "hermes tools list".`);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
await cli('hermes', ['mcp', 'remove', 'agent-pass'], true).catch(() => { });
|
|
168
|
+
await cli('hermes', [
|
|
169
|
+
'mcp',
|
|
170
|
+
'add',
|
|
171
|
+
'agent-pass',
|
|
172
|
+
'--command',
|
|
173
|
+
stdio.command,
|
|
174
|
+
'--args',
|
|
175
|
+
...stdio.args,
|
|
176
|
+
]);
|
|
177
|
+
console.log('Registered agent-pass with Hermes (hermes mcp add). Restart Hermes to load it.');
|
|
188
178
|
return;
|
|
179
|
+
}
|
|
189
180
|
case 'codex': {
|
|
190
181
|
// `codex mcp add` writes ~/.codex/config.toml itself; an HTTP signer's bearer header has
|
|
191
182
|
// no flag there, so that form is printed to paste.
|
|
@@ -241,14 +232,14 @@ async function installSkill(client) {
|
|
|
241
232
|
await symlink(source, target, 'dir');
|
|
242
233
|
console.log(`${temporary ? 'Copied' : 'Linked'} the agent-pass skill into ${target}.`);
|
|
243
234
|
}
|
|
244
|
-
/**
|
|
235
|
+
/** Detected agents first; other clients remain available through a separate manual menu. */
|
|
245
236
|
async function chooseClients() {
|
|
246
237
|
const home = homedir();
|
|
247
|
-
const found = async (path) => access(path).then(() =>
|
|
238
|
+
const found = async (path) => access(path).then(() => true, () => false);
|
|
248
239
|
const onPath = (bin) => new Promise((done) => {
|
|
249
240
|
const child = spawn('sh', ['-c', `command -v ${bin}`], { stdio: 'ignore' });
|
|
250
|
-
child.once('error', () => done(
|
|
251
|
-
child.once('exit', (code) => done(code === 0
|
|
241
|
+
child.once('error', () => done(false));
|
|
242
|
+
child.once('exit', (code) => done(code === 0));
|
|
252
243
|
});
|
|
253
244
|
const desktopConfig = process.platform === 'darwin'
|
|
254
245
|
? join(home, 'Library/Application Support/Claude')
|
|
@@ -262,15 +253,43 @@ async function chooseClients() {
|
|
|
262
253
|
found(join(home, '.hermes')),
|
|
263
254
|
found(join(home, '.codex')),
|
|
264
255
|
]);
|
|
256
|
+
const choices = [
|
|
257
|
+
{ name: 'Claude Code', value: 'claude-code', found: claude },
|
|
258
|
+
{ name: 'Claude Desktop', value: 'claude-desktop', found: desktop },
|
|
259
|
+
{ name: 'Cursor', value: 'cursor', found: cursor },
|
|
260
|
+
{ name: 'Hermes', value: 'hermes', found: hermes },
|
|
261
|
+
{ name: 'Codex', value: 'codex', found: codex },
|
|
262
|
+
{ name: 'Generic MCP configuration', value: 'json', found: false },
|
|
263
|
+
];
|
|
264
|
+
if (!choices.some((c) => c.found))
|
|
265
|
+
console.log('No supported agents detected. Choose Other / manual setup to configure one.');
|
|
265
266
|
console.log('Pick one at a time with the arrow keys and enter; add more after.');
|
|
266
|
-
const picked =
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
267
|
+
const picked = [];
|
|
268
|
+
while (picked.length < choices.length) {
|
|
269
|
+
const remaining = choices.filter((c) => !picked.includes(c.value));
|
|
270
|
+
const manual = remaining.filter((c) => !c.found);
|
|
271
|
+
const pick = await select({
|
|
272
|
+
message: `Which agent may use your passes?${picked.length ? ` (${picked.length} picked so far)` : ''}`,
|
|
273
|
+
choices: [
|
|
274
|
+
...remaining.filter((c) => c.found),
|
|
275
|
+
...(manual.length ? [{ name: 'Other / manual setup', value: 'manual' }] : []),
|
|
276
|
+
{ name: "That's all", value: null },
|
|
277
|
+
],
|
|
278
|
+
});
|
|
279
|
+
if (pick === null)
|
|
280
|
+
break;
|
|
281
|
+
if (pick === 'manual') {
|
|
282
|
+
const client = await select({
|
|
283
|
+
message: 'Choose a client to configure manually',
|
|
284
|
+
choices: [...manual, { name: 'Back', value: null }],
|
|
285
|
+
});
|
|
286
|
+
if (client !== null)
|
|
287
|
+
picked.push(client);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
picked.push(pick);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
274
293
|
if (picked.length === 0) {
|
|
275
294
|
const finish = await select({
|
|
276
295
|
message: 'No agent picked. Finish without registering any?',
|