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