@mysten-incubation/sui-agent-pass 0.1.19 → 0.1.20
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 +14 -3
- package/dist/cli.js +45 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ agent-pass connect # connect all detected agents, or choose specific ones
|
|
|
64
64
|
|
|
65
65
|
That is the only command. For each agent you pick it registers the MCP server and links the
|
|
66
66
|
`agent-pass` skill, the playbook built into the package, into the agent's skills folder (Claude
|
|
67
|
-
Code, Codex, Cursor and
|
|
67
|
+
Code, Codex, Cursor, Hermes and OpenClaw), so the agent has the tools and the guidance for them. A link
|
|
68
68
|
follows upgrades; rerun `connect` if you installed through `npx`. Then open the agent and tell
|
|
69
69
|
it what to do with your money. It
|
|
70
70
|
proposes a pass (`propose_authorization`) and opens the review page with the proposal in its URL.
|
|
@@ -94,8 +94,9 @@ writes or prints the entry in the right place:
|
|
|
94
94
|
| `claude-code` | `claude mcp add` in user scope |
|
|
95
95
|
| `claude-desktop` | Writes into `claude_desktop_config.json` |
|
|
96
96
|
| `cursor` | Writes into `~/.cursor/mcp.json` |
|
|
97
|
-
| `hermes` |
|
|
98
|
-
| `codex` |
|
|
97
|
+
| `hermes` | Uses `hermes mcp add`; prints configuration for `--session` |
|
|
98
|
+
| `codex` | Uses `codex mcp add`; prints configuration for `--session` |
|
|
99
|
+
| `openclaw` | Uses `openclaw mcp set` in the active OpenClaw profile |
|
|
99
100
|
| `json` | Prints a generic `mcpServers` entry |
|
|
100
101
|
|
|
101
102
|
The entry is `agent-pass mcp`, a stdio server the client starts when it needs it and stops with
|
|
@@ -105,6 +106,16 @@ also set a pass up. While it runs it also serves each pass's HTTP signer, which
|
|
|
105
106
|
`connect --session <directory>` instead points a client at one session's foreground signer
|
|
106
107
|
(`agent-pass serve`), for agents that cannot start a process themselves.
|
|
107
108
|
|
|
109
|
+
OpenClaw needs a release with native `openclaw mcp set` support. Stop its gateway before
|
|
110
|
+
connecting (`openclaw gateway stop` when running as a service), then run
|
|
111
|
+
`agent-pass connect --client openclaw`. Restart OpenClaw and start a new chat session afterward.
|
|
112
|
+
Registration uses OpenClaw's own CLI and its reported managed skills directory, so custom
|
|
113
|
+
state directories and profiles stay aligned. For a named profile, use
|
|
114
|
+
`OPENCLAW_PROFILE=<name> agent-pass connect --client openclaw`; `OPENCLAW_HOME` and
|
|
115
|
+
`OPENCLAW_STATE_DIR` are passed through to OpenClaw. OpenClaw must run on the machine where
|
|
116
|
+
Agent Pass is installed and have access to a local Node runtime for SDK scripts; remote
|
|
117
|
+
gateways need their own installation.
|
|
118
|
+
|
|
108
119
|
Acting is a Node script against the SDK. `session_info.sdk.install` is the install command
|
|
109
120
|
(`npm install <this checkout>` after `npm run build` while the package is unpublished), then:
|
|
110
121
|
|
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Copyright (c) Mysten Labs, Inc.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import { spawn } from 'node:child_process';
|
|
4
|
+
import { execFile, spawn } from 'node:child_process';
|
|
5
5
|
import { realpathSync } from 'node:fs';
|
|
6
6
|
import { access, cp, lstat, mkdir, readFile, rm, symlink, writeFile } from 'node:fs/promises';
|
|
7
7
|
import { homedir } from 'node:os';
|
|
8
|
-
import { dirname, join, resolve, sep } from 'node:path';
|
|
8
|
+
import { dirname, isAbsolute, join, resolve, sep } from 'node:path';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { promisify } from 'node:util';
|
|
10
11
|
import { checkbox, select } from '@inquirer/prompts';
|
|
11
12
|
import { Command } from 'commander';
|
|
12
13
|
import { clientFor, readStatus } from './chain.js';
|
|
@@ -17,7 +18,7 @@ const quote = (s) => `'${s.replaceAll("'", "'\\''")}'`;
|
|
|
17
18
|
export async function serve(store, port = 0, open = true) {
|
|
18
19
|
const server = await startServer(store, port);
|
|
19
20
|
console.log(`\nOwner page: ${server.ownerUrl}\nSession address: ${store.state.sessionAddress}\nSession directory: ${store.directory}`);
|
|
20
|
-
console.log(`\nAfter authorization, register the signer with your agent (from the agent's working directory for Claude Code):\n${cliInvocation().map(quote).join(' ')} connect --session ${quote(store.directory)} --client claude-code\nOther clients: --client claude-desktop | cursor | hermes | codex | json\n\nKeep this process running. Ctrl-C stops signing; use the owner page to revoke on chain.`);
|
|
21
|
+
console.log(`\nAfter authorization, register the signer with your agent (from the agent's working directory for Claude Code):\n${cliInvocation().map(quote).join(' ')} connect --session ${quote(store.directory)} --client claude-code\nOther clients: --client claude-desktop | cursor | hermes | codex | openclaw | json\n\nKeep this process running. Ctrl-C stops signing; use the owner page to revoke on chain.`);
|
|
21
22
|
if (open)
|
|
22
23
|
openBrowser(server.ownerUrl);
|
|
23
24
|
const stop = () => {
|
|
@@ -76,15 +77,29 @@ program
|
|
|
76
77
|
const { url } = await servePluginHttp(options, Number(o.http));
|
|
77
78
|
console.error(`agent-pass MCP at ${url}; bearer token in ${join(options.root, 'mcp-http.json')}`);
|
|
78
79
|
});
|
|
79
|
-
const CLIENTS = [
|
|
80
|
+
const CLIENTS = [
|
|
81
|
+
'claude-code',
|
|
82
|
+
'claude-desktop',
|
|
83
|
+
'cursor',
|
|
84
|
+
'hermes',
|
|
85
|
+
'codex',
|
|
86
|
+
'openclaw',
|
|
87
|
+
'json',
|
|
88
|
+
];
|
|
80
89
|
const CLIENT_NAMES = {
|
|
81
90
|
'claude-code': 'Claude Code',
|
|
82
91
|
'claude-desktop': 'Claude Desktop',
|
|
83
92
|
cursor: 'Cursor',
|
|
84
93
|
hermes: 'Hermes',
|
|
85
94
|
codex: 'Codex',
|
|
95
|
+
openclaw: 'OpenClaw',
|
|
86
96
|
json: 'Generic MCP configuration',
|
|
87
97
|
};
|
|
98
|
+
/** OpenClaw's CLI selects named profiles through a root option, not the environment alone. */
|
|
99
|
+
function openclawArgs(args) {
|
|
100
|
+
const profile = process.env.OPENCLAW_PROFILE?.trim();
|
|
101
|
+
return profile ? ['--profile', profile, ...args] : args;
|
|
102
|
+
}
|
|
88
103
|
/** Merges one server entry into a JSON MCP config file, creating it if needed. */
|
|
89
104
|
async function mergeJsonConfig(path, entry) {
|
|
90
105
|
const current = await readFile(path, 'utf8')
|
|
@@ -197,6 +212,19 @@ async function registerClient(client, http) {
|
|
|
197
212
|
console.log('Registered agent-pass with Codex (codex mcp add).');
|
|
198
213
|
return;
|
|
199
214
|
}
|
|
215
|
+
case 'openclaw':
|
|
216
|
+
// Let OpenClaw validate and update its own registry, including profile/state overrides.
|
|
217
|
+
// `set` replaces only our entry and refuses to write while its gateway owns the state.
|
|
218
|
+
await cli('openclaw', openclawArgs([
|
|
219
|
+
'mcp',
|
|
220
|
+
'set',
|
|
221
|
+
'agent-pass',
|
|
222
|
+
JSON.stringify({
|
|
223
|
+
...(http ? { ...http, transport: 'streamable-http' } : stdio),
|
|
224
|
+
requestTimeoutMs: 180_000, // session_info can wait 120 seconds for wallet consent.
|
|
225
|
+
}),
|
|
226
|
+
]));
|
|
227
|
+
return;
|
|
200
228
|
case 'json':
|
|
201
229
|
console.log(JSON.stringify({ mcpServers: { 'agent-pass': http ?? stdio } }, null, 2));
|
|
202
230
|
}
|
|
@@ -216,14 +244,22 @@ async function installSkill(client) {
|
|
|
216
244
|
const source = fileURLToPath(new URL('../skills/agent-pass', import.meta.url));
|
|
217
245
|
if (!(await access(join(source, 'SKILL.md')).then(() => true, () => false)))
|
|
218
246
|
throw new Error(`The skill is missing from ${source}; run npm run build`);
|
|
219
|
-
|
|
247
|
+
let dir = SKILL_DIRS[client];
|
|
248
|
+
if (client === 'openclaw') {
|
|
249
|
+
// Ask the client for its managed directory so profiles and custom state roots stay aligned.
|
|
250
|
+
const { stdout } = await promisify(execFile)('openclaw', openclawArgs(['skills', 'list', '--json']));
|
|
251
|
+
const report = JSON.parse(stdout);
|
|
252
|
+
if (typeof report.managedSkillsDir !== 'string' || !isAbsolute(report.managedSkillsDir))
|
|
253
|
+
throw new Error('OpenClaw did not report an absolute managed skills directory');
|
|
254
|
+
dir = report.managedSkillsDir;
|
|
255
|
+
}
|
|
220
256
|
if (!dir) {
|
|
221
257
|
console.log(client === 'claude-desktop'
|
|
222
258
|
? `Claude Desktop takes skills from its own settings; add ${join(source, 'SKILL.md')} there to give it the playbook.`
|
|
223
259
|
: `If the agent loads SKILL.md skills, link ${source} into its skills folder to give it the playbook.`);
|
|
224
260
|
return;
|
|
225
261
|
}
|
|
226
|
-
const target = join(homedir(), dir, 'agent-pass');
|
|
262
|
+
const target = join(isAbsolute(dir) ? dir : join(homedir(), dir), 'agent-pass');
|
|
227
263
|
const existing = await lstat(target).catch(() => null);
|
|
228
264
|
if (existing && !existing.isSymbolicLink()) {
|
|
229
265
|
const ours = await readFile(join(target, 'SKILL.md'), 'utf8').then((t) => /^name: agent-pass$/m.test(t), () => false);
|
|
@@ -254,17 +290,19 @@ async function chooseClients(http = false) {
|
|
|
254
290
|
: process.platform === 'win32'
|
|
255
291
|
? join(process.env.APPDATA ?? join(home, 'AppData/Roaming'), 'Claude')
|
|
256
292
|
: join(home, '.config/Claude');
|
|
257
|
-
const [claude, desktop, hermes, codex] = await Promise.all([
|
|
293
|
+
const [claude, desktop, hermes, codex, openclaw] = await Promise.all([
|
|
258
294
|
onPath('claude'),
|
|
259
295
|
found(desktopConfig),
|
|
260
296
|
onPath('hermes'),
|
|
261
297
|
onPath('codex'),
|
|
298
|
+
onPath('openclaw'),
|
|
262
299
|
]);
|
|
263
300
|
const detected = {
|
|
264
301
|
'claude-code': claude,
|
|
265
302
|
'claude-desktop': desktop,
|
|
266
303
|
hermes,
|
|
267
304
|
codex,
|
|
305
|
+
openclaw,
|
|
268
306
|
};
|
|
269
307
|
const choices = CLIENTS.filter((client) => !http || client !== 'claude-desktop').map((client) => ({ name: CLIENT_NAMES[client], value: client, found: !!detected[client] }));
|
|
270
308
|
const available = choices.filter((c) => c.found);
|