@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
@@ -1,533 +0,0 @@
1
- import { mkdir, readdir, readFile, rename, writeFile } from "node:fs/promises";
2
- import path from "node:path";
3
- import { marketplaceIndexSchema } from "@ocean/core/domain/capabilities/capability-manifest.js";
4
- import { engineRoot } from "@ocean/core/shared/paths.js";
5
- import { scanText } from "../security/description-scan.js";
6
- import { engineIndexFile } from "./mcp-connection.js";
7
- import { literalArguments, planMcpLaunch, } from "./mcp-launch.js";
8
- export const GATEWAY_CAPABILITY = "dev.ocean/mcp-gateway";
9
- const errorMessage = (error) => error instanceof Error ? error.message : String(error);
10
- function namespaceFor(capability, taken) {
11
- const clean = (value) => value.toLowerCase().replace(/[^a-z0-9_-]+/g, "_");
12
- const short = clean(capability.split("/").at(-1) ?? capability);
13
- let prefix = taken.has(short) ? clean(capability) : short;
14
- for (let suffix = 2; taken.has(prefix); suffix++)
15
- prefix = `${clean(capability)}-${suffix}`;
16
- taken.add(prefix);
17
- return prefix;
18
- }
19
- const BROWSER = /(^|[^a-z])(browser|chrome|chromium|devtools|playwright|puppeteer|selenium|webdriver)([^a-z]|$)/i;
20
- // Why an installed server is hidden from a client that was not allowed it by name, or nothing.
21
- // Declared file writes count; so does driving a browser, recognised by name, since a browser
22
- // server reads and acts inside every signed-in session whatever it declares.
23
- export function sensitivityOf(installed) {
24
- if (installed.permissions.filesystem.write.length)
25
- return "writes files";
26
- const names = [
27
- installed.capability,
28
- ...(installed.server.packages ?? []).map((item) => String(item.identifier)),
29
- ];
30
- if (names.some((name) => BROWSER.test(name)))
31
- return "controls a browser";
32
- return undefined;
33
- }
34
- export function canSee(access, client, member) {
35
- const rule = client === undefined ? undefined : access.clients[client];
36
- if (rule?.deny?.includes(member.capability))
37
- return false;
38
- if (!member.sensitive)
39
- return true;
40
- return Boolean(rule?.allow?.includes(member.capability) || rule?.allow?.includes("*"));
41
- }
42
- // `ocean clients allow|deny|unset <client> <capability>`: one rule changed, the rest kept.
43
- export async function updateGatewayAccess(file, client, capability, change) {
44
- const access = await readGatewayAccess(file);
45
- const rule = access.clients[client] ?? {};
46
- const without = (list) => (list ?? []).filter((item) => item !== capability);
47
- const next = { allow: without(rule.allow), deny: without(rule.deny) };
48
- if (change === "allow")
49
- next.allow.push(capability);
50
- if (change === "deny")
51
- next.deny.push(capability);
52
- if (next.allow.length || next.deny.length)
53
- access.clients[client] = {
54
- ...(next.allow.length ? { allow: next.allow.sort() } : {}),
55
- ...(next.deny.length ? { deny: next.deny.sort() } : {}),
56
- };
57
- else
58
- delete access.clients[client];
59
- await mkdir(path.dirname(file), { recursive: true });
60
- const temp = `${file}.${process.pid}.tmp`;
61
- await writeFile(temp, `${JSON.stringify(access, null, 2)}\n`);
62
- await rename(temp, file);
63
- return access;
64
- }
65
- export async function readGatewayAccess(file) {
66
- let raw;
67
- try {
68
- raw = JSON.parse(await readFile(file, "utf8"));
69
- }
70
- catch (error) {
71
- if (error.code === "ENOENT")
72
- return { clients: {} };
73
- throw new Error(`Cannot read ${file}: ${errorMessage(error)}`);
74
- }
75
- const clients = isRecord(raw) ? raw.clients : undefined;
76
- const list = (value) => value === undefined ||
77
- (Array.isArray(value) && value.every((item) => typeof item === "string"));
78
- if (!isRecord(clients) ||
79
- !Object.values(clients).every((rule) => isRecord(rule) && list(rule.allow) && list(rule.deny)))
80
- throw new Error(`${file}: expected {"clients": {"<client name>": {"allow": [...], "deny": [...]}}}`);
81
- return raw;
82
- }
83
- // The servers the gateway routes: the engine's first-party ones, then every MCP server installed
84
- // from the marketplace, each planned by the same launcher as `ocean market exec` — declared
85
- // permissions, declared environment only. A third-party server joins only by
86
- // being installed; anything that cannot be launched here is reported, not fatal.
87
- export async function gatewayMembers(options) {
88
- const members = [];
89
- const skipped = [];
90
- const taken = new Set();
91
- const notFirstParty = [];
92
- const firstParty = new Set();
93
- const index = marketplaceIndexSchema.parse(JSON.parse(await readFile(options.indexFile ?? engineIndexFile(), "utf8")));
94
- for (const manifest of index.capabilities) {
95
- if (manifest.kind !== "mcp" || manifest.name === GATEWAY_CAPABILITY)
96
- continue;
97
- const item = manifest.spec.packages?.[0];
98
- if (item?.registryType !== "ocean-engine") {
99
- notFirstParty.push(manifest.name);
100
- continue;
101
- }
102
- firstParty.add(manifest.name);
103
- if (options.firstParty === false)
104
- continue;
105
- members.push({
106
- capability: manifest.name,
107
- prefix: namespaceFor(manifest.name, taken),
108
- command: process.execPath,
109
- args: [
110
- path.join(engineRoot(), "dist", "main.js"),
111
- ...literalArguments(item.packageArguments, `${manifest.name} packageArguments`),
112
- ],
113
- cwd: engineRoot(),
114
- env: {},
115
- inheritEnv: true,
116
- });
117
- }
118
- let files = [];
119
- try {
120
- files = (await readdir(options.serversRoot))
121
- .filter((file) => file.endsWith(".json"))
122
- .sort();
123
- }
124
- catch {
125
- // Nothing installed yet.
126
- }
127
- for (const file of files) {
128
- let installed;
129
- try {
130
- installed = JSON.parse(await readFile(path.join(options.serversRoot, file), "utf8"));
131
- }
132
- catch (error) {
133
- skipped.push({ capability: file, reason: errorMessage(error) });
134
- continue;
135
- }
136
- const name = installed.capability;
137
- // An installed copy of an engine server runs the same code as the member already routed.
138
- if (name === GATEWAY_CAPABILITY ||
139
- firstParty.has(name) ||
140
- members.some((member) => member.capability === name))
141
- continue;
142
- const stateDir = path.join(options.stateRoot, path.basename(file, ".json"));
143
- try {
144
- const launch = planMcpLaunch(installed, {
145
- stateDir,
146
- env: options.env,
147
- secret: (secret) => options.secrets?.get(name, secret),
148
- });
149
- const sensitive = sensitivityOf(installed);
150
- const base = {
151
- capability: name,
152
- prefix: namespaceFor(name, taken),
153
- ...(sensitive ? { sensitive } : {}),
154
- };
155
- if (launch.transport === "remote") {
156
- members.push({
157
- ...base,
158
- transport: "remote",
159
- type: launch.type,
160
- url: launch.url,
161
- ...(Object.keys(launch.headers).length
162
- ? { headers: launch.headers }
163
- : {}),
164
- });
165
- continue;
166
- }
167
- await mkdir(stateDir, { recursive: true });
168
- members.push({
169
- ...base,
170
- command: launch.command,
171
- args: launch.args,
172
- cwd: launch.cwd,
173
- env: launch.env,
174
- inheritEnv: false,
175
- });
176
- }
177
- catch (error) {
178
- skipped.push({ capability: name, reason: errorMessage(error) });
179
- }
180
- }
181
- for (const name of notFirstParty)
182
- if (!members.some((member) => member.capability === name))
183
- skipped.push({
184
- capability: name,
185
- reason: "not first-party; install it from the marketplace to route it through the gateway",
186
- });
187
- return { members, skipped };
188
- }
189
- // Every text a model reads for a tool, resource or prompt: each named field, and each key and
190
- // string nested inside it (a tool's schema property names, titles, enums and defaults included).
191
- function modelTexts(fields) {
192
- const texts = [];
193
- const walk = (value, at) => {
194
- if (typeof value === "string")
195
- texts.push({ at, text: value });
196
- else if (Array.isArray(value))
197
- value.forEach((item, index) => {
198
- walk(item, `${at}[${index}]`);
199
- });
200
- else if (value && typeof value === "object")
201
- for (const [key, item] of Object.entries(value)) {
202
- texts.push({ at: `${at} key`, text: key });
203
- walk(item, `${at}.${key}`);
204
- }
205
- };
206
- for (const [at, value] of Object.entries(fields))
207
- walk(value, at);
208
- return texts;
209
- }
210
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
211
- function withTimeout(promise, ms, what) {
212
- let timer;
213
- return Promise.race([
214
- promise,
215
- new Promise((_, reject) => {
216
- timer = setTimeout(() => reject(new Error(`${what} within ${ms} ms`)), ms);
217
- }),
218
- ]).finally(() => clearTimeout(timer));
219
- }
220
- class GatewayError extends Error {
221
- code;
222
- constructor(code, message) {
223
- super(message);
224
- this.code = code;
225
- }
226
- }
227
- // One MCP endpoint in front of many servers. Tools are exposed as `<prefix>__<tool>`; a tool
228
- // whose texts carry injected instructions is hidden, since clients read them as prompt. The
229
- // gateway adds no authority and removes none: a call reaches its server with the arguments the
230
- // client sent, so the server's own checks (an approval fingerprint, say) decide as they would
231
- // on a direct connection, and the client's permission prompt stays the human gate.
232
- export class McpGateway {
233
- members;
234
- options;
235
- #routes = new Map();
236
- #tools = [];
237
- // Resource URIs are exposed unchanged (a server's own texts point at them), so a URI two
238
- // members both list stays with the first. Prompts are namespaced like tools.
239
- #resourceRoutes = new Map();
240
- #resources = [];
241
- #promptRoutes = new Map();
242
- #prompts = [];
243
- #clients = [];
244
- #started;
245
- // Who is on the other end, from `initialize`; fixed once members start.
246
- #client;
247
- constructor(members, options) {
248
- this.members = members;
249
- this.options = options;
250
- this.#client = options.clientId;
251
- }
252
- // Starts every member at once; one that fails or hangs is left out, never the whole gateway.
253
- start() {
254
- this.#started ??= this.#connectAll();
255
- return this.#started;
256
- }
257
- // Only the members this client may see are started at all: a hidden server never runs and its
258
- // tools never reach the client's context.
259
- async #connectAll() {
260
- const timeoutMs = this.options.timeoutMs ?? 15_000;
261
- const access = this.options.access ?? { clients: {} };
262
- const members = this.members.filter((member) => {
263
- if (canSee(access, this.#client, member))
264
- return true;
265
- this.#log(`${member.capability} hidden from ${this.#client ?? "an unnamed client"}${member.sensitive ? ` (${member.sensitive}; allow it in gateway-access.json)` : " (denied in gateway-access.json)"}`);
266
- return false;
267
- });
268
- const clients = members.map((member) => this.options.client(member));
269
- this.#clients.push(...clients);
270
- const results = await Promise.allSettled(members.map(async (member, index) => {
271
- await withTimeout(clients[index].connect(), timeoutMs, `${member.capability} did not start`);
272
- const tools = await withTimeout(clients[index].listTools(), timeoutMs, `${member.capability} did not list its tools`);
273
- // A member that cannot list resources or prompts keeps its tools.
274
- const optional = async (what, list) => {
275
- if (!list)
276
- return [];
277
- try {
278
- return await withTimeout(list(), timeoutMs, `${member.capability} did not list its ${what}`);
279
- }
280
- catch (error) {
281
- this.#log(`${member.capability} ${what} left out: ${errorMessage(error)}`);
282
- return [];
283
- }
284
- };
285
- const client = clients[index];
286
- const listing = {
287
- tools,
288
- resources: await optional("resources", client.listResources?.bind(client)),
289
- prompts: await optional("prompts", client.listPrompts?.bind(client)),
290
- };
291
- return listing;
292
- }));
293
- results.forEach((result, index) => {
294
- const member = members[index];
295
- if (result.status === "rejected") {
296
- this.#log(`${member.capability} left out: ${errorMessage(result.reason)}`);
297
- clients[index].close();
298
- return;
299
- }
300
- for (const tool of result.value.tools)
301
- this.#expose(member, clients[index], tool);
302
- for (const resource of result.value.resources)
303
- this.#exposeResource(member, clients[index], resource);
304
- for (const prompt of result.value.prompts)
305
- this.#exposePrompt(member, clients[index], prompt);
306
- });
307
- }
308
- // True when a text the model would read carries injected instructions; then it is hidden.
309
- #injected(member, kind, name, fields) {
310
- const findings = modelTexts(fields).flatMap(({ at, text }) => scanText(at, text));
311
- if (!findings.length)
312
- return false;
313
- this.#log(`${member.capability} ${kind} ${name} hidden: ${findings.map((finding) => `${finding.rule} in ${finding.source} ("${finding.excerpt}")`).join("; ")}`);
314
- return true;
315
- }
316
- #exposeResource(member, client, resource) {
317
- if (!isRecord(resource) || typeof resource.uri !== "string")
318
- return;
319
- if (this.#injected(member, "resource", resource.uri, resource))
320
- return;
321
- if (this.#resourceRoutes.has(resource.uri)) {
322
- this.#log(`${member.capability} lists resource ${resource.uri} already routed; kept the first`);
323
- return;
324
- }
325
- this.#resourceRoutes.set(resource.uri, client);
326
- this.#resources.push(resource);
327
- }
328
- #exposePrompt(member, client, prompt) {
329
- if (!isRecord(prompt) || typeof prompt.name !== "string")
330
- return;
331
- if (this.#injected(member, "prompt", prompt.name, prompt))
332
- return;
333
- const name = `${member.prefix}__${prompt.name}`;
334
- if (this.#promptRoutes.has(name)) {
335
- this.#log(`${member.capability} lists prompt ${prompt.name} twice; kept the first`);
336
- return;
337
- }
338
- this.#promptRoutes.set(name, { client, prompt: prompt.name });
339
- this.#prompts.push({ ...prompt, name });
340
- }
341
- #expose(member, client, tool) {
342
- if (this.#injected(member, "tool", tool.name, {
343
- name: tool.name,
344
- description: tool.description,
345
- inputSchema: tool.inputSchema,
346
- }))
347
- return;
348
- const name = `${member.prefix}__${tool.name}`;
349
- if (this.#routes.has(name)) {
350
- this.#log(`${member.capability} lists ${tool.name} twice; kept the first`);
351
- return;
352
- }
353
- this.#routes.set(name, { client, tool: tool.name });
354
- this.#tools.push({ ...tool, name });
355
- }
356
- async tools() {
357
- await this.start();
358
- return [...this.#tools];
359
- }
360
- async call(name, args) {
361
- await this.start();
362
- const route = this.#routes.get(name);
363
- if (!route)
364
- throw new GatewayError(-32602, `Unknown MCP tool: ${name}`);
365
- return route.client.forwardToolCall(route.tool, args);
366
- }
367
- async resources() {
368
- await this.start();
369
- return [...this.#resources];
370
- }
371
- async readResource(uri) {
372
- await this.start();
373
- const client = this.#resourceRoutes.get(uri);
374
- if (!client?.readResource)
375
- throw new GatewayError(-32602, `Unknown MCP resource: ${uri}`);
376
- return client.readResource(uri);
377
- }
378
- async prompts() {
379
- await this.start();
380
- return [...this.#prompts];
381
- }
382
- async getPrompt(name, args) {
383
- await this.start();
384
- const route = this.#promptRoutes.get(name);
385
- if (!route?.client.getPrompt)
386
- throw new GatewayError(-32602, `Unknown MCP prompt: ${name}`);
387
- return route.client.getPrompt(route.prompt, args);
388
- }
389
- async handle(request) {
390
- // MCP 2025-06-18 has no batches; anything but one request object is invalid.
391
- if (!isRecord(request))
392
- return {
393
- jsonrpc: "2.0",
394
- id: null,
395
- error: { code: -32600, message: "Invalid Request" },
396
- };
397
- // Notifications get no answer.
398
- if (request.id === undefined)
399
- return null;
400
- const id = typeof request.id === "string" || typeof request.id === "number"
401
- ? request.id
402
- : null;
403
- return this.#respond(request, id);
404
- }
405
- async #respond(request, id) {
406
- try {
407
- return { jsonrpc: "2.0", id, result: await this.#answer(request) };
408
- }
409
- catch (error) {
410
- return {
411
- jsonrpc: "2.0",
412
- id,
413
- error: {
414
- code: error instanceof GatewayError ? error.code : -32000,
415
- message: errorMessage(error),
416
- },
417
- };
418
- }
419
- }
420
- async #answer(request) {
421
- switch (request.method) {
422
- case "initialize": {
423
- const info = isRecord(request.params)
424
- ? request.params.clientInfo
425
- : undefined;
426
- const named = isRecord(info) && typeof info.name === "string";
427
- if (this.options.clientId)
428
- this.#log(`client: ${this.options.clientId}${named ? ` (says ${String(info.name)})` : ""}`);
429
- else if (!this.#started && named) {
430
- this.#client = String(info.name);
431
- this.#log(`client: ${this.#client}`);
432
- }
433
- // Members start while the client finishes its handshake.
434
- void this.start();
435
- return {
436
- protocolVersion: "2025-06-18",
437
- // Members start after this answer, so resources and prompts are always offered; a
438
- // gateway whose members have none lists them empty, which MCP allows.
439
- capabilities: { tools: {}, resources: {}, prompts: {} },
440
- serverInfo: {
441
- name: this.options.serverName ?? "ocean-gateway",
442
- version: this.options.version ?? "0.0.0",
443
- },
444
- ...(this.#instructions()
445
- ? { instructions: this.options.instructions }
446
- : {}),
447
- };
448
- }
449
- case "ping":
450
- return {};
451
- case "tools/list":
452
- return { tools: await this.tools() };
453
- case "tools/call": {
454
- const params = isRecord(request.params) ? request.params : {};
455
- const args = params.arguments ?? {};
456
- if (typeof params.name !== "string" || !isRecord(args))
457
- throw new GatewayError(-32602, "tools/call needs a tool name and an arguments object");
458
- return this.call(params.name, args);
459
- }
460
- case "resources/list":
461
- return { resources: await this.resources() };
462
- case "resources/read": {
463
- const params = isRecord(request.params) ? request.params : {};
464
- if (typeof params.uri !== "string")
465
- throw new GatewayError(-32602, "resources/read needs a uri");
466
- return this.readResource(params.uri);
467
- }
468
- case "prompts/list":
469
- return { prompts: await this.prompts() };
470
- case "prompts/get": {
471
- const params = isRecord(request.params) ? request.params : {};
472
- const args = params.arguments ?? {};
473
- if (typeof params.name !== "string" || !isRecord(args))
474
- throw new GatewayError(-32602, "prompts/get needs a prompt name and an arguments object");
475
- return this.getPrompt(params.name, args);
476
- }
477
- default:
478
- throw new GatewayError(-32601, `Unsupported MCP method: ${request.method ?? ""}`);
479
- }
480
- }
481
- #instructions() {
482
- const { instructions, instructionsMember } = this.options;
483
- if (!instructions)
484
- return false;
485
- if (!instructionsMember)
486
- return true;
487
- const access = this.options.access ?? { clients: {} };
488
- return this.members.some((member) => member.capability === instructionsMember &&
489
- canSee(access, this.#client, member));
490
- }
491
- close() {
492
- for (const client of this.#clients)
493
- client.close();
494
- }
495
- #log(line) {
496
- this.options.log?.(line);
497
- }
498
- }
499
- // Newline-delimited JSON-RPC over stdio. Requests run concurrently, so a slow tool on one server
500
- // does not hold up another; members are stopped when the client closes the stream.
501
- export async function serveMcpGateway(gateway, input = process.stdin, output = process.stdout) {
502
- let buffer = "";
503
- const write = (response) => {
504
- if (response)
505
- output.write(`${JSON.stringify(response)}\n`);
506
- };
507
- input.setEncoding("utf8");
508
- input.on("data", (chunk) => {
509
- buffer += chunk;
510
- for (let newline = buffer.indexOf("\n"); newline >= 0; newline = buffer.indexOf("\n")) {
511
- const line = buffer.slice(0, newline).trim();
512
- buffer = buffer.slice(newline + 1);
513
- if (!line)
514
- continue;
515
- let request;
516
- try {
517
- request = JSON.parse(line);
518
- }
519
- catch {
520
- write({
521
- jsonrpc: "2.0",
522
- id: null,
523
- error: { code: -32700, message: "Parse error" },
524
- });
525
- continue;
526
- }
527
- void gateway.handle(request).then(write);
528
- }
529
- });
530
- await new Promise((resolve) => input.once("end", resolve));
531
- gateway.close();
532
- }
533
- //# sourceMappingURL=mcp-gateway.js.map
@@ -1,51 +0,0 @@
1
- {
2
- "schemaVersion": 2,
3
- "name": "default",
4
- "description": "General-purpose assistant profile for ad-hoc work across the active workspace.",
5
- "version": "1.0.0",
6
- "role": "general assistant",
7
- "skills": [],
8
- "contextSources": [],
9
- "defaultClient": "claude",
10
- "clients": {
11
- "claude": {
12
- "enabled": true,
13
- "model": "sonnet",
14
- "transport": "cli"
15
- },
16
- "codex": {
17
- "enabled": true,
18
- "transport": "cli",
19
- "model": "provider-managed"
20
- },
21
- "gemini": {
22
- "enabled": true,
23
- "transport": "cli",
24
- "model": "provider-managed"
25
- },
26
- "antigravity": {
27
- "enabled": true,
28
- "transport": "cli",
29
- "model": "provider-managed"
30
- },
31
- "hermes": {
32
- "enabled": true,
33
- "transport": "cli",
34
- "model": "provider-managed"
35
- }
36
- },
37
- "governance": {
38
- "allowedPaths": ["."],
39
- "allowedCommands": [],
40
- "writePolicy": "workspace"
41
- },
42
- "memory": {
43
- "enabled": true,
44
- "scope": "profile"
45
- },
46
- "verification": {
47
- "commands": []
48
- },
49
- "contextCompression": "none",
50
- "instructions": "Handle ad-hoc work carefully. Preserve unrelated changes and report what was verified."
51
- }
@@ -1,51 +0,0 @@
1
- {
2
- "schemaVersion": 2,
3
- "name": "developer",
4
- "description": "Implementation profile: reads and writes within the workspace to build and fix code.",
5
- "version": "1.0.0",
6
- "role": "developer",
7
- "skills": [],
8
- "contextSources": [],
9
- "defaultClient": "claude",
10
- "clients": {
11
- "claude": {
12
- "enabled": true,
13
- "model": "sonnet",
14
- "transport": "cli"
15
- },
16
- "codex": {
17
- "enabled": true,
18
- "transport": "cli",
19
- "model": "provider-managed"
20
- },
21
- "gemini": {
22
- "enabled": true,
23
- "transport": "cli",
24
- "model": "provider-managed"
25
- },
26
- "antigravity": {
27
- "enabled": true,
28
- "transport": "cli",
29
- "model": "provider-managed"
30
- },
31
- "hermes": {
32
- "enabled": true,
33
- "transport": "cli",
34
- "model": "provider-managed"
35
- }
36
- },
37
- "governance": {
38
- "allowedPaths": ["."],
39
- "allowedCommands": [],
40
- "writePolicy": "workspace"
41
- },
42
- "memory": {
43
- "enabled": true,
44
- "scope": "profile"
45
- },
46
- "verification": {
47
- "commands": ["pnpm test"]
48
- },
49
- "contextCompression": "none",
50
- "instructions": "Inspect before editing. Preserve unrelated work. Run focused tests and report proven results."
51
- }
@@ -1,51 +0,0 @@
1
- {
2
- "schemaVersion": 2,
3
- "name": "reviewer",
4
- "description": "Read-only profile: reviews changes and reports findings without writing to the workspace.",
5
- "version": "1.0.0",
6
- "role": "code reviewer",
7
- "skills": [],
8
- "contextSources": [],
9
- "defaultClient": "claude",
10
- "clients": {
11
- "claude": {
12
- "enabled": true,
13
- "model": "sonnet",
14
- "transport": "cli"
15
- },
16
- "codex": {
17
- "enabled": true,
18
- "transport": "cli",
19
- "model": "provider-managed"
20
- },
21
- "gemini": {
22
- "enabled": true,
23
- "transport": "cli",
24
- "model": "provider-managed"
25
- },
26
- "antigravity": {
27
- "enabled": true,
28
- "transport": "cli",
29
- "model": "provider-managed"
30
- },
31
- "hermes": {
32
- "enabled": true,
33
- "transport": "cli",
34
- "model": "provider-managed"
35
- }
36
- },
37
- "governance": {
38
- "allowedPaths": ["."],
39
- "allowedCommands": [],
40
- "writePolicy": "none"
41
- },
42
- "memory": {
43
- "enabled": true,
44
- "scope": "profile"
45
- },
46
- "verification": {
47
- "commands": []
48
- },
49
- "contextCompression": "none",
50
- "instructions": "Review changes without editing files. Separate findings from assumptions and identify missing evidence."
51
- }