@amoree-code/ocean 2.23.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -53
- package/dist/application/clients/bundles.js +1 -1
- package/dist/application/clients/client-detect.js +291 -0
- package/dist/application/clients/clients.js +104 -25
- package/dist/application/clients/desktop-link.js +40 -0
- package/dist/application/clients/desktop-watcher.js +6 -4
- package/dist/application/clients/hook-trust.js +106 -0
- package/dist/application/clients/hooks.js +7 -1
- package/dist/application/clients/mcp-schema-cost.js +74 -0
- package/dist/application/clients/native.js +38 -2
- package/dist/application/clients/registry.js +51 -9
- package/dist/application/clients/status.js +7 -2
- package/dist/application/gateway/webhook-gateway.js +1 -1
- package/dist/application/integrations/charter-copies.js +1 -1
- package/dist/application/integrations/engine-entry-repair.js +4 -3
- package/dist/application/integrations/skill-auto-sync.js +2 -2
- package/dist/application/integrations/skill-filter.js +1 -1
- package/dist/application/integrations/skill-router.js +134 -90
- package/dist/application/layout/layout-apply.js +1 -1
- package/dist/application/layout/workspace-template.js +1 -1
- package/dist/application/onboarding/steps.js +121 -30
- package/dist/application/profiles/profile-doctor.js +118 -0
- package/dist/application/profiles/profile-migration-service.js +208 -0
- package/dist/application/profiles/profile-suggestion.js +3 -7
- package/dist/application/profiles/profile-upgrade-service.js +98 -86
- package/dist/application/pull/history-index.js +1 -1
- package/dist/application/pull/project-match.js +3 -3
- package/dist/application/pull/pull.js +1 -1
- package/dist/application/pull/server-capture.js +92 -9
- package/dist/application/scheduler/local-scheduler.js +2 -2
- package/dist/application/spend/claude-prices.js +55 -0
- package/dist/application/spend/claude-spend.js +365 -0
- package/dist/application/uninstall/uninstall.js +25 -3
- package/dist/application/upkeep/nightly-upkeep.js +4 -4
- package/dist/composition/runtime.js +2 -2
- package/dist/infrastructure/desktop/claude-export.js +1 -1
- package/dist/infrastructure/desktop/desktop-chat.js +60 -13
- package/dist/infrastructure/desktop/indexeddb.js +4 -4
- package/dist/infrastructure/desktop/leveldb.js +2 -2
- package/dist/infrastructure/filesystem/profile-loader.js +3 -45
- package/dist/infrastructure/filesystem/runtime-config-loader.js +1 -1
- package/dist/infrastructure/observability/runtime-logger.js +1 -1
- package/dist/infrastructure/process/agent-tool-executor.js +3 -3
- package/dist/infrastructure/process/process-supervisor.js +1 -1
- package/dist/infrastructure/process/service.js +8 -8
- package/dist/infrastructure/providers/openai-compatible.js +2 -2
- package/dist/infrastructure/providers/provider-invocation.js +1 -1
- package/dist/infrastructure/providers/session-facts-completer.js +78 -5
- package/dist/interfaces/cli/auth-command.js +2 -2
- package/dist/interfaces/cli/brief-command.js +1 -1
- package/dist/interfaces/cli/browser-command.js +6 -6
- package/dist/interfaces/cli/browser-findings.js +6 -9
- package/dist/interfaces/cli/browser-settings.js +10 -10
- package/dist/interfaces/cli/capture-command.js +6 -6
- package/dist/interfaces/cli/client-test-command.js +3 -3
- package/dist/interfaces/cli/clients-command.js +33 -6
- package/dist/interfaces/cli/command-aliases.js +56 -0
- package/dist/interfaces/cli/command-registry.js +48 -1414
- package/dist/interfaces/cli/commands/browser.js +5 -0
- package/dist/interfaces/cli/commands/capture.js +19 -0
- package/dist/interfaces/cli/commands/catalog.js +9 -0
- package/dist/interfaces/cli/commands/client.js +135 -0
- package/dist/interfaces/cli/commands/clients.js +33 -0
- package/dist/interfaces/cli/commands/connectors.js +14 -0
- package/dist/interfaces/cli/commands/context.js +9 -0
- package/dist/interfaces/cli/commands/cost.js +15 -0
- package/dist/interfaces/cli/commands/daily.js +11 -0
- package/dist/interfaces/cli/commands/day.js +25 -0
- package/dist/interfaces/cli/commands/dispatch.js +31 -0
- package/dist/interfaces/cli/commands/doctor.js +60 -0
- package/dist/interfaces/cli/commands/env.js +5 -0
- package/dist/interfaces/cli/commands/gateway.js +16 -0
- package/dist/interfaces/cli/commands/handoff.js +11 -0
- package/dist/interfaces/cli/commands/health.js +17 -0
- package/dist/interfaces/cli/commands/hook.js +142 -0
- package/dist/interfaces/cli/commands/idea.js +11 -0
- package/dist/interfaces/cli/commands/install.js +31 -0
- package/dist/interfaces/cli/commands/intent.js +14 -0
- package/dist/interfaces/cli/commands/intercept.js +22 -0
- package/dist/interfaces/cli/commands/layout.js +11 -0
- package/dist/interfaces/cli/commands/lifecycle.js +5 -0
- package/dist/interfaces/cli/commands/loop.js +73 -0
- package/dist/interfaces/cli/commands/market.js +11 -0
- package/dist/interfaces/cli/commands/mcp.js +57 -0
- package/dist/interfaces/cli/commands/memory.js +5 -0
- package/dist/interfaces/cli/commands/migrate.js +5 -0
- package/dist/interfaces/cli/commands/observe.js +11 -0
- package/dist/interfaces/cli/commands/obsidian.js +111 -0
- package/dist/interfaces/cli/commands/operate.js +7 -0
- package/dist/interfaces/cli/commands/policy.js +16 -0
- package/dist/interfaces/cli/commands/project.js +207 -0
- package/dist/interfaces/cli/commands/repair.js +20 -0
- package/dist/interfaces/cli/commands/run.js +52 -0
- package/dist/interfaces/cli/commands/schedule.js +58 -0
- package/dist/interfaces/cli/commands/service.js +21 -0
- package/dist/interfaces/cli/commands/session.js +182 -0
- package/dist/interfaces/cli/commands/sessions.js +12 -0
- package/dist/interfaces/cli/commands/setup.js +21 -0
- package/dist/interfaces/cli/commands/skill.js +159 -0
- package/dist/interfaces/cli/commands/tasks.js +10 -0
- package/dist/interfaces/cli/commands/update-remove.js +25 -0
- package/dist/interfaces/cli/connectors-command.js +150 -0
- package/dist/interfaces/cli/context-command.js +39 -3
- package/dist/interfaces/cli/cost-command.js +104 -0
- package/dist/interfaces/cli/curator-command.js +1 -1
- package/dist/interfaces/cli/daily-command.js +7 -1
- package/dist/interfaces/cli/desktop-command.js +43 -7
- package/dist/interfaces/cli/distill-command.js +7 -2
- package/dist/interfaces/cli/express-command.js +1 -1
- package/dist/interfaces/cli/failures-command.js +4 -4
- package/dist/interfaces/cli/gateway-findings.js +2 -2
- package/dist/interfaces/cli/governance-command.js +23 -16
- package/dist/interfaces/cli/handoff-command.js +1 -1
- package/dist/interfaces/cli/harvest-command.js +2 -2
- package/dist/interfaces/cli/help-command.js +53 -169
- package/dist/interfaces/cli/hygiene-command.js +1 -1
- package/dist/interfaces/cli/idea-command.js +1 -1
- package/dist/interfaces/cli/intercept-command.js +8 -7
- package/dist/interfaces/cli/interests-command.js +1 -1
- package/dist/interfaces/cli/layout-command.js +2 -0
- package/dist/interfaces/cli/market-command.js +9 -9
- package/dist/interfaces/cli/mcp-gateway-command.js +124 -7
- package/dist/interfaces/cli/mcp-probe-command.js +186 -0
- package/dist/interfaces/cli/mcp-status-command.js +5 -5
- package/dist/interfaces/cli/memory-command.js +41 -7
- package/dist/interfaces/cli/migrate-command.js +2 -2
- package/dist/interfaces/cli/note-command.js +1 -1
- package/dist/interfaces/cli/onboard-command.js +14 -0
- package/dist/interfaces/cli/operate-command.js +5 -5
- package/dist/interfaces/cli/profiles-command.js +61 -1
- package/dist/interfaces/cli/rhythm-command.js +11 -5
- package/dist/interfaces/cli/running-server-findings.js +1 -1
- package/dist/interfaces/cli/scorecard-command.js +8 -8
- package/dist/interfaces/cli/session-facts-command.js +2 -2
- package/dist/interfaces/cli/sessions-command.js +145 -0
- package/dist/interfaces/cli/setup-command.js +15 -2
- package/dist/interfaces/cli/tasks-command.js +63 -13
- package/dist/interfaces/cli/telemetry-command.js +4 -4
- package/dist/interfaces/cli/uninstall-command.js +1 -1
- package/dist/interfaces/cli/week-failures.js +32 -0
- package/dist/main.js +12 -0
- package/node_modules/@ocean/brain/dist/{infrastructure/brain/brain-index.js → brain-index.js} +2 -2
- package/node_modules/@ocean/brain/dist/{brain/brain-markdown.js → brain-markdown.js} +1 -1
- package/node_modules/@ocean/brain/dist/{brain/brain-service.js → brain-service.js} +12 -2
- package/node_modules/@ocean/brain/dist/memory/brain-dump.js +92 -16
- package/node_modules/@ocean/brain/dist/memory/extraction-log.js +125 -0
- package/node_modules/@ocean/brain/dist/memory/extraction-retry.js +54 -0
- package/node_modules/@ocean/brain/dist/memory/fact-routing.js +44 -1
- package/node_modules/@ocean/brain/dist/memory/lesson-activation.js +2 -2
- package/node_modules/@ocean/brain/dist/memory/lesson-learning.js +2 -2
- package/node_modules/@ocean/brain/dist/memory/lessons.js +1 -1
- package/node_modules/@ocean/brain/dist/memory/memory-audit.js +2 -2
- package/node_modules/@ocean/brain/dist/memory/memory-harvest.js +1 -1
- package/node_modules/@ocean/brain/dist/memory/memory-paths.js +8 -0
- package/node_modules/@ocean/brain/dist/memory/memory-review.js +31 -3
- package/node_modules/@ocean/brain/dist/memory/memory-trash.js +29 -0
- package/node_modules/@ocean/brain/dist/memory/memory-write.js +4 -2
- package/node_modules/@ocean/brain/dist/memory/model-narrative.js +2 -2
- package/node_modules/@ocean/brain/dist/memory/profile-facts.js +1 -1
- package/node_modules/@ocean/brain/dist/memory/routing.json +6 -6
- package/node_modules/@ocean/{market/dist/skills → brain/dist/memory}/signal-detection.js +1 -1
- package/node_modules/@ocean/brain/dist/{memory → people}/people.js +1 -1
- package/node_modules/@ocean/brain/dist/sessions-capture/session-facts.js +625 -0
- package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-promotion.js +7 -15
- package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-summary.js +1 -1
- package/node_modules/@ocean/brain/dist/sessions-capture/session-triage.js +52 -0
- package/node_modules/@ocean/brain/package.json +1 -1
- package/node_modules/@ocean/connect/dist/connectors/connector-hub.js +173 -0
- package/node_modules/@ocean/{market → connect}/dist/install/default-marketplace.js +6 -2
- package/node_modules/@ocean/{market → connect}/dist/install/marketplace-service.js +1 -1
- package/node_modules/@ocean/connect/dist/mcp/mcp-gateway.js +987 -0
- package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-launch.js +102 -5
- package/node_modules/@ocean/{market → connect}/dist/registry/official-registry.js +1 -1
- package/node_modules/@ocean/{market → connect}/dist/security/permissions.js +1 -1
- package/node_modules/@ocean/{market → connect}/dist/skills/skill-hub.js +104 -6
- package/node_modules/@ocean/{market → connect}/package.json +2 -2
- package/node_modules/@ocean/context/dist/{context/context-ladder.js → context-ladder.js} +3 -3
- package/node_modules/@ocean/context/dist/{context/context-references.js → context-references.js} +5 -4
- package/node_modules/@ocean/context/dist/{context/context-cost.js → context-size.js} +6 -6
- package/node_modules/@ocean/context/dist/{context/intent-router.js → intent-router.js} +1 -1
- package/node_modules/@ocean/context/dist/{context/resource-injection.js → resource-injection.js} +3 -1
- package/node_modules/@ocean/context/package.json +1 -1
- package/node_modules/@ocean/core/dist/domain/brain/brain-record.js +1 -1
- package/node_modules/@ocean/core/dist/domain/capabilities/capability-manifest.js +5 -5
- package/node_modules/@ocean/core/dist/domain/connector-entry.js +86 -0
- package/node_modules/@ocean/core/dist/domain/context/context.js +1 -1
- package/node_modules/@ocean/core/dist/domain/context/project-id.js +8 -2
- package/node_modules/@ocean/core/dist/domain/{evidence/evidence.js → evidence.js} +1 -1
- package/node_modules/@ocean/core/dist/domain/mcp/memory-contract.js +4 -1
- package/node_modules/@ocean/core/dist/domain/ports/brain-index-port.js +1 -1
- package/node_modules/@ocean/core/dist/domain/profiles/profile-markdown.js +40 -0
- package/node_modules/@ocean/core/dist/domain/profiles/profile-resolution.js +276 -0
- package/node_modules/@ocean/core/dist/domain/profiles/profile-selection.js +23 -60
- package/node_modules/@ocean/core/dist/domain/profiles/profile-upgrade.js +2 -2
- package/node_modules/@ocean/core/dist/domain/profiles/profile.js +66 -6
- package/node_modules/@ocean/core/dist/domain/profiles/runtime-config.js +1 -1
- package/node_modules/@ocean/core/dist/domain/runs/agent-tools.js +2 -2
- package/node_modules/@ocean/core/dist/domain/sessions/session-identity.js +53 -0
- package/node_modules/@ocean/core/dist/domain/sessions/session-metadata.js +208 -0
- package/node_modules/@ocean/core/dist/domain/{tasks/task-id.js → task-id.js} +2 -2
- package/node_modules/@ocean/core/dist/profiles/profile-files.js +57 -0
- package/node_modules/@ocean/core/dist/profiles/profile-loader.js +97 -0
- package/node_modules/@ocean/core/dist/profiles/project-profile-fill.js +33 -0
- package/node_modules/@ocean/core/dist/profiles/session-profile.js +158 -0
- package/node_modules/@ocean/core/dist/shared/charter.js +110 -0
- package/node_modules/@ocean/core/dist/shared/context-ack.js +1 -1
- package/node_modules/@ocean/core/dist/shared/context-triggers.js +67 -0
- package/node_modules/@ocean/core/dist/shared/paths.js +6 -6
- package/node_modules/@ocean/core/dist/shared/project-legacy.js +232 -0
- package/node_modules/@ocean/core/dist/shared/project-manifest.js +308 -0
- package/node_modules/@ocean/core/dist/shared/project-names.js +87 -0
- package/node_modules/@ocean/core/dist/shared/project-register.js +560 -0
- package/node_modules/@ocean/core/dist/shared/project-resolution.js +83 -861
- package/node_modules/@ocean/core/dist/shared/repo-signals.js +45 -0
- package/node_modules/@ocean/core/dist/shared/task-reference.js +1 -1
- package/node_modules/@ocean/core/dist/shared/text-tokens.js +37 -0
- package/node_modules/@ocean/core/dist/shared/tool-groups.js +224 -0
- package/node_modules/@ocean/core/package.json +4 -1
- package/node_modules/@ocean/services/dist/day/day.js +45 -3
- package/node_modules/@ocean/services/dist/{distill → day}/distill.js +29 -3
- package/node_modules/@ocean/services/dist/{harvest → day}/harvest.js +54 -14
- package/node_modules/@ocean/services/dist/{brief → day}/interest-discovery.js +3 -3
- package/node_modules/@ocean/services/dist/day/note.js +2 -2
- package/node_modules/@ocean/services/dist/{onboarding → day}/onboarding.js +1 -1
- package/node_modules/@ocean/services/dist/day/patterns.js +68 -0
- package/node_modules/@ocean/services/dist/{curator → health}/curator.js +5 -5
- package/node_modules/@ocean/services/dist/{journey → health}/failures.js +7 -5
- package/node_modules/@ocean/services/dist/{hygiene → health}/hygiene.js +2 -2
- package/node_modules/@ocean/services/dist/{journey → health}/lesson-effect.js +1 -1
- package/node_modules/@ocean/services/dist/{scorecard → health}/scorecard.js +3 -3
- package/node_modules/@ocean/services/dist/{upkeep → health}/upkeep.js +2 -2
- package/node_modules/@ocean/services/dist/{doctor → health}/workspace-doctor.js +57 -17
- package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-session.js +1 -1
- package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/call-ledger.js +3 -0
- package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-client.js +19 -3
- package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/obsidian-server.js +4 -4
- package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/ocean-server.js +423 -34
- package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/conflict-log.js +1 -1
- package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/folder-templates.js +8 -5
- package/node_modules/@ocean/services/dist/projects/project-doctor.js +173 -0
- package/node_modules/@ocean/services/dist/projects/project-snippet.js +9 -0
- package/node_modules/@ocean/services/dist/projects/projects-overview.js +2 -2
- package/node_modules/@ocean/services/package.json +1 -1
- package/node_modules/@ocean/{loop/dist/loops → work/dist/runs}/guard-runtime.js +3 -3
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/memory-knowledge-operations.js +4 -12
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-contract.js +2 -2
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/project-operations.js +2 -1
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/task-operations.js +4 -4
- package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/write-guard.js +1 -1
- package/node_modules/@ocean/{loop → work}/dist/runs/prompt-assembly.js +2 -2
- package/node_modules/@ocean/{loop → work}/dist/runs/run-agent.js +4 -4
- package/node_modules/@ocean/{loop → work}/dist/runs/tool-loop.js +4 -4
- package/node_modules/@ocean/work/dist/sessions/hooks/desktop-facts.js +309 -0
- package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-end-hook.js +36 -5
- package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-facts-hook.js +144 -14
- package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-start-hook.js +129 -12
- package/node_modules/@ocean/work/dist/sessions/hooks/start-brief.js +110 -0
- package/node_modules/@ocean/work/dist/sessions/hooks/unlinked-warning.js +68 -0
- package/node_modules/@ocean/{loop → work}/dist/sessions/session-closeout.js +4 -4
- package/node_modules/@ocean/{loop → work}/dist/sessions/session-projects.js +13 -3
- package/node_modules/@ocean/work/dist/sessions/session-relink.js +300 -0
- package/node_modules/@ocean/{loop → work}/dist/sessions/session-retention.js +1 -1
- package/node_modules/@ocean/{loop → work}/dist/tasks/list-tasks.js +7 -2
- package/node_modules/@ocean/{loop → work}/dist/tasks/renumber-tasks.js +4 -2
- package/node_modules/@ocean/{loop → work}/dist/tasks/session-task.js +2 -2
- package/node_modules/@ocean/{loop → work}/dist/tasks/sync-task-prs.js +77 -7
- package/node_modules/@ocean/work/dist/tasks/task-git.js +63 -0
- package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop.js +4 -4
- package/node_modules/@ocean/{loop → work}/dist/tasks/verification-readiness.js +1 -1
- package/node_modules/@ocean/{loop → work}/dist/tasks/verify-task.js +1 -1
- package/node_modules/@ocean/{loop → work}/package.json +2 -2
- package/ocean-marketplace.json +41 -41
- package/package.json +12 -11
- package/skills/core/daily-harvest/SKILL.md +1 -1
- package/skills/core/ocean-memory/SKILL.md +4 -0
- package/skills/core/use-browser/SKILL.md +30 -7
- package/skills/index.json +1 -1
- package/templates/profiles/default.md +44 -0
- package/templates/profiles/developer.md +45 -0
- package/templates/profiles/reviewer.md +44 -0
- package/templates/profiles/strategist.md +44 -0
- package/templates/profiles-v3/analysis.md +16 -0
- package/templates/profiles-v3/backend.md +16 -0
- package/templates/profiles-v3/base.md +57 -0
- package/templates/profiles-v3/code-review.md +16 -0
- package/templates/profiles-v3/devops.md +16 -0
- package/templates/profiles-v3/docs-office.md +16 -0
- package/templates/profiles-v3/frontend.md +16 -0
- package/templates/profiles-v3/learning.md +16 -0
- package/templates/profiles-v3/marketing-ads.md +16 -0
- package/templates/profiles-v3/marketing-content-seo.md +16 -0
- package/templates/profiles-v3/ocean-ops.md +16 -0
- package/templates/profiles-v3/product-strategy.md +16 -0
- package/templates/profiles-v3/qa-testing.md +16 -0
- package/templates/profiles-v3/security.md +16 -0
- package/templates/workspace/MANIFEST.json +1 -0
- package/templates/workspace/charter/core.md +22 -90
- package/templates/workspace/charter/policies/README.md +7 -1
- package/templates/workspace/charter/policies/claude-code-context.md +6 -1
- package/templates/workspace/charter/policies/concise-output.md +5 -0
- package/templates/workspace/charter/policies/context.md +5 -0
- package/templates/workspace/charter/policies/contracts/task.md +2 -2
- package/templates/workspace/charter/policies/git.md +5 -0
- package/templates/workspace/charter/policies/graph.md +6 -1
- package/templates/workspace/charter/policies/knowledge.md +11 -4
- package/templates/workspace/charter/policies/layout.md +23 -0
- package/templates/workspace/charter/policies/lifecycle.md +5 -0
- package/templates/workspace/charter/policies/memory.md +5 -0
- package/templates/workspace/charter/policies/minimal-change.md +5 -0
- package/templates/workspace/charter/policies/models.md +5 -0
- package/templates/workspace/charter/policies/response.md +5 -0
- package/templates/workspace/charter/policies/skill-observer.md +12 -0
- package/templates/workspace/charter/policies/stack.md +5 -0
- package/templates/workspace/charter/policies/task.md +17 -3
- package/templates/workspace/charter/policies/verification.md +5 -0
- package/node_modules/@ocean/brain/dist/evidence/verification-report.js +0 -13
- package/node_modules/@ocean/brain/dist/memory/daily-narrative.js +0 -142
- package/node_modules/@ocean/brain/dist/memory/session-facts.js +0 -283
- package/node_modules/@ocean/context/dist/context/context-compression.js +0 -66
- package/node_modules/@ocean/loop/dist/hooks/desktop-facts.js +0 -174
- package/node_modules/@ocean/loop/dist/operations/task-linker.js +0 -40
- package/node_modules/@ocean/loop/dist/sessions/session-pointer.js +0 -133
- package/node_modules/@ocean/loop/dist/tasks/task-git.js +0 -28
- package/node_modules/@ocean/market/dist/mcp/mcp-gateway.js +0 -533
- package/templates/profiles/default.json +0 -51
- package/templates/profiles/developer.json +0 -51
- package/templates/profiles/reviewer.json +0 -51
- package/templates/profiles/strategist.json +0 -51
- /package/node_modules/@ocean/brain/dist/{brain/brain-eval.js → brain-eval.js} +0 -0
- /package/node_modules/@ocean/brain/dist/{brain/brain-reindex.js → brain-reindex.js} +0 -0
- /package/node_modules/@ocean/brain/dist/{capture → sessions-capture}/inbox-sync.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/adapters/mcp-adapter.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/adapters/owned-directory.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/adapters/plugin-adapter.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/adapters/skill-adapter.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/capability/adapter.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/capability/catalog.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/capability/content-digest.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/capability/registry.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/install/lock.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/install/own-server.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/mcp/chrome-debugging.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-connection.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-runner.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/security/description-scan.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/security/secrets.js +0 -0
- /package/node_modules/@ocean/{market → connect}/dist/skills/core-skill-sync.js +0 -0
- /package/node_modules/@ocean/context/dist/{context/context-packet.js → context-packet.js} +0 -0
- /package/node_modules/@ocean/core/dist/domain/{process/process-events.js → process-events.js} +0 -0
- /package/node_modules/@ocean/core/dist/domain/{redaction/redaction.js → redaction.js} +0 -0
- /package/node_modules/@ocean/services/dist/{brief → day}/brief.js +0 -0
- /package/node_modules/@ocean/services/dist/{express → day}/express.js +0 -0
- /package/node_modules/@ocean/services/dist/{brief → day}/source-registry.json +0 -0
- /package/node_modules/@ocean/services/dist/{journey → health}/telemetry.js +0 -0
- /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-service.js +0 -0
- /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-task-runner.js +0 -0
- /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-session.js +0 -0
- /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/server-version.js +0 -0
- /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/tool-registry.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/inbox-promotion.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-discovery.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-ingestion.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-sync.js +0 -0
- /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-writer.js +0 -0
- /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-scope.js +0 -0
- /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-io.js +0 -0
- /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-operations.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/runs/run-authorization.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/runs/session-tokens.js +0 -0
- /package/node_modules/@ocean/{loop/dist/handoff → work/dist/sessions}/handoff-service.js +0 -0
- /package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/lifecycle-hooks.js +0 -0
- /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-store.js +0 -0
- /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-validator.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/archive-tasks.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/checkpoint-task.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/claim-task.js +0 -0
- /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/iteration-graph.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/new-task.js +0 -0
- /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop-record.js +0 -0
- /package/node_modules/@ocean/{loop → work}/dist/tasks/task-verification.js +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { extractionLogFile, readExtractionLog, summarizeCost, } from "@ocean/brain/memory/extraction-log.js";
|
|
2
|
+
import { applyRelink, planRelink, } from "@ocean/work/sessions/session-relink.js";
|
|
3
|
+
import { openSessionStoreReadOnly } from "@ocean/work/sessions/session-store.js";
|
|
4
|
+
const usage = [
|
|
5
|
+
"Usage: ocean sessions cost [--days N] [--weeks N] [--json]",
|
|
6
|
+
" ocean sessions relink (--dry-run | --yes) [--json]",
|
|
7
|
+
].join("\n");
|
|
8
|
+
const count = (args, flag, fallback) => {
|
|
9
|
+
const index = args.indexOf(flag);
|
|
10
|
+
const value = index >= 0 ? Number(args[index + 1]) : fallback;
|
|
11
|
+
return Number.isInteger(value) && value > 0 && value <= 366
|
|
12
|
+
? value
|
|
13
|
+
: fallback;
|
|
14
|
+
};
|
|
15
|
+
const seconds = (ms) => {
|
|
16
|
+
const total = Math.round(ms / 1000);
|
|
17
|
+
return total >= 60
|
|
18
|
+
? `${Math.floor(total / 60)}m ${String(total % 60).padStart(2, "0")}s`
|
|
19
|
+
: `${total}s`;
|
|
20
|
+
};
|
|
21
|
+
function table(title, rows) {
|
|
22
|
+
const header = [
|
|
23
|
+
title,
|
|
24
|
+
"calls",
|
|
25
|
+
"failed",
|
|
26
|
+
"repeats",
|
|
27
|
+
"input chars",
|
|
28
|
+
"in tokens",
|
|
29
|
+
"out tokens",
|
|
30
|
+
"measured",
|
|
31
|
+
"time",
|
|
32
|
+
];
|
|
33
|
+
const lines = rows.map((row) => [
|
|
34
|
+
row.period,
|
|
35
|
+
String(row.calls),
|
|
36
|
+
String(row.failed),
|
|
37
|
+
String(row.repeats),
|
|
38
|
+
row.input_chars.toLocaleString("en-US"),
|
|
39
|
+
row.est_tokens.toLocaleString("en-US"),
|
|
40
|
+
row.output_tokens.toLocaleString("en-US"),
|
|
41
|
+
`${row.measured}/${row.calls}`,
|
|
42
|
+
seconds(row.ms),
|
|
43
|
+
]);
|
|
44
|
+
const widths = header.map((cell, column) => Math.max(cell.length, ...lines.map((line) => line[column].length)));
|
|
45
|
+
const render = (cells) => cells
|
|
46
|
+
.map((cell, column) => column === 0
|
|
47
|
+
? cell.padEnd(widths[column])
|
|
48
|
+
: cell.padStart(widths[column]))
|
|
49
|
+
.join(" ");
|
|
50
|
+
return [render(header), ...lines.map(render)];
|
|
51
|
+
}
|
|
52
|
+
// `ocean sessions cost` (T-335): what session capture's model calls cost, per day and week, from
|
|
53
|
+
// the extraction log. Tokens are the ones each call reported (T-340); a line from before that,
|
|
54
|
+
// or from a client that reports none, is estimated at four characters a token.
|
|
55
|
+
export async function runSessionsCommand(args) {
|
|
56
|
+
if (args[0] === "relink")
|
|
57
|
+
return relink(args.slice(1));
|
|
58
|
+
if (args[0] !== "cost") {
|
|
59
|
+
console.error(usage);
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const summary = summarizeCost(await readExtractionLog(), {
|
|
64
|
+
days: count(args, "--days", 7),
|
|
65
|
+
weeks: count(args, "--weeks", 4),
|
|
66
|
+
});
|
|
67
|
+
if (args.includes("--json")) {
|
|
68
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
console.log([
|
|
72
|
+
`Extraction calls behind session capture (${extractionLogFile()})`,
|
|
73
|
+
"",
|
|
74
|
+
...table("day", summary.days),
|
|
75
|
+
"",
|
|
76
|
+
...table("week of", summary.weeks),
|
|
77
|
+
].join("\n"));
|
|
78
|
+
}
|
|
79
|
+
const clip = (value) => value.length > 60 ? `${value.slice(0, 57)}...` : value;
|
|
80
|
+
function describe(plan) {
|
|
81
|
+
const lines = [];
|
|
82
|
+
for (const change of plan.changes) {
|
|
83
|
+
lines.push(change.file);
|
|
84
|
+
for (const field of change.changes)
|
|
85
|
+
lines.push(` ${field.key}: ${JSON.stringify(clip(field.from))} → ${JSON.stringify(clip(field.to))}`);
|
|
86
|
+
}
|
|
87
|
+
return lines;
|
|
88
|
+
}
|
|
89
|
+
// `ocean sessions relink` (T-337): old session records and review candidates brought to what new
|
|
90
|
+
// sessions write. --dry-run prints every change and writes nothing; --yes backs up, then writes.
|
|
91
|
+
async function relink(args) {
|
|
92
|
+
const write = args.includes("--yes");
|
|
93
|
+
if (write === args.includes("--dry-run")) {
|
|
94
|
+
console.error(usage);
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const store = await openSessionStoreReadOnly();
|
|
99
|
+
let plan;
|
|
100
|
+
try {
|
|
101
|
+
plan = await planRelink(store);
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
store.close();
|
|
105
|
+
}
|
|
106
|
+
const result = write ? await applyRelink(plan) : null;
|
|
107
|
+
if (args.includes("--json")) {
|
|
108
|
+
console.log(JSON.stringify({
|
|
109
|
+
scanned: plan.scanned,
|
|
110
|
+
changes: plan.changes.map(({ file, kind, changes }) => ({
|
|
111
|
+
file,
|
|
112
|
+
kind,
|
|
113
|
+
changes,
|
|
114
|
+
})),
|
|
115
|
+
...(result ? { result } : {}),
|
|
116
|
+
}, null, 2));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const records = plan.changes.filter((c) => c.kind === "record").length;
|
|
120
|
+
const summary = `${plan.changes.length} file(s) to change of ${plan.scanned} scanned (${records} record(s), ${plan.changes.length - records} candidate(s))`;
|
|
121
|
+
if (!result) {
|
|
122
|
+
console.log([
|
|
123
|
+
...describe(plan),
|
|
124
|
+
"",
|
|
125
|
+
summary,
|
|
126
|
+
"Dry run: nothing written. Write with --yes.",
|
|
127
|
+
]
|
|
128
|
+
.join("\n")
|
|
129
|
+
.trim());
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
console.log([
|
|
133
|
+
...describe(plan),
|
|
134
|
+
"",
|
|
135
|
+
summary,
|
|
136
|
+
`Written: ${result.written.length}. Backup: ${result.backup}`,
|
|
137
|
+
...(result.stale.length
|
|
138
|
+
? [
|
|
139
|
+
`Changed since planned, left alone: ${result.stale.length}`,
|
|
140
|
+
...result.stale.map((file) => ` ${file}`),
|
|
141
|
+
]
|
|
142
|
+
: []),
|
|
143
|
+
].join("\n"));
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=sessions-command.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { access, chmod, mkdir, readdir, readFile, rename, writeFile, } from "node:fs/promises";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { listProfileNames } from "@ocean/core/profiles/profile-files.js";
|
|
4
5
|
import { registryFile } from "@ocean/core/shared/fs-utils.js";
|
|
5
6
|
import { DAILY_DIR, INBOX_DIR, KNOWLEDGE_DIR, LEGACY_NOTES_DIR, liveEngineEntry, NOTES_DIR, oceanPath, oceanRoot, PERSONAL_DIR, projectDir, REGISTRY_DIR, REPORT_KINDS, REPORTS_DIR, SYSTEM_DIR, TEMPLATES_DIR, WORKSPACE_PROJECT_ID, } from "@ocean/core/shared/paths.js";
|
|
6
|
-
import { connectObsidianVault } from "@ocean/services/obsidian/vault-discovery.js";
|
|
7
|
+
import { connectObsidianVault } from "@ocean/services/integrations/obsidian/vault-discovery.js";
|
|
7
8
|
import { seedWorkspaceTemplate } from "../../application/layout/workspace-template.js";
|
|
8
9
|
import { installShellIntegration, syncProviderWrappers, } from "../../infrastructure/wrappers/wrapper-manager.js";
|
|
9
10
|
const personalDirectories = [
|
|
@@ -155,7 +156,19 @@ export async function setup(options = {}) {
|
|
|
155
156
|
await Promise.all(stateDirectories.map((directory) => mkdir(oceanPath(directory), { recursive: true })));
|
|
156
157
|
await ensureFile(oceanPath(PERSONAL_DIR, "MEMORY.md"), "# Memory\n\n## Records (generated)\n");
|
|
157
158
|
await ensureFile(oceanPath(KNOWLEDGE_DIR, "KNOWLEDGE.md"), "# Knowledge\n\n## Records (generated)\n");
|
|
158
|
-
|
|
159
|
+
// T-338: profiles ship as Markdown; a default kept in any form (an older `default.json`
|
|
160
|
+
// too) is never joined by a second copy.
|
|
161
|
+
if (!(await listProfileNames()).includes("default"))
|
|
162
|
+
await ensureFile(oceanPath(SYSTEM_DIR, "profiles", "default.md"), await readFile(new URL("../../../templates/profiles/default.md", import.meta.url), "utf8"));
|
|
163
|
+
// T-338 P2: the domain profiles (base, frontend, ...) the resolver chooses from. A profile
|
|
164
|
+
// already present, or edited by the owner, is never replaced.
|
|
165
|
+
const bundles = new URL("../../../templates/profiles-v3/", import.meta.url);
|
|
166
|
+
const present = new Set(await listProfileNames());
|
|
167
|
+
for (const file of (await readdir(bundles)).sort()) {
|
|
168
|
+
const name = file.replace(/\.md$/, "");
|
|
169
|
+
if (file.endsWith(".md") && !present.has(name))
|
|
170
|
+
await ensureFile(oceanPath(SYSTEM_DIR, "profiles", file), await readFile(new URL(file, bundles), "utf8"));
|
|
171
|
+
}
|
|
159
172
|
// T-245: the runtime config names the default profile, so `ocean run` without --profile
|
|
160
173
|
// no longer depends on the historical fallback. An existing file is never replaced.
|
|
161
174
|
await ensureFile(oceanPath(SYSTEM_DIR, "config", "runtime.json"), `${JSON.stringify({ schemaVersion: 1, defaultProfile: "default" }, null, 2)}\n`);
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { execFile as execFileCallback } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
2
3
|
import { writeFile } from "node:fs/promises";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { promisify } from "node:util";
|
|
5
6
|
import { enginePath, oceanPath, projectDir, resolveWithin, WORKSPACE_PROJECT_ID, } from "@ocean/core/shared/paths.js";
|
|
7
|
+
import { canonicalPath, readProjectManifest, } from "@ocean/core/shared/project-manifest.js";
|
|
6
8
|
import { folderProject, projectsWithTasks, } from "@ocean/core/shared/project-resolution.js";
|
|
7
9
|
import { resolveTaskReference } from "@ocean/core/shared/task-reference.js";
|
|
8
|
-
import { openSessionStore } from "@ocean/
|
|
9
|
-
import { archiveDoneTasks, completeTask, } from "@ocean/
|
|
10
|
-
import { checkpointTask } from "@ocean/
|
|
11
|
-
import { claimTask, releaseTask } from "@ocean/
|
|
12
|
-
import { listTasks, listTasksForFolder, } from "@ocean/
|
|
13
|
-
import { newTask } from "@ocean/
|
|
14
|
-
import { renumberTasks } from "@ocean/
|
|
15
|
-
import { syncTaskPrs, } from "@ocean/
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
10
|
+
import { openSessionStore } from "@ocean/work/sessions/session-store.js";
|
|
11
|
+
import { archiveDoneTasks, completeTask, } from "@ocean/work/tasks/archive-tasks.js";
|
|
12
|
+
import { checkpointTask } from "@ocean/work/tasks/checkpoint-task.js";
|
|
13
|
+
import { claimTask, releaseTask } from "@ocean/work/tasks/claim-task.js";
|
|
14
|
+
import { listTasks, listTasksForFolder, } from "@ocean/work/tasks/list-tasks.js";
|
|
15
|
+
import { newTask } from "@ocean/work/tasks/new-task.js";
|
|
16
|
+
import { renumberTasks } from "@ocean/work/tasks/renumber-tasks.js";
|
|
17
|
+
import { mentionsToken, prLinks, syncTaskPrs, } from "@ocean/work/tasks/sync-task-prs.js";
|
|
18
|
+
import { branchAheadOfBase } from "@ocean/work/tasks/task-git.js";
|
|
19
|
+
import { verifyAndRecord } from "@ocean/work/tasks/task-verification.js";
|
|
20
|
+
import { verificationReadiness } from "@ocean/work/tasks/verification-readiness.js";
|
|
18
21
|
import { taskReviewer } from "../../infrastructure/providers/task-reviewer.js";
|
|
19
22
|
const execFile = promisify(execFileCallback);
|
|
20
23
|
// Re-exported for existing importers (daily/context commands, tests). The
|
|
@@ -52,6 +55,39 @@ async function githubPrState(link) {
|
|
|
52
55
|
return state;
|
|
53
56
|
throw new Error(`${link.url}: unexpected PR state "${state}"`);
|
|
54
57
|
}
|
|
58
|
+
// The repos a project is bound to that exist on this machine (its manifest `paths`).
|
|
59
|
+
async function projectRepos(project) {
|
|
60
|
+
const manifest = await readProjectManifest(project).catch(() => null);
|
|
61
|
+
return (manifest?.paths ?? [])
|
|
62
|
+
.map((repo) => canonicalPath(repo))
|
|
63
|
+
.filter((repo) => existsSync(repo));
|
|
64
|
+
}
|
|
65
|
+
// PRs of the project's repos (any state, newest 100 each) read once per sync, then matched
|
|
66
|
+
// against a task's tokens in the PR title or branch.
|
|
67
|
+
function prDiscovery(repos) {
|
|
68
|
+
let listed = null;
|
|
69
|
+
const list = () => (listed ??= (async () => {
|
|
70
|
+
const found = [];
|
|
71
|
+
for (const repo of repos) {
|
|
72
|
+
const { stdout } = await execFile("gh", [
|
|
73
|
+
"pr",
|
|
74
|
+
"list",
|
|
75
|
+
"--state",
|
|
76
|
+
"all",
|
|
77
|
+
"--limit",
|
|
78
|
+
"100",
|
|
79
|
+
"--json",
|
|
80
|
+
"url,title,headRefName",
|
|
81
|
+
], { cwd: repo, timeout: 30_000 });
|
|
82
|
+
for (const pr of JSON.parse(stdout))
|
|
83
|
+
found.push({ url: pr.url, title: pr.title, branch: pr.headRefName });
|
|
84
|
+
}
|
|
85
|
+
return found;
|
|
86
|
+
})());
|
|
87
|
+
return async (tokens) => (await list())
|
|
88
|
+
.filter((pr) => mentionsToken(pr.title, tokens) || mentionsToken(pr.branch, tokens))
|
|
89
|
+
.flatMap((pr) => prLinks(pr.url));
|
|
90
|
+
}
|
|
55
91
|
// `ocean tasks list --pretty`: one aligned row per task, for a person rather than a tool.
|
|
56
92
|
function taskTable(tasks) {
|
|
57
93
|
if (!tasks.length)
|
|
@@ -195,23 +231,37 @@ export async function runTasksCommand(action, args) {
|
|
|
195
231
|
}
|
|
196
232
|
if (action === "sync") {
|
|
197
233
|
// Task state follows linked GitHub PRs: open → in-qa, all merged → done via the completion
|
|
198
|
-
// gate
|
|
199
|
-
|
|
234
|
+
// gate; a PR that names the task and a branch ahead of its base count too (T-327). Session
|
|
235
|
+
// start runs `--all` in the background. Outside any project there is no project to sync, so
|
|
236
|
+
// it syncs every one, as `tasks list` does there, rather than reporting an empty workspace.
|
|
237
|
+
const projects = args.includes("--all") || (!explicitProject && !cwdProject)
|
|
200
238
|
? await projectsWithTasks()
|
|
201
239
|
: [projectId];
|
|
202
240
|
const apply = !args.includes("--dry-run");
|
|
203
241
|
const report = {};
|
|
204
242
|
for (const project of projects) {
|
|
205
243
|
const root = resolveWithin(oceanPath(projectDir(project)), "tasks");
|
|
244
|
+
const repos = await projectRepos(project);
|
|
206
245
|
const outcome = await syncTaskPrs(root, {
|
|
207
246
|
apply,
|
|
208
247
|
fetchPr: githubPrState,
|
|
248
|
+
discoverPrs: repos.length ? prDiscovery(repos) : undefined,
|
|
249
|
+
branchAhead: async (tokens) => {
|
|
250
|
+
for (const repo of repos) {
|
|
251
|
+
const found = await branchAheadOfBase(repo, (branch) => mentionsToken(branch, tokens));
|
|
252
|
+
if (found)
|
|
253
|
+
return found;
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
},
|
|
209
257
|
complete: (id, taskRoot) => completeTask(id, taskRoot, { verify: recordedVerification }),
|
|
210
258
|
});
|
|
211
259
|
if (outcome.changed.length || outcome.skipped.length)
|
|
212
260
|
report[project] = outcome;
|
|
213
261
|
}
|
|
214
|
-
|
|
262
|
+
// `scanned` names what was looked at, so an empty `projects` reads as "nothing to move", not
|
|
263
|
+
// "nothing looked at".
|
|
264
|
+
console.log(JSON.stringify({ apply, scanned: projects, projects: report }, null, 2));
|
|
215
265
|
return;
|
|
216
266
|
}
|
|
217
267
|
if (action === "complete") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { failureRecurrence, ladderFindings, listFailures, } from "@ocean/services/health/failures.js";
|
|
2
|
+
import { lessonEffects, retirementFindings, } from "@ocean/services/health/lesson-effect.js";
|
|
3
|
+
import { analyzeSessions, proposeTelemetry, signatureStats, } from "@ocean/services/health/telemetry.js";
|
|
4
|
+
import { openSessionStore } from "@ocean/work/sessions/session-store.js";
|
|
5
5
|
// `ocean telemetry [--days N] [--yes]` (T-314): recurring errors and failing providers in the
|
|
6
6
|
// last N days (30) of sessions, proposed as backlog lines for review; a dry run until --yes.
|
|
7
7
|
// T-323: each error carries its signature; one that already has a failure record is tracked
|
|
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import readline from "node:readline/promises";
|
|
3
3
|
import { planUninstall, runUninstall, } from "../../application/uninstall/uninstall.js";
|
|
4
4
|
import { shimDirectory, stripInterceptionBlocks, } from "../../infrastructure/wrappers/wrapper-manager.js";
|
|
5
|
-
|
|
5
|
+
const UNINSTALL_USAGE = "Usage: ocean uninstall [--yes] [--purge] [--json]";
|
|
6
6
|
// Deleting the workspace cannot be undone, so `--purge` asks once more, on a terminal only:
|
|
7
7
|
// the person types the workspace folder's name.
|
|
8
8
|
async function confirmPurge(root) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { listFailures } from "@ocean/services/health/failures.js";
|
|
2
|
+
import { signatureStats } from "@ocean/services/health/telemetry.js";
|
|
3
|
+
import { openSessionStoreReadOnly } from "@ocean/work/sessions/session-store.js";
|
|
4
|
+
// Telemetry signatures seen in a week's sessions, named by their failure record when one exists
|
|
5
|
+
// (T-329 phase 5). No session store (a fresh install, a test) is no failures, never a failed digest.
|
|
6
|
+
export async function weekFailures(week) {
|
|
7
|
+
let store;
|
|
8
|
+
try {
|
|
9
|
+
store = await openSessionStoreReadOnly();
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
const names = new Map((await listFailures().catch(() => [])).map((record) => [
|
|
16
|
+
record.signature,
|
|
17
|
+
record.id,
|
|
18
|
+
]));
|
|
19
|
+
const stats = signatureStats(store.list(), (session) => store.listEvents(session), `${week.from}T00:00:00.000Z`);
|
|
20
|
+
const end = `${week.to}T23:59:59.999Z`;
|
|
21
|
+
return [...stats].map(([signature, item]) => ({
|
|
22
|
+
label: names.get(signature) ?? signature,
|
|
23
|
+
sessions: new Set(item.hits
|
|
24
|
+
.filter((hit) => hit.at >= week.from && hit.at <= end)
|
|
25
|
+
.map((hit) => hit.sessionId)).size,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
store.close();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=week-failures.js.map
|
package/dist/main.js
CHANGED
|
@@ -5,8 +5,20 @@ import "./node-warnings.js";
|
|
|
5
5
|
// node:sqlite, and print its warning, before any module body runs.
|
|
6
6
|
const { commandRegistry } = await import("./interfaces/cli/command-registry.js");
|
|
7
7
|
const { renderCommandHelp, renderHelp, wantsCommandHelp } = await import("./interfaces/cli/help-command.js");
|
|
8
|
+
const { resolveAlias } = await import("./interfaces/cli/command-aliases.js");
|
|
8
9
|
const { onboard } = await import("./interfaces/cli/onboard-command.js");
|
|
9
10
|
const { oceanVersion } = await import("./version.js");
|
|
11
|
+
// A name that was merged into another command (`ocean loop` is now `ocean tasks loop`) runs the
|
|
12
|
+
// new command. On a terminal it says so; a hook, shim or service that still uses the old name
|
|
13
|
+
// gets no extra line.
|
|
14
|
+
const renamed = process.argv[2]
|
|
15
|
+
? resolveAlias(process.argv[2], process.argv.slice(3))
|
|
16
|
+
: null;
|
|
17
|
+
if (renamed) {
|
|
18
|
+
if (process.stderr.isTTY || process.env.OCEAN_ALIAS_NOTICE === "1")
|
|
19
|
+
console.error(`ocean ${process.argv[2]} is now: ocean ${renamed.join(" ")}`);
|
|
20
|
+
process.argv = [...process.argv.slice(0, 2), ...renamed];
|
|
21
|
+
}
|
|
10
22
|
const command = process.argv[2] === "--yes" ? undefined : process.argv[2];
|
|
11
23
|
if (command === "--version" || command === "-v") {
|
|
12
24
|
console.log(await oceanVersion());
|
package/node_modules/@ocean/brain/dist/{infrastructure/brain/brain-index.js → brain-index.js}
RENAMED
|
@@ -150,7 +150,7 @@ async function populate(db, docs, links, options) {
|
|
|
150
150
|
// Builds a brand-new index file at `outFile` from scratch: writes into a sibling temp file
|
|
151
151
|
// and renames atomically into place, so a reader never observes a half-built index and a
|
|
152
152
|
// crash mid-build never corrupts whatever index was there before.
|
|
153
|
-
|
|
153
|
+
async function buildIndex(docs, links, outFile, options) {
|
|
154
154
|
const temp = `${outFile}.tmp-${process.pid}-${Date.now()}`;
|
|
155
155
|
await rm(temp, { force: true });
|
|
156
156
|
const db = new DatabaseSync(temp, { allowExtension: true });
|
|
@@ -174,7 +174,7 @@ function loadVectorExtension(db) {
|
|
|
174
174
|
return false;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
class BrainIndexReader {
|
|
178
178
|
db;
|
|
179
179
|
meta;
|
|
180
180
|
hasVectors;
|
|
@@ -226,7 +226,7 @@ export function normalizeForSearch(text) {
|
|
|
226
226
|
.replace(/ك/g, "ک")
|
|
227
227
|
.toLowerCase();
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
function _idFromRelPath(relPath) {
|
|
230
230
|
return relPath.replace(/\.md$/i, "");
|
|
231
231
|
}
|
|
232
232
|
export function basenameStem(relPath) {
|
|
@@ -2,9 +2,11 @@ import { readFile, stat } from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { scopeVisible, visibleScopes, } from "@ocean/core/domain/brain/record-scope.js";
|
|
4
4
|
import { BRAIN_INDEX_SCHEMA_VERSION, } from "@ocean/core/domain/ports/brain-index-port.js";
|
|
5
|
+
import { readMetadata } from "@ocean/core/domain/sessions/session-metadata.js";
|
|
6
|
+
import { FRONTMATTER_READ_BYTES, readFrontmatterFile, } from "@ocean/core/shared/fs-utils.js";
|
|
5
7
|
import { oceanRoot, resolveStorePath, resolveWithin, STORE_DIR, storeRelativeToRoot, } from "@ocean/core/shared/paths.js";
|
|
6
8
|
import { normalizeForSearch, normalizeRecord } from "./brain-markdown.js";
|
|
7
|
-
import { brainIndexPath, computeCorpusHash
|
|
9
|
+
import { brainIndexPath, computeCorpusHash } from "./brain-reindex.js";
|
|
8
10
|
// A v1 index has no scope column, so it cannot answer a scoped query: say how to fix it
|
|
9
11
|
// rather than return unfiltered hits.
|
|
10
12
|
export class BrainIndexStaleError extends Error {
|
|
@@ -176,6 +178,15 @@ export async function brainSearch(options) {
|
|
|
176
178
|
}
|
|
177
179
|
if (options.asOf && !validOn(doc, options.asOf, successor))
|
|
178
180
|
continue;
|
|
181
|
+
if (options.task || options.branch) {
|
|
182
|
+
const head = await readFrontmatterFile(resolveStorePath(root, String(doc.path)), FRONTMATTER_READ_BYTES);
|
|
183
|
+
const meta = readMetadata(head?.fields ?? {});
|
|
184
|
+
if (options.task &&
|
|
185
|
+
meta.task?.toLowerCase() !== options.task.trim().toLowerCase())
|
|
186
|
+
continue;
|
|
187
|
+
if (options.branch && meta.branch !== options.branch.trim())
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
179
190
|
// Backstop for hits the SQL filter never saw (vector hits are not scope-filtered).
|
|
180
191
|
if (options.scope &&
|
|
181
192
|
!scopeVisible(String(doc.scope), options.scope.project))
|
|
@@ -358,7 +369,6 @@ export async function ensureIndexBuilt(root = oceanRoot()) {
|
|
|
358
369
|
return false;
|
|
359
370
|
}
|
|
360
371
|
}
|
|
361
|
-
export { reindexBrain };
|
|
362
372
|
export function relativeStorePath(file, root = oceanRoot()) {
|
|
363
373
|
// Deepest store first: the notes sit inside 02-personal and must resolve to "notes/".
|
|
364
374
|
const stores = Object.entries(STORE_DIR).sort(([, a], [, b]) => b.length - a.length);
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { mkdir, open, readdir, readFile, rm, writeFile, } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { redactRuntimeText } from "@ocean/core/domain/redaction
|
|
3
|
+
import { redactRuntimeText } from "@ocean/core/domain/redaction.js";
|
|
4
|
+
import { NO_PROJECT, sessionIdentity, } from "@ocean/core/domain/sessions/session-identity.js";
|
|
5
|
+
import { ActivityTally, mergeActivity, metadataLines, readMetadata, } from "@ocean/core/domain/sessions/session-metadata.js";
|
|
4
6
|
import { cleanTitle } from "@ocean/core/shared/clean-title.js";
|
|
7
|
+
import { parseFrontmatter, safeJsonParse, } from "@ocean/core/shared/fs-utils.js";
|
|
5
8
|
import { localDate, localMoment, localTime, } from "@ocean/core/shared/local-date.js";
|
|
6
9
|
import { DAILY_DIR, INBOX_DIR, oceanPath, oceanRoot, } from "@ocean/core/shared/paths.js";
|
|
7
|
-
import { findGitRoot } from "@ocean/core/shared/project-resolution.js";
|
|
10
|
+
import { findGitRoot, gitBranch, repoRelative, } from "@ocean/core/shared/project-resolution.js";
|
|
8
11
|
import { isTrivialSession } from "./model-narrative.js";
|
|
9
|
-
// Same fallback title stamped on a session with no explicit title
|
|
10
|
-
//
|
|
12
|
+
// Same fallback title stamped on a session with no explicit title — never meaningful
|
|
13
|
+
// content on its own.
|
|
11
14
|
const GENERIC_TITLE = /^(claude|codex|hermes|kimi|gemini|copilot|kilo|antigravity|openhands) session$/i;
|
|
12
15
|
function safeText(value, max = 400) {
|
|
13
16
|
return redactRuntimeText(value).replace(/\s+/g, " ").trim().slice(0, max);
|
|
@@ -74,7 +77,7 @@ async function recordHead(file) {
|
|
|
74
77
|
* The live record of one session in 01-daily/sessions/YYYY-MM/ (archive/ is history and is never
|
|
75
78
|
* rewritten). When an older duplicate exists, the digest record wins over a closeout one.
|
|
76
79
|
*/
|
|
77
|
-
|
|
80
|
+
async function findSessionRecord(sessionId) {
|
|
78
81
|
const root = oceanPath(DAILY_DIR, "sessions");
|
|
79
82
|
const needle = `session_id: ${JSON.stringify(sessionId)}`;
|
|
80
83
|
const months = (await readdir(root).catch(() => []))
|
|
@@ -96,13 +99,13 @@ export async function findSessionRecord(sessionId) {
|
|
|
96
99
|
return (found.find((record) => isDigestRecord(record.text)) ?? found[0] ?? null);
|
|
97
100
|
}
|
|
98
101
|
// Records written before `source:` existed carry the chat summary's verification line instead.
|
|
99
|
-
|
|
102
|
+
function isDigestRecord(text) {
|
|
100
103
|
return (/^source: "digest"$/m.test(text) ||
|
|
101
104
|
text.includes("NOT PROVEN — summarized from a chat"));
|
|
102
105
|
}
|
|
103
106
|
const PLACEHOLDER = /^(not stated\.?|no objective was captured\.?)$/i;
|
|
104
107
|
/** A digest record read back into the digest it was written from. */
|
|
105
|
-
|
|
108
|
+
function recordDigest(text) {
|
|
106
109
|
const section = (heading) => {
|
|
107
110
|
const start = text.indexOf(`\n## ${heading}\n`);
|
|
108
111
|
if (start < 0)
|
|
@@ -135,7 +138,7 @@ const MERGED_ITEMS = 5;
|
|
|
135
138
|
* Two stretches of one conversation as one account: what it set out to do comes from the first,
|
|
136
139
|
* where it ended from the latest, and what remains to do only from the latest that said anything.
|
|
137
140
|
*/
|
|
138
|
-
|
|
141
|
+
function mergeDigests(earlier, later) {
|
|
139
142
|
const union = (a, b) => [...new Set([...a, ...b])].slice(-MERGED_ITEMS);
|
|
140
143
|
return {
|
|
141
144
|
title: earlier.title || later.title,
|
|
@@ -147,17 +150,50 @@ export function mergeDigests(earlier, later) {
|
|
|
147
150
|
next: (later.next.length ? later.next : earlier.next).slice(0, MERGED_ITEMS),
|
|
148
151
|
};
|
|
149
152
|
}
|
|
153
|
+
// What an intercepted CLI session did, from its store events and the files git shows changed
|
|
154
|
+
// (T-334). The store keeps the user's turns and Ocean's own MCP calls, not each assistant reply
|
|
155
|
+
// or the client's tool calls, so those keys are left out rather than guessed.
|
|
156
|
+
function closeoutActivity(session, events, changedFiles) {
|
|
157
|
+
const tally = new ActivityTally();
|
|
158
|
+
for (const event of events) {
|
|
159
|
+
if ((event.type === "user_input" || event.type === "resume_requested") &&
|
|
160
|
+
withoutWrappers(event.data))
|
|
161
|
+
tally.turn("user");
|
|
162
|
+
if (event.type === "mcp_tool_call") {
|
|
163
|
+
const tool = safeJsonParse(event.data)?.tool;
|
|
164
|
+
if (typeof tool === "string")
|
|
165
|
+
tally.tool(tool);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const { turnsUser, tools } = tally.result();
|
|
169
|
+
const root = findGitRoot(session.workingDirectory);
|
|
170
|
+
const files = {};
|
|
171
|
+
for (const line of changedFiles) {
|
|
172
|
+
// A `git status --short` line: status letters, then the path (a rename names both).
|
|
173
|
+
const named = line
|
|
174
|
+
.replace(/^[A-Z?!]{1,2}\s+/, "")
|
|
175
|
+
.split(" -> ")
|
|
176
|
+
.at(-1)
|
|
177
|
+
?.replace(/^"|"$/g, "");
|
|
178
|
+
if (!named)
|
|
179
|
+
continue;
|
|
180
|
+
const file = repoRelative(path.resolve(session.workingDirectory, named), root);
|
|
181
|
+
files[file] = (files[file] ?? 0) + 1;
|
|
182
|
+
}
|
|
183
|
+
const branch = gitBranch(session.workingDirectory);
|
|
184
|
+
return { turnsUser, tools, files, ...(branch ? { branch } : {}) };
|
|
185
|
+
}
|
|
150
186
|
/**
|
|
151
187
|
* One session record per session in 01-daily/sessions/YYYY-MM/ (T-314; was 00-inbox/brain-dump/),
|
|
152
188
|
* separate from the machine-oriented kernel/bridge/sessions/summaries/ dump. Prefers
|
|
153
|
-
* the cheap model narrative (see model-narrative.ts) and falls back to
|
|
154
|
-
*
|
|
189
|
+
* the cheap model narrative (see model-narrative.ts) and falls back to a
|
|
190
|
+
* deterministic heuristic when it is unavailable.
|
|
155
191
|
* When lesson-learning.ts already found signals for this session (corrections,
|
|
156
192
|
* repeated procedures, explicit decisions), they're mirrored under
|
|
157
193
|
* "## Signals" — the same events already surfaced in brain/01-daily/, so a
|
|
158
194
|
* later cross-session sweep has one place to look instead of two.
|
|
159
195
|
*
|
|
160
|
-
* Skipped for the
|
|
196
|
+
* Skipped for the low-value case: a generic
|
|
161
197
|
* title with no real (git) project behind it — nothing a human would want to
|
|
162
198
|
* read later.
|
|
163
199
|
*/
|
|
@@ -213,15 +249,18 @@ export async function writeBrainDump(input) {
|
|
|
213
249
|
const started = localMoment(session.createdAt);
|
|
214
250
|
const time = localTime(started);
|
|
215
251
|
const date = localDate(started);
|
|
216
|
-
|
|
252
|
+
// The project and task decided when the session was created (T-331): "" when unbound.
|
|
253
|
+
const identity = sessionIdentity(session, events);
|
|
254
|
+
const project = identity.projectId;
|
|
217
255
|
const status = session.status === "completed" && (input.exitCode ?? 0) === 0
|
|
218
256
|
? "completed"
|
|
219
257
|
: "failed";
|
|
258
|
+
const fallbackTitle = project || "Session";
|
|
220
259
|
const title = !isGenericContent(workLog)
|
|
221
|
-
? cleanTitle(workLog,
|
|
260
|
+
? cleanTitle(workLog, fallbackTitle)
|
|
222
261
|
: lastReply
|
|
223
|
-
? cleanTitle(lastReply,
|
|
224
|
-
:
|
|
262
|
+
? cleanTitle(lastReply, fallbackTitle)
|
|
263
|
+
: fallbackTitle;
|
|
225
264
|
const outcome = status === "completed"
|
|
226
265
|
? (lastReply ??
|
|
227
266
|
(changedFiles.length
|
|
@@ -235,10 +274,18 @@ export async function writeBrainDump(input) {
|
|
|
235
274
|
"---",
|
|
236
275
|
"type: session",
|
|
237
276
|
`project: ${quote(project)}`,
|
|
277
|
+
`task: ${quote(identity.taskId)}`,
|
|
238
278
|
`provider: ${quote(session.provider)}`,
|
|
239
279
|
'source: "closeout"',
|
|
240
280
|
`status: ${status}`,
|
|
241
281
|
`session_id: ${quote(session.sessionId)}`,
|
|
282
|
+
...metadataLines({
|
|
283
|
+
projectHow: identity.how,
|
|
284
|
+
projectConfidence: identity.confidence,
|
|
285
|
+
started: session.createdAt,
|
|
286
|
+
ended: session.closedAt ?? session.updatedAt,
|
|
287
|
+
activity: closeoutActivity(session, events, changedFiles),
|
|
288
|
+
}),
|
|
242
289
|
`date: ${date}`,
|
|
243
290
|
"tags: []",
|
|
244
291
|
"distilled: false",
|
|
@@ -352,14 +399,32 @@ export async function writeDigestRecord(input) {
|
|
|
352
399
|
const earlier = existing && isDigestRecord(existing.text)
|
|
353
400
|
? recordDigest(existing.text)
|
|
354
401
|
: null;
|
|
402
|
+
// A later stretch adds its counts and cost to the ones the record already carries.
|
|
403
|
+
const before = earlier && existing ? readMetadata(parseFrontmatter(existing.text)) : {};
|
|
404
|
+
const activity = mergeActivity(before.activity, input.activity);
|
|
405
|
+
const extraction = before.extraction && input.extraction
|
|
406
|
+
? {
|
|
407
|
+
model: input.extraction.model,
|
|
408
|
+
inputChars: before.extraction.inputChars + input.extraction.inputChars,
|
|
409
|
+
ms: before.extraction.ms + input.extraction.ms,
|
|
410
|
+
}
|
|
411
|
+
: (input.extraction ?? before.extraction);
|
|
412
|
+
const identity = input.identity ??
|
|
413
|
+
(input.project
|
|
414
|
+
? { how: "path", confidence: "high" }
|
|
415
|
+
: NO_PROJECT);
|
|
355
416
|
const digest = earlier ? mergeDigests(earlier, input.digest) : input.digest;
|
|
356
417
|
const existingDate = existing
|
|
357
418
|
? /^date: (\d{4}-\d{2}-\d{2})$/m.exec(existing.text)?.[1]
|
|
358
419
|
: undefined;
|
|
359
420
|
const date = existingDate ?? localDate(localMoment(input.endedAt));
|
|
360
421
|
const time = localTime(localMoment(input.startedAt));
|
|
361
|
-
|
|
422
|
+
// A later stretch keeps the start the first stretch recorded.
|
|
423
|
+
const started = (existing ? /^started: "([^"]+)"$/m.exec(existing.text)?.[1] : undefined) ??
|
|
424
|
+
input.startedAt;
|
|
425
|
+
const title = cleanTitle(safeText(input.conversationTitle || digest.title || digest.goal, 400), input.project || "Conversation");
|
|
362
426
|
const quote = (value) => JSON.stringify(value);
|
|
427
|
+
const optional = (key, value) => value ? [`${key}: ${quote(safeText(value, 200))}`] : [];
|
|
363
428
|
const list = (heading, items) => items.length
|
|
364
429
|
? [
|
|
365
430
|
"",
|
|
@@ -372,10 +437,21 @@ export async function writeDigestRecord(input) {
|
|
|
372
437
|
"---",
|
|
373
438
|
"type: session",
|
|
374
439
|
`project: ${quote(input.project ?? "")}`,
|
|
440
|
+
`task: ${quote(input.task ?? "")}`,
|
|
375
441
|
`provider: ${quote(input.provider)}`,
|
|
376
442
|
'source: "digest"',
|
|
377
443
|
"status: completed",
|
|
378
444
|
`session_id: ${quote(input.sessionId)}`,
|
|
445
|
+
...optional("conversation_title", input.conversationTitle),
|
|
446
|
+
...optional("claude_project", input.claudeProject),
|
|
447
|
+
...metadataLines({
|
|
448
|
+
projectHow: identity.how,
|
|
449
|
+
projectConfidence: identity.confidence,
|
|
450
|
+
started,
|
|
451
|
+
ended: input.endedAt,
|
|
452
|
+
...(activity ? { activity } : {}),
|
|
453
|
+
...(extraction ? { extraction } : {}),
|
|
454
|
+
}),
|
|
379
455
|
`date: ${date}`,
|
|
380
456
|
"tags: []",
|
|
381
457
|
"distilled: false",
|