@mysten-incubation/sui-agent-pass 0.1.13 → 0.1.15

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/dist/cli.js CHANGED
@@ -112,6 +112,18 @@ async function mergeJsonConfig(path, entry) {
112
112
  console.log(`Wrote agent-pass into ${path}. Restart the client to load it.`);
113
113
  }
114
114
  /** Registers agent-pass with Claude Code, replacing an earlier entry in the same scope. */
115
+ /** Runs a client's own CLI; the client is not on this machine when the command cannot start. */
116
+ function cli(bin, args, quiet = false) {
117
+ return new Promise((resolve, reject) => {
118
+ const child = spawn(bin, args, { stdio: quiet ? 'ignore' : 'inherit' });
119
+ child.once('error', (e) => reject(e.code === 'ENOENT'
120
+ ? new Error(`${bin} is not on PATH; install it or pick another client`)
121
+ : e));
122
+ child.once('exit', (code) => code === 0
123
+ ? resolve()
124
+ : reject(new Error(`${bin} ${args.slice(0, 2).join(' ')} exited ${code}`)));
125
+ });
126
+ }
115
127
  async function claudeMcpAdd(args) {
116
128
  const scope = args[args.indexOf('--scope') + 1];
117
129
  await new Promise((done) => {
@@ -174,11 +186,18 @@ async function registerClient(client, http) {
174
186
  ? ` url: "${http.url}"\n headers:\n Authorization: "${http.headers.Authorization}"`
175
187
  : ` command: "${stdio.command}"\n args: ${JSON.stringify(stdio.args)}`}\n\nThen restart Hermes; the tools appear in "hermes tools list".`);
176
188
  return;
177
- case 'codex':
178
- console.log(`Add to ~/.codex/config.toml:\n\n[mcp_servers.agent-pass]\n${http
179
- ? `url = "${http.url}"\nhttp_headers = { Authorization = "${http.headers.Authorization}" }`
180
- : `command = "${stdio.command}"\nargs = ${JSON.stringify(stdio.args)}`}\n`);
189
+ case 'codex': {
190
+ // `codex mcp add` writes ~/.codex/config.toml itself; an HTTP signer's bearer header has
191
+ // no flag there, so that form is printed to paste.
192
+ if (http) {
193
+ console.log(`Add to ~/.codex/config.toml:\n\n[mcp_servers.agent-pass]\nurl = "${http.url}"\nhttp_headers = { Authorization = "${http.headers.Authorization}" }\n`);
194
+ return;
195
+ }
196
+ await cli('codex', ['mcp', 'remove', 'agent-pass'], true).catch(() => { });
197
+ await cli('codex', ['mcp', 'add', 'agent-pass', '--', stdio.command, ...stdio.args]);
198
+ console.log('Registered agent-pass with Codex (codex mcp add). Restart Codex to load it.');
181
199
  return;
200
+ }
182
201
  case 'json':
183
202
  console.log(JSON.stringify({ mcpServers: { 'agent-pass': http ?? stdio } }, null, 2));
184
203
  }
@@ -249,7 +268,7 @@ async function chooseClients() {
249
268
  { name: `Claude Desktop${desktop}`, value: 'claude-desktop' },
250
269
  { name: `Cursor${cursor}`, value: 'cursor' },
251
270
  { name: `Hermes${hermes} (prints the config to paste)`, value: 'hermes' },
252
- { name: `Codex${codex} (prints the config to paste)`, value: 'codex' },
271
+ { name: `Codex${codex}`, value: 'codex' },
253
272
  { name: 'Something else (prints a generic MCP entry)', value: 'json' },
254
273
  ], "That's all", false);
255
274
  if (picked.length === 0) {
package/dist/plugin.js CHANGED
@@ -59,11 +59,18 @@ class Registry {
59
59
  }
60
60
  /** Sessions on disk this code cannot open, with what their files still say about the pass. */
61
61
  unreadable = new Map();
62
+ /**
63
+ * Every session on disk, each re-read: another process (the one whose watcher saw the owner
64
+ * sign, a later connect) may have changed a session file since this one loaded it.
65
+ */
62
66
  async all() {
63
67
  await mkdir(this.sessionsDir, { recursive: true, mode: 0o700 });
64
68
  for (const id of (await readdir(this.sessionsDir)).sort()) {
65
- if (this.sessions.has(id))
69
+ const known = this.sessions.get(id);
70
+ if (known) {
71
+ await known.store.refresh().catch(() => { });
66
72
  continue;
73
+ }
67
74
  try {
68
75
  this.sessions.set(id, {
69
76
  id,
package/dist/server.js CHANGED
@@ -219,7 +219,10 @@ export async function startServer(store, port = 0) {
219
219
  sessionAddress: store.state.sessionAddress,
220
220
  setup: store.state.setup,
221
221
  }),
222
- passUrl: store.state.active ? passPageUrl(d, origin, store.state.active.passId) : null,
222
+ // Read on use: the activation that makes a pass page exist lands after the server starts.
223
+ get passUrl() {
224
+ return store.state.active ? passPageUrl(d, origin, store.state.active.passId) : null;
225
+ },
223
226
  mcpUrl: `${origin}/mcp`,
224
227
  close: () => new Promise((resolve, reject) => {
225
228
  closed = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten-incubation/sui-agent-pass",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "description": "AI builds transactions. A session signer signs. Your pass enforces the rules.",
6
6
  "repository": {