@amoree-code/ocean 2.22.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/README.md +46 -53
  2. package/dist/application/clients/bundles.js +220 -0
  3. package/dist/application/clients/chat-plugin.js +4 -42
  4. package/dist/application/clients/client-detect.js +291 -0
  5. package/dist/application/clients/clients.js +104 -25
  6. package/dist/application/clients/desktop-link.js +40 -0
  7. package/dist/application/clients/desktop-watcher.js +6 -4
  8. package/dist/application/clients/hook-trust.js +106 -0
  9. package/dist/application/clients/hooks.js +7 -1
  10. package/dist/application/clients/mcp-schema-cost.js +74 -0
  11. package/dist/application/clients/native.js +38 -2
  12. package/dist/application/clients/registry.js +51 -9
  13. package/dist/application/clients/status.js +7 -2
  14. package/dist/application/clients/zip.js +44 -0
  15. package/dist/application/gateway/webhook-gateway.js +1 -1
  16. package/dist/application/integrations/charter-copies.js +1 -1
  17. package/dist/application/integrations/engine-entry-repair.js +4 -3
  18. package/dist/application/integrations/skill-auto-sync.js +2 -2
  19. package/dist/application/integrations/skill-filter.js +1 -1
  20. package/dist/application/integrations/skill-router.js +134 -90
  21. package/dist/application/layout/layout-apply.js +1 -1
  22. package/dist/application/layout/workspace-template.js +1 -1
  23. package/dist/application/onboarding/steps.js +121 -30
  24. package/dist/application/profiles/profile-doctor.js +118 -0
  25. package/dist/application/profiles/profile-migration-service.js +208 -0
  26. package/dist/application/profiles/profile-suggestion.js +3 -7
  27. package/dist/application/profiles/profile-upgrade-service.js +98 -86
  28. package/dist/application/pull/history-index.js +1 -1
  29. package/dist/application/pull/project-match.js +3 -3
  30. package/dist/application/pull/pull.js +1 -1
  31. package/dist/application/pull/server-capture.js +92 -9
  32. package/dist/application/scheduler/local-scheduler.js +2 -2
  33. package/dist/application/spend/claude-prices.js +55 -0
  34. package/dist/application/spend/claude-spend.js +365 -0
  35. package/dist/application/uninstall/uninstall.js +25 -3
  36. package/dist/application/upkeep/nightly-upkeep.js +4 -4
  37. package/dist/composition/runtime.js +2 -2
  38. package/dist/infrastructure/desktop/claude-export.js +1 -1
  39. package/dist/infrastructure/desktop/desktop-chat.js +60 -13
  40. package/dist/infrastructure/desktop/indexeddb.js +4 -4
  41. package/dist/infrastructure/desktop/leveldb.js +2 -2
  42. package/dist/infrastructure/filesystem/profile-loader.js +3 -45
  43. package/dist/infrastructure/filesystem/runtime-config-loader.js +1 -1
  44. package/dist/infrastructure/observability/runtime-logger.js +1 -1
  45. package/dist/infrastructure/process/agent-tool-executor.js +3 -3
  46. package/dist/infrastructure/process/process-supervisor.js +1 -1
  47. package/dist/infrastructure/process/service.js +8 -8
  48. package/dist/infrastructure/providers/openai-compatible.js +2 -2
  49. package/dist/infrastructure/providers/provider-invocation.js +1 -1
  50. package/dist/infrastructure/providers/session-facts-completer.js +78 -5
  51. package/dist/interfaces/cli/auth-command.js +2 -2
  52. package/dist/interfaces/cli/brief-command.js +1 -1
  53. package/dist/interfaces/cli/browser-command.js +6 -6
  54. package/dist/interfaces/cli/browser-findings.js +6 -9
  55. package/dist/interfaces/cli/browser-settings.js +10 -10
  56. package/dist/interfaces/cli/capture-command.js +6 -6
  57. package/dist/interfaces/cli/client-test-command.js +3 -3
  58. package/dist/interfaces/cli/clients-command.js +55 -6
  59. package/dist/interfaces/cli/command-aliases.js +56 -0
  60. package/dist/interfaces/cli/command-registry.js +48 -1414
  61. package/dist/interfaces/cli/commands/browser.js +5 -0
  62. package/dist/interfaces/cli/commands/capture.js +19 -0
  63. package/dist/interfaces/cli/commands/catalog.js +9 -0
  64. package/dist/interfaces/cli/commands/client.js +135 -0
  65. package/dist/interfaces/cli/commands/clients.js +33 -0
  66. package/dist/interfaces/cli/commands/connectors.js +14 -0
  67. package/dist/interfaces/cli/commands/context.js +9 -0
  68. package/dist/interfaces/cli/commands/cost.js +15 -0
  69. package/dist/interfaces/cli/commands/daily.js +11 -0
  70. package/dist/interfaces/cli/commands/day.js +25 -0
  71. package/dist/interfaces/cli/commands/dispatch.js +31 -0
  72. package/dist/interfaces/cli/commands/doctor.js +60 -0
  73. package/dist/interfaces/cli/commands/env.js +5 -0
  74. package/dist/interfaces/cli/commands/gateway.js +16 -0
  75. package/dist/interfaces/cli/commands/handoff.js +11 -0
  76. package/dist/interfaces/cli/commands/health.js +17 -0
  77. package/dist/interfaces/cli/commands/hook.js +142 -0
  78. package/dist/interfaces/cli/commands/idea.js +11 -0
  79. package/dist/interfaces/cli/commands/install.js +31 -0
  80. package/dist/interfaces/cli/commands/intent.js +14 -0
  81. package/dist/interfaces/cli/commands/intercept.js +22 -0
  82. package/dist/interfaces/cli/commands/layout.js +11 -0
  83. package/dist/interfaces/cli/commands/lifecycle.js +5 -0
  84. package/dist/interfaces/cli/commands/loop.js +73 -0
  85. package/dist/interfaces/cli/commands/market.js +11 -0
  86. package/dist/interfaces/cli/commands/mcp.js +57 -0
  87. package/dist/interfaces/cli/commands/memory.js +5 -0
  88. package/dist/interfaces/cli/commands/migrate.js +5 -0
  89. package/dist/interfaces/cli/commands/observe.js +11 -0
  90. package/dist/interfaces/cli/commands/obsidian.js +111 -0
  91. package/dist/interfaces/cli/commands/operate.js +7 -0
  92. package/dist/interfaces/cli/commands/policy.js +16 -0
  93. package/dist/interfaces/cli/commands/project.js +207 -0
  94. package/dist/interfaces/cli/commands/repair.js +20 -0
  95. package/dist/interfaces/cli/commands/run.js +52 -0
  96. package/dist/interfaces/cli/commands/schedule.js +58 -0
  97. package/dist/interfaces/cli/commands/service.js +21 -0
  98. package/dist/interfaces/cli/commands/session.js +182 -0
  99. package/dist/interfaces/cli/commands/sessions.js +12 -0
  100. package/dist/interfaces/cli/commands/setup.js +21 -0
  101. package/dist/interfaces/cli/commands/skill.js +159 -0
  102. package/dist/interfaces/cli/commands/tasks.js +10 -0
  103. package/dist/interfaces/cli/commands/update-remove.js +25 -0
  104. package/dist/interfaces/cli/connectors-command.js +150 -0
  105. package/dist/interfaces/cli/context-command.js +39 -3
  106. package/dist/interfaces/cli/cost-command.js +104 -0
  107. package/dist/interfaces/cli/curator-command.js +1 -1
  108. package/dist/interfaces/cli/daily-command.js +7 -1
  109. package/dist/interfaces/cli/desktop-command.js +43 -7
  110. package/dist/interfaces/cli/distill-command.js +7 -2
  111. package/dist/interfaces/cli/express-command.js +1 -1
  112. package/dist/interfaces/cli/failures-command.js +4 -4
  113. package/dist/interfaces/cli/gateway-findings.js +2 -2
  114. package/dist/interfaces/cli/governance-command.js +23 -16
  115. package/dist/interfaces/cli/handoff-command.js +1 -1
  116. package/dist/interfaces/cli/harvest-command.js +2 -2
  117. package/dist/interfaces/cli/help-command.js +53 -169
  118. package/dist/interfaces/cli/hygiene-command.js +1 -1
  119. package/dist/interfaces/cli/idea-command.js +1 -1
  120. package/dist/interfaces/cli/intercept-command.js +8 -7
  121. package/dist/interfaces/cli/interests-command.js +1 -1
  122. package/dist/interfaces/cli/layout-command.js +2 -0
  123. package/dist/interfaces/cli/market-command.js +9 -9
  124. package/dist/interfaces/cli/mcp-gateway-command.js +124 -7
  125. package/dist/interfaces/cli/mcp-probe-command.js +186 -0
  126. package/dist/interfaces/cli/mcp-status-command.js +5 -5
  127. package/dist/interfaces/cli/memory-command.js +41 -7
  128. package/dist/interfaces/cli/migrate-command.js +2 -2
  129. package/dist/interfaces/cli/note-command.js +1 -1
  130. package/dist/interfaces/cli/onboard-command.js +14 -0
  131. package/dist/interfaces/cli/operate-command.js +5 -5
  132. package/dist/interfaces/cli/profiles-command.js +61 -1
  133. package/dist/interfaces/cli/rhythm-command.js +11 -5
  134. package/dist/interfaces/cli/running-server-findings.js +1 -1
  135. package/dist/interfaces/cli/scorecard-command.js +8 -8
  136. package/dist/interfaces/cli/session-facts-command.js +2 -2
  137. package/dist/interfaces/cli/sessions-command.js +145 -0
  138. package/dist/interfaces/cli/setup-command.js +15 -2
  139. package/dist/interfaces/cli/tasks-command.js +63 -13
  140. package/dist/interfaces/cli/telemetry-command.js +4 -4
  141. package/dist/interfaces/cli/uninstall-command.js +1 -1
  142. package/dist/interfaces/cli/week-failures.js +32 -0
  143. package/dist/main.js +12 -0
  144. package/node_modules/@ocean/brain/dist/{infrastructure/brain/brain-index.js → brain-index.js} +2 -2
  145. package/node_modules/@ocean/brain/dist/{brain/brain-markdown.js → brain-markdown.js} +1 -1
  146. package/node_modules/@ocean/brain/dist/{brain/brain-service.js → brain-service.js} +12 -2
  147. package/node_modules/@ocean/brain/dist/memory/brain-dump.js +92 -16
  148. package/node_modules/@ocean/brain/dist/memory/extraction-log.js +125 -0
  149. package/node_modules/@ocean/brain/dist/memory/extraction-retry.js +54 -0
  150. package/node_modules/@ocean/brain/dist/memory/fact-routing.js +44 -1
  151. package/node_modules/@ocean/brain/dist/memory/lesson-activation.js +2 -2
  152. package/node_modules/@ocean/brain/dist/memory/lesson-learning.js +2 -2
  153. package/node_modules/@ocean/brain/dist/memory/lessons.js +1 -1
  154. package/node_modules/@ocean/brain/dist/memory/memory-audit.js +2 -2
  155. package/node_modules/@ocean/brain/dist/memory/memory-harvest.js +1 -1
  156. package/node_modules/@ocean/brain/dist/memory/memory-paths.js +8 -0
  157. package/node_modules/@ocean/brain/dist/memory/memory-review.js +31 -3
  158. package/node_modules/@ocean/brain/dist/memory/memory-trash.js +29 -0
  159. package/node_modules/@ocean/brain/dist/memory/memory-write.js +4 -2
  160. package/node_modules/@ocean/brain/dist/memory/model-narrative.js +2 -2
  161. package/node_modules/@ocean/brain/dist/memory/profile-facts.js +1 -1
  162. package/node_modules/@ocean/brain/dist/memory/routing.json +6 -6
  163. package/node_modules/@ocean/{market/dist/skills → brain/dist/memory}/signal-detection.js +1 -1
  164. package/node_modules/@ocean/brain/dist/{memory → people}/people.js +1 -1
  165. package/node_modules/@ocean/brain/dist/sessions-capture/session-facts.js +625 -0
  166. package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-promotion.js +7 -15
  167. package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-summary.js +1 -1
  168. package/node_modules/@ocean/brain/dist/sessions-capture/session-triage.js +52 -0
  169. package/node_modules/@ocean/brain/package.json +1 -1
  170. package/node_modules/@ocean/connect/dist/connectors/connector-hub.js +173 -0
  171. package/node_modules/@ocean/{market → connect}/dist/install/default-marketplace.js +6 -2
  172. package/node_modules/@ocean/{market → connect}/dist/install/marketplace-service.js +1 -1
  173. package/node_modules/@ocean/connect/dist/mcp/mcp-gateway.js +987 -0
  174. package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-launch.js +102 -5
  175. package/node_modules/@ocean/{market → connect}/dist/registry/official-registry.js +1 -1
  176. package/node_modules/@ocean/{market → connect}/dist/security/permissions.js +1 -1
  177. package/node_modules/@ocean/{market → connect}/dist/skills/skill-hub.js +104 -6
  178. package/node_modules/@ocean/{market → connect}/package.json +2 -2
  179. package/node_modules/@ocean/context/dist/{context/context-ladder.js → context-ladder.js} +3 -3
  180. package/node_modules/@ocean/context/dist/{context/context-references.js → context-references.js} +5 -4
  181. package/node_modules/@ocean/context/dist/{context/context-cost.js → context-size.js} +6 -6
  182. package/node_modules/@ocean/context/dist/{context/intent-router.js → intent-router.js} +1 -1
  183. package/node_modules/@ocean/context/dist/{context/resource-injection.js → resource-injection.js} +3 -1
  184. package/node_modules/@ocean/context/package.json +1 -1
  185. package/node_modules/@ocean/core/dist/domain/brain/brain-record.js +1 -1
  186. package/node_modules/@ocean/core/dist/domain/capabilities/capability-manifest.js +5 -5
  187. package/node_modules/@ocean/core/dist/domain/connector-entry.js +86 -0
  188. package/node_modules/@ocean/core/dist/domain/context/context.js +1 -1
  189. package/node_modules/@ocean/core/dist/domain/context/project-id.js +8 -2
  190. package/node_modules/@ocean/core/dist/domain/{evidence/evidence.js → evidence.js} +1 -1
  191. package/node_modules/@ocean/core/dist/domain/mcp/memory-contract.js +4 -1
  192. package/node_modules/@ocean/core/dist/domain/ports/brain-index-port.js +1 -1
  193. package/node_modules/@ocean/core/dist/domain/profiles/profile-markdown.js +40 -0
  194. package/node_modules/@ocean/core/dist/domain/profiles/profile-resolution.js +276 -0
  195. package/node_modules/@ocean/core/dist/domain/profiles/profile-selection.js +23 -60
  196. package/node_modules/@ocean/core/dist/domain/profiles/profile-upgrade.js +2 -2
  197. package/node_modules/@ocean/core/dist/domain/profiles/profile.js +66 -6
  198. package/node_modules/@ocean/core/dist/domain/profiles/runtime-config.js +1 -1
  199. package/node_modules/@ocean/core/dist/domain/runs/agent-tools.js +2 -2
  200. package/node_modules/@ocean/core/dist/domain/sessions/session-identity.js +53 -0
  201. package/node_modules/@ocean/core/dist/domain/sessions/session-metadata.js +208 -0
  202. package/node_modules/@ocean/core/dist/domain/{tasks/task-id.js → task-id.js} +2 -2
  203. package/node_modules/@ocean/core/dist/profiles/profile-files.js +57 -0
  204. package/node_modules/@ocean/core/dist/profiles/profile-loader.js +97 -0
  205. package/node_modules/@ocean/core/dist/profiles/project-profile-fill.js +33 -0
  206. package/node_modules/@ocean/core/dist/profiles/session-profile.js +158 -0
  207. package/node_modules/@ocean/core/dist/shared/charter.js +110 -0
  208. package/node_modules/@ocean/core/dist/shared/context-ack.js +1 -1
  209. package/node_modules/@ocean/core/dist/shared/context-triggers.js +67 -0
  210. package/node_modules/@ocean/core/dist/shared/paths.js +6 -6
  211. package/node_modules/@ocean/core/dist/shared/project-legacy.js +232 -0
  212. package/node_modules/@ocean/core/dist/shared/project-manifest.js +308 -0
  213. package/node_modules/@ocean/core/dist/shared/project-names.js +87 -0
  214. package/node_modules/@ocean/core/dist/shared/project-register.js +560 -0
  215. package/node_modules/@ocean/core/dist/shared/project-resolution.js +83 -861
  216. package/node_modules/@ocean/core/dist/shared/repo-signals.js +45 -0
  217. package/node_modules/@ocean/core/dist/shared/task-reference.js +1 -1
  218. package/node_modules/@ocean/core/dist/shared/text-tokens.js +37 -0
  219. package/node_modules/@ocean/core/dist/shared/tool-groups.js +224 -0
  220. package/node_modules/@ocean/core/package.json +4 -1
  221. package/node_modules/@ocean/services/dist/day/day.js +45 -3
  222. package/node_modules/@ocean/services/dist/{distill → day}/distill.js +29 -3
  223. package/node_modules/@ocean/services/dist/{harvest → day}/harvest.js +54 -14
  224. package/node_modules/@ocean/services/dist/{brief → day}/interest-discovery.js +3 -3
  225. package/node_modules/@ocean/services/dist/day/note.js +2 -2
  226. package/node_modules/@ocean/services/dist/{onboarding → day}/onboarding.js +1 -1
  227. package/node_modules/@ocean/services/dist/day/patterns.js +68 -0
  228. package/node_modules/@ocean/services/dist/{curator → health}/curator.js +5 -5
  229. package/node_modules/@ocean/services/dist/{journey → health}/failures.js +7 -5
  230. package/node_modules/@ocean/services/dist/{hygiene → health}/hygiene.js +2 -2
  231. package/node_modules/@ocean/services/dist/{journey → health}/lesson-effect.js +1 -1
  232. package/node_modules/@ocean/services/dist/{scorecard → health}/scorecard.js +3 -3
  233. package/node_modules/@ocean/services/dist/{upkeep → health}/upkeep.js +2 -2
  234. package/node_modules/@ocean/services/dist/{doctor → health}/workspace-doctor.js +57 -17
  235. package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-session.js +1 -1
  236. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/call-ledger.js +3 -0
  237. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-client.js +19 -3
  238. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/obsidian-server.js +4 -4
  239. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/ocean-server.js +423 -34
  240. package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/conflict-log.js +1 -1
  241. package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/folder-templates.js +8 -5
  242. package/node_modules/@ocean/services/dist/projects/project-doctor.js +173 -0
  243. package/node_modules/@ocean/services/dist/projects/project-snippet.js +9 -0
  244. package/node_modules/@ocean/services/dist/projects/projects-overview.js +2 -2
  245. package/node_modules/@ocean/services/package.json +1 -1
  246. package/node_modules/@ocean/{loop/dist/loops → work/dist/runs}/guard-runtime.js +3 -3
  247. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/memory-knowledge-operations.js +4 -12
  248. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-contract.js +2 -2
  249. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/project-operations.js +2 -1
  250. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/task-operations.js +4 -4
  251. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/write-guard.js +1 -1
  252. package/node_modules/@ocean/{loop → work}/dist/runs/prompt-assembly.js +2 -2
  253. package/node_modules/@ocean/{loop → work}/dist/runs/run-agent.js +4 -4
  254. package/node_modules/@ocean/{loop → work}/dist/runs/tool-loop.js +4 -4
  255. package/node_modules/@ocean/work/dist/sessions/hooks/desktop-facts.js +309 -0
  256. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-end-hook.js +36 -5
  257. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-facts-hook.js +144 -14
  258. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-start-hook.js +129 -12
  259. package/node_modules/@ocean/work/dist/sessions/hooks/start-brief.js +110 -0
  260. package/node_modules/@ocean/work/dist/sessions/hooks/unlinked-warning.js +68 -0
  261. package/node_modules/@ocean/{loop → work}/dist/sessions/session-closeout.js +4 -4
  262. package/node_modules/@ocean/{loop → work}/dist/sessions/session-projects.js +13 -3
  263. package/node_modules/@ocean/work/dist/sessions/session-relink.js +300 -0
  264. package/node_modules/@ocean/{loop → work}/dist/sessions/session-retention.js +1 -1
  265. package/node_modules/@ocean/{loop → work}/dist/tasks/list-tasks.js +7 -2
  266. package/node_modules/@ocean/{loop → work}/dist/tasks/renumber-tasks.js +4 -2
  267. package/node_modules/@ocean/{loop → work}/dist/tasks/session-task.js +2 -2
  268. package/node_modules/@ocean/{loop → work}/dist/tasks/sync-task-prs.js +77 -7
  269. package/node_modules/@ocean/work/dist/tasks/task-git.js +63 -0
  270. package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop.js +4 -4
  271. package/node_modules/@ocean/{loop → work}/dist/tasks/verification-readiness.js +1 -1
  272. package/node_modules/@ocean/{loop → work}/dist/tasks/verify-task.js +1 -1
  273. package/node_modules/@ocean/{loop → work}/package.json +2 -2
  274. package/ocean-marketplace.json +41 -41
  275. package/package.json +12 -11
  276. package/skills/core/daily-harvest/SKILL.md +1 -1
  277. package/skills/core/ocean-memory/SKILL.md +4 -0
  278. package/skills/core/use-browser/SKILL.md +30 -7
  279. package/skills/index.json +1 -1
  280. package/templates/profiles/default.md +44 -0
  281. package/templates/profiles/developer.md +45 -0
  282. package/templates/profiles/reviewer.md +44 -0
  283. package/templates/profiles/strategist.md +44 -0
  284. package/templates/profiles-v3/analysis.md +16 -0
  285. package/templates/profiles-v3/backend.md +16 -0
  286. package/templates/profiles-v3/base.md +57 -0
  287. package/templates/profiles-v3/code-review.md +16 -0
  288. package/templates/profiles-v3/devops.md +16 -0
  289. package/templates/profiles-v3/docs-office.md +16 -0
  290. package/templates/profiles-v3/frontend.md +16 -0
  291. package/templates/profiles-v3/learning.md +16 -0
  292. package/templates/profiles-v3/marketing-ads.md +16 -0
  293. package/templates/profiles-v3/marketing-content-seo.md +16 -0
  294. package/templates/profiles-v3/ocean-ops.md +16 -0
  295. package/templates/profiles-v3/product-strategy.md +16 -0
  296. package/templates/profiles-v3/qa-testing.md +16 -0
  297. package/templates/profiles-v3/security.md +16 -0
  298. package/templates/workspace/MANIFEST.json +1 -0
  299. package/templates/workspace/charter/core.md +22 -90
  300. package/templates/workspace/charter/policies/README.md +7 -1
  301. package/templates/workspace/charter/policies/claude-code-context.md +6 -1
  302. package/templates/workspace/charter/policies/concise-output.md +5 -0
  303. package/templates/workspace/charter/policies/context.md +5 -0
  304. package/templates/workspace/charter/policies/contracts/task.md +2 -2
  305. package/templates/workspace/charter/policies/git.md +5 -0
  306. package/templates/workspace/charter/policies/graph.md +6 -1
  307. package/templates/workspace/charter/policies/knowledge.md +11 -4
  308. package/templates/workspace/charter/policies/layout.md +23 -0
  309. package/templates/workspace/charter/policies/lifecycle.md +5 -0
  310. package/templates/workspace/charter/policies/memory.md +5 -0
  311. package/templates/workspace/charter/policies/minimal-change.md +5 -0
  312. package/templates/workspace/charter/policies/models.md +5 -0
  313. package/templates/workspace/charter/policies/response.md +5 -0
  314. package/templates/workspace/charter/policies/skill-observer.md +12 -0
  315. package/templates/workspace/charter/policies/stack.md +5 -0
  316. package/templates/workspace/charter/policies/task.md +17 -3
  317. package/templates/workspace/charter/policies/verification.md +5 -0
  318. package/node_modules/@ocean/brain/dist/evidence/verification-report.js +0 -13
  319. package/node_modules/@ocean/brain/dist/memory/daily-narrative.js +0 -142
  320. package/node_modules/@ocean/brain/dist/memory/session-facts.js +0 -283
  321. package/node_modules/@ocean/context/dist/context/context-compression.js +0 -66
  322. package/node_modules/@ocean/loop/dist/hooks/desktop-facts.js +0 -174
  323. package/node_modules/@ocean/loop/dist/operations/task-linker.js +0 -40
  324. package/node_modules/@ocean/loop/dist/sessions/session-pointer.js +0 -133
  325. package/node_modules/@ocean/loop/dist/tasks/task-git.js +0 -28
  326. package/node_modules/@ocean/market/dist/mcp/mcp-gateway.js +0 -533
  327. package/templates/profiles/default.json +0 -51
  328. package/templates/profiles/developer.json +0 -51
  329. package/templates/profiles/reviewer.json +0 -51
  330. package/templates/profiles/strategist.json +0 -51
  331. /package/node_modules/@ocean/brain/dist/{brain/brain-eval.js → brain-eval.js} +0 -0
  332. /package/node_modules/@ocean/brain/dist/{brain/brain-reindex.js → brain-reindex.js} +0 -0
  333. /package/node_modules/@ocean/brain/dist/{capture → sessions-capture}/inbox-sync.js +0 -0
  334. /package/node_modules/@ocean/{market → connect}/dist/adapters/mcp-adapter.js +0 -0
  335. /package/node_modules/@ocean/{market → connect}/dist/adapters/owned-directory.js +0 -0
  336. /package/node_modules/@ocean/{market → connect}/dist/adapters/plugin-adapter.js +0 -0
  337. /package/node_modules/@ocean/{market → connect}/dist/adapters/skill-adapter.js +0 -0
  338. /package/node_modules/@ocean/{market → connect}/dist/capability/adapter.js +0 -0
  339. /package/node_modules/@ocean/{market → connect}/dist/capability/catalog.js +0 -0
  340. /package/node_modules/@ocean/{market → connect}/dist/capability/content-digest.js +0 -0
  341. /package/node_modules/@ocean/{market → connect}/dist/capability/registry.js +0 -0
  342. /package/node_modules/@ocean/{market → connect}/dist/install/lock.js +0 -0
  343. /package/node_modules/@ocean/{market → connect}/dist/install/own-server.js +0 -0
  344. /package/node_modules/@ocean/{market → connect}/dist/mcp/chrome-debugging.js +0 -0
  345. /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-connection.js +0 -0
  346. /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-runner.js +0 -0
  347. /package/node_modules/@ocean/{market → connect}/dist/security/description-scan.js +0 -0
  348. /package/node_modules/@ocean/{market → connect}/dist/security/secrets.js +0 -0
  349. /package/node_modules/@ocean/{market → connect}/dist/skills/core-skill-sync.js +0 -0
  350. /package/node_modules/@ocean/context/dist/{context/context-packet.js → context-packet.js} +0 -0
  351. /package/node_modules/@ocean/core/dist/domain/{process/process-events.js → process-events.js} +0 -0
  352. /package/node_modules/@ocean/core/dist/domain/{redaction/redaction.js → redaction.js} +0 -0
  353. /package/node_modules/@ocean/services/dist/{brief → day}/brief.js +0 -0
  354. /package/node_modules/@ocean/services/dist/{express → day}/express.js +0 -0
  355. /package/node_modules/@ocean/services/dist/{brief → day}/source-registry.json +0 -0
  356. /package/node_modules/@ocean/services/dist/{journey → health}/telemetry.js +0 -0
  357. /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-service.js +0 -0
  358. /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-task-runner.js +0 -0
  359. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-session.js +0 -0
  360. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/server-version.js +0 -0
  361. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/tool-registry.js +0 -0
  362. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/inbox-promotion.js +0 -0
  363. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-discovery.js +0 -0
  364. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-ingestion.js +0 -0
  365. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-sync.js +0 -0
  366. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-writer.js +0 -0
  367. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-scope.js +0 -0
  368. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-io.js +0 -0
  369. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-operations.js +0 -0
  370. /package/node_modules/@ocean/{loop → work}/dist/runs/run-authorization.js +0 -0
  371. /package/node_modules/@ocean/{loop → work}/dist/runs/session-tokens.js +0 -0
  372. /package/node_modules/@ocean/{loop/dist/handoff → work/dist/sessions}/handoff-service.js +0 -0
  373. /package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/lifecycle-hooks.js +0 -0
  374. /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-store.js +0 -0
  375. /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-validator.js +0 -0
  376. /package/node_modules/@ocean/{loop → work}/dist/tasks/archive-tasks.js +0 -0
  377. /package/node_modules/@ocean/{loop → work}/dist/tasks/checkpoint-task.js +0 -0
  378. /package/node_modules/@ocean/{loop → work}/dist/tasks/claim-task.js +0 -0
  379. /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/iteration-graph.js +0 -0
  380. /package/node_modules/@ocean/{loop → work}/dist/tasks/new-task.js +0 -0
  381. /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop-record.js +0 -0
  382. /package/node_modules/@ocean/{loop → work}/dist/tasks/task-verification.js +0 -0
@@ -5,7 +5,7 @@ import { unsnappy, varint } from "./snappy.js";
5
5
  // copied aside: CURRENT → MANIFEST names the live tables and the current log, every live entry
6
6
  // is read, and for each user key the highest sequence number wins (a deletion hides the key).
7
7
  // Never point it at a folder an app has open: copy the folder first.
8
- export class LevelDbFormatError extends Error {
8
+ class LevelDbFormatError extends Error {
9
9
  }
10
10
  const BLOCK_SIZE = 32 * 1024;
11
11
  const RECORD_FULL = 1;
@@ -34,7 +34,7 @@ function maskedCrc(data) {
34
34
  // The records of a log-format file (a .log write-ahead log or a MANIFEST). A record whose
35
35
  // checksum fails, or one cut off at the end (a file copied while being written), ends the
36
36
  // read: everything before it is kept.
37
- export function* logRecords(buf) {
37
+ function* logRecords(buf) {
38
38
  let pos = 0;
39
39
  let pending = null;
40
40
  while (pos + 7 <= buf.length) {
@@ -1,46 +1,4 @@
1
- import { readFile, stat } from "node:fs/promises";
2
- import path from "node:path";
3
- import { assertProfileName, } from "@ocean/core/domain/profiles/profile.js";
4
- import { validateProfile } from "@ocean/core/domain/profiles/profile-validator.js";
5
- import { oceanPath, resolveWithin, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
6
- function missingAsNull(error) {
7
- if (error.code === "ENOENT")
8
- return null;
9
- throw error;
10
- }
11
- // The parser's message quotes the text around the error, which could be part of a secret
12
- // pasted into the file, so only the file is named.
13
- function parseProfile(source, file) {
14
- try {
15
- return JSON.parse(source);
16
- }
17
- catch {
18
- throw new Error(`Invalid profile JSON in ${file}`);
19
- }
20
- }
21
- // The name inside the file must be the name it was loaded by: the name keys sessions and the
22
- // profile's memory namespace, so a mismatch would read or write another profile's facts.
23
- function requireName(profile, name, file) {
24
- if (profile.name !== name)
25
- throw new Error(`Profile ${file} declares name "${profile.name}", expected "${name}"`);
26
- return profile;
27
- }
28
- export async function loadProfile(name) {
29
- assertProfileName(name);
30
- const root = oceanPath(SYSTEM_DIR, "profiles");
31
- const file = resolveWithin(root, `${name}.json`);
32
- // Only a missing canonical file falls through to the legacy directory form; a file that
33
- // exists but cannot be read, parsed or validated is an error, never a silent fallback.
34
- const source = await readFile(file, "utf8").catch(missingAsNull);
35
- if (source !== null)
36
- return requireName(validateProfile(parseProfile(source, file)), name, file);
37
- const directory = resolveWithin(root, name);
38
- if ((await stat(directory).catch(missingAsNull))?.isDirectory()) {
39
- const legacy = path.join(directory, "profile.json");
40
- const input = parseProfile(await readFile(legacy, "utf8"), legacy);
41
- const instructions = await readFile(path.join(directory, "instructions.md"), "utf8").catch(() => "");
42
- return requireName(validateProfile({ ...input, instructions }), name, legacy);
43
- }
44
- throw new Error(`Profile not found: ${name}`);
45
- }
1
+ // The loader lives in core (T-338 P2) so the session hook and the MCP server read profiles the
2
+ // same way the CLI does.
3
+ export { loadProfile } from "@ocean/core/profiles/profile-loader.js";
46
4
  //# sourceMappingURL=profile-loader.js.map
@@ -1,7 +1,7 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { validateRuntimeConfig, } from "@ocean/core/domain/profiles/runtime-config.js";
3
3
  import { oceanPath, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
4
- export function runtimeConfigFile() {
4
+ function runtimeConfigFile() {
5
5
  return oceanPath(SYSTEM_DIR, "config", "runtime.json");
6
6
  }
7
7
  // null only when the file does not exist; a file that exists but is not valid is an error.
@@ -1,6 +1,6 @@
1
1
  import { appendFile, mkdir } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { redactRuntimeText, redactSecrets, } from "@ocean/core/domain/redaction/redaction.js";
3
+ import { redactRuntimeText, redactSecrets, } from "@ocean/core/domain/redaction.js";
4
4
  import { oceanPath, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
5
5
  // Redaction is a pure domain transform; re-exported here so existing infrastructure
6
6
  // callers keep importing it from the logger without reaching into domain directly.
@@ -1,17 +1,17 @@
1
1
  import { mkdir, readdir, readFile, stat } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { containsKnownSecret } from "@ocean/core/domain/redaction/redaction.js";
3
+ import { containsKnownSecret } from "@ocean/core/domain/redaction.js";
4
4
  import { atomicWrite } from "@ocean/core/shared/fs-utils.js";
5
5
  import { realDeepestExisting, resolveWithin, } from "@ocean/core/shared/paths.js";
6
6
  // Executes one already-validated file tool call for a tool-loop run (T-245 Phase 6).
7
7
  // Everything it touches is bounded to the plan's allowed paths under its cwd, judged and
8
8
  // operated on by real path, and never a credential-bearing or repository-internal file:
9
9
  // what a tool reads is sent to a third-party API.
10
- export const MAX_READ_BYTES = 64 * 1024;
10
+ const MAX_READ_BYTES = 64 * 1024;
11
11
  const MAX_LIST_ENTRIES = 500;
12
12
  // A policy refusal, as opposed to a tool that ran and failed. The loop records it as
13
13
  // `tool_denied` by this name.
14
- export class ToolDenied extends Error {
14
+ class ToolDenied extends Error {
15
15
  name = "ToolDenied";
16
16
  }
17
17
  // Case-insensitive: the default macOS volume is, so ".Git" is ".git".
@@ -11,7 +11,7 @@ const forwardedSignals = ["SIGINT", "SIGTERM", "SIGHUP"];
11
11
  // How long output still in the pipe gets, once the process itself has exited, before whatever
12
12
  // else holds the pipe open (a background process it left behind) is stopped and no longer awaited.
13
13
  const LINGER_MS = 500;
14
- export function signalTree(child, signal) {
14
+ function signalTree(child, signal) {
15
15
  if (!child?.pid)
16
16
  return;
17
17
  try {
@@ -3,11 +3,11 @@ import { existsSync } from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
  import { promisify } from "node:util";
6
- import { reindexBrain } from "@ocean/brain/brain/brain-reindex.js";
7
- import { brainIndexState } from "@ocean/brain/brain/brain-service.js";
8
- import { brainIndexPort } from "@ocean/brain/infrastructure/brain/brain-index.js";
9
- import { loadObsidianConnection } from "@ocean/services/obsidian/vault-discovery.js";
10
- import { watchObsidianVault } from "@ocean/services/obsidian/vault-sync.js";
6
+ import { brainIndexPort } from "@ocean/brain/brain-index.js";
7
+ import { reindexBrain } from "@ocean/brain/brain-reindex.js";
8
+ import { brainIndexState } from "@ocean/brain/brain-service.js";
9
+ import { loadObsidianConnection } from "@ocean/services/integrations/obsidian/vault-discovery.js";
10
+ import { watchObsidianVault } from "@ocean/services/integrations/obsidian/vault-sync.js";
11
11
  import { refreshClaudeProjects } from "../../application/pull/server-capture.js";
12
12
  import { createOllamaEmbedder } from "../providers/ollama-embedder.js";
13
13
  const HOUR_MS = 60 * 60 * 1000;
@@ -67,7 +67,7 @@ export function startBackgroundPull() {
67
67
  if (process.env.OCEAN_NO_PULL_ON_START === "1")
68
68
  return;
69
69
  try {
70
- spawn(process.execPath, [process.argv[1], "pull", "--yes", "--daily"], {
70
+ spawn(process.execPath, [process.argv[1], "capture", "import", "--yes", "--daily"], {
71
71
  detached: true,
72
72
  stdio: "ignore",
73
73
  })
@@ -84,7 +84,7 @@ export function startBackgroundRhythm() {
84
84
  if (process.env.OCEAN_NO_PULL_ON_START === "1")
85
85
  return;
86
86
  try {
87
- spawn(process.execPath, [process.argv[1], "rhythm", "--yes"], {
87
+ spawn(process.execPath, [process.argv[1], "day", "auto", "--yes"], {
88
88
  detached: true,
89
89
  stdio: "ignore",
90
90
  })
@@ -97,7 +97,7 @@ export function startBackgroundRhythm() {
97
97
  }
98
98
  // Scheduled agent runs (T-322): each guarded schedule that is due, at most hourly. Schedules
99
99
  // without a guard never run (local-scheduler.ts).
100
- export function startBackgroundSchedules() {
100
+ function startBackgroundSchedules() {
101
101
  if (process.env.OCEAN_NO_PULL_ON_START === "1")
102
102
  return;
103
103
  try {
@@ -1,4 +1,4 @@
1
- import { redactRuntimeText } from "@ocean/core/domain/redaction/redaction.js";
1
+ import { redactRuntimeText } from "@ocean/core/domain/redaction.js";
2
2
  import { DEFAULT_MAX_OUTPUT_BYTES } from "../process/cli-process.js";
3
3
  // OpenAI-compatible chat completions over built-in fetch (T-245 Phase 4). Endpoints and
4
4
  // credential variable names are fixed here, never taken from a profile, so a profile cannot
@@ -8,7 +8,7 @@ export const completionEndpoints = {
8
8
  deepseek: "https://api.deepseek.com/chat/completions",
9
9
  openrouter: "https://openrouter.ai/api/v1/chat/completions",
10
10
  };
11
- export const completionCredentialEnv = {
11
+ const completionCredentialEnv = {
12
12
  deepseek: "DEEPSEEK_API_KEY",
13
13
  openrouter: "OPENROUTER_API_KEY",
14
14
  };
@@ -1,5 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
- import { evaluateGuard, } from "@ocean/loop/operations/write-guard.js";
2
+ import { evaluateGuard, } from "@ocean/work/runs/operations/write-guard.js";
3
3
  import { redactRuntimeText } from "../observability/runtime-logger.js";
4
4
  import { resolveOriginalExecutable } from "./provider-registry.js";
5
5
  export const PROVIDER_HEADLESS = {
@@ -1,4 +1,5 @@
1
1
  import { mkdir } from "node:fs/promises";
2
+ import os from "node:os";
2
3
  import { oceanEnv, oceanEnvPair, oceanPath, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
3
4
  import { resolveOriginalExecutable } from "./provider-registry.js";
4
5
  import { runProvider } from "./providers.js";
@@ -6,17 +7,20 @@ import { runProvider } from "./providers.js";
6
7
  // whose session it was runs it, so whoever uses only Codex gets capture too and no other CLI is
7
8
  // required. Read-only, in a folder of its own (no project context to load), with a cheap model
8
9
  // where the client has a known one. OCEAN_SESSION_FACTS_MODEL overrides it.
10
+ // Sonnet, not Haiku (T-329 phase 2): free triage already drops the trivial chats, each chat is
11
+ // read once it is closed, and the extraction has to tell a confirmed decision from an assistant
12
+ // guess, which the smaller model got wrong.
9
13
  // The env flag the spawned call carries: its own hooks see it and do nothing, so the capture
10
14
  // call is never recorded as a session, and never captures from itself.
11
15
  export const FACTS_CALL_ENV = "FACTS_CALL";
12
16
  const DEFAULT_MODEL = {
13
- claude: "haiku",
17
+ claude: "sonnet",
14
18
  };
15
19
  const PROVIDER = {
16
20
  claude: "claude",
17
21
  codex: "codex",
18
22
  };
19
- const TIMEOUT_MS = 90_000;
23
+ const TIMEOUT_MS = 180_000;
20
24
  // The whole task is in the prompt; the system prompt only keeps the answer machine-readable.
21
25
  const FACTS_SYSTEM_PROMPT = "You extract durable facts from a conversation transcript. Follow the instructions in the message exactly and answer with JSON only.";
22
26
  // The model's final answer: the Claude SDK's `result` message, or Codex's last agent message
@@ -43,6 +47,59 @@ export function finalText(events) {
43
47
  }
44
48
  return answer ?? (texts.length ? texts.join("\n") : null);
45
49
  }
50
+ const count = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
51
+ // The tokens a call reported (T-340): the Claude SDK's `result` message carries `usage` with
52
+ // cache reads and writes apart; Codex's `turn.completed` carries `usage` with cached input
53
+ // counted inside input. Null when no event reported any.
54
+ export function tokenUsage(events) {
55
+ let usage = null;
56
+ for (const event of events) {
57
+ const data = event.data;
58
+ if (!data || typeof data !== "object")
59
+ continue;
60
+ const reported = data.usage;
61
+ if (!reported || typeof reported !== "object")
62
+ continue;
63
+ if (data.type === "result")
64
+ usage = {
65
+ input_tokens: count(reported.input_tokens),
66
+ output_tokens: count(reported.output_tokens),
67
+ cache_read_tokens: count(reported.cache_read_input_tokens),
68
+ cache_write_tokens: count(reported.cache_creation_input_tokens),
69
+ };
70
+ else if (data.type === "turn.completed") {
71
+ const cached = count(reported.cached_input_tokens);
72
+ usage = {
73
+ input_tokens: Math.max(0, count(reported.input_tokens) - cached),
74
+ output_tokens: count(reported.output_tokens),
75
+ cache_read_tokens: cached,
76
+ cache_write_tokens: 0,
77
+ };
78
+ }
79
+ }
80
+ return usage;
81
+ }
82
+ const AUTH_FAILURE = /not logged in|please run \/login|invalid api key|authentication|unauthori[sz]ed|oauth token/i;
83
+ // Why a call that gave no answer gave none: a sign-in failure shows in the client's own text,
84
+ // a timeout is the supervisor's exit code 124.
85
+ export function failureReason(exitCode, events, stderr = "") {
86
+ if (exitCode === 124)
87
+ return "timeout";
88
+ const text = [
89
+ stderr,
90
+ ...events.map((event) => typeof event.data === "string" ? event.data : JSON.stringify(event.data)),
91
+ ].join("\n");
92
+ if (AUTH_FAILURE.test(text))
93
+ return "auth";
94
+ return exitCode === 0 ? "no-answer" : "exit";
95
+ }
96
+ // The identity a macOS keychain lookup needs. A job started by launchd or a hook can reach this
97
+ // call without USER or LOGNAME, and Claude Code then reports "Not logged in" although the owner
98
+ // is signed in; naming them explicitly makes the call independent of how it was started.
99
+ function identityEnv() {
100
+ const user = os.userInfo().username;
101
+ return { USER: user, LOGNAME: user, HOME: os.homedir() };
102
+ }
46
103
  export function sessionFactsCompleter(client, run = runProvider) {
47
104
  const provider = PROVIDER[client];
48
105
  if (!provider)
@@ -54,9 +111,11 @@ export function sessionFactsCompleter(client, run = runProvider) {
54
111
  return null;
55
112
  }
56
113
  const model = oceanEnv("SESSION_FACTS_MODEL") ?? DEFAULT_MODEL[provider];
57
- return async (prompt) => {
114
+ const complete = async (prompt) => {
58
115
  const cwd = oceanPath(SYSTEM_DIR, "state", "memory", "extract");
59
116
  await mkdir(cwd, { recursive: true, mode: 0o700 });
117
+ complete.lastFailure = undefined;
118
+ complete.lastUsage = undefined;
60
119
  const result = await run({
61
120
  provider,
62
121
  prompt,
@@ -65,9 +124,23 @@ export function sessionFactsCompleter(client, run = runProvider) {
65
124
  bare: { systemPrompt: FACTS_SYSTEM_PROMPT },
66
125
  model,
67
126
  timeoutMs: TIMEOUT_MS,
68
- env: oceanEnvPair(FACTS_CALL_ENV, "1"),
127
+ env: { ...identityEnv(), ...oceanEnvPair(FACTS_CALL_ENV, "1") },
69
128
  });
70
- return result.exitCode === 0 ? finalText(result.events) : null;
129
+ const usage = tokenUsage(result.events);
130
+ if (usage)
131
+ complete.lastUsage = usage;
132
+ let answer = result.exitCode === 0 ? finalText(result.events) : null;
133
+ // The client's own sign-in notice is plain text, never the JSON asked for.
134
+ if (answer !== null &&
135
+ !answer.trimStart().startsWith("{") &&
136
+ AUTH_FAILURE.test(answer.slice(0, 200)))
137
+ answer = null;
138
+ if (answer === null)
139
+ complete.lastFailure = failureReason(result.exitCode, result.events, result.stderr);
140
+ return answer;
71
141
  };
142
+ // Without a model of its own the client's default answers; the record says which client.
143
+ complete.model = model ?? `${provider} default`;
144
+ return complete;
72
145
  }
73
146
  //# sourceMappingURL=session-facts-completer.js.map
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { validateSessionEntryContract } from "@ocean/core/domain/sessions/entry-contract.js";
3
- import { openSessionStore } from "@ocean/loop/infrastructure/persistence/session-store.js";
4
- import { sessionProjectId } from "@ocean/loop/sessions/session-projects.js";
3
+ import { sessionProjectId } from "@ocean/work/sessions/session-projects.js";
4
+ import { openSessionStore } from "@ocean/work/sessions/session-store.js";
5
5
  import { authLogin, authStatus, } from "../../application/auth/auth-orchestrator.js";
6
6
  import { defaultAuthDeps } from "../../composition/runtime.js";
7
7
  export async function runAuthCommand(action, provider) {
@@ -1,5 +1,5 @@
1
1
  import { localDate } from "@ocean/core/shared/local-date.js";
2
- import { buildBrief } from "@ocean/services/brief/brief.js";
2
+ import { buildBrief } from "@ocean/services/day/brief.js";
3
3
  // `ocean brief [--weekly] [--dry-run] [--date YYYY-MM-DD]` (T-314): what moved in what the owner
4
4
  // follows, written to 01-daily/reports/briefs/.
5
5
  export async function runBriefCommand(args) {
@@ -1,9 +1,9 @@
1
- import { openSessionStore } from "@ocean/loop/infrastructure/persistence/session-store.js";
2
- import { BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE, browserLabel, browserProfileRoot, CHROMIUM_BROWSERS, listeningBrowsers, resolveBrowserChoice, selectedBrowserProfile, } from "@ocean/market/mcp/chrome-debugging.js";
3
- import { keychainStore } from "@ocean/market/security/secrets.js";
4
- import { BrowserService, } from "@ocean/services/browser/browser-service.js";
5
- import { BrowserSessionManager, browserDownloadsPath, } from "@ocean/services/browser/browser-session.js";
6
- import { BrowserTaskRunner } from "@ocean/services/browser/browser-task-runner.js";
1
+ import { BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE, browserLabel, browserProfileRoot, CHROMIUM_BROWSERS, listeningBrowsers, resolveBrowserChoice, selectedBrowserProfile, } from "@ocean/connect/mcp/chrome-debugging.js";
2
+ import { keychainStore } from "@ocean/connect/security/secrets.js";
3
+ import { BrowserService, } from "@ocean/services/integrations/browser/browser-service.js";
4
+ import { BrowserSessionManager, browserDownloadsPath, } from "@ocean/services/integrations/browser/browser-session.js";
5
+ import { BrowserTaskRunner } from "@ocean/services/integrations/browser/browser-task-runner.js";
6
+ import { openSessionStore } from "@ocean/work/sessions/session-store.js";
7
7
  import { PlaywrightBrowserProvider } from "../../infrastructure/providers/playwright-browser-provider.js";
8
8
  import { browserBlocklist, browserConnection, browserProfile, browserUsage, useFirefox, } from "./browser-settings.js";
9
9
  // `ocean browser use <name|path>`: which Chromium browser `dev.ocean/chrome-devtools` attaches
@@ -1,17 +1,14 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import path from "node:path";
3
- import { mcpServerFile } from "@ocean/market/adapters/mcp-adapter.js";
4
- import { marketplacePaths } from "@ocean/market/install/default-marketplace.js";
5
- import { BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE, browserLabel, chromeDebuggingListening, listeningBrowsers, selectedBrowserProfile, } from "@ocean/market/mcp/chrome-debugging.js";
6
- import { keychainStore } from "@ocean/market/security/secrets.js";
3
+ import { mcpServerFile } from "@ocean/connect/adapters/mcp-adapter.js";
4
+ import { marketplacePaths } from "@ocean/connect/install/default-marketplace.js";
5
+ import { BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE, browserLabel, chromeDebuggingListening, listeningBrowsers, selectedBrowserProfile, } from "@ocean/connect/mcp/chrome-debugging.js";
6
+ import { keychainStore } from "@ocean/connect/security/secrets.js";
7
7
  // Marketplace capabilities that attach to the owner's running browser (T-298).
8
- export const BROWSER_CAPABILITIES = [
9
- "dev.ocean/chrome-devtools",
10
- "dev.ocean/browser",
11
- ];
8
+ const BROWSER_CAPABILITIES = ["dev.ocean/chrome-devtools", "dev.ocean/browser"];
12
9
  // chrome-devtools-mcp attaches with --autoConnect, which needs the inspect page's remote
13
10
  // debugging switch: Chromium 144 or later.
14
- export const MIN_AUTO_CONNECT_MAJOR = 144;
11
+ const MIN_AUTO_CONNECT_MAJOR = 144;
15
12
  // The Chromium major the browser last ran, from the `Last Version` file it keeps in its profile
16
13
  // root (Brave writes the Chromium version there too). No DevTools connection, so no prompt.
17
14
  export function browserMajorVersion(root) {
@@ -2,21 +2,21 @@ import { spawnSync } from "node:child_process";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
- import { mcpServerFile } from "@ocean/market/adapters/mcp-adapter.js";
6
- import { marketplacePaths } from "@ocean/market/install/default-marketplace.js";
7
- import { BROWSER_CAPABILITY } from "@ocean/market/mcp/chrome-debugging.js";
5
+ import { mcpServerFile } from "@ocean/connect/adapters/mcp-adapter.js";
6
+ import { marketplacePaths } from "@ocean/connect/install/default-marketplace.js";
7
+ import { BROWSER_CAPABILITY } from "@ocean/connect/mcp/chrome-debugging.js";
8
8
  // Settings of ocean-browser-mcp (T-324), stored like `ocean browser use`: one value per
9
9
  // variable in the secret store, read by every client's launch of `dev.ocean/chrome-devtools`.
10
10
  // Restart open clients after a change.
11
- export const PROFILE_VARIABLE = "OCEAN_BROWSER_PROFILE";
12
- export const BLOCKED_VARIABLE = "OCEAN_BROWSER_BLOCKED";
13
- export const BROWSER_PROFILES = ["standard", "full", "lean", "slim"];
11
+ const PROFILE_VARIABLE = "OCEAN_BROWSER_PROFILE";
12
+ const BLOCKED_VARIABLE = "OCEAN_BROWSER_BLOCKED";
13
+ const BROWSER_PROFILES = ["standard", "full", "lean", "slim"];
14
14
  const DEFAULT_PROFILE = "standard";
15
15
  // `dev.ocean/firefox-devtools` keeps its own profile folder once `ocean browser use firefox`
16
16
  // names one; unset, Mozilla's server starts a fresh temporary profile each run.
17
- export const FIREFOX_CAPABILITY = "dev.ocean/firefox-devtools";
18
- export const FIREFOX_PROFILE_VARIABLE = "OCEAN_FIREFOX_PROFILE";
19
- export function firefoxProfileDir(env = process.env) {
17
+ const FIREFOX_CAPABILITY = "dev.ocean/firefox-devtools";
18
+ const FIREFOX_PROFILE_VARIABLE = "OCEAN_FIREFOX_PROFILE";
19
+ function firefoxProfileDir(env = process.env) {
20
20
  const base = env.XDG_STATE_HOME || path.join(os.homedir(), ".local", "state");
21
21
  return path.join(base, "ocean-firefox", "profile");
22
22
  }
@@ -83,7 +83,7 @@ export function browserBlocklist(store, action = "list", pattern) {
83
83
  };
84
84
  }
85
85
  // The wrapper's own state folder (usage log, screenshot previews); same rule as its stateDir().
86
- export function browserStateDir(env = process.env) {
86
+ function browserStateDir(env = process.env) {
87
87
  if (env.OCEAN_BROWSER_STATE_DIR)
88
88
  return env.OCEAN_BROWSER_STATE_DIR;
89
89
  const base = env.XDG_STATE_HOME || path.join(os.homedir(), ".local", "state");
@@ -1,13 +1,13 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { appendFile, mkdir, writeFile } from "node:fs/promises";
3
3
  import path from "node:path";
4
- import { syncCaptureInbox } from "@ocean/brain/capture/inbox-sync.js";
5
4
  import { syncMemoryIndexes } from "@ocean/brain/memory/index-sync.js";
5
+ import { syncCaptureInbox } from "@ocean/brain/sessions-capture/inbox-sync.js";
6
6
  import { validateSessionEntryContract } from "@ocean/core/domain/sessions/entry-contract.js";
7
7
  import { localDate } from "@ocean/core/shared/local-date.js";
8
8
  import { isUnderNotes, KNOWLEDGE_DIR, NOTES_DIR, oceanPath, oceanRoot, PERSONAL_DIR, PROJECTS_DIR, WORKSPACE_PROJECT_ID, } from "@ocean/core/shared/paths.js";
9
- import { openSessionStore } from "@ocean/loop/infrastructure/persistence/session-store.js";
10
- import { sessionProjectId } from "@ocean/loop/sessions/session-projects.js";
9
+ import { sessionProjectId } from "@ocean/work/sessions/session-projects.js";
10
+ import { openSessionStore } from "@ocean/work/sessions/session-store.js";
11
11
  import { redactRuntimeText } from "../../infrastructure/observability/runtime-logger.js";
12
12
  export async function runCaptureCommand(action, args) {
13
13
  const store = await openSessionStore();
@@ -87,7 +87,7 @@ export async function runCaptureCommand(action, args) {
87
87
  store.close();
88
88
  }
89
89
  }
90
- async function promote(item, target = "knowledge/results") {
90
+ async function promote(item, target = "knowledge/lessons") {
91
91
  if (target.startsWith("memory/")) {
92
92
  const relative = target.slice("memory/".length);
93
93
  if (!relative.endsWith(".md") || relative.includes(".."))
@@ -110,7 +110,7 @@ async function promote(item, target = "knowledge/results") {
110
110
  await appendFile(oceanPath(PROJECTS_DIR, "backlog.md"), `\n- [TODO] (P2) ${WORKSPACE_PROJECT_ID} — ${item.content.replace(/\s+/g, " ").trim()} {${localDate()}}\n`);
111
111
  return;
112
112
  }
113
- const match = target.match(/^knowledge\/(architecture|decisions|discoveries|failures|research|results|solutions|references)$/);
113
+ const match = target.match(/^knowledge\/(decisions|lessons)$/);
114
114
  if (!match)
115
115
  throw new Error("Target must be knowledge/<kind>, memory/<file>.md, or backlog.");
116
116
  const safe = item.content
@@ -121,7 +121,7 @@ async function promote(item, target = "knowledge/results") {
121
121
  const slug = safe || `capture-${item.captureId}`;
122
122
  const file = path.join(oceanPath(KNOWLEDGE_DIR, match[1], `${slug}-${item.captureId}.md`));
123
123
  await mkdir(path.dirname(file), { recursive: true });
124
- await writeFile(file, `---\nname: ${slug}-${item.captureId}\ndescription: Candidate promoted from a reviewed session input\ntype: ${match[1] === "results" ? "task-result" : match[1].slice(0, -1)}\ndomain: ${match[1]}\nstatus: current\nverification: unverified\nsource: session-capture-${item.captureId}\n---\n\n${item.content.trim()}\n`);
124
+ await writeFile(file, `---\nname: ${slug}-${item.captureId}\ndescription: Candidate promoted from a reviewed session input\ntype: ${match[1].slice(0, -1)}\ndomain: ${match[1]}\nstatus: current\nverification: unverified\nsource: session-capture-${item.captureId}\n---\n\n${item.content.trim()}\n`);
125
125
  await syncMemoryIndexes(true);
126
126
  }
127
127
  //# sourceMappingURL=capture-command.js.map
@@ -1,11 +1,11 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
- import { buildOceanBootstrap } from "@ocean/context/context/resource-injection.js";
4
+ import { buildOceanBootstrap } from "@ocean/context/resource-injection.js";
5
5
  import { enginePath, oceanPath, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
6
6
  import { resolveProject } from "@ocean/core/shared/project-resolution.js";
7
- import { claudeNativeHookStatus } from "@ocean/loop/hooks/session-start-hook.js";
8
- import { openSessionStore } from "@ocean/loop/infrastructure/persistence/session-store.js";
7
+ import { claudeNativeHookStatus } from "@ocean/work/sessions/hooks/session-start-hook.js";
8
+ import { openSessionStore } from "@ocean/work/sessions/session-store.js";
9
9
  import { findProvider, loadProviderRegistry, resolveOriginalExecutable, } from "../../infrastructure/providers/provider-registry.js";
10
10
  import { providerWrapperName, providerWrapperPath, shimDirectory, } from "../../infrastructure/wrappers/wrapper-manager.js";
11
11
  export async function runClientTestCommand(providerName, json = false) {
@@ -1,17 +1,20 @@
1
1
  import readline from "node:readline/promises";
2
2
  import { memorySettings, setSessionFacts, } from "@ocean/brain/memory/memory-audit.js";
3
- import { marketplacePaths } from "@ocean/market/install/default-marketplace.js";
4
- import { updateGatewayAccess } from "@ocean/market/mcp/mcp-gateway.js";
5
- import { readCallLedger, summarizeCallLedger, } from "@ocean/services/infrastructure/mcp/call-ledger.js";
3
+ import { marketplacePaths } from "@ocean/connect/install/default-marketplace.js";
4
+ import { updateGatewayAccess } from "@ocean/connect/mcp/mcp-gateway.js";
5
+ import { readCallLedger, summarizeCallLedger, } from "@ocean/services/integrations/mcp/call-ledger.js";
6
+ import { CLAUDE_PLUGIN_STEPS, DESKTOP_EXTENSION_STEPS, desktopConfigHasOcean, writeBundles, } from "../../application/clients/bundles.js";
6
7
  import { CHAT_PLUGIN_STEPS, chatPluginAdded, openChatPluginSetup, } from "../../application/clients/chat-plugin.js";
8
+ import { applyClientDetect, detectNewClients, notifyNewClients, planClientDetect, restoreClientDetect, } from "../../application/clients/client-detect.js";
7
9
  import { applyClients, attributeLedger, confirmClient, defaultClientEnv, gatewayDefault, planClients, readGatewayClients, recordVerification, repairClients, restoreClients, setGatewayClient, setGatewayDefault, temporaryEntryProblem, verifyClient, } from "../../application/clients/clients.js";
8
10
  import { applyDesktopWatcher, planDesktopWatcher, restoreDesktopWatcher, } from "../../application/clients/desktop-watcher.js";
9
11
  import { applyHooks, planHooks, restoreHooks, } from "../../application/clients/hooks.js";
10
12
  import { applyNative, planNative, restoreNative, } from "../../application/clients/native.js";
11
13
  import { applyOpencodePlugin, planOpencodePlugin, restoreOpencodePlugin, } from "../../application/clients/opencode-plugin.js";
12
14
  import { buildClientStatus, formatClientStatus, } from "../../application/clients/status.js";
13
- const usage = "Usage: ocean clients status [--json] [--days <n>] | detect|plan [--json] | apply [--client <id>…] [--yes] [--session-facts on|off] | chat-plugin | verify [<id>…] | confirm <id>… --label in-app|headless|connected|blocked [--via <evidence>] [--reason <why>] | gateway [<id> on|off] [--default gateway|per-server] | allow|deny|unset <id> <server> | ledger | repair | restore [--batch <id>]";
14
- export const SESSION_FACTS_QUESTION = "Capture durable facts from your sessions automatically? It costs one small model call per session, run by the client the session was in. Every fact goes to your review queue; nothing is saved without your approval, even with auto-approve on. [y/N] ";
15
+ import { oceanVersion } from "../../version.js";
16
+ const usage = "Usage: ocean clients status [--json] [--days <n>] | detect|plan [--json] | detect --new [--notify] | apply [--client <id>…] [--yes] [--session-facts on|off] | chat-plugin | bundles [--out <dir>] | verify [<id>…] | confirm <id>… --label in-app|headless|connected|blocked [--via <evidence>] [--reason <why>] | gateway [<id> on|off] [--default gateway|per-server] | allow|deny|unset <id> <server> | ledger | repair | restore [--batch <id>]";
17
+ const SESSION_FACTS_QUESTION = "Capture durable facts from your sessions automatically? It costs one small model call per session, run by the client the session was in. Every fact goes to your review queue; nothing is saved without your approval, even with auto-approve on. [y/N] ";
15
18
  // The session-facts answer, asked once (T-313): `--session-facts on|off` decides; otherwise a
16
19
  // terminal is asked; with no terminal and no saved answer it stays unset (off), and
17
20
  // `ocean doctor` points to `ocean memory session-facts on|off`.
@@ -73,6 +76,22 @@ export async function runClientsCommand(args) {
73
76
  }
74
77
  result = report;
75
78
  }
79
+ else if (action === "detect" && rest.includes("--new")) {
80
+ // Clients installed since the last look (T-328 P7); `--notify` is how the detector runs.
81
+ const found = await detectNewClients();
82
+ if (rest.includes("--notify"))
83
+ await notifyNewClients(found.offers);
84
+ if (!json) {
85
+ if (found.seeded)
86
+ console.log("Recorded every installed client; new ones are offered from now on.");
87
+ for (const offer of found.offers)
88
+ console.log(`${offer.label} is installed — connect it: ${offer.command}`);
89
+ if (!found.seeded && !found.offers.length)
90
+ console.log("No new client to connect.");
91
+ return;
92
+ }
93
+ result = found;
94
+ }
76
95
  else if (action === "detect" || action === "plan") {
77
96
  const plans = await planClients();
78
97
  // `apply` refuses a temporary engine; the plan says so up front (T-300).
@@ -97,6 +116,9 @@ export async function runClientsCommand(args) {
97
116
  if (action === "plan")
98
117
  for (const plugin of await planOpencodePlugin())
99
118
  console.log(`${"opencode hook".padEnd(15)} ${plugin.status.padEnd(14)} ${plugin.file} plugin${plugin.reason ? ` (${plugin.reason})` : ""}`);
119
+ if (action === "plan")
120
+ for (const detector of await planClientDetect())
121
+ console.log(`${"client detector".padEnd(15)} ${detector.status.padEnd(14)} ${detector.file} new-client offers${detector.reason ? ` (${detector.reason})` : ""}`);
100
122
  if (action === "plan")
101
123
  for (const watcher of await planDesktopWatcher())
102
124
  console.log(`${"claude-desktop watcher".padEnd(15)} ${watcher.status.padEnd(14)} ${watcher.file} chat capture${watcher.reason ? ` (${watcher.reason})` : ""}`);
@@ -111,6 +133,7 @@ export async function runClientsCommand(args) {
111
133
  plugins: await planOpencodePlugin(),
112
134
  native: await planNative(),
113
135
  watcher: await planDesktopWatcher(),
136
+ detector: await planClientDetect(),
114
137
  };
115
138
  }
116
139
  else if (action === "apply") {
@@ -126,7 +149,10 @@ export async function runClientsCommand(args) {
126
149
  (!clients.length || clients.includes(plan.client)));
127
150
  const watcher = (await planDesktopWatcher()).filter((plan) => plan.status === "change" &&
128
151
  (!clients.length || clients.includes(plan.client)));
129
- console.log(JSON.stringify({ dryRun: true, pending, hooks, plugins, native, watcher }, null, 2));
152
+ const detector = clients.length
153
+ ? []
154
+ : (await planClientDetect()).filter((plan) => plan.status === "change");
155
+ console.log(JSON.stringify({ dryRun: true, pending, hooks, plugins, native, watcher, detector }, null, 2));
130
156
  console.error("Dry run: pass --yes to write these client configs.");
131
157
  return;
132
158
  }
@@ -155,6 +181,8 @@ export async function runClientsCommand(args) {
155
181
  result = {
156
182
  ...appliedAll,
157
183
  watcher: (await applyDesktopWatcher({ clients: selected, batch: applied.batch })).results,
184
+ // A whole apply only: the detector serves every client, not the one `--client` names.
185
+ detector: (await applyClientDetect({ clients: selected, batch: applied.batch })).results,
158
186
  ...(chatPlugin ? { chatPlugin } : {}),
159
187
  };
160
188
  }
@@ -178,6 +206,26 @@ export async function runClientsCommand(args) {
178
206
  }
179
207
  result = { added, ...(opened ?? {}) };
180
208
  }
209
+ else if (action === "bundles") {
210
+ // One-click bundles (T-328): the Claude Desktop Extension and the Claude plugin, written
211
+ // to Downloads (or --out) with the clicks to install each. Installing stays the user's.
212
+ const written = await writeBundles(await oceanVersion(), values("--out")[0]);
213
+ const duplicate = desktopConfigHasOcean();
214
+ if (!json) {
215
+ console.log(`Saved ${written.extension}`);
216
+ for (const step of DESKTOP_EXTENSION_STEPS)
217
+ console.log(` ${step}`);
218
+ if (duplicate)
219
+ console.log(" Ocean is already in claude_desktop_config.json: keep one of the two, or Desktop shows every Ocean tool twice");
220
+ console.log(`Saved ${written.plugin}`);
221
+ for (const step of CLAUDE_PLUGIN_STEPS)
222
+ console.log(` ${step}`);
223
+ if (chatPluginAdded() === true)
224
+ console.log(" An Ocean skill is already in your Claude account: remove the ocean-memory upload once the plugin is in, so the skill loads once");
225
+ return;
226
+ }
227
+ result = { ...written, desktopConfigHasOcean: duplicate };
228
+ }
181
229
  else if (action === "verify") {
182
230
  const ids = rest.filter((arg) => !arg.startsWith("--"));
183
231
  const targets = ids.length
@@ -255,6 +303,7 @@ export async function runClientsCommand(args) {
255
303
  plugins: await restoreOpencodePlugin({ batch: restored.batch }),
256
304
  native: await restoreNative({ batch: restored.batch }),
257
305
  watcher: await restoreDesktopWatcher({ batch: restored.batch }),
306
+ detector: await restoreClientDetect({ batch: restored.batch }),
258
307
  }
259
308
  : restored;
260
309
  }