voratiq 0.1.0-beta.2 → 0.1.0-beta.21
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/README.md +41 -29
- package/dist/agents/launch/chat.d.ts +23 -0
- package/dist/agents/launch/chat.js +44 -0
- package/dist/agents/launch/environment.d.ts +8 -0
- package/dist/{commands/run/agents/workspace-prep.js → agents/launch/environment.js} +5 -27
- package/dist/agents/launch/prompt.d.ts +6 -0
- package/dist/agents/launch/prompt.js +12 -0
- package/dist/agents/launch/provider-state.d.ts +39 -0
- package/dist/agents/launch/provider-state.js +103 -0
- package/dist/agents/runtime/auth.d.ts +27 -0
- package/dist/agents/runtime/auth.js +72 -0
- package/dist/agents/runtime/chat.d.ts +5 -0
- package/dist/agents/runtime/chat.js +7 -0
- package/dist/agents/runtime/errors.d.ts +27 -0
- package/dist/agents/runtime/errors.js +51 -0
- package/dist/{commands/run/agents → agents/runtime}/failures.d.ts +0 -1
- package/dist/agents/runtime/failures.js +136 -0
- package/dist/agents/runtime/harness.d.ts +2 -0
- package/dist/agents/runtime/harness.js +119 -0
- package/dist/{commands/run/agents/sandbox-launcher.d.ts → agents/runtime/launcher.d.ts} +18 -6
- package/dist/{commands/run/agents/sandbox-launcher.js → agents/runtime/launcher.js} +17 -39
- package/dist/{commands/run/agents/workspace-prep.d.ts → agents/runtime/manifest.d.ts} +6 -6
- package/dist/agents/runtime/manifest.js +34 -0
- package/dist/agents/runtime/policy.d.ts +32 -0
- package/dist/agents/runtime/policy.js +240 -0
- package/dist/agents/runtime/registry.d.ts +4 -0
- package/dist/agents/runtime/registry.js +54 -0
- package/dist/{commands/run → agents/runtime}/sandbox.d.ts +8 -2
- package/dist/{commands/run → agents/runtime}/sandbox.js +28 -67
- package/dist/agents/runtime/shim/run-agent-shim.d.ts +1 -0
- package/dist/agents/runtime/shim/run-agent-shim.js +276 -0
- package/dist/agents/runtime/types.d.ts +91 -0
- package/dist/{commands/run/agents → agents/runtime}/watchdog.d.ts +4 -3
- package/dist/{commands/run/agents → agents/runtime}/watchdog.js +155 -26
- package/dist/auth/providers/codex.js +7 -2
- package/dist/auth/providers/gemini.js +14 -6
- package/dist/auth/providers/types.d.ts +1 -0
- package/dist/auth/providers/utils.d.ts +0 -1
- package/dist/auth/providers/utils.js +1 -49
- package/dist/bin.js +369 -71
- package/dist/cli/apply.d.ts +4 -0
- package/dist/cli/apply.js +28 -9
- package/dist/cli/auto.d.ts +32 -0
- package/dist/cli/auto.js +232 -0
- package/dist/cli/contract.d.ts +328 -0
- package/dist/cli/contract.js +480 -0
- package/dist/cli/errors.d.ts +3 -0
- package/dist/cli/errors.js +21 -3
- package/dist/cli/init.d.ts +5 -0
- package/dist/cli/init.js +34 -6
- package/dist/cli/list.d.ts +6 -4
- package/dist/cli/list.js +39 -16
- package/dist/cli/mcp.d.ts +2 -0
- package/dist/cli/mcp.js +16 -0
- package/dist/cli/message.d.ts +28 -0
- package/dist/cli/message.js +147 -0
- package/dist/cli/operator-envelope.d.ts +180 -0
- package/dist/cli/operator-envelope.js +425 -0
- package/dist/cli/output.d.ts +15 -1
- package/dist/cli/output.js +153 -5
- package/dist/cli/prune.d.ts +7 -3
- package/dist/cli/prune.js +57 -12
- package/dist/cli/reduce.d.ts +29 -0
- package/dist/cli/reduce.js +211 -0
- package/dist/cli/root-launcher.d.ts +4 -0
- package/dist/cli/root-launcher.js +15 -0
- package/dist/cli/run.d.ts +27 -1
- package/dist/cli/run.js +108 -16
- package/dist/cli/spec.d.ts +31 -0
- package/dist/cli/spec.js +180 -0
- package/dist/cli/verify.d.ts +35 -0
- package/dist/cli/verify.js +297 -0
- package/dist/commands/apply/command.d.ts +2 -0
- package/dist/commands/apply/command.js +145 -6
- package/dist/commands/apply/errors.d.ts +43 -4
- package/dist/commands/apply/errors.js +100 -22
- package/dist/commands/apply/types.d.ts +2 -1
- package/dist/commands/auto/command.d.ts +145 -0
- package/dist/commands/auto/command.js +433 -0
- package/dist/commands/auto/errors.d.ts +19 -0
- package/dist/commands/auto/errors.js +19 -0
- package/dist/commands/auto/validation.d.ts +14 -0
- package/dist/commands/auto/validation.js +90 -0
- package/dist/commands/fetch.d.ts +2 -2
- package/dist/commands/fetch.js +4 -4
- package/dist/commands/init/agents.d.ts +2 -1
- package/dist/commands/init/agents.js +66 -63
- package/dist/commands/init/command.js +300 -16
- package/dist/commands/init/types.d.ts +18 -7
- package/dist/commands/interactive/lifecycle.d.ts +15 -0
- package/dist/commands/interactive/lifecycle.js +141 -0
- package/dist/commands/list/command.d.ts +10 -3
- package/dist/commands/list/command.js +597 -40
- package/dist/commands/message/command.d.ts +23 -0
- package/dist/commands/message/command.js +215 -0
- package/dist/commands/message/errors.d.ts +9 -0
- package/dist/commands/message/errors.js +20 -0
- package/dist/commands/message/lifecycle.d.ts +14 -0
- package/dist/commands/message/lifecycle.js +128 -0
- package/dist/commands/prune/command.d.ts +2 -1
- package/dist/commands/prune/command.js +61 -10
- package/dist/commands/prune/errors.d.ts +1 -1
- package/dist/commands/prune/errors.js +5 -5
- package/dist/commands/prune/types.d.ts +21 -0
- package/dist/commands/reduce/command.d.ts +26 -0
- package/dist/commands/reduce/command.js +145 -0
- package/dist/commands/reduce/errors.d.ts +17 -0
- package/dist/commands/reduce/errors.js +32 -0
- package/dist/commands/reduce/targets.d.ts +11 -0
- package/dist/commands/reduce/targets.js +271 -0
- package/dist/commands/root-launcher/command.d.ts +31 -0
- package/dist/commands/root-launcher/command.js +233 -0
- package/dist/commands/run/command.d.ts +6 -1
- package/dist/commands/run/command.js +70 -40
- package/dist/commands/run/lifecycle.d.ts +7 -5
- package/dist/commands/run/lifecycle.js +45 -23
- package/dist/commands/run/record-init.d.ts +4 -1
- package/dist/commands/run/record-init.js +5 -2
- package/dist/commands/run/shim/run-agent-shim.d.ts +2 -1
- package/dist/commands/run/shim/run-agent-shim.js +4 -219
- package/dist/commands/run/validation.d.ts +2 -3
- package/dist/commands/run/validation.js +54 -25
- package/dist/commands/shared/max-parallel.d.ts +5 -0
- package/dist/commands/shared/max-parallel.js +15 -0
- package/dist/commands/shared/preview.d.ts +10 -0
- package/dist/commands/shared/preview.js +60 -0
- package/dist/commands/shared/resolve-reduction-competitors.d.ts +15 -0
- package/dist/commands/shared/resolve-reduction-competitors.js +13 -0
- package/dist/commands/shared/resolve-stage-competitors.d.ts +19 -0
- package/dist/commands/shared/resolve-stage-competitors.js +171 -0
- package/dist/commands/shared/session-id.d.ts +1 -0
- package/dist/commands/shared/session-id.js +1 -0
- package/dist/commands/spec/command.d.ts +22 -0
- package/dist/commands/spec/command.js +330 -0
- package/dist/commands/spec/errors.d.ts +11 -0
- package/dist/commands/spec/errors.js +23 -0
- package/dist/commands/verify/agents.d.ts +8 -0
- package/dist/commands/verify/agents.js +29 -0
- package/dist/commands/verify/command.d.ts +23 -0
- package/dist/commands/verify/command.js +168 -0
- package/dist/commands/verify/lifecycle.d.ts +14 -0
- package/dist/commands/verify/lifecycle.js +229 -0
- package/dist/commands/verify/max-parallel.d.ts +7 -0
- package/dist/commands/verify/max-parallel.js +15 -0
- package/dist/commands/verify/targets.d.ts +18 -0
- package/dist/commands/verify/targets.js +420 -0
- package/dist/competition/command-adapter.d.ts +35 -0
- package/dist/competition/command-adapter.js +20 -0
- package/dist/competition/core.d.ts +41 -0
- package/dist/competition/core.js +181 -0
- package/dist/competition/shared/extra-context.d.ts +14 -0
- package/dist/competition/shared/extra-context.js +100 -0
- package/dist/competition/shared/preflight.d.ts +11 -0
- package/dist/competition/shared/preflight.js +39 -0
- package/dist/competition/shared/prompt-helpers.d.ts +16 -0
- package/dist/competition/shared/prompt-helpers.js +27 -0
- package/dist/competition/shared/prune.d.ts +1 -0
- package/dist/competition/shared/prune.js +4 -0
- package/dist/competition/shared/sandbox-policy.d.ts +9 -0
- package/dist/competition/shared/sandbox-policy.js +7 -0
- package/dist/competition/shared/teardown.d.ts +36 -0
- package/dist/competition/shared/teardown.js +101 -0
- package/dist/configs/agents/defaults.d.ts +31 -2
- package/dist/configs/agents/defaults.js +346 -30
- package/dist/configs/agents/errors.js +14 -11
- package/dist/configs/agents/loader.d.ts +11 -1
- package/dist/configs/agents/loader.js +71 -4
- package/dist/configs/agents/types.js +2 -2
- package/dist/configs/environment/detect.js +9 -4
- package/dist/configs/environment/errors.js +4 -4
- package/dist/configs/environment/loader.d.ts +1 -1
- package/dist/configs/environment/loader.js +3 -3
- package/dist/configs/orchestration/bootstrap.d.ts +16 -0
- package/dist/configs/orchestration/bootstrap.js +122 -0
- package/dist/configs/orchestration/errors.d.ts +15 -0
- package/dist/configs/orchestration/errors.js +28 -0
- package/dist/configs/orchestration/loader.d.ts +9 -0
- package/dist/configs/orchestration/loader.js +148 -0
- package/dist/configs/orchestration/types.d.ts +102 -0
- package/dist/configs/orchestration/types.js +65 -0
- package/dist/configs/sandbox/defaults.js +14 -4
- package/dist/configs/sandbox/errors.d.ts +1 -1
- package/dist/configs/sandbox/errors.js +1 -1
- package/dist/configs/sandbox/loader.js +6 -4
- package/dist/configs/sandbox/schemas.js +4 -2
- package/dist/configs/settings/loader.d.ts +7 -0
- package/dist/configs/settings/loader.js +81 -0
- package/dist/configs/settings/types.d.ts +47 -0
- package/dist/configs/settings/types.js +23 -0
- package/dist/configs/verification/errors.d.ts +11 -0
- package/dist/configs/verification/errors.js +21 -0
- package/dist/configs/verification/loader.d.ts +8 -0
- package/dist/configs/verification/loader.js +43 -0
- package/dist/configs/verification/methods.d.ts +35 -0
- package/dist/configs/verification/methods.js +41 -0
- package/dist/configs/verification/programmatic-defaults.d.ts +10 -0
- package/dist/configs/verification/programmatic-defaults.js +42 -0
- package/dist/configs/verification/programmatic-detect.d.ts +10 -0
- package/dist/configs/{evals/detect.js → verification/programmatic-detect.js} +22 -33
- package/dist/configs/verification/types.d.ts +49 -0
- package/dist/configs/verification/types.js +45 -0
- package/dist/contracts/list.d.ts +207 -0
- package/dist/contracts/list.js +154 -0
- package/dist/domain/interactive/model/types.d.ts +104 -0
- package/dist/domain/interactive/model/types.js +83 -0
- package/dist/domain/interactive/persistence/adapter.d.ts +39 -0
- package/dist/domain/interactive/persistence/adapter.js +144 -0
- package/dist/domain/interactive/prompt.d.ts +3 -0
- package/dist/domain/interactive/prompt.js +7 -0
- package/dist/domain/message/competition/adapter.d.ts +36 -0
- package/dist/domain/message/competition/adapter.js +197 -0
- package/dist/domain/message/competition/prompt.d.ts +8 -0
- package/dist/domain/message/competition/prompt.js +29 -0
- package/dist/domain/message/model/mutators.d.ts +17 -0
- package/dist/domain/message/model/mutators.js +107 -0
- package/dist/domain/message/model/types.d.ts +100 -0
- package/dist/domain/message/model/types.js +87 -0
- package/dist/domain/message/persistence/adapter.d.ts +43 -0
- package/dist/domain/message/persistence/adapter.js +124 -0
- package/dist/domain/reduce/competition/adapter.d.ts +42 -0
- package/dist/domain/reduce/competition/adapter.js +826 -0
- package/dist/domain/reduce/competition/output-validation.d.ts +4 -0
- package/dist/domain/reduce/competition/output-validation.js +18 -0
- package/dist/domain/reduce/competition/prompt.d.ts +10 -0
- package/dist/domain/reduce/competition/prompt.js +96 -0
- package/dist/domain/reduce/competition/reduction.d.ts +9 -0
- package/dist/domain/reduce/competition/reduction.js +32 -0
- package/dist/domain/reduce/model/types.d.ts +122 -0
- package/dist/domain/reduce/model/types.js +84 -0
- package/dist/domain/reduce/persistence/adapter.d.ts +43 -0
- package/dist/domain/reduce/persistence/adapter.js +126 -0
- package/dist/domain/run/competition/adapter.d.ts +30 -0
- package/dist/domain/run/competition/adapter.js +39 -0
- package/dist/domain/run/competition/agent-execution.d.ts +20 -0
- package/dist/domain/run/competition/agent-execution.js +45 -0
- package/dist/domain/run/competition/agent-preparation.d.ts +12 -0
- package/dist/domain/run/competition/agent-preparation.js +24 -0
- package/dist/domain/run/competition/agents/artifacts.d.ts +17 -0
- package/dist/domain/run/competition/agents/artifacts.js +173 -0
- package/dist/{commands/run → domain/run/competition}/agents/lifecycle.d.ts +3 -3
- package/dist/{commands/run → domain/run/competition}/agents/lifecycle.js +84 -64
- package/dist/domain/run/competition/agents/post-processing.d.ts +12 -0
- package/dist/domain/run/competition/agents/post-processing.js +4 -0
- package/dist/domain/run/competition/agents/preparation.js +64 -0
- package/dist/{commands/run → domain/run/competition}/agents/run-context.d.ts +9 -16
- package/dist/{commands/run → domain/run/competition}/agents/run-context.js +22 -70
- package/dist/{commands/run → domain/run/competition}/agents/types.d.ts +10 -13
- package/dist/domain/run/competition/agents/workspace.d.ts +21 -0
- package/dist/domain/run/competition/agents/workspace.js +47 -0
- package/dist/{commands/run → domain/run/competition}/errors.d.ts +8 -1
- package/dist/{commands/run → domain/run/competition}/errors.js +39 -9
- package/dist/{commands/run → domain/run/competition}/phases.d.ts +1 -2
- package/dist/domain/run/competition/phases.js +1 -0
- package/dist/domain/run/competition/prompt.d.ts +7 -0
- package/dist/domain/run/competition/prompt.js +27 -0
- package/dist/{commands/run → domain/run/competition}/reports.d.ts +5 -3
- package/dist/{commands/run → domain/run/competition}/reports.js +7 -19
- package/dist/domain/run/competition/termination-state.d.ts +4 -0
- package/dist/domain/run/competition/termination-state.js +12 -0
- package/dist/{records → domain/run/model}/enhanced.d.ts +6 -7
- package/dist/{records → domain/run/model}/enhanced.js +11 -11
- package/dist/{records → domain/run/model}/errors.d.ts +1 -1
- package/dist/{records → domain/run/model}/errors.js +5 -5
- package/dist/{records → domain/run/model}/mutators.d.ts +4 -3
- package/dist/{records → domain/run/model}/mutators.js +58 -36
- package/dist/domain/run/model/types.d.ts +376 -0
- package/dist/domain/run/model/types.js +192 -0
- package/dist/{records/persistence.d.ts → domain/run/persistence/adapter.d.ts} +9 -3
- package/dist/domain/run/persistence/adapter.js +340 -0
- package/dist/domain/run/persistence/error-mapping.d.ts +2 -0
- package/dist/domain/run/persistence/error-mapping.js +17 -0
- package/dist/domain/shared/lifecycle.d.ts +54 -0
- package/dist/domain/shared/lifecycle.js +165 -0
- package/dist/domain/shared/token-usage.d.ts +21 -0
- package/dist/domain/shared/token-usage.js +38 -0
- package/dist/domain/spec/competition/adapter.d.ts +31 -0
- package/dist/domain/spec/competition/adapter.js +196 -0
- package/dist/domain/spec/competition/prompt.d.ts +11 -0
- package/dist/domain/spec/competition/prompt.js +44 -0
- package/dist/domain/spec/model/output.d.ts +13 -0
- package/dist/domain/spec/model/output.js +36 -0
- package/dist/domain/spec/model/types.d.ts +98 -0
- package/dist/domain/spec/model/types.js +84 -0
- package/dist/domain/spec/persistence/adapter.d.ts +51 -0
- package/dist/domain/spec/persistence/adapter.js +140 -0
- package/dist/domain/verify/blinding/aliases.d.ts +7 -0
- package/dist/domain/verify/blinding/aliases.js +23 -0
- package/dist/domain/verify/competition/adapter.d.ts +54 -0
- package/dist/domain/verify/competition/adapter.js +444 -0
- package/dist/domain/verify/competition/artifacts.d.ts +6 -0
- package/dist/domain/verify/competition/artifacts.js +7 -0
- package/dist/domain/verify/competition/blinding.d.ts +24 -0
- package/dist/domain/verify/competition/blinding.js +109 -0
- package/dist/domain/verify/competition/finalize.d.ts +11 -0
- package/dist/domain/verify/competition/finalize.js +65 -0
- package/dist/domain/verify/competition/programmatic.d.ts +15 -0
- package/dist/domain/verify/competition/programmatic.js +352 -0
- package/dist/domain/verify/competition/prompt.d.ts +19 -0
- package/dist/domain/verify/competition/prompt.js +63 -0
- package/dist/domain/verify/competition/rubric.d.ts +23 -0
- package/dist/domain/verify/competition/rubric.js +77 -0
- package/dist/domain/verify/competition/shared-layout.d.ts +121 -0
- package/dist/domain/verify/competition/shared-layout.js +365 -0
- package/dist/domain/verify/competition/target.d.ts +47 -0
- package/dist/domain/verify/competition/target.js +1 -0
- package/dist/domain/verify/model/mutators.d.ts +16 -0
- package/dist/domain/verify/model/mutators.js +126 -0
- package/dist/domain/verify/model/types.d.ts +408 -0
- package/dist/domain/verify/model/types.js +289 -0
- package/dist/domain/verify/persistence/adapter.d.ts +43 -0
- package/dist/domain/verify/persistence/adapter.js +126 -0
- package/dist/domain/verify/programmatic/runner.d.ts +22 -0
- package/dist/domain/verify/programmatic/runner.js +209 -0
- package/dist/domain/verify/rubric-result.d.ts +28 -0
- package/dist/domain/verify/rubric-result.js +121 -0
- package/dist/extra-context/contract.d.ts +17 -0
- package/dist/extra-context/contract.js +60 -0
- package/dist/interactive/index.d.ts +2 -0
- package/dist/interactive/index.js +1 -0
- package/dist/interactive/providers/launch.d.ts +23 -0
- package/dist/interactive/providers/launch.js +203 -0
- package/dist/interactive/providers/mcp.d.ts +13 -0
- package/dist/interactive/providers/mcp.js +547 -0
- package/dist/interactive/providers/shared.d.ts +2 -0
- package/dist/interactive/providers/shared.js +1 -0
- package/dist/interactive/providers.d.ts +3 -0
- package/dist/interactive/providers.js +3 -0
- package/dist/interactive/records.d.ts +2 -0
- package/dist/interactive/records.js +1 -0
- package/dist/interactive/substrate.d.ts +21 -0
- package/dist/interactive/substrate.js +522 -0
- package/dist/interactive/types.d.ts +101 -0
- package/dist/interactive/types.js +1 -0
- package/dist/mcp/server.d.ts +88 -0
- package/dist/mcp/server.js +790 -0
- package/dist/persistence/error-mapping.d.ts +19 -0
- package/dist/persistence/error-mapping.js +44 -0
- package/dist/persistence/errors.d.ts +26 -0
- package/dist/persistence/errors.js +49 -0
- package/dist/persistence/extra-context.d.ts +9 -0
- package/dist/persistence/extra-context.js +60 -0
- package/dist/{records → persistence}/history-lock.js +2 -2
- package/dist/persistence/record-path-schema.d.ts +3 -0
- package/dist/persistence/record-path-schema.js +16 -0
- package/dist/persistence/session-store.d.ts +92 -0
- package/dist/persistence/session-store.js +412 -0
- package/dist/policy/auto.d.ts +13 -0
- package/dist/policy/auto.js +22 -0
- package/dist/policy/index.d.ts +5 -0
- package/dist/policy/index.js +5 -0
- package/dist/policy/resolution.d.ts +6 -0
- package/dist/policy/resolution.js +23 -0
- package/dist/policy/result.d.ts +53 -0
- package/dist/policy/result.js +15 -0
- package/dist/policy/selector.d.ts +11 -0
- package/dist/policy/selector.js +57 -0
- package/dist/policy/verification.d.ts +77 -0
- package/dist/policy/verification.js +365 -0
- package/dist/policy/verifier-selection.d.ts +13 -0
- package/dist/policy/verifier-selection.js +78 -0
- package/dist/preflight/branch.d.ts +9 -0
- package/dist/preflight/branch.js +48 -0
- package/dist/preflight/errors.d.ts +3 -0
- package/dist/preflight/errors.js +10 -3
- package/dist/preflight/index.d.ts +13 -0
- package/dist/preflight/index.js +43 -8
- package/dist/render/interactions/confirmation.js +4 -2
- package/dist/render/transcripts/apply.js +9 -10
- package/dist/render/transcripts/auto.d.ts +27 -0
- package/dist/render/transcripts/auto.js +21 -0
- package/dist/render/transcripts/init.d.ts +4 -15
- package/dist/render/transcripts/init.js +71 -72
- package/dist/render/transcripts/list.d.ts +10 -1
- package/dist/render/transcripts/list.js +121 -15
- package/dist/render/transcripts/message.d.ts +72 -0
- package/dist/render/transcripts/message.js +362 -0
- package/dist/render/transcripts/prune.d.ts +7 -2
- package/dist/render/transcripts/prune.js +64 -17
- package/dist/render/transcripts/reduce.d.ts +74 -0
- package/dist/render/transcripts/reduce.js +395 -0
- package/dist/render/transcripts/root-launcher.d.ts +19 -0
- package/dist/render/transcripts/root-launcher.js +40 -0
- package/dist/render/transcripts/run.d.ts +35 -6
- package/dist/render/transcripts/run.js +241 -165
- package/dist/render/transcripts/shared.d.ts +2 -0
- package/dist/render/transcripts/shared.js +11 -4
- package/dist/render/transcripts/spec.d.ts +74 -0
- package/dist/render/transcripts/spec.js +394 -0
- package/dist/render/transcripts/stage-progress.d.ts +22 -0
- package/dist/render/transcripts/stage-progress.js +6 -0
- package/dist/render/transcripts/update-check.d.ts +2 -0
- package/dist/render/transcripts/update-check.js +22 -0
- package/dist/render/transcripts/verify.d.ts +74 -0
- package/dist/render/transcripts/verify.js +409 -0
- package/dist/render/utils/agents.d.ts +10 -9
- package/dist/render/utils/agents.js +30 -82
- package/dist/render/utils/badges.d.ts +3 -20
- package/dist/render/utils/badges.js +3 -36
- package/dist/render/utils/duration.d.ts +12 -0
- package/dist/render/utils/duration.js +37 -0
- package/dist/render/utils/interactive-frame.d.ts +6 -0
- package/dist/render/utils/interactive-frame.js +38 -0
- package/dist/render/utils/records.js +4 -4
- package/dist/render/utils/runs.d.ts +3 -9
- package/dist/render/utils/runs.js +16 -48
- package/dist/render/utils/stage-output.d.ts +20 -0
- package/dist/render/utils/stage-output.js +44 -0
- package/dist/render/utils/timezone.d.ts +2 -0
- package/dist/render/utils/timezone.js +42 -0
- package/dist/render/utils/transcript-shell.d.ts +66 -0
- package/dist/render/utils/transcript-shell.js +155 -0
- package/dist/render/utils/transcript.d.ts +7 -1
- package/dist/render/utils/transcript.js +12 -2
- package/dist/render/utils/wrap.d.ts +1 -0
- package/dist/render/utils/wrap.js +20 -0
- package/dist/status/colors.d.ts +2 -3
- package/dist/status/colors.js +3 -3
- package/dist/status/index.d.ts +108 -8
- package/dist/status/index.js +164 -5
- package/dist/update-check/checker.d.ts +24 -0
- package/dist/update-check/checker.js +130 -0
- package/dist/update-check/prompt.d.ts +25 -0
- package/dist/update-check/prompt.js +62 -0
- package/dist/update-check/semver.d.ts +17 -0
- package/dist/update-check/semver.js +36 -0
- package/dist/update-check/state-path.d.ts +8 -0
- package/dist/update-check/state-path.js +18 -0
- package/dist/utils/binaries.js +14 -8
- package/dist/utils/errors.d.ts +3 -1
- package/dist/utils/errors.js +3 -1
- package/dist/utils/git.d.ts +10 -0
- package/dist/utils/git.js +15 -3
- package/dist/utils/output.d.ts +5 -1
- package/dist/utils/output.js +4 -2
- package/dist/utils/process.d.ts +2 -1
- package/dist/utils/process.js +7 -3
- package/dist/utils/session-id.d.ts +1 -0
- package/dist/utils/session-id.js +22 -0
- package/dist/utils/slug.d.ts +2 -0
- package/dist/utils/slug.js +15 -0
- package/dist/utils/voratiq-cli-target.d.ts +9 -0
- package/dist/utils/voratiq-cli-target.js +58 -0
- package/dist/workspace/agents.d.ts +13 -16
- package/dist/workspace/agents.js +22 -147
- package/dist/workspace/chat/artifacts.d.ts +9 -0
- package/dist/workspace/chat/artifacts.js +82 -12
- package/dist/workspace/chat/native-usage.d.ts +13 -0
- package/dist/workspace/chat/native-usage.js +60 -0
- package/dist/workspace/chat/sources.d.ts +9 -5
- package/dist/workspace/chat/sources.js +89 -23
- package/dist/workspace/chat/token-usage-result.d.ts +23 -0
- package/dist/workspace/chat/token-usage-result.js +7 -0
- package/dist/workspace/chat/usage-extractor.d.ts +30 -0
- package/dist/workspace/chat/usage-extractor.js +461 -0
- package/dist/workspace/chat/usage-mappings.d.ts +20 -0
- package/dist/workspace/chat/usage-mappings.js +136 -0
- package/dist/workspace/credential-guard.js +1 -1
- package/dist/workspace/dependencies.js +4 -4
- package/dist/workspace/errors.d.ts +5 -0
- package/dist/workspace/errors.js +13 -3
- package/dist/workspace/layout.d.ts +17 -6
- package/dist/workspace/layout.js +51 -32
- package/dist/workspace/promotion.d.ts +32 -0
- package/dist/workspace/promotion.js +34 -0
- package/dist/workspace/prune.d.ts +1 -1
- package/dist/workspace/run.d.ts +1 -3
- package/dist/workspace/run.js +6 -15
- package/dist/workspace/setup.d.ts +8 -0
- package/dist/workspace/setup.js +359 -56
- package/dist/workspace/shim.js +1 -1
- package/dist/workspace/structure.d.ts +91 -26
- package/dist/workspace/structure.js +227 -43
- package/dist/workspace/templates.d.ts +9 -3
- package/dist/workspace/templates.js +26 -15
- package/dist/workspace/verification-defaults.d.ts +12 -0
- package/dist/workspace/verification-defaults.js +1017 -0
- package/package.json +30 -24
- package/dist/cli/review.d.ts +0 -12
- package/dist/cli/review.js +0 -33
- package/dist/commands/errors.d.ts +0 -4
- package/dist/commands/errors.js +0 -7
- package/dist/commands/init/evals.d.ts +0 -4
- package/dist/commands/init/evals.js +0 -219
- package/dist/commands/review/command.d.ts +0 -10
- package/dist/commands/review/command.js +0 -26
- package/dist/commands/run/agent-execution.d.ts +0 -19
- package/dist/commands/run/agent-execution.js +0 -63
- package/dist/commands/run/agents/auth-stage.d.ts +0 -23
- package/dist/commands/run/agents/auth-stage.js +0 -108
- package/dist/commands/run/agents/chat-preserver.d.ts +0 -9
- package/dist/commands/run/agents/chat-preserver.js +0 -35
- package/dist/commands/run/agents/eval-runner.d.ts +0 -19
- package/dist/commands/run/agents/eval-runner.js +0 -27
- package/dist/commands/run/agents/failures.js +0 -32
- package/dist/commands/run/agents/preparation.js +0 -123
- package/dist/commands/run/agents.d.ts +0 -14
- package/dist/commands/run/agents.js +0 -47
- package/dist/commands/run/prompts.d.ts +0 -4
- package/dist/commands/run/prompts.js +0 -16
- package/dist/commands/run/sandbox-registry.d.ts +0 -4
- package/dist/commands/run/sandbox-registry.js +0 -54
- package/dist/configs/evals/defaults.d.ts +0 -8
- package/dist/configs/evals/defaults.js +0 -28
- package/dist/configs/evals/detect.d.ts +0 -10
- package/dist/configs/evals/errors.d.ts +0 -16
- package/dist/configs/evals/errors.js +0 -29
- package/dist/configs/evals/loader.d.ts +0 -9
- package/dist/configs/evals/loader.js +0 -46
- package/dist/configs/evals/types.d.ts +0 -42
- package/dist/configs/evals/types.js +0 -74
- package/dist/evals/runner.d.ts +0 -16
- package/dist/evals/runner.js +0 -132
- package/dist/records/persistence.js +0 -469
- package/dist/records/types.d.ts +0 -255
- package/dist/records/types.js +0 -160
- package/dist/render/transcripts/review.d.ts +0 -2
- package/dist/render/transcripts/review.js +0 -36
- /package/dist/{commands/run → agents/runtime}/shim/agent-manifest.d.ts +0 -0
- /package/dist/{commands/run → agents/runtime}/shim/agent-manifest.js +0 -0
- /package/dist/{commands/run → agents/runtime/shim}/argv.d.ts +0 -0
- /package/dist/{commands/run → agents/runtime/shim}/argv.js +0 -0
- /package/dist/{commands/run/agents → agents/runtime}/types.js +0 -0
- /package/dist/{commands/run → domain/run/competition}/agents/preparation.d.ts +0 -0
- /package/dist/{commands/run/phases.js → domain/run/competition/agents/types.js} +0 -0
- /package/dist/{commands/run → domain/run/model}/id.d.ts +0 -0
- /package/dist/{commands/run → domain/run/model}/id.js +0 -0
- /package/dist/{records → persistence}/history-lock.d.ts +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { VerificationRecord } from "../model/types.js";
|
|
2
|
+
export type VerificationRecordPredicate = (record: VerificationRecord) => boolean;
|
|
3
|
+
export interface VerificationRecordWarningMissing {
|
|
4
|
+
kind: "missing-record";
|
|
5
|
+
sessionId: string;
|
|
6
|
+
recordPath: string;
|
|
7
|
+
displayPath: string;
|
|
8
|
+
}
|
|
9
|
+
export interface VerificationRecordWarningParse {
|
|
10
|
+
kind: "parse-error";
|
|
11
|
+
sessionId: string;
|
|
12
|
+
recordPath: string;
|
|
13
|
+
displayPath: string;
|
|
14
|
+
details: string;
|
|
15
|
+
}
|
|
16
|
+
export type VerificationRecordWarning = VerificationRecordWarningMissing | VerificationRecordWarningParse;
|
|
17
|
+
export interface ReadVerificationRecordsOptions {
|
|
18
|
+
root: string;
|
|
19
|
+
verificationsFilePath: string;
|
|
20
|
+
limit?: number;
|
|
21
|
+
predicate?: VerificationRecordPredicate;
|
|
22
|
+
onWarning?: (warning: VerificationRecordWarning) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface RewriteVerificationRecordOptions {
|
|
25
|
+
root: string;
|
|
26
|
+
verificationsFilePath: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
mutate: (record: VerificationRecord) => VerificationRecord;
|
|
29
|
+
forceFlush?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface AppendVerificationRecordOptions {
|
|
32
|
+
root: string;
|
|
33
|
+
verificationsFilePath: string;
|
|
34
|
+
record: VerificationRecord;
|
|
35
|
+
}
|
|
36
|
+
export declare function readVerificationRecords(options: ReadVerificationRecordsOptions): Promise<VerificationRecord[]>;
|
|
37
|
+
export declare function appendVerificationRecord(options: AppendVerificationRecordOptions): Promise<void>;
|
|
38
|
+
export declare function rewriteVerificationRecord(options: RewriteVerificationRecordOptions): Promise<VerificationRecord>;
|
|
39
|
+
export declare function flushVerificationRecordBuffer(options: {
|
|
40
|
+
verificationsFilePath: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
export declare function flushAllVerificationRecordBuffers(): Promise<void>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { dirname, join } from "node:path";
|
|
2
|
+
import { mapSessionStoreError, sessionStoreErrorMapper, } from "../../../persistence/error-mapping.js";
|
|
3
|
+
import { SessionRecordParseError } from "../../../persistence/errors.js";
|
|
4
|
+
import { acquireHistoryLock } from "../../../persistence/history-lock.js";
|
|
5
|
+
import { createSessionStore, } from "../../../persistence/session-store.js";
|
|
6
|
+
import { TERMINAL_VERIFICATION_STATUSES, verificationRecordSchema, } from "../model/types.js";
|
|
7
|
+
const VERIFICATION_INDEX_VERSION = 1;
|
|
8
|
+
const VERIFICATION_RECORD_FILENAME = "record.json";
|
|
9
|
+
const VERIFICATION_HISTORY_LOCK_FILENAME = "history.lock";
|
|
10
|
+
const verificationPersistence = createSessionStore({
|
|
11
|
+
recordFilename: VERIFICATION_RECORD_FILENAME,
|
|
12
|
+
indexVersion: VERIFICATION_INDEX_VERSION,
|
|
13
|
+
acquireLock: acquireHistoryLock,
|
|
14
|
+
parseRecord: ({ path, raw }) => {
|
|
15
|
+
const parsed = JSON.parse(raw);
|
|
16
|
+
const result = verificationRecordSchema.safeParse(parsed);
|
|
17
|
+
if (!result.success) {
|
|
18
|
+
const issues = result.error.issues
|
|
19
|
+
.map((issue) => issue.message)
|
|
20
|
+
.join(", ");
|
|
21
|
+
throw new SessionRecordParseError(path, issues);
|
|
22
|
+
}
|
|
23
|
+
return result.data;
|
|
24
|
+
},
|
|
25
|
+
buildIndexEntry: (record) => ({
|
|
26
|
+
sessionId: record.sessionId,
|
|
27
|
+
createdAt: record.createdAt,
|
|
28
|
+
status: record.status,
|
|
29
|
+
targetKind: record.target.kind,
|
|
30
|
+
targetSessionId: record.target.sessionId,
|
|
31
|
+
}),
|
|
32
|
+
getIndexEntryId: (entry) => entry.sessionId,
|
|
33
|
+
shouldForceFlush: (record) => TERMINAL_VERIFICATION_STATUSES.includes(record.status),
|
|
34
|
+
getRecordId: (record) => record.sessionId,
|
|
35
|
+
getRecordStatus: (record) => record.status,
|
|
36
|
+
readIndexEntries: (parsed) => {
|
|
37
|
+
const payload = parsed;
|
|
38
|
+
return Array.isArray(payload.sessions) ? payload.sessions : [];
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
export async function readVerificationRecords(options) {
|
|
42
|
+
const { root, verificationsFilePath, limit, predicate, onWarning } = options;
|
|
43
|
+
const paths = buildVerificationPaths(root, verificationsFilePath);
|
|
44
|
+
try {
|
|
45
|
+
return await verificationPersistence.readRecords({
|
|
46
|
+
paths,
|
|
47
|
+
limit,
|
|
48
|
+
predicate,
|
|
49
|
+
onWarning: onWarning
|
|
50
|
+
? (warning) => onWarning(mapWarning(warning))
|
|
51
|
+
: undefined,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw mapSessionStoreError(error, sessionStoreErrorMapper);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export async function appendVerificationRecord(options) {
|
|
59
|
+
const { root, verificationsFilePath, record } = options;
|
|
60
|
+
const paths = buildVerificationPaths(root, verificationsFilePath);
|
|
61
|
+
try {
|
|
62
|
+
await verificationPersistence.appendRecord({ paths, record });
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw mapSessionStoreError(error, sessionStoreErrorMapper);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export async function rewriteVerificationRecord(options) {
|
|
69
|
+
const { root, verificationsFilePath, sessionId, mutate, forceFlush = false, } = options;
|
|
70
|
+
const paths = buildVerificationPaths(root, verificationsFilePath);
|
|
71
|
+
try {
|
|
72
|
+
return await verificationPersistence.rewriteRecord({
|
|
73
|
+
paths,
|
|
74
|
+
sessionId,
|
|
75
|
+
mutate,
|
|
76
|
+
forceFlush,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
throw mapSessionStoreError(error, sessionStoreErrorMapper);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export async function flushVerificationRecordBuffer(options) {
|
|
84
|
+
const { verificationsFilePath, sessionId } = options;
|
|
85
|
+
const paths = buildVerificationPaths("", verificationsFilePath);
|
|
86
|
+
try {
|
|
87
|
+
await verificationPersistence.flushRecordBuffer({ paths, sessionId });
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
throw mapSessionStoreError(error, sessionStoreErrorMapper);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export async function flushAllVerificationRecordBuffers() {
|
|
94
|
+
try {
|
|
95
|
+
await verificationPersistence.flushAllRecordBuffers();
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
throw mapSessionStoreError(error, sessionStoreErrorMapper);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function buildVerificationPaths(root, verificationsFilePath) {
|
|
102
|
+
const verificationsRoot = dirname(verificationsFilePath);
|
|
103
|
+
return {
|
|
104
|
+
root,
|
|
105
|
+
indexPath: verificationsFilePath,
|
|
106
|
+
sessionsDir: join(verificationsRoot, "sessions"),
|
|
107
|
+
lockPath: join(verificationsRoot, VERIFICATION_HISTORY_LOCK_FILENAME),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function mapWarning(warning) {
|
|
111
|
+
if (warning.kind === "missing-record") {
|
|
112
|
+
return {
|
|
113
|
+
kind: "missing-record",
|
|
114
|
+
sessionId: warning.sessionId,
|
|
115
|
+
recordPath: warning.recordPath,
|
|
116
|
+
displayPath: warning.displayPath,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
kind: "parse-error",
|
|
121
|
+
sessionId: warning.sessionId,
|
|
122
|
+
recordPath: warning.recordPath,
|
|
123
|
+
displayPath: warning.displayPath,
|
|
124
|
+
details: warning.details,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type EnvironmentConfig } from "../../../configs/environment/types.js";
|
|
2
|
+
import type { ProgrammaticCheckResult, ProgrammaticCommandEntry } from "../../../configs/verification/methods.js";
|
|
3
|
+
interface ExecuteProgrammaticChecksOptions {
|
|
4
|
+
checks: readonly ProgrammaticCommandEntry[];
|
|
5
|
+
cwd: string;
|
|
6
|
+
root: string;
|
|
7
|
+
logsDirectory: string;
|
|
8
|
+
env?: NodeJS.ProcessEnv;
|
|
9
|
+
environment: EnvironmentConfig;
|
|
10
|
+
envDirectoryGuard?: ProgrammaticEnvDirectoryGuardOptions;
|
|
11
|
+
}
|
|
12
|
+
export interface ProgrammaticEnvDirectoryGuardOptions {
|
|
13
|
+
trustedAbsoluteRoots: readonly string[];
|
|
14
|
+
includeHomeForPythonStack?: boolean;
|
|
15
|
+
failOnDirectoryPreparationError?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ExecuteProgrammaticChecksResult {
|
|
18
|
+
results: ProgrammaticCheckResult[];
|
|
19
|
+
warnings: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function executeProgrammaticChecks(options: ExecuteProgrammaticChecksOptions): Promise<ExecuteProgrammaticChecksResult>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { createWriteStream } from "node:fs";
|
|
2
|
+
import { mkdir } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { isAbsolute, resolve as resolveAbsolute } from "node:path";
|
|
5
|
+
import { getNodeDependencyRoots, getPythonEnvironmentPath, } from "../../../configs/environment/types.js";
|
|
6
|
+
import { sanitizeSlugForFilename } from "../../../configs/verification/methods.js";
|
|
7
|
+
import { toErrorMessage } from "../../../utils/errors.js";
|
|
8
|
+
import { normalizePathForDisplay, relativeToRoot, resolvePath, } from "../../../utils/path.js";
|
|
9
|
+
import { spawnStreamingProcess } from "../../../utils/process.js";
|
|
10
|
+
export async function executeProgrammaticChecks(options) {
|
|
11
|
+
const { checks, cwd, root, logsDirectory, env, environment, envDirectoryGuard, } = options;
|
|
12
|
+
const results = [];
|
|
13
|
+
const warnings = [];
|
|
14
|
+
await mkdir(logsDirectory, { recursive: true });
|
|
15
|
+
const checkEnvironment = composeCheckEnvironment(env);
|
|
16
|
+
for (const check of checks) {
|
|
17
|
+
const { slug, command } = check;
|
|
18
|
+
if (!command) {
|
|
19
|
+
results.push({
|
|
20
|
+
slug,
|
|
21
|
+
status: "skipped",
|
|
22
|
+
});
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const prepWarnings = await ensureEnvDirectories({
|
|
27
|
+
command,
|
|
28
|
+
cwd,
|
|
29
|
+
env: checkEnvironment,
|
|
30
|
+
guard: envDirectoryGuard,
|
|
31
|
+
});
|
|
32
|
+
warnings.push(...prepWarnings);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw new Error(`Programmatic environment preparation failed for "${slug}": ${toErrorMessage(error)}`);
|
|
36
|
+
}
|
|
37
|
+
const logFileName = `${sanitizeSlugForFilename(slug)}.log`;
|
|
38
|
+
const logPath = resolvePath(logsDirectory, logFileName);
|
|
39
|
+
const logStream = createWriteStream(logPath, { flags: "w" });
|
|
40
|
+
let exitCode = null;
|
|
41
|
+
let status = "succeeded";
|
|
42
|
+
let errorMessage;
|
|
43
|
+
const missingStacks = detectMissingStacks(command, environment);
|
|
44
|
+
if (missingStacks.length > 0) {
|
|
45
|
+
const warningMessage = buildMissingStackWarning(slug, command, missingStacks);
|
|
46
|
+
logStream.write(`${warningMessage}\n`);
|
|
47
|
+
warnings.push(warningMessage);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const { exitCode: code, signal } = await spawnStreamingProcess({
|
|
51
|
+
command,
|
|
52
|
+
cwd,
|
|
53
|
+
env: checkEnvironment,
|
|
54
|
+
shell: true,
|
|
55
|
+
stdout: { writable: logStream, endOnClose: false },
|
|
56
|
+
stderr: { writable: logStream, endOnClose: false },
|
|
57
|
+
});
|
|
58
|
+
if (signal) {
|
|
59
|
+
status = "errored";
|
|
60
|
+
exitCode = null;
|
|
61
|
+
errorMessage = `Process terminated by signal ${signal}`;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
exitCode = code;
|
|
65
|
+
status = code === 0 ? "succeeded" : "failed";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
status = "errored";
|
|
70
|
+
exitCode = null;
|
|
71
|
+
errorMessage = toErrorMessage(error);
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
logStream.end();
|
|
75
|
+
}
|
|
76
|
+
results.push({
|
|
77
|
+
slug,
|
|
78
|
+
status,
|
|
79
|
+
command,
|
|
80
|
+
exitCode,
|
|
81
|
+
logPath: normalizePathForDisplay(relativeToRoot(root, logPath)),
|
|
82
|
+
error: errorMessage,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return { results, warnings };
|
|
86
|
+
}
|
|
87
|
+
function composeCheckEnvironment(overrides) {
|
|
88
|
+
return {
|
|
89
|
+
...overrides,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async function ensureEnvDirectories(options) {
|
|
93
|
+
const { command, cwd, env, guard } = options;
|
|
94
|
+
if (!guard) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
const warnings = [];
|
|
98
|
+
const candidates = collectEnvDirCandidates({
|
|
99
|
+
command,
|
|
100
|
+
cwd,
|
|
101
|
+
env,
|
|
102
|
+
includeHomeForPythonStack: guard.includeHomeForPythonStack ?? false,
|
|
103
|
+
});
|
|
104
|
+
if (candidates.length === 0) {
|
|
105
|
+
return warnings;
|
|
106
|
+
}
|
|
107
|
+
const trustedRoots = normalizeTrustedRoots(guard.trustedAbsoluteRoots);
|
|
108
|
+
trustedRoots.push(resolveAbsolute(tmpdir()));
|
|
109
|
+
for (const candidate of candidates) {
|
|
110
|
+
if (candidate.absolute &&
|
|
111
|
+
!isWithinAnyRoot(candidate.resolvedPath, trustedRoots)) {
|
|
112
|
+
warnings.push(`[voratiq] Warning: skipping programmatic env mkdir for ${candidate.variables.join(", ")} at ${candidate.resolvedPath} (outside trusted roots).`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
await mkdir(candidate.resolvedPath, { recursive: true });
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
const failureMessage = `[voratiq] Warning: failed to create programmatic env directory for ${candidate.variables.join(", ")} at ${candidate.resolvedPath}: ${toErrorMessage(error)}`;
|
|
120
|
+
warnings.push(failureMessage);
|
|
121
|
+
if (guard.failOnDirectoryPreparationError) {
|
|
122
|
+
throw new Error(`required programmatic env directory prep failed for ${candidate.variables.join(", ")} at ${candidate.resolvedPath}: ${toErrorMessage(error)}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return warnings;
|
|
127
|
+
}
|
|
128
|
+
function collectEnvDirCandidates(options) {
|
|
129
|
+
const { command, cwd, env, includeHomeForPythonStack } = options;
|
|
130
|
+
const lowerCommand = command.toLowerCase();
|
|
131
|
+
const variableNames = ["TMPDIR", "TMP", "TEMP"];
|
|
132
|
+
if (includeHomeForPythonStack && requiresPythonStack(lowerCommand)) {
|
|
133
|
+
variableNames.push("HOME");
|
|
134
|
+
}
|
|
135
|
+
const deduplicated = new Map();
|
|
136
|
+
for (const variable of variableNames) {
|
|
137
|
+
const raw = env[variable];
|
|
138
|
+
if (typeof raw !== "string") {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const trimmed = raw.trim();
|
|
142
|
+
if (trimmed.length === 0) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const absolute = isAbsolute(trimmed);
|
|
146
|
+
const resolvedPath = absolute
|
|
147
|
+
? resolveAbsolute(trimmed)
|
|
148
|
+
: resolveAbsolute(cwd, trimmed);
|
|
149
|
+
const existing = deduplicated.get(resolvedPath);
|
|
150
|
+
if (existing) {
|
|
151
|
+
existing.variables.push(variable);
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
deduplicated.set(resolvedPath, {
|
|
155
|
+
resolvedPath,
|
|
156
|
+
variables: [variable],
|
|
157
|
+
absolute,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return Array.from(deduplicated.values());
|
|
161
|
+
}
|
|
162
|
+
function normalizeTrustedRoots(roots) {
|
|
163
|
+
const unique = new Set();
|
|
164
|
+
for (const root of roots) {
|
|
165
|
+
if (typeof root !== "string") {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const trimmed = root.trim();
|
|
169
|
+
if (trimmed.length === 0) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
unique.add(resolveAbsolute(trimmed));
|
|
173
|
+
}
|
|
174
|
+
return Array.from(unique);
|
|
175
|
+
}
|
|
176
|
+
function isWithinAnyRoot(path, roots) {
|
|
177
|
+
for (const root of roots) {
|
|
178
|
+
if (path === root) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
if (path.startsWith(`${root}/`)) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
function detectMissingStacks(command, environment) {
|
|
188
|
+
const missing = [];
|
|
189
|
+
const lowerCommand = command.toLowerCase();
|
|
190
|
+
if (requiresNodeStack(lowerCommand) &&
|
|
191
|
+
getNodeDependencyRoots(environment).length === 0) {
|
|
192
|
+
missing.push("node");
|
|
193
|
+
}
|
|
194
|
+
if (requiresPythonStack(lowerCommand) &&
|
|
195
|
+
!getPythonEnvironmentPath(environment)) {
|
|
196
|
+
missing.push("python");
|
|
197
|
+
}
|
|
198
|
+
return missing;
|
|
199
|
+
}
|
|
200
|
+
function requiresNodeStack(command) {
|
|
201
|
+
return /(^|\\s)(npm|pnpm|yarn|node|tsc|jest|vitest)(\\s|$)/u.test(command);
|
|
202
|
+
}
|
|
203
|
+
function requiresPythonStack(command) {
|
|
204
|
+
return /(^|\\s)(python|python3|pip|pip3|pytest)(\\s|$)/u.test(command);
|
|
205
|
+
}
|
|
206
|
+
function buildMissingStackWarning(slug, command, missingStacks) {
|
|
207
|
+
const stackList = missingStacks.join(", ");
|
|
208
|
+
return `[voratiq] Warning: programmatic check "${slug}" may fail because ${stackList} support is not enabled (command: ${JSON.stringify(command)}).`;
|
|
209
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const rubricResultPayloadSchema: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
|
|
3
|
+
export type RubricResultPayload = z.infer<typeof rubricResultPayloadSchema>;
|
|
4
|
+
export declare const rubricRecommendationSchema: z.ZodObject<{
|
|
5
|
+
preferred: z.ZodOptional<z.ZodString>;
|
|
6
|
+
ranking: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
|
+
rationale: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type RubricRecommendation = z.infer<typeof rubricRecommendationSchema>;
|
|
10
|
+
export declare function parseRubricResultPayload(raw: string): RubricResultPayload;
|
|
11
|
+
export declare function safeParseRubricRecommendationFromResult(result: RubricResultPayload): {
|
|
12
|
+
success: true;
|
|
13
|
+
data: RubricRecommendation | undefined;
|
|
14
|
+
} | {
|
|
15
|
+
success: false;
|
|
16
|
+
error: z.ZodError<RubricRecommendation>;
|
|
17
|
+
};
|
|
18
|
+
export declare function parseRubricRecommendationFromResult(result: RubricResultPayload): RubricRecommendation | undefined;
|
|
19
|
+
export declare function readRubricResultPreferred(result: RubricResultPayload): string | undefined;
|
|
20
|
+
export declare function readRubricResultRanking(result: RubricResultPayload): string[] | undefined;
|
|
21
|
+
export declare function readRubricResultComparison(result: RubricResultPayload): string | undefined;
|
|
22
|
+
export declare function readRubricResultRationale(result: RubricResultPayload): string | undefined;
|
|
23
|
+
export declare function readRubricResultNextActions(result: RubricResultPayload): string[] | undefined;
|
|
24
|
+
export declare function readRubricResultNarrative(result: RubricResultPayload): string | undefined;
|
|
25
|
+
export declare function formatRubricResultIssues(issues: ReadonlyArray<{
|
|
26
|
+
path: readonly PropertyKey[];
|
|
27
|
+
message: string;
|
|
28
|
+
}>): string;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const rubricResultPayloadSchema = z.object({}).catchall(z.unknown());
|
|
3
|
+
const verificationSelectorSchema = z.string().trim().min(1);
|
|
4
|
+
export const rubricRecommendationSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
preferred: verificationSelectorSchema.optional(),
|
|
7
|
+
ranking: z.array(verificationSelectorSchema).min(1).optional(),
|
|
8
|
+
rationale: z.string().min(1).optional(),
|
|
9
|
+
})
|
|
10
|
+
.strict()
|
|
11
|
+
.superRefine((value, ctx) => {
|
|
12
|
+
if (value.preferred !== undefined &&
|
|
13
|
+
value.ranking !== undefined &&
|
|
14
|
+
value.ranking[0] !== value.preferred) {
|
|
15
|
+
ctx.addIssue({
|
|
16
|
+
code: z.ZodIssueCode.custom,
|
|
17
|
+
path: ["preferred"],
|
|
18
|
+
message: "`preferred` must match `ranking[0]` when both are present",
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export function parseRubricResultPayload(raw) {
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = JSON.parse(raw);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
const reason = error instanceof Error ? error.message : "invalid JSON";
|
|
29
|
+
throw new Error(`Invalid verifier result.json: ${reason}`);
|
|
30
|
+
}
|
|
31
|
+
const validation = rubricResultPayloadSchema.safeParse(parsed);
|
|
32
|
+
if (!validation.success) {
|
|
33
|
+
throw new Error("Invalid verifier result.json: expected a top-level JSON object");
|
|
34
|
+
}
|
|
35
|
+
return validation.data;
|
|
36
|
+
}
|
|
37
|
+
export function safeParseRubricRecommendationFromResult(result) {
|
|
38
|
+
const candidate = extractRubricRecommendationCandidate(result);
|
|
39
|
+
if (!candidate) {
|
|
40
|
+
return {
|
|
41
|
+
success: true,
|
|
42
|
+
data: undefined,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const validation = rubricRecommendationSchema.safeParse(candidate);
|
|
46
|
+
if (!validation.success) {
|
|
47
|
+
return validation;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
success: true,
|
|
51
|
+
data: validation.data,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function parseRubricRecommendationFromResult(result) {
|
|
55
|
+
const validation = safeParseRubricRecommendationFromResult(result);
|
|
56
|
+
if (!validation.success) {
|
|
57
|
+
throw new Error(formatRubricResultIssues(validation.error.issues));
|
|
58
|
+
}
|
|
59
|
+
return validation.data;
|
|
60
|
+
}
|
|
61
|
+
export function readRubricResultPreferred(result) {
|
|
62
|
+
return normalizeNonEmptyString(result["preferred"]);
|
|
63
|
+
}
|
|
64
|
+
export function readRubricResultRanking(result) {
|
|
65
|
+
const value = result["ranking"];
|
|
66
|
+
if (!Array.isArray(value) ||
|
|
67
|
+
!value.every((entry) => typeof entry === "string")) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const ranking = value.map((entry) => entry.trim());
|
|
71
|
+
return ranking.every((entry) => entry.length > 0) ? ranking : undefined;
|
|
72
|
+
}
|
|
73
|
+
export function readRubricResultComparison(result) {
|
|
74
|
+
return normalizeNonEmptyString(result["comparison"]);
|
|
75
|
+
}
|
|
76
|
+
export function readRubricResultRationale(result) {
|
|
77
|
+
return normalizeNonEmptyString(result["rationale"]);
|
|
78
|
+
}
|
|
79
|
+
export function readRubricResultNextActions(result) {
|
|
80
|
+
const value = result["next_actions"];
|
|
81
|
+
if (!Array.isArray(value)) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const actions = value
|
|
85
|
+
.map((entry) => normalizeNonEmptyString(entry))
|
|
86
|
+
.filter((entry) => entry !== undefined);
|
|
87
|
+
return actions.length > 0 ? actions : undefined;
|
|
88
|
+
}
|
|
89
|
+
export function readRubricResultNarrative(result) {
|
|
90
|
+
return (readRubricResultRationale(result) ?? readRubricResultComparison(result));
|
|
91
|
+
}
|
|
92
|
+
export function formatRubricResultIssues(issues) {
|
|
93
|
+
return issues
|
|
94
|
+
.map((issue) => {
|
|
95
|
+
const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "root";
|
|
96
|
+
return `${path}: ${issue.message}`;
|
|
97
|
+
})
|
|
98
|
+
.join("; ");
|
|
99
|
+
}
|
|
100
|
+
function extractRubricRecommendationCandidate(result) {
|
|
101
|
+
const preferred = readRubricResultPreferred(result);
|
|
102
|
+
const ranking = readRubricResultRanking(result);
|
|
103
|
+
const rationale = readRubricResultNarrative(result);
|
|
104
|
+
if (preferred === undefined &&
|
|
105
|
+
ranking === undefined &&
|
|
106
|
+
rationale === undefined) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
...(preferred !== undefined ? { preferred } : {}),
|
|
111
|
+
...(ranking !== undefined ? { ranking } : {}),
|
|
112
|
+
...(rationale !== undefined ? { rationale } : {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function normalizeNonEmptyString(value) {
|
|
116
|
+
if (typeof value !== "string") {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
const normalized = value.trim();
|
|
120
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
121
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const EXTRA_CONTEXT_STAGED_PREFIX: string;
|
|
2
|
+
export interface PersistableExtraContextFile {
|
|
3
|
+
readonly displayPath: string;
|
|
4
|
+
readonly stagedRelativePath: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PersistedExtraContextMetadataEntry {
|
|
7
|
+
readonly stagedPath: string;
|
|
8
|
+
readonly sourcePath: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PersistedExtraContextFields {
|
|
11
|
+
readonly extraContext?: string[];
|
|
12
|
+
readonly extraContextMetadata?: PersistedExtraContextMetadataEntry[];
|
|
13
|
+
}
|
|
14
|
+
export declare function buildPersistedExtraContextFields(files: readonly PersistableExtraContextFile[]): PersistedExtraContextFields;
|
|
15
|
+
export declare function assertExtraContextStagedPath(value: string, message?: string): string;
|
|
16
|
+
export declare function assertExtraContextSourcePath(value: string, message?: string): string;
|
|
17
|
+
export declare function toExtraContextContextSubpath(stagedPath: string): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const EXTRA_CONTEXT_STAGED_PREFIX_SEGMENTS = ["..", "context"];
|
|
2
|
+
export const EXTRA_CONTEXT_STAGED_PREFIX = `${EXTRA_CONTEXT_STAGED_PREFIX_SEGMENTS.join("/")}/`;
|
|
3
|
+
export function buildPersistedExtraContextFields(files) {
|
|
4
|
+
if (files.length === 0) {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
extraContext: files.map((file) => assertExtraContextStagedPath(file.stagedRelativePath)),
|
|
9
|
+
extraContextMetadata: files.map((file) => ({
|
|
10
|
+
stagedPath: assertExtraContextStagedPath(file.stagedRelativePath),
|
|
11
|
+
sourcePath: assertExtraContextSourcePath(file.displayPath),
|
|
12
|
+
})),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function assertExtraContextStagedPath(value, message = `Path "${value}" must be session-relative under "../context/" with forward slashes.`) {
|
|
16
|
+
if (typeof value !== "string") {
|
|
17
|
+
throw new Error(message);
|
|
18
|
+
}
|
|
19
|
+
if (value.trim() !== value || value.length === 0) {
|
|
20
|
+
throw new Error(message);
|
|
21
|
+
}
|
|
22
|
+
if (value.startsWith("/")) {
|
|
23
|
+
throw new Error(message);
|
|
24
|
+
}
|
|
25
|
+
if (isWindowsAbsolutePath(value)) {
|
|
26
|
+
throw new Error(message);
|
|
27
|
+
}
|
|
28
|
+
if (value.includes("\\")) {
|
|
29
|
+
throw new Error(message);
|
|
30
|
+
}
|
|
31
|
+
const segments = value.split("/");
|
|
32
|
+
if (segments.length < 3) {
|
|
33
|
+
throw new Error(message);
|
|
34
|
+
}
|
|
35
|
+
const [parentSegment, contextSegment, ...rest] = segments;
|
|
36
|
+
if (parentSegment !== EXTRA_CONTEXT_STAGED_PREFIX_SEGMENTS[0] ||
|
|
37
|
+
contextSegment !== EXTRA_CONTEXT_STAGED_PREFIX_SEGMENTS[1]) {
|
|
38
|
+
throw new Error(message);
|
|
39
|
+
}
|
|
40
|
+
if (rest.some((segment) => segment.length === 0 || segment === "." || segment === "..")) {
|
|
41
|
+
throw new Error(message);
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
export function assertExtraContextSourcePath(value, message = `Path "${value}" must be a non-empty normalized source path.`) {
|
|
46
|
+
if (typeof value !== "string") {
|
|
47
|
+
throw new Error(message);
|
|
48
|
+
}
|
|
49
|
+
if (value.trim() !== value || value.length === 0) {
|
|
50
|
+
throw new Error(message);
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
export function toExtraContextContextSubpath(stagedPath) {
|
|
55
|
+
assertExtraContextStagedPath(stagedPath);
|
|
56
|
+
return stagedPath.slice(EXTRA_CONTEXT_STAGED_PREFIX.length);
|
|
57
|
+
}
|
|
58
|
+
function isWindowsAbsolutePath(value) {
|
|
59
|
+
return /^[A-Za-z]:/.test(value);
|
|
60
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { prepareAndSpawnNativeInteractiveSession, prepareNativeInteractiveSession, resolveInteractiveAgentProvider, spawnPreparedInteractiveSession, } from "./substrate.js";
|
|
2
|
+
export type { InteractiveLaunchFailure, InteractiveLaunchFailureCode, InteractiveLaunchFailureKind, InteractiveSessionChatRecord, InteractiveSessionErrorRecord, InteractiveSessionIndexEntry, InteractiveSessionIndexRecord, InteractiveSessionRecord, InteractiveSessionStatus, NativeLaunchInvocation, NativeSessionLaunchMode, NativeToolDeclaration, PrepareAndSpawnNativeSessionResult, PreparedInteractiveSession, PrepareNativeSessionFailure, PrepareNativeSessionOptions, PrepareNativeSessionResult, PrepareNativeSessionSuccess, SpawnPreparedSessionFailure, SpawnPreparedSessionOptions, SpawnPreparedSessionResult, SpawnPreparedSessionSuccess, ToolAttachmentStatus, } from "./types.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { prepareAndSpawnNativeInteractiveSession, prepareNativeInteractiveSession, resolveInteractiveAgentProvider, spawnPreparedInteractiveSession, } from "./substrate.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AgentDefinition } from "../../configs/agents/types.js";
|
|
2
|
+
import type { NativeToolDeclaration, ToolAttachmentStatus } from "../types.js";
|
|
3
|
+
import type { FirstPartyMcpStatusAndArgs } from "./mcp.js";
|
|
4
|
+
export interface ProviderLaunchPreparationInput {
|
|
5
|
+
providerId: string;
|
|
6
|
+
agent: AgentDefinition;
|
|
7
|
+
root: string;
|
|
8
|
+
toolDeclarations: readonly NativeToolDeclaration[];
|
|
9
|
+
prompt?: string;
|
|
10
|
+
launchMode?: "default" | "first-party";
|
|
11
|
+
firstPartyMcpResolution?: FirstPartyMcpStatusAndArgs;
|
|
12
|
+
}
|
|
13
|
+
export interface ProviderLaunchPreparationResult {
|
|
14
|
+
args: string[];
|
|
15
|
+
env: Record<string, string>;
|
|
16
|
+
toolAttachmentStatus: ToolAttachmentStatus;
|
|
17
|
+
artifactCaptureSupported: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function createBundledVoratiqToolDeclaration(options: {
|
|
20
|
+
command: string;
|
|
21
|
+
argsPrefix: readonly string[];
|
|
22
|
+
}): NativeToolDeclaration;
|
|
23
|
+
export declare function prepareProviderNativeLaunch(options: ProviderLaunchPreparationInput): Promise<ProviderLaunchPreparationResult>;
|