@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,218 @@
|
|
|
1
|
+
import { passesNameRule } from "../../../../ports/src/index.js";
|
|
2
|
+
import { isSecretVariableName } from "../../../../std/src/index.js";
|
|
3
|
+
import { checkKeysIn } from "../../shared/key-in-value.js";
|
|
4
|
+
import { checkSecretName, looksLikeKey } from "../../shared/secret-name.js";
|
|
5
|
+
import { approveAll, Connector } from "./schema.js";
|
|
6
|
+
/** `library/connectors/<id>.connector.yaml`, shared at the root or a hub's own. */
|
|
7
|
+
export const connectorKind = {
|
|
8
|
+
name: "connector",
|
|
9
|
+
about: "Tools for agents from an MCP server or a built-in service such as Google.",
|
|
10
|
+
syntax: "yaml",
|
|
11
|
+
schema: Connector,
|
|
12
|
+
places: [
|
|
13
|
+
{ scope: "workspace-and-hub", folder: "library/connectors", name: "<id>.connector.yaml" },
|
|
14
|
+
],
|
|
15
|
+
idFromPlace: "fallback",
|
|
16
|
+
check: (connector) => [
|
|
17
|
+
...checkSecretNames(connector),
|
|
18
|
+
...checkGoogleValues(connector),
|
|
19
|
+
...checkPastedKeys(connector),
|
|
20
|
+
...checkInheritedNames(connector),
|
|
21
|
+
...checkApprovedTools(connector),
|
|
22
|
+
...checkReadTools(connector),
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Every value the connector gives as a secret's name: its own `secret` (the
|
|
27
|
+
* HTTP bearer token) and, for a local program, each `secretEnv` value. A
|
|
28
|
+
* Google connector names no secret: see {@link checkGoogleValues}.
|
|
29
|
+
*/
|
|
30
|
+
function secretNames(connector) {
|
|
31
|
+
const names = [];
|
|
32
|
+
if (connector.secret !== undefined && !("google" in connector.transport)) {
|
|
33
|
+
names.push([connector.secret, ["secret"]]);
|
|
34
|
+
}
|
|
35
|
+
if ("stdio" in connector.transport) {
|
|
36
|
+
for (const [variable, name] of Object.entries(connector.transport.stdio.secretEnv ?? {})) {
|
|
37
|
+
names.push([name, ["transport", "stdio", "secretEnv", variable]]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return names;
|
|
41
|
+
}
|
|
42
|
+
/** The secrets are named in the file, so a bad name or a pasted key is caught here, not at run time. */
|
|
43
|
+
function checkSecretNames(connector) {
|
|
44
|
+
return secretNames(connector).flatMap(([name, path]) => checkSecretName(name, path) ?? []);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A Google connector's `client` and `secret` name no secret. The account's
|
|
48
|
+
* Google setup decides which OAuth client a sign-in uses and keeps the
|
|
49
|
+
* refresh token as `google-account-<accountRef>` (`google-setup.store-names`).
|
|
50
|
+
* Both stay so older files still read, and both are refused only when they
|
|
51
|
+
* hold a pasted key, since the file may be committed or shared.
|
|
52
|
+
*/
|
|
53
|
+
function checkGoogleValues(connector) {
|
|
54
|
+
if (!("google" in connector.transport)) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
const values = [
|
|
58
|
+
[connector.transport.google.client, ["transport", "google", "client"]],
|
|
59
|
+
[connector.secret, ["secret"]],
|
|
60
|
+
];
|
|
61
|
+
return values.flatMap(([value, path]) => value !== undefined && looksLikeKey(value) ? (checkSecretName(value, path) ?? []) : []);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* HTTP headers and a local program's `env` and `args` take any text, so a
|
|
65
|
+
* key pasted there would be saved in the file. The connector's `secret` and
|
|
66
|
+
* `secretEnv` name the secrets instead.
|
|
67
|
+
*/
|
|
68
|
+
function checkPastedKeys(connector) {
|
|
69
|
+
const { transport } = connector;
|
|
70
|
+
if ("http" in transport) {
|
|
71
|
+
return checkKeysIn(transport.http.headers, ["transport", "http", "headers"], "header");
|
|
72
|
+
}
|
|
73
|
+
if ("stdio" in transport) {
|
|
74
|
+
const path = ["transport", "stdio"];
|
|
75
|
+
return [
|
|
76
|
+
...checkKeysIn(transport.stdio.env, [...path, "env"], "env"),
|
|
77
|
+
...transport.stdio.args.flatMap((arg, index) => {
|
|
78
|
+
const [name, value] = argument(arg, transport.stdio.args[index - 1]);
|
|
79
|
+
return checkKeysIn(value, [...path, "args", index], "arg", name);
|
|
80
|
+
}),
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
/** A variable name a program can be given: letters, digits and `_`, not starting with a digit. */
|
|
86
|
+
const variableName = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
87
|
+
/*
|
|
88
|
+
* The words are the team's (HAL-6266), next to the placeholders of
|
|
89
|
+
* `secret-name.ts` and `key-in-value.ts` that wait on the board.
|
|
90
|
+
*/
|
|
91
|
+
const inheritWords = {
|
|
92
|
+
"inherit-env-name": (name) => `"${name}" isn't a variable name. Use only letters, digits and _, not starting with a digit.`,
|
|
93
|
+
"inherit-env-secret": (name) => `"${name}" looks like it holds a secret, so it can't be taken from your environment. Store the value as a secret and set this variable under secretEnv to the secret's name instead.`,
|
|
94
|
+
"inherit-env-duplicate": (name) => `"${name}" is already in this list. Name each variable once, whatever its letter case.`,
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* `inheritEnv` names variables a local program takes from the app's own
|
|
98
|
+
* environment. A name that says it holds a secret, such as
|
|
99
|
+
* `ANTHROPIC_API_KEY`, is refused: a workspace file must not reach for a
|
|
100
|
+
* key in the person's shell, and `secretEnv` names the secret openly. A name
|
|
101
|
+
* written twice, in any letter case, is refused too, since Windows reads
|
|
102
|
+
* `Aws_Profile` and `AWS_PROFILE` as one variable.
|
|
103
|
+
*/
|
|
104
|
+
function checkInheritedNames(connector) {
|
|
105
|
+
if (!("stdio" in connector.transport)) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const problems = [];
|
|
109
|
+
const seen = new Set();
|
|
110
|
+
(connector.transport.stdio.inheritEnv ?? []).forEach((name, index) => {
|
|
111
|
+
const path = ["transport", "stdio", "inheritEnv", index];
|
|
112
|
+
const folded = name.toUpperCase();
|
|
113
|
+
const repeated = seen.has(folded);
|
|
114
|
+
seen.add(folded);
|
|
115
|
+
if (!variableName.test(name)) {
|
|
116
|
+
const code = "inherit-env-name";
|
|
117
|
+
problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
|
|
118
|
+
}
|
|
119
|
+
else if (isSecretVariableName(name)) {
|
|
120
|
+
const code = "inherit-env-secret";
|
|
121
|
+
problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
|
|
122
|
+
}
|
|
123
|
+
else if (repeated) {
|
|
124
|
+
const code = "inherit-env-duplicate";
|
|
125
|
+
problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return problems;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* An argument's value and the option it belongs to: `--api-key=…` and
|
|
132
|
+
* `--api-key …` both name the value, so a key without a known format is
|
|
133
|
+
* still caught after a flag that says it is one.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* argument("--token=abc", undefined); // ["--token", "abc"]
|
|
137
|
+
* argument("abc", "--token"); // ["--token", "abc"]
|
|
138
|
+
*/
|
|
139
|
+
function argument(arg, before) {
|
|
140
|
+
const equals = arg.indexOf("=");
|
|
141
|
+
if (arg.startsWith("-") && equals > 0) {
|
|
142
|
+
return [arg.slice(0, equals), arg.slice(equals + 1)];
|
|
143
|
+
}
|
|
144
|
+
return [before?.startsWith("-") ? before : undefined, arg];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A tool that needs approval but isn't in `tools.allow` is never offered, so
|
|
148
|
+
* say so. `approve: all` names no tool, so there is nothing to compare.
|
|
149
|
+
*/
|
|
150
|
+
function checkApprovedTools(connector) {
|
|
151
|
+
const { allow, approve } = connector.tools;
|
|
152
|
+
const problems = [];
|
|
153
|
+
if (allow === undefined || approve === approveAll) {
|
|
154
|
+
return problems;
|
|
155
|
+
}
|
|
156
|
+
approve.forEach((tool, index) => {
|
|
157
|
+
if (allow.includes(tool)) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
problems.push({
|
|
161
|
+
severity: "warning",
|
|
162
|
+
code: "approved-tool-not-allowed",
|
|
163
|
+
path: ["tools", "approve", index],
|
|
164
|
+
message: `Connector "${connector.id}": "${tool}" needs approval but is not in tools.allow, so agents never see it`,
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
return problems;
|
|
168
|
+
}
|
|
169
|
+
/** Characters that make a name in `tools.read` look like a pattern, not a tool's name. */
|
|
170
|
+
const patternCharacters = /[*?[\]{}]/;
|
|
171
|
+
/**
|
|
172
|
+
* Said when a name in `tools.read` fails the listed-tool name rule. It
|
|
173
|
+
* doesn't quote the name: the character at fault may be invisible, so the
|
|
174
|
+
* name would look right. Wording: Sofia, HAL-5762.
|
|
175
|
+
*/
|
|
176
|
+
const readNameBreaksRule = `"read" needs exact tool names: letters a–z and A–Z, digits 0–9, "_" and "-", up to 64 characters. This one doesn't match, often because of a space, a look-alike letter or an invisible character.`;
|
|
177
|
+
/**
|
|
178
|
+
* `tools.read` takes exact names only, so a pattern is refused rather than
|
|
179
|
+
* matching nothing in silence. A name must also pass the name rule that a
|
|
180
|
+
* server's tool names pass, so a look-alike letter, a space or an invisible
|
|
181
|
+
* character can't make a name read as one tool and be another; it is
|
|
182
|
+
* refused too. A name that `tools.allow` leaves out is never offered, so
|
|
183
|
+
* say so. Without `tools.allow` nothing checks the names against a listing:
|
|
184
|
+
* a name, exactly as written, makes a tool `read` as soon as a server lists
|
|
185
|
+
* a tool by that name. Wording: Sofia, HAL-5582 and HAL-5762.
|
|
186
|
+
*/
|
|
187
|
+
function checkReadTools(connector) {
|
|
188
|
+
const { allow, read } = connector.tools;
|
|
189
|
+
const problems = [];
|
|
190
|
+
read?.forEach((tool, index) => {
|
|
191
|
+
const path = ["tools", "read", index];
|
|
192
|
+
if (patternCharacters.test(tool)) {
|
|
193
|
+
problems.push({
|
|
194
|
+
severity: "error",
|
|
195
|
+
code: "read-tool-pattern",
|
|
196
|
+
path,
|
|
197
|
+
message: `"read" needs exact tool names. "${tool}" looks like a pattern.`,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
else if (!passesNameRule(tool)) {
|
|
201
|
+
problems.push({
|
|
202
|
+
severity: "error",
|
|
203
|
+
code: "read-tool-name",
|
|
204
|
+
path,
|
|
205
|
+
message: readNameBreaksRule,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
else if (allow !== undefined && !allow.includes(tool)) {
|
|
209
|
+
problems.push({
|
|
210
|
+
severity: "warning",
|
|
211
|
+
code: "read-tool-not-allowed",
|
|
212
|
+
path,
|
|
213
|
+
message: `"read" lists "${tool}", but this connector has no tool by that name. Check the spelling.`,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
return problems;
|
|
218
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type Infer } from "../../../../schema-kit/src/index.js";
|
|
2
|
+
/** The `tools.approve` value that makes every tool of the connector ask a person first. */
|
|
3
|
+
export declare const approveAll = "all";
|
|
4
|
+
/**
|
|
5
|
+
* `library/connectors/<id>.connector.yaml`: tools for agents from an MCP
|
|
6
|
+
* server or a built-in service. Secrets are referenced by name only.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Connector: import("zod").ZodObject<{
|
|
9
|
+
version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
|
|
10
|
+
id: import("zod").ZodString;
|
|
11
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
12
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
13
|
+
transport: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
14
|
+
http: import("zod").ZodObject<{
|
|
15
|
+
url: import("zod").ZodString;
|
|
16
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
17
|
+
}, import("zod/v4/core").$strict>;
|
|
18
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
19
|
+
stdio: import("zod").ZodObject<{
|
|
20
|
+
command: import("zod").ZodString;
|
|
21
|
+
args: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
22
|
+
env: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
23
|
+
secretEnv: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
24
|
+
inheritEnv: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
25
|
+
cwd: import("zod").ZodOptional<import("zod").ZodString>;
|
|
26
|
+
sites: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
27
|
+
}, import("zod/v4/core").$strict>;
|
|
28
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
29
|
+
google: import("zod").ZodObject<{
|
|
30
|
+
account: import("zod").ZodString;
|
|
31
|
+
client: import("zod").ZodDefault<import("zod").ZodString>;
|
|
32
|
+
}, import("zod/v4/core").$strict>;
|
|
33
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
34
|
+
integration: import("zod").ZodObject<{
|
|
35
|
+
folder: import("zod").ZodString;
|
|
36
|
+
}, import("zod/v4/core").$strict>;
|
|
37
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
38
|
+
plugin: import("zod").ZodObject<{
|
|
39
|
+
id: import("zod").ZodString;
|
|
40
|
+
}, import("zod/v4/core").$strict>;
|
|
41
|
+
}, import("zod/v4/core").$strict>]>;
|
|
42
|
+
secret: import("zod").ZodOptional<import("zod").ZodString>;
|
|
43
|
+
tools: import("zod").ZodDefault<import("zod").ZodObject<{
|
|
44
|
+
allow: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
45
|
+
approve: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodArray<import("zod").ZodString>, import("zod").ZodLiteral<"all">]>>;
|
|
46
|
+
read: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
47
|
+
}, import("zod/v4/core").$strict>>;
|
|
48
|
+
local: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
49
|
+
}, import("zod/v4/core").$strict>;
|
|
50
|
+
/** A connector, with defaults filled in. */
|
|
51
|
+
export type Connector = Infer<typeof Connector>;
|
|
52
|
+
/**
|
|
53
|
+
* Whether every call to `tool` waits for a person, as the connector's
|
|
54
|
+
* `tools.approve` says: the tool is listed there, or it says `all`.
|
|
55
|
+
* `tool` is the name the server lists the tool under.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* needsApproval({ approve: "all" }, "delete_file"); // true
|
|
59
|
+
* needsApproval({ approve: ["send_mail"] }, "read_mail"); // false
|
|
60
|
+
*/
|
|
61
|
+
export declare function needsApproval(tools: Pick<Connector["tools"], "approve">, tool: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the workspace marks `tool` as only reading, as the connector's
|
|
64
|
+
* `tools.read` says: the list names it exactly, and `tools.approve` doesn't
|
|
65
|
+
* make it ask first, so `approve` wins when both name a tool. `tool` is the
|
|
66
|
+
* name the server lists the tool under. A tool this says `false` for counts
|
|
67
|
+
* as `write`, or `send` when its listing says so.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* marksRead({ approve: [], read: ["search_issues"] }, "search_issues"); // true
|
|
71
|
+
* marksRead({ approve: ["search_issues"], read: ["search_issues"] }, "search_issues"); // false
|
|
72
|
+
* marksRead({ approve: [] }, "search_issues"); // false
|
|
73
|
+
*/
|
|
74
|
+
export declare function marksRead(tools: Pick<Connector["tools"], "approve" | "read">, tool: string): boolean;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { s } from "../../../../schema-kit/src/index.js";
|
|
2
|
+
import { id, version } from "../../shared/fields.js";
|
|
3
|
+
import { AllowedSitesInUnion } from "../agent/sandbox-fields.js";
|
|
4
|
+
/** A remote MCP server over HTTP. */
|
|
5
|
+
const HttpTransport = s
|
|
6
|
+
.object({
|
|
7
|
+
http: s
|
|
8
|
+
.object({ url: s.string().url(), headers: s.record(s.string(), s.string()).optional() })
|
|
9
|
+
.strict(),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
12
|
+
/** A local MCP program over standard input and output. */
|
|
13
|
+
const StdioTransport = s
|
|
14
|
+
.object({
|
|
15
|
+
stdio: s
|
|
16
|
+
.object({
|
|
17
|
+
command: s.string().min(1),
|
|
18
|
+
args: s.array(s.string()).default([]),
|
|
19
|
+
/** Plain environment variables; secrets go in `secretEnv`. */
|
|
20
|
+
env: s.record(s.string(), s.string()).optional(),
|
|
21
|
+
/** Environment variable → secret name. */
|
|
22
|
+
secretEnv: s.record(s.string(), s.string()).optional(),
|
|
23
|
+
/**
|
|
24
|
+
* Variables taken from the app's own environment by name, such as
|
|
25
|
+
* `AWS_PROFILE`, on top of the base every program gets. No secret:
|
|
26
|
+
* a key goes in `secretEnv`.
|
|
27
|
+
*/
|
|
28
|
+
inheritEnv: s.array(s.string()).optional(),
|
|
29
|
+
/** Working directory, relative to the workspace root. */
|
|
30
|
+
cwd: s.string().optional(),
|
|
31
|
+
/**
|
|
32
|
+
* The sites the program may reach when it runs in a sandbox: host
|
|
33
|
+
* names or `*.` and a domain, with the agent file's `allowedSites`
|
|
34
|
+
* rules. Without a sandbox the program runs as before, unfenced.
|
|
35
|
+
*/
|
|
36
|
+
sites: AllowedSitesInUnion.optional(),
|
|
37
|
+
})
|
|
38
|
+
.strict(),
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
41
|
+
/** Built-in Gmail and Google Drive for one Google account. */
|
|
42
|
+
const GoogleTransport = s
|
|
43
|
+
.object({
|
|
44
|
+
google: s
|
|
45
|
+
.object({
|
|
46
|
+
/** The Google account the connector acts as. */
|
|
47
|
+
account: s.string().email(),
|
|
48
|
+
/**
|
|
49
|
+
* Kept so older files still read. It names no secret: the OAuth
|
|
50
|
+
* client's ID and secret come from the account's Google setup, which
|
|
51
|
+
* only the host's setup routes write (`@halonicjs/google-setup`).
|
|
52
|
+
*/
|
|
53
|
+
client: s.string().default("google"),
|
|
54
|
+
})
|
|
55
|
+
.strict(),
|
|
56
|
+
})
|
|
57
|
+
.strict();
|
|
58
|
+
/**
|
|
59
|
+
* A local integration: a folder under `integrations/` whose code runs in the
|
|
60
|
+
* I5 runner. The tools offered are the ones its permission sheet names.
|
|
61
|
+
*/
|
|
62
|
+
const IntegrationTransport = s.object({ integration: s.object({ folder: id }).strict() }).strict();
|
|
63
|
+
/** A plugin's backend, started in the I5 runner. Same rules as a local integration. */
|
|
64
|
+
const PluginTransport = s.object({ plugin: s.object({ id }).strict() }).strict();
|
|
65
|
+
/** The `tools.approve` value that makes every tool of the connector ask a person first. */
|
|
66
|
+
export const approveAll = "all";
|
|
67
|
+
/** Said when `tools.read` isn't a list of tool names. Wording: Sofia, HAL-5582. */
|
|
68
|
+
const readNotAList = '"read" must be a list of tool names.';
|
|
69
|
+
/**
|
|
70
|
+
* `library/connectors/<id>.connector.yaml`: tools for agents from an MCP
|
|
71
|
+
* server or a built-in service. Secrets are referenced by name only.
|
|
72
|
+
*/
|
|
73
|
+
export const Connector = s
|
|
74
|
+
.object({
|
|
75
|
+
version,
|
|
76
|
+
id,
|
|
77
|
+
name: s.string().optional(),
|
|
78
|
+
description: s.string().optional(),
|
|
79
|
+
transport: s.union([
|
|
80
|
+
HttpTransport,
|
|
81
|
+
StdioTransport,
|
|
82
|
+
GoogleTransport,
|
|
83
|
+
IntegrationTransport,
|
|
84
|
+
PluginTransport,
|
|
85
|
+
]),
|
|
86
|
+
/**
|
|
87
|
+
* HTTP: the secret sent as a bearer token. Google: kept so older files
|
|
88
|
+
* still read, but it names no secret: the account's Google setup keeps
|
|
89
|
+
* the refresh token (`@halonicjs/google-setup`).
|
|
90
|
+
*/
|
|
91
|
+
secret: s.string().optional(),
|
|
92
|
+
tools: s
|
|
93
|
+
.object({
|
|
94
|
+
/** Only these tools are offered to agents. Leave out to offer every tool. */
|
|
95
|
+
allow: s.array(s.string()).optional(),
|
|
96
|
+
/**
|
|
97
|
+
* Every call to these tools waits for a person to approve or reject
|
|
98
|
+
* it. `all` means every tool the server offers, including tools it
|
|
99
|
+
* adds later: a new MCP connector starts with it.
|
|
100
|
+
*/
|
|
101
|
+
approve: s.union([s.array(s.string()), s.literal(approveAll)]).default([]),
|
|
102
|
+
/**
|
|
103
|
+
* Tools listed here run without asking. Only list tools that don't
|
|
104
|
+
* change anything. Exact names only, no patterns: every tool not
|
|
105
|
+
* listed still asks first, and a tool `approve` names asks whatever
|
|
106
|
+
* this list says. Only the person writing this file sets it; nothing
|
|
107
|
+
* a connector's server lists can add a tool to it.
|
|
108
|
+
*/
|
|
109
|
+
read: s.array(s.string({ error: readNotAList }), { error: readNotAList }).optional(),
|
|
110
|
+
})
|
|
111
|
+
.strict()
|
|
112
|
+
.default({ approve: [] }),
|
|
113
|
+
/** Runs on this machine or your own network. Default: true for stdio and localhost URLs, false for integrations and plugins, whose sheet can name outside sites. */
|
|
114
|
+
local: s.boolean().optional(),
|
|
115
|
+
})
|
|
116
|
+
.strict();
|
|
117
|
+
/**
|
|
118
|
+
* Whether every call to `tool` waits for a person, as the connector's
|
|
119
|
+
* `tools.approve` says: the tool is listed there, or it says `all`.
|
|
120
|
+
* `tool` is the name the server lists the tool under.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* needsApproval({ approve: "all" }, "delete_file"); // true
|
|
124
|
+
* needsApproval({ approve: ["send_mail"] }, "read_mail"); // false
|
|
125
|
+
*/
|
|
126
|
+
export function needsApproval(tools, tool) {
|
|
127
|
+
return tools.approve === approveAll || tools.approve.includes(tool);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Whether the workspace marks `tool` as only reading, as the connector's
|
|
131
|
+
* `tools.read` says: the list names it exactly, and `tools.approve` doesn't
|
|
132
|
+
* make it ask first, so `approve` wins when both name a tool. `tool` is the
|
|
133
|
+
* name the server lists the tool under. A tool this says `false` for counts
|
|
134
|
+
* as `write`, or `send` when its listing says so.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* marksRead({ approve: [], read: ["search_issues"] }, "search_issues"); // true
|
|
138
|
+
* marksRead({ approve: ["search_issues"], read: ["search_issues"] }, "search_issues"); // false
|
|
139
|
+
* marksRead({ approve: [] }, "search_issues"); // false
|
|
140
|
+
*/
|
|
141
|
+
export function marksRead(tools, tool) {
|
|
142
|
+
return (tools.read?.includes(tool) ?? false) && !needsApproval(tools, tool);
|
|
143
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Deployments } from "./schema.js";
|
|
2
|
+
/** `deployments.yaml` at the workspace root. */
|
|
3
|
+
export const deploymentsKind = {
|
|
4
|
+
name: "deployments",
|
|
5
|
+
about: "The places the workspace runs, each with its own runtime data.",
|
|
6
|
+
syntax: "yaml",
|
|
7
|
+
schema: Deployments,
|
|
8
|
+
places: [{ scope: "workspace", folder: "", name: "deployments.yaml" }],
|
|
9
|
+
idFromPlace: "none",
|
|
10
|
+
check: checkDeployments,
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The default deployment, when one is named, must be one of the listed ones,
|
|
14
|
+
* and Cloudflare settings on another host are flagged as unused.
|
|
15
|
+
*/
|
|
16
|
+
function checkDeployments(file) {
|
|
17
|
+
return [...checkDefault(file), ...checkUnusedCloudflare(file)];
|
|
18
|
+
}
|
|
19
|
+
/** The default deployment, when one is named, must be one of the listed ones. */
|
|
20
|
+
function checkDefault(file) {
|
|
21
|
+
if (file.default === undefined || Object.hasOwn(file.deployments, file.default)) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
severity: "error",
|
|
27
|
+
code: "default-deployment-not-listed",
|
|
28
|
+
path: ["default"],
|
|
29
|
+
message: `The default deployment "${file.default}" is not listed`,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Cloudflare settings on a deployment that runs elsewhere are a warning, not
|
|
35
|
+
* an error: moving a deployment to another host changes only `host:`, so the
|
|
36
|
+
* settings may stay behind for the way back (ADR HAL-35, 2).
|
|
37
|
+
*/
|
|
38
|
+
function checkUnusedCloudflare(file) {
|
|
39
|
+
return Object.entries(file.deployments).flatMap(([id, deployment]) => deployment.cloudflare === undefined || deployment.host === "cloudflare"
|
|
40
|
+
? []
|
|
41
|
+
: [
|
|
42
|
+
{
|
|
43
|
+
severity: "warning",
|
|
44
|
+
code: "cloudflare-settings-unused",
|
|
45
|
+
path: ["deployments", id, "cloudflare"],
|
|
46
|
+
message: `Deployment "${id}" runs on host "${deployment.host}", so its cloudflare settings are not used`,
|
|
47
|
+
},
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type Infer } from "../../../../schema-kit/src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Non-secret settings for a deployment with `host: cloudflare` (ADR HAL-35,
|
|
4
|
+
* 5.7). They carry no account id, token or key, so the file stays safe to
|
|
5
|
+
* commit and the same file deploys from any account.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CloudflareSettings: import("zod").ZodObject<{
|
|
8
|
+
worker: import("zod").ZodString;
|
|
9
|
+
domain: import("zod").ZodOptional<import("zod").ZodString>;
|
|
10
|
+
location: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
11
|
+
eu: "eu";
|
|
12
|
+
}>>;
|
|
13
|
+
}, import("zod/v4/core").$strict>;
|
|
14
|
+
/** Ceilings the deployment's handler enforces, because Cloudflare has no hard spending cap. */
|
|
15
|
+
export declare const DeploymentLimits: import("zod").ZodObject<{
|
|
16
|
+
dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
17
|
+
}, import("zod/v4/core").$strict>;
|
|
18
|
+
/** One place the workspace runs, with its own data (runs, Inbox, records, simulations). */
|
|
19
|
+
export declare const Deployment: import("zod").ZodObject<{
|
|
20
|
+
name: import("zod").ZodString;
|
|
21
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
22
|
+
host: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
23
|
+
cloudflare: "cloudflare";
|
|
24
|
+
local: "local";
|
|
25
|
+
}>>;
|
|
26
|
+
stage: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
27
|
+
development: "development";
|
|
28
|
+
production: "production";
|
|
29
|
+
}>>;
|
|
30
|
+
shadow: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
31
|
+
cloudflare: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
32
|
+
worker: import("zod").ZodString;
|
|
33
|
+
domain: import("zod").ZodOptional<import("zod").ZodString>;
|
|
34
|
+
location: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
35
|
+
eu: "eu";
|
|
36
|
+
}>>;
|
|
37
|
+
}, import("zod/v4/core").$strict>>;
|
|
38
|
+
limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
39
|
+
dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
40
|
+
}, import("zod/v4/core").$strict>>;
|
|
41
|
+
}, import("zod/v4/core").$strict>;
|
|
42
|
+
/** `deployments.yaml`: the places the workspace runs. */
|
|
43
|
+
export declare const Deployments: import("zod").ZodObject<{
|
|
44
|
+
version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
|
|
45
|
+
default: import("zod").ZodOptional<import("zod").ZodString>;
|
|
46
|
+
deployments: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
47
|
+
name: import("zod").ZodString;
|
|
48
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
49
|
+
host: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
50
|
+
cloudflare: "cloudflare";
|
|
51
|
+
local: "local";
|
|
52
|
+
}>>;
|
|
53
|
+
stage: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
54
|
+
development: "development";
|
|
55
|
+
production: "production";
|
|
56
|
+
}>>;
|
|
57
|
+
shadow: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
58
|
+
cloudflare: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
59
|
+
worker: import("zod").ZodString;
|
|
60
|
+
domain: import("zod").ZodOptional<import("zod").ZodString>;
|
|
61
|
+
location: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
62
|
+
eu: "eu";
|
|
63
|
+
}>>;
|
|
64
|
+
}, import("zod/v4/core").$strict>>;
|
|
65
|
+
limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
66
|
+
dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
67
|
+
}, import("zod/v4/core").$strict>>;
|
|
68
|
+
}, import("zod/v4/core").$strict>>;
|
|
69
|
+
}, import("zod/v4/core").$strict>;
|
|
70
|
+
/** A deployment's Cloudflare settings. */
|
|
71
|
+
export type CloudflareSettings = Infer<typeof CloudflareSettings>;
|
|
72
|
+
/** A deployment's ceilings. */
|
|
73
|
+
export type DeploymentLimits = Infer<typeof DeploymentLimits>;
|
|
74
|
+
/** One deployment, with defaults filled in. */
|
|
75
|
+
export type Deployment = Infer<typeof Deployment>;
|
|
76
|
+
/** The content of `deployments.yaml`, with defaults filled in. */
|
|
77
|
+
export type Deployments = Infer<typeof Deployments>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { s } from "../../../../schema-kit/src/index.js";
|
|
2
|
+
import { deploymentId, version } from "../../shared/fields.js";
|
|
3
|
+
/**
|
|
4
|
+
* The most characters a Worker name may have: it becomes the first label of
|
|
5
|
+
* `<worker>.<account>.workers.dev`, and a DNS label holds at most 63.
|
|
6
|
+
*/
|
|
7
|
+
const WORKER_NAME_MAX_LENGTH = 63;
|
|
8
|
+
/** The most characters a host name may have in DNS. */
|
|
9
|
+
const HOST_NAME_MAX_LENGTH = 253;
|
|
10
|
+
/**
|
|
11
|
+
* A host name: lowercase labels of letters, digits and inner `-`, joined by
|
|
12
|
+
* dots, with a top-level label that isn't all digits. The length cap is a
|
|
13
|
+
* separate `maxLength`, not a lookahead, so the JSON Schema's pattern also
|
|
14
|
+
* works in Go and Rust regex libraries, which have no lookaround.
|
|
15
|
+
*/
|
|
16
|
+
const HOST_NAME_PATTERN = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
17
|
+
/**
|
|
18
|
+
* Non-secret settings for a deployment with `host: cloudflare` (ADR HAL-35,
|
|
19
|
+
* 5.7). They carry no account id, token or key, so the file stays safe to
|
|
20
|
+
* commit and the same file deploys from any account.
|
|
21
|
+
*/
|
|
22
|
+
export const CloudflareSettings = s
|
|
23
|
+
.object({
|
|
24
|
+
/** The Worker's name; it serves at `<worker>.<account>.workers.dev`. */
|
|
25
|
+
worker: s
|
|
26
|
+
.string()
|
|
27
|
+
.min(1)
|
|
28
|
+
.max(WORKER_NAME_MAX_LENGTH, `use at most ${WORKER_NAME_MAX_LENGTH} characters, so the name fits in a workers.dev address`)
|
|
29
|
+
.regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/, "use lowercase letters, digits or '-', not at the start or end"),
|
|
30
|
+
/** A custom domain the Worker also serves at, such as `halonic.example.com`. */
|
|
31
|
+
domain: s
|
|
32
|
+
.string()
|
|
33
|
+
.max(HOST_NAME_MAX_LENGTH, `use at most ${HOST_NAME_MAX_LENGTH} characters`)
|
|
34
|
+
.regex(HOST_NAME_PATTERN, "use a lowercase host name such as halonic.example.com")
|
|
35
|
+
.optional(),
|
|
36
|
+
/**
|
|
37
|
+
* Where the deployment keeps its data. `eu` keeps D1, R2 and Durable
|
|
38
|
+
* Objects in the EU jurisdiction. Cloudflare fixes it when the data is
|
|
39
|
+
* first created, so changing it later needs an export and an import.
|
|
40
|
+
*/
|
|
41
|
+
location: s.enum(["eu"]).optional(),
|
|
42
|
+
})
|
|
43
|
+
.strict();
|
|
44
|
+
/** Ceilings the deployment's handler enforces, because Cloudflare has no hard spending cap. */
|
|
45
|
+
export const DeploymentLimits = s
|
|
46
|
+
.object({
|
|
47
|
+
/** The most requests the deployment answers per UTC day; beyond it, it refuses them. */
|
|
48
|
+
dailyRequests: s.number().int().positive().optional(),
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
51
|
+
/** One place the workspace runs, with its own data (runs, Inbox, records, simulations). */
|
|
52
|
+
export const Deployment = s
|
|
53
|
+
.object({
|
|
54
|
+
name: s.string().min(1),
|
|
55
|
+
description: s.string().optional(),
|
|
56
|
+
/** Where it runs: `halonic serve` on a machine, or Cloudflare. */
|
|
57
|
+
host: s.enum(["local", "cloudflare"]).default("local"),
|
|
58
|
+
stage: s.enum(["development", "production"]).default("development"),
|
|
59
|
+
/** Every write a connector would make is only recorded, never done. */
|
|
60
|
+
shadow: s.boolean().default(false),
|
|
61
|
+
/** Settings used when `host` is `cloudflare`. */
|
|
62
|
+
cloudflare: CloudflareSettings.optional(),
|
|
63
|
+
/** Ceilings on what the deployment answers, such as requests per day. */
|
|
64
|
+
limits: DeploymentLimits.optional(),
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
67
|
+
/** `deployments.yaml`: the places the workspace runs. */
|
|
68
|
+
export const Deployments = s
|
|
69
|
+
.object({
|
|
70
|
+
version,
|
|
71
|
+
/** The deployment `halonic serve` runs when none is named. */
|
|
72
|
+
default: s.string().optional(),
|
|
73
|
+
deployments: s
|
|
74
|
+
.record(deploymentId, Deployment, { error: deploymentIdProblem })
|
|
75
|
+
.refine((named) => Object.keys(named).length > 0, "Name at least one deployment"),
|
|
76
|
+
})
|
|
77
|
+
.strict();
|
|
78
|
+
/**
|
|
79
|
+
* Says why a deployment id was refused. Without it a refused key only reads
|
|
80
|
+
* "Invalid key in record", which doesn't tell the person what to change.
|
|
81
|
+
*/
|
|
82
|
+
function deploymentIdProblem(issue) {
|
|
83
|
+
if (issue.code !== "invalid_key" || !Array.isArray(issue.issues)) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
const reasons = issue.issues.flatMap((keyIssue) => {
|
|
87
|
+
const isMessage = typeof keyIssue === "object" &&
|
|
88
|
+
keyIssue !== null &&
|
|
89
|
+
"message" in keyIssue &&
|
|
90
|
+
typeof keyIssue.message === "string";
|
|
91
|
+
return isMessage ? [keyIssue.message] : [];
|
|
92
|
+
});
|
|
93
|
+
return `Not a deployment id: ${reasons.join("; ")}`;
|
|
94
|
+
}
|