wyrm-mcp 7.3.2 → 7.3.3

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 (184) hide show
  1. package/README.md +8 -14
  2. package/dist/activation.js +59 -1
  3. package/dist/agent-daemon.js +281 -4
  4. package/dist/agent-loop.js +332 -7
  5. package/dist/analytics.js +236 -13
  6. package/dist/attribution.js +49 -1
  7. package/dist/audit.js +457 -2
  8. package/dist/auto-capture.js +138 -3
  9. package/dist/auto-orchestrator.js +325 -1
  10. package/dist/autoconfig.d.ts +50 -0
  11. package/dist/autoconfig.d.ts.map +1 -1
  12. package/dist/autoconfig.js +1115 -39
  13. package/dist/autoconfig.js.map +1 -1
  14. package/dist/buddy-runner.js +109 -1
  15. package/dist/buddy.js +564 -14
  16. package/dist/build-flags.js +15 -1
  17. package/dist/capabilities.js +183 -3
  18. package/dist/capture.js +56 -1
  19. package/dist/causality.js +148 -8
  20. package/dist/cli.js +281 -20
  21. package/dist/cloud/cli.js +541 -5
  22. package/dist/cloud/client.js +221 -1
  23. package/dist/cloud/crypto.js +85 -1
  24. package/dist/cloud/machine-id.js +113 -2
  25. package/dist/cloud/recovery.js +60 -1
  26. package/dist/cloud/sync-engine.js +543 -7
  27. package/dist/cloud-backup.js +579 -5
  28. package/dist/cloud-profile.js +138 -1
  29. package/dist/cloud-sync-entrypoint.js +47 -1
  30. package/dist/cloud-sync.js +309 -2
  31. package/dist/connectors/bridge-source.d.ts +46 -0
  32. package/dist/connectors/bridge-source.d.ts.map +1 -0
  33. package/dist/connectors/bridge-source.js +77 -0
  34. package/dist/connectors/bridge-source.js.map +1 -0
  35. package/dist/connectors/index.d.ts +24 -0
  36. package/dist/connectors/index.d.ts.map +1 -0
  37. package/dist/connectors/index.js +69 -0
  38. package/dist/connectors/index.js.map +1 -0
  39. package/dist/connectors/ingest.d.ts +16 -0
  40. package/dist/connectors/ingest.d.ts.map +1 -0
  41. package/dist/connectors/ingest.js +116 -0
  42. package/dist/connectors/ingest.js.map +1 -0
  43. package/dist/connectors/types.d.ts +99 -0
  44. package/dist/connectors/types.d.ts.map +1 -0
  45. package/dist/connectors/types.js +17 -0
  46. package/dist/connectors/types.js.map +1 -0
  47. package/dist/constellation.js +168 -12
  48. package/dist/content-signature.js +45 -1
  49. package/dist/context-build-budgeted.js +144 -4
  50. package/dist/context-ranking.js +69 -1
  51. package/dist/crypto.js +179 -1
  52. package/dist/daemon-write-endpoint.js +290 -1
  53. package/dist/daemon-writer.js +406 -2
  54. package/dist/database.js +1278 -53
  55. package/dist/deprecations.js +162 -2
  56. package/dist/design.js +141 -13
  57. package/dist/event-replication.js +112 -1
  58. package/dist/events-sse.js +43 -7
  59. package/dist/events.js +238 -6
  60. package/dist/failure-patterns.d.ts +107 -0
  61. package/dist/failure-patterns.d.ts.map +1 -1
  62. package/dist/failure-patterns.js +924 -43
  63. package/dist/failure-patterns.js.map +1 -1
  64. package/dist/federation.js +236 -12
  65. package/dist/goals.js +101 -13
  66. package/dist/golden.js +355 -3
  67. package/dist/handlers/agent.js +165 -4
  68. package/dist/handlers/alias-adapters.js +129 -1
  69. package/dist/handlers/aliases.js +171 -1
  70. package/dist/handlers/audit.js +87 -1
  71. package/dist/handlers/boundary.js +221 -1
  72. package/dist/handlers/capture.js +1114 -73
  73. package/dist/handlers/causality.js +119 -9
  74. package/dist/handlers/cloud.js +382 -85
  75. package/dist/handlers/companion.js +459 -28
  76. package/dist/handlers/datalake.js +187 -7
  77. package/dist/handlers/dispatch-context.js +22 -0
  78. package/dist/handlers/entity.js +256 -25
  79. package/dist/handlers/events.js +335 -16
  80. package/dist/handlers/failure.d.ts.map +1 -1
  81. package/dist/handlers/failure.js +408 -13
  82. package/dist/handlers/failure.js.map +1 -1
  83. package/dist/handlers/goals.js +296 -4
  84. package/dist/handlers/intelligence.js +681 -126
  85. package/dist/handlers/invoicing.js +70 -1
  86. package/dist/handlers/mcpclient.js +137 -6
  87. package/dist/handlers/orchestration.js +125 -40
  88. package/dist/handlers/output-schemas.js +24 -1
  89. package/dist/handlers/presence.js +99 -3
  90. package/dist/handlers/project.js +182 -28
  91. package/dist/handlers/prompts.js +157 -6
  92. package/dist/handlers/quest.js +224 -4
  93. package/dist/handlers/recall.js +237 -13
  94. package/dist/handlers/registry.js +167 -1
  95. package/dist/handlers/resources.js +288 -1
  96. package/dist/handlers/review.js +74 -11
  97. package/dist/handlers/run.js +498 -16
  98. package/dist/handlers/search.js +338 -15
  99. package/dist/handlers/session.js +643 -31
  100. package/dist/handlers/share.js +184 -8
  101. package/dist/handlers/shims.js +464 -1
  102. package/dist/handlers/skill.js +449 -67
  103. package/dist/handlers/survivors.js +120 -1
  104. package/dist/handlers/symbols.js +109 -8
  105. package/dist/handlers/syncops.js +302 -4
  106. package/dist/handlers/types.js +27 -1
  107. package/dist/harvest.js +191 -5
  108. package/dist/hours.js +156 -7
  109. package/dist/http-auth.js +321 -3
  110. package/dist/http-fast.js +1302 -22
  111. package/dist/icons.js +47 -1
  112. package/dist/importers.js +268 -1
  113. package/dist/index.js +840 -2
  114. package/dist/indexer.js +145 -4
  115. package/dist/intelligence.js +261 -31
  116. package/dist/internal-dispatch.js +212 -3
  117. package/dist/keyset.js +110 -1
  118. package/dist/knowledge-graph.js +176 -12
  119. package/dist/license.js +441 -2
  120. package/dist/logger.js +199 -2
  121. package/dist/maintenance.js +148 -2
  122. package/dist/mcp-client.js +262 -6
  123. package/dist/memory-artifacts.js +596 -32
  124. package/dist/migrate-prompt.js +124 -2
  125. package/dist/migrations.d.ts.map +1 -1
  126. package/dist/migrations.js +799 -42
  127. package/dist/migrations.js.map +1 -1
  128. package/dist/performance.js +228 -1
  129. package/dist/presence.js +140 -11
  130. package/dist/priority-embed.js +164 -5
  131. package/dist/providers/embedding-provider.js +196 -1
  132. package/dist/readonly-gate.js +29 -1
  133. package/dist/receipt.js +43 -1
  134. package/dist/rehydration.js +157 -9
  135. package/dist/reindex.js +88 -1
  136. package/dist/render-target.js +544 -21
  137. package/dist/render.js +280 -4
  138. package/dist/repl-guard.js +173 -1
  139. package/dist/replication-daemon-entrypoint.js +31 -1
  140. package/dist/replication-daemon.js +262 -2
  141. package/dist/rerank.js +142 -1
  142. package/dist/resilience.js +591 -1
  143. package/dist/reverse-bridge.js +360 -5
  144. package/dist/security.js +244 -1
  145. package/dist/session-seen.js +51 -3
  146. package/dist/setup.js +260 -1
  147. package/dist/skill-author.js +168 -5
  148. package/dist/spec-kit.js +191 -1
  149. package/dist/sqlite-busy.js +154 -1
  150. package/dist/statusline.js +315 -11
  151. package/dist/sub-agent.js +262 -13
  152. package/dist/summarizer.js +139 -13
  153. package/dist/symbols.js +283 -7
  154. package/dist/sync.js +359 -5
  155. package/dist/tasks-dispatch.js +84 -1
  156. package/dist/tasks.js +282 -1
  157. package/dist/token-budget.js +143 -1
  158. package/dist/tool-analytics.js +129 -7
  159. package/dist/tool-annotations.js +365 -1
  160. package/dist/tool-manifest-v2.json +1 -1
  161. package/dist/tool-manifest.json +1 -1
  162. package/dist/tool-profiles.js +75 -1
  163. package/dist/trace-harvest.js +244 -6
  164. package/dist/types.js +30 -1
  165. package/dist/ui-dashboard.js +50 -41
  166. package/dist/ulid.js +81 -1
  167. package/dist/usage-tracker.js +66 -1
  168. package/dist/validate.js +129 -1
  169. package/dist/vault.js +534 -1
  170. package/dist/vector-init.js +67 -1
  171. package/dist/vectors.js +184 -3
  172. package/dist/version-check.js +136 -4
  173. package/dist/visibility.js +155 -19
  174. package/dist/wyrm-cli.js +2845 -101
  175. package/dist/wyrm-cli.js.map +1 -1
  176. package/dist/wyrm-guard.d.ts.map +1 -1
  177. package/dist/wyrm-guard.js +475 -14
  178. package/dist/wyrm-guard.js.map +1 -1
  179. package/dist/wyrm-loop.js +150 -3
  180. package/dist/wyrm-manifest.json +1 -1
  181. package/dist/wyrm-statusline-daemon.js +11 -1
  182. package/dist/wyrm-statusline.js +56 -4
  183. package/dist/wyrm-ui.js +77 -9
  184. package/package.json +1 -1
package/dist/events.js CHANGED
@@ -1,18 +1,250 @@
1
- import{randomUUID as g}from"node:crypto";import{hostname as m}from"node:os";import{logger as l}from"./logger.js";import{getActor as R}from"./handlers/boundary.js";const I=new Set(["capture","session_update","quest","truth","presence","tool_call","failure","decision"]),T=64*1024,y=80,d=256,_=864e5,p=r=>typeof r=="number"&&Number.isInteger(r)&&r>=0&&r<=Number.MAX_SAFE_INTEGER,s=(r,t)=>typeof r=="string"?r.slice(0,t):null;function O(){const r=(process.env.WYRM_LIVE_MEMORY||"").toLowerCase();return r!=="0"&&r!=="false"&&r!=="off"}const f=new WeakMap;function S(r){const t=f.get(r);if(t)return t;const e=()=>r.prepare("SELECT value FROM wyrm_meta WHERE key = 'device_id'").get()?.value;let n=e();if(!n){const o=`${m().slice(0,24)}-${g().slice(0,8)}`;r.prepare("INSERT OR IGNORE INTO wyrm_meta (key, value) VALUES ('device_id', ?)").run(o),n=e()||o}return f.set(r,n),n}function a(r,t,e,n){const o=typeof r=="number"&&Number.isFinite(r)?Math.floor(r):n;return Math.max(t,Math.min(e,o))}function C(r,t){if(O())try{const e=S(r),n=t.isShared?1:0;let o=null;if(n&&t.payload!==void 0)try{o=JSON.stringify(t.payload)}catch{o=null}const i=R(),c=t.agentId!==void 0?t.agentId:i.agent_id,u=t.runId!==void 0?t.runId:i.run_id;r.prepare(`
1
+ /**
2
+ * Live Memory v6.4 — append-only event log (Phase 1: local node).
3
+ *
4
+ * Every canonical write emits an event here as a FAILURE-ISOLATED side effect:
5
+ * the emit runs AFTER the canonical write and any failure — or the feature being
6
+ * disabled — logs-and-drops. It NEVER throws and NEVER rolls back the real write.
7
+ * "Strictly additive" means the existing write path cannot regress even if this
8
+ * table or its migration is broken.
9
+ *
10
+ * Feature flag `WYRM_LIVE_MEMORY` — DEFAULT ON (operator decision, v6.4).
11
+ * Disable with `WYRM_LIVE_MEMORY=0` (or `false` / `off`).
12
+ *
13
+ * Privacy: a denormalized payload is written ONLY for shareable rows; protected
14
+ * or private rows are reference-only (`payload_json = NULL`) so the event log
15
+ * never becomes a copy of data the encryption/federation layer protects.
16
+ *
17
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
18
+ * @license Proprietary — (c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
19
+ */
20
+ import { randomUUID } from 'node:crypto';
21
+ import { hostname } from 'node:os';
22
+ import { logger } from './logger.js';
23
+ import { getActor } from './handlers/boundary.js';
24
+ /** The closed set of valid event kinds — ingest rejects anything else (anti-spoof). */
25
+ const KNOWN_KINDS = new Set([
26
+ 'capture', 'session_update', 'quest', 'truth', 'presence', 'tool_call',
27
+ 'failure', 'decision',
28
+ ]);
29
+ // Ingest bounds for peer-supplied events (defends storage + ordering against a hostile peer).
30
+ const MAX_PAYLOAD_BYTES = 64 * 1024; // oversized payloads degrade to reference-only
31
+ const MAX_DEVICE_LEN = 80;
32
+ const MAX_FIELD_LEN = 256;
33
+ const DAY_MS = 86_400_000;
34
+ const isSafeNonNegInt = (n) => typeof n === 'number' && Number.isInteger(n) && n >= 0 && n <= Number.MAX_SAFE_INTEGER;
35
+ const clampStr = (s, max) => typeof s === 'string' ? s.slice(0, max) : null;
36
+ /** Default ON in v6.4 (operator decision). Disable with WYRM_LIVE_MEMORY=0|false|off. */
37
+ export function isLiveMemoryEnabled() {
38
+ const v = (process.env.WYRM_LIVE_MEMORY || '').toLowerCase();
39
+ return v !== '0' && v !== 'false' && v !== 'off';
40
+ }
41
+ // Per-DB cache (not a single module global): a process that opens more than one
42
+ // WyrmDB — e.g. cross-device replication tests, or a future multi-DB host — must
43
+ // get a DISTINCT device id per DB, or echo-suppression collapses.
44
+ const deviceIdCache = new WeakMap();
45
+ /** Stable per-node device id, persisted in wyrm_meta. Lazy + cached per DB. */
46
+ export function getDeviceId(db) {
47
+ const hit = deviceIdCache.get(db);
48
+ if (hit)
49
+ return hit;
50
+ const read = () => db.prepare(`SELECT value FROM wyrm_meta WHERE key = 'device_id'`).get()?.value;
51
+ let id = read();
52
+ if (!id) {
53
+ const candidate = `${hostname().slice(0, 24)}-${randomUUID().slice(0, 8)}`;
54
+ db.prepare(`INSERT OR IGNORE INTO wyrm_meta (key, value) VALUES ('device_id', ?)`).run(candidate);
55
+ id = read() || candidate; // re-read in case another process won the race
56
+ }
57
+ deviceIdCache.set(db, id);
58
+ return id;
59
+ }
60
+ function clamp(n, lo, hi, dflt) {
61
+ const v = typeof n === 'number' && Number.isFinite(n) ? Math.floor(n) : dflt;
62
+ return Math.max(lo, Math.min(hi, v));
63
+ }
64
+ /**
65
+ * Emit an event for a canonical write. NEVER throws; no-op when disabled.
66
+ * Call AFTER the canonical row is committed.
67
+ */
68
+ export function emitEvent(db, ev) {
69
+ if (!isLiveMemoryEnabled())
70
+ return;
71
+ try {
72
+ const device = getDeviceId(db);
73
+ const isShared = ev.isShared ? 1 : 0;
74
+ let payloadJson = null;
75
+ if (isShared && ev.payload !== undefined) {
76
+ // Isolate stringify: a non-serializable payload (circular / BigInt) degrades
77
+ // to reference-only — the event still emits rather than being dropped whole.
78
+ try {
79
+ payloadJson = JSON.stringify(ev.payload);
80
+ }
81
+ catch {
82
+ payloadJson = null;
83
+ }
84
+ }
85
+ // v7 F2 (T009): machine attribution from the ambient actor envelope unless
86
+ // the caller passed it explicitly. The 6.x `actor` display label keeps being
87
+ // written exactly as before — agent_id/run_id land ALONGSIDE it.
88
+ const ambient = getActor();
89
+ const agentId = ev.agentId !== undefined ? ev.agentId : ambient.agent_id;
90
+ const runId = ev.runId !== undefined ? ev.runId : ambient.run_id;
91
+ // Atomic origin_seq allocation: the MAX(origin_seq)+1 is computed INSIDE the
92
+ // INSERT so it runs under the write lock — no read-then-write race between the
93
+ // server, the CLI, and the trace hook all writing to one DB.
94
+ db.prepare(`
2
95
  INSERT INTO events
3
96
  (origin_device, origin_seq, project_id, kind, ref_table, ref_id, actor, is_shared, payload_json, created_at, agent_id, run_id)
4
97
  VALUES (?, (SELECT COALESCE(MAX(origin_seq), 0) + 1 FROM events WHERE origin_device = ?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
5
- `).run(e,e,String(t.projectId),t.kind,t.refTable??null,t.refId!=null?String(t.refId):null,t.actor??null,n,o,Date.now(),c,u)}catch(e){l.warn("live-memory: emitEvent dropped",{err:e instanceof Error?e.message:String(e)})}}function D(r,t,e=0,n=100){const o=a(n,1,1e3,100),i=a(e,0,Number.MAX_SAFE_INTEGER,0);return r.prepare("SELECT * FROM events WHERE project_id = ? AND cursor > ? ORDER BY cursor ASC LIMIT ?").all(String(t),i,o)}function F(r,t,e=20){const n=a(e,1,200,20),o=r.prepare("SELECT * FROM events WHERE project_id = ? ORDER BY cursor DESC LIMIT ?").all(String(t),n);return o.reverse(),{cursor:r.prepare("SELECT COALESCE(MAX(cursor), 0) AS c FROM events WHERE project_id = ?").get(String(t)).c,recent:o}}function j(r,t,e){try{if(!e||typeof e.origin_device!="string"||!p(e.origin_seq))return"duplicate";const n=s(e.origin_device,y);if(!n)return"duplicate";if(n===S(r))return"echo";if(typeof e.kind!="string"||!I.has(e.kind))return"duplicate";const o=e.is_shared?1:0;let i=o&&typeof e.payload_json=="string"?e.payload_json:null;i&&i.length>T&&(i=null);const c=Date.now(),u=p(e.created_at)&&e.created_at<=c+_?e.created_at:c,E=p(e.cloud_cursor)?e.cloud_cursor:null;return r.prepare(`
98
+ `).run(device, device, String(ev.projectId), ev.kind, ev.refTable ?? null, ev.refId != null ? String(ev.refId) : null, ev.actor ?? null, isShared, payloadJson, Date.now(), agentId, runId);
99
+ }
100
+ catch (err) {
101
+ // log-and-drop: the canonical write already succeeded; the event is best-effort.
102
+ logger.warn('live-memory: emitEvent dropped', { err: err instanceof Error ? err.message : String(err) });
103
+ }
104
+ }
105
+ /** One-shot pull of events newer than a cursor, for a project. Idempotent. */
106
+ export function eventsSince(db, projectId, sinceCursor = 0, limit = 100) {
107
+ const lim = clamp(limit, 1, 1000, 100);
108
+ const since = clamp(sinceCursor, 0, Number.MAX_SAFE_INTEGER, 0);
109
+ return db
110
+ .prepare(`SELECT * FROM events WHERE project_id = ? AND cursor > ? ORDER BY cursor ASC LIMIT ?`)
111
+ .all(String(projectId), since, lim);
112
+ }
113
+ /** Initial subscribe: current head cursor + a recent window (chronological). */
114
+ export function subscribeEvents(db, projectId, window = 20) {
115
+ const win = clamp(window, 1, 200, 20);
116
+ const recent = db
117
+ .prepare(`SELECT * FROM events WHERE project_id = ? ORDER BY cursor DESC LIMIT ?`)
118
+ .all(String(projectId), win);
119
+ recent.reverse();
120
+ const head = db
121
+ .prepare(`SELECT COALESCE(MAX(cursor), 0) AS c FROM events WHERE project_id = ?`)
122
+ .get(String(projectId));
123
+ return { cursor: head.c, recent };
124
+ }
125
+ /**
126
+ * Ingest one event received from a peer (replication PULL). Failure-isolated.
127
+ * - **Echo-suppression:** an event whose `origin_device` is THIS device is
128
+ * dropped (`'echo'`) — our own events bouncing back never re-insert.
129
+ * - **Idempotent dedup:** `INSERT OR IGNORE` on `UNIQUE(origin_device, origin_seq)`
130
+ * → re-delivering the same event is a no-op (`'duplicate'`).
131
+ * - `localProjectId` files the event under a LOCAL project (peer project ids are
132
+ * not assumed to match ours — the local node decides the mapping).
133
+ * The remote `(origin_device, origin_seq)` identity is preserved verbatim so the
134
+ * dedup key stays globally stable; only the local `cursor` is freshly minted.
135
+ */
136
+ export function ingestRemoteEvent(db, localProjectId, ev) {
137
+ try {
138
+ // ── Validate + bound every peer-supplied field (hostile peer hardening) ──
139
+ if (!ev || typeof ev.origin_device !== 'string' || !isSafeNonNegInt(ev.origin_seq)) {
140
+ return 'duplicate'; // malformed identity — drop, never throw
141
+ }
142
+ const device = clampStr(ev.origin_device, MAX_DEVICE_LEN);
143
+ if (!device)
144
+ return 'duplicate';
145
+ if (device === getDeviceId(db))
146
+ return 'echo'; // our own event bounced back
147
+ // Reject unknown kinds — stops a peer injecting arbitrary `event:` types downstream.
148
+ if (typeof ev.kind !== 'string' || !KNOWN_KINDS.has(ev.kind))
149
+ return 'duplicate';
150
+ const isShared = ev.is_shared ? 1 : 0;
151
+ // Privacy consistency: a non-shared row NEVER carries a payload (mirrors emit's invariant),
152
+ // so a peer can't smuggle a private-flagged blob. Oversized shared payloads degrade to
153
+ // reference-only rather than bloating the store unboundedly.
154
+ let payloadJson = isShared && typeof ev.payload_json === 'string' ? ev.payload_json : null;
155
+ if (payloadJson && payloadJson.length > MAX_PAYLOAD_BYTES)
156
+ payloadJson = null;
157
+ const now = Date.now();
158
+ const createdAt = isSafeNonNegInt(ev.created_at) && ev.created_at <= now + DAY_MS ? ev.created_at : now;
159
+ const cloudCursor = isSafeNonNegInt(ev.cloud_cursor) ? ev.cloud_cursor : null;
160
+ // v7 F2 (T009): the remote author's attribution is preserved (clamped like
161
+ // every peer-supplied field) — the LOCAL actor envelope is deliberately NOT
162
+ // stamped on ingested events: provenance belongs to whoever wrote the row,
163
+ // and NULL stays NULL so replication round-trips are byte-faithful.
164
+ const info = db.prepare(`
6
165
  INSERT OR IGNORE INTO events
7
166
  (origin_device, origin_seq, cloud_cursor, project_id, kind, ref_table, ref_id, actor, is_shared, payload_json, created_at, agent_id, run_id)
8
167
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
9
- `).run(n,e.origin_seq,E,String(t),e.kind,s(e.ref_table,d),s(e.ref_id,d),s(e.actor,d),o,i,u,s(e.agent_id,d),s(e.run_id,d)).changes>0?"inserted":"duplicate"}catch(n){return l.warn("live-memory: ingestRemoteEvent dropped",{err:n instanceof Error?n.message:String(n)}),"duplicate"}}function v(r,t,e=0,n=200){const o=a(n,1,1e3,200),i=a(e,0,Number.MAX_SAFE_INTEGER,0);try{const c=r.prepare("SELECT sync_policy AS p FROM projects WHERE CAST(id AS TEXT) = ? OR path = ? LIMIT 1").get(String(t),String(t));if(c&&c.p&&c.p!=="team")return[]}catch{}return r.prepare(`
168
+ `).run(device, ev.origin_seq, cloudCursor, String(localProjectId), ev.kind, clampStr(ev.ref_table, MAX_FIELD_LEN), clampStr(ev.ref_id, MAX_FIELD_LEN), clampStr(ev.actor, MAX_FIELD_LEN), isShared, payloadJson, createdAt, clampStr(ev.agent_id, MAX_FIELD_LEN), clampStr(ev.run_id, MAX_FIELD_LEN));
169
+ return info.changes > 0 ? 'inserted' : 'duplicate';
170
+ }
171
+ catch (err) {
172
+ logger.warn('live-memory: ingestRemoteEvent dropped', { err: err instanceof Error ? err.message : String(err) });
173
+ return 'duplicate';
174
+ }
175
+ }
176
+ /**
177
+ * Shared events past a local-cursor watermark, for PUSH up to a peer/cloud.
178
+ * **Privacy gate:** only `is_shared = 1` rows are eligible to leave the box;
179
+ * reference-only rows keep `payload_json = NULL` exactly as stored, so protected
180
+ * data never replicates even by accident.
181
+ */
182
+ export function eventsForPush(db, projectId, sinceCursor = 0, limit = 200) {
183
+ const lim = clamp(limit, 1, 1000, 200);
184
+ const since = clamp(sinceCursor, 0, Number.MAX_SAFE_INTEGER, 0);
185
+ // [grove isolation] Live Memory replication is a separate egress channel; gate
186
+ // it by grove too. Only a 'team' grove's events may leave the box. We match the
187
+ // event's project_id against BOTH projects.id and projects.path (events store a
188
+ // path-or-id key), so a private grove (e.g. GHOST PROTOCOL) never replicates.
189
+ // If the projects.sync_policy column is absent (pre-migration), the grove
190
+ // feature is off and we fall back to the is_shared-only gate.
191
+ try {
192
+ const pol = db.prepare(`SELECT sync_policy AS p FROM projects WHERE CAST(id AS TEXT) = ? OR path = ? LIMIT 1`).get(String(projectId), String(projectId));
193
+ if (pol && pol.p && pol.p !== 'team')
194
+ return [];
195
+ }
196
+ catch { /* sync_policy column absent (pre-migration): grove gate off */ }
197
+ return db.prepare(`
10
198
  SELECT * FROM events
11
199
  WHERE project_id = ? AND is_shared = 1 AND cursor > ?
12
200
  ORDER BY cursor ASC LIMIT ?
13
- `).all(String(t),i,o)}function w(r,t={}){const e=a(t.olderThanDays,1,3650,90),n=a(t.maxPerProject,1,1e6,5e3);try{let o=0;const i=Date.now()-e*_;o+=r.prepare("DELETE FROM events WHERE created_at < ?").run(i).changes;const c=r.prepare("SELECT project_id FROM events GROUP BY project_id HAVING COUNT(*) > ?").all(n),u=r.prepare(`
201
+ `).all(String(projectId), since, lim);
202
+ }
203
+ /**
204
+ * Retention for the append-only event log. Live Memory is a DERIVED stream, not
205
+ * the system of record — trimming old events is lossless for memory; it only
206
+ * shortens how far back the live tail / replication catch-up can reach. Bounds
207
+ * the table two ways: (1) drop events older than `olderThanDays` (old enough that
208
+ * any peer has long since synced), then (2) cap each project to its most recent
209
+ * `maxPerProject` by cursor. Failure-isolated — a retention hiccup never throws.
210
+ *
211
+ * Performance note: this is why widening producers (truths/captures/failures/
212
+ * decisions all emit now) can't grow the DB unbounded — maintenance trims it.
213
+ */
214
+ export function pruneEvents(db, opts = {}) {
215
+ const olderThanDays = clamp(opts.olderThanDays, 1, 3650, 90);
216
+ const maxPerProject = clamp(opts.maxPerProject, 1, 1_000_000, 5000);
217
+ try {
218
+ let deleted = 0;
219
+ // (1) Age-based sweep.
220
+ const cutoff = Date.now() - olderThanDays * DAY_MS;
221
+ deleted += db.prepare(`DELETE FROM events WHERE created_at < ?`).run(cutoff).changes;
222
+ // (2) Per-project count cap: keep the most recent `maxPerProject` by cursor.
223
+ // The OFFSET row is the (max+1)-th newest cursor; deleting <= it keeps exactly
224
+ // `maxPerProject`. Projects under the cap return NULL → `cursor <= NULL` deletes
225
+ // nothing (safe no-op).
226
+ const overflow = db.prepare(`SELECT project_id FROM events GROUP BY project_id HAVING COUNT(*) > ?`).all(maxPerProject);
227
+ const trim = db.prepare(`
14
228
  DELETE FROM events WHERE project_id = ? AND cursor <= (
15
229
  SELECT cursor FROM events WHERE project_id = ? ORDER BY cursor DESC LIMIT 1 OFFSET ?
16
230
  )
17
- `);for(const{project_id:E}of c)o+=u.run(E,E,n).changes;return{deleted:o}}catch(o){return l.warn("live-memory: pruneEvents failed",{err:o instanceof Error?o.message:String(o)}),{deleted:0}}}function x(r,t){return r.prepare("SELECT value FROM wyrm_meta WHERE key = ?").get(t)?.value}function W(r,t,e){r.prepare(`INSERT INTO wyrm_meta (key, value) VALUES (?, ?)
18
- ON CONFLICT(key) DO UPDATE SET value = excluded.value`).run(t,e)}export{C as emitEvent,v as eventsForPush,D as eventsSince,S as getDeviceId,x as getMeta,j as ingestRemoteEvent,O as isLiveMemoryEnabled,w as pruneEvents,W as setMeta,F as subscribeEvents};
231
+ `);
232
+ for (const { project_id } of overflow) {
233
+ deleted += trim.run(project_id, project_id, maxPerProject).changes;
234
+ }
235
+ return { deleted };
236
+ }
237
+ catch (err) {
238
+ logger.warn('live-memory: pruneEvents failed', { err: err instanceof Error ? err.message : String(err) });
239
+ return { deleted: 0 };
240
+ }
241
+ }
242
+ /** Tiny persistent KV in wyrm_meta — used for replication watermarks. */
243
+ export function getMeta(db, key) {
244
+ return db.prepare(`SELECT value FROM wyrm_meta WHERE key = ?`).get(key)?.value;
245
+ }
246
+ export function setMeta(db, key, value) {
247
+ db.prepare(`INSERT INTO wyrm_meta (key, value) VALUES (?, ?)
248
+ ON CONFLICT(key) DO UPDATE SET value = excluded.value`).run(key, value);
249
+ }
250
+ //# sourceMappingURL=events.js.map
@@ -24,6 +24,35 @@ export type RunScopeFilter = QuarantineScope | 'any';
24
24
  /** v7 F2 (T015): the tiers a failure can be PROMOTED to ('run' is where
25
25
  * quarantined rows start — promotion only ever widens, see TIER_RANK). */
26
26
  export type PromoteTier = 'project' | 'global';
27
+ /** Hard cap on DISTINCT anchored files (rel_paths) per failure, enforced at
28
+ * WRITE time (recordAnchors). Refreshing an already-anchored path never
29
+ * consumes a slot — one row per (failure_id, rel_path) by construction. */
30
+ export declare const ANCHOR_CAP = 8;
31
+ /** The advisory flag a downgraded match carries (PROTOCOL.md §10.2.5). Both
32
+ * surfaces — the MCP failure_check handler and the wyrm-guard block tiers —
33
+ * emit EXACTLY this string, so consumers can key on it. */
34
+ export declare const STALE_ANCHOR_FLAG = "source changed since this failure was recorded \u2014 re-verify";
35
+ /**
36
+ * One stored anchor row (SELECT-projection of failure_anchors). size/mtime_ns
37
+ * are BigInt: mtime in nanoseconds exceeds Number.MAX_SAFE_INTEGER (~9e15 vs
38
+ * ~1.7e18), so the read statement runs under safeIntegers — a number round-trip
39
+ * would silently break the stat fast path on every check.
40
+ */
41
+ export interface FailureAnchor {
42
+ rel_path: string;
43
+ sha: string;
44
+ size: bigint;
45
+ mtime_ns: bigint;
46
+ recorded_at: string;
47
+ }
48
+ /** One failure's oracle verdict:
49
+ * - 'unanchored' — nothing checkable (no anchors / no root / every anchor
50
+ * missing-or-unreadable): FAIL-OPEN, no staleness claim, verdict unchanged.
51
+ * - 'fresh' — ≥1 checkable anchor and every checkable anchor matches
52
+ * (stat fast path, or normalized-content hash on stat drift).
53
+ * - 'stale' — ≥1 anchor is READABLE and its normalized-content hash
54
+ * positively differs from what was recorded. The only downgrading verdict. */
55
+ export type AnchorFreshness = 'unanchored' | 'fresh' | 'stale';
27
56
  export interface FailurePattern {
28
57
  id: number;
29
58
  project_id: number | null;
@@ -91,6 +120,12 @@ export interface FailureVerdictMatch {
91
120
  match: 'exact' | 'fuzzy' | 'target';
92
121
  /** Deterministic per-match score, 0..1 — see matchConfidence(). */
93
122
  confidence: number;
123
+ /** Staleness oracle (migration 30, PROTOCOL.md §10.2.5): present ONLY when
124
+ * this match's anchored source files have POSITIVELY drifted since the
125
+ * failure was recorded — the hard block downgrades to advisory and this
126
+ * carries STALE_ANCHOR_FLAG. ADDITIVE: absent (never null) on every
127
+ * unanchored/fresh match, so anchor-less results stay byte-identical. */
128
+ stale_anchor?: string;
94
129
  }
95
130
  /**
96
131
  * The canonical wyrm_failure_check result shape (spec FR-2). `confidence` is a
@@ -280,6 +315,78 @@ export declare class FailurePatterns {
280
315
  */
281
316
  contentMatch(editContent: string, scope: FailureScope, projectId: number | null): FailurePattern | null;
282
317
  get(id: number): FailurePattern | null;
318
+ /** The anchor fingerprint: sha256 over the NORMALIZED content form
319
+ * (normalizeContentSignature — the content-tier normal form), so
320
+ * whitespace/reformat/comment churn can never false-flag staleness. */
321
+ static anchorSha(content: string): string;
322
+ /**
323
+ * Anchor a recorded failure to the source files it is about (the undeclared
324
+ * `files` param of wyrm_failure_record). For each file UNDER the project
325
+ * root: stat + read + hash the normalized content, store the
326
+ * PROJECT-RELATIVE path (anchors replicate across machines whose checkouts
327
+ * live at different roots) with the stat fast-path fields. Paths escaping
328
+ * the project root (traversal, absolute paths outside it) are REJECTED;
329
+ * unreadable files are skipped.
330
+ *
331
+ * UPSERT per (failure_id, rel_path): record() COALESCES repeat failures
332
+ * onto ONE id, so a coalesced re-record that names the same files must
333
+ * REFRESH each path's anchor in place (delete-then-insert — no reliance on
334
+ * the unique index, so a DB that ran an earlier shape of migration 30 still
335
+ * behaves). Appending instead would leave the old-sha row beside the fresh
336
+ * one, and anchorFreshness — 'stale' on ANY drifted row — would keep a
337
+ * failure just re-confirmed against CURRENT source permanently advisory.
338
+ * ANCHOR_CAP counts DISTINCT rel_paths: refreshing an existing anchor never
339
+ * consumes a slot and lands even at the cap. Best-effort by contract:
340
+ * returns how many anchors were written (refreshes included) and NEVER
341
+ * throws — a pre-migration-30 DB or any fs error must not fail the record.
342
+ *
343
+ * SECURITY (allowNewPaths): only the call that FRESHLY created this failure
344
+ * may introduce NEW anchor paths. record() coalesces a repeat signature onto
345
+ * an existing id, so a coalesced re-record (allowNewPaths=false) may only
346
+ * REFRESH paths already anchored — it can never attach a NEW (decoy) anchor
347
+ * to a firm block it does not own and then drift the decoy to collapse that
348
+ * block to advisory. Refreshes are always allowed (a re-confirmed failure
349
+ * must regain its hard block); the gate is on introducing new paths only.
350
+ */
351
+ recordAnchors(failureId: number, projectRoot: string, files: string[], allowNewPaths?: boolean): number;
352
+ /** Stored anchors for one failure. safeIntegers: mtime_ns (INT64 ns) exceeds
353
+ * JS safe-number range — a number round-trip would break the stat fast path.
354
+ * Never throws: a pre-migration-30 DB reads as "no anchors" (fail-open). */
355
+ getAnchors(failureId: number): FailureAnchor[];
356
+ /**
357
+ * THE ORACLE CORE: has this failure's anchored source POSITIVELY drifted?
358
+ *
359
+ * Fast path first (the guard's latency budget): stat each anchor — equal
360
+ * size AND mtime_ns ⇒ fresh with ZERO hashing. Only on stat drift is the
361
+ * file read and its NORMALIZED content re-hashed (anchorSha), so a
362
+ * whitespace-only reformat stats different but hashes identical ⇒ fresh.
363
+ *
364
+ * FAIL-OPEN (PROTOCOL.md §10.2 verdict contract): a missing/unreadable
365
+ * anchor file (fleet-replicated rows from machines whose checkout this box
366
+ * doesn't have), a rel_path that would escape the root, a pre-migration DB,
367
+ * or ANY fs error contributes NO staleness claim — only a readable file
368
+ * whose normalized hash differs returns 'stale'. Never throws. Read-only
369
+ * (the wyrm-guard handle is readonly).
370
+ */
371
+ anchorFreshness(failureId: number, projectRoot: string | null): AnchorFreshness;
372
+ /**
373
+ * The SHARED downgrade rule both firewall surfaces inherit — the MCP
374
+ * wyrm_failure_check handler AND the wyrm-guard block tiers call exactly
375
+ * this, so the two cannot drift. Returns the ids of matches whose hard
376
+ * block must DOWNGRADE to advisory (stale_anchor), i.e. matches that are:
377
+ *
378
+ * · NOT an exact-signature match for the current attempt — an exact
379
+ * command/edit signature match KEEPS its hard block regardless of
380
+ * anchors (code moving on does not unprove a command failure), and
381
+ * · file/symbol-scoped — only matches ABOUT source code are unproven by
382
+ * that source changing; command/edit/prompt scopes key on the ATTEMPT
383
+ * itself and never downgrade, and
384
+ * · positively 'stale' under anchorFreshness above.
385
+ *
386
+ * Fail-open end to end: no project root, no anchors, missing files, any
387
+ * error ⇒ ids stay out of the set ⇒ verdict unchanged. Never throws.
388
+ */
389
+ staleAnchorIds(matches: ReadonlyArray<Pick<FailureVerdictMatch, 'id' | 'scope' | 'match'>>, projectRoot: string | null): Set<number>;
283
390
  /**
284
391
  * Confirmation ledger + the ≥2-distinct-agents auto-promotion path.
285
392
  *
@@ -1 +1 @@
1
- {"version":3,"file":"failure-patterns.d.ts","sourceRoot":"","sources":["../src/failure-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,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