@iowarp/clio-coder 0.3.8 → 0.3.9
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/CHANGELOG.md +49 -0
- package/README.md +7 -3
- package/dist/{acp-U67UHUK2.js → acp-7LOELQFP.js} +6 -6
- package/dist/{agents-YU6SGALZ.js → agents-FIBG2SHA.js} +27 -25
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-5ZPJOIVG.js → auth-OI4LIH2I.js} +11 -12
- package/dist/{builtins-C6JMZVV6.js → builtins-AD25UL3C.js} +5 -5
- package/dist/{chunk-5FR74PWO.js → chunk-2JDWVJND.js} +2 -2
- package/dist/chunk-3DPEIQKN.js +113 -0
- package/dist/{chunk-4SPRNWDE.js → chunk-3DUR4WUA.js} +15 -15
- package/dist/{chunk-VHN4MY6O.js → chunk-3MRC2YSQ.js} +2 -2
- package/dist/{chunk-5DHKRSMQ.js → chunk-3UUY7R3Z.js} +11 -7
- package/dist/{chunk-IGWKHNIQ.js → chunk-3V5AYSEQ.js} +8 -8
- package/dist/{chunk-FHJEP5SW.js → chunk-465CC7FK.js} +8 -5
- package/dist/{chunk-5WIGXA4T.js → chunk-47CMYGET.js} +111 -4
- package/dist/{chunk-A3WNZD3P.js → chunk-4H6ULJ3H.js} +67 -21
- package/dist/{chunk-TB5666IT.js → chunk-4LJX2PUC.js} +3 -3
- package/dist/{chunk-XWSF374K.js → chunk-56KB5IJP.js} +2 -2
- package/dist/{chunk-SPULKLCF.js → chunk-5DQRIYDZ.js} +2 -2
- package/dist/{chunk-2HEJ2F35.js → chunk-5HFBWUMU.js} +20 -8
- package/dist/{chunk-WNIJTQQK.js → chunk-5PVQ4SRS.js} +78 -6
- package/dist/{chunk-DYIM5TJT.js → chunk-5QKCQQ3E.js} +262 -6
- package/dist/{chunk-TYPGUK6W.js → chunk-5T7RBWN2.js} +111 -5
- package/dist/{chunk-IIZWH4XA.js → chunk-774ILSRL.js} +2 -2
- package/dist/chunk-7C6RYZGQ.js +391 -0
- package/dist/{chunk-TANS5ZJS.js → chunk-AD7Y7STJ.js} +3 -3
- package/dist/{chunk-RWSI4YD7.js → chunk-AEYBF3TB.js} +33 -12
- package/dist/{chunk-DGSYXYMX.js → chunk-AMKHQW3C.js} +2 -2
- package/dist/{chunk-VWZOAB7K.js → chunk-B5XRQOLB.js} +7 -7
- package/dist/{chunk-WXY7KU3G.js → chunk-BVDVID7E.js} +2 -2
- package/dist/{chunk-PMDBGQSJ.js → chunk-CA42X6KT.js} +2 -2
- package/dist/{chunk-HLE42MG7.js → chunk-D73KXYPF.js} +3 -3
- package/dist/{chunk-5Q2VVUKB.js → chunk-DG4M6ZUE.js} +3 -3
- package/dist/{chunk-ME6CCNFO.js → chunk-EBOC7MT3.js} +6 -6
- package/dist/{chunk-MXKJU4JB.js → chunk-ECUO3KDP.js} +48 -7
- package/dist/{chunk-26LEYJZH.js → chunk-FALJGAWU.js} +2 -2
- package/dist/{chunk-GWS3VEIW.js → chunk-FWDFM5ZU.js} +24 -3
- package/dist/{chunk-7RGZWPB6.js → chunk-GAYUJ7LE.js} +67 -13
- package/dist/{chunk-VCBR6CU7.js → chunk-HAY4ZE2P.js} +2 -2
- package/dist/{chunk-FBVTI2TJ.js → chunk-HCBCAYZU.js} +11 -130
- package/dist/{chunk-WSB3FPX7.js → chunk-HJB5IUKP.js} +32 -136
- package/dist/{chunk-J3YUBZWY.js → chunk-HKO36JWF.js} +33 -5
- package/dist/{chunk-E77JEWSD.js → chunk-HPCTNZM2.js} +6 -36
- package/dist/{chunk-FJ3H4MN5.js → chunk-IHKBWSXF.js} +2 -2
- package/dist/{chunk-NMPKI6XL.js → chunk-JEQQR47K.js} +37 -18
- package/dist/{chunk-3BINW3FP.js → chunk-KV2AOLDF.js} +24 -4
- package/dist/{chunk-YS5VLNH5.js → chunk-LXPJXFM5.js} +7 -7
- package/dist/{chunk-7RFXX52T.js → chunk-MIX5N5AC.js} +271 -41
- package/dist/{chunk-K4XHGFR5.js → chunk-MLOK6ZOS.js} +1297 -218
- package/dist/{chunk-ZNLWCMVZ.js → chunk-MV2VUEJC.js} +2 -2
- package/dist/{chunk-MVVUPGPW.js → chunk-MXHC5QYU.js} +6 -6
- package/dist/{chunk-5H3GB5BO.js → chunk-N3PBVRTZ.js} +4 -382
- package/dist/{chunk-2HFZQUHL.js → chunk-N5XKWMDW.js} +17 -7
- package/dist/{chunk-5C3AQNDW.js → chunk-NNNWO6F2.js} +124 -36
- package/dist/{chunk-GU2UIAFZ.js → chunk-NQ6UCCOD.js} +3 -3
- package/dist/{chunk-N22QMJKY.js → chunk-NZU6YDNV.js} +4 -4
- package/dist/{chunk-ZVJ5BLO2.js → chunk-O6I4CIEU.js} +151 -13
- package/dist/{chunk-XN3L4EYL.js → chunk-OEDBCISO.js} +2 -2
- package/dist/{chunk-VAWNZU7Z.js → chunk-P3JGPQFL.js} +2 -2
- package/dist/{chunk-IJ7RPIYJ.js → chunk-PNY46YEY.js} +20 -3
- package/dist/{chunk-U6MBIEMB.js → chunk-PZ4I4JE2.js} +56 -35
- package/dist/{chunk-GPIEI3LY.js → chunk-QQ7EKM72.js} +2 -2
- package/dist/{chunk-WLFILSD5.js → chunk-R7LNVMCS.js} +66 -28
- package/dist/{chunk-GOXNB3AO.js → chunk-RAPCMZL4.js} +75 -4
- package/dist/chunk-RKKLTLYB.js +45 -0
- package/dist/{chunk-TT36MB5S.js → chunk-RKRLDWD3.js} +3 -1
- package/dist/{chunk-TTHACPOM.js → chunk-S4COXYBG.js} +456 -18
- package/dist/{chunk-WWCZ5F23.js → chunk-T3Z6VAAF.js} +69 -10
- package/dist/{chunk-GN57SG4G.js → chunk-TD7UE2L5.js} +9 -7
- package/dist/{chunk-TLQJPP24.js → chunk-TEO2TLVN.js} +523 -322
- package/dist/{chunk-FCSXB6T2.js → chunk-UOSL25KY.js} +14 -2
- package/dist/{chunk-KTYTFRMB.js → chunk-VKBMFOYV.js} +17 -15
- package/dist/{chunk-PT7HYKEM.js → chunk-VO2LKSTM.js} +2 -2
- package/dist/{chunk-P43ETTHK.js → chunk-VPTUJU4P.js} +2 -2
- package/dist/{chunk-WEH5XRJQ.js → chunk-WIE7ZOSW.js} +2 -2
- package/dist/{chunk-EMYUUSFG.js → chunk-WXCJ7VME.js} +5 -5
- package/dist/{chunk-4DGYLA73.js → chunk-XDOQXGFO.js} +22 -7
- package/dist/{chunk-JOZYP4GM.js → chunk-YKOFT37S.js} +5 -5
- package/dist/chunk-YSEHGPCT.js +127 -0
- package/dist/{chunk-HFSBBKSQ.js → chunk-YW7UVM5V.js} +138 -3
- package/dist/cli/index.js +27 -27
- package/dist/{clio-QVTYJ57A.js → clio-LT5V7SSZ.js} +6 -6
- package/dist/{code-nav-FGGFIE7L.js → code-nav-LMW275PA.js} +4 -4
- package/dist/{config-LW5IJFQN.js → config-RXS5T3JT.js} +71 -43
- package/dist/{configure-7XIZCOU4.js → configure-2WYWSCSD.js} +14 -15
- package/dist/{context-Y6Y7QPR6.js → context-I3BTOTCS.js} +12 -12
- package/dist/{context-L3WL3X7K.js → context-MVOORGMF.js} +34 -33
- package/dist/{context-N52ZA626.js → context-PALKKQYL.js} +20 -20
- package/dist/{context-clear-MBQRLSDQ.js → context-clear-N2WOYZ2K.js} +34 -33
- package/dist/{context-index-HVMFQHK3.js → context-index-HNG3MOME.js} +2 -2
- package/dist/{context-working-set-GS6DSO7F.js → context-working-set-MIEVECVZ.js} +10 -11
- package/dist/{dispatch-runner-22ZCNOM3.js → dispatch-runner-VVA4SRRH.js} +34 -33
- package/dist/doctor-TWBWFK5V.js +165 -0
- package/dist/{eval-BEC2WHDA.js → eval-IJ5VEZDJ.js} +2016 -142
- package/dist/{evidence-REJUMSKM.js → evidence-L5APPXNV.js} +29 -28
- package/dist/{evolve-PY5ZBA5K.js → evolve-RGNKFJ52.js} +29 -28
- package/dist/{extensions-HVKU65YU.js → extensions-7WYWUX5A.js} +9 -3
- package/dist/{fleet-7WZEWRFA.js → fleet-6CNVBZZP.js} +87 -55
- package/dist/{fleet-commands-UVHWM76J.js → fleet-commands-L2SXSYEI.js} +6 -6
- package/dist/{fleet-graph-6ULH7PES.js → fleet-graph-2J3OOIPO.js} +14 -12
- package/dist/{fleet-preflight-J53T6CCE.js → fleet-preflight-CZRJ4JP5.js} +3 -4
- package/dist/{fleet-validate-72PC4SLA.js → fleet-validate-C5RI6DP7.js} +16 -15
- package/dist/{init-OG3TPGQG.js → init-VBN2ACVA.js} +50 -48
- package/dist/{library-CNTMPLRF.js → library-JHGUMLY2.js} +13 -11
- package/dist/{memory-6IS7F275.js → memory-K4OQIYWG.js} +31 -30
- package/dist/{models-ENRJDA5W.js → models-2NCZUWDD.js} +23 -22
- package/dist/{monitor-XLDVO7TN.js → monitor-MMVTJABD.js} +35 -34
- package/dist/{orchestrator-6KSPYRHA.js → orchestrator-ZKBPCHW6.js} +1627 -294
- package/dist/{reset-RZ4ER727.js → reset-DD5JGOY3.js} +3 -3
- package/dist/{run-Y2CNK5RU.js → run-QEGNX7FL.js} +56 -55
- package/dist/{share-A55GYP6Z.js → share-JKD3BQMW.js} +13 -11
- package/dist/{skills-ALC5J6AT.js → skills-LMQIKDOZ.js} +14 -12
- package/dist/{skills-eval-JPBEBYQU.js → skills-eval-I7X2774U.js} +34 -32
- package/dist/{steer-GGWFUJUD.js → steer-CF5TDANS.js} +3 -3
- package/dist/{support-MIETYA5E.js → support-I7LOJLIF.js} +4 -4
- package/dist/{targets-VGNXIR3S.js → targets-RUSR6B5Z.js} +58 -32
- package/dist/{terminal-lease-WOBR64YA.js → terminal-lease-QYVORFR4.js} +6 -4
- package/dist/{trace-PNCASAXC.js → trace-ODOQIVIW.js} +61 -6
- package/dist/{upgrade-FUSUAGHR.js → upgrade-XANW3FXB.js} +17 -16
- package/dist/{usage-N4MKVHKD.js → usage-4H7ZRXQT.js} +88 -44
- package/dist/{verifiers-YAWOJ3H2.js → verifiers-UZXNBZEB.js} +6 -6
- package/dist/{verify-LTDHYBGY.js → verify-BVKWTNDL.js} +5 -5
- package/dist/{wiki-generate-6M7GHTBJ.js → wiki-generate-MY7WV2QI.js} +49 -47
- package/dist/worker/entry.js +29 -33
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/artifact-versions.md +6 -1
- package/docs/built-in-agents.md +1 -1
- package/docs/capacity-and-scheduling.md +23 -2
- package/docs/commands-and-modes.md +1 -1
- package/docs/configuration-and-targets.md +30 -3
- package/docs/context-engine.md +63 -4
- package/docs/documentation-coverage.md +3 -3
- package/docs/documentation-guide.md +1 -1
- package/docs/environment-variables.md +2 -0
- package/docs/eval-runner.md +262 -11
- package/docs/evals-internal.md +72 -2
- package/docs/evidence-and-memory.md +11 -10
- package/docs/evolution.md +1 -1
- package/docs/extensions-and-sharing.md +3 -1
- package/docs/fleet-dispatch.md +4 -4
- package/docs/installation-and-lifecycle.md +1 -1
- package/docs/middleware-and-components.md +1 -1
- package/docs/model-catalog.md +1 -1
- package/docs/observability.md +53 -2
- package/docs/proactive-memory.md +127 -14
- package/docs/prompt-envelope-and-tools.md +19 -1
- package/docs/provider-adapter-cookbook.md +1 -1
- package/docs/release-cut-checklist.md +19 -3
- package/docs/safety-model.md +1 -1
- package/docs/scientific-validation.md +1 -1
- package/docs/skills-marketplace.md +1 -1
- package/docs/tool-usage.md +1 -1
- package/docs/trace-store.md +1 -1
- package/docs/troubleshooting.md +87 -0
- package/docs/tui-design.md +1 -1
- package/docs/worker-dispatch-mechanics.md +1 -1
- package/package.json +2 -1
- package/src/cli/agents.ts +1 -1
- package/src/cli/config-inspect.ts +33 -6
- package/src/cli/config.ts +1 -1
- package/src/cli/doctor-state-size.ts +82 -0
- package/src/cli/doctor.ts +3 -1
- package/src/cli/eval.ts +80 -16
- package/src/cli/extensions.ts +5 -1
- package/src/cli/fleet.ts +32 -3
- package/src/cli/targets.ts +44 -13
- package/src/cli/trace.ts +63 -4
- package/src/cli/usage.ts +63 -14
- package/src/core/bus-events.ts +29 -1
- package/src/core/cache-telemetry.ts +42 -0
- package/src/core/config.ts +18 -0
- package/src/core/defaults.ts +36 -6
- package/src/core/endpoint-key.ts +27 -0
- package/src/core/residency-target-key.ts +25 -0
- package/src/core/response-schema.ts +36 -2
- package/src/domains/config/classify.ts +3 -0
- package/src/domains/context/codewiki/coordinator.ts +12 -4
- package/src/domains/dispatch/admission.ts +40 -3
- package/src/domains/dispatch/capacity-lease.ts +98 -9
- package/src/domains/dispatch/contract.ts +11 -0
- package/src/domains/dispatch/execution-plan.ts +44 -4
- package/src/domains/dispatch/extension.ts +166 -42
- package/src/domains/dispatch/fleet-run.ts +23 -3
- package/src/domains/dispatch/heartbeat.ts +32 -8
- package/src/domains/dispatch/index.ts +3 -0
- package/src/domains/dispatch/orphan-recovery.ts +5 -0
- package/src/domains/dispatch/reservation-store.ts +116 -8
- package/src/domains/dispatch/state.ts +4 -0
- package/src/domains/dispatch/worker-spawn.ts +25 -11
- package/src/domains/dispatch/write-boundary-enforcer.ts +20 -3
- package/src/domains/dispatch/write-boundary.ts +62 -1
- package/src/domains/eval/artifacts/store.ts +62 -0
- package/src/domains/eval/compare/behavioral.ts +224 -0
- package/src/domains/eval/compare/compare.ts +355 -2
- package/src/domains/eval/compare/envelope.ts +128 -0
- package/src/domains/eval/compare/gates.ts +24 -6
- package/src/domains/eval/compare/thresholds.ts +30 -3
- package/src/domains/eval/execution-provenance.ts +240 -0
- package/src/domains/eval/metrics/aggregate.ts +136 -0
- package/src/domains/eval/metrics/call-ledger-stream.ts +112 -0
- package/src/domains/eval/metrics/tracked.ts +413 -0
- package/src/domains/eval/provenance.ts +117 -0
- package/src/domains/eval/reports/comparison.ts +128 -0
- package/src/domains/eval/reports/junit.ts +17 -3
- package/src/domains/eval/reports/markdown.ts +3 -3
- package/src/domains/eval/reports/text.ts +14 -0
- package/src/domains/eval/run-compare.ts +20 -0
- package/src/domains/eval/runners/clio-run.ts +127 -0
- package/src/domains/eval/runners/external-command.ts +28 -3
- package/src/domains/eval/schema/adapter.ts +111 -0
- package/src/domains/eval/schema/artifact.ts +20 -0
- package/src/domains/eval/schema/behavioral-metrics.ts +204 -0
- package/src/domains/eval/schema/behavioral.ts +520 -0
- package/src/domains/eval/schema/execution-envelope.ts +194 -0
- package/src/domains/eval/schema/serving.ts +74 -0
- package/src/domains/eval/schema/suite.ts +38 -8
- package/src/domains/eval/schema/validate.ts +58 -3
- package/src/domains/eval/schema/verdict.ts +237 -0
- package/src/domains/eval/suites/resolve.ts +2 -0
- package/src/domains/eval/suites/run.ts +264 -33
- package/src/domains/eval/verifiers/command.ts +2 -1
- package/src/domains/eval/workspaces/temp-copy.ts +145 -13
- package/src/domains/evidence/build.ts +2 -13
- package/src/domains/evidence/eval.ts +2 -12
- package/src/domains/evidence/findings-markdown.ts +33 -0
- package/src/domains/evidence/run-trust.ts +7 -113
- package/src/domains/evidence/trust-projection.ts +2 -2
- package/src/domains/extensions/compatibility.ts +285 -0
- package/src/domains/extensions/discovery.ts +38 -3
- package/src/domains/extensions/resources.ts +1 -1
- package/src/domains/extensions/state.ts +12 -3
- package/src/domains/extensions/types.ts +2 -0
- package/src/domains/lifecycle/doctor.ts +69 -1
- package/src/domains/memory/index.ts +14 -0
- package/src/domains/memory/task-bank-promotion.ts +64 -0
- package/src/domains/memory/task-memory-policy.ts +77 -8
- package/src/domains/memory/task-memory-spend.ts +131 -0
- package/src/domains/memory/task-memory-status.ts +7 -0
- package/src/domains/memory/task-memory-telemetry.ts +2 -0
- package/src/domains/middleware/index.ts +1 -0
- package/src/domains/middleware/memory-intervention.ts +69 -5
- package/src/domains/middleware/memory-step-endpoint.ts +71 -0
- package/src/domains/observability/background-memory-usage.ts +140 -0
- package/src/domains/observability/cost.ts +1 -1
- package/src/domains/observability/index.ts +7 -0
- package/src/domains/observability/out-of-turn-usage.ts +51 -2
- package/src/domains/observability/trace-store.ts +192 -2
- package/src/domains/prompts/compiler.ts +100 -13
- package/src/domains/providers/endpoint-capacity.ts +96 -0
- package/src/domains/providers/index.ts +10 -0
- package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +243 -1
- package/src/domains/providers/runtime-resolution.ts +8 -1
- package/src/domains/providers/runtimes/common/probe-helpers.ts +31 -9
- package/src/domains/providers/runtimes/local-native/llamacpp-anthropic.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp-completion.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp-embed.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp-rerank.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp.ts +4 -1
- package/src/domains/providers/runtimes/local-native/lmstudio.ts +4 -1
- package/src/domains/providers/runtimes/local-native/ollama-native.ts +6 -1
- package/src/domains/providers/types/capability-flags.ts +2 -0
- package/src/domains/providers/types/target-descriptor.ts +2 -0
- package/src/domains/resources/prompts/loader.ts +95 -33
- package/src/domains/safety/call-target.ts +52 -0
- package/src/domains/safety/run-effects.ts +35 -4
- package/src/domains/session/context-accounting.ts +52 -1
- package/src/domains/session/context-ledger.ts +37 -13
- package/src/domains/session/index.ts +6 -0
- package/src/domains/session/prompt-cache.ts +140 -0
- package/src/domains/session/prompt-manifest.ts +42 -0
- package/src/engine/acp/adapter.ts +18 -3
- package/src/engine/ai.ts +35 -0
- package/src/engine/apis/llamacpp-residency.ts +55 -3
- package/src/engine/apis/lmstudio.ts +25 -5
- package/src/engine/apis/ollama-native.ts +2 -1
- package/src/engine/apis/openai-completions.ts +80 -17
- package/src/engine/apis/residency-lock.ts +3 -1
- package/src/engine/apis/residency.ts +34 -1
- package/src/engine/provider-payload.ts +29 -1
- package/src/entry/orchestrator.ts +176 -30
- package/src/interactive/chat-loop-messages.ts +26 -7
- package/src/interactive/chat-loop.ts +318 -41
- package/src/interactive/chat-panel.ts +62 -8
- package/src/interactive/clio-editor.ts +45 -8
- package/src/interactive/context-activity.ts +5 -1
- package/src/interactive/context-meter.ts +1 -1
- package/src/interactive/context-overlay.ts +40 -10
- package/src/interactive/cost-overlay.ts +64 -6
- package/src/interactive/dispatch-board.ts +84 -12
- package/src/interactive/fleet-run-preview.ts +41 -15
- package/src/interactive/handoff-round.ts +41 -2
- package/src/interactive/interactive-application.ts +24 -1
- package/src/interactive/interactive-input-runtime.ts +8 -0
- package/src/interactive/interactive-presentation.ts +4 -0
- package/src/interactive/interactive-shell.ts +20 -17
- package/src/interactive/interactive-slash-runtime.ts +27 -4
- package/src/interactive/memory-overlay.ts +8 -0
- package/src/interactive/mutation-preview.ts +295 -0
- package/src/interactive/overlay-general-openers.ts +16 -0
- package/src/interactive/overlay-key-routing.ts +38 -0
- package/src/interactive/overlay-lifecycle.ts +38 -5
- package/src/interactive/overlay-permission-lifecycle.ts +22 -2
- package/src/interactive/overlay-session-lifecycle.ts +73 -9
- package/src/interactive/overlays/ask-user.ts +91 -19
- package/src/interactive/overlays/help-reference.ts +4 -0
- package/src/interactive/overlays/prompts.ts +11 -1
- package/src/interactive/overlays/settings.ts +35 -1
- package/src/interactive/permission-hint.ts +34 -2
- package/src/interactive/permission-overlay.ts +159 -9
- package/src/interactive/prewarm.ts +197 -0
- package/src/interactive/render-trace.ts +162 -15
- package/src/interactive/renderers/tool-execution.ts +4 -0
- package/src/interactive/side-question.ts +58 -1
- package/src/interactive/status/controller.ts +11 -0
- package/src/interactive/status/state-machine.ts +54 -2
- package/src/interactive/status/types.ts +7 -0
- package/src/interactive/terminal-lease.ts +2 -0
- package/src/interactive/turn-context.ts +299 -31
- package/src/interactive/turn-persistence.ts +14 -4
- package/src/interactive/turn-prewarm.ts +364 -0
- package/src/interactive/turn-queues.ts +7 -4
- package/src/interactive/turn-runtime.ts +8 -1
- package/src/interactive/turn-state.ts +23 -0
- package/src/interactive/view/view-overlay.ts +28 -3
- package/src/tools/ask-user.ts +43 -2
- package/src/tools/dispatch-plan.ts +17 -9
- package/src/tools/dispatch-scout.ts +1 -1
- package/src/tools/registry.ts +16 -0
- package/dist/chunk-AOCYTWAV.js +0 -449
- package/dist/chunk-HWUFFB6L.js +0 -83
- package/dist/chunk-R346GLFC.js +0 -31
- package/dist/doctor-M7YEDGAE.js +0 -91
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
detectValidationCommand,
|
|
4
|
+
extractCommandDeleteTargets,
|
|
5
|
+
extractCommandWriteTargets,
|
|
6
|
+
toolMutationPaths
|
|
7
|
+
} from "./chunk-MV3K5QF2.js";
|
|
8
|
+
import {
|
|
9
|
+
isProjectVerifierCheckId,
|
|
10
|
+
isVerificationScriptName
|
|
11
|
+
} from "./chunk-UL3WSD3F.js";
|
|
12
|
+
import {
|
|
13
|
+
ToolNames
|
|
14
|
+
} from "./chunk-CGKSTWHD.js";
|
|
15
|
+
import {
|
|
16
|
+
init_esm_shims
|
|
17
|
+
} from "./chunk-3R73A4XB.js";
|
|
18
|
+
|
|
19
|
+
// src/domains/safety/finish-contract.ts
|
|
20
|
+
init_esm_shims();
|
|
21
|
+
var FINISH_CONTRACT_ADVISORY_MESSAGE = "[Clio Coder] finish-contract advisory: you changed files this turn without recording validation evidence or an explicit limitation. Run a verification command or state what could not be verified.";
|
|
22
|
+
var DEFAULT_RECENT_ENTRY_LIMIT = 80;
|
|
23
|
+
var LIMITATION_PATTERNS = [
|
|
24
|
+
/\b(?:blocked by|blocker|blockers|unable to|not able to|could not|couldn't|cannot|can't)\b/i,
|
|
25
|
+
/\b(?:did not|didn't|have not|haven't|has not|hasn't|was not able|wasn't able)\b/i,
|
|
26
|
+
/\b(?:not complete|incomplete)\b/i,
|
|
27
|
+
/\b(?:not|un)(?:\s|-)?(?:validated|verified|tested)\b/i,
|
|
28
|
+
/^\s*Tests\s*:\s*(?:not run|not executed|not available|failed|blocked|skipped)\b/im,
|
|
29
|
+
/^\s*Known gaps?\s*:\s*(?!\s*(?:none|no\b|n\/a|not applicable)\b).+/im,
|
|
30
|
+
/\bremaining(?:\s+\w+){0,3}\s+(?:work|issue|issues|gap|gaps|blocker|blockers)\b/i
|
|
31
|
+
];
|
|
32
|
+
function assessFinishContract(input) {
|
|
33
|
+
const assistantText = input.assistantText.trim();
|
|
34
|
+
const sessionEntries = input.sessionEntries ?? [];
|
|
35
|
+
const assistantTurnId = input.assistantTurnId ?? null;
|
|
36
|
+
const window = recentEntries(sessionEntries, assistantTurnId, input.recentEntryLimit ?? DEFAULT_RECENT_ENTRY_LIMIT);
|
|
37
|
+
const mutatedPaths = mutatingReceipts(window);
|
|
38
|
+
if (mutatedPaths.length === 0) {
|
|
39
|
+
return { kind: "ok", reason: "no_mutation", evidence: [], mutatedPaths };
|
|
40
|
+
}
|
|
41
|
+
const evidence = collectValidationEvidence(window);
|
|
42
|
+
if (evidence.length > 0) {
|
|
43
|
+
return { kind: "ok", reason: "validation_evidence", evidence, mutatedPaths };
|
|
44
|
+
}
|
|
45
|
+
if (hasExplicitLimitation(assistantText)) {
|
|
46
|
+
return { kind: "ok", reason: "explicit_limitation", evidence: [], mutatedPaths };
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
kind: "engage",
|
|
50
|
+
reason: "unvalidated_mutation",
|
|
51
|
+
message: FINISH_CONTRACT_ADVISORY_MESSAGE,
|
|
52
|
+
evidence: [],
|
|
53
|
+
mutatedPaths
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function hasExplicitLimitation(text) {
|
|
57
|
+
const normalized = text.trim();
|
|
58
|
+
if (normalized.length === 0) return false;
|
|
59
|
+
return LIMITATION_PATTERNS.some((pattern) => pattern.test(normalized));
|
|
60
|
+
}
|
|
61
|
+
function mutatingReceipts(recent) {
|
|
62
|
+
const mutationCalls = /* @__PURE__ */ new Map();
|
|
63
|
+
const paths = [];
|
|
64
|
+
const seen = /* @__PURE__ */ new Set();
|
|
65
|
+
for (const entry of recent) {
|
|
66
|
+
const bashMutation = bashExecutionMutationPaths(entry);
|
|
67
|
+
if (bashMutation !== null) {
|
|
68
|
+
for (const path of bashMutation) pushPath(paths, seen, path);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const call = mutatingToolCall(entry);
|
|
72
|
+
if (call !== null) {
|
|
73
|
+
mutationCalls.set(call.toolCallId, call);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const resultId = successfulToolResultId(entry);
|
|
77
|
+
if (resultId !== null) {
|
|
78
|
+
const candidate = mutationCalls.get(resultId);
|
|
79
|
+
if (candidate !== void 0) {
|
|
80
|
+
for (const path of candidate.paths) pushPath(paths, seen, path);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return paths;
|
|
85
|
+
}
|
|
86
|
+
function mutationPathsForTool(toolName, args) {
|
|
87
|
+
if (toolName === ToolNames.Bash) {
|
|
88
|
+
const command = typeof args?.command === "string" ? args.command : null;
|
|
89
|
+
if (command === null) return [];
|
|
90
|
+
return [...extractCommandWriteTargets(command), ...extractCommandDeleteTargets(command)];
|
|
91
|
+
}
|
|
92
|
+
return toolMutationPaths(toolName, args);
|
|
93
|
+
}
|
|
94
|
+
function mutatingToolCall(entry) {
|
|
95
|
+
const record = asRecord(entry);
|
|
96
|
+
if (record?.kind !== "message" || record.role !== "tool_call") return null;
|
|
97
|
+
const payload = asRecord(record.payload);
|
|
98
|
+
if (payload === null) return null;
|
|
99
|
+
const toolName = stringFromFirst(payload, ["name", "toolName", "tool"]);
|
|
100
|
+
if (toolName === null) return null;
|
|
101
|
+
const args = asRecord(payload.args ?? payload.arguments ?? payload.input) ?? void 0;
|
|
102
|
+
const paths = mutationPathsForTool(toolName, args);
|
|
103
|
+
if (paths.length === 0) return null;
|
|
104
|
+
const toolCallId = stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]) ?? turnIdOf(entry);
|
|
105
|
+
if (toolCallId === null) return null;
|
|
106
|
+
return { toolCallId, paths };
|
|
107
|
+
}
|
|
108
|
+
function bashExecutionMutationPaths(entry) {
|
|
109
|
+
const record = asRecord(entry);
|
|
110
|
+
if (record?.kind !== "bashExecution") return null;
|
|
111
|
+
if (typeof record.command !== "string") return null;
|
|
112
|
+
if (record.cancelled === true || record.exitCode !== 0) return null;
|
|
113
|
+
return [...extractCommandWriteTargets(record.command), ...extractCommandDeleteTargets(record.command)];
|
|
114
|
+
}
|
|
115
|
+
function pushPath(paths, seen, path) {
|
|
116
|
+
if (path.length === 0 || seen.has(path)) return;
|
|
117
|
+
seen.add(path);
|
|
118
|
+
paths.push(path);
|
|
119
|
+
}
|
|
120
|
+
function collectValidationEvidence(recent) {
|
|
121
|
+
const evidence = [];
|
|
122
|
+
const toolCalls = /* @__PURE__ */ new Map();
|
|
123
|
+
const dispatchCalls = /* @__PURE__ */ new Map();
|
|
124
|
+
const seen = /* @__PURE__ */ new Set();
|
|
125
|
+
for (const entry of recent) {
|
|
126
|
+
const protectedArtifact = protectedArtifactEvidence(entry);
|
|
127
|
+
if (protectedArtifact !== null) {
|
|
128
|
+
pushEvidence(evidence, seen, protectedArtifact);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const call = bashValidationCall(entry);
|
|
132
|
+
if (call !== null) {
|
|
133
|
+
toolCalls.set(call.toolCallId, call);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const typedValidationCall = validationToolCall(entry);
|
|
137
|
+
if (typedValidationCall !== null) {
|
|
138
|
+
toolCalls.set(typedValidationCall.toolCallId, typedValidationCall);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const dispatchCall = dispatchEvidenceCall(entry);
|
|
142
|
+
if (dispatchCall !== null) {
|
|
143
|
+
dispatchCalls.set(dispatchCall.toolCallId, dispatchCall);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const resultId = successfulToolResultId(entry);
|
|
147
|
+
if (resultId !== null) {
|
|
148
|
+
const dispatchCandidate = dispatchCalls.get(resultId);
|
|
149
|
+
const dispatchReceipt = dispatchReceiptEvidence(entry, dispatchCandidate);
|
|
150
|
+
if (dispatchReceipt !== null) {
|
|
151
|
+
pushEvidence(evidence, seen, dispatchReceipt);
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const candidate = toolCalls.get(resultId);
|
|
155
|
+
if (candidate !== void 0) {
|
|
156
|
+
pushEvidence(evidence, seen, validationEvidence(candidate));
|
|
157
|
+
}
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const bashExecution = bashExecutionEvidence(entry);
|
|
161
|
+
if (bashExecution !== null) pushEvidence(evidence, seen, bashExecution);
|
|
162
|
+
}
|
|
163
|
+
return evidence;
|
|
164
|
+
}
|
|
165
|
+
function recentEntries(entries, assistantTurnId, recentEntryLimit) {
|
|
166
|
+
const boundedLimit = Number.isFinite(recentEntryLimit) && recentEntryLimit > 0 ? Math.floor(recentEntryLimit) : DEFAULT_RECENT_ENTRY_LIMIT;
|
|
167
|
+
const assistantIndex = assistantTurnId === null ? -1 : entries.findIndex((entry) => turnIdOf(entry) === assistantTurnId);
|
|
168
|
+
const endExclusive = assistantIndex >= 0 ? assistantIndex : entries.length;
|
|
169
|
+
let startInclusive = Math.max(0, endExclusive - boundedLimit);
|
|
170
|
+
for (let index = endExclusive - 1; index >= startInclusive; index -= 1) {
|
|
171
|
+
if (isUserMessageEntry(entries[index])) {
|
|
172
|
+
startInclusive = index + 1;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return entries.slice(startInclusive, endExclusive);
|
|
177
|
+
}
|
|
178
|
+
function bashValidationCall(entry) {
|
|
179
|
+
const record = asRecord(entry);
|
|
180
|
+
if (record?.kind !== "message" || record.role !== "tool_call") return null;
|
|
181
|
+
const payload = asRecord(record.payload);
|
|
182
|
+
if (payload === null) return null;
|
|
183
|
+
const toolName = stringFromFirst(payload, ["name", "toolName", "tool"]);
|
|
184
|
+
if (toolName !== "bash") return null;
|
|
185
|
+
const args = asRecord(payload.args ?? payload.arguments ?? payload.input);
|
|
186
|
+
const command = typeof args?.command === "string" ? args.command : null;
|
|
187
|
+
if (command === null) return null;
|
|
188
|
+
const detected = detectValidationCommand(command);
|
|
189
|
+
if (detected.kind !== "validation") return null;
|
|
190
|
+
const toolCallId = stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]) ?? turnIdOf(entry);
|
|
191
|
+
if (toolCallId === null) return null;
|
|
192
|
+
const candidate = {
|
|
193
|
+
toolCallId,
|
|
194
|
+
command: detected.matched
|
|
195
|
+
};
|
|
196
|
+
const turnId = turnIdOf(entry);
|
|
197
|
+
if (turnId !== null) candidate.turnId = turnId;
|
|
198
|
+
return candidate;
|
|
199
|
+
}
|
|
200
|
+
function dispatchEvidenceCall(entry) {
|
|
201
|
+
const record = asRecord(entry);
|
|
202
|
+
if (record?.kind !== "message" || record.role !== "tool_call") return null;
|
|
203
|
+
const payload = asRecord(record.payload);
|
|
204
|
+
if (payload === null) return null;
|
|
205
|
+
const toolName = stringFromFirst(payload, ["name", "toolName", "tool"]);
|
|
206
|
+
if (toolName !== "dispatch") return null;
|
|
207
|
+
const args = asRecord(payload.args ?? payload.arguments ?? payload.input);
|
|
208
|
+
const { agentId, task } = dispatchCallDescriptor(args);
|
|
209
|
+
const toolCallId = stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]) ?? turnIdOf(entry);
|
|
210
|
+
if (toolCallId === null) return null;
|
|
211
|
+
const candidate = {
|
|
212
|
+
toolCallId,
|
|
213
|
+
command: `agent=${agentId}${task.length > 0 ? ` task=${task}` : ""}`
|
|
214
|
+
};
|
|
215
|
+
const turnId = turnIdOf(entry);
|
|
216
|
+
if (turnId !== null) candidate.turnId = turnId;
|
|
217
|
+
return candidate;
|
|
218
|
+
}
|
|
219
|
+
function dispatchCallDescriptor(args) {
|
|
220
|
+
const defaultAgent = stringFromFirst(args ?? {}, ["agent", "agent_id", "agentId"]);
|
|
221
|
+
const tasks = Array.isArray(args?.tasks) ? args.tasks : null;
|
|
222
|
+
if (tasks !== null && tasks.length > 0) {
|
|
223
|
+
const first = tasks[0];
|
|
224
|
+
if (typeof first === "string") {
|
|
225
|
+
return { agentId: defaultAgent ?? "coder", task: first.trim() };
|
|
226
|
+
}
|
|
227
|
+
const firstRecord = asRecord(first);
|
|
228
|
+
const itemAgent = firstRecord === null ? null : stringFromFirst(firstRecord, ["agent", "agent_id", "agentId"]);
|
|
229
|
+
const itemTask = typeof firstRecord?.task === "string" ? firstRecord.task.trim() : "";
|
|
230
|
+
return { agentId: itemAgent ?? defaultAgent ?? "coder", task: itemTask };
|
|
231
|
+
}
|
|
232
|
+
const singleTask = typeof args?.task === "string" ? args.task.trim() : "";
|
|
233
|
+
return { agentId: defaultAgent ?? "coder", task: singleTask };
|
|
234
|
+
}
|
|
235
|
+
function validationToolCall(entry) {
|
|
236
|
+
const record = asRecord(entry);
|
|
237
|
+
if (record?.kind !== "message" || record.role !== "tool_call") return null;
|
|
238
|
+
const payload = asRecord(record.payload);
|
|
239
|
+
if (payload === null) return null;
|
|
240
|
+
const toolName = stringFromFirst(payload, ["name", "toolName", "tool"]);
|
|
241
|
+
if (toolName === null) return null;
|
|
242
|
+
const summary = typedValidationSummary(toolName, payload);
|
|
243
|
+
if (summary === null) return null;
|
|
244
|
+
const toolCallId = stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]) ?? turnIdOf(entry);
|
|
245
|
+
if (toolCallId === null) return null;
|
|
246
|
+
const candidate = {
|
|
247
|
+
toolCallId,
|
|
248
|
+
command: summary
|
|
249
|
+
};
|
|
250
|
+
const turnId = turnIdOf(entry);
|
|
251
|
+
if (turnId !== null) candidate.turnId = turnId;
|
|
252
|
+
return candidate;
|
|
253
|
+
}
|
|
254
|
+
function typedValidationSummary(toolName, payload) {
|
|
255
|
+
const args = asRecord(payload.args ?? payload.arguments ?? payload.input);
|
|
256
|
+
if (toolName === "verify") {
|
|
257
|
+
const check = typeof args?.check === "string" ? args.check.trim() : "";
|
|
258
|
+
if (check === "frontend") {
|
|
259
|
+
const path = typeof args?.path === "string" && args.path.trim().length > 0 ? args.path.trim() : "artifact";
|
|
260
|
+
return `verify frontend ${path}`;
|
|
261
|
+
}
|
|
262
|
+
if (isVerificationScriptName(check)) return `npm run ${check}`;
|
|
263
|
+
if (isProjectVerifierCheckId(check)) return `verify ${check}`;
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
function successfulToolResultId(entry) {
|
|
269
|
+
const record = asRecord(entry);
|
|
270
|
+
if (record?.kind !== "message" || record.role !== "tool_result") return null;
|
|
271
|
+
const payload = asRecord(record.payload);
|
|
272
|
+
if (payload === null) return null;
|
|
273
|
+
if (payload.isError === true || payload.error === true) return null;
|
|
274
|
+
const result = asRecord(payload.result);
|
|
275
|
+
const details = asRecord(result?.details);
|
|
276
|
+
if (details?.kind === "error") return null;
|
|
277
|
+
return stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]);
|
|
278
|
+
}
|
|
279
|
+
function dispatchReceiptEvidence(entry, candidate) {
|
|
280
|
+
const record = asRecord(entry);
|
|
281
|
+
if (record?.kind !== "message" || record.role !== "tool_result") return null;
|
|
282
|
+
const payload = asRecord(record.payload);
|
|
283
|
+
if (payload === null) return null;
|
|
284
|
+
const toolName = stringFromFirst(payload, ["toolName", "name", "tool"]);
|
|
285
|
+
if (toolName !== null && toolName !== "dispatch") return null;
|
|
286
|
+
const result = asRecord(payload.result);
|
|
287
|
+
const details = asRecord(result?.details);
|
|
288
|
+
if (details === null) return null;
|
|
289
|
+
const summary = passedDispatchReceiptSummary(details, candidate);
|
|
290
|
+
if (summary === null) return null;
|
|
291
|
+
const evidence = {
|
|
292
|
+
kind: "dispatch_receipt",
|
|
293
|
+
summary
|
|
294
|
+
};
|
|
295
|
+
const turnId = candidate?.turnId ?? turnIdOf(entry);
|
|
296
|
+
if (turnId !== null && turnId !== void 0) evidence.turnId = turnId;
|
|
297
|
+
return evidence;
|
|
298
|
+
}
|
|
299
|
+
function passedDispatchReceiptSummary(details, candidate) {
|
|
300
|
+
if (Array.isArray(details.runs)) {
|
|
301
|
+
const runs = details.runs.map(asRecord);
|
|
302
|
+
if (runs.length === 0 || runs.some((run) => run === null || run.exitCode !== 0)) return null;
|
|
303
|
+
if (typeof details.failedCount === "number" && details.failedCount !== 0) return null;
|
|
304
|
+
const first = runs[0];
|
|
305
|
+
const runId = typeof first?.runId === "string" && first.runId.length > 0 ? first.runId : "unknown";
|
|
306
|
+
const agentId = dispatchReceiptAgentId(typeof first?.agentId === "string" ? first.agentId : void 0, candidate);
|
|
307
|
+
const extra = runs.length > 1 ? ` (+${runs.length - 1} more)` : "";
|
|
308
|
+
return `dispatch receipt passed: run ${runId} agent ${agentId}${extra}`;
|
|
309
|
+
}
|
|
310
|
+
if (details.exitCode === 0) {
|
|
311
|
+
const runId = typeof details.runId === "string" && details.runId.length > 0 ? details.runId : "unknown";
|
|
312
|
+
const agentId = dispatchReceiptAgentId(typeof details.agentId === "string" ? details.agentId : void 0, candidate);
|
|
313
|
+
return `dispatch receipt passed: run ${runId} agent ${agentId}`;
|
|
314
|
+
}
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
function dispatchReceiptAgentId(receiptAgentId, candidate) {
|
|
318
|
+
if (receiptAgentId !== void 0 && receiptAgentId.length > 0) return receiptAgentId;
|
|
319
|
+
return candidate?.command.match(/^agent=([^\s]+)/)?.[1] ?? "unknown";
|
|
320
|
+
}
|
|
321
|
+
function bashExecutionEvidence(entry) {
|
|
322
|
+
const record = asRecord(entry);
|
|
323
|
+
if (record?.kind !== "bashExecution") return null;
|
|
324
|
+
if (typeof record.command !== "string") return null;
|
|
325
|
+
if (record.cancelled === true) return null;
|
|
326
|
+
if (record.exitCode !== 0) return null;
|
|
327
|
+
const detected = detectValidationCommand(record.command);
|
|
328
|
+
if (detected.kind !== "validation") return null;
|
|
329
|
+
const evidence = {
|
|
330
|
+
kind: "validation_command",
|
|
331
|
+
summary: `validation command passed: ${detected.matched}`
|
|
332
|
+
};
|
|
333
|
+
const turnId = turnIdOf(entry);
|
|
334
|
+
if (turnId !== null) evidence.turnId = turnId;
|
|
335
|
+
return evidence;
|
|
336
|
+
}
|
|
337
|
+
function protectedArtifactEvidence(entry) {
|
|
338
|
+
const record = asRecord(entry);
|
|
339
|
+
if (record?.kind !== "protectedArtifact" || record.action !== "protect") return null;
|
|
340
|
+
const artifact = asRecord(record.artifact);
|
|
341
|
+
const path = typeof artifact?.path === "string" && artifact.path.trim().length > 0 ? artifact.path.trim() : null;
|
|
342
|
+
if (path === null) return null;
|
|
343
|
+
const evidence = {
|
|
344
|
+
kind: "protected_artifact",
|
|
345
|
+
summary: `protected artifact recorded: ${path}`
|
|
346
|
+
};
|
|
347
|
+
const turnId = turnIdOf(entry);
|
|
348
|
+
if (turnId !== null) evidence.turnId = turnId;
|
|
349
|
+
return evidence;
|
|
350
|
+
}
|
|
351
|
+
function validationEvidence(candidate) {
|
|
352
|
+
const evidence = {
|
|
353
|
+
kind: "validation_command",
|
|
354
|
+
summary: `validation command passed: ${candidate.command}`
|
|
355
|
+
};
|
|
356
|
+
if (candidate.turnId !== void 0) evidence.turnId = candidate.turnId;
|
|
357
|
+
return evidence;
|
|
358
|
+
}
|
|
359
|
+
function pushEvidence(evidence, seen, item) {
|
|
360
|
+
const key = `${item.kind}\0${item.summary}\0${item.turnId ?? ""}`;
|
|
361
|
+
if (seen.has(key)) return;
|
|
362
|
+
seen.add(key);
|
|
363
|
+
evidence.push(item);
|
|
364
|
+
}
|
|
365
|
+
function isUserMessageEntry(entry) {
|
|
366
|
+
const record = asRecord(entry);
|
|
367
|
+
if (record?.kind !== "message" || record.role !== "user") return false;
|
|
368
|
+
const payload = asRecord(record.payload);
|
|
369
|
+
return payload?.synthetic !== true;
|
|
370
|
+
}
|
|
371
|
+
function turnIdOf(entry) {
|
|
372
|
+
const record = asRecord(entry);
|
|
373
|
+
return typeof record?.turnId === "string" ? record.turnId : null;
|
|
374
|
+
}
|
|
375
|
+
function stringFromFirst(record, keys) {
|
|
376
|
+
for (const key of keys) {
|
|
377
|
+
const value = record[key];
|
|
378
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
379
|
+
}
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
function asRecord(value) {
|
|
383
|
+
return value !== null && typeof value === "object" ? value : null;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export {
|
|
387
|
+
DEFAULT_RECENT_ENTRY_LIMIT,
|
|
388
|
+
assessFinishContract,
|
|
389
|
+
typedValidationSummary
|
|
390
|
+
};
|
|
391
|
+
//# sourceMappingURL=chunk-7C6RYZGQ.js.map
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
readRootEntries,
|
|
4
4
|
splitYamlFrontmatter,
|
|
5
5
|
stringField
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AMKHQW3C.js";
|
|
7
7
|
import {
|
|
8
8
|
enabledExtensionResourceRoots
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5QKCQQ3E.js";
|
|
10
10
|
import {
|
|
11
11
|
ToolNames
|
|
12
12
|
} from "./chunk-CGKSTWHD.js";
|
|
@@ -1195,4 +1195,4 @@ export {
|
|
|
1195
1195
|
expandSkillInvocationInput,
|
|
1196
1196
|
parsePendingSkillRequests
|
|
1197
1197
|
};
|
|
1198
|
-
//# sourceMappingURL=chunk-
|
|
1198
|
+
//# sourceMappingURL=chunk-AD7Y7STJ.js.map
|
|
@@ -2,7 +2,7 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
|
|
|
2
2
|
import {
|
|
3
3
|
cwdHash,
|
|
4
4
|
sessionPaths
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KV2AOLDF.js";
|
|
6
6
|
import {
|
|
7
7
|
init_esm_shims
|
|
8
8
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -170,14 +170,6 @@ function buildContextLedger(input) {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
const meter = [...groups];
|
|
173
|
-
if (reserveTokens > 0) {
|
|
174
|
-
meter.push({
|
|
175
|
-
category: "reserve",
|
|
176
|
-
label: CONTEXT_CATEGORY_LABEL.reserve,
|
|
177
|
-
tokens: reserveTokens,
|
|
178
|
-
percent: percentOf(reserveTokens, window)
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
173
|
if (window > 0) {
|
|
182
174
|
meter.push({
|
|
183
175
|
category: "free",
|
|
@@ -186,6 +178,14 @@ function buildContextLedger(input) {
|
|
|
186
178
|
percent: percentOf(freeTokens, window)
|
|
187
179
|
});
|
|
188
180
|
}
|
|
181
|
+
if (reserveTokens > 0) {
|
|
182
|
+
meter.push({
|
|
183
|
+
category: "reserve",
|
|
184
|
+
label: CONTEXT_CATEGORY_LABEL.reserve,
|
|
185
|
+
tokens: reserveTokens,
|
|
186
|
+
percent: percentOf(reserveTokens, window)
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
189
|
return {
|
|
190
190
|
provider: input.provider ?? null,
|
|
191
191
|
model: input.model ?? null,
|
|
@@ -205,7 +205,8 @@ function buildContextLedger(input) {
|
|
|
205
205
|
groups,
|
|
206
206
|
meter,
|
|
207
207
|
lastCompaction: input.lastCompaction ?? null,
|
|
208
|
-
promptCache: input.promptCache ?? null
|
|
208
|
+
promptCache: input.promptCache ?? null,
|
|
209
|
+
prewarm: input.prewarm ?? null
|
|
209
210
|
};
|
|
210
211
|
}
|
|
211
212
|
|
|
@@ -405,6 +406,17 @@ function getLatestContextSnapshot(meta) {
|
|
|
405
406
|
const list = getContextSnapshots(meta);
|
|
406
407
|
return list.at(-1) ?? null;
|
|
407
408
|
}
|
|
409
|
+
function lastLoadedContextWindow(meta, providerId, modelId) {
|
|
410
|
+
const snapshots = getContextSnapshots(meta);
|
|
411
|
+
for (let i = snapshots.length - 1; i >= 0; i -= 1) {
|
|
412
|
+
const snapshot = snapshots[i];
|
|
413
|
+
if (snapshot?.contextWindowSource !== "loaded") continue;
|
|
414
|
+
if (snapshot.providerId !== providerId || snapshot.modelId !== modelId) continue;
|
|
415
|
+
const window = snapshot.effectiveContextWindow;
|
|
416
|
+
if (typeof window === "number" && Number.isFinite(window) && window > 0) return window;
|
|
417
|
+
}
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
408
420
|
function buildSnapshotCategories(inputs) {
|
|
409
421
|
const raw = {
|
|
410
422
|
system: 0,
|
|
@@ -477,6 +489,7 @@ function captureContextSnapshot(input) {
|
|
|
477
489
|
compactionThreshold: input.compactionThreshold
|
|
478
490
|
});
|
|
479
491
|
return {
|
|
492
|
+
estimatedTokens: sumSplitTokens(categories),
|
|
480
493
|
snapshotId: nextSnapshotId(),
|
|
481
494
|
sessionId: input.sessionId,
|
|
482
495
|
turnId: input.turnId,
|
|
@@ -499,8 +512,11 @@ function captureContextSnapshot(input) {
|
|
|
499
512
|
messageRange: input.conversationMessages.length > 0 ? { start: 0, end: input.conversationMessages.length - 1 } : void 0
|
|
500
513
|
};
|
|
501
514
|
}
|
|
515
|
+
function sumSplitTokens(categories) {
|
|
516
|
+
return SNAPSHOT_SPLIT_KEYS.reduce((sum, key) => sum + (categories[key] ?? 0), 0);
|
|
517
|
+
}
|
|
502
518
|
function snapshotInputTokens(snapshot) {
|
|
503
|
-
return
|
|
519
|
+
return sumSplitTokens(snapshot.categories);
|
|
504
520
|
}
|
|
505
521
|
function reconcileSnapshot(snapshot, usage) {
|
|
506
522
|
const exactInput = (usage.input || 0) + (usage.cacheRead || 0) + (usage.cacheWrite || 0);
|
|
@@ -580,9 +596,13 @@ function reconcileSnapshot(snapshot, usage) {
|
|
|
580
596
|
},
|
|
581
597
|
{}
|
|
582
598
|
);
|
|
599
|
+
const estimatedTokens = snapshot.estimatedTokens ?? sumSplitTokens(snapshot.categories);
|
|
583
600
|
return {
|
|
584
601
|
...snapshot,
|
|
585
602
|
categories: updatedCategories,
|
|
603
|
+
estimatedTokens,
|
|
604
|
+
reconciledTokens: exactInput,
|
|
605
|
+
divergenceRatio: estimatedTokens > 0 ? Math.round(exactInput / estimatedTokens * 1e3) / 1e3 : void 0,
|
|
586
606
|
sources: {
|
|
587
607
|
total: "reconciled",
|
|
588
608
|
splits: splitsSources
|
|
@@ -606,8 +626,9 @@ export {
|
|
|
606
626
|
contextUsageSnapshot,
|
|
607
627
|
appendContextSnapshot,
|
|
608
628
|
getLatestContextSnapshot,
|
|
629
|
+
lastLoadedContextWindow,
|
|
609
630
|
captureContextSnapshot,
|
|
610
631
|
snapshotInputTokens,
|
|
611
632
|
reconcileSnapshot
|
|
612
633
|
};
|
|
613
|
-
//# sourceMappingURL=chunk-
|
|
634
|
+
//# sourceMappingURL=chunk-AEYBF3TB.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
enabledExtensionResourceRoots
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5QKCQQ3E.js";
|
|
5
5
|
import {
|
|
6
6
|
require_dist
|
|
7
7
|
} from "./chunk-APJ265NV.js";
|
|
@@ -120,4 +120,4 @@ export {
|
|
|
120
120
|
splitYamlFrontmatter,
|
|
121
121
|
stringField
|
|
122
122
|
};
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
123
|
+
//# sourceMappingURL=chunk-AMKHQW3C.js.map
|
|
@@ -2,16 +2,16 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
|
|
|
2
2
|
import {
|
|
3
3
|
readLayeredSettings,
|
|
4
4
|
readStrictLayeredSettings
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FALJGAWU.js";
|
|
6
6
|
import {
|
|
7
7
|
formatBootTrace
|
|
8
8
|
} from "./chunk-HKIYEGME.js";
|
|
9
9
|
import {
|
|
10
10
|
initializeClioHome
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-56KB5IJP.js";
|
|
12
12
|
import {
|
|
13
13
|
readSettings
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PNY46YEY.js";
|
|
15
15
|
import {
|
|
16
16
|
require_dist
|
|
17
17
|
} from "./chunk-APJ265NV.js";
|
|
@@ -158,7 +158,7 @@ Run \`clio-coder auth login ${verdict.store}\` if the endpoint requires one; loc
|
|
|
158
158
|
} else if (verdict.kind !== "usable") {
|
|
159
159
|
process.stdout.write(`${describeVerdict(verdict)} Starting \`clio-coder configure\`.
|
|
160
160
|
`);
|
|
161
|
-
const { runConfigureCommand } = await import("./configure-
|
|
161
|
+
const { runConfigureCommand } = await import("./configure-2WYWSCSD.js");
|
|
162
162
|
const configured = await runConfigureCommand([]);
|
|
163
163
|
if (configured !== 0) return configured;
|
|
164
164
|
startupSettings = readStrictLayeredSettings(process.cwd()).settings;
|
|
@@ -167,7 +167,7 @@ Run \`clio-coder auth login ${verdict.store}\` if the endpoint requires one; loc
|
|
|
167
167
|
let terminalLease;
|
|
168
168
|
try {
|
|
169
169
|
if (terminalLeaseEligible(options)) {
|
|
170
|
-
const { createProcessTerminalLease, instantShellEnabled } = await import("./terminal-lease-
|
|
170
|
+
const { createProcessTerminalLease, instantShellEnabled } = await import("./terminal-lease-QYVORFR4.js");
|
|
171
171
|
if (instantShellEnabled()) {
|
|
172
172
|
let stage0FrameId = null;
|
|
173
173
|
terminalLease = createProcessTerminalLease({
|
|
@@ -190,7 +190,7 @@ Run \`clio-coder auth login ${verdict.store}\` if the endpoint requires one; loc
|
|
|
190
190
|
throw new Error("injected Stage 1 hydration failure");
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
const { bootOrchestrator } = await import("./orchestrator-
|
|
193
|
+
const { bootOrchestrator } = await import("./orchestrator-ZKBPCHW6.js");
|
|
194
194
|
const result = await bootOrchestrator({
|
|
195
195
|
...options,
|
|
196
196
|
...startupSettings ? { startupSettings } : {},
|
|
@@ -214,4 +214,4 @@ export {
|
|
|
214
214
|
terminalLeaseEligible,
|
|
215
215
|
runClioCommand
|
|
216
216
|
};
|
|
217
|
-
//# sourceMappingURL=chunk-
|
|
217
|
+
//# sourceMappingURL=chunk-B5XRQOLB.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-ZGVHUX3M.js";
|
|
5
5
|
import {
|
|
6
6
|
BusChannels
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RKRLDWD3.js";
|
|
8
8
|
import {
|
|
9
9
|
init_esm_shims
|
|
10
10
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -226,4 +226,4 @@ export {
|
|
|
226
226
|
runWithBudget,
|
|
227
227
|
getTerminationCoordinator
|
|
228
228
|
};
|
|
229
|
-
//# sourceMappingURL=chunk-
|
|
229
|
+
//# sourceMappingURL=chunk-BVDVID7E.js.map
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./chunk-B5CSFE7B.js";
|
|
20
20
|
import {
|
|
21
21
|
StringEnum
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-UOSL25KY.js";
|
|
23
23
|
import {
|
|
24
24
|
init_esm_shims
|
|
25
25
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -177,4 +177,4 @@ export {
|
|
|
177
177
|
prepareVerifyArguments,
|
|
178
178
|
verifyToolSurface
|
|
179
179
|
};
|
|
180
|
-
//# sourceMappingURL=chunk-
|
|
180
|
+
//# sourceMappingURL=chunk-CA42X6KT.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
durableAssistantTextFromEvent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TEO2TLVN.js";
|
|
5
5
|
import {
|
|
6
6
|
responseModelIdObservationFromRecord
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LXPJXFM5.js";
|
|
8
8
|
import {
|
|
9
9
|
init_esm_shims
|
|
10
10
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -34,4 +34,4 @@ export {
|
|
|
34
34
|
assistantTextFromEvent,
|
|
35
35
|
receiptResponseModelIdObservationLabel
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-D73KXYPF.js.map
|
|
@@ -2,7 +2,7 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
|
|
|
2
2
|
import {
|
|
3
3
|
readStateInfo,
|
|
4
4
|
runDoctor
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-T3Z6VAAF.js";
|
|
6
6
|
import {
|
|
7
7
|
getVersionInfo
|
|
8
8
|
} from "./chunk-XPLRXC72.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
readSettings,
|
|
11
11
|
settingsPath,
|
|
12
12
|
updateSettings
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PNY46YEY.js";
|
|
14
14
|
import {
|
|
15
15
|
authStoragePath,
|
|
16
16
|
openAuthStorage
|
|
@@ -158,4 +158,4 @@ export {
|
|
|
158
158
|
describeUpgradeNotice,
|
|
159
159
|
LifecycleDomainModule
|
|
160
160
|
};
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
161
|
+
//# sourceMappingURL=chunk-DG4M6ZUE.js.map
|