@amoree-code/ocean 2.22.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 +220 -0
- package/dist/application/clients/chat-plugin.js +4 -42
- 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/clients/zip.js +44 -0
- 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 +55 -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,11 +1,22 @@
|
|
|
1
1
|
import { mkdir, readdir, readFile, stat } from "node:fs/promises";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { clientSkillRoots } from "@ocean/connect/skills/core-skill-sync.js";
|
|
5
|
+
import { profileCatalog, sessionProfile, } from "@ocean/core/profiles/session-profile.js";
|
|
6
|
+
import { policyCatalog, policyLine, routePolicies, } from "@ocean/core/shared/charter.js";
|
|
7
|
+
import { matchTriggers } from "@ocean/core/shared/context-triggers.js";
|
|
4
8
|
import { atomicWrite } from "@ocean/core/shared/fs-utils.js";
|
|
5
9
|
import { oceanPath, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
|
|
6
|
-
import {
|
|
10
|
+
import { resolveProject } from "@ocean/core/shared/project-resolution.js";
|
|
11
|
+
import { projectSignals } from "@ocean/core/shared/repo-signals.js";
|
|
12
|
+
import { isContentWord, normalizeText, stem, tokenize, } from "@ocean/core/shared/text-tokens.js";
|
|
13
|
+
import { PROFILE_DEFAULT_GROUPS, TOOL_GROUPS, writeToolSelection, } from "@ocean/core/shared/tool-groups.js";
|
|
7
14
|
// Below this a match is noise; tuned on the owner's installed skills (`ocean skill route`).
|
|
8
15
|
export const ROUTE_THRESHOLD = 7;
|
|
16
|
+
// What being in the session's primary profile adds to a skill that already matched, and being
|
|
17
|
+
// in a profile the prompt itself triggered (T-338 P3). Neither makes a match from nothing.
|
|
18
|
+
const PRIMARY_BOOST = 4;
|
|
19
|
+
const SECONDARY_BOOST = 3;
|
|
9
20
|
// A runner-up within this share of the top score counts as close (named, or ambiguous).
|
|
10
21
|
const SECOND_RATIO = 0.8;
|
|
11
22
|
// What a word found in only one skill is worth (≈ its raw IDF across ~150 skills).
|
|
@@ -167,39 +178,6 @@ export async function loadSkillIndex(home = os.homedir()) {
|
|
|
167
178
|
}
|
|
168
179
|
return buildSkillIndex(home);
|
|
169
180
|
}
|
|
170
|
-
const STOP_WORDS = new Set(("a an the and or but if of to in on at by for with from as is are was were be been being " +
|
|
171
|
-
"it its this that these those i me my we our us you your he she they them their what which " +
|
|
172
|
-
"who whom how when where why can could should would will shall do does did done doing have " +
|
|
173
|
-
"has had not no yes so than then there here about into over under up down out any all some " +
|
|
174
|
-
"each every more most other such only own same too very just also use used using user users " +
|
|
175
|
-
"owner says say said ask asks asked want wants need needs please let lets get got make made " +
|
|
176
|
-
"via per etc skill skills like one two new now way well really thing things help").split(" "));
|
|
177
|
-
const isContentWord = (word) => word.length >= 2 && !STOP_WORDS.has(word);
|
|
178
|
-
function normalizeText(text) {
|
|
179
|
-
return (text
|
|
180
|
-
.toLowerCase()
|
|
181
|
-
.normalize("NFKC")
|
|
182
|
-
.match(/[\p{L}\p{N}]+/gu)
|
|
183
|
-
?.join(" ") ?? "");
|
|
184
|
-
}
|
|
185
|
-
// Light suffix stripping so "writing tests" meets "write a test"; the same on both sides.
|
|
186
|
-
function stem(word) {
|
|
187
|
-
let out = word;
|
|
188
|
-
if (out.length > 5 && out.endsWith("ing"))
|
|
189
|
-
out = out.slice(0, -3);
|
|
190
|
-
else if (out.length > 4 && out.endsWith("ed"))
|
|
191
|
-
out = out.slice(0, -2);
|
|
192
|
-
else if (out.length > 4 && out.endsWith("es"))
|
|
193
|
-
out = out.slice(0, -2);
|
|
194
|
-
else if (out.length > 3 && out.endsWith("s") && !out.endsWith("ss"))
|
|
195
|
-
out = out.slice(0, -1);
|
|
196
|
-
if (out.length > 3 && out.endsWith("e"))
|
|
197
|
-
out = out.slice(0, -1);
|
|
198
|
-
return out;
|
|
199
|
-
}
|
|
200
|
-
export function tokenize(text) {
|
|
201
|
-
return normalizeText(text).split(" ").filter(isContentWord).map(stem);
|
|
202
|
-
}
|
|
203
181
|
// Message shapes that carry intent no single word does: "Zustand or Redux?" is a comparison.
|
|
204
182
|
function expansions(message) {
|
|
205
183
|
const words = [];
|
|
@@ -209,48 +187,6 @@ function expansions(message) {
|
|
|
209
187
|
words.push("compare");
|
|
210
188
|
return words;
|
|
211
189
|
}
|
|
212
|
-
// Words the working directory names: its package.json dependencies and its top-level file
|
|
213
|
-
// names (`vitest.config.ts` → vitest, `graphify-out` → graphify).
|
|
214
|
-
export async function projectSignals(cwd) {
|
|
215
|
-
const terms = new Set();
|
|
216
|
-
const dirs = [cwd];
|
|
217
|
-
let current = cwd;
|
|
218
|
-
for (let depth = 0; depth < 5; depth++) {
|
|
219
|
-
const marker = await stat(path.join(current, "package.json")).catch(() => stat(path.join(current, ".git")).catch(() => null));
|
|
220
|
-
if (marker) {
|
|
221
|
-
if (current !== cwd)
|
|
222
|
-
dirs.push(current);
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
const parent = path.dirname(current);
|
|
226
|
-
if (parent === current)
|
|
227
|
-
break;
|
|
228
|
-
current = parent;
|
|
229
|
-
}
|
|
230
|
-
for (const dir of dirs) {
|
|
231
|
-
try {
|
|
232
|
-
for (const entry of await readdir(dir))
|
|
233
|
-
terms.add(entry.toLowerCase().split(/[.\-_]/)[0]);
|
|
234
|
-
}
|
|
235
|
-
catch { }
|
|
236
|
-
try {
|
|
237
|
-
const pkg = JSON.parse(await readFile(path.join(dir, "package.json"), "utf8"));
|
|
238
|
-
for (const deps of [pkg?.dependencies, pkg?.devDependencies])
|
|
239
|
-
if (deps && typeof deps === "object")
|
|
240
|
-
for (const dep of Object.keys(deps)) {
|
|
241
|
-
const [scope, name] = dep.startsWith("@")
|
|
242
|
-
? dep.slice(1).split("/")
|
|
243
|
-
: [dep, ""];
|
|
244
|
-
terms.add(`dep:${scope.toLowerCase()}`);
|
|
245
|
-
if (name)
|
|
246
|
-
terms.add(`dep:${name.toLowerCase()}`);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
catch { }
|
|
250
|
-
}
|
|
251
|
-
terms.delete("");
|
|
252
|
-
return terms;
|
|
253
|
-
}
|
|
254
190
|
// Whether the working directory points at this skill: a file named like it, or a dependency
|
|
255
191
|
// named like it (or like its first word: `next` → next-best-practices).
|
|
256
192
|
function projectHit(name, signals) {
|
|
@@ -273,8 +209,50 @@ function fileFor(skill, client) {
|
|
|
273
209
|
return skill.files[root];
|
|
274
210
|
return Object.values(skill.files)[0] ?? "";
|
|
275
211
|
}
|
|
276
|
-
//
|
|
277
|
-
//
|
|
212
|
+
// The primary comes from the project, task and repository, as at session start, so it holds
|
|
213
|
+
// for the session; the prompt only adds secondaries. Never throws: no profiles, no boost.
|
|
214
|
+
async function promptProfiles(cwd, prompt) {
|
|
215
|
+
try {
|
|
216
|
+
const catalog = await profileCatalog();
|
|
217
|
+
const project = await resolveProject(cwd).catch(() => null);
|
|
218
|
+
const session = await sessionProfile({
|
|
219
|
+
projectId: project?.status === "bound" ? project.projectId : undefined,
|
|
220
|
+
cwd,
|
|
221
|
+
prompt,
|
|
222
|
+
catalog,
|
|
223
|
+
});
|
|
224
|
+
const of = (name) => catalog.profiles.find((profile) => profile.name === name);
|
|
225
|
+
const all = [session.primary, ...session.secondary];
|
|
226
|
+
return {
|
|
227
|
+
skills: {
|
|
228
|
+
primary: new Set(of(session.primary)?.skills ?? []),
|
|
229
|
+
secondary: new Set(session.secondary.flatMap((name) => of(name)?.skills ?? [])),
|
|
230
|
+
},
|
|
231
|
+
primary: session.primary,
|
|
232
|
+
secondary: session.secondary,
|
|
233
|
+
policies: [...new Set(all.flatMap((name) => of(name)?.policies ?? []))],
|
|
234
|
+
groups: [
|
|
235
|
+
...new Set(all.flatMap((name) => [
|
|
236
|
+
...(of(name)?.tools ?? []),
|
|
237
|
+
...(PROFILE_DEFAULT_GROUPS[name] ?? []),
|
|
238
|
+
])),
|
|
239
|
+
],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// The Ocean tool groups this prompt's words open.
|
|
247
|
+
function promptGroups(prompt) {
|
|
248
|
+
if (!prompt.trim() || prompt.trimStart().startsWith("/"))
|
|
249
|
+
return [];
|
|
250
|
+
return Object.entries(TOOL_GROUPS)
|
|
251
|
+
.filter(([, group]) => matchTriggers(group.triggers, prompt).score > 0)
|
|
252
|
+
.map(([name]) => name);
|
|
253
|
+
}
|
|
254
|
+
// BM25 over each description (the name counts double), plus trigger-phrase hits, the
|
|
255
|
+
// working-directory signal and the session's profiles. Pure: the same index, message and signals give the same answer.
|
|
278
256
|
export function routeSkills(index, message, options = {}) {
|
|
279
257
|
const empty = { matches: [], candidates: [] };
|
|
280
258
|
const text = message.slice(0, MESSAGE_CHARS);
|
|
@@ -308,6 +286,9 @@ export function routeSkills(index, message, options = {}) {
|
|
|
308
286
|
const b = 0.75;
|
|
309
287
|
const signals = options.signals ?? new Set();
|
|
310
288
|
const scored = [];
|
|
289
|
+
// The profile boost each match got: a boost shared by the top skill and a runner-up must
|
|
290
|
+
// not make them look closer than their own words do.
|
|
291
|
+
const boostOf = new Map();
|
|
311
292
|
for (const item of prepared) {
|
|
312
293
|
let score = 0;
|
|
313
294
|
const why = [];
|
|
@@ -339,6 +320,16 @@ export function routeSkills(index, message, options = {}) {
|
|
|
339
320
|
score += 4;
|
|
340
321
|
why.push("project");
|
|
341
322
|
}
|
|
323
|
+
if (score > 0 && options.profiles?.primary.has(item.skill.name)) {
|
|
324
|
+
score += PRIMARY_BOOST;
|
|
325
|
+
boostOf.set(item.skill.name, PRIMARY_BOOST);
|
|
326
|
+
why.push("profile");
|
|
327
|
+
}
|
|
328
|
+
else if (score > 0 && options.profiles?.secondary.has(item.skill.name)) {
|
|
329
|
+
score += SECONDARY_BOOST;
|
|
330
|
+
boostOf.set(item.skill.name, SECONDARY_BOOST);
|
|
331
|
+
why.push("secondary profile");
|
|
332
|
+
}
|
|
342
333
|
if (score <= 0)
|
|
343
334
|
continue;
|
|
344
335
|
scored.push({
|
|
@@ -356,9 +347,10 @@ export function routeSkills(index, message, options = {}) {
|
|
|
356
347
|
// Close runners-up: one is named alongside the top skill; two or more mean the message is
|
|
357
348
|
// generic ("write tests" with three test skills and nothing in the project to choose), so
|
|
358
349
|
// nothing is named.
|
|
350
|
+
const shared = (item) => Math.min(boostOf.get(item.name) ?? 0, boostOf.get(top.name) ?? 0);
|
|
359
351
|
const close = scored
|
|
360
352
|
.slice(1)
|
|
361
|
-
.filter((item) => item.score >= top.score * SECOND_RATIO);
|
|
353
|
+
.filter((item) => item.score - shared(item) >= (top.score - shared(item)) * SECOND_RATIO);
|
|
362
354
|
if (close.length >= 2)
|
|
363
355
|
return { matches: [], candidates };
|
|
364
356
|
const matches = [top, ...close];
|
|
@@ -392,46 +384,98 @@ const HOOK_EVENT = {
|
|
|
392
384
|
gemini: "BeforeAgent",
|
|
393
385
|
};
|
|
394
386
|
export const PROMPT_HOOK_CLIENTS = Object.keys(HOOK_EVENT);
|
|
387
|
+
// One line naming the groups this prompt opened, so a client that never re-lists still knows
|
|
388
|
+
// the tools exist and how to reach them.
|
|
389
|
+
function groupsLine(groups) {
|
|
390
|
+
const named = groups
|
|
391
|
+
.map((name) => `${name} (${TOOL_GROUPS[name]?.tools.join(", ")})`)
|
|
392
|
+
.join("; ");
|
|
393
|
+
return `Ocean tools opened: ${named}. If they are not listed, run one through ocean_call.`;
|
|
394
|
+
}
|
|
395
395
|
// `ocean hook prompt --client <c>`: the hook payload in, the client's additional-context
|
|
396
396
|
// output (or nothing) out. Never throws on a bad payload: a prompt hook must not block a prompt.
|
|
397
|
+
// Names at most one skill line, two policy digests and the tool groups the prompt opened, each
|
|
398
|
+
// once per session; writes the folder's tool selection the MCP servers follow (T-339).
|
|
397
399
|
export async function skillRouterHook(payload, client, home = os.homedir()) {
|
|
398
400
|
const prompt = typeof payload.prompt === "string" ? payload.prompt : "";
|
|
399
401
|
if (!prompt.trim())
|
|
400
402
|
return null;
|
|
401
403
|
const cwd = typeof payload.cwd === "string" ? payload.cwd : process.cwd();
|
|
402
404
|
const session = typeof payload.session_id === "string" ? payload.session_id : "";
|
|
403
|
-
const index = await
|
|
405
|
+
const [index, signals, profiles, policies] = await Promise.all([
|
|
406
|
+
loadSkillIndex(home),
|
|
407
|
+
projectSignals(cwd),
|
|
408
|
+
promptProfiles(cwd, prompt),
|
|
409
|
+
policyCatalog().catch(() => []),
|
|
410
|
+
]);
|
|
404
411
|
const { matches } = routeSkills(index, prompt, {
|
|
405
|
-
signals
|
|
412
|
+
signals,
|
|
406
413
|
client,
|
|
414
|
+
profiles: profiles?.skills,
|
|
407
415
|
});
|
|
408
|
-
if (!matches.length)
|
|
409
|
-
return null;
|
|
410
416
|
const state = await readState();
|
|
411
|
-
const
|
|
412
|
-
const
|
|
413
|
-
|
|
417
|
+
const entry = session ? state.sessions[session] : undefined;
|
|
418
|
+
const seenSkills = new Set(entry?.skills ?? []);
|
|
419
|
+
// The profile's own policies arrived with the start brief; a prompt never repeats them.
|
|
420
|
+
const seenPolicies = new Set([
|
|
421
|
+
...(entry?.policies ?? []),
|
|
422
|
+
...(profiles?.policies ?? []),
|
|
423
|
+
]);
|
|
424
|
+
const seenGroups = new Set(entry?.groups ?? []);
|
|
425
|
+
const fresh = matches.filter((match) => !seenSkills.has(match.name));
|
|
426
|
+
const policyMatches = routePolicies(policies, prompt, {
|
|
427
|
+
max: Number.POSITIVE_INFINITY,
|
|
428
|
+
})
|
|
429
|
+
.filter((match) => !seenPolicies.has(match.name))
|
|
430
|
+
.slice(0, 2);
|
|
431
|
+
const groups = [
|
|
432
|
+
...new Set([...(profiles?.groups ?? []), ...promptGroups(prompt)]),
|
|
433
|
+
];
|
|
434
|
+
const newGroups = groups.filter((name) => !seenGroups.has(name));
|
|
435
|
+
try {
|
|
436
|
+
await writeToolSelection(cwd, {
|
|
437
|
+
primary: profiles?.primary ?? "base",
|
|
438
|
+
secondary: profiles?.secondary ?? [],
|
|
439
|
+
groups,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
catch { }
|
|
443
|
+
// Profile groups are listed from the start; only the ones this prompt's words opened are said.
|
|
444
|
+
const spoken = newGroups.filter((name) => !(profiles?.groups ?? []).includes(name));
|
|
445
|
+
if (!fresh.length && !policyMatches.length && !newGroups.length)
|
|
414
446
|
return null;
|
|
415
447
|
const now = Date.now();
|
|
416
|
-
for (const [id,
|
|
417
|
-
if (!
|
|
448
|
+
for (const [id, item] of Object.entries(state.sessions))
|
|
449
|
+
if (!item || now - item.at > SESSION_TTL_MS)
|
|
418
450
|
delete state.sessions[id];
|
|
419
451
|
if (session)
|
|
420
452
|
state.sessions[session] = {
|
|
421
453
|
at: now,
|
|
422
|
-
skills: [...
|
|
454
|
+
skills: [...seenSkills, ...fresh.map((match) => match.name)],
|
|
455
|
+
policies: [...seenPolicies, ...policyMatches.map((match) => match.name)],
|
|
456
|
+
groups: [...seenGroups, ...newGroups],
|
|
423
457
|
};
|
|
424
458
|
for (const match of fresh)
|
|
425
459
|
state.hits[match.name] = (state.hits[match.name] ?? 0) + 1;
|
|
460
|
+
for (const match of policyMatches)
|
|
461
|
+
state.hits[`policy:${match.name}`] =
|
|
462
|
+
(state.hits[`policy:${match.name}`] ?? 0) + 1;
|
|
426
463
|
try {
|
|
427
464
|
await mkdir(path.dirname(statePath()), { recursive: true });
|
|
428
465
|
await atomicWrite(statePath(), `${JSON.stringify(state, null, 2)}\n`);
|
|
429
466
|
}
|
|
430
467
|
catch { }
|
|
468
|
+
const lines = [
|
|
469
|
+
...(fresh.length ? [routerLine(fresh)] : []),
|
|
470
|
+
...policyMatches.map(policyLine),
|
|
471
|
+
...(spoken.length ? [groupsLine(spoken)] : []),
|
|
472
|
+
];
|
|
473
|
+
if (!lines.length)
|
|
474
|
+
return null;
|
|
431
475
|
return {
|
|
432
476
|
hookSpecificOutput: {
|
|
433
477
|
hookEventName: HOOK_EVENT[client] ?? "UserPromptSubmit",
|
|
434
|
-
additionalContext:
|
|
478
|
+
additionalContext: lines.join("\n"),
|
|
435
479
|
},
|
|
436
480
|
};
|
|
437
481
|
}
|
|
@@ -74,7 +74,7 @@ async function pointerState(pointer) {
|
|
|
74
74
|
: readFile(pointer.target).then(sha256, () => "");
|
|
75
75
|
}
|
|
76
76
|
// `<p>/brain/x` → `<p>/x` and `<p>/kernel/bridge/x` → `<p>/bridge/x`, by the plan's own pattern.
|
|
77
|
-
|
|
77
|
+
function repoint(text, root, home, areas) {
|
|
78
78
|
return text.replace(oldPathPattern(root, home, areas), (_, prefix, area) => area === "brain" ? prefix : `${prefix}/bridge`);
|
|
79
79
|
}
|
|
80
80
|
// The old areas a set of moves empties, i.e. the only ones whose paths go stale.
|
|
@@ -5,7 +5,7 @@ import { oceanRoot } from "@ocean/core/shared/paths.js";
|
|
|
5
5
|
// The workspace template shipped in the package (T-296 §3.9): generic charter, policies,
|
|
6
6
|
// templates and indexes, empty private files, and the required empty directories. Its classes
|
|
7
7
|
// live in MANIFEST.json and are checked by scripts/check-template-purity.mjs.
|
|
8
|
-
|
|
8
|
+
const WORKSPACE_TEMPLATE = fileURLToPath(new URL("../../../templates/workspace/", import.meta.url));
|
|
9
9
|
// Copies every template file the workspace does not have yet and creates the required
|
|
10
10
|
// directories. A file that already exists is never replaced, so a rerun on a populated
|
|
11
11
|
// workspace changes nothing. `.gitkeep` files are not copied: they only keep the template's
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import { syncCoreSkills } from "@ocean/connect/skills/core-skill-sync.js";
|
|
3
|
+
import { copyClientSkills } from "@ocean/connect/skills/skill-hub.js";
|
|
2
4
|
import { oceanPath, PERSONAL_DIR } from "@ocean/core/shared/paths.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { connectObsidianVault } from "@ocean/services/obsidian/vault-discovery.js";
|
|
6
|
-
import { ONBOARDING_QUESTIONS, onboard, } from "@ocean/services/onboarding/onboarding.js";
|
|
5
|
+
import { ONBOARDING_QUESTIONS, onboard, } from "@ocean/services/day/onboarding.js";
|
|
6
|
+
import { connectObsidianVault } from "@ocean/services/integrations/obsidian/vault-discovery.js";
|
|
7
7
|
import { CHAT_PLUGIN_STEPS, CHAT_SKILL_ZIP, chatPluginAdded, openChatPluginSetup, } from "../clients/chat-plugin.js";
|
|
8
8
|
// Bump when a step is added; completed steps stay completed, only new ids run.
|
|
9
9
|
export const ONBOARDING_VERSION = 5;
|
|
10
|
+
export const DETECTOR_QUESTION = " Watch for AI clients you install later and offer to connect each one? (a macOS notification; nothing is edited without your yes)";
|
|
10
11
|
async function yes(io, question) {
|
|
11
12
|
return (await io.ask(`${question} [Y/n] `, "y")).trim().toLowerCase() !== "n";
|
|
12
13
|
}
|
|
@@ -21,9 +22,101 @@ function describeClient(plan) {
|
|
|
21
22
|
return `unknown: ${plan.reason}`;
|
|
22
23
|
return `${plan.status}: ${plan.reason}; fallback: ${plan.fallback}`;
|
|
23
24
|
}
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
|
|
25
|
+
// What each hook event does for the owner: the first two make the client call Ocean, the
|
|
26
|
+
// last two put what happened in a session into Ocean.
|
|
27
|
+
const HOOK_ROLE = {
|
|
28
|
+
SessionStart: {
|
|
29
|
+
pillar: "trigger",
|
|
30
|
+
does: "session-start hook loads Ocean's context",
|
|
31
|
+
},
|
|
32
|
+
UserPromptSubmit: {
|
|
33
|
+
pillar: "trigger",
|
|
34
|
+
does: "prompt hook routes each prompt to a skill",
|
|
35
|
+
},
|
|
36
|
+
SessionEnd: {
|
|
37
|
+
pillar: "capture",
|
|
38
|
+
does: "session-end hook records each finished session",
|
|
39
|
+
},
|
|
40
|
+
PreCompact: {
|
|
41
|
+
pillar: "capture",
|
|
42
|
+
does: "pre-compact hook keeps facts before a long chat is compacted",
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
function hookLine(hook) {
|
|
46
|
+
const role = HOOK_ROLE[hook.event].does;
|
|
47
|
+
if (hook.status === "current")
|
|
48
|
+
return role;
|
|
49
|
+
if (hook.status === "change")
|
|
50
|
+
return `${role} (will add in ${hook.file})`;
|
|
51
|
+
return `${role} (hand edit needed: ${hook.reason}${hook.snippet ? `; add ${hook.snippet}` : ""})`;
|
|
52
|
+
}
|
|
53
|
+
function nativeLine(item) {
|
|
54
|
+
if (item.status === "current")
|
|
55
|
+
return `own memory governed: ${item.setting}`;
|
|
56
|
+
if (item.status === "change")
|
|
57
|
+
return `own memory: will set ${item.setting} in ${item.file}`;
|
|
58
|
+
if (item.status === "manual")
|
|
59
|
+
return `own memory: hand edit ${item.setting} in ${item.file} (${item.reason})`;
|
|
60
|
+
if (item.status === "capture")
|
|
61
|
+
return `own memory captured: ${item.reason}`;
|
|
62
|
+
if (item.status === "harvest")
|
|
63
|
+
return `own memory harvested: ${item.reason}`;
|
|
64
|
+
return `own memory NOT captured (${item.reason})`;
|
|
65
|
+
}
|
|
66
|
+
function ago(ts, now = Date.now()) {
|
|
67
|
+
const minutes = Math.max(0, Math.round((now - Date.parse(ts)) / 60_000));
|
|
68
|
+
if (minutes < 60)
|
|
69
|
+
return `${minutes}m`;
|
|
70
|
+
if (minutes < 48 * 60)
|
|
71
|
+
return `${Math.round(minutes / 60)}h`;
|
|
72
|
+
return `${Math.round(minutes / 1440)}d`;
|
|
73
|
+
}
|
|
74
|
+
// T-328 P5: one card per detected client — connect → trigger → capture → live. The capture
|
|
75
|
+
// lines are the consent: they say what flows into Ocean before the one question that allows it.
|
|
76
|
+
function clientCards(plans, hooks, native, lastCalls) {
|
|
77
|
+
const ids = [
|
|
78
|
+
...new Set([
|
|
79
|
+
...plans.map((plan) => plan.client),
|
|
80
|
+
...hooks.map((hook) => hook.client),
|
|
81
|
+
...native.map((item) => item.client),
|
|
82
|
+
]),
|
|
83
|
+
];
|
|
84
|
+
const lines = [];
|
|
85
|
+
const row = (pillar, items) => items.forEach((item, index) => {
|
|
86
|
+
lines.push(` ${(index ? "" : pillar).padEnd(8)} ${item}`);
|
|
87
|
+
});
|
|
88
|
+
for (const id of ids) {
|
|
89
|
+
const plan = plans.find((item) => item.client === id);
|
|
90
|
+
const own = hooks.filter((hook) => hook.client === id);
|
|
91
|
+
const memory = native.filter((item) => item.client === id);
|
|
92
|
+
lines.push(` ${plan?.label ?? id}`);
|
|
93
|
+
row("connect", [plan ? describeClient(plan) : "n/a"]);
|
|
94
|
+
const triggers = own
|
|
95
|
+
.filter((hook) => HOOK_ROLE[hook.event].pillar === "trigger")
|
|
96
|
+
.map(hookLine);
|
|
97
|
+
if (!triggers.length && plan && ["current", "change"].includes(plan.status))
|
|
98
|
+
triggers.push("server instructions: the model calls Ocean when your work comes up");
|
|
99
|
+
row("trigger", triggers.length ? triggers : ["none"]);
|
|
100
|
+
const captures = [
|
|
101
|
+
...own
|
|
102
|
+
.filter((hook) => HOOK_ROLE[hook.event].pillar === "capture")
|
|
103
|
+
.map(hookLine),
|
|
104
|
+
...memory.map(nativeLine),
|
|
105
|
+
];
|
|
106
|
+
if (!memory.length && plan?.nativeMemory === "none")
|
|
107
|
+
captures.push("it keeps no memory of its own");
|
|
108
|
+
row("capture", captures.length ? captures : ["nothing"]);
|
|
109
|
+
row("live", [
|
|
110
|
+
lastCalls[id]
|
|
111
|
+
? `last Ocean call ${ago(lastCalls[id])} ago`
|
|
112
|
+
: "no Ocean call recorded yet",
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
115
|
+
return lines;
|
|
116
|
+
}
|
|
117
|
+
// T-296 §3.7: one consolidated review of every detected client (MCP entry, session hooks and
|
|
118
|
+
// native memory), one confirmation for all of them. Without a terminal nothing is written:
|
|
119
|
+
// client configs change only on an explicit yes.
|
|
27
120
|
function connectStep(clients) {
|
|
28
121
|
return {
|
|
29
122
|
id: "connect",
|
|
@@ -43,46 +136,44 @@ function connectStep(clients) {
|
|
|
43
136
|
},
|
|
44
137
|
async run(io) {
|
|
45
138
|
const plans = (await clients.plan()).filter((plan) => plan.installed);
|
|
46
|
-
for (const plan of plans)
|
|
47
|
-
io.say(` ${plan.label.padEnd(34)} ${describeClient(plan)}`);
|
|
48
|
-
for (const plan of plans.filter((item) => item.status === "manual"))
|
|
49
|
-
io.say(` Hand edit for ${plan.label} (${plan.file}): add ${plan.snippet}`);
|
|
50
139
|
const hooks = await clients.hooks();
|
|
51
|
-
for (const hook of hooks)
|
|
52
|
-
io.say(` ${`${hook.client} ${hook.event} hook`.padEnd(34)} ${hook.status === "current"
|
|
53
|
-
? "present"
|
|
54
|
-
: hook.status === "change"
|
|
55
|
-
? `will add a ${hook.event} hook in ${hook.file}`
|
|
56
|
-
: `hand edit needed (${hook.reason})${hook.snippet ? `; add ${hook.snippet}` : ""}`}`);
|
|
57
140
|
const native = await clients.native();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
: item.status === "manual"
|
|
64
|
-
? `hand edit: ${item.setting} in ${item.file} (${item.reason})`
|
|
65
|
-
: item.status === "capture"
|
|
66
|
-
? `captured: ${item.reason}`
|
|
67
|
-
: `you: ${item.reason}`}`);
|
|
141
|
+
io.say(" Per client: connect → trigger → capture → live. What is captured stays in ~/ocean on this machine.");
|
|
142
|
+
for (const line of clientCards(plans, hooks, native, (await clients.lastCalls?.()) ?? {}))
|
|
143
|
+
io.say(line);
|
|
144
|
+
for (const plan of plans.filter((item) => item.status === "manual"))
|
|
145
|
+
io.say(` Hand edit for ${plan.label} (${plan.file}): add ${plan.snippet}`);
|
|
68
146
|
const pending = plans.filter((plan) => plan.status === "change");
|
|
69
147
|
const pendingHooks = hooks.filter((hook) => hook.status === "change");
|
|
70
148
|
const pendingNative = native.filter((item) => item.status === "change");
|
|
149
|
+
const detectorPending = (await clients.detector?.())?.some((plan) => plan.status === "change");
|
|
150
|
+
// Asked on its own, after the client changes, so declining it never blocks them.
|
|
151
|
+
const offerDetector = async (batch) => {
|
|
152
|
+
if (!detectorPending || !clients.applyDetector)
|
|
153
|
+
return;
|
|
154
|
+
if (!io.interactive || !(await yes(io, DETECTOR_QUESTION)))
|
|
155
|
+
return;
|
|
156
|
+
for (const { result } of await clients.applyDetector(batch))
|
|
157
|
+
io.say(` client detector: ${result}`);
|
|
158
|
+
};
|
|
71
159
|
if (pending.length + pendingHooks.length + pendingNative.length === 0) {
|
|
72
160
|
io.say(" Every client Ocean can wire is already connected.");
|
|
161
|
+
await offerDetector();
|
|
73
162
|
return "done";
|
|
74
163
|
}
|
|
75
164
|
if (!io.interactive) {
|
|
76
165
|
io.say(" Review: ocean clients plan Apply: ocean clients apply --yes");
|
|
77
166
|
return "skipped";
|
|
78
167
|
}
|
|
79
|
-
|
|
168
|
+
io.say(" Before each edit the whole config is saved next to it as <file>.ocean-backup-<batch>; `ocean uninstall` puts everything back.");
|
|
169
|
+
if (!(await yes(io, ` Apply these changes and allow the capture above (${pending.length} MCP entries, ${pendingHooks.length} session hooks, ${pendingNative.length} native-memory settings)?`)))
|
|
80
170
|
return "skipped";
|
|
81
171
|
const { batch, results } = await clients.apply(pending.map((plan) => plan.client));
|
|
82
172
|
for (const { client, event, result } of await clients.applyHooks(batch))
|
|
83
173
|
io.say(` ${client} ${event} hook: ${result}`);
|
|
84
174
|
for (const { client, result } of await clients.applyNative(batch))
|
|
85
175
|
io.say(` ${client} native memory: ${result}`);
|
|
176
|
+
await offerDetector(batch);
|
|
86
177
|
io.say(` Undo with: ocean clients restore --batch ${batch}`);
|
|
87
178
|
for (const { client, result } of results) {
|
|
88
179
|
if (result !== "written") {
|
|
@@ -100,7 +191,7 @@ function connectStep(clients) {
|
|
|
100
191
|
// Claude chat (Desktop, claude.ai, phone) runs no hooks and drops MCP instructions, so Ocean's
|
|
101
192
|
// rule reaches it as a skill uploaded to the account (T-328). Uploading has no API: the one step
|
|
102
193
|
// left to the owner is an upload and a few clicks, set up here.
|
|
103
|
-
|
|
194
|
+
function chatPluginStep(chat = {
|
|
104
195
|
added: () => chatPluginAdded(),
|
|
105
196
|
open: () => openChatPluginSetup(),
|
|
106
197
|
}) {
|
|
@@ -278,7 +369,7 @@ export function buildSteps(deps) {
|
|
|
278
369
|
},
|
|
279
370
|
guided("hooks", "SessionStart auto-sync hook", [
|
|
280
371
|
"Add before the exec in your session-bootstrap hook:",
|
|
281
|
-
'node "$HOME/ocean/kernel/packages/
|
|
372
|
+
'node "$HOME/ocean/kernel/packages/cli/dist/main.js" client sync >/dev/null 2>&1 &',
|
|
282
373
|
]),
|
|
283
374
|
guided("service", "Background service and schedules", [
|
|
284
375
|
"Run: ocean service (and ocean schedule for recurring jobs)",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { oceanPath, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
|
|
3
|
+
// A pattern has to repeat before it is a finding: one odd session is noise.
|
|
4
|
+
const REPEAT = 3;
|
|
5
|
+
const bump = (counts, key) => {
|
|
6
|
+
counts[key] = (counts[key] ?? 0) + 1;
|
|
7
|
+
};
|
|
8
|
+
export function selectionsLog() {
|
|
9
|
+
return oceanPath(SYSTEM_DIR, "state", "profiles", "selections.jsonl");
|
|
10
|
+
}
|
|
11
|
+
export function profileDoctor(text, known, options = {}) {
|
|
12
|
+
const days = options.days ?? 30;
|
|
13
|
+
const since = (options.now ?? new Date()).getTime() - days * 86_400_000;
|
|
14
|
+
const names = new Set(known);
|
|
15
|
+
const report = {
|
|
16
|
+
log: options.log ?? "bridge/state/profiles/selections.jsonl",
|
|
17
|
+
days,
|
|
18
|
+
lines: 0,
|
|
19
|
+
sessions: 0,
|
|
20
|
+
tasks: 0,
|
|
21
|
+
unreadable: 0,
|
|
22
|
+
byProfile: {},
|
|
23
|
+
byConfidence: {},
|
|
24
|
+
findings: [],
|
|
25
|
+
};
|
|
26
|
+
const unknown = {};
|
|
27
|
+
// Per bound project: sessions, those that matched nothing, and secondaries added by prompts.
|
|
28
|
+
const projects = new Map();
|
|
29
|
+
const overrides = {};
|
|
30
|
+
for (const raw of text.split("\n")) {
|
|
31
|
+
if (!raw.trim())
|
|
32
|
+
continue;
|
|
33
|
+
let line;
|
|
34
|
+
try {
|
|
35
|
+
line = JSON.parse(raw);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
report.unreadable += 1;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const at = line.ts ? Date.parse(line.ts) : Number.NaN;
|
|
42
|
+
if (Number.isNaN(at) || at < since)
|
|
43
|
+
continue;
|
|
44
|
+
report.lines += 1;
|
|
45
|
+
const profile = line.profile ?? "?";
|
|
46
|
+
bump(report.byProfile, profile);
|
|
47
|
+
if (names.size && !names.has(profile))
|
|
48
|
+
bump(unknown, profile);
|
|
49
|
+
if (line.task) {
|
|
50
|
+
report.tasks += 1;
|
|
51
|
+
const suggested = line.suggested?.profile;
|
|
52
|
+
if (line.override && suggested && suggested !== profile) {
|
|
53
|
+
const pair = `${suggested} → ${profile}`;
|
|
54
|
+
overrides[pair] = [...(overrides[pair] ?? []), line.task];
|
|
55
|
+
}
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
report.sessions += 1;
|
|
59
|
+
bump(report.byConfidence, line.confidence ?? "?");
|
|
60
|
+
const project = line.project;
|
|
61
|
+
if (!project || project === "unbound")
|
|
62
|
+
continue;
|
|
63
|
+
const entry = projects.get(project) ?? {
|
|
64
|
+
sessions: 0,
|
|
65
|
+
unmatched: 0,
|
|
66
|
+
secondary: {},
|
|
67
|
+
};
|
|
68
|
+
entry.sessions += 1;
|
|
69
|
+
if (line.confidence === "none")
|
|
70
|
+
entry.unmatched += 1;
|
|
71
|
+
for (const name of line.secondary ?? [])
|
|
72
|
+
bump(entry.secondary, name);
|
|
73
|
+
projects.set(project, entry);
|
|
74
|
+
}
|
|
75
|
+
for (const [profile, count] of Object.entries(unknown))
|
|
76
|
+
report.findings.push({
|
|
77
|
+
kind: "unknown-profile",
|
|
78
|
+
count,
|
|
79
|
+
detail: `${count} selections name ${profile}, which no installed profile is called`,
|
|
80
|
+
suggestion: "older lines from before a rename are harmless; if new ones keep coming, run `ocean profiles validate`",
|
|
81
|
+
});
|
|
82
|
+
for (const [project, entry] of projects) {
|
|
83
|
+
if (entry.unmatched >= REPEAT && entry.unmatched === entry.sessions)
|
|
84
|
+
report.findings.push({
|
|
85
|
+
kind: "unrouted-project",
|
|
86
|
+
count: entry.unmatched,
|
|
87
|
+
detail: `every session in ${project} (${entry.sessions}) matched nothing and fell back to base`,
|
|
88
|
+
suggestion: `bind it to a profile: \`ocean project register\` fills project.json profiles from its signals, or set profiles in ${project}'s project.json`,
|
|
89
|
+
});
|
|
90
|
+
for (const [secondary, count] of Object.entries(entry.secondary))
|
|
91
|
+
if (count >= REPEAT)
|
|
92
|
+
report.findings.push({
|
|
93
|
+
kind: "recurring-secondary",
|
|
94
|
+
count,
|
|
95
|
+
detail: `prompts in ${project} added ${secondary} as a secondary profile ${count} times`,
|
|
96
|
+
suggestion: `add ${secondary} to ${project}'s project.json profiles so its tools are there from the start`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
for (const [pair, tasks] of Object.entries(overrides))
|
|
100
|
+
if (tasks.length >= 2)
|
|
101
|
+
report.findings.push({
|
|
102
|
+
kind: "task-override",
|
|
103
|
+
count: tasks.length,
|
|
104
|
+
detail: `tasks were moved ${pair} by hand ${tasks.length} times (${tasks.slice(-3).join(", ")})`,
|
|
105
|
+
suggestion: `add a trigger from those tasks' titles to ${pair.split(" → ")[1]}'s triggers`,
|
|
106
|
+
});
|
|
107
|
+
report.findings.sort((a, b) => b.count - a.count);
|
|
108
|
+
return report;
|
|
109
|
+
}
|
|
110
|
+
export async function readSelections(log = selectionsLog()) {
|
|
111
|
+
try {
|
|
112
|
+
return await readFile(log, "utf8");
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return "";
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=profile-doctor.js.map
|