@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.
- package/README.md +46 -53
- package/dist/application/clients/bundles.js +1 -1
- package/dist/application/clients/client-detect.js +291 -0
- package/dist/application/clients/clients.js +104 -25
- package/dist/application/clients/desktop-link.js +40 -0
- package/dist/application/clients/desktop-watcher.js +6 -4
- package/dist/application/clients/hook-trust.js +106 -0
- package/dist/application/clients/hooks.js +7 -1
- package/dist/application/clients/mcp-schema-cost.js +74 -0
- package/dist/application/clients/native.js +38 -2
- package/dist/application/clients/registry.js +51 -9
- package/dist/application/clients/status.js +7 -2
- package/dist/application/gateway/webhook-gateway.js +1 -1
- package/dist/application/integrations/charter-copies.js +1 -1
- package/dist/application/integrations/engine-entry-repair.js +4 -3
- package/dist/application/integrations/skill-auto-sync.js +2 -2
- package/dist/application/integrations/skill-filter.js +1 -1
- package/dist/application/integrations/skill-router.js +134 -90
- package/dist/application/layout/layout-apply.js +1 -1
- package/dist/application/layout/workspace-template.js +1 -1
- package/dist/application/onboarding/steps.js +121 -30
- package/dist/application/profiles/profile-doctor.js +118 -0
- package/dist/application/profiles/profile-migration-service.js +208 -0
- package/dist/application/profiles/profile-suggestion.js +3 -7
- package/dist/application/profiles/profile-upgrade-service.js +98 -86
- package/dist/application/pull/history-index.js +1 -1
- package/dist/application/pull/project-match.js +3 -3
- package/dist/application/pull/pull.js +1 -1
- package/dist/application/pull/server-capture.js +92 -9
- package/dist/application/scheduler/local-scheduler.js +2 -2
- package/dist/application/spend/claude-prices.js +55 -0
- package/dist/application/spend/claude-spend.js +365 -0
- package/dist/application/uninstall/uninstall.js +25 -3
- package/dist/application/upkeep/nightly-upkeep.js +4 -4
- package/dist/composition/runtime.js +2 -2
- package/dist/infrastructure/desktop/claude-export.js +1 -1
- package/dist/infrastructure/desktop/desktop-chat.js +60 -13
- package/dist/infrastructure/desktop/indexeddb.js +4 -4
- package/dist/infrastructure/desktop/leveldb.js +2 -2
- package/dist/infrastructure/filesystem/profile-loader.js +3 -45
- package/dist/infrastructure/filesystem/runtime-config-loader.js +1 -1
- package/dist/infrastructure/observability/runtime-logger.js +1 -1
- package/dist/infrastructure/process/agent-tool-executor.js +3 -3
- package/dist/infrastructure/process/process-supervisor.js +1 -1
- package/dist/infrastructure/process/service.js +8 -8
- package/dist/infrastructure/providers/openai-compatible.js +2 -2
- package/dist/infrastructure/providers/provider-invocation.js +1 -1
- package/dist/infrastructure/providers/session-facts-completer.js +78 -5
- package/dist/interfaces/cli/auth-command.js +2 -2
- package/dist/interfaces/cli/brief-command.js +1 -1
- package/dist/interfaces/cli/browser-command.js +6 -6
- package/dist/interfaces/cli/browser-findings.js +6 -9
- package/dist/interfaces/cli/browser-settings.js +10 -10
- package/dist/interfaces/cli/capture-command.js +6 -6
- package/dist/interfaces/cli/client-test-command.js +3 -3
- package/dist/interfaces/cli/clients-command.js +33 -6
- package/dist/interfaces/cli/command-aliases.js +56 -0
- package/dist/interfaces/cli/command-registry.js +48 -1414
- package/dist/interfaces/cli/commands/browser.js +5 -0
- package/dist/interfaces/cli/commands/capture.js +19 -0
- package/dist/interfaces/cli/commands/catalog.js +9 -0
- package/dist/interfaces/cli/commands/client.js +135 -0
- package/dist/interfaces/cli/commands/clients.js +33 -0
- package/dist/interfaces/cli/commands/connectors.js +14 -0
- package/dist/interfaces/cli/commands/context.js +9 -0
- package/dist/interfaces/cli/commands/cost.js +15 -0
- package/dist/interfaces/cli/commands/daily.js +11 -0
- package/dist/interfaces/cli/commands/day.js +25 -0
- package/dist/interfaces/cli/commands/dispatch.js +31 -0
- package/dist/interfaces/cli/commands/doctor.js +60 -0
- package/dist/interfaces/cli/commands/env.js +5 -0
- package/dist/interfaces/cli/commands/gateway.js +16 -0
- package/dist/interfaces/cli/commands/handoff.js +11 -0
- package/dist/interfaces/cli/commands/health.js +17 -0
- package/dist/interfaces/cli/commands/hook.js +142 -0
- package/dist/interfaces/cli/commands/idea.js +11 -0
- package/dist/interfaces/cli/commands/install.js +31 -0
- package/dist/interfaces/cli/commands/intent.js +14 -0
- package/dist/interfaces/cli/commands/intercept.js +22 -0
- package/dist/interfaces/cli/commands/layout.js +11 -0
- package/dist/interfaces/cli/commands/lifecycle.js +5 -0
- package/dist/interfaces/cli/commands/loop.js +73 -0
- package/dist/interfaces/cli/commands/market.js +11 -0
- package/dist/interfaces/cli/commands/mcp.js +57 -0
- package/dist/interfaces/cli/commands/memory.js +5 -0
- package/dist/interfaces/cli/commands/migrate.js +5 -0
- package/dist/interfaces/cli/commands/observe.js +11 -0
- package/dist/interfaces/cli/commands/obsidian.js +111 -0
- package/dist/interfaces/cli/commands/operate.js +7 -0
- package/dist/interfaces/cli/commands/policy.js +16 -0
- package/dist/interfaces/cli/commands/project.js +207 -0
- package/dist/interfaces/cli/commands/repair.js +20 -0
- package/dist/interfaces/cli/commands/run.js +52 -0
- package/dist/interfaces/cli/commands/schedule.js +58 -0
- package/dist/interfaces/cli/commands/service.js +21 -0
- package/dist/interfaces/cli/commands/session.js +182 -0
- package/dist/interfaces/cli/commands/sessions.js +12 -0
- package/dist/interfaces/cli/commands/setup.js +21 -0
- package/dist/interfaces/cli/commands/skill.js +159 -0
- package/dist/interfaces/cli/commands/tasks.js +10 -0
- package/dist/interfaces/cli/commands/update-remove.js +25 -0
- package/dist/interfaces/cli/connectors-command.js +150 -0
- package/dist/interfaces/cli/context-command.js +39 -3
- package/dist/interfaces/cli/cost-command.js +104 -0
- package/dist/interfaces/cli/curator-command.js +1 -1
- package/dist/interfaces/cli/daily-command.js +7 -1
- package/dist/interfaces/cli/desktop-command.js +43 -7
- package/dist/interfaces/cli/distill-command.js +7 -2
- package/dist/interfaces/cli/express-command.js +1 -1
- package/dist/interfaces/cli/failures-command.js +4 -4
- package/dist/interfaces/cli/gateway-findings.js +2 -2
- package/dist/interfaces/cli/governance-command.js +23 -16
- package/dist/interfaces/cli/handoff-command.js +1 -1
- package/dist/interfaces/cli/harvest-command.js +2 -2
- package/dist/interfaces/cli/help-command.js +53 -169
- package/dist/interfaces/cli/hygiene-command.js +1 -1
- package/dist/interfaces/cli/idea-command.js +1 -1
- package/dist/interfaces/cli/intercept-command.js +8 -7
- package/dist/interfaces/cli/interests-command.js +1 -1
- package/dist/interfaces/cli/layout-command.js +2 -0
- package/dist/interfaces/cli/market-command.js +9 -9
- package/dist/interfaces/cli/mcp-gateway-command.js +124 -7
- package/dist/interfaces/cli/mcp-probe-command.js +186 -0
- package/dist/interfaces/cli/mcp-status-command.js +5 -5
- package/dist/interfaces/cli/memory-command.js +41 -7
- package/dist/interfaces/cli/migrate-command.js +2 -2
- package/dist/interfaces/cli/note-command.js +1 -1
- package/dist/interfaces/cli/onboard-command.js +14 -0
- package/dist/interfaces/cli/operate-command.js +5 -5
- package/dist/interfaces/cli/profiles-command.js +61 -1
- package/dist/interfaces/cli/rhythm-command.js +11 -5
- package/dist/interfaces/cli/running-server-findings.js +1 -1
- package/dist/interfaces/cli/scorecard-command.js +8 -8
- package/dist/interfaces/cli/session-facts-command.js +2 -2
- package/dist/interfaces/cli/sessions-command.js +145 -0
- package/dist/interfaces/cli/setup-command.js +15 -2
- package/dist/interfaces/cli/tasks-command.js +63 -13
- package/dist/interfaces/cli/telemetry-command.js +4 -4
- package/dist/interfaces/cli/uninstall-command.js +1 -1
- package/dist/interfaces/cli/week-failures.js +32 -0
- package/dist/main.js +12 -0
- package/node_modules/@ocean/brain/dist/{infrastructure/brain/brain-index.js → brain-index.js} +2 -2
- package/node_modules/@ocean/brain/dist/{brain/brain-markdown.js → brain-markdown.js} +1 -1
- package/node_modules/@ocean/brain/dist/{brain/brain-service.js → brain-service.js} +12 -2
- package/node_modules/@ocean/brain/dist/memory/brain-dump.js +92 -16
- package/node_modules/@ocean/brain/dist/memory/extraction-log.js +125 -0
- package/node_modules/@ocean/brain/dist/memory/extraction-retry.js +54 -0
- package/node_modules/@ocean/brain/dist/memory/fact-routing.js +44 -1
- package/node_modules/@ocean/brain/dist/memory/lesson-activation.js +2 -2
- package/node_modules/@ocean/brain/dist/memory/lesson-learning.js +2 -2
- package/node_modules/@ocean/brain/dist/memory/lessons.js +1 -1
- package/node_modules/@ocean/brain/dist/memory/memory-audit.js +2 -2
- package/node_modules/@ocean/brain/dist/memory/memory-harvest.js +1 -1
- package/node_modules/@ocean/brain/dist/memory/memory-paths.js +8 -0
- package/node_modules/@ocean/brain/dist/memory/memory-review.js +31 -3
- package/node_modules/@ocean/brain/dist/memory/memory-trash.js +29 -0
- package/node_modules/@ocean/brain/dist/memory/memory-write.js +4 -2
- package/node_modules/@ocean/brain/dist/memory/model-narrative.js +2 -2
- package/node_modules/@ocean/brain/dist/memory/profile-facts.js +1 -1
- package/node_modules/@ocean/brain/dist/memory/routing.json +6 -6
- package/node_modules/@ocean/{market/dist/skills → brain/dist/memory}/signal-detection.js +1 -1
- package/node_modules/@ocean/brain/dist/{memory → people}/people.js +1 -1
- package/node_modules/@ocean/brain/dist/sessions-capture/session-facts.js +625 -0
- package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-promotion.js +7 -15
- package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-summary.js +1 -1
- package/node_modules/@ocean/brain/dist/sessions-capture/session-triage.js +52 -0
- package/node_modules/@ocean/brain/package.json +1 -1
- package/node_modules/@ocean/connect/dist/connectors/connector-hub.js +173 -0
- package/node_modules/@ocean/{market → connect}/dist/install/default-marketplace.js +6 -2
- package/node_modules/@ocean/{market → connect}/dist/install/marketplace-service.js +1 -1
- package/node_modules/@ocean/connect/dist/mcp/mcp-gateway.js +987 -0
- package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-launch.js +102 -5
- package/node_modules/@ocean/{market → connect}/dist/registry/official-registry.js +1 -1
- package/node_modules/@ocean/{market → connect}/dist/security/permissions.js +1 -1
- package/node_modules/@ocean/{market → connect}/dist/skills/skill-hub.js +104 -6
- package/node_modules/@ocean/{market → connect}/package.json +2 -2
- package/node_modules/@ocean/context/dist/{context/context-ladder.js → context-ladder.js} +3 -3
- package/node_modules/@ocean/context/dist/{context/context-references.js → context-references.js} +5 -4
- package/node_modules/@ocean/context/dist/{context/context-cost.js → context-size.js} +6 -6
- package/node_modules/@ocean/context/dist/{context/intent-router.js → intent-router.js} +1 -1
- package/node_modules/@ocean/context/dist/{context/resource-injection.js → resource-injection.js} +3 -1
- package/node_modules/@ocean/context/package.json +1 -1
- package/node_modules/@ocean/core/dist/domain/brain/brain-record.js +1 -1
- package/node_modules/@ocean/core/dist/domain/capabilities/capability-manifest.js +5 -5
- package/node_modules/@ocean/core/dist/domain/connector-entry.js +86 -0
- package/node_modules/@ocean/core/dist/domain/context/context.js +1 -1
- package/node_modules/@ocean/core/dist/domain/context/project-id.js +8 -2
- package/node_modules/@ocean/core/dist/domain/{evidence/evidence.js → evidence.js} +1 -1
- package/node_modules/@ocean/core/dist/domain/mcp/memory-contract.js +4 -1
- package/node_modules/@ocean/core/dist/domain/ports/brain-index-port.js +1 -1
- package/node_modules/@ocean/core/dist/domain/profiles/profile-markdown.js +40 -0
- package/node_modules/@ocean/core/dist/domain/profiles/profile-resolution.js +276 -0
- package/node_modules/@ocean/core/dist/domain/profiles/profile-selection.js +23 -60
- package/node_modules/@ocean/core/dist/domain/profiles/profile-upgrade.js +2 -2
- package/node_modules/@ocean/core/dist/domain/profiles/profile.js +66 -6
- package/node_modules/@ocean/core/dist/domain/profiles/runtime-config.js +1 -1
- package/node_modules/@ocean/core/dist/domain/runs/agent-tools.js +2 -2
- package/node_modules/@ocean/core/dist/domain/sessions/session-identity.js +53 -0
- package/node_modules/@ocean/core/dist/domain/sessions/session-metadata.js +208 -0
- package/node_modules/@ocean/core/dist/domain/{tasks/task-id.js → task-id.js} +2 -2
- package/node_modules/@ocean/core/dist/profiles/profile-files.js +57 -0
- package/node_modules/@ocean/core/dist/profiles/profile-loader.js +97 -0
- package/node_modules/@ocean/core/dist/profiles/project-profile-fill.js +33 -0
- package/node_modules/@ocean/core/dist/profiles/session-profile.js +158 -0
- package/node_modules/@ocean/core/dist/shared/charter.js +110 -0
- package/node_modules/@ocean/core/dist/shared/context-ack.js +1 -1
- package/node_modules/@ocean/core/dist/shared/context-triggers.js +67 -0
- package/node_modules/@ocean/core/dist/shared/paths.js +6 -6
- package/node_modules/@ocean/core/dist/shared/project-legacy.js +232 -0
- package/node_modules/@ocean/core/dist/shared/project-manifest.js +308 -0
- package/node_modules/@ocean/core/dist/shared/project-names.js +87 -0
- package/node_modules/@ocean/core/dist/shared/project-register.js +560 -0
- package/node_modules/@ocean/core/dist/shared/project-resolution.js +83 -861
- package/node_modules/@ocean/core/dist/shared/repo-signals.js +45 -0
- package/node_modules/@ocean/core/dist/shared/task-reference.js +1 -1
- package/node_modules/@ocean/core/dist/shared/text-tokens.js +37 -0
- package/node_modules/@ocean/core/dist/shared/tool-groups.js +224 -0
- package/node_modules/@ocean/core/package.json +4 -1
- package/node_modules/@ocean/services/dist/day/day.js +45 -3
- package/node_modules/@ocean/services/dist/{distill → day}/distill.js +29 -3
- package/node_modules/@ocean/services/dist/{harvest → day}/harvest.js +54 -14
- package/node_modules/@ocean/services/dist/{brief → day}/interest-discovery.js +3 -3
- package/node_modules/@ocean/services/dist/day/note.js +2 -2
- package/node_modules/@ocean/services/dist/{onboarding → day}/onboarding.js +1 -1
- package/node_modules/@ocean/services/dist/day/patterns.js +68 -0
- package/node_modules/@ocean/services/dist/{curator → health}/curator.js +5 -5
- package/node_modules/@ocean/services/dist/{journey → health}/failures.js +7 -5
- package/node_modules/@ocean/services/dist/{hygiene → health}/hygiene.js +2 -2
- package/node_modules/@ocean/services/dist/{journey → health}/lesson-effect.js +1 -1
- package/node_modules/@ocean/services/dist/{scorecard → health}/scorecard.js +3 -3
- package/node_modules/@ocean/services/dist/{upkeep → health}/upkeep.js +2 -2
- package/node_modules/@ocean/services/dist/{doctor → health}/workspace-doctor.js +57 -17
- package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-session.js +1 -1
- package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/call-ledger.js +3 -0
- package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-client.js +19 -3
- package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/obsidian-server.js +4 -4
- package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/ocean-server.js +423 -34
- package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/conflict-log.js +1 -1
- package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/folder-templates.js +8 -5
- package/node_modules/@ocean/services/dist/projects/project-doctor.js +173 -0
- package/node_modules/@ocean/services/dist/projects/project-snippet.js +9 -0
- package/node_modules/@ocean/services/dist/projects/projects-overview.js +2 -2
- package/node_modules/@ocean/services/package.json +1 -1
- package/node_modules/@ocean/{loop/dist/loops → work/dist/runs}/guard-runtime.js +3 -3
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/memory-knowledge-operations.js +4 -12
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-contract.js +2 -2
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/project-operations.js +2 -1
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/task-operations.js +4 -4
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/write-guard.js +1 -1
- package/node_modules/@ocean/{loop → work}/dist/runs/prompt-assembly.js +2 -2
- package/node_modules/@ocean/{loop → work}/dist/runs/run-agent.js +4 -4
- package/node_modules/@ocean/{loop → work}/dist/runs/tool-loop.js +4 -4
- package/node_modules/@ocean/work/dist/sessions/hooks/desktop-facts.js +309 -0
- package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-end-hook.js +36 -5
- package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-facts-hook.js +144 -14
- package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-start-hook.js +129 -12
- package/node_modules/@ocean/work/dist/sessions/hooks/start-brief.js +110 -0
- package/node_modules/@ocean/work/dist/sessions/hooks/unlinked-warning.js +68 -0
- package/node_modules/@ocean/{loop → work}/dist/sessions/session-closeout.js +4 -4
- package/node_modules/@ocean/{loop → work}/dist/sessions/session-projects.js +13 -3
- package/node_modules/@ocean/work/dist/sessions/session-relink.js +300 -0
- package/node_modules/@ocean/{loop → work}/dist/sessions/session-retention.js +1 -1
- package/node_modules/@ocean/{loop → work}/dist/tasks/list-tasks.js +7 -2
- package/node_modules/@ocean/{loop → work}/dist/tasks/renumber-tasks.js +4 -2
- package/node_modules/@ocean/{loop → work}/dist/tasks/session-task.js +2 -2
- package/node_modules/@ocean/{loop → work}/dist/tasks/sync-task-prs.js +77 -7
- package/node_modules/@ocean/work/dist/tasks/task-git.js +63 -0
- package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop.js +4 -4
- package/node_modules/@ocean/{loop → work}/dist/tasks/verification-readiness.js +1 -1
- package/node_modules/@ocean/{loop → work}/dist/tasks/verify-task.js +1 -1
- package/node_modules/@ocean/{loop → work}/package.json +2 -2
- package/ocean-marketplace.json +41 -41
- package/package.json +12 -11
- package/skills/core/daily-harvest/SKILL.md +1 -1
- package/skills/core/ocean-memory/SKILL.md +4 -0
- package/skills/core/use-browser/SKILL.md +30 -7
- package/skills/index.json +1 -1
- package/templates/profiles/default.md +44 -0
- package/templates/profiles/developer.md +45 -0
- package/templates/profiles/reviewer.md +44 -0
- package/templates/profiles/strategist.md +44 -0
- package/templates/profiles-v3/analysis.md +16 -0
- package/templates/profiles-v3/backend.md +16 -0
- package/templates/profiles-v3/base.md +57 -0
- package/templates/profiles-v3/code-review.md +16 -0
- package/templates/profiles-v3/devops.md +16 -0
- package/templates/profiles-v3/docs-office.md +16 -0
- package/templates/profiles-v3/frontend.md +16 -0
- package/templates/profiles-v3/learning.md +16 -0
- package/templates/profiles-v3/marketing-ads.md +16 -0
- package/templates/profiles-v3/marketing-content-seo.md +16 -0
- package/templates/profiles-v3/ocean-ops.md +16 -0
- package/templates/profiles-v3/product-strategy.md +16 -0
- package/templates/profiles-v3/qa-testing.md +16 -0
- package/templates/profiles-v3/security.md +16 -0
- package/templates/workspace/MANIFEST.json +1 -0
- package/templates/workspace/charter/core.md +22 -90
- package/templates/workspace/charter/policies/README.md +7 -1
- package/templates/workspace/charter/policies/claude-code-context.md +6 -1
- package/templates/workspace/charter/policies/concise-output.md +5 -0
- package/templates/workspace/charter/policies/context.md +5 -0
- package/templates/workspace/charter/policies/contracts/task.md +2 -2
- package/templates/workspace/charter/policies/git.md +5 -0
- package/templates/workspace/charter/policies/graph.md +6 -1
- package/templates/workspace/charter/policies/knowledge.md +11 -4
- package/templates/workspace/charter/policies/layout.md +23 -0
- package/templates/workspace/charter/policies/lifecycle.md +5 -0
- package/templates/workspace/charter/policies/memory.md +5 -0
- package/templates/workspace/charter/policies/minimal-change.md +5 -0
- package/templates/workspace/charter/policies/models.md +5 -0
- package/templates/workspace/charter/policies/response.md +5 -0
- package/templates/workspace/charter/policies/skill-observer.md +12 -0
- package/templates/workspace/charter/policies/stack.md +5 -0
- package/templates/workspace/charter/policies/task.md +17 -3
- package/templates/workspace/charter/policies/verification.md +5 -0
- package/node_modules/@ocean/brain/dist/evidence/verification-report.js +0 -13
- package/node_modules/@ocean/brain/dist/memory/daily-narrative.js +0 -142
- package/node_modules/@ocean/brain/dist/memory/session-facts.js +0 -283
- package/node_modules/@ocean/context/dist/context/context-compression.js +0 -66
- package/node_modules/@ocean/loop/dist/hooks/desktop-facts.js +0 -174
- package/node_modules/@ocean/loop/dist/operations/task-linker.js +0 -40
- package/node_modules/@ocean/loop/dist/sessions/session-pointer.js +0 -133
- package/node_modules/@ocean/loop/dist/tasks/task-git.js +0 -28
- package/node_modules/@ocean/market/dist/mcp/mcp-gateway.js +0 -533
- package/templates/profiles/default.json +0 -51
- package/templates/profiles/developer.json +0 -51
- package/templates/profiles/reviewer.json +0 -51
- package/templates/profiles/strategist.json +0 -51
- /package/node_modules/@ocean/brain/dist/{brain/brain-eval.js → brain-eval.js} +0 -0
- /package/node_modules/@ocean/brain/dist/{brain/brain-reindex.js → brain-reindex.js} +0 -0
- /package/node_modules/@ocean/brain/dist/{capture → sessions-capture}/inbox-sync.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/adapters/mcp-adapter.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/adapters/owned-directory.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/adapters/plugin-adapter.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/adapters/skill-adapter.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/capability/adapter.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/capability/catalog.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/capability/content-digest.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/capability/registry.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/install/lock.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/install/own-server.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/mcp/chrome-debugging.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-connection.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-runner.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/security/description-scan.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/security/secrets.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/skills/core-skill-sync.js +0 -0
- /package/node_modules/@ocean/context/dist/{context/context-packet.js → context-packet.js} +0 -0
- /package/node_modules/@ocean/core/dist/domain/{process/process-events.js → process-events.js} +0 -0
- /package/node_modules/@ocean/core/dist/domain/{redaction/redaction.js → redaction.js} +0 -0
- /package/node_modules/@ocean/services/dist/{brief → day}/brief.js +0 -0
- /package/node_modules/@ocean/services/dist/{express → day}/express.js +0 -0
- /package/node_modules/@ocean/services/dist/{brief → day}/source-registry.json +0 -0
- /package/node_modules/@ocean/services/dist/{journey → health}/telemetry.js +0 -0
- /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-service.js +0 -0
- /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-task-runner.js +0 -0
- /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-session.js +0 -0
- /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/server-version.js +0 -0
- /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/tool-registry.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/inbox-promotion.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-discovery.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-ingestion.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-sync.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-writer.js +0 -0
- /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-scope.js +0 -0
- /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-io.js +0 -0
- /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-operations.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/runs/run-authorization.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/runs/session-tokens.js +0 -0
- /package/node_modules/@ocean/{loop/dist/handoff → work/dist/sessions}/handoff-service.js +0 -0
- /package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/lifecycle-hooks.js +0 -0
- /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-store.js +0 -0
- /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-validator.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/archive-tasks.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/checkpoint-task.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/claim-task.js +0 -0
- /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/iteration-graph.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/new-task.js +0 -0
- /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop-record.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/task-verification.js +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { createHash, randomBytes } from "node:crypto";
|
|
3
3
|
import { accessSync, constants, existsSync, readdirSync, readFileSync, realpathSync, } from "node:fs";
|
|
4
|
-
import { appendFile, mkdir, readFile } from "node:fs/promises";
|
|
4
|
+
import { appendFile, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { clientJournalFile } from "@ocean/brain/memory/memory-paths.js";
|
|
8
|
-
import {
|
|
8
|
+
import { marketplacePaths } from "@ocean/connect/install/default-marketplace.js";
|
|
9
|
+
import { SELF_CHECK_CLIENT } from "@ocean/core/domain/mcp/memory-contract.js";
|
|
10
|
+
import { containsKnownSecret } from "@ocean/core/domain/redaction.js";
|
|
9
11
|
import { atomicWrite, withFileLock } from "@ocean/core/shared/fs-utils.js";
|
|
10
12
|
import { liveEngineEntry, oceanPath, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
|
|
11
|
-
import { marketplacePaths } from "@ocean/market/install/default-marketplace.js";
|
|
12
13
|
import { ENTRY_KEYS, ManualEdit, } from "./editors.js";
|
|
13
14
|
import { CLIENT_ADAPTERS, mcpClientOf, } from "./registry.js";
|
|
14
15
|
// Keys Ocean already manages for its own servers; a marketplace server never takes one.
|
|
@@ -394,12 +395,7 @@ function stateFile() {
|
|
|
394
395
|
// How far a client's use of Ocean is proven (T-307). Only `in-app` — the client's model searched
|
|
395
396
|
// Ocean during normal use and cited the record — counts as done; `blocked` names why that check
|
|
396
397
|
// cannot run yet. A confirmation recorded before labels existed has none and proves nothing.
|
|
397
|
-
|
|
398
|
-
"in-app",
|
|
399
|
-
"headless",
|
|
400
|
-
"connected",
|
|
401
|
-
"blocked",
|
|
402
|
-
];
|
|
398
|
+
const EVIDENCE_LABELS = ["in-app", "headless", "connected", "blocked"];
|
|
403
399
|
export async function readClientState() {
|
|
404
400
|
const text = await readText(stateFile());
|
|
405
401
|
const parsed = text ? JSON.parse(text) : {};
|
|
@@ -514,8 +510,52 @@ export const newBatch = () => `${new Date()
|
|
|
514
510
|
.toISOString()
|
|
515
511
|
.replace(/[-:TZ]/g, "")
|
|
516
512
|
.slice(0, 14)}-${randomBytes(4).toString("hex")}`;
|
|
513
|
+
// The whole file as it was before a batch first touched it (T-328 P5): `<file>.ocean-backup-<batch>`,
|
|
514
|
+
// next to the original, readable by the owner only. The journal keeps a value only when it is
|
|
515
|
+
// Ocean-shaped and holds no secret; this copy is what brings back anything else.
|
|
516
|
+
export const backupPath = (file, batch) => `${file}.ocean-backup-${batch}`;
|
|
517
|
+
async function writeBackup(file, text, batch) {
|
|
518
|
+
try {
|
|
519
|
+
await writeFile(backupPath(file, batch), text, { flag: "wx", mode: 0o600 });
|
|
520
|
+
}
|
|
521
|
+
catch (error) {
|
|
522
|
+
// A batch edits one file several times; the first copy is the original.
|
|
523
|
+
if (error.code !== "EEXIST")
|
|
524
|
+
throw error;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
// The value `key` held in the batch's backup of `file`, only when it hashes to `beforeSha`, so
|
|
528
|
+
// a backup the owner edited since never restores something else.
|
|
529
|
+
async function backupValue(file, batch, key, beforeSha, servers) {
|
|
530
|
+
const text = await readText(backupPath(file, batch));
|
|
531
|
+
const value = text === null ? undefined : servers(text)?.get(key);
|
|
532
|
+
return value && sha(JSON.stringify(value)) === beforeSha ? value : null;
|
|
533
|
+
}
|
|
534
|
+
// Removes the backups of the given batches, except those of files a conflict kept: their
|
|
535
|
+
// copy is the owner's way back. Returns the paths removed and the ones kept.
|
|
536
|
+
export async function removeBackups(home, journal, keepClients = new Set()) {
|
|
537
|
+
const removed = [];
|
|
538
|
+
const kept = [];
|
|
539
|
+
const seen = new Set();
|
|
540
|
+
for (const entry of journal) {
|
|
541
|
+
if (entry.restoreOf)
|
|
542
|
+
continue;
|
|
543
|
+
const file = backupPath(path.join(home, entry.file), entry.batch);
|
|
544
|
+
if (seen.has(file) || !existsSync(file))
|
|
545
|
+
continue;
|
|
546
|
+
seen.add(file);
|
|
547
|
+
if (keepClients.has(entry.client))
|
|
548
|
+
kept.push(file);
|
|
549
|
+
else {
|
|
550
|
+
await rm(file, { force: true });
|
|
551
|
+
removed.push(file);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return { removed, kept: kept.filter((file) => existsSync(file)) };
|
|
555
|
+
}
|
|
517
556
|
// Writes one client file: re-reads it right before the rename and recomputes when it changed
|
|
518
|
-
// meanwhile, so an edit the user (or the client) made in between is never overwritten.
|
|
557
|
+
// meanwhile, so an edit the user (or the client) made in between is never overwritten. Before
|
|
558
|
+
// the first write of a batch (not an undo) the file is copied whole to its backup.
|
|
519
559
|
// Exported for its test only.
|
|
520
560
|
export async function edit(file, change, batch) {
|
|
521
561
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
@@ -527,6 +567,8 @@ export async function edit(file, change, batch) {
|
|
|
527
567
|
const outcome = await withFileLock(file, async () => {
|
|
528
568
|
if ((await readText(file)) !== text)
|
|
529
569
|
return "retry";
|
|
570
|
+
if (text !== null && result.entries.some((entry) => !entry.restoreOf))
|
|
571
|
+
await writeBackup(file, text, batch);
|
|
530
572
|
await atomicWrite(file, result.next, text === null ? 0o600 : undefined);
|
|
531
573
|
return "written";
|
|
532
574
|
});
|
|
@@ -621,6 +663,15 @@ export async function restoreClients(options = {}) {
|
|
|
621
663
|
if (!adapter?.config)
|
|
622
664
|
continue;
|
|
623
665
|
const config = adapter.config;
|
|
666
|
+
// A value the journal kept only as a hash comes back from the batch's backup.
|
|
667
|
+
const original = new Map();
|
|
668
|
+
for (const entry of entries.filter((item) => item.file === file)) {
|
|
669
|
+
if (entry.before || !entry.beforeSha)
|
|
670
|
+
continue;
|
|
671
|
+
const value = await backupValue(path.join(env.home, file), batch, entry.key, entry.beforeSha, (text) => config.editor.servers(text));
|
|
672
|
+
if (value)
|
|
673
|
+
original.set(entry.key, value);
|
|
674
|
+
}
|
|
624
675
|
// Collected per attempt: edit() may run the change again when the file moved under it.
|
|
625
676
|
let fileRestored = [];
|
|
626
677
|
let fileConflicts = [];
|
|
@@ -656,20 +707,22 @@ export async function restoreClients(options = {}) {
|
|
|
656
707
|
conflicts.push(label);
|
|
657
708
|
continue;
|
|
658
709
|
}
|
|
659
|
-
|
|
660
|
-
|
|
710
|
+
const before = entry.before ?? original.get(entry.key);
|
|
711
|
+
if (before)
|
|
712
|
+
queue({ kind: "set", key: entry.key, value: before });
|
|
661
713
|
else
|
|
662
714
|
queue({ kind: "remove", key: entry.key });
|
|
663
|
-
restored.push(entry.beforeSha
|
|
715
|
+
restored.push(entry.beforeSha && !before
|
|
664
716
|
? `${label} (removed; original not stored)`
|
|
665
717
|
: label);
|
|
666
718
|
}
|
|
667
719
|
else if (entry.op === "remove") {
|
|
668
|
-
|
|
720
|
+
const before = entry.before ?? original.get(entry.key);
|
|
721
|
+
if (servers.has(entry.key) || !before) {
|
|
669
722
|
conflicts.push(label);
|
|
670
723
|
continue;
|
|
671
724
|
}
|
|
672
|
-
queue({ kind: "set", key: entry.key, value:
|
|
725
|
+
queue({ kind: "set", key: entry.key, value: before });
|
|
673
726
|
restored.push(label);
|
|
674
727
|
}
|
|
675
728
|
notes.push({ ...entry, restoreOf: batch });
|
|
@@ -737,8 +790,9 @@ export async function removeOceanEntries(options = {}) {
|
|
|
737
790
|
}
|
|
738
791
|
return { removed, left };
|
|
739
792
|
}
|
|
740
|
-
// Starts the client's configured `ocean` command
|
|
741
|
-
//
|
|
793
|
+
// Starts the client's configured `ocean` command, with that entry's own env, and makes one real
|
|
794
|
+
// tool call (`ocean_ping`) the way the client would. This proves the entry launches and answers;
|
|
795
|
+
// it does not prove the client app connects to it. The self-check's name stays out of the ledger.
|
|
742
796
|
export async function verifyClient(client, env = defaultClientEnv()) {
|
|
743
797
|
const adapter = CLIENT_ADAPTERS.find((item) => item.id === client);
|
|
744
798
|
if (!adapter?.config)
|
|
@@ -749,9 +803,13 @@ export async function verifyClient(client, env = defaultClientEnv()) {
|
|
|
749
803
|
: undefined;
|
|
750
804
|
if (!entry || typeof entry.command !== "string")
|
|
751
805
|
return { client, ok: false, detail: "no `ocean` entry" };
|
|
806
|
+
const entryEnv = entry.env && typeof entry.env === "object"
|
|
807
|
+
? Object.fromEntries(Object.entries(entry.env).filter((pair) => typeof pair[1] === "string"))
|
|
808
|
+
: {};
|
|
752
809
|
return new Promise((resolve) => {
|
|
753
810
|
const child = spawn(entry.command, entry.args ?? [], {
|
|
754
811
|
stdio: ["pipe", "pipe", "ignore"],
|
|
812
|
+
env: { ...process.env, ...entryEnv },
|
|
755
813
|
});
|
|
756
814
|
let output = "";
|
|
757
815
|
let done = false;
|
|
@@ -776,21 +834,42 @@ export async function verifyClient(client, env = defaultClientEnv()) {
|
|
|
776
834
|
.map((line) => JSON.parse(line));
|
|
777
835
|
const init = replies.find((reply) => reply.id === 1);
|
|
778
836
|
const list = replies.find((reply) => reply.id === 2);
|
|
779
|
-
|
|
837
|
+
const ping = replies.find((reply) => reply.id === 3);
|
|
838
|
+
if (!init || !list || !ping)
|
|
780
839
|
return;
|
|
781
840
|
const name = init.result?.serverInfo
|
|
782
841
|
?.name;
|
|
783
842
|
const tools = (list.result?.tools ?? []).map((tool) => tool.name);
|
|
784
|
-
|
|
785
|
-
tools.includes("brain_search")
|
|
786
|
-
tools.includes("memory_write")
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
843
|
+
if (name !== "ocean" ||
|
|
844
|
+
!tools.includes("brain_search") ||
|
|
845
|
+
!tools.includes("memory_write"))
|
|
846
|
+
return finish(false, `serverInfo ${name}, ${tools.length} tools`);
|
|
847
|
+
const answer = ping.result?.structuredContent?.ok;
|
|
848
|
+
if (ping.error || ping.result?.isError || answer !== true)
|
|
849
|
+
return finish(false, `ocean_ping failed: ${ping.error?.message ?? "no ok in the answer"}`);
|
|
850
|
+
finish(true, "answered a real ocean_ping call as the ocean brain server");
|
|
790
851
|
});
|
|
791
|
-
|
|
852
|
+
const send = (id, method, params) => `${JSON.stringify({ jsonrpc: "2.0", id, method, ...(params ? { params } : {}) })}\n`;
|
|
853
|
+
child.stdin.write(send(1, "initialize", { clientInfo: { name: SELF_CHECK_CLIENT } }) +
|
|
854
|
+
send(2, "tools/list") +
|
|
855
|
+
send(3, "tools/call", { name: "ocean_ping", arguments: {} }));
|
|
792
856
|
});
|
|
793
857
|
}
|
|
858
|
+
// Doctor's end-to-end view (T-328): every installed client whose `ocean` entry is current gets
|
|
859
|
+
// one real call through that entry, all at once. An entry that is written but does not answer
|
|
860
|
+
// fails: the client would show Ocean connected and get nothing.
|
|
861
|
+
export async function clientLiveFindings(env = defaultClientEnv(), verify = verifyClient) {
|
|
862
|
+
const wired = (await planClients(env)).filter((plan) => plan.installed && plan.status === "current");
|
|
863
|
+
return Promise.all(wired.map(async (plan) => {
|
|
864
|
+
const check = await verify(plan.client, env);
|
|
865
|
+
return {
|
|
866
|
+
code: check.ok ? "CLIENT_LIVE_OK" : "CLIENT_LIVE_FAIL",
|
|
867
|
+
severity: check.ok ? "OK" : "FAIL",
|
|
868
|
+
message: `${plan.label} (${plan.client}): ${check.detail}`,
|
|
869
|
+
fixable: false,
|
|
870
|
+
};
|
|
871
|
+
}));
|
|
872
|
+
}
|
|
794
873
|
// Doctor view: a supported client that is installed but not wired fails; unsupported clients
|
|
795
874
|
// are reported with their fallback; an unknown capability is a warning, never a pass. On this
|
|
796
875
|
// machine's real env, an engine in a temporary directory is named first: every plan below then
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import { bindConversation, readClaudeConversations, } from "@ocean/core/shared/project-legacy.js";
|
|
3
|
+
import { linkProjectAlias, } from "@ocean/core/shared/project-register.js";
|
|
4
|
+
import { refreshClaudeProjects } from "../pull/server-capture.js";
|
|
5
|
+
// Re-reads the caches so the chat just used has its title and Claude project on file before a
|
|
6
|
+
// capture or a link reads them. A failed read only leaves the last list in place.
|
|
7
|
+
export async function refreshClaudeConversations(home = os.homedir()) {
|
|
8
|
+
await refreshClaudeProjects(home).catch(() => undefined);
|
|
9
|
+
}
|
|
10
|
+
// `ocean desktop link <id>` (T-333, behind `ocean_project_link`): the newest Desktop chat is
|
|
11
|
+
// bound to the project, and the Claude project it sits in becomes that project's alias, so the
|
|
12
|
+
// project's other chats follow without being linked one by one. A Claude project name another
|
|
13
|
+
// project already answers to is left with it (alias.conflict says which).
|
|
14
|
+
export async function linkLatestDesktopChat(options) {
|
|
15
|
+
await (options.refresh ?? refreshClaudeConversations)();
|
|
16
|
+
const read = await options.read();
|
|
17
|
+
if (read.status === "absent")
|
|
18
|
+
return { status: "absent" };
|
|
19
|
+
const latest = read.conversations.reduce((best, each) => !best ||
|
|
20
|
+
(Date.parse(each.updatedAt) || 0) > (Date.parse(best.updatedAt) || 0)
|
|
21
|
+
? each
|
|
22
|
+
: best, undefined);
|
|
23
|
+
if (!latest)
|
|
24
|
+
return { status: "absent" };
|
|
25
|
+
await bindConversation(latest.uuid, options.project);
|
|
26
|
+
const claudeProject = (await readClaudeConversations())[latest.uuid]
|
|
27
|
+
?.projectName;
|
|
28
|
+
return {
|
|
29
|
+
status: "linked",
|
|
30
|
+
uuid: latest.uuid,
|
|
31
|
+
project: options.project,
|
|
32
|
+
...(claudeProject
|
|
33
|
+
? {
|
|
34
|
+
claudeProject,
|
|
35
|
+
alias: await linkProjectAlias(claudeProject, options.project),
|
|
36
|
+
}
|
|
37
|
+
: {}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=desktop-link.js.map
|
|
@@ -5,7 +5,7 @@ import { readFile, unlink } from "node:fs/promises";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { sessionFactsEnabled } from "@ocean/brain/memory/memory-audit.js";
|
|
8
|
-
import { desktopFactsLastRunFile } from "@ocean/
|
|
8
|
+
import { desktopFactsLastRunFile } from "@ocean/work/sessions/hooks/desktop-facts.js";
|
|
9
9
|
import { appendJournal, defaultClientEnv, edit, newBatch, planClients, readJournal, temporaryEntryProblem, } from "./clients.js";
|
|
10
10
|
import { oceanInvocation } from "./opencode-plugin.js";
|
|
11
11
|
// Claude Desktop's plain chat has no hooks (T-315), so a per-user LaunchAgent stands in for
|
|
@@ -19,15 +19,17 @@ export const DESKTOP_WATCHER_LABEL = "com.ocean.desktop-capture";
|
|
|
19
19
|
export const DESKTOP_WATCHER_FILE = `Library/LaunchAgents/${DESKTOP_WATCHER_LABEL}.plist`;
|
|
20
20
|
const CLIENT = "claude-desktop";
|
|
21
21
|
const KEY = "desktop-watcher";
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
// Hourly at most (T-340): every wake-up that finds a closed chat may spend a model call, and a
|
|
23
|
+
// store write fires WatchPaths every few minutes while the app is in use.
|
|
24
|
+
const THROTTLE_SECONDS = 3600;
|
|
25
|
+
const INTERVAL_SECONDS = 3600;
|
|
24
26
|
const sha = (text) => createHash("sha256").update(text).digest("hex");
|
|
25
27
|
const xml = (text) => text
|
|
26
28
|
.replaceAll("&", "&")
|
|
27
29
|
.replaceAll("<", "<")
|
|
28
30
|
.replaceAll(">", ">")
|
|
29
31
|
.replaceAll('"', """);
|
|
30
|
-
|
|
32
|
+
function desktopStoreDir(home) {
|
|
31
33
|
return path.join(home, "Library", "Application Support", "Claude", "IndexedDB", "https_claude.ai_0.indexeddb.leveldb");
|
|
32
34
|
}
|
|
33
35
|
// Only the folder that holds `claude`, resolved through symlinks: the shell's PATH carries
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { defaultClientEnv, planClients, } from "./clients.js";
|
|
4
|
+
import { oceanHookEvent } from "./hooks.js";
|
|
5
|
+
const snake = (event) => event.replace(/[A-Z]/g, (letter, at) => `${at ? "_" : ""}${letter.toLowerCase()}`);
|
|
6
|
+
async function readText(file) {
|
|
7
|
+
try {
|
|
8
|
+
return await readFile(file, "utf8");
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code === "ENOENT")
|
|
12
|
+
return "";
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// A TOML basic or literal string's value.
|
|
17
|
+
const tomlString = (quoted) => quoted.startsWith("'")
|
|
18
|
+
? quoted.slice(1, -1)
|
|
19
|
+
: quoted.slice(1, -1).replace(/\\(["\\])/g, "$1");
|
|
20
|
+
const KEY = String.raw `("(?:[^"\\]|\\.)*"|'[^']*')`;
|
|
21
|
+
// The hook keys config.toml holds a trusted_hash for, in either shape Codex accepts:
|
|
22
|
+
// `[hooks.state."<key>"]` tables, or `"<key>" = { trusted_hash = … }` under `[hooks.state]`.
|
|
23
|
+
export function trustedHookKeys(configToml) {
|
|
24
|
+
const trusted = new Set();
|
|
25
|
+
const table = new RegExp(String.raw `^\[\s*hooks\.state\.${KEY}\s*\]$`);
|
|
26
|
+
const inline = new RegExp(String.raw `^${KEY}\s*=\s*\{[^}]*\btrusted_hash\s*=\s*["']sha256:`);
|
|
27
|
+
let section = "";
|
|
28
|
+
let key;
|
|
29
|
+
for (const raw of configToml.split(/\r?\n/)) {
|
|
30
|
+
const line = raw.trim();
|
|
31
|
+
if (line.startsWith("[")) {
|
|
32
|
+
const match = table.exec(line);
|
|
33
|
+
key = match ? tomlString(match[1]) : undefined;
|
|
34
|
+
section = match ? "" : line.replace(/\s+/g, "");
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (key && /^trusted_hash\s*=\s*["']sha256:/.test(line))
|
|
38
|
+
trusted.add(key);
|
|
39
|
+
if (section === "[hooks.state]") {
|
|
40
|
+
const match = inline.exec(line);
|
|
41
|
+
if (match)
|
|
42
|
+
trusted.add(tomlString(match[1]));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return trusted;
|
|
46
|
+
}
|
|
47
|
+
// Every Ocean hook in Codex's hooks.json, with the trust key Codex gives it.
|
|
48
|
+
export function codexHookTrust(hooksJson, configToml, hooksFile) {
|
|
49
|
+
let root;
|
|
50
|
+
try {
|
|
51
|
+
root = JSON.parse(hooksJson);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const events = root?.hooks;
|
|
57
|
+
if (!events || typeof events !== "object")
|
|
58
|
+
return [];
|
|
59
|
+
const trusted = trustedHookKeys(configToml);
|
|
60
|
+
const found = [];
|
|
61
|
+
for (const [name, groups] of Object.entries(events)) {
|
|
62
|
+
if (!Array.isArray(groups))
|
|
63
|
+
continue;
|
|
64
|
+
groups.forEach((group, groupIndex) => {
|
|
65
|
+
const hooks = group?.hooks;
|
|
66
|
+
if (!Array.isArray(hooks))
|
|
67
|
+
return;
|
|
68
|
+
hooks.forEach((hook, hookIndex) => {
|
|
69
|
+
const event = oceanHookEvent(hook?.command);
|
|
70
|
+
if (!event)
|
|
71
|
+
return;
|
|
72
|
+
const key = `${hooksFile}:${snake(name)}:${groupIndex}:${hookIndex}`;
|
|
73
|
+
found.push({ client: "codex", event, key, trusted: trusted.has(key) });
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return found;
|
|
78
|
+
}
|
|
79
|
+
const FIX = 'open Codex and choose "Trust all and continue" when it asks "Hooks need review", or trust it under /hooks. Ocean does not trust hooks for you';
|
|
80
|
+
// `ocean doctor`: one finding per installed client that has a per-hook trust step.
|
|
81
|
+
export async function hookTrustFindings(env = defaultClientEnv()) {
|
|
82
|
+
const installed = (await planClients(env)).some((plan) => plan.installed && plan.client === "codex");
|
|
83
|
+
if (!installed)
|
|
84
|
+
return [];
|
|
85
|
+
const hooksFile = path.join(env.home, ".codex", "hooks.json");
|
|
86
|
+
const hooks = codexHookTrust(await readText(hooksFile), await readText(path.join(env.home, ".codex", "config.toml")), hooksFile);
|
|
87
|
+
if (!hooks.length)
|
|
88
|
+
return [];
|
|
89
|
+
const untrusted = hooks.filter((hook) => !hook.trusted);
|
|
90
|
+
if (!untrusted.length)
|
|
91
|
+
return [
|
|
92
|
+
{
|
|
93
|
+
code: "HOOK_TRUST",
|
|
94
|
+
severity: "OK",
|
|
95
|
+
message: `codex: Ocean's ${hooks.map((hook) => hook.event).join(", ")} hooks are trusted`,
|
|
96
|
+
fixable: false,
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
return untrusted.map((hook) => ({
|
|
100
|
+
code: "HOOK_UNTRUSTED",
|
|
101
|
+
severity: "WARN",
|
|
102
|
+
message: `codex: Ocean's ${hook.event} hook is not trusted, so Codex never runs it${hook.event === "SessionEnd" ? " and its sessions are not recorded" : ""} — ${FIX}`,
|
|
103
|
+
fixable: false,
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=hook-trust.js.map
|
|
@@ -28,7 +28,13 @@ const EVENTS = {
|
|
|
28
28
|
pattern: /\bhook prompt\b/,
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
// The Ocean hook event a command runs, if it is an Ocean hook at all (read by hook-trust.ts).
|
|
32
|
+
export function oceanHookEvent(command) {
|
|
33
|
+
if (typeof command !== "string")
|
|
34
|
+
return undefined;
|
|
35
|
+
return Object.keys(EVENTS).find((event) => EVENTS[event].pattern.test(command));
|
|
36
|
+
}
|
|
37
|
+
const HOOK_ADAPTERS = [
|
|
32
38
|
{
|
|
33
39
|
client: "claude-code",
|
|
34
40
|
hookClient: "claude",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
// One stdio server's tools/list, or null when it does not answer in time.
|
|
3
|
+
export function listToolBytes(command, cwd, timeoutMs = 15_000) {
|
|
4
|
+
return new Promise((resolve) => {
|
|
5
|
+
let child;
|
|
6
|
+
try {
|
|
7
|
+
child = spawn(command[0], command.slice(1), {
|
|
8
|
+
cwd,
|
|
9
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
resolve(null);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
let buffer = "";
|
|
17
|
+
let settled = false;
|
|
18
|
+
const finish = (value) => {
|
|
19
|
+
if (settled)
|
|
20
|
+
return;
|
|
21
|
+
settled = true;
|
|
22
|
+
clearTimeout(timer);
|
|
23
|
+
child.kill();
|
|
24
|
+
resolve(value);
|
|
25
|
+
};
|
|
26
|
+
const timer = setTimeout(() => finish(null), timeoutMs);
|
|
27
|
+
child.on("error", () => finish(null));
|
|
28
|
+
child.on("exit", () => finish(null));
|
|
29
|
+
child.stdout?.setEncoding("utf8");
|
|
30
|
+
child.stdout?.on("data", (chunk) => {
|
|
31
|
+
buffer += chunk;
|
|
32
|
+
let newline = buffer.indexOf("\n");
|
|
33
|
+
while (newline >= 0) {
|
|
34
|
+
const line = buffer.slice(0, newline);
|
|
35
|
+
buffer = buffer.slice(newline + 1);
|
|
36
|
+
newline = buffer.indexOf("\n");
|
|
37
|
+
let message;
|
|
38
|
+
try {
|
|
39
|
+
message = JSON.parse(line);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (message.id !== 2)
|
|
45
|
+
continue;
|
|
46
|
+
const tools = Array.isArray(message.result?.tools)
|
|
47
|
+
? message.result.tools
|
|
48
|
+
: [];
|
|
49
|
+
finish({
|
|
50
|
+
bytes: tools.reduce((total, tool) => total + Buffer.byteLength(JSON.stringify(tool)), 0),
|
|
51
|
+
tools: tools.length,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const send = (id, method, params = {}) => child.stdin?.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}\n`);
|
|
56
|
+
child.stdin?.on("error", () => finish(null));
|
|
57
|
+
send(1, "initialize", {
|
|
58
|
+
protocolVersion: "2025-06-18",
|
|
59
|
+
capabilities: {},
|
|
60
|
+
clientInfo: { name: "ocean-context-cost", version: "0" },
|
|
61
|
+
});
|
|
62
|
+
child.stdin?.write(`${JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })}\n`);
|
|
63
|
+
send(2, "tools/list");
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// `ocean mcp serve` and the gateway, as a client in `cwd` launches them.
|
|
67
|
+
export async function measureMcpSchemas(cwd, oceanCommand, gatewayArgs) {
|
|
68
|
+
const [ocean, gateway] = await Promise.all([
|
|
69
|
+
listToolBytes([...oceanCommand, "mcp", "serve"], cwd),
|
|
70
|
+
listToolBytes([...oceanCommand, ...gatewayArgs], cwd),
|
|
71
|
+
]);
|
|
72
|
+
return { ocean, gateway };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=mcp-schema-cost.js.map
|
|
@@ -4,7 +4,8 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
4
4
|
import { stagingDir } from "@ocean/brain/memory/memory-paths.js";
|
|
5
5
|
import { defaultClientEnv, edit, newBatch, planClients, readJournal, } from "./clients.js";
|
|
6
6
|
import { canonicalJson, ManualEdit } from "./editors.js";
|
|
7
|
-
|
|
7
|
+
import { XCODE_AGENTS } from "./registry.js";
|
|
8
|
+
const NATIVE_ADAPTERS = [
|
|
8
9
|
{
|
|
9
10
|
client: "claude-code",
|
|
10
11
|
kind: "json-set",
|
|
@@ -40,6 +41,29 @@ export const NATIVE_ADAPTERS = [
|
|
|
40
41
|
section: "memory",
|
|
41
42
|
values: { memory_enabled: false, user_profile_enabled: false },
|
|
42
43
|
},
|
|
44
|
+
// Xcode's agents are the same CLIs reading their own config homes (T-328 P6): the Claude
|
|
45
|
+
// Agent's memory goes to Claude Code's staging folder, which the harvest already reads.
|
|
46
|
+
{
|
|
47
|
+
client: "xcode-claude",
|
|
48
|
+
kind: "json-set",
|
|
49
|
+
file: `${XCODE_AGENTS}/ClaudeAgentConfig/settings.json`,
|
|
50
|
+
key: ["autoMemoryDirectory"],
|
|
51
|
+
value: () => stagingDir("claude-code"),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
client: "xcode-codex",
|
|
55
|
+
kind: "toml",
|
|
56
|
+
file: `${XCODE_AGENTS}/codex/config.toml`,
|
|
57
|
+
section: "memories",
|
|
58
|
+
values: { generate_memories: false, use_memories: false },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
client: "xcode-gemini",
|
|
62
|
+
kind: "json-add",
|
|
63
|
+
file: `${XCODE_AGENTS}/gemini/settings.json`,
|
|
64
|
+
key: ["tools", "exclude"],
|
|
65
|
+
value: () => "save_memory",
|
|
66
|
+
},
|
|
43
67
|
{
|
|
44
68
|
client: "claude-desktop",
|
|
45
69
|
kind: "capture",
|
|
@@ -48,7 +72,19 @@ export const NATIVE_ADAPTERS = [
|
|
|
48
72
|
{
|
|
49
73
|
client: "cursor",
|
|
50
74
|
kind: "uncaptured",
|
|
51
|
-
text: "left on: Cursor
|
|
75
|
+
text: "left on: Cursor's Memories (no settings page since 2.1) live on its servers; its sessions reach Ocean through the session hooks",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
// Two stores (code.visualstudio.com/docs/agents/run/memory, checked T-328 P6): Copilot
|
|
79
|
+
// Memory on GitHub's servers, and the local memory tool, whose files the docs do not place.
|
|
80
|
+
client: "vscode",
|
|
81
|
+
kind: "uncaptured",
|
|
82
|
+
text: "left on: Copilot Memory lives on GitHub's servers and the local /memories tool in VS Code's storage, neither readable by Ocean",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
client: "warp",
|
|
86
|
+
kind: "uncaptured",
|
|
87
|
+
text: "left on: Warp's rules and agent memory sync through Warp Drive, on Warp's servers",
|
|
52
88
|
},
|
|
53
89
|
{
|
|
54
90
|
client: "chatgpt",
|
|
@@ -14,6 +14,8 @@ const opencodeEditor = jsonEditor(["mcp"], (value) => ({
|
|
|
14
14
|
args: command.slice(1),
|
|
15
15
|
};
|
|
16
16
|
});
|
|
17
|
+
// Home-relative folder holding each Xcode agent's own config (T-328 P6).
|
|
18
|
+
export const XCODE_AGENTS = "Library/Developer/Xcode/CodingAssistant";
|
|
17
19
|
export const CLIENT_ADAPTERS = [
|
|
18
20
|
{
|
|
19
21
|
id: "claude-code",
|
|
@@ -114,7 +116,7 @@ export const CLIENT_ADAPTERS = [
|
|
|
114
116
|
file: "Library/Application Support/Code/User/mcp.json",
|
|
115
117
|
editor: jsonEditor(["servers"], (value) => ({ type: "stdio", ...value })),
|
|
116
118
|
},
|
|
117
|
-
nativeMemory: "
|
|
119
|
+
nativeMemory: "uncaptured",
|
|
118
120
|
},
|
|
119
121
|
{
|
|
120
122
|
id: "hermes",
|
|
@@ -175,23 +177,63 @@ export const CLIENT_ADAPTERS = [
|
|
|
175
177
|
fallback: "`ocean pull` captures its conversations and memory from the browsers' caches",
|
|
176
178
|
},
|
|
177
179
|
{
|
|
180
|
+
// Warp's agents read file-based MCP servers from `~/.warp/.mcp.json` (docs.warp.dev,
|
|
181
|
+
// agents/capabilities/mcp, checked T-328 P6); it reads ~/.claude.json too, but only with
|
|
182
|
+
// third-party auto-spawn on, which is off by default — so Ocean writes Warp's own file.
|
|
178
183
|
id: "warp",
|
|
179
184
|
label: "Warp",
|
|
180
|
-
|
|
181
|
-
tier: "unsupported",
|
|
185
|
+
tier: "supported",
|
|
182
186
|
detect: { apps: ["Warp.app"], paths: [".warp"] },
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
fallback: "use Ocean from a supported client or the `ocean` CLI",
|
|
187
|
+
config: { file: ".warp/.mcp.json", editor: jsonEditor(["mcpServers"]) },
|
|
188
|
+
nativeMemory: "uncaptured",
|
|
186
189
|
},
|
|
187
190
|
{
|
|
191
|
+
// Xcode's own chat cannot load an MCP server; its agents (Xcode 26.3+) can, each from its
|
|
192
|
+
// own folder under CodingAssistant (rows below), so this row only accounts for the app.
|
|
188
193
|
id: "xcode",
|
|
189
194
|
label: "Xcode",
|
|
190
195
|
tier: "unsupported",
|
|
191
196
|
detect: { apps: ["Xcode.app"] },
|
|
192
|
-
nativeMemory: "
|
|
193
|
-
reason: "
|
|
194
|
-
fallback: "
|
|
197
|
+
nativeMemory: "none",
|
|
198
|
+
reason: "its built-in chat cannot load an MCP server; Xcode's Claude Agent, Codex and Gemini agents connect from their own config folders",
|
|
199
|
+
fallback: "enable an agent in Xcode → Settings → Intelligence, then `ocean clients apply`",
|
|
200
|
+
},
|
|
201
|
+
// Xcode's agents read only `~/Library/Developer/Xcode/CodingAssistant/<agent>` (Apple,
|
|
202
|
+
// "Extending and customizing agents"), never the CLI's own config, so each is a client of its
|
|
203
|
+
// own, found once Xcode has created its folder. Each folder stands in for that CLI's config
|
|
204
|
+
// home (CLAUDE_CONFIG_DIR, CODEX_HOME, ~/.gemini). Not yet run on a Mac with an agent enabled.
|
|
205
|
+
{
|
|
206
|
+
id: "xcode-claude",
|
|
207
|
+
label: "Xcode Claude Agent",
|
|
208
|
+
tier: "supported",
|
|
209
|
+
detect: { paths: [`${XCODE_AGENTS}/ClaudeAgentConfig`] },
|
|
210
|
+
config: {
|
|
211
|
+
file: `${XCODE_AGENTS}/ClaudeAgentConfig/.claude.json`,
|
|
212
|
+
editor: jsonEditor(["mcpServers"]),
|
|
213
|
+
},
|
|
214
|
+
nativeMemory: "redirect-staging",
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: "xcode-codex",
|
|
218
|
+
label: "Xcode Codex",
|
|
219
|
+
tier: "supported",
|
|
220
|
+
detect: { paths: [`${XCODE_AGENTS}/codex`] },
|
|
221
|
+
config: {
|
|
222
|
+
file: `${XCODE_AGENTS}/codex/config.toml`,
|
|
223
|
+
editor: tomlEditor("mcp_servers"),
|
|
224
|
+
},
|
|
225
|
+
nativeMemory: "disable",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: "xcode-gemini",
|
|
229
|
+
label: "Xcode Gemini",
|
|
230
|
+
tier: "supported",
|
|
231
|
+
detect: { paths: [`${XCODE_AGENTS}/gemini`] },
|
|
232
|
+
config: {
|
|
233
|
+
file: `${XCODE_AGENTS}/gemini/settings.json`,
|
|
234
|
+
editor: jsonEditor(["mcpServers"]),
|
|
235
|
+
},
|
|
236
|
+
nativeMemory: "disable",
|
|
195
237
|
},
|
|
196
238
|
];
|
|
197
239
|
// Clients whose only trace in Ocean is their MCP connection: no CLI to intercept and no session
|