wyrm-mcp 7.0.2 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/LICENSE +1 -1
  2. package/NOTICE +29 -0
  3. package/dist/agent-daemon.d.ts +1 -1
  4. package/dist/agent-daemon.js +1 -1
  5. package/dist/agent-loop.d.ts +1 -1
  6. package/dist/agent-loop.js +1 -1
  7. package/dist/analytics.d.ts +1 -1
  8. package/dist/analytics.js +1 -1
  9. package/dist/audit.d.ts +1 -1
  10. package/dist/audit.js +1 -1
  11. package/dist/auto-capture.js +1 -1
  12. package/dist/auto-orchestrator.d.ts +1 -1
  13. package/dist/auto-orchestrator.js +1 -1
  14. package/dist/autoconfig.d.ts +1 -1
  15. package/dist/autoconfig.js +1 -1
  16. package/dist/buddy-runner.d.ts +24 -0
  17. package/dist/buddy-runner.d.ts.map +1 -0
  18. package/dist/buddy-runner.js +109 -0
  19. package/dist/buddy-runner.js.map +1 -0
  20. package/dist/buddy.d.ts +1 -1
  21. package/dist/buddy.js +1 -1
  22. package/dist/capabilities.d.ts +1 -1
  23. package/dist/capabilities.js +1 -1
  24. package/dist/capture.d.ts +1 -1
  25. package/dist/capture.js +1 -1
  26. package/dist/causality.d.ts +1 -1
  27. package/dist/causality.js +1 -1
  28. package/dist/cli.d.ts +1 -1
  29. package/dist/cli.js +1 -1
  30. package/dist/cloud/cli.d.ts.map +1 -1
  31. package/dist/cloud/cli.js +66 -5
  32. package/dist/cloud/cli.js.map +1 -1
  33. package/dist/cloud/client.d.ts +19 -0
  34. package/dist/cloud/client.d.ts.map +1 -1
  35. package/dist/cloud/client.js +26 -8
  36. package/dist/cloud/client.js.map +1 -1
  37. package/dist/cloud/machine-id.d.ts +80 -0
  38. package/dist/cloud/machine-id.d.ts.map +1 -0
  39. package/dist/cloud/machine-id.js +113 -0
  40. package/dist/cloud/machine-id.js.map +1 -0
  41. package/dist/cloud/sync-engine.d.ts +26 -0
  42. package/dist/cloud/sync-engine.d.ts.map +1 -1
  43. package/dist/cloud/sync-engine.js +83 -5
  44. package/dist/cloud/sync-engine.js.map +1 -1
  45. package/dist/cloud-backup.d.ts +1 -1
  46. package/dist/cloud-backup.js +1 -1
  47. package/dist/cloud-profile.d.ts +103 -0
  48. package/dist/cloud-profile.d.ts.map +1 -0
  49. package/dist/cloud-profile.js +138 -0
  50. package/dist/cloud-profile.js.map +1 -0
  51. package/dist/cloud-sync-entrypoint.d.ts +1 -1
  52. package/dist/cloud-sync-entrypoint.js +1 -1
  53. package/dist/cloud-sync.d.ts +1 -1
  54. package/dist/cloud-sync.js +1 -1
  55. package/dist/constellation.d.ts +1 -1
  56. package/dist/constellation.js +1 -1
  57. package/dist/context-build-budgeted.d.ts +43 -0
  58. package/dist/context-build-budgeted.d.ts.map +1 -0
  59. package/dist/context-build-budgeted.js +144 -0
  60. package/dist/context-build-budgeted.js.map +1 -0
  61. package/dist/context-ranking.d.ts +1 -1
  62. package/dist/context-ranking.js +1 -1
  63. package/dist/crypto.d.ts +1 -1
  64. package/dist/crypto.js +1 -1
  65. package/dist/database.d.ts +1 -1
  66. package/dist/database.js +1 -1
  67. package/dist/design.d.ts +1 -1
  68. package/dist/design.js +1 -1
  69. package/dist/event-replication.d.ts +1 -1
  70. package/dist/event-replication.js +1 -1
  71. package/dist/events-sse.d.ts +1 -1
  72. package/dist/events-sse.js +1 -1
  73. package/dist/events.js +1 -1
  74. package/dist/failure-patterns.d.ts +1 -1
  75. package/dist/failure-patterns.js +1 -1
  76. package/dist/federation.d.ts +1 -1
  77. package/dist/federation.js +1 -1
  78. package/dist/goals.d.ts +1 -1
  79. package/dist/goals.js +1 -1
  80. package/dist/handlers/agent.d.ts +7 -0
  81. package/dist/handlers/agent.d.ts.map +1 -0
  82. package/dist/handlers/agent.js +165 -0
  83. package/dist/handlers/agent.js.map +1 -0
  84. package/dist/handlers/aliases.d.ts +2 -2
  85. package/dist/handlers/aliases.d.ts.map +1 -1
  86. package/dist/handlers/aliases.js +3 -2
  87. package/dist/handlers/aliases.js.map +1 -1
  88. package/dist/handlers/audit.d.ts +7 -0
  89. package/dist/handlers/audit.d.ts.map +1 -0
  90. package/dist/handlers/audit.js +87 -0
  91. package/dist/handlers/audit.js.map +1 -0
  92. package/dist/handlers/boundary.d.ts +4 -0
  93. package/dist/handlers/boundary.d.ts.map +1 -1
  94. package/dist/handlers/boundary.js +18 -0
  95. package/dist/handlers/boundary.js.map +1 -1
  96. package/dist/handlers/capture.d.ts.map +1 -1
  97. package/dist/handlers/capture.js +146 -2
  98. package/dist/handlers/capture.js.map +1 -1
  99. package/dist/handlers/causality.d.ts +7 -0
  100. package/dist/handlers/causality.d.ts.map +1 -0
  101. package/dist/handlers/causality.js +114 -0
  102. package/dist/handlers/causality.js.map +1 -0
  103. package/dist/handlers/cloud.d.ts +7 -0
  104. package/dist/handlers/cloud.d.ts.map +1 -0
  105. package/dist/handlers/cloud.js +382 -0
  106. package/dist/handlers/cloud.js.map +1 -0
  107. package/dist/handlers/companion.d.ts +7 -0
  108. package/dist/handlers/companion.d.ts.map +1 -0
  109. package/dist/handlers/companion.js +459 -0
  110. package/dist/handlers/companion.js.map +1 -0
  111. package/dist/handlers/datalake.d.ts +7 -0
  112. package/dist/handlers/datalake.d.ts.map +1 -0
  113. package/dist/handlers/datalake.js +187 -0
  114. package/dist/handlers/datalake.js.map +1 -0
  115. package/dist/handlers/dispatch-context.d.ts +153 -0
  116. package/dist/handlers/dispatch-context.d.ts.map +1 -0
  117. package/dist/handlers/dispatch-context.js +22 -0
  118. package/dist/handlers/dispatch-context.js.map +1 -0
  119. package/dist/handlers/entity.d.ts +7 -0
  120. package/dist/handlers/entity.d.ts.map +1 -0
  121. package/dist/handlers/entity.js +256 -0
  122. package/dist/handlers/entity.js.map +1 -0
  123. package/dist/handlers/events.d.ts +7 -0
  124. package/dist/handlers/events.d.ts.map +1 -0
  125. package/dist/handlers/events.js +335 -0
  126. package/dist/handlers/events.js.map +1 -0
  127. package/dist/handlers/intelligence.d.ts +7 -0
  128. package/dist/handlers/intelligence.d.ts.map +1 -0
  129. package/dist/handlers/intelligence.js +674 -0
  130. package/dist/handlers/intelligence.js.map +1 -0
  131. package/dist/handlers/invoicing.d.ts +7 -0
  132. package/dist/handlers/invoicing.d.ts.map +1 -0
  133. package/dist/handlers/invoicing.js +70 -0
  134. package/dist/handlers/invoicing.js.map +1 -0
  135. package/dist/handlers/mcpclient.d.ts +7 -0
  136. package/dist/handlers/mcpclient.d.ts.map +1 -0
  137. package/dist/handlers/mcpclient.js +137 -0
  138. package/dist/handlers/mcpclient.js.map +1 -0
  139. package/dist/handlers/orchestration.d.ts +7 -0
  140. package/dist/handlers/orchestration.d.ts.map +1 -0
  141. package/dist/handlers/orchestration.js +125 -0
  142. package/dist/handlers/orchestration.js.map +1 -0
  143. package/dist/handlers/presence.d.ts +7 -0
  144. package/dist/handlers/presence.d.ts.map +1 -0
  145. package/dist/handlers/presence.js +99 -0
  146. package/dist/handlers/presence.js.map +1 -0
  147. package/dist/handlers/project.d.ts +7 -0
  148. package/dist/handlers/project.d.ts.map +1 -0
  149. package/dist/handlers/project.js +182 -0
  150. package/dist/handlers/project.js.map +1 -0
  151. package/dist/handlers/prompts.d.ts.map +1 -1
  152. package/dist/handlers/prompts.js +3 -2
  153. package/dist/handlers/prompts.js.map +1 -1
  154. package/dist/handlers/recall.d.ts +3 -3
  155. package/dist/handlers/recall.d.ts.map +1 -1
  156. package/dist/handlers/recall.js +33 -3
  157. package/dist/handlers/recall.js.map +1 -1
  158. package/dist/handlers/registry.d.ts.map +1 -1
  159. package/dist/handlers/registry.js +45 -0
  160. package/dist/handlers/registry.js.map +1 -1
  161. package/dist/handlers/resources.d.ts +131 -0
  162. package/dist/handlers/resources.d.ts.map +1 -0
  163. package/dist/handlers/resources.js +288 -0
  164. package/dist/handlers/resources.js.map +1 -0
  165. package/dist/handlers/review.d.ts.map +1 -1
  166. package/dist/handlers/review.js +8 -0
  167. package/dist/handlers/review.js.map +1 -1
  168. package/dist/handlers/session.d.ts.map +1 -1
  169. package/dist/handlers/session.js +3 -2
  170. package/dist/handlers/session.js.map +1 -1
  171. package/dist/handlers/share.d.ts +7 -0
  172. package/dist/handlers/share.d.ts.map +1 -0
  173. package/dist/handlers/share.js +184 -0
  174. package/dist/handlers/share.js.map +1 -0
  175. package/dist/handlers/shims.d.ts.map +1 -1
  176. package/dist/handlers/shims.js +1 -0
  177. package/dist/handlers/shims.js.map +1 -1
  178. package/dist/handlers/skill.d.ts +7 -0
  179. package/dist/handlers/skill.d.ts.map +1 -0
  180. package/dist/handlers/skill.js +449 -0
  181. package/dist/handlers/skill.js.map +1 -0
  182. package/dist/handlers/survivors.d.ts +19 -0
  183. package/dist/handlers/survivors.d.ts.map +1 -1
  184. package/dist/handlers/survivors.js +19 -0
  185. package/dist/handlers/survivors.js.map +1 -1
  186. package/dist/handlers/symbols.d.ts +7 -0
  187. package/dist/handlers/symbols.d.ts.map +1 -0
  188. package/dist/handlers/symbols.js +109 -0
  189. package/dist/handlers/symbols.js.map +1 -0
  190. package/dist/handlers/syncops.d.ts +7 -0
  191. package/dist/handlers/syncops.d.ts.map +1 -0
  192. package/dist/handlers/syncops.js +310 -0
  193. package/dist/handlers/syncops.js.map +1 -0
  194. package/dist/handlers/types.d.ts +39 -4
  195. package/dist/handlers/types.d.ts.map +1 -1
  196. package/dist/handlers/types.js +7 -1
  197. package/dist/handlers/types.js.map +1 -1
  198. package/dist/harvest.d.ts +1 -1
  199. package/dist/harvest.js +1 -1
  200. package/dist/hours.d.ts +1 -1
  201. package/dist/hours.js +1 -1
  202. package/dist/http-auth.d.ts +1 -1
  203. package/dist/http-auth.js +1 -1
  204. package/dist/icons.d.ts +1 -1
  205. package/dist/icons.js +1 -1
  206. package/dist/index.d.ts +1 -1
  207. package/dist/index.d.ts.map +1 -1
  208. package/dist/index.js +217 -4344
  209. package/dist/index.js.map +1 -1
  210. package/dist/indexer.d.ts +1 -1
  211. package/dist/indexer.js +1 -1
  212. package/dist/intelligence.d.ts +1 -1
  213. package/dist/intelligence.js +1 -1
  214. package/dist/internal-dispatch.d.ts +35 -0
  215. package/dist/internal-dispatch.d.ts.map +1 -0
  216. package/dist/internal-dispatch.js +217 -0
  217. package/dist/internal-dispatch.js.map +1 -0
  218. package/dist/keyset.d.ts +78 -0
  219. package/dist/keyset.d.ts.map +1 -0
  220. package/dist/keyset.js +110 -0
  221. package/dist/keyset.js.map +1 -0
  222. package/dist/knowledge-graph.d.ts +1 -1
  223. package/dist/knowledge-graph.js +1 -1
  224. package/dist/license.d.ts +1 -1
  225. package/dist/license.js +1 -1
  226. package/dist/logger.d.ts +1 -1
  227. package/dist/logger.js +1 -1
  228. package/dist/mcp-client.d.ts +1 -1
  229. package/dist/mcp-client.js +1 -1
  230. package/dist/memory-artifacts.d.ts +20 -1
  231. package/dist/memory-artifacts.d.ts.map +1 -1
  232. package/dist/memory-artifacts.js +48 -1
  233. package/dist/memory-artifacts.js.map +1 -1
  234. package/dist/migrate-prompt.d.ts +1 -1
  235. package/dist/migrate-prompt.js +1 -1
  236. package/dist/migrations.d.ts +1 -1
  237. package/dist/migrations.d.ts.map +1 -1
  238. package/dist/migrations.js +33 -1
  239. package/dist/migrations.js.map +1 -1
  240. package/dist/presence.d.ts +1 -1
  241. package/dist/presence.js +1 -1
  242. package/dist/priority-embed.d.ts +1 -1
  243. package/dist/priority-embed.js +1 -1
  244. package/dist/providers/embedding-provider.d.ts +1 -1
  245. package/dist/providers/embedding-provider.js +1 -1
  246. package/dist/rehydration.d.ts +1 -1
  247. package/dist/rehydration.js +1 -1
  248. package/dist/render-target.d.ts +302 -0
  249. package/dist/render-target.d.ts.map +1 -0
  250. package/dist/render-target.js +535 -0
  251. package/dist/render-target.js.map +1 -0
  252. package/dist/repl-guard.d.ts +1 -1
  253. package/dist/repl-guard.js +1 -1
  254. package/dist/replication-daemon-entrypoint.d.ts +1 -1
  255. package/dist/replication-daemon-entrypoint.js +1 -1
  256. package/dist/replication-daemon.d.ts +1 -1
  257. package/dist/replication-daemon.js +1 -1
  258. package/dist/resilience.d.ts +1 -1
  259. package/dist/resilience.js +1 -1
  260. package/dist/reverse-bridge.d.ts +253 -0
  261. package/dist/reverse-bridge.d.ts.map +1 -0
  262. package/dist/reverse-bridge.js +363 -0
  263. package/dist/reverse-bridge.js.map +1 -0
  264. package/dist/security.d.ts +1 -1
  265. package/dist/security.js +1 -1
  266. package/dist/session-seen.d.ts +1 -1
  267. package/dist/session-seen.js +1 -1
  268. package/dist/setup.d.ts +1 -1
  269. package/dist/setup.js +1 -1
  270. package/dist/skill-author.d.ts +1 -1
  271. package/dist/skill-author.js +1 -1
  272. package/dist/spec-kit.d.ts +1 -1
  273. package/dist/spec-kit.js +1 -1
  274. package/dist/statusline.d.ts +1 -1
  275. package/dist/statusline.js +1 -1
  276. package/dist/sub-agent.d.ts +1 -1
  277. package/dist/sub-agent.js +1 -1
  278. package/dist/symbols.d.ts +1 -1
  279. package/dist/symbols.js +1 -1
  280. package/dist/sync.d.ts +1 -1
  281. package/dist/sync.js +1 -1
  282. package/dist/tasks-dispatch.d.ts +48 -0
  283. package/dist/tasks-dispatch.d.ts.map +1 -0
  284. package/dist/tasks-dispatch.js +84 -0
  285. package/dist/tasks-dispatch.js.map +1 -0
  286. package/dist/tasks.d.ts +214 -0
  287. package/dist/tasks.d.ts.map +1 -0
  288. package/dist/tasks.js +282 -0
  289. package/dist/tasks.js.map +1 -0
  290. package/dist/token-budget.d.ts +1 -1
  291. package/dist/token-budget.js +1 -1
  292. package/dist/tool-analytics.d.ts +1 -1
  293. package/dist/tool-analytics.js +1 -1
  294. package/dist/tool-annotations.d.ts.map +1 -1
  295. package/dist/tool-annotations.js +3 -0
  296. package/dist/tool-annotations.js.map +1 -1
  297. package/dist/tool-manifest-v2.json +84 -0
  298. package/dist/tool-manifest.json +1 -1
  299. package/dist/tool-profiles.d.ts +1 -1
  300. package/dist/tool-profiles.js +1 -1
  301. package/dist/trace-harvest.d.ts +78 -0
  302. package/dist/trace-harvest.d.ts.map +1 -0
  303. package/dist/trace-harvest.js +244 -0
  304. package/dist/trace-harvest.js.map +1 -0
  305. package/dist/types.d.ts +1 -1
  306. package/dist/types.js +1 -1
  307. package/dist/ui-dashboard.d.ts +1 -1
  308. package/dist/ui-dashboard.js +1 -1
  309. package/dist/vault.js +1 -1
  310. package/dist/vectors.d.ts +1 -1
  311. package/dist/vectors.js +1 -1
  312. package/dist/version-check.d.ts +1 -1
  313. package/dist/version-check.js +1 -1
  314. package/dist/visibility.d.ts +1 -1
  315. package/dist/visibility.js +1 -1
  316. package/dist/wyrm-cli.d.ts +1 -1
  317. package/dist/wyrm-cli.js +171 -1
  318. package/dist/wyrm-cli.js.map +1 -1
  319. package/dist/wyrm-loop.d.ts +1 -1
  320. package/dist/wyrm-loop.js +1 -1
  321. package/dist/wyrm-manifest.json +219 -1
  322. package/dist/wyrm-statusline-daemon.d.ts +1 -1
  323. package/dist/wyrm-statusline-daemon.js +1 -1
  324. package/dist/wyrm-statusline.d.ts +1 -1
  325. package/dist/wyrm-statusline.js +1 -1
  326. package/dist/wyrm-ui.d.ts +1 -1
  327. package/dist/wyrm-ui.js +1 -1
  328. package/package.json +3 -2
package/LICENSE CHANGED
@@ -661,7 +661,7 @@ For more information on this, and how to apply and follow the GNU AGPL, see
661
661
  <https://www.gnu.org/licenses/>.
662
662
 
663
663
  ---
664
- Copyright (c) 2024-2026 Ghost Protocol (Pvt) Ltd
664
+ Copyright (c) 2026 Ghost Protocol (Pvt) Ltd
665
665
  https://ghosts.lk
666
666
 
667
667
  For commercial licensing inquiries: ghosts.lk@proton.me
package/NOTICE ADDED
@@ -0,0 +1,29 @@
1
+ Wyrm — Persistent Memory for AI Agents
2
+ Copyright © 2026 Ghost Protocol (Pvt) Ltd. All rights reserved.
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.
7
+
8
+ LICENSE — dual-licensed:
9
+
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.
15
+
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
20
+
21
+ Trademarks: "Wyrm", "Ghost Protocol", and the silver-dragon mark are trademarks
22
+ of Ghost Protocol (Pvt) Ltd. Use of the AGPL license does not grant any
23
+ trademark rights.
24
+
25
+ Unauthorized copying, reverse engineering to circumvent the license, or
26
+ distribution of derivative works outside the terms above is prohibited and may
27
+ infringe the copyright and other rights of Ghost Protocol (Pvt) Ltd.
28
+
29
+ Ghost Protocol (Pvt) Ltd · Colombo, Sri Lanka · ghosts.lk · ghosts.lk@proton.me
@@ -15,7 +15,7 @@
15
15
  * alive, `start()` refuses (no fork-bomb). `restart()` is provided as
16
16
  * an explicit operation.
17
17
  *
18
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
18
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
19
19
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
20
20
  */
21
21
  import type Database from 'better-sqlite3';
@@ -15,7 +15,7 @@
15
15
  * alive, `start()` refuses (no fork-bomb). `restart()` is provided as
16
16
  * an explicit operation.
17
17
  *
18
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
18
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
19
19
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
20
20
  */
21
21
  import { spawn } from 'child_process';
@@ -26,7 +26,7 @@
26
26
  * {"thought":"...","action":"done","summary":"..."} or
27
27
  * {"thought":"...","action":"block","reason":"..."}
28
28
  *
29
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
29
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
30
30
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
31
31
  */
32
32
  import type Database from 'better-sqlite3';
@@ -26,7 +26,7 @@
26
26
  * {"thought":"...","action":"done","summary":"..."} or
27
27
  * {"thought":"...","action":"block","reason":"..."}
28
28
  *
29
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
29
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
30
30
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
31
31
  */
32
32
  import { Goals } from './goals.js';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Wyrm Analytics — Persistent Usage Tracking & Cost Monitoring
3
3
  *
4
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
4
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
5
5
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
6
6
  * @module analytics
7
7
  * @version 3.2.0
package/dist/analytics.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Wyrm Analytics — Persistent Usage Tracking & Cost Monitoring
3
3
  *
4
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
4
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
5
5
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
6
6
  * @module analytics
7
7
  * @version 3.2.0
package/dist/audit.d.ts CHANGED
@@ -59,7 +59,7 @@
59
59
  * unsigned, byte-identical to 6.x behavior. `WYRM_AUDIT_SIGNING_KEY` holds a
60
60
  * PEM-encoded (pkcs8) Ed25519 private key, or a path to one.
61
61
  *
62
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
62
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
63
63
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
64
64
  */
65
65
  import type Database from 'better-sqlite3';
package/dist/audit.js CHANGED
@@ -59,7 +59,7 @@
59
59
  * unsigned, byte-identical to 6.x behavior. `WYRM_AUDIT_SIGNING_KEY` holds a
60
60
  * PEM-encoded (pkcs8) Ed25519 private key, or a path to one.
61
61
  *
62
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
62
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
63
63
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
64
64
  */
65
65
  import { createHash, createPrivateKey, createPublicKey, sign as edSign, verify as edVerify, } from 'crypto';
@@ -12,7 +12,7 @@
12
12
  * stored with needs_review=1 so the operator vets them (wyrm_review) — nothing
13
13
  * auto-trusted, matching Wyrm's distillation-queue discipline.
14
14
  *
15
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
15
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
16
16
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
17
17
  */
18
18
  import { classifyCapture } from './capture.js';
@@ -10,7 +10,7 @@
10
10
  * - Task Decomposition: Large features via subtasks + parallel execution
11
11
  * - Verification: High-risk code changes via multi-angle review
12
12
  *
13
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
13
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
14
14
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
15
15
  */
16
16
  export type TaskType = 'decision' | 'generation' | 'research' | 'verification' | 'decomposition';
@@ -10,7 +10,7 @@
10
10
  * - Task Decomposition: Large features via subtasks + parallel execution
11
11
  * - Verification: High-risk code changes via multi-angle review
12
12
  *
13
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
13
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
14
14
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
15
15
  */
16
16
  /**
@@ -5,7 +5,7 @@
5
5
  * Cursor, Windsurf, Zed, etc.) and configures Wyrm's MCP server in each.
6
6
  * Handles provider switching seamlessly — change your AI, Wyrm follows.
7
7
  *
8
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
8
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
9
9
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
10
10
  * @module autoconfig
11
11
  * @version 3.0.0
@@ -5,7 +5,7 @@
5
5
  * Cursor, Windsurf, Zed, etc.) and configures Wyrm's MCP server in each.
6
6
  * Handles provider switching seamlessly — change your AI, Wyrm follows.
7
7
  *
8
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
8
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
9
9
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
10
10
  * @module autoconfig
11
11
  * @version 3.0.0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Companion-buddy runner (v7 F4 T036 - extracted from the index.ts monolith).
3
+ * The buddy fold's ONE implementation: wyrm_buddy calls it directly and the
4
+ * well-known `buddy` tool calls it when any companion param is present. Lifted
5
+ * VERBATIM behind a factory that captures the same singletons it always closed
6
+ * over (db / mcpClient / our version string for cycle-prevention).
7
+ *
8
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
9
+ * @license AGPL-3.0-or-later
10
+ */
11
+ import type { WyrmDB } from "./database.js";
12
+ import type { OutboundMcpClient } from "./mcp-client.js";
13
+ export interface BuddyRunnerDeps {
14
+ db: WyrmDB;
15
+ mcpClient: OutboundMcpClient;
16
+ version: string;
17
+ }
18
+ export declare function makeRunCompanionBuddy(deps: BuddyRunnerDeps): (args: Record<string, unknown>) => Promise<{
19
+ content: Array<{
20
+ type: string;
21
+ text: string;
22
+ }>;
23
+ }>;
24
+ //# sourceMappingURL=buddy-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buddy-runner.d.ts","sourceRoot":"","sources":["../src/buddy-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,eAAe,UA0DpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAoC3H"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Companion-buddy runner (v7 F4 T036 - extracted from the index.ts monolith).
3
+ * The buddy fold's ONE implementation: wyrm_buddy calls it directly and the
4
+ * well-known `buddy` tool calls it when any companion param is present. Lifted
5
+ * VERBATIM behind a factory that captures the same singletons it always closed
6
+ * over (db / mcpClient / our version string for cycle-prevention).
7
+ *
8
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
9
+ * @license AGPL-3.0-or-later
10
+ */
11
+ import { gatherBuddyInputs, buildBuddyOutput } from "./buddy.js";
12
+ export function makeRunCompanionBuddy(deps) {
13
+ const { db, mcpClient, version } = deps;
14
+ /**
15
+ * Spec 015 — buddy federation.
16
+ *
17
+ * For each registered + enabled outbound MCP server, list its tools and
18
+ * call any whose name matches /^(buddy_|.+_buddy$)/ (case-insensitive).
19
+ * Collects up to 3 replies; budget-frugal, best-effort.
20
+ */
21
+ async function collectExternalBuddyReplies(projectId) {
22
+ const replies = [];
23
+ const servers = mcpClient.list().filter((r) => r.enabled);
24
+ // Identify ourselves for cycle prevention per Buddy Protocol v1.0 §4.
25
+ const fromBuddy = `wyrm@${version}`;
26
+ // Try to give peers context — name of the project the local buddy is on.
27
+ let projectHint;
28
+ try {
29
+ const row = db.getDatabase().prepare('SELECT name FROM projects WHERE id = ?').get(projectId);
30
+ projectHint = row?.name;
31
+ }
32
+ catch { /* fine */ }
33
+ for (const srv of servers) {
34
+ if (replies.length >= 3)
35
+ break;
36
+ let tools = null;
37
+ try {
38
+ tools = await mcpClient.listTools(srv.server_name);
39
+ }
40
+ catch {
41
+ continue;
42
+ }
43
+ if (!tools)
44
+ continue;
45
+ // Prefer well-known `buddy` (Buddy Protocol v1.0); fall back to `*_buddy` / `buddy_*` patterns.
46
+ const wellKnown = tools.find((t) => t.name.toLowerCase() === 'buddy');
47
+ const buddyTools = wellKnown
48
+ ? [wellKnown]
49
+ : tools.filter((t) => /^(buddy_|.*_buddy)$/i.test(t.name));
50
+ for (const t of buddyTools) {
51
+ if (replies.length >= 3)
52
+ break;
53
+ try {
54
+ const r = await mcpClient.call(srv.server_name, t.name, {
55
+ from_buddy: fromBuddy,
56
+ project_hint: projectHint,
57
+ size: 'compact',
58
+ });
59
+ const text = typeof r.result === 'string' ? r.result : JSON.stringify(r.result).slice(0, 800);
60
+ if (text)
61
+ replies.push({ server: srv.server_name, tool: t.name, reply: text });
62
+ }
63
+ catch { /* skip on error */ }
64
+ }
65
+ }
66
+ return replies;
67
+ }
68
+ /**
69
+ * v7 F3 (T021) — the companion buddy code path, extracted VERBATIM from the
70
+ * wyrm_buddy switch case so the buddy fold shares ONE implementation:
71
+ * `wyrm_buddy` calls it directly, and the well-known `buddy` tool calls it
72
+ * whenever any companion param (persona/persona_name/mood/federate/
73
+ * project_path — handlers/alias-adapters.ts) is present. Never a duplicate;
74
+ * the alias spine routes wyrm_buddy → buddy with an argument adapter and the
75
+ * golden replay CI proves both entries byte-equivalent.
76
+ */
77
+ async function runCompanionBuddy(args) {
78
+ const { project_path: bdPath, mood: bdMood, persona: bdPersona, persona_name: bdPersonaName, federate: bdFederate, size: bdSize } = args;
79
+ // Resolve project: explicit path > cwd > nothing
80
+ const cwd = bdPath ?? process.cwd();
81
+ const project = db.getProject(cwd);
82
+ if (!project) {
83
+ return {
84
+ content: [{
85
+ type: 'text',
86
+ text: `󱅝 I don't see *${cwd}* in my hoard yet — scan it first with \`wyrm_scan_projects\`, then come back.`,
87
+ }],
88
+ };
89
+ }
90
+ const persona = bdPersona ?? process.env.WYRM_BUDDY_DEFAULT_PERSONA ?? 'wyrm';
91
+ const inputs = gatherBuddyInputs(db.getDatabase(), project.id);
92
+ // Federate with other "*_buddy" tools on registered external MCPs.
93
+ // Skipped in quiet mode (token-frugal) and on explicit federate:false.
94
+ if (bdFederate !== false && bdMood !== 'quiet') {
95
+ try {
96
+ const externals = await collectExternalBuddyReplies(project.id);
97
+ if (externals.length > 0)
98
+ inputs.externalBuddies = externals;
99
+ }
100
+ catch {
101
+ // Federation is best-effort. Don't fail the local buddy on a remote hiccup.
102
+ }
103
+ }
104
+ const out = buildBuddyOutput(inputs, { mood: bdMood, persona, personaName: bdPersonaName, size: bdSize });
105
+ return { content: [{ type: 'text', text: out.markdown }] };
106
+ }
107
+ return runCompanionBuddy;
108
+ }
109
+ //# sourceMappingURL=buddy-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buddy-runner.js","sourceRoot":"","sources":["../src/buddy-runner.ts"],"names":[],"mappings":"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"}
package/dist/buddy.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * `buddy_*` is queried via `wyrm_call_external` and its output is
11
11
  * folded into the response.
12
12
  *
13
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
13
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
14
14
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
15
15
  */
16
16
  import type Database from 'better-sqlite3';
package/dist/buddy.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * `buddy_*` is queried via `wyrm_call_external` and its output is
11
11
  * folded into the response.
12
12
  *
13
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
13
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
14
14
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
15
15
  */
16
16
  import { ICON } from './icons.js';
@@ -10,7 +10,7 @@
10
10
  * Also used as the body of the `wyrm_capabilities` MCP tool, the
11
11
  * `wyrm_inject_prompt` block, and the postinstall pitch.
12
12
  *
13
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
13
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
14
14
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
15
15
  */
16
16
  import type Database from 'better-sqlite3';
@@ -10,7 +10,7 @@
10
10
  * Also used as the body of the `wyrm_capabilities` MCP tool, the
11
11
  * `wyrm_inject_prompt` block, and the postinstall pitch.
12
12
  *
13
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
13
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
14
14
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
15
15
  */
16
16
  import { homedir } from 'os';
package/dist/capture.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Wyrm Capture Helpers — Classification logic for unified auto-capture.
3
3
  *
4
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
4
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
5
5
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
6
6
  */
7
7
  export type CaptureType = 'quest' | 'truth' | 'memory';
package/dist/capture.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Wyrm Capture Helpers — Classification logic for unified auto-capture.
3
3
  *
4
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
4
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
5
5
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
6
6
  */
7
7
  /**
@@ -9,7 +9,7 @@
9
9
  * ground truth flips to stale or gets superseded, the invalidation
10
10
  * cascade walks the edge graph and flags downstream decisions.
11
11
  *
12
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
12
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
13
13
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
14
14
  */
15
15
  import type Database from 'better-sqlite3';
package/dist/causality.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * ground truth flips to stale or gets superseded, the invalidation
10
10
  * cascade walks the edge graph and flags downstream decisions.
11
11
  *
12
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
12
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
13
13
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
14
14
  */
15
15
  import { emitEvent } from './events.js';
package/dist/cli.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Wyrm CLI - Beautiful command-line interface
3
3
  *
4
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
4
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
5
5
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
6
6
  * @module cli
7
7
  * @version 3.0.0
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Wyrm CLI - Beautiful command-line interface
3
3
  *
4
- * @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
4
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
5
5
  * @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
6
6
  * @module cli
7
7
  * @version 3.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cloud/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA8CH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsD5D"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cloud/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA+CH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6D5D"}
package/dist/cloud/cli.js CHANGED
@@ -19,7 +19,8 @@ import { resolve } from 'node:path';
19
19
  import { createInterface } from 'node:readline';
20
20
  import { CloudClient, CloudError, DEFAULT_BASE, SESSION_FILE, loadSession, saveSession, clearSession } from './client.js';
21
21
  import { getMasterKey, keyExists, keyFilePath } from './crypto.js';
22
- import { runSync } from './sync-engine.js';
22
+ import { computeMachineFp, classifySession } from './machine-id.js';
23
+ import { runSync, CopiedSessionError } from './sync-engine.js';
23
24
  import { initializeLicense, hasFeature, getTier } from '../license.js';
24
25
  /**
25
26
  * Gate the data-movement cloud commands behind a Pro+ license.
@@ -69,6 +70,7 @@ export async function cmdCloud(args) {
69
70
  case 'login': return await cmdLogin(rest);
70
71
  case 'logout': return await cmdLogout();
71
72
  case 'status': return await cmdStatus();
73
+ case 'doctor': return cmdDoctor();
72
74
  case 'devices': return await cmdDevices(rest);
73
75
  case 'sync': return await cmdSync(rest);
74
76
  case 'export': return await cmdExport(rest);
@@ -83,6 +85,12 @@ export async function cmdCloud(args) {
83
85
  catch (err) {
84
86
  // Translate common errors to friendly CLI output. Falls through
85
87
  // to a generic message for unexpected exceptions.
88
+ if (err instanceof CopiedSessionError) {
89
+ // The detailed loud guidance was already written to stderr by the
90
+ // sync engine. Just exit non-zero without burying it under a
91
+ // generic message.
92
+ process.exit(1);
93
+ }
86
94
  if (err instanceof CloudError) {
87
95
  if (err.status === 401) {
88
96
  console.error('✘ Not authenticated. Run `wyrm cloud login`.');
@@ -132,10 +140,14 @@ SUBCOMMANDS:
132
140
  status Show account, tier, storage, and registered devices.
133
141
  devices List devices on this account.
134
142
  devices revoke <id> Revoke a specific device.
135
- sync [--dry-run] [--all]
143
+ sync [--dry-run] [--all] [--force]
136
144
  Push local cross-project rows + pull peer deltas.
137
145
  --all syncs every semantic table (ignores
138
146
  visibility opt-in). Skips telemetry / FTS / logs.
147
+ --force proceeds past a copied-session warning
148
+ (or set WYRM_ALLOW_COPIED_SESSION=1).
149
+ doctor Diagnose this device's cloud identity (device_id,
150
+ machine fingerprint match, copied-session check).
139
151
  export [path] Download full account dump (deltas stay encrypted).
140
152
  delete --confirm Permanently delete the cloud account (irreversible).
141
153
  recovery show Print master key as a 24-word BIP39 phrase.
@@ -228,10 +240,12 @@ async function cmdLogin(_args) {
228
240
  try {
229
241
  const reg = await authed.registerDevice(deviceName);
230
242
  deviceId = reg.device.id;
231
- // Update session file with device info
243
+ // Update session file with device info + this machine's fingerprint.
244
+ // The fp binds the session to THIS machine so a later copy of
245
+ // cloud.json to a second box is detected at sync (failure #40).
232
246
  const s = loadSession();
233
247
  if (s)
234
- saveSession({ ...s, email, device_id: deviceId, device_name: deviceName });
248
+ saveSession({ ...s, email, device_id: deviceId, device_name: deviceName, machine_fp: computeMachineFp() });
235
249
  }
236
250
  catch (err) {
237
251
  console.error(`\n⚠ Logged in but could not register device: ${err instanceof Error ? err.message : err}`);
@@ -303,7 +317,9 @@ async function cmdStatus() {
303
317
  console.log(` Providers:${me.identities.map((i) => ' ' + i.provider).join(',')}`);
304
318
  console.log('');
305
319
  console.log(` This machine: ${s.device_name ?? '(not registered)'}`);
320
+ console.log(` Device ID: ${s.device_id ? s.device_id.slice(0, 8) + '…' : '(none)'}`);
306
321
  console.log(` Session age: ${Math.round((Date.now() - s.created_at) / (24 * 60 * 60 * 1000))} day(s)`);
322
+ printIdentityHealth(s);
307
323
  console.log('');
308
324
  // Encryption-key health. The whole operator-owns-data guarantee rests
309
325
  // on this file existing — if it's gone, no pulled blob can be decrypted.
@@ -328,6 +344,50 @@ async function cmdStatus() {
328
344
  throw err;
329
345
  }
330
346
  }
347
+ /**
348
+ * Print the device-identity health line(s) for a session: whether the
349
+ * stored machine fingerprint matches THIS machine. A mismatch is the
350
+ * copied-session / device_id-collision symptom (failure #40). Shared by
351
+ * `status` and `doctor`.
352
+ */
353
+ function printIdentityHealth(s) {
354
+ const verdict = classifySession(s.machine_fp);
355
+ if (verdict.state === 'match') {
356
+ console.log(' Identity: ✓ machine fingerprint matches (not a copied session)');
357
+ }
358
+ else if (verdict.state === 'adopt') {
359
+ console.log(' Identity: — no fingerprint yet (pre-7.0.3 session; adopted on next sync)');
360
+ }
361
+ else {
362
+ console.log(' Identity: ⚠ FINGERPRINT MISMATCH — this session looks COPIED');
363
+ console.log(` stored ${verdict.stored.slice(0, 12)}… vs this machine ${verdict.current.slice(0, 12)}…`);
364
+ console.log(' device_id collision → cross-device pull returns 0 silently.');
365
+ console.log(' Fix: rm ~/.wyrm/cloud.json ~/.wyrm/cloud-cursor.json (KEEP cloud.key),');
366
+ console.log(' then `wyrm cloud login`. (Or `wyrm cloud sync --force` if intended.)');
367
+ }
368
+ }
369
+ // ── doctor ────────────────────────────────────────────────────────────────────
370
+ function cmdDoctor() {
371
+ const s = loadSession();
372
+ console.log('');
373
+ console.log('󱅝 Wyrm Cloud — device identity doctor');
374
+ console.log('');
375
+ if (!s) {
376
+ console.log(' Not logged in. Run `wyrm cloud login`.');
377
+ console.log('');
378
+ return;
379
+ }
380
+ console.log(` Account: ${s.email ?? s.account_id.slice(0, 8) + '…'}`);
381
+ console.log(` Device ID: ${s.device_id ? s.device_id.slice(0, 8) + '…' : '(none — re-run `wyrm cloud login`)'}`);
382
+ console.log(` Server: ${s.base}`);
383
+ console.log(` Stored fp: ${s.machine_fp ? s.machine_fp.slice(0, 12) + '…' : '(none — pre-7.0.3 session)'}`);
384
+ console.log(` This box fp: ${computeMachineFp().slice(0, 12)}…`);
385
+ printIdentityHealth(s);
386
+ console.log('');
387
+ console.log(' Only ~/.wyrm/cloud.key is meant to be shared across your machines.');
388
+ console.log(' cloud.json + cloud-cursor.json + machine-id are per-device.');
389
+ console.log('');
390
+ }
331
391
  // ── devices ─────────────────────────────────────────────────────────────────
332
392
  async function cmdDevices(args) {
333
393
  const action = args[0];
@@ -363,6 +423,7 @@ async function cmdSync(args) {
363
423
  requireCloudLicense();
364
424
  const dryRun = args.includes('--dry-run');
365
425
  const all = args.includes('--all');
426
+ const force = args.includes('--force');
366
427
  if (!keyExists()) {
367
428
  console.error('⚠ Encryption key not found at', keyFilePath());
368
429
  console.error(' A new key will be generated, but it will NOT decrypt deltas');
@@ -376,7 +437,7 @@ async function cmdSync(args) {
376
437
  console.log(' Skipped: per-device logs, FTS shadows, sync internals.');
377
438
  console.log('');
378
439
  }
379
- const result = await runSync({ dryRun, all });
440
+ const result = await runSync({ dryRun, all, force });
380
441
  console.log('');
381
442
  console.log('󱅝 Sync complete');
382
443
  console.log('');