@cleocode/core 2026.6.11 → 2026.6.13
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/conduit/local-transport.d.ts +12 -0
- package/dist/conduit/local-transport.d.ts.map +1 -1
- package/dist/conduit/local-transport.js +53 -23
- package/dist/conduit/local-transport.js.map +1 -1
- package/dist/crypto/credentials.d.ts +37 -0
- package/dist/crypto/credentials.d.ts.map +1 -1
- package/dist/crypto/credentials.js +110 -0
- package/dist/crypto/credentials.js.map +1 -1
- package/dist/dispatch/contracts/derive-output-contract.d.ts +86 -0
- package/dist/dispatch/contracts/derive-output-contract.d.ts.map +1 -0
- package/dist/dispatch/contracts/derive-output-contract.js +347 -0
- package/dist/dispatch/contracts/derive-output-contract.js.map +1 -0
- package/dist/dispatch/contracts/ensures-schema.d.ts +77 -0
- package/dist/dispatch/contracts/ensures-schema.d.ts.map +1 -0
- package/dist/dispatch/contracts/ensures-schema.js +91 -0
- package/dist/dispatch/contracts/ensures-schema.js.map +1 -0
- package/dist/dispatch/contracts/output-contracts.d.ts +27 -5
- package/dist/dispatch/contracts/output-contracts.d.ts.map +1 -1
- package/dist/dispatch/contracts/output-contracts.js +29 -6
- package/dist/dispatch/contracts/output-contracts.js.map +1 -1
- package/dist/docs/export-document.js +2309 -1262
- package/dist/docs/export-document.js.map +3 -3
- package/dist/go/driver.d.ts +132 -7
- package/dist/go/driver.d.ts.map +1 -1
- package/dist/go/driver.js +135 -10
- package/dist/go/driver.js.map +1 -1
- package/dist/go/index.d.ts +1 -1
- package/dist/go/index.d.ts.map +1 -1
- package/dist/go/index.js +1 -1
- package/dist/go/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +13 -10
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +11 -11
- package/dist/internal.js.map +1 -1
- package/dist/lifecycle/engine-ops.d.ts.map +1 -1
- package/dist/lifecycle/engine-ops.js +7 -4
- package/dist/lifecycle/engine-ops.js.map +1 -1
- package/dist/lifecycle/ivtr-loop.d.ts +108 -183
- package/dist/lifecycle/ivtr-loop.d.ts.map +1 -1
- package/dist/lifecycle/ivtr-loop.js +207 -522
- package/dist/lifecycle/ivtr-loop.js.map +1 -1
- package/dist/llm/auxiliary-fallback.js +1 -1
- package/dist/llm/auxiliary-fallback.js.map +1 -1
- package/dist/llm/cli-ops.d.ts +14 -1
- package/dist/llm/cli-ops.d.ts.map +1 -1
- package/dist/llm/cli-ops.js +41 -12
- package/dist/llm/cli-ops.js.map +1 -1
- package/dist/llm/concrete-session.d.ts.map +1 -1
- package/dist/llm/concrete-session.js +4 -0
- package/dist/llm/concrete-session.js.map +1 -1
- package/dist/llm/credentials.d.ts +35 -0
- package/dist/llm/credentials.d.ts.map +1 -1
- package/dist/llm/credentials.js +49 -0
- package/dist/llm/credentials.js.map +1 -1
- package/dist/llm/index.d.ts +4 -0
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +4 -0
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/pi/gondolin-loader.d.ts +241 -0
- package/dist/llm/pi/gondolin-loader.d.ts.map +1 -0
- package/dist/llm/pi/gondolin-loader.js +195 -0
- package/dist/llm/pi/gondolin-loader.js.map +1 -0
- package/dist/llm/pi/index.d.ts +28 -0
- package/dist/llm/pi/index.d.ts.map +1 -0
- package/dist/llm/pi/index.js +27 -0
- package/dist/llm/pi/index.js.map +1 -0
- package/dist/llm/pi/pi-agent-adapter.d.ts +135 -0
- package/dist/llm/pi/pi-agent-adapter.d.ts.map +1 -0
- package/dist/llm/pi/pi-agent-adapter.js +329 -0
- package/dist/llm/pi/pi-agent-adapter.js.map +1 -0
- package/dist/llm/pi/pi-errors.d.ts +161 -0
- package/dist/llm/pi/pi-errors.d.ts.map +1 -0
- package/dist/llm/pi/pi-errors.js +296 -0
- package/dist/llm/pi/pi-errors.js.map +1 -0
- package/dist/llm/pi/pi-execution-env.d.ts +286 -0
- package/dist/llm/pi/pi-execution-env.d.ts.map +1 -0
- package/dist/llm/pi/pi-execution-env.js +406 -0
- package/dist/llm/pi/pi-execution-env.js.map +1 -0
- package/dist/llm/pi/pi-gondolin-env.d.ts +227 -0
- package/dist/llm/pi/pi-gondolin-env.d.ts.map +1 -0
- package/dist/llm/pi/pi-gondolin-env.js +541 -0
- package/dist/llm/pi/pi-gondolin-env.js.map +1 -0
- package/dist/llm/pi/pi-session-storage.d.ts +154 -0
- package/dist/llm/pi/pi-session-storage.d.ts.map +1 -0
- package/dist/llm/pi/pi-session-storage.js +314 -0
- package/dist/llm/pi/pi-session-storage.js.map +1 -0
- package/dist/llm/pi/pi-stream-fn.d.ts +124 -0
- package/dist/llm/pi/pi-stream-fn.d.ts.map +1 -0
- package/dist/llm/pi/pi-stream-fn.js +504 -0
- package/dist/llm/pi/pi-stream-fn.js.map +1 -0
- package/dist/llm/pi/pi-tool-bridge.d.ts +99 -0
- package/dist/llm/pi/pi-tool-bridge.d.ts.map +1 -0
- package/dist/llm/pi/pi-tool-bridge.js +117 -0
- package/dist/llm/pi/pi-tool-bridge.js.map +1 -0
- package/dist/llm/pi/pi-types.d.ts +56 -0
- package/dist/llm/pi/pi-types.d.ts.map +1 -0
- package/dist/llm/pi/pi-types.js +16 -0
- package/dist/llm/pi/pi-types.js.map +1 -0
- package/dist/llm/pi/resolve-execution-env.d.ts +194 -0
- package/dist/llm/pi/resolve-execution-env.d.ts.map +1 -0
- package/dist/llm/pi/resolve-execution-env.js +132 -0
- package/dist/llm/pi/resolve-execution-env.js.map +1 -0
- package/dist/llm/plugin-facade.js +2253 -1151
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/llm/role-executor.d.ts.map +1 -1
- package/dist/llm/role-executor.js +8 -5
- package/dist/llm/role-executor.js.map +1 -1
- package/dist/llm/role-resolver.d.ts +46 -14
- package/dist/llm/role-resolver.d.ts.map +1 -1
- package/dist/llm/role-resolver.js +178 -20
- package/dist/llm/role-resolver.js.map +1 -1
- package/dist/llm/sealed-credential.d.ts +125 -0
- package/dist/llm/sealed-credential.d.ts.map +1 -0
- package/dist/llm/sealed-credential.js +133 -0
- package/dist/llm/sealed-credential.js.map +1 -0
- package/dist/llm/session-factory.d.ts.map +1 -1
- package/dist/llm/session-factory.js +6 -2
- package/dist/llm/session-factory.js.map +1 -1
- package/dist/llm/system-key.d.ts +67 -0
- package/dist/llm/system-key.d.ts.map +1 -0
- package/dist/llm/system-key.js +87 -0
- package/dist/llm/system-key.js.map +1 -0
- package/dist/llm/system-of-use-registry.d.ts +119 -0
- package/dist/llm/system-of-use-registry.d.ts.map +1 -0
- package/dist/llm/system-of-use-registry.js +200 -0
- package/dist/llm/system-of-use-registry.js.map +1 -0
- package/dist/llm/system-resolver.d.ts +32 -10
- package/dist/llm/system-resolver.d.ts.map +1 -1
- package/dist/llm/system-resolver.js +70 -18
- package/dist/llm/system-resolver.js.map +1 -1
- package/dist/memory/brain-writer-thread.d.ts.map +1 -1
- package/dist/memory/brain-writer-thread.js +116 -11
- package/dist/memory/brain-writer-thread.js.map +1 -1
- package/dist/memory/claude-mem-migration.d.ts.map +1 -1
- package/dist/memory/claude-mem-migration.js +21 -0
- package/dist/memory/claude-mem-migration.js.map +1 -1
- package/dist/memory/graph-memory-bridge.d.ts.map +1 -1
- package/dist/memory/graph-memory-bridge.js +32 -25
- package/dist/memory/graph-memory-bridge.js.map +1 -1
- package/dist/memory/llm-backend-resolver.js +23 -5
- package/dist/memory/llm-backend-resolver.js.map +1 -1
- package/dist/nexus/migrations/M-split-graph.d.ts.map +1 -1
- package/dist/nexus/migrations/M-split-graph.js +60 -53
- package/dist/nexus/migrations/M-split-graph.js.map +1 -1
- package/dist/orchestrate/pivot.d.ts.map +1 -1
- package/dist/orchestrate/pivot.js +20 -2
- package/dist/orchestrate/pivot.js.map +1 -1
- package/dist/release/engine-ops.js +2 -2
- package/dist/release/engine-ops.js.map +1 -1
- package/dist/release/plan.d.ts +4 -6
- package/dist/release/plan.d.ts.map +1 -1
- package/dist/release/plan.js +10 -23
- package/dist/release/plan.js.map +1 -1
- package/dist/release/reconcile.d.ts +0 -2
- package/dist/release/reconcile.d.ts.map +1 -1
- package/dist/release/reconcile.js +43 -50
- package/dist/release/reconcile.js.map +1 -1
- package/dist/release/release-manifest.d.ts.map +1 -1
- package/dist/release/release-manifest.js +4 -1
- package/dist/release/release-manifest.js.map +1 -1
- package/dist/release/verify-provenance.js +20 -20
- package/dist/release/verify-provenance.js.map +1 -1
- package/dist/routing/capability-matrix.d.ts.map +1 -1
- package/dist/routing/capability-matrix.js +0 -57
- package/dist/routing/capability-matrix.js.map +1 -1
- package/dist/selfimprove/budget.d.ts +206 -0
- package/dist/selfimprove/budget.d.ts.map +1 -0
- package/dist/selfimprove/budget.js +203 -0
- package/dist/selfimprove/budget.js.map +1 -0
- package/dist/selfimprove/dhq-adapter.d.ts +105 -0
- package/dist/selfimprove/dhq-adapter.d.ts.map +1 -0
- package/dist/selfimprove/dhq-adapter.js +95 -0
- package/dist/selfimprove/dhq-adapter.js.map +1 -0
- package/dist/selfimprove/draft-pr.d.ts +129 -0
- package/dist/selfimprove/draft-pr.d.ts.map +1 -0
- package/dist/selfimprove/draft-pr.js +158 -0
- package/dist/selfimprove/draft-pr.js.map +1 -0
- package/dist/selfimprove/envelope-diff.d.ts +162 -0
- package/dist/selfimprove/envelope-diff.d.ts.map +1 -0
- package/dist/selfimprove/envelope-diff.js +321 -0
- package/dist/selfimprove/envelope-diff.js.map +1 -0
- package/dist/selfimprove/replay.d.ts +121 -0
- package/dist/selfimprove/replay.d.ts.map +1 -0
- package/dist/selfimprove/replay.js +109 -0
- package/dist/selfimprove/replay.js.map +1 -0
- package/dist/selfimprove/run-loop.d.ts +148 -0
- package/dist/selfimprove/run-loop.d.ts.map +1 -0
- package/dist/selfimprove/run-loop.js +240 -0
- package/dist/selfimprove/run-loop.js.map +1 -0
- package/dist/selfimprove/scenario.d.ts +145 -0
- package/dist/selfimprove/scenario.d.ts.map +1 -0
- package/dist/selfimprove/scenario.js +243 -0
- package/dist/selfimprove/scenario.js.map +1 -0
- package/dist/sentient/daemon-entry.js +5 -0
- package/dist/sentient/daemon-entry.js.map +1 -1
- package/dist/sentient/daemon.d.ts.map +1 -1
- package/dist/sentient/daemon.js +19 -0
- package/dist/sentient/daemon.js.map +1 -1
- package/dist/sentient/hygiene-scan.d.ts.map +1 -1
- package/dist/sentient/hygiene-scan.js +14 -6
- package/dist/sentient/hygiene-scan.js.map +1 -1
- package/dist/sessions/briefing.d.ts.map +1 -1
- package/dist/sessions/briefing.js +13 -9
- package/dist/sessions/briefing.js.map +1 -1
- package/dist/sessions/connection-session-handle.d.ts +161 -0
- package/dist/sessions/connection-session-handle.d.ts.map +1 -0
- package/dist/sessions/connection-session-handle.js +168 -0
- package/dist/sessions/connection-session-handle.js.map +1 -0
- package/dist/sessions/handoff.d.ts.map +1 -1
- package/dist/sessions/handoff.js +9 -0
- package/dist/sessions/handoff.js.map +1 -1
- package/dist/sessions/index.d.ts +4 -1
- package/dist/sessions/index.d.ts.map +1 -1
- package/dist/sessions/index.js +31 -1
- package/dist/sessions/index.js.map +1 -1
- package/dist/sessions/session-id.d.ts +34 -0
- package/dist/sessions/session-id.d.ts.map +1 -1
- package/dist/sessions/session-id.js +37 -0
- package/dist/sessions/session-id.js.map +1 -1
- package/dist/sessions/session-manifest-mirror.d.ts +115 -0
- package/dist/sessions/session-manifest-mirror.d.ts.map +1 -0
- package/dist/sessions/session-manifest-mirror.js +250 -0
- package/dist/sessions/session-manifest-mirror.js.map +1 -0
- package/dist/sessions/session-switch.d.ts.map +1 -1
- package/dist/sessions/session-switch.js +5 -2
- package/dist/sessions/session-switch.js.map +1 -1
- package/dist/store/converters.d.ts.map +1 -1
- package/dist/store/converters.js +2 -0
- package/dist/store/converters.js.map +1 -1
- package/dist/store/db-helpers.d.ts.map +1 -1
- package/dist/store/db-helpers.js +2 -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 +87 -47
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/pi-session-store.d.ts +151 -0
- package/dist/store/pi-session-store.d.ts.map +1 -0
- package/dist/store/pi-session-store.js +166 -0
- package/dist/store/pi-session-store.js.map +1 -0
- package/dist/store/safety-data-accessor.d.ts +1 -0
- package/dist/store/safety-data-accessor.d.ts.map +1 -1
- package/dist/store/safety-data-accessor.js +5 -0
- package/dist/store/safety-data-accessor.js.map +1 -1
- package/dist/store/schema/cleo-global/accounts.d.ts +357 -0
- package/dist/store/schema/cleo-global/accounts.d.ts.map +1 -0
- package/dist/store/schema/cleo-global/accounts.js +136 -0
- package/dist/store/schema/cleo-global/accounts.js.map +1 -0
- package/dist/store/schema/cleo-global/index.d.ts +2 -0
- package/dist/store/schema/cleo-global/index.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/index.js +2 -0
- package/dist/store/schema/cleo-global/index.js.map +1 -1
- package/dist/store/schema/cleo-global/session-manifest.d.ts +217 -0
- package/dist/store/schema/cleo-global/session-manifest.d.ts.map +1 -0
- package/dist/store/schema/cleo-global/session-manifest.js +99 -0
- package/dist/store/schema/cleo-global/session-manifest.js.map +1 -0
- package/dist/store/schema/cleo-project/tasks-core.d.ts +16 -0
- package/dist/store/schema/cleo-project/tasks-core.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/tasks-core.js +14 -0
- package/dist/store/schema/cleo-project/tasks-core.js.map +1 -1
- package/dist/store/schema/tasks.d.ts +16 -0
- package/dist/store/schema/tasks.d.ts.map +1 -1
- package/dist/store/schema/tasks.js +10 -0
- package/dist/store/schema/tasks.js.map +1 -1
- package/dist/store/selfimprove-dhq-schema.d.ts +284 -0
- package/dist/store/selfimprove-dhq-schema.d.ts.map +1 -0
- package/dist/store/selfimprove-dhq-schema.js +128 -0
- package/dist/store/selfimprove-dhq-schema.js.map +1 -0
- package/dist/store/selfimprove-dhq-store.d.ts +175 -0
- package/dist/store/selfimprove-dhq-store.d.ts.map +1 -0
- package/dist/store/selfimprove-dhq-store.js +182 -0
- package/dist/store/selfimprove-dhq-store.js.map +1 -0
- package/dist/store/session-store.d.ts +52 -13
- package/dist/store/session-store.d.ts.map +1 -1
- package/dist/store/session-store.js +71 -13
- package/dist/store/session-store.js.map +1 -1
- package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
- package/dist/store/sqlite-data-accessor.js +7 -0
- package/dist/store/sqlite-data-accessor.js.map +1 -1
- package/dist/store/tasks-schema.d.ts +4 -0
- package/dist/store/tasks-schema.d.ts.map +1 -1
- package/dist/store/tasks-schema.js +14 -0
- package/dist/store/tasks-schema.js.map +1 -1
- package/dist/store/umbrella-data-accessor.d.ts +1 -0
- package/dist/store/umbrella-data-accessor.d.ts.map +1 -1
- package/dist/store/umbrella-data-accessor.js +5 -0
- package/dist/store/umbrella-data-accessor.js.map +1 -1
- package/dist/store/validation-schemas.d.ts +94 -62
- package/dist/store/validation-schemas.d.ts.map +1 -1
- package/dist/store/writer-lease-schema.d.ts +392 -0
- package/dist/store/writer-lease-schema.d.ts.map +1 -0
- package/dist/store/writer-lease-schema.js +142 -0
- package/dist/store/writer-lease-schema.js.map +1 -0
- package/dist/store/writer-lease.d.ts +368 -0
- package/dist/store/writer-lease.d.ts.map +1 -0
- package/dist/store/writer-lease.js +1002 -0
- package/dist/store/writer-lease.js.map +1 -0
- package/dist/task-tools/describe-schema.d.ts +4 -2
- package/dist/task-tools/describe-schema.d.ts.map +1 -1
- package/dist/task-tools/describe-schema.js +9 -3
- package/dist/task-tools/describe-schema.js.map +1 -1
- package/dist/tasks/backfill-child-projections.d.ts.map +1 -1
- package/dist/tasks/backfill-child-projections.js +14 -9
- package/dist/tasks/backfill-child-projections.js.map +1 -1
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +7 -10
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/duplicate-detector.d.ts.map +1 -1
- package/dist/tasks/duplicate-detector.js +14 -7
- package/dist/tasks/duplicate-detector.js.map +1 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +10 -4
- package/dist/telemetry/index.js.map +1 -1
- package/dist/tools/agent-registry.d.ts +250 -0
- package/dist/tools/agent-registry.d.ts.map +1 -0
- package/dist/tools/agent-registry.js +292 -0
- package/dist/tools/agent-registry.js.map +1 -0
- package/dist/tools/agent-tool-families.d.ts +107 -0
- package/dist/tools/agent-tool-families.d.ts.map +1 -0
- package/dist/tools/agent-tool-families.js +527 -0
- package/dist/tools/agent-tool-families.js.map +1 -0
- package/dist/tools/browser-driver.d.ts +183 -0
- package/dist/tools/browser-driver.d.ts.map +1 -0
- package/dist/tools/browser-driver.js +242 -0
- package/dist/tools/browser-driver.js.map +1 -0
- package/dist/tools/builtin-agent-tools.d.ts +36 -0
- package/dist/tools/builtin-agent-tools.d.ts.map +1 -0
- package/dist/tools/builtin-agent-tools.js +150 -0
- package/dist/tools/builtin-agent-tools.js.map +1 -0
- package/dist/tools/dispatch.d.ts +370 -0
- package/dist/tools/dispatch.d.ts.map +1 -0
- package/dist/tools/dispatch.js +505 -0
- package/dist/tools/dispatch.js.map +1 -0
- package/dist/tools/env-scrub.d.ts +93 -0
- package/dist/tools/env-scrub.d.ts.map +1 -0
- package/dist/tools/env-scrub.js +176 -0
- package/dist/tools/env-scrub.js.map +1 -0
- package/dist/tools/fs.d.ts +30 -0
- package/dist/tools/fs.d.ts.map +1 -1
- package/dist/tools/fs.js +55 -2
- package/dist/tools/fs.js.map +1 -1
- package/dist/tools/guard.d.ts +15 -0
- package/dist/tools/guard.d.ts.map +1 -1
- package/dist/tools/guard.js +49 -12
- package/dist/tools/guard.js.map +1 -1
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +37 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/pty.d.ts +45 -0
- package/dist/tools/pty.d.ts.map +1 -0
- package/dist/tools/pty.js +166 -0
- package/dist/tools/pty.js.map +1 -0
- package/dist/tools/schema-gen.d.ts +57 -0
- package/dist/tools/schema-gen.d.ts.map +1 -0
- package/dist/tools/schema-gen.js +52 -0
- package/dist/tools/schema-gen.js.map +1 -0
- package/dist/tools/shell.d.ts +12 -0
- package/dist/tools/shell.d.ts.map +1 -1
- package/dist/tools/shell.js +14 -1
- package/dist/tools/shell.js.map +1 -1
- package/dist/tools/web-agent-tools.d.ts +72 -0
- package/dist/tools/web-agent-tools.d.ts.map +1 -0
- package/dist/tools/web-agent-tools.js +393 -0
- package/dist/tools/web-agent-tools.js.map +1 -0
- package/dist/tools/web-search-backends.d.ts +156 -0
- package/dist/tools/web-search-backends.d.ts.map +1 -0
- package/dist/tools/web-search-backends.js +290 -0
- package/dist/tools/web-search-backends.js.map +1 -0
- package/dist/validation/ops.d.ts +1 -15
- package/dist/validation/ops.d.ts.map +1 -1
- package/dist/validation/ops.js +0 -20
- package/dist/validation/ops.js.map +1 -1
- package/migrations/drizzle-cleo-global/20260607000000_t11891-writer-leases/migration.sql +55 -0
- package/migrations/drizzle-cleo-global/20260607010000_t11639-session-manifest/migration.sql +43 -0
- package/migrations/drizzle-cleo-global/20260608000000_t11899-pi-session-tree/migration.sql +52 -0
- package/migrations/drizzle-cleo-global/20260608010000_t11709-accounts-credential-pool/migration.sql +72 -0
- package/migrations/drizzle-cleo-global/20260608020000_t11889-selfimprove-dhq/migration.sql +64 -0
- package/migrations/drizzle-cleo-project/20260606000000_t11884-restore-prefixed-task-triggers/migration.sql +272 -0
- package/migrations/drizzle-cleo-project/20260606000000_t11884-restore-prefixed-task-triggers/revert.sql +29 -0
- package/migrations/drizzle-cleo-project/20260606000100_t11883-tasks-releases-version-unique/migration.sql +21 -0
- package/migrations/drizzle-cleo-project/20260606000100_t11883-tasks-releases-version-unique/revert.sql +4 -0
- package/migrations/drizzle-cleo-project/20260607000000_t11891-writer-leases/migration.sql +55 -0
- package/migrations/drizzle-cleo-project/20260607010000_t11639-session-parent/migration.sql +22 -0
- package/migrations/drizzle-cleo-project/20260608000000_t11899-pi-session-tree/migration.sql +52 -0
- package/migrations/drizzle-cleo-project/20260608020000_t11889-selfimprove-dhq/migration.sql +64 -0
- package/package.json +15 -13
- package/dist/lifecycle/chain-composition.d.ts +0 -30
- package/dist/lifecycle/chain-composition.d.ts.map +0 -1
- package/dist/lifecycle/chain-composition.js +0 -152
- package/dist/lifecycle/chain-composition.js.map +0 -1
- package/dist/lifecycle/chain-store.d.ts +0 -70
- package/dist/lifecycle/chain-store.d.ts.map +0 -1
- package/dist/lifecycle/chain-store.js +0 -246
- package/dist/lifecycle/chain-store.js.map +0 -1
- package/dist/lifecycle/default-chain.d.ts +0 -39
- package/dist/lifecycle/default-chain.d.ts.map +0 -1
- package/dist/lifecycle/default-chain.js +0 -176
- package/dist/lifecycle/default-chain.js.map +0 -1
- package/dist/lifecycle/tessera-engine.d.ts +0 -48
- package/dist/lifecycle/tessera-engine.d.ts.map +0 -1
- package/dist/lifecycle/tessera-engine.js +0 -249
- package/dist/lifecycle/tessera-engine.js.map +0 -1
- package/dist/release/provenance-fk.d.ts +0 -74
- package/dist/release/provenance-fk.d.ts.map +0 -1
- package/dist/release/provenance-fk.js +0 -122
- package/dist/release/provenance-fk.js.map +0 -1
- package/dist/validation/chain-validation.d.ts +0 -43
- package/dist/validation/chain-validation.d.ts.map +0 -1
- package/dist/validation/chain-validation.js +0 -146
- package/dist/validation/chain-validation.js.map +0 -1
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* deriveOutputContract — generic per-operation OUTPUT contract producer.
|
|
3
|
+
*
|
|
4
|
+
* Closes the COVERAGE half of DHQ-057 / T11692 (the symptom-fix half — the
|
|
5
|
+
* `--field` remediation loop — is ST-4). The hand-authored {@link OUTPUT_CONTRACTS}
|
|
6
|
+
* registry covers only the 7 highest-traffic `tasks.*` operations. Every other
|
|
7
|
+
* operation in the 411-row {@link OPERATIONS} registry has NO machine-readable
|
|
8
|
+
* description of its result `data` shape, so an agent asking `cleo <op>
|
|
9
|
+
* --describe` (or hitting `E_FIELD_NOT_FOUND` on a bad `--field` pointer) gets
|
|
10
|
+
* nothing back for ~404 ops.
|
|
11
|
+
*
|
|
12
|
+
* Rather than hand-write 404 more contracts (unmaintainable, drifts instantly),
|
|
13
|
+
* this module DERIVES an {@link OperationOutputContract} for an operation from
|
|
14
|
+
* three shape registries that ALREADY exist:
|
|
15
|
+
*
|
|
16
|
+
* | Source registry | Home | Derives |
|
|
17
|
+
* |------------------------|--------------------------|----------------------------------------------------------|
|
|
18
|
+
* | {@link OPERATION_RESULT_SCHEMAS} | `@cleocode/contracts` | precise top-level data keys for the 5 workgraph reads |
|
|
19
|
+
* | {@link PROJECTION_PLANS} | `./mvi-projection.js` | the data PATH (`tasks.show→task`, `docs.list→attachments`) for projected reads |
|
|
20
|
+
* | {@link MUTATE_PROJECTION_PLANS} | `./mutate-projection.js` | the shared `{count, created, updated, deleted}` shape — but ONLY for the 6 ops that actually project it |
|
|
21
|
+
*
|
|
22
|
+
* Resolution precedence inside {@link deriveOutputContract} (most-precise first):
|
|
23
|
+
*
|
|
24
|
+
* 1. workgraph result schema → precise key-derived contract
|
|
25
|
+
* 2. read op with projection plan → path-rooted contract
|
|
26
|
+
* 3. mutate op WITH a {@link MUTATE_PROJECTION_PLANS} entry → shared
|
|
27
|
+
* minimal-mutate contract. An unplanned `gateway==='mutate'` op is NOT
|
|
28
|
+
* rewritten by the dispatch middleware (it returns its raw domain payload),
|
|
29
|
+
* so it must NOT advertise `/data/created/0` — it falls through to (4).
|
|
30
|
+
* 4. any other registered op (unplanned mutate or plain query) → a GENERIC
|
|
31
|
+
* object contract (data is an object; no specific `--field` pointers, but a
|
|
32
|
+
* `shapeNote` telling the agent to `--full`/`--describe`).
|
|
33
|
+
*
|
|
34
|
+
* A `null` return means the operation is NOT in {@link OPERATIONS} at all
|
|
35
|
+
* (genuinely unknown). Per T10400 §6.3 R6.7 a `null` output contract is
|
|
36
|
+
* "unverified shape", NEVER an error — callers MUST treat it as absent, not
|
|
37
|
+
* throw.
|
|
38
|
+
*
|
|
39
|
+
* ## Boundary
|
|
40
|
+
*
|
|
41
|
+
* This producer lives in `core/src/dispatch` (NOT `contracts`) because it reads
|
|
42
|
+
* `PROJECTION_PLANS` / `MUTATE_PROJECTION_PLANS`, which are core-resident, and
|
|
43
|
+
* because it is a bodied runtime helper (the contracts-purity Gate 10 forbids
|
|
44
|
+
* net-new bodied functions in `contracts`). It is import-time side-effect-free:
|
|
45
|
+
* it builds nothing at module load, only on call.
|
|
46
|
+
*
|
|
47
|
+
* @packageDocumentation
|
|
48
|
+
* @module @cleocode/core/dispatch/contracts/derive-output-contract
|
|
49
|
+
*
|
|
50
|
+
* @epic T11679
|
|
51
|
+
* @task T11762 ST-3 — DHQ-057: generic per-op output schema coverage backfill
|
|
52
|
+
*/
|
|
53
|
+
import { OPERATION_RESULT_SCHEMAS, OPERATIONS, } from '@cleocode/contracts';
|
|
54
|
+
import { MUTATE_PROJECTION_PLANS } from '../mutate-projection.js';
|
|
55
|
+
import { PROJECTION_PLANS } from '../mvi-projection.js';
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Operation-def resolution (mirrors describe-operation.ts:resolveOperationDef)
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
/**
|
|
60
|
+
* Resolve the {@link OperationDef} for a canonical `<domain>.<verb>` key.
|
|
61
|
+
*
|
|
62
|
+
* Mirrors `resolveOperationDef` in `describe-operation.ts`: an undotted key is
|
|
63
|
+
* matched by operation name only (and only when unambiguous); a dotted key is
|
|
64
|
+
* split at the FIRST dot into `<domain>.<rest>` so multi-segment operation
|
|
65
|
+
* names like `workgraph.audit` (key `tasks.workgraph.audit`) resolve correctly.
|
|
66
|
+
*
|
|
67
|
+
* @param operation - Canonical `<domain>.<verb>` operation identifier.
|
|
68
|
+
* @returns The matching definition, or `null` when no operation matches.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
function resolveOperationDef(operation) {
|
|
73
|
+
const dotIdx = operation.indexOf('.');
|
|
74
|
+
if (dotIdx === -1) {
|
|
75
|
+
const matches = OPERATIONS.filter((op) => op.operation === operation);
|
|
76
|
+
return matches.length === 1 ? (matches[0] ?? null) : null;
|
|
77
|
+
}
|
|
78
|
+
const domain = operation.slice(0, dotIdx);
|
|
79
|
+
const op = operation.slice(dotIdx + 1);
|
|
80
|
+
return OPERATIONS.find((o) => o.domain === domain && o.operation === op) ?? null;
|
|
81
|
+
}
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// 1. Workgraph result schemas → precise top-level-key contract
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
/**
|
|
86
|
+
* A Zod object schema exposes its top-level field map under `.shape`. The
|
|
87
|
+
* {@link OPERATION_RESULT_SCHEMAS} values are typed loosely (`safeParse` only),
|
|
88
|
+
* so this guard recovers the introspectable shape at runtime without coupling
|
|
89
|
+
* the derive module to a specific Zod typings import.
|
|
90
|
+
*
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
function readZodTopLevelKeys(schema) {
|
|
94
|
+
if (schema === null || typeof schema !== 'object')
|
|
95
|
+
return null;
|
|
96
|
+
const shape = schema.shape;
|
|
97
|
+
if (shape === null || typeof shape !== 'object')
|
|
98
|
+
return null;
|
|
99
|
+
const keys = Object.keys(shape);
|
|
100
|
+
return keys.length > 0 ? keys : null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Derive a contract for a workgraph read whose result shape is contracted in
|
|
104
|
+
* {@link OPERATION_RESULT_SCHEMAS}. The top-level data keys become both the
|
|
105
|
+
* `dataSchema` properties and the `/data/<key>` field pointers.
|
|
106
|
+
*
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
function deriveFromResultSchema(operation) {
|
|
110
|
+
const schema = OPERATION_RESULT_SCHEMAS.get(operation);
|
|
111
|
+
if (schema === undefined)
|
|
112
|
+
return null;
|
|
113
|
+
const keys = readZodTopLevelKeys(schema);
|
|
114
|
+
if (keys === null) {
|
|
115
|
+
// Schema present but not introspectable — fall back to a generic object
|
|
116
|
+
// contract rather than dropping coverage for a known workgraph op.
|
|
117
|
+
return genericObjectContract(operation, 'workgraph result');
|
|
118
|
+
}
|
|
119
|
+
const properties = {};
|
|
120
|
+
for (const key of keys)
|
|
121
|
+
properties[key] = { type: 'object' };
|
|
122
|
+
return {
|
|
123
|
+
operation,
|
|
124
|
+
shapeNote: `Workgraph result — top-level keys: ${keys.join(', ')}. Pointers are rooted at /data/<key>.`,
|
|
125
|
+
dataSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
required: keys,
|
|
128
|
+
additionalProperties: true,
|
|
129
|
+
properties,
|
|
130
|
+
},
|
|
131
|
+
fieldPointers: keys.map((k) => `/data/${k}`),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
// 2. Projection-plan reads → path-rooted contract
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
/**
|
|
138
|
+
* Map a {@link ProjectionKind} to the secondary identity field that pairs with
|
|
139
|
+
* `id` in the derived field pointers.
|
|
140
|
+
*
|
|
141
|
+
* Task-shaped records (`task`/`epic`/`saga`) carry a `title`; doc-shaped records
|
|
142
|
+
* (`doc`) carry NO `title` — their human-readable handle is `slug` (see
|
|
143
|
+
* `AttachmentMetadata` and the doc MVI field-set in `mvi-projection.ts`, which
|
|
144
|
+
* expose `slug`/`description` but never `title`). Hardcoding `/title` for doc
|
|
145
|
+
* plans produced an invalid `--field /data/.../title` pointer that fails with
|
|
146
|
+
* `E_FIELD_NOT_FOUND` — the very class of failure this contract exists to
|
|
147
|
+
* prevent. `'unknown'` falls back to `title` (the generic record convention),
|
|
148
|
+
* matching the {@link GENERIC_MVI_FIELDS} routing keys.
|
|
149
|
+
*
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
function secondaryPointerField(kind) {
|
|
153
|
+
return kind === 'doc' ? 'slug' : 'title';
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Derive a contract for a read op that has a {@link PROJECTION_PLANS} entry.
|
|
157
|
+
* The plan tells us WHERE the records live in `data` (`plan.path`) and whether
|
|
158
|
+
* the payload at that path is a list. We root the field pointers there:
|
|
159
|
+
*
|
|
160
|
+
* - task-kind list plan → `/data/<path>/0/id`, `/data/<path>/0/title`
|
|
161
|
+
* - doc-kind list plan → `/data/<path>/0/id`, `/data/<path>/0/slug`
|
|
162
|
+
* - single plan → `/data/<path>/id`, `/data/<path>/{title|slug}`
|
|
163
|
+
* - `$` path → records are the data root itself.
|
|
164
|
+
*
|
|
165
|
+
* The secondary pointer is chosen per {@link ProjectionKind}
|
|
166
|
+
* ({@link secondaryPointerField}): task-shaped records expose `title`, doc
|
|
167
|
+
* records expose `slug` (they have no `title`).
|
|
168
|
+
*
|
|
169
|
+
* @internal
|
|
170
|
+
*/
|
|
171
|
+
function deriveFromProjectionPlan(operation, plan) {
|
|
172
|
+
const atRoot = plan.path === '$';
|
|
173
|
+
const base = atRoot ? '/data' : `/data/${plan.path}`;
|
|
174
|
+
const recordPointer = plan.list ? `${base}/0` : base;
|
|
175
|
+
const secondaryField = secondaryPointerField(plan.kind);
|
|
176
|
+
const fieldPointers = [`${recordPointer}/id`, `${recordPointer}/${secondaryField}`];
|
|
177
|
+
const recordSchema = {
|
|
178
|
+
type: 'object',
|
|
179
|
+
description: `A ${plan.kind} record.`,
|
|
180
|
+
};
|
|
181
|
+
const pathValueSchema = plan.list
|
|
182
|
+
? { type: 'array', items: recordSchema, description: `Array of ${plan.kind} records.` }
|
|
183
|
+
: recordSchema;
|
|
184
|
+
const dataSchema = atRoot
|
|
185
|
+
? pathValueSchema
|
|
186
|
+
: {
|
|
187
|
+
type: 'object',
|
|
188
|
+
required: [plan.path],
|
|
189
|
+
additionalProperties: true,
|
|
190
|
+
properties: { [plan.path]: pathValueSchema },
|
|
191
|
+
};
|
|
192
|
+
const shapeNote = atRoot
|
|
193
|
+
? `Records (${plan.kind}) are the /data ${plan.list ? 'array' : 'object'} itself.`
|
|
194
|
+
: `Records (${plan.kind}) are under /data/${plan.path}${plan.list ? ' (array)' : ''}. ` +
|
|
195
|
+
`Use ${recordPointer}/<field>.`;
|
|
196
|
+
return { operation, shapeNote, dataSchema, fieldPointers };
|
|
197
|
+
}
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
// 3. Mutate ops → shared MinimalMutateEnvelope contract
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
/**
|
|
202
|
+
* The shared `data` schema for the minimal mutate projection envelope
|
|
203
|
+
* (`MinimalMutateEnvelope` — mutate-projection.ts). `created`/`updated`/
|
|
204
|
+
* `deleted` are arrays of BARE TASK ID STRINGS (not objects), so
|
|
205
|
+
* `/data/created/0` resolves to e.g. `"T11692"` directly.
|
|
206
|
+
*
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
const MINIMAL_MUTATE_DATA_SCHEMA = {
|
|
210
|
+
type: 'object',
|
|
211
|
+
required: ['count', 'created', 'updated', 'deleted'],
|
|
212
|
+
additionalProperties: true,
|
|
213
|
+
properties: {
|
|
214
|
+
count: { type: 'number', description: 'Number of records the mutation affected.' },
|
|
215
|
+
created: {
|
|
216
|
+
type: 'array',
|
|
217
|
+
description: 'Task IDs created (bare strings, e.g. "T11692"). Empty for update/delete-only.',
|
|
218
|
+
items: { type: 'string' },
|
|
219
|
+
},
|
|
220
|
+
updated: {
|
|
221
|
+
type: 'array',
|
|
222
|
+
description: 'Task IDs updated (bare strings). Empty for create/delete-only.',
|
|
223
|
+
items: { type: 'string' },
|
|
224
|
+
},
|
|
225
|
+
deleted: {
|
|
226
|
+
type: 'array',
|
|
227
|
+
description: 'Task IDs deleted (bare strings). Empty for create/update-only.',
|
|
228
|
+
items: { type: 'string' },
|
|
229
|
+
},
|
|
230
|
+
ids: {
|
|
231
|
+
type: 'array',
|
|
232
|
+
description: 'Deprecated alias for the non-empty bucket. Prefer created/updated/deleted.',
|
|
233
|
+
items: { type: 'string' },
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Derive the shared minimal-mutate-envelope contract for a mutate op that
|
|
239
|
+
* actually projects the `{count, created[], updated[], deleted[]}` shape.
|
|
240
|
+
*
|
|
241
|
+
* IMPORTANT: only the 6 ops with a {@link MUTATE_PROJECTION_PLANS} entry
|
|
242
|
+
* (`tasks.add`, `tasks.add-batch`, `tasks.saga.create`, `tasks.update`,
|
|
243
|
+
* `tasks.complete`, `tasks.delete`) are rewritten into the minimal envelope by
|
|
244
|
+
* the dispatch middleware — `applyMutateProjection` / `mutate-minimal-envelope`
|
|
245
|
+
* return the RAW domain payload untouched for every unplanned mutate op. The
|
|
246
|
+
* caller ({@link deriveOutputContract}) therefore gates this on plan presence;
|
|
247
|
+
* the ~169 unplanned mutate ops (`memory.observe`, `session.start`, `docs.add`,
|
|
248
|
+
* `release.plan`, …) fall through to {@link genericObjectContract} so we never
|
|
249
|
+
* advertise `/data/created/0` for a result that does not carry it.
|
|
250
|
+
*
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
253
|
+
function deriveMutateContract(operation) {
|
|
254
|
+
return {
|
|
255
|
+
operation,
|
|
256
|
+
shapeNote: 'Mutate envelope: affected task IDs are bare strings under /data/created, ' +
|
|
257
|
+
'/data/updated, or /data/deleted (e.g. /data/created/0 → "T11692"). /data/count is the total. ' +
|
|
258
|
+
'Pass --full for the verbose post-mutation record.',
|
|
259
|
+
dataSchema: { ...MINIMAL_MUTATE_DATA_SCHEMA },
|
|
260
|
+
fieldPointers: ['/data/count', '/data/created/0', '/data/updated/0', '/data/deleted/0'],
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
// 4. Generic fallback — any other registered query op
|
|
265
|
+
// ---------------------------------------------------------------------------
|
|
266
|
+
/**
|
|
267
|
+
* Derive a GENERIC object contract for a registered query op that has neither a
|
|
268
|
+
* workgraph result schema nor a projection plan. This keeps coverage high (most
|
|
269
|
+
* read ops return an object `data`) while being honest that the precise shape is
|
|
270
|
+
* not contracted: no specific `--field` pointers, just a `shapeNote` pointing
|
|
271
|
+
* the agent at `--describe` / `--full`.
|
|
272
|
+
*
|
|
273
|
+
* @internal
|
|
274
|
+
*/
|
|
275
|
+
function genericObjectContract(operation, kindHint = 'query') {
|
|
276
|
+
return {
|
|
277
|
+
operation,
|
|
278
|
+
shapeNote: `Generic ${kindHint} result — the precise /data shape is not individually contracted. ` +
|
|
279
|
+
'Run with --full to see the verbose record, or --describe for the operation contract.',
|
|
280
|
+
dataSchema: { type: 'object', additionalProperties: true },
|
|
281
|
+
fieldPointers: [],
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
// ---------------------------------------------------------------------------
|
|
285
|
+
// Public producer
|
|
286
|
+
// ---------------------------------------------------------------------------
|
|
287
|
+
/**
|
|
288
|
+
* Derive an {@link OperationOutputContract} for an operation from the existing
|
|
289
|
+
* shape registries, or `null` when the operation is genuinely unknown.
|
|
290
|
+
*
|
|
291
|
+
* Used as the SECOND tier of {@link getOutputContract}'s resolution order
|
|
292
|
+
* (hand-authored {@link OUTPUT_CONTRACTS} → `deriveOutputContract` → `null`).
|
|
293
|
+
* The hand-authored 7 stay authoritative; this lifts coverage to near-100% for
|
|
294
|
+
* the remaining ~404 ops without hand-authoring sprawl.
|
|
295
|
+
*
|
|
296
|
+
* Resolution precedence (most-precise first): workgraph result schema →
|
|
297
|
+
* projection-plan read → planned mutate op → generic registered op (unplanned
|
|
298
|
+
* mutate or plain query) → `null`.
|
|
299
|
+
*
|
|
300
|
+
* A `null` return MUST be treated as "no contract / unverified shape", NOT an
|
|
301
|
+
* error (T10400 §6.3 R6.7).
|
|
302
|
+
*
|
|
303
|
+
* @param operation - Canonical `<domain>.<verb>` operation identifier.
|
|
304
|
+
* @returns A derived contract, or `null` when the operation is not registered.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* deriveOutputContract('tasks.tree'); // precise workgraph keys
|
|
309
|
+
* deriveOutputContract('tasks.show'); // projection-plan path (`task`)
|
|
310
|
+
* deriveOutputContract('tasks.add'); // shared minimal-mutate envelope (planned)
|
|
311
|
+
* deriveOutputContract('memory.observe'); // generic object (UNPLANNED mutate)
|
|
312
|
+
* deriveOutputContract('session.start'); // generic object contract
|
|
313
|
+
* deriveOutputContract('does.not-exist'); // null
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @task T11762 ST-3
|
|
317
|
+
*/
|
|
318
|
+
export function deriveOutputContract(operation) {
|
|
319
|
+
const def = resolveOperationDef(operation);
|
|
320
|
+
if (def === null)
|
|
321
|
+
return null;
|
|
322
|
+
// Re-derive the canonical key from the resolved def so a non-canonical input
|
|
323
|
+
// (e.g. an undotted unambiguous op name) still yields canonical pointers.
|
|
324
|
+
const key = `${def.domain}.${def.operation}`;
|
|
325
|
+
// 1. Precise workgraph result schema.
|
|
326
|
+
const fromSchema = deriveFromResultSchema(key);
|
|
327
|
+
if (fromSchema !== null)
|
|
328
|
+
return fromSchema;
|
|
329
|
+
// 2. Read op with a projection plan.
|
|
330
|
+
const plan = PROJECTION_PLANS[key];
|
|
331
|
+
if (plan !== undefined)
|
|
332
|
+
return deriveFromProjectionPlan(key, plan);
|
|
333
|
+
// 3. Mutate op that ACTUALLY projects the minimal-mutate envelope. Only the
|
|
334
|
+
// ops with a MUTATE_PROJECTION_PLANS entry are rewritten into
|
|
335
|
+
// `{count, created[], updated[], deleted[]}` by the dispatch middleware;
|
|
336
|
+
// every other `gateway==='mutate'` op returns its own domain-specific
|
|
337
|
+
// result shape untouched, so advertising `/data/created/0` for them would
|
|
338
|
+
// steer agents at a pointer that resolves nothing (DHQ-057 loop).
|
|
339
|
+
if (def.gateway === 'mutate' && MUTATE_PROJECTION_PLANS[key] !== undefined) {
|
|
340
|
+
return deriveMutateContract(key);
|
|
341
|
+
}
|
|
342
|
+
// 4. Any other registered op (unplanned mutate or plain query) → generic
|
|
343
|
+
// object contract: honest "shape not individually contracted" rather than
|
|
344
|
+
// a misleading pointer set.
|
|
345
|
+
return genericObjectContract(key);
|
|
346
|
+
}
|
|
347
|
+
//# sourceMappingURL=derive-output-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive-output-contract.js","sourceRoot":"","sources":["../../../src/dispatch/contracts/derive-output-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EACL,wBAAwB,EACxB,UAAU,GAGX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAA4C,MAAM,sBAAsB,CAAC;AAElG,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAE9E;;;;;;;;;;;;GAYG;AACH,SAAS,mBAAmB,CAAC,SAAiB;IAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;QAClB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QACtE,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5D,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1C,MAAM,EAAE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I,CAAC;IAE9B,6EAA6E;IAC7E,0EAA0E;IAC1E,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;IAE7C,sCAAsC;IACtC,MAAM,UAAU,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,UAAU,KAAK,IAAI;QAAE,OAAO,UAAU,CAAC;IAE3C,qCAAqC;IACrC,MAAM,IAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,wBAAwB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEnE,4EAA4E;IAC5E,iEAAiE;IACjE,4EAA4E;IAC5E,yEAAyE;IACzE,6EAA6E;IAC7E,qEAAqE;IACrE,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,uBAAuB,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QAC3E,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,yEAAyE;IACzE,6EAA6E;IAC7E,+BAA+B;IAC/B,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures-schema accessors — the bodied lookup layer over the cantbook
|
|
3
|
+
* `ensures.schema` Zod registry (T11762 ST-1b · Lane A).
|
|
4
|
+
*
|
|
5
|
+
* ## Why this lives in `core` (not `contracts`)
|
|
6
|
+
*
|
|
7
|
+
* The Zod schemas, the {@link EnsuresSchemaSpec} type, and the registry DATA
|
|
8
|
+
* ({@link ENSURES_SCHEMA_REGISTRY}) live in the `@cleocode/contracts` leaf
|
|
9
|
+
* package (ST-1) because those are exactly the Gate-10
|
|
10
|
+
* (`lint-no-runtime-in-contracts`)-ALLOWED kinds. A `Map.get` accessor, by
|
|
11
|
+
* contrast, is a net-new bodied runtime helper — NOT a type guard, Zod schema,
|
|
12
|
+
* or `as const` data — and so MUST NOT live in `contracts` (it would trip the
|
|
13
|
+
* contracts-purity gate). It is housed here in `core`, mirroring the
|
|
14
|
+
* `getOutputContract` / `getInputContract` precedent in this same directory.
|
|
15
|
+
*
|
|
16
|
+
* The playbook runtime (`packages/playbooks/src/runtime.ts`, ST-2) imports these
|
|
17
|
+
* accessors from `@cleocode/core` (already a playbooks dependency) to resolve a
|
|
18
|
+
* declared `ensures.schema` name → its Zod validator, replacing the historical
|
|
19
|
+
* hardcoded `if (schema === 'task_tree') … else if (=== 'evidence')` block.
|
|
20
|
+
*
|
|
21
|
+
* Import-time side-effect-free: this module only constructs a mutable working
|
|
22
|
+
* copy of the immutable contracts registry at module load. No I/O, no global
|
|
23
|
+
* state mutation beyond the module-local `REGISTRY` map.
|
|
24
|
+
*
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
* @module @cleocode/core/dispatch/contracts/ensures-schema
|
|
27
|
+
*
|
|
28
|
+
* @epic T11762 — E-OUTPUT-SCHEMA-ENFORCEMENT
|
|
29
|
+
* @task T11901 — ST-1b: ensures-schema accessors in core
|
|
30
|
+
* @see ENSURES_SCHEMA_REGISTRY — the contracts-resident registry DATA (ST-1)
|
|
31
|
+
*/
|
|
32
|
+
import { type EnsuresSchemaSpec } from '@cleocode/contracts';
|
|
33
|
+
export type { EnsuresSchemaSpec };
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a registered `ensures.schema` spec by its declared name.
|
|
36
|
+
*
|
|
37
|
+
* The playbook runtime calls this with a node's `ensures.schema` value; a
|
|
38
|
+
* `null` result signals an UNKNOWN schema name, which the runtime treats as a
|
|
39
|
+
* fail-closed contract violation (it no longer silently skips unknown names —
|
|
40
|
+
* AC1/AC2).
|
|
41
|
+
*
|
|
42
|
+
* @param name - The `ensures.schema:` name declared in a `.cantbook`
|
|
43
|
+
* (e.g. `'task_tree'`, `'evidence'`).
|
|
44
|
+
* @returns The matching {@link EnsuresSchemaSpec}, or `null` when no schema is
|
|
45
|
+
* registered under that name.
|
|
46
|
+
*
|
|
47
|
+
* @task T11901
|
|
48
|
+
*/
|
|
49
|
+
export declare function getEnsuresSchema(name: string): EnsuresSchemaSpec | null;
|
|
50
|
+
/**
|
|
51
|
+
* Enumerate every registered `ensures.schema` name.
|
|
52
|
+
*
|
|
53
|
+
* Used by the runtime's fail-closed path to list the valid schema set in the
|
|
54
|
+
* violation message (so a `.cantbook` author sees which names are accepted),
|
|
55
|
+
* and by the parity tests to assert the registered set.
|
|
56
|
+
*
|
|
57
|
+
* @returns A read-only array of all registered schema names.
|
|
58
|
+
*
|
|
59
|
+
* @task T11901
|
|
60
|
+
*/
|
|
61
|
+
export declare function listEnsuresSchemaNames(): readonly string[];
|
|
62
|
+
/**
|
|
63
|
+
* Register (or override) an `ensures.schema` spec by name.
|
|
64
|
+
*
|
|
65
|
+
* Genkit-shaped registration alias provided for a future Genkit
|
|
66
|
+
* `ai.defineSchema(name, zodSchema)` bridge (T11768): that bridge re-registers
|
|
67
|
+
* the SAME named Zod schemas as a thin adapter over this SSoT, never as a
|
|
68
|
+
* competing source. Mutates only the module-local working {@link REGISTRY}, not
|
|
69
|
+
* the immutable contracts data.
|
|
70
|
+
*
|
|
71
|
+
* @param spec - The {@link EnsuresSchemaSpec} to register; an existing entry with
|
|
72
|
+
* the same {@link EnsuresSchemaSpec.name | name} is replaced.
|
|
73
|
+
*
|
|
74
|
+
* @task T11901
|
|
75
|
+
*/
|
|
76
|
+
export declare function defineEnsuresSchema(spec: EnsuresSchemaSpec): void;
|
|
77
|
+
//# sourceMappingURL=ensures-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensures-schema.d.ts","sourceRoot":"","sources":["../../../src/dispatch/contracts/ensures-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEtF,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAYlC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAEvE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,SAAS,MAAM,EAAE,CAE1D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAEjE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures-schema accessors — the bodied lookup layer over the cantbook
|
|
3
|
+
* `ensures.schema` Zod registry (T11762 ST-1b · Lane A).
|
|
4
|
+
*
|
|
5
|
+
* ## Why this lives in `core` (not `contracts`)
|
|
6
|
+
*
|
|
7
|
+
* The Zod schemas, the {@link EnsuresSchemaSpec} type, and the registry DATA
|
|
8
|
+
* ({@link ENSURES_SCHEMA_REGISTRY}) live in the `@cleocode/contracts` leaf
|
|
9
|
+
* package (ST-1) because those are exactly the Gate-10
|
|
10
|
+
* (`lint-no-runtime-in-contracts`)-ALLOWED kinds. A `Map.get` accessor, by
|
|
11
|
+
* contrast, is a net-new bodied runtime helper — NOT a type guard, Zod schema,
|
|
12
|
+
* or `as const` data — and so MUST NOT live in `contracts` (it would trip the
|
|
13
|
+
* contracts-purity gate). It is housed here in `core`, mirroring the
|
|
14
|
+
* `getOutputContract` / `getInputContract` precedent in this same directory.
|
|
15
|
+
*
|
|
16
|
+
* The playbook runtime (`packages/playbooks/src/runtime.ts`, ST-2) imports these
|
|
17
|
+
* accessors from `@cleocode/core` (already a playbooks dependency) to resolve a
|
|
18
|
+
* declared `ensures.schema` name → its Zod validator, replacing the historical
|
|
19
|
+
* hardcoded `if (schema === 'task_tree') … else if (=== 'evidence')` block.
|
|
20
|
+
*
|
|
21
|
+
* Import-time side-effect-free: this module only constructs a mutable working
|
|
22
|
+
* copy of the immutable contracts registry at module load. No I/O, no global
|
|
23
|
+
* state mutation beyond the module-local `REGISTRY` map.
|
|
24
|
+
*
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
* @module @cleocode/core/dispatch/contracts/ensures-schema
|
|
27
|
+
*
|
|
28
|
+
* @epic T11762 — E-OUTPUT-SCHEMA-ENFORCEMENT
|
|
29
|
+
* @task T11901 — ST-1b: ensures-schema accessors in core
|
|
30
|
+
* @see ENSURES_SCHEMA_REGISTRY — the contracts-resident registry DATA (ST-1)
|
|
31
|
+
*/
|
|
32
|
+
import { ENSURES_SCHEMA_REGISTRY } from '@cleocode/contracts';
|
|
33
|
+
/**
|
|
34
|
+
* Module-local mutable working copy of the immutable contracts registry.
|
|
35
|
+
*
|
|
36
|
+
* Seeded from {@link ENSURES_SCHEMA_REGISTRY} (a `ReadonlyMap`). A mutable copy
|
|
37
|
+
* is held so {@link defineEnsuresSchema} can register additional specs at
|
|
38
|
+
* runtime (e.g. a future Genkit `ai.defineSchema` bridge — T11768) without
|
|
39
|
+
* mutating the shared frozen contracts data.
|
|
40
|
+
*/
|
|
41
|
+
const REGISTRY = new Map(ENSURES_SCHEMA_REGISTRY);
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a registered `ensures.schema` spec by its declared name.
|
|
44
|
+
*
|
|
45
|
+
* The playbook runtime calls this with a node's `ensures.schema` value; a
|
|
46
|
+
* `null` result signals an UNKNOWN schema name, which the runtime treats as a
|
|
47
|
+
* fail-closed contract violation (it no longer silently skips unknown names —
|
|
48
|
+
* AC1/AC2).
|
|
49
|
+
*
|
|
50
|
+
* @param name - The `ensures.schema:` name declared in a `.cantbook`
|
|
51
|
+
* (e.g. `'task_tree'`, `'evidence'`).
|
|
52
|
+
* @returns The matching {@link EnsuresSchemaSpec}, or `null` when no schema is
|
|
53
|
+
* registered under that name.
|
|
54
|
+
*
|
|
55
|
+
* @task T11901
|
|
56
|
+
*/
|
|
57
|
+
export function getEnsuresSchema(name) {
|
|
58
|
+
return REGISTRY.get(name) ?? null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Enumerate every registered `ensures.schema` name.
|
|
62
|
+
*
|
|
63
|
+
* Used by the runtime's fail-closed path to list the valid schema set in the
|
|
64
|
+
* violation message (so a `.cantbook` author sees which names are accepted),
|
|
65
|
+
* and by the parity tests to assert the registered set.
|
|
66
|
+
*
|
|
67
|
+
* @returns A read-only array of all registered schema names.
|
|
68
|
+
*
|
|
69
|
+
* @task T11901
|
|
70
|
+
*/
|
|
71
|
+
export function listEnsuresSchemaNames() {
|
|
72
|
+
return [...REGISTRY.keys()];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Register (or override) an `ensures.schema` spec by name.
|
|
76
|
+
*
|
|
77
|
+
* Genkit-shaped registration alias provided for a future Genkit
|
|
78
|
+
* `ai.defineSchema(name, zodSchema)` bridge (T11768): that bridge re-registers
|
|
79
|
+
* the SAME named Zod schemas as a thin adapter over this SSoT, never as a
|
|
80
|
+
* competing source. Mutates only the module-local working {@link REGISTRY}, not
|
|
81
|
+
* the immutable contracts data.
|
|
82
|
+
*
|
|
83
|
+
* @param spec - The {@link EnsuresSchemaSpec} to register; an existing entry with
|
|
84
|
+
* the same {@link EnsuresSchemaSpec.name | name} is replaced.
|
|
85
|
+
*
|
|
86
|
+
* @task T11901
|
|
87
|
+
*/
|
|
88
|
+
export function defineEnsuresSchema(spec) {
|
|
89
|
+
REGISTRY.set(spec.name, spec);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=ensures-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensures-schema.js","sourceRoot":"","sources":["../../../src/dispatch/contracts/ensures-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,uBAAuB,EAA0B,MAAM,qBAAqB,CAAC;AAItF;;;;;;;GAOG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,CAA4B,uBAAuB,CAAC,CAAC;AAE7E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AACpC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -8,29 +8,51 @@
|
|
|
8
8
|
* surface consult.
|
|
9
9
|
*
|
|
10
10
|
* Keyed by the canonical `<domain>.<verb>` operation identifier (e.g.
|
|
11
|
-
* `'tasks.show'`). A `null` lookup is expected (
|
|
12
|
-
*
|
|
11
|
+
* `'tasks.show'`). A `null` lookup is expected (a genuinely-unregistered op)
|
|
12
|
+
* and MUST NOT error.
|
|
13
|
+
*
|
|
14
|
+
* ## Resolution order (T11762 ST-3)
|
|
15
|
+
*
|
|
16
|
+
* The accessor resolves a contract in two tiers, most-authoritative first:
|
|
17
|
+
*
|
|
18
|
+
* 1. **Hand-authored** — the 7 high-traffic `tasks.*` entries in
|
|
19
|
+
* {@link OUTPUT_CONTRACTS}. These are precise and stay authoritative.
|
|
20
|
+
* 2. **Derived** — {@link deriveOutputContract} synthesises a contract from
|
|
21
|
+
* existing shape registries (`OPERATION_RESULT_SCHEMAS`, `PROJECTION_PLANS`,
|
|
22
|
+
* `MinimalMutateEnvelope`) so the remaining ~404 operations resolve a
|
|
23
|
+
* contract without hand-authoring sprawl (closes the DHQ-057 coverage gap).
|
|
24
|
+
* 3. **`null`** — the operation is not registered at all.
|
|
13
25
|
*
|
|
14
26
|
* @packageDocumentation
|
|
15
27
|
* @module @cleocode/core/dispatch/contracts/output-contracts
|
|
16
28
|
*
|
|
17
29
|
* @epic T11679
|
|
18
30
|
* @task T11692 — DHQ-057: per-operation output schema SSoT
|
|
31
|
+
* @task T11762 ST-3 — generic per-op output schema coverage backfill
|
|
19
32
|
*/
|
|
20
33
|
import { type OperationOutputContract, OUTPUT_CONTRACTS } from '@cleocode/contracts';
|
|
21
34
|
export { OUTPUT_CONTRACTS };
|
|
22
35
|
/**
|
|
23
36
|
* Resolve the {@link OperationOutputContract} for an operation id, or return
|
|
24
|
-
* `null` when no contract
|
|
37
|
+
* `null` when no contract can be resolved.
|
|
25
38
|
*
|
|
26
39
|
* Used by the SDK `describeOperation` and the `cleo <op> --describe`
|
|
27
40
|
* introspection surface to render the result-shape contract (data schema +
|
|
28
|
-
* valid `--field` pointers). Mirrors {@link getInputContract} exactly
|
|
41
|
+
* valid `--field` pointers). Mirrors {@link getInputContract} exactly, with the
|
|
42
|
+
* addition of the derived tier (T11762 ST-3).
|
|
43
|
+
*
|
|
44
|
+
* Resolution order: hand-authored {@link OUTPUT_CONTRACTS}[op] →
|
|
45
|
+
* {@link deriveOutputContract}(op) → `null`. The hand-authored contracts stay
|
|
46
|
+
* authoritative; the derived tier lifts coverage to near-100% for ops that lack
|
|
47
|
+
* a bespoke entry. A `null` result is "no contract / unverified shape", never an
|
|
48
|
+
* error.
|
|
29
49
|
*
|
|
30
50
|
* @param operation - Canonical `<domain>.<verb>` operation identifier.
|
|
31
|
-
* @returns The matching contract, or `null` when
|
|
51
|
+
* @returns The matching contract (hand-authored or derived), or `null` when the
|
|
52
|
+
* operation is not registered.
|
|
32
53
|
*
|
|
33
54
|
* @task T11692
|
|
55
|
+
* @task T11762 ST-3
|
|
34
56
|
*/
|
|
35
57
|
export declare function getOutputContract(operation: string): OperationOutputContract | null;
|
|
36
58
|
//# sourceMappingURL=output-contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-contracts.d.ts","sourceRoot":"","sources":["../../../src/dispatch/contracts/output-contracts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"output-contracts.d.ts","sourceRoot":"","sources":["../../../src/dispatch/contracts/output-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGrF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,CAEnF"}
|
|
@@ -8,31 +8,54 @@
|
|
|
8
8
|
* surface consult.
|
|
9
9
|
*
|
|
10
10
|
* Keyed by the canonical `<domain>.<verb>` operation identifier (e.g.
|
|
11
|
-
* `'tasks.show'`). A `null` lookup is expected (
|
|
12
|
-
*
|
|
11
|
+
* `'tasks.show'`). A `null` lookup is expected (a genuinely-unregistered op)
|
|
12
|
+
* and MUST NOT error.
|
|
13
|
+
*
|
|
14
|
+
* ## Resolution order (T11762 ST-3)
|
|
15
|
+
*
|
|
16
|
+
* The accessor resolves a contract in two tiers, most-authoritative first:
|
|
17
|
+
*
|
|
18
|
+
* 1. **Hand-authored** — the 7 high-traffic `tasks.*` entries in
|
|
19
|
+
* {@link OUTPUT_CONTRACTS}. These are precise and stay authoritative.
|
|
20
|
+
* 2. **Derived** — {@link deriveOutputContract} synthesises a contract from
|
|
21
|
+
* existing shape registries (`OPERATION_RESULT_SCHEMAS`, `PROJECTION_PLANS`,
|
|
22
|
+
* `MinimalMutateEnvelope`) so the remaining ~404 operations resolve a
|
|
23
|
+
* contract without hand-authoring sprawl (closes the DHQ-057 coverage gap).
|
|
24
|
+
* 3. **`null`** — the operation is not registered at all.
|
|
13
25
|
*
|
|
14
26
|
* @packageDocumentation
|
|
15
27
|
* @module @cleocode/core/dispatch/contracts/output-contracts
|
|
16
28
|
*
|
|
17
29
|
* @epic T11679
|
|
18
30
|
* @task T11692 — DHQ-057: per-operation output schema SSoT
|
|
31
|
+
* @task T11762 ST-3 — generic per-op output schema coverage backfill
|
|
19
32
|
*/
|
|
20
33
|
import { OUTPUT_CONTRACTS } from '@cleocode/contracts';
|
|
34
|
+
import { deriveOutputContract } from './derive-output-contract.js';
|
|
21
35
|
export { OUTPUT_CONTRACTS };
|
|
22
36
|
/**
|
|
23
37
|
* Resolve the {@link OperationOutputContract} for an operation id, or return
|
|
24
|
-
* `null` when no contract
|
|
38
|
+
* `null` when no contract can be resolved.
|
|
25
39
|
*
|
|
26
40
|
* Used by the SDK `describeOperation` and the `cleo <op> --describe`
|
|
27
41
|
* introspection surface to render the result-shape contract (data schema +
|
|
28
|
-
* valid `--field` pointers). Mirrors {@link getInputContract} exactly
|
|
42
|
+
* valid `--field` pointers). Mirrors {@link getInputContract} exactly, with the
|
|
43
|
+
* addition of the derived tier (T11762 ST-3).
|
|
44
|
+
*
|
|
45
|
+
* Resolution order: hand-authored {@link OUTPUT_CONTRACTS}[op] →
|
|
46
|
+
* {@link deriveOutputContract}(op) → `null`. The hand-authored contracts stay
|
|
47
|
+
* authoritative; the derived tier lifts coverage to near-100% for ops that lack
|
|
48
|
+
* a bespoke entry. A `null` result is "no contract / unverified shape", never an
|
|
49
|
+
* error.
|
|
29
50
|
*
|
|
30
51
|
* @param operation - Canonical `<domain>.<verb>` operation identifier.
|
|
31
|
-
* @returns The matching contract, or `null` when
|
|
52
|
+
* @returns The matching contract (hand-authored or derived), or `null` when the
|
|
53
|
+
* operation is not registered.
|
|
32
54
|
*
|
|
33
55
|
* @task T11692
|
|
56
|
+
* @task T11762 ST-3
|
|
34
57
|
*/
|
|
35
58
|
export function getOutputContract(operation) {
|
|
36
|
-
return OUTPUT_CONTRACTS[operation] ?? null;
|
|
59
|
+
return OUTPUT_CONTRACTS[operation] ?? deriveOutputContract(operation) ?? null;
|
|
37
60
|
}
|
|
38
61
|
//# sourceMappingURL=output-contracts.js.map
|