@memnexus-ai/mx-agent-cli 0.1.273 → 0.1.274

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.
Files changed (26) hide show
  1. package/dist/__tests__/coordination-401-production-wiring.test.d.ts +19 -0
  2. package/dist/__tests__/coordination-401-production-wiring.test.d.ts.map +1 -0
  3. package/dist/__tests__/coordination-401-production-wiring.test.js +97 -0
  4. package/dist/__tests__/coordination-401-production-wiring.test.js.map +1 -0
  5. package/dist/__tests__/coordination-401-recovery.test.d.ts +22 -0
  6. package/dist/__tests__/coordination-401-recovery.test.d.ts.map +1 -0
  7. package/dist/__tests__/coordination-401-recovery.test.js +577 -0
  8. package/dist/__tests__/coordination-401-recovery.test.js.map +1 -0
  9. package/dist/__tests__/coordination-brief-pin.test.js +10 -2
  10. package/dist/__tests__/coordination-brief-pin.test.js.map +1 -1
  11. package/dist/__tests__/coordination-brief.test.js +9 -1
  12. package/dist/__tests__/coordination-brief.test.js.map +1 -1
  13. package/dist/__tests__/coordination-provision.test.js +17 -2
  14. package/dist/__tests__/coordination-provision.test.js.map +1 -1
  15. package/dist/__tests__/coordination-token.test.js +24 -0
  16. package/dist/__tests__/coordination-token.test.js.map +1 -1
  17. package/dist/agent-config/hooks/coordination-brief.sh +61 -9
  18. package/dist/commands/coordination.d.ts +40 -6
  19. package/dist/commands/coordination.d.ts.map +1 -1
  20. package/dist/commands/coordination.js +222 -10
  21. package/dist/commands/coordination.js.map +1 -1
  22. package/dist/lib/coordination-token.d.ts +104 -2
  23. package/dist/lib/coordination-token.d.ts.map +1 -1
  24. package/dist/lib/coordination-token.js +223 -42
  25. package/dist/lib/coordination-token.js.map +1 -1
  26. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"coordination-token.d.ts","sourceRoot":"","sources":["../../src/lib/coordination-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAUH;;;;;;G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;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,yEAAyE;IACzE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,kBAAkB,CAgG/G"}
@@ -27,6 +27,12 @@
27
27
  * report "unprovisioned" so the caller degrades, never crash.
28
28
  * - Fail-CLOSED only on a roster mismatch.
29
29
  *
30
+ * ROTATION RECOVERY (#4970): resolveCoordinationToken serves the per-worktree
31
+ * cache unconditionally, so a rotated secret would be presented forever. The
32
+ * companion refreshCoordinationToken() deletes that cache and refetches from the
33
+ * vault; it runs the SAME identity gates (slug validity, marker, roster) so a
34
+ * rejected token can never be turned into a fetch the first resolve would refuse.
35
+ *
30
36
  * ZERO-ORPHAN KV shim (Phase 1): the secret name is the parse-safe double-hyphen
31
37
  * `coordination-token--<project>--<team>` (ND-1). For the DEFAULT project
32
38
  * (memnexus) the live Key Vault still holds the PRE-migration single-hyphen
@@ -36,7 +42,7 @@
36
42
  * vault; Phase 2 renames the secrets and the fallback is removed.
37
43
  */
38
44
  import { execFileSync } from 'node:child_process';
39
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
45
+ import { existsSync, readFileSync, writeFileSync, rmSync } from 'node:fs';
40
46
  import { join } from 'node:path';
41
47
  import { getConfigValue } from './config.js';
42
48
  import { CONFIG_KEY_TOKEN } from './coordination-client.js';
@@ -110,15 +116,37 @@ function defaultFetchSecret(vault, secretName) {
110
116
  return undefined;
111
117
  }
112
118
  }
113
- /** SF-3 born-0600 cache write. A write failure is tolerated (fail-open). */
119
+ /**
120
+ * SF-3 born-0600 cache write. A write failure is tolerated (fail-open) but is
121
+ * REPORTED: `true` only when the bytes actually landed. Callers use that to decide
122
+ * whether they may tell the operator a cached copy was replaced — see writeCache
123
+ * in TokenResolveDeps.
124
+ */
114
125
  function defaultWriteCache(path, value) {
115
126
  try {
116
127
  writeFileSync(path, value, { mode: 0o600 });
128
+ return true;
117
129
  }
118
130
  catch {
119
131
  /* A cache-write failure must not break provisioning — the token is still returned. */
132
+ return false;
120
133
  }
121
134
  }
135
+ /**
136
+ * A fetched secret is usable only if it has non-whitespace content.
137
+ *
138
+ * SF-4 of the #4970 delta security review. The guard below is what keeps a
139
+ * useless vault answer from deleting the ONLY local copy of the token, and it
140
+ * must reject every falsy AND blank value, not just `undefined`: the default
141
+ * fetcher happens to normalise `''` away (`trimmed || undefined`), but that is one
142
+ * line of a DIFFERENT function, and a fetcher that does not — a test double, or a
143
+ * future non-`az` backend — would otherwise delete the cache and write a blank
144
+ * file, restoring the exact defect this round closed. Whitespace-only is rejected
145
+ * here rather than trusted to the fetcher for the same reason.
146
+ */
147
+ function isUsableSecret(value) {
148
+ return typeof value === 'string' && value.trim() !== '';
149
+ }
122
150
  /** Extract the first line and strip all whitespace (marker/cache are single-value). */
123
151
  function firstLineNoSpace(raw) {
124
152
  const firstLine = raw.split(/\r?\n/, 1)[0] ?? '';
@@ -154,6 +182,52 @@ export function resolveRoster(project, env, readFileText) {
154
182
  }
155
183
  return BUILTIN_ROSTERS[project] ?? [];
156
184
  }
185
+ function resolveIdentity(env, readFileText, projectOverride) {
186
+ // Resolve the PROJECT (config-derived, default memnexus). Never throws.
187
+ const project = projectOverride ?? resolveProductSlug();
188
+ // Validate the resolved project slug BEFORE any roster lookup or az/KV call
189
+ // (KI-COORDMT-CLIENT-SLUG-VALIDATION). The default 'memnexus' is known-valid so
190
+ // this never trips the unset path; an explicitly-set invalid slug fails CLOSED
191
+ // as a typed result — it is NOT coerced to memnexus (that would bleed the
192
+ // misconfigured project's traffic into the memnexus tenant). No KV-name is
193
+ // built for an invalid slug.
194
+ if (!isValidProjectSlug(project)) {
195
+ return { ok: false, fail: { status: 'misconfigured', project, detail: invalidProjectSlugMessage(project) } };
196
+ }
197
+ // MF-2: read the authoritative team marker. No worktree/marker → fail-OPEN.
198
+ const worktree = env.CLAUDE_WORKTREE_PATH;
199
+ if (!worktree) {
200
+ return { ok: false, fail: { status: 'unprovisioned', project, detail: 'CLAUDE_WORKTREE_PATH is unset — cannot locate the coordination marker' } };
201
+ }
202
+ const markerRaw = readFileText(join(worktree, MARKER_FILE));
203
+ if (markerRaw === undefined) {
204
+ return { ok: false, fail: { status: 'unprovisioned', project, detail: 'no coordination marker (.mx-coordination-team) in this worktree' } };
205
+ }
206
+ const slug = firstLineNoSpace(markerRaw);
207
+ if (!slug) {
208
+ return { ok: false, fail: { status: 'unprovisioned', project, detail: 'coordination marker is empty' } };
209
+ }
210
+ // SF-2: roster-membership gate for THIS project BEFORE any az call. The roster
211
+ // comes from the OFFLINE file (single source), builtin fallback.
212
+ const roster = resolveRoster(project, env, readFileText);
213
+ if (!roster.includes(slug)) {
214
+ return { ok: false, fail: { status: 'not-on-roster', project, slug } };
215
+ }
216
+ // MF-1: (project, team)-bound per-worktree cache.
217
+ return { ok: true, id: { project, slug, cachePath: join(worktree, cacheFileName(project, slug)) } };
218
+ }
219
+ /**
220
+ * Fetch this identity's token from Key Vault. Primary: parse-safe double-hyphen
221
+ * name (ND-1). Fallback (memnexus only): legacy single-hyphen name — the
222
+ * zero-orphan dual-read against the un-migrated live vault (Phase 2 removes it).
223
+ */
224
+ function fetchFromKeyVault(id, fetchSecret) {
225
+ let fetched = fetchSecret(KEYVAULT_NAME, kvSecretName(id.project, id.slug));
226
+ if (!isUsableSecret(fetched) && id.project === DEFAULT_PRODUCT_SLUG) {
227
+ fetched = fetchSecret(KEYVAULT_NAME, legacyKvSecretName(id.slug));
228
+ }
229
+ return fetched;
230
+ }
157
231
  /**
158
232
  * Resolve the coordination token, self-provisioning from Key Vault when none is
159
233
  * configured. Never throws — every failure is a typed result the caller acts on.
@@ -176,54 +250,25 @@ export function resolveCoordinationToken(deps = {}) {
176
250
  }
177
251
  if (configToken)
178
252
  return { status: 'already-configured', token: configToken, source: 'config' };
179
- // 2. Resolve the PROJECT (config-derived, default memnexus). Never throws.
180
- const project = deps.project ?? resolveProductSlug();
181
- // 2a. Validate the resolved project slug BEFORE any roster lookup or az/KV
182
- // call (KI-COORDMT-CLIENT-SLUG-VALIDATION). The default 'memnexus' is
183
- // known-valid so this never trips the unset path; an explicitly-set
184
- // invalid slug fails CLOSED as a typed result — it is NOT coerced to
185
- // memnexus (that would bleed the misconfigured project's traffic into the
186
- // memnexus tenant). No KV-name is built for an invalid slug.
187
- if (!isValidProjectSlug(project)) {
188
- return { status: 'misconfigured', project, detail: invalidProjectSlugMessage(project) };
189
- }
190
- // 3. MF-2: read the authoritative team marker. No worktree/marker → fail-OPEN.
191
- const worktree = env.CLAUDE_WORKTREE_PATH;
192
- if (!worktree) {
193
- return { status: 'unprovisioned', project, detail: 'CLAUDE_WORKTREE_PATH is unset — cannot locate the coordination marker' };
194
- }
195
- const markerRaw = readFileText(join(worktree, MARKER_FILE));
196
- if (markerRaw === undefined) {
197
- return { status: 'unprovisioned', project, detail: 'no coordination marker (.mx-coordination-team) in this worktree' };
198
- }
199
- const slug = firstLineNoSpace(markerRaw);
200
- if (!slug) {
201
- return { status: 'unprovisioned', project, detail: 'coordination marker is empty' };
202
- }
203
- // 4. SF-2: roster-membership gate for THIS project BEFORE any az call. The
204
- // roster comes from the OFFLINE file (single source), builtin fallback.
205
- const roster = resolveRoster(project, env, readFileText);
206
- if (!roster.includes(slug)) {
207
- return { status: 'not-on-roster', project, slug };
208
- }
253
+ // 2-4. Resolve + gate the (project, team) identity: project slug validity,
254
+ // authoritative marker, roster membership. Shared with the 401 refresh
255
+ // path so both obey the same gates.
256
+ const identity = resolveIdentity(env, readFileText, deps.project);
257
+ if (!identity.ok)
258
+ return identity.fail;
259
+ const { project, slug, cachePath } = identity.id;
209
260
  // 5. MF-1: (project, team)-bound per-worktree cache.
210
- const cachePath = join(worktree, cacheFileName(project, slug));
211
261
  const cachedRaw = readFileText(cachePath);
212
262
  if (cachedRaw) {
213
263
  const cached = firstLineNoSpace(cachedRaw);
214
264
  if (cached)
215
265
  return { status: 'resolved', token: cached, project, slug, source: 'cache' };
216
266
  }
217
- // 6. Fetch from Key Vault. Primary: parse-safe double-hyphen name (ND-1).
218
- // Fallback (memnexus only): legacy single-hyphen name — the zero-orphan
219
- // dual-read against the un-migrated live vault (Phase 2 removes it).
267
+ // 6. Fetch from Key Vault (ND-1 primary name, memnexus legacy fallback).
220
268
  const fetchSecret = deps.fetchSecret ?? defaultFetchSecret;
221
- let fetched = fetchSecret(KEYVAULT_NAME, kvSecretName(project, slug));
222
- let source = 'keyvault';
223
- if (!fetched && project === DEFAULT_PRODUCT_SLUG) {
224
- fetched = fetchSecret(KEYVAULT_NAME, legacyKvSecretName(slug));
225
- }
226
- if (!fetched) {
269
+ const fetched = fetchFromKeyVault(identity.id, fetchSecret);
270
+ const source = 'keyvault';
271
+ if (!isUsableSecret(fetched)) {
227
272
  return {
228
273
  status: 'unprovisioned',
229
274
  project,
@@ -236,4 +281,140 @@ export function resolveCoordinationToken(deps = {}) {
236
281
  writeCache(cachePath, fetched);
237
282
  return { status: 'resolved', token: fetched, project, slug, source };
238
283
  }
284
+ /** Default cache deletion. A failure is reported, never thrown (fail-open). */
285
+ function defaultRemoveFile(path) {
286
+ try {
287
+ if (!existsSync(path))
288
+ return false;
289
+ rmSync(path, { force: true });
290
+ return true;
291
+ }
292
+ catch {
293
+ return false;
294
+ }
295
+ }
296
+ /**
297
+ * Invalidate the per-worktree token cache and refetch the team's token from its
298
+ * source, for retry after the coordination service REJECTED the current token
299
+ * (HTTP 401 — #4970).
300
+ *
301
+ * Why this exists: resolveCoordinationToken returns the per-worktree cache
302
+ * unconditionally when it is non-empty, and nothing anywhere deleted that cache
303
+ * on an HTTP error. After a token rotation every session-start brief would
304
+ * present the dead cached token forever, with no self-heal.
305
+ *
306
+ * Order of preference:
307
+ * 1. The cache already holds a DIFFERENT token — another process (or the
308
+ * hook) refreshed it since this client was built. Use it; do NOT delete a
309
+ * cache entry we never proved bad, and do NOT spend an `az` call.
310
+ * 2. Otherwise refetch from Key Vault and, ONLY if that yields a token,
311
+ * replace the cache with it (deleted, then re-written born 0600) so nothing
312
+ * — this process, the session-start hook, or a later run — can serve the
313
+ * rejected token again. If the fetch yields nothing the cache is LEFT
314
+ * ALONE: see the comment at the fetch below; deleting it converts a loud
315
+ * repeating failure into permanent silence. That "stays loud" guarantee
316
+ * holds only where a cache actually exists, so the returned detail is
317
+ * derived from the cache that was read — the no-cache case is reported as
318
+ * the one that will go silent and needs a human (SF-1).
319
+ *
320
+ * The SAME identity gates as the first resolve apply (valid project slug,
321
+ * authoritative marker, roster membership), so a 401 can never be turned into a
322
+ * fetch of a secret the initial resolve would have refused. Never throws, never
323
+ * logs the token, and never writes to the global config.
324
+ *
325
+ * `rejectedToken` is compared but never logged; pass '' when it is unknown.
326
+ */
327
+ export function refreshCoordinationToken(rejectedToken, deps = {}) {
328
+ const env = deps.env ?? process.env;
329
+ const readFileText = deps.readFileText ?? defaultReadFileText;
330
+ const identity = resolveIdentity(env, readFileText, deps.project);
331
+ if (!identity.ok)
332
+ return identity.fail;
333
+ const { project, slug, cachePath } = identity.id;
334
+ const cachedRaw = readFileText(cachePath);
335
+ const cached = cachedRaw ? firstLineNoSpace(cachedRaw) : '';
336
+ if (cached && cached !== rejectedToken) {
337
+ return { status: 'refreshed', token: cached, project, slug, source: 'cache', cacheInvalidated: false };
338
+ }
339
+ // FETCH FIRST, DELETE ONLY ON SUCCESS. Do NOT reorder this — the obvious
340
+ // "invalidate then refetch" order is a silent-outage bug (security review of
341
+ // #4970), and the reasoning is load-bearing:
342
+ //
343
+ // The az fetch is documented FAIL-OPEN, and "az not logged in" is an EXPECTED
344
+ // state in an agent worktree. Deleting first and then failing to fetch leaves
345
+ // the worktree with NO token at all. The session-start hook then finds no
346
+ // cache, its own az fetch fails too, and it takes its fail-open branch:
347
+ // exit 0 with NO OUTPUT. The brief is never invoked again, so neither the
348
+ // CLI's loud TOKEN REJECTED block nor the hook's 401 block can ever fire —
349
+ // session N is loud, every session after it is SILENT, on the channel that
350
+ // carries P0 escalations, until a human happens to run `az login`.
351
+ //
352
+ // Keeping the rejected token on disk is strictly better: it is refused again
353
+ // next session, which keeps the 401 — and therefore the loud block — firing
354
+ // every single session until someone fixes it. A credential the service
355
+ // already refuses grants nothing; losing the ONLY local copy costs the alarm.
356
+ //
357
+ // So: nothing is deleted unless we hold a replacement in hand.
358
+ const fetchSecret = deps.fetchSecret ?? defaultFetchSecret;
359
+ const fetched = fetchFromKeyVault(identity.id, fetchSecret);
360
+ if (!isUsableSecret(fetched)) {
361
+ // SF-1 of the delta security review: which of the TWO states we are in decides
362
+ // whether the loudness guarantee above actually holds, so the message is
363
+ // derived from the cache we just read, never asserted unconditionally.
364
+ //
365
+ // (a) The cache still holds the rejected token. The reasoning above applies
366
+ // verbatim: it is presented again next session, refused again, and the
367
+ // loud block fires again. Nothing to do beyond fixing the vault.
368
+ // (b) There is NO cached token — no cache file, an empty/whitespace-only
369
+ // one, or a write that failed earlier (the hook's cache write ends in
370
+ // `|| true`, and a token supplied via MX_COORD_SERVICE_TOKEN or the
371
+ // global config never writes a cache at all). Then the guarantee does
372
+ // NOT hold: next session resolveCoordinationToken finds no cache, its own
373
+ // az fetch fails, the session-start hook takes its fail-open exit 0 with
374
+ // no output, and the channel that carries P0 escalations goes silent with
375
+ // nothing on screen. This state needs a human before the next session,
376
+ // and the message has to say so — it is the only warning that gets shown.
377
+ const rejectedStillCached = cached !== '' && cached === rejectedToken;
378
+ return {
379
+ status: 'unprovisioned',
380
+ project,
381
+ slug,
382
+ cacheInvalidated: false,
383
+ detail: rejectedStillCached
384
+ ? 'Key Vault returned no token (az not logged in, KV unreachable, or secret missing); ' +
385
+ 'the rejected token was LEFT in the per-worktree cache on purpose, so this failure stays loud every session'
386
+ : 'Key Vault returned no token (az not logged in, KV unreachable, or secret missing), and this worktree ' +
387
+ 'holds NO cached token to fail loudly with. NEEDS MANUAL ATTENTION BEFORE THE NEXT SESSION: the next ' +
388
+ 'session-start brief will find no cache, fail the same fetch, and exit silently with no output, so ' +
389
+ 'queued cross-team escalations will read as an empty inbox. Run `az login` in this worktree, or ask the ' +
390
+ 'platform team to re-issue this team\'s token (P1).',
391
+ };
392
+ }
393
+ // Delete-then-write, in that order, is deliberate: writeFileSync applies `mode`
394
+ // only when it CREATES the file, so writing over a surviving entry would inherit
395
+ // whatever mode it already had and lose the SF-3 born-0600 property. Writing
396
+ // first and deleting after cannot fix SF-2 either — both operations target the
397
+ // same path. So the order stays and the CLAIM is what changes: cacheInvalidated
398
+ // is the result of the WRITE, not of the delete.
399
+ const removeFile = deps.removeFile ?? defaultRemoveFile;
400
+ const removed = removeFile(cachePath);
401
+ const writeCache = deps.writeCache ?? defaultWriteCache;
402
+ // A stub that reports nothing leaves the outcome UNKNOWN, and neither claim is
403
+ // made from an unknown: `true` is required to say a copy was replaced, `false`
404
+ // is required to say the write was lost.
405
+ const writeResult = writeCache(cachePath, fetched);
406
+ return {
407
+ status: 'refreshed',
408
+ token: fetched,
409
+ project,
410
+ slug,
411
+ source: 'keyvault',
412
+ // Replaced = the old entry is gone AND the new one landed. `removed === false`
413
+ // with a successful write is a first-time cache fill, not a replacement.
414
+ cacheInvalidated: removed && writeResult === true,
415
+ cacheWriteFailed: writeResult === false,
416
+ cacheRemoved: removed,
417
+ unchanged: fetched === rejectedToken,
418
+ };
419
+ }
239
420
  //# sourceMappingURL=coordination-token.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coordination-token.js","sourceRoot":"","sources":["../../src/lib/coordination-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAA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-agent-cli",
3
- "version": "0.1.273",
3
+ "version": "0.1.274",
4
4
  "description": "CLI for creating and managing AI agent teams",
5
5
  "type": "module",
6
6
  "bin": {