@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
@@ -0,0 +1,22 @@
1
+ import { intercept } from "../intercept-command.js";
2
+ export async function commandIntercept() {
3
+ const clientIndex = process.argv.indexOf("--client");
4
+ const executableIndex = process.argv.indexOf("--executable");
5
+ const separatorIndex = process.argv.indexOf("--");
6
+ const client = clientIndex >= 0 ? process.argv[clientIndex + 1] : "";
7
+ const args = separatorIndex >= 0 ? process.argv.slice(separatorIndex + 1) : [];
8
+ if (!client) {
9
+ console.error("Usage: ocean intercept --client <provider> -- [args]");
10
+ process.exitCode = 1;
11
+ }
12
+ else {
13
+ process.exitCode = await intercept(client, args, executableIndex >= 0
14
+ ? {
15
+ originalExecutable: process.argv[executableIndex + 1],
16
+ entryPoint: "desktop-wrapper",
17
+ controlLevel: "managed-partial",
18
+ }
19
+ : undefined);
20
+ }
21
+ }
22
+ //# sourceMappingURL=intercept.js.map
@@ -0,0 +1,11 @@
1
+ import { runLayoutCommand } from "../layout-command.js";
2
+ export async function commandLayout() {
3
+ try {
4
+ await runLayoutCommand(process.argv.slice(3));
5
+ }
6
+ catch (error) {
7
+ console.error(error instanceof Error ? error.message : String(error));
8
+ process.exitCode = 1;
9
+ }
10
+ }
11
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1,5 @@
1
+ import { runLifecycleCommand } from "../governance-command.js";
2
+ export async function commandLifecycle() {
3
+ await runLifecycleCommand(process.argv.slice(3));
4
+ }
5
+ //# sourceMappingURL=lifecycle.js.map
@@ -0,0 +1,73 @@
1
+ import { GUARD_FLAGS, parseGuardFlags, } from "@ocean/core/domain/runs/loop-guard.js";
2
+ import { oceanEnv, oceanRoot } from "@ocean/core/shared/paths.js";
3
+ import { listTaskLoops, runTaskLoopsOnce, runTaskLoopWorker, startTaskLoop, stopTaskLoop, } from "@ocean/work/tasks/task-loop.js";
4
+ import { defaultAgentRuntime } from "../../../composition/runtime.js";
5
+ export async function commandLoop() {
6
+ const action = process.argv[3] ?? "status";
7
+ if (action === "status")
8
+ console.log(JSON.stringify(await listTaskLoops(), null, 2));
9
+ else if (action === "start") {
10
+ // The prompt is everything after --prompt, so the guard flags come before it.
11
+ const promptIndex = process.argv.indexOf("--prompt");
12
+ const head = promptIndex >= 0 ? process.argv.slice(0, promptIndex) : process.argv;
13
+ const { guard, rest } = parseGuardFlags(head.slice(4));
14
+ const [taskId, profile = "developer"] = rest.filter((arg, index, all) => !arg.startsWith("--") &&
15
+ !["--interval-ms", "--max-attempts"].includes(all[index - 1] ?? ""));
16
+ const prompt = promptIndex >= 0 ? process.argv.slice(promptIndex + 1).join(" ") : "";
17
+ if (!taskId || !prompt || !head.includes("--approve")) {
18
+ console.error(`Usage: ocean loop start <task-id> <profile> --approve ${GUARD_FLAGS} [--interval-ms N] [--max-attempts N] --prompt <text>`);
19
+ process.exitCode = 1;
20
+ }
21
+ else {
22
+ const value = (flag, fallback) => {
23
+ const index = head.indexOf(flag);
24
+ return index >= 0 ? Number(head[index + 1]) : fallback;
25
+ };
26
+ try {
27
+ console.log(JSON.stringify(await startTaskLoop({
28
+ taskId,
29
+ profile,
30
+ prompt,
31
+ cwd: oceanRoot(),
32
+ approved: true,
33
+ guard,
34
+ intervalMs: value("--interval-ms", 60_000),
35
+ maxAttempts: value("--max-attempts", 2),
36
+ }), null, 2));
37
+ }
38
+ catch (error) {
39
+ console.error(error instanceof Error ? error.message : String(error));
40
+ process.exitCode = 1;
41
+ }
42
+ }
43
+ }
44
+ else if (action === "worker-once") {
45
+ console.log(JSON.stringify({ ran: await runTaskLoopsOnce(oceanRoot(), defaultAgentRuntime) }, null, 2));
46
+ }
47
+ else if (action === "worker") {
48
+ const controller = new AbortController();
49
+ const stop = () => controller.abort();
50
+ process.once("SIGINT", stop);
51
+ process.once("SIGTERM", stop);
52
+ await runTaskLoopWorker(oceanRoot(), defaultAgentRuntime, {
53
+ signal: controller.signal,
54
+ pollMs: Number(oceanEnv("LOOP_POLL_MS") ?? 30_000),
55
+ });
56
+ process.off("SIGINT", stop);
57
+ process.off("SIGTERM", stop);
58
+ }
59
+ else if (action === "stop") {
60
+ const id = process.argv[4];
61
+ if (!id) {
62
+ console.error("Usage: ocean loop stop <loop-id>");
63
+ process.exitCode = 1;
64
+ }
65
+ else
66
+ console.log(JSON.stringify(await stopTaskLoop(id), null, 2));
67
+ }
68
+ else {
69
+ console.error("Usage: ocean loop start|status|stop|worker-once|worker");
70
+ process.exitCode = 1;
71
+ }
72
+ }
73
+ //# sourceMappingURL=loop.js.map
@@ -0,0 +1,11 @@
1
+ import { runMarketCommand } from "../market-command.js";
2
+ export async function commandMarket() {
3
+ try {
4
+ await runMarketCommand(process.argv[3] ?? "", process.argv.slice(4));
5
+ }
6
+ catch (error) {
7
+ console.error(error instanceof Error ? error.message : String(error));
8
+ process.exitCode = 1;
9
+ }
10
+ }
11
+ //# sourceMappingURL=market.js.map
@@ -0,0 +1,57 @@
1
+ import { mcpClientConfig, oceanMcpConfig, playwrightMcpConfig, } from "@ocean/connect/mcp/mcp-connection.js";
2
+ import { GATEWAY_CAPABILITY } from "@ocean/connect/mcp/mcp-gateway.js";
3
+ import { createMcpSessionRecorder } from "@ocean/services/integrations/mcp/mcp-session.js";
4
+ import { runOceanMcpServer } from "@ocean/services/integrations/mcp/ocean-server.js";
5
+ import { MCP_ONLY_CLIENTS, mcpClientOf, } from "../../../application/clients/registry.js";
6
+ import { defaultBrainIndexPort, defaultSessionStoreFactory, defaultWrapperManager, } from "../../../composition/runtime.js";
7
+ import { createOllamaEmbedder } from "../../../infrastructure/providers/ollama-embedder.js";
8
+ import { runBrowserServiceCommand } from "../browser-service-command.js";
9
+ import { runMcpGatewayCommand } from "../mcp-gateway-command.js";
10
+ import { runMcpProbeCommand } from "../mcp-probe-command.js";
11
+ import { runMcpStatusCommand } from "../mcp-status-command.js";
12
+ // brain_search over MCP uses vectors when the local embedder answers (T-307), and full text when
13
+ // it does not; a working embedder is kept, a failure is retried on the next search.
14
+ function mcpEmbedder() {
15
+ let ready = null;
16
+ return async () => {
17
+ if (!ready)
18
+ ready = await createOllamaEmbedder().catch(() => null);
19
+ return ready;
20
+ };
21
+ }
22
+ export async function commandMcp() {
23
+ const action = process.argv[3] ?? "config";
24
+ if (action === "config")
25
+ console.log(JSON.stringify(oceanMcpConfig(), null, 2));
26
+ else if (action === "playwright-config")
27
+ console.log(JSON.stringify(playwrightMcpConfig(), null, 2));
28
+ else if (action === "gateway-config")
29
+ console.log(JSON.stringify(mcpClientConfig(GATEWAY_CAPABILITY), null, 2));
30
+ else if (action === "serve")
31
+ await runOceanMcpServer({
32
+ brainIndex: defaultBrainIndexPort,
33
+ sessionStoreFactory: defaultSessionStoreFactory,
34
+ wrapperManager: defaultWrapperManager,
35
+ embedder: mcpEmbedder(),
36
+ mcpSessions: createMcpSessionRecorder({
37
+ openStore: defaultSessionStoreFactory,
38
+ providerOf: (name) => {
39
+ const id = mcpClientOf(name)?.id;
40
+ return id && MCP_ONLY_CLIENTS.has(id) ? id : null;
41
+ },
42
+ }),
43
+ });
44
+ else if (action === "gateway")
45
+ await runMcpGatewayCommand(process.argv.slice(4));
46
+ else if (action === "status")
47
+ await runMcpStatusCommand(process.argv.slice(4));
48
+ else if (action === "probe-client")
49
+ await runMcpProbeCommand(process.argv.slice(4));
50
+ else if (action === "browser-service")
51
+ await runBrowserServiceCommand(process.argv[4] ?? "");
52
+ else {
53
+ console.error("Usage: ocean mcp config|playwright-config|gateway-config|serve|gateway|status [--check] [--json]|probe-client [report] [--log <file>]|browser-service uninstall");
54
+ process.exitCode = 1;
55
+ }
56
+ }
57
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1,5 @@
1
+ import { runMemoryCommand } from "../memory-command.js";
2
+ export async function commandMemory() {
3
+ await runMemoryCommand(process.argv[3] ?? "", process.argv.slice(4));
4
+ }
5
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1,5 @@
1
+ import { runMigrateCommand } from "../migrate-command.js";
2
+ export async function commandMigrate() {
3
+ await runMigrateCommand(process.argv.includes("--apply"));
4
+ }
5
+ //# sourceMappingURL=migrate.js.map
@@ -0,0 +1,11 @@
1
+ import { runObserveCommand } from "../observe-command.js";
2
+ export async function commandObserve() {
3
+ try {
4
+ await runObserveCommand(process.argv.slice(3));
5
+ }
6
+ catch (error) {
7
+ console.error(error instanceof Error ? error.message : String(error));
8
+ process.exitCode = 1;
9
+ }
10
+ }
11
+ //# sourceMappingURL=observe.js.map
@@ -0,0 +1,111 @@
1
+ import { runObsidianMcpServer } from "@ocean/services/integrations/mcp/obsidian-server.js";
2
+ import { parseConflictSide, resolveConflict, } from "@ocean/services/integrations/obsidian/conflict-log.js";
3
+ import { syncFolderTemplates, syncQuickAddChoices, } from "@ocean/services/integrations/obsidian/folder-templates.js";
4
+ import { listInboxCandidates, promoteInboxNote, } from "@ocean/services/integrations/obsidian/inbox-promotion.js";
5
+ import { connectObsidianVault, discoverObsidianVault, loadObsidianConnection, } from "@ocean/services/integrations/obsidian/vault-discovery.js";
6
+ import { syncObsidianVault, watchObsidianVault, } from "@ocean/services/integrations/obsidian/vault-sync.js";
7
+ import { writeObsidianNote } from "@ocean/services/integrations/obsidian/vault-writer.js";
8
+ export async function commandObsidian() {
9
+ const action = process.argv[3] ?? "discover";
10
+ if (action === "mcp")
11
+ await runObsidianMcpServer();
12
+ else if (![
13
+ "connect",
14
+ "discover",
15
+ "sync",
16
+ "templates",
17
+ "watch",
18
+ "inbox",
19
+ "write",
20
+ "conflicts",
21
+ ].includes(action)) {
22
+ console.error("Usage: ocean obsidian connect <vault-path> [--read-write]|discover|sync|templates [--yes]|watch|inbox|write|conflicts resolve <id> --keep=vault|ocean");
23
+ process.exitCode = 1;
24
+ }
25
+ else {
26
+ try {
27
+ if (action === "templates") {
28
+ // T-314: Templater folder templates and QuickAdd choices generated from routing.json; a dry run
29
+ // until --yes.
30
+ const apply = process.argv.includes("--yes");
31
+ const result = await syncFolderTemplates({ apply });
32
+ const quickadd = await syncQuickAddChoices({ apply });
33
+ console.log(JSON.stringify({ ...result, quickadd }, null, 2));
34
+ if (!result.written)
35
+ console.error("Dry run: pass --yes to write the Templater and QuickAdd config.");
36
+ return;
37
+ }
38
+ if (action === "connect") {
39
+ const vaultPath = process.argv[4];
40
+ if (!vaultPath)
41
+ throw new Error("Usage: ocean obsidian connect <vault-path> [--read-write]");
42
+ const readWrite = process.argv.includes("--read-write");
43
+ const mode = readWrite
44
+ ? "read-write"
45
+ : "read-only";
46
+ const result = await connectObsidianVault(vaultPath, mode);
47
+ const synced = await syncObsidianVault(await loadObsidianConnection());
48
+ console.log(JSON.stringify({
49
+ connected: true,
50
+ mode,
51
+ vaultPath: result.vaultPath,
52
+ noteCount: synced.noteCount,
53
+ added: synced.added,
54
+ changed: synced.changed,
55
+ removed: synced.removed,
56
+ issues: synced.issues,
57
+ }, null, 2));
58
+ }
59
+ else {
60
+ const connection = await loadObsidianConnection();
61
+ if (action === "conflicts") {
62
+ if (process.argv[4] !== "resolve")
63
+ throw new Error("Usage: ocean obsidian conflicts resolve <id> --keep=vault|ocean");
64
+ const id = process.argv[5];
65
+ const keepArg = process.argv.find((arg) => arg.startsWith("--keep="));
66
+ const keep = keepArg?.slice("--keep=".length);
67
+ if (!id || !keep || !parseConflictSide(keep))
68
+ throw new Error("Usage: ocean obsidian conflicts resolve <id> --keep=vault|ocean");
69
+ console.log(JSON.stringify(await resolveConflict(id, keep), null, 2));
70
+ }
71
+ else if (action === "write") {
72
+ const relative = process.argv[4];
73
+ const content = process.argv[5];
74
+ const expectedSha256 = process.argv[6] ?? null;
75
+ if (!relative || content === undefined)
76
+ throw new Error("Usage: ocean obsidian write <relative.md> <content> [expected-sha256] [--apply]");
77
+ console.log(JSON.stringify(await writeObsidianNote(connection, relative, content, expectedSha256 === "-" ? null : expectedSha256, process.argv.includes("--apply")), null, 2));
78
+ }
79
+ else if (action === "inbox") {
80
+ const inboxAction = process.argv[4] ?? "list";
81
+ if (inboxAction === "list")
82
+ console.log(JSON.stringify(await listInboxCandidates(connection), null, 2));
83
+ else if (inboxAction === "promote") {
84
+ const source = process.argv[5];
85
+ const target = process.argv[6];
86
+ if (!source || !target)
87
+ throw new Error("Usage: ocean obsidian inbox promote <source.md> <target-directory> [--apply]");
88
+ console.log(JSON.stringify(await promoteInboxNote(connection, source, target, process.argv.includes("--apply")), null, 2));
89
+ }
90
+ else
91
+ throw new Error("Usage: ocean obsidian inbox list|promote <source.md> <target-directory> [--apply]");
92
+ }
93
+ else if (action === "discover")
94
+ console.log(JSON.stringify(await discoverObsidianVault(connection), null, 2));
95
+ else if (action === "sync")
96
+ console.log(JSON.stringify(await syncObsidianVault(connection), null, 2));
97
+ else {
98
+ const controller = new AbortController();
99
+ process.once("SIGINT", () => controller.abort());
100
+ process.once("SIGTERM", () => controller.abort());
101
+ await watchObsidianVault(connection, undefined, controller.signal);
102
+ }
103
+ }
104
+ }
105
+ catch (error) {
106
+ console.error(error instanceof Error ? error.message : String(error));
107
+ process.exitCode = 1;
108
+ }
109
+ }
110
+ }
111
+ //# sourceMappingURL=obsidian.js.map
@@ -0,0 +1,7 @@
1
+ import { runOperateCommand } from "../operate-command.js";
2
+ export async function commandOperate() {
3
+ const args = process.argv.slice(3);
4
+ const text = (args[0] === "--" ? args.slice(1) : args).join(" ");
5
+ await runOperateCommand(text);
6
+ }
7
+ //# sourceMappingURL=operate.js.map
@@ -0,0 +1,16 @@
1
+ import { runPolicyCommand } from "../governance-command.js";
2
+ import { withArgs } from "./dispatch.js";
3
+ import { commandLifecycle } from "./lifecycle.js";
4
+ export async function commandPolicy() {
5
+ // `policy checkpoint` decides whether work should checkpoint now (was `lifecycle`).
6
+ if (process.argv[3] === "checkpoint")
7
+ return withArgs(process.argv.slice(4), commandLifecycle);
8
+ try {
9
+ await runPolicyCommand(process.argv[3] ?? "list");
10
+ }
11
+ catch (error) {
12
+ console.error(error instanceof Error ? error.message : String(error));
13
+ process.exitCode = 1;
14
+ }
15
+ }
16
+ //# sourceMappingURL=policy.js.map
@@ -0,0 +1,207 @@
1
+ import { fillProjectProfiles } from "@ocean/core/profiles/project-profile-fill.js";
2
+ import { migrateProjectBindings } from "@ocean/core/shared/project-legacy.js";
3
+ import { PROJECT_CATEGORIES, projectCategory, scanProjectManifests, } from "@ocean/core/shared/project-manifest.js";
4
+ import { autoRegisterProject, bindProject, createProject, findProject, linkNewProject, linkProjectAlias, moveProject, renameProject, renderProjectIndex, unbindProjectPath, writeProjectIndex, } from "@ocean/core/shared/project-register.js";
5
+ import { findGitRoot, listProjectBindings, resolveProject, } from "@ocean/core/shared/project-resolution.js";
6
+ import { formatNameWarnings, projectDoctor, } from "@ocean/services/projects/project-doctor.js";
7
+ import { projectSnippet } from "@ocean/services/projects/project-snippet.js";
8
+ import { overviewTable, projectsOverview, writeRegistryBlock, } from "@ocean/services/projects/projects-overview.js";
9
+ export async function commandProject() {
10
+ const action = process.argv[3] ?? "resolve";
11
+ if (action === "resolve") {
12
+ console.log(JSON.stringify(await resolveProject(process.argv[4] ?? process.cwd()), null, 2));
13
+ }
14
+ else if (action === "bind") {
15
+ const args = process.argv.slice(4);
16
+ const addPath = args.includes("--add");
17
+ const [name, targetPath] = args.filter((arg) => arg !== "--add");
18
+ if (!name || !targetPath) {
19
+ console.error("Usage: ocean project bind <name> <path> [--add]");
20
+ process.exitCode = 1;
21
+ }
22
+ else {
23
+ const result = await bindProject(name, targetPath, { addPath });
24
+ if (result.created && !result.conflict)
25
+ await fillProjectProfiles(result.binding.id, targetPath);
26
+ console.log(JSON.stringify(result, null, 2));
27
+ if (result.conflict)
28
+ process.exitCode = 2;
29
+ }
30
+ }
31
+ else if (action === "list") {
32
+ const flag = process.argv.indexOf("--category");
33
+ const wanted = flag >= 0 ? process.argv[flag + 1] : undefined;
34
+ if (flag >= 0 &&
35
+ !PROJECT_CATEGORIES.includes(wanted ?? "")) {
36
+ console.error(`Usage: ocean project list [--category ${PROJECT_CATEGORIES.join("|")}]`);
37
+ process.exitCode = 1;
38
+ return;
39
+ }
40
+ const { manifests, errors } = await scanProjectManifests();
41
+ for (const { file, error } of errors)
42
+ console.error(`skipped invalid ${file}: ${error}`);
43
+ const categories = new Map();
44
+ for (const manifest of manifests) {
45
+ try {
46
+ const category = projectCategory(manifest);
47
+ if (category)
48
+ categories.set(manifest.id, category);
49
+ }
50
+ catch (error) {
51
+ console.error(`${manifest.id}: ${error instanceof Error ? error.message : String(error)}`);
52
+ }
53
+ }
54
+ const bindings = (await listProjectBindings())
55
+ .map((binding) => ({
56
+ ...binding,
57
+ gitRoot: binding.gitRoot ?? findGitRoot(binding.path),
58
+ ...(categories.has(binding.id)
59
+ ? { category: categories.get(binding.id) }
60
+ : {}),
61
+ }))
62
+ .filter((binding) => !wanted || binding.category === wanted);
63
+ console.log(JSON.stringify(bindings, null, 2));
64
+ if (errors.length)
65
+ process.exitCode = 2;
66
+ }
67
+ else if (action === "register") {
68
+ const result = await autoRegisterProject(process.argv[4] ?? process.cwd(), {
69
+ explicit: true,
70
+ });
71
+ if (result.status === "registered" && result.resolution.status === "bound")
72
+ await fillProjectProfiles(result.projectId, result.resolution.path);
73
+ console.log(JSON.stringify(result, null, 2));
74
+ if (result.status !== "registered")
75
+ process.exitCode = 2;
76
+ }
77
+ else if (action === "unbind") {
78
+ const target = process.argv[4];
79
+ if (!target) {
80
+ console.error("Usage: ocean project unbind <path>");
81
+ process.exitCode = 1;
82
+ }
83
+ else {
84
+ const result = await unbindProjectPath(target);
85
+ console.log(JSON.stringify(result, null, 2));
86
+ if (!result.removed)
87
+ process.exitCode = 2;
88
+ }
89
+ }
90
+ else if (action === "rename") {
91
+ const [from, to] = process.argv.slice(4);
92
+ if (!from || !to) {
93
+ console.error("Usage: ocean project rename <id> <new-id>");
94
+ process.exitCode = 1;
95
+ }
96
+ else {
97
+ try {
98
+ console.log(JSON.stringify(await renameProject(from, to), null, 2));
99
+ }
100
+ catch (error) {
101
+ console.error(error instanceof Error ? error.message : String(error));
102
+ process.exitCode = 2;
103
+ }
104
+ }
105
+ }
106
+ else if (action === "move") {
107
+ const args = process.argv.slice(4);
108
+ const [id, category] = args.filter((arg) => arg !== "--write");
109
+ if (!id || !category) {
110
+ console.error(`Usage: ocean project move <id> <${PROJECT_CATEGORIES.join("|")}> [--write]`);
111
+ process.exitCode = 1;
112
+ }
113
+ else {
114
+ try {
115
+ console.log(JSON.stringify(await moveProject(id, category, args.includes("--write")), null, 2));
116
+ }
117
+ catch (error) {
118
+ console.error(error instanceof Error ? error.message : String(error));
119
+ process.exitCode = 2;
120
+ }
121
+ }
122
+ }
123
+ else if (action === "new") {
124
+ // A project with no code yet (one grown from a note); `bind` adds a path later.
125
+ const [id, category, ...name] = process.argv.slice(4);
126
+ if (!id || !category) {
127
+ console.error(`Usage: ocean project new <id> <${PROJECT_CATEGORIES.join("|")}> [display name]`);
128
+ process.exitCode = 1;
129
+ }
130
+ else {
131
+ try {
132
+ const result = await createProject(id, category, name.join(" ") || id);
133
+ console.log(JSON.stringify(result, null, 2));
134
+ }
135
+ catch (error) {
136
+ console.error(error instanceof Error ? error.message : String(error));
137
+ process.exitCode = 2;
138
+ }
139
+ }
140
+ }
141
+ else if (action === "link") {
142
+ // Another name for a project — a Claude project, an old folder name (T-332).
143
+ const args = process.argv.slice(4);
144
+ const flag = args.indexOf("--new");
145
+ const category = flag >= 0 ? args[flag + 1] : undefined;
146
+ const [name, id] = args.filter((_, index) => flag < 0 || (index !== flag && index !== flag + 1));
147
+ if (!name || (flag < 0 ? !id : !category || id)) {
148
+ console.error(`Usage: ocean project link "<name>" <id> | link "<name>" --new <${PROJECT_CATEGORIES.join("|")}>`);
149
+ process.exitCode = 1;
150
+ return;
151
+ }
152
+ try {
153
+ const result = flag >= 0
154
+ ? await linkNewProject(name, category ?? "")
155
+ : await linkProjectAlias(name, id);
156
+ console.log(JSON.stringify(result, null, 2));
157
+ if (result.conflict)
158
+ process.exitCode = 2;
159
+ }
160
+ catch (error) {
161
+ console.error(error instanceof Error ? error.message : String(error));
162
+ process.exitCode = 2;
163
+ }
164
+ }
165
+ else if (action === "snippet") {
166
+ // The lines a Claude Desktop project's instructions carry (T-333).
167
+ const id = await findProject(process.argv[4] ?? "");
168
+ if (!id) {
169
+ console.error("Usage: ocean project snippet <id>");
170
+ process.exitCode = 1;
171
+ return;
172
+ }
173
+ console.log(projectSnippet(id));
174
+ }
175
+ else if (action === "doctor") {
176
+ // Every way the project names drifted apart, each with its fix (T-332). Advisory: exit 0.
177
+ const warnings = await projectDoctor();
178
+ console.log(process.argv.includes("--json")
179
+ ? JSON.stringify(warnings, null, 2)
180
+ : formatNameWarnings(warnings));
181
+ }
182
+ else if (action === "migrate") {
183
+ const result = await migrateProjectBindings(process.argv.includes("--write"));
184
+ console.log(JSON.stringify(result, null, 2));
185
+ }
186
+ else if (action === "status") {
187
+ // Every project's git state, open tasks, last session and next action, derived now (T-317).
188
+ const rows = await projectsOverview();
189
+ if (process.argv.includes("--write"))
190
+ console.log(`updated ${await writeRegistryBlock(rows)}`);
191
+ else if (process.argv.includes("--json"))
192
+ console.log(JSON.stringify(rows, null, 2));
193
+ else
194
+ console.log(overviewTable(rows));
195
+ }
196
+ else if (action === "index") {
197
+ if (process.argv.includes("--write"))
198
+ console.log(JSON.stringify(await writeProjectIndex(), null, 2));
199
+ else
200
+ console.log(await renderProjectIndex());
201
+ }
202
+ else {
203
+ console.error("Usage: ocean project resolve [path]|bind <name> <path> [--add]|register [path]|unbind <path>|rename <id> <new-id>|new <id> <category> [name]|move <id> <category> [--write]|list [--category <name>]|link <name> <id>|link <name> --new <category>|snippet <id>|doctor [--json]|status [--json] [--write]|migrate [--write]|index [--write]");
204
+ process.exitCode = 1;
205
+ }
206
+ }
207
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1,20 @@
1
+ import { hasFailures, repairWorkspace, workspaceReport, } from "@ocean/services/health/workspace-doctor.js";
2
+ import { defaultWrapperManager } from "../../../composition/runtime.js";
3
+ export async function commandRepair() {
4
+ const apply = process.argv.includes("--apply");
5
+ if (!apply) {
6
+ const report = await workspaceReport(defaultWrapperManager);
7
+ console.log(JSON.stringify({
8
+ dryRun: true,
9
+ fixable: report.findings.filter((finding) => finding.fixable),
10
+ findings: report.findings,
11
+ }, null, 2));
12
+ }
13
+ else {
14
+ const result = await repairWorkspace(defaultWrapperManager);
15
+ console.log(JSON.stringify({ applied: result.changes, findings: result.findings }, null, 2));
16
+ if (hasFailures(result.findings))
17
+ process.exitCode = 1;
18
+ }
19
+ }
20
+ //# sourceMappingURL=repair.js.map
@@ -0,0 +1,52 @@
1
+ import { resolveProfileName } from "@ocean/core/domain/profiles/runtime-config.js";
2
+ import { oceanRoot } from "@ocean/core/shared/paths.js";
3
+ import { runAgent } from "@ocean/work/runs/run-agent.js";
4
+ import { selectProfileForTask } from "../../../application/profiles/profile-suggestion.js";
5
+ import { defaultAgentRuntime } from "../../../composition/runtime.js";
6
+ import { loadRuntimeConfig } from "../../../infrastructure/filesystem/runtime-config-loader.js";
7
+ import { withArgs } from "./dispatch.js";
8
+ import { commandIntent } from "./intent.js";
9
+ import { commandOperate } from "./operate.js";
10
+ export async function commandRun() {
11
+ // `run --op <text>` runs the operation a plain-language request names; with `--dry` it only
12
+ // classifies it (were `operate` and `intent classify`).
13
+ if (process.argv[3] === "--op") {
14
+ const rest = process.argv.slice(4);
15
+ if (rest[0] === "--dry")
16
+ return withArgs(["classify", ...rest.slice(1)], commandIntent);
17
+ return withArgs(rest, commandOperate);
18
+ }
19
+ const profileIndex = process.argv.indexOf("--profile");
20
+ const promptIndex = process.argv.indexOf("--prompt");
21
+ const clientIndex = process.argv.indexOf("--client");
22
+ const taskIndex = process.argv.indexOf("--task");
23
+ const handoffIndex = process.argv.indexOf("--handoff");
24
+ // --profile, then runtime.json's defaultProfile, then the historical "default" while no
25
+ // runtime.json exists. A named profile that does not exist fails; nothing falls back.
26
+ const explicitProfile = profileIndex >= 0 ? process.argv[profileIndex + 1] : undefined;
27
+ if (profileIndex >= 0 &&
28
+ (!explicitProfile || explicitProfile.startsWith("--"))) {
29
+ console.error("Usage: ocean run --profile <name> ... --prompt <text>");
30
+ process.exitCode = 1;
31
+ return;
32
+ }
33
+ // runtime.json is read only when it is needed, so a broken one cannot block an explicit run.
34
+ const runtimeConfig = explicitProfile ? null : await loadRuntimeConfig();
35
+ const client = clientIndex >= 0 ? process.argv[clientIndex + 1] : undefined;
36
+ const taskId = taskIndex >= 0 ? process.argv[taskIndex + 1] : undefined;
37
+ // T-296: with `autoProfile` on, a run for a task without --profile takes the suggested one.
38
+ const profileName = runtimeConfig?.autoProfile && taskId
39
+ ? (await selectProfileForTask(taskId, { cwd: process.cwd() })).profile
40
+ : resolveProfileName(explicitProfile, runtimeConfig);
41
+ const handoffId = handoffIndex >= 0 ? process.argv[handoffIndex + 1] : undefined;
42
+ const prompt = promptIndex >= 0 ? process.argv.slice(promptIndex + 1).join(" ") : "";
43
+ if (!profileName || !prompt) {
44
+ console.error("Usage: ocean run --profile <name> [--client <client>] [--task <id>] [--handoff <id>] --prompt <text>");
45
+ process.exitCode = 1;
46
+ }
47
+ else {
48
+ const session = await runAgent({ profileName, client, taskId, handoffId, prompt, cwd: oceanRoot() }, defaultAgentRuntime);
49
+ console.log(JSON.stringify({ sessionId: session.sessionId, status: session.status }));
50
+ }
51
+ }
52
+ //# sourceMappingURL=run.js.map