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
package/src/index.ts
CHANGED
|
@@ -66,11 +66,15 @@ import {
|
|
|
66
66
|
workspaceExists,
|
|
67
67
|
} from './workspace.js'
|
|
68
68
|
import { connectorsCommand } from './connectors-cli.js'
|
|
69
|
+
import { modelConfigsCommand } from './model-configs-cli.js'
|
|
69
70
|
import { ARTIFACT_MAX_BYTES, runnerOptimizerCommand } from './artifact-pull.js'
|
|
70
71
|
import { killSwitchCommand } from './kill-switch-cli.js'
|
|
71
72
|
import { egressAllowlistCommand } from './egress-allowlist-cli.js'
|
|
72
73
|
import { acceptScoreRunCommand } from './scores-accept-cli.js'
|
|
73
74
|
import { listOptimizationRunsCommand } from './optimizations-list-cli.js'
|
|
75
|
+
import { promoteOptimizationCommand } from './optimizations-promote-cli.js'
|
|
76
|
+
import { scorersCommand } from './scorers-cli.js'
|
|
77
|
+
import { verifyScorerParityCommand } from './scorers-verify-parity.js'
|
|
74
78
|
import {
|
|
75
79
|
archiveArtifactCommand,
|
|
76
80
|
listAssignmentsCommand,
|
|
@@ -85,9 +89,12 @@ import { workbenchCommand } from './workbench-cli.js'
|
|
|
85
89
|
import { hostedCommand } from './hosted-session-cli.js'
|
|
86
90
|
import { workspaceSyncCommand } from './workspace-sync.js'
|
|
87
91
|
import { runGitCredentialInvocation } from './git-credential.js'
|
|
92
|
+
import { instructionSetsCommand, syncToDisk } from './instruction-sets-cli.js'; export { loadInstructionSet } from './instruction-set-loader.js'
|
|
93
|
+
import { runnerInputInstructionSet, runnerInputPrompt, runnerInstructionSetSyncSet, type RunnerInstructionSet } from './runner-instruction-set-contract.js'
|
|
88
94
|
import { pushPromptDraft } from './prompt-draft-push.js'
|
|
89
95
|
import { readMarkdownReportInput } from './markdown-report-input.js'
|
|
90
96
|
import { promptPushErrorMessage, promptReportCommand } from './prompt-report-cli.js'
|
|
97
|
+
import { setPromptLabel } from './prompt-label-cli.js'
|
|
91
98
|
import { printPromptSummaryTable } from './prompt-summary-table.js'
|
|
92
99
|
import type {
|
|
93
100
|
CliLengthMeasurementUnavailableReason,
|
|
@@ -98,6 +105,7 @@ import { runScorersRegister } from './scorer-draft-push.js'
|
|
|
98
105
|
import { runZipArtifactPush } from './zip-draft-push.js'
|
|
99
106
|
import { type GithubLinkResult, runGithubLink, runInteractiveHostedSetup } from './github-setup.js'
|
|
100
107
|
import { parseJsonResponse, sanitizeTerminalText } from './json-response.js'
|
|
108
|
+
import { reportReplacementWarning } from './report-replacement-warning.js'
|
|
101
109
|
import {
|
|
102
110
|
reportCommentsCommand,
|
|
103
111
|
throwDeprecatedPromptCommentsCommand,
|
|
@@ -105,6 +113,11 @@ import {
|
|
|
105
113
|
} from './report-comments-cli.js'
|
|
106
114
|
import { diffCommentsCommand } from './diff-comments-cli.js'
|
|
107
115
|
import { exportOptimizationRunCommand } from './optimization-export-cli.js'
|
|
116
|
+
import { dispatchGepaEngine } from './gepa-engine-dispatch.js'
|
|
117
|
+
import { resolveGepaInstructionSetProfileVersion } from './instruction-set-gepa-launch.js'
|
|
118
|
+
import { getGepaPythonCommand } from './gepa-python-command.js'
|
|
119
|
+
import { getGepaPythonPathEntries } from './gepa-python-paths.js'
|
|
120
|
+
import { prepareSkilledProposerLaunch } from './skilled-proposer-launch.js'
|
|
108
121
|
|
|
109
122
|
export { parseJsonResponse, sanitizeTerminalText } from './json-response.js'
|
|
110
123
|
|
|
@@ -191,6 +204,10 @@ interface PromptSummary {
|
|
|
191
204
|
lengthStatsUnavailableReason?: CliLengthMeasurementUnavailableReason
|
|
192
205
|
lengthStatsVersionId?: string
|
|
193
206
|
lengthStatsVersionNumber?: number
|
|
207
|
+
owner?: {
|
|
208
|
+
instructionSetSlug: string
|
|
209
|
+
componentKey: string
|
|
210
|
+
} | null
|
|
194
211
|
}
|
|
195
212
|
|
|
196
213
|
interface TaskReportPayload {
|
|
@@ -225,7 +242,7 @@ interface ScoreSubmitInput {
|
|
|
225
242
|
|
|
226
243
|
interface RunnerExecContext {
|
|
227
244
|
prompt: {
|
|
228
|
-
body
|
|
245
|
+
body?: string | null
|
|
229
246
|
bodyKind: string
|
|
230
247
|
providerSettings: Record<string, unknown>
|
|
231
248
|
promptId?: string
|
|
@@ -237,6 +254,7 @@ interface RunnerExecContext {
|
|
|
237
254
|
metricKey: string
|
|
238
255
|
higherIsBetter: boolean
|
|
239
256
|
} | null
|
|
257
|
+
instructionSet?: RunnerInstructionSet
|
|
240
258
|
rows: Array<{
|
|
241
259
|
id: string
|
|
242
260
|
row: Record<string, unknown>
|
|
@@ -473,6 +491,14 @@ function printError(message: string): void {
|
|
|
473
491
|
console.error(sanitizeTerminalText(message))
|
|
474
492
|
}
|
|
475
493
|
|
|
494
|
+
function printPushDisclosures(data: Record<string, unknown>): void {
|
|
495
|
+
const warning = reportReplacementWarning(data)
|
|
496
|
+
if (warning) printError(warning)
|
|
497
|
+
if (data.metadata_updated === true) {
|
|
498
|
+
printError('Updated prompt metadata on the identical existing version')
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
476
502
|
export function validateBrowserUrl(url: string, expectedOrigin?: string): URL {
|
|
477
503
|
let parsed: URL
|
|
478
504
|
try {
|
|
@@ -1514,7 +1540,10 @@ async function pushPromptArtifact(kind: 'prompt' | 'judge') {
|
|
|
1514
1540
|
report,
|
|
1515
1541
|
})
|
|
1516
1542
|
if (hasJsonFlag()) printJson(data)
|
|
1517
|
-
else
|
|
1543
|
+
else {
|
|
1544
|
+
printPushDisclosures(data)
|
|
1545
|
+
printLine(message)
|
|
1546
|
+
}
|
|
1518
1547
|
return
|
|
1519
1548
|
}
|
|
1520
1549
|
|
|
@@ -1564,6 +1593,7 @@ async function pushPromptArtifact(kind: 'prompt' | 'judge') {
|
|
|
1564
1593
|
return
|
|
1565
1594
|
}
|
|
1566
1595
|
|
|
1596
|
+
printPushDisclosures(data)
|
|
1567
1597
|
printLine(`Pushed ${kind} ${sanitizeTerminalText(String(manifest.name || promptDir))} (${sanitizeTerminalText(String(data.prompt_version_id || 'unknown version'))})`)
|
|
1568
1598
|
}
|
|
1569
1599
|
|
|
@@ -1618,6 +1648,10 @@ async function pullPromptArtifact(kind: 'prompt' | 'judge') {
|
|
|
1618
1648
|
metricKey: string
|
|
1619
1649
|
higherIsBetter: boolean
|
|
1620
1650
|
}>
|
|
1651
|
+
owner?: {
|
|
1652
|
+
instructionSetSlug: string
|
|
1653
|
+
componentKey: string
|
|
1654
|
+
} | null
|
|
1621
1655
|
}>(response, `${kind} pull`)
|
|
1622
1656
|
|
|
1623
1657
|
const targetDir = expandHomePath(outDir)
|
|
@@ -1704,6 +1738,7 @@ async function pullPromptArtifact(kind: 'prompt' | 'judge') {
|
|
|
1704
1738
|
scorer_version_id: data.scorerVersionId || undefined,
|
|
1705
1739
|
scorer_version_ids: scorerVersions.map(item => item.id),
|
|
1706
1740
|
path: targetDir,
|
|
1741
|
+
owner: data.owner || undefined,
|
|
1707
1742
|
})
|
|
1708
1743
|
return
|
|
1709
1744
|
}
|
|
@@ -1719,73 +1754,17 @@ async function pullPromptArtifact(kind: 'prompt' | 'judge') {
|
|
|
1719
1754
|
`Warning: prompt version ${sanitizeTerminalText(data.version.id)} does not map to an executable scorer version.`
|
|
1720
1755
|
)
|
|
1721
1756
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
const project = getArg('--project') || await resolveProjectSlug(null)
|
|
1728
|
-
const promptVersionId = getArg('--version')
|
|
1729
|
-
|
|
1730
|
-
if (!promptName || !label || !promptVersionId) {
|
|
1731
|
-
throw new Error('Usage: orizu prompts labels set <prompt-name> <label> --version <prompt-version-id> [--project <team/project>] [--json]')
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
const response = await authedFetch(`/api/cli/prompts/labels?project=${encodeURIComponent(project)}`, {
|
|
1735
|
-
method: 'POST',
|
|
1736
|
-
headers: { 'Content-Type': 'application/json' },
|
|
1737
|
-
body: JSON.stringify({
|
|
1738
|
-
promptName,
|
|
1739
|
-
label,
|
|
1740
|
-
promptVersionId,
|
|
1741
|
-
}),
|
|
1742
|
-
})
|
|
1743
|
-
|
|
1744
|
-
if (!response.ok) {
|
|
1745
|
-
throw new Error(`Failed to set prompt label: ${await response.text()}`)
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
const data = await parseJsonResponse<Record<string, unknown>>(response, 'Prompt label set')
|
|
1749
|
-
if (hasJsonFlag()) {
|
|
1750
|
-
printJson(data)
|
|
1751
|
-
return
|
|
1757
|
+
if (kind === 'prompt' && data.owner) {
|
|
1758
|
+
printLine(
|
|
1759
|
+
`Owner: ${sanitizeTerminalText(data.prompt.name)} (${sanitizeTerminalText(data.prompt.id)}) -> ` +
|
|
1760
|
+
`${sanitizeTerminalText(data.owner.instructionSetSlug)} / ${sanitizeTerminalText(data.owner.componentKey)}`
|
|
1761
|
+
)
|
|
1752
1762
|
}
|
|
1753
|
-
|
|
1754
|
-
printLine(`Moved ${sanitizeTerminalText(label)} to ${sanitizeTerminalText(promptVersionId)}`)
|
|
1755
1763
|
}
|
|
1756
1764
|
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
const command = archived ? 'archive' : 'restore'
|
|
1761
|
-
|
|
1762
|
-
if (!promptRef) {
|
|
1763
|
-
throw new Error(`Usage: orizu prompts ${command} <prompt-id-or-name> --project <team/project> [--json]`)
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
const response = await authedFetch(`/api/cli/prompts/${encodeURIComponent(promptRef)}?project=${encodeURIComponent(project)}`, {
|
|
1767
|
-
method: 'PATCH',
|
|
1768
|
-
headers: { 'Content-Type': 'application/json' },
|
|
1769
|
-
body: JSON.stringify({ archived }),
|
|
1770
|
-
})
|
|
1771
|
-
|
|
1772
|
-
if (!response.ok) {
|
|
1773
|
-
throw new Error(`Failed to ${command} prompt: ${await response.text()}`)
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
const data = await parseJsonResponse<{
|
|
1777
|
-
prompt: {
|
|
1778
|
-
id: string
|
|
1779
|
-
name: string
|
|
1780
|
-
status: string
|
|
1781
|
-
}
|
|
1782
|
-
}>(response, `Prompt ${command}`)
|
|
1783
|
-
if (hasJsonFlag()) {
|
|
1784
|
-
printJson(data)
|
|
1785
|
-
return
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
printLine(`${archived ? 'Archived' : 'Restored'} prompt ${sanitizeTerminalText(data.prompt.name)} (${sanitizeTerminalText(data.prompt.id)})`)
|
|
1765
|
+
function refusePromptMutation(replacement: string): never {
|
|
1766
|
+
process.exitCode = 1
|
|
1767
|
+
throw new Error(`Use: orizu instructions ${replacement}`)
|
|
1789
1768
|
}
|
|
1790
1769
|
|
|
1791
1770
|
async function bindPromptScorer(role: 'headline' | 'tracked') {
|
|
@@ -1814,13 +1793,25 @@ async function bindPromptScorer(role: 'headline' | 'tracked') {
|
|
|
1814
1793
|
throw new Error(`Failed to bind prompt scorer: ${await response.text()}`)
|
|
1815
1794
|
}
|
|
1816
1795
|
|
|
1817
|
-
const data = await parseJsonResponse<
|
|
1796
|
+
const data = await parseJsonResponse<{
|
|
1797
|
+
promptScorer: Record<string, unknown>
|
|
1798
|
+
owner?: {
|
|
1799
|
+
instructionSetSlug: string
|
|
1800
|
+
componentKey: string
|
|
1801
|
+
}
|
|
1802
|
+
}>(response, 'Prompt scorer bind')
|
|
1818
1803
|
if (hasJsonFlag()) {
|
|
1819
1804
|
printJson(data)
|
|
1820
1805
|
return
|
|
1821
1806
|
}
|
|
1822
1807
|
|
|
1823
1808
|
printLine(`${role === 'headline' ? 'Set headline' : 'Added'} scorer ${sanitizeTerminalText(scorerVersionId)} for ${sanitizeTerminalText(promptId)}`)
|
|
1809
|
+
if (data.owner) {
|
|
1810
|
+
printLine(
|
|
1811
|
+
`Owner: ${sanitizeTerminalText(promptId)} -> ` +
|
|
1812
|
+
`${sanitizeTerminalText(data.owner.instructionSetSlug)} / ${sanitizeTerminalText(data.owner.componentKey)}`
|
|
1813
|
+
)
|
|
1814
|
+
}
|
|
1824
1815
|
}
|
|
1825
1816
|
|
|
1826
1817
|
function getPositionalArg(index: number): string | null {
|
|
@@ -2506,35 +2497,12 @@ async function updateOptimizationRunLifecycle(action: OptimizationLifecycleActio
|
|
|
2506
2497
|
|
|
2507
2498
|
// ALI-1073 list moved to optimizations-list-cli.ts (line ratchet, ALI-976);
|
|
2508
2499
|
// ALI-1175 labels its best scores as agent-reported evidence there.
|
|
2509
|
-
|
|
2510
|
-
function removeFlagWithValue(args: string[], flag: string): string[] {
|
|
2511
|
-
const filtered: string[] = []
|
|
2512
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
2513
|
-
if (args[index] === flag) {
|
|
2514
|
-
index += 1
|
|
2515
|
-
continue
|
|
2516
|
-
}
|
|
2517
|
-
filtered.push(args[index])
|
|
2518
|
-
}
|
|
2519
|
-
return filtered
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
function bundledOrizuGepaPythonPath(): string | null {
|
|
2523
|
-
const candidates = [
|
|
2524
|
-
fileURLToPath(new URL('../vendor/orizu-gepa-python/src', import.meta.url)),
|
|
2525
|
-
fileURLToPath(new URL('../../orizu-gepa-python/src', import.meta.url)),
|
|
2526
|
-
]
|
|
2527
|
-
|
|
2528
|
-
return candidates.find(candidate => existsSync(candidate)) ?? null
|
|
2529
|
-
}
|
|
2530
|
-
|
|
2531
2500
|
async function runGepaOptimization() {
|
|
2532
2501
|
const project = getArg('--project') || await resolveProjectSlug(null)
|
|
2533
2502
|
const baseUrl = getBaseUrl()
|
|
2534
|
-
const
|
|
2535
|
-
const
|
|
2536
|
-
let forwardedArgs =
|
|
2537
|
-
|
|
2503
|
+
const runGepa = getGepaPythonCommand(cliArgs.slice(2), process.env)
|
|
2504
|
+
const python = runGepa.python
|
|
2505
|
+
let forwardedArgs = runGepa.args
|
|
2538
2506
|
// ALI-1159 (ADR-007): GEPA executes ad-hoc local runner dirs while
|
|
2539
2507
|
// attributing records to registered runner version ids — verify the bytes
|
|
2540
2508
|
// ARE those versions before the optimizer spawns. Scans the forwarded argv
|
|
@@ -2543,8 +2511,8 @@ async function runGepaOptimization() {
|
|
|
2543
2511
|
// so a post-hash mutation of the original dirs cannot change what runs.
|
|
2544
2512
|
const verified = await verifyGepaRunnerDirsFromArgs(forwardedArgs)
|
|
2545
2513
|
forwardedArgs = verified.args
|
|
2546
|
-
|
|
2547
2514
|
let result
|
|
2515
|
+
let selectedEngine = 'official'
|
|
2548
2516
|
try {
|
|
2549
2517
|
// Uniform resolution (ALI-1090): honors ORIZU_TOKEN / ORIZU_TOKEN_FILE before
|
|
2550
2518
|
// credentials.json so hosted sandboxes can run optimizations. Read at spawn
|
|
@@ -2552,40 +2520,35 @@ async function runGepaOptimization() {
|
|
|
2552
2520
|
// rotation crossing the hash + lookup round-trips cannot hand the child a
|
|
2553
2521
|
// stale bearer.
|
|
2554
2522
|
const token = resolveAuthTokenForBaseUrl(baseUrl)
|
|
2555
|
-
|
|
2556
2523
|
if (!forwardedArgs.includes('--project')) {
|
|
2557
2524
|
forwardedArgs = ['--project', project, ...forwardedArgs]
|
|
2558
2525
|
}
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
env: {
|
|
2568
|
-
...process.env,
|
|
2569
|
-
ORIZU_API_URL: baseUrl,
|
|
2570
|
-
ORIZU_TOKEN: token,
|
|
2571
|
-
ORIZU_PROJECT: project,
|
|
2572
|
-
// Integrity handshake (ALI-1159): the Python entrypoint refuses
|
|
2573
|
-
// runner dirs that are not in this wrapper-verified list.
|
|
2574
|
-
ORIZU_VERIFIED_RUNNER_DIRS: JSON.stringify(verified.verifiedDirs),
|
|
2575
|
-
PYTHONPATH: pythonPathEntries.join(delimiter),
|
|
2576
|
-
PYTHONUNBUFFERED: process.env.PYTHONUNBUFFERED || '1',
|
|
2577
|
-
},
|
|
2526
|
+
const dispatch = dispatchGepaEngine(forwardedArgs, project, {
|
|
2527
|
+
...process.env,
|
|
2528
|
+
ORIZU_API_URL: baseUrl,
|
|
2529
|
+
ORIZU_TOKEN: token,
|
|
2530
|
+
ORIZU_PROJECT: project,
|
|
2531
|
+
ORIZU_VERIFIED_RUNNER_DIRS: JSON.stringify(verified.verifiedDirs),
|
|
2532
|
+
PYTHONPATH: getGepaPythonPathEntries(process.env.PYTHONPATH).join(delimiter),
|
|
2533
|
+
PYTHONUNBUFFERED: process.env.PYTHONUNBUFFERED || '1',
|
|
2578
2534
|
})
|
|
2535
|
+
const instructionSetName = dispatch.environment.ORIZU_INSTRUCTION_SET_NAME
|
|
2536
|
+
const modelConfigIdentity = dispatch.environment.ORIZU_MODEL_CONFIG_IDENTITY
|
|
2537
|
+
const instructionSetProfileVersionId = instructionSetName && modelConfigIdentity
|
|
2538
|
+
? await resolveGepaInstructionSetProfileVersion(instructionSetName, modelConfigIdentity, project) : undefined
|
|
2539
|
+
if (instructionSetProfileVersionId) dispatch.environment.ORIZU_INSTRUCTION_SET_PROFILE_VERSION_ID = instructionSetProfileVersionId
|
|
2540
|
+
selectedEngine = dispatch.engine
|
|
2541
|
+
const launch = prepareSkilledProposerLaunch(python, dispatch.engine, dispatch.environment)
|
|
2542
|
+
result = spawnSync(launch.python, ['-m', dispatch.module, ...dispatch.args], { stdio: 'inherit', env: launch.environment })
|
|
2579
2543
|
} finally {
|
|
2580
2544
|
verified.cleanup()
|
|
2581
2545
|
}
|
|
2582
|
-
|
|
2583
2546
|
if (result.error) {
|
|
2584
|
-
throw result.error
|
|
2547
|
+
throw new Error(`${selectedEngine} GEPA engine failed: ${result.error.message}`, { cause: result.error })
|
|
2585
2548
|
}
|
|
2586
2549
|
|
|
2587
2550
|
if (result.status !== 0) {
|
|
2588
|
-
throw new Error(
|
|
2551
|
+
throw new Error(`${selectedEngine} GEPA engine failed with exit code ${result.status}`)
|
|
2589
2552
|
}
|
|
2590
2553
|
|
|
2591
2554
|
if (hasJsonFlag()) {
|
|
@@ -5785,7 +5748,7 @@ async function downloadAnnotations() {
|
|
|
5785
5748
|
printLine(`Saved ${format.toUpperCase()} export to ${sanitizeTerminalText(filename)}`)
|
|
5786
5749
|
}
|
|
5787
5750
|
|
|
5788
|
-
function readRunnerManifest(runnerDir: string): { command: string[]; supports_body_kind?: string[] } {
|
|
5751
|
+
export function readRunnerManifest(runnerDir: string): { command: string[]; supports_body_kind?: string[] } {
|
|
5789
5752
|
const manifestPath = join(runnerDir, 'manifest.json')
|
|
5790
5753
|
const raw = readSourceFile(manifestPath)
|
|
5791
5754
|
const manifest = JSON.parse(raw) as {
|
|
@@ -5813,9 +5776,9 @@ function readRunnerManifest(runnerDir: string): { command: string[]; supports_bo
|
|
|
5813
5776
|
}
|
|
5814
5777
|
}
|
|
5815
5778
|
|
|
5816
|
-
const RUNNER_TIMEOUT_MS = 120_000
|
|
5817
|
-
const RUNNER_OUTPUT_MAX_BYTES = 2 * 1024 * 1024
|
|
5818
|
-
const RUNNER_ENV_ALLOWLIST = new Set([
|
|
5779
|
+
export const RUNNER_TIMEOUT_MS = 120_000
|
|
5780
|
+
export const RUNNER_OUTPUT_MAX_BYTES = 2 * 1024 * 1024
|
|
5781
|
+
export const RUNNER_ENV_ALLOWLIST = new Set([
|
|
5819
5782
|
'PATH',
|
|
5820
5783
|
'SystemRoot',
|
|
5821
5784
|
'WINDIR',
|
|
@@ -5833,7 +5796,7 @@ const RUNNER_ENV_ALLOWLIST = new Set([
|
|
|
5833
5796
|
'GOOGLE_API_KEY',
|
|
5834
5797
|
])
|
|
5835
5798
|
|
|
5836
|
-
function runnerSubprocessEnv(inputPath: string, outputPath: string): NodeJS.ProcessEnv {
|
|
5799
|
+
export function runnerSubprocessEnv(inputPath: string, outputPath: string, instructionSetDir?: string): NodeJS.ProcessEnv {
|
|
5837
5800
|
const env = {} as NodeJS.ProcessEnv
|
|
5838
5801
|
for (const key of RUNNER_ENV_ALLOWLIST) {
|
|
5839
5802
|
const value = process.env[key]
|
|
@@ -5843,6 +5806,8 @@ function runnerSubprocessEnv(inputPath: string, outputPath: string): NodeJS.Proc
|
|
|
5843
5806
|
}
|
|
5844
5807
|
env.ORIZU_RUNNER_INPUT_PATH = inputPath
|
|
5845
5808
|
env.ORIZU_RUNNER_OUTPUT_PATH = outputPath
|
|
5809
|
+
delete env.ORIZU_INSTRUCTION_SET_DIR
|
|
5810
|
+
if (instructionSetDir) env.ORIZU_INSTRUCTION_SET_DIR = instructionSetDir
|
|
5846
5811
|
return env
|
|
5847
5812
|
}
|
|
5848
5813
|
|
|
@@ -5855,7 +5820,7 @@ function boundedRunnerOutput(value: string | Buffer | null | undefined): string
|
|
|
5855
5820
|
return `${buffer.subarray(0, RUNNER_OUTPUT_MAX_BYTES).toString('utf8')}\n[truncated]`
|
|
5856
5821
|
}
|
|
5857
5822
|
|
|
5858
|
-
async function materializeRunnerVersion(runnerVersionId: string): Promise<{ runnerDir: string; cleanup: () => void }> {
|
|
5823
|
+
export async function materializeRunnerVersion(runnerVersionId: string): Promise<{ runnerDir: string; cleanup: () => void }> {
|
|
5859
5824
|
const response = await authedFetch(`/api/cli/runner-versions/${encodeURIComponent(runnerVersionId)}/download`)
|
|
5860
5825
|
if (!response.ok) {
|
|
5861
5826
|
throw new Error(`Failed to download runner version: ${await response.text()}`)
|
|
@@ -5949,7 +5914,6 @@ async function runnersExec() {
|
|
|
5949
5914
|
})()
|
|
5950
5915
|
: await materializeRunnerVersion(resolvedRunnerVersionId)
|
|
5951
5916
|
const runnerDir = materializedRunner.runnerDir
|
|
5952
|
-
|
|
5953
5917
|
try {
|
|
5954
5918
|
assertSnapshotManifestConfined(runnerDir, runnerDirArg ? '--runner-dir' : '--runner-version')
|
|
5955
5919
|
// Inside the try (codex round-6 P3): a bad manifest must not leak the dir.
|
|
@@ -5959,22 +5923,19 @@ async function runnersExec() {
|
|
|
5959
5923
|
`Runner does not support prompt body kind '${context.prompt.bodyKind}'. Supported kinds: ${manifest.supports_body_kind.join(', ')}`
|
|
5960
5924
|
)
|
|
5961
5925
|
}
|
|
5962
|
-
|
|
5963
5926
|
const resultLines: string[] = []
|
|
5964
5927
|
for (const row of context.rows) {
|
|
5965
5928
|
const tempDir = mkdtempSync(join(tmpdir(), 'orizu-runner-'))
|
|
5966
5929
|
const inputPath = join(tempDir, 'input.json')
|
|
5967
5930
|
const outputPath = join(tempDir, 'output.json')
|
|
5968
|
-
|
|
5931
|
+
const instructionSetDir = context.instructionSet ? join(tempDir, 'instruction-set') : undefined
|
|
5969
5932
|
try {
|
|
5970
5933
|
const modelOutput = row.row.model_output ?? row.row.modelOutput ?? row.row.output ?? null
|
|
5934
|
+
if (instructionSetDir && context.instructionSet) syncToDisk(instructionSetDir, runnerInstructionSetSyncSet(context.instructionSet))
|
|
5971
5935
|
writeFileSync(inputPath, JSON.stringify({
|
|
5972
5936
|
row: row.row,
|
|
5973
|
-
prompt:
|
|
5974
|
-
|
|
5975
|
-
body_kind: context.prompt.bodyKind,
|
|
5976
|
-
provider_settings: context.prompt.providerSettings,
|
|
5977
|
-
},
|
|
5937
|
+
prompt: runnerInputPrompt(context.prompt),
|
|
5938
|
+
...(context.instructionSet ? { instruction_set: runnerInputInstructionSet(context.instructionSet) } : {}),
|
|
5978
5939
|
subject: scorerVersion
|
|
5979
5940
|
? {
|
|
5980
5941
|
type: 'scorer_row',
|
|
@@ -6002,7 +5963,7 @@ async function runnersExec() {
|
|
|
6002
5963
|
|
|
6003
5964
|
const result = spawnSync(manifest.command[0], manifest.command.slice(1), {
|
|
6004
5965
|
cwd: runnerDir,
|
|
6005
|
-
env: runnerSubprocessEnv(inputPath, outputPath),
|
|
5966
|
+
env: runnerSubprocessEnv(inputPath, outputPath, instructionSetDir),
|
|
6006
5967
|
encoding: 'utf8',
|
|
6007
5968
|
maxBuffer: RUNNER_OUTPUT_MAX_BYTES,
|
|
6008
5969
|
timeout: RUNNER_TIMEOUT_MS,
|
|
@@ -6234,8 +6195,11 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
6234
6195
|
}
|
|
6235
6196
|
|
|
6236
6197
|
if (command === 'prompts' && subcommand === 'push') {
|
|
6237
|
-
|
|
6238
|
-
|
|
6198
|
+
if (getArg('--session')) {
|
|
6199
|
+
await pushPromptArtifact('prompt')
|
|
6200
|
+
return
|
|
6201
|
+
}
|
|
6202
|
+
refusePromptMutation('push <manifest> --project <team/project>')
|
|
6239
6203
|
}
|
|
6240
6204
|
|
|
6241
6205
|
if (
|
|
@@ -6249,17 +6213,25 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
6249
6213
|
}
|
|
6250
6214
|
|
|
6251
6215
|
if (command === 'prompts' && subcommand === 'archive') {
|
|
6252
|
-
|
|
6253
|
-
return
|
|
6216
|
+
refusePromptMutation('archive <slug-or-exact-name> --project <team/project>')
|
|
6254
6217
|
}
|
|
6255
6218
|
|
|
6256
6219
|
if (command === 'prompts' && subcommand === 'restore') {
|
|
6257
|
-
|
|
6258
|
-
return
|
|
6220
|
+
refusePromptMutation('restore <slug-or-exact-name> --project <team/project>')
|
|
6259
6221
|
}
|
|
6260
6222
|
|
|
6261
6223
|
if (command === 'prompts' && subcommand === 'labels' && cliArgs[2] === 'set') {
|
|
6262
|
-
|
|
6224
|
+
if (getPositionalArg(4) === 'production') {
|
|
6225
|
+
refusePromptMutation('profiles promote <set> --project <team/project> --model-config <identity> --version <n>')
|
|
6226
|
+
}
|
|
6227
|
+
await setPromptLabel({
|
|
6228
|
+
getArg,
|
|
6229
|
+
getPositionalArg,
|
|
6230
|
+
json: hasJsonFlag(),
|
|
6231
|
+
printJson,
|
|
6232
|
+
printLine,
|
|
6233
|
+
resolveProjectSlug,
|
|
6234
|
+
})
|
|
6263
6235
|
return
|
|
6264
6236
|
}
|
|
6265
6237
|
|
|
@@ -6310,29 +6282,17 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
6310
6282
|
return
|
|
6311
6283
|
}
|
|
6312
6284
|
|
|
6313
|
-
if (command === 'scorers'
|
|
6314
|
-
await
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
await showScorerDetail()
|
|
6325
|
-
return
|
|
6326
|
-
}
|
|
6327
|
-
|
|
6328
|
-
if (command === 'scorers' && subcommand === 'labels' && cliArgs[2] === 'set') {
|
|
6329
|
-
await setScorerLabel()
|
|
6330
|
-
return
|
|
6331
|
-
}
|
|
6332
|
-
|
|
6333
|
-
if (command === 'scorers' && subcommand === 'exec') {
|
|
6334
|
-
await execScorer()
|
|
6335
|
-
return
|
|
6285
|
+
if (command === 'scorers') {
|
|
6286
|
+
const scorersExit = await scorersCommand(cliArgs, {
|
|
6287
|
+
list: listScorers, register: registerScorer, detail: showScorerDetail,
|
|
6288
|
+
labelsSet: setScorerLabel, exec: execScorer,
|
|
6289
|
+
verifyParity: args => verifyScorerParityCommand(args, {
|
|
6290
|
+
json: hasJsonFlag(), print: printLine, printErr: printError,
|
|
6291
|
+
materializeRunnerVersion, readRunnerManifest, runnerSubprocessEnv,
|
|
6292
|
+
timeoutMs: RUNNER_TIMEOUT_MS, maxOutputBytes: RUNNER_OUTPUT_MAX_BYTES,
|
|
6293
|
+
}),
|
|
6294
|
+
})
|
|
6295
|
+
if (scorersExit !== null) { process.exitCode = scorersExit; return }
|
|
6336
6296
|
}
|
|
6337
6297
|
|
|
6338
6298
|
if ((command === 'runners' || command === 'optimizers') && subcommand === 'push') {
|
|
@@ -6393,7 +6353,12 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
6393
6353
|
await listOptimizationRunsCommand(cliArgs.slice(2), { json: hasJsonFlag(), print: printLine, resolveProjectSlug })
|
|
6394
6354
|
return
|
|
6395
6355
|
}
|
|
6396
|
-
|
|
6356
|
+
if (command === 'optimizations' && subcommand === 'promote') {
|
|
6357
|
+
await promoteOptimizationCommand(cliArgs.slice(2), {
|
|
6358
|
+
json: hasJsonFlag(), print: printLine, resolveProjectSlug, fetcher: authedFetch,
|
|
6359
|
+
})
|
|
6360
|
+
return
|
|
6361
|
+
}
|
|
6397
6362
|
if (
|
|
6398
6363
|
command === 'optimizations' &&
|
|
6399
6364
|
(
|
|
@@ -6557,11 +6522,11 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
6557
6522
|
}
|
|
6558
6523
|
if (command === 'git-credential') { process.exitCode = await runGitCredentialInvocation(cliArgs.slice(1), { stdin: readFileSync(0, 'utf8'), cwd: process.cwd(), print: printLine, printErr: printError }); return }
|
|
6559
6524
|
if (command === 'github' && subcommand === 'link') { const noInput = hasArg('--no-input') || hasArg('--non-interactive') || !isInteractiveTerminal(); const team = getOptionalArgValue('--team') || (await resolveSetupTeam(null, noInput, false)).slug; await runGithubLink(team, { print: printLine, fetcher: authedFetch, openUrl: openInBrowser, confirm: (org) => askYesNo(`Connect this team to GitHub org '${org}'?`, true) }); return }
|
|
6560
|
-
if (command === 'connectors' || command === 'manifests') {
|
|
6561
|
-
|
|
6562
|
-
process.exitCode = await moduleCommand(cliArgs.slice(1), { json: hasJsonFlag(), print: printLine, resolveProjectSlug })
|
|
6525
|
+
if (command === 'connectors' || command === 'manifests' || command === 'model-configs') {
|
|
6526
|
+
process.exitCode = await (command === 'connectors' ? connectorsCommand : command === 'manifests' ? manifestsCommand : modelConfigsCommand)(cliArgs.slice(1), { json: hasJsonFlag(), print: printLine, resolveProjectSlug })
|
|
6563
6527
|
return
|
|
6564
6528
|
}
|
|
6529
|
+
if (command === 'instructions' || command === 'instruction-sets') { process.exitCode = await instructionSetsCommand(cliArgs.slice(1), { json: hasJsonFlag(), print: printLine, resolveProjectSlug }); return }
|
|
6565
6530
|
if (command === 'team' && (subcommand === 'kill-agents' || subcommand === 'release-agents')) {
|
|
6566
6531
|
process.exitCode = await killSwitchCommand(cliArgs.slice(1), { json: hasJsonFlag(), print: printLine, printErr: printError })
|
|
6567
6532
|
return
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { authedFetch } from './http.js'
|
|
2
|
+
import { parseJsonResponse } from './json-response.js'
|
|
3
|
+
|
|
4
|
+
interface InstructionSetResolution {
|
|
5
|
+
instructionSet?: {
|
|
6
|
+
default?: { profileVersionId?: string } | null
|
|
7
|
+
profiles?: Array<{
|
|
8
|
+
modelConfigIdentity?: string | null
|
|
9
|
+
production?: { profileVersionId?: string } | null
|
|
10
|
+
}>
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Resolve the same production-or-default tuple served for a model identity. */
|
|
15
|
+
export async function resolveGepaInstructionSetProfileVersion(
|
|
16
|
+
instructionSetName: string,
|
|
17
|
+
modelConfigIdentity: string,
|
|
18
|
+
project: string,
|
|
19
|
+
): Promise<string> {
|
|
20
|
+
const response = await authedFetch(`/api/cli/instruction-sets/${encodeURIComponent(instructionSetName)}?project=${encodeURIComponent(project)}`)
|
|
21
|
+
if (!response.ok) throw new Error(`Instruction set resolution failed: ${await response.text()}`)
|
|
22
|
+
const payload = await parseJsonResponse<InstructionSetResolution>(response, 'Instruction set resolution')
|
|
23
|
+
const instructionSet = payload.instructionSet
|
|
24
|
+
const profile = instructionSet?.profiles?.find(candidate => candidate.modelConfigIdentity === modelConfigIdentity)
|
|
25
|
+
const profileVersionId = profile?.production?.profileVersionId || instructionSet?.default?.profileVersionId
|
|
26
|
+
if (!profileVersionId) throw new Error('instruction_set_profile_version_unresolvable')
|
|
27
|
+
return profileVersionId
|
|
28
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { existsSync, realpathSync, readFileSync, statSync } from 'node:fs'
|
|
2
|
+
import { resolve, sep } from 'node:path'
|
|
3
|
+
|
|
4
|
+
export class InstructionSetLoaderError extends Error {
|
|
5
|
+
constructor(readonly code: string) { super(code); this.name = 'InstructionSetLoaderError' }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface Material { files: Record<string, string>; pinnedComponents?: Record<string, unknown> }
|
|
9
|
+
interface Manifest { manifestVersion: number; name: string; shape: string[]; default: Material; profiles: Array<{ modelConfigIdentity: string; production: Material | null }>; filteredTo?: string[] }
|
|
10
|
+
|
|
11
|
+
function inside(root: string, candidate: string) { return candidate === root || candidate.startsWith(`${root}${sep}`) }
|
|
12
|
+
|
|
13
|
+
export function loadInstructionSet(directory: string, name: string, modelConfigIdentity: string): Record<string, string> {
|
|
14
|
+
const unresolvedRoot = resolve(directory, name)
|
|
15
|
+
if (!existsSync(unresolvedRoot) || !statSync(unresolvedRoot).isDirectory()) throw new InstructionSetLoaderError('instruction_set_not_synced')
|
|
16
|
+
const setRoot = realpathSync(unresolvedRoot)
|
|
17
|
+
const manifestPath = resolve(setRoot, 'manifest.json')
|
|
18
|
+
if (!existsSync(manifestPath)) throw new InstructionSetLoaderError('instruction_set_manifest_missing')
|
|
19
|
+
let manifest: Manifest
|
|
20
|
+
try { manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as Manifest } catch { throw new InstructionSetLoaderError('instruction_set_manifest_missing') }
|
|
21
|
+
if (manifest.manifestVersion !== 1) throw new InstructionSetLoaderError('instruction_set_manifest_version_unsupported')
|
|
22
|
+
if (manifest.filteredTo && !manifest.filteredTo.includes(modelConfigIdentity)) throw new InstructionSetLoaderError('instruction_set_profile_not_synced')
|
|
23
|
+
const selected = manifest.profiles.find(profile => profile.modelConfigIdentity === modelConfigIdentity)?.production || manifest.default
|
|
24
|
+
const result: Record<string, string> = {}
|
|
25
|
+
for (const key of manifest.shape) {
|
|
26
|
+
if (selected.pinnedComponents?.[key]) throw new InstructionSetLoaderError('instruction_set_component_unavailable')
|
|
27
|
+
const relativePath = selected.files?.[key]
|
|
28
|
+
if (!relativePath) throw new InstructionSetLoaderError('instruction_set_profile_key_missing')
|
|
29
|
+
const unresolvedPath = resolve(setRoot, relativePath)
|
|
30
|
+
if (!inside(setRoot, unresolvedPath)) throw new InstructionSetLoaderError('instruction_set_path_unsafe')
|
|
31
|
+
let path: string
|
|
32
|
+
try { path = realpathSync(unresolvedPath) } catch { throw new InstructionSetLoaderError('instruction_set_component_unreadable') }
|
|
33
|
+
if (!inside(setRoot, path)) throw new InstructionSetLoaderError('instruction_set_path_unsafe')
|
|
34
|
+
try { result[key] = readFileSync(path, 'utf8') } catch { throw new InstructionSetLoaderError('instruction_set_component_unreadable') }
|
|
35
|
+
}
|
|
36
|
+
return result
|
|
37
|
+
}
|