@halonicjs/testing 0.0.0 → 0.1.1
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 +5 -0
- package/README.md +41 -1
- package/dist/adapters/http-kit/src/address-checking.d.ts +19 -0
- package/dist/adapters/http-kit/src/address-checking.js +1 -0
- 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 +3 -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/auth-placement.d.ts +40 -0
- package/dist/adapters/integration-kit/src/auth-placement.js +102 -0
- package/dist/adapters/integration-kit/src/current-secret-forms.d.ts +28 -0
- package/dist/adapters/integration-kit/src/current-secret-forms.js +60 -0
- package/dist/adapters/integration-kit/src/declaration.d.ts +15 -0
- package/dist/adapters/integration-kit/src/declaration.js +78 -0
- package/dist/adapters/integration-kit/src/host.d.ts +34 -0
- package/dist/adapters/integration-kit/src/host.js +31 -0
- package/dist/adapters/integration-kit/src/index.d.ts +16 -0
- package/dist/adapters/integration-kit/src/index.js +22 -0
- package/dist/adapters/integration-kit/src/leak-attempt.d.ts +16 -0
- package/dist/adapters/integration-kit/src/leak-attempt.js +19 -0
- package/dist/adapters/integration-kit/src/limited-http.d.ts +55 -0
- package/dist/adapters/integration-kit/src/limited-http.js +225 -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 +131 -0
- package/dist/adapters/integration-kit/src/loader.js +251 -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 +83 -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 +27 -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 +220 -0
- package/dist/adapters/integration-kit/src/secret-in-request.d.ts +62 -0
- package/dist/adapters/integration-kit/src/secret-in-request.js +139 -0
- package/dist/adapters/integration-kit/src/secret-placement.d.ts +46 -0
- package/dist/adapters/integration-kit/src/secret-placement.js +160 -0
- package/dist/adapters/integration-kit/src/sign-in-placement.d.ts +29 -0
- package/dist/adapters/integration-kit/src/sign-in-placement.js +92 -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/blocked-sites.d.ts +57 -0
- package/dist/core/events/src/blocked-sites.js +89 -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 +17 -0
- package/dist/core/events/src/index.js +10 -0
- package/dist/core/events/src/run-basics.d.ts +228 -0
- package/dist/core/events/src/run-basics.js +1 -0
- package/dist/core/events/src/run-event.d.ts +478 -0
- package/dist/core/events/src/run-event.js +1 -0
- package/dist/core/events/src/run-reads.d.ts +25 -0
- package/dist/core/events/src/run-reads.js +44 -0
- package/dist/core/events/src/run-sends.d.ts +47 -0
- package/dist/core/events/src/run-sends.js +68 -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 +192 -0
- package/dist/core/events/src/timeline-entry.d.ts +21 -0
- package/dist/core/events/src/timeline-entry.js +106 -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 +39 -0
- package/dist/core/format/src/index.js +25 -0
- package/dist/core/format/src/integration/index.d.ts +7 -0
- package/dist/core/format/src/integration/index.js +10 -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 +99 -0
- package/dist/core/format/src/kinds/agent/sandbox-fields.js +216 -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 +218 -0
- package/dist/core/format/src/kinds/connector/schema.d.ts +74 -0
- package/dist/core/format/src/kinds/connector/schema.js +143 -0
- package/dist/core/format/src/kinds/deployments/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/deployments/kind.js +49 -0
- package/dist/core/format/src/kinds/deployments/schema.d.ts +77 -0
- package/dist/core/format/src/kinds/deployments/schema.js +94 -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/approved-sign-ins.d.ts +62 -0
- package/dist/core/format/src/kinds/integration/approved-sign-ins.js +125 -0
- package/dist/core/format/src/kinds/integration/host-key.d.ts +7 -0
- package/dist/core/format/src/kinds/integration/host-key.js +8 -0
- package/dist/core/format/src/kinds/integration/kind.d.ts +18 -0
- package/dist/core/format/src/kinds/integration/kind.js +175 -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 +112 -0
- package/dist/core/format/src/kinds/integration/policy.js +327 -0
- package/dist/core/format/src/kinds/integration/schema.d.ts +410 -0
- package/dist/core/format/src/kinds/integration/schema.js +359 -0
- package/dist/core/format/src/kinds/integration/sign-in-checks.d.ts +13 -0
- package/dist/core/format/src/kinds/integration/sign-in-checks.js +120 -0
- package/dist/core/format/src/kinds/integration/sign-in-urls.d.ts +19 -0
- package/dist/core/format/src/kinds/integration/sign-in-urls.js +47 -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 +137 -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 +672 -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 +85 -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 +62 -0
- package/dist/core/format/src/kinds/routine/schema.d.ts +94 -0
- package/dist/core/format/src/kinds/routine/schema.js +115 -0
- package/dist/core/format/src/kinds/routine/webhook-headers.d.ts +9 -0
- package/dist/core/format/src/kinds/routine/webhook-headers.js +26 -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 +34 -0
- package/dist/core/format/src/shared/fields.js +74 -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/agent-runs-not-available.d.ts +21 -0
- package/dist/core/ports/src/agent-runs-not-available.js +25 -0
- package/dist/core/ports/src/blob-store.d.ts +45 -0
- package/dist/core/ports/src/blob-store.js +24 -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 +303 -0
- package/dist/core/ports/src/connector-client.js +19 -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 +229 -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 +198 -0
- package/dist/core/ports/src/harness-bridge-server.js +37 -0
- package/dist/core/ports/src/harness-sign-in-command.d.ts +27 -0
- package/dist/core/ports/src/harness-sign-in-command.js +31 -0
- package/dist/core/ports/src/harness.d.ts +283 -0
- package/dist/core/ports/src/harness.js +45 -0
- package/dist/core/ports/src/host-settings-store.d.ts +116 -0
- package/dist/core/ports/src/host-settings-store.js +106 -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 +45 -0
- package/dist/core/ports/src/index.js +44 -0
- package/dist/core/ports/src/instruction-trust-store.d.ts +81 -0
- package/dist/core/ports/src/instruction-trust-store.js +43 -0
- package/dist/core/ports/src/integration.d.ts +242 -0
- package/dist/core/ports/src/integration.js +31 -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 +186 -0
- package/dist/core/ports/src/llm-provider.js +139 -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 +63 -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 +47 -0
- package/dist/core/ports/src/port-versions.js +80 -0
- package/dist/core/ports/src/program-probe.d.ts +69 -0
- package/dist/core/ports/src/program-probe.js +2 -0
- package/dist/core/ports/src/provider-default-base-url.d.ts +10 -0
- package/dist/core/ports/src/provider-default-base-url.js +18 -0
- package/dist/core/ports/src/record-store.d.ts +79 -0
- package/dist/core/ports/src/record-store.js +108 -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 +303 -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/run-target-not-found.d.ts +34 -0
- package/dist/core/ports/src/run-target-not-found.js +41 -0
- package/dist/core/ports/src/sandbox-setting-store.d.ts +68 -0
- package/dist/core/ports/src/sandbox-setting-store.js +33 -0
- package/dist/core/ports/src/sandbox.d.ts +364 -0
- package/dist/core/ports/src/sandbox.js +70 -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 +201 -0
- package/dist/core/ports/src/secrets.js +200 -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 +253 -0
- package/dist/core/ports/src/tool-approval-store.js +116 -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-status.d.ts +8 -0
- package/dist/core/ports/src/vcs-status.js +90 -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/amount.d.ts +13 -0
- package/dist/core/std/src/amount.js +22 -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/hidden-characters.d.ts +19 -0
- package/dist/core/std/src/hidden-characters.js +54 -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 +30 -0
- package/dist/core/std/src/index.js +31 -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/public-suffixes.generated.d.ts +9 -0
- package/dist/core/std/src/public-suffixes.generated.js +10429 -0
- package/dist/core/std/src/registrable-domain.d.ts +10 -0
- package/dist/core/std/src/registrable-domain.js +62 -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/secret-variable-name.d.ts +12 -0
- package/dist/core/std/src/secret-variable-name.js +34 -0
- package/dist/core/std/src/site-name.d.ts +35 -0
- package/dist/core/std/src/site-name.js +111 -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/url-host.d.ts +35 -0
- package/dist/core/std/src/url-host.js +170 -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 +47 -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 +34 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { IntegrationRefusedError } from "@halonicjs/adapters/integration-kit";
|
|
2
|
+
import { checkSecretHost, checkSecretPlacement, placeSecret, quoted } from "./secret-placement.js";
|
|
3
|
+
import { checkSignInPlacement, checkSignInPlacementHost, placeToken } from "./sign-in-placement.js";
|
|
4
|
+
/** The placement puts a secret, not a sign-in's token. */
|
|
5
|
+
export function isSecretPlacement(placement) {
|
|
6
|
+
return "secret" in placement;
|
|
7
|
+
}
|
|
8
|
+
/** The placement puts a sign-in's access token, not a secret. */
|
|
9
|
+
export function isSignInPlacement(placement) {
|
|
10
|
+
return "signIn" in placement;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Copies the placements the integration's code gave into frozen objects of
|
|
14
|
+
* text fields, reading each field once. The kit checks and places only
|
|
15
|
+
* these copies: the code keeps its own objects and could change them, or
|
|
16
|
+
* give a getter, after the check and before the secret is placed. A field
|
|
17
|
+
* that isn't text is refused here, because an object could turn into other
|
|
18
|
+
* text each time it is read.
|
|
19
|
+
*/
|
|
20
|
+
export function copyPlacements(policy, placements) {
|
|
21
|
+
return Object.freeze(placements.map((placement) => copyPlacement(policy, placement)));
|
|
22
|
+
}
|
|
23
|
+
function copyPlacement(policy, placement) {
|
|
24
|
+
if (typeof placement !== "object" || placement === null) {
|
|
25
|
+
throw new IntegrationRefusedError("placement-not-in-sheet", `${policy.name}: a placement is not an object with text fields`);
|
|
26
|
+
}
|
|
27
|
+
const given = placement;
|
|
28
|
+
// The types say `secret` and `signIn` never appear together. If both do, nothing is placed, so a `signIn` key can't carry a secret past the secret check.
|
|
29
|
+
if ("secret" in given && "signIn" in given) {
|
|
30
|
+
throw new IntegrationRefusedError("placement-not-in-sheet", `${policy.name}: a placement names both a secret and a sign-in; it must name one`);
|
|
31
|
+
}
|
|
32
|
+
const kind = "signIn" in given ? "signIn" : "secret";
|
|
33
|
+
const owner = kind === "signIn" ? "sign-in" : "secret";
|
|
34
|
+
const name = given[kind];
|
|
35
|
+
const as = given.as;
|
|
36
|
+
if (typeof name !== "string")
|
|
37
|
+
throw notText(policy, `the ${owner}'s name`, owner);
|
|
38
|
+
if (typeof as !== "string")
|
|
39
|
+
throw notText(policy, `the "as" of the ${owner} ${quoted(name)}`, owner);
|
|
40
|
+
const copy = { [kind]: name, as };
|
|
41
|
+
for (const key of ["header", "prefix", "field"]) {
|
|
42
|
+
const value = given[key];
|
|
43
|
+
if (value === undefined)
|
|
44
|
+
continue;
|
|
45
|
+
if (typeof value !== "string")
|
|
46
|
+
throw notText(policy, `the "${key}" of the ${owner} ${quoted(name)}`, owner);
|
|
47
|
+
copy[key] = value;
|
|
48
|
+
}
|
|
49
|
+
// Whether the fields fit together is for `checkPlacements` to say.
|
|
50
|
+
return Object.freeze(copy);
|
|
51
|
+
}
|
|
52
|
+
/** A part of a placement that isn't text, named with the kind of placement it is in. */
|
|
53
|
+
function notText(policy, what, kind) {
|
|
54
|
+
return new IntegrationRefusedError("placement-not-in-sheet", `${policy.name}: ${what} in a ${kind} placement is not text`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Checks every placement against the sheet before a secret value or a token
|
|
58
|
+
* is read. Give it the copies from {@link copyPlacements}, never the code's
|
|
59
|
+
* own objects. Where a secret or token may go is for
|
|
60
|
+
* {@link checkPlacementHosts}.
|
|
61
|
+
*/
|
|
62
|
+
export function checkPlacements(policy, placements) {
|
|
63
|
+
for (const placement of placements) {
|
|
64
|
+
if (isSecretPlacement(placement))
|
|
65
|
+
checkSecretPlacement(policy, placement);
|
|
66
|
+
else
|
|
67
|
+
checkSignInPlacement(policy, placement);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Checks that every placed secret or token may go to the request's first
|
|
72
|
+
* host, once the URL is parsed. {@link checkPlacements} has already run, so
|
|
73
|
+
* every secret and sign-in is declared.
|
|
74
|
+
*/
|
|
75
|
+
export function checkPlacementHosts(policy, placements, url) {
|
|
76
|
+
for (const placement of placements) {
|
|
77
|
+
if (isSecretPlacement(placement))
|
|
78
|
+
checkSecretHost(policy, placement, url);
|
|
79
|
+
else
|
|
80
|
+
checkSignInPlacementHost(policy, placement, url);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Puts the secrets and tokens allowed for this hop's host into the headers
|
|
85
|
+
* and the form body. A placement whose secret or token may not go to this
|
|
86
|
+
* hop is left out, which happens after a redirect to another declared host.
|
|
87
|
+
*
|
|
88
|
+
* @param tokens the access tokens read for this hop, by sign-in
|
|
89
|
+
* @returns the form body to send, when a placement wrote into it
|
|
90
|
+
*/
|
|
91
|
+
export function place(policy, placements, values, url, headers, form) {
|
|
92
|
+
let body = form;
|
|
93
|
+
for (const placement of placements) {
|
|
94
|
+
if (isSecretPlacement(placement)) {
|
|
95
|
+
body = placeSecret(policy, placement, values.secrets.get(placement.secret), url, headers, body);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
placeToken(placement, values.tokens.get(placement.signIn), headers);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return body;
|
|
102
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { SignInTokens } from "../../../core/ports/src/index.js";
|
|
2
|
+
import { type SecretForms, type SecretOnWire } from "./secret-filter.js";
|
|
3
|
+
/**
|
|
4
|
+
* The forms the filter looks for now. Sign-in tokens change while an
|
|
5
|
+
* integration runs, so a filter outside the kit, such as the runner bridge's,
|
|
6
|
+
* asks for them each time it filters instead of keeping the forms it built
|
|
7
|
+
* at the start. The same `SecretForms` object comes back until a value changes.
|
|
8
|
+
*/
|
|
9
|
+
export type CurrentSecretForms = () => SecretForms;
|
|
10
|
+
/**
|
|
11
|
+
* The forms of `secrets` and of every value the sign-ins' `filterValues`
|
|
12
|
+
* lists now: the access tokens not yet expired, the refresh token and the
|
|
13
|
+
* client secret. A sign-in value is matched in every form a secret is.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const current = currentSecretForms([{ value: key }], signIns.tokens);
|
|
17
|
+
* removeSecrets(text, current());
|
|
18
|
+
*/
|
|
19
|
+
export declare function currentSecretForms(secrets: readonly SecretOnWire[], signIns?: Pick<SignInTokens, "filterValues">): CurrentSecretForms;
|
|
20
|
+
/**
|
|
21
|
+
* A stream step that removes the current secrets, for the bridge's stderr.
|
|
22
|
+
* When the forms change, a value that began in the bytes held back and ends in
|
|
23
|
+
* the next piece is still found: the held bytes go through the new forms again.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* runner.stderr.pipeThrough(removeCurrentSecretsStream(current))
|
|
27
|
+
*/
|
|
28
|
+
export declare function removeCurrentSecretsStream(current: CurrentSecretForms): TransformStream<Uint8Array, Uint8Array>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { SecretRemover, secretForms, } from "./secret-filter.js";
|
|
2
|
+
/**
|
|
3
|
+
* The forms of `secrets` and of every value the sign-ins' `filterValues`
|
|
4
|
+
* lists now: the access tokens not yet expired, the refresh token and the
|
|
5
|
+
* client secret. A sign-in value is matched in every form a secret is.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const current = currentSecretForms([{ value: key }], signIns.tokens);
|
|
9
|
+
* removeSecrets(text, current());
|
|
10
|
+
*/
|
|
11
|
+
export function currentSecretForms(secrets, signIns) {
|
|
12
|
+
const fixed = secretForms(secrets);
|
|
13
|
+
if (signIns === undefined) {
|
|
14
|
+
return () => fixed;
|
|
15
|
+
}
|
|
16
|
+
let listed = [];
|
|
17
|
+
let forms = fixed;
|
|
18
|
+
return () => {
|
|
19
|
+
const values = signIns.filterValues();
|
|
20
|
+
if (!sameValues(values, listed)) {
|
|
21
|
+
listed = [...values];
|
|
22
|
+
forms = secretForms([...secrets, ...values.map((value) => ({ value }))]);
|
|
23
|
+
}
|
|
24
|
+
return forms;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function sameValues(a, b) {
|
|
28
|
+
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A stream step that removes the current secrets, for the bridge's stderr.
|
|
32
|
+
* When the forms change, a value that began in the bytes held back and ends in
|
|
33
|
+
* the next piece is still found: the held bytes go through the new forms again.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* runner.stderr.pipeThrough(removeCurrentSecretsStream(current))
|
|
37
|
+
*/
|
|
38
|
+
export function removeCurrentSecretsStream(current) {
|
|
39
|
+
let forms = current();
|
|
40
|
+
let remover = new SecretRemover(forms);
|
|
41
|
+
return new TransformStream({
|
|
42
|
+
transform(piece, controller) {
|
|
43
|
+
const now = current();
|
|
44
|
+
if (now !== forms) {
|
|
45
|
+
const held = remover.flush();
|
|
46
|
+
forms = now;
|
|
47
|
+
remover = new SecretRemover(now);
|
|
48
|
+
enqueueIfAny(controller, remover.push(held));
|
|
49
|
+
}
|
|
50
|
+
enqueueIfAny(controller, remover.push(piece));
|
|
51
|
+
},
|
|
52
|
+
flush(controller) {
|
|
53
|
+
enqueueIfAny(controller, remover.flush());
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function enqueueIfAny(controller, bytes) {
|
|
58
|
+
if (bytes.length > 0)
|
|
59
|
+
controller.enqueue(bytes);
|
|
60
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IntegrationSheet } from "../../../core/format/src/integration/index.js";
|
|
2
|
+
import { type Integration } from "../../../core/ports/src/index.js";
|
|
3
|
+
import type { LoadProblem } from "./load-problem.js";
|
|
4
|
+
/**
|
|
5
|
+
* Where the integration's code differs from its permission sheet, or the sheet
|
|
6
|
+
* needs a newer kit than this Halonic offers: the kit
|
|
7
|
+
* version, the name, the version, and each tool's text, `risk` and
|
|
8
|
+
* `untrusted`. The user approves the sheet, so the code must be exactly what
|
|
9
|
+
* it says. Empty when they match. Only what the code declares is read, so a
|
|
10
|
+
* declaration the runner sent works as well as the integration itself.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* declarationProblems(sheet, weather); // [] when code and sheet agree
|
|
14
|
+
*/
|
|
15
|
+
export declare function declarationProblems(sheet: IntegrationSheet, integration: Pick<Integration, "name" | "version" | "tools">): LoadProblem[];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { integrationVersion } from "../../../core/ports/src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Where the integration's code differs from its permission sheet, or the sheet
|
|
4
|
+
* needs a newer kit than this Halonic offers: the kit
|
|
5
|
+
* version, the name, the version, and each tool's text, `risk` and
|
|
6
|
+
* `untrusted`. The user approves the sheet, so the code must be exactly what
|
|
7
|
+
* it says. Empty when they match. Only what the code declares is read, so a
|
|
8
|
+
* declaration the runner sent works as well as the integration itself.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* declarationProblems(sheet, weather); // [] when code and sheet agree
|
|
12
|
+
*/
|
|
13
|
+
export function declarationProblems(sheet, integration) {
|
|
14
|
+
const problems = [];
|
|
15
|
+
const add = (code, path, message) => problems.push({ code, path, message: `${sheet.id}: ${message}` });
|
|
16
|
+
if (sheet.kit > integrationVersion) {
|
|
17
|
+
add("kit-version", ["kit"], `this integration needs a newer version of Halonic (it is built against kit ${sheet.kit}, and this Halonic offers kit ${integrationVersion})`);
|
|
18
|
+
}
|
|
19
|
+
if (integration.name !== sheet.id) {
|
|
20
|
+
add("name-differs", ["id"], `the code is named "${integration.name}"`);
|
|
21
|
+
}
|
|
22
|
+
if (integration.version !== sheet.version) {
|
|
23
|
+
add("version-differs", ["version"], `the code is version ${integration.version}`);
|
|
24
|
+
}
|
|
25
|
+
const offered = new Map();
|
|
26
|
+
for (const tool of integration.tools) {
|
|
27
|
+
if (offered.has(tool.name)) {
|
|
28
|
+
add("tool-twice", ["tools"], `the code offers the tool "${tool.name}" twice`);
|
|
29
|
+
}
|
|
30
|
+
offered.set(tool.name, tool);
|
|
31
|
+
}
|
|
32
|
+
sheet.tools.forEach((declared, index) => {
|
|
33
|
+
const tool = offered.get(declared.name);
|
|
34
|
+
if (tool === undefined) {
|
|
35
|
+
add("tool-not-offered", ["tools", index], `the code doesn't offer "${declared.name}"`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
offered.delete(declared.name);
|
|
39
|
+
for (const field of toolDifferences(declared, tool)) {
|
|
40
|
+
add("tool-differs", ["tools", index, field], `"${declared.name}" differs in ${field} between code and sheet`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
for (const name of offered.keys()) {
|
|
44
|
+
add("tool-not-declared", ["tools"], `the code offers "${name}", which the sheet doesn't list`);
|
|
45
|
+
}
|
|
46
|
+
return problems;
|
|
47
|
+
}
|
|
48
|
+
/** The fields in which a tool's code and its sheet entry differ. */
|
|
49
|
+
function toolDifferences(declared, tool) {
|
|
50
|
+
const differences = [];
|
|
51
|
+
if (tool.description !== declared.description)
|
|
52
|
+
differences.push("description");
|
|
53
|
+
if (tool.risk !== declared.risk)
|
|
54
|
+
differences.push("risk");
|
|
55
|
+
if ((tool.untrusted ?? false) !== declared.untrusted)
|
|
56
|
+
differences.push("untrusted");
|
|
57
|
+
const texts = argumentTexts(tool.parameters);
|
|
58
|
+
const listed = declared.arguments ?? {};
|
|
59
|
+
const names = new Set([...Object.keys(texts), ...Object.keys(listed)]);
|
|
60
|
+
if ([...names].some((name) => texts[name] !== listed[name]))
|
|
61
|
+
differences.push("arguments");
|
|
62
|
+
return differences;
|
|
63
|
+
}
|
|
64
|
+
/** Each argument's description in the tool's JSON Schema, by name. */
|
|
65
|
+
function argumentTexts(parameters) {
|
|
66
|
+
const properties = parameters["properties"];
|
|
67
|
+
if (typeof properties !== "object" || properties === null) {
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
const texts = {};
|
|
71
|
+
for (const [name, schema] of Object.entries(properties)) {
|
|
72
|
+
const description = schema?.description;
|
|
73
|
+
if (typeof description === "string") {
|
|
74
|
+
texts[name] = description;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return texts;
|
|
78
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { HttpClient, IntegrationHost, Secrets, SignInTokens, TokenStore } from "../../../core/ports/src/index.js";
|
|
2
|
+
import { type RequestLimits } from "./limited-http.js";
|
|
3
|
+
import type { IntegrationPolicy } from "./policy.js";
|
|
4
|
+
import { RequestLog } from "./request-log.js";
|
|
5
|
+
/** What {@link createIntegrationHost} needs: the raw ports, which the integration never sees. */
|
|
6
|
+
export interface IntegrationHostOptions {
|
|
7
|
+
readonly policy: IntegrationPolicy;
|
|
8
|
+
readonly transport: HttpClient;
|
|
9
|
+
readonly secrets: Secrets;
|
|
10
|
+
readonly tokens: TokenStore;
|
|
11
|
+
/**
|
|
12
|
+
* Where the kit gets the access tokens of the sheet's sign-ins, and tells
|
|
13
|
+
* about a 401. Without it, a request that places a token is refused as
|
|
14
|
+
* `sign-in-needed`.
|
|
15
|
+
*/
|
|
16
|
+
readonly signInTokens?: SignInTokens;
|
|
17
|
+
readonly settings?: Readonly<Record<string, unknown>>;
|
|
18
|
+
readonly limits?: RequestLimits;
|
|
19
|
+
readonly now?: () => number;
|
|
20
|
+
}
|
|
21
|
+
/** The host for one integration, and its request log, which only Halonic reads. */
|
|
22
|
+
export interface CreatedIntegrationHost {
|
|
23
|
+
readonly host: IntegrationHost;
|
|
24
|
+
readonly log: RequestLog;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Builds the `IntegrationHost` for one integration from the raw ports. The
|
|
28
|
+
* integration gets the host; Halonic keeps the log.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const { host, log } = createIntegrationHost({ policy, transport: { fetch }, secrets, tokens });
|
|
32
|
+
* const connection = weather.connect(host);
|
|
33
|
+
*/
|
|
34
|
+
export declare function createIntegrationHost(options: IntegrationHostOptions): CreatedIntegrationHost;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createLimitedHttpClient } from "./limited-http.js";
|
|
2
|
+
import { RequestLog } from "./request-log.js";
|
|
3
|
+
import { scopedTokens } from "./scoped-tokens.js";
|
|
4
|
+
import { integrationWait } from "./wait.js";
|
|
5
|
+
/**
|
|
6
|
+
* Builds the `IntegrationHost` for one integration from the raw ports. The
|
|
7
|
+
* integration gets the host; Halonic keeps the log.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const { host, log } = createIntegrationHost({ policy, transport: { fetch }, secrets, tokens });
|
|
11
|
+
* const connection = weather.connect(host);
|
|
12
|
+
*/
|
|
13
|
+
export function createIntegrationHost(options) {
|
|
14
|
+
const log = new RequestLog();
|
|
15
|
+
const http = createLimitedHttpClient({
|
|
16
|
+
policy: options.policy,
|
|
17
|
+
transport: options.transport,
|
|
18
|
+
secrets: options.secrets,
|
|
19
|
+
log,
|
|
20
|
+
...(options.signInTokens ? { signInTokens: options.signInTokens } : {}),
|
|
21
|
+
...(options.limits ? { limits: options.limits } : {}),
|
|
22
|
+
...(options.now ? { now: options.now } : {}),
|
|
23
|
+
});
|
|
24
|
+
const host = Object.freeze({
|
|
25
|
+
http: Object.freeze(http),
|
|
26
|
+
tokens: Object.freeze(scopedTokens(options.policy, options.tokens)),
|
|
27
|
+
settings: Object.freeze({ ...options.settings }),
|
|
28
|
+
wait: integrationWait,
|
|
29
|
+
});
|
|
30
|
+
return { host, log };
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { AddressCheckingHttpClient } from "../../http-kit/src/index.js";
|
|
2
|
+
export { type CurrentSecretForms, currentSecretForms, removeCurrentSecretsStream, } from "./current-secret-forms.js";
|
|
3
|
+
export { declarationProblems } from "./declaration.js";
|
|
4
|
+
export { type CreatedIntegrationHost, createIntegrationHost, type IntegrationHostOptions, } from "./host.js";
|
|
5
|
+
export { IntegrationRefusedError, IntegrationTimeoutError, type RefusalCode, } from "@halonicjs/adapters/integration-kit";
|
|
6
|
+
export { leakAttemptCodes } from "./leak-attempt.js";
|
|
7
|
+
export { createLimitedHttpClient, type LimitedHttpOptions, type RequestLimits, } from "./limited-http.js";
|
|
8
|
+
export type { LoadProblem } from "./load-problem.js";
|
|
9
|
+
export { type IntegrationSource, type LoadedIntegration, type LoadIntegrationOptions, loadIntegration, type PreparedIntegration, type PrepareIntegrationOptions, prepareIntegration, providerChoices, type WorkspaceChoices, } from "./loader.js";
|
|
10
|
+
export { pluginLoadProblems } from "./plugin-load.js";
|
|
11
|
+
export { allowedUrl, type DeclaredPlacement, type DeclaredSecret, type DeclaredSignIn, type DeclaredSignInPlacement, type IntegrationPolicy, namePattern, } from "./policy.js";
|
|
12
|
+
export { maxRequestBodyBytes } from "./request-body.js";
|
|
13
|
+
export { RequestLog, type RequestLogEntry } from "./request-log.js";
|
|
14
|
+
export { scopedTokens, storedTokenName } from "./scoped-tokens.js";
|
|
15
|
+
export { removeSecrets, removeSecretsFromHeaders, removeSecretsStream, type SecretForms, type SecretOnWire, SecretRemover, secretForms, secretRemoved, } from "./secret-filter.js";
|
|
16
|
+
export { clampWaitMs, integrationWait } from "./wait.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// The host side of @halonicjs/adapter-integration-kit: the loader, the host
|
|
2
|
+
// and its limited client, for Halonic itself. It isn't published; the
|
|
3
|
+
// integration entry (`./integration`) is, as @halonicjs/adapters/integration-kit.
|
|
4
|
+
// The host side takes the error classes from the integration entry, so there
|
|
5
|
+
// is one copy of each. The npm build (tooling/publish) keeps that entry
|
|
6
|
+
// outside the conformance suite's bundle and points it at the published kit;
|
|
7
|
+
// it fails when host code imports a file inside the entry's folder instead
|
|
8
|
+
// of the entry itself. Internal code imports by relative path.
|
|
9
|
+
export { currentSecretForms, removeCurrentSecretsStream, } from "./current-secret-forms.js";
|
|
10
|
+
export { declarationProblems } from "./declaration.js";
|
|
11
|
+
export { createIntegrationHost, } from "./host.js";
|
|
12
|
+
export { IntegrationRefusedError, IntegrationTimeoutError, } from "@halonicjs/adapters/integration-kit";
|
|
13
|
+
export { leakAttemptCodes } from "./leak-attempt.js";
|
|
14
|
+
export { createLimitedHttpClient, } from "./limited-http.js";
|
|
15
|
+
export { loadIntegration, prepareIntegration, providerChoices, } from "./loader.js";
|
|
16
|
+
export { pluginLoadProblems } from "./plugin-load.js";
|
|
17
|
+
export { allowedUrl, namePattern, } from "./policy.js";
|
|
18
|
+
export { maxRequestBodyBytes } from "./request-body.js";
|
|
19
|
+
export { RequestLog } from "./request-log.js";
|
|
20
|
+
export { scopedTokens, storedTokenName } from "./scoped-tokens.js";
|
|
21
|
+
export { removeSecrets, removeSecretsFromHeaders, removeSecretsStream, SecretRemover, secretForms, secretRemoved, } from "./secret-filter.js";
|
|
22
|
+
export { clampWaitMs, integrationWait } from "./wait.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RefusalCode } from "@halonicjs/adapters/integration-kit";
|
|
2
|
+
/**
|
|
3
|
+
* The refusal codes that mean the integration tried to get a secret out:
|
|
4
|
+
* it carried a secret value in its own request, it asked the kit to
|
|
5
|
+
* place a secret or a sign-in's token somewhere its permission sheet doesn't
|
|
6
|
+
* say, or it asked for a client secret, which only Halonic's sign-in code
|
|
7
|
+
* may send. A connector
|
|
8
|
+
* that gets one of these should be paused, not just shown the error. Every
|
|
9
|
+
* other code is an ordinary mistake, such as a host the sheet doesn't list
|
|
10
|
+
* or a body that is too large, or comes from the server, such as
|
|
11
|
+
* `secret-in-redirect` for a redirect whose URL holds a secret.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* if (leakAttemptCodes.includes(error.code)) pauseConnector(); // "secret-in-request"
|
|
15
|
+
*/
|
|
16
|
+
export declare const leakAttemptCodes: readonly RefusalCode[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The refusal codes that mean the integration tried to get a secret out:
|
|
3
|
+
* it carried a secret value in its own request, it asked the kit to
|
|
4
|
+
* place a secret or a sign-in's token somewhere its permission sheet doesn't
|
|
5
|
+
* say, or it asked for a client secret, which only Halonic's sign-in code
|
|
6
|
+
* may send. A connector
|
|
7
|
+
* that gets one of these should be paused, not just shown the error. Every
|
|
8
|
+
* other code is an ordinary mistake, such as a host the sheet doesn't list
|
|
9
|
+
* or a body that is too large, or comes from the server, such as
|
|
10
|
+
* `secret-in-redirect` for a redirect whose URL holds a secret.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* if (leakAttemptCodes.includes(error.code)) pauseConnector(); // "secret-in-request"
|
|
14
|
+
*/
|
|
15
|
+
export const leakAttemptCodes = Object.freeze([
|
|
16
|
+
"secret-in-request",
|
|
17
|
+
"placement-not-in-sheet",
|
|
18
|
+
"secret-sign-in-only",
|
|
19
|
+
]);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { HttpClient, IntegrationHttpClient, Secrets, SignInTokens } from "../../../core/ports/src/index.js";
|
|
2
|
+
import { type IntegrationPolicy } from "./policy.js";
|
|
3
|
+
import type { RequestLog } from "./request-log.js";
|
|
4
|
+
/**
|
|
5
|
+
* Limits on one request. Every field has a default; the loader sets them
|
|
6
|
+
* from the integration's permission sheet, so a model answer streamed for
|
|
7
|
+
* minutes or a large file export can raise them.
|
|
8
|
+
*/
|
|
9
|
+
export interface RequestLimits {
|
|
10
|
+
/** Waiting for the response headers, redirects included. Default 30 seconds. */
|
|
11
|
+
readonly headersTimeoutMs?: number;
|
|
12
|
+
/** Waiting for the next piece of the body. Default 60 seconds. */
|
|
13
|
+
readonly idleTimeoutMs?: number;
|
|
14
|
+
/** The whole request, reading the body included. Default 10 minutes. */
|
|
15
|
+
readonly timeoutMs?: number;
|
|
16
|
+
/** The response body. Default 10 MiB. */
|
|
17
|
+
readonly maxResponseBytes?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The request body, in bytes sent. Default and ceiling 720 KiB
|
|
20
|
+
* (`maxRequestBodyBytes`): it can be lowered, never raised, so an
|
|
21
|
+
* integration behaves the same in-process and in the fenced runner.
|
|
22
|
+
*/
|
|
23
|
+
readonly maxRequestBodyBytes?: number;
|
|
24
|
+
/** Redirects followed before the request fails. Default 5. */
|
|
25
|
+
readonly maxRedirects?: number;
|
|
26
|
+
}
|
|
27
|
+
/** What {@link createLimitedHttpClient} needs. */
|
|
28
|
+
export interface LimitedHttpOptions {
|
|
29
|
+
readonly policy: IntegrationPolicy;
|
|
30
|
+
/** The real transport underneath, such as the runtime's `fetch`. */
|
|
31
|
+
readonly transport: HttpClient;
|
|
32
|
+
/** Where the kit reads the values of the secrets it places. */
|
|
33
|
+
readonly secrets: Secrets;
|
|
34
|
+
/**
|
|
35
|
+
* Where the kit gets the access token of a sign-in it places, and what it
|
|
36
|
+
* tells when a server answers 401. Without it, a request that places a
|
|
37
|
+
* token is refused as `sign-in-needed`.
|
|
38
|
+
*/
|
|
39
|
+
readonly signInTokens?: SignInTokens;
|
|
40
|
+
readonly log: RequestLog;
|
|
41
|
+
readonly limits?: RequestLimits;
|
|
42
|
+
/** Milliseconds for the request log's timings. Default `Date.now`. */
|
|
43
|
+
readonly now?: () => number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The `HttpClient` an integration gets: only the hosts and secrets of its
|
|
47
|
+
* permission sheet, `https` only (plain `http` only to a local host), every
|
|
48
|
+
* redirect hop checked again, with timeouts and a response size limit. Every
|
|
49
|
+
* request goes into the log.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const http = createLimitedHttpClient({ policy, transport: { fetch }, secrets, log: new RequestLog() });
|
|
53
|
+
* await http.fetch("https://api.example.com/v1", { auth: { secret: "example-key", as: "bearer" } });
|
|
54
|
+
*/
|
|
55
|
+
export declare function createLimitedHttpClient(options: LimitedHttpOptions): IntegrationHttpClient;
|