@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,40 @@
1
+ import { parse, stringify } from "yaml";
2
+ // A profile as Markdown (T-338): YAML frontmatter holds every field but `instructions`, and the
3
+ // body is the instructions. Obsidian's Properties editor rewrites lists as block YAML and the
4
+ // `clients` map is nested, so the frontmatter is real YAML, not the flat record parser.
5
+ const FENCE = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/;
6
+ // The body is normalized (LF, trimmed) so an editor's trailing newline never changes the
7
+ // profile's identity.
8
+ function normalizeInstructions(text) {
9
+ return text.replace(/\r\n?/g, "\n").trim();
10
+ }
11
+ // Messages name the file only: the YAML parser quotes the text around an error, which could be
12
+ // part of a secret pasted into the file.
13
+ export function parseProfileMarkdown(source, file) {
14
+ const match = FENCE.exec(source.replace(/^/, ""));
15
+ if (!match)
16
+ throw new Error(`Profile ${file} has no frontmatter block`);
17
+ let fields;
18
+ try {
19
+ fields = parse(match[1] ?? "", { prettyErrors: false });
20
+ }
21
+ catch {
22
+ throw new Error(`Invalid profile frontmatter in ${file}`);
23
+ }
24
+ if (!fields || typeof fields !== "object" || Array.isArray(fields))
25
+ throw new Error(`Profile ${file} frontmatter must be a mapping`);
26
+ const record = fields;
27
+ if ("instructions" in record)
28
+ throw new Error(`Profile ${file} sets instructions in frontmatter; write them as the body`);
29
+ const body = normalizeInstructions(source.slice(match[0].length));
30
+ return body ? { ...record, instructions: body } : record;
31
+ }
32
+ // The inverse, for migrating a JSON profile: field order is kept, `instructions` becomes the
33
+ // body.
34
+ export function renderProfileMarkdown(raw) {
35
+ const { instructions, ...fields } = raw;
36
+ const frontmatter = stringify(fields, { lineWidth: 0 }).trimEnd();
37
+ const body = typeof instructions === "string" ? normalizeInstructions(instructions) : "";
38
+ return `---\n${frontmatter}\n---\n${body ? `\n${body}\n` : ""}`;
39
+ }
40
+ //# sourceMappingURL=profile-markdown.js.map
@@ -0,0 +1,276 @@
1
+ import { tokenize } from "../../shared/text-tokens.js";
2
+ export const BASE_PROFILE = "base";
3
+ const MAX_SECONDARY = 2;
4
+ const MAX_TEXT = 2_000;
5
+ // The profiles before v3 (T-296) and the ones that replace them. An old name still answers for
6
+ // its new one and the other way round, so `ocean run` keeps working whichever set is installed;
7
+ // a profile is chosen by name only, so its identity (and a session's resume) never changes.
8
+ const PROFILE_ALIASES = {
9
+ base: ["default"],
10
+ security: ["security-auditor"],
11
+ "code-review": ["reviewer"],
12
+ "qa-testing": ["tester"],
13
+ analysis: ["researcher"],
14
+ "product-strategy": ["strategist"],
15
+ frontend: ["developer"],
16
+ backend: ["developer"],
17
+ };
18
+ // The words the old rule table (PROFILE_RULES) matched, as triggers for a profile that declares
19
+ // none. Listed in the old table's order: on a tie the earlier one wins, as the first rule did.
20
+ const LEGACY_TRIGGERS = [
21
+ [
22
+ "security",
23
+ [
24
+ "security",
25
+ "privacy",
26
+ "secret",
27
+ "vulnerability",
28
+ "vulnerable",
29
+ "auth",
30
+ "authentication",
31
+ "authorization",
32
+ "permission",
33
+ "leak",
34
+ ],
35
+ ],
36
+ ["code-review", ["review", "reviewer", "audit", "inspect", "inspection"]],
37
+ [
38
+ "qa-testing",
39
+ [
40
+ "test",
41
+ "testing",
42
+ "regression",
43
+ "reproduce",
44
+ "reproduction",
45
+ "flaky",
46
+ "coverage",
47
+ ],
48
+ ],
49
+ [
50
+ "devops",
51
+ [
52
+ "deploy",
53
+ "deployment",
54
+ "release",
55
+ "ci",
56
+ "pipeline",
57
+ "docker",
58
+ "dockerfile",
59
+ "infra",
60
+ "infrastructure",
61
+ "runtime",
62
+ "rollout",
63
+ ],
64
+ ],
65
+ [
66
+ "analysis",
67
+ [
68
+ "research",
69
+ "investigate",
70
+ "investigation",
71
+ "compare",
72
+ "comparison",
73
+ "evaluate",
74
+ "evaluation",
75
+ "spike",
76
+ "explore",
77
+ "exploration",
78
+ ],
79
+ ],
80
+ [
81
+ "product-strategy",
82
+ [
83
+ "plan",
84
+ "planning",
85
+ "design",
86
+ "architecture",
87
+ "strategy",
88
+ "roadmap",
89
+ "proposal",
90
+ "decide",
91
+ ],
92
+ ],
93
+ [
94
+ "developer",
95
+ [
96
+ "implement",
97
+ "implementation",
98
+ "fix",
99
+ "build",
100
+ "add",
101
+ "feat",
102
+ "feature",
103
+ "bug",
104
+ "refactor",
105
+ "wire",
106
+ "migrate",
107
+ "migration",
108
+ ],
109
+ ],
110
+ ];
111
+ const LEGACY_ORDER = LEGACY_TRIGGERS.map(([name]) => name);
112
+ // The names the old rule table returned, in its order.
113
+ export const LEGACY_PROFILES = [
114
+ "security-auditor",
115
+ "reviewer",
116
+ "tester",
117
+ "devops",
118
+ "researcher",
119
+ "strategist",
120
+ "developer",
121
+ ];
122
+ // The canonical name a profile answers for (`tester` → `qa-testing`), itself when it has none.
123
+ function canonical(name) {
124
+ for (const [target, olds] of Object.entries(PROFILE_ALIASES))
125
+ if (olds.includes(name))
126
+ return target;
127
+ return name;
128
+ }
129
+ function legacyTriggers(name) {
130
+ const own = canonical(name);
131
+ const key = own === "frontend" || own === "backend" ? "developer" : own;
132
+ return (LEGACY_TRIGGERS.find(([legacy]) => legacy === key || legacy === name)?.[1] ?? []);
133
+ }
134
+ // Old-table order first, so a tie goes where the first matching rule used to send it.
135
+ function rank(name) {
136
+ const own = canonical(name);
137
+ const key = own === "frontend" || own === "backend" ? "developer" : own;
138
+ const at = LEGACY_ORDER.indexOf(key);
139
+ return at === -1 ? LEGACY_ORDER.length : at;
140
+ }
141
+ // `components.json` → `components`, `Dockerfile` → `dockerfile`, `dep:React` → `dep:react`:
142
+ // the same shape projectSignals() gives a repository's file names and dependencies.
143
+ function signalTerm(signal) {
144
+ const lower = signal.trim().toLowerCase();
145
+ if (lower.startsWith("dep:"))
146
+ return lower;
147
+ return lower.replace(/^\.+/, "").split(/[./\-_]/)[0] ?? "";
148
+ }
149
+ function prepare(profile) {
150
+ const declared = (profile.triggers ?? []).filter(Boolean);
151
+ const words = declared.length ? declared : legacyTriggers(profile.name);
152
+ return {
153
+ name: profile.name,
154
+ triggers: words
155
+ .map((trigger) => tokenize(trigger))
156
+ .filter((tokens) => tokens.length > 0),
157
+ signals: new Set((profile.signals ?? []).map(signalTerm).filter((term) => term.length)),
158
+ };
159
+ }
160
+ // A trigger matches when every one of its words is in the text; a phrase (two words or more)
161
+ // counts as a strong match on its own.
162
+ function scoreText(profiles, text) {
163
+ const words = new Set(tokenize(text.slice(0, MAX_TEXT)));
164
+ if (!words.size)
165
+ return [];
166
+ const scores = [];
167
+ for (const profile of profiles) {
168
+ const hits = profile.triggers.filter((tokens) => tokens.every((token) => words.has(token)));
169
+ if (hits.length)
170
+ scores.push({
171
+ name: profile.name,
172
+ score: hits.length,
173
+ phrase: hits.some((tokens) => tokens.length > 1),
174
+ hits: hits.map((tokens) => tokens.join(" ")),
175
+ });
176
+ }
177
+ return sortScores(scores);
178
+ }
179
+ function sortScores(scores) {
180
+ return scores.sort((a, b) => b.score - a.score ||
181
+ rank(a.name) - rank(b.name) ||
182
+ a.name.localeCompare(b.name));
183
+ }
184
+ // The installed profile a wanted name means: itself, else the profile it is an alias of, else
185
+ // one of its aliases.
186
+ export function installedAs(name, installed) {
187
+ if (installed.has(name))
188
+ return name;
189
+ // An old name may answer for more than one new profile (`developer` → frontend, backend).
190
+ for (const [target, olds] of Object.entries(PROFILE_ALIASES))
191
+ if (olds.includes(name) && installed.has(target))
192
+ return target;
193
+ for (const old of PROFILE_ALIASES[name] ?? [])
194
+ if (installed.has(old))
195
+ return old;
196
+ return null;
197
+ }
198
+ function fallback(installed) {
199
+ return installedAs(BASE_PROFILE, installed) ?? BASE_PROFILE;
200
+ }
201
+ export function resolveProfile(input) {
202
+ const profiles = input.profiles.map(prepare);
203
+ const installed = new Set(profiles.map((profile) => profile.name));
204
+ const base = fallback(installed);
205
+ const why = [];
206
+ let primary = null;
207
+ let confidence = "none";
208
+ const secondary = [];
209
+ const declared = (input.projectProfiles ?? [])
210
+ .map((name) => installedAs(name, installed))
211
+ .filter((name) => Boolean(name));
212
+ if (declared.length) {
213
+ primary = declared[0];
214
+ confidence = "high";
215
+ why.push(`project lists ${primary}`);
216
+ for (const name of declared.slice(1))
217
+ if (name !== primary && !secondary.includes(name))
218
+ secondary.push(name);
219
+ }
220
+ if (!primary && input.task) {
221
+ const task = input.task;
222
+ // The kind is a declared signal and is tried alone first; title and objective are prose.
223
+ const byKind = task.kind ? scoreText(profiles, task.kind) : [];
224
+ const byText = byKind.length
225
+ ? []
226
+ : scoreText(profiles, `${task.title} ${task.objective ?? ""}`);
227
+ const best = byKind[0] ?? byText[0];
228
+ if (best) {
229
+ primary = best.name;
230
+ confidence = byKind.length ? "high" : "medium";
231
+ why.push(`${task.id} ${byKind.length ? "kind" : "text"} matches ${best.hits.join(", ")}`);
232
+ }
233
+ }
234
+ if (!primary && input.signals) {
235
+ const repo = new Set(input.signals);
236
+ const scores = sortScores(profiles
237
+ .map((profile) => {
238
+ const hits = [...profile.signals].filter((term) => repo.has(term));
239
+ return {
240
+ name: profile.name,
241
+ score: hits.length,
242
+ phrase: false,
243
+ hits,
244
+ };
245
+ })
246
+ .filter((score) => score.score > 0));
247
+ const best = scores[0];
248
+ if (best) {
249
+ primary = best.name;
250
+ confidence = best.score >= 2 ? "medium" : "low";
251
+ why.push(`repository has ${best.hits.join(", ")}`);
252
+ }
253
+ }
254
+ if (!primary) {
255
+ primary = base;
256
+ why.push("nothing matched");
257
+ }
258
+ if (input.prompt)
259
+ for (const score of scoreText(profiles, input.prompt)) {
260
+ if (secondary.length >= MAX_SECONDARY)
261
+ break;
262
+ if (score.name === primary || secondary.includes(score.name))
263
+ continue;
264
+ if (score.score < 2 && !score.phrase)
265
+ continue;
266
+ secondary.push(score.name);
267
+ why.push(`prompt matches ${score.name}: ${score.hits.join(", ")}`);
268
+ }
269
+ return {
270
+ primary,
271
+ secondary: secondary.slice(0, MAX_SECONDARY),
272
+ confidence,
273
+ why,
274
+ };
275
+ }
276
+ //# sourceMappingURL=profile-resolution.js.map
@@ -1,73 +1,36 @@
1
- // Profile suggestion for a task (T-296 §3.10): a fixed rule table over the task record —
2
- // its `kind`, title and objective, plus `class`/`risk` — picks one installed profile and says
3
- // why. First matching rule wins; nothing matching, or a profile that is not installed, falls
4
- // back to `default`. The suggestion never widens anything by itself: `ocean run` uses it only
5
- // when runtime.json turns `autoProfile` on, and an explicit --profile always wins.
6
- export const PROFILE_RULES = [
7
- {
8
- rule: "security",
9
- profile: "security-auditor",
10
- words: /\b(security|privacy|secrets?|vulnerab\w*|auth(entication|orization)?|permissions?|leaks?)\b/,
11
- },
12
- {
13
- rule: "review",
14
- profile: "reviewer",
15
- words: /\b(review\w*|audit\w*|inspect\w*)\b/,
16
- },
17
- {
18
- rule: "test",
19
- profile: "tester",
20
- words: /\b(tests?|testing|regressions?|reproduc\w*|flaky|coverage)\b/,
21
- },
22
- {
23
- rule: "delivery",
24
- profile: "devops",
25
- words: /\b(deploy\w*|release\w*|ci|pipelines?|docker\w*|infra\w*|runtime|rollout)\b/,
26
- },
27
- {
28
- rule: "research",
29
- profile: "researcher",
30
- words: /\b(research\w*|investigat\w*|compar\w*|evaluat\w*|spike|explor\w*)\b/,
31
- },
32
- {
33
- rule: "planning",
34
- profile: "strategist",
35
- words: /\b(plan|planning|design|architecture|strategy|roadmap|proposal|decide)\b/,
36
- },
37
- {
38
- rule: "implementation",
39
- profile: "developer",
40
- words: /\b(implement\w*|fix\w*|build\w*|add\w*|feat\w*|bugs?|refactor\w*|wire\w*|migrat\w*)\b/,
41
- },
42
- ];
1
+ import { BASE_PROFILE, installedAs, LEGACY_PROFILES, resolveProfile, } from "./profile-resolution.js";
2
+ function fallbackName(installed) {
3
+ return installed.has(BASE_PROFILE) ? BASE_PROFILE : "default";
4
+ }
43
5
  export function suggestProfile(task, installed) {
44
- // The kind is a declared signal and is tried alone first; title and objective are prose.
45
- const sources = [task.kind ?? "", `${task.title} ${task.objective ?? ""}`];
46
- let match;
47
- for (const text of sources) {
48
- const lower = text.toLowerCase().slice(0, 2_000);
49
- match = PROFILE_RULES.find((rule) => rule.words.test(lower));
50
- if (match)
51
- break;
52
- }
6
+ const candidates = installed.map((entry) => typeof entry === "string" ? { name: entry } : entry);
7
+ const names = new Set(candidates.map((candidate) => candidate.name));
8
+ // The old profiles that are not installed still compete, so the reason can say which one the
9
+ // work wanted.
10
+ const missing = LEGACY_PROFILES.filter((name) => !installedAs(name, names));
11
+ const result = resolveProfile({
12
+ profiles: [...candidates, ...missing.map((name) => ({ name }))],
13
+ task,
14
+ });
53
15
  const highRisk = [task.class, task.risk].some((value) => value?.toLowerCase() === "high");
54
16
  const riskNote = highRisk ? "; high risk — verify before completing" : "";
55
- if (!match)
17
+ const why = result.why[0] ?? "";
18
+ if (result.confidence === "none")
56
19
  return {
57
- profile: "default",
20
+ profile: fallbackName(names),
58
21
  rule: "fallback",
59
22
  reason: `no rule matched ${task.id}${riskNote}`,
60
23
  };
61
- if (!installed.includes(match.profile))
24
+ if (!names.has(result.primary))
62
25
  return {
63
- profile: "default",
64
- rule: match.rule,
65
- reason: `${match.rule} work suggests ${match.profile}, which is not installed${riskNote}`,
26
+ profile: fallbackName(names),
27
+ rule: result.primary,
28
+ reason: `${why} — suggests ${result.primary}, which is not installed${riskNote}`,
66
29
  };
67
30
  return {
68
- profile: match.profile,
69
- rule: match.rule,
70
- reason: `${match.rule} work in ${task.id}${riskNote}`,
31
+ profile: result.primary,
32
+ rule: result.primary,
33
+ reason: `${why}${riskNote}`,
71
34
  };
72
35
  }
73
36
  //# sourceMappingURL=profile-selection.js.map
@@ -1,4 +1,4 @@
1
- import { redactSecrets } from "../redaction/redaction.js";
1
+ import { redactSecrets } from "../redaction.js";
2
2
  import { isApiClient, selectProfileClient } from "./profile.js";
3
3
  import { validateProfile } from "./profile-validator.js";
4
4
  const credentialKey = /api[-_]?key|token|secret|password|credential|bearer/i;
@@ -57,7 +57,7 @@ export function upgradeProfile(raw) {
57
57
  catch (error) {
58
58
  return { status: "rejected", issues: [error.message] };
59
59
  }
60
- if (v1.schemaVersion === 2)
60
+ if (v1.schemaVersion >= 2)
61
61
  return { status: "current" };
62
62
  const changes = [];
63
63
  const rawClients = (input.clients ?? {});
@@ -23,7 +23,7 @@ const modelSchema = z
23
23
  .string()
24
24
  .min(1)
25
25
  .refine((model) => !model.startsWith("-"), "A model cannot start with -");
26
- export const transportSchema = z.enum(["cli", "openai-compatible-api"]);
26
+ const transportSchema = z.enum(["cli", "openai-compatible-api"]);
27
27
  // `transport` and `temperature` stay optional (no default) so a v1 binding parses to exactly
28
28
  // the object it parsed to before schema v2, and its profile identity is unchanged.
29
29
  const clientBindingSchema = z.object({
@@ -46,7 +46,7 @@ const governanceSchema = z.object({
46
46
  approvalRequired: z.boolean().optional(),
47
47
  network: z.string().min(1).optional(),
48
48
  });
49
- // A profile name is also a filename (profiles/<name>.json) and a memory namespace
49
+ // A profile name is also a filename (profiles/<name>.md or .json) and a memory namespace
50
50
  // (memory/profiles/<name>.json), so it is restricted to characters that can never form a path.
51
51
  // Lowercase only: on a case-insensitive filesystem "Alpha" and "alpha" would share one file.
52
52
  const profileNamePattern = /^[a-z0-9][a-z0-9_-]{0,63}$/;
@@ -56,9 +56,11 @@ export function assertProfileName(name) {
56
56
  throw new Error("Invalid profile name");
57
57
  return name;
58
58
  }
59
+ const bundleList = z.array(z.string().min(1)).optional();
59
60
  const rawProfileSchema = z.object({
60
- // Absent means 1. Schema v1 stays readable for one release; v2 is what new profiles use.
61
- schemaVersion: z.union([z.literal(1), z.literal(2)]).default(1),
61
+ // Absent means 1. Schema v1 stays readable for one release; v2 is what role profiles use and
62
+ // v3 (T-338) adds the domain-bundle fields below.
63
+ schemaVersion: z.union([z.literal(1), z.literal(2), z.literal(3)]).default(1),
62
64
  name: z.string().regex(profileNamePattern, "Invalid profile name"),
63
65
  description: z.string().default(""),
64
66
  version: z.string().min(1).default("1.0.0"),
@@ -84,7 +86,40 @@ const rawProfileSchema = z.object({
84
86
  .default({ commands: [] }),
85
87
  contextCompression: z.enum(["none", "ocean-bounded"]).default("none"),
86
88
  instructions: z.string().default(""),
89
+ // v3 (T-338): a profile as a domain bundle. Names only, never launch config or secrets.
90
+ kind: z.enum(["role", "domain"]).optional(),
91
+ // The profile this one inherits from; resolved by the loader before validation.
92
+ extends: z
93
+ .string()
94
+ .regex(profileNamePattern, "Invalid profile name")
95
+ .optional(),
96
+ // Words in a prompt or task that point at this profile.
97
+ triggers: bundleList,
98
+ // Repository signals (dependencies, files) that point at this profile.
99
+ signals: bundleList,
100
+ // Ocean gateway members this profile exposes.
101
+ mcp: bundleList,
102
+ // Account connectors (claude.ai) the profile uses; Ocean names them, never toggles them.
103
+ connectors: bundleList,
104
+ // Composio toolkits the profile uses.
105
+ composio: bundleList,
106
+ // Client plugins the profile recommends; enabling a plugin is global to a client.
107
+ plugins: bundleList,
108
+ // T-339: policies summoned with this profile, and Ocean MCP tool groups listed with it.
109
+ policies: bundleList,
110
+ tools: bundleList,
87
111
  });
112
+ const V3_FIELDS = [
113
+ "kind",
114
+ "triggers",
115
+ "signals",
116
+ "mcp",
117
+ "connectors",
118
+ "composio",
119
+ "plugins",
120
+ "policies",
121
+ "tools",
122
+ ];
88
123
  // Schema v2 makes explicit what v1 left to defaults: a default client, a model on every
89
124
  // enabled client, and a closed memory scope.
90
125
  function refineV2(input, context) {
@@ -101,8 +136,18 @@ function refineV2(input, context) {
101
136
  }
102
137
  export const profileSchema = rawProfileSchema
103
138
  .superRefine((input, context) => {
104
- if (input.schemaVersion === 2)
139
+ if (input.schemaVersion >= 2)
105
140
  refineV2(input, context);
141
+ // A bundle field on v1/v2 would be outside the identity hash, so an edit to it could never
142
+ // be detected; it needs v3.
143
+ if (input.schemaVersion < 3)
144
+ for (const field of V3_FIELDS)
145
+ if (input[field] !== undefined)
146
+ context.addIssue({
147
+ code: z.ZodIssueCode.custom,
148
+ path: [field],
149
+ message: `${field} requires schemaVersion 3`,
150
+ });
106
151
  for (const [client, binding] of Object.entries(input.clients)) {
107
152
  if (!providerSchema.safeParse(client).success)
108
153
  context.addIssue({
@@ -209,9 +254,24 @@ export function profileIdentity(profile) {
209
254
  instructions: profile.instructions,
210
255
  // v2-only fields are appended only for v2, so every v1 identity stays what it was and a
211
256
  // v1 session can still be resumed after this release.
212
- ...(profile.schemaVersion === 2
257
+ ...(profile.schemaVersion >= 2
213
258
  ? { schemaVersion: profile.schemaVersion }
214
259
  : {}),
260
+ // v3 bundle fields, likewise only for v3, so a v2 identity is unchanged.
261
+ ...(profile.schemaVersion === 3
262
+ ? {
263
+ kind: profile.kind ?? "role",
264
+ triggers: profile.triggers ?? [],
265
+ signals: profile.signals ?? [],
266
+ mcp: profile.mcp ?? [],
267
+ connectors: profile.connectors ?? [],
268
+ composio: profile.composio ?? [],
269
+ plugins: profile.plugins ?? [],
270
+ // T-339 fields join the identity only when set, so every earlier v3 identity holds.
271
+ ...(profile.policies?.length ? { policies: profile.policies } : {}),
272
+ ...(profile.tools?.length ? { tools: profile.tools } : {}),
273
+ }
274
+ : {}),
215
275
  };
216
276
  return createHash("sha256").update(JSON.stringify(canonical)).digest("hex");
217
277
  }
@@ -23,7 +23,7 @@ export function validateRuntimeConfig(input) {
23
23
  }
24
24
  // Until runtime.json exists the historical default applies, so an install that predates the
25
25
  // file keeps working. Once it exists it is the only source; an explicit --profile wins.
26
- export const LEGACY_DEFAULT_PROFILE = "default";
26
+ const LEGACY_DEFAULT_PROFILE = "default";
27
27
  export function resolveProfileName(explicit, config) {
28
28
  return explicit ?? config?.defaultProfile ?? LEGACY_DEFAULT_PROFILE;
29
29
  }
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  // part of deciding whether one call may run. Filesystem bounds are checked again where the
4
4
  // tool executes, against real paths.
5
5
  const MAX_PATH = 1_024;
6
- export const MAX_WRITE_BYTES = 256 * 1024;
6
+ const MAX_WRITE_BYTES = 256 * 1024;
7
7
  const relativePath = z
8
8
  .string()
9
9
  .min(1)
@@ -53,7 +53,7 @@ const toolSpecs = {
53
53
  };
54
54
  // Read tools always; write only when the run may write; then narrowed by the run contract.
55
55
  // There is no command tool: Ocean cannot confine what a command reads, writes or reaches.
56
- export function offeredTools(plan, limits) {
56
+ function offeredTools(plan, limits) {
57
57
  const tools = ["read_file", "list_directory"];
58
58
  if (!plan.readOnly)
59
59
  tools.push("write_file");
@@ -0,0 +1,53 @@
1
+ // The project a session belongs to is decided once, deterministically, before any model runs
2
+ // (T-330); every record writer reads that decision and none recomputes it. The store's
3
+ // project_id holds the project; this event, appended when the session is created, says how it
4
+ // was decided.
5
+ export const PROJECT_IDENTITY_EVENT = "project_identity";
6
+ export const NO_PROJECT = {
7
+ projectId: "",
8
+ how: "none",
9
+ confidence: "none",
10
+ };
11
+ const HOWS = [
12
+ "explicit",
13
+ "project-folder",
14
+ "path",
15
+ "git-root",
16
+ "claude-project",
17
+ "model",
18
+ ];
19
+ const CONFIDENCES = ["high", "medium", "low"];
20
+ function decisionFrom(data) {
21
+ try {
22
+ const parsed = JSON.parse(data);
23
+ return typeof parsed.projectId === "string" &&
24
+ HOWS.includes(parsed.how ?? "") &&
25
+ CONFIDENCES.includes(parsed.confidence ?? "")
26
+ ? parsed
27
+ : null;
28
+ }
29
+ catch {
30
+ return null;
31
+ }
32
+ }
33
+ // The session's project and task, from the store. An unbound session has project "": never a
34
+ // folder name. A session recorded before the identity event existed got its project from path
35
+ // resolution, so that is how it was decided.
36
+ export function sessionIdentity(session, events = []) {
37
+ const taskId = session.taskId ?? "";
38
+ const projectId = session.projectId ?? "";
39
+ if (!projectId)
40
+ return { ...NO_PROJECT, taskId };
41
+ const recorded = events
42
+ .filter((event) => event.type === PROJECT_IDENTITY_EVENT)
43
+ .map((event) => decisionFrom(event.data))
44
+ .filter((decision) => decision?.projectId === projectId)
45
+ .at(-1);
46
+ return {
47
+ projectId,
48
+ how: recorded?.how ?? "path",
49
+ confidence: recorded?.confidence ?? "high",
50
+ taskId,
51
+ };
52
+ }
53
+ //# sourceMappingURL=session-identity.js.map