@qvac/harness 1.0.0-rc.0 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1168 -1
- package/NOTICE.md +16 -0
- package/README.md +278 -471
- package/dist-lib/index.d.ts +101 -169
- package/dist-lib/index.js +423 -1506
- package/dist-lib/lib/addon-seal.bare.d.ts +1 -0
- package/dist-lib/lib/addon-seal.bare.js +3 -0
- package/dist-lib/lib/addon-seal.node.d.ts +1 -0
- package/dist-lib/lib/addon-seal.node.js +1 -0
- package/dist-lib/lib/agent/delegate.d.ts +83 -0
- package/dist-lib/lib/agent/delegate.js +261 -0
- package/dist-lib/lib/agent/follow.d.ts +32 -0
- package/dist-lib/lib/agent/follow.js +162 -0
- package/dist-lib/lib/agent/index.d.ts +37 -0
- package/dist-lib/lib/agent/index.js +42 -0
- package/dist-lib/lib/agent/plan.d.ts +6 -0
- package/dist-lib/lib/agent/plan.js +74 -0
- package/dist-lib/lib/agent/resolve.d.ts +3 -0
- package/dist-lib/lib/agent/resolve.js +78 -0
- package/dist-lib/lib/{capabilities → agent}/tool-names.d.ts +0 -1
- package/dist-lib/lib/{capabilities → agent}/tool-names.js +0 -1
- package/dist-lib/lib/{capabilities → agent}/tool-selection.d.ts +3 -6
- package/dist-lib/lib/{capabilities → agent}/tool-selection.js +9 -1
- package/dist-lib/lib/agent/tools.d.ts +14 -0
- package/dist-lib/lib/agent/tools.js +16 -0
- package/dist-lib/lib/agent/transfer.d.ts +7 -0
- package/dist-lib/lib/agent/transfer.js +26 -0
- package/dist-lib/lib/capabilities/agent-ports.d.ts +3 -0
- package/dist-lib/lib/capabilities/agent-ports.js +9 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +25 -9
- package/dist-lib/lib/capabilities/completion-engine/actors/batching.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/batching.js +90 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +14 -5
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.d.ts +5 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.js +8 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.d.ts +29 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +100 -40
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.d.ts +11 -10
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +28 -21
- package/dist-lib/lib/capabilities/completion-engine/actors/finishing.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +67 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.d.ts +10 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +14 -11
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.d.ts +7 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +30 -31
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.d.ts +3 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +86 -102
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +24 -7
- package/dist-lib/lib/capabilities/completion-engine/actors/rejection.d.ts +4 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/rejection.js +8 -8
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +73 -15
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.d.ts +10 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +56 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +74 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +76 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +84 -26
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +16 -6
- package/dist-lib/lib/capabilities/completion-engine/actors.d.ts +11 -0
- package/dist-lib/lib/capabilities/completion-engine/actors.js +216 -0
- package/dist-lib/lib/capabilities/completion-engine/driver.d.ts +12 -5
- package/dist-lib/lib/capabilities/completion-engine/driver.js +118 -33
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/durable.js +6 -4
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +65 -0
- package/dist-lib/lib/{machine → capabilities/completion-engine}/engine.js +67 -130
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +30 -0
- package/dist-lib/lib/capabilities/completion-engine/index.js +44 -0
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +58 -0
- package/dist-lib/lib/capabilities/completion-engine/loop.js +62 -0
- package/dist-lib/lib/capabilities/completion-engine/metrics.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/metrics.js +46 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.d.ts +5 -2
- package/dist-lib/lib/capabilities/completion-engine/operations.js +84 -15
- package/dist-lib/lib/capabilities/completion-engine/ports.d.ts +25 -2
- package/dist-lib/lib/capabilities/completion-engine/ports.js +25 -16
- package/dist-lib/lib/capabilities/completion-engine/prepare-step.d.ts +26 -0
- package/dist-lib/lib/{machine → capabilities/completion-engine}/replay-output.d.ts +1 -1
- package/dist-lib/lib/{machine → capabilities/completion-engine}/replay-output.js +1 -1
- package/dist-lib/lib/capabilities/{completion-loop → completion-engine}/round.d.ts +24 -4
- package/dist-lib/lib/capabilities/{completion-loop → completion-engine}/round.js +242 -27
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +19 -12
- package/dist-lib/lib/capabilities/completion-engine/session.js +12 -6
- package/dist-lib/lib/capabilities/completion-engine/splice.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/splice.js +7 -0
- package/dist-lib/lib/capabilities/completion-engine/stages.d.ts +23 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.d.ts +10 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +151 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +77 -0
- package/dist-lib/lib/capabilities/{completion-loop → completion-engine}/tool-execution.js +74 -25
- package/dist-lib/lib/capabilities/{completion-loop → completion-engine}/turns.d.ts +8 -4
- package/dist-lib/lib/capabilities/completion-engine/turns.js +225 -0
- package/dist-lib/lib/capabilities/enhance.d.ts +1 -1
- package/dist-lib/lib/capabilities/enhance.js +3 -2
- package/dist-lib/lib/capabilities/invoke.d.ts +1 -1
- package/dist-lib/lib/capabilities/preview-model-source.d.ts +1 -10
- package/dist-lib/lib/capabilities/preview-model-source.js +3 -1
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +10 -0
- package/dist-lib/lib/capabilities/sdk-tool.js +130 -0
- package/dist-lib/lib/capabilities/skill-entry.d.ts +8 -0
- package/dist-lib/lib/capabilities/skill-entry.js +14 -0
- package/dist-lib/lib/capabilities/tool-plan.d.ts +6 -5
- package/dist-lib/lib/capabilities/tool-plan.js +16 -10
- package/dist-lib/lib/capabilities/tool-turns.d.ts +29 -4
- package/dist-lib/lib/capabilities/tool-turns.js +120 -10
- package/dist-lib/lib/capabilities/usage-breakdown.d.ts +1 -1
- package/dist-lib/lib/capabilities/usage-breakdown.js +4 -1
- package/dist-lib/lib/connect.d.ts +6 -0
- package/dist-lib/lib/connect.js +153 -65
- package/dist-lib/lib/context-window.d.ts +4 -2
- package/dist-lib/lib/context-window.js +27 -16
- package/dist-lib/lib/contract/agent.d.ts +65 -0
- package/dist-lib/lib/{capabilities/types.d.ts → contract/completion.d.ts} +140 -26
- package/dist-lib/lib/contract/exec.d.ts +134 -0
- package/dist-lib/lib/{hooks/types.d.ts → contract/hooks.d.ts} +62 -10
- package/dist-lib/lib/contract/index.d.ts +5 -0
- package/dist-lib/lib/contract/knowledge.d.ts +60 -0
- package/dist-lib/lib/contract/knowledge.js +1 -0
- package/dist-lib/lib/contract/models.d.ts +56 -0
- package/dist-lib/lib/contract/models.js +1 -0
- package/dist-lib/lib/contract/run.d.ts +142 -0
- package/dist-lib/lib/contract/run.js +1 -0
- package/dist-lib/lib/contract/sandbox.d.ts +29 -0
- package/dist-lib/lib/contract/sandbox.js +1 -0
- package/dist-lib/lib/contract/skill-readiness.d.ts +14 -0
- package/dist-lib/lib/contract/skill-readiness.js +1 -0
- package/dist-lib/lib/{capabilities/voice.d.ts → contract/speech.d.ts} +11 -16
- package/dist-lib/lib/contract/speech.js +1 -0
- package/dist-lib/lib/contract-types.d.ts +43 -16
- package/dist-lib/lib/docx/index.d.ts +0 -1
- package/dist-lib/lib/docx/index.js +15 -24
- package/dist-lib/lib/embeddings/index.d.ts +63 -0
- package/dist-lib/lib/embeddings/index.js +267 -0
- package/dist-lib/lib/fold/index.d.ts +50 -0
- package/dist-lib/lib/fold/index.js +123 -0
- package/dist-lib/lib/{tools/exec/adapters/python/guarded-fetch.d.ts → guarded-fetch.d.ts} +5 -12
- package/dist-lib/lib/{tools/exec/adapters/python/guarded-fetch.js → guarded-fetch.js} +12 -34
- package/dist-lib/lib/helpers/completion-params.d.ts +3 -0
- package/dist-lib/lib/helpers/completion-params.js +12 -0
- package/dist-lib/lib/helpers/copy.d.ts +1 -0
- package/dist-lib/lib/helpers/copy.js +5 -0
- package/dist-lib/lib/helpers/drain.d.ts +5 -0
- package/dist-lib/lib/helpers/drain.js +19 -0
- package/dist-lib/lib/{machine/errors.d.ts → helpers/engine-error.d.ts} +6 -9
- package/dist-lib/lib/{machine/errors.js → helpers/engine-error.js} +9 -25
- package/dist-lib/lib/helpers/failure-result.d.ts +21 -0
- package/dist-lib/lib/helpers/failure-result.js +39 -0
- package/dist-lib/lib/helpers/head-tail.d.ts +7 -0
- package/dist-lib/lib/helpers/head-tail.js +19 -0
- package/dist-lib/lib/helpers/image-settings.d.ts +2 -0
- package/dist-lib/lib/helpers/image-settings.js +19 -0
- package/dist-lib/lib/helpers/mcp-methods.d.ts +2 -0
- package/dist-lib/lib/helpers/mcp-methods.js +14 -0
- package/dist-lib/lib/helpers/race-abort.d.ts +1 -1
- package/dist-lib/lib/helpers/race-abort.js +1 -1
- package/dist-lib/lib/helpers/repeated-reply.d.ts +2 -0
- package/dist-lib/lib/helpers/repeated-reply.js +63 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +5 -4
- package/dist-lib/lib/helpers/run-outcome.js +11 -9
- package/dist-lib/lib/{machine → helpers}/stable-stringify.js +1 -1
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +1 -0
- package/dist-lib/lib/helpers/tool-call-markup.js +9 -5
- package/dist-lib/lib/helpers/tool-label.d.ts +2 -2
- package/dist-lib/lib/helpers/tool-label.js +3 -3
- package/dist-lib/lib/hooks/built-in/arg-repair.d.ts +1 -1
- package/dist-lib/lib/hooks/built-in/arg-repair.js +109 -19
- package/dist-lib/lib/hooks/built-in/egress.d.ts +1 -1
- package/dist-lib/lib/hooks/built-in/egress.js +13 -21
- package/dist-lib/lib/hooks/built-in/sandbox.d.ts +1 -1
- package/dist-lib/lib/hooks/built-in/skill-catalog.d.ts +1 -1
- package/dist-lib/lib/hooks/index.d.ts +48 -0
- package/dist-lib/lib/hooks/index.js +130 -0
- package/dist-lib/lib/hooks/run.d.ts +9 -6
- package/dist-lib/lib/hooks/run.js +113 -48
- package/dist-lib/lib/{completion-lifecycle.d.ts → lifecycle/completion-run.d.ts} +1 -1
- package/dist-lib/lib/{completion-lifecycle.js → lifecycle/completion-run.js} +1 -1
- package/dist-lib/lib/lifecycle/index.d.ts +83 -0
- package/dist-lib/lib/lifecycle/index.js +335 -0
- package/dist-lib/lib/{harness-lifecycle.js → lifecycle/machine.js} +2 -2
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +11 -2
- package/dist-lib/lib/machine/completion/actions/completion.js +98 -14
- package/dist-lib/lib/machine/completion/actions/prepare.d.ts +9 -0
- package/dist-lib/lib/machine/completion/actions/prepare.js +30 -0
- package/dist-lib/lib/machine/completion/actions/tools.d.ts +10 -1
- package/dist-lib/lib/machine/completion/actions/tools.js +79 -7
- package/dist-lib/lib/machine/completion/context.d.ts +7 -2
- package/dist-lib/lib/machine/completion/context.js +29 -5
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +1 -0
- package/dist-lib/lib/machine/completion/guards/retry.js +6 -3
- package/dist-lib/lib/machine/completion/implementations.d.ts +38 -12
- package/dist-lib/lib/machine/completion/implementations.js +81 -31
- package/dist-lib/lib/machine/completion/machine.d.ts +140 -63
- package/dist-lib/lib/machine/completion/machine.js +194 -58
- package/dist-lib/lib/machine/completion/ports.d.ts +7 -55
- package/dist-lib/lib/machine/completion/ports.js +1 -224
- package/dist-lib/lib/machine/completion/rules.d.ts +20 -19
- package/dist-lib/lib/machine/completion/rules.js +73 -52
- package/dist-lib/lib/machine/completion/types.d.ts +110 -187
- package/dist-lib/lib/machine/completion/version.d.ts +1 -0
- package/dist-lib/lib/machine/completion/version.js +1 -0
- package/dist-lib/lib/machine/definition.d.ts +23 -0
- package/dist-lib/lib/machine/definition.js +76 -0
- package/dist-lib/lib/machine/index.d.ts +463 -20
- package/dist-lib/lib/machine/index.js +15 -11
- package/dist-lib/lib/models/llm-presets.d.ts +1 -0
- package/dist-lib/lib/models/model-catalog-constants.d.ts +3 -1
- package/dist-lib/lib/models/model-catalog-constants.js +9 -1
- package/dist-lib/lib/models/model-catalog.d.ts +31 -4
- package/dist-lib/lib/models/model-catalog.js +89 -8
- package/dist-lib/lib/models/model-fit.d.ts +55 -0
- package/dist-lib/lib/models/model-fit.js +102 -0
- package/dist-lib/lib/models/model-handle.d.ts +4 -0
- package/dist-lib/lib/models/model-handle.js +8 -1
- package/dist-lib/lib/models/model-list.d.ts +4 -0
- package/dist-lib/lib/models/model-pool.d.ts +35 -10
- package/dist-lib/lib/models/model-pool.js +63 -14
- package/dist-lib/lib/models/music-catalog.d.ts +1 -1
- package/dist-lib/lib/models/music-catalog.js +8 -1
- package/dist-lib/lib/models/sdk-faults.d.ts +2 -0
- package/dist-lib/lib/models/sdk-faults.js +18 -0
- package/dist-lib/lib/models/tts-model-default.js +3 -3
- package/dist-lib/lib/office/engine/codes.d.ts +62 -0
- package/dist-lib/lib/office/engine/codes.js +61 -0
- package/dist-lib/lib/office/engine/docx/document.d.ts +216 -0
- package/dist-lib/lib/office/engine/docx/document.js +1152 -0
- package/dist-lib/lib/office/engine/docx/index.d.ts +7 -0
- package/dist-lib/lib/office/engine/docx/index.js +8 -0
- package/dist-lib/lib/office/engine/docx/styles.d.ts +31 -0
- package/dist-lib/lib/office/engine/docx/styles.js +173 -0
- package/dist-lib/lib/office/engine/docx/template.d.ts +18 -0
- package/dist-lib/lib/office/engine/docx/template.js +133 -0
- package/dist-lib/lib/office/engine/docx/text.d.ts +55 -0
- package/dist-lib/lib/office/engine/docx/text.js +538 -0
- package/dist-lib/lib/office/engine/drawingml/chart.d.ts +63 -0
- package/dist-lib/lib/office/engine/drawingml/chart.js +539 -0
- package/dist-lib/lib/office/engine/drawingml/text.d.ts +35 -0
- package/dist-lib/lib/office/engine/drawingml/text.js +352 -0
- package/dist-lib/lib/office/engine/errors.d.ts +6 -0
- package/dist-lib/lib/office/engine/errors.js +12 -0
- package/dist-lib/lib/office/engine/image.d.ts +8 -0
- package/dist-lib/lib/office/engine/image.js +48 -0
- package/dist-lib/lib/office/engine/index.d.ts +12 -0
- package/dist-lib/lib/office/engine/index.js +7 -0
- package/dist-lib/lib/office/engine/opc/content-types.d.ts +17 -0
- package/dist-lib/lib/office/engine/opc/content-types.js +74 -0
- package/dist-lib/lib/office/engine/opc/media.d.ts +13 -0
- package/dist-lib/lib/office/engine/opc/media.js +11 -0
- package/dist-lib/lib/office/engine/opc/package.d.ts +51 -0
- package/dist-lib/lib/office/engine/opc/package.js +324 -0
- package/dist-lib/lib/office/engine/opc/paths.d.ts +7 -0
- package/dist-lib/lib/office/engine/opc/paths.js +46 -0
- package/dist-lib/lib/office/engine/opc/properties.d.ts +7 -0
- package/dist-lib/lib/office/engine/opc/properties.js +75 -0
- package/dist-lib/lib/office/engine/opc/relationships.d.ts +23 -0
- package/dist-lib/lib/office/engine/opc/relationships.js +65 -0
- package/dist-lib/lib/office/engine/opc/zip.d.ts +15 -0
- package/dist-lib/lib/office/engine/opc/zip.js +264 -0
- package/dist-lib/lib/office/engine/pptx/fit.d.ts +12 -0
- package/dist-lib/lib/office/engine/pptx/fit.js +37 -0
- package/dist-lib/lib/office/engine/pptx/index.d.ts +8 -0
- package/dist-lib/lib/office/engine/pptx/index.js +8 -0
- package/dist-lib/lib/office/engine/pptx/inherit.d.ts +29 -0
- package/dist-lib/lib/office/engine/pptx/inherit.js +155 -0
- package/dist-lib/lib/office/engine/pptx/notes.d.ts +5 -0
- package/dist-lib/lib/office/engine/pptx/notes.js +85 -0
- package/dist-lib/lib/office/engine/pptx/presentation.d.ts +54 -0
- package/dist-lib/lib/office/engine/pptx/presentation.js +749 -0
- package/dist-lib/lib/office/engine/pptx/read.d.ts +9 -0
- package/dist-lib/lib/office/engine/pptx/read.js +66 -0
- package/dist-lib/lib/office/engine/pptx/shapes.d.ts +52 -0
- package/dist-lib/lib/office/engine/pptx/shapes.js +276 -0
- package/dist-lib/lib/office/engine/pptx/slides.d.ts +27 -0
- package/dist-lib/lib/office/engine/pptx/slides.js +123 -0
- package/dist-lib/lib/office/engine/pptx/template.d.ts +20 -0
- package/dist-lib/lib/office/engine/pptx/template.js +391 -0
- package/dist-lib/lib/office/engine/pptx/types.d.ts +120 -0
- package/dist-lib/lib/office/engine/pptx/types.js +1 -0
- package/dist-lib/lib/office/engine/units.d.ts +3 -0
- package/dist-lib/lib/office/engine/units.js +12 -0
- package/dist-lib/lib/office/engine/utf8.d.ts +2 -0
- package/dist-lib/lib/office/engine/utf8.js +103 -0
- package/dist-lib/lib/office/engine/xlsx/formula.d.ts +49 -0
- package/dist-lib/lib/office/engine/xlsx/formula.js +381 -0
- package/dist-lib/lib/office/engine/xlsx/index.d.ts +8 -0
- package/dist-lib/lib/office/engine/xlsx/index.js +8 -0
- package/dist-lib/lib/office/engine/xlsx/refs.d.ts +22 -0
- package/dist-lib/lib/office/engine/xlsx/refs.js +82 -0
- package/dist-lib/lib/office/engine/xlsx/reshape.d.ts +21 -0
- package/dist-lib/lib/office/engine/xlsx/reshape.js +424 -0
- package/dist-lib/lib/office/engine/xlsx/sheet.d.ts +108 -0
- package/dist-lib/lib/office/engine/xlsx/sheet.js +662 -0
- package/dist-lib/lib/office/engine/xlsx/strings.d.ts +15 -0
- package/dist-lib/lib/office/engine/xlsx/strings.js +93 -0
- package/dist-lib/lib/office/engine/xlsx/styles.d.ts +38 -0
- package/dist-lib/lib/office/engine/xlsx/styles.js +369 -0
- package/dist-lib/lib/office/engine/xlsx/template.d.ts +7 -0
- package/dist-lib/lib/office/engine/xlsx/template.js +54 -0
- package/dist-lib/lib/office/engine/xlsx/workbook.d.ts +161 -0
- package/dist-lib/lib/office/engine/xlsx/workbook.js +850 -0
- package/dist-lib/lib/office/engine/xlsx/write.d.ts +2 -0
- package/dist-lib/lib/office/engine/xlsx/write.js +42 -0
- package/dist-lib/lib/office/engine/xml.d.ts +45 -0
- package/dist-lib/lib/office/engine/xml.js +258 -0
- package/dist-lib/lib/office/extract.d.ts +9 -0
- package/dist-lib/lib/office/extract.js +19 -0
- package/dist-lib/lib/office/index.d.ts +1 -1
- package/dist-lib/lib/office/index.js +74 -19
- package/dist-lib/lib/plugins/addons.d.ts +2 -0
- package/dist-lib/lib/plugins/addons.js +12 -0
- package/dist-lib/lib/plugins/context.d.ts +16 -0
- package/dist-lib/lib/plugins/context.js +48 -0
- package/dist-lib/lib/plugins/index.d.ts +3 -0
- package/dist-lib/lib/plugins/index.js +1 -0
- package/dist-lib/lib/plugins/registry.d.ts +116 -0
- package/dist-lib/lib/plugins/registry.js +505 -0
- package/dist-lib/lib/plugins/runtime.d.ts +27 -0
- package/dist-lib/lib/plugins/runtime.js +143 -0
- package/dist-lib/lib/plugins/scope.d.ts +17 -0
- package/dist-lib/lib/plugins/scope.js +55 -0
- package/dist-lib/lib/prompt.d.ts +2 -5
- package/dist-lib/lib/prompt.js +9 -0
- package/dist-lib/lib/residency/completion-runtime.d.ts +52 -0
- package/dist-lib/lib/{capabilities → residency}/completion-runtime.js +22 -15
- package/dist-lib/lib/residency/index.d.ts +148 -0
- package/dist-lib/lib/residency/index.js +539 -0
- package/dist-lib/lib/run-log/boundary.d.ts +17 -0
- package/dist-lib/lib/run-log/boundary.js +58 -0
- package/dist-lib/lib/run-log/history-codec.d.ts +7 -6
- package/dist-lib/lib/run-log/history-codec.js +175 -46
- package/dist-lib/lib/run-log/index.d.ts +46 -0
- package/dist-lib/lib/run-log/index.js +40 -0
- package/dist-lib/lib/run-log/inspect.d.ts +53 -0
- package/dist-lib/lib/{run-log-inspect.js → run-log/inspect.js} +196 -139
- package/dist-lib/lib/run-log/live.d.ts +37 -0
- package/dist-lib/lib/run-log/live.js +195 -0
- package/dist-lib/lib/run-log/persisted-actor.d.ts +1 -6
- package/dist-lib/lib/run-log/persisted-actor.js +4 -3
- package/dist-lib/lib/run-log/protocol-types.d.ts +37 -14
- package/dist-lib/lib/run-log/protocol.d.ts +1 -2
- package/dist-lib/lib/run-log/protocol.js +45 -40
- package/dist-lib/lib/{run-log-redact.d.ts → run-log/redact.d.ts} +3 -2
- package/dist-lib/lib/{run-log-redact.js → run-log/redact.js} +101 -16
- package/dist-lib/lib/run-log/replay.d.ts +3 -2
- package/dist-lib/lib/run-log/replay.js +7 -6
- package/dist-lib/lib/run-log/request-codec.d.ts +17 -0
- package/dist-lib/lib/run-log/request-codec.js +87 -0
- package/dist-lib/lib/run-log/run-journal.d.ts +14 -8
- package/dist-lib/lib/run-log/run-journal.js +100 -75
- package/dist-lib/lib/sdk-loader.d.ts +2 -7
- package/dist-lib/lib/sdk-loader.js +8 -15
- package/dist-lib/lib/sdk-storage.js +3 -1
- package/dist-lib/lib/serve.js +139 -38
- package/dist-lib/lib/skills-host/index.d.ts +59 -0
- package/dist-lib/lib/skills-host/index.js +268 -0
- package/dist-lib/lib/spawn.d.ts +37 -3
- package/dist-lib/lib/spawn.js +7 -3
- package/dist-lib/lib/spill.d.ts +11 -0
- package/dist-lib/lib/spill.js +82 -0
- package/dist-lib/lib/tools/{exec/adapters/python → attachments}/output-policy.d.ts +2 -3
- package/dist-lib/lib/tools/{exec/adapters/python/attachments.d.ts → attachments/staging.d.ts} +2 -2
- package/dist-lib/lib/tools/{exec/adapters/python/attachments.js → attachments/staging.js} +3 -3
- package/dist-lib/lib/tools/catalog.d.ts +1 -1
- package/dist-lib/lib/tools/catalog.js +1 -1
- package/dist-lib/lib/tools/create-documents.d.ts +1 -1
- package/dist-lib/lib/tools/edit-documents.d.ts +1 -1
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.d.ts +5 -7
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +3 -2
- package/dist-lib/lib/tools/exec/bare-runtime.js +2 -4
- package/dist-lib/lib/tools/exec/python-source.d.ts +6 -0
- package/dist-lib/lib/tools/exec/python-source.js +243 -0
- package/dist-lib/lib/tools/exec/runner.d.ts +24 -45
- package/dist-lib/lib/tools/exec/runner.js +68 -34
- package/dist-lib/lib/tools/exec/scope.d.ts +2 -0
- package/dist-lib/lib/tools/exec/scope.js +33 -2
- package/dist-lib/lib/tools/exec/shell-guidance.d.ts +11 -9
- package/dist-lib/lib/tools/exec/shell-guidance.js +28 -57
- package/dist-lib/lib/tools/exec/video-tools.d.ts +0 -1
- package/dist-lib/lib/tools/exec/video-tools.js +0 -5
- package/dist-lib/lib/tools/exec.d.ts +7 -14
- package/dist-lib/lib/tools/exec.js +181 -457
- package/dist-lib/lib/tools/file-glob.d.ts +1 -1
- package/dist-lib/lib/tools/file-glob.js +1 -0
- package/dist-lib/lib/tools/fs/scope.d.ts +1 -0
- package/dist-lib/lib/tools/fs/scope.js +8 -3
- package/dist-lib/lib/tools/grep.d.ts +1 -1
- package/dist-lib/lib/tools/grep.js +1 -0
- package/dist-lib/lib/tools/http-request.d.ts +1 -1
- package/dist-lib/lib/tools/http-request.js +1 -0
- package/dist-lib/lib/tools/index.d.ts +21 -0
- package/dist-lib/lib/tools/index.js +46 -0
- package/dist-lib/lib/tools/office/ops.d.ts +13 -0
- package/dist-lib/lib/tools/office/ops.js +100 -0
- package/dist-lib/lib/tools/office.d.ts +12 -0
- package/dist-lib/lib/tools/office.js +486 -0
- package/dist-lib/lib/tools/operations/compile.d.ts +3 -3
- package/dist-lib/lib/tools/operations/compile.js +2 -1
- package/dist-lib/lib/tools/operations/decoders.js +1 -1
- package/dist-lib/lib/tools/operations/manifest.d.ts +1 -1
- package/dist-lib/lib/tools/outbound-guard.d.ts +3 -1
- package/dist-lib/lib/tools/outbound-guard.js +4 -0
- package/dist-lib/lib/tools/pdf/build.d.ts +43 -0
- package/dist-lib/lib/tools/pdf/build.js +150 -0
- package/dist-lib/lib/tools/pdf/images.d.ts +7 -0
- package/dist-lib/lib/tools/pdf/images.js +82 -0
- package/dist-lib/lib/tools/pdf/request.d.ts +63 -0
- package/dist-lib/lib/tools/pdf/request.js +335 -0
- package/dist-lib/lib/tools/pdf.d.ts +6 -0
- package/dist-lib/lib/tools/pdf.js +303 -0
- package/dist-lib/lib/tools/read-files.d.ts +1 -1
- package/dist-lib/lib/tools/read-files.js +5 -1
- package/dist-lib/lib/tools/skill.d.ts +2 -4
- package/dist-lib/lib/tools/skill.js +20 -22
- package/dist-lib/lib/tools/skills/auth-resolver.d.ts +1 -1
- package/dist-lib/lib/tools/skills/catalog.d.ts +9 -2
- package/dist-lib/lib/tools/skills/catalog.js +7 -7
- package/dist-lib/lib/tools/skills/cli-schema.js +1 -1
- package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +1 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +1 -0
- package/dist-lib/lib/tools/skills/mention.d.ts +1 -2
- package/dist-lib/lib/tools/skills/mention.js +0 -3
- package/dist-lib/lib/tools/skills/scope-key.d.ts +2 -1
- package/dist-lib/lib/tools/skills/scope-key.js +2 -3
- package/dist-lib/lib/tools/skills/skill-state.d.ts +2 -2
- package/dist-lib/lib/tools/skills/skill-state.js +11 -28
- package/dist-lib/lib/tools/toolsets.d.ts +3 -7
- package/dist-lib/lib/tools/toolsets.js +5 -9
- package/dist-lib/lib/tools/web-fetch.d.ts +1 -1
- package/dist-lib/lib/tools/web-fetch.js +42 -6
- package/dist-lib/lib/web-fetch/embedded-state.js +1 -1
- package/dist-lib/lib/web-fetch/extract.js +1 -1
- package/dist-lib/lib/web-fetch/images.js +1 -1
- package/dist-lib/lib/web-fetch/video.js +1 -1
- package/dist-lib/lib/wire.d.ts +8 -0
- package/dist-lib/lib/wire.js +112 -2
- package/dist-lib/plugins/code-mode/index.d.ts +16 -0
- package/dist-lib/plugins/code-mode/index.js +43 -0
- package/dist-lib/plugins/coding/index.d.ts +15 -0
- package/dist-lib/plugins/coding/index.js +42 -0
- package/dist-lib/plugins/coding/jobs.d.ts +24 -0
- package/dist-lib/plugins/coding/jobs.js +144 -0
- package/dist-lib/plugins/coding/session.d.ts +51 -0
- package/dist-lib/plugins/coding/session.js +263 -0
- package/dist-lib/plugins/coding/write-file.d.ts +3 -0
- package/dist-lib/plugins/coding/write-file.js +52 -0
- package/dist-lib/plugins/command-hooks/index.d.ts +88 -0
- package/dist-lib/plugins/command-hooks/index.js +338 -0
- package/dist-lib/plugins/external-agents/acp.d.ts +27 -0
- package/dist-lib/plugins/external-agents/acp.js +264 -0
- package/dist-lib/plugins/external-agents/cli.d.ts +3 -0
- package/dist-lib/plugins/external-agents/cli.js +199 -0
- package/dist-lib/plugins/external-agents/index.d.ts +25 -0
- package/dist-lib/plugins/external-agents/index.js +54 -0
- package/dist-lib/plugins/external-agents/process.d.ts +19 -0
- package/dist-lib/plugins/external-agents/process.js +92 -0
- package/dist-lib/plugins/external-agents/targets.d.ts +32 -0
- package/dist-lib/plugins/external-agents/targets.js +66 -0
- package/dist-lib/{lib/tools → plugins/image}/edit-image.d.ts +3 -2
- package/dist-lib/{lib/tools → plugins/image}/edit-image.js +7 -2
- package/dist-lib/{lib/tools → plugins/image}/generate-image.d.ts +6 -12
- package/dist-lib/{lib/tools → plugins/image}/generate-image.js +6 -7
- package/dist-lib/plugins/image/index.d.ts +25 -0
- package/dist-lib/plugins/image/index.js +76 -0
- package/dist-lib/plugins/knowledge/index.d.ts +21 -0
- package/dist-lib/plugins/knowledge/index.js +47 -0
- package/dist-lib/plugins/knowledge/search-tool.d.ts +4 -0
- package/dist-lib/plugins/knowledge/search-tool.js +38 -0
- package/dist-lib/plugins/knowledge/store.d.ts +42 -0
- package/dist-lib/plugins/knowledge/store.js +332 -0
- package/dist-lib/plugins/lsp/index.d.ts +32 -0
- package/dist-lib/plugins/lsp/index.js +77 -0
- package/dist-lib/plugins/lsp/pool.d.ts +24 -0
- package/dist-lib/plugins/lsp/pool.js +73 -0
- package/dist-lib/plugins/lsp/rpc.d.ts +37 -0
- package/dist-lib/plugins/lsp/rpc.js +145 -0
- package/dist-lib/plugins/lsp/server.d.ts +55 -0
- package/dist-lib/plugins/lsp/server.js +192 -0
- package/dist-lib/plugins/lsp/tool.d.ts +12 -0
- package/dist-lib/plugins/lsp/tool.js +366 -0
- package/dist-lib/plugins/mcp/call.d.ts +17 -0
- package/dist-lib/{lib/tools/mcp-call.js → plugins/mcp/call.js} +92 -84
- package/dist-lib/plugins/mcp/index.d.ts +21 -0
- package/dist-lib/plugins/mcp/index.js +85 -0
- package/dist-lib/{lib/tools → plugins}/mcp/protocol.d.ts +9 -16
- package/dist-lib/{lib/tools → plugins}/mcp/protocol.js +3 -16
- package/dist-lib/plugins/mcp/server.d.ts +23 -0
- package/dist-lib/plugins/mcp/server.js +108 -0
- package/dist-lib/{lib/tools → plugins/music}/generate-music.d.ts +6 -15
- package/dist-lib/{lib/tools → plugins/music}/generate-music.js +7 -8
- package/dist-lib/plugins/music/index.d.ts +24 -0
- package/dist-lib/plugins/music/index.js +48 -0
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/cli-process.d.ts +2 -2
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/cli-process.js +2 -2
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/cli.d.ts +1 -1
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/cli.js +7 -7
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/command.js +1 -1
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/guidance.d.ts +0 -1
- package/dist-lib/{lib/tools/exec → plugins}/obsidian/guidance.js +0 -7
- package/dist-lib/plugins/obsidian/index.d.ts +26 -0
- package/dist-lib/plugins/obsidian/index.js +138 -0
- package/dist-lib/{lib/tools/skills/obsidian-readiness.d.ts → plugins/obsidian/readiness.d.ts} +1 -0
- package/dist-lib/{lib/tools/skills/obsidian-readiness.js → plugins/obsidian/readiness.js} +7 -0
- package/dist-lib/plugins/python/guarded-fetch.d.ts +13 -0
- package/dist-lib/plugins/python/guarded-fetch.js +32 -0
- package/dist-lib/plugins/python/index.d.ts +18 -0
- package/dist-lib/plugins/python/index.js +19 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/interrupt-timer.js +2 -2
- package/dist-lib/plugins/python/language.d.ts +8 -0
- package/dist-lib/plugins/python/language.js +377 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/loader.d.ts +1 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/loader.js +8 -1
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/memfs.js +3 -3
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/module-distributions.js +0 -3
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/pyodide.js +4 -4
- package/dist-lib/plugins/python/python-adapter.d.ts +41 -0
- package/dist-lib/plugins/python/python-adapter.js +515 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/run-session.d.ts +1 -2
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/run-session.js +10 -99
- package/dist-lib/plugins/python/shell-redirect.d.ts +8 -0
- package/dist-lib/plugins/python/shell-redirect.js +25 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/wheels.js +5 -3
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/active.js +1 -1
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/client.d.ts +1 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/client.js +6 -3
- package/dist-lib/plugins/python/worker/entry.d.ts +1 -0
- package/dist-lib/plugins/python/worker/entry.js +9 -0
- package/dist-lib/plugins/python/worker/interrupt-deadline.d.ts +1 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/interrupt-deadline.js +1 -1
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/serve.js +2 -2
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/spawn.d.ts +1 -0
- package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/spawn.js +7 -0
- package/dist-lib/plugins/quickjs/index.d.ts +20 -0
- package/dist-lib/plugins/quickjs/index.js +25 -0
- package/dist-lib/plugins/quickjs/language.d.ts +3 -0
- package/dist-lib/plugins/quickjs/language.js +59 -0
- package/dist-lib/plugins/quickjs/runtime.d.ts +38 -0
- package/dist-lib/plugins/quickjs/runtime.js +421 -0
- package/dist-lib/plugins/quickjs/text-decoder.d.ts +1 -0
- package/dist-lib/plugins/quickjs/text-decoder.js +15 -0
- package/dist-lib/plugins/run-report/brand.d.ts +1 -0
- package/dist-lib/plugins/run-report/brand.js +1 -0
- package/dist-lib/plugins/run-report/flow-view.d.ts +6 -0
- package/dist-lib/plugins/run-report/flow-view.js +53 -0
- package/dist-lib/plugins/run-report/flow.d.ts +33 -0
- package/dist-lib/plugins/run-report/flow.js +201 -0
- package/dist-lib/plugins/run-report/index.d.ts +17 -0
- package/dist-lib/plugins/run-report/index.js +27 -0
- package/dist-lib/plugins/run-report/layout.d.ts +39 -0
- package/dist-lib/plugins/run-report/layout.js +175 -0
- package/dist-lib/plugins/run-report/meaning.d.ts +6 -0
- package/dist-lib/plugins/run-report/meaning.js +43 -0
- package/dist-lib/plugins/run-report/model.d.ts +86 -0
- package/dist-lib/plugins/run-report/model.js +387 -0
- package/dist-lib/plugins/run-report/page.d.ts +13 -0
- package/dist-lib/plugins/run-report/page.js +234 -0
- package/dist-lib/plugins/run-report/script.d.ts +1 -0
- package/dist-lib/plugins/run-report/script.js +661 -0
- package/dist-lib/plugins/run-report/story.d.ts +48 -0
- package/dist-lib/plugins/run-report/story.js +188 -0
- package/dist-lib/plugins/run-report/style.d.ts +1 -0
- package/dist-lib/plugins/run-report/style.js +410 -0
- package/dist-lib/plugins/run-report/why.d.ts +28 -0
- package/dist-lib/plugins/run-report/why.js +170 -0
- package/dist-lib/plugins/sandbox-macos/index.d.ts +48 -0
- package/dist-lib/plugins/sandbox-macos/index.js +175 -0
- package/dist-lib/plugins/sandbox-vm/index.d.ts +24 -0
- package/dist-lib/plugins/sandbox-vm/index.js +27 -0
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +46 -0
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +106 -0
- package/dist-lib/{lib → plugins/speech}/audio-transcode-bare.js +2 -2
- package/dist-lib/plugins/speech/index.d.ts +17 -0
- package/dist-lib/plugins/speech/index.js +24 -0
- package/dist-lib/plugins/speech/speech-engine.d.ts +23 -0
- package/dist-lib/plugins/speech/speech-engine.js +55 -0
- package/dist-lib/plugins/speech/speech-runtime.d.ts +22 -0
- package/dist-lib/plugins/speech/speech-runtime.js +212 -0
- package/dist-lib/{lib/capabilities → plugins/speech}/speech-text.d.ts +1 -0
- package/dist-lib/{lib/capabilities → plugins/speech}/speech-text.js +10 -3
- package/dist-lib/plugins/speech/voice-lane.d.ts +2 -0
- package/dist-lib/plugins/speech/voice-lane.js +9 -0
- package/dist-lib/plugins/speech/voice.d.ts +17 -0
- package/dist-lib/{lib/capabilities → plugins/speech}/voice.js +27 -25
- package/dist-lib/plugins/translation/index.d.ts +22 -0
- package/dist-lib/plugins/translation/index.js +63 -0
- package/dist-lib/{lib/models → plugins/translation}/nmt-catalog.d.ts +0 -1
- package/dist-lib/{lib/models → plugins/translation}/nmt-catalog.js +0 -3
- package/dist-lib/{lib/tools → plugins/translation}/translate.d.ts +14 -6
- package/dist-lib/{lib/tools → plugins/translation}/translate.js +14 -8
- package/dist-lib/plugins/walkie-talkie/crew.d.ts +27 -0
- package/dist-lib/plugins/walkie-talkie/crew.js +103 -0
- package/dist-lib/plugins/walkie-talkie/index.d.ts +127 -0
- package/dist-lib/plugins/walkie-talkie/index.js +340 -0
- package/dist-lib/plugins/walkie-talkie/wire.d.ts +67 -0
- package/dist-lib/plugins/walkie-talkie/wire.js +136 -0
- package/dist-lib/plugins/weather/geocode.d.ts +25 -0
- package/dist-lib/plugins/weather/geocode.js +101 -0
- package/dist-lib/plugins/weather/index.d.ts +15 -0
- package/dist-lib/plugins/weather/index.js +17 -0
- package/dist-lib/plugins/weather/lookup.d.ts +6 -0
- package/dist-lib/plugins/weather/lookup.js +169 -0
- package/dist-lib/{lib/tools/weather-lookup → plugins/weather}/place.js +5 -1
- package/dist-lib/plugins/web-search/engine-registry.d.ts +44 -0
- package/dist-lib/plugins/web-search/engine-registry.js +17 -0
- package/dist-lib/{lib → plugins}/web-search/engines/aol.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/aol.js +5 -3
- package/dist-lib/{lib → plugins}/web-search/engines/bing.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/bing.js +9 -4
- package/dist-lib/{lib → plugins}/web-search/engines/brave.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/brave.js +5 -3
- package/dist-lib/{lib → plugins}/web-search/engines/duckduckgo.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/duckduckgo.js +5 -2
- package/dist-lib/{lib → plugins}/web-search/engines/google.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/google.js +6 -4
- package/dist-lib/{lib → plugins}/web-search/engines/wikipedia.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/wikipedia.js +5 -3
- package/dist-lib/{lib → plugins}/web-search/engines/yahoo.d.ts +1 -0
- package/dist-lib/{lib → plugins}/web-search/engines/yahoo.js +5 -3
- package/dist-lib/{lib → plugins}/web-search/fetch-html.js +1 -1
- package/dist-lib/plugins/web-search/index.d.ts +18 -0
- package/dist-lib/plugins/web-search/index.js +33 -0
- package/dist-lib/{lib → plugins}/web-search/orchestrator.d.ts +3 -1
- package/dist-lib/{lib → plugins}/web-search/orchestrator.js +5 -5
- package/dist-lib/plugins/web-search/tool.d.ts +3 -0
- package/dist-lib/{lib/tools/web-search.js → plugins/web-search/tool.js} +18 -14
- package/dist-lib/plugins/web-search/types.js +1 -0
- package/dist-lib/schema/generate.js +5 -2
- package/dist-lib/schema/harness.js +158 -7
- package/dist-lib/spec/bind.js +20 -4
- package/dist-lib/spec/calls.js +4 -0
- package/dist-lib/spec/hrpc/hrpc.json +52 -0
- package/dist-lib/spec/hrpc/index.js +51 -3
- package/dist-lib/spec/hrpc/messages.js +595 -17
- package/dist-lib/spec/hyperschema/index.js +595 -17
- package/dist-lib/spec/hyperschema/schema.json +464 -1
- package/dist-lib/spec/hyperschema/types.d.ts +113 -2
- package/package.json +262 -485
- package/patches/{@qvac%2Finference@0.20.0.patch → @qvac%2Finference@0.21.0.patch} +8 -8
- package/scripts/addon-externals.cjs +386 -0
- package/scripts/addon-externals.d.ts +30 -0
- package/wheels/manifest.json +1 -160
- package/worker/harness-sidecar.mjs +80 -59
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-preload.d.ts +0 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-preload.js +0 -75
- package/dist-lib/lib/capabilities/completion-engine/actors/preload-failure.d.ts +0 -9
- package/dist-lib/lib/capabilities/completion-engine/actors/preload-failure.js +0 -11
- package/dist-lib/lib/capabilities/completion-engine/actors/preloading.d.ts +0 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/preloading.js +0 -114
- package/dist-lib/lib/capabilities/completion-loop/index.d.ts +0 -80
- package/dist-lib/lib/capabilities/completion-loop/index.js +0 -158
- package/dist-lib/lib/capabilities/completion-loop/metrics.d.ts +0 -5
- package/dist-lib/lib/capabilities/completion-loop/metrics.js +0 -29
- package/dist-lib/lib/capabilities/completion-loop/tool-execution.d.ts +0 -60
- package/dist-lib/lib/capabilities/completion-loop/turns.js +0 -112
- package/dist-lib/lib/capabilities/completion-runtime.d.ts +0 -46
- package/dist-lib/lib/capabilities/completion.d.ts +0 -18
- package/dist-lib/lib/capabilities/completion.js +0 -22
- package/dist-lib/lib/helpers/recovery-required.d.ts +0 -1
- package/dist-lib/lib/helpers/recovery-required.js +0 -1
- package/dist-lib/lib/hooks/built-in/index.d.ts +0 -4
- package/dist-lib/lib/hooks/built-in/index.js +0 -4
- package/dist-lib/lib/hooks/pipeline.d.ts +0 -24
- package/dist-lib/lib/hooks/pipeline.js +0 -74
- package/dist-lib/lib/hooks/registry.d.ts +0 -2
- package/dist-lib/lib/hooks/registry.js +0 -7
- package/dist-lib/lib/machine/completion/actions/skills.d.ts +0 -9
- package/dist-lib/lib/machine/completion/actions/skills.js +0 -83
- package/dist-lib/lib/machine/engine.d.ts +0 -93
- package/dist-lib/lib/machine/guards.d.ts +0 -2
- package/dist-lib/lib/machine/guards.js +0 -6
- package/dist-lib/lib/office/pptx.d.ts +0 -1
- package/dist-lib/lib/office/pptx.js +0 -26
- package/dist-lib/lib/office/python.d.ts +0 -8
- package/dist-lib/lib/office/python.js +0 -32
- package/dist-lib/lib/office/xlsx.d.ts +0 -1
- package/dist-lib/lib/office/xlsx.js +0 -26
- package/dist-lib/lib/run-log-inspect.d.ts +0 -25
- package/dist-lib/lib/run-log-protocol.d.ts +0 -2
- package/dist-lib/lib/run-log-protocol.js +0 -1
- package/dist-lib/lib/tool-call-display.d.ts +0 -1
- package/dist-lib/lib/tools/exec/adapters/adapter.d.ts +0 -31
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.d.ts +0 -7
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.js +0 -318
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.d.ts +0 -89
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +0 -1371
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.js +0 -3
- package/dist-lib/lib/tools/exec/obsidian/route.d.ts +0 -17
- package/dist-lib/lib/tools/exec/obsidian/route.js +0 -91
- package/dist-lib/lib/tools/mcp-call.d.ts +0 -14
- package/dist-lib/lib/tools/rag-search.d.ts +0 -2
- package/dist-lib/lib/tools/rag-search.js +0 -105
- package/dist-lib/lib/tools/weather-lookup.d.ts +0 -8
- package/dist-lib/lib/tools/weather-lookup.js +0 -122
- package/dist-lib/lib/tools/web-search.d.ts +0 -6
- package/dist-lib/lib/web-search/engine-registry.d.ts +0 -7
- package/dist-lib/lib/web-search/engine-registry.js +0 -17
- package/wheels/cffi-2.0.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/cryptography-47.0.0-cp314-abi3-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/defusedxml-0.7.1-py2.py3-none-any.whl +0 -0
- package/wheels/et_xmlfile-2.0.0-py3-none-any.whl +0 -0
- package/wheels/fonttools-4.62.1-py3-none-any.whl +0 -0
- package/wheels/fpdf2-2.8.8-py3-none-any.whl +0 -0
- package/wheels/lxml-6.0.2-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/openpyxl-3.1.5-py2.py3-none-any.whl +0 -0
- package/wheels/pillow-12.2.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
- package/wheels/pycparser-3.0-py3-none-any.whl +0 -0
- package/wheels/pypdf-6.15.0-py3-none-any.whl +0 -0
- package/wheels/python_docx-1.2.0-py3-none-any.whl +0 -0
- package/wheels/python_pptx-1.0.2-py3-none-any.whl +0 -0
- package/wheels/six-1.17.0-py2.py3-none-any.whl +0 -0
- package/wheels/typing_extensions-4.15.0-py3-none-any.whl +0 -0
- package/wheels/xlsxwriter-3.2.9-py3-none-any.whl +0 -0
- /package/dist-lib/lib/{tools/skills → agent}/tool-grants.d.ts +0 -0
- /package/dist-lib/lib/{tools/skills → agent}/tool-grants.js +0 -0
- /package/dist-lib/lib/capabilities/{types.js → completion-engine/prepare-step.js} +0 -0
- /package/dist-lib/lib/{hooks/types.js → capabilities/completion-engine/stages.js} +0 -0
- /package/dist-lib/lib/{tool-call-display.js → contract/agent.js} +0 -0
- /package/dist-lib/lib/{tools/exec/adapters/adapter.js → contract/completion.js} +0 -0
- /package/dist-lib/lib/{tools/exec/adapters/python/worker/entry.d.ts → contract/exec.js} +0 -0
- /package/dist-lib/lib/{tools/exec/adapters/python/worker/interrupt-deadline.d.ts → contract/hooks.js} +0 -0
- /package/dist-lib/lib/{web-search/types.js → contract/index.js} +0 -0
- /package/dist-lib/lib/{capabilities/completion-engine → helpers}/abort-polyfill.d.ts +0 -0
- /package/dist-lib/lib/{capabilities/completion-engine → helpers}/abort-polyfill.js +0 -0
- /package/dist-lib/lib/{web-search → helpers}/html-helpers.d.ts +0 -0
- /package/dist-lib/lib/{web-search → helpers}/html-helpers.js +0 -0
- /package/dist-lib/lib/{tools → helpers}/model-args.d.ts +0 -0
- /package/dist-lib/lib/{tools → helpers}/model-args.js +0 -0
- /package/dist-lib/lib/{machine → helpers}/stable-stringify.d.ts +0 -0
- /package/dist-lib/lib/{web-search → helpers}/user-agents.d.ts +0 -0
- /package/dist-lib/lib/{web-search → helpers}/user-agents.js +0 -0
- /package/dist-lib/lib/{harness-lifecycle.d.ts → lifecycle/machine.d.ts} +0 -0
- /package/dist-lib/lib/tools/{exec/adapters/python → attachments}/output-policy.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/command.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/note-name.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/note-name.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/output.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/output.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/safe-path.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/safe-path.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-create.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-create.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-fs.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-fs.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-paths.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-paths.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-read.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-read.js +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-write.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec → plugins}/obsidian/vault-write.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/deadline-state.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/deadline-state.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/distributions.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/distributions.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/interrupt-timer.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/memfs.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/module-distributions.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/named-hosts.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/named-hosts.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/net-shim.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/net-shim.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/pyodide.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/wheels.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/active.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/protocol.d.ts +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/protocol.js +0 -0
- /package/dist-lib/{lib/tools/exec/adapters → plugins}/python/worker/serve.d.ts +0 -0
- /package/dist-lib/{lib/capabilities → plugins/speech}/audio-resample.d.ts +0 -0
- /package/dist-lib/{lib/capabilities → plugins/speech}/audio-resample.js +0 -0
- /package/dist-lib/{lib → plugins/speech}/audio-transcode-bare.d.ts +0 -0
- /package/dist-lib/{lib → plugins/speech}/audio-transcode-node.d.ts +0 -0
- /package/dist-lib/{lib → plugins/speech}/audio-transcode-node.js +0 -0
- /package/dist-lib/{lib/capabilities → plugins/speech}/speech-lexicon.d.ts +0 -0
- /package/dist-lib/{lib/capabilities → plugins/speech}/speech-lexicon.js +0 -0
- /package/dist-lib/{lib → plugins/speech}/wav-encode.d.ts +0 -0
- /package/dist-lib/{lib → plugins/speech}/wav-encode.js +0 -0
- /package/dist-lib/{lib/tools/weather-lookup → plugins/weather}/place.d.ts +0 -0
- /package/dist-lib/{lib/tools/weather-lookup → plugins/weather}/report.d.ts +0 -0
- /package/dist-lib/{lib/tools/weather-lookup → plugins/weather}/report.js +0 -0
- /package/dist-lib/{lib → plugins}/web-search/fetch-html.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/format-results.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/format-results.js +0 -0
- /package/dist-lib/{lib → plugins}/web-search/merge-results.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/merge-results.js +0 -0
- /package/dist-lib/{lib → plugins}/web-search/types.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/url-helpers.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/url-helpers.js +0 -0
- /package/dist-lib/{lib → plugins}/web-search/url-normalize.d.ts +0 -0
- /package/dist-lib/{lib → plugins}/web-search/url-normalize.js +0 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { createActor } from 'xstate';
|
|
2
|
+
import { CompletionMachine } from '../../lib/machine/index.js';
|
|
3
|
+
import { errorMessage, isRecord } from '../../lib/guards.js';
|
|
4
|
+
import { RunLog } from '../../lib/run-log/index.js';
|
|
5
|
+
import { story } from './story.js';
|
|
6
|
+
import { decide } from './why.js';
|
|
7
|
+
export async function reportModel(core) {
|
|
8
|
+
const requests = new Map();
|
|
9
|
+
for await (const request of RunLog.requests(core)) {
|
|
10
|
+
requests.set(request.index, request.params);
|
|
11
|
+
}
|
|
12
|
+
const fold = new Fold(requests);
|
|
13
|
+
for await (const entry of RunLog.read(core, { anyMachine: true })) {
|
|
14
|
+
fold.add(entry);
|
|
15
|
+
}
|
|
16
|
+
return fold.finish();
|
|
17
|
+
}
|
|
18
|
+
class Fold {
|
|
19
|
+
model = {
|
|
20
|
+
run: emptySummary(),
|
|
21
|
+
definition: null,
|
|
22
|
+
steps: [],
|
|
23
|
+
visits: {},
|
|
24
|
+
edges: {},
|
|
25
|
+
story: { prompt: '', rounds: [], tools: [] }
|
|
26
|
+
};
|
|
27
|
+
calls = new Map();
|
|
28
|
+
approvals = new Map();
|
|
29
|
+
rounds = new Map();
|
|
30
|
+
receipts = new Map();
|
|
31
|
+
machine = null;
|
|
32
|
+
current = null;
|
|
33
|
+
previous;
|
|
34
|
+
started = false;
|
|
35
|
+
lastSaved = 0;
|
|
36
|
+
round = 0;
|
|
37
|
+
requests;
|
|
38
|
+
constructor(requests) {
|
|
39
|
+
this.requests = requests;
|
|
40
|
+
}
|
|
41
|
+
add(entry) {
|
|
42
|
+
const { index, record } = entry;
|
|
43
|
+
if (record.type === 'metadata') {
|
|
44
|
+
this.metadata(record);
|
|
45
|
+
}
|
|
46
|
+
else if (record.type === 'operation') {
|
|
47
|
+
this.receipt(index, record.receipt);
|
|
48
|
+
}
|
|
49
|
+
else if (record.type === 'request') {
|
|
50
|
+
this.request(index, record);
|
|
51
|
+
}
|
|
52
|
+
else if (record.type === 'checkpoint' || record.type === 'delta') {
|
|
53
|
+
this.transition(entry, record);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
finish() {
|
|
57
|
+
const snapshot = Object(this.previous);
|
|
58
|
+
const context = Object(snapshot.context);
|
|
59
|
+
const output = Object(snapshot.output);
|
|
60
|
+
const metrics = Object(output.metrics ?? context.metrics);
|
|
61
|
+
Object.assign(this.model.run, {
|
|
62
|
+
endedAt: this.lastSaved || null,
|
|
63
|
+
status: String(snapshot.status ?? 'unknown'),
|
|
64
|
+
outcome: String(output.status ?? context.outcome ?? snapshot.status ?? 'unknown'),
|
|
65
|
+
response: String(output.response ?? context.response ?? ''),
|
|
66
|
+
failure: failureOf(context, output),
|
|
67
|
+
rounds: Array.isArray(metrics.rounds)
|
|
68
|
+
? metrics.rounds.length
|
|
69
|
+
: Number(context.round ?? 0) + 1,
|
|
70
|
+
tokens: typeof metrics.tokens === 'number' ? metrics.tokens : null
|
|
71
|
+
});
|
|
72
|
+
this.model.story = story({
|
|
73
|
+
context,
|
|
74
|
+
calls: this.calls,
|
|
75
|
+
approvals: this.approvals,
|
|
76
|
+
requests: this.rounds
|
|
77
|
+
});
|
|
78
|
+
return this.model;
|
|
79
|
+
}
|
|
80
|
+
metadata(record) {
|
|
81
|
+
const request = Object(record.request);
|
|
82
|
+
const budget = Object(record.budget);
|
|
83
|
+
this.model.definition = isDefinition(record.definition) ? record.definition : null;
|
|
84
|
+
Object.assign(this.model.run, {
|
|
85
|
+
runId: record.runId,
|
|
86
|
+
model: String(request.model ?? '?'),
|
|
87
|
+
agent: String(Object(request.agent).id ?? request.agentId ?? 'default'),
|
|
88
|
+
startedAt: record.startedAt ?? null,
|
|
89
|
+
deadline: typeof budget.deadlineMs === 'number' ? budget.deadlineMs : null,
|
|
90
|
+
machine: record.machine
|
|
91
|
+
});
|
|
92
|
+
if (record.machine !== CompletionMachine.VERSION || record.xstate !== RunLog.XSTATE_VERSION) {
|
|
93
|
+
this.model.run.replay = `Recorded on machine v${record.machine} and xstate ${record.xstate ?? '?'}; this report runs v${CompletionMachine.VERSION} and ${RunLog.XSTATE_VERSION}, so routes are not re-weighed.`;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.machine = CompletionMachine.create();
|
|
97
|
+
}
|
|
98
|
+
receipt(index, receipt) {
|
|
99
|
+
const known = this.receipts.get(receipt.id);
|
|
100
|
+
if (receipt.status === 'result' && known) {
|
|
101
|
+
Object.assign(known, { result: receipt.result, settled: true });
|
|
102
|
+
this.approval(receipt);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const step = {
|
|
106
|
+
kind: 'receipt',
|
|
107
|
+
index,
|
|
108
|
+
round: Number(/:round-(\d+):/.exec(receipt.id)?.[1] ?? this.round),
|
|
109
|
+
id: receipt.id,
|
|
110
|
+
name: receipt.name,
|
|
111
|
+
effect: receipt.effect,
|
|
112
|
+
args: receipt.status === 'result' ? undefined : receipt.args,
|
|
113
|
+
result: receipt.status === 'result' ? receipt.result : undefined,
|
|
114
|
+
settled: receipt.status === 'result'
|
|
115
|
+
};
|
|
116
|
+
this.receipts.set(receipt.id, step);
|
|
117
|
+
this.model.steps.push(step);
|
|
118
|
+
}
|
|
119
|
+
approval(receipt) {
|
|
120
|
+
const named = /:round-(\d+):(.+):approve$/.exec(receipt.id);
|
|
121
|
+
if (receipt.name === 'human:approve' && named && receipt.status === 'result') {
|
|
122
|
+
this.approvals.set(`${named[1]}:${named[2]}`, receipt.result === true);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
request(index, record) {
|
|
126
|
+
if (!this.rounds.has(record.round)) {
|
|
127
|
+
this.rounds.set(record.round, index);
|
|
128
|
+
}
|
|
129
|
+
const params = Object(this.requests.get(index));
|
|
130
|
+
const history = Array.isArray(params.history) ? params.history : [];
|
|
131
|
+
const tools = Array.isArray(params.tools) ? params.tools : [];
|
|
132
|
+
this.model.steps.push({
|
|
133
|
+
kind: 'request',
|
|
134
|
+
index,
|
|
135
|
+
round: record.round,
|
|
136
|
+
attempt: record.attempt,
|
|
137
|
+
droppedTurns: record.droppedTurns,
|
|
138
|
+
appended: history.slice(record.keep),
|
|
139
|
+
tools: tools.map((tool) => String(Object(Object(tool).function ?? tool).name ?? '?'))
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
transition({ index, snapshot, events }, record) {
|
|
143
|
+
const previous = this.previous;
|
|
144
|
+
this.saw(snapshot, record.savedAt, events);
|
|
145
|
+
if (!this.started) {
|
|
146
|
+
this.begin(snapshot);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.inspected(index, snapshot, events);
|
|
150
|
+
const micro = events.flatMap((event) => this.replay(event));
|
|
151
|
+
const recorded = record.trace ?? [];
|
|
152
|
+
this.restore(snapshot);
|
|
153
|
+
const from = Object(previous).value;
|
|
154
|
+
const to = Object(snapshot).value;
|
|
155
|
+
const drift = this.machine !== null && routes(micro) !== routesOf(recorded);
|
|
156
|
+
const walked = drift ? [] : micro;
|
|
157
|
+
const step = {
|
|
158
|
+
kind: 'transition',
|
|
159
|
+
index,
|
|
160
|
+
round: this.round,
|
|
161
|
+
at: record.savedAt,
|
|
162
|
+
from,
|
|
163
|
+
to,
|
|
164
|
+
events,
|
|
165
|
+
micro,
|
|
166
|
+
recorded,
|
|
167
|
+
changes: record.type === 'delta' ? changes(record.patch, { before: previous, after: snapshot }) : [],
|
|
168
|
+
entered: entered(walked, from, to),
|
|
169
|
+
taken: this.taken(walked, recorded),
|
|
170
|
+
facts: events.length > 0 && events.every((event) => event.type === 'FACTS'),
|
|
171
|
+
drift
|
|
172
|
+
};
|
|
173
|
+
this.count(step);
|
|
174
|
+
}
|
|
175
|
+
saw(snapshot, savedAt, events) {
|
|
176
|
+
this.previous = snapshot;
|
|
177
|
+
this.round = Number(Object(Object(snapshot).context).round ?? this.round);
|
|
178
|
+
this.lastSaved = savedAt;
|
|
179
|
+
this.learn(snapshot, events);
|
|
180
|
+
}
|
|
181
|
+
inspected(index, snapshot, events) {
|
|
182
|
+
const round = Object(Object(snapshot).context).round;
|
|
183
|
+
for (const event of events) {
|
|
184
|
+
const call = Object(Object(event.output).call);
|
|
185
|
+
if (String(event.type).endsWith('.tools.inspecting') && typeof call.id === 'string') {
|
|
186
|
+
this.calls.set(`${round}:${call.id}`, {
|
|
187
|
+
name: String(call.name),
|
|
188
|
+
args: call.args,
|
|
189
|
+
step: index
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
begin(snapshot) {
|
|
195
|
+
this.started = true;
|
|
196
|
+
this.restore(snapshot);
|
|
197
|
+
for (const id of activeIds(Object(snapshot).value, 'completion')) {
|
|
198
|
+
this.model.visits[id] = [];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
taken(micro, recorded) {
|
|
202
|
+
const keys = micro.length > 0
|
|
203
|
+
? micro.flatMap((each) => each.candidates.filter((c) => c.verdict === 'taken').map((c) => c.key))
|
|
204
|
+
: recorded.flatMap((item) => routeKeys(this.model.definition, item));
|
|
205
|
+
return [...new Set(keys)];
|
|
206
|
+
}
|
|
207
|
+
count(step) {
|
|
208
|
+
const { index, entered, taken } = step;
|
|
209
|
+
this.model.steps.push(step);
|
|
210
|
+
for (const id of entered) {
|
|
211
|
+
;
|
|
212
|
+
(this.model.visits[id] ??= []).push(index);
|
|
213
|
+
}
|
|
214
|
+
for (const key of taken) {
|
|
215
|
+
;
|
|
216
|
+
(this.model.edges[key] ??= []).push(index);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
learn(snapshot, events) {
|
|
220
|
+
const run = this.model.run;
|
|
221
|
+
const policy = Object(Object(Object(snapshot).context).policy);
|
|
222
|
+
run.maxToolRounds ??= typeof policy.maxToolRounds === 'number' ? policy.maxToolRounds : null;
|
|
223
|
+
const facts = Object(events.find((event) => event.type === 'FACTS')?.value);
|
|
224
|
+
const tools = Array.isArray(facts.tools) ? facts.tools : [];
|
|
225
|
+
if (run.tools.length === 0 && tools.length > 0) {
|
|
226
|
+
run.tools = tools.map((tool) => String(Object(tool).name ?? '?'));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
replay(event) {
|
|
230
|
+
if (!this.machine || !this.current || typeof event.type !== 'string') {
|
|
231
|
+
return [];
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
const decided = decide(this.machine, this.current, { ...event, type: event.type });
|
|
235
|
+
this.current = decided.at(-1)?.after ?? this.current;
|
|
236
|
+
return decided.map(({ eventType, before, after, candidates }) => ({
|
|
237
|
+
eventType,
|
|
238
|
+
from: before.value,
|
|
239
|
+
to: after.value,
|
|
240
|
+
candidates
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
this.model.run.replay ||= `Routes could not be re-weighed: ${errorMessage(error)}`;
|
|
245
|
+
return [];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
restore(snapshot) {
|
|
249
|
+
if (!this.machine || !isRecord(snapshot)) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
const persisted = RunLog.parseSnapshot(snapshot);
|
|
254
|
+
this.current = createActor(this.machine, { snapshot: persisted }).getSnapshot();
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
this.model.run.replay ||= `A recorded snapshot did not restore: ${errorMessage(error)}`;
|
|
258
|
+
this.current = null;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function failureOf(context, output) {
|
|
263
|
+
const reason = [
|
|
264
|
+
context.failMessage,
|
|
265
|
+
Object(context.failure).message,
|
|
266
|
+
Object(output.error).message,
|
|
267
|
+
output.error
|
|
268
|
+
];
|
|
269
|
+
const found = reason.find((value) => typeof value === 'string' && value.length > 0);
|
|
270
|
+
return typeof found === 'string' ? found : '';
|
|
271
|
+
}
|
|
272
|
+
function entered(micro, from, to) {
|
|
273
|
+
const walks = micro.length > 0 ? micro : [{ from, to }];
|
|
274
|
+
const out = new Set();
|
|
275
|
+
for (const walk of walks) {
|
|
276
|
+
const was = new Set(activeIds(walk.from, 'completion'));
|
|
277
|
+
for (const id of activeIds(walk.to, 'completion')) {
|
|
278
|
+
if (!was.has(id)) {
|
|
279
|
+
out.add(id);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return [...out];
|
|
284
|
+
}
|
|
285
|
+
function routeKeys(definition, item) {
|
|
286
|
+
return item.sourceIds.flatMap((source) => {
|
|
287
|
+
const state = find(definition, source);
|
|
288
|
+
const event = item.eventType || 'always';
|
|
289
|
+
const list = (item.eventType ? state?.on?.[item.eventType] : state?.always) ?? [];
|
|
290
|
+
const index = list.findIndex((route) => item.targetIds.every((target) => route.target?.includes(target)));
|
|
291
|
+
return index < 0 ? [] : [`${source}|${event}|${index}`];
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
function find(node, id) {
|
|
295
|
+
if (!node || node.id === id) {
|
|
296
|
+
return node;
|
|
297
|
+
}
|
|
298
|
+
for (const child of Object.values(node.states ?? {})) {
|
|
299
|
+
const found = find(child, id);
|
|
300
|
+
if (found) {
|
|
301
|
+
return found;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
function routes(micro) {
|
|
307
|
+
return micro
|
|
308
|
+
.flatMap((step) => step.candidates
|
|
309
|
+
.filter((candidate) => candidate.verdict === 'taken')
|
|
310
|
+
.map((candidate) => `${step.eventType}:${candidate.source}>${candidate.targets.join(',')}`))
|
|
311
|
+
.join(' ');
|
|
312
|
+
}
|
|
313
|
+
function routesOf(trace) {
|
|
314
|
+
return trace
|
|
315
|
+
.map((item) => `${item.eventType}:${item.sourceIds.join(',')}>${item.targetIds.join(',')}`)
|
|
316
|
+
.join(' ');
|
|
317
|
+
}
|
|
318
|
+
function emptySummary() {
|
|
319
|
+
return {
|
|
320
|
+
runId: '?',
|
|
321
|
+
model: '?',
|
|
322
|
+
agent: 'default',
|
|
323
|
+
startedAt: null,
|
|
324
|
+
endedAt: null,
|
|
325
|
+
tools: [],
|
|
326
|
+
maxToolRounds: null,
|
|
327
|
+
deadline: null,
|
|
328
|
+
status: 'unknown',
|
|
329
|
+
outcome: 'unknown',
|
|
330
|
+
response: '',
|
|
331
|
+
rounds: 0,
|
|
332
|
+
tokens: null,
|
|
333
|
+
machine: null,
|
|
334
|
+
replay: '',
|
|
335
|
+
failure: ''
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
export function activeIds(value, prefix) {
|
|
339
|
+
if (typeof value === 'string') {
|
|
340
|
+
return [`${prefix}.${value}`];
|
|
341
|
+
}
|
|
342
|
+
return isRecord(value)
|
|
343
|
+
? Object.entries(value).flatMap(([key, child]) => [
|
|
344
|
+
`${prefix}.${key}`,
|
|
345
|
+
...activeIds(child, `${prefix}.${key}`)
|
|
346
|
+
])
|
|
347
|
+
: [];
|
|
348
|
+
}
|
|
349
|
+
function changes(patch, sides) {
|
|
350
|
+
const out = [];
|
|
351
|
+
const walk = ({ patch: node, path, before, after }) => {
|
|
352
|
+
if (!isRecord(node)) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if ('t' in node && Array.isArray(node.a)) {
|
|
356
|
+
out.push({
|
|
357
|
+
path,
|
|
358
|
+
before: undefined,
|
|
359
|
+
after: undefined,
|
|
360
|
+
kept: Number(node.t),
|
|
361
|
+
appended: node.a
|
|
362
|
+
});
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if ('$' in node || 't' in node) {
|
|
366
|
+
out.push({ path: path || '$', before, after });
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
for (const key of Array.isArray(node.d) ? node.d : []) {
|
|
370
|
+
out.push({ path: join(path, String(key)), before: Object(before)[key], after: undefined });
|
|
371
|
+
}
|
|
372
|
+
for (const [key, child] of Object.entries(isRecord(node.o) ? node.o : {})) {
|
|
373
|
+
const next = { before: Object(before)[key], after: Object(after)[key] };
|
|
374
|
+
if (key !== 'children' || path !== '') {
|
|
375
|
+
walk({ patch: child, path: join(path, key), ...next });
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
walk({ patch, path: '', ...sides });
|
|
380
|
+
return out;
|
|
381
|
+
}
|
|
382
|
+
function isDefinition(value) {
|
|
383
|
+
return isRecord(value) && typeof value.id === 'string' && typeof value.type === 'string';
|
|
384
|
+
}
|
|
385
|
+
function join(path, key) {
|
|
386
|
+
return path ? `${path}.${key}` : key;
|
|
387
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Chart } from './layout.ts';
|
|
2
|
+
import type { ReportModel } from './model.ts';
|
|
3
|
+
import type { Flow } from './flow.ts';
|
|
4
|
+
export interface Charts {
|
|
5
|
+
run: Chart;
|
|
6
|
+
all: Chart;
|
|
7
|
+
}
|
|
8
|
+
export interface Views {
|
|
9
|
+
flow: Flow;
|
|
10
|
+
machine: Charts | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function page(model: ReportModel, views: Views, title: string): string;
|
|
13
|
+
export declare function esc(value: string): string;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { WORDMARK } from './brand.js';
|
|
2
|
+
import { MEANINGS } from './meaning.js';
|
|
3
|
+
import { SCRIPT } from './script.js';
|
|
4
|
+
import { flowSvg, storyChips } from './flow-view.js';
|
|
5
|
+
import { STYLE } from './style.js';
|
|
6
|
+
const FONTS = 'https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Inconsolata:wght@400;600;700&display=swap';
|
|
7
|
+
export function page(model, views, title) {
|
|
8
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
9
|
+
<title>${esc(title)}</title>
|
|
10
|
+
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
11
|
+
<link href="${FONTS}" rel="stylesheet"><style>${STYLE}</style></head><body><main>
|
|
12
|
+
<header class="topbar"><div class="brand">${WORDMARK}<span>Run report</span></div><button class="pill" type="button" id="theme">Theme</button></header>
|
|
13
|
+
${hero(model, title)}
|
|
14
|
+
<section id="flow"><h2>How the run went</h2>
|
|
15
|
+
<p class="section-lede">From the request to the answer: each round the model took, and each call it made, colored by how it went, with the reason when it went wrong. Click any box for its details and the state machine steps inside it. Press play or use ← and → to walk the run.</p>
|
|
16
|
+
${board(model, views)}</section>
|
|
17
|
+
</main>
|
|
18
|
+
<script type="application/json" id="data">${json(pageData(model, views))}</script>
|
|
19
|
+
<script>${SCRIPT}</script></body></html>`;
|
|
20
|
+
}
|
|
21
|
+
function pageData(model, views) {
|
|
22
|
+
const chart = views.machine?.all;
|
|
23
|
+
return {
|
|
24
|
+
meanings: MEANINGS,
|
|
25
|
+
flow: views.flow.nodes.map(({ x, y, w, h, ...box }) => box),
|
|
26
|
+
run: model.run,
|
|
27
|
+
steps: model.steps,
|
|
28
|
+
visits: model.visits,
|
|
29
|
+
edges: model.edges,
|
|
30
|
+
story: model.story,
|
|
31
|
+
nodes: chart?.nodes.map(({ id, label, group, kind, stays }) => ({
|
|
32
|
+
id,
|
|
33
|
+
label,
|
|
34
|
+
group,
|
|
35
|
+
kind,
|
|
36
|
+
stays
|
|
37
|
+
})) ?? [],
|
|
38
|
+
routes: chart?.edges.map(({ key, source, target, event, guard }) => ({
|
|
39
|
+
key,
|
|
40
|
+
source,
|
|
41
|
+
target,
|
|
42
|
+
event,
|
|
43
|
+
guard
|
|
44
|
+
})) ?? []
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function board(model, { flow, machine }) {
|
|
48
|
+
const canvas = flowSvg(flow, esc) +
|
|
49
|
+
(machine ? svg(machine.run, model, 'run') + svg(machine.all, model, 'all') : '');
|
|
50
|
+
return `<div class="board"><div class="card flow">
|
|
51
|
+
<div class="toolbar"><div class="views"><button class="pill" type="button" data-chart="flow" aria-pressed="true">The run</button>${machine ? '<button class="pill" type="button" data-chart="machine" aria-pressed="false">State machine</button>' : ''}</div>
|
|
52
|
+
<div class="legend flow-only"><span class="o-ok"><i></i>ok</span><span class="o-failed"><i></i>failed</span><span class="o-rejected"><i></i>rejected</span><span class="o-denied"><i></i>denied</span></div>
|
|
53
|
+
<div class="legend machine-only"><span class="l-now"><i></i>this step</span><span class="l-taken"><i></i>taken</span><span class="l-not"><i></i>never taken</span><span class="l-trouble"><i></i>call turned down</span><span class="l-person"><i></i>a person decides</span><span class="l-error"><i></i>failed</span></div><span class="grow"></span>
|
|
54
|
+
<button class="pill machine-only" type="button" id="untaken" aria-pressed="false">Whole machine</button>
|
|
55
|
+
<button class="pill" type="button" id="facts" aria-pressed="false">Fact refreshes</button>
|
|
56
|
+
<button class="pill" type="button" id="follow" aria-pressed="true">Follow</button>
|
|
57
|
+
<button class="pill" type="button" id="zoom-out" aria-label="Zoom out">−</button><button class="pill" type="button" id="zoom-in" aria-label="Zoom in">+</button><button class="pill" type="button" id="fit">Fit</button></div>
|
|
58
|
+
${jumps(model)}<div class="canvas" id="canvas">${canvas}</div>
|
|
59
|
+
<div class="player"><div class="buttons"><button type="button" id="first" aria-label="First step">⏮</button><button type="button" id="prev" aria-label="Previous step">◀</button><button type="button" class="play" id="play" aria-label="Play">▶</button><button type="button" id="next" aria-label="Next step">▶︎▶︎</button></div>
|
|
60
|
+
<input type="range" id="scrub" min="0" max="0" value="0" aria-label="Step"><span class="where" id="where"></span><div class="ticks" id="ticks"></div></div>
|
|
61
|
+
</div><aside class="card panel" id="panel"></aside></div>`;
|
|
62
|
+
}
|
|
63
|
+
function jumps(model) {
|
|
64
|
+
const bad = model.story.rounds
|
|
65
|
+
.flatMap((round) => round.calls)
|
|
66
|
+
.filter((call) => call.outcome !== 'ok' && call.step !== null);
|
|
67
|
+
if (bad.length === 0) {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
const chips = bad.map((call) => `<button type="button" class="chip o-${call.outcome}" data-goto="${call.step}">Round ${call.round + 1} · ${esc(call.name)} · ${esc(call.outcome === 'pending' ? 'no result' : call.outcome)}</button>`);
|
|
71
|
+
return `<div class="jumps"><span class="muted">Went wrong:</span>${chips.join('')}</div>`;
|
|
72
|
+
}
|
|
73
|
+
function hero(model, title) {
|
|
74
|
+
const { run } = model;
|
|
75
|
+
const wall = run.startedAt && run.endedAt ? duration(run.endedAt - run.startedAt) : '?';
|
|
76
|
+
const approvals = model.visits['completion.active.tools.approving']?.length ?? 0;
|
|
77
|
+
const good = run.outcome === 'success' || run.status === 'done';
|
|
78
|
+
const tiles = [
|
|
79
|
+
['rounds', String(run.rounds)],
|
|
80
|
+
['tool calls', String(model.story.rounds.flatMap((round) => round.calls).length)],
|
|
81
|
+
['approvals', String(approvals)],
|
|
82
|
+
['tokens', run.tokens === null ? '?' : String(run.tokens)],
|
|
83
|
+
['wall time', wall],
|
|
84
|
+
['state changes', String(model.steps.filter((step) => step.kind === 'transition').length)]
|
|
85
|
+
];
|
|
86
|
+
const limits = [
|
|
87
|
+
run.maxToolRounds === null ? '' : `at most ${run.maxToolRounds} tool rounds`,
|
|
88
|
+
run.deadline && run.startedAt ? `deadline ${duration(run.deadline - run.startedAt)}` : ''
|
|
89
|
+
].filter(Boolean);
|
|
90
|
+
return `<div class="card hero"><p class="eyebrow">Run ${esc(run.runId.slice(0, 12))}</p>
|
|
91
|
+
<h1>${esc(title)}</h1>
|
|
92
|
+
<p class="lede">Agent <b>${esc(run.agent)}</b> on <code>${esc(run.model)}</code>, completion machine v${esc(String(run.machine ?? '?'))}.</p>
|
|
93
|
+
<div class="chips"><span class="chip ${good ? 'good' : 'warn'}">${esc(run.outcome)}</span>${storyChips(model.story, esc)}${limits.map((limit) => `<span class="chip warn">${esc(limit)}</span>`).join('')}</div>
|
|
94
|
+
${run.tools.length ? `<p class="offered">Tools offered: ${run.tools.map((tool) => `<code>${esc(tool)}</code>`).join(' ')}</p>` : ''}
|
|
95
|
+
<div class="tiles">${tiles.map(([key, val]) => `<div class="tile"><b>${esc(val)}</b><span>${esc(key)}</span></div>`).join('')}</div>
|
|
96
|
+
${run.response ? `<details class="answer"><summary>The answer</summary><pre class="json">${esc(run.response)}</pre></details>` : ''}
|
|
97
|
+
${run.replay ? `<div class="notice">${esc(run.replay)}</div>` : ''}</div>`;
|
|
98
|
+
}
|
|
99
|
+
function svg(chart, model, which) {
|
|
100
|
+
const pad = 16;
|
|
101
|
+
const w = chart.w + pad * 2;
|
|
102
|
+
const h = chart.h + pad * 2;
|
|
103
|
+
return `<svg id="chart-${which}" class="chart" style="display:none" xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="${-pad} ${-pad} ${w} ${h}" data-w="${w}" data-h="${h}">
|
|
104
|
+
<defs>${MARKS.map((kind) => marker(kind, which)).join('')}</defs>
|
|
105
|
+
${chart.edges.map((edge) => route(edge, model)).join('\n')}
|
|
106
|
+
${chart.nodes.map((node) => state(node, model)).join('\n')}
|
|
107
|
+
${chart.nodes.map((node) => badge(node, troubles(model))).join('')}
|
|
108
|
+
</svg>`;
|
|
109
|
+
}
|
|
110
|
+
const FILLS = {
|
|
111
|
+
faint: 'var(--fg-faint)',
|
|
112
|
+
taken: 'var(--primary)',
|
|
113
|
+
hot: 'var(--fg)',
|
|
114
|
+
picked: 'var(--info-fg)',
|
|
115
|
+
trouble: 'var(--warn-fg)',
|
|
116
|
+
person: 'var(--info-fg)',
|
|
117
|
+
limit: 'var(--warn-fg)',
|
|
118
|
+
error: 'var(--bad-fg)'
|
|
119
|
+
};
|
|
120
|
+
const MARKS = Object.keys(FILLS);
|
|
121
|
+
function marker(kind, which) {
|
|
122
|
+
const fill = FILLS[kind];
|
|
123
|
+
return `<marker id="arrow-${which}-${kind}" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 z" style="fill:${fill}"/></marker>`;
|
|
124
|
+
}
|
|
125
|
+
function state(node, model) {
|
|
126
|
+
const seen = node.kind === 'any' || node.kind === 'start' || node.id in model.visits;
|
|
127
|
+
const meaning = MEANINGS[node.id];
|
|
128
|
+
const tone = meaning?.tone ? ` t-${meaning.tone}` : '';
|
|
129
|
+
const cls = `n ${node.kind} ${seen ? 'visited' : 'unvisited'}${tone}`;
|
|
130
|
+
const id = esc(node.id);
|
|
131
|
+
const tip = meaning ? `<title>${esc(meaning.says)}</title>` : '';
|
|
132
|
+
const cx = node.x + node.w / 2;
|
|
133
|
+
const cy = node.y + node.h / 2;
|
|
134
|
+
if (node.kind === 'start') {
|
|
135
|
+
return `<g class="${cls}" data-id="${id}"><circle cx="${cx}" cy="${cy}" r="7"/></g>`;
|
|
136
|
+
}
|
|
137
|
+
if (node.kind === 'history') {
|
|
138
|
+
return `<g class="${cls}" data-id="${id}">${tip}<circle cx="${cx}" cy="${cy}" r="${node.w / 2}"/><text x="${cx}" y="${cy + 4.5}" text-anchor="middle">H</text></g>`;
|
|
139
|
+
}
|
|
140
|
+
const count = model.visits[node.id]?.length;
|
|
141
|
+
const name = node.group
|
|
142
|
+
? `<text class="grp" x="${node.x + 12}" y="${node.y + 15}">${esc(node.group)}</text><text x="${node.x + 12}" y="${node.y + 32}">${esc(node.label)}</text>`
|
|
143
|
+
: `<text x="${node.x + 12}" y="${cy + 4.5}">${esc(node.label)}</text>`;
|
|
144
|
+
return `<g class="${cls}" data-id="${id}">${tip}<rect x="${node.x}" y="${node.y}" width="${node.w}" height="${node.h}" rx="10"/>
|
|
145
|
+
${name}${count ? `<text class="count" x="${node.x + node.w - 10}" y="${cy + 4}" text-anchor="end">×${count}</text>` : ''}</g>`;
|
|
146
|
+
}
|
|
147
|
+
function route(edge, model) {
|
|
148
|
+
const taken = model.edges[edge.key]?.length ?? 0;
|
|
149
|
+
const start = edge.event === '';
|
|
150
|
+
const d = `M${edge.points.map(([x, y]) => `${x},${y}`).join(' L')}`;
|
|
151
|
+
const width = taken ? Math.min(1.6 + Math.log2(taken + 1) * 0.8, 4) : 1.2;
|
|
152
|
+
const tone = MEANINGS[edge.target]?.tone;
|
|
153
|
+
const toned = tone && tone !== 'end' ? tone : '';
|
|
154
|
+
const cls = `e${taken || start ? ' taken' : ''}${toned ? ` to-${toned}` : ''}`;
|
|
155
|
+
const used = taken > 0 || start;
|
|
156
|
+
const head = used ? toned || 'taken' : 'faint';
|
|
157
|
+
const { x, y, w, h } = edge.label;
|
|
158
|
+
const lines = [edge.event, edge.guard ? `[${edge.guard}]` : ''].filter(Boolean);
|
|
159
|
+
const label = start
|
|
160
|
+
? ''
|
|
161
|
+
: `<g class="lab"><rect x="${x}" y="${y}" width="${w}" height="${h}" rx="5"/>${lines
|
|
162
|
+
.map((line, index) => `<text x="${x + 6}" y="${y + 14 + index * 15}">${esc(line)}${index === 0 && taken ? `<tspan class="n-taken" dx="6">×${taken}</tspan>` : ''}</text>`)
|
|
163
|
+
.join('')}</g>`;
|
|
164
|
+
return `<g class="${cls}" data-key="${esc(edge.key)}"><path class="hit" d="${d}"/><path class="line" d="${d}" style="stroke-width:${width}" data-head="${head}"/>${label}</g>`;
|
|
165
|
+
}
|
|
166
|
+
const BADGES = [
|
|
167
|
+
{
|
|
168
|
+
state: 'completion.active.tools.rejecting',
|
|
169
|
+
text: 'rejected',
|
|
170
|
+
tone: 'rejected',
|
|
171
|
+
counts: (call) => call.outcome === 'rejected'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
state: 'completion.active.tools.executing',
|
|
175
|
+
text: 'failed',
|
|
176
|
+
tone: 'failed',
|
|
177
|
+
counts: (call) => call.outcome === 'failed'
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
state: 'completion.active.tools.approving',
|
|
181
|
+
text: 'approved',
|
|
182
|
+
tone: 'ok',
|
|
183
|
+
counts: (call) => call.approved === true
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
state: 'completion.active.tools.approving',
|
|
187
|
+
text: 'declined',
|
|
188
|
+
tone: 'denied',
|
|
189
|
+
counts: (call) => call.approved === false
|
|
190
|
+
}
|
|
191
|
+
];
|
|
192
|
+
function troubles(model) {
|
|
193
|
+
const calls = model.story.rounds.flatMap((round) => round.calls);
|
|
194
|
+
const out = new Map();
|
|
195
|
+
for (const rule of BADGES) {
|
|
196
|
+
const n = calls.filter(rule.counts).length;
|
|
197
|
+
if (n > 0) {
|
|
198
|
+
out.set(rule.state, [
|
|
199
|
+
...(out.get(rule.state) ?? []),
|
|
200
|
+
{ text: `${n} ${rule.text}`, tone: rule.tone }
|
|
201
|
+
]);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
function badge(node, all) {
|
|
207
|
+
let right = node.x + node.w + 6;
|
|
208
|
+
return (all.get(node.id) ?? [])
|
|
209
|
+
.map((trouble) => {
|
|
210
|
+
const w = trouble.text.length * 6.4 + 14;
|
|
211
|
+
right -= w + 4;
|
|
212
|
+
return `<g class="tb o-${trouble.tone}" data-id="${esc(node.id)}"><rect x="${right}" y="${node.y - 11}" width="${w}" height="18" rx="9"/><text x="${right + w / 2}" y="${node.y + 2}" text-anchor="middle">${esc(trouble.text)}</text></g>`;
|
|
213
|
+
})
|
|
214
|
+
.join('');
|
|
215
|
+
}
|
|
216
|
+
function json(value) {
|
|
217
|
+
return JSON.stringify(value).replace(/</g, '\\u003c');
|
|
218
|
+
}
|
|
219
|
+
export function esc(value) {
|
|
220
|
+
return value
|
|
221
|
+
.replace(/&/g, '&')
|
|
222
|
+
.replace(/</g, '<')
|
|
223
|
+
.replace(/>/g, '>')
|
|
224
|
+
.replace(/"/g, '"');
|
|
225
|
+
}
|
|
226
|
+
function duration(ms) {
|
|
227
|
+
const s = Math.round(ms / 1000);
|
|
228
|
+
if (s < 60) {
|
|
229
|
+
return `${s} s`;
|
|
230
|
+
}
|
|
231
|
+
return s < 3600
|
|
232
|
+
? `${Math.floor(s / 60)}m ${s % 60}s`
|
|
233
|
+
: `${Math.floor(s / 3600)}h ${Math.floor((s % 3600) / 60)}m`;
|
|
234
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SCRIPT: string;
|