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.
Files changed (378) hide show
  1. package/README.md +23 -0
  2. package/dist/archive-artifacts-cli.d.ts +50 -0
  3. package/dist/archive-artifacts-cli.d.ts.map +1 -0
  4. package/dist/artifact-archive.d.ts +48 -0
  5. package/dist/artifact-archive.d.ts.map +1 -0
  6. package/dist/artifact-pull.d.ts +22 -0
  7. package/dist/artifact-pull.d.ts.map +1 -0
  8. package/dist/banner.d.ts +3 -0
  9. package/dist/banner.d.ts.map +1 -0
  10. package/dist/connectors-cli.d.ts +31 -0
  11. package/dist/connectors-cli.d.ts.map +1 -0
  12. package/dist/credentials.d.ts +46 -0
  13. package/dist/credentials.d.ts.map +1 -0
  14. package/dist/csv.d.ts +49 -0
  15. package/dist/csv.d.ts.map +1 -0
  16. package/dist/dataset-download.d.ts +6 -0
  17. package/dist/dataset-download.d.ts.map +1 -0
  18. package/dist/dataset-edit-rows.d.ts +10 -0
  19. package/dist/dataset-edit-rows.d.ts.map +1 -0
  20. package/dist/dataset-upload-snapshot.d.ts +13 -0
  21. package/dist/dataset-upload-snapshot.d.ts.map +1 -0
  22. package/dist/daytona-slice-rehearsal.d.ts +89 -0
  23. package/dist/daytona-slice-rehearsal.d.ts.map +1 -0
  24. package/dist/daytona-slice.d.ts +106 -0
  25. package/dist/daytona-slice.d.ts.map +1 -0
  26. package/dist/deploy-key-merge-core.d.ts +121 -0
  27. package/dist/deploy-key-merge-core.d.ts.map +1 -0
  28. package/dist/diff-comments-cli.d.ts +12 -0
  29. package/dist/diff-comments-cli.d.ts.map +1 -0
  30. package/dist/diff-comments-cli.js +21 -2
  31. package/dist/egress-allowlist-cli.d.ts +23 -0
  32. package/dist/egress-allowlist-cli.d.ts.map +1 -0
  33. package/dist/egress-policy.d.ts +108 -0
  34. package/dist/egress-policy.d.ts.map +1 -0
  35. package/dist/error-response.d.ts +9 -0
  36. package/dist/error-response.d.ts.map +1 -0
  37. package/dist/file-parser.d.ts +5 -0
  38. package/dist/file-parser.d.ts.map +1 -0
  39. package/dist/gepa-engine-dispatch.d.ts +9 -0
  40. package/dist/gepa-engine-dispatch.d.ts.map +1 -0
  41. package/dist/gepa-engine-dispatch.js +307 -0
  42. package/dist/gepa-python-command.d.ts +6 -0
  43. package/dist/gepa-python-command.d.ts.map +1 -0
  44. package/dist/gepa-python-command.js +26 -0
  45. package/dist/gepa-python-paths.d.ts +6 -0
  46. package/dist/gepa-python-paths.d.ts.map +1 -0
  47. package/dist/gepa-python-paths.js +42 -0
  48. package/dist/git-credential.d.ts +69 -0
  49. package/dist/git-credential.d.ts.map +1 -0
  50. package/dist/git-recovery-environment.d.ts +31 -0
  51. package/dist/git-recovery-environment.d.ts.map +1 -0
  52. package/dist/github-setup.d.ts +122 -0
  53. package/dist/github-setup.d.ts.map +1 -0
  54. package/dist/global-flags.d.ts +12 -0
  55. package/dist/global-flags.d.ts.map +1 -0
  56. package/dist/help.d.ts +46 -0
  57. package/dist/help.d.ts.map +1 -0
  58. package/dist/help.js +93 -25
  59. package/dist/hosted-boot.d.ts +273 -0
  60. package/dist/hosted-boot.d.ts.map +1 -0
  61. package/dist/hosted-bootstrap-rehearsal.d.ts +86 -0
  62. package/dist/hosted-bootstrap-rehearsal.d.ts.map +1 -0
  63. package/dist/hosted-bootstrap.d.ts +188 -0
  64. package/dist/hosted-bootstrap.d.ts.map +1 -0
  65. package/dist/hosted-broker-server.d.ts +50 -0
  66. package/dist/hosted-broker-server.d.ts.map +1 -0
  67. package/dist/hosted-git-http-server.d.ts +36 -0
  68. package/dist/hosted-git-http-server.d.ts.map +1 -0
  69. package/dist/hosted-harness-claude.d.ts +195 -0
  70. package/dist/hosted-harness-claude.d.ts.map +1 -0
  71. package/dist/hosted-harness-opencode.d.ts +227 -0
  72. package/dist/hosted-harness-opencode.d.ts.map +1 -0
  73. package/dist/hosted-harness.d.ts +118 -0
  74. package/dist/hosted-harness.d.ts.map +1 -0
  75. package/dist/hosted-harvest.d.ts +68 -0
  76. package/dist/hosted-harvest.d.ts.map +1 -0
  77. package/dist/hosted-headless.d.ts +72 -0
  78. package/dist/hosted-headless.d.ts.map +1 -0
  79. package/dist/hosted-loop-lifecycle.d.ts +206 -0
  80. package/dist/hosted-loop-lifecycle.d.ts.map +1 -0
  81. package/dist/hosted-loop.d.ts +170 -0
  82. package/dist/hosted-loop.d.ts.map +1 -0
  83. package/dist/hosted-run-event-sink.d.ts +222 -0
  84. package/dist/hosted-run-event-sink.d.ts.map +1 -0
  85. package/dist/hosted-runtime-assets.d.ts +186 -0
  86. package/dist/hosted-runtime-assets.d.ts.map +1 -0
  87. package/dist/hosted-session-cli.d.ts +258 -0
  88. package/dist/hosted-session-cli.d.ts.map +1 -0
  89. package/dist/hosted-skill-staging.d.ts +73 -0
  90. package/dist/hosted-skill-staging.d.ts.map +1 -0
  91. package/dist/http.d.ts +8 -0
  92. package/dist/http.d.ts.map +1 -0
  93. package/dist/index.d.ts +22 -0
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +119 -129
  96. package/dist/instruction-set-gepa-launch.d.ts +3 -0
  97. package/dist/instruction-set-gepa-launch.d.ts.map +1 -0
  98. package/dist/instruction-set-gepa-launch.js +15 -0
  99. package/dist/instruction-set-loader.d.ts +6 -0
  100. package/dist/instruction-set-loader.d.ts.map +1 -0
  101. package/dist/instruction-set-loader.js +59 -0
  102. package/dist/instruction-set-manifest.d.ts +14 -0
  103. package/dist/instruction-set-manifest.d.ts.map +1 -0
  104. package/dist/instruction-set-manifest.js +162 -0
  105. package/dist/instruction-sets-cli.d.ts +40 -0
  106. package/dist/instruction-sets-cli.d.ts.map +1 -0
  107. package/dist/instruction-sets-cli.js +361 -0
  108. package/dist/json-response.d.ts +4 -0
  109. package/dist/json-response.d.ts.map +1 -0
  110. package/dist/jsonl-stream.d.ts +8 -0
  111. package/dist/jsonl-stream.d.ts.map +1 -0
  112. package/dist/kill-switch-cli.d.ts +30 -0
  113. package/dist/kill-switch-cli.d.ts.map +1 -0
  114. package/dist/loopback-serve.d.ts +25 -0
  115. package/dist/loopback-serve.d.ts.map +1 -0
  116. package/dist/manifests-cli.d.ts +22 -0
  117. package/dist/manifests-cli.d.ts.map +1 -0
  118. package/dist/markdown-report-input.d.ts +7 -0
  119. package/dist/markdown-report-input.d.ts.map +1 -0
  120. package/dist/markdown-report-input.js +15 -1
  121. package/dist/merge-job.d.ts +155 -0
  122. package/dist/merge-job.d.ts.map +1 -0
  123. package/dist/model-configs-cli.d.ts +19 -0
  124. package/dist/model-configs-cli.d.ts.map +1 -0
  125. package/dist/model-configs-cli.js +104 -0
  126. package/dist/optimization-export-cli.d.ts +19 -0
  127. package/dist/optimization-export-cli.d.ts.map +1 -0
  128. package/dist/optimizations-list-cli.d.ts +20 -0
  129. package/dist/optimizations-list-cli.d.ts.map +1 -0
  130. package/dist/optimizations-promote-cli.d.ts +8 -0
  131. package/dist/optimizations-promote-cli.d.ts.map +1 -0
  132. package/dist/optimizations-promote-cli.js +34 -0
  133. package/dist/option-validation.d.ts +15 -0
  134. package/dist/option-validation.d.ts.map +1 -0
  135. package/dist/preview-runtime.d.ts +63 -0
  136. package/dist/preview-runtime.d.ts.map +1 -0
  137. package/dist/prompt-draft-push.d.ts +60 -0
  138. package/dist/prompt-draft-push.d.ts.map +1 -0
  139. package/dist/prompt-label-cli.d.ts +11 -0
  140. package/dist/prompt-label-cli.d.ts.map +1 -0
  141. package/dist/prompt-label-cli.js +29 -0
  142. package/dist/prompt-length-wire.d.ts +28 -0
  143. package/dist/prompt-length-wire.d.ts.map +1 -0
  144. package/dist/prompt-length-wire.js +2 -2
  145. package/dist/prompt-report-cli.d.ts +10 -0
  146. package/dist/prompt-report-cli.d.ts.map +1 -0
  147. package/dist/prompt-report-cli.js +2 -2
  148. package/dist/prompt-summary-table.d.ts +15 -0
  149. package/dist/prompt-summary-table.d.ts.map +1 -0
  150. package/dist/prompt-summary-table.js +6 -0
  151. package/dist/registration-tag-warning.d.ts +32 -0
  152. package/dist/registration-tag-warning.d.ts.map +1 -0
  153. package/dist/report-comments-cli.d.ts +16 -0
  154. package/dist/report-comments-cli.d.ts.map +1 -0
  155. package/dist/report-markdown-blankness.d.ts +2 -0
  156. package/dist/report-markdown-blankness.d.ts.map +1 -0
  157. package/dist/report-markdown-blankness.js +6 -0
  158. package/dist/report-replacement-warning.d.ts +17 -0
  159. package/dist/report-replacement-warning.d.ts.map +1 -0
  160. package/dist/report-replacement-warning.js +31 -0
  161. package/dist/repository-backup-core.d.ts +225 -0
  162. package/dist/repository-backup-core.d.ts.map +1 -0
  163. package/dist/repository-recovery-manifest.d.ts +83 -0
  164. package/dist/repository-recovery-manifest.d.ts.map +1 -0
  165. package/dist/run-event-digest.d.ts +74 -0
  166. package/dist/run-event-digest.d.ts.map +1 -0
  167. package/dist/runner-dir-verify.d.ts +66 -0
  168. package/dist/runner-dir-verify.d.ts.map +1 -0
  169. package/dist/runner-instruction-set-contract.d.ts +24 -0
  170. package/dist/runner-instruction-set-contract.d.ts.map +1 -0
  171. package/dist/runner-instruction-set-contract.js +50 -0
  172. package/dist/sandbox-hygiene.d.ts +45 -0
  173. package/dist/sandbox-hygiene.d.ts.map +1 -0
  174. package/dist/sandbox-provider.d.ts +193 -0
  175. package/dist/sandbox-provider.d.ts.map +1 -0
  176. package/dist/scorer-draft-push.d.ts +50 -0
  177. package/dist/scorer-draft-push.d.ts.map +1 -0
  178. package/dist/scorers-cli.d.ts +20 -0
  179. package/dist/scorers-cli.d.ts.map +1 -0
  180. package/dist/scorers-cli.js +22 -0
  181. package/dist/scorers-verify-parity-bridge.d.ts +16 -0
  182. package/dist/scorers-verify-parity-bridge.d.ts.map +1 -0
  183. package/dist/scorers-verify-parity-bridge.js +90 -0
  184. package/dist/scorers-verify-parity.d.ts +81 -0
  185. package/dist/scorers-verify-parity.d.ts.map +1 -0
  186. package/dist/scorers-verify-parity.js +502 -0
  187. package/dist/scores-accept-cli.d.ts +21 -0
  188. package/dist/scores-accept-cli.d.ts.map +1 -0
  189. package/dist/secret-redaction.d.ts +47 -0
  190. package/dist/secret-redaction.d.ts.map +1 -0
  191. package/dist/session-timeline.d.ts +54 -0
  192. package/dist/session-timeline.d.ts.map +1 -0
  193. package/dist/setup-prompt.d.ts +5 -0
  194. package/dist/setup-prompt.d.ts.map +1 -0
  195. package/dist/skill-installer.d.ts +68 -0
  196. package/dist/skill-installer.d.ts.map +1 -0
  197. package/dist/skilled-proposer-launch.d.ts +7 -0
  198. package/dist/skilled-proposer-launch.d.ts.map +1 -0
  199. package/dist/skilled-proposer-launch.js +60 -0
  200. package/dist/smoke.d.ts +102 -0
  201. package/dist/smoke.d.ts.map +1 -0
  202. package/dist/start-intent.d.ts +12 -0
  203. package/dist/start-intent.d.ts.map +1 -0
  204. package/dist/task-assignment-manifest.d.ts +15 -0
  205. package/dist/task-assignment-manifest.d.ts.map +1 -0
  206. package/dist/task-create-error.d.ts +18 -0
  207. package/dist/task-create-error.d.ts.map +1 -0
  208. package/dist/team-connectors-cli.d.ts +29 -0
  209. package/dist/team-connectors-cli.d.ts.map +1 -0
  210. package/dist/types.d.ts +39 -0
  211. package/dist/types.d.ts.map +1 -0
  212. package/dist/vercel-sandbox-provider.d.ts +156 -0
  213. package/dist/vercel-sandbox-provider.d.ts.map +1 -0
  214. package/dist/workbench-cli.d.ts +233 -0
  215. package/dist/workbench-cli.d.ts.map +1 -0
  216. package/dist/workspace-sync.d.ts +207 -0
  217. package/dist/workspace-sync.d.ts.map +1 -0
  218. package/dist/workspace.d.ts +92 -0
  219. package/dist/workspace.d.ts.map +1 -0
  220. package/dist/zip-draft-push.d.ts +55 -0
  221. package/dist/zip-draft-push.d.ts.map +1 -0
  222. package/package.json +15 -2
  223. package/requirements/README.md +138 -0
  224. package/requirements/skilled-proposer.in +66 -0
  225. package/requirements/skilled-proposer.lock +265 -0
  226. package/scripts/build-cli-dist.mjs +30 -0
  227. package/scripts/ensure-skilled-proposer-venv.mjs +5 -0
  228. package/scripts/orizu-source-checkout.d.mts +1 -0
  229. package/scripts/orizu-source-checkout.mjs +10 -0
  230. package/scripts/refresh-skilled-proposer-lock.mjs +256 -0
  231. package/scripts/vendor-gepa-python.mjs +187 -4
  232. package/src/diff-comments-cli.ts +41 -3
  233. package/src/gepa-engine-dispatch.ts +340 -0
  234. package/src/gepa-python-command.ts +31 -0
  235. package/src/gepa-python-paths.ts +56 -0
  236. package/src/help.ts +95 -25
  237. package/src/index.ts +131 -166
  238. package/src/instruction-set-gepa-launch.ts +28 -0
  239. package/src/instruction-set-loader.ts +37 -0
  240. package/src/instruction-set-manifest.ts +120 -0
  241. package/src/instruction-sets-cli.ts +306 -0
  242. package/src/markdown-report-input.ts +19 -1
  243. package/src/model-configs-cli.ts +119 -0
  244. package/src/optimizations-promote-cli.ts +41 -0
  245. package/src/prompt-label-cli.ts +55 -0
  246. package/src/prompt-length-wire.ts +1 -1
  247. package/src/prompt-report-cli.ts +2 -2
  248. package/src/prompt-summary-table.ts +12 -0
  249. package/src/report-markdown-blankness.ts +6 -0
  250. package/src/report-replacement-warning.ts +35 -0
  251. package/src/runner-instruction-set-contract.ts +64 -0
  252. package/src/scorers-cli.ts +40 -0
  253. package/src/scorers-verify-parity-bridge.ts +90 -0
  254. package/src/scorers-verify-parity.ts +564 -0
  255. package/src/skilled-proposer-launch.ts +89 -0
  256. package/src/skilled-proposer-venv-manager.mjs +757 -0
  257. package/tsconfig.json +2 -0
  258. package/vendor/gepa-python/LICENSE +7 -0
  259. package/vendor/gepa-python/manifest.json +107 -0
  260. package/vendor/gepa-python/src/gepa/__init__.py +22 -0
  261. package/vendor/gepa-python/src/gepa/adapters/__init__.py +0 -0
  262. package/vendor/gepa-python/src/gepa/adapters/anymaths_adapter/__init__.py +1 -0
  263. package/vendor/gepa-python/src/gepa/adapters/anymaths_adapter/anymaths_adapter.py +174 -0
  264. package/vendor/gepa-python/src/gepa/adapters/confidence_adapter/__init__.py +26 -0
  265. package/vendor/gepa-python/src/gepa/adapters/confidence_adapter/confidence_adapter.py +618 -0
  266. package/vendor/gepa-python/src/gepa/adapters/confidence_adapter/scoring.py +206 -0
  267. package/vendor/gepa-python/src/gepa/adapters/default_adapter/__init__.py +0 -0
  268. package/vendor/gepa-python/src/gepa/adapters/default_adapter/default_adapter.py +206 -0
  269. package/vendor/gepa-python/src/gepa/adapters/dspy_adapter/__init__.py +0 -0
  270. package/vendor/gepa-python/src/gepa/adapters/dspy_adapter/dspy_adapter.py +525 -0
  271. package/vendor/gepa-python/src/gepa/adapters/dspy_adapter/instruction_proposal.py +500 -0
  272. package/vendor/gepa-python/src/gepa/adapters/dspy_full_program_adapter/__init__.py +6 -0
  273. package/vendor/gepa-python/src/gepa/adapters/dspy_full_program_adapter/dspy_program_proposal_signature.py +137 -0
  274. package/vendor/gepa-python/src/gepa/adapters/dspy_full_program_adapter/full_program_adapter.py +269 -0
  275. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/__init__.py +56 -0
  276. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/evaluation_metrics.py +226 -0
  277. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/generic_rag_adapter.py +496 -0
  278. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/rag_pipeline.py +238 -0
  279. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_store_interface.py +212 -0
  280. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/__init__.py +2 -0
  281. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/chroma_store.py +196 -0
  282. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/lancedb_store.py +422 -0
  283. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/milvus_store.py +409 -0
  284. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/qdrant_store.py +368 -0
  285. package/vendor/gepa-python/src/gepa/adapters/generic_rag_adapter/vector_stores/weaviate_store.py +418 -0
  286. package/vendor/gepa-python/src/gepa/adapters/langchain_adapter/__init__.py +11 -0
  287. package/vendor/gepa-python/src/gepa/adapters/langchain_adapter/langchain_adapter.py +261 -0
  288. package/vendor/gepa-python/src/gepa/adapters/mcp_adapter/__init__.py +37 -0
  289. package/vendor/gepa-python/src/gepa/adapters/mcp_adapter/mcp_adapter.py +693 -0
  290. package/vendor/gepa-python/src/gepa/adapters/mcp_adapter/mcp_client.py +364 -0
  291. package/vendor/gepa-python/src/gepa/adapters/optimize_anything_adapter/optimize_anything_adapter.py +879 -0
  292. package/vendor/gepa-python/src/gepa/adapters/terminal_bench_adapter/__init__.py +0 -0
  293. package/vendor/gepa-python/src/gepa/adapters/terminal_bench_adapter/terminal_bench_adapter.py +217 -0
  294. package/vendor/gepa-python/src/gepa/api.py +468 -0
  295. package/vendor/gepa-python/src/gepa/core/__init__.py +0 -0
  296. package/vendor/gepa-python/src/gepa/core/adapter.py +227 -0
  297. package/vendor/gepa-python/src/gepa/core/callbacks.py +551 -0
  298. package/vendor/gepa-python/src/gepa/core/data_loader.py +74 -0
  299. package/vendor/gepa-python/src/gepa/core/engine.py +1025 -0
  300. package/vendor/gepa-python/src/gepa/core/result.py +271 -0
  301. package/vendor/gepa-python/src/gepa/core/state.py +706 -0
  302. package/vendor/gepa-python/src/gepa/examples/__init__.py +0 -0
  303. package/vendor/gepa-python/src/gepa/examples/aime.py +24 -0
  304. package/vendor/gepa-python/src/gepa/examples/anymaths-bench/eval_default.py +111 -0
  305. package/vendor/gepa-python/src/gepa/examples/anymaths-bench/train_anymaths.py +177 -0
  306. package/vendor/gepa-python/src/gepa/examples/mcp_adapter/__init__.py +4 -0
  307. package/vendor/gepa-python/src/gepa/examples/mcp_adapter/mcp_optimization_example.py +456 -0
  308. package/vendor/gepa-python/src/gepa/examples/rag_adapter/__init__.py +9 -0
  309. package/vendor/gepa-python/src/gepa/examples/rag_adapter/rag_optimization.py +824 -0
  310. package/vendor/gepa-python/src/gepa/examples/terminal-bench/train_terminus.py +161 -0
  311. package/vendor/gepa-python/src/gepa/gepa_utils.py +117 -0
  312. package/vendor/gepa-python/src/gepa/gskill/__init__.py +1 -0
  313. package/vendor/gepa-python/src/gepa/gskill/gskill/__init__.py +0 -0
  314. package/vendor/gepa-python/src/gepa/gskill/gskill/cost_tracker.py +194 -0
  315. package/vendor/gepa-python/src/gepa/gskill/gskill/evaluate/__init__.py +0 -0
  316. package/vendor/gepa-python/src/gepa/gskill/gskill/evaluate/claude_code.py +1117 -0
  317. package/vendor/gepa-python/src/gepa/gskill/gskill/evaluate/claude_code_skills.py +613 -0
  318. package/vendor/gepa-python/src/gepa/gskill/gskill/evaluate/mini_swe_agent.py +440 -0
  319. package/vendor/gepa-python/src/gepa/gskill/gskill/experiment_logger.py +367 -0
  320. package/vendor/gepa-python/src/gepa/gskill/gskill/swe_fitness_fn.py +209 -0
  321. package/vendor/gepa-python/src/gepa/gskill/gskill/swe_harness.py +352 -0
  322. package/vendor/gepa-python/src/gepa/gskill/gskill/train_optimize_anything.py +830 -0
  323. package/vendor/gepa-python/src/gepa/image.py +104 -0
  324. package/vendor/gepa-python/src/gepa/lm.py +261 -0
  325. package/vendor/gepa-python/src/gepa/logging/__init__.py +0 -0
  326. package/vendor/gepa-python/src/gepa/logging/experiment_tracker.py +457 -0
  327. package/vendor/gepa-python/src/gepa/logging/logger.py +75 -0
  328. package/vendor/gepa-python/src/gepa/logging/utils.py +130 -0
  329. package/vendor/gepa-python/src/gepa/optimize_anything.py +1701 -0
  330. package/vendor/gepa-python/src/gepa/proposer/__init__.py +0 -0
  331. package/vendor/gepa-python/src/gepa/proposer/base.py +53 -0
  332. package/vendor/gepa-python/src/gepa/proposer/merge.py +403 -0
  333. package/vendor/gepa-python/src/gepa/proposer/reflective_mutation/__init__.py +0 -0
  334. package/vendor/gepa-python/src/gepa/proposer/reflective_mutation/base.py +64 -0
  335. package/vendor/gepa-python/src/gepa/proposer/reflective_mutation/reflection_lm.py +178 -0
  336. package/vendor/gepa-python/src/gepa/proposer/reflective_mutation/reflective_mutation.py +641 -0
  337. package/vendor/gepa-python/src/gepa/py.typed +0 -0
  338. package/vendor/gepa-python/src/gepa/strategies/__init__.py +0 -0
  339. package/vendor/gepa-python/src/gepa/strategies/acceptance.py +66 -0
  340. package/vendor/gepa-python/src/gepa/strategies/batch_sampler.py +103 -0
  341. package/vendor/gepa-python/src/gepa/strategies/candidate_selector.py +82 -0
  342. package/vendor/gepa-python/src/gepa/strategies/component_selector.py +36 -0
  343. package/vendor/gepa-python/src/gepa/strategies/eval_policy.py +64 -0
  344. package/vendor/gepa-python/src/gepa/strategies/instruction_proposal.py +153 -0
  345. package/vendor/gepa-python/src/gepa/strategies/proposal_sampling.py +128 -0
  346. package/vendor/gepa-python/src/gepa/strategies/proposal_selection.py +84 -0
  347. package/vendor/gepa-python/src/gepa/utils/__init__.py +63 -0
  348. package/vendor/gepa-python/src/gepa/utils/code_execution.py +626 -0
  349. package/vendor/gepa-python/src/gepa/utils/stdio_capture.py +145 -0
  350. package/vendor/gepa-python/src/gepa/utils/stop_condition.py +230 -0
  351. package/vendor/gepa-python/src/gepa/visualization.py +359 -0
  352. package/vendor/orizu-gepa/pyproject.toml +18 -0
  353. package/vendor/orizu-gepa/src/orizu_gepa_connector/__init__.py +9 -0
  354. package/vendor/orizu-gepa/src/orizu_gepa_connector/__main__.py +5 -0
  355. package/vendor/orizu-gepa/src/orizu_gepa_connector/adapter.py +138 -0
  356. package/vendor/orizu-gepa/src/orizu_gepa_connector/callbacks.py +666 -0
  357. package/vendor/orizu-gepa/src/orizu_gepa_connector/cli.py +7 -0
  358. package/vendor/orizu-gepa/src/orizu_gepa_connector/engine.py +269 -0
  359. package/vendor/orizu-gepa/src/orizu_gepa_connector/instruction_set_loader.py +52 -0
  360. package/vendor/orizu-gepa/src/orizu_gepa_connector/preflight.py +64 -0
  361. package/vendor/orizu-gepa/src/orizu_gepa_connector/reflection.py +186 -0
  362. package/vendor/orizu-gepa/src/orizu_gepa_connector/runtime.py +721 -0
  363. package/vendor/orizu-gepa/src/orizu_gepa_connector/skilled_proposer_bridge.py +381 -0
  364. package/vendor/orizu-gepa/src/orizu_gepa_connector/stop_conditions.py +55 -0
  365. package/vendor/orizu-gepa/src/orizu_gepa_connector/translator.py +203 -0
  366. package/vendor/orizu-gepa-python/pyproject.toml +1 -1
  367. package/vendor/orizu-gepa-python/src/orizu_gepa/cli.py +1 -0
  368. package/vendor/orizu-gepa-python/src/orizu_gepa/client.py +52 -7
  369. package/vendor/orizu-gepa-python/src/orizu_gepa/local_log.py +52 -0
  370. package/vendor/orizu-gepa-python/src/orizu_gepa/optimizer.py +10 -5
  371. package/vendor/orizu-gepa-python/src/orizu_gepa/reflection.py +323 -68
  372. package/vendor/orizu-gepa-python/src/orizu_gepa/runner.py +207 -13
  373. package/vendor/skills/orizu-cli/SKILL.md +3 -1
  374. package/vendor/skills/orizu-cli/references/cli-reference.md +85 -1
  375. package/vendor/skills/orizu-cli/references/migrate-existing-gepa-setup.md +303 -0
  376. package/vendor/skills/orizu-cli/references/optimization-reports.md +1 -1
  377. package/vendor/skills/orizu-cli/references/optimization-with-gepa.md +26 -1
  378. package/vendor/skills/orizu-cli/references/prompt-control-plane.md +113 -10
@@ -0,0 +1,352 @@
1
+ import gc
2
+ import logging
3
+ import os
4
+ import platform
5
+ import uuid
6
+ from dataclasses import dataclass
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+ import yaml
11
+
12
+ # Suppress verbose LiteLLM logging
13
+ logging.getLogger("LiteLLM").setLevel(logging.WARNING)
14
+ logging.getLogger("litellm").setLevel(logging.WARNING)
15
+ logging.getLogger("httpx").setLevel(logging.WARNING)
16
+
17
+ import litellm
18
+
19
+ litellm.suppress_debug_info = True
20
+
21
+ import docker
22
+ from minisweagent.agents.default import DefaultAgent
23
+ from minisweagent.environments.docker import DockerEnvironment, DockerEnvironmentConfig
24
+ from minisweagent.models.litellm_model import LitellmModel
25
+ from swebench.harness.constants import KEY_INSTANCE_ID, LOG_TEST_OUTPUT, RUN_EVALUATION_LOG_DIR
26
+ from swesmith.harness.utils import run_patch_in_container
27
+ from swesmith.profiles import registry
28
+
29
+
30
+ class ExistingContainerEnvironment(DockerEnvironment):
31
+ """DockerEnvironment subclass that uses an existing container instead of creating one."""
32
+
33
+ def __init__(self, container_id: str, cwd: str = "/testbed", timeout: int = 120):
34
+ # Don't call super().__init__() - it would try to create a new container
35
+ # Just set up the minimal config needed
36
+ self.logger = None
37
+ self.container_id = container_id
38
+ self.config = DockerEnvironmentConfig(
39
+ image="unused", # Not used since we already have a container
40
+ cwd=cwd,
41
+ timeout=timeout,
42
+ env={
43
+ "PAGER": "cat",
44
+ "MANPAGER": "cat",
45
+ "LESS": "-R",
46
+ "PIP_PROGRESS_BAR": "off",
47
+ "TQDM_DISABLE": "1",
48
+ },
49
+ )
50
+
51
+ def cleanup(self):
52
+ """No cleanup - container is managed by SWEHarness."""
53
+ pass
54
+
55
+
56
+ @dataclass
57
+ class TaskResult:
58
+ passed: bool
59
+ trace: str
60
+ output: str
61
+
62
+
63
+ class SWEHarness:
64
+ def __init__(self):
65
+ """Initialize harness with SWE-smith Docker containers."""
66
+ self.container = None
67
+ self.repo_profile = None
68
+ self.current_task = None
69
+
70
+ # Set DOCKER_HOST environment variable for rootless Docker
71
+ # This ensures SWE-smith's internal docker.from_env() calls work correctly
72
+ if not os.getenv("DOCKER_HOST"):
73
+ # Try to detect rootless Docker
74
+ uid = os.getuid()
75
+ xdg_runtime = os.getenv("XDG_RUNTIME_DIR")
76
+
77
+ if xdg_runtime:
78
+ rootless_socket = f"unix://{xdg_runtime}/docker.sock"
79
+ else:
80
+ rootless_socket = f"unix:///run/user/{uid}/docker.sock"
81
+
82
+ # Check if rootless socket exists
83
+ import pathlib
84
+
85
+ socket_path = rootless_socket.replace("unix://", "")
86
+ if pathlib.Path(socket_path).exists():
87
+ os.environ["DOCKER_HOST"] = rootless_socket
88
+ print(f" Using rootless Docker: {rootless_socket}")
89
+
90
+ # Try to connect to Docker
91
+ try:
92
+ self.docker_client = docker.from_env()
93
+ self.docker_client.ping()
94
+ except Exception as e:
95
+ raise RuntimeError(
96
+ f"Cannot connect to Docker: {e}\n\n"
97
+ f"Please ensure Docker is running:\n"
98
+ f" Rootless: systemctl --user start docker\n"
99
+ f" Standard: sudo systemctl start docker\n\n"
100
+ f"If using rootless Docker, ensure DOCKER_HOST is set:\n"
101
+ f" export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock"
102
+ ) from e
103
+
104
+ def setup_task(self, task_instance: dict[str, Any]):
105
+ """Setup task environment using SWE-smith Docker container.
106
+
107
+ Args:
108
+ task_instance: Full SWE-smith task instance
109
+ """
110
+ # Cleanup previous container if any
111
+ if self.container:
112
+ try:
113
+ self.container.stop()
114
+ self.container.remove()
115
+ except Exception:
116
+ pass
117
+
118
+ # Get container from SWE-smith
119
+ # The container comes with:
120
+ # - Repository cloned at /testbed
121
+ # - Instance branch checked out at HEAD (tests removed - agent can't see them)
122
+ # - All dependencies installed
123
+ #
124
+ # NOTE: SWE-smith branch structure:
125
+ # - HEAD: Bug commit WITHOUT test files (for agent work)
126
+ # - HEAD~1: Bug commit WITH test files (for evaluation)
127
+ # The agent works at HEAD. Verification uses run_patch_in_container which
128
+ # handles the proper checkout to HEAD~1 for testing.
129
+ self.repo_profile = registry.get_from_inst(task_instance)
130
+ self.current_task = task_instance
131
+ self.container = self.repo_profile.get_container(task_instance)
132
+ print(f" Docker container created: {self.container.id[:12]}")
133
+
134
+ def run_agent(
135
+ self,
136
+ problem_statement: str,
137
+ skills: str,
138
+ model_name: str = "gemini/gemini-2.0-flash-exp",
139
+ config_path: str | None = None,
140
+ ) -> tuple[str, str, dict]:
141
+ """Run the agent in Docker container and return (patch, conversation_trace, metrics).
142
+
143
+ The skills from GEPA are injected into the system template's {{ skills }} placeholder.
144
+ This allows GEPA to evolve the agent's learned skills over time.
145
+
146
+ Args:
147
+ problem_statement: The problem to solve
148
+ skills: Skills string to inject (ignored if config doesn't have {{ skills }} placeholder)
149
+ model_name: LiteLLM model name
150
+ config_path: Optional custom config path. Defaults to mini.yaml
151
+
152
+ Returns:
153
+ patch: The git diff of changes made
154
+ trace: Full conversation trace
155
+ metrics: Dict with 'steps' (number of agent turns) and 'tokens' (estimated)
156
+ """
157
+
158
+ # Load our custom mini-swe-agent config from the project directory
159
+ # This config has {{ skills }} placeholder that GEPA will optimize
160
+ if config_path is None:
161
+ config_path = os.path.join(os.path.dirname(__file__), "mini_swe_agent_config", "mini.yaml")
162
+ with open(config_path) as f:
163
+ config = yaml.safe_load(f)
164
+ # Extract only supported fields from agent config
165
+ full_agent_config = config.get("agent", {})
166
+ # DefaultAgent only accepts these template fields + limits
167
+ supported_fields = [
168
+ "system_template",
169
+ "instance_template",
170
+ "action_observation_template",
171
+ "format_error_template",
172
+ "timeout_template",
173
+ "step_limit",
174
+ "cost_limit",
175
+ ]
176
+ agent_config = {k: v for k, v in full_agent_config.items() if k in supported_fields}
177
+ agent_config["step_limit"] = 50 # Max steps per task
178
+
179
+ # Get model kwargs from config and add OpenAI regional endpoint if needed
180
+ model_config = config.get("model", {})
181
+ model_kwargs = model_config.get("model_kwargs", {}).copy()
182
+
183
+ # Add OpenAI regional endpoint (us.api.openai.com) if using OpenAI models
184
+ if "openai" in model_name.lower() or model_name.startswith("gpt-"):
185
+ if "api_base" not in model_kwargs:
186
+ model_kwargs["api_base"] = "https://us.api.openai.com/v1"
187
+
188
+ # Initialize Agent with Docker container environment
189
+ # Use ExistingContainerEnvironment to execute commands inside the container
190
+ agent = DefaultAgent(
191
+ model=LitellmModel(model_name=model_name, model_kwargs=model_kwargs),
192
+ env=ExistingContainerEnvironment(
193
+ container_id=self.container.id,
194
+ cwd="/testbed",
195
+ timeout=120,
196
+ ),
197
+ **agent_config,
198
+ )
199
+
200
+ try:
201
+ # We wrap in try/except to ensure we capture trace even if it crashes
202
+ # Build kwargs for template variables
203
+ run_kwargs = {}
204
+
205
+ # Pass skills if the config has the {{ skills }} placeholder
206
+ if "{{ skills }}" in agent_config.get("system_template", ""):
207
+ run_kwargs["skills"] = skills
208
+
209
+ # Pass system info if the config has these placeholders (original_mini.yaml)
210
+ instance_template = agent_config.get("instance_template", "")
211
+ if "{{system}}" in instance_template or "{{ system }}" in instance_template:
212
+ run_kwargs["system"] = platform.system()
213
+ run_kwargs["release"] = platform.release()
214
+ run_kwargs["version"] = platform.version()
215
+ run_kwargs["machine"] = platform.machine()
216
+
217
+ result = agent.run(problem_statement, **run_kwargs)
218
+
219
+ # Extract the full conversation trace from agent.messages
220
+ # This contains the agent's reasoning, actions, and tool outputs
221
+ trace = "\n\n".join([f"[{msg['role'].upper()}]\n{msg['content']}" for msg in agent.messages])
222
+
223
+ # Calculate metrics
224
+ num_steps = len([m for m in agent.messages if m.get("role") == "assistant"])
225
+
226
+ # Use LiteLLM's token counter for accurate count
227
+ try:
228
+ import litellm
229
+
230
+ # token_counter expects messages with 'role' and 'content' keys
231
+ token_count = litellm.token_counter(model=model_name, messages=agent.messages)
232
+ except Exception:
233
+ # Fallback to estimate if tokenizer fails
234
+ total_chars = sum(len(m.get("content", "")) for m in agent.messages)
235
+ token_count = total_chars // 4
236
+
237
+ metrics = {
238
+ "steps": num_steps,
239
+ "estimated_tokens": token_count,
240
+ "num_messages": len(agent.messages),
241
+ "messages": list(agent.messages), # Structured messages for trace logging
242
+ }
243
+
244
+ # Generate patch of changes from Docker container
245
+ result = self.container.exec_run("git diff", workdir="/testbed")
246
+ patch = result.output.decode() if result.output else ""
247
+
248
+ # Explicit cleanup to prevent memory leaks
249
+ del agent
250
+ gc.collect()
251
+
252
+ return patch, trace, metrics
253
+
254
+ except Exception as e:
255
+ import traceback
256
+
257
+ error_trace = traceback.format_exc()
258
+ print(f" AGENT ERROR: {e!s}")
259
+ print(f" Traceback:\n{error_trace}")
260
+ gc.collect() # Clean up even on error
261
+ return (
262
+ "",
263
+ f"Agent crashed: {e!s}\n\nTraceback:\n{error_trace}",
264
+ {"steps": 0, "estimated_tokens": 0, "num_messages": 0},
265
+ )
266
+
267
+ def verify_with_patch(self, patch: str, f2p_only: bool = True, timeout: int = 300) -> tuple[bool, str]:
268
+ """Verify a patch using SWE-smith's run_patch_in_container.
269
+
270
+ This is the proper way to evaluate patches - it:
271
+ 1. Creates a fresh container
272
+ 2. Checks out the correct commit with test files
273
+ 3. Applies the patch
274
+ 4. Runs the appropriate tests
275
+ 5. Cleans up
276
+
277
+ Args:
278
+ patch: The git diff patch to apply and test
279
+ f2p_only: If True, only run FAIL_TO_PASS tests
280
+ timeout: Test timeout in seconds
281
+
282
+ Returns:
283
+ (passed, test_output) tuple
284
+ """
285
+ if not self.current_task:
286
+ return False, "No task set up"
287
+
288
+ instance_id = self.current_task.get(KEY_INSTANCE_ID, "unknown")
289
+ run_id = f"gepa_{uuid.uuid4().hex[:8]}"
290
+ # IMPORTANT: Use RUN_EVALUATION_LOG_DIR to trigger is_eval=True in run_patch_in_container
291
+ # This makes it do `git checkout HEAD~1` to restore test files
292
+ log_dir = RUN_EVALUATION_LOG_DIR
293
+
294
+ try:
295
+ result = run_patch_in_container(
296
+ instance=self.current_task,
297
+ run_id=run_id,
298
+ log_dir=log_dir,
299
+ timeout=timeout,
300
+ patch=patch if patch.strip() else None,
301
+ commit=instance_id, # Checkout the instance branch
302
+ f2p_only=f2p_only,
303
+ is_gold=False, # We're testing a fix, not the gold solution
304
+ )
305
+
306
+ if result is None:
307
+ return False, "run_patch_in_container returned None (error occurred)"
308
+
309
+ _logger, timed_out = result
310
+
311
+ # Read the test output from the log file
312
+ test_output_file = Path(log_dir) / run_id / instance_id / LOG_TEST_OUTPUT
313
+ if test_output_file.exists():
314
+ test_output = test_output_file.read_text()
315
+ else:
316
+ # Test output file not found means tests never ran (e.g., patch apply failed)
317
+ # Check the run_instance.log for more details
318
+ run_log = Path(log_dir) / run_id / instance_id / "run_instance.log"
319
+ if run_log.exists():
320
+ run_log_content = run_log.read_text()
321
+ if "Patch Apply Failed" in run_log_content:
322
+ return False, f"Patch Apply Failed. See {run_log}"
323
+ return False, "Test output file not found - tests never ran"
324
+
325
+ # Parse test results - check for failures in the output
326
+ # SWE-smith uses pytest, so we look for standard pytest markers
327
+ passed = not timed_out and "FAILED" not in test_output and "ERROR" not in test_output
328
+
329
+ # Also check exit code from the log if available
330
+ if "PASSED" in test_output or "passed" in test_output.lower():
331
+ passed = True
332
+
333
+ # Double-check for patch apply failures in test output
334
+ if "Patch Apply Failed" in test_output:
335
+ passed = False
336
+
337
+ return passed, test_output
338
+
339
+ except Exception as e:
340
+ import traceback
341
+
342
+ return False, f"Verification error: {e}\n{traceback.format_exc()}"
343
+
344
+ def cleanup(self):
345
+ """Cleanup Docker container after run."""
346
+ if self.container:
347
+ try:
348
+ self.container.stop()
349
+ self.container.remove()
350
+ self.container = None
351
+ except Exception as e:
352
+ print(f" WARNING: Failed to cleanup container: {e}")