@amoree-code/ocean 2.23.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 (380) hide show
  1. package/README.md +46 -53
  2. package/dist/application/clients/bundles.js +1 -1
  3. package/dist/application/clients/client-detect.js +291 -0
  4. package/dist/application/clients/clients.js +104 -25
  5. package/dist/application/clients/desktop-link.js +40 -0
  6. package/dist/application/clients/desktop-watcher.js +6 -4
  7. package/dist/application/clients/hook-trust.js +106 -0
  8. package/dist/application/clients/hooks.js +7 -1
  9. package/dist/application/clients/mcp-schema-cost.js +74 -0
  10. package/dist/application/clients/native.js +38 -2
  11. package/dist/application/clients/registry.js +51 -9
  12. package/dist/application/clients/status.js +7 -2
  13. package/dist/application/gateway/webhook-gateway.js +1 -1
  14. package/dist/application/integrations/charter-copies.js +1 -1
  15. package/dist/application/integrations/engine-entry-repair.js +4 -3
  16. package/dist/application/integrations/skill-auto-sync.js +2 -2
  17. package/dist/application/integrations/skill-filter.js +1 -1
  18. package/dist/application/integrations/skill-router.js +134 -90
  19. package/dist/application/layout/layout-apply.js +1 -1
  20. package/dist/application/layout/workspace-template.js +1 -1
  21. package/dist/application/onboarding/steps.js +121 -30
  22. package/dist/application/profiles/profile-doctor.js +118 -0
  23. package/dist/application/profiles/profile-migration-service.js +208 -0
  24. package/dist/application/profiles/profile-suggestion.js +3 -7
  25. package/dist/application/profiles/profile-upgrade-service.js +98 -86
  26. package/dist/application/pull/history-index.js +1 -1
  27. package/dist/application/pull/project-match.js +3 -3
  28. package/dist/application/pull/pull.js +1 -1
  29. package/dist/application/pull/server-capture.js +92 -9
  30. package/dist/application/scheduler/local-scheduler.js +2 -2
  31. package/dist/application/spend/claude-prices.js +55 -0
  32. package/dist/application/spend/claude-spend.js +365 -0
  33. package/dist/application/uninstall/uninstall.js +25 -3
  34. package/dist/application/upkeep/nightly-upkeep.js +4 -4
  35. package/dist/composition/runtime.js +2 -2
  36. package/dist/infrastructure/desktop/claude-export.js +1 -1
  37. package/dist/infrastructure/desktop/desktop-chat.js +60 -13
  38. package/dist/infrastructure/desktop/indexeddb.js +4 -4
  39. package/dist/infrastructure/desktop/leveldb.js +2 -2
  40. package/dist/infrastructure/filesystem/profile-loader.js +3 -45
  41. package/dist/infrastructure/filesystem/runtime-config-loader.js +1 -1
  42. package/dist/infrastructure/observability/runtime-logger.js +1 -1
  43. package/dist/infrastructure/process/agent-tool-executor.js +3 -3
  44. package/dist/infrastructure/process/process-supervisor.js +1 -1
  45. package/dist/infrastructure/process/service.js +8 -8
  46. package/dist/infrastructure/providers/openai-compatible.js +2 -2
  47. package/dist/infrastructure/providers/provider-invocation.js +1 -1
  48. package/dist/infrastructure/providers/session-facts-completer.js +78 -5
  49. package/dist/interfaces/cli/auth-command.js +2 -2
  50. package/dist/interfaces/cli/brief-command.js +1 -1
  51. package/dist/interfaces/cli/browser-command.js +6 -6
  52. package/dist/interfaces/cli/browser-findings.js +6 -9
  53. package/dist/interfaces/cli/browser-settings.js +10 -10
  54. package/dist/interfaces/cli/capture-command.js +6 -6
  55. package/dist/interfaces/cli/client-test-command.js +3 -3
  56. package/dist/interfaces/cli/clients-command.js +33 -6
  57. package/dist/interfaces/cli/command-aliases.js +56 -0
  58. package/dist/interfaces/cli/command-registry.js +48 -1414
  59. package/dist/interfaces/cli/commands/browser.js +5 -0
  60. package/dist/interfaces/cli/commands/capture.js +19 -0
  61. package/dist/interfaces/cli/commands/catalog.js +9 -0
  62. package/dist/interfaces/cli/commands/client.js +135 -0
  63. package/dist/interfaces/cli/commands/clients.js +33 -0
  64. package/dist/interfaces/cli/commands/connectors.js +14 -0
  65. package/dist/interfaces/cli/commands/context.js +9 -0
  66. package/dist/interfaces/cli/commands/cost.js +15 -0
  67. package/dist/interfaces/cli/commands/daily.js +11 -0
  68. package/dist/interfaces/cli/commands/day.js +25 -0
  69. package/dist/interfaces/cli/commands/dispatch.js +31 -0
  70. package/dist/interfaces/cli/commands/doctor.js +60 -0
  71. package/dist/interfaces/cli/commands/env.js +5 -0
  72. package/dist/interfaces/cli/commands/gateway.js +16 -0
  73. package/dist/interfaces/cli/commands/handoff.js +11 -0
  74. package/dist/interfaces/cli/commands/health.js +17 -0
  75. package/dist/interfaces/cli/commands/hook.js +142 -0
  76. package/dist/interfaces/cli/commands/idea.js +11 -0
  77. package/dist/interfaces/cli/commands/install.js +31 -0
  78. package/dist/interfaces/cli/commands/intent.js +14 -0
  79. package/dist/interfaces/cli/commands/intercept.js +22 -0
  80. package/dist/interfaces/cli/commands/layout.js +11 -0
  81. package/dist/interfaces/cli/commands/lifecycle.js +5 -0
  82. package/dist/interfaces/cli/commands/loop.js +73 -0
  83. package/dist/interfaces/cli/commands/market.js +11 -0
  84. package/dist/interfaces/cli/commands/mcp.js +57 -0
  85. package/dist/interfaces/cli/commands/memory.js +5 -0
  86. package/dist/interfaces/cli/commands/migrate.js +5 -0
  87. package/dist/interfaces/cli/commands/observe.js +11 -0
  88. package/dist/interfaces/cli/commands/obsidian.js +111 -0
  89. package/dist/interfaces/cli/commands/operate.js +7 -0
  90. package/dist/interfaces/cli/commands/policy.js +16 -0
  91. package/dist/interfaces/cli/commands/project.js +207 -0
  92. package/dist/interfaces/cli/commands/repair.js +20 -0
  93. package/dist/interfaces/cli/commands/run.js +52 -0
  94. package/dist/interfaces/cli/commands/schedule.js +58 -0
  95. package/dist/interfaces/cli/commands/service.js +21 -0
  96. package/dist/interfaces/cli/commands/session.js +182 -0
  97. package/dist/interfaces/cli/commands/sessions.js +12 -0
  98. package/dist/interfaces/cli/commands/setup.js +21 -0
  99. package/dist/interfaces/cli/commands/skill.js +159 -0
  100. package/dist/interfaces/cli/commands/tasks.js +10 -0
  101. package/dist/interfaces/cli/commands/update-remove.js +25 -0
  102. package/dist/interfaces/cli/connectors-command.js +150 -0
  103. package/dist/interfaces/cli/context-command.js +39 -3
  104. package/dist/interfaces/cli/cost-command.js +104 -0
  105. package/dist/interfaces/cli/curator-command.js +1 -1
  106. package/dist/interfaces/cli/daily-command.js +7 -1
  107. package/dist/interfaces/cli/desktop-command.js +43 -7
  108. package/dist/interfaces/cli/distill-command.js +7 -2
  109. package/dist/interfaces/cli/express-command.js +1 -1
  110. package/dist/interfaces/cli/failures-command.js +4 -4
  111. package/dist/interfaces/cli/gateway-findings.js +2 -2
  112. package/dist/interfaces/cli/governance-command.js +23 -16
  113. package/dist/interfaces/cli/handoff-command.js +1 -1
  114. package/dist/interfaces/cli/harvest-command.js +2 -2
  115. package/dist/interfaces/cli/help-command.js +53 -169
  116. package/dist/interfaces/cli/hygiene-command.js +1 -1
  117. package/dist/interfaces/cli/idea-command.js +1 -1
  118. package/dist/interfaces/cli/intercept-command.js +8 -7
  119. package/dist/interfaces/cli/interests-command.js +1 -1
  120. package/dist/interfaces/cli/layout-command.js +2 -0
  121. package/dist/interfaces/cli/market-command.js +9 -9
  122. package/dist/interfaces/cli/mcp-gateway-command.js +124 -7
  123. package/dist/interfaces/cli/mcp-probe-command.js +186 -0
  124. package/dist/interfaces/cli/mcp-status-command.js +5 -5
  125. package/dist/interfaces/cli/memory-command.js +41 -7
  126. package/dist/interfaces/cli/migrate-command.js +2 -2
  127. package/dist/interfaces/cli/note-command.js +1 -1
  128. package/dist/interfaces/cli/onboard-command.js +14 -0
  129. package/dist/interfaces/cli/operate-command.js +5 -5
  130. package/dist/interfaces/cli/profiles-command.js +61 -1
  131. package/dist/interfaces/cli/rhythm-command.js +11 -5
  132. package/dist/interfaces/cli/running-server-findings.js +1 -1
  133. package/dist/interfaces/cli/scorecard-command.js +8 -8
  134. package/dist/interfaces/cli/session-facts-command.js +2 -2
  135. package/dist/interfaces/cli/sessions-command.js +145 -0
  136. package/dist/interfaces/cli/setup-command.js +15 -2
  137. package/dist/interfaces/cli/tasks-command.js +63 -13
  138. package/dist/interfaces/cli/telemetry-command.js +4 -4
  139. package/dist/interfaces/cli/uninstall-command.js +1 -1
  140. package/dist/interfaces/cli/week-failures.js +32 -0
  141. package/dist/main.js +12 -0
  142. package/node_modules/@ocean/brain/dist/{infrastructure/brain/brain-index.js → brain-index.js} +2 -2
  143. package/node_modules/@ocean/brain/dist/{brain/brain-markdown.js → brain-markdown.js} +1 -1
  144. package/node_modules/@ocean/brain/dist/{brain/brain-service.js → brain-service.js} +12 -2
  145. package/node_modules/@ocean/brain/dist/memory/brain-dump.js +92 -16
  146. package/node_modules/@ocean/brain/dist/memory/extraction-log.js +125 -0
  147. package/node_modules/@ocean/brain/dist/memory/extraction-retry.js +54 -0
  148. package/node_modules/@ocean/brain/dist/memory/fact-routing.js +44 -1
  149. package/node_modules/@ocean/brain/dist/memory/lesson-activation.js +2 -2
  150. package/node_modules/@ocean/brain/dist/memory/lesson-learning.js +2 -2
  151. package/node_modules/@ocean/brain/dist/memory/lessons.js +1 -1
  152. package/node_modules/@ocean/brain/dist/memory/memory-audit.js +2 -2
  153. package/node_modules/@ocean/brain/dist/memory/memory-harvest.js +1 -1
  154. package/node_modules/@ocean/brain/dist/memory/memory-paths.js +8 -0
  155. package/node_modules/@ocean/brain/dist/memory/memory-review.js +31 -3
  156. package/node_modules/@ocean/brain/dist/memory/memory-trash.js +29 -0
  157. package/node_modules/@ocean/brain/dist/memory/memory-write.js +4 -2
  158. package/node_modules/@ocean/brain/dist/memory/model-narrative.js +2 -2
  159. package/node_modules/@ocean/brain/dist/memory/profile-facts.js +1 -1
  160. package/node_modules/@ocean/brain/dist/memory/routing.json +6 -6
  161. package/node_modules/@ocean/{market/dist/skills → brain/dist/memory}/signal-detection.js +1 -1
  162. package/node_modules/@ocean/brain/dist/{memory → people}/people.js +1 -1
  163. package/node_modules/@ocean/brain/dist/sessions-capture/session-facts.js +625 -0
  164. package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-promotion.js +7 -15
  165. package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-summary.js +1 -1
  166. package/node_modules/@ocean/brain/dist/sessions-capture/session-triage.js +52 -0
  167. package/node_modules/@ocean/brain/package.json +1 -1
  168. package/node_modules/@ocean/connect/dist/connectors/connector-hub.js +173 -0
  169. package/node_modules/@ocean/{market → connect}/dist/install/default-marketplace.js +6 -2
  170. package/node_modules/@ocean/{market → connect}/dist/install/marketplace-service.js +1 -1
  171. package/node_modules/@ocean/connect/dist/mcp/mcp-gateway.js +987 -0
  172. package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-launch.js +102 -5
  173. package/node_modules/@ocean/{market → connect}/dist/registry/official-registry.js +1 -1
  174. package/node_modules/@ocean/{market → connect}/dist/security/permissions.js +1 -1
  175. package/node_modules/@ocean/{market → connect}/dist/skills/skill-hub.js +104 -6
  176. package/node_modules/@ocean/{market → connect}/package.json +2 -2
  177. package/node_modules/@ocean/context/dist/{context/context-ladder.js → context-ladder.js} +3 -3
  178. package/node_modules/@ocean/context/dist/{context/context-references.js → context-references.js} +5 -4
  179. package/node_modules/@ocean/context/dist/{context/context-cost.js → context-size.js} +6 -6
  180. package/node_modules/@ocean/context/dist/{context/intent-router.js → intent-router.js} +1 -1
  181. package/node_modules/@ocean/context/dist/{context/resource-injection.js → resource-injection.js} +3 -1
  182. package/node_modules/@ocean/context/package.json +1 -1
  183. package/node_modules/@ocean/core/dist/domain/brain/brain-record.js +1 -1
  184. package/node_modules/@ocean/core/dist/domain/capabilities/capability-manifest.js +5 -5
  185. package/node_modules/@ocean/core/dist/domain/connector-entry.js +86 -0
  186. package/node_modules/@ocean/core/dist/domain/context/context.js +1 -1
  187. package/node_modules/@ocean/core/dist/domain/context/project-id.js +8 -2
  188. package/node_modules/@ocean/core/dist/domain/{evidence/evidence.js → evidence.js} +1 -1
  189. package/node_modules/@ocean/core/dist/domain/mcp/memory-contract.js +4 -1
  190. package/node_modules/@ocean/core/dist/domain/ports/brain-index-port.js +1 -1
  191. package/node_modules/@ocean/core/dist/domain/profiles/profile-markdown.js +40 -0
  192. package/node_modules/@ocean/core/dist/domain/profiles/profile-resolution.js +276 -0
  193. package/node_modules/@ocean/core/dist/domain/profiles/profile-selection.js +23 -60
  194. package/node_modules/@ocean/core/dist/domain/profiles/profile-upgrade.js +2 -2
  195. package/node_modules/@ocean/core/dist/domain/profiles/profile.js +66 -6
  196. package/node_modules/@ocean/core/dist/domain/profiles/runtime-config.js +1 -1
  197. package/node_modules/@ocean/core/dist/domain/runs/agent-tools.js +2 -2
  198. package/node_modules/@ocean/core/dist/domain/sessions/session-identity.js +53 -0
  199. package/node_modules/@ocean/core/dist/domain/sessions/session-metadata.js +208 -0
  200. package/node_modules/@ocean/core/dist/domain/{tasks/task-id.js → task-id.js} +2 -2
  201. package/node_modules/@ocean/core/dist/profiles/profile-files.js +57 -0
  202. package/node_modules/@ocean/core/dist/profiles/profile-loader.js +97 -0
  203. package/node_modules/@ocean/core/dist/profiles/project-profile-fill.js +33 -0
  204. package/node_modules/@ocean/core/dist/profiles/session-profile.js +158 -0
  205. package/node_modules/@ocean/core/dist/shared/charter.js +110 -0
  206. package/node_modules/@ocean/core/dist/shared/context-ack.js +1 -1
  207. package/node_modules/@ocean/core/dist/shared/context-triggers.js +67 -0
  208. package/node_modules/@ocean/core/dist/shared/paths.js +6 -6
  209. package/node_modules/@ocean/core/dist/shared/project-legacy.js +232 -0
  210. package/node_modules/@ocean/core/dist/shared/project-manifest.js +308 -0
  211. package/node_modules/@ocean/core/dist/shared/project-names.js +87 -0
  212. package/node_modules/@ocean/core/dist/shared/project-register.js +560 -0
  213. package/node_modules/@ocean/core/dist/shared/project-resolution.js +83 -861
  214. package/node_modules/@ocean/core/dist/shared/repo-signals.js +45 -0
  215. package/node_modules/@ocean/core/dist/shared/task-reference.js +1 -1
  216. package/node_modules/@ocean/core/dist/shared/text-tokens.js +37 -0
  217. package/node_modules/@ocean/core/dist/shared/tool-groups.js +224 -0
  218. package/node_modules/@ocean/core/package.json +4 -1
  219. package/node_modules/@ocean/services/dist/day/day.js +45 -3
  220. package/node_modules/@ocean/services/dist/{distill → day}/distill.js +29 -3
  221. package/node_modules/@ocean/services/dist/{harvest → day}/harvest.js +54 -14
  222. package/node_modules/@ocean/services/dist/{brief → day}/interest-discovery.js +3 -3
  223. package/node_modules/@ocean/services/dist/day/note.js +2 -2
  224. package/node_modules/@ocean/services/dist/{onboarding → day}/onboarding.js +1 -1
  225. package/node_modules/@ocean/services/dist/day/patterns.js +68 -0
  226. package/node_modules/@ocean/services/dist/{curator → health}/curator.js +5 -5
  227. package/node_modules/@ocean/services/dist/{journey → health}/failures.js +7 -5
  228. package/node_modules/@ocean/services/dist/{hygiene → health}/hygiene.js +2 -2
  229. package/node_modules/@ocean/services/dist/{journey → health}/lesson-effect.js +1 -1
  230. package/node_modules/@ocean/services/dist/{scorecard → health}/scorecard.js +3 -3
  231. package/node_modules/@ocean/services/dist/{upkeep → health}/upkeep.js +2 -2
  232. package/node_modules/@ocean/services/dist/{doctor → health}/workspace-doctor.js +57 -17
  233. package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-session.js +1 -1
  234. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/call-ledger.js +3 -0
  235. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-client.js +19 -3
  236. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/obsidian-server.js +4 -4
  237. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/ocean-server.js +423 -34
  238. package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/conflict-log.js +1 -1
  239. package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/folder-templates.js +8 -5
  240. package/node_modules/@ocean/services/dist/projects/project-doctor.js +173 -0
  241. package/node_modules/@ocean/services/dist/projects/project-snippet.js +9 -0
  242. package/node_modules/@ocean/services/dist/projects/projects-overview.js +2 -2
  243. package/node_modules/@ocean/services/package.json +1 -1
  244. package/node_modules/@ocean/{loop/dist/loops → work/dist/runs}/guard-runtime.js +3 -3
  245. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/memory-knowledge-operations.js +4 -12
  246. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-contract.js +2 -2
  247. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/project-operations.js +2 -1
  248. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/task-operations.js +4 -4
  249. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/write-guard.js +1 -1
  250. package/node_modules/@ocean/{loop → work}/dist/runs/prompt-assembly.js +2 -2
  251. package/node_modules/@ocean/{loop → work}/dist/runs/run-agent.js +4 -4
  252. package/node_modules/@ocean/{loop → work}/dist/runs/tool-loop.js +4 -4
  253. package/node_modules/@ocean/work/dist/sessions/hooks/desktop-facts.js +309 -0
  254. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-end-hook.js +36 -5
  255. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-facts-hook.js +144 -14
  256. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-start-hook.js +129 -12
  257. package/node_modules/@ocean/work/dist/sessions/hooks/start-brief.js +110 -0
  258. package/node_modules/@ocean/work/dist/sessions/hooks/unlinked-warning.js +68 -0
  259. package/node_modules/@ocean/{loop → work}/dist/sessions/session-closeout.js +4 -4
  260. package/node_modules/@ocean/{loop → work}/dist/sessions/session-projects.js +13 -3
  261. package/node_modules/@ocean/work/dist/sessions/session-relink.js +300 -0
  262. package/node_modules/@ocean/{loop → work}/dist/sessions/session-retention.js +1 -1
  263. package/node_modules/@ocean/{loop → work}/dist/tasks/list-tasks.js +7 -2
  264. package/node_modules/@ocean/{loop → work}/dist/tasks/renumber-tasks.js +4 -2
  265. package/node_modules/@ocean/{loop → work}/dist/tasks/session-task.js +2 -2
  266. package/node_modules/@ocean/{loop → work}/dist/tasks/sync-task-prs.js +77 -7
  267. package/node_modules/@ocean/work/dist/tasks/task-git.js +63 -0
  268. package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop.js +4 -4
  269. package/node_modules/@ocean/{loop → work}/dist/tasks/verification-readiness.js +1 -1
  270. package/node_modules/@ocean/{loop → work}/dist/tasks/verify-task.js +1 -1
  271. package/node_modules/@ocean/{loop → work}/package.json +2 -2
  272. package/ocean-marketplace.json +41 -41
  273. package/package.json +12 -11
  274. package/skills/core/daily-harvest/SKILL.md +1 -1
  275. package/skills/core/ocean-memory/SKILL.md +4 -0
  276. package/skills/core/use-browser/SKILL.md +30 -7
  277. package/skills/index.json +1 -1
  278. package/templates/profiles/default.md +44 -0
  279. package/templates/profiles/developer.md +45 -0
  280. package/templates/profiles/reviewer.md +44 -0
  281. package/templates/profiles/strategist.md +44 -0
  282. package/templates/profiles-v3/analysis.md +16 -0
  283. package/templates/profiles-v3/backend.md +16 -0
  284. package/templates/profiles-v3/base.md +57 -0
  285. package/templates/profiles-v3/code-review.md +16 -0
  286. package/templates/profiles-v3/devops.md +16 -0
  287. package/templates/profiles-v3/docs-office.md +16 -0
  288. package/templates/profiles-v3/frontend.md +16 -0
  289. package/templates/profiles-v3/learning.md +16 -0
  290. package/templates/profiles-v3/marketing-ads.md +16 -0
  291. package/templates/profiles-v3/marketing-content-seo.md +16 -0
  292. package/templates/profiles-v3/ocean-ops.md +16 -0
  293. package/templates/profiles-v3/product-strategy.md +16 -0
  294. package/templates/profiles-v3/qa-testing.md +16 -0
  295. package/templates/profiles-v3/security.md +16 -0
  296. package/templates/workspace/MANIFEST.json +1 -0
  297. package/templates/workspace/charter/core.md +22 -90
  298. package/templates/workspace/charter/policies/README.md +7 -1
  299. package/templates/workspace/charter/policies/claude-code-context.md +6 -1
  300. package/templates/workspace/charter/policies/concise-output.md +5 -0
  301. package/templates/workspace/charter/policies/context.md +5 -0
  302. package/templates/workspace/charter/policies/contracts/task.md +2 -2
  303. package/templates/workspace/charter/policies/git.md +5 -0
  304. package/templates/workspace/charter/policies/graph.md +6 -1
  305. package/templates/workspace/charter/policies/knowledge.md +11 -4
  306. package/templates/workspace/charter/policies/layout.md +23 -0
  307. package/templates/workspace/charter/policies/lifecycle.md +5 -0
  308. package/templates/workspace/charter/policies/memory.md +5 -0
  309. package/templates/workspace/charter/policies/minimal-change.md +5 -0
  310. package/templates/workspace/charter/policies/models.md +5 -0
  311. package/templates/workspace/charter/policies/response.md +5 -0
  312. package/templates/workspace/charter/policies/skill-observer.md +12 -0
  313. package/templates/workspace/charter/policies/stack.md +5 -0
  314. package/templates/workspace/charter/policies/task.md +17 -3
  315. package/templates/workspace/charter/policies/verification.md +5 -0
  316. package/node_modules/@ocean/brain/dist/evidence/verification-report.js +0 -13
  317. package/node_modules/@ocean/brain/dist/memory/daily-narrative.js +0 -142
  318. package/node_modules/@ocean/brain/dist/memory/session-facts.js +0 -283
  319. package/node_modules/@ocean/context/dist/context/context-compression.js +0 -66
  320. package/node_modules/@ocean/loop/dist/hooks/desktop-facts.js +0 -174
  321. package/node_modules/@ocean/loop/dist/operations/task-linker.js +0 -40
  322. package/node_modules/@ocean/loop/dist/sessions/session-pointer.js +0 -133
  323. package/node_modules/@ocean/loop/dist/tasks/task-git.js +0 -28
  324. package/node_modules/@ocean/market/dist/mcp/mcp-gateway.js +0 -533
  325. package/templates/profiles/default.json +0 -51
  326. package/templates/profiles/developer.json +0 -51
  327. package/templates/profiles/reviewer.json +0 -51
  328. package/templates/profiles/strategist.json +0 -51
  329. /package/node_modules/@ocean/brain/dist/{brain/brain-eval.js → brain-eval.js} +0 -0
  330. /package/node_modules/@ocean/brain/dist/{brain/brain-reindex.js → brain-reindex.js} +0 -0
  331. /package/node_modules/@ocean/brain/dist/{capture → sessions-capture}/inbox-sync.js +0 -0
  332. /package/node_modules/@ocean/{market → connect}/dist/adapters/mcp-adapter.js +0 -0
  333. /package/node_modules/@ocean/{market → connect}/dist/adapters/owned-directory.js +0 -0
  334. /package/node_modules/@ocean/{market → connect}/dist/adapters/plugin-adapter.js +0 -0
  335. /package/node_modules/@ocean/{market → connect}/dist/adapters/skill-adapter.js +0 -0
  336. /package/node_modules/@ocean/{market → connect}/dist/capability/adapter.js +0 -0
  337. /package/node_modules/@ocean/{market → connect}/dist/capability/catalog.js +0 -0
  338. /package/node_modules/@ocean/{market → connect}/dist/capability/content-digest.js +0 -0
  339. /package/node_modules/@ocean/{market → connect}/dist/capability/registry.js +0 -0
  340. /package/node_modules/@ocean/{market → connect}/dist/install/lock.js +0 -0
  341. /package/node_modules/@ocean/{market → connect}/dist/install/own-server.js +0 -0
  342. /package/node_modules/@ocean/{market → connect}/dist/mcp/chrome-debugging.js +0 -0
  343. /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-connection.js +0 -0
  344. /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-runner.js +0 -0
  345. /package/node_modules/@ocean/{market → connect}/dist/security/description-scan.js +0 -0
  346. /package/node_modules/@ocean/{market → connect}/dist/security/secrets.js +0 -0
  347. /package/node_modules/@ocean/{market → connect}/dist/skills/core-skill-sync.js +0 -0
  348. /package/node_modules/@ocean/context/dist/{context/context-packet.js → context-packet.js} +0 -0
  349. /package/node_modules/@ocean/core/dist/domain/{process/process-events.js → process-events.js} +0 -0
  350. /package/node_modules/@ocean/core/dist/domain/{redaction/redaction.js → redaction.js} +0 -0
  351. /package/node_modules/@ocean/services/dist/{brief → day}/brief.js +0 -0
  352. /package/node_modules/@ocean/services/dist/{express → day}/express.js +0 -0
  353. /package/node_modules/@ocean/services/dist/{brief → day}/source-registry.json +0 -0
  354. /package/node_modules/@ocean/services/dist/{journey → health}/telemetry.js +0 -0
  355. /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-service.js +0 -0
  356. /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-task-runner.js +0 -0
  357. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-session.js +0 -0
  358. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/server-version.js +0 -0
  359. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/tool-registry.js +0 -0
  360. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/inbox-promotion.js +0 -0
  361. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-discovery.js +0 -0
  362. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-ingestion.js +0 -0
  363. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-sync.js +0 -0
  364. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-writer.js +0 -0
  365. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-scope.js +0 -0
  366. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-io.js +0 -0
  367. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-operations.js +0 -0
  368. /package/node_modules/@ocean/{loop → work}/dist/runs/run-authorization.js +0 -0
  369. /package/node_modules/@ocean/{loop → work}/dist/runs/session-tokens.js +0 -0
  370. /package/node_modules/@ocean/{loop/dist/handoff → work/dist/sessions}/handoff-service.js +0 -0
  371. /package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/lifecycle-hooks.js +0 -0
  372. /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-store.js +0 -0
  373. /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-validator.js +0 -0
  374. /package/node_modules/@ocean/{loop → work}/dist/tasks/archive-tasks.js +0 -0
  375. /package/node_modules/@ocean/{loop → work}/dist/tasks/checkpoint-task.js +0 -0
  376. /package/node_modules/@ocean/{loop → work}/dist/tasks/claim-task.js +0 -0
  377. /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/iteration-graph.js +0 -0
  378. /package/node_modules/@ocean/{loop → work}/dist/tasks/new-task.js +0 -0
  379. /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop-record.js +0 -0
  380. /package/node_modules/@ocean/{loop → work}/dist/tasks/task-verification.js +0 -0
@@ -28,7 +28,7 @@ function messageText(message) {
28
28
  }
29
29
  return typeof message.text === "string" ? message.text.trim() : "";
30
30
  }
31
- export function exportConversation(raw) {
31
+ function exportConversation(raw) {
32
32
  if (!isObject(raw) || typeof raw.uuid !== "string")
33
33
  return null;
34
34
  if (!Array.isArray(raw.chat_messages))
@@ -8,7 +8,7 @@ import { readIndexedDb } from "./indexeddb.js";
8
8
  // and may change with any app update, so any surprise ends in DesktopChatUnreadable, and a
9
9
  // record that does not decode is skipped. Read-only: the LevelDB folder is copied aside and the
10
10
  // copy is read; the app's LOCK is never taken and nothing in its folders is written.
11
- export const DESKTOP_CHAT_UNREADABLE = "DESKTOP_CHAT_UNREADABLE";
11
+ const DESKTOP_CHAT_UNREADABLE = "DESKTOP_CHAT_UNREADABLE";
12
12
  export class DesktopChatUnreadable extends Error {
13
13
  code = DESKTOP_CHAT_UNREADABLE;
14
14
  }
@@ -17,7 +17,7 @@ const TREES_STORE = "trees";
17
17
  const ROOT_PARENT = "00000000-0000-4000-8000-000000000000";
18
18
  const LEVELDB_FILE = /^(CURRENT|MANIFEST-\d+|\d+\.(log|ldb|sst))$/;
19
19
  // Where Claude Desktop keeps its IndexedDB: the app's user-data folder on each platform.
20
- export function desktopIndexedDbDir(home = os.homedir(), platform = process.platform) {
20
+ function desktopIndexedDbDir(home = os.homedir(), platform = process.platform) {
21
21
  if (platform === "win32")
22
22
  return path.join(process.env.APPDATA ?? path.join(home, "AppData", "Roaming"), "Claude", "IndexedDB");
23
23
  if (platform === "darwin")
@@ -34,18 +34,65 @@ function isoDate(value) {
34
34
  return value.toISOString();
35
35
  return null;
36
36
  }
37
- // The text of a message: its `text` blocks only. Thinking, tool calls, tool results and
38
- // attachments are left out.
39
- function messageText(content) {
37
+ // What a tool step keeps: its call's input and its result are cut to these lengths, so a long
38
+ // file read or search result does not crowd out the conversation (T-329).
39
+ const TOOL_INPUT_CHARS = 200;
40
+ export const TOOL_RESULT_CHARS = 600;
41
+ function clip(text, max) {
42
+ const flat = text.replace(/\s+/g, " ").trim();
43
+ return flat.length > max ? `${flat.slice(0, max)}…` : flat;
44
+ }
45
+ // "mcp__remote-devices__ocean__brain_search" → "brain_search".
46
+ const toolName = (name) => typeof name === "string" && name ? (name.split("__").at(-1) ?? name) : "tool";
47
+ function toolInput(input) {
48
+ if (typeof input === "string")
49
+ return clip(input, TOOL_INPUT_CHARS);
50
+ if (!isObject(input) || Object.keys(input).length === 0)
51
+ return "";
52
+ // The app keeps a one-line summary of the call's input where it has one.
53
+ if (typeof input.summary === "string" && Object.keys(input).length === 1)
54
+ return clip(input.summary, TOOL_INPUT_CHARS);
55
+ return clip(JSON.stringify(input), TOOL_INPUT_CHARS);
56
+ }
57
+ function toolResult(content) {
58
+ if (typeof content === "string")
59
+ return clip(content, TOOL_RESULT_CHARS);
60
+ if (!Array.isArray(content))
61
+ return "";
62
+ return clip(content
63
+ .filter((part) => isObject(part) &&
64
+ part.type === "text" &&
65
+ typeof part.text === "string")
66
+ .map((part) => part.text)
67
+ .join(" "), TOOL_RESULT_CHARS);
68
+ }
69
+ // The text of a message: its `text` blocks, and each tool call and result as one bracketed line
70
+ // (T-329: a capture without them missed what the assistant actually did and found). Thinking
71
+ // and attachments are left out.
72
+ export function messageText(content) {
40
73
  if (!Array.isArray(content))
41
74
  return "";
42
- return content
43
- .filter((block) => isObject(block) &&
44
- block.type === "text" &&
45
- typeof block.text === "string")
46
- .map((block) => block.text.trim())
47
- .filter(Boolean)
48
- .join("\n\n");
75
+ const parts = [];
76
+ for (const block of content) {
77
+ if (!isObject(block))
78
+ continue;
79
+ if (block.type === "text" && typeof block.text === "string") {
80
+ const text = block.text.trim();
81
+ if (text)
82
+ parts.push(text);
83
+ }
84
+ else if (block.type === "tool_use") {
85
+ const input = toolInput(block.input);
86
+ parts.push(`[tool ${toolName(block.name)}${input ? `: ${input}` : ""}]`);
87
+ }
88
+ else if (block.type === "tool_result") {
89
+ const result = toolResult(block.content);
90
+ const label = block.is_error === true ? "tool error" : "tool result";
91
+ if (result)
92
+ parts.push(`[${label}: ${result}]`);
93
+ }
94
+ }
95
+ return parts.join("\n\n");
49
96
  }
50
97
  function rawMessage(value) {
51
98
  if (!isObject(value))
@@ -68,7 +115,7 @@ function rawMessage(value) {
68
115
  }
69
116
  // An edited or retried message leaves sibling branches in the tree. The conversation is the
70
117
  // branch that ends at the newest leaf: highest index, then latest creation.
71
- export function currentBranch(all) {
118
+ function currentBranch(all) {
72
119
  const byUuid = new Map(all.map((message) => [message.uuid, message]));
73
120
  const parents = new Set(all.map((message) => message.parent));
74
121
  const leaves = all.filter((message) => !parents.has(message.uuid));
@@ -9,7 +9,7 @@ import { unsnappy, varint } from "./snappy.js";
9
9
  // Blink-serialized value or a wrapper: 0xFF 0x11 0x02 + raw Snappy of one, or 0xFF 0x11 0x01 +
10
10
  // size + blob index, meaning the bytes are in that blob file. A Blink value is 0xFF + version
11
11
  // (+ 0xFE and a 12-byte trailer from version 21), then V8's own serialization.
12
- export class IndexedDbFormatError extends Error {
12
+ class IndexedDbFormatError extends Error {
13
13
  }
14
14
  const OBJECT_STORE_DATA = 1;
15
15
  const BLOB_ENTRY = 3;
@@ -17,7 +17,7 @@ const OBJECT_STORE_META = 50;
17
17
  const WRAPPED = 0x11;
18
18
  const WRAPPED_IN_BLOB = 0x01;
19
19
  const WRAPPED_SNAPPY = 0x02;
20
- export function keyPrefix(key) {
20
+ function keyPrefix(key) {
21
21
  if (key.length < 4)
22
22
  return null;
23
23
  const first = key[0];
@@ -69,7 +69,7 @@ function blinkValue(bytes) {
69
69
  }
70
70
  // A record's blob list: per blob, is-file flag, blob number, MIME type, then size (a plain blob)
71
71
  // or name and modification time (a File). Only plain blobs are read.
72
- export function blobNumbers(value) {
72
+ function blobNumbers(value) {
73
73
  const numbers = [];
74
74
  let pos = 0;
75
75
  while (pos < value.length) {
@@ -86,7 +86,7 @@ export function blobNumbers(value) {
86
86
  }
87
87
  return numbers;
88
88
  }
89
- export function blobPath(blobDir, database, number) {
89
+ function blobPath(blobDir, database, number) {
90
90
  return path.join(blobDir, database.toString(16), (Math.floor(number / 256) % 256).toString(16).padStart(2, "0"), number.toString(16));
91
91
  }
92
92
  async function wireValue(bytes, blob, depth = 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) {