@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,64 @@
|
|
|
1
|
+
import type { FileKind } from "./kind.js";
|
|
2
|
+
import type { Agent } from "./kinds/agent/schema.js";
|
|
3
|
+
import type { Collection } from "./kinds/collection/schema.js";
|
|
4
|
+
import type { Connector } from "./kinds/connector/schema.js";
|
|
5
|
+
import type { Deployments } from "./kinds/deployments/schema.js";
|
|
6
|
+
import type { Hub } from "./kinds/hub/schema.js";
|
|
7
|
+
import type { IntegrationSheet } from "./kinds/integration/schema.js";
|
|
8
|
+
import type { KnowledgeSource } from "./kinds/knowledge/schema.js";
|
|
9
|
+
import type { Models } from "./kinds/models/schema.js";
|
|
10
|
+
import type { Plugin } from "./kinds/plugin/schema.js";
|
|
11
|
+
import type { Provider } from "./kinds/provider/schema.js";
|
|
12
|
+
import type { Routine } from "./kinds/routine/schema.js";
|
|
13
|
+
import type { Runtime } from "./kinds/runtime/schema.js";
|
|
14
|
+
import type { Skill } from "./kinds/skill/schema.js";
|
|
15
|
+
import type { Workflow } from "./kinds/workflow/schema.js";
|
|
16
|
+
import type { WorkflowTest } from "./kinds/workflow-test/schema.js";
|
|
17
|
+
import type { WorkspaceSettings } from "./kinds/workspace/schema.js";
|
|
18
|
+
/** The value each file kind parses to, by kind name. */
|
|
19
|
+
export interface KindValues {
|
|
20
|
+
workspace: WorkspaceSettings;
|
|
21
|
+
deployments: Deployments;
|
|
22
|
+
models: Models;
|
|
23
|
+
provider: Provider;
|
|
24
|
+
runtime: Runtime;
|
|
25
|
+
knowledge: KnowledgeSource;
|
|
26
|
+
collection: Collection;
|
|
27
|
+
connector: Connector;
|
|
28
|
+
skill: Skill;
|
|
29
|
+
hub: Hub;
|
|
30
|
+
agent: Agent;
|
|
31
|
+
workflow: Workflow;
|
|
32
|
+
workflowTest: WorkflowTest;
|
|
33
|
+
routine: Routine;
|
|
34
|
+
integration: IntegrationSheet;
|
|
35
|
+
plugin: Plugin;
|
|
36
|
+
}
|
|
37
|
+
/** The name of a file kind: `workspace`, `agent`, `workflowTest`, … */
|
|
38
|
+
export type KindName = keyof KindValues;
|
|
39
|
+
/**
|
|
40
|
+
* Every file kind, by name. Adding a kind means adding its folder under
|
|
41
|
+
* `kinds/` and one line here; the loader and the tooling read this list
|
|
42
|
+
* instead of switching on kind names.
|
|
43
|
+
*/
|
|
44
|
+
export declare const fileKinds: {
|
|
45
|
+
readonly [Name in KindName]: FileKind<KindValues[Name]>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The names of every file kind, workspace-level kinds first and the
|
|
49
|
+
* integration sheet and the plugin manifest, which sit outside workspaces,
|
|
50
|
+
* last, in a fixed order.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* for (const name of kindNames()) console.log(name, fileKinds[name].about);
|
|
54
|
+
*/
|
|
55
|
+
export declare function kindNames(): readonly KindName[];
|
|
56
|
+
/**
|
|
57
|
+
* Whether a text names a file kind, for input from outside such as a CLI
|
|
58
|
+
* argument.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* isKindName("agent"); // true
|
|
62
|
+
* isKindName("toString"); // false
|
|
63
|
+
*/
|
|
64
|
+
export declare function isKindName(name: string): name is KindName;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { agentKind } from "./kinds/agent/kind.js";
|
|
2
|
+
import { collectionKind } from "./kinds/collection/kind.js";
|
|
3
|
+
import { connectorKind } from "./kinds/connector/kind.js";
|
|
4
|
+
import { deploymentsKind } from "./kinds/deployments/kind.js";
|
|
5
|
+
import { hubKind } from "./kinds/hub/kind.js";
|
|
6
|
+
import { integrationKind } from "./kinds/integration/kind.js";
|
|
7
|
+
import { knowledgeKind } from "./kinds/knowledge/kind.js";
|
|
8
|
+
import { modelsKind } from "./kinds/models/kind.js";
|
|
9
|
+
import { pluginKind } from "./kinds/plugin/kind.js";
|
|
10
|
+
import { providerKind } from "./kinds/provider/kind.js";
|
|
11
|
+
import { routineKind } from "./kinds/routine/kind.js";
|
|
12
|
+
import { runtimeKind } from "./kinds/runtime/kind.js";
|
|
13
|
+
import { skillKind } from "./kinds/skill/kind.js";
|
|
14
|
+
import { workflowKind } from "./kinds/workflow/kind.js";
|
|
15
|
+
import { workflowTestKind } from "./kinds/workflow-test/kind.js";
|
|
16
|
+
import { workspaceKind } from "./kinds/workspace/kind.js";
|
|
17
|
+
/**
|
|
18
|
+
* Every file kind, by name. Adding a kind means adding its folder under
|
|
19
|
+
* `kinds/` and one line here; the loader and the tooling read this list
|
|
20
|
+
* instead of switching on kind names.
|
|
21
|
+
*/
|
|
22
|
+
export const fileKinds = {
|
|
23
|
+
workspace: workspaceKind,
|
|
24
|
+
deployments: deploymentsKind,
|
|
25
|
+
models: modelsKind,
|
|
26
|
+
provider: providerKind,
|
|
27
|
+
runtime: runtimeKind,
|
|
28
|
+
knowledge: knowledgeKind,
|
|
29
|
+
collection: collectionKind,
|
|
30
|
+
connector: connectorKind,
|
|
31
|
+
skill: skillKind,
|
|
32
|
+
hub: hubKind,
|
|
33
|
+
agent: agentKind,
|
|
34
|
+
workflow: workflowKind,
|
|
35
|
+
workflowTest: workflowTestKind,
|
|
36
|
+
routine: routineKind,
|
|
37
|
+
integration: integrationKind,
|
|
38
|
+
plugin: pluginKind,
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The names of every file kind, workspace-level kinds first and the
|
|
42
|
+
* integration sheet and the plugin manifest, which sit outside workspaces,
|
|
43
|
+
* last, in a fixed order.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* for (const name of kindNames()) console.log(name, fileKinds[name].about);
|
|
47
|
+
*/
|
|
48
|
+
export function kindNames() {
|
|
49
|
+
return Object.keys(fileKinds);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Whether a text names a file kind, for input from outside such as a CLI
|
|
53
|
+
* argument.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* isKindName("agent"); // true
|
|
57
|
+
* isKindName("toString"); // false
|
|
58
|
+
*/
|
|
59
|
+
export function isKindName(name) {
|
|
60
|
+
return Object.hasOwn(fileKinds, name);
|
|
61
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The folder Halonic keeps for its own data inside a workspace and inside
|
|
3
|
+
* each hub: install records, staging and change sets. It holds no workspace
|
|
4
|
+
* files, so the loader skips it without a warning (format.reserved-folder).
|
|
5
|
+
*/
|
|
6
|
+
export declare const RESERVED_FOLDER = ".halonic";
|
|
7
|
+
/**
|
|
8
|
+
* Whether a workspace-relative path (with `/` separators) sits in the
|
|
9
|
+
* reserved `.halonic/` folder of the workspace root or of a hub. Names
|
|
10
|
+
* compare the way Windows and macOS open them, as `segmentAsOpened` gives
|
|
11
|
+
* them: case folded, without trailing dots and spaces and without the code
|
|
12
|
+
* points HFS+ ignores. So `.Halonic./x` and `HUBS/billing/.HALONIC/x` are
|
|
13
|
+
* reserved too, since they open the same folder.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* isReservedPath("hubs/billing/.halonic/source.json"); // true
|
|
17
|
+
* isReservedPath(".Halonic./staging/abc/hub.yaml"); // true
|
|
18
|
+
* isReservedPath("hubs/billing/agents/clerk.agent.yaml"); // false
|
|
19
|
+
*/
|
|
20
|
+
export declare function isReservedPath(path: string): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { segmentAsOpened } from "../../ports/src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The folder Halonic keeps for its own data inside a workspace and inside
|
|
4
|
+
* each hub: install records, staging and change sets. It holds no workspace
|
|
5
|
+
* files, so the loader skips it without a warning (format.reserved-folder).
|
|
6
|
+
*/
|
|
7
|
+
export const RESERVED_FOLDER = ".halonic";
|
|
8
|
+
/**
|
|
9
|
+
* Whether a workspace-relative path (with `/` separators) sits in the
|
|
10
|
+
* reserved `.halonic/` folder of the workspace root or of a hub. Names
|
|
11
|
+
* compare the way Windows and macOS open them, as `segmentAsOpened` gives
|
|
12
|
+
* them: case folded, without trailing dots and spaces and without the code
|
|
13
|
+
* points HFS+ ignores. So `.Halonic./x` and `HUBS/billing/.HALONIC/x` are
|
|
14
|
+
* reserved too, since they open the same folder.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* isReservedPath("hubs/billing/.halonic/source.json"); // true
|
|
18
|
+
* isReservedPath(".Halonic./staging/abc/hub.yaml"); // true
|
|
19
|
+
* isReservedPath("hubs/billing/agents/clerk.agent.yaml"); // false
|
|
20
|
+
*/
|
|
21
|
+
export function isReservedPath(path) {
|
|
22
|
+
const [first = "", hub = "", inHub = ""] = path.split("/");
|
|
23
|
+
if (opensAsReservedFolder(first)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return segmentAsOpened(first) === "hubs" && hub !== "" && opensAsReservedFolder(inHub);
|
|
27
|
+
}
|
|
28
|
+
function opensAsReservedFolder(segment) {
|
|
29
|
+
return segmentAsOpened(segment) === RESERVED_FOLDER;
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The file format version every kind's `version` key holds. */
|
|
2
|
+
export declare const SCHEMA_VERSION: 1;
|
|
3
|
+
/** An item's id: lowercase letters, digits, `-` and `_`, starting with a letter or digit. */
|
|
4
|
+
export declare const id: import("zod").ZodString;
|
|
5
|
+
/** A deployment's id, which names the deployment's runs folder. */
|
|
6
|
+
export declare const deploymentId: import("zod").ZodString;
|
|
7
|
+
/** An agent's id, which names the agent's harness settings folder. */
|
|
8
|
+
export declare const agentId: import("zod").ZodString;
|
|
9
|
+
/**
|
|
10
|
+
* A workspace collection's id: lowercase letters, digits and `-`, starting
|
|
11
|
+
* with a letter or digit. Halonic's own collections (`_tokens`,
|
|
12
|
+
* `_google_setups`) start with `_`, so no workspace file can name them.
|
|
13
|
+
* The scheduler's and coordination's collections (`halonic.scheduler.timers`,
|
|
14
|
+
* `halonic.coordination`) are kept out by the `.` instead, so keep a `.` in
|
|
15
|
+
* their names.
|
|
16
|
+
*/
|
|
17
|
+
export declare const collectionId: import("zod").ZodString;
|
|
18
|
+
/** The `version` key: `1`, and `1` when the file leaves it out. */
|
|
19
|
+
export declare const version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
|
|
20
|
+
/** A whole number and a unit: minutes, hours or days ("30m", "4h", "2d"). */
|
|
21
|
+
export declare const DURATION_PATTERN: RegExp;
|
|
22
|
+
/** Tuning passed to a model (temperature, maxTokens, …). */
|
|
23
|
+
export declare const ModelParams: import("zod").ZodObject<{
|
|
24
|
+
temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
25
|
+
topP: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
26
|
+
maxTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
27
|
+
stop: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
28
|
+
reasoningEffort: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
29
|
+
high: "high";
|
|
30
|
+
low: "low";
|
|
31
|
+
medium: "medium";
|
|
32
|
+
}>>;
|
|
33
|
+
extra: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
34
|
+
}, import("zod/v4/core").$strict>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Field schemas that several file kinds share. Each keeps the exact rule and
|
|
2
|
+
// message of the old schema (784f78d: packages/core/schema/src/index.ts).
|
|
3
|
+
import { s } from "../../../schema-kit/src/index.js";
|
|
4
|
+
/** The file format version every kind's `version` key holds. */
|
|
5
|
+
export const SCHEMA_VERSION = 1;
|
|
6
|
+
/** An item's id: lowercase letters, digits, `-` and `_`, starting with a letter or digit. */
|
|
7
|
+
export const id = s
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.regex(/^[a-z0-9][a-z0-9-_]*$/, "use lowercase letters, digits, '-' or '_'");
|
|
11
|
+
/**
|
|
12
|
+
* The most characters an id that names a folder may have. A deployment's runs
|
|
13
|
+
* live in `deployments/<id>/runs` and an agent's harness settings in
|
|
14
|
+
* `harness-settings/<id>/<harness>` in the profile, and 64 keeps those paths
|
|
15
|
+
* well under Windows' 260-character limit.
|
|
16
|
+
*/
|
|
17
|
+
const FOLDER_ID_MAX_LENGTH = 64;
|
|
18
|
+
/** Names Windows keeps for devices; no file or folder can have them. */
|
|
19
|
+
const WINDOWS_DEVICE_NAME = /^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/;
|
|
20
|
+
/**
|
|
21
|
+
* An {@link id} that names a folder in the profile: at most 64 characters
|
|
22
|
+
* and not a Windows device name. `owner` says whose folder it is in the
|
|
23
|
+
* message. The device names are refused by a separate rule that the JSON
|
|
24
|
+
* Schema carries as `not: { pattern }`, not by a lookahead, so the pattern
|
|
25
|
+
* also works in Go and Rust regex libraries, which have no lookaround.
|
|
26
|
+
* `@halonicjs/profile` keeps the same rule, and a test in each kind that
|
|
27
|
+
* uses it holds the two together.
|
|
28
|
+
*/
|
|
29
|
+
function folderId(owner) {
|
|
30
|
+
return id
|
|
31
|
+
.max(FOLDER_ID_MAX_LENGTH, `use at most ${FOLDER_ID_MAX_LENGTH} characters, so the ${owner}'s folder fits in a Windows path`)
|
|
32
|
+
.superRefine((name, context) => {
|
|
33
|
+
if (WINDOWS_DEVICE_NAME.test(name)) {
|
|
34
|
+
context.addIssue({
|
|
35
|
+
code: "invalid_format",
|
|
36
|
+
format: "regex",
|
|
37
|
+
pattern: WINDOWS_DEVICE_NAME.source,
|
|
38
|
+
message: "use a name Windows doesn't keep for a device (con, prn, aux, nul, com0-com9, lpt0-lpt9)",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
.meta({ not: { pattern: WINDOWS_DEVICE_NAME.source } });
|
|
43
|
+
}
|
|
44
|
+
/** A deployment's id, which names the deployment's runs folder. */
|
|
45
|
+
export const deploymentId = folderId("deployment");
|
|
46
|
+
/** An agent's id, which names the agent's harness settings folder. */
|
|
47
|
+
export const agentId = folderId("agent");
|
|
48
|
+
/**
|
|
49
|
+
* A workspace collection's id: lowercase letters, digits and `-`, starting
|
|
50
|
+
* with a letter or digit. Halonic's own collections (`_tokens`,
|
|
51
|
+
* `_google_setups`) start with `_`, so no workspace file can name them.
|
|
52
|
+
* The scheduler's and coordination's collections (`halonic.scheduler.timers`,
|
|
53
|
+
* `halonic.coordination`) are kept out by the `.` instead, so keep a `.` in
|
|
54
|
+
* their names.
|
|
55
|
+
*/
|
|
56
|
+
export const collectionId = s
|
|
57
|
+
.string()
|
|
58
|
+
.regex(/^[a-z0-9][a-z0-9-]*$/, "use lowercase letters, digits or '-'");
|
|
59
|
+
/** The `version` key: `1`, and `1` when the file leaves it out. */
|
|
60
|
+
export const version = s.literal(SCHEMA_VERSION).default(SCHEMA_VERSION);
|
|
61
|
+
/** A whole number and a unit: minutes, hours or days ("30m", "4h", "2d"). */
|
|
62
|
+
export const DURATION_PATTERN = /^[1-9]\d*(m|h|d)$/;
|
|
63
|
+
/** Tuning passed to a model (temperature, maxTokens, …). */
|
|
64
|
+
export const ModelParams = s
|
|
65
|
+
.object({
|
|
66
|
+
temperature: s.number().min(0).max(2).optional(),
|
|
67
|
+
topP: s.number().min(0).max(1).optional(),
|
|
68
|
+
maxTokens: s.number().int().positive().optional(),
|
|
69
|
+
stop: s.array(s.string()).optional(),
|
|
70
|
+
reasoningEffort: s.enum(["low", "medium", "high"]).optional(),
|
|
71
|
+
/** Provider-specific extras, passed through untouched. */
|
|
72
|
+
extra: s.record(s.string(), s.unknown()).optional(),
|
|
73
|
+
})
|
|
74
|
+
.strict();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Schema } from "../../../schema-kit/src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* A condition on a run's data, used by workflow transitions and signal
|
|
4
|
+
* routines. Values may be `{{path}}` templates.
|
|
5
|
+
*/
|
|
6
|
+
export type Guard = {
|
|
7
|
+
equals: [unknown, unknown];
|
|
8
|
+
} | {
|
|
9
|
+
notEquals: [unknown, unknown];
|
|
10
|
+
} | {
|
|
11
|
+
contains: [unknown, unknown];
|
|
12
|
+
} | {
|
|
13
|
+
exists: string;
|
|
14
|
+
}
|
|
15
|
+
/** Numbers: both sides are read as numbers; a side that is no number makes the guard false. */
|
|
16
|
+
| {
|
|
17
|
+
gt: [unknown, unknown];
|
|
18
|
+
} | {
|
|
19
|
+
gte: [unknown, unknown];
|
|
20
|
+
} | {
|
|
21
|
+
lt: [unknown, unknown];
|
|
22
|
+
} | {
|
|
23
|
+
lte: [unknown, unknown];
|
|
24
|
+
} | {
|
|
25
|
+
not: Guard;
|
|
26
|
+
} | {
|
|
27
|
+
all: Guard[];
|
|
28
|
+
} | {
|
|
29
|
+
any: Guard[];
|
|
30
|
+
};
|
|
31
|
+
/** The schema of a `Guard`. It refers to itself for `not`, `all` and `any`. */
|
|
32
|
+
export declare const Guard: Schema<Guard>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { s } from "../../../schema-kit/src/index.js";
|
|
2
|
+
const pair = () => s.tuple([s.unknown(), s.unknown()]);
|
|
3
|
+
/** The schema of a `Guard`. It refers to itself for `not`, `all` and `any`. */
|
|
4
|
+
export const Guard = s.lazy(() => s.union([
|
|
5
|
+
s.object({ equals: pair() }).strict(),
|
|
6
|
+
s.object({ notEquals: pair() }).strict(),
|
|
7
|
+
s.object({ contains: pair() }).strict(),
|
|
8
|
+
s.object({ exists: s.string() }).strict(),
|
|
9
|
+
s.object({ gt: pair() }).strict(),
|
|
10
|
+
s.object({ gte: pair() }).strict(),
|
|
11
|
+
s.object({ lt: pair() }).strict(),
|
|
12
|
+
s.object({ lte: pair() }).strict(),
|
|
13
|
+
s.object({ not: Guard }).strict(),
|
|
14
|
+
s.object({ all: s.array(Guard) }).strict(),
|
|
15
|
+
s.object({ any: s.array(Guard) }).strict(),
|
|
16
|
+
]));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Path } from "../../../schema-kit/src/index.js";
|
|
2
|
+
import type { KindCheckProblem } from "../kind.js";
|
|
3
|
+
declare const words: {
|
|
4
|
+
readonly header: "This looks like an API key written into the file. Remove it, store the key as a secret, and write the secret's name in the connector's secret, which is sent as a bearer token.";
|
|
5
|
+
readonly env: "This looks like an API key written into the file. Remove it, store the key as a secret, and set this variable under secretEnv to the secret's name instead.";
|
|
6
|
+
readonly arg: "This looks like an API key written into the file. Remove it, store the key as a secret, and give it to the program through secretEnv instead of its arguments.";
|
|
7
|
+
readonly "provider-option": "This looks like an API key written into the file. Remove it, store the key as a secret, and write the secret's name in the provider's secret.";
|
|
8
|
+
readonly setting: "This looks like an API key written into the file. Remove it and store the key as a secret, so the file can be shared and committed safely.";
|
|
9
|
+
};
|
|
10
|
+
/** Which field the text sits in, which picks the advice in the message. */
|
|
11
|
+
export type KeyPlace = keyof typeof words;
|
|
12
|
+
/**
|
|
13
|
+
* Checks every text in a free field for a pasted key, down through nested
|
|
14
|
+
* maps and lists, and reports each one as the error `value-looks-like-key`
|
|
15
|
+
* at its own path. The message never repeats the value.
|
|
16
|
+
*
|
|
17
|
+
* @param value - the field's value from the file
|
|
18
|
+
* @param path - where the field sits in the file
|
|
19
|
+
* @param place - which advice the message gives
|
|
20
|
+
* @param name - the name the value sits under, when the field itself is one entry
|
|
21
|
+
* @returns one problem per text that holds a key
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* checkKeysIn({ Authorization: `Bearer sk-${"Q7x2Lm9K".repeat(4)}` }, ["headers"], "header");
|
|
25
|
+
* // [{ code: "value-looks-like-key", path: ["headers", "Authorization"], … }]
|
|
26
|
+
*/
|
|
27
|
+
export declare function checkKeysIn(value: unknown, path: Path, place: KeyPlace, name?: string): KindCheckProblem[];
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { findSecretShape } from "../../../std/src/index.js";
|
|
2
|
+
import { looksLikeKey } from "./secret-name.js";
|
|
3
|
+
/*
|
|
4
|
+
* A file holds only a secret's name, never the secret (save model 8.1). The
|
|
5
|
+
* fields checked here take any text: a connector's HTTP headers, a local
|
|
6
|
+
* program's `env` and `args`, and the adapter settings in `options` and
|
|
7
|
+
* `config`. Two tests catch a key pasted into one:
|
|
8
|
+
*
|
|
9
|
+
* - The known key formats `findSecretShape` spots, anywhere in the text, so
|
|
10
|
+
* `Bearer sk-…` and `--api-key=sk-…` are caught too.
|
|
11
|
+
* - Under a name that says it holds a credential (`Authorization`,
|
|
12
|
+
* `GITHUB_TOKEN`, `apiKey`), the full `looksLikeKey` test, once a leading
|
|
13
|
+
* `Bearer`, `Basic` or `Token` is dropped. Only a value made of key
|
|
14
|
+
* characters counts: without the name, or with a `.`, `:` or space left
|
|
15
|
+
* in it, the long-random-part test would also find addresses and paths
|
|
16
|
+
* such as `/opt/python3.12-tools`. A value that starts like a path
|
|
17
|
+
* (`/`, `./`, `../`, `~/`) is a path, such as `CREDENTIALS_DIR:
|
|
18
|
+
* /srv/runner/work/app2/creds`; a base64 key may hold a `/`, but doesn't
|
|
19
|
+
* start with one.
|
|
20
|
+
*/
|
|
21
|
+
const credentialName = /token|secret|passw(?:or)?d|api[-_]?key|access[-_]?key|private[-_]?key|credential|authorization|^auth$/i;
|
|
22
|
+
const authScheme = /^(?:bearer|basic|token)\s+/i;
|
|
23
|
+
const keyCharacters = /^[A-Za-z0-9+/=_-]+$/;
|
|
24
|
+
const pathStart = /^(?:\/|\.\.?\/|~\/)/;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a value in a free text field holds a key.
|
|
27
|
+
* Only the answer leaves the check; when it is `true`, never repeat the value.
|
|
28
|
+
*
|
|
29
|
+
* @param value - the text from the file
|
|
30
|
+
* @param name - the header, variable or setting the text belongs to
|
|
31
|
+
*/
|
|
32
|
+
function holdsKey(value, name) {
|
|
33
|
+
if (findSecretShape(value) !== undefined) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (name === undefined || !credentialName.test(name)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const credential = value.trim().replace(authScheme, "");
|
|
40
|
+
return !pathStart.test(credential) && keyCharacters.test(credential) && looksLikeKey(credential);
|
|
41
|
+
}
|
|
42
|
+
/*
|
|
43
|
+
* The words wait on the board (HAL-2264, P8), like those in
|
|
44
|
+
* `secret-name.ts`. Each says where the secret's name goes instead.
|
|
45
|
+
*/
|
|
46
|
+
const opening = "This looks like an API key written into the file.";
|
|
47
|
+
const words = {
|
|
48
|
+
header: `${opening} Remove it, store the key as a secret, and write the secret's name in the connector's secret, which is sent as a bearer token.`,
|
|
49
|
+
env: `${opening} Remove it, store the key as a secret, and set this variable under secretEnv to the secret's name instead.`,
|
|
50
|
+
arg: `${opening} Remove it, store the key as a secret, and give it to the program through secretEnv instead of its arguments.`,
|
|
51
|
+
"provider-option": `${opening} Remove it, store the key as a secret, and write the secret's name in the provider's secret.`,
|
|
52
|
+
setting: `${opening} Remove it and store the key as a secret, so the file can be shared and committed safely.`,
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Checks every text in a free field for a pasted key, down through nested
|
|
56
|
+
* maps and lists, and reports each one as the error `value-looks-like-key`
|
|
57
|
+
* at its own path. The message never repeats the value.
|
|
58
|
+
*
|
|
59
|
+
* @param value - the field's value from the file
|
|
60
|
+
* @param path - where the field sits in the file
|
|
61
|
+
* @param place - which advice the message gives
|
|
62
|
+
* @param name - the name the value sits under, when the field itself is one entry
|
|
63
|
+
* @returns one problem per text that holds a key
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* checkKeysIn({ Authorization: `Bearer sk-${"Q7x2Lm9K".repeat(4)}` }, ["headers"], "header");
|
|
67
|
+
* // [{ code: "value-looks-like-key", path: ["headers", "Authorization"], … }]
|
|
68
|
+
*/
|
|
69
|
+
export function checkKeysIn(value, path, place, name) {
|
|
70
|
+
if (typeof value === "string") {
|
|
71
|
+
return holdsKey(value, name)
|
|
72
|
+
? [{ severity: "error", code: "value-looks-like-key", path, message: words[place] }]
|
|
73
|
+
: [];
|
|
74
|
+
}
|
|
75
|
+
if (Array.isArray(value)) {
|
|
76
|
+
return value.flatMap((item, index) => checkKeysIn(item, [...path, index], place, name));
|
|
77
|
+
}
|
|
78
|
+
if (typeof value === "object" && value !== null) {
|
|
79
|
+
return Object.entries(value).flatMap(([key, item]) => checkKeysIn(item, [...path, key], place, key));
|
|
80
|
+
}
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a copy of `map` with the key `oldName` read as `newName`, so files
|
|
3
|
+
* from before a rename keep loading. When the file already has `newName`,
|
|
4
|
+
* the old key stays as it is and the schema reports it as unknown.
|
|
5
|
+
*/
|
|
6
|
+
export declare function renameKey(map: Readonly<Record<string, unknown>>, oldName: string, newName: string): Record<string, unknown>;
|
|
7
|
+
/** Whether a value is a plain map (not a list, not null). */
|
|
8
|
+
export declare function isMap(value: unknown): value is Readonly<Record<string, unknown>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a copy of `map` with the key `oldName` read as `newName`, so files
|
|
3
|
+
* from before a rename keep loading. When the file already has `newName`,
|
|
4
|
+
* the old key stays as it is and the schema reports it as unknown.
|
|
5
|
+
*/
|
|
6
|
+
export function renameKey(map, oldName, newName) {
|
|
7
|
+
if (!Object.hasOwn(map, oldName) || Object.hasOwn(map, newName)) {
|
|
8
|
+
return { ...map };
|
|
9
|
+
}
|
|
10
|
+
// fromEntries defines keys as plain properties, so a "__proto__" key in a
|
|
11
|
+
// file stays data instead of changing the copy's prototype.
|
|
12
|
+
return Object.fromEntries(Object.entries(map).map(([key, value]) => [key === oldName ? newName : key, value]));
|
|
13
|
+
}
|
|
14
|
+
/** Whether a value is a plain map (not a list, not null). */
|
|
15
|
+
export function isMap(value) {
|
|
16
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How Halonic reads a program start for the paths it names. Three guards
|
|
3
|
+
* refuse a start by what it names: a skill's `scripts/` folder
|
|
4
|
+
* (`format.skill-scripts-folder`), and an agent's working folder, both as
|
|
5
|
+
* written in a workspace (`workspace.working-folders`) and on the real file
|
|
6
|
+
* system (`format.working-folder-start`). They read a start the same way, so
|
|
7
|
+
* a path one of them finds, the others find too (HAL-4777). Reading too much
|
|
8
|
+
* as a path only makes a guard stricter.
|
|
9
|
+
*/
|
|
10
|
+
/** What a start would run: the program, its arguments, the folder it starts in and its environment. */
|
|
11
|
+
export interface ProgramStart {
|
|
12
|
+
readonly cwd: string;
|
|
13
|
+
readonly program: string;
|
|
14
|
+
readonly args: readonly string[];
|
|
15
|
+
/** The variables the program gets. Their values are read for paths; their names aren't. */
|
|
16
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
17
|
+
}
|
|
18
|
+
/** A path a start names. */
|
|
19
|
+
export interface NamedPath {
|
|
20
|
+
/** The path as written. A relative path is read from the start folder. */
|
|
21
|
+
readonly path: string;
|
|
22
|
+
/** The program, argument or `NAME=value` it comes from, for a message. */
|
|
23
|
+
readonly shown: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The paths a start names, besides the folder it starts in: the program,
|
|
27
|
+
* every path each argument names (see {@link pathsIn}), the folder path of a
|
|
28
|
+
* module that `python -m` runs (see {@link moduleIn}) and every path an `env`
|
|
29
|
+
* value names. The start folder isn't listed, as each guard reads it on its
|
|
30
|
+
* own terms.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* pathsNamedBy({ cwd: ".", program: "node", args: ["--config=tools/mail.json"] });
|
|
34
|
+
* // [{ path: "node", shown: "node" },
|
|
35
|
+
* // { path: "--config=tools/mail.json", shown: "--config=tools/mail.json" },
|
|
36
|
+
* // { path: "--config", shown: "--config=tools/mail.json" },
|
|
37
|
+
* // { path: "tools/mail.json", shown: "--config=tools/mail.json" }]
|
|
38
|
+
*/
|
|
39
|
+
export declare function pathsNamedBy({ program, args, env }: ProgramStart): NamedPath[];
|
|
40
|
+
/**
|
|
41
|
+
* The paths an argument or `env` value may name: the whole text, each piece
|
|
42
|
+
* between `;` and spaces (a Windows `PATH` keeps its drive letters), each
|
|
43
|
+
* piece between `=`, `:`, `;`, `@` and spaces (as in
|
|
44
|
+
* `--config=tools/mail.json`, `--define=KEY=tools/x`, `PATH=tools/bin:/usr/bin`,
|
|
45
|
+
* `file:tools/x` or `@tools/args.txt`), the whole text after each `=`, `:`
|
|
46
|
+
* and `@` (so `--file=my link` still names `my link`), the whole text inside
|
|
47
|
+
* each pair of quotes (as in `--require "my tools/x.js"`), each piece without
|
|
48
|
+
* its quotes (HAL-4903), and each piece without its short flag, as in
|
|
49
|
+
* `-ctools/mail.json`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function pathsIn(text: string): string[];
|
|
52
|
+
/**
|
|
53
|
+
* The folder paths of a module that `python -m` runs, from the argument at
|
|
54
|
+
* `index`: `-m tools.mail`, `-mtools.mail` and, with `-m` among other short
|
|
55
|
+
* flags, `-Im tools.mail` or `-Imtools.mail` read `tools/mail`. Both readings
|
|
56
|
+
* are kept: in `-Wm -mtools.mail`, the argument is read as a module after
|
|
57
|
+
* `-Wm` and as `-m` with its module, so a guard never reads less than before
|
|
58
|
+
* (HAL-4903). Empty when that argument names no module.
|
|
59
|
+
*/
|
|
60
|
+
export declare function moduleIn(args: readonly string[], index: number): string[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How Halonic reads a program start for the paths it names. Three guards
|
|
3
|
+
* refuse a start by what it names: a skill's `scripts/` folder
|
|
4
|
+
* (`format.skill-scripts-folder`), and an agent's working folder, both as
|
|
5
|
+
* written in a workspace (`workspace.working-folders`) and on the real file
|
|
6
|
+
* system (`format.working-folder-start`). They read a start the same way, so
|
|
7
|
+
* a path one of them finds, the others find too (HAL-4777). Reading too much
|
|
8
|
+
* as a path only makes a guard stricter.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The paths a start names, besides the folder it starts in: the program,
|
|
12
|
+
* every path each argument names (see {@link pathsIn}), the folder path of a
|
|
13
|
+
* module that `python -m` runs (see {@link moduleIn}) and every path an `env`
|
|
14
|
+
* value names. The start folder isn't listed, as each guard reads it on its
|
|
15
|
+
* own terms.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* pathsNamedBy({ cwd: ".", program: "node", args: ["--config=tools/mail.json"] });
|
|
19
|
+
* // [{ path: "node", shown: "node" },
|
|
20
|
+
* // { path: "--config=tools/mail.json", shown: "--config=tools/mail.json" },
|
|
21
|
+
* // { path: "--config", shown: "--config=tools/mail.json" },
|
|
22
|
+
* // { path: "tools/mail.json", shown: "--config=tools/mail.json" }]
|
|
23
|
+
*/
|
|
24
|
+
export function pathsNamedBy({ program, args, env = {} }) {
|
|
25
|
+
const named = (shown, paths) => paths.map((path) => ({ path, shown }));
|
|
26
|
+
return [
|
|
27
|
+
{ path: program, shown: program },
|
|
28
|
+
...args.flatMap((arg, index) => named(arg, [...pathsIn(arg), ...moduleIn(args, index)])),
|
|
29
|
+
...Object.entries(env).flatMap(([name, value]) => named(`${name}=${value}`, pathsIn(value))),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The paths an argument or `env` value may name: the whole text, each piece
|
|
34
|
+
* between `;` and spaces (a Windows `PATH` keeps its drive letters), each
|
|
35
|
+
* piece between `=`, `:`, `;`, `@` and spaces (as in
|
|
36
|
+
* `--config=tools/mail.json`, `--define=KEY=tools/x`, `PATH=tools/bin:/usr/bin`,
|
|
37
|
+
* `file:tools/x` or `@tools/args.txt`), the whole text after each `=`, `:`
|
|
38
|
+
* and `@` (so `--file=my link` still names `my link`), the whole text inside
|
|
39
|
+
* each pair of quotes (as in `--require "my tools/x.js"`), each piece without
|
|
40
|
+
* its quotes (HAL-4903), and each piece without its short flag, as in
|
|
41
|
+
* `-ctools/mail.json`.
|
|
42
|
+
*/
|
|
43
|
+
export function pathsIn(text) {
|
|
44
|
+
const pieces = [
|
|
45
|
+
text,
|
|
46
|
+
...text.split(/[;\s]+/),
|
|
47
|
+
...text.split(/[=:;@\s]+/),
|
|
48
|
+
...textsAfter(/[=:@]/g, text),
|
|
49
|
+
...textsInQuotes(text),
|
|
50
|
+
];
|
|
51
|
+
const withoutQuotes = pieces.flatMap((piece) => [piece, piece.replaceAll(/["']/g, "")]);
|
|
52
|
+
const withoutFlags = withoutQuotes.flatMap((piece) => /^-[^-]./.test(piece) ? [piece, piece.slice(2)] : [piece]);
|
|
53
|
+
return [...new Set(withoutFlags.filter((piece) => piece !== ""))];
|
|
54
|
+
}
|
|
55
|
+
/** The whole text after each match of `separator`: `a=b:c` gives `b:c` and `c` for `/[=:]/g`. */
|
|
56
|
+
function textsAfter(separator, text) {
|
|
57
|
+
return [...text.matchAll(separator)].map((match) => text.slice(match.index + 1));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The text inside each pair of `"` and each pair of `'`: `--require "my x.js"`
|
|
61
|
+
* gives `my x.js`. The two kinds are paired in separate passes, so a stray
|
|
62
|
+
* apostrophe, as in `it's --require "my x.js"`, can't hide a double-quoted
|
|
63
|
+
* path (HAL-4903). A quote escaped with `\` inside quotes isn't read as part
|
|
64
|
+
* of the path; that needs a path with quotes and spaces in its name.
|
|
65
|
+
*/
|
|
66
|
+
function textsInQuotes(text) {
|
|
67
|
+
const inPairsOf = (quote) => [...text.matchAll(new RegExp(`${quote}([^${quote}]*)${quote}`, "g"))].map((match) => match[1] ?? "");
|
|
68
|
+
return [...inPairsOf('"'), ...inPairsOf("'")];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The folder paths of a module that `python -m` runs, from the argument at
|
|
72
|
+
* `index`: `-m tools.mail`, `-mtools.mail` and, with `-m` among other short
|
|
73
|
+
* flags, `-Im tools.mail` or `-Imtools.mail` read `tools/mail`. Both readings
|
|
74
|
+
* are kept: in `-Wm -mtools.mail`, the argument is read as a module after
|
|
75
|
+
* `-Wm` and as `-m` with its module, so a guard never reads less than before
|
|
76
|
+
* (HAL-4903). Empty when that argument names no module.
|
|
77
|
+
*/
|
|
78
|
+
export function moduleIn(args, index) {
|
|
79
|
+
return moduleNames(args[index - 1], args[index] ?? "").map((name) => name.replaceAll(".", "/"));
|
|
80
|
+
}
|
|
81
|
+
/** The modules an argument names: after a `-m` before it, and after its own `-m`. */
|
|
82
|
+
function moduleNames(before, arg) {
|
|
83
|
+
const afterFlagBefore = before !== undefined && textAfterShortM(before) === "" ? arg : "";
|
|
84
|
+
const afterOwnFlag = textAfterShortM(arg) ?? "";
|
|
85
|
+
return [...new Set([afterFlagBefore, afterOwnFlag].filter((name) => name !== ""))];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The text after the first `m` in a group of short flags, as Python reads
|
|
89
|
+
* one: `-Imtools.mail` gives `tools.mail`, and `-Im` gives an empty text, as
|
|
90
|
+
* the module is the next argument. Undefined when the argument isn't a group
|
|
91
|
+
* of short flags or has no `m`. A flag that takes a value, as in `-Xdev`, may
|
|
92
|
+
* read a stray module; that only makes a guard stricter.
|
|
93
|
+
*/
|
|
94
|
+
function textAfterShortM(arg) {
|
|
95
|
+
if (!/^-[^-]/.test(arg))
|
|
96
|
+
return undefined;
|
|
97
|
+
const at = arg.indexOf("m", 1);
|
|
98
|
+
return at === -1 ? undefined : arg.slice(at + 1);
|
|
99
|
+
}
|