@halonicjs/testing 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +41 -1
- package/dist/adapters/http-kit/src/address-checking.d.ts +19 -0
- package/dist/adapters/http-kit/src/address-checking.js +1 -0
- package/dist/adapters/http-kit/src/address-class.d.ts +34 -0
- package/dist/adapters/http-kit/src/address-class.js +109 -0
- package/dist/adapters/http-kit/src/index.d.ts +3 -0
- package/dist/adapters/http-kit/src/index.js +2 -0
- package/dist/adapters/http-kit/src/ip-address.d.ts +23 -0
- package/dist/adapters/http-kit/src/ip-address.js +89 -0
- package/dist/adapters/integration-kit/src/auth-placement.d.ts +40 -0
- package/dist/adapters/integration-kit/src/auth-placement.js +102 -0
- package/dist/adapters/integration-kit/src/current-secret-forms.d.ts +28 -0
- package/dist/adapters/integration-kit/src/current-secret-forms.js +60 -0
- package/dist/adapters/integration-kit/src/declaration.d.ts +15 -0
- package/dist/adapters/integration-kit/src/declaration.js +78 -0
- package/dist/adapters/integration-kit/src/host.d.ts +34 -0
- package/dist/adapters/integration-kit/src/host.js +31 -0
- package/dist/adapters/integration-kit/src/index.d.ts +16 -0
- package/dist/adapters/integration-kit/src/index.js +22 -0
- package/dist/adapters/integration-kit/src/leak-attempt.d.ts +16 -0
- package/dist/adapters/integration-kit/src/leak-attempt.js +19 -0
- package/dist/adapters/integration-kit/src/limited-http.d.ts +55 -0
- package/dist/adapters/integration-kit/src/limited-http.js +225 -0
- package/dist/adapters/integration-kit/src/load-problem.d.ts +20 -0
- package/dist/adapters/integration-kit/src/load-problem.js +1 -0
- package/dist/adapters/integration-kit/src/loader.d.ts +131 -0
- package/dist/adapters/integration-kit/src/loader.js +251 -0
- package/dist/adapters/integration-kit/src/local-address.d.ts +15 -0
- package/dist/adapters/integration-kit/src/local-address.js +25 -0
- package/dist/adapters/integration-kit/src/own-request.d.ts +33 -0
- package/dist/adapters/integration-kit/src/own-request.js +36 -0
- package/dist/adapters/integration-kit/src/plugin-load.d.ts +14 -0
- package/dist/adapters/integration-kit/src/plugin-load.js +58 -0
- package/dist/adapters/integration-kit/src/policy.d.ts +83 -0
- package/dist/adapters/integration-kit/src/policy.js +37 -0
- package/dist/adapters/integration-kit/src/request-body.d.ts +38 -0
- package/dist/adapters/integration-kit/src/request-body.js +68 -0
- package/dist/adapters/integration-kit/src/request-log.d.ts +25 -0
- package/dist/adapters/integration-kit/src/request-log.js +17 -0
- package/dist/adapters/integration-kit/src/response-body.d.ts +27 -0
- package/dist/adapters/integration-kit/src/response-body.js +117 -0
- package/dist/adapters/integration-kit/src/scoped-tokens.d.ts +14 -0
- package/dist/adapters/integration-kit/src/scoped-tokens.js +27 -0
- package/dist/adapters/integration-kit/src/secret-filter.d.ts +84 -0
- package/dist/adapters/integration-kit/src/secret-filter.js +220 -0
- package/dist/adapters/integration-kit/src/secret-in-request.d.ts +62 -0
- package/dist/adapters/integration-kit/src/secret-in-request.js +139 -0
- package/dist/adapters/integration-kit/src/secret-placement.d.ts +46 -0
- package/dist/adapters/integration-kit/src/secret-placement.js +160 -0
- package/dist/adapters/integration-kit/src/sign-in-placement.d.ts +29 -0
- package/dist/adapters/integration-kit/src/sign-in-placement.js +92 -0
- package/dist/adapters/integration-kit/src/wait.d.ts +16 -0
- package/dist/adapters/integration-kit/src/wait.js +35 -0
- package/dist/core/events/src/add-usage.d.ts +10 -0
- package/dist/core/events/src/add-usage.js +27 -0
- package/dist/core/events/src/agent-resume.d.ts +24 -0
- package/dist/core/events/src/agent-resume.js +1 -0
- package/dist/core/events/src/blocked-sites.d.ts +57 -0
- package/dist/core/events/src/blocked-sites.js +89 -0
- package/dist/core/events/src/home-path.d.ts +13 -0
- package/dist/core/events/src/home-path.js +26 -0
- package/dist/core/events/src/index.d.ts +17 -0
- package/dist/core/events/src/index.js +10 -0
- package/dist/core/events/src/run-basics.d.ts +228 -0
- package/dist/core/events/src/run-basics.js +1 -0
- package/dist/core/events/src/run-event.d.ts +478 -0
- package/dist/core/events/src/run-event.js +1 -0
- package/dist/core/events/src/run-reads.d.ts +25 -0
- package/dist/core/events/src/run-reads.js +44 -0
- package/dist/core/events/src/run-sends.d.ts +47 -0
- package/dist/core/events/src/run-sends.js +68 -0
- package/dist/core/events/src/run-summary.d.ts +108 -0
- package/dist/core/events/src/run-summary.js +1 -0
- package/dist/core/events/src/sandbox-blocked.d.ts +42 -0
- package/dist/core/events/src/sandbox-blocked.js +26 -0
- package/dist/core/events/src/sandbox-opened-read.d.ts +17 -0
- package/dist/core/events/src/sandbox-opened-read.js +63 -0
- package/dist/core/events/src/sandbox-opened.d.ts +94 -0
- package/dist/core/events/src/sandbox-opened.js +52 -0
- package/dist/core/events/src/summarize.d.ts +14 -0
- package/dist/core/events/src/summarize.js +192 -0
- package/dist/core/events/src/timeline-entry.d.ts +21 -0
- package/dist/core/events/src/timeline-entry.js +106 -0
- package/dist/core/events/src/upgrade.d.ts +23 -0
- package/dist/core/events/src/upgrade.js +49 -0
- package/dist/core/format/src/compact.d.ts +30 -0
- package/dist/core/format/src/compact.js +72 -0
- package/dist/core/format/src/index.d.ts +39 -0
- package/dist/core/format/src/index.js +25 -0
- package/dist/core/format/src/integration/index.d.ts +7 -0
- package/dist/core/format/src/integration/index.js +10 -0
- package/dist/core/format/src/json-schema.d.ts +26 -0
- package/dist/core/format/src/json-schema.js +48 -0
- package/dist/core/format/src/kind.d.ts +65 -0
- package/dist/core/format/src/kind.js +1 -0
- package/dist/core/format/src/kinds/agent/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/agent/kind.js +10 -0
- package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +99 -0
- package/dist/core/format/src/kinds/agent/sandbox-fields.js +216 -0
- package/dist/core/format/src/kinds/agent/schema.d.ts +147 -0
- package/dist/core/format/src/kinds/agent/schema.js +107 -0
- package/dist/core/format/src/kinds/agent/working-folder-start.d.ts +74 -0
- package/dist/core/format/src/kinds/agent/working-folder-start.js +312 -0
- package/dist/core/format/src/kinds/collection/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/collection/kind.js +14 -0
- package/dist/core/format/src/kinds/collection/schema.d.ts +89 -0
- package/dist/core/format/src/kinds/collection/schema.js +90 -0
- package/dist/core/format/src/kinds/connector/is-local.d.ts +10 -0
- package/dist/core/format/src/kinds/connector/is-local.js +43 -0
- package/dist/core/format/src/kinds/connector/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/connector/kind.js +218 -0
- package/dist/core/format/src/kinds/connector/schema.d.ts +74 -0
- package/dist/core/format/src/kinds/connector/schema.js +143 -0
- package/dist/core/format/src/kinds/deployments/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/deployments/kind.js +49 -0
- package/dist/core/format/src/kinds/deployments/schema.d.ts +77 -0
- package/dist/core/format/src/kinds/deployments/schema.js +94 -0
- package/dist/core/format/src/kinds/hub/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/hub/kind.js +10 -0
- package/dist/core/format/src/kinds/hub/schema.d.ts +54 -0
- package/dist/core/format/src/kinds/hub/schema.js +34 -0
- package/dist/core/format/src/kinds/integration/approved-sign-ins.d.ts +62 -0
- package/dist/core/format/src/kinds/integration/approved-sign-ins.js +125 -0
- package/dist/core/format/src/kinds/integration/host-key.d.ts +7 -0
- package/dist/core/format/src/kinds/integration/host-key.js +8 -0
- package/dist/core/format/src/kinds/integration/kind.d.ts +18 -0
- package/dist/core/format/src/kinds/integration/kind.js +175 -0
- package/dist/core/format/src/kinds/integration/parse-sheet.d.ts +19 -0
- package/dist/core/format/src/kinds/integration/parse-sheet.js +24 -0
- package/dist/core/format/src/kinds/integration/policy.d.ts +112 -0
- package/dist/core/format/src/kinds/integration/policy.js +327 -0
- package/dist/core/format/src/kinds/integration/schema.d.ts +410 -0
- package/dist/core/format/src/kinds/integration/schema.js +359 -0
- package/dist/core/format/src/kinds/integration/sign-in-checks.d.ts +13 -0
- package/dist/core/format/src/kinds/integration/sign-in-checks.js +120 -0
- package/dist/core/format/src/kinds/integration/sign-in-urls.d.ts +19 -0
- package/dist/core/format/src/kinds/integration/sign-in-urls.js +47 -0
- package/dist/core/format/src/kinds/knowledge/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/knowledge/kind.js +13 -0
- package/dist/core/format/src/kinds/knowledge/schema.d.ts +18 -0
- package/dist/core/format/src/kinds/knowledge/schema.js +25 -0
- package/dist/core/format/src/kinds/models/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/models/kind.js +10 -0
- package/dist/core/format/src/kinds/models/schema.d.ts +92 -0
- package/dist/core/format/src/kinds/models/schema.js +38 -0
- package/dist/core/format/src/kinds/plugin/backend.d.ts +22 -0
- package/dist/core/format/src/kinds/plugin/backend.js +31 -0
- package/dist/core/format/src/kinds/plugin/checks.d.ts +13 -0
- package/dist/core/format/src/kinds/plugin/checks.js +137 -0
- package/dist/core/format/src/kinds/plugin/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/plugin/kind.js +16 -0
- package/dist/core/format/src/kinds/plugin/problems.d.ts +24 -0
- package/dist/core/format/src/kinds/plugin/problems.js +65 -0
- package/dist/core/format/src/kinds/plugin/schema.d.ts +672 -0
- package/dist/core/format/src/kinds/plugin/schema.js +261 -0
- package/dist/core/format/src/kinds/plugin/setting-values.d.ts +17 -0
- package/dist/core/format/src/kinds/plugin/setting-values.js +38 -0
- package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +8 -0
- package/dist/core/format/src/kinds/plugin/ui-checks.js +85 -0
- package/dist/core/format/src/kinds/provider/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/provider/kind.js +24 -0
- package/dist/core/format/src/kinds/provider/schema.d.ts +17 -0
- package/dist/core/format/src/kinds/provider/schema.js +22 -0
- package/dist/core/format/src/kinds/routine/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/routine/kind.js +62 -0
- package/dist/core/format/src/kinds/routine/schema.d.ts +94 -0
- package/dist/core/format/src/kinds/routine/schema.js +115 -0
- package/dist/core/format/src/kinds/routine/webhook-headers.d.ts +9 -0
- package/dist/core/format/src/kinds/routine/webhook-headers.js +26 -0
- package/dist/core/format/src/kinds/runtime/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/runtime/kind.js +13 -0
- package/dist/core/format/src/kinds/runtime/schema.d.ts +10 -0
- package/dist/core/format/src/kinds/runtime/schema.js +12 -0
- package/dist/core/format/src/kinds/skill/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/skill/kind.js +10 -0
- package/dist/core/format/src/kinds/skill/schema.d.ts +17 -0
- package/dist/core/format/src/kinds/skill/schema.js +17 -0
- package/dist/core/format/src/kinds/skill/scripts-folder.d.ts +27 -0
- package/dist/core/format/src/kinds/skill/scripts-folder.js +37 -0
- package/dist/core/format/src/kinds/workflow/kind.d.ts +8 -0
- package/dist/core/format/src/kinds/workflow/kind.js +14 -0
- package/dist/core/format/src/kinds/workflow/schema.d.ts +162 -0
- package/dist/core/format/src/kinds/workflow/schema.js +106 -0
- package/dist/core/format/src/kinds/workflow-test/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/workflow-test/kind.js +14 -0
- package/dist/core/format/src/kinds/workflow-test/schema.d.ts +67 -0
- package/dist/core/format/src/kinds/workflow-test/schema.js +59 -0
- package/dist/core/format/src/kinds/workspace/kind.d.ts +4 -0
- package/dist/core/format/src/kinds/workspace/kind.js +10 -0
- package/dist/core/format/src/kinds/workspace/schema.d.ts +72 -0
- package/dist/core/format/src/kinds/workspace/schema.js +66 -0
- package/dist/core/format/src/parse-file.d.ts +69 -0
- package/dist/core/format/src/parse-file.js +105 -0
- package/dist/core/format/src/recording/format.d.ts +81 -0
- package/dist/core/format/src/recording/format.js +102 -0
- package/dist/core/format/src/recording/index.d.ts +1 -0
- package/dist/core/format/src/recording/index.js +3 -0
- package/dist/core/format/src/registry.d.ts +64 -0
- package/dist/core/format/src/registry.js +61 -0
- package/dist/core/format/src/reserved.d.ts +20 -0
- package/dist/core/format/src/reserved.js +30 -0
- package/dist/core/format/src/shared/fields.d.ts +34 -0
- package/dist/core/format/src/shared/fields.js +74 -0
- package/dist/core/format/src/shared/guard.d.ts +32 -0
- package/dist/core/format/src/shared/guard.js +16 -0
- package/dist/core/format/src/shared/key-in-value.d.ts +28 -0
- package/dist/core/format/src/shared/key-in-value.js +82 -0
- package/dist/core/format/src/shared/legacy-keys.d.ts +8 -0
- package/dist/core/format/src/shared/legacy-keys.js +17 -0
- package/dist/core/format/src/shared/program-start.d.ts +60 -0
- package/dist/core/format/src/shared/program-start.js +99 -0
- package/dist/core/format/src/shared/relative-path.d.ts +29 -0
- package/dist/core/format/src/shared/relative-path.js +50 -0
- package/dist/core/format/src/shared/secret-name.d.ts +24 -0
- package/dist/core/format/src/shared/secret-name.js +107 -0
- package/dist/core/format/src/source.d.ts +16 -0
- package/dist/core/format/src/source.js +73 -0
- package/dist/core/ports/src/agent-placement-store.d.ts +74 -0
- package/dist/core/ports/src/agent-placement-store.js +27 -0
- package/dist/core/ports/src/agent-runs-not-available.d.ts +21 -0
- package/dist/core/ports/src/agent-runs-not-available.js +25 -0
- package/dist/core/ports/src/blob-store.d.ts +45 -0
- package/dist/core/ports/src/blob-store.js +24 -0
- package/dist/core/ports/src/cant-try-error.d.ts +35 -0
- package/dist/core/ports/src/cant-try-error.js +44 -0
- package/dist/core/ports/src/chat.d.ts +127 -0
- package/dist/core/ports/src/chat.js +1 -0
- package/dist/core/ports/src/clock.d.ts +7 -0
- package/dist/core/ports/src/clock.js +2 -0
- package/dist/core/ports/src/connection-settings-store.d.ts +57 -0
- package/dist/core/ports/src/connection-settings-store.js +2 -0
- package/dist/core/ports/src/connector-client.d.ts +303 -0
- package/dist/core/ports/src/connector-client.js +19 -0
- package/dist/core/ports/src/coordination.d.ts +84 -0
- package/dist/core/ports/src/coordination.js +2 -0
- package/dist/core/ports/src/definition-store.d.ts +229 -0
- package/dist/core/ports/src/definition-store.js +122 -0
- package/dist/core/ports/src/digest.d.ts +14 -0
- package/dist/core/ports/src/digest.js +2 -0
- package/dist/core/ports/src/folder-reader.d.ts +89 -0
- package/dist/core/ports/src/folder-reader.js +2 -0
- package/dist/core/ports/src/harness-bridge-server.d.ts +198 -0
- package/dist/core/ports/src/harness-bridge-server.js +37 -0
- package/dist/core/ports/src/harness-sign-in-command.d.ts +27 -0
- package/dist/core/ports/src/harness-sign-in-command.js +31 -0
- package/dist/core/ports/src/harness.d.ts +283 -0
- package/dist/core/ports/src/harness.js +45 -0
- package/dist/core/ports/src/host-settings-store.d.ts +116 -0
- package/dist/core/ports/src/host-settings-store.js +106 -0
- package/dist/core/ports/src/http-client.d.ts +27 -0
- package/dist/core/ports/src/http-client.js +2 -0
- package/dist/core/ports/src/id-generator.d.ts +14 -0
- package/dist/core/ports/src/id-generator.js +2 -0
- package/dist/core/ports/src/index.d.ts +45 -0
- package/dist/core/ports/src/index.js +44 -0
- package/dist/core/ports/src/instruction-trust-store.d.ts +81 -0
- package/dist/core/ports/src/instruction-trust-store.js +43 -0
- package/dist/core/ports/src/integration.d.ts +242 -0
- package/dist/core/ports/src/integration.js +31 -0
- package/dist/core/ports/src/knowledge-provider.d.ts +65 -0
- package/dist/core/ports/src/knowledge-provider.js +2 -0
- package/dist/core/ports/src/llm-cache.d.ts +13 -0
- package/dist/core/ports/src/llm-cache.js +2 -0
- package/dist/core/ports/src/llm-provider.d.ts +186 -0
- package/dist/core/ports/src/llm-provider.js +139 -0
- package/dist/core/ports/src/model-price.d.ts +34 -0
- package/dist/core/ports/src/model-price.js +25 -0
- package/dist/core/ports/src/password-hasher.d.ts +63 -0
- package/dist/core/ports/src/password-hasher.js +2 -0
- package/dist/core/ports/src/plugin-folder-writer.d.ts +104 -0
- package/dist/core/ports/src/plugin-folder-writer.js +95 -0
- package/dist/core/ports/src/port-versions.d.ts +47 -0
- package/dist/core/ports/src/port-versions.js +80 -0
- package/dist/core/ports/src/program-probe.d.ts +69 -0
- package/dist/core/ports/src/program-probe.js +2 -0
- package/dist/core/ports/src/provider-default-base-url.d.ts +10 -0
- package/dist/core/ports/src/provider-default-base-url.js +18 -0
- package/dist/core/ports/src/record-store.d.ts +79 -0
- package/dist/core/ports/src/record-store.js +108 -0
- package/dist/core/ports/src/resource-probe.d.ts +59 -0
- package/dist/core/ports/src/resource-probe.js +2 -0
- package/dist/core/ports/src/run-executor.d.ts +303 -0
- package/dist/core/ports/src/run-executor.js +2 -0
- package/dist/core/ports/src/run-failure-error.d.ts +49 -0
- package/dist/core/ports/src/run-failure-error.js +47 -0
- package/dist/core/ports/src/run-store.d.ts +194 -0
- package/dist/core/ports/src/run-store.js +131 -0
- package/dist/core/ports/src/run-target-not-found.d.ts +34 -0
- package/dist/core/ports/src/run-target-not-found.js +41 -0
- package/dist/core/ports/src/sandbox-setting-store.d.ts +68 -0
- package/dist/core/ports/src/sandbox-setting-store.js +33 -0
- package/dist/core/ports/src/sandbox.d.ts +364 -0
- package/dist/core/ports/src/sandbox.js +70 -0
- package/dist/core/ports/src/scheduler.d.ts +85 -0
- package/dist/core/ports/src/scheduler.js +2 -0
- package/dist/core/ports/src/secrets.d.ts +201 -0
- package/dist/core/ports/src/secrets.js +200 -0
- package/dist/core/ports/src/token-store.d.ts +19 -0
- package/dist/core/ports/src/token-store.js +2 -0
- package/dist/core/ports/src/tool-approval-store.d.ts +253 -0
- package/dist/core/ports/src/tool-approval-store.js +116 -0
- package/dist/core/ports/src/trust-store.d.ts +72 -0
- package/dist/core/ports/src/trust-store.js +2 -0
- package/dist/core/ports/src/unfenced-run-consent-store.d.ts +43 -0
- package/dist/core/ports/src/unfenced-run-consent-store.js +2 -0
- package/dist/core/ports/src/vcs-status.d.ts +8 -0
- package/dist/core/ports/src/vcs-status.js +90 -0
- package/dist/core/ports/src/vcs.d.ts +394 -0
- package/dist/core/ports/src/vcs.js +48 -0
- package/dist/core/schema-kit/src/builders.d.ts +50 -0
- package/dist/core/schema-kit/src/builders.js +72 -0
- package/dist/core/schema-kit/src/depth.d.ts +15 -0
- package/dist/core/schema-kit/src/depth.js +37 -0
- package/dist/core/schema-kit/src/index.d.ts +6 -0
- package/dist/core/schema-kit/src/index.js +6 -0
- package/dist/core/schema-kit/src/issue.d.ts +22 -0
- package/dist/core/schema-kit/src/issue.js +23 -0
- package/dist/core/schema-kit/src/json-schema.d.ts +23 -0
- package/dist/core/schema-kit/src/json-schema.js +22 -0
- package/dist/core/schema-kit/src/parse.d.ts +17 -0
- package/dist/core/schema-kit/src/parse.js +25 -0
- package/dist/core/schema-kit/src/schema.d.ts +12 -0
- package/dist/core/schema-kit/src/schema.js +1 -0
- package/dist/core/std/src/amount.d.ts +13 -0
- package/dist/core/std/src/amount.js +22 -0
- package/dist/core/std/src/ascii-host.d.ts +18 -0
- package/dist/core/std/src/ascii-host.js +110 -0
- package/dist/core/std/src/assert.d.ts +39 -0
- package/dist/core/std/src/assert.js +59 -0
- package/dist/core/std/src/base64url.d.ts +23 -0
- package/dist/core/std/src/base64url.js +65 -0
- package/dist/core/std/src/canonical-json.d.ts +18 -0
- package/dist/core/std/src/canonical-json.js +56 -0
- package/dist/core/std/src/clock.d.ts +27 -0
- package/dist/core/std/src/clock.js +33 -0
- package/dist/core/std/src/constant-time.d.ts +16 -0
- package/dist/core/std/src/constant-time.js +26 -0
- package/dist/core/std/src/content-digest.d.ts +24 -0
- package/dist/core/std/src/content-digest.js +28 -0
- package/dist/core/std/src/deep-clone.d.ts +15 -0
- package/dist/core/std/src/deep-clone.js +59 -0
- package/dist/core/std/src/deep-equal.d.ts +23 -0
- package/dist/core/std/src/deep-equal.js +64 -0
- package/dist/core/std/src/emitter.d.ts +42 -0
- package/dist/core/std/src/emitter.js +74 -0
- package/dist/core/std/src/error-kind.d.ts +88 -0
- package/dist/core/std/src/error-kind.js +98 -0
- package/dist/core/std/src/hex.d.ts +10 -0
- package/dist/core/std/src/hex.js +16 -0
- package/dist/core/std/src/hidden-characters.d.ts +19 -0
- package/dist/core/std/src/hidden-characters.js +54 -0
- package/dist/core/std/src/ids.d.ts +45 -0
- package/dist/core/std/src/ids.js +49 -0
- package/dist/core/std/src/index.d.ts +30 -0
- package/dist/core/std/src/index.js +31 -0
- package/dist/core/std/src/keyed-queue.d.ts +18 -0
- package/dist/core/std/src/keyed-queue.js +32 -0
- package/dist/core/std/src/line-diff.d.ts +83 -0
- package/dist/core/std/src/line-diff.js +179 -0
- package/dist/core/std/src/line-merge.d.ts +63 -0
- package/dist/core/std/src/line-merge.js +138 -0
- package/dist/core/std/src/plain-data.d.ts +32 -0
- package/dist/core/std/src/plain-data.js +57 -0
- package/dist/core/std/src/posix-path.d.ts +61 -0
- package/dist/core/std/src/posix-path.js +121 -0
- package/dist/core/std/src/public-suffixes.generated.d.ts +9 -0
- package/dist/core/std/src/public-suffixes.generated.js +10429 -0
- package/dist/core/std/src/registrable-domain.d.ts +10 -0
- package/dist/core/std/src/registrable-domain.js +62 -0
- package/dist/core/std/src/result.d.ts +55 -0
- package/dist/core/std/src/result.js +52 -0
- package/dist/core/std/src/secret-scrubber.d.ts +54 -0
- package/dist/core/std/src/secret-scrubber.js +124 -0
- package/dist/core/std/src/secret-shape.d.ts +20 -0
- package/dist/core/std/src/secret-shape.js +53 -0
- package/dist/core/std/src/secret-variable-name.d.ts +12 -0
- package/dist/core/std/src/secret-variable-name.js +34 -0
- package/dist/core/std/src/site-name.d.ts +35 -0
- package/dist/core/std/src/site-name.js +111 -0
- package/dist/core/std/src/stop-signal.d.ts +44 -0
- package/dist/core/std/src/stop-signal.js +77 -0
- package/dist/core/std/src/text.d.ts +28 -0
- package/dist/core/std/src/text.js +54 -0
- package/dist/core/std/src/url-host.d.ts +35 -0
- package/dist/core/std/src/url-host.js +170 -0
- package/dist/core/std/src/utf8.d.ts +23 -0
- package/dist/core/std/src/utf8.js +110 -0
- package/dist/core/std/src/version.d.ts +48 -0
- package/dist/core/std/src/version.js +103 -0
- package/dist/core/yaml/src/depth.d.ts +14 -0
- package/dist/core/yaml/src/depth.js +140 -0
- package/dist/core/yaml/src/edit-data.d.ts +47 -0
- package/dist/core/yaml/src/edit-data.js +286 -0
- package/dist/core/yaml/src/edit-text.d.ts +92 -0
- package/dist/core/yaml/src/edit-text.js +267 -0
- package/dist/core/yaml/src/edit.d.ts +47 -0
- package/dist/core/yaml/src/edit.js +198 -0
- package/dist/core/yaml/src/index.d.ts +5 -0
- package/dist/core/yaml/src/index.js +4 -0
- package/dist/core/yaml/src/problem.d.ts +20 -0
- package/dist/core/yaml/src/problem.js +1 -0
- package/dist/core/yaml/src/read.d.ts +47 -0
- package/dist/core/yaml/src/read.js +130 -0
- package/dist/core/yaml/src/splice-node.d.ts +47 -0
- package/dist/core/yaml/src/splice-node.js +333 -0
- package/dist/core/yaml/src/splice.d.ts +13 -0
- package/dist/core/yaml/src/splice.js +174 -0
- package/dist/core/yaml/src/unsupported.d.ts +26 -0
- package/dist/core/yaml/src/unsupported.js +70 -0
- package/dist/core/yaml/src/write.d.ts +35 -0
- package/dist/core/yaml/src/write.js +44 -0
- package/dist/testing/integration/src/canaries.d.ts +14 -0
- package/dist/testing/integration/src/canaries.js +17 -0
- package/dist/testing/integration/src/checks.d.ts +37 -0
- package/dist/testing/integration/src/checks.js +195 -0
- package/dist/testing/integration/src/describe.d.ts +35 -0
- package/dist/testing/integration/src/describe.js +74 -0
- package/dist/testing/integration/src/failure.d.ts +6 -0
- package/dist/testing/integration/src/failure.js +8 -0
- package/dist/testing/integration/src/fake-wait.d.ts +18 -0
- package/dist/testing/integration/src/fake-wait.js +21 -0
- package/dist/testing/integration/src/index.d.ts +10 -0
- package/dist/testing/integration/src/index.js +11 -0
- package/dist/testing/integration/src/load.d.ts +14 -0
- package/dist/testing/integration/src/load.js +47 -0
- package/dist/testing/integration/src/plugin-folder.d.ts +23 -0
- package/dist/testing/integration/src/plugin-folder.js +59 -0
- package/dist/testing/integration/src/plugin.d.ts +32 -0
- package/dist/testing/integration/src/plugin.js +57 -0
- package/dist/testing/integration/src/recording.d.ts +84 -0
- package/dist/testing/integration/src/recording.js +164 -0
- package/dist/testing/integration/src/run.d.ts +60 -0
- package/dist/testing/integration/src/run.js +81 -0
- package/dist/testing/integration/src/source-scan.d.ts +16 -0
- package/dist/testing/integration/src/source-scan.js +40 -0
- package/package.json +34 -3
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { CantTryStep, RunFailureReason, RunKind, RunStatus, RunTrigger, Usage } from "./run-basics.js";
|
|
2
|
+
/** A tool call a run is waiting on a person's OK for, from its `approval.requested` event. */
|
|
3
|
+
export interface PendingApproval {
|
|
4
|
+
/** The state's agent: the one that asked, or the one whose subagent asked. */
|
|
5
|
+
agent: string;
|
|
6
|
+
/**
|
|
7
|
+
* The subagent that asked, when it was one (requirement
|
|
8
|
+
* `events.agent-resume-inner`); absent when `agent` asked itself.
|
|
9
|
+
*/
|
|
10
|
+
subagent?: string;
|
|
11
|
+
tool: string;
|
|
12
|
+
args: unknown;
|
|
13
|
+
callId: string;
|
|
14
|
+
/** ISO time the approval was asked for. */
|
|
15
|
+
at: string;
|
|
16
|
+
/** The state whose agent asked. */
|
|
17
|
+
state: string;
|
|
18
|
+
/** The parallel branch that asked, or `null` outside a parallel state. */
|
|
19
|
+
branch: string | null;
|
|
20
|
+
/** The for-each item that asked (0-based), or `null` outside a for-each state. */
|
|
21
|
+
item: number | null;
|
|
22
|
+
}
|
|
23
|
+
/** A signal a run sent. `id` is "<runId>:<seq>" of its `signal.sent` event. */
|
|
24
|
+
export interface SentSignal {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
data: Record<string, unknown>;
|
|
28
|
+
at: string;
|
|
29
|
+
}
|
|
30
|
+
/** Summary of a run, derived from its events by {@link summarize}. */
|
|
31
|
+
export interface RunSummary {
|
|
32
|
+
id: string;
|
|
33
|
+
hubId: string;
|
|
34
|
+
workflowId: string;
|
|
35
|
+
kind: RunKind;
|
|
36
|
+
status: RunStatus;
|
|
37
|
+
state: string | null;
|
|
38
|
+
startedAt: string;
|
|
39
|
+
endedAt: string | null;
|
|
40
|
+
usage: Usage;
|
|
41
|
+
/** Sum of the priced model calls, in the budget currency. Subscription calls aren't in it. */
|
|
42
|
+
cost: number;
|
|
43
|
+
/** Model calls without a price (their cost is unknown). Subscription calls aren't counted here. */
|
|
44
|
+
unpricedCalls: number;
|
|
45
|
+
/**
|
|
46
|
+
* Model calls the person's own subscription paid for (`paidBy:
|
|
47
|
+
* "subscription"`). Their tokens are in `usage`; they have no price and
|
|
48
|
+
* are in neither `cost` nor `unpricedCalls`.
|
|
49
|
+
*/
|
|
50
|
+
subscriptionCalls: number;
|
|
51
|
+
statesVisited: string[];
|
|
52
|
+
context: Record<string, unknown>;
|
|
53
|
+
error: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Why the run failed, from its `run.failed` event. `null` while it hasn't
|
|
56
|
+
* failed, and for older logs whose `run.failed` gives no reason.
|
|
57
|
+
*/
|
|
58
|
+
reason: RunFailureReason | null;
|
|
59
|
+
definitionsVersion: string;
|
|
60
|
+
trigger: RunTrigger | null;
|
|
61
|
+
/** The run that started this one (subflows). */
|
|
62
|
+
parentRunId: string | null;
|
|
63
|
+
/** While waiting: the child run that waits (send events there, or here; they are passed on). */
|
|
64
|
+
waitingOn: string | null;
|
|
65
|
+
/** Events the run accepts while waiting. */
|
|
66
|
+
accepts: string[];
|
|
67
|
+
/**
|
|
68
|
+
* While waiting: event → the label the wait step's author gave that answer,
|
|
69
|
+
* for the events in `accepts` that have one. Show a label in place of its
|
|
70
|
+
* event name; `{}` when none has one, and in older logs.
|
|
71
|
+
*/
|
|
72
|
+
answerLabels: Record<string, string>;
|
|
73
|
+
/** While waiting: when the next timer is due (ISO), if the state has timers. */
|
|
74
|
+
nextTimer: string | null;
|
|
75
|
+
/**
|
|
76
|
+
* While waiting: the wait step's description, filled in, as its first line
|
|
77
|
+
* (`title`) and the rest (`body`); `null` when the step has none. The
|
|
78
|
+
* filled-in values can be model output: show them as plain text.
|
|
79
|
+
*/
|
|
80
|
+
waitingFor: {
|
|
81
|
+
title: string;
|
|
82
|
+
body: string;
|
|
83
|
+
} | null;
|
|
84
|
+
/** ISO time of the last `run.waiting`, kept after the run goes on; `null` if it never waited. */
|
|
85
|
+
lastWaitingAt: string | null;
|
|
86
|
+
/**
|
|
87
|
+
* The tool calls waiting for approval, oldest first. Parallel branches can
|
|
88
|
+
* each wait for one, so there can be more than one.
|
|
89
|
+
*/
|
|
90
|
+
approvals: PendingApproval[];
|
|
91
|
+
/** Signals the run sent, in order (for signal triggers). */
|
|
92
|
+
signals: SentSignal[];
|
|
93
|
+
/**
|
|
94
|
+
* The steps of a Try it or Test run that couldn't be tried, from
|
|
95
|
+
* `run.started`, a parallel branch's `agent.finished` and `run.cant-try`.
|
|
96
|
+
* Kept when a real failure ends the run as `failed`. `[]` for any other
|
|
97
|
+
* run, and in older logs.
|
|
98
|
+
*/
|
|
99
|
+
cantTry: CantTryStep[];
|
|
100
|
+
/**
|
|
101
|
+
* Sequence number of the run's last event. A writer appends after it, and a
|
|
102
|
+
* client subscribes from it. Not in the old summary; derived, so the run
|
|
103
|
+
* log doesn't change.
|
|
104
|
+
*/
|
|
105
|
+
lastSeq: number;
|
|
106
|
+
/** ISO time of the run's last event, so a watchdog can find runs that stopped moving. */
|
|
107
|
+
updatedAt: string;
|
|
108
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An access a step's sandbox refused, as the `Sandbox` port reports it: a
|
|
3
|
+
* file read or write, or a connection to a site. A copy of the port's
|
|
4
|
+
* `SandboxBlock`, so this package doesn't depend on the ports.
|
|
5
|
+
*/
|
|
6
|
+
export type SandboxBlock = {
|
|
7
|
+
kind: "file";
|
|
8
|
+
path: string;
|
|
9
|
+
access: "read" | "write";
|
|
10
|
+
} | {
|
|
11
|
+
kind: "network";
|
|
12
|
+
host: string;
|
|
13
|
+
port: number | null;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* What a `sandbox.blocked` event names: one blocked target, or `others`, the
|
|
17
|
+
* blocked accesses to the targets past the ones a step's log names.
|
|
18
|
+
*/
|
|
19
|
+
export type LoggedSandboxBlock = SandboxBlock | {
|
|
20
|
+
kind: "others";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The most distinct targets one step's run log names in `sandbox.blocked`
|
|
24
|
+
* events. Blocks of further targets are counted in one `others` event, so a
|
|
25
|
+
* program that tries many files can't flood the log.
|
|
26
|
+
*/
|
|
27
|
+
export declare const maxBlockedTargetsPerStep = 100;
|
|
28
|
+
/**
|
|
29
|
+
* Makes the copy of a blocked access that a `sandbox.blocked` event carries
|
|
30
|
+
* (requirement `events.sandbox-blocked`): a file path in the person's home
|
|
31
|
+
* folder starts with `~`, the way `sandbox.opened` writes paths. A site is
|
|
32
|
+
* copied as it is.
|
|
33
|
+
*
|
|
34
|
+
* @param block - the access the sandbox refused
|
|
35
|
+
* @param home - the person's home folder, or `null` when it is unknown
|
|
36
|
+
* @returns the block for the event
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* sandboxBlockedView({ kind: "file", path: "<home>/.ssh/id_ed25519", access: "read" }, "<home>");
|
|
40
|
+
* // => { kind: "file", path: "~/.ssh/id_ed25519", access: "read" }
|
|
41
|
+
*/
|
|
42
|
+
export declare function sandboxBlockedView(block: SandboxBlock, home: string | null): SandboxBlock;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { shortenHome } from "./home-path.js";
|
|
2
|
+
/**
|
|
3
|
+
* The most distinct targets one step's run log names in `sandbox.blocked`
|
|
4
|
+
* events. Blocks of further targets are counted in one `others` event, so a
|
|
5
|
+
* program that tries many files can't flood the log.
|
|
6
|
+
*/
|
|
7
|
+
export const maxBlockedTargetsPerStep = 100;
|
|
8
|
+
/**
|
|
9
|
+
* Makes the copy of a blocked access that a `sandbox.blocked` event carries
|
|
10
|
+
* (requirement `events.sandbox-blocked`): a file path in the person's home
|
|
11
|
+
* folder starts with `~`, the way `sandbox.opened` writes paths. A site is
|
|
12
|
+
* copied as it is.
|
|
13
|
+
*
|
|
14
|
+
* @param block - the access the sandbox refused
|
|
15
|
+
* @param home - the person's home folder, or `null` when it is unknown
|
|
16
|
+
* @returns the block for the event
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* sandboxBlockedView({ kind: "file", path: "<home>/.ssh/id_ed25519", access: "read" }, "<home>");
|
|
20
|
+
* // => { kind: "file", path: "~/.ssh/id_ed25519", access: "read" }
|
|
21
|
+
*/
|
|
22
|
+
export function sandboxBlockedView(block, home) {
|
|
23
|
+
if (block.kind === "network")
|
|
24
|
+
return { kind: "network", host: block.host, port: block.port };
|
|
25
|
+
return { kind: "file", path: shortenHome(block.path, home), access: block.access };
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type SandboxOpenedView } from "./sandbox-opened.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reads the `sandbox` of a stored `sandbox.opened` event (requirement
|
|
4
|
+
* `events.sandbox-opened`). It never throws: a value that is damaged, from
|
|
5
|
+
* another version or missing a field gives `null`, so a screen says it
|
|
6
|
+
* couldn't read what the step could do instead of showing part of it. It
|
|
7
|
+
* copies only the view's fields, so an extra field in a damaged log never
|
|
8
|
+
* reaches a screen either.
|
|
9
|
+
*
|
|
10
|
+
* @param value - the event's `sandbox`, as parsed from the log
|
|
11
|
+
* @returns the view, or `null` when it can't be read
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* readSandboxOpened({ strength: "os", workingFolder: "~/work", ... }); // => { strength: "os", ... }
|
|
15
|
+
* readSandboxOpened("damaged"); // => null
|
|
16
|
+
*/
|
|
17
|
+
export declare function readSandboxOpened(value: unknown): SandboxOpenedView | null;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { deniedPathGroupCodes, } from "./sandbox-opened.js";
|
|
2
|
+
const strengths = ["os", "vm", "remote"];
|
|
3
|
+
const groupCodes = deniedPathGroupCodes;
|
|
4
|
+
/** A list of strings, or `null` when the value is anything else. */
|
|
5
|
+
function stringsOf(value) {
|
|
6
|
+
if (!Array.isArray(value))
|
|
7
|
+
return null;
|
|
8
|
+
if (!value.every((item) => typeof item === "string"))
|
|
9
|
+
return null;
|
|
10
|
+
return [...value];
|
|
11
|
+
}
|
|
12
|
+
/** A list of group codes, or `null` when the value holds anything else. */
|
|
13
|
+
function groupCodesOf(value) {
|
|
14
|
+
const codes = stringsOf(value);
|
|
15
|
+
if (codes === null)
|
|
16
|
+
return null;
|
|
17
|
+
if (!codes.every((code) => groupCodes.includes(code)))
|
|
18
|
+
return null;
|
|
19
|
+
return codes;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reads the `sandbox` of a stored `sandbox.opened` event (requirement
|
|
23
|
+
* `events.sandbox-opened`). It never throws: a value that is damaged, from
|
|
24
|
+
* another version or missing a field gives `null`, so a screen says it
|
|
25
|
+
* couldn't read what the step could do instead of showing part of it. It
|
|
26
|
+
* copies only the view's fields, so an extra field in a damaged log never
|
|
27
|
+
* reaches a screen either.
|
|
28
|
+
*
|
|
29
|
+
* @param value - the event's `sandbox`, as parsed from the log
|
|
30
|
+
* @returns the view, or `null` when it can't be read
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* readSandboxOpened({ strength: "os", workingFolder: "~/work", ... }); // => { strength: "os", ... }
|
|
34
|
+
* readSandboxOpened("damaged"); // => null
|
|
35
|
+
*/
|
|
36
|
+
export function readSandboxOpened(value) {
|
|
37
|
+
if (typeof value !== "object" || value === null)
|
|
38
|
+
return null;
|
|
39
|
+
const fields = value;
|
|
40
|
+
const { strength, workingFolder, timeLimitMs } = fields;
|
|
41
|
+
const readOnlyPaths = stringsOf(fields.readOnlyPaths);
|
|
42
|
+
const deniedGroups = groupCodesOf(fields.deniedGroups);
|
|
43
|
+
const deniedPaths = stringsOf(fields.deniedPaths);
|
|
44
|
+
const allowedSites = stringsOf(fields.allowedSites);
|
|
45
|
+
if (!strengths.includes(strength) || typeof workingFolder !== "string")
|
|
46
|
+
return null;
|
|
47
|
+
if (typeof timeLimitMs !== "number" || !Number.isFinite(timeLimitMs) || timeLimitMs < 0) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (readOnlyPaths === null || deniedGroups === null)
|
|
51
|
+
return null;
|
|
52
|
+
if (deniedPaths === null || allowedSites === null)
|
|
53
|
+
return null;
|
|
54
|
+
return {
|
|
55
|
+
strength: strength,
|
|
56
|
+
workingFolder,
|
|
57
|
+
readOnlyPaths,
|
|
58
|
+
deniedGroups,
|
|
59
|
+
deniedPaths,
|
|
60
|
+
allowedSites,
|
|
61
|
+
timeLimitMs,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How strong a sandbox's fence is, as the `Sandbox` port's `capabilities()`
|
|
3
|
+
* gives it: `os` (the operating system confines the program), `vm` (a
|
|
4
|
+
* micro-VM) or `remote` (another machine).
|
|
5
|
+
*/
|
|
6
|
+
export type SandboxStrength = "os" | "vm" | "remote";
|
|
7
|
+
/**
|
|
8
|
+
* The codes of the groups of paths a sandbox denies: the person's SSH keys,
|
|
9
|
+
* their cloud sign-ins, browser data, password stores, Halonic's own data and
|
|
10
|
+
* other agents' settings (such as `~/.claude`). One list, so the profile
|
|
11
|
+
* builder, the run log and the screens name the same groups. Screens word
|
|
12
|
+
* each code through the message catalogue.
|
|
13
|
+
*/
|
|
14
|
+
export declare const deniedPathGroupCodes: readonly ["ssh-keys", "cloud-sign-ins", "browser-data", "password-stores", "halonic-data", "agent-settings"];
|
|
15
|
+
/** A group of denied paths: one of {@link deniedPathGroupCodes}. */
|
|
16
|
+
export type DeniedPathGroupCode = (typeof deniedPathGroupCodes)[number];
|
|
17
|
+
/**
|
|
18
|
+
* What a sandboxed step can do, as a `sandbox.opened` event records it. It is
|
|
19
|
+
* a display copy of the step's sandbox profile, made by
|
|
20
|
+
* {@link sandboxOpenedView}, so a finished run still shows it. It never holds
|
|
21
|
+
* the profile's environment variables or any field not named here.
|
|
22
|
+
*/
|
|
23
|
+
export interface SandboxOpenedView {
|
|
24
|
+
/** How strong the fence is. */
|
|
25
|
+
strength: SandboxStrength;
|
|
26
|
+
/**
|
|
27
|
+
* The step's working folder. Paths in the person's home folder start with
|
|
28
|
+
* `~`. Its own temp folder and settings folder are writable too, but the
|
|
29
|
+
* screens never show their paths, so the view leaves them out.
|
|
30
|
+
*/
|
|
31
|
+
workingFolder: string;
|
|
32
|
+
/** Paths the step may read but not change. */
|
|
33
|
+
readOnlyPaths: string[];
|
|
34
|
+
/** The codes of the groups of denied paths, in the order the groups were given. */
|
|
35
|
+
deniedGroups: DeniedPathGroupCode[];
|
|
36
|
+
/** The denied paths that are in no group: the ones the person added. */
|
|
37
|
+
deniedPaths: string[];
|
|
38
|
+
/** The sites the step may reach, besides the Halonic bridge when the profile has one. */
|
|
39
|
+
allowedSites: string[];
|
|
40
|
+
/** How long the step may last, in milliseconds. */
|
|
41
|
+
timeLimitMs: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The parts of a sandbox profile that {@link sandboxOpenedView} reads. The
|
|
45
|
+
* `Sandbox` port's `SandboxProfile` fits it; its other fields, such as `env`,
|
|
46
|
+
* are never read.
|
|
47
|
+
*/
|
|
48
|
+
export interface ShownSandboxProfile {
|
|
49
|
+
workingFolder: string;
|
|
50
|
+
readOnlyPaths: readonly string[];
|
|
51
|
+
deniedPaths: readonly string[];
|
|
52
|
+
network: {
|
|
53
|
+
allowedSites: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
timeLimitMs: number;
|
|
56
|
+
}
|
|
57
|
+
/** A named group of denied paths, such as the person's SSH keys. */
|
|
58
|
+
export interface DeniedPathGroup {
|
|
59
|
+
/** Which group it is. Screens show it through the message catalogue. */
|
|
60
|
+
code: DeniedPathGroupCode;
|
|
61
|
+
/** The paths of the group, absolute, as they are in the profile. */
|
|
62
|
+
paths: readonly string[];
|
|
63
|
+
}
|
|
64
|
+
/** What {@link sandboxOpenedView} needs besides the profile. */
|
|
65
|
+
export interface SandboxOpenedOptions {
|
|
66
|
+
/** The sandbox's strength, from its `capabilities()`. */
|
|
67
|
+
strength: SandboxStrength;
|
|
68
|
+
/** The person's home folder, or `null` when it is unknown. Paths in it are shortened to `~`. */
|
|
69
|
+
home: string | null;
|
|
70
|
+
/** The groups the profile's denied paths were built from. */
|
|
71
|
+
deniedGroups: readonly DeniedPathGroup[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Makes the display copy of a sandbox profile that a `sandbox.opened` event
|
|
75
|
+
* carries (requirement `events.sandbox-opened`). It copies a fixed list of
|
|
76
|
+
* fields and nothing else, so the profile's `env`, its temp and settings
|
|
77
|
+
* folders and any field added later never reach the run log. A group is named when it has paths and all of them
|
|
78
|
+
* are denied, so a group with no paths never claims something was blocked;
|
|
79
|
+
* the denied paths outside the named groups are listed one by one. Paths in
|
|
80
|
+
* the person's home folder start with `~`.
|
|
81
|
+
*
|
|
82
|
+
* @param profile - the step's sandbox profile
|
|
83
|
+
* @param options - the sandbox's strength, the home folder and the groups of denied paths
|
|
84
|
+
* @returns the view for the event
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* sandboxOpenedView(profile, {
|
|
88
|
+
* strength: "os",
|
|
89
|
+
* home: "<home>",
|
|
90
|
+
* deniedGroups: [{ code: "ssh-keys", paths: ["<home>/.ssh"] }],
|
|
91
|
+
* });
|
|
92
|
+
* // => { strength: "os", workingFolder: "~/work", deniedGroups: ["ssh-keys"], ... }
|
|
93
|
+
*/
|
|
94
|
+
export declare function sandboxOpenedView(profile: ShownSandboxProfile, options: SandboxOpenedOptions): SandboxOpenedView;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { shortenHome } from "./home-path.js";
|
|
2
|
+
/**
|
|
3
|
+
* The codes of the groups of paths a sandbox denies: the person's SSH keys,
|
|
4
|
+
* their cloud sign-ins, browser data, password stores, Halonic's own data and
|
|
5
|
+
* other agents' settings (such as `~/.claude`). One list, so the profile
|
|
6
|
+
* builder, the run log and the screens name the same groups. Screens word
|
|
7
|
+
* each code through the message catalogue.
|
|
8
|
+
*/
|
|
9
|
+
export const deniedPathGroupCodes = [
|
|
10
|
+
"ssh-keys",
|
|
11
|
+
"cloud-sign-ins",
|
|
12
|
+
"browser-data",
|
|
13
|
+
"password-stores",
|
|
14
|
+
"halonic-data",
|
|
15
|
+
"agent-settings",
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Makes the display copy of a sandbox profile that a `sandbox.opened` event
|
|
19
|
+
* carries (requirement `events.sandbox-opened`). It copies a fixed list of
|
|
20
|
+
* fields and nothing else, so the profile's `env`, its temp and settings
|
|
21
|
+
* folders and any field added later never reach the run log. A group is named when it has paths and all of them
|
|
22
|
+
* are denied, so a group with no paths never claims something was blocked;
|
|
23
|
+
* the denied paths outside the named groups are listed one by one. Paths in
|
|
24
|
+
* the person's home folder start with `~`.
|
|
25
|
+
*
|
|
26
|
+
* @param profile - the step's sandbox profile
|
|
27
|
+
* @param options - the sandbox's strength, the home folder and the groups of denied paths
|
|
28
|
+
* @returns the view for the event
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* sandboxOpenedView(profile, {
|
|
32
|
+
* strength: "os",
|
|
33
|
+
* home: "<home>",
|
|
34
|
+
* deniedGroups: [{ code: "ssh-keys", paths: ["<home>/.ssh"] }],
|
|
35
|
+
* });
|
|
36
|
+
* // => { strength: "os", workingFolder: "~/work", deniedGroups: ["ssh-keys"], ... }
|
|
37
|
+
*/
|
|
38
|
+
export function sandboxOpenedView(profile, options) {
|
|
39
|
+
const shorten = (path) => shortenHome(path, options.home);
|
|
40
|
+
const denied = new Set(profile.deniedPaths);
|
|
41
|
+
const named = options.deniedGroups.filter((group) => group.paths.length > 0 && group.paths.every((path) => denied.has(path)));
|
|
42
|
+
const inNamedGroup = new Set(named.flatMap((group) => group.paths));
|
|
43
|
+
return {
|
|
44
|
+
strength: options.strength,
|
|
45
|
+
workingFolder: shorten(profile.workingFolder),
|
|
46
|
+
readOnlyPaths: profile.readOnlyPaths.map(shorten),
|
|
47
|
+
deniedGroups: named.map((group) => group.code),
|
|
48
|
+
deniedPaths: [...denied].filter((path) => !inNamedGroup.has(path)).map(shorten),
|
|
49
|
+
allowedSites: [...profile.network.allowedSites],
|
|
50
|
+
timeLimitMs: profile.timeLimitMs,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RunEvent } from "./run-event.js";
|
|
2
|
+
import type { RunSummary } from "./run-summary.js";
|
|
3
|
+
/**
|
|
4
|
+
* Fold a run's event stream into its summary. Pure; every run store uses it,
|
|
5
|
+
* so all of them report a run the same way.
|
|
6
|
+
*
|
|
7
|
+
* @param events - the run's events, oldest first
|
|
8
|
+
* @returns the summary, or `null` when the stream doesn't start with `run.started`
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const summary = summarize(await runStore.events(runId));
|
|
12
|
+
* if (summary?.status === "waiting") showButtons(summary.accepts);
|
|
13
|
+
*/
|
|
14
|
+
export declare function summarize(events: readonly RunEvent[]): RunSummary | null;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { addUsage } from "./add-usage.js";
|
|
2
|
+
import { upgradeEvent } from "./upgrade.js";
|
|
3
|
+
/**
|
|
4
|
+
* Fold a run's event stream into its summary. Pure; every run store uses it,
|
|
5
|
+
* so all of them report a run the same way.
|
|
6
|
+
*
|
|
7
|
+
* @param events - the run's events, oldest first
|
|
8
|
+
* @returns the summary, or `null` when the stream doesn't start with `run.started`
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const summary = summarize(await runStore.events(runId));
|
|
12
|
+
* if (summary?.status === "waiting") showButtons(summary.accepts);
|
|
13
|
+
*/
|
|
14
|
+
export function summarize(events) {
|
|
15
|
+
const firstEvent = events[0];
|
|
16
|
+
if (firstEvent === undefined)
|
|
17
|
+
return null;
|
|
18
|
+
const first = upgradeEvent(firstEvent);
|
|
19
|
+
if (first.type !== "run.started")
|
|
20
|
+
return null;
|
|
21
|
+
const summary = {
|
|
22
|
+
id: first.runId,
|
|
23
|
+
hubId: first.hubId,
|
|
24
|
+
workflowId: first.workflowId,
|
|
25
|
+
kind: first.kind,
|
|
26
|
+
status: "running",
|
|
27
|
+
state: null,
|
|
28
|
+
startedAt: first.at,
|
|
29
|
+
endedAt: null,
|
|
30
|
+
usage: { inputTokens: 0, outputTokens: 0 },
|
|
31
|
+
cost: 0,
|
|
32
|
+
unpricedCalls: 0,
|
|
33
|
+
subscriptionCalls: 0,
|
|
34
|
+
statesVisited: [],
|
|
35
|
+
context: {},
|
|
36
|
+
error: null,
|
|
37
|
+
reason: null,
|
|
38
|
+
definitionsVersion: first.definitionsVersion,
|
|
39
|
+
trigger: first.trigger ?? null,
|
|
40
|
+
parentRunId: first.parent?.runId ?? null,
|
|
41
|
+
waitingOn: null,
|
|
42
|
+
accepts: [],
|
|
43
|
+
answerLabels: {},
|
|
44
|
+
nextTimer: null,
|
|
45
|
+
waitingFor: null,
|
|
46
|
+
lastWaitingAt: null,
|
|
47
|
+
approvals: [],
|
|
48
|
+
signals: [],
|
|
49
|
+
cantTry: [...(first.cantTry ?? [])],
|
|
50
|
+
lastSeq: first.seq,
|
|
51
|
+
updatedAt: first.at,
|
|
52
|
+
};
|
|
53
|
+
for (const event of events) {
|
|
54
|
+
applyEvent(summary, event);
|
|
55
|
+
summary.lastSeq = event.seq;
|
|
56
|
+
summary.updatedAt = event.at;
|
|
57
|
+
}
|
|
58
|
+
return summary;
|
|
59
|
+
}
|
|
60
|
+
/** Update the summary in place with one event. Events that change nothing are skipped. */
|
|
61
|
+
function applyEvent(summary, event) {
|
|
62
|
+
switch (event.type) {
|
|
63
|
+
case "state.entered":
|
|
64
|
+
summary.state = event.state;
|
|
65
|
+
summary.statesVisited.push(event.state);
|
|
66
|
+
if (summary.status === "waiting")
|
|
67
|
+
summary.status = "running";
|
|
68
|
+
return;
|
|
69
|
+
case "llm.response":
|
|
70
|
+
addModelCall(summary, event);
|
|
71
|
+
return;
|
|
72
|
+
case "context.updated":
|
|
73
|
+
summary.context[event.key] = event.value;
|
|
74
|
+
return;
|
|
75
|
+
case "run.waiting":
|
|
76
|
+
summary.status = "waiting";
|
|
77
|
+
summary.waitingOn = event.child ?? null;
|
|
78
|
+
summary.accepts = event.events;
|
|
79
|
+
summary.answerLabels = { ...event.labels };
|
|
80
|
+
summary.nextTimer = earliestTimer(event.timers);
|
|
81
|
+
summary.waitingFor =
|
|
82
|
+
event.title === undefined && event.body === undefined
|
|
83
|
+
? null
|
|
84
|
+
: { title: event.title ?? "", body: event.body ?? "" };
|
|
85
|
+
summary.lastWaitingAt = event.at;
|
|
86
|
+
return;
|
|
87
|
+
case "signal.sent":
|
|
88
|
+
summary.signals.push({
|
|
89
|
+
id: `${event.runId}:${event.seq}`,
|
|
90
|
+
name: event.name,
|
|
91
|
+
data: event.data,
|
|
92
|
+
at: event.at,
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
case "approval.requested":
|
|
96
|
+
summary.approvals.push(pendingApproval(event));
|
|
97
|
+
return;
|
|
98
|
+
case "approval.resolved":
|
|
99
|
+
removeApproval(summary.approvals, event.callId);
|
|
100
|
+
return;
|
|
101
|
+
case "agent.finished":
|
|
102
|
+
if (event.cantTry !== undefined)
|
|
103
|
+
summary.cantTry.push(event.cantTry);
|
|
104
|
+
return;
|
|
105
|
+
case "event.received":
|
|
106
|
+
case "workflow.finished":
|
|
107
|
+
case "workflow.resumed":
|
|
108
|
+
case "timer.fired":
|
|
109
|
+
summary.status = "running";
|
|
110
|
+
summary.waitingOn = null;
|
|
111
|
+
summary.accepts = [];
|
|
112
|
+
summary.answerLabels = {};
|
|
113
|
+
summary.nextTimer = null;
|
|
114
|
+
summary.waitingFor = null;
|
|
115
|
+
return;
|
|
116
|
+
case "run.completed":
|
|
117
|
+
summary.status = "completed";
|
|
118
|
+
summary.endedAt = event.at;
|
|
119
|
+
summary.context = event.context;
|
|
120
|
+
summary.approvals = [];
|
|
121
|
+
return;
|
|
122
|
+
case "run.failed":
|
|
123
|
+
// A run cancelled or stopped by its budget while it waited ends its
|
|
124
|
+
// approvals without an `approval.resolved`: nobody decided them.
|
|
125
|
+
summary.status = "failed";
|
|
126
|
+
summary.endedAt = event.at;
|
|
127
|
+
summary.error = event.error;
|
|
128
|
+
summary.reason = event.reason ?? null;
|
|
129
|
+
summary.approvals = [];
|
|
130
|
+
return;
|
|
131
|
+
case "run.cant-try":
|
|
132
|
+
summary.status = "cant-try";
|
|
133
|
+
summary.endedAt = event.at;
|
|
134
|
+
summary.cantTry = event.cantTry;
|
|
135
|
+
summary.approvals = [];
|
|
136
|
+
return;
|
|
137
|
+
default:
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** The tool call an `approval.requested` asks about, as the summary lists it. */
|
|
142
|
+
function pendingApproval(event) {
|
|
143
|
+
return {
|
|
144
|
+
agent: event.agent,
|
|
145
|
+
...(event.subagent === undefined ? {} : { subagent: event.subagent }),
|
|
146
|
+
tool: event.tool,
|
|
147
|
+
args: event.args,
|
|
148
|
+
callId: event.callId,
|
|
149
|
+
at: event.at,
|
|
150
|
+
state: event.state,
|
|
151
|
+
branch: event.branch ?? null,
|
|
152
|
+
item: event.item ?? null,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Remove the waiting approval with this call id. The engine makes call ids
|
|
157
|
+
* unique in a run; older logs asked for one approval at a time, so the first
|
|
158
|
+
* match is the one being resolved.
|
|
159
|
+
*/
|
|
160
|
+
function removeApproval(approvals, callId) {
|
|
161
|
+
const index = approvals.findIndex((approval) => approval.callId === callId);
|
|
162
|
+
if (index !== -1)
|
|
163
|
+
approvals.splice(index, 1);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Add one model call's tokens, and its cost when it has a price. A call the
|
|
167
|
+
* person's subscription paid for is counted on its own, never priced. An
|
|
168
|
+
* answer from the cache made no model call, so it adds nothing at all.
|
|
169
|
+
*/
|
|
170
|
+
function addModelCall(summary, call) {
|
|
171
|
+
if (call.cached === true)
|
|
172
|
+
return;
|
|
173
|
+
summary.usage = addUsage(summary.usage, call.usage);
|
|
174
|
+
if (call.paidBy === "subscription")
|
|
175
|
+
summary.subscriptionCalls++;
|
|
176
|
+
else if (call.cost === undefined)
|
|
177
|
+
summary.unpricedCalls++;
|
|
178
|
+
else
|
|
179
|
+
summary.cost += call.cost;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The earliest due time of a wait state's timers, or `null` when it has none.
|
|
183
|
+
* ISO times in the same format sort as text, which is how the old code compared them.
|
|
184
|
+
*/
|
|
185
|
+
function earliestTimer(timers) {
|
|
186
|
+
let earliest = null;
|
|
187
|
+
for (const timer of timers ?? []) {
|
|
188
|
+
if (earliest === null || timer.at < earliest)
|
|
189
|
+
earliest = timer.at;
|
|
190
|
+
}
|
|
191
|
+
return earliest;
|
|
192
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RunEvent } from "./run-event.js";
|
|
2
|
+
/**
|
|
3
|
+
* The timeline entry of each event of a run log: the `seq` of the event that
|
|
4
|
+
* opened the entry. An event that has `entry` keeps it. For a log written
|
|
5
|
+
* before the field existed, an event that finishes or updates an entry (such
|
|
6
|
+
* as `agent.finished`) gets the `seq` of the latest still-open event that
|
|
7
|
+
* opened it, with the same branch, item and matching fields; every other
|
|
8
|
+
* event opens an entry of its own. The engine writes `entry` by the same
|
|
9
|
+
* rules, so an old log and a new log of the same run give the same entries.
|
|
10
|
+
*
|
|
11
|
+
* @param events - one run's log, in `seq` order
|
|
12
|
+
* @returns the entry of each event, in the same order as `events`
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* entryOf([
|
|
16
|
+
* { seq: 1, type: "agent.started", state: "s", agent: "a", ... },
|
|
17
|
+
* { seq: 2, type: "agent.finished", state: "s", agent: "a", ... },
|
|
18
|
+
* ]);
|
|
19
|
+
* // => [1, 1]
|
|
20
|
+
*/
|
|
21
|
+
export declare function entryOf(events: readonly RunEvent[]): number[];
|