@qvac/harness 1.0.0-rc.9 → 1.0.0
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 +696 -7
- package/NOTICE.md +0 -16
- package/README.md +46 -5
- package/dist-lib/index.d.ts +23 -16
- package/dist-lib/index.js +127 -23
- package/dist-lib/lib/agent/delegate.d.ts +1 -0
- package/dist-lib/lib/agent/delegate.js +10 -9
- package/dist-lib/lib/agent/follow.d.ts +1 -0
- package/dist-lib/lib/agent/follow.js +12 -2
- package/dist-lib/lib/agent/resolve.js +11 -3
- package/dist-lib/lib/agent/tools.d.ts +1 -0
- package/dist-lib/lib/agent/tools.js +1 -1
- package/dist-lib/lib/capabilities/agent-ports.d.ts +1 -1
- package/dist-lib/lib/capabilities/agent-ports.js +8 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +79 -9
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +12 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +13 -8
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +3 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +47 -22
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +5 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +10 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +19 -11
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +38 -23
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +31 -10
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +5 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +61 -7
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +41 -16
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +26 -10
- package/dist-lib/lib/capabilities/completion-engine/actors.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/actors.js +8 -8
- package/dist-lib/lib/capabilities/completion-engine/driver.d.ts +0 -1
- package/dist-lib/lib/capabilities/completion-engine/driver.js +30 -6
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/durable.js +7 -1
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/engine.js +35 -15
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +0 -1
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +13 -3
- package/dist-lib/lib/capabilities/completion-engine/loop.js +7 -2
- package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/model-round.js +2 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.js +29 -9
- package/dist-lib/lib/capabilities/completion-engine/ports.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/ports.js +6 -4
- package/dist-lib/lib/capabilities/completion-engine/prepare-step.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/round.d.ts +14 -0
- package/dist-lib/lib/capabilities/completion-engine/round.js +102 -47
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +5 -3
- package/dist-lib/lib/capabilities/completion-engine/session.js +1 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +3 -1
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +5 -41
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +21 -135
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.js +40 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-preflight.d.ts +43 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-preflight.js +91 -0
- package/dist-lib/lib/capabilities/completion-engine/transition-log.d.ts +14 -0
- package/dist-lib/lib/capabilities/completion-engine/transition-log.js +44 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.js +36 -8
- package/dist-lib/lib/capabilities/enhance.js +3 -3
- package/dist-lib/lib/capabilities/kv-cache.js +11 -3
- package/dist-lib/lib/capabilities/prefix-template.d.ts +34 -0
- package/dist-lib/lib/capabilities/prefix-template.js +175 -0
- package/dist-lib/lib/capabilities/prompt-prefix.d.ts +2 -0
- package/dist-lib/lib/capabilities/prompt-prefix.js +8 -0
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +4 -4
- package/dist-lib/lib/capabilities/sdk-tool.js +22 -6
- package/dist-lib/lib/capabilities/skill-entry.d.ts +13 -1
- package/dist-lib/lib/capabilities/skill-entry.js +33 -2
- package/dist-lib/lib/capabilities/tool-failed-note.d.ts +1 -0
- package/dist-lib/lib/capabilities/tool-failed-note.js +1 -0
- package/dist-lib/lib/capabilities/tool-turns/answered.d.ts +15 -0
- package/dist-lib/lib/capabilities/tool-turns/answered.js +16 -0
- package/dist-lib/lib/capabilities/tool-turns/attachments.d.ts +7 -0
- package/dist-lib/lib/capabilities/tool-turns/attachments.js +39 -0
- package/dist-lib/lib/capabilities/tool-turns/copy.d.ts +13 -0
- package/dist-lib/lib/capabilities/tool-turns/copy.js +29 -0
- package/dist-lib/lib/capabilities/tool-turns/result-turn.d.ts +22 -0
- package/dist-lib/lib/capabilities/tool-turns/result-turn.js +120 -0
- package/dist-lib/lib/capabilities/tool-turns/run-limits.d.ts +6 -0
- package/dist-lib/lib/capabilities/tool-turns/run-limits.js +32 -0
- package/dist-lib/lib/capabilities/tool-turns/skill-loads.d.ts +9 -0
- package/dist-lib/lib/capabilities/tool-turns/skill-loads.js +71 -0
- package/dist-lib/lib/capabilities/tool-turns.d.ts +10 -43
- package/dist-lib/lib/capabilities/tool-turns.js +7 -262
- package/dist-lib/lib/capabilities/usage-breakdown.d.ts +1 -0
- package/dist-lib/lib/capabilities/usage-breakdown.js +4 -1
- package/dist-lib/lib/client/index.js +6 -5
- package/dist-lib/lib/connect/abort.d.ts +6 -0
- package/dist-lib/lib/connect/abort.js +52 -0
- package/dist-lib/lib/connect/bridges.d.ts +21 -0
- package/dist-lib/lib/connect/bridges.js +185 -0
- package/dist-lib/lib/connect/decode.d.ts +31 -0
- package/dist-lib/lib/connect/decode.js +114 -0
- package/dist-lib/lib/connect/host-run-log.d.ts +20 -0
- package/dist-lib/lib/connect/host-run-log.js +89 -0
- package/dist-lib/lib/connect/round-log.d.ts +8 -0
- package/dist-lib/lib/connect/round-log.js +33 -0
- package/dist-lib/lib/connect/served.d.ts +7 -0
- package/dist-lib/lib/connect/served.js +45 -0
- package/dist-lib/lib/connect.d.ts +5 -1
- package/dist-lib/lib/connect.js +102 -444
- package/dist-lib/lib/context-window.d.ts +13 -6
- package/dist-lib/lib/context-window.js +18 -5
- package/dist-lib/lib/contract/agent.d.ts +18 -1
- package/dist-lib/lib/contract/completion.d.ts +35 -3
- package/dist-lib/lib/contract/drive.d.ts +154 -4
- package/dist-lib/lib/contract/exec.d.ts +1 -0
- package/dist-lib/lib/contract/index.d.ts +1 -0
- package/dist-lib/lib/contract/knowledge.d.ts +10 -0
- package/dist-lib/lib/contract/media.d.ts +58 -0
- package/dist-lib/lib/contract/models.d.ts +6 -2
- package/dist-lib/lib/contract/ocr.d.ts +17 -0
- package/dist-lib/lib/contract/ocr.js +1 -0
- package/dist-lib/lib/contract/root-search.d.ts +34 -0
- package/dist-lib/lib/contract/root-search.js +1 -0
- package/dist-lib/lib/contract/run.d.ts +13 -0
- package/dist-lib/lib/contract-types.d.ts +10 -2
- package/dist-lib/lib/docx/index.js +1 -1
- package/dist-lib/lib/errors.d.ts +8 -4
- package/dist-lib/lib/errors.js +12 -8
- package/dist-lib/lib/fold/index.d.ts +4 -2
- package/dist-lib/lib/fold/index.js +15 -7
- package/dist-lib/lib/guards.d.ts +2 -0
- package/dist-lib/lib/guards.js +7 -0
- package/dist-lib/lib/hardware/capability-probe.js +10 -7
- package/dist-lib/lib/hardware/gpu-probe-addon.js +26 -11
- package/dist-lib/lib/hardware/gpu-stats.native.cjs +17 -1
- package/dist-lib/lib/helpers/completion-params.d.ts +2 -1
- package/dist-lib/lib/helpers/completion-params.js +18 -2
- package/dist-lib/lib/helpers/control-tokens.d.ts +3 -0
- package/dist-lib/lib/helpers/control-tokens.js +25 -0
- package/dist-lib/lib/helpers/drain.d.ts +1 -1
- package/dist-lib/lib/helpers/drain.js +1 -1
- package/dist-lib/lib/helpers/goal-check/asks.d.ts +25 -0
- package/dist-lib/lib/helpers/goal-check/asks.js +52 -0
- package/dist-lib/lib/helpers/goal-check/checks.d.ts +8 -0
- package/dist-lib/lib/helpers/goal-check/checks.js +92 -0
- package/dist-lib/lib/helpers/goal-check/commands.d.ts +7 -0
- package/dist-lib/lib/helpers/goal-check/commands.js +130 -0
- package/dist-lib/lib/helpers/goal-check/paths.d.ts +5 -0
- package/dist-lib/lib/helpers/goal-check/paths.js +44 -0
- package/dist-lib/lib/helpers/goal-check/shell.d.ts +9 -0
- package/dist-lib/lib/helpers/goal-check/shell.js +96 -0
- package/dist-lib/lib/helpers/goal-check.d.ts +36 -6
- package/dist-lib/lib/helpers/goal-check.js +34 -98
- package/dist-lib/lib/helpers/html-helpers.js +9 -6
- package/dist-lib/lib/helpers/recent-map.d.ts +7 -0
- package/dist-lib/lib/helpers/recent-map.js +23 -0
- package/dist-lib/lib/helpers/repeated-reply.js +9 -2
- package/dist-lib/lib/helpers/root-search.d.ts +3 -0
- package/dist-lib/lib/helpers/root-search.js +74 -0
- package/dist-lib/lib/helpers/run-latency.d.ts +14 -0
- package/dist-lib/lib/helpers/run-latency.js +63 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +2 -0
- package/dist-lib/lib/helpers/run-outcome.js +6 -2
- package/dist-lib/lib/helpers/spawn-path.d.ts +1 -0
- package/dist-lib/lib/helpers/spawn-path.js +2 -1
- package/dist-lib/lib/helpers/stable-stringify.js +10 -2
- package/dist-lib/lib/helpers/text-coalescer.d.ts +6 -0
- package/dist-lib/lib/helpers/text-coalescer.js +44 -4
- package/dist-lib/lib/helpers/tool-call-markup/emit.d.ts +6 -0
- package/dist-lib/lib/helpers/tool-call-markup/emit.js +15 -0
- package/dist-lib/lib/helpers/tool-call-markup/recover.d.ts +22 -0
- package/dist-lib/lib/helpers/tool-call-markup/recover.js +130 -0
- package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.d.ts +3 -0
- package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.js +56 -0
- package/dist-lib/lib/helpers/tool-call-markup/strip.d.ts +4 -0
- package/dist-lib/lib/helpers/tool-call-markup/strip.js +157 -0
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +19 -24
- package/dist-lib/lib/helpers/tool-call-markup.js +17 -343
- package/dist-lib/lib/lifecycle/completion-run.js +2 -2
- package/dist-lib/lib/log.d.ts +3 -0
- package/dist-lib/lib/log.js +17 -1
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +13 -16
- package/dist-lib/lib/machine/completion/actions/completion.js +110 -138
- package/dist-lib/lib/machine/completion/actions/goal.d.ts +10 -0
- package/dist-lib/lib/machine/completion/actions/goal.js +93 -0
- package/dist-lib/lib/machine/completion/actions/prepare.js +2 -1
- package/dist-lib/lib/machine/completion/actions/reject-tool.d.ts +16 -0
- package/dist-lib/lib/machine/completion/actions/reject-tool.js +147 -0
- package/dist-lib/lib/machine/completion/actions/retry-round.d.ts +6 -0
- package/dist-lib/lib/machine/completion/actions/retry-round.js +50 -0
- package/dist-lib/lib/machine/completion/actions/rounds.d.ts +5 -0
- package/dist-lib/lib/machine/completion/actions/rounds.js +31 -0
- package/dist-lib/lib/machine/completion/actions/tools.d.ts +1 -16
- package/dist-lib/lib/machine/completion/actions/tools.js +73 -151
- package/dist-lib/lib/machine/completion/context.js +6 -1
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +2 -1
- package/dist-lib/lib/machine/completion/guards/retry.js +4 -3
- package/dist-lib/lib/machine/completion/implementations.d.ts +8 -5
- package/dist-lib/lib/machine/completion/implementations.js +22 -7
- package/dist-lib/lib/machine/completion/machine.d.ts +15 -6
- package/dist-lib/lib/machine/completion/machine.js +25 -5
- package/dist-lib/lib/machine/completion/metrics.d.ts +25 -0
- package/dist-lib/lib/machine/completion/metrics.js +70 -0
- package/dist-lib/lib/machine/completion/nudges.d.ts +5 -0
- package/dist-lib/lib/machine/completion/nudges.js +33 -0
- package/dist-lib/lib/machine/completion/rules.d.ts +10 -33
- package/dist-lib/lib/machine/completion/rules.js +27 -103
- package/dist-lib/lib/machine/completion/splice.d.ts +9 -0
- package/dist-lib/lib/machine/completion/splice.js +19 -0
- package/dist-lib/lib/machine/completion/types.d.ts +37 -13
- package/dist-lib/lib/machine/index.d.ts +21 -7
- package/dist-lib/lib/machine/index.js +7 -2
- package/dist-lib/lib/media-host.d.ts +12 -0
- package/dist-lib/lib/media-host.js +52 -0
- package/dist-lib/lib/media-port.d.ts +20 -0
- package/dist-lib/lib/media-port.js +77 -0
- package/dist-lib/lib/media-wire.d.ts +8 -0
- package/dist-lib/lib/media-wire.js +111 -0
- package/dist-lib/lib/models/context-choice.js +8 -1
- package/dist-lib/lib/models/custom-model-cache.d.ts +1 -0
- package/dist-lib/lib/models/custom-model-cache.js +3 -0
- package/dist-lib/lib/models/gguf-header.d.ts +6 -0
- package/dist-lib/lib/models/gguf-header.js +38 -1
- package/dist-lib/lib/models/gpu-selection.d.ts +6 -1
- package/dist-lib/lib/models/gpu-selection.js +29 -5
- package/dist-lib/lib/models/kv-cache.d.ts +2 -0
- package/dist-lib/lib/models/kv-cache.js +8 -0
- package/dist-lib/lib/models/llm-presets.js +27 -1
- package/dist-lib/lib/models/load-requests.d.ts +9 -0
- package/dist-lib/lib/models/load-requests.js +42 -0
- package/dist-lib/lib/models/model-catalog-constants.d.ts +3 -2
- package/dist-lib/lib/models/model-catalog-constants.js +8 -5
- package/dist-lib/lib/models/model-catalog.d.ts +12 -3
- package/dist-lib/lib/models/model-catalog.js +40 -16
- package/dist-lib/lib/models/model-delete.js +3 -0
- package/dist-lib/lib/models/model-handle.d.ts +1 -0
- package/dist-lib/lib/models/model-list.d.ts +2 -1
- package/dist-lib/lib/models/model-list.js +5 -1
- package/dist-lib/lib/models/model-pool.d.ts +7 -1
- package/dist-lib/lib/models/model-pool.js +34 -13
- package/dist-lib/lib/models/tts-model-default.d.ts +2 -1
- package/dist-lib/lib/models/tts-model-default.js +8 -6
- package/dist-lib/lib/no-redirect-fetch-impl.d.ts +2 -1
- package/dist-lib/lib/no-redirect-fetch-impl.js +45 -8
- package/dist-lib/lib/office/index.js +1 -1
- package/dist-lib/lib/plugins/registry.d.ts +12 -0
- package/dist-lib/lib/plugins/registry.js +71 -15
- package/dist-lib/lib/plugins/require-bare.d.ts +1 -0
- package/dist-lib/lib/plugins/require-bare.js +13 -0
- package/dist-lib/lib/prompt.d.ts +7 -4
- package/dist-lib/lib/prompt.js +81 -24
- package/dist-lib/lib/residency/completion-runtime.d.ts +8 -6
- package/dist-lib/lib/residency/completion-runtime.js +53 -9
- package/dist-lib/lib/residency/index.d.ts +12 -3
- package/dist-lib/lib/residency/index.js +52 -16
- package/dist-lib/lib/round-host.js +3 -3
- package/dist-lib/lib/round-port.js +3 -3
- package/dist-lib/lib/run-log/boundary.d.ts +1 -4
- package/dist-lib/lib/run-log/boundary.js +4 -21
- package/dist-lib/lib/run-log/history-codec.d.ts +1 -1
- package/dist-lib/lib/run-log/history-codec.js +3 -3
- package/dist-lib/lib/run-log/protocol.js +17 -16
- package/dist-lib/lib/run-log/redact.d.ts +10 -1
- package/dist-lib/lib/run-log/redact.js +99 -9
- package/dist-lib/lib/run-log/request-codec.d.ts +3 -0
- package/dist-lib/lib/run-log/request-codec.js +19 -4
- package/dist-lib/lib/run-log/run-journal.js +1 -1
- package/dist-lib/lib/sdk-loader.d.ts +1 -0
- package/dist-lib/lib/sdk-loader.js +14 -0
- package/dist-lib/lib/serve/completion.d.ts +7 -0
- package/dist-lib/lib/serve/completion.js +571 -0
- package/dist-lib/lib/serve/downloads.d.ts +4 -0
- package/dist-lib/lib/serve/downloads.js +79 -0
- package/dist-lib/lib/serve/models.d.ts +5 -0
- package/dist-lib/lib/serve/models.js +120 -0
- package/dist-lib/lib/serve/noop.d.ts +1 -0
- package/dist-lib/lib/serve/noop.js +1 -0
- package/dist-lib/lib/serve/requests.d.ts +148 -0
- package/dist-lib/lib/serve/requests.js +1 -0
- package/dist-lib/lib/serve/rounds.d.ts +11 -0
- package/dist-lib/lib/serve/rounds.js +67 -0
- package/dist-lib/lib/serve/run-log-start.d.ts +37 -0
- package/dist-lib/lib/serve/run-log-start.js +253 -0
- package/dist-lib/lib/serve/skills.d.ts +32 -0
- package/dist-lib/lib/serve/skills.js +46 -0
- package/dist-lib/lib/serve.d.ts +5 -1
- package/dist-lib/lib/serve.js +23 -995
- package/dist-lib/lib/sidecar/index.d.ts +1 -1
- package/dist-lib/lib/sidecar/index.js +11 -19
- package/dist-lib/lib/sidecar/user-plugins.js +6 -4
- package/dist-lib/lib/skills-host/index.d.ts +6 -3
- package/dist-lib/lib/skills-host/index.js +39 -18
- package/dist-lib/lib/spawn.d.ts +14 -0
- package/dist-lib/lib/spawn.js +9 -5
- package/dist-lib/lib/tools/ask-user.d.ts +2 -0
- package/dist-lib/lib/tools/ask-user.js +137 -0
- package/dist-lib/lib/tools/attachments/delivered.d.ts +5 -0
- package/dist-lib/lib/tools/attachments/delivered.js +16 -0
- package/dist-lib/lib/tools/attachments/fetched-file.d.ts +32 -0
- package/dist-lib/lib/tools/attachments/fetched-file.js +134 -0
- package/dist-lib/lib/tools/attachments/staging.d.ts +1 -0
- package/dist-lib/lib/tools/attachments/staging.js +18 -22
- package/dist-lib/lib/tools/exec/runner.d.ts +4 -0
- package/dist-lib/lib/tools/exec/runner.js +20 -3
- package/dist-lib/lib/tools/exec.js +2 -1
- package/dist-lib/lib/tools/files/edit-file.d.ts +4 -1
- package/dist-lib/lib/tools/files/edit-file.js +220 -28
- package/dist-lib/lib/tools/files/glob.js +72 -11
- package/dist-lib/lib/tools/files/grep.js +65 -22
- package/dist-lib/lib/tools/files/index.js +3 -1
- package/dist-lib/lib/tools/files/read-file.js +199 -36
- package/dist-lib/lib/tools/fs/document-text.d.ts +7 -1
- package/dist-lib/lib/tools/fs/document-text.js +5 -21
- package/dist-lib/lib/tools/fs/drive.d.ts +1 -17
- package/dist-lib/lib/tools/fs/edit-match.d.ts +22 -0
- package/dist-lib/lib/tools/fs/edit-match.js +337 -45
- package/dist-lib/lib/tools/fs/engine.d.ts +9 -0
- package/dist-lib/lib/tools/fs/engine.js +28 -0
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +1 -81
- package/dist-lib/lib/tools/fs/scope.d.ts +2 -17
- package/dist-lib/lib/tools/fs/search.d.ts +2 -18
- package/dist-lib/lib/tools/fs/suggest.d.ts +8 -0
- package/dist-lib/lib/tools/fs/suggest.js +110 -0
- package/dist-lib/lib/tools/fs/tool-path.d.ts +3 -0
- package/dist-lib/lib/tools/fs/tool-path.js +13 -0
- package/dist-lib/lib/tools/fs/walk.d.ts +5 -5
- package/dist-lib/lib/tools/fs/walk.js +22 -21
- package/dist-lib/lib/tools/http-request/request.d.ts +4 -2
- package/dist-lib/lib/tools/http-request/request.js +2 -1
- package/dist-lib/lib/tools/http-request/truncate-response.d.ts +16 -1
- package/dist-lib/lib/tools/http-request/truncate-response.js +56 -11
- package/dist-lib/lib/tools/http-request.d.ts +1 -0
- package/dist-lib/lib/tools/http-request.js +88 -14
- package/dist-lib/lib/tools/index.d.ts +3 -1
- package/dist-lib/lib/tools/index.js +6 -2
- package/dist-lib/lib/tools/office/ops.d.ts +1 -0
- package/dist-lib/lib/tools/office/ops.js +5 -1
- package/dist-lib/lib/tools/office.d.ts +3 -2
- package/dist-lib/lib/tools/office.js +200 -39
- package/dist-lib/lib/tools/operations/builders.d.ts +4 -3
- package/dist-lib/lib/tools/operations/builders.js +41 -3
- package/dist-lib/lib/tools/operations/calendar-range.d.ts +16 -0
- package/dist-lib/lib/tools/operations/calendar-range.js +40 -0
- package/dist-lib/lib/tools/operations/compile.js +8 -6
- package/dist-lib/lib/tools/operations/manifest.d.ts +4 -0
- package/dist-lib/lib/tools/pdf/build.d.ts +13 -3
- package/dist-lib/lib/tools/pdf/build.js +52 -16
- package/dist-lib/lib/tools/pdf/pages.d.ts +12 -0
- package/dist-lib/lib/tools/pdf/pages.js +31 -0
- package/dist-lib/lib/tools/pdf/recognize.d.ts +13 -0
- package/dist-lib/lib/tools/pdf/recognize.js +55 -0
- package/dist-lib/lib/tools/pdf/request.d.ts +3 -8
- package/dist-lib/lib/tools/pdf/request.js +4 -4
- package/dist-lib/lib/tools/pdf.d.ts +0 -1
- package/dist-lib/lib/tools/pdf.js +42 -14
- package/dist-lib/lib/tools/skill.js +13 -4
- package/dist-lib/lib/tools/skills/bundled-dir.d.ts +8 -1
- package/dist-lib/lib/tools/skills/bundled-dir.js +38 -32
- package/dist-lib/lib/tools/skills/bundled-hash.d.ts +1 -0
- package/dist-lib/lib/tools/skills/bundled-hash.js +4 -1
- package/dist-lib/lib/tools/skills/catalog-loader.d.ts +12 -0
- package/dist-lib/lib/tools/skills/catalog-loader.js +173 -0
- package/dist-lib/lib/tools/skills/catalog.d.ts +5 -8
- package/dist-lib/lib/tools/skills/catalog.js +1 -162
- package/dist-lib/lib/tools/skills/credential-check.d.ts +1 -0
- package/dist-lib/lib/tools/skills/credential-check.js +3 -0
- package/dist-lib/lib/tools/skills/index.d.ts +1 -0
- package/dist-lib/lib/tools/skills/index.js +1 -0
- package/dist-lib/lib/tools/skills/manifest-parse.js +27 -3
- package/dist-lib/lib/tools/skills/manifest.d.ts +1 -0
- package/dist-lib/lib/tools/skills/overlay-crud.d.ts +3 -3
- package/dist-lib/lib/tools/skills/overlay-crud.js +4 -4
- package/dist-lib/lib/tools/skills/overlay-watch.d.ts +2 -2
- package/dist-lib/lib/tools/skills/overlay-watch.js +4 -3
- package/dist-lib/lib/tools/skills/scope-key.d.ts +1 -0
- package/dist-lib/lib/tools/skills/scope-key.js +4 -0
- package/dist-lib/lib/tools/skills/skill-tree.d.ts +5 -0
- package/dist-lib/lib/tools/skills/skill-tree.js +54 -0
- package/dist-lib/lib/tools/toolsets.d.ts +1 -1
- package/dist-lib/lib/tools/toolsets.js +2 -0
- package/dist-lib/lib/tools/web-fetch.js +41 -130
- package/dist-lib/lib/wire/download.d.ts +10 -0
- package/dist-lib/lib/wire/download.js +35 -0
- package/dist-lib/lib/wire/event.d.ts +41 -0
- package/dist-lib/lib/wire/event.js +306 -0
- package/dist-lib/lib/wire/fields.d.ts +3 -0
- package/dist-lib/lib/wire/fields.js +12 -0
- package/dist-lib/lib/wire/knowledge.d.ts +9 -0
- package/dist-lib/lib/wire/knowledge.js +68 -0
- package/dist-lib/lib/wire/round.d.ts +14 -0
- package/dist-lib/lib/wire/round.js +45 -0
- package/dist-lib/lib/wire/vectors.d.ts +6 -0
- package/dist-lib/lib/wire/vectors.js +33 -0
- package/dist-lib/lib/wire.d.ts +28 -77
- package/dist-lib/lib/wire.js +24 -463
- package/dist-lib/plugins/charts/chart-tool.d.ts +8 -0
- package/dist-lib/plugins/charts/chart-tool.js +175 -0
- package/dist-lib/plugins/charts/index.d.ts +16 -0
- package/dist-lib/plugins/charts/index.js +21 -0
- package/dist-lib/plugins/coding-guards/index.d.ts +25 -0
- package/dist-lib/plugins/coding-guards/index.js +126 -0
- package/dist-lib/plugins/diagrams/draw.d.ts +10 -0
- package/dist-lib/plugins/diagrams/draw.js +90 -0
- package/dist-lib/plugins/diagrams/index.d.ts +13 -0
- package/dist-lib/plugins/diagrams/index.js +15 -0
- package/dist-lib/plugins/diagrams/render.d.ts +16 -0
- package/dist-lib/plugins/diagrams/render.js +285 -0
- package/dist-lib/plugins/image/edit-image.d.ts +3 -22
- package/dist-lib/plugins/image/edit-image.js +20 -44
- package/dist-lib/plugins/image/fit.d.ts +31 -0
- package/dist-lib/plugins/image/fit.js +28 -0
- package/dist-lib/plugins/image/generate-image.d.ts +24 -4
- package/dist-lib/plugins/image/generate-image.js +198 -72
- package/dist-lib/plugins/image/index.d.ts +2 -1
- package/dist-lib/plugins/image/index.js +17 -8
- package/dist-lib/plugins/knowledge/index.d.ts +3 -0
- package/dist-lib/plugins/knowledge/index.js +5 -0
- package/dist-lib/plugins/knowledge/manifest.d.ts +53 -0
- package/dist-lib/plugins/knowledge/manifest.js +86 -0
- package/dist-lib/plugins/knowledge/search-tool.js +8 -8
- package/dist-lib/plugins/knowledge/store.d.ts +45 -8
- package/dist-lib/plugins/knowledge/store.js +428 -166
- package/dist-lib/plugins/mcp/call.js +15 -4
- package/dist-lib/plugins/mcp/protocol.d.ts +10 -2
- package/dist-lib/plugins/mcp/protocol.js +13 -12
- package/dist-lib/plugins/mcp/tool-listing.d.ts +6 -0
- package/dist-lib/plugins/mcp/tool-listing.js +97 -0
- package/dist-lib/plugins/music/generate-music.d.ts +21 -4
- package/dist-lib/plugins/music/generate-music.js +168 -65
- package/dist-lib/plugins/music/index.d.ts +2 -1
- package/dist-lib/plugins/music/index.js +11 -6
- package/dist-lib/plugins/obsidian/index.js +14 -4
- package/dist-lib/plugins/ocr/bmp.d.ts +2 -0
- package/dist-lib/plugins/ocr/bmp.js +27 -0
- package/dist-lib/plugins/ocr/coverage.d.ts +3 -0
- package/dist-lib/plugins/ocr/coverage.js +67 -0
- package/dist-lib/plugins/ocr/index.d.ts +12 -0
- package/dist-lib/plugins/ocr/index.js +20 -0
- package/dist-lib/plugins/ocr/ocr-runtime.d.ts +25 -0
- package/dist-lib/plugins/ocr/ocr-runtime.js +103 -0
- package/dist-lib/plugins/ocr/reading-order.d.ts +5 -0
- package/dist-lib/plugins/ocr/reading-order.js +218 -0
- package/dist-lib/plugins/python/bare-floor.d.ts +1 -0
- package/dist-lib/plugins/python/bare-floor.js +2 -0
- package/dist-lib/plugins/python/index.d.ts +4 -1
- package/dist-lib/plugins/python/index.js +5 -1
- package/dist-lib/plugins/python/language.js +11 -10
- package/dist-lib/plugins/python/python-adapter.d.ts +6 -1
- package/dist-lib/plugins/python/python-adapter.js +34 -1
- package/dist-lib/plugins/python/worker/client.js +1 -1
- package/dist-lib/plugins/python/worker/entry.js +2 -8
- package/dist-lib/plugins/python/worker/preload.d.ts +1 -0
- package/dist-lib/plugins/python/worker/preload.js +2 -0
- package/dist-lib/plugins/python/worker/spawn.js +1 -1
- package/dist-lib/plugins/ripgrep/index.d.ts +15 -0
- package/dist-lib/plugins/ripgrep/index.js +28 -0
- package/dist-lib/plugins/run-report/story.js +4 -1
- package/dist-lib/plugins/sandbox-linux/index.js +2 -2
- package/dist-lib/plugins/sandbox-macos/index.js +2 -2
- package/dist-lib/plugins/sandbox-vm/index.d.ts +2 -1
- package/dist-lib/plugins/sandbox-vm/index.js +2 -2
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +3 -1
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +45 -16
- package/dist-lib/plugins/sandbox-windows/index.js +2 -2
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/speech/speech-engine.d.ts +1 -1
- package/dist-lib/plugins/speech/speech-engine.js +10 -5
- package/dist-lib/plugins/speech/speech-text.d.ts +1 -0
- package/dist-lib/plugins/speech/speech-text.js +9 -4
- package/dist-lib/plugins/speech/voice.js +7 -2
- package/dist-lib/plugins/walkie-talkie/index.d.ts +2 -0
- package/dist-lib/plugins/walkie-talkie/index.js +6 -1
- package/dist-lib/plugins/weather/lookup.js +1 -0
- package/dist-lib/schema/baseline.d.ts +2 -1
- package/dist-lib/schema/baseline.js +2 -2
- package/dist-lib/schema/generate.js +8 -1
- package/dist-lib/schema/harness.js +34 -5
- package/dist-lib/schema/release-tags.d.ts +2 -1
- package/dist-lib/schema/release-tags.js +9 -10
- package/dist-lib/spec/bind.js +3 -0
- package/dist-lib/spec/calls.js +1 -0
- package/dist-lib/spec/hrpc/hrpc.json +13 -0
- package/dist-lib/spec/hrpc/index.js +15 -3
- package/dist-lib/spec/hrpc/messages.js +126 -13
- package/dist-lib/spec/hyperschema/index.js +126 -13
- package/dist-lib/spec/hyperschema/schema.json +86 -2
- package/dist-lib/spec/hyperschema/types.d.ts +18 -3
- package/package.json +96 -36
- package/scripts/addon-externals.cjs +7 -1
- package/worker/harness-sidecar.mjs +10 -0
- package/dist-lib/lib/helpers/buffer-burst.d.ts +0 -1
- package/dist-lib/lib/helpers/buffer-burst.js +0 -22
- package/dist-lib/lib/office/engine/codes.d.ts +0 -62
- package/dist-lib/lib/office/engine/codes.js +0 -61
- package/dist-lib/lib/office/engine/docx/document.d.ts +0 -216
- package/dist-lib/lib/office/engine/docx/document.js +0 -1152
- package/dist-lib/lib/office/engine/docx/index.d.ts +0 -7
- package/dist-lib/lib/office/engine/docx/index.js +0 -8
- package/dist-lib/lib/office/engine/docx/styles.d.ts +0 -31
- package/dist-lib/lib/office/engine/docx/styles.js +0 -173
- package/dist-lib/lib/office/engine/docx/template.d.ts +0 -18
- package/dist-lib/lib/office/engine/docx/template.js +0 -133
- package/dist-lib/lib/office/engine/docx/text.d.ts +0 -55
- package/dist-lib/lib/office/engine/docx/text.js +0 -538
- package/dist-lib/lib/office/engine/drawingml/chart.d.ts +0 -63
- package/dist-lib/lib/office/engine/drawingml/chart.js +0 -539
- package/dist-lib/lib/office/engine/drawingml/text.d.ts +0 -35
- package/dist-lib/lib/office/engine/drawingml/text.js +0 -352
- package/dist-lib/lib/office/engine/errors.d.ts +0 -6
- package/dist-lib/lib/office/engine/errors.js +0 -12
- package/dist-lib/lib/office/engine/image.d.ts +0 -8
- package/dist-lib/lib/office/engine/image.js +0 -48
- package/dist-lib/lib/office/engine/index.d.ts +0 -12
- package/dist-lib/lib/office/engine/index.js +0 -7
- package/dist-lib/lib/office/engine/opc/content-types.d.ts +0 -17
- package/dist-lib/lib/office/engine/opc/content-types.js +0 -74
- package/dist-lib/lib/office/engine/opc/media.d.ts +0 -13
- package/dist-lib/lib/office/engine/opc/media.js +0 -11
- package/dist-lib/lib/office/engine/opc/package.d.ts +0 -51
- package/dist-lib/lib/office/engine/opc/package.js +0 -324
- package/dist-lib/lib/office/engine/opc/paths.d.ts +0 -7
- package/dist-lib/lib/office/engine/opc/paths.js +0 -46
- package/dist-lib/lib/office/engine/opc/properties.d.ts +0 -7
- package/dist-lib/lib/office/engine/opc/properties.js +0 -75
- package/dist-lib/lib/office/engine/opc/relationships.d.ts +0 -23
- package/dist-lib/lib/office/engine/opc/relationships.js +0 -65
- package/dist-lib/lib/office/engine/opc/zip.d.ts +0 -15
- package/dist-lib/lib/office/engine/opc/zip.js +0 -264
- package/dist-lib/lib/office/engine/pptx/fit.d.ts +0 -12
- package/dist-lib/lib/office/engine/pptx/fit.js +0 -37
- package/dist-lib/lib/office/engine/pptx/index.d.ts +0 -8
- package/dist-lib/lib/office/engine/pptx/index.js +0 -8
- package/dist-lib/lib/office/engine/pptx/inherit.d.ts +0 -29
- package/dist-lib/lib/office/engine/pptx/inherit.js +0 -155
- package/dist-lib/lib/office/engine/pptx/notes.d.ts +0 -5
- package/dist-lib/lib/office/engine/pptx/notes.js +0 -85
- package/dist-lib/lib/office/engine/pptx/picture-area.d.ts +0 -23
- package/dist-lib/lib/office/engine/pptx/picture-area.js +0 -84
- package/dist-lib/lib/office/engine/pptx/presentation.d.ts +0 -56
- package/dist-lib/lib/office/engine/pptx/presentation.js +0 -787
- package/dist-lib/lib/office/engine/pptx/read.d.ts +0 -9
- package/dist-lib/lib/office/engine/pptx/read.js +0 -66
- package/dist-lib/lib/office/engine/pptx/shapes.d.ts +0 -52
- package/dist-lib/lib/office/engine/pptx/shapes.js +0 -276
- package/dist-lib/lib/office/engine/pptx/slides.d.ts +0 -27
- package/dist-lib/lib/office/engine/pptx/slides.js +0 -123
- package/dist-lib/lib/office/engine/pptx/template.d.ts +0 -20
- package/dist-lib/lib/office/engine/pptx/template.js +0 -391
- package/dist-lib/lib/office/engine/pptx/types.d.ts +0 -121
- package/dist-lib/lib/office/engine/units.d.ts +0 -3
- package/dist-lib/lib/office/engine/units.js +0 -12
- package/dist-lib/lib/office/engine/utf8.d.ts +0 -2
- package/dist-lib/lib/office/engine/utf8.js +0 -103
- package/dist-lib/lib/office/engine/xlsx/formula.d.ts +0 -49
- package/dist-lib/lib/office/engine/xlsx/formula.js +0 -381
- package/dist-lib/lib/office/engine/xlsx/index.d.ts +0 -8
- package/dist-lib/lib/office/engine/xlsx/index.js +0 -8
- package/dist-lib/lib/office/engine/xlsx/refs.d.ts +0 -22
- package/dist-lib/lib/office/engine/xlsx/refs.js +0 -82
- package/dist-lib/lib/office/engine/xlsx/reshape.d.ts +0 -21
- package/dist-lib/lib/office/engine/xlsx/reshape.js +0 -424
- package/dist-lib/lib/office/engine/xlsx/sheet.d.ts +0 -108
- package/dist-lib/lib/office/engine/xlsx/sheet.js +0 -662
- package/dist-lib/lib/office/engine/xlsx/strings.d.ts +0 -15
- package/dist-lib/lib/office/engine/xlsx/strings.js +0 -93
- package/dist-lib/lib/office/engine/xlsx/styles.d.ts +0 -38
- package/dist-lib/lib/office/engine/xlsx/styles.js +0 -369
- package/dist-lib/lib/office/engine/xlsx/template.d.ts +0 -7
- package/dist-lib/lib/office/engine/xlsx/template.js +0 -54
- package/dist-lib/lib/office/engine/xlsx/workbook.d.ts +0 -162
- package/dist-lib/lib/office/engine/xlsx/workbook.js +0 -881
- package/dist-lib/lib/office/engine/xlsx/write.d.ts +0 -2
- package/dist-lib/lib/office/engine/xlsx/write.js +0 -42
- package/dist-lib/lib/office/engine/xml.d.ts +0 -45
- package/dist-lib/lib/office/engine/xml.js +0 -258
- package/patches/localwatch@1.4.3.patch +0 -13
- /package/dist-lib/lib/{office/engine/pptx/types.js → contract/media.js} +0 -0
|
@@ -3,7 +3,22 @@ import { HarnessError } from './errors.js';
|
|
|
3
3
|
import { DEFAULT_USER_AGENT } from './user-agent.js';
|
|
4
4
|
const UA_SNIFFING_HOSTS = new Set(['wttr.in']);
|
|
5
5
|
export function runNoRedirectFetch(request, url, init = {}) {
|
|
6
|
-
return new Promise((
|
|
6
|
+
return new Promise((outerResolve, outerReject) => {
|
|
7
|
+
let idle = null;
|
|
8
|
+
const stopIdle = () => {
|
|
9
|
+
if (idle) {
|
|
10
|
+
clearTimeout(idle);
|
|
11
|
+
}
|
|
12
|
+
idle = null;
|
|
13
|
+
};
|
|
14
|
+
const resolve = (response) => {
|
|
15
|
+
stopIdle();
|
|
16
|
+
outerResolve(response);
|
|
17
|
+
};
|
|
18
|
+
const reject = (err) => {
|
|
19
|
+
stopIdle();
|
|
20
|
+
outerReject(err);
|
|
21
|
+
};
|
|
7
22
|
const headers = { ...init.headers };
|
|
8
23
|
if (init.body !== undefined &&
|
|
9
24
|
!Object.keys(headers).some((h) => h.toLowerCase() === 'content-length')) {
|
|
@@ -16,6 +31,14 @@ export function runNoRedirectFetch(request, url, init = {}) {
|
|
|
16
31
|
}
|
|
17
32
|
const method = init.method ?? 'GET';
|
|
18
33
|
const req = request(url, { method, headers, validatedAddresses: init.validatedAddresses }, (res) => {
|
|
34
|
+
armIdle();
|
|
35
|
+
const responseHeaders = {};
|
|
36
|
+
for (const [name, value] of Object.entries(res.headers)) {
|
|
37
|
+
responseHeaders[name.toLowerCase()] = String(value);
|
|
38
|
+
}
|
|
39
|
+
const maxBytes = typeof init.maxBytes === 'function'
|
|
40
|
+
? init.maxBytes(contentTypeOf(responseHeaders))
|
|
41
|
+
: init.maxBytes;
|
|
19
42
|
const chunks = [];
|
|
20
43
|
let received = 0;
|
|
21
44
|
let settled = false;
|
|
@@ -24,10 +47,6 @@ export function runNoRedirectFetch(request, url, init = {}) {
|
|
|
24
47
|
return;
|
|
25
48
|
settled = true;
|
|
26
49
|
const body = b4a.concat(chunks);
|
|
27
|
-
const responseHeaders = {};
|
|
28
|
-
for (const [name, value] of Object.entries(res.headers)) {
|
|
29
|
-
responseHeaders[name.toLowerCase()] = String(value);
|
|
30
|
-
}
|
|
31
50
|
resolve({
|
|
32
51
|
status: res.statusCode,
|
|
33
52
|
headers: {
|
|
@@ -45,10 +64,11 @@ export function runNoRedirectFetch(request, url, init = {}) {
|
|
|
45
64
|
reject(err);
|
|
46
65
|
};
|
|
47
66
|
res.on('data', (chunk) => {
|
|
67
|
+
armIdle();
|
|
48
68
|
received += chunk.byteLength;
|
|
49
|
-
if (
|
|
69
|
+
if (maxBytes !== undefined && received > maxBytes) {
|
|
50
70
|
if (init.truncate) {
|
|
51
|
-
const allowed = chunk.byteLength - (received -
|
|
71
|
+
const allowed = chunk.byteLength - (received - maxBytes);
|
|
52
72
|
if (allowed > 0) {
|
|
53
73
|
chunks.push(chunk.subarray(0, allowed));
|
|
54
74
|
}
|
|
@@ -56,7 +76,7 @@ export function runNoRedirectFetch(request, url, init = {}) {
|
|
|
56
76
|
req.destroy();
|
|
57
77
|
return;
|
|
58
78
|
}
|
|
59
|
-
const err = new HarnessError('RESPONSE_TOO_LARGE', [
|
|
79
|
+
const err = new HarnessError('RESPONSE_TOO_LARGE', [maxBytes]);
|
|
60
80
|
req.destroy(err);
|
|
61
81
|
fail(err);
|
|
62
82
|
return;
|
|
@@ -67,6 +87,20 @@ export function runNoRedirectFetch(request, url, init = {}) {
|
|
|
67
87
|
res.on('end', respond);
|
|
68
88
|
});
|
|
69
89
|
req.on('error', reject);
|
|
90
|
+
function armIdle() {
|
|
91
|
+
const ms = init.idleTimeoutMs;
|
|
92
|
+
if (ms === undefined) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
stopIdle();
|
|
96
|
+
idle = setTimeout(() => {
|
|
97
|
+
const err = new Error(`no data received for ${ms} ms`);
|
|
98
|
+
err.name = 'TimeoutError';
|
|
99
|
+
req.destroy(err);
|
|
100
|
+
reject(err);
|
|
101
|
+
}, ms);
|
|
102
|
+
}
|
|
103
|
+
armIdle();
|
|
70
104
|
if (init.signal) {
|
|
71
105
|
const abort = () => {
|
|
72
106
|
const err = new Error('This operation was aborted');
|
|
@@ -85,3 +119,6 @@ export function runNoRedirectFetch(request, url, init = {}) {
|
|
|
85
119
|
req.end();
|
|
86
120
|
});
|
|
87
121
|
}
|
|
122
|
+
function contentTypeOf(headers) {
|
|
123
|
+
return (headers['content-type'] ?? '').split(';')[0]?.trim().toLowerCase() ?? '';
|
|
124
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { HarnessError } from '../errors.js';
|
|
3
3
|
import { extractDocxText } from '../docx/index.js';
|
|
4
|
-
import { pptx, xlsx } from '
|
|
4
|
+
import { pptx, xlsx } from 'qvac-office';
|
|
5
5
|
import { cellText, extractWith } from './extract.js';
|
|
6
6
|
const OFFICE_MIME_EXTENSIONS = {
|
|
7
7
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': '.docx',
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { AddonLoaders, ToolDefinition, ToolExecuteContext, ToolFetch } from '../contract/index.ts';
|
|
2
2
|
import type { KnowledgeService } from '../contract/knowledge.ts';
|
|
3
|
+
import type { OcrService } from '../contract/ocr.ts';
|
|
4
|
+
import type { RootSearch } from '../contract/root-search.ts';
|
|
3
5
|
import type { SandboxService } from '../contract/sandbox.ts';
|
|
4
6
|
import type { EgressProxyService } from '../contract/egress-proxy.ts';
|
|
5
7
|
import type { EmbedHost, ModelHost } from '../contract/models.ts';
|
|
8
|
+
import type { MediaRoundServer } from '../contract/media.ts';
|
|
6
9
|
import type { SpeechService } from '../contract/speech.ts';
|
|
7
10
|
import type { HarnessHook, SkillReadiness } from '../contract/index.ts';
|
|
8
11
|
import type { ExecLanguage, ExecRoute, ExecShell } from '../contract/exec.ts';
|
|
@@ -15,8 +18,12 @@ declare module './context.ts' {
|
|
|
15
18
|
models: ModelHost;
|
|
16
19
|
embed: EmbedHost;
|
|
17
20
|
knowledge: KnowledgeService;
|
|
21
|
+
ocr: OcrService;
|
|
22
|
+
rootSearch: RootSearch;
|
|
18
23
|
sandbox: SandboxService;
|
|
19
24
|
'egress-proxy': EgressProxyService;
|
|
25
|
+
'image-rounds': MediaRoundServer;
|
|
26
|
+
'music-rounds': MediaRoundServer;
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
export interface PluginContext {
|
|
@@ -85,6 +92,8 @@ export declare class PluginRegistry {
|
|
|
85
92
|
private readonly _buildsExec;
|
|
86
93
|
private readonly _deniedRoots;
|
|
87
94
|
private readonly _loaded;
|
|
95
|
+
private readonly _order;
|
|
96
|
+
private readonly _addons;
|
|
88
97
|
private readonly _held;
|
|
89
98
|
private readonly _services;
|
|
90
99
|
private readonly _cleanupErrors;
|
|
@@ -92,6 +101,7 @@ export declare class PluginRegistry {
|
|
|
92
101
|
private _fetch;
|
|
93
102
|
private _publish;
|
|
94
103
|
private _revision;
|
|
104
|
+
private _served;
|
|
95
105
|
private _holds;
|
|
96
106
|
private _drained;
|
|
97
107
|
private _swapping;
|
|
@@ -101,6 +111,7 @@ export declare class PluginRegistry {
|
|
|
101
111
|
constructor(plugins: readonly HarnessPlugin[], options?: PluginRegistryOptions);
|
|
102
112
|
static loadAddons(owner: string, addons?: AddonLoaders): Promise<void>;
|
|
103
113
|
static requirePeers(plugin: string, peers: PeerResolvers): void;
|
|
114
|
+
static requireBare(plugin: string, floor: string): void;
|
|
104
115
|
start(reserved: Iterable<string>, { fetch, publish }?: PluginStartOptions): Promise<StartedPlugins>;
|
|
105
116
|
add(plugin: HarnessPlugin): Promise<void>;
|
|
106
117
|
remove(name: string): Promise<void>;
|
|
@@ -115,6 +126,7 @@ export declare class PluginRegistry {
|
|
|
115
126
|
private _ownDispose;
|
|
116
127
|
private _setUp;
|
|
117
128
|
private _drop;
|
|
129
|
+
private _forget;
|
|
118
130
|
private _check;
|
|
119
131
|
private _removable;
|
|
120
132
|
private _swap;
|
|
@@ -3,6 +3,7 @@ import { Policy } from '../policy/index.js';
|
|
|
3
3
|
import { canonicalDenyRoots, defaultRealpath } from '../tools/fs/scope.js';
|
|
4
4
|
import { TOOLSETS } from '../tools/toolsets.js';
|
|
5
5
|
import { loadAddons } from './addons.js';
|
|
6
|
+
import { requireBare } from './require-bare.js';
|
|
6
7
|
import { requirePeers } from '../helpers/require-peers.js';
|
|
7
8
|
import { PluginRuntime } from './runtime.js';
|
|
8
9
|
const API_VERSION = 1;
|
|
@@ -249,6 +250,8 @@ export class PluginRegistry {
|
|
|
249
250
|
_buildsExec;
|
|
250
251
|
_deniedRoots;
|
|
251
252
|
_loaded = [];
|
|
253
|
+
_order;
|
|
254
|
+
_addons = new Map();
|
|
252
255
|
_held = [];
|
|
253
256
|
_services = new Map();
|
|
254
257
|
_cleanupErrors = [];
|
|
@@ -256,6 +259,7 @@ export class PluginRegistry {
|
|
|
256
259
|
_fetch = undefined;
|
|
257
260
|
_publish = undefined;
|
|
258
261
|
_revision = 0;
|
|
262
|
+
_served = false;
|
|
259
263
|
_holds = 0;
|
|
260
264
|
_drained = null;
|
|
261
265
|
_swapping = null;
|
|
@@ -271,6 +275,7 @@ export class PluginRegistry {
|
|
|
271
275
|
for (const plugin of order) {
|
|
272
276
|
validated(plugin);
|
|
273
277
|
}
|
|
278
|
+
this._order = order;
|
|
274
279
|
const runtime = new PluginRuntime(order.map((plugin) => this._plugin(plugin, 0, (loaded) => this._loaded.push(loaded))));
|
|
275
280
|
for (const [name, value] of core) {
|
|
276
281
|
provideService(runtime.ctx, name, value);
|
|
@@ -287,6 +292,9 @@ export class PluginRegistry {
|
|
|
287
292
|
static requirePeers(plugin, peers) {
|
|
288
293
|
requirePeers(`@qvac/harness/plugins/${plugin}`, peers);
|
|
289
294
|
}
|
|
295
|
+
static requireBare(plugin, floor) {
|
|
296
|
+
requireBare(`@qvac/harness/plugins/${plugin}`, floor);
|
|
297
|
+
}
|
|
290
298
|
start(reserved, { fetch, publish } = {}) {
|
|
291
299
|
if (this._closing) {
|
|
292
300
|
return Promise.reject(new Error('Plugin registry is closing or closed'));
|
|
@@ -296,14 +304,20 @@ export class PluginRegistry {
|
|
|
296
304
|
this._reserved = new Set(reserved);
|
|
297
305
|
this._fetch = fetch;
|
|
298
306
|
this._publish = publish;
|
|
307
|
+
for (const plugin of this._order) {
|
|
308
|
+
const loading = loadAddons(`plugin '${plugin.name}'`, plugin.addons);
|
|
309
|
+
loading.catch(noop);
|
|
310
|
+
this._addons.set(plugin, loading);
|
|
311
|
+
}
|
|
299
312
|
this._starting = this._runtime.ready().then(() => this._started());
|
|
300
313
|
return this._starting;
|
|
301
314
|
}
|
|
302
315
|
add(plugin) {
|
|
303
316
|
return this._swap(() => {
|
|
304
317
|
this._check(plugin);
|
|
318
|
+
const revision = this._served ? ++this._revision : 0;
|
|
305
319
|
return async () => {
|
|
306
|
-
await this._setUp(plugin, (loaded) => this._loaded.push(loaded));
|
|
320
|
+
await this._setUp(plugin, revision, (loaded) => this._loaded.push(loaded));
|
|
307
321
|
};
|
|
308
322
|
});
|
|
309
323
|
}
|
|
@@ -324,11 +338,12 @@ export class PluginRegistry {
|
|
|
324
338
|
this._check(plugin, name);
|
|
325
339
|
return async () => {
|
|
326
340
|
const index = await this._drop(name);
|
|
327
|
-
await this._setUp(plugin, (loaded) => this._loaded.splice(index, 0, loaded));
|
|
341
|
+
await this._setUp(plugin, ++this._revision, (loaded) => this._loaded.splice(index, 0, loaded));
|
|
328
342
|
};
|
|
329
343
|
});
|
|
330
344
|
}
|
|
331
345
|
async hold(join = false) {
|
|
346
|
+
this._served = true;
|
|
332
347
|
while (this._swapping && !(join && this._holds > 0)) {
|
|
333
348
|
await this._swapping;
|
|
334
349
|
}
|
|
@@ -344,8 +359,16 @@ export class PluginRegistry {
|
|
|
344
359
|
}
|
|
345
360
|
};
|
|
346
361
|
}
|
|
347
|
-
unload() {
|
|
348
|
-
|
|
362
|
+
async unload() {
|
|
363
|
+
const setups = [...this._held];
|
|
364
|
+
const outcomes = await Promise.allSettled(setups.map((setup) => setup.unload?.()));
|
|
365
|
+
outcomes.forEach((outcome, index) => {
|
|
366
|
+
if (outcome.status === 'fulfilled' &&
|
|
367
|
+
!this._loaded.some((loaded) => loaded.setup === setups[index])) {
|
|
368
|
+
this._forget(setups[index]);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
return outcomes;
|
|
349
372
|
}
|
|
350
373
|
unloadIdle() {
|
|
351
374
|
return Promise.allSettled(this._held.map(async (setup) => setup.unloadIdle?.()));
|
|
@@ -384,7 +407,9 @@ export class PluginRegistry {
|
|
|
384
407
|
for (const name of plugin.needs ?? []) {
|
|
385
408
|
readService(ctx, name);
|
|
386
409
|
}
|
|
387
|
-
|
|
410
|
+
const loading = this._addons.get(plugin) ?? loadAddons(`plugin '${plugin.name}'`, plugin.addons);
|
|
411
|
+
this._addons.delete(plugin);
|
|
412
|
+
await loading;
|
|
388
413
|
const onDispose = (dispose) => this._ownDispose(ctx, plugin.name, dispose);
|
|
389
414
|
const fetch = this._fetch ? this._fetch(undefined, anywhere) : unfetched;
|
|
390
415
|
const deniedRoots = Object.freeze(await canonicalDenyRoots(this._deniedRoots, defaultRealpath));
|
|
@@ -439,33 +464,64 @@ export class PluginRegistry {
|
|
|
439
464
|
}
|
|
440
465
|
});
|
|
441
466
|
}
|
|
442
|
-
async _setUp(plugin, place) {
|
|
467
|
+
async _setUp(plugin, revision, place) {
|
|
443
468
|
const setups = this._held.length;
|
|
444
469
|
try {
|
|
445
|
-
await this._runtime.add(this._plugin(plugin,
|
|
470
|
+
await this._runtime.add(this._plugin(plugin, revision, place));
|
|
446
471
|
}
|
|
447
472
|
catch (error) {
|
|
448
|
-
|
|
449
|
-
|
|
473
|
+
const acquired = this._held.slice(setups);
|
|
474
|
+
const outcomes = await Promise.allSettled(acquired.map((setup) => setup.unload?.()));
|
|
475
|
+
const failures = [error];
|
|
476
|
+
outcomes.forEach((outcome, index) => {
|
|
477
|
+
if (outcome.status === 'fulfilled') {
|
|
478
|
+
this._forget(acquired[index]);
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
failures.push(outcome.reason);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
throw failures.length === 1
|
|
485
|
+
? error
|
|
486
|
+
: new AggregateError(failures, 'Plugin setup and model cleanup failed', { cause: error });
|
|
450
487
|
}
|
|
451
488
|
}
|
|
452
489
|
async _drop(name) {
|
|
453
490
|
const index = this._loaded.findIndex((loaded) => loaded.plugin.name === name);
|
|
454
491
|
const [{ plugin, setup }] = this._loaded.splice(index, 1);
|
|
455
|
-
this._held.splice(this._held.indexOf(setup), 1);
|
|
456
492
|
const errors = this._cleanupErrors.length;
|
|
493
|
+
const failures = [];
|
|
457
494
|
try {
|
|
458
495
|
await this._runtime.remove(name);
|
|
459
496
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
497
|
+
catch (error) {
|
|
498
|
+
failures.push(error);
|
|
499
|
+
}
|
|
500
|
+
this._cleanupErrors.length = errors;
|
|
501
|
+
for (const service of plugin.provides ?? []) {
|
|
502
|
+
this._services.delete(service);
|
|
503
|
+
}
|
|
504
|
+
try {
|
|
465
505
|
await setup.unload?.();
|
|
506
|
+
this._forget(setup);
|
|
507
|
+
}
|
|
508
|
+
catch (error) {
|
|
509
|
+
failures.push(error);
|
|
510
|
+
}
|
|
511
|
+
if (failures.length === 1) {
|
|
512
|
+
throw failures[0];
|
|
513
|
+
}
|
|
514
|
+
if (failures.length > 1) {
|
|
515
|
+
throw new AggregateError(failures, `Plugin '${name}' removal and model cleanup failed`);
|
|
466
516
|
}
|
|
467
517
|
return index;
|
|
468
518
|
}
|
|
519
|
+
_forget(setup) {
|
|
520
|
+
const index = this._held.indexOf(setup);
|
|
521
|
+
if (index !== -1) {
|
|
522
|
+
this._held.splice(index, 1);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
469
525
|
_check(plugin, replacing) {
|
|
470
526
|
const others = this._loaded
|
|
471
527
|
.map((loaded) => loaded.plugin)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function requireBare(subject: string, floor: string): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function requireBare(subject, floor) {
|
|
2
|
+
const running = globalThis.Bare?.version;
|
|
3
|
+
if (running === undefined || !olderThan(running.replace(/^v/, ''), floor)) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
throw new Error(`${subject} needs Bare ${floor} or later, and this is Bare ${running}`);
|
|
7
|
+
}
|
|
8
|
+
function olderThan(version, floor) {
|
|
9
|
+
const have = version.split('.').map((part) => parseInt(part, 10));
|
|
10
|
+
const need = floor.split('.').map((part) => parseInt(part, 10));
|
|
11
|
+
const differs = need.findIndex((part, i) => have[i] !== part);
|
|
12
|
+
return differs !== -1 && have[differs] < need[differs];
|
|
13
|
+
}
|
package/dist-lib/lib/prompt.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Message, SystemPromptParts } from './contract/index.ts';
|
|
1
|
+
import type { GuidelineWording, Message, SystemPromptParts } from './contract/index.ts';
|
|
2
2
|
export declare const RAG_CITATION_LINE = "After your answer, add one final line naming the files you used, written exactly as [Sources: file-a.pdf, file-b.md] - or [Sources: none] if the excerpts did not answer the question. This line is required, it is the only place square brackets belong, and it is removed before the user sees it.";
|
|
3
3
|
export declare function currentTimeAnnotation(now?: Date): string;
|
|
4
4
|
export declare function lastUserContent(messages: Message[]): string;
|
|
@@ -7,16 +7,19 @@ export declare function annotateUserTimes<T extends {
|
|
|
7
7
|
content: string;
|
|
8
8
|
sentAt?: number | undefined;
|
|
9
9
|
}>(turns: ReadonlyArray<T>, now?: Date): T[];
|
|
10
|
-
export declare function toolGuidelines(name: string): string[];
|
|
10
|
+
export declare function toolGuidelines(name: string, wording?: GuidelineWording): string[];
|
|
11
11
|
export interface SystemPromptInput {
|
|
12
12
|
bio?: string | null | undefined;
|
|
13
13
|
toolNames?: ReadonlyArray<string>;
|
|
14
14
|
skillsSection?: string | null;
|
|
15
|
+
platform?: string | null | undefined;
|
|
16
|
+
guidelines?: GuidelineWording | undefined;
|
|
15
17
|
}
|
|
16
|
-
export declare function systemPromptParts({ bio, toolNames, skillsSection }: SystemPromptInput): SystemPromptParts;
|
|
18
|
+
export declare function systemPromptParts({ bio, toolNames, skillsSection, platform, guidelines }: SystemPromptInput): SystemPromptParts;
|
|
17
19
|
export declare function buildSystemPrompt(input: SystemPromptInput): string;
|
|
18
20
|
export interface PromptSkill {
|
|
19
21
|
readonly name: string;
|
|
20
22
|
readonly description: string;
|
|
23
|
+
readonly note?: string | undefined;
|
|
21
24
|
}
|
|
22
|
-
export declare function skillsPromptSection(
|
|
25
|
+
export declare function skillsPromptSection(skills: ReadonlyArray<PromptSkill>, wording?: GuidelineWording): string | null;
|
package/dist-lib/lib/prompt.js
CHANGED
|
@@ -1,22 +1,56 @@
|
|
|
1
1
|
const BASE_GUIDELINES = [
|
|
2
|
-
|
|
2
|
+
[
|
|
3
|
+
'ask-when-ambiguous',
|
|
4
|
+
'When the request is ambiguous, ask for clarification rather than guessing.'
|
|
5
|
+
]
|
|
3
6
|
];
|
|
4
7
|
const TOOL_GUIDELINES = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
[
|
|
9
|
+
'one-action-at-a-time',
|
|
10
|
+
'Request one action at a time; inspect the result before deciding the next step.'
|
|
11
|
+
],
|
|
12
|
+
[
|
|
13
|
+
'recover-from-failure',
|
|
14
|
+
'If a tool fails, analyze the error and try a corrective action before asking the user for help.'
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
'finish-setup',
|
|
18
|
+
'If a tool reports missing auth, setup, or approval, take the next tool step to complete it. Do not ask the user in chat whether to request approval; the policy/UI layer handles that.'
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
'prove-side-effects',
|
|
22
|
+
'If the user asks you to use a tool, emit a tool call. Never claim external information was fetched or a side effect completed unless a tool result from this turn proves it.'
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
'summarize-results',
|
|
26
|
+
'After tool execution, summarize the result for the user in plain language.'
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
'intent',
|
|
30
|
+
'Every gated tool takes an `intent`: one short sentence, addressed to the user, saying plainly what that call does for them — the outcome in their words, never the code. It is the only thing the approval prompt shows them, so never leave it out and never paste the command into it.'
|
|
31
|
+
]
|
|
11
32
|
];
|
|
12
33
|
const EXEC_FILE_GUIDELINE = 'You CAN create and deliver files: run code with `exec` and declare the file names in `outputs` — each produced file is attached to the chat for the user to open or save. Never claim you cannot produce a file, and never instruct the user to run code or use another app to make one.';
|
|
13
34
|
const EXEC_ATTACHED_IMAGE_GUIDELINE = 'An image the user attached is a file you can use, not just something to look at: when they want it inside a file you build, stage that attachment as an `exec` input and embed it. Never generate a replacement for an image the user attached, and if you truly cannot use it, say so rather than delivering the file without it.';
|
|
14
35
|
const SKILL_GUIDELINES = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
[
|
|
37
|
+
'skills-are-guidance',
|
|
38
|
+
'Tools are typed callable functions; skills are markdown guidance for when and how to use them.'
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
'skill-first',
|
|
42
|
+
'Before your first action on a request, check the skills list. If a skill covers the capability you are about to use, call the `skill` tool to load its full instructions FIRST — before any other tool call, and before asking the user a follow-up; the instructions usually answer it.'
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
'skill-before-capability',
|
|
46
|
+
'Never use a capability whose skill you have not loaded this conversation, and never claim a capability is unavailable without checking the skills list.'
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
'skill-files',
|
|
50
|
+
'Loaded instructions may point to more files in the skill (e.g. references/edit.md). Call the `skill` tool again with `name` and `file` to load one BEFORE doing the work it covers — never guess what a referenced file contains.'
|
|
51
|
+
]
|
|
19
52
|
];
|
|
53
|
+
const SKILLS_LIST_HEADER = 'Skills available this turn. You MUST call the `skill` tool with its name BEFORE using the capability it describes — load the skill first, then act.';
|
|
20
54
|
const CITATION_GUIDELINE = 'Search results arrive prefixed with source labels (`[1]`, `[Source 2: file, ...]`, `Source: <url>`). Do NOT echo those labels or refer to sources by number — they are shown to the user separately. Name a source (its file name or site) in natural prose when you rely on it. If the user explicitly asks for numbered references, produce them normally.';
|
|
21
55
|
export const RAG_CITATION_LINE = 'After your answer, add one final line naming the files you used, written exactly as [Sources: file-a.pdf, file-b.md] - or [Sources: none] if the excerpts did not answer the question. This line is required, it is the only place square brackets belong, and it is removed before the user sees it.';
|
|
22
56
|
const METADATA_SECTION = `## Message Metadata
|
|
@@ -51,36 +85,56 @@ export function annotateUserTimes(turns, now = new Date()) {
|
|
|
51
85
|
return { ...turn, content: `${currentTimeAnnotation(at)}\n\n${turn.content}` };
|
|
52
86
|
});
|
|
53
87
|
}
|
|
54
|
-
|
|
88
|
+
function toolGuidelineEntries(name) {
|
|
55
89
|
if (name === 'exec') {
|
|
56
|
-
return [
|
|
90
|
+
return [
|
|
91
|
+
['exec-files', EXEC_FILE_GUIDELINE],
|
|
92
|
+
['exec-attached-images', EXEC_ATTACHED_IMAGE_GUIDELINE]
|
|
93
|
+
];
|
|
57
94
|
}
|
|
58
|
-
return name === 'web_search' || name === 'web_fetch' ? [CITATION_GUIDELINE] : [];
|
|
95
|
+
return name === 'web_search' || name === 'web_fetch' ? [['citations', CITATION_GUIDELINE]] : [];
|
|
59
96
|
}
|
|
60
|
-
function
|
|
97
|
+
export function toolGuidelines(name, wording = {}) {
|
|
98
|
+
return toolGuidelineEntries(name)
|
|
99
|
+
.map(([id, text]) => wording[id] ?? text)
|
|
100
|
+
.filter((line) => line !== false);
|
|
101
|
+
}
|
|
102
|
+
function buildGuidelines(active, wording = {}) {
|
|
61
103
|
const lines = [...BASE_GUIDELINES];
|
|
62
104
|
if (active.size > 0) {
|
|
63
105
|
lines.push(...TOOL_GUIDELINES);
|
|
64
106
|
}
|
|
65
107
|
if (active.has('exec')) {
|
|
66
|
-
lines.push(...
|
|
108
|
+
lines.push(...toolGuidelineEntries('exec'));
|
|
67
109
|
}
|
|
68
110
|
if (active.has('skill')) {
|
|
69
111
|
lines.push(...SKILL_GUIDELINES);
|
|
70
112
|
}
|
|
71
113
|
if (active.has('web_search') || active.has('web_fetch')) {
|
|
72
|
-
lines.push(
|
|
114
|
+
lines.push(...toolGuidelineEntries('web_search'));
|
|
73
115
|
}
|
|
74
|
-
|
|
116
|
+
const worded = lines
|
|
117
|
+
.map(([id, text]) => wording[id] ?? text)
|
|
118
|
+
.filter((line) => line !== false);
|
|
119
|
+
return worded.length ? `**Guidelines:**\n${worded.map((line) => `- ${line}`).join('\n')}` : '';
|
|
75
120
|
}
|
|
76
|
-
|
|
121
|
+
const PLATFORM_LABELS = {
|
|
122
|
+
darwin: 'macOS',
|
|
123
|
+
linux: 'Linux',
|
|
124
|
+
win32: 'Windows',
|
|
125
|
+
ios: 'iOS',
|
|
126
|
+
android: 'Android'
|
|
127
|
+
};
|
|
128
|
+
export function systemPromptParts({ bio, toolNames = [], skillsSection, platform, guidelines }) {
|
|
77
129
|
const active = new Set(toolNames);
|
|
78
130
|
const header = active.size
|
|
79
131
|
? 'You are a helpful AI assistant with access to tools.'
|
|
80
132
|
: 'You are a helpful AI assistant.';
|
|
81
133
|
const preamble = `${header}\n\n${METADATA_SECTION}`;
|
|
134
|
+
const label = platform ? PLATFORM_LABELS[platform] : undefined;
|
|
135
|
+
const host = label ? `You run on ${label}.` : null;
|
|
82
136
|
const skills = active.has('skill') ? skillsSection : null;
|
|
83
|
-
const text = [preamble, bio, skills, buildGuidelines(active)]
|
|
137
|
+
const text = [preamble, host, bio, skills, buildGuidelines(active, guidelines)]
|
|
84
138
|
.filter((part) => Boolean(part))
|
|
85
139
|
.join('\n\n');
|
|
86
140
|
return { text, bioChars: (bio ?? '').length, skillsChars: (skills ?? '').length };
|
|
@@ -88,9 +142,12 @@ export function systemPromptParts({ bio, toolNames = [], skillsSection }) {
|
|
|
88
142
|
export function buildSystemPrompt(input) {
|
|
89
143
|
return systemPromptParts(input).text;
|
|
90
144
|
}
|
|
91
|
-
export function skillsPromptSection(
|
|
92
|
-
if (!
|
|
145
|
+
export function skillsPromptSection(skills, wording = {}) {
|
|
146
|
+
if (!skills.length)
|
|
93
147
|
return null;
|
|
94
|
-
const lines =
|
|
95
|
-
|
|
148
|
+
const lines = skills
|
|
149
|
+
.map((skill) => `- ${skill.name}: ${skill.description}${skill.note ? ` [${skill.note}]` : ''}`)
|
|
150
|
+
.join('\n');
|
|
151
|
+
const header = wording['skills-list'] ?? SKILLS_LIST_HEADER;
|
|
152
|
+
return header === false ? lines : `${header}\n${lines}`;
|
|
96
153
|
}
|
|
@@ -3,6 +3,7 @@ import type { CompletionArgs } from '../capabilities/completion-engine/index.ts'
|
|
|
3
3
|
import type { CompletionSdk, RoundModelLease, ToolDefinition } from '../contract/index.ts';
|
|
4
4
|
import type { CompletionContext } from '../../index.ts';
|
|
5
5
|
import type { CompletionSkillEntry } from '../capabilities/skill-entry.ts';
|
|
6
|
+
import type { SkillTreeRef } from '../tools/skills/catalog.ts';
|
|
6
7
|
import { type LlmDeviceConfig, type ModelLoadOptions, type ModelLifecycleSdk, type PoolLike } from '../models/model-pool.ts';
|
|
7
8
|
export type CompletionRuntimeRequest = CompletionContext & {
|
|
8
9
|
ctxSize?: number;
|
|
@@ -11,6 +12,7 @@ interface RuntimeLease {
|
|
|
11
12
|
modelId: string;
|
|
12
13
|
ctxSize?: number | undefined;
|
|
13
14
|
slots?: number | undefined;
|
|
15
|
+
canThink?: boolean | undefined;
|
|
14
16
|
release(): void;
|
|
15
17
|
}
|
|
16
18
|
interface RuntimeAcquireOptions {
|
|
@@ -32,18 +34,18 @@ interface RuntimeResidency {
|
|
|
32
34
|
load(): Promise<CompletionSdk>;
|
|
33
35
|
};
|
|
34
36
|
tools(): readonly ToolDefinition[];
|
|
35
|
-
skills(agentId: string | null, model: string): Promise<CompletionSkillEntry[]>;
|
|
36
|
-
|
|
37
|
+
skills(agentId: string | null, model: string, trees?: readonly SkillTreeRef[]): Promise<CompletionSkillEntry[]>;
|
|
38
|
+
platform(): string | undefined;
|
|
37
39
|
loadOptions(model: string, agent?: CompletionContext['agent']): ModelLoadOptions;
|
|
38
40
|
deviceConfig(): LlmDeviceConfig;
|
|
39
41
|
acquireLease(options: RuntimeAcquireOptions): Promise<RuntimeLease | null>;
|
|
40
|
-
|
|
42
|
+
roomForCompletion(model: string, options: {
|
|
41
43
|
loadOpts: ModelLoadOptions;
|
|
42
|
-
signal?: BareAbortSignal;
|
|
43
|
-
}): Promise<
|
|
44
|
+
signal?: BareAbortSignal | undefined;
|
|
45
|
+
}): Promise<void>;
|
|
44
46
|
loadLifecycleSdk(): Promise<ModelLifecycleSdk>;
|
|
45
47
|
}
|
|
46
|
-
export type RoundResidency = Pick<RuntimeResidency, 'pool' | 'gate' | 'sdk' | 'acquireLease' | '
|
|
48
|
+
export type RoundResidency = Pick<RuntimeResidency, 'pool' | 'gate' | 'sdk' | 'acquireLease' | 'roomForCompletion'>;
|
|
47
49
|
interface RoundTarget {
|
|
48
50
|
model: string;
|
|
49
51
|
key: string;
|