@mmnto/mcp 1.115.0 → 1.117.0

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.
@@ -1,3 +1,4 @@
1
+ import type { AgentSourceProvenance, AttributionConflict } from '@mmnto/totem';
1
2
  export interface SearchLogEntry {
2
3
  timestamp: string;
3
4
  query: string;
@@ -33,36 +34,65 @@ export interface SearchLogEntry {
33
34
  * identity to join against (ruled on mmnto-ai/totem#2362).
34
35
  */
35
36
  agent_source?: string | null;
37
+ /**
38
+ * Provenance of `agent_source` (mmnto-ai/totem#2629, ruled two-value enum):
39
+ * `'env'` iff the row was stamped from `TOTEM_SELF_AGENT`, `'absent'` iff no
40
+ * attribution was stamped (the honest stamped-absence default). Optional for
41
+ * pre-sensor rows; `logSearch` stamps it on every new row.
42
+ */
43
+ agent_source_provenance?: AgentSourceProvenance;
44
+ /**
45
+ * Fail-closed disclosure (#2629): present iff the ambient env seat and the
46
+ * session pointer's minting seat disagreed — `agent_source` is withheld and
47
+ * both candidates are named. The query itself is never refused (Tenet 13).
48
+ */
49
+ attribution_conflict?: AttributionConflict;
50
+ /** Named degradation (#2629): the conflict probe failed; the env stamp stands. */
51
+ attribution_probe_error?: string;
36
52
  /** A.3.a: explicit session id passed through from `TOTEM_SESSION_ID` if present, else null (never guessed). Reserved forward primitive for the ADR-078 commit-side session join; deliberately inert in the current repo-wide windowing. */
37
53
  session_id?: string | null;
38
54
  /** A.3.a: trace-correlation id passed through from `TOTEM_CORRELATION_ID` if present, else null (never guessed). Reserved for the A.3.c end-to-end correlation pass; carried now so the trio lands in one producer touch. */
39
55
  correlation_id?: string | null;
40
56
  }
41
57
  /**
42
- * The A.3.a attribution trio stamped onto every `SearchLogEntry` at log time.
43
- * Every field is `string | null` — a present value or an explicit `null`
44
- * (Tenet 4: absence is stamped, never guessed).
58
+ * The attribution stamp applied to every `SearchLogEntry` at log time: the
59
+ * A.3.a trio (`string | null` — a present value or an explicit `null`, Tenet 4)
60
+ * plus the #2629 provenance/fail-closed fields. Every key is REQUIRED on this
61
+ * interface — `attribution_conflict` / `attribution_probe_error` carry explicit
62
+ * `undefined` when clean — so the spread-last stamp in `logSearch` displaces
63
+ * any caller-supplied value for every stamped field (absence from the sense is
64
+ * as authoritative as presence; `JSON.stringify` drops the undefined keys from
65
+ * the persisted row).
45
66
  */
46
67
  export interface SearchLogAttribution {
47
68
  agent_source: string | null;
69
+ agent_source_provenance: AgentSourceProvenance;
70
+ attribution_conflict: AttributionConflict | undefined;
71
+ attribution_probe_error: string | undefined;
48
72
  session_id: string | null;
49
73
  correlation_id: string | null;
50
74
  }
51
75
  /**
52
- * Derive the A.3.a attribution trio from the environment (default
53
- * `process.env`). Pure — no I/O, no side effects — so the producer stamp is
54
- * testable without touching the filesystem.
76
+ * Derive the attribution stamp for one row.
55
77
  *
56
- * - `agent_source`: from `TOTEM_SELF_AGENT`, reusing the same read + comma
57
- * parsing precedent as `resolveSelfAgents` (orchestration-resolver.ts). The
58
- * MCP server is spawned under a single seat, so the first non-empty
59
- * comma-separated entry is that seat; a bare value passes through unchanged.
78
+ * - `agent_source` + the #2629 provenance/fail-closed fields: delegated to
79
+ * core's `senseAgentAttribution` the one derivation both stamp seams
80
+ * (this one and the selection-manifest builder) consume. Same env read +
81
+ * comma parse as `resolveSelfAgents` (the MCP server runs under a single
82
+ * seat, so the first non-empty entry is that seat), cross-checked against
83
+ * the session pointer's minting seat when `totemDir` is provided.
60
84
  * - `session_id` / `correlation_id`: straight pass-through from
61
85
  * `TOTEM_SESSION_ID` / `TOTEM_CORRELATION_ID`.
62
86
  *
63
- * Any field whose env var is absent or blank is stamped `null`.
87
+ * Any field whose env var is absent or blank is stamped `null`. Env-only calls
88
+ * (no `totemDir`) stay pure — no I/O — the testable-producer property the
89
+ * original trio derivation had; with `totemDir` the conflict probe reads the
90
+ * pointer + `events.ndjson`, per call, never cached (ruled — a cache converts
91
+ * a transient contamination into a whole-session one). The probe can never
92
+ * throw into the stamp path: failures degrade to the env-only stamp with the
93
+ * failure named on `attribution_probe_error`.
64
94
  */
65
- export declare function deriveSearchLogAttribution(env?: NodeJS.ProcessEnv): SearchLogAttribution;
95
+ export declare function deriveSearchLogAttribution(env?: NodeJS.ProcessEnv, totemDir?: string): SearchLogAttribution;
66
96
  export interface SearchStats {
67
97
  totalCalls: number;
68
98
  avgDuration: number;
@@ -73,13 +103,19 @@ export interface SearchStats {
73
103
  * Must be called before the first `logSearch` to enable file logging.
74
104
  */
75
105
  export declare function setLogDir(totemDir: string): void;
106
+ /**
107
+ * Test seam — clears the configured log path so attribution runs env-only
108
+ * (no ledger in reach) and file logging is disarmed. Production never calls
109
+ * this; the naming follows `_clearBashResolverCacheForTesting` (core).
110
+ */
111
+ export declare function _clearLogDirForTesting(): void;
76
112
  /**
77
113
  * Record a search call.
78
114
  *
79
- * - Stamps the A.3.a attribution trio (`agent_source` / `session_id` /
80
- * `correlation_id`) from the environment at log time — one producer touch
81
- * shared by every call site. A caller-supplied value (none today) wins over
82
- * the env derivation.
115
+ * - Stamps the attribution fields (the A.3.a trio + the #2629 provenance /
116
+ * fail-closed fields) at log time — one producer touch shared by every call
117
+ * site. The derived stamp is authoritative: a caller-supplied value for any
118
+ * stamped field is displaced (see the stamp comment below).
83
119
  * - Always appends to the in-memory array.
84
120
  * - Best-effort appends a single JSON line to `{totemDir}/.search-log.jsonl`.
85
121
  * File writes are fire-and-forget — failures are silently swallowed because
@@ -1 +1 @@
1
- {"version":3,"file":"search-log.d.ts","sourceRoot":"","sources":["../src/search-log.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;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G,IAAI,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CA+B/D;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAc5C"}
@@ -1,5 +1,6 @@
1
1
  import * as fs from 'node:fs';
2
2
  import * as path from 'node:path';
3
+ import { senseAgentAttribution } from '@mmnto/totem';
3
4
  /**
4
5
  * Read one env var, trim it, and normalize empty/whitespace-only to `null`.
5
6
  * `null` is the explicit "not present" stamp (Tenet 4) — never a guessed value.
@@ -12,30 +13,32 @@ function envOrNull(env, key) {
12
13
  return trimmed.length > 0 ? trimmed : null;
13
14
  }
14
15
  /**
15
- * Derive the A.3.a attribution trio from the environment (default
16
- * `process.env`). Pure — no I/O, no side effects — so the producer stamp is
17
- * testable without touching the filesystem.
16
+ * Derive the attribution stamp for one row.
18
17
  *
19
- * - `agent_source`: from `TOTEM_SELF_AGENT`, reusing the same read + comma
20
- * parsing precedent as `resolveSelfAgents` (orchestration-resolver.ts). The
21
- * MCP server is spawned under a single seat, so the first non-empty
22
- * comma-separated entry is that seat; a bare value passes through unchanged.
18
+ * - `agent_source` + the #2629 provenance/fail-closed fields: delegated to
19
+ * core's `senseAgentAttribution` the one derivation both stamp seams
20
+ * (this one and the selection-manifest builder) consume. Same env read +
21
+ * comma parse as `resolveSelfAgents` (the MCP server runs under a single
22
+ * seat, so the first non-empty entry is that seat), cross-checked against
23
+ * the session pointer's minting seat when `totemDir` is provided.
23
24
  * - `session_id` / `correlation_id`: straight pass-through from
24
25
  * `TOTEM_SESSION_ID` / `TOTEM_CORRELATION_ID`.
25
26
  *
26
- * Any field whose env var is absent or blank is stamped `null`.
27
+ * Any field whose env var is absent or blank is stamped `null`. Env-only calls
28
+ * (no `totemDir`) stay pure — no I/O — the testable-producer property the
29
+ * original trio derivation had; with `totemDir` the conflict probe reads the
30
+ * pointer + `events.ndjson`, per call, never cached (ruled — a cache converts
31
+ * a transient contamination into a whole-session one). The probe can never
32
+ * throw into the stamp path: failures degrade to the env-only stamp with the
33
+ * failure named on `attribution_probe_error`.
27
34
  */
28
- export function deriveSearchLogAttribution(env = process.env) {
29
- const selfAgentRaw = envOrNull(env, 'TOTEM_SELF_AGENT');
30
- const agent_source = selfAgentRaw !== null
31
- ? // Same comma-split as resolveSelfAgents; take the first non-empty seat.
32
- (selfAgentRaw
33
- .split(',')
34
- .map((s) => s.trim())
35
- .find((s) => s.length > 0) ?? null)
36
- : null;
35
+ export function deriveSearchLogAttribution(env = process.env, totemDir) {
36
+ const sense = senseAgentAttribution({ env, totemDir });
37
37
  return {
38
- agent_source,
38
+ agent_source: sense.agent_source,
39
+ agent_source_provenance: sense.agent_source_provenance,
40
+ attribution_conflict: sense.attribution_conflict,
41
+ attribution_probe_error: sense.attribution_probe_error,
39
42
  session_id: envOrNull(env, 'TOTEM_SESSION_ID'),
40
43
  correlation_id: envOrNull(env, 'TOTEM_CORRELATION_ID'),
41
44
  };
@@ -51,13 +54,21 @@ let logFilePath;
51
54
  export function setLogDir(totemDir) {
52
55
  logFilePath = path.join(totemDir, '.search-log.jsonl');
53
56
  }
57
+ /**
58
+ * Test seam — clears the configured log path so attribution runs env-only
59
+ * (no ledger in reach) and file logging is disarmed. Production never calls
60
+ * this; the naming follows `_clearBashResolverCacheForTesting` (core).
61
+ */
62
+ export function _clearLogDirForTesting() {
63
+ logFilePath = undefined;
64
+ }
54
65
  /**
55
66
  * Record a search call.
56
67
  *
57
- * - Stamps the A.3.a attribution trio (`agent_source` / `session_id` /
58
- * `correlation_id`) from the environment at log time — one producer touch
59
- * shared by every call site. A caller-supplied value (none today) wins over
60
- * the env derivation.
68
+ * - Stamps the attribution fields (the A.3.a trio + the #2629 provenance /
69
+ * fail-closed fields) at log time — one producer touch shared by every call
70
+ * site. The derived stamp is authoritative: a caller-supplied value for any
71
+ * stamped field is displaced (see the stamp comment below).
61
72
  * - Always appends to the in-memory array.
62
73
  * - Best-effort appends a single JSON line to `{totemDir}/.search-log.jsonl`.
63
74
  * File writes are fire-and-forget — failures are silently swallowed because
@@ -67,10 +78,19 @@ export function setLogDir(totemDir) {
67
78
  * without touching the filesystem.
68
79
  */
69
80
  export function logSearch(entry) {
70
- // Env stamp LAST: the attribution trio is governance telemetry, so the
71
- // environment-derived values are authoritative — a caller-supplied (or
72
- // spread-truthy `undefined`) trio field must never displace the stamp.
73
- const stamped = { ...entry, ...deriveSearchLogAttribution() };
81
+ // Env stamp LAST: the attribution fields are governance telemetry, so the
82
+ // derived values are authoritative — a caller-supplied (or spread-truthy
83
+ // `undefined`) stamped field must never displace the stamp. The attribution
84
+ // object carries every stamped key explicitly (undefined when clean), so a
85
+ // caller-supplied conflict cannot survive a clean sense either.
86
+ // `totemDir` recovers from the log path per call — when `setLogDir` was
87
+ // never called there is no ledger in reach and the sense runs env-only
88
+ // (provenance still stamped, no conflict probe).
89
+ const totemDir = logFilePath !== undefined ? path.dirname(logFilePath) : undefined;
90
+ const stamped = {
91
+ ...entry,
92
+ ...deriveSearchLogAttribution(process.env, totemDir),
93
+ };
74
94
  entries.push(stamped);
75
95
  // Best-effort, non-blocking file append
76
96
  if (logFilePath) {
@@ -1 +1 @@
1
- {"version":3,"file":"search-log.js","sourceRoot":"","sources":["../src/search-log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAsDlC;;;GAGG;AACH,SAAS,SAAS,CAAC,GAAsB,EAAE,GAAW;IACpD,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CA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OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC;IAEnF,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;IAC1D,MAAM,WAAW,GACf,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,QAAS,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1F,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AAClD,CAAC"}
@@ -1,8 +1,31 @@
1
+ import * as fs from 'node:fs';
2
+ import * as os from 'node:os';
3
+ import * as path from 'node:path';
1
4
  import { afterEach, beforeEach, describe, expect, it } from 'vitest';
2
- import { deriveSearchLogAttribution, logSearch } from './search-log.js';
3
- // ─── deriveSearchLogAttribution (pure — env in, trio out) ───
5
+ import { _clearLogDirForTesting, deriveSearchLogAttribution, getSearchStats, logSearch, setLogDir, } from './search-log.js';
6
+ const SESSION_A = '550e8400-e29b-41d4-a716-446655440000';
7
+ /** Windows-safe teardown options — retries ride out transient ENOTEMPTY. */
8
+ const RM_OPTS = { recursive: true, force: true, maxRetries: 3, retryDelay: 100 };
9
+ /** Pointer at SESSION_A minted by `mintSeat` — the #2629 contamination fixture. */
10
+ function contaminatedTotemDir(mintSeat) {
11
+ const totemDir = fs.mkdtempSync(path.join(os.tmpdir(), 'search-log-attr-'));
12
+ const ledgerDir = path.join(totemDir, 'ledger');
13
+ fs.mkdirSync(ledgerDir, { recursive: true });
14
+ fs.writeFileSync(path.join(ledgerDir, '.session-id'), SESSION_A, 'utf-8');
15
+ fs.writeFileSync(path.join(ledgerDir, 'events.ndjson'), JSON.stringify({
16
+ timestamp: '2026-08-12T03:03:00.000Z',
17
+ type: 'session_start',
18
+ activity_name: 'SessionStart',
19
+ source: 'bot',
20
+ justification: '',
21
+ session_id: SESSION_A,
22
+ agent_source: mintSeat,
23
+ }) + '\n', 'utf-8');
24
+ return totemDir;
25
+ }
26
+ // ─── deriveSearchLogAttribution (env-only calls stay pure) ───
4
27
  describe('deriveSearchLogAttribution', () => {
5
- it('stamps all three fields from the environment when present', () => {
28
+ it('stamps all fields from the environment when present, with env provenance', () => {
6
29
  const attribution = deriveSearchLogAttribution({
7
30
  TOTEM_SELF_AGENT: 'totem-claude',
8
31
  TOTEM_SESSION_ID: 'sess-123',
@@ -10,13 +33,15 @@ describe('deriveSearchLogAttribution', () => {
10
33
  });
11
34
  expect(attribution).toEqual({
12
35
  agent_source: 'totem-claude',
36
+ agent_source_provenance: 'env',
13
37
  session_id: 'sess-123',
14
38
  correlation_id: 'corr-abc',
15
39
  });
16
40
  });
17
- it('stamps null for every field when the env is absent (Tenet 4 — never guess)', () => {
41
+ it('stamps null + absent provenance when the env is absent (Tenet 4 — never guess)', () => {
18
42
  expect(deriveSearchLogAttribution({})).toEqual({
19
43
  agent_source: null,
44
+ agent_source_provenance: 'absent',
20
45
  session_id: null,
21
46
  correlation_id: null,
22
47
  });
@@ -24,6 +49,7 @@ describe('deriveSearchLogAttribution', () => {
24
49
  it('stamps null per-field independently (partial env)', () => {
25
50
  const attribution = deriveSearchLogAttribution({ TOTEM_SESSION_ID: 'only-session' });
26
51
  expect(attribution.agent_source).toBeNull();
52
+ expect(attribution.agent_source_provenance).toBe('absent');
27
53
  expect(attribution.session_id).toBe('only-session');
28
54
  expect(attribution.correlation_id).toBeNull();
29
55
  });
@@ -35,6 +61,7 @@ describe('deriveSearchLogAttribution', () => {
35
61
  });
36
62
  expect(attribution).toEqual({
37
63
  agent_source: null,
64
+ agent_source_provenance: 'absent',
38
65
  session_id: null,
39
66
  correlation_id: null,
40
67
  });
@@ -45,6 +72,31 @@ describe('deriveSearchLogAttribution', () => {
45
72
  expect(deriveSearchLogAttribution({ TOTEM_SELF_AGENT: ' , totem-gemini , extra' }).agent_source).toBe('totem-gemini');
46
73
  });
47
74
  });
75
+ // ─── #2629 fail-closed conflict (totemDir-armed calls) ───
76
+ describe('deriveSearchLogAttribution conflict sense (#2629)', () => {
77
+ let totemDir;
78
+ afterEach(() => {
79
+ fs.rmSync(totemDir, RM_OPTS);
80
+ });
81
+ it('FAIL-CLOSED: env seat ≠ pointer minting seat → stamp neither, name both', () => {
82
+ totemDir = contaminatedTotemDir('totem-claude');
83
+ const attribution = deriveSearchLogAttribution({ TOTEM_SELF_AGENT: 'totem-gemini' }, totemDir);
84
+ expect(attribution.agent_source).toBeNull();
85
+ expect(attribution.agent_source_provenance).toBe('absent');
86
+ expect(attribution.attribution_conflict).toEqual({
87
+ env_seat: 'totem-gemini',
88
+ minting_seat: 'totem-claude',
89
+ pointer_session_id: SESSION_A,
90
+ });
91
+ });
92
+ it('agreement keeps the env stamp — no conflict fabricated', () => {
93
+ totemDir = contaminatedTotemDir('totem-claude');
94
+ const attribution = deriveSearchLogAttribution({ TOTEM_SELF_AGENT: 'totem-claude' }, totemDir);
95
+ expect(attribution.agent_source).toBe('totem-claude');
96
+ expect(attribution.agent_source_provenance).toBe('env');
97
+ expect(attribution.attribution_conflict).toBeUndefined();
98
+ });
99
+ });
48
100
  // ─── logSearch stamping (no setLogDir → in-memory only, no fs) ───
49
101
  describe('logSearch attribution stamp', () => {
50
102
  const ENV_KEYS = ['TOTEM_SELF_AGENT', 'TOTEM_SESSION_ID', 'TOTEM_CORRELATION_ID'];
@@ -69,21 +121,92 @@ describe('logSearch attribution stamp', () => {
69
121
  else
70
122
  process.env[k] = saved[k];
71
123
  }
124
+ // Reset the module-level log path so no test depends on file order and a
125
+ // torn-down tmpdir is never probed by a later logSearch (CR on #2634).
126
+ _clearLogDirForTesting();
72
127
  });
73
- it('stamps the trio from process.env onto the returned entry', () => {
128
+ it('stamps the trio + env provenance from process.env onto the returned entry', () => {
74
129
  process.env.TOTEM_SELF_AGENT = 'totem-claude';
75
130
  process.env.TOTEM_SESSION_ID = 'sess-9';
76
131
  process.env.TOTEM_CORRELATION_ID = 'corr-9';
77
132
  const stamped = logSearch({ ...baseEntry });
78
133
  expect(stamped.agent_source).toBe('totem-claude');
134
+ expect(stamped.agent_source_provenance).toBe('env');
79
135
  expect(stamped.session_id).toBe('sess-9');
80
136
  expect(stamped.correlation_id).toBe('corr-9');
81
137
  });
82
- it('stamps explicit null on every field when the env is absent', () => {
138
+ it('stamps explicit null + absent provenance on every field when the env is absent', () => {
83
139
  const stamped = logSearch({ ...baseEntry });
84
140
  expect(stamped.agent_source).toBeNull();
141
+ expect(stamped.agent_source_provenance).toBe('absent');
85
142
  expect(stamped.session_id).toBeNull();
86
143
  expect(stamped.correlation_id).toBeNull();
87
144
  });
145
+ it('a caller-supplied conflict/provenance never displaces the stamp — absence from the sense is authoritative too', () => {
146
+ process.env.TOTEM_SELF_AGENT = 'totem-claude';
147
+ const stamped = logSearch({
148
+ ...baseEntry,
149
+ agent_source: 'forged-seat',
150
+ agent_source_provenance: 'absent',
151
+ attribution_conflict: {
152
+ env_seat: 'forged-a',
153
+ minting_seat: 'forged-b',
154
+ pointer_session_id: SESSION_A,
155
+ },
156
+ attribution_probe_error: 'forged failure',
157
+ });
158
+ expect(stamped.agent_source).toBe('totem-claude');
159
+ expect(stamped.agent_source_provenance).toBe('env');
160
+ // Clean sense → explicit undefined displaces the forged values, and
161
+ // JSON.stringify (the persistence shape) drops the keys entirely.
162
+ expect(stamped.attribution_conflict).toBeUndefined();
163
+ expect(stamped.attribution_probe_error).toBeUndefined();
164
+ expect(JSON.parse(JSON.stringify(stamped))).not.toHaveProperty('attribution_conflict');
165
+ });
166
+ it('SEAM-LEVEL invariant 10: with EVERY probe failing (pointer AND events paths are directories), logSearch still records, stamps env, and names the errno', () => {
167
+ const totemDir = fs.mkdtempSync(path.join(os.tmpdir(), 'search-log-probe-'));
168
+ try {
169
+ const ledgerDir = path.join(totemDir, 'ledger');
170
+ // DIRECTORIES where both probe files should be — EISDIR on read for the
171
+ // pointer and the events file alike: every probe fails, the non-benign
172
+ // class (not the honest-absence ENOENT set).
173
+ fs.mkdirSync(path.join(ledgerDir, 'events.ndjson'), { recursive: true });
174
+ fs.mkdirSync(path.join(ledgerDir, '.session-id'), { recursive: true });
175
+ process.env.TOTEM_SELF_AGENT = 'totem-claude';
176
+ setLogDir(totemDir);
177
+ const callsBefore = getSearchStats().totalCalls;
178
+ const stamped = logSearch({ ...baseEntry });
179
+ // "still records": the in-memory log grew (the file append is
180
+ // fire-and-forget by contract and not asserted here).
181
+ expect(getSearchStats().totalCalls).toBe(callsBefore + 1);
182
+ expect(stamped.agent_source).toBe('totem-claude');
183
+ expect(stamped.agent_source_provenance).toBe('env');
184
+ expect(stamped.attribution_conflict).toBeUndefined();
185
+ // "names the failure": the errno itself — the half a post-hoc reader
186
+ // filters on — must survive the cause unroll, not just the wrapper text.
187
+ expect(stamped.attribution_probe_error).toMatch(/EISDIR|EPERM|EACCES/);
188
+ }
189
+ finally {
190
+ fs.rmSync(totemDir, RM_OPTS);
191
+ }
192
+ });
193
+ it('with setLogDir armed, a contaminated ledger produces a conflict row and the call still succeeds', () => {
194
+ const totemDir = contaminatedTotemDir('totem-claude');
195
+ try {
196
+ process.env.TOTEM_SELF_AGENT = 'totem-gemini';
197
+ setLogDir(totemDir);
198
+ const stamped = logSearch({ ...baseEntry });
199
+ expect(stamped.agent_source).toBeNull();
200
+ expect(stamped.agent_source_provenance).toBe('absent');
201
+ expect(stamped.attribution_conflict).toEqual({
202
+ env_seat: 'totem-gemini',
203
+ minting_seat: 'totem-claude',
204
+ pointer_session_id: SESSION_A,
205
+ });
206
+ }
207
+ finally {
208
+ fs.rmSync(totemDir, RM_OPTS);
209
+ }
210
+ });
88
211
  });
89
212
  //# sourceMappingURL=search-log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AAM,QAAQ,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;QACtD,IAAI,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAG,cAAc,CAAC;YAC9C,SAAS,CAAC,QAAQ,CAAC,CAAC;YACpB,MAAM,OAAO,GAAG,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;YACxC,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvD,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;gBAC3C,QAAQ,EAAE,cAAc;gBACxB,YAAY,EAAE,cAAc;gBAC5B,kBAAkB,EAAE,SAAS;aAC9B,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmnto/mcp",
3
- "version": "1.115.0",
3
+ "version": "1.117.0",
4
4
  "description": "MCP server for Totem, the local-first toolkit that keeps AI-agent work queryable, enforceable, and derivable as plain files in your codebase",
5
5
  "type": "module",
6
6
  "engines": {
@@ -22,7 +22,7 @@
22
22
  "dotenv": "^16.4.0",
23
23
  "jiti": "^2.4.0",
24
24
  "zod": "^3.24.0",
25
- "@mmnto/totem": "1.115.0"
25
+ "@mmnto/totem": "1.117.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.0.0",