@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,29 @@
|
|
|
1
|
+
/** The words a message uses for the folder a path must stay in, and for one part of it. */
|
|
2
|
+
export type PathPlace = {
|
|
3
|
+
/** The folder the path is relative to, such as `the workspace`. */
|
|
4
|
+
readonly root: string;
|
|
5
|
+
/** What one part of the path is, such as `folder name`. */
|
|
6
|
+
readonly part: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A name as a case-insensitive file system sees it: compatibility forms
|
|
10
|
+
* folded (`hubs` is `hubs`) and case folded (`ſ` and `S` are `s`).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* foldName(".GIT"); // ".git"
|
|
14
|
+
*/
|
|
15
|
+
export declare function foldName(name: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Why a path can't be used inside `place`, or `null` when it can. It must be
|
|
18
|
+
* relative, with `/` between its parts, and stay inside the folder. Parts
|
|
19
|
+
* that Windows or macOS would read as another name are refused too: a
|
|
20
|
+
* trailing `.` or space, a `:` (a drive or an NTFS stream), an 8.3 short name
|
|
21
|
+
* such as `GIT~1`, control characters and invisible code points. The checks
|
|
22
|
+
* run on the path after {@link foldName}, so `agents./x` fails like
|
|
23
|
+
* `agents./x`. Symlinks are resolved later, when the program starts.
|
|
24
|
+
*
|
|
25
|
+
* @param path - the path as written in the file
|
|
26
|
+
* @param place - the words the message uses
|
|
27
|
+
* @returns a message, or `null`
|
|
28
|
+
*/
|
|
29
|
+
export declare function relativePathProblem(path: string, place: PathPlace): string | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// The rules for a path that must stay inside one folder: an agent's working
|
|
2
|
+
// folder in the workspace, or a file in a plugin's folder. They decide what a
|
|
3
|
+
// program on the person's computer can touch, so one set of rules serves both.
|
|
4
|
+
/**
|
|
5
|
+
* A name as a case-insensitive file system sees it: compatibility forms
|
|
6
|
+
* folded (`hubs` is `hubs`) and case folded (`ſ` and `S` are `s`).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* foldName(".GIT"); // ".git"
|
|
10
|
+
*/
|
|
11
|
+
export function foldName(name) {
|
|
12
|
+
return name.normalize("NFKC").toUpperCase().toLowerCase();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Why a path can't be used inside `place`, or `null` when it can. It must be
|
|
16
|
+
* relative, with `/` between its parts, and stay inside the folder. Parts
|
|
17
|
+
* that Windows or macOS would read as another name are refused too: a
|
|
18
|
+
* trailing `.` or space, a `:` (a drive or an NTFS stream), an 8.3 short name
|
|
19
|
+
* such as `GIT~1`, control characters and invisible code points. The checks
|
|
20
|
+
* run on the path after {@link foldName}, so `agents./x` fails like
|
|
21
|
+
* `agents./x`. Symlinks are resolved later, when the program starts.
|
|
22
|
+
*
|
|
23
|
+
* @param path - the path as written in the file
|
|
24
|
+
* @param place - the words the message uses
|
|
25
|
+
* @returns a message, or `null`
|
|
26
|
+
*/
|
|
27
|
+
export function relativePathProblem(path, place) {
|
|
28
|
+
if (/[\p{Cc}\p{Default_Ignorable_Code_Point}]/u.test(path)) {
|
|
29
|
+
return `Don't use control characters or invisible characters in a ${place.part}`;
|
|
30
|
+
}
|
|
31
|
+
const folded = foldName(path);
|
|
32
|
+
if (folded.includes("\\"))
|
|
33
|
+
return "Use '/' between folders";
|
|
34
|
+
if (folded.startsWith("/") || /^[a-z]:/.test(folded)) {
|
|
35
|
+
return `Use a path relative to ${place.root}`;
|
|
36
|
+
}
|
|
37
|
+
if (folded.includes(":"))
|
|
38
|
+
return `Don't use ':' in a ${place.part}`;
|
|
39
|
+
const parts = folded.split("/");
|
|
40
|
+
if (parts.some((part) => part === "" || part === "." || part === "..")) {
|
|
41
|
+
return `Use a path inside ${place.root}, without '.', '..' or empty parts`;
|
|
42
|
+
}
|
|
43
|
+
if (parts.some((part) => /[. ]$/.test(part))) {
|
|
44
|
+
return `Don't end a ${place.part} with '.' or a space`;
|
|
45
|
+
}
|
|
46
|
+
if (parts.some((part) => /~\d/.test(part))) {
|
|
47
|
+
return "Don't use '~' followed by a digit: Windows reads it as a short name";
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Path } from "../../../schema-kit/src/index.js";
|
|
2
|
+
import type { KindCheckProblem } from "../kind.js";
|
|
3
|
+
/**
|
|
4
|
+
* Whether a value written as a secret's name looks like a key instead.
|
|
5
|
+
* Only the answer leaves the check; when it is `true`, never repeat the value.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* looksLikeKey("openai-key"); // false
|
|
9
|
+
* looksLikeKey(`sk-ant-api03-${"Q7x2Lm9K".repeat(4)}`); // true
|
|
10
|
+
*/
|
|
11
|
+
export declare function looksLikeKey(value: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Checks a value a file gives as a secret's name, before anything asks a
|
|
14
|
+
* store for it. A key is refused first (`secret-looks-like-key`), then a
|
|
15
|
+
* name that breaks the rule of the `Secrets` port (`secret-name`). Both are
|
|
16
|
+
* errors, because the file may be committed. The message repeats the value
|
|
17
|
+
* only when it doesn't look like a key and would pass the rule with its
|
|
18
|
+
* spaces and dots written as `-`.
|
|
19
|
+
*
|
|
20
|
+
* @param name - the value from the file
|
|
21
|
+
* @param path - where it sits in the file
|
|
22
|
+
* @returns the problem, or `undefined` for a good name
|
|
23
|
+
*/
|
|
24
|
+
export declare function checkSecretName(name: string, path: Path): KindCheckProblem | undefined;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { isSecretName, maxSecretNameLength } from "../../../ports/src/index.js";
|
|
2
|
+
import { findSecretShape } from "../../../std/src/index.js";
|
|
3
|
+
/*
|
|
4
|
+
* A key pasted where a secret's name belongs fits the name rule more often
|
|
5
|
+
* than not (`sk-ant-api03-…` is a letter, then letters, digits and `-`), so
|
|
6
|
+
* the rule alone lets it through and every later message repeats it. Three
|
|
7
|
+
* tests catch it:
|
|
8
|
+
*
|
|
9
|
+
* - The known key formats `findSecretShape` spots (`sk-`, `GOCSPX-`, `AIza`,
|
|
10
|
+
* `ghp_`, `github_pat_`, `xoxb-`), the same check Studio asks before a
|
|
11
|
+
* chat message is sent.
|
|
12
|
+
* - A UUID anywhere in the value. Many services issue keys as a bare UUID,
|
|
13
|
+
* whose parts are too short for the next test.
|
|
14
|
+
* - A long random part: between the `-` and `_` that split a name, a run of
|
|
15
|
+
* at least 20 characters that mixes letters and digits. Names people
|
|
16
|
+
* write are words (`openai-key`, `SERVE_PASSWORD`), and a word of 20
|
|
17
|
+
* characters with digits in it is rare. Keys without a known prefix
|
|
18
|
+
* (hex tokens, other Slack tokens, cloud access keys) are such runs. An
|
|
19
|
+
* AWS access key ID is exactly 20 characters, so keep the length at 20.
|
|
20
|
+
*/
|
|
21
|
+
const uuid = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
|
|
22
|
+
const randomPartLength = 20;
|
|
23
|
+
const nameParts = /[-_]/;
|
|
24
|
+
const letter = /[A-Za-z]/;
|
|
25
|
+
const digit = /[0-9]/;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a value written as a secret's name looks like a key instead.
|
|
28
|
+
* Only the answer leaves the check; when it is `true`, never repeat the value.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* looksLikeKey("openai-key"); // false
|
|
32
|
+
* looksLikeKey(`sk-ant-api03-${"Q7x2Lm9K".repeat(4)}`); // true
|
|
33
|
+
*/
|
|
34
|
+
export function looksLikeKey(value) {
|
|
35
|
+
if (findSecretShape(value) !== undefined || uuid.test(value)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return value
|
|
39
|
+
.split(nameParts)
|
|
40
|
+
.some((part) => part.length >= randomPartLength && letter.test(part) && digit.test(part));
|
|
41
|
+
}
|
|
42
|
+
/*
|
|
43
|
+
* The words wait on the board (HAL-2264, P8). They sit here, one per
|
|
44
|
+
* problem, so the approved text replaces them in one place.
|
|
45
|
+
*/
|
|
46
|
+
const words = {
|
|
47
|
+
"secret-looks-like-key": "This looks like an API key, not a secret's name. Remove it from the file, store the key as a secret, and write the secret's name here, such as openai-key.",
|
|
48
|
+
"secret-name": (name) => `The secret name "${name}" can't be used. Start with a letter, then use only letters, digits, - or _, such as openai-key.`,
|
|
49
|
+
"secret-name-too-long": (length) => `This secret name is ${length} characters long. Use at most ${maxSecretNameLength}, starting with a letter, then only letters, digits, - or _.`,
|
|
50
|
+
"secret-name-characters": "This secret name has characters that can't be used. Start with a letter, then use only letters, digits, - or _.",
|
|
51
|
+
};
|
|
52
|
+
const typoSeparators = /[ .]/g;
|
|
53
|
+
/**
|
|
54
|
+
* Whether a name that breaks the rule does so the way a typo does: it
|
|
55
|
+
* would pass with each space and dot written as `-` (`openai key`,
|
|
56
|
+
* `openai.key`). Only such a name may be repeated in a message. Anything
|
|
57
|
+
* else (`Hunter2!x`, `pass@word`) may be a password pasted by mistake, and
|
|
58
|
+
* `halonic validate` output can end up in a CI log.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* isTypoedSecretName("openai key"); // true
|
|
62
|
+
* isTypoedSecretName("Hunter2!x"); // false
|
|
63
|
+
*/
|
|
64
|
+
function isTypoedSecretName(name) {
|
|
65
|
+
return isSecretName(name.replace(typoSeparators, "-"));
|
|
66
|
+
}
|
|
67
|
+
/** The `secret-name` message: the name quoted only when it is a typo. */
|
|
68
|
+
function badNameMessage(name) {
|
|
69
|
+
if (isTypoedSecretName(name)) {
|
|
70
|
+
return words["secret-name"](name);
|
|
71
|
+
}
|
|
72
|
+
if (name.length > maxSecretNameLength) {
|
|
73
|
+
return words["secret-name-too-long"](name.length);
|
|
74
|
+
}
|
|
75
|
+
return words["secret-name-characters"];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Checks a value a file gives as a secret's name, before anything asks a
|
|
79
|
+
* store for it. A key is refused first (`secret-looks-like-key`), then a
|
|
80
|
+
* name that breaks the rule of the `Secrets` port (`secret-name`). Both are
|
|
81
|
+
* errors, because the file may be committed. The message repeats the value
|
|
82
|
+
* only when it doesn't look like a key and would pass the rule with its
|
|
83
|
+
* spaces and dots written as `-`.
|
|
84
|
+
*
|
|
85
|
+
* @param name - the value from the file
|
|
86
|
+
* @param path - where it sits in the file
|
|
87
|
+
* @returns the problem, or `undefined` for a good name
|
|
88
|
+
*/
|
|
89
|
+
export function checkSecretName(name, path) {
|
|
90
|
+
if (looksLikeKey(name)) {
|
|
91
|
+
return {
|
|
92
|
+
severity: "error",
|
|
93
|
+
code: "secret-looks-like-key",
|
|
94
|
+
path,
|
|
95
|
+
message: words["secret-looks-like-key"],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (isSecretName(name)) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
severity: "error",
|
|
103
|
+
code: "secret-name",
|
|
104
|
+
path,
|
|
105
|
+
message: badNameMessage(name),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Result } from "../../std/src/index.js";
|
|
2
|
+
import { type SourcePosition, type YamlPath, type YamlProblem } from "../../yaml/src/index.js";
|
|
3
|
+
import type { KindSyntax } from "./kind.js";
|
|
4
|
+
/** A file's text, read into data, with where each value sits. */
|
|
5
|
+
export interface Source {
|
|
6
|
+
/** The data: a map for a well-formed file; `{}` for an empty one, as the old loader read it. */
|
|
7
|
+
readonly data: unknown;
|
|
8
|
+
/** Where the value at `path` starts, or the nearest parent; line 1, column 1 when nothing does. */
|
|
9
|
+
positionOf(path: YamlPath): SourcePosition;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reads a file's text in its kind's syntax.
|
|
13
|
+
*
|
|
14
|
+
* @returns the data and positions, or the YAML problem with its line in the file
|
|
15
|
+
*/
|
|
16
|
+
export declare function readSource(syntax: KindSyntax, text: string): Result<Source, YamlProblem>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { err, ok } from "../../std/src/index.js";
|
|
2
|
+
import { readYaml } from "../../yaml/src/index.js";
|
|
3
|
+
import { isMap } from "./shared/legacy-keys.js";
|
|
4
|
+
const fileStart = { line: 1, col: 1 };
|
|
5
|
+
/**
|
|
6
|
+
* Reads a file's text in its kind's syntax.
|
|
7
|
+
*
|
|
8
|
+
* @returns the data and positions, or the YAML problem with its line in the file
|
|
9
|
+
*/
|
|
10
|
+
export function readSource(syntax, text) {
|
|
11
|
+
if (syntax === "front-matter") {
|
|
12
|
+
return readFrontMatterFile(text);
|
|
13
|
+
}
|
|
14
|
+
const read = readYaml(text);
|
|
15
|
+
if (!read.ok) {
|
|
16
|
+
return read;
|
|
17
|
+
}
|
|
18
|
+
const file = read.value;
|
|
19
|
+
return ok({
|
|
20
|
+
data: file.data ?? {},
|
|
21
|
+
positionOf: (path) => file.positionOf(path) ?? fileStart,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// The old loader's pattern (784f78d: parseSkillMarkdown): `---`, the YAML,
|
|
25
|
+
// `---`, then the body.
|
|
26
|
+
const frontMatterPattern = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
27
|
+
/**
|
|
28
|
+
* Reads a Markdown file with YAML front matter, such as `SKILL.md`. The data
|
|
29
|
+
* is the front matter plus `body`, the Markdown after it, trimmed. Without
|
|
30
|
+
* front matter the data is only `body`, the whole text untrimmed, as before.
|
|
31
|
+
*/
|
|
32
|
+
function readFrontMatterFile(text) {
|
|
33
|
+
const match = frontMatterPattern.exec(text);
|
|
34
|
+
if (match === null) {
|
|
35
|
+
return ok({ data: { body: text }, positionOf: () => fileStart });
|
|
36
|
+
}
|
|
37
|
+
const frontMatterText = match[1] ?? "";
|
|
38
|
+
const body = match[2] ?? "";
|
|
39
|
+
// The front matter starts on line 2, below the opening `---`.
|
|
40
|
+
const lineOffset = 1;
|
|
41
|
+
const read = readYaml(frontMatterText);
|
|
42
|
+
if (!read.ok) {
|
|
43
|
+
return err({ ...read.error, line: read.error.line + lineOffset });
|
|
44
|
+
}
|
|
45
|
+
const frontMatter = read.value;
|
|
46
|
+
const bodyPosition = {
|
|
47
|
+
line: lineCount(text.slice(0, text.length - body.length)),
|
|
48
|
+
col: 1,
|
|
49
|
+
};
|
|
50
|
+
const data = frontMatter.data ?? {};
|
|
51
|
+
return ok({
|
|
52
|
+
data: isMap(data) ? { ...data, body: body.trim() } : data,
|
|
53
|
+
positionOf: (path) => {
|
|
54
|
+
if (path[0] === "body") {
|
|
55
|
+
return bodyPosition;
|
|
56
|
+
}
|
|
57
|
+
const position = frontMatter.positionOf(path);
|
|
58
|
+
return position === undefined
|
|
59
|
+
? fileStart
|
|
60
|
+
: { line: position.line + lineOffset, col: position.col };
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** The 1-based number of the line a text ends on. */
|
|
65
|
+
function lineCount(text) {
|
|
66
|
+
let lines = 1;
|
|
67
|
+
for (const character of text) {
|
|
68
|
+
if (character === "\n") {
|
|
69
|
+
lines += 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return lines;
|
|
73
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** Version of the {@link AgentPlacementStore} port. A breaking change bumps it and comes with an ADR. */
|
|
2
|
+
export declare const agentPlacementStoreVersion = 1;
|
|
3
|
+
/** Which agent a placement is for. */
|
|
4
|
+
export interface AgentPlacementKey {
|
|
5
|
+
/** The workspace's resolved real path, as in a `TrustRecord`. */
|
|
6
|
+
location: string;
|
|
7
|
+
/** The agent's id in the workspace. */
|
|
8
|
+
agent: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A person's choice to run one agent's harness on this computer, outside a
|
|
12
|
+
* sandbox (requirement `ports.agent-placement-store`). Without a record, the
|
|
13
|
+
* agent runs in a sandbox on this computer, so the default is the safe one.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const placement: AgentPlacementRecord = {
|
|
17
|
+
* location: "/workspaces/acme",
|
|
18
|
+
* agent: "coder",
|
|
19
|
+
* runsOn: "this-computer",
|
|
20
|
+
* agentFingerprint: "sha256:9f86d0…",
|
|
21
|
+
* chosenAt: "2026-11-09T10:00:00.000Z",
|
|
22
|
+
* };
|
|
23
|
+
*/
|
|
24
|
+
export interface AgentPlacementRecord extends AgentPlacementKey {
|
|
25
|
+
/** Where the person chose to run the agent. The only choice a record can hold. */
|
|
26
|
+
runsOn: "this-computer";
|
|
27
|
+
/**
|
|
28
|
+
* The fingerprint of the agent's file when the person chose. When the file
|
|
29
|
+
* changes, `AgentPlacement` in `core/app` treats the choice as not made
|
|
30
|
+
* until the person confirms again.
|
|
31
|
+
*/
|
|
32
|
+
agentFingerprint: string;
|
|
33
|
+
/** When the person chose, as ISO text. */
|
|
34
|
+
chosenAt: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Each agent's "this computer" choice, in the user's profile next to the
|
|
38
|
+
* trust records: the profile folder for the CLI and `serve`, the app data
|
|
39
|
+
* folder for the desktop app, memory for tests and the browser demo. **Never
|
|
40
|
+
* inside a workspace**, so an agent that edits the workspace can't take
|
|
41
|
+
* itself out of its sandbox.
|
|
42
|
+
*
|
|
43
|
+
* The port only stores choices. `AgentPlacement` in `core/app` reads them,
|
|
44
|
+
* checks the fingerprint and is what the engine asks. Only a person makes a
|
|
45
|
+
* choice: no tool the model can call reaches this store.
|
|
46
|
+
*
|
|
47
|
+
* A record that exists but can't be read makes `get` throw, never return
|
|
48
|
+
* `null`: the caller then runs the agent in a sandbox and tells the user why.
|
|
49
|
+
* The error names the record's key, and `remove` still deletes it.
|
|
50
|
+
*/
|
|
51
|
+
export interface AgentPlacementStore {
|
|
52
|
+
/** The choice for one agent, or `null` when there is none. */
|
|
53
|
+
get(key: AgentPlacementKey): Promise<AgentPlacementRecord | null>;
|
|
54
|
+
/** Saves a choice, replacing any with the same key. */
|
|
55
|
+
save(placement: AgentPlacementRecord): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Deletes the choice for one agent, even one that can't be read. Removing
|
|
58
|
+
* a choice that isn't there is not an error.
|
|
59
|
+
*/
|
|
60
|
+
remove(key: AgentPlacementKey): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Whether `value`, as read back from a store, is a valid choice for `key`:
|
|
64
|
+
* exactly the fields of an {@link AgentPlacementRecord}, each text, with
|
|
65
|
+
* `runsOn: "this-computer"` and the key asked for. Anything else is a
|
|
66
|
+
* damaged or borrowed choice, such as a hand edit or a file copied from
|
|
67
|
+
* another agent, and must never take an agent out of its sandbox. Every
|
|
68
|
+
* adapter checks what it reads with this, and `AgentPlacement` in
|
|
69
|
+
* `core/app` checks what an adapter gives back with it again.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* isAgentPlacementFor(key, JSON.parse(text)); // false for `{ ...record, sandbox: false }`
|
|
73
|
+
*/
|
|
74
|
+
export declare function isAgentPlacementFor(key: AgentPlacementKey, value: unknown): value is AgentPlacementRecord;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Version of the {@link AgentPlacementStore} port. A breaking change bumps it and comes with an ADR. */
|
|
2
|
+
export const agentPlacementStoreVersion = 1;
|
|
3
|
+
/** Every field of an {@link AgentPlacementRecord}, and no other. */
|
|
4
|
+
const placementFields = ["location", "agent", "runsOn", "agentFingerprint", "chosenAt"];
|
|
5
|
+
/**
|
|
6
|
+
* Whether `value`, as read back from a store, is a valid choice for `key`:
|
|
7
|
+
* exactly the fields of an {@link AgentPlacementRecord}, each text, with
|
|
8
|
+
* `runsOn: "this-computer"` and the key asked for. Anything else is a
|
|
9
|
+
* damaged or borrowed choice, such as a hand edit or a file copied from
|
|
10
|
+
* another agent, and must never take an agent out of its sandbox. Every
|
|
11
|
+
* adapter checks what it reads with this, and `AgentPlacement` in
|
|
12
|
+
* `core/app` checks what an adapter gives back with it again.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* isAgentPlacementFor(key, JSON.parse(text)); // false for `{ ...record, sandbox: false }`
|
|
16
|
+
*/
|
|
17
|
+
export function isAgentPlacementFor(key, value) {
|
|
18
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const record = value;
|
|
22
|
+
return (Object.keys(record).length === placementFields.length &&
|
|
23
|
+
placementFields.every((field) => Object.hasOwn(record, field) && typeof record[field] === "string") &&
|
|
24
|
+
record.runsOn === "this-computer" &&
|
|
25
|
+
record.location === key.location &&
|
|
26
|
+
record.agent === key.agent);
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What {@link RunExecutor.startAgent} throws when the executor refuses an agent run on purpose
|
|
3
|
+
* because agent runs aren't built yet (requirement `ports.agent-runs-not-available`). A caller
|
|
4
|
+
* that answers a person, such as the host's run routes, can then tell "not built yet" from a
|
|
5
|
+
* real failure.
|
|
6
|
+
*
|
|
7
|
+
* Check for it with {@link isAgentRunsNotAvailable}, not `instanceof`: an executor may be built
|
|
8
|
+
* against its own copy of this package.
|
|
9
|
+
*
|
|
10
|
+
* TODO(engine step 4): remove this with the mapping in `host/server` when the agent loop lands.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AgentRunsNotAvailable extends Error {
|
|
13
|
+
readonly name = "AgentRunsNotAvailable";
|
|
14
|
+
/** @param message - safe to log; the host doesn't send it to a client */
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Whether `value` is an {@link AgentRunsNotAvailable}: an `Error` named "AgentRunsNotAvailable".
|
|
19
|
+
* It works across copies of this package, where `instanceof` doesn't.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isAgentRunsNotAvailable(value: unknown): value is AgentRunsNotAvailable;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What {@link RunExecutor.startAgent} throws when the executor refuses an agent run on purpose
|
|
3
|
+
* because agent runs aren't built yet (requirement `ports.agent-runs-not-available`). A caller
|
|
4
|
+
* that answers a person, such as the host's run routes, can then tell "not built yet" from a
|
|
5
|
+
* real failure.
|
|
6
|
+
*
|
|
7
|
+
* Check for it with {@link isAgentRunsNotAvailable}, not `instanceof`: an executor may be built
|
|
8
|
+
* against its own copy of this package.
|
|
9
|
+
*
|
|
10
|
+
* TODO(engine step 4): remove this with the mapping in `host/server` when the agent loop lands.
|
|
11
|
+
*/
|
|
12
|
+
export class AgentRunsNotAvailable extends Error {
|
|
13
|
+
name = "AgentRunsNotAvailable";
|
|
14
|
+
/** @param message - safe to log; the host doesn't send it to a client */
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Whether `value` is an {@link AgentRunsNotAvailable}: an `Error` named "AgentRunsNotAvailable".
|
|
21
|
+
* It works across copies of this package, where `instanceof` doesn't.
|
|
22
|
+
*/
|
|
23
|
+
export function isAgentRunsNotAvailable(value) {
|
|
24
|
+
return value instanceof Error && value.name === "AgentRunsNotAvailable";
|
|
25
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Version of the {@link BlobStore} port. A breaking change bumps it and comes with an ADR. */
|
|
2
|
+
export declare const blobStoreVersion = 1;
|
|
3
|
+
/** A stored blob: its hash (lowercase hex SHA-256 of the bytes), size in bytes and media type. */
|
|
4
|
+
export interface BlobRef {
|
|
5
|
+
hash: string;
|
|
6
|
+
size: number;
|
|
7
|
+
mediaType: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Content-addressed storage for attachments, knowledge files, large event
|
|
11
|
+
* payloads and exports. The same bytes always get the same hash, so storing
|
|
12
|
+
* them twice keeps one copy.
|
|
13
|
+
*/
|
|
14
|
+
export interface BlobStore {
|
|
15
|
+
/**
|
|
16
|
+
* Stores the bytes and returns their reference, which echoes this call's
|
|
17
|
+
* `mediaType`. Storing the same bytes again with another type keeps one
|
|
18
|
+
* copy, and `get` doesn't promise which type, if any, was kept: callers
|
|
19
|
+
* keep the `BlobRef` they got.
|
|
20
|
+
*
|
|
21
|
+
* @throws RangeError when `mediaType` isn't `type/subtype` made of HTTP
|
|
22
|
+
* token characters (no parameters, spaces or line breaks), because it
|
|
23
|
+
* ends up in storage metadata and in a served `Content-Type` header
|
|
24
|
+
*/
|
|
25
|
+
put(data: Uint8Array, mediaType: string): Promise<BlobRef>;
|
|
26
|
+
/**
|
|
27
|
+
* The bytes stored under a hash, or `null` when there are none. A hash that
|
|
28
|
+
* isn't 64 lowercase hex characters returns `null` without touching
|
|
29
|
+
* storage, so it can never reach a file path or key (the old Node adapter
|
|
30
|
+
* read `get("../…")` outside its folder).
|
|
31
|
+
*/
|
|
32
|
+
get(hash: string): Promise<Uint8Array | null>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Refuses a media type {@link BlobStore.put} must not store: anything but
|
|
36
|
+
* `type/subtype` made of HTTP token characters.
|
|
37
|
+
*
|
|
38
|
+
* @throws RangeError naming the media type
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkBlobMediaType(mediaType: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Whether a hash can name a blob: 64 lowercase hex characters. Any other
|
|
43
|
+
* is answered with `null` by {@link BlobStore.get} before it reaches storage.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isBlobHash(hash: string): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Version of the {@link BlobStore} port. A breaking change bumps it and comes with an ADR. */
|
|
2
|
+
export const blobStoreVersion = 1;
|
|
3
|
+
/** HTTP token characters (RFC 9110), for each half of `type/subtype`. */
|
|
4
|
+
const mediaTypeToken = "[!#$%&'*+.^_`|~0-9A-Za-z-]+";
|
|
5
|
+
const mediaTypePattern = new RegExp(`^${mediaTypeToken}/${mediaTypeToken}$`, "u");
|
|
6
|
+
const blobHashPattern = /^[0-9a-f]{64}$/u;
|
|
7
|
+
/**
|
|
8
|
+
* Refuses a media type {@link BlobStore.put} must not store: anything but
|
|
9
|
+
* `type/subtype` made of HTTP token characters.
|
|
10
|
+
*
|
|
11
|
+
* @throws RangeError naming the media type
|
|
12
|
+
*/
|
|
13
|
+
export function checkBlobMediaType(mediaType) {
|
|
14
|
+
if (!mediaTypePattern.test(mediaType)) {
|
|
15
|
+
throw new RangeError(`Media type ${JSON.stringify(mediaType)} is not type/subtype without parameters.`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Whether a hash can name a blob: 64 lowercase hex characters. Any other
|
|
20
|
+
* is answered with `null` by {@link BlobStore.get} before it reaches storage.
|
|
21
|
+
*/
|
|
22
|
+
export function isBlobHash(hash) {
|
|
23
|
+
return blobHashPattern.test(hash);
|
|
24
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CantTryReason } from "../../events/src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* An error a Try it or Test adapter throws when a step it serves can't be
|
|
4
|
+
* tried, because it needs a change left out of the run, such as a model
|
|
5
|
+
* alias that is new in `models.yaml` (requirement `ports.cant-try-error`).
|
|
6
|
+
* The engine then ends the step's branch as it does for a failed step, and
|
|
7
|
+
* the run ends with `run.cant-try` instead of `run.failed`. The engine adds
|
|
8
|
+
* the step's id; the adapter knows the item being tried and why.
|
|
9
|
+
*
|
|
10
|
+
* The message must be safe to show and to log. Check for it with
|
|
11
|
+
* {@link isCantTryError}, not `instanceof`: an adapter may be built against
|
|
12
|
+
* its own copy of this package.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const reason = { kind: "needs-left-out-change", path: "models.yaml", leftOut: "models" } as const;
|
|
16
|
+
* throw new CantTryError("workflows/triage.yaml", reason, "Alias smart is new.");
|
|
17
|
+
*/
|
|
18
|
+
export declare class CantTryError extends Error {
|
|
19
|
+
readonly name = "CantTryError";
|
|
20
|
+
/** The path of the item being tried. */
|
|
21
|
+
readonly item: string;
|
|
22
|
+
readonly reason: CantTryReason;
|
|
23
|
+
/**
|
|
24
|
+
* @param item - the path of the item being tried
|
|
25
|
+
* @param reason - which left-out change the step needs
|
|
26
|
+
* @param message - safe to show and to log
|
|
27
|
+
*/
|
|
28
|
+
constructor(item: string, reason: CantTryReason, message: string);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Whether `value` is a {@link CantTryError}: an `Error` named "CantTryError"
|
|
32
|
+
* with an `item` and a `reason` of a known kind. It works across copies of
|
|
33
|
+
* this package, where `instanceof` doesn't.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isCantTryError(value: unknown): value is CantTryError;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An error a Try it or Test adapter throws when a step it serves can't be
|
|
3
|
+
* tried, because it needs a change left out of the run, such as a model
|
|
4
|
+
* alias that is new in `models.yaml` (requirement `ports.cant-try-error`).
|
|
5
|
+
* The engine then ends the step's branch as it does for a failed step, and
|
|
6
|
+
* the run ends with `run.cant-try` instead of `run.failed`. The engine adds
|
|
7
|
+
* the step's id; the adapter knows the item being tried and why.
|
|
8
|
+
*
|
|
9
|
+
* The message must be safe to show and to log. Check for it with
|
|
10
|
+
* {@link isCantTryError}, not `instanceof`: an adapter may be built against
|
|
11
|
+
* its own copy of this package.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const reason = { kind: "needs-left-out-change", path: "models.yaml", leftOut: "models" } as const;
|
|
15
|
+
* throw new CantTryError("workflows/triage.yaml", reason, "Alias smart is new.");
|
|
16
|
+
*/
|
|
17
|
+
export class CantTryError extends Error {
|
|
18
|
+
name = "CantTryError";
|
|
19
|
+
/** The path of the item being tried. */
|
|
20
|
+
item;
|
|
21
|
+
reason;
|
|
22
|
+
/**
|
|
23
|
+
* @param item - the path of the item being tried
|
|
24
|
+
* @param reason - which left-out change the step needs
|
|
25
|
+
* @param message - safe to show and to log
|
|
26
|
+
*/
|
|
27
|
+
constructor(item, reason, message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.item = item;
|
|
30
|
+
this.reason = reason;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether `value` is a {@link CantTryError}: an `Error` named "CantTryError"
|
|
35
|
+
* with an `item` and a `reason` of a known kind. It works across copies of
|
|
36
|
+
* this package, where `instanceof` doesn't.
|
|
37
|
+
*/
|
|
38
|
+
export function isCantTryError(value) {
|
|
39
|
+
if (!(value instanceof Error) || value.name !== "CantTryError")
|
|
40
|
+
return false;
|
|
41
|
+
const { item, reason } = value;
|
|
42
|
+
const knownKind = reason?.kind === "needs-left-out-change" || reason?.kind === "invalid-without-change";
|
|
43
|
+
return typeof item === "string" && knownKind;
|
|
44
|
+
}
|