@productbrain/cli 0.1.0-beta.5083 → 0.1.0-beta.5105

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 (70) hide show
  1. package/dist/__tests__/profiles.test.js +34 -1
  2. package/dist/__tests__/profiles.test.js.map +1 -1
  3. package/dist/__tests__/reportedProfile.test.js +227 -3
  4. package/dist/__tests__/reportedProfile.test.js.map +1 -1
  5. package/dist/__tests__/session-resume-backstop.test.js +8 -0
  6. package/dist/__tests__/session-resume-backstop.test.js.map +1 -1
  7. package/dist/__tests__/session-start-key-refresh.test.js +29 -0
  8. package/dist/__tests__/session-start-key-refresh.test.js.map +1 -1
  9. package/dist/__tests__/session-switch.test.js +107 -0
  10. package/dist/__tests__/session-switch.test.js.map +1 -1
  11. package/dist/__tests__/sessionBinding.test.d.ts +2 -0
  12. package/dist/__tests__/sessionBinding.test.d.ts.map +1 -0
  13. package/dist/__tests__/sessionBinding.test.js +100 -0
  14. package/dist/__tests__/sessionBinding.test.js.map +1 -0
  15. package/dist/__tests__/workspaceNotice.test.js +20 -0
  16. package/dist/__tests__/workspaceNotice.test.js.map +1 -1
  17. package/dist/commands/migrate-setup.d.ts.map +1 -1
  18. package/dist/commands/migrate-setup.js +12 -0
  19. package/dist/commands/migrate-setup.js.map +1 -1
  20. package/dist/commands/profile.d.ts +6 -1
  21. package/dist/commands/profile.d.ts.map +1 -1
  22. package/dist/commands/profile.js +72 -32
  23. package/dist/commands/profile.js.map +1 -1
  24. package/dist/commands/session.d.ts.map +1 -1
  25. package/dist/commands/session.js +28 -14
  26. package/dist/commands/session.js.map +1 -1
  27. package/dist/commands/setup-ingest.d.ts.map +1 -1
  28. package/dist/commands/setup-ingest.js +12 -0
  29. package/dist/commands/setup-ingest.js.map +1 -1
  30. package/dist/commands/whoami.d.ts +7 -0
  31. package/dist/commands/whoami.d.ts.map +1 -1
  32. package/dist/commands/whoami.js +49 -2
  33. package/dist/commands/whoami.js.map +1 -1
  34. package/dist/commands/whoami.test.js +58 -0
  35. package/dist/commands/whoami.test.js.map +1 -1
  36. package/dist/lib/client.d.ts.map +1 -1
  37. package/dist/lib/client.js +8 -0
  38. package/dist/lib/client.js.map +1 -1
  39. package/dist/lib/config.d.ts +1 -1
  40. package/dist/lib/config.d.ts.map +1 -1
  41. package/dist/lib/config.js +10 -13
  42. package/dist/lib/config.js.map +1 -1
  43. package/dist/lib/configResult.d.ts +24 -1
  44. package/dist/lib/configResult.d.ts.map +1 -1
  45. package/dist/lib/configResult.js +4 -0
  46. package/dist/lib/configResult.js.map +1 -1
  47. package/dist/lib/envKeySnapshot.d.ts +10 -0
  48. package/dist/lib/envKeySnapshot.d.ts.map +1 -0
  49. package/dist/lib/envKeySnapshot.js +30 -0
  50. package/dist/lib/envKeySnapshot.js.map +1 -0
  51. package/dist/lib/localBinding.d.ts +25 -0
  52. package/dist/lib/localBinding.d.ts.map +1 -1
  53. package/dist/lib/localBinding.js +19 -1
  54. package/dist/lib/localBinding.js.map +1 -1
  55. package/dist/lib/reportedProfile.d.ts +2 -1
  56. package/dist/lib/reportedProfile.d.ts.map +1 -1
  57. package/dist/lib/reportedProfile.js +114 -4
  58. package/dist/lib/reportedProfile.js.map +1 -1
  59. package/dist/lib/session.d.ts +13 -0
  60. package/dist/lib/session.d.ts.map +1 -1
  61. package/dist/lib/session.js.map +1 -1
  62. package/dist/lib/sessionBinding.d.ts +59 -0
  63. package/dist/lib/sessionBinding.d.ts.map +1 -0
  64. package/dist/lib/sessionBinding.js +118 -0
  65. package/dist/lib/sessionBinding.js.map +1 -0
  66. package/dist/lib/workspaceNotice.d.ts +7 -0
  67. package/dist/lib/workspaceNotice.d.ts.map +1 -1
  68. package/dist/lib/workspaceNotice.js +28 -1
  69. package/dist/lib/workspaceNotice.js.map +1 -1
  70. package/package.json +1 -1
@@ -8,12 +8,100 @@
8
8
  * Lives outside config.ts (STD-2 / DEC-1504 shrink-only). Do not re-export
9
9
  * from config.ts — this module imports FROM config.ts.
10
10
  */
11
- import { getConfigSafe, resolveEffectiveProfile } from './config.js';
11
+ import { resolveConfig, resolveEffectiveProfile } from './config.js';
12
+ import { resolveConfigResult } from './configResult.js';
13
+ import { declaresCompletePreviewBinding, declaresLocalBinding } from './localBinding.js';
14
+ import { readLocalProjectConfig } from './projectConfig.js';
15
+ import { getGlobalActiveProfile } from './profiles.js';
16
+ import { isEnvKeyBinding } from './envKeySnapshot.js';
17
+ // The snapshot itself lives in its own leaf so config.ts can use it too without a cycle.
18
+ // Re-exported here because every label surface already imports it from this module.
19
+ export { isEnvKeyBinding, resetReportedProfileSnapshot } from './envKeySnapshot.js';
12
20
  export function resolveReportedProfile() {
13
- const cfg = getConfigSafe();
14
- if (!cfg.ok && cfg.kind === 'missing-pin') {
15
- return { profile: null, source: 'missing-pin' };
21
+ // Precedence mirrors the CREDENTIAL cascade (DEC-1607), so the label can never name a source
22
+ // that lost. An exported key wins resolveConfig() step 1 outright — ahead of the pin, ahead of
23
+ // the no-tenant refusal — so it is reported first, and `missing-pin` can never co-occur.
24
+ if (isEnvKeyBinding())
25
+ return { profile: null, source: 'env-key' };
26
+ // From here the answer comes from ONE place: the credential cascade re-run against the FILES.
27
+ //
28
+ // `ignoreEnvKey` is what makes that possible (TEN-3311). loadEnv() copies whichever credential
29
+ // won into PRODUCTBRAIN_API_KEY, so a plain getConfigSafe() after any kernel call reports every
30
+ // binding as `env` — which is why five review rounds each surfaced one more branch whose label
31
+ // was wrong. We have already established above that no OPERATOR export exists, so skipping
32
+ // step 1 recovers the branch that actually supplied the key, with the name it recorded.
33
+ const cfg = resolveConfigResult(() => resolveConfig(true));
34
+ if (!cfg.ok) {
35
+ // ONE RULE, and every refusal obeys it: a refusal is still an answer about WHICH binding is in
36
+ // play, so it must never be attributed to a source that binding already beat. Four review
37
+ // rounds found four refusals violating it, so they are handled by what the refusal KNOWS
38
+ // rather than case by case (Codex P2 r8, r16, r18, r20):
39
+ // the no-tenant refusal → say so; nothing is bound (r8).
40
+ // it names the winner → name it, even though the cascade then rejected what it held.
41
+ // Re-deriving returns a DIFFERENT profile when PB_PROFILE points
42
+ // at a missing one (r18).
43
+ // it names only a source → a dotenv file supplied it and then failed validation (r20).
44
+ // config.local.json's own → an incomplete claim, or a complete one with a bad URL (r16).
45
+ // Only a DANGLING PIN falls through to the configured name, because naming the pin IS the
46
+ // diagnosis the operator needs there (TEN-2163).
47
+ if (cfg.kind === 'missing-pin')
48
+ return { profile: null, source: 'missing-pin' };
49
+ if (cfg.profileName)
50
+ return { profile: cfg.profileName, source: classifyProfileName(cfg.profileName) };
51
+ if (cfg.source === 'cwd')
52
+ return { profile: null, source: 'cwd-key' };
53
+ return classifyLocalBinding() ?? safeDerive();
16
54
  }
55
+ switch (cfg.source) {
56
+ case 'project': {
57
+ // config.local.json won. `profileName` present = the repo PIN; absent = a direct
58
+ // apiKey/siteUrl binding, which resolveLocalBinding() puts AHEAD of any sibling pin
59
+ // (Codex P2 r7) — so naming that pin would name a workspace pb is not using.
60
+ if (cfg.profileName)
61
+ return { profile: cfg.profileName, source: 'local' };
62
+ return classifyLocalBinding() ?? { profile: null, source: 'local-key' };
63
+ }
64
+ // resolveProfileConfig() falls PB_PROFILE → active-profile file → "default" → legacy and
65
+ // RECORDS the winner, so a PB_PROFILE naming a DELETED profile no longer reports that dead
66
+ // name. Absent only for the nameless legacy home file, which no profile describes.
67
+ case 'profile':
68
+ // No name only for the nameless legacy home file, which is auto-migrated on first use;
69
+ // leave that rare path on the configured-name behaviour rather than inventing a label.
70
+ return cfg.profileName
71
+ ? { profile: cfg.profileName, source: classifyProfileName(cfg.profileName) }
72
+ : safeDerive();
73
+ // A dotenv file here supplied the key. No profile involved — same lie as env-key, other file.
74
+ case 'cwd':
75
+ return { profile: null, source: 'cwd-key' };
76
+ // 'env' cannot reach here (the export returned above); 'default' means no credential at all.
77
+ default:
78
+ return safeDerive();
79
+ }
80
+ }
81
+ /**
82
+ * Name config.local.json's own direct binding, or null when it declares none. Shared by the
83
+ * success and refusal paths so a binding is described the same way whether it resolved or blew up.
84
+ */
85
+ function classifyLocalBinding() {
86
+ try {
87
+ const local = readLocalProjectConfig();
88
+ // localBinding's OWN claim predicate, not a copy of it. Mine missed `apiKeyMalformed` — a
89
+ // wrong-prefix or non-string key, which resolveLocalBinding() still treats as a direct-binding
90
+ // claim that outranks the pin, so the label fell back to naming that pin (Codex P2 r17).
91
+ // Duplicating this test is what caused it; sharing it is what stops the next one.
92
+ if (!declaresLocalBinding(local))
93
+ return null;
94
+ const preview = declaresCompletePreviewBinding(local);
95
+ return preview
96
+ ? { profile: preview.workspaceName, source: 'preview' }
97
+ : { profile: null, source: 'local-key' };
98
+ }
99
+ catch {
100
+ return null;
101
+ }
102
+ }
103
+ /** The configured-name path, guarded: whoami must degrade on an unreadable/racing file, not throw. */
104
+ function safeDerive() {
17
105
  try {
18
106
  return resolveEffectiveProfile();
19
107
  }
@@ -21,4 +109,26 @@ export function resolveReportedProfile() {
21
109
  return { profile: null, source: 'none' };
22
110
  }
23
111
  }
112
+ /**
113
+ * Where a profile NAME that actually supplied the credential came from.
114
+ *
115
+ * Same precedence as `resolveEffectiveProfile()`: repo pin > PB_PROFILE > global > default. The
116
+ * pin came last-minute (Codex P2 r19) — without it, a pinned profile whose URL is then rejected
117
+ * was reported `global`, pointing the operator at the wrong file to repair.
118
+ */
119
+ function classifyProfileName(name) {
120
+ try {
121
+ if (name === readLocalProjectConfig()?.profile)
122
+ return 'local';
123
+ }
124
+ catch { /* fall through */ }
125
+ if (name === process.env.PB_PROFILE?.trim())
126
+ return 'env';
127
+ try {
128
+ if (name === getGlobalActiveProfile())
129
+ return 'global';
130
+ }
131
+ catch { /* fall through */ }
132
+ return name === 'default' ? 'default' : 'global';
133
+ }
24
134
  //# sourceMappingURL=reportedProfile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reportedProfile.js","sourceRoot":"","sources":["../../src/lib/reportedProfile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,E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AAE,OAAO,OAAO,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;IAC9B,IAAI,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE;QAAE,OAAO,KAAK,CAAC;IAC1D,IAAI,CAAC;QACH,IAAI,IAAI,KAAK,sBAAsB,EAAE;YAAE,OAAO,QAAQ,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;IAC9B,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AACnD,CAAC"}
@@ -27,6 +27,19 @@ export interface SessionState {
27
27
  closedAt?: string;
28
28
  /** Effective profile name at session start — backstop for detecting a profile switch. */
29
29
  profile?: string;
30
+ /**
31
+ * Fingerprint of the CREDENTIAL this session was started under (TEN-3240).
32
+ *
33
+ * `profile` alone cannot see a raw exported `PRODUCTBRAIN_API_KEY`: it names profiles, and an
34
+ * exported key supplies no profile name. Swap that key for another workspace's between two
35
+ * invocations and the name is unchanged, so the name-only backstop reports the OLD workspace's
36
+ * session as still active. This is derived from the resolved key + gateway, so it moves
37
+ * whenever the binding does — profile switch, preview flip, or bare key swap alike.
38
+ *
39
+ * Optional: sessions written before this field existed carry only `profile`, and the backstop
40
+ * still honours that. Never the key itself — a one-way digest, and only its head is kept.
41
+ */
42
+ bindingFingerprint?: string;
30
43
  /** WP-479 E2: the conversation identity this marker is scoped to, when one resolved. */
31
44
  conversationId?: string;
32
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/lib/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAA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UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAiB,CAAC;QAChE,IAAI,CAAC,GAAG,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC/B,OAAO;YACL,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,cAAc,EAAE,GAAG,CAAC,cAAc;SACnC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,sBAA+B;IAC/E,MAAM,OAAO,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,YAAY,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { SessionState } from './session.js';
2
+ /**
3
+ * One-way digest of the credential + gateway currently bound, or undefined when nothing is.
4
+ *
5
+ * By the time this runs, `getConfigOrGuide()` has already called `loadEnv()`, so `process.env`
6
+ * holds the credential that actually WON — whatever supplied it (export, pin, profile, preview).
7
+ * That is exactly the property wanted here: the fingerprint moves whenever the effective binding
8
+ * moves, without this module having to know which source produced it.
9
+ *
10
+ * Head-truncated to 16 hex chars: this value is only ever COMPARED, so keeping more would store
11
+ * more of a secret than the job needs. Never the key itself, never sent anywhere.
12
+ */
13
+ export declare function fingerprintBinding(): string | undefined;
14
+ /**
15
+ * The digest itself, taken as arguments rather than read from the environment.
16
+ *
17
+ * Split out so the hashing rules can be tested WITHOUT mutating `process.env`: vitest runs test
18
+ * files in parallel inside shared workers, so a test that deletes `PRODUCTBRAIN_API_KEY` to set up
19
+ * a case yanks it out from under whatever unrelated file is running beside it (observed live —
20
+ * it broke the handshake suite while passing on its own).
21
+ */
22
+ export declare function fingerprintOf(key: string, gateway: string | undefined): string;
23
+ /**
24
+ * Has the workspace this session was started against changed underneath it?
25
+ *
26
+ * TWO signals, because neither alone is sufficient:
27
+ *
28
+ * - **Profile name** (TEN-2163, the original backstop) — catches `pb profile use`, a preview
29
+ * flip, a pin edit. Blind to a raw exported `PRODUCTBRAIN_API_KEY`, which carries no profile
30
+ * name at all: repoint that key at another workspace and the name never moves, so the session
31
+ * stayed "already active" while every write went to a foreign Chain (TEN-3240).
32
+ * - **Binding fingerprint** (TEN-3240) — catches exactly that, because it tracks the credential
33
+ * rather than a name for it.
34
+ *
35
+ * Either firing is enough. Both comparisons are skipped when one side is absent, which is what
36
+ * keeps a session marker written BEFORE `bindingFingerprint` existed on the original name-only
37
+ * behaviour instead of being discarded on every start.
38
+ */
39
+ export declare function bindingChanged(existing: Pick<SessionState, 'profile' | 'bindingFingerprint'>, current: {
40
+ profile: string | null;
41
+ fingerprint: string | undefined;
42
+ }): boolean;
43
+ /**
44
+ * Refuse a session-attributed write whose credential has MOVED since the session opened.
45
+ *
46
+ * `pb session start`'s switch-backstop is not the only door (Codex P1 r9): an operator can
47
+ * repoint an exported PRODUCTBRAIN_API_KEY and then run `pb capture` / `relate` / `update`
48
+ * directly, never re-running start. The marker still names the old workspace while the gateway
49
+ * derives the new one from the key (BR-18) — a cross-workspace write with a stale session id.
50
+ *
51
+ * Compares the fingerprint only: `getConfig()` above has already resolved the credential into
52
+ * `process.env`, so this is arithmetic on values already in hand — no file, no network, on the
53
+ * hot path of every write. Markers written before the field existed carry no fingerprint and are
54
+ * skipped, exactly as the session-start backstop skips them.
55
+ */
56
+ export declare function assertSessionStillBound(session: {
57
+ bindingFingerprint?: string;
58
+ } | null, current?: string | undefined): void;
59
+ //# sourceMappingURL=sessionBinding.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Session binding identity — "is this session still pointed at the same Chain?"
3
+ *
4
+ * Lives outside commands/session.ts, which is grandfathered shrink-only (STD-2 / DEC-1504),
5
+ * and outside config.ts for the same reason. Pure and offline by construction: `process.env` and
6
+ * the stored marker, never a file and never the network — so the deliberately offline
7
+ * already-active session path (WP-696) can call it.
8
+ *
9
+ * It fingerprints the CREDENTIAL, always. An earlier version keyed a preview binding on its
10
+ * workspace NAME so a reseed would not read as a switch — that was unsound twice over (Codex r6
11
+ * P1, r8 P1): an exported key outranks the preview binding, and `seed-preview.mjs` hardcodes the
12
+ * name `Preview Workspace` while deliberately orphaning a stale workspace in the SAME deployment,
13
+ * so two genuinely different workspaces shared one fingerprint. The reseed nuisance it was buying
14
+ * — one extra session restart — is not worth trading a safety property for. Fail safe.
15
+ */
16
+ import { createHash } from 'crypto';
17
+ import { CLIError, ErrorCode } from './errors.js';
18
+ import { DEFAULT_SITE_URL } from './constants.js';
19
+ /**
20
+ * One-way digest of the credential + gateway currently bound, or undefined when nothing is.
21
+ *
22
+ * By the time this runs, `getConfigOrGuide()` has already called `loadEnv()`, so `process.env`
23
+ * holds the credential that actually WON — whatever supplied it (export, pin, profile, preview).
24
+ * That is exactly the property wanted here: the fingerprint moves whenever the effective binding
25
+ * moves, without this module having to know which source produced it.
26
+ *
27
+ * Head-truncated to 16 hex chars: this value is only ever COMPARED, so keeping more would store
28
+ * more of a secret than the job needs. Never the key itself, never sent anywhere.
29
+ */
30
+ export function fingerprintBinding() {
31
+ const key = process.env.PRODUCTBRAIN_API_KEY;
32
+ return key ? fingerprintOf(key, process.env.CONVEX_SITE_URL) : undefined;
33
+ }
34
+ /**
35
+ * The digest itself, taken as arguments rather than read from the environment.
36
+ *
37
+ * Split out so the hashing rules can be tested WITHOUT mutating `process.env`: vitest runs test
38
+ * files in parallel inside shared workers, so a test that deletes `PRODUCTBRAIN_API_KEY` to set up
39
+ * a case yanks it out from under whatever unrelated file is running beside it (observed live —
40
+ * it broke the handshake suite while passing on its own).
41
+ */
42
+ export function fingerprintOf(key, gateway) {
43
+ // Strip the trailing slash exactly as getConfigOrGuide()/loadEnv() do before using the URL.
44
+ // Without this, `https://x/` and `https://x` — the SAME effective endpoint — hash differently,
45
+ // and a session started under one form is spuriously discarded under the other (Codex P2 r2).
46
+ // Resolve the SAME way getConfigOrGuide() does — absent means DEFAULT_SITE_URL, not "no
47
+ // gateway". Hashing '' for the absent case made an explicit export of that exact default look
48
+ // like a different endpoint, discarding a valid session for no reason (Codex P2 r3).
49
+ const normalized = (gateway ?? DEFAULT_SITE_URL).replace(/\/$/, '');
50
+ return createHash('sha256').update(`${key} ${normalized}`).digest('hex').slice(0, 16);
51
+ }
52
+ /**
53
+ * Has the workspace this session was started against changed underneath it?
54
+ *
55
+ * TWO signals, because neither alone is sufficient:
56
+ *
57
+ * - **Profile name** (TEN-2163, the original backstop) — catches `pb profile use`, a preview
58
+ * flip, a pin edit. Blind to a raw exported `PRODUCTBRAIN_API_KEY`, which carries no profile
59
+ * name at all: repoint that key at another workspace and the name never moves, so the session
60
+ * stayed "already active" while every write went to a foreign Chain (TEN-3240).
61
+ * - **Binding fingerprint** (TEN-3240) — catches exactly that, because it tracks the credential
62
+ * rather than a name for it.
63
+ *
64
+ * Either firing is enough. Both comparisons are skipped when one side is absent, which is what
65
+ * keeps a session marker written BEFORE `bindingFingerprint` existed on the original name-only
66
+ * behaviour instead of being discarded on every start.
67
+ */
68
+ export function bindingChanged(existing, current) {
69
+ const profileSwitched = Boolean(existing.profile && current.profile && existing.profile !== current.profile);
70
+ const credentialSwitched = Boolean(existing.bindingFingerprint && current.fingerprint && existing.bindingFingerprint !== current.fingerprint);
71
+ // MIGRATION BACKSTOP. A marker written before `bindingFingerprint` existed cannot be compared on
72
+ // the credential at all, so there is no evidence its workspace is unchanged — and a
73
+ // cross-workspace session survived the upgrade (Codex P1 r7, r8).
74
+ //
75
+ // A matching profile NAME is not that evidence, tempting as it looks: `pb connect` can overwrite
76
+ // an existing profile's credentials in place (connect.ts), so one name can point at two
77
+ // workspaces over time (Codex P1 r13). Treating it as proof was an escape hatch that could be
78
+ // wrong; without it the rule is both simpler and stricter.
79
+ //
80
+ // So it fails CLOSED, always: an unnecessary re-start costs one kernel call, once, while a
81
+ // missed switch costs a wrong-Chain write. It cannot fire on a marker this version wrote —
82
+ // those always carry a fingerprint — so it retires itself as old markers roll over.
83
+ const unprovable = !existing.bindingFingerprint && Boolean(current.fingerprint);
84
+ return profileSwitched || credentialSwitched || unprovable;
85
+ }
86
+ /**
87
+ * Refuse a session-attributed write whose credential has MOVED since the session opened.
88
+ *
89
+ * `pb session start`'s switch-backstop is not the only door (Codex P1 r9): an operator can
90
+ * repoint an exported PRODUCTBRAIN_API_KEY and then run `pb capture` / `relate` / `update`
91
+ * directly, never re-running start. The marker still names the old workspace while the gateway
92
+ * derives the new one from the key (BR-18) — a cross-workspace write with a stale session id.
93
+ *
94
+ * Compares the fingerprint only: `getConfig()` above has already resolved the credential into
95
+ * `process.env`, so this is arithmetic on values already in hand — no file, no network, on the
96
+ * hot path of every write. Markers written before the field existed carry no fingerprint and are
97
+ * skipped, exactly as the session-start backstop skips them.
98
+ */
99
+ export function assertSessionStillBound(session,
100
+ // Injectable for the same reason `fingerprintOf` takes arguments: a test must not mutate the
101
+ // shared process env to set this up (see that function's note).
102
+ current = fingerprintBinding()) {
103
+ // Nothing bound, or a match: nothing to object to.
104
+ if (!session || !current || current === session.bindingFingerprint)
105
+ return;
106
+ // Falling through means either the fingerprints DISAGREE, or the marker carries none at all.
107
+ // A marker without one predates the field, so nothing can prove it still targets the workspace
108
+ // this credential belongs to — the same reasoning `bindingChanged` uses, and now the same answer
109
+ // (Codex P1 r15). Letting that through was the bigger hole of the two: `pb relate` sends no
110
+ // session id, so nothing downstream re-checks. `pb session start` restarts it once and stamps a
111
+ // 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.', {
113
+ code: ErrorCode.SESSION_REQUIRED,
114
+ category: 'session',
115
+ guidance: 'Run `pb session start` to open a session against the current workspace.',
116
+ });
117
+ }
118
+ //# sourceMappingURL=sessionBinding.js.map
@@ -0,0 +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;;;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F,MAAM,UAAU,GAAG,CAAC,QAAQ,CAAC,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAChF,OAAO,eAAe,IAAI,kBAAkB,IAAI,UAAU,CAAC;AAC7D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAA+C;AAC/C,6FAA6F;AAC7F,gEAAgE;AAChE,UAA8B,kBAAkB,EAAE;IAElD,mDAAmD;IACnD,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,OAAO,CAAC,kBAAkB;QAAE,OAAO;IAC3E,6FAA6F;IAC7F,+FAA+F;IAC/F,iGAAiG;IACjG,4FAA4F;IAC5F,gGAAgG;IAChG,mDAAmD;IACnD,MAAM,IAAI,QAAQ,CAChB,6IAA6I,EAC7I;QACE,IAAI,EAAE,SAAS,CAAC,gBAAgB;QAChC,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,yEAAyE;KACpF,CACF,CAAC;AACJ,CAAC"}
@@ -48,6 +48,13 @@ export interface WriteTargetNoticeInput {
48
48
  * - `none` → null (not configured: nothing to name, stay silent).
49
49
  * - `missing-pin` → null (declared project, no pin: the CLI REFUSES this write, so
50
50
  * there is no target workspace to name — and never `→ unknown`).
51
+ * - `cwd-key` → LOUD, unnamed (a dotenv file here picked the Chain — same shape as
52
+ * `env-key`, different file).
53
+ * - `env-key` → LOUD, unnamed (an exported PRODUCTBRAIN_API_KEY picked the Chain;
54
+ * no profile describes it, so the write goes somewhere this process
55
+ * cannot name from config — TEN-3240).
56
+ * - `preview` → named + disposable (a deliberate `npm run pb:preview` binding; the
57
+ * PREVIEW banner already shouts, so this does not shout twice).
51
58
  * - `global` / `default` → qualified + hint (no repo pin → an unpinned fallback binding).
52
59
  * - `local` / `env` → plain (an explicit, intentional binding).
53
60
  *
@@ -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;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI,CAQlG;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAexE"}
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"}
@@ -41,6 +41,13 @@ import { resolveReportedProfile } from './reportedProfile.js';
41
41
  * - `none` → null (not configured: nothing to name, stay silent).
42
42
  * - `missing-pin` → null (declared project, no pin: the CLI REFUSES this write, so
43
43
  * there is no target workspace to name — and never `→ unknown`).
44
+ * - `cwd-key` → LOUD, unnamed (a dotenv file here picked the Chain — same shape as
45
+ * `env-key`, different file).
46
+ * - `env-key` → LOUD, unnamed (an exported PRODUCTBRAIN_API_KEY picked the Chain;
47
+ * no profile describes it, so the write goes somewhere this process
48
+ * cannot name from config — TEN-3240).
49
+ * - `preview` → named + disposable (a deliberate `npm run pb:preview` binding; the
50
+ * PREVIEW banner already shouts, so this does not shout twice).
44
51
  * - `global` / `default` → qualified + hint (no repo pin → an unpinned fallback binding).
45
52
  * - `local` / `env` → plain (an explicit, intentional binding).
46
53
  *
@@ -50,7 +57,23 @@ import { resolveReportedProfile } from './reportedProfile.js';
50
57
  export function formatWriteTargetNotice({ profile, source }) {
51
58
  if (source === 'none' || source === 'missing-pin')
52
59
  return null;
60
+ // Deliberately NOT `→ unknown`: that reads as "a workspace whose name we failed to look up".
61
+ // Here there is no name to look up — the credential itself chose the Chain, so the honest
62
+ // line names the credential and the repair (TEN-3240).
63
+ if (source === 'env-key') {
64
+ return '→ unnamed workspace (PRODUCTBRAIN_API_KEY — the exported key picks the Chain, not a profile)';
65
+ }
66
+ if (source === 'cwd-key') {
67
+ return '→ unnamed workspace (a dotenv file in this directory picks the Chain, not a profile)';
68
+ }
69
+ if (source === 'local-key') {
70
+ return '→ unnamed workspace (config.local.json binds a credential directly, not a profile)';
71
+ }
53
72
  const name = profile?.trim() || 'unknown';
73
+ // Deliberate and disposable: the operator ran `npm run pb:preview`, and index.ts already prints
74
+ // a loud PREVIEW banner on every command — so this names the workspace without a second alarm.
75
+ if (source === 'preview')
76
+ return `→ ${name} (throwaway preview — \`npm run pb:real\` to go back)`;
54
77
  if (source === 'global' || source === 'default') {
55
78
  return `→ ${name} (global default — run from your project dir to use its workspace)`;
56
79
  }
@@ -85,7 +108,11 @@ export async function emitWriteTargetNotice(json) {
85
108
  }
86
109
  if (source === 'none' || source === 'missing-pin')
87
110
  return;
88
- const isUnpinnedFallback = source === 'global' || source === 'default';
111
+ // `env-key` joins the LOUD set (TEN-3240): the write lands in a workspace this process cannot
112
+ // name from config, which is a stronger version of the drift the unpinned fallback warns about
113
+ // — so it must survive `--json`, the mode agents write in.
114
+ const isUnpinnedFallback = source === 'global' || source === 'default' || source === 'env-key'
115
+ || source === 'cwd-key' || source === 'local-key';
89
116
  if (json && !isUnpinnedFallback)
90
117
  return;
91
118
  const notice = formatWriteTargetNotice({ profile, source });
@@ -1 +1 @@
1
- {"version":3,"file":"workspaceNotice.js","sourceRoot":"","sources":["../../src/lib/workspaceNotice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,sBAAsB,EAA8B,MAAM,sBAAsB,CAAC;AAU1F;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CAAC,EAAE,OAAO,EAAE,MAAM,EAA0B;IACjF,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,aAAa;QAAE,OAAO,IAAI,CAAC;IAC/D,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAC1C,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChD,OAAO,KAAK,IAAI,oEAAoE,CAAC;IACvF,CAAC;IACD,sDAAsD;IACtD,OAAO,KAAK,IAAI,EAAE,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAAa;IACvD,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,IAAI,MAAM,GAA0B,MAAM,CAAC;IAC3C,IAAI,CAAC;QACH,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,sBAAsB,EAAE,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,oEAAoE;IAC9E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Q,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChD,OAAO,KAAK,IAAI,oEAAoE,CAAC;IACvF,CAAC;IACD,sDAAsD;IACtD,OAAO,KAAK,IAAI,EAAE,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAAa;IACvD,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,IAAI,MAAM,GAA0B,MAAM,CAAC;IAC3C,IAAI,CAAC;QACH,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,sBAAsB,EAAE,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,oEAAoE;IAC9E,CAAC;IACD,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,aAAa;QAAE,OAAO;IAE1D,8FAA8F;IAC9F,+FAA+F;IAC/F,2DAA2D;IAC3D,MAAM,kBAAkB,GAAG,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;WACzF,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,WAAW,CAAC;IACpD,IAAI,IAAI,IAAI,CAAC,kBAAkB;QAAE,OAAO;IAExC,MAAM,MAAM,GAAG,uBAAuB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5D,IAAI,MAAM;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,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.5083",
3
+ "version": "0.1.0-beta.5105",
4
4
  "description": "Product Brain — Chain knowledge and write-back CLI",
5
5
  "type": "module",
6
6
  "bin": {