wyrm-mcp 7.2.1 → 7.2.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 (280) hide show
  1. package/LICENSE +26 -667
  2. package/NOTICE +14 -33
  3. package/dist/activation.d.ts +8 -9
  4. package/dist/activation.d.ts.map +1 -1
  5. package/dist/activation.js +1 -60
  6. package/dist/activation.js.map +1 -1
  7. package/dist/agent-daemon.d.ts +1 -1
  8. package/dist/agent-daemon.js +4 -281
  9. package/dist/agent-loop.d.ts +1 -1
  10. package/dist/agent-loop.js +7 -332
  11. package/dist/analytics.d.ts +1 -1
  12. package/dist/analytics.js +13 -236
  13. package/dist/attribution.d.ts +1 -1
  14. package/dist/attribution.js +1 -49
  15. package/dist/audit.d.ts +1 -1
  16. package/dist/audit.js +2 -457
  17. package/dist/auto-capture.js +3 -138
  18. package/dist/auto-orchestrator.d.ts +1 -1
  19. package/dist/auto-orchestrator.js +1 -325
  20. package/dist/autoconfig.d.ts +1 -1
  21. package/dist/autoconfig.js +39 -840
  22. package/dist/buddy-runner.d.ts +1 -1
  23. package/dist/buddy-runner.js +1 -109
  24. package/dist/buddy.d.ts +1 -1
  25. package/dist/buddy.js +14 -564
  26. package/dist/build-flags.d.ts +6 -8
  27. package/dist/build-flags.d.ts.map +1 -1
  28. package/dist/build-flags.js +1 -17
  29. package/dist/build-flags.js.map +1 -1
  30. package/dist/capabilities.d.ts +1 -1
  31. package/dist/capabilities.js +3 -183
  32. package/dist/capture.d.ts +1 -1
  33. package/dist/capture.js +1 -56
  34. package/dist/causality.d.ts +1 -1
  35. package/dist/causality.js +6 -107
  36. package/dist/cli.d.ts +1 -1
  37. package/dist/cli.js +20 -281
  38. package/dist/cloud/cli.js +5 -541
  39. package/dist/cloud/client.js +1 -221
  40. package/dist/cloud/crypto.js +1 -85
  41. package/dist/cloud/machine-id.d.ts +1 -1
  42. package/dist/cloud/machine-id.js +2 -113
  43. package/dist/cloud/recovery.js +1 -60
  44. package/dist/cloud/sync-engine.js +7 -543
  45. package/dist/cloud-backup.d.ts +1 -1
  46. package/dist/cloud-backup.js +5 -579
  47. package/dist/cloud-profile.d.ts +1 -1
  48. package/dist/cloud-profile.js +1 -138
  49. package/dist/cloud-sync-entrypoint.d.ts +1 -1
  50. package/dist/cloud-sync-entrypoint.js +1 -47
  51. package/dist/cloud-sync.d.ts +1 -1
  52. package/dist/cloud-sync.js +2 -309
  53. package/dist/constellation.d.ts +1 -1
  54. package/dist/constellation.js +12 -168
  55. package/dist/context-build-budgeted.d.ts +1 -1
  56. package/dist/context-build-budgeted.js +4 -144
  57. package/dist/context-ranking.d.ts +1 -1
  58. package/dist/context-ranking.js +1 -69
  59. package/dist/crypto.d.ts +1 -1
  60. package/dist/crypto.js +1 -179
  61. package/dist/daemon-write-endpoint.d.ts +1 -1
  62. package/dist/daemon-write-endpoint.js +1 -290
  63. package/dist/daemon-writer.d.ts +1 -1
  64. package/dist/daemon-writer.js +2 -406
  65. package/dist/database.d.ts +1 -1
  66. package/dist/database.js +43 -1110
  67. package/dist/deprecations.js +2 -162
  68. package/dist/design.d.ts +1 -1
  69. package/dist/design.js +13 -141
  70. package/dist/event-replication.d.ts +1 -1
  71. package/dist/event-replication.js +1 -112
  72. package/dist/events-sse.d.ts +1 -1
  73. package/dist/events-sse.js +7 -43
  74. package/dist/events.js +6 -238
  75. package/dist/failure-patterns.d.ts +1 -1
  76. package/dist/failure-patterns.js +42 -659
  77. package/dist/federation.d.ts +1 -1
  78. package/dist/federation.js +12 -236
  79. package/dist/goals.d.ts +1 -1
  80. package/dist/goals.js +13 -101
  81. package/dist/golden.js +3 -355
  82. package/dist/handlers/agent.d.ts +1 -1
  83. package/dist/handlers/agent.js +4 -165
  84. package/dist/handlers/alias-adapters.d.ts +1 -1
  85. package/dist/handlers/alias-adapters.js +1 -129
  86. package/dist/handlers/aliases.d.ts +1 -1
  87. package/dist/handlers/aliases.js +1 -171
  88. package/dist/handlers/audit.d.ts +1 -1
  89. package/dist/handlers/audit.js +1 -87
  90. package/dist/handlers/boundary.d.ts +1 -1
  91. package/dist/handlers/boundary.js +1 -221
  92. package/dist/handlers/capture.d.ts +1 -1
  93. package/dist/handlers/capture.js +73 -1109
  94. package/dist/handlers/causality.d.ts +1 -1
  95. package/dist/handlers/causality.js +7 -114
  96. package/dist/handlers/cloud.d.ts +1 -1
  97. package/dist/handlers/cloud.js +85 -382
  98. package/dist/handlers/companion.d.ts +1 -1
  99. package/dist/handlers/companion.js +28 -459
  100. package/dist/handlers/datalake.d.ts +1 -1
  101. package/dist/handlers/datalake.js +7 -187
  102. package/dist/handlers/dispatch-context.d.ts +1 -1
  103. package/dist/handlers/dispatch-context.js +0 -22
  104. package/dist/handlers/entity.d.ts +1 -1
  105. package/dist/handlers/entity.js +25 -256
  106. package/dist/handlers/events.d.ts +1 -1
  107. package/dist/handlers/events.js +16 -335
  108. package/dist/handlers/failure.d.ts +1 -1
  109. package/dist/handlers/failure.js +13 -340
  110. package/dist/handlers/goals.d.ts +1 -1
  111. package/dist/handlers/goals.js +4 -296
  112. package/dist/handlers/intelligence.d.ts +1 -1
  113. package/dist/handlers/intelligence.js +126 -674
  114. package/dist/handlers/invoicing.d.ts +1 -1
  115. package/dist/handlers/invoicing.js +1 -70
  116. package/dist/handlers/mcpclient.d.ts +1 -1
  117. package/dist/handlers/mcpclient.js +6 -137
  118. package/dist/handlers/orchestration.d.ts +1 -1
  119. package/dist/handlers/orchestration.js +40 -125
  120. package/dist/handlers/output-schemas.d.ts +1 -1
  121. package/dist/handlers/output-schemas.js +1 -24
  122. package/dist/handlers/presence.d.ts +1 -1
  123. package/dist/handlers/presence.js +3 -99
  124. package/dist/handlers/project.d.ts +1 -1
  125. package/dist/handlers/project.js +28 -182
  126. package/dist/handlers/prompts.d.ts +1 -1
  127. package/dist/handlers/prompts.js +6 -157
  128. package/dist/handlers/quest.d.ts +1 -1
  129. package/dist/handlers/quest.js +4 -224
  130. package/dist/handlers/recall.d.ts +1 -1
  131. package/dist/handlers/recall.js +11 -218
  132. package/dist/handlers/registry.d.ts +1 -1
  133. package/dist/handlers/registry.js +1 -167
  134. package/dist/handlers/resources.d.ts +1 -1
  135. package/dist/handlers/resources.js +1 -288
  136. package/dist/handlers/review.d.ts +1 -1
  137. package/dist/handlers/review.js +11 -74
  138. package/dist/handlers/run.d.ts +1 -1
  139. package/dist/handlers/run.js +17 -487
  140. package/dist/handlers/search.d.ts +1 -1
  141. package/dist/handlers/search.js +15 -326
  142. package/dist/handlers/session.d.ts +1 -1
  143. package/dist/handlers/session.js +28 -615
  144. package/dist/handlers/share.d.ts +1 -1
  145. package/dist/handlers/share.js +8 -184
  146. package/dist/handlers/shims.d.ts +1 -1
  147. package/dist/handlers/shims.js +1 -464
  148. package/dist/handlers/skill.d.ts +1 -1
  149. package/dist/handlers/skill.js +67 -449
  150. package/dist/handlers/survivors.d.ts +1 -1
  151. package/dist/handlers/survivors.js +1 -120
  152. package/dist/handlers/symbols.d.ts +1 -1
  153. package/dist/handlers/symbols.js +8 -109
  154. package/dist/handlers/syncops.d.ts +1 -1
  155. package/dist/handlers/syncops.js +4 -302
  156. package/dist/handlers/types.d.ts +1 -1
  157. package/dist/handlers/types.js +1 -27
  158. package/dist/harvest.d.ts +1 -1
  159. package/dist/harvest.js +5 -191
  160. package/dist/hours.d.ts +1 -1
  161. package/dist/hours.js +7 -156
  162. package/dist/http-auth.d.ts +1 -1
  163. package/dist/http-auth.js +3 -321
  164. package/dist/http-fast.js +21 -1137
  165. package/dist/icons.d.ts +1 -1
  166. package/dist/icons.js +1 -47
  167. package/dist/index.d.ts +1 -1
  168. package/dist/index.js +2 -924
  169. package/dist/index.js.map +1 -1
  170. package/dist/indexer.d.ts +1 -1
  171. package/dist/indexer.js +4 -145
  172. package/dist/intelligence.d.ts +1 -1
  173. package/dist/intelligence.js +31 -261
  174. package/dist/internal-dispatch.d.ts +1 -1
  175. package/dist/internal-dispatch.js +3 -212
  176. package/dist/keyset.d.ts +1 -1
  177. package/dist/keyset.js +1 -110
  178. package/dist/knowledge-graph.d.ts +1 -1
  179. package/dist/knowledge-graph.js +12 -176
  180. package/dist/license.d.ts +1 -1
  181. package/dist/license.js +2 -441
  182. package/dist/logger.d.ts +1 -1
  183. package/dist/logger.js +2 -199
  184. package/dist/maintenance.d.ts +1 -1
  185. package/dist/maintenance.js +2 -148
  186. package/dist/mcp-client.d.ts +1 -1
  187. package/dist/mcp-client.js +6 -262
  188. package/dist/memory-artifacts.d.ts +1 -1
  189. package/dist/memory-artifacts.js +30 -449
  190. package/dist/migrate-prompt.d.ts +1 -1
  191. package/dist/migrate-prompt.js +2 -124
  192. package/dist/migrations.d.ts +1 -1
  193. package/dist/migrations.js +40 -655
  194. package/dist/performance.js +1 -228
  195. package/dist/presence.d.ts +1 -1
  196. package/dist/presence.js +11 -140
  197. package/dist/priority-embed.d.ts +1 -1
  198. package/dist/priority-embed.js +5 -164
  199. package/dist/providers/embedding-provider.d.ts +1 -1
  200. package/dist/providers/embedding-provider.js +1 -196
  201. package/dist/readonly-gate.js +1 -29
  202. package/dist/rehydration.d.ts +1 -1
  203. package/dist/rehydration.js +9 -157
  204. package/dist/reindex.d.ts +1 -1
  205. package/dist/reindex.js +1 -88
  206. package/dist/render-target.d.ts +1 -1
  207. package/dist/render-target.js +21 -514
  208. package/dist/render.d.ts +1 -1
  209. package/dist/render.js +4 -280
  210. package/dist/repl-guard.d.ts +1 -1
  211. package/dist/repl-guard.js +1 -173
  212. package/dist/replication-daemon-entrypoint.d.ts +1 -1
  213. package/dist/replication-daemon-entrypoint.js +1 -31
  214. package/dist/replication-daemon.d.ts +1 -1
  215. package/dist/replication-daemon.js +2 -262
  216. package/dist/resilience.d.ts +1 -1
  217. package/dist/resilience.js +1 -591
  218. package/dist/reverse-bridge.d.ts +1 -1
  219. package/dist/reverse-bridge.js +5 -360
  220. package/dist/security.d.ts +1 -1
  221. package/dist/security.js +1 -244
  222. package/dist/session-seen.d.ts +1 -1
  223. package/dist/session-seen.js +3 -51
  224. package/dist/setup.d.ts +1 -1
  225. package/dist/setup.js +1 -260
  226. package/dist/skill-author.d.ts +1 -1
  227. package/dist/skill-author.js +5 -168
  228. package/dist/spec-kit.d.ts +1 -1
  229. package/dist/spec-kit.js +1 -191
  230. package/dist/sqlite-busy.d.ts +1 -1
  231. package/dist/sqlite-busy.js +1 -154
  232. package/dist/statusline.d.ts +1 -1
  233. package/dist/statusline.js +11 -315
  234. package/dist/sub-agent.d.ts +1 -1
  235. package/dist/sub-agent.js +13 -262
  236. package/dist/summarizer.js +13 -139
  237. package/dist/symbols.d.ts +1 -1
  238. package/dist/symbols.js +7 -283
  239. package/dist/sync.d.ts +1 -1
  240. package/dist/sync.js +5 -359
  241. package/dist/tasks-dispatch.js +1 -84
  242. package/dist/tasks.js +1 -282
  243. package/dist/token-budget.d.ts +1 -1
  244. package/dist/token-budget.js +1 -143
  245. package/dist/tool-analytics.d.ts +1 -1
  246. package/dist/tool-analytics.js +7 -129
  247. package/dist/tool-annotations.js +1 -365
  248. package/dist/tool-manifest-v2.json +1 -1
  249. package/dist/tool-manifest.json +1 -1
  250. package/dist/tool-profiles.d.ts +1 -1
  251. package/dist/tool-profiles.js +1 -75
  252. package/dist/trace-harvest.d.ts +1 -1
  253. package/dist/trace-harvest.js +6 -244
  254. package/dist/types.d.ts +1 -1
  255. package/dist/types.js +1 -30
  256. package/dist/ui-dashboard.d.ts +1 -1
  257. package/dist/ui-dashboard.js +41 -50
  258. package/dist/ulid.d.ts +1 -1
  259. package/dist/ulid.js +1 -81
  260. package/dist/validate.d.ts +1 -1
  261. package/dist/validate.js +1 -129
  262. package/dist/vault.js +1 -534
  263. package/dist/vectors.d.ts +1 -1
  264. package/dist/vectors.js +3 -184
  265. package/dist/version-check.d.ts +1 -1
  266. package/dist/version-check.js +4 -136
  267. package/dist/visibility.d.ts +1 -1
  268. package/dist/visibility.js +19 -155
  269. package/dist/wyrm-cli.d.ts +1 -1
  270. package/dist/wyrm-cli.js +98 -2464
  271. package/dist/wyrm-cli.js.map +1 -1
  272. package/dist/wyrm-guard.d.ts +1 -1
  273. package/dist/wyrm-guard.js +14 -424
  274. package/dist/wyrm-loop.js +3 -150
  275. package/dist/wyrm-manifest.json +1 -1
  276. package/dist/wyrm-statusline-daemon.js +1 -11
  277. package/dist/wyrm-statusline.js +4 -56
  278. package/dist/wyrm-ui.d.ts +1 -1
  279. package/dist/wyrm-ui.js +9 -77
  280. package/package.json +4 -2
@@ -1,335 +1,16 @@
1
- /**
2
- * @copyright 2026 Ghost Protocol (Pvt) Ltd.
3
- * @license AGPL-3.0-or-later
4
- */
5
- import { TOOL_ANNOTATIONS } from "../tool-annotations.js";
6
- import { installClaudeCodeHooks, installClaudeStatusline } from "../autoconfig.js";
7
- import { replicateOnce } from "../event-replication.js";
8
- import { embedAll, removeAll, statusAll } from "../priority-embed.js";
9
- import { ReplicationDaemon, addPeer, listPeers, removePeer } from "../replication-daemon.js";
10
- export const eventsToolSpecs = [
11
- {
12
- name: "wyrm_events_subscribe",
13
- description: "Use to START consuming a project's Live Memory event stream: returns the current head cursor plus a recent chronological window of events in one read-only call. Nothing persists server-side — poll wyrm_events_since with the returned cursor for new events. Returns disabled:true if WYRM_LIVE_MEMORY is off. Keywords: events, live memory, event stream, cursor, tail events, watch project, replication feed.",
14
- inputSchema: {
15
- type: "object",
16
- properties: {
17
- projectPath: { type: "string", description: "Project path" },
18
- window: { type: "number", description: "How many recent events to return (1-200, default 20)" },
19
- },
20
- required: ["projectPath"],
21
- },
22
- annotations: TOOL_ANNOTATIONS["wyrm_events_subscribe"],
23
- aliases: [],
24
- handler: async (args, ctx) => {
25
- const { db } = ctx;
26
- const a = args || {};
27
- const requireArgs = (fields) => {
28
- const missing = fields.filter(f => !a[f] && a[f] !== 0 && a[f] !== false);
29
- if (missing.length > 0) {
30
- return { content: [{ type: "text", text: `Missing required arguments: ${missing.join(', ')}` }], isError: true };
31
- }
32
- return null;
33
- };
34
- const argErr = requireArgs(['projectPath']);
35
- if (argErr)
36
- return argErr;
37
- const { projectPath, window } = args;
38
- if (!db.liveMemoryEnabled()) {
39
- return { content: [{ type: "text", text: JSON.stringify({ disabled: true, hint: "Set WYRM_LIVE_MEMORY=1 to enable the event log." }) }] };
40
- }
41
- const project = db.getProject(projectPath);
42
- if (!project)
43
- return { content: [{ type: "text", text: "Project not found" }] };
44
- const sub = db.subscribeEvents(project.id, window);
45
- return { content: [{ type: "text", text: JSON.stringify({ project: project.name, cursor: sub.cursor, count: sub.recent.length, events: sub.recent }) }] };
46
- },
47
- },
48
- {
49
- name: "wyrm_events_since",
50
- description: "Live Memory: pull events newer than a cursor for a project, in chronological order. Idempotent — safe to re-poll. Returns the events and the new head cursor to pass next time.",
51
- inputSchema: {
52
- type: "object",
53
- properties: {
54
- projectPath: { type: "string", description: "Project path" },
55
- cursor: { type: "number", description: "Return events with cursor greater than this (default 0 = from start)" },
56
- limit: { type: "number", description: "Max events to return (1-1000, default 100)" },
57
- },
58
- required: ["projectPath"],
59
- },
60
- annotations: TOOL_ANNOTATIONS["wyrm_events_since"],
61
- aliases: [],
62
- handler: async (args, ctx) => {
63
- const { db } = ctx;
64
- const a = args || {};
65
- const requireArgs = (fields) => {
66
- const missing = fields.filter(f => !a[f] && a[f] !== 0 && a[f] !== false);
67
- if (missing.length > 0) {
68
- return { content: [{ type: "text", text: `Missing required arguments: ${missing.join(', ')}` }], isError: true };
69
- }
70
- return null;
71
- };
72
- const argErr = requireArgs(['projectPath']);
73
- if (argErr)
74
- return argErr;
75
- const { projectPath, cursor, limit } = args;
76
- if (!db.liveMemoryEnabled()) {
77
- return { content: [{ type: "text", text: JSON.stringify({ disabled: true, hint: "Set WYRM_LIVE_MEMORY=1 to enable the event log." }) }] };
78
- }
79
- const project = db.getProject(projectPath);
80
- if (!project)
81
- return { content: [{ type: "text", text: "Project not found" }] };
82
- const events = db.eventsSince(project.id, cursor || 0, limit || 100);
83
- const head = events.length ? events[events.length - 1].cursor : (cursor || 0);
84
- return { content: [{ type: "text", text: JSON.stringify({ project: project.name, cursor: head, count: events.length, events }) }] };
85
- },
86
- },
87
- {
88
- name: "wyrm_events_publish",
89
- description: "Live Memory: manually publish an event onto a project's stream (e.g. a tool_call or presence marker). Failure-isolated — never throws. Payload is stored only when isShared is true (reference-only otherwise).",
90
- inputSchema: {
91
- type: "object",
92
- properties: {
93
- projectPath: { type: "string", description: "Project path" },
94
- kind: { type: "string", enum: ["capture", "session_update", "quest", "truth", "presence", "tool_call"], description: "Event kind" },
95
- refTable: { type: "string", description: "Canonical table this event refers to (optional)" },
96
- refId: { type: "string", description: "Canonical row id this event refers to (optional)" },
97
- actor: { type: "string", description: "Who/what produced the event (optional)" },
98
- isShared: { type: "boolean", description: "If true, the payload is denormalized into the event (default false = reference-only)" },
99
- payload: { type: "object", description: "Denormalized snapshot, stored only when isShared is true" },
100
- },
101
- required: ["projectPath", "kind"],
102
- },
103
- annotations: TOOL_ANNOTATIONS["wyrm_events_publish"],
104
- aliases: [],
105
- handler: async (args, ctx) => {
106
- const { db, presence } = ctx;
107
- const a = args || {};
108
- const requireArgs = (fields) => {
109
- const missing = fields.filter(f => !a[f] && a[f] !== 0 && a[f] !== false);
110
- if (missing.length > 0) {
111
- return { content: [{ type: "text", text: `Missing required arguments: ${missing.join(', ')}` }], isError: true };
112
- }
113
- return null;
114
- };
115
- const argErr = requireArgs(['projectPath', 'kind']);
116
- if (argErr)
117
- return argErr;
118
- const { projectPath, kind, refTable, refId, actor, isShared, payload } = args;
119
- if (!db.liveMemoryEnabled()) {
120
- return { content: [{ type: "text", text: JSON.stringify({ disabled: true, hint: "Set WYRM_LIVE_MEMORY=1 to enable the event log." }) }] };
121
- }
122
- const project = db.getProject(projectPath);
123
- if (!project)
124
- return { content: [{ type: "text", text: "Project not found" }] };
125
- db.publishEvent({ projectId: project.id, kind, refTable, refId, actor, isShared, payload });
126
- return { content: [{ type: "text", text: `󱅝 Event published to ${project.name} stream (${kind})` }] };
127
- },
128
- },
129
- {
130
- name: "wyrm_events_replicate",
131
- description: "Live Memory (Phase 3): one-shot cross-device replication with a peer Wyrm node — pulls the peer's shared events and pushes ours over the peer's HTTP surface. Privacy-gated (only is_shared events leave the box; reference-only rows carry no payload), with automatic dedup + echo-suppression. Watermarks persist, so repeat calls are incremental. Returns pulled/pushed/duplicate counts.",
132
- inputSchema: {
133
- type: "object",
134
- properties: {
135
- projectPath: { type: "string", description: "Local project path" },
136
- // v7 T033: wyrm-http was deleted — the peer surface is `wyrm serve` (http-fast).
137
- peerUrl: { type: "string", description: "Peer Wyrm HTTP (wyrm serve) base URL, e.g. http://other-host:3333" },
138
- token: { type: "string", description: "Bearer token for the peer (optional if the peer runs open / dev mode)" },
139
- remoteProject: { type: "string", description: "Project path or name on the peer (defaults to this project's name)" },
140
- },
141
- required: ["projectPath", "peerUrl"],
142
- },
143
- annotations: TOOL_ANNOTATIONS["wyrm_events_replicate"],
144
- aliases: [],
145
- handler: async (args, ctx) => {
146
- const { db } = ctx;
147
- const a = args || {};
148
- const requireArgs = (fields) => {
149
- const missing = fields.filter(f => !a[f] && a[f] !== 0 && a[f] !== false);
150
- if (missing.length > 0) {
151
- return { content: [{ type: "text", text: `Missing required arguments: ${missing.join(', ')}` }], isError: true };
152
- }
153
- return null;
154
- };
155
- const argErr = requireArgs(['projectPath', 'peerUrl']);
156
- if (argErr)
157
- return argErr;
158
- if (!db.liveMemoryEnabled()) {
159
- return { content: [{ type: "text", text: JSON.stringify({ disabled: true, hint: "Set WYRM_LIVE_MEMORY=1 to enable replication." }) }] };
160
- }
161
- const { projectPath, peerUrl, token, remoteProject } = args;
162
- const project = db.getProject(projectPath);
163
- if (!project)
164
- return { content: [{ type: "text", text: "Project not found" }] };
165
- const peer = {
166
- baseUrl: String(peerUrl).replace(/\/+$/, ''),
167
- token,
168
- localProjectId: project.id,
169
- remoteProject: remoteProject || project.name,
170
- };
171
- const r = await replicateOnce(db, peer, fetch);
172
- const summary = `󱅝 Replicated ${project.name} ↔ ${peer.baseUrl}: pulled ${r.pulled}, pushed ${r.pushed}, dup ${r.duplicates}, echo ${r.echoes}` +
173
- (r.errors.length ? `\n⚠️ ${r.errors.join('; ')}` : '');
174
- return { content: [{ type: "text", text: summary }] };
175
- },
176
- },
177
- {
178
- name: "wyrm_replication",
179
- description: "Use to sync memory between machines and watch the live event mesh - action=start|stop|status|tick (daemon + peers; tokens via tokenEnv), conflicts (did the last sync leave conflicts to resolve?), resolve, publish, since, subscribe (watch a project's live activity feed for changes from other agents), replicate (one-shot: sync my memory over to another machine or peer). Back up the memory database off this machine, encrypted: wyrm cloud backup (CLI).",
180
- // v7 F3 (T022, spec FR-4): wyrm_replication absorbs sync_conflicts/
181
- // sync_resolve (action=conflicts|resolve) and the events quartet
182
- // (action=publish|since|subscribe|replicate — the Live-Memory event
183
- // mesh IS the replication domain); resolveShimCall translates each
184
- // onto the original dispatcher case. Existing actions unchanged.
185
- inputSchema: {
186
- type: "object",
187
- properties: {
188
- // v7 F3 (T026): property prose compressed to fund the hot-path
189
- // outputSchemas under the 8K default-surface pin (the T022/T025
190
- // schema-chars trade; BM25 ranks name+description only).
191
- action: { type: "string", enum: ["start", "stop", "status", "tick", "peer_add", "peer_remove", "peer_list", "conflicts", "resolve", "publish", "since", "subscribe", "replicate"] },
192
- interval_minutes: { type: "number", description: "start (default 1)" },
193
- baseUrl: { type: "string", description: "peer_add/peer_remove" },
194
- projectPath: { type: "string" },
195
- remoteProject: { type: "string", description: "peer_add/replicate" },
196
- tokenEnv: { type: "string", description: "peer_add: env var NAME with the peer token" },
197
- limit: { type: "number", description: "conflicts/since" },
198
- conflict_id: { type: "number", description: "resolve" },
199
- mode: { type: "string", description: "resolve: kept_local|kept_remote|merged" },
200
- // T027 budget trim: merged_payload/isShared/window pass through
201
- // undeclared (T022 lean-union rule).
202
- kind: { type: "string", description: "publish" },
203
- payload: { type: "object", description: "publish" },
204
- cursor: { type: "number", description: "since" },
205
- peerUrl: { type: "string", description: "replicate" },
206
- token: { type: "string", description: "replicate: bearer" },
207
- },
208
- required: ["action"],
209
- },
210
- annotations: TOOL_ANNOTATIONS["wyrm_replication"],
211
- aliases: [],
212
- handler: async (args, ctx) => {
213
- const { db, replicationManager } = ctx;
214
- const a = args || {};
215
- const requireArgs = (fields) => {
216
- const missing = fields.filter(f => !a[f] && a[f] !== 0 && a[f] !== false);
217
- if (missing.length > 0) {
218
- return { content: [{ type: "text", text: `Missing required arguments: ${missing.join(', ')}` }], isError: true };
219
- }
220
- return null;
221
- };
222
- const argErr = requireArgs(['action']);
223
- if (argErr)
224
- return argErr;
225
- const { action, interval_minutes, baseUrl, projectPath, remoteProject, tokenEnv } = args;
226
- switch (action) {
227
- case 'start': {
228
- if (!db.liveMemoryEnabled())
229
- return { content: [{ type: "text", text: "Live Memory is off (WYRM_LIVE_MEMORY=0) — daemon not started." }] };
230
- const res = replicationManager.start({ interval_minutes });
231
- return { content: [{ type: "text", text: res.ok ? `󱅝 Replication daemon started (pid ${res.pid})` : `Not started: ${res.reason}` }] };
232
- }
233
- case 'stop': {
234
- const res = replicationManager.stop();
235
- return { content: [{ type: "text", text: res.ok ? "󱅝 Replication daemon stopping" : `Not stopped: ${res.reason}` }] };
236
- }
237
- case 'status': {
238
- const st = replicationManager.status();
239
- const peers = listPeers(db);
240
- return { content: [{ type: "text", text: JSON.stringify({ running: st.running, pid: st.pid, peers }) }] };
241
- }
242
- case 'tick': {
243
- const daemon = new ReplicationDaemon(db);
244
- const results = await daemon.tick(fetch);
245
- return { content: [{ type: "text", text: JSON.stringify({ peers: results.length, results }) }] };
246
- }
247
- case 'peer_add': {
248
- if (!baseUrl || !projectPath)
249
- return { content: [{ type: "text", text: "peer_add requires baseUrl and projectPath" }] };
250
- const project = db.getProject(projectPath);
251
- if (!project)
252
- return { content: [{ type: "text", text: "Project not found" }] };
253
- try {
254
- const peers = addPeer(db, { baseUrl, projectPath, remoteProject, tokenEnv });
255
- return { content: [{ type: "text", text: `󱅝 Peer added. Registry now has ${peers.length} peer(s).` }] };
256
- }
257
- catch (e) {
258
- return { content: [{ type: "text", text: `Peer rejected: ${e instanceof Error ? e.message : String(e)}` }] };
259
- }
260
- }
261
- case 'peer_remove': {
262
- if (!baseUrl || !projectPath)
263
- return { content: [{ type: "text", text: "peer_remove requires baseUrl and projectPath" }] };
264
- const peers = removePeer(db, baseUrl, projectPath);
265
- return { content: [{ type: "text", text: `󱅝 Peer removed. Registry now has ${peers.length} peer(s).` }] };
266
- }
267
- case 'peer_list': {
268
- return { content: [{ type: "text", text: JSON.stringify({ peers: listPeers(db) }) }] };
269
- }
270
- default:
271
- return { content: [{ type: "text", text: `Unknown action: ${action}` }] };
272
- }
273
- },
274
- },
275
- {
276
- name: "wyrm_embed",
277
- description: "Make Wyrm FIRST-PRIORITY, always-loaded memory across Claude Code and other CLIs — so it isn't ignored and is consulted proactively, not just when called. Prepends a managed 'Wyrm is your memory — consult it FIRST' directive to the TOP of each client's always-loaded instruction file (~/.claude/CLAUDE.md globally; project CLAUDE.md/AGENTS.md, and with allClients also .cursorrules/.windsurfrules/.github/copilot-instructions.md). install also installs the proactive SessionStart/predictive hooks. Idempotent + fully reversible. action=install|status|remove.",
278
- inputSchema: {
279
- type: "object",
280
- properties: {
281
- action: { type: "string", enum: ["install", "status", "remove"], description: "Operation to perform" },
282
- projectPath: { type: "string", description: "Also embed into this project's instruction files (CLAUDE.md + AGENTS.md)" },
283
- allClients: { type: "boolean", description: "With projectPath: also write Cursor/.cursorrules, Windsurf/.windsurfrules, and GitHub Copilot instructions (default false)" },
284
- },
285
- required: ["action"],
286
- },
287
- annotations: TOOL_ANNOTATIONS["wyrm_embed"],
288
- aliases: [],
289
- handler: async (args, ctx) => {
290
- const { memory } = ctx;
291
- const a = args || {};
292
- const requireArgs = (fields) => {
293
- const missing = fields.filter(f => !a[f] && a[f] !== 0 && a[f] !== false);
294
- if (missing.length > 0) {
295
- return { content: [{ type: "text", text: `Missing required arguments: ${missing.join(', ')}` }], isError: true };
296
- }
297
- return null;
298
- };
299
- const argErr = requireArgs(['action']);
300
- if (argErr)
301
- return argErr;
302
- const { action, projectPath, allClients } = args;
303
- const opts = { projectDir: projectPath, allClients };
304
- const fmt = (rows) => rows.map(r => ` ${String(r.result ?? r.status).padEnd(9)} [${r.scope}] ${r.file}`).join('\n');
305
- if (action === 'status') {
306
- return { content: [{ type: "text", text: `󱅝 Wyrm priority embedding status:\n${fmt(statusAll(opts))}` }] };
307
- }
308
- if (action === 'remove') {
309
- return { content: [{ type: "text", text: `󱅝 Removed Wyrm priority embedding:\n${fmt(removeAll(opts))}` }] };
310
- }
311
- // install — all three: priority blocks + proactive hooks + persistent buddy statusline
312
- const embedded = embedAll(opts);
313
- let hookNote = '';
314
- try {
315
- const hooks = installClaudeCodeHooks();
316
- hookNote = hooks ? `\n\n✅ Proactive hooks installed (${hooks.message ?? 'SessionStart rehydrate + capture + trace'}).` : '\n\n(Claude Code not detected — skipped hook install.)';
317
- }
318
- catch (e) {
319
- hookNote = `\n\n(Hook install skipped: ${e instanceof Error ? e.message : String(e)})`;
320
- }
321
- let slNote = '';
322
- try {
323
- const sl = installClaudeStatusline();
324
- if (sl)
325
- slNote = `\n✅ Buddy statusline: ${sl.message}`;
326
- }
327
- catch (e) {
328
- slNote = `\n(Statusline skipped: ${e instanceof Error ? e.message : String(e)})`;
329
- }
330
- return { content: [{ type: "text", text: `󱅝 Wyrm is now FIRST-PRIORITY memory:\n${fmt(embedded)}${hookNote}${slNote}\n\n` +
331
- `Wyrm will now be read at the top of every session, primed proactively, and shown in the TUI at all times — not waiting to be called.` }] };
332
- },
333
- },
334
- ];
335
- //# sourceMappingURL=events.js.map
1
+ import{TOOL_ANNOTATIONS as f}from"../tool-annotations.js";import{installClaudeCodeHooks as j,installClaudeStatusline as x}from"../autoconfig.js";import{replicateOnce as w}from"../event-replication.js";import{embedAll as P,removeAll as _,statusAll as E}from"../priority-embed.js";import{ReplicationDaemon as S,addPeer as k,listPeers as b,removePeer as M}from"../replication-daemon.js";const O=[{name:"wyrm_events_subscribe",description:"Use to START consuming a project's Live Memory event stream: returns the current head cursor plus a recent chronological window of events in one read-only call. Nothing persists server-side \u2014 poll wyrm_events_since with the returned cursor for new events. Returns disabled:true if WYRM_LIVE_MEMORY is off. Keywords: events, live memory, event stream, cursor, tail events, watch project, replication feed.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project path"},window:{type:"number",description:"How many recent events to return (1-200, default 20)"}},required:["projectPath"]},annotations:f.wyrm_events_subscribe,aliases:[],handler:async(a,y)=>{const{db:t}=y,o=a||{},d=(r=>{const m=r.filter(i=>!o[i]&&o[i]!==0&&o[i]!==!1);return m.length>0?{content:[{type:"text",text:`Missing required arguments: ${m.join(", ")}`}],isError:!0}:null})(["projectPath"]);if(d)return d;const{projectPath:p,window:u}=a;if(!t.liveMemoryEnabled())return{content:[{type:"text",text:JSON.stringify({disabled:!0,hint:"Set WYRM_LIVE_MEMORY=1 to enable the event log."})}]};const l=t.getProject(p);if(!l)return{content:[{type:"text",text:"Project not found"}]};const s=t.subscribeEvents(l.id,u);return{content:[{type:"text",text:JSON.stringify({project:l.name,cursor:s.cursor,count:s.recent.length,events:s.recent})}]}}},{name:"wyrm_events_since",description:"Live Memory: pull events newer than a cursor for a project, in chronological order. Idempotent \u2014 safe to re-poll. Returns the events and the new head cursor to pass next time.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project path"},cursor:{type:"number",description:"Return events with cursor greater than this (default 0 = from start)"},limit:{type:"number",description:"Max events to return (1-1000, default 100)"}},required:["projectPath"]},annotations:f.wyrm_events_since,aliases:[],handler:async(a,y)=>{const{db:t}=y,o=a||{},d=(i=>{const n=i.filter(e=>!o[e]&&o[e]!==0&&o[e]!==!1);return n.length>0?{content:[{type:"text",text:`Missing required arguments: ${n.join(", ")}`}],isError:!0}:null})(["projectPath"]);if(d)return d;const{projectPath:p,cursor:u,limit:l}=a;if(!t.liveMemoryEnabled())return{content:[{type:"text",text:JSON.stringify({disabled:!0,hint:"Set WYRM_LIVE_MEMORY=1 to enable the event log."})}]};const s=t.getProject(p);if(!s)return{content:[{type:"text",text:"Project not found"}]};const r=t.eventsSince(s.id,u||0,l||100),m=r.length?r[r.length-1].cursor:u||0;return{content:[{type:"text",text:JSON.stringify({project:s.name,cursor:m,count:r.length,events:r})}]}}},{name:"wyrm_events_publish",description:"Live Memory: manually publish an event onto a project's stream (e.g. a tool_call or presence marker). Failure-isolated \u2014 never throws. Payload is stored only when isShared is true (reference-only otherwise).",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project path"},kind:{type:"string",enum:["capture","session_update","quest","truth","presence","tool_call"],description:"Event kind"},refTable:{type:"string",description:"Canonical table this event refers to (optional)"},refId:{type:"string",description:"Canonical row id this event refers to (optional)"},actor:{type:"string",description:"Who/what produced the event (optional)"},isShared:{type:"boolean",description:"If true, the payload is denormalized into the event (default false = reference-only)"},payload:{type:"object",description:"Denormalized snapshot, stored only when isShared is true"}},required:["projectPath","kind"]},annotations:f.wyrm_events_publish,aliases:[],handler:async(a,y)=>{const{db:t,presence:o}=y,h=a||{},p=(c=>{const g=c.filter(v=>!h[v]&&h[v]!==0&&h[v]!==!1);return g.length>0?{content:[{type:"text",text:`Missing required arguments: ${g.join(", ")}`}],isError:!0}:null})(["projectPath","kind"]);if(p)return p;const{projectPath:u,kind:l,refTable:s,refId:r,actor:m,isShared:i,payload:n}=a;if(!t.liveMemoryEnabled())return{content:[{type:"text",text:JSON.stringify({disabled:!0,hint:"Set WYRM_LIVE_MEMORY=1 to enable the event log."})}]};const e=t.getProject(u);return e?(t.publishEvent({projectId:e.id,kind:l,refTable:s,refId:r,actor:m,isShared:i,payload:n}),{content:[{type:"text",text:`\u{F115D} Event published to ${e.name} stream (${l})`}]}):{content:[{type:"text",text:"Project not found"}]}}},{name:"wyrm_events_replicate",description:"Live Memory (Phase 3): one-shot cross-device replication with a peer Wyrm node \u2014 pulls the peer's shared events and pushes ours over the peer's HTTP surface. Privacy-gated (only is_shared events leave the box; reference-only rows carry no payload), with automatic dedup + echo-suppression. Watermarks persist, so repeat calls are incremental. Returns pulled/pushed/duplicate counts.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Local project path"},peerUrl:{type:"string",description:"Peer Wyrm HTTP (wyrm serve) base URL, e.g. http://other-host:3333"},token:{type:"string",description:"Bearer token for the peer (optional if the peer runs open / dev mode)"},remoteProject:{type:"string",description:"Project path or name on the peer (defaults to this project's name)"}},required:["projectPath","peerUrl"]},annotations:f.wyrm_events_replicate,aliases:[],handler:async(a,y)=>{const{db:t}=y,o=a||{},d=(e=>{const c=e.filter(g=>!o[g]&&o[g]!==0&&o[g]!==!1);return c.length>0?{content:[{type:"text",text:`Missing required arguments: ${c.join(", ")}`}],isError:!0}:null})(["projectPath","peerUrl"]);if(d)return d;if(!t.liveMemoryEnabled())return{content:[{type:"text",text:JSON.stringify({disabled:!0,hint:"Set WYRM_LIVE_MEMORY=1 to enable replication."})}]};const{projectPath:p,peerUrl:u,token:l,remoteProject:s}=a,r=t.getProject(p);if(!r)return{content:[{type:"text",text:"Project not found"}]};const m={baseUrl:String(u).replace(/\/+$/,""),token:l,localProjectId:r.id,remoteProject:s||r.name},i=await w(t,m,fetch);return{content:[{type:"text",text:`\u{F115D} Replicated ${r.name} \u2194 ${m.baseUrl}: pulled ${i.pulled}, pushed ${i.pushed}, dup ${i.duplicates}, echo ${i.echoes}`+(i.errors.length?`
2
+ \u26A0\uFE0F ${i.errors.join("; ")}`:"")}]}}},{name:"wyrm_replication",description:"Use to sync memory between machines and watch the live event mesh - action=start|stop|status|tick (daemon + peers; tokens via tokenEnv), conflicts (did the last sync leave conflicts to resolve?), resolve, publish, since, subscribe (watch a project's live activity feed for changes from other agents), replicate (one-shot: sync my memory over to another machine or peer). Back up the memory database off this machine, encrypted: wyrm cloud backup (CLI).",inputSchema:{type:"object",properties:{action:{type:"string",enum:["start","stop","status","tick","peer_add","peer_remove","peer_list","conflicts","resolve","publish","since","subscribe","replicate"]},interval_minutes:{type:"number",description:"start (default 1)"},baseUrl:{type:"string",description:"peer_add/peer_remove"},projectPath:{type:"string"},remoteProject:{type:"string",description:"peer_add/replicate"},tokenEnv:{type:"string",description:"peer_add: env var NAME with the peer token"},limit:{type:"number",description:"conflicts/since"},conflict_id:{type:"number",description:"resolve"},mode:{type:"string",description:"resolve: kept_local|kept_remote|merged"},kind:{type:"string",description:"publish"},payload:{type:"object",description:"publish"},cursor:{type:"number",description:"since"},peerUrl:{type:"string",description:"replicate"},token:{type:"string",description:"replicate: bearer"}},required:["action"]},annotations:f.wyrm_replication,aliases:[],handler:async(a,y)=>{const{db:t,replicationManager:o}=y,h=a||{},p=(n=>{const e=n.filter(c=>!h[c]&&h[c]!==0&&h[c]!==!1);return e.length>0?{content:[{type:"text",text:`Missing required arguments: ${e.join(", ")}`}],isError:!0}:null})(["action"]);if(p)return p;const{action:u,interval_minutes:l,baseUrl:s,projectPath:r,remoteProject:m,tokenEnv:i}=a;switch(u){case"start":{if(!t.liveMemoryEnabled())return{content:[{type:"text",text:"Live Memory is off (WYRM_LIVE_MEMORY=0) \u2014 daemon not started."}]};const n=o.start({interval_minutes:l});return{content:[{type:"text",text:n.ok?`\u{F115D} Replication daemon started (pid ${n.pid})`:`Not started: ${n.reason}`}]}}case"stop":{const n=o.stop();return{content:[{type:"text",text:n.ok?"\u{F115D} Replication daemon stopping":`Not stopped: ${n.reason}`}]}}case"status":{const n=o.status(),e=b(t);return{content:[{type:"text",text:JSON.stringify({running:n.running,pid:n.pid,peers:e})}]}}case"tick":{const e=await new S(t).tick(fetch);return{content:[{type:"text",text:JSON.stringify({peers:e.length,results:e})}]}}case"peer_add":{if(!s||!r)return{content:[{type:"text",text:"peer_add requires baseUrl and projectPath"}]};if(!t.getProject(r))return{content:[{type:"text",text:"Project not found"}]};try{return{content:[{type:"text",text:`\u{F115D} Peer added. Registry now has ${k(t,{baseUrl:s,projectPath:r,remoteProject:m,tokenEnv:i}).length} peer(s).`}]}}catch(e){return{content:[{type:"text",text:`Peer rejected: ${e instanceof Error?e.message:String(e)}`}]}}}case"peer_remove":return!s||!r?{content:[{type:"text",text:"peer_remove requires baseUrl and projectPath"}]}:{content:[{type:"text",text:`\u{F115D} Peer removed. Registry now has ${M(t,s,r).length} peer(s).`}]};case"peer_list":return{content:[{type:"text",text:JSON.stringify({peers:b(t)})}]};default:return{content:[{type:"text",text:`Unknown action: ${u}`}]}}}},{name:"wyrm_embed",description:"Make Wyrm FIRST-PRIORITY, always-loaded memory across Claude Code and other CLIs \u2014 so it isn't ignored and is consulted proactively, not just when called. Prepends a managed 'Wyrm is your memory \u2014 consult it FIRST' directive to the TOP of each client's always-loaded instruction file (~/.claude/CLAUDE.md globally; project CLAUDE.md/AGENTS.md, and with allClients also .cursorrules/.windsurfrules/.github/copilot-instructions.md). install also installs the proactive SessionStart/predictive hooks. Idempotent + fully reversible. action=install|status|remove.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["install","status","remove"],description:"Operation to perform"},projectPath:{type:"string",description:"Also embed into this project's instruction files (CLAUDE.md + AGENTS.md)"},allClients:{type:"boolean",description:"With projectPath: also write Cursor/.cursorrules, Windsurf/.windsurfrules, and GitHub Copilot instructions (default false)"}},required:["action"]},annotations:f.wyrm_embed,aliases:[],handler:async(a,y)=>{const{memory:t}=y,o=a||{},d=(e=>{const c=e.filter(g=>!o[g]&&o[g]!==0&&o[g]!==!1);return c.length>0?{content:[{type:"text",text:`Missing required arguments: ${c.join(", ")}`}],isError:!0}:null})(["action"]);if(d)return d;const{action:p,projectPath:u,allClients:l}=a,s={projectDir:u,allClients:l},r=e=>e.map(c=>` ${String(c.result??c.status).padEnd(9)} [${c.scope}] ${c.file}`).join(`
3
+ `);if(p==="status")return{content:[{type:"text",text:`\u{F115D} Wyrm priority embedding status:
4
+ ${r(E(s))}`}]};if(p==="remove")return{content:[{type:"text",text:`\u{F115D} Removed Wyrm priority embedding:
5
+ ${r(_(s))}`}]};const m=P(s);let i="";try{const e=j();i=e?`
6
+
7
+ \u2705 Proactive hooks installed (${e.message??"SessionStart rehydrate + capture + trace"}).`:`
8
+
9
+ (Claude Code not detected \u2014 skipped hook install.)`}catch(e){i=`
10
+
11
+ (Hook install skipped: ${e instanceof Error?e.message:String(e)})`}let n="";try{const e=x();e&&(n=`
12
+ \u2705 Buddy statusline: ${e.message}`)}catch(e){n=`
13
+ (Statusline skipped: ${e instanceof Error?e.message:String(e)})`}return{content:[{type:"text",text:`\u{F115D} Wyrm is now FIRST-PRIORITY memory:
14
+ ${r(m)}${i}${n}
15
+
16
+ Wyrm will now be read at the top of every session, primed proactively, and shown in the TUI at all times \u2014 not waiting to be called.`}]}}}];export{O as eventsToolSpecs};
@@ -17,7 +17,7 @@
17
17
  * prose was advisory (the T022/T025 schema-chars-fund-the-surface trade).
18
18
  *
19
19
  * @copyright 2026 Ghost Protocol (Pvt) Ltd.
20
- * @license AGPL-3.0-or-laterdual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
20
+ * @license Proprietary(c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
21
21
  */
22
22
  import type { HotPathContext, JsonSchema, ToolSpec } from './types.js';
23
23
  /** Narrow slice this domain declares (T026). */