@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,58 @@
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 { listSchedules, runDueSchedules, runSchedule, runSchedulerWorker, runSchedulerWorkerOnce, saveSchedule, setScheduleEnabled, } from "../../../application/scheduler/local-scheduler.js";
4
+ import { defaultAgentRuntime } from "../../../composition/runtime.js";
5
+ export async function commandSchedule() {
6
+ const action = process.argv[3] ?? "list";
7
+ if (action === "list")
8
+ console.log(JSON.stringify(await listSchedules(), null, 2));
9
+ else if (action === "add") {
10
+ const { guard, rest } = parseGuardFlags(process.argv.slice(4));
11
+ const [id, profile, intervalMs, ...prompt] = rest;
12
+ if (!id || !profile || !intervalMs || !prompt.length) {
13
+ console.error(`Usage: ocean schedule add <id> <profile> <interval-ms> ${GUARD_FLAGS} <prompt>`);
14
+ process.exitCode = 1;
15
+ }
16
+ else
17
+ try {
18
+ await saveSchedule({
19
+ id,
20
+ profile,
21
+ prompt: prompt.join(" "),
22
+ intervalMs: Number(intervalMs),
23
+ nextRunAt: new Date().toISOString(),
24
+ enabled: true,
25
+ guard: guard,
26
+ });
27
+ }
28
+ catch (error) {
29
+ console.error(error instanceof Error ? error.message : String(error));
30
+ process.exitCode = 1;
31
+ }
32
+ }
33
+ else if (action === "run-due")
34
+ console.log(JSON.stringify({ ran: await runDueSchedules(oceanRoot(), defaultAgentRuntime) }, null, 2));
35
+ else if (action === "worker-once")
36
+ console.log(JSON.stringify({ ran: await runSchedulerWorkerOnce(oceanRoot(), defaultAgentRuntime) }, null, 2));
37
+ else if (action === "worker") {
38
+ const controller = new AbortController();
39
+ const stop = () => controller.abort();
40
+ process.once("SIGINT", stop);
41
+ process.once("SIGTERM", stop);
42
+ await runSchedulerWorker(oceanRoot(), defaultAgentRuntime, {
43
+ signal: controller.signal,
44
+ pollMs: Number(oceanEnv("SCHEDULER_POLL_MS") ?? 30_000),
45
+ });
46
+ process.off("SIGINT", stop);
47
+ process.off("SIGTERM", stop);
48
+ }
49
+ else if (action === "enable" || action === "disable")
50
+ console.log(JSON.stringify(await setScheduleEnabled(process.argv[4] ?? "", action === "enable"), null, 2));
51
+ else if (action === "run-now")
52
+ await runSchedule(process.argv[4] ?? "", oceanRoot(), defaultAgentRuntime);
53
+ else {
54
+ console.error("Usage: ocean schedule list|add|enable|disable|run-due|run-now|worker-once|worker");
55
+ process.exitCode = 1;
56
+ }
57
+ }
58
+ //# sourceMappingURL=schedule.js.map
@@ -0,0 +1,21 @@
1
+ import { oceanEnv } from "@ocean/core/shared/paths.js";
2
+ import { restartService, runService, } from "../../../infrastructure/process/service.js";
3
+ import { commandGateway } from "./gateway.js";
4
+ export async function commandService() {
5
+ // `service webhook` serves the local webhook gateway (was `gateway`).
6
+ if (process.argv[3] === "webhook")
7
+ return commandGateway();
8
+ // `ocean service restart` (T-307): a new build reaches the service without unloading it.
9
+ if (process.argv[3] === "restart") {
10
+ const restarted = await restartService({ reload: false });
11
+ console.log(JSON.stringify({ service: restarted }, null, 2));
12
+ if (typeof restarted === "object")
13
+ process.exitCode = 1;
14
+ return;
15
+ }
16
+ const shutdownAfterMs = Number(oceanEnv("SERVICE_TEST_SHUTDOWN_MS"));
17
+ await runService(Number.isFinite(shutdownAfterMs) && shutdownAfterMs > 0
18
+ ? shutdownAfterMs
19
+ : undefined);
20
+ }
21
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1,182 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { promoteSessionToKnowledge } from "@ocean/brain/sessions-capture/session-promotion.js";
4
+ import { oceanPath, oceanRoot, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
5
+ import { resumeAgent } from "@ocean/work/runs/run-agent.js";
6
+ import { applyRetention, DEFAULT_KEEP_DAYS, planRetention, simulateRetention, } from "@ocean/work/sessions/session-retention.js";
7
+ import { openSessionStore } from "@ocean/work/sessions/session-store.js";
8
+ import { defaultAgentRuntime, defaultSessionStoreFactory, defaultSessionStoreOpener, } from "../../../composition/runtime.js";
9
+ export async function commandSession() {
10
+ const action = process.argv[3] ?? "list";
11
+ const store = await openSessionStore();
12
+ if (action === "list") {
13
+ console.log(JSON.stringify(store.list()));
14
+ store.close();
15
+ }
16
+ else if (action === "show") {
17
+ const sessionId = process.argv[4] ?? "";
18
+ const session = store.get(sessionId);
19
+ const entryEvent = session
20
+ ? store
21
+ .listEvents(sessionId)
22
+ .find((event) => event.type === "session_entry_contract")
23
+ : undefined;
24
+ store.close();
25
+ if (!session) {
26
+ console.error("Session not found");
27
+ process.exitCode = 1;
28
+ }
29
+ else
30
+ console.log(JSON.stringify({
31
+ ...session,
32
+ entryContract: entryEvent ? JSON.parse(entryEvent.data) : null,
33
+ }));
34
+ }
35
+ else if (action === "summary") {
36
+ const sessionId = process.argv[4] ?? "";
37
+ const session = store.get(sessionId);
38
+ store.close();
39
+ if (!session) {
40
+ console.error("Session not found");
41
+ process.exitCode = 1;
42
+ }
43
+ else if (!session.summaryPath) {
44
+ console.error("Session summary not available");
45
+ process.exitCode = 1;
46
+ }
47
+ else {
48
+ try {
49
+ console.log(await readFile(path.resolve(oceanRoot(), session.summaryPath), "utf8"));
50
+ }
51
+ catch {
52
+ console.error("Session summary file is missing");
53
+ process.exitCode = 1;
54
+ }
55
+ }
56
+ }
57
+ else if (action === "events") {
58
+ const sessionId = process.argv[4] ?? "";
59
+ const session = store.get(sessionId);
60
+ const events = session ? store.listEvents(sessionId) : [];
61
+ store.close();
62
+ if (!session) {
63
+ console.error("Session not found");
64
+ process.exitCode = 1;
65
+ }
66
+ else
67
+ console.log(JSON.stringify(events, null, 2));
68
+ }
69
+ else if (action === "resume") {
70
+ const sessionId = process.argv[4];
71
+ const prompt = process.argv.slice(5).join(" ");
72
+ store.close();
73
+ if (!sessionId || !prompt) {
74
+ console.error("Usage: ocean session resume <session-id> <prompt>");
75
+ process.exitCode = 1;
76
+ }
77
+ else {
78
+ const session = await resumeAgent(sessionId, prompt, defaultAgentRuntime);
79
+ console.log(JSON.stringify({
80
+ sessionId: session.sessionId,
81
+ status: session.status,
82
+ }));
83
+ }
84
+ }
85
+ else if (action === "promote") {
86
+ const sessionId = process.argv[4];
87
+ const target = process.argv[5] ?? "knowledge/lessons";
88
+ store.close();
89
+ if (!sessionId) {
90
+ console.error("Usage: ocean session promote <session-id> [knowledge/<kind>] --approve");
91
+ process.exitCode = 1;
92
+ }
93
+ else {
94
+ try {
95
+ console.log(JSON.stringify(await promoteSessionToKnowledge(sessionId, defaultSessionStoreFactory, target, process.argv.includes("--approve")), null, 2));
96
+ }
97
+ catch (error) {
98
+ console.error(error instanceof Error ? error.message : String(error));
99
+ process.exitCode = 1;
100
+ }
101
+ }
102
+ }
103
+ else if (action === "doctor") {
104
+ const thresholdHours = Number(process.argv[4] ?? "24");
105
+ const apply = process.argv.includes("--apply");
106
+ if (!Number.isFinite(thresholdHours) || thresholdHours <= 0) {
107
+ store.close();
108
+ console.error("Usage: ocean session doctor [hours] [--apply]");
109
+ process.exitCode = 1;
110
+ }
111
+ else {
112
+ const thresholdMs = thresholdHours * 60 * 60 * 1000;
113
+ const stale = apply
114
+ ? store.reconcileStaleRunning(thresholdMs)
115
+ : store.listStaleRunning(thresholdMs);
116
+ console.log(JSON.stringify({
117
+ apply,
118
+ thresholdHours,
119
+ stale: stale.map((session) => ({
120
+ sessionId: session.sessionId,
121
+ provider: session.provider,
122
+ updatedAt: session.updatedAt,
123
+ })),
124
+ integrity: store.integrityCheck(),
125
+ }));
126
+ store.close();
127
+ }
128
+ }
129
+ else if (action === "compact") {
130
+ const keepDaysIndex = process.argv.indexOf("--keep-days");
131
+ const keepDays = keepDaysIndex >= 0
132
+ ? Number(process.argv[keepDaysIndex + 1])
133
+ : DEFAULT_KEEP_DAYS;
134
+ const simulate = process.argv.includes("--simulate");
135
+ const apply = process.argv.includes("--apply");
136
+ const beforeIndex = process.argv.indexOf("--before");
137
+ const before = beforeIndex >= 0 ? process.argv[beforeIndex + 1] : undefined;
138
+ const planIndex = process.argv.indexOf("--plan");
139
+ const fingerprint = planIndex >= 0 ? process.argv[planIndex + 1] : undefined;
140
+ if (!Number.isFinite(keepDays) || keepDays <= 0) {
141
+ store.close();
142
+ console.error("Usage: ocean session compact [--keep-days N] [--simulate|--apply --before <iso> --plan <fingerprint>] [--json]");
143
+ process.exitCode = 1;
144
+ return;
145
+ }
146
+ const plan = planRetention(store, { keepDays, before });
147
+ if (apply) {
148
+ if (!before || !fingerprint) {
149
+ store.close();
150
+ console.error("ocean session compact --apply requires --before <iso> and --plan <fingerprint> from a prior plan/--simulate run");
151
+ process.exitCode = 1;
152
+ return;
153
+ }
154
+ try {
155
+ const result = await applyRetention(store, oceanPath(SYSTEM_DIR, "sessions", "sessions.sqlite"), plan, fingerprint);
156
+ console.log(JSON.stringify({ apply: true, plan, result }, null, 2));
157
+ }
158
+ catch (error) {
159
+ console.error(error instanceof Error ? error.message : String(error));
160
+ process.exitCode = 1;
161
+ }
162
+ finally {
163
+ store.close();
164
+ }
165
+ return;
166
+ }
167
+ if (simulate) {
168
+ const result = await simulateRetention(store, oceanPath(SYSTEM_DIR, "sessions", "sessions.sqlite"), plan, defaultSessionStoreOpener);
169
+ store.close();
170
+ console.log(JSON.stringify({ simulate: true, plan, result }, null, 2));
171
+ return;
172
+ }
173
+ store.close();
174
+ console.log(JSON.stringify({ dryRun: true, plan }, null, 2));
175
+ }
176
+ else {
177
+ store.close();
178
+ console.error("Usage: ocean session list|show <session-id>|summary <session-id>|events <session-id>|resume <session-id> <prompt>|promote <session-id> [knowledge/<kind>] --approve|doctor [hours] [--apply]|compact [--keep-days N] [--simulate]|compact --apply --before <iso> --plan <fingerprint>");
179
+ process.exitCode = 1;
180
+ }
181
+ }
182
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1,12 @@
1
+ import { runSessionsCommand } from "../sessions-command.js";
2
+ import { router } from "./dispatch.js";
3
+ import { commandHandoff } from "./handoff.js";
4
+ import { commandSession } from "./session.js";
5
+ // One noun for recorded sessions: list, show, summary, events, resume, promote, doctor, compact
6
+ // (was `session`), handoff (was `handoff`), relink and cost.
7
+ export const commandSessions = router({
8
+ relink: { keep: () => runSessionsCommand(process.argv.slice(3)) },
9
+ cost: { keep: () => runSessionsCommand(process.argv.slice(3)) },
10
+ handoff: { drop: commandHandoff },
11
+ }, commandSession);
12
+ //# sourceMappingURL=sessions.js.map
@@ -0,0 +1,21 @@
1
+ import { runOnboardCommand } from "../onboard-command.js";
2
+ import { parseSetupArgs, SETUP_USAGE, setup } from "../setup-command.js";
3
+ import { withArgs } from "./dispatch.js";
4
+ import { commandEnv } from "./env.js";
5
+ export async function commandSetup() {
6
+ // `setup onboard` is the first-run wizard, `setup path` the shell line (were onboard, env).
7
+ if (process.argv[3] === "onboard")
8
+ return withArgs(process.argv.slice(4), () => runOnboardCommand(process.argv.slice(3)));
9
+ if (process.argv[3] === "path")
10
+ return commandEnv();
11
+ const parsed = parseSetupArgs(process.argv.slice(3));
12
+ if (parsed.kind === "help")
13
+ console.log(SETUP_USAGE);
14
+ else if (parsed.kind === "error") {
15
+ console.error(`${parsed.message}\n${SETUP_USAGE}`);
16
+ process.exitCode = 1;
17
+ }
18
+ else
19
+ await setup(parsed.options);
20
+ }
21
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1,159 @@
1
+ import { learnFromSession } from "@ocean/brain/memory/lesson-learning.js";
2
+ import { addLesson, effectiveConfidence, listLessons, migrateLegacyLessons, readLesson, setLessonStatus, } from "@ocean/brain/memory/lessons.js";
3
+ import { coreSkillReports, syncCoreSkills, } from "@ocean/connect/skills/core-skill-sync.js";
4
+ import { copyClientSkills, linkClientSkills, populateSkillHub, skillDuplicates, skillProfileReport, skillSurfaceReport, } from "@ocean/connect/skills/skill-hub.js";
5
+ import { projectSignals } from "@ocean/core/shared/repo-signals.js";
6
+ import { buildSkillIndex, loadSkillIndex, ROUTE_THRESHOLD, routerLine, routeSkills, } from "../../../application/integrations/skill-router.js";
7
+ import { defaultSessionStoreFactory } from "../../../composition/runtime.js";
8
+ export async function commandSkill() {
9
+ const action = process.argv[3] ?? "list";
10
+ if (action === "sync")
11
+ console.log(JSON.stringify(await syncCoreSkills(), null, 2));
12
+ else if (action === "hub") {
13
+ const sources = process.argv
14
+ .slice(4)
15
+ .filter((arg) => !arg.startsWith("--"));
16
+ console.log(JSON.stringify(await populateSkillHub(sources), null, 2));
17
+ }
18
+ else if (action === "copy") {
19
+ console.log(JSON.stringify(await copyClientSkills({ apply: process.argv.includes("--apply") }), null, 2));
20
+ }
21
+ else if (action === "link") {
22
+ console.log(JSON.stringify(await linkClientSkills({
23
+ apply: process.argv.includes("--apply"),
24
+ all: process.argv.includes("--all"),
25
+ }), null, 2));
26
+ }
27
+ else if (action === "doctor") {
28
+ // Core skills per client, then the surface check: every installed client holds the
29
+ // skills Ocean keeps for it (T-319 C5). A gap fails the command.
30
+ const surface = await skillSurfaceReport();
31
+ const profiles = await skillProfileReport();
32
+ const duplicates = await skillDuplicates();
33
+ console.log(JSON.stringify({ core: await coreSkillReports(), surface, profiles, duplicates }, null, 2));
34
+ for (const { profile, skill } of profiles.missing)
35
+ console.error(`NOT CONSISTENT: profile ${profile} names missing skill ${skill}`);
36
+ for (const { profile, skill } of profiles.clientOnly)
37
+ console.error(`profile ${profile} names ${skill}, held only by a client (not core or the hub)`);
38
+ for (const { name, error } of profiles.problems)
39
+ console.error(`NOT CONSISTENT: profile ${name} does not load: ${error}`);
40
+ if (profiles.noProfile.length)
41
+ console.error(`${profiles.noProfile.length} hub skill(s) in no profile: ${profiles.noProfile.join(", ")}`);
42
+ // A skill loaded twice by one client warns: the model sees two near-identical entries.
43
+ for (const { client, skill, at } of duplicates)
44
+ console.error(`DUPLICATE: ${client} loads ${skill} twice: ${at.join(", ")}`);
45
+ if (!profiles.consistent)
46
+ process.exitCode = 1;
47
+ if (!surface.consistent) {
48
+ for (const row of surface.clients)
49
+ if (row.missing.length)
50
+ console.error(`NOT CONSISTENT: ${row.client} lacks ${row.missing.join(", ")} (${row.root})`);
51
+ process.exitCode = 1;
52
+ }
53
+ }
54
+ else if (action === "list") {
55
+ // [status] filters; any other argument is a lesson id (what a truncated lesson points at).
56
+ const filter = process.argv[4];
57
+ const isStatus = filter === "candidate" || filter === "active" || filter === "retired";
58
+ const lessons = filter && !isStatus
59
+ ? [await readLesson(filter)].filter((lesson) => lesson !== null)
60
+ : await listLessons(isStatus ? { status: filter } : {});
61
+ if (filter && !isStatus && !lessons.length) {
62
+ console.error(`Lesson not found: ${filter}`);
63
+ process.exitCode = 1;
64
+ }
65
+ else
66
+ console.log(JSON.stringify(lessons.map((lesson) => ({
67
+ ...lesson,
68
+ effectiveConfidence: Number(effectiveConfidence(lesson).toFixed(4)),
69
+ })), null, 2));
70
+ }
71
+ else if (action === "observe" || action === "learn") {
72
+ // Scores one closed session into the lessons store (the same step closeout runs).
73
+ const sessionId = process.argv[4];
74
+ if (!sessionId && action === "observe")
75
+ console.log(JSON.stringify(await listLessons({ status: "candidate" }), null, 2));
76
+ else if (!sessionId) {
77
+ console.error("Usage: ocean skill learn <session-id>");
78
+ process.exitCode = 1;
79
+ }
80
+ else {
81
+ const store = await defaultSessionStoreFactory();
82
+ try {
83
+ const learning = await learnFromSession(store, sessionId);
84
+ console.log(JSON.stringify(learning, null, 2));
85
+ // Lessons come only from verified sessions (T-323); say so instead of silently learning nothing.
86
+ if (!learning.score.verified)
87
+ console.error(`Session ${sessionId} is not verified: no lessons were learned from it.`);
88
+ }
89
+ finally {
90
+ store.close();
91
+ }
92
+ }
93
+ }
94
+ else if (action === "add") {
95
+ const [id, name, ...instructions] = process.argv.slice(4);
96
+ if (!id || !name || !instructions.length) {
97
+ console.error("Usage: ocean skill add <id> <name> <instructions>");
98
+ process.exitCode = 1;
99
+ }
100
+ else
101
+ console.log(JSON.stringify(await addLesson({ id, title: name, body: instructions.join(" ") }), null, 2));
102
+ }
103
+ else if (action === "review") {
104
+ // The owner's call: promoted activates a lesson without waiting for the replay eval,
105
+ // rejected retires it. Run `ocean memory reindex` afterwards so runs can find it.
106
+ const [id, status] = process.argv.slice(4);
107
+ if (!id || (status !== "promoted" && status !== "rejected")) {
108
+ console.error("Usage: ocean skill review <id> promoted|rejected");
109
+ process.exitCode = 1;
110
+ }
111
+ else
112
+ console.log(JSON.stringify(await setLessonStatus(id, status === "promoted" ? "active" : "retired"), null, 2));
113
+ }
114
+ else if (action === "migrate") {
115
+ console.log(JSON.stringify(await migrateLegacyLessons(), null, 2));
116
+ }
117
+ else if (action === "route") {
118
+ // What the prompt hook would name for a message, with the near misses (T-325).
119
+ const args = process.argv.slice(4);
120
+ const value = (flag) => {
121
+ const at = args.indexOf(flag);
122
+ return at >= 0 ? args[at + 1] : undefined;
123
+ };
124
+ const valued = new Set(["--client", "--cwd"]);
125
+ const message = args
126
+ .filter((arg, i) => !arg.startsWith("--") && !valued.has(args[i - 1]))
127
+ .join(" ");
128
+ if (!message.trim()) {
129
+ console.error("Usage: ocean skill route <message> [--client claude|codex|gemini|qwen] [--cwd <dir>] [--rebuild] [--json]");
130
+ process.exitCode = 1;
131
+ return;
132
+ }
133
+ const index = args.includes("--rebuild")
134
+ ? await buildSkillIndex()
135
+ : await loadSkillIndex();
136
+ const result = routeSkills(index, message, {
137
+ signals: await projectSignals(value("--cwd") ?? process.cwd()),
138
+ client: value("--client") ?? "claude",
139
+ });
140
+ if (args.includes("--json"))
141
+ console.log(JSON.stringify({
142
+ threshold: ROUTE_THRESHOLD,
143
+ skills: index.skills.length,
144
+ ...result,
145
+ }, null, 2));
146
+ else {
147
+ console.log(result.matches.length
148
+ ? routerLine(result.matches)
149
+ : `No skill above the threshold (${ROUTE_THRESHOLD}).`);
150
+ for (const item of result.candidates)
151
+ console.log(` ${item.score.toFixed(1).padStart(5)} ${item.name} [${item.why.join(", ")}]`);
152
+ }
153
+ }
154
+ else {
155
+ console.error("Usage: ocean skill sync|doctor|list [status|id]|observe [session-id]|add|review <id> promoted|rejected|migrate|route <message>");
156
+ process.exitCode = 1;
157
+ }
158
+ }
159
+ //# sourceMappingURL=skill.js.map
@@ -0,0 +1,10 @@
1
+ import { runTasksCommand } from "../tasks-command.js";
2
+ import { withArgs } from "./dispatch.js";
3
+ import { commandLoop } from "./loop.js";
4
+ export async function commandTasks() {
5
+ // `tasks loop` runs task loops (was `loop`).
6
+ if (process.argv[3] === "loop")
7
+ return withArgs(process.argv.slice(4), commandLoop);
8
+ await runTasksCommand(process.argv[3] ?? "", process.argv.slice(4));
9
+ }
10
+ //# sourceMappingURL=tasks.js.map
@@ -0,0 +1,25 @@
1
+ import { removeInstalledProvider, updateProvider, } from "../../../application/install/provider-installer.js";
2
+ import { defaultProviderRegistry, defaultWrapperManager, } from "../../../composition/runtime.js";
3
+ export async function commandUpdateOrRemove(command) {
4
+ const id = process.argv[3];
5
+ if (!id || !process.argv.includes("--yes")) {
6
+ console.error(`Usage: ocean ${command} <client> --yes`);
7
+ process.exitCode = 2;
8
+ }
9
+ else {
10
+ try {
11
+ const result = command === "update"
12
+ ? await updateProvider(id, true, defaultWrapperManager, defaultProviderRegistry)
13
+ : await removeInstalledProvider(id, true, defaultWrapperManager);
14
+ console.log(JSON.stringify({
15
+ [command === "update" ? "updated" : "removed"]: true,
16
+ provider: result,
17
+ }, null, 2));
18
+ }
19
+ catch (error) {
20
+ console.error(error instanceof Error ? error.message : String(error));
21
+ process.exitCode = 1;
22
+ }
23
+ }
24
+ }
25
+ //# sourceMappingURL=update-remove.js.map
@@ -0,0 +1,150 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { mkdir, readFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { ConnectorHub, connectorsForProfile, scoutProfile, scoutReport, } from "@ocean/connect/connectors/connector-hub.js";
5
+ import { searchRegistry } from "@ocean/connect/registry/official-registry.js";
6
+ import { profileCatalog, } from "@ocean/core/profiles/session-profile.js";
7
+ import { atomicWrite } from "@ocean/core/shared/fs-utils.js";
8
+ import { oceanPath, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
9
+ // T-339 P3: `ocean connectors list|doctor|add|remove|auth` and `ocean scout <profile>`.
10
+ export const connectorsDir = () => oceanPath(SYSTEM_DIR, "connectors");
11
+ // Whether the entry's sign-in is in place, without reading a secret. Keychain: the service has
12
+ // an item (`security find-generic-password -s` prints attributes only). OAuth sits with the
13
+ // provider, so it is not checkable here.
14
+ function signedInHere(entry, platform = process.platform) {
15
+ if (entry.auth.type !== "keychain" ||
16
+ platform !== "darwin" ||
17
+ !entry.auth.service)
18
+ return undefined;
19
+ return (spawnSync("security", ["find-generic-password", "-s", entry.auth.service], {
20
+ stdio: "ignore",
21
+ }).status === 0);
22
+ }
23
+ const AUTH_HELP = {
24
+ oauth: (entry) => entry.auth.provider === "composio"
25
+ ? `Sign in through Composio: \`composio link ${entry.source.replace(/^composio:/, "")}\` (the token stays with Composio).`
26
+ : `Sign in through ${entry.auth.provider}; the token stays with the provider.`,
27
+ keychain: (entry) => `File the secret yourself: \`security add-generic-password -s ${entry.auth.service} -a "$USER" -w\` (prompts; Ocean never sees it).`,
28
+ none: () => "No sign-in needed.",
29
+ };
30
+ export async function runConnectorsCommand(args, hub = new ConnectorHub(connectorsDir())) {
31
+ const [action = "list", target] = args;
32
+ const json = args.includes("--json");
33
+ if (action === "list") {
34
+ const { rows, invalid } = await hub.list();
35
+ const profile = args.includes("--profile")
36
+ ? args[args.indexOf("--profile") + 1]
37
+ : undefined;
38
+ let shown = rows;
39
+ if (profile) {
40
+ const summary = (await profileCatalog()).profiles.find((candidate) => candidate.name === profile);
41
+ shown = connectorsForProfile(rows, {
42
+ name: profile,
43
+ connectors: summary?.connectors ?? [],
44
+ });
45
+ }
46
+ if (json)
47
+ return void console.log(JSON.stringify({ connectors: shown, invalid }, null, 2));
48
+ if (!shown.length)
49
+ console.log(profile ? `no connectors for ${profile}` : "no connectors");
50
+ for (const row of shown)
51
+ console.log(`${row.id} ${row.kind} ${row.source} auth=${row.auth.type} profiles=${row.profiles.join(",") || "-"} (${row.origin})`);
52
+ for (const bad of invalid)
53
+ console.log(`! ${bad.id}: ${bad.message}`);
54
+ return;
55
+ }
56
+ if (action === "doctor") {
57
+ const findings = await hub.doctor((entry) => signedInHere(entry));
58
+ if (json)
59
+ console.log(JSON.stringify(findings, null, 2));
60
+ else
61
+ for (const finding of findings)
62
+ console.log(`${finding.level.padEnd(5)} ${finding.id}: ${finding.message}`);
63
+ if (findings.some((finding) => finding.level === "error"))
64
+ process.exitCode = 1;
65
+ return;
66
+ }
67
+ if (action === "add") {
68
+ if (!target)
69
+ throw new Error("Usage: ocean connectors add <entry.json> --approve");
70
+ const raw = JSON.parse(await readFile(path.resolve(target), "utf8"));
71
+ if (!args.includes("--approve")) {
72
+ console.error("Adding a connector needs the owner's approval: re-run with --approve. Nothing written.");
73
+ process.exitCode = 1;
74
+ return;
75
+ }
76
+ const entry = await hub.add(raw);
77
+ console.log(`added ${entry.id} (${entry.kind} ${entry.source}); sign in: ocean connectors auth ${entry.id}`);
78
+ return;
79
+ }
80
+ if (action === "remove") {
81
+ if (!target)
82
+ throw new Error("Usage: ocean connectors remove <id>");
83
+ console.log((await hub.remove(target))
84
+ ? `removed ${target}`
85
+ : `no live entry ${target} (built-in entries stay)`);
86
+ return;
87
+ }
88
+ if (action === "auth") {
89
+ const entry = (await hub.list()).rows.find((row) => row.id === target);
90
+ if (!entry)
91
+ throw new Error(`no connector ${target ?? "(none given)"}`);
92
+ console.log(AUTH_HELP[entry.auth.type](entry));
93
+ if (entry.risk)
94
+ console.log(`Risk: ${entry.risk}`);
95
+ return;
96
+ }
97
+ console.error("Usage: ocean connectors list [--profile <name>] [--json]|doctor|add <entry.json> --approve|remove <id>|auth <id>");
98
+ process.exitCode = 1;
99
+ }
100
+ // Sources scout may ask: the official MCP registry and what is already installed here. It reads
101
+ // only; nothing is installed or written but its report.
102
+ function defaultScoutSources(profiles, rows) {
103
+ return {
104
+ "mcp-registry": async (term) => (await searchRegistry(term, { limit: 8, timeoutMs: 8000 })).map((hit) => ({
105
+ source: "mcp-registry",
106
+ name: hit.name,
107
+ description: hit.description,
108
+ official: true,
109
+ status: hit.status,
110
+ })),
111
+ installed: async (term) => {
112
+ const needle = term.toLowerCase();
113
+ const names = [
114
+ ...rows.map((row) => ({ name: row.id, description: row.title })),
115
+ ...profiles.flatMap((profile) => [...profile.mcp, ...profile.composio].map((name) => ({
116
+ name,
117
+ description: `used by profile ${profile.name}`,
118
+ }))),
119
+ ];
120
+ return names
121
+ .filter((item) => item.name.toLowerCase().includes(needle) ||
122
+ item.description.toLowerCase().includes(needle))
123
+ .map((item) => ({
124
+ source: "installed",
125
+ ...item,
126
+ official: false,
127
+ status: "installed",
128
+ }));
129
+ },
130
+ };
131
+ }
132
+ export async function runScoutCommand(args, options = {}) {
133
+ const name = args[0];
134
+ if (!name)
135
+ throw new Error("Usage: ocean connectors scout <profile>");
136
+ const profiles = options.profiles ?? (await profileCatalog()).profiles;
137
+ const profile = profiles.find((candidate) => candidate.name === name);
138
+ if (!profile)
139
+ throw new Error(`no profile named ${name}. Installed: ${profiles.map((p) => p.name).join(", ")}`);
140
+ const sources = options.sources ??
141
+ defaultScoutSources(profiles, (await new ConnectorHub(connectorsDir()).list()).rows);
142
+ const date = (options.now ?? new Date()).toISOString().slice(0, 10);
143
+ const result = await scoutProfile(profile, sources);
144
+ const file = oceanPath(SYSTEM_DIR, "state", "scout", `${name}-${date}.md`);
145
+ await mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
146
+ await atomicWrite(file, scoutReport(profile, result, date));
147
+ console.log(`scout ${name}: ${result.candidates.length} candidates, report ${file}. Nothing installed.`);
148
+ return file;
149
+ }
150
+ //# sourceMappingURL=connectors-command.js.map