@qvac/harness 1.0.0-rc.0 → 1.0.0-rc.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 +1168 -1
- package/NOTICE.md +16 -0
- package/README.md +278 -471
- package/dist-lib/index.d.ts +101 -169
- package/dist-lib/index.js +423 -1506
- package/dist-lib/lib/addon-seal.bare.d.ts +1 -0
- package/dist-lib/lib/addon-seal.bare.js +3 -0
- package/dist-lib/lib/addon-seal.node.d.ts +1 -0
- package/dist-lib/lib/addon-seal.node.js +1 -0
- package/dist-lib/lib/agent/delegate.d.ts +83 -0
- package/dist-lib/lib/agent/delegate.js +261 -0
- package/dist-lib/lib/agent/follow.d.ts +32 -0
- package/dist-lib/lib/agent/follow.js +162 -0
- package/dist-lib/lib/agent/index.d.ts +37 -0
- package/dist-lib/lib/agent/index.js +42 -0
- package/dist-lib/lib/agent/plan.d.ts +6 -0
- package/dist-lib/lib/agent/plan.js +74 -0
- package/dist-lib/lib/agent/resolve.d.ts +3 -0
- package/dist-lib/lib/agent/resolve.js +78 -0
- package/dist-lib/lib/{capabilities → agent}/tool-names.d.ts +0 -1
- package/dist-lib/lib/{capabilities → agent}/tool-names.js +0 -1
- package/dist-lib/lib/{capabilities → agent}/tool-selection.d.ts +3 -6
- package/dist-lib/lib/{capabilities → agent}/tool-selection.js +9 -1
- package/dist-lib/lib/agent/tools.d.ts +14 -0
- package/dist-lib/lib/agent/tools.js +16 -0
- package/dist-lib/lib/agent/transfer.d.ts +7 -0
- package/dist-lib/lib/agent/transfer.js +26 -0
- package/dist-lib/lib/capabilities/agent-ports.d.ts +3 -0
- package/dist-lib/lib/capabilities/agent-ports.js +9 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +25 -9
- package/dist-lib/lib/capabilities/completion-engine/actors/batching.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/batching.js +90 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +14 -5
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.d.ts +5 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.js +8 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.d.ts +29 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +100 -40
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.d.ts +11 -10
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +28 -21
- package/dist-lib/lib/capabilities/completion-engine/actors/finishing.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +67 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.d.ts +10 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +14 -11
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.d.ts +7 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +30 -31
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.d.ts +3 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +86 -102
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +24 -7
- package/dist-lib/lib/capabilities/completion-engine/actors/rejection.d.ts +4 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/rejection.js +8 -8
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +73 -15
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.d.ts +10 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +56 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +74 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +76 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +84 -26
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +16 -6
- package/dist-lib/lib/capabilities/completion-engine/actors.d.ts +11 -0
- package/dist-lib/lib/capabilities/completion-engine/actors.js +216 -0
- package/dist-lib/lib/capabilities/completion-engine/driver.d.ts +12 -5
- package/dist-lib/lib/capabilities/completion-engine/driver.js +118 -33
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/durable.js +6 -4
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +65 -0
- package/dist-lib/lib/{machine → capabilities/completion-engine}/engine.js +67 -130
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +30 -0
- package/dist-lib/lib/capabilities/completion-engine/index.js +44 -0
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +58 -0
- package/dist-lib/lib/capabilities/completion-engine/loop.js +62 -0
- package/dist-lib/lib/capabilities/completion-engine/metrics.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/metrics.js +46 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.d.ts +5 -2
- package/dist-lib/lib/capabilities/completion-engine/operations.js +84 -15
- package/dist-lib/lib/capabilities/completion-engine/ports.d.ts +25 -2
- package/dist-lib/lib/capabilities/completion-engine/ports.js +25 -16
- package/dist-lib/lib/capabilities/completion-engine/prepare-step.d.ts +26 -0
- package/dist-lib/lib/{machine → capabilities/completion-engine}/replay-output.d.ts +1 -1
- package/dist-lib/lib/{machine → capabilities/completion-engine}/replay-output.js +1 -1
- package/dist-lib/lib/capabilities/{completion-loop → completion-engine}/round.d.ts +24 -4
- package/dist-lib/lib/capabilities/{completion-loop → completion-engine}/round.js +242 -27
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +19 -12
- package/dist-lib/lib/capabilities/completion-engine/session.js +12 -6
- package/dist-lib/lib/capabilities/completion-engine/splice.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/splice.js +7 -0
- package/dist-lib/lib/capabilities/completion-engine/stages.d.ts +23 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.d.ts +10 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +151 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +77 -0
- package/dist-lib/lib/capabilities/{completion-loop → completion-engine}/tool-execution.js +74 -25
- package/dist-lib/lib/capabilities/{completion-loop → completion-engine}/turns.d.ts +8 -4
- package/dist-lib/lib/capabilities/completion-engine/turns.js +225 -0
- package/dist-lib/lib/capabilities/enhance.d.ts +1 -1
- package/dist-lib/lib/capabilities/enhance.js +3 -2
- package/dist-lib/lib/capabilities/invoke.d.ts +1 -1
- package/dist-lib/lib/capabilities/preview-model-source.d.ts +1 -10
- package/dist-lib/lib/capabilities/preview-model-source.js +3 -1
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +10 -0
- package/dist-lib/lib/capabilities/sdk-tool.js +130 -0
- package/dist-lib/lib/capabilities/skill-entry.d.ts +8 -0
- package/dist-lib/lib/capabilities/skill-entry.js +14 -0
- package/dist-lib/lib/capabilities/tool-plan.d.ts +6 -5
- package/dist-lib/lib/capabilities/tool-plan.js +16 -10
- package/dist-lib/lib/capabilities/tool-turns.d.ts +29 -4
- package/dist-lib/lib/capabilities/tool-turns.js +120 -10
- package/dist-lib/lib/capabilities/usage-breakdown.d.ts +1 -1
- package/dist-lib/lib/capabilities/usage-breakdown.js +4 -1
- package/dist-lib/lib/connect.d.ts +6 -0
- package/dist-lib/lib/connect.js +153 -65
- package/dist-lib/lib/context-window.d.ts +4 -2
- package/dist-lib/lib/context-window.js +27 -16
- package/dist-lib/lib/contract/agent.d.ts +65 -0
- package/dist-lib/lib/{capabilities/types.d.ts → contract/completion.d.ts} +140 -26
- package/dist-lib/lib/contract/exec.d.ts +134 -0
- package/dist-lib/lib/{hooks/types.d.ts → contract/hooks.d.ts} +62 -10
- package/dist-lib/lib/contract/index.d.ts +5 -0
- package/dist-lib/lib/contract/knowledge.d.ts +60 -0
- package/dist-lib/lib/contract/knowledge.js +1 -0
- package/dist-lib/lib/contract/models.d.ts +56 -0
- package/dist-lib/lib/contract/models.js +1 -0
- package/dist-lib/lib/contract/run.d.ts +142 -0
- package/dist-lib/lib/contract/run.js +1 -0
- package/dist-lib/lib/contract/sandbox.d.ts +29 -0
- package/dist-lib/lib/contract/sandbox.js +1 -0
- package/dist-lib/lib/contract/skill-readiness.d.ts +14 -0
- package/dist-lib/lib/contract/skill-readiness.js +1 -0
- package/dist-lib/lib/{capabilities/voice.d.ts → contract/speech.d.ts} +11 -16
- package/dist-lib/lib/contract/speech.js +1 -0
- package/dist-lib/lib/contract-types.d.ts +43 -16
- package/dist-lib/lib/docx/index.d.ts +0 -1
- package/dist-lib/lib/docx/index.js +15 -24
- package/dist-lib/lib/embeddings/index.d.ts +63 -0
- package/dist-lib/lib/embeddings/index.js +267 -0
- package/dist-lib/lib/fold/index.d.ts +50 -0
- package/dist-lib/lib/fold/index.js +123 -0
- package/dist-lib/lib/{tools/exec/adapters/python/guarded-fetch.d.ts → guarded-fetch.d.ts} +5 -12
- package/dist-lib/lib/{tools/exec/adapters/python/guarded-fetch.js → guarded-fetch.js} +12 -34
- package/dist-lib/lib/helpers/completion-params.d.ts +3 -0
- package/dist-lib/lib/helpers/completion-params.js +12 -0
- package/dist-lib/lib/helpers/copy.d.ts +1 -0
- package/dist-lib/lib/helpers/copy.js +5 -0
- package/dist-lib/lib/helpers/drain.d.ts +5 -0
- package/dist-lib/lib/helpers/drain.js +19 -0
- package/dist-lib/lib/{machine/errors.d.ts → helpers/engine-error.d.ts} +6 -9
- package/dist-lib/lib/{machine/errors.js → helpers/engine-error.js} +9 -25
- package/dist-lib/lib/helpers/failure-result.d.ts +21 -0
- package/dist-lib/lib/helpers/failure-result.js +39 -0
- package/dist-lib/lib/helpers/head-tail.d.ts +7 -0
- package/dist-lib/lib/helpers/head-tail.js +19 -0
- package/dist-lib/lib/helpers/image-settings.d.ts +2 -0
- package/dist-lib/lib/helpers/image-settings.js +19 -0
- package/dist-lib/lib/helpers/mcp-methods.d.ts +2 -0
- package/dist-lib/lib/helpers/mcp-methods.js +14 -0
- package/dist-lib/lib/helpers/race-abort.d.ts +1 -1
- package/dist-lib/lib/helpers/race-abort.js +1 -1
- package/dist-lib/lib/helpers/repeated-reply.d.ts +2 -0
- package/dist-lib/lib/helpers/repeated-reply.js +63 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +5 -4
- package/dist-lib/lib/helpers/run-outcome.js +11 -9
- package/dist-lib/lib/{machine → helpers}/stable-stringify.js +1 -1
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +1 -0
- package/dist-lib/lib/helpers/tool-call-markup.js +9 -5
- package/dist-lib/lib/helpers/tool-label.d.ts +2 -2
- package/dist-lib/lib/helpers/tool-label.js +3 -3
- package/dist-lib/lib/hooks/built-in/arg-repair.d.ts +1 -1
- package/dist-lib/lib/hooks/built-in/arg-repair.js +109 -19
- package/dist-lib/lib/hooks/built-in/egress.d.ts +1 -1
- package/dist-lib/lib/hooks/built-in/egress.js +13 -21
- package/dist-lib/lib/hooks/built-in/sandbox.d.ts +1 -1
- package/dist-lib/lib/hooks/built-in/skill-catalog.d.ts +1 -1
- package/dist-lib/lib/hooks/index.d.ts +48 -0
- package/dist-lib/lib/hooks/index.js +130 -0
- package/dist-lib/lib/hooks/run.d.ts +9 -6
- package/dist-lib/lib/hooks/run.js +113 -48
- package/dist-lib/lib/{completion-lifecycle.d.ts → lifecycle/completion-run.d.ts} +1 -1
- package/dist-lib/lib/{completion-lifecycle.js → lifecycle/completion-run.js} +1 -1
- package/dist-lib/lib/lifecycle/index.d.ts +83 -0
- package/dist-lib/lib/lifecycle/index.js +335 -0
- package/dist-lib/lib/{harness-lifecycle.js → lifecycle/machine.js} +2 -2
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +11 -2
- package/dist-lib/lib/machine/completion/actions/completion.js +98 -14
- package/dist-lib/lib/machine/completion/actions/prepare.d.ts +9 -0
- package/dist-lib/lib/machine/completion/actions/prepare.js +30 -0
- package/dist-lib/lib/machine/completion/actions/tools.d.ts +10 -1
- package/dist-lib/lib/machine/completion/actions/tools.js +79 -7
- package/dist-lib/lib/machine/completion/context.d.ts +7 -2
- package/dist-lib/lib/machine/completion/context.js +29 -5
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +1 -0
- package/dist-lib/lib/machine/completion/guards/retry.js +6 -3
- package/dist-lib/lib/machine/completion/implementations.d.ts +38 -12
- package/dist-lib/lib/machine/completion/implementations.js +81 -31
- package/dist-lib/lib/machine/completion/machine.d.ts +140 -63
- package/dist-lib/lib/machine/completion/machine.js +194 -58
- package/dist-lib/lib/machine/completion/ports.d.ts +7 -55
- package/dist-lib/lib/machine/completion/ports.js +1 -224
- package/dist-lib/lib/machine/completion/rules.d.ts +20 -19
- package/dist-lib/lib/machine/completion/rules.js +73 -52
- package/dist-lib/lib/machine/completion/types.d.ts +110 -187
- package/dist-lib/lib/machine/completion/version.d.ts +1 -0
- package/dist-lib/lib/machine/completion/version.js +1 -0
- package/dist-lib/lib/machine/definition.d.ts +23 -0
- package/dist-lib/lib/machine/definition.js +76 -0
- package/dist-lib/lib/machine/index.d.ts +463 -20
- package/dist-lib/lib/machine/index.js +15 -11
- package/dist-lib/lib/models/llm-presets.d.ts +1 -0
- package/dist-lib/lib/models/model-catalog-constants.d.ts +3 -1
- package/dist-lib/lib/models/model-catalog-constants.js +9 -1
- package/dist-lib/lib/models/model-catalog.d.ts +31 -4
- package/dist-lib/lib/models/model-catalog.js +89 -8
- package/dist-lib/lib/models/model-fit.d.ts +55 -0
- package/dist-lib/lib/models/model-fit.js +102 -0
- package/dist-lib/lib/models/model-handle.d.ts +4 -0
- package/dist-lib/lib/models/model-handle.js +8 -1
- package/dist-lib/lib/models/model-list.d.ts +4 -0
- package/dist-lib/lib/models/model-pool.d.ts +35 -10
- package/dist-lib/lib/models/model-pool.js +63 -14
- package/dist-lib/lib/models/music-catalog.d.ts +1 -1
- package/dist-lib/lib/models/music-catalog.js +8 -1
- package/dist-lib/lib/models/sdk-faults.d.ts +2 -0
- package/dist-lib/lib/models/sdk-faults.js +18 -0
- package/dist-lib/lib/models/tts-model-default.js +3 -3
- package/dist-lib/lib/office/engine/codes.d.ts +62 -0
- package/dist-lib/lib/office/engine/codes.js +61 -0
- package/dist-lib/lib/office/engine/docx/document.d.ts +216 -0
- package/dist-lib/lib/office/engine/docx/document.js +1152 -0
- package/dist-lib/lib/office/engine/docx/index.d.ts +7 -0
- package/dist-lib/lib/office/engine/docx/index.js +8 -0
- package/dist-lib/lib/office/engine/docx/styles.d.ts +31 -0
- package/dist-lib/lib/office/engine/docx/styles.js +173 -0
- package/dist-lib/lib/office/engine/docx/template.d.ts +18 -0
- package/dist-lib/lib/office/engine/docx/template.js +133 -0
- package/dist-lib/lib/office/engine/docx/text.d.ts +55 -0
- package/dist-lib/lib/office/engine/docx/text.js +538 -0
- package/dist-lib/lib/office/engine/drawingml/chart.d.ts +63 -0
- package/dist-lib/lib/office/engine/drawingml/chart.js +539 -0
- package/dist-lib/lib/office/engine/drawingml/text.d.ts +35 -0
- package/dist-lib/lib/office/engine/drawingml/text.js +352 -0
- package/dist-lib/lib/office/engine/errors.d.ts +6 -0
- package/dist-lib/lib/office/engine/errors.js +12 -0
- package/dist-lib/lib/office/engine/image.d.ts +8 -0
- package/dist-lib/lib/office/engine/image.js +48 -0
- package/dist-lib/lib/office/engine/index.d.ts +12 -0
- package/dist-lib/lib/office/engine/index.js +7 -0
- package/dist-lib/lib/office/engine/opc/content-types.d.ts +17 -0
- package/dist-lib/lib/office/engine/opc/content-types.js +74 -0
- package/dist-lib/lib/office/engine/opc/media.d.ts +13 -0
- package/dist-lib/lib/office/engine/opc/media.js +11 -0
- package/dist-lib/lib/office/engine/opc/package.d.ts +51 -0
- package/dist-lib/lib/office/engine/opc/package.js +324 -0
- package/dist-lib/lib/office/engine/opc/paths.d.ts +7 -0
- package/dist-lib/lib/office/engine/opc/paths.js +46 -0
- package/dist-lib/lib/office/engine/opc/properties.d.ts +7 -0
- package/dist-lib/lib/office/engine/opc/properties.js +75 -0
- package/dist-lib/lib/office/engine/opc/relationships.d.ts +23 -0
- package/dist-lib/lib/office/engine/opc/relationships.js +65 -0
- package/dist-lib/lib/office/engine/opc/zip.d.ts +15 -0
- package/dist-lib/lib/office/engine/opc/zip.js +264 -0
- package/dist-lib/lib/office/engine/pptx/fit.d.ts +12 -0
- package/dist-lib/lib/office/engine/pptx/fit.js +37 -0
- package/dist-lib/lib/office/engine/pptx/index.d.ts +8 -0
- package/dist-lib/lib/office/engine/pptx/index.js +8 -0
- package/dist-lib/lib/office/engine/pptx/inherit.d.ts +29 -0
- package/dist-lib/lib/office/engine/pptx/inherit.js +155 -0
- package/dist-lib/lib/office/engine/pptx/notes.d.ts +5 -0
- package/dist-lib/lib/office/engine/pptx/notes.js +85 -0
- package/dist-lib/lib/office/engine/pptx/presentation.d.ts +54 -0
- package/dist-lib/lib/office/engine/pptx/presentation.js +749 -0
- package/dist-lib/lib/office/engine/pptx/read.d.ts +9 -0
- package/dist-lib/lib/office/engine/pptx/read.js +66 -0
- package/dist-lib/lib/office/engine/pptx/shapes.d.ts +52 -0
- package/dist-lib/lib/office/engine/pptx/shapes.js +276 -0
- package/dist-lib/lib/office/engine/pptx/slides.d.ts +27 -0
- package/dist-lib/lib/office/engine/pptx/slides.js +123 -0
- package/dist-lib/lib/office/engine/pptx/template.d.ts +20 -0
- package/dist-lib/lib/office/engine/pptx/template.js +391 -0
- package/dist-lib/lib/office/engine/pptx/types.d.ts +120 -0
- package/dist-lib/lib/office/engine/pptx/types.js +1 -0
- package/dist-lib/lib/office/engine/units.d.ts +3 -0
- package/dist-lib/lib/office/engine/units.js +12 -0
- package/dist-lib/lib/office/engine/utf8.d.ts +2 -0
- package/dist-lib/lib/office/engine/utf8.js +103 -0
- package/dist-lib/lib/office/engine/xlsx/formula.d.ts +49 -0
- package/dist-lib/lib/office/engine/xlsx/formula.js +381 -0
- package/dist-lib/lib/office/engine/xlsx/index.d.ts +8 -0
- package/dist-lib/lib/office/engine/xlsx/index.js +8 -0
- package/dist-lib/lib/office/engine/xlsx/refs.d.ts +22 -0
- package/dist-lib/lib/office/engine/xlsx/refs.js +82 -0
- package/dist-lib/lib/office/engine/xlsx/reshape.d.ts +21 -0
- package/dist-lib/lib/office/engine/xlsx/reshape.js +424 -0
- package/dist-lib/lib/office/engine/xlsx/sheet.d.ts +108 -0
- package/dist-lib/lib/office/engine/xlsx/sheet.js +662 -0
- package/dist-lib/lib/office/engine/xlsx/strings.d.ts +15 -0
- package/dist-lib/lib/office/engine/xlsx/strings.js +93 -0
- package/dist-lib/lib/office/engine/xlsx/styles.d.ts +38 -0
- package/dist-lib/lib/office/engine/xlsx/styles.js +369 -0
- package/dist-lib/lib/office/engine/xlsx/template.d.ts +7 -0
- package/dist-lib/lib/office/engine/xlsx/template.js +54 -0
- package/dist-lib/lib/office/engine/xlsx/workbook.d.ts +161 -0
- package/dist-lib/lib/office/engine/xlsx/workbook.js +850 -0
- package/dist-lib/lib/office/engine/xlsx/write.d.ts +2 -0
- package/dist-lib/lib/office/engine/xlsx/write.js +42 -0
- package/dist-lib/lib/office/engine/xml.d.ts +45 -0
- package/dist-lib/lib/office/engine/xml.js +258 -0
- package/dist-lib/lib/office/extract.d.ts +9 -0
- package/dist-lib/lib/office/extract.js +19 -0
- package/dist-lib/lib/office/index.d.ts +1 -1
- package/dist-lib/lib/office/index.js +74 -19
- package/dist-lib/lib/plugins/addons.d.ts +2 -0
- package/dist-lib/lib/plugins/addons.js +12 -0
- package/dist-lib/lib/plugins/context.d.ts +16 -0
- package/dist-lib/lib/plugins/context.js +48 -0
- package/dist-lib/lib/plugins/index.d.ts +3 -0
- package/dist-lib/lib/plugins/index.js +1 -0
- package/dist-lib/lib/plugins/registry.d.ts +116 -0
- package/dist-lib/lib/plugins/registry.js +505 -0
- package/dist-lib/lib/plugins/runtime.d.ts +27 -0
- package/dist-lib/lib/plugins/runtime.js +143 -0
- package/dist-lib/lib/plugins/scope.d.ts +17 -0
- package/dist-lib/lib/plugins/scope.js +55 -0
- package/dist-lib/lib/prompt.d.ts +2 -5
- package/dist-lib/lib/prompt.js +9 -0
- package/dist-lib/lib/residency/completion-runtime.d.ts +52 -0
- package/dist-lib/lib/{capabilities → residency}/completion-runtime.js +22 -15
- package/dist-lib/lib/residency/index.d.ts +148 -0
- package/dist-lib/lib/residency/index.js +539 -0
- package/dist-lib/lib/run-log/boundary.d.ts +17 -0
- package/dist-lib/lib/run-log/boundary.js +58 -0
- package/dist-lib/lib/run-log/history-codec.d.ts +7 -6
- package/dist-lib/lib/run-log/history-codec.js +175 -46
- package/dist-lib/lib/run-log/index.d.ts +46 -0
- package/dist-lib/lib/run-log/index.js +40 -0
- package/dist-lib/lib/run-log/inspect.d.ts +53 -0
- package/dist-lib/lib/{run-log-inspect.js → run-log/inspect.js} +196 -139
- package/dist-lib/lib/run-log/live.d.ts +37 -0
- package/dist-lib/lib/run-log/live.js +195 -0
- package/dist-lib/lib/run-log/persisted-actor.d.ts +1 -6
- package/dist-lib/lib/run-log/persisted-actor.js +4 -3
- package/dist-lib/lib/run-log/protocol-types.d.ts +37 -14
- package/dist-lib/lib/run-log/protocol.d.ts +1 -2
- package/dist-lib/lib/run-log/protocol.js +45 -40
- package/dist-lib/lib/{run-log-redact.d.ts → run-log/redact.d.ts} +3 -2
- package/dist-lib/lib/{run-log-redact.js → run-log/redact.js} +101 -16
- package/dist-lib/lib/run-log/replay.d.ts +3 -2
- package/dist-lib/lib/run-log/replay.js +7 -6
- package/dist-lib/lib/run-log/request-codec.d.ts +17 -0
- package/dist-lib/lib/run-log/request-codec.js +87 -0
- package/dist-lib/lib/run-log/run-journal.d.ts +14 -8
- package/dist-lib/lib/run-log/run-journal.js +100 -75
- package/dist-lib/lib/sdk-loader.d.ts +2 -7
- package/dist-lib/lib/sdk-loader.js +8 -15
- package/dist-lib/lib/sdk-storage.js +3 -1
- package/dist-lib/lib/serve.js +139 -38
- package/dist-lib/lib/skills-host/index.d.ts +59 -0
- package/dist-lib/lib/skills-host/index.js +268 -0
- package/dist-lib/lib/spawn.d.ts +37 -3
- package/dist-lib/lib/spawn.js +7 -3
- package/dist-lib/lib/spill.d.ts +11 -0
- package/dist-lib/lib/spill.js +82 -0
- package/dist-lib/lib/tools/{exec/adapters/python → attachments}/output-policy.d.ts +2 -3
- package/dist-lib/lib/tools/{exec/adapters/python/attachments.d.ts → attachments/staging.d.ts} +2 -2
- package/dist-lib/lib/tools/{exec/adapters/python/attachments.js → attachments/staging.js} +3 -3
- package/dist-lib/lib/tools/catalog.d.ts +1 -1
- package/dist-lib/lib/tools/catalog.js +1 -1
- package/dist-lib/lib/tools/create-documents.d.ts +1 -1
- package/dist-lib/lib/tools/edit-documents.d.ts +1 -1
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.d.ts +5 -7
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +3 -2
- package/dist-lib/lib/tools/exec/bare-runtime.js +2 -4
- package/dist-lib/lib/tools/exec/python-source.d.ts +6 -0
- package/dist-lib/lib/tools/exec/python-source.js +243 -0
- package/dist-lib/lib/tools/exec/runner.d.ts +24 -45
- package/dist-lib/lib/tools/exec/runner.js +68 -34
- package/dist-lib/lib/tools/exec/scope.d.ts +2 -0
- package/dist-lib/lib/tools/exec/scope.js +33 -2
- package/dist-lib/lib/tools/exec/shell-guidance.d.ts +11 -9
- package/dist-lib/lib/tools/exec/shell-guidance.js +28 -57
- package/dist-lib/lib/tools/exec/video-tools.d.ts +0 -1
- package/dist-lib/lib/tools/exec/video-tools.js +0 -5
- package/dist-lib/lib/tools/exec.d.ts +7 -14
- package/dist-lib/lib/tools/exec.js +181 -457
- package/dist-lib/lib/tools/file-glob.d.ts +1 -1
- package/dist-lib/lib/tools/file-glob.js +1 -0
- package/dist-lib/lib/tools/fs/scope.d.ts +1 -0
- package/dist-lib/lib/tools/fs/scope.js +8 -3
- package/dist-lib/lib/tools/grep.d.ts +1 -1
- package/dist-lib/lib/tools/grep.js +1 -0
- package/dist-lib/lib/tools/http-request.d.ts +1 -1
- package/dist-lib/lib/tools/http-request.js +1 -0
- package/dist-lib/lib/tools/index.d.ts +21 -0
- package/dist-lib/lib/tools/index.js +46 -0
- package/dist-lib/lib/tools/office/ops.d.ts +13 -0
- package/dist-lib/lib/tools/office/ops.js +100 -0
- package/dist-lib/lib/tools/office.d.ts +12 -0
- package/dist-lib/lib/tools/office.js +486 -0
- package/dist-lib/lib/tools/operations/compile.d.ts +3 -3
- package/dist-lib/lib/tools/operations/compile.js +2 -1
- package/dist-lib/lib/tools/operations/decoders.js +1 -1
- package/dist-lib/lib/tools/operations/manifest.d.ts +1 -1
- package/dist-lib/lib/tools/outbound-guard.d.ts +3 -1
- package/dist-lib/lib/tools/outbound-guard.js +4 -0
- package/dist-lib/lib/tools/pdf/build.d.ts +43 -0
- package/dist-lib/lib/tools/pdf/build.js +150 -0
- package/dist-lib/lib/tools/pdf/images.d.ts +7 -0
- package/dist-lib/lib/tools/pdf/images.js +82 -0
- package/dist-lib/lib/tools/pdf/request.d.ts +63 -0
- package/dist-lib/lib/tools/pdf/request.js +335 -0
- package/dist-lib/lib/tools/pdf.d.ts +6 -0
- package/dist-lib/lib/tools/pdf.js +303 -0
- package/dist-lib/lib/tools/read-files.d.ts +1 -1
- package/dist-lib/lib/tools/read-files.js +5 -1
- package/dist-lib/lib/tools/skill.d.ts +2 -4
- package/dist-lib/lib/tools/skill.js +20 -22
- package/dist-lib/lib/tools/skills/auth-resolver.d.ts +1 -1
- package/dist-lib/lib/tools/skills/catalog.d.ts +9 -2
- package/dist-lib/lib/tools/skills/catalog.js +7 -7
- package/dist-lib/lib/tools/skills/cli-schema.js +1 -1
- package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +1 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +1 -0
- package/dist-lib/lib/tools/skills/mention.d.ts +1 -2
- package/dist-lib/lib/tools/skills/mention.js +0 -3
- package/dist-lib/lib/tools/skills/scope-key.d.ts +2 -1
- package/dist-lib/lib/tools/skills/scope-key.js +2 -3
- package/dist-lib/lib/tools/skills/skill-state.d.ts +2 -2
- package/dist-lib/lib/tools/skills/skill-state.js +11 -28
- package/dist-lib/lib/tools/toolsets.d.ts +3 -7
- package/dist-lib/lib/tools/toolsets.js +5 -9
- package/dist-lib/lib/tools/web-fetch.d.ts +1 -1
- package/dist-lib/lib/tools/web-fetch.js +42 -6
- package/dist-lib/lib/web-fetch/embedded-state.js +1 -1
- package/dist-lib/lib/web-fetch/extract.js +1 -1
- package/dist-lib/lib/web-fetch/images.js +1 -1
- package/dist-lib/lib/web-fetch/video.js +1 -1
- package/dist-lib/lib/wire.d.ts +8 -0
- package/dist-lib/lib/wire.js +112 -2
- package/dist-lib/plugins/code-mode/index.d.ts +16 -0
- package/dist-lib/plugins/code-mode/index.js +43 -0
- package/dist-lib/plugins/coding/index.d.ts +15 -0
- package/dist-lib/plugins/coding/index.js +42 -0
- package/dist-lib/plugins/coding/jobs.d.ts +24 -0
- package/dist-lib/plugins/coding/jobs.js +144 -0
- package/dist-lib/plugins/coding/session.d.ts +51 -0
- package/dist-lib/plugins/coding/session.js +263 -0
- package/dist-lib/plugins/coding/write-file.d.ts +3 -0
- package/dist-lib/plugins/coding/write-file.js +52 -0
- package/dist-lib/plugins/command-hooks/index.d.ts +88 -0
- package/dist-lib/plugins/command-hooks/index.js +338 -0
- package/dist-lib/plugins/external-agents/acp.d.ts +27 -0
- package/dist-lib/plugins/external-agents/acp.js +264 -0
- package/dist-lib/plugins/external-agents/cli.d.ts +3 -0
- package/dist-lib/plugins/external-agents/cli.js +199 -0
- package/dist-lib/plugins/external-agents/index.d.ts +25 -0
- package/dist-lib/plugins/external-agents/index.js +54 -0
- package/dist-lib/plugins/external-agents/process.d.ts +19 -0
- package/dist-lib/plugins/external-agents/process.js +92 -0
- package/dist-lib/plugins/external-agents/targets.d.ts +32 -0
- package/dist-lib/plugins/external-agents/targets.js +66 -0
- package/dist-lib/{lib/tools → plugins/image}/edit-image.d.ts +3 -2
- package/dist-lib/{lib/tools → plugins/image}/edit-image.js +7 -2
- package/dist-lib/{lib/tools → plugins/image}/generate-image.d.ts +6 -12
- package/dist-lib/{lib/tools → plugins/image}/generate-image.js +6 -7
- package/dist-lib/plugins/image/index.d.ts +25 -0
- package/dist-lib/plugins/image/index.js +76 -0
- package/dist-lib/plugins/knowledge/index.d.ts +21 -0
- package/dist-lib/plugins/knowledge/index.js +47 -0
- package/dist-lib/plugins/knowledge/search-tool.d.ts +4 -0
- package/dist-lib/plugins/knowledge/search-tool.js +38 -0
- package/dist-lib/plugins/knowledge/store.d.ts +42 -0
- package/dist-lib/plugins/knowledge/store.js +332 -0
- package/dist-lib/plugins/lsp/index.d.ts +32 -0
- package/dist-lib/plugins/lsp/index.js +77 -0
- package/dist-lib/plugins/lsp/pool.d.ts +24 -0
- package/dist-lib/plugins/lsp/pool.js +73 -0
- package/dist-lib/plugins/lsp/rpc.d.ts +37 -0
- package/dist-lib/plugins/lsp/rpc.js +145 -0
- package/dist-lib/plugins/lsp/server.d.ts +55 -0
- package/dist-lib/plugins/lsp/server.js +192 -0
- package/dist-lib/plugins/lsp/tool.d.ts +12 -0
- package/dist-lib/plugins/lsp/tool.js +366 -0
- package/dist-lib/plugins/mcp/call.d.ts +17 -0
- package/dist-lib/{lib/tools/mcp-call.js → plugins/mcp/call.js} +92 -84
- package/dist-lib/plugins/mcp/index.d.ts +21 -0
- package/dist-lib/plugins/mcp/index.js +85 -0
- package/dist-lib/{lib/tools → plugins}/mcp/protocol.d.ts +9 -16
- package/dist-lib/{lib/tools → plugins}/mcp/protocol.js +3 -16
- package/dist-lib/plugins/mcp/server.d.ts +23 -0
- package/dist-lib/plugins/mcp/server.js +108 -0
- package/dist-lib/{lib/tools → plugins/music}/generate-music.d.ts +6 -15
- package/dist-lib/{lib/tools → plugins/music}/generate-music.js +7 -8
- package/dist-lib/plugins/music/index.d.ts +24 -0
- package/dist-lib/plugins/music/index.js +48 -0
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/cli-process.d.ts +2 -2
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/cli-process.js +2 -2
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/cli.d.ts +1 -1
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/cli.js +7 -7
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/command.js +1 -1
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/guidance.d.ts +0 -1
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/guidance.js +0 -7
- package/dist-lib/plugins/obsidian/index.d.ts +26 -0
- package/dist-lib/plugins/obsidian/index.js +138 -0
- package/dist-lib/{lib/tools/skills/obsidian-readiness.d.ts → plugins/obsidian/readiness.d.ts} +1 -0
- package/dist-lib/{lib/tools/skills/obsidian-readiness.js → plugins/obsidian/readiness.js} +7 -0
- package/dist-lib/plugins/python/guarded-fetch.d.ts +13 -0
- package/dist-lib/plugins/python/guarded-fetch.js +32 -0
- package/dist-lib/plugins/python/index.d.ts +18 -0
- package/dist-lib/plugins/python/index.js +19 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/interrupt-timer.js +2 -2
- package/dist-lib/plugins/python/language.d.ts +8 -0
- package/dist-lib/plugins/python/language.js +377 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/loader.d.ts +1 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/loader.js +8 -1
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/memfs.js +3 -3
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/module-distributions.js +0 -3
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/pyodide.js +4 -4
- package/dist-lib/plugins/python/python-adapter.d.ts +41 -0
- package/dist-lib/plugins/python/python-adapter.js +515 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/run-session.d.ts +1 -2
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/run-session.js +10 -99
- package/dist-lib/plugins/python/shell-redirect.d.ts +8 -0
- package/dist-lib/plugins/python/shell-redirect.js +25 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/wheels.js +5 -3
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/active.js +1 -1
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/client.d.ts +1 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/client.js +6 -3
- package/dist-lib/plugins/python/worker/entry.d.ts +1 -0
- package/dist-lib/plugins/python/worker/entry.js +9 -0
- package/dist-lib/plugins/python/worker/interrupt-deadline.d.ts +1 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/interrupt-deadline.js +1 -1
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/serve.js +2 -2
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/spawn.d.ts +1 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/spawn.js +7 -0
- package/dist-lib/plugins/quickjs/index.d.ts +20 -0
- package/dist-lib/plugins/quickjs/index.js +25 -0
- package/dist-lib/plugins/quickjs/language.d.ts +3 -0
- package/dist-lib/plugins/quickjs/language.js +59 -0
- package/dist-lib/plugins/quickjs/runtime.d.ts +38 -0
- package/dist-lib/plugins/quickjs/runtime.js +421 -0
- package/dist-lib/plugins/quickjs/text-decoder.d.ts +1 -0
- package/dist-lib/plugins/quickjs/text-decoder.js +15 -0
- package/dist-lib/plugins/run-report/brand.d.ts +1 -0
- package/dist-lib/plugins/run-report/brand.js +1 -0
- package/dist-lib/plugins/run-report/flow-view.d.ts +6 -0
- package/dist-lib/plugins/run-report/flow-view.js +53 -0
- package/dist-lib/plugins/run-report/flow.d.ts +33 -0
- package/dist-lib/plugins/run-report/flow.js +201 -0
- package/dist-lib/plugins/run-report/index.d.ts +17 -0
- package/dist-lib/plugins/run-report/index.js +27 -0
- package/dist-lib/plugins/run-report/layout.d.ts +39 -0
- package/dist-lib/plugins/run-report/layout.js +175 -0
- package/dist-lib/plugins/run-report/meaning.d.ts +6 -0
- package/dist-lib/plugins/run-report/meaning.js +43 -0
- package/dist-lib/plugins/run-report/model.d.ts +86 -0
- package/dist-lib/plugins/run-report/model.js +387 -0
- package/dist-lib/plugins/run-report/page.d.ts +13 -0
- package/dist-lib/plugins/run-report/page.js +234 -0
- package/dist-lib/plugins/run-report/script.d.ts +1 -0
- package/dist-lib/plugins/run-report/script.js +661 -0
- package/dist-lib/plugins/run-report/story.d.ts +48 -0
- package/dist-lib/plugins/run-report/story.js +188 -0
- package/dist-lib/plugins/run-report/style.d.ts +1 -0
- package/dist-lib/plugins/run-report/style.js +410 -0
- package/dist-lib/plugins/run-report/why.d.ts +28 -0
- package/dist-lib/plugins/run-report/why.js +170 -0
- package/dist-lib/plugins/sandbox-macos/index.d.ts +48 -0
- package/dist-lib/plugins/sandbox-macos/index.js +175 -0
- package/dist-lib/plugins/sandbox-vm/index.d.ts +24 -0
- package/dist-lib/plugins/sandbox-vm/index.js +27 -0
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +46 -0
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +106 -0
- package/dist-lib/{lib → plugins/speech}/audio-transcode-bare.js +2 -2
- package/dist-lib/plugins/speech/index.d.ts +17 -0
- package/dist-lib/plugins/speech/index.js +24 -0
- package/dist-lib/plugins/speech/speech-engine.d.ts +23 -0
- package/dist-lib/plugins/speech/speech-engine.js +55 -0
- package/dist-lib/plugins/speech/speech-runtime.d.ts +22 -0
- package/dist-lib/plugins/speech/speech-runtime.js +212 -0
- package/dist-lib/{lib/capabilities → plugins/speech}/speech-text.d.ts +1 -0
- package/dist-lib/{lib/capabilities → plugins/speech}/speech-text.js +10 -3
- package/dist-lib/plugins/speech/voice-lane.d.ts +2 -0
- package/dist-lib/plugins/speech/voice-lane.js +9 -0
- package/dist-lib/plugins/speech/voice.d.ts +17 -0
- package/dist-lib/{lib/capabilities → plugins/speech}/voice.js +27 -25
- package/dist-lib/plugins/translation/index.d.ts +22 -0
- package/dist-lib/plugins/translation/index.js +63 -0
- package/dist-lib/{lib/models → plugins/translation}/nmt-catalog.d.ts +0 -1
- package/dist-lib/{lib/models → plugins/translation}/nmt-catalog.js +0 -3
- package/dist-lib/{lib/tools → plugins/translation}/translate.d.ts +14 -6
- package/dist-lib/{lib/tools → plugins/translation}/translate.js +14 -8
- package/dist-lib/plugins/walkie-talkie/crew.d.ts +27 -0
- package/dist-lib/plugins/walkie-talkie/crew.js +103 -0
- package/dist-lib/plugins/walkie-talkie/index.d.ts +127 -0
- package/dist-lib/plugins/walkie-talkie/index.js +340 -0
- package/dist-lib/plugins/walkie-talkie/wire.d.ts +67 -0
- package/dist-lib/plugins/walkie-talkie/wire.js +136 -0
- package/dist-lib/plugins/weather/geocode.d.ts +25 -0
- package/dist-lib/plugins/weather/geocode.js +101 -0
- package/dist-lib/plugins/weather/index.d.ts +15 -0
- package/dist-lib/plugins/weather/index.js +17 -0
- package/dist-lib/plugins/weather/lookup.d.ts +6 -0
- package/dist-lib/plugins/weather/lookup.js +169 -0
- package/dist-lib/{lib/tools/weather-lookup → plugins/weather}/place.js +5 -1
- package/dist-lib/plugins/web-search/engine-registry.d.ts +44 -0
- package/dist-lib/plugins/web-search/engine-registry.js +17 -0
- package/dist-lib/{lib → plugins}/web-search/engines/aol.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/aol.js +5 -3
- package/dist-lib/{lib → plugins}/web-search/engines/bing.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/bing.js +9 -4
- package/dist-lib/{lib → plugins}/web-search/engines/brave.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/brave.js +5 -3
- package/dist-lib/{lib → plugins}/web-search/engines/duckduckgo.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/duckduckgo.js +5 -2
- package/dist-lib/{lib → plugins}/web-search/engines/google.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/google.js +6 -4
- package/dist-lib/{lib → plugins}/web-search/engines/wikipedia.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/wikipedia.js +5 -3
- package/dist-lib/{lib → plugins}/web-search/engines/yahoo.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/yahoo.js +5 -3
- package/dist-lib/{lib → plugins}/web-search/fetch-html.js +1 -1
- package/dist-lib/plugins/web-search/index.d.ts +18 -0
- package/dist-lib/plugins/web-search/index.js +33 -0
- package/dist-lib/{lib → plugins}/web-search/orchestrator.d.ts +3 -1
- package/dist-lib/{lib → plugins}/web-search/orchestrator.js +5 -5
- package/dist-lib/plugins/web-search/tool.d.ts +3 -0
- package/dist-lib/{lib/tools/web-search.js → plugins/web-search/tool.js} +18 -14
- package/dist-lib/plugins/web-search/types.js +1 -0
- package/dist-lib/schema/generate.js +5 -2
- package/dist-lib/schema/harness.js +158 -7
- package/dist-lib/spec/bind.js +20 -4
- package/dist-lib/spec/calls.js +4 -0
- package/dist-lib/spec/hrpc/hrpc.json +52 -0
- package/dist-lib/spec/hrpc/index.js +51 -3
- package/dist-lib/spec/hrpc/messages.js +595 -17
- package/dist-lib/spec/hyperschema/index.js +595 -17
- package/dist-lib/spec/hyperschema/schema.json +464 -1
- package/dist-lib/spec/hyperschema/types.d.ts +113 -2
- package/package.json +262 -485
- package/patches/{@qvac%2Finference@0.20.0.patch → @qvac%2Finference@0.21.0.patch} +8 -8
- package/scripts/addon-externals.cjs +386 -0
- package/scripts/addon-externals.d.ts +30 -0
- package/wheels/manifest.json +1 -160
- package/worker/harness-sidecar.mjs +80 -59
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-preload.d.ts +0 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-preload.js +0 -75
- package/dist-lib/lib/capabilities/completion-engine/actors/preload-failure.d.ts +0 -9
- package/dist-lib/lib/capabilities/completion-engine/actors/preload-failure.js +0 -11
- package/dist-lib/lib/capabilities/completion-engine/actors/preloading.d.ts +0 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/preloading.js +0 -114
- package/dist-lib/lib/capabilities/completion-loop/index.d.ts +0 -80
- package/dist-lib/lib/capabilities/completion-loop/index.js +0 -158
- package/dist-lib/lib/capabilities/completion-loop/metrics.d.ts +0 -5
- package/dist-lib/lib/capabilities/completion-loop/metrics.js +0 -29
- package/dist-lib/lib/capabilities/completion-loop/tool-execution.d.ts +0 -60
- package/dist-lib/lib/capabilities/completion-loop/turns.js +0 -112
- package/dist-lib/lib/capabilities/completion-runtime.d.ts +0 -46
- package/dist-lib/lib/capabilities/completion.d.ts +0 -18
- package/dist-lib/lib/capabilities/completion.js +0 -22
- package/dist-lib/lib/helpers/recovery-required.d.ts +0 -1
- package/dist-lib/lib/helpers/recovery-required.js +0 -1
- package/dist-lib/lib/hooks/built-in/index.d.ts +0 -4
- package/dist-lib/lib/hooks/built-in/index.js +0 -4
- package/dist-lib/lib/hooks/pipeline.d.ts +0 -24
- package/dist-lib/lib/hooks/pipeline.js +0 -74
- package/dist-lib/lib/hooks/registry.d.ts +0 -2
- package/dist-lib/lib/hooks/registry.js +0 -7
- package/dist-lib/lib/machine/completion/actions/skills.d.ts +0 -9
- package/dist-lib/lib/machine/completion/actions/skills.js +0 -83
- package/dist-lib/lib/machine/engine.d.ts +0 -93
- package/dist-lib/lib/machine/guards.d.ts +0 -2
- package/dist-lib/lib/machine/guards.js +0 -6
- package/dist-lib/lib/office/pptx.d.ts +0 -1
- package/dist-lib/lib/office/pptx.js +0 -26
- package/dist-lib/lib/office/python.d.ts +0 -8
- package/dist-lib/lib/office/python.js +0 -32
- package/dist-lib/lib/office/xlsx.d.ts +0 -1
- package/dist-lib/lib/office/xlsx.js +0 -26
- package/dist-lib/lib/run-log-inspect.d.ts +0 -25
- package/dist-lib/lib/run-log-protocol.d.ts +0 -2
- package/dist-lib/lib/run-log-protocol.js +0 -1
- package/dist-lib/lib/tool-call-display.d.ts +0 -1
- package/dist-lib/lib/tools/exec/adapters/adapter.d.ts +0 -31
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.d.ts +0 -7
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.js +0 -318
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.d.ts +0 -89
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +0 -1371
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.js +0 -3
- package/dist-lib/lib/tools/exec/obsidian/route.d.ts +0 -17
- package/dist-lib/lib/tools/exec/obsidian/route.js +0 -91
- package/dist-lib/lib/tools/mcp-call.d.ts +0 -14
- package/dist-lib/lib/tools/rag-search.d.ts +0 -2
- package/dist-lib/lib/tools/rag-search.js +0 -105
- package/dist-lib/lib/tools/weather-lookup.d.ts +0 -8
- package/dist-lib/lib/tools/weather-lookup.js +0 -122
- package/dist-lib/lib/tools/web-search.d.ts +0 -6
- package/dist-lib/lib/web-search/engine-registry.d.ts +0 -7
- package/dist-lib/lib/web-search/engine-registry.js +0 -17
- package/wheels/cffi-2.0.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/cryptography-47.0.0-cp314-abi3-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/defusedxml-0.7.1-py2.py3-none-any.whl +0 -0
- package/wheels/et_xmlfile-2.0.0-py3-none-any.whl +0 -0
- package/wheels/fonttools-4.62.1-py3-none-any.whl +0 -0
- package/wheels/fpdf2-2.8.8-py3-none-any.whl +0 -0
- package/wheels/lxml-6.0.2-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/openpyxl-3.1.5-py2.py3-none-any.whl +0 -0
- package/wheels/pillow-12.2.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/pycparser-3.0-py3-none-any.whl +0 -0
- package/wheels/pypdf-6.15.0-py3-none-any.whl +0 -0
- package/wheels/python_docx-1.2.0-py3-none-any.whl +0 -0
- package/wheels/python_pptx-1.0.2-py3-none-any.whl +0 -0
- package/wheels/six-1.17.0-py2.py3-none-any.whl +0 -0
- package/wheels/typing_extensions-4.15.0-py3-none-any.whl +0 -0
- package/wheels/xlsxwriter-3.2.9-py3-none-any.whl +0 -0
- /package/dist-lib/lib/{tools/skills → agent}/tool-grants.d.ts +0 -0
- /package/dist-lib/lib/{tools/skills → agent}/tool-grants.js +0 -0
- /package/dist-lib/lib/capabilities/{types.js → completion-engine/prepare-step.js} +0 -0
- /package/dist-lib/lib/{hooks/types.js → capabilities/completion-engine/stages.js} +0 -0
- /package/dist-lib/lib/{tool-call-display.js → contract/agent.js} +0 -0
- /package/dist-lib/lib/{tools/exec/adapters/adapter.js → contract/completion.js} +0 -0
- /package/dist-lib/lib/{tools/exec/adapters/python/worker/entry.d.ts → contract/exec.js} +0 -0
- /package/dist-lib/lib/{tools/exec/adapters/python/worker/interrupt-deadline.d.ts → contract/hooks.js} +0 -0
- /package/dist-lib/lib/{web-search/types.js → contract/index.js} +0 -0
- /package/dist-lib/lib/{capabilities/completion-engine → helpers}/abort-polyfill.d.ts +0 -0
- /package/dist-lib/lib/{capabilities/completion-engine → helpers}/abort-polyfill.js +0 -0
- /package/dist-lib/lib/{web-search → helpers}/html-helpers.d.ts +0 -0
- /package/dist-lib/lib/{web-search → helpers}/html-helpers.js +0 -0
- /package/dist-lib/lib/{tools → helpers}/model-args.d.ts +0 -0
- /package/dist-lib/lib/{tools → helpers}/model-args.js +0 -0
- /package/dist-lib/lib/{machine → helpers}/stable-stringify.d.ts +0 -0
- /package/dist-lib/lib/{web-search → helpers}/user-agents.d.ts +0 -0
- /package/dist-lib/lib/{web-search → helpers}/user-agents.js +0 -0
- /package/dist-lib/lib/{harness-lifecycle.d.ts → lifecycle/machine.d.ts} +0 -0
- /package/dist-lib/lib/tools/{exec/adapters/python → attachments}/output-policy.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/command.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/note-name.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/note-name.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/output.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/output.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/safe-path.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/safe-path.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-create.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-create.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-fs.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-fs.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-paths.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-paths.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-read.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-read.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-write.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-write.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/deadline-state.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/deadline-state.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/distributions.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/distributions.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/interrupt-timer.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/memfs.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/module-distributions.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/named-hosts.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/named-hosts.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/net-shim.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/net-shim.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/pyodide.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/wheels.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/active.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/protocol.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/protocol.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/serve.d.ts +0 -0
- /package/dist-lib/{lib/capabilities → plugins/speech}/audio-resample.d.ts +0 -0
- /package/dist-lib/{lib/capabilities → plugins/speech}/audio-resample.js +0 -0
- /package/dist-lib/{lib → plugins/speech}/audio-transcode-bare.d.ts +0 -0
- /package/dist-lib/{lib → plugins/speech}/audio-transcode-node.d.ts +0 -0
- /package/dist-lib/{lib → plugins/speech}/audio-transcode-node.js +0 -0
- /package/dist-lib/{lib/capabilities → plugins/speech}/speech-lexicon.d.ts +0 -0
- /package/dist-lib/{lib/capabilities → plugins/speech}/speech-lexicon.js +0 -0
- /package/dist-lib/{lib → plugins/speech}/wav-encode.d.ts +0 -0
- /package/dist-lib/{lib → plugins/speech}/wav-encode.js +0 -0
- /package/dist-lib/{lib/tools/weather-lookup → plugins/weather}/place.d.ts +0 -0
- /package/dist-lib/{lib/tools/weather-lookup → plugins/weather}/report.d.ts +0 -0
- /package/dist-lib/{lib/tools/weather-lookup → plugins/weather}/report.js +0 -0
- /package/dist-lib/{lib → plugins}/web-search/fetch-html.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/format-results.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/format-results.js +0 -0
- /package/dist-lib/{lib → plugins}/web-search/merge-results.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/merge-results.js +0 -0
- /package/dist-lib/{lib → plugins}/web-search/types.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/url-helpers.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/url-helpers.js +0 -0
- /package/dist-lib/{lib → plugins}/web-search/url-normalize.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/url-normalize.js +0 -0
|
@@ -1,10 +1,97 @@
|
|
|
1
1
|
import { isRecord } from '../guards.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Agent } from '../agent/index.js';
|
|
3
|
+
import { headTail } from '../helpers/head-tail.js';
|
|
4
|
+
import { compactContent } from '../context-window.js';
|
|
5
|
+
import { TOOL_SEARCH_TOOL_NAME } from './sdk-tool.js';
|
|
6
|
+
import { isFailureResultReference, readFailureResult } from '../helpers/failure-result.js';
|
|
4
7
|
export const DIRECT_CALL_ID = 'call-direct';
|
|
5
|
-
export
|
|
8
|
+
export const MAX_TOOL_ROUNDS = 10;
|
|
9
|
+
export const GOAL_ROUNDS = 40;
|
|
10
|
+
export const TOOL_CONTINUATION_NUDGE = "[Tool results above. Continue the user's request: call the next tool, or answer.]";
|
|
11
|
+
export const FILE_DELIVERED_NUDGE = '[Tool results above. The file is attached to the chat and shown to the user. Answer now, unless the request still needs a file that is not made yet.]';
|
|
12
|
+
export const TOOL_DENIED_MESSAGE = 'The user declined this call. Do not retry it or call it with different arguments to get ' +
|
|
13
|
+
'around the refusal. Tell the user plainly what you could not do, and never present a ' +
|
|
14
|
+
'result you did not obtain.';
|
|
15
|
+
export const TOOL_CUT_OFF_MESSAGE = 'This tool call was not executed: the response hit the output token limit, so its ' +
|
|
16
|
+
'arguments may be truncated. Re-issue the tool call with complete arguments, and keep ' +
|
|
17
|
+
'them short enough to finish.';
|
|
18
|
+
export const GOAL_CONTINUATION_NUDGE = '[The goal is not met yet. Keep working on it: call the next tool. Track the work with ' +
|
|
19
|
+
'update_plan and mark each step done as you finish it; the goal is met when every step is done.]';
|
|
20
|
+
export function checkMaxToolRounds(rounds) {
|
|
21
|
+
if (!Number.isSafeInteger(rounds) || rounds < 1) {
|
|
22
|
+
throw new Error(`maxToolRounds must be an integer of 1 or more, got ${rounds}`);
|
|
23
|
+
}
|
|
24
|
+
return rounds;
|
|
25
|
+
}
|
|
26
|
+
export function checkGoal(goal, responseFormat) {
|
|
27
|
+
if (responseFormat) {
|
|
28
|
+
throw new Error('A goal cannot run with a responseFormat: the run would have no plan to finish');
|
|
29
|
+
}
|
|
30
|
+
if (typeof goal.objective !== 'string' || !goal.objective.trim()) {
|
|
31
|
+
throw new Error('A goal needs an objective');
|
|
32
|
+
}
|
|
33
|
+
for (const key of ['rounds', 'ms', 'tokens']) {
|
|
34
|
+
const value = goal[key];
|
|
35
|
+
if (value !== undefined && (!Number.isSafeInteger(value) || value < 1)) {
|
|
36
|
+
throw new Error(`goal.${key} must be an integer of 1 or more, got ${value}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return goal;
|
|
40
|
+
}
|
|
41
|
+
export const TOOL_RESULT_MAX_CHARS = 65_536;
|
|
42
|
+
const MIN_LEAF_CHARS = 256;
|
|
43
|
+
const HOOK_CONTEXT_KEY = 'hookContext';
|
|
44
|
+
export function withHookContext(output, context) {
|
|
45
|
+
if (context === undefined) {
|
|
46
|
+
return output;
|
|
47
|
+
}
|
|
48
|
+
const base = isRecord(output) && !Array.isArray(output) ? output : { result: output };
|
|
49
|
+
const prior = base[HOOK_CONTEXT_KEY];
|
|
50
|
+
return {
|
|
51
|
+
...base,
|
|
52
|
+
[HOOK_CONTEXT_KEY]: typeof prior === 'string' ? `${prior}\n${context}` : context
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function deliversFile(output) {
|
|
56
|
+
return isRecord(output) && Array.isArray(output.attachments) && output.attachments.length > 0;
|
|
57
|
+
}
|
|
6
58
|
export function toolResultTurn(name, id, output) {
|
|
7
|
-
|
|
59
|
+
let context = '';
|
|
60
|
+
let shown = output;
|
|
61
|
+
if (isRecord(output) && typeof output[HOOK_CONTEXT_KEY] === 'string') {
|
|
62
|
+
const { [HOOK_CONTEXT_KEY]: added, ...rest } = output;
|
|
63
|
+
context = `\n${String(added)}`;
|
|
64
|
+
shown = rest;
|
|
65
|
+
}
|
|
66
|
+
const payload = historyPayload(shown);
|
|
67
|
+
if (name === TOOL_SEARCH_TOOL_NAME) {
|
|
68
|
+
return JSON.stringify(payload);
|
|
69
|
+
}
|
|
70
|
+
const text = name === Agent.SKILL_TOOL_NAME ? JSON.stringify(payload) : fitted(payload);
|
|
71
|
+
return `[Tool: ${name} (${id})]\n${text}${context}`;
|
|
72
|
+
}
|
|
73
|
+
function fitted(payload) {
|
|
74
|
+
const whole = JSON.stringify(payload);
|
|
75
|
+
if (whole === undefined || whole.length <= TOOL_RESULT_MAX_CHARS) {
|
|
76
|
+
return whole;
|
|
77
|
+
}
|
|
78
|
+
const render = (cap) => JSON.stringify(payload, (_key, value) => typeof value === 'string' && value.length > cap ? headTail(value, cap) : value);
|
|
79
|
+
const floor = render(MIN_LEAF_CHARS);
|
|
80
|
+
if (floor.length > TOOL_RESULT_MAX_CHARS) {
|
|
81
|
+
return floor;
|
|
82
|
+
}
|
|
83
|
+
let fits = MIN_LEAF_CHARS;
|
|
84
|
+
let over = whole.length;
|
|
85
|
+
while (over - fits > 1) {
|
|
86
|
+
const mid = Math.floor((fits + over) / 2);
|
|
87
|
+
if (render(mid).length <= TOOL_RESULT_MAX_CHARS) {
|
|
88
|
+
fits = mid;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
over = mid;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return render(fits);
|
|
8
95
|
}
|
|
9
96
|
export function toolResultHistoryEntry({ name, id, output, resultRef }) {
|
|
10
97
|
return resultRef
|
|
@@ -24,18 +111,41 @@ export function materializeCompletionHistory(history, values) {
|
|
|
24
111
|
if (!stored) {
|
|
25
112
|
throw new Error(`History references missing failed tool result: ${entry.ref}`);
|
|
26
113
|
}
|
|
114
|
+
const content = toolResultTurn(stored.name, entry.callId, readFailureResult(stored.result));
|
|
27
115
|
return {
|
|
28
116
|
role: 'tool',
|
|
29
|
-
content:
|
|
117
|
+
content: entry.compactedTo === undefined ? content : compactContent(content, entry.compactedTo)
|
|
30
118
|
};
|
|
31
119
|
});
|
|
32
120
|
}
|
|
33
|
-
export function
|
|
34
|
-
|
|
121
|
+
export function redactFailureTurns(history, failures, redact) {
|
|
122
|
+
const out = [...history];
|
|
123
|
+
for (const { at, name, callId, result, compactedTo } of redact(failures)) {
|
|
124
|
+
const content = toolResultTurn(name, callId, readFailureResult(result));
|
|
125
|
+
out[at] = {
|
|
126
|
+
role: 'tool',
|
|
127
|
+
content: compactedTo === undefined ? content : compactContent(content, compactedTo)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
export function skillLoadedTurn(name, id = DIRECT_CALL_ID) {
|
|
133
|
+
return toolResultTurn(Agent.SKILL_TOOL_NAME, id, {
|
|
35
134
|
name,
|
|
36
135
|
content: `${name} was loaded in an earlier turn but its instructions are not in this context. Call the skill tool with this name again before doing its work.`
|
|
37
136
|
});
|
|
38
137
|
}
|
|
138
|
+
const PRELOAD_HEAD = '[Skill invoked by user: ';
|
|
139
|
+
const PRELOAD_USER = "\n\nThe user's message:\n";
|
|
140
|
+
export function skillPreloadMessage(content, name, body) {
|
|
141
|
+
return `${PRELOAD_HEAD}${name}]\n${body}${PRELOAD_USER}${content}`;
|
|
142
|
+
}
|
|
143
|
+
export function splitPreloadMessage(text) {
|
|
144
|
+
const at = text.lastIndexOf(PRELOAD_USER);
|
|
145
|
+
return text.startsWith(PRELOAD_HEAD) && at >= 0
|
|
146
|
+
? { skill: text.slice(0, at), user: text.slice(at + PRELOAD_USER.length) }
|
|
147
|
+
: null;
|
|
148
|
+
}
|
|
39
149
|
function refFrom(value) {
|
|
40
150
|
if (!value || typeof value !== 'object') {
|
|
41
151
|
return null;
|
|
@@ -110,11 +220,11 @@ function skillLoadPayload(turn) {
|
|
|
110
220
|
if (turn.role !== 'tool')
|
|
111
221
|
return null;
|
|
112
222
|
const text = String(turn.content ?? '');
|
|
113
|
-
if (!text.startsWith(`[Tool: ${SKILL_TOOL_NAME} (`)) {
|
|
223
|
+
if (!text.startsWith(`[Tool: ${Agent.SKILL_TOOL_NAME} (`)) {
|
|
114
224
|
return null;
|
|
115
225
|
}
|
|
116
226
|
try {
|
|
117
|
-
const payload = JSON.parse(text.
|
|
227
|
+
const payload = JSON.parse(text.split('\n', 2)[1] ?? '');
|
|
118
228
|
if (typeof payload !== 'object' || payload === null) {
|
|
119
229
|
return null;
|
|
120
230
|
}
|
|
@@ -130,7 +240,7 @@ function skillLoadPayload(turn) {
|
|
|
130
240
|
}
|
|
131
241
|
}
|
|
132
242
|
const HOST_ONLY_KEYS = ['data', 'hostNotice'];
|
|
133
|
-
function historyPayload(output) {
|
|
243
|
+
export function historyPayload(output) {
|
|
134
244
|
if (!output || typeof output !== 'object')
|
|
135
245
|
return output;
|
|
136
246
|
if (!HOST_ONLY_KEYS.some((key) => key in output))
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { toolDialectFor } from '../models/model-catalog.js';
|
|
1
2
|
import { detectToolDialect } from '../models/tool-dialect.js';
|
|
2
3
|
const QWEN35 = { prose: 4.38, schema: 4.08, toolBlockTokens: 189 };
|
|
3
4
|
const DENSITY_BY_DIALECT = new Map([['qwen35', QWEN35]]);
|
|
4
5
|
export function densityFor(modelName) {
|
|
5
|
-
const dialect = modelName
|
|
6
|
+
const dialect = modelName
|
|
7
|
+
? (toolDialectFor(modelName) ?? detectToolDialect(modelName, modelName))
|
|
8
|
+
: undefined;
|
|
6
9
|
return (dialect && DENSITY_BY_DIALECT.get(dialect)) ?? QWEN35;
|
|
7
10
|
}
|
|
8
11
|
export function promptUsageParts({ system, toolSchemas }) {
|
|
@@ -4,6 +4,7 @@ import { type KvCacheDeletionResult } from './capabilities/kv-cache.ts';
|
|
|
4
4
|
import type { CustomModelEntry } from './models/model-catalog.ts';
|
|
5
5
|
import { type ModelSourcePreview, type PreviewModelSourceContext } from './capabilities/preview-model-source.ts';
|
|
6
6
|
import type { CapabilityInfo, CompletionContext, CredentialEntry, DetectedLanguage, DetectLanguageContext, DownloadContext, EmbedContext, HarnessContract, HarnessDiagnostics, HarnessEvent, HarnessInfo, InfraModel, InvokeContext, ListModelsOptions, ModelInfo, ResolvedSkillCatalogEntry, SkillsOptions, SkillWriteResult, SpeakContext, SpeakResult, SpeakStreamContext, ToolCatalogEntry, TranscribeContext, LoadModelContext, LoadModelResult, UnloadModelContext, UnloadModelResult, WarmModelContext } from './contract-types.ts';
|
|
7
|
+
import type { KnowledgeArtifact, KnowledgeHit, KnowledgeQuery, KnowledgeRemoved, KnowledgeStatus, KnowledgeUpsertResult } from './contract/knowledge.ts';
|
|
7
8
|
import { type EmbedDevice } from './models/embed-config.ts';
|
|
8
9
|
import type { DeleteModelSummary } from './models/model-delete.ts';
|
|
9
10
|
import type { CopyBaseResult, DeleteOverlayResult, ManagedSkill, SkillFileContent } from './tools/skills/overlay-crud.ts';
|
|
@@ -30,6 +31,7 @@ export declare class RemoteHarness extends EventEmitter implements HarnessContra
|
|
|
30
31
|
private _ensure;
|
|
31
32
|
private _open;
|
|
32
33
|
completion(context: CompletionContext | import('./contract-types.ts').ResumeCompletionContext): AsyncIterable<HarnessEvent>;
|
|
34
|
+
private _hop;
|
|
33
35
|
invoke(context: InvokeContext): AsyncIterable<HarnessEvent>;
|
|
34
36
|
private _run;
|
|
35
37
|
download(context: DownloadContext): AsyncIterable<HarnessEvent>;
|
|
@@ -55,6 +57,10 @@ export declare class RemoteHarness extends EventEmitter implements HarnessContra
|
|
|
55
57
|
warmModel(context: WarmModelContext): Promise<void>;
|
|
56
58
|
loadModel(context: LoadModelContext): Promise<LoadModelResult>;
|
|
57
59
|
unloadModel(context: UnloadModelContext): Promise<UnloadModelResult>;
|
|
60
|
+
knowledgeUpsert(artifact: KnowledgeArtifact): Promise<KnowledgeUpsertResult>;
|
|
61
|
+
knowledgeRemove(artifactId: string): Promise<KnowledgeRemoved>;
|
|
62
|
+
knowledgeSearch(query: Omit<KnowledgeQuery, 'signal'>): Promise<KnowledgeHit[]>;
|
|
63
|
+
knowledgeStatus(): Promise<KnowledgeStatus>;
|
|
58
64
|
list(options?: ListModelsOptions): Promise<ModelInfo[]>;
|
|
59
65
|
deleteModel(name: string): Promise<DeleteModelSummary>;
|
|
60
66
|
clearKvCache(): Promise<KvCacheDeletionResult>;
|
package/dist-lib/lib/connect.js
CHANGED
|
@@ -6,19 +6,23 @@ import { z } from 'zod';
|
|
|
6
6
|
import { settleOnClose } from './rpc-session.js';
|
|
7
7
|
import { harnessClient } from '../spec/calls.js';
|
|
8
8
|
import HRPC from '../spec/hrpc/index.js';
|
|
9
|
+
import { encode } from '../spec/hrpc/messages.js';
|
|
9
10
|
import { unsupportedKvCacheDeletion } from './capabilities/kv-cache.js';
|
|
11
|
+
import { checkGoal, checkMaxToolRounds } from './capabilities/tool-turns.js';
|
|
12
|
+
import { Agent } from './agent/index.js';
|
|
10
13
|
import { readModelSourcePreview } from './capabilities/preview-model-source.js';
|
|
11
|
-
import {
|
|
14
|
+
import { RunLog } from './run-log/index.js';
|
|
12
15
|
import { hlog } from './log.js';
|
|
13
16
|
import { assertEmbedDevice } from './models/embed-config.js';
|
|
14
17
|
import { addonTaskType } from './models/model-task.js';
|
|
15
18
|
import { errorCode, errorMessage, isRecord } from './guards.js';
|
|
16
19
|
import { pushQueue } from './queue.js';
|
|
17
20
|
import { stageFile, sweepStaging } from './staging.js';
|
|
21
|
+
import { sweepSpill } from './spill.js';
|
|
18
22
|
import { readInstall, readSetup } from './tools/skills/manifest-parse.js';
|
|
19
23
|
import { SKILL_STATE } from './tools/skills/skill-state.js';
|
|
20
24
|
import { asToolset } from './tools/toolsets.js';
|
|
21
|
-
import { fromDownloadWire, fromWire, unpackVectors } from './wire.js';
|
|
25
|
+
import { fromDownloadWire, fromKnowledgeHitWire, fromKnowledgeStatusWire, fromKnowledgeUpsertResultWire, fromWire, toKnowledgeUpsertWire, unpackVectors } from './wire.js';
|
|
22
26
|
export const HARNESS_DIED = 'HARNESS_DIED';
|
|
23
27
|
const PAUSE_GRACE_MS = 10_000;
|
|
24
28
|
export function connectHarness(transport, options = {}) {
|
|
@@ -60,6 +64,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
60
64
|
}
|
|
61
65
|
async _open() {
|
|
62
66
|
sweepStaging();
|
|
67
|
+
sweepSpill();
|
|
63
68
|
let stream;
|
|
64
69
|
try {
|
|
65
70
|
stream = await this._transport();
|
|
@@ -92,7 +97,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
92
97
|
this._session = session;
|
|
93
98
|
this.emit('status', { state: 'running' });
|
|
94
99
|
const models = session.client.modelEvents({});
|
|
95
|
-
models.on('data', (state) => this.emit('model', state));
|
|
100
|
+
models.on('data', (state) => this.emit('model', state.loaded ? { ...state, loaded: state.loaded.map(loadedModel) } : state));
|
|
96
101
|
models.on('error', noop);
|
|
97
102
|
if (this._customModels.length) {
|
|
98
103
|
try {
|
|
@@ -104,7 +109,12 @@ export class RemoteHarness extends EventEmitter {
|
|
|
104
109
|
}
|
|
105
110
|
return session;
|
|
106
111
|
}
|
|
107
|
-
|
|
112
|
+
completion(context) {
|
|
113
|
+
return context.agents
|
|
114
|
+
? Agent.follow({ completion: (hop) => this._hop(hop) }, { ...context, goal: undefined })
|
|
115
|
+
: this._hop(context);
|
|
116
|
+
}
|
|
117
|
+
async *_hop(context) {
|
|
108
118
|
const runId = context.runId ?? b4a.toHex(randomBytes(16));
|
|
109
119
|
if (context.signal?.aborted) {
|
|
110
120
|
yield { type: 'aborted', runId };
|
|
@@ -119,6 +129,18 @@ export class RemoteHarness extends EventEmitter {
|
|
|
119
129
|
if (explicitEmptyIdentity.length) {
|
|
120
130
|
payload.explicitEmptyIdentity = explicitEmptyIdentity;
|
|
121
131
|
}
|
|
132
|
+
if (context.knowledge) {
|
|
133
|
+
payload.knowledge = { scopes: [...context.knowledge.scopes] };
|
|
134
|
+
}
|
|
135
|
+
if (context.planMode) {
|
|
136
|
+
payload.planMode = true;
|
|
137
|
+
}
|
|
138
|
+
if (context.parentRunId) {
|
|
139
|
+
payload.parentRunId = context.parentRunId;
|
|
140
|
+
}
|
|
141
|
+
if (context.goal) {
|
|
142
|
+
payload.goal = checkGoal({ ...context.goal }, context.responseFormat);
|
|
143
|
+
}
|
|
122
144
|
yield* this._run({
|
|
123
145
|
type: 'start',
|
|
124
146
|
runId,
|
|
@@ -130,10 +152,17 @@ export class RemoteHarness extends EventEmitter {
|
|
|
130
152
|
generationParams: context.generationParams,
|
|
131
153
|
responseFormat: context.responseFormat,
|
|
132
154
|
captureInferenceCalls: context.captureInferenceCalls,
|
|
133
|
-
|
|
155
|
+
maxToolRounds: context.maxToolRounds === undefined || context.maxToolRounds === 0
|
|
156
|
+
? undefined
|
|
157
|
+
: checkMaxToolRounds(context.maxToolRounds),
|
|
158
|
+
messages: context.messages?.map(({ role, content, attachments, toolCalls, toolCallId, name, id }) => ({
|
|
134
159
|
role,
|
|
135
160
|
content,
|
|
136
|
-
attachments: attachments?.map(({ path: file }) => ({ path: file }))
|
|
161
|
+
attachments: attachments?.map(({ path: file }) => ({ path: file })),
|
|
162
|
+
toolCalls,
|
|
163
|
+
toolCallId,
|
|
164
|
+
name,
|
|
165
|
+
id
|
|
137
166
|
})),
|
|
138
167
|
toolConfigs: context.toolConfigs,
|
|
139
168
|
grantedDirs: context.grantedDirs,
|
|
@@ -227,11 +256,26 @@ export class RemoteHarness extends EventEmitter {
|
|
|
227
256
|
};
|
|
228
257
|
let pauseTimer;
|
|
229
258
|
let started = false;
|
|
259
|
+
let failure = null;
|
|
260
|
+
const send = (frame) => {
|
|
261
|
+
if (!duplex)
|
|
262
|
+
return false;
|
|
263
|
+
try {
|
|
264
|
+
encode('@harness/completion-frame', frame);
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
failure ??= new Error(`cannot encode ${String(frame.type)} frame: ${errorMessage(err)}`);
|
|
268
|
+
duplex.destroy(failure);
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
duplex.write(frame);
|
|
272
|
+
return true;
|
|
273
|
+
};
|
|
230
274
|
const onAbort = () => {
|
|
231
275
|
if (!pausable || !duplex || !started) {
|
|
232
276
|
return duplex?.destroy();
|
|
233
277
|
}
|
|
234
|
-
|
|
278
|
+
send({ type: 'pause' });
|
|
235
279
|
pauseTimer = setTimeout(() => duplex?.destroy(), this._pauseGraceMs);
|
|
236
280
|
};
|
|
237
281
|
try {
|
|
@@ -267,8 +311,21 @@ export class RemoteHarness extends EventEmitter {
|
|
|
267
311
|
yield { type: 'aborted', runId: activeRunId };
|
|
268
312
|
return;
|
|
269
313
|
}
|
|
270
|
-
|
|
314
|
+
if (!send(startFrame)) {
|
|
315
|
+
throw failure;
|
|
316
|
+
}
|
|
271
317
|
started = true;
|
|
318
|
+
if (context.input) {
|
|
319
|
+
void sendInput(context.input, (item) => {
|
|
320
|
+
if (closed)
|
|
321
|
+
return false;
|
|
322
|
+
return send({
|
|
323
|
+
type: item.mode,
|
|
324
|
+
callId: item.id,
|
|
325
|
+
messages: [{ role: 'user', content: item.text }]
|
|
326
|
+
});
|
|
327
|
+
}).catch(noop);
|
|
328
|
+
}
|
|
272
329
|
hlog('client wire open', { model: context.model, capability: open.capability });
|
|
273
330
|
for await (const event of frames(duplex)) {
|
|
274
331
|
received++;
|
|
@@ -288,11 +345,11 @@ export class RemoteHarness extends EventEmitter {
|
|
|
288
345
|
.then(() => context.approve?.(approval))
|
|
289
346
|
.then((approved) => {
|
|
290
347
|
if (!closed) {
|
|
291
|
-
|
|
348
|
+
send({ type: 'decision', callId, approved: approved === true });
|
|
292
349
|
}
|
|
293
350
|
}, () => {
|
|
294
351
|
if (!closed) {
|
|
295
|
-
|
|
352
|
+
send({ type: 'decision', callId, approved: false });
|
|
296
353
|
}
|
|
297
354
|
})
|
|
298
355
|
.catch((err) => hlog('approval reply failed', { callId, message: errorMessage(err) }));
|
|
@@ -303,11 +360,11 @@ export class RemoteHarness extends EventEmitter {
|
|
|
303
360
|
void bridgeAttach(event, context.attach)
|
|
304
361
|
.then((frame) => {
|
|
305
362
|
if (!closed) {
|
|
306
|
-
|
|
363
|
+
send({ ...frame, callId });
|
|
307
364
|
}
|
|
308
365
|
}, (err) => {
|
|
309
366
|
if (!closed) {
|
|
310
|
-
|
|
367
|
+
send({
|
|
311
368
|
type: 'attach-result',
|
|
312
369
|
callId,
|
|
313
370
|
message: errorMessage(err)
|
|
@@ -324,12 +381,12 @@ export class RemoteHarness extends EventEmitter {
|
|
|
324
381
|
if (closed) {
|
|
325
382
|
return reclaim();
|
|
326
383
|
}
|
|
327
|
-
|
|
384
|
+
send({ ...frame, callId });
|
|
328
385
|
}, (err) => {
|
|
329
386
|
if (closed) {
|
|
330
387
|
return reclaim();
|
|
331
388
|
}
|
|
332
|
-
|
|
389
|
+
send({ type: 'fetch-result', callId, message: errorMessage(err) });
|
|
333
390
|
})
|
|
334
391
|
.catch((err) => hlog('fetch reply failed', { callId, message: errorMessage(err) }));
|
|
335
392
|
continue;
|
|
@@ -339,7 +396,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
339
396
|
void bridgeDrive(event, context)
|
|
340
397
|
.then((frame) => {
|
|
341
398
|
if (!closed) {
|
|
342
|
-
return
|
|
399
|
+
return send({ ...frame, callId });
|
|
343
400
|
}
|
|
344
401
|
const stagedPath = frame.payload?.path;
|
|
345
402
|
if (stagedPath) {
|
|
@@ -347,7 +404,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
347
404
|
}
|
|
348
405
|
}, (err) => {
|
|
349
406
|
if (!closed) {
|
|
350
|
-
|
|
407
|
+
send({
|
|
351
408
|
type: 'drive-result',
|
|
352
409
|
callId,
|
|
353
410
|
message: errorMessage(err)
|
|
@@ -367,11 +424,11 @@ export class RemoteHarness extends EventEmitter {
|
|
|
367
424
|
})
|
|
368
425
|
.then((frame) => {
|
|
369
426
|
if (!closed) {
|
|
370
|
-
|
|
427
|
+
send({ ...frame, callId });
|
|
371
428
|
}
|
|
372
429
|
}, (err) => {
|
|
373
430
|
if (!closed) {
|
|
374
|
-
|
|
431
|
+
send({
|
|
375
432
|
type: 'run-log-result',
|
|
376
433
|
callId,
|
|
377
434
|
message: errorMessage(err)
|
|
@@ -381,31 +438,12 @@ export class RemoteHarness extends EventEmitter {
|
|
|
381
438
|
.catch((err) => hlog('run-log reply failed', { callId, message: errorMessage(err) }));
|
|
382
439
|
continue;
|
|
383
440
|
}
|
|
384
|
-
if (event.type === 'rag-ask') {
|
|
385
|
-
const callId = event.callId;
|
|
386
|
-
void bridgeRag(event, context)
|
|
387
|
-
.then((frame) => {
|
|
388
|
-
if (!closed) {
|
|
389
|
-
duplex.write({ ...frame, callId });
|
|
390
|
-
}
|
|
391
|
-
}, (err) => {
|
|
392
|
-
if (!closed) {
|
|
393
|
-
duplex.write({
|
|
394
|
-
type: 'rag-result',
|
|
395
|
-
callId,
|
|
396
|
-
message: errorMessage(err)
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
})
|
|
400
|
-
.catch((err) => hlog('rag reply failed', { callId, message: errorMessage(err) }));
|
|
401
|
-
continue;
|
|
402
|
-
}
|
|
403
441
|
if (event.type === 'question-ask') {
|
|
404
442
|
answerQuestion(event, {
|
|
405
443
|
askUser: context.askUser,
|
|
406
444
|
reply: (frame) => {
|
|
407
445
|
if (!closed) {
|
|
408
|
-
|
|
446
|
+
send(frame);
|
|
409
447
|
}
|
|
410
448
|
}
|
|
411
449
|
});
|
|
@@ -424,6 +462,9 @@ export class RemoteHarness extends EventEmitter {
|
|
|
424
462
|
hlog('client wire ended', { received });
|
|
425
463
|
}
|
|
426
464
|
catch (err) {
|
|
465
|
+
if (failure) {
|
|
466
|
+
throw failure;
|
|
467
|
+
}
|
|
427
468
|
if (context.signal?.aborted) {
|
|
428
469
|
if (!emittedAborted) {
|
|
429
470
|
yield { type: 'aborted', runId: activeRunId };
|
|
@@ -539,12 +580,19 @@ export class RemoteHarness extends EventEmitter {
|
|
|
539
580
|
const pump = (async () => {
|
|
540
581
|
try {
|
|
541
582
|
for await (const fragment of context.text) {
|
|
542
|
-
|
|
583
|
+
const frame = { text: fragment };
|
|
584
|
+
try {
|
|
585
|
+
encode('@harness/speak-stream-frame', frame);
|
|
586
|
+
}
|
|
587
|
+
catch (err) {
|
|
588
|
+
throw new Error(`cannot encode speak frame: ${errorMessage(err)}`);
|
|
589
|
+
}
|
|
590
|
+
duplex.write(frame);
|
|
543
591
|
}
|
|
544
592
|
duplex.end();
|
|
545
593
|
}
|
|
546
|
-
catch {
|
|
547
|
-
duplex.destroy();
|
|
594
|
+
catch (err) {
|
|
595
|
+
duplex.destroy(err);
|
|
548
596
|
}
|
|
549
597
|
})();
|
|
550
598
|
try {
|
|
@@ -713,6 +761,30 @@ export class RemoteHarness extends EventEmitter {
|
|
|
713
761
|
});
|
|
714
762
|
return { unloaded: response.unloaded === true };
|
|
715
763
|
}
|
|
764
|
+
async knowledgeUpsert(artifact) {
|
|
765
|
+
const { client } = await this._ensure();
|
|
766
|
+
const response = await client.knowledgeUpsert(toKnowledgeUpsertWire(artifact));
|
|
767
|
+
return fromKnowledgeUpsertResultWire(response, artifact.chunks.length);
|
|
768
|
+
}
|
|
769
|
+
async knowledgeRemove(artifactId) {
|
|
770
|
+
const { client } = await this._ensure();
|
|
771
|
+
const response = await client.knowledgeRemove({ artifactId });
|
|
772
|
+
return { removed: response.removed };
|
|
773
|
+
}
|
|
774
|
+
async knowledgeSearch(query) {
|
|
775
|
+
const { client } = await this._ensure();
|
|
776
|
+
const response = await client.knowledgeSearch({
|
|
777
|
+
text: query.text,
|
|
778
|
+
scopes: [...query.scopes],
|
|
779
|
+
k: query.k
|
|
780
|
+
});
|
|
781
|
+
return response.hits.map(fromKnowledgeHitWire);
|
|
782
|
+
}
|
|
783
|
+
async knowledgeStatus() {
|
|
784
|
+
const { client } = await this._ensure();
|
|
785
|
+
const response = await client.knowledgeStatus({});
|
|
786
|
+
return fromKnowledgeStatusWire(response);
|
|
787
|
+
}
|
|
716
788
|
async list(options = {}) {
|
|
717
789
|
const { client } = await this._ensure();
|
|
718
790
|
const response = await client.listModels({
|
|
@@ -720,11 +792,14 @@ export class RemoteHarness extends EventEmitter {
|
|
|
720
792
|
cachedOnly: options.cachedOnly,
|
|
721
793
|
fullRegistry: options.fullRegistry
|
|
722
794
|
});
|
|
723
|
-
return (response.models ?? []).map(({ actualSize, label, ...row }) => ({
|
|
795
|
+
return (response.models ?? []).map(({ actualSize, label, fit, fitBasis, fitEvidence, ...row }) => ({
|
|
724
796
|
...row,
|
|
725
797
|
actualSize: actualSize || undefined,
|
|
726
798
|
label: label || undefined,
|
|
727
|
-
taskType: addonTaskType(row.type)
|
|
799
|
+
taskType: addonTaskType(row.type),
|
|
800
|
+
fit: (fit || undefined),
|
|
801
|
+
fitBasis: (fitBasis || undefined),
|
|
802
|
+
fitEvidence: (fitEvidence || undefined)
|
|
728
803
|
}));
|
|
729
804
|
}
|
|
730
805
|
async deleteModel(name) {
|
|
@@ -825,7 +900,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
825
900
|
const snapshot = await diagnostics.call(client, {});
|
|
826
901
|
const device = snapshot?.device;
|
|
827
902
|
return {
|
|
828
|
-
models: (snapshot?.models ?? []).map(
|
|
903
|
+
models: (snapshot?.models ?? []).map(loadedModel),
|
|
829
904
|
suspended: snapshot?.suspended ?? false,
|
|
830
905
|
sdkLoaded: snapshot?.sdkLoaded ?? false,
|
|
831
906
|
toolNames: snapshot?.toolNames ?? [],
|
|
@@ -834,6 +909,23 @@ export class RemoteHarness extends EventEmitter {
|
|
|
834
909
|
};
|
|
835
910
|
}
|
|
836
911
|
}
|
|
912
|
+
function loadedModel({ model, refs, fit }) {
|
|
913
|
+
if (!fit) {
|
|
914
|
+
return { model, refs };
|
|
915
|
+
}
|
|
916
|
+
const { verdict, reason, plan, deviceBytes, hostBytes } = fit;
|
|
917
|
+
return {
|
|
918
|
+
model,
|
|
919
|
+
refs,
|
|
920
|
+
fit: {
|
|
921
|
+
verdict,
|
|
922
|
+
reason,
|
|
923
|
+
plan: plan ?? undefined,
|
|
924
|
+
deviceBytes: deviceBytes || undefined,
|
|
925
|
+
hostBytes: hostBytes || undefined
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
}
|
|
837
929
|
function parseSkillState(value) {
|
|
838
930
|
return value ? value : SKILL_STATE.failed;
|
|
839
931
|
}
|
|
@@ -880,7 +972,10 @@ function knobs(agent) {
|
|
|
880
972
|
imageHeight: agent.imageHeight ?? undefined,
|
|
881
973
|
approvalMode: agent.approvalMode ?? undefined,
|
|
882
974
|
disabledToolsets: agent.disabledToolsets ?? undefined,
|
|
883
|
-
sandboxMode: agent.sandboxMode ?? undefined
|
|
975
|
+
sandboxMode: agent.sandboxMode ?? undefined,
|
|
976
|
+
handoffs: agent.handoffs?.map(({ id, description }) => ({ id, description })),
|
|
977
|
+
plan: agent.plan ?? undefined,
|
|
978
|
+
model: agent.model ?? undefined
|
|
884
979
|
};
|
|
885
980
|
}
|
|
886
981
|
function explicitEmptyIdentityFields(context) {
|
|
@@ -1011,6 +1106,16 @@ async function bridgeDrive(event, context) {
|
|
|
1011
1106
|
return { type: 'drive-result', message: errorMessage(err) };
|
|
1012
1107
|
}
|
|
1013
1108
|
}
|
|
1109
|
+
async function sendInput(input, send) {
|
|
1110
|
+
const iterator = input[Symbol.asyncIterator]();
|
|
1111
|
+
for (;;) {
|
|
1112
|
+
const next = await iterator.next();
|
|
1113
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1114
|
+
if (next.done || !send(next.value)) {
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1014
1119
|
function answerQuestion(event, { askUser, reply }) {
|
|
1015
1120
|
const callId = event.callId;
|
|
1016
1121
|
if (!askUser) {
|
|
@@ -1072,7 +1177,7 @@ function validateHostRunLogLease(lease, runId) {
|
|
|
1072
1177
|
throw new Error('host returned an invalid run-log lease');
|
|
1073
1178
|
}
|
|
1074
1179
|
if (lease.boot) {
|
|
1075
|
-
validateEngineBoot(lease.boot);
|
|
1180
|
+
RunLog.validateEngineBoot(lease.boot);
|
|
1076
1181
|
}
|
|
1077
1182
|
const metadata = lease.boot?.metadata;
|
|
1078
1183
|
if (metadata && metadata.runId !== runId) {
|
|
@@ -1087,7 +1192,8 @@ function approvalCall(event) {
|
|
|
1087
1192
|
resource: event.resource ?? null,
|
|
1088
1193
|
effect: event.effect === 'read' ? 'read' : 'write',
|
|
1089
1194
|
intent: event.intent || null,
|
|
1090
|
-
display: isToolCallDisplay(event.display) ? event.display : null
|
|
1195
|
+
display: isToolCallDisplay(event.display) ? event.display : null,
|
|
1196
|
+
quote: event.question || null
|
|
1091
1197
|
};
|
|
1092
1198
|
if (typeof identity.callId === 'string') {
|
|
1093
1199
|
approval.callId = identity.callId;
|
|
@@ -1145,24 +1251,6 @@ function awaitWithAbort(promise, signal) {
|
|
|
1145
1251
|
});
|
|
1146
1252
|
});
|
|
1147
1253
|
}
|
|
1148
|
-
async function bridgeRag(event, context) {
|
|
1149
|
-
if (!context.ragSearch) {
|
|
1150
|
-
return {
|
|
1151
|
-
type: 'rag-result',
|
|
1152
|
-
result: { enabled: false, indexEmpty: true, hasKnowledge: false, hits: [] }
|
|
1153
|
-
};
|
|
1154
|
-
}
|
|
1155
|
-
try {
|
|
1156
|
-
const result = await context.ragSearch({
|
|
1157
|
-
query: event.query ?? '',
|
|
1158
|
-
limit: event.limit ?? undefined
|
|
1159
|
-
});
|
|
1160
|
-
return { type: 'rag-result', result };
|
|
1161
|
-
}
|
|
1162
|
-
catch (err) {
|
|
1163
|
-
return { type: 'rag-result', message: errorMessage(err) };
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
1254
|
async function* frames(stream) {
|
|
1167
1255
|
const queue = pushQueue();
|
|
1168
1256
|
let error = null;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Message } from './
|
|
1
|
+
import type { Message } from './contract/index.ts';
|
|
2
2
|
export declare const TOOL_RESULT_TRUNCATION_MARKER = "\n[tool result truncated for context]\n";
|
|
3
|
+
export declare function compactedFrom(message: Message): Message | undefined;
|
|
3
4
|
export interface ContextCandidate {
|
|
4
5
|
history: Message[];
|
|
5
6
|
droppedTurns: number;
|
|
6
7
|
}
|
|
7
|
-
export declare function contextCandidates(history: Message[]): ContextCandidate[];
|
|
8
|
+
export declare function contextCandidates(history: Message[], ...nudges: string[]): ContextCandidate[];
|
|
9
|
+
export declare function compactContent(content: string, target: number): string;
|