@halonicjs/testing 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +1 -0
- package/README.md +40 -2
- package/dist/adapters/http-kit/src/address-class.d.ts +34 -0
- package/dist/adapters/http-kit/src/address-class.js +109 -0
- package/dist/adapters/http-kit/src/index.d.ts +2 -0
- package/dist/adapters/http-kit/src/index.js +2 -0
- package/dist/adapters/http-kit/src/ip-address.d.ts +23 -0
- package/dist/adapters/http-kit/src/ip-address.js +89 -0
- package/dist/adapters/integration-kit/src/declaration.d.ts +14 -0
- package/dist/adapters/integration-kit/src/declaration.js +77 -0
- package/dist/adapters/integration-kit/src/host.d.ts +28 -0
- package/dist/adapters/integration-kit/src/host.js +30 -0
- package/dist/adapters/integration-kit/src/index.d.ts +14 -0
- package/dist/adapters/integration-kit/src/index.js +21 -0
- package/dist/adapters/integration-kit/src/leak-attempt.d.ts +14 -0
- package/dist/adapters/integration-kit/src/leak-attempt.js +16 -0
- package/dist/adapters/integration-kit/src/limited-http.d.ts +49 -0
- package/dist/adapters/integration-kit/src/limited-http.js +182 -0
- package/dist/adapters/integration-kit/src/load-problem.d.ts +20 -0
- package/dist/adapters/integration-kit/src/load-problem.js +1 -0
- package/dist/adapters/integration-kit/src/loader.d.ts +104 -0
- package/dist/adapters/integration-kit/src/loader.js +219 -0
- package/dist/adapters/integration-kit/src/local-address.d.ts +15 -0
- package/dist/adapters/integration-kit/src/local-address.js +25 -0
- package/dist/adapters/integration-kit/src/own-request.d.ts +33 -0
- package/dist/adapters/integration-kit/src/own-request.js +36 -0
- package/dist/adapters/integration-kit/src/plugin-load.d.ts +14 -0
- package/dist/adapters/integration-kit/src/plugin-load.js +58 -0
- package/dist/adapters/integration-kit/src/policy.d.ts +55 -0
- package/dist/adapters/integration-kit/src/policy.js +37 -0
- package/dist/adapters/integration-kit/src/request-body.d.ts +38 -0
- package/dist/adapters/integration-kit/src/request-body.js +68 -0
- package/dist/adapters/integration-kit/src/request-log.d.ts +25 -0
- package/dist/adapters/integration-kit/src/request-log.js +17 -0
- package/dist/adapters/integration-kit/src/response-body.d.ts +23 -0
- package/dist/adapters/integration-kit/src/response-body.js +117 -0
- package/dist/adapters/integration-kit/src/scoped-tokens.d.ts +14 -0
- package/dist/adapters/integration-kit/src/scoped-tokens.js +27 -0
- package/dist/adapters/integration-kit/src/secret-filter.d.ts +84 -0
- package/dist/adapters/integration-kit/src/secret-filter.js +205 -0
- package/dist/adapters/integration-kit/src/secret-in-request.d.ts +59 -0
- package/dist/adapters/integration-kit/src/secret-in-request.js +133 -0
- package/dist/adapters/integration-kit/src/secret-placement.d.ts +36 -0
- package/dist/adapters/integration-kit/src/secret-placement.js +190 -0
- package/dist/adapters/integration-kit/src/wait.d.ts +16 -0
- package/dist/adapters/integration-kit/src/wait.js +35 -0
- package/dist/core/events/src/add-usage.d.ts +10 -0
- package/dist/core/events/src/add-usage.js +27 -0
- package/dist/core/events/src/agent-resume.d.ts +24 -0
- package/dist/core/events/src/agent-resume.js +1 -0
- package/dist/core/events/src/home-path.d.ts +13 -0
- package/dist/core/events/src/home-path.js +26 -0
- package/dist/core/events/src/index.d.ts +13 -0
- package/dist/core/events/src/index.js +7 -0
- package/dist/core/events/src/run-basics.d.ts +205 -0
- package/dist/core/events/src/run-basics.js +1 -0
- package/dist/core/events/src/run-event.d.ts +434 -0
- package/dist/core/events/src/run-event.js +1 -0
- package/dist/core/events/src/run-summary.d.ts +108 -0
- package/dist/core/events/src/run-summary.js +1 -0
- package/dist/core/events/src/sandbox-blocked.d.ts +42 -0
- package/dist/core/events/src/sandbox-blocked.js +26 -0
- package/dist/core/events/src/sandbox-opened-read.d.ts +17 -0
- package/dist/core/events/src/sandbox-opened-read.js +63 -0
- package/dist/core/events/src/sandbox-opened.d.ts +94 -0
- package/dist/core/events/src/sandbox-opened.js +52 -0
- package/dist/core/events/src/summarize.d.ts +14 -0
- package/dist/core/events/src/summarize.js +188 -0
- package/dist/core/events/src/timeline-entry.d.ts +21 -0
- package/dist/core/events/src/timeline-entry.js +105 -0
- package/dist/core/events/src/upgrade.d.ts +23 -0
- package/dist/core/events/src/upgrade.js +49 -0
- package/dist/core/format/src/compact.d.ts +30 -0
- package/dist/core/format/src/compact.js +72 -0
- package/dist/core/format/src/index.d.ts +37 -0
- package/dist/core/format/src/index.js +23 -0
- package/dist/core/format/src/integration/index.d.ts +6 -0
- package/dist/core/format/src/integration/index.js +9 -0
- package/dist/core/format/src/json-schema.d.ts +26 -0
- package/dist/core/format/src/json-schema.js +48 -0
- package/dist/core/format/src/kind.d.ts +65 -0
- package/dist/core/format/src/kind.js +1 -0
- package/dist/core/format/src/kinds/agent/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/agent/kind.js +10 -0
- package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +89 -0
- package/dist/core/format/src/kinds/agent/sandbox-fields.js +197 -0
- package/dist/core/format/src/kinds/agent/schema.d.ts +147 -0
- package/dist/core/format/src/kinds/agent/schema.js +107 -0
- package/dist/core/format/src/kinds/agent/working-folder-start.d.ts +74 -0
- package/dist/core/format/src/kinds/agent/working-folder-start.js +312 -0
- package/dist/core/format/src/kinds/collection/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/collection/kind.js +14 -0
- package/dist/core/format/src/kinds/collection/schema.d.ts +89 -0
- package/dist/core/format/src/kinds/collection/schema.js +90 -0
- package/dist/core/format/src/kinds/connector/is-local.d.ts +10 -0
- package/dist/core/format/src/kinds/connector/is-local.js +43 -0
- package/dist/core/format/src/kinds/connector/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/connector/kind.js +119 -0
- package/dist/core/format/src/kinds/connector/schema.d.ts +50 -0
- package/dist/core/format/src/kinds/connector/schema.js +92 -0
- package/dist/core/format/src/kinds/deployments/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/deployments/kind.js +25 -0
- package/dist/core/format/src/kinds/deployments/schema.d.ts +37 -0
- package/dist/core/format/src/kinds/deployments/schema.js +42 -0
- package/dist/core/format/src/kinds/hub/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/hub/kind.js +10 -0
- package/dist/core/format/src/kinds/hub/schema.d.ts +54 -0
- package/dist/core/format/src/kinds/hub/schema.js +34 -0
- package/dist/core/format/src/kinds/integration/kind.d.ts +16 -0
- package/dist/core/format/src/kinds/integration/kind.js +138 -0
- package/dist/core/format/src/kinds/integration/parse-sheet.d.ts +19 -0
- package/dist/core/format/src/kinds/integration/parse-sheet.js +24 -0
- package/dist/core/format/src/kinds/integration/policy.d.ts +67 -0
- package/dist/core/format/src/kinds/integration/policy.js +268 -0
- package/dist/core/format/src/kinds/integration/schema.d.ts +233 -0
- package/dist/core/format/src/kinds/integration/schema.js +233 -0
- package/dist/core/format/src/kinds/knowledge/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/knowledge/kind.js +13 -0
- package/dist/core/format/src/kinds/knowledge/schema.d.ts +18 -0
- package/dist/core/format/src/kinds/knowledge/schema.js +25 -0
- package/dist/core/format/src/kinds/models/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/models/kind.js +10 -0
- package/dist/core/format/src/kinds/models/schema.d.ts +92 -0
- package/dist/core/format/src/kinds/models/schema.js +38 -0
- package/dist/core/format/src/kinds/plugin/backend.d.ts +22 -0
- package/dist/core/format/src/kinds/plugin/backend.js +31 -0
- package/dist/core/format/src/kinds/plugin/checks.d.ts +13 -0
- package/dist/core/format/src/kinds/plugin/checks.js +131 -0
- package/dist/core/format/src/kinds/plugin/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/plugin/kind.js +16 -0
- package/dist/core/format/src/kinds/plugin/problems.d.ts +24 -0
- package/dist/core/format/src/kinds/plugin/problems.js +65 -0
- package/dist/core/format/src/kinds/plugin/schema.d.ts +542 -0
- package/dist/core/format/src/kinds/plugin/schema.js +261 -0
- package/dist/core/format/src/kinds/plugin/setting-values.d.ts +17 -0
- package/dist/core/format/src/kinds/plugin/setting-values.js +38 -0
- package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +8 -0
- package/dist/core/format/src/kinds/plugin/ui-checks.js +94 -0
- package/dist/core/format/src/kinds/provider/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/provider/kind.js +24 -0
- package/dist/core/format/src/kinds/provider/schema.d.ts +17 -0
- package/dist/core/format/src/kinds/provider/schema.js +22 -0
- package/dist/core/format/src/kinds/routine/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/routine/kind.js +25 -0
- package/dist/core/format/src/kinds/routine/schema.d.ts +84 -0
- package/dist/core/format/src/kinds/routine/schema.js +93 -0
- package/dist/core/format/src/kinds/runtime/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/runtime/kind.js +13 -0
- package/dist/core/format/src/kinds/runtime/schema.d.ts +10 -0
- package/dist/core/format/src/kinds/runtime/schema.js +12 -0
- package/dist/core/format/src/kinds/skill/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/skill/kind.js +10 -0
- package/dist/core/format/src/kinds/skill/schema.d.ts +17 -0
- package/dist/core/format/src/kinds/skill/schema.js +17 -0
- package/dist/core/format/src/kinds/skill/scripts-folder.d.ts +27 -0
- package/dist/core/format/src/kinds/skill/scripts-folder.js +37 -0
- package/dist/core/format/src/kinds/workflow/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/workflow/kind.js +14 -0
- package/dist/core/format/src/kinds/workflow/schema.d.ts +162 -0
- package/dist/core/format/src/kinds/workflow/schema.js +106 -0
- package/dist/core/format/src/kinds/workflow-test/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/workflow-test/kind.js +14 -0
- package/dist/core/format/src/kinds/workflow-test/schema.d.ts +67 -0
- package/dist/core/format/src/kinds/workflow-test/schema.js +59 -0
- package/dist/core/format/src/kinds/workspace/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/workspace/kind.js +10 -0
- package/dist/core/format/src/kinds/workspace/schema.d.ts +72 -0
- package/dist/core/format/src/kinds/workspace/schema.js +66 -0
- package/dist/core/format/src/parse-file.d.ts +69 -0
- package/dist/core/format/src/parse-file.js +105 -0
- package/dist/core/format/src/recording/format.d.ts +81 -0
- package/dist/core/format/src/recording/format.js +102 -0
- package/dist/core/format/src/recording/index.d.ts +1 -0
- package/dist/core/format/src/recording/index.js +3 -0
- package/dist/core/format/src/registry.d.ts +64 -0
- package/dist/core/format/src/registry.js +61 -0
- package/dist/core/format/src/reserved.d.ts +20 -0
- package/dist/core/format/src/reserved.js +30 -0
- package/dist/core/format/src/shared/fields.d.ts +37 -0
- package/dist/core/format/src/shared/fields.js +54 -0
- package/dist/core/format/src/shared/guard.d.ts +32 -0
- package/dist/core/format/src/shared/guard.js +16 -0
- package/dist/core/format/src/shared/key-in-value.d.ts +28 -0
- package/dist/core/format/src/shared/key-in-value.js +82 -0
- package/dist/core/format/src/shared/legacy-keys.d.ts +8 -0
- package/dist/core/format/src/shared/legacy-keys.js +17 -0
- package/dist/core/format/src/shared/program-start.d.ts +60 -0
- package/dist/core/format/src/shared/program-start.js +99 -0
- package/dist/core/format/src/shared/relative-path.d.ts +29 -0
- package/dist/core/format/src/shared/relative-path.js +50 -0
- package/dist/core/format/src/shared/secret-name.d.ts +24 -0
- package/dist/core/format/src/shared/secret-name.js +107 -0
- package/dist/core/format/src/source.d.ts +16 -0
- package/dist/core/format/src/source.js +73 -0
- package/dist/core/ports/src/agent-placement-store.d.ts +74 -0
- package/dist/core/ports/src/agent-placement-store.js +27 -0
- package/dist/core/ports/src/blob-store.d.ts +33 -0
- package/dist/core/ports/src/blob-store.js +2 -0
- package/dist/core/ports/src/cant-try-error.d.ts +35 -0
- package/dist/core/ports/src/cant-try-error.js +44 -0
- package/dist/core/ports/src/chat.d.ts +127 -0
- package/dist/core/ports/src/chat.js +1 -0
- package/dist/core/ports/src/clock.d.ts +7 -0
- package/dist/core/ports/src/clock.js +2 -0
- package/dist/core/ports/src/connection-settings-store.d.ts +57 -0
- package/dist/core/ports/src/connection-settings-store.js +2 -0
- package/dist/core/ports/src/connector-client.d.ts +259 -0
- package/dist/core/ports/src/connector-client.js +2 -0
- package/dist/core/ports/src/coordination.d.ts +84 -0
- package/dist/core/ports/src/coordination.js +2 -0
- package/dist/core/ports/src/definition-store.d.ts +208 -0
- package/dist/core/ports/src/definition-store.js +122 -0
- package/dist/core/ports/src/digest.d.ts +14 -0
- package/dist/core/ports/src/digest.js +2 -0
- package/dist/core/ports/src/folder-reader.d.ts +89 -0
- package/dist/core/ports/src/folder-reader.js +2 -0
- package/dist/core/ports/src/harness-bridge-server.d.ts +189 -0
- package/dist/core/ports/src/harness-bridge-server.js +37 -0
- package/dist/core/ports/src/harness.d.ts +250 -0
- package/dist/core/ports/src/harness.js +45 -0
- package/dist/core/ports/src/http-client.d.ts +27 -0
- package/dist/core/ports/src/http-client.js +2 -0
- package/dist/core/ports/src/id-generator.d.ts +14 -0
- package/dist/core/ports/src/id-generator.js +2 -0
- package/dist/core/ports/src/index.d.ts +37 -0
- package/dist/core/ports/src/index.js +36 -0
- package/dist/core/ports/src/integration.d.ts +178 -0
- package/dist/core/ports/src/integration.js +13 -0
- package/dist/core/ports/src/knowledge-provider.d.ts +65 -0
- package/dist/core/ports/src/knowledge-provider.js +2 -0
- package/dist/core/ports/src/llm-cache.d.ts +13 -0
- package/dist/core/ports/src/llm-cache.js +2 -0
- package/dist/core/ports/src/llm-provider.d.ts +184 -0
- package/dist/core/ports/src/llm-provider.js +136 -0
- package/dist/core/ports/src/model-price.d.ts +34 -0
- package/dist/core/ports/src/model-price.js +25 -0
- package/dist/core/ports/src/password-hasher.d.ts +47 -0
- package/dist/core/ports/src/password-hasher.js +2 -0
- package/dist/core/ports/src/plugin-folder-writer.d.ts +104 -0
- package/dist/core/ports/src/plugin-folder-writer.js +95 -0
- package/dist/core/ports/src/port-versions.d.ts +44 -0
- package/dist/core/ports/src/port-versions.js +74 -0
- package/dist/core/ports/src/program-probe.d.ts +46 -0
- package/dist/core/ports/src/program-probe.js +2 -0
- package/dist/core/ports/src/record-store.d.ts +62 -0
- package/dist/core/ports/src/record-store.js +38 -0
- package/dist/core/ports/src/resource-probe.d.ts +59 -0
- package/dist/core/ports/src/resource-probe.js +2 -0
- package/dist/core/ports/src/run-executor.d.ts +302 -0
- package/dist/core/ports/src/run-executor.js +2 -0
- package/dist/core/ports/src/run-failure-error.d.ts +49 -0
- package/dist/core/ports/src/run-failure-error.js +47 -0
- package/dist/core/ports/src/run-store.d.ts +194 -0
- package/dist/core/ports/src/run-store.js +131 -0
- package/dist/core/ports/src/sandbox.d.ts +247 -0
- package/dist/core/ports/src/sandbox.js +34 -0
- package/dist/core/ports/src/scheduler.d.ts +85 -0
- package/dist/core/ports/src/scheduler.js +2 -0
- package/dist/core/ports/src/secrets.d.ts +128 -0
- package/dist/core/ports/src/secrets.js +144 -0
- package/dist/core/ports/src/token-store.d.ts +19 -0
- package/dist/core/ports/src/token-store.js +2 -0
- package/dist/core/ports/src/tool-approval-store.d.ts +211 -0
- package/dist/core/ports/src/tool-approval-store.js +57 -0
- package/dist/core/ports/src/trust-store.d.ts +72 -0
- package/dist/core/ports/src/trust-store.js +2 -0
- package/dist/core/ports/src/unfenced-run-consent-store.d.ts +43 -0
- package/dist/core/ports/src/unfenced-run-consent-store.js +2 -0
- package/dist/core/ports/src/vcs.d.ts +394 -0
- package/dist/core/ports/src/vcs.js +48 -0
- package/dist/core/schema-kit/src/builders.d.ts +50 -0
- package/dist/core/schema-kit/src/builders.js +72 -0
- package/dist/core/schema-kit/src/depth.d.ts +15 -0
- package/dist/core/schema-kit/src/depth.js +37 -0
- package/dist/core/schema-kit/src/index.d.ts +6 -0
- package/dist/core/schema-kit/src/index.js +6 -0
- package/dist/core/schema-kit/src/issue.d.ts +22 -0
- package/dist/core/schema-kit/src/issue.js +23 -0
- package/dist/core/schema-kit/src/json-schema.d.ts +23 -0
- package/dist/core/schema-kit/src/json-schema.js +22 -0
- package/dist/core/schema-kit/src/parse.d.ts +17 -0
- package/dist/core/schema-kit/src/parse.js +25 -0
- package/dist/core/schema-kit/src/schema.d.ts +12 -0
- package/dist/core/schema-kit/src/schema.js +1 -0
- package/dist/core/std/src/ascii-host.d.ts +18 -0
- package/dist/core/std/src/ascii-host.js +110 -0
- package/dist/core/std/src/assert.d.ts +39 -0
- package/dist/core/std/src/assert.js +59 -0
- package/dist/core/std/src/base64url.d.ts +23 -0
- package/dist/core/std/src/base64url.js +65 -0
- package/dist/core/std/src/canonical-json.d.ts +18 -0
- package/dist/core/std/src/canonical-json.js +56 -0
- package/dist/core/std/src/clock.d.ts +27 -0
- package/dist/core/std/src/clock.js +33 -0
- package/dist/core/std/src/constant-time.d.ts +16 -0
- package/dist/core/std/src/constant-time.js +26 -0
- package/dist/core/std/src/content-digest.d.ts +24 -0
- package/dist/core/std/src/content-digest.js +28 -0
- package/dist/core/std/src/deep-clone.d.ts +15 -0
- package/dist/core/std/src/deep-clone.js +59 -0
- package/dist/core/std/src/deep-equal.d.ts +23 -0
- package/dist/core/std/src/deep-equal.js +64 -0
- package/dist/core/std/src/emitter.d.ts +42 -0
- package/dist/core/std/src/emitter.js +74 -0
- package/dist/core/std/src/error-kind.d.ts +88 -0
- package/dist/core/std/src/error-kind.js +98 -0
- package/dist/core/std/src/hex.d.ts +10 -0
- package/dist/core/std/src/hex.js +16 -0
- package/dist/core/std/src/ids.d.ts +45 -0
- package/dist/core/std/src/ids.js +49 -0
- package/dist/core/std/src/index.d.ts +25 -0
- package/dist/core/std/src/index.js +26 -0
- package/dist/core/std/src/keyed-queue.d.ts +18 -0
- package/dist/core/std/src/keyed-queue.js +32 -0
- package/dist/core/std/src/line-diff.d.ts +83 -0
- package/dist/core/std/src/line-diff.js +179 -0
- package/dist/core/std/src/line-merge.d.ts +63 -0
- package/dist/core/std/src/line-merge.js +138 -0
- package/dist/core/std/src/plain-data.d.ts +32 -0
- package/dist/core/std/src/plain-data.js +57 -0
- package/dist/core/std/src/posix-path.d.ts +61 -0
- package/dist/core/std/src/posix-path.js +121 -0
- package/dist/core/std/src/result.d.ts +55 -0
- package/dist/core/std/src/result.js +52 -0
- package/dist/core/std/src/secret-scrubber.d.ts +54 -0
- package/dist/core/std/src/secret-scrubber.js +124 -0
- package/dist/core/std/src/secret-shape.d.ts +20 -0
- package/dist/core/std/src/secret-shape.js +53 -0
- package/dist/core/std/src/stop-signal.d.ts +44 -0
- package/dist/core/std/src/stop-signal.js +77 -0
- package/dist/core/std/src/text.d.ts +28 -0
- package/dist/core/std/src/text.js +54 -0
- package/dist/core/std/src/utf8.d.ts +23 -0
- package/dist/core/std/src/utf8.js +110 -0
- package/dist/core/std/src/version.d.ts +48 -0
- package/dist/core/std/src/version.js +103 -0
- package/dist/core/yaml/src/depth.d.ts +14 -0
- package/dist/core/yaml/src/depth.js +140 -0
- package/dist/core/yaml/src/edit-data.d.ts +47 -0
- package/dist/core/yaml/src/edit-data.js +286 -0
- package/dist/core/yaml/src/edit-text.d.ts +92 -0
- package/dist/core/yaml/src/edit-text.js +267 -0
- package/dist/core/yaml/src/edit.d.ts +47 -0
- package/dist/core/yaml/src/edit.js +198 -0
- package/dist/core/yaml/src/index.d.ts +5 -0
- package/dist/core/yaml/src/index.js +4 -0
- package/dist/core/yaml/src/problem.d.ts +20 -0
- package/dist/core/yaml/src/problem.js +1 -0
- package/dist/core/yaml/src/read.d.ts +47 -0
- package/dist/core/yaml/src/read.js +130 -0
- package/dist/core/yaml/src/splice-node.d.ts +47 -0
- package/dist/core/yaml/src/splice-node.js +333 -0
- package/dist/core/yaml/src/splice.d.ts +13 -0
- package/dist/core/yaml/src/splice.js +174 -0
- package/dist/core/yaml/src/unsupported.d.ts +26 -0
- package/dist/core/yaml/src/unsupported.js +70 -0
- package/dist/core/yaml/src/write.d.ts +35 -0
- package/dist/core/yaml/src/write.js +44 -0
- package/dist/testing/integration/src/canaries.d.ts +14 -0
- package/dist/testing/integration/src/canaries.js +17 -0
- package/dist/testing/integration/src/checks.d.ts +37 -0
- package/dist/testing/integration/src/checks.js +195 -0
- package/dist/testing/integration/src/describe.d.ts +35 -0
- package/dist/testing/integration/src/describe.js +74 -0
- package/dist/testing/integration/src/failure.d.ts +6 -0
- package/dist/testing/integration/src/failure.js +8 -0
- package/dist/testing/integration/src/fake-wait.d.ts +18 -0
- package/dist/testing/integration/src/fake-wait.js +21 -0
- package/dist/testing/integration/src/index.d.ts +10 -0
- package/dist/testing/integration/src/index.js +11 -0
- package/dist/testing/integration/src/load.d.ts +14 -0
- package/dist/testing/integration/src/load.js +45 -0
- package/dist/testing/integration/src/plugin-folder.d.ts +23 -0
- package/dist/testing/integration/src/plugin-folder.js +59 -0
- package/dist/testing/integration/src/plugin.d.ts +32 -0
- package/dist/testing/integration/src/plugin.js +57 -0
- package/dist/testing/integration/src/recording.d.ts +84 -0
- package/dist/testing/integration/src/recording.js +164 -0
- package/dist/testing/integration/src/run.d.ts +60 -0
- package/dist/testing/integration/src/run.js +81 -0
- package/dist/testing/integration/src/source-scan.d.ts +16 -0
- package/dist/testing/integration/src/source-scan.js +40 -0
- package/package.json +35 -4
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Version of the {@link RecordStore} port. A breaking change bumps it and comes with an ADR. */
|
|
2
|
+
export declare const recordStoreVersion = 2;
|
|
3
|
+
/** One change to a record in a collection. The current records are the log folded up. */
|
|
4
|
+
export interface RecordChange {
|
|
5
|
+
at: string;
|
|
6
|
+
collection: string;
|
|
7
|
+
id: string;
|
|
8
|
+
op: "add" | "update" | "remove" | "seed";
|
|
9
|
+
/** add, seed: all values; update: only the changed ones; remove: null. */
|
|
10
|
+
values: Record<string, unknown> | null;
|
|
11
|
+
/** The run (and agent) or person that made the change. */
|
|
12
|
+
by?: {
|
|
13
|
+
runId?: string;
|
|
14
|
+
agent?: string;
|
|
15
|
+
person?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The data in collections, kept as a log of changes per collection and never
|
|
20
|
+
* in git. Collection names are values, never table or file names chosen by
|
|
21
|
+
* the caller.
|
|
22
|
+
*/
|
|
23
|
+
export interface RecordStore {
|
|
24
|
+
/** Appends changes, in order. Changes to several collections may come in one call. */
|
|
25
|
+
append(changes: readonly RecordChange[]): Promise<void>;
|
|
26
|
+
/** Every change to a collection, oldest first. Empty for an unknown collection. */
|
|
27
|
+
changes(collection: string): Promise<RecordChange[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Replaces a collection's log with its current records, so overwritten and
|
|
30
|
+
* removed values leave the storage. Afterwards {@link changes} gives one
|
|
31
|
+
* `seed` per current record, with the values {@link foldRecords} gives, the
|
|
32
|
+
* `at` of the record's last change and no `by`. Other collections stay as
|
|
33
|
+
* they are; an unknown or empty collection stays empty.
|
|
34
|
+
*
|
|
35
|
+
* A change appended while a compact runs is either folded into the seeds
|
|
36
|
+
* or kept after them, never lost; for example, read, fold and replace in
|
|
37
|
+
* one transaction or under the store's write lock.
|
|
38
|
+
*/
|
|
39
|
+
compact(collection: string): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/** A record as its changes leave it: its current values and the time of its last change. */
|
|
42
|
+
export interface CurrentRecord {
|
|
43
|
+
values: Record<string, unknown>;
|
|
44
|
+
at: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Folds changes, oldest first, into the current records by id. `add` and
|
|
48
|
+
* `seed` set all values, `update` merges its values into the record's, and
|
|
49
|
+
* `remove` drops the record. Every reader of a {@link RecordStore} and every
|
|
50
|
+
* {@link RecordStore.compact} folds this way.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* const leads = foldRecords(await records.changes("leads"));
|
|
54
|
+
* leads.get("1")?.values; // { name: "Ada L." }
|
|
55
|
+
*/
|
|
56
|
+
export declare function foldRecords(changes: readonly RecordChange[]): Map<string, CurrentRecord>;
|
|
57
|
+
/**
|
|
58
|
+
* What a collection's changes become when it is compacted: one `seed` per
|
|
59
|
+
* current record, with its folded values, the `at` of its last change and
|
|
60
|
+
* no `by`. Adapters write this in place of the collection's log.
|
|
61
|
+
*/
|
|
62
|
+
export declare function compactedChanges(collection: string, changes: readonly RecordChange[]): RecordChange[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Version of the {@link RecordStore} port. A breaking change bumps it and comes with an ADR. */
|
|
2
|
+
export const recordStoreVersion = 2;
|
|
3
|
+
/**
|
|
4
|
+
* Folds changes, oldest first, into the current records by id. `add` and
|
|
5
|
+
* `seed` set all values, `update` merges its values into the record's, and
|
|
6
|
+
* `remove` drops the record. Every reader of a {@link RecordStore} and every
|
|
7
|
+
* {@link RecordStore.compact} folds this way.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const leads = foldRecords(await records.changes("leads"));
|
|
11
|
+
* leads.get("1")?.values; // { name: "Ada L." }
|
|
12
|
+
*/
|
|
13
|
+
export function foldRecords(changes) {
|
|
14
|
+
const records = new Map();
|
|
15
|
+
for (const change of changes) {
|
|
16
|
+
if (change.op === "remove") {
|
|
17
|
+
records.delete(change.id);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const earlier = change.op === "update" ? records.get(change.id)?.values : undefined;
|
|
21
|
+
records.set(change.id, { values: { ...earlier, ...change.values }, at: change.at });
|
|
22
|
+
}
|
|
23
|
+
return records;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* What a collection's changes become when it is compacted: one `seed` per
|
|
27
|
+
* current record, with its folded values, the `at` of its last change and
|
|
28
|
+
* no `by`. Adapters write this in place of the collection's log.
|
|
29
|
+
*/
|
|
30
|
+
export function compactedChanges(collection, changes) {
|
|
31
|
+
return [...foldRecords(changes)].map(([id, record]) => ({
|
|
32
|
+
at: record.at,
|
|
33
|
+
collection,
|
|
34
|
+
id,
|
|
35
|
+
op: "seed",
|
|
36
|
+
values: record.values,
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Version of the {@link ResourceProbe} port. A breaking change bumps it and comes with an ADR. */
|
|
2
|
+
export declare const resourceProbeVersion = 1;
|
|
3
|
+
/** One process the engine started, such as a harness, a sandbox or an MCP server. */
|
|
4
|
+
export interface ProcessUsage {
|
|
5
|
+
/** The operating system's process id. */
|
|
6
|
+
readonly pid: number;
|
|
7
|
+
/** The program's name, such as "claude", without its folder. */
|
|
8
|
+
readonly name: string;
|
|
9
|
+
/** The memory the process holds now (its resident set), in bytes. */
|
|
10
|
+
readonly memoryBytes: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* How much disk space a folder's files take. `complete` is `false` when the
|
|
14
|
+
* adapter stopped counting at its limit, so `bytes` is a lower bound.
|
|
15
|
+
*/
|
|
16
|
+
export interface FolderSize {
|
|
17
|
+
readonly bytes: number;
|
|
18
|
+
readonly complete: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reads what the engine uses on this machine: memory, the processes it
|
|
22
|
+
* started and disk space (failure-path guide, rule 3; requirement
|
|
23
|
+
* `ports.resource-probe`). `ResourceReport` in `core/app` puts the numbers
|
|
24
|
+
* together for `halonic doctor` and the Studio.
|
|
25
|
+
*
|
|
26
|
+
* Every method reads the machine once, when it's called; nothing here polls
|
|
27
|
+
* or keeps a timer. All numbers are whole, non-negative bytes.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const free = await probe.freeDisk(dataFolder);
|
|
31
|
+
* if (free < 1024 ** 3) warnings.push("low-disk");
|
|
32
|
+
*/
|
|
33
|
+
export interface ResourceProbe {
|
|
34
|
+
/** The engine process's own memory (its resident set), in bytes. */
|
|
35
|
+
engineMemory(): Promise<number>;
|
|
36
|
+
/**
|
|
37
|
+
* Every process below the engine's own process, children and their
|
|
38
|
+
* children, in ascending `pid` order. Processes that end while they're
|
|
39
|
+
* being read are left out.
|
|
40
|
+
*/
|
|
41
|
+
childProcesses(): Promise<readonly ProcessUsage[]>;
|
|
42
|
+
/**
|
|
43
|
+
* The sizes of the files in the folder at `path` and in the folders below
|
|
44
|
+
* it: the bytes they hold, not the blocks the drive sets aside. Symbolic
|
|
45
|
+
* links aren't followed, so a link out of the folder adds nothing. A path
|
|
46
|
+
* where nothing is gives 0 bytes, complete.
|
|
47
|
+
*
|
|
48
|
+
* @param path - an absolute path
|
|
49
|
+
*/
|
|
50
|
+
folderSize(path: string): Promise<FolderSize>;
|
|
51
|
+
/**
|
|
52
|
+
* The free space a program without special rights can use on the drive
|
|
53
|
+
* that holds `path`, in bytes. When nothing is at `path` yet, the drive of
|
|
54
|
+
* its nearest existing parent folder.
|
|
55
|
+
*
|
|
56
|
+
* @param path - an absolute path
|
|
57
|
+
*/
|
|
58
|
+
freeDisk(path: string): Promise<number>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import type { CantTryStep, ModelSkipReason, RunEvent, RunKind, RunSummary, RunTrigger, RunVersion } from "../../events/src/index.js";
|
|
2
|
+
import type { ChatMessage, ChatParams, ChatResponse, ToolDefinition } from "./chat.js";
|
|
3
|
+
/** Version of the {@link RunExecutor} port. A breaking change bumps it and comes with an ADR. */
|
|
4
|
+
export declare const runExecutorVersion = 1;
|
|
5
|
+
/**
|
|
6
|
+
* Start a workflow run. Subflows are not started through this port: the
|
|
7
|
+
* engine starts them inside the executor, which also tells the parent when a
|
|
8
|
+
* child finishes.
|
|
9
|
+
*/
|
|
10
|
+
export interface StartRunRequest {
|
|
11
|
+
hubId: string;
|
|
12
|
+
workflowId: string;
|
|
13
|
+
input: Record<string, unknown>;
|
|
14
|
+
kind?: RunKind;
|
|
15
|
+
trigger?: RunTrigger;
|
|
16
|
+
/**
|
|
17
|
+
* The harness every task agent of the run runs in, whatever its file
|
|
18
|
+
* names, such as `codex`; `halonic` runs them all in Halonic's own loop.
|
|
19
|
+
* Its child runs use it too. Each agent's own harness when absent. An id
|
|
20
|
+
* that isn't a harness is refused before anything is recorded. Whether
|
|
21
|
+
* the harness is installed is the caller's check (`detect()`).
|
|
22
|
+
*/
|
|
23
|
+
harness?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The steps of a Try it or Test run that can't be tried, as found when the
|
|
26
|
+
* caller loaded the run's item: each `step` names a state of the run's
|
|
27
|
+
* workflow, or is `null` when the whole item can't be tried. They go on
|
|
28
|
+
* `run.started`, and the run never runs them. None when absent.
|
|
29
|
+
*/
|
|
30
|
+
cantTry?: readonly CantTryStep[];
|
|
31
|
+
/**
|
|
32
|
+
* Which version of the workspace the run reads, as the caller loaded it:
|
|
33
|
+
* the live version, with its commit and date, or the saved files. It goes
|
|
34
|
+
* on `run.started`, and the run's child runs record it too. Not recorded
|
|
35
|
+
* when absent. The executor doesn't check it against `definitionsOf`, so
|
|
36
|
+
* the caller passes the version of the files it gives the run.
|
|
37
|
+
*/
|
|
38
|
+
version?: RunVersion;
|
|
39
|
+
/**
|
|
40
|
+
* The id the run gets, for a start that may be repeated: a routine fire, a
|
|
41
|
+
* mail or a signal. When a run with this id already exists, `start` returns
|
|
42
|
+
* its summary and starts nothing, whatever the rest of the request says.
|
|
43
|
+
* A new id from the executor's `IdGenerator` when absent. At most 256
|
|
44
|
+
* UTF-8 bytes, because it becomes a `Scheduler` key; a longer one
|
|
45
|
+
* is refused with a `RangeError` before anything is recorded.
|
|
46
|
+
*/
|
|
47
|
+
runId?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Start a run of a single agent with a prompt. */
|
|
50
|
+
export interface StartAgentRequest {
|
|
51
|
+
hubId: string;
|
|
52
|
+
agentId: string;
|
|
53
|
+
prompt: string;
|
|
54
|
+
/**
|
|
55
|
+
* What started the run, as for a workflow run. A routine that runs one
|
|
56
|
+
* agent sets it, so the routine can find its own runs again (last run,
|
|
57
|
+
* overlap). The old local engine accepted it too.
|
|
58
|
+
*/
|
|
59
|
+
trigger?: RunTrigger;
|
|
60
|
+
/**
|
|
61
|
+
* As {@link StartRunRequest.runId}: repeating a start with the same id
|
|
62
|
+
* starts nothing, and an id over 256 UTF-8 bytes is a `RangeError`.
|
|
63
|
+
*/
|
|
64
|
+
runId?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Options for {@link RunExecutor.send}. */
|
|
67
|
+
export interface SendOptions {
|
|
68
|
+
/**
|
|
69
|
+
* The tool call the event is meant for, such as the one a person approves,
|
|
70
|
+
* as the run's summary names it. When it is given and the run doesn't wait
|
|
71
|
+
* on that call, `send` is refused before anything is recorded: a person
|
|
72
|
+
* who answered an approval that has since moved on must not approve the
|
|
73
|
+
* next one by accident. Absent: no check.
|
|
74
|
+
*/
|
|
75
|
+
readonly callId?: string;
|
|
76
|
+
}
|
|
77
|
+
/** An agent's model settings for a chat turn that aren't saved in a file yet. */
|
|
78
|
+
export interface ChatAgentSettings {
|
|
79
|
+
/** The provider adapter type, such as "openai". */
|
|
80
|
+
type: string;
|
|
81
|
+
/** The model name at that provider. */
|
|
82
|
+
model: string;
|
|
83
|
+
/** The provider's address, when it isn't the adapter's default. */
|
|
84
|
+
baseUrl?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The **name** of the secret that holds the API key, never the key itself.
|
|
87
|
+
* This travels over the wire to a remote host, which looks the name up.
|
|
88
|
+
*/
|
|
89
|
+
secret?: string;
|
|
90
|
+
/** Whether the model runs on this machine (such as Ollama), so it has no price. */
|
|
91
|
+
local: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** One model turn for a chat outside any run (agent chat, the Build assistant, inbox conversations). */
|
|
94
|
+
export interface ChatTurnRequest {
|
|
95
|
+
hubId: string;
|
|
96
|
+
/** The model alias to use; the workspace default when absent. */
|
|
97
|
+
alias?: string;
|
|
98
|
+
messages: ChatMessage[];
|
|
99
|
+
tools: ToolDefinition[];
|
|
100
|
+
/** The agent whose settings and prompt apply, if any. */
|
|
101
|
+
agentId?: string;
|
|
102
|
+
params?: ChatParams;
|
|
103
|
+
/** Unsaved model settings from the agent editor; they win over the saved ones. */
|
|
104
|
+
agent?: ChatAgentSettings;
|
|
105
|
+
/**
|
|
106
|
+
* Aborted when the person stops the chat. An executor that honors it stops
|
|
107
|
+
* the model call and rejects; a remote one also stops waiting for the host.
|
|
108
|
+
* It is never sent over the wire. Optional, so an executor that ignores it
|
|
109
|
+
* still satisfies the port: the caller then drops an answer that comes
|
|
110
|
+
* after the abort.
|
|
111
|
+
*/
|
|
112
|
+
signal?: AbortSignal;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Something a chat turn refused, as data a status view can read. It mirrors
|
|
116
|
+
* `ToolRefusal` from `core/app`, which this package can't import, and adds
|
|
117
|
+
* `call`. `listing`, `tool` and `keyword` are refusals of what a source
|
|
118
|
+
* listed; they never go to the model. `call` is a tool call that didn't run:
|
|
119
|
+
* the check refused it, it named a tool nobody offered, or the turn hit its
|
|
120
|
+
* round limit first.
|
|
121
|
+
*/
|
|
122
|
+
export interface ChatTurnRefusal {
|
|
123
|
+
/** The id of the tool's source: a connector or integration, or "halonic" for Halonic's own tools. */
|
|
124
|
+
source: string;
|
|
125
|
+
/** The tool's name; left out when a whole listing is refused. */
|
|
126
|
+
name?: string;
|
|
127
|
+
refused: "listing" | "tool" | "keyword" | "call";
|
|
128
|
+
/** Why, as plain text. Text a server wrote is cut and escaped before it gets here. */
|
|
129
|
+
reason: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A model alias a chat turn skipped before calling it. It is what an
|
|
133
|
+
* `llm.skipped` run log event says, for a turn that has no run log.
|
|
134
|
+
*/
|
|
135
|
+
export interface ChatTurnSkip {
|
|
136
|
+
/** The skipped alias, such as "smart". */
|
|
137
|
+
alias: string;
|
|
138
|
+
provider: string;
|
|
139
|
+
model: string;
|
|
140
|
+
reason: ModelSkipReason;
|
|
141
|
+
/** The alias tried instead; absent when none was left. */
|
|
142
|
+
next?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The model's answer to a {@link ChatTurnRequest}, with the model that gave it.
|
|
146
|
+
* `content`, `toolCalls` and `finishReason` are those of the turn's last
|
|
147
|
+
* answer; `usage` adds up every model call in the turn.
|
|
148
|
+
*/
|
|
149
|
+
export interface ChatTurnResponse extends ChatResponse {
|
|
150
|
+
model: string;
|
|
151
|
+
/**
|
|
152
|
+
* Every assistant and tool message the turn added, in order, so the
|
|
153
|
+
* caller can keep the conversation by appending them. It ends with the
|
|
154
|
+
* last answer, or, when the turn ends on the caller's tool calls, with the
|
|
155
|
+
* results of the calls the executor ran from that answer; the caller then
|
|
156
|
+
* adds one tool message for each call in `toolCalls`. Absent
|
|
157
|
+
* from an executor that doesn't report it; the caller then appends the
|
|
158
|
+
* answer itself.
|
|
159
|
+
*/
|
|
160
|
+
turn?: ChatMessage[];
|
|
161
|
+
/** What the turn refused, in the order it happened. Absent or empty when it refused nothing. */
|
|
162
|
+
refusals?: ChatTurnRefusal[];
|
|
163
|
+
/** The model aliases skipped before any call, in order. Absent or empty when none was. */
|
|
164
|
+
skipped?: ChatTurnSkip[];
|
|
165
|
+
}
|
|
166
|
+
/** Receives a run's events from {@link RunExecutor.subscribe}. */
|
|
167
|
+
export interface RunEventListener {
|
|
168
|
+
/** One durable event, in order and without gaps. */
|
|
169
|
+
onEvent(event: RunEvent): void;
|
|
170
|
+
/**
|
|
171
|
+
* The stream ended, once and for good. Without an error: the run ended and
|
|
172
|
+
* every event was delivered. With an error: the stream broke (such as a
|
|
173
|
+
* dropped connection), and the caller subscribes again after the last
|
|
174
|
+
* `seq` it saw. Not called when the caller closes the subscription.
|
|
175
|
+
*/
|
|
176
|
+
onClose(error?: Error): void;
|
|
177
|
+
}
|
|
178
|
+
/** An open subscription. Closing it twice is not an error. */
|
|
179
|
+
export interface RunSubscription {
|
|
180
|
+
close(): void;
|
|
181
|
+
}
|
|
182
|
+
/** Whether the engine behind a {@link RunExecutor} can be reached. */
|
|
183
|
+
export type EngineConnectionState = "connected" | "lost";
|
|
184
|
+
/**
|
|
185
|
+
* The engine connection of an executor that can lose it, such as the remote
|
|
186
|
+
* one in served mode or on a phone connected to a host. A broken run stream
|
|
187
|
+
* only tells its own subscriber; this tells everyone that the engine as a
|
|
188
|
+
* whole is gone, and when it is back.
|
|
189
|
+
*/
|
|
190
|
+
export interface EngineConnection {
|
|
191
|
+
/** The state now. */
|
|
192
|
+
readonly state: EngineConnectionState;
|
|
193
|
+
/**
|
|
194
|
+
* Calls `listener` on each change of state: never twice in a row with the
|
|
195
|
+
* same state, and never before `onChange` returns. Returns a function that
|
|
196
|
+
* stops it; calling that twice is not an error.
|
|
197
|
+
*
|
|
198
|
+
* A listener may throw, as the shell re-throws its features' errors. The
|
|
199
|
+
* executor catches that inside its own loop, reports it and carries on,
|
|
200
|
+
* so one faulty feature can't break its reconnect handling.
|
|
201
|
+
*/
|
|
202
|
+
onChange(listener: (state: EngineConnectionState) => void): () => void;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Where runs execute. Replaces the old `Runtime` and `RunHost` ports: the
|
|
206
|
+
* local implementation runs the engine in this process, the remote
|
|
207
|
+
* one forwards to a host such as `halonic serve` or a Worker. It is chosen
|
|
208
|
+
* once at start-up, so no caller asks "local or remote?".
|
|
209
|
+
*
|
|
210
|
+
* A run advances one step per call, from timers, so
|
|
211
|
+
* `start` and `send` return once the input is recorded. The summary they
|
|
212
|
+
* return may still be "running"; follow progress with `subscribe`.
|
|
213
|
+
*/
|
|
214
|
+
export interface RunExecutor {
|
|
215
|
+
/** Identifies the implementation, such as "local" or "remote". */
|
|
216
|
+
readonly id: string;
|
|
217
|
+
/**
|
|
218
|
+
* Starts a workflow run, or returns the existing one for a repeated `runId`.
|
|
219
|
+
*
|
|
220
|
+
* @throws when the hub or workflow doesn't exist or the input is refused
|
|
221
|
+
*/
|
|
222
|
+
start(request: StartRunRequest): Promise<RunSummary>;
|
|
223
|
+
/**
|
|
224
|
+
* Starts a run of one agent; its workflow id is "agent:<agentId>". A
|
|
225
|
+
* repeated `runId` returns the existing run.
|
|
226
|
+
*
|
|
227
|
+
* @throws when the hub or agent doesn't exist
|
|
228
|
+
*/
|
|
229
|
+
startAgent(request: StartAgentRequest): Promise<RunSummary>;
|
|
230
|
+
/**
|
|
231
|
+
* Delivers an event to a waiting run, such as "approve".
|
|
232
|
+
*
|
|
233
|
+
* @throws when the run doesn't exist, doesn't accept the event now, or
|
|
234
|
+
* doesn't wait on the call that `options.callId` names
|
|
235
|
+
*/
|
|
236
|
+
send(runId: string, event: string, payload?: unknown, options?: SendOptions): Promise<RunSummary>;
|
|
237
|
+
/**
|
|
238
|
+
* Streams a run's durable events: first the stored ones after `afterSeq`,
|
|
239
|
+
* then new ones as they are appended, until the run ends or the stream
|
|
240
|
+
* breaks (see {@link RunEventListener.onClose}). A client that reconnects
|
|
241
|
+
* passes the last sequence number it saw.
|
|
242
|
+
*
|
|
243
|
+
* It returns at once and never throws for the run itself, because a
|
|
244
|
+
* remote executor only learns later whether the run exists: an unknown
|
|
245
|
+
* run gets `onClose(error)`. The listener is never called before
|
|
246
|
+
* `subscribe` returns, so the caller always holds the handle it may
|
|
247
|
+
* need to `close()`.
|
|
248
|
+
*/
|
|
249
|
+
subscribe(runId: string, afterSeq: number, listener: RunEventListener): RunSubscription;
|
|
250
|
+
/**
|
|
251
|
+
* Cancels a run that hasn't ended, as Ctrl C or a Stop button asks: it
|
|
252
|
+
* ends with `run.failed` and `reason: "cancelled"`, and so does the child
|
|
253
|
+
* run it waits on. A run that waits ends too. What the run was doing
|
|
254
|
+
* stops where the executor can stop it; anything it still finishes is
|
|
255
|
+
* recorded nowhere. A run that has already ended is left as it is, so a
|
|
256
|
+
* cancel that comes just after the end is not an error.
|
|
257
|
+
*
|
|
258
|
+
* A remote executor forwards it to the host. Optional, so the port keeps
|
|
259
|
+
* version 1, as for `connection`: a caller without it can only stop
|
|
260
|
+
* following the run.
|
|
261
|
+
*
|
|
262
|
+
* @returns the run's summary after the cancel
|
|
263
|
+
* @throws when the run doesn't exist
|
|
264
|
+
*/
|
|
265
|
+
cancel?(runId: string): Promise<RunSummary>;
|
|
266
|
+
/**
|
|
267
|
+
* One chat turn outside any run. Served mode forwards it to the host,
|
|
268
|
+
* which has the provider keys, like a run. `request.signal` may cancel it.
|
|
269
|
+
*
|
|
270
|
+
* A turn may take several model calls. The executor offers the model the
|
|
271
|
+
* caller's `request.tools`, Halonic's own tools and the tools the
|
|
272
|
+
* connected servers list, in that order; when two have the same name, the
|
|
273
|
+
* first is kept and the later one refused. It runs the calls to Halonic's
|
|
274
|
+
* and the servers' tools itself and asks the model again, until the model
|
|
275
|
+
* answers without such calls or the round limit is hit. The messages
|
|
276
|
+
* this adds come back in `turn`.
|
|
277
|
+
*
|
|
278
|
+
* The caller's tools run on the caller's side: when the model calls one,
|
|
279
|
+
* the turn ends with `finishReason: "tool_calls"` and only those calls in
|
|
280
|
+
* `toolCalls`. Calls to the executor's tools in the same answer have
|
|
281
|
+
* already run, and their results are in `turn`. At the round limit the
|
|
282
|
+
* turn ends with `finishReason: "length"` and no calls; the calls the
|
|
283
|
+
* model still asked for are dropped and refused. Anything refused along
|
|
284
|
+
* the way (a listing, a tool, a call) is in `refusals`; a refused call
|
|
285
|
+
* also goes back to the model as that call's result. A tool that throws
|
|
286
|
+
* gives the model an error result, not the caller an error. Nothing
|
|
287
|
+
* outside a run can wait for a person, so a call that needs approval is
|
|
288
|
+
* refused here. A model alias skipped before any call, such as one whose
|
|
289
|
+
* provider has no key, is in `skipped`.
|
|
290
|
+
*
|
|
291
|
+
* @throws when the model can't be reached or refuses the call, or when
|
|
292
|
+
* `request.signal` is aborted and the executor honors it
|
|
293
|
+
*/
|
|
294
|
+
chatTurn(request: ChatTurnRequest): Promise<ChatTurnResponse>;
|
|
295
|
+
/**
|
|
296
|
+
* The connection to the engine, for an executor that can lose it. The
|
|
297
|
+
* remote executor sets it from its streams and retries. Absent means
|
|
298
|
+
* always connected: the local executor's engine runs in this process.
|
|
299
|
+
* Optional, so callers check for it and the port keeps version 1.
|
|
300
|
+
*/
|
|
301
|
+
readonly connection?: EngineConnection;
|
|
302
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Every failure a {@link RunFailureError} can name, in {@link AdapterFailure} order. */
|
|
2
|
+
export declare const adapterFailures: readonly ["disk-full", "sandbox-start-failed", "harness-start-failed"];
|
|
3
|
+
/**
|
|
4
|
+
* The run failure reasons an adapter that isn't a model provider can tell the
|
|
5
|
+
* engine about by throwing a {@link RunFailureError}:
|
|
6
|
+
* - `disk-full`: the disk ran out of space while the run wrote to it.
|
|
7
|
+
* - `sandbox-start-failed`: the sandbox the run needs didn't start.
|
|
8
|
+
* - `harness-start-failed`: the coding agent harness didn't start.
|
|
9
|
+
*
|
|
10
|
+
* A provider says why a model call failed with a `ModelCallError` instead, so
|
|
11
|
+
* the model fallback can read it. The engine decides `budget`, `cancelled`,
|
|
12
|
+
* `interrupted` and `error` itself.
|
|
13
|
+
*/
|
|
14
|
+
export type AdapterFailure = (typeof adapterFailures)[number];
|
|
15
|
+
/**
|
|
16
|
+
* An error an adapter that isn't a model provider throws when it knows why a
|
|
17
|
+
* run can't go on, so the engine puts that reason on `run.failed`
|
|
18
|
+
* (requirement `ports.run-failure-error`).
|
|
19
|
+
*
|
|
20
|
+
* The message must be safe to show and to log. Keep the adapter's own text in
|
|
21
|
+
* `cause`, not in the message.
|
|
22
|
+
*
|
|
23
|
+
* Check for it with {@link isRunFailureError}, not `instanceof`: an adapter
|
|
24
|
+
* may be built against its own copy of this package.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* throw new RunFailureError("sandbox-start-failed", "The sandbox didn't start.", { cause });
|
|
28
|
+
*/
|
|
29
|
+
export declare class RunFailureError extends Error {
|
|
30
|
+
readonly name = "RunFailureError";
|
|
31
|
+
readonly failure: AdapterFailure;
|
|
32
|
+
/**
|
|
33
|
+
* @param failure - why the run can't go on
|
|
34
|
+
* @param message - safe to show and to log
|
|
35
|
+
* @param options - `cause` keeps the error this one wraps, for the log
|
|
36
|
+
*/
|
|
37
|
+
constructor(failure: AdapterFailure, message: string, options?: {
|
|
38
|
+
cause?: unknown;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Whether `value` is a {@link RunFailureError}: an `Error` named
|
|
43
|
+
* "RunFailureError" with one of the known failures. It works across copies
|
|
44
|
+
* of this package, where `instanceof` doesn't.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const failure = isRunFailureError(error) ? error.failure : "error";
|
|
48
|
+
*/
|
|
49
|
+
export declare function isRunFailureError(value: unknown): value is RunFailureError;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Every failure a {@link RunFailureError} can name, in {@link AdapterFailure} order. */
|
|
2
|
+
export const adapterFailures = [
|
|
3
|
+
"disk-full",
|
|
4
|
+
"sandbox-start-failed",
|
|
5
|
+
"harness-start-failed",
|
|
6
|
+
];
|
|
7
|
+
/**
|
|
8
|
+
* An error an adapter that isn't a model provider throws when it knows why a
|
|
9
|
+
* run can't go on, so the engine puts that reason on `run.failed`
|
|
10
|
+
* (requirement `ports.run-failure-error`).
|
|
11
|
+
*
|
|
12
|
+
* The message must be safe to show and to log. Keep the adapter's own text in
|
|
13
|
+
* `cause`, not in the message.
|
|
14
|
+
*
|
|
15
|
+
* Check for it with {@link isRunFailureError}, not `instanceof`: an adapter
|
|
16
|
+
* may be built against its own copy of this package.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* throw new RunFailureError("sandbox-start-failed", "The sandbox didn't start.", { cause });
|
|
20
|
+
*/
|
|
21
|
+
export class RunFailureError extends Error {
|
|
22
|
+
name = "RunFailureError";
|
|
23
|
+
failure;
|
|
24
|
+
/**
|
|
25
|
+
* @param failure - why the run can't go on
|
|
26
|
+
* @param message - safe to show and to log
|
|
27
|
+
* @param options - `cause` keeps the error this one wraps, for the log
|
|
28
|
+
*/
|
|
29
|
+
constructor(failure, message, options) {
|
|
30
|
+
super(message, options);
|
|
31
|
+
this.failure = failure;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether `value` is a {@link RunFailureError}: an `Error` named
|
|
36
|
+
* "RunFailureError" with one of the known failures. It works across copies
|
|
37
|
+
* of this package, where `instanceof` doesn't.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* const failure = isRunFailureError(error) ? error.failure : "error";
|
|
41
|
+
*/
|
|
42
|
+
export function isRunFailureError(value) {
|
|
43
|
+
if (!(value instanceof Error) || value.name !== "RunFailureError")
|
|
44
|
+
return false;
|
|
45
|
+
const failure = value.failure;
|
|
46
|
+
return adapterFailures.some((known) => known === failure);
|
|
47
|
+
}
|