@iowarp/clio-coder 0.3.1 → 0.3.2
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 +90 -2
- package/CONTRIBUTING.md +23 -23
- package/README.md +284 -613
- package/dist/{acp-FPR54DGL.js → acp-BIYHVZIM.js} +43 -53
- package/dist/{agents-OGPIHPJH.js → agents-YT6SSRIT.js} +43 -26
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-IC3K6NIZ.js → auth-5TWEIYDN.js} +20 -12
- package/dist/{chunk-PV4JUBVJ.js → chunk-2EHAIA3X.js} +40 -21
- package/dist/{chunk-IS3ONKU3.js → chunk-2IR2NMPA.js} +6 -4
- package/dist/chunk-2SFS6XQE.js +122 -0
- package/dist/chunk-2VTFPG5O.js +48 -0
- package/dist/{chunk-MAR7Y6HW.js → chunk-3ZXDFGR5.js} +23 -16
- package/dist/chunk-4BJ5BYCE.js +61 -0
- package/dist/{chunk-474KN5II.js → chunk-4BPJXDWC.js} +111 -181
- package/dist/chunk-4KLWL3UC.js +18 -0
- package/dist/chunk-4VP4KH3K.js +962 -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-OLBBMFRD.js → chunk-5UUP6MWO.js} +24 -62
- package/dist/chunk-65DEGPJ6.js +52 -0
- package/dist/chunk-6EJMN2Y3.js +17 -0
- package/dist/chunk-6EJV5X2W.js +16405 -0
- package/dist/chunk-6N5PTWMY.js +136 -0
- package/dist/chunk-6XLNIQDB.js +27 -0
- package/dist/{chunk-TEKV33Q5.js → chunk-77VKQEHF.js} +65 -33
- package/dist/chunk-7CR24IG7.js +242 -0
- package/dist/{chunk-M5T5VO65.js → chunk-7EYHLWU7.js} +837 -635
- 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-AO4RKG4M.js +277 -0
- package/dist/{chunk-GB6QRBXN.js → chunk-APJ265NV.js} +54 -1187
- package/dist/chunk-ARBGF5F7.js +174 -0
- 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-ECH6PKUQ.js +39 -0
- package/dist/chunk-ED4KHGC3.js +143 -0
- package/dist/chunk-EKMEHE4H.js +340 -0
- package/dist/{chunk-RPTR2H26.js → chunk-EPVUXGXG.js} +21 -15
- package/dist/chunk-FCSXB6T2.js +338 -0
- package/dist/chunk-FJ3H4MN5.js +48 -0
- package/dist/chunk-FQ4SKYE4.js +29 -0
- package/dist/chunk-G2DE3C7R.js +644 -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-4QKXUHSR.js → chunk-IGLFWIYI.js} +70 -20
- package/dist/chunk-IKCO5N3L.js +162 -0
- package/dist/chunk-IR4CFBFN.js +56 -0
- package/dist/{chunk-PFEFKVGL.js → chunk-J5HN4RYU.js} +13 -11
- package/dist/{chunk-R5KLMSBV.js → chunk-J5Q24KAG.js} +2 -2
- package/dist/{chunk-K5XEMXTI.js → chunk-JVCV3ICN.js} +1 -1
- package/dist/chunk-KJ5LWLOE.js +1077 -0
- package/dist/chunk-LBMZMYH2.js +285 -0
- package/dist/{chunk-G34LV2PF.js → chunk-LBNRH5WM.js} +84 -170
- package/dist/{chunk-H6F6BYOH.js → chunk-LZSJBIVT.js} +7003 -7434
- package/dist/{chunk-HQQID6OA.js → chunk-M6SHUN7Q.js} +5 -5
- package/dist/chunk-MAW544W2.js +1882 -0
- package/dist/chunk-MBS4V7ZP.js +217 -0
- package/dist/{chunk-FST4FYJB.js → chunk-MFFY33HR.js} +99 -140
- package/dist/chunk-MNA4JGU4.js +255 -0
- package/dist/chunk-MQSRRFWA.js +3428 -0
- package/dist/{chunk-BSU2YIWB.js → chunk-MVVUPGPW.js} +131 -136
- package/dist/chunk-OAO4GE4M.js +619 -0
- package/dist/chunk-OHHN2SO4.js +5135 -0
- 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-POHLU5DW.js +1186 -0
- package/dist/chunk-QKMUKYO7.js +4961 -0
- package/dist/{chunk-ASND7OZK.js → chunk-QTYWRVRA.js} +13 -13
- package/dist/{chunk-EYOKLTMF.js → chunk-SRF2PJNW.js} +17 -3
- package/dist/chunk-SST6Z5JA.js +80 -0
- package/dist/chunk-STBPMHSX.js +2456 -0
- package/dist/chunk-T6YILFSB.js +80 -0
- package/dist/chunk-TZTZS7QK.js +227 -0
- package/dist/chunk-UOV2BYIW.js +107 -0
- package/dist/{chunk-Q3RUPKEJ.js → chunk-V4RXGQ5Q.js} +58 -189
- package/dist/chunk-VAKQQHWR.js +434 -0
- package/dist/chunk-VG7TBQIY.js +128 -0
- package/dist/chunk-VJWL6YS5.js +244 -0
- package/dist/chunk-WEH5XRJQ.js +32 -0
- package/dist/chunk-WMSVI4G2.js +2095 -0
- package/dist/chunk-WVO7V2QY.js +797 -0
- package/dist/chunk-X4RCMKVQ.js +641 -0
- package/dist/chunk-X75S7HFS.js +374 -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/cli/index.js +62 -54
- package/dist/clio-4LY5K2AC.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-GTLUW2PR.js} +92 -55
- package/dist/configure-R6A64DHX.js +42 -0
- package/dist/context-5VKGUVJJ.js +866 -0
- package/dist/{context-3KWFLHJG.js → context-JFZEJ7W5.js} +15 -13
- package/dist/{context-5RADCKTR.js → context-RW5HC47S.js} +71 -35
- package/dist/{context-clear-7TSNPAAI.js → context-clear-6ZHBAZZT.js} +54 -28
- package/dist/{context-index-W4RLWOQH.js → context-index-BZ4UYMTC.js} +30 -24
- package/dist/dispatch-runner-VKBRCWQC.js +1997 -0
- package/dist/{docs-5AWSPS37.js → docs-2C2LTVT2.js} +23 -10
- package/dist/{doctor-UC5NAJYQ.js → doctor-KI767GSN.js} +27 -17
- package/dist/{eval-U6TJHRLX.js → eval-XSSNATB4.js} +29 -16
- package/dist/{evidence-YEGUW4L3.js → evidence-UA6AWDQQ.js} +46 -26
- package/dist/{evolve-TXARCTPG.js → evolve-QNTFGV6Z.js} +45 -25
- package/dist/{extensions-OZFJ3A3G.js → extensions-QVDOHDGJ.js} +16 -7
- package/dist/{fleet-6G3DHNYE.js → fleet-Q7UOMUSG.js} +163 -54
- package/dist/{fleet-preflight-DSNT37JK.js → fleet-preflight-DDN536IT.js} +7 -4
- package/dist/{init-KZ5QTF6M.js → init-WBB65ZHQ.js} +69 -32
- package/dist/{memory-73ESV5YC.js → memory-MD3O64RI.js} +48 -27
- package/dist/{models-A4PVNWJK.js → models-BZU34YWD.js} +39 -25
- package/dist/monitor-MEQA5C3I.js +661 -0
- package/dist/{chunk-FCIH3BIZ.js → orchestrator-CGFKEP27.js} +11832 -8687
- 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-IV4Q6RLN.js} +101 -61
- package/dist/{share-YIFFV4NQ.js → share-S5BZQC5I.js} +15 -8
- package/dist/{skills-2V6RA3OQ.js → skills-LQEKRDTN.js} +34 -14
- package/dist/{skills-eval-S2TVJO4F.js → skills-eval-3DC4HEWS.js} +70 -34
- package/dist/steer-GGWFUJUD.js +77 -0
- package/dist/{targets-TYXLPB23.js → targets-C4SSGQOB.js} +43 -27
- package/dist/terminal-lease-IT5JW2NR.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-7TT7SQ3G.js} +45 -25
- package/dist/{usage-ZAFSXKKG.js → usage-GV4PKT3M.js} +62 -31
- package/dist/verify-G6V4D2G7.js +716 -0
- package/dist/web-fetch-2YHJ3KTG.js +638 -0
- package/dist/{wiki-generate-NUQCVOQ3.js → wiki-generate-DQF6Z66B.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 +362 -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 +42 -6
- 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 +173 -47
- package/src/interactive/chat-renderer.ts +262 -72
- 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 +228 -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 +20 -2
- package/src/interactive/footer-panel.ts +2 -2
- package/src/interactive/format-time.ts +14 -2
- package/src/interactive/interactive-application.ts +201 -17
- package/src/interactive/interactive-event-projection.ts +6 -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 +176 -114
- 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/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 +386 -133
- 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/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/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 +265 -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/registry.ts +39 -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
|
@@ -0,0 +1,1077 @@
|
|
|
1
|
+
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
canonicalJson,
|
|
4
|
+
sha256
|
|
5
|
+
} from "./chunk-6EJV5X2W.js";
|
|
6
|
+
import {
|
|
7
|
+
ToolNames
|
|
8
|
+
} from "./chunk-CGKSTWHD.js";
|
|
9
|
+
import {
|
|
10
|
+
ceilChars,
|
|
11
|
+
extractReasoningTokens
|
|
12
|
+
} from "./chunk-LZSJBIVT.js";
|
|
13
|
+
import {
|
|
14
|
+
settingsPath
|
|
15
|
+
} from "./chunk-A3CYT5EX.js";
|
|
16
|
+
import {
|
|
17
|
+
expandConfigPath
|
|
18
|
+
} from "./chunk-SST6Z5JA.js";
|
|
19
|
+
import {
|
|
20
|
+
isEngineContextOverflow
|
|
21
|
+
} from "./chunk-FCSXB6T2.js";
|
|
22
|
+
import {
|
|
23
|
+
init_esm_shims
|
|
24
|
+
} from "./chunk-3R73A4XB.js";
|
|
25
|
+
|
|
26
|
+
// src/cli/steer-channel.ts
|
|
27
|
+
init_esm_shims();
|
|
28
|
+
import * as fs from "node:fs";
|
|
29
|
+
import * as readline from "node:readline";
|
|
30
|
+
function setupSteerChannel(filePath, onLine) {
|
|
31
|
+
let closed = false;
|
|
32
|
+
let watcher = null;
|
|
33
|
+
let stream = null;
|
|
34
|
+
let rl = null;
|
|
35
|
+
try {
|
|
36
|
+
const stats = fs.statSync(filePath);
|
|
37
|
+
if (stats.isFIFO()) {
|
|
38
|
+
stream = fs.createReadStream(filePath);
|
|
39
|
+
rl = readline.createInterface({ input: stream, crlfDelay: Infinity });
|
|
40
|
+
rl.on("line", (line) => {
|
|
41
|
+
if (closed) return;
|
|
42
|
+
const trimmed = line.trim();
|
|
43
|
+
if (trimmed.length > 0) {
|
|
44
|
+
onLine(trimmed);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
let bytesRead = 0;
|
|
49
|
+
let leftover = "";
|
|
50
|
+
const readNewContent = () => {
|
|
51
|
+
if (closed) return;
|
|
52
|
+
try {
|
|
53
|
+
const currentStats = fs.statSync(filePath);
|
|
54
|
+
if (currentStats.size > bytesRead) {
|
|
55
|
+
let fd;
|
|
56
|
+
const buffer = Buffer.alloc(currentStats.size - bytesRead);
|
|
57
|
+
try {
|
|
58
|
+
fd = fs.openSync(filePath, "r");
|
|
59
|
+
fs.readSync(fd, buffer, 0, buffer.length, bytesRead);
|
|
60
|
+
} finally {
|
|
61
|
+
if (fd !== void 0) fs.closeSync(fd);
|
|
62
|
+
}
|
|
63
|
+
bytesRead = currentStats.size;
|
|
64
|
+
const text = `${leftover}${buffer.toString("utf-8")}`;
|
|
65
|
+
const lines = text.split(/\r?\n/);
|
|
66
|
+
leftover = lines.pop() ?? "";
|
|
67
|
+
for (const line of lines) {
|
|
68
|
+
if (closed) return;
|
|
69
|
+
const trimmed = line.trim();
|
|
70
|
+
if (trimmed.length > 0) {
|
|
71
|
+
onLine(trimmed);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch (_err) {
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
readNewContent();
|
|
79
|
+
watcher = fs.watch(filePath, (event) => {
|
|
80
|
+
if (event === "change") {
|
|
81
|
+
readNewContent();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
process.stderr.write(
|
|
87
|
+
`clio-coder run: failed to setup steer channel: ${err instanceof Error ? err.message : String(err)}
|
|
88
|
+
`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return () => {
|
|
92
|
+
closed = true;
|
|
93
|
+
if (watcher) {
|
|
94
|
+
watcher.close();
|
|
95
|
+
}
|
|
96
|
+
if (rl) {
|
|
97
|
+
rl.close();
|
|
98
|
+
}
|
|
99
|
+
if (stream) {
|
|
100
|
+
stream.destroy();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/cli/modes/json-stream.ts
|
|
106
|
+
init_esm_shims();
|
|
107
|
+
|
|
108
|
+
// src/interactive/chat-loop-messages.ts
|
|
109
|
+
init_esm_shims();
|
|
110
|
+
import { randomUUID } from "node:crypto";
|
|
111
|
+
|
|
112
|
+
// src/domains/providers/errors.ts
|
|
113
|
+
init_esm_shims();
|
|
114
|
+
var ContextOverflowError = class extends Error {
|
|
115
|
+
kind = "context-overflow";
|
|
116
|
+
original;
|
|
117
|
+
constructor(message, original) {
|
|
118
|
+
super(message);
|
|
119
|
+
this.name = "ContextOverflowError";
|
|
120
|
+
this.original = original;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
function isContextOverflowError(err) {
|
|
124
|
+
if (err instanceof ContextOverflowError) return true;
|
|
125
|
+
if (!err || typeof err !== "object") return false;
|
|
126
|
+
return err.kind === "context-overflow";
|
|
127
|
+
}
|
|
128
|
+
function toContextOverflowError(err) {
|
|
129
|
+
if (isContextOverflowError(err))
|
|
130
|
+
return err instanceof ContextOverflowError ? err : new ContextOverflowError(
|
|
131
|
+
typeof err.message === "string" ? err.message : "context overflow",
|
|
132
|
+
err
|
|
133
|
+
);
|
|
134
|
+
const message = extractMessage(err);
|
|
135
|
+
if (!message) return null;
|
|
136
|
+
if (isEngineContextOverflow(message)) return new ContextOverflowError(message, err);
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
function extractMessage(err) {
|
|
140
|
+
if (typeof err === "string") return err;
|
|
141
|
+
if (err instanceof Error) return err.message;
|
|
142
|
+
if (err && typeof err === "object") {
|
|
143
|
+
const m = err.message;
|
|
144
|
+
if (typeof m === "string") return m;
|
|
145
|
+
}
|
|
146
|
+
return "";
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// src/interactive/chat-loop-messages.ts
|
|
150
|
+
function notConfiguredNotice() {
|
|
151
|
+
return [
|
|
152
|
+
"[Clio Coder] orchestrator not configured. Set one up with:",
|
|
153
|
+
" clio-coder configure --id <id> --runtime <runtime> --url <url> --model <model> --set-orchestrator",
|
|
154
|
+
"or, when targets already exist: clio-coder targets use <id> --model <model>",
|
|
155
|
+
`(orchestrator.target + orchestrator.model live in ${settingsPath()})`
|
|
156
|
+
].join("\n");
|
|
157
|
+
}
|
|
158
|
+
function extractText(message) {
|
|
159
|
+
if (!message || typeof message !== "object" || message === null || !("role" in message) || message.role !== "assistant") {
|
|
160
|
+
return "";
|
|
161
|
+
}
|
|
162
|
+
const content = "content" in message && Array.isArray(message.content) ? message.content : [];
|
|
163
|
+
return content.filter((item) => item?.type === "text" && typeof item.text === "string").map((item) => item.text).join("");
|
|
164
|
+
}
|
|
165
|
+
function extractUserText(message) {
|
|
166
|
+
if (!message || typeof message !== "object" || message === null || !("role" in message) || message.role !== "user") {
|
|
167
|
+
return "";
|
|
168
|
+
}
|
|
169
|
+
const content = "content" in message ? message.content : "";
|
|
170
|
+
if (typeof content === "string") return content;
|
|
171
|
+
if (!Array.isArray(content)) return "";
|
|
172
|
+
return content.filter((item) => item?.type === "text" && typeof item.text === "string").map((item) => item.text).join("");
|
|
173
|
+
}
|
|
174
|
+
function extractThinking(message) {
|
|
175
|
+
if (!message || typeof message !== "object" || message === null || !("role" in message) || message.role !== "assistant") {
|
|
176
|
+
return "";
|
|
177
|
+
}
|
|
178
|
+
const content = "content" in message && Array.isArray(message.content) ? message.content : [];
|
|
179
|
+
return content.filter(
|
|
180
|
+
(item) => item?.type === "thinking" && typeof item.thinking === "string"
|
|
181
|
+
).map((item) => item.thinking).join("");
|
|
182
|
+
}
|
|
183
|
+
function terminalFailureFromAssistantMessage(message) {
|
|
184
|
+
if (!message || typeof message !== "object" || message === null || !("role" in message) || message.role !== "assistant") {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
const stopReason = message.stopReason;
|
|
188
|
+
if (stopReason !== "error" && stopReason !== "aborted") return null;
|
|
189
|
+
const rawError = message.errorMessage;
|
|
190
|
+
const errorMessage = typeof rawError === "string" && rawError.length > 0 ? rawError : stopReason === "aborted" ? "request aborted" : "model target returned an error";
|
|
191
|
+
return { stopReason, errorMessage, message };
|
|
192
|
+
}
|
|
193
|
+
function isSelfExplainingAbort(view) {
|
|
194
|
+
if (view.stopReason !== "aborted") return false;
|
|
195
|
+
if (typeof view.errorMessage === "string" && view.errorMessage.length > 0) return false;
|
|
196
|
+
return view.text.trim().length > 0;
|
|
197
|
+
}
|
|
198
|
+
function isLengthStopAssistantMessage(message) {
|
|
199
|
+
return !!message && typeof message === "object" && message !== null && "role" in message && message.role === "assistant" && message.stopReason === "length";
|
|
200
|
+
}
|
|
201
|
+
function isEmptyAbortedAssistantMessage(message) {
|
|
202
|
+
if (!message || typeof message !== "object" || message === null || !("role" in message) || message.role !== "assistant") {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
if (message.stopReason !== "aborted") return false;
|
|
206
|
+
if (extractText(message).trim().length > 0) return false;
|
|
207
|
+
return !hasStructuredToolCall(message);
|
|
208
|
+
}
|
|
209
|
+
function lengthStopMetadata(message) {
|
|
210
|
+
const usage = message.usage;
|
|
211
|
+
const metadata = {
|
|
212
|
+
kind: "provider_length_stop",
|
|
213
|
+
stopReason: "length",
|
|
214
|
+
message: "Model target hit its generation/output limit before a complete assistant response. This is not a safety denial; compacting helps only when the prompt and tool observations are also near the context window."
|
|
215
|
+
};
|
|
216
|
+
if (usage && typeof usage === "object") {
|
|
217
|
+
const u = usage;
|
|
218
|
+
for (const [from, to] of [
|
|
219
|
+
["input", "inputTokens"],
|
|
220
|
+
["output", "outputTokens"],
|
|
221
|
+
["totalTokens", "totalTokens"]
|
|
222
|
+
]) {
|
|
223
|
+
const value = u[from];
|
|
224
|
+
if (typeof value === "number" && Number.isFinite(value)) metadata[to] = value;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return metadata;
|
|
228
|
+
}
|
|
229
|
+
function hasStructuredToolCall(message) {
|
|
230
|
+
if (!message || typeof message !== "object" || !("content" in message) || !Array.isArray(message.content))
|
|
231
|
+
return false;
|
|
232
|
+
return message.content.some((block) => block?.type === "toolCall");
|
|
233
|
+
}
|
|
234
|
+
function toolNamesFromAgentState(tools) {
|
|
235
|
+
const names = [];
|
|
236
|
+
for (const tool of tools) {
|
|
237
|
+
if (!tool || typeof tool !== "object") continue;
|
|
238
|
+
const name = tool.name;
|
|
239
|
+
if (typeof name === "string" && name.trim().length > 0) names.push(name);
|
|
240
|
+
}
|
|
241
|
+
return names;
|
|
242
|
+
}
|
|
243
|
+
function noticeMessage(text) {
|
|
244
|
+
return {
|
|
245
|
+
role: "assistant",
|
|
246
|
+
content: [{ type: "text", text }],
|
|
247
|
+
stopReason: "aborted",
|
|
248
|
+
timestamp: Date.now()
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function pendingSkillRequestPreamble(requests) {
|
|
252
|
+
const named = requests.filter((request) => request.name.trim().length > 0);
|
|
253
|
+
if (named.length === 0) return "";
|
|
254
|
+
const allowed = [...new Set(named.map((request) => request.name.trim()))];
|
|
255
|
+
const lines = named.map((request) => {
|
|
256
|
+
const status = request.installed ? "installed" : "not-installed";
|
|
257
|
+
const args = request.args.trim();
|
|
258
|
+
return `- ${request.name} (${status}, source=${request.source})${args.length > 0 ? ` \u2014 task: ${args}` : ""}`;
|
|
259
|
+
});
|
|
260
|
+
return [
|
|
261
|
+
"[Skill request]",
|
|
262
|
+
...lines,
|
|
263
|
+
`First call context with scope="skills" and name for: ${allowed.join(", ")}. Only these pending skill names are allowed this turn. After the skill loads, follow the loaded workflow.`
|
|
264
|
+
].join("\n");
|
|
265
|
+
}
|
|
266
|
+
function toolSignatureFromState(tools) {
|
|
267
|
+
const schemas = [];
|
|
268
|
+
for (const tool of tools) {
|
|
269
|
+
if (!tool || typeof tool !== "object" || Array.isArray(tool)) continue;
|
|
270
|
+
const record = tool;
|
|
271
|
+
schemas.push({
|
|
272
|
+
name: typeof record.name === "string" ? record.name : "",
|
|
273
|
+
description: typeof record.description === "string" ? record.description : "",
|
|
274
|
+
parameters: record.parameters ?? null
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
schemas.sort((a, b) => a.name.localeCompare(b.name));
|
|
278
|
+
return sha256(canonicalJson(schemas));
|
|
279
|
+
}
|
|
280
|
+
function fallbackIdentityPrompt() {
|
|
281
|
+
return [
|
|
282
|
+
"You are Clio, the coding agent in IOWarp's CLIO ecosystem of agentic science (NSF-funded, iowarp.ai).",
|
|
283
|
+
"CLIO stands for Context Layer for Input/Output. Named after the Greek muse of history, you focus on HPC and scientific-software engineering.",
|
|
284
|
+
"Whichever weights run you, your name and persona are Clio. You are not Claude, GPT, Qwen, Gemini, Llama, Mistral, or any other vendor's assistant."
|
|
285
|
+
].join(" ");
|
|
286
|
+
}
|
|
287
|
+
function createPendingSkillToolPolicy(requests) {
|
|
288
|
+
const allowedSkillNames = [
|
|
289
|
+
...new Set(requests.map((request) => request.name.trim()).filter((name) => name.length > 0))
|
|
290
|
+
];
|
|
291
|
+
if (allowedSkillNames.length === 0) return void 0;
|
|
292
|
+
return {
|
|
293
|
+
allowedSkillNames,
|
|
294
|
+
requests: [...requests],
|
|
295
|
+
loadedSkillNames: /* @__PURE__ */ new Set(),
|
|
296
|
+
loadedSkillPolicies: /* @__PURE__ */ new Map()
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function createAskUserToolPolicy(activeTools) {
|
|
300
|
+
if (!activeTools.some((tool) => tool.name === ToolNames.AskUser)) return void 0;
|
|
301
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
302
|
+
return {
|
|
303
|
+
id: randomUUID(),
|
|
304
|
+
status: "idle",
|
|
305
|
+
startedAt: now,
|
|
306
|
+
updatedAt: now,
|
|
307
|
+
rounds: [],
|
|
308
|
+
decisions: [],
|
|
309
|
+
inFlight: false,
|
|
310
|
+
cancelled: false,
|
|
311
|
+
answerCount: 0,
|
|
312
|
+
callCount: 0,
|
|
313
|
+
maxCalls: 6,
|
|
314
|
+
askedQuestionKeys: /* @__PURE__ */ new Set()
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function sumRunUsage(messages) {
|
|
318
|
+
const summary = {
|
|
319
|
+
tokens: 0,
|
|
320
|
+
costUsd: 0,
|
|
321
|
+
input: 0,
|
|
322
|
+
output: 0,
|
|
323
|
+
cacheRead: 0,
|
|
324
|
+
cacheWrite: 0,
|
|
325
|
+
reasoning: 0,
|
|
326
|
+
apiCalls: 0,
|
|
327
|
+
hadReasoning: false,
|
|
328
|
+
hadUsage: false
|
|
329
|
+
};
|
|
330
|
+
for (const raw of messages) {
|
|
331
|
+
const message = raw;
|
|
332
|
+
if (!message || typeof message !== "object") continue;
|
|
333
|
+
if (message.role !== "assistant") continue;
|
|
334
|
+
const usage = message.usage;
|
|
335
|
+
if (!usage || typeof usage !== "object") continue;
|
|
336
|
+
summary.hadUsage = true;
|
|
337
|
+
summary.apiCalls += 1;
|
|
338
|
+
const input = typeof usage.input === "number" ? usage.input : 0;
|
|
339
|
+
const output = typeof usage.output === "number" ? usage.output : 0;
|
|
340
|
+
const cacheRead = typeof usage.cacheRead === "number" ? usage.cacheRead : 0;
|
|
341
|
+
const cacheWrite = typeof usage.cacheWrite === "number" ? usage.cacheWrite : 0;
|
|
342
|
+
summary.input += input;
|
|
343
|
+
summary.output += output;
|
|
344
|
+
summary.cacheRead += cacheRead;
|
|
345
|
+
summary.cacheWrite += cacheWrite;
|
|
346
|
+
const reasoning = extractReasoningTokens(usage);
|
|
347
|
+
if (reasoning !== null) {
|
|
348
|
+
summary.reasoning += reasoning;
|
|
349
|
+
summary.hadReasoning = true;
|
|
350
|
+
}
|
|
351
|
+
if (typeof usage.totalTokens === "number" && usage.totalTokens > 0) {
|
|
352
|
+
summary.tokens += usage.totalTokens;
|
|
353
|
+
} else {
|
|
354
|
+
summary.tokens += input + output + cacheRead + cacheWrite;
|
|
355
|
+
}
|
|
356
|
+
const total = usage.cost?.total;
|
|
357
|
+
if (typeof total === "number") summary.costUsd += total;
|
|
358
|
+
}
|
|
359
|
+
return summary;
|
|
360
|
+
}
|
|
361
|
+
function backendCacheVerdict(input, cacheRead) {
|
|
362
|
+
if (cacheRead > 0) return input >= 2e3 ? "partial" : "hot";
|
|
363
|
+
return input >= 2e3 ? "cold" : "small";
|
|
364
|
+
}
|
|
365
|
+
function assistantSessionPayload(message, failure) {
|
|
366
|
+
const text = extractText(message).trim();
|
|
367
|
+
const thinking = extractThinking(message).trim();
|
|
368
|
+
const payload = { text };
|
|
369
|
+
const raw = message;
|
|
370
|
+
if (Array.isArray(raw.content)) payload.content = raw.content;
|
|
371
|
+
if (thinking.length > 0) payload.thinking = thinking;
|
|
372
|
+
for (const key of ["usage", "api", "provider", "model", "responseModel", "responseId", "diagnostics"]) {
|
|
373
|
+
if (raw[key] !== void 0) payload[key] = raw[key];
|
|
374
|
+
}
|
|
375
|
+
if (failure && !isSelfExplainingAbort({ stopReason: raw.stopReason, errorMessage: raw.errorMessage, text })) {
|
|
376
|
+
payload.stopReason = failure.stopReason;
|
|
377
|
+
payload.errorMessage = failure.errorMessage;
|
|
378
|
+
} else {
|
|
379
|
+
const stopReason = raw.stopReason;
|
|
380
|
+
if (stopReason !== void 0) payload.stopReason = stopReason;
|
|
381
|
+
if (stopReason === "length") payload.contextExhaustion = lengthStopMetadata(message);
|
|
382
|
+
}
|
|
383
|
+
return payload;
|
|
384
|
+
}
|
|
385
|
+
function estimatedUsageForInterruptedTurn(message, promptSideTokens) {
|
|
386
|
+
if (message.stopReason !== "aborted") return null;
|
|
387
|
+
const reported = message.usage;
|
|
388
|
+
if (reported && typeof reported === "object") {
|
|
389
|
+
for (const key of ["input", "output", "cacheRead", "cacheWrite", "totalTokens"]) {
|
|
390
|
+
const value = reported[key];
|
|
391
|
+
if (typeof value === "number" && value > 0) return null;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const streamedChars = extractText(message).length + extractThinking(message).length;
|
|
395
|
+
if (streamedChars === 0 && promptSideTokens <= 0) return null;
|
|
396
|
+
const input = Math.max(0, Math.round(promptSideTokens));
|
|
397
|
+
const output = streamedChars > 0 ? Math.max(1, ceilChars(streamedChars)) : 0;
|
|
398
|
+
return {
|
|
399
|
+
input,
|
|
400
|
+
output,
|
|
401
|
+
cacheRead: 0,
|
|
402
|
+
cacheWrite: 0,
|
|
403
|
+
reasoning: 0,
|
|
404
|
+
totalTokens: input + output,
|
|
405
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
406
|
+
estimated: true
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function hasPersistableAssistantContent(payload, failure) {
|
|
410
|
+
if (failure) return true;
|
|
411
|
+
if (payload.stopReason === "length") return true;
|
|
412
|
+
if (typeof payload.text === "string" && payload.text.trim().length > 0) return true;
|
|
413
|
+
if (typeof payload.thinking === "string" && payload.thinking.trim().length > 0) return true;
|
|
414
|
+
if (Array.isArray(payload.content) && payload.content.length > 0) return true;
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
function recordValue(value) {
|
|
418
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
419
|
+
}
|
|
420
|
+
function textFromToolResultContent(content) {
|
|
421
|
+
if (!Array.isArray(content)) return "";
|
|
422
|
+
return content.map((block) => {
|
|
423
|
+
const item = recordValue(block);
|
|
424
|
+
if (item?.type !== "text" || typeof item?.text !== "string") return "";
|
|
425
|
+
return item.text;
|
|
426
|
+
}).join("");
|
|
427
|
+
}
|
|
428
|
+
function toolResultSummary(result2) {
|
|
429
|
+
const obj = recordValue(result2);
|
|
430
|
+
const text = textFromToolResultContent(obj?.content) || (typeof result2 === "string" ? result2 : "");
|
|
431
|
+
const bytes = Buffer.byteLength(text, "utf8");
|
|
432
|
+
const details = recordValue(obj?.details);
|
|
433
|
+
const size = recordValue(details?.resultSize);
|
|
434
|
+
const truncation = recordValue(details?.truncation);
|
|
435
|
+
const observation = recordValue(details?.observation);
|
|
436
|
+
const offloadPath = typeof observation?.offloadPath === "string" ? observation.offloadPath : typeof size?.offloadPath === "string" ? size.offloadPath : null;
|
|
437
|
+
return {
|
|
438
|
+
bytes,
|
|
439
|
+
truncated: size?.truncated === true || truncation?.truncated === true || observation?.truncated === true || text.includes("[tool result truncated]"),
|
|
440
|
+
...typeof size?.policy === "string" ? { policy: size.policy } : {},
|
|
441
|
+
...typeof size?.followUpHint === "string" ? { followUpHint: size.followUpHint } : {},
|
|
442
|
+
...offloadPath !== null ? { offloadPath } : {},
|
|
443
|
+
// Observation envelope counts (OBSERVE plane): unit, shown/total counts
|
|
444
|
+
// and bytes, format, exact continuation, offload path. Persisted with
|
|
445
|
+
// the turn so the ledger line renders identically live and on replay.
|
|
446
|
+
...observation !== null ? { observation } : {}
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function runtimeSupportsTools(agentRuntime) {
|
|
450
|
+
return agentRuntime.runtimeResolution.capabilityDecisions.tools === true;
|
|
451
|
+
}
|
|
452
|
+
function detectTerminalFailureFromState(agent) {
|
|
453
|
+
const msgs = agent.state.messages;
|
|
454
|
+
const tail = Array.isArray(msgs) ? msgs[msgs.length - 1] : void 0;
|
|
455
|
+
const failure = terminalFailureFromAssistantMessage(tail);
|
|
456
|
+
if (failure) return failure;
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
function pruneFailedAssistantFromContext(agent) {
|
|
460
|
+
const messages = agent.state.messages;
|
|
461
|
+
const tail = Array.isArray(messages) ? messages[messages.length - 1] : void 0;
|
|
462
|
+
if (!terminalFailureFromAssistantMessage(tail)) return;
|
|
463
|
+
agent.state.messages = messages.slice(0, -1);
|
|
464
|
+
}
|
|
465
|
+
function detectOverflowFromState(agent) {
|
|
466
|
+
const direct = agent.state.errorMessage;
|
|
467
|
+
if (typeof direct === "string" && direct.length > 0) {
|
|
468
|
+
const match = toContextOverflowError(direct);
|
|
469
|
+
if (match) return match;
|
|
470
|
+
}
|
|
471
|
+
const msgs = agent.state.messages;
|
|
472
|
+
const tail = Array.isArray(msgs) ? msgs[msgs.length - 1] : void 0;
|
|
473
|
+
if (tail && typeof tail === "object" && tail.stopReason === "error") {
|
|
474
|
+
const em = tail.errorMessage;
|
|
475
|
+
if (typeof em === "string") {
|
|
476
|
+
const match = toContextOverflowError(em);
|
|
477
|
+
if (match) return match;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// src/cli/modes/json-stream.ts
|
|
484
|
+
function projectHeadlessJsonEvent(event) {
|
|
485
|
+
if (event.type === "message_update") return null;
|
|
486
|
+
if (event.type === "text_delta") {
|
|
487
|
+
return { type: event.type, contentIndex: event.contentIndex, delta: event.delta };
|
|
488
|
+
}
|
|
489
|
+
if (event.type === "thinking_delta") {
|
|
490
|
+
return { type: event.type, contentIndex: event.contentIndex, delta: event.delta };
|
|
491
|
+
}
|
|
492
|
+
if (event.type === "message_end") {
|
|
493
|
+
return { ...event, message: withoutStreamedContent(event.message) };
|
|
494
|
+
}
|
|
495
|
+
if (event.type === "agent_end") return segmentSummary(event.type, event.messages);
|
|
496
|
+
if (event.type === "turn_end") {
|
|
497
|
+
return { type: event.type, message: withoutStreamedContent(event.message) };
|
|
498
|
+
}
|
|
499
|
+
return event;
|
|
500
|
+
}
|
|
501
|
+
function withoutStreamedContent(message) {
|
|
502
|
+
if (!isRecord(message) || message.role !== "assistant" || !Array.isArray(message.content)) return message;
|
|
503
|
+
const content = message.content.map((block) => {
|
|
504
|
+
if (!isRecord(block)) return block;
|
|
505
|
+
if (block.type === "text" && typeof block.text === "string") {
|
|
506
|
+
const { text: _text, ...rest } = block;
|
|
507
|
+
return { ...rest, streamed: true, textLength: block.text.length };
|
|
508
|
+
}
|
|
509
|
+
if (block.type === "thinking" && typeof block.thinking === "string") {
|
|
510
|
+
const { thinking: _thinking, ...rest } = block;
|
|
511
|
+
return { ...rest, streamed: true, thinkingLength: block.thinking.length };
|
|
512
|
+
}
|
|
513
|
+
return block;
|
|
514
|
+
});
|
|
515
|
+
return { ...message, content };
|
|
516
|
+
}
|
|
517
|
+
function projectDispatchJsonEvent(event) {
|
|
518
|
+
if (!isRecord(event) || event.type !== "agent_end" || !Array.isArray(event.messages)) return event;
|
|
519
|
+
const { messages: _messages, ...rest } = event;
|
|
520
|
+
return { ...rest, ...segmentSummary("agent_end", event.messages) };
|
|
521
|
+
}
|
|
522
|
+
function segmentSummary(type, messages) {
|
|
523
|
+
const usage = sumRunUsage(messages);
|
|
524
|
+
return {
|
|
525
|
+
type,
|
|
526
|
+
messageCount: messages.length,
|
|
527
|
+
usage: {
|
|
528
|
+
input: usage.input,
|
|
529
|
+
output: usage.output,
|
|
530
|
+
cacheRead: usage.cacheRead,
|
|
531
|
+
cacheWrite: usage.cacheWrite,
|
|
532
|
+
reasoning: usage.reasoning,
|
|
533
|
+
totalTokens: usage.tokens,
|
|
534
|
+
costUsd: usage.costUsd,
|
|
535
|
+
apiCalls: usage.apiCalls,
|
|
536
|
+
measured: usage.hadUsage
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function isRecord(value) {
|
|
541
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// src/core/file-references.ts
|
|
545
|
+
init_esm_shims();
|
|
546
|
+
import { existsSync, readFileSync, statSync as statSync2 } from "node:fs";
|
|
547
|
+
import path2 from "node:path";
|
|
548
|
+
|
|
549
|
+
// src/utils/image-resize.ts
|
|
550
|
+
init_esm_shims();
|
|
551
|
+
|
|
552
|
+
// src/utils/exif-orientation.ts
|
|
553
|
+
init_esm_shims();
|
|
554
|
+
function byte(bytes, offset) {
|
|
555
|
+
return bytes[offset] ?? 0;
|
|
556
|
+
}
|
|
557
|
+
function readOrientationFromTiff(bytes, tiffStart) {
|
|
558
|
+
if (tiffStart + 8 > bytes.length) return 1;
|
|
559
|
+
const byteOrder = byte(bytes, tiffStart) << 8 | byte(bytes, tiffStart + 1);
|
|
560
|
+
const le = byteOrder === 18761;
|
|
561
|
+
const read16 = (pos) => {
|
|
562
|
+
if (le) return byte(bytes, pos) | byte(bytes, pos + 1) << 8;
|
|
563
|
+
return byte(bytes, pos) << 8 | byte(bytes, pos + 1);
|
|
564
|
+
};
|
|
565
|
+
const read32 = (pos) => {
|
|
566
|
+
if (le) {
|
|
567
|
+
return byte(bytes, pos) | byte(bytes, pos + 1) << 8 | byte(bytes, pos + 2) << 16 | byte(bytes, pos + 3) << 24;
|
|
568
|
+
}
|
|
569
|
+
return (byte(bytes, pos) << 24 | byte(bytes, pos + 1) << 16 | byte(bytes, pos + 2) << 8 | byte(bytes, pos + 3)) >>> 0;
|
|
570
|
+
};
|
|
571
|
+
const ifdOffset = read32(tiffStart + 4);
|
|
572
|
+
const ifdStart = tiffStart + ifdOffset;
|
|
573
|
+
if (ifdStart + 2 > bytes.length) return 1;
|
|
574
|
+
const entryCount = read16(ifdStart);
|
|
575
|
+
for (let i = 0; i < entryCount; i++) {
|
|
576
|
+
const entryPos = ifdStart + 2 + i * 12;
|
|
577
|
+
if (entryPos + 12 > bytes.length) return 1;
|
|
578
|
+
if (read16(entryPos) === 274) {
|
|
579
|
+
const value = read16(entryPos + 8);
|
|
580
|
+
return value >= 1 && value <= 8 ? value : 1;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return 1;
|
|
584
|
+
}
|
|
585
|
+
function hasExifHeader(bytes, offset) {
|
|
586
|
+
return byte(bytes, offset) === 69 && byte(bytes, offset + 1) === 120 && byte(bytes, offset + 2) === 105 && byte(bytes, offset + 3) === 102 && byte(bytes, offset + 4) === 0 && byte(bytes, offset + 5) === 0;
|
|
587
|
+
}
|
|
588
|
+
function findJpegTiffOffset(bytes) {
|
|
589
|
+
let offset = 2;
|
|
590
|
+
while (offset < bytes.length - 1) {
|
|
591
|
+
if (byte(bytes, offset) !== 255) return -1;
|
|
592
|
+
const marker = byte(bytes, offset + 1);
|
|
593
|
+
if (marker === 255) {
|
|
594
|
+
offset++;
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
if (marker === 225) {
|
|
598
|
+
if (offset + 4 >= bytes.length) return -1;
|
|
599
|
+
const segmentStart = offset + 4;
|
|
600
|
+
if (segmentStart + 6 > bytes.length) return -1;
|
|
601
|
+
if (!hasExifHeader(bytes, segmentStart)) return -1;
|
|
602
|
+
return segmentStart + 6;
|
|
603
|
+
}
|
|
604
|
+
if (offset + 4 > bytes.length) return -1;
|
|
605
|
+
const length = byte(bytes, offset + 2) << 8 | byte(bytes, offset + 3);
|
|
606
|
+
offset += 2 + length;
|
|
607
|
+
}
|
|
608
|
+
return -1;
|
|
609
|
+
}
|
|
610
|
+
function findWebpTiffOffset(bytes) {
|
|
611
|
+
let offset = 12;
|
|
612
|
+
while (offset + 8 <= bytes.length) {
|
|
613
|
+
const chunkId = String.fromCharCode(
|
|
614
|
+
byte(bytes, offset),
|
|
615
|
+
byte(bytes, offset + 1),
|
|
616
|
+
byte(bytes, offset + 2),
|
|
617
|
+
byte(bytes, offset + 3)
|
|
618
|
+
);
|
|
619
|
+
const chunkSize = byte(bytes, offset + 4) | byte(bytes, offset + 5) << 8 | byte(bytes, offset + 6) << 16 | byte(bytes, offset + 7) << 24;
|
|
620
|
+
const dataStart = offset + 8;
|
|
621
|
+
if (chunkId === "EXIF") {
|
|
622
|
+
if (dataStart + chunkSize > bytes.length) return -1;
|
|
623
|
+
return chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;
|
|
624
|
+
}
|
|
625
|
+
offset = dataStart + chunkSize + chunkSize % 2;
|
|
626
|
+
}
|
|
627
|
+
return -1;
|
|
628
|
+
}
|
|
629
|
+
function getExifOrientation(bytes) {
|
|
630
|
+
let tiffOffset = -1;
|
|
631
|
+
if (bytes.length >= 2 && byte(bytes, 0) === 255 && byte(bytes, 1) === 216) {
|
|
632
|
+
tiffOffset = findJpegTiffOffset(bytes);
|
|
633
|
+
} else if (bytes.length >= 12 && byte(bytes, 0) === 82 && byte(bytes, 1) === 73 && byte(bytes, 2) === 70 && byte(bytes, 3) === 70 && byte(bytes, 8) === 87 && byte(bytes, 9) === 69 && byte(bytes, 10) === 66 && byte(bytes, 11) === 80) {
|
|
634
|
+
tiffOffset = findWebpTiffOffset(bytes);
|
|
635
|
+
}
|
|
636
|
+
if (tiffOffset === -1) return 1;
|
|
637
|
+
return readOrientationFromTiff(bytes, tiffOffset);
|
|
638
|
+
}
|
|
639
|
+
function rotate90(photon, image, dstIndex) {
|
|
640
|
+
const w = image.get_width();
|
|
641
|
+
const h = image.get_height();
|
|
642
|
+
const src = image.get_raw_pixels();
|
|
643
|
+
const dst = new Uint8Array(src.length);
|
|
644
|
+
for (let y = 0; y < h; y++) {
|
|
645
|
+
for (let x = 0; x < w; x++) {
|
|
646
|
+
const srcIdx = (y * w + x) * 4;
|
|
647
|
+
const dstIdx = dstIndex(x, y, w, h) * 4;
|
|
648
|
+
dst[dstIdx] = src[srcIdx] ?? 0;
|
|
649
|
+
dst[dstIdx + 1] = src[srcIdx + 1] ?? 0;
|
|
650
|
+
dst[dstIdx + 2] = src[srcIdx + 2] ?? 0;
|
|
651
|
+
dst[dstIdx + 3] = src[srcIdx + 3] ?? 0;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return new photon.PhotonImage(dst, h, w);
|
|
655
|
+
}
|
|
656
|
+
function applyExifOrientation(photon, image, originalBytes) {
|
|
657
|
+
const orientation = getExifOrientation(originalBytes);
|
|
658
|
+
if (orientation === 1) return image;
|
|
659
|
+
switch (orientation) {
|
|
660
|
+
case 2:
|
|
661
|
+
photon.fliph(image);
|
|
662
|
+
return image;
|
|
663
|
+
case 3:
|
|
664
|
+
photon.fliph(image);
|
|
665
|
+
photon.flipv(image);
|
|
666
|
+
return image;
|
|
667
|
+
case 4:
|
|
668
|
+
photon.flipv(image);
|
|
669
|
+
return image;
|
|
670
|
+
case 5: {
|
|
671
|
+
const rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));
|
|
672
|
+
photon.fliph(rotated);
|
|
673
|
+
return rotated;
|
|
674
|
+
}
|
|
675
|
+
case 6:
|
|
676
|
+
return rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));
|
|
677
|
+
case 7: {
|
|
678
|
+
const rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);
|
|
679
|
+
photon.fliph(rotated);
|
|
680
|
+
return rotated;
|
|
681
|
+
}
|
|
682
|
+
case 8:
|
|
683
|
+
return rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);
|
|
684
|
+
default:
|
|
685
|
+
return image;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// src/utils/photon.ts
|
|
690
|
+
init_esm_shims();
|
|
691
|
+
import { createRequire } from "node:module";
|
|
692
|
+
import path from "node:path";
|
|
693
|
+
import { fileURLToPath } from "node:url";
|
|
694
|
+
var require2 = createRequire(import.meta.url);
|
|
695
|
+
var fs2 = require2("node:fs");
|
|
696
|
+
var WASM_FILENAME = "photon_rs_bg.wasm";
|
|
697
|
+
var photonModule = null;
|
|
698
|
+
var loadPromise = null;
|
|
699
|
+
function pathOrNull(file) {
|
|
700
|
+
if (typeof file === "string") return file;
|
|
701
|
+
if (file instanceof URL) return fileURLToPath(file);
|
|
702
|
+
return null;
|
|
703
|
+
}
|
|
704
|
+
function getFallbackWasmPaths() {
|
|
705
|
+
const execDir = path.dirname(process.execPath);
|
|
706
|
+
return [
|
|
707
|
+
path.join(execDir, WASM_FILENAME),
|
|
708
|
+
path.join(execDir, "photon", WASM_FILENAME),
|
|
709
|
+
path.join(process.cwd(), WASM_FILENAME)
|
|
710
|
+
];
|
|
711
|
+
}
|
|
712
|
+
function patchPhotonWasmRead() {
|
|
713
|
+
const originalReadFileSync = fs2.readFileSync.bind(fs2);
|
|
714
|
+
const fallbackPaths = getFallbackWasmPaths();
|
|
715
|
+
const mutableFs = fs2;
|
|
716
|
+
const patchedReadFileSync = ((...args) => {
|
|
717
|
+
const [file, options] = args;
|
|
718
|
+
const resolvedPath = pathOrNull(file);
|
|
719
|
+
if (resolvedPath?.endsWith(WASM_FILENAME)) {
|
|
720
|
+
try {
|
|
721
|
+
return originalReadFileSync(...args);
|
|
722
|
+
} catch (error) {
|
|
723
|
+
const err = error;
|
|
724
|
+
if (err?.code && err.code !== "ENOENT") throw error;
|
|
725
|
+
for (const fallbackPath of fallbackPaths) {
|
|
726
|
+
if (!fs2.existsSync(fallbackPath)) continue;
|
|
727
|
+
if (options === void 0) return originalReadFileSync(fallbackPath);
|
|
728
|
+
return originalReadFileSync(fallbackPath, options);
|
|
729
|
+
}
|
|
730
|
+
throw error;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return originalReadFileSync(...args);
|
|
734
|
+
});
|
|
735
|
+
try {
|
|
736
|
+
mutableFs.readFileSync = patchedReadFileSync;
|
|
737
|
+
} catch {
|
|
738
|
+
Object.defineProperty(fs2, "readFileSync", {
|
|
739
|
+
value: patchedReadFileSync,
|
|
740
|
+
writable: true,
|
|
741
|
+
configurable: true
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
return () => {
|
|
745
|
+
try {
|
|
746
|
+
mutableFs.readFileSync = originalReadFileSync;
|
|
747
|
+
} catch {
|
|
748
|
+
Object.defineProperty(fs2, "readFileSync", {
|
|
749
|
+
value: originalReadFileSync,
|
|
750
|
+
writable: true,
|
|
751
|
+
configurable: true
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
async function loadPhoton() {
|
|
757
|
+
if (photonModule) return photonModule;
|
|
758
|
+
if (loadPromise) return loadPromise;
|
|
759
|
+
loadPromise = (async () => {
|
|
760
|
+
const restoreReadFileSync = patchPhotonWasmRead();
|
|
761
|
+
try {
|
|
762
|
+
photonModule = await import("@silvia-odwyer/photon-node");
|
|
763
|
+
return photonModule;
|
|
764
|
+
} catch {
|
|
765
|
+
photonModule = null;
|
|
766
|
+
return photonModule;
|
|
767
|
+
} finally {
|
|
768
|
+
restoreReadFileSync();
|
|
769
|
+
}
|
|
770
|
+
})();
|
|
771
|
+
return loadPromise;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
// src/utils/image-resize.ts
|
|
775
|
+
var DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;
|
|
776
|
+
var DEFAULT_OPTIONS = {
|
|
777
|
+
maxWidth: 2e3,
|
|
778
|
+
maxHeight: 2e3,
|
|
779
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
780
|
+
jpegQuality: 80
|
|
781
|
+
};
|
|
782
|
+
function encodeCandidate(buffer, mimeType) {
|
|
783
|
+
const data = Buffer.from(buffer).toString("base64");
|
|
784
|
+
return {
|
|
785
|
+
data,
|
|
786
|
+
encodedSize: Buffer.byteLength(data, "utf-8"),
|
|
787
|
+
mimeType
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
async function resizeImage(img, options) {
|
|
791
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
792
|
+
const inputBuffer = Buffer.from(img.data, "base64");
|
|
793
|
+
const inputBase64Size = Buffer.byteLength(img.data, "utf-8");
|
|
794
|
+
const photon = await loadPhoton();
|
|
795
|
+
if (!photon) return null;
|
|
796
|
+
const loadedPhoton = photon;
|
|
797
|
+
let image;
|
|
798
|
+
try {
|
|
799
|
+
let tryEncodings2 = function(width, height, jpegQualities) {
|
|
800
|
+
const resized = loadedPhoton.resize(loadedImage, width, height, loadedPhoton.SamplingFilter.Lanczos3);
|
|
801
|
+
try {
|
|
802
|
+
const candidates = [encodeCandidate(resized.get_bytes(), "image/png")];
|
|
803
|
+
for (const quality of jpegQualities) {
|
|
804
|
+
candidates.push(encodeCandidate(resized.get_bytes_jpeg(quality), "image/jpeg"));
|
|
805
|
+
}
|
|
806
|
+
return candidates;
|
|
807
|
+
} finally {
|
|
808
|
+
resized.free();
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
var tryEncodings = tryEncodings2;
|
|
812
|
+
const inputBytes = new Uint8Array(inputBuffer);
|
|
813
|
+
const rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);
|
|
814
|
+
image = applyExifOrientation(photon, rawImage, inputBytes);
|
|
815
|
+
if (image !== rawImage) rawImage.free();
|
|
816
|
+
const originalWidth = image.get_width();
|
|
817
|
+
const originalHeight = image.get_height();
|
|
818
|
+
const format = img.mimeType?.split("/")[1] ?? "png";
|
|
819
|
+
if (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {
|
|
820
|
+
return {
|
|
821
|
+
data: img.data,
|
|
822
|
+
mimeType: img.mimeType ?? `image/${format}`,
|
|
823
|
+
originalWidth,
|
|
824
|
+
originalHeight,
|
|
825
|
+
width: originalWidth,
|
|
826
|
+
height: originalHeight,
|
|
827
|
+
wasResized: false
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
let targetWidth = originalWidth;
|
|
831
|
+
let targetHeight = originalHeight;
|
|
832
|
+
if (targetWidth > opts.maxWidth) {
|
|
833
|
+
targetHeight = Math.round(targetHeight * opts.maxWidth / targetWidth);
|
|
834
|
+
targetWidth = opts.maxWidth;
|
|
835
|
+
}
|
|
836
|
+
if (targetHeight > opts.maxHeight) {
|
|
837
|
+
targetWidth = Math.round(targetWidth * opts.maxHeight / targetHeight);
|
|
838
|
+
targetHeight = opts.maxHeight;
|
|
839
|
+
}
|
|
840
|
+
const loadedImage = image;
|
|
841
|
+
const qualitySteps = Array.from(/* @__PURE__ */ new Set([opts.jpegQuality, 85, 70, 55, 40]));
|
|
842
|
+
let currentWidth = targetWidth;
|
|
843
|
+
let currentHeight = targetHeight;
|
|
844
|
+
while (true) {
|
|
845
|
+
const candidates = tryEncodings2(currentWidth, currentHeight, qualitySteps);
|
|
846
|
+
for (const candidate of candidates) {
|
|
847
|
+
if (candidate.encodedSize < opts.maxBytes) {
|
|
848
|
+
return {
|
|
849
|
+
data: candidate.data,
|
|
850
|
+
mimeType: candidate.mimeType,
|
|
851
|
+
originalWidth,
|
|
852
|
+
originalHeight,
|
|
853
|
+
width: currentWidth,
|
|
854
|
+
height: currentHeight,
|
|
855
|
+
wasResized: true
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
if (currentWidth === 1 && currentHeight === 1) break;
|
|
860
|
+
const nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));
|
|
861
|
+
const nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));
|
|
862
|
+
if (nextWidth === currentWidth && nextHeight === currentHeight) break;
|
|
863
|
+
currentWidth = nextWidth;
|
|
864
|
+
currentHeight = nextHeight;
|
|
865
|
+
}
|
|
866
|
+
return null;
|
|
867
|
+
} catch {
|
|
868
|
+
return null;
|
|
869
|
+
} finally {
|
|
870
|
+
if (image) image.free();
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
function formatDimensionNote(result2) {
|
|
874
|
+
if (!result2.wasResized) return void 0;
|
|
875
|
+
const scale = result2.originalWidth / result2.width;
|
|
876
|
+
return `[Image: original ${result2.originalWidth}x${result2.originalHeight}, displayed at ${result2.width}x${result2.height}. Multiply coordinates by ${scale.toFixed(2)} to map to original image.]`;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
// src/core/file-references.ts
|
|
880
|
+
var FILE_REF = /(^|\s)@(\S+)/g;
|
|
881
|
+
var DEFAULT_IMAGE_MAX_BASE64_BYTES = 4.5 * 1024 * 1024;
|
|
882
|
+
function renderTextFile(filePath, content) {
|
|
883
|
+
return `<file name="${filePath}">
|
|
884
|
+
${content}
|
|
885
|
+
</file>
|
|
886
|
+
`;
|
|
887
|
+
}
|
|
888
|
+
function renderImageFile(filePath, content = "") {
|
|
889
|
+
return `<file name="${filePath}">${content}</file>
|
|
890
|
+
`;
|
|
891
|
+
}
|
|
892
|
+
function result(text, diagnostics = [], images = [], referencedPaths = []) {
|
|
893
|
+
return { text, diagnostics, images, referencedPaths };
|
|
894
|
+
}
|
|
895
|
+
function detectSupportedImageMimeType(bytes) {
|
|
896
|
+
if (bytes.length >= 8 && bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) {
|
|
897
|
+
return "image/png";
|
|
898
|
+
}
|
|
899
|
+
if (bytes.length >= 3 && bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255) {
|
|
900
|
+
return "image/jpeg";
|
|
901
|
+
}
|
|
902
|
+
const signature = bytes.subarray(0, 6).toString("ascii");
|
|
903
|
+
if (signature === "GIF87a" || signature === "GIF89a") return "image/gif";
|
|
904
|
+
if (bytes.length >= 12 && bytes.subarray(0, 4).toString("ascii") === "RIFF" && bytes.subarray(8, 12).toString("ascii") === "WEBP") {
|
|
905
|
+
return "image/webp";
|
|
906
|
+
}
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
async function readFileReferenceAsync(fileArg, options) {
|
|
910
|
+
const filePath = expandConfigPath(fileArg, options.cwd === void 0 ? void 0 : { cwd: options.cwd });
|
|
911
|
+
if (!existsSync(filePath)) {
|
|
912
|
+
if (options.missing === "leave") return result(`@${fileArg}`);
|
|
913
|
+
return result("", [{ type: "error", message: `file not found: ${filePath}`, path: filePath }]);
|
|
914
|
+
}
|
|
915
|
+
let stat;
|
|
916
|
+
try {
|
|
917
|
+
stat = statSync2(filePath);
|
|
918
|
+
} catch (err) {
|
|
919
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
920
|
+
return result("", [{ type: "error", message: `file could not be stat'ed: ${reason}`, path: filePath }]);
|
|
921
|
+
}
|
|
922
|
+
if (!stat.isFile()) {
|
|
923
|
+
return result("", [{ type: "error", message: `not a file: ${filePath}`, path: filePath }]);
|
|
924
|
+
}
|
|
925
|
+
if (stat.size === 0) return result("", [], [], [filePath]);
|
|
926
|
+
try {
|
|
927
|
+
const bytes = readFileSync(filePath);
|
|
928
|
+
const imageMimeType = detectSupportedImageMimeType(bytes);
|
|
929
|
+
if (imageMimeType) {
|
|
930
|
+
if (options.includeImages !== true) return result(`@${fileArg}`);
|
|
931
|
+
const originalImage = {
|
|
932
|
+
type: "image",
|
|
933
|
+
mimeType: imageMimeType,
|
|
934
|
+
data: bytes.toString("base64")
|
|
935
|
+
};
|
|
936
|
+
if (options.autoResizeImages === false) {
|
|
937
|
+
return result(renderImageFile(filePath), [], [originalImage], [filePath]);
|
|
938
|
+
}
|
|
939
|
+
const resized = await resizeImage(originalImage);
|
|
940
|
+
if (!resized) {
|
|
941
|
+
if (Buffer.byteLength(originalImage.data, "utf-8") < DEFAULT_IMAGE_MAX_BASE64_BYTES) {
|
|
942
|
+
return result(renderImageFile(filePath), [], [originalImage], [filePath]);
|
|
943
|
+
}
|
|
944
|
+
return result(
|
|
945
|
+
renderImageFile(filePath, "[Image omitted: could not be resized below the inline image size limit.]"),
|
|
946
|
+
[],
|
|
947
|
+
[],
|
|
948
|
+
[filePath]
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
return result(
|
|
952
|
+
renderImageFile(filePath, formatDimensionNote(resized)),
|
|
953
|
+
[],
|
|
954
|
+
[{ type: "image", mimeType: resized.mimeType, data: resized.data }],
|
|
955
|
+
[filePath]
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
return result(renderTextFile(filePath, bytes.toString("utf8")), [], [], [filePath]);
|
|
959
|
+
} catch (err) {
|
|
960
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
961
|
+
return result("", [{ type: "error", message: `file could not be read: ${reason}`, path: filePath }]);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
async function readFileArgsAsync(fileArgs, options = {}) {
|
|
965
|
+
const diagnostics = [];
|
|
966
|
+
const images = [];
|
|
967
|
+
const referencedPaths = [];
|
|
968
|
+
let text = "";
|
|
969
|
+
for (const fileArg of fileArgs) {
|
|
970
|
+
const ref = await readFileReferenceAsync(fileArg, {
|
|
971
|
+
...options,
|
|
972
|
+
missing: options.missing ?? "error",
|
|
973
|
+
includeImages: true
|
|
974
|
+
});
|
|
975
|
+
text += ref.text;
|
|
976
|
+
images.push(...ref.images);
|
|
977
|
+
diagnostics.push(...ref.diagnostics);
|
|
978
|
+
referencedPaths.push(...ref.referencedPaths);
|
|
979
|
+
}
|
|
980
|
+
return { text, images, diagnostics, referencedPaths };
|
|
981
|
+
}
|
|
982
|
+
function splitTrailingPunctuation(token) {
|
|
983
|
+
const match = token.match(/^(.+?)([),.;:!?]+)$/);
|
|
984
|
+
if (!match?.[1] || !match[2]) return { fileArg: token, suffix: "" };
|
|
985
|
+
const candidate = match[1];
|
|
986
|
+
const suffix = match[2];
|
|
987
|
+
const ext = path2.extname(candidate);
|
|
988
|
+
if (ext.length === 0 && suffix.startsWith(".")) return { fileArg: token, suffix: "" };
|
|
989
|
+
return { fileArg: candidate, suffix };
|
|
990
|
+
}
|
|
991
|
+
async function expandInlineFileReferencesAsync(input, options = {}) {
|
|
992
|
+
const diagnostics = [];
|
|
993
|
+
const images = [];
|
|
994
|
+
const referencedPaths = [];
|
|
995
|
+
let text = "";
|
|
996
|
+
let lastIndex = 0;
|
|
997
|
+
for (const match of input.matchAll(FILE_REF)) {
|
|
998
|
+
const index = match.index ?? 0;
|
|
999
|
+
const full = match[0] ?? "";
|
|
1000
|
+
const prefix = match[1] ?? "";
|
|
1001
|
+
const token = match[2] ?? "";
|
|
1002
|
+
text += input.slice(lastIndex, index);
|
|
1003
|
+
const direct = await readFileReferenceAsync(token, {
|
|
1004
|
+
...options,
|
|
1005
|
+
missing: "leave",
|
|
1006
|
+
includeImages: options.includeImages === true
|
|
1007
|
+
});
|
|
1008
|
+
if (direct.text !== `@${token}`) {
|
|
1009
|
+
diagnostics.push(...direct.diagnostics);
|
|
1010
|
+
images.push(...direct.images);
|
|
1011
|
+
referencedPaths.push(...direct.referencedPaths);
|
|
1012
|
+
text += `${prefix}${direct.text}`;
|
|
1013
|
+
lastIndex = index + full.length;
|
|
1014
|
+
continue;
|
|
1015
|
+
}
|
|
1016
|
+
const { fileArg, suffix } = splitTrailingPunctuation(token);
|
|
1017
|
+
if (fileArg === token) {
|
|
1018
|
+
text += full;
|
|
1019
|
+
lastIndex = index + full.length;
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
1022
|
+
const stripped = await readFileReferenceAsync(fileArg, {
|
|
1023
|
+
...options,
|
|
1024
|
+
missing: "leave",
|
|
1025
|
+
includeImages: options.includeImages === true
|
|
1026
|
+
});
|
|
1027
|
+
if (stripped.text === `@${fileArg}`) {
|
|
1028
|
+
text += full;
|
|
1029
|
+
lastIndex = index + full.length;
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
diagnostics.push(...stripped.diagnostics);
|
|
1033
|
+
images.push(...stripped.images);
|
|
1034
|
+
referencedPaths.push(...stripped.referencedPaths);
|
|
1035
|
+
text += `${prefix}${stripped.text}${suffix}`;
|
|
1036
|
+
lastIndex = index + full.length;
|
|
1037
|
+
}
|
|
1038
|
+
text += input.slice(lastIndex);
|
|
1039
|
+
return { text, images, diagnostics, referencedPaths };
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export {
|
|
1043
|
+
toContextOverflowError,
|
|
1044
|
+
notConfiguredNotice,
|
|
1045
|
+
extractText,
|
|
1046
|
+
extractUserText,
|
|
1047
|
+
extractThinking,
|
|
1048
|
+
terminalFailureFromAssistantMessage,
|
|
1049
|
+
isSelfExplainingAbort,
|
|
1050
|
+
isLengthStopAssistantMessage,
|
|
1051
|
+
isEmptyAbortedAssistantMessage,
|
|
1052
|
+
hasStructuredToolCall,
|
|
1053
|
+
toolNamesFromAgentState,
|
|
1054
|
+
noticeMessage,
|
|
1055
|
+
pendingSkillRequestPreamble,
|
|
1056
|
+
toolSignatureFromState,
|
|
1057
|
+
fallbackIdentityPrompt,
|
|
1058
|
+
createPendingSkillToolPolicy,
|
|
1059
|
+
createAskUserToolPolicy,
|
|
1060
|
+
sumRunUsage,
|
|
1061
|
+
backendCacheVerdict,
|
|
1062
|
+
assistantSessionPayload,
|
|
1063
|
+
estimatedUsageForInterruptedTurn,
|
|
1064
|
+
hasPersistableAssistantContent,
|
|
1065
|
+
recordValue,
|
|
1066
|
+
toolResultSummary,
|
|
1067
|
+
runtimeSupportsTools,
|
|
1068
|
+
detectTerminalFailureFromState,
|
|
1069
|
+
pruneFailedAssistantFromContext,
|
|
1070
|
+
detectOverflowFromState,
|
|
1071
|
+
setupSteerChannel,
|
|
1072
|
+
projectHeadlessJsonEvent,
|
|
1073
|
+
projectDispatchJsonEvent,
|
|
1074
|
+
readFileArgsAsync,
|
|
1075
|
+
expandInlineFileReferencesAsync
|
|
1076
|
+
};
|
|
1077
|
+
//# sourceMappingURL=chunk-KJ5LWLOE.js.map
|