orizu 0.5.19 → 0.5.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 +23 -0
- package/dist/archive-artifacts-cli.d.ts +50 -0
- package/dist/archive-artifacts-cli.d.ts.map +1 -0
- package/dist/artifact-archive.d.ts +48 -0
- package/dist/artifact-archive.d.ts.map +1 -0
- package/dist/artifact-pull.d.ts +22 -0
- package/dist/artifact-pull.d.ts.map +1 -0
- package/dist/banner.d.ts +3 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/connectors-cli.d.ts +31 -0
- package/dist/connectors-cli.d.ts.map +1 -0
- package/dist/credentials.d.ts +46 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/csv.d.ts +49 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/dataset-download.d.ts +6 -0
- package/dist/dataset-download.d.ts.map +1 -0
- package/dist/dataset-edit-rows.d.ts +10 -0
- package/dist/dataset-edit-rows.d.ts.map +1 -0
- package/dist/dataset-upload-snapshot.d.ts +13 -0
- package/dist/dataset-upload-snapshot.d.ts.map +1 -0
- package/dist/daytona-slice-rehearsal.d.ts +89 -0
- package/dist/daytona-slice-rehearsal.d.ts.map +1 -0
- package/dist/daytona-slice.d.ts +106 -0
- package/dist/daytona-slice.d.ts.map +1 -0
- package/dist/deploy-key-merge-core.d.ts +121 -0
- package/dist/deploy-key-merge-core.d.ts.map +1 -0
- package/dist/diff-comments-cli.d.ts +12 -0
- package/dist/diff-comments-cli.d.ts.map +1 -0
- package/dist/diff-comments-cli.js +21 -2
- package/dist/egress-allowlist-cli.d.ts +23 -0
- package/dist/egress-allowlist-cli.d.ts.map +1 -0
- package/dist/egress-policy.d.ts +108 -0
- package/dist/egress-policy.d.ts.map +1 -0
- package/dist/error-response.d.ts +9 -0
- package/dist/error-response.d.ts.map +1 -0
- package/dist/file-parser.d.ts +5 -0
- package/dist/file-parser.d.ts.map +1 -0
- package/dist/gepa-engine-dispatch.d.ts +9 -0
- package/dist/gepa-engine-dispatch.d.ts.map +1 -0
- package/dist/gepa-engine-dispatch.js +307 -0
- package/dist/gepa-python-command.d.ts +6 -0
- package/dist/gepa-python-command.d.ts.map +1 -0
- package/dist/gepa-python-command.js +26 -0
- package/dist/gepa-python-paths.d.ts +6 -0
- package/dist/gepa-python-paths.d.ts.map +1 -0
- package/dist/gepa-python-paths.js +42 -0
- package/dist/git-credential.d.ts +69 -0
- package/dist/git-credential.d.ts.map +1 -0
- package/dist/git-recovery-environment.d.ts +31 -0
- package/dist/git-recovery-environment.d.ts.map +1 -0
- package/dist/github-setup.d.ts +122 -0
- package/dist/github-setup.d.ts.map +1 -0
- package/dist/global-flags.d.ts +12 -0
- package/dist/global-flags.d.ts.map +1 -0
- package/dist/help.d.ts +46 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +93 -25
- package/dist/hosted-boot.d.ts +273 -0
- package/dist/hosted-boot.d.ts.map +1 -0
- package/dist/hosted-bootstrap-rehearsal.d.ts +86 -0
- package/dist/hosted-bootstrap-rehearsal.d.ts.map +1 -0
- package/dist/hosted-bootstrap.d.ts +188 -0
- package/dist/hosted-bootstrap.d.ts.map +1 -0
- package/dist/hosted-broker-server.d.ts +50 -0
- package/dist/hosted-broker-server.d.ts.map +1 -0
- package/dist/hosted-git-http-server.d.ts +36 -0
- package/dist/hosted-git-http-server.d.ts.map +1 -0
- package/dist/hosted-harness-claude.d.ts +195 -0
- package/dist/hosted-harness-claude.d.ts.map +1 -0
- package/dist/hosted-harness-opencode.d.ts +227 -0
- package/dist/hosted-harness-opencode.d.ts.map +1 -0
- package/dist/hosted-harness.d.ts +118 -0
- package/dist/hosted-harness.d.ts.map +1 -0
- package/dist/hosted-harvest.d.ts +68 -0
- package/dist/hosted-harvest.d.ts.map +1 -0
- package/dist/hosted-headless.d.ts +72 -0
- package/dist/hosted-headless.d.ts.map +1 -0
- package/dist/hosted-loop-lifecycle.d.ts +206 -0
- package/dist/hosted-loop-lifecycle.d.ts.map +1 -0
- package/dist/hosted-loop.d.ts +170 -0
- package/dist/hosted-loop.d.ts.map +1 -0
- package/dist/hosted-run-event-sink.d.ts +222 -0
- package/dist/hosted-run-event-sink.d.ts.map +1 -0
- package/dist/hosted-runtime-assets.d.ts +186 -0
- package/dist/hosted-runtime-assets.d.ts.map +1 -0
- package/dist/hosted-session-cli.d.ts +258 -0
- package/dist/hosted-session-cli.d.ts.map +1 -0
- package/dist/hosted-skill-staging.d.ts +73 -0
- package/dist/hosted-skill-staging.d.ts.map +1 -0
- package/dist/http.d.ts +8 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +119 -129
- package/dist/instruction-set-gepa-launch.d.ts +3 -0
- package/dist/instruction-set-gepa-launch.d.ts.map +1 -0
- package/dist/instruction-set-gepa-launch.js +15 -0
- package/dist/instruction-set-loader.d.ts +6 -0
- package/dist/instruction-set-loader.d.ts.map +1 -0
- package/dist/instruction-set-loader.js +59 -0
- package/dist/instruction-set-manifest.d.ts +14 -0
- package/dist/instruction-set-manifest.d.ts.map +1 -0
- package/dist/instruction-set-manifest.js +162 -0
- package/dist/instruction-sets-cli.d.ts +40 -0
- package/dist/instruction-sets-cli.d.ts.map +1 -0
- package/dist/instruction-sets-cli.js +361 -0
- package/dist/json-response.d.ts +4 -0
- package/dist/json-response.d.ts.map +1 -0
- package/dist/jsonl-stream.d.ts +8 -0
- package/dist/jsonl-stream.d.ts.map +1 -0
- package/dist/kill-switch-cli.d.ts +30 -0
- package/dist/kill-switch-cli.d.ts.map +1 -0
- package/dist/loopback-serve.d.ts +25 -0
- package/dist/loopback-serve.d.ts.map +1 -0
- package/dist/manifests-cli.d.ts +22 -0
- package/dist/manifests-cli.d.ts.map +1 -0
- package/dist/markdown-report-input.d.ts +7 -0
- package/dist/markdown-report-input.d.ts.map +1 -0
- package/dist/markdown-report-input.js +15 -1
- package/dist/merge-job.d.ts +155 -0
- package/dist/merge-job.d.ts.map +1 -0
- package/dist/model-configs-cli.d.ts +19 -0
- package/dist/model-configs-cli.d.ts.map +1 -0
- package/dist/model-configs-cli.js +104 -0
- package/dist/optimization-export-cli.d.ts +19 -0
- package/dist/optimization-export-cli.d.ts.map +1 -0
- package/dist/optimizations-list-cli.d.ts +20 -0
- package/dist/optimizations-list-cli.d.ts.map +1 -0
- package/dist/optimizations-promote-cli.d.ts +8 -0
- package/dist/optimizations-promote-cli.d.ts.map +1 -0
- package/dist/optimizations-promote-cli.js +34 -0
- package/dist/option-validation.d.ts +15 -0
- package/dist/option-validation.d.ts.map +1 -0
- package/dist/preview-runtime.d.ts +63 -0
- package/dist/preview-runtime.d.ts.map +1 -0
- package/dist/prompt-draft-push.d.ts +60 -0
- package/dist/prompt-draft-push.d.ts.map +1 -0
- package/dist/prompt-label-cli.d.ts +11 -0
- package/dist/prompt-label-cli.d.ts.map +1 -0
- package/dist/prompt-label-cli.js +29 -0
- package/dist/prompt-length-wire.d.ts +28 -0
- package/dist/prompt-length-wire.d.ts.map +1 -0
- package/dist/prompt-length-wire.js +2 -2
- package/dist/prompt-report-cli.d.ts +10 -0
- package/dist/prompt-report-cli.d.ts.map +1 -0
- package/dist/prompt-report-cli.js +2 -2
- package/dist/prompt-summary-table.d.ts +15 -0
- package/dist/prompt-summary-table.d.ts.map +1 -0
- package/dist/prompt-summary-table.js +6 -0
- package/dist/registration-tag-warning.d.ts +32 -0
- package/dist/registration-tag-warning.d.ts.map +1 -0
- package/dist/report-comments-cli.d.ts +16 -0
- package/dist/report-comments-cli.d.ts.map +1 -0
- package/dist/report-markdown-blankness.d.ts +2 -0
- package/dist/report-markdown-blankness.d.ts.map +1 -0
- package/dist/report-markdown-blankness.js +6 -0
- package/dist/report-replacement-warning.d.ts +17 -0
- package/dist/report-replacement-warning.d.ts.map +1 -0
- package/dist/report-replacement-warning.js +31 -0
- package/dist/repository-backup-core.d.ts +225 -0
- package/dist/repository-backup-core.d.ts.map +1 -0
- package/dist/repository-recovery-manifest.d.ts +83 -0
- package/dist/repository-recovery-manifest.d.ts.map +1 -0
- package/dist/run-event-digest.d.ts +74 -0
- package/dist/run-event-digest.d.ts.map +1 -0
- package/dist/runner-dir-verify.d.ts +66 -0
- package/dist/runner-dir-verify.d.ts.map +1 -0
- package/dist/runner-instruction-set-contract.d.ts +24 -0
- package/dist/runner-instruction-set-contract.d.ts.map +1 -0
- package/dist/runner-instruction-set-contract.js +50 -0
- package/dist/sandbox-hygiene.d.ts +45 -0
- package/dist/sandbox-hygiene.d.ts.map +1 -0
- package/dist/sandbox-provider.d.ts +193 -0
- package/dist/sandbox-provider.d.ts.map +1 -0
- package/dist/scorer-draft-push.d.ts +50 -0
- package/dist/scorer-draft-push.d.ts.map +1 -0
- package/dist/scorers-cli.d.ts +20 -0
- package/dist/scorers-cli.d.ts.map +1 -0
- package/dist/scorers-cli.js +22 -0
- package/dist/scorers-verify-parity-bridge.d.ts +16 -0
- package/dist/scorers-verify-parity-bridge.d.ts.map +1 -0
- package/dist/scorers-verify-parity-bridge.js +90 -0
- package/dist/scorers-verify-parity.d.ts +81 -0
- package/dist/scorers-verify-parity.d.ts.map +1 -0
- package/dist/scorers-verify-parity.js +502 -0
- package/dist/scores-accept-cli.d.ts +21 -0
- package/dist/scores-accept-cli.d.ts.map +1 -0
- package/dist/secret-redaction.d.ts +47 -0
- package/dist/secret-redaction.d.ts.map +1 -0
- package/dist/session-timeline.d.ts +54 -0
- package/dist/session-timeline.d.ts.map +1 -0
- package/dist/setup-prompt.d.ts +5 -0
- package/dist/setup-prompt.d.ts.map +1 -0
- package/dist/skill-installer.d.ts +68 -0
- package/dist/skill-installer.d.ts.map +1 -0
- package/dist/skilled-proposer-launch.d.ts +7 -0
- package/dist/skilled-proposer-launch.d.ts.map +1 -0
- package/dist/skilled-proposer-launch.js +60 -0
- package/dist/smoke.d.ts +102 -0
- package/dist/smoke.d.ts.map +1 -0
- package/dist/start-intent.d.ts +12 -0
- package/dist/start-intent.d.ts.map +1 -0
- package/dist/task-assignment-manifest.d.ts +15 -0
- package/dist/task-assignment-manifest.d.ts.map +1 -0
- package/dist/task-create-error.d.ts +18 -0
- package/dist/task-create-error.d.ts.map +1 -0
- package/dist/team-connectors-cli.d.ts +29 -0
- package/dist/team-connectors-cli.d.ts.map +1 -0
- package/dist/types.d.ts +39 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/vercel-sandbox-provider.d.ts +156 -0
- package/dist/vercel-sandbox-provider.d.ts.map +1 -0
- package/dist/workbench-cli.d.ts +233 -0
- package/dist/workbench-cli.d.ts.map +1 -0
- package/dist/workspace-sync.d.ts +207 -0
- package/dist/workspace-sync.d.ts.map +1 -0
- package/dist/workspace.d.ts +92 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/zip-draft-push.d.ts +55 -0
- package/dist/zip-draft-push.d.ts.map +1 -0
- package/package.json +15 -2
- package/requirements/README.md +138 -0
- package/requirements/skilled-proposer.in +66 -0
- package/requirements/skilled-proposer.lock +265 -0
- package/scripts/build-cli-dist.mjs +30 -0
- package/scripts/ensure-skilled-proposer-venv.mjs +5 -0
- package/scripts/orizu-source-checkout.d.mts +1 -0
- package/scripts/orizu-source-checkout.mjs +10 -0
- package/scripts/refresh-skilled-proposer-lock.mjs +256 -0
- package/scripts/vendor-gepa-python.mjs +187 -4
- package/src/diff-comments-cli.ts +41 -3
- package/src/gepa-engine-dispatch.ts +340 -0
- package/src/gepa-python-command.ts +31 -0
- package/src/gepa-python-paths.ts +56 -0
- package/src/help.ts +95 -25
- package/src/index.ts +131 -166
- package/src/instruction-set-gepa-launch.ts +28 -0
- package/src/instruction-set-loader.ts +37 -0
- package/src/instruction-set-manifest.ts +120 -0
- package/src/instruction-sets-cli.ts +306 -0
- package/src/markdown-report-input.ts +19 -1
- package/src/model-configs-cli.ts +119 -0
- package/src/optimizations-promote-cli.ts +41 -0
- package/src/prompt-label-cli.ts +55 -0
- package/src/prompt-length-wire.ts +1 -1
- package/src/prompt-report-cli.ts +2 -2
- package/src/prompt-summary-table.ts +12 -0
- package/src/report-markdown-blankness.ts +6 -0
- package/src/report-replacement-warning.ts +35 -0
- package/src/runner-instruction-set-contract.ts +64 -0
- package/src/scorers-cli.ts +40 -0
- package/src/scorers-verify-parity-bridge.ts +90 -0
- package/src/scorers-verify-parity.ts +564 -0
- package/src/skilled-proposer-launch.ts +89 -0
- package/src/skilled-proposer-venv-manager.mjs +757 -0
- package/tsconfig.json +2 -0
- package/vendor/gepa-python/LICENSE +7 -0
- package/vendor/gepa-python/manifest.json +107 -0
- package/vendor/gepa-python/src/gepa/__init__.py +22 -0
- package/vendor/gepa-python/src/gepa/adapters/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/adapters/anymaths_adapter/__init__.py +1 -0
- package/vendor/gepa-python/src/gepa/adapters/anymaths_adapter/anymaths_adapter.py +174 -0
- package/vendor/gepa-python/src/gepa/adapters/confidence_adapter/__init__.py +26 -0
- package/vendor/gepa-python/src/gepa/adapters/confidence_adapter/confidence_adapter.py +618 -0
- package/vendor/gepa-python/src/gepa/adapters/confidence_adapter/scoring.py +206 -0
- package/vendor/gepa-python/src/gepa/adapters/default_adapter/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/adapters/default_adapter/default_adapter.py +206 -0
- package/vendor/gepa-python/src/gepa/adapters/dspy_adapter/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/adapters/dspy_adapter/dspy_adapter.py +525 -0
- package/vendor/gepa-python/src/gepa/adapters/dspy_adapter/instruction_proposal.py +500 -0
- package/vendor/gepa-python/src/gepa/adapters/dspy_full_program_adapter/__init__.py +6 -0
- package/vendor/gepa-python/src/gepa/adapters/dspy_full_program_adapter/dspy_program_proposal_signature.py +137 -0
- package/vendor/gepa-python/src/gepa/adapters/dspy_full_program_adapter/full_program_adapter.py +269 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/__init__.py +56 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/evaluation_metrics.py +226 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/generic_rag_adapter.py +496 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/rag_pipeline.py +238 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_store_interface.py +212 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/__init__.py +2 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/chroma_store.py +196 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/lancedb_store.py +422 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/milvus_store.py +409 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/qdrant_store.py +368 -0
- package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/weaviate_store.py +418 -0
- package/vendor/gepa-python/src/gepa/adapters/langchain_adapter/__init__.py +11 -0
- package/vendor/gepa-python/src/gepa/adapters/langchain_adapter/langchain_adapter.py +261 -0
- package/vendor/gepa-python/src/gepa/adapters/mcp_adapter/__init__.py +37 -0
- package/vendor/gepa-python/src/gepa/adapters/mcp_adapter/mcp_adapter.py +693 -0
- package/vendor/gepa-python/src/gepa/adapters/mcp_adapter/mcp_client.py +364 -0
- package/vendor/gepa-python/src/gepa/adapters/optimize_anything_adapter/optimize_anything_adapter.py +879 -0
- package/vendor/gepa-python/src/gepa/adapters/terminal_bench_adapter/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/adapters/terminal_bench_adapter/terminal_bench_adapter.py +217 -0
- package/vendor/gepa-python/src/gepa/api.py +468 -0
- package/vendor/gepa-python/src/gepa/core/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/core/adapter.py +227 -0
- package/vendor/gepa-python/src/gepa/core/callbacks.py +551 -0
- package/vendor/gepa-python/src/gepa/core/data_loader.py +74 -0
- package/vendor/gepa-python/src/gepa/core/engine.py +1025 -0
- package/vendor/gepa-python/src/gepa/core/result.py +271 -0
- package/vendor/gepa-python/src/gepa/core/state.py +706 -0
- package/vendor/gepa-python/src/gepa/examples/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/examples/aime.py +24 -0
- package/vendor/gepa-python/src/gepa/examples/anymaths-bench/eval_default.py +111 -0
- package/vendor/gepa-python/src/gepa/examples/anymaths-bench/train_anymaths.py +177 -0
- package/vendor/gepa-python/src/gepa/examples/mcp_adapter/__init__.py +4 -0
- package/vendor/gepa-python/src/gepa/examples/mcp_adapter/mcp_optimization_example.py +456 -0
- package/vendor/gepa-python/src/gepa/examples/rag_adapter/__init__.py +9 -0
- package/vendor/gepa-python/src/gepa/examples/rag_adapter/rag_optimization.py +824 -0
- package/vendor/gepa-python/src/gepa/examples/terminal-bench/train_terminus.py +161 -0
- package/vendor/gepa-python/src/gepa/gepa_utils.py +117 -0
- package/vendor/gepa-python/src/gepa/gskill/__init__.py +1 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/cost_tracker.py +194 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/evaluate/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/evaluate/claude_code.py +1117 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/evaluate/claude_code_skills.py +613 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/evaluate/mini_swe_agent.py +440 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/experiment_logger.py +367 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/swe_fitness_fn.py +209 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/swe_harness.py +352 -0
- package/vendor/gepa-python/src/gepa/gskill/gskill/train_optimize_anything.py +830 -0
- package/vendor/gepa-python/src/gepa/image.py +104 -0
- package/vendor/gepa-python/src/gepa/lm.py +261 -0
- package/vendor/gepa-python/src/gepa/logging/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/logging/experiment_tracker.py +457 -0
- package/vendor/gepa-python/src/gepa/logging/logger.py +75 -0
- package/vendor/gepa-python/src/gepa/logging/utils.py +130 -0
- package/vendor/gepa-python/src/gepa/optimize_anything.py +1701 -0
- package/vendor/gepa-python/src/gepa/proposer/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/proposer/base.py +53 -0
- package/vendor/gepa-python/src/gepa/proposer/merge.py +403 -0
- package/vendor/gepa-python/src/gepa/proposer/reflective_mutation/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/proposer/reflective_mutation/base.py +64 -0
- package/vendor/gepa-python/src/gepa/proposer/reflective_mutation/reflection_lm.py +178 -0
- package/vendor/gepa-python/src/gepa/proposer/reflective_mutation/reflective_mutation.py +641 -0
- package/vendor/gepa-python/src/gepa/py.typed +0 -0
- package/vendor/gepa-python/src/gepa/strategies/__init__.py +0 -0
- package/vendor/gepa-python/src/gepa/strategies/acceptance.py +66 -0
- package/vendor/gepa-python/src/gepa/strategies/batch_sampler.py +103 -0
- package/vendor/gepa-python/src/gepa/strategies/candidate_selector.py +82 -0
- package/vendor/gepa-python/src/gepa/strategies/component_selector.py +36 -0
- package/vendor/gepa-python/src/gepa/strategies/eval_policy.py +64 -0
- package/vendor/gepa-python/src/gepa/strategies/instruction_proposal.py +153 -0
- package/vendor/gepa-python/src/gepa/strategies/proposal_sampling.py +128 -0
- package/vendor/gepa-python/src/gepa/strategies/proposal_selection.py +84 -0
- package/vendor/gepa-python/src/gepa/utils/__init__.py +63 -0
- package/vendor/gepa-python/src/gepa/utils/code_execution.py +626 -0
- package/vendor/gepa-python/src/gepa/utils/stdio_capture.py +145 -0
- package/vendor/gepa-python/src/gepa/utils/stop_condition.py +230 -0
- package/vendor/gepa-python/src/gepa/visualization.py +359 -0
- package/vendor/orizu-gepa/pyproject.toml +18 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/__init__.py +9 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/__main__.py +5 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/adapter.py +138 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/callbacks.py +666 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/cli.py +7 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/engine.py +269 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/instruction_set_loader.py +52 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/preflight.py +64 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/reflection.py +186 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/runtime.py +721 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/skilled_proposer_bridge.py +381 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/stop_conditions.py +55 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/translator.py +203 -0
- package/vendor/orizu-gepa-python/pyproject.toml +1 -1
- package/vendor/orizu-gepa-python/src/orizu_gepa/cli.py +1 -0
- package/vendor/orizu-gepa-python/src/orizu_gepa/client.py +52 -7
- package/vendor/orizu-gepa-python/src/orizu_gepa/local_log.py +52 -0
- package/vendor/orizu-gepa-python/src/orizu_gepa/optimizer.py +10 -5
- package/vendor/orizu-gepa-python/src/orizu_gepa/reflection.py +323 -68
- package/vendor/orizu-gepa-python/src/orizu_gepa/runner.py +207 -13
- package/vendor/skills/orizu-cli/SKILL.md +3 -1
- package/vendor/skills/orizu-cli/references/cli-reference.md +85 -1
- package/vendor/skills/orizu-cli/references/migrate-existing-gepa-setup.md +303 -0
- package/vendor/skills/orizu-cli/references/optimization-reports.md +1 -1
- package/vendor/skills/orizu-cli/references/optimization-with-gepa.md +26 -1
- package/vendor/skills/orizu-cli/references/prompt-control-plane.md +113 -10
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared compact per-event digest renderer for workbench-run tails (ALI-1045).
|
|
3
|
+
*
|
|
4
|
+
* Used by BOTH `orizu run tail` (human mode) and the `--tail` attached to
|
|
5
|
+
* `orizu session start --hosted`, so the operator watching a live hosted run
|
|
6
|
+
* can see at a glance what the agent said, which tool it called with what
|
|
7
|
+
* args, and what came back — enough to spot a stall, an unanswerable question,
|
|
8
|
+
* or a misdirection within seconds, without a second terminal.
|
|
9
|
+
*
|
|
10
|
+
* THREAT MODEL: the sandboxed agent AUTHORS these payloads and this renderer
|
|
11
|
+
* writes to the OPERATOR'S terminal — treat every field as hostile.
|
|
12
|
+
*
|
|
13
|
+
* Contract:
|
|
14
|
+
* - ONE line per event, prefixed `#<sequence> <eventType>`.
|
|
15
|
+
* - Every field that reaches the output is capped (FIELD_MAX for tool /
|
|
16
|
+
* status / eventType, TOKEN_TEXT_MAX for prose/output, SUMMARY_MAX for
|
|
17
|
+
* args/JSON) and the WHOLE assembled line is bounded by LINE_MAX.
|
|
18
|
+
* - The final line is sanitized as the LAST step: all C0/C1 control bytes
|
|
19
|
+
* (ESC, BEL, backspace, CR/LF, DEL, 0x80-0x9F, …) are stripped, so a
|
|
20
|
+
* hostile payload can never emit terminal escape sequences (OSC-52
|
|
21
|
+
* clipboard writes, CSI clear/spoof) or extra lines at the operator; the
|
|
22
|
+
* same pass strips Unicode bidi controls, U+2028/U+2029 separators, and
|
|
23
|
+
* zero-width characters, so a payload cannot visually reorder, split, or
|
|
24
|
+
* spoof the line either (see CONTROL_CHARS).
|
|
25
|
+
* - Bounded work per event: raw strings are sliced to a working window of
|
|
26
|
+
* WORK_FACTOR x the display cap BEFORE any regex normalization; JSON
|
|
27
|
+
* summaries first take a BOUNDED PROJECTION of the payload (max
|
|
28
|
+
* PROJECTION_MAX_ITEMS entries per level, PROJECTION_MAX_DEPTH deep,
|
|
29
|
+
* PROJECTION_MAX_NODES containers) so JSON.stringify never traverses a
|
|
30
|
+
* payload-sized structure, then slice oversized string fields via the
|
|
31
|
+
* replacer — a megabyte payload costs O(display size), not O(payload).
|
|
32
|
+
* - NEVER throws: malformed payloads degrade to the bare `#<seq> <type>`
|
|
33
|
+
* line; hostile objects (throwing getters) degrade to `#? unknown`. Full
|
|
34
|
+
* fidelity stays in the JSON streams (`--json` on either command).
|
|
35
|
+
*
|
|
36
|
+
* Event payload shapes come from the hosted harness seam
|
|
37
|
+
* (hosted-harness-{claude,opencode}.ts → hosted-run-event-sink.ts):
|
|
38
|
+
* agent_token { messageId, text } (coalesced snapshot)
|
|
39
|
+
* agent_tool_call { tool, args, callId, status }
|
|
40
|
+
* agent_tool_result { callId, status, output[, tool] }
|
|
41
|
+
* agent_step_finish { cost, tokens, reason } (tokens shape varies)
|
|
42
|
+
*/
|
|
43
|
+
/** Max chars of streamed agent text / tool output shown per digest line. */
|
|
44
|
+
export declare const TOKEN_TEXT_MAX = 120;
|
|
45
|
+
/** Max chars of arg/JSON summaries shown per digest line. */
|
|
46
|
+
export declare const SUMMARY_MAX = 160;
|
|
47
|
+
/** Max chars for short identifier-ish fields: tool names, statuses, eventType. */
|
|
48
|
+
export declare const FIELD_MAX = 60;
|
|
49
|
+
/** Hard backstop for a whole assembled digest line (prefix + segments + slack). */
|
|
50
|
+
export declare const LINE_MAX = 360;
|
|
51
|
+
interface ProjectionState {
|
|
52
|
+
nodes: number;
|
|
53
|
+
seen: WeakSet<object>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build a bounded clone of a hostile payload BEFORE serialization, so
|
|
57
|
+
* JSON.stringify never traverses payload-sized structures (huge arrays, many
|
|
58
|
+
* properties, deep nesting): at most PROJECTION_MAX_ITEMS entries per level,
|
|
59
|
+
* PROJECTION_MAX_DEPTH levels, PROJECTION_MAX_NODES containers total. Cut
|
|
60
|
+
* points and repeated/cyclic references become the '…' marker. Exported for
|
|
61
|
+
* tests only.
|
|
62
|
+
*/
|
|
63
|
+
export declare function boundedJsonProjection(value: unknown, depth?: number, state?: ProjectionState): unknown;
|
|
64
|
+
/** The old (pre-ALI-1045) types-only line — kept for `--quiet`. */
|
|
65
|
+
export declare function formatRunEventTypeLine(event: unknown): string;
|
|
66
|
+
/**
|
|
67
|
+
* One compact human line for a workbench-run event: `#<seq> <type> <digest>`.
|
|
68
|
+
* Never throws; degrades to the bare `#<seq> <type>` line on any malformed or
|
|
69
|
+
* missing payload field, and to `#? unknown` when the envelope itself is
|
|
70
|
+
* hostile (throwing getters, revoked proxies).
|
|
71
|
+
*/
|
|
72
|
+
export declare function formatRunEventDigest(event: unknown): string;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=run-event-digest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-event-digest.d.ts","sourceRoot":"","sources":["../src/run-event-digest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,cAAc,MAAM,CAAA;AACjC,6DAA6D;AAC7D,eAAO,MAAM,WAAW,MAAM,CAAA;AAC9B,kFAAkF;AAClF,eAAO,MAAM,SAAS,KAAK,CAAA;AAC3B,mFAAmF;AACnF,eAAO,MAAM,QAAQ,MAAM,CAAA;AAyD3B,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,KAAK,SAAI,EACT,KAAK,GAAE,eAAmD,GACzD,OAAO,CA+BT;AA+ID,mEAAmE;AACnE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAO7D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAkB3D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ALI-1159 (ADR-007): ad-hoc `--runner-dir` bytes may only execute when they
|
|
3
|
+
* ARE a registered runner version. Runs that execute local runner bytes stamp
|
|
4
|
+
* a registered `runner_version_id` into every result record; before this
|
|
5
|
+
* guard, nothing tied those bytes to that version — a run could produce live
|
|
6
|
+
* Orizu records from runner bytes that were never registered or committed
|
|
7
|
+
* anywhere (the GEPA-adapter loss on orizu-workbench-demo). The check is the
|
|
8
|
+
* same deterministic-zip content sha the push paths record: identical
|
|
9
|
+
* directory bytes hash to the registered version's `content_sha256`.
|
|
10
|
+
*
|
|
11
|
+
* Lives outside index.ts per the CLI line ratchet (ALI-976).
|
|
12
|
+
*/
|
|
13
|
+
/** Test seam; defaults to the authenticated CLI fetcher. */
|
|
14
|
+
export interface VerifyRunnerDirInput {
|
|
15
|
+
runnerVersionId: string;
|
|
16
|
+
dir: string;
|
|
17
|
+
/** The CLI flag the dir arrived on (for the error message). */
|
|
18
|
+
flag: string;
|
|
19
|
+
fetcher?: (path: string, init?: RequestInit) => Promise<Response>;
|
|
20
|
+
}
|
|
21
|
+
export interface VerifiedRunnerSnapshot {
|
|
22
|
+
/**
|
|
23
|
+
* Temp directory holding EXACTLY the verified file set, materialized from
|
|
24
|
+
* the same in-memory bytes the hash covered (codex round 4 on #1447):
|
|
25
|
+
* execution from here is immune to post-hash mutation of the original dir,
|
|
26
|
+
* and hash-excluded entries (.env, .git, .orizu, caches, symlinks) simply
|
|
27
|
+
* do not exist at runtime.
|
|
28
|
+
*/
|
|
29
|
+
snapshotDir: string;
|
|
30
|
+
cleanup: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function verifyRunnerDirRegistered(input: VerifyRunnerDirInput): Promise<VerifiedRunnerSnapshot>;
|
|
33
|
+
/**
|
|
34
|
+
* The runner contract executes `manifest.json`'s `command` with cwd at the
|
|
35
|
+
* artifact root. Every command entry must stay INSIDE the snapshot: absolute
|
|
36
|
+
* entries and `..` escapes are refused (a bare program name like `node` is
|
|
37
|
+
* PATH-resolved — interpreters are environment, not artifact bytes). Missing
|
|
38
|
+
* or malformed manifests are refused here too, so no snapshot can outlive a
|
|
39
|
+
* runner that could never execute.
|
|
40
|
+
*/
|
|
41
|
+
export declare function assertSnapshotManifestConfined(snapshotDir: string, flag: string): void;
|
|
42
|
+
/** Extract a flag value accepting BOTH argparse forms: `--flag value` and
|
|
43
|
+
* `--flag=value` (codex P1 on #1447 — the equals form bypassed `getArg`). */
|
|
44
|
+
export declare function extractFlagValue(args: string[], flag: string): string | null;
|
|
45
|
+
export interface GepaVerifiedArgs {
|
|
46
|
+
/** The forwarded argv with each runner-dir flag REWRITTEN to its verified
|
|
47
|
+
* snapshot path — Python executes the hashed bytes, not the mutable dir. */
|
|
48
|
+
args: string[];
|
|
49
|
+
/** The snapshot dirs, for the ORIZU_VERIFIED_RUNNER_DIRS handshake. */
|
|
50
|
+
verifiedDirs: string[];
|
|
51
|
+
cleanup: () => void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Verify the run-gepa wrapper's two ad-hoc runner dirs (candidate + scorer)
|
|
55
|
+
* against the FORWARDED argv before the Python optimizer is spawned —
|
|
56
|
+
* scanning the same tokens Python will parse, in both argparse forms, so no
|
|
57
|
+
* spelling of the flags can slip past verification. FAIL-CLOSED: if either
|
|
58
|
+
* half of a pair is present but the pair is incomplete, the wrapper refuses
|
|
59
|
+
* here rather than forwarding an unverified pair to argparse. A pair that is
|
|
60
|
+
* entirely absent is left to the Python CLI's required-argument validation —
|
|
61
|
+
* it cannot execute without both. On success each dir flag is REWRITTEN to
|
|
62
|
+
* the verified snapshot (codex round 4): the optimizer runs the exact hashed
|
|
63
|
+
* bytes, immune to post-hash mutation of the original dirs.
|
|
64
|
+
*/
|
|
65
|
+
export declare function verifyGepaRunnerDirsFromArgs(args: string[], fetcher?: (path: string, init?: RequestInit) => Promise<Response>): Promise<GepaVerifiedArgs>;
|
|
66
|
+
//# sourceMappingURL=runner-dir-verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-dir-verify.d.ts","sourceRoot":"","sources":["../src/runner-dir-verify.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;GAWG;AA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modelConfig: Record<string, unknown>;
|
|
5
|
+
shape: string[];
|
|
6
|
+
profileVersionId: string;
|
|
7
|
+
modelConfigSettingsVersionId?: string;
|
|
8
|
+
versionNumber: number;
|
|
9
|
+
promptComponentKey?: string;
|
|
10
|
+
components: Record<string, string>;
|
|
11
|
+
pinnedComponents?: Record<string, {
|
|
12
|
+
repoPath: string;
|
|
13
|
+
contentSha: string;
|
|
14
|
+
commitSha: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export declare function runnerInstructionSetSyncSet(instructionSet: RunnerInstructionSet): SyncSet;
|
|
18
|
+
export declare function runnerInputPrompt(promptContext: {
|
|
19
|
+
body?: string | null;
|
|
20
|
+
bodyKind: string;
|
|
21
|
+
providerSettings: Record<string, unknown>;
|
|
22
|
+
}): Record<string, unknown>;
|
|
23
|
+
export declare function runnerInputInstructionSet(instructionSet: RunnerInstructionSet): Record<string, unknown>;
|
|
24
|
+
//# sourceMappingURL=runner-instruction-set-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-instruction-set-contract.d.ts","sourceRoot":"","sources":["../src/runner-instruction-set-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAE5E,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,4BAA4B,CAAC,EAAE,MAAM,CAAA;IACrC,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC/F;AAED,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,oBAAoB,GAAG,OAAO,CAwBzF;AAED,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACnG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AAED,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUvG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export function runnerInstructionSetSyncSet(instructionSet) {
|
|
2
|
+
const modelConfigIdentity = typeof instructionSet.modelConfig.identity === 'string'
|
|
3
|
+
? instructionSet.modelConfig.identity
|
|
4
|
+
: '';
|
|
5
|
+
if (!modelConfigIdentity)
|
|
6
|
+
throw new Error('Runner exec context instruction set has no model config identity');
|
|
7
|
+
const missingKey = instructionSet.shape.find(key => !(key in instructionSet.components) && !(key in (instructionSet.pinnedComponents || {})));
|
|
8
|
+
if (missingKey)
|
|
9
|
+
throw new Error('instruction_set_tuple_incomplete');
|
|
10
|
+
const components = Object.fromEntries(Object.entries(instructionSet.components).map(([key, body]) => [key, { body }]));
|
|
11
|
+
for (const [key, pin] of Object.entries(instructionSet.pinnedComponents || {}))
|
|
12
|
+
components[key] = pin;
|
|
13
|
+
const material = {
|
|
14
|
+
profileVersionId: instructionSet.profileVersionId,
|
|
15
|
+
versionNumber: instructionSet.versionNumber,
|
|
16
|
+
modelConfigIdentity,
|
|
17
|
+
// syncToDisk's long-lived manifest requires provenance; this execution
|
|
18
|
+
// path has no resolver decision to expose, only an exact profile version.
|
|
19
|
+
resolvedFrom: 'exact_profile_version',
|
|
20
|
+
components,
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
name: instructionSet.name,
|
|
24
|
+
shape: instructionSet.shape,
|
|
25
|
+
default: material,
|
|
26
|
+
profiles: [{ modelConfigIdentity, resolvedFrom: 'exact_profile_version', production: material }],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function runnerInputPrompt(promptContext) {
|
|
30
|
+
const prompt = {
|
|
31
|
+
body_kind: promptContext.bodyKind,
|
|
32
|
+
provider_settings: promptContext.providerSettings,
|
|
33
|
+
};
|
|
34
|
+
// The route owns this decision. Preserve its response shape exactly so an
|
|
35
|
+
// implicit wrapped prompt remains compatible with existing runners.
|
|
36
|
+
if ('body' in promptContext)
|
|
37
|
+
prompt.body = promptContext.body;
|
|
38
|
+
return prompt;
|
|
39
|
+
}
|
|
40
|
+
export function runnerInputInstructionSet(instructionSet) {
|
|
41
|
+
return {
|
|
42
|
+
name: instructionSet.name,
|
|
43
|
+
model_config: instructionSet.modelConfig,
|
|
44
|
+
shape: instructionSet.shape,
|
|
45
|
+
...(instructionSet.modelConfigSettingsVersionId ? { model_config_settings_version_id: instructionSet.modelConfigSettingsVersionId } : {}),
|
|
46
|
+
...(instructionSet.promptComponentKey ? { prompt_component_key: instructionSet.promptComponentKey } : {}),
|
|
47
|
+
components: instructionSet.components,
|
|
48
|
+
...(Object.keys(instructionSet.pinnedComponents || {}).length > 0 ? { pinned_components: instructionSet.pinnedComponents } : {}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral sandbox token-hygiene sweep (ALI-973 / ALI-1050).
|
|
3
|
+
*
|
|
4
|
+
* Extracted out of `daytona-slice.ts` so the hygiene helper carries NO Daytona
|
|
5
|
+
* coupling: it works against any `SandboxProvider`/`SandboxSession` (ADR-003
|
|
6
|
+
* seam) and is imported by the shipped hosted-bootstrap path (`hosted-bootstrap
|
|
7
|
+
* .ts`) as well as the founder-only Daytona slice. Keeping it here means the
|
|
8
|
+
* shipped code never transitively reaches the optional `@daytonaio/sdk`.
|
|
9
|
+
*/
|
|
10
|
+
import type { SandboxSession } from './sandbox-provider.js';
|
|
11
|
+
export interface HygieneFinding {
|
|
12
|
+
location: string;
|
|
13
|
+
marker: string;
|
|
14
|
+
}
|
|
15
|
+
export interface HygieneProbe {
|
|
16
|
+
location: string;
|
|
17
|
+
/** Shell command whose stdout is scanned for tokens + markers. */
|
|
18
|
+
command: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The list of places a short-lived git token can leak inside a sandbox after a
|
|
22
|
+
* transient clone+push. List-driven so it is trivial to extend. `${repo}` is
|
|
23
|
+
* substituted with the repo path. Ordered from the repo-local stores outward to
|
|
24
|
+
* global config, the credential cache, the reflog, shell history, and the live
|
|
25
|
+
* process listing / argv — the exact surfaces the Daytona-support question names.
|
|
26
|
+
*/
|
|
27
|
+
export declare function tokenLeakProbes(repoPath: string): HygieneProbe[];
|
|
28
|
+
/**
|
|
29
|
+
* Grep the sandbox filesystem + process table for token values and the
|
|
30
|
+
* `x-access-token` marker across every known leak surface (see `tokenLeakProbes`).
|
|
31
|
+
* Returns every finding; an empty array means the transient operations left no
|
|
32
|
+
* residue. This is the load-bearing check the whole slice exists to make.
|
|
33
|
+
*
|
|
34
|
+
* NOTE (local-sim): the reflog/config/credential-store/history probes run
|
|
35
|
+
* meaningfully in local-sim, but `ps`/argv coverage is only decisive on the live
|
|
36
|
+
* Daytona run (local-sim runs the git clone via a child process on the host, not
|
|
37
|
+
* inside an isolated PID namespace). The WS-F memo marks that probe live-only.
|
|
38
|
+
*/
|
|
39
|
+
export declare function sweepForTokenResidue(session: SandboxSession, opts: {
|
|
40
|
+
tokens: string[];
|
|
41
|
+
repoPath: string;
|
|
42
|
+
markers?: string[];
|
|
43
|
+
probes?: HygieneProbe[];
|
|
44
|
+
}): Promise<HygieneFinding[]>;
|
|
45
|
+
//# sourceMappingURL=sandbox-hygiene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-hygiene.d.ts","sourceRoot":"","sources":["../src/sandbox-hygiene.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,EAAE,CAYhE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;CAAE,GACxF,OAAO,CAAC,cAAc,EAAE,CAAC,CAoB3B"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orizu-owned sandbox provider seam (ALI-973 / WS-F, per ADR-003).
|
|
3
|
+
*
|
|
4
|
+
* ADR-003 requires every provider call (GitHub, Daytona) to sit behind an
|
|
5
|
+
* Orizu-owned interface so the durable contracts never couple to whichever SDK
|
|
6
|
+
* wins the quarter. This module defines `SandboxProvider` / `SandboxSession` and
|
|
7
|
+
* ships two implementations:
|
|
8
|
+
*
|
|
9
|
+
* - `createDaytonaProvider(config)` — a THIN adapter over the Daytona
|
|
10
|
+
* TypeScript SDK (`@daytonaio/sdk`). The SDK is imported LAZILY (dynamic
|
|
11
|
+
* import through a non-literal specifier) so the CLI works without it
|
|
12
|
+
* installed, the app build never resolves it, and tests never load it.
|
|
13
|
+
* - `createLocalSimProvider(config)` — a temp-dir + real-`git`-subprocess
|
|
14
|
+
* simulation used by the unit tests AND by the no-credentials local-sim
|
|
15
|
+
* rehearsal. It is a genuine rehearsal (real clone/commit/push against a
|
|
16
|
+
* local bare repo), not a mock.
|
|
17
|
+
*
|
|
18
|
+
* SDK-vs-docs note (verified against daytona.io/docs, 2026-07-02): the real
|
|
19
|
+
* `git.clone` signature is
|
|
20
|
+
* clone(url, path, branch?, commitId?, username?, password?, insecureSkipTls?)
|
|
21
|
+
* i.e. a `commitId` argument sits BETWEEN `branch` and `username` — the ALI-973
|
|
22
|
+
* brief documented `clone(url, path, branch, username, password)`. The adapter
|
|
23
|
+
* passes `undefined` for `commitId` so the Orizu seam keeps its clean per-call
|
|
24
|
+
* credential shape. `git.push(path, username?, password?)` matches the brief.
|
|
25
|
+
*/
|
|
26
|
+
export interface ExecResult {
|
|
27
|
+
stdout: string;
|
|
28
|
+
exitCode: number;
|
|
29
|
+
/** Captured standard error, when the provider exposes it — surfaced so a
|
|
30
|
+
* failed git clone/push does not vanish behind a masked exit code. */
|
|
31
|
+
stderr?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface GitCloneParams {
|
|
34
|
+
url: string;
|
|
35
|
+
path: string;
|
|
36
|
+
branch?: string;
|
|
37
|
+
username?: string;
|
|
38
|
+
password?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface GitPushParams {
|
|
41
|
+
path: string;
|
|
42
|
+
username?: string;
|
|
43
|
+
password?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A single request transform a provider firewall applies to matching egress
|
|
47
|
+
* (the credential-brokering seam: inject a header at the proxy so the raw
|
|
48
|
+
* secret never enters the sandbox). Structurally identical to @vercel/sandbox's
|
|
49
|
+
* `NetworkPolicyRule` so a Vercel adapter can pass it straight through, but
|
|
50
|
+
* declared here so the Orizu seam owns the shape (ADR-003).
|
|
51
|
+
*/
|
|
52
|
+
export interface SandboxEgressRule {
|
|
53
|
+
transform?: {
|
|
54
|
+
headers?: Record<string, string>;
|
|
55
|
+
}[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Provider-neutral egress/network policy, wired to the sandbox firewall AT
|
|
59
|
+
* CREATE. G5 (ALI-1006) owns the allowlist CONTENT; this slice only plumbs the
|
|
60
|
+
* option so the orchestrator can pass a policy (incl. a credential-injection
|
|
61
|
+
* transform for a model endpoint). `'allow-all'` is the provider default when
|
|
62
|
+
* omitted. Structurally compatible with @vercel/sandbox's `NetworkPolicy`.
|
|
63
|
+
*/
|
|
64
|
+
export type SandboxEgressPolicy = 'allow-all' | 'deny-all' | {
|
|
65
|
+
allow?: string[] | Record<string, SandboxEgressRule[]>;
|
|
66
|
+
subnets?: {
|
|
67
|
+
allow?: string[];
|
|
68
|
+
deny?: string[];
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export interface SandboxCreateOpts {
|
|
72
|
+
language?: string;
|
|
73
|
+
snapshot?: string;
|
|
74
|
+
envVars?: Record<string, string>;
|
|
75
|
+
labels?: Record<string, string>;
|
|
76
|
+
/** Sandbox auto-terminate timeout (ms). Honored where the provider supports a
|
|
77
|
+
* configurable session length (Vercel); ignored by providers that do not. */
|
|
78
|
+
timeoutMs?: number;
|
|
79
|
+
/** Provider runtime image hint (e.g. Vercel 'node24'); provider-specific. */
|
|
80
|
+
runtime?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Provider custom-image ref (e.g. Vercel VCR 'orizu-hosted-runtime:<tag>').
|
|
83
|
+
* When set, the provider creates the sandbox from this pre-baked image instead
|
|
84
|
+
* of the base runtime (ALI-1017). Provider-specific — Vercel honors it; other
|
|
85
|
+
* providers ignore it. `runtime` is still the base-runtime hint when no image
|
|
86
|
+
* is given.
|
|
87
|
+
*/
|
|
88
|
+
image?: string;
|
|
89
|
+
/** vCPUs to allocate (memory scales with vCPUs on Vercel: 2048 MiB each). */
|
|
90
|
+
vcpus?: number;
|
|
91
|
+
/** Ports to expose from the sandbox (provider-specific; up to 4 on Vercel). */
|
|
92
|
+
ports?: number[];
|
|
93
|
+
/** Egress/firewall policy applied at create (G5 supplies content). */
|
|
94
|
+
egressPolicy?: SandboxEgressPolicy;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A live sandbox. Per-call git credentials mirror Daytona's contract (and
|
|
98
|
+
* OpenInspect's credential-helper shape): the token is handed to each operation,
|
|
99
|
+
* never written once per session.
|
|
100
|
+
*/
|
|
101
|
+
export interface SandboxSession {
|
|
102
|
+
readonly id: string;
|
|
103
|
+
gitClone(params: GitCloneParams): Promise<void>;
|
|
104
|
+
gitPush(params: GitPushParams): Promise<void>;
|
|
105
|
+
exec(command: string, opts?: {
|
|
106
|
+
cwd?: string;
|
|
107
|
+
}): Promise<ExecResult>;
|
|
108
|
+
readFile(path: string): Promise<string>;
|
|
109
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
110
|
+
fileExists(path: string): Promise<boolean>;
|
|
111
|
+
destroy(): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Extend the sandbox's auto-terminate timeout by `durationMs` (keepalive).
|
|
114
|
+
* OPTIONAL: only providers with a configurable session length implement it
|
|
115
|
+
* (Vercel). Host-side token rotation uses it to keep a long session alive
|
|
116
|
+
* beyond the provider's default. Absent on local-sim / Daytona.
|
|
117
|
+
*/
|
|
118
|
+
extendTimeout?(durationMs: number): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Snapshot the running sandbox's filesystem state and RETURN the snapshot id
|
|
121
|
+
* (ALI-1017). A new sandbox can then boot from it via `createSandbox({ snapshot })`
|
|
122
|
+
* — the zero-Docker "prebaked runtime" path (parallel to a VCR `image`).
|
|
123
|
+
* OPTIONAL: only providers with a snapshot API implement it (Vercel); absent on
|
|
124
|
+
* local-sim / Daytona. NOTE: the provider may STOP this sandbox as part of the
|
|
125
|
+
* snapshot (Vercel does), so treat the session as spent afterwards.
|
|
126
|
+
*
|
|
127
|
+
* `expiration` is an optional TTL (ms) for the snapshot; 0 = never expire.
|
|
128
|
+
*/
|
|
129
|
+
snapshot?(opts?: {
|
|
130
|
+
expiration?: number;
|
|
131
|
+
}): Promise<string>;
|
|
132
|
+
}
|
|
133
|
+
export type SandboxProviderKind = 'daytona' | 'local-sim' | 'vercel';
|
|
134
|
+
export interface SandboxProvider {
|
|
135
|
+
readonly kind: SandboxProviderKind;
|
|
136
|
+
createSandbox(opts?: SandboxCreateOpts): Promise<SandboxSession>;
|
|
137
|
+
}
|
|
138
|
+
export interface DaytonaProviderConfig {
|
|
139
|
+
apiKey: string;
|
|
140
|
+
apiUrl?: string;
|
|
141
|
+
target?: string;
|
|
142
|
+
}
|
|
143
|
+
interface DaytonaSdkSandbox {
|
|
144
|
+
id: string;
|
|
145
|
+
git: {
|
|
146
|
+
clone(url: string, path: string, branch?: string, commitId?: string, username?: string, password?: string, insecureSkipTls?: boolean): Promise<void>;
|
|
147
|
+
push(path: string, username?: string, password?: string): Promise<void>;
|
|
148
|
+
};
|
|
149
|
+
process: {
|
|
150
|
+
executeCommand(command: string, cwd?: string, env?: Record<string, string>, timeout?: number): Promise<{
|
|
151
|
+
exitCode?: number;
|
|
152
|
+
result?: string;
|
|
153
|
+
stderr?: string;
|
|
154
|
+
artifacts?: {
|
|
155
|
+
stdout?: string;
|
|
156
|
+
stderr?: string;
|
|
157
|
+
};
|
|
158
|
+
}>;
|
|
159
|
+
};
|
|
160
|
+
fs: {
|
|
161
|
+
downloadFile(remotePath: string): Promise<Uint8Array | Buffer | string>;
|
|
162
|
+
uploadFile(file: Uint8Array, remotePath: string): Promise<void>;
|
|
163
|
+
getFileDetails(path: string): Promise<unknown>;
|
|
164
|
+
};
|
|
165
|
+
delete(timeout?: number): Promise<void>;
|
|
166
|
+
}
|
|
167
|
+
interface DaytonaSdkClient {
|
|
168
|
+
create(params?: Record<string, unknown>, options?: {
|
|
169
|
+
timeout: number;
|
|
170
|
+
}): Promise<DaytonaSdkSandbox>;
|
|
171
|
+
}
|
|
172
|
+
export interface DaytonaSdkModule {
|
|
173
|
+
Daytona: new (config: {
|
|
174
|
+
apiKey: string;
|
|
175
|
+
apiUrl?: string;
|
|
176
|
+
target?: string;
|
|
177
|
+
}) => DaytonaSdkClient;
|
|
178
|
+
}
|
|
179
|
+
/** Test seam: inject a fake SDK module so the adapter's request mapping can be
|
|
180
|
+
* exercised without the real package installed or a network. */
|
|
181
|
+
export interface DaytonaProviderDeps {
|
|
182
|
+
loadModule?: () => Promise<DaytonaSdkModule>;
|
|
183
|
+
}
|
|
184
|
+
export declare function createDaytonaProvider(config: DaytonaProviderConfig, deps?: DaytonaProviderDeps): SandboxProvider;
|
|
185
|
+
export interface LocalSimProviderConfig {
|
|
186
|
+
/** Parent directory for per-sandbox temp dirs (defaults to the OS tmpdir). */
|
|
187
|
+
rootDir?: string;
|
|
188
|
+
/** Skip filesystem teardown on destroy() (used by --keep for debugging). */
|
|
189
|
+
keepOnDestroy?: boolean;
|
|
190
|
+
}
|
|
191
|
+
export declare function createLocalSimProvider(config?: LocalSimProviderConfig): SandboxProvider;
|
|
192
|
+
export {};
|
|
193
|
+
//# sourceMappingURL=sandbox-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-provider.d.ts","sourceRoot":"","sources":["../src/sandbox-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB;2EACuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAA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C;AAED,UAAU,gBAAgB;IACxB,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;CACpG;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,KAAK,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,gBAAgB,CAAA;CAChG;AAED;iEACiE;AACjE,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC7C;AAyGD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,IAAI,GAAE,mBAAwB,GAC7B,eAAe,CA0CjB;AAID,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAkFD,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,sBAA2B,GAAG,eAAe,CAY3F"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-007 P5 (ALI-1074): the session-scoped, commit-first scorer push.
|
|
3
|
+
*
|
|
4
|
+
* `orizu scorers register --session <id>` creates the version through
|
|
5
|
+
* POST /api/cli/scorers/drafts: the server commits the scorer's canonical
|
|
6
|
+
* `manifest.json` to the session's `orizu/session-*` branch (one Git Data API
|
|
7
|
+
* commit) and then writes a DRAFT row pinning
|
|
8
|
+
* repo_path/content_sha/commit_sha. The draft seals — and gets its version
|
|
9
|
+
* number — when the session branch merges via `orizu session finish` +
|
|
10
|
+
* promotion-manifest apply.
|
|
11
|
+
*
|
|
12
|
+
* The git filename is ALWAYS `manifest.json`: the server read side
|
|
13
|
+
* (lib/artifact-git-read.ts SCORER_MANIFEST_FILENAMES) prefers that name.
|
|
14
|
+
*
|
|
15
|
+
* Lives outside index.ts per the CLI line ratchet (ALI-976); mirrors
|
|
16
|
+
* prompt-draft-push.ts.
|
|
17
|
+
*/
|
|
18
|
+
/** index.ts helpers injected by the command dispatcher (report-comments-cli
|
|
19
|
+
* precedent: command modules receive a ctx instead of importing the CLI
|
|
20
|
+
* entrypoint). */
|
|
21
|
+
export interface ScorersRegisterContext {
|
|
22
|
+
getArg: (name: string) => string | null;
|
|
23
|
+
resolveProjectSlug: (projectArg: string | null) => Promise<string>;
|
|
24
|
+
readJsonFile: (pathArg: string) => Record<string, unknown>;
|
|
25
|
+
hasJsonFlag: () => boolean;
|
|
26
|
+
printJson: (value: Record<string, unknown>) => void;
|
|
27
|
+
printLine: (message?: string) => void;
|
|
28
|
+
parseJsonResponse: (response: Response, label: string) => Promise<Record<string, unknown>>;
|
|
29
|
+
}
|
|
30
|
+
/** The full `orizu scorers register` command (moved out of index.ts for the
|
|
31
|
+
* CLI line ratchet): --session takes the ADR-007 P5 commit-first draft path,
|
|
32
|
+
* sessionless stays on the legacy create endpoint. */
|
|
33
|
+
export declare function runScorersRegister(ctx: ScorersRegisterContext): Promise<void>;
|
|
34
|
+
export interface PushScorerDraftInput {
|
|
35
|
+
project: string;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
name: string;
|
|
38
|
+
/** The parsed scorer manifest (the artifact's canonical bytes). */
|
|
39
|
+
manifest: Record<string, unknown>;
|
|
40
|
+
promptVersionId?: string;
|
|
41
|
+
runnerVersionId?: string;
|
|
42
|
+
/** Test seam; defaults to the authenticated CLI fetcher. */
|
|
43
|
+
fetcher?: (path: string, init?: RequestInit) => Promise<Response>;
|
|
44
|
+
}
|
|
45
|
+
export interface PushScorerDraftResult {
|
|
46
|
+
data: Record<string, unknown>;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function pushScorerDraft(input: PushScorerDraftInput): Promise<PushScorerDraftResult>;
|
|
50
|
+
//# sourceMappingURL=scorer-draft-push.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scorer-draft-push.d.ts","sourceRoot":"","sources":["../src/scorer-draft-push.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH;;kBAEkB;AAClB,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;IACvC,kBAAkB,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAClE,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC1D,WAAW,EAAE,MAAM,OAAO,CAAA;IAC1B,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACnD,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAC3F;AAED;;sDAEsD;AACtD,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyDnF;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CAClE;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAsCjG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `orizu scorers` subcommand router (ALI-1554).
|
|
3
|
+
*
|
|
4
|
+
* The five historical branches lived inline in index.ts; folding them here
|
|
5
|
+
* reclaims the headroom the CLI line ratchet (ALI-976) requires before a new
|
|
6
|
+
* subcommand may be added. Behaviour is unchanged: each handler is the same
|
|
7
|
+
* function index.ts already called, and an unrecognised subcommand returns
|
|
8
|
+
* null so main() still falls through to printUsage().
|
|
9
|
+
*/
|
|
10
|
+
export interface ScorersCommandIo {
|
|
11
|
+
list: () => Promise<void>;
|
|
12
|
+
register: () => Promise<void>;
|
|
13
|
+
detail: () => Promise<void>;
|
|
14
|
+
labelsSet: () => Promise<void>;
|
|
15
|
+
exec: () => Promise<void>;
|
|
16
|
+
verifyParity: (args: string[]) => Promise<number>;
|
|
17
|
+
}
|
|
18
|
+
/** Returns the process exit code, or null when the subcommand is not ours. */
|
|
19
|
+
export declare function scorersCommand(args: string[], io: ScorersCommandIo): Promise<number | null>;
|
|
20
|
+
//# sourceMappingURL=scorers-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scorers-cli.d.ts","sourceRoot":"","sources":["../src/scorers-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAClD;AAED,8EAA8E;AAC9E,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBjG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Returns the process exit code, or null when the subcommand is not ours. */
|
|
2
|
+
export async function scorersCommand(args, io) {
|
|
3
|
+
const subcommand = args[1];
|
|
4
|
+
// A Map, not an object literal: `scorers constructor` must not resolve to
|
|
5
|
+
// an Object.prototype member and be treated as a known subcommand.
|
|
6
|
+
const handlers = new Map([
|
|
7
|
+
['list', io.list], ['register', io.register], ['detail', io.detail], ['exec', io.exec],
|
|
8
|
+
]);
|
|
9
|
+
const handler = subcommand === undefined ? undefined : handlers.get(subcommand);
|
|
10
|
+
if (handler) {
|
|
11
|
+
await handler();
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
if (subcommand === 'labels' && args[2] === 'set') {
|
|
15
|
+
await io.labelsSet();
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
if (subcommand === 'verify-parity') {
|
|
19
|
+
return io.verifyParity(args.slice(2));
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The customer-side half of `orizu scorers verify-parity` (ALI-1554).
|
|
3
|
+
*
|
|
4
|
+
* Embedded as a string constant and written to a temp file at run time on
|
|
5
|
+
* purpose: no packaging (`files`/`vendor`) change, so there is nothing for the
|
|
6
|
+
* published tarball to lose. It runs in the CUSTOMER's interpreter and the
|
|
7
|
+
* customer's unscrubbed environment — it is their metric in their process.
|
|
8
|
+
*
|
|
9
|
+
* Contract: reads `{rows: [{row_id, row, model_output}]}` from
|
|
10
|
+
* ORIZU_PARITY_INPUT_PATH, calls `<module>:<function>(row, model_output)` per
|
|
11
|
+
* row, and writes `{scores: [{row_id, score} | {row_id, error}]}` to
|
|
12
|
+
* ORIZU_PARITY_OUTPUT_PATH. Exit 2 (with the reason on stderr) means the check
|
|
13
|
+
* could not run at all; a per-row exception is that row's error, not an abort.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PARITY_BRIDGE_SOURCE = "import json, math, os, sys, traceback\n\n\ndef fail(message):\n sys.stderr.write(message + \"\\n\")\n sys.exit(2)\n\n\ndef last_line(text):\n lines = [line for line in text.strip().splitlines() if line.strip()]\n return lines[-1] if lines else \"unknown error\"\n\n\ndef extract(value):\n # Mirrors orizu_gepa.optimizer._score_from_scorer, minus the clamp: the\n # CLI clamps both sides so the compared number is what GEPA optimizes.\n # bool is deliberately NOT rejected: measured, _score_from_scorer(extra=\n # {'score': True}) -> (1.0, None) and False -> (0.0, None), because bool is an\n # int subclass and Python's numeric branch accepts it. An exact-match DSPy\n # metric returning True must compare, not error.\n if isinstance(value, (int, float)):\n raw = value\n elif isinstance(value, dict):\n raw = value.get(\"score\")\n if raw is None and isinstance(value.get(\"model_response\"), dict):\n raw = value[\"model_response\"].get(\"score\")\n elif hasattr(value, \"score\"):\n # official GEPA's EvaluationResult NamedTuple and friends;\n # objective_scores is deliberately ignored.\n raw = value.score\n else:\n raise TypeError(\"scorer result must be a number, a dict with a numeric 'score', or an object with a numeric .score attribute\")\n if isinstance(raw, str):\n raw = float(raw)\n if not isinstance(raw, (int, float)):\n raise TypeError(\"scorer result must include a numeric score\")\n raw = float(raw)\n if not math.isfinite(raw):\n raise ValueError(\"scorer result score must be finite\")\n return raw\n\n\ntarget = os.environ.get(\"ORIZU_PARITY_ORIGINAL\", \"\")\nmodule_name, separator, function_name = target.partition(\":\")\nif not separator or not module_name or not function_name:\n fail(\"--original must be <module>:<function> (got %r)\" % target)\n\n# The customer's metric lives beside the command's cwd, not beside this\n# generated bridge file, so cwd must win over the script directory.\nsys.path.insert(0, os.getcwd())\ntry:\n import importlib\n\n module = importlib.import_module(module_name)\nexcept Exception:\n fail(\"Failed to import original metric module '%s': %s\" % (module_name, last_line(traceback.format_exc())))\n\nif not hasattr(module, function_name):\n fail(\"Original metric module '%s' has no attribute '%s'\" % (module_name, function_name))\nmetric = getattr(module, function_name)\nif not callable(metric):\n fail(\"Original metric '%s:%s' is not callable\" % (module_name, function_name))\n\nwith open(os.environ[\"ORIZU_PARITY_INPUT_PATH\"], encoding=\"utf-8\") as handle:\n payload = json.load(handle)\n\nscores = []\nfor item in payload[\"rows\"]:\n try:\n scores.append({\"row_id\": item[\"row_id\"], \"score\": extract(metric(item[\"row\"], item[\"model_output\"]))})\n except Exception:\n scores.append({\"row_id\": item[\"row_id\"], \"error\": last_line(traceback.format_exc())})\n\nwith open(os.environ[\"ORIZU_PARITY_OUTPUT_PATH\"], \"w\", encoding=\"utf-8\") as handle:\n json.dump({\"scores\": scores}, handle)\n";
|
|
16
|
+
//# sourceMappingURL=scorers-verify-parity-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scorers-verify-parity-bridge.d.ts","sourceRoot":"","sources":["../src/scorers-verify-parity-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,8lGA2EhC,CAAA"}
|