@iowarp/clio-coder 0.3.1 → 0.3.3
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 +233 -373
- package/CONTRIBUTING.md +23 -23
- package/README.md +284 -613
- package/dist/{acp-FPR54DGL.js → acp-P2AQILE2.js} +43 -53
- package/dist/{agents-OGPIHPJH.js → agents-72W3BI7I.js} +43 -26
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-IC3K6NIZ.js → auth-5TWEIYDN.js} +20 -12
- package/dist/chunk-2DJ2KNFG.js +2095 -0
- package/dist/{chunk-IS3ONKU3.js → chunk-2IR2NMPA.js} +6 -4
- package/dist/chunk-2SFS6XQE.js +122 -0
- package/dist/{chunk-PV4JUBVJ.js → chunk-2TLUCQVG.js} +40 -21
- package/dist/chunk-2VTFPG5O.js +48 -0
- package/dist/chunk-4BJ5BYCE.js +61 -0
- package/dist/{chunk-474KN5II.js → chunk-4BPJXDWC.js} +111 -181
- package/dist/chunk-4VP4KH3K.js +962 -0
- package/dist/chunk-4XUGQOHA.js +797 -0
- package/dist/chunk-4ZG3XFUR.js +77 -0
- package/dist/chunk-5B2AEOW5.js +5407 -0
- package/dist/{chunk-K2ITRMHZ.js → chunk-5TSRNF4G.js} +6 -138
- package/dist/{chunk-4QKXUHSR.js → chunk-5UFT4SUX.js} +70 -20
- package/dist/{chunk-OLBBMFRD.js → chunk-5UUP6MWO.js} +24 -62
- package/dist/chunk-65DEGPJ6.js +52 -0
- package/dist/chunk-6EJMN2Y3.js +17 -0
- package/dist/chunk-6N5PTWMY.js +136 -0
- package/dist/chunk-6SGHMWE3.js +277 -0
- package/dist/chunk-6XLNIQDB.js +27 -0
- package/dist/chunk-7CR24IG7.js +242 -0
- package/dist/chunk-7MNJORFF.js +22 -0
- package/dist/{chunk-KY56HMHH.js → chunk-A3CYT5EX.js} +125 -31
- package/dist/chunk-AGYYIBLL.js +1069 -0
- package/dist/{chunk-GB6QRBXN.js → chunk-APJ265NV.js} +54 -1187
- package/dist/{chunk-673JJUWJ.js → chunk-BMEMKKIT.js} +2 -2
- package/dist/chunk-CBCAPZAA.js +229 -0
- package/dist/chunk-CMZWFGD2.js +352 -0
- package/dist/chunk-COU2UHX6.js +400 -0
- package/dist/chunk-DSELYM6W.js +1077 -0
- package/dist/chunk-DUYJ5IO6.js +644 -0
- package/dist/chunk-ECH6PKUQ.js +39 -0
- package/dist/chunk-ED4KHGC3.js +143 -0
- package/dist/chunk-EKMEHE4H.js +340 -0
- package/dist/chunk-FCSXB6T2.js +338 -0
- package/dist/chunk-FJ3H4MN5.js +48 -0
- package/dist/{chunk-RPTR2H26.js → chunk-FNTMWMX5.js} +21 -15
- package/dist/chunk-FQ4SKYE4.js +29 -0
- package/dist/chunk-G4BMMOKF.js +182 -0
- package/dist/{chunk-ZPY3JZ5E.js → chunk-GGXXDWE4.js} +183 -1233
- package/dist/chunk-HC4CLZ2Y.js +68 -0
- package/dist/{chunk-LU4TK2PR.js → chunk-HFSBBKSQ.js} +5 -56
- package/dist/{chunk-PIUMUEMV.js → chunk-HKIYEGME.js} +10 -6
- package/dist/chunk-I4HZDVNP.js +73 -0
- package/dist/chunk-IKCO5N3L.js +162 -0
- package/dist/chunk-IR4CFBFN.js +56 -0
- package/dist/{chunk-R5KLMSBV.js → chunk-J5Q24KAG.js} +2 -2
- package/dist/chunk-J7CWMCQD.js +255 -0
- package/dist/{chunk-K5XEMXTI.js → chunk-JVCV3ICN.js} +1 -1
- package/dist/chunk-KZWTDYJF.js +217 -0
- package/dist/chunk-LBMZMYH2.js +285 -0
- package/dist/{chunk-G34LV2PF.js → chunk-LM5TQCJZ.js} +84 -170
- package/dist/chunk-LW6DSM3M.js +5135 -0
- package/dist/chunk-LWLEKMDQ.js +3482 -0
- package/dist/{chunk-H6F6BYOH.js → chunk-LZSJBIVT.js} +7003 -7434
- package/dist/{chunk-HQQID6OA.js → chunk-M6SHUN7Q.js} +5 -5
- package/dist/{chunk-FST4FYJB.js → chunk-MFFY33HR.js} +99 -140
- package/dist/{chunk-BSU2YIWB.js → chunk-MVVUPGPW.js} +131 -136
- package/dist/chunk-OAO4GE4M.js +619 -0
- package/dist/{chunk-Q3RUPKEJ.js → chunk-OC7FIQPC.js} +58 -189
- package/dist/chunk-OKGUZO2U.js +34 -0
- package/dist/{chunk-GAEBEQVI.js → chunk-OOJYHWRB.js} +32 -346
- package/dist/{chunk-Q5WJOSJ7.js → chunk-OQ33BKR3.js} +2 -1
- package/dist/chunk-OQE5J4C6.js +73 -0
- package/dist/{chunk-KKNLWXI6.js → chunk-ORBHGJC5.js} +8 -8
- package/dist/{chunk-MAR7Y6HW.js → chunk-PAJK6MAQ.js} +23 -16
- package/dist/{chunk-M5T5VO65.js → chunk-PIWWS5BL.js} +837 -635
- package/dist/chunk-POHLU5DW.js +1186 -0
- package/dist/chunk-QKMUKYO7.js +4961 -0
- package/dist/chunk-SRDMMSEP.js +16405 -0
- package/dist/chunk-SST6Z5JA.js +80 -0
- package/dist/chunk-STBPMHSX.js +2456 -0
- package/dist/chunk-T6YILFSB.js +80 -0
- package/dist/chunk-TZK7PACC.js +174 -0
- package/dist/chunk-TZTZS7QK.js +227 -0
- package/dist/{chunk-ASND7OZK.js → chunk-UFIIWP2H.js} +13 -13
- package/dist/chunk-UOV2BYIW.js +107 -0
- package/dist/{chunk-PFEFKVGL.js → chunk-V6RTAOC2.js} +13 -11
- package/dist/chunk-VAKQQHWR.js +434 -0
- package/dist/chunk-VG7TBQIY.js +128 -0
- package/dist/chunk-VJWL6YS5.js +244 -0
- package/dist/{chunk-EYOKLTMF.js → chunk-VPAYEGVX.js} +17 -3
- package/dist/chunk-WEH5XRJQ.js +32 -0
- package/dist/chunk-X4RCMKVQ.js +641 -0
- package/dist/{chunk-TEKV33Q5.js → chunk-X6IAEBZR.js} +65 -33
- package/dist/chunk-XBXAASKX.js +18 -0
- package/dist/chunk-XN3L4EYL.js +46 -0
- package/dist/{chunk-RDLVBZEO.js → chunk-YCWGATWI.js} +6 -4
- package/dist/chunk-YHZX5GEU.js +193 -0
- package/dist/chunk-YXLYO42X.js +91 -0
- package/dist/{chunk-NMOX6HFD.js → chunk-ZDOOVTXZ.js} +29 -77
- package/dist/chunk-ZI647VB5.js +37 -0
- package/dist/{chunk-C4PTHK7P.js → chunk-ZWLZP4ZT.js} +5 -5
- package/dist/chunk-ZWMF7253.js +1882 -0
- package/dist/cli/index.js +62 -54
- package/dist/clio-JOU4FXVA.js +25 -0
- package/dist/code-nav-7AX6FYE6.js +600 -0
- package/dist/codewiki/build-worker.js +66 -0
- package/dist/compile-cache-CVJMMODC.js +18 -0
- package/dist/{components-DMAOEKFB.js → components-KELWS457.js} +11 -6
- package/dist/{config-IRUQ7SE4.js → config-XCDVKR23.js} +92 -55
- package/dist/configure-4GAP54ZW.js +42 -0
- package/dist/{context-5RADCKTR.js → context-4UOGGLQ5.js} +71 -35
- package/dist/context-5VKGUVJJ.js +866 -0
- package/dist/{context-3KWFLHJG.js → context-77FM5DV5.js} +15 -13
- package/dist/{context-clear-7TSNPAAI.js → context-clear-XXJRLCJJ.js} +54 -28
- package/dist/{context-index-W4RLWOQH.js → context-index-BZ4UYMTC.js} +30 -24
- package/dist/dispatch-runner-QPRDDBDX.js +1997 -0
- package/dist/{docs-5AWSPS37.js → docs-2C2LTVT2.js} +23 -10
- package/dist/{doctor-UC5NAJYQ.js → doctor-HR46URBJ.js} +27 -17
- package/dist/{eval-U6TJHRLX.js → eval-XSSNATB4.js} +29 -16
- package/dist/{evidence-YEGUW4L3.js → evidence-6HG2PY2B.js} +46 -26
- package/dist/{evolve-TXARCTPG.js → evolve-K7YU3NCY.js} +45 -25
- package/dist/{extensions-OZFJ3A3G.js → extensions-QVDOHDGJ.js} +16 -7
- package/dist/{fleet-6G3DHNYE.js → fleet-VY3HHKN6.js} +163 -54
- package/dist/{fleet-preflight-DSNT37JK.js → fleet-preflight-DDN536IT.js} +7 -4
- package/dist/{init-KZ5QTF6M.js → init-JYGXI3FK.js} +69 -32
- package/dist/{memory-73ESV5YC.js → memory-WFZMGYHX.js} +48 -27
- package/dist/{models-A4PVNWJK.js → models-I5QWSEOM.js} +39 -25
- package/dist/monitor-GE4ID3IA.js +661 -0
- package/dist/{chunk-FCIH3BIZ.js → orchestrator-EM5MC3HM.js} +15979 -12407
- package/dist/{paths-C4H6IV77.js → paths-UXLN5YYZ.js} +10 -5
- package/dist/{preload-6WVMHX3A.js → preload-P6DGH2PZ.js} +2 -2
- package/dist/{reset-BGW6OGMV.js → reset-L2FQEE3E.js} +16 -10
- package/dist/{run-YTPEYQOH.js → run-ZU3QMZPZ.js} +101 -61
- package/dist/{share-YIFFV4NQ.js → share-S5BZQC5I.js} +15 -8
- package/dist/{skills-2V6RA3OQ.js → skills-X5VXCRNQ.js} +34 -14
- package/dist/{skills-eval-S2TVJO4F.js → skills-eval-WKIHWTHR.js} +70 -34
- package/dist/steer-GGWFUJUD.js +77 -0
- package/dist/{targets-TYXLPB23.js → targets-SNCPI2NR.js} +43 -27
- package/dist/terminal-lease-BNAHVHBS.js +395 -0
- package/dist/{trace-GGOJ6Q6Z.js → trace-PNCASAXC.js} +41 -16
- package/dist/{chunk-N6F52NLF.js → tree-sitter-HGKH6LG4.js} +28 -2306
- package/dist/{uninstall-LLLT4F4W.js → uninstall-FZCQCDKC.js} +10 -5
- package/dist/{upgrade-33G2LMM5.js → upgrade-JQHHPQ4K.js} +45 -25
- package/dist/{usage-ZAFSXKKG.js → usage-OR4O5SMZ.js} +62 -31
- package/dist/verify-375KUB3Y.js +716 -0
- package/dist/web-fetch-2YHJ3KTG.js +638 -0
- package/dist/{wiki-generate-NUQCVOQ3.js → wiki-generate-UEXP2ARI.js} +74 -34
- package/dist/worker/entry.js +221 -36
- package/dist/workspace-G4ZWUIPR.js +22 -0
- package/docs/README.md +22 -17
- package/docs/acp.md +168 -16
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +136 -7
- package/docs/artifact-versions.md +1 -1
- package/docs/built-in-agents.md +1 -1
- package/docs/capacity-and-scheduling.md +1 -1
- package/docs/commands-and-modes.md +114 -71
- package/docs/config-knobs-audit.md +1 -3
- package/docs/configuration-and-targets.md +174 -46
- package/docs/context-engine.md +29 -6
- package/docs/development-pipeline.md +26 -1
- package/docs/dispatch-architecture-rationale.md +1 -1
- package/docs/documentation-coverage.md +2 -2
- package/docs/documentation-guide.md +1 -1
- package/docs/environment-variables.md +13 -5
- package/docs/eval-runner.md +1 -1
- package/docs/evals-internal.md +1 -1
- package/docs/evidence-and-memory.md +6 -2
- package/docs/evolution.md +2 -2
- package/docs/exit-codes-and-output.md +15 -9
- package/docs/extensions-and-sharing.md +9 -9
- package/docs/fleet-dispatch.md +7 -5
- package/docs/git-commit-provenance.md +120 -0
- package/docs/glossary.md +1 -1
- package/docs/installation-and-lifecycle.md +34 -27
- package/docs/middleware-and-components.md +1 -1
- package/docs/model-catalog.md +45 -14
- package/docs/observability.md +8 -5
- package/docs/performance-methodology.md +491 -0
- package/docs/pi-boundary.md +72 -0
- package/docs/proactive-memory.md +3 -3
- package/docs/prompt-envelope-and-tools.md +24 -3
- package/docs/provider-adapter-cookbook.md +57 -4
- package/docs/release-cut-checklist.md +129 -115
- package/docs/safety-model.md +9 -5
- package/docs/scientific-validation.md +3 -3
- package/docs/session-lifecycle.md +55 -12
- package/docs/skills-marketplace.md +12 -8
- package/docs/time-conventions.md +1 -1
- package/docs/tool-usage.md +3 -3
- package/docs/trace-store.md +1 -1
- package/docs/troubleshooting.md +10 -7
- package/docs/tui-design.md +47 -10
- package/docs/worker-dispatch-mechanics.md +1 -1
- package/package.json +19 -22
- package/skills/coding/ast-grep/SKILL.md +136 -0
- package/skills/coding/ast-grep/evals.md +56 -0
- package/skills/coding/ast-grep/references/rule_reference.md +297 -0
- package/skills/coding/coding-standards/SKILL.md +113 -0
- package/skills/coding/coding-standards/evals.md +34 -0
- package/skills/coding/prototype/SKILL.md +86 -0
- package/skills/coding/prototype/evals.md +42 -0
- package/skills/coding/prototype/references/LOGIC.md +67 -0
- package/skills/coding/prototype/references/UI.md +112 -0
- package/skills/coding/tdd/SKILL.md +101 -0
- package/skills/coding/tdd/evals.md +41 -0
- package/skills/coding/tdd/references/mocking.md +59 -0
- package/skills/coding/tdd/references/tests.md +77 -0
- package/skills/context/context-handoff/SKILL.md +126 -0
- package/skills/context/context-handoff/evals.md +57 -0
- package/skills/context/context-handoff/scripts/new-handoff.sh +26 -0
- package/skills/context/context-prime/SKILL.md +95 -0
- package/skills/context/context-prime/evals.md +54 -0
- package/skills/meta/clio-dev/SKILL.md +91 -0
- package/skills/meta/clio-dev/evals.md +45 -0
- package/skills/meta/clio-test/SKILL.md +130 -0
- package/skills/meta/clio-test/evals.md +43 -0
- package/skills/meta/clio-test/references/harness.md +97 -0
- package/skills/meta/clio-test/references/test-map.md +59 -0
- package/skills/meta/credentials/SKILL.md +125 -0
- package/skills/meta/credentials/evals.md +104 -0
- package/skills/meta/find-skills/SKILL.md +72 -0
- package/skills/meta/find-skills/evals.md +47 -0
- package/skills/meta/herdr/SKILL.md +127 -0
- package/skills/meta/herdr/evals.md +38 -0
- package/skills/meta/skill-craft/SKILL.md +102 -0
- package/skills/meta/skill-craft/evals.md +41 -0
- package/skills/planning/architecture/SKILL.md +129 -0
- package/skills/planning/architecture/evals.md +36 -0
- package/skills/planning/backlog/SKILL.md +90 -0
- package/skills/planning/backlog/evals.md +43 -0
- package/skills/planning/prd/SKILL.md +82 -0
- package/skills/planning/prd/evals.md +49 -0
- package/skills/planning/product-intent/SKILL.md +112 -0
- package/skills/planning/product-intent/evals.md +36 -0
- package/skills/planning/tech-spec/SKILL.md +115 -0
- package/skills/planning/tech-spec/evals.md +47 -0
- package/skills/registry.yaml +136 -0
- package/skills/research/arxiv-literature/SKILL.md +104 -0
- package/skills/research/arxiv-literature/evals.md +58 -0
- package/skills/research/experiment-protocol/SKILL.md +122 -0
- package/skills/research/experiment-protocol/evals.md +91 -0
- package/skills/research/scientific-debugging/SKILL.md +119 -0
- package/skills/research/scientific-debugging/evals.md +138 -0
- package/skills/research/scientific-modernization/SKILL.md +138 -0
- package/skills/research/scientific-modernization/evals.md +84 -0
- package/skills/workflow/design-council/SKILL.md +139 -0
- package/skills/workflow/design-council/evals.md +97 -0
- package/skills/workflow/grill-me/SKILL.md +186 -0
- package/skills/workflow/grill-me/evals.md +78 -0
- package/skills/workflow/workflow-distiller/SKILL.md +136 -0
- package/skills/workflow/workflow-distiller/evals.md +107 -0
- package/src/cli/acp.ts +31 -4
- package/src/cli/clio.ts +68 -6
- package/src/cli/config-inspect.ts +28 -22
- package/src/cli/configure.ts +47 -9
- package/src/cli/context-clear.ts +2 -2
- package/src/cli/context-index.ts +21 -23
- package/src/cli/context.ts +13 -8
- package/src/cli/default-target.ts +9 -17
- package/src/cli/docs.ts +11 -5
- package/src/cli/evidence.ts +4 -1
- package/src/cli/extensions.ts +10 -1
- package/src/cli/fleet.ts +47 -6
- package/src/cli/index.ts +55 -26
- package/src/cli/memory.ts +3 -1
- package/src/cli/models.ts +1 -1
- package/src/cli/modes/json-stream.ts +37 -1
- package/src/cli/modes/print.ts +24 -9
- package/src/cli/run.ts +2 -2
- package/src/cli/skills-eval.ts +23 -8
- package/src/cli/skills.ts +19 -4
- package/src/cli/targets.ts +4 -0
- package/src/cli/text-layout.ts +15 -5
- package/src/cli/trace.ts +62 -14
- package/src/cli/upgrade.ts +18 -2
- package/src/cli/usage.ts +10 -3
- package/src/cli/wiki-generate.ts +2 -1
- package/src/core/agent-environment.ts +7 -0
- package/src/core/bash-exec.ts +72 -1
- package/src/core/boot-trace.ts +9 -4
- package/src/core/bus-events.ts +20 -4
- package/src/core/commit-attribution.ts +157 -0
- package/src/core/compile-cache.ts +159 -0
- package/src/core/config.ts +131 -2
- package/src/core/defaults.ts +39 -5
- package/src/core/domain-loader.ts +12 -5
- package/src/core/git-commit-attribution.ts +387 -0
- package/src/core/incomplete-installation.ts +45 -0
- package/src/core/response-schema.ts +1 -1
- package/src/core/safe-exec.ts +13 -1
- package/src/core/settings-layers.ts +155 -21
- package/src/core/skill-activation.ts +1 -1
- package/src/core/startup-timer.ts +3 -3
- package/src/core/state-file-lock.ts +13 -1
- package/src/core/termination.ts +78 -5
- package/src/domains/config/classify.ts +15 -3
- package/src/domains/config/extension.ts +19 -13
- package/src/domains/config/index.ts +10 -0
- package/src/domains/config/keybindings.ts +45 -9
- package/src/domains/context/bootstrap-prompt.ts +1 -1
- package/src/domains/context/bootstrap.ts +111 -18
- package/src/domains/context/clear.ts +16 -11
- package/src/domains/context/clio-md.ts +111 -9
- package/src/domains/context/codewiki/artifact.ts +400 -0
- package/src/domains/context/codewiki/build-worker-protocol.ts +24 -0
- package/src/domains/context/codewiki/build-worker.ts +54 -0
- package/src/domains/context/codewiki/coordinator.ts +182 -0
- package/src/domains/context/codewiki/indexer.ts +59 -144
- package/src/domains/context/codewiki/paths.ts +67 -0
- package/src/domains/context/codewiki/schema.ts +80 -0
- package/src/domains/context/codewiki/tree-sitter.ts +1 -1
- package/src/domains/context/contract.ts +11 -5
- package/src/domains/context/extension.ts +94 -143
- package/src/domains/context/fingerprint.ts +3 -1
- package/src/domains/context/index.ts +12 -22
- package/src/domains/context/project-metadata.ts +19 -0
- package/src/domains/context/prompt-context.ts +9 -10
- package/src/domains/context/refresh.ts +29 -21
- package/src/domains/context/runtime.ts +17 -0
- package/src/domains/context/wiki/generate.ts +39 -34
- package/src/domains/context/wiki/plan.ts +1 -1
- package/src/domains/context/wiki/prompts.ts +21 -8
- package/src/domains/dispatch/code-step.ts +20 -1
- package/src/domains/dispatch/extension.ts +158 -21
- package/src/domains/dispatch/failure-classification.ts +6 -0
- package/src/domains/dispatch/fleet-commit-attribution.ts +56 -0
- package/src/domains/dispatch/orphan-recovery.ts +50 -8
- package/src/domains/dispatch/receipt-integrity.ts +5 -0
- package/src/domains/dispatch/state.ts +31 -6
- package/src/domains/dispatch/transport.ts +2 -1
- package/src/domains/dispatch/types.ts +14 -0
- package/src/domains/dispatch/worker-spawn.ts +21 -2
- package/src/domains/eval/metrics/context.ts +1 -1
- package/src/domains/eval/types.ts +0 -1
- package/src/domains/evidence/build.ts +41 -1
- package/src/domains/lifecycle/migrations/2026-08-18-lmstudio-runtime-id.ts +52 -0
- package/src/domains/lifecycle/migrations/index.ts +24 -4
- package/src/domains/middleware/hooks-io.ts +12 -0
- package/src/domains/middleware/skills-reminder.ts +30 -15
- package/src/domains/prompts/compiler.ts +142 -84
- package/src/domains/prompts/contract.ts +18 -2
- package/src/domains/prompts/extension.ts +39 -7
- package/src/domains/prompts/fragment-loader.ts +0 -1
- package/src/domains/prompts/fragments/identity/clio.md +2 -4
- package/src/domains/prompts/fragments/identity/docs-routing.md +10 -0
- package/src/domains/prompts/fragments/identity/self-awareness.md +1 -45
- package/src/domains/prompts/fragments/operating/contract.md +4 -50
- package/src/domains/prompts/fragments/operating/delegation.md +42 -0
- package/src/domains/prompts/fragments/operating/skills.md +26 -0
- package/src/domains/prompts/fragments/operating/worker.md +16 -0
- package/src/domains/prompts/fragments/safety/auto-edit.md +5 -5
- package/src/domains/prompts/fragments/safety/full-auto.md +3 -3
- package/src/domains/prompts/fragments/safety/read-only.md +4 -4
- package/src/domains/prompts/fragments/safety/suggest.md +2 -2
- package/src/domains/prompts/fragments/wiki/page.md +10 -0
- package/src/domains/prompts/fragments/wiki/plan.md +10 -0
- package/src/domains/prompts/preload.ts +3 -3
- package/src/domains/providers/auth/api-key.ts +1 -1
- package/src/domains/providers/auth/backend-file.ts +20 -10
- package/src/domains/providers/auth/backend-memory.ts +59 -4
- package/src/domains/providers/auth/boot-status.ts +65 -0
- package/src/domains/providers/auth/oauth.ts +2 -1
- package/src/domains/providers/auth/storage.ts +97 -38
- package/src/domains/providers/capabilities.ts +12 -4
- package/src/domains/providers/contract.ts +15 -4
- package/src/domains/providers/extension.ts +18 -6
- package/src/domains/providers/model-runtime-capabilities.ts +15 -4
- package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +118 -35
- package/src/domains/providers/plugins.ts +5 -3
- package/src/domains/providers/probe/fingerprint.ts +25 -5
- package/src/domains/providers/registry.ts +31 -10
- package/src/domains/providers/runtimes/boot-manifest.ts +55 -0
- package/src/domains/providers/runtimes/builtins.ts +2 -2
- package/src/domains/providers/runtimes/common/lmstudio-http.ts +423 -0
- package/src/domains/providers/runtimes/common/local-synth.ts +6 -7
- package/src/domains/providers/runtimes/local-native/lmstudio.ts +241 -0
- package/src/domains/providers/support.ts +6 -3
- package/src/domains/providers/types/local-model-quirks.ts +7 -9
- package/src/domains/providers/types/runtime-descriptor.ts +12 -1
- package/src/domains/providers/types/target-descriptor.ts +22 -0
- package/src/domains/resources/contract.ts +0 -1
- package/src/domains/resources/extension.ts +1 -3
- package/src/domains/resources/loader.ts +3 -4
- package/src/domains/resources/prompts/loader.ts +16 -2
- package/src/domains/resources/prompts/substitute.ts +1 -65
- package/src/domains/resources/skills/content-hash.ts +2 -0
- package/src/domains/resources/skills/install.ts +17 -0
- package/src/domains/resources/skills/loader.ts +17 -10
- package/src/domains/resources/skills/marketplace.ts +55 -9
- package/src/domains/safety/action-classifier.ts +4 -2
- package/src/domains/safety/audit.ts +8 -2
- package/src/domains/safety/extension.ts +1 -1
- package/src/domains/session/compaction/branch-summary.ts +3 -2
- package/src/domains/session/compaction/cut-point.ts +2 -1
- package/src/domains/session/compaction/tokens.ts +2 -1
- package/src/domains/session/context-ledger.ts +14 -0
- package/src/domains/session/contract.ts +15 -0
- package/src/domains/session/decision-board.ts +190 -0
- package/src/domains/session/entries.ts +66 -3
- package/src/domains/session/extension.ts +93 -12
- package/src/domains/session/retry.ts +10 -18
- package/src/domains/session/session-artifacts.ts +107 -0
- package/src/domains/session/task-board.ts +207 -13
- package/src/domains/session/tree/active-path.ts +44 -5
- package/src/domains/session/tree/fork.ts +26 -27
- package/src/domains/session/tree/preview.ts +2 -2
- package/src/domains/session/workspace/git-probe.ts +17 -11
- package/src/domains/user-tasks/store.ts +297 -0
- package/src/engine/acp/errors.ts +96 -0
- package/src/engine/acp/server.ts +1728 -146
- package/src/engine/acp/transport.ts +135 -14
- package/src/engine/acp/types.ts +26 -0
- package/src/engine/agent.ts +3 -3
- package/src/engine/ai.ts +32 -27
- package/src/engine/alcf-oauth.ts +26 -19
- package/src/engine/api-registry.ts +223 -0
- package/src/engine/apis/index.ts +3 -7
- package/src/engine/apis/llamacpp-residency.ts +49 -9
- package/src/engine/apis/lmstudio-residency.ts +5 -21
- package/src/engine/apis/lmstudio.ts +243 -0
- package/src/engine/apis/ollama-native.ts +24 -3
- package/src/engine/apis/openai-completions.ts +170 -91
- package/src/engine/apis/residency.ts +139 -3
- package/src/engine/apis/types.ts +16 -0
- package/src/engine/env-api-keys.ts +98 -0
- package/src/engine/gemma-channel-filter.ts +223 -0
- package/src/engine/instrumented-tui.ts +192 -0
- package/src/engine/messages.ts +14 -0
- package/src/engine/models.ts +42 -0
- package/src/engine/oauth.ts +16 -12
- package/src/engine/prompt-templates.ts +1 -0
- package/src/engine/provider-payload.ts +16 -59
- package/src/engine/strip-tokenizer-sentinels.ts +1 -1
- package/src/engine/truncate.ts +9 -0
- package/src/engine/tui.ts +17 -9
- package/src/engine/types.ts +3 -6
- package/src/engine/worker-runtime-capabilities.ts +5 -0
- package/src/engine/worker-runtime.ts +1 -1
- package/src/engine/worker-tools.ts +9 -4
- package/src/entry/boot-options.ts +50 -0
- package/src/entry/orchestrator.ts +288 -150
- package/src/interactive/application-controller.ts +89 -2
- package/src/interactive/chat-loop.ts +266 -41
- package/src/interactive/chat-panel.ts +715 -278
- package/src/interactive/chat-renderer.ts +306 -85
- package/src/interactive/clio-editor.ts +3 -8
- package/src/interactive/command-fallbacks.ts +2 -2
- package/src/interactive/context-overlay.ts +27 -1
- package/src/interactive/editor-submit.ts +253 -24
- package/src/interactive/export-html/ansi-to-html.ts +161 -0
- package/src/interactive/export-html/index.ts +51 -0
- package/src/interactive/export-html/template.ts +45 -0
- package/src/interactive/export-html/tool-renderer.ts +54 -0
- package/src/interactive/footer/dashboard.ts +4 -0
- package/src/interactive/footer/notifications.ts +1 -1
- package/src/interactive/footer/widgets.ts +42 -22
- package/src/interactive/footer-panel.ts +8 -3
- package/src/interactive/format-time.ts +14 -2
- package/src/interactive/interactive-application.ts +203 -17
- package/src/interactive/interactive-event-projection.ts +18 -1
- package/src/interactive/interactive-input-runtime.ts +50 -4
- package/src/interactive/interactive-presentation.ts +151 -19
- package/src/interactive/interactive-shell.ts +268 -14
- package/src/interactive/interactive-slash-runtime.ts +184 -117
- package/src/interactive/interactive-tickers.ts +38 -7
- package/src/interactive/keybinding-manager.ts +1 -1
- package/src/interactive/layout.ts +40 -3
- package/src/interactive/overlay-frame.ts +1 -1
- package/src/interactive/overlay-general-openers.ts +58 -1
- package/src/interactive/overlay-key-routing.ts +3 -0
- package/src/interactive/overlay-lifecycle.ts +13 -0
- package/src/interactive/overlay-permission-lifecycle.ts +2 -1
- package/src/interactive/overlay-session-lifecycle.ts +69 -12
- package/src/interactive/overlays/ask-user.ts +146 -24
- package/src/interactive/overlays/decisions.ts +300 -0
- package/src/interactive/overlays/help-reference.ts +15 -10
- package/src/interactive/overlays/model-selector.ts +34 -16
- package/src/interactive/overlays/session-selector.ts +18 -0
- package/src/interactive/overlays/settings.ts +105 -17
- package/src/interactive/overlays/skills-hub.ts +4 -4
- package/src/interactive/overlays/tree-selector.ts +41 -6
- package/src/interactive/render-trace.ts +499 -90
- package/src/interactive/renderers/compaction-summary.ts +2 -2
- package/src/interactive/renderers/diff.ts +115 -104
- package/src/interactive/renderers/mermaid.ts +53 -0
- package/src/interactive/renderers/tool-execution.ts +516 -168
- package/src/interactive/renderers/worker-entry.ts +20 -4
- package/src/interactive/session-switch-settlement.ts +10 -0
- package/src/interactive/slash-autocomplete.ts +6 -114
- package/src/interactive/slash-commands.ts +135 -47
- package/src/interactive/slash-spec.ts +9 -38
- package/src/interactive/status/controller.ts +5 -1
- package/src/interactive/status/index.ts +12 -1
- package/src/interactive/status/reasoning.ts +87 -0
- package/src/interactive/status/summary.ts +13 -2
- package/src/interactive/stdout-backpressure.ts +99 -0
- package/src/interactive/stream-pacer.ts +530 -0
- package/src/interactive/stream-pacing-policy.ts +66 -0
- package/src/interactive/tasks-overlay.ts +368 -14
- package/src/interactive/terminal-lease.ts +485 -0
- package/src/interactive/theme/tokens.ts +1 -1
- package/src/interactive/transcript-detail.ts +120 -0
- package/src/interactive/turn-context.ts +4 -3
- package/src/interactive/turn-persistence.ts +30 -13
- package/src/interactive/turn-queues.ts +12 -0
- package/src/interactive/turn-recovery.ts +25 -8
- package/src/interactive/turn-runtime.ts +79 -12
- package/src/interactive/turn-state.ts +10 -0
- package/src/interactive/view/artifacts.ts +114 -4
- package/src/interactive/view/view-overlay.ts +3 -0
- package/src/interactive/welcome-dashboard.ts +17 -16
- package/src/interactive/worker-receipts.ts +52 -3
- package/src/interactive/worker-stream.ts +5 -1
- package/src/tools/agent-tools.ts +23 -3
- package/src/tools/artifact.ts +2 -2
- package/src/tools/ask-user.ts +23 -13
- package/src/tools/bash.ts +30 -2
- package/src/tools/bootstrap.ts +34 -431
- package/src/tools/builtin-tool-catalog.ts +271 -0
- package/src/tools/codewiki/code-nav-surface.ts +29 -0
- package/src/tools/codewiki/code-nav.ts +8 -22
- package/src/tools/codewiki/shared.ts +41 -38
- package/src/tools/context/docs-engine.ts +14 -3
- package/src/tools/context/index.ts +107 -28
- package/src/tools/context/surface.ts +19 -0
- package/src/tools/core-bootstrap.ts +168 -0
- package/src/tools/credential-present.ts +5 -5
- package/src/tools/dispatch-admission.ts +533 -0
- package/src/tools/dispatch-background.ts +54 -0
- package/src/tools/dispatch-event-text.ts +6 -0
- package/src/tools/dispatch-plan.ts +9 -4
- package/src/tools/dispatch-run-events.ts +238 -0
- package/src/tools/dispatch-runner.ts +2370 -0
- package/src/tools/dispatch-scout-admission.ts +295 -0
- package/src/tools/dispatch-types.ts +77 -0
- package/src/tools/dispatch.ts +67 -3161
- package/src/tools/find.ts +4 -2
- package/src/tools/grep.ts +2 -2
- package/src/tools/lazy-tool.ts +60 -0
- package/src/tools/ledger.ts +3 -3
- package/src/tools/monitor-surface.ts +36 -0
- package/src/tools/monitor.ts +2 -32
- package/src/tools/observers.ts +2 -2
- package/src/tools/presentation.ts +107 -0
- package/src/tools/registry.ts +45 -27
- package/src/tools/safe-exec.ts +2 -2
- package/src/tools/steer-surface.ts +17 -0
- package/src/tools/steer.ts +2 -13
- package/src/tools/tasks.ts +108 -11
- package/src/tools/truncate.ts +25 -184
- package/src/tools/verify/frontend.ts +3 -1
- package/src/tools/verify/index.ts +3 -38
- package/src/tools/verify/surface.ts +46 -0
- package/src/tools/web-fetch-surface.ts +23 -0
- package/src/tools/web-fetch.ts +2 -20
- package/src/tools/write.ts +7 -2
- package/src/worker/entry.ts +39 -2
- package/src/worker/spec-contract.ts +26 -5
- package/dist/chunk-7SS2CTV2.js +0 -61361
- package/dist/chunk-DKGKUHFA.js +0 -924
- package/dist/chunk-GEP36Y4X.js +0 -12796
- package/dist/chunk-XYWBQRDM.js +0 -137
- package/dist/clio-BZVGEUFJ.js +0 -58
- package/dist/configure-S7S6F6CL.js +0 -32
- package/docs/html/agents_blueprint.html +0 -936
- package/docs/html/alcf_blueprint.html +0 -324
- package/docs/html/architecture_blueprint.html +0 -850
- package/docs/html/commands_blueprint.html +0 -939
- package/docs/html/config_knobs_audit_blueprint.html +0 -178
- package/docs/html/configuration_blueprint.html +0 -1080
- package/docs/html/context_blueprint.html +0 -603
- package/docs/html/documentation_blueprint.html +0 -832
- package/docs/html/environment_blueprint.html +0 -404
- package/docs/html/eval_blueprint.html +0 -743
- package/docs/html/evals_internal_blueprint.html +0 -190
- package/docs/html/evolution_blueprint.html +0 -674
- package/docs/html/extensions_blueprint.html +0 -2065
- package/docs/html/fleet_dispatch_blueprint.html +0 -286
- package/docs/html/index.html +0 -919
- package/docs/html/lifecycle_blueprint.html +0 -723
- package/docs/html/memory_blueprint.html +0 -699
- package/docs/html/middleware_blueprint.html +0 -664
- package/docs/html/models_blueprint.html +0 -2366
- package/docs/html/observability_blueprint.html +0 -683
- package/docs/html/provider_adapter_blueprint.html +0 -245
- package/docs/html/safety_blueprint.html +0 -1386
- package/docs/html/shared.css +0 -571
- package/docs/html/shared.js +0 -143
- package/docs/html/skills_blueprint.html +0 -671
- package/docs/html/soak_blueprint.html +0 -182
- package/docs/html/tool_usage_blueprint.html +0 -350
- package/docs/html/tools_blueprint.html +0 -2249
- package/docs/html/trace_blueprint.html +0 -235
- package/docs/html/tui_design_blueprint.html +0 -374
- package/docs/html/validation_blueprint.html +0 -961
- package/docs/html/worker_dispatch_blueprint.html +0 -231
- package/src/core/release.ts +0 -2
- package/src/domains/providers/runtimes/common/lmstudio-logger.ts +0 -32
- package/src/domains/providers/runtimes/local-native/lmstudio-native.ts +0 -491
- package/src/engine/apis/lmstudio-native.ts +0 -1438
- package/src/engine/apis/thinking-replay.ts +0 -11
- package/src/tools/string-enum.ts +0 -15
package/dist/chunk-DKGKUHFA.js
DELETED
|
@@ -1,924 +0,0 @@
|
|
|
1
|
-
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
RESPONSE_SCHEMA_RUNTIME_ID
|
|
4
|
-
} from "./chunk-7SS2CTV2.js";
|
|
5
|
-
import {
|
|
6
|
-
hashToolCall
|
|
7
|
-
} from "./chunk-GEP36Y4X.js";
|
|
8
|
-
import {
|
|
9
|
-
classify,
|
|
10
|
-
protectArtifact,
|
|
11
|
-
protectedArtifactMutationBlockReason
|
|
12
|
-
} from "./chunk-OLBBMFRD.js";
|
|
13
|
-
import {
|
|
14
|
-
ToolNames
|
|
15
|
-
} from "./chunk-CGKSTWHD.js";
|
|
16
|
-
import {
|
|
17
|
-
defaultAnthropicBudgetForLevel,
|
|
18
|
-
defaultAnthropicEffortForLevel
|
|
19
|
-
} from "./chunk-H6F6BYOH.js";
|
|
20
|
-
import {
|
|
21
|
-
BusChannels
|
|
22
|
-
} from "./chunk-Q5WJOSJ7.js";
|
|
23
|
-
import {
|
|
24
|
-
GUARDRAIL_DEFAULTS,
|
|
25
|
-
resolveGuardrail,
|
|
26
|
-
workerSynthesisReserveBlockReason,
|
|
27
|
-
workerSynthesisReserveDirective,
|
|
28
|
-
workerToolCallCapExceededReason,
|
|
29
|
-
workerToolCallCapSynthesisReason
|
|
30
|
-
} from "./chunk-NMOX6HFD.js";
|
|
31
|
-
import {
|
|
32
|
-
init_esm_shims
|
|
33
|
-
} from "./chunk-3R73A4XB.js";
|
|
34
|
-
|
|
35
|
-
// src/domains/safety/protected-artifacts-registration.ts
|
|
36
|
-
init_esm_shims();
|
|
37
|
-
var PROTECTED_ARTIFACTS_REGISTRATION_ID = "guard.protected-artifacts";
|
|
38
|
-
function createProtectedArtifactsRegistration(options = {}) {
|
|
39
|
-
let state = cloneState(options.initialState ?? { artifacts: [] });
|
|
40
|
-
let health = { kind: "healthy" };
|
|
41
|
-
const markDegraded = (reason) => {
|
|
42
|
-
if (health.kind === "degraded") return;
|
|
43
|
-
const degraded = {
|
|
44
|
-
kind: "degraded",
|
|
45
|
-
reason,
|
|
46
|
-
since: (/* @__PURE__ */ new Date()).toISOString()
|
|
47
|
-
};
|
|
48
|
-
health = degraded;
|
|
49
|
-
try {
|
|
50
|
-
options.onDurabilityFailure?.({ ...degraded });
|
|
51
|
-
} catch {
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const absorb = (input, context) => {
|
|
55
|
-
for (const effect of context?.priorEffects ?? []) {
|
|
56
|
-
if (effect.kind !== "protect_path") continue;
|
|
57
|
-
const artifact = artifactFromEffect(effect, input);
|
|
58
|
-
state = protectArtifact(state, artifact);
|
|
59
|
-
try {
|
|
60
|
-
emitProtect(options.onProtect, artifact, input);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
markDegraded(`protected artifact persistence failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const blockReason = (input) => {
|
|
67
|
-
const toolName = input.toolName ?? "";
|
|
68
|
-
const args = input.toolArgs !== void 0 ? { ...input.toolArgs } : void 0;
|
|
69
|
-
if (health.kind === "degraded") {
|
|
70
|
-
const actionClass = classify({ tool: toolName, ...args !== void 0 ? { args } : {} }).actionClass;
|
|
71
|
-
if (actionClass !== "read") {
|
|
72
|
-
return `protected artifact durability degraded: ${health.reason}; non-read tool '${toolName}' is blocked until protection state is trustworthy`;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return protectedArtifactMutationBlockReason(state, toolName, args);
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
id: PROTECTED_ARTIFACTS_REGISTRATION_ID,
|
|
79
|
-
description: "blocks mutations of protected paths and absorbs protect_path effects",
|
|
80
|
-
hooks: ["before_tool", "after_tool"],
|
|
81
|
-
state: () => cloneState(state),
|
|
82
|
-
health: () => ({ ...health }),
|
|
83
|
-
replaceState(next) {
|
|
84
|
-
state = cloneState(next);
|
|
85
|
-
health = { kind: "healthy" };
|
|
86
|
-
},
|
|
87
|
-
markDegraded,
|
|
88
|
-
evaluate(input, context) {
|
|
89
|
-
absorb(input, context);
|
|
90
|
-
if (input.hook !== "before_tool") return [];
|
|
91
|
-
const reason = blockReason(input);
|
|
92
|
-
if (reason === null) return [];
|
|
93
|
-
return [{ kind: "block_tool", reason, severity: "hard-block" }];
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function artifactFromEffect(effect, input) {
|
|
98
|
-
const artifact = {
|
|
99
|
-
path: effect.path,
|
|
100
|
-
protectedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
101
|
-
reason: effect.reason,
|
|
102
|
-
source: "middleware"
|
|
103
|
-
};
|
|
104
|
-
const validationCommand = input.metadata?.validationCommand;
|
|
105
|
-
if (typeof validationCommand === "string" && validationCommand.length > 0) {
|
|
106
|
-
artifact.validationCommand = validationCommand;
|
|
107
|
-
if (input.metadata?.validationExitCode === 0) artifact.validationExitCode = 0;
|
|
108
|
-
}
|
|
109
|
-
return artifact;
|
|
110
|
-
}
|
|
111
|
-
function emitProtect(sink, artifact, input) {
|
|
112
|
-
if (!sink) return;
|
|
113
|
-
const event = {
|
|
114
|
-
kind: "protect",
|
|
115
|
-
artifact: cloneArtifact(artifact),
|
|
116
|
-
toolName: input.toolName ?? ""
|
|
117
|
-
};
|
|
118
|
-
if (input.runId !== void 0) event.runId = input.runId;
|
|
119
|
-
if (input.sessionId !== void 0) event.sessionId = input.sessionId;
|
|
120
|
-
if (input.turnId !== void 0) event.turnId = input.turnId;
|
|
121
|
-
if (input.toolCallId !== void 0) event.toolCallId = input.toolCallId;
|
|
122
|
-
if (input.correlationId !== void 0) event.correlationId = input.correlationId;
|
|
123
|
-
sink(event);
|
|
124
|
-
}
|
|
125
|
-
function cloneState(state) {
|
|
126
|
-
let next = { artifacts: [] };
|
|
127
|
-
for (const artifact of state.artifacts) {
|
|
128
|
-
next = protectArtifact(next, artifact);
|
|
129
|
-
}
|
|
130
|
-
return next;
|
|
131
|
-
}
|
|
132
|
-
function cloneArtifact(artifact) {
|
|
133
|
-
const clone = {
|
|
134
|
-
path: artifact.path,
|
|
135
|
-
protectedAt: artifact.protectedAt,
|
|
136
|
-
reason: artifact.reason,
|
|
137
|
-
source: artifact.source
|
|
138
|
-
};
|
|
139
|
-
if (artifact.validationCommand !== void 0) clone.validationCommand = artifact.validationCommand;
|
|
140
|
-
if (artifact.validationExitCode !== void 0) clone.validationExitCode = artifact.validationExitCode;
|
|
141
|
-
return clone;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// src/engine/loop-guard.ts
|
|
145
|
-
init_esm_shims();
|
|
146
|
-
var LOOP_GUARD_REGISTRATION_ID = "guard.loop";
|
|
147
|
-
var INTERACTIVE_LOOP_BLOCK_BUDGET = 2;
|
|
148
|
-
var WORKER_LOOP_BLOCK_CALLS_PER_BLOCK = 10;
|
|
149
|
-
function workerLoopBlockBudget(toolCalls) {
|
|
150
|
-
if (!Number.isSafeInteger(toolCalls) || toolCalls <= 0) return INTERACTIVE_LOOP_BLOCK_BUDGET;
|
|
151
|
-
return Math.max(INTERACTIVE_LOOP_BLOCK_BUDGET, Math.ceil(toolCalls / WORKER_LOOP_BLOCK_CALLS_PER_BLOCK));
|
|
152
|
-
}
|
|
153
|
-
var LOOP_SYNTHESIS_BACKSTOP_DENIALS = 2;
|
|
154
|
-
var WIDE_BATCH_DENIAL_FLOOR = 32;
|
|
155
|
-
var DEFAULT_WORKER_TOOL_CALL_CAP = GUARDRAIL_DEFAULTS.workerToolCallCap;
|
|
156
|
-
var DEFAULT_ORCH_TURN_TOOL_CALL_BUDGET = GUARDRAIL_DEFAULTS.turnToolCallBudget;
|
|
157
|
-
var ORCH_TURN_TOOL_CALL_HARD_MARGIN = 15;
|
|
158
|
-
var LOOP_GUARD_TURN_LIMIT = 32;
|
|
159
|
-
var SUCCEEDED_FINGERPRINT_LIMIT = 128;
|
|
160
|
-
var NO_TURN_BUCKET = "no-turn";
|
|
161
|
-
var SIZE_ONLY_ARG_KEYS = /* @__PURE__ */ new Set(["limit", "offset", "max_bytes", "context"]);
|
|
162
|
-
var RESULT_STAGNATION_THRESHOLD = 3;
|
|
163
|
-
var CROSS_ARGUMENT_RESULT_MIN_BYTES = 64;
|
|
164
|
-
function stagnationFingerprint(tool, args) {
|
|
165
|
-
const reduced = {};
|
|
166
|
-
for (const [key, value] of Object.entries(args ?? {})) {
|
|
167
|
-
if (!SIZE_ONLY_ARG_KEYS.has(key)) reduced[key] = value;
|
|
168
|
-
}
|
|
169
|
-
return hashToolCall(tool, reduced);
|
|
170
|
-
}
|
|
171
|
-
function stagnationBlockReason(tool, identicalResults) {
|
|
172
|
-
return `loop detected: the last ${identicalResults} ${tool} calls returned byte-identical results even though size arguments (limit/offset) changed. Raising them is not producing new information. Re-read the result above, change the query or tool, or answer from what you have.`;
|
|
173
|
-
}
|
|
174
|
-
function crossArgumentResultMessage(tool, distinctArguments) {
|
|
175
|
-
return `loop guard: ${distinctArguments} distinct ${tool} arguments returned the same substantial result this turn. The tool may be ignoring an argument; re-read the result, change tools, or answer from what you have.`;
|
|
176
|
-
}
|
|
177
|
-
function loopBlockBaseReason(tool, repeatCount, priorSuccesses) {
|
|
178
|
-
const evidence = priorSuccesses > 0 ? `This exact call already succeeded ${priorSuccesses} ${priorSuccesses === 1 ? "time" : "times"} this run; its result is already in the conversation above \u2014 re-read that result before calling tools again. ` : "";
|
|
179
|
-
return `loop detected: ${tool} was called ${repeatCount} times with identical arguments among this turn's recent tool calls. Repeating the exact call is blocked. ${evidence}Change strategy: vary the arguments, use a different tool, or explain what new information you expect before retrying.`;
|
|
180
|
-
}
|
|
181
|
-
function synthesisLockoutDirective() {
|
|
182
|
-
return "loop guard: this turn reached its tool-call limit after repeated identical calls, so tool calls are now disabled for the rest of this turn. Everything you retrieved is already in the conversation above. Answer the operator now, in plain prose, from what you have gathered. Do not write tool-call markup such as <tool_call> blocks; tool calls are disabled and will not run.";
|
|
183
|
-
}
|
|
184
|
-
function synthesisBackstopReason(tool) {
|
|
185
|
-
return `loop guard: tool calls stayed disabled and ${tool} was called again instead of answering, so the turn is being stopped. Summarize what you found for the operator.`;
|
|
186
|
-
}
|
|
187
|
-
function workerExplorationSynthesisDirective(limit) {
|
|
188
|
-
return `worker exploration budget reached (${limit}); exploration tools are now disabled for this run. Answer in plain prose from the evidence already gathered, with live path:line citations. Do not retry or substitute another tool call.`;
|
|
189
|
-
}
|
|
190
|
-
function disallowedToolsText(deliveryTools) {
|
|
191
|
-
const candidates = ["code_nav", "ls", "grep", "find", "context", "git", "shell commands"];
|
|
192
|
-
const excluded = candidates.filter((tool) => !deliveryTools.includes(tool));
|
|
193
|
-
return excluded.join(", ");
|
|
194
|
-
}
|
|
195
|
-
function workerLiveReadReserveDirective(remaining, deliveryTools) {
|
|
196
|
-
const admitted = deliveryTools.length > 0 ? `read and ${deliveryTools.join("/")}` : "the read tool";
|
|
197
|
-
const finish = deliveryTools.length > 0 ? `Finish the work: re-read what you will cite and write it with ${deliveryTools.join(" or ")}.` : "Read a specific live file needed for the handoff.";
|
|
198
|
-
return `worker live-read reserve: broad orientation is complete and ${remaining} ${remaining === 1 ? "call remains" : "calls remain"}. Only ${admitted} ${deliveryTools.length > 0 ? "are" : "is"} admitted now. ${finish} Do not substitute ${disallowedToolsText(deliveryTools)}.`;
|
|
199
|
-
}
|
|
200
|
-
function workerDeliveryOnlyDirective(limit, deliveryTools) {
|
|
201
|
-
return `worker discovery budget reached (${limit}); exploration tools are disabled for the rest of this run. Only read and ${deliveryTools.join("/")} are admitted now. Write what you have with ${deliveryTools.join(" or ")} and finish. Do not substitute ${disallowedToolsText(deliveryTools)}.`;
|
|
202
|
-
}
|
|
203
|
-
var DEAD_TOOL_CALL_MARKUP_PATTERNS = [
|
|
204
|
-
/<tool_call>[\s\S]*?<\/tool_call>/gi,
|
|
205
|
-
/<function=[\w.-]+>[\s\S]*?<\/function>/gi,
|
|
206
|
-
/<tool_call>\s*(?:<function=|[{[])[\s\S]*$/i,
|
|
207
|
-
/<function=[\w.-]+>[\s\S]*$/i
|
|
208
|
-
];
|
|
209
|
-
function stripDeadToolCallMarkup(text) {
|
|
210
|
-
let out = text;
|
|
211
|
-
for (const pattern of DEAD_TOOL_CALL_MARKUP_PATTERNS) {
|
|
212
|
-
out = out.replace(pattern, "");
|
|
213
|
-
}
|
|
214
|
-
return out === text ? text : out.trim();
|
|
215
|
-
}
|
|
216
|
-
function lockedSynthesisFallbackText() {
|
|
217
|
-
return "[Clio Coder] loop guard: tool calls were disabled for the rest of this turn, but the reply contained only tool-call markup, which cannot run and was removed. Ask me to continue with a different approach, or narrow the request.";
|
|
218
|
-
}
|
|
219
|
-
function sanitizeLockedSynthesisMessage(message) {
|
|
220
|
-
if (!message || typeof message !== "object" || message.role !== "assistant") return false;
|
|
221
|
-
const record = message;
|
|
222
|
-
const stopReason = record.stopReason;
|
|
223
|
-
if (stopReason !== void 0 && stopReason !== "stop" && stopReason !== "length") return false;
|
|
224
|
-
if (!Array.isArray(record.content)) return false;
|
|
225
|
-
const blocks = record.content;
|
|
226
|
-
if (blocks.some((block) => block?.type === "toolCall")) return false;
|
|
227
|
-
let changed = false;
|
|
228
|
-
for (const block of blocks) {
|
|
229
|
-
if (block?.type !== "text" || typeof block.text !== "string") continue;
|
|
230
|
-
const stripped = stripDeadToolCallMarkup(block.text);
|
|
231
|
-
if (stripped !== block.text) {
|
|
232
|
-
block.text = stripped;
|
|
233
|
-
changed = true;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
if (!changed) return false;
|
|
237
|
-
const remaining = blocks.filter((block) => block?.type === "text" && typeof block.text === "string").map((block) => block.text).join("").trim();
|
|
238
|
-
if (remaining.length === 0) {
|
|
239
|
-
const firstText = blocks.find(
|
|
240
|
-
(block) => block?.type === "text" && typeof block.text === "string"
|
|
241
|
-
);
|
|
242
|
-
if (firstText) firstText.text = lockedSynthesisFallbackText();
|
|
243
|
-
else blocks.push({ type: "text", text: lockedSynthesisFallbackText() });
|
|
244
|
-
}
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
247
|
-
function isLoopGuardSynthesisBackstopReason(reason) {
|
|
248
|
-
return /^loop guard: tool calls stayed disabled and .+ was called again instead of answering/.test(reason);
|
|
249
|
-
}
|
|
250
|
-
function readOrchTurnToolCallBudget(env = process.env) {
|
|
251
|
-
const soft = resolveGuardrail("turnToolCallBudget", env);
|
|
252
|
-
return { soft, hard: soft + ORCH_TURN_TOOL_CALL_HARD_MARGIN };
|
|
253
|
-
}
|
|
254
|
-
function createLoopGuardRegistration(options) {
|
|
255
|
-
const budget = options.turnBlockBudget ?? INTERACTIVE_LOOP_BLOCK_BUDGET;
|
|
256
|
-
const cap = options.toolCallCap;
|
|
257
|
-
const softLimit = options.toolCallSoftLimit !== void 0 && Number.isSafeInteger(options.toolCallSoftLimit) && options.toolCallSoftLimit > 0 && (cap === void 0 || options.toolCallSoftLimit <= cap) ? options.toolCallSoftLimit : void 0;
|
|
258
|
-
const turnBudget = options.turnToolCallBudget;
|
|
259
|
-
const synthesisLockout = options.turnSynthesisLockout === true;
|
|
260
|
-
const softReadReserve = options.toolCallSoftReadReserve ?? 0;
|
|
261
|
-
const softReadReserveThreshold = softLimit !== void 0 && softReadReserve > 0 && softLimit > softReadReserve ? softLimit - softReadReserve : null;
|
|
262
|
-
const deliveryTools = [...new Set(options.deliveryTools ?? [])];
|
|
263
|
-
const reserveAdmits = (tool) => isReserveAdmittedTool(tool, deliveryTools);
|
|
264
|
-
let softAdmittedCount = 0;
|
|
265
|
-
let softReadReserveEntered = false;
|
|
266
|
-
let reserveDenials = { denials: 0 };
|
|
267
|
-
let deniedAttempts = 0;
|
|
268
|
-
const denialBudget = cap === void 0 ? void 0 : Math.max(cap, WIDE_BATCH_DENIAL_FLOOR);
|
|
269
|
-
const boundRunDenials = (effects, input) => {
|
|
270
|
-
if (denialBudget === void 0 || !effects.some((effect) => effect.kind === "block_tool")) return effects;
|
|
271
|
-
deniedAttempts += 1;
|
|
272
|
-
if (deniedAttempts <= denialBudget) return effects;
|
|
273
|
-
return [{ kind: "block_tool", reason: synthesisBackstopReason(input.toolName ?? "unknown"), severity: "hard-block" }];
|
|
274
|
-
};
|
|
275
|
-
const reserve = options.toolCallReserve ?? 0;
|
|
276
|
-
const reserveThreshold = cap !== void 0 && reserve > 0 && cap > reserve ? cap - reserve : null;
|
|
277
|
-
let reserveDirectiveEmitted = false;
|
|
278
|
-
const blocksByTurn = /* @__PURE__ */ new Map();
|
|
279
|
-
const callsByTurn = /* @__PURE__ */ new Map();
|
|
280
|
-
const lockoutByTurn = /* @__PURE__ */ new Map();
|
|
281
|
-
let capLockout = null;
|
|
282
|
-
let softLockout = null;
|
|
283
|
-
const succeededFingerprints = /* @__PURE__ */ new Map();
|
|
284
|
-
const stagnationByTurn = /* @__PURE__ */ new Map();
|
|
285
|
-
const crossArgumentResultsByTurn = /* @__PURE__ */ new Map();
|
|
286
|
-
let count = 0;
|
|
287
|
-
const enterSoftReadReserve = () => {
|
|
288
|
-
if (softReadReserveEntered) return;
|
|
289
|
-
softReadReserveEntered = true;
|
|
290
|
-
options.onSoftReadReserve?.();
|
|
291
|
-
};
|
|
292
|
-
const bumpBoundedCounter = (store, key, limit = LOOP_GUARD_TURN_LIMIT) => {
|
|
293
|
-
if (!store.has(key)) {
|
|
294
|
-
while (store.size >= limit) {
|
|
295
|
-
const oldest = store.keys().next().value;
|
|
296
|
-
if (typeof oldest !== "string") break;
|
|
297
|
-
store.delete(oldest);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
const next = (store.get(key) ?? 0) + 1;
|
|
301
|
-
store.set(key, next);
|
|
302
|
-
return next;
|
|
303
|
-
};
|
|
304
|
-
const resultCarriesEvidence = (details) => {
|
|
305
|
-
const observation = details?.observation;
|
|
306
|
-
if (observation === null || typeof observation !== "object" || Array.isArray(observation)) return true;
|
|
307
|
-
const record = observation;
|
|
308
|
-
return !(record.truncated === true && record.shownCount === 0);
|
|
309
|
-
};
|
|
310
|
-
const recordSuccessfulResult = (input) => {
|
|
311
|
-
if (input.metadata?.resultKind !== "ok") return;
|
|
312
|
-
if (!resultCarriesEvidence(input.toolResultDetails)) return;
|
|
313
|
-
const tool = input.toolName;
|
|
314
|
-
if (typeof tool !== "string" || tool.length === 0) return;
|
|
315
|
-
bumpBoundedCounter(succeededFingerprints, hashToolCall(tool, input.toolArgs ?? {}), SUCCEEDED_FINGERPRINT_LIMIT);
|
|
316
|
-
};
|
|
317
|
-
const recordResultForStagnation = (input) => {
|
|
318
|
-
const turnKey = input.turnId ?? NO_TURN_BUCKET;
|
|
319
|
-
const tool = input.toolName;
|
|
320
|
-
const resultFingerprint = input.metadata?.resultFingerprint;
|
|
321
|
-
if (typeof tool !== "string" || tool.length === 0 || input.metadata?.resultKind !== "ok" || typeof resultFingerprint !== "string") {
|
|
322
|
-
stagnationByTurn.delete(turnKey);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
const reducedFingerprint = stagnationFingerprint(tool, input.toolArgs);
|
|
326
|
-
const previous = stagnationByTurn.get(turnKey);
|
|
327
|
-
if (previous !== void 0 && previous.reducedFingerprint === reducedFingerprint && previous.resultFingerprint === resultFingerprint) {
|
|
328
|
-
previous.streak += 1;
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
if (!stagnationByTurn.has(turnKey)) {
|
|
332
|
-
while (stagnationByTurn.size >= LOOP_GUARD_TURN_LIMIT) {
|
|
333
|
-
const oldest = stagnationByTurn.keys().next().value;
|
|
334
|
-
if (typeof oldest !== "string") break;
|
|
335
|
-
stagnationByTurn.delete(oldest);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
stagnationByTurn.set(turnKey, { reducedFingerprint, resultFingerprint, streak: 1 });
|
|
339
|
-
};
|
|
340
|
-
const crossArgumentResultEffects = (input) => {
|
|
341
|
-
const turnKey = input.turnId ?? NO_TURN_BUCKET;
|
|
342
|
-
const tool = input.toolName;
|
|
343
|
-
const resultFingerprint = input.metadata?.resultFingerprint;
|
|
344
|
-
const resultBytes = input.metadata?.resultBytes;
|
|
345
|
-
if (typeof tool !== "string" || tool.length === 0 || input.metadata?.actionClass !== "read" || input.metadata?.resultKind !== "ok" || typeof resultFingerprint !== "string" || typeof resultBytes !== "number" || resultBytes < CROSS_ARGUMENT_RESULT_MIN_BYTES || !resultCarriesEvidence(input.toolResultDetails)) {
|
|
346
|
-
crossArgumentResultsByTurn.delete(turnKey);
|
|
347
|
-
return [];
|
|
348
|
-
}
|
|
349
|
-
const argumentFingerprint = stagnationFingerprint(tool, input.toolArgs);
|
|
350
|
-
const previous = crossArgumentResultsByTurn.get(turnKey);
|
|
351
|
-
if (previous?.tool === tool && previous.resultFingerprint === resultFingerprint) {
|
|
352
|
-
if (previous.warned) return [];
|
|
353
|
-
previous.argumentFingerprints.add(argumentFingerprint);
|
|
354
|
-
if (previous.argumentFingerprints.size >= RESULT_STAGNATION_THRESHOLD) {
|
|
355
|
-
previous.warned = true;
|
|
356
|
-
return [
|
|
357
|
-
{
|
|
358
|
-
kind: "annotate_tool_result",
|
|
359
|
-
message: crossArgumentResultMessage(tool, previous.argumentFingerprints.size),
|
|
360
|
-
severity: "warn"
|
|
361
|
-
}
|
|
362
|
-
];
|
|
363
|
-
}
|
|
364
|
-
return [];
|
|
365
|
-
}
|
|
366
|
-
if (!crossArgumentResultsByTurn.has(turnKey)) {
|
|
367
|
-
while (crossArgumentResultsByTurn.size >= LOOP_GUARD_TURN_LIMIT) {
|
|
368
|
-
const oldest = crossArgumentResultsByTurn.keys().next().value;
|
|
369
|
-
if (typeof oldest !== "string") break;
|
|
370
|
-
crossArgumentResultsByTurn.delete(oldest);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
crossArgumentResultsByTurn.set(turnKey, {
|
|
374
|
-
tool,
|
|
375
|
-
resultFingerprint,
|
|
376
|
-
argumentFingerprints: /* @__PURE__ */ new Set([argumentFingerprint]),
|
|
377
|
-
warned: false
|
|
378
|
-
});
|
|
379
|
-
return [];
|
|
380
|
-
};
|
|
381
|
-
const bumpTurnBlocks = (turnId) => bumpBoundedCounter(blocksByTurn, turnId);
|
|
382
|
-
const enterLockout = (input, turnKey, state) => {
|
|
383
|
-
if (!lockoutByTurn.has(turnKey)) {
|
|
384
|
-
while (lockoutByTurn.size >= LOOP_GUARD_TURN_LIMIT) {
|
|
385
|
-
const oldest = lockoutByTurn.keys().next().value;
|
|
386
|
-
if (typeof oldest !== "string") break;
|
|
387
|
-
lockoutByTurn.delete(oldest);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
lockoutByTurn.set(turnKey, {
|
|
391
|
-
...state,
|
|
392
|
-
denials: 0,
|
|
393
|
-
...input.correlationId !== void 0 ? { correlationId: input.correlationId } : {}
|
|
394
|
-
});
|
|
395
|
-
};
|
|
396
|
-
const reachesLockoutBackstop = (state, input) => {
|
|
397
|
-
if (input.correlationId !== void 0 && state.correlationId === input.correlationId) return false;
|
|
398
|
-
state.denials += 1;
|
|
399
|
-
if (input.correlationId !== void 0) state.correlationId = input.correlationId;
|
|
400
|
-
else delete state.correlationId;
|
|
401
|
-
return state.denials > LOOP_SYNTHESIS_BACKSTOP_DENIALS;
|
|
402
|
-
};
|
|
403
|
-
const emitLoopBlocked = (input, info, at) => {
|
|
404
|
-
const payload = {
|
|
405
|
-
tool: info.tool,
|
|
406
|
-
repeatCount: info.repeatCount,
|
|
407
|
-
blocksThisTurn: info.blocksThisTurn,
|
|
408
|
-
budget,
|
|
409
|
-
interrupted: info.disposition === "stop",
|
|
410
|
-
disposition: info.disposition,
|
|
411
|
-
at,
|
|
412
|
-
...input.turnId !== void 0 ? { turnId: input.turnId } : {}
|
|
413
|
-
};
|
|
414
|
-
options.bus?.emit(BusChannels.LoopBlocked, payload);
|
|
415
|
-
};
|
|
416
|
-
const emitBudgetEvent = (input, callsThisTurn, interrupted, at) => {
|
|
417
|
-
if (turnBudget === void 0) return;
|
|
418
|
-
const payload = {
|
|
419
|
-
tool: input.toolName ?? "unknown",
|
|
420
|
-
callsThisTurn,
|
|
421
|
-
softBudget: turnBudget.soft,
|
|
422
|
-
hardCeiling: turnBudget.hard,
|
|
423
|
-
interrupted,
|
|
424
|
-
at,
|
|
425
|
-
...input.turnId !== void 0 ? { turnId: input.turnId } : {}
|
|
426
|
-
};
|
|
427
|
-
options.bus?.emit(BusChannels.ToolBudgetExceeded, payload);
|
|
428
|
-
};
|
|
429
|
-
const evaluateTurnBudget = (input, now) => {
|
|
430
|
-
if (turnBudget === void 0) return null;
|
|
431
|
-
const turnKey = input.turnId ?? NO_TURN_BUCKET;
|
|
432
|
-
const callsThisTurn = bumpBoundedCounter(callsByTurn, turnKey);
|
|
433
|
-
if (callsThisTurn >= turnBudget.hard) {
|
|
434
|
-
if (callsThisTurn === turnBudget.hard) emitBudgetEvent(input, callsThisTurn, true, now);
|
|
435
|
-
return [
|
|
436
|
-
{
|
|
437
|
-
kind: "block_tool",
|
|
438
|
-
reason: `tool-call budget exhausted: ${callsThisTurn} tool calls in this turn reached the hard ceiling (${turnBudget.hard}); the turn is being stopped. Summarize what you found and wait for the operator.`,
|
|
439
|
-
severity: "hard-block"
|
|
440
|
-
}
|
|
441
|
-
];
|
|
442
|
-
}
|
|
443
|
-
if (callsThisTurn >= turnBudget.soft) {
|
|
444
|
-
if (callsThisTurn === turnBudget.soft) emitBudgetEvent(input, callsThisTurn, false, now);
|
|
445
|
-
return [
|
|
446
|
-
{
|
|
447
|
-
kind: "block_tool",
|
|
448
|
-
reason: `tool-call budget: you have made ${callsThisTurn} tool calls in this turn (soft budget ${turnBudget.soft}). Every further tool call this turn will be blocked, so do not retry this call and do not substitute another one. Summarize what you have found so far in plain text, state the single next step you propose, and wait for the operator.`,
|
|
449
|
-
severity: "hard-block"
|
|
450
|
-
}
|
|
451
|
-
];
|
|
452
|
-
}
|
|
453
|
-
return null;
|
|
454
|
-
};
|
|
455
|
-
const blockAsLoop = (input, turnKey, tool, repeatCount, baseReason, now) => {
|
|
456
|
-
const blocksThisTurn = bumpTurnBlocks(turnKey);
|
|
457
|
-
const reachedBudget = blocksThisTurn >= budget;
|
|
458
|
-
if (synthesisLockout && reachedBudget) {
|
|
459
|
-
enterLockout(input, turnKey, { tool, repeatCount, blocksThisTurn });
|
|
460
|
-
options.onSynthesisLockout?.();
|
|
461
|
-
emitLoopBlocked(input, { tool, repeatCount, blocksThisTurn, disposition: "lockout" }, now);
|
|
462
|
-
return [{ kind: "block_tool", reason: synthesisLockoutDirective(), severity: "hard-block" }];
|
|
463
|
-
}
|
|
464
|
-
emitLoopBlocked(input, { tool, repeatCount, blocksThisTurn, disposition: reachedBudget ? "stop" : "block" }, now);
|
|
465
|
-
const reason = reachedBudget ? `${baseReason} Loop budget exhausted (${blocksThisTurn} blocks this turn); the agent is being stopped.` : baseReason;
|
|
466
|
-
return [{ kind: "block_tool", reason, severity: "hard-block" }];
|
|
467
|
-
};
|
|
468
|
-
return {
|
|
469
|
-
id: LOOP_GUARD_REGISTRATION_ID,
|
|
470
|
-
description: "blocks repeated tool calls, enforces tool-call caps, and annotates substantial identical read results across distinct arguments",
|
|
471
|
-
hooks: ["before_tool", "after_tool"],
|
|
472
|
-
callCount: () => count,
|
|
473
|
-
evaluate(input) {
|
|
474
|
-
if (input.hook === "after_tool") {
|
|
475
|
-
recordSuccessfulResult(input);
|
|
476
|
-
recordResultForStagnation(input);
|
|
477
|
-
const effects = [...crossArgumentResultEffects(input)];
|
|
478
|
-
if (softReadReserveEntered && softLockout === null && deliveryTools.length === 0 && input.toolName === ToolNames.Read) {
|
|
479
|
-
effects.push({ kind: "require_tool", toolName: ToolNames.Read });
|
|
480
|
-
}
|
|
481
|
-
if (reserveThreshold !== null && cap !== void 0 && !reserveDirectiveEmitted && count > reserveThreshold && count <= cap) {
|
|
482
|
-
reserveDirectiveEmitted = true;
|
|
483
|
-
effects.push({
|
|
484
|
-
kind: "annotate_tool_result",
|
|
485
|
-
message: workerSynthesisReserveDirective(Math.max(0, cap - count), cap),
|
|
486
|
-
severity: "warn"
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
return effects;
|
|
490
|
-
}
|
|
491
|
-
const now = options.now?.() ?? Date.now();
|
|
492
|
-
const turnKey = input.turnId ?? NO_TURN_BUCKET;
|
|
493
|
-
const decide = () => {
|
|
494
|
-
if (capLockout !== null && cap !== void 0) {
|
|
495
|
-
if (reachesLockoutBackstop(capLockout, input)) {
|
|
496
|
-
return [
|
|
497
|
-
{ kind: "block_tool", reason: synthesisBackstopReason(input.toolName ?? "unknown"), severity: "hard-block" }
|
|
498
|
-
];
|
|
499
|
-
}
|
|
500
|
-
return [{ kind: "block_tool", reason: workerToolCallCapSynthesisReason(cap), severity: "hard-block" }];
|
|
501
|
-
}
|
|
502
|
-
if (softLockout !== null && softLimit !== void 0) {
|
|
503
|
-
if (reachesLockoutBackstop(softLockout, input)) {
|
|
504
|
-
return [
|
|
505
|
-
{ kind: "block_tool", reason: synthesisBackstopReason(input.toolName ?? "unknown"), severity: "hard-block" }
|
|
506
|
-
];
|
|
507
|
-
}
|
|
508
|
-
return [{ kind: "block_tool", reason: workerExplorationSynthesisDirective(softLimit), severity: "hard-block" }];
|
|
509
|
-
}
|
|
510
|
-
const lockout = synthesisLockout ? lockoutByTurn.get(turnKey) : void 0;
|
|
511
|
-
if (lockout !== void 0) {
|
|
512
|
-
if (reachesLockoutBackstop(lockout, input)) {
|
|
513
|
-
emitLoopBlocked(
|
|
514
|
-
input,
|
|
515
|
-
{
|
|
516
|
-
tool: lockout.tool,
|
|
517
|
-
repeatCount: lockout.repeatCount,
|
|
518
|
-
blocksThisTurn: lockout.blocksThisTurn,
|
|
519
|
-
disposition: "stop"
|
|
520
|
-
},
|
|
521
|
-
now
|
|
522
|
-
);
|
|
523
|
-
return [{ kind: "block_tool", reason: synthesisBackstopReason(lockout.tool), severity: "hard-block" }];
|
|
524
|
-
}
|
|
525
|
-
return [{ kind: "block_tool", reason: synthesisLockoutDirective(), severity: "hard-block" }];
|
|
526
|
-
}
|
|
527
|
-
if (softLimit !== void 0) {
|
|
528
|
-
const spentSoftLimit = softAdmittedCount >= softLimit;
|
|
529
|
-
if (spentSoftLimit && deliveryTools.length === 0) {
|
|
530
|
-
softLockout = {
|
|
531
|
-
denials: 0,
|
|
532
|
-
...input.correlationId !== void 0 ? { correlationId: input.correlationId } : {}
|
|
533
|
-
};
|
|
534
|
-
options.onSynthesisLockout?.();
|
|
535
|
-
return [{ kind: "block_tool", reason: workerExplorationSynthesisDirective(softLimit), severity: "hard-block" }];
|
|
536
|
-
}
|
|
537
|
-
const inReserve = softReadReserveThreshold !== null && softAdmittedCount >= softReadReserveThreshold;
|
|
538
|
-
if (spentSoftLimit || inReserve) {
|
|
539
|
-
enterSoftReadReserve();
|
|
540
|
-
if (!reserveAdmits(input.toolName)) {
|
|
541
|
-
if (reachesLockoutBackstop(reserveDenials, input)) {
|
|
542
|
-
softLockout = {
|
|
543
|
-
denials: 0,
|
|
544
|
-
...input.correlationId !== void 0 ? { correlationId: input.correlationId } : {}
|
|
545
|
-
};
|
|
546
|
-
options.onSynthesisLockout?.();
|
|
547
|
-
return [{ kind: "block_tool", reason: workerExplorationSynthesisDirective(softLimit), severity: "hard-block" }];
|
|
548
|
-
}
|
|
549
|
-
return [
|
|
550
|
-
{
|
|
551
|
-
kind: "block_tool",
|
|
552
|
-
reason: spentSoftLimit ? workerDeliveryOnlyDirective(softLimit, deliveryTools) : workerLiveReadReserveDirective(softLimit - softAdmittedCount, deliveryTools),
|
|
553
|
-
severity: "hard-block"
|
|
554
|
-
}
|
|
555
|
-
];
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
if (reserveThreshold !== null && cap !== void 0 && count >= reserveThreshold && !reserveAdmits(input.toolName)) {
|
|
560
|
-
if (reachesLockoutBackstop(reserveDenials, input)) {
|
|
561
|
-
if (synthesisLockout) {
|
|
562
|
-
capLockout = {
|
|
563
|
-
denials: 0,
|
|
564
|
-
...input.correlationId !== void 0 ? { correlationId: input.correlationId } : {}
|
|
565
|
-
};
|
|
566
|
-
options.onSynthesisLockout?.();
|
|
567
|
-
}
|
|
568
|
-
return [{ kind: "block_tool", reason: workerToolCallCapSynthesisReason(cap), severity: "hard-block" }];
|
|
569
|
-
}
|
|
570
|
-
return [
|
|
571
|
-
{
|
|
572
|
-
kind: "block_tool",
|
|
573
|
-
reason: workerSynthesisReserveBlockReason(input.toolName ?? "unknown", Math.max(1, cap - count), cap),
|
|
574
|
-
severity: "hard-block"
|
|
575
|
-
}
|
|
576
|
-
];
|
|
577
|
-
}
|
|
578
|
-
count += 1;
|
|
579
|
-
reserveDenials = { denials: 0 };
|
|
580
|
-
if (softLimit !== void 0) {
|
|
581
|
-
softAdmittedCount += 1;
|
|
582
|
-
if (softReadReserveThreshold !== null && softAdmittedCount >= softReadReserveThreshold) enterSoftReadReserve();
|
|
583
|
-
if (softAdmittedCount >= softLimit) {
|
|
584
|
-
if (deliveryTools.length === 0) {
|
|
585
|
-
softLockout = {
|
|
586
|
-
denials: 0,
|
|
587
|
-
...input.correlationId !== void 0 ? { correlationId: input.correlationId } : {}
|
|
588
|
-
};
|
|
589
|
-
options.onSynthesisLockout?.();
|
|
590
|
-
}
|
|
591
|
-
options.onSoftLimitFinalCallAdmitted?.(input.toolCallId);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
if (cap !== void 0 && count > cap) {
|
|
595
|
-
if (!synthesisLockout) {
|
|
596
|
-
return [{ kind: "block_tool", reason: workerToolCallCapExceededReason(cap), severity: "hard-block" }];
|
|
597
|
-
}
|
|
598
|
-
capLockout = {
|
|
599
|
-
denials: 0,
|
|
600
|
-
...input.correlationId !== void 0 ? { correlationId: input.correlationId } : {}
|
|
601
|
-
};
|
|
602
|
-
options.onSynthesisLockout?.();
|
|
603
|
-
return [{ kind: "block_tool", reason: workerToolCallCapSynthesisReason(cap), severity: "hard-block" }];
|
|
604
|
-
}
|
|
605
|
-
const fingerprint = input.metadata?.callFingerprint;
|
|
606
|
-
if (typeof fingerprint !== "string" || fingerprint.length === 0) {
|
|
607
|
-
return evaluateTurnBudget(input, now) ?? [];
|
|
608
|
-
}
|
|
609
|
-
const verdict = options.safety.observeLoop(`${turnKey}|${fingerprint}`, now);
|
|
610
|
-
if (verdict.looping) {
|
|
611
|
-
const tool = input.toolName ?? "unknown";
|
|
612
|
-
const priorSuccesses = succeededFingerprints.get(fingerprint) ?? 0;
|
|
613
|
-
return blockAsLoop(
|
|
614
|
-
input,
|
|
615
|
-
turnKey,
|
|
616
|
-
tool,
|
|
617
|
-
verdict.count,
|
|
618
|
-
loopBlockBaseReason(tool, verdict.count, priorSuccesses),
|
|
619
|
-
now
|
|
620
|
-
);
|
|
621
|
-
}
|
|
622
|
-
const toolName = input.toolName;
|
|
623
|
-
if (typeof toolName === "string" && toolName.length > 0) {
|
|
624
|
-
const entry = stagnationByTurn.get(turnKey);
|
|
625
|
-
if (entry !== void 0 && entry.streak >= RESULT_STAGNATION_THRESHOLD - 1 && entry.reducedFingerprint === stagnationFingerprint(toolName, input.toolArgs)) {
|
|
626
|
-
return blockAsLoop(
|
|
627
|
-
input,
|
|
628
|
-
turnKey,
|
|
629
|
-
toolName,
|
|
630
|
-
entry.streak + 1,
|
|
631
|
-
stagnationBlockReason(toolName, entry.streak),
|
|
632
|
-
now
|
|
633
|
-
);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
return evaluateTurnBudget(input, now) ?? [];
|
|
637
|
-
};
|
|
638
|
-
return boundRunDenials(decide(), input);
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
function isReserveAdmittedTool(tool, deliveryTools) {
|
|
643
|
-
return tool === ToolNames.Read || tool !== void 0 && deliveryTools.includes(tool);
|
|
644
|
-
}
|
|
645
|
-
function resolveDeliveryTools(allowedTools, product) {
|
|
646
|
-
const candidates = product === "orientation" ? [ToolNames.Write, ToolNames.Edit, ToolNames.CodeNav] : [ToolNames.Write, ToolNames.Edit];
|
|
647
|
-
if (allowedTools instanceof Set) {
|
|
648
|
-
return candidates.filter((tool) => allowedTools.has(tool));
|
|
649
|
-
}
|
|
650
|
-
return candidates.filter((tool) => allowedTools.includes(tool));
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// src/engine/agent.ts
|
|
654
|
-
init_esm_shims();
|
|
655
|
-
import { Agent } from "@earendil-works/pi-agent-core";
|
|
656
|
-
import { streamSimple } from "@earendil-works/pi-ai/compat";
|
|
657
|
-
function createEngineAgent(options = {}) {
|
|
658
|
-
const agent = new Agent({ streamFn: streamSimple, ...options });
|
|
659
|
-
return {
|
|
660
|
-
agent,
|
|
661
|
-
state: () => agent.state
|
|
662
|
-
};
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
// src/domains/safety/call-target.ts
|
|
666
|
-
init_esm_shims();
|
|
667
|
-
var ESC_CHAR = String.fromCharCode(27);
|
|
668
|
-
var BEL_CHAR = String.fromCharCode(7);
|
|
669
|
-
var OSC_PATTERN = new RegExp(`${ESC_CHAR}\\][\\s\\S]*?(?:${BEL_CHAR}|${ESC_CHAR}\\\\|$)`, "g");
|
|
670
|
-
var CSI_PATTERN = new RegExp(`${ESC_CHAR}\\[[0-9;?]*[0-9A-Za-z]`, "g");
|
|
671
|
-
function sanitizeForDisplay(value) {
|
|
672
|
-
const stripped = value.replace(OSC_PATTERN, "").replace(CSI_PATTERN, "");
|
|
673
|
-
let out = "";
|
|
674
|
-
for (const ch of stripped) {
|
|
675
|
-
const code = ch.codePointAt(0) ?? 0;
|
|
676
|
-
out += code < 32 || code === 127 ? " " : ch;
|
|
677
|
-
}
|
|
678
|
-
return out;
|
|
679
|
-
}
|
|
680
|
-
function oneLine(value) {
|
|
681
|
-
return value.replace(/\s+/g, " ").trim();
|
|
682
|
-
}
|
|
683
|
-
function sanitizeCallTargetText(value) {
|
|
684
|
-
return oneLine(sanitizeForDisplay(value));
|
|
685
|
-
}
|
|
686
|
-
function describeCallTarget(args) {
|
|
687
|
-
if (!args) return "";
|
|
688
|
-
const str = (value) => typeof value === "string" && value.trim().length > 0 ? oneLine(sanitizeForDisplay(value)).trim() || null : null;
|
|
689
|
-
const candidate = str(args.command) ?? str(args.path) ?? str(args.file_path) ?? str(args.name) ?? str(args.pattern);
|
|
690
|
-
if (candidate) return candidate;
|
|
691
|
-
try {
|
|
692
|
-
const json = JSON.stringify(args);
|
|
693
|
-
return json === "{}" || json === void 0 ? "" : oneLine(sanitizeForDisplay(json)).slice(0, 120);
|
|
694
|
-
} catch {
|
|
695
|
-
return "";
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
// src/engine/provider-payload.ts
|
|
700
|
-
init_esm_shims();
|
|
701
|
-
function reasoningSummaryForLevel(level) {
|
|
702
|
-
if (!level || level === "off") return void 0;
|
|
703
|
-
if (level === "minimal" || level === "low") return "concise";
|
|
704
|
-
return "detailed";
|
|
705
|
-
}
|
|
706
|
-
function isOpenAIResponsesApi(api) {
|
|
707
|
-
return api === "openai-codex-responses" || api === "openai-responses" || api === "azure-openai-responses";
|
|
708
|
-
}
|
|
709
|
-
function isRecord(value) {
|
|
710
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
711
|
-
}
|
|
712
|
-
function namedToolDefinitions(tools, toolName) {
|
|
713
|
-
if (!Array.isArray(tools)) return null;
|
|
714
|
-
const narrowed = [];
|
|
715
|
-
for (const tool of tools) {
|
|
716
|
-
if (!isRecord(tool)) continue;
|
|
717
|
-
const directName = typeof tool.name === "string" ? tool.name : void 0;
|
|
718
|
-
const functionName = isRecord(tool.function) && typeof tool.function.name === "string" ? tool.function.name : void 0;
|
|
719
|
-
const toolSpecName = isRecord(tool.toolSpec) && typeof tool.toolSpec.name === "string" ? tool.toolSpec.name : void 0;
|
|
720
|
-
if (directName === toolName || functionName === toolName || toolSpecName === toolName) {
|
|
721
|
-
narrowed.push(tool);
|
|
722
|
-
continue;
|
|
723
|
-
}
|
|
724
|
-
if (Array.isArray(tool.functionDeclarations)) {
|
|
725
|
-
const declarations = tool.functionDeclarations.filter(
|
|
726
|
-
(declaration) => isRecord(declaration) && declaration.name === toolName
|
|
727
|
-
);
|
|
728
|
-
if (declarations.length > 0) narrowed.push({ ...tool, functionDeclarations: declarations });
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
return narrowed.length > 0 ? narrowed : null;
|
|
732
|
-
}
|
|
733
|
-
function numberValue(value) {
|
|
734
|
-
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
735
|
-
}
|
|
736
|
-
function patchOpenAIReasoningSummaryPayload(payload, model, thinkingLevel) {
|
|
737
|
-
if (!isOpenAIResponsesApi(model.api)) return void 0;
|
|
738
|
-
const summary = reasoningSummaryForLevel(thinkingLevel);
|
|
739
|
-
if (!summary || !isRecord(payload)) return void 0;
|
|
740
|
-
const record = payload;
|
|
741
|
-
const reasoning = record.reasoning;
|
|
742
|
-
if (!isRecord(reasoning)) return void 0;
|
|
743
|
-
return {
|
|
744
|
-
...record,
|
|
745
|
-
reasoning: {
|
|
746
|
-
...reasoning,
|
|
747
|
-
summary
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
}
|
|
751
|
-
function isAnthropicMessagesApi(api) {
|
|
752
|
-
return api === "anthropic-messages";
|
|
753
|
-
}
|
|
754
|
-
function anthropicThinkingLevelMap(model) {
|
|
755
|
-
return model.thinkingLevelMap;
|
|
756
|
-
}
|
|
757
|
-
function anthropicUsesAdaptiveThinking(model) {
|
|
758
|
-
const compat = model.compat;
|
|
759
|
-
return compat?.forceAdaptiveThinking === true;
|
|
760
|
-
}
|
|
761
|
-
function patchAnthropicThinkingPayload(payload, model, thinkingLevel) {
|
|
762
|
-
if (!isAnthropicMessagesApi(model.api) || model.reasoning !== true) return void 0;
|
|
763
|
-
if (!thinkingLevel || thinkingLevel === "off" || !isRecord(payload)) return void 0;
|
|
764
|
-
const record = payload;
|
|
765
|
-
const existingThinking = isRecord(record.thinking) ? record.thinking : {};
|
|
766
|
-
const display = typeof existingThinking.display === "string" ? existingThinking.display : "summarized";
|
|
767
|
-
if (anthropicUsesAdaptiveThinking(model)) {
|
|
768
|
-
const effort = defaultAnthropicEffortForLevel(thinkingLevel, anthropicThinkingLevelMap(model));
|
|
769
|
-
const existingOutputConfig = isRecord(record.output_config) ? record.output_config : {};
|
|
770
|
-
return {
|
|
771
|
-
...record,
|
|
772
|
-
thinking: { ...existingThinking, type: "adaptive", display },
|
|
773
|
-
...effort ? { output_config: { ...existingOutputConfig, effort } } : {}
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
const maxTokens = numberValue(record.max_tokens) ?? model.maxTokens;
|
|
777
|
-
const budgetTokens = defaultAnthropicBudgetForLevel(thinkingLevel, maxTokens);
|
|
778
|
-
if (budgetTokens === void 0) return void 0;
|
|
779
|
-
return {
|
|
780
|
-
...record,
|
|
781
|
-
thinking: { ...existingThinking, type: "enabled", budget_tokens: budgetTokens, display }
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
function patchProviderThinkingPayload(payload, model, thinkingLevel) {
|
|
785
|
-
return patchOpenAIReasoningSummaryPayload(payload, model, thinkingLevel) ?? patchAnthropicThinkingPayload(payload, model, thinkingLevel);
|
|
786
|
-
}
|
|
787
|
-
function patchToolChoiceNonePayload(payload, model) {
|
|
788
|
-
if (!isRecord(payload)) return void 0;
|
|
789
|
-
if (!("tools" in payload) || payload.tools === void 0 || payload.tools === null) return void 0;
|
|
790
|
-
if (isAnthropicMessagesApi(model.api)) return { ...payload, tool_choice: { type: "none" } };
|
|
791
|
-
return { ...payload, tool_choice: "none" };
|
|
792
|
-
}
|
|
793
|
-
function patchToolSurfaceLockedPayload(payload, model) {
|
|
794
|
-
if (!isRecord(payload)) return void 0;
|
|
795
|
-
if (!("tools" in payload) || payload.tools === void 0 || payload.tools === null) return void 0;
|
|
796
|
-
if (isAnthropicMessagesApi(model.api)) return patchToolChoiceNonePayload(payload, model);
|
|
797
|
-
const stripped = { ...payload };
|
|
798
|
-
delete stripped.tools;
|
|
799
|
-
delete stripped.tool_choice;
|
|
800
|
-
return stripped;
|
|
801
|
-
}
|
|
802
|
-
function patchToolChoiceNamedPayload(payload, model, toolName) {
|
|
803
|
-
if (!isRecord(payload) || toolName.trim().length === 0) return void 0;
|
|
804
|
-
if (isAnthropicMessagesApi(model.api)) {
|
|
805
|
-
const tools2 = namedToolDefinitions(payload.tools, toolName);
|
|
806
|
-
if (tools2 === null) return void 0;
|
|
807
|
-
const patched = { ...payload };
|
|
808
|
-
delete patched.thinking;
|
|
809
|
-
if (isRecord(patched.output_config) && "effort" in patched.output_config) {
|
|
810
|
-
const outputConfig = { ...patched.output_config };
|
|
811
|
-
delete outputConfig.effort;
|
|
812
|
-
if (Object.keys(outputConfig).length > 0) patched.output_config = outputConfig;
|
|
813
|
-
else delete patched.output_config;
|
|
814
|
-
}
|
|
815
|
-
return { ...patched, tools: tools2, tool_choice: { type: "tool", name: toolName } };
|
|
816
|
-
}
|
|
817
|
-
if (model.api === "google-generative-ai" || model.api === "google-vertex") {
|
|
818
|
-
if (!isRecord(payload.config) || payload.config.tools === void 0 || payload.config.tools === null)
|
|
819
|
-
return void 0;
|
|
820
|
-
const tools2 = namedToolDefinitions(payload.config.tools, toolName);
|
|
821
|
-
if (tools2 === null) return void 0;
|
|
822
|
-
const toolConfig = isRecord(payload.config.toolConfig) ? payload.config.toolConfig : {};
|
|
823
|
-
return {
|
|
824
|
-
...payload,
|
|
825
|
-
config: {
|
|
826
|
-
...payload.config,
|
|
827
|
-
tools: tools2,
|
|
828
|
-
toolConfig: {
|
|
829
|
-
...toolConfig,
|
|
830
|
-
functionCallingConfig: { mode: "ANY", allowedFunctionNames: [toolName] }
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
if (model.api === "bedrock-converse-stream") {
|
|
836
|
-
if (!isRecord(payload.toolConfig) || payload.toolConfig.tools === void 0 || payload.toolConfig.tools === null) {
|
|
837
|
-
return void 0;
|
|
838
|
-
}
|
|
839
|
-
const tools2 = namedToolDefinitions(payload.toolConfig.tools, toolName);
|
|
840
|
-
if (tools2 === null) return void 0;
|
|
841
|
-
return { ...payload, toolConfig: { ...payload.toolConfig, tools: tools2, toolChoice: { tool: { name: toolName } } } };
|
|
842
|
-
}
|
|
843
|
-
const tools = namedToolDefinitions(payload.tools, toolName);
|
|
844
|
-
if (tools === null) return void 0;
|
|
845
|
-
if (isOpenAIResponsesApi(model.api)) {
|
|
846
|
-
return { ...payload, tools, tool_choice: { type: "function", name: toolName } };
|
|
847
|
-
}
|
|
848
|
-
if (model.api === "mistral-conversations") {
|
|
849
|
-
return { ...payload, tools, toolChoice: { type: "function", function: { name: toolName } } };
|
|
850
|
-
}
|
|
851
|
-
return { ...payload, tools, tool_choice: { type: "function", function: { name: toolName } } };
|
|
852
|
-
}
|
|
853
|
-
function patchLlamaCppResponseSchemaPayload(payload, runtimeId, responseSchema) {
|
|
854
|
-
if (responseSchema === void 0) return void 0;
|
|
855
|
-
if (runtimeId !== RESPONSE_SCHEMA_RUNTIME_ID) {
|
|
856
|
-
throw new Error(`responseSchema requires the native llamacpp runtime; received '${runtimeId}'`);
|
|
857
|
-
}
|
|
858
|
-
if (!isRecord(payload)) throw new Error("cannot apply responseSchema to a non-object provider payload");
|
|
859
|
-
return {
|
|
860
|
-
...payload,
|
|
861
|
-
response_format: {
|
|
862
|
-
// llama-server accepts schema-constrained JSON through the widely
|
|
863
|
-
// compatible json_object form; some deployed gateways silently ignore
|
|
864
|
-
// the newer json_schema discriminator while still returning HTTP 200.
|
|
865
|
-
type: "json_object",
|
|
866
|
-
schema: responseSchema
|
|
867
|
-
}
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
function patchWorkerRequestPayload(payload, model, options) {
|
|
871
|
-
let patched = payload;
|
|
872
|
-
let changed = false;
|
|
873
|
-
const thinkingPatched = patchProviderThinkingPayload(patched, model, options.thinkingLevel);
|
|
874
|
-
if (thinkingPatched !== void 0) {
|
|
875
|
-
patched = thinkingPatched;
|
|
876
|
-
changed = true;
|
|
877
|
-
}
|
|
878
|
-
const schemaPatched = patchLlamaCppResponseSchemaPayload(patched, options.runtimeId, options.responseSchema);
|
|
879
|
-
if (schemaPatched !== void 0) {
|
|
880
|
-
patched = schemaPatched;
|
|
881
|
-
changed = true;
|
|
882
|
-
}
|
|
883
|
-
if (options.toolSurfaceLocked === true) {
|
|
884
|
-
const lockedPatched = patchToolSurfaceLockedPayload(patched, model);
|
|
885
|
-
if (lockedPatched !== void 0) {
|
|
886
|
-
patched = lockedPatched;
|
|
887
|
-
changed = true;
|
|
888
|
-
}
|
|
889
|
-
} else if (options.toolChoiceNone === true) {
|
|
890
|
-
const toolChoicePatched = patchToolChoiceNonePayload(patched, model);
|
|
891
|
-
if (toolChoicePatched !== void 0) {
|
|
892
|
-
patched = toolChoicePatched;
|
|
893
|
-
changed = true;
|
|
894
|
-
}
|
|
895
|
-
} else if (options.toolChoiceName !== void 0) {
|
|
896
|
-
const toolChoicePatched = patchToolChoiceNamedPayload(patched, model, options.toolChoiceName);
|
|
897
|
-
if (toolChoicePatched !== void 0) {
|
|
898
|
-
patched = toolChoicePatched;
|
|
899
|
-
changed = true;
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
return changed ? patched : void 0;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
export {
|
|
906
|
-
createProtectedArtifactsRegistration,
|
|
907
|
-
INTERACTIVE_LOOP_BLOCK_BUDGET,
|
|
908
|
-
workerLoopBlockBudget,
|
|
909
|
-
lockedSynthesisFallbackText,
|
|
910
|
-
sanitizeLockedSynthesisMessage,
|
|
911
|
-
isLoopGuardSynthesisBackstopReason,
|
|
912
|
-
readOrchTurnToolCallBudget,
|
|
913
|
-
createLoopGuardRegistration,
|
|
914
|
-
isReserveAdmittedTool,
|
|
915
|
-
resolveDeliveryTools,
|
|
916
|
-
createEngineAgent,
|
|
917
|
-
sanitizeCallTargetText,
|
|
918
|
-
describeCallTarget,
|
|
919
|
-
patchProviderThinkingPayload,
|
|
920
|
-
patchToolChoiceNonePayload,
|
|
921
|
-
patchToolChoiceNamedPayload,
|
|
922
|
-
patchWorkerRequestPayload
|
|
923
|
-
};
|
|
924
|
-
//# sourceMappingURL=chunk-DKGKUHFA.js.map
|