@productbrain/cli 0.1.0-beta.5322 → 0.1.0-beta.5368

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 (57) hide show
  1. package/dist/__tests__/client-binding-guard.test.d.ts +2 -0
  2. package/dist/__tests__/client-binding-guard.test.d.ts.map +1 -0
  3. package/dist/__tests__/client-binding-guard.test.js +84 -0
  4. package/dist/__tests__/client-binding-guard.test.js.map +1 -0
  5. package/dist/__tests__/migrate-setup-session-refusal.test.d.ts +2 -0
  6. package/dist/__tests__/migrate-setup-session-refusal.test.d.ts.map +1 -0
  7. package/dist/__tests__/migrate-setup-session-refusal.test.js +65 -0
  8. package/dist/__tests__/migrate-setup-session-refusal.test.js.map +1 -0
  9. package/dist/__tests__/read-target-notice.test.d.ts +2 -0
  10. package/dist/__tests__/read-target-notice.test.d.ts.map +1 -0
  11. package/dist/__tests__/read-target-notice.test.js +104 -0
  12. package/dist/__tests__/read-target-notice.test.js.map +1 -0
  13. package/dist/__tests__/session-resume-backstop.test.js +1 -1
  14. package/dist/__tests__/session-resume-backstop.test.js.map +1 -1
  15. package/dist/__tests__/session-start-key-refresh.test.js +1 -1
  16. package/dist/__tests__/session-start-key-refresh.test.js.map +1 -1
  17. package/dist/__tests__/session-switch.test.js +1 -1
  18. package/dist/__tests__/session-switch.test.js.map +1 -1
  19. package/dist/__tests__/workspaceNotice.test.js +121 -26
  20. package/dist/__tests__/workspaceNotice.test.js.map +1 -1
  21. package/dist/commands/capture.js +2 -2
  22. package/dist/commands/capture.js.map +1 -1
  23. package/dist/commands/migrate-setup.d.ts.map +1 -1
  24. package/dist/commands/migrate-setup.js +12 -10
  25. package/dist/commands/migrate-setup.js.map +1 -1
  26. package/dist/commands/organisation.test.js +1 -1
  27. package/dist/commands/organisation.test.js.map +1 -1
  28. package/dist/commands/organisationHierarchy.test.js +1 -1
  29. package/dist/commands/organisationHierarchy.test.js.map +1 -1
  30. package/dist/commands/organisationWrite.js +2 -2
  31. package/dist/commands/organisationWrite.js.map +1 -1
  32. package/dist/commands/promote.js +2 -2
  33. package/dist/commands/promote.js.map +1 -1
  34. package/dist/commands/relate.js +3 -3
  35. package/dist/commands/relate.js.map +1 -1
  36. package/dist/commands/restore.js +2 -2
  37. package/dist/commands/restore.js.map +1 -1
  38. package/dist/commands/session.js +2 -2
  39. package/dist/commands/session.js.map +1 -1
  40. package/dist/commands/setup-ingest.d.ts.map +1 -1
  41. package/dist/commands/setup-ingest.js +3 -10
  42. package/dist/commands/setup-ingest.js.map +1 -1
  43. package/dist/commands/update.js +2 -2
  44. package/dist/commands/update.js.map +1 -1
  45. package/dist/lib/client.d.ts +3 -0
  46. package/dist/lib/client.d.ts.map +1 -1
  47. package/dist/lib/client.js +64 -76
  48. package/dist/lib/client.js.map +1 -1
  49. package/dist/lib/sessionBinding.d.ts +3 -1
  50. package/dist/lib/sessionBinding.d.ts.map +1 -1
  51. package/dist/lib/sessionBinding.js +9 -2
  52. package/dist/lib/sessionBinding.js.map +1 -1
  53. package/dist/lib/workspaceNotice.d.ts +42 -13
  54. package/dist/lib/workspaceNotice.d.ts.map +1 -1
  55. package/dist/lib/workspaceNotice.js +96 -14
  56. package/dist/lib/workspaceNotice.js.map +1 -1
  57. package/package.json +1 -1
@@ -17,8 +17,10 @@ import { gatewayTimeoutError, isTimeoutAbort } from './gatewayTimeout.js';
17
17
  // abort (WP-575 review). Split out under STD-2/DEC-1504; see ./kernelEnvelope.ts's header for
18
18
  // why the seam is real and not a line-count dodge.
19
19
  import { parseKernelEnvelope, recordLatestFromResponse } from './kernelEnvelope.js';
20
- import { getConfig } from './config.js';
20
+ import { getConfig, resolveEffectiveProfile } from './config.js';
21
21
  import { resolveAdminConfig } from './adminConfig.js';
22
+ import { isJsonMode } from './runner.js';
23
+ import { emitEffectiveTenantNotice } from './workspaceNotice.js';
22
24
  import { readSession, readSessionBySessionId } from './session.js';
23
25
  import { assertSessionStillBound } from './sessionBinding.js';
24
26
  import { CLIError, ErrorCode } from './errors.js';
@@ -269,14 +271,44 @@ export async function adminCall(command, args) {
269
271
  * the gateway defaults to `api` if it is ever absent.
270
272
  */
271
273
  const PB_TELEMETRY_SOURCE = 'cli';
272
- export async function kernelCall(fn, args = {}, options) {
274
+ /**
275
+ * Resolve the session to check the binding guard against: the ambient marker, unless `args`
276
+ * names a DIFFERENT session explicitly (TEN-3315 — e.g. `pb rework report --conversation A`
277
+ * selects a session other than the ambient one, and judging the ambient marker there would
278
+ * judge the wrong session). No extra IO on the ordinary path: the lookup only runs when an
279
+ * explicit id names a session different from the ambient marker.
280
+ */
281
+ function boundSessionFor(args) {
282
+ const session = readSession();
283
+ const explicitSessionId = typeof args.sessionId === 'string' ? args.sessionId : null;
284
+ return explicitSessionId && explicitSessionId !== session?.sessionId
285
+ ? readSessionBySessionId(explicitSessionId)
286
+ : session;
287
+ }
288
+ /**
289
+ * The ONE gateway fetch every kernelCall path routes through (WP-711/712). Resolves config,
290
+ * runs the binding guard, POSTs to /api/aki, and returns the raw envelope.
291
+ *
292
+ * Before this slice only kernelCallWithSession ran assertSessionStillBound, so a moved tenant
293
+ * pin refused writes but not reads: `pb get`/`search`/`orient`/`context`/`brief`/`constellation`
294
+ * all go through plain kernelCall and silently followed a repointed pin. Two write commands
295
+ * (migrate-setup.ts, setup-ingest.ts) send their writes through plain kernelCall too and had
296
+ * each hand-duplicated the same guard call to cover that gap — exactly the "N copies of the pin
297
+ * cascade" shape WP-692's TEN-3239 warned about. Folding the check in here removes all three
298
+ * duplicates; every caller, read or write, now shares this one call site.
299
+ */
300
+ async function fetchKernelEnvelope(fn, args, options) {
273
301
  const { apiKey, siteUrl } = getConfig();
302
+ // The ONE guard call site. `resolveEffectiveProfile()` only runs inside the thunk, so it costs
303
+ // nothing on the ordinary (no session, or unchanged binding) path — it is invoked only once
304
+ // the guard has already decided to refuse.
305
+ assertSessionStillBound(boundSessionFor(args), undefined, () => resolveEffectiveProfile().profile ?? undefined);
274
306
  const label = spinnerLabel(fn);
275
307
  const budgetMs = latencyBudgetMsForRoute(fn);
276
308
  // Spinner OUTSIDE the retry: withSpinner reports a terminal `— failed` line on any throw,
277
309
  // so a spinner per attempt would paint up to MAX_RATE_LIMIT_RETRIES false failures for a
278
310
  // call that ultimately succeeds, then sit silent through each Retry-After wait.
279
- return withSpinner(label, () => maybeRetry(async () => {
311
+ const envelope = await withSpinner(label, () => maybeRetry(async () => {
280
312
  let res;
281
313
  try {
282
314
  res = await fetch(`${siteUrl}/api/aki`, {
@@ -294,12 +326,21 @@ export async function kernelCall(fn, args = {}, options) {
294
326
  catch (err) {
295
327
  rethrowWithGuidance(err, siteUrl, { fn, budgetMs, args });
296
328
  }
297
- const envelope = await parseKernelEnvelope(res, { fn, budgetMs, args });
298
- if (!res.ok || envelope.ok === false) {
299
- throw new McpError(envelope.message || envelope.error || res.statusText, envelope.code, envelope.details, envelope.retryAfterSeconds);
329
+ const parsed = await parseKernelEnvelope(res, { fn, budgetMs, args });
330
+ if (!res.ok || parsed.ok === false) {
331
+ throw new McpError(parsed.message || parsed.error || res.statusText, parsed.code, parsed.details, parsed.retryAfterSeconds);
300
332
  }
301
- return envelope.data;
333
+ return parsed;
302
334
  }, options));
335
+ // apiKey/siteUrl travel out alongside the envelope (PR #810 review, Copilot) — kernelCallWithSession
336
+ // needs them AFTER this resolves, for the post-write touch. Returning them here means getConfig()
337
+ // is called exactly ONCE per kernelCall*, never re-resolved by a caller that already has them.
338
+ return { envelope, apiKey, siteUrl };
339
+ }
340
+ export async function kernelCall(fn, args = {}, options) {
341
+ const { envelope } = await fetchKernelEnvelope(fn, args, options);
342
+ await emitEffectiveTenantNotice(isJsonMode()); // WP-714 S3: the read path announces too (once/process).
343
+ return envelope.data;
303
344
  }
304
345
  /**
305
346
  * kernelCall variant that returns the full kernel envelope (data + summary + _meta) instead
@@ -309,32 +350,9 @@ export async function kernelCall(fn, args = {}, options) {
309
350
  * shape — the reason `_meta` exists as a side-channel at all (convex/lib/envelopeContract.ts).
310
351
  */
311
352
  export async function kernelCallEnvelope(fn, args = {}, options) {
312
- const { apiKey, siteUrl } = getConfig();
313
- const label = spinnerLabel(fn);
314
- const budgetMs = latencyBudgetMsForRoute(fn);
315
- return withSpinner(label, () => maybeRetry(async () => {
316
- let res;
317
- try {
318
- res = await fetch(`${siteUrl}/api/aki`, {
319
- method: 'POST',
320
- signal: AbortSignal.timeout(budgetMs),
321
- headers: {
322
- 'Content-Type': 'application/json',
323
- Authorization: `Bearer ${apiKey}`,
324
- 'x-pb-source': PB_TELEMETRY_SOURCE,
325
- },
326
- body: JSON.stringify({ fn, args }),
327
- });
328
- }
329
- catch (err) {
330
- rethrowWithGuidance(err, siteUrl, { fn, budgetMs, args });
331
- }
332
- const envelope = await parseKernelEnvelope(res, { fn, budgetMs, args });
333
- if (!res.ok || envelope.ok === false) {
334
- throw new McpError(envelope.message || envelope.error || res.statusText, envelope.code, envelope.details, envelope.retryAfterSeconds);
335
- }
336
- return { data: envelope.data, summary: envelope.summary, _meta: envelope._meta };
337
- }, options));
353
+ const { envelope } = await fetchKernelEnvelope(fn, args, options);
354
+ await emitEffectiveTenantNotice(isJsonMode()); // WP-714 S3: the read path announces too (once/process).
355
+ return { data: envelope.data, summary: envelope.summary, _meta: envelope._meta };
338
356
  }
339
357
  /**
340
358
  * Raw fetch to the gateway — no spinner, swallows errors.
@@ -367,6 +385,9 @@ async function mcpFetchRaw(fn, args, apiKey, siteUrl) {
367
385
  * `X-Agent-Session-Id` header).
368
386
  * All write commands (update, relate, unrelate, capture) should use this.
369
387
  *
388
+ * WP-711/712: the binding guard itself now lives in the shared fetchKernelEnvelope, reached by
389
+ * every kernelCall path — this function only adds the post-write session-touch on top.
390
+ *
370
391
  * After a successful write, fires a non-blocking `agent.touchSession` call to
371
392
  * renew the session TTL — mirroring MCP server behavior (DEC-299, BET-181 Slice 1).
372
393
  * The touch is fire-and-forget: it does not block the write response, and errors
@@ -374,50 +395,17 @@ async function mcpFetchRaw(fn, args, apiKey, siteUrl) {
374
395
  * the write itself fails.
375
396
  */
376
397
  export async function kernelCallWithSession(fn, args = {}, options) {
377
- const { apiKey, siteUrl } = getConfig();
398
+ // Ambient session, for the post-write touch below — deliberately NOT `boundSessionFor(args)`:
399
+ // the touch always renews the marker actually in play locally, regardless of which session an
400
+ // explicit `sessionId` in `args` asked the guard to validate against.
378
401
  const session = readSession();
379
- // Validate the marker actually in play (TEN-3315). A command may select a different
380
- // conversation's session and pass its id explicitly (e.g. `pb rework report --conversation A`)
381
- // while `readSession()` resolves the current/default marker judging that one would judge the
382
- // wrong session. Previously the guard skipped there; now it looks the id's own marker up, so
383
- // the deliberate case is the one that gets checked rather than the one that gets waved through.
384
- // No extra IO on the ordinary path: the lookup runs only when an explicit id names a DIFFERENT
385
- // session than the ambient marker.
386
- const explicitSessionId = typeof args.sessionId === 'string' ? args.sessionId : null;
387
- const bound = explicitSessionId && explicitSessionId !== session?.sessionId
388
- ? readSessionBySessionId(explicitSessionId)
389
- : session;
390
- assertSessionStillBound(bound);
391
- const label = spinnerLabel(fn);
392
- const headers = {
393
- 'Content-Type': 'application/json',
394
- Authorization: `Bearer ${apiKey}`,
395
- // DEC-1207: attribute this connector for the gateway's context.served seam.
396
- 'x-pb-source': PB_TELEMETRY_SOURCE,
397
- };
398
- // WP-575 + WP-579 compose deliberately: the budget is derived ONCE per route, but the
399
- // AbortSignal is created inside the retried callback, so each 429 retry attempt gets its
400
- // own full budget rather than sharing one deadline across all attempts.
401
- const budgetMs = latencyBudgetMsForRoute(fn);
402
- const result = await withSpinner(label, () => maybeRetry(async () => {
403
- let res;
404
- try {
405
- res = await fetch(`${siteUrl}/api/aki`, {
406
- method: 'POST',
407
- signal: AbortSignal.timeout(budgetMs),
408
- headers,
409
- body: JSON.stringify({ fn, args }),
410
- });
411
- }
412
- catch (err) {
413
- rethrowWithGuidance(err, siteUrl, { fn, budgetMs, args });
414
- }
415
- const envelope = await parseKernelEnvelope(res, { fn, budgetMs, args });
416
- if (!res.ok || envelope.ok === false) {
417
- throw new McpError(envelope.message || envelope.error || res.statusText, envelope.code, envelope.details, envelope.retryAfterSeconds);
418
- }
419
- return envelope.data;
420
- }, options));
402
+ // apiKey/siteUrl come back FROM fetchKernelEnvelope rather than a second getConfig() call here
403
+ // (PR #810 review, Copilot): the old code called getConfig() once here and again inside the
404
+ // shared fetch, so the touch below could in principle read a different resolution than the
405
+ // write it is renewing. Reusing the pair fetchKernelEnvelope already resolved makes that
406
+ // impossible by construction, not just unlikely.
407
+ const { envelope, apiKey, siteUrl } = await fetchKernelEnvelope(fn, args, options);
408
+ const result = envelope.data;
421
409
  // Fire-and-forget session touch — best-effort, never blocks the write response.
422
410
  // Uses mcpFetchRaw (not kernelCall) to avoid recursion and suppress the visible spinner
423
411
  // that would appear if kernelCall were used here (background ops are silent noise).
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,uFAAuF;AACvF,sFAAsF;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1E,4FAA4F;AAC5F,8FAA8F;AAC9F,mDAAmD;AACnD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAA0B,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EAAE,CAAC;QAC9F,KAAK,WAAW,CAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -55,5 +55,7 @@ export declare function bindingChanged(existing: Pick<SessionState, 'profile' |
55
55
  */
56
56
  export declare function assertSessionStillBound(session: {
57
57
  bindingFingerprint?: string;
58
- } | null, current?: string | undefined): void;
58
+ workspaceName?: string;
59
+ profile?: string;
60
+ } | null, current?: string | undefined, describeCurrent?: () => string | undefined): void;
59
61
  //# sourceMappingURL=sessionBinding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sessionBinding.d.ts","sourceRoot":"","sources":["../../src/lib/sessionBinding.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAGvD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAS9E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,oBAAoB,CAAC,EAC9D,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACnE,OAAO,CAqBT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EAG/C,OAAO,GAAE,MAAM,GAAG,SAAgC,GACjD,IAAI,CAiBN"}
1
+ {"version":3,"file":"sessionBinding.d.ts","sourceRoot":"","sources":["../../src/lib/sessionBinding.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAGvD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAS9E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,oBAAoB,CAAC,EAC9D,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACnE,OAAO,CAqBT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EAGzF,OAAO,GAAE,MAAM,GAAG,SAAgC,EAKlD,eAAe,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,GACzC,IAAI,CAmBN"}
@@ -99,7 +99,12 @@ export function bindingChanged(existing, current) {
99
99
  export function assertSessionStillBound(session,
100
100
  // Injectable for the same reason `fingerprintOf` takes arguments: a test must not mutate the
101
101
  // shared process env to set this up (see that function's note).
102
- current = fingerprintBinding()) {
102
+ current = fingerprintBinding(),
103
+ // WP-711/712: names the tenant CURRENTLY in play, for the refusal message only. A thunk, not
104
+ // a plain value — resolving it (e.g. via config.ts's resolveEffectiveProfile) can mean a local
105
+ // file read, and this function stays pure/offline on every PASSING call by invoking it only
106
+ // once it has already decided to refuse. Never called when nothing is bound or the two agree.
107
+ describeCurrent) {
103
108
  // Nothing bound, or a match: nothing to object to.
104
109
  if (!session || !current || current === session.bindingFingerprint)
105
110
  return;
@@ -109,7 +114,9 @@ current = fingerprintBinding()) {
109
114
  // (Codex P1 r15). Letting that through was the bigger hole of the two: `pb relate` sends no
110
115
  // session id, so nothing downstream re-checks. `pb session start` restarts it once and stamps a
111
116
  // fingerprint, after which this never fires again.
112
- throw new CLIError('The workspace credential changed after this session started, so this write would land in a different workspace than the session belongs to.', {
117
+ const expected = session.workspaceName || session.profile || "the session's workspace";
118
+ const found = describeCurrent?.() || 'a different, unrecorded workspace';
119
+ throw new CLIError(`The workspace credential changed after this session started — expected "${expected}", found "${found}" — so this call would land in a different workspace than the session belongs to.`, {
113
120
  code: ErrorCode.SESSION_REQUIRED,
114
121
  category: 'session',
115
122
  guidance: 'Run `pb session start` to open a session against the current workspace.',
@@ -1 +1 @@
1
- {"version":3,"file":"sessionBinding.js","sourceRoot":"","sources":["../../src/lib/sessionBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC7C,OAAO,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,OAA2B;IACpE,4FAA4F;IAC5F,+FAA+F;IAC/F,8FAA8F;IAC9F,wFAAwF;IACxF,8FAA8F;IAC9F,qFAAqF;IACrF,MAAM,UAAU,GAAG,CAAC,OA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EAA2E,QAAQ,aAAa,KAAK,mFAAmF,EACxL;QACE,IAAI,EAAE,SAAS,CAAC,gBAAgB;QAChC,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,yEAAyE;KACpF,CACF,CAAC;AACJ,CAAC"}
@@ -1,11 +1,12 @@
1
1
  /**
2
- * WP-1 — Loud workspace identity on every Chain write.
2
+ * WP-1 — Loud workspace identity on every Chain write. WP-714 S3 extended this to every
3
+ * Chain READ too (see `emitEffectiveTenantNotice`'s doc comment below for the read-path wiring).
3
4
  *
4
5
  * Running `pb` from a directory with no repo pin (e.g. `~/`) silently resolves the
5
6
  * GLOBAL profile and writes to whichever Chain that points at — proven live: captures
6
- * meant for one workspace landed on another. This module makes every Chain write NAME
7
- * its target workspace on stderr, and qualifies the line LOUDLY when the binding is an
8
- * unpinned fallback (`global`/`default` — no repo pin) so a wrong-Chain write is never
7
+ * meant for one workspace landed on another. This module makes every Chain read or write
8
+ * NAME its target workspace on stderr, and qualifies the line LOUDLY when the binding is an
9
+ * unpinned fallback (`global`/`default` — no repo pin) so a wrong-Chain call is never
9
10
  * silent. An explicit binding (`local`/`env`) gets a plain, non-alarming line.
10
11
  *
11
12
  * Label source — the PROFILE SLUG only, via `resolveReportedProfile()`: it returns
@@ -31,16 +32,32 @@
31
32
  * - The gate is the `json` flag alone — not `--quiet`: a quiet human run still names its
32
33
  * target Chain.
33
34
  *
34
- * SSOT: one pure formatter + one thin emitter, called from all four write commands —
35
- * no per-command copy-paste.
35
+ * SSOT: one pure formatter + one thin emitter called explicitly from the 7 write-command
36
+ * files (8 call sites) and once per process from the shared read-path kernel wrapper
37
+ * (`client.ts`'s `kernelCall`/`kernelCallEnvelope`) — no per-command copy-paste.
36
38
  */
37
39
  import { type ReportedProfileSource } from './reportedProfile.js';
40
+ /** A repo-local pin that disagrees with the globally active `pb` profile (WP-714 S3). */
41
+ export interface TenantDisagreement {
42
+ /** The repo-local `.productbrain/config.local.json` pin — what THIS process actually uses. */
43
+ local: string;
44
+ /** The globally active profile — what `pb whoami` reports outside a pinned repo. */
45
+ global: string;
46
+ }
38
47
  /** Inputs to the pure notice formatter. */
39
- export interface WriteTargetNoticeInput {
48
+ export interface EffectiveTenantNoticeInput {
40
49
  /** Effective profile name (the configured pin / identity), or null when unconfigured. */
41
50
  profile: string | null;
42
51
  /** Where that profile came from — see resolveReportedProfile(). */
43
52
  source: ReportedProfileSource;
53
+ /**
54
+ * WP-714 S3: set only when a repo-local pin disagrees with the globally active profile.
55
+ * `null`/`undefined` covers both "no repo-local pin" and "local and global agree" — in
56
+ * either case there is nothing to flag, and the base announcement above is unconditional
57
+ * either way (including the both-wrong case: local and global pinned to the SAME wrong
58
+ * tenant still announces that tenant, just without this second line).
59
+ */
60
+ disagreement?: TenantDisagreement | null;
44
61
  }
45
62
  /**
46
63
  * Build the one-line target-workspace notice — or null when there is nothing to say.
@@ -61,10 +78,20 @@ export interface WriteTargetNoticeInput {
61
78
  * Pure: no IO. The display label is the profile slug — a single resolution path, so the
62
79
  * label and the qualifier can never contradict each other.
63
80
  */
64
- export declare function formatWriteTargetNotice({ profile, source }: WriteTargetNoticeInput): string | null;
81
+ export declare function formatEffectiveTenantNotice({ profile, source, disagreement }: EffectiveTenantNoticeInput): string | null;
82
+ /** Test-only: reset the once-per-process guard between cases (mirrors resetReportedProfileSnapshot). */
83
+ export declare function resetEffectiveTenantNoticeForTests(): void;
65
84
  /**
66
- * Resolve identity and write the target notice to STDERR. Pass the SAME `json` value the
67
- * command computed (e.g. `isJsonMode() || options.json === true`).
85
+ * Resolve identity and write the target notice to STDERR for every Chain read OR write.
86
+ * Pass the SAME `json` value the caller computed (e.g. `isJsonMode() || options.json ===
87
+ * true`). WP-714 S3: originally called only from the 8 explicit write call sites; now ALSO
88
+ * called once per process from `client.ts`'s `kernelCall`/`kernelCallEnvelope` (the plain,
89
+ * non-session read path), so every read command that reaches the kernel announces too.
90
+ * Deliberately NOT wired into `kernelCallWithSession` (the write path): every write command
91
+ * already calls this explicitly, earlier in its own flow than any plain `kernelCall` it
92
+ * might also make (e.g. `update`'s post-write `chain.getEntry` refresh) — the
93
+ * once-per-process guard just makes that later plain call's attempt a no-op instead of a
94
+ * duplicate line, so write-command output is unchanged bit-for-bit.
68
95
  *
69
96
  * `json` suppresses only the PLAIN line for an explicit binding. The unpinned-fallback
70
97
  * WARNING is never suppressed (TEN-3238): `--json` is how agents invoke pb, and agents are
@@ -74,10 +101,12 @@ export declare function formatWriteTargetNotice({ profile, source }: WriteTarget
74
101
  * strict JSON on stdout stays byte-for-byte unchanged either way (and the CLI already writes
75
102
  * unconditional stderr warnings elsewhere, e.g. the preview-scrub misroute in config.ts).
76
103
  * The plain line stays human-only: it carries no warning, so it is pure noise in agent logs.
104
+ * The repo-local-vs-global disagreement line (WP-714 S3) rides the same suppression as its
105
+ * base line — it only ever attaches to the 'local' source, which json already silences.
77
106
  *
78
107
  * Never throws and does no network IO: a wrong/unreadable config degrades to silence, and
79
- * the label comes from `resolveReportedProfile()` — only fast local config reads
80
- * (no probe) in front of the write. It is safe to call immediately before any Chain write.
108
+ * the label comes from `resolveReportedProfile()` — only fast local config reads (no probe)
109
+ * in front of the call. It is safe to call immediately before any Chain read or write.
81
110
  */
82
- export declare function emitWriteTargetNotice(json: boolean): Promise<void>;
111
+ export declare function emitEffectiveTenantNotice(json: boolean): Promise<void>;
83
112
  //# sourceMappingURL=workspaceNotice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspaceNotice.d.ts","sourceRoot":"","sources":["../../src/lib/workspaceNotice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE1F,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,yFAAyF;IACzF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,mEAAmE;IACnE,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI,CAuBlG;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBxE"}
1
+ {"version":3,"file":"workspaceNotice.d.ts","sourceRoot":"","sources":["../../src/lib/workspaceNotice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAI1F,yFAAyF;AACzF,MAAM,WAAW,kBAAkB;IACjC,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,2CAA2C;AAC3C,MAAM,WAAW,0BAA0B;IACzC,yFAAyF;IACzF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,mEAAmE;IACnE,MAAM,EAAE,qBAAqB,CAAC;IAC9B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,0BAA0B,GAAG,MAAM,GAAG,IAAI,CASxH;AA0ED,wGAAwG;AACxG,wBAAgB,kCAAkC,IAAI,IAAI,CAEzD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
@@ -1,11 +1,12 @@
1
1
  /**
2
- * WP-1 — Loud workspace identity on every Chain write.
2
+ * WP-1 — Loud workspace identity on every Chain write. WP-714 S3 extended this to every
3
+ * Chain READ too (see `emitEffectiveTenantNotice`'s doc comment below for the read-path wiring).
3
4
  *
4
5
  * Running `pb` from a directory with no repo pin (e.g. `~/`) silently resolves the
5
6
  * GLOBAL profile and writes to whichever Chain that points at — proven live: captures
6
- * meant for one workspace landed on another. This module makes every Chain write NAME
7
- * its target workspace on stderr, and qualifies the line LOUDLY when the binding is an
8
- * unpinned fallback (`global`/`default` — no repo pin) so a wrong-Chain write is never
7
+ * meant for one workspace landed on another. This module makes every Chain read or write
8
+ * NAME its target workspace on stderr, and qualifies the line LOUDLY when the binding is an
9
+ * unpinned fallback (`global`/`default` — no repo pin) so a wrong-Chain call is never
9
10
  * silent. An explicit binding (`local`/`env`) gets a plain, non-alarming line.
10
11
  *
11
12
  * Label source — the PROFILE SLUG only, via `resolveReportedProfile()`: it returns
@@ -31,10 +32,13 @@
31
32
  * - The gate is the `json` flag alone — not `--quiet`: a quiet human run still names its
32
33
  * target Chain.
33
34
  *
34
- * SSOT: one pure formatter + one thin emitter, called from all four write commands —
35
- * no per-command copy-paste.
35
+ * SSOT: one pure formatter + one thin emitter called explicitly from the 7 write-command
36
+ * files (8 call sites) and once per process from the shared read-path kernel wrapper
37
+ * (`client.ts`'s `kernelCall`/`kernelCallEnvelope`) — no per-command copy-paste.
36
38
  */
37
39
  import { resolveReportedProfile } from './reportedProfile.js';
40
+ import { readLocalProjectConfig } from './projectConfig.js';
41
+ import { getGlobalActiveProfile } from './profiles.js';
38
42
  /**
39
43
  * Build the one-line target-workspace notice — or null when there is nothing to say.
40
44
  *
@@ -54,7 +58,17 @@ import { resolveReportedProfile } from './reportedProfile.js';
54
58
  * Pure: no IO. The display label is the profile slug — a single resolution path, so the
55
59
  * label and the qualifier can never contradict each other.
56
60
  */
57
- export function formatWriteTargetNotice({ profile, source }) {
61
+ export function formatEffectiveTenantNotice({ profile, source, disagreement }) {
62
+ const base = formatBaseNotice(profile, source);
63
+ // WP-714 S3: the disagreement line rides the SAME notice, but only when there is a base
64
+ // line to attach it to (source === 'none'/'missing-pin' already returned null above — no
65
+ // target was named, so there is nothing to flag a disagreement against either).
66
+ if (base && disagreement) {
67
+ return `${base}\n NOTICE: repo-local pin ("${disagreement.local}") differs from the globally active Chain profile ("${disagreement.global}") — this process uses "${disagreement.local}" regardless of what \`pb whoami\` reports globally`;
68
+ }
69
+ return base;
70
+ }
71
+ function formatBaseNotice(profile, source) {
58
72
  if (source === 'none' || source === 'missing-pin')
59
73
  return null;
60
74
  // Deliberately NOT `→ unknown`: that reads as "a workspace whose name we failed to look up".
@@ -81,8 +95,70 @@ export function formatWriteTargetNotice({ profile, source }) {
81
95
  return `→ ${name}`;
82
96
  }
83
97
  /**
84
- * Resolve identity and write the target notice to STDERR. Pass the SAME `json` value the
85
- * command computed (e.g. `isJsonMode() || options.json === true`).
98
+ * WP-714 S3: does the repo-local PROFILE PIN the credential this process actually binds
99
+ * to disagree with the globally active `pb` profile (`~/.config/productbrain/active-profile`)?
100
+ * Mirrors `scripts/superset/chain-pin-notice.mjs`'s birth-time comparison (WP-713, untouched
101
+ * here) so both notices agree on what counts as a disagreement — but this runs on every
102
+ * process instead of once at worktree birth. Never throws: an unreadable/racing file on
103
+ * either side degrades to "nothing to compare" rather than crashing a read or write.
104
+ *
105
+ * `source` gates this to `'local'` ONLY (PR #816 review, Copilot-confirmed bug): the DEC-1607
106
+ * credential cascade lets a `config.local.json` `apiKey`/`env`/dotenv binding OUTRANK its own
107
+ * `profile` field (`resolveReportedProfile()` reports that as `local-key`/`env-key`/`cwd-key`,
108
+ * never `local`). A `profile` field can still be PRESENT and differ from the global marker in
109
+ * those cases even though this process is not using it — comparing the file's raw `profile`
110
+ * field against the global marker regardless of source would name a tenant the process does
111
+ * not actually touch, in the sentence an operator trusts most. This intentionally does NOT
112
+ * grow a second "your pin is being overridden by a key" notice — that is a different claim,
113
+ * out of scope for this slice.
114
+ */
115
+ function resolveTenantDisagreement(source) {
116
+ if (source !== 'local')
117
+ return null;
118
+ let localProfile;
119
+ try {
120
+ localProfile = readLocalProjectConfig()?.profile?.trim() || undefined;
121
+ }
122
+ catch {
123
+ return null;
124
+ }
125
+ if (!localProfile)
126
+ return null; // no repo-local pin — nothing to compare against.
127
+ let globalProfile;
128
+ try {
129
+ globalProfile = getGlobalActiveProfile();
130
+ }
131
+ catch {
132
+ return null;
133
+ }
134
+ if (!globalProfile || globalProfile === localProfile)
135
+ return null;
136
+ return { local: localProfile, global: globalProfile };
137
+ }
138
+ /**
139
+ * Once-per-PROCESS guard (WP-714 S3). A `pb` invocation is one process, so this is really
140
+ * "once per command" — but a single command can reach this function many times (`pb orient`
141
+ * alone makes three separate `kernelCall`s). Set on the FIRST call regardless of outcome
142
+ * (silent 'none'/'missing-pin', json-suppressed, or an actual print): the resolved identity
143
+ * cannot change mid-process, so re-attempting on later calls would only ever repeat the same
144
+ * verdict — or, for a printed notice, repeat the same line.
145
+ */
146
+ let hasAttemptedEffectiveTenantNotice = false;
147
+ /** Test-only: reset the once-per-process guard between cases (mirrors resetReportedProfileSnapshot). */
148
+ export function resetEffectiveTenantNoticeForTests() {
149
+ hasAttemptedEffectiveTenantNotice = false;
150
+ }
151
+ /**
152
+ * Resolve identity and write the target notice to STDERR — for every Chain read OR write.
153
+ * Pass the SAME `json` value the caller computed (e.g. `isJsonMode() || options.json ===
154
+ * true`). WP-714 S3: originally called only from the 8 explicit write call sites; now ALSO
155
+ * called once per process from `client.ts`'s `kernelCall`/`kernelCallEnvelope` (the plain,
156
+ * non-session read path), so every read command that reaches the kernel announces too.
157
+ * Deliberately NOT wired into `kernelCallWithSession` (the write path): every write command
158
+ * already calls this explicitly, earlier in its own flow than any plain `kernelCall` it
159
+ * might also make (e.g. `update`'s post-write `chain.getEntry` refresh) — the
160
+ * once-per-process guard just makes that later plain call's attempt a no-op instead of a
161
+ * duplicate line, so write-command output is unchanged bit-for-bit.
86
162
  *
87
163
  * `json` suppresses only the PLAIN line for an explicit binding. The unpinned-fallback
88
164
  * WARNING is never suppressed (TEN-3238): `--json` is how agents invoke pb, and agents are
@@ -92,19 +168,24 @@ export function formatWriteTargetNotice({ profile, source }) {
92
168
  * strict JSON on stdout stays byte-for-byte unchanged either way (and the CLI already writes
93
169
  * unconditional stderr warnings elsewhere, e.g. the preview-scrub misroute in config.ts).
94
170
  * The plain line stays human-only: it carries no warning, so it is pure noise in agent logs.
171
+ * The repo-local-vs-global disagreement line (WP-714 S3) rides the same suppression as its
172
+ * base line — it only ever attaches to the 'local' source, which json already silences.
95
173
  *
96
174
  * Never throws and does no network IO: a wrong/unreadable config degrades to silence, and
97
- * the label comes from `resolveReportedProfile()` — only fast local config reads
98
- * (no probe) in front of the write. It is safe to call immediately before any Chain write.
175
+ * the label comes from `resolveReportedProfile()` — only fast local config reads (no probe)
176
+ * in front of the call. It is safe to call immediately before any Chain read or write.
99
177
  */
100
- export async function emitWriteTargetNotice(json) {
178
+ export async function emitEffectiveTenantNotice(json) {
179
+ if (hasAttemptedEffectiveTenantNotice)
180
+ return;
181
+ hasAttemptedEffectiveTenantNotice = true;
101
182
  let profile = null;
102
183
  let source = 'none';
103
184
  try {
104
185
  ({ profile, source } = resolveReportedProfile());
105
186
  }
106
187
  catch {
107
- return; // unreadable/racing config — say nothing rather than crash a write.
188
+ return; // unreadable/racing config — say nothing rather than crash a read or write.
108
189
  }
109
190
  if (source === 'none' || source === 'missing-pin')
110
191
  return;
@@ -115,7 +196,8 @@ export async function emitWriteTargetNotice(json) {
115
196
  || source === 'cwd-key' || source === 'local-key';
116
197
  if (json && !isUnpinnedFallback)
117
198
  return;
118
- const notice = formatWriteTargetNotice({ profile, source });
199
+ const disagreement = resolveTenantDisagreement(source);
200
+ const notice = formatEffectiveTenantNotice({ profile, source, disagreement });
119
201
  if (notice)
120
202
  process.stderr.write(notice + '\n');
121
203
  }
@@ -1 +1 @@
1
- {"version":3,"file":"workspaceNotice.js","sourceRoot":"","sources":["../../src/lib/workspaceNotice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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AAM,GAAG,IAAI,CAAC,CAAC;AAClD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@productbrain/cli",
3
- "version": "0.1.0-beta.5322",
3
+ "version": "0.1.0-beta.5368",
4
4
  "description": "Product Brain — Chain knowledge and write-back CLI",
5
5
  "type": "module",
6
6
  "bin": {