@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,72 @@
|
|
|
1
|
+
import { describeObject, isPlainObject, keyPath } from "../../std/src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Removes the values a saved file doesn't need, so files stay small: in every
|
|
4
|
+
* object, a key whose value is `undefined`, an empty array or an empty object
|
|
5
|
+
* is left out. Each value is compacted before it is checked, so
|
|
6
|
+
* `{ a: { b: [] } }` loses `a` too.
|
|
7
|
+
*
|
|
8
|
+
* It behaves like the old app's `compact` (requirement `format.compact`):
|
|
9
|
+
* - `null`, `""`, `0` and `false` are kept.
|
|
10
|
+
* - Array items are compacted but never removed, not even `undefined` or `{}`,
|
|
11
|
+
* because removing one would shift the position of every item after it.
|
|
12
|
+
* - The value passed in is never removed: `compact({})` is `{}`.
|
|
13
|
+
* - A key named `__proto__` (`JSON.parse` can make one) is kept as an ordinary
|
|
14
|
+
* key; it never changes the result's prototype.
|
|
15
|
+
*
|
|
16
|
+
* Unlike the old app, it refuses any object that is neither a plain object nor
|
|
17
|
+
* an array, such as a `Date`, a `Map` or a class instance. The old app turned
|
|
18
|
+
* those into `{}` and left them out, quietly losing them; a parsed file never
|
|
19
|
+
* contains one, so meeting one means the caller passed the wrong value.
|
|
20
|
+
*
|
|
21
|
+
* The input is not changed; the result is a new value that shares no objects
|
|
22
|
+
* or arrays with it.
|
|
23
|
+
*
|
|
24
|
+
* @param value - the value about to be written, usually a parsed file
|
|
25
|
+
* @returns the value without empty keys
|
|
26
|
+
* @throws TypeError for an object that isn't a plain object or an array, naming where it is
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* compact({ name: "triage", tags: [], layout: {} }); // { name: "triage" }
|
|
30
|
+
*/
|
|
31
|
+
export function compact(value) {
|
|
32
|
+
return compactValue(value, "value");
|
|
33
|
+
}
|
|
34
|
+
function compactValue(value, path) {
|
|
35
|
+
if (Array.isArray(value)) {
|
|
36
|
+
return value.map((item, index) => compactValue(item, `${path}[${index}]`));
|
|
37
|
+
}
|
|
38
|
+
if (isPlainObject(value)) {
|
|
39
|
+
return compactObject(value, path);
|
|
40
|
+
}
|
|
41
|
+
if (typeof value === "object" && value !== null) {
|
|
42
|
+
throw new TypeError(`compact writes plain data only, but ${path} is ${describeObject(value)}.`);
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
function compactObject(value, path) {
|
|
47
|
+
const result = {};
|
|
48
|
+
for (const [key, child] of Object.entries(value)) {
|
|
49
|
+
const compacted = compactValue(child, keyPath(path, key));
|
|
50
|
+
if (isEmpty(compacted)) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
// defineProperty, not assignment: a "__proto__" key from JSON.parse
|
|
54
|
+
// stays a plain key instead of changing the result's prototype.
|
|
55
|
+
Object.defineProperty(result, key, {
|
|
56
|
+
value: compacted,
|
|
57
|
+
enumerable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
function isEmpty(value) {
|
|
65
|
+
if (value === undefined) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
if (Array.isArray(value)) {
|
|
69
|
+
return value.length === 0;
|
|
70
|
+
}
|
|
71
|
+
return isPlainObject(value) && Object.keys(value).length === 0;
|
|
72
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { compact } from "./compact.js";
|
|
2
|
+
export { jsonSchemaOf } from "./json-schema.js";
|
|
3
|
+
export type { FileKind, FilePlace, KindCheckProblem, KindSyntax } from "./kind.js";
|
|
4
|
+
export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, } from "./kinds/agent/sandbox-fields.js";
|
|
5
|
+
export type { Agent, AgentMethod, AgentOutput, MethodField } from "./kinds/agent/schema.js";
|
|
6
|
+
export { type ConnectorStart, type FolderLookup, touchesWorkingFolder, type WorkingFolderReach, workingFolderRefusal, } from "./kinds/agent/working-folder-start.js";
|
|
7
|
+
export type { Collection, CollectionField, CollectionView } from "./kinds/collection/schema.js";
|
|
8
|
+
export { FIELD_TYPES } from "./kinds/collection/schema.js";
|
|
9
|
+
export { connectorIsLocal } from "./kinds/connector/is-local.js";
|
|
10
|
+
export { approveAll, type Connector, needsApproval } from "./kinds/connector/schema.js";
|
|
11
|
+
export type { Deployment, Deployments } from "./kinds/deployments/schema.js";
|
|
12
|
+
export type { Hub, HubUses } from "./kinds/hub/schema.js";
|
|
13
|
+
export { checkIntegrationSheet } from "./kinds/integration/kind.js";
|
|
14
|
+
export { parseIntegrationSheet, type SheetProblem } from "./kinds/integration/parse-sheet.js";
|
|
15
|
+
export { type DeclaredPlacement, type DeclaredSecret, type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "./kinds/integration/policy.js";
|
|
16
|
+
export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationHost, type IntegrationSecret, type IntegrationSecretHost, IntegrationSheet, type IntegrationTool, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "./kinds/integration/schema.js";
|
|
17
|
+
export type { KnowledgeSource } from "./kinds/knowledge/schema.js";
|
|
18
|
+
export type { ModelAlias, Models } from "./kinds/models/schema.js";
|
|
19
|
+
export { backendSheet, pluginFromIntegrationSheet } from "./kinds/plugin/backend.js";
|
|
20
|
+
export { checkPlugin } from "./kinds/plugin/checks.js";
|
|
21
|
+
export { ARGUMENT_NAME_PATTERN, DEFAULT_BACKEND_ENTRY, ENV_NAME_PATTERN, MAX_PLUGIN_ID_LENGTH, MAX_PLUGIN_SECRET_NAME_LENGTH, NPM_EXACT_VERSION_PATTERN, networkSiteProblem, Plugin, type PluginBackend, type PluginLocalTool, type PluginUi, PYPI_EXACT_VERSION_PATTERN, pluginPathProblem, } from "./kinds/plugin/schema.js";
|
|
22
|
+
export { type PluginSettingField, type PluginSettingValue, settingValueProblem, } from "./kinds/plugin/setting-values.js";
|
|
23
|
+
export type { Provider } from "./kinds/provider/schema.js";
|
|
24
|
+
export type { Routine, RoutineTarget, RoutineTrigger } from "./kinds/routine/schema.js";
|
|
25
|
+
export type { Runtime } from "./kinds/runtime/schema.js";
|
|
26
|
+
export type { Skill } from "./kinds/skill/schema.js";
|
|
27
|
+
export { type PathLookup, skillScriptsRefusal, touchesSkillScripts, } from "./kinds/skill/scripts-folder.js";
|
|
28
|
+
export type { Branch, StateType, Transition, Workflow, WorkflowState, } from "./kinds/workflow/schema.js";
|
|
29
|
+
export type { WorkflowTest, WorkflowTestCase } from "./kinds/workflow-test/schema.js";
|
|
30
|
+
export type { SessionAssistant, WorkspaceSettings } from "./kinds/workspace/schema.js";
|
|
31
|
+
export { type FileProblem, type ParsedFile, type ParseFileOptions, parseFile, } from "./parse-file.js";
|
|
32
|
+
export { fileKinds, isKindName, type KindName, type KindValues, kindNames } from "./registry.js";
|
|
33
|
+
export { isReservedPath, RESERVED_FOLDER } from "./reserved.js";
|
|
34
|
+
export { SCHEMA_VERSION } from "./shared/fields.js";
|
|
35
|
+
export type { Guard } from "./shared/guard.js";
|
|
36
|
+
export { type NamedPath, type ProgramStart, pathsNamedBy } from "./shared/program-start.js";
|
|
37
|
+
export { foldName } from "./shared/relative-path.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// The public API of @halonicjs/format. Internal code imports by relative path.
|
|
2
|
+
export { compact } from "./compact.js";
|
|
3
|
+
export { jsonSchemaOf } from "./json-schema.js";
|
|
4
|
+
export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, } from "./kinds/agent/sandbox-fields.js";
|
|
5
|
+
export { touchesWorkingFolder, workingFolderRefusal, } from "./kinds/agent/working-folder-start.js";
|
|
6
|
+
export { FIELD_TYPES } from "./kinds/collection/schema.js";
|
|
7
|
+
export { connectorIsLocal } from "./kinds/connector/is-local.js";
|
|
8
|
+
export { approveAll, needsApproval } from "./kinds/connector/schema.js";
|
|
9
|
+
export { checkIntegrationSheet } from "./kinds/integration/kind.js";
|
|
10
|
+
export { parseIntegrationSheet } from "./kinds/integration/parse-sheet.js";
|
|
11
|
+
export { integrationPolicy, } from "./kinds/integration/policy.js";
|
|
12
|
+
export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "./kinds/integration/schema.js";
|
|
13
|
+
export { backendSheet, pluginFromIntegrationSheet } from "./kinds/plugin/backend.js";
|
|
14
|
+
export { checkPlugin } from "./kinds/plugin/checks.js";
|
|
15
|
+
export { ARGUMENT_NAME_PATTERN, DEFAULT_BACKEND_ENTRY, ENV_NAME_PATTERN, MAX_PLUGIN_ID_LENGTH, MAX_PLUGIN_SECRET_NAME_LENGTH, NPM_EXACT_VERSION_PATTERN, networkSiteProblem, Plugin, PYPI_EXACT_VERSION_PATTERN, pluginPathProblem, } from "./kinds/plugin/schema.js";
|
|
16
|
+
export { settingValueProblem, } from "./kinds/plugin/setting-values.js";
|
|
17
|
+
export { skillScriptsRefusal, touchesSkillScripts, } from "./kinds/skill/scripts-folder.js";
|
|
18
|
+
export { parseFile, } from "./parse-file.js";
|
|
19
|
+
export { fileKinds, isKindName, kindNames } from "./registry.js";
|
|
20
|
+
export { isReservedPath, RESERVED_FOLDER } from "./reserved.js";
|
|
21
|
+
export { SCHEMA_VERSION } from "./shared/fields.js";
|
|
22
|
+
export { pathsNamedBy } from "./shared/program-start.js";
|
|
23
|
+
export { foldName } from "./shared/relative-path.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { checkIntegrationSheet } from "../kinds/integration/kind.js";
|
|
2
|
+
export { parseIntegrationSheet, type SheetProblem } from "../kinds/integration/parse-sheet.js";
|
|
3
|
+
export { type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "../kinds/integration/policy.js";
|
|
4
|
+
export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationHost, type IntegrationSecret, type IntegrationSecretHost, IntegrationSheet, type IntegrationTool, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "../kinds/integration/schema.js";
|
|
5
|
+
export { backendSheet, pluginFromIntegrationSheet } from "../kinds/plugin/backend.js";
|
|
6
|
+
export { Plugin } from "../kinds/plugin/schema.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The public API of @halonicjs/format/integration: the permission sheet for
|
|
2
|
+
// the integration kit and the conformance suite. It must not import `yaml`,
|
|
3
|
+
// even indirectly; integration-entry.test.ts checks that.
|
|
4
|
+
export { checkIntegrationSheet } from "../kinds/integration/kind.js";
|
|
5
|
+
export { parseIntegrationSheet } from "../kinds/integration/parse-sheet.js";
|
|
6
|
+
export { integrationPolicy, } from "../kinds/integration/policy.js";
|
|
7
|
+
export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "../kinds/integration/schema.js";
|
|
8
|
+
export { backendSheet, pluginFromIntegrationSheet } from "../kinds/plugin/backend.js";
|
|
9
|
+
export { Plugin } from "../kinds/plugin/schema.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type JsonSchema } from "../../schema-kit/src/index.js";
|
|
2
|
+
import { type KindName } from "./registry.js";
|
|
3
|
+
/** Where the `$id` of every file kind's JSON Schema starts. Nothing is hosted there yet. */
|
|
4
|
+
export declare const SPEC_ID_BASE = "https://halonic.com/spec/format";
|
|
5
|
+
/**
|
|
6
|
+
* A kind's name in its spec file and `$id`: the kind name in kebab case,
|
|
7
|
+
* so `workflowTest` becomes `workflow-test`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function specName(kind: KindName): string;
|
|
10
|
+
/**
|
|
11
|
+
* The `$id` of a kind's JSON Schema. It names the schema and the file format
|
|
12
|
+
* version it describes, for example
|
|
13
|
+
* `https://halonic.com/spec/format/workflow/v1.schema.json`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function specId(kind: KindName): string;
|
|
16
|
+
/**
|
|
17
|
+
* The JSON Schema (2020-12) of a file kind, for editors, docs and other
|
|
18
|
+
* engines. It describes what a file may contain: keys with a default are
|
|
19
|
+
* not required. Checks over several fields can't be expressed and are left out.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const schema = jsonSchemaOf("agent");
|
|
23
|
+
* schema["required"]; // ["id", "name"]
|
|
24
|
+
* schema["$id"]; // "https://halonic.com/spec/format/agent/v1.schema.json"
|
|
25
|
+
*/
|
|
26
|
+
export declare function jsonSchemaOf(kind: KindName): JsonSchema;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { JSON_SCHEMA_DRAFT, toJsonSchema } from "../../schema-kit/src/index.js";
|
|
2
|
+
import { fileKinds } from "./registry.js";
|
|
3
|
+
import { SCHEMA_VERSION } from "./shared/fields.js";
|
|
4
|
+
/** Where the `$id` of every file kind's JSON Schema starts. Nothing is hosted there yet. */
|
|
5
|
+
export const SPEC_ID_BASE = "https://halonic.com/spec/format";
|
|
6
|
+
/**
|
|
7
|
+
* A kind's name in its spec file and `$id`: the kind name in kebab case,
|
|
8
|
+
* so `workflowTest` becomes `workflow-test`.
|
|
9
|
+
*/
|
|
10
|
+
export function specName(kind) {
|
|
11
|
+
return kind.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The `$id` of a kind's JSON Schema. It names the schema and the file format
|
|
15
|
+
* version it describes, for example
|
|
16
|
+
* `https://halonic.com/spec/format/workflow/v1.schema.json`.
|
|
17
|
+
*/
|
|
18
|
+
export function specId(kind) {
|
|
19
|
+
return idOf(kind, toJsonSchema(fileKinds[kind].schema));
|
|
20
|
+
}
|
|
21
|
+
function idOf(kind, schema) {
|
|
22
|
+
return `${SPEC_ID_BASE}/${specName(kind)}/v${kindVersion(schema)}.schema.json`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The file format version a kind's schema describes: the `const` of its
|
|
26
|
+
* `version` key. A kind without a `version` key (`skill`, whose file is
|
|
27
|
+
* SKILL.md front matter) falls back to the format's SCHEMA_VERSION.
|
|
28
|
+
*/
|
|
29
|
+
function kindVersion(schema) {
|
|
30
|
+
const properties = schema["properties"];
|
|
31
|
+
return properties?.["version"]?.const ?? SCHEMA_VERSION;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The JSON Schema (2020-12) of a file kind, for editors, docs and other
|
|
35
|
+
* engines. It describes what a file may contain: keys with a default are
|
|
36
|
+
* not required. Checks over several fields can't be expressed and are left out.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const schema = jsonSchemaOf("agent");
|
|
40
|
+
* schema["required"]; // ["id", "name"]
|
|
41
|
+
* schema["$id"]; // "https://halonic.com/spec/format/agent/v1.schema.json"
|
|
42
|
+
*/
|
|
43
|
+
export function jsonSchemaOf(kind) {
|
|
44
|
+
// `$schema` and `$id` come first, where readers of the spec file look for
|
|
45
|
+
// them; the spread keeps a key where it was first set.
|
|
46
|
+
const schema = toJsonSchema(fileKinds[kind].schema);
|
|
47
|
+
return { $schema: JSON_SCHEMA_DRAFT, $id: idOf(kind, schema), ...schema };
|
|
48
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Path, Schema } from "../../schema-kit/src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Where files of a kind sit in a workspace, in the one layout the new loader
|
|
4
|
+
* reads (plan 4.2): `agents/` and `workflows/` (with `workflows/routines/`)
|
|
5
|
+
* and `library/`, at the workspace root and inside each `hubs/<hub>/`.
|
|
6
|
+
*/
|
|
7
|
+
export interface FilePlace {
|
|
8
|
+
/**
|
|
9
|
+
* `workspace`: at the workspace root only. `hub`: inside each
|
|
10
|
+
* `hubs/<hub>/` folder only. `workspace-and-hub`: both; at the root the
|
|
11
|
+
* item is shared with every hub (for agents and workflows the root acts as
|
|
12
|
+
* a hub of its own).
|
|
13
|
+
*/
|
|
14
|
+
readonly scope: "workspace" | "hub" | "workspace-and-hub";
|
|
15
|
+
/** The folder inside that place, such as `library/connectors`; `""` for the place itself. */
|
|
16
|
+
readonly folder: string;
|
|
17
|
+
/**
|
|
18
|
+
* The file name. `<id>` stands for the item's id: `<id>.agent.yaml` is an
|
|
19
|
+
* agent whose id is the file name without `.agent.yaml`, and
|
|
20
|
+
* `<id>/SKILL.md` is a skill whose id is its folder.
|
|
21
|
+
*/
|
|
22
|
+
readonly name: string;
|
|
23
|
+
}
|
|
24
|
+
/** How a kind's text is read: plain YAML, or Markdown with YAML front matter (`SKILL.md`). */
|
|
25
|
+
export type KindSyntax = "yaml" | "front-matter";
|
|
26
|
+
/** A problem a kind's own checks find in a value that passed its schema. */
|
|
27
|
+
export interface KindCheckProblem {
|
|
28
|
+
/** An error makes the file fail; a warning only informs. */
|
|
29
|
+
readonly severity: "error" | "warning";
|
|
30
|
+
/** A stable name for the rule, such as `default-deployment-not-listed`. */
|
|
31
|
+
readonly code: string;
|
|
32
|
+
/** Where the problem sits in the file. */
|
|
33
|
+
readonly path: Path;
|
|
34
|
+
readonly message: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One kind of workspace file: how it's read, its schema with every default,
|
|
38
|
+
* the checks that need more than one field, and where its files sit.
|
|
39
|
+
* The registry lists every kind, so the loader and the tooling need no
|
|
40
|
+
* switch over kind names.
|
|
41
|
+
*/
|
|
42
|
+
export interface FileKind<Value = unknown> {
|
|
43
|
+
/** The kind's name, as the old schema export named it: `workspace`, `workflowTest`, … */
|
|
44
|
+
readonly name: string;
|
|
45
|
+
/** One line on what the file is for. */
|
|
46
|
+
readonly about: string;
|
|
47
|
+
readonly syntax: KindSyntax;
|
|
48
|
+
/** The schema of the file's content, with every default. Its JSON Schema is the kind's. */
|
|
49
|
+
readonly schema: Schema<Value, unknown>;
|
|
50
|
+
/** Where the kind's files sit. Empty for none. */
|
|
51
|
+
readonly places: readonly FilePlace[];
|
|
52
|
+
/**
|
|
53
|
+
* How the id the file's place gives (its file name or folder) is used:
|
|
54
|
+
* `fallback` fills `id` in when the file has none, `always` overrides it,
|
|
55
|
+
* `none` ignores it.
|
|
56
|
+
*/
|
|
57
|
+
readonly idFromPlace: "fallback" | "always" | "none";
|
|
58
|
+
/**
|
|
59
|
+
* Reads old key names as their new ones before the schema sees the data,
|
|
60
|
+
* so older files keep loading (for example `flow:` for `workflow:`).
|
|
61
|
+
*/
|
|
62
|
+
readonly upgradeKeys?: (data: Readonly<Record<string, unknown>>) => Record<string, unknown>;
|
|
63
|
+
/** Checks that span several fields, run after the schema passed. */
|
|
64
|
+
readonly check?: (value: Value) => readonly KindCheckProblem[];
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Agent } from "./schema.js";
|
|
2
|
+
/** `agents/<id>.agent.yaml`, at the root or in a hub. */
|
|
3
|
+
export const agentKind = {
|
|
4
|
+
name: "agent",
|
|
5
|
+
about: "An agent: its model, instructions, tools, methods and character.",
|
|
6
|
+
syntax: "yaml",
|
|
7
|
+
schema: Agent,
|
|
8
|
+
places: [{ scope: "workspace-and-hub", folder: "agents", name: "<id>.agent.yaml" }],
|
|
9
|
+
idFromPlace: "fallback",
|
|
10
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The harnesses an agent can run in: Halonic's own loop, Claude Code or
|
|
3
|
+
* Codex. A closed list, so a typo fails `halonic validate`; each new harness
|
|
4
|
+
* adds a value here.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AgentHarness: import("zod").ZodEnum<{
|
|
7
|
+
"claude-code": "claude-code";
|
|
8
|
+
codex: "codex";
|
|
9
|
+
halonic: "halonic";
|
|
10
|
+
}>;
|
|
11
|
+
/** The ids of the harnesses an agent can run in, for a caller that checks one outside an agent's file. */
|
|
12
|
+
export declare const AGENT_HARNESSES: readonly string[];
|
|
13
|
+
/** The most sites one agent may name (Julian's cap, HAL-1708). */
|
|
14
|
+
export declare const MAX_ALLOWED_SITES = 50;
|
|
15
|
+
/**
|
|
16
|
+
* The first parts of a workspace path that hold definition files or data
|
|
17
|
+
* that isn't the agent's to write: git's own folder, Halonic's reserved
|
|
18
|
+
* folder, every kind's folder, the hubs and the kind files in the workspace
|
|
19
|
+
* root. A test checks that every kind's place is covered, so a new kind
|
|
20
|
+
* can't be missed. They are compared after {@link foldName}.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PROTECTED_TOP_NAMES: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* The working folder an agent gets when its file names none.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* defaultWorkingFolder("writer"); // "files/agents/writer"
|
|
28
|
+
*/
|
|
29
|
+
export declare function defaultWorkingFolder(agentId: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Why a working folder can't be used, or `null` when it can. It must be a
|
|
32
|
+
* path relative to the workspace with `/` between its parts, that stays in
|
|
33
|
+
* the workspace and doesn't point into a {@link PROTECTED_TOP_NAMES} entry
|
|
34
|
+
* or a top folder whose name starts with `.`: tools such as git, Claude
|
|
35
|
+
* Code, Codex and editors read hooks, commands and tasks from those
|
|
36
|
+
* (`.git`, `.claude`, `.codex`, `.vscode`), and would run them outside the
|
|
37
|
+
* sandbox. Parts that Windows or macOS would read as another name are refused
|
|
38
|
+
* too, in fullwidth forms as well (see {@link relativePathProblem}). Symlinks
|
|
39
|
+
* are resolved later, when the sandbox profile is built.
|
|
40
|
+
*
|
|
41
|
+
* @param path - the `workingFolder` value
|
|
42
|
+
* @returns a message, or `null`
|
|
43
|
+
*/
|
|
44
|
+
export declare function workingFolderProblem(path: string): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Whether a workspace path is a working folder or inside it, as a file
|
|
47
|
+
* system that ignores case sees it. Both are relative to the workspace root.
|
|
48
|
+
* `path` may be written loosely, as a program's folder or argument is: with
|
|
49
|
+
* `\`, `.` or `..` parts, or a part that ends in `.` or a space, which
|
|
50
|
+
* Windows drops. An absolute path, or one that leaves the workspace, is
|
|
51
|
+
* never inside: who checks those must know where the workspace is.
|
|
52
|
+
*
|
|
53
|
+
* @param path - a path relative to the workspace root
|
|
54
|
+
* @param workingFolder - a `workingFolder` that passed {@link workingFolderProblem}
|
|
55
|
+
* @returns `true` when the path is the folder or inside it
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* isInWorkingFolder("Scripts\\mail.sh", "scripts"); // true
|
|
59
|
+
* isInWorkingFolder("scripts-old/mail.sh", "scripts"); // false
|
|
60
|
+
*/
|
|
61
|
+
export declare function isInWorkingFolder(path: string, workingFolder: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Why an allowed site can't be used, or `null` when it can. A site is a host
|
|
64
|
+
* name with at least two labels, such as `api.example.com`, or `*.` and a
|
|
65
|
+
* domain with at least two labels, such as `*.example.com`. No address in any
|
|
66
|
+
* notation (a last label starting with a digit, so `127.0x1` too), port,
|
|
67
|
+
* scheme or path, no bare `*`, and no `localhost`, `local`, `localdomain`,
|
|
68
|
+
* `internal` or `arpa` names, which would reach this computer or the local
|
|
69
|
+
* network. Fullwidth forms, ideographic dots, control characters and
|
|
70
|
+
* invisible code points are refused, since a URL parser would map them to
|
|
71
|
+
* another name.
|
|
72
|
+
*
|
|
73
|
+
* @param site - an `allowedSites` entry, in any case and in Unicode or ASCII
|
|
74
|
+
* @returns a message, or `null`
|
|
75
|
+
*/
|
|
76
|
+
export declare function allowedSiteProblem(site: string): string | null;
|
|
77
|
+
/**
|
|
78
|
+
* The allowed sites in the form the sandbox and the trust prompt use:
|
|
79
|
+
* lowercase, in ASCII (Punycode) and each once, in the order first named.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* asciiAllowedSites(["API.Example.com", "bücher.example", "api.example.com"]);
|
|
83
|
+
* // => ["api.example.com", "xn--bcher-kva.example"]
|
|
84
|
+
*/
|
|
85
|
+
export declare function asciiAllowedSites(sites: readonly string[]): string[];
|
|
86
|
+
/** The `workingFolder` field: a folder in the workspace the agent may write to. */
|
|
87
|
+
export declare const WorkingFolder: import("zod").ZodString;
|
|
88
|
+
/** One `allowedSites` entry: a host name, or `*.` and a domain. */
|
|
89
|
+
export declare const AllowedSite: import("zod").ZodString;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// The agent fields that say how a harness agent runs: which program, the one
|
|
2
|
+
// folder it writes to and the sites it may reach (requirement
|
|
3
|
+
// format.agent-sandbox-fields). They decide what a program on the person's
|
|
4
|
+
// computer can touch, so the checks refuse anything that could reach past
|
|
5
|
+
// the workspace or past the named sites.
|
|
6
|
+
import { s } from "../../../../schema-kit/src/index.js";
|
|
7
|
+
import { asciiHost, posixPath } from "../../../../std/src/index.js";
|
|
8
|
+
import { foldName, relativePathProblem } from "../../shared/relative-path.js";
|
|
9
|
+
/**
|
|
10
|
+
* The harnesses an agent can run in: Halonic's own loop, Claude Code or
|
|
11
|
+
* Codex. A closed list, so a typo fails `halonic validate`; each new harness
|
|
12
|
+
* adds a value here.
|
|
13
|
+
*/
|
|
14
|
+
export const AgentHarness = s.enum(["halonic", "claude-code", "codex"]);
|
|
15
|
+
/** The ids of the harnesses an agent can run in, for a caller that checks one outside an agent's file. */
|
|
16
|
+
export const AGENT_HARNESSES = AgentHarness.options;
|
|
17
|
+
/** The most sites one agent may name (Julian's cap, HAL-1708). */
|
|
18
|
+
export const MAX_ALLOWED_SITES = 50;
|
|
19
|
+
/**
|
|
20
|
+
* The first parts of a workspace path that hold definition files or data
|
|
21
|
+
* that isn't the agent's to write: git's own folder, Halonic's reserved
|
|
22
|
+
* folder, every kind's folder, the hubs and the kind files in the workspace
|
|
23
|
+
* root. A test checks that every kind's place is covered, so a new kind
|
|
24
|
+
* can't be missed. They are compared after {@link foldName}.
|
|
25
|
+
*/
|
|
26
|
+
export const PROTECTED_TOP_NAMES = [
|
|
27
|
+
".git",
|
|
28
|
+
".halonic",
|
|
29
|
+
"agents",
|
|
30
|
+
"deployments.yaml",
|
|
31
|
+
"hub.yaml",
|
|
32
|
+
"hubs",
|
|
33
|
+
"library",
|
|
34
|
+
"models.yaml",
|
|
35
|
+
"providers",
|
|
36
|
+
"runtimes",
|
|
37
|
+
"workflows",
|
|
38
|
+
"workspace.yaml",
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
* The working folder an agent gets when its file names none.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* defaultWorkingFolder("writer"); // "files/agents/writer"
|
|
45
|
+
*/
|
|
46
|
+
export function defaultWorkingFolder(agentId) {
|
|
47
|
+
return `files/agents/${agentId}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Why a working folder can't be used, or `null` when it can. It must be a
|
|
51
|
+
* path relative to the workspace with `/` between its parts, that stays in
|
|
52
|
+
* the workspace and doesn't point into a {@link PROTECTED_TOP_NAMES} entry
|
|
53
|
+
* or a top folder whose name starts with `.`: tools such as git, Claude
|
|
54
|
+
* Code, Codex and editors read hooks, commands and tasks from those
|
|
55
|
+
* (`.git`, `.claude`, `.codex`, `.vscode`), and would run them outside the
|
|
56
|
+
* sandbox. Parts that Windows or macOS would read as another name are refused
|
|
57
|
+
* too, in fullwidth forms as well (see {@link relativePathProblem}). Symlinks
|
|
58
|
+
* are resolved later, when the sandbox profile is built.
|
|
59
|
+
*
|
|
60
|
+
* @param path - the `workingFolder` value
|
|
61
|
+
* @returns a message, or `null`
|
|
62
|
+
*/
|
|
63
|
+
export function workingFolderProblem(path) {
|
|
64
|
+
const pathProblem = relativePathProblem(path, { root: "the workspace", part: "folder name" });
|
|
65
|
+
if (pathProblem !== null)
|
|
66
|
+
return pathProblem;
|
|
67
|
+
const shown = path.split("/")[0] ?? "";
|
|
68
|
+
const top = foldName(path).split("/")[0] ?? "";
|
|
69
|
+
if (PROTECTED_TOP_NAMES.includes(top)) {
|
|
70
|
+
return `The agent can't write in '${shown}': it holds definitions or Halonic's own data`;
|
|
71
|
+
}
|
|
72
|
+
if (top.startsWith(".")) {
|
|
73
|
+
return `The agent can't write in '${shown}': tools read settings and hooks from folders that start with '.'`;
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Whether a workspace path is a working folder or inside it, as a file
|
|
79
|
+
* system that ignores case sees it. Both are relative to the workspace root.
|
|
80
|
+
* `path` may be written loosely, as a program's folder or argument is: with
|
|
81
|
+
* `\`, `.` or `..` parts, or a part that ends in `.` or a space, which
|
|
82
|
+
* Windows drops. An absolute path, or one that leaves the workspace, is
|
|
83
|
+
* never inside: who checks those must know where the workspace is.
|
|
84
|
+
*
|
|
85
|
+
* @param path - a path relative to the workspace root
|
|
86
|
+
* @param workingFolder - a `workingFolder` that passed {@link workingFolderProblem}
|
|
87
|
+
* @returns `true` when the path is the folder or inside it
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* isInWorkingFolder("Scripts\\mail.sh", "scripts"); // true
|
|
91
|
+
* isInWorkingFolder("scripts-old/mail.sh", "scripts"); // false
|
|
92
|
+
*/
|
|
93
|
+
export function isInWorkingFolder(path, workingFolder) {
|
|
94
|
+
const parts = comparableParts(path);
|
|
95
|
+
const folder = comparableParts(workingFolder);
|
|
96
|
+
if (parts === null || folder === null || parts.length < folder.length)
|
|
97
|
+
return false;
|
|
98
|
+
return folder.every((part, index) => parts[index] === part);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The parts of a relative path as a file system that ignores case reads
|
|
102
|
+
* them, or `null` for an absolute path or one that leaves the workspace.
|
|
103
|
+
*/
|
|
104
|
+
function comparableParts(path) {
|
|
105
|
+
const slashed = foldName(path).replaceAll("\\", "/");
|
|
106
|
+
if (slashed.startsWith("/") || /^[a-z]:/.test(slashed))
|
|
107
|
+
return null;
|
|
108
|
+
const normalized = posixPath.normalize(slashed.split("/").map(windowsName).join("/"));
|
|
109
|
+
if (normalized === ".." || normalized.startsWith("../"))
|
|
110
|
+
return null;
|
|
111
|
+
return normalized.split("/").filter((part) => part !== "" && part !== ".");
|
|
112
|
+
}
|
|
113
|
+
/** A part as Windows reads it: without trailing dots and spaces, so `scripts.` is `scripts`. */
|
|
114
|
+
function windowsName(part) {
|
|
115
|
+
const trimmed = part.replace(/[. ]+$/, "");
|
|
116
|
+
return part === "." || part === ".." || trimmed === "" ? part : trimmed;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The last labels that name this computer or the local network, not a site
|
|
120
|
+
* on the internet.
|
|
121
|
+
*/
|
|
122
|
+
const LOCAL_TOP_LABELS = [
|
|
123
|
+
"arpa",
|
|
124
|
+
"internal",
|
|
125
|
+
"local",
|
|
126
|
+
"localdomain",
|
|
127
|
+
"localhost",
|
|
128
|
+
];
|
|
129
|
+
/**
|
|
130
|
+
* Why an allowed site can't be used, or `null` when it can. A site is a host
|
|
131
|
+
* name with at least two labels, such as `api.example.com`, or `*.` and a
|
|
132
|
+
* domain with at least two labels, such as `*.example.com`. No address in any
|
|
133
|
+
* notation (a last label starting with a digit, so `127.0x1` too), port,
|
|
134
|
+
* scheme or path, no bare `*`, and no `localhost`, `local`, `localdomain`,
|
|
135
|
+
* `internal` or `arpa` names, which would reach this computer or the local
|
|
136
|
+
* network. Fullwidth forms, ideographic dots, control characters and
|
|
137
|
+
* invisible code points are refused, since a URL parser would map them to
|
|
138
|
+
* another name.
|
|
139
|
+
*
|
|
140
|
+
* @param site - an `allowedSites` entry, in any case and in Unicode or ASCII
|
|
141
|
+
* @returns a message, or `null`
|
|
142
|
+
*/
|
|
143
|
+
export function allowedSiteProblem(site) {
|
|
144
|
+
if (/[\p{Cc}\p{Default_Ignorable_Code_Point}\u3002]/u.test(site) ||
|
|
145
|
+
site.normalize("NFKC") !== site.normalize("NFC")) {
|
|
146
|
+
return "Write the host name in plain characters, without fullwidth forms or invisible characters";
|
|
147
|
+
}
|
|
148
|
+
const host = asciiHost(site);
|
|
149
|
+
const wildcard = host.startsWith("*.");
|
|
150
|
+
const name = wildcard ? host.slice(2) : host;
|
|
151
|
+
if (host === "*")
|
|
152
|
+
return "Name a domain after '*.', such as '*.example.com'";
|
|
153
|
+
if (/[:/@?#\s[\]]/.test(name) || name.includes("*")) {
|
|
154
|
+
return "Write only a host name, such as 'api.example.com', without a scheme, port or path";
|
|
155
|
+
}
|
|
156
|
+
const labels = name.split(".");
|
|
157
|
+
if (!labels.every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(label))) {
|
|
158
|
+
return "Use a host name of letters, digits, '-' and '.'";
|
|
159
|
+
}
|
|
160
|
+
if (name.length > 253)
|
|
161
|
+
return "Use a host name of at most 253 characters";
|
|
162
|
+
const last = labels.at(-1) ?? "";
|
|
163
|
+
if (/^\d/.test(last))
|
|
164
|
+
return "Use a host name, not an address";
|
|
165
|
+
if (labels.length < 2) {
|
|
166
|
+
return wildcard
|
|
167
|
+
? "Name at least two labels after '*.', such as '*.example.com'"
|
|
168
|
+
: "Use a full host name, such as 'api.example.com'";
|
|
169
|
+
}
|
|
170
|
+
if (LOCAL_TOP_LABELS.includes(last)) {
|
|
171
|
+
return `A '.${last}' name would reach this computer or the local network`;
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The allowed sites in the form the sandbox and the trust prompt use:
|
|
177
|
+
* lowercase, in ASCII (Punycode) and each once, in the order first named.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* asciiAllowedSites(["API.Example.com", "bücher.example", "api.example.com"]);
|
|
181
|
+
* // => ["api.example.com", "xn--bcher-kva.example"]
|
|
182
|
+
*/
|
|
183
|
+
export function asciiAllowedSites(sites) {
|
|
184
|
+
return [...new Set(sites.map(asciiHost))];
|
|
185
|
+
}
|
|
186
|
+
/** The `workingFolder` field: a folder in the workspace the agent may write to. */
|
|
187
|
+
export const WorkingFolder = s.string().superRefine((path, context) => {
|
|
188
|
+
const problem = workingFolderProblem(path);
|
|
189
|
+
if (problem !== null)
|
|
190
|
+
context.addIssue({ code: "custom", message: problem });
|
|
191
|
+
});
|
|
192
|
+
/** One `allowedSites` entry: a host name, or `*.` and a domain. */
|
|
193
|
+
export const AllowedSite = s.string().superRefine((site, context) => {
|
|
194
|
+
const problem = allowedSiteProblem(site);
|
|
195
|
+
if (problem !== null)
|
|
196
|
+
context.addIssue({ code: "custom", message: problem });
|
|
197
|
+
});
|