@veilio-inc/mcp 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,14 +63,24 @@ result from this server states which namespace produced its placeholders:
63
63
  - **`team`** — resolved against the team's shared dictionary, fetched from
64
64
  Cloud once at startup and reused for the life of the process, so every
65
65
  teammate's agent produces the same placeholder for the same identifier.
66
- - **`local`** — resolved locally: never signed in, offline, or the plan
67
- doesn't include shared dictionaries. This is the normal, fully-functional
68
- state for anyone not on a paid team — the server never blocks on it, and
69
- the fallback is always stated, never silent.
66
+ - **`local`** — resolved locally: not signed in, no team key unlocked on this
67
+ machine, offline, or the plan doesn't include shared dictionaries. This is the
68
+ normal, fully-functional state for anyone not on a paid team — the server never
69
+ blocks on it, and the fallback is always stated, never silent.
70
70
 
71
71
  There is no separate sign-in for the MCP server; it reads the same credential
72
72
  file `veilio login` already wrote.
73
73
 
74
+ The merge happens **here, not in Cloud**: team maps arrive sealed under the team
75
+ key, which the server cannot read. So on a Team plan the namespace is `team` only
76
+ once `veilio team unlock` has opened that key on this machine — it is kept for
77
+ seven days, and a key rotation ends it sooner. Signed in with nothing unlocked,
78
+ the server reports `local`: there is nothing it could decrypt. A single map it
79
+ cannot open is skipped rather than fatal, but a failed read of the namespace as a
80
+ whole reports `local` too, because a namespace missing a teammate's newest map
81
+ would restore their placeholders wrong. An older self-hosted Cloud that still
82
+ merges server-side is honoured as it is, with no key needed here.
83
+
74
84
  The account's custom rules are fetched at startup the same way and applied to
75
85
  every anonymize call. Each result states their source: `from Cloud`, `cached`
76
86
  (Cloud did not answer, so the last `veilio rules pull` is used, with its age),
@@ -1,26 +1,26 @@
1
- import { type TeamMapEntry } from '@veilio-inc/engine';
1
+ import { type TeamNamespaceResult } from '@veilio-inc/cli/team-namespace';
2
2
  export type NamespaceSource = 'team' | 'local';
3
3
  export interface ResolvedNamespace {
4
4
  source: NamespaceSource;
5
- /** Placeholder -> identifier. Empty for 'local' — there is nothing to merge. */
5
+ /** Placeholder -> identifier, WITHOUT the disputed placeholders - so this
6
+ * server never emits one. Empty for 'local'. */
6
7
  namespace: Record<string, string>;
7
- /**
8
- * Placeholders the team's saved maps give DIFFERENT identifiers (maps saved
9
- * before Cloud reserved numbers - spec 017). Left out of `namespace`, so this
10
- * server never emits one, and `restore_text` refuses to guess them.
11
- */
12
- conflicts: string[];
13
- /**
14
- * Highest number per placeholder base in ANY readable team map, conflicts
15
- * included. New names are numbered above it, so this server never hands a
16
- * new identifier a number the team already uses for something else.
17
- */
8
+ /** A second number a team map kept for an identifier that already had one
9
+ * (spec 017): text sent with it must restore too (spec 028). */
10
+ aliases: Record<string, string>;
11
+ /** Placeholders the team's saved maps give DIFFERENT identifiers -> how many.
12
+ * Never emitted, never guessed back (spec 017). */
13
+ conflicts: Record<string, number>;
14
+ /** Highest number per placeholder base in any readable team map, conflicts
15
+ * included: new names are numbered above it. */
18
16
  highest: Record<string, number>;
17
+ /** What the CLI's resolver found - including why it is 'local' when the team
18
+ * exists but its maps were not read (locked, unavailable). Never silent. */
19
+ found: TeamNamespaceResult;
20
+ /** False for an older instance's server-merged namespace: usable to anonymize,
21
+ * never to restore - it cannot tell a disputed placeholder (spec 028). */
22
+ conflictDetection: boolean;
19
23
  }
20
- /** Highest number per base across every readable map. */
21
- export declare function highestAcross(entries: readonly TeamMapEntry[]): Record<string, number>;
22
- /** Placeholders that readable maps give more than one identifier. */
23
- export declare function findConflicts(entries: readonly TeamMapEntry[]): string[];
24
24
  /**
25
25
  * Resolve the namespace once and cache it for the rest of the process.
26
26
  *
@@ -28,7 +28,20 @@ export declare function findConflicts(entries: readonly TeamMapEntry[]): string[
28
28
  * their own request. `home` is injectable for tests; production leaves it
29
29
  * undefined and `readCredential` falls back to the real home directory.
30
30
  */
31
- export declare function primeNamespace(home?: string): Promise<ResolvedNamespace>;
31
+ export declare function primeNamespace(home?: string, opts?: {
32
+ retryDelayMs?: number;
33
+ }): Promise<ResolvedNamespace>;
34
+ /**
35
+ * The cache must not outlive the reason it was cached (review): `veilio team
36
+ * unlock` run after this server started said "restore again" and every retry
37
+ * met the same cached `locked`. Called at the start of each tool call. Cheap
38
+ * and synchronous - a local file read - and never waits: when there is
39
+ * something new to fetch it starts the fetch and says 'loading'; the next call
40
+ * sees the result. A settled `team` or `local` is kept for the process.
41
+ */
42
+ export declare function refreshNamespaceIfStale(): 'unlocked' | 'retrying' | null;
43
+ /** Test support and callers that can wait: the in-flight (or last) resolution. */
44
+ export declare function namespaceSettled(): Promise<ResolvedNamespace>;
32
45
  /** The already-resolved namespace. `local` (with an empty namespace) until
33
46
  * `primeNamespace` has been called and settled — the safe default for any
34
47
  * caller that never primes, including every existing offline-only test. */
@@ -36,35 +49,29 @@ export declare function getNamespace(): ResolvedNamespace;
36
49
  /** Test-only: forget the cached result so the next `primeNamespace` refetches. */
37
50
  export declare function resetNamespaceCache(): void;
38
51
  /**
39
- * Overlay a team namespace onto a local map, safely.
40
- *
41
- * Both are `Record<placeholder, identifier>`, and that similarity is a trap: the
42
- * two placeholder spaces are numbered independently — the local map by this
43
- * project's own engine, the team's by `mergeTeamNamespace` walking every
44
- * member's own maps — so `__CLS__1` in one has no relation to `__CLS__1` in the
45
- * other beyond coincidence. A blind `{ ...local, ...team }` merge treats that
46
- * coincidence as identity: two different identifiers that happen to land on the
47
- * same key collide, `saveMap` then refuses the write as data loss (or, worse,
48
- * silently drops one identifier's real mapping if the guard is bypassed), and
49
- * text already restored under the shadowed placeholder now resolves to the
50
- * wrong name.
52
+ * The namespace line every anonymize result carries, with the reason when the
53
+ * team exists but was not used - so a fallback is never mistaken for agreement.
54
+ */
55
+ export declare function namespaceLine(resolved: ResolvedNamespace): string;
56
+ /**
57
+ * The map handed to the engine to anonymize: this project's store and the
58
+ * team's namespace, reconciled so that nothing emitted can mean something else
59
+ * to a teammate (spec 028 R5; this replaced spec 005's "the local placeholder
60
+ * wins", which after a lapse emitted staging's `createInvoice` as __FN__1 - the
61
+ * team's `chargeCustomer`).
51
62
  *
52
- * So this reconciles by IDENTIFIER, which is the thing two teammates actually
53
- * want to agree on, and it only ever ADDS to `local` — never overwrites an
54
- * existing key, never introduces a second placeholder for an identifier `local`
55
- * already has under a different one:
63
+ * The two placeholder spaces are numbered independently, so a shared key is
64
+ * coincidence, not identity:
56
65
  *
57
- * - an identifier already known locally (under any placeholder) keeps its
58
- * local placeholder — converging it to the team's would relabel every
59
- * already-anonymized reference to it, which is not this call's to decide
60
- * - a team entry whose placeholder KEY is already taken locally by a
61
- * DIFFERENT identifier is dropped rather than forced in; that one
62
- * identifier just doesn't converge with the team this round and gets a
63
- * fresh local placeholder from the engine instead, which is a safe
64
- * degradation, not a corruption
65
- * - everything else — a team identifier neither known locally nor colliding
66
- * on key — is added under the team's placeholder, which is the case two
67
- * fresh sessions (T044) actually converge through
66
+ * - An identifier the team knows takes the TEAM's placeholder. The project's
67
+ * own placeholder for it is left out (it stays in the store, for restoring
68
+ * text already sent) - one placeholder per identifier, always.
69
+ * - A placeholder the project's store and the team use for DIFFERENT
70
+ * identifiers is used for neither: the store must keep its meaning (text was
71
+ * sent with it; `saveMap` refuses to lose it), and emitting it would mean the
72
+ * team's identifier to every teammate. Both identifiers get fresh numbers.
73
+ * - Everything else - a local entry the team does not contradict, a team entry
74
+ * the store does not contradict - is used as it is.
68
75
  */
69
76
  export declare function mergeNamespace(local: Record<string, string>, team: Record<string, string>): Record<string, string>;
70
77
  //# sourceMappingURL=namespace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../src/namespace.ts"],"names":[],"mappings":"AA4BA,OAAO,EAKL,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAA;AAE3B,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAA;AAE9C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,eAAe,CAAA;IACvB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC,MAA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D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC;qDACiD;IACjD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B;iFAC6E;IAC7E,KAAK,EAAE,mBAAmB,CAAA;IAC1B;+EAC2E;IAC3E,iBAAiB,EAAE,OAAO,CAAA;CAC3B;AA2CD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,GAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAY5B;AAUD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,IAAI,UAAU,GAAG,UAAU,GAAG,IAAI,CAqBxE;AAGD,kFAAkF;AAClF,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAE7D;AAED;;4EAE4E;AAC5E,wBAAgB,YAAY,IAAI,iBAAiB,CAEhD;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,IAAI,IAAI,CAM1C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAQjE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBxB"}
package/dist/namespace.js CHANGED
@@ -15,184 +15,43 @@
15
15
  // whole JSON-RPC pipeline (server.ts, tools.ts) synchronous rather than
16
16
  // threading a Promise through 78 existing call sites for one network call that
17
17
  // happens once per process.
18
+ import { resolveTeamNamespace } from '@veilio-inc/cli/team-namespace';
18
19
  import { readCredential } from '@veilio-inc/cli/credential';
19
- import { CloudError, listMaps, getMap, getTeamEnvelopes, } from '@veilio-inc/cli/cloud';
20
20
  import { readTeamUnlock } from '@veilio-inc/cli/team-unlock';
21
- import { importTeamKey, decryptTeamMapWithAny, mergeTeamNamespace, } from '@veilio-inc/engine';
22
- const LOCAL = { source: 'local', namespace: {}, conflicts: [], highest: {} };
23
- const NUMBERED = /^(__[A-Z][A-Z0-9_]*__)(\d+)$/;
24
- /** Highest number per base across every readable map. */
25
- export function highestAcross(entries) {
26
- const out = {};
27
- for (const entry of entries) {
28
- for (const placeholder of Object.keys(entry.map ?? {})) {
29
- const m = NUMBERED.exec(placeholder);
30
- if (m && Number(m[2]) > (out[m[1]] ?? 0))
31
- out[m[1]] = Number(m[2]);
32
- }
33
- }
34
- return out;
35
- }
36
- /** Placeholders that readable maps give more than one identifier. */
37
- export function findConflicts(entries) {
38
- const meanings = new Map();
39
- for (const entry of entries) {
40
- for (const [placeholder, identifier] of Object.entries(entry.map ?? {})) {
41
- const seen = meanings.get(placeholder) ?? new Set();
42
- seen.add(identifier);
43
- meanings.set(placeholder, seen);
44
- }
45
- }
46
- return [...meanings].filter(([, seen]) => seen.size > 1).map(([p]) => p);
21
+ function localFrom(found) {
22
+ return {
23
+ source: 'local',
24
+ namespace: {},
25
+ aliases: {},
26
+ conflicts: {},
27
+ highest: {},
28
+ found,
29
+ conflictDetection: true,
30
+ };
47
31
  }
32
+ const LOCAL = localFrom({ status: 'local' });
48
33
  let current = LOCAL;
49
34
  let priming = null;
50
- /**
51
- * Build the team namespace from maps this member can actually open.
52
- *
53
- * Cloud used to merge these server-side and send the result. It stopped,
54
- * because merging meant decrypting every team map, and that was the only reason
55
- * it held a key that could read them. So the merge happens here now, over maps
56
- * only this member can decrypt, and the server holds nothing that would let it
57
- * do the same (spec 010).
58
- *
59
- * Entitlement is still not decided here, and still does not need to be. Cloud
60
- * serves team maps only for teams in `access.teams`, and refuses a non-member's
61
- * request for a team key outright. A user outside a paid team gets neither, so
62
- * there is nothing to merge — the gate is the data, not a flag this code reads.
63
- */
64
- async function buildTeamNamespace(credential, keys, list) {
65
- // A member's OWN team maps arrive under personalMaps — the listing splits by
66
- // ownership, not by scope — so both lists have to be considered or this
67
- // member's own placeholders drop out of the shared namespace.
68
- const teamScoped = [...list.personalMaps, ...list.teamMaps].filter((m) => m.scope === 'team');
69
- const entries = await readTeamEntries(credential, keys, teamScoped);
70
- const merged = mergeTeamNamespace(entries);
71
- // Every map unreadable is not a team namespace, it is a failed one. Saying
72
- // `local` is honest; an empty `team` would claim agreement that is not there.
73
- if (Object.keys(merged).length === 0)
74
- return null;
75
- const conflicts = findConflicts(entries);
76
- const namespace = Object.fromEntries(Object.entries(merged).filter(([p]) => !conflicts.includes(p)));
77
- return { namespace, conflicts, highest: highestAcross(entries) };
78
- }
79
- /**
80
- * The team keys this machine has unlocked, if any.
81
- *
82
- * Read from disk rather than derived, because an MCP server starts inside a
83
- * coding agent with nobody present to type a vault passphrase. `veilio team
84
- * unlock` is the interactive run that puts them there; see the CLI's
85
- * `team-unlock.ts` for what is stored and what it costs.
86
- *
87
- * Absent, expired, or belonging to another account all read the same way —
88
- * nothing unlocked — because all three mean the same thing here.
89
- */
90
- async function heldTeamKeys(credential, home, teamId) {
91
- const unlock = readTeamUnlock({ instance: credential.instance, account: credential.account }, home);
92
- if (!unlock)
93
- return [];
94
- // Unlocked for a different team than the one this account is currently in.
95
- // Possible after leaving one team and joining another without re-unlocking.
96
- if (unlock.teamId !== teamId)
97
- return [];
98
- const keys = [];
99
- for (const stored of unlock.keys) {
100
- try {
101
- keys.push({ version: stored.version, key: await importTeamKey(stored.key) });
102
- }
103
- catch {
104
- // A damaged entry. Skipped rather than fatal, for the same reason an
105
- // unopenable map is: the others may still carry the team's namespace.
106
- continue;
107
- }
108
- }
109
- return keys;
110
- }
111
- /**
112
- * Every team map, opened with the held keys. One request where Cloud offers it;
113
- * one per map only for an instance that predates it (404). A failure of the
114
- * single request is NOT turned into skipped maps: it throws, and the caller
115
- * reports `local` - a namespace missing a teammate's newest map restored their
116
- * placeholders wrong (found on staging, 2026-09-26).
117
- */
118
- async function readTeamEntries(credential, keys, teamScoped) {
119
- let bulk;
120
- try {
121
- bulk = await getTeamEnvelopes(credential);
122
- }
123
- catch (err) {
124
- if (err instanceof CloudError && err.status === 404) {
125
- return Promise.all(teamScoped.map((m) => openTeamMap(credential, m, keys)));
126
- }
127
- throw err;
128
- }
129
- return Promise.all(bulk.maps.map(async (row) => {
130
- try {
131
- const envelope = JSON.parse(row.map_data);
132
- return { createdAt: row.created_at, map: await decryptTeamMapWithAny(keys, envelope) };
133
- }
134
- catch {
135
- // A version this member was never granted: skipped, not fatal.
136
- return { createdAt: row.created_at, map: null };
137
- }
138
- }));
139
- }
140
- /** One team map, opened if any held key fits. */
141
- async function openTeamMap(credential, summary, keys) {
142
- const miss = { createdAt: summary.created_at, map: null };
143
- try {
144
- const full = await getMap(credential, summary.id);
145
- // A server-decrypted map arrives as an object. Nothing to open, and nothing
146
- // that should be here — but reading it is safe and losing it would drop a
147
- // teammate's placeholders for no reason.
148
- if (typeof full.map_data !== 'string') {
149
- return { createdAt: summary.created_at, map: full.map_data };
150
- }
151
- const envelope = JSON.parse(full.map_data);
152
- return {
153
- createdAt: summary.created_at,
154
- map: await decryptTeamMapWithAny(keys, envelope),
155
- };
156
- }
157
- catch {
158
- // One unreadable map must never cost the team its namespace. `null` is how
159
- // mergeTeamNamespace is told to skip it.
160
- return miss;
161
- }
162
- }
163
- async function fetchNamespace(home) {
164
- const credential = readCredential(home);
165
- // Not signed in. No request — a signed-out terminal has nothing to ask Cloud.
166
- if (!credential)
167
- return LOCAL;
168
- try {
169
- const list = await listMaps(credential);
170
- // An older self-hosted Cloud may still merge server-side, and that answer
171
- // needs no key at all. Checked before the vault key so such a deployment
172
- // keeps working for a member who has not unlocked one.
173
- if (list.teamNamespace) {
174
- return { source: 'team', namespace: list.teamNamespace, conflicts: [], highest: {} };
175
- }
176
- // Past here everything must be decrypted locally, so without keys on disk
177
- // there is nothing further to try. That is the state until somebody has run
178
- // `veilio team unlock` in a terminal.
179
- const teamId = list.team?.id;
180
- if (!teamId)
181
- return LOCAL;
182
- const keys = await heldTeamKeys(credential, home, teamId);
183
- if (keys.length === 0)
184
- return LOCAL;
185
- const built = await buildTeamNamespace(credential, keys, list);
186
- if (!built)
187
- return LOCAL;
188
- return { source: 'team', ...built };
189
- }
190
- catch {
191
- // Unreachable, revoked session, timed out — every network or auth failure
192
- // degrades the same way. A coding agent must keep working when Cloud is
193
- // down; the fallback itself is what gets reported, not this failure.
194
- return LOCAL;
35
+ /** The CLI's resolver, shaped for this server (spec 028: one resolver for both). */
36
+ async function fetchNamespace(home, opts) {
37
+ const found = await resolveTeamNamespace(home, opts);
38
+ if (found.status !== 'team')
39
+ return localFrom(found);
40
+ const { namespace, aliases, conflicts, highest } = found.analysis;
41
+ // A team with no maps yet has no namespace to share: 'local', as before. (A
42
+ // team whose maps exist but none opened is 'unavailable', from the resolver.)
43
+ if (Object.keys(namespace).length === 0 && Object.keys(conflicts).length === 0) {
44
+ return localFrom({ status: 'local' });
195
45
  }
46
+ return {
47
+ source: 'team',
48
+ namespace: Object.fromEntries(Object.entries(namespace).filter(([p]) => !(p in conflicts))),
49
+ aliases,
50
+ conflicts,
51
+ highest,
52
+ found,
53
+ conflictDetection: found.conflictDetection,
54
+ };
196
55
  }
197
56
  /**
198
57
  * Resolve the namespace once and cache it for the rest of the process.
@@ -201,15 +60,57 @@ async function fetchNamespace(home) {
201
60
  * their own request. `home` is injectable for tests; production leaves it
202
61
  * undefined and `readCredential` falls back to the real home directory.
203
62
  */
204
- export function primeNamespace(home) {
63
+ export function primeNamespace(home, opts = {}) {
64
+ primedWith = { home, opts };
65
+ lastAttemptAt = Date.now();
205
66
  if (!priming) {
206
- priming = fetchNamespace(home).then((resolved) => {
67
+ priming = fetchNamespace(home, { deadlineMs: STARTUP_DEADLINE_MS, ...opts }).then((resolved) => {
207
68
  current = resolved;
208
69
  return resolved;
209
70
  });
210
71
  }
211
72
  return priming;
212
73
  }
74
+ /** A hung instance must not hold the agent's first tool call for 30 s. */
75
+ const STARTUP_DEADLINE_MS = 10_000;
76
+ /** How often an 'unavailable' team is asked again, from a tool call. */
77
+ const UNAVAILABLE_RECHECK_MS = 30_000;
78
+ let primedWith = { opts: {} };
79
+ let lastAttemptAt = 0;
80
+ /**
81
+ * The cache must not outlive the reason it was cached (review): `veilio team
82
+ * unlock` run after this server started said "restore again" and every retry
83
+ * met the same cached `locked`. Called at the start of each tool call. Cheap
84
+ * and synchronous - a local file read - and never waits: when there is
85
+ * something new to fetch it starts the fetch and says 'loading'; the next call
86
+ * sees the result. A settled `team` or `local` is kept for the process.
87
+ */
88
+ export function refreshNamespaceIfStale() {
89
+ const status = current.found.status;
90
+ if (status !== 'locked' && status !== 'unavailable')
91
+ return null;
92
+ if (priming && !settledFlag)
93
+ return status === 'locked' ? 'unlocked' : 'retrying';
94
+ const now = Date.now();
95
+ const credential = status === 'locked' ? readCredential(primedWith.home) : null;
96
+ const due = status === 'locked'
97
+ ? credential !== null &&
98
+ readTeamUnlock({ instance: credential.instance, account: credential.account }, primedWith.home) !== null
99
+ : now - lastAttemptAt >= UNAVAILABLE_RECHECK_MS;
100
+ if (!due)
101
+ return null;
102
+ priming = null;
103
+ settledFlag = false;
104
+ void primeNamespace(primedWith.home, primedWith.opts).then(() => {
105
+ settledFlag = true;
106
+ });
107
+ return status === 'locked' ? 'unlocked' : 'retrying';
108
+ }
109
+ let settledFlag = true;
110
+ /** Test support and callers that can wait: the in-flight (or last) resolution. */
111
+ export function namespaceSettled() {
112
+ return priming ?? Promise.resolve(current);
113
+ }
213
114
  /** The already-resolved namespace. `local` (with an empty namespace) until
214
115
  * `primeNamespace` has been called and settled — the safe default for any
215
116
  * caller that never primes, including every existing offline-only test. */
@@ -220,48 +121,62 @@ export function getNamespace() {
220
121
  export function resetNamespaceCache() {
221
122
  current = LOCAL;
222
123
  priming = null;
124
+ settledFlag = true;
125
+ lastAttemptAt = 0;
126
+ primedWith = { opts: {} };
223
127
  }
224
128
  /**
225
- * Overlay a team namespace onto a local map, safely.
226
- *
227
- * Both are `Record<placeholder, identifier>`, and that similarity is a trap: the
228
- * two placeholder spaces are numbered independently — the local map by this
229
- * project's own engine, the team's by `mergeTeamNamespace` walking every
230
- * member's own maps — so `__CLS__1` in one has no relation to `__CLS__1` in the
231
- * other beyond coincidence. A blind `{ ...local, ...team }` merge treats that
232
- * coincidence as identity: two different identifiers that happen to land on the
233
- * same key collide, `saveMap` then refuses the write as data loss (or, worse,
234
- * silently drops one identifier's real mapping if the guard is bypassed), and
235
- * text already restored under the shadowed placeholder now resolves to the
236
- * wrong name.
129
+ * The namespace line every anonymize result carries, with the reason when the
130
+ * team exists but was not used - so a fallback is never mistaken for agreement.
131
+ */
132
+ export function namespaceLine(resolved) {
133
+ if (resolved.source === 'team')
134
+ return 'Namespace: team';
135
+ const { found } = resolved;
136
+ if (found.status === 'locked')
137
+ return 'Namespace: local (the team key is locked on this machine - run `veilio team unlock`)';
138
+ if (found.status === 'unavailable')
139
+ return `Namespace: local (could not read the team's maps: ${found.reason})`;
140
+ return 'Namespace: local';
141
+ }
142
+ /**
143
+ * The map handed to the engine to anonymize: this project's store and the
144
+ * team's namespace, reconciled so that nothing emitted can mean something else
145
+ * to a teammate (spec 028 R5; this replaced spec 005's "the local placeholder
146
+ * wins", which after a lapse emitted staging's `createInvoice` as __FN__1 - the
147
+ * team's `chargeCustomer`).
237
148
  *
238
- * So this reconciles by IDENTIFIER, which is the thing two teammates actually
239
- * want to agree on, and it only ever ADDS to `local` — never overwrites an
240
- * existing key, never introduces a second placeholder for an identifier `local`
241
- * already has under a different one:
149
+ * The two placeholder spaces are numbered independently, so a shared key is
150
+ * coincidence, not identity:
242
151
  *
243
- * - an identifier already known locally (under any placeholder) keeps its
244
- * local placeholder — converging it to the team's would relabel every
245
- * already-anonymized reference to it, which is not this call's to decide
246
- * - a team entry whose placeholder KEY is already taken locally by a
247
- * DIFFERENT identifier is dropped rather than forced in; that one
248
- * identifier just doesn't converge with the team this round and gets a
249
- * fresh local placeholder from the engine instead, which is a safe
250
- * degradation, not a corruption
251
- * - everything else — a team identifier neither known locally nor colliding
252
- * on key — is added under the team's placeholder, which is the case two
253
- * fresh sessions (T044) actually converge through
152
+ * - An identifier the team knows takes the TEAM's placeholder. The project's
153
+ * own placeholder for it is left out (it stays in the store, for restoring
154
+ * text already sent) - one placeholder per identifier, always.
155
+ * - A placeholder the project's store and the team use for DIFFERENT
156
+ * identifiers is used for neither: the store must keep its meaning (text was
157
+ * sent with it; `saveMap` refuses to lose it), and emitting it would mean the
158
+ * team's identifier to every teammate. Both identifiers get fresh numbers.
159
+ * - Everything else - a local entry the team does not contradict, a team entry
160
+ * the store does not contradict - is used as it is.
254
161
  */
255
162
  export function mergeNamespace(local, team) {
256
- const merged = { ...local };
257
- const knownIdentifiers = new Set(Object.values(local));
163
+ const merged = {};
164
+ const placed = new Set();
258
165
  for (const [placeholder, identifier] of Object.entries(team)) {
259
- if (knownIdentifiers.has(identifier))
166
+ if (placeholder in local && local[placeholder] !== identifier)
167
+ continue;
168
+ if (placed.has(identifier))
169
+ continue;
170
+ merged[placeholder] = identifier;
171
+ placed.add(identifier);
172
+ }
173
+ for (const [placeholder, identifier] of Object.entries(local)) {
174
+ if (placeholder in team && team[placeholder] !== identifier)
260
175
  continue;
261
- if (placeholder in merged)
176
+ if (placed.has(identifier))
262
177
  continue;
263
178
  merged[placeholder] = identifier;
264
- knownIdentifiers.add(identifier);
179
+ placed.add(identifier);
265
180
  }
266
181
  return merged;
267
182
  }
@@ -1 +1 @@
1
- {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../src/namespace.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iFAAiF;AACjF,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,iEAAiE;AACjE,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,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AkPD,eAAO,MAAM,KAAK,EAAE,cAAc,EAqJjC,CAAA;AAED,eAAO,MAAM,aAAa,6BAAyC,CAAA;AAEnE;;wEAEwE;AACxE,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,UAAU,CASZ"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAuDA,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAA;IACX,yEAAyE;IACzE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,WAAW,KAAK,UAAU,CAAA;CACzE;AA0QD,eAAO,MAAM,KAAK,EAAE,cAAc,EAiLjC,CAAA;AAED,eAAO,MAAM,aAAa,6BAAyC,CAAA;AAEnE;;wEAEwE;AACxE,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,UAAU,CASZ"}
package/dist/tools.js CHANGED
@@ -17,9 +17,16 @@
17
17
  // model does not reach for it out of convenience and quietly defeat the purpose.
18
18
  import { readFileSync } from 'node:fs';
19
19
  import { isAbsolute, relative, resolve } from 'node:path';
20
- import { anonymize, detectSecrets, isPlaceholder, restore, summarizeSecrets, withAiPreamble, BIN_NAME, LANGUAGES, LANGUAGE_LABELS, PRODUCT_NAME, } from '@veilio-inc/engine';
20
+ import { anonymize, detectSecrets, isPlaceholder, restore, restoreLayers, disputedNote, locallyNumberedNote, summarizeSecrets, withAiPreamble, BIN_NAME, LANGUAGES, LANGUAGE_LABELS, PRODUCT_NAME, } from '@veilio-inc/engine';
21
21
  import { loadMap, resolveMapPath, saveMap } from '@veilio-inc/cli/store';
22
- import { getNamespace, mergeNamespace } from './namespace.js';
22
+ import { getNamespace, mergeNamespace, namespaceLine, refreshNamespaceIfStale, } from './namespace.js';
23
+ import { teamLayerNote } from '@veilio-inc/cli/team-namespace';
24
+ /** Said when a tool call has just started reloading the team's maps. */
25
+ function loadingNote(why) {
26
+ return why === 'unlocked'
27
+ ? "Note: the team key was unlocked - loading the team's maps now; call again in a moment to use them."
28
+ : "Note: asking Cloud for the team's maps again; call again in a moment to use them.";
29
+ }
23
30
  import { getRules } from './rules.js';
24
31
  import { describeAge } from '@veilio-inc/cli/rules';
25
32
  // ─── Helpers ─────────────────────────────────────────────────────────────────
@@ -137,6 +144,16 @@ const FLOOR_MARKER = '\u0000floor:';
137
144
  * returned map. Only added above the map's own highest, where they cannot
138
145
  * overwrite a real entry. Same technique as the Cloud web app.
139
146
  */
147
+ /** The team's highest number per base, raised to this project's own where higher. */
148
+ function floorsWith(highest, local) {
149
+ const floors = { ...highest };
150
+ for (const placeholder of Object.keys(local)) {
151
+ const m = NUMBERED.exec(placeholder);
152
+ if (m && Number(m[2]) > (floors[m[1]] ?? 0))
153
+ floors[m[1]] = Number(m[2]);
154
+ }
155
+ return floors;
156
+ }
140
157
  function anonymizeAbove(source, options, floors) {
141
158
  const inMap = {};
142
159
  for (const p of Object.keys(options.existingMap)) {
@@ -166,11 +183,16 @@ function runAnonymize(source, label, args, ctx) {
166
183
  // independently and a shared key is coincidence, not identity. See
167
184
  // mergeNamespace's own comment for why a naive `{ ...local, ...namespace }`
168
185
  // corrupts the store (spec 005 US4).
169
- const { source: namespaceSource, namespace, highest } = getNamespace();
186
+ const refreshing = refreshNamespaceIfStale();
187
+ const resolved = getNamespace();
188
+ const { namespace, highest } = resolved;
170
189
  const existingMap = mergeNamespace(localMap, namespace);
171
190
  const language = (str(args, 'language') ?? 'auto');
172
191
  const rules = getRules();
173
- const result = anonymizeAbove(source, { existingMap, language, secrets: 'redact', rules: rules.rules }, highest);
192
+ // New names go above the team's numbers AND this project's own: an entry
193
+ // mergeNamespace left out (a lapse-era number) stays in the store, and a new
194
+ // identifier must never be handed its number (spec 028 R5).
195
+ const result = anonymizeAbove(source, { existingMap, language, secrets: 'redact', rules: rules.rules }, floorsWith(highest, localMap));
174
196
  // Persist local-original, whatever this call genuinely minted, and only the
175
197
  // team-overlay entries this call actually USED — never the rest of the team
176
198
  // namespace. Persisting all of it would bake entries this project never
@@ -179,9 +201,14 @@ function runAnonymize(source, label, args, ctx) {
179
201
  // resolving through team placeholders while truthfully reporting `local`.
180
202
  // Persisting none of it, the other extreme, breaks `restore_text` for a
181
203
  // team placeholder that IS sitting in the output this call just returned.
182
- const toPersist = Object.fromEntries(Object.entries(result.map).filter(([placeholder]) => !(placeholder in namespace) ||
183
- placeholder in localMap ||
184
- appearsAsToken(result.anonymized, placeholder)));
204
+ // Every entry the store already held is kept - including one mergeNamespace
205
+ // left out of this call - because text was already sent with it.
206
+ const toPersist = {
207
+ ...localMap,
208
+ ...Object.fromEntries(Object.entries(result.map).filter(([placeholder]) => !(placeholder in namespace) ||
209
+ placeholder in localMap ||
210
+ appearsAsToken(result.anonymized, placeholder))),
211
+ };
185
212
  saveMap(mapPath, toPersist);
186
213
  const body = args.preamble === true ? withAiPreamble(result.anonymized, result.map) : result.anonymized;
187
214
  // The model reading this is about to reason over the masked text, and these
@@ -207,7 +234,8 @@ function runAnonymize(source, label, args, ctx) {
207
234
  `Placeholders in map: ${Object.keys(toPersist).length}`,
208
235
  // Never absent (FR-016, Constitution V): a result that cannot say where its
209
236
  // names came from is the silent fallback this line exists to rule out.
210
- `Namespace: ${namespaceSource}`,
237
+ namespaceLine(resolved),
238
+ ...(refreshing ? [loadingNote(refreshing)] : []),
211
239
  // Stated every time, like the namespace: an agent whose masking ignored the
212
240
  // team's rules must be able to tell.
213
241
  rulesLine(rules),
@@ -291,27 +319,52 @@ export const TOOLS = [
291
319
  },
292
320
  handler: (args, ctx) => {
293
321
  const text = str(args, 'text', true);
294
- const map = loadMap(resolveMapPath(ctx.mapPath, ctx.cwd));
295
- if (Object.keys(map).length === 0) {
322
+ const own = loadMap(resolveMapPath(ctx.mapPath, ctx.cwd));
323
+ // The one restore rule (spec 028), shared with the web app and the CLI:
324
+ // the team's maps - aliases included, disputed placeholders left out -
325
+ // then this project's map on top where it is in the team's numbering.
326
+ const refreshing = refreshNamespaceIfStale();
327
+ const resolved = getNamespace();
328
+ const team = resolved.source === 'team' && resolved.conflictDetection
329
+ ? {
330
+ namespace: resolved.namespace,
331
+ aliases: resolved.aliases,
332
+ conflicts: resolved.conflicts,
333
+ }
334
+ : null;
335
+ const unexplained = restore(text, own).report.unresolved;
336
+ const found = resolved.found;
337
+ const note = team ? null : teamLayerNote(found, unexplained);
338
+ if (Object.keys(own).length === 0 && !team && !note) {
296
339
  throw new ToolError(`no symbol map yet — run anonymize_file (or "${BIN_NAME} scrub") first`);
297
340
  }
298
- // A placeholder the team's maps disagree about is never guessed (spec
299
- // 017): a wrong restore reads exactly like a right one. It stays in the
300
- // text and is named, whatever the local store says it means.
301
- const { conflicts } = getNamespace();
302
- for (const placeholder of conflicts)
303
- delete map[placeholder];
304
- const ambiguous = conflicts.filter((p) => appearsAsToken(text, p));
305
- const result = restore(text, map);
306
- const ambiguity = ambiguous.length === 0
307
- ? ''
308
- : `\n\nWARNING: left as is: ${ambiguous.join(', ')}. The team's saved maps give ` +
309
- `${ambiguous.length === 1 ? 'this placeholder' : 'these placeholders'} different ` +
310
- `identifiers, so restoring would be a guess.`;
341
+ const layers = restoreLayers({ own, team });
342
+ const disputed = layers.disputedIn(text);
343
+ const localOnly = layers.locallyNumberedIn(text);
344
+ const result = restore(text, layers.map);
345
+ // Measured against this project's map, not the whole team layer (review),
346
+ // and a placeholder left for a named reason is not "invented".
347
+ const report = {
348
+ ...result.report,
349
+ missing: result.report.missing.filter((p) => p in own),
350
+ unresolved: result.report.unresolved.filter((p) => !disputed.includes(p) && !localOnly.includes(p)),
351
+ };
352
+ const counted = new Set([...Object.keys(own), ...result.report.resolved]).size;
353
+ const warnings = [
354
+ ...(refreshing ? [loadingNote(refreshing)] : []),
355
+ ...(note ? [`WARNING: ${note}`] : []),
356
+ ...(disputed.length ? [`WARNING: ${disputedNote(disputed)}`] : []),
357
+ ...(localOnly.length ? [`WARNING: ${locallyNumberedNote(localOnly)}`] : []),
358
+ ];
359
+ // Unrestored team placeholders because the team's maps could not be used
360
+ // (locked, unreadable): not a success, whatever else restored (FR-005).
361
+ const failed = found.status === 'locked' || found.status === 'unavailable';
311
362
  return {
312
- text: `Restored ${result.report.resolved.length} of ${Object.keys(map).length} placeholders; ` +
363
+ isError: note !== null && failed,
364
+ text: `Restored ${result.report.resolved.length} of ${counted} placeholders; ` +
313
365
  `stripped ${result.strippedCount} AI artifact(s).` +
314
- `${restoreReportLines(result.report)}${ambiguity}\n\n--- restored ---\n${result.restored}`,
366
+ `${restoreReportLines(report)}` +
367
+ `${warnings.length ? `\n\n${warnings.join('\n')}` : ''}\n\n--- restored ---\n${result.restored}`,
315
368
  };
316
369
  },
317
370
  },
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,EAAE;AACF,oCAAoC;AACpC,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,aAAa;AACb,EAAE;AACF,8EAA8E;AAC9E,mEAAmE;AACnE,iFAAiF;AACjF,yEAAyE;AACzE,EAAE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,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAChE,OAAO,EAAE,IAAI,EAAE,GAAG,YAAY,KAAK,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IAC/D,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veilio-inc/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "MCP server exposing the anonymizer to coding agents, so a model can work on masked code without the real identifiers ever entering its context.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  ],
28
28
  "license": "SEE LICENSE IN LICENSE",
29
29
  "dependencies": {
30
- "@veilio-inc/engine": "^1.6.2",
31
- "@veilio-inc/cli": "^0.3.0"
30
+ "@veilio-inc/engine": "^1.7.0",
31
+ "@veilio-inc/cli": "^0.3.1"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsc",