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,162 @@
|
|
|
1
|
+
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { dirname, isAbsolute, relative, resolve } from 'node:path';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
// Keep file-backed component reads within the same text budget used by prompt
|
|
5
|
+
// tooling; request assembly never asks Node to allocate an unbounded body.
|
|
6
|
+
export const MAX_INSTRUCTION_SET_COMPONENT_BYTES = 512 * 1024;
|
|
7
|
+
const fail = (code) => { throw new Error(code); };
|
|
8
|
+
const sha256 = (value) => createHash('sha256').update(value, 'utf8').digest('hex');
|
|
9
|
+
function hasPinnedComponents(material) {
|
|
10
|
+
if (!material || typeof material !== 'object')
|
|
11
|
+
return false;
|
|
12
|
+
const pinned = material.pinnedComponents;
|
|
13
|
+
return Boolean(pinned && typeof pinned === 'object' && Object.keys(pinned).length > 0);
|
|
14
|
+
}
|
|
15
|
+
export function loadInstructionSetManifest(path) {
|
|
16
|
+
let value;
|
|
17
|
+
let source;
|
|
18
|
+
try {
|
|
19
|
+
source = readFileSync(path, 'utf8');
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return fail('instruction_set_path_not_found');
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
value = JSON.parse(source);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return fail('instruction_set_manifest_invalid_json');
|
|
29
|
+
}
|
|
30
|
+
if (!value || typeof value !== 'object')
|
|
31
|
+
return fail('instruction_set_manifest_invalid');
|
|
32
|
+
const input = value;
|
|
33
|
+
if (typeof input.name !== 'string' || input.name.trim() === '')
|
|
34
|
+
return fail('instruction_set_manifest_invalid_name');
|
|
35
|
+
const hasDescription = Object.hasOwn(input, 'description');
|
|
36
|
+
if (hasDescription && input.description !== null && typeof input.description !== 'string')
|
|
37
|
+
return fail('instruction_set_manifest_invalid_description');
|
|
38
|
+
const description = hasDescription
|
|
39
|
+
? input.description === '' ? null : input.description
|
|
40
|
+
: undefined;
|
|
41
|
+
if (hasPinnedComponents(input.default))
|
|
42
|
+
return fail('instruction_set_component_unavailable');
|
|
43
|
+
if (!Array.isArray(input.shape) || input.shape.length === 0 || input.shape.some(key => typeof key !== 'string' || key === '') || new Set(input.shape).size !== input.shape.length)
|
|
44
|
+
return fail('instruction_set_manifest_invalid_shape');
|
|
45
|
+
if (!Array.isArray(input.components))
|
|
46
|
+
return fail('instruction_set_manifest_invalid_components');
|
|
47
|
+
let root;
|
|
48
|
+
try {
|
|
49
|
+
root = realpathSync(dirname(path));
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return fail('instruction_set_path_not_found');
|
|
53
|
+
}
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
const loadedComponents = [];
|
|
56
|
+
for (const raw of input.components) {
|
|
57
|
+
if (!raw || typeof raw !== 'object')
|
|
58
|
+
return fail('instruction_set_manifest_invalid_component');
|
|
59
|
+
const component = raw;
|
|
60
|
+
if (typeof component.key !== 'string' || component.key === '' || !input.shape.includes(component.key))
|
|
61
|
+
return fail(component.key && !input.shape.includes(component.key) ? 'instruction_set_key_outside_shape' : 'instruction_set_manifest_invalid_component');
|
|
62
|
+
const modelConfig = component.modelConfig === undefined ? undefined : component.modelConfig;
|
|
63
|
+
if (modelConfig !== undefined && (typeof modelConfig !== 'string' || modelConfig === ''))
|
|
64
|
+
return fail('instruction_set_manifest_invalid_component');
|
|
65
|
+
const identity = `${component.key}\u0000${modelConfig ?? ''}`;
|
|
66
|
+
if (seen.has(identity))
|
|
67
|
+
return fail('instruction_set_duplicate_component');
|
|
68
|
+
seen.add(identity);
|
|
69
|
+
let text;
|
|
70
|
+
if (typeof component.text === 'string' && component.path === undefined)
|
|
71
|
+
text = component.text;
|
|
72
|
+
else if (typeof component.path === 'string' && component.text === undefined) {
|
|
73
|
+
if (isAbsolute(component.path))
|
|
74
|
+
return fail('instruction_set_path_escape');
|
|
75
|
+
const candidate = resolve(root, component.path);
|
|
76
|
+
if (relative(root, candidate).startsWith('..'))
|
|
77
|
+
return fail('instruction_set_path_escape');
|
|
78
|
+
if (!existsSync(candidate))
|
|
79
|
+
return fail('instruction_set_path_not_found');
|
|
80
|
+
let target;
|
|
81
|
+
try {
|
|
82
|
+
target = realpathSync(candidate);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return fail('instruction_set_path_not_found');
|
|
86
|
+
}
|
|
87
|
+
if (relative(root, target).startsWith('..'))
|
|
88
|
+
return fail('instruction_set_path_escape');
|
|
89
|
+
try {
|
|
90
|
+
text = readFileSync(target, 'utf8');
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return fail('instruction_set_path_not_found');
|
|
94
|
+
}
|
|
95
|
+
if (Buffer.byteLength(text, 'utf8') > MAX_INSTRUCTION_SET_COMPONENT_BYTES)
|
|
96
|
+
return fail('instruction_set_component_too_large');
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
return fail('instruction_set_manifest_invalid_component');
|
|
100
|
+
if (Buffer.byteLength(text, 'utf8') > MAX_INSTRUCTION_SET_COMPONENT_BYTES)
|
|
101
|
+
return fail('instruction_set_component_too_large');
|
|
102
|
+
const hasSyncBaseline = typeof component.syncedContentSha256 === 'string';
|
|
103
|
+
if (component.syncedContentSha256 !== undefined && (!hasSyncBaseline || !/^[a-f0-9]{64}$/u.test(component.syncedContentSha256)))
|
|
104
|
+
return fail('instruction_set_manifest_invalid_component');
|
|
105
|
+
loadedComponents.push({
|
|
106
|
+
key: component.key,
|
|
107
|
+
...(modelConfig === undefined ? {} : { modelConfig }),
|
|
108
|
+
text,
|
|
109
|
+
hasSyncBaseline,
|
|
110
|
+
changedSinceSync: hasSyncBaseline && sha256(text) !== component.syncedContentSha256,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
for (const key of input.shape)
|
|
114
|
+
if (!loadedComponents.some(component => component.key === key))
|
|
115
|
+
return fail('instruction_set_missing_shape_key');
|
|
116
|
+
const defaultIdentity = input.default && typeof input.default === 'object'
|
|
117
|
+
&& typeof input.default.modelConfigIdentity === 'string'
|
|
118
|
+
? input.default.modelConfigIdentity
|
|
119
|
+
: null;
|
|
120
|
+
let components = loadedComponents;
|
|
121
|
+
if (defaultIdentity) {
|
|
122
|
+
if (input.manifestVersion === 1 && input.shape.some(key => {
|
|
123
|
+
const bare = loadedComponents.find(component => component.key === key && component.modelConfig === undefined);
|
|
124
|
+
const tagged = loadedComponents.find(component => component.key === key && component.modelConfig === defaultIdentity);
|
|
125
|
+
return bare && tagged && (!bare.hasSyncBaseline || !tagged.hasSyncBaseline);
|
|
126
|
+
}))
|
|
127
|
+
return fail('instruction_set_sync_baseline_missing');
|
|
128
|
+
const changedDefaultKeys = new Set(loadedComponents.flatMap(component => (component.modelConfig === undefined && component.hasSyncBaseline && component.changedSinceSync
|
|
129
|
+
? [component.key]
|
|
130
|
+
: [])));
|
|
131
|
+
const changedSameIdentityKeys = new Set(loadedComponents.flatMap(component => (component.modelConfig === defaultIdentity && component.hasSyncBaseline && component.changedSinceSync
|
|
132
|
+
? [component.key]
|
|
133
|
+
: [])));
|
|
134
|
+
if ([...changedDefaultKeys].some(key => changedSameIdentityKeys.has(key)))
|
|
135
|
+
return fail('instruction_set_conflicting_synced_edits');
|
|
136
|
+
if (changedDefaultKeys.size > 0) {
|
|
137
|
+
components = loadedComponents.filter(component => (component.modelConfig !== defaultIdentity || !changedDefaultKeys.has(component.key)));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const namedProfiles = new Set([
|
|
141
|
+
...(components.some(component => component.modelConfig === undefined) && defaultIdentity
|
|
142
|
+
? [defaultIdentity]
|
|
143
|
+
: []),
|
|
144
|
+
...components.flatMap(component => component.modelConfig ? [component.modelConfig] : []),
|
|
145
|
+
]);
|
|
146
|
+
const namedProfileHasPins = Array.isArray(input.profiles) && input.profiles.some(profile => {
|
|
147
|
+
if (!profile || typeof profile !== 'object')
|
|
148
|
+
return false;
|
|
149
|
+
const value = profile;
|
|
150
|
+
return typeof value.modelConfigIdentity === 'string'
|
|
151
|
+
&& namedProfiles.has(value.modelConfigIdentity)
|
|
152
|
+
&& hasPinnedComponents(value.production);
|
|
153
|
+
});
|
|
154
|
+
if (namedProfileHasPins)
|
|
155
|
+
return fail('instruction_set_component_unavailable');
|
|
156
|
+
return {
|
|
157
|
+
name: input.name,
|
|
158
|
+
...(hasDescription ? { description } : {}),
|
|
159
|
+
shape: input.shape,
|
|
160
|
+
components: components.map(({ key, modelConfig, text }) => ({ key, ...(modelConfig === undefined ? {} : { modelConfig }), text })),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { renameSync, writeFileSync } from 'node:fs';
|
|
2
|
+
export interface InstructionSetsCommandIo {
|
|
3
|
+
json: boolean;
|
|
4
|
+
print: (line: string) => void;
|
|
5
|
+
resolveProjectSlug: (provided: string | null) => Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
export interface SyncComponent {
|
|
8
|
+
body?: string;
|
|
9
|
+
repoPath?: string;
|
|
10
|
+
contentSha?: string;
|
|
11
|
+
commitSha?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SyncMaterial {
|
|
14
|
+
profileVersionId: string;
|
|
15
|
+
versionNumber: number;
|
|
16
|
+
modelConfigIdentity: string;
|
|
17
|
+
resolvedFrom: string;
|
|
18
|
+
components: Record<string, SyncComponent>;
|
|
19
|
+
}
|
|
20
|
+
export interface SyncProfile {
|
|
21
|
+
modelConfigIdentity: string;
|
|
22
|
+
resolvedFrom: string;
|
|
23
|
+
production: SyncMaterial | null;
|
|
24
|
+
}
|
|
25
|
+
export interface SyncSet {
|
|
26
|
+
name: string;
|
|
27
|
+
slug?: string;
|
|
28
|
+
description?: string | null;
|
|
29
|
+
shape: string[];
|
|
30
|
+
default: SyncMaterial;
|
|
31
|
+
profiles: SyncProfile[];
|
|
32
|
+
filteredTo?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface SyncFileOps {
|
|
35
|
+
writeFileSync: typeof writeFileSync;
|
|
36
|
+
renameSync?: typeof renameSync;
|
|
37
|
+
}
|
|
38
|
+
export declare function syncToDisk(out: string, set: SyncSet, fileOps?: SyncFileOps): void;
|
|
39
|
+
export declare function instructionSetsCommand(args: string[], io: InstructionSetsCommandIo): Promise<number>;
|
|
40
|
+
//# sourceMappingURL=instruction-sets-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruction-sets-cli.d.ts","sourceRoot":"","sources":["../src/instruction-sets-cli.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuC,UAAU,EAAoB,aAAa,EAAE,MAAM,SAAS,CAAA;AAI1G,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACjE;AA+BD,MAAM,WAAW,aAAa;IAAG,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;AAC5G,MAAM,WAAW,YAAY;IAAG,gBAAgB,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAAE;AAC/K,MAAM,WAAW,WAAW;IAAG,mBAAmB,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE;AACnH,MAAM,WAAW,OAAO;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,WAAW,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE;AAM7K,MAAM,WAAW,WAAW;IAAG,aAAa,EAAE,OAAO,aAAa,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,UAAU,CAAA;CAAE;AAoCpG,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,WAA+B,QAyC7F;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+K1G"}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { authedFetch } from './http.js';
|
|
2
|
+
import { loadInstructionSetManifest, MAX_INSTRUCTION_SET_COMPONENT_BYTES } from './instruction-set-manifest.js';
|
|
3
|
+
import { sanitizeHumanInlineText, sanitizeTerminalText } from './json-response.js';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
7
|
+
function positionalArgs(args) {
|
|
8
|
+
const values = [];
|
|
9
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
10
|
+
const value = args[index];
|
|
11
|
+
if (value.startsWith('--')) {
|
|
12
|
+
if (argValue(args, value) !== null)
|
|
13
|
+
index += 1;
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
values.push(value);
|
|
17
|
+
}
|
|
18
|
+
return values;
|
|
19
|
+
}
|
|
20
|
+
function argValue(args, flag) {
|
|
21
|
+
const index = args.indexOf(flag);
|
|
22
|
+
return index === -1 || !args[index + 1] || args[index + 1].startsWith('--')
|
|
23
|
+
? null
|
|
24
|
+
: args[index + 1];
|
|
25
|
+
}
|
|
26
|
+
async function responsePayload(response, action) {
|
|
27
|
+
const payload = await response.json().catch(() => ({}));
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw new Error(`${action} failed (${response.status}): ${typeof payload.error === 'string' ? payload.error : response.statusText}`);
|
|
30
|
+
}
|
|
31
|
+
return payload;
|
|
32
|
+
}
|
|
33
|
+
const SAFE_SEGMENT = /^[A-Za-z0-9._-]+$/u;
|
|
34
|
+
function safeSegment(value) { if (!SAFE_SEGMENT.test(value) || value === '.' || value === '..' || value.startsWith('.'))
|
|
35
|
+
throw new Error('instruction_set_path_unsafe'); }
|
|
36
|
+
function slug(identity) { return identity.replaceAll('/', '__').replace(/[^A-Za-z0-9._-]/gu, '_'); }
|
|
37
|
+
function stable(value) { return `${JSON.stringify(value, null, 2)}\n`; }
|
|
38
|
+
function sha256(value) { return createHash('sha256').update(value, 'utf8').digest('hex'); }
|
|
39
|
+
function writeMaterial(root, material, shape, manifestRoot, fileOps = { writeFileSync }) {
|
|
40
|
+
const files = {};
|
|
41
|
+
const syncedContentSha256 = {};
|
|
42
|
+
const pinnedComponents = {};
|
|
43
|
+
for (const key of [...shape].sort()) {
|
|
44
|
+
safeSegment(key);
|
|
45
|
+
const component = material.components[key];
|
|
46
|
+
if (typeof component?.body === 'string') {
|
|
47
|
+
const relative = `${manifestRoot}/${key}.md`;
|
|
48
|
+
files[key] = relative;
|
|
49
|
+
const target = join(root, ...relative.split('/'));
|
|
50
|
+
mkdirSync(join(target, '..'), { recursive: true });
|
|
51
|
+
fileOps.writeFileSync(target, component.body);
|
|
52
|
+
syncedContentSha256[key] = sha256(component.body);
|
|
53
|
+
}
|
|
54
|
+
else if (component?.repoPath && component?.contentSha && component?.commitSha)
|
|
55
|
+
pinnedComponents[key] = { repoPath: component.repoPath, contentSha: component.contentSha, commitSha: component.commitSha };
|
|
56
|
+
else
|
|
57
|
+
throw new Error('instruction_set_unresolvable');
|
|
58
|
+
}
|
|
59
|
+
return { profileVersionId: material.profileVersionId, versionNumber: material.versionNumber, modelConfigIdentity: material.modelConfigIdentity, resolvedFrom: material.resolvedFrom, files, syncedContentSha256, ...(Object.keys(pinnedComponents).length ? { pinnedComponents } : {}) };
|
|
60
|
+
}
|
|
61
|
+
// Only the scratch paths THIS run created are ever removed; a user's own
|
|
62
|
+
// `.<set>.*.bak` in --out is never touched (PR #1668 review).
|
|
63
|
+
function removeOwnScratch(paths) {
|
|
64
|
+
for (const path of paths)
|
|
65
|
+
if (path && existsSync(path))
|
|
66
|
+
rmSync(path, { recursive: true, force: true });
|
|
67
|
+
}
|
|
68
|
+
function existingDestinationIsSynced(destination, name) {
|
|
69
|
+
try {
|
|
70
|
+
if (!statSync(destination).isDirectory())
|
|
71
|
+
return false;
|
|
72
|
+
const manifest = JSON.parse(readFileSync(join(destination, 'manifest.json'), 'utf8'));
|
|
73
|
+
return manifest.manifestVersion === 1 && manifest.name === name;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function syncToDisk(out, set, fileOps = { writeFileSync }) {
|
|
80
|
+
safeSegment(set.name);
|
|
81
|
+
for (const key of set.shape)
|
|
82
|
+
safeSegment(key);
|
|
83
|
+
const profileSlugs = new Set();
|
|
84
|
+
for (const profile of set.profiles) {
|
|
85
|
+
const value = slug(profile.modelConfigIdentity);
|
|
86
|
+
safeSegment(value);
|
|
87
|
+
if (profileSlugs.has(value))
|
|
88
|
+
throw new Error('instruction_set_slug_collision');
|
|
89
|
+
profileSlugs.add(value);
|
|
90
|
+
}
|
|
91
|
+
mkdirSync(out, { recursive: true });
|
|
92
|
+
const destination = join(out, set.name);
|
|
93
|
+
if (existsSync(destination) && !existingDestinationIsSynced(destination, set.name))
|
|
94
|
+
throw new Error('instruction_set_sync_destination_not_synced');
|
|
95
|
+
const temp = join(out, `.${set.name}.${randomUUID()}.tmp`);
|
|
96
|
+
const move = fileOps.renameSync || renameSync;
|
|
97
|
+
let backup = null;
|
|
98
|
+
mkdirSync(temp);
|
|
99
|
+
try {
|
|
100
|
+
const defaultMaterial = writeMaterial(temp, set.default, set.shape, 'default', fileOps);
|
|
101
|
+
const profiles = set.profiles.map(profile => ({
|
|
102
|
+
modelConfigIdentity: profile.modelConfigIdentity, slug: slug(profile.modelConfigIdentity), resolvedFrom: profile.resolvedFrom,
|
|
103
|
+
production: profile.production ? writeMaterial(temp, profile.production, set.shape, `profiles/${slug(profile.modelConfigIdentity)}`, fileOps) : null,
|
|
104
|
+
})).sort((a, b) => a.modelConfigIdentity.localeCompare(b.modelConfigIdentity));
|
|
105
|
+
const components = [
|
|
106
|
+
...Object.entries(defaultMaterial.files).map(([key, path]) => ({ key, path, syncedContentSha256: defaultMaterial.syncedContentSha256[key] })),
|
|
107
|
+
...profiles.flatMap(profile => profile.production
|
|
108
|
+
? Object.entries(profile.production.files).map(([key, path]) => ({ key, modelConfig: profile.modelConfigIdentity, path, syncedContentSha256: profile.production.syncedContentSha256[key] }))
|
|
109
|
+
: []),
|
|
110
|
+
];
|
|
111
|
+
const manifest = { manifestVersion: 1, name: set.name, ...(Object.hasOwn(set, 'description') ? { description: set.description ?? null } : {}), shape: set.shape, components, default: defaultMaterial, profiles, ...(set.filteredTo ? { filteredTo: [...set.filteredTo].sort() } : {}) };
|
|
112
|
+
fileOps.writeFileSync(join(temp, 'manifest.json'), stable(manifest));
|
|
113
|
+
backup = join(out, `.${set.name}.${randomUUID()}.bak`);
|
|
114
|
+
if (existsSync(destination))
|
|
115
|
+
move(destination, backup);
|
|
116
|
+
try {
|
|
117
|
+
move(temp, destination);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if (existsSync(backup))
|
|
121
|
+
move(backup, destination);
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
removeOwnScratch([backup]);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
removeOwnScratch([temp]);
|
|
128
|
+
if (backup && existsSync(backup) && !existsSync(destination))
|
|
129
|
+
move(backup, destination);
|
|
130
|
+
removeOwnScratch([backup]);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export async function instructionSetsCommand(args, io) {
|
|
135
|
+
const positionals = positionalArgs(args);
|
|
136
|
+
const [subcommand, reference] = positionals;
|
|
137
|
+
if (subcommand === 'default' && reference === 'move') {
|
|
138
|
+
const version = argValue(args, '--version');
|
|
139
|
+
if (!version || !/^[0-9]+$/u.test(version) || Number(version) < 1)
|
|
140
|
+
throw new Error('--version must be a positive integer');
|
|
141
|
+
}
|
|
142
|
+
let writeManifest;
|
|
143
|
+
if (subcommand === 'create' || subcommand === 'push') {
|
|
144
|
+
if (!reference || reference.startsWith('--'))
|
|
145
|
+
throw new Error(subcommand === 'create'
|
|
146
|
+
? 'Usage: orizu instructions create <manifest> --project <team/project> [--runner-version <id>] [--model-config <identity>] [--json]'
|
|
147
|
+
: 'Usage: orizu instructions push <manifest> --project <team/project> [--set <slug-or-exact-name>] [--runner-version <id>] [--json]');
|
|
148
|
+
writeManifest = loadInstructionSetManifest(reference);
|
|
149
|
+
}
|
|
150
|
+
const project = await io.resolveProjectSlug(argValue(args, '--project'));
|
|
151
|
+
if (subcommand === 'default') {
|
|
152
|
+
const operation = reference;
|
|
153
|
+
const set = positionals[2];
|
|
154
|
+
const identity = argValue(args, '--model-config');
|
|
155
|
+
const version = argValue(args, '--version');
|
|
156
|
+
if ((operation !== 'show' && operation !== 'move') || !set)
|
|
157
|
+
throw new Error('Usage: orizu instructions default show|move <set> --project <team/project> [--model-config <identity> --version <n>] [--json]');
|
|
158
|
+
if (operation === 'move' && (!identity || !version || !/^[0-9]+$/u.test(version) || Number(version) < 1))
|
|
159
|
+
throw new Error('--version must be a positive integer');
|
|
160
|
+
const path = `/api/cli/instruction-sets/${encodeURIComponent(set)}/default?project=${encodeURIComponent(project)}`;
|
|
161
|
+
if (operation === 'show') {
|
|
162
|
+
const payload = await responsePayload(await authedFetch(path, { method: 'GET' }), 'Instruction sets default show');
|
|
163
|
+
if (io.json)
|
|
164
|
+
io.print(JSON.stringify(payload));
|
|
165
|
+
else
|
|
166
|
+
io.print(`Default: v${payload.default?.versionNumber ?? '?'}`);
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
if (!io.json) {
|
|
170
|
+
const impact = await responsePayload(await authedFetch(path, { method: 'GET' }), 'Instruction sets default show');
|
|
171
|
+
const resolvesToDefault = Array.isArray(impact.resolvesToDefault) ? impact.resolvesToDefault.filter((item) => typeof item === 'string') : [];
|
|
172
|
+
io.print(`These model configs resolve to the default: ${resolvesToDefault.join(', ')}`);
|
|
173
|
+
}
|
|
174
|
+
const payload = await responsePayload(await authedFetch(path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ modelConfigIdentity: identity, versionNumber: Number(version) }) }), 'Instruction sets default move');
|
|
175
|
+
if (io.json)
|
|
176
|
+
io.print(JSON.stringify(payload));
|
|
177
|
+
else
|
|
178
|
+
io.print(`Default moved to ${identity} v${version}`);
|
|
179
|
+
return 0;
|
|
180
|
+
}
|
|
181
|
+
if (subcommand === 'shape') {
|
|
182
|
+
const operation = reference;
|
|
183
|
+
const set = positionals[2];
|
|
184
|
+
const key = argValue(args, '--key');
|
|
185
|
+
const from = argValue(args, '--from');
|
|
186
|
+
if ((operation !== 'add' && operation !== 'remove') || !set || !key || (operation === 'add' && !from))
|
|
187
|
+
throw new Error('Usage: orizu instructions shape add|remove <set> --project <team/project> --key <key> [--from <manifest>] [--json]');
|
|
188
|
+
let component;
|
|
189
|
+
if (operation === 'add') {
|
|
190
|
+
let manifest;
|
|
191
|
+
try {
|
|
192
|
+
manifest = JSON.parse(readFileSync(from, 'utf8'));
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
throw new Error('instruction_set_manifest_invalid_json');
|
|
196
|
+
}
|
|
197
|
+
const source = manifest && typeof manifest === 'object' && Array.isArray(manifest.components)
|
|
198
|
+
? manifest.components.find((item) => Boolean(item && typeof item === 'object' && item.key === key))
|
|
199
|
+
: undefined;
|
|
200
|
+
if (!source || typeof source.text !== 'string' || Buffer.byteLength(source.text, 'utf8') > MAX_INSTRUCTION_SET_COMPONENT_BYTES)
|
|
201
|
+
throw new Error(`Instruction set manifest has no component for key: ${key}`);
|
|
202
|
+
component = { body: source.text };
|
|
203
|
+
}
|
|
204
|
+
const payload = await responsePayload(await authedFetch(`/api/cli/instruction-sets/${encodeURIComponent(set)}/shape?project=${encodeURIComponent(project)}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ operation, key, ...(component ? { component } : {}) }) }), `Instruction sets shape ${operation}`);
|
|
205
|
+
if (io.json)
|
|
206
|
+
io.print(JSON.stringify(payload));
|
|
207
|
+
else {
|
|
208
|
+
io.print(`Shape ${operation === 'add' ? 'added' : 'removed'}: ${key}`);
|
|
209
|
+
const affected = Array.isArray(payload.affected) ? payload.affected : [];
|
|
210
|
+
const identities = [...new Set(affected.flatMap(pointer => pointer && typeof pointer === 'object' && typeof pointer.modelConfigIdentity === 'string' ? [pointer.modelConfigIdentity] : []))];
|
|
211
|
+
if (identities.length)
|
|
212
|
+
io.print(`${set} does not resolve for these model configs until the pointers move: ${identities.join(', ')}`);
|
|
213
|
+
for (const pointer of affected)
|
|
214
|
+
if (pointer && typeof pointer === 'object') {
|
|
215
|
+
const item = pointer;
|
|
216
|
+
if (typeof item.modelConfigIdentity === 'string' && (item.pointer === 'production' || item.pointer === 'default') && typeof item.headVersionNumber === 'number') {
|
|
217
|
+
const command = item.pointer === 'production' ? 'profiles promote' : 'default move';
|
|
218
|
+
const operatorAction = item.pointer === 'production' ? 'promote' : 'default move';
|
|
219
|
+
if (typeof item.stalePointerVersionNumber === 'number' && typeof item.branchedFromVersionNumber === 'number' && item.branchedFromVersionNumber !== item.stalePointerVersionNumber)
|
|
220
|
+
io.print(`${operatorAction} would move ${item.pointer} from v${item.stalePointerVersionNumber}'s text to v${item.headVersionNumber} = v${item.branchedFromVersionNumber}'s text + ${key}`);
|
|
221
|
+
io.print(`Follow up: instructions ${command} ${set} --project ${project} --model-config ${item.modelConfigIdentity} --version ${item.headVersionNumber}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return 0;
|
|
226
|
+
}
|
|
227
|
+
if (subcommand === 'profiles') {
|
|
228
|
+
const operation = reference;
|
|
229
|
+
const set = positionals[2];
|
|
230
|
+
const identity = argValue(args, '--model-config');
|
|
231
|
+
if ((operation !== 'new' && operation !== 'promote' && operation !== 'rollback') || !set || !identity)
|
|
232
|
+
throw new Error('Usage: orizu instructions profiles new|promote|rollback <set> --project <team/project> --model-config <identity> [--version <n>|--to <n>] [--json]');
|
|
233
|
+
const encodedSet = encodeURIComponent(set);
|
|
234
|
+
const encodedIdentity = encodeURIComponent(identity);
|
|
235
|
+
const version = argValue(args, '--version');
|
|
236
|
+
const to = argValue(args, '--to');
|
|
237
|
+
if ((operation === 'promote' && (!version || !/^[0-9]+$/u.test(version) || Number(version) < 1)) || (operation === 'rollback' && (!to || !/^[0-9]+$/u.test(to) || Number(to) < 1)))
|
|
238
|
+
throw new Error(operation === 'promote' ? '--version must be a positive integer' : '--to must be a positive integer');
|
|
239
|
+
const path = operation === 'new' ? `/api/cli/instruction-sets/${encodedSet}/profiles` : operation === 'promote' ? `/api/cli/instruction-sets/${encodedSet}/profiles/${encodedIdentity}/label` : `/api/cli/instruction-sets/${encodedSet}/profiles/${encodedIdentity}/rollback`;
|
|
240
|
+
const body = operation === 'new' ? { modelConfigIdentity: identity } : operation === 'promote' ? { versionNumber: Number(version) } : { to: Number(to) };
|
|
241
|
+
const payload = await responsePayload(await authedFetch(`${path}?project=${encodeURIComponent(project)}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }), `Instruction sets profiles ${operation}`);
|
|
242
|
+
if (io.json)
|
|
243
|
+
io.print(JSON.stringify(payload));
|
|
244
|
+
else {
|
|
245
|
+
const profile = payload.profile;
|
|
246
|
+
io.print(`${profile?.modelConfigIdentity || identity}: v${profile?.versionNumber ?? '?'} ${operation === 'new' ? 'created' : operation === 'promote' ? 'promoted' : 'rolled back'}`);
|
|
247
|
+
const mirrored = payload.mirroredPromptLabel;
|
|
248
|
+
if (mirrored && (typeof mirrored.promptName === 'string' || typeof mirrored.promptId === 'string'))
|
|
249
|
+
io.print(`also moved production for prompt ${typeof mirrored.promptName === 'string' ? mirrored.promptName : mirrored.promptId} (default profile → prompt label)`);
|
|
250
|
+
}
|
|
251
|
+
return 0;
|
|
252
|
+
}
|
|
253
|
+
if (subcommand === 'create' || subcommand === 'push') {
|
|
254
|
+
const manifest = writeManifest;
|
|
255
|
+
const modelConfig = argValue(args, '--model-config');
|
|
256
|
+
const runnerVersion = argValue(args, '--runner-version');
|
|
257
|
+
const setReference = argValue(args, '--set') || manifest.name;
|
|
258
|
+
const path = subcommand === 'create' ? '/api/cli/instruction-sets' : `/api/cli/instruction-sets/${encodeURIComponent(setReference)}/versions`;
|
|
259
|
+
const body = subcommand === 'create'
|
|
260
|
+
? { ...manifest, ...(modelConfig ? { modelConfigIdentity: modelConfig } : {}), ...(runnerVersion ? { runnerVersionId: runnerVersion } : {}) }
|
|
261
|
+
: { shape: manifest.shape, components: manifest.components, ...(Object.hasOwn(manifest, 'description') ? { description: manifest.description } : {}), ...(runnerVersion ? { runnerVersionId: runnerVersion } : {}) };
|
|
262
|
+
const payload = await responsePayload(await authedFetch(`${path}?project=${encodeURIComponent(project)}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }), `Instruction sets ${subcommand}`);
|
|
263
|
+
if (io.json)
|
|
264
|
+
io.print(JSON.stringify(payload));
|
|
265
|
+
else {
|
|
266
|
+
const set = payload.instructionSet;
|
|
267
|
+
const pushed = Array.isArray(payload.pushed) ? payload.pushed : [];
|
|
268
|
+
const unchanged = Array.isArray(payload.unchanged) ? payload.unchanged : [];
|
|
269
|
+
const skipped = Array.isArray(payload.skipped) ? payload.skipped : [];
|
|
270
|
+
if (subcommand === 'create') {
|
|
271
|
+
const profiles = Array.isArray(set?.profiles) ? set.profiles : [];
|
|
272
|
+
io.print(`${set?.name || manifest.name}: ${profiles.length} profile(s) created`);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
const describe = (value) => {
|
|
276
|
+
if (typeof value === 'string')
|
|
277
|
+
return value;
|
|
278
|
+
if (value && typeof value === 'object') {
|
|
279
|
+
const row = value;
|
|
280
|
+
return `${typeof row.modelConfigIdentity === 'string' ? row.modelConfigIdentity : 'unknown'}${typeof row.versionNumber === 'number' ? ` v${row.versionNumber}` : ''}`;
|
|
281
|
+
}
|
|
282
|
+
return 'unknown';
|
|
283
|
+
};
|
|
284
|
+
io.print(`${set?.name || manifest.name}: pushed ${pushed.map(describe).join(', ') || 'none'}; unchanged ${unchanged.map(describe).join(', ') || 'none'}; skipped ${skipped.map(describe).join(', ') || 'none'}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return 0;
|
|
288
|
+
}
|
|
289
|
+
if (subcommand === 'archive' || subcommand === 'restore') {
|
|
290
|
+
if (!reference || reference.startsWith('--'))
|
|
291
|
+
throw new Error(`Usage: orizu instructions ${subcommand} <slug-or-exact-name> --project <team/project> [--json]`);
|
|
292
|
+
const archived = subcommand === 'archive';
|
|
293
|
+
const payload = await responsePayload(await authedFetch(`/api/cli/instruction-sets/${encodeURIComponent(reference)}?project=${encodeURIComponent(project)}`, {
|
|
294
|
+
method: 'PATCH',
|
|
295
|
+
headers: { 'content-type': 'application/json' },
|
|
296
|
+
body: JSON.stringify({ archived }),
|
|
297
|
+
}), `Instructions ${subcommand}`);
|
|
298
|
+
if (io.json)
|
|
299
|
+
io.print(JSON.stringify(payload));
|
|
300
|
+
else {
|
|
301
|
+
const set = payload.instructionSet;
|
|
302
|
+
const identity = set?.slug && set.slug !== set.name ? `${set.name || reference} (${set.slug})` : set?.name || set?.slug || reference;
|
|
303
|
+
io.print(`${archived ? 'Archived' : 'Restored'} instruction set ${identity}`);
|
|
304
|
+
}
|
|
305
|
+
return 0;
|
|
306
|
+
}
|
|
307
|
+
const status = argValue(args, '--status') || 'active';
|
|
308
|
+
if (subcommand !== 'list' && subcommand !== 'show' && subcommand !== 'sync')
|
|
309
|
+
throw new Error('Usage: orizu instructions list|show|sync|archive|restore');
|
|
310
|
+
if (subcommand === 'sync') {
|
|
311
|
+
const output = argValue(args, '--out');
|
|
312
|
+
if (!reference || !output)
|
|
313
|
+
throw new Error('Usage: orizu instructions sync <set> --out <dir> --project <team/project> [--model-config <identity>] [--json]');
|
|
314
|
+
const modelConfig = argValue(args, '--model-config');
|
|
315
|
+
const path = `/api/cli/instruction-sets/${encodeURIComponent(reference)}/sync?project=${encodeURIComponent(project)}${modelConfig ? `&modelConfig=${encodeURIComponent(modelConfig)}` : ''}`;
|
|
316
|
+
const payload = await responsePayload(await authedFetch(path, { method: 'GET' }), 'Instruction sets sync');
|
|
317
|
+
const set = payload.instructionSet;
|
|
318
|
+
if (!set || (set.slug !== reference && set.name !== reference) || (modelConfig && (!Array.isArray(set.filteredTo) || set.filteredTo.length !== 1 || set.filteredTo[0] !== modelConfig))) {
|
|
319
|
+
throw new Error('instruction_set_sync_response_mismatch');
|
|
320
|
+
}
|
|
321
|
+
syncToDisk(output, set);
|
|
322
|
+
if (io.json)
|
|
323
|
+
io.print(JSON.stringify(payload));
|
|
324
|
+
else
|
|
325
|
+
io.print(`Synced ${set.name} to ${join(output, set.name)}`);
|
|
326
|
+
return 0;
|
|
327
|
+
}
|
|
328
|
+
if (subcommand === 'show' && (!reference || reference.startsWith('--')))
|
|
329
|
+
throw new Error('Instruction set name is required');
|
|
330
|
+
if (status !== 'active' && status !== 'archived' && status !== 'all')
|
|
331
|
+
throw new Error('--status must be active, archived, or all');
|
|
332
|
+
const query = `project=${encodeURIComponent(project)}&status=${encodeURIComponent(status)}`;
|
|
333
|
+
const path = subcommand === 'list'
|
|
334
|
+
? `/api/cli/instruction-sets?${query}`
|
|
335
|
+
: `/api/cli/instruction-sets/${encodeURIComponent(reference)}?${query}`;
|
|
336
|
+
const payload = await responsePayload(await authedFetch(path, { method: 'GET' }), `Instruction sets ${subcommand}`);
|
|
337
|
+
if (io.json) {
|
|
338
|
+
io.print(JSON.stringify(payload));
|
|
339
|
+
return 0;
|
|
340
|
+
}
|
|
341
|
+
if (subcommand === 'list') {
|
|
342
|
+
const sets = Array.isArray(payload.instructionSets) ? payload.instructionSets : [];
|
|
343
|
+
for (const item of sets) {
|
|
344
|
+
const set = item;
|
|
345
|
+
io.print(`${set.name || 'unnamed'}${set.slug ? ` [${set.slug}]` : ''}${set.status === 'archived' ? ' [archived]' : ''}${set.shape ? ` (${set.shape.join(', ')})` : ''}`);
|
|
346
|
+
if (set.description)
|
|
347
|
+
io.print(` ${sanitizeHumanInlineText(sanitizeTerminalText, set.description)}`);
|
|
348
|
+
}
|
|
349
|
+
return 0;
|
|
350
|
+
}
|
|
351
|
+
const set = payload.instructionSet;
|
|
352
|
+
io.print(`${set?.name || reference}${set?.status === 'archived' ? ' [archived]' : ''}: ${set?.shape?.join(', ') || ''}`);
|
|
353
|
+
if (set?.description)
|
|
354
|
+
io.print(`Description: ${sanitizeHumanInlineText(sanitizeTerminalText, set.description)}`);
|
|
355
|
+
if (set?.default)
|
|
356
|
+
io.print(`Default: v${set.default.versionNumber ?? '?'}`);
|
|
357
|
+
for (const profile of set?.profiles || []) {
|
|
358
|
+
io.print(`${profile.modelConfigIdentity || 'unspecified'}: production ${profile.production ? `v${profile.production.versionNumber}` : '—'}, latest ${profile.latestVersionNumber ?? '—'}`);
|
|
359
|
+
}
|
|
360
|
+
return 0;
|
|
361
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function sanitizeTerminalText(value: unknown): string;
|
|
2
|
+
export declare function sanitizeHumanInlineText(sanitizer: (value: unknown) => string, value: unknown): string;
|
|
3
|
+
export declare function parseJsonResponse<T>(response: Response, context: string): Promise<T>;
|
|
4
|
+
//# sourceMappingURL=json-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-response.d.ts","sourceRoot":"","sources":["../src/json-response.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAK3D;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,EACrC,KAAK,EAAE,OAAO,GACb,MAAM,CAER;AAED,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAmBZ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const JSONL_UPLOAD_CHUNK_MAX_BYTES: number;
|
|
2
|
+
interface JsonlChunkOptions {
|
|
3
|
+
maxPayloadBytes?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function estimateRowsPayloadByteLength(rows: Array<Record<string, unknown>>): number;
|
|
6
|
+
export declare function streamJsonlRowChunks(filePath: string, options?: JsonlChunkOptions): AsyncGenerator<Array<Record<string, unknown>>>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=jsonl-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl-stream.d.ts","sourceRoot":"","sources":["../src/jsonl-stream.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,QAAkB,CAAA;AAE3D,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AA2CD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAM1F;AAED,wBAAuB,oBAAoB,CACzC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,iBAAsB,GAC9B,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAqEhD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-team agent kill switch CLI (ALI-1007 / G6):
|
|
3
|
+
* orizu team kill-agents <team> [--reason <text>]
|
|
4
|
+
* orizu team release-agents <team>
|
|
5
|
+
*
|
|
6
|
+
* `kill-agents` ENGAGES the switch — ends every active session of the team and
|
|
7
|
+
* revokes its agent tokens "in seconds"; `release-agents` re-enables minting
|
|
8
|
+
* (killed sessions stay ended). Human ADMIN only: the server rejects agent
|
|
9
|
+
* bearers and non-admins. Pure command logic with an injected fetcher so the
|
|
10
|
+
* entry point owns argument parsing and human/JSON output.
|
|
11
|
+
*
|
|
12
|
+
* Containment (ALI-1166): the guarantee is session-end + per-request
|
|
13
|
+
* verification + token-row revocation at engage — a bearer bound to an ended
|
|
14
|
+
* session can never verify again, and ended sessions are terminal
|
|
15
|
+
* (DB-enforced; no post-kill resurrection).
|
|
16
|
+
* `tokensRevoked` in the summary counts the persisted agent token rows the
|
|
17
|
+
* engage revoked (trigger cascade + belt, one transaction); it may include
|
|
18
|
+
* expired or already-ended-session stragglers that were never live bearers at
|
|
19
|
+
* kill time. `--json` output is the server's summary passed through, including
|
|
20
|
+
* `containment: "session-end"`.
|
|
21
|
+
*/
|
|
22
|
+
export type CliFetcher = (path: string, init?: RequestInit) => Promise<Response>;
|
|
23
|
+
export interface KillSwitchCommandIo {
|
|
24
|
+
json: boolean;
|
|
25
|
+
print: (line: string) => void;
|
|
26
|
+
printErr?: (line: string) => void;
|
|
27
|
+
fetcher?: CliFetcher;
|
|
28
|
+
}
|
|
29
|
+
export declare function killSwitchCommand(args: string[], io: KillSwitchCommandIo): Promise<number>;
|
|
30
|
+
//# sourceMappingURL=kill-switch-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kill-switch-cli.d.ts","sourceRoot":"","sources":["../src/kill-switch-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEhF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,OAAO,CAAC,EAAE,UAAU,CAAA;CACrB;AA8CD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ChG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface LoopbackServer {
|
|
2
|
+
port: number;
|
|
3
|
+
stop: (force?: boolean) => void;
|
|
4
|
+
}
|
|
5
|
+
interface LoopbackServeOptions {
|
|
6
|
+
port: number;
|
|
7
|
+
hostname: '127.0.0.1';
|
|
8
|
+
fetch: (request: Request) => Promise<Response> | Response;
|
|
9
|
+
}
|
|
10
|
+
export interface LoopbackServeRuntime {
|
|
11
|
+
serve: (options: LoopbackServeOptions) => {
|
|
12
|
+
port?: number;
|
|
13
|
+
stop: (force?: boolean) => void;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Bind a separate-process test server to loopback.
|
|
18
|
+
*
|
|
19
|
+
* The full parallel suite exposed intermittent Bun `port: 0` startup failures,
|
|
20
|
+
* so these fixtures use explicit high-port candidates. `serve()` still performs
|
|
21
|
+
* the atomic bind; a collision retries only when Bun reports `EADDRINUSE`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function serveOnLoopback(runtime: LoopbackServeRuntime, requestedPort: number | undefined, fetch: (request: Request) => Promise<Response> | Response, serverName: string): LoopbackServer;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=loopback-serve.d.ts.map
|