@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
2
|
import type { HarnessCapabilityProfile } from '../spec/hyperschema/types.d.ts';
|
|
3
|
-
import type { AccessPolicy, AgentHandoff, ApproveFn, AskUserFn, AttachFn, FetchAttachmentFn, HistoryToolCall, ProgressFn, ResourceDescriptor, ResponseFormat } from './contract/index.ts';
|
|
3
|
+
import type { AccessPolicy, AgentHandoff, ApproveFn, AskUserFn, AttachFn, FetchAttachmentFn, HistoryToolCall, ProgressFn, WorkspaceSkill, ResourceDescriptor, ResponseFormat, MediaRoundIo, MediaRoundPort, MediaRoundRequest, MediaRoundResult, ShowImageFn, ProjectSkill } from './contract/index.ts';
|
|
4
4
|
import type { KvCacheDeletionResult } from './capabilities/kv-cache.ts';
|
|
5
|
+
import type { RunLatency } from './helpers/run-latency.ts';
|
|
5
6
|
import type { ModelRoundIo, ModelRoundPort, ModelRoundRequest, ModelRoundResult } from './capabilities/completion-engine/index.ts';
|
|
6
7
|
import type { ModelSourcePreview, PreviewModelSourceContext } from './capabilities/preview-model-source.ts';
|
|
7
8
|
import type { MemoryBudget } from './hardware/memory-budget.ts';
|
|
@@ -13,6 +14,7 @@ import type { ListModelsOptions, ModelInfo } from './models/model-list.ts';
|
|
|
13
14
|
import type { ToolCatalogEntry } from './tools/catalog.ts';
|
|
14
15
|
import type { ManagedSkill, SkillFileContent } from './tools/skills/overlay-crud.ts';
|
|
15
16
|
import type { DriveOpFn, GrantedDrive } from './tools/fs/remote-protocol.ts';
|
|
17
|
+
import type { OcrPage, OcrReadContext } from './contract/ocr.ts';
|
|
16
18
|
import type { SpeakResult } from './contract/speech.ts';
|
|
17
19
|
import type { RunInput } from './contract/completion.ts';
|
|
18
20
|
import type { RunGoal, TurnContext } from './contract/run.ts';
|
|
@@ -66,6 +68,8 @@ export interface CompletionContext {
|
|
|
66
68
|
recovery?: RecoveryResolution[];
|
|
67
69
|
model: string;
|
|
68
70
|
agent: AgentKnobs;
|
|
71
|
+
projectSkills?: readonly ProjectSkill[];
|
|
72
|
+
workspaceSkills?: readonly WorkspaceSkill[];
|
|
69
73
|
agents?: Record<string, AgentKnobs>;
|
|
70
74
|
messages: ChatMessage[];
|
|
71
75
|
typedText?: string;
|
|
@@ -89,17 +93,19 @@ export interface CompletionContext {
|
|
|
89
93
|
approve?: (call: ApprovalCall) => Promise<boolean>;
|
|
90
94
|
attach?: AttachFn;
|
|
91
95
|
fetchAttachment?: FetchAttachmentFn;
|
|
96
|
+
showImage?: ShowImageFn;
|
|
92
97
|
progress?: ProgressFn;
|
|
93
98
|
askUser?: AskUserFn;
|
|
94
99
|
runLog?: HostRunLog;
|
|
95
100
|
boot?: EngineBoot;
|
|
96
101
|
onStep?: (step: EngineStep) => Promise<void>;
|
|
97
|
-
hostAppendTimeoutMs?: number;
|
|
98
102
|
requestDigestKey?: Uint8Array;
|
|
99
103
|
signal?: BareAbortSignal;
|
|
100
104
|
input?: AsyncIterable<RunInput>;
|
|
101
105
|
roundCut?: (cut: (note: string) => void) => void;
|
|
102
106
|
modelRound?: ModelRoundPort;
|
|
107
|
+
mediaRound?: MediaRoundPort;
|
|
108
|
+
latency?: RunLatency;
|
|
103
109
|
}
|
|
104
110
|
export interface HostSignal {
|
|
105
111
|
aborted?: boolean;
|
|
@@ -259,11 +265,13 @@ export interface InfraModel {
|
|
|
259
265
|
export interface HarnessContract {
|
|
260
266
|
completion(context: CompletionContext | ResumeCompletionContext): AsyncIterable<HarnessEvent>;
|
|
261
267
|
serveModelRound?(request: ModelRoundRequest, io: ModelRoundIo): Promise<ModelRoundResult>;
|
|
268
|
+
serveMediaRound?(request: MediaRoundRequest, io: MediaRoundIo): Promise<MediaRoundResult>;
|
|
262
269
|
invoke?(context: InvokeContext): AsyncIterable<HarnessEvent>;
|
|
263
270
|
download?(context: DownloadContext): AsyncIterable<HarnessEvent>;
|
|
264
271
|
describe?(): Promise<HarnessInfo | null> | HarnessInfo;
|
|
265
272
|
embed?(context: EmbedContext): Promise<number[][]>;
|
|
266
273
|
transcribe?(context: TranscribeContext): Promise<string>;
|
|
274
|
+
ocrRead?(context: OcrReadContext): Promise<OcrPage>;
|
|
267
275
|
detectLanguage?(context: DetectLanguageContext): DetectedLanguage[] | Promise<DetectedLanguage[]>;
|
|
268
276
|
speak?(context: SpeakContext): Promise<SpeakResult>;
|
|
269
277
|
speakStream?(context: SpeakStreamContext): AsyncIterable<SpeakResult>;
|
package/dist-lib/lib/errors.d.ts
CHANGED
|
@@ -68,6 +68,10 @@ declare const HARNESS_ERRORS: {
|
|
|
68
68
|
readonly code: 102107;
|
|
69
69
|
readonly message: () => string;
|
|
70
70
|
};
|
|
71
|
+
readonly MEDIA_MODEL_MISSING: {
|
|
72
|
+
readonly code: 102108;
|
|
73
|
+
readonly message: (kind: string, model: string) => string;
|
|
74
|
+
};
|
|
71
75
|
readonly CONTEXT_WINDOW_EXCEEDED: {
|
|
72
76
|
readonly code: 102201;
|
|
73
77
|
readonly message: () => string;
|
|
@@ -152,10 +156,6 @@ declare const HARNESS_ERRORS: {
|
|
|
152
156
|
readonly code: 102504;
|
|
153
157
|
readonly message: (exitCode: number) => string;
|
|
154
158
|
};
|
|
155
|
-
readonly ATTACHMENT_STAGING_TIMED_OUT: {
|
|
156
|
-
readonly code: 102505;
|
|
157
|
-
readonly message: (ms: number) => string;
|
|
158
|
-
};
|
|
159
159
|
readonly FETCH_REFUSED: {
|
|
160
160
|
readonly code: 102506;
|
|
161
161
|
readonly message: (reason: string) => string;
|
|
@@ -248,6 +248,10 @@ declare const HARNESS_ERRORS: {
|
|
|
248
248
|
readonly code: 102711;
|
|
249
249
|
readonly message: () => string;
|
|
250
250
|
};
|
|
251
|
+
readonly BUNDLED_SKILLS_HASH_INVALID: {
|
|
252
|
+
readonly code: 102712;
|
|
253
|
+
readonly message: (hash: string) => string;
|
|
254
|
+
};
|
|
251
255
|
};
|
|
252
256
|
type Errors = typeof HARNESS_ERRORS;
|
|
253
257
|
export type HarnessErrorName = keyof Errors;
|
package/dist-lib/lib/errors.js
CHANGED
|
@@ -45,6 +45,10 @@ const HARNESS_ERRORS = {
|
|
|
45
45
|
code: 102107,
|
|
46
46
|
message: () => 'translation model download stalled'
|
|
47
47
|
},
|
|
48
|
+
MEDIA_MODEL_MISSING: {
|
|
49
|
+
code: 102108,
|
|
50
|
+
message: (kind, model) => `this device does not hold the ${kind} model ${model}`
|
|
51
|
+
},
|
|
48
52
|
CONTEXT_WINDOW_EXCEEDED: {
|
|
49
53
|
code: 102201,
|
|
50
54
|
message: () => 'This message is too large for the model context window.'
|
|
@@ -102,10 +106,6 @@ const HARNESS_ERRORS = {
|
|
|
102
106
|
code: 102504,
|
|
103
107
|
message: (exitCode) => `python worker exited with code ${exitCode}`
|
|
104
108
|
},
|
|
105
|
-
ATTACHMENT_STAGING_TIMED_OUT: {
|
|
106
|
-
code: 102505,
|
|
107
|
-
message: (ms) => `staging attachments timed out after ${ms}ms`
|
|
108
|
-
},
|
|
109
109
|
FETCH_REFUSED: { code: 102506, message: (reason) => `fetch refused: ${reason}` },
|
|
110
110
|
OBSIDIAN_NOTE_NAME_IS_PATH: {
|
|
111
111
|
code: 102601,
|
|
@@ -159,16 +159,16 @@ const HARNESS_ERRORS = {
|
|
|
159
159
|
SKILL_NOT_FOUND: { code: 102703, message: (name) => `skill not found: ${name}` },
|
|
160
160
|
BUNDLED_SKILLS_INVALID: {
|
|
161
161
|
code: 102704,
|
|
162
|
-
message: (staging) => `
|
|
162
|
+
message: (staging) => `skills staging dir ${staging} failed validation`
|
|
163
163
|
},
|
|
164
164
|
BUNDLED_SKILLS_TAMPERED: {
|
|
165
165
|
code: 102705,
|
|
166
|
-
message: (dir) => `
|
|
166
|
+
message: (dir) => `skills dir ${dir} failed validation after a rewrite — ` +
|
|
167
167
|
'another process is tampering with it; remove it and restart'
|
|
168
168
|
},
|
|
169
169
|
BUNDLED_SKILLS_OCCUPIED: {
|
|
170
170
|
code: 102706,
|
|
171
|
-
message: (dir, why) => `
|
|
171
|
+
message: (dir, why) => `skills dir ${dir} could not be read or replaced${why} — remove it and restart`
|
|
172
172
|
},
|
|
173
173
|
DRIVE_TIMED_OUT: { code: 102707, message: (op) => `drive ${op} timed out` },
|
|
174
174
|
DRIVE_READ_TRUNCATED: {
|
|
@@ -180,7 +180,11 @@ const HARNESS_ERRORS = {
|
|
|
180
180
|
message: () => 'cannot fence the app storage root: the SDK home is unknown'
|
|
181
181
|
},
|
|
182
182
|
SLM_TRANSLATION_UNAVAILABLE: { code: 102710, message: () => 'slm translation is unavailable' },
|
|
183
|
-
PDF_TEXT_UNAVAILABLE: { code: 102711, message: () => 'PDF text is not available on this device' }
|
|
183
|
+
PDF_TEXT_UNAVAILABLE: { code: 102711, message: () => 'PDF text is not available on this device' },
|
|
184
|
+
BUNDLED_SKILLS_HASH_INVALID: {
|
|
185
|
+
code: 102712,
|
|
186
|
+
message: (hash) => `bundled skills hash ${hash} is not 16 hex characters`
|
|
187
|
+
}
|
|
184
188
|
};
|
|
185
189
|
addCodes(Object.fromEntries(Object.entries(HARNESS_ERRORS).map(([name, { code, message }]) => [code, { name, message }])), { name: '@qvac/harness', version: `${Object.keys(HARNESS_ERRORS).length}.0.0` });
|
|
186
190
|
export class HarnessError extends QvacErrorBase {
|
|
@@ -35,6 +35,7 @@ export interface RoundsBoundary {
|
|
|
35
35
|
}
|
|
36
36
|
export interface RoundsOptions extends FoldOptions {
|
|
37
37
|
nudges: readonly string[];
|
|
38
|
+
goals?: readonly string[] | undefined;
|
|
38
39
|
keeps: (message: Message) => boolean;
|
|
39
40
|
}
|
|
40
41
|
export type RoundsResult = {
|
|
@@ -58,15 +59,16 @@ export declare class Fold {
|
|
|
58
59
|
static turn(summary: string): string;
|
|
59
60
|
static isSummary(message: Pick<Message, 'role' | 'content'>): boolean;
|
|
60
61
|
static isTurn(message: Pick<Message, 'role' | 'content'>, nudges: readonly string[]): boolean;
|
|
61
|
-
static
|
|
62
|
+
static carriesState(message: Pick<Message, 'role' | 'content'>, nudges: readonly string[]): boolean;
|
|
62
63
|
static ratio(ctxSize: number): number;
|
|
63
64
|
static fits(ctxSize: number | undefined): boolean;
|
|
64
65
|
static due({ cacheTokens, ctxSize, cutOff }: FoldReading): boolean;
|
|
65
66
|
static observe(cacheKey: string, reading: FoldReading): void;
|
|
66
67
|
static reading(cacheKey: string): FoldReading | undefined;
|
|
67
68
|
static forget(cacheKey: string): void;
|
|
69
|
+
static forgetAll(): void;
|
|
68
70
|
static boundary(messages: readonly Message[], keepTurns?: number): FoldBoundary | null;
|
|
69
|
-
static roundBoundary(messages: readonly Message[], { nudges, keeps }: Pick<RoundsOptions, 'nudges' | 'keeps'>, most?: number): RoundsBoundary | null;
|
|
71
|
+
static roundBoundary(messages: readonly Message[], { nudges, goals, keeps }: Pick<RoundsOptions, 'nudges' | 'goals' | 'keeps'>, most?: number): RoundsBoundary | null;
|
|
70
72
|
static prompt(messages: readonly Message[], instructions?: string): string;
|
|
71
73
|
static shrinks(folded: readonly Message[], summary: string): boolean;
|
|
72
74
|
run(messages: readonly Message[], options?: FoldOptions): AsyncGenerator<FoldEvent, FoldResult>;
|
|
@@ -26,11 +26,11 @@ export class Fold {
|
|
|
26
26
|
return (message.role === 'user' &&
|
|
27
27
|
!Fold.isSummary(message) &&
|
|
28
28
|
!nudges.includes(message.content) &&
|
|
29
|
-
!Fold.
|
|
29
|
+
!Fold.carriesState(message, nudges));
|
|
30
30
|
}
|
|
31
|
-
static
|
|
31
|
+
static carriesState(message, nudges) {
|
|
32
32
|
return (message.role === 'user' &&
|
|
33
|
-
nudges.some((nudge) => message.content.startsWith(`${nudge}\
|
|
33
|
+
nudges.some((nudge) => nudge !== '' && message.content.startsWith(`${nudge}\n`)));
|
|
34
34
|
}
|
|
35
35
|
static ratio(ctxSize) {
|
|
36
36
|
return TIERS.find(([below]) => ctxSize < below)?.[1] ?? Fold.RATIO;
|
|
@@ -52,7 +52,14 @@ export class Fold {
|
|
|
52
52
|
return readings.get(cacheKey);
|
|
53
53
|
}
|
|
54
54
|
static forget(cacheKey) {
|
|
55
|
-
readings.
|
|
55
|
+
for (const key of readings.keys()) {
|
|
56
|
+
if (key === cacheKey || key.startsWith(`${cacheKey}/`)) {
|
|
57
|
+
readings.delete(key);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static forgetAll() {
|
|
62
|
+
readings.clear();
|
|
56
63
|
}
|
|
57
64
|
static boundary(messages, keepTurns = Fold.KEEP_TURNS) {
|
|
58
65
|
const users = messages.flatMap((message, at) => message.role === 'user' && !Fold.isSummary(message) ? [at] : []);
|
|
@@ -62,14 +69,15 @@ export class Fold {
|
|
|
62
69
|
const end = users[users.length - keepTurns];
|
|
63
70
|
return end > 0 ? { end, foldedTurns: users.length - keepTurns } : null;
|
|
64
71
|
}
|
|
65
|
-
static roundBoundary(messages, { nudges, keeps }, most = Infinity) {
|
|
72
|
+
static roundBoundary(messages, { nudges, goals = [], keeps }, most = Infinity) {
|
|
66
73
|
const task = messages.findLastIndex((message) => Fold.isTurn(message, nudges));
|
|
67
74
|
if (task === -1) {
|
|
68
75
|
return null;
|
|
69
76
|
}
|
|
70
77
|
const starts = messages.flatMap((message, at) => at > task && message.role === 'assistant' ? [at] : []);
|
|
71
|
-
const
|
|
72
|
-
const
|
|
78
|
+
const latest = (among) => messages.findLastIndex((message, at) => at > task && Fold.carriesState(message, among));
|
|
79
|
+
const states = [latest(goals), latest(nudges)];
|
|
80
|
+
const kept = (from, to) => states.some((at) => at >= from && at < to) || messages.slice(from, to).some(keeps);
|
|
73
81
|
const rounds = starts
|
|
74
82
|
.map((from, index) => [from, starts[index + 1] ?? messages.length])
|
|
75
83
|
.slice(0, Math.max(0, starts.length - Fold.KEEP_ROUNDS))
|
package/dist-lib/lib/guards.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AskField } from './contract/index.ts';
|
|
1
2
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
2
3
|
export declare function errorMessage(err: unknown): string;
|
|
3
4
|
export declare function errorCode(err: unknown): string | undefined;
|
|
5
|
+
export declare function isAskForm(value: unknown): value is AskField[];
|
package/dist-lib/lib/guards.js
CHANGED
|
@@ -9,3 +9,10 @@ export function errorCode(err) {
|
|
|
9
9
|
return undefined;
|
|
10
10
|
return typeof err.code === 'string' ? err.code : undefined;
|
|
11
11
|
}
|
|
12
|
+
export function isAskForm(value) {
|
|
13
|
+
return (Array.isArray(value) &&
|
|
14
|
+
value.every((field) => isRecord(field) &&
|
|
15
|
+
typeof field.id === 'string' &&
|
|
16
|
+
typeof field.label === 'string' &&
|
|
17
|
+
typeof field.type === 'string'));
|
|
18
|
+
}
|
|
@@ -49,6 +49,11 @@ async function probeSysfs(reads) {
|
|
|
49
49
|
}
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
|
+
async function probeAmdVram(reads) {
|
|
53
|
+
const rocm = await reads.run('rocm-smi --showmeminfo vram');
|
|
54
|
+
const rocmBudget = rocm ? parseRocmSmiOutput(rocm) : null;
|
|
55
|
+
return rocmBudget ?? (await probeSysfs(reads));
|
|
56
|
+
}
|
|
52
57
|
async function probeDesktop(reads) {
|
|
53
58
|
const ram = reads.totalmem();
|
|
54
59
|
const addon = probeWithAddon(await reads.readGpuStats(), ram);
|
|
@@ -60,14 +65,12 @@ async function probeDesktop(reads) {
|
|
|
60
65
|
if (nvidiaBudget) {
|
|
61
66
|
return nvidiaBudget;
|
|
62
67
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (rocmBudget) {
|
|
66
|
-
return rocmBudget;
|
|
68
|
+
if (addon?.source === 'integrated') {
|
|
69
|
+
return addon;
|
|
67
70
|
}
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
71
|
+
const amd = await probeAmdVram(reads);
|
|
72
|
+
if (amd) {
|
|
73
|
+
return amd;
|
|
71
74
|
}
|
|
72
75
|
const registry = await reads.run(`powershell -Command "${WINDOWS_REGISTRY_QUERY}"`);
|
|
73
76
|
const registryBudget = registry ? parseWindowsRegistryOutput(registry, ram) : null;
|
|
@@ -3,28 +3,43 @@ import { classifyGpu } from './gpu-classify.js';
|
|
|
3
3
|
import { IGPU_LIE_THRESHOLD, sharedRamBudget } from './parsers.js';
|
|
4
4
|
const GpuDeviceSchema = z.object({
|
|
5
5
|
name: z.string(),
|
|
6
|
-
videoMemoryBytes: z.number()
|
|
6
|
+
videoMemoryBytes: z.number(),
|
|
7
|
+
kind: z.enum(['integrated', 'discrete']).optional()
|
|
7
8
|
});
|
|
8
9
|
const StatsSchema = z.object({
|
|
9
10
|
memory: z.object({ totalBytes: z.number() }).optional(),
|
|
10
11
|
gpu: z.object({ devices: z.array(GpuDeviceSchema) }).optional()
|
|
11
12
|
});
|
|
13
|
+
function deviceClass(device) {
|
|
14
|
+
const byName = classifyGpu(device.name);
|
|
15
|
+
if (byName === 'software') {
|
|
16
|
+
return byName;
|
|
17
|
+
}
|
|
18
|
+
return device.kind ?? byName;
|
|
19
|
+
}
|
|
12
20
|
function classifyBestDevice(devices, systemRamBytes) {
|
|
13
21
|
for (const device of devices) {
|
|
14
|
-
|
|
15
|
-
if (cls === 'software') {
|
|
22
|
+
if (deviceClass(device) !== 'discrete') {
|
|
16
23
|
continue;
|
|
17
24
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return { ...sharedRamBudget(systemRamBytes), source: 'integrated', gpuClass: 'integrated' };
|
|
22
|
-
}
|
|
23
|
-
return { totalBytes: vram, availableBytes: vram, source: 'vram', gpuClass: 'discrete' };
|
|
25
|
+
const vram = device.videoMemoryBytes;
|
|
26
|
+
if (vram > systemRamBytes * IGPU_LIE_THRESHOLD) {
|
|
27
|
+
return { ...sharedRamBudget(systemRamBytes), source: 'integrated', gpuClass: 'integrated' };
|
|
24
28
|
}
|
|
29
|
+
return { totalBytes: vram, availableBytes: vram, source: 'vram', gpuClass: 'discrete' };
|
|
25
30
|
}
|
|
26
31
|
return null;
|
|
27
32
|
}
|
|
33
|
+
function integratedBudget(devices, totalRamBytes) {
|
|
34
|
+
const shared = sharedRamBudget(totalRamBytes);
|
|
35
|
+
const addressable = devices
|
|
36
|
+
.filter((device) => device.kind === 'integrated')
|
|
37
|
+
.map((device) => device.videoMemoryBytes);
|
|
38
|
+
const availableBytes = addressable.length > 0
|
|
39
|
+
? Math.min(shared.availableBytes, Math.max(...addressable))
|
|
40
|
+
: shared.availableBytes;
|
|
41
|
+
return { ...shared, availableBytes, source: 'integrated', gpuClass: 'integrated' };
|
|
42
|
+
}
|
|
28
43
|
export function probeWithAddon(rawStats, systemRamBytes) {
|
|
29
44
|
const parsed = StatsSchema.safeParse(rawStats);
|
|
30
45
|
if (!parsed.success) {
|
|
@@ -39,8 +54,8 @@ export function probeWithAddon(rawStats, systemRamBytes) {
|
|
|
39
54
|
if (best) {
|
|
40
55
|
return best;
|
|
41
56
|
}
|
|
42
|
-
if (devices.every((device) =>
|
|
57
|
+
if (devices.every((device) => deviceClass(device) === 'software')) {
|
|
43
58
|
return { ...sharedRamBudget(totalRamBytes), source: 'software' };
|
|
44
59
|
}
|
|
45
|
-
return
|
|
60
|
+
return integratedBudget(devices, totalRamBytes);
|
|
46
61
|
}
|
|
@@ -3,6 +3,18 @@ const os = require('os')
|
|
|
3
3
|
// lazy: the addon drags the graphics stack (and on Linux a second LLVM) into its importer
|
|
4
4
|
let GPUInfo
|
|
5
5
|
|
|
6
|
+
function deviceKind(gpu, gpuType) {
|
|
7
|
+
if (gpu.unifiedMemory === true || gpu.type === gpuType.INTEGRATED) {
|
|
8
|
+
return 'integrated'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (gpu.type === gpuType.DEDICATED || gpu.type === gpuType.EXTERNAL) {
|
|
12
|
+
return 'discrete'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return undefined
|
|
16
|
+
}
|
|
17
|
+
|
|
6
18
|
// system RAM is here to catch integrated-GPU lies
|
|
7
19
|
exports.readSystemStats = function readSystemStats() {
|
|
8
20
|
try {
|
|
@@ -11,7 +23,11 @@ exports.readSystemStats = function readSystemStats() {
|
|
|
11
23
|
try {
|
|
12
24
|
const devices = [...info]
|
|
13
25
|
.filter((gpu) => typeof gpu.memory === 'number' && gpu.name)
|
|
14
|
-
.map((gpu) => ({
|
|
26
|
+
.map((gpu) => ({
|
|
27
|
+
name: gpu.name,
|
|
28
|
+
videoMemoryBytes: gpu.memory,
|
|
29
|
+
kind: deviceKind(gpu, GPUInfo.constants.gpuType)
|
|
30
|
+
}))
|
|
15
31
|
if (devices.length === 0) {
|
|
16
32
|
return null
|
|
17
33
|
}
|
|
@@ -3,5 +3,6 @@ export type CompletionParams = Parameters<CompletionSdk['completion']>[0];
|
|
|
3
3
|
interface CompletionParamsInput extends Omit<CompletionParams, 'stream' | 'history'> {
|
|
4
4
|
history: Message[];
|
|
5
5
|
}
|
|
6
|
-
export declare function completionParams(
|
|
6
|
+
export declare function completionParams(input: CompletionParamsInput): CompletionParams;
|
|
7
|
+
export declare function sentParams({ modelId, history, tools, generationParams, responseFormat, toolDialect, kvCache, prefill }: CompletionParamsInput): CompletionParams;
|
|
7
8
|
export {};
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
import { defuseTemplateTokens, mapStrings } from './control-tokens.js';
|
|
1
2
|
function isSdkMessage(turn) {
|
|
2
3
|
return turn.toolCalls !== null && turn.toolCallId !== null;
|
|
3
4
|
}
|
|
4
|
-
|
|
5
|
+
function defused(turn) {
|
|
6
|
+
if (turn.role === 'assistant') {
|
|
7
|
+
return turn;
|
|
8
|
+
}
|
|
9
|
+
const content = defuseTemplateTokens(turn.content);
|
|
10
|
+
return content === turn.content ? turn : { ...turn, content };
|
|
11
|
+
}
|
|
12
|
+
export function completionParams(input) {
|
|
13
|
+
return sentParams({
|
|
14
|
+
...input,
|
|
15
|
+
history: input.history.map(defused),
|
|
16
|
+
tools: input.tools && mapStrings(input.tools, defuseTemplateTokens)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export function sentParams({ modelId, history, tools, generationParams, responseFormat, toolDialect, kvCache, prefill }) {
|
|
5
20
|
return {
|
|
6
21
|
modelId,
|
|
7
22
|
history: history.map((turn) => isSdkMessage(turn)
|
|
@@ -16,6 +31,7 @@ export function completionParams({ modelId, history, tools, generationParams, re
|
|
|
16
31
|
generationParams,
|
|
17
32
|
responseFormat,
|
|
18
33
|
toolDialect,
|
|
19
|
-
kvCache
|
|
34
|
+
kvCache,
|
|
35
|
+
prefill
|
|
20
36
|
};
|
|
21
37
|
}
|
|
@@ -4,4 +4,7 @@ export declare function endsTurn(token: string): boolean;
|
|
|
4
4
|
export declare function controlTokenIndex(text: string): number;
|
|
5
5
|
export declare function truncateAtControlToken(text: string): string;
|
|
6
6
|
export declare function stripControlTokens(text: string): string;
|
|
7
|
+
export declare function defuseTemplateTokens(text: string): string;
|
|
8
|
+
export declare function restoreTemplateTokens(text: string): string;
|
|
9
|
+
export declare function mapStrings<Value>(value: Value, map: (text: string) => string): Value;
|
|
7
10
|
export declare function stopAtControlToken(tokens: AsyncIterable<string>, onStop?: (token: string) => void): AsyncGenerator<string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { firstMarker, markers, strip, truncateAt } from 'asenion/guards';
|
|
2
2
|
import { scanner } from 'asenion/scan';
|
|
3
|
+
import { isRecord } from '../guards.js';
|
|
3
4
|
export const STOP_MARKERS = [...markers.controlTokens, ...markers.scaffold];
|
|
4
5
|
const [SCAFFOLD_OPENING] = markers.scaffold;
|
|
5
6
|
export const RUNAWAY_STOP_SEQUENCES = [SCAFFOLD_OPENING];
|
|
@@ -15,6 +16,30 @@ export function truncateAtControlToken(text) {
|
|
|
15
16
|
export function stripControlTokens(text) {
|
|
16
17
|
return strip(truncateAt(text, markers.scaffold), markers.controlTokens);
|
|
17
18
|
}
|
|
19
|
+
const TOKEN_REST = String.raw `\|\w+\|>||[^|<>]+|>|(?:start|end)_of_turn>|\/?(?:tool_call|tool_response|think)>|tts_\w+>`;
|
|
20
|
+
const WORD_JOINER = '\u2060';
|
|
21
|
+
const TEMPLATE_TOKEN = new RegExp(`<(?=${TOKEN_REST})`, 'g');
|
|
22
|
+
const DEFUSED_TOKEN = new RegExp(`<${WORD_JOINER}(?=${TOKEN_REST})`, 'g');
|
|
23
|
+
export function defuseTemplateTokens(text) {
|
|
24
|
+
return text.replace(TEMPLATE_TOKEN, `<${WORD_JOINER}`);
|
|
25
|
+
}
|
|
26
|
+
export function restoreTemplateTokens(text) {
|
|
27
|
+
return text.replace(DEFUSED_TOKEN, '<');
|
|
28
|
+
}
|
|
29
|
+
export function mapStrings(value, map) {
|
|
30
|
+
return mapped(value, map);
|
|
31
|
+
}
|
|
32
|
+
function mapped(value, map) {
|
|
33
|
+
if (typeof value === 'string') {
|
|
34
|
+
return map(value);
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
return value.map((item) => mapped(item, map));
|
|
38
|
+
}
|
|
39
|
+
return isRecord(value)
|
|
40
|
+
? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, mapped(item, map)]))
|
|
41
|
+
: value;
|
|
42
|
+
}
|
|
18
43
|
export async function* stopAtControlToken(tokens, onStop) {
|
|
19
44
|
const safe = scanner({ stop: STOP_MARKERS });
|
|
20
45
|
for await (const token of tokens) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const EFFECT_DRAIN_TIMEOUT_MS = 5000;
|
|
2
2
|
declare const TIMED_OUT: unique symbol;
|
|
3
|
-
export declare function raceDrain<T>(promise: Promise<T>, timeoutMs
|
|
3
|
+
export declare function raceDrain<T>(promise: Promise<T>, timeoutMs: number): Promise<T | typeof TIMED_OUT>;
|
|
4
4
|
export declare function didDrainTimeOut(value: unknown): value is typeof TIMED_OUT;
|
|
5
5
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const EFFECT_DRAIN_TIMEOUT_MS = 5000;
|
|
2
2
|
const TIMED_OUT = Symbol('timed-out');
|
|
3
|
-
export async function raceDrain(promise, timeoutMs
|
|
3
|
+
export async function raceDrain(promise, timeoutMs) {
|
|
4
4
|
let timer;
|
|
5
5
|
const timeout = new Promise((resolve) => {
|
|
6
6
|
timer = setTimeout(() => resolve(TIMED_OUT), timeoutMs);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const GOAL_CHECKS_ASK: string;
|
|
2
|
+
export declare const GOAL_PROOF_ASK: string;
|
|
3
|
+
export declare const GOAL_REVIEW_ASK: string;
|
|
4
|
+
export declare const GOAL_CASES_ASK: string;
|
|
5
|
+
export declare const MAX_PROOF_ASKS = 2;
|
|
6
|
+
export interface AskedGoal {
|
|
7
|
+
checkable?: boolean;
|
|
8
|
+
named?: boolean;
|
|
9
|
+
checks: readonly {
|
|
10
|
+
name: string;
|
|
11
|
+
passed?: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
turns: number;
|
|
14
|
+
deliverable?: readonly string[];
|
|
15
|
+
proving?: readonly string[];
|
|
16
|
+
edited?: readonly string[];
|
|
17
|
+
proof?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function deliverableAsk(paths: readonly string[]): string;
|
|
20
|
+
export declare function deliverableChecked(goal: AskedGoal): boolean;
|
|
21
|
+
export declare function asksDeliverable(goal: AskedGoal): boolean;
|
|
22
|
+
export declare function runAsk(path: string): string;
|
|
23
|
+
export declare function codeUnrun(goal: AskedGoal): boolean;
|
|
24
|
+
export declare function asksRun(goal: AskedGoal): boolean;
|
|
25
|
+
export declare function asksChecks(goal: AskedGoal): boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { runsDeliverable } from './checks.js';
|
|
2
|
+
export const GOAL_CHECKS_ASK = '[This goal has no checks yet. Name the commands that will prove the task is done: write a ' +
|
|
3
|
+
'line `Checks:`, then one command per line in backticks, such as `test -s /app/result.json` ' +
|
|
4
|
+
'or `python3 check.py`. Each must exit 0 only once the task is done, with no pipe, ; or && ' +
|
|
5
|
+
'in it. The goal is met only once each of them ran on its own and exited 0.]';
|
|
6
|
+
export const GOAL_PROOF_ASK = '[The checks this goal has so far may only show that the output exists, not that it is right. Name the ' +
|
|
7
|
+
'commands that will prove the result is correct, such as running the program on an input ' +
|
|
8
|
+
"and comparing with what the task asks, or the task's own tests: write a line `Checks:`, " +
|
|
9
|
+
'then one command per line in backticks, with no pipe, ; or && in it. A command that repeats ' +
|
|
10
|
+
'one of those checks does not count. The goal is met only once each check ran on its own and exited 0.]';
|
|
11
|
+
export const GOAL_REVIEW_ASK = '[Before the goal is met, read the task again and list each requirement it states, one line ' +
|
|
12
|
+
'each, with the command that proves it in backticks and the output it gave. Then write a ' +
|
|
13
|
+
'line `Checks:` and, one per line in backticks, a command for each requirement nothing proved ' +
|
|
14
|
+
'yet, that exits 0 only when it holds, with no pipe, ; or && in it. If every requirement is ' +
|
|
15
|
+
'proved, name no command.]';
|
|
16
|
+
export const GOAL_CASES_ASK = '[The checks pass with most of the budget left. Read the task again and quote each case it ' +
|
|
17
|
+
'names, such as an input, an edge case or an output format, one line each. For each one, ' +
|
|
18
|
+
'run a command that feeds it to your result and show the output it gave. Fix what does not ' +
|
|
19
|
+
'hold, then answer.]';
|
|
20
|
+
const GOAL_DELIVERABLE_ASK = '[The checks pass, but none of them runs or reads {paths}, what the task asks for. A check ' +
|
|
21
|
+
'counts only when its command, or a script it runs that you wrote, names one of those paths. ' +
|
|
22
|
+
'Write a line `Checks:`, then one command per line in backticks that runs or reads it on an ' +
|
|
23
|
+
'input and exits 0 only when the result is right, with no pipe, ; or && in it. The checks so ' +
|
|
24
|
+
'far stay.]';
|
|
25
|
+
const GOAL_RUN_ASK = '[No command ran `{path}` after your last edit. Run a test that exercises it. It counts only ' +
|
|
26
|
+
'when it exits 0 on its own, with no pipe, `|| true` or ; after it.]';
|
|
27
|
+
export const MAX_PROOF_ASKS = 2;
|
|
28
|
+
export function deliverableAsk(paths) {
|
|
29
|
+
return GOAL_DELIVERABLE_ASK.replaceAll('{paths}', paths.join(', '));
|
|
30
|
+
}
|
|
31
|
+
export function deliverableChecked(goal) {
|
|
32
|
+
const { deliverable, proving = [] } = goal;
|
|
33
|
+
return (!deliverable || goal.checks.some((check) => runsDeliverable(check.name, deliverable, proving)));
|
|
34
|
+
}
|
|
35
|
+
export function asksDeliverable(goal) {
|
|
36
|
+
return (!asksChecks(goal) && goal.checks.every((check) => check.passed) && !deliverableChecked(goal));
|
|
37
|
+
}
|
|
38
|
+
export function runAsk(path) {
|
|
39
|
+
return GOAL_RUN_ASK.replaceAll('{path}', path);
|
|
40
|
+
}
|
|
41
|
+
export function codeUnrun(goal) {
|
|
42
|
+
return !!goal.checkable && !!goal.edited?.length && !goal.proof;
|
|
43
|
+
}
|
|
44
|
+
export function asksRun(goal) {
|
|
45
|
+
return (codeUnrun(goal) &&
|
|
46
|
+
!asksChecks(goal) &&
|
|
47
|
+
goal.checks.every((check) => check.passed) &&
|
|
48
|
+
deliverableChecked(goal));
|
|
49
|
+
}
|
|
50
|
+
export function asksChecks(goal) {
|
|
51
|
+
return !!goal.checkable && !goal.named && goal.turns < MAX_PROOF_ASKS;
|
|
52
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const MAX_GOAL_CHECKS = 8;
|
|
2
|
+
export declare const MAX_PROVING: number;
|
|
3
|
+
export declare function existenceOnly(checks: readonly string[]): boolean;
|
|
4
|
+
export declare function pathsOf(checks: readonly string[]): string[];
|
|
5
|
+
export declare function runsDeliverable(check: string, deliverable: readonly string[], proving: readonly string[]): boolean;
|
|
6
|
+
export declare function citesPassed(text: string, passed: readonly string[]): boolean;
|
|
7
|
+
export declare function namedChecks(text: string): string[];
|
|
8
|
+
export declare function mergeChecks(host: readonly string[], named: readonly string[]): string[];
|