claude-code-swarm 0.3.4 → 0.3.5

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 (1377) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +22 -1
  3. package/.claude-plugin/run-agent-inbox-mcp.sh +76 -0
  4. package/.claude-plugin/run-minimem-mcp.sh +98 -0
  5. package/.claude-plugin/run-opentasks-mcp.sh +65 -0
  6. package/CLAUDE.md +196 -36
  7. package/e2e/helpers/cleanup.mjs +17 -3
  8. package/e2e/helpers/map-mock-server.mjs +201 -25
  9. package/e2e/helpers/sidecar.mjs +222 -0
  10. package/e2e/helpers/workspace.mjs +2 -1
  11. package/e2e/tier5-sidecar-inbox.test.mjs +900 -0
  12. package/e2e/tier6-inbox-mcp.test.mjs +173 -0
  13. package/e2e/tier6-live-agent.test.mjs +759 -0
  14. package/e2e/vitest.config.e2e.mjs +1 -1
  15. package/hooks/hooks.json +15 -8
  16. package/package.json +13 -1
  17. package/references/agent-inbox/CLAUDE.md +151 -0
  18. package/references/agent-inbox/README.md +238 -0
  19. package/references/agent-inbox/docs/CLAUDE-CODE-SWARM-PROPOSAL.md +137 -0
  20. package/references/agent-inbox/docs/DESIGN.md +1156 -0
  21. package/references/agent-inbox/hooks/inbox-hook.mjs +119 -0
  22. package/references/agent-inbox/hooks/register-hook.mjs +69 -0
  23. package/references/agent-inbox/package-lock.json +3347 -0
  24. package/references/agent-inbox/package.json +58 -0
  25. package/references/agent-inbox/rules/agent-inbox.md +78 -0
  26. package/references/agent-inbox/src/federation/address.ts +61 -0
  27. package/references/agent-inbox/src/federation/connection-manager.ts +573 -0
  28. package/references/agent-inbox/src/federation/delivery-queue.ts +222 -0
  29. package/references/agent-inbox/src/federation/index.ts +6 -0
  30. package/references/agent-inbox/src/federation/routing-engine.ts +188 -0
  31. package/references/agent-inbox/src/federation/trust.ts +71 -0
  32. package/references/agent-inbox/src/index.ts +390 -0
  33. package/references/agent-inbox/src/ipc/ipc-server.ts +207 -0
  34. package/references/agent-inbox/src/jsonrpc/mail-server.ts +382 -0
  35. package/references/agent-inbox/src/map/map-client.ts +414 -0
  36. package/references/agent-inbox/src/mcp/mcp-server.ts +272 -0
  37. package/references/agent-inbox/src/mesh/delivery-bridge.ts +110 -0
  38. package/references/agent-inbox/src/mesh/mesh-connector.ts +41 -0
  39. package/references/agent-inbox/src/mesh/mesh-transport.ts +157 -0
  40. package/references/agent-inbox/src/mesh/type-mapper.ts +239 -0
  41. package/references/agent-inbox/src/push/notifier.ts +233 -0
  42. package/references/agent-inbox/src/registry/warm-registry.ts +255 -0
  43. package/references/agent-inbox/src/router/message-router.ts +175 -0
  44. package/references/agent-inbox/src/storage/interface.ts +48 -0
  45. package/references/agent-inbox/src/storage/memory.ts +145 -0
  46. package/references/agent-inbox/src/storage/sqlite.ts +671 -0
  47. package/references/agent-inbox/src/traceability/traceability.ts +183 -0
  48. package/references/agent-inbox/src/types.ts +303 -0
  49. package/references/agent-inbox/test/federation/address.test.ts +101 -0
  50. package/references/agent-inbox/test/federation/connection-manager.test.ts +546 -0
  51. package/references/agent-inbox/test/federation/delivery-queue.test.ts +159 -0
  52. package/references/agent-inbox/test/federation/integration.test.ts +857 -0
  53. package/references/agent-inbox/test/federation/routing-engine.test.ts +117 -0
  54. package/references/agent-inbox/test/federation/sdk-integration.test.ts +744 -0
  55. package/references/agent-inbox/test/federation/trust.test.ts +89 -0
  56. package/references/agent-inbox/test/ipc-jsonrpc.test.ts +113 -0
  57. package/references/agent-inbox/test/ipc-server.test.ts +197 -0
  58. package/references/agent-inbox/test/mail-server.test.ts +285 -0
  59. package/references/agent-inbox/test/map-client.test.ts +408 -0
  60. package/references/agent-inbox/test/mesh/delivery-bridge.test.ts +178 -0
  61. package/references/agent-inbox/test/mesh/e2e-mesh.test.ts +527 -0
  62. package/references/agent-inbox/test/mesh/e2e-real-meshpeer.test.ts +629 -0
  63. package/references/agent-inbox/test/mesh/federation-mesh.test.ts +269 -0
  64. package/references/agent-inbox/test/mesh/mesh-connector.test.ts +66 -0
  65. package/references/agent-inbox/test/mesh/mesh-transport.test.ts +191 -0
  66. package/references/agent-inbox/test/mesh/meshpeer-integration.test.ts +442 -0
  67. package/references/agent-inbox/test/mesh/mock-mesh.ts +125 -0
  68. package/references/agent-inbox/test/mesh/mock-meshpeer.ts +266 -0
  69. package/references/agent-inbox/test/mesh/type-mapper.test.ts +226 -0
  70. package/references/agent-inbox/test/message-router.test.ts +184 -0
  71. package/references/agent-inbox/test/push-notifier.test.ts +139 -0
  72. package/references/agent-inbox/test/registry/warm-registry.test.ts +171 -0
  73. package/references/agent-inbox/test/sqlite-prefix.test.ts +192 -0
  74. package/references/agent-inbox/test/sqlite-storage.test.ts +243 -0
  75. package/references/agent-inbox/test/storage.test.ts +196 -0
  76. package/references/agent-inbox/test/traceability.test.ts +123 -0
  77. package/references/agent-inbox/test/wake.test.ts +330 -0
  78. package/references/agent-inbox/tsconfig.json +20 -0
  79. package/references/agent-inbox/tsup.config.ts +10 -0
  80. package/references/agent-inbox/vitest.config.ts +8 -0
  81. package/references/minimem/.claude/settings.json +7 -0
  82. package/references/minimem/.sudocode/issues.jsonl +18 -0
  83. package/references/minimem/.sudocode/specs.jsonl +1 -0
  84. package/references/minimem/CLAUDE.md +329 -0
  85. package/references/minimem/README.md +565 -0
  86. package/references/minimem/claude-plugin/.claude-plugin/plugin.json +10 -0
  87. package/references/minimem/claude-plugin/.mcp.json +7 -0
  88. package/references/minimem/claude-plugin/README.md +158 -0
  89. package/references/minimem/claude-plugin/commands/recall.md +47 -0
  90. package/references/minimem/claude-plugin/commands/remember.md +41 -0
  91. package/references/minimem/claude-plugin/hooks/__tests__/hooks.test.ts +272 -0
  92. package/references/minimem/claude-plugin/hooks/hooks.json +27 -0
  93. package/references/minimem/claude-plugin/hooks/session-end.sh +86 -0
  94. package/references/minimem/claude-plugin/hooks/session-start.sh +85 -0
  95. package/references/minimem/claude-plugin/skills/memory/SKILL.md +108 -0
  96. package/references/minimem/media/banner.png +0 -0
  97. package/references/minimem/package-lock.json +5373 -0
  98. package/references/minimem/package.json +76 -0
  99. package/references/minimem/scripts/postbuild.js +49 -0
  100. package/references/minimem/src/__tests__/edge-cases.test.ts +371 -0
  101. package/references/minimem/src/__tests__/errors.test.ts +265 -0
  102. package/references/minimem/src/__tests__/helpers.ts +199 -0
  103. package/references/minimem/src/__tests__/internal.test.ts +407 -0
  104. package/references/minimem/src/__tests__/knowledge-frontmatter.test.ts +148 -0
  105. package/references/minimem/src/__tests__/knowledge.test.ts +148 -0
  106. package/references/minimem/src/__tests__/minimem.integration.test.ts +1127 -0
  107. package/references/minimem/src/__tests__/session.test.ts +190 -0
  108. package/references/minimem/src/cli/__tests__/commands.test.ts +760 -0
  109. package/references/minimem/src/cli/__tests__/contained-layout.test.ts +286 -0
  110. package/references/minimem/src/cli/commands/__tests__/conflicts.test.ts +141 -0
  111. package/references/minimem/src/cli/commands/append.ts +76 -0
  112. package/references/minimem/src/cli/commands/config.ts +262 -0
  113. package/references/minimem/src/cli/commands/conflicts.ts +415 -0
  114. package/references/minimem/src/cli/commands/daemon.ts +169 -0
  115. package/references/minimem/src/cli/commands/index.ts +12 -0
  116. package/references/minimem/src/cli/commands/init.ts +166 -0
  117. package/references/minimem/src/cli/commands/mcp.ts +221 -0
  118. package/references/minimem/src/cli/commands/push-pull.ts +213 -0
  119. package/references/minimem/src/cli/commands/search.ts +223 -0
  120. package/references/minimem/src/cli/commands/status.ts +84 -0
  121. package/references/minimem/src/cli/commands/store.ts +189 -0
  122. package/references/minimem/src/cli/commands/sync-init.ts +290 -0
  123. package/references/minimem/src/cli/commands/sync.ts +70 -0
  124. package/references/minimem/src/cli/commands/upsert.ts +197 -0
  125. package/references/minimem/src/cli/config.ts +611 -0
  126. package/references/minimem/src/cli/index.ts +299 -0
  127. package/references/minimem/src/cli/shared.ts +189 -0
  128. package/references/minimem/src/cli/sync/__tests__/central.test.ts +152 -0
  129. package/references/minimem/src/cli/sync/__tests__/conflicts.test.ts +209 -0
  130. package/references/minimem/src/cli/sync/__tests__/daemon.test.ts +118 -0
  131. package/references/minimem/src/cli/sync/__tests__/detection.test.ts +207 -0
  132. package/references/minimem/src/cli/sync/__tests__/integration.test.ts +476 -0
  133. package/references/minimem/src/cli/sync/__tests__/registry.test.ts +363 -0
  134. package/references/minimem/src/cli/sync/__tests__/state.test.ts +255 -0
  135. package/references/minimem/src/cli/sync/__tests__/validation.test.ts +193 -0
  136. package/references/minimem/src/cli/sync/__tests__/watcher.test.ts +178 -0
  137. package/references/minimem/src/cli/sync/central.ts +292 -0
  138. package/references/minimem/src/cli/sync/conflicts.ts +205 -0
  139. package/references/minimem/src/cli/sync/daemon.ts +407 -0
  140. package/references/minimem/src/cli/sync/detection.ts +138 -0
  141. package/references/minimem/src/cli/sync/index.ts +107 -0
  142. package/references/minimem/src/cli/sync/operations.ts +373 -0
  143. package/references/minimem/src/cli/sync/registry.ts +279 -0
  144. package/references/minimem/src/cli/sync/state.ts +358 -0
  145. package/references/minimem/src/cli/sync/validation.ts +206 -0
  146. package/references/minimem/src/cli/sync/watcher.ts +237 -0
  147. package/references/minimem/src/cli/version.ts +34 -0
  148. package/references/minimem/src/core/index.ts +9 -0
  149. package/references/minimem/src/core/indexer.ts +628 -0
  150. package/references/minimem/src/core/searcher.ts +221 -0
  151. package/references/minimem/src/db/schema.ts +183 -0
  152. package/references/minimem/src/db/sqlite-vec.ts +24 -0
  153. package/references/minimem/src/embeddings/__tests__/embeddings.test.ts +431 -0
  154. package/references/minimem/src/embeddings/batch-gemini.ts +392 -0
  155. package/references/minimem/src/embeddings/batch-openai.ts +409 -0
  156. package/references/minimem/src/embeddings/embeddings.ts +434 -0
  157. package/references/minimem/src/index.ts +132 -0
  158. package/references/minimem/src/internal.ts +299 -0
  159. package/references/minimem/src/minimem.ts +1291 -0
  160. package/references/minimem/src/search/__tests__/hybrid.test.ts +247 -0
  161. package/references/minimem/src/search/graph.ts +234 -0
  162. package/references/minimem/src/search/hybrid.ts +151 -0
  163. package/references/minimem/src/search/search.ts +256 -0
  164. package/references/minimem/src/server/__tests__/mcp.test.ts +347 -0
  165. package/references/minimem/src/server/__tests__/tools.test.ts +364 -0
  166. package/references/minimem/src/server/mcp.ts +326 -0
  167. package/references/minimem/src/server/tools.ts +720 -0
  168. package/references/minimem/src/session.ts +460 -0
  169. package/references/minimem/src/store/__tests__/manifest.test.ts +177 -0
  170. package/references/minimem/src/store/__tests__/materialize.test.ts +52 -0
  171. package/references/minimem/src/store/__tests__/store-graph.test.ts +228 -0
  172. package/references/minimem/src/store/index.ts +27 -0
  173. package/references/minimem/src/store/manifest.ts +203 -0
  174. package/references/minimem/src/store/materialize.ts +185 -0
  175. package/references/minimem/src/store/store-graph.ts +252 -0
  176. package/references/minimem/tsconfig.json +19 -0
  177. package/references/minimem/tsup.config.ts +26 -0
  178. package/references/minimem/vitest.config.ts +29 -0
  179. package/references/multi-agent-protocol/.sudocode/issues.jsonl +120 -0
  180. package/references/multi-agent-protocol/.sudocode/specs.jsonl +15 -0
  181. package/references/multi-agent-protocol/LICENSE +21 -0
  182. package/references/multi-agent-protocol/README.md +113 -0
  183. package/references/multi-agent-protocol/docs/00-design-specification.md +496 -0
  184. package/references/multi-agent-protocol/docs/01-open-questions.md +1050 -0
  185. package/references/multi-agent-protocol/docs/02-wire-protocol.md +296 -0
  186. package/references/multi-agent-protocol/docs/03-streaming-semantics.md +252 -0
  187. package/references/multi-agent-protocol/docs/04-error-handling.md +231 -0
  188. package/references/multi-agent-protocol/docs/05-connection-model.md +244 -0
  189. package/references/multi-agent-protocol/docs/06-visibility-permissions.md +243 -0
  190. package/references/multi-agent-protocol/docs/07-federation.md +335 -0
  191. package/references/multi-agent-protocol/docs/08-macro-agent-migration.md +253 -0
  192. package/references/multi-agent-protocol/docs/09-authentication.md +748 -0
  193. package/references/multi-agent-protocol/docs/10-environment-awareness.md +242 -0
  194. package/references/multi-agent-protocol/docs/10-mail-protocol.md +553 -0
  195. package/references/multi-agent-protocol/docs/11-anp-inspired-improvements.md +1079 -0
  196. package/references/multi-agent-protocol/docs/11-trajectory-protocol.md +292 -0
  197. package/references/multi-agent-protocol/docs/12-anp-implementation-plan.md +641 -0
  198. package/references/multi-agent-protocol/docs/agent-iam-integration.md +877 -0
  199. package/references/multi-agent-protocol/docs/agentic-mesh-integration-draft.md +459 -0
  200. package/references/multi-agent-protocol/docs/git-transport-draft.md +251 -0
  201. package/references/multi-agent-protocol/docs-site/Gemfile +22 -0
  202. package/references/multi-agent-protocol/docs-site/README.md +82 -0
  203. package/references/multi-agent-protocol/docs-site/_config.yml +91 -0
  204. package/references/multi-agent-protocol/docs-site/_includes/head_custom.html +20 -0
  205. package/references/multi-agent-protocol/docs-site/_sass/color_schemes/map.scss +42 -0
  206. package/references/multi-agent-protocol/docs-site/_sass/custom/custom.scss +34 -0
  207. package/references/multi-agent-protocol/docs-site/examples/full-integration.md +510 -0
  208. package/references/multi-agent-protocol/docs-site/examples/index.md +138 -0
  209. package/references/multi-agent-protocol/docs-site/examples/simple-chat.md +282 -0
  210. package/references/multi-agent-protocol/docs-site/examples/task-queue.md +399 -0
  211. package/references/multi-agent-protocol/docs-site/getting-started/index.md +98 -0
  212. package/references/multi-agent-protocol/docs-site/getting-started/installation.md +219 -0
  213. package/references/multi-agent-protocol/docs-site/getting-started/overview.md +172 -0
  214. package/references/multi-agent-protocol/docs-site/getting-started/quickstart.md +237 -0
  215. package/references/multi-agent-protocol/docs-site/index.md +136 -0
  216. package/references/multi-agent-protocol/docs-site/protocol/authentication.md +391 -0
  217. package/references/multi-agent-protocol/docs-site/protocol/connection-model.md +376 -0
  218. package/references/multi-agent-protocol/docs-site/protocol/design.md +284 -0
  219. package/references/multi-agent-protocol/docs-site/protocol/error-handling.md +312 -0
  220. package/references/multi-agent-protocol/docs-site/protocol/federation.md +449 -0
  221. package/references/multi-agent-protocol/docs-site/protocol/index.md +129 -0
  222. package/references/multi-agent-protocol/docs-site/protocol/permissions.md +398 -0
  223. package/references/multi-agent-protocol/docs-site/protocol/streaming.md +353 -0
  224. package/references/multi-agent-protocol/docs-site/protocol/wire-protocol.md +369 -0
  225. package/references/multi-agent-protocol/docs-site/sdk/api/agent.md +357 -0
  226. package/references/multi-agent-protocol/docs-site/sdk/api/client.md +380 -0
  227. package/references/multi-agent-protocol/docs-site/sdk/api/index.md +62 -0
  228. package/references/multi-agent-protocol/docs-site/sdk/api/server.md +453 -0
  229. package/references/multi-agent-protocol/docs-site/sdk/api/types.md +468 -0
  230. package/references/multi-agent-protocol/docs-site/sdk/guides/agent.md +375 -0
  231. package/references/multi-agent-protocol/docs-site/sdk/guides/authentication.md +405 -0
  232. package/references/multi-agent-protocol/docs-site/sdk/guides/client.md +352 -0
  233. package/references/multi-agent-protocol/docs-site/sdk/guides/index.md +89 -0
  234. package/references/multi-agent-protocol/docs-site/sdk/guides/server.md +360 -0
  235. package/references/multi-agent-protocol/docs-site/sdk/guides/testing.md +446 -0
  236. package/references/multi-agent-protocol/docs-site/sdk/guides/transports.md +363 -0
  237. package/references/multi-agent-protocol/docs-site/sdk/index.md +206 -0
  238. package/references/multi-agent-protocol/package-lock.json +4230 -0
  239. package/references/multi-agent-protocol/package.json +56 -0
  240. package/references/multi-agent-protocol/schema/meta.json +584 -0
  241. package/references/multi-agent-protocol/schema/schema.json +3067 -0
  242. package/references/openhive/.claude/settings.json +6 -0
  243. package/references/openhive/.dockerignore +54 -0
  244. package/references/openhive/.github/workflows/docker.yml +52 -0
  245. package/references/openhive/.sudocode/issues.jsonl +24 -0
  246. package/references/openhive/.sudocode/specs.jsonl +4 -0
  247. package/references/openhive/CLAUDE.md +88 -0
  248. package/references/openhive/Dockerfile +105 -0
  249. package/references/openhive/README.md +745 -0
  250. package/references/openhive/bin/openhive.js +6 -0
  251. package/references/openhive/cloudbuild.yaml +80 -0
  252. package/references/openhive/deploy/cloud-run.sh +106 -0
  253. package/references/openhive/deploy/openhive.env.example +80 -0
  254. package/references/openhive/deploy/openhive.service +91 -0
  255. package/references/openhive/docker-compose.yml +67 -0
  256. package/references/openhive/docker-entrypoint.sh +117 -0
  257. package/references/openhive/docs/API_MIGRATION.md +176 -0
  258. package/references/openhive/docs/DEPLOYMENT.md +847 -0
  259. package/references/openhive/docs/DESIGN_v1.md +489 -0
  260. package/references/openhive/docs/DESIGN_v2.md +564 -0
  261. package/references/openhive/docs/HEADSCALE_HOSTING_SPEC.md +513 -0
  262. package/references/openhive/docs/HIVE_SYNC_DESIGN.md +2362 -0
  263. package/references/openhive/docs/HIVE_SYNC_IMPLEMENTATION_PLAN.md +1169 -0
  264. package/references/openhive/docs/HOSTING.md +601 -0
  265. package/references/openhive/docs/IMPLEMENTATION_PLAN.md +428 -0
  266. package/references/openhive/docs/LOCAL_SETUP.md +506 -0
  267. package/references/openhive/docs/MACRO_AGENT_ATLAS_EXTENSION.md +351 -0
  268. package/references/openhive/docs/MEMORY_BANK_SYNC_SPEC.md +909 -0
  269. package/references/openhive/docs/PLAN_v1.md +471 -0
  270. package/references/openhive/docs/PLAN_v2.md +623 -0
  271. package/references/openhive/docs/WEBSOCKET.md +267 -0
  272. package/references/openhive/docs/openswarm-bootstrap-token-spec.md +240 -0
  273. package/references/openhive/ecosystem.config.cjs +76 -0
  274. package/references/openhive/fly.toml +63 -0
  275. package/references/openhive/package-lock.json +17640 -0
  276. package/references/openhive/package.json +128 -0
  277. package/references/openhive/packages/openhive-types/package-lock.json +1473 -0
  278. package/references/openhive/packages/openhive-types/package.json +42 -0
  279. package/references/openhive/packages/openhive-types/src/index.ts +36 -0
  280. package/references/openhive/packages/openhive-types/src/map-coordination.ts +92 -0
  281. package/references/openhive/packages/openhive-types/src/map-session-sync.ts +50 -0
  282. package/references/openhive/packages/openhive-types/src/map-sync.ts +68 -0
  283. package/references/openhive/packages/openhive-types/tsconfig.json +15 -0
  284. package/references/openhive/packages/openhive-types/tsconfig.tsbuildinfo +1 -0
  285. package/references/openhive/packages/openhive-types/tsup.config.ts +12 -0
  286. package/references/openhive/railway.json +13 -0
  287. package/references/openhive/railway.toml +24 -0
  288. package/references/openhive/render.yaml +51 -0
  289. package/references/openhive/src/__tests__/auth.test.ts +148 -0
  290. package/references/openhive/src/__tests__/bridge/credentials.test.ts +65 -0
  291. package/references/openhive/src/__tests__/bridge/dal.test.ts +279 -0
  292. package/references/openhive/src/__tests__/bridge/inbound.test.ts +349 -0
  293. package/references/openhive/src/__tests__/bridge/manager.test.ts +419 -0
  294. package/references/openhive/src/__tests__/bridge/mentions.test.ts +83 -0
  295. package/references/openhive/src/__tests__/bridge/outbound.test.ts +209 -0
  296. package/references/openhive/src/__tests__/bridge/slack-adapter.test.ts +276 -0
  297. package/references/openhive/src/__tests__/cli.test.ts +342 -0
  298. package/references/openhive/src/__tests__/config.test.ts +205 -0
  299. package/references/openhive/src/__tests__/coordination/coordination.test.ts +1072 -0
  300. package/references/openhive/src/__tests__/coordination/cross-instance.test.ts +540 -0
  301. package/references/openhive/src/__tests__/coordination/e2e.test.ts +780 -0
  302. package/references/openhive/src/__tests__/data-dir.test.ts +332 -0
  303. package/references/openhive/src/__tests__/db.test.ts +258 -0
  304. package/references/openhive/src/__tests__/discovery.test.ts +288 -0
  305. package/references/openhive/src/__tests__/events/dal.test.ts +371 -0
  306. package/references/openhive/src/__tests__/events/dispatch.test.ts +202 -0
  307. package/references/openhive/src/__tests__/events/e2e.test.ts +528 -0
  308. package/references/openhive/src/__tests__/events/normalizers.test.ts +263 -0
  309. package/references/openhive/src/__tests__/events/router.test.ts +314 -0
  310. package/references/openhive/src/__tests__/events/routes.test.ts +407 -0
  311. package/references/openhive/src/__tests__/follows.test.ts +328 -0
  312. package/references/openhive/src/__tests__/helpers/test-dirs.ts +44 -0
  313. package/references/openhive/src/__tests__/ingest-keys.test.ts +925 -0
  314. package/references/openhive/src/__tests__/map/sync-client-content.test.ts +288 -0
  315. package/references/openhive/src/__tests__/map/sync-client.test.ts +500 -0
  316. package/references/openhive/src/__tests__/map/sync-listener.test.ts +504 -0
  317. package/references/openhive/src/__tests__/middleware/hostname-guard.test.ts +73 -0
  318. package/references/openhive/src/__tests__/migrations.test.ts +260 -0
  319. package/references/openhive/src/__tests__/opentasks/client.test.ts +497 -0
  320. package/references/openhive/src/__tests__/opentasks/discovery.test.ts +283 -0
  321. package/references/openhive/src/__tests__/opentasks/e2e.test.ts +767 -0
  322. package/references/openhive/src/__tests__/routes/agents.test.ts +417 -0
  323. package/references/openhive/src/__tests__/routes/opentasks-content.test.ts +493 -0
  324. package/references/openhive/src/__tests__/routes/resource-content.test.ts +1741 -0
  325. package/references/openhive/src/__tests__/sessions/adapters.test.ts +524 -0
  326. package/references/openhive/src/__tests__/sessions/routes.test.ts +1053 -0
  327. package/references/openhive/src/__tests__/sessions/storage.test.ts +545 -0
  328. package/references/openhive/src/__tests__/sessions/trajectory-checkpoints.test.ts +349 -0
  329. package/references/openhive/src/__tests__/sessions/trajectory-routes.test.ts +290 -0
  330. package/references/openhive/src/__tests__/swarm/config.test.ts +125 -0
  331. package/references/openhive/src/__tests__/swarm/credentials.test.ts +254 -0
  332. package/references/openhive/src/__tests__/swarm/dal.test.ts +290 -0
  333. package/references/openhive/src/__tests__/swarm/e2e.test.ts +827 -0
  334. package/references/openhive/src/__tests__/swarm/fixtures/exit-immediately.js +3 -0
  335. package/references/openhive/src/__tests__/swarm/fixtures/map-server.js +147 -0
  336. package/references/openhive/src/__tests__/swarm/fixtures/sleep-server.js +52 -0
  337. package/references/openhive/src/__tests__/swarm/local-provider.test.ts +279 -0
  338. package/references/openhive/src/__tests__/swarm/manager.test.ts +305 -0
  339. package/references/openhive/src/__tests__/swarm/routes.test.ts +396 -0
  340. package/references/openhive/src/__tests__/swarm/workspace.test.ts +257 -0
  341. package/references/openhive/src/__tests__/swarmhub/client.test.ts +324 -0
  342. package/references/openhive/src/__tests__/swarmhub/config.test.ts +213 -0
  343. package/references/openhive/src/__tests__/swarmhub/connector.test.ts +581 -0
  344. package/references/openhive/src/__tests__/swarmhub/routes.test.ts +639 -0
  345. package/references/openhive/src/__tests__/swarmhub/slack-client.test.ts +164 -0
  346. package/references/openhive/src/__tests__/swarmhub/slack-connector.test.ts +164 -0
  347. package/references/openhive/src/__tests__/swarmhub/slack-routes.test.ts +373 -0
  348. package/references/openhive/src/__tests__/swarmhub/webhook-handler.test.ts +295 -0
  349. package/references/openhive/src/__tests__/sync/resource-sync.test.ts +1418 -0
  350. package/references/openhive/src/__tests__/sync/sync.test.ts +800 -0
  351. package/references/openhive/src/api/index.ts +65 -0
  352. package/references/openhive/src/api/middleware/auth.ts +227 -0
  353. package/references/openhive/src/api/middleware/hostname-guard.ts +38 -0
  354. package/references/openhive/src/api/routes/admin.ts +366 -0
  355. package/references/openhive/src/api/routes/agents.ts +223 -0
  356. package/references/openhive/src/api/routes/auth.ts +164 -0
  357. package/references/openhive/src/api/routes/bridges.ts +384 -0
  358. package/references/openhive/src/api/routes/comments.ts +294 -0
  359. package/references/openhive/src/api/routes/coordination.ts +312 -0
  360. package/references/openhive/src/api/routes/events.ts +158 -0
  361. package/references/openhive/src/api/routes/federation.ts +367 -0
  362. package/references/openhive/src/api/routes/feed.ts +212 -0
  363. package/references/openhive/src/api/routes/hives.ts +264 -0
  364. package/references/openhive/src/api/routes/map.ts +674 -0
  365. package/references/openhive/src/api/routes/memory-banks.ts +971 -0
  366. package/references/openhive/src/api/routes/posts.ts +342 -0
  367. package/references/openhive/src/api/routes/resource-content.ts +727 -0
  368. package/references/openhive/src/api/routes/resources.ts +1013 -0
  369. package/references/openhive/src/api/routes/search.ts +45 -0
  370. package/references/openhive/src/api/routes/sessions.ts +1187 -0
  371. package/references/openhive/src/api/routes/swarm-hosting.ts +313 -0
  372. package/references/openhive/src/api/routes/sync-protocol.ts +168 -0
  373. package/references/openhive/src/api/routes/sync.ts +279 -0
  374. package/references/openhive/src/api/routes/uploads.ts +174 -0
  375. package/references/openhive/src/api/routes/webhooks.ts +603 -0
  376. package/references/openhive/src/api/schemas/agents.ts +26 -0
  377. package/references/openhive/src/api/schemas/comments.ts +22 -0
  378. package/references/openhive/src/api/schemas/hives.ts +33 -0
  379. package/references/openhive/src/api/schemas/posts.ts +37 -0
  380. package/references/openhive/src/api/schemas/sync.ts +56 -0
  381. package/references/openhive/src/auth/index.ts +2 -0
  382. package/references/openhive/src/auth/jwks.ts +58 -0
  383. package/references/openhive/src/bridge/adapters/slack.ts +306 -0
  384. package/references/openhive/src/bridge/credentials.ts +72 -0
  385. package/references/openhive/src/bridge/inbound.ts +288 -0
  386. package/references/openhive/src/bridge/index.ts +42 -0
  387. package/references/openhive/src/bridge/manager.ts +425 -0
  388. package/references/openhive/src/bridge/mentions.ts +42 -0
  389. package/references/openhive/src/bridge/outbound.ts +103 -0
  390. package/references/openhive/src/bridge/schema.ts +82 -0
  391. package/references/openhive/src/bridge/types.ts +238 -0
  392. package/references/openhive/src/cli/network.ts +480 -0
  393. package/references/openhive/src/cli.ts +620 -0
  394. package/references/openhive/src/config.ts +611 -0
  395. package/references/openhive/src/coordination/index.ts +43 -0
  396. package/references/openhive/src/coordination/listener.ts +92 -0
  397. package/references/openhive/src/coordination/schema.ts +79 -0
  398. package/references/openhive/src/coordination/service.ts +233 -0
  399. package/references/openhive/src/coordination/types.ts +177 -0
  400. package/references/openhive/src/data-dir.ts +105 -0
  401. package/references/openhive/src/db/adapters/index.ts +21 -0
  402. package/references/openhive/src/db/adapters/postgres.ts +310 -0
  403. package/references/openhive/src/db/adapters/sqlite.ts +56 -0
  404. package/references/openhive/src/db/adapters/types.ts +65 -0
  405. package/references/openhive/src/db/dal/agents.ts +430 -0
  406. package/references/openhive/src/db/dal/bridge.ts +336 -0
  407. package/references/openhive/src/db/dal/comments.ts +213 -0
  408. package/references/openhive/src/db/dal/coordination.ts +361 -0
  409. package/references/openhive/src/db/dal/events.ts +381 -0
  410. package/references/openhive/src/db/dal/follows.ts +96 -0
  411. package/references/openhive/src/db/dal/hives.ts +198 -0
  412. package/references/openhive/src/db/dal/ingest-keys.ts +176 -0
  413. package/references/openhive/src/db/dal/instances.ts +196 -0
  414. package/references/openhive/src/db/dal/invites.ts +123 -0
  415. package/references/openhive/src/db/dal/map.ts +750 -0
  416. package/references/openhive/src/db/dal/posts.ts +274 -0
  417. package/references/openhive/src/db/dal/remote-agents.ts +56 -0
  418. package/references/openhive/src/db/dal/search.ts +238 -0
  419. package/references/openhive/src/db/dal/sync-events.ts +160 -0
  420. package/references/openhive/src/db/dal/sync-groups.ts +100 -0
  421. package/references/openhive/src/db/dal/sync-peer-configs.ts +216 -0
  422. package/references/openhive/src/db/dal/sync-peers.ts +145 -0
  423. package/references/openhive/src/db/dal/syncable-resources.ts +888 -0
  424. package/references/openhive/src/db/dal/trajectory-checkpoints.ts +291 -0
  425. package/references/openhive/src/db/dal/uploads.ts +124 -0
  426. package/references/openhive/src/db/dal/votes.ts +124 -0
  427. package/references/openhive/src/db/index.ts +293 -0
  428. package/references/openhive/src/db/providers/index.ts +75 -0
  429. package/references/openhive/src/db/providers/postgres.ts +529 -0
  430. package/references/openhive/src/db/providers/sqlite.ts +1383 -0
  431. package/references/openhive/src/db/providers/turso.ts +1360 -0
  432. package/references/openhive/src/db/providers/types.ts +516 -0
  433. package/references/openhive/src/db/schema.ts +641 -0
  434. package/references/openhive/src/discovery/index.ts +403 -0
  435. package/references/openhive/src/events/dispatch.ts +106 -0
  436. package/references/openhive/src/events/index.ts +17 -0
  437. package/references/openhive/src/events/normalizers/github.ts +133 -0
  438. package/references/openhive/src/events/normalizers/index.ts +62 -0
  439. package/references/openhive/src/events/normalizers/slack.ts +50 -0
  440. package/references/openhive/src/events/router.ts +156 -0
  441. package/references/openhive/src/events/schema.ts +66 -0
  442. package/references/openhive/src/events/types.ts +130 -0
  443. package/references/openhive/src/federation/index.ts +1 -0
  444. package/references/openhive/src/federation/service.ts +776 -0
  445. package/references/openhive/src/headscale/client.ts +256 -0
  446. package/references/openhive/src/headscale/config.ts +212 -0
  447. package/references/openhive/src/headscale/index.ts +23 -0
  448. package/references/openhive/src/headscale/manager.ts +249 -0
  449. package/references/openhive/src/headscale/sync.ts +272 -0
  450. package/references/openhive/src/headscale/types.ts +231 -0
  451. package/references/openhive/src/index.ts +225 -0
  452. package/references/openhive/src/map/client-entry.ts +26 -0
  453. package/references/openhive/src/map/index.ts +76 -0
  454. package/references/openhive/src/map/schema.ts +119 -0
  455. package/references/openhive/src/map/service.ts +323 -0
  456. package/references/openhive/src/map/sync-client.ts +696 -0
  457. package/references/openhive/src/map/sync-listener.ts +409 -0
  458. package/references/openhive/src/map/types.ts +290 -0
  459. package/references/openhive/src/network/factory.ts +118 -0
  460. package/references/openhive/src/network/headscale-provider.ts +437 -0
  461. package/references/openhive/src/network/index.ts +43 -0
  462. package/references/openhive/src/network/tailscale-client.ts +289 -0
  463. package/references/openhive/src/network/tailscale-provider.ts +287 -0
  464. package/references/openhive/src/network/types.ts +178 -0
  465. package/references/openhive/src/opentasks-client/client.ts +374 -0
  466. package/references/openhive/src/opentasks-client/index.ts +7 -0
  467. package/references/openhive/src/realtime/index.ts +282 -0
  468. package/references/openhive/src/server.ts +1069 -0
  469. package/references/openhive/src/services/email.ts +177 -0
  470. package/references/openhive/src/services/sitemap.ts +135 -0
  471. package/references/openhive/src/sessions/adapters/claude.ts +466 -0
  472. package/references/openhive/src/sessions/adapters/codex.ts +265 -0
  473. package/references/openhive/src/sessions/adapters/index.ts +263 -0
  474. package/references/openhive/src/sessions/adapters/raw.ts +144 -0
  475. package/references/openhive/src/sessions/adapters/types.ts +83 -0
  476. package/references/openhive/src/sessions/index.ts +50 -0
  477. package/references/openhive/src/sessions/storage/adapters/gcs.ts +277 -0
  478. package/references/openhive/src/sessions/storage/adapters/local.ts +240 -0
  479. package/references/openhive/src/sessions/storage/adapters/s3.ts +321 -0
  480. package/references/openhive/src/sessions/storage/index.ts +231 -0
  481. package/references/openhive/src/sessions/storage/types.ts +189 -0
  482. package/references/openhive/src/sessions/types.ts +415 -0
  483. package/references/openhive/src/shared/types/index.ts +45 -0
  484. package/references/openhive/src/shared/types/map-coordination.ts +92 -0
  485. package/references/openhive/src/shared/types/map-session-sync.ts +170 -0
  486. package/references/openhive/src/shared/types/map-sync.ts +68 -0
  487. package/references/openhive/src/skill.ts +203 -0
  488. package/references/openhive/src/storage/adapters/local.ts +169 -0
  489. package/references/openhive/src/storage/adapters/s3.ts +195 -0
  490. package/references/openhive/src/storage/index.ts +64 -0
  491. package/references/openhive/src/storage/types.ts +69 -0
  492. package/references/openhive/src/swarm/credentials.ts +98 -0
  493. package/references/openhive/src/swarm/dal.ts +206 -0
  494. package/references/openhive/src/swarm/index.ts +28 -0
  495. package/references/openhive/src/swarm/manager.ts +917 -0
  496. package/references/openhive/src/swarm/providers/local.ts +338 -0
  497. package/references/openhive/src/swarm/providers/sandboxed-local.ts +478 -0
  498. package/references/openhive/src/swarm/providers/workspace.ts +52 -0
  499. package/references/openhive/src/swarm/schema.ts +43 -0
  500. package/references/openhive/src/swarm/types.ts +333 -0
  501. package/references/openhive/src/swarmhub/client.ts +279 -0
  502. package/references/openhive/src/swarmhub/connector.ts +463 -0
  503. package/references/openhive/src/swarmhub/index.ts +43 -0
  504. package/references/openhive/src/swarmhub/routes.ts +296 -0
  505. package/references/openhive/src/swarmhub/types.ts +213 -0
  506. package/references/openhive/src/swarmhub/webhook-handler.ts +126 -0
  507. package/references/openhive/src/sync/compaction.ts +193 -0
  508. package/references/openhive/src/sync/coordination-hooks.ts +154 -0
  509. package/references/openhive/src/sync/crypto.ts +79 -0
  510. package/references/openhive/src/sync/gossip.ts +136 -0
  511. package/references/openhive/src/sync/hooks.ts +202 -0
  512. package/references/openhive/src/sync/materializer-repo.ts +256 -0
  513. package/references/openhive/src/sync/materializer.ts +682 -0
  514. package/references/openhive/src/sync/middleware.ts +140 -0
  515. package/references/openhive/src/sync/peer-resolver.ts +157 -0
  516. package/references/openhive/src/sync/resource-hooks.ts +161 -0
  517. package/references/openhive/src/sync/schema.ts +158 -0
  518. package/references/openhive/src/sync/service.ts +990 -0
  519. package/references/openhive/src/sync/types.ts +369 -0
  520. package/references/openhive/src/terminal/index.ts +4 -0
  521. package/references/openhive/src/terminal/pty-manager.ts +337 -0
  522. package/references/openhive/src/terminal/resolve-tui.ts +44 -0
  523. package/references/openhive/src/terminal/terminal-ws.ts +251 -0
  524. package/references/openhive/src/types.ts +442 -0
  525. package/references/openhive/src/utils/git-remote.ts +329 -0
  526. package/references/openhive/src/web/App.tsx +77 -0
  527. package/references/openhive/src/web/__tests__/components/dashboard/RecentActivity.test.tsx +77 -0
  528. package/references/openhive/src/web/__tests__/components/dashboard/StatsOverview.test.tsx +62 -0
  529. package/references/openhive/src/web/__tests__/components/dashboard/SwarmStatusSummary.test.tsx +122 -0
  530. package/references/openhive/src/web/__tests__/components/dashboard/SyncResourcesStatus.test.tsx +104 -0
  531. package/references/openhive/src/web/__tests__/components/layout/Sidebar.test.tsx +110 -0
  532. package/references/openhive/src/web/__tests__/components/swarm/StatusBadges.test.tsx +65 -0
  533. package/references/openhive/src/web/__tests__/components/terminal/query-responses.test.ts +143 -0
  534. package/references/openhive/src/web/__tests__/components/terminal/terminal-mouse.test.ts +509 -0
  535. package/references/openhive/src/web/__tests__/hooks/useEventsApi.test.ts +378 -0
  536. package/references/openhive/src/web/__tests__/pages/Dashboard.test.tsx +57 -0
  537. package/references/openhive/src/web/__tests__/pages/Events.test.tsx +886 -0
  538. package/references/openhive/src/web/__tests__/pages/Explore.test.tsx +63 -0
  539. package/references/openhive/src/web/__tests__/routing.test.tsx +79 -0
  540. package/references/openhive/src/web/__tests__/setup.ts +37 -0
  541. package/references/openhive/src/web/__tests__/stores/dashboard.test.ts +49 -0
  542. package/references/openhive/src/web/components/common/AgentBadge.tsx +58 -0
  543. package/references/openhive/src/web/components/common/Avatar.tsx +78 -0
  544. package/references/openhive/src/web/components/common/ErrorBoundary.tsx +76 -0
  545. package/references/openhive/src/web/components/common/Highlight.tsx +79 -0
  546. package/references/openhive/src/web/components/common/ImageUpload.tsx +209 -0
  547. package/references/openhive/src/web/components/common/LoadingSpinner.tsx +37 -0
  548. package/references/openhive/src/web/components/common/Logo.tsx +21 -0
  549. package/references/openhive/src/web/components/common/Markdown.tsx +53 -0
  550. package/references/openhive/src/web/components/common/ProtectedRoute.tsx +18 -0
  551. package/references/openhive/src/web/components/common/ThemeToggle.tsx +38 -0
  552. package/references/openhive/src/web/components/common/TimeAgo.tsx +17 -0
  553. package/references/openhive/src/web/components/common/Toast.tsx +70 -0
  554. package/references/openhive/src/web/components/common/VoteButtons.tsx +100 -0
  555. package/references/openhive/src/web/components/dashboard/RecentActivity.tsx +100 -0
  556. package/references/openhive/src/web/components/dashboard/StatsOverview.tsx +40 -0
  557. package/references/openhive/src/web/components/dashboard/SwarmStatusSummary.tsx +89 -0
  558. package/references/openhive/src/web/components/dashboard/SyncResourcesStatus.tsx +81 -0
  559. package/references/openhive/src/web/components/feed/FeedControls.tsx +38 -0
  560. package/references/openhive/src/web/components/feed/NewPostsIndicator.tsx +75 -0
  561. package/references/openhive/src/web/components/feed/PostCard.tsx +129 -0
  562. package/references/openhive/src/web/components/feed/PostList.tsx +83 -0
  563. package/references/openhive/src/web/components/layout/Footer.tsx +5 -0
  564. package/references/openhive/src/web/components/layout/Layout.tsx +29 -0
  565. package/references/openhive/src/web/components/layout/Sidebar.tsx +348 -0
  566. package/references/openhive/src/web/components/post/CommentForm.tsx +59 -0
  567. package/references/openhive/src/web/components/post/CommentTree.tsx +145 -0
  568. package/references/openhive/src/web/components/resources/MemoryBrowser.tsx +208 -0
  569. package/references/openhive/src/web/components/resources/OpenTasksSummary.tsx +138 -0
  570. package/references/openhive/src/web/components/resources/SkillBrowser.tsx +284 -0
  571. package/references/openhive/src/web/components/swarm/StatusBadges.tsx +56 -0
  572. package/references/openhive/src/web/components/terminal/TerminalPanel.tsx +485 -0
  573. package/references/openhive/src/web/components/terminal/index.ts +2 -0
  574. package/references/openhive/src/web/components/terminal/query-responses.ts +70 -0
  575. package/references/openhive/src/web/components/terminal/terminal-mouse.ts +222 -0
  576. package/references/openhive/src/web/hooks/useApi.ts +740 -0
  577. package/references/openhive/src/web/hooks/useDocumentTitle.ts +49 -0
  578. package/references/openhive/src/web/hooks/useInfiniteScroll.ts +58 -0
  579. package/references/openhive/src/web/hooks/useRealtimeUpdates.ts +154 -0
  580. package/references/openhive/src/web/hooks/useWebSocket.ts +225 -0
  581. package/references/openhive/src/web/index.html +73 -0
  582. package/references/openhive/src/web/lib/api.ts +518 -0
  583. package/references/openhive/src/web/main.tsx +32 -0
  584. package/references/openhive/src/web/pages/About.tsx +131 -0
  585. package/references/openhive/src/web/pages/Agent.tsx +130 -0
  586. package/references/openhive/src/web/pages/Agents.tsx +69 -0
  587. package/references/openhive/src/web/pages/AuthCallback.tsx +75 -0
  588. package/references/openhive/src/web/pages/Dashboard.tsx +41 -0
  589. package/references/openhive/src/web/pages/Events.tsx +1025 -0
  590. package/references/openhive/src/web/pages/Explore.tsx +43 -0
  591. package/references/openhive/src/web/pages/Hive.tsx +134 -0
  592. package/references/openhive/src/web/pages/Hives.tsx +64 -0
  593. package/references/openhive/src/web/pages/Home.tsx +43 -0
  594. package/references/openhive/src/web/pages/Login.tsx +122 -0
  595. package/references/openhive/src/web/pages/Post.tsx +216 -0
  596. package/references/openhive/src/web/pages/ResourceDetail.tsx +426 -0
  597. package/references/openhive/src/web/pages/Resources.tsx +276 -0
  598. package/references/openhive/src/web/pages/Search.tsx +234 -0
  599. package/references/openhive/src/web/pages/SessionDetail.tsx +703 -0
  600. package/references/openhive/src/web/pages/Sessions.tsx +129 -0
  601. package/references/openhive/src/web/pages/Settings.tsx +826 -0
  602. package/references/openhive/src/web/pages/SwarmCraft.tsx +16 -0
  603. package/references/openhive/src/web/pages/Swarms.tsx +981 -0
  604. package/references/openhive/src/web/pages/Terminal.tsx +69 -0
  605. package/references/openhive/src/web/postcss.config.js +5 -0
  606. package/references/openhive/src/web/public/favicon.svg +11 -0
  607. package/references/openhive/src/web/public/manifest.json +21 -0
  608. package/references/openhive/src/web/stores/auth.ts +207 -0
  609. package/references/openhive/src/web/stores/dashboard.ts +23 -0
  610. package/references/openhive/src/web/stores/realtime.ts +90 -0
  611. package/references/openhive/src/web/stores/theme.ts +70 -0
  612. package/references/openhive/src/web/stores/toast.ts +63 -0
  613. package/references/openhive/src/web/styles/globals.css +503 -0
  614. package/references/openhive/src/web/sw.ts +228 -0
  615. package/references/openhive/src/web/utils/serviceWorker.ts +86 -0
  616. package/references/openhive/src/web/vite.config.ts +81 -0
  617. package/references/openhive/tsconfig.json +32 -0
  618. package/references/openhive/tsup.config.ts +17 -0
  619. package/references/openhive/vitest.config.ts +30 -0
  620. package/references/openhive/vitest.web.config.ts +20 -0
  621. package/references/opentasks/.claude/settings.json +6 -0
  622. package/references/opentasks/.claude-plugin/plugin.json +20 -0
  623. package/references/opentasks/.lintstagedrc.json +4 -0
  624. package/references/opentasks/.prettierignore +4 -0
  625. package/references/opentasks/.prettierrc.json +11 -0
  626. package/references/opentasks/.sudocode/issues.jsonl +89 -0
  627. package/references/opentasks/.sudocode/specs.jsonl +24 -0
  628. package/references/opentasks/README.md +401 -0
  629. package/references/opentasks/docs/ARCHITECTURE.md +841 -0
  630. package/references/opentasks/docs/DESIGN.md +689 -0
  631. package/references/opentasks/docs/INTERFACE.md +670 -0
  632. package/references/opentasks/docs/PERSISTENCE.md +1638 -0
  633. package/references/opentasks/docs/PROVIDERS.md +1412 -0
  634. package/references/opentasks/docs/SCHEMA.md +815 -0
  635. package/references/opentasks/docs/TESTING.md +1081 -0
  636. package/references/opentasks/eslint.config.js +58 -0
  637. package/references/opentasks/package-lock.json +4348 -0
  638. package/references/opentasks/package.json +81 -0
  639. package/references/opentasks/skills/opentasks/SKILL.md +139 -0
  640. package/references/opentasks/skills/opentasks/dependency-management.md +119 -0
  641. package/references/opentasks/skills/opentasks/feedback-and-review.md +100 -0
  642. package/references/opentasks/skills/opentasks/linking-external-data.md +103 -0
  643. package/references/opentasks/skills/opentasks/spec-to-implementation.md +98 -0
  644. package/references/opentasks/src/__tests__/cli-tools.test.ts +800 -0
  645. package/references/opentasks/src/__tests__/cli.test.ts +97 -0
  646. package/references/opentasks/src/__tests__/p1-p3-gaps.test.ts +635 -0
  647. package/references/opentasks/src/cli.ts +929 -0
  648. package/references/opentasks/src/client/__tests__/client-crud.test.ts +546 -0
  649. package/references/opentasks/src/client/__tests__/client.test.ts +658 -0
  650. package/references/opentasks/src/client/__tests__/socket-discovery.test.ts +122 -0
  651. package/references/opentasks/src/client/client.ts +560 -0
  652. package/references/opentasks/src/client/index.ts +32 -0
  653. package/references/opentasks/src/config/__tests__/defaults.test.ts +66 -0
  654. package/references/opentasks/src/config/__tests__/env.test.ts +155 -0
  655. package/references/opentasks/src/config/__tests__/index.test.ts +148 -0
  656. package/references/opentasks/src/config/__tests__/loader.test.ts +173 -0
  657. package/references/opentasks/src/config/__tests__/merge.test.ts +121 -0
  658. package/references/opentasks/src/config/__tests__/schema.test.ts +446 -0
  659. package/references/opentasks/src/config/defaults.ts +18 -0
  660. package/references/opentasks/src/config/env.ts +170 -0
  661. package/references/opentasks/src/config/errors.ts +33 -0
  662. package/references/opentasks/src/config/index.ts +63 -0
  663. package/references/opentasks/src/config/loader.ts +90 -0
  664. package/references/opentasks/src/config/merge.ts +64 -0
  665. package/references/opentasks/src/config/schema.ts +767 -0
  666. package/references/opentasks/src/core/__tests__/conditional-redirects.test.ts +116 -0
  667. package/references/opentasks/src/core/__tests__/connections.test.ts +194 -0
  668. package/references/opentasks/src/core/__tests__/hash.test.ts +161 -0
  669. package/references/opentasks/src/core/__tests__/id.test.ts +175 -0
  670. package/references/opentasks/src/core/__tests__/init.test.ts +115 -0
  671. package/references/opentasks/src/core/__tests__/location.test.ts +94 -0
  672. package/references/opentasks/src/core/__tests__/merge-driver.test.ts +300 -0
  673. package/references/opentasks/src/core/__tests__/redirects.test.ts +169 -0
  674. package/references/opentasks/src/core/__tests__/resolve-location-target.test.ts +468 -0
  675. package/references/opentasks/src/core/__tests__/uri.test.ts +228 -0
  676. package/references/opentasks/src/core/__tests__/worktree.test.ts +160 -0
  677. package/references/opentasks/src/core/conditional-redirects.ts +100 -0
  678. package/references/opentasks/src/core/connections.ts +217 -0
  679. package/references/opentasks/src/core/discover.ts +195 -0
  680. package/references/opentasks/src/core/hash.ts +74 -0
  681. package/references/opentasks/src/core/id.ts +174 -0
  682. package/references/opentasks/src/core/index.ts +108 -0
  683. package/references/opentasks/src/core/init.ts +66 -0
  684. package/references/opentasks/src/core/location.ts +139 -0
  685. package/references/opentasks/src/core/merge-driver.ts +280 -0
  686. package/references/opentasks/src/core/redirects.ts +182 -0
  687. package/references/opentasks/src/core/uri.ts +270 -0
  688. package/references/opentasks/src/core/worktree.ts +504 -0
  689. package/references/opentasks/src/daemon/__tests__/e2e-live-agent.test.ts +344 -0
  690. package/references/opentasks/src/daemon/__tests__/e2e-session-pipeline.test.ts +447 -0
  691. package/references/opentasks/src/daemon/__tests__/e2e-watch.test.ts +279 -0
  692. package/references/opentasks/src/daemon/__tests__/entire-linker.test.ts +1074 -0
  693. package/references/opentasks/src/daemon/__tests__/entire-watcher.test.ts +659 -0
  694. package/references/opentasks/src/daemon/__tests__/flush.test.ts +306 -0
  695. package/references/opentasks/src/daemon/__tests__/integration.test.ts +338 -0
  696. package/references/opentasks/src/daemon/__tests__/ipc.test.ts +406 -0
  697. package/references/opentasks/src/daemon/__tests__/lifecycle.test.ts +378 -0
  698. package/references/opentasks/src/daemon/__tests__/lock.test.ts +240 -0
  699. package/references/opentasks/src/daemon/__tests__/methods/graph.test.ts +372 -0
  700. package/references/opentasks/src/daemon/__tests__/methods/provider.test.ts +238 -0
  701. package/references/opentasks/src/daemon/__tests__/methods/tools.test.ts +690 -0
  702. package/references/opentasks/src/daemon/__tests__/multi-location.test.ts +945 -0
  703. package/references/opentasks/src/daemon/__tests__/registry.test.ts +268 -0
  704. package/references/opentasks/src/daemon/__tests__/watcher.test.ts +329 -0
  705. package/references/opentasks/src/daemon/entire-linker.ts +615 -0
  706. package/references/opentasks/src/daemon/entire-watcher.ts +415 -0
  707. package/references/opentasks/src/daemon/factory.ts +133 -0
  708. package/references/opentasks/src/daemon/flush.ts +168 -0
  709. package/references/opentasks/src/daemon/index.ts +120 -0
  710. package/references/opentasks/src/daemon/ipc.ts +491 -0
  711. package/references/opentasks/src/daemon/lifecycle.ts +1106 -0
  712. package/references/opentasks/src/daemon/location-state.ts +481 -0
  713. package/references/opentasks/src/daemon/lock.ts +168 -0
  714. package/references/opentasks/src/daemon/methods/__tests__/graph.test.ts +359 -0
  715. package/references/opentasks/src/daemon/methods/__tests__/provider.test.ts +227 -0
  716. package/references/opentasks/src/daemon/methods/__tests__/tools.test.ts +360 -0
  717. package/references/opentasks/src/daemon/methods/__tests__/watch.test.ts +656 -0
  718. package/references/opentasks/src/daemon/methods/archive.ts +193 -0
  719. package/references/opentasks/src/daemon/methods/graph.ts +274 -0
  720. package/references/opentasks/src/daemon/methods/lifecycle.ts +112 -0
  721. package/references/opentasks/src/daemon/methods/location.ts +118 -0
  722. package/references/opentasks/src/daemon/methods/provider.ts +159 -0
  723. package/references/opentasks/src/daemon/methods/tools.ts +221 -0
  724. package/references/opentasks/src/daemon/methods/watch.ts +206 -0
  725. package/references/opentasks/src/daemon/registry.ts +244 -0
  726. package/references/opentasks/src/daemon/types.ts +163 -0
  727. package/references/opentasks/src/daemon/watcher.ts +248 -0
  728. package/references/opentasks/src/entire/__tests__/agent-registry.test.ts +127 -0
  729. package/references/opentasks/src/entire/__tests__/claude-generator.test.ts +49 -0
  730. package/references/opentasks/src/entire/__tests__/commit-msg.test.ts +89 -0
  731. package/references/opentasks/src/entire/__tests__/cursor-agent.test.ts +224 -0
  732. package/references/opentasks/src/entire/__tests__/flush-sentinel.test.ts +93 -0
  733. package/references/opentasks/src/entire/__tests__/gemini-agent.test.ts +375 -0
  734. package/references/opentasks/src/entire/__tests__/git-hooks.test.ts +85 -0
  735. package/references/opentasks/src/entire/__tests__/hook-managers.test.ts +128 -0
  736. package/references/opentasks/src/entire/__tests__/opencode-agent.test.ts +329 -0
  737. package/references/opentasks/src/entire/__tests__/redaction.test.ts +143 -0
  738. package/references/opentasks/src/entire/__tests__/session-store.test.ts +83 -0
  739. package/references/opentasks/src/entire/__tests__/summarize.test.ts +346 -0
  740. package/references/opentasks/src/entire/__tests__/transcript-timestamp.test.ts +127 -0
  741. package/references/opentasks/src/entire/__tests__/types.test.ts +112 -0
  742. package/references/opentasks/src/entire/__tests__/utils.test.ts +296 -0
  743. package/references/opentasks/src/entire/__tests__/validation.test.ts +103 -0
  744. package/references/opentasks/src/entire/__tests__/worktree.test.ts +66 -0
  745. package/references/opentasks/src/entire/agent/registry.ts +143 -0
  746. package/references/opentasks/src/entire/agent/session-types.ts +117 -0
  747. package/references/opentasks/src/entire/agent/types.ts +217 -0
  748. package/references/opentasks/src/entire/commands/clean.ts +134 -0
  749. package/references/opentasks/src/entire/commands/disable.ts +85 -0
  750. package/references/opentasks/src/entire/commands/doctor.ts +152 -0
  751. package/references/opentasks/src/entire/commands/enable.ts +149 -0
  752. package/references/opentasks/src/entire/commands/explain.ts +271 -0
  753. package/references/opentasks/src/entire/commands/reset.ts +105 -0
  754. package/references/opentasks/src/entire/commands/resume.ts +194 -0
  755. package/references/opentasks/src/entire/commands/rewind.ts +204 -0
  756. package/references/opentasks/src/entire/commands/status.ts +150 -0
  757. package/references/opentasks/src/entire/config.ts +153 -0
  758. package/references/opentasks/src/entire/git-operations.ts +485 -0
  759. package/references/opentasks/src/entire/hooks/git-hooks.ts +171 -0
  760. package/references/opentasks/src/entire/hooks/lifecycle.ts +224 -0
  761. package/references/opentasks/src/entire/index.ts +644 -0
  762. package/references/opentasks/src/entire/security/redaction.ts +263 -0
  763. package/references/opentasks/src/entire/session/state-machine.ts +463 -0
  764. package/references/opentasks/src/entire/store/checkpoint-store.ts +489 -0
  765. package/references/opentasks/src/entire/store/native-store.ts +178 -0
  766. package/references/opentasks/src/entire/store/provider-types.ts +99 -0
  767. package/references/opentasks/src/entire/store/session-store.ts +233 -0
  768. package/references/opentasks/src/entire/strategy/attribution.ts +300 -0
  769. package/references/opentasks/src/entire/strategy/common.ts +222 -0
  770. package/references/opentasks/src/entire/strategy/content-overlap.ts +242 -0
  771. package/references/opentasks/src/entire/strategy/manual-commit.ts +1008 -0
  772. package/references/opentasks/src/entire/strategy/types.ts +285 -0
  773. package/references/opentasks/src/entire/summarize/claude-generator.ts +119 -0
  774. package/references/opentasks/src/entire/summarize/summarize.ts +432 -0
  775. package/references/opentasks/src/entire/types.ts +408 -0
  776. package/references/opentasks/src/entire/utils/chunk-files.ts +49 -0
  777. package/references/opentasks/src/entire/utils/commit-message.ts +65 -0
  778. package/references/opentasks/src/entire/utils/detect-agent.ts +36 -0
  779. package/references/opentasks/src/entire/utils/hook-managers.ts +118 -0
  780. package/references/opentasks/src/entire/utils/ide-tags.ts +32 -0
  781. package/references/opentasks/src/entire/utils/paths.ts +59 -0
  782. package/references/opentasks/src/entire/utils/preview-rewind.ts +86 -0
  783. package/references/opentasks/src/entire/utils/rewind-conflict.ts +121 -0
  784. package/references/opentasks/src/entire/utils/shadow-branch.ts +113 -0
  785. package/references/opentasks/src/entire/utils/string-utils.ts +46 -0
  786. package/references/opentasks/src/entire/utils/todo-extract.ts +193 -0
  787. package/references/opentasks/src/entire/utils/trailers.ts +190 -0
  788. package/references/opentasks/src/entire/utils/transcript-parse.ts +177 -0
  789. package/references/opentasks/src/entire/utils/transcript-timestamp.ts +61 -0
  790. package/references/opentasks/src/entire/utils/tree-ops.ts +227 -0
  791. package/references/opentasks/src/entire/utils/tty.ts +72 -0
  792. package/references/opentasks/src/entire/utils/validation.ts +67 -0
  793. package/references/opentasks/src/entire/utils/worktree.ts +58 -0
  794. package/references/opentasks/src/graph/EdgeTypeRegistry.ts +330 -0
  795. package/references/opentasks/src/graph/FederatedGraph.ts +796 -0
  796. package/references/opentasks/src/graph/GraphologyAdapter.ts +374 -0
  797. package/references/opentasks/src/graph/HydratingFederatedGraph.ts +533 -0
  798. package/references/opentasks/src/graph/__tests__/EdgeTypeRegistry.test.ts +263 -0
  799. package/references/opentasks/src/graph/__tests__/FederatedGraph.test.ts +821 -0
  800. package/references/opentasks/src/graph/__tests__/GraphologyAdapter.test.ts +408 -0
  801. package/references/opentasks/src/graph/__tests__/HydratingFederatedGraph.test.ts +735 -0
  802. package/references/opentasks/src/graph/__tests__/debounce.test.ts +276 -0
  803. package/references/opentasks/src/graph/__tests__/e2e-store-roundtrip.test.ts +349 -0
  804. package/references/opentasks/src/graph/__tests__/edge-cases.test.ts +595 -0
  805. package/references/opentasks/src/graph/__tests__/expansion.test.ts +304 -0
  806. package/references/opentasks/src/graph/__tests__/git-graph-syncer.test.ts +572 -0
  807. package/references/opentasks/src/graph/__tests__/provider-store.test.ts +1091 -0
  808. package/references/opentasks/src/graph/__tests__/query.test.ts +991 -0
  809. package/references/opentasks/src/graph/__tests__/store.test.ts +998 -0
  810. package/references/opentasks/src/graph/__tests__/sync.test.ts +178 -0
  811. package/references/opentasks/src/graph/__tests__/validation.test.ts +657 -0
  812. package/references/opentasks/src/graph/coordination.ts +454 -0
  813. package/references/opentasks/src/graph/debounce.ts +154 -0
  814. package/references/opentasks/src/graph/expansion.ts +364 -0
  815. package/references/opentasks/src/graph/git-graph-syncer.ts +321 -0
  816. package/references/opentasks/src/graph/history.ts +438 -0
  817. package/references/opentasks/src/graph/index.ts +145 -0
  818. package/references/opentasks/src/graph/provider-store.ts +1077 -0
  819. package/references/opentasks/src/graph/query.ts +651 -0
  820. package/references/opentasks/src/graph/store.ts +861 -0
  821. package/references/opentasks/src/graph/sync.ts +116 -0
  822. package/references/opentasks/src/graph/types.ts +420 -0
  823. package/references/opentasks/src/graph/validation.ts +520 -0
  824. package/references/opentasks/src/index.ts +270 -0
  825. package/references/opentasks/src/materialization/CLAUDE.md +88 -0
  826. package/references/opentasks/src/materialization/README.md +187 -0
  827. package/references/opentasks/src/materialization/__tests__/archive-methods.test.ts +194 -0
  828. package/references/opentasks/src/materialization/__tests__/archiver.test.ts +528 -0
  829. package/references/opentasks/src/materialization/__tests__/config.test.ts +123 -0
  830. package/references/opentasks/src/materialization/__tests__/git-remote-store.test.ts +533 -0
  831. package/references/opentasks/src/materialization/__tests__/graph-id.test.ts +82 -0
  832. package/references/opentasks/src/materialization/__tests__/http-remote-store.test.ts +263 -0
  833. package/references/opentasks/src/materialization/__tests__/materialize-before-archive.test.ts +246 -0
  834. package/references/opentasks/src/materialization/__tests__/remote-store-factory.test.ts +152 -0
  835. package/references/opentasks/src/materialization/__tests__/snapshot.test.ts +209 -0
  836. package/references/opentasks/src/materialization/archiver.ts +318 -0
  837. package/references/opentasks/src/materialization/git-archive-store.ts +568 -0
  838. package/references/opentasks/src/materialization/git-remote-store.ts +551 -0
  839. package/references/opentasks/src/materialization/graph-id.ts +173 -0
  840. package/references/opentasks/src/materialization/http-remote-store.ts +190 -0
  841. package/references/opentasks/src/materialization/index.ts +62 -0
  842. package/references/opentasks/src/materialization/remote-store-factory.ts +55 -0
  843. package/references/opentasks/src/materialization/snapshot.ts +230 -0
  844. package/references/opentasks/src/materialization/types.ts +410 -0
  845. package/references/opentasks/src/providers/__tests__/beads.test.ts +752 -0
  846. package/references/opentasks/src/providers/__tests__/claude-tasks.test.ts +485 -0
  847. package/references/opentasks/src/providers/__tests__/entire-e2e.test.ts +692 -0
  848. package/references/opentasks/src/providers/__tests__/entire-sessionlog-e2e.test.ts +1113 -0
  849. package/references/opentasks/src/providers/__tests__/entire.test.ts +1016 -0
  850. package/references/opentasks/src/providers/__tests__/from-config.test.ts +183 -0
  851. package/references/opentasks/src/providers/__tests__/global.test.ts +515 -0
  852. package/references/opentasks/src/providers/__tests__/materialization.test.ts +567 -0
  853. package/references/opentasks/src/providers/__tests__/native.test.ts +693 -0
  854. package/references/opentasks/src/providers/__tests__/registry.test.ts +232 -0
  855. package/references/opentasks/src/providers/beads.ts +1155 -0
  856. package/references/opentasks/src/providers/claude-tasks.ts +402 -0
  857. package/references/opentasks/src/providers/entire.ts +608 -0
  858. package/references/opentasks/src/providers/from-config.ts +210 -0
  859. package/references/opentasks/src/providers/global.ts +460 -0
  860. package/references/opentasks/src/providers/index.ts +147 -0
  861. package/references/opentasks/src/providers/location.ts +237 -0
  862. package/references/opentasks/src/providers/materialization.ts +346 -0
  863. package/references/opentasks/src/providers/native.ts +725 -0
  864. package/references/opentasks/src/providers/registry.ts +114 -0
  865. package/references/opentasks/src/providers/sudocode.ts +1292 -0
  866. package/references/opentasks/src/providers/sync.ts +485 -0
  867. package/references/opentasks/src/providers/traits/RelationshipQueryable.ts +169 -0
  868. package/references/opentasks/src/providers/traits/TaskManageable.ts +211 -0
  869. package/references/opentasks/src/providers/traits/Watchable.ts +260 -0
  870. package/references/opentasks/src/providers/traits/__tests__/RelationshipQueryable.test.ts +217 -0
  871. package/references/opentasks/src/providers/traits/__tests__/TaskManageable.test.ts +241 -0
  872. package/references/opentasks/src/providers/traits/index.ts +42 -0
  873. package/references/opentasks/src/providers/types.ts +439 -0
  874. package/references/opentasks/src/schema/__tests__/validation.test.ts +283 -0
  875. package/references/opentasks/src/schema/base.ts +88 -0
  876. package/references/opentasks/src/schema/edges.ts +78 -0
  877. package/references/opentasks/src/schema/index.ts +37 -0
  878. package/references/opentasks/src/schema/nodes.ts +119 -0
  879. package/references/opentasks/src/schema/storage.ts +130 -0
  880. package/references/opentasks/src/schema/validation.ts +209 -0
  881. package/references/opentasks/src/storage/__tests__/atomic-write.test.ts +227 -0
  882. package/references/opentasks/src/storage/__tests__/file-lock.test.ts +120 -0
  883. package/references/opentasks/src/storage/__tests__/jsonl.test.ts +267 -0
  884. package/references/opentasks/src/storage/__tests__/locked-writer.test.ts +134 -0
  885. package/references/opentasks/src/storage/__tests__/sqlite.test.ts +572 -0
  886. package/references/opentasks/src/storage/atomic-write.ts +86 -0
  887. package/references/opentasks/src/storage/file-lock.ts +215 -0
  888. package/references/opentasks/src/storage/index.ts +24 -0
  889. package/references/opentasks/src/storage/interface.ts +289 -0
  890. package/references/opentasks/src/storage/jsonl.ts +264 -0
  891. package/references/opentasks/src/storage/locked-writer.ts +140 -0
  892. package/references/opentasks/src/storage/sqlite-schema.ts +177 -0
  893. package/references/opentasks/src/storage/sqlite.ts +791 -0
  894. package/references/opentasks/src/tools/__tests__/annotate.test.ts +381 -0
  895. package/references/opentasks/src/tools/__tests__/link.test.ts +299 -0
  896. package/references/opentasks/src/tools/__tests__/query.test.ts +350 -0
  897. package/references/opentasks/src/tools/__tests__/task.test.ts +218 -0
  898. package/references/opentasks/src/tools/annotate.ts +277 -0
  899. package/references/opentasks/src/tools/index.ts +57 -0
  900. package/references/opentasks/src/tools/link.ts +163 -0
  901. package/references/opentasks/src/tools/query.ts +468 -0
  902. package/references/opentasks/src/tools/task.ts +213 -0
  903. package/references/opentasks/src/tools/types.ts +451 -0
  904. package/references/opentasks/src/tracking/__tests__/claude-tool-categorizer.test.ts +223 -0
  905. package/references/opentasks/src/tracking/__tests__/transcript-extractor.test.ts +262 -0
  906. package/references/opentasks/src/tracking/claude-tool-categorizer.ts +155 -0
  907. package/references/opentasks/src/tracking/index.ts +32 -0
  908. package/references/opentasks/src/tracking/skill-tracker.ts +322 -0
  909. package/references/opentasks/src/tracking/transcript-extractor.ts +225 -0
  910. package/references/opentasks/tests/e2e/helpers/assertions.ts +211 -0
  911. package/references/opentasks/tests/e2e/helpers/beads-helpers.ts +487 -0
  912. package/references/opentasks/tests/e2e/helpers/fixtures.ts +236 -0
  913. package/references/opentasks/tests/e2e/helpers/index.ts +122 -0
  914. package/references/opentasks/tests/e2e/helpers/sudocode-helpers.ts +341 -0
  915. package/references/opentasks/tests/e2e/helpers/system-setup.ts +504 -0
  916. package/references/opentasks/tests/e2e/helpers/test-agent.ts +504 -0
  917. package/references/opentasks/tests/e2e/infrastructure.e2e.test.ts +521 -0
  918. package/references/opentasks/tests/e2e/skill-tracking.e2e.test.ts +625 -0
  919. package/references/opentasks/tests/e2e/workflows/feedback-loop.e2e.test.ts +279 -0
  920. package/references/opentasks/tests/e2e/workflows/multi-agent.e2e.test.ts +304 -0
  921. package/references/opentasks/tests/e2e/workflows/provider-sync/background-sync.e2e.test.ts +292 -0
  922. package/references/opentasks/tests/e2e/workflows/provider-sync/beads-provider-compat.e2e.test.ts +249 -0
  923. package/references/opentasks/tests/e2e/workflows/provider-sync/cross-provider-edges.e2e.test.ts +407 -0
  924. package/references/opentasks/tests/e2e/workflows/provider-sync/federated-ready.e2e.test.ts +504 -0
  925. package/references/opentasks/tests/e2e/workflows/provider-sync/hydration.e2e.test.ts +340 -0
  926. package/references/opentasks/tests/e2e/workflows/provider-sync/materialization.e2e.test.ts +370 -0
  927. package/references/opentasks/tests/e2e/workflows/provider-sync/sudocode-provider-compat.e2e.test.ts +683 -0
  928. package/references/opentasks/tests/e2e/workflows/provider-sync/watchable-beads.e2e.test.ts +573 -0
  929. package/references/opentasks/tests/e2e/workflows/spec-driven.e2e.test.ts +244 -0
  930. package/references/opentasks/tests/e2e/worktree-location.e2e.test.ts +699 -0
  931. package/references/opentasks/tests/integration/daemon/helpers.ts +147 -0
  932. package/references/opentasks/tests/integration/daemon/ipc.integration.test.ts +343 -0
  933. package/references/opentasks/tests/integration/daemon/lifecycle.integration.test.ts +407 -0
  934. package/references/opentasks/tests/integration/graph/federated-graph.integration.test.ts +660 -0
  935. package/references/opentasks/tests/integration/helpers/flags.ts +28 -0
  936. package/references/opentasks/tests/integration/helpers/index.ts +47 -0
  937. package/references/opentasks/tests/integration/helpers/process.ts +133 -0
  938. package/references/opentasks/tests/integration/helpers/temp.ts +105 -0
  939. package/references/opentasks/tests/integration/helpers/wait.ts +133 -0
  940. package/references/opentasks/tests/integration/helpers.test.ts +120 -0
  941. package/references/opentasks/tests/integration/providers/beads-task-manageable.integration.test.ts +450 -0
  942. package/references/opentasks/tests/integration/providers/beads.integration.test.ts +388 -0
  943. package/references/opentasks/tests/integration/providers/native-task-manageable.integration.test.ts +667 -0
  944. package/references/opentasks/tests/integration/providers/sudocode-task-manageable.integration.test.ts +406 -0
  945. package/references/opentasks/tests/integration/providers/sudocode.integration.test.ts +342 -0
  946. package/references/opentasks/tests/integration/storage/jsonl-durability.integration.test.ts +390 -0
  947. package/references/opentasks/tests/integration/storage/sqlite-durability.integration.test.ts +527 -0
  948. package/references/opentasks/tests/integration/worktree/redirect-location-resolution.integration.test.ts +578 -0
  949. package/references/opentasks/tests/integration/worktree/worktree-flow.integration.test.ts +656 -0
  950. package/references/opentasks/tsconfig.json +18 -0
  951. package/references/opentasks/vitest.config.ts +27 -0
  952. package/references/opentasks/vitest.e2e.config.ts +35 -0
  953. package/references/opentasks/vitest.integration.config.ts +19 -0
  954. package/references/openteams/.claude/settings.json +6 -0
  955. package/references/openteams/CLAUDE.md +98 -0
  956. package/references/openteams/README.md +508 -0
  957. package/references/openteams/SKILL.md +198 -0
  958. package/references/openteams/design.md +250 -0
  959. package/references/openteams/docs/visual-editor-design.md +1225 -0
  960. package/references/openteams/editor/index.html +15 -0
  961. package/references/openteams/editor/package.json +39 -0
  962. package/references/openteams/editor/src/App.tsx +48 -0
  963. package/references/openteams/editor/src/components/canvas/Canvas.tsx +131 -0
  964. package/references/openteams/editor/src/components/canvas/QuickAddMenu.tsx +134 -0
  965. package/references/openteams/editor/src/components/edges/PeerRouteEdge.tsx +82 -0
  966. package/references/openteams/editor/src/components/edges/SignalFlowEdge.tsx +77 -0
  967. package/references/openteams/editor/src/components/edges/SpawnEdge.tsx +54 -0
  968. package/references/openteams/editor/src/components/inspector/ChannelInspector.tsx +158 -0
  969. package/references/openteams/editor/src/components/inspector/EdgeInspector.tsx +168 -0
  970. package/references/openteams/editor/src/components/inspector/Inspector.tsx +46 -0
  971. package/references/openteams/editor/src/components/inspector/RoleInspector.tsx +508 -0
  972. package/references/openteams/editor/src/components/inspector/TeamInspector.tsx +126 -0
  973. package/references/openteams/editor/src/components/nodes/ChannelNode.tsx +103 -0
  974. package/references/openteams/editor/src/components/nodes/RoleNode.tsx +157 -0
  975. package/references/openteams/editor/src/components/nodes/node-styles.ts +101 -0
  976. package/references/openteams/editor/src/components/sidebar/Sidebar.tsx +227 -0
  977. package/references/openteams/editor/src/components/toolbar/ExportModal.tsx +110 -0
  978. package/references/openteams/editor/src/components/toolbar/ImportModal.tsx +139 -0
  979. package/references/openteams/editor/src/components/toolbar/Toolbar.tsx +190 -0
  980. package/references/openteams/editor/src/hooks/use-autosave.ts +126 -0
  981. package/references/openteams/editor/src/hooks/use-keyboard.ts +106 -0
  982. package/references/openteams/editor/src/hooks/use-validation.ts +45 -0
  983. package/references/openteams/editor/src/index.css +245 -0
  984. package/references/openteams/editor/src/lib/auto-layout.ts +51 -0
  985. package/references/openteams/editor/src/lib/bundled-templates.ts +42 -0
  986. package/references/openteams/editor/src/lib/compiler.ts +75 -0
  987. package/references/openteams/editor/src/lib/load-template.ts +103 -0
  988. package/references/openteams/editor/src/lib/rebuild-edges.ts +104 -0
  989. package/references/openteams/editor/src/lib/serializer.ts +408 -0
  990. package/references/openteams/editor/src/lib/signal-catalog.ts +50 -0
  991. package/references/openteams/editor/src/lib/validator.ts +172 -0
  992. package/references/openteams/editor/src/main.tsx +10 -0
  993. package/references/openteams/editor/src/stores/canvas-store.ts +80 -0
  994. package/references/openteams/editor/src/stores/config-store.ts +243 -0
  995. package/references/openteams/editor/src/stores/history-store.ts +143 -0
  996. package/references/openteams/editor/src/stores/theme-store.ts +66 -0
  997. package/references/openteams/editor/src/stores/ui-store.ts +46 -0
  998. package/references/openteams/editor/src/stores/validation-store.ts +27 -0
  999. package/references/openteams/editor/src/types/editor.ts +74 -0
  1000. package/references/openteams/editor/src/vite-env.d.ts +1 -0
  1001. package/references/openteams/editor/tests/compiler.test.ts +151 -0
  1002. package/references/openteams/editor/tests/e2e-add-remove.test.ts +386 -0
  1003. package/references/openteams/editor/tests/e2e-components.test.tsx +424 -0
  1004. package/references/openteams/editor/tests/e2e-export-roundtrip.test.ts +299 -0
  1005. package/references/openteams/editor/tests/e2e-template-load.test.ts +204 -0
  1006. package/references/openteams/editor/tests/e2e-ui-store.test.ts +126 -0
  1007. package/references/openteams/editor/tests/e2e-undo-redo.test.ts +203 -0
  1008. package/references/openteams/editor/tests/e2e-validation.test.ts +307 -0
  1009. package/references/openteams/editor/tests/serializer.test.ts +142 -0
  1010. package/references/openteams/editor/tests/setup.ts +52 -0
  1011. package/references/openteams/editor/tests/validator.test.ts +92 -0
  1012. package/references/openteams/editor/tsconfig.json +21 -0
  1013. package/references/openteams/editor/tsconfig.tsbuildinfo +1 -0
  1014. package/references/openteams/editor/vite.config.ts +28 -0
  1015. package/references/openteams/examples/bmad-method/prompts/analyst/ROLE.md +16 -0
  1016. package/references/openteams/examples/bmad-method/prompts/analyst/SOUL.md +5 -0
  1017. package/references/openteams/examples/bmad-method/prompts/architect/ROLE.md +24 -0
  1018. package/references/openteams/examples/bmad-method/prompts/architect/SOUL.md +5 -0
  1019. package/references/openteams/examples/bmad-method/prompts/developer/ROLE.md +25 -0
  1020. package/references/openteams/examples/bmad-method/prompts/developer/SOUL.md +5 -0
  1021. package/references/openteams/examples/bmad-method/prompts/master/ROLE.md +21 -0
  1022. package/references/openteams/examples/bmad-method/prompts/master/SOUL.md +5 -0
  1023. package/references/openteams/examples/bmad-method/prompts/pm/ROLE.md +20 -0
  1024. package/references/openteams/examples/bmad-method/prompts/pm/SOUL.md +5 -0
  1025. package/references/openteams/examples/bmad-method/prompts/qa/ROLE.md +17 -0
  1026. package/references/openteams/examples/bmad-method/prompts/qa/SOUL.md +5 -0
  1027. package/references/openteams/examples/bmad-method/prompts/quick-flow-dev/ROLE.md +23 -0
  1028. package/references/openteams/examples/bmad-method/prompts/quick-flow-dev/SOUL.md +5 -0
  1029. package/references/openteams/examples/bmad-method/prompts/scrum-master/ROLE.md +27 -0
  1030. package/references/openteams/examples/bmad-method/prompts/scrum-master/SOUL.md +5 -0
  1031. package/references/openteams/examples/bmad-method/prompts/tech-writer/ROLE.md +21 -0
  1032. package/references/openteams/examples/bmad-method/prompts/tech-writer/SOUL.md +5 -0
  1033. package/references/openteams/examples/bmad-method/prompts/ux-designer/ROLE.md +16 -0
  1034. package/references/openteams/examples/bmad-method/prompts/ux-designer/SOUL.md +5 -0
  1035. package/references/openteams/examples/bmad-method/roles/analyst.yaml +9 -0
  1036. package/references/openteams/examples/bmad-method/roles/architect.yaml +9 -0
  1037. package/references/openteams/examples/bmad-method/roles/developer.yaml +8 -0
  1038. package/references/openteams/examples/bmad-method/roles/master.yaml +8 -0
  1039. package/references/openteams/examples/bmad-method/roles/pm.yaml +9 -0
  1040. package/references/openteams/examples/bmad-method/roles/qa.yaml +8 -0
  1041. package/references/openteams/examples/bmad-method/roles/quick-flow-dev.yaml +8 -0
  1042. package/references/openteams/examples/bmad-method/roles/scrum-master.yaml +9 -0
  1043. package/references/openteams/examples/bmad-method/roles/tech-writer.yaml +8 -0
  1044. package/references/openteams/examples/bmad-method/roles/ux-designer.yaml +8 -0
  1045. package/references/openteams/examples/bmad-method/team.yaml +161 -0
  1046. package/references/openteams/examples/bug-fix-pipeline/roles/fixer.yaml +9 -0
  1047. package/references/openteams/examples/bug-fix-pipeline/roles/investigator.yaml +8 -0
  1048. package/references/openteams/examples/bug-fix-pipeline/roles/pr-creator.yaml +6 -0
  1049. package/references/openteams/examples/bug-fix-pipeline/roles/triager.yaml +7 -0
  1050. package/references/openteams/examples/bug-fix-pipeline/roles/verifier.yaml +8 -0
  1051. package/references/openteams/examples/bug-fix-pipeline/team.yaml +88 -0
  1052. package/references/openteams/examples/codebase-migration/roles/assessor.yaml +7 -0
  1053. package/references/openteams/examples/codebase-migration/roles/migrator.yaml +9 -0
  1054. package/references/openteams/examples/codebase-migration/roles/planner.yaml +5 -0
  1055. package/references/openteams/examples/codebase-migration/roles/test-extractor.yaml +9 -0
  1056. package/references/openteams/examples/codebase-migration/roles/validator.yaml +7 -0
  1057. package/references/openteams/examples/codebase-migration/team.yaml +81 -0
  1058. package/references/openteams/examples/docs-sync/roles/adr-writer.yaml +7 -0
  1059. package/references/openteams/examples/docs-sync/roles/api-doc-writer.yaml +7 -0
  1060. package/references/openteams/examples/docs-sync/roles/change-detector.yaml +7 -0
  1061. package/references/openteams/examples/docs-sync/roles/doc-reviewer.yaml +7 -0
  1062. package/references/openteams/examples/docs-sync/roles/guide-writer.yaml +7 -0
  1063. package/references/openteams/examples/docs-sync/team.yaml +84 -0
  1064. package/references/openteams/examples/gsd/prompts/codebase-mapper/ROLE.md +17 -0
  1065. package/references/openteams/examples/gsd/prompts/codebase-mapper/SOUL.md +5 -0
  1066. package/references/openteams/examples/gsd/prompts/debugger/ROLE.md +25 -0
  1067. package/references/openteams/examples/gsd/prompts/debugger/SOUL.md +5 -0
  1068. package/references/openteams/examples/gsd/prompts/executor/ROLE.md +34 -0
  1069. package/references/openteams/examples/gsd/prompts/executor/SOUL.md +5 -0
  1070. package/references/openteams/examples/gsd/prompts/integration-checker/ROLE.md +18 -0
  1071. package/references/openteams/examples/gsd/prompts/integration-checker/SOUL.md +3 -0
  1072. package/references/openteams/examples/gsd/prompts/orchestrator/ROLE.md +42 -0
  1073. package/references/openteams/examples/gsd/prompts/orchestrator/SOUL.md +5 -0
  1074. package/references/openteams/examples/gsd/prompts/phase-researcher/ROLE.md +15 -0
  1075. package/references/openteams/examples/gsd/prompts/phase-researcher/SOUL.md +3 -0
  1076. package/references/openteams/examples/gsd/prompts/plan-checker/ROLE.md +17 -0
  1077. package/references/openteams/examples/gsd/prompts/plan-checker/SOUL.md +3 -0
  1078. package/references/openteams/examples/gsd/prompts/planner/ROLE.md +28 -0
  1079. package/references/openteams/examples/gsd/prompts/planner/SOUL.md +5 -0
  1080. package/references/openteams/examples/gsd/prompts/project-researcher/ROLE.md +16 -0
  1081. package/references/openteams/examples/gsd/prompts/project-researcher/SOUL.md +3 -0
  1082. package/references/openteams/examples/gsd/prompts/research-synthesizer/ROLE.md +13 -0
  1083. package/references/openteams/examples/gsd/prompts/research-synthesizer/SOUL.md +3 -0
  1084. package/references/openteams/examples/gsd/prompts/roadmapper/ROLE.md +14 -0
  1085. package/references/openteams/examples/gsd/prompts/roadmapper/SOUL.md +3 -0
  1086. package/references/openteams/examples/gsd/prompts/verifier/ROLE.md +19 -0
  1087. package/references/openteams/examples/gsd/prompts/verifier/SOUL.md +5 -0
  1088. package/references/openteams/examples/gsd/roles/codebase-mapper.yaml +8 -0
  1089. package/references/openteams/examples/gsd/roles/debugger.yaml +8 -0
  1090. package/references/openteams/examples/gsd/roles/executor.yaml +8 -0
  1091. package/references/openteams/examples/gsd/roles/integration-checker.yaml +8 -0
  1092. package/references/openteams/examples/gsd/roles/orchestrator.yaml +9 -0
  1093. package/references/openteams/examples/gsd/roles/phase-researcher.yaml +7 -0
  1094. package/references/openteams/examples/gsd/roles/plan-checker.yaml +8 -0
  1095. package/references/openteams/examples/gsd/roles/planner.yaml +8 -0
  1096. package/references/openteams/examples/gsd/roles/project-researcher.yaml +8 -0
  1097. package/references/openteams/examples/gsd/roles/research-synthesizer.yaml +7 -0
  1098. package/references/openteams/examples/gsd/roles/roadmapper.yaml +7 -0
  1099. package/references/openteams/examples/gsd/roles/verifier.yaml +8 -0
  1100. package/references/openteams/examples/gsd/team.yaml +154 -0
  1101. package/references/openteams/examples/incident-response/roles/communicator.yaml +5 -0
  1102. package/references/openteams/examples/incident-response/roles/fix-proposer.yaml +7 -0
  1103. package/references/openteams/examples/incident-response/roles/incident-triager.yaml +8 -0
  1104. package/references/openteams/examples/incident-response/roles/investigator.yaml +8 -0
  1105. package/references/openteams/examples/incident-response/team.yaml +68 -0
  1106. package/references/openteams/examples/pr-review-checks/roles/code-reviewer.yaml +7 -0
  1107. package/references/openteams/examples/pr-review-checks/roles/security-scanner.yaml +6 -0
  1108. package/references/openteams/examples/pr-review-checks/roles/summarizer.yaml +6 -0
  1109. package/references/openteams/examples/pr-review-checks/roles/test-checker.yaml +8 -0
  1110. package/references/openteams/examples/pr-review-checks/team.yaml +64 -0
  1111. package/references/openteams/examples/security-audit/roles/code-analyzer.yaml +6 -0
  1112. package/references/openteams/examples/security-audit/roles/dep-scanner.yaml +7 -0
  1113. package/references/openteams/examples/security-audit/roles/fixer.yaml +9 -0
  1114. package/references/openteams/examples/security-audit/roles/pr-creator.yaml +6 -0
  1115. package/references/openteams/examples/security-audit/roles/prioritizer.yaml +6 -0
  1116. package/references/openteams/examples/security-audit/roles/secrets-scanner.yaml +6 -0
  1117. package/references/openteams/examples/security-audit/roles/verifier.yaml +8 -0
  1118. package/references/openteams/examples/security-audit/team.yaml +102 -0
  1119. package/references/openteams/media/banner.png +0 -0
  1120. package/references/openteams/media/editor.png +0 -0
  1121. package/references/openteams/package-lock.json +4804 -0
  1122. package/references/openteams/package.json +58 -0
  1123. package/references/openteams/schema/role.schema.json +147 -0
  1124. package/references/openteams/schema/team.schema.json +311 -0
  1125. package/references/openteams/src/cli/editor.ts +170 -0
  1126. package/references/openteams/src/cli/generate.test.ts +191 -0
  1127. package/references/openteams/src/cli/generate.ts +242 -0
  1128. package/references/openteams/src/cli/prompt-utils.ts +42 -0
  1129. package/references/openteams/src/cli/template.test.ts +365 -0
  1130. package/references/openteams/src/cli/template.ts +205 -0
  1131. package/references/openteams/src/cli.ts +22 -0
  1132. package/references/openteams/src/generators/agent-prompt-generator.test.ts +426 -0
  1133. package/references/openteams/src/generators/agent-prompt-generator.ts +556 -0
  1134. package/references/openteams/src/generators/package-generator.test.ts +129 -0
  1135. package/references/openteams/src/generators/package-generator.ts +110 -0
  1136. package/references/openteams/src/generators/skill-generator.test.ts +274 -0
  1137. package/references/openteams/src/generators/skill-generator.ts +394 -0
  1138. package/references/openteams/src/index.ts +84 -0
  1139. package/references/openteams/src/template/builtins.test.ts +74 -0
  1140. package/references/openteams/src/template/builtins.ts +108 -0
  1141. package/references/openteams/src/template/install-service.test.ts +452 -0
  1142. package/references/openteams/src/template/install-service.ts +332 -0
  1143. package/references/openteams/src/template/loader.test.ts +1696 -0
  1144. package/references/openteams/src/template/loader.ts +804 -0
  1145. package/references/openteams/src/template/resolver.test.ts +304 -0
  1146. package/references/openteams/src/template/resolver.ts +251 -0
  1147. package/references/openteams/src/template/types.ts +229 -0
  1148. package/references/openteams/tsconfig.cjs.json +7 -0
  1149. package/references/openteams/tsconfig.esm.json +8 -0
  1150. package/references/openteams/tsconfig.json +16 -0
  1151. package/references/openteams/vitest.config.ts +9 -0
  1152. package/references/sessionlog/.husky/pre-commit +1 -0
  1153. package/references/sessionlog/.lintstagedrc.json +4 -0
  1154. package/references/sessionlog/.prettierignore +4 -0
  1155. package/references/sessionlog/.prettierrc.json +11 -0
  1156. package/references/sessionlog/LICENSE +21 -0
  1157. package/references/sessionlog/README.md +453 -0
  1158. package/references/sessionlog/eslint.config.js +58 -0
  1159. package/references/sessionlog/package-lock.json +3672 -0
  1160. package/references/sessionlog/package.json +65 -0
  1161. package/references/sessionlog/src/__tests__/agent-hooks.test.ts +570 -0
  1162. package/references/sessionlog/src/__tests__/agent-registry.test.ts +127 -0
  1163. package/references/sessionlog/src/__tests__/claude-code-hooks.test.ts +225 -0
  1164. package/references/sessionlog/src/__tests__/claude-generator.test.ts +46 -0
  1165. package/references/sessionlog/src/__tests__/commit-msg.test.ts +86 -0
  1166. package/references/sessionlog/src/__tests__/cursor-agent.test.ts +224 -0
  1167. package/references/sessionlog/src/__tests__/e2e-live.test.ts +890 -0
  1168. package/references/sessionlog/src/__tests__/event-log.test.ts +183 -0
  1169. package/references/sessionlog/src/__tests__/flush-sentinel.test.ts +105 -0
  1170. package/references/sessionlog/src/__tests__/gemini-agent.test.ts +375 -0
  1171. package/references/sessionlog/src/__tests__/git-hooks.test.ts +78 -0
  1172. package/references/sessionlog/src/__tests__/hook-managers.test.ts +121 -0
  1173. package/references/sessionlog/src/__tests__/lifecycle-tasks.test.ts +759 -0
  1174. package/references/sessionlog/src/__tests__/opencode-agent.test.ts +338 -0
  1175. package/references/sessionlog/src/__tests__/redaction.test.ts +136 -0
  1176. package/references/sessionlog/src/__tests__/session-repo.test.ts +353 -0
  1177. package/references/sessionlog/src/__tests__/session-store.test.ts +166 -0
  1178. package/references/sessionlog/src/__tests__/setup-ccweb.test.ts +466 -0
  1179. package/references/sessionlog/src/__tests__/skill-live.test.ts +461 -0
  1180. package/references/sessionlog/src/__tests__/summarize.test.ts +348 -0
  1181. package/references/sessionlog/src/__tests__/task-plan-e2e.test.ts +610 -0
  1182. package/references/sessionlog/src/__tests__/task-plan-live.test.ts +632 -0
  1183. package/references/sessionlog/src/__tests__/transcript-timestamp.test.ts +121 -0
  1184. package/references/sessionlog/src/__tests__/types.test.ts +166 -0
  1185. package/references/sessionlog/src/__tests__/utils.test.ts +333 -0
  1186. package/references/sessionlog/src/__tests__/validation.test.ts +103 -0
  1187. package/references/sessionlog/src/__tests__/worktree.test.ts +57 -0
  1188. package/references/sessionlog/src/agent/registry.ts +143 -0
  1189. package/references/sessionlog/src/agent/session-types.ts +113 -0
  1190. package/references/sessionlog/src/agent/types.ts +220 -0
  1191. package/references/sessionlog/src/cli.ts +597 -0
  1192. package/references/sessionlog/src/commands/clean.ts +133 -0
  1193. package/references/sessionlog/src/commands/disable.ts +84 -0
  1194. package/references/sessionlog/src/commands/doctor.ts +145 -0
  1195. package/references/sessionlog/src/commands/enable.ts +202 -0
  1196. package/references/sessionlog/src/commands/explain.ts +261 -0
  1197. package/references/sessionlog/src/commands/reset.ts +105 -0
  1198. package/references/sessionlog/src/commands/resume.ts +180 -0
  1199. package/references/sessionlog/src/commands/rewind.ts +195 -0
  1200. package/references/sessionlog/src/commands/setup-ccweb.ts +275 -0
  1201. package/references/sessionlog/src/commands/status.ts +172 -0
  1202. package/references/sessionlog/src/config.ts +165 -0
  1203. package/references/sessionlog/src/events/event-log.ts +126 -0
  1204. package/references/sessionlog/src/git-operations.ts +558 -0
  1205. package/references/sessionlog/src/hooks/git-hooks.ts +165 -0
  1206. package/references/sessionlog/src/hooks/lifecycle.ts +391 -0
  1207. package/references/sessionlog/src/index.ts +650 -0
  1208. package/references/sessionlog/src/security/redaction.ts +283 -0
  1209. package/references/sessionlog/src/session/state-machine.ts +452 -0
  1210. package/references/sessionlog/src/store/checkpoint-store.ts +509 -0
  1211. package/references/sessionlog/src/store/native-store.ts +173 -0
  1212. package/references/sessionlog/src/store/provider-types.ts +99 -0
  1213. package/references/sessionlog/src/store/session-store.ts +266 -0
  1214. package/references/sessionlog/src/strategy/attribution.ts +296 -0
  1215. package/references/sessionlog/src/strategy/common.ts +207 -0
  1216. package/references/sessionlog/src/strategy/content-overlap.ts +228 -0
  1217. package/references/sessionlog/src/strategy/manual-commit.ts +988 -0
  1218. package/references/sessionlog/src/strategy/types.ts +279 -0
  1219. package/references/sessionlog/src/summarize/claude-generator.ts +115 -0
  1220. package/references/sessionlog/src/summarize/summarize.ts +432 -0
  1221. package/references/sessionlog/src/types.ts +508 -0
  1222. package/references/sessionlog/src/utils/chunk-files.ts +49 -0
  1223. package/references/sessionlog/src/utils/commit-message.ts +65 -0
  1224. package/references/sessionlog/src/utils/detect-agent.ts +36 -0
  1225. package/references/sessionlog/src/utils/hook-managers.ts +125 -0
  1226. package/references/sessionlog/src/utils/ide-tags.ts +32 -0
  1227. package/references/sessionlog/src/utils/paths.ts +79 -0
  1228. package/references/sessionlog/src/utils/preview-rewind.ts +80 -0
  1229. package/references/sessionlog/src/utils/rewind-conflict.ts +121 -0
  1230. package/references/sessionlog/src/utils/shadow-branch.ts +109 -0
  1231. package/references/sessionlog/src/utils/string-utils.ts +46 -0
  1232. package/references/sessionlog/src/utils/todo-extract.ts +188 -0
  1233. package/references/sessionlog/src/utils/trailers.ts +187 -0
  1234. package/references/sessionlog/src/utils/transcript-parse.ts +177 -0
  1235. package/references/sessionlog/src/utils/transcript-timestamp.ts +59 -0
  1236. package/references/sessionlog/src/utils/tree-ops.ts +219 -0
  1237. package/references/sessionlog/src/utils/tty.ts +72 -0
  1238. package/references/sessionlog/src/utils/validation.ts +65 -0
  1239. package/references/sessionlog/src/utils/worktree.ts +58 -0
  1240. package/references/sessionlog/src/wire-types.ts +59 -0
  1241. package/references/sessionlog/templates/setup-env.sh +153 -0
  1242. package/references/sessionlog/tsconfig.json +18 -0
  1243. package/references/sessionlog/vitest.config.ts +12 -0
  1244. package/references/skill-tree/.claude/settings.json +6 -0
  1245. package/references/skill-tree/.sudocode/issues.jsonl +19 -0
  1246. package/references/skill-tree/.sudocode/specs.jsonl +3 -0
  1247. package/references/skill-tree/CLAUDE.md +132 -0
  1248. package/references/skill-tree/README.md +396 -0
  1249. package/references/skill-tree/docs/GAPS_v1.md +221 -0
  1250. package/references/skill-tree/docs/INTEGRATION_PLAN.md +467 -0
  1251. package/references/skill-tree/docs/TODOS.md +91 -0
  1252. package/references/skill-tree/docs/anthropic_skill_guide.md +1364 -0
  1253. package/references/skill-tree/docs/design/federated-skill-trees.md +524 -0
  1254. package/references/skill-tree/docs/design/multi-agent-sync.md +759 -0
  1255. package/references/skill-tree/docs/scraper/BRAINSTORM.md +583 -0
  1256. package/references/skill-tree/docs/scraper/POC_PLAN.md +420 -0
  1257. package/references/skill-tree/docs/scraper/README.md +170 -0
  1258. package/references/skill-tree/examples/basic-usage.ts +157 -0
  1259. package/references/skill-tree/package-lock.json +1852 -0
  1260. package/references/skill-tree/package.json +66 -0
  1261. package/references/skill-tree/plan.md +78 -0
  1262. package/references/skill-tree/scraper/README.md +123 -0
  1263. package/references/skill-tree/scraper/docs/DESIGN.md +683 -0
  1264. package/references/skill-tree/scraper/docs/PLAN.md +336 -0
  1265. package/references/skill-tree/scraper/drizzle.config.ts +10 -0
  1266. package/references/skill-tree/scraper/package-lock.json +6329 -0
  1267. package/references/skill-tree/scraper/package.json +68 -0
  1268. package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-description.md +7 -0
  1269. package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-name.md +7 -0
  1270. package/references/skill-tree/scraper/test/fixtures/minimal-skill/SKILL.md +27 -0
  1271. package/references/skill-tree/scraper/test/fixtures/skill-json/SKILL.json +21 -0
  1272. package/references/skill-tree/scraper/test/fixtures/skill-with-meta/SKILL.md +54 -0
  1273. package/references/skill-tree/scraper/test/fixtures/skill-with-meta/_meta.json +24 -0
  1274. package/references/skill-tree/scraper/test/fixtures/valid-skill/SKILL.md +93 -0
  1275. package/references/skill-tree/scraper/test/fixtures/valid-skill/_meta.json +22 -0
  1276. package/references/skill-tree/scraper/tsup.config.ts +14 -0
  1277. package/references/skill-tree/scraper/vitest.config.ts +17 -0
  1278. package/references/skill-tree/scripts/convert-to-vitest.ts +166 -0
  1279. package/references/skill-tree/skills/skill-writer/SKILL.md +339 -0
  1280. package/references/skill-tree/skills/skill-writer/references/examples.md +326 -0
  1281. package/references/skill-tree/skills/skill-writer/references/patterns.md +210 -0
  1282. package/references/skill-tree/skills/skill-writer/references/quality-checklist.md +123 -0
  1283. package/references/skill-tree/test/run-all.ts +106 -0
  1284. package/references/skill-tree/test/utils.ts +128 -0
  1285. package/references/skill-tree/vitest.config.ts +16 -0
  1286. package/references/swarmkit/LICENSE +21 -0
  1287. package/references/swarmkit/README.md +130 -0
  1288. package/references/swarmkit/docs/design.md +453 -0
  1289. package/references/swarmkit/docs/package-setup-reference.md +519 -0
  1290. package/references/swarmkit/package-lock.json +1938 -0
  1291. package/references/swarmkit/package.json +43 -0
  1292. package/references/swarmkit/src/cli.ts +41 -0
  1293. package/references/swarmkit/src/commands/add.ts +126 -0
  1294. package/references/swarmkit/src/commands/doctor.ts +117 -0
  1295. package/references/swarmkit/src/commands/hive.ts +279 -0
  1296. package/references/swarmkit/src/commands/init/phases/configure.ts +74 -0
  1297. package/references/swarmkit/src/commands/init/phases/global-setup.ts +104 -0
  1298. package/references/swarmkit/src/commands/init/phases/packages.ts +44 -0
  1299. package/references/swarmkit/src/commands/init/phases/project.ts +81 -0
  1300. package/references/swarmkit/src/commands/init/phases/use-case.ts +47 -0
  1301. package/references/swarmkit/src/commands/init/state.test.ts +23 -0
  1302. package/references/swarmkit/src/commands/init/state.ts +22 -0
  1303. package/references/swarmkit/src/commands/init/wizard.ts +160 -0
  1304. package/references/swarmkit/src/commands/init.ts +17 -0
  1305. package/references/swarmkit/src/commands/login.ts +106 -0
  1306. package/references/swarmkit/src/commands/logout.ts +22 -0
  1307. package/references/swarmkit/src/commands/remove.ts +72 -0
  1308. package/references/swarmkit/src/commands/status.ts +101 -0
  1309. package/references/swarmkit/src/commands/update.ts +62 -0
  1310. package/references/swarmkit/src/commands/whoami.ts +41 -0
  1311. package/references/swarmkit/src/config/global.test.ts +258 -0
  1312. package/references/swarmkit/src/config/global.ts +141 -0
  1313. package/references/swarmkit/src/config/keys.test.ts +109 -0
  1314. package/references/swarmkit/src/config/keys.ts +49 -0
  1315. package/references/swarmkit/src/doctor/checks.test.ts +366 -0
  1316. package/references/swarmkit/src/doctor/checks.ts +292 -0
  1317. package/references/swarmkit/src/doctor/types.ts +33 -0
  1318. package/references/swarmkit/src/hub/auth-flow.test.ts +127 -0
  1319. package/references/swarmkit/src/hub/auth-flow.ts +144 -0
  1320. package/references/swarmkit/src/hub/client.test.ts +224 -0
  1321. package/references/swarmkit/src/hub/client.ts +185 -0
  1322. package/references/swarmkit/src/hub/credentials.test.ts +132 -0
  1323. package/references/swarmkit/src/hub/credentials.ts +51 -0
  1324. package/references/swarmkit/src/index.ts +116 -0
  1325. package/references/swarmkit/src/packages/installer.test.ts +365 -0
  1326. package/references/swarmkit/src/packages/installer.ts +206 -0
  1327. package/references/swarmkit/src/packages/plugin.test.ts +141 -0
  1328. package/references/swarmkit/src/packages/plugin.ts +46 -0
  1329. package/references/swarmkit/src/packages/registry.test.ts +235 -0
  1330. package/references/swarmkit/src/packages/registry.ts +209 -0
  1331. package/references/swarmkit/src/packages/setup.test.ts +1395 -0
  1332. package/references/swarmkit/src/packages/setup.ts +671 -0
  1333. package/references/swarmkit/src/utils/ui.test.ts +115 -0
  1334. package/references/swarmkit/src/utils/ui.ts +62 -0
  1335. package/references/swarmkit/tsconfig.json +17 -0
  1336. package/references/swarmkit/vitest.config.ts +9 -0
  1337. package/scripts/bootstrap.mjs +26 -1
  1338. package/scripts/generate-agents.mjs +5 -1
  1339. package/scripts/map-hook.mjs +97 -64
  1340. package/scripts/map-sidecar.mjs +179 -25
  1341. package/scripts/team-loader.mjs +12 -41
  1342. package/skills/swarm/SKILL.md +89 -25
  1343. package/src/__tests__/agent-generator.test.mjs +6 -13
  1344. package/src/__tests__/bootstrap.test.mjs +124 -1
  1345. package/src/__tests__/config.test.mjs +72 -27
  1346. package/src/__tests__/e2e-live-map.test.mjs +536 -0
  1347. package/src/__tests__/e2e-mesh-sidecar.test.mjs +570 -0
  1348. package/src/__tests__/e2e-native-task-hooks.test.mjs +376 -0
  1349. package/src/__tests__/e2e-sidecar-bridge.test.mjs +477 -0
  1350. package/src/__tests__/helpers.mjs +13 -0
  1351. package/src/__tests__/inbox.test.mjs +22 -89
  1352. package/src/__tests__/index.test.mjs +33 -9
  1353. package/src/__tests__/integration.test.mjs +513 -0
  1354. package/src/__tests__/map-events.test.mjs +514 -150
  1355. package/src/__tests__/mesh-connection.test.mjs +308 -0
  1356. package/src/__tests__/opentasks-client.test.mjs +517 -0
  1357. package/src/__tests__/paths.test.mjs +185 -54
  1358. package/src/__tests__/sidecar-client.test.mjs +35 -0
  1359. package/src/__tests__/sidecar-server.test.mjs +124 -0
  1360. package/src/__tests__/skilltree-client.test.mjs +80 -0
  1361. package/src/agent-generator.mjs +104 -33
  1362. package/src/bootstrap.mjs +150 -10
  1363. package/src/config.mjs +35 -1
  1364. package/src/context-output.mjs +58 -8
  1365. package/src/inbox.mjs +9 -54
  1366. package/src/index.mjs +36 -7
  1367. package/src/map-connection.mjs +1 -0
  1368. package/src/map-events.mjs +350 -80
  1369. package/src/mesh-connection.mjs +148 -0
  1370. package/src/opentasks-client.mjs +269 -0
  1371. package/src/paths.mjs +178 -28
  1372. package/src/sessionlog.mjs +14 -9
  1373. package/src/sidecar-client.mjs +79 -25
  1374. package/src/sidecar-server.mjs +175 -16
  1375. package/src/skilltree-client.mjs +173 -0
  1376. package/src/template.mjs +68 -4
  1377. package/vitest.config.mjs +1 -0
@@ -0,0 +1,988 @@
1
+ /**
2
+ * Manual Commit Strategy
3
+ *
4
+ * Core strategy implementation that orchestrates session tracking,
5
+ * checkpoint creation, condensation, and git hook integration.
6
+ *
7
+ * Data flow:
8
+ * 1. InitializeSession -> Creates SessionState, calculates initial attribution
9
+ * 2. SaveStep/SaveTaskStep -> Writes to shadow branch via CheckpointStore
10
+ * 3. PrepareCommitMsg -> Adds Sessionlog-Checkpoint trailer to commit messages
11
+ * 4. PostCommit -> Condenses session data, handles carry-forward
12
+ * 5. PrePush -> Pushes metadata branch alongside user push
13
+ */
14
+
15
+ import * as fs from 'node:fs';
16
+ import * as path from 'node:path';
17
+ import type { SessionStore } from '../store/session-store.js';
18
+ import type { CheckpointStore } from '../store/checkpoint-store.js';
19
+ import type { SessionState, CheckpointID } from '../types.js';
20
+ import {
21
+ addTokenUsage,
22
+ CHECKPOINTS_BRANCH,
23
+ SHADOW_BRANCH_PREFIX,
24
+ validateCheckpointID,
25
+ } from '../types.js';
26
+ import {
27
+ git,
28
+ gitSafe,
29
+ getHead,
30
+ getCurrentBranch,
31
+ getWorktreeRoot,
32
+ getGitAuthor,
33
+ getUntrackedFiles,
34
+ refExists,
35
+ pushBranch,
36
+ hasUncommittedChanges,
37
+ listBranches,
38
+ showFile,
39
+ lsTree,
40
+ deleteBranch,
41
+ updateRef,
42
+ diffNameOnly,
43
+ } from '../git-operations.js';
44
+ import { parseCheckpoint, formatShadowCommit, CheckpointTrailerKey } from '../utils/trailers.js';
45
+ import {
46
+ filesOverlapWithContent,
47
+ stagedFilesOverlapWithContent,
48
+ filesWithRemainingAgentChanges,
49
+ } from './content-overlap.js';
50
+ import type {
51
+ Strategy,
52
+ StepContext,
53
+ TaskStepContext,
54
+ CondensationResult,
55
+ RewindPoint,
56
+ OrphanedItem,
57
+ } from './types.js';
58
+ import { STRATEGY_NAME_MANUAL_COMMIT, formatSubagentEndMessage } from './types.js';
59
+ import { appendCheckpointEvent } from '../events/event-log.js';
60
+
61
+ // ============================================================================
62
+ // ManualCommitStrategy
63
+ // ============================================================================
64
+
65
+ export interface ManualCommitStrategyConfig {
66
+ sessionStore: SessionStore;
67
+ checkpointStore: CheckpointStore;
68
+ cwd?: string;
69
+ /** When a separate session repo is configured, this is its working directory.
70
+ * Used for pushing the checkpoints branch from the correct repo. */
71
+ sessionRepoCwd?: string;
72
+ /** Override for the checkpoints branch name (e.g. project-namespaced). */
73
+ checkpointsBranch?: string;
74
+ /** Enable the JSONL event log (.sessionlog/events.jsonl).
75
+ * When true, checkpoint events are appended after each commit. */
76
+ eventLogEnabled?: boolean;
77
+ /** Maximum number of events to retain in the event log file.
78
+ * When set, the log is pruned to this many entries after each write.
79
+ * 0 or undefined means keep all events. */
80
+ eventLogMaxEvents?: number;
81
+ }
82
+
83
+ export function createManualCommitStrategy(config: ManualCommitStrategyConfig): Strategy {
84
+ const { sessionStore, checkpointStore, cwd, sessionRepoCwd } = config;
85
+ /** The cwd for operations on the committed checkpoints branch */
86
+ const committedCwd = sessionRepoCwd ?? cwd;
87
+ /** Branch name for committed checkpoints */
88
+ const cpBranch = config.checkpointsBranch ?? CHECKPOINTS_BRANCH;
89
+
90
+ // ========================================================================
91
+ // Session State Helpers
92
+ // ========================================================================
93
+
94
+ async function loadSession(sessionID: string): Promise<SessionState | null> {
95
+ return sessionStore.load(sessionID);
96
+ }
97
+
98
+ async function saveSession(state: SessionState): Promise<void> {
99
+ await sessionStore.save(state);
100
+ }
101
+
102
+ async function listAllSessions(): Promise<SessionState[]> {
103
+ return sessionStore.list();
104
+ }
105
+
106
+ async function findSessionsForCommit(baseCommitSHA: string): Promise<SessionState[]> {
107
+ const all = await listAllSessions();
108
+ return all.filter((s) => s.baseCommit === baseCommitSHA);
109
+ }
110
+
111
+ function getShadowBranchName(baseCommit: string, worktreeID?: string): string {
112
+ return checkpointStore.getShadowBranchName(baseCommit, worktreeID);
113
+ }
114
+
115
+ // ========================================================================
116
+ // File Merging Helpers
117
+ // ========================================================================
118
+
119
+ function mergeFilesTouched(existing: string[], ...fileLists: string[][]): string[] {
120
+ const seen = new Set(existing);
121
+ for (const list of fileLists) {
122
+ for (const f of list) seen.add(f);
123
+ }
124
+ return Array.from(seen).sort();
125
+ }
126
+
127
+ // ========================================================================
128
+ // Strategy Implementation
129
+ // ========================================================================
130
+
131
+ const strategy: Strategy = {
132
+ name: STRATEGY_NAME_MANUAL_COMMIT,
133
+
134
+ // ======================================================================
135
+ // PrepareCommitMsg - Add checkpoint trailer to commit messages
136
+ // ======================================================================
137
+ async prepareCommitMsg(commitMsgFile: string, source: string, _sha: string): Promise<void> {
138
+ // Read the current commit message
139
+ const commitMsg = fs.readFileSync(commitMsgFile, 'utf-8');
140
+
141
+ // Skip merge commits
142
+ if (source === 'merge') return;
143
+
144
+ // Handle amend: preserve existing checkpoint trailer
145
+ if (source === 'commit') {
146
+ const [cpID, found] = parseCheckpoint(commitMsg);
147
+ if (found && cpID) {
148
+ // Trailer already present, nothing to do
149
+ return;
150
+ }
151
+ }
152
+
153
+ // Get current HEAD
154
+ const head = await getHead(cwd);
155
+
156
+ // Find active sessions for this commit
157
+ const sessions = await findSessionsForCommit(head);
158
+ if (sessions.length === 0) return;
159
+
160
+ // Get staged files
161
+ const stagedOutput = await gitSafe(
162
+ ['diff', '--cached', '--name-only', '--diff-filter=ACMRD'],
163
+ { cwd },
164
+ );
165
+ if (!stagedOutput) return;
166
+ const stagedFiles = stagedOutput
167
+ .trim()
168
+ .split('\n')
169
+ .filter((f) => f.length > 0);
170
+ if (stagedFiles.length === 0) return;
171
+
172
+ // Check if any session has overlapping work
173
+ let hasOverlap = false;
174
+ let overlappingSession: SessionState | null = null;
175
+
176
+ for (const state of sessions) {
177
+ if (state.stepCount === 0 || state.filesTouched.length === 0) continue;
178
+
179
+ const shadowBranch = getShadowBranchName(state.baseCommit, state.worktreeID);
180
+ const exists = await refExists(`refs/heads/${shadowBranch}`, cwd);
181
+ if (!exists) continue;
182
+
183
+ // Content-aware overlap check
184
+ const overlap = await stagedFilesOverlapWithContent(
185
+ shadowBranch,
186
+ stagedFiles,
187
+ state.filesTouched,
188
+ cwd,
189
+ );
190
+
191
+ if (overlap) {
192
+ hasOverlap = true;
193
+ overlappingSession = state;
194
+ break;
195
+ }
196
+ }
197
+
198
+ // Fallback: handle active sessions where the agent is committing mid-turn.
199
+ // At this point TurnEnd hasn't fired, so stepCount/filesTouched/shadow branch
200
+ // may not exist yet. Use staged files as a proxy for agent work.
201
+ if (!hasOverlap) {
202
+ for (const state of sessions) {
203
+ if (state.phase !== 'active') continue;
204
+
205
+ try {
206
+ const shadowBranch = getShadowBranchName(state.baseCommit, state.worktreeID);
207
+ let shadowExists = await refExists(`refs/heads/${shadowBranch}`, cwd);
208
+
209
+ if (!shadowExists) {
210
+ const author = await getGitAuthor(cwd);
211
+ // Use flat name (no slashes) — mergeMetadataIntoTree can't handle nested paths
212
+ const metadataDir = `sessionlog-${state.sessionID}`;
213
+ const result = await checkpointStore.writeTemporary({
214
+ sessionID: state.sessionID,
215
+ baseCommit: state.baseCommit,
216
+ worktreeID: state.worktreeID,
217
+ modifiedFiles: stagedFiles,
218
+ newFiles: [],
219
+ deletedFiles: [],
220
+ metadataDir,
221
+ metadataDirAbs: path.resolve(cwd ?? '.', metadataDir),
222
+ commitMessage: formatShadowCommit(
223
+ `Checkpoint: ${stagedFiles.length} file(s)`,
224
+ metadataDir,
225
+ state.sessionID,
226
+ ),
227
+ authorName: author.name,
228
+ authorEmail: author.email,
229
+ isFirstCheckpoint: true,
230
+ });
231
+ if (!result.skipped) {
232
+ shadowExists = true;
233
+ }
234
+ }
235
+
236
+ if (shadowExists) {
237
+ // Update session state so postCommit can process it
238
+ state.stepCount = Math.max(state.stepCount, 1);
239
+ state.filesTouched = mergeFilesTouched(state.filesTouched, stagedFiles);
240
+ await saveSession(state);
241
+ hasOverlap = true;
242
+ overlappingSession = state;
243
+ break;
244
+ }
245
+ } catch {
246
+ // Non-fatal
247
+ }
248
+ }
249
+ }
250
+
251
+ if (!hasOverlap || !overlappingSession) return;
252
+
253
+ // Generate or reuse checkpoint ID
254
+ let cpID: CheckpointID;
255
+ if (
256
+ overlappingSession.lastCheckpointID &&
257
+ validateCheckpointID(overlappingSession.lastCheckpointID)
258
+ ) {
259
+ cpID = overlappingSession.lastCheckpointID;
260
+ } else {
261
+ cpID = await checkpointStore.generateID();
262
+ }
263
+
264
+ // Inject trailer into commit message
265
+ const trailer = `${CheckpointTrailerKey}: ${cpID}`;
266
+ const injected = injectCheckpointTrailer(commitMsg, trailer);
267
+ fs.writeFileSync(commitMsgFile, injected, 'utf-8');
268
+ },
269
+
270
+ // ======================================================================
271
+ // PostCommit - Condense session data after commit
272
+ // ======================================================================
273
+ async postCommit(): Promise<void> {
274
+ // Read HEAD commit message
275
+ const headHash = await getHead(cwd);
276
+ const commitMsg = await git(['log', '-1', '--format=%B', headHash], { cwd });
277
+
278
+ // Check for checkpoint trailer
279
+ const [cpID, found] = parseCheckpoint(commitMsg);
280
+ if (!found || !cpID) return;
281
+
282
+ // Find sessions for the parent commit (our base)
283
+ const parentHash = await gitSafe(['rev-parse', `${headHash}^`], { cwd });
284
+ if (!parentHash) return;
285
+
286
+ const sessions = await findSessionsForCommit(parentHash.trim());
287
+ if (sessions.length === 0) return;
288
+
289
+ // Get files changed in this commit
290
+ const { added, modified, deleted } = await diffNameOnly(`${headHash}^`, headHash, cwd);
291
+ const committedFiles = new Set([...added, ...modified, ...deleted]);
292
+
293
+ // Process each session
294
+ for (const state of sessions) {
295
+ if (state.stepCount === 0 || state.filesTouched.length === 0) continue;
296
+
297
+ const shadowBranch = getShadowBranchName(state.baseCommit, state.worktreeID);
298
+ const exists = await refExists(`refs/heads/${shadowBranch}`, cwd);
299
+ if (!exists) continue;
300
+
301
+ // Check overlap with committed files
302
+ const overlap = await filesOverlapWithContent(
303
+ shadowBranch,
304
+ headHash,
305
+ parentHash.trim(),
306
+ state.filesTouched,
307
+ cwd,
308
+ );
309
+ if (!overlap) continue;
310
+
311
+ // Condense this session
312
+ try {
313
+ await condenseSession(state, cpID, committedFiles);
314
+ } catch {
315
+ // Log but continue with other sessions
316
+ }
317
+
318
+ // Handle carry-forward for remaining files
319
+ const remaining = await filesWithRemainingAgentChanges(
320
+ shadowBranch,
321
+ headHash,
322
+ state.filesTouched,
323
+ committedFiles,
324
+ cwd,
325
+ );
326
+
327
+ if (remaining.length === 0) {
328
+ // All files committed - clean up shadow branch
329
+ try {
330
+ await checkpointStore.deleteShadowBranch(shadowBranch);
331
+ } catch {
332
+ // Best effort cleanup
333
+ }
334
+
335
+ // Update session for new base commit
336
+ state.baseCommit = headHash;
337
+ state.stepCount = 0;
338
+ state.filesTouched = [];
339
+ state.promptAttributions = [];
340
+ state.lastCheckpointID = cpID;
341
+ await saveSession(state);
342
+ } else {
343
+ // Carry forward: update state for remaining files
344
+ state.baseCommit = headHash;
345
+ state.filesTouched = remaining;
346
+ state.stepCount = 0;
347
+ state.promptAttributions = [];
348
+ state.lastCheckpointID = cpID;
349
+ await saveSession(state);
350
+ }
351
+ }
352
+ },
353
+
354
+ // ======================================================================
355
+ // CommitMsg - Strip trailer if no user content (prevents empty commits)
356
+ // ======================================================================
357
+ async commitMsg(commitMsgFile: string): Promise<void> {
358
+ let content: string;
359
+ try {
360
+ content = fs.readFileSync(commitMsgFile, 'utf-8');
361
+ } catch {
362
+ return; // Hook must be silent on failure
363
+ }
364
+
365
+ // Check if our trailer is present
366
+ const [, found] = parseCheckpoint(content);
367
+ if (!found) return;
368
+
369
+ // Check if there's any user content (non-comment, non-trailer lines)
370
+ if (!hasUserContent(content)) {
371
+ // No user content - strip the trailer so git aborts the commit
372
+ const stripped = stripCheckpointTrailer(content);
373
+ try {
374
+ fs.writeFileSync(commitMsgFile, stripped, 'utf-8');
375
+ } catch {
376
+ // Hook must be silent on failure
377
+ }
378
+ }
379
+ },
380
+
381
+ // ======================================================================
382
+ // PrePush - Push metadata branch alongside user push
383
+ // ======================================================================
384
+ async prePush(remote: string): Promise<void> {
385
+ const pushCwd = committedCwd;
386
+ const branchExists = await refExists(`refs/heads/${cpBranch}`, pushCwd);
387
+ if (!branchExists) return;
388
+
389
+ try {
390
+ await pushBranch(remote, cpBranch, false, pushCwd);
391
+ } catch {
392
+ // Non-fatal: metadata push failure shouldn't block user push
393
+ }
394
+ },
395
+
396
+ // ======================================================================
397
+ // SaveStep - Create session checkpoint on shadow branch
398
+ // ======================================================================
399
+ async saveStep(step: StepContext): Promise<void> {
400
+ const sessionID = path.basename(step.metadataDir);
401
+ let state = await loadSession(sessionID);
402
+
403
+ // Initialize if needed
404
+ if (!state || !state.baseCommit) {
405
+ const head = await getHead(cwd);
406
+ const untrackedFiles = await getUntrackedFiles(cwd);
407
+ const worktreeRoot = await getWorktreeRoot(cwd);
408
+
409
+ state = {
410
+ sessionID,
411
+ baseCommit: head,
412
+ attributionBaseCommit: head,
413
+ startedAt: new Date().toISOString(),
414
+ phase: 'active',
415
+ turnCheckpointIDs: [],
416
+ stepCount: 0,
417
+ checkpointTranscriptStart: 0,
418
+ untrackedFilesAtStart: untrackedFiles,
419
+ filesTouched: [],
420
+ agentType: step.agentType,
421
+ worktreePath: worktreeRoot,
422
+ };
423
+ await saveSession(state);
424
+ }
425
+
426
+ // Migrate shadow branch if HEAD changed (rebase/pull mid-session)
427
+ await migrateAndPersist(state);
428
+
429
+ // Write temporary checkpoint
430
+ const isFirstCheckpoint = state.stepCount === 0;
431
+ const result = await checkpointStore.writeTemporary({
432
+ sessionID,
433
+ baseCommit: state.baseCommit,
434
+ worktreeID: state.worktreeID,
435
+ modifiedFiles: step.modifiedFiles,
436
+ newFiles: step.newFiles,
437
+ deletedFiles: step.deletedFiles,
438
+ metadataDir: step.metadataDir,
439
+ metadataDirAbs: step.metadataDirAbs,
440
+ commitMessage: step.commitMessage,
441
+ authorName: step.authorName,
442
+ authorEmail: step.authorEmail,
443
+ isFirstCheckpoint,
444
+ });
445
+
446
+ if (result.skipped) return;
447
+
448
+ // Update session state
449
+ state.stepCount++;
450
+ state.filesTouched = mergeFilesTouched(
451
+ state.filesTouched,
452
+ step.modifiedFiles,
453
+ step.newFiles,
454
+ step.deletedFiles,
455
+ );
456
+
457
+ if (state.stepCount === 1 && step.stepTranscriptIdentifier) {
458
+ state.transcriptIdentifierAtStart = step.stepTranscriptIdentifier;
459
+ }
460
+
461
+ if (step.tokenUsage) {
462
+ state.tokenUsage = state.tokenUsage
463
+ ? addTokenUsage(state.tokenUsage, step.tokenUsage)
464
+ : step.tokenUsage;
465
+ }
466
+
467
+ await saveSession(state);
468
+ },
469
+
470
+ // ======================================================================
471
+ // SaveTaskStep - Create task checkpoint on shadow branch
472
+ // ======================================================================
473
+ async saveTaskStep(step: TaskStepContext): Promise<void> {
474
+ let state = await loadSession(step.sessionID);
475
+
476
+ if (!state || !state.baseCommit) {
477
+ const head = await getHead(cwd);
478
+ const untrackedFiles = await getUntrackedFiles(cwd);
479
+ const worktreeRoot = await getWorktreeRoot(cwd);
480
+
481
+ state = {
482
+ sessionID: step.sessionID,
483
+ baseCommit: head,
484
+ attributionBaseCommit: head,
485
+ startedAt: new Date().toISOString(),
486
+ phase: 'active',
487
+ turnCheckpointIDs: [],
488
+ stepCount: 0,
489
+ checkpointTranscriptStart: 0,
490
+ untrackedFilesAtStart: untrackedFiles,
491
+ filesTouched: [],
492
+ agentType: step.agentType,
493
+ worktreePath: worktreeRoot,
494
+ };
495
+ await saveSession(state);
496
+ }
497
+
498
+ // Migrate shadow branch if HEAD changed (rebase/pull mid-session)
499
+ await migrateAndPersist(state);
500
+
501
+ // Generate commit message for task checkpoint
502
+ const shortToolUseID =
503
+ step.toolUseID.length > 7 ? step.toolUseID.slice(0, 7) : step.toolUseID;
504
+ const messageSubject = formatSubagentEndMessage(
505
+ step.subagentType,
506
+ step.taskDescription,
507
+ shortToolUseID,
508
+ );
509
+ const metadataDir = `.sessionlog/metadata/${step.sessionID}/tasks/${step.toolUseID}`;
510
+ const commitMsg = formatShadowCommit(messageSubject, metadataDir, step.sessionID);
511
+
512
+ // Write temporary checkpoint
513
+ await checkpointStore.writeTemporary({
514
+ sessionID: step.sessionID,
515
+ baseCommit: state.baseCommit,
516
+ worktreeID: state.worktreeID,
517
+ modifiedFiles: step.modifiedFiles,
518
+ newFiles: step.newFiles,
519
+ deletedFiles: step.deletedFiles,
520
+ metadataDir,
521
+ metadataDirAbs: path.resolve(cwd ?? '.', metadataDir),
522
+ commitMessage: commitMsg,
523
+ authorName: step.authorName,
524
+ authorEmail: step.authorEmail,
525
+ isFirstCheckpoint: state.stepCount === 0,
526
+ });
527
+
528
+ // Update session state
529
+ state.filesTouched = mergeFilesTouched(
530
+ state.filesTouched,
531
+ step.modifiedFiles,
532
+ step.newFiles,
533
+ step.deletedFiles,
534
+ );
535
+ await saveSession(state);
536
+ },
537
+
538
+ // ======================================================================
539
+ // Rewind operations
540
+ // ======================================================================
541
+ async getRewindPoints(limit: number): Promise<RewindPoint[]> {
542
+ const head = await getHead(cwd);
543
+ const sessions = await findSessionsForCommit(head);
544
+ const allPoints: RewindPoint[] = [];
545
+
546
+ for (const state of sessions) {
547
+ const shadowBranch = getShadowBranchName(state.baseCommit, state.worktreeID);
548
+ const exists = await refExists(`refs/heads/${shadowBranch}`, cwd);
549
+ if (!exists) continue;
550
+
551
+ // List temporary checkpoints
552
+ const temps = await checkpointStore.listTemporary();
553
+ for (const temp of temps) {
554
+ if (temp.baseCommit !== state.baseCommit) continue;
555
+
556
+ allPoints.push({
557
+ id: temp.latestCommit,
558
+ message: `Checkpoint on ${shadowBranch}`,
559
+ date: new Date(temp.timestamp),
560
+ isTaskCheckpoint: false,
561
+ isLogsOnly: false,
562
+ agent: state.agentType,
563
+ sessionID: state.sessionID,
564
+ sessionPrompt: state.firstPrompt,
565
+ sessionCount: 1,
566
+ sessionIDs: [state.sessionID],
567
+ });
568
+ }
569
+ }
570
+
571
+ // Sort by date descending
572
+ allPoints.sort((a, b) => b.date.getTime() - a.date.getTime());
573
+
574
+ // Also add logs-only points from commit history
575
+ const logsOnlyPoints = await getLogsOnlyRewindPoints(limit);
576
+ const existingIDs = new Set(allPoints.map((p) => p.id));
577
+ for (const p of logsOnlyPoints) {
578
+ if (!existingIDs.has(p.id)) {
579
+ allPoints.push(p);
580
+ }
581
+ }
582
+
583
+ // Re-sort and trim
584
+ allPoints.sort((a, b) => b.date.getTime() - a.date.getTime());
585
+ return allPoints.slice(0, limit);
586
+ },
587
+
588
+ async rewind(point: RewindPoint): Promise<void> {
589
+ if (point.isLogsOnly) {
590
+ throw new Error('Use restoreLogsOnly for logs-only rewind points');
591
+ }
592
+
593
+ // Read checkpoint tree and restore files
594
+ const treeEntries = await lsTree(point.id, undefined, cwd);
595
+ const worktreeRoot = await getWorktreeRoot(cwd);
596
+
597
+ for (const entry of treeEntries) {
598
+ if (entry.name.startsWith('.sessionlog/')) continue;
599
+
600
+ try {
601
+ const content = await showFile(point.id, entry.name, cwd);
602
+ const absPath = path.join(worktreeRoot, entry.name);
603
+ const dir = path.dirname(absPath);
604
+ fs.mkdirSync(dir, { recursive: true });
605
+
606
+ const perm = entry.mode === '100755' ? 0o755 : 0o644;
607
+ fs.writeFileSync(absPath, content, { mode: perm });
608
+ } catch {
609
+ // Skip files that can't be restored
610
+ }
611
+ }
612
+ },
613
+
614
+ async canRewind(): Promise<[boolean, string]> {
615
+ const hasChanges = await hasUncommittedChanges(cwd);
616
+ if (hasChanges) {
617
+ return [
618
+ true,
619
+ 'Warning: You have uncommitted changes that will be overwritten by the rewind.',
620
+ ];
621
+ }
622
+ return [true, ''];
623
+ },
624
+
625
+ // ======================================================================
626
+ // Condensation
627
+ // ======================================================================
628
+ async condense(sessionID: string): Promise<CondensationResult> {
629
+ const state = await loadSession(sessionID);
630
+ if (!state) {
631
+ throw new Error(`Session not found: ${sessionID}`);
632
+ }
633
+
634
+ const cpID = await checkpointStore.generateID();
635
+ const committedFiles = new Set(state.filesTouched);
636
+ return condenseSession(state, cpID, committedFiles);
637
+ },
638
+
639
+ // ======================================================================
640
+ // Validation & Cleanup
641
+ // ======================================================================
642
+
643
+ async validateRepository(): Promise<void> {
644
+ const { validateRepository: validate } = await import('./common.js');
645
+ await validate(cwd);
646
+ },
647
+
648
+ async listOrphanedItems(): Promise<OrphanedItem[]> {
649
+ const items: OrphanedItem[] = [];
650
+
651
+ // Find orphaned shadow branches
652
+ const allBranches = await listBranches(cwd);
653
+ for (const branch of allBranches) {
654
+ if (branch.startsWith(SHADOW_BRANCH_PREFIX) && branch !== CHECKPOINTS_BRANCH) {
655
+ items.push({
656
+ type: 'shadow-branch',
657
+ id: branch,
658
+ reason: 'shadow branch (should have been auto-cleaned)',
659
+ });
660
+ }
661
+ }
662
+
663
+ return items;
664
+ },
665
+ };
666
+
667
+ // ========================================================================
668
+ // Internal: Condensation
669
+ // ========================================================================
670
+
671
+ async function condenseSession(
672
+ state: SessionState,
673
+ checkpointID: CheckpointID,
674
+ committedFiles: Set<string>,
675
+ ): Promise<CondensationResult> {
676
+ const author = await getGitAuthor(cwd);
677
+ const branch = await getCurrentBranch(cwd);
678
+
679
+ // Filter filesTouched to committed subset
680
+ const filesTouched = state.filesTouched.filter((f) => committedFiles.has(f));
681
+
682
+ // Build transcript and prompts from shadow branch
683
+ let transcript = Buffer.alloc(0);
684
+ let prompts: string[] = [];
685
+ let context = Buffer.alloc(0);
686
+
687
+ const shadowBranch = getShadowBranchName(state.baseCommit, state.worktreeID);
688
+ const shadowExists = await refExists(`refs/heads/${shadowBranch}`, cwd);
689
+
690
+ if (shadowExists) {
691
+ // Read transcript from shadow branch metadata
692
+ try {
693
+ const metadataDir = `.sessionlog/metadata/${state.sessionID}`;
694
+ const fullContent = await gitSafe(
695
+ ['show', `refs/heads/${shadowBranch}:${metadataDir}/full.jsonl`],
696
+ { cwd },
697
+ );
698
+ if (fullContent) {
699
+ transcript = Buffer.from(fullContent, 'utf-8');
700
+ }
701
+ } catch {
702
+ // Use empty transcript
703
+ }
704
+
705
+ // Read prompts
706
+ try {
707
+ const metadataDir = `.sessionlog/metadata/${state.sessionID}`;
708
+ const promptContent = await gitSafe(
709
+ ['show', `refs/heads/${shadowBranch}:${metadataDir}/prompt.txt`],
710
+ { cwd },
711
+ );
712
+ if (promptContent) {
713
+ prompts = promptContent.split('\n---\n').filter((p) => p.trim().length > 0);
714
+ }
715
+ } catch {
716
+ // Use empty prompts
717
+ }
718
+ }
719
+
720
+ // If we have a live transcript path, try to read from there
721
+ if (transcript.length === 0 && state.transcriptPath) {
722
+ try {
723
+ transcript = fs.readFileSync(state.transcriptPath);
724
+ } catch {
725
+ // Keep empty
726
+ }
727
+ }
728
+
729
+ // Generate context from prompts
730
+ if (prompts.length > 0) {
731
+ const contextLines = prompts.map((p, i) => `## Prompt ${i + 1}\n\n${p}`);
732
+ context = Buffer.from(contextLines.join('\n\n---\n\n'), 'utf-8');
733
+ }
734
+
735
+ // Write committed checkpoint
736
+ await checkpointStore.writeCommitted({
737
+ checkpointID,
738
+ sessionID: state.sessionID,
739
+ strategy: STRATEGY_NAME_MANUAL_COMMIT,
740
+ branch: branch ?? undefined,
741
+ transcript,
742
+ prompts,
743
+ context,
744
+ filesTouched,
745
+ checkpointsCount: state.stepCount,
746
+ authorName: author.name,
747
+ authorEmail: author.email,
748
+ agent: state.agentType,
749
+ turnID: state.turnID,
750
+ transcriptIdentifierAtStart: state.transcriptIdentifierAtStart,
751
+ checkpointTranscriptStart: state.checkpointTranscriptStart,
752
+ tokenUsage: state.tokenUsage,
753
+ tasks: state.tasks,
754
+ planModeUsed: (state.planModeEntries ?? 0) > 0,
755
+ planModeEntries: state.planModeEntries,
756
+ planEntries: state.planEntries,
757
+ skillsUsed: state.skillsUsed,
758
+ });
759
+
760
+ // Write event to the JSONL event log for external consumers (opt-in)
761
+ if (config.eventLogEnabled) {
762
+ try {
763
+ const eventCwd = cwd ?? process.cwd();
764
+ await appendCheckpointEvent(
765
+ eventCwd,
766
+ {
767
+ type: 'checkpoint_committed',
768
+ timestamp: new Date().toISOString(),
769
+ checkpointID,
770
+ sessionID: state.sessionID,
771
+ agent: state.agentType,
772
+ branch: branch ?? undefined,
773
+ filesTouched,
774
+ checkpointsCount: state.stepCount,
775
+ tokenUsage: state.tokenUsage,
776
+ },
777
+ { maxEvents: config.eventLogMaxEvents },
778
+ );
779
+ } catch {
780
+ // Non-fatal: event log failure shouldn't break checkpoint flow
781
+ }
782
+ }
783
+
784
+ return {
785
+ checkpointID,
786
+ sessionsCondensed: 1,
787
+ checkpointsCount: state.stepCount,
788
+ filesTouched,
789
+ tokenUsage: state.tokenUsage,
790
+ };
791
+ }
792
+
793
+ // ========================================================================
794
+ // Internal: Logs-only rewind points from commit history
795
+ // ========================================================================
796
+
797
+ async function getLogsOnlyRewindPoints(limit: number): Promise<RewindPoint[]> {
798
+ const points: RewindPoint[] = [];
799
+
800
+ // Check if checkpoints branch exists (in session repo if configured)
801
+ const branchExists = await refExists(`refs/heads/${cpBranch}`, committedCwd);
802
+ if (!branchExists) return points;
803
+
804
+ // Get committed checkpoints
805
+ const committed = await checkpointStore.listCommitted(limit);
806
+ if (committed.length === 0) return points;
807
+
808
+ // Build map of checkpoint IDs
809
+ const cpMap = new Map<string, (typeof committed)[0]>();
810
+ for (const cp of committed) {
811
+ if (cp.checkpointID) {
812
+ cpMap.set(cp.checkpointID, cp);
813
+ }
814
+ }
815
+
816
+ // Walk commit history looking for checkpoint trailers
817
+ const head = await getHead(cwd);
818
+ const logOutput = await gitSafe(
819
+ ['log', '--format=%H %s%n%b', `--max-count=${limit * 2}`, head],
820
+ { cwd },
821
+ );
822
+ if (!logOutput) return points;
823
+
824
+ // Parse log output looking for checkpoint trailers
825
+ const commits = logOutput.split('\n\n').filter((c) => c.trim().length > 0);
826
+
827
+ for (const commitBlock of commits) {
828
+ const lines = commitBlock.split('\n');
829
+ if (lines.length === 0) continue;
830
+
831
+ const firstLine = lines[0];
832
+ const spaceIdx = firstLine.indexOf(' ');
833
+ if (spaceIdx < 0) continue;
834
+
835
+ const sha = firstLine.slice(0, spaceIdx);
836
+ const message = firstLine.slice(spaceIdx + 1);
837
+ const body = lines.slice(1).join('\n');
838
+ const fullMessage = `${message}\n${body}`;
839
+
840
+ const [cpID, found] = parseCheckpoint(fullMessage);
841
+ if (!found || !cpID) continue;
842
+
843
+ const cpInfo = cpMap.get(cpID);
844
+ if (!cpInfo) continue;
845
+
846
+ points.push({
847
+ id: sha,
848
+ message,
849
+ date: new Date(),
850
+ isLogsOnly: true,
851
+ isTaskCheckpoint: false,
852
+ checkpointID: cpID,
853
+ sessionCount: cpInfo.sessions?.length ?? 1,
854
+ sessionIDs: [],
855
+ });
856
+
857
+ if (points.length >= limit) break;
858
+ }
859
+
860
+ return points;
861
+ }
862
+
863
+ // ========================================================================
864
+ // Internal: Shadow branch migration
865
+ // ========================================================================
866
+
867
+ /**
868
+ * Check if HEAD has changed since the session started and migrate the
869
+ * shadow branch to the new base commit if needed.
870
+ *
871
+ * This handles the scenario where the agent performs a rebase, pull, or
872
+ * other git operation that changes HEAD mid-session. Without migration,
873
+ * checkpoints would be saved to an orphaned shadow branch.
874
+ */
875
+ async function migrateShadowBranchIfNeeded(state: SessionState): Promise<boolean> {
876
+ if (!state.baseCommit) return false;
877
+
878
+ const currentHead = await getHead(cwd);
879
+ if (state.baseCommit === currentHead) return false;
880
+
881
+ const oldShadowBranch = getShadowBranchName(state.baseCommit, state.worktreeID);
882
+ const newShadowBranch = getShadowBranchName(currentHead, state.worktreeID);
883
+
884
+ // Guard: if both commits produce the same shadow branch name
885
+ // (same 7-char prefix), just update state
886
+ if (oldShadowBranch === newShadowBranch) {
887
+ state.baseCommit = currentHead;
888
+ return true;
889
+ }
890
+
891
+ const oldExists = await refExists(`refs/heads/${oldShadowBranch}`, cwd);
892
+ if (!oldExists) {
893
+ // Old shadow branch doesn't exist — just update baseCommit
894
+ state.baseCommit = currentHead;
895
+ return true;
896
+ }
897
+
898
+ // Old shadow branch exists — rename it to the new base
899
+ try {
900
+ // Read the current tip of the old branch
901
+ const oldTip = await git(['rev-parse', `refs/heads/${oldShadowBranch}`], { cwd });
902
+
903
+ // Create new branch pointing to same commit
904
+ await updateRef(`refs/heads/${newShadowBranch}`, oldTip.trim(), cwd);
905
+
906
+ // Delete old branch (best effort)
907
+ try {
908
+ await deleteBranch(oldShadowBranch, false, cwd);
909
+ } catch {
910
+ // Non-fatal
911
+ }
912
+ } catch {
913
+ // If rename fails, just update state
914
+ }
915
+
916
+ state.baseCommit = currentHead;
917
+ return true;
918
+ }
919
+
920
+ /**
921
+ * Check for HEAD changes, migrate shadow branch if needed, and persist.
922
+ */
923
+ async function migrateAndPersist(state: SessionState): Promise<void> {
924
+ const migrated = await migrateShadowBranchIfNeeded(state);
925
+ if (migrated) {
926
+ await saveSession(state);
927
+ }
928
+ }
929
+
930
+ return strategy;
931
+ }
932
+
933
+ // ============================================================================
934
+ // Helpers
935
+ // ============================================================================
936
+
937
+ /**
938
+ * Inject a checkpoint trailer before any git comments in the commit message.
939
+ */
940
+ function injectCheckpointTrailer(message: string, trailer: string): string {
941
+ const lines = message.split('\n');
942
+
943
+ // Find where git comments start (lines beginning with #)
944
+ let insertIndex = lines.length;
945
+ for (let i = 0; i < lines.length; i++) {
946
+ if (lines[i].startsWith('#')) {
947
+ insertIndex = i;
948
+ break;
949
+ }
950
+ }
951
+
952
+ // Insert trailer before comments, with a blank line separator
953
+ const before = lines.slice(0, insertIndex);
954
+ const after = lines.slice(insertIndex);
955
+
956
+ // Ensure there's a blank line before the trailer
957
+ while (before.length > 0 && before[before.length - 1].trim() === '') {
958
+ before.pop();
959
+ }
960
+
961
+ return [...before, '', trailer, '', ...after].join('\n');
962
+ }
963
+
964
+ /**
965
+ * Check if a commit message has any content besides comments and our trailer.
966
+ */
967
+ export function hasUserContent(message: string): boolean {
968
+ const trailerPrefix = CheckpointTrailerKey + ':';
969
+ for (const line of message.split('\n')) {
970
+ const trimmed = line.trim();
971
+ if (!trimmed) continue;
972
+ if (trimmed.startsWith('#')) continue;
973
+ if (trimmed.startsWith(trailerPrefix)) continue;
974
+ return true;
975
+ }
976
+ return false;
977
+ }
978
+
979
+ /**
980
+ * Remove the Sessionlog-Checkpoint trailer line from a commit message.
981
+ */
982
+ export function stripCheckpointTrailer(message: string): string {
983
+ const trailerPrefix = CheckpointTrailerKey + ':';
984
+ return message
985
+ .split('\n')
986
+ .filter((line) => !line.trim().startsWith(trailerPrefix))
987
+ .join('\n');
988
+ }