@qvac/harness 1.0.0-rc.2 → 1.0.0-rc.21
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/.nvmrc +1 -0
- package/CHANGELOG.md +3073 -1485
- package/README.md +110 -46
- package/dist-lib/index.d.ts +63 -16
- package/dist-lib/index.js +232 -38
- package/dist-lib/lib/agent/delegate.d.ts +3 -2
- package/dist-lib/lib/agent/delegate.js +6 -4
- package/dist-lib/lib/agent/follow.d.ts +5 -0
- package/dist-lib/lib/agent/follow.js +11 -2
- package/dist-lib/lib/agent/resolve.js +30 -17
- package/dist-lib/lib/agent/tool-selection.d.ts +4 -2
- package/dist-lib/lib/agent/tool-selection.js +5 -6
- package/dist-lib/lib/agent/tools.d.ts +2 -0
- package/dist-lib/lib/agent/tools.js +2 -1
- package/dist-lib/lib/capabilities/agent-ports.d.ts +1 -1
- package/dist-lib/lib/capabilities/agent-ports.js +11 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/batching.js +1 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +2 -0
- 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 +132 -13
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +11 -5
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +3 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +54 -10
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +12 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +142 -50
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +10 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +78 -20
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +33 -16
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +38 -23
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +50 -12
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +10 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +80 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.d.ts +5 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +101 -41
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +56 -17
- package/dist-lib/lib/capabilities/completion-engine/driver.js +58 -15
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +3 -1
- package/dist-lib/lib/capabilities/completion-engine/durable.js +12 -2
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/engine.js +14 -1
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +5 -1
- package/dist-lib/lib/capabilities/completion-engine/index.js +5 -2
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +26 -3
- package/dist-lib/lib/capabilities/completion-engine/loop.js +14 -2
- package/dist-lib/lib/capabilities/completion-engine/metrics.d.ts +9 -2
- package/dist-lib/lib/capabilities/completion-engine/metrics.js +28 -7
- package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +63 -0
- package/dist-lib/lib/capabilities/completion-engine/model-round.js +99 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.js +30 -10
- package/dist-lib/lib/capabilities/completion-engine/ports.js +6 -9
- package/dist-lib/lib/capabilities/completion-engine/prepare-step.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/round.d.ts +38 -6
- package/dist-lib/lib/capabilities/completion-engine/round.js +395 -118
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +12 -4
- package/dist-lib/lib/capabilities/completion-engine/session.js +31 -2
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +5 -2
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +8 -43
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +32 -141
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.js +42 -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/tool-sets.d.ts +24 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-sets.js +15 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.d.ts +17 -9
- package/dist-lib/lib/capabilities/completion-engine/turns.js +98 -86
- package/dist-lib/lib/capabilities/detect-language.d.ts +2 -1
- package/dist-lib/lib/capabilities/detect-language.js +14 -2
- package/dist-lib/lib/capabilities/download.d.ts +10 -8
- package/dist-lib/lib/capabilities/download.js +1 -1
- package/dist-lib/lib/capabilities/enhance.d.ts +1 -1
- package/dist-lib/lib/capabilities/enhance.js +23 -11
- package/dist-lib/lib/capabilities/kv-cache.d.ts +1 -1
- package/dist-lib/lib/capabilities/preview-model-source.d.ts +7 -0
- package/dist-lib/lib/capabilities/preview-model-source.js +83 -23
- package/dist-lib/lib/capabilities/prompt-prefix.d.ts +3 -1
- package/dist-lib/lib/capabilities/prompt-prefix.js +8 -0
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +13 -4
- package/dist-lib/lib/capabilities/sdk-tool.js +59 -7
- 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-plan.d.ts +5 -1
- package/dist-lib/lib/capabilities/tool-plan.js +20 -5
- package/dist-lib/lib/capabilities/tool-prompt-log.d.ts +1 -1
- package/dist-lib/lib/capabilities/tool-prompt-log.js +3 -3
- 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 +8 -43
- package/dist-lib/lib/capabilities/tool-turns.js +6 -253
- 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.d.ts +19 -0
- package/dist-lib/lib/client/index.js +263 -0
- 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 +16 -0
- package/dist-lib/lib/connect/host-run-log.js +74 -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 +20 -11
- package/dist-lib/lib/connect.js +178 -415
- package/dist-lib/lib/context-window.d.ts +13 -5
- package/dist-lib/lib/context-window.js +19 -6
- package/dist-lib/lib/contract/agent.d.ts +25 -4
- package/dist-lib/lib/contract/completion.d.ts +82 -32
- package/dist-lib/lib/contract/drive.d.ts +130 -0
- package/dist-lib/lib/contract/drive.js +1 -0
- package/dist-lib/lib/contract/egress-proxy.d.ts +13 -0
- package/dist-lib/lib/contract/egress-proxy.js +1 -0
- package/dist-lib/lib/contract/exec.d.ts +4 -3
- package/dist-lib/lib/contract/hooks.d.ts +4 -1
- package/dist-lib/lib/contract/index.d.ts +4 -0
- package/dist-lib/lib/contract/knowledge.d.ts +10 -0
- package/dist-lib/lib/contract/managed-skills.d.ts +1 -0
- package/dist-lib/lib/contract/managed-skills.js +1 -0
- package/dist-lib/lib/contract/media.d.ts +58 -0
- package/dist-lib/lib/contract/media.js +1 -0
- package/dist-lib/lib/contract/models.d.ts +12 -6
- package/dist-lib/lib/contract/ocr.d.ts +17 -0
- package/dist-lib/lib/contract/ocr.js +1 -0
- package/dist-lib/lib/contract/policy.d.ts +75 -0
- package/dist-lib/lib/contract/policy.js +1 -0
- package/dist-lib/lib/contract/run.d.ts +28 -3
- package/dist-lib/lib/contract/sandbox.d.ts +3 -1
- package/dist-lib/lib/contract/speech.d.ts +1 -1
- package/dist-lib/lib/contract/translation.d.ts +20 -0
- package/dist-lib/lib/contract/translation.js +1 -0
- package/dist-lib/lib/contract-types.d.ts +48 -16
- package/dist-lib/lib/embeddings/index.d.ts +7 -1
- package/dist-lib/lib/embeddings/index.js +26 -5
- package/dist-lib/lib/errors.d.ts +278 -0
- package/dist-lib/lib/errors.js +212 -0
- package/dist-lib/lib/fold/index.d.ts +26 -1
- package/dist-lib/lib/fold/index.js +76 -9
- package/dist-lib/lib/guarded-fetch.js +11 -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/cpu-placement.d.ts +8 -0
- package/dist-lib/lib/hardware/cpu-placement.js +48 -0
- package/dist-lib/lib/hardware/gpu-probe-addon.js +26 -11
- package/dist-lib/lib/hardware/gpu-probe.js +10 -1
- package/dist-lib/lib/hardware/gpu-stats.native.cjs +17 -1
- package/dist-lib/lib/helpers/completion-params.d.ts +7 -2
- package/dist-lib/lib/helpers/completion-params.js +26 -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/engine-error.d.ts +2 -1
- package/dist-lib/lib/helpers/engine-error.js +12 -12
- 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 -0
- package/dist-lib/lib/helpers/goal-check.js +35 -0
- package/dist-lib/lib/helpers/head-tail.js +1 -1
- package/dist-lib/lib/helpers/html-helpers.js +9 -6
- package/dist-lib/lib/helpers/load-stall.d.ts +1 -1
- package/dist-lib/lib/helpers/load-stall.js +2 -2
- package/dist-lib/lib/helpers/markup-stream-filter.d.ts +4 -1
- package/dist-lib/lib/helpers/markup-stream-filter.js +20 -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 +24 -16
- package/dist-lib/lib/helpers/require-peers.d.ts +3 -0
- package/dist-lib/lib/helpers/require-peers.js +23 -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/thinking.d.ts +3 -2
- package/dist-lib/lib/helpers/thinking.js +19 -0
- 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 +149 -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/hooks/built-in/arg-repair.js +6 -2
- package/dist-lib/lib/hooks/built-in/policy-rules.d.ts +8 -0
- package/dist-lib/lib/hooks/built-in/policy-rules.js +192 -0
- package/dist-lib/lib/hooks/built-in/sandbox.js +23 -5
- package/dist-lib/lib/hooks/index.d.ts +4 -1
- package/dist-lib/lib/hooks/index.js +9 -4
- package/dist-lib/lib/hooks/run.js +3 -3
- package/dist-lib/lib/lifecycle/index.js +15 -14
- package/dist-lib/lib/lifecycle/machine.js +2 -2
- package/dist-lib/lib/log.d.ts +26 -5
- package/dist-lib/lib/log.js +86 -23
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +15 -16
- package/dist-lib/lib/machine/completion/actions/completion.js +164 -107
- 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 +3 -2
- 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 +111 -140
- package/dist-lib/lib/machine/completion/context.js +11 -1
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +3 -1
- package/dist-lib/lib/machine/completion/guards/retry.js +9 -2
- package/dist-lib/lib/machine/completion/implementations.d.ts +18 -9
- package/dist-lib/lib/machine/completion/implementations.js +64 -16
- package/dist-lib/lib/machine/completion/machine.d.ts +38 -9
- package/dist-lib/lib/machine/completion/machine.js +58 -9
- package/dist-lib/lib/machine/completion/metrics.d.ts +25 -0
- package/dist-lib/lib/machine/completion/metrics.js +68 -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 +19 -27
- package/dist-lib/lib/machine/completion/rules.js +48 -79
- 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 +81 -14
- package/dist-lib/lib/machine/index.d.ts +50 -11
- package/dist-lib/lib/machine/index.js +12 -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.d.ts +15 -0
- package/dist-lib/lib/models/context-choice.js +62 -0
- package/dist-lib/lib/models/context.d.ts +1 -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/download-gate.d.ts +20 -0
- package/dist-lib/lib/models/download-gate.js +73 -0
- package/dist-lib/lib/models/gguf-header.d.ts +11 -0
- package/dist-lib/lib/models/gguf-header.js +203 -15
- 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.d.ts +6 -1
- package/dist-lib/lib/models/llm-presets.js +33 -6
- 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/memory-cap.d.ts +13 -0
- package/dist-lib/lib/models/memory-cap.js +21 -0
- package/dist-lib/lib/models/model-catalog-constants.d.ts +2 -2
- package/dist-lib/lib/models/model-catalog-constants.js +3 -4
- package/dist-lib/lib/models/model-catalog.d.ts +7 -3
- package/dist-lib/lib/models/model-catalog.js +44 -11
- package/dist-lib/lib/models/model-delete.d.ts +1 -1
- package/dist-lib/lib/models/model-fit.d.ts +2 -2
- package/dist-lib/lib/models/model-fit.js +5 -6
- package/dist-lib/lib/models/model-handle.d.ts +9 -2
- package/dist-lib/lib/models/model-handle.js +14 -3
- package/dist-lib/lib/models/model-list.d.ts +9 -2
- package/dist-lib/lib/models/model-list.js +23 -0
- package/dist-lib/lib/models/model-pool.d.ts +42 -7
- package/dist-lib/lib/models/model-pool.js +139 -49
- package/dist-lib/lib/models/model-source.d.ts +3 -2
- package/dist-lib/lib/models/model-source.js +23 -5
- package/dist-lib/lib/models/opencl-cache.js +2 -2
- package/dist-lib/lib/models/sdk-faults.d.ts +1 -0
- package/dist-lib/lib/models/sdk-faults.js +9 -0
- package/dist-lib/lib/models/tool-dialect.d.ts +1 -1
- 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-bare.js +2 -1
- package/dist-lib/lib/no-redirect-fetch-impl.d.ts +2 -1
- package/dist-lib/lib/no-redirect-fetch-impl.js +46 -8
- package/dist-lib/lib/office/engine/pptx/picture-area.d.ts +23 -0
- package/dist-lib/lib/office/engine/pptx/picture-area.js +84 -0
- package/dist-lib/lib/office/engine/pptx/presentation.d.ts +2 -0
- package/dist-lib/lib/office/engine/pptx/presentation.js +64 -21
- package/dist-lib/lib/office/engine/pptx/types.d.ts +1 -0
- package/dist-lib/lib/office/engine/xlsx/sheet.js +10 -4
- package/dist-lib/lib/office/engine/xlsx/workbook.d.ts +1 -0
- package/dist-lib/lib/office/engine/xlsx/workbook.js +34 -3
- package/dist-lib/lib/office/extract.js +4 -3
- package/dist-lib/lib/office/index.js +2 -1
- package/dist-lib/lib/plugins/registry.d.ts +15 -0
- package/dist-lib/lib/plugins/registry.js +91 -22
- 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/policy/index.d.ts +11 -0
- package/dist-lib/lib/policy/index.js +235 -0
- package/dist-lib/lib/prompt.d.ts +9 -4
- package/dist-lib/lib/prompt.js +95 -32
- package/dist-lib/lib/residency/completion-runtime.d.ts +17 -6
- package/dist-lib/lib/residency/completion-runtime.js +91 -37
- package/dist-lib/lib/residency/index.d.ts +59 -6
- package/dist-lib/lib/residency/index.js +444 -42
- package/dist-lib/lib/resolution-detector.js +3 -3
- package/dist-lib/lib/round-host.d.ts +12 -0
- package/dist-lib/lib/round-host.js +57 -0
- package/dist-lib/lib/round-port.d.ts +24 -0
- package/dist-lib/lib/round-port.js +81 -0
- package/dist-lib/lib/rpc-session.js +2 -1
- package/dist-lib/lib/run-log/redact.js +7 -7
- package/dist-lib/lib/run-log/request-codec.js +2 -2
- package/dist-lib/lib/sdk-loader.d.ts +1 -1
- package/dist-lib/lib/sdk-loader.js +47 -17
- package/dist-lib/lib/sdk-storage.d.ts +1 -0
- package/dist-lib/lib/sdk-storage.js +18 -2
- package/dist-lib/lib/serve/completion.d.ts +7 -0
- package/dist-lib/lib/serve/completion.js +553 -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 +147 -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 +38 -0
- package/dist-lib/lib/serve/run-log-start.js +254 -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 +51 -916
- package/dist-lib/lib/sidecar/index.d.ts +39 -0
- package/dist-lib/lib/sidecar/index.js +205 -0
- package/dist-lib/lib/sidecar/user-plugins.d.ts +9 -0
- package/dist-lib/lib/sidecar/user-plugins.js +119 -0
- package/dist-lib/lib/skills-host/index.d.ts +7 -3
- package/dist-lib/lib/skills-host/index.js +47 -22
- package/dist-lib/lib/spawn.d.ts +6 -4
- package/dist-lib/lib/spawn.js +22 -20
- package/dist-lib/lib/spill.d.ts +1 -0
- package/dist-lib/lib/spill.js +12 -8
- 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 +19 -8
- package/dist-lib/lib/tools/exec/runner.d.ts +4 -0
- package/dist-lib/lib/tools/exec/runner.js +20 -2
- package/dist-lib/lib/tools/exec/scope.d.ts +0 -1
- package/dist-lib/lib/tools/exec/scope.js +23 -114
- package/dist-lib/lib/tools/exec/shell-guidance.js +4 -4
- package/dist-lib/lib/tools/exec/shell-line.d.ts +26 -0
- package/dist-lib/lib/tools/exec/shell-line.js +334 -0
- package/dist-lib/lib/tools/exec.d.ts +4 -1
- package/dist-lib/lib/tools/exec.js +89 -27
- package/dist-lib/lib/tools/files/edit-file.d.ts +6 -0
- package/dist-lib/lib/tools/files/edit-file.js +266 -0
- package/dist-lib/lib/tools/files/glob.d.ts +3 -0
- package/dist-lib/lib/tools/files/glob.js +65 -0
- package/dist-lib/lib/tools/files/grep.d.ts +6 -0
- package/dist-lib/lib/tools/files/grep.js +212 -0
- package/dist-lib/lib/tools/files/index.d.ts +3 -0
- package/dist-lib/lib/tools/files/index.js +25 -0
- package/dist-lib/lib/tools/files/list-dir.d.ts +6 -0
- package/dist-lib/lib/tools/files/list-dir.js +136 -0
- package/dist-lib/lib/tools/files/make-dir.d.ts +3 -0
- package/dist-lib/lib/tools/files/make-dir.js +48 -0
- package/dist-lib/lib/tools/files/read-file.d.ts +3 -0
- package/dist-lib/lib/tools/files/read-file.js +224 -0
- package/dist-lib/lib/tools/files/transfer.d.ts +4 -0
- package/dist-lib/lib/tools/files/transfer.js +83 -0
- package/dist-lib/lib/tools/files/trash-file.d.ts +4 -0
- package/dist-lib/lib/tools/files/trash-file.js +62 -0
- package/dist-lib/lib/tools/files/write-file.d.ts +3 -0
- package/dist-lib/lib/tools/files/write-file.js +56 -0
- package/dist-lib/lib/tools/fs/document-text.d.ts +8 -0
- package/dist-lib/lib/tools/fs/document-text.js +22 -0
- package/dist-lib/lib/tools/fs/drive.d.ts +5 -25
- package/dist-lib/lib/tools/fs/drive.js +9 -1
- package/dist-lib/lib/tools/fs/edit-match.d.ts +33 -0
- package/dist-lib/lib/tools/fs/edit-match.js +445 -0
- package/dist-lib/lib/tools/fs/ignore.d.ts +13 -0
- package/dist-lib/lib/tools/fs/ignore.js +104 -0
- package/dist-lib/lib/tools/fs/local.js +28 -5
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +2 -40
- package/dist-lib/lib/tools/fs/remote-protocol.js +1 -1
- package/dist-lib/lib/tools/fs/remote.d.ts +3 -11
- package/dist-lib/lib/tools/fs/remote.js +24 -14
- package/dist-lib/lib/tools/fs/scope.d.ts +4 -15
- package/dist-lib/lib/tools/fs/scope.js +5 -2
- package/dist-lib/lib/tools/fs/search.d.ts +25 -0
- package/dist-lib/lib/tools/fs/search.js +383 -0
- package/dist-lib/lib/tools/{file-glob.d.ts → fs/targets.d.ts} +1 -5
- package/dist-lib/lib/tools/fs/targets.js +32 -0
- package/dist-lib/lib/tools/fs/tool-path.d.ts +27 -0
- package/dist-lib/lib/tools/fs/tool-path.js +70 -0
- package/dist-lib/lib/tools/fs/walk.d.ts +14 -5
- package/dist-lib/lib/tools/fs/walk.js +119 -24
- 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 +101 -16
- package/dist-lib/lib/tools/index.d.ts +4 -1
- package/dist-lib/lib/tools/index.js +8 -12
- 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 +2 -1
- package/dist-lib/lib/tools/office.js +273 -56
- 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 +17 -3
- package/dist-lib/lib/tools/pdf/build.js +77 -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 +56 -13
- package/dist-lib/lib/tools/skill.js +23 -11
- package/dist-lib/lib/tools/skills/bundled-dir.d.ts +8 -1
- package/dist-lib/lib/tools/skills/bundled-dir.js +42 -36
- 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 +7 -8
- package/dist-lib/lib/tools/skills/catalog.js +1 -158
- package/dist-lib/lib/tools/skills/cli-argv.js +25 -5
- package/dist-lib/lib/tools/skills/cli-schema-check.d.ts +1 -0
- package/dist-lib/lib/tools/skills/cli-schema-check.js +3 -0
- package/dist-lib/lib/tools/skills/cli-schema-load.js +10 -0
- package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +2 -0
- package/dist-lib/lib/tools/skills/cli-schema.js +6 -3
- 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/credential-health.js +3 -3
- package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +3 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +5 -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.d.ts +1 -0
- package/dist-lib/lib/tools/skills/manifest-parse.js +39 -3
- package/dist-lib/lib/tools/skills/manifest.d.ts +1 -0
- package/dist-lib/lib/tools/skills/mention-name.d.ts +6 -0
- package/dist-lib/lib/tools/skills/mention-name.js +6 -0
- package/dist-lib/lib/tools/skills/mention.d.ts +2 -2
- package/dist-lib/lib/tools/skills/mention.js +11 -4
- package/dist-lib/lib/tools/skills/overlay-crud.d.ts +3 -3
- package/dist-lib/lib/tools/skills/overlay-crud.js +7 -6
- 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-state-constants.d.ts +1 -0
- package/dist-lib/lib/tools/skills/skill-state-constants.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/url-guard.d.ts +6 -1
- package/dist-lib/lib/tools/url-guard.js +8 -2
- package/dist-lib/lib/tools/web-fetch.js +50 -133
- 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 -64
- package/dist-lib/lib/wire.js +24 -417
- package/dist-lib/plugins/coding/index.d.ts +1 -1
- package/dist-lib/plugins/coding/index.js +2 -4
- package/dist-lib/plugins/coding/read-only.d.ts +1 -0
- package/dist-lib/plugins/coding/read-only.js +264 -0
- package/dist-lib/plugins/coding/session.d.ts +6 -4
- package/dist-lib/plugins/coding/session.js +45 -16
- 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/command-hooks/index.js +5 -3
- package/dist-lib/plugins/egress-proxy/index.d.ts +53 -0
- package/dist-lib/plugins/egress-proxy/index.js +184 -0
- package/dist-lib/plugins/image/edit-image.d.ts +3 -22
- package/dist-lib/plugins/image/edit-image.js +23 -46
- 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 +27 -6
- package/dist-lib/plugins/image/generate-image.js +201 -74
- package/dist-lib/plugins/image/index.d.ts +2 -1
- package/dist-lib/plugins/image/index.js +29 -12
- 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/language-hint/index.d.ts +15 -0
- package/dist-lib/plugins/language-hint/index.js +54 -0
- package/dist-lib/plugins/lsp/tool.js +2 -2
- package/dist-lib/plugins/mcp/call.js +15 -4
- package/dist-lib/plugins/mcp/index.js +6 -3
- package/dist-lib/plugins/mcp/protocol.d.ts +10 -2
- package/dist-lib/plugins/mcp/protocol.js +13 -12
- package/dist-lib/plugins/mcp/server.js +1 -1
- 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 +24 -5
- package/dist-lib/plugins/music/generate-music.js +170 -64
- package/dist-lib/plugins/music/index.d.ts +2 -1
- package/dist-lib/plugins/music/index.js +23 -11
- package/dist-lib/plugins/obsidian/command.js +2 -2
- package/dist-lib/plugins/obsidian/index.js +14 -4
- package/dist-lib/plugins/obsidian/note-name.js +2 -1
- package/dist-lib/plugins/obsidian/readiness.js +2 -2
- package/dist-lib/plugins/obsidian/safe-path.js +5 -4
- package/dist-lib/plugins/obsidian/vault-create.js +3 -2
- package/dist-lib/plugins/obsidian/vault-fs.js +2 -2
- package/dist-lib/plugins/obsidian/vault-paths.js +3 -2
- package/dist-lib/plugins/obsidian/vault-read.js +20 -18
- package/dist-lib/plugins/obsidian/vault-write.js +13 -12
- 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/guarded-fetch.d.ts +2 -1
- package/dist-lib/plugins/python/guarded-fetch.js +5 -1
- package/dist-lib/plugins/python/index.d.ts +4 -1
- package/dist-lib/plugins/python/index.js +6 -1
- package/dist-lib/plugins/python/interrupt-timer.js +2 -2
- package/dist-lib/plugins/python/language.js +11 -10
- package/dist-lib/plugins/python/loader.d.ts +1 -0
- package/dist-lib/plugins/python/loader.js +76 -3
- package/dist-lib/plugins/python/memfs.js +2 -2
- package/dist-lib/plugins/python/pyodide.d.ts +1 -0
- package/dist-lib/plugins/python/pyodide.js +9 -8
- package/dist-lib/plugins/python/python-adapter.d.ts +6 -1
- package/dist-lib/plugins/python/python-adapter.js +37 -2
- package/dist-lib/plugins/python/run-session.d.ts +1 -0
- package/dist-lib/plugins/python/run-session.js +19 -8
- package/dist-lib/plugins/python/wheels.js +8 -6
- package/dist-lib/plugins/python/worker/active.js +2 -2
- package/dist-lib/plugins/python/worker/client.js +10 -9
- 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/protocol.d.ts +2 -0
- package/dist-lib/plugins/python/worker/serve.js +23 -4
- package/dist-lib/plugins/python/worker/spawn.d.ts +2 -1
- package/dist-lib/plugins/python/worker/spawn.js +3 -2
- package/dist-lib/plugins/quickjs/index.js +4 -0
- package/dist-lib/plugins/quickjs/runtime.js +8 -3
- package/dist-lib/plugins/run-report/chain.d.ts +2 -0
- package/dist-lib/plugins/run-report/chain.js +73 -0
- package/dist-lib/plugins/run-report/flow-view.js +2 -1
- package/dist-lib/plugins/run-report/flow.d.ts +1 -1
- package/dist-lib/plugins/run-report/flow.js +66 -14
- package/dist-lib/plugins/run-report/index.d.ts +23 -2
- package/dist-lib/plugins/run-report/index.js +32 -13
- package/dist-lib/plugins/run-report/layout.js +1 -1
- package/dist-lib/plugins/run-report/model.d.ts +10 -1
- package/dist-lib/plugins/run-report/model.js +12 -6
- package/dist-lib/plugins/run-report/page.d.ts +9 -0
- package/dist-lib/plugins/run-report/page.js +55 -15
- package/dist-lib/plugins/run-report/script.js +317 -43
- package/dist-lib/plugins/run-report/story.d.ts +2 -1
- package/dist-lib/plugins/run-report/story.js +7 -4
- package/dist-lib/plugins/run-report/style.d.ts +1 -1
- package/dist-lib/plugins/run-report/style.js +126 -0
- package/dist-lib/plugins/run-report/why.js +1 -1
- package/dist-lib/plugins/sandbox-linux/index.d.ts +62 -0
- package/dist-lib/plugins/sandbox-linux/index.js +354 -0
- package/dist-lib/plugins/sandbox-linux/seccomp.d.ts +2 -0
- package/dist-lib/plugins/sandbox-linux/seccomp.js +74 -0
- package/dist-lib/plugins/sandbox-macos/index.d.ts +25 -11
- package/dist-lib/plugins/sandbox-macos/index.js +244 -49
- package/dist-lib/plugins/sandbox-vm/index.d.ts +2 -1
- package/dist-lib/plugins/sandbox-vm/index.js +5 -2
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +7 -3
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +54 -20
- package/dist-lib/plugins/sandbox-windows/helper/qvac-sandbox.c +554 -0
- package/dist-lib/plugins/sandbox-windows/index.d.ts +53 -0
- package/dist-lib/plugins/sandbox-windows/index.js +205 -0
- 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/audio-resample.d.ts +1 -1
- package/dist-lib/plugins/speech/audio-resample.js +8 -8
- package/dist-lib/plugins/speech/audio-transcode-bare.d.ts +1 -1
- package/dist-lib/plugins/speech/audio-transcode-bare.js +23 -26
- package/dist-lib/plugins/speech/audio-transcode-node.d.ts +1 -1
- package/dist-lib/plugins/speech/audio-transcode-node.js +1 -3
- package/dist-lib/plugins/speech/index.d.ts +1 -0
- package/dist-lib/plugins/speech/index.js +8 -1
- 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-runtime.js +37 -37
- 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.d.ts +5 -1
- package/dist-lib/plugins/speech/voice.js +107 -33
- package/dist-lib/plugins/translation/index.d.ts +2 -1
- package/dist-lib/plugins/translation/index.js +21 -10
- package/dist-lib/plugins/translation/translate.d.ts +9 -5
- package/dist-lib/plugins/translation/translate.js +69 -64
- package/dist-lib/plugins/walkie-talkie/index.d.ts +4 -2
- package/dist-lib/plugins/walkie-talkie/index.js +19 -6
- package/dist-lib/plugins/walkie-talkie/wire.d.ts +5 -0
- package/dist-lib/plugins/walkie-talkie/wire.js +6 -5
- package/dist-lib/plugins/weather/geocode.js +2 -1
- package/dist-lib/plugins/weather/lookup.js +6 -4
- package/dist-lib/plugins/web-search/engines/bing.js +2 -1
- package/dist-lib/plugins/web-search/engines/google.js +2 -1
- package/dist-lib/plugins/web-search/fetch-html.d.ts +5 -5
- package/dist-lib/plugins/web-search/fetch-html.js +12 -15
- package/dist-lib/plugins/web-search/tool.js +1 -0
- package/dist-lib/schema/generate.js +8 -1
- package/dist-lib/schema/harness.js +94 -12
- package/dist-lib/spec/bind.js +12 -0
- package/dist-lib/spec/calls.js +4 -0
- package/dist-lib/spec/hrpc/hrpc.json +55 -3
- package/dist-lib/spec/hrpc/index.js +58 -10
- package/dist-lib/spec/hrpc/messages.js +485 -209
- package/dist-lib/spec/hyperschema/index.js +485 -209
- package/dist-lib/spec/hyperschema/schema.json +290 -85
- package/dist-lib/spec/hyperschema/types.d.ts +42 -5
- package/package.json +265 -65
- package/patches/pyodide@314.0.2.patch +37 -8
- package/scripts/addon-externals.cjs +16 -5
- package/worker/harness-sidecar.mjs +23 -154
- package/dist-lib/lib/tools/create-documents.d.ts +0 -3
- package/dist-lib/lib/tools/create-documents.js +0 -95
- package/dist-lib/lib/tools/edit-documents.d.ts +0 -3
- package/dist-lib/lib/tools/edit-documents.js +0 -132
- package/dist-lib/lib/tools/exec/shell-argv.d.ts +0 -2
- package/dist-lib/lib/tools/exec/shell-argv.js +0 -61
- package/dist-lib/lib/tools/file-glob.js +0 -118
- package/dist-lib/lib/tools/grep.d.ts +0 -5
- package/dist-lib/lib/tools/grep.js +0 -184
- package/dist-lib/lib/tools/read-files.d.ts +0 -5
- package/dist-lib/lib/tools/read-files.js +0 -160
- package/dist-lib/plugins/coding/write-file.d.ts +0 -3
- package/dist-lib/plugins/coding/write-file.js +0 -52
- package/patches/@qvac%2Finference@0.21.0.patch +0 -67
- package/patches/bare-stow@0.1.5.patch +0 -68
- package/patches/hypercore-blob-server@1.15.0.patch +0 -15
- package/patches/localwatch@1.4.3.patch +0 -13
|
@@ -1,35 +1,58 @@
|
|
|
1
1
|
export const SCRIPT = String.raw `
|
|
2
2
|
(function () {
|
|
3
3
|
var linked = Number(location.hash.slice(1))
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
4
|
+
var root = document.documentElement
|
|
5
|
+
var liveMode = document.body.dataset.live === '1'
|
|
6
|
+
// the run on the page; load() sets them, again each time a live run grows
|
|
7
|
+
var data = null
|
|
8
|
+
var run = null
|
|
9
|
+
var steps = []
|
|
7
10
|
var byIndex = {}
|
|
8
|
-
steps.forEach(function (step, i) { byIndex[step.index] = i })
|
|
9
11
|
var nodes = {}
|
|
10
|
-
data.nodes.forEach(function (node) { nodes[node.id] = node })
|
|
11
12
|
var routes = {}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
var charts = { run: document.getElementById('chart-run'), all: document.getElementById('chart-all') }
|
|
16
|
-
var svg = charts.run
|
|
17
|
-
var flowSvg = document.getElementById('chart-flow')
|
|
13
|
+
var charts = {}
|
|
14
|
+
var svg = null
|
|
15
|
+
var flowSvg = null
|
|
18
16
|
var flowNodes = {}
|
|
19
17
|
var ownerOfStep = {}
|
|
20
|
-
data.flow.forEach(function (node) {
|
|
21
|
-
flowNodes[node.id] = node
|
|
22
|
-
node.steps.forEach(function (index) { ownerOfStep[index] = node.id })
|
|
23
|
-
})
|
|
24
18
|
var board = document.querySelector('.board')
|
|
25
19
|
var canvas = document.getElementById('canvas')
|
|
26
20
|
var panel = document.getElementById('panel')
|
|
27
21
|
var scrub = document.getElementById('scrub')
|
|
28
22
|
var where = document.getElementById('where')
|
|
29
23
|
var ticks = document.getElementById('ticks')
|
|
30
|
-
var state = { pos: 0, facts: false, follow: true, view: 'step', picked: null, timer: null, scale: 1, chart: 'flow' }
|
|
24
|
+
var state = { pos: 0, facts: false, follow: true, view: 'step', picked: null, timer: null, scale: 1, chart: 'flow', whole: false }
|
|
31
25
|
function visible() { return state.chart === 'flow' ? flowSvg : svg }
|
|
32
26
|
var played = []
|
|
27
|
+
// set while a live update redraws: playback keeps its place and the canvas stays where it is
|
|
28
|
+
var quiet = false
|
|
29
|
+
|
|
30
|
+
function load(next) {
|
|
31
|
+
data = next
|
|
32
|
+
run = data.run
|
|
33
|
+
steps = data.steps
|
|
34
|
+
byIndex = {}
|
|
35
|
+
steps.forEach(function (step, i) { byIndex[step.index] = i })
|
|
36
|
+
nodes = {}
|
|
37
|
+
data.nodes.forEach(function (node) { nodes[node.id] = node })
|
|
38
|
+
routes = {}
|
|
39
|
+
data.routes.forEach(function (route) { routes[route.key] = route })
|
|
40
|
+
charts = { run: document.getElementById('chart-run'), all: document.getElementById('chart-all') }
|
|
41
|
+
svg = state.whole && charts.all ? charts.all : charts.run
|
|
42
|
+
flowSvg = document.getElementById('chart-flow')
|
|
43
|
+
flowNodes = {}
|
|
44
|
+
ownerOfStep = {}
|
|
45
|
+
data.flow.forEach(function (node) {
|
|
46
|
+
flowNodes[node.id] = node
|
|
47
|
+
node.steps.forEach(function (index) { ownerOfStep[index] = node.id })
|
|
48
|
+
})
|
|
49
|
+
// the charts keep the view the reader chose
|
|
50
|
+
flowSvg.style.display = state.chart === 'flow' ? '' : 'none'
|
|
51
|
+
if (charts.run) charts.run.style.display = 'none'
|
|
52
|
+
if (charts.all) charts.all.style.display = 'none'
|
|
53
|
+
if (svg && state.chart === 'machine') svg.style.display = ''
|
|
54
|
+
zoom(state.scale)
|
|
55
|
+
}
|
|
33
56
|
|
|
34
57
|
// ---- theme, as the bench pages keep it
|
|
35
58
|
var themeButton = document.getElementById('theme')
|
|
@@ -119,11 +142,11 @@ export const SCRIPT = String.raw `
|
|
|
119
142
|
}
|
|
120
143
|
|
|
121
144
|
function plays(step) { return state.facts || step.kind !== 'transition' || !step.facts }
|
|
122
|
-
|
|
123
|
-
|
|
145
|
+
// keeps playback on the step it was on, by index: a live update brings new step objects
|
|
146
|
+
function rebuild(atIndex) {
|
|
147
|
+
var at = atIndex === undefined ? (played[state.pos] ? played[state.pos].index : null) : atIndex
|
|
124
148
|
played = steps.filter(plays)
|
|
125
|
-
var pos = at ? played.
|
|
126
|
-
if (pos < 0 && at) pos = played.findIndex(function (step) { return step.index >= at.index })
|
|
149
|
+
var pos = at === null ? -1 : played.findIndex(function (step) { return step.index >= at })
|
|
127
150
|
state.pos = Math.max(0, pos)
|
|
128
151
|
scrub.max = String(Math.max(0, played.length - 1))
|
|
129
152
|
// each tick takes the color of the box it happened in; the step that decided a call stands tall
|
|
@@ -154,11 +177,11 @@ export const SCRIPT = String.raw `
|
|
|
154
177
|
var step = played[state.pos]
|
|
155
178
|
scrub.value = String(state.pos)
|
|
156
179
|
where.textContent = 'step ' + (state.pos + 1) + ' of ' + played.length + ' · #' + step.index
|
|
157
|
-
try { history.replaceState(null, '', '#' + step.index) } catch (e) {}
|
|
180
|
+
if (!liveMode) { try { history.replaceState(null, '', '#' + step.index) } catch (e) {} }
|
|
158
181
|
Array.prototype.forEach.call(ticks.children, function (tick, i) { tick.classList.toggle('at', i === state.pos) })
|
|
159
182
|
var owner = ownerOfStep[step.index]
|
|
160
183
|
flowSvg.querySelectorAll('.fn').forEach(function (el) { el.classList.toggle('now', el.dataset.node === owner) })
|
|
161
|
-
if (state.follow && state.chart === 'flow') keepInView(flowSvg.querySelector('.fn[data-node="' + owner + '"]'))
|
|
184
|
+
if (state.follow && !quiet && state.chart === 'flow') keepInView(flowSvg.querySelector('.fn[data-node="' + owner + '"]'))
|
|
162
185
|
var now = {}
|
|
163
186
|
activeIds(stateAt(state.pos), 'completion').forEach(function (id) { now[id] = true })
|
|
164
187
|
if (svg) {
|
|
@@ -179,8 +202,8 @@ export const SCRIPT = String.raw `
|
|
|
179
202
|
if (order && taken.length > 1) number(el, order)
|
|
180
203
|
})
|
|
181
204
|
var said = callout(step, now)
|
|
182
|
-
if (said && state.follow && state.chart === 'machine') keepInView(said)
|
|
183
|
-
if (state.follow && state.chart === 'machine') follow(step, now)
|
|
205
|
+
if (said && state.follow && !quiet && state.chart === 'machine') keepInView(said)
|
|
206
|
+
if (state.follow && !quiet && state.chart === 'machine') follow(step, now)
|
|
184
207
|
}
|
|
185
208
|
if (state.view === 'step' || state.view === 'list') render()
|
|
186
209
|
}
|
|
@@ -320,7 +343,7 @@ export const SCRIPT = String.raw `
|
|
|
320
343
|
// a step inside a call that went wrong starts with what went wrong, in full
|
|
321
344
|
function verdict(step) {
|
|
322
345
|
var node = flowNodes[ownerOfStep[step.index]]
|
|
323
|
-
if (!node || node.kind !== 'call' || node.status === 'ok') return ''
|
|
346
|
+
if (!node || node.kind !== 'call' || node.status === 'ok' || node.status === 'running') return ''
|
|
324
347
|
var call = data.story.rounds[node.round].calls[node.call]
|
|
325
348
|
return '<div class="reason o-' + call.outcome + '"><b>' + esc(call.name) + ' was ' + esc(call.outcome === 'pending' ? 'left without a result' : call.outcome) + ':</b> ' + esc(reasonOf(call)) + '</div>'
|
|
326
349
|
}
|
|
@@ -455,7 +478,7 @@ export const SCRIPT = String.raw `
|
|
|
455
478
|
}
|
|
456
479
|
|
|
457
480
|
// ---- a box of the run's flowchart: how it went, then the machine steps inside it
|
|
458
|
-
var KIND = { start: 'The request', round: 'Model round', call: 'Tool call', end: 'How it
|
|
481
|
+
var KIND = { start: 'The request', handoff: 'A handoff', steer: 'Sent mid-run', round: 'Model round', call: 'Tool call', end: 'How it ends' }
|
|
459
482
|
// open: the step to show expanded, when playback is on it
|
|
460
483
|
function flowPanel(id, open) {
|
|
461
484
|
var node = flowNodes[id]
|
|
@@ -466,7 +489,11 @@ export const SCRIPT = String.raw `
|
|
|
466
489
|
if (node.kind === 'call') out += callDetails(data.story.rounds[node.round].calls[node.call])
|
|
467
490
|
if (node.kind === 'round') out += roundDetails(data.story.rounds[node.round], node)
|
|
468
491
|
if (node.kind === 'start') out += '<div class="msg"><div class="body">' + esc(data.story.prompt) + '</div></div>'
|
|
469
|
-
if (node.kind === '
|
|
492
|
+
if (node.kind === 'handoff') out += handoffDetails(data.hops[Number(node.id.slice(4))])
|
|
493
|
+
if (node.kind === 'steer') out += '<p class="meta">The person sent this while the run was going; the next round reads it in place of the nudge.</p><div class="msg"><span class="role">user</span><div class="body">' + esc(steps[byIndex[node.from]].events.filter(function (e) { return e.type === 'INPUT' }).map(function (e) { return e.text }).join('\n')) + '</div></div>'
|
|
494
|
+
if (node.kind === 'end' && node.status === 'running') {
|
|
495
|
+
out += '<div class="reason o-running"><i class="spin"></i>The run is still going: its answer lands here when it ends.</div>'
|
|
496
|
+
} else if (node.kind === 'end') {
|
|
470
497
|
out += (run.failure ? '<div class="reason o-failed">' + esc(run.failure) + '</div>' : '') +
|
|
471
498
|
(run.response ? '<div class="msg"><span class="role">answer</span><div class="body">' + esc(run.response) + '</div></div>' : '')
|
|
472
499
|
}
|
|
@@ -480,15 +507,22 @@ export const SCRIPT = String.raw `
|
|
|
480
507
|
function callDetails(call) {
|
|
481
508
|
var asked = call.approved === null ? '' : '<span class="chip ' + (call.approved ? 'info' : 'o-denied') + '">' + (call.approved ? 'approved' : 'declined') + ' by a person</span>'
|
|
482
509
|
var reason = call.outcome === 'ok' ? '' : '<div class="reason o-' + call.outcome + '">' + esc(reasonOf(call)) + '</div>'
|
|
510
|
+
if (call.outcome === 'running') reason = '<div class="reason o-running"><i class="spin"></i>' + esc(reasonOf(call)) + '</div>'
|
|
483
511
|
return reason + (asked ? '<div class="chips">' + asked + '</div>' : '') +
|
|
484
512
|
'<h3>Arguments</h3>' + full(call.args) + '<h3>Result</h3>' + full(call.result)
|
|
485
513
|
}
|
|
486
514
|
|
|
515
|
+
function handoffDetails(hop) {
|
|
516
|
+
return '<p class="meta">From here <b>' + esc(hop.agent) + '</b> runs on <code>' + esc(hop.model) + '</code>, as a run of its own.</p>' +
|
|
517
|
+
(hop.reason ? '<div class="msg"><span class="role">why</span><div class="body">' + esc(hop.reason) + '</div></div>' : '')
|
|
518
|
+
}
|
|
519
|
+
|
|
487
520
|
function reasonOf(call) {
|
|
488
521
|
var result = call.result || {}
|
|
489
522
|
var error = typeof result === 'string' ? result : result.error
|
|
490
523
|
if (call.outcome === 'denied') return 'A person declined this call.'
|
|
491
524
|
if (call.outcome === 'pending') return 'The run stopped before this call returned.'
|
|
525
|
+
if (call.outcome === 'running') return 'Running now: its result lands here when it returns.'
|
|
492
526
|
return (call.detail && call.detail.indexOf('HTTP') === 0 ? call.detail + ': ' : '') + (typeof error === 'string' ? error : JSON.stringify(error || call.detail))
|
|
493
527
|
}
|
|
494
528
|
|
|
@@ -510,6 +544,7 @@ export const SCRIPT = String.raw `
|
|
|
510
544
|
|
|
511
545
|
// ---- selection
|
|
512
546
|
function pick(view, id) {
|
|
547
|
+
if (!data) return
|
|
513
548
|
state.view = view
|
|
514
549
|
state.picked = id
|
|
515
550
|
flowSvg.querySelectorAll('.fn.picked').forEach(function (el) { el.classList.remove('picked') })
|
|
@@ -528,6 +563,7 @@ export const SCRIPT = String.raw `
|
|
|
528
563
|
function goTo(index) {
|
|
529
564
|
var step = steps[byIndex[index]]
|
|
530
565
|
if (!step) return
|
|
566
|
+
pause()
|
|
531
567
|
if (!plays(step)) { state.facts = true; document.getElementById('facts').setAttribute('aria-pressed', 'true'); rebuild() }
|
|
532
568
|
state.view = 'step'
|
|
533
569
|
pick('step', null)
|
|
@@ -543,12 +579,15 @@ export const SCRIPT = String.raw `
|
|
|
543
579
|
goTo(Number(t.dataset.step))
|
|
544
580
|
})
|
|
545
581
|
|
|
546
|
-
|
|
547
|
-
|
|
582
|
+
// the went-wrong chips are redrawn with each live update, so one listener serves them all
|
|
583
|
+
document.addEventListener('click', function (event) {
|
|
584
|
+
var b = event.target.closest('[data-goto]')
|
|
585
|
+
if (b) { stop(); goTo(Number(b.dataset.goto)) }
|
|
548
586
|
})
|
|
549
587
|
|
|
550
588
|
canvas.addEventListener('click', function (event) {
|
|
551
|
-
if (moved) return
|
|
589
|
+
if (moved || !data) return
|
|
590
|
+
if (event.target.closest('.fn,.n,.e,.tb')) pause()
|
|
552
591
|
var tb = event.target.closest('.tb')
|
|
553
592
|
if (tb) { pick('node', tb.dataset.id); return }
|
|
554
593
|
var f = event.target.closest('.fn')
|
|
@@ -562,7 +601,9 @@ export const SCRIPT = String.raw `
|
|
|
562
601
|
// ---- controls
|
|
563
602
|
function stop() { clearInterval(state.timer); state.timer = null; document.getElementById('play').textContent = '▶' }
|
|
564
603
|
function play() {
|
|
604
|
+
if (!data) return
|
|
565
605
|
if (state.timer) return stop()
|
|
606
|
+
pause()
|
|
566
607
|
if (state.pos >= played.length - 1) show(0)
|
|
567
608
|
document.getElementById('play').textContent = '❚❚'
|
|
568
609
|
state.timer = setInterval(function () {
|
|
@@ -571,18 +612,20 @@ export const SCRIPT = String.raw `
|
|
|
571
612
|
}, 900)
|
|
572
613
|
}
|
|
573
614
|
document.getElementById('play').addEventListener('click', play)
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
document.getElementById('
|
|
577
|
-
|
|
615
|
+
// stepping by hand: a live page stops following the run while the reader looks back
|
|
616
|
+
function stepTo(to) { if (!data) return; stop(); pause(); show(to) }
|
|
617
|
+
document.getElementById('first').addEventListener('click', function () { stepTo(0) })
|
|
618
|
+
document.getElementById('prev').addEventListener('click', function () { stepTo(state.pos - 1) })
|
|
619
|
+
document.getElementById('next').addEventListener('click', function () { stepTo(state.pos + 1) })
|
|
620
|
+
scrub.addEventListener('input', function () { if (state.view !== 'list') state.view = 'step'; stepTo(Number(scrub.value)) })
|
|
578
621
|
ticks.addEventListener('click', function (event) {
|
|
579
622
|
var t = event.target.closest('[data-pos]')
|
|
580
|
-
if (t) {
|
|
623
|
+
if (t) { state.view = 'step'; stepTo(Number(t.dataset.pos)) }
|
|
581
624
|
})
|
|
582
625
|
document.addEventListener('keydown', function (event) {
|
|
583
626
|
if (event.target.closest('input,textarea')) return
|
|
584
|
-
if (event.key === 'ArrowRight') {
|
|
585
|
-
if (event.key === 'ArrowLeft') {
|
|
627
|
+
if (event.key === 'ArrowRight') { stepTo(state.pos + 1); event.preventDefault() }
|
|
628
|
+
if (event.key === 'ArrowLeft') { stepTo(state.pos - 1); event.preventDefault() }
|
|
586
629
|
if (event.key === ' ') { play(); event.preventDefault() }
|
|
587
630
|
})
|
|
588
631
|
function toggle(id, on) {
|
|
@@ -595,6 +638,7 @@ export const SCRIPT = String.raw `
|
|
|
595
638
|
}
|
|
596
639
|
// ---- which chart: the run's flowchart, or the state machine
|
|
597
640
|
function setChart(name) {
|
|
641
|
+
if (!data) return
|
|
598
642
|
state.chart = name
|
|
599
643
|
board.classList.toggle('on-machine', name === 'machine')
|
|
600
644
|
document.querySelectorAll('[data-chart]').forEach(function (b) { b.setAttribute('aria-pressed', String(b.dataset.chart === name)) })
|
|
@@ -609,6 +653,7 @@ export const SCRIPT = String.raw `
|
|
|
609
653
|
|
|
610
654
|
// the whole machine is its own layout; the run's is the default
|
|
611
655
|
toggle('untaken', function (on) {
|
|
656
|
+
state.whole = on
|
|
612
657
|
if (!svg) return
|
|
613
658
|
svg.style.display = 'none'
|
|
614
659
|
svg = on ? charts.all : charts.run
|
|
@@ -617,7 +662,7 @@ export const SCRIPT = String.raw `
|
|
|
617
662
|
if (state.view === 'node' || state.view === 'edge') pick(state.view, state.picked)
|
|
618
663
|
show(state.pos)
|
|
619
664
|
})
|
|
620
|
-
toggle('facts', function (on) { state.facts = on; rebuild(); show(state.pos) })
|
|
665
|
+
toggle('facts', function (on) { state.facts = on; if (data) { rebuild(); show(state.pos) } })
|
|
621
666
|
toggle('follow', function (on) { state.follow = on })
|
|
622
667
|
|
|
623
668
|
// ---- zoom and pan
|
|
@@ -643,19 +688,248 @@ export const SCRIPT = String.raw `
|
|
|
643
688
|
drag = { x: event.clientX, y: event.clientY, left: canvas.scrollLeft, top: canvas.scrollTop }
|
|
644
689
|
moved = false
|
|
645
690
|
})
|
|
691
|
+
// a reader scrolling the canvas is looking somewhere; following would pull them away
|
|
692
|
+
canvas.addEventListener('wheel', function () { pause() }, { passive: true })
|
|
646
693
|
window.addEventListener('pointermove', function (event) {
|
|
647
694
|
if (!drag) return
|
|
648
695
|
var dx = event.clientX - drag.x
|
|
649
696
|
var dy = event.clientY - drag.y
|
|
650
|
-
if (Math.abs(dx) + Math.abs(dy) > 4) { moved = true; canvas.classList.add('dragging') }
|
|
697
|
+
if (Math.abs(dx) + Math.abs(dy) > 4) { if (!moved) pause(); moved = true; canvas.classList.add('dragging') }
|
|
651
698
|
canvas.scrollLeft = drag.left - dx
|
|
652
699
|
canvas.scrollTop = drag.top - dy
|
|
653
700
|
})
|
|
654
701
|
window.addEventListener('pointerup', function () { drag = null; canvas.classList.remove('dragging'); setTimeout(function () { moved = false }, 0) })
|
|
655
702
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
703
|
+
// ---- live: a page that follows a run as it happens
|
|
704
|
+
var heroSlot = document.getElementById('hero-slot')
|
|
705
|
+
var jumpsSlot = document.getElementById('jumps-slot')
|
|
706
|
+
var toLive = document.getElementById('to-live')
|
|
707
|
+
var live = {
|
|
708
|
+
following: true,
|
|
709
|
+
// how many steps there were when the reader stopped following, for the count on the button
|
|
710
|
+
pausedAt: 0,
|
|
711
|
+
connected: false,
|
|
712
|
+
// the runs the server has, newest last, and the one on the page
|
|
713
|
+
runs: [],
|
|
714
|
+
viewing: null,
|
|
715
|
+
followRuns: true,
|
|
716
|
+
loaded: { n: null, size: -1 },
|
|
717
|
+
fetching: false,
|
|
718
|
+
again: false,
|
|
719
|
+
// the page's clock against the writer's: when the newest step arrived here
|
|
720
|
+
receivedAt: 0,
|
|
721
|
+
lastAt: null,
|
|
722
|
+
clock: null
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
function ended() { return !run || run.status !== 'active' }
|
|
726
|
+
|
|
727
|
+
// the reader took over: playback stays where they put it until they jump back
|
|
728
|
+
function pause() {
|
|
729
|
+
if (!liveMode || !live.following || !data) return
|
|
730
|
+
live.following = false
|
|
731
|
+
live.pausedAt = played.length
|
|
732
|
+
chrome()
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function resume() {
|
|
736
|
+
live.following = true
|
|
737
|
+
if (data) { state.view = 'step'; state.picked = null; pick('step', null); quiet = true; show(played.length - 1); quiet = false }
|
|
738
|
+
chrome()
|
|
739
|
+
toTail(false)
|
|
740
|
+
}
|
|
741
|
+
toLive.addEventListener('click', resume)
|
|
742
|
+
|
|
743
|
+
function apply(parts, n) {
|
|
744
|
+
var fresh = !data
|
|
745
|
+
var sameRun = live.loaded.n === n
|
|
746
|
+
var before = {}
|
|
747
|
+
if (flowSvg && sameRun) flowSvg.querySelectorAll('.fn').forEach(function (el) { before[el.dataset.node] = true })
|
|
748
|
+
var atIndex = sameRun && played[state.pos] ? played[state.pos].index : null
|
|
749
|
+
var scroll = { left: canvas.scrollLeft, top: canvas.scrollTop }
|
|
750
|
+
heroSlot.innerHTML = parts.hero
|
|
751
|
+
jumpsSlot.innerHTML = parts.jumps
|
|
752
|
+
canvas.innerHTML = parts.canvas
|
|
753
|
+
document.title = parts.title + ' · QVAC'
|
|
754
|
+
var machineButton = document.querySelector('[data-chart="machine"]')
|
|
755
|
+
if (machineButton) machineButton.hidden = !parts.machine
|
|
756
|
+
if (!parts.machine && state.chart === 'machine') { state.chart = 'flow'; board.classList.remove('on-machine') }
|
|
757
|
+
if (!sameRun) { state.view = 'step'; state.picked = null; live.following = live.followRuns || live.following }
|
|
758
|
+
load(parts.data)
|
|
759
|
+
// what landed since the last update draws itself in
|
|
760
|
+
if (sameRun && !fresh) {
|
|
761
|
+
flowSvg.querySelectorAll('.fn').forEach(function (el) { if (!before[el.dataset.node]) el.classList.add('arrived') })
|
|
762
|
+
}
|
|
763
|
+
rebuild(atIndex)
|
|
764
|
+
if (!live.following && sameRun) { canvas.scrollLeft = scroll.left; canvas.scrollTop = scroll.top }
|
|
765
|
+
if (fresh) document.body.classList.remove('waiting-for-run')
|
|
766
|
+
// playback moves to the newest step, but the canvas is moved once, to the tail, below
|
|
767
|
+
quiet = true
|
|
768
|
+
show(live.following ? played.length - 1 : state.pos)
|
|
769
|
+
quiet = false
|
|
770
|
+
if (state.view === 'flow' || state.view === 'node' || state.view === 'edge') pick(state.view, state.picked)
|
|
771
|
+
live.loaded = { n: n, size: live.loaded.size }
|
|
772
|
+
chrome()
|
|
773
|
+
if (live.following) toTail(fresh)
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// the newest box sits low in the canvas, as the newest line of a chat does, with room above it
|
|
777
|
+
function toTail(jump) {
|
|
778
|
+
if (state.chart !== 'flow' || !steps.length) return
|
|
779
|
+
// while the run goes its last box is the one it will answer from; after, the box it ended in
|
|
780
|
+
var el = flowSvg.querySelector('.fn.k-end') || flowSvg.querySelector('.fn[data-node="' + ownerOfStep[steps[steps.length - 1].index] + '"]')
|
|
781
|
+
if (!el) return
|
|
782
|
+
var box = el.getBBox()
|
|
783
|
+
var vb = flowSvg.viewBox.baseVal
|
|
784
|
+
var bottom = (box.y + box.height - vb.y) * state.scale
|
|
785
|
+
var left = (box.x - vb.x) * state.scale
|
|
786
|
+
canvas.scrollTo({ top: Math.max(0, bottom - canvas.clientHeight + 56), left: Math.max(0, left - 48), behavior: jump ? 'auto' : 'smooth' })
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// the box the run is in while it goes, breathing
|
|
790
|
+
function head() {
|
|
791
|
+
flowSvg.querySelectorAll('.fn.live-head').forEach(function (el) { el.classList.remove('live-head') })
|
|
792
|
+
if (ended() || !steps.length) return
|
|
793
|
+
var owner = ownerOfStep[steps[steps.length - 1].index]
|
|
794
|
+
var el = flowSvg.querySelector('.fn[data-node="' + owner + '"]')
|
|
795
|
+
if (el) el.classList.add('live-head')
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function clockText(ms) {
|
|
799
|
+
var s = Math.max(0, Math.round(ms / 1000))
|
|
800
|
+
return s < 60 ? s + ' s' : Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0')
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// the pill in the top bar, the button back to the tail, and the player's live mark
|
|
804
|
+
function chrome() {
|
|
805
|
+
var pill = document.getElementById('live-pill')
|
|
806
|
+
var text = document.getElementById('live-text')
|
|
807
|
+
if (!pill) return
|
|
808
|
+
clearInterval(live.clock)
|
|
809
|
+
live.clock = null
|
|
810
|
+
pill.className = 'live-pill'
|
|
811
|
+
if (!live.connected) {
|
|
812
|
+
pill.classList.add('is-off')
|
|
813
|
+
text.textContent = data ? 'Reconnecting' : 'Connecting'
|
|
814
|
+
} else if (!data) {
|
|
815
|
+
pill.classList.add('is-waiting')
|
|
816
|
+
text.textContent = 'Waiting for the run'
|
|
817
|
+
} else if (ended()) {
|
|
818
|
+
pill.classList.add('is-ended')
|
|
819
|
+
var took = run.startedAt && run.endedAt ? ' · ' + clockText(run.endedAt - run.startedAt) : ''
|
|
820
|
+
text.textContent = (run.outcome === 'success' || run.status === 'done' ? 'Finished' : 'Stopped') + took
|
|
821
|
+
} else {
|
|
822
|
+
pill.classList.add('is-live')
|
|
823
|
+
var last = steps[steps.length - 1]
|
|
824
|
+
var node = last && flowNodes[ownerOfStep[last.index]]
|
|
825
|
+
// requests and receipts carry no time; the clock runs from the last step that does
|
|
826
|
+
var timed = steps.filter(function (step) { return step.at }).pop()
|
|
827
|
+
var lastAt = timed ? timed.at : run.startedAt
|
|
828
|
+
// the clock restarts from a step only when a newer timed one lands, so it never runs back
|
|
829
|
+
if (lastAt !== live.lastAt) { live.lastAt = lastAt; live.receivedAt = Date.now() }
|
|
830
|
+
var tick = function () {
|
|
831
|
+
var elapsed = run.startedAt ? lastAt - run.startedAt + (Date.now() - live.receivedAt) : 0
|
|
832
|
+
text.textContent = 'Live · ' + clockText(elapsed) + (node ? ' · ' + whereIn(node) : '')
|
|
833
|
+
}
|
|
834
|
+
tick()
|
|
835
|
+
live.clock = setInterval(tick, 1000)
|
|
836
|
+
}
|
|
837
|
+
var behind = played.length - live.pausedAt
|
|
838
|
+
toLive.hidden = !data || live.following
|
|
839
|
+
toLive.textContent = behind > 0 ? 'Jump to live · ' + behind + ' new' : 'Back to live'
|
|
840
|
+
document.querySelector('.player').classList.toggle('at-live', !!data && live.following && !ended())
|
|
841
|
+
if (data) head()
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// ---- the runs the server holds: tabs, newest followed unless the reader picked an older one
|
|
845
|
+
function runTabs() {
|
|
846
|
+
var nav = document.getElementById('run-tabs')
|
|
847
|
+
nav.hidden = live.runs.length < 2
|
|
848
|
+
nav.innerHTML = live.runs.map(function (r) {
|
|
849
|
+
var on = r.n === live.loaded.n || (live.loaded.n === null && r.n === target())
|
|
850
|
+
var newest = r.n === live.runs[live.runs.length - 1].n
|
|
851
|
+
return '<button type="button" class="run-tab' + (on ? ' on' : '') + '" data-run="' + r.n + '"><b>Run ' + r.n + '</b>' +
|
|
852
|
+
(r.label ? '<span>' + esc(r.label) + '</span>' : '') + (newest && !ended() && on ? '<i class="dot"></i>' : '') + '</button>'
|
|
853
|
+
}).join('')
|
|
854
|
+
}
|
|
855
|
+
if (liveMode) document.getElementById('run-tabs').addEventListener('click', function (event) {
|
|
856
|
+
var b = event.target.closest('[data-run]')
|
|
857
|
+
if (!b) return
|
|
858
|
+
var n = Number(b.dataset.run)
|
|
859
|
+
live.followRuns = n === live.runs[live.runs.length - 1].n
|
|
860
|
+
live.viewing = n
|
|
861
|
+
document.getElementById('new-run').hidden = true
|
|
862
|
+
// the run already on screen has nothing to fetch: back to its tail
|
|
863
|
+
if (n === live.loaded.n) { resume(); return }
|
|
864
|
+
live.following = true
|
|
865
|
+
fetchRun()
|
|
866
|
+
})
|
|
867
|
+
|
|
868
|
+
function target() {
|
|
869
|
+
if (live.followRuns || live.viewing === null) return live.runs.length ? live.runs[live.runs.length - 1].n : null
|
|
870
|
+
return live.viewing
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
function notice(r) {
|
|
874
|
+
var box = document.getElementById('new-run')
|
|
875
|
+
box.innerHTML = '<span>Run ' + r.n + ' started' + (r.label ? ' · ' + esc(r.label) : '') + '</span><button type="button" class="pill" data-run-show="' + r.n + '">Show it</button>'
|
|
876
|
+
box.hidden = false
|
|
877
|
+
}
|
|
878
|
+
if (liveMode) document.getElementById('new-run').addEventListener('click', function (event) {
|
|
879
|
+
var b = event.target.closest('[data-run-show]')
|
|
880
|
+
if (!b) return
|
|
881
|
+
live.followRuns = true
|
|
882
|
+
live.following = true
|
|
883
|
+
event.currentTarget.hidden = true
|
|
884
|
+
fetchRun()
|
|
885
|
+
})
|
|
886
|
+
|
|
887
|
+
// one fetch at a time; a change meanwhile fetches once more after it
|
|
888
|
+
function fetchRun() {
|
|
889
|
+
var n = target()
|
|
890
|
+
if (n === null) return
|
|
891
|
+
if (live.fetching) { live.again = true; return }
|
|
892
|
+
var r = live.runs.filter(function (x) { return x.n === n })[0]
|
|
893
|
+
if (!r || (live.loaded.n === n && live.loaded.size === r.size)) return
|
|
894
|
+
live.fetching = true
|
|
895
|
+
fetch('run/' + n).then(function (res) { return res.json() }).then(function (parts) {
|
|
896
|
+
// the reader moved to another run meanwhile: draw that one instead
|
|
897
|
+
if (target() !== n) { live.again = true; return }
|
|
898
|
+
apply(parts, n)
|
|
899
|
+
live.loaded.size = r.size
|
|
900
|
+
runTabs()
|
|
901
|
+
}).catch(function (err) { console.error('live: ' + (err && err.stack || err)) }).then(function () {
|
|
902
|
+
live.fetching = false
|
|
903
|
+
if (live.again) { live.again = false; fetchRun() }
|
|
904
|
+
})
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function connect() {
|
|
908
|
+
if (window.location.protocol === 'file:') return
|
|
909
|
+
chrome()
|
|
910
|
+
var events = new EventSource('events')
|
|
911
|
+
events.onopen = function () { live.connected = true; chrome() }
|
|
912
|
+
events.onerror = function () { live.connected = false; chrome() }
|
|
913
|
+
events.onmessage = function (event) {
|
|
914
|
+
var message = JSON.parse(event.data)
|
|
915
|
+
var known = live.runs.length
|
|
916
|
+
live.runs = message.runs
|
|
917
|
+
live.connected = true
|
|
918
|
+
if (live.runs.length > known && known > 0 && !live.followRuns) notice(live.runs[live.runs.length - 1])
|
|
919
|
+
runTabs()
|
|
920
|
+
fetchRun()
|
|
921
|
+
chrome()
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
var first = JSON.parse(document.getElementById('data').textContent)
|
|
926
|
+
if (first) {
|
|
927
|
+
load(first)
|
|
928
|
+
rebuild()
|
|
929
|
+
zoom(1)
|
|
930
|
+
if (linked && steps[byIndex[linked]]) goTo(linked)
|
|
931
|
+
else show(0)
|
|
932
|
+
}
|
|
933
|
+
if (liveMode) connect()
|
|
660
934
|
})()
|
|
661
935
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Outcome = 'ok' | 'failed' | 'rejected' | 'denied' | 'pending';
|
|
1
|
+
export type Outcome = 'ok' | 'failed' | 'rejected' | 'denied' | 'pending' | 'running';
|
|
2
2
|
export interface StoryCall {
|
|
3
3
|
round: number;
|
|
4
4
|
id: string;
|
|
@@ -44,5 +44,6 @@ export interface StoryInput {
|
|
|
44
44
|
calls: Map<string, SeenCall>;
|
|
45
45
|
approvals: Map<string, boolean>;
|
|
46
46
|
requests: Map<number, number>;
|
|
47
|
+
running: boolean;
|
|
47
48
|
}
|
|
48
49
|
export declare function story(input: StoryInput): Story;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isRecord } from '../../lib/guards.js';
|
|
2
|
+
import { TOOL_FAILED_NOTE } from '../../lib/capabilities/tool-failed-note.js';
|
|
2
3
|
const TOOL_RESULT = /^\[Tool: (.+?) \((.+?)\)\]\n?/;
|
|
3
4
|
export function story(input) {
|
|
4
5
|
const teller = new Teller(input);
|
|
@@ -55,8 +56,8 @@ class Teller {
|
|
|
55
56
|
const id = key.slice(key.indexOf(':') + 1);
|
|
56
57
|
round.calls.push({
|
|
57
58
|
...this.call(round.round, { name: seen.name, id, result: undefined }),
|
|
58
|
-
outcome: 'pending',
|
|
59
|
-
detail: 'no result'
|
|
59
|
+
outcome: this.input.running ? 'running' : 'pending',
|
|
60
|
+
detail: this.input.running ? 'running' : 'no result'
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
63
|
}
|
|
@@ -142,7 +143,7 @@ function tally(rounds) {
|
|
|
142
143
|
const tool = tools.get(call.name) ?? {
|
|
143
144
|
name: call.name,
|
|
144
145
|
calls: 0,
|
|
145
|
-
outcomes: { ok: 0, failed: 0, rejected: 0, denied: 0, pending: 0 },
|
|
146
|
+
outcomes: { ok: 0, failed: 0, rejected: 0, denied: 0, pending: 0, running: 0 },
|
|
146
147
|
problems: []
|
|
147
148
|
};
|
|
148
149
|
tool.calls++;
|
|
@@ -173,8 +174,10 @@ function request(content) {
|
|
|
173
174
|
return text.replace(/^\[Current local time:[^\]]*\]\s*/, '').trim();
|
|
174
175
|
}
|
|
175
176
|
function parse(text) {
|
|
177
|
+
const note = `\n${TOOL_FAILED_NOTE}`;
|
|
178
|
+
const payload = text.endsWith(note) ? text.slice(0, -note.length) : text;
|
|
176
179
|
try {
|
|
177
|
-
return JSON.parse(
|
|
180
|
+
return JSON.parse(payload);
|
|
178
181
|
}
|
|
179
182
|
catch {
|
|
180
183
|
return text;
|