@cleocode/core 2026.9.22 → 2026.9.24
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/dist/admin/import-tasks.d.ts.map +1 -1
- package/dist/admin/import-tasks.js +35 -6
- package/dist/admin/import-tasks.js.map +1 -1
- package/dist/admin/import.d.ts.map +1 -1
- package/dist/admin/import.js +25 -6
- package/dist/admin/import.js.map +1 -1
- package/dist/build-provenance.json +6 -0
- package/dist/cloud/http.d.ts +8 -0
- package/dist/cloud/http.d.ts.map +1 -1
- package/dist/cloud/http.js +8 -1
- package/dist/cloud/http.js.map +1 -1
- package/dist/cloud/index.d.ts +6 -1
- package/dist/cloud/index.d.ts.map +1 -1
- package/dist/cloud/index.js +6 -1
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/nexus-auth.d.ts +169 -0
- package/dist/cloud/nexus-auth.d.ts.map +1 -0
- package/dist/cloud/nexus-auth.js +372 -0
- package/dist/cloud/nexus-auth.js.map +1 -0
- package/dist/cloud/nexus-credentials.d.ts +188 -0
- package/dist/cloud/nexus-credentials.d.ts.map +1 -0
- package/dist/cloud/nexus-credentials.js +323 -0
- package/dist/cloud/nexus-credentials.js.map +1 -0
- package/dist/cloud/nexus-link.d.ts +85 -0
- package/dist/cloud/nexus-link.d.ts.map +1 -0
- package/dist/cloud/nexus-link.js +226 -0
- package/dist/cloud/nexus-link.js.map +1 -0
- package/dist/cloud/presence.d.ts +88 -0
- package/dist/cloud/presence.d.ts.map +1 -0
- package/dist/cloud/presence.js +137 -0
- package/dist/cloud/presence.js.map +1 -0
- package/dist/cloud/projects.d.ts +3 -1
- package/dist/cloud/projects.d.ts.map +1 -1
- package/dist/cloud/projects.js +4 -2
- package/dist/cloud/projects.js.map +1 -1
- package/dist/crypto/credentials.d.ts +14 -4
- package/dist/crypto/credentials.d.ts.map +1 -1
- package/dist/crypto/credentials.js +15 -1
- package/dist/crypto/credentials.js.map +1 -1
- package/dist/decide/audit.d.ts +7 -1
- package/dist/decide/audit.d.ts.map +1 -1
- package/dist/decide/audit.js.map +1 -1
- package/dist/decide/bench/dataset.d.ts +125 -0
- package/dist/decide/bench/dataset.d.ts.map +1 -0
- package/dist/decide/bench/dataset.js +457 -0
- package/dist/decide/bench/dataset.js.map +1 -0
- package/dist/decide/bench/index.d.ts +23 -0
- package/dist/decide/bench/index.d.ts.map +1 -0
- package/dist/decide/bench/index.js +23 -0
- package/dist/decide/bench/index.js.map +1 -0
- package/dist/decide/bench/metrics.d.ts +55 -0
- package/dist/decide/bench/metrics.d.ts.map +1 -0
- package/dist/decide/bench/metrics.js +100 -0
- package/dist/decide/bench/metrics.js.map +1 -0
- package/dist/decide/bench/operation.d.ts +119 -0
- package/dist/decide/bench/operation.d.ts.map +1 -0
- package/dist/decide/bench/operation.js +171 -0
- package/dist/decide/bench/operation.js.map +1 -0
- package/dist/decide/bench/profiles.d.ts +74 -0
- package/dist/decide/bench/profiles.d.ts.map +1 -0
- package/dist/decide/bench/profiles.js +131 -0
- package/dist/decide/bench/profiles.js.map +1 -0
- package/dist/decide/bench/questions.d.ts +40 -0
- package/dist/decide/bench/questions.d.ts.map +1 -0
- package/dist/decide/bench/questions.js +107 -0
- package/dist/decide/bench/questions.js.map +1 -0
- package/dist/decide/bench/report.d.ts +21 -0
- package/dist/decide/bench/report.d.ts.map +1 -0
- package/dist/decide/bench/report.js +120 -0
- package/dist/decide/bench/report.js.map +1 -0
- package/dist/decide/bench/runner.d.ts +203 -0
- package/dist/decide/bench/runner.d.ts.map +1 -0
- package/dist/decide/bench/runner.js +335 -0
- package/dist/decide/bench/runner.js.map +1 -0
- package/dist/decide/bench/source.d.ts +21 -0
- package/dist/decide/bench/source.d.ts.map +1 -0
- package/dist/decide/bench/source.js +67 -0
- package/dist/decide/bench/source.js.map +1 -0
- package/dist/decide/bench/spot-check.d.ts +117 -0
- package/dist/decide/bench/spot-check.d.ts.map +1 -0
- package/dist/decide/bench/spot-check.js +221 -0
- package/dist/decide/bench/spot-check.js.map +1 -0
- package/dist/decide/bench/stats.d.ts +57 -0
- package/dist/decide/bench/stats.d.ts.map +1 -0
- package/dist/decide/bench/stats.js +82 -0
- package/dist/decide/bench/stats.js.map +1 -0
- package/dist/decide/bench/types.d.ts +216 -0
- package/dist/decide/bench/types.d.ts.map +1 -0
- package/dist/decide/bench/types.js +104 -0
- package/dist/decide/bench/types.js.map +1 -0
- package/dist/decide/client.d.ts +80 -4
- package/dist/decide/client.d.ts.map +1 -1
- package/dist/decide/client.js +428 -39
- package/dist/decide/client.js.map +1 -1
- package/dist/decide/credentials.d.ts +200 -16
- package/dist/decide/credentials.d.ts.map +1 -1
- package/dist/decide/credentials.js +547 -45
- package/dist/decide/credentials.js.map +1 -1
- package/dist/decide/index.d.ts +10 -4
- package/dist/decide/index.d.ts.map +1 -1
- package/dist/decide/index.js +10 -4
- package/dist/decide/index.js.map +1 -1
- package/dist/decide/jev-wire.d.ts +105 -7
- package/dist/decide/jev-wire.d.ts.map +1 -1
- package/dist/decide/jev-wire.js +426 -54
- package/dist/decide/jev-wire.js.map +1 -1
- package/dist/decide/operations.d.ts +149 -21
- package/dist/decide/operations.d.ts.map +1 -1
- package/dist/decide/operations.js +241 -31
- package/dist/decide/operations.js.map +1 -1
- package/dist/decide/provider-state.d.ts +162 -0
- package/dist/decide/provider-state.d.ts.map +1 -0
- package/dist/decide/provider-state.js +267 -0
- package/dist/decide/provider-state.js.map +1 -0
- package/dist/decide/provider.d.ts +31 -5
- package/dist/decide/provider.d.ts.map +1 -1
- package/dist/decide/provider.js.map +1 -1
- package/dist/decide/providers.d.ts +71 -0
- package/dist/decide/providers.d.ts.map +1 -0
- package/dist/decide/providers.js +85 -0
- package/dist/decide/providers.js.map +1 -0
- package/dist/decide/site.d.ts +2 -2
- package/dist/decide/site.d.ts.map +1 -1
- package/dist/decide/site.js +2 -0
- package/dist/decide/site.js.map +1 -1
- package/dist/decide/sites/list.d.ts +46 -0
- package/dist/decide/sites/list.d.ts.map +1 -0
- package/dist/decide/sites/list.js +206 -0
- package/dist/decide/sites/list.js.map +1 -0
- package/dist/decide/sites/registry.d.ts +152 -0
- package/dist/decide/sites/registry.d.ts.map +1 -0
- package/dist/decide/sites/registry.js +398 -0
- package/dist/decide/sites/registry.js.map +1 -0
- package/dist/decide/spend.d.ts +196 -0
- package/dist/decide/spend.d.ts.map +1 -0
- package/dist/decide/spend.js +387 -0
- package/dist/decide/spend.js.map +1 -0
- package/dist/decide/wizard.d.ts +61 -0
- package/dist/decide/wizard.d.ts.map +1 -0
- package/dist/decide/wizard.js +197 -0
- package/dist/decide/wizard.js.map +1 -0
- package/dist/dispatch/mvi-projection.d.ts +15 -2
- package/dist/dispatch/mvi-projection.d.ts.map +1 -1
- package/dist/dispatch/mvi-projection.js +73 -12
- package/dist/dispatch/mvi-projection.js.map +1 -1
- package/dist/docs/adr-allocator.d.ts +2 -2
- package/dist/docs/adr-allocator.d.ts.map +1 -1
- package/dist/docs/adr-allocator.js +17 -4
- package/dist/docs/adr-allocator.js.map +1 -1
- package/dist/docs/blob-consolidation.js +1 -1
- package/dist/docs/blob-consolidation.js.map +1 -1
- package/dist/docs/display-alias.d.ts +1 -1
- package/dist/docs/display-alias.d.ts.map +1 -1
- package/dist/docs/display-alias.js +7 -4
- package/dist/docs/display-alias.js.map +1 -1
- package/dist/docs/docs-audit.d.ts.map +1 -1
- package/dist/docs/docs-audit.js +1 -2
- package/dist/docs/docs-audit.js.map +1 -1
- package/dist/docs/docs-inconsistency-detector.js +1 -1
- package/dist/docs/docs-inconsistency-detector.js.map +1 -1
- package/dist/docs/docs-update.d.ts.map +1 -1
- package/dist/docs/docs-update.js +6 -1
- package/dist/docs/docs-update.js.map +1 -1
- package/dist/docs/export-document.js +3462 -1227
- package/dist/docs/export-document.js.map +3 -3
- package/dist/docs/numbering.js +1 -1
- package/dist/docs/numbering.js.map +1 -1
- package/dist/docs/supersede.d.ts.map +1 -1
- package/dist/docs/supersede.js +6 -3
- package/dist/docs/supersede.js.map +1 -1
- package/dist/docs/version-ssot.js +1 -1
- package/dist/docs/version-ssot.js.map +1 -1
- package/dist/doctor/db-substrate.d.ts.map +1 -1
- package/dist/doctor/db-substrate.js +39 -24
- package/dist/doctor/db-substrate.js.map +1 -1
- package/dist/doctor/knowledge-summary.d.ts +10 -3
- package/dist/doctor/knowledge-summary.d.ts.map +1 -1
- package/dist/doctor/knowledge-summary.js +10 -3
- package/dist/doctor/knowledge-summary.js.map +1 -1
- package/dist/doctor/project-identity.d.ts +128 -37
- package/dist/doctor/project-identity.d.ts.map +1 -1
- package/dist/doctor/project-identity.js +476 -63
- package/dist/doctor/project-identity.js.map +1 -1
- package/dist/doctor/twin-collapse.d.ts +52 -2
- package/dist/doctor/twin-collapse.d.ts.map +1 -1
- package/dist/doctor/twin-collapse.js +108 -4
- package/dist/doctor/twin-collapse.js.map +1 -1
- package/dist/error-catalog.js +2 -2
- package/dist/error-catalog.js.map +1 -1
- package/dist/error-registry.js +1 -1
- package/dist/error-registry.js.map +1 -1
- package/dist/gateway-client/generated/types.gen.d.ts +22 -2
- package/dist/gateway-client/generated/types.gen.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/init/scaffold-workflows.d.ts.map +1 -1
- package/dist/init/scaffold-workflows.js +6 -3
- package/dist/init/scaffold-workflows.js.map +1 -1
- package/dist/init/upgrade-workflows.d.ts.map +1 -1
- package/dist/init/upgrade-workflows.js +6 -3
- package/dist/init/upgrade-workflows.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +20 -11
- package/dist/init.js.map +1 -1
- package/dist/inject/index.d.ts.map +1 -1
- package/dist/inject/index.js +2 -3
- package/dist/inject/index.js.map +1 -1
- package/dist/internal.d.ts +6 -5
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +7 -5
- package/dist/internal.js.map +1 -1
- package/dist/llm/credential-remove-entry.d.ts +59 -0
- package/dist/llm/credential-remove-entry.d.ts.map +1 -0
- package/dist/llm/credential-remove-entry.js +101 -0
- package/dist/llm/credential-remove-entry.js.map +1 -0
- package/dist/llm/oauth/device-code.d.ts +26 -6
- package/dist/llm/oauth/device-code.d.ts.map +1 -1
- package/dist/llm/oauth/device-code.js +44 -12
- package/dist/llm/oauth/device-code.js.map +1 -1
- package/dist/llm/plugin-facade.js +3556 -1321
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/memory/attention.d.ts.map +1 -1
- package/dist/memory/attention.js +5 -3
- package/dist/memory/attention.js.map +1 -1
- package/dist/memory/decision-contradiction.d.ts +3 -3
- package/dist/memory/decision-contradiction.d.ts.map +1 -1
- package/dist/memory/decision-contradiction.js +4 -3
- package/dist/memory/decision-contradiction.js.map +1 -1
- package/dist/memory/decisions.d.ts +48 -3
- package/dist/memory/decisions.d.ts.map +1 -1
- package/dist/memory/decisions.js +98 -14
- package/dist/memory/decisions.js.map +1 -1
- package/dist/memory/graph-memory-bridge.d.ts.map +1 -1
- package/dist/memory/graph-memory-bridge.js +2 -0
- package/dist/memory/graph-memory-bridge.js.map +1 -1
- package/dist/memory/learnings.d.ts +6 -6
- package/dist/memory/observation-type-decision.d.ts +2 -2
- package/dist/memory/observation-type-decision.d.ts.map +1 -1
- package/dist/memory/observation-type-decision.js +3 -2
- package/dist/memory/observation-type-decision.js.map +1 -1
- package/dist/memory/patterns.d.ts +4 -4
- package/dist/memory/pipeline-manifest-sqlite.d.ts +111 -0
- package/dist/memory/pipeline-manifest-sqlite.d.ts.map +1 -1
- package/dist/memory/pipeline-manifest-sqlite.js +230 -2
- package/dist/memory/pipeline-manifest-sqlite.js.map +1 -1
- package/dist/migration/manual/T10165-backfill-adr-index.d.ts.map +1 -1
- package/dist/migration/manual/T10165-backfill-adr-index.js +5 -1
- package/dist/migration/manual/T10165-backfill-adr-index.js.map +1 -1
- package/dist/nexus/fleet-status.d.ts +83 -0
- package/dist/nexus/fleet-status.d.ts.map +1 -0
- package/dist/nexus/fleet-status.js +414 -0
- package/dist/nexus/fleet-status.js.map +1 -0
- package/dist/nexus/git-state.d.ts +15 -0
- package/dist/nexus/git-state.d.ts.map +1 -1
- package/dist/nexus/git-state.js +67 -2
- package/dist/nexus/git-state.js.map +1 -1
- package/dist/nexus/identity.d.ts.map +1 -1
- package/dist/nexus/identity.js +4 -0
- package/dist/nexus/identity.js.map +1 -1
- package/dist/nexus/index.d.ts +4 -1
- package/dist/nexus/index.d.ts.map +1 -1
- package/dist/nexus/index.js +7 -1
- package/dist/nexus/index.js.map +1 -1
- package/dist/nexus/migrate-json-to-sqlite.d.ts +3 -2
- package/dist/nexus/migrate-json-to-sqlite.d.ts.map +1 -1
- package/dist/nexus/migrate-json-to-sqlite.js +9 -17
- package/dist/nexus/migrate-json-to-sqlite.js.map +1 -1
- package/dist/nexus/migrations/M-split-graph.d.ts.map +1 -1
- package/dist/nexus/migrations/M-split-graph.js +4 -0
- package/dist/nexus/migrations/M-split-graph.js.map +1 -1
- package/dist/nexus/ops.d.ts +1 -0
- package/dist/nexus/ops.d.ts.map +1 -1
- package/dist/nexus/project-activity.d.ts +104 -0
- package/dist/nexus/project-activity.d.ts.map +1 -0
- package/dist/nexus/project-activity.js +150 -0
- package/dist/nexus/project-activity.js.map +1 -0
- package/dist/nexus/query.d.ts +2 -2
- package/dist/nexus/query.d.ts.map +1 -1
- package/dist/nexus/query.js +4 -19
- package/dist/nexus/query.js.map +1 -1
- package/dist/nexus/registry-errors.d.ts +61 -0
- package/dist/nexus/registry-errors.d.ts.map +1 -0
- package/dist/nexus/registry-errors.js +85 -0
- package/dist/nexus/registry-errors.js.map +1 -0
- package/dist/nexus/registry.d.ts +30 -5
- package/dist/nexus/registry.d.ts.map +1 -1
- package/dist/nexus/registry.js +115 -70
- package/dist/nexus/registry.js.map +1 -1
- package/dist/nexus/store.d.ts.map +1 -1
- package/dist/nexus/store.js +2 -0
- package/dist/nexus/store.js.map +1 -1
- package/dist/orchestrate/pivot.d.ts +4 -0
- package/dist/orchestrate/pivot.d.ts.map +1 -1
- package/dist/orchestrate/pivot.js +82 -14
- package/dist/orchestrate/pivot.js.map +1 -1
- package/dist/orchestrate/plan.d.ts.map +1 -1
- package/dist/orchestrate/plan.js +3 -0
- package/dist/orchestrate/plan.js.map +1 -1
- package/dist/orchestrate/query-ops.d.ts.map +1 -1
- package/dist/orchestrate/query-ops.js +29 -27
- package/dist/orchestrate/query-ops.js.map +1 -1
- package/dist/orchestrate/spawn-ops.d.ts.map +1 -1
- package/dist/orchestrate/spawn-ops.js +29 -3
- package/dist/orchestrate/spawn-ops.js.map +1 -1
- package/dist/orchestration/bootstrap.d.ts.map +1 -1
- package/dist/orchestration/bootstrap.js +20 -14
- package/dist/orchestration/bootstrap.js.map +1 -1
- package/dist/orchestration/index.d.ts +15 -1
- package/dist/orchestration/index.d.ts.map +1 -1
- package/dist/orchestration/index.js +25 -6
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/lead-rollup.d.ts +7 -1
- package/dist/orchestration/lead-rollup.d.ts.map +1 -1
- package/dist/orchestration/lead-rollup.js +20 -5
- package/dist/orchestration/lead-rollup.js.map +1 -1
- package/dist/orchestration/owner-decision-readiness.d.ts +2 -2
- package/dist/orchestration/owner-decision-readiness.d.ts.map +1 -1
- package/dist/orchestration/owner-decision-readiness.js +3 -2
- package/dist/orchestration/owner-decision-readiness.js.map +1 -1
- package/dist/orchestration/spawn-prompt.js +1 -1
- package/dist/orchestration/spawn-prompt.js.map +1 -1
- package/dist/orchestration/validate-spawn.d.ts.map +1 -1
- package/dist/orchestration/validate-spawn.js +2 -0
- package/dist/orchestration/validate-spawn.js.map +1 -1
- package/dist/orchestration/waves.d.ts +21 -10
- package/dist/orchestration/waves.d.ts.map +1 -1
- package/dist/orchestration/waves.js +38 -35
- package/dist/orchestration/waves.js.map +1 -1
- package/dist/paths.d.ts +9 -2
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +30 -13
- package/dist/paths.js.map +1 -1
- package/dist/phases/index.d.ts +1 -1
- package/dist/phases/index.d.ts.map +1 -1
- package/dist/phases/index.js +3 -4
- package/dist/phases/index.js.map +1 -1
- package/dist/project-info.d.ts +40 -3
- package/dist/project-info.d.ts.map +1 -1
- package/dist/project-info.js +74 -6
- package/dist/project-info.js.map +1 -1
- package/dist/project-lifecycle.d.ts +28 -7
- package/dist/project-lifecycle.d.ts.map +1 -1
- package/dist/project-lifecycle.js +114 -47
- package/dist/project-lifecycle.js.map +1 -1
- package/dist/project-scope.d.ts +86 -3
- package/dist/project-scope.d.ts.map +1 -1
- package/dist/project-scope.js +192 -17
- package/dist/project-scope.js.map +1 -1
- package/dist/release/github-pr.d.ts.map +1 -1
- package/dist/release/github-pr.js +2 -1
- package/dist/release/github-pr.js.map +1 -1
- package/dist/release/open.d.ts +12 -2
- package/dist/release/open.d.ts.map +1 -1
- package/dist/release/open.js +32 -3
- package/dist/release/open.js.map +1 -1
- package/dist/release/preflight-skip.d.ts +73 -0
- package/dist/release/preflight-skip.d.ts.map +1 -0
- package/dist/release/preflight-skip.js +254 -0
- package/dist/release/preflight-skip.js.map +1 -0
- package/dist/render/decide/index.d.ts +51 -0
- package/dist/render/decide/index.d.ts.map +1 -0
- package/dist/render/decide/index.js +289 -0
- package/dist/render/decide/index.js.map +1 -0
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +1 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/nexus/graph/index.d.ts +5 -0
- package/dist/render/nexus/graph/index.d.ts.map +1 -1
- package/dist/render/nexus/graph/index.js +53 -0
- package/dist/render/nexus/graph/index.js.map +1 -1
- package/dist/routing/capability-matrix.d.ts.map +1 -1
- package/dist/routing/capability-matrix.js +7 -0
- package/dist/routing/capability-matrix.js.map +1 -1
- package/dist/scaffold/ensure-config.d.ts +14 -6
- package/dist/scaffold/ensure-config.d.ts.map +1 -1
- package/dist/scaffold/ensure-config.js +39 -17
- package/dist/scaffold/ensure-config.js.map +1 -1
- package/dist/scaffold/project-identity.d.ts +115 -23
- package/dist/scaffold/project-identity.d.ts.map +1 -1
- package/dist/scaffold/project-identity.js +196 -44
- package/dist/scaffold/project-identity.js.map +1 -1
- package/dist/selfimprove/fix-gen.js +3569 -1334
- package/dist/selfimprove/fix-gen.js.map +3 -3
- package/dist/sentient/cross-project-hygiene.d.ts +12 -6
- package/dist/sentient/cross-project-hygiene.d.ts.map +1 -1
- package/dist/sentient/cross-project-hygiene.js +15 -10
- package/dist/sentient/cross-project-hygiene.js.map +1 -1
- package/dist/session/engine-ops.d.ts +13 -4
- package/dist/session/engine-ops.d.ts.map +1 -1
- package/dist/session/engine-ops.js +38 -45
- package/dist/session/engine-ops.js.map +1 -1
- package/dist/sessions/briefing.d.ts +7 -3
- package/dist/sessions/briefing.d.ts.map +1 -1
- package/dist/sessions/briefing.js +32 -71
- package/dist/sessions/briefing.js.map +1 -1
- package/dist/sessions/drift-watchdog.d.ts.map +1 -1
- package/dist/sessions/drift-watchdog.js +11 -19
- package/dist/sessions/drift-watchdog.js.map +1 -1
- package/dist/sessions/focus-state-store.d.ts +109 -27
- package/dist/sessions/focus-state-store.d.ts.map +1 -1
- package/dist/sessions/focus-state-store.js +171 -39
- package/dist/sessions/focus-state-store.js.map +1 -1
- package/dist/sessions/handoff.d.ts.map +1 -1
- package/dist/sessions/handoff.js +9 -18
- package/dist/sessions/handoff.js.map +1 -1
- package/dist/sessions/index.d.ts +4 -2
- package/dist/sessions/index.d.ts.map +1 -1
- package/dist/sessions/index.js +35 -6
- package/dist/sessions/index.js.map +1 -1
- package/dist/sessions/session-drift.d.ts.map +1 -1
- package/dist/sessions/session-drift.js +4 -2
- package/dist/sessions/session-drift.js.map +1 -1
- package/dist/sessions/session-view.d.ts +8 -1
- package/dist/sessions/session-view.d.ts.map +1 -1
- package/dist/sessions/session-view.js +9 -2
- package/dist/sessions/session-view.js.map +1 -1
- package/dist/setup/config-json-merge.d.ts +28 -0
- package/dist/setup/config-json-merge.d.ts.map +1 -1
- package/dist/setup/config-json-merge.js +52 -0
- package/dist/setup/config-json-merge.js.map +1 -1
- package/dist/setup/index.d.ts +15 -10
- package/dist/setup/index.d.ts.map +1 -1
- package/dist/setup/index.js +19 -10
- package/dist/setup/index.js.map +1 -1
- package/dist/setup/sections/llm.js +1 -1
- package/dist/setup/sections/llm.js.map +1 -1
- package/dist/setup/sections/nexus-account.d.ts +32 -0
- package/dist/setup/sections/nexus-account.d.ts.map +1 -0
- package/dist/setup/sections/nexus-account.js +64 -0
- package/dist/setup/sections/nexus-account.js.map +1 -0
- package/dist/setup/sections/system-one.d.ts +28 -0
- package/dist/setup/sections/system-one.d.ts.map +1 -0
- package/dist/setup/sections/system-one.js +53 -0
- package/dist/setup/sections/system-one.js.map +1 -0
- package/dist/setup/wizard.d.ts +15 -1
- package/dist/setup/wizard.d.ts.map +1 -1
- package/dist/setup/wizard.js +15 -0
- package/dist/setup/wizard.js.map +1 -1
- package/dist/skills/orchestrator/startup.d.ts.map +1 -1
- package/dist/skills/orchestrator/startup.js +18 -31
- package/dist/skills/orchestrator/startup.js.map +1 -1
- package/dist/skills/prune-bundled.d.ts +40 -1
- package/dist/skills/prune-bundled.d.ts.map +1 -1
- package/dist/skills/prune-bundled.js +117 -1
- package/dist/skills/prune-bundled.js.map +1 -1
- package/dist/snapshot/index.d.ts.map +1 -1
- package/dist/snapshot/index.js +60 -53
- package/dist/snapshot/index.js.map +1 -1
- package/dist/spawn/agent-identity.d.ts +33 -1
- package/dist/spawn/agent-identity.d.ts.map +1 -1
- package/dist/spawn/agent-identity.js +53 -1
- package/dist/spawn/agent-identity.js.map +1 -1
- package/dist/spawn/index.d.ts +1 -1
- package/dist/spawn/index.d.ts.map +1 -1
- package/dist/spawn/index.js +1 -1
- package/dist/spawn/index.js.map +1 -1
- package/dist/stats/index.d.ts.map +1 -1
- package/dist/stats/index.js +3 -4
- package/dist/stats/index.js.map +1 -1
- package/dist/status/index.d.ts +12 -3
- package/dist/status/index.d.ts.map +1 -1
- package/dist/status/index.js +47 -5
- package/dist/status/index.js.map +1 -1
- package/dist/store/agent-registry-accessor.d.ts.map +1 -1
- package/dist/store/agent-registry-accessor.js +2 -0
- package/dist/store/agent-registry-accessor.js.map +1 -1
- package/dist/store/attachment-repair.d.ts.map +1 -1
- package/dist/store/attachment-repair.js +42 -3
- package/dist/store/attachment-repair.js.map +1 -1
- package/dist/store/attachment-store.d.ts.map +1 -1
- package/dist/store/attachment-store.js +30 -46
- package/dist/store/attachment-store.js.map +1 -1
- package/dist/store/backup-pack.js +1 -1
- package/dist/store/backup-pack.js.map +1 -1
- package/dist/store/backup-recover-brain.d.ts +4 -0
- package/dist/store/backup-recover-brain.d.ts.map +1 -1
- package/dist/store/backup-recover-brain.js +2 -0
- package/dist/store/backup-recover-brain.js.map +1 -1
- package/dist/store/backup-recover.d.ts +9 -0
- package/dist/store/backup-recover.d.ts.map +1 -1
- package/dist/store/backup-recover.js +28 -1
- package/dist/store/backup-recover.js.map +1 -1
- package/dist/store/backup-sidecar.d.ts +30 -0
- package/dist/store/backup-sidecar.d.ts.map +1 -1
- package/dist/store/backup-sidecar.js +90 -2
- package/dist/store/backup-sidecar.js.map +1 -1
- package/dist/store/backup.d.ts +15 -1
- package/dist/store/backup.d.ts.map +1 -1
- package/dist/store/backup.js +18 -2
- package/dist/store/backup.js.map +1 -1
- package/dist/store/blob-keep.d.ts +135 -0
- package/dist/store/blob-keep.d.ts.map +1 -0
- package/dist/store/blob-keep.js +283 -0
- package/dist/store/blob-keep.js.map +1 -0
- package/dist/store/conduit-sqlite.d.ts.map +1 -1
- package/dist/store/conduit-sqlite.js +3 -0
- package/dist/store/conduit-sqlite.js.map +1 -1
- package/dist/store/converters.d.ts.map +1 -1
- package/dist/store/converters.js +11 -0
- package/dist/store/converters.js.map +1 -1
- package/dist/store/credential-transfer.d.ts +37 -5
- package/dist/store/credential-transfer.d.ts.map +1 -1
- package/dist/store/credential-transfer.js +75 -18
- package/dist/store/credential-transfer.js.map +1 -1
- package/dist/store/cross-db-cleanup.d.ts.map +1 -1
- package/dist/store/cross-db-cleanup.js +2 -0
- package/dist/store/cross-db-cleanup.js.map +1 -1
- package/dist/store/data-accessor.d.ts +1 -1
- package/dist/store/data-accessor.d.ts.map +1 -1
- package/dist/store/data-accessor.js.map +1 -1
- package/dist/store/db-helpers.d.ts +18 -0
- package/dist/store/db-helpers.d.ts.map +1 -1
- package/dist/store/db-helpers.js +46 -0
- package/dist/store/db-helpers.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +13 -2
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/exodus/on-open.d.ts.map +1 -1
- package/dist/store/exodus/on-open.js +35 -0
- package/dist/store/exodus/on-open.js.map +1 -1
- package/dist/store/exodus/runtime-targets.d.ts +3 -3
- package/dist/store/exodus/runtime-targets.js +3 -3
- package/dist/store/import-remap.d.ts +12 -1
- package/dist/store/import-remap.d.ts.map +1 -1
- package/dist/store/import-remap.js +14 -0
- package/dist/store/import-remap.js.map +1 -1
- package/dist/store/legacy-tasks-lineage.d.ts +3 -1
- package/dist/store/legacy-tasks-lineage.d.ts.map +1 -1
- package/dist/store/legacy-tasks-lineage.js +3 -1
- package/dist/store/legacy-tasks-lineage.js.map +1 -1
- package/dist/store/memory-accessor.js +1 -1
- package/dist/store/memory-accessor.js.map +1 -1
- package/dist/store/migrate-signaldock-to-conduit.d.ts.map +1 -1
- package/dist/store/migrate-signaldock-to-conduit.js +3 -0
- package/dist/store/migrate-signaldock-to-conduit.js.map +1 -1
- package/dist/store/migration-manager.d.ts +61 -0
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +138 -6
- package/dist/store/migration-manager.js.map +1 -1
- package/dist/store/migration-sqlite.d.ts.map +1 -1
- package/dist/store/migration-sqlite.js +2 -0
- package/dist/store/migration-sqlite.js.map +1 -1
- package/dist/store/nexus-sqlite.d.ts.map +1 -1
- package/dist/store/nexus-sqlite.js +3 -0
- package/dist/store/nexus-sqlite.js.map +1 -1
- package/dist/store/nexus-validation-schemas.d.ts +64 -0
- package/dist/store/nexus-validation-schemas.d.ts.map +1 -1
- package/dist/store/open-cleo-db.d.ts.map +1 -1
- package/dist/store/open-cleo-db.js +3 -0
- package/dist/store/open-cleo-db.js.map +1 -1
- package/dist/store/portable-bundle-import.d.ts +8 -0
- package/dist/store/portable-bundle-import.d.ts.map +1 -1
- package/dist/store/portable-bundle-import.js +12 -0
- package/dist/store/portable-bundle-import.js.map +1 -1
- package/dist/store/portable-bundle-relocate.d.ts.map +1 -1
- package/dist/store/portable-bundle-relocate.js +2 -0
- package/dist/store/portable-bundle-relocate.js.map +1 -1
- package/dist/store/portable-bundle-scan.d.ts.map +1 -1
- package/dist/store/portable-bundle-scan.js +2 -1
- package/dist/store/portable-bundle-scan.js.map +1 -1
- package/dist/store/portable-bundle.d.ts.map +1 -1
- package/dist/store/portable-bundle.js +15 -14
- package/dist/store/portable-bundle.js.map +1 -1
- package/dist/store/ports/domain-binding.d.ts.map +1 -1
- package/dist/store/ports/domain-binding.js +5 -0
- package/dist/store/ports/domain-binding.js.map +1 -1
- package/dist/store/pre-repair-snapshot.d.ts +4 -1
- package/dist/store/pre-repair-snapshot.d.ts.map +1 -1
- package/dist/store/pre-repair-snapshot.js +5 -1
- package/dist/store/pre-repair-snapshot.js.map +1 -1
- package/dist/store/regenerators.d.ts +4 -2
- package/dist/store/regenerators.d.ts.map +1 -1
- package/dist/store/regenerators.js +7 -3
- package/dist/store/regenerators.js.map +1 -1
- package/dist/store/repair-malformed-dbs.d.ts +4 -0
- package/dist/store/repair-malformed-dbs.d.ts.map +1 -1
- package/dist/store/repair-malformed-dbs.js +3 -0
- package/dist/store/repair-malformed-dbs.js.map +1 -1
- package/dist/store/safety-data-accessor.d.ts +8 -3
- package/dist/store/safety-data-accessor.d.ts.map +1 -1
- package/dist/store/safety-data-accessor.js +11 -4
- package/dist/store/safety-data-accessor.js.map +1 -1
- package/dist/store/schema/cleo-global/nexus.d.ts +48 -0
- package/dist/store/schema/cleo-global/nexus.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/nexus.js +17 -0
- package/dist/store/schema/cleo-global/nexus.js.map +1 -1
- package/dist/store/schema/cleo-project/docs.d.ts +16 -0
- package/dist/store/schema/cleo-project/docs.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/docs.js +10 -0
- package/dist/store/schema/cleo-project/docs.js.map +1 -1
- package/dist/store/schema/cleo-project/tasks-core.d.ts +80 -0
- package/dist/store/schema/cleo-project/tasks-core.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/tasks-core.js +25 -1
- package/dist/store/schema/cleo-project/tasks-core.js.map +1 -1
- package/dist/store/schema/cleo-shared/brain.d.ts +1 -1
- package/dist/store/schema/memory-schema.d.ts +1 -1
- package/dist/store/schema/nexus-schema.d.ts +48 -0
- package/dist/store/schema/nexus-schema.d.ts.map +1 -1
- package/dist/store/schema/nexus-schema.js +28 -7
- package/dist/store/schema/nexus-schema.js.map +1 -1
- package/dist/store/session-store.d.ts +65 -0
- package/dist/store/session-store.d.ts.map +1 -1
- package/dist/store/session-store.js +108 -7
- package/dist/store/session-store.js.map +1 -1
- package/dist/store/split-brain-import.d.ts.map +1 -1
- package/dist/store/split-brain-import.js +2 -0
- package/dist/store/split-brain-import.js.map +1 -1
- package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
- package/dist/store/sqlite-data-accessor.js +252 -47
- package/dist/store/sqlite-data-accessor.js.map +1 -1
- package/dist/store/sqlite-native.d.ts.map +1 -1
- package/dist/store/sqlite-native.js +1 -0
- package/dist/store/sqlite-native.js.map +1 -1
- package/dist/store/sqlite.d.ts +15 -3
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +57 -20
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/store-write-guard.d.ts +9 -3
- package/dist/store/store-write-guard.d.ts.map +1 -1
- package/dist/store/store-write-guard.js +25 -4
- package/dist/store/store-write-guard.js.map +1 -1
- package/dist/store/table-classification.d.ts +1 -1
- package/dist/store/table-classification.d.ts.map +1 -1
- package/dist/store/table-classification.js +34 -8
- package/dist/store/table-classification.js.map +1 -1
- package/dist/store/task-claim.d.ts +144 -0
- package/dist/store/task-claim.d.ts.map +1 -0
- package/dist/store/task-claim.js +195 -0
- package/dist/store/task-claim.js.map +1 -0
- package/dist/store/task-version.d.ts +43 -5
- package/dist/store/task-version.d.ts.map +1 -1
- package/dist/store/task-version.js +113 -17
- package/dist/store/task-version.js.map +1 -1
- package/dist/store/tasks-schema.d.ts +2 -0
- package/dist/store/tasks-schema.d.ts.map +1 -1
- package/dist/store/tasks-schema.js +1 -0
- package/dist/store/tasks-schema.js.map +1 -1
- package/dist/store/tasks-sqlite.js +1 -1
- package/dist/store/tasks-sqlite.js.map +1 -1
- package/dist/store/twin-collapse.d.ts +339 -22
- package/dist/store/twin-collapse.d.ts.map +1 -1
- package/dist/store/twin-collapse.js +1323 -48
- package/dist/store/twin-collapse.js.map +1 -1
- package/dist/store/umbrella-data-accessor.d.ts +8 -3
- package/dist/store/umbrella-data-accessor.d.ts.map +1 -1
- package/dist/store/umbrella-data-accessor.js +10 -4
- package/dist/store/umbrella-data-accessor.js.map +1 -1
- package/dist/store/validation-schemas.d.ts +161 -1
- package/dist/store/validation-schemas.d.ts.map +1 -1
- package/dist/store/with-retry.d.ts +36 -0
- package/dist/store/with-retry.d.ts.map +1 -1
- package/dist/store/with-retry.js +51 -0
- package/dist/store/with-retry.js.map +1 -1
- package/dist/store/worktree-build-guard.d.ts +200 -0
- package/dist/store/worktree-build-guard.d.ts.map +1 -0
- package/dist/store/worktree-build-guard.js +497 -0
- package/dist/store/worktree-build-guard.js.map +1 -0
- package/dist/store/worktree-isolation-guard.d.ts +138 -0
- package/dist/store/worktree-isolation-guard.d.ts.map +1 -1
- package/dist/store/worktree-isolation-guard.js +189 -2
- package/dist/store/worktree-isolation-guard.js.map +1 -1
- package/dist/store/writer-lease.d.ts.map +1 -1
- package/dist/store/writer-lease.js +2 -0
- package/dist/store/writer-lease.js.map +1 -1
- package/dist/system/backup.d.ts +13 -2
- package/dist/system/backup.d.ts.map +1 -1
- package/dist/system/backup.js +11 -3
- package/dist/system/backup.js.map +1 -1
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +3 -1
- package/dist/system/health.js.map +1 -1
- package/dist/system/inject-generate.d.ts.map +1 -1
- package/dist/system/inject-generate.js +23 -10
- package/dist/system/inject-generate.js.map +1 -1
- package/dist/system/project-health.d.ts +8 -0
- package/dist/system/project-health.d.ts.map +1 -1
- package/dist/system/project-health.js +13 -5
- package/dist/system/project-health.js.map +1 -1
- package/dist/task-tools/index.d.ts +4 -2
- package/dist/task-tools/index.d.ts.map +1 -1
- package/dist/task-tools/index.js +3 -2
- package/dist/task-tools/index.js.map +1 -1
- package/dist/task-tools/score-task-priority.d.ts +131 -18
- package/dist/task-tools/score-task-priority.d.ts.map +1 -1
- package/dist/task-tools/score-task-priority.js +243 -80
- package/dist/task-tools/score-task-priority.js.map +1 -1
- package/dist/task-work/claims.d.ts +215 -0
- package/dist/task-work/claims.d.ts.map +1 -0
- package/dist/task-work/claims.js +272 -0
- package/dist/task-work/claims.js.map +1 -0
- package/dist/task-work/index.d.ts +47 -3
- package/dist/task-work/index.d.ts.map +1 -1
- package/dist/task-work/index.js +74 -41
- package/dist/task-work/index.js.map +1 -1
- package/dist/tasks/add.d.ts.map +1 -1
- package/dist/tasks/add.js +3 -2
- package/dist/tasks/add.js.map +1 -1
- package/dist/tasks/affected-packages.d.ts +5 -1
- package/dist/tasks/affected-packages.d.ts.map +1 -1
- package/dist/tasks/affected-packages.js +21 -3
- package/dist/tasks/affected-packages.js.map +1 -1
- package/dist/tasks/analyze.d.ts +29 -1
- package/dist/tasks/analyze.d.ts.map +1 -1
- package/dist/tasks/analyze.js +47 -37
- package/dist/tasks/analyze.js.map +1 -1
- package/dist/tasks/backfill-child-projections.d.ts.map +1 -1
- package/dist/tasks/backfill-child-projections.js +4 -1
- package/dist/tasks/backfill-child-projections.js.map +1 -1
- package/dist/tasks/change-set.d.ts +5 -0
- package/dist/tasks/change-set.d.ts.map +1 -1
- package/dist/tasks/change-set.js +75 -6
- package/dist/tasks/change-set.js.map +1 -1
- package/dist/tasks/command-line.d.ts +54 -0
- package/dist/tasks/command-line.d.ts.map +1 -0
- package/dist/tasks/command-line.js +151 -0
- package/dist/tasks/command-line.js.map +1 -0
- package/dist/tasks/complete.d.ts +16 -0
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +27 -7
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/component-pr.d.ts +162 -1
- package/dist/tasks/component-pr.d.ts.map +1 -1
- package/dist/tasks/component-pr.js +639 -53
- package/dist/tasks/component-pr.js.map +1 -1
- package/dist/tasks/delete.d.ts.map +1 -1
- package/dist/tasks/delete.js +20 -0
- package/dist/tasks/delete.js.map +1 -1
- package/dist/tasks/done-record.d.ts +14 -1
- package/dist/tasks/done-record.d.ts.map +1 -1
- package/dist/tasks/done-record.js +37 -0
- package/dist/tasks/done-record.js.map +1 -1
- package/dist/tasks/duplicate-detector.d.ts +23 -4
- package/dist/tasks/duplicate-detector.d.ts.map +1 -1
- package/dist/tasks/duplicate-detector.js +14 -5
- package/dist/tasks/duplicate-detector.js.map +1 -1
- package/dist/tasks/engine-wrap-ops.d.ts +48 -10
- package/dist/tasks/engine-wrap-ops.d.ts.map +1 -1
- package/dist/tasks/engine-wrap-ops.js +78 -10
- package/dist/tasks/engine-wrap-ops.js.map +1 -1
- package/dist/tasks/engine-wrap.d.ts +1 -1
- package/dist/tasks/engine-wrap.d.ts.map +1 -1
- package/dist/tasks/engine-wrap.js +1 -1
- package/dist/tasks/engine-wrap.js.map +1 -1
- package/dist/tasks/evidence.d.ts +2 -0
- package/dist/tasks/evidence.d.ts.map +1 -1
- package/dist/tasks/evidence.js +30 -4
- package/dist/tasks/evidence.js.map +1 -1
- package/dist/tasks/gate-runner.d.ts.map +1 -1
- package/dist/tasks/gate-runner.js +48 -12
- package/dist/tasks/gate-runner.js.map +1 -1
- package/dist/tasks/graph-ops.d.ts +9 -2
- package/dist/tasks/graph-ops.d.ts.map +1 -1
- package/dist/tasks/graph-ops.js +24 -32
- package/dist/tasks/graph-ops.js.map +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +1 -1
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/ops.d.ts +1 -0
- package/dist/tasks/ops.d.ts.map +1 -1
- package/dist/tasks/plan.d.ts.map +1 -1
- package/dist/tasks/plan.js +16 -60
- package/dist/tasks/plan.js.map +1 -1
- package/dist/tasks/ranking-audit.d.ts +122 -0
- package/dist/tasks/ranking-audit.d.ts.map +1 -0
- package/dist/tasks/ranking-audit.js +193 -0
- package/dist/tasks/ranking-audit.js.map +1 -0
- package/dist/tasks/task-analyze.d.ts.map +1 -1
- package/dist/tasks/task-analyze.js +19 -32
- package/dist/tasks/task-analyze.js.map +1 -1
- package/dist/tasks/task-context.d.ts.map +1 -1
- package/dist/tasks/task-context.js +13 -0
- package/dist/tasks/task-context.js.map +1 -1
- package/dist/tasks/task-import.d.ts.map +1 -1
- package/dist/tasks/task-import.js +21 -12
- package/dist/tasks/task-import.js.map +1 -1
- package/dist/tasks/task-next.d.ts +67 -2
- package/dist/tasks/task-next.d.ts.map +1 -1
- package/dist/tasks/task-next.js +99 -102
- package/dist/tasks/task-next.js.map +1 -1
- package/dist/tasks/task-ops.d.ts +1 -1
- package/dist/tasks/task-ops.d.ts.map +1 -1
- package/dist/tasks/task-ops.js +1 -1
- package/dist/tasks/task-ops.js.map +1 -1
- package/dist/tasks/tool-resolver.d.ts +7 -1
- package/dist/tasks/tool-resolver.d.ts.map +1 -1
- package/dist/tasks/tool-resolver.js +24 -10
- package/dist/tasks/tool-resolver.js.map +1 -1
- package/dist/tasks/update.d.ts +8 -2
- package/dist/tasks/update.d.ts.map +1 -1
- package/dist/tasks/update.js +35 -6
- package/dist/tasks/update.js.map +1 -1
- package/dist/telemetry/sqlite.d.ts.map +1 -1
- package/dist/telemetry/sqlite.js +2 -0
- package/dist/telemetry/sqlite.js.map +1 -1
- package/dist/upgrade.d.ts +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +48 -9
- package/dist/upgrade.js.map +1 -1
- package/dist/validation/doctor/checks.d.ts +20 -6
- package/dist/validation/doctor/checks.d.ts.map +1 -1
- package/dist/validation/doctor/checks.js +53 -10
- package/dist/validation/doctor/checks.js.map +1 -1
- package/dist/validation/validate-ops.d.ts.map +1 -1
- package/dist/validation/validate-ops.js +2 -3
- package/dist/validation/validate-ops.js.map +1 -1
- package/migrations/drizzle-cleo-global/20260929010000_t12512-registry-probed-opened/migration.sql +35 -0
- package/migrations/drizzle-cleo-global/20260929020000_t12721-git-state-head-committed-at/migration.sql +25 -0
- package/migrations/drizzle-cleo-project/20260929000000_t12535-docs-attachments-union-shape/migration.sql +21 -0
- package/migrations/drizzle-cleo-project/20260929120000_t12502-task-claim-leases/migration.sql +77 -0
- package/migrations/drizzle-cleo-project/20260929130000_t12736-claim-lease-iso-repair/migration.sql +37 -0
- package/package.json +24 -14
- package/schemas/config.schema.json +13 -0
- package/schemas/project-info.schema.json +10 -4
- package/templates/CLEO-INJECTION.md +1 -1
- package/templates/CLEO-REFERENCE.md +7 -3
- package/templates/cleo-gitignore +11 -0
- package/templates/workflows/release-prepare.yml.tmpl +156 -10
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* @task T12491
|
|
9
9
|
* @epic T12486
|
|
10
10
|
*/
|
|
11
|
-
import type
|
|
11
|
+
import { type DecideProfileListResult, type DecideProviderState as DecideProviderStateContract, type DecisionAnswer, type DecisionProviderCapabilities, type DecisionProviderKind, type DecisionProviderUsage } from '@cleocode/contracts';
|
|
12
12
|
import { type DecideCredentialsSummary, type SealedDecideConnection } from './credentials.js';
|
|
13
|
+
import { type SpendLedger, type SpendLedgerHealth, type SpendResetOptions, type SpendResetReceipt } from './spend.js';
|
|
13
14
|
/** Default deadline for the `GET /v1/models` probe, ms. */
|
|
14
15
|
export declare const DEFAULT_DECIDE_PROBE_TIMEOUT_MS = 3000;
|
|
15
16
|
/** Default deadline for `cleo decide ask`, ms (generous: it is a debug tool). */
|
|
@@ -18,15 +19,34 @@ export declare const DEFAULT_DECIDE_ASK_TIMEOUT_MS = 10000;
|
|
|
18
19
|
* Reachability of the configured provider.
|
|
19
20
|
*
|
|
20
21
|
* - `reachable` — `GET /v1/models` answered 2xx.
|
|
21
|
-
* - `unauthorized` — the provider rejected the key (401
|
|
22
|
+
* - `unauthorized` — the provider rejected the key (401, or a 403 that is not a key limit).
|
|
23
|
+
* - `key_limit_reached` — the key's monthly decision limit is reached (403
|
|
24
|
+
* `key_limit_exceeded`); decisions resume when the UTC month rolls over.
|
|
22
25
|
* - `unconfigured` — no valid base URL + key stored.
|
|
23
26
|
* - `unreachable` — network failure, timeout, or any other HTTP status.
|
|
24
27
|
*/
|
|
25
|
-
export type DecideProviderState =
|
|
28
|
+
export type DecideProviderState = DecideProviderStateContract;
|
|
29
|
+
/** Month-to-date spend against the CLEO cap (D11159). */
|
|
30
|
+
export interface DecideSpendSummary {
|
|
31
|
+
/** UTC month, `YYYY-MM`. */
|
|
32
|
+
readonly month: string;
|
|
33
|
+
/** Micro-dollars recorded this month. */
|
|
34
|
+
readonly spentMicros: number;
|
|
35
|
+
/** Micro-dollars reserved by calls in flight. */
|
|
36
|
+
readonly reservedMicros: number;
|
|
37
|
+
/** The cap, micro-dollars (`decide.budget.monthlyMicros`). */
|
|
38
|
+
readonly capMicros: number;
|
|
39
|
+
/** Whether sites are degraded to their heuristics because the cap is reached. */
|
|
40
|
+
readonly capReached: boolean;
|
|
41
|
+
/** ISO time until which the key's monthly limit stops decisions, when set. */
|
|
42
|
+
readonly keyLimitedUntil?: string;
|
|
43
|
+
}
|
|
26
44
|
/** Result of {@link probeDecideProvider}. */
|
|
27
45
|
export interface DecideProbeResult {
|
|
28
46
|
/** Reachability verdict. */
|
|
29
47
|
readonly state: DecideProviderState;
|
|
48
|
+
/** Profile id probed (`<provider>/<name>`, T12733), when known. */
|
|
49
|
+
readonly profile?: string;
|
|
30
50
|
/** Configured base URL. */
|
|
31
51
|
readonly baseUrl?: string;
|
|
32
52
|
/** Masked key preview. */
|
|
@@ -43,6 +63,18 @@ export interface DecideProbeResult {
|
|
|
43
63
|
readonly latencyMs?: number;
|
|
44
64
|
/** Secret-free explanation or warning. */
|
|
45
65
|
readonly detail?: string;
|
|
66
|
+
/** Registered decision sites (T12662). */
|
|
67
|
+
readonly sites: number;
|
|
68
|
+
/** What the provider supports beyond the Jev minimum (T12664). */
|
|
69
|
+
readonly capabilities?: DecisionProviderCapabilities;
|
|
70
|
+
/** Last usage/balance read (refreshed at most every 10 minutes). */
|
|
71
|
+
readonly usage?: DecisionProviderUsage & {
|
|
72
|
+
readonly fetchedAt: string;
|
|
73
|
+
};
|
|
74
|
+
/** Month-to-date spend against the cap. */
|
|
75
|
+
readonly spend?: DecideSpendSummary;
|
|
76
|
+
/** Spend-ledger health; `corrupt` or `unavailable` means every site falls back. */
|
|
77
|
+
readonly spendLedger?: SpendLedgerHealth;
|
|
46
78
|
}
|
|
47
79
|
/** Options for {@link probeDecideProvider}. */
|
|
48
80
|
export interface DecideProbeOptions {
|
|
@@ -52,7 +84,24 @@ export interface DecideProbeOptions {
|
|
|
52
84
|
readonly fetch?: typeof fetch;
|
|
53
85
|
/** Deadline, ms. Default {@link DEFAULT_DECIDE_PROBE_TIMEOUT_MS}. */
|
|
54
86
|
readonly timeoutMs?: number;
|
|
87
|
+
/** Spend ledger; `null` omits spend. Default: the machine-wide ledger. */
|
|
88
|
+
readonly spend?: SpendLedger | null;
|
|
89
|
+
/** Monthly cap, micro-dollars. Default: `decide.budget.monthlyMicros`, else $1. */
|
|
90
|
+
readonly capMicros?: number;
|
|
91
|
+
/** Spend-ledger path to inspect. Default: `<cleoHome>/decide/spend.json`. */
|
|
92
|
+
readonly spendStatePath?: string;
|
|
93
|
+
/** Provider-state file (capabilities + usage cache). Default: `<cleoHome>/decide/provider-state.json`. */
|
|
94
|
+
readonly providerStatePath?: string;
|
|
95
|
+
/** Wall clock, epoch ms. Default `Date.now`. */
|
|
96
|
+
readonly now?: () => number;
|
|
97
|
+
/**
|
|
98
|
+
* Re-detect capabilities even when the cached read is fresh. Set after the
|
|
99
|
+
* settings change so the provider's extensions apply immediately (T12713).
|
|
100
|
+
*/
|
|
101
|
+
readonly refreshCapabilities?: boolean;
|
|
55
102
|
}
|
|
103
|
+
/** Message naming the repair for a ledger that cannot be read. */
|
|
104
|
+
export declare const SPEND_LEDGER_REPAIR_HINT = "The System One spend ledger cannot be read, so every site uses its heuristic (the cap fails closed). Run `cleo decide budget reset` to start a fresh ledger; the old file is kept as a receipt.";
|
|
56
105
|
/**
|
|
57
106
|
* Probe the provider with `GET {baseUrl}/v1/models` under a short deadline.
|
|
58
107
|
* Never throws.
|
|
@@ -63,46 +112,104 @@ export interface DecideProbeOptions {
|
|
|
63
112
|
export declare function probeDecideProvider(opts?: DecideProbeOptions): Promise<DecideProbeResult>;
|
|
64
113
|
/** Input for {@link configureDecide}. */
|
|
65
114
|
export interface DecideConfigureInput {
|
|
66
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Provider kind. Omitted → the provider of a `<provider>/<name>` profile,
|
|
117
|
+
* else inferred from an override `baseUrl` (the layahost origin →
|
|
118
|
+
* `layahost`, any other → `jev`), else the active profile's provider, else
|
|
119
|
+
* `layahost`.
|
|
120
|
+
*/
|
|
121
|
+
readonly provider?: DecisionProviderKind;
|
|
122
|
+
/**
|
|
123
|
+
* `default` (the provider's preset URL, resolved at call time) or an
|
|
124
|
+
* override URL. Omitted → the profile's stored setting, else `default`.
|
|
125
|
+
*/
|
|
67
126
|
readonly baseUrl?: string;
|
|
68
|
-
/** API key. Omitted → the stored key is kept. */
|
|
127
|
+
/** API key. Omitted → the profile's stored key is kept. */
|
|
69
128
|
readonly apiKey?: string;
|
|
70
129
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
130
|
+
* Profile to add or update (T12733): `<provider>/<name>` or a bare name;
|
|
131
|
+
* other profiles are kept. Omitted → the active profile when it has the
|
|
132
|
+
* same provider, else `<provider>/default`.
|
|
133
|
+
*/
|
|
134
|
+
readonly profile?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Make the profile active. Omitted → true for the first profile or one that
|
|
137
|
+
* is already active, else false (adding a second key never silently
|
|
138
|
+
* switches everyday decisions).
|
|
139
|
+
*/
|
|
140
|
+
readonly activate?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Default model. Omitted → the stored model when the URL is unchanged;
|
|
143
|
+
* otherwise the preset default (`layahost`), else the first model the
|
|
144
|
+
* provider lists (`jev`).
|
|
73
145
|
*/
|
|
74
146
|
readonly model?: string;
|
|
75
|
-
/** `fetch` for the model lookup; tests inject a stub. */
|
|
147
|
+
/** `fetch` for the model lookup and the post-save probe; tests inject a stub. */
|
|
76
148
|
readonly fetch?: typeof fetch;
|
|
77
|
-
/** Deadline for the model lookup, ms. */
|
|
149
|
+
/** Deadline for the model lookup and the probe, ms. */
|
|
78
150
|
readonly timeoutMs?: number;
|
|
79
151
|
}
|
|
80
152
|
/** Result of {@link configureDecide}. */
|
|
81
153
|
export interface DecideConfigureResult extends DecideCredentialsSummary {
|
|
154
|
+
/** Whether the configured profile is now the active one. */
|
|
155
|
+
readonly active: boolean;
|
|
82
156
|
/** Where the stored model came from. */
|
|
83
|
-
readonly modelSource: 'flag' | 'stored' | 'provider-listing' | 'none';
|
|
157
|
+
readonly modelSource: 'flag' | 'stored' | 'preset' | 'provider-listing' | 'none';
|
|
158
|
+
/** Reachability verdict of the probe run after saving. */
|
|
159
|
+
readonly providerState: DecideProviderState;
|
|
160
|
+
/** Capabilities detected after saving (the provider's extensions are active from now on). */
|
|
161
|
+
readonly capabilities?: DecisionProviderCapabilities;
|
|
84
162
|
/** Secret-free warning, e.g. when no model could be resolved. */
|
|
85
163
|
readonly warning?: string;
|
|
86
164
|
}
|
|
87
165
|
/**
|
|
88
|
-
* Store
|
|
166
|
+
* Store a profile's settings, merging omitted values with the stored ones,
|
|
167
|
+
* then probe the provider and re-detect its capabilities so its extensions
|
|
168
|
+
* apply immediately.
|
|
89
169
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
170
|
+
* A model is always stored when one can be known, because the Jev
|
|
171
|
+
* `/v1/systemone` endpoint rejects a request without one (422, and every
|
|
172
|
+
* site silently falls back). The model comes from, in order: the flag; the
|
|
173
|
+
* stored model (same URL); the provider preset (`layahost` →
|
|
174
|
+
* `LAYAHOST_DEFAULT_MODEL`); the first model the provider lists. Only a
|
|
175
|
+
* `jev` provider whose listing fails can end with no model, and then a
|
|
176
|
+
* warning says how to set one.
|
|
96
177
|
*
|
|
97
|
-
* @param input - URL, key, optional model.
|
|
98
|
-
* @returns Secret-free summary plus the model's provenance.
|
|
99
178
|
* A URL whose host differs from the stored one must come with a fresh key:
|
|
100
179
|
* the stored key is never re-used (or sent in the model probe) for a new host.
|
|
101
180
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
181
|
+
* Profiles (T12733): the settings go to one profile, `<provider>/<name>`
|
|
182
|
+
* (see {@link DecideConfigureInput.profile}); every other profile is kept,
|
|
183
|
+
* and a new profile needs its own key. The URL is stored as `default` unless
|
|
184
|
+
* overridden. The post-save probe targets that profile, active or not.
|
|
185
|
+
*
|
|
186
|
+
* @param input - Provider, URL, key, optional model, profile and activation.
|
|
187
|
+
* @returns Secret-free summary plus the model's provenance and the probe verdict.
|
|
188
|
+
* @throws {DecideCredentialsError} On an invalid URL or profile, a provider
|
|
189
|
+
* without a preset URL and no override, a blank key, an invalid model name,
|
|
190
|
+
* a new profile without a key, or a host change without a fresh key.
|
|
104
191
|
*/
|
|
105
192
|
export declare function configureDecide(input: DecideConfigureInput): Promise<DecideConfigureResult>;
|
|
193
|
+
/** Options for {@link listDecideProfilesReport}. */
|
|
194
|
+
export interface DecideProfilesReportOptions {
|
|
195
|
+
/** Probe each profile's `GET /v1/models`. Default false (no network). */
|
|
196
|
+
readonly probe?: boolean;
|
|
197
|
+
/** `fetch` for the probes; tests inject a stub. */
|
|
198
|
+
readonly fetch?: typeof fetch;
|
|
199
|
+
/** Deadline per probe, ms. Default {@link DEFAULT_DECIDE_PROBE_TIMEOUT_MS}. */
|
|
200
|
+
readonly timeoutMs?: number;
|
|
201
|
+
/** Provider-state file for the probes. Default: `<cleoHome>/decide/provider-state.json`. */
|
|
202
|
+
readonly providerStatePath?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* `cleo decide profiles`: every stored profile with the active one marked and
|
|
206
|
+
* keys masked; with `probe`, each profile's reachability (probed in parallel).
|
|
207
|
+
* Never throws.
|
|
208
|
+
*
|
|
209
|
+
* @param opts - Whether to probe, plus the injectable `fetch` and deadline.
|
|
210
|
+
* @returns The secret-free profile list.
|
|
211
|
+
*/
|
|
212
|
+
export declare function listDecideProfilesReport(opts?: DecideProfilesReportOptions): Promise<DecideProfileListResult>;
|
|
106
213
|
/**
|
|
107
214
|
* Remove the stored settings (and rotated backups of them).
|
|
108
215
|
*
|
|
@@ -121,9 +228,17 @@ export interface DecideAskInput {
|
|
|
121
228
|
readonly timeoutMs?: number;
|
|
122
229
|
/** Project root for the audit line. Default: the resolved project root. */
|
|
123
230
|
readonly projectRoot?: string;
|
|
231
|
+
/** Profile to ask through (T12733), `<provider>/<name>`. Default: the active profile. */
|
|
232
|
+
readonly profile?: string;
|
|
124
233
|
}
|
|
125
234
|
/** Result of {@link askDecideDebug}. */
|
|
126
235
|
export interface DecideAskResult {
|
|
236
|
+
/** The yes/no question that was asked (so a human render can show it). */
|
|
237
|
+
readonly question?: string;
|
|
238
|
+
/** The state that was judged (echoed for the human render). */
|
|
239
|
+
readonly state?: string;
|
|
240
|
+
/** Id of the profile asked through, when one was configured (T12733). */
|
|
241
|
+
readonly profile?: string;
|
|
127
242
|
/** The typed answer. */
|
|
128
243
|
readonly answer: DecisionAnswer;
|
|
129
244
|
/** `provider`, `cache` or `fallback`. */
|
|
@@ -149,4 +264,17 @@ export interface DecideAskResult {
|
|
|
149
264
|
* @returns The typed answer with source, fallback reason, latency and cost.
|
|
150
265
|
*/
|
|
151
266
|
export declare function askDecideDebug(input: DecideAskInput): Promise<DecideAskResult>;
|
|
267
|
+
/**
|
|
268
|
+
* `cleo decide budget reset`: start a fresh spend ledger for this month,
|
|
269
|
+
* moving the old file aside as a receipt. The repair for a corrupt ledger,
|
|
270
|
+
* which otherwise keeps every site on its heuristic. A readable ledger is
|
|
271
|
+
* refused unless `opts.force`, and its month-to-date spend is carried over,
|
|
272
|
+
* so a reset never lifts a reached cap.
|
|
273
|
+
*
|
|
274
|
+
* @param statePath - Ledger path. Default: `<cleoHome>/decide/spend.json`.
|
|
275
|
+
* @param opts - `force` resets a ledger that is not corrupt.
|
|
276
|
+
* @returns The receipt: previous health, carried spend and where the old file went.
|
|
277
|
+
* @throws {SpendResetRefusedError} When the ledger is not corrupt and `force` is not set.
|
|
278
|
+
*/
|
|
279
|
+
export declare function resetDecideBudget(statePath?: string, opts?: SpendResetOptions): Promise<SpendResetReceipt>;
|
|
152
280
|
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/decide/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/decide/operations.ts"],"names":[],"mappings":"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"}
|
|
@@ -8,21 +8,69 @@
|
|
|
8
8
|
* @task T12491
|
|
9
9
|
* @epic T12486
|
|
10
10
|
*/
|
|
11
|
+
import { DECIDE_DEFAULT_PROFILE_NAME, DECIDE_PROFILE_DEFAULT_URL, JEV_MINIMUM_CAPABILITIES, } from '@cleocode/contracts';
|
|
11
12
|
import { getProjectRoot } from '../paths.js';
|
|
12
13
|
import { createJsonlDecisionAudit, } from './audit.js';
|
|
13
14
|
import { decide } from './client.js';
|
|
14
|
-
import { clearDecideCredentials, DecideCredentialsError, describeDecideCredentials, loadDecideConnection, sameDecideHost, saveDecideCredentials, } from './credentials.js';
|
|
15
|
+
import { clearDecideCredentials, DecideCredentialsError, decideProfileId, describeDecideCredentials, describeDecideProfile, isValidDecideProfileName, listDecideProfiles, loadDecideConnection, loadDecideProfile, parseDecideProfileRef, sameDecideHost, saveDecideCredentials, } from './credentials.js';
|
|
15
16
|
import { listJevModels } from './jev-wire.js';
|
|
16
17
|
import { DecisionProviderError } from './provider.js';
|
|
18
|
+
import { refreshProviderState } from './provider-state.js';
|
|
19
|
+
import { DECISION_PROVIDER_PRESETS, inferDecisionProviderKind, presetBaseUrl, } from './providers.js';
|
|
20
|
+
import { DECIDE_ASK_DECISION_SITE, DECISION_SITES } from './sites/registry.js';
|
|
21
|
+
import { createFileSpendLedger, DEFAULT_MONTHLY_SPEND_CAP_MICROS, inspectSpendLedger, MONTHLY_SPEND_CAP_KEY, resetSpendLedger, } from './spend.js';
|
|
17
22
|
/** Default deadline for the `GET /v1/models` probe, ms. */
|
|
18
23
|
export const DEFAULT_DECIDE_PROBE_TIMEOUT_MS = 3_000;
|
|
19
24
|
/** Default deadline for `cleo decide ask`, ms (generous: it is a debug tool). */
|
|
20
25
|
export const DEFAULT_DECIDE_ASK_TIMEOUT_MS = 10_000;
|
|
26
|
+
const KEY_LIMIT_DETAIL = "The key's monthly decision limit is reached (403 key_limit_exceeded). The key itself is fine: decisions resume when the UTC month rolls over, or raise the limit in the provider console.";
|
|
27
|
+
/** Message naming the repair for a ledger that cannot be read. */
|
|
28
|
+
export const SPEND_LEDGER_REPAIR_HINT = 'The System One spend ledger cannot be read, so every site uses its heuristic (the cap fails closed). Run `cleo decide budget reset` to start a fresh ledger; the old file is kept as a receipt.';
|
|
29
|
+
/** `{ detail }` when there is one, else nothing. */
|
|
30
|
+
function optionalDetail(detail) {
|
|
31
|
+
return detail ? { detail } : {};
|
|
32
|
+
}
|
|
33
|
+
/** Month-to-date spend, or undefined when the ledger is disabled or unreadable. */
|
|
34
|
+
async function spendSummary(opts) {
|
|
35
|
+
const ledger = opts.spend === undefined ? createFileSpendLedger() : opts.spend;
|
|
36
|
+
if (!ledger)
|
|
37
|
+
return undefined;
|
|
38
|
+
const status = await ledger.status();
|
|
39
|
+
if (!status)
|
|
40
|
+
return undefined;
|
|
41
|
+
let capMicros = opts.capMicros;
|
|
42
|
+
if (capMicros === undefined) {
|
|
43
|
+
try {
|
|
44
|
+
const { getConfigValue } = await import('../config/registry.js');
|
|
45
|
+
const value = await getConfigValue(MONTHLY_SPEND_CAP_KEY, {
|
|
46
|
+
projectRoot: getProjectRoot(),
|
|
47
|
+
});
|
|
48
|
+
capMicros =
|
|
49
|
+
typeof value === 'number' && value >= 0 ? value : DEFAULT_MONTHLY_SPEND_CAP_MICROS;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
capMicros = DEFAULT_MONTHLY_SPEND_CAP_MICROS;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
month: status.month,
|
|
57
|
+
spentMicros: status.spentMicros,
|
|
58
|
+
reservedMicros: status.reservedMicros,
|
|
59
|
+
capMicros,
|
|
60
|
+
capReached: status.spentMicros >= capMicros,
|
|
61
|
+
...(status.keyLimitedUntil !== undefined
|
|
62
|
+
? { keyLimitedUntil: new Date(status.keyLimitedUntil).toISOString() }
|
|
63
|
+
: {}),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
21
66
|
const NO_MODEL_WARNING = 'No default model is configured. The Jev /v1/systemone endpoint requires a model; set one with `cleo decide config --model <name>` (see `models`).';
|
|
22
67
|
function stateForError(err) {
|
|
23
68
|
if (err instanceof DecisionProviderError) {
|
|
24
69
|
if (err.kind === 'unauthorized')
|
|
25
70
|
return { state: 'unauthorized', httpStatus: err.status };
|
|
71
|
+
if (err.kind === 'key_limit_exceeded') {
|
|
72
|
+
return { state: 'key_limit_reached', httpStatus: err.status };
|
|
73
|
+
}
|
|
26
74
|
if (err.kind === 'invalid_response')
|
|
27
75
|
return { state: 'reachable', httpStatus: err.status };
|
|
28
76
|
return {
|
|
@@ -40,98 +88,239 @@ function stateForError(err) {
|
|
|
40
88
|
* @returns The reachability verdict and, when listed, the available models.
|
|
41
89
|
*/
|
|
42
90
|
export async function probeDecideProvider(opts = {}) {
|
|
91
|
+
const sites = DECISION_SITES.length;
|
|
43
92
|
const sealed = opts.connection === undefined ? loadDecideConnection() : opts.connection;
|
|
93
|
+
const spend = await spendSummary(opts);
|
|
94
|
+
const spendLedger = opts.spend === null ? undefined : inspectSpendLedger(opts.spendStatePath);
|
|
95
|
+
const ledgerBroken = spendLedger === 'corrupt' || spendLedger === 'unavailable';
|
|
96
|
+
const withHint = (detail) => ledgerBroken ? [detail, SPEND_LEDGER_REPAIR_HINT].filter(Boolean).join(' ') : detail;
|
|
44
97
|
if (!sealed) {
|
|
45
98
|
return {
|
|
46
99
|
state: 'unconfigured',
|
|
47
100
|
modelsEndpoint: 'skipped',
|
|
48
|
-
detail: 'Run `cleo decide config`.',
|
|
101
|
+
detail: withHint('Run `cleo decide config`.'),
|
|
102
|
+
sites,
|
|
103
|
+
...(spend ? { spend } : {}),
|
|
104
|
+
...(spendLedger ? { spendLedger } : {}),
|
|
49
105
|
};
|
|
50
106
|
}
|
|
51
107
|
const base = {
|
|
108
|
+
...(sealed.profile ? { profile: sealed.profile } : {}),
|
|
52
109
|
baseUrl: sealed.baseUrl,
|
|
53
110
|
keyPreview: sealed.keyPreview,
|
|
54
111
|
...(sealed.model ? { model: sealed.model } : {}),
|
|
112
|
+
sites,
|
|
113
|
+
...(spend ? { spend } : {}),
|
|
114
|
+
...(spendLedger ? { spendLedger } : {}),
|
|
55
115
|
};
|
|
116
|
+
const now = opts.now ?? Date.now;
|
|
56
117
|
const started = performance.now();
|
|
57
118
|
const signal = AbortSignal.timeout(opts.timeoutMs ?? DEFAULT_DECIDE_PROBE_TIMEOUT_MS);
|
|
119
|
+
// Capabilities + usage: reuse the cached read unless it is older than 10 minutes.
|
|
120
|
+
// Shared with decideBatch's lazy detection: at most one detection per
|
|
121
|
+
// identity per USAGE_REFRESH_MS, transient failures keep the old state.
|
|
122
|
+
const state = await refreshProviderState(sealed.connection(), signal, {
|
|
123
|
+
...(opts.fetch ? { fetch: opts.fetch } : {}),
|
|
124
|
+
now,
|
|
125
|
+
...(opts.providerStatePath !== undefined ? { path: opts.providerStatePath } : {}),
|
|
126
|
+
force: opts.refreshCapabilities === true,
|
|
127
|
+
});
|
|
128
|
+
const extras = {
|
|
129
|
+
capabilities: state?.capabilities ?? JEV_MINIMUM_CAPABILITIES,
|
|
130
|
+
...(state?.usage
|
|
131
|
+
? { usage: { ...state.usage, fetchedAt: new Date(state.detectedAt).toISOString() } }
|
|
132
|
+
: {}),
|
|
133
|
+
};
|
|
58
134
|
try {
|
|
59
135
|
const models = await listJevModels(sealed.connection(), signal, { fetch: opts.fetch });
|
|
136
|
+
const keyLimited = spend?.keyLimitedUntil !== undefined;
|
|
60
137
|
return {
|
|
61
138
|
...base,
|
|
62
|
-
|
|
139
|
+
...extras,
|
|
140
|
+
state: keyLimited ? 'key_limit_reached' : 'reachable',
|
|
63
141
|
modelsEndpoint: 'ok',
|
|
64
142
|
models,
|
|
65
143
|
httpStatus: 200,
|
|
66
144
|
latencyMs: Math.round(performance.now() - started),
|
|
67
|
-
...(sealed.model ?
|
|
145
|
+
...optionalDetail(withHint(keyLimited ? KEY_LIMIT_DETAIL : sealed.model ? undefined : NO_MODEL_WARNING)),
|
|
68
146
|
};
|
|
69
147
|
}
|
|
70
148
|
catch (err) {
|
|
71
149
|
const verdict = stateForError(err);
|
|
72
150
|
return {
|
|
73
151
|
...base,
|
|
152
|
+
...extras,
|
|
74
153
|
...verdict,
|
|
75
154
|
modelsEndpoint: 'failed',
|
|
76
155
|
latencyMs: Math.round(performance.now() - started),
|
|
77
|
-
|
|
156
|
+
...optionalDetail(withHint(verdict.state === 'key_limit_reached'
|
|
157
|
+
? KEY_LIMIT_DETAIL
|
|
158
|
+
: err instanceof Error
|
|
159
|
+
? err.message
|
|
160
|
+
: 'probe failed')),
|
|
78
161
|
};
|
|
79
162
|
}
|
|
80
163
|
}
|
|
164
|
+
/** The profile {@link configureDecide} writes. */
|
|
165
|
+
function configureTarget(input) {
|
|
166
|
+
const raw = input.profile?.trim();
|
|
167
|
+
if (raw?.includes('/')) {
|
|
168
|
+
const ref = parseDecideProfileRef(raw);
|
|
169
|
+
if (!ref) {
|
|
170
|
+
throw new DecideCredentialsError(`invalid profile '${raw}' (use <provider>/<name>, e.g. layahost/work)`);
|
|
171
|
+
}
|
|
172
|
+
if (input.provider && input.provider !== ref.provider) {
|
|
173
|
+
throw new DecideCredentialsError(`profile '${ref.id}' belongs to ${ref.provider}, not ${input.provider}`);
|
|
174
|
+
}
|
|
175
|
+
return ref;
|
|
176
|
+
}
|
|
177
|
+
const active = listDecideProfiles().active;
|
|
178
|
+
const activeRef = active ? parseDecideProfileRef(active) : null;
|
|
179
|
+
const url = input.baseUrl?.trim();
|
|
180
|
+
const provider = input.provider ??
|
|
181
|
+
(url && url !== DECIDE_PROFILE_DEFAULT_URL
|
|
182
|
+
? inferDecisionProviderKind(url)
|
|
183
|
+
: (activeRef?.provider ?? 'layahost'));
|
|
184
|
+
const name = raw || (activeRef?.provider === provider ? activeRef.name : DECIDE_DEFAULT_PROFILE_NAME);
|
|
185
|
+
if (!isValidDecideProfileName(name)) {
|
|
186
|
+
throw new DecideCredentialsError(`invalid profile name '${name}' (use 1-32 lowercase letters, digits or -, starting and ending with a letter or digit)`);
|
|
187
|
+
}
|
|
188
|
+
return { provider, name, id: decideProfileId(provider, name) };
|
|
189
|
+
}
|
|
81
190
|
/**
|
|
82
|
-
* Store
|
|
191
|
+
* Store a profile's settings, merging omitted values with the stored ones,
|
|
192
|
+
* then probe the provider and re-detect its capabilities so its extensions
|
|
193
|
+
* apply immediately.
|
|
83
194
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
195
|
+
* A model is always stored when one can be known, because the Jev
|
|
196
|
+
* `/v1/systemone` endpoint rejects a request without one (422, and every
|
|
197
|
+
* site silently falls back). The model comes from, in order: the flag; the
|
|
198
|
+
* stored model (same URL); the provider preset (`layahost` →
|
|
199
|
+
* `LAYAHOST_DEFAULT_MODEL`); the first model the provider lists. Only a
|
|
200
|
+
* `jev` provider whose listing fails can end with no model, and then a
|
|
201
|
+
* warning says how to set one.
|
|
90
202
|
*
|
|
91
|
-
* @param input - URL, key, optional model.
|
|
92
|
-
* @returns Secret-free summary plus the model's provenance.
|
|
93
203
|
* A URL whose host differs from the stored one must come with a fresh key:
|
|
94
204
|
* the stored key is never re-used (or sent in the model probe) for a new host.
|
|
95
205
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
206
|
+
* Profiles (T12733): the settings go to one profile, `<provider>/<name>`
|
|
207
|
+
* (see {@link DecideConfigureInput.profile}); every other profile is kept,
|
|
208
|
+
* and a new profile needs its own key. The URL is stored as `default` unless
|
|
209
|
+
* overridden. The post-save probe targets that profile, active or not.
|
|
210
|
+
*
|
|
211
|
+
* @param input - Provider, URL, key, optional model, profile and activation.
|
|
212
|
+
* @returns Secret-free summary plus the model's provenance and the probe verdict.
|
|
213
|
+
* @throws {DecideCredentialsError} On an invalid URL or profile, a provider
|
|
214
|
+
* without a preset URL and no override, a blank key, an invalid model name,
|
|
215
|
+
* a new profile without a key, or a host change without a fresh key.
|
|
98
216
|
*/
|
|
99
217
|
export async function configureDecide(input) {
|
|
100
|
-
const
|
|
101
|
-
const
|
|
218
|
+
const target = configureTarget(input);
|
|
219
|
+
const stored = loadDecideProfile(target.id);
|
|
220
|
+
const storedSetting = stored && describeDecideProfile(target.id).urlSource === 'override'
|
|
221
|
+
? stored.baseUrl
|
|
222
|
+
: DECIDE_PROFILE_DEFAULT_URL;
|
|
223
|
+
const urlSetting = input.baseUrl?.trim() || storedSetting;
|
|
224
|
+
const baseUrl = urlSetting === DECIDE_PROFILE_DEFAULT_URL ? presetBaseUrl(target.provider) : urlSetting;
|
|
225
|
+
if (!baseUrl) {
|
|
226
|
+
throw new DecideCredentialsError(`the ${target.provider} provider has no default URL: pass --url https://your-provider.example (https, or http only for localhost)`);
|
|
227
|
+
}
|
|
102
228
|
const freshKey = input.apiKey?.trim();
|
|
229
|
+
if (!freshKey && !stored) {
|
|
230
|
+
throw new DecideCredentialsError(`profile '${target.id}' has no stored key; pass --key-stdin (keys are never copied between profiles)`);
|
|
231
|
+
}
|
|
103
232
|
if (!freshKey && stored && !sameDecideHost(stored.baseUrl, baseUrl)) {
|
|
104
233
|
throw new DecideCredentialsError('changing the provider host requires a fresh key; pass --key-stdin (the stored key is never sent to a new host)');
|
|
105
234
|
}
|
|
106
235
|
const apiKey = freshKey || stored?.connection().apiKey || '';
|
|
236
|
+
const preset = DECISION_PROVIDER_PRESETS[target.provider];
|
|
107
237
|
const explicit = input.model?.trim();
|
|
238
|
+
let model;
|
|
239
|
+
let modelSource = 'none';
|
|
108
240
|
if (explicit) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
241
|
+
model = explicit;
|
|
242
|
+
modelSource = 'flag';
|
|
243
|
+
}
|
|
244
|
+
else if (stored?.model && stored.baseUrl === baseUrl) {
|
|
245
|
+
model = stored.model;
|
|
246
|
+
modelSource = 'stored';
|
|
113
247
|
}
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
248
|
+
else if (preset.defaultModel) {
|
|
249
|
+
model = preset.defaultModel;
|
|
250
|
+
modelSource = 'preset';
|
|
117
251
|
}
|
|
118
|
-
const
|
|
252
|
+
const settings = {
|
|
253
|
+
provider: target.provider,
|
|
254
|
+
profile: target.id,
|
|
255
|
+
baseUrl: urlSetting,
|
|
256
|
+
apiKey,
|
|
257
|
+
};
|
|
258
|
+
const saved = await saveDecideCredentials({
|
|
259
|
+
...settings,
|
|
260
|
+
...(model ? { model } : {}),
|
|
261
|
+
...(input.activate !== undefined ? { activate: input.activate } : {}),
|
|
262
|
+
});
|
|
119
263
|
const probe = await probeDecideProvider({
|
|
120
|
-
connection:
|
|
264
|
+
connection: loadDecideProfile(target.id),
|
|
121
265
|
fetch: input.fetch,
|
|
122
266
|
timeoutMs: input.timeoutMs,
|
|
267
|
+
refreshCapabilities: true,
|
|
123
268
|
});
|
|
269
|
+
const verdict = {
|
|
270
|
+
active: saved.activeProfile === target.id,
|
|
271
|
+
providerState: probe.state,
|
|
272
|
+
...(probe.capabilities ? { capabilities: probe.capabilities } : {}),
|
|
273
|
+
};
|
|
274
|
+
if (model)
|
|
275
|
+
return { ...saved, modelSource, ...verdict };
|
|
124
276
|
const first = probe.models?.[0];
|
|
125
277
|
if (!first) {
|
|
126
278
|
const why = probe.state === 'reachable' ? 'the provider listed no models' : `probe ${probe.state}`;
|
|
127
279
|
return {
|
|
128
280
|
...saved,
|
|
129
281
|
modelSource: 'none',
|
|
282
|
+
...verdict,
|
|
130
283
|
warning: `No model stored (${why}). ${NO_MODEL_WARNING}`,
|
|
131
284
|
};
|
|
132
285
|
}
|
|
133
|
-
const withModel = await saveDecideCredentials({
|
|
134
|
-
|
|
286
|
+
const withModel = await saveDecideCredentials({
|
|
287
|
+
...settings,
|
|
288
|
+
model: first,
|
|
289
|
+
activate: verdict.active,
|
|
290
|
+
});
|
|
291
|
+
return { ...withModel, modelSource: 'provider-listing', ...verdict };
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* `cleo decide profiles`: every stored profile with the active one marked and
|
|
295
|
+
* keys masked; with `probe`, each profile's reachability (probed in parallel).
|
|
296
|
+
* Never throws.
|
|
297
|
+
*
|
|
298
|
+
* @param opts - Whether to probe, plus the injectable `fetch` and deadline.
|
|
299
|
+
* @returns The secret-free profile list.
|
|
300
|
+
*/
|
|
301
|
+
export async function listDecideProfilesReport(opts = {}) {
|
|
302
|
+
const list = listDecideProfiles();
|
|
303
|
+
if (opts.probe !== true)
|
|
304
|
+
return list;
|
|
305
|
+
const profiles = await Promise.all(list.profiles.map(async (summary) => {
|
|
306
|
+
const result = await probeDecideProvider({
|
|
307
|
+
connection: loadDecideProfile(summary.id),
|
|
308
|
+
spend: null,
|
|
309
|
+
...(opts.fetch ? { fetch: opts.fetch } : {}),
|
|
310
|
+
...(opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : {}),
|
|
311
|
+
...(opts.providerStatePath !== undefined
|
|
312
|
+
? { providerStatePath: opts.providerStatePath }
|
|
313
|
+
: {}),
|
|
314
|
+
});
|
|
315
|
+
const probe = {
|
|
316
|
+
state: result.state,
|
|
317
|
+
...(result.httpStatus !== undefined ? { httpStatus: result.httpStatus } : {}),
|
|
318
|
+
...(result.latencyMs !== undefined ? { latencyMs: result.latencyMs } : {}),
|
|
319
|
+
...(result.detail ? { detail: result.detail } : {}),
|
|
320
|
+
};
|
|
321
|
+
return { ...summary, probe };
|
|
322
|
+
}));
|
|
323
|
+
return { ...list, profiles };
|
|
135
324
|
}
|
|
136
325
|
/**
|
|
137
326
|
* Remove the stored settings (and rotated backups of them).
|
|
@@ -176,9 +365,12 @@ function teeAudit(projectRoot) {
|
|
|
176
365
|
* @returns The typed answer with source, fallback reason, latency and cost.
|
|
177
366
|
*/
|
|
178
367
|
export async function askDecideDebug(input) {
|
|
179
|
-
const sealed = loadDecideConnection();
|
|
368
|
+
const sealed = input.profile ? loadDecideProfile(input.profile) : loadDecideConnection();
|
|
369
|
+
const profile = input.profile
|
|
370
|
+
? parseDecideProfileRef(input.profile)?.id
|
|
371
|
+
: (listDecideProfiles().active ?? undefined);
|
|
180
372
|
const audit = teeAudit(input.projectRoot);
|
|
181
|
-
const outcome = await decide(
|
|
373
|
+
const outcome = await decide(DECIDE_ASK_DECISION_SITE.id, { state: input.state, questions: { answer: { type: 'noul', criteria: input.question } } }, () => ({ answer: NEUTRAL_NOUL }), {
|
|
182
374
|
connection: sealed?.connection() ?? null,
|
|
183
375
|
cache: null,
|
|
184
376
|
audit: audit.sink,
|
|
@@ -186,6 +378,9 @@ export async function askDecideDebug(input) {
|
|
|
186
378
|
});
|
|
187
379
|
const reason = audit.last()?.fallbackReason;
|
|
188
380
|
return {
|
|
381
|
+
question: input.question,
|
|
382
|
+
state: input.state,
|
|
383
|
+
...(sealed && profile ? { profile } : {}),
|
|
189
384
|
answer: outcome.answers['answer'] ?? NEUTRAL_NOUL,
|
|
190
385
|
source: outcome.source,
|
|
191
386
|
...(reason ? { fallbackReason: reason } : {}),
|
|
@@ -196,4 +391,19 @@ export async function askDecideDebug(input) {
|
|
|
196
391
|
...(sealed ? { keyPreview: sealed.keyPreview } : {}),
|
|
197
392
|
};
|
|
198
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* `cleo decide budget reset`: start a fresh spend ledger for this month,
|
|
396
|
+
* moving the old file aside as a receipt. The repair for a corrupt ledger,
|
|
397
|
+
* which otherwise keeps every site on its heuristic. A readable ledger is
|
|
398
|
+
* refused unless `opts.force`, and its month-to-date spend is carried over,
|
|
399
|
+
* so a reset never lifts a reached cap.
|
|
400
|
+
*
|
|
401
|
+
* @param statePath - Ledger path. Default: `<cleoHome>/decide/spend.json`.
|
|
402
|
+
* @param opts - `force` resets a ledger that is not corrupt.
|
|
403
|
+
* @returns The receipt: previous health, carried spend and where the old file went.
|
|
404
|
+
* @throws {SpendResetRefusedError} When the ledger is not corrupt and `force` is not set.
|
|
405
|
+
*/
|
|
406
|
+
export async function resetDecideBudget(statePath, opts = {}) {
|
|
407
|
+
return resetSpendLedger(statePath, Date.now(), opts);
|
|
408
|
+
}
|
|
199
409
|
//# sourceMappingURL=operations.js.map
|