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,256 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
4
|
+
import { execFileSync } from "node:child_process";
|
|
5
|
+
import {
|
|
6
|
+
closeSync,
|
|
7
|
+
fsyncSync,
|
|
8
|
+
mkdtempSync,
|
|
9
|
+
openSync,
|
|
10
|
+
readFileSync,
|
|
11
|
+
readdirSync,
|
|
12
|
+
renameSync,
|
|
13
|
+
rmSync,
|
|
14
|
+
writeFileSync,
|
|
15
|
+
} from "node:fs";
|
|
16
|
+
import { tmpdir } from "node:os";
|
|
17
|
+
import { dirname, join, resolve } from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
|
|
20
|
+
const scriptDirectory = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const cliRoot = resolve(scriptDirectory, "..");
|
|
22
|
+
const repositoryRoot = resolve(cliRoot, "../..");
|
|
23
|
+
const inputPath = join(cliRoot, "requirements", "skilled-proposer.in");
|
|
24
|
+
const lockPath = join(cliRoot, "requirements", "skilled-proposer.lock");
|
|
25
|
+
|
|
26
|
+
const TARGETS = [
|
|
27
|
+
{ name: "macos-arm64", platforms: ["macosx_15_0_arm64"] },
|
|
28
|
+
{
|
|
29
|
+
name: "linux-x86_64",
|
|
30
|
+
platforms: ["manylinux_2_28_x86_64", "manylinux2014_x86_64"],
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
const PYTHON_MINORS = ["3.10", "3.11", "3.12", "3.13", "3.14"];
|
|
34
|
+
|
|
35
|
+
function parseArguments(argv) {
|
|
36
|
+
const options = {
|
|
37
|
+
check: false,
|
|
38
|
+
download: false,
|
|
39
|
+
python: join(repositoryRoot, ".scratch-deps", "venv", "bin", "python"),
|
|
40
|
+
wheelRoot: join(repositoryRoot, ".scratch-deps", "wheels"),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
44
|
+
const argument = argv[index];
|
|
45
|
+
if (argument === "--check") options.check = true;
|
|
46
|
+
else if (argument === "--download") options.download = true;
|
|
47
|
+
else if (argument === "--python") options.python = resolve(argv[++index]);
|
|
48
|
+
else if (argument === "--wheel-root") options.wheelRoot = resolve(argv[++index]);
|
|
49
|
+
else throw new Error(`Unknown argument: ${argument}`);
|
|
50
|
+
}
|
|
51
|
+
if (options.check && options.download) {
|
|
52
|
+
throw new Error("--check and --download are mutually exclusive");
|
|
53
|
+
}
|
|
54
|
+
return options;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function canonicalizeName(name) {
|
|
58
|
+
return name.toLowerCase().replace(/[._-]+/g, "-");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function parsePins() {
|
|
62
|
+
return readFileSync(inputPath, "utf8")
|
|
63
|
+
.split(/\r?\n/u)
|
|
64
|
+
.map((line) => line.trim())
|
|
65
|
+
.filter((line) => line && !line.startsWith("#"))
|
|
66
|
+
.map((line) => {
|
|
67
|
+
const match = /^([A-Za-z0-9._-]+)==([^ ;]+)(?:\s*;\s*(.+))?$/u.exec(line);
|
|
68
|
+
if (!match) throw new Error(`Invalid fully pinned requirement: ${line}`);
|
|
69
|
+
return {
|
|
70
|
+
name: canonicalizeName(match[1]),
|
|
71
|
+
version: match[2],
|
|
72
|
+
marker: match[3] ?? null,
|
|
73
|
+
source: line,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function pinApplies(pin, pythonMinor) {
|
|
79
|
+
if (!pin.marker) return true;
|
|
80
|
+
if (pin.marker === 'python_version == "3.10"') return pythonMinor === "3.10";
|
|
81
|
+
if (pin.marker === 'python_version >= "3.11" and python_version < "3.15"') {
|
|
82
|
+
return pythonMinor !== "3.10";
|
|
83
|
+
}
|
|
84
|
+
throw new Error(`Unsupported environment marker in ${pin.source}`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function activePins(pins, pythonMinor) {
|
|
88
|
+
const active = pins.filter((pin) => pinApplies(pin, pythonMinor));
|
|
89
|
+
const names = new Set(active.map((pin) => pin.name));
|
|
90
|
+
const expectedCount = pythonMinor === "3.10" ? 60 : 58;
|
|
91
|
+
if (active.length !== expectedCount || names.size !== expectedCount) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
`Expected ${expectedCount} unique active pins for Python ${pythonMinor}; found ${active.length}`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return active;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function wheelIdentity(filename) {
|
|
100
|
+
const match = /^(.+?)-([^-]+)-[^-]+-[^-]+-[^-]+\.whl$/u.exec(filename);
|
|
101
|
+
if (!match) throw new Error(`Not a wheel filename: ${filename}`);
|
|
102
|
+
return { name: canonicalizeName(match[1]), version: match[2] };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function downloadWheelhouse(options, target, pythonMinor, pins) {
|
|
106
|
+
const wheelhouse = join(
|
|
107
|
+
options.wheelRoot,
|
|
108
|
+
`${target.name}-py${pythonMinor.replace(".", "")}`,
|
|
109
|
+
);
|
|
110
|
+
const temporary = mkdtempSync(join(tmpdir(), "orizu-ali-1505-pins-"));
|
|
111
|
+
const requirements = join(temporary, "requirements.txt");
|
|
112
|
+
writeFileSync(
|
|
113
|
+
requirements,
|
|
114
|
+
`${activePins(pins, pythonMinor)
|
|
115
|
+
.map(({ name, version }) => `${name}==${version}`)
|
|
116
|
+
.join("\n")}\n`,
|
|
117
|
+
);
|
|
118
|
+
const pipArguments = [
|
|
119
|
+
"-m",
|
|
120
|
+
"pip",
|
|
121
|
+
"download",
|
|
122
|
+
"--disable-pip-version-check",
|
|
123
|
+
"--no-deps",
|
|
124
|
+
"--only-binary=:all:",
|
|
125
|
+
"--implementation",
|
|
126
|
+
"cp",
|
|
127
|
+
"--python-version",
|
|
128
|
+
pythonMinor.replace(".", ""),
|
|
129
|
+
"--abi",
|
|
130
|
+
`cp${pythonMinor.replace(".", "")}`,
|
|
131
|
+
];
|
|
132
|
+
for (const platform of target.platforms) {
|
|
133
|
+
pipArguments.push("--platform", platform);
|
|
134
|
+
}
|
|
135
|
+
pipArguments.push("--dest", wheelhouse, "--requirement", requirements);
|
|
136
|
+
try {
|
|
137
|
+
execFileSync(options.python, pipArguments, { stdio: "inherit", timeout: 10 * 60 * 1000 });
|
|
138
|
+
} finally {
|
|
139
|
+
rmSync(temporary, { recursive: true, force: true });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function digestWheel(path) {
|
|
144
|
+
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function collectWheelHashes(options, pins) {
|
|
148
|
+
const hashes = new Map(pins.map((pin) => [pin.source, new Set()]));
|
|
149
|
+
|
|
150
|
+
for (const target of TARGETS) {
|
|
151
|
+
for (const pythonMinor of PYTHON_MINORS) {
|
|
152
|
+
const active = activePins(pins, pythonMinor);
|
|
153
|
+
const activeByIdentity = new Map(
|
|
154
|
+
active.map((pin) => [`${pin.name}==${pin.version}`, pin]),
|
|
155
|
+
);
|
|
156
|
+
const wheelhouse = join(
|
|
157
|
+
options.wheelRoot,
|
|
158
|
+
`${target.name}-py${pythonMinor.replace(".", "")}`,
|
|
159
|
+
);
|
|
160
|
+
const files = readdirSync(wheelhouse).filter((file) => file.endsWith(".whl"));
|
|
161
|
+
const found = new Set();
|
|
162
|
+
for (const file of files) {
|
|
163
|
+
const identity = wheelIdentity(file);
|
|
164
|
+
const key = `${identity.name}==${identity.version}`;
|
|
165
|
+
const pin = activeByIdentity.get(key);
|
|
166
|
+
if (!pin) throw new Error(`Unexpected wheel in ${wheelhouse}: ${file}`);
|
|
167
|
+
if (found.has(pin.name)) {
|
|
168
|
+
throw new Error(`Multiple wheels for ${pin.name} in ${wheelhouse}`);
|
|
169
|
+
}
|
|
170
|
+
found.add(pin.name);
|
|
171
|
+
hashes.get(pin.source).add(digestWheel(join(wheelhouse, file)));
|
|
172
|
+
}
|
|
173
|
+
const missing = active.filter((pin) => !found.has(pin.name));
|
|
174
|
+
if (missing.length > 0) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
`Missing wheels in ${wheelhouse}: ${missing.map((pin) => pin.source).join(", ")}`,
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return hashes;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function renderLock(pins, hashes) {
|
|
185
|
+
const header = [
|
|
186
|
+
"# Generated by packages/cli/scripts/refresh-skilled-proposer-lock.mjs.",
|
|
187
|
+
"# Do not edit by hand; see packages/cli/requirements/README.md.",
|
|
188
|
+
"#",
|
|
189
|
+
"# Wheel-only coverage: CPython 3.10-3.14 on macOS 15+ arm64 and",
|
|
190
|
+
"# glibc-based Linux x86_64 compatible with the locked manylinux wheels.",
|
|
191
|
+
"# Other OS/architecture/libc combinations are intentionally not covered.",
|
|
192
|
+
"",
|
|
193
|
+
];
|
|
194
|
+
const continuation = ` ${String.fromCharCode(92, 10)}`;
|
|
195
|
+
const requirements = [...pins]
|
|
196
|
+
.sort((left, right) => left.source.localeCompare(right.source))
|
|
197
|
+
.map((pin) => {
|
|
198
|
+
const pinHashes = [...hashes.get(pin.source)].sort();
|
|
199
|
+
if (pinHashes.length === 0) throw new Error(`No wheel hash for ${pin.source}`);
|
|
200
|
+
const hashLines = pinHashes
|
|
201
|
+
.map((hash) => ` --hash=sha256:${hash}`)
|
|
202
|
+
.join(continuation);
|
|
203
|
+
return pin.source + continuation + hashLines;
|
|
204
|
+
});
|
|
205
|
+
return `${header.join("\n")}${requirements.join("\n")}\n`;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function main() {
|
|
209
|
+
const options = parseArguments(process.argv.slice(2));
|
|
210
|
+
const pins = parsePins();
|
|
211
|
+
if (options.download) {
|
|
212
|
+
for (const target of TARGETS) {
|
|
213
|
+
for (const pythonMinor of PYTHON_MINORS) {
|
|
214
|
+
downloadWheelhouse(options, target, pythonMinor, pins);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const lock = renderLock(pins, collectWheelHashes(options, pins));
|
|
219
|
+
if (options.check) {
|
|
220
|
+
if (readFileSync(lockPath, "utf8") !== lock) {
|
|
221
|
+
throw new Error(`${lockPath} is stale; regenerate it from verified wheelhouses`);
|
|
222
|
+
}
|
|
223
|
+
process.stdout.write(`Verified ${lockPath}\n`);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const temporaryLock = join(
|
|
227
|
+
dirname(lockPath),
|
|
228
|
+
`.skilled-proposer.lock-${process.pid}-${randomUUID()}.tmp`,
|
|
229
|
+
);
|
|
230
|
+
try {
|
|
231
|
+
const temporaryDescriptor = openSync(temporaryLock, "wx");
|
|
232
|
+
try {
|
|
233
|
+
writeFileSync(temporaryDescriptor, lock);
|
|
234
|
+
fsyncSync(temporaryDescriptor);
|
|
235
|
+
} finally {
|
|
236
|
+
closeSync(temporaryDescriptor);
|
|
237
|
+
}
|
|
238
|
+
renameSync(temporaryLock, lockPath);
|
|
239
|
+
const requirementsDescriptor = openSync(dirname(lockPath), "r");
|
|
240
|
+
try {
|
|
241
|
+
fsyncSync(requirementsDescriptor);
|
|
242
|
+
} finally {
|
|
243
|
+
closeSync(requirementsDescriptor);
|
|
244
|
+
}
|
|
245
|
+
} finally {
|
|
246
|
+
rmSync(temporaryLock, { force: true });
|
|
247
|
+
}
|
|
248
|
+
process.stdout.write(`Wrote ${lockPath}\n`);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
try {
|
|
252
|
+
main();
|
|
253
|
+
} catch (error) {
|
|
254
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
255
|
+
process.exitCode = 1;
|
|
256
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { cpSync, existsSync, mkdirSync, rmSync } from 'node:fs'
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, rmSync, statSync, writeFileSync, readFileSync } from 'node:fs'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { spawnSync } from 'node:child_process'
|
|
2
4
|
import { dirname, resolve } from 'node:path'
|
|
3
5
|
import { fileURLToPath } from 'node:url'
|
|
4
6
|
|
|
@@ -7,32 +9,194 @@ const cliRoot = resolve(scriptDir, '..')
|
|
|
7
9
|
const repoRoot = resolve(cliRoot, '..', '..')
|
|
8
10
|
const sourceRoot = resolve(repoRoot, 'packages', 'orizu-gepa-python')
|
|
9
11
|
const vendorRoot = resolve(cliRoot, 'vendor', 'orizu-gepa-python')
|
|
12
|
+
const connectorSourceRoot = resolve(repoRoot, 'packages', 'orizu-gepa')
|
|
13
|
+
const connectorVendorRoot = resolve(cliRoot, 'vendor', 'orizu-gepa')
|
|
14
|
+
const officialArchive = resolve(cliRoot, 'gepa-python-source.zip')
|
|
15
|
+
const officialVendorRoot = resolve(cliRoot, 'vendor', 'gepa-python')
|
|
10
16
|
const shouldClean = process.argv.includes('--clean')
|
|
17
|
+
const shouldRefresh = process.argv.includes('--refresh')
|
|
18
|
+
const archiveArgumentIndex = process.argv.indexOf('--archive')
|
|
19
|
+
const suppliedArchive = archiveArgumentIndex === -1
|
|
20
|
+
? null
|
|
21
|
+
: process.argv[archiveArgumentIndex + 1]
|
|
11
22
|
const sourceSrc = resolve(sourceRoot, 'src')
|
|
12
23
|
const sourcePyproject = resolve(sourceRoot, 'pyproject.toml')
|
|
13
24
|
const sourceManifest = resolve(sourceRoot, 'manifest.json')
|
|
14
25
|
const vendoredSrc = resolve(vendorRoot, 'src')
|
|
15
26
|
const vendoredPyproject = resolve(vendorRoot, 'pyproject.toml')
|
|
16
27
|
const vendoredManifest = resolve(vendorRoot, 'manifest.json')
|
|
28
|
+
const officialVendoredManifest = resolve(officialVendorRoot, 'manifest.json')
|
|
29
|
+
const officialVendoredGepa = resolve(officialVendorRoot, 'src', 'gepa', '__init__.py')
|
|
30
|
+
const GEPA_VERSION = '0.1.4'
|
|
31
|
+
const GEPA_RELEASE_COMMIT = '8b0ce6cd99a234f6b74daf37558a2ac0ce18f975'
|
|
32
|
+
const GEPA_WHEEL_FILENAME = 'gepa-0.1.4-py3-none-any.whl'
|
|
33
|
+
const GEPA_WHEEL_SHA256 = '12b971039599625c156d2231f6d72a29c31a22e9c237689459b5f1a3c353f532'
|
|
17
34
|
const hasSourcePackage = existsSync(sourceSrc)
|
|
18
35
|
&& existsSync(sourcePyproject)
|
|
19
36
|
&& existsSync(sourceManifest)
|
|
37
|
+
const hasConnectorSourcePackage = existsSync(resolve(connectorSourceRoot, 'src'))
|
|
38
|
+
&& existsSync(resolve(connectorSourceRoot, 'pyproject.toml'))
|
|
20
39
|
const hasVendoredPackage = existsSync(vendoredSrc)
|
|
21
40
|
&& existsSync(vendoredPyproject)
|
|
22
41
|
&& existsSync(vendoredManifest)
|
|
42
|
+
const hasVendoredConnectorPackage = existsSync(resolve(connectorVendorRoot, 'src', 'orizu_gepa_connector', '__main__.py'))
|
|
43
|
+
&& existsSync(resolve(connectorVendorRoot, 'pyproject.toml'))
|
|
44
|
+
const hasOfficialVendoredPackage = existsSync(officialVendoredManifest)
|
|
45
|
+
&& existsSync(officialVendoredGepa)
|
|
46
|
+
|
|
47
|
+
function sha256File(path) {
|
|
48
|
+
return createHash('sha256').update(readFileSync(path)).digest('hex')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function assertPinnedGepaArchive(path) {
|
|
52
|
+
if (!existsSync(path)) {
|
|
53
|
+
throw new Error(`Unable to vendor official GEPA: source archive not found at ${path}`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const actualSha256 = sha256File(path)
|
|
57
|
+
if (actualSha256 !== GEPA_WHEEL_SHA256) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`Official GEPA source archive sha256 mismatch: expected ${GEPA_WHEEL_SHA256}, got ${actualSha256}`
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function collectFileHashes(root, prefix = '') {
|
|
65
|
+
const files = {}
|
|
66
|
+
for (const entry of readdirSync(root).sort()) {
|
|
67
|
+
const path = resolve(root, entry)
|
|
68
|
+
const relativePath = prefix ? `${prefix}/${entry}` : entry
|
|
69
|
+
if (statSync(path).isDirectory()) {
|
|
70
|
+
Object.assign(files, collectFileHashes(path, relativePath))
|
|
71
|
+
} else {
|
|
72
|
+
files[relativePath] = sha256File(path)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return files
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function assertOfficialVendoredManifest() {
|
|
79
|
+
let manifest
|
|
80
|
+
try {
|
|
81
|
+
manifest = JSON.parse(readFileSync(officialVendoredManifest, 'utf8'))
|
|
82
|
+
} catch (error) {
|
|
83
|
+
throw new Error(`Official GEPA vendored manifest is unreadable: ${error.message}`)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!manifest.files || typeof manifest.files !== 'object' || Array.isArray(manifest.files)) {
|
|
87
|
+
throw new Error('Official GEPA vendored manifest is missing file hashes')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const actualFiles = collectFileHashes(officialVendorRoot)
|
|
91
|
+
delete actualFiles['manifest.json']
|
|
92
|
+
const expectedEntries = Object.entries(manifest.files).sort(([left], [right]) => left.localeCompare(right))
|
|
93
|
+
const actualEntries = Object.entries(actualFiles).sort(([left], [right]) => left.localeCompare(right))
|
|
94
|
+
if (expectedEntries.length !== actualEntries.length) {
|
|
95
|
+
throw new Error('Official GEPA vendored manifest file count does not match extracted files')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (let index = 0; index < expectedEntries.length; index += 1) {
|
|
99
|
+
const [expectedPath, expectedSha256] = expectedEntries[index]
|
|
100
|
+
const [actualPath, actualSha256] = actualEntries[index]
|
|
101
|
+
if (expectedPath !== actualPath || expectedSha256 !== actualSha256) {
|
|
102
|
+
throw new Error(`Official GEPA vendored manifest mismatch at ${expectedPath}`)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function extractPinnedGepa(archivePath) {
|
|
108
|
+
const extractor = String.raw`
|
|
109
|
+
from pathlib import Path, PurePosixPath
|
|
110
|
+
import shutil
|
|
111
|
+
import sys
|
|
112
|
+
import zipfile
|
|
113
|
+
|
|
114
|
+
archive_path = Path(sys.argv[1])
|
|
115
|
+
destination_root = Path(sys.argv[2])
|
|
116
|
+
license_member = 'gepa-0.1.4.dist-info/licenses/LICENSE'
|
|
117
|
+
|
|
118
|
+
with zipfile.ZipFile(archive_path) as archive:
|
|
119
|
+
for member in archive.infolist():
|
|
120
|
+
if member.is_dir():
|
|
121
|
+
continue
|
|
122
|
+
if member.filename.startswith('gepa/'):
|
|
123
|
+
relative_path = PurePosixPath('src') / PurePosixPath(member.filename)
|
|
124
|
+
elif member.filename == license_member:
|
|
125
|
+
relative_path = PurePosixPath('LICENSE')
|
|
126
|
+
else:
|
|
127
|
+
continue
|
|
128
|
+
if relative_path.is_absolute() or '..' in relative_path.parts:
|
|
129
|
+
raise ValueError(f'unsafe GEPA wheel member: {member.filename}')
|
|
130
|
+
destination = destination_root.joinpath(*relative_path.parts)
|
|
131
|
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
132
|
+
with archive.open(member) as source, destination.open('wb') as output:
|
|
133
|
+
shutil.copyfileobj(source, output)
|
|
134
|
+
`
|
|
135
|
+
const result = spawnSync('python3', ['-c', extractor, archivePath, officialVendorRoot], {
|
|
136
|
+
encoding: 'utf8',
|
|
137
|
+
})
|
|
138
|
+
if (result.status !== 0) {
|
|
139
|
+
const details = result.error?.message || result.stderr || result.stdout || 'no subprocess output'
|
|
140
|
+
throw new Error(`Unable to extract verified official GEPA wheel; python3 is required: ${details}`)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function vendorOfficialGepa(archivePath) {
|
|
145
|
+
assertPinnedGepaArchive(archivePath)
|
|
146
|
+
rmSync(officialVendorRoot, { recursive: true, force: true })
|
|
147
|
+
mkdirSync(officialVendorRoot, { recursive: true })
|
|
148
|
+
extractPinnedGepa(archivePath)
|
|
149
|
+
|
|
150
|
+
const files = collectFileHashes(officialVendorRoot)
|
|
151
|
+
writeFileSync(officialVendoredManifest, `${JSON.stringify({
|
|
152
|
+
schemaVersion: 'gepa-vendor.v1',
|
|
153
|
+
upstream: {
|
|
154
|
+
package: 'gepa',
|
|
155
|
+
version: GEPA_VERSION,
|
|
156
|
+
repositoryCommit: GEPA_RELEASE_COMMIT,
|
|
157
|
+
wheel: {
|
|
158
|
+
filename: GEPA_WHEEL_FILENAME,
|
|
159
|
+
sha256: GEPA_WHEEL_SHA256,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
files,
|
|
163
|
+
}, null, 2)}\n`)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (archiveArgumentIndex !== -1 && (!suppliedArchive || suppliedArchive.startsWith('--'))) {
|
|
167
|
+
throw new Error('Expected a source archive path after --archive')
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (shouldRefresh) {
|
|
171
|
+
if (!suppliedArchive) {
|
|
172
|
+
throw new Error('Refreshing official GEPA requires --archive <verified-wheel-path>')
|
|
173
|
+
}
|
|
174
|
+
assertPinnedGepaArchive(suppliedArchive)
|
|
175
|
+
cpSync(suppliedArchive, officialArchive)
|
|
176
|
+
}
|
|
23
177
|
|
|
24
178
|
if (shouldClean) {
|
|
25
179
|
if (hasSourcePackage) {
|
|
26
180
|
rmSync(vendorRoot, { recursive: true, force: true })
|
|
27
181
|
}
|
|
182
|
+
if (hasConnectorSourcePackage) {
|
|
183
|
+
rmSync(connectorVendorRoot, { recursive: true, force: true })
|
|
184
|
+
}
|
|
185
|
+
if (hasSourcePackage || hasConnectorSourcePackage) {
|
|
186
|
+
rmSync(officialVendorRoot, { recursive: true, force: true })
|
|
187
|
+
}
|
|
28
188
|
process.exit(0)
|
|
29
189
|
}
|
|
30
190
|
|
|
31
|
-
if (!hasSourcePackage) {
|
|
32
|
-
if (hasVendoredPackage) {
|
|
191
|
+
if (!hasSourcePackage || !hasConnectorSourcePackage) {
|
|
192
|
+
if (hasVendoredPackage && hasVendoredConnectorPackage && hasOfficialVendoredPackage) {
|
|
193
|
+
assertOfficialVendoredManifest()
|
|
33
194
|
process.exit(0)
|
|
34
195
|
}
|
|
35
|
-
|
|
196
|
+
if (hasVendoredPackage || hasVendoredConnectorPackage || hasOfficialVendoredPackage) {
|
|
197
|
+
throw new Error('Unable to vendor GEPA packages: vendored legacy, connector, or official package is incomplete')
|
|
198
|
+
}
|
|
199
|
+
throw new Error(`Unable to vendor GEPA packages: source package not found at ${sourceRoot} or ${connectorSourceRoot}`)
|
|
36
200
|
}
|
|
37
201
|
|
|
38
202
|
rmSync(vendorRoot, { recursive: true, force: true })
|
|
@@ -52,3 +216,22 @@ cpSync(sourceSrc, resolve(vendorRoot, 'src'), {
|
|
|
52
216
|
&& !normalizedPath.endsWith('/.DS_Store')
|
|
53
217
|
},
|
|
54
218
|
})
|
|
219
|
+
|
|
220
|
+
rmSync(connectorVendorRoot, { recursive: true, force: true })
|
|
221
|
+
mkdirSync(connectorVendorRoot, { recursive: true })
|
|
222
|
+
cpSync(resolve(connectorSourceRoot, 'pyproject.toml'), resolve(connectorVendorRoot, 'pyproject.toml'))
|
|
223
|
+
cpSync(resolve(connectorSourceRoot, 'src'), resolve(connectorVendorRoot, 'src'), {
|
|
224
|
+
recursive: true,
|
|
225
|
+
filter: sourcePath => {
|
|
226
|
+
const normalizedPath = sourcePath.replace(/\\/g, '/')
|
|
227
|
+
return !normalizedPath.endsWith('/__pycache__')
|
|
228
|
+
&& !normalizedPath.includes('/__pycache__/')
|
|
229
|
+
&& !normalizedPath.endsWith('.pyc')
|
|
230
|
+
&& !normalizedPath.endsWith('.pyo')
|
|
231
|
+
&& !normalizedPath.endsWith('/.pytest_cache')
|
|
232
|
+
&& !normalizedPath.includes('/.pytest_cache/')
|
|
233
|
+
&& !normalizedPath.endsWith('/.DS_Store')
|
|
234
|
+
},
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
vendorOfficialGepa(suppliedArchive ?? officialArchive)
|
package/src/diff-comments-cli.ts
CHANGED
|
@@ -36,6 +36,7 @@ interface DiffCommentPayloadComment {
|
|
|
36
36
|
body: string
|
|
37
37
|
author: DiffCommentAuthor
|
|
38
38
|
createdAt: string
|
|
39
|
+
componentKey?: string | null
|
|
39
40
|
anchor: { side: 'old' | 'new'; line: number }
|
|
40
41
|
context: {
|
|
41
42
|
lineText: string
|
|
@@ -50,7 +51,11 @@ interface DiffCommentPayloadPairContext {
|
|
|
50
51
|
bodies: { from: string; to: string } | null
|
|
51
52
|
degraded: { reason: DiffCommentContextUnavailableReason } | null
|
|
52
53
|
lengthStats: CliLengthStatsPair | null
|
|
53
|
-
lengthDelta:
|
|
54
|
+
lengthDelta: (
|
|
55
|
+
Partial<Record<keyof Omit<CliLengthDelta, 'splitUnavailableReason'>, unknown>> & {
|
|
56
|
+
splitUnavailableReason?: unknown
|
|
57
|
+
}
|
|
58
|
+
) | null
|
|
54
59
|
lengthDeltaUnavailableReason?: CliLengthMeasurementUnavailableReason
|
|
55
60
|
comments: DiffCommentPayloadComment[]
|
|
56
61
|
}
|
|
@@ -76,6 +81,12 @@ interface DiffCommentsPayload {
|
|
|
76
81
|
pairs: DiffCommentPayloadPair[]
|
|
77
82
|
}
|
|
78
83
|
|
|
84
|
+
interface RenderableLengthMetricDelta {
|
|
85
|
+
removed: number | null
|
|
86
|
+
added: number | null
|
|
87
|
+
net: number | null
|
|
88
|
+
}
|
|
89
|
+
|
|
79
90
|
export interface DiffCommentsCliContext {
|
|
80
91
|
getArg: (name: string) => string | null
|
|
81
92
|
rejectDashPrefixedOptionValue: (name: string, value: string | null) => void
|
|
@@ -171,6 +182,22 @@ function formatDeltaValue(
|
|
|
171
182
|
return metric === 'tokens' ? `~${formatted}` : formatted
|
|
172
183
|
}
|
|
173
184
|
|
|
185
|
+
function isLengthMetricDelta(
|
|
186
|
+
value: unknown
|
|
187
|
+
): value is RenderableLengthMetricDelta {
|
|
188
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
189
|
+
return false
|
|
190
|
+
}
|
|
191
|
+
const delta = value as Record<string, unknown>
|
|
192
|
+
const isNullableFiniteNumber = (candidate: unknown) =>
|
|
193
|
+
candidate === null || (
|
|
194
|
+
typeof candidate === 'number' && Number.isFinite(candidate)
|
|
195
|
+
)
|
|
196
|
+
return isNullableFiniteNumber(delta.removed) &&
|
|
197
|
+
isNullableFiniteNumber(delta.added) &&
|
|
198
|
+
isNullableFiniteNumber(delta.net)
|
|
199
|
+
}
|
|
200
|
+
|
|
174
201
|
function printLengthMeasurements(
|
|
175
202
|
ctx: DiffCommentsCliContext,
|
|
176
203
|
pair: DiffCommentPayloadPair
|
|
@@ -210,11 +237,15 @@ function printLengthMeasurements(
|
|
|
210
237
|
return
|
|
211
238
|
}
|
|
212
239
|
|
|
213
|
-
|
|
240
|
+
const splitUnavailableReason = pair.lengthDelta.splitUnavailableReason
|
|
241
|
+
if (
|
|
242
|
+
typeof splitUnavailableReason === 'string' &&
|
|
243
|
+
splitUnavailableReason.length > 0
|
|
244
|
+
) {
|
|
214
245
|
ctx.printLine(
|
|
215
246
|
` Split unavailable: ${sanitizeHumanInlineText(
|
|
216
247
|
ctx.sanitizeTerminalText,
|
|
217
|
-
|
|
248
|
+
splitUnavailableReason
|
|
218
249
|
)}`
|
|
219
250
|
)
|
|
220
251
|
}
|
|
@@ -225,6 +256,10 @@ function printLengthMeasurements(
|
|
|
225
256
|
['words', 'Words'],
|
|
226
257
|
] as const) {
|
|
227
258
|
const delta = pair.lengthDelta[metric]
|
|
259
|
+
if (!isLengthMetricDelta(delta)) {
|
|
260
|
+
ctx.printLine(` ${label}: unavailable`)
|
|
261
|
+
continue
|
|
262
|
+
}
|
|
228
263
|
ctx.printLine(
|
|
229
264
|
` ${label}: removed ${formatDeltaValue(delta.removed, metric)} · ` +
|
|
230
265
|
`added ${formatDeltaValue(delta.added, metric)} · ` +
|
|
@@ -330,6 +365,9 @@ function printDiffComments(ctx: DiffCommentsCliContext, payload: DiffCommentsPay
|
|
|
330
365
|
`${sanitizeHumanInlineText(ctx.sanitizeTerminalText, String(comment.anchor.line + 1))}`
|
|
331
366
|
)
|
|
332
367
|
printHumanTextBlock(ctx, comment.body)
|
|
368
|
+
if (typeof comment.componentKey === 'string' && comment.componentKey) {
|
|
369
|
+
ctx.printLine(` Component: ${sanitizeHumanInlineText(ctx.sanitizeTerminalText, comment.componentKey)}`)
|
|
370
|
+
}
|
|
333
371
|
|
|
334
372
|
if (comment.contextUnavailableReason) {
|
|
335
373
|
ctx.printLine(
|