orizu 0.5.20 → 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 (260) hide show
  1. package/dist/archive-artifacts-cli.d.ts +50 -0
  2. package/dist/archive-artifacts-cli.d.ts.map +1 -0
  3. package/dist/artifact-archive.d.ts +48 -0
  4. package/dist/artifact-archive.d.ts.map +1 -0
  5. package/dist/artifact-pull.d.ts +22 -0
  6. package/dist/artifact-pull.d.ts.map +1 -0
  7. package/dist/banner.d.ts +3 -0
  8. package/dist/banner.d.ts.map +1 -0
  9. package/dist/connectors-cli.d.ts +31 -0
  10. package/dist/connectors-cli.d.ts.map +1 -0
  11. package/dist/credentials.d.ts +46 -0
  12. package/dist/credentials.d.ts.map +1 -0
  13. package/dist/csv.d.ts +49 -0
  14. package/dist/csv.d.ts.map +1 -0
  15. package/dist/dataset-download.d.ts +6 -0
  16. package/dist/dataset-download.d.ts.map +1 -0
  17. package/dist/dataset-edit-rows.d.ts +10 -0
  18. package/dist/dataset-edit-rows.d.ts.map +1 -0
  19. package/dist/dataset-upload-snapshot.d.ts +13 -0
  20. package/dist/dataset-upload-snapshot.d.ts.map +1 -0
  21. package/dist/daytona-slice-rehearsal.d.ts +89 -0
  22. package/dist/daytona-slice-rehearsal.d.ts.map +1 -0
  23. package/dist/daytona-slice.d.ts +106 -0
  24. package/dist/daytona-slice.d.ts.map +1 -0
  25. package/dist/deploy-key-merge-core.d.ts +121 -0
  26. package/dist/deploy-key-merge-core.d.ts.map +1 -0
  27. package/dist/diff-comments-cli.d.ts +12 -0
  28. package/dist/diff-comments-cli.d.ts.map +1 -0
  29. package/dist/diff-comments-cli.js +3 -0
  30. package/dist/egress-allowlist-cli.d.ts +23 -0
  31. package/dist/egress-allowlist-cli.d.ts.map +1 -0
  32. package/dist/egress-policy.d.ts +108 -0
  33. package/dist/egress-policy.d.ts.map +1 -0
  34. package/dist/error-response.d.ts +9 -0
  35. package/dist/error-response.d.ts.map +1 -0
  36. package/dist/file-parser.d.ts +5 -0
  37. package/dist/file-parser.d.ts.map +1 -0
  38. package/dist/gepa-engine-dispatch.d.ts +9 -0
  39. package/dist/gepa-engine-dispatch.d.ts.map +1 -0
  40. package/dist/gepa-engine-dispatch.js +48 -2
  41. package/dist/gepa-python-command.d.ts +6 -0
  42. package/dist/gepa-python-command.d.ts.map +1 -0
  43. package/dist/gepa-python-paths.d.ts +6 -0
  44. package/dist/gepa-python-paths.d.ts.map +1 -0
  45. package/dist/gepa-python-paths.js +6 -3
  46. package/dist/git-credential.d.ts +69 -0
  47. package/dist/git-credential.d.ts.map +1 -0
  48. package/dist/git-recovery-environment.d.ts +31 -0
  49. package/dist/git-recovery-environment.d.ts.map +1 -0
  50. package/dist/github-setup.d.ts +122 -0
  51. package/dist/github-setup.d.ts.map +1 -0
  52. package/dist/global-flags.d.ts +12 -0
  53. package/dist/global-flags.d.ts.map +1 -0
  54. package/dist/help.d.ts +46 -0
  55. package/dist/help.d.ts.map +1 -0
  56. package/dist/help.js +91 -23
  57. package/dist/hosted-boot.d.ts +273 -0
  58. package/dist/hosted-boot.d.ts.map +1 -0
  59. package/dist/hosted-bootstrap-rehearsal.d.ts +86 -0
  60. package/dist/hosted-bootstrap-rehearsal.d.ts.map +1 -0
  61. package/dist/hosted-bootstrap.d.ts +188 -0
  62. package/dist/hosted-bootstrap.d.ts.map +1 -0
  63. package/dist/hosted-broker-server.d.ts +50 -0
  64. package/dist/hosted-broker-server.d.ts.map +1 -0
  65. package/dist/hosted-git-http-server.d.ts +36 -0
  66. package/dist/hosted-git-http-server.d.ts.map +1 -0
  67. package/dist/hosted-harness-claude.d.ts +195 -0
  68. package/dist/hosted-harness-claude.d.ts.map +1 -0
  69. package/dist/hosted-harness-opencode.d.ts +227 -0
  70. package/dist/hosted-harness-opencode.d.ts.map +1 -0
  71. package/dist/hosted-harness.d.ts +118 -0
  72. package/dist/hosted-harness.d.ts.map +1 -0
  73. package/dist/hosted-harvest.d.ts +68 -0
  74. package/dist/hosted-harvest.d.ts.map +1 -0
  75. package/dist/hosted-headless.d.ts +72 -0
  76. package/dist/hosted-headless.d.ts.map +1 -0
  77. package/dist/hosted-loop-lifecycle.d.ts +206 -0
  78. package/dist/hosted-loop-lifecycle.d.ts.map +1 -0
  79. package/dist/hosted-loop.d.ts +170 -0
  80. package/dist/hosted-loop.d.ts.map +1 -0
  81. package/dist/hosted-run-event-sink.d.ts +222 -0
  82. package/dist/hosted-run-event-sink.d.ts.map +1 -0
  83. package/dist/hosted-runtime-assets.d.ts +186 -0
  84. package/dist/hosted-runtime-assets.d.ts.map +1 -0
  85. package/dist/hosted-session-cli.d.ts +258 -0
  86. package/dist/hosted-session-cli.d.ts.map +1 -0
  87. package/dist/hosted-skill-staging.d.ts +73 -0
  88. package/dist/hosted-skill-staging.d.ts.map +1 -0
  89. package/dist/http.d.ts +8 -0
  90. package/dist/http.d.ts.map +1 -0
  91. package/dist/index.d.ts +22 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +88 -92
  94. package/dist/instruction-set-gepa-launch.d.ts +3 -0
  95. package/dist/instruction-set-gepa-launch.d.ts.map +1 -0
  96. package/dist/instruction-set-gepa-launch.js +15 -0
  97. package/dist/instruction-set-loader.d.ts +6 -0
  98. package/dist/instruction-set-loader.d.ts.map +1 -0
  99. package/dist/instruction-set-loader.js +59 -0
  100. package/dist/instruction-set-manifest.d.ts +14 -0
  101. package/dist/instruction-set-manifest.d.ts.map +1 -0
  102. package/dist/instruction-set-manifest.js +162 -0
  103. package/dist/instruction-sets-cli.d.ts +40 -0
  104. package/dist/instruction-sets-cli.d.ts.map +1 -0
  105. package/dist/instruction-sets-cli.js +361 -0
  106. package/dist/json-response.d.ts +4 -0
  107. package/dist/json-response.d.ts.map +1 -0
  108. package/dist/jsonl-stream.d.ts +8 -0
  109. package/dist/jsonl-stream.d.ts.map +1 -0
  110. package/dist/kill-switch-cli.d.ts +30 -0
  111. package/dist/kill-switch-cli.d.ts.map +1 -0
  112. package/dist/loopback-serve.d.ts +25 -0
  113. package/dist/loopback-serve.d.ts.map +1 -0
  114. package/dist/manifests-cli.d.ts +22 -0
  115. package/dist/manifests-cli.d.ts.map +1 -0
  116. package/dist/markdown-report-input.d.ts +7 -0
  117. package/dist/markdown-report-input.d.ts.map +1 -0
  118. package/dist/merge-job.d.ts +155 -0
  119. package/dist/merge-job.d.ts.map +1 -0
  120. package/dist/model-configs-cli.d.ts +19 -0
  121. package/dist/model-configs-cli.d.ts.map +1 -0
  122. package/dist/model-configs-cli.js +104 -0
  123. package/dist/optimization-export-cli.d.ts +19 -0
  124. package/dist/optimization-export-cli.d.ts.map +1 -0
  125. package/dist/optimizations-list-cli.d.ts +20 -0
  126. package/dist/optimizations-list-cli.d.ts.map +1 -0
  127. package/dist/optimizations-promote-cli.d.ts +8 -0
  128. package/dist/optimizations-promote-cli.d.ts.map +1 -0
  129. package/dist/optimizations-promote-cli.js +34 -0
  130. package/dist/option-validation.d.ts +15 -0
  131. package/dist/option-validation.d.ts.map +1 -0
  132. package/dist/preview-runtime.d.ts +63 -0
  133. package/dist/preview-runtime.d.ts.map +1 -0
  134. package/dist/prompt-draft-push.d.ts +60 -0
  135. package/dist/prompt-draft-push.d.ts.map +1 -0
  136. package/dist/prompt-label-cli.d.ts +11 -0
  137. package/dist/prompt-label-cli.d.ts.map +1 -0
  138. package/dist/prompt-label-cli.js +29 -0
  139. package/dist/prompt-length-wire.d.ts +28 -0
  140. package/dist/prompt-length-wire.d.ts.map +1 -0
  141. package/dist/prompt-report-cli.d.ts +10 -0
  142. package/dist/prompt-report-cli.d.ts.map +1 -0
  143. package/dist/prompt-summary-table.d.ts +15 -0
  144. package/dist/prompt-summary-table.d.ts.map +1 -0
  145. package/dist/prompt-summary-table.js +6 -0
  146. package/dist/registration-tag-warning.d.ts +32 -0
  147. package/dist/registration-tag-warning.d.ts.map +1 -0
  148. package/dist/report-comments-cli.d.ts +16 -0
  149. package/dist/report-comments-cli.d.ts.map +1 -0
  150. package/dist/report-markdown-blankness.d.ts +2 -0
  151. package/dist/report-markdown-blankness.d.ts.map +1 -0
  152. package/dist/report-replacement-warning.d.ts +17 -0
  153. package/dist/report-replacement-warning.d.ts.map +1 -0
  154. package/dist/repository-backup-core.d.ts +225 -0
  155. package/dist/repository-backup-core.d.ts.map +1 -0
  156. package/dist/repository-recovery-manifest.d.ts +83 -0
  157. package/dist/repository-recovery-manifest.d.ts.map +1 -0
  158. package/dist/run-event-digest.d.ts +74 -0
  159. package/dist/run-event-digest.d.ts.map +1 -0
  160. package/dist/runner-dir-verify.d.ts +66 -0
  161. package/dist/runner-dir-verify.d.ts.map +1 -0
  162. package/dist/runner-instruction-set-contract.d.ts +24 -0
  163. package/dist/runner-instruction-set-contract.d.ts.map +1 -0
  164. package/dist/runner-instruction-set-contract.js +50 -0
  165. package/dist/sandbox-hygiene.d.ts +45 -0
  166. package/dist/sandbox-hygiene.d.ts.map +1 -0
  167. package/dist/sandbox-provider.d.ts +193 -0
  168. package/dist/sandbox-provider.d.ts.map +1 -0
  169. package/dist/scorer-draft-push.d.ts +50 -0
  170. package/dist/scorer-draft-push.d.ts.map +1 -0
  171. package/dist/scorers-cli.d.ts +20 -0
  172. package/dist/scorers-cli.d.ts.map +1 -0
  173. package/dist/scorers-cli.js +22 -0
  174. package/dist/scorers-verify-parity-bridge.d.ts +16 -0
  175. package/dist/scorers-verify-parity-bridge.d.ts.map +1 -0
  176. package/dist/scorers-verify-parity-bridge.js +90 -0
  177. package/dist/scorers-verify-parity.d.ts +81 -0
  178. package/dist/scorers-verify-parity.d.ts.map +1 -0
  179. package/dist/scorers-verify-parity.js +502 -0
  180. package/dist/scores-accept-cli.d.ts +21 -0
  181. package/dist/scores-accept-cli.d.ts.map +1 -0
  182. package/dist/secret-redaction.d.ts +47 -0
  183. package/dist/secret-redaction.d.ts.map +1 -0
  184. package/dist/session-timeline.d.ts +54 -0
  185. package/dist/session-timeline.d.ts.map +1 -0
  186. package/dist/setup-prompt.d.ts +5 -0
  187. package/dist/setup-prompt.d.ts.map +1 -0
  188. package/dist/skill-installer.d.ts +68 -0
  189. package/dist/skill-installer.d.ts.map +1 -0
  190. package/dist/skilled-proposer-launch.d.ts +7 -0
  191. package/dist/skilled-proposer-launch.d.ts.map +1 -0
  192. package/dist/skilled-proposer-launch.js +60 -0
  193. package/dist/smoke.d.ts +102 -0
  194. package/dist/smoke.d.ts.map +1 -0
  195. package/dist/start-intent.d.ts +12 -0
  196. package/dist/start-intent.d.ts.map +1 -0
  197. package/dist/task-assignment-manifest.d.ts +15 -0
  198. package/dist/task-assignment-manifest.d.ts.map +1 -0
  199. package/dist/task-create-error.d.ts +18 -0
  200. package/dist/task-create-error.d.ts.map +1 -0
  201. package/dist/team-connectors-cli.d.ts +29 -0
  202. package/dist/team-connectors-cli.d.ts.map +1 -0
  203. package/dist/types.d.ts +39 -0
  204. package/dist/types.d.ts.map +1 -0
  205. package/dist/vercel-sandbox-provider.d.ts +156 -0
  206. package/dist/vercel-sandbox-provider.d.ts.map +1 -0
  207. package/dist/workbench-cli.d.ts +233 -0
  208. package/dist/workbench-cli.d.ts.map +1 -0
  209. package/dist/workspace-sync.d.ts +207 -0
  210. package/dist/workspace-sync.d.ts.map +1 -0
  211. package/dist/workspace.d.ts +92 -0
  212. package/dist/workspace.d.ts.map +1 -0
  213. package/dist/zip-draft-push.d.ts +55 -0
  214. package/dist/zip-draft-push.d.ts.map +1 -0
  215. package/package.json +14 -1
  216. package/requirements/README.md +138 -0
  217. package/requirements/skilled-proposer.in +66 -0
  218. package/requirements/skilled-proposer.lock +265 -0
  219. package/scripts/ensure-skilled-proposer-venv.mjs +5 -0
  220. package/scripts/refresh-skilled-proposer-lock.mjs +256 -0
  221. package/src/diff-comments-cli.ts +4 -0
  222. package/src/gepa-engine-dispatch.ts +42 -2
  223. package/src/gepa-python-paths.ts +6 -3
  224. package/src/help.ts +93 -23
  225. package/src/index.ts +99 -126
  226. package/src/instruction-set-gepa-launch.ts +28 -0
  227. package/src/instruction-set-loader.ts +37 -0
  228. package/src/instruction-set-manifest.ts +120 -0
  229. package/src/instruction-sets-cli.ts +306 -0
  230. package/src/model-configs-cli.ts +119 -0
  231. package/src/optimizations-promote-cli.ts +41 -0
  232. package/src/prompt-label-cli.ts +55 -0
  233. package/src/prompt-summary-table.ts +12 -0
  234. package/src/runner-instruction-set-contract.ts +64 -0
  235. package/src/scorers-cli.ts +40 -0
  236. package/src/scorers-verify-parity-bridge.ts +90 -0
  237. package/src/scorers-verify-parity.ts +564 -0
  238. package/src/skilled-proposer-launch.ts +89 -0
  239. package/src/skilled-proposer-venv-manager.mjs +757 -0
  240. package/tsconfig.json +2 -0
  241. package/vendor/orizu-gepa/src/orizu_gepa_connector/__init__.py +2 -1
  242. package/vendor/orizu-gepa/src/orizu_gepa_connector/adapter.py +8 -2
  243. package/vendor/orizu-gepa/src/orizu_gepa_connector/callbacks.py +17 -3
  244. package/vendor/orizu-gepa/src/orizu_gepa_connector/engine.py +100 -8
  245. package/vendor/orizu-gepa/src/orizu_gepa_connector/instruction_set_loader.py +52 -0
  246. package/vendor/orizu-gepa/src/orizu_gepa_connector/reflection.py +92 -12
  247. package/vendor/orizu-gepa/src/orizu_gepa_connector/runtime.py +100 -22
  248. package/vendor/orizu-gepa/src/orizu_gepa_connector/skilled_proposer_bridge.py +381 -0
  249. package/vendor/orizu-gepa/src/orizu_gepa_connector/stop_conditions.py +17 -0
  250. package/vendor/orizu-gepa/src/orizu_gepa_connector/translator.py +2 -1
  251. package/vendor/orizu-gepa-python/src/orizu_gepa/client.py +52 -7
  252. package/vendor/orizu-gepa-python/src/orizu_gepa/local_log.py +4 -1
  253. package/vendor/orizu-gepa-python/src/orizu_gepa/optimizer.py +10 -5
  254. package/vendor/orizu-gepa-python/src/orizu_gepa/reflection.py +323 -68
  255. package/vendor/orizu-gepa-python/src/orizu_gepa/runner.py +207 -13
  256. package/vendor/skills/orizu-cli/SKILL.md +2 -0
  257. package/vendor/skills/orizu-cli/references/cli-reference.md +85 -1
  258. package/vendor/skills/orizu-cli/references/migrate-existing-gepa-setup.md +303 -0
  259. package/vendor/skills/orizu-cli/references/optimization-with-gepa.md +25 -0
  260. package/vendor/skills/orizu-cli/references/prompt-control-plane.md +108 -8
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Orizu-owned sandbox provider seam (ALI-973 / WS-F, per ADR-003).
3
+ *
4
+ * ADR-003 requires every provider call (GitHub, Daytona) to sit behind an
5
+ * Orizu-owned interface so the durable contracts never couple to whichever SDK
6
+ * wins the quarter. This module defines `SandboxProvider` / `SandboxSession` and
7
+ * ships two implementations:
8
+ *
9
+ * - `createDaytonaProvider(config)` — a THIN adapter over the Daytona
10
+ * TypeScript SDK (`@daytonaio/sdk`). The SDK is imported LAZILY (dynamic
11
+ * import through a non-literal specifier) so the CLI works without it
12
+ * installed, the app build never resolves it, and tests never load it.
13
+ * - `createLocalSimProvider(config)` — a temp-dir + real-`git`-subprocess
14
+ * simulation used by the unit tests AND by the no-credentials local-sim
15
+ * rehearsal. It is a genuine rehearsal (real clone/commit/push against a
16
+ * local bare repo), not a mock.
17
+ *
18
+ * SDK-vs-docs note (verified against daytona.io/docs, 2026-07-02): the real
19
+ * `git.clone` signature is
20
+ * clone(url, path, branch?, commitId?, username?, password?, insecureSkipTls?)
21
+ * i.e. a `commitId` argument sits BETWEEN `branch` and `username` — the ALI-973
22
+ * brief documented `clone(url, path, branch, username, password)`. The adapter
23
+ * passes `undefined` for `commitId` so the Orizu seam keeps its clean per-call
24
+ * credential shape. `git.push(path, username?, password?)` matches the brief.
25
+ */
26
+ export interface ExecResult {
27
+ stdout: string;
28
+ exitCode: number;
29
+ /** Captured standard error, when the provider exposes it — surfaced so a
30
+ * failed git clone/push does not vanish behind a masked exit code. */
31
+ stderr?: string;
32
+ }
33
+ export interface GitCloneParams {
34
+ url: string;
35
+ path: string;
36
+ branch?: string;
37
+ username?: string;
38
+ password?: string;
39
+ }
40
+ export interface GitPushParams {
41
+ path: string;
42
+ username?: string;
43
+ password?: string;
44
+ }
45
+ /**
46
+ * A single request transform a provider firewall applies to matching egress
47
+ * (the credential-brokering seam: inject a header at the proxy so the raw
48
+ * secret never enters the sandbox). Structurally identical to @vercel/sandbox's
49
+ * `NetworkPolicyRule` so a Vercel adapter can pass it straight through, but
50
+ * declared here so the Orizu seam owns the shape (ADR-003).
51
+ */
52
+ export interface SandboxEgressRule {
53
+ transform?: {
54
+ headers?: Record<string, string>;
55
+ }[];
56
+ }
57
+ /**
58
+ * Provider-neutral egress/network policy, wired to the sandbox firewall AT
59
+ * CREATE. G5 (ALI-1006) owns the allowlist CONTENT; this slice only plumbs the
60
+ * option so the orchestrator can pass a policy (incl. a credential-injection
61
+ * transform for a model endpoint). `'allow-all'` is the provider default when
62
+ * omitted. Structurally compatible with @vercel/sandbox's `NetworkPolicy`.
63
+ */
64
+ export type SandboxEgressPolicy = 'allow-all' | 'deny-all' | {
65
+ allow?: string[] | Record<string, SandboxEgressRule[]>;
66
+ subnets?: {
67
+ allow?: string[];
68
+ deny?: string[];
69
+ };
70
+ };
71
+ export interface SandboxCreateOpts {
72
+ language?: string;
73
+ snapshot?: string;
74
+ envVars?: Record<string, string>;
75
+ labels?: Record<string, string>;
76
+ /** Sandbox auto-terminate timeout (ms). Honored where the provider supports a
77
+ * configurable session length (Vercel); ignored by providers that do not. */
78
+ timeoutMs?: number;
79
+ /** Provider runtime image hint (e.g. Vercel 'node24'); provider-specific. */
80
+ runtime?: string;
81
+ /**
82
+ * Provider custom-image ref (e.g. Vercel VCR 'orizu-hosted-runtime:<tag>').
83
+ * When set, the provider creates the sandbox from this pre-baked image instead
84
+ * of the base runtime (ALI-1017). Provider-specific — Vercel honors it; other
85
+ * providers ignore it. `runtime` is still the base-runtime hint when no image
86
+ * is given.
87
+ */
88
+ image?: string;
89
+ /** vCPUs to allocate (memory scales with vCPUs on Vercel: 2048 MiB each). */
90
+ vcpus?: number;
91
+ /** Ports to expose from the sandbox (provider-specific; up to 4 on Vercel). */
92
+ ports?: number[];
93
+ /** Egress/firewall policy applied at create (G5 supplies content). */
94
+ egressPolicy?: SandboxEgressPolicy;
95
+ }
96
+ /**
97
+ * A live sandbox. Per-call git credentials mirror Daytona's contract (and
98
+ * OpenInspect's credential-helper shape): the token is handed to each operation,
99
+ * never written once per session.
100
+ */
101
+ export interface SandboxSession {
102
+ readonly id: string;
103
+ gitClone(params: GitCloneParams): Promise<void>;
104
+ gitPush(params: GitPushParams): Promise<void>;
105
+ exec(command: string, opts?: {
106
+ cwd?: string;
107
+ }): Promise<ExecResult>;
108
+ readFile(path: string): Promise<string>;
109
+ writeFile(path: string, content: string): Promise<void>;
110
+ fileExists(path: string): Promise<boolean>;
111
+ destroy(): Promise<void>;
112
+ /**
113
+ * Extend the sandbox's auto-terminate timeout by `durationMs` (keepalive).
114
+ * OPTIONAL: only providers with a configurable session length implement it
115
+ * (Vercel). Host-side token rotation uses it to keep a long session alive
116
+ * beyond the provider's default. Absent on local-sim / Daytona.
117
+ */
118
+ extendTimeout?(durationMs: number): Promise<void>;
119
+ /**
120
+ * Snapshot the running sandbox's filesystem state and RETURN the snapshot id
121
+ * (ALI-1017). A new sandbox can then boot from it via `createSandbox({ snapshot })`
122
+ * — the zero-Docker "prebaked runtime" path (parallel to a VCR `image`).
123
+ * OPTIONAL: only providers with a snapshot API implement it (Vercel); absent on
124
+ * local-sim / Daytona. NOTE: the provider may STOP this sandbox as part of the
125
+ * snapshot (Vercel does), so treat the session as spent afterwards.
126
+ *
127
+ * `expiration` is an optional TTL (ms) for the snapshot; 0 = never expire.
128
+ */
129
+ snapshot?(opts?: {
130
+ expiration?: number;
131
+ }): Promise<string>;
132
+ }
133
+ export type SandboxProviderKind = 'daytona' | 'local-sim' | 'vercel';
134
+ export interface SandboxProvider {
135
+ readonly kind: SandboxProviderKind;
136
+ createSandbox(opts?: SandboxCreateOpts): Promise<SandboxSession>;
137
+ }
138
+ export interface DaytonaProviderConfig {
139
+ apiKey: string;
140
+ apiUrl?: string;
141
+ target?: string;
142
+ }
143
+ interface DaytonaSdkSandbox {
144
+ id: string;
145
+ git: {
146
+ clone(url: string, path: string, branch?: string, commitId?: string, username?: string, password?: string, insecureSkipTls?: boolean): Promise<void>;
147
+ push(path: string, username?: string, password?: string): Promise<void>;
148
+ };
149
+ process: {
150
+ executeCommand(command: string, cwd?: string, env?: Record<string, string>, timeout?: number): Promise<{
151
+ exitCode?: number;
152
+ result?: string;
153
+ stderr?: string;
154
+ artifacts?: {
155
+ stdout?: string;
156
+ stderr?: string;
157
+ };
158
+ }>;
159
+ };
160
+ fs: {
161
+ downloadFile(remotePath: string): Promise<Uint8Array | Buffer | string>;
162
+ uploadFile(file: Uint8Array, remotePath: string): Promise<void>;
163
+ getFileDetails(path: string): Promise<unknown>;
164
+ };
165
+ delete(timeout?: number): Promise<void>;
166
+ }
167
+ interface DaytonaSdkClient {
168
+ create(params?: Record<string, unknown>, options?: {
169
+ timeout: number;
170
+ }): Promise<DaytonaSdkSandbox>;
171
+ }
172
+ export interface DaytonaSdkModule {
173
+ Daytona: new (config: {
174
+ apiKey: string;
175
+ apiUrl?: string;
176
+ target?: string;
177
+ }) => DaytonaSdkClient;
178
+ }
179
+ /** Test seam: inject a fake SDK module so the adapter's request mapping can be
180
+ * exercised without the real package installed or a network. */
181
+ export interface DaytonaProviderDeps {
182
+ loadModule?: () => Promise<DaytonaSdkModule>;
183
+ }
184
+ export declare function createDaytonaProvider(config: DaytonaProviderConfig, deps?: DaytonaProviderDeps): SandboxProvider;
185
+ export interface LocalSimProviderConfig {
186
+ /** Parent directory for per-sandbox temp dirs (defaults to the OS tmpdir). */
187
+ rootDir?: string;
188
+ /** Skip filesystem teardown on destroy() (used by --keep for debugging). */
189
+ keepOnDestroy?: boolean;
190
+ }
191
+ export declare function createLocalSimProvider(config?: LocalSimProviderConfig): SandboxProvider;
192
+ export {};
193
+ //# sourceMappingURL=sandbox-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-provider.d.ts","sourceRoot":"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**
2
+ * ADR-007 P5 (ALI-1074): the session-scoped, commit-first scorer push.
3
+ *
4
+ * `orizu scorers register --session <id>` creates the version through
5
+ * POST /api/cli/scorers/drafts: the server commits the scorer's canonical
6
+ * `manifest.json` to the session's `orizu/session-*` branch (one Git Data API
7
+ * commit) and then writes a DRAFT row pinning
8
+ * repo_path/content_sha/commit_sha. The draft seals — and gets its version
9
+ * number — when the session branch merges via `orizu session finish` +
10
+ * promotion-manifest apply.
11
+ *
12
+ * The git filename is ALWAYS `manifest.json`: the server read side
13
+ * (lib/artifact-git-read.ts SCORER_MANIFEST_FILENAMES) prefers that name.
14
+ *
15
+ * Lives outside index.ts per the CLI line ratchet (ALI-976); mirrors
16
+ * prompt-draft-push.ts.
17
+ */
18
+ /** index.ts helpers injected by the command dispatcher (report-comments-cli
19
+ * precedent: command modules receive a ctx instead of importing the CLI
20
+ * entrypoint). */
21
+ export interface ScorersRegisterContext {
22
+ getArg: (name: string) => string | null;
23
+ resolveProjectSlug: (projectArg: string | null) => Promise<string>;
24
+ readJsonFile: (pathArg: string) => Record<string, unknown>;
25
+ hasJsonFlag: () => boolean;
26
+ printJson: (value: Record<string, unknown>) => void;
27
+ printLine: (message?: string) => void;
28
+ parseJsonResponse: (response: Response, label: string) => Promise<Record<string, unknown>>;
29
+ }
30
+ /** The full `orizu scorers register` command (moved out of index.ts for the
31
+ * CLI line ratchet): --session takes the ADR-007 P5 commit-first draft path,
32
+ * sessionless stays on the legacy create endpoint. */
33
+ export declare function runScorersRegister(ctx: ScorersRegisterContext): Promise<void>;
34
+ export interface PushScorerDraftInput {
35
+ project: string;
36
+ sessionId: string;
37
+ name: string;
38
+ /** The parsed scorer manifest (the artifact's canonical bytes). */
39
+ manifest: Record<string, unknown>;
40
+ promptVersionId?: string;
41
+ runnerVersionId?: string;
42
+ /** Test seam; defaults to the authenticated CLI fetcher. */
43
+ fetcher?: (path: string, init?: RequestInit) => Promise<Response>;
44
+ }
45
+ export interface PushScorerDraftResult {
46
+ data: Record<string, unknown>;
47
+ message: string;
48
+ }
49
+ export declare function pushScorerDraft(input: PushScorerDraftInput): Promise<PushScorerDraftResult>;
50
+ //# sourceMappingURL=scorer-draft-push.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scorer-draft-push.d.ts","sourceRoot":"","sources":["../src/scorer-draft-push.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH;;kBAEkB;AAClB,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;IACvC,kBAAkB,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAClE,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC1D,WAAW,EAAE,MAAM,OAAO,CAAA;IAC1B,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACnD,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAC3F;AAED;;sDAEsD;AACtD,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyDnF;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CAClE;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAsCjG"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The `orizu scorers` subcommand router (ALI-1554).
3
+ *
4
+ * The five historical branches lived inline in index.ts; folding them here
5
+ * reclaims the headroom the CLI line ratchet (ALI-976) requires before a new
6
+ * subcommand may be added. Behaviour is unchanged: each handler is the same
7
+ * function index.ts already called, and an unrecognised subcommand returns
8
+ * null so main() still falls through to printUsage().
9
+ */
10
+ export interface ScorersCommandIo {
11
+ list: () => Promise<void>;
12
+ register: () => Promise<void>;
13
+ detail: () => Promise<void>;
14
+ labelsSet: () => Promise<void>;
15
+ exec: () => Promise<void>;
16
+ verifyParity: (args: string[]) => Promise<number>;
17
+ }
18
+ /** Returns the process exit code, or null when the subcommand is not ours. */
19
+ export declare function scorersCommand(args: string[], io: ScorersCommandIo): Promise<number | null>;
20
+ //# sourceMappingURL=scorers-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scorers-cli.d.ts","sourceRoot":"","sources":["../src/scorers-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAClD;AAED,8EAA8E;AAC9E,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBjG"}
@@ -0,0 +1,22 @@
1
+ /** Returns the process exit code, or null when the subcommand is not ours. */
2
+ export async function scorersCommand(args, io) {
3
+ const subcommand = args[1];
4
+ // A Map, not an object literal: `scorers constructor` must not resolve to
5
+ // an Object.prototype member and be treated as a known subcommand.
6
+ const handlers = new Map([
7
+ ['list', io.list], ['register', io.register], ['detail', io.detail], ['exec', io.exec],
8
+ ]);
9
+ const handler = subcommand === undefined ? undefined : handlers.get(subcommand);
10
+ if (handler) {
11
+ await handler();
12
+ return 0;
13
+ }
14
+ if (subcommand === 'labels' && args[2] === 'set') {
15
+ await io.labelsSet();
16
+ return 0;
17
+ }
18
+ if (subcommand === 'verify-parity') {
19
+ return io.verifyParity(args.slice(2));
20
+ }
21
+ return null;
22
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The customer-side half of `orizu scorers verify-parity` (ALI-1554).
3
+ *
4
+ * Embedded as a string constant and written to a temp file at run time on
5
+ * purpose: no packaging (`files`/`vendor`) change, so there is nothing for the
6
+ * published tarball to lose. It runs in the CUSTOMER's interpreter and the
7
+ * customer's unscrubbed environment — it is their metric in their process.
8
+ *
9
+ * Contract: reads `{rows: [{row_id, row, model_output}]}` from
10
+ * ORIZU_PARITY_INPUT_PATH, calls `<module>:<function>(row, model_output)` per
11
+ * row, and writes `{scores: [{row_id, score} | {row_id, error}]}` to
12
+ * ORIZU_PARITY_OUTPUT_PATH. Exit 2 (with the reason on stderr) means the check
13
+ * could not run at all; a per-row exception is that row's error, not an abort.
14
+ */
15
+ export declare const PARITY_BRIDGE_SOURCE = "import json, math, os, sys, traceback\n\n\ndef fail(message):\n sys.stderr.write(message + \"\\n\")\n sys.exit(2)\n\n\ndef last_line(text):\n lines = [line for line in text.strip().splitlines() if line.strip()]\n return lines[-1] if lines else \"unknown error\"\n\n\ndef extract(value):\n # Mirrors orizu_gepa.optimizer._score_from_scorer, minus the clamp: the\n # CLI clamps both sides so the compared number is what GEPA optimizes.\n # bool is deliberately NOT rejected: measured, _score_from_scorer(extra=\n # {'score': True}) -> (1.0, None) and False -> (0.0, None), because bool is an\n # int subclass and Python's numeric branch accepts it. An exact-match DSPy\n # metric returning True must compare, not error.\n if isinstance(value, (int, float)):\n raw = value\n elif isinstance(value, dict):\n raw = value.get(\"score\")\n if raw is None and isinstance(value.get(\"model_response\"), dict):\n raw = value[\"model_response\"].get(\"score\")\n elif hasattr(value, \"score\"):\n # official GEPA's EvaluationResult NamedTuple and friends;\n # objective_scores is deliberately ignored.\n raw = value.score\n else:\n raise TypeError(\"scorer result must be a number, a dict with a numeric 'score', or an object with a numeric .score attribute\")\n if isinstance(raw, str):\n raw = float(raw)\n if not isinstance(raw, (int, float)):\n raise TypeError(\"scorer result must include a numeric score\")\n raw = float(raw)\n if not math.isfinite(raw):\n raise ValueError(\"scorer result score must be finite\")\n return raw\n\n\ntarget = os.environ.get(\"ORIZU_PARITY_ORIGINAL\", \"\")\nmodule_name, separator, function_name = target.partition(\":\")\nif not separator or not module_name or not function_name:\n fail(\"--original must be <module>:<function> (got %r)\" % target)\n\n# The customer's metric lives beside the command's cwd, not beside this\n# generated bridge file, so cwd must win over the script directory.\nsys.path.insert(0, os.getcwd())\ntry:\n import importlib\n\n module = importlib.import_module(module_name)\nexcept Exception:\n fail(\"Failed to import original metric module '%s': %s\" % (module_name, last_line(traceback.format_exc())))\n\nif not hasattr(module, function_name):\n fail(\"Original metric module '%s' has no attribute '%s'\" % (module_name, function_name))\nmetric = getattr(module, function_name)\nif not callable(metric):\n fail(\"Original metric '%s:%s' is not callable\" % (module_name, function_name))\n\nwith open(os.environ[\"ORIZU_PARITY_INPUT_PATH\"], encoding=\"utf-8\") as handle:\n payload = json.load(handle)\n\nscores = []\nfor item in payload[\"rows\"]:\n try:\n scores.append({\"row_id\": item[\"row_id\"], \"score\": extract(metric(item[\"row\"], item[\"model_output\"]))})\n except Exception:\n scores.append({\"row_id\": item[\"row_id\"], \"error\": last_line(traceback.format_exc())})\n\nwith open(os.environ[\"ORIZU_PARITY_OUTPUT_PATH\"], \"w\", encoding=\"utf-8\") as handle:\n json.dump({\"scores\": scores}, handle)\n";
16
+ //# sourceMappingURL=scorers-verify-parity-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scorers-verify-parity-bridge.d.ts","sourceRoot":"","sources":["../src/scorers-verify-parity-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,8lGA2EhC,CAAA"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * The customer-side half of `orizu scorers verify-parity` (ALI-1554).
3
+ *
4
+ * Embedded as a string constant and written to a temp file at run time on
5
+ * purpose: no packaging (`files`/`vendor`) change, so there is nothing for the
6
+ * published tarball to lose. It runs in the CUSTOMER's interpreter and the
7
+ * customer's unscrubbed environment — it is their metric in their process.
8
+ *
9
+ * Contract: reads `{rows: [{row_id, row, model_output}]}` from
10
+ * ORIZU_PARITY_INPUT_PATH, calls `<module>:<function>(row, model_output)` per
11
+ * row, and writes `{scores: [{row_id, score} | {row_id, error}]}` to
12
+ * ORIZU_PARITY_OUTPUT_PATH. Exit 2 (with the reason on stderr) means the check
13
+ * could not run at all; a per-row exception is that row's error, not an abort.
14
+ */
15
+ export const PARITY_BRIDGE_SOURCE = `import json, math, os, sys, traceback
16
+
17
+
18
+ def fail(message):
19
+ sys.stderr.write(message + "\\n")
20
+ sys.exit(2)
21
+
22
+
23
+ def last_line(text):
24
+ lines = [line for line in text.strip().splitlines() if line.strip()]
25
+ return lines[-1] if lines else "unknown error"
26
+
27
+
28
+ def extract(value):
29
+ # Mirrors orizu_gepa.optimizer._score_from_scorer, minus the clamp: the
30
+ # CLI clamps both sides so the compared number is what GEPA optimizes.
31
+ # bool is deliberately NOT rejected: measured, _score_from_scorer(extra=
32
+ # {'score': True}) -> (1.0, None) and False -> (0.0, None), because bool is an
33
+ # int subclass and Python's numeric branch accepts it. An exact-match DSPy
34
+ # metric returning True must compare, not error.
35
+ if isinstance(value, (int, float)):
36
+ raw = value
37
+ elif isinstance(value, dict):
38
+ raw = value.get("score")
39
+ if raw is None and isinstance(value.get("model_response"), dict):
40
+ raw = value["model_response"].get("score")
41
+ elif hasattr(value, "score"):
42
+ # official GEPA's EvaluationResult NamedTuple and friends;
43
+ # objective_scores is deliberately ignored.
44
+ raw = value.score
45
+ else:
46
+ raise TypeError("scorer result must be a number, a dict with a numeric 'score', or an object with a numeric .score attribute")
47
+ if isinstance(raw, str):
48
+ raw = float(raw)
49
+ if not isinstance(raw, (int, float)):
50
+ raise TypeError("scorer result must include a numeric score")
51
+ raw = float(raw)
52
+ if not math.isfinite(raw):
53
+ raise ValueError("scorer result score must be finite")
54
+ return raw
55
+
56
+
57
+ target = os.environ.get("ORIZU_PARITY_ORIGINAL", "")
58
+ module_name, separator, function_name = target.partition(":")
59
+ if not separator or not module_name or not function_name:
60
+ fail("--original must be <module>:<function> (got %r)" % target)
61
+
62
+ # The customer's metric lives beside the command's cwd, not beside this
63
+ # generated bridge file, so cwd must win over the script directory.
64
+ sys.path.insert(0, os.getcwd())
65
+ try:
66
+ import importlib
67
+
68
+ module = importlib.import_module(module_name)
69
+ except Exception:
70
+ fail("Failed to import original metric module '%s': %s" % (module_name, last_line(traceback.format_exc())))
71
+
72
+ if not hasattr(module, function_name):
73
+ fail("Original metric module '%s' has no attribute '%s'" % (module_name, function_name))
74
+ metric = getattr(module, function_name)
75
+ if not callable(metric):
76
+ fail("Original metric '%s:%s' is not callable" % (module_name, function_name))
77
+
78
+ with open(os.environ["ORIZU_PARITY_INPUT_PATH"], encoding="utf-8") as handle:
79
+ payload = json.load(handle)
80
+
81
+ scores = []
82
+ for item in payload["rows"]:
83
+ try:
84
+ scores.append({"row_id": item["row_id"], "score": extract(metric(item["row"], item["model_output"]))})
85
+ except Exception:
86
+ scores.append({"row_id": item["row_id"], "error": last_line(traceback.format_exc())})
87
+
88
+ with open(os.environ["ORIZU_PARITY_OUTPUT_PATH"], "w", encoding="utf-8") as handle:
89
+ json.dump({"scores": scores}, handle)
90
+ `;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * `orizu scorers verify-parity` (ALI-1554): prove a migrated Orizu scorer
3
+ * runner scores the same rows the same way the customer's original Python
4
+ * metric does, UNDER THE PAYLOAD `run-gepa` sends the runner, before the first
5
+ * optimization spends tokens on a scorer that silently disagrees.
6
+ *
7
+ * Honesty note: `run-gepa` executes runners through the vendored Python
8
+ * `run_file_contract_runner`, not this TypeScript path. What this proves is
9
+ * "the runner, under the run-gepa flat_row payload, via the CLI's file
10
+ * contract". The payload is asserted key-for-key by
11
+ * test/scorers-verify-parity.test.ts (H9) against a literal hand-derived from
12
+ * `make_scorer_runner`'s flat_row branch — NOT against a fixture shared with
13
+ * `test_flat_row_payload_shape_mirrors_score_run_exec`, so a rename on the
14
+ * Python side turns only the Python test red until the shared fixture lands
15
+ * (ALI-1556). The env allowlist is the TypeScript one.
16
+ */
17
+ export interface VerifyParityIo {
18
+ json: boolean;
19
+ print: (line: string) => void;
20
+ printErr: (line: string) => void;
21
+ materializeRunnerVersion: (runnerVersionId: string) => Promise<{
22
+ runnerDir: string;
23
+ cleanup: () => void;
24
+ }>;
25
+ readRunnerManifest: (runnerDir: string) => {
26
+ command: string[];
27
+ supports_body_kind?: string[];
28
+ };
29
+ runnerSubprocessEnv: (inputPath: string, outputPath: string) => NodeJS.ProcessEnv;
30
+ timeoutMs: number;
31
+ maxOutputBytes: number;
32
+ fetcher?: (path: string, init?: RequestInit) => Promise<Response>;
33
+ /** Test seam for the pairing tests (H8); production always uses the embedded bridge. */
34
+ bridgeSource?: string;
35
+ }
36
+ interface ExtractedScore {
37
+ raw: number;
38
+ score: number;
39
+ }
40
+ /**
41
+ * Python's `float()` grammar, not JavaScript's `Number()`. Measured 2026-08-23:
42
+ * `float` REJECTS '0x10', '0b1', '0o7', '' and '1,5' (all of which `Number`
43
+ * happily converts or turns into 0), and ACCEPTS ' 0.5 ', '1e3', '1_0', '.5',
44
+ * '5.', '+3', 'inf', 'Infinity' and 'nan'. Anything `_score_from_scorer` would
45
+ * refuse during the real optimization must be refused here too, or this gate
46
+ * certifies a scorer run-gepa cannot use. `inf`/`nan` parse and are then
47
+ * rejected by the finite check, exactly as Python does.
48
+ */
49
+ export declare function pythonFloat(text: string): number | null;
50
+ export declare function extractParityScore(value: unknown, label: string): ExtractedScore;
51
+ /**
52
+ * The Orizu side spawns the runner ONCE PER ROW, so each row gets the full
53
+ * per-row budget. The original side scores the whole sample in ONE bridge
54
+ * process, so handing it the per-row budget gives an N-row split 1/N of the
55
+ * time the Orizu side had: a 40-row split with an LLM-judge metric is SIGTERMed
56
+ * before it can write output.json and every row's work is lost (round-2 review).
57
+ * Scale by the sample length, bounded so a huge split cannot ask for forever.
58
+ */
59
+ export declare function bridgeBudget(perRowTimeoutMs: number, perRowMaxOutputBytes: number, sampleLength: number): {
60
+ timeoutMs: number;
61
+ maxOutputBytes: number;
62
+ };
63
+ /**
64
+ * Resolve the scorer input contract and candidate-output row field with the
65
+ * SAME precedence `run-gepa` uses (`orizu_gepa.runner.resolve_scorer_input_contract`):
66
+ * explicit flag > runner manifest (`scorer_input_contract`, `candidate_output_field`)
67
+ * > defaults (`gepa`, `model_output`). Resolution is by PRESENCE, not truthiness,
68
+ * so a blank manifest value fails validation instead of silently defaulting.
69
+ *
70
+ * Parity may only be claimed for the payload run-gepa will actually send, so a
71
+ * contract that resolves to anything but `flat_row` is refused here rather than
72
+ * assumed: proving parity on a shape the optimization never uses is the exact
73
+ * silent-agreement failure this command exists to prevent.
74
+ */
75
+ export declare function resolveScorerInputContract(manifest: Record<string, unknown>, flagContract: string | null, flagField: string | null): {
76
+ contract: string;
77
+ field: string;
78
+ };
79
+ export declare function verifyScorerParityCommand(args: string[], io: VerifyParityIo): Promise<number>;
80
+ export {};
81
+ //# sourceMappingURL=scorers-verify-parity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scorers-verify-parity.d.ts","sourceRoot":"","sources":["../src/scorers-verify-parity.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,wBAAwB,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAA;IAC1G,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IAC/F,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,UAAU,CAAA;IACjF,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IACjE,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAKD,UAAU,cAAc;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;C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