@halonicjs/testing 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +1 -0
- package/README.md +40 -2
- package/dist/adapters/http-kit/src/address-class.d.ts +34 -0
- package/dist/adapters/http-kit/src/address-class.js +109 -0
- package/dist/adapters/http-kit/src/index.d.ts +2 -0
- package/dist/adapters/http-kit/src/index.js +2 -0
- package/dist/adapters/http-kit/src/ip-address.d.ts +23 -0
- package/dist/adapters/http-kit/src/ip-address.js +89 -0
- package/dist/adapters/integration-kit/src/declaration.d.ts +14 -0
- package/dist/adapters/integration-kit/src/declaration.js +77 -0
- package/dist/adapters/integration-kit/src/host.d.ts +28 -0
- package/dist/adapters/integration-kit/src/host.js +30 -0
- package/dist/adapters/integration-kit/src/index.d.ts +14 -0
- package/dist/adapters/integration-kit/src/index.js +21 -0
- package/dist/adapters/integration-kit/src/leak-attempt.d.ts +14 -0
- package/dist/adapters/integration-kit/src/leak-attempt.js +16 -0
- package/dist/adapters/integration-kit/src/limited-http.d.ts +49 -0
- package/dist/adapters/integration-kit/src/limited-http.js +182 -0
- package/dist/adapters/integration-kit/src/load-problem.d.ts +20 -0
- package/dist/adapters/integration-kit/src/load-problem.js +1 -0
- package/dist/adapters/integration-kit/src/loader.d.ts +104 -0
- package/dist/adapters/integration-kit/src/loader.js +219 -0
- package/dist/adapters/integration-kit/src/local-address.d.ts +15 -0
- package/dist/adapters/integration-kit/src/local-address.js +25 -0
- package/dist/adapters/integration-kit/src/own-request.d.ts +33 -0
- package/dist/adapters/integration-kit/src/own-request.js +36 -0
- package/dist/adapters/integration-kit/src/plugin-load.d.ts +14 -0
- package/dist/adapters/integration-kit/src/plugin-load.js +58 -0
- package/dist/adapters/integration-kit/src/policy.d.ts +55 -0
- package/dist/adapters/integration-kit/src/policy.js +37 -0
- package/dist/adapters/integration-kit/src/request-body.d.ts +38 -0
- package/dist/adapters/integration-kit/src/request-body.js +68 -0
- package/dist/adapters/integration-kit/src/request-log.d.ts +25 -0
- package/dist/adapters/integration-kit/src/request-log.js +17 -0
- package/dist/adapters/integration-kit/src/response-body.d.ts +23 -0
- package/dist/adapters/integration-kit/src/response-body.js +117 -0
- package/dist/adapters/integration-kit/src/scoped-tokens.d.ts +14 -0
- package/dist/adapters/integration-kit/src/scoped-tokens.js +27 -0
- package/dist/adapters/integration-kit/src/secret-filter.d.ts +84 -0
- package/dist/adapters/integration-kit/src/secret-filter.js +205 -0
- package/dist/adapters/integration-kit/src/secret-in-request.d.ts +59 -0
- package/dist/adapters/integration-kit/src/secret-in-request.js +133 -0
- package/dist/adapters/integration-kit/src/secret-placement.d.ts +36 -0
- package/dist/adapters/integration-kit/src/secret-placement.js +190 -0
- package/dist/adapters/integration-kit/src/wait.d.ts +16 -0
- package/dist/adapters/integration-kit/src/wait.js +35 -0
- package/dist/core/events/src/add-usage.d.ts +10 -0
- package/dist/core/events/src/add-usage.js +27 -0
- package/dist/core/events/src/agent-resume.d.ts +24 -0
- package/dist/core/events/src/agent-resume.js +1 -0
- package/dist/core/events/src/home-path.d.ts +13 -0
- package/dist/core/events/src/home-path.js +26 -0
- package/dist/core/events/src/index.d.ts +13 -0
- package/dist/core/events/src/index.js +7 -0
- package/dist/core/events/src/run-basics.d.ts +205 -0
- package/dist/core/events/src/run-basics.js +1 -0
- package/dist/core/events/src/run-event.d.ts +434 -0
- package/dist/core/events/src/run-event.js +1 -0
- package/dist/core/events/src/run-summary.d.ts +108 -0
- package/dist/core/events/src/run-summary.js +1 -0
- package/dist/core/events/src/sandbox-blocked.d.ts +42 -0
- package/dist/core/events/src/sandbox-blocked.js +26 -0
- package/dist/core/events/src/sandbox-opened-read.d.ts +17 -0
- package/dist/core/events/src/sandbox-opened-read.js +63 -0
- package/dist/core/events/src/sandbox-opened.d.ts +94 -0
- package/dist/core/events/src/sandbox-opened.js +52 -0
- package/dist/core/events/src/summarize.d.ts +14 -0
- package/dist/core/events/src/summarize.js +188 -0
- package/dist/core/events/src/timeline-entry.d.ts +21 -0
- package/dist/core/events/src/timeline-entry.js +105 -0
- package/dist/core/events/src/upgrade.d.ts +23 -0
- package/dist/core/events/src/upgrade.js +49 -0
- package/dist/core/format/src/compact.d.ts +30 -0
- package/dist/core/format/src/compact.js +72 -0
- package/dist/core/format/src/index.d.ts +37 -0
- package/dist/core/format/src/index.js +23 -0
- package/dist/core/format/src/integration/index.d.ts +6 -0
- package/dist/core/format/src/integration/index.js +9 -0
- package/dist/core/format/src/json-schema.d.ts +26 -0
- package/dist/core/format/src/json-schema.js +48 -0
- package/dist/core/format/src/kind.d.ts +65 -0
- package/dist/core/format/src/kind.js +1 -0
- package/dist/core/format/src/kinds/agent/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/agent/kind.js +10 -0
- package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +89 -0
- package/dist/core/format/src/kinds/agent/sandbox-fields.js +197 -0
- package/dist/core/format/src/kinds/agent/schema.d.ts +147 -0
- package/dist/core/format/src/kinds/agent/schema.js +107 -0
- package/dist/core/format/src/kinds/agent/working-folder-start.d.ts +74 -0
- package/dist/core/format/src/kinds/agent/working-folder-start.js +312 -0
- package/dist/core/format/src/kinds/collection/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/collection/kind.js +14 -0
- package/dist/core/format/src/kinds/collection/schema.d.ts +89 -0
- package/dist/core/format/src/kinds/collection/schema.js +90 -0
- package/dist/core/format/src/kinds/connector/is-local.d.ts +10 -0
- package/dist/core/format/src/kinds/connector/is-local.js +43 -0
- package/dist/core/format/src/kinds/connector/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/connector/kind.js +119 -0
- package/dist/core/format/src/kinds/connector/schema.d.ts +50 -0
- package/dist/core/format/src/kinds/connector/schema.js +92 -0
- package/dist/core/format/src/kinds/deployments/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/deployments/kind.js +25 -0
- package/dist/core/format/src/kinds/deployments/schema.d.ts +37 -0
- package/dist/core/format/src/kinds/deployments/schema.js +42 -0
- package/dist/core/format/src/kinds/hub/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/hub/kind.js +10 -0
- package/dist/core/format/src/kinds/hub/schema.d.ts +54 -0
- package/dist/core/format/src/kinds/hub/schema.js +34 -0
- package/dist/core/format/src/kinds/integration/kind.d.ts +16 -0
- package/dist/core/format/src/kinds/integration/kind.js +138 -0
- package/dist/core/format/src/kinds/integration/parse-sheet.d.ts +19 -0
- package/dist/core/format/src/kinds/integration/parse-sheet.js +24 -0
- package/dist/core/format/src/kinds/integration/policy.d.ts +67 -0
- package/dist/core/format/src/kinds/integration/policy.js +268 -0
- package/dist/core/format/src/kinds/integration/schema.d.ts +233 -0
- package/dist/core/format/src/kinds/integration/schema.js +233 -0
- package/dist/core/format/src/kinds/knowledge/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/knowledge/kind.js +13 -0
- package/dist/core/format/src/kinds/knowledge/schema.d.ts +18 -0
- package/dist/core/format/src/kinds/knowledge/schema.js +25 -0
- package/dist/core/format/src/kinds/models/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/models/kind.js +10 -0
- package/dist/core/format/src/kinds/models/schema.d.ts +92 -0
- package/dist/core/format/src/kinds/models/schema.js +38 -0
- package/dist/core/format/src/kinds/plugin/backend.d.ts +22 -0
- package/dist/core/format/src/kinds/plugin/backend.js +31 -0
- package/dist/core/format/src/kinds/plugin/checks.d.ts +13 -0
- package/dist/core/format/src/kinds/plugin/checks.js +131 -0
- package/dist/core/format/src/kinds/plugin/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/plugin/kind.js +16 -0
- package/dist/core/format/src/kinds/plugin/problems.d.ts +24 -0
- package/dist/core/format/src/kinds/plugin/problems.js +65 -0
- package/dist/core/format/src/kinds/plugin/schema.d.ts +542 -0
- package/dist/core/format/src/kinds/plugin/schema.js +261 -0
- package/dist/core/format/src/kinds/plugin/setting-values.d.ts +17 -0
- package/dist/core/format/src/kinds/plugin/setting-values.js +38 -0
- package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +8 -0
- package/dist/core/format/src/kinds/plugin/ui-checks.js +94 -0
- package/dist/core/format/src/kinds/provider/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/provider/kind.js +24 -0
- package/dist/core/format/src/kinds/provider/schema.d.ts +17 -0
- package/dist/core/format/src/kinds/provider/schema.js +22 -0
- package/dist/core/format/src/kinds/routine/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/routine/kind.js +25 -0
- package/dist/core/format/src/kinds/routine/schema.d.ts +84 -0
- package/dist/core/format/src/kinds/routine/schema.js +93 -0
- package/dist/core/format/src/kinds/runtime/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/runtime/kind.js +13 -0
- package/dist/core/format/src/kinds/runtime/schema.d.ts +10 -0
- package/dist/core/format/src/kinds/runtime/schema.js +12 -0
- package/dist/core/format/src/kinds/skill/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/skill/kind.js +10 -0
- package/dist/core/format/src/kinds/skill/schema.d.ts +17 -0
- package/dist/core/format/src/kinds/skill/schema.js +17 -0
- package/dist/core/format/src/kinds/skill/scripts-folder.d.ts +27 -0
- package/dist/core/format/src/kinds/skill/scripts-folder.js +37 -0
- package/dist/core/format/src/kinds/workflow/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/workflow/kind.js +14 -0
- package/dist/core/format/src/kinds/workflow/schema.d.ts +162 -0
- package/dist/core/format/src/kinds/workflow/schema.js +106 -0
- package/dist/core/format/src/kinds/workflow-test/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/workflow-test/kind.js +14 -0
- package/dist/core/format/src/kinds/workflow-test/schema.d.ts +67 -0
- package/dist/core/format/src/kinds/workflow-test/schema.js +59 -0
- package/dist/core/format/src/kinds/workspace/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/workspace/kind.js +10 -0
- package/dist/core/format/src/kinds/workspace/schema.d.ts +72 -0
- package/dist/core/format/src/kinds/workspace/schema.js +66 -0
- package/dist/core/format/src/parse-file.d.ts +69 -0
- package/dist/core/format/src/parse-file.js +105 -0
- package/dist/core/format/src/recording/format.d.ts +81 -0
- package/dist/core/format/src/recording/format.js +102 -0
- package/dist/core/format/src/recording/index.d.ts +1 -0
- package/dist/core/format/src/recording/index.js +3 -0
- package/dist/core/format/src/registry.d.ts +64 -0
- package/dist/core/format/src/registry.js +61 -0
- package/dist/core/format/src/reserved.d.ts +20 -0
- package/dist/core/format/src/reserved.js +30 -0
- package/dist/core/format/src/shared/fields.d.ts +37 -0
- package/dist/core/format/src/shared/fields.js +54 -0
- package/dist/core/format/src/shared/guard.d.ts +32 -0
- package/dist/core/format/src/shared/guard.js +16 -0
- package/dist/core/format/src/shared/key-in-value.d.ts +28 -0
- package/dist/core/format/src/shared/key-in-value.js +82 -0
- package/dist/core/format/src/shared/legacy-keys.d.ts +8 -0
- package/dist/core/format/src/shared/legacy-keys.js +17 -0
- package/dist/core/format/src/shared/program-start.d.ts +60 -0
- package/dist/core/format/src/shared/program-start.js +99 -0
- package/dist/core/format/src/shared/relative-path.d.ts +29 -0
- package/dist/core/format/src/shared/relative-path.js +50 -0
- package/dist/core/format/src/shared/secret-name.d.ts +24 -0
- package/dist/core/format/src/shared/secret-name.js +107 -0
- package/dist/core/format/src/source.d.ts +16 -0
- package/dist/core/format/src/source.js +73 -0
- package/dist/core/ports/src/agent-placement-store.d.ts +74 -0
- package/dist/core/ports/src/agent-placement-store.js +27 -0
- package/dist/core/ports/src/blob-store.d.ts +33 -0
- package/dist/core/ports/src/blob-store.js +2 -0
- package/dist/core/ports/src/cant-try-error.d.ts +35 -0
- package/dist/core/ports/src/cant-try-error.js +44 -0
- package/dist/core/ports/src/chat.d.ts +127 -0
- package/dist/core/ports/src/chat.js +1 -0
- package/dist/core/ports/src/clock.d.ts +7 -0
- package/dist/core/ports/src/clock.js +2 -0
- package/dist/core/ports/src/connection-settings-store.d.ts +57 -0
- package/dist/core/ports/src/connection-settings-store.js +2 -0
- package/dist/core/ports/src/connector-client.d.ts +259 -0
- package/dist/core/ports/src/connector-client.js +2 -0
- package/dist/core/ports/src/coordination.d.ts +84 -0
- package/dist/core/ports/src/coordination.js +2 -0
- package/dist/core/ports/src/definition-store.d.ts +208 -0
- package/dist/core/ports/src/definition-store.js +122 -0
- package/dist/core/ports/src/digest.d.ts +14 -0
- package/dist/core/ports/src/digest.js +2 -0
- package/dist/core/ports/src/folder-reader.d.ts +89 -0
- package/dist/core/ports/src/folder-reader.js +2 -0
- package/dist/core/ports/src/harness-bridge-server.d.ts +189 -0
- package/dist/core/ports/src/harness-bridge-server.js +37 -0
- package/dist/core/ports/src/harness.d.ts +250 -0
- package/dist/core/ports/src/harness.js +45 -0
- package/dist/core/ports/src/http-client.d.ts +27 -0
- package/dist/core/ports/src/http-client.js +2 -0
- package/dist/core/ports/src/id-generator.d.ts +14 -0
- package/dist/core/ports/src/id-generator.js +2 -0
- package/dist/core/ports/src/index.d.ts +37 -0
- package/dist/core/ports/src/index.js +36 -0
- package/dist/core/ports/src/integration.d.ts +178 -0
- package/dist/core/ports/src/integration.js +13 -0
- package/dist/core/ports/src/knowledge-provider.d.ts +65 -0
- package/dist/core/ports/src/knowledge-provider.js +2 -0
- package/dist/core/ports/src/llm-cache.d.ts +13 -0
- package/dist/core/ports/src/llm-cache.js +2 -0
- package/dist/core/ports/src/llm-provider.d.ts +184 -0
- package/dist/core/ports/src/llm-provider.js +136 -0
- package/dist/core/ports/src/model-price.d.ts +34 -0
- package/dist/core/ports/src/model-price.js +25 -0
- package/dist/core/ports/src/password-hasher.d.ts +47 -0
- package/dist/core/ports/src/password-hasher.js +2 -0
- package/dist/core/ports/src/plugin-folder-writer.d.ts +104 -0
- package/dist/core/ports/src/plugin-folder-writer.js +95 -0
- package/dist/core/ports/src/port-versions.d.ts +44 -0
- package/dist/core/ports/src/port-versions.js +74 -0
- package/dist/core/ports/src/program-probe.d.ts +46 -0
- package/dist/core/ports/src/program-probe.js +2 -0
- package/dist/core/ports/src/record-store.d.ts +62 -0
- package/dist/core/ports/src/record-store.js +38 -0
- package/dist/core/ports/src/resource-probe.d.ts +59 -0
- package/dist/core/ports/src/resource-probe.js +2 -0
- package/dist/core/ports/src/run-executor.d.ts +302 -0
- package/dist/core/ports/src/run-executor.js +2 -0
- package/dist/core/ports/src/run-failure-error.d.ts +49 -0
- package/dist/core/ports/src/run-failure-error.js +47 -0
- package/dist/core/ports/src/run-store.d.ts +194 -0
- package/dist/core/ports/src/run-store.js +131 -0
- package/dist/core/ports/src/sandbox.d.ts +247 -0
- package/dist/core/ports/src/sandbox.js +34 -0
- package/dist/core/ports/src/scheduler.d.ts +85 -0
- package/dist/core/ports/src/scheduler.js +2 -0
- package/dist/core/ports/src/secrets.d.ts +128 -0
- package/dist/core/ports/src/secrets.js +144 -0
- package/dist/core/ports/src/token-store.d.ts +19 -0
- package/dist/core/ports/src/token-store.js +2 -0
- package/dist/core/ports/src/tool-approval-store.d.ts +211 -0
- package/dist/core/ports/src/tool-approval-store.js +57 -0
- package/dist/core/ports/src/trust-store.d.ts +72 -0
- package/dist/core/ports/src/trust-store.js +2 -0
- package/dist/core/ports/src/unfenced-run-consent-store.d.ts +43 -0
- package/dist/core/ports/src/unfenced-run-consent-store.js +2 -0
- package/dist/core/ports/src/vcs.d.ts +394 -0
- package/dist/core/ports/src/vcs.js +48 -0
- package/dist/core/schema-kit/src/builders.d.ts +50 -0
- package/dist/core/schema-kit/src/builders.js +72 -0
- package/dist/core/schema-kit/src/depth.d.ts +15 -0
- package/dist/core/schema-kit/src/depth.js +37 -0
- package/dist/core/schema-kit/src/index.d.ts +6 -0
- package/dist/core/schema-kit/src/index.js +6 -0
- package/dist/core/schema-kit/src/issue.d.ts +22 -0
- package/dist/core/schema-kit/src/issue.js +23 -0
- package/dist/core/schema-kit/src/json-schema.d.ts +23 -0
- package/dist/core/schema-kit/src/json-schema.js +22 -0
- package/dist/core/schema-kit/src/parse.d.ts +17 -0
- package/dist/core/schema-kit/src/parse.js +25 -0
- package/dist/core/schema-kit/src/schema.d.ts +12 -0
- package/dist/core/schema-kit/src/schema.js +1 -0
- package/dist/core/std/src/ascii-host.d.ts +18 -0
- package/dist/core/std/src/ascii-host.js +110 -0
- package/dist/core/std/src/assert.d.ts +39 -0
- package/dist/core/std/src/assert.js +59 -0
- package/dist/core/std/src/base64url.d.ts +23 -0
- package/dist/core/std/src/base64url.js +65 -0
- package/dist/core/std/src/canonical-json.d.ts +18 -0
- package/dist/core/std/src/canonical-json.js +56 -0
- package/dist/core/std/src/clock.d.ts +27 -0
- package/dist/core/std/src/clock.js +33 -0
- package/dist/core/std/src/constant-time.d.ts +16 -0
- package/dist/core/std/src/constant-time.js +26 -0
- package/dist/core/std/src/content-digest.d.ts +24 -0
- package/dist/core/std/src/content-digest.js +28 -0
- package/dist/core/std/src/deep-clone.d.ts +15 -0
- package/dist/core/std/src/deep-clone.js +59 -0
- package/dist/core/std/src/deep-equal.d.ts +23 -0
- package/dist/core/std/src/deep-equal.js +64 -0
- package/dist/core/std/src/emitter.d.ts +42 -0
- package/dist/core/std/src/emitter.js +74 -0
- package/dist/core/std/src/error-kind.d.ts +88 -0
- package/dist/core/std/src/error-kind.js +98 -0
- package/dist/core/std/src/hex.d.ts +10 -0
- package/dist/core/std/src/hex.js +16 -0
- package/dist/core/std/src/ids.d.ts +45 -0
- package/dist/core/std/src/ids.js +49 -0
- package/dist/core/std/src/index.d.ts +25 -0
- package/dist/core/std/src/index.js +26 -0
- package/dist/core/std/src/keyed-queue.d.ts +18 -0
- package/dist/core/std/src/keyed-queue.js +32 -0
- package/dist/core/std/src/line-diff.d.ts +83 -0
- package/dist/core/std/src/line-diff.js +179 -0
- package/dist/core/std/src/line-merge.d.ts +63 -0
- package/dist/core/std/src/line-merge.js +138 -0
- package/dist/core/std/src/plain-data.d.ts +32 -0
- package/dist/core/std/src/plain-data.js +57 -0
- package/dist/core/std/src/posix-path.d.ts +61 -0
- package/dist/core/std/src/posix-path.js +121 -0
- package/dist/core/std/src/result.d.ts +55 -0
- package/dist/core/std/src/result.js +52 -0
- package/dist/core/std/src/secret-scrubber.d.ts +54 -0
- package/dist/core/std/src/secret-scrubber.js +124 -0
- package/dist/core/std/src/secret-shape.d.ts +20 -0
- package/dist/core/std/src/secret-shape.js +53 -0
- package/dist/core/std/src/stop-signal.d.ts +44 -0
- package/dist/core/std/src/stop-signal.js +77 -0
- package/dist/core/std/src/text.d.ts +28 -0
- package/dist/core/std/src/text.js +54 -0
- package/dist/core/std/src/utf8.d.ts +23 -0
- package/dist/core/std/src/utf8.js +110 -0
- package/dist/core/std/src/version.d.ts +48 -0
- package/dist/core/std/src/version.js +103 -0
- package/dist/core/yaml/src/depth.d.ts +14 -0
- package/dist/core/yaml/src/depth.js +140 -0
- package/dist/core/yaml/src/edit-data.d.ts +47 -0
- package/dist/core/yaml/src/edit-data.js +286 -0
- package/dist/core/yaml/src/edit-text.d.ts +92 -0
- package/dist/core/yaml/src/edit-text.js +267 -0
- package/dist/core/yaml/src/edit.d.ts +47 -0
- package/dist/core/yaml/src/edit.js +198 -0
- package/dist/core/yaml/src/index.d.ts +5 -0
- package/dist/core/yaml/src/index.js +4 -0
- package/dist/core/yaml/src/problem.d.ts +20 -0
- package/dist/core/yaml/src/problem.js +1 -0
- package/dist/core/yaml/src/read.d.ts +47 -0
- package/dist/core/yaml/src/read.js +130 -0
- package/dist/core/yaml/src/splice-node.d.ts +47 -0
- package/dist/core/yaml/src/splice-node.js +333 -0
- package/dist/core/yaml/src/splice.d.ts +13 -0
- package/dist/core/yaml/src/splice.js +174 -0
- package/dist/core/yaml/src/unsupported.d.ts +26 -0
- package/dist/core/yaml/src/unsupported.js +70 -0
- package/dist/core/yaml/src/write.d.ts +35 -0
- package/dist/core/yaml/src/write.js +44 -0
- package/dist/testing/integration/src/canaries.d.ts +14 -0
- package/dist/testing/integration/src/canaries.js +17 -0
- package/dist/testing/integration/src/checks.d.ts +37 -0
- package/dist/testing/integration/src/checks.js +195 -0
- package/dist/testing/integration/src/describe.d.ts +35 -0
- package/dist/testing/integration/src/describe.js +74 -0
- package/dist/testing/integration/src/failure.d.ts +6 -0
- package/dist/testing/integration/src/failure.js +8 -0
- package/dist/testing/integration/src/fake-wait.d.ts +18 -0
- package/dist/testing/integration/src/fake-wait.js +21 -0
- package/dist/testing/integration/src/index.d.ts +10 -0
- package/dist/testing/integration/src/index.js +11 -0
- package/dist/testing/integration/src/load.d.ts +14 -0
- package/dist/testing/integration/src/load.js +45 -0
- package/dist/testing/integration/src/plugin-folder.d.ts +23 -0
- package/dist/testing/integration/src/plugin-folder.js +59 -0
- package/dist/testing/integration/src/plugin.d.ts +32 -0
- package/dist/testing/integration/src/plugin.js +57 -0
- package/dist/testing/integration/src/recording.d.ts +84 -0
- package/dist/testing/integration/src/recording.js +164 -0
- package/dist/testing/integration/src/run.d.ts +60 -0
- package/dist/testing/integration/src/run.js +81 -0
- package/dist/testing/integration/src/source-scan.d.ts +16 -0
- package/dist/testing/integration/src/source-scan.js +40 -0
- package/package.json +35 -4
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type Infer } from "../../../../schema-kit/src/index.js";
|
|
2
|
+
/** The shape of an agent's reply: free text, one of a list of options, or JSON. */
|
|
3
|
+
export declare const AgentOutput: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
4
|
+
type: import("zod").ZodLiteral<"text">;
|
|
5
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
6
|
+
type: import("zod").ZodLiteral<"choice">;
|
|
7
|
+
options: import("zod").ZodArray<import("zod").ZodString>;
|
|
8
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
9
|
+
type: import("zod").ZodLiteral<"json">;
|
|
10
|
+
schema: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
11
|
+
}, import("zod/v4/core").$strict>], "type">;
|
|
12
|
+
/** A field of a method's answer; a trailing "?" makes it optional. */
|
|
13
|
+
export declare const MethodField: import("zod").ZodEnum<{
|
|
14
|
+
boolean: "boolean";
|
|
15
|
+
"boolean?": "boolean?";
|
|
16
|
+
list: "list";
|
|
17
|
+
"list?": "list?";
|
|
18
|
+
number: "number";
|
|
19
|
+
"number?": "number?";
|
|
20
|
+
object: "object";
|
|
21
|
+
"object?": "object?";
|
|
22
|
+
string: "string";
|
|
23
|
+
"string?": "string?";
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* A named task an agent can do, called by workflow steps
|
|
27
|
+
* (`agent: finance, method: extract-invoice, with: { … }`).
|
|
28
|
+
*/
|
|
29
|
+
export declare const AgentMethod: import("zod").ZodObject<{
|
|
30
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
31
|
+
input: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
32
|
+
instructions: import("zod").ZodString;
|
|
33
|
+
tools: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
34
|
+
model: import("zod").ZodOptional<import("zod").ZodString>;
|
|
35
|
+
maxSteps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
36
|
+
output: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<"text">, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodEnum<{
|
|
37
|
+
boolean: "boolean";
|
|
38
|
+
"boolean?": "boolean?";
|
|
39
|
+
list: "list";
|
|
40
|
+
"list?": "list?";
|
|
41
|
+
number: "number";
|
|
42
|
+
"number?": "number?";
|
|
43
|
+
object: "object";
|
|
44
|
+
"object?": "object?";
|
|
45
|
+
string: "string";
|
|
46
|
+
"string?": "string?";
|
|
47
|
+
}>>]>>;
|
|
48
|
+
}, import("zod/v4/core").$strict>;
|
|
49
|
+
/** How the agent's character looks; colours default to a pair taken from the agent id. */
|
|
50
|
+
export declare const AgentCharacter: import("zod").ZodObject<{
|
|
51
|
+
style: import("zod").ZodDefault<import("zod").ZodLiteral<"buddy">>;
|
|
52
|
+
surface: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
53
|
+
glossy: "glossy";
|
|
54
|
+
soft: "soft";
|
|
55
|
+
}>>;
|
|
56
|
+
body: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
57
|
+
elastic: "elastic";
|
|
58
|
+
firm: "firm";
|
|
59
|
+
}>>;
|
|
60
|
+
top: import("zod").ZodDefault<import("zod").ZodLiteral<"none">>;
|
|
61
|
+
colors: import("zod").ZodOptional<import("zod").ZodTuple<[import("zod").ZodString, import("zod").ZodString], null>>;
|
|
62
|
+
}, import("zod/v4/core").$strict>;
|
|
63
|
+
/** `agents/<id>.agent.yaml`: an agent's model, instructions, tools and methods. */
|
|
64
|
+
export declare const Agent: import("zod").ZodObject<{
|
|
65
|
+
version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
|
|
66
|
+
id: import("zod").ZodString;
|
|
67
|
+
name: import("zod").ZodString;
|
|
68
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
69
|
+
model: import("zod").ZodOptional<import("zod").ZodString>;
|
|
70
|
+
params: import("zod").ZodDefault<import("zod").ZodObject<{
|
|
71
|
+
temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
72
|
+
topP: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
73
|
+
maxTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
74
|
+
stop: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
75
|
+
reasoningEffort: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
76
|
+
high: "high";
|
|
77
|
+
low: "low";
|
|
78
|
+
medium: "medium";
|
|
79
|
+
}>>;
|
|
80
|
+
extra: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
81
|
+
}, import("zod/v4/core").$strict>>;
|
|
82
|
+
instructions: import("zod").ZodDefault<import("zod").ZodString>;
|
|
83
|
+
skills: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
84
|
+
knowledge: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
85
|
+
connectors: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
86
|
+
runLogs: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
87
|
+
collections: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
88
|
+
subagents: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
89
|
+
methods: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
90
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
91
|
+
input: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
92
|
+
instructions: import("zod").ZodString;
|
|
93
|
+
tools: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
94
|
+
model: import("zod").ZodOptional<import("zod").ZodString>;
|
|
95
|
+
maxSteps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
96
|
+
output: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<"text">, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodEnum<{
|
|
97
|
+
boolean: "boolean";
|
|
98
|
+
"boolean?": "boolean?";
|
|
99
|
+
list: "list";
|
|
100
|
+
"list?": "list?";
|
|
101
|
+
number: "number";
|
|
102
|
+
"number?": "number?";
|
|
103
|
+
object: "object";
|
|
104
|
+
"object?": "object?";
|
|
105
|
+
string: "string";
|
|
106
|
+
"string?": "string?";
|
|
107
|
+
}>>]>>;
|
|
108
|
+
}, import("zod/v4/core").$strict>>>;
|
|
109
|
+
output: import("zod").ZodDefault<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
110
|
+
type: import("zod").ZodLiteral<"text">;
|
|
111
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
112
|
+
type: import("zod").ZodLiteral<"choice">;
|
|
113
|
+
options: import("zod").ZodArray<import("zod").ZodString>;
|
|
114
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
115
|
+
type: import("zod").ZodLiteral<"json">;
|
|
116
|
+
schema: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
117
|
+
}, import("zod/v4/core").$strict>], "type">>;
|
|
118
|
+
maxSteps: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
119
|
+
character: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
120
|
+
style: import("zod").ZodDefault<import("zod").ZodLiteral<"buddy">>;
|
|
121
|
+
surface: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
122
|
+
glossy: "glossy";
|
|
123
|
+
soft: "soft";
|
|
124
|
+
}>>;
|
|
125
|
+
body: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
126
|
+
elastic: "elastic";
|
|
127
|
+
firm: "firm";
|
|
128
|
+
}>>;
|
|
129
|
+
top: import("zod").ZodDefault<import("zod").ZodLiteral<"none">>;
|
|
130
|
+
colors: import("zod").ZodOptional<import("zod").ZodTuple<[import("zod").ZodString, import("zod").ZodString], null>>;
|
|
131
|
+
}, import("zod/v4/core").$strict>>;
|
|
132
|
+
harness: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
133
|
+
"claude-code": "claude-code";
|
|
134
|
+
codex: "codex";
|
|
135
|
+
halonic: "halonic";
|
|
136
|
+
}>>;
|
|
137
|
+
workingFolder: import("zod").ZodOptional<import("zod").ZodString>;
|
|
138
|
+
allowedSites: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
139
|
+
}, import("zod/v4/core").$strict>;
|
|
140
|
+
/** An agent, with defaults filled in. */
|
|
141
|
+
export type Agent = Infer<typeof Agent>;
|
|
142
|
+
/** One of an agent's methods. */
|
|
143
|
+
export type AgentMethod = Infer<typeof AgentMethod>;
|
|
144
|
+
/** The shape of an agent's reply. */
|
|
145
|
+
export type AgentOutput = Infer<typeof AgentOutput>;
|
|
146
|
+
/** A field type of a method's JSON answer. */
|
|
147
|
+
export type MethodField = Infer<typeof MethodField>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { s } from "../../../../schema-kit/src/index.js";
|
|
2
|
+
import { collectionId, id, ModelParams, version } from "../../shared/fields.js";
|
|
3
|
+
import { AgentHarness, AllowedSite, MAX_ALLOWED_SITES, WorkingFolder } from "./sandbox-fields.js";
|
|
4
|
+
/** The shape of an agent's reply: free text, one of a list of options, or JSON. */
|
|
5
|
+
export const AgentOutput = s.discriminatedUnion("type", [
|
|
6
|
+
s.object({ type: s.literal("text") }).strict(),
|
|
7
|
+
s
|
|
8
|
+
.object({
|
|
9
|
+
type: s.literal("choice"),
|
|
10
|
+
/**
|
|
11
|
+
* The reply must be exactly one of these values, case-sensitively, once
|
|
12
|
+
* the whitespace around it is trimmed. Any other reply fails the step
|
|
13
|
+
* with `answer-not-an-option`.
|
|
14
|
+
*/
|
|
15
|
+
options: s.array(s.string()).min(1),
|
|
16
|
+
})
|
|
17
|
+
.strict(),
|
|
18
|
+
s
|
|
19
|
+
.object({
|
|
20
|
+
type: s.literal("json"),
|
|
21
|
+
/** A JSON Schema the reply must satisfy. */
|
|
22
|
+
schema: s.record(s.string(), s.unknown()).optional(),
|
|
23
|
+
})
|
|
24
|
+
.strict(),
|
|
25
|
+
]);
|
|
26
|
+
/** A field of a method's answer; a trailing "?" makes it optional. */
|
|
27
|
+
export const MethodField = s.enum([
|
|
28
|
+
"string",
|
|
29
|
+
"number",
|
|
30
|
+
"boolean",
|
|
31
|
+
"list",
|
|
32
|
+
"object",
|
|
33
|
+
"string?",
|
|
34
|
+
"number?",
|
|
35
|
+
"boolean?",
|
|
36
|
+
"list?",
|
|
37
|
+
"object?",
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* A named task an agent can do, called by workflow steps
|
|
41
|
+
* (`agent: finance, method: extract-invoice, with: { … }`).
|
|
42
|
+
*/
|
|
43
|
+
export const AgentMethod = s
|
|
44
|
+
.object({
|
|
45
|
+
description: s.string().optional(),
|
|
46
|
+
/** Argument names; the instructions use them as {{name}}. */
|
|
47
|
+
input: s.array(s.string()).default([]),
|
|
48
|
+
instructions: s.string().min(1),
|
|
49
|
+
/** Only these tools; leave out for all of the agent's tools, [] for none. */
|
|
50
|
+
tools: s.array(s.string()).optional(),
|
|
51
|
+
/** Model alias for this method; the agent's model otherwise. */
|
|
52
|
+
model: s.string().optional(),
|
|
53
|
+
/** Most model calls for one call of this method; the agent's maxSteps otherwise. */
|
|
54
|
+
maxSteps: s.number().int().min(1).max(200).optional(),
|
|
55
|
+
/** "text", or the fields of a JSON answer: { vendor: string, note: string? }. */
|
|
56
|
+
output: s.union([s.literal("text"), s.record(s.string(), MethodField)]).default("text"),
|
|
57
|
+
})
|
|
58
|
+
.strict();
|
|
59
|
+
const colour = () => s.string().regex(/^#[0-9a-fA-F]{6}$/);
|
|
60
|
+
/** How the agent's character looks; colours default to a pair taken from the agent id. */
|
|
61
|
+
export const AgentCharacter = s
|
|
62
|
+
.object({
|
|
63
|
+
style: s.literal("buddy").default("buddy"),
|
|
64
|
+
/** Soft: matte with a little grain. Glossy: a highlight. */
|
|
65
|
+
surface: s.enum(["soft", "glossy"]).default("soft"),
|
|
66
|
+
/** Elastic: wobbles and springs back. Firm: keeps its shape. */
|
|
67
|
+
body: s.enum(["elastic", "firm"]).default("elastic"),
|
|
68
|
+
top: s.literal("none").default("none"),
|
|
69
|
+
/** Two colours, such as ["#3B82F6", "#8B5CF6"]. */
|
|
70
|
+
colors: s.tuple([colour(), colour()]).optional(),
|
|
71
|
+
})
|
|
72
|
+
.strict();
|
|
73
|
+
/** `agents/<id>.agent.yaml`: an agent's model, instructions, tools and methods. */
|
|
74
|
+
export const Agent = s
|
|
75
|
+
.object({
|
|
76
|
+
version,
|
|
77
|
+
id,
|
|
78
|
+
name: s.string().min(1),
|
|
79
|
+
description: s.string().optional(),
|
|
80
|
+
/** Model alias (preferred) or "provider/model". */
|
|
81
|
+
model: s.string().optional(),
|
|
82
|
+
params: ModelParams.default({}),
|
|
83
|
+
instructions: s.string().default(""),
|
|
84
|
+
skills: s.array(s.string()).default([]),
|
|
85
|
+
knowledge: s.array(s.string()).default([]),
|
|
86
|
+
/** Connector ids whose tools this agent may use. */
|
|
87
|
+
connectors: s.array(s.string()).default([]),
|
|
88
|
+
/** Read-only access to the run history of earlier runs. Never sees secrets. */
|
|
89
|
+
runLogs: s.boolean().default(false),
|
|
90
|
+
/** Collections this agent may read and write. */
|
|
91
|
+
collections: s.array(collectionId).default([]),
|
|
92
|
+
/** Agents of the same hub this agent may hand a task to. */
|
|
93
|
+
subagents: s.array(s.string()).default([]),
|
|
94
|
+
/** Named tasks workflow steps can call. */
|
|
95
|
+
methods: s.record(id, AgentMethod).default({}),
|
|
96
|
+
output: AgentOutput.default({ type: "text" }),
|
|
97
|
+
/** Most model calls per invocation (tool loops). */
|
|
98
|
+
maxSteps: s.number().int().min(1).max(200).default(6),
|
|
99
|
+
character: AgentCharacter.optional(),
|
|
100
|
+
/** The program the agent runs in; Halonic's own loop when left out. */
|
|
101
|
+
harness: AgentHarness.optional(),
|
|
102
|
+
/** The one workspace folder a harness agent writes to; `files/agents/<id>` when left out. */
|
|
103
|
+
workingFolder: WorkingFolder.optional(),
|
|
104
|
+
/** Sites a harness agent may reach besides Halonic: host names or `*.` and a domain. */
|
|
105
|
+
allowedSites: s.array(AllowedSite).max(MAX_ALLOWED_SITES).optional(),
|
|
106
|
+
})
|
|
107
|
+
.strict();
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A harness agent writes in its working folder from inside the sandbox. A
|
|
3
|
+
* local connector's program runs outside it, with the connector's secrets.
|
|
4
|
+
* The workspace check `workspace.working-folders` refuses a working folder
|
|
5
|
+
* that holds what a connector names, but it only sees paths as written. This
|
|
6
|
+
* is the same rule again on the real file system, right before a program
|
|
7
|
+
* starts (HAL-4739, HAL-4759): through symbolic links and Windows short
|
|
8
|
+
* names, for absolute paths into the workspace, for the program as found on
|
|
9
|
+
* `PATH`, for packages linked into `node_modules`, and for the files a
|
|
10
|
+
* program loads from next to its script without naming them.
|
|
11
|
+
*/
|
|
12
|
+
import { type ProgramStart } from "../../shared/program-start.js";
|
|
13
|
+
import type { PathLookup } from "../skill/scripts-folder.js";
|
|
14
|
+
/** What a connector starts, with the environment its program gets. */
|
|
15
|
+
export interface ConnectorStart extends ProgramStart {
|
|
16
|
+
readonly env: Readonly<Record<string, string>>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* How to look at the file system. Core has none, so an adapter passes Node's
|
|
20
|
+
* `resolve`, `realpath`, `readdir` and `stat`.
|
|
21
|
+
*/
|
|
22
|
+
export interface FolderLookup extends PathLookup {
|
|
23
|
+
/** The names in a folder, through links. Empty when it isn't a folder. Never rejects. */
|
|
24
|
+
list(folder: string): Promise<readonly string[]>;
|
|
25
|
+
/** Whether a file, not a folder, is there, through links. Never rejects. */
|
|
26
|
+
isFile(path: string): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
/** Where a start's program would load what an agent may write. */
|
|
29
|
+
export interface WorkingFolderReach {
|
|
30
|
+
/** The working folder, as given. */
|
|
31
|
+
readonly folder: string;
|
|
32
|
+
/** How the start reaches it, worded to follow "it", such as "runs 'tools/mail.js'". */
|
|
33
|
+
readonly how: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The message for a start that was refused because of `reach`.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* workingFolderRefusal({ folder: "/w/tools", how: "runs '/w/tools/mail.js'" });
|
|
40
|
+
* // "Halonic didn't start the program: it runs '/w/tools/mail.js', in the agent working folder '/w/tools'. …"
|
|
41
|
+
*/
|
|
42
|
+
export declare function workingFolderRefusal(reach: WorkingFolderReach): string;
|
|
43
|
+
/**
|
|
44
|
+
* Whether a start would run or load a file from a harness agent's working
|
|
45
|
+
* folder, checked on real paths. It looks at:
|
|
46
|
+
*
|
|
47
|
+
* 1. the start folder, the program and every path its arguments and `env`
|
|
48
|
+
* values name, as resolved from the start folder and through symbolic
|
|
49
|
+
* links (a path that doesn't exist yet is followed as far as it does);
|
|
50
|
+
* 2. the program as given, so the caller checks again with the absolute
|
|
51
|
+
* path it found on `PATH`;
|
|
52
|
+
* 3. every package in the `node_modules` folders from the start folder and
|
|
53
|
+
* from the folder of each script it runs up to the workspace root, where
|
|
54
|
+
* `npx` and `require()` look without being told: npm and pnpm workspaces
|
|
55
|
+
* link these to folders in the workspace. A package that is such a
|
|
56
|
+
* workspace folder has its own `node_modules` folders looked at too;
|
|
57
|
+
* 4. the folder of each script it runs and the folder it starts in, unless
|
|
58
|
+
* that is the workspace root: a program loads files from there without
|
|
59
|
+
* naming them. A script is the program, an argument or a piece of one
|
|
60
|
+
* that is a file, an argument that is a file once Node or Python add an
|
|
61
|
+
* ending (`node server`, `python -m mail`), or an argument that is a
|
|
62
|
+
* folder, which Node and Python run from inside (`node .`).
|
|
63
|
+
*
|
|
64
|
+
* Paths are compared without regard to case, with `\` as `/`, as Windows
|
|
65
|
+
* and macOS read them. Reading too much as a path only makes it stricter.
|
|
66
|
+
* Inline code (`node -e`) isn't read, and packages in pnpm's store aren't
|
|
67
|
+
* followed into their own `node_modules`: see the requirement's limits.
|
|
68
|
+
*
|
|
69
|
+
* @param start - the start, with absolute `cwd`
|
|
70
|
+
* @param workspaceRoot - the workspace's absolute path
|
|
71
|
+
* @param workingFolders - the absolute working folder of every harness agent in the workspace
|
|
72
|
+
* @returns the first reach found, or `null` when the start reaches none
|
|
73
|
+
*/
|
|
74
|
+
export declare function touchesWorkingFolder(start: ConnectorStart, workspaceRoot: string, workingFolders: readonly string[], lookup: FolderLookup): Promise<WorkingFolderReach | null>;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A harness agent writes in its working folder from inside the sandbox. A
|
|
3
|
+
* local connector's program runs outside it, with the connector's secrets.
|
|
4
|
+
* The workspace check `workspace.working-folders` refuses a working folder
|
|
5
|
+
* that holds what a connector names, but it only sees paths as written. This
|
|
6
|
+
* is the same rule again on the real file system, right before a program
|
|
7
|
+
* starts (HAL-4739, HAL-4759): through symbolic links and Windows short
|
|
8
|
+
* names, for absolute paths into the workspace, for the program as found on
|
|
9
|
+
* `PATH`, for packages linked into `node_modules`, and for the files a
|
|
10
|
+
* program loads from next to its script without naming them.
|
|
11
|
+
*/
|
|
12
|
+
import { moduleIn, pathsIn, pathsNamedBy } from "../../shared/program-start.js";
|
|
13
|
+
import { foldName } from "../../shared/relative-path.js";
|
|
14
|
+
/**
|
|
15
|
+
* The message for a start that was refused because of `reach`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* workingFolderRefusal({ folder: "/w/tools", how: "runs '/w/tools/mail.js'" });
|
|
19
|
+
* // "Halonic didn't start the program: it runs '/w/tools/mail.js', in the agent working folder '/w/tools'. …"
|
|
20
|
+
*/
|
|
21
|
+
export function workingFolderRefusal(reach) {
|
|
22
|
+
return (`Halonic didn't start the program: it ${reach.how}, in the agent working folder ` +
|
|
23
|
+
`'${reach.folder}'. An agent could change it, and it would run outside the sandbox`);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Whether a start would run or load a file from a harness agent's working
|
|
27
|
+
* folder, checked on real paths. It looks at:
|
|
28
|
+
*
|
|
29
|
+
* 1. the start folder, the program and every path its arguments and `env`
|
|
30
|
+
* values name, as resolved from the start folder and through symbolic
|
|
31
|
+
* links (a path that doesn't exist yet is followed as far as it does);
|
|
32
|
+
* 2. the program as given, so the caller checks again with the absolute
|
|
33
|
+
* path it found on `PATH`;
|
|
34
|
+
* 3. every package in the `node_modules` folders from the start folder and
|
|
35
|
+
* from the folder of each script it runs up to the workspace root, where
|
|
36
|
+
* `npx` and `require()` look without being told: npm and pnpm workspaces
|
|
37
|
+
* link these to folders in the workspace. A package that is such a
|
|
38
|
+
* workspace folder has its own `node_modules` folders looked at too;
|
|
39
|
+
* 4. the folder of each script it runs and the folder it starts in, unless
|
|
40
|
+
* that is the workspace root: a program loads files from there without
|
|
41
|
+
* naming them. A script is the program, an argument or a piece of one
|
|
42
|
+
* that is a file, an argument that is a file once Node or Python add an
|
|
43
|
+
* ending (`node server`, `python -m mail`), or an argument that is a
|
|
44
|
+
* folder, which Node and Python run from inside (`node .`).
|
|
45
|
+
*
|
|
46
|
+
* Paths are compared without regard to case, with `\` as `/`, as Windows
|
|
47
|
+
* and macOS read them. Reading too much as a path only makes it stricter.
|
|
48
|
+
* Inline code (`node -e`) isn't read, and packages in pnpm's store aren't
|
|
49
|
+
* followed into their own `node_modules`: see the requirement's limits.
|
|
50
|
+
*
|
|
51
|
+
* @param start - the start, with absolute `cwd`
|
|
52
|
+
* @param workspaceRoot - the workspace's absolute path
|
|
53
|
+
* @param workingFolders - the absolute working folder of every harness agent in the workspace
|
|
54
|
+
* @returns the first reach found, or `null` when the start reaches none
|
|
55
|
+
*/
|
|
56
|
+
export async function touchesWorkingFolder(start, workspaceRoot, workingFolders, lookup) {
|
|
57
|
+
if (workingFolders.length === 0)
|
|
58
|
+
return null;
|
|
59
|
+
const folders = await Promise.all(workingFolders.map(async (folder) => ({
|
|
60
|
+
folder,
|
|
61
|
+
forms: await formsOf(folder, folder, lookup),
|
|
62
|
+
})));
|
|
63
|
+
const root = await realPath(workspaceRoot, lookup);
|
|
64
|
+
const scripts = await scriptsRun(start, lookup);
|
|
65
|
+
const finds = [
|
|
66
|
+
() => namedPart(start, folders, lookup),
|
|
67
|
+
() => linkedPackage(start, scripts, root, folders, lookup),
|
|
68
|
+
() => scriptFolder(start, scripts, root, folders, lookup),
|
|
69
|
+
];
|
|
70
|
+
for (const find of finds) {
|
|
71
|
+
const reach = await find();
|
|
72
|
+
if (reach !== null)
|
|
73
|
+
return reach;
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
/** The endings Node and Python add to a script or module name that names no file. */
|
|
78
|
+
const SCRIPT_ENDINGS = [".js", ".mjs", ".cjs", ".ts", ".json", ".node", ".py"];
|
|
79
|
+
/** Rule 1 and 2: a path the start names, read from its folder, inside a working folder. */
|
|
80
|
+
async function namedPart(start, folders, lookup) {
|
|
81
|
+
// A path written as the program is checked once, as what the start runs.
|
|
82
|
+
const used = pathsNamedBy(start).filter(({ path }) => path !== start.program);
|
|
83
|
+
const named = [
|
|
84
|
+
{ shown: start.cwd, how: "starts in" },
|
|
85
|
+
{ shown: start.program, how: "runs" },
|
|
86
|
+
...used.map(({ path }) => ({ shown: path, how: "uses" })),
|
|
87
|
+
];
|
|
88
|
+
for (const { shown, how } of named) {
|
|
89
|
+
const folder = holding(await formsOf(start.cwd, shown, lookup), folders);
|
|
90
|
+
if (folder !== undefined)
|
|
91
|
+
return { folder, how: `${how} '${shown}'` };
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Rule 3: a `node_modules` folder, or a package, `.bin` entry or scoped
|
|
97
|
+
* package in one, that really lives in a working folder. `require()` looks
|
|
98
|
+
* from the folder of the file that asks, so the folders listed are those from
|
|
99
|
+
* the start folder, from each script's folder and from each workspace package
|
|
100
|
+
* found on the way, up to the workspace root. Anything above the workspace is
|
|
101
|
+
* out of an agent's reach, and a start outside it (such as a pinned package's
|
|
102
|
+
* new empty folder) has none to list.
|
|
103
|
+
*/
|
|
104
|
+
async function linkedPackage(start, scripts, root, folders, lookup) {
|
|
105
|
+
const listed = new Set();
|
|
106
|
+
const from = [await realPath(start.cwd, lookup), ...scripts.map((script) => script.folder)];
|
|
107
|
+
for (let next = from.shift(); next !== undefined; next = from.shift()) {
|
|
108
|
+
for (const folder of foldersUpTo(next, root, lookup)) {
|
|
109
|
+
const modules = lookup.resolve(folder, "node_modules");
|
|
110
|
+
if (listed.has(comparable(modules)))
|
|
111
|
+
continue;
|
|
112
|
+
listed.add(comparable(modules));
|
|
113
|
+
const found = await modulesFolder(modules, root, folders, lookup);
|
|
114
|
+
if (found.reach !== null)
|
|
115
|
+
return found.reach;
|
|
116
|
+
from.push(...found.workspacePackages);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* One `node_modules` folder for rule 3: the first entry that really lives
|
|
123
|
+
* in a working folder, and the real folders of the workspace packages in it.
|
|
124
|
+
*/
|
|
125
|
+
async function modulesFolder(modules, root, folders, lookup) {
|
|
126
|
+
const entries = [modules, ...(await packagesIn(modules, lookup))];
|
|
127
|
+
const reals = await Promise.all(entries.map((entry) => realPath(entry, lookup)));
|
|
128
|
+
for (const [index, real] of reals.entries()) {
|
|
129
|
+
const holder = holding([real], folders);
|
|
130
|
+
if (holder !== undefined) {
|
|
131
|
+
return { reach: { folder: holder, how: `loads '${entries[index]}'` }, workspacePackages: [] };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { reach: null, workspacePackages: reals.filter((real) => isWorkspacePackage(real, root)) };
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Whether a real path is in the workspace's own folders and not in a
|
|
138
|
+
* `node_modules` folder, as a workspace package linked into one is.
|
|
139
|
+
* `require()` in that package reads its own `node_modules` folders.
|
|
140
|
+
*/
|
|
141
|
+
function isWorkspacePackage(path, root) {
|
|
142
|
+
if (!isInside(path, root))
|
|
143
|
+
return false;
|
|
144
|
+
return !comparable(path).slice(comparable(root).length).split("/").includes("node_modules");
|
|
145
|
+
}
|
|
146
|
+
/** The entries of a `node_modules` folder, with those inside `.bin` and `@scope` folders. */
|
|
147
|
+
async function packagesIn(modules, lookup) {
|
|
148
|
+
const entries = [];
|
|
149
|
+
for (const name of await lookup.list(modules)) {
|
|
150
|
+
const entry = lookup.resolve(modules, name);
|
|
151
|
+
entries.push(entry);
|
|
152
|
+
if (name === ".bin" || name.startsWith("@")) {
|
|
153
|
+
const inner = await lookup.list(entry);
|
|
154
|
+
entries.push(...inner.map((innerName) => lookup.resolve(entry, innerName)));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return entries;
|
|
158
|
+
}
|
|
159
|
+
/** A real `folder` and each folder above it up to the real workspace root, or none when it's outside. */
|
|
160
|
+
function foldersUpTo(folder, root, lookup) {
|
|
161
|
+
if (!isInside(folder, root))
|
|
162
|
+
return [];
|
|
163
|
+
const chain = [folder];
|
|
164
|
+
let current = folder;
|
|
165
|
+
while (!isSame(current, root)) {
|
|
166
|
+
const parent = lookup.resolve(current, "..");
|
|
167
|
+
if (parent === current)
|
|
168
|
+
break;
|
|
169
|
+
current = parent;
|
|
170
|
+
chain.push(current);
|
|
171
|
+
}
|
|
172
|
+
return chain;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The scripts a start runs (see rule 4): the program and each piece of an
|
|
176
|
+
* argument when it is a file, and each argument and `-m` module also when
|
|
177
|
+
* it is a file once an ending is added, or a folder. Empty inline code
|
|
178
|
+
* (`node -e ""`) is no script. Any other empty argument is read as the start
|
|
179
|
+
* folder, as Python does: `python ""` runs `__main__.py` from there.
|
|
180
|
+
*/
|
|
181
|
+
async function scriptsRun(start, lookup) {
|
|
182
|
+
const exact = [
|
|
183
|
+
start.program,
|
|
184
|
+
...start.args.flatMap((arg) => pathsIn(arg).filter((piece) => piece !== arg)),
|
|
185
|
+
];
|
|
186
|
+
const named = start.args.flatMap((arg, index) => isEmptyInlineCode(start.args, index) ? [] : [{ arg, index }]);
|
|
187
|
+
const filled = named.flatMap(({ arg, index }) => [
|
|
188
|
+
{ shown: arg, path: arg },
|
|
189
|
+
...moduleIn(start.args, index).map((path) => ({ shown: arg, path })),
|
|
190
|
+
]);
|
|
191
|
+
const scripts = [];
|
|
192
|
+
for (const shown of exact) {
|
|
193
|
+
const folder = await fileFolder([lookup.resolve(start.cwd, shown)], lookup);
|
|
194
|
+
if (folder !== null)
|
|
195
|
+
scripts.push({ shown, folder });
|
|
196
|
+
}
|
|
197
|
+
for (const { shown, path } of filled) {
|
|
198
|
+
const folder = await loadFolder(lookup.resolve(start.cwd, path), lookup);
|
|
199
|
+
if (folder !== null)
|
|
200
|
+
scripts.push({ shown, folder });
|
|
201
|
+
}
|
|
202
|
+
return scripts;
|
|
203
|
+
}
|
|
204
|
+
/** The flags that take inline code as their next argument: Node's `-e` and `-p`, and `-c` for Python and shells. */
|
|
205
|
+
const INLINE_CODE_FLAGS = new Set(["-e", "--eval", "-p", "--print", "-c"]);
|
|
206
|
+
/**
|
|
207
|
+
* Python flags that take the next argument as their value. In `python -W -c ""`
|
|
208
|
+
* the `-c` is the value of `-W`, so the `""` is the script, not inline code.
|
|
209
|
+
*/
|
|
210
|
+
const VALUE_FLAGS = new Set(["-W", "-X"]);
|
|
211
|
+
/** Whether the argument at `index` is empty inline code, such as the `""` in `node -e ""`. */
|
|
212
|
+
function isEmptyInlineCode(args, index) {
|
|
213
|
+
return (args[index] === "" &&
|
|
214
|
+
INLINE_CODE_FLAGS.has(args[index - 1] ?? "") &&
|
|
215
|
+
!VALUE_FLAGS.has(args[index - 2] ?? ""));
|
|
216
|
+
}
|
|
217
|
+
/** The real folder of the first of `paths` that is a file, or `null`. */
|
|
218
|
+
async function fileFolder(paths, lookup) {
|
|
219
|
+
for (const path of paths) {
|
|
220
|
+
if (await lookup.isFile(path))
|
|
221
|
+
return lookup.resolve(await realPath(path, lookup), "..");
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The real folder a script named by `path` loads files from: the folder of
|
|
227
|
+
* the file it names, with or without an ending Node or Python adds, or the
|
|
228
|
+
* folder itself when it names one. `null` when nothing is there.
|
|
229
|
+
*/
|
|
230
|
+
async function loadFolder(path, lookup) {
|
|
231
|
+
const file = await fileFolder([path, ...SCRIPT_ENDINGS.map((ending) => path + ending)], lookup);
|
|
232
|
+
if (file !== null)
|
|
233
|
+
return file;
|
|
234
|
+
try {
|
|
235
|
+
return await lookup.realpath(path);
|
|
236
|
+
}
|
|
237
|
+
catch {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Rule 4: a working folder inside the folder of a script the start runs, or
|
|
243
|
+
* inside the folder it starts in. The workspace root counts as a script's
|
|
244
|
+
* folder, but not as a start folder: every working folder is inside the
|
|
245
|
+
* root, and the static check already refuses a `node_modules` working folder.
|
|
246
|
+
*/
|
|
247
|
+
async function scriptFolder(start, scripts, root, folders, lookup) {
|
|
248
|
+
for (const script of scripts) {
|
|
249
|
+
const inside = folders.find((folder) => folder.forms.some((form) => isInside(form, script.folder)));
|
|
250
|
+
if (inside !== undefined) {
|
|
251
|
+
return {
|
|
252
|
+
folder: inside.folder,
|
|
253
|
+
how: `runs '${script.shown}', which loads files from next to it`,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const cwd = await realPath(start.cwd, lookup);
|
|
258
|
+
if (isSame(cwd, root))
|
|
259
|
+
return null;
|
|
260
|
+
const inside = folders.find((folder) => folder.forms.some((form) => isInside(form, cwd)));
|
|
261
|
+
return inside === undefined
|
|
262
|
+
? null
|
|
263
|
+
: { folder: inside.folder, how: `starts in '${start.cwd}' and reads files from there` };
|
|
264
|
+
}
|
|
265
|
+
/** The first working folder that holds one of `forms`. */
|
|
266
|
+
function holding(forms, folders) {
|
|
267
|
+
return folders.find((folder) => folder.forms.some((folderForm) => forms.some((form) => isInside(form, folderForm))))?.folder;
|
|
268
|
+
}
|
|
269
|
+
/** A path resolved from `cwd`, and where it really is. */
|
|
270
|
+
async function formsOf(cwd, path, lookup) {
|
|
271
|
+
const resolved = lookup.resolve(cwd, path);
|
|
272
|
+
return [resolved, await realPath(resolved, lookup)];
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Where an absolute path really is, through links and Windows short names.
|
|
276
|
+
* When it doesn't exist (yet), the nearest folder above it that does is
|
|
277
|
+
* followed, and the rest is added back, so `out/new.json` in a linked
|
|
278
|
+
* `out` folder is still found.
|
|
279
|
+
*/
|
|
280
|
+
async function realPath(path, lookup) {
|
|
281
|
+
try {
|
|
282
|
+
return await lookup.realpath(path);
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
const parent = lookup.resolve(path, "..");
|
|
286
|
+
if (parent === path)
|
|
287
|
+
return path;
|
|
288
|
+
const rest = path.slice(parent.length).replace(/^[\\/]+/, "");
|
|
289
|
+
return lookup.resolve(await realPath(parent, lookup), rest);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/** Whether `path` is `folder` or inside it, as a file system that ignores case reads them. */
|
|
293
|
+
function isInside(path, folder) {
|
|
294
|
+
const comparablePath = comparable(path);
|
|
295
|
+
const comparableFolder = comparable(folder);
|
|
296
|
+
return comparablePath === comparableFolder || comparablePath.startsWith(`${comparableFolder}/`);
|
|
297
|
+
}
|
|
298
|
+
function isSame(path, other) {
|
|
299
|
+
return comparable(path) === comparable(other);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* An absolute path as Windows and macOS compare it: folded case, `/` between
|
|
303
|
+
* parts, no trailing dots and spaces on a part, and no `/` at the end.
|
|
304
|
+
*/
|
|
305
|
+
function comparable(path) {
|
|
306
|
+
return foldName(path)
|
|
307
|
+
.replaceAll("\\", "/")
|
|
308
|
+
.split("/")
|
|
309
|
+
.map((part) => (part === "." || part === ".." ? part : part.replace(/[. ]+$/, "")))
|
|
310
|
+
.join("/")
|
|
311
|
+
.replace(/\/+$/, "");
|
|
312
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileKind } from "../../kind.js";
|
|
2
|
+
import { Collection } from "./schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* `library/collections/<id>.collection.yaml` at the workspace root. Checking
|
|
5
|
+
* and folding records is runtime work for the records service, not part of
|
|
6
|
+
* the file format.
|
|
7
|
+
*/
|
|
8
|
+
export declare const collectionKind: FileKind<Collection>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Collection } from "./schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* `library/collections/<id>.collection.yaml` at the workspace root. Checking
|
|
4
|
+
* and folding records is runtime work for the records service, not part of
|
|
5
|
+
* the file format.
|
|
6
|
+
*/
|
|
7
|
+
export const collectionKind = {
|
|
8
|
+
name: "collection",
|
|
9
|
+
about: "A typed list of records agents read and write, with views and seed records.",
|
|
10
|
+
syntax: "yaml",
|
|
11
|
+
schema: Collection,
|
|
12
|
+
places: [{ scope: "workspace", folder: "library/collections", name: "<id>.collection.yaml" }],
|
|
13
|
+
idFromPlace: "fallback",
|
|
14
|
+
};
|