@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,14 @@
|
|
|
1
|
+
/** Version of the {@link IdGenerator} port. A breaking change bumps it and comes with an ADR. */
|
|
2
|
+
export declare const idGeneratorVersion = 1;
|
|
3
|
+
/**
|
|
4
|
+
* Makes unique ids. Passed in, so the core needs no platform randomness and
|
|
5
|
+
* tests can record event logs with fixed ids.
|
|
6
|
+
*
|
|
7
|
+
* Ids are unique, **not secret**: tests make them predictable on purpose.
|
|
8
|
+
* Anything that must be unguessable, such as a session token, uses
|
|
9
|
+
* `crypto.getRandomValues` instead.
|
|
10
|
+
*/
|
|
11
|
+
export interface IdGenerator {
|
|
12
|
+
/** A new id that starts with the prefix, such as "run_…". */
|
|
13
|
+
next(prefix: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { type AgentPlacementKey, type AgentPlacementRecord, type AgentPlacementStore, agentPlacementStoreVersion, isAgentPlacementFor, } from "./agent-placement-store.js";
|
|
2
|
+
export { type BlobRef, type BlobStore, blobStoreVersion } from "./blob-store.js";
|
|
3
|
+
export { CantTryError, isCantTryError } from "./cant-try-error.js";
|
|
4
|
+
export type { ChatMessage, ChatParams, ChatRequest, ChatResponse, ChatStreamEvent, ProviderReplay, ToolCall, ToolDefinition, } from "./chat.js";
|
|
5
|
+
export { type Clock, clockVersion } from "./clock.js";
|
|
6
|
+
export { type ConnectionKey, type ConnectionSettingsRecord, type ConnectionSettingsStore, connectionSettingsStoreVersion, } from "./connection-settings-store.js";
|
|
7
|
+
export { type ConnectorCallOptions, type ConnectorClient, type ConnectorConfig, type ConnectorFactory, type ConnectorFactoryContext, type ConnectorPin, type ConnectorTool, type ConnectorTransport, connectorClientVersion, type ToolRisk, type TrustGrant, } from "./connector-client.js";
|
|
8
|
+
export { type Coordination, type CounterResult, coordinationVersion, type Lease, type WindowCount, } from "./coordination.js";
|
|
9
|
+
export { checkPublicWorkspacePath, checkWorkspacePath, type DefinitionSource, type DefinitionStore, type DefinitionWatch, type DefinitionWatchListener, definitionStoreVersion, type ExpectedContent, isPrivateWorkspacePath, isUnreadableWorkspaceFolderError, segmentAsOpened, UnreadableWorkspaceFolderError, type WorkspaceFileChange, type WriteOptions, type WriteResult, } from "./definition-store.js";
|
|
10
|
+
export { type Digest, digestVersion } from "./digest.js";
|
|
11
|
+
export { type FolderEntriesOptions, type FolderEntry, type FolderReader, folderReaderVersion, } from "./folder-reader.js";
|
|
12
|
+
export { addHarnessEnvironment, type Harness, type HarnessBridge, type HarnessDetection, type HarnessEvent, type HarnessInput, type HarnessRun, type HarnessSignIn, type HarnessTask, harnessBridgeTokenHeader, harnessVersion, } from "./harness.js";
|
|
13
|
+
export { type BridgeApprovalDecision, type BridgeApprovalRequest, type BridgeApprovals, type BridgeCallCharge, type BridgeEvent, type BridgeProvider, type BridgeProviderAccess, type BridgeRecorder, type BridgeToolCheck, type BridgeToolResult, type BridgeTools, bridgeCallCharge, bridgeCallCost, type HarnessBridgeOptions, type HarnessBridgeServer, harnessBridgeServerVersion, type OpenHarnessBridge, } from "./harness-bridge-server.js";
|
|
14
|
+
export { type HttpClient, httpClientVersion } from "./http-client.js";
|
|
15
|
+
export { type IdGenerator, idGeneratorVersion } from "./id-generator.js";
|
|
16
|
+
export { type Integration, type IntegrationConnection, type IntegrationHost, type IntegrationHttpClient, type IntegrationRequestInit, type IntegrationTool, integrationVersion, maxIntegrationWaitMs, type SecretPlacement, } from "./integration.js";
|
|
17
|
+
export { type KnowledgeCapabilities, type KnowledgeDoc, type KnowledgeHit, type KnowledgeProvider, type KnowledgeProviderContext, type KnowledgeProviderFactory, knowledgeProviderVersion, } from "./knowledge-provider.js";
|
|
18
|
+
export { type LlmCache, llmCacheVersion } from "./llm-cache.js";
|
|
19
|
+
export { isModelCallError, isModelOutOfMemory, isVendorErrorText, type LlmCapabilities, type LlmProvider, type LlmProviderFactory, llmProviderVersion, ModelCallError, type ModelCallErrorReason, modelCallErrorReasons, type ProviderConfig, type ProviderFactoryContext, VendorErrorText, } from "./llm-provider.js";
|
|
20
|
+
export { type ModelPrice, priceOf } from "./model-price.js";
|
|
21
|
+
export { type PasswordHasher, passwordHasherVersion } from "./password-hasher.js";
|
|
22
|
+
export { checkPluginFiles, checkPluginId, type PlacePluginOptions, type PluginFolderWriter, type PluginPlacement, pluginFolderWriterVersion, } from "./plugin-folder-writer.js";
|
|
23
|
+
export { type PortName, portVersions } from "./port-versions.js";
|
|
24
|
+
export { type ProgramProbe, type ProgramProbeResult, programProbeVersion, } from "./program-probe.js";
|
|
25
|
+
export { type CurrentRecord, compactedChanges, foldRecords, type RecordChange, type RecordStore, recordStoreVersion, } from "./record-store.js";
|
|
26
|
+
export { type FolderSize, type ProcessUsage, type ResourceProbe, resourceProbeVersion, } from "./resource-probe.js";
|
|
27
|
+
export { type ChatAgentSettings, type ChatTurnRefusal, type ChatTurnRequest, type ChatTurnResponse, type ChatTurnSkip, type EngineConnection, type EngineConnectionState, type RunEventListener, type RunExecutor, type RunSubscription, runExecutorVersion, type SendOptions, type StartAgentRequest, type StartRunRequest, } from "./run-executor.js";
|
|
28
|
+
export { type AdapterFailure, adapterFailures, isRunFailureError, RunFailureError, } from "./run-failure-error.js";
|
|
29
|
+
export { type AppendOptions, type AppendResult, checkRunAppend, checkRunId, compareRunSummaries, formatLogLines, isRunId, matchesRunFilter, parseLogLines, type RunFilter, type RunLockRecord, type RunSnapshot, type RunStore, runLockFormat, runLockStaleAfterMs, runLockTakeoverStaleAfterMs, runStoreVersion, startedAtOrAfter, } from "./run-store.js";
|
|
30
|
+
export { type Sandbox, type SandboxBlock, type SandboxBlockListener, type SandboxCapabilities, type SandboxCheck, type SandboxCommand, type SandboxExit, type SandboxFence, type SandboxFileAccess, type SandboxNetwork, type SandboxProcess, type SandboxProfile, type SandboxSession, type SandboxStrength, type SandboxUnavailableReason, sandboxUnavailableReasons, sandboxVersion, } from "./sandbox.js";
|
|
31
|
+
export { type ScheduledTimer, type Scheduler, type SchedulerFactory, type SchedulerListener, schedulerVersion, } from "./scheduler.js";
|
|
32
|
+
export { describeSecretName, halonicSecretNames, isHalonicSecretName, isPluginSecretName, isQuotableSecretName, isSecretName, maxSecretNameLength, pluginSecretNamePrefix, type Secrets, secretKey, secretsVersion, tokenNamePrefix, workspaceSecrets, } from "./secrets.js";
|
|
33
|
+
export { type TokenStore, tokenStoreVersion } from "./token-store.js";
|
|
34
|
+
export { isUnreadableToolApprovalError, type ListedToolFingerprint, type ListedToolText, maxWaitingVersions, type ToolApproval, type ToolApprovalKey, type ToolApprovalStore, type ToolServer, toolApprovalStoreVersion, UnreadableToolApprovalError, type WaitingVersion, type WrittenDigest, } from "./tool-approval-store.js";
|
|
35
|
+
export { type TrustOrigin, type TrustRecord, type TrustStore, trustStoreVersion, } from "./trust-store.js";
|
|
36
|
+
export { type UnfencedRunConsent, type UnfencedRunConsentStore, unfencedRunConsentStoreVersion, } from "./unfenced-run-consent-store.js";
|
|
37
|
+
export { checkCommitId, checkProposalRef, unversionedFolders, type Vcs, type VcsApplyOptions, type VcsChange, type VcsCommit, type VcsCommitVersionOptions, type VcsCommitWorktreeOptions, type VcsDiffStatus, type VcsFileDiff, type VcsFileStatus, type VcsStatus, type VcsWorktree, vcsVersion, } from "./vcs.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { agentPlacementStoreVersion, isAgentPlacementFor, } from "./agent-placement-store.js";
|
|
2
|
+
export { blobStoreVersion } from "./blob-store.js";
|
|
3
|
+
export { CantTryError, isCantTryError } from "./cant-try-error.js";
|
|
4
|
+
export { clockVersion } from "./clock.js";
|
|
5
|
+
export { connectionSettingsStoreVersion, } from "./connection-settings-store.js";
|
|
6
|
+
export { connectorClientVersion, } from "./connector-client.js";
|
|
7
|
+
export { coordinationVersion, } from "./coordination.js";
|
|
8
|
+
export { checkPublicWorkspacePath, checkWorkspacePath, definitionStoreVersion, isPrivateWorkspacePath, isUnreadableWorkspaceFolderError, segmentAsOpened, UnreadableWorkspaceFolderError, } from "./definition-store.js";
|
|
9
|
+
export { digestVersion } from "./digest.js";
|
|
10
|
+
export { folderReaderVersion, } from "./folder-reader.js";
|
|
11
|
+
export { addHarnessEnvironment, harnessBridgeTokenHeader, harnessVersion, } from "./harness.js";
|
|
12
|
+
export { bridgeCallCharge, bridgeCallCost, harnessBridgeServerVersion, } from "./harness-bridge-server.js";
|
|
13
|
+
export { httpClientVersion } from "./http-client.js";
|
|
14
|
+
export { idGeneratorVersion } from "./id-generator.js";
|
|
15
|
+
export { integrationVersion, maxIntegrationWaitMs, } from "./integration.js";
|
|
16
|
+
export { knowledgeProviderVersion, } from "./knowledge-provider.js";
|
|
17
|
+
export { llmCacheVersion } from "./llm-cache.js";
|
|
18
|
+
export { isModelCallError, isModelOutOfMemory, isVendorErrorText, llmProviderVersion, ModelCallError, modelCallErrorReasons, VendorErrorText, } from "./llm-provider.js";
|
|
19
|
+
export { priceOf } from "./model-price.js";
|
|
20
|
+
export { passwordHasherVersion } from "./password-hasher.js";
|
|
21
|
+
export { checkPluginFiles, checkPluginId, pluginFolderWriterVersion, } from "./plugin-folder-writer.js";
|
|
22
|
+
export { portVersions } from "./port-versions.js";
|
|
23
|
+
export { programProbeVersion, } from "./program-probe.js";
|
|
24
|
+
export { compactedChanges, foldRecords, recordStoreVersion, } from "./record-store.js";
|
|
25
|
+
export { resourceProbeVersion, } from "./resource-probe.js";
|
|
26
|
+
export { runExecutorVersion, } from "./run-executor.js";
|
|
27
|
+
export { adapterFailures, isRunFailureError, RunFailureError, } from "./run-failure-error.js";
|
|
28
|
+
export { checkRunAppend, checkRunId, compareRunSummaries, formatLogLines, isRunId, matchesRunFilter, parseLogLines, runLockFormat, runLockStaleAfterMs, runLockTakeoverStaleAfterMs, runStoreVersion, startedAtOrAfter, } from "./run-store.js";
|
|
29
|
+
export { sandboxUnavailableReasons, sandboxVersion, } from "./sandbox.js";
|
|
30
|
+
export { schedulerVersion, } from "./scheduler.js";
|
|
31
|
+
export { describeSecretName, halonicSecretNames, isHalonicSecretName, isPluginSecretName, isQuotableSecretName, isSecretName, maxSecretNameLength, pluginSecretNamePrefix, secretKey, secretsVersion, tokenNamePrefix, workspaceSecrets, } from "./secrets.js";
|
|
32
|
+
export { tokenStoreVersion } from "./token-store.js";
|
|
33
|
+
export { isUnreadableToolApprovalError, maxWaitingVersions, toolApprovalStoreVersion, UnreadableToolApprovalError, } from "./tool-approval-store.js";
|
|
34
|
+
export { trustStoreVersion, } from "./trust-store.js";
|
|
35
|
+
export { unfencedRunConsentStoreVersion, } from "./unfenced-run-consent-store.js";
|
|
36
|
+
export { checkCommitId, checkProposalRef, unversionedFolders, vcsVersion, } from "./vcs.js";
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { ConnectorTool, ToolRisk } from "./connector-client.js";
|
|
2
|
+
import type { HttpClient } from "./http-client.js";
|
|
3
|
+
import type { KnowledgeProvider } from "./knowledge-provider.js";
|
|
4
|
+
import type { LlmProvider, ProviderConfig } from "./llm-provider.js";
|
|
5
|
+
import type { TokenStore } from "./token-store.js";
|
|
6
|
+
/**
|
|
7
|
+
* Version of the {@link Integration} and {@link IntegrationHost} ports. A
|
|
8
|
+
* breaking change bumps it and comes with an ADR. An integration's permission
|
|
9
|
+
* sheet names the version it was built against (`kit`), and the loader
|
|
10
|
+
* refuses one built against another version.
|
|
11
|
+
*/
|
|
12
|
+
export declare const integrationVersion = 1;
|
|
13
|
+
/**
|
|
14
|
+
* The longest {@link IntegrationHost.wait} waits, in milliseconds (30 s). The
|
|
15
|
+
* host enforces it; it is exported so an integration can tell in advance
|
|
16
|
+
* that a server asks for a longer pause and give up instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare const maxIntegrationWaitMs = 30000;
|
|
19
|
+
/**
|
|
20
|
+
* A tool an integration offers: the {@link ConnectorTool} shape, with its
|
|
21
|
+
* `risk` required. The permission sheet lists the same tools with the same
|
|
22
|
+
* `risk` and `untrusted`, and the conformance suite fails when they differ.
|
|
23
|
+
*/
|
|
24
|
+
export interface IntegrationTool extends ConnectorTool {
|
|
25
|
+
risk: ToolRisk;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Puts a configured secret into one request. The integration names the
|
|
29
|
+
* secret; the host looks up the value and places it, and only when the
|
|
30
|
+
* permission sheet allows that secret to go to the request's host. The
|
|
31
|
+
* integration never sees the value, so it can't put it in a URL, a tool
|
|
32
|
+
* result, an error or a log.
|
|
33
|
+
*/
|
|
34
|
+
export type SecretPlacement =
|
|
35
|
+
/** `Authorization: Bearer <value>`. */
|
|
36
|
+
{
|
|
37
|
+
secret: string;
|
|
38
|
+
as: "bearer";
|
|
39
|
+
}
|
|
40
|
+
/** `<header>: <prefix><value>`, such as `x-api-key`. */
|
|
41
|
+
| {
|
|
42
|
+
secret: string;
|
|
43
|
+
as: "header";
|
|
44
|
+
header: string;
|
|
45
|
+
prefix?: string;
|
|
46
|
+
}
|
|
47
|
+
/** A field in a form body (`application/x-www-form-urlencoded`), such as an OAuth `client_secret`. */
|
|
48
|
+
| {
|
|
49
|
+
secret: string;
|
|
50
|
+
as: "form";
|
|
51
|
+
field: string;
|
|
52
|
+
};
|
|
53
|
+
/** A request as an integration sends it: a Web `RequestInit`, plus where to put a secret. */
|
|
54
|
+
export interface IntegrationRequestInit extends RequestInit {
|
|
55
|
+
/** The secrets to place in this request. Each must be declared and allowed for the host. */
|
|
56
|
+
auth?: SecretPlacement | readonly SecretPlacement[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The only way an integration reaches the network. It sends only to the
|
|
60
|
+
* hosts the permission sheet declares (exact host, `https`), checks every
|
|
61
|
+
* redirect hop the same way, and places secrets for the integration.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* const response = await host.http.fetch("https://api.example.com/v1/forecast?city=Ghent", {
|
|
65
|
+
* auth: { secret: "example-key", as: "header", header: "x-api-key" },
|
|
66
|
+
* signal,
|
|
67
|
+
* });
|
|
68
|
+
*/
|
|
69
|
+
export interface IntegrationHttpClient extends HttpClient {
|
|
70
|
+
/**
|
|
71
|
+
* Sends one request. An HTTP error status still resolves; check `ok`.
|
|
72
|
+
*
|
|
73
|
+
* @throws when the host, the scheme or a redirect isn't allowed, a secret
|
|
74
|
+
* isn't declared or isn't allowed for the host, the network fails, the
|
|
75
|
+
* request times out or is aborted, or the response is too large
|
|
76
|
+
*/
|
|
77
|
+
fetch(url: string, init?: IntegrationRequestInit): Promise<Response>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What an integration is given, and all it is given. There is no raw
|
|
81
|
+
* `HttpClient`, no `Secrets`, no file system and no timer: an integration
|
|
82
|
+
* reaches the outside world, and waits, only through these.
|
|
83
|
+
*/
|
|
84
|
+
export interface IntegrationHost {
|
|
85
|
+
/** Outbound HTTP, limited to the declared hosts and secrets. */
|
|
86
|
+
readonly http: IntegrationHttpClient;
|
|
87
|
+
/**
|
|
88
|
+
* Tokens this integration writes itself, such as a refresh token. Only the
|
|
89
|
+
* names its permission sheet declares, and only its own: two integrations
|
|
90
|
+
* with a token of the same name never see each other's.
|
|
91
|
+
*/
|
|
92
|
+
readonly tokens: TokenStore;
|
|
93
|
+
/**
|
|
94
|
+
* The settings the workspace gives this integration, such as a `baseUrl`
|
|
95
|
+
* or an account name. Never a secret value.
|
|
96
|
+
*/
|
|
97
|
+
readonly settings: Readonly<Record<string, unknown>>;
|
|
98
|
+
/**
|
|
99
|
+
* Waits `ms` milliseconds, at most {@link maxIntegrationWaitMs}, such as
|
|
100
|
+
* the pause a server asks for with SSE `retry:` or `Retry-After`. The host
|
|
101
|
+
* clamps `ms`: `NaN` and negative values wait 0, `Infinity` waits the
|
|
102
|
+
* maximum. Pass the tool call's own `signal`, so cancelling the call also
|
|
103
|
+
* cancels the pause and a wait never outlives its call.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* await host.wait(retryMs, signal);
|
|
107
|
+
*
|
|
108
|
+
* @throws `signal.reason` when `signal` aborts during the wait or is already aborted
|
|
109
|
+
*/
|
|
110
|
+
wait(ms: number, signal?: AbortSignal): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* One integration connected through its host. Created by
|
|
114
|
+
* {@link Integration.connect}; the host closes it when the workspace no
|
|
115
|
+
* longer needs it.
|
|
116
|
+
*/
|
|
117
|
+
export interface IntegrationConnection {
|
|
118
|
+
/**
|
|
119
|
+
* Calls one of the integration's tools and returns its text result.
|
|
120
|
+
*
|
|
121
|
+
* @throws when the tool fails, the host refuses a request or `signal` aborts the call
|
|
122
|
+
*/
|
|
123
|
+
callTool(name: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<string>;
|
|
124
|
+
/**
|
|
125
|
+
* The tools offered now, when they can change while connected (an MCP
|
|
126
|
+
* server). Without it the declared `tools` are the list. The host treats a
|
|
127
|
+
* tool it finds here but not in the declaration as `risk: "write"` unless
|
|
128
|
+
* the workspace sets a lower one.
|
|
129
|
+
*
|
|
130
|
+
* A server the workspace chose wrote such a tool, so the host also rebuilds
|
|
131
|
+
* its parameters from an allow-list, fences off its description, schema
|
|
132
|
+
* texts and results as untrusted text, and refuses tools that are too large
|
|
133
|
+
* or whose names it can't check (requirement
|
|
134
|
+
* `ports.untrusted-tool-listings`). Don't fence them here, and don't mark
|
|
135
|
+
* them trusted. For a declared name, the host uses the declared tool
|
|
136
|
+
* instead of the listed one.
|
|
137
|
+
*/
|
|
138
|
+
listTools?(): Promise<IntegrationTool[]>;
|
|
139
|
+
/** Builds a model provider, for an integration whose sheet `provides` `llm`. */
|
|
140
|
+
createLlmProvider?(config: ProviderConfig): LlmProvider;
|
|
141
|
+
/** Builds a knowledge source, for an integration whose sheet `provides` `knowledge`. */
|
|
142
|
+
createKnowledgeProvider?(source: {
|
|
143
|
+
id: string;
|
|
144
|
+
config: Record<string, unknown>;
|
|
145
|
+
}): KnowledgeProvider;
|
|
146
|
+
/** Releases what the connection holds. Safe to call twice. */
|
|
147
|
+
close(): Promise<void>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* An integration as its package exports it: what it is, which tools it
|
|
151
|
+
* offers, and how to connect it. Its permission sheet (`integration.yaml`)
|
|
152
|
+
* declares the same name, version and tools, plus the hosts, secrets and
|
|
153
|
+
* tokens it may use.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* export const weather: Integration = {
|
|
157
|
+
* name: "weather",
|
|
158
|
+
* version: "1.0.0",
|
|
159
|
+
* tools: [{ name: "forecast", description: "…", parameters: { type: "object" }, risk: "read", untrusted: true }],
|
|
160
|
+
* connect: (host) => ({
|
|
161
|
+
* callTool: async (_name, args, signal) => {
|
|
162
|
+
* const response = await host.http.fetch(`https://api.example.com/v1/forecast?city=${encodeURIComponent(String(args["city"]))}`, { signal });
|
|
163
|
+
* return await response.text();
|
|
164
|
+
* },
|
|
165
|
+
* close: async () => {},
|
|
166
|
+
* }),
|
|
167
|
+
* };
|
|
168
|
+
*/
|
|
169
|
+
export interface Integration {
|
|
170
|
+
/** The integration's name: lower-case words joined by `-`. The sheet's `id`. */
|
|
171
|
+
readonly name: string;
|
|
172
|
+
/** Its version, `major.minor.patch`. The sheet's `version`. */
|
|
173
|
+
readonly version: string;
|
|
174
|
+
/** The tools it offers. Empty for an integration that only provides a model or knowledge. */
|
|
175
|
+
readonly tools: readonly IntegrationTool[];
|
|
176
|
+
/** Connects through the host. Must not send a request before the first call. */
|
|
177
|
+
connect(host: IntegrationHost): IntegrationConnection;
|
|
178
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version of the {@link Integration} and {@link IntegrationHost} ports. A
|
|
3
|
+
* breaking change bumps it and comes with an ADR. An integration's permission
|
|
4
|
+
* sheet names the version it was built against (`kit`), and the loader
|
|
5
|
+
* refuses one built against another version.
|
|
6
|
+
*/
|
|
7
|
+
export const integrationVersion = 1;
|
|
8
|
+
/**
|
|
9
|
+
* The longest {@link IntegrationHost.wait} waits, in milliseconds (30 s). The
|
|
10
|
+
* host enforces it; it is exported so an integration can tell in advance
|
|
11
|
+
* that a server asks for a longer pause and give up instead.
|
|
12
|
+
*/
|
|
13
|
+
export const maxIntegrationWaitMs = 30_000;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { DefinitionSource } from "./definition-store.js";
|
|
2
|
+
import type { HttpClient } from "./http-client.js";
|
|
3
|
+
import type { Secrets } from "./secrets.js";
|
|
4
|
+
/** Version of the {@link KnowledgeProvider} and {@link KnowledgeProviderFactory} ports. A breaking change bumps it and comes with an ADR. */
|
|
5
|
+
export declare const knowledgeProviderVersion = 1;
|
|
6
|
+
/** One search result. */
|
|
7
|
+
export interface KnowledgeHit {
|
|
8
|
+
ref: string;
|
|
9
|
+
title: string;
|
|
10
|
+
snippet: string;
|
|
11
|
+
score: number;
|
|
12
|
+
}
|
|
13
|
+
/** One whole document. */
|
|
14
|
+
export interface KnowledgeDoc {
|
|
15
|
+
ref: string;
|
|
16
|
+
title: string;
|
|
17
|
+
content: string;
|
|
18
|
+
}
|
|
19
|
+
/** What a knowledge source can do. */
|
|
20
|
+
export interface KnowledgeCapabilities {
|
|
21
|
+
search: boolean;
|
|
22
|
+
semantic: boolean;
|
|
23
|
+
ingest: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** A knowledge source agents can search and read. */
|
|
26
|
+
export interface KnowledgeProvider {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly capabilities: KnowledgeCapabilities;
|
|
29
|
+
/**
|
|
30
|
+
* Whether hits and documents may hold text someone outside the workspace
|
|
31
|
+
* wrote, such as a remote server's answers. Halonic fences that text off
|
|
32
|
+
* like an untrusted tool result, so instructions in it aren't followed.
|
|
33
|
+
* Leaving it out counts as `true`: only a source whose content the
|
|
34
|
+
* workspace itself wrote, such as its own files, says `false`.
|
|
35
|
+
*/
|
|
36
|
+
readonly untrusted?: boolean;
|
|
37
|
+
/** The best matches first. */
|
|
38
|
+
search(query: string, options?: {
|
|
39
|
+
limit?: number;
|
|
40
|
+
}): Promise<KnowledgeHit[]>;
|
|
41
|
+
/** The document, or `null` when there is no such ref. */
|
|
42
|
+
get(ref: string): Promise<KnowledgeDoc | null>;
|
|
43
|
+
/** Every document's ref and title, when the provider can list them (for prompts and summaries). */
|
|
44
|
+
list?(): Promise<{
|
|
45
|
+
ref: string;
|
|
46
|
+
title: string;
|
|
47
|
+
}[]>;
|
|
48
|
+
}
|
|
49
|
+
/** What a factory may use to build a knowledge source. */
|
|
50
|
+
export interface KnowledgeProviderContext {
|
|
51
|
+
/** The workspace files; read-only, because a knowledge source never edits them. */
|
|
52
|
+
store: DefinitionSource;
|
|
53
|
+
/** The folder of the hub or workspace the source belongs to, relative to the store. */
|
|
54
|
+
basePath: string;
|
|
55
|
+
http: HttpClient;
|
|
56
|
+
secrets: Secrets;
|
|
57
|
+
}
|
|
58
|
+
/** Creates knowledge sources of one type from their config. */
|
|
59
|
+
export interface KnowledgeProviderFactory {
|
|
60
|
+
readonly type: string;
|
|
61
|
+
create(source: {
|
|
62
|
+
id: string;
|
|
63
|
+
config: Record<string, unknown>;
|
|
64
|
+
}, context: KnowledgeProviderContext): KnowledgeProvider;
|
|
65
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChatResponse } from "./chat.js";
|
|
2
|
+
/** Version of the {@link LlmCache} port. A breaking change bumps it and comes with an ADR. */
|
|
3
|
+
export declare const llmCacheVersion = 1;
|
|
4
|
+
/**
|
|
5
|
+
* Model answers by request: a hash of model, messages, tools and settings.
|
|
6
|
+
* A simulation re-run reuses them instead of calling the model again.
|
|
7
|
+
*/
|
|
8
|
+
export interface LlmCache {
|
|
9
|
+
/** The cached answer, or `null` when there is none. */
|
|
10
|
+
get(key: string): Promise<ChatResponse | null>;
|
|
11
|
+
/** Stores an answer, replacing any answer already stored under the key. */
|
|
12
|
+
set(key: string, response: ChatResponse): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { ChatRequest, ChatResponse, ChatStreamEvent } from "./chat.js";
|
|
2
|
+
import type { HttpClient } from "./http-client.js";
|
|
3
|
+
import type { Secrets } from "./secrets.js";
|
|
4
|
+
/** Version of the {@link LlmProvider} and {@link LlmProviderFactory} ports. A breaking change bumps it and comes with an ADR. */
|
|
5
|
+
export declare const llmProviderVersion = 1;
|
|
6
|
+
/** What a provider's models can do. */
|
|
7
|
+
export interface LlmCapabilities {
|
|
8
|
+
/** Whether its models can call tools. */
|
|
9
|
+
tools: boolean;
|
|
10
|
+
/** Whether it can be asked for a JSON answer. */
|
|
11
|
+
jsonOutput: boolean;
|
|
12
|
+
/** Whether its models accept images. */
|
|
13
|
+
vision: boolean;
|
|
14
|
+
/** Whether it can stream an answer as it is written. */
|
|
15
|
+
streaming: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** A model provider (OpenAI, Gemini, Ollama, the scripted test model …) as one workspace configures it. */
|
|
18
|
+
export interface LlmProvider {
|
|
19
|
+
/** The provider's id in the workspace's providers. */
|
|
20
|
+
readonly id: string;
|
|
21
|
+
/** The adapter type, such as "openai". */
|
|
22
|
+
readonly type: string;
|
|
23
|
+
/** What its models can do. */
|
|
24
|
+
readonly capabilities: LlmCapabilities;
|
|
25
|
+
/**
|
|
26
|
+
* Makes one model call.
|
|
27
|
+
*
|
|
28
|
+
* @throws {ModelCallError} when the call fails, with the reason why: no
|
|
29
|
+
* key, offline, the model is missing, it can't call tools, it ran out of
|
|
30
|
+
* memory, the key wasn't accepted, the account is out of credit, the
|
|
31
|
+
* provider is busy, or the provider refused. Callers treat any other error as `refused`, except the abort
|
|
32
|
+
* error when `request.signal` aborts the call.
|
|
33
|
+
*/
|
|
34
|
+
chat(request: ChatRequest): Promise<ChatResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Makes one model call and yields the answer as it is written, ending
|
|
37
|
+
* with a `done` event that holds the full {@link ChatResponse}. Present
|
|
38
|
+
* only when `capabilities.streaming` is true; callers check both and
|
|
39
|
+
* fall back to `chat()`. Aborting `request.signal` ends the stream with
|
|
40
|
+
* an error.
|
|
41
|
+
*
|
|
42
|
+
* @throws {ModelCallError} when the call fails, before the first event or
|
|
43
|
+
* during the stream, with the same reason `chat()` would give for the same
|
|
44
|
+
* failure.
|
|
45
|
+
*/
|
|
46
|
+
stream?(request: ChatRequest): AsyncIterable<ChatStreamEvent>;
|
|
47
|
+
}
|
|
48
|
+
/** Every reason a model call can fail with, in {@link ModelCallErrorReason} order. */
|
|
49
|
+
export declare const modelCallErrorReasons: readonly ["no-key", "offline", "model-missing", "model-no-tools", "out-of-memory", "key-refused", "out-of-credit", "provider-busy", "refused"];
|
|
50
|
+
/**
|
|
51
|
+
* Why a model call failed:
|
|
52
|
+
* - `no-key`: the provider needs a key and its secret isn't set. A provider
|
|
53
|
+
* that has a key and is turned away says `key-refused`.
|
|
54
|
+
* - `offline`: the provider couldn't be reached, such as no network, a DNS
|
|
55
|
+
* failure, a refused connection or a timeout. The error names the `host`
|
|
56
|
+
* when the provider knows it.
|
|
57
|
+
* - `model-missing`: the provider doesn't have the model asked for.
|
|
58
|
+
* - `model-no-tools`: the model can't call tools and the request offered some.
|
|
59
|
+
* - `out-of-memory`: the model doesn't fit in the memory of the machine that
|
|
60
|
+
* runs it. Providers find it with {@link isModelOutOfMemory}.
|
|
61
|
+
* - `key-refused`: the provider didn't accept the key (HTTP 401 or 403).
|
|
62
|
+
* - `out-of-credit`: the account at the provider has no credit left or
|
|
63
|
+
* reached its spending limit, such as HTTP 402 or OpenAI's 429 with
|
|
64
|
+
* `insufficient_quota`. This is never Halonic's own budget.
|
|
65
|
+
* - `provider-busy`: the provider is overloaded or asked the caller to slow
|
|
66
|
+
* down, such as any other HTTP 429, a 5xx or Anthropic's 529.
|
|
67
|
+
* - `refused`: anything else the provider turned down or failed on.
|
|
68
|
+
*/
|
|
69
|
+
export type ModelCallErrorReason = (typeof modelCallErrorReasons)[number];
|
|
70
|
+
/**
|
|
71
|
+
* The error an {@link LlmProvider} throws when a model call fails, so the
|
|
72
|
+
* engine can tell why and decide whether to try the next model. Its message
|
|
73
|
+
* is plain text for the run log; it never holds a key or any part of one.
|
|
74
|
+
*
|
|
75
|
+
* Check for it with {@link isModelCallError}, not `instanceof`: an adapter
|
|
76
|
+
* may be built against its own copy of this package.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* throw new ModelCallError("model-missing", `openai has no model "gpt-9"`);
|
|
80
|
+
* throw new ModelCallError("offline", "Ollama didn't answer.", { host: "localhost:11434", cause });
|
|
81
|
+
*/
|
|
82
|
+
export declare class ModelCallError extends Error {
|
|
83
|
+
readonly name = "ModelCallError";
|
|
84
|
+
readonly reason: ModelCallErrorReason;
|
|
85
|
+
/**
|
|
86
|
+
* With `offline` only: the host that didn't answer, as its name and port,
|
|
87
|
+
* such as `localhost:11434`. Never a URL with a path, a query or a key.
|
|
88
|
+
*/
|
|
89
|
+
readonly host: string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* @param reason - why the call failed
|
|
92
|
+
* @param message - plain text for the run log, never a key
|
|
93
|
+
* @param options - `cause` keeps the error this one wraps; `host` names the
|
|
94
|
+
* host that didn't answer, and is kept only with `offline`
|
|
95
|
+
*/
|
|
96
|
+
constructor(reason: ModelCallErrorReason, message: string, options?: {
|
|
97
|
+
cause?: unknown;
|
|
98
|
+
host?: string;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Whether `value` is a {@link ModelCallError}: an `Error` named
|
|
103
|
+
* "ModelCallError" with one of the known reasons. It works across copies of
|
|
104
|
+
* this package, where `instanceof` doesn't.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* const reason = isModelCallError(error) ? error.reason : "refused";
|
|
108
|
+
*/
|
|
109
|
+
export declare function isModelCallError(value: unknown): value is ModelCallError;
|
|
110
|
+
/**
|
|
111
|
+
* The provider's own error text, as the `cause` of a {@link ModelCallError}
|
|
112
|
+
* for an error reply (requirement `ports.vendor-error-text`). It stays
|
|
113
|
+
* out of the message, which Studio and the command line show: microcopy 1.4
|
|
114
|
+
* allows no quoted outside text there. The engine keeps it in the run log
|
|
115
|
+
* for `--debug` and Copy details.
|
|
116
|
+
*
|
|
117
|
+
* The provider shortens the text and checks it for keys before it builds
|
|
118
|
+
* one: whatever is in it may end up in the run log.
|
|
119
|
+
*
|
|
120
|
+
* Check for it with {@link isVendorErrorText}, not `instanceof`: an adapter
|
|
121
|
+
* may be built against its own copy of this package.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* const cause = new VendorErrorText(400, "max_tokens: 200000 > 64000");
|
|
125
|
+
* throw new ModelCallError("refused", `anthropic refused the call (HTTP 400)`, { cause });
|
|
126
|
+
*/
|
|
127
|
+
export declare class VendorErrorText extends Error {
|
|
128
|
+
readonly name = "VendorErrorText";
|
|
129
|
+
/**
|
|
130
|
+
* The HTTP status the text came with, or for an error in a stream the
|
|
131
|
+
* status its error type stands for; undefined when there is none.
|
|
132
|
+
*/
|
|
133
|
+
readonly status: number | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* @param status - the HTTP status the text came with, or undefined when there is none
|
|
136
|
+
* @param text - the provider's text, already shortened and checked for keys
|
|
137
|
+
*/
|
|
138
|
+
constructor(status: number | undefined, text: string);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Whether `value` is a {@link VendorErrorText}: an `Error` named
|
|
142
|
+
* "VendorErrorText" with a `status` that is a whole number or set to
|
|
143
|
+
* undefined. It works across copies of this package, where `instanceof`
|
|
144
|
+
* doesn't.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* const text = isVendorErrorText(error.cause) ? error.cause.message : undefined;
|
|
148
|
+
*/
|
|
149
|
+
export declare function isVendorErrorText(value: unknown): value is VendorErrorText;
|
|
150
|
+
/**
|
|
151
|
+
* True when a model server's error text says the model ran out of memory.
|
|
152
|
+
* A provider calls it on an error body, then throws a {@link ModelCallError}
|
|
153
|
+
* with `out-of-memory` (requirement `ports.model-out-of-memory-text`).
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* isModelOutOfMemory("model requires more system memory (12.0 GiB) than is available (7.6 GiB)"); // true
|
|
157
|
+
*/
|
|
158
|
+
export declare function isModelOutOfMemory(text: string): boolean;
|
|
159
|
+
/** A provider as the workspace's YAML configures it. */
|
|
160
|
+
export interface ProviderConfig {
|
|
161
|
+
/** The provider's id in the workspace. */
|
|
162
|
+
id: string;
|
|
163
|
+
/** The adapter type, such as "openai"; picks the factory. */
|
|
164
|
+
type: string;
|
|
165
|
+
/** The provider's address, when it isn't the adapter's default. */
|
|
166
|
+
baseUrl?: string;
|
|
167
|
+
/** The **name** of the secret that holds the API key, never the key itself. */
|
|
168
|
+
secret?: string;
|
|
169
|
+
/** Whether the models run on this machine (such as Ollama), so they have no price. */
|
|
170
|
+
local: boolean;
|
|
171
|
+
/** Settings only this adapter type understands. */
|
|
172
|
+
options: Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
/** What a factory may use to build a provider. */
|
|
175
|
+
export interface ProviderFactoryContext {
|
|
176
|
+
secrets: Secrets;
|
|
177
|
+
http: HttpClient;
|
|
178
|
+
}
|
|
179
|
+
/** Creates a provider from its YAML config. One factory per adapter type. */
|
|
180
|
+
export interface LlmProviderFactory {
|
|
181
|
+
/** The `type` this factory handles. */
|
|
182
|
+
readonly type: string;
|
|
183
|
+
create(config: ProviderConfig, context: ProviderFactoryContext): LlmProvider;
|
|
184
|
+
}
|