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
package/NOTICE CHANGED
@@ -1,40 +1,21 @@
1
1
  Wyrm — Persistent Memory for AI Agents
2
2
  Copyright © 2026 Ghost Protocol (Pvt) Ltd. All rights reserved.
3
3
 
4
- This software ("Wyrm", published as the npm package "wyrm-mcp") and its source
5
- code, documentation, and associated materials are the original work and
6
- intellectual property of Ghost Protocol (Pvt) Ltd, Colombo, Sri Lanka.
4
+ Wyrm (published as the npm package "wyrm-mcp") and its source code, documentation,
5
+ and associated materials are the proprietary and confidential property of Ghost
6
+ Protocol (Pvt) Ltd, Colombo, Sri Lanka.
7
7
 
8
- LICENSE — dual-licensed:
8
+ LICENSE: Proprietary see the LICENSE file. No open-source license is granted for
9
+ this or any version published after 2026-06-14. Versions of "wyrm-mcp" at 7.2.1 and
10
+ earlier were released under AGPL-3.0-or-later, which continues to apply to those
11
+ specific versions only. Use of the official builds and the Wyrm hosted services
12
+ requires a Ghost Protocol account and is governed by the Wyrm Terms of Service.
9
13
 
10
- 1. Open source: GNU Affero General Public License, version 3 or later
11
- (AGPL-3.0-or-later). See the LICENSE file for the full terms. Note in
12
- particular AGPL section 13: if you run a modified version of this software
13
- to provide a network service, you must offer the complete corresponding
14
- source code of your modified version to the users of that service.
14
+ Trademarks: "Wyrm", "Ghost Protocol", and the silver-dragon mark are trademarks of
15
+ Ghost Protocol (Pvt) Ltd.
15
16
 
16
- 2. Commercial: a separate, non-copyleft commercial license is available for
17
- embedding Wyrm in a closed-source product, or operating it as a managed
18
- service without AGPL's source-sharing obligations. Contact:
19
- ghosts.lk@proton.me
17
+ Unauthorized copying, modification, reverse engineering, or distribution is
18
+ prohibited and may infringe the copyright, trademark, and other rights of Ghost
19
+ Protocol (Pvt) Ltd.
20
20
 
21
- Official distribution account required: the official Wyrm builds published by
22
- Ghost Protocol (the "wyrm-mcp" package on npm and signed releases) and the Wyrm
23
- hosted services (wyrm.ghosts.lk, mcp.wyrm.ghosts.lk, account.ghosts.lk) require a
24
- free account and are subject to the Wyrm Terms of Service. The official build
25
- validates a short-lived, account-bound license locally ("wyrm login"); your
26
- memory stays on your machine. This account requirement governs the official
27
- distribution and services — it does not restrict your AGPL rights in the source,
28
- which remains free to build and run without an account. Circumventing, disabling,
29
- or removing the activation requirement and redistributing the result under the
30
- "Wyrm" name or marks is not permitted.
31
-
32
- Trademarks: "Wyrm", "Ghost Protocol", and the silver-dragon mark are trademarks
33
- of Ghost Protocol (Pvt) Ltd. Use of the AGPL license does not grant any
34
- trademark rights.
35
-
36
- Unauthorized copying, reverse engineering to circumvent the license, or
37
- distribution of derivative works outside the terms above is prohibited and may
38
- infringe the copyright and other rights of Ghost Protocol (Pvt) Ltd.
39
-
40
- Ghost Protocol (Pvt) Ltd · Colombo, Sri Lanka · ghosts.lk · ghosts.lk@proton.me
21
+ Ghost Protocol (Pvt) Ltd · Colombo, Sri Lanka · ghosts.lk · ryan@ghosts.lk
@@ -1,21 +1,20 @@
1
1
  /**
2
2
  * Activation gate for account-required builds.
3
3
  *
4
- * OFF by default in the AGPL source — self-hosters and the test suite are
5
- * unaffected, and the open-standard (WMP) ecosystem keeps working without an
6
- * account. The OFFICIAL distribution bakes `WYRM_REQUIRE_ACTIVATION=1`, so the
7
- * free tier needs a (free) account: `wyrm login` fetches a short-lived,
8
- * account-bound signed license that's validated locally by license.ts. A
9
- * suspended account can't refresh, so access lapses at expiry. Memory is local
10
- * either way — login only ties usage to a revocable identity.
4
+ * OFF by default in source — the test suite and local dev builds are unaffected.
5
+ * The OFFICIAL distribution bakes `WYRM_REQUIRE_ACTIVATION=1`, so the free tier
6
+ * needs a (free) account: `wyrm login` fetches a short-lived, account-bound signed
7
+ * license that's validated locally by license.ts. A suspended account can't
8
+ * refresh, so access lapses at expiry. Memory is local either way — login only
9
+ * ties usage to a revocable identity. (Wyrm is proprietary; see LICENSE.)
11
10
  *
12
11
  * @copyright 2026 Ghost Protocol (Pvt) Ltd.
13
- * @license AGPL-3.0-or-laterdual-licensed; commercial terms: ghosts.lk@proton.me.
12
+ * @license Proprietary(c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
14
13
  */
15
14
  /**
16
15
  * Whether the account-required gate is enabled on this build. ON when this is the
17
16
  * official published artifact (OFFICIAL_BUILD baked true at release), OR when the
18
- * operator opts in via WYRM_REQUIRE_ACTIVATION. OFF in AGPL source + tests.
17
+ * operator opts in via WYRM_REQUIRE_ACTIVATION. OFF in source + tests.
19
18
  */
20
19
  export declare const REQUIRE_ACTIVATION: boolean;
21
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../src/activation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SACyD,CAAC;AAczF;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAG7C;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,IAAI;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,CAWxG"}
1
+ {"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../src/activation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SACyD,CAAC;AAczF;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAG7C;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,IAAI;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,CAWxG"}
@@ -1,60 +1 @@
1
- /**
2
- * Activation gate for account-required builds.
3
- *
4
- * OFF by default in the AGPL source — self-hosters and the test suite are
5
- * unaffected, and the open-standard (WMP) ecosystem keeps working without an
6
- * account. The OFFICIAL distribution bakes `WYRM_REQUIRE_ACTIVATION=1`, so the
7
- * free tier needs a (free) account: `wyrm login` fetches a short-lived,
8
- * account-bound signed license that's validated locally by license.ts. A
9
- * suspended account can't refresh, so access lapses at expiry. Memory is local
10
- * either way — login only ties usage to a revocable identity.
11
- *
12
- * @copyright 2026 Ghost Protocol (Pvt) Ltd.
13
- * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me.
14
- */
15
- import { getLicenseInfo, selfTestVerifier } from './license.js';
16
- import { OFFICIAL_BUILD } from './build-flags.js';
17
- /**
18
- * Whether the account-required gate is enabled on this build. ON when this is the
19
- * official published artifact (OFFICIAL_BUILD baked true at release), OR when the
20
- * operator opts in via WYRM_REQUIRE_ACTIVATION. OFF in AGPL source + tests.
21
- */
22
- export const REQUIRE_ACTIVATION = OFFICIAL_BUILD || /^(1|true|yes|on)$/i.test(process.env.WYRM_REQUIRE_ACTIVATION ?? '');
23
- /**
24
- * Tamper-evidence: on the official build, verify at load that the license verifier
25
- * still rejects a forged signature. If it doesn't, someone stubbed the verifier to
26
- * bypass the gate — so we keep the gate CLOSED regardless of what getLicenseInfo()
27
- * now claims. A determined forker can remove this too (it's open source) — a
28
- * deterrent, not a guarantee.
29
- */
30
- const TAMPERED = OFFICIAL_BUILD ? !selfTestVerifier().ok : false;
31
- if (TAMPERED) {
32
- try {
33
- console.error('Wyrm: integrity self-test FAILED — license verifier tampered; activation gate locked.');
34
- }
35
- catch { /* noop */ }
36
- }
37
- /**
38
- * True when tool execution is permitted. Always true unless the build requires
39
- * activation AND no valid (free or paid) account-bound license is loaded.
40
- * Re-checked live so a mid-session `wyrm login` takes effect without a restart.
41
- */
42
- export function activationSatisfied() {
43
- if (TAMPERED)
44
- return false; // verifier subverted → never satisfy the gate
45
- return !REQUIRE_ACTIVATION || getLicenseInfo().valid;
46
- }
47
- /** The MCP error result returned for any tool call while activation is unmet. */
48
- export function activationGateResult() {
49
- return {
50
- content: [{
51
- type: 'text',
52
- text: '🔒 Wyrm requires a free account on this build.\n\n'
53
- + 'Run `wyrm login` in your terminal to sign in and activate (free). '
54
- + 'Your memory stays local — login just ties usage to an account so it can be managed.\n\n'
55
- + 'Already logged in? Your activation may have expired — run `wyrm login` again to refresh.',
56
- }],
57
- isError: true,
58
- };
59
- }
60
- //# sourceMappingURL=activation.js.map
1
+ import{getLicenseInfo as r,selfTestVerifier as n}from"./license.js";import{OFFICIAL_BUILD as e}from"./build-flags.js";const i=e||/^(1|true|yes|on)$/i.test(process.env.WYRM_REQUIRE_ACTIVATION??""),t=e?!n().ok:!1;if(t)try{console.error("Wyrm: integrity self-test FAILED \u2014 license verifier tampered; activation gate locked.")}catch{}function s(){return t?!1:!i||r().valid}function c(){return{content:[{type:"text",text:"\u{1F512} Wyrm requires a free account on this build.\n\nRun `wyrm login` in your terminal to sign in and activate (free). Your memory stays local \u2014 login just ties usage to an account so it can be managed.\n\nAlready logged in? Your activation may have expired \u2014 run `wyrm login` again to refresh."}],isError:!0}}export{i as REQUIRE_ACTIVATION,c as activationGateResult,s as activationSatisfied};
@@ -1 +1 @@
1
- {"version":3,"file":"activation.js","sourceRoot":"","sources":["../src/activation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,cAAc,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;AAEzF;;;;;;GAMG;AACH,MAAM,QAAQ,GAAY,cAAc,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1E,IAAI,QAAQ,EAAE,CAAC;IACb,IAAI,CAAC;QAAC,OAAO,CAAC,KAAK,CAAC,uFAAuF,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;AACtI,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IACjC,IAAI,QAAQ;QAAE,OAAO,KAAK,CAAC,CAAC,8CAA8C;IAC1E,OAAO,CAAC,kBAAkB,IAAI,cAAc,EAAE,CAAC,KAAK,CAAC;AACvD,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,OAAO,EAAE,CAAC;gBACR,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,oDAAoD;sBACtD,oEAAoE;sBACpE,yFAAyF;sBACzF,0FAA0F;aAC/F,CAAC;QACF,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"activation.js","sourceRoot":"","sources":["../src/activation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,cAAc,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;AAEzF;;;;;;GAMG;AACH,MAAM,QAAQ,GAAY,cAAc,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1E,IAAI,QAAQ,EAAE,CAAC;IACb,IAAI,CAAC;QAAC,OAAO,CAAC,KAAK,CAAC,uFAAuF,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;AACtI,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IACjC,IAAI,QAAQ;QAAE,OAAO,KAAK,CAAC,CAAC,8CAA8C;IAC1E,OAAO,CAAC,kBAAkB,IAAI,cAAc,EAAE,CAAC,KAAK,CAAC;AACvD,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,OAAO,EAAE,CAAC;gBACR,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,oDAAoD;sBACtD,oEAAoE;sBACpE,yFAAyF;sBACzF,0FAA0F;aAC/F,CAAC;QACF,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
@@ -16,7 +16,7 @@
16
16
  * an explicit operation.
17
17
  *
18
18
  * @copyright 2026 Ghost Protocol (Pvt) Ltd.
19
- * @license AGPL-3.0-or-laterdual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
19
+ * @license Proprietary(c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
20
20
  */
21
21
  import type Database from 'better-sqlite3';
22
22
  export interface DaemonStatus {
@@ -1,283 +1,6 @@
1
- /**
2
- * Agent daemon process manager.
3
- *
4
- * Lets an AI client (Claude / Codex / Cursor / etc.) bootstrap, monitor,
5
- * and tear down the `wyrm-loop` autonomous scheduler without the
6
- * operator running shell commands. The MCP server can spawn the daemon
7
- * as a detached background process, write a PID + log file under
8
- * `~/.wyrm/`, and check liveness on demand.
9
- *
10
- * Files (all under `~/.wyrm/`):
11
- * wyrm-loop.pid PID of the running daemon (single-line)
12
- * wyrm-loop.log Stdout/stderr of the daemon (rotated at 1MB)
13
- *
14
- * Single-instance guarantee — if a PID file exists and the process is
15
- * alive, `start()` refuses (no fork-bomb). `restart()` is provided as
16
- * an explicit operation.
17
- *
18
- * @copyright 2026 Ghost Protocol (Pvt) Ltd.
19
- * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
20
- */
21
- import { spawn } from 'child_process';
22
- import { existsSync, readFileSync, writeFileSync, statSync, openSync, closeSync, renameSync, unlinkSync, mkdirSync } from 'fs';
23
- import { homedir } from 'os';
24
- import { join, dirname, resolve } from 'path';
25
- import { fileURLToPath } from 'url';
26
- const WYRM_DIR = join(homedir(), '.wyrm');
27
- const PID_FILE = join(WYRM_DIR, 'wyrm-loop.pid');
28
- const LOG_FILE = join(WYRM_DIR, 'wyrm-loop.log');
29
- const LOG_FILE_OLD = join(WYRM_DIR, 'wyrm-loop.log.1');
30
- const MAX_LOG_BYTES = 1_000_000;
31
- function ensureWyrmDir() {
32
- if (!existsSync(WYRM_DIR))
33
- mkdirSync(WYRM_DIR, { recursive: true });
34
- }
35
- function rotateLogIfLarge() {
36
- try {
37
- if (existsSync(LOG_FILE) && statSync(LOG_FILE).size > MAX_LOG_BYTES) {
38
- if (existsSync(LOG_FILE_OLD))
39
- unlinkSync(LOG_FILE_OLD);
40
- renameSync(LOG_FILE, LOG_FILE_OLD);
41
- }
42
- }
43
- catch { /* best-effort */ }
44
- }
45
- function readPid() {
46
- try {
47
- const raw = readFileSync(PID_FILE, 'utf-8').trim();
48
- const pid = parseInt(raw, 10);
49
- return Number.isFinite(pid) && pid > 0 ? pid : null;
50
- }
51
- catch {
52
- return null;
53
- }
54
- }
55
- function isProcessAlive(pid) {
56
- try {
57
- // signal 0 doesn't kill; just checks existence + permission
58
- process.kill(pid, 0);
59
- return true;
60
- }
61
- catch {
62
- return false;
63
- }
64
- }
65
- /** Find the bundled `wyrm-loop` script path. Resolves relative to this
66
- * module so it works whether installed via npm, run from source, or
67
- * invoked from a global symlink. */
68
- function locateLoopBinary() {
69
- // 1. import.meta.url → packages/mcp-server/dist/agent-daemon.js
70
- try {
71
- const here = fileURLToPath(import.meta.url);
72
- const candidates = [
73
- // installed alongside (dist/wyrm-loop.js)
74
- resolve(dirname(here), 'wyrm-loop.js'),
75
- // source layout
76
- resolve(dirname(here), '..', 'dist', 'wyrm-loop.js'),
77
- ];
78
- for (const p of candidates) {
79
- if (existsSync(p))
80
- return p;
81
- }
82
- }
83
- catch { /* fall through */ }
84
- // 2. Look in PATH for the `wyrm-loop` binary (set up by `npm install -g`)
85
- const pathDirs = (process.env.PATH ?? '').split(':');
86
- for (const dir of pathDirs) {
87
- const cand = join(dir, 'wyrm-loop');
88
- if (existsSync(cand))
89
- return cand;
90
- }
91
- return null;
92
- }
93
- export class AgentDaemon {
94
- db;
95
- constructor(db) {
96
- this.db = db;
97
- }
98
- /** Current daemon status. Always safe to call. */
99
- status() {
100
- const pid = readPid();
101
- const running = pid != null && isProcessAlive(pid);
102
- let started_at;
103
- let uptime_seconds;
104
- try {
105
- if (existsSync(PID_FILE)) {
106
- const st = statSync(PID_FILE);
107
- started_at = st.mtime.toISOString();
108
- uptime_seconds = Math.round((Date.now() - st.mtime.getTime()) / 1000);
109
- }
110
- }
111
- catch { /* best-effort */ }
112
- // Read latest agent_actions row for "last action" summary
113
- let last_action;
114
- try {
115
- const row = this.db.prepare(`
1
+ import{spawn as E}from"child_process";import{existsSync as l,readFileSync as g,writeFileSync as I,statSync as w,openSync as M,closeSync as h,renameSync as v,unlinkSync as f,mkdirSync as O}from"fs";import{homedir as R}from"os";import{join as d,dirname as S,resolve as k}from"path";import{fileURLToPath as b}from"url";const m=d(R(),".wyrm"),i=d(m,"wyrm-loop.pid"),u=d(m,"wyrm-loop.log"),_=d(m,"wyrm-loop.log.1"),D=1e6;function T(){l(m)||O(m,{recursive:!0})}function C(){try{l(u)&&w(u).size>D&&(l(_)&&f(_),v(u,_))}catch{}}function L(){try{const p=g(i,"utf-8").trim(),t=parseInt(p,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}}function y(p){try{return process.kill(p,0),!0}catch{return!1}}function F(){try{const t=b(import.meta.url),r=[k(S(t),"wyrm-loop.js"),k(S(t),"..","dist","wyrm-loop.js")];for(const n of r)if(l(n))return n}catch{}const p=(process.env.PATH??"").split(":");for(const t of p){const r=d(t,"wyrm-loop");if(l(r))return r}return null}class A{db;constructor(t){this.db=t}status(){const t=L(),r=t!=null&&y(t);let n,a;try{if(l(i)){const s=w(i);n=s.mtime.toISOString(),a=Math.round((Date.now()-s.mtime.getTime())/1e3)}}catch{}let e;try{const s=this.db.prepare(`
116
2
  SELECT actor, goal_id, action_kind, summary, result_status, ran_at
117
3
  FROM agent_actions ORDER BY id DESC LIMIT 1
118
- `).get();
119
- if (row)
120
- last_action = {
121
- ran_at: row.ran_at, actor: row.actor, goal_id: row.goal_id,
122
- summary: `${row.action_kind}: ${row.summary}`.slice(0, 200),
123
- result_status: row.result_status,
124
- };
125
- }
126
- catch { /* table may not exist on pre-v5 DBs */ }
127
- let active_goals = 0;
128
- let total_iterations = 0;
129
- try {
130
- active_goals = this.db.prepare(`SELECT COUNT(*) as c FROM goals WHERE status = 'active'`).get().c;
131
- total_iterations = this.db.prepare(`SELECT COALESCE(SUM(iterations_count), 0) as c FROM goals`).get().c;
132
- }
133
- catch { /* pre-v5 DB */ }
134
- return {
135
- running,
136
- pid: running ? pid : null,
137
- pid_file: PID_FILE,
138
- log_file: LOG_FILE,
139
- started_at: running ? started_at : undefined,
140
- uptime_seconds: running ? uptime_seconds : undefined,
141
- last_action,
142
- active_goals,
143
- total_iterations,
144
- };
145
- }
146
- /** Start the daemon. No-op if already running. */
147
- start(opts = {}) {
148
- ensureWyrmDir();
149
- rotateLogIfLarge();
150
- const cur = this.status();
151
- if (cur.running) {
152
- return { ok: true, pid: cur.pid ?? undefined, status: cur };
153
- }
154
- // Clear stale PID file from a crashed prior run
155
- if (existsSync(PID_FILE)) {
156
- try {
157
- unlinkSync(PID_FILE);
158
- }
159
- catch { /* ignore */ }
160
- }
161
- const binary = locateLoopBinary();
162
- if (!binary) {
163
- return { ok: false, error: 'Could not locate wyrm-loop binary. Run `npm install -g wyrm-mcp` or `npm run build` in packages/mcp-server.' };
164
- }
165
- const args = ['--interval', String(opts.interval_seconds ?? 600)];
166
- if (opts.max_steps)
167
- args.push('--max-steps', String(opts.max_steps));
168
- if (opts.project_path)
169
- args.push('--project', opts.project_path);
170
- if (opts.verbose)
171
- args.push('--verbose');
172
- // Open the log file once, share fd with the child
173
- let logFd;
174
- try {
175
- logFd = openSync(LOG_FILE, 'a');
176
- }
177
- catch (err) {
178
- return { ok: false, error: `Could not open log file ${LOG_FILE}: ${err.message}` };
179
- }
180
- let child;
181
- try {
182
- child = spawn('node', [binary, ...args], {
183
- detached: true,
184
- stdio: ['ignore', logFd, logFd],
185
- env: { ...process.env, WYRM_LOOP_LOG: opts.verbose ? '1' : '0' },
186
- });
187
- }
188
- catch (err) {
189
- return { ok: false, error: `spawn failed: ${err.message}` };
190
- }
191
- if (!child.pid) {
192
- try {
193
- closeSync(logFd);
194
- }
195
- catch { /* ignore */ }
196
- return { ok: false, error: 'spawn returned no PID' };
197
- }
198
- try {
199
- writeFileSync(PID_FILE, String(child.pid), 'utf-8');
200
- }
201
- catch (err) {
202
- // Process is up but we can't track it — kill to keep state consistent
203
- try {
204
- process.kill(child.pid, 'SIGTERM');
205
- }
206
- catch { /* ignore */ }
207
- try {
208
- closeSync(logFd);
209
- }
210
- catch { /* ignore */ }
211
- return { ok: false, error: `Could not write PID file: ${err.message}` };
212
- }
213
- // Close the parent's copy of the log fd — the child inherits its own
214
- // dup via stdio. Without this, every successful spawn leaks one fd in
215
- // the parent (the MCP server).
216
- try {
217
- closeSync(logFd);
218
- }
219
- catch { /* ignore */ }
220
- // unref so this process doesn't wait on the child
221
- child.unref();
222
- // Brief settle delay so status() reflects the new state
223
- return { ok: true, pid: child.pid, status: this.status() };
224
- }
225
- /** Stop the daemon. Sends SIGTERM, then SIGKILL after a grace period. */
226
- async stop(opts = {}) {
227
- const pid = readPid();
228
- if (pid == null) {
229
- return { ok: true, was_running: false };
230
- }
231
- if (!isProcessAlive(pid)) {
232
- // Stale PID file
233
- try {
234
- unlinkSync(PID_FILE);
235
- }
236
- catch { /* ignore */ }
237
- return { ok: true, was_running: false, pid };
238
- }
239
- try {
240
- process.kill(pid, 'SIGTERM');
241
- }
242
- catch (err) {
243
- return { ok: false, was_running: true, pid, error: `SIGTERM failed: ${err.message}` };
244
- }
245
- const grace = Math.max(100, Math.min(opts.grace_ms ?? 3000, 30_000));
246
- const start = Date.now();
247
- while (Date.now() - start < grace) {
248
- if (!isProcessAlive(pid))
249
- break;
250
- await new Promise(r => { setTimeout(r, 100); });
251
- }
252
- if (isProcessAlive(pid)) {
253
- try {
254
- process.kill(pid, 'SIGKILL');
255
- }
256
- catch { /* may already be dead */ }
257
- }
258
- try {
259
- unlinkSync(PID_FILE);
260
- }
261
- catch { /* ignore */ }
262
- return { ok: true, was_running: true, pid };
263
- }
264
- /** Stop + Start in sequence. */
265
- async restart(opts = {}) {
266
- await this.stop({ grace_ms: 3000 });
267
- return this.start(opts);
268
- }
269
- /** Read the last N lines of the daemon log. */
270
- recentLog(lines = 40) {
271
- try {
272
- if (!existsSync(LOG_FILE))
273
- return '(log file does not exist)';
274
- const raw = readFileSync(LOG_FILE, 'utf-8');
275
- const all = raw.split('\n');
276
- return all.slice(-Math.max(1, Math.min(lines, 1000))).join('\n');
277
- }
278
- catch (err) {
279
- return `(could not read log: ${err.message})`;
280
- }
281
- }
282
- }
283
- //# sourceMappingURL=agent-daemon.js.map
4
+ `).get();s&&(e={ran_at:s.ran_at,actor:s.actor,goal_id:s.goal_id,summary:`${s.action_kind}: ${s.summary}`.slice(0,200),result_status:s.result_status})}catch{}let o=0,c=0;try{o=this.db.prepare("SELECT COUNT(*) as c FROM goals WHERE status = 'active'").get().c,c=this.db.prepare("SELECT COALESCE(SUM(iterations_count), 0) as c FROM goals").get().c}catch{}return{running:r,pid:r?t:null,pid_file:i,log_file:u,started_at:r?n:void 0,uptime_seconds:r?a:void 0,last_action:e,active_goals:o,total_iterations:c}}start(t={}){T(),C();const r=this.status();if(r.running)return{ok:!0,pid:r.pid??void 0,status:r};if(l(i))try{f(i)}catch{}const n=F();if(!n)return{ok:!1,error:"Could not locate wyrm-loop binary. Run `npm install -g wyrm-mcp` or `npm run build` in packages/mcp-server."};const a=["--interval",String(t.interval_seconds??600)];t.max_steps&&a.push("--max-steps",String(t.max_steps)),t.project_path&&a.push("--project",t.project_path),t.verbose&&a.push("--verbose");let e;try{e=M(u,"a")}catch(c){return{ok:!1,error:`Could not open log file ${u}: ${c.message}`}}let o;try{o=E("node",[n,...a],{detached:!0,stdio:["ignore",e,e],env:{...process.env,WYRM_LOOP_LOG:t.verbose?"1":"0"}})}catch(c){return{ok:!1,error:`spawn failed: ${c.message}`}}if(!o.pid){try{h(e)}catch{}return{ok:!1,error:"spawn returned no PID"}}try{I(i,String(o.pid),"utf-8")}catch(c){try{process.kill(o.pid,"SIGTERM")}catch{}try{h(e)}catch{}return{ok:!1,error:`Could not write PID file: ${c.message}`}}try{h(e)}catch{}return o.unref(),{ok:!0,pid:o.pid,status:this.status()}}async stop(t={}){const r=L();if(r==null)return{ok:!0,was_running:!1};if(!y(r)){try{f(i)}catch{}return{ok:!0,was_running:!1,pid:r}}try{process.kill(r,"SIGTERM")}catch(e){return{ok:!1,was_running:!0,pid:r,error:`SIGTERM failed: ${e.message}`}}const n=Math.max(100,Math.min(t.grace_ms??3e3,3e4)),a=Date.now();for(;Date.now()-a<n&&y(r);)await new Promise(e=>{setTimeout(e,100)});if(y(r))try{process.kill(r,"SIGKILL")}catch{}try{f(i)}catch{}return{ok:!0,was_running:!0,pid:r}}async restart(t={}){return await this.stop({grace_ms:3e3}),this.start(t)}recentLog(t=40){try{return l(u)?g(u,"utf-8").split(`
5
+ `).slice(-Math.max(1,Math.min(t,1e3))).join(`
6
+ `):"(log file does not exist)"}catch(r){return`(could not read log: ${r.message})`}}}export{A as AgentDaemon};
@@ -27,7 +27,7 @@
27
27
  * {"thought":"...","action":"block","reason":"..."}
28
28
  *
29
29
  * @copyright 2026 Ghost Protocol (Pvt) Ltd.
30
- * @license AGPL-3.0-or-laterdual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
30
+ * @license Proprietary(c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
31
31
  */
32
32
  import type Database from 'better-sqlite3';
33
33
  import { OutboundMcpClient } from './mcp-client.js';