@withgauge/cli 0.12.0 → 0.13.0

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 (3) hide show
  1. package/README.md +18 -1
  2. package/dist/index.js +1437 -1979
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1934,295 +1934,20 @@ var executionTargetsResponseSchema = z21.object({
1934
1934
  items: z21.array(executionTargetSchema)
1935
1935
  });
1936
1936
 
1937
- // ../packages/api-schemas/src/experiments.ts
1938
- var experiments_exports = {};
1939
- __export(experiments_exports, {
1940
- EXPERIMENT_MODES: () => EXPERIMENT_MODES,
1941
- EXPERIMENT_STATUSES: () => EXPERIMENT_STATUSES,
1942
- SUPPORT_CLASSES: () => SUPPORT_CLASSES,
1943
- TERMINAL_EXPERIMENT_STATUSES: () => TERMINAL_EXPERIMENT_STATUSES,
1944
- addVariantBodySchema: () => addVariantBodySchema,
1945
- cancelResponseSchema: () => cancelResponseSchema,
1946
- createExperimentBodyFields: () => createExperimentBodyFields,
1947
- createExperimentBodySchema: () => createExperimentBodySchema,
1948
- createExperimentResponseSchema: () => createExperimentResponseSchema,
1949
- eligibleExperimentRunSchema: () => eligibleExperimentRunSchema,
1950
- experimentBoundarySchema: () => experimentBoundarySchema,
1951
- experimentContentQuerySchema: () => experimentContentQuerySchema,
1952
- experimentContentResponseSchema: () => experimentContentResponseSchema,
1953
- experimentContentTypeSchema: () => experimentContentTypeSchema,
1954
- experimentDetailSchema: () => experimentDetailSchema,
1955
- experimentListQuerySchema: () => experimentListQuerySchema,
1956
- experimentListResponseSchema: () => experimentListResponseSchema,
1957
- experimentModeSchema: () => experimentModeSchema,
1958
- experimentStatusResponseSchema: () => experimentStatusResponseSchema,
1959
- experimentStatusSchema: () => experimentStatusSchema,
1960
- experimentSummarySchema: () => experimentSummarySchema,
1961
- experimentVariantSchema: () => experimentVariantSchema,
1962
- fixerEditSchema: () => fixerEditSchema,
1963
- launchResultSchema: () => launchResultSchema,
1964
- patchVariantBodySchema: () => patchVariantBodySchema,
1965
- recommendationSchema: () => recommendationSchema,
1966
- shipBodySchema: () => shipBodySchema,
1967
- supportClassSchema: () => supportClassSchema,
1968
- variantDeltaSchema: () => variantDeltaSchema,
1969
- variantRefSchema: () => variantRefSchema,
1970
- variantRunSchema: () => variantRunSchema,
1971
- writeRoundResponseSchema: () => writeRoundResponseSchema,
1972
- writeVariantContentBodySchema: () => writeVariantContentBodySchema,
1973
- writeVariantContentResponseSchema: () => writeVariantContentResponseSchema
1974
- });
1937
+ // ../packages/api-schemas/src/invites.ts
1975
1938
  import { z as z22 } from "zod";
1976
- var EXPERIMENT_STATUSES = [
1977
- "DRAFT",
1978
- "GENERATING",
1979
- "LAUNCHING",
1980
- "RUNNING",
1981
- "SYNTHESIZING",
1982
- "COMPLETE",
1983
- "PARTIAL",
1984
- "FAILED",
1985
- "CANCELED"
1986
- ];
1987
- var experimentStatusSchema = z22.enum(EXPERIMENT_STATUSES);
1988
- var TERMINAL_EXPERIMENT_STATUSES = [
1989
- "COMPLETE",
1990
- "PARTIAL",
1991
- "FAILED",
1992
- "CANCELED"
1993
- ];
1994
- var SUPPORT_CLASSES = [
1995
- "RECOMMENDED",
1996
- "PROMISING",
1997
- "NOT_SUPPORTED",
1998
- "NOT_EVALUABLE"
1999
- ];
2000
- var supportClassSchema = z22.enum(SUPPORT_CLASSES);
2001
- var jsonValue = z22.unknown();
2002
- var EXPERIMENT_MODES = ["PROPOSE", "DIRECT", "MANUAL"];
2003
- var experimentModeSchema = z22.enum(EXPERIMENT_MODES);
2004
- var createExperimentBodyFields = z22.object({
2005
- runId: z22.string().min(1),
2006
- boundarySeq: z22.string().min(1),
2007
- problemText: z22.string().trim().min(1).optional(),
2008
- /** OPTIONAL, and it stays optional: a CLI built before the bifurcation must
2009
- * keep working, and omitting it means PROPOSE — the behaviour it already
2010
- * expects. */
2011
- mode: experimentModeSchema.optional(),
2012
- /** DIRECT only: the one change to make, in the author's own words. Ignored
2013
- * in the other modes. Carried as the single rewrite's title, and REQUIRED
2014
- * when `mode` is DIRECT — see the cross-field check below. */
2015
- changeInstruction: z22.string().trim().min(1).max(200).optional()
2016
- });
2017
- var createExperimentBodySchema = createExperimentBodyFields.superRefine((body, ctx) => {
2018
- if (body.mode === "DIRECT" && !body.changeInstruction) {
2019
- ctx.addIssue({
2020
- code: "custom",
2021
- path: ["changeInstruction"],
2022
- message: "mode DIRECT requires changeInstruction \u2014 the one change to make, in your own words"
2023
- });
2024
- }
2025
- });
2026
- var createExperimentResponseSchema = z22.object({
2027
- experimentId: z22.string(),
2028
- /** false = an existing draft for this (run, boundary) was resumed. */
2029
- created: z22.boolean(),
2030
- /** What is persisted — a resume keeps the statement it was opened with. */
2031
- problemText: z22.string(),
2032
- /** The PERSISTED mode, echoed for the same reason `problemText` is: exactly
2033
- * one live draft exists per (run, boundary), so a resume returns the mode
2034
- * that draft was opened with — which may not be the one this call asked
2035
- * for. Clients report what came back, not what they sent. */
2036
- mode: experimentModeSchema
2037
- });
2038
- var experimentListQuerySchema = z22.object({
2039
- status: z22.string().transform(
2040
- (s) => s.split(",").map((x) => x.trim().toUpperCase()).filter(Boolean)
2041
- ).pipe(z22.array(experimentStatusSchema)).optional(),
2042
- limit: z22.coerce.number().int().min(1).max(100).default(25)
2043
- });
2044
- var experimentSummarySchema = z22.object({
2045
- id: z22.string(),
2046
- status: experimentStatusSchema,
2047
- problem: z22.string(),
2048
- boundaryUrl: z22.string().nullable(),
2049
- sourceRunId: z22.string(),
2050
- variantCount: z22.number().int(),
2051
- createdAt: z22.string()
2052
- });
2053
- var experimentListResponseSchema = z22.object({
2054
- items: z22.array(experimentSummarySchema)
2055
- });
2056
- var eligibleExperimentRunSchema = z22.object({
2057
- runId: z22.string(),
2058
- agent: agentSchema,
2059
- promptText: z22.string(),
2060
- createdAt: z22.string(),
2061
- verdict: z22.string().nullable(),
2062
- boundaryCount: z22.number().int()
2063
- });
2064
- var experimentBoundarySchema = z22.object({
2065
- boundarySeq: z22.union([z22.string(), z22.number()]),
2066
- turn: z22.number().int().nullable(),
2067
- url: z22.string(),
2068
- domain: z22.string().nullable(),
2069
- fetchPrompt: z22.string().nullable(),
2070
- source: z22.string(),
2071
- boundaryCheckpointId: z22.string().nullable(),
2072
- boundaryOrdinal: z22.number().int().nullable(),
2073
- capturedOccurrence: z22.number().int().nullable()
2074
- });
2075
- var variantRunSchema = z22.object({
2076
- runId: z22.string(),
2077
- status: z22.string(),
2078
- failureReason: z22.string().nullable(),
2079
- integrations: z22.array(jsonValue)
2080
- });
2081
- var experimentVariantSchema = z22.object({
2082
- variantId: z22.string(),
2083
- key: z22.string(),
2084
- title: z22.string(),
2085
- hypothesis: z22.string(),
2086
- rewriteChars: z22.number().int(),
2087
- hasRewrite: z22.boolean(),
2088
- invalidReason: z22.string().nullable(),
2089
- planStatus: z22.string().nullable(),
2090
- planError: z22.string().nullable(),
2091
- runs: z22.array(variantRunSchema),
2092
- /** Arm verdict / finding counts / EXPERIMENT_DELTA output — server-owned
2093
- * analytic JSON, null until computable. */
2094
- verdict: jsonValue.nullable(),
2095
- findings: jsonValue.nullable(),
2096
- delta: jsonValue.nullable()
2097
- });
2098
- var experimentDetailSchema = z22.object({
2099
- id: z22.string(),
2100
- status: experimentStatusSchema,
2101
- problem: z22.string(),
2102
- boundaryUrl: z22.string().nullable(),
2103
- createdAt: z22.string(),
2104
- editable: z22.boolean(),
2105
- roundInFlight: z22.boolean(),
2106
- launching: z22.boolean(),
2107
- launchError: z22.string().nullable(),
2108
- planned: z22.boolean(),
2109
- livePage: jsonValue.nullable(),
2110
- sourceRun: z22.object({
2111
- runId: z22.string(),
2112
- agent: agentSchema,
2113
- status: z22.string(),
2114
- task: z22.string(),
2115
- repoUrl: z22.string().nullable(),
2116
- verdict: jsonValue.nullable(),
2117
- integrations: z22.array(jsonValue)
2118
- }),
2119
- variants: z22.array(experimentVariantSchema),
2120
- /** The settled comparison (winners vs baseline) — null until launched. */
2121
- summary: jsonValue.nullable()
2122
- });
2123
- var experimentStatusResponseSchema = z22.object({
2124
- id: z22.string(),
2125
- status: experimentStatusSchema,
2126
- planned: z22.boolean(),
2127
- writeStartedAt: z22.string().nullable(),
2128
- launchStartedAt: z22.string().nullable(),
2129
- launchError: z22.string().nullable(),
2130
- shippedVariantId: z22.string().nullable(),
2131
- shippedAt: z22.string().nullable()
2132
- });
2133
- var addVariantBodySchema = z22.object({
2134
- title: z22.string().optional(),
2135
- hypothesis: z22.string().optional()
2136
- });
2137
- var patchVariantBodySchema = z22.object({
2138
- title: z22.string().optional(),
2139
- hypothesis: z22.string().optional()
2140
- });
2141
- var fixerEditSchema = z22.object({
2142
- find: z22.string().min(1),
2143
- replace: z22.string()
2144
- });
2145
- var experimentContentTypeSchema = z22.string().trim().toLowerCase().max(127).regex(
2146
- /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/,
2147
- "contentType must be a MIME type such as text/markdown"
2148
- );
2149
- var writeVariantContentBodySchema = z22.object({
2150
- content: z22.string().optional(),
2151
- edits: z22.array(fixerEditSchema).optional(),
2152
- contentType: experimentContentTypeSchema.optional()
2153
- });
2154
- var writeVariantContentResponseSchema = z22.object({
2155
- variantId: z22.string(),
2156
- chars: z22.number().int(),
2157
- truncated: z22.boolean(),
2158
- applied: z22.number().int(),
2159
- skipped: z22.number().int()
2160
- });
2161
- var experimentContentQuerySchema = z22.object({
2162
- variantId: z22.string().optional(),
2163
- offset: z22.coerce.number().int().min(0).default(0),
2164
- maxChars: z22.coerce.number().int().min(1).max(4e4).default(2e4)
2165
- });
2166
- var experimentContentResponseSchema = z22.object({
2167
- source: z22.string(),
2168
- totalChars: z22.number().int(),
2169
- offset: z22.number().int(),
2170
- returnedChars: z22.number().int(),
2171
- nextOffset: z22.number().int().nullable(),
2172
- content: z22.string()
2173
- });
2174
- var writeRoundResponseSchema = z22.object({
2175
- queued: z22.number().int(),
2176
- reason: z22.enum(["round_in_flight", "nothing_pending"]).optional()
2177
- });
2178
- var launchResultSchema = z22.object({
2179
- experimentId: z22.string(),
2180
- status: z22.literal("LAUNCHING")
2181
- });
2182
- var shipBodySchema = z22.object({ variantId: z22.string().min(1) });
2183
- var cancelResponseSchema = z22.object({
1939
+ var inviteSchema = z22.object({
2184
1940
  id: z22.string(),
2185
- status: z22.literal("CANCELED")
2186
- });
2187
- var variantDeltaSchema = z22.object({
2188
- changed: z22.boolean().nullable(),
2189
- hypothesisSupported: z22.enum(["supported", "refuted", "inconclusive"]).nullable(),
2190
- summary: z22.string().nullable()
2191
- });
2192
- var variantRefSchema = z22.object({
2193
- key: z22.string(),
2194
- title: z22.string(),
2195
- effect: z22.number().nullable(),
2196
- consistency: z22.string().nullable(),
2197
- note: z22.string().nullable(),
2198
- delta: variantDeltaSchema.nullable().optional()
2199
- });
2200
- var recommendationSchema = z22.object({
2201
- evaluatorVersion: z22.string(),
2202
- summary: z22.string(),
2203
- groups: z22.object({
2204
- recommended: z22.array(variantRefSchema),
2205
- promising: z22.array(variantRefSchema),
2206
- notSupported: z22.array(variantRefSchema),
2207
- notEvaluable: z22.array(variantRefSchema)
2208
- }),
2209
- tradeoffs: z22.array(z22.string())
2210
- });
2211
-
2212
- // ../packages/api-schemas/src/invites.ts
2213
- import { z as z23 } from "zod";
2214
- var inviteSchema = z23.object({
2215
- id: z23.string(),
2216
- email: z23.string(),
2217
- invitedBy: z23.object({
2218
- name: z23.string().nullable(),
2219
- email: z23.string().nullable()
1941
+ email: z22.string(),
1942
+ invitedBy: z22.object({
1943
+ name: z22.string().nullable(),
1944
+ email: z22.string().nullable()
2220
1945
  }),
2221
- createdAt: z23.string(),
2222
- expiresAt: z23.string()
1946
+ createdAt: z22.string(),
1947
+ expiresAt: z22.string()
2223
1948
  });
2224
- var listInvitesResponseSchema = z23.object({
2225
- items: z23.array(inviteSchema)
1949
+ var listInvitesResponseSchema = z22.object({
1950
+ items: z22.array(inviteSchema)
2226
1951
  });
2227
1952
 
2228
1953
  // ../packages/api-schemas/src/keys.ts
@@ -2235,177 +1960,177 @@ __export(keys_exports, {
2235
1960
  setProviderKeyBodySchema: () => setProviderKeyBodySchema,
2236
1961
  setProviderKeyResponseSchema: () => setProviderKeyResponseSchema
2237
1962
  });
2238
- import { z as z24 } from "zod";
1963
+ import { z as z23 } from "zod";
2239
1964
  var PROVIDER_TYPES = ["anthropic", "openai"];
2240
- var providerTypeSchema = z24.enum(PROVIDER_TYPES);
2241
- var setProviderKeyBodySchema = z24.object({
1965
+ var providerTypeSchema = z23.enum(PROVIDER_TYPES);
1966
+ var setProviderKeyBodySchema = z23.object({
2242
1967
  /** The raw provider API key. Verified + stored server-side (AWS Secrets
2243
1968
  * Manager); never persisted in the app DB and never echoed back. */
2244
- key: z24.string().min(1)
1969
+ key: z23.string().min(1)
2245
1970
  });
2246
- var setProviderKeyResponseSchema = z24.object({
1971
+ var setProviderKeyResponseSchema = z23.object({
2247
1972
  providerType: providerTypeSchema,
2248
- last4: z24.string()
1973
+ last4: z23.string()
2249
1974
  });
2250
- var providerKeySchema = z24.object({
1975
+ var providerKeySchema = z23.object({
2251
1976
  providerType: providerTypeSchema,
2252
- last4: z24.string(),
2253
- createdAt: z24.string(),
1977
+ last4: z23.string(),
1978
+ createdAt: z23.string(),
2254
1979
  /** When the key was last saved/rotated. */
2255
- updatedAt: z24.string()
1980
+ updatedAt: z23.string()
2256
1981
  });
2257
1982
  var providerKeyListResponseSchema = listResponseSchema(providerKeySchema);
2258
1983
 
2259
1984
  // ../packages/api-schemas/src/mcp.ts
2260
- import { z as z26 } from "zod";
1985
+ import { z as z25 } from "zod";
2261
1986
 
2262
1987
  // ../packages/api-schemas/src/skills.ts
2263
- import { z as z25 } from "zod";
1988
+ import { z as z24 } from "zod";
2264
1989
  var sha256Hex = sha256DigestSchema;
2265
- var skillHandleSchema = z25.string().min(1).max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, "invalid skill handle").refine((name) => name !== "." && name !== "..", "invalid skill handle");
2266
- var skillSetEntrySchema = z25.object({
2267
- skillId: z25.string().min(1),
1990
+ var skillHandleSchema = z24.string().min(1).max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, "invalid skill handle").refine((name) => name !== "." && name !== "..", "invalid skill handle");
1991
+ var skillSetEntrySchema = z24.object({
1992
+ skillId: z24.string().min(1),
2268
1993
  name: skillHandleSchema,
2269
- label: z25.string().min(1),
1994
+ label: z24.string().min(1),
2270
1995
  contentDigest: sha256Hex,
2271
1996
  blobDigest: sha256Hex,
2272
1997
  /** `cas/v2/<scope>/skills/sha256/<ab>/<blobDigest>.tar.zst`. */
2273
- blobKey: z25.string().min(1),
1998
+ blobKey: z24.string().min(1),
2274
1999
  /** Raw canonical-tar size. Bounds the decompression allocation when present. */
2275
- rawBytes: z25.number().int().positive().optional(),
2000
+ rawBytes: z24.number().int().positive().optional(),
2276
2001
  /** Stored compressed size, verified against the object when present. */
2277
- storedBytes: z25.number().int().positive().optional(),
2002
+ storedBytes: z24.number().int().positive().optional(),
2278
2003
  /**
2279
2004
  * What the MODEL sees, parsed from the frontmatter at push time
2280
2005
  * (`{ name, description, descriptionChars, bodyBytes }`). Carried through to
2281
2006
  * the trace for the record; the staging path never branches on it.
2282
2007
  */
2283
- exposure: z25.record(z25.string(), z25.unknown()).optional()
2008
+ exposure: z24.record(z24.string(), z24.unknown()).optional()
2284
2009
  });
2285
2010
  var MAX_SKILL_SET_ENTRIES = 32;
2286
- var skillSetSchema = z25.array(skillSetEntrySchema).max(
2011
+ var skillSetSchema = z24.array(skillSetEntrySchema).max(
2287
2012
  MAX_SKILL_SET_ENTRIES,
2288
2013
  `a run may stage at most ${MAX_SKILL_SET_ENTRIES} skills`
2289
2014
  );
2290
- var skillSourceWireSchema = z25.object({
2291
- repoFullName: z25.string(),
2292
- ref: z25.string(),
2293
- subpath: z25.string(),
2294
- autoIngest: z25.boolean(),
2295
- lastSeenCommit: z25.string().nullable(),
2296
- lastCheckedAt: z25.string().nullable(),
2297
- lastError: z25.string().nullable()
2298
- });
2299
- var skillVersionWireSchema = z25.object({
2300
- id: z25.string(),
2301
- label: z25.string(),
2302
- contentDigest: z25.string(),
2303
- ingestTrigger: z25.string().nullable(),
2304
- createdAt: z25.string()
2305
- });
2306
- var skillListItemSchema = z25.object({
2307
- id: z25.string(),
2015
+ var skillSourceWireSchema = z24.object({
2016
+ repoFullName: z24.string(),
2017
+ ref: z24.string(),
2018
+ subpath: z24.string(),
2019
+ autoIngest: z24.boolean(),
2020
+ lastSeenCommit: z24.string().nullable(),
2021
+ lastCheckedAt: z24.string().nullable(),
2022
+ lastError: z24.string().nullable()
2023
+ });
2024
+ var skillVersionWireSchema = z24.object({
2025
+ id: z24.string(),
2026
+ label: z24.string(),
2027
+ contentDigest: z24.string(),
2028
+ ingestTrigger: z24.string().nullable(),
2029
+ createdAt: z24.string()
2030
+ });
2031
+ var skillListItemSchema = z24.object({
2032
+ id: z24.string(),
2308
2033
  /** OUR storage handle — the {ref} segment. */
2309
2034
  name: skillHandleSchema,
2310
- note: z25.string().nullable(),
2035
+ note: z24.string().nullable(),
2311
2036
  source: skillSourceWireSchema.nullable(),
2312
2037
  latestVersion: skillVersionWireSchema.nullable(),
2313
- versionCount: z25.number().int(),
2314
- createdAt: z25.string(),
2315
- updatedAt: z25.string()
2038
+ versionCount: z24.number().int(),
2039
+ createdAt: z24.string(),
2040
+ updatedAt: z24.string()
2316
2041
  });
2317
- var listSkillsResponseSchema = z25.object({
2318
- items: z25.array(skillListItemSchema)
2042
+ var listSkillsResponseSchema = z24.object({
2043
+ items: z24.array(skillListItemSchema)
2319
2044
  });
2320
- var skillDetailSchema = skillListItemSchema.omit({ latestVersion: true }).extend({ versions: z25.array(skillVersionWireSchema) });
2321
- var addSkillBodySchema = z25.object({
2322
- reference: z25.string().min(1),
2045
+ var skillDetailSchema = skillListItemSchema.omit({ latestVersion: true }).extend({ versions: z24.array(skillVersionWireSchema) });
2046
+ var addSkillBodySchema = z24.object({
2047
+ reference: z24.string().min(1),
2323
2048
  /** OUR handle; defaults to the resolved directory basename. */
2324
2049
  handle: skillHandleSchema.optional(),
2325
2050
  /** Explicit version label — a typed label is intent and always mints;
2326
2051
  * omitted derives from the resolved anchor and dedups by digest. */
2327
- label: z25.string().min(1).max(120).optional(),
2052
+ label: z24.string().min(1).max(120).optional(),
2328
2053
  /** Select one skill from a source holding several. */
2329
- skill: z25.string().min(1).optional(),
2330
- note: z25.string().max(2e3).optional(),
2054
+ skill: z24.string().min(1).optional(),
2055
+ note: z24.string().max(2e3).optional(),
2331
2056
  /** Track the source branch for auto re-ingest (needs an explicit branch). */
2332
- trackSource: z25.boolean().optional()
2057
+ trackSource: z24.boolean().optional()
2333
2058
  });
2334
- var addSkillResponseSchema = z25.object({
2335
- skillId: z25.string().nullable(),
2336
- handle: z25.string(),
2337
- label: z25.string(),
2059
+ var addSkillResponseSchema = z24.object({
2060
+ skillId: z24.string().nullable(),
2061
+ handle: z24.string(),
2062
+ label: z24.string(),
2338
2063
  /** True = the newest version already carried this content; nothing minted. */
2339
- unchanged: z25.boolean()
2064
+ unchanged: z24.boolean()
2340
2065
  });
2341
- var updateSkillBodySchema = z25.object({
2066
+ var updateSkillBodySchema = z24.object({
2342
2067
  name: skillHandleSchema.optional(),
2343
- note: z25.string().max(2e3).nullish(),
2344
- source: z25.object({
2345
- repoFullName: z25.string().min(1),
2068
+ note: z24.string().max(2e3).nullish(),
2069
+ source: z24.object({
2070
+ repoFullName: z24.string().min(1),
2346
2071
  /** A branch name — never HEAD, never a SHA. */
2347
- ref: z25.string().min(1),
2348
- subpath: z25.string().optional(),
2349
- autoIngest: z25.boolean().optional()
2072
+ ref: z24.string().min(1),
2073
+ subpath: z24.string().optional(),
2074
+ autoIngest: z24.boolean().optional()
2350
2075
  }).nullish()
2351
2076
  });
2352
- var reingestSkillResponseSchema = z25.object({
2353
- label: z25.string().nullable(),
2077
+ var reingestSkillResponseSchema = z24.object({
2078
+ label: z24.string().nullable(),
2354
2079
  /** True = "already current": the source content matches the newest version. */
2355
- unchanged: z25.boolean()
2080
+ unchanged: z24.boolean()
2356
2081
  });
2357
- var addSkillVersionBodySchema = z25.object({
2358
- reference: z25.string().min(1),
2082
+ var addSkillVersionBodySchema = z24.object({
2083
+ reference: z24.string().min(1),
2359
2084
  /** Omitted defaults to the ref name (branch/tag), else the anchor. */
2360
- label: z25.string().min(1).max(120).optional()
2361
- });
2362
- var addSkillVersionResponseSchema = z25.object({
2363
- label: z25.string(),
2364
- unchanged: z25.boolean()
2365
- });
2366
- var skillRunWireSchema = z25.object({
2367
- runId: z25.string(),
2368
- agent: z25.string(),
2369
- turns: z25.number().int().nullable(),
2370
- durationMs: z25.number().int().nullable(),
2371
- costUsd: z25.number().nullable(),
2372
- finishedAt: z25.string().nullable(),
2085
+ label: z24.string().min(1).max(120).optional()
2086
+ });
2087
+ var addSkillVersionResponseSchema = z24.object({
2088
+ label: z24.string(),
2089
+ unchanged: z24.boolean()
2090
+ });
2091
+ var skillRunWireSchema = z24.object({
2092
+ runId: z24.string(),
2093
+ agent: z24.string(),
2094
+ turns: z24.number().int().nullable(),
2095
+ durationMs: z24.number().int().nullable(),
2096
+ costUsd: z24.number().nullable(),
2097
+ finishedAt: z24.string().nullable(),
2373
2098
  /** WHICH version of the skill the session staged. */
2374
- versionLabel: z25.string().nullable()
2099
+ versionLabel: z24.string().nullable()
2375
2100
  });
2376
- var listSkillRunsResponseSchema = z25.object({
2377
- items: z25.array(skillRunWireSchema)
2101
+ var listSkillRunsResponseSchema = z24.object({
2102
+ items: z24.array(skillRunWireSchema)
2378
2103
  });
2379
2104
 
2380
2105
  // ../packages/api-schemas/src/mcp.ts
2381
2106
  var mcpServerHandleSchema = skillHandleSchema;
2382
2107
  var MCP_SPEC_VERSION = 1;
2383
- var envVarNameSchema = z26.string().min(1).max(128).regex(
2108
+ var envVarNameSchema = z25.string().min(1).max(128).regex(
2384
2109
  /^[A-Za-z_][A-Za-z0-9_]*$/,
2385
2110
  "an environment variable name (letters, digits, underscore; not starting with a digit)"
2386
2111
  );
2387
- var headerNameSchema2 = z26.string().min(1).max(128).regex(
2112
+ var headerNameSchema2 = z25.string().min(1).max(128).regex(
2388
2113
  /^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/,
2389
2114
  "an HTTP header name (a token \u2014 no colon, no spaces)"
2390
2115
  );
2391
- var mcpToolSchema = z26.object({
2392
- name: z26.string().min(1).max(128),
2393
- description: z26.string().max(4096).optional()
2116
+ var mcpToolSchema = z25.object({
2117
+ name: z25.string().min(1).max(128),
2118
+ description: z25.string().max(4096).optional()
2394
2119
  });
2395
- var mcpSpecSchema = z26.object({
2396
- specVersion: z26.literal(MCP_SPEC_VERSION),
2397
- transport: z26.enum(["stdio", "http"]),
2120
+ var mcpSpecSchema = z25.object({
2121
+ specVersion: z25.literal(MCP_SPEC_VERSION),
2122
+ transport: z25.enum(["stdio", "http"]),
2398
2123
  // stdio
2399
- command: z26.string().min(1).max(512).optional(),
2400
- args: z26.array(z26.string().max(4096)).max(64).optional(),
2401
- envNames: z26.array(envVarNameSchema).max(32).optional(),
2124
+ command: z25.string().min(1).max(512).optional(),
2125
+ args: z25.array(z25.string().max(4096)).max(64).optional(),
2126
+ envNames: z25.array(envVarNameSchema).max(32).optional(),
2402
2127
  // http
2403
- url: z26.string().url().max(2048).optional(),
2404
- headerNames: z26.array(headerNameSchema2).max(32).optional(),
2128
+ url: z25.string().url().max(2048).optional(),
2129
+ headerNames: z25.array(headerNameSchema2).max(32).optional(),
2405
2130
  // display only — outside the digest (D13)
2406
2131
  serverName: mcpServerHandleSchema,
2407
- description: z26.string().max(4096).optional(),
2408
- tools: z26.array(mcpToolSchema).max(256).optional()
2132
+ description: z25.string().max(4096).optional(),
2133
+ tools: z25.array(mcpToolSchema).max(256).optional()
2409
2134
  }).strict().superRefine((spec, ctx) => {
2410
2135
  if (spec.transport === "stdio") {
2411
2136
  if (!spec.command) {
@@ -2449,17 +2174,17 @@ var mcpSpecSchema = z26.object({
2449
2174
  }
2450
2175
  }
2451
2176
  });
2452
- var mcpExposureSchema = z26.object({
2453
- serverName: z26.string().min(1),
2454
- description: z26.string().optional(),
2455
- tools: z26.array(mcpToolSchema).default([]),
2177
+ var mcpExposureSchema = z25.object({
2178
+ serverName: z25.string().min(1),
2179
+ description: z25.string().optional(),
2180
+ tools: z25.array(mcpToolSchema).default([]),
2456
2181
  /** Declared credential NAMES, mirrored here so the picker and the index row can
2457
2182
  * render the contract without parsing `spec`. Never values. */
2458
- envNames: z26.array(z26.string()).default([]),
2459
- headerNames: z26.array(z26.string()).default([])
2183
+ envNames: z25.array(z25.string()).default([]),
2184
+ headerNames: z25.array(z25.string()).default([])
2460
2185
  });
2461
- var mcpWarningSchema = z26.object({
2462
- code: z26.enum([
2186
+ var mcpWarningSchema = z25.object({
2187
+ code: z25.enum([
2463
2188
  "unpinned_package",
2464
2189
  "credential_required",
2465
2190
  "value_discarded",
@@ -2469,125 +2194,122 @@ var mcpWarningSchema = z26.object({
2469
2194
  // contract was recorded when none was (Bugbot, medium).
2470
2195
  "flag_ignored"
2471
2196
  ]),
2472
- message: z26.string()
2197
+ message: z25.string()
2473
2198
  });
2474
- var mcpSetEntrySchema = z26.object({
2199
+ var mcpSetEntrySchema = z25.object({
2475
2200
  /** `McpServer.id` — the stable handle a UI chip links back to; `label` already
2476
2201
  * names the version, so this is deliberately not `McpServerVersion.id`. */
2477
- serverId: z26.string().min(1),
2202
+ serverId: z25.string().min(1),
2478
2203
  /** `McpServer.name` — OUR handle, and the CONFIG KEY the serializer writes. NOT
2479
2204
  * the agent-visible `spec.serverName`. */
2480
2205
  name: mcpServerHandleSchema,
2481
- label: z26.string().min(1),
2482
- specDigest: z26.string().min(1),
2206
+ label: z25.string().min(1),
2207
+ specDigest: z25.string().min(1),
2483
2208
  spec: mcpSpecSchema,
2484
2209
  /** Declared tools/description as at authoring time. The preparation path never
2485
2210
  * branches on it; it rides along for the trace and the UI. */
2486
- exposure: z26.record(z26.string(), z26.unknown()).optional(),
2211
+ exposure: z25.record(z25.string(), z25.unknown()).optional(),
2487
2212
  /** Connection selected by this immutable MCP version. The matching non-secret
2488
2213
  * provider metadata lives in Batch.connectionSet. */
2489
- connectionId: z26.string().min(1).optional()
2214
+ connectionId: z25.string().min(1).optional()
2490
2215
  });
2491
2216
  var MAX_MCP_SET_ENTRIES = 8;
2492
- var mcpSetSchema = z26.array(mcpSetEntrySchema).max(
2217
+ var mcpSetSchema = z25.array(mcpSetEntrySchema).max(
2493
2218
  MAX_MCP_SET_ENTRIES,
2494
2219
  `a run may prepare at most ${MAX_MCP_SET_ENTRIES} MCP servers`
2495
2220
  );
2496
- var mcpRefSchema = z26.string().min(3).max(320).regex(
2221
+ var mcpRefSchema = z25.string().min(3).max(320).regex(
2497
2222
  /^[A-Za-z0-9][A-Za-z0-9._-]*@[^,]+$/,
2498
2223
  'an MCP server reference must be "name@label" (a bare name is not a reference)'
2499
2224
  );
2500
- var mcpRefsSchema = z26.array(mcpRefSchema).max(MAX_MCP_SET_ENTRIES);
2501
- var mcpVersionWireSchema = z26.object({
2502
- id: z26.string(),
2503
- label: z26.string(),
2504
- specDigest: z26.string(),
2225
+ var mcpRefsSchema = z25.array(mcpRefSchema).max(MAX_MCP_SET_ENTRIES);
2226
+ var mcpVersionWireSchema = z25.object({
2227
+ id: z25.string(),
2228
+ label: z25.string(),
2229
+ specDigest: z25.string(),
2505
2230
  spec: mcpSpecSchema,
2506
2231
  exposure: mcpExposureSchema,
2507
- warnings: z26.array(mcpWarningSchema),
2508
- createdAt: z26.string()
2232
+ warnings: z25.array(mcpWarningSchema),
2233
+ createdAt: z25.string()
2509
2234
  });
2510
- var mcpServerListItemSchema = z26.object({
2511
- id: z26.string(),
2235
+ var mcpServerListItemSchema = z25.object({
2236
+ id: z25.string(),
2512
2237
  /** OUR handle — the {ref} segment and the config key the serializer writes. */
2513
2238
  name: mcpServerHandleSchema,
2514
- note: z26.string().nullable(),
2239
+ note: z25.string().nullable(),
2515
2240
  latestVersion: mcpVersionWireSchema.nullable(),
2516
- versionCount: z26.number().int(),
2517
- createdAt: z26.string(),
2518
- updatedAt: z26.string()
2241
+ versionCount: z25.number().int(),
2242
+ createdAt: z25.string(),
2243
+ updatedAt: z25.string()
2519
2244
  });
2520
- var listMcpServersResponseSchema = z26.object({
2521
- items: z26.array(mcpServerListItemSchema)
2245
+ var listMcpServersResponseSchema = z25.object({
2246
+ items: z25.array(mcpServerListItemSchema)
2522
2247
  });
2523
- var mcpServerDetailSchema = mcpServerListItemSchema.omit({ latestVersion: true }).extend({ versions: z26.array(mcpVersionWireSchema) });
2524
- var saveMcpServerBodySchema = z26.object({
2248
+ var mcpServerDetailSchema = mcpServerListItemSchema.omit({ latestVersion: true }).extend({ versions: z25.array(mcpVersionWireSchema) });
2249
+ var saveMcpServerBodySchema = z25.object({
2525
2250
  name: mcpServerHandleSchema,
2526
- spec: z26.unknown(),
2251
+ spec: z25.unknown(),
2527
2252
  /** A typed label is intent and always mints; omitted defaults to a UTC
2528
2253
  * timestamp label and dedups by spec digest. */
2529
- label: z26.string().min(1).max(120).optional(),
2530
- note: z26.string().max(2e3).optional()
2531
- });
2532
- var saveMcpServerResponseSchema = z26.object({
2533
- serverId: z26.string().nullable(),
2534
- handle: z26.string(),
2535
- label: z26.string(),
2536
- specDigest: z26.string(),
2537
- warnings: z26.array(mcpWarningSchema),
2254
+ label: z25.string().min(1).max(120).optional(),
2255
+ note: z25.string().max(2e3).optional()
2256
+ });
2257
+ var saveMcpServerResponseSchema = z25.object({
2258
+ serverId: z25.string().nullable(),
2259
+ handle: z25.string(),
2260
+ label: z25.string(),
2261
+ specDigest: z25.string(),
2262
+ warnings: z25.array(mcpWarningSchema),
2538
2263
  /** True = the newest version already carries this exact spec. */
2539
- unchanged: z26.boolean(),
2264
+ unchanged: z25.boolean(),
2540
2265
  /** Display-only rendered invocation or URL. */
2541
- invocation: z26.string()
2266
+ invocation: z25.string()
2542
2267
  });
2543
- var updateMcpServerBodySchema = z26.object({
2268
+ var updateMcpServerBodySchema = z25.object({
2544
2269
  name: mcpServerHandleSchema.optional(),
2545
- note: z26.string().max(2e3).nullish()
2270
+ note: z25.string().max(2e3).nullish()
2546
2271
  });
2547
2272
 
2548
2273
  // ../packages/api-schemas/src/me.ts
2549
- import { z as z27 } from "zod";
2550
- var meUserSchema = z27.object({
2551
- id: z27.string(),
2552
- email: z27.string().nullable(),
2553
- isSuperuser: z27.boolean()
2274
+ import { z as z26 } from "zod";
2275
+ var meUserSchema = z26.object({
2276
+ id: z26.string(),
2277
+ email: z26.string().nullable(),
2278
+ isSuperuser: z26.boolean()
2554
2279
  });
2555
- var meOrgSchema = z27.object({
2556
- slug: z27.string(),
2280
+ var meOrgSchema = z26.object({
2281
+ slug: z26.string(),
2557
2282
  // Gauge's immutable Organization.public_id; null for LOCAL orgs.
2558
- publicId: z27.string().nullable(),
2559
- name: z27.string()
2283
+ publicId: z26.string().nullable(),
2284
+ name: z26.string()
2560
2285
  });
2561
- var meResponseSchema = z27.object({
2286
+ var meResponseSchema = z26.object({
2562
2287
  user: meUserSchema,
2563
2288
  // Membership-scoped for normal users; superusers see every org (mirrors the
2564
2289
  // web tier's userOrgs).
2565
- orgs: z27.array(meOrgSchema)
2290
+ orgs: z26.array(meOrgSchema)
2566
2291
  });
2567
2292
 
2568
2293
  // ../packages/api-schemas/src/optimizations.ts
2569
- import { z as z31 } from "zod";
2570
-
2571
- // ../packages/api-schemas/src/climb.ts
2572
2294
  import { z as z30 } from "zod";
2573
2295
 
2574
2296
  // ../packages/api-schemas/src/cli-interventions.ts
2575
- import { z as z28 } from "zod";
2576
- var digest = z28.string().regex(/^[a-f0-9]{64}$/);
2577
- var token = z28.string().min(1).max(4096);
2578
- var optionFlag = z28.string().regex(/^--?[A-Za-z0-9][A-Za-z0-9-]*$/);
2579
- var envKey = z28.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);
2580
- var relativePath = z28.string().min(1).max(1024).refine(
2297
+ import { z as z27 } from "zod";
2298
+ var digest = z27.string().regex(/^[a-f0-9]{64}$/);
2299
+ var token = z27.string().min(1).max(4096);
2300
+ var optionFlag = z27.string().regex(/^--?[A-Za-z0-9][A-Za-z0-9-]*$/);
2301
+ var envKey = z27.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);
2302
+ var relativePath = z27.string().min(1).max(1024).refine(
2581
2303
  (path2) => !path2.startsWith("/") && !path2.includes("\\") && !path2.includes("\0") && path2.split("/").every(
2582
2304
  (part) => part && part !== "." && part !== ".." && ![".git", "node_modules", ".pnpm", ".yarn", ".venv"].includes(part)
2583
2305
  ),
2584
2306
  "Use a workspace-relative path without traversal"
2585
2307
  );
2586
- var sourcedValue = z28.discriminatedUnion("source", [
2587
- z28.object({ source: z28.literal("literal"), value: z28.string().max(8192) }).strict(),
2588
- z28.object({ source: z28.literal("localFact"), key: envKey }).strict()
2308
+ var sourcedValue = z27.discriminatedUnion("source", [
2309
+ z27.object({ source: z27.literal("literal"), value: z27.string().max(8192) }).strict(),
2310
+ z27.object({ source: z27.literal("localFact"), key: envKey }).strict()
2589
2311
  ]);
2590
- var cliLaunchFormSchema = z28.enum([
2312
+ var cliLaunchFormSchema = z27.enum([
2591
2313
  "native",
2592
2314
  "path",
2593
2315
  "symlink",
@@ -2598,13 +2320,48 @@ var cliLaunchFormSchema = z28.enum([
2598
2320
  "execveat-path",
2599
2321
  "execveat-fd"
2600
2322
  ]);
2601
- var cliIoProfileSchema = z28.enum([
2323
+ var cliObservationReasonSchema = z27.enum([
2324
+ "eligible",
2325
+ "other-target",
2326
+ "other-command",
2327
+ "selector-mismatch",
2328
+ "unknown-command",
2329
+ "identity-unresolved",
2330
+ "artifact-mismatch",
2331
+ "runtime-mismatch",
2332
+ "launch-form",
2333
+ "io-profile",
2334
+ "operation-profile",
2335
+ "descriptor-lifetime"
2336
+ ]);
2337
+ var cliIoProfileSchema = z27.enum([
2602
2338
  "pipes",
2603
2339
  "redirected",
2604
2340
  "shared-descriptor",
2605
2341
  "pty"
2606
2342
  ]);
2607
- var cliOperationKindSchema = z28.enum([
2343
+ var cliObservationSchema = z27.object({
2344
+ invocationId: z27.string().regex(/^[a-f0-9]{32}$/),
2345
+ targetId: token,
2346
+ commandId: token.nullable(),
2347
+ entrypointSha256: digest,
2348
+ runtimeSha256: digest.nullable(),
2349
+ launchForm: cliLaunchFormSchema.nullable(),
2350
+ ioProfile: cliIoProfileSchema.nullable(),
2351
+ reason: cliObservationReasonSchema
2352
+ });
2353
+ var cliCoverageSchema = z27.object({
2354
+ attempt: z27.number().int().nonnegative(),
2355
+ observedInvocationCount: z27.number().int().nonnegative().nullable(),
2356
+ invocationCount: z27.number().int().nonnegative(),
2357
+ appliedInvocationCount: z27.number().int().nonnegative(),
2358
+ incompleteCount: z27.number().int().nonnegative(),
2359
+ unsupportedCount: z27.number().int().nonnegative(),
2360
+ instrumentationFailed: z27.boolean(),
2361
+ observations: z27.array(cliObservationSchema),
2362
+ unsupportedDiagnostics: z27.array(z27.string())
2363
+ });
2364
+ var cliOperationKindSchema = z27.enum([
2608
2365
  "ensureOption",
2609
2366
  "replaceOption",
2610
2367
  "setEnv",
@@ -2614,17 +2371,17 @@ var cliOperationKindSchema = z28.enum([
2614
2371
  "promptRecipe",
2615
2372
  "generatedFile"
2616
2373
  ]);
2617
- var commandCapabilitiesSchema = z28.object({
2618
- operations: z28.array(cliOperationKindSchema).max(8),
2619
- options: z28.array(z28.object({ flag: optionFlag, takesValue: z28.boolean() }).strict()).max(100).default([]),
2620
- settings: z28.array(envKey).max(100).default([]),
2621
- localFacts: z28.array(envKey).max(30).default([]),
2622
- generatedPaths: z28.array(relativePath).max(50).default([]),
2623
- outputModes: z28.array(z28.enum(["streaming", "completed"])).max(2).default([]),
2624
- stdinFormats: z28.array(z28.enum(["text", "json", "jsonl"])).max(3).default([]),
2625
- recipeIds: z28.array(token).max(50).default([])
2374
+ var commandCapabilitiesSchema = z27.object({
2375
+ operations: z27.array(cliOperationKindSchema).max(8),
2376
+ options: z27.array(z27.object({ flag: optionFlag, takesValue: z27.boolean() }).strict()).max(100).default([]),
2377
+ settings: z27.array(envKey).max(100).default([]),
2378
+ localFacts: z27.array(envKey).max(30).default([]),
2379
+ generatedPaths: z27.array(relativePath).max(50).default([]),
2380
+ outputModes: z27.array(z27.enum(["streaming", "completed"])).max(2).default([]),
2381
+ stdinFormats: z27.array(z27.enum(["text", "json", "jsonl"])).max(3).default([]),
2382
+ recipeIds: z27.array(token).max(50).default([])
2626
2383
  }).strict();
2627
- var cliTargetSchema = z28.object({
2384
+ var cliTargetSchema = z27.object({
2628
2385
  id: token,
2629
2386
  vendor: token,
2630
2387
  package: token,
@@ -2633,22 +2390,22 @@ var cliTargetSchema = z28.object({
2633
2390
  artifactSha256: digest.nullable(),
2634
2391
  entrypointSha256: digest.nullable(),
2635
2392
  /** Trace-derived recognition hints. Actual bytes are captured by record mode. */
2636
- discovery: z28.object({
2393
+ discovery: z27.object({
2637
2394
  ecosystem: token.nullable(),
2638
2395
  program: token,
2639
- executables: z28.array(token).max(20)
2396
+ executables: z27.array(token).max(20)
2640
2397
  }).strict().optional(),
2641
- ownershipEvidence: z28.string().min(1).max(2048),
2642
- entrypoints: z28.array(z28.string().min(1).max(1024)).max(20),
2398
+ ownershipEvidence: z27.string().min(1).max(2048),
2399
+ entrypoints: z27.array(z27.string().min(1).max(1024)).max(20),
2643
2400
  /** Flags accepted before the subcommand, with explicit value arity. */
2644
- globalOptions: z28.array(z28.object({ flag: optionFlag, takesValue: z28.boolean() }).strict()).max(100),
2645
- launchForms: z28.array(cliLaunchFormSchema).min(1),
2646
- ioProfiles: z28.array(cliIoProfileSchema).min(1),
2647
- commands: z28.array(
2648
- z28.object({
2401
+ globalOptions: z27.array(z27.object({ flag: optionFlag, takesValue: z27.boolean() }).strict()).max(100),
2402
+ launchForms: z27.array(cliLaunchFormSchema).min(1),
2403
+ ioProfiles: z27.array(cliIoProfileSchema).min(1),
2404
+ commands: z27.array(
2405
+ z27.object({
2649
2406
  id: token,
2650
2407
  /** Tokens following global options, before a literal `--`. */
2651
- subcommand: z28.array(token).max(8),
2408
+ subcommand: z27.array(token).max(8),
2652
2409
  capabilities: commandCapabilitiesSchema
2653
2410
  }).strict()
2654
2411
  ).min(1)
@@ -2728,11 +2485,11 @@ var cliTargetSchema = z28.object({
2728
2485
  }
2729
2486
  });
2730
2487
  var CLI_CATALOG_MAX_TARGETS = 100;
2731
- var cliCatalogSchema = z28.object({
2732
- version: z28.union([z28.literal(1), z28.literal(2)]),
2488
+ var cliCatalogSchema = z27.object({
2489
+ version: z27.union([z27.literal(1), z27.literal(2)]),
2733
2490
  engineVersion: token,
2734
2491
  digest,
2735
- targets: z28.array(cliTargetSchema).max(CLI_CATALOG_MAX_TARGETS)
2492
+ targets: z27.array(cliTargetSchema).max(CLI_CATALOG_MAX_TARGETS)
2736
2493
  }).strict().superRefine((catalog, ctx) => {
2737
2494
  if (catalog.version === 1 && (!catalog.targets.length || catalog.targets.some((target) => target.discovery)))
2738
2495
  ctx.addIssue({
@@ -2748,15 +2505,15 @@ var cliCatalogSchema = z28.object({
2748
2505
  });
2749
2506
  });
2750
2507
  });
2751
- var exitPredicate = z28.discriminatedUnion("kind", [
2752
- z28.object({ kind: z28.literal("any") }).strict(),
2753
- z28.object({
2754
- kind: z28.literal("code"),
2755
- value: z28.number().int().min(0).max(255)
2508
+ var exitPredicate = z27.discriminatedUnion("kind", [
2509
+ z27.object({ kind: z27.literal("any") }).strict(),
2510
+ z27.object({
2511
+ kind: z27.literal("code"),
2512
+ value: z27.number().int().min(0).max(255)
2756
2513
  }).strict()
2757
2514
  ]);
2758
- var outputStream = z28.enum(["stdout", "stderr", "combined"]);
2759
- var literalEdit = z28.object({ find: z28.string().min(1).max(8192), replace: z28.string().max(8192) }).strict();
2515
+ var outputStream = z27.enum(["stdout", "stderr", "combined"]);
2516
+ var literalEdit = z27.object({ find: z27.string().min(1).max(8192), replace: z27.string().max(8192) }).strict();
2760
2517
  function boundedOutputPattern(pattern) {
2761
2518
  let at = pattern.startsWith("^") ? 1 : 0;
2762
2519
  const end = pattern.endsWith("$") && pattern.length > at ? pattern.length - 1 : pattern.length;
@@ -2779,86 +2536,86 @@ function boundedOutputPattern(pattern) {
2779
2536
  }
2780
2537
  return literalBytes > 0;
2781
2538
  }
2782
- var operationSchema = z28.discriminatedUnion("kind", [
2783
- z28.object({
2784
- kind: z28.literal("ensureOption"),
2539
+ var operationSchema = z27.discriminatedUnion("kind", [
2540
+ z27.object({
2541
+ kind: z27.literal("ensureOption"),
2785
2542
  option: optionFlag,
2786
2543
  value: sourcedValue.optional()
2787
2544
  }).strict(),
2788
- z28.object({
2789
- kind: z28.literal("replaceOption"),
2545
+ z27.object({
2546
+ kind: z27.literal("replaceOption"),
2790
2547
  option: optionFlag,
2791
2548
  value: sourcedValue
2792
2549
  }).strict(),
2793
- z28.object({
2794
- kind: z28.literal("setEnv"),
2550
+ z27.object({
2551
+ kind: z27.literal("setEnv"),
2795
2552
  key: envKey,
2796
2553
  value: sourcedValue,
2797
- whenAbsent: z28.boolean()
2554
+ whenAbsent: z27.boolean()
2798
2555
  }).strict(),
2799
- z28.object({
2800
- kind: z28.literal("streamOutput"),
2556
+ z27.object({
2557
+ kind: z27.literal("streamOutput"),
2801
2558
  stream: outputStream,
2802
2559
  edit: literalEdit
2803
2560
  }).strict(),
2804
- z28.object({
2805
- kind: z28.literal("completeOutput"),
2561
+ z27.object({
2562
+ kind: z27.literal("completeOutput"),
2806
2563
  stream: outputStream,
2807
- matcher: z28.discriminatedUnion("kind", [
2808
- z28.object({
2809
- kind: z28.literal("literal"),
2810
- text: z28.string().min(1).max(8192)
2564
+ matcher: z27.discriminatedUnion("kind", [
2565
+ z27.object({
2566
+ kind: z27.literal("literal"),
2567
+ text: z27.string().min(1).max(8192)
2811
2568
  }).strict(),
2812
- z28.object({
2813
- kind: z28.literal("re2"),
2814
- pattern: z28.string().min(1).max(2048).refine(
2569
+ z27.object({
2570
+ kind: z27.literal("re2"),
2571
+ pattern: z27.string().min(1).max(2048).refine(
2815
2572
  boundedOutputPattern,
2816
2573
  "Use literals, anchors, and at most one greedy .*; escape literal regex punctuation"
2817
2574
  )
2818
2575
  }).strict()
2819
2576
  ]),
2820
- replace: z28.string().max(8192),
2577
+ replace: z27.string().max(8192),
2821
2578
  exit: exitPredicate
2822
2579
  }).strict(),
2823
- z28.object({
2824
- kind: z28.literal("structuredStdin"),
2825
- format: z28.enum(["text", "json", "jsonl"]),
2580
+ z27.object({
2581
+ kind: z27.literal("structuredStdin"),
2582
+ format: z27.enum(["text", "json", "jsonl"]),
2826
2583
  payload: sourcedValue,
2827
- timing: z28.literal("onLaunch"),
2828
- callerInput: z28.literal("replace"),
2829
- eof: z28.literal("close")
2584
+ timing: z27.literal("onLaunch"),
2585
+ callerInput: z27.literal("replace"),
2586
+ eof: z27.literal("close")
2830
2587
  }).strict(),
2831
- z28.object({
2832
- kind: z28.literal("promptRecipe"),
2588
+ z27.object({
2589
+ kind: z27.literal("promptRecipe"),
2833
2590
  recipeId: token,
2834
- steps: z28.array(
2835
- z28.object({
2836
- prompt: z28.string().min(1).max(4096),
2591
+ steps: z27.array(
2592
+ z27.object({
2593
+ prompt: z27.string().min(1).max(4096),
2837
2594
  response: sourcedValue,
2838
- timeoutMs: z28.number().int().min(1).max(12e4)
2595
+ timeoutMs: z27.number().int().min(1).max(12e4)
2839
2596
  }).strict()
2840
2597
  ).min(1).max(20),
2841
- overallTimeoutMs: z28.number().int().min(1).max(6e5),
2842
- completion: z28.string().min(1).max(4096)
2598
+ overallTimeoutMs: z27.number().int().min(1).max(6e5),
2599
+ completion: z27.string().min(1).max(4096)
2843
2600
  }).strict(),
2844
- z28.object({
2845
- kind: z28.literal("generatedFile"),
2601
+ z27.object({
2602
+ kind: z27.literal("generatedFile"),
2846
2603
  path: relativePath,
2847
2604
  beforeSha256: digest.nullable(),
2848
2605
  generatedSha256: digest,
2849
2606
  outcome: exitPredicate,
2850
2607
  edit: literalEdit,
2851
- required: z28.boolean()
2608
+ required: z27.boolean()
2852
2609
  }).strict()
2853
2610
  ]);
2854
- var cliBaselineRecordFileSchema = z28.object({
2855
- pathIndex: z28.number().int().nonnegative().max(49),
2611
+ var cliBaselineRecordFileSchema = z27.object({
2612
+ pathIndex: z27.number().int().nonnegative().max(49),
2856
2613
  path: relativePath,
2857
- status: z28.enum(["generated", "not-exercised"]),
2614
+ status: z27.enum(["generated", "not-exercised"]),
2858
2615
  beforeSha256: digest.nullable(),
2859
2616
  generatedSha256: digest.nullable()
2860
2617
  }).strict();
2861
- var baselineInvocationSchema = z28.object({
2618
+ var baselineInvocationSchema = z27.object({
2862
2619
  runId: token,
2863
2620
  invocationId: token,
2864
2621
  targetId: token,
@@ -2866,34 +2623,36 @@ var baselineInvocationSchema = z28.object({
2866
2623
  artifactSha256: digest.nullable(),
2867
2624
  entrypointSha256: digest,
2868
2625
  engineSha256: digest.optional(),
2626
+ runtimeSha256: digest.optional(),
2869
2627
  launchForm: cliLaunchFormSchema,
2870
2628
  ioProfile: cliIoProfileSchema,
2871
- recordFiles: z28.array(cliBaselineRecordFileSchema).max(50).default([])
2629
+ recordFiles: z27.array(cliBaselineRecordFileSchema).max(50).default([])
2872
2630
  }).strict();
2873
- var cliInterventionSchema = z28.object({
2874
- schemaVersion: z28.union([z28.literal(1), z28.literal(2)]),
2631
+ var cliInterventionSchema = z27.object({
2632
+ schemaVersion: z27.union([z27.literal(1), z27.literal(2)]),
2633
+ identityPolicy: z27.literal("artifact").optional(),
2875
2634
  engineVersion: token,
2876
2635
  engineSha256: digest.nullable(),
2877
2636
  bundleSha256: digest,
2878
2637
  catalog: cliCatalogSchema,
2879
- mode: z28.enum(["record", "trial"]),
2880
- captureProfiles: z28.array(cliIoProfileSchema).min(1),
2638
+ mode: z27.enum(["record", "trial"]),
2639
+ captureProfiles: z27.array(cliIoProfileSchema).min(1),
2881
2640
  activeTargetId: token.nullable(),
2882
2641
  activeCommandId: token.nullable(),
2883
- selector: z28.object({
2884
- optionPresent: z28.array(optionFlag).max(20),
2885
- optionAbsent: z28.array(optionFlag).max(20)
2642
+ selector: z27.object({
2643
+ optionPresent: z27.array(optionFlag).max(20),
2644
+ optionAbsent: z27.array(optionFlag).max(20)
2886
2645
  }).strict().nullable(),
2887
- baselineInvocations: z28.array(baselineInvocationSchema).max(500),
2888
- operations: z28.array(operationSchema).max(50),
2889
- limits: z28.object({
2890
- completedStreamBytes: z28.number().int().min(1).max(2 * 1024 * 1024),
2891
- replacementBytes: z28.number().int().min(1).max(8192),
2892
- generatedFileBytes: z28.number().int().min(1).max(2 * 1024 * 1024),
2893
- generatedAggregateBytes: z28.number().int().min(1).max(8 * 1024 * 1024),
2894
- generatedFileCount: z28.number().int().min(1).max(50)
2646
+ baselineInvocations: z27.array(baselineInvocationSchema).max(500),
2647
+ operations: z27.array(operationSchema).max(50),
2648
+ limits: z27.object({
2649
+ completedStreamBytes: z27.number().int().min(1).max(2 * 1024 * 1024),
2650
+ replacementBytes: z27.number().int().min(1).max(8192),
2651
+ generatedFileBytes: z27.number().int().min(1).max(2 * 1024 * 1024),
2652
+ generatedAggregateBytes: z27.number().int().min(1).max(8 * 1024 * 1024),
2653
+ generatedFileCount: z27.number().int().min(1).max(50)
2895
2654
  }).strict(),
2896
- shippingIntent: z28.enum([
2655
+ shippingIntent: z27.enum([
2897
2656
  "default",
2898
2657
  "message",
2899
2658
  "interaction",
@@ -2904,6 +2663,13 @@ var cliInterventionSchema = z28.object({
2904
2663
  const fail = (path2, message) => ctx.addIssue({ code: "custom", path: path2, message });
2905
2664
  if (bundle.schemaVersion !== bundle.catalog.version)
2906
2665
  fail(["schemaVersion"], "Bundle and catalog schema versions differ");
2666
+ if (bundle.identityPolicy && bundle.schemaVersion !== 2)
2667
+ fail(["identityPolicy"], "Artifact identity requires schema version 2");
2668
+ if (bundle.identityPolicy && bundle.baselineInvocations.some((row2) => !row2.runtimeSha256))
2669
+ fail(
2670
+ ["baselineInvocations"],
2671
+ "Artifact identity requires the recorded runtime bytes"
2672
+ );
2907
2673
  if (!bundle.engineSha256 && (bundle.schemaVersion === 1 || bundle.mode !== "record"))
2908
2674
  fail(["engineSha256"], "A trial must pin the recorded engine bytes");
2909
2675
  if (!bundle.catalog.targets.length)
@@ -3087,7 +2853,7 @@ var cliInterventionSchema = z28.object({
3087
2853
  "Generated file count exceeds limit"
3088
2854
  );
3089
2855
  });
3090
- var cliTrialChangeSchema = z28.object({
2856
+ var cliTrialChangeSchema = z27.object({
3091
2857
  targetId: token,
3092
2858
  commandId: token,
3093
2859
  selector: cliInterventionSchema.shape.selector.unwrap(),
@@ -3095,6 +2861,9 @@ var cliTrialChangeSchema = z28.object({
3095
2861
  shippingIntent: cliInterventionSchema.shape.shippingIntent.unwrap()
3096
2862
  }).strict();
3097
2863
 
2864
+ // ../packages/api-schemas/src/climb.ts
2865
+ import { z as z29 } from "zod";
2866
+
3098
2867
  // ../packages/api-schemas/src/climb-kinds.ts
3099
2868
  var LEVER_KINDS = [
3100
2869
  "DOCS",
@@ -3123,35 +2892,35 @@ var LEVER_INTERVENTIONS = {
3123
2892
  };
3124
2893
 
3125
2894
  // ../packages/api-schemas/src/sandbox-overrides.ts
3126
- import { z as z29 } from "zod";
2895
+ import { z as z28 } from "zod";
3127
2896
  var SANDBOX_OVERRIDE_KINDS = ["packages", "clis"];
3128
- var ecosystemSchema = z29.enum(["npm", "pypi", "cargo", "go", "gem"]);
3129
- var overrideFilesSchema = z29.array(
3130
- z29.object({
3131
- path: z29.string().min(1).refine(
2897
+ var ecosystemSchema = z28.enum(["npm", "pypi", "cargo", "go", "gem"]);
2898
+ var overrideFilesSchema = z28.array(
2899
+ z28.object({
2900
+ path: z28.string().min(1).refine(
3132
2901
  (path2) => !path2.startsWith("/") && !path2.includes("\\") && !path2.split("/").includes(".."),
3133
2902
  "Use a relative path within the target"
3134
2903
  ),
3135
- body: z29.string()
2904
+ body: z28.string()
3136
2905
  }).strict()
3137
2906
  ).min(1);
3138
2907
  var contentShape = {
3139
- version: z29.string().trim().min(1).optional(),
2908
+ version: z28.string().trim().min(1).optional(),
3140
2909
  files: overrideFilesSchema.optional()
3141
2910
  };
3142
2911
  var hasContent = (value) => value.version !== void 0 || value.files !== void 0;
3143
- var sandboxOverridesSchema = z29.object({
3144
- version: z29.literal(1),
3145
- packages: z29.array(
3146
- z29.object({
2912
+ var sandboxOverridesSchema = z28.object({
2913
+ version: z28.literal(1),
2914
+ packages: z28.array(
2915
+ z28.object({
3147
2916
  ecosystem: ecosystemSchema,
3148
- name: z29.string().trim().min(1),
2917
+ name: z28.string().trim().min(1),
3149
2918
  ...contentShape
3150
2919
  }).strict().refine(hasContent, "Specify a version or files")
3151
2920
  ).optional(),
3152
- clis: z29.array(
3153
- z29.object({
3154
- name: z29.string().trim().min(1),
2921
+ clis: z28.array(
2922
+ z28.object({
2923
+ name: z28.string().trim().min(1),
3155
2924
  ...contentShape
3156
2925
  }).strict().refine(hasContent, "Specify a version or files")
3157
2926
  ).optional()
@@ -3178,11 +2947,11 @@ var sandboxOverridesSchema = z29.object({
3178
2947
  });
3179
2948
 
3180
2949
  // ../packages/api-schemas/src/climb.ts
3181
- var climbSubjectKindSchema = z30.enum(["EVAL_SET", "VISIBILITY_PROMPT"]);
3182
- var leverKindSchema = z30.enum(LEVER_KINDS);
3183
- var interventionKindSchema = z30.enum(INTERVENTION_KINDS);
3184
- var skill = z30.object({ skillVersionId: z30.string().min(1) }).strict();
3185
- var empty = z30.object({}).strict();
2950
+ var climbSubjectKindSchema = z29.enum(["EVAL_SET", "VISIBILITY_PROMPT"]);
2951
+ var leverKindSchema = z29.enum(LEVER_KINDS);
2952
+ var interventionKindSchema = z29.enum(INTERVENTION_KINDS);
2953
+ var skill = z29.object({ skillVersionId: z29.string().min(1) }).strict();
2954
+ var empty = z29.object({}).strict();
3186
2955
  function validateFixtureIntervention(value, ctx) {
3187
2956
  const result = webFixtureSchema.safeParse({ version: 1, ...value });
3188
2957
  if (!result.success) {
@@ -3195,75 +2964,75 @@ function validateFixtureIntervention(value, ctx) {
3195
2964
  }
3196
2965
  }
3197
2966
  }
3198
- var interventionSchema = z30.discriminatedUnion("kind", [
3199
- z30.object({ kind: z30.literal("BASELINE"), after: empty }),
3200
- z30.object({ kind: z30.literal("ADD_SKILL"), after: skill }),
3201
- z30.object({ kind: z30.literal("REMOVE_SKILL"), before: skill, after: empty }),
3202
- z30.object({ kind: z30.literal("EDIT_SKILL"), before: skill, after: skill }),
3203
- z30.object({
3204
- kind: z30.literal("REWRITE_DOCS"),
3205
- before: z30.json().optional(),
3206
- after: z30.object({ pages: webFixtureSchema.shape.pages.unwrap().min(1) }).strict().superRefine(validateFixtureIntervention)
2967
+ var interventionSchema = z29.discriminatedUnion("kind", [
2968
+ z29.object({ kind: z29.literal("BASELINE"), after: empty }),
2969
+ z29.object({ kind: z29.literal("ADD_SKILL"), after: skill }),
2970
+ z29.object({ kind: z29.literal("REMOVE_SKILL"), before: skill, after: empty }),
2971
+ z29.object({ kind: z29.literal("EDIT_SKILL"), before: skill, after: skill }),
2972
+ z29.object({
2973
+ kind: z29.literal("REWRITE_DOCS"),
2974
+ before: z29.json().optional(),
2975
+ after: z29.object({ pages: webFixtureSchema.shape.pages.unwrap().min(1) }).strict().superRefine(validateFixtureIntervention)
3207
2976
  }),
3208
- z30.object({
3209
- kind: z30.literal("PACKAGE_VERSION"),
3210
- after: z30.object({
2977
+ z29.object({
2978
+ kind: z29.literal("PACKAGE_VERSION"),
2979
+ after: z29.object({
3211
2980
  ecosystem: ecosystemSchema,
3212
- name: z30.string().min(1),
3213
- version: z30.string().min(1)
2981
+ name: z29.string().min(1),
2982
+ version: z29.string().min(1)
3214
2983
  }).strict()
3215
2984
  }),
3216
- z30.object({
3217
- kind: z30.literal("PACKAGE_CONTENT"),
3218
- after: z30.object({
2985
+ z29.object({
2986
+ kind: z29.literal("PACKAGE_CONTENT"),
2987
+ after: z29.object({
3219
2988
  ecosystem: ecosystemSchema,
3220
- name: z30.string().min(1),
2989
+ name: z29.string().min(1),
3221
2990
  files: overrideFilesSchema
3222
2991
  }).strict()
3223
2992
  }),
3224
- z30.object({
3225
- kind: z30.literal("CLI_VERSION"),
3226
- after: z30.object({ name: z30.string().min(1), version: z30.string().min(1) }).strict()
2993
+ z29.object({
2994
+ kind: z29.literal("CLI_VERSION"),
2995
+ after: z29.object({ name: z29.string().min(1), version: z29.string().min(1) }).strict()
3227
2996
  }),
3228
- z30.object({
3229
- kind: z30.literal("CLI_INTERVENTION"),
2997
+ z29.object({
2998
+ kind: z29.literal("CLI_INTERVENTION"),
3230
2999
  after: cliInterventionSchema.refine((bundle) => bundle.mode === "trial", {
3231
3000
  message: "A CLI trial requires a trial-mode bundle"
3232
3001
  })
3233
3002
  })
3234
3003
  ]);
3235
- var climbSettingsSchema = z30.object({
3236
- maxRounds: z30.number().int().positive().default(5),
3237
- sampleCount: z30.number().int().positive().default(1),
3238
- creditCap: z30.number().int().nonnegative(),
3239
- targetScore: z30.number().min(0).max(1).default(1),
3004
+ var climbSettingsSchema = z29.object({
3005
+ maxRounds: z29.number().int().positive().default(5),
3006
+ sampleCount: z29.number().int().positive().default(1),
3007
+ creditCap: z29.number().int().nonnegative(),
3008
+ targetScore: z29.number().min(0).max(1).default(1),
3240
3009
  // Narrow the subject's whole roster to one slot, for the baseline and every
3241
3010
  // trial alike. A subject rostering ten models otherwise multiplies every
3242
3011
  // trial by ten, and a one-model trial measured against a ten-model baseline
3243
3012
  // is not a comparison. `pinnedModel` empty means the agent's default model.
3244
3013
  pinnedAgent: schedulableAgentSchema.optional(),
3245
- pinnedModel: z30.string().optional(),
3246
- maxTrialsPerRound: z30.number().int().min(1).max(10).default(3),
3014
+ pinnedModel: z29.string().optional(),
3015
+ maxTrialsPerRound: z29.number().int().min(1).max(10).default(3),
3247
3016
  // The round a continuation started at; the no-improvement counter
3248
3017
  // restarts here.
3249
- continuedAtRound: z30.number().int().nonnegative().optional()
3018
+ continuedAtRound: z29.number().int().nonnegative().optional()
3250
3019
  }).strip().refine((value) => value.pinnedAgent !== void 0 || !value.pinnedModel, {
3251
3020
  path: ["pinnedAgent"],
3252
3021
  message: "Pin an agent with the model"
3253
3022
  });
3254
- var climbDirectionSchema = z30.object({
3255
- focus: z30.string().trim().max(2e3).nullable().default(null),
3256
- preserve: z30.array(z30.string().trim().min(1).max(500)).max(20).default([]),
3257
- exclude: z30.array(z30.string().trim().min(1).max(500)).max(20).default([]),
3258
- notes: z30.string().trim().max(4e3).nullable().default(null)
3259
- });
3260
- var climbDirectionPatchSchema = z30.object({
3261
- focus: z30.string().trim().max(2e3).nullable().optional(),
3262
- preserve: z30.array(z30.string().trim().min(1).max(500)).max(20).optional(),
3263
- exclude: z30.array(z30.string().trim().min(1).max(500)).max(20).optional(),
3264
- notes: z30.string().trim().max(4e3).nullable().optional(),
3023
+ var climbDirectionSchema = z29.object({
3024
+ focus: z29.string().trim().max(2e3).nullable().default(null),
3025
+ preserve: z29.array(z29.string().trim().min(1).max(500)).max(20).default([]),
3026
+ exclude: z29.array(z29.string().trim().min(1).max(500)).max(20).default([]),
3027
+ notes: z29.string().trim().max(4e3).nullable().default(null)
3028
+ });
3029
+ var climbDirectionPatchSchema = z29.object({
3030
+ focus: z29.string().trim().max(2e3).nullable().optional(),
3031
+ preserve: z29.array(z29.string().trim().min(1).max(500)).max(20).optional(),
3032
+ exclude: z29.array(z29.string().trim().min(1).max(500)).max(20).optional(),
3033
+ notes: z29.string().trim().max(4e3).nullable().optional(),
3265
3034
  /** One line on why this was recorded; becomes the DIRECTION row summary. */
3266
- rationale: z30.string().trim().max(500).optional()
3035
+ rationale: z29.string().trim().max(500).optional()
3267
3036
  }).strict();
3268
3037
  var CLIMB_ACTIVITY_KINDS = [
3269
3038
  "STARTED",
@@ -3282,74 +3051,74 @@ var CLIMB_ACTIVITY_KINDS = [
3282
3051
  "CONTINUED",
3283
3052
  "CANCELED"
3284
3053
  ];
3285
- var climbActivityKindSchema = z30.enum(CLIMB_ACTIVITY_KINDS);
3286
- var proposerTraceStepSchema = z30.object({
3287
- tool: z30.string(),
3288
- args: z30.string(),
3289
- result: z30.string().nullable(),
3290
- isError: z30.boolean().optional()
3291
- });
3292
- var proposerTraceSchema = z30.object({
3293
- steps: z30.array(proposerTraceStepSchema),
3294
- reasoning: z30.string(),
3295
- durationMs: z30.number().int().nonnegative(),
3296
- model: z30.string()
3297
- });
3298
- var climbActivitySchema = z30.object({
3299
- id: z30.string(),
3300
- climbId: z30.string(),
3301
- roundId: z30.string().nullable(),
3302
- trialId: z30.string().nullable(),
3054
+ var climbActivityKindSchema = z29.enum(CLIMB_ACTIVITY_KINDS);
3055
+ var proposerTraceStepSchema = z29.object({
3056
+ tool: z29.string(),
3057
+ args: z29.string(),
3058
+ result: z29.string().nullable(),
3059
+ isError: z29.boolean().optional()
3060
+ });
3061
+ var proposerTraceSchema = z29.object({
3062
+ steps: z29.array(proposerTraceStepSchema),
3063
+ reasoning: z29.string(),
3064
+ durationMs: z29.number().int().nonnegative(),
3065
+ model: z29.string()
3066
+ });
3067
+ var climbActivitySchema = z29.object({
3068
+ id: z29.string(),
3069
+ climbId: z29.string(),
3070
+ roundId: z29.string().nullable(),
3071
+ trialId: z29.string().nullable(),
3303
3072
  kind: climbActivityKindSchema,
3304
- actorUserId: z30.string().nullable(),
3305
- actorName: z30.string().nullable(),
3306
- summary: z30.string(),
3307
- detail: z30.unknown().nullable(),
3308
- createdAt: z30.string()
3309
- });
3310
- var activityQuerySchema = z30.object({
3311
- after: z30.string().datetime().optional(),
3312
- limit: z30.coerce.number().int().min(1).max(500).default(500)
3313
- });
3314
- var climbConfigSnapshotSchema = z30.object({
3315
- promptText: z30.string(),
3316
- scenario: z30.enum(["GREENFIELD", "MIGRATION"]),
3317
- repoUrl: z30.string().nullable(),
3318
- repoRef: z30.string().nullable(),
3319
- profileId: z30.string().nullable(),
3320
- profileName: z30.string().nullable(),
3321
- profileDescription: z30.string().nullable(),
3322
- profileModel: z30.string().nullable(),
3323
- limits: z30.json(),
3324
- agents: z30.array(agentConfigSchema).min(1),
3325
- skillRefs: z30.array(z30.string()),
3326
- mcpRefs: z30.array(z30.string()),
3327
- skillVersionIds: z30.array(z30.string()),
3328
- mcpServerVersionIds: z30.array(z30.string()),
3329
- skillSet: z30.json().nullable(),
3330
- mcpSet: z30.json().nullable(),
3331
- connectionIds: z30.array(z30.string()),
3332
- connectionSet: z30.json().nullable(),
3333
- agentContext: z30.json().nullable(),
3334
- agentContextDigest: z30.string().nullable(),
3073
+ actorUserId: z29.string().nullable(),
3074
+ actorName: z29.string().nullable(),
3075
+ summary: z29.string(),
3076
+ detail: z29.unknown().nullable(),
3077
+ createdAt: z29.string()
3078
+ });
3079
+ var activityQuerySchema = z29.object({
3080
+ after: z29.string().datetime().optional(),
3081
+ limit: z29.coerce.number().int().min(1).max(500).default(500)
3082
+ });
3083
+ var climbConfigSnapshotSchema = z29.object({
3084
+ promptText: z29.string(),
3085
+ scenario: z29.enum(["GREENFIELD", "MIGRATION"]),
3086
+ repoUrl: z29.string().nullable(),
3087
+ repoRef: z29.string().nullable(),
3088
+ profileId: z29.string().nullable(),
3089
+ profileName: z29.string().nullable(),
3090
+ profileDescription: z29.string().nullable(),
3091
+ profileModel: z29.string().nullable(),
3092
+ limits: z29.json(),
3093
+ agents: z29.array(agentConfigSchema).min(1),
3094
+ skillRefs: z29.array(z29.string()),
3095
+ mcpRefs: z29.array(z29.string()),
3096
+ skillVersionIds: z29.array(z29.string()),
3097
+ mcpServerVersionIds: z29.array(z29.string()),
3098
+ skillSet: z29.json().nullable(),
3099
+ mcpSet: z29.json().nullable(),
3100
+ connectionIds: z29.array(z29.string()),
3101
+ connectionSet: z29.json().nullable(),
3102
+ agentContext: z29.json().nullable(),
3103
+ agentContextDigest: z29.string().nullable(),
3335
3104
  webFixture: webFixtureSchema.nullable(),
3336
3105
  cliIntervention: cliInterventionSchema.nullable().default(null),
3337
3106
  sandboxOverrides: sandboxOverridesSchema.nullable(),
3338
- visibilityScenarioId: z30.string().nullable()
3107
+ visibilityScenarioId: z29.string().nullable()
3339
3108
  }).strict();
3340
- var targetRefSchema = z30.object({
3341
- kind: z30.string().min(1),
3342
- id: z30.string().optional(),
3343
- url: z30.url().optional(),
3344
- package: z30.string().optional()
3109
+ var targetRefSchema = z29.object({
3110
+ kind: z29.string().min(1),
3111
+ id: z29.string().optional(),
3112
+ url: z29.url().optional(),
3113
+ package: z29.string().optional()
3345
3114
  }).strict();
3346
- var trialInputSchema = z30.object({
3347
- title: z30.string().trim().min(1).max(200),
3348
- hypothesis: z30.string().max(4e3).optional(),
3115
+ var trialInputSchema = z29.object({
3116
+ title: z29.string().trim().min(1).max(200),
3117
+ hypothesis: z29.string().max(4e3).optional(),
3349
3118
  lever: leverKindSchema,
3350
3119
  targetRef: targetRefSchema.optional(),
3351
3120
  intervention: interventionSchema,
3352
- authorMode: z30.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL")
3121
+ authorMode: z29.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL")
3353
3122
  }).strict().superRefine((value, ctx) => {
3354
3123
  const allowed = LEVER_INTERVENTIONS[value.lever];
3355
3124
  if (!allowed.includes(value.intervention.kind))
@@ -3368,7 +3137,7 @@ var OPTIMIZATION_STATUSES = [
3368
3137
  "DONE",
3369
3138
  "ARCHIVED"
3370
3139
  ];
3371
- var optimizationStatusSchema = z31.enum(OPTIMIZATION_STATUSES);
3140
+ var optimizationStatusSchema = z30.enum(OPTIMIZATION_STATUSES);
3372
3141
  var ROUND_STATUSES = [
3373
3142
  "PROPOSING",
3374
3143
  "PROPOSED",
@@ -3397,61 +3166,61 @@ var OPTIMIZATION_EFFORTS = [
3397
3166
  { value: "HIGH", label: "Thorough", sampleCount: 2, maxRounds: 8 },
3398
3167
  { value: "XHIGH", label: "Exhaustive", sampleCount: 3, maxRounds: 12 }
3399
3168
  ];
3400
- var optimizationEffortSchema = z31.enum(
3169
+ var optimizationEffortSchema = z30.enum(
3401
3170
  OPTIMIZATION_EFFORTS.map((preset) => preset.value)
3402
3171
  );
3403
- var listOptimizationsQuerySchema = z31.object({
3404
- status: z31.string().optional().transform(
3172
+ var listOptimizationsQuerySchema = z30.object({
3173
+ status: z30.string().optional().transform(
3405
3174
  (value) => value ? value.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean) : void 0
3406
- ).pipe(z31.array(optimizationStatusSchema).optional()),
3175
+ ).pipe(z30.array(optimizationStatusSchema).optional()),
3407
3176
  subjectKind: climbSubjectKindSchema.optional(),
3408
- subjectId: z31.string().min(1).optional(),
3409
- limit: z31.coerce.number().int().min(1).max(200).default(50),
3177
+ subjectId: z30.string().min(1).optional(),
3178
+ limit: z30.coerce.number().int().min(1).max(200).default(50),
3410
3179
  /** Drafts are workspaces, not runs; older clients never see them. */
3411
- includeDrafts: z31.union([z31.boolean(), z31.string()]).optional().transform((value) => value === true || value === "true" || value === "1")
3180
+ includeDrafts: z30.union([z30.boolean(), z30.string()]).optional().transform((value) => value === true || value === "true" || value === "1")
3412
3181
  });
3413
- var optimizationSummarySchema = z31.object({
3414
- id: z31.string(),
3415
- name: z31.string(),
3182
+ var optimizationSummarySchema = z30.object({
3183
+ id: z30.string(),
3184
+ name: z30.string(),
3416
3185
  status: optimizationStatusSchema,
3417
- mode: z31.enum(["MANUAL", "AUTO"]),
3186
+ mode: z30.enum(["MANUAL", "AUTO"]),
3418
3187
  /** Autonomous launches every proposed round; interactive waits for one. */
3419
- autonomous: z31.boolean(),
3420
- stopReason: z31.string().nullable(),
3188
+ autonomous: z30.boolean(),
3189
+ stopReason: z30.string().nullable(),
3421
3190
  subjectKind: climbSubjectKindSchema,
3422
- subjectId: z31.string(),
3423
- subjectName: z31.string(),
3191
+ subjectId: z30.string(),
3192
+ subjectName: z30.string(),
3424
3193
  lever: leverKindSchema.nullable(),
3425
- round: z31.number().int(),
3426
- maxRounds: z31.number().int(),
3194
+ round: z30.number().int(),
3195
+ maxRounds: z30.number().int(),
3427
3196
  /** Starting baseline score, 0..1. */
3428
- before: z31.number().nullable(),
3197
+ before: z30.number().nullable(),
3429
3198
  /** Score of the marked winner, or best BETTER trial, 0..1. */
3430
- after: z31.number().nullable(),
3199
+ after: z30.number().nullable(),
3431
3200
  /** Percentage-point change from the baseline to the winner or best BETTER trial. */
3432
- delta: z31.number().nullable(),
3201
+ delta: z30.number().nullable(),
3433
3202
  /** Score after each round, baseline first. */
3434
- path: z31.array(z31.number()),
3435
- creditsSpent: z31.number().int(),
3436
- creditsReserved: z31.number().int(),
3437
- summary: z31.string().nullable(),
3438
- href: z31.string(),
3439
- createdAt: z31.string(),
3440
- updatedAt: z31.string()
3441
- });
3442
- var listOptimizationsResponseSchema = z31.object({
3443
- items: z31.array(optimizationSummarySchema)
3444
- });
3445
- var targetSchema = z31.object({
3203
+ path: z30.array(z30.number()),
3204
+ creditsSpent: z30.number().int(),
3205
+ creditsReserved: z30.number().int(),
3206
+ summary: z30.string().nullable(),
3207
+ href: z30.string(),
3208
+ createdAt: z30.string(),
3209
+ updatedAt: z30.string()
3210
+ });
3211
+ var listOptimizationsResponseSchema = z30.object({
3212
+ items: z30.array(optimizationSummarySchema)
3213
+ });
3214
+ var targetSchema = z30.object({
3446
3215
  agent: schedulableAgentSchema.optional(),
3447
3216
  /** Empty or omitted means the agent's default model. */
3448
- model: z31.string().optional()
3217
+ model: z30.string().optional()
3449
3218
  });
3450
3219
  var planShape = {
3451
3220
  effort: optimizationEffortSchema.optional(),
3452
- sampleCount: z31.number().int().min(1).max(100).optional(),
3453
- maxRounds: z31.number().int().min(1).max(100).optional(),
3454
- maxTrialsPerRound: z31.number().int().min(1).max(10).optional()
3221
+ sampleCount: z30.number().int().min(1).max(100).optional(),
3222
+ maxRounds: z30.number().int().min(1).max(100).optional(),
3223
+ maxTrialsPerRound: z30.number().int().min(1).max(10).optional()
3455
3224
  };
3456
3225
  function refinePlan(value, ctx) {
3457
3226
  if (value.effort && (value.sampleCount || value.maxRounds))
@@ -3467,18 +3236,18 @@ function refinePlan(value, ctx) {
3467
3236
  message: "Pin an agent with the model"
3468
3237
  });
3469
3238
  }
3470
- var startOptimizationBodySchema = z31.object({
3239
+ var startOptimizationBodySchema = z30.object({
3471
3240
  subjectKind: climbSubjectKindSchema,
3472
- subjectId: z31.string().min(1),
3473
- name: z31.string().trim().min(1).max(200).optional(),
3241
+ subjectId: z30.string().min(1),
3242
+ name: z30.string().trim().min(1).max(200).optional(),
3474
3243
  ...planShape,
3475
- creditCap: z31.number().int().nonnegative().optional(),
3476
- targetScore: z31.number().min(0).max(1).optional(),
3244
+ creditCap: z30.number().int().nonnegative().optional(),
3245
+ targetScore: z30.number().min(0).max(1).optional(),
3477
3246
  target: targetSchema.extend({ agent: schedulableAgentSchema })
3478
3247
  }).strict().superRefine(refinePlan);
3479
- var estimateOptimizationBodySchema = z31.object({
3248
+ var estimateOptimizationBodySchema = z30.object({
3480
3249
  subjectKind: climbSubjectKindSchema,
3481
- subjectId: z31.string().min(1),
3250
+ subjectId: z30.string().min(1),
3482
3251
  ...planShape,
3483
3252
  target: targetSchema.optional()
3484
3253
  }).strict().superRefine(refinePlan);
@@ -3490,100 +3259,101 @@ var RUN_CREDIT_BASES = [
3490
3259
  "byok",
3491
3260
  "reserve"
3492
3261
  ];
3493
- var runCreditBasisSchema = z31.enum(RUN_CREDIT_BASES);
3494
- var optimizationEstimateSchema = z31.object({
3495
- sampleCount: z31.number().int(),
3496
- maxRounds: z31.number().int(),
3497
- runsPerTrial: z31.number(),
3498
- executionCredits: z31.number(),
3499
- judgeCredits: z31.number(),
3500
- leverPassCredits: z31.number(),
3501
- trialCredits: z31.number(),
3262
+ var runCreditBasisSchema = z30.enum(RUN_CREDIT_BASES);
3263
+ var optimizationEstimateSchema = z30.object({
3264
+ sampleCount: z30.number().int(),
3265
+ maxRounds: z30.number().int(),
3266
+ runsPerTrial: z30.number(),
3267
+ executionCredits: z30.number(),
3268
+ judgeCredits: z30.number(),
3269
+ leverPassCredits: z30.number(),
3270
+ trialCredits: z30.number(),
3502
3271
  /** Estimate, not a reservation or enforced spending cap. */
3503
- estimate: z31.number().int(),
3272
+ estimate: z30.number().int(),
3504
3273
  /** True when no price or history covered a model: a bound, not a forecast. */
3505
- approximate: z31.boolean().default(false),
3274
+ approximate: z30.boolean().default(false),
3506
3275
  /** Which rung priced the run, so the UI can say why a figure is what it is. */
3507
3276
  basis: runCreditBasisSchema.optional()
3508
3277
  });
3509
- var diagnoseBodySchema = z31.object({
3278
+ var diagnoseBodySchema = z30.object({
3510
3279
  subjectKind: climbSubjectKindSchema,
3511
- subjectId: z31.string().min(1)
3280
+ subjectId: z30.string().min(1)
3512
3281
  }).strict();
3513
- var diagnosisSchema = z31.object({
3514
- id: z31.string(),
3515
- status: z31.enum(["GENERATING", "READY", "FAILED"]),
3282
+ var diagnosisSchema = z30.object({
3283
+ id: z30.string(),
3284
+ status: z30.enum(["GENERATING", "READY", "FAILED"]),
3516
3285
  subjectKind: climbSubjectKindSchema,
3517
- subjectId: z31.string(),
3518
- runCount: z31.number().int(),
3519
- summary: z31.string().nullable(),
3286
+ subjectId: z30.string(),
3287
+ runCount: z30.number().int(),
3288
+ summary: z30.string().nullable(),
3520
3289
  recommendedLever: leverKindSchema.nullable(),
3521
- recommendedTarget: z31.unknown().nullable(),
3522
- clusters: z31.array(
3523
- z31.object({
3524
- title: z31.string(),
3525
- failureMode: z31.string(),
3526
- criterionIds: z31.array(z31.string()),
3527
- runIds: z31.array(z31.string()),
3290
+ recommendedTarget: z30.unknown().nullable(),
3291
+ clusters: z30.array(
3292
+ z30.object({
3293
+ title: z30.string(),
3294
+ failureMode: z30.string(),
3295
+ criterionIds: z30.array(z30.string()),
3296
+ runIds: z30.array(z30.string()),
3528
3297
  lever: leverKindSchema.nullable(),
3529
- targetRef: z31.unknown().nullable(),
3530
- confidence: z31.number()
3298
+ targetRef: z30.unknown().nullable(),
3299
+ confidence: z30.number()
3531
3300
  })
3532
3301
  ),
3533
- unsupportedLevers: z31.array(leverKindSchema).default([]),
3534
- createdAt: z31.string()
3535
- });
3536
- var trialRunSchema = z31.object({
3537
- id: z31.string(),
3538
- status: z31.string(),
3539
- passed: z31.boolean().nullable(),
3540
- criteria: z31.array(
3541
- z31.object({ name: z31.string(), passed: z31.boolean(), reasoning: z31.string() })
3302
+ unsupportedLevers: z30.array(leverKindSchema).default([]),
3303
+ createdAt: z30.string()
3304
+ });
3305
+ var trialRunSchema = z30.object({
3306
+ id: z30.string(),
3307
+ status: z30.string(),
3308
+ cliCoverage: cliCoverageSchema.nullable().optional(),
3309
+ passed: z30.boolean().nullable(),
3310
+ criteria: z30.array(
3311
+ z30.object({ name: z30.string(), passed: z30.boolean(), reasoning: z30.string() })
3542
3312
  ),
3543
- levers: z31.array(
3544
- z31.object({
3545
- lever: z31.string(),
3546
- attributed: z31.boolean(),
3547
- note: z31.string().nullable()
3313
+ levers: z30.array(
3314
+ z30.object({
3315
+ lever: z30.string(),
3316
+ attributed: z30.boolean(),
3317
+ note: z30.string().nullable()
3548
3318
  })
3549
3319
  )
3550
3320
  });
3551
- var trialSchema = z31.object({
3552
- id: z31.string(),
3553
- climbId: z31.string(),
3554
- roundNumber: z31.number().int(),
3555
- key: z31.string(),
3321
+ var trialSchema = z30.object({
3322
+ id: z30.string(),
3323
+ climbId: z30.string(),
3324
+ roundNumber: z30.number().int(),
3325
+ key: z30.string(),
3556
3326
  /** @deprecated All trials branch from the baseline. */
3557
- parentTrialId: z31.string().nullable(),
3327
+ parentTrialId: z30.string().nullable(),
3558
3328
  /** @deprecated Always the baseline key for non-baseline trials. */
3559
- parentKey: z31.string().nullable(),
3560
- title: z31.string(),
3561
- hypothesis: z31.string().nullable(),
3329
+ parentKey: z30.string().nullable(),
3330
+ title: z30.string(),
3331
+ hypothesis: z30.string().nullable(),
3562
3332
  lever: leverKindSchema.nullable(),
3563
3333
  kind: interventionKindSchema,
3564
- status: z31.enum(TRIAL_STATUSES),
3565
- verdict: z31.enum(TRIAL_VERDICTS).nullable(),
3566
- score: z31.number().nullable(),
3567
- baselineScore: z31.number().nullable(),
3334
+ status: z30.enum(TRIAL_STATUSES),
3335
+ verdict: z30.enum(TRIAL_VERDICTS).nullable(),
3336
+ score: z30.number().nullable(),
3337
+ baselineScore: z30.number().nullable(),
3568
3338
  /** Judged sessions behind `score`. */
3569
- sessions: z31.number().int(),
3570
- isBaseline: z31.boolean(),
3339
+ sessions: z30.number().int(),
3340
+ isBaseline: z30.boolean(),
3571
3341
  /** The user marked this trial as the winner; it does not move the baseline. */
3572
- adopted: z31.boolean(),
3573
- adoptedAt: z31.string().nullable(),
3574
- outcome: z31.string().nullable(),
3342
+ adopted: z30.boolean(),
3343
+ adoptedAt: z30.string().nullable(),
3344
+ outcome: z30.string().nullable(),
3575
3345
  /** The kind-specific `after` payload (skill version id, pages, package). */
3576
- after: z31.unknown(),
3577
- before: z31.unknown(),
3578
- runs: z31.array(trialRunSchema),
3579
- createdAt: z31.string()
3580
- });
3581
- var roundSchema = z31.object({
3582
- id: z31.string(),
3583
- number: z31.number().int(),
3584
- status: z31.enum(ROUND_STATUSES),
3585
- narrative: z31.string().nullable(),
3586
- trials: z31.array(trialSchema)
3346
+ after: z30.unknown(),
3347
+ before: z30.unknown(),
3348
+ runs: z30.array(trialRunSchema),
3349
+ createdAt: z30.string()
3350
+ });
3351
+ var roundSchema = z30.object({
3352
+ id: z30.string(),
3353
+ number: z30.number().int(),
3354
+ status: z30.enum(ROUND_STATUSES),
3355
+ narrative: z30.string().nullable(),
3356
+ trials: z30.array(trialSchema)
3587
3357
  });
3588
3358
  var OPTIMIZATION_NEXT_ACTIONS = [
3589
3359
  "START",
@@ -3594,375 +3364,375 @@ var OPTIMIZATION_NEXT_ACTIONS = [
3594
3364
  "RESUME",
3595
3365
  "NONE"
3596
3366
  ];
3597
- var optimizationNextActionSchema = z31.enum(OPTIMIZATION_NEXT_ACTIONS);
3367
+ var optimizationNextActionSchema = z30.enum(OPTIMIZATION_NEXT_ACTIONS);
3598
3368
  var optimizationDetailSchema = optimizationSummarySchema.extend({
3599
- baselineTrialId: z31.string().nullable(),
3369
+ baselineTrialId: z30.string().nullable(),
3600
3370
  /** The one thing a client does next. WAIT and NONE need nobody. */
3601
3371
  nextAction: optimizationNextActionSchema,
3602
- settings: z31.object({
3603
- sampleCount: z31.number().int(),
3604
- maxRounds: z31.number().int(),
3605
- maxTrialsPerRound: z31.number().int(),
3606
- creditCap: z31.number().int(),
3607
- targetScore: z31.number(),
3608
- pinnedAgent: z31.string().nullable(),
3609
- pinnedModel: z31.string().nullable(),
3610
- continuedAtRound: z31.number().int().nullable()
3372
+ settings: z30.object({
3373
+ sampleCount: z30.number().int(),
3374
+ maxRounds: z30.number().int(),
3375
+ maxTrialsPerRound: z30.number().int(),
3376
+ creditCap: z30.number().int(),
3377
+ targetScore: z30.number(),
3378
+ pinnedAgent: z30.string().nullable(),
3379
+ pinnedModel: z30.string().nullable(),
3380
+ continuedAtRound: z30.number().int().nullable()
3611
3381
  }),
3612
3382
  direction: climbDirectionSchema,
3613
- rounds: z31.array(roundSchema)
3383
+ rounds: z30.array(roundSchema)
3614
3384
  });
3615
- var listTrialsResponseSchema = z31.object({
3616
- items: z31.array(trialSchema)
3385
+ var listTrialsResponseSchema = z30.object({
3386
+ items: z30.array(trialSchema)
3617
3387
  });
3618
- var trialDocumentSchema = z31.object({
3619
- path: z31.string(),
3620
- before: z31.string(),
3621
- after: z31.string()
3388
+ var trialDocumentSchema = z30.object({
3389
+ path: z30.string(),
3390
+ before: z30.string(),
3391
+ after: z30.string()
3622
3392
  });
3623
- var trialContentSchema = z31.object({
3624
- trialId: z31.string(),
3393
+ var trialContentSchema = z30.object({
3394
+ trialId: z30.string(),
3625
3395
  kind: interventionKindSchema,
3626
- documents: z31.array(trialDocumentSchema),
3396
+ documents: z30.array(trialDocumentSchema),
3627
3397
  /** Full page bodies for a docs rewrite, ready to paste; null otherwise. */
3628
- copyableBody: z31.string().nullable(),
3629
- configSnapshot: z31.unknown()
3398
+ copyableBody: z30.string().nullable(),
3399
+ configSnapshot: z30.unknown()
3630
3400
  });
3631
- var createTrialBodySchema = z31.object({
3401
+ var createTrialBodySchema = z30.object({
3632
3402
  trial: trialInputSchema,
3633
3403
  files: overrideFilesSchema.optional(),
3634
- fork: z31.object({ runId: z31.string().min(1), boundarySeq: z31.string().min(1) }).strict().optional(),
3635
- launch: z31.boolean().default(false),
3404
+ fork: z30.object({ runId: z30.string().min(1), boundarySeq: z30.string().min(1) }).strict().optional(),
3405
+ launch: z30.boolean().default(false),
3636
3406
  /** Replays return the trial the first call created instead of a second
3637
3407
  * one. Scoped to the optimization. */
3638
- idempotencyKey: z31.string().min(1).max(200).optional()
3408
+ idempotencyKey: z30.string().min(1).max(200).optional()
3639
3409
  }).strict();
3640
- var skillFilesResponseSchema = z31.object({
3641
- versionId: z31.string(),
3410
+ var skillFilesResponseSchema = z30.object({
3411
+ versionId: z30.string(),
3642
3412
  files: overrideFilesSchema
3643
3413
  });
3644
- var pageBodyResponseSchema = z31.object({
3645
- url: z31.string(),
3646
- body: z31.string(),
3647
- contentType: z31.string().optional()
3414
+ var pageBodyResponseSchema = z30.object({
3415
+ url: z30.string(),
3416
+ body: z30.string(),
3417
+ contentType: z30.string().optional()
3648
3418
  });
3649
- var launchTrialResponseSchema = z31.object({
3650
- trialId: z31.string(),
3651
- batchIds: z31.array(z31.string()),
3652
- runIds: z31.array(z31.string())
3419
+ var launchTrialResponseSchema = z30.object({
3420
+ trialId: z30.string(),
3421
+ batchIds: z30.array(z30.string()),
3422
+ runIds: z30.array(z30.string())
3653
3423
  });
3654
- var createDraftOptimizationBodySchema = z31.object({
3424
+ var createDraftOptimizationBodySchema = z30.object({
3655
3425
  subjectKind: climbSubjectKindSchema,
3656
- subjectId: z31.string().min(1),
3657
- name: z31.string().trim().min(1).max(200).optional(),
3426
+ subjectId: z30.string().min(1),
3427
+ name: z30.string().trim().min(1).max(200).optional(),
3658
3428
  ...planShape,
3659
3429
  target: targetSchema.optional(),
3660
- autonomous: z31.boolean().optional()
3430
+ autonomous: z30.boolean().optional()
3661
3431
  }).strict().superRefine(refinePlan);
3662
3432
  var planPatchShape = {
3663
- name: z31.string().trim().min(1).max(200).optional(),
3433
+ name: z30.string().trim().min(1).max(200).optional(),
3664
3434
  ...planShape,
3665
3435
  target: targetSchema.optional()
3666
3436
  };
3667
- var optimizationPlanPatchSchema = z31.object(planPatchShape).strict().superRefine(refinePlan);
3668
- var startDraftOptimizationBodySchema = z31.object({
3437
+ var optimizationPlanPatchSchema = z30.object(planPatchShape).strict().superRefine(refinePlan);
3438
+ var startDraftOptimizationBodySchema = z30.object({
3669
3439
  ...planPatchShape,
3670
- creditCap: z31.number().int().nonnegative().optional()
3440
+ creditCap: z30.number().int().nonnegative().optional()
3671
3441
  }).strict().superRefine(refinePlan);
3672
- var setModeBodySchema = z31.object({ autonomous: z31.boolean() }).strict();
3673
- var launchRoundResponseSchema = z31.object({
3674
- roundNumber: z31.number().int().nullable(),
3675
- launched: z31.array(z31.string()),
3442
+ var setModeBodySchema = z30.object({ autonomous: z30.boolean() }).strict();
3443
+ var launchRoundResponseSchema = z30.object({
3444
+ roundNumber: z30.number().int().nullable(),
3445
+ launched: z30.array(z30.string()),
3676
3446
  /** True when nothing was left to launch: someone else got there first. */
3677
- alreadyLaunched: z31.boolean()
3447
+ alreadyLaunched: z30.boolean()
3678
3448
  });
3679
- var resolveChatResponseSchema = z31.object({
3680
- chatId: z31.string(),
3681
- href: z31.string()
3449
+ var resolveChatResponseSchema = z30.object({
3450
+ chatId: z30.string(),
3451
+ href: z30.string()
3682
3452
  });
3683
- var continueOptimizationBodySchema = z31.object({
3684
- rounds: z31.number().int().min(1).max(20).default(1),
3685
- maxTrialsPerRound: z31.number().int().min(1).max(10).optional()
3453
+ var continueOptimizationBodySchema = z30.object({
3454
+ rounds: z30.number().int().min(1).max(20).default(1),
3455
+ maxTrialsPerRound: z30.number().int().min(1).max(10).optional()
3686
3456
  }).strict();
3687
- var patchOptimizationBodySchema = z31.object({
3457
+ var patchOptimizationBodySchema = z30.object({
3688
3458
  ...planPatchShape,
3689
3459
  direction: climbDirectionPatchSchema.optional(),
3690
- autonomous: z31.boolean().optional()
3460
+ autonomous: z30.boolean().optional()
3691
3461
  }).strict().superRefine(refinePlan);
3692
3462
 
3693
3463
  // ../packages/api-schemas/src/orgs.ts
3694
- import { z as z32 } from "zod";
3695
- var createOrgRequestSchema = z32.object({
3464
+ import { z as z31 } from "zod";
3465
+ var createOrgRequestSchema = z31.object({
3696
3466
  /** Workspace display name; the slug is derived server-side. */
3697
- name: z32.string().trim().min(1).max(200),
3467
+ name: z31.string().trim().min(1).max(200),
3698
3468
  /** Optional company site (logo source; stamped onto the org). */
3699
- website: z32.string().trim().max(300).optional()
3469
+ website: z31.string().trim().max(300).optional()
3700
3470
  });
3701
- var createOrgResponseSchema = z32.object({
3702
- slug: z32.string(),
3703
- name: z32.string(),
3471
+ var createOrgResponseSchema = z31.object({
3472
+ slug: z31.string(),
3473
+ name: z31.string(),
3704
3474
  // LOCAL orgs never have a Gauge publicId.
3705
- publicId: z32.string().nullable()
3475
+ publicId: z31.string().nullable()
3706
3476
  });
3707
- var orgSettingsSchema = z32.object({
3708
- slug: z32.string(),
3709
- name: z32.string(),
3710
- publicId: z32.string().nullable(),
3711
- website: z32.string().nullable(),
3477
+ var orgSettingsSchema = z31.object({
3478
+ slug: z31.string(),
3479
+ name: z31.string(),
3480
+ publicId: z31.string().nullable(),
3481
+ website: z31.string().nullable(),
3712
3482
  /** Per-run max-spend override in USD; null = the server default. */
3713
- maxSpendUsd: z32.number().nullable(),
3714
- overageEnabled: z32.boolean(),
3483
+ maxSpendUsd: z31.number().nullable(),
3484
+ overageEnabled: z31.boolean(),
3715
3485
  /** Per-cycle overage cap in credits; null = uncapped. */
3716
- overageCapCredits: z32.number().int().nullable(),
3486
+ overageCapCredits: z31.number().int().nullable(),
3717
3487
  /** Domain claimed for same-domain auto-join; null = off. */
3718
- autoJoinDomain: z32.string().nullable()
3488
+ autoJoinDomain: z31.string().nullable()
3719
3489
  });
3720
- var orgMemberSchema = z32.object({
3721
- userId: z32.string(),
3722
- name: z32.string().nullable(),
3723
- email: z32.string().nullable(),
3724
- joinedAt: z32.string()
3490
+ var orgMemberSchema = z31.object({
3491
+ userId: z31.string(),
3492
+ name: z31.string().nullable(),
3493
+ email: z31.string().nullable(),
3494
+ joinedAt: z31.string()
3725
3495
  });
3726
- var listMembersResponseSchema = z32.object({
3727
- items: z32.array(orgMemberSchema)
3496
+ var listMembersResponseSchema = z31.object({
3497
+ items: z31.array(orgMemberSchema)
3728
3498
  });
3729
3499
 
3730
3500
  // ../packages/api-schemas/src/personas.ts
3731
- import { z as z33 } from "zod";
3732
- var personaSchema = z33.object({
3733
- id: z33.string(),
3734
- name: z33.string(),
3735
- description: z33.string(),
3501
+ import { z as z32 } from "zod";
3502
+ var personaSchema = z32.object({
3503
+ id: z32.string(),
3504
+ name: z32.string(),
3505
+ description: z32.string(),
3736
3506
  /** The judge model this persona calls (Claude only). */
3737
- model: z33.string(),
3738
- createdAt: z33.string(),
3739
- updatedAt: z33.string()
3507
+ model: z32.string(),
3508
+ createdAt: z32.string(),
3509
+ updatedAt: z32.string()
3740
3510
  });
3741
- var listPersonasResponseSchema = z33.object({
3742
- items: z33.array(personaSchema)
3511
+ var listPersonasResponseSchema = z32.object({
3512
+ items: z32.array(personaSchema)
3743
3513
  });
3744
- var createPersonaBodySchema = z33.object({
3745
- name: z33.string().min(1).max(120),
3746
- description: z33.string().min(1)
3514
+ var createPersonaBodySchema = z32.object({
3515
+ name: z32.string().min(1).max(120),
3516
+ description: z32.string().min(1)
3747
3517
  });
3748
- var updatePersonaBodySchema = z33.object({
3749
- name: z33.string().min(1).max(120).optional(),
3750
- description: z33.string().min(1).optional()
3518
+ var updatePersonaBodySchema = z32.object({
3519
+ name: z32.string().min(1).max(120).optional(),
3520
+ description: z32.string().min(1).optional()
3751
3521
  });
3752
3522
 
3753
3523
  // ../packages/api-schemas/src/prompts.ts
3754
- import { z as z36 } from "zod";
3524
+ import { z as z35 } from "zod";
3755
3525
 
3756
3526
  // ../packages/api-schemas/src/tags.ts
3757
- import { z as z34 } from "zod";
3758
- var tagSchema = z34.object({
3759
- id: z34.string(),
3760
- name: z34.string(),
3527
+ import { z as z33 } from "zod";
3528
+ var tagSchema = z33.object({
3529
+ id: z33.string(),
3530
+ name: z33.string(),
3761
3531
  /** A Mantine palette name (e.g. "blue", "grape"); unknown values are
3762
3532
  * normalized server-side to the default ("gray"). */
3763
- color: z34.string()
3533
+ color: z33.string()
3764
3534
  });
3765
- var createTagBodySchema = z34.object({
3766
- name: z34.string().min(1),
3767
- color: z34.string().optional()
3535
+ var createTagBodySchema = z33.object({
3536
+ name: z33.string().min(1),
3537
+ color: z33.string().optional()
3768
3538
  });
3769
- var updateTagBodySchema = z34.object({
3770
- name: z34.string().min(1).optional(),
3771
- color: z34.string().optional()
3539
+ var updateTagBodySchema = z33.object({
3540
+ name: z33.string().min(1).optional(),
3541
+ color: z33.string().optional()
3772
3542
  });
3773
3543
  var tagListResponseSchema = listResponseSchema(tagSchema);
3774
3544
 
3775
3545
  // ../packages/api-schemas/src/topics.ts
3776
- import { z as z35 } from "zod";
3777
- var topicSchema = z35.object({
3778
- id: z35.string(),
3779
- name: z35.string()
3546
+ import { z as z34 } from "zod";
3547
+ var topicSchema = z34.object({
3548
+ id: z34.string(),
3549
+ name: z34.string()
3780
3550
  });
3781
- var createTopicBodySchema = z35.object({
3782
- name: z35.string().min(1, "name is required")
3551
+ var createTopicBodySchema = z34.object({
3552
+ name: z34.string().min(1, "name is required")
3783
3553
  });
3784
3554
  var topicListResponseSchema = listResponseSchema(topicSchema);
3785
3555
 
3786
3556
  // ../packages/api-schemas/src/prompts.ts
3787
- var promptSummarySchema = z36.object({
3788
- id: z36.string(),
3789
- text: z36.string(),
3790
- isBranded: z36.boolean(),
3557
+ var promptSummarySchema = z35.object({
3558
+ id: z35.string(),
3559
+ text: z35.string(),
3560
+ isBranded: z35.boolean(),
3791
3561
  /** Battery-spec identity (idempotent applies); null for UI/CLI-created prompts. */
3792
- externalKey: z36.string().nullable(),
3562
+ externalKey: z35.string().nullable(),
3793
3563
  topic: topicSchema.nullable(),
3794
- tags: z36.array(tagSchema),
3795
- createdAt: z36.string()
3564
+ tags: z35.array(tagSchema),
3565
+ createdAt: z35.string()
3796
3566
  });
3797
3567
  var promptListResponseSchema = listResponseSchema(promptSummarySchema);
3798
3568
  var listPromptsQuerySchema = listQuerySchema.extend({
3799
- topic: z36.string().min(1).optional(),
3800
- tag: z36.string().min(1).optional(),
3801
- q: z36.string().min(1).optional()
3802
- });
3803
- var createPromptBodySchema = z36.object({
3804
- text: z36.string().min(1, "text is required"),
3805
- isBranded: z36.boolean().default(false),
3806
- topic: z36.string().min(1).optional(),
3807
- tags: z36.array(z36.string().min(1)).default([])
3808
- });
3809
- var updatePromptBodySchema = z36.object({
3810
- text: z36.string().min(1).optional(),
3811
- isBranded: z36.boolean().optional(),
3812
- topicId: z36.string().min(1).nullish(),
3813
- tags: z36.array(z36.string().min(1)).optional()
3814
- });
3815
- var runPromptBodySchema = z36.object({
3569
+ topic: z35.string().min(1).optional(),
3570
+ tag: z35.string().min(1).optional(),
3571
+ q: z35.string().min(1).optional()
3572
+ });
3573
+ var createPromptBodySchema = z35.object({
3574
+ text: z35.string().min(1, "text is required"),
3575
+ isBranded: z35.boolean().default(false),
3576
+ topic: z35.string().min(1).optional(),
3577
+ tags: z35.array(z35.string().min(1)).default([])
3578
+ });
3579
+ var updatePromptBodySchema = z35.object({
3580
+ text: z35.string().min(1).optional(),
3581
+ isBranded: z35.boolean().optional(),
3582
+ topicId: z35.string().min(1).nullish(),
3583
+ tags: z35.array(z35.string().min(1)).optional()
3584
+ });
3585
+ var runPromptBodySchema = z35.object({
3816
3586
  /** Preferred paired representation; each agent may pin its own model tiers. */
3817
- agentConfigs: z36.array(agentConfigInputSchema).min(1).optional(),
3587
+ agentConfigs: z35.array(agentConfigInputSchema).min(1).optional(),
3818
3588
  /** Legacy agent set (no per-agent pins), kept during the API transition. */
3819
- agents: z36.array(z36.enum(["CLAUDE_CODE", "CODEX_CLI", "CURSOR"])).min(1, "Select at least one agent").default(["CLAUDE_CODE", "CODEX_CLI"]),
3820
- repoUrl: z36.string().min(1).nullish(),
3821
- repoRef: z36.string().min(1).nullish(),
3822
- samplesPerCycle: z36.number().int().min(1).max(10).default(1),
3589
+ agents: z35.array(z35.enum(["CLAUDE_CODE", "CODEX_CLI", "CURSOR"])).min(1, "Select at least one agent").default(["CLAUDE_CODE", "CODEX_CLI"]),
3590
+ repoUrl: z35.string().min(1).nullish(),
3591
+ repoRef: z35.string().min(1).nullish(),
3592
+ samplesPerCycle: z35.number().int().min(1).max(10).default(1),
3823
3593
  webFixture: webFixtureSchema.optional()
3824
3594
  });
3825
- var runPromptResponseSchema = z36.object({
3826
- batchIds: z36.array(z36.string()),
3827
- runIds: z36.array(z36.string()),
3828
- blocked: z36.enum(["insufficient_credits", "needs_provider_key"]).optional()
3595
+ var runPromptResponseSchema = z35.object({
3596
+ batchIds: z35.array(z35.string()),
3597
+ runIds: z35.array(z35.string()),
3598
+ blocked: z35.enum(["insufficient_credits", "needs_provider_key"]).optional()
3829
3599
  });
3830
3600
 
3831
3601
  // ../packages/api-schemas/src/repos.ts
3832
- import { z as z37 } from "zod";
3602
+ import { z as z36 } from "zod";
3833
3603
  var REPO_SIZE_BUCKETS = [
3834
3604
  "small",
3835
3605
  "medium",
3836
3606
  "large",
3837
3607
  "xlarge"
3838
3608
  ];
3839
- var repoSizeBucketSchema = z37.enum(REPO_SIZE_BUCKETS);
3840
- var repoSchema = z37.object({
3841
- url: z37.string(),
3842
- name: z37.string(),
3843
- isSystem: z37.boolean(),
3844
- languages: z37.array(z37.string()),
3845
- frameworks: z37.array(z37.string()),
3609
+ var repoSizeBucketSchema = z36.enum(REPO_SIZE_BUCKETS);
3610
+ var repoSchema = z36.object({
3611
+ url: z36.string(),
3612
+ name: z36.string(),
3613
+ isSystem: z36.boolean(),
3614
+ languages: z36.array(z36.string()),
3615
+ frameworks: z36.array(z36.string()),
3846
3616
  /** Faceted labels (complexity:L2, buildable:yes, stack:nextjs, …). */
3847
- tags: z37.array(z37.string()),
3848
- primaryLanguage: z37.string(),
3849
- sizeKb: z37.number(),
3617
+ tags: z36.array(z36.string()),
3618
+ primaryLanguage: z36.string(),
3619
+ sizeKb: z36.number(),
3850
3620
  sizeBucket: repoSizeBucketSchema.nullable(),
3851
- stars: z37.number()
3621
+ stars: z36.number()
3852
3622
  });
3853
3623
  var repoListResponseSchema = listResponseSchema(repoSchema);
3854
- var addRepoBodySchema = z37.object({
3855
- url: z37.string().min(1, "url is required"),
3624
+ var addRepoBodySchema = z36.object({
3625
+ url: z36.string().min(1, "url is required"),
3856
3626
  /**
3857
3627
  * Reserved (accepted, not yet persisted): the catalog keys repos by URL only
3858
3628
  * — `fact_repo` has no ref column and metadata sync always reads the default
3859
3629
  * branch. Kept in the wire format so `gauge repos add --ref` is stable once
3860
3630
  * the catalog learns refs.
3861
3631
  */
3862
- ref: z37.string().min(1).optional(),
3632
+ ref: z36.string().min(1).optional(),
3863
3633
  /** Display name; defaults to the `owner/repo` label of the URL. */
3864
- name: z37.string().min(1).optional(),
3634
+ name: z36.string().min(1).optional(),
3865
3635
  /** Manual override; defaults to frameworks detected from the repo's manifests. */
3866
- frameworks: z37.array(z37.string()).optional(),
3867
- tags: z37.array(z37.string()).optional()
3636
+ frameworks: z36.array(z36.string()).optional(),
3637
+ tags: z36.array(z36.string()).optional()
3868
3638
  });
3869
- var updateRepoBodySchema = z37.object({
3870
- url: z37.string().min(1, "url is required"),
3871
- name: z37.string().min(1).optional(),
3872
- frameworks: z37.array(z37.string()).optional(),
3873
- tags: z37.array(z37.string()).optional()
3639
+ var updateRepoBodySchema = z36.object({
3640
+ url: z36.string().min(1, "url is required"),
3641
+ name: z36.string().min(1).optional(),
3642
+ frameworks: z36.array(z36.string()).optional(),
3643
+ tags: z36.array(z36.string()).optional()
3874
3644
  });
3875
- var resyncRepoBodySchema = z37.object({
3876
- url: z37.string().min(1, "url is required")
3645
+ var resyncRepoBodySchema = z36.object({
3646
+ url: z36.string().min(1, "url is required")
3877
3647
  });
3878
- var deleteRepoQuerySchema = z37.object({
3879
- url: z37.string().min(1, "url is required")
3648
+ var deleteRepoQuerySchema = z36.object({
3649
+ url: z36.string().min(1, "url is required")
3880
3650
  });
3881
- var repoSyncResultSchema = z37.object({
3651
+ var repoSyncResultSchema = z36.object({
3882
3652
  repo: repoSchema,
3883
- synced: z37.boolean()
3653
+ synced: z36.boolean()
3884
3654
  });
3885
3655
 
3886
3656
  // ../packages/api-schemas/src/runAddons.ts
3887
- import { z as z38 } from "zod";
3888
- var runAddonsSchema = z38.object({
3889
- browser: z38.object({
3890
- session: z38.string().min(1),
3891
- projectId: z38.number().int().positive(),
3892
- region: z38.literal("us").default("us")
3657
+ import { z as z37 } from "zod";
3658
+ var runAddonsSchema = z37.object({
3659
+ browser: z37.object({
3660
+ session: z37.string().min(1),
3661
+ projectId: z37.number().int().positive(),
3662
+ region: z37.literal("us").default("us")
3893
3663
  }).strict().optional()
3894
3664
  }).strict();
3895
3665
 
3896
3666
  // ../packages/api-schemas/src/runDefinitions.ts
3897
- import { z as z40 } from "zod";
3667
+ import { z as z39 } from "zod";
3898
3668
 
3899
3669
  // ../packages/api-schemas/src/runPlan.ts
3900
- import { z as z39 } from "zod";
3901
- var runPlanCriterionSchema = z39.object({
3902
- id: z39.string().min(1),
3903
- name: z39.string(),
3904
- rubric: z39.string()
3670
+ import { z as z38 } from "zod";
3671
+ var runPlanCriterionSchema = z38.object({
3672
+ id: z38.string().min(1),
3673
+ name: z38.string(),
3674
+ rubric: z38.string()
3905
3675
  });
3906
- var criteriaSnapshotV1Schema = z39.object({
3907
- version: z39.literal(1),
3676
+ var criteriaSnapshotV1Schema = z38.object({
3677
+ version: z38.literal(1),
3908
3678
  // File-authored criteria have no saved EvalSet; their identity is frozen
3909
3679
  // in the request and result rows retain the criterion text without an FK.
3910
- evalSetId: z39.string().min(1).nullable(),
3911
- criteria: z39.array(runPlanCriterionSchema)
3912
- });
3913
- var runPlanCaseSchema = z39.object({
3914
- id: z39.string().min(1),
3915
- prompt: z39.object({ id: z39.string().min(1), text: z39.string() }),
3916
- workspace: z39.object({
3917
- repoUrl: z39.string().nullable(),
3918
- repoRef: z39.string().nullable()
3680
+ evalSetId: z38.string().min(1).nullable(),
3681
+ criteria: z38.array(runPlanCriterionSchema)
3682
+ });
3683
+ var runPlanCaseSchema = z38.object({
3684
+ id: z38.string().min(1),
3685
+ prompt: z38.object({ id: z38.string().min(1), text: z38.string() }),
3686
+ workspace: z38.object({
3687
+ repoUrl: z38.string().nullable(),
3688
+ repoRef: z38.string().nullable()
3919
3689
  }),
3920
- agents: z39.array(
3690
+ agents: z38.array(
3921
3691
  agentConfigSchema.extend({
3922
3692
  // Validated against the current catalog request schema when lowered.
3923
- catalogSelections: z39.record(z39.string(), z39.unknown()).optional()
3693
+ catalogSelections: z38.record(z38.string(), z38.unknown()).optional()
3924
3694
  })
3925
3695
  ),
3926
- samples: z39.number().int().min(1).max(50),
3927
- evalSetId: z39.string().min(1).optional(),
3696
+ samples: z38.number().int().min(1).max(50),
3697
+ evalSetId: z38.string().min(1).optional(),
3928
3698
  criteriaSnapshot: criteriaSnapshotV1Schema.optional(),
3929
- sourceRepoCommit: z39.string().nullable().optional(),
3930
- experiment: z39.string().nullable().optional(),
3931
- membershipTagIds: z39.array(z39.string()).optional(),
3932
- profile: z39.object({
3933
- id: z39.string(),
3934
- name: z39.string(),
3935
- description: z39.string(),
3936
- model: z39.string()
3699
+ sourceRepoCommit: z38.string().nullable().optional(),
3700
+ experiment: z38.string().nullable().optional(),
3701
+ membershipTagIds: z38.array(z38.string()).optional(),
3702
+ profile: z38.object({
3703
+ id: z38.string(),
3704
+ name: z38.string(),
3705
+ description: z38.string(),
3706
+ model: z38.string()
3937
3707
  }).nullable().optional(),
3938
3708
  skillSet: skillSetSchema.optional(),
3939
3709
  mcpSet: mcpSetSchema.optional(),
3940
3710
  connectionSet: connectionSetSchema.optional(),
3941
3711
  // The server's agentContextSnapshotV1Schema validates this at lowering.
3942
- agentContext: z39.unknown().optional(),
3943
- agentContextDigest: z39.string().nullable().optional(),
3712
+ agentContext: z38.unknown().optional(),
3713
+ agentContextDigest: z38.string().nullable().optional(),
3944
3714
  addons: runAddonsSchema.optional(),
3945
3715
  /** Names of resources the coordinator must prepare before expansion. */
3946
- inputs: z39.array(z39.string().min(1)).default([])
3947
- });
3948
- var builtDirectoryResourceSchema = z39.object({
3949
- name: z39.string().min(1),
3950
- type: z39.literal("built-directory"),
3951
- source: z39.object({
3952
- type: z39.literal("git-checkout"),
3953
- repoUrl: z39.string().min(1),
3954
- commit: z39.string().regex(/^[a-f0-9]{40}$/i)
3716
+ inputs: z38.array(z38.string().min(1)).default([])
3717
+ });
3718
+ var builtDirectoryResourceSchema = z38.object({
3719
+ name: z38.string().min(1),
3720
+ type: z38.literal("built-directory"),
3721
+ source: z38.object({
3722
+ type: z38.literal("git-checkout"),
3723
+ repoUrl: z38.string().min(1),
3724
+ commit: z38.string().regex(/^[a-f0-9]{40}$/i)
3955
3725
  }),
3956
- build: z39.object({
3957
- runtime: z39.literal("node-24"),
3958
- run: z39.string().min(1),
3959
- output: z39.string().min(1),
3726
+ build: z38.object({
3727
+ runtime: z38.literal("node-24"),
3728
+ run: z38.string().min(1),
3729
+ output: z38.string().min(1),
3960
3730
  /** Declared command name plus args, invoked from a clean cwd before a session. */
3961
- smoke: z39.array(z39.string().min(1)).min(1)
3731
+ smoke: z38.array(z38.string().min(1)).min(1)
3962
3732
  }),
3963
- expose: z39.object({
3964
- type: z39.literal("command"),
3965
- commands: z39.record(z39.string().min(1), z39.array(z39.string().min(1)).min(1))
3733
+ expose: z38.object({
3734
+ type: z38.literal("command"),
3735
+ commands: z38.record(z38.string().min(1), z38.array(z38.string().min(1)).min(1))
3966
3736
  })
3967
3737
  }).superRefine((resource, ctx) => {
3968
3738
  if (!(resource.build.smoke[0] in resource.expose.commands))
@@ -3972,24 +3742,24 @@ var builtDirectoryResourceSchema = z39.object({
3972
3742
  message: "Smoke command must name an exposed command"
3973
3743
  });
3974
3744
  });
3975
- var bundleRelativeScriptSchema = z39.string().min(1).refine(
3745
+ var bundleRelativeScriptSchema = z38.string().min(1).refine(
3976
3746
  (path2) => !path2.startsWith("/") && !path2.includes("\\") && !path2.includes("\0") && !path2.split("/").includes("..") && path2.split("/").some((part) => part !== "" && part !== "."),
3977
3747
  "Install script must be a bundle-relative path without traversal"
3978
3748
  );
3979
- var preparedDirectoryPrepareSchema = z39.union([
3980
- z39.object({ run: z39.string().min(1) }).strict(),
3981
- z39.object({
3982
- type: z39.literal("npm-cli"),
3983
- build: z39.string().min(1).optional()
3749
+ var preparedDirectoryPrepareSchema = z38.union([
3750
+ z38.object({ run: z38.string().min(1) }).strict(),
3751
+ z38.object({
3752
+ type: z38.literal("npm-cli"),
3753
+ build: z38.string().min(1).optional()
3984
3754
  }).strict()
3985
3755
  ]);
3986
- var preparedDirectoryResourceSchema = z39.object({
3987
- name: z39.string().min(1),
3988
- type: z39.literal("prepared-directory"),
3989
- source: z39.object({
3990
- type: z39.literal("git-checkout"),
3991
- repoUrl: z39.string().min(1),
3992
- commit: z39.string().regex(/^[a-f0-9]{40}$/i)
3756
+ var preparedDirectoryResourceSchema = z38.object({
3757
+ name: z38.string().min(1),
3758
+ type: z38.literal("prepared-directory"),
3759
+ source: z38.object({
3760
+ type: z38.literal("git-checkout"),
3761
+ repoUrl: z38.string().min(1),
3762
+ commit: z38.string().regex(/^[a-f0-9]{40}$/i)
3993
3763
  }).strict(),
3994
3764
  prepare: preparedDirectoryPrepareSchema,
3995
3765
  install: bundleRelativeScriptSchema.optional()
@@ -4001,39 +3771,46 @@ var preparedDirectoryResourceSchema = z39.object({
4001
3771
  message: "npm-cli products cannot declare an install script"
4002
3772
  });
4003
3773
  });
4004
- var runPlanResourceSchema = z39.union([
3774
+ var runPlanResourceSchema = z38.union([
4005
3775
  builtDirectoryResourceSchema,
4006
3776
  preparedDirectoryResourceSchema
4007
3777
  ]);
4008
- var runPlanSchema = z39.object({
4009
- version: z39.literal(1),
3778
+ var runPlanSchema = z38.object({
3779
+ version: z38.literal(1),
4010
3780
  /** Existing launches keep their current measurement semantics. */
4011
- measurementMode: z39.enum(["EXISTING", "AGENT_EXPERIENCE"]),
4012
- cases: z39.array(runPlanCaseSchema).min(1),
4013
- resources: z39.array(runPlanResourceSchema).default([]),
3781
+ measurementMode: z38.enum(["EXISTING", "AGENT_EXPERIENCE"]),
3782
+ cases: z38.array(runPlanCaseSchema).min(1),
3783
+ resources: z38.array(runPlanResourceSchema).default([]),
4014
3784
  /** Server-populated context retained across deferred preparation. */
4015
- launch: z39.object({
4016
- origin: z39.object({
4017
- initiator: z39.literal("API"),
4018
- userId: z39.string().min(1),
4019
- email: z39.string().nullable()
4020
- }).strict(),
4021
- funding: z39.enum(["ORG", "PLATFORM"]),
4022
- queueClass: z39.literal("INTERACTIVE")
3785
+ launch: z38.object({
3786
+ origin: z38.discriminatedUnion("initiator", [
3787
+ z38.object({
3788
+ initiator: z38.literal("API"),
3789
+ userId: z38.string().min(1),
3790
+ email: z38.string().nullable()
3791
+ }).strict(),
3792
+ z38.object({
3793
+ initiator: z38.literal("GITHUB"),
3794
+ userId: z38.null(),
3795
+ email: z38.null()
3796
+ }).strict()
3797
+ ]),
3798
+ funding: z38.enum(["ORG", "PLATFORM"]),
3799
+ queueClass: z38.literal("INTERACTIVE")
4023
3800
  }).strict().optional(),
4024
- provenance: z39.object({
4025
- definition: z39.object({
4026
- repoUrl: z39.string().min(1),
4027
- commit: z39.string().regex(/^[a-f0-9]{40}$/i),
4028
- digest: z39.string().min(1),
3801
+ provenance: z38.object({
3802
+ definition: z38.object({
3803
+ repoUrl: z38.string().min(1),
3804
+ commit: z38.string().regex(/^[a-f0-9]{40}$/i),
3805
+ digest: z38.string().min(1),
4029
3806
  /** File submissions are asserted by the caller until server-side
4030
3807
  * committed-byte fetching is available. */
4031
- verification: z39.literal("SUBMITTED_UNVERIFIED").optional()
3808
+ verification: z38.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED"]).optional()
4032
3809
  }).optional(),
4033
- liveDependencies: z39.array(
4034
- z39.object({
4035
- name: z39.string().min(1),
4036
- url: z39.string().url().optional()
3810
+ liveDependencies: z38.array(
3811
+ z38.object({
3812
+ name: z38.string().min(1),
3813
+ url: z38.string().url().optional()
4037
3814
  })
4038
3815
  ).default([])
4039
3816
  })
@@ -4084,7 +3861,7 @@ var runPlanSchema = z39.object({
4084
3861
  });
4085
3862
 
4086
3863
  // ../packages/api-schemas/src/runDefinitions.ts
4087
- var uncredentialedRepoUrlSchema = z40.string().min(1).refine((raw) => {
3864
+ var uncredentialedRepoUrlSchema = z39.string().min(1).refine((raw) => {
4088
3865
  if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(raw)) return true;
4089
3866
  try {
4090
3867
  const url = new URL(raw);
@@ -4093,36 +3870,36 @@ var uncredentialedRepoUrlSchema = z40.string().min(1).refine((raw) => {
4093
3870
  return false;
4094
3871
  }
4095
3872
  }, "Repository URL must not contain embedded credentials or query parameters");
4096
- var runDefinitionConfigSchema = z40.object({
4097
- agents: z40.array(agentConfigInputSchema).min(1),
4098
- sampleCount: z40.number().int().min(1).max(50).optional(),
3873
+ var runDefinitionConfigSchema = z39.object({
3874
+ agents: z39.array(agentConfigInputSchema).min(1),
3875
+ sampleCount: z39.number().int().min(1).max(50).optional(),
4099
3876
  repoUrl: uncredentialedRepoUrlSchema.nullable().optional(),
4100
- repoRef: z40.string().min(1).nullable().optional(),
4101
- profileId: z40.string().min(1).nullable().optional(),
3877
+ repoRef: z39.string().min(1).nullable().optional(),
3878
+ profileId: z39.string().min(1).nullable().optional(),
4102
3879
  skillRefs: assetRefListSchema.optional(),
4103
3880
  mcpRefs: assetRefListSchema.optional(),
4104
- connectionIds: z40.array(z40.string().min(1)).max(32).optional(),
3881
+ connectionIds: z39.array(z39.string().min(1)).max(32).optional(),
4105
3882
  addons: runAddonsSchema.optional()
4106
3883
  }).strict();
4107
- var githubCasePathSchema = z40.string().regex(
3884
+ var githubCasePathSchema = z39.string().regex(
4108
3885
  /^evals\/[A-Za-z0-9_./-]+\.md$/,
4109
3886
  "Expected an explicit evals/*.md path"
4110
3887
  ).refine(
4111
3888
  (path2) => path2.split("/").every((part) => part !== "" && part !== "." && part !== ".."),
4112
3889
  "Case path must not contain traversal or empty segments"
4113
3890
  );
4114
- var runDefinitionFileConfigSchema = z40.object({
4115
- version: z40.literal(1).default(1),
4116
- org: z40.string().min(1).optional(),
4117
- product: z40.object({
4118
- type: z40.literal("npm-cli"),
4119
- build: z40.string().min(1).optional()
3891
+ var runDefinitionFileConfigSchema = z39.object({
3892
+ version: z39.literal(1).default(1),
3893
+ org: z39.string().min(1).optional(),
3894
+ product: z39.object({
3895
+ type: z39.literal("npm-cli"),
3896
+ build: z39.string().min(1).optional()
4120
3897
  }).strict().optional(),
4121
- prepare: z40.string().min(1).optional(),
3898
+ prepare: z39.string().min(1).optional(),
4122
3899
  install: bundleRelativeScriptSchema.optional(),
4123
- github: z40.object({
4124
- enabled: z40.literal(true),
4125
- files: z40.array(githubCasePathSchema).min(1).max(20).refine(
3900
+ github: z39.object({
3901
+ enabled: z39.literal(true),
3902
+ files: z39.array(githubCasePathSchema).min(1).max(20).refine(
4126
3903
  (paths) => new Set(paths).size === paths.length,
4127
3904
  "Case paths must be unique"
4128
3905
  )
@@ -4141,27 +3918,27 @@ var runDefinitionFileConfigSchema = z40.object({
4141
3918
  message: "npm-cli products cannot declare an install script"
4142
3919
  });
4143
3920
  });
4144
- var runDefinitionCriterionSchema = z40.object({ name: z40.string().min(1), rubric: z40.string().min(1) }).strict();
4145
- var runDefinitionFrontmatterSchema = z40.object({
4146
- criteria: z40.array(runDefinitionCriterionSchema).min(1),
3921
+ var runDefinitionCriterionSchema = z39.object({ name: z39.string().min(1), rubric: z39.string().min(1) }).strict();
3922
+ var runDefinitionFrontmatterSchema = z39.object({
3923
+ criteria: z39.array(runDefinitionCriterionSchema).min(1),
4147
3924
  config: runDefinitionConfigSchema
4148
3925
  }).strict();
4149
- var runDefinitionCaseSchema = z40.object({
4150
- path: z40.string().min(1),
4151
- prompt: z40.string().min(1),
4152
- criteria: z40.array(runDefinitionCriterionSchema).min(1),
3926
+ var runDefinitionCaseSchema = z39.object({
3927
+ path: z39.string().min(1),
3928
+ prompt: z39.string().min(1),
3929
+ criteria: z39.array(runDefinitionCriterionSchema).min(1),
4153
3930
  config: runDefinitionConfigSchema
4154
3931
  }).strict();
4155
- var runDefinitionSubmissionSchema = z40.object({
4156
- version: z40.literal(1),
4157
- source: z40.object({
3932
+ var runDefinitionSubmissionSchema = z39.object({
3933
+ version: z39.literal(1),
3934
+ source: z39.object({
4158
3935
  repoUrl: uncredentialedRepoUrlSchema,
4159
- commit: z40.string().regex(/^[a-f0-9]{40}$/i),
4160
- digest: z40.string().regex(/^sha256:[a-f0-9]{64}$/),
4161
- verification: z40.literal("SUBMITTED_UNVERIFIED")
3936
+ commit: z39.string().regex(/^[a-f0-9]{40}$/i),
3937
+ digest: z39.string().regex(/^sha256:[a-f0-9]{64}$/),
3938
+ verification: z39.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED"])
4162
3939
  }).strict(),
4163
- resources: z40.array(preparedDirectoryResourceSchema).max(1).default([]),
4164
- cases: z40.array(runDefinitionCaseSchema).min(1)
3940
+ resources: z39.array(preparedDirectoryResourceSchema).max(1).default([]),
3941
+ cases: z39.array(runDefinitionCaseSchema).min(1)
4165
3942
  }).strict().superRefine((definition, ctx) => {
4166
3943
  const paths = /* @__PURE__ */ new Set();
4167
3944
  for (const [index, item] of definition.cases.entries()) {
@@ -4200,41 +3977,48 @@ var runDefinitionSubmissionSchema = z40.object({
4200
3977
  });
4201
3978
  }
4202
3979
  });
4203
- var runDefinitionPlanResponseSchema = z40.object({
3980
+ var runDefinitionPublicSubmissionSchema = runDefinitionSubmissionSchema.refine(
3981
+ (definition) => definition.source.verification === "SUBMITTED_UNVERIFIED",
3982
+ {
3983
+ path: ["source", "verification"],
3984
+ message: "Only the GitHub App may verify committed bytes"
3985
+ }
3986
+ );
3987
+ var runDefinitionPlanResponseSchema = z39.object({
4204
3988
  source: runDefinitionSubmissionSchema.shape.source,
4205
- measurementMode: z40.literal("AGENT_EXPERIENCE"),
4206
- cases: z40.array(
4207
- z40.object({
4208
- path: z40.string(),
4209
- agents: z40.array(agentConfigSchema),
4210
- samples: z40.number().int().nonnegative(),
4211
- expectedRuns: z40.number().int().nonnegative(),
4212
- workspace: z40.object({
4213
- repoUrl: z40.string().nullable(),
4214
- repoRef: z40.string().nullable()
3989
+ measurementMode: z39.literal("AGENT_EXPERIENCE"),
3990
+ cases: z39.array(
3991
+ z39.object({
3992
+ path: z39.string(),
3993
+ agents: z39.array(agentConfigSchema),
3994
+ samples: z39.number().int().nonnegative(),
3995
+ expectedRuns: z39.number().int().nonnegative(),
3996
+ workspace: z39.object({
3997
+ repoUrl: z39.string().nullable(),
3998
+ repoRef: z39.string().nullable()
4215
3999
  }),
4216
- criteriaCount: z40.number().int().nonnegative(),
4217
- inputs: z40.array(z40.string())
4000
+ criteriaCount: z39.number().int().nonnegative(),
4001
+ inputs: z39.array(z39.string())
4218
4002
  })
4219
4003
  ),
4220
- resources: z40.array(
4221
- z40.object({ name: z40.string(), type: z40.literal("prepared-directory") })
4004
+ resources: z39.array(
4005
+ z39.object({ name: z39.string(), type: z39.literal("prepared-directory") })
4222
4006
  ),
4223
- expectedRuns: z40.number().int().nonnegative(),
4224
- canRun: z40.boolean()
4007
+ expectedRuns: z39.number().int().nonnegative(),
4008
+ canRun: z39.boolean()
4225
4009
  });
4226
- var runDefinitionRunResponseSchema = z40.object({
4227
- runRequestId: z40.string(),
4228
- batchIds: z40.array(z40.string()),
4229
- runIds: z40.array(z40.string()),
4230
- requestedRuns: z40.number().int().nonnegative(),
4231
- createdRuns: z40.number().int().nonnegative(),
4232
- aggregateUrl: z40.string()
4010
+ var runDefinitionRunResponseSchema = z39.object({
4011
+ runRequestId: z39.string(),
4012
+ batchIds: z39.array(z39.string()),
4013
+ runIds: z39.array(z39.string()),
4014
+ requestedRuns: z39.number().int().nonnegative(),
4015
+ createdRuns: z39.number().int().nonnegative(),
4016
+ aggregateUrl: z39.string()
4233
4017
  });
4234
4018
 
4235
4019
  // ../packages/api-schemas/src/runRequests.ts
4236
- import { z as z41 } from "zod";
4237
- var runRequestStatusSchema = z41.enum([
4020
+ import { z as z40 } from "zod";
4021
+ var runRequestStatusSchema = z40.enum([
4238
4022
  "PENDING",
4239
4023
  "PREPARING",
4240
4024
  "RUNNING",
@@ -4242,7 +4026,7 @@ var runRequestStatusSchema = z41.enum([
4242
4026
  "FAILED",
4243
4027
  "CANCELED"
4244
4028
  ]);
4245
- var runRequestResultSchema = z41.enum([
4029
+ var runRequestResultSchema = z40.enum([
4246
4030
  "PENDING",
4247
4031
  "PASSED",
4248
4032
  "QUALITY_FAILED",
@@ -4252,222 +4036,222 @@ var runRequestResultSchema = z41.enum([
4252
4036
  "INCOMPLETE",
4253
4037
  "CANCELED"
4254
4038
  ]);
4255
- var runRequestCriterionResultSchema = z41.object({
4256
- criterionId: z41.string().nullable(),
4257
- name: z41.string(),
4258
- passed: z41.boolean(),
4259
- reasoning: z41.string().nullable()
4260
- });
4261
- var runRequestRunSchema = z41.object({
4262
- id: z41.string(),
4263
- batchId: z41.string(),
4264
- status: z41.string(),
4039
+ var runRequestCriterionResultSchema = z40.object({
4040
+ criterionId: z40.string().nullable(),
4041
+ name: z40.string(),
4042
+ passed: z40.boolean(),
4043
+ reasoning: z40.string().nullable()
4044
+ });
4045
+ var runRequestRunSchema = z40.object({
4046
+ id: z40.string(),
4047
+ batchId: z40.string(),
4048
+ status: z40.string(),
4265
4049
  agent: agentSchema,
4266
- model: z41.string(),
4050
+ model: z40.string(),
4267
4051
  result: runRequestResultSchema,
4268
- judge: z41.object({ status: z41.string() }).nullable(),
4269
- criterionResults: z41.array(runRequestCriterionResultSchema)
4052
+ judge: z40.object({ status: z40.string() }).nullable(),
4053
+ criterionResults: z40.array(runRequestCriterionResultSchema)
4270
4054
  });
4271
- var runRequestResponseSchema = z41.object({
4272
- id: z41.string(),
4055
+ var runRequestResponseSchema = z40.object({
4056
+ id: z40.string(),
4273
4057
  status: runRequestStatusSchema,
4274
4058
  result: runRequestResultSchema,
4275
- settled: z41.boolean(),
4276
- counts: z41.object({
4277
- requestedRuns: z41.number().int().nonnegative(),
4278
- createdRuns: z41.number().int().nonnegative(),
4279
- terminalRuns: z41.number().int().nonnegative(),
4280
- judgedRuns: z41.number().int().nonnegative(),
4281
- passedRuns: z41.number().int().nonnegative(),
4282
- qualityFailedRuns: z41.number().int().nonnegative(),
4283
- executionFailedRuns: z41.number().int().nonnegative(),
4284
- judgeFailedRuns: z41.number().int().nonnegative(),
4285
- pendingRuns: z41.number().int().nonnegative()
4059
+ settled: z40.boolean(),
4060
+ counts: z40.object({
4061
+ requestedRuns: z40.number().int().nonnegative(),
4062
+ createdRuns: z40.number().int().nonnegative(),
4063
+ terminalRuns: z40.number().int().nonnegative(),
4064
+ judgedRuns: z40.number().int().nonnegative(),
4065
+ passedRuns: z40.number().int().nonnegative(),
4066
+ qualityFailedRuns: z40.number().int().nonnegative(),
4067
+ executionFailedRuns: z40.number().int().nonnegative(),
4068
+ judgeFailedRuns: z40.number().int().nonnegative(),
4069
+ pendingRuns: z40.number().int().nonnegative()
4286
4070
  }),
4287
- batches: z41.array(
4288
- z41.object({ id: z41.string(), runs: z41.array(runRequestRunSchema) })
4071
+ batches: z40.array(
4072
+ z40.object({ id: z40.string(), runs: z40.array(runRequestRunSchema) })
4289
4073
  ),
4290
- createdAt: z41.string(),
4291
- updatedAt: z41.string(),
4292
- finishedAt: z41.string().nullable()
4074
+ createdAt: z40.string(),
4075
+ updatedAt: z40.string(),
4076
+ finishedAt: z40.string().nullable()
4293
4077
  });
4294
4078
 
4295
4079
  // ../packages/api-schemas/src/summary.ts
4296
- import { z as z42 } from "zod";
4080
+ import { z as z41 } from "zod";
4297
4081
  function cardResultSchema(data) {
4298
- return z42.union([
4299
- z42.object({ ok: z42.literal(true), data }),
4300
- z42.object({ ok: z42.literal(false), error: z42.string() })
4082
+ return z41.union([
4083
+ z41.object({ ok: z41.literal(true), data }),
4084
+ z41.object({ ok: z41.literal(false), error: z41.string() })
4301
4085
  ]);
4302
4086
  }
4303
- var summaryActionSchema = z42.object({
4304
- id: z42.string(),
4305
- title: z42.string(),
4306
- priority: z42.string(),
4307
- status: z42.string(),
4308
- evidenceCount: z42.number().int()
4087
+ var summaryActionSchema = z41.object({
4088
+ id: z41.string(),
4089
+ title: z41.string(),
4090
+ priority: z41.string(),
4091
+ status: z41.string(),
4092
+ evidenceCount: z41.number().int()
4309
4093
  });
4310
- var summaryAeCardSchema = z42.object({
4311
- id: z42.string(),
4312
- name: z42.string(),
4313
- judgedRuns: z42.number().int(),
4314
- passRate: z42.number().nullable(),
4094
+ var summaryAeCardSchema = z41.object({
4095
+ id: z41.string(),
4096
+ name: z41.string(),
4097
+ judgedRuns: z41.number().int(),
4098
+ passRate: z41.number().nullable(),
4315
4099
  /** pp delta vs the prior 30d; null with no prior. */
4316
- deltaPP: z42.number().nullable()
4100
+ deltaPP: z41.number().nullable()
4317
4101
  });
4318
- var summaryVisibilityCardSchema = z42.object({
4319
- name: z42.string(),
4320
- owned: z42.object({
4321
- name: z42.string(),
4322
- rank: z42.number(),
4323
- chosenRate: z42.number(),
4324
- mentionRate: z42.number()
4102
+ var summaryVisibilityCardSchema = z41.object({
4103
+ name: z41.string(),
4104
+ owned: z41.object({
4105
+ name: z41.string(),
4106
+ rank: z41.number(),
4107
+ chosenRate: z41.number(),
4108
+ mentionRate: z41.number()
4325
4109
  }).nullable(),
4326
- chosenDeltaPP: z42.number().nullable()
4110
+ chosenDeltaPP: z41.number().nullable()
4327
4111
  });
4328
- var homeSummarySchema = z42.object({
4329
- hasAnyRuns: z42.boolean(),
4330
- lastSynthesisAt: z42.string().nullable(),
4331
- actions: cardResultSchema(z42.array(summaryActionSchema)),
4112
+ var homeSummarySchema = z41.object({
4113
+ hasAnyRuns: z41.boolean(),
4114
+ lastSynthesisAt: z41.string().nullable(),
4115
+ actions: cardResultSchema(z41.array(summaryActionSchema)),
4332
4116
  visibility: cardResultSchema(
4333
- z42.object({
4334
- cards: z42.array(summaryVisibilityCardSchema),
4335
- marketsTotal: z42.number().int(),
4336
- promptCount: z42.number().int()
4117
+ z41.object({
4118
+ cards: z41.array(summaryVisibilityCardSchema),
4119
+ marketsTotal: z41.number().int(),
4120
+ promptCount: z41.number().int()
4337
4121
  })
4338
4122
  ),
4339
4123
  agentExperience: cardResultSchema(
4340
- z42.object({
4341
- cards: z42.array(summaryAeCardSchema),
4342
- total: z42.number().int(),
4343
- setCount: z42.number().int()
4124
+ z41.object({
4125
+ cards: z41.array(summaryAeCardSchema),
4126
+ total: z41.number().int(),
4127
+ setCount: z41.number().int()
4344
4128
  })
4345
4129
  ),
4346
- notableSessions: cardResultSchema(z42.array(z42.unknown()))
4130
+ notableSessions: cardResultSchema(z41.array(z41.unknown()))
4347
4131
  });
4348
4132
 
4349
4133
  // ../packages/api-schemas/src/tokens.ts
4350
- import { z as z43 } from "zod";
4351
- var apiTokenSchema = z43.object({
4352
- id: z43.string(),
4353
- name: z43.string(),
4134
+ import { z as z42 } from "zod";
4135
+ var apiTokenSchema = z42.object({
4136
+ id: z42.string(),
4137
+ name: z42.string(),
4354
4138
  /** Last 4 chars of the plaintext, for recognizability (non-secret). */
4355
- last4: z43.string(),
4356
- expiresAt: z43.iso.datetime().nullable(),
4357
- lastUsedAt: z43.iso.datetime().nullable(),
4358
- createdAt: z43.iso.datetime(),
4359
- revokedAt: z43.iso.datetime().nullable()
4360
- });
4361
- var createTokenRequestSchema = z43.object({
4362
- name: z43.string().min(1).max(100),
4139
+ last4: z42.string(),
4140
+ expiresAt: z42.iso.datetime().nullable(),
4141
+ lastUsedAt: z42.iso.datetime().nullable(),
4142
+ createdAt: z42.iso.datetime(),
4143
+ revokedAt: z42.iso.datetime().nullable()
4144
+ });
4145
+ var createTokenRequestSchema = z42.object({
4146
+ name: z42.string().min(1).max(100),
4363
4147
  /** ISO-8601 datetime; omit for no expiry. */
4364
- expiresAt: z43.iso.datetime({ offset: true }).optional()
4148
+ expiresAt: z42.iso.datetime({ offset: true }).optional()
4365
4149
  });
4366
4150
  var createTokenResponseSchema = apiTokenSchema.extend({
4367
- token: z43.string()
4151
+ token: z42.string()
4368
4152
  });
4369
4153
  var listTokensResponseSchema = listResponseSchema(apiTokenSchema);
4370
4154
 
4371
4155
  // ../packages/api-schemas/src/visibility.ts
4372
- import { z as z44 } from "zod";
4156
+ import { z as z43 } from "zod";
4373
4157
  var VISIBILITY_PROMPT_KINDS = ["HEAD_TO_HEAD", "RECOMMEND"];
4374
- var visibilityPromptKindSchema = z44.enum(VISIBILITY_PROMPT_KINDS);
4158
+ var visibilityPromptKindSchema = z43.enum(VISIBILITY_PROMPT_KINDS);
4375
4159
  var visibilityPromptSchema = visibilityPromptSettingsSchema.extend({
4376
- id: z44.string(),
4377
- name: z44.string(),
4160
+ id: z43.string(),
4161
+ name: z43.string(),
4378
4162
  kind: visibilityPromptKindSchema,
4379
- promptText: z44.string(),
4163
+ promptText: z43.string(),
4380
4164
  /** HEAD_TO_HEAD is always branded; RECOMMEND may be either. */
4381
- branded: z44.boolean(),
4382
- brandA: z44.string().nullable(),
4383
- brandB: z44.string().nullable(),
4384
- market: z44.object({ id: z44.string(), slug: z44.string(), name: z44.string() }).nullable(),
4385
- position: z44.number().int(),
4386
- createdAt: z44.string(),
4165
+ branded: z43.boolean(),
4166
+ brandA: z43.string().nullable(),
4167
+ brandB: z43.string().nullable(),
4168
+ market: z43.object({ id: z43.string(), slug: z43.string(), name: z43.string() }).nullable(),
4169
+ position: z43.number().int(),
4170
+ createdAt: z43.string(),
4387
4171
  /** User tag names on the hidden backing prompt (Surface:* excluded). */
4388
- tags: z44.array(z44.string()),
4389
- runCount: z44.number().int(),
4390
- lastRunAt: z44.string().nullable(),
4391
- scenarios: z44.array(visibilityScenarioSchema)
4172
+ tags: z43.array(z43.string()),
4173
+ runCount: z43.number().int(),
4174
+ lastRunAt: z43.string().nullable(),
4175
+ scenarios: z43.array(visibilityScenarioSchema)
4392
4176
  });
4393
- var listVisibilityPromptsResponseSchema = z44.object({
4394
- items: z44.array(visibilityPromptSchema)
4177
+ var listVisibilityPromptsResponseSchema = z43.object({
4178
+ items: z43.array(visibilityPromptSchema)
4395
4179
  });
4396
- var createVisibilityPromptBodySchema = z44.object({
4397
- name: z44.string().min(1),
4398
- promptText: z44.string().min(1),
4180
+ var createVisibilityPromptBodySchema = z43.object({
4181
+ name: z43.string().min(1),
4182
+ promptText: z43.string().min(1),
4399
4183
  kind: visibilityPromptKindSchema,
4400
- branded: z44.boolean().optional(),
4184
+ branded: z43.boolean().optional(),
4401
4185
  /** Required pair for HEAD_TO_HEAD (order-independent). */
4402
- brandA: z44.string().nullish(),
4403
- brandB: z44.string().nullish(),
4186
+ brandA: z43.string().nullish(),
4187
+ brandB: z43.string().nullish(),
4404
4188
  /** Measured market id from the org's tracked set. */
4405
- marketId: z44.string().nullish(),
4406
- tags: z44.array(z44.string()).optional(),
4189
+ marketId: z43.string().nullish(),
4190
+ tags: z43.array(z43.string()).optional(),
4407
4191
  agents: visibilityPromptSettingsInputShape.agents.optional(),
4408
4192
  skillRefs: visibilityPromptSettingsInputShape.skillRefs,
4409
4193
  mcpRefs: visibilityPromptSettingsInputShape.mcpRefs,
4410
4194
  connectionIds: visibilityPromptSettingsInputShape.connectionIds,
4411
4195
  cadence: visibilityPromptSettingsInputShape.cadence,
4412
4196
  sampleCount: visibilityPromptSettingsInputShape.sampleCount,
4413
- scenarios: z44.array(visibilityScenarioInputSchema).optional().default([])
4197
+ scenarios: z43.array(visibilityScenarioInputSchema).optional().default([])
4414
4198
  }).strict();
4415
- var synthesizeResponseSchema = z44.object({
4199
+ var synthesizeResponseSchema = z43.object({
4416
4200
  /** False when the pre-check found no new evidence and nothing was queued. */
4417
- queued: z44.boolean()
4418
- });
4419
- var updateVisibilityPromptBodySchema = z44.object({
4420
- name: z44.string().min(1).optional(),
4421
- promptText: z44.string().min(1).optional(),
4422
- branded: z44.boolean().optional(),
4423
- brandA: z44.string().nullish(),
4424
- brandB: z44.string().nullish(),
4425
- marketId: z44.string().nullish(),
4426
- tags: z44.array(z44.string()).optional(),
4201
+ queued: z43.boolean()
4202
+ });
4203
+ var updateVisibilityPromptBodySchema = z43.object({
4204
+ name: z43.string().min(1).optional(),
4205
+ promptText: z43.string().min(1).optional(),
4206
+ branded: z43.boolean().optional(),
4207
+ brandA: z43.string().nullish(),
4208
+ brandB: z43.string().nullish(),
4209
+ marketId: z43.string().nullish(),
4210
+ tags: z43.array(z43.string()).optional(),
4427
4211
  ...visibilityPromptSettingsPatchShape,
4428
4212
  /** Replaces the whole scenario set when present. */
4429
- scenarios: z44.array(visibilityScenarioInputSchema).optional()
4213
+ scenarios: z43.array(visibilityScenarioInputSchema).optional()
4430
4214
  }).strict();
4431
- var runVisibilityPromptResponseSchema = z44.object({
4432
- batchIds: z44.array(z44.string()),
4433
- runIds: z44.array(z44.string())
4215
+ var runVisibilityPromptResponseSchema = z43.object({
4216
+ batchIds: z43.array(z43.string()),
4217
+ runIds: z43.array(z43.string())
4434
4218
  });
4435
- var visibilityPromptRunSchema = z44.object({
4436
- id: z44.string(),
4437
- status: z44.string(),
4219
+ var visibilityPromptRunSchema = z43.object({
4220
+ id: z43.string(),
4221
+ status: z43.string(),
4438
4222
  agent: agentSchema,
4439
- model: z44.string().nullable(),
4440
- resolvedModel: z44.string().nullable(),
4441
- createdAt: z44.string(),
4442
- startedAt: z44.string().nullable(),
4443
- finishedAt: z44.string().nullable(),
4444
- failureReason: z44.string().nullable(),
4445
- verdict: z44.object({
4446
- status: z44.string(),
4447
- error: z44.string().nullable(),
4448
- payload: z44.unknown().nullable()
4223
+ model: z43.string().nullable(),
4224
+ resolvedModel: z43.string().nullable(),
4225
+ createdAt: z43.string(),
4226
+ startedAt: z43.string().nullable(),
4227
+ finishedAt: z43.string().nullable(),
4228
+ failureReason: z43.string().nullable(),
4229
+ verdict: z43.object({
4230
+ status: z43.string(),
4231
+ error: z43.string().nullable(),
4232
+ payload: z43.unknown().nullable()
4449
4233
  }).nullable()
4450
4234
  });
4451
- var listVisibilityPromptRunsResponseSchema = z44.object({
4452
- items: z44.array(visibilityPromptRunSchema)
4235
+ var listVisibilityPromptRunsResponseSchema = z43.object({
4236
+ items: z43.array(visibilityPromptRunSchema)
4453
4237
  });
4454
- var orgMarketSchema = z44.object({
4455
- marketId: z44.string(),
4456
- slug: z44.string(),
4457
- name: z44.string(),
4238
+ var orgMarketSchema = z43.object({
4239
+ marketId: z43.string(),
4240
+ slug: z43.string(),
4241
+ name: z43.string(),
4458
4242
  /** The one line saying what the market measures. */
4459
- capability: z44.string(),
4243
+ capability: z43.string(),
4460
4244
  /** SUGGESTED (the matcher) | USER (a human picked it). */
4461
- source: z44.string()
4245
+ source: z43.string()
4462
4246
  });
4463
4247
  var addableMarketSchema = orgMarketSchema.omit({ source: true });
4464
- var listMarketsResponseSchema = z44.object({
4465
- tracked: z44.array(orgMarketSchema),
4248
+ var listMarketsResponseSchema = z43.object({
4249
+ tracked: z43.array(orgMarketSchema),
4466
4250
  /** Published markets the org does not track yet (closed set — no free-text
4467
4251
  * market creation). */
4468
- addable: z44.array(addableMarketSchema)
4252
+ addable: z43.array(addableMarketSchema)
4469
4253
  });
4470
- var addMarketBodySchema = z44.object({ marketId: z44.string().min(1) });
4254
+ var addMarketBodySchema = z43.object({ marketId: z43.string().min(1) });
4471
4255
 
4472
4256
  // src/version.ts
4473
4257
  import { createRequire } from "module";
@@ -4852,7 +4636,7 @@ __export(apply_exports, {
4852
4636
  register: () => register2
4853
4637
  });
4854
4638
  import { readFileSync as readFileSync3 } from "fs";
4855
- import { z as z45 } from "zod";
4639
+ import { z as z44 } from "zod";
4856
4640
  function assertRequiredExperiment(spec, required) {
4857
4641
  if (required.length === 0) {
4858
4642
  throw new CliError(
@@ -5004,7 +4788,7 @@ function register2(program2) {
5004
4788
  ).option("--schema", "print the battery spec JSON Schema and exit").option("--example", "print a minimal example battery spec and exit").action(
5005
4789
  async (opts, command) => {
5006
4790
  if (opts.schema) {
5007
- printJson(z45.toJSONSchema(batteries_exports.batterySpecSchema));
4791
+ printJson(z44.toJSONSchema(batteries_exports.batterySpecSchema));
5008
4792
  return;
5009
4793
  }
5010
4794
  if (opts.example) {
@@ -6347,67 +6131,137 @@ function cadenceLabel(cadence) {
6347
6131
 
6348
6132
  // src/lib/runDefinitionFiles.ts
6349
6133
  import { execFileSync } from "child_process";
6350
- import { createHash as createHash2 } from "crypto";
6351
6134
  import { isAbsolute, relative, resolve, sep } from "path";
6135
+
6136
+ // ../packages/api-schemas/src/compileRunDefinition.ts
6137
+ import { createHash as createHash2 } from "crypto";
6352
6138
  import { parseDocument } from "yaml";
6353
- function git(cwd, args) {
6354
- try {
6355
- return execFileSync("git", args, {
6356
- cwd,
6357
- encoding: "buffer",
6358
- maxBuffer: 10 * 1024 * 1024,
6359
- stdio: ["ignore", "pipe", "pipe"]
6360
- });
6361
- } catch (error) {
6362
- const detail = error && typeof error === "object" && "stderr" in error ? String(error.stderr).trim() : String(error);
6363
- throw new CliError("usage", `git ${args[0]} failed: ${detail}`);
6364
- }
6365
- }
6366
- function committedBlob(root, commit, path2) {
6367
- return git(root, ["show", `${commit}:${path2}`]);
6368
- }
6369
- function decode(blob, path2) {
6139
+ function utf8(bytes, path2) {
6370
6140
  try {
6371
- return new TextDecoder("utf-8", { fatal: true }).decode(blob);
6141
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
6372
6142
  } catch {
6373
- throw new CliError("usage", `${path2} is not UTF-8 text`);
6374
- }
6375
- }
6376
- function parseYaml(text, path2) {
6377
- const document = parseDocument(text, { uniqueKeys: true });
6378
- if (document.errors.length) {
6379
- throw new CliError(
6380
- "usage",
6381
- `${path2}: ${document.errors.map((error) => error.message).join("; ")}`
6382
- );
6143
+ throw new Error(`${path2} is not UTF-8 text`);
6383
6144
  }
6384
- return document.toJS();
6385
6145
  }
6386
- function caseFromMarkdown(path2, source) {
6146
+ function markdownCase(path2, bytes) {
6147
+ const source = utf8(bytes, path2);
6387
6148
  const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(source);
6388
6149
  if (!match)
6389
- throw new CliError(
6390
- "usage",
6391
- `${path2}: expected YAML frontmatter between --- lines`
6150
+ throw new Error(`${path2}: expected YAML frontmatter between --- lines`);
6151
+ const document = parseDocument(match[1], { uniqueKeys: true });
6152
+ if (document.errors.length)
6153
+ throw new Error(
6154
+ `${path2}: ${document.errors.map((error) => error.message).join("; ")}`
6392
6155
  );
6393
- const parsed = runDefinitionFrontmatterSchema.safeParse(
6394
- parseYaml(match[1], path2)
6395
- );
6396
- if (!parsed.success)
6397
- throw new CliError("usage", `${path2}: ${parsed.error.message}`);
6156
+ const parsed = runDefinitionFrontmatterSchema.safeParse(document.toJS());
6157
+ if (!parsed.success) throw new Error(`${path2}: ${parsed.error.message}`);
6398
6158
  const prompt = match[2].trim();
6399
- if (!prompt) throw new CliError("usage", `${path2}: Markdown body is empty`);
6159
+ if (!prompt) throw new Error(`${path2}: Markdown body is empty`);
6400
6160
  return { path: path2, prompt, ...parsed.data };
6401
6161
  }
6402
- function relativeGitPath(root, cwd, input) {
6403
- if (!input || input.includes("\0") || /[*?[\]{}]/.test(input))
6404
- throw new CliError("usage", `expected an explicit case path: ${input}`);
6405
- const absolute = resolve(cwd, input);
6406
- const path2 = relative(root, absolute);
6407
- if (!path2 || path2 === ".." || path2.startsWith(`..${sep}`) || isAbsolute(path2))
6408
- throw new CliError(
6409
- "usage",
6410
- `case path is outside this Git repository: ${input}`
6162
+ function compileRunDefinitionFromBlobs(input) {
6163
+ if (!uncredentialedRepoUrlSchema.safeParse(input.repoUrl).success)
6164
+ throw new Error("Git origin must not contain embedded credentials");
6165
+ if (!/^[a-f0-9]{40}$/i.test(input.commit))
6166
+ throw new Error("Expected a full Git commit SHA");
6167
+ if (input.casePaths.length === 0)
6168
+ throw new Error("At least one Markdown case is required");
6169
+ if (new Set(input.casePaths).size !== input.casePaths.length)
6170
+ throw new Error("Case paths must be unique");
6171
+ const configBytes = input.blobs.get("gauge.json");
6172
+ let config;
6173
+ if (configBytes) {
6174
+ try {
6175
+ config = runDefinitionFileConfigSchema.parse(
6176
+ JSON.parse(utf8(configBytes, "gauge.json"))
6177
+ );
6178
+ } catch (error) {
6179
+ throw new Error(
6180
+ `gauge.json: ${error instanceof Error ? error.message : error}`
6181
+ );
6182
+ }
6183
+ }
6184
+ const conventionalPrepare = input.blobs.has(".gauge/prepare.sh");
6185
+ if (config?.product && conventionalPrepare)
6186
+ throw new Error(
6187
+ "gauge.json: product and .gauge/prepare.sh are alternatives"
6188
+ );
6189
+ const prepare = config?.prepare ?? (conventionalPrepare ? "bash .gauge/prepare.sh" : void 0);
6190
+ const preparation = config?.product ?? (prepare ? { run: prepare } : void 0);
6191
+ if (config?.install && !prepare)
6192
+ throw new Error("gauge.json: install requires prepare");
6193
+ if (preparation && !input.repoUrl.startsWith("https://"))
6194
+ throw new Error("Project preparation requires a public HTTPS Git origin");
6195
+ const cases = input.casePaths.map((path2) => {
6196
+ const bytes = input.blobs.get(path2);
6197
+ if (!path2.endsWith(".md") || !bytes)
6198
+ throw new Error(`Missing committed Markdown case: ${path2}`);
6199
+ return markdownCase(path2, bytes);
6200
+ });
6201
+ const hash = createHash2("sha256");
6202
+ hash.update("gauge-run-definition-v1\0");
6203
+ for (const [path2, bytes] of [...input.blobs.entries()].sort(
6204
+ ([a], [b]) => a < b ? -1 : a > b ? 1 : 0
6205
+ )) {
6206
+ hash.update(path2);
6207
+ hash.update("\0");
6208
+ hash.update(String(bytes.length));
6209
+ hash.update("\0");
6210
+ hash.update(bytes);
6211
+ hash.update("\0");
6212
+ }
6213
+ const submission = runDefinitionSubmissionSchema.parse({
6214
+ version: 1,
6215
+ source: {
6216
+ repoUrl: input.repoUrl,
6217
+ commit: input.commit,
6218
+ digest: `sha256:${hash.digest("hex")}`,
6219
+ verification: input.verification
6220
+ },
6221
+ resources: preparation ? [
6222
+ {
6223
+ name: "project",
6224
+ type: "prepared-directory",
6225
+ source: {
6226
+ type: "git-checkout",
6227
+ repoUrl: input.repoUrl,
6228
+ commit: input.commit
6229
+ },
6230
+ prepare: preparation,
6231
+ ...config?.install ? { install: config.install } : {}
6232
+ }
6233
+ ] : [],
6234
+ cases
6235
+ });
6236
+ return { definition: submission, org: config?.org, github: config?.github };
6237
+ }
6238
+
6239
+ // src/lib/runDefinitionFiles.ts
6240
+ function git(cwd, args) {
6241
+ try {
6242
+ return execFileSync("git", args, {
6243
+ cwd,
6244
+ encoding: "buffer",
6245
+ maxBuffer: 10 * 1024 * 1024,
6246
+ stdio: ["ignore", "pipe", "pipe"]
6247
+ });
6248
+ } catch (error) {
6249
+ const detail = error && typeof error === "object" && "stderr" in error ? String(error.stderr).trim() : String(error);
6250
+ throw new CliError("usage", `git ${args[0]} failed: ${detail}`);
6251
+ }
6252
+ }
6253
+ function committedBlob(root, commit, path2) {
6254
+ return git(root, ["show", `${commit}:${path2}`]);
6255
+ }
6256
+ function relativeGitPath(root, cwd, input) {
6257
+ if (!input || input.includes("\0") || /[*?[\]{}]/.test(input))
6258
+ throw new CliError("usage", `expected an explicit case path: ${input}`);
6259
+ const absolute = resolve(cwd, input);
6260
+ const path2 = relative(root, absolute);
6261
+ if (!path2 || path2 === ".." || path2.startsWith(`..${sep}`) || isAbsolute(path2))
6262
+ throw new CliError(
6263
+ "usage",
6264
+ `case path is outside this Git repository: ${input}`
6411
6265
  );
6412
6266
  const gitPath = path2.split(sep).join("/");
6413
6267
  if (!gitPath.endsWith(".md"))
@@ -6436,83 +6290,34 @@ function loadCommittedRunDefinitionWithContext(files, cwd = process.cwd()) {
6436
6290
  const paths = files.map((file) => relativeGitPath(root, cwd, file));
6437
6291
  if (new Set(paths).size !== paths.length)
6438
6292
  throw new CliError("usage", "case paths must be unique");
6439
- const blobs = [];
6440
- let config;
6293
+ const blobs = /* @__PURE__ */ new Map();
6441
6294
  const hasConfig = git(root, ["ls-tree", "--name-only", commit, "--", "gauge.json"]).toString("utf8").trim() === "gauge.json";
6442
6295
  if (hasConfig) {
6443
- try {
6444
- const bytes = committedBlob(root, commit, "gauge.json");
6445
- blobs.push({ path: "gauge.json", bytes });
6446
- config = runDefinitionFileConfigSchema.parse(
6447
- JSON.parse(decode(bytes, "gauge.json"))
6448
- );
6449
- } catch (error) {
6450
- throw new CliError(
6451
- "usage",
6452
- `gauge.json: ${error instanceof Error ? error.message : error}`
6453
- );
6454
- }
6296
+ blobs.set("gauge.json", committedBlob(root, commit, "gauge.json"));
6455
6297
  }
6456
6298
  const hasConventionalPrepare = git(root, ["ls-tree", "--name-only", commit, "--", ".gauge/prepare.sh"]).toString("utf8").trim() === ".gauge/prepare.sh";
6457
6299
  if (hasConventionalPrepare) {
6458
- blobs.push({
6459
- path: ".gauge/prepare.sh",
6460
- bytes: committedBlob(root, commit, ".gauge/prepare.sh")
6461
- });
6462
- }
6463
- if (config?.product && hasConventionalPrepare)
6464
- throw new CliError(
6465
- "usage",
6466
- "gauge.json: product and .gauge/prepare.sh are alternatives"
6467
- );
6468
- const prepare = config?.prepare ?? (hasConventionalPrepare ? "bash .gauge/prepare.sh" : void 0);
6469
- const preparation = config?.product ?? (prepare ? { run: prepare } : void 0);
6470
- if (config?.install && !prepare)
6471
- throw new CliError("usage", "gauge.json: install requires prepare");
6472
- if (preparation && !repoUrl.startsWith("https://"))
6473
- throw new CliError(
6474
- "usage",
6475
- "Project preparation requires a public HTTPS Git origin"
6300
+ blobs.set(
6301
+ ".gauge/prepare.sh",
6302
+ committedBlob(root, commit, ".gauge/prepare.sh")
6476
6303
  );
6477
- const cases = paths.map((path2) => {
6478
- const bytes = committedBlob(root, commit, path2);
6479
- blobs.push({ path: path2, bytes });
6480
- return caseFromMarkdown(path2, decode(bytes, path2));
6481
- });
6482
- const hash = createHash2("sha256");
6483
- hash.update("gauge-run-definition-v1\0");
6484
- for (const entry of blobs.sort(
6485
- (a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0
6486
- )) {
6487
- hash.update(entry.path);
6488
- hash.update("\0");
6489
- hash.update(String(entry.bytes.length));
6490
- hash.update("\0");
6491
- hash.update(entry.bytes);
6492
- hash.update("\0");
6493
6304
  }
6494
- const submission = runDefinitionSubmissionSchema.safeParse({
6495
- version: 1,
6496
- source: {
6305
+ for (const path2 of paths) blobs.set(path2, committedBlob(root, commit, path2));
6306
+ try {
6307
+ const result = compileRunDefinitionFromBlobs({
6497
6308
  repoUrl,
6498
6309
  commit,
6499
- digest: `sha256:${hash.digest("hex")}`,
6310
+ casePaths: paths,
6311
+ blobs,
6500
6312
  verification: "SUBMITTED_UNVERIFIED"
6501
- },
6502
- resources: preparation ? [
6503
- {
6504
- name: "project",
6505
- type: "prepared-directory",
6506
- source: { type: "git-checkout", repoUrl, commit },
6507
- prepare: preparation,
6508
- ...config?.install ? { install: config.install } : {}
6509
- }
6510
- ] : [],
6511
- cases
6512
- });
6513
- if (!submission.success)
6514
- throw new CliError("usage", submission.error.message);
6515
- return { definition: submission.data, org: config?.org };
6313
+ });
6314
+ return { definition: result.definition, org: result.org };
6315
+ } catch (error) {
6316
+ throw new CliError(
6317
+ "usage",
6318
+ error instanceof Error ? error.message : String(error)
6319
+ );
6320
+ }
6516
6321
  }
6517
6322
 
6518
6323
  // src/lib/staff.ts
@@ -6744,527 +6549,115 @@ function register11(program2) {
6744
6549
  else console.log(`Updated eval set ${updated.id}`);
6745
6550
  }
6746
6551
  );
6747
- group.command("rm <id>").description("Delete an eval set (its run history survives)").action(async (id, _opts, cmd) => {
6748
- const org = resolveOrg(cmd);
6749
- await createClient().delete(
6750
- `${evalSetsPath(org)}/${encodeURIComponent(id)}`
6751
- );
6752
- if (resolveOutput(cmd) !== "json") console.log(`Deleted eval set ${id}`);
6753
- });
6754
- group.command("run [id]").description(
6755
- staffCommandsVisible() ? "Run an eval set now with its stored configuration (superusers run without billing the org by default)" : "Run an eval set now with its stored configuration"
6756
- ).addOption(
6757
- new Option2(
6758
- "--bill-to-org",
6759
- "bill this run to the org's credits instead (superusers)"
6760
- ).hideHelp(!staffCommandsVisible())
6761
- ).option("--files <paths...>", "explicit committed Markdown paths").option("--yes", "skip the confirmation").action(
6762
- async (id, opts, cmd) => {
6763
- if (opts.files !== void 0) {
6764
- if (id !== void 0)
6765
- throw new CliError(
6766
- "usage",
6767
- "pass either an eval ID or --files, not both"
6768
- );
6769
- const { definition, org: fileOrg } = loadCommittedRunDefinitionWithContext(opts.files);
6770
- const org2 = resolveOrg(cmd, fileOrg);
6771
- await confirmOrAbort("Run these committed eval cases now?", opts.yes);
6772
- const result2 = await createClient().post(
6773
- `/api/v1/orgs/${encodeURIComponent(org2)}/run-definitions/run`,
6774
- definition,
6775
- opts.billToOrg ? { billToOrg: true } : void 0
6776
- );
6777
- if (resolveOutput(cmd) === "json") printJson(result2);
6778
- else {
6779
- console.log(
6780
- `Started ${result2.createdRuns}/${result2.requestedRuns} sessions in request ${result2.runRequestId}`
6781
- );
6782
- console.log(`Wait: gauge run-requests wait ${result2.runRequestId}`);
6783
- }
6784
- return;
6785
- }
6786
- if (id === void 0)
6787
- throw new CliError("usage", "pass an eval ID or --files <paths...>");
6788
- const org = resolveOrg(cmd);
6789
- await confirmOrAbort(
6790
- "Run this eval's stored configuration now?",
6791
- opts.yes
6792
- );
6793
- const result = await createClient().post(
6794
- `${evalSetsPath(org)}/${encodeURIComponent(id)}/run`,
6795
- opts.billToOrg ? { billToOrg: true } : {}
6796
- );
6797
- if (resolveOutput(cmd) === "json") printJson(result);
6798
- else
6799
- console.log(
6800
- `Started ${result.runIds.length} run${result.runIds.length === 1 ? "" : "s"} in batch ${result.batchIds[0] ?? ""}`
6801
- );
6802
- }
6803
- );
6804
- group.command("runs <id>").description("The eval set's run log with per-criterion verdicts").option("--limit <n>", "max runs (default 100)").action(async (id, opts, cmd) => {
6805
- const org = resolveOrg(cmd);
6806
- const res = await createClient().get(
6807
- `${evalSetsPath(org)}/${encodeURIComponent(id)}/runs`,
6808
- { limit: opts.limit }
6809
- );
6810
- if (resolveOutput(cmd) === "json") {
6811
- printJson(res.items);
6812
- return;
6813
- }
6814
- printItems(
6815
- res.items.map((r) => ({
6816
- id: r.id,
6817
- status: r.status,
6818
- agent: r.agent,
6819
- model: r.resolvedModel ?? r.model ?? "",
6820
- created: r.createdAt,
6821
- judge: r.judge?.status ?? "-",
6822
- verdicts: r.criterionResults.length === 0 ? "-" : `${r.criterionResults.filter((c) => c.passed).length}/${r.criterionResults.length} passed`
6823
- })),
6824
- "table"
6825
- );
6826
- });
6827
- group.command("tag <id>").description("Replace an eval set's user tags (Surface:* is preserved)").option(
6828
- "--tag <name>",
6829
- "tag name, create-on-type (repeatable)",
6830
- collect,
6831
- []
6832
- ).option("--clear", "remove all user tags").action(
6833
- async (id, opts, cmd) => {
6834
- const org = resolveOrg(cmd);
6835
- if (opts.tag.length > 0 && opts.clear)
6836
- throw new CliError("usage", "--tag and --clear conflict");
6837
- if (opts.tag.length === 0 && !opts.clear)
6838
- throw new CliError(
6839
- "usage",
6840
- "pass --tag <name> (repeatable) or --clear"
6841
- );
6842
- const updated = await createClient().patch(
6843
- `${evalSetsPath(org)}/${encodeURIComponent(id)}`,
6844
- { tags: opts.clear ? [] : opts.tag }
6845
- );
6846
- if (resolveOutput(cmd) === "json") printJson(updated);
6847
- else console.log(`Tags: ${updated.tags.join(", ") || "(none)"}`);
6848
- }
6849
- );
6850
- }
6851
-
6852
- // src/commands/experiments.ts
6853
- var experiments_exports2 = {};
6854
- __export(experiments_exports2, {
6855
- register: () => register12,
6856
- rewriteContentType: () => rewriteContentType
6857
- });
6858
- import { readFileSync as readFileSync7 } from "fs";
6859
- import { extname } from "path";
6860
- var TERMINAL = /* @__PURE__ */ new Set(["COMPLETE", "PARTIAL", "FAILED", "CANCELED"]);
6861
- function experimentsPath(org) {
6862
- return `/api/v1/orgs/${encodeURIComponent(org)}/experiments`;
6863
- }
6864
- function itemPath(org, id) {
6865
- return `${experimentsPath(org)}/${encodeURIComponent(id)}`;
6866
- }
6867
- function readText(path2) {
6868
- return readFileSync7(path2 === "-" ? 0 : path2, "utf8");
6869
- }
6870
- var REWRITE_FILE_CONTENT_TYPES = {
6871
- ".md": "text/markdown",
6872
- ".markdown": "text/markdown",
6873
- ".html": "text/html",
6874
- ".htm": "text/html",
6875
- ".txt": "text/plain"
6876
- };
6877
- function rewriteContentType(path2, explicit) {
6878
- if (explicit !== void 0) return explicit;
6879
- if (path2 === void 0 || path2 === "-") return void 0;
6880
- return REWRITE_FILE_CONTENT_TYPES[extname(path2).toLowerCase()];
6881
- }
6882
- function sleep2(ms) {
6883
- return new Promise((resolve2) => setTimeout(resolve2, ms));
6884
- }
6885
- function toRow3(e) {
6886
- return {
6887
- id: e.id,
6888
- status: e.status,
6889
- problem: e.problem.length > 60 ? `${e.problem.slice(0, 57)}...` : e.problem,
6890
- page: e.boundaryUrl ?? "",
6891
- variants: e.variantCount,
6892
- "source run": e.sourceRunId,
6893
- created: e.createdAt
6894
- };
6895
- }
6896
- function printDetail3(e) {
6897
- console.log(`id: ${e.id}`);
6898
- console.log(`status: ${e.status}`);
6899
- console.log(`problem: ${e.problem}`);
6900
- console.log(`page: ${e.boundaryUrl ?? "(none)"}`);
6901
- console.log(`source run: ${e.sourceRun.runId} (${e.sourceRun.agent})`);
6902
- if (e.launchError) console.log(`launch err: ${e.launchError}`);
6903
- console.log("variants:");
6904
- for (const v of e.variants) {
6905
- const rewrite = v.hasRewrite ? `${v.rewriteChars} chars` : "no rewrite yet";
6906
- const state = v.invalidReason ? `invalid: ${v.invalidReason}` : v.planStatus ?? "draft";
6907
- console.log(
6908
- ` [${v.key}] ${v.title || "(untitled)"} \u2014 ${rewrite}, ${state}`
6909
- );
6910
- if (v.hypothesis) console.log(` hypothesis: ${v.hypothesis}`);
6911
- for (const r of v.runs) {
6912
- console.log(
6913
- ` run ${r.runId}: ${r.status}${r.failureReason ? ` (${r.failureReason})` : ""}`
6914
- );
6915
- }
6916
- }
6917
- }
6918
- function register12(program2) {
6919
- const group = program2.command("experiments").description(
6920
- "Author, launch, and read content experiments (legacy: orgs with Optimizations reject writes; use `gauge optimizations`)"
6921
- );
6922
- group.command("list").description("List the org's experiments").option(
6923
- "--status <statuses>",
6924
- "comma-separated statuses (e.g. RUNNING,COMPLETE)"
6925
- ).option("--limit <n>", "max rows (default 25)").action(async (opts, cmd) => {
6926
- const org = resolveOrg(cmd);
6927
- const res = await createClient().get(
6928
- experimentsPath(org),
6929
- { status: opts.status, limit: opts.limit }
6930
- );
6931
- if (resolveOutput(cmd) === "json") printJson(res.items);
6932
- else printItems(res.items.map(toRow3), "table");
6933
- });
6934
- group.command("eligible").description("Recent runs worth experimenting on (worst verdicts first)").action(async (_opts, cmd) => {
6935
- const org = resolveOrg(cmd);
6936
- const res = await createClient().get(`${experimentsPath(org)}/eligible-runs`);
6937
- if (resolveOutput(cmd) === "json") printJson(res.items);
6938
- else
6939
- printItems(
6940
- res.items.map((r) => ({
6941
- "run id": r.runId,
6942
- agent: r.agent,
6943
- verdict: r.verdict ?? "-",
6944
- boundaries: r.boundaryCount,
6945
- created: r.createdAt
6946
- })),
6947
- "table"
6948
- );
6949
- });
6950
- group.command("boundaries").description("The forkable fetches of a run (pass boundarySeq to create)").requiredOption("--run <runId>", "source run id").action(async (opts, cmd) => {
6951
- const org = resolveOrg(cmd);
6952
- const res = await createClient().get(`${experimentsPath(org)}/boundaries`, { runId: opts.run });
6953
- if (resolveOutput(cmd) === "json") printJson(res.items);
6954
- else
6955
- printItems(
6956
- res.items.map((b) => ({
6957
- boundarySeq: String(b.boundarySeq),
6958
- turn: b.turn ?? "?",
6959
- url: b.url,
6960
- prompt: b.fetchPrompt ?? ""
6961
- })),
6962
- "table"
6963
- );
6964
- });
6965
- group.command("create").description(
6966
- "Open (or resume) an experiment draft and start the plan round"
6967
- ).requiredOption("--run <runId>", "source run id").requiredOption(
6968
- "--boundary <seq>",
6969
- "opaque boundarySeq from `experiments boundaries`"
6970
- ).option("--problem <text>", "problem statement (derived if omitted)").option(
6971
- "--mode <mode>",
6972
- "who writes the rewrites: propose (default, directions are proposed then each is written), direct (one --change instruction, one write), manual (no generation \u2014 the rewrite is seeded with the page the agent read)",
6973
- "propose"
6974
- ).option(
6975
- "--change <text>",
6976
- "--mode direct only: the one change to make, in your words"
6977
- ).action(
6978
- async (opts, cmd) => {
6979
- const org = resolveOrg(cmd);
6980
- const parsedMode = experiments_exports.experimentModeSchema.safeParse(
6981
- opts.mode.toUpperCase()
6982
- );
6983
- if (!parsedMode.success) {
6984
- throw new Error(
6985
- `--mode must be one of ${experiments_exports.EXPERIMENT_MODES.map((m) => m.toLowerCase()).join(", ")}`
6986
- );
6987
- }
6988
- const mode = parsedMode.data;
6989
- if (mode === "DIRECT" && !opts.change?.trim()) {
6990
- throw new Error("--mode direct requires --change <text>");
6991
- }
6992
- if (mode !== "DIRECT" && opts.change !== void 0) {
6993
- throw new Error(`--change only applies to --mode direct`);
6994
- }
6995
- const body = {
6996
- runId: opts.run,
6997
- boundarySeq: opts.boundary,
6998
- ...opts.problem !== void 0 ? { problemText: opts.problem } : {},
6999
- mode,
7000
- ...opts.change !== void 0 ? { changeInstruction: opts.change.trim() } : {}
7001
- };
7002
- const result = await createClient().post(
7003
- experimentsPath(org),
7004
- body
7005
- );
7006
- if (resolveOutput(cmd) === "json") {
7007
- printJson(result);
7008
- return;
7009
- }
7010
- console.log(
7011
- `${result.created ? "Created" : "Resumed"} experiment ${result.experimentId}`
7012
- );
7013
- console.log(`Problem: ${result.problemText}`);
7014
- console.log(`Mode: ${result.mode.toLowerCase()}`);
7015
- if (!result.created && result.mode !== mode) {
7016
- console.error(
7017
- `Note: this fetch already had a live ${result.mode.toLowerCase()} draft, so --mode ${mode.toLowerCase()} was not applied \u2014 that draft was resumed instead.`
7018
- );
7019
- }
7020
- console.error(
7021
- result.mode === "MANUAL" ? `Tip: \`gauge experiments get ${result.experimentId}\` shows the seeded rewrite once the page is recovered` : `Tip: \`gauge experiments watch ${result.experimentId}\` follows the ${result.mode === "DIRECT" ? "write" : "plan"} round`
7022
- );
7023
- }
7024
- );
7025
- group.command("get <id>").description("Full detail: directions, rewrites, arms, verdicts").action(async (id, _opts, cmd) => {
7026
- const org = resolveOrg(cmd);
7027
- const detail = await createClient().get(
7028
- itemPath(org, id)
7029
- );
7030
- if (resolveOutput(cmd) === "json") printJson(detail);
7031
- else printDetail3(detail);
7032
- });
7033
- group.command("status <id>").description("The async round/launch state (carries launchError)").action(async (id, _opts, cmd) => {
7034
- const org = resolveOrg(cmd);
7035
- const status = await createClient().get(
7036
- `${itemPath(org, id)}/status`
7037
- );
7038
- if (resolveOutput(cmd) === "json") printJson(status);
7039
- else {
7040
- console.log(`status: ${status.status}`);
7041
- if (status.launchError)
7042
- console.log(`launch error: ${status.launchError}`);
7043
- if (status.shippedVariantId)
7044
- console.log(
7045
- `shipped: ${status.shippedVariantId} at ${status.shippedAt}`
7046
- );
7047
- }
7048
- });
7049
- const variants = group.command("variants").description("Manage a draft's rewrite directions");
7050
- variants.command("add <experimentId>").description("Add a direction (a candidate rewrite slot)").option("--title <title>", "direction title").option("--hypothesis <text>", "what this rewrite should change").action(
7051
- async (experimentId, opts, cmd) => {
7052
- const org = resolveOrg(cmd);
7053
- const created = await createClient().post(
7054
- `${itemPath(org, experimentId)}/variants`,
7055
- opts
7056
- );
7057
- if (resolveOutput(cmd) === "json") printJson(created);
7058
- else console.log(`Added variant ${created.key} (${created.id})`);
7059
- }
7060
- );
7061
- variants.command("edit <experimentId> <variantId>").description("Retitle / re-hypothesize a direction").option("--title <title>", "direction title").option("--hypothesis <text>", "hypothesis").action(
7062
- async (experimentId, variantId, opts, cmd) => {
7063
- if (opts.title === void 0 && opts.hypothesis === void 0)
7064
- throw new CliError("usage", "nothing to change");
7065
- const org = resolveOrg(cmd);
7066
- await createClient().patch(
7067
- `${itemPath(org, experimentId)}/variants/${encodeURIComponent(variantId)}`,
7068
- opts
7069
- );
7070
- if (resolveOutput(cmd) !== "json") console.log("Updated");
7071
- }
7072
- );
7073
- variants.command("rm <experimentId> <variantId>").description("Remove a direction from the draft").action(
7074
- async (experimentId, variantId, _o, cmd) => {
7075
- const org = resolveOrg(cmd);
7076
- await createClient().delete(
7077
- `${itemPath(org, experimentId)}/variants/${encodeURIComponent(variantId)}`
7078
- );
7079
- if (resolveOutput(cmd) !== "json") console.log("Removed");
7080
- }
7081
- );
7082
- group.command("content <id>").description("Read the live page (or a rewrite) in bounded windows").option("--variant <variantId>", "read this variant's rewrite instead").option("--offset <n>", "start offset (default 0)").option("--max-chars <n>", "window size (default 20000, max 40000)").action(
7083
- async (id, opts, cmd) => {
7084
- const org = resolveOrg(cmd);
7085
- const result = await createClient().get(
7086
- `${itemPath(org, id)}/content`,
7087
- {
7088
- variantId: opts.variant,
7089
- offset: opts.offset,
7090
- maxChars: opts.maxChars
7091
- }
7092
- );
7093
- if (resolveOutput(cmd) === "json") {
7094
- printJson(result);
7095
- return;
7096
- }
7097
- process.stdout.write(result.content);
7098
- if (result.nextOffset != null)
7099
- console.error(
7100
- `
7101
- --- ${result.returnedChars}/${result.totalChars} chars; continue with --offset ${result.nextOffset}`
7102
- );
7103
- }
7104
- );
7105
- group.command("rewrite <id> <variantId>").description(
7106
- "Write a variant's page: --file replaces it; --edits-file applies {find, replace} ops"
7107
- ).option("--file <path>", 'full content ("-" for stdin)').option(
7108
- "--content-type <mime>",
7109
- "rewrite MIME type (inferred for .md, .markdown, .html, .htm, and .txt)"
7110
- ).option(
7111
- "--edits-file <path>",
7112
- 'JSON array of {find, replace} ops ("-" for stdin)'
7113
- ).action(
7114
- async (id, variantId, opts, cmd) => {
7115
- if (opts.file === void 0 === (opts.editsFile === void 0))
7116
- throw new CliError(
7117
- "usage",
7118
- "pass exactly one of --file or --edits-file"
7119
- );
7120
- const org = resolveOrg(cmd);
7121
- const body = {};
7122
- if (opts.file !== void 0) body.content = readText(opts.file);
7123
- else {
7124
- let parsed;
7125
- try {
7126
- parsed = JSON.parse(readText(opts.editsFile));
7127
- } catch (e) {
6552
+ group.command("rm <id>").description("Delete an eval set (its run history survives)").action(async (id, _opts, cmd) => {
6553
+ const org = resolveOrg(cmd);
6554
+ await createClient().delete(
6555
+ `${evalSetsPath(org)}/${encodeURIComponent(id)}`
6556
+ );
6557
+ if (resolveOutput(cmd) !== "json") console.log(`Deleted eval set ${id}`);
6558
+ });
6559
+ group.command("run [id]").description(
6560
+ staffCommandsVisible() ? "Run an eval set now with its stored configuration (superusers run without billing the org by default)" : "Run an eval set now with its stored configuration"
6561
+ ).addOption(
6562
+ new Option2(
6563
+ "--bill-to-org",
6564
+ "bill this run to the org's credits instead (superusers)"
6565
+ ).hideHelp(!staffCommandsVisible())
6566
+ ).option("--files <paths...>", "explicit committed Markdown paths").option("--yes", "skip the confirmation").action(
6567
+ async (id, opts, cmd) => {
6568
+ if (opts.files !== void 0) {
6569
+ if (id !== void 0)
7128
6570
  throw new CliError(
7129
6571
  "usage",
7130
- `could not read --edits-file: ${e instanceof Error ? e.message : e}`
6572
+ "pass either an eval ID or --files, not both"
7131
6573
  );
7132
- }
7133
- if (!Array.isArray(parsed) || parsed.length === 0)
7134
- throw new CliError(
7135
- "usage",
7136
- "--edits-file must be a non-empty JSON array of {find, replace}"
6574
+ const { definition, org: fileOrg } = loadCommittedRunDefinitionWithContext(opts.files);
6575
+ const org2 = resolveOrg(cmd, fileOrg);
6576
+ await confirmOrAbort("Run these committed eval cases now?", opts.yes);
6577
+ const result2 = await createClient().post(
6578
+ `/api/v1/orgs/${encodeURIComponent(org2)}/run-definitions/run`,
6579
+ definition,
6580
+ opts.billToOrg ? { billToOrg: true } : void 0
6581
+ );
6582
+ if (resolveOutput(cmd) === "json") printJson(result2);
6583
+ else {
6584
+ console.log(
6585
+ `Started ${result2.createdRuns}/${result2.requestedRuns} sessions in request ${result2.runRequestId}`
7137
6586
  );
7138
- body.edits = parsed;
6587
+ console.log(`Wait: gauge run-requests wait ${result2.runRequestId}`);
6588
+ }
6589
+ return;
7139
6590
  }
7140
- body.contentType = rewriteContentType(opts.file, opts.contentType);
7141
- const result = await createClient().put(
7142
- `${itemPath(org, id)}/variants/${encodeURIComponent(variantId)}/content`,
7143
- body
6591
+ if (id === void 0)
6592
+ throw new CliError("usage", "pass an eval ID or --files <paths...>");
6593
+ const org = resolveOrg(cmd);
6594
+ await confirmOrAbort(
6595
+ "Run this eval's stored configuration now?",
6596
+ opts.yes
6597
+ );
6598
+ const result = await createClient().post(
6599
+ `${evalSetsPath(org)}/${encodeURIComponent(id)}/run`,
6600
+ opts.billToOrg ? { billToOrg: true } : {}
7144
6601
  );
7145
6602
  if (resolveOutput(cmd) === "json") printJson(result);
7146
- else {
7147
- console.log(`Wrote ${result.chars} chars`);
7148
- if (body.edits)
7149
- console.log(
7150
- `Edits: ${result.applied} applied, ${result.skipped} skipped`
7151
- );
7152
- if (result.truncated) console.error("warning: content was truncated");
7153
- }
6603
+ else
6604
+ console.log(
6605
+ `Started ${result.runIds.length} run${result.runIds.length === 1 ? "" : "s"} in batch ${result.batchIds[0] ?? ""}`
6606
+ );
7154
6607
  }
7155
6608
  );
7156
- group.command("replan <id>").description("Discard the directions and propose fresh ones").action(async (id, _opts, cmd) => {
7157
- const org = resolveOrg(cmd);
7158
- await createClient().post(`${itemPath(org, id)}/replan`, {});
7159
- if (resolveOutput(cmd) !== "json")
7160
- console.log("Replanning \u2014 follow with `gauge experiments watch`");
7161
- });
7162
- group.command("write <id>").description("Write rewrites for directions that lack one").action(async (id, _opts, cmd) => {
6609
+ group.command("runs <id>").description("The eval set's run log with per-criterion verdicts").option("--limit <n>", "max runs (default 100)").action(async (id, opts, cmd) => {
7163
6610
  const org = resolveOrg(cmd);
7164
- const result = await createClient().post(
7165
- `${itemPath(org, id)}/write`,
7166
- {}
6611
+ const res = await createClient().get(
6612
+ `${evalSetsPath(org)}/${encodeURIComponent(id)}/runs`,
6613
+ { limit: opts.limit }
7167
6614
  );
7168
6615
  if (resolveOutput(cmd) === "json") {
7169
- printJson(result);
6616
+ printJson(res.items);
7170
6617
  return;
7171
6618
  }
7172
- if (result.queued > 0) console.log(`Queued ${result.queued} rewrite(s)`);
7173
- else if (result.reason === "round_in_flight")
7174
- console.log("A round is already running");
7175
- else console.log("Nothing pending \u2014 every direction has a rewrite");
7176
- });
7177
- group.command("launch <id>").description("Claim the draft for launch (spends credits; async fan-out)").action(async (id, _opts, cmd) => {
7178
- const org = resolveOrg(cmd);
7179
- const result = await createClient().post(
7180
- `${itemPath(org, id)}/launch`,
7181
- {}
7182
- );
7183
- if (resolveOutput(cmd) === "json") printJson(result);
7184
- else
7185
- console.log(
7186
- `Launching ${result.experimentId} \u2014 \`gauge experiments watch ${result.experimentId}\` follows it`
7187
- );
7188
- });
7189
- group.command("watch <id>").description(
7190
- "Follow the running round or launch; prints the recommendation on settle"
7191
- ).option("--interval <seconds>", "poll interval (default 10)").action(async (id, opts, cmd) => {
7192
- const org = resolveOrg(cmd);
7193
- const client = createClient();
7194
- const intervalMs = Math.max(Number(opts.interval ?? 10) * 1e3, 2e3);
7195
- const GRACE_POLLS = 3;
7196
- let sawActive = false;
7197
- let draftPolls = 0;
7198
- let last = "";
7199
- for (; ; ) {
7200
- const status = await client.get(
7201
- `${itemPath(org, id)}/status`
7202
- );
7203
- if (status.status !== last) {
7204
- last = status.status;
7205
- console.error(`status: ${status.status}`);
7206
- if (status.launchError)
7207
- console.error(`launch error: ${status.launchError}`);
7208
- }
7209
- if (TERMINAL.has(status.status)) break;
7210
- if (status.status === "DRAFT") {
7211
- if (status.launchError) {
7212
- process.exitCode = 1;
7213
- return;
7214
- }
7215
- if (sawActive) {
7216
- console.error(
7217
- `Round finished \u2014 \`gauge experiments get ${id}\` shows the directions and rewrites.`
7218
- );
7219
- return;
7220
- }
7221
- draftPolls += 1;
7222
- if (draftPolls >= GRACE_POLLS) {
7223
- console.error(
7224
- `Nothing is running \u2014 \`gauge experiments get ${id}\` shows the draft.`
7225
- );
7226
- return;
7227
- }
7228
- } else {
7229
- sawActive = true;
7230
- }
7231
- await sleep2(intervalMs);
7232
- }
7233
- const rec = await client.get(
7234
- `${itemPath(org, id)}/recommendation`
7235
- );
7236
- printJson(rec);
7237
- });
7238
- group.command("export <id>").description("Print the settled recommendation (JSON)").action(async (id, _opts, cmd) => {
7239
- const org = resolveOrg(cmd);
7240
- const rec = await createClient().get(
7241
- `${itemPath(org, id)}/recommendation`
6619
+ printItems(
6620
+ res.items.map((r) => ({
6621
+ id: r.id,
6622
+ status: r.status,
6623
+ agent: r.agent,
6624
+ model: r.resolvedModel ?? r.model ?? "",
6625
+ created: r.createdAt,
6626
+ judge: r.judge?.status ?? "-",
6627
+ verdicts: r.criterionResults.length === 0 ? "-" : `${r.criterionResults.filter((c) => c.passed).length}/${r.criterionResults.length} passed`
6628
+ })),
6629
+ "table"
7242
6630
  );
7243
- printJson(rec);
7244
6631
  });
7245
- group.command("ship <id> <variantId>").description("Mark a variant as shipped to your live docs").action(
7246
- async (id, variantId, _o, cmd) => {
6632
+ group.command("tag <id>").description("Replace an eval set's user tags (Surface:* is preserved)").option(
6633
+ "--tag <name>",
6634
+ "tag name, create-on-type (repeatable)",
6635
+ collect,
6636
+ []
6637
+ ).option("--clear", "remove all user tags").action(
6638
+ async (id, opts, cmd) => {
7247
6639
  const org = resolveOrg(cmd);
7248
- await createClient().post(`${itemPath(org, id)}/ship`, { variantId });
7249
- if (resolveOutput(cmd) !== "json") console.log("Marked shipped");
6640
+ if (opts.tag.length > 0 && opts.clear)
6641
+ throw new CliError("usage", "--tag and --clear conflict");
6642
+ if (opts.tag.length === 0 && !opts.clear)
6643
+ throw new CliError(
6644
+ "usage",
6645
+ "pass --tag <name> (repeatable) or --clear"
6646
+ );
6647
+ const updated = await createClient().patch(
6648
+ `${evalSetsPath(org)}/${encodeURIComponent(id)}`,
6649
+ { tags: opts.clear ? [] : opts.tag }
6650
+ );
6651
+ if (resolveOutput(cmd) === "json") printJson(updated);
6652
+ else console.log(`Tags: ${updated.tags.join(", ") || "(none)"}`);
7250
6653
  }
7251
6654
  );
7252
- group.command("unship <id>").description("Clear the shipped mark").action(async (id, _opts, cmd) => {
7253
- const org = resolveOrg(cmd);
7254
- await createClient().delete(`${itemPath(org, id)}/ship`);
7255
- if (resolveOutput(cmd) !== "json") console.log("Cleared");
7256
- });
7257
- group.command("cancel <id>").description("Cancel a draft/generating/launching experiment").action(async (id, _opts, cmd) => {
7258
- const org = resolveOrg(cmd);
7259
- await createClient().post(`${itemPath(org, id)}/cancel`, {});
7260
- if (resolveOutput(cmd) !== "json") console.log(`Canceled ${id}`);
7261
- });
7262
6655
  }
7263
6656
 
7264
6657
  // src/commands/instructions.ts
7265
6658
  var instructions_exports = {};
7266
6659
  __export(instructions_exports, {
7267
- register: () => register13
6660
+ register: () => register12
7268
6661
  });
7269
6662
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
7270
6663
  import { join as join3 } from "path";
@@ -7383,7 +6776,7 @@ function resolveTopic(topic) {
7383
6776
 
7384
6777
  // src/commands/instructions.ts
7385
6778
  var INSTALL_ROOT = ".claude/skills";
7386
- function register13(program2) {
6779
+ function register12(program2) {
7387
6780
  program2.command("instructions [topic]").description(
7388
6781
  `Instructions for a coding agent using this CLI. Run before your first gauge command; a topic reprints one group: ${TOPIC_NAMES.join(", ")}`
7389
6782
  ).option("--list", "print the topic names only").option(
@@ -7416,7 +6809,7 @@ function register13(program2) {
7416
6809
  // src/commands/keys.ts
7417
6810
  var keys_exports2 = {};
7418
6811
  __export(keys_exports2, {
7419
- register: () => register14
6812
+ register: () => register13
7420
6813
  });
7421
6814
  function keysPath(org) {
7422
6815
  return `/api/v1/orgs/${encodeURIComponent(org)}/provider-keys`;
@@ -7459,7 +6852,7 @@ async function readKeyInput(opts) {
7459
6852
  }
7460
6853
  return key;
7461
6854
  }
7462
- function register14(program2) {
6855
+ function register13(program2) {
7463
6856
  const group = program2.command("keys").description("Manage BYOK provider keys (write-only; reads show last4)");
7464
6857
  group.command("set <provider>").description(
7465
6858
  "Set a provider key (anthropic|openai); reads it from stdin or GAUGE_PROVIDER_KEY"
@@ -7515,9 +6908,9 @@ function register14(program2) {
7515
6908
  // src/commands/mcp.ts
7516
6909
  var mcp_exports2 = {};
7517
6910
  __export(mcp_exports2, {
7518
- register: () => register15
6911
+ register: () => register14
7519
6912
  });
7520
- import { readFileSync as readFileSync8 } from "fs";
6913
+ import { readFileSync as readFileSync7 } from "fs";
7521
6914
  function mcpPath(org) {
7522
6915
  return `/api/v1/orgs/${encodeURIComponent(org)}/mcp-servers`;
7523
6916
  }
@@ -7533,7 +6926,7 @@ function specFromOpts(opts) {
7533
6926
  throw new CliError("usage", "--spec-file conflicts with --command/--url");
7534
6927
  try {
7535
6928
  return JSON.parse(
7536
- readFileSync8(opts.specFile === "-" ? 0 : opts.specFile, "utf8")
6929
+ readFileSync7(opts.specFile === "-" ? 0 : opts.specFile, "utf8")
7537
6930
  );
7538
6931
  } catch (e) {
7539
6932
  throw new CliError(
@@ -7562,7 +6955,7 @@ function specFromOpts(opts) {
7562
6955
  ...tools.length ? { tools } : {}
7563
6956
  };
7564
6957
  }
7565
- function register15(program2) {
6958
+ function register14(program2) {
7566
6959
  const group = program2.command("mcp").description("Manage MCP servers used by eval and visibility runs");
7567
6960
  group.command("list").description("List the org's MCP servers with their newest version").action(async (_opts, cmd) => {
7568
6961
  const org = resolveOrg(cmd);
@@ -7693,9 +7086,9 @@ function register15(program2) {
7693
7086
  // src/commands/members.ts
7694
7087
  var members_exports = {};
7695
7088
  __export(members_exports, {
7696
- register: () => register16
7089
+ register: () => register15
7697
7090
  });
7698
- function register16(program2) {
7091
+ function register15(program2) {
7699
7092
  const group = program2.command("members").description("Team members and pending invites (read-only)");
7700
7093
  group.command("list").description("List members and pending invites").action(async (_opts, cmd) => {
7701
7094
  const org = resolveOrg(cmd);
@@ -7737,7 +7130,7 @@ var models_exports = {};
7737
7130
  __export(models_exports, {
7738
7131
  capabilityLabel: () => capabilityLabel,
7739
7132
  executionTargetsPath: () => executionTargetsPath,
7740
- register: () => register17
7133
+ register: () => register16
7741
7134
  });
7742
7135
  function executionTargetsPath(org) {
7743
7136
  return `/api/v1/orgs/${encodeURIComponent(org)}/execution-targets`;
@@ -7745,7 +7138,7 @@ function executionTargetsPath(org) {
7745
7138
  function capabilityLabel(capabilities) {
7746
7139
  return Object.entries(capabilities).filter(([, supported]) => supported).map(([name]) => name === "agentContext" ? "context" : name).join(", ");
7747
7140
  }
7748
- function register17(program2) {
7141
+ function register16(program2) {
7749
7142
  const group = program2.command("models").description("Discover supported models, harnesses, and providers");
7750
7143
  group.command("list", { isDefault: true }).description("List execution targets available to the organization").action(async (_opts, cmd) => {
7751
7144
  const org = resolveOrg(cmd);
@@ -7772,7 +7165,7 @@ function register17(program2) {
7772
7165
  // src/commands/onboard.ts
7773
7166
  var onboard_exports = {};
7774
7167
  __export(onboard_exports, {
7775
- register: () => register18
7168
+ register: () => register17
7776
7169
  });
7777
7170
  function orgNameFromEmail(email) {
7778
7171
  const domain = email?.split("@")[1] ?? "";
@@ -7780,7 +7173,7 @@ function orgNameFromEmail(email) {
7780
7173
  if (!base) return "My Workspace";
7781
7174
  return base.charAt(0).toUpperCase() + base.slice(1);
7782
7175
  }
7783
- function register18(program2) {
7176
+ function register17(program2) {
7784
7177
  program2.command("onboard").description(
7785
7178
  "Self-serve onboarding: sign in (device flow) and create your first workspace"
7786
7179
  ).option("--email <email>", "email a sign-in link (device-flow convenience)").option("--org-name <name>", "workspace name (default: from your email)").option("--website <url>", "company site (scanned to seed the workspace)").option("--new", "create a new workspace even if you already belong to one").option(
@@ -7887,28 +7280,28 @@ __export(optimizations_exports2, {
7887
7280
  parseTarget: () => parseTarget,
7888
7281
  planFromOpts: () => planFromOpts,
7889
7282
  readSkillDir: () => readSkillDir,
7890
- register: () => register19,
7283
+ register: () => register18,
7891
7284
  trialBodyFromOpts: () => trialBodyFromOpts,
7892
7285
  trialTemplate: () => trialTemplate,
7893
7286
  watchStops: () => watchStops
7894
7287
  });
7895
- import { readdirSync, readFileSync as readFileSync9, statSync } from "fs";
7288
+ import { readdirSync, readFileSync as readFileSync8, statSync } from "fs";
7896
7289
  import { join as join4, relative as relative2, sep as sep2 } from "path";
7897
- var TERMINAL2 = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
7290
+ var TERMINAL = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
7898
7291
  var EFFORTS = ["low", "medium", "high", "xhigh"];
7899
7292
  function basePath(org) {
7900
7293
  return `/api/v1/orgs/${encodeURIComponent(org)}/optimizations`;
7901
7294
  }
7902
- function itemPath2(org, id) {
7295
+ function itemPath(org, id) {
7903
7296
  return `${basePath(org)}/${encodeURIComponent(id)}`;
7904
7297
  }
7905
7298
  function trialPath(org, id, trialId) {
7906
- return `${itemPath2(org, id)}/trials/${encodeURIComponent(trialId)}`;
7299
+ return `${itemPath(org, id)}/trials/${encodeURIComponent(trialId)}`;
7907
7300
  }
7908
- function readText2(path2) {
7909
- return readFileSync9(path2 === "-" ? 0 : path2, "utf8");
7301
+ function readText(path2) {
7302
+ return readFileSync8(path2 === "-" ? 0 : path2, "utf8");
7910
7303
  }
7911
- function sleep3(ms) {
7304
+ function sleep2(ms) {
7912
7305
  return new Promise((resolve2) => setTimeout(resolve2, ms));
7913
7306
  }
7914
7307
  function parseSubject(opts) {
@@ -7961,19 +7354,19 @@ var NEXT_ACTION_HINT = {
7961
7354
  AUTHOR_TRIAL: "author the next trial: `gauge optimizations trials add <id>`",
7962
7355
  LAUNCH_ROUND: "launch the saved round: `gauge optimizations launch <id>`",
7963
7356
  ADOPT: "adopt the winning trial: `gauge optimizations adopt <id> <trial>`",
7964
- RESUME: "resume it: `gauge optimizations resume <id>`",
7357
+ RESUME: "resume it in the web app, or `gauge optimizations cancel <id>`",
7965
7358
  NONE: "nothing to do in Gauge"
7966
7359
  };
7967
7360
  function awaitingInput(detail) {
7968
7361
  return detail.nextAction !== "WAIT" && detail.nextAction !== "NONE";
7969
7362
  }
7970
7363
  function watchStops(detail, follow) {
7971
- return TERMINAL2.has(detail.status) || detail.nextAction === "NONE" || !follow && awaitingInput(detail);
7364
+ return TERMINAL.has(detail.status) || detail.nextAction === "NONE" || !follow && awaitingInput(detail);
7972
7365
  }
7973
7366
  function readObject(path2) {
7974
7367
  let value;
7975
7368
  try {
7976
- value = JSON.parse(readText2(path2));
7369
+ value = JSON.parse(readText(path2));
7977
7370
  } catch {
7978
7371
  throw new CliError("usage", "the file must contain valid JSON");
7979
7372
  }
@@ -8006,7 +7399,7 @@ function parseStatuses(raw) {
8006
7399
  );
8007
7400
  return parts.join(",");
8008
7401
  }
8009
- function readSkillDir(dir, read = readText2, walk = listFiles) {
7402
+ function readSkillDir(dir, read = readText, walk = listFiles) {
8010
7403
  const paths = walk(dir).sort();
8011
7404
  if (!paths.length)
8012
7405
  throw new CliError("usage", `no files under ${dir} to send`);
@@ -8033,7 +7426,7 @@ function listFiles(dir) {
8033
7426
  return statSync(path2).isDirectory() ? listFiles(path2) : [path2];
8034
7427
  });
8035
7428
  }
8036
- function trialBodyFromOpts(opts, read = readText2, walk) {
7429
+ function trialBodyFromOpts(opts, read = readText, walk) {
8037
7430
  const launch = opts.launch === true;
8038
7431
  const idempotencyKey = opts.idempotencyKey;
8039
7432
  const fork = opts.forkRun || opts.forkBoundary ? (() => {
@@ -8175,7 +7568,7 @@ function pct(value) {
8175
7568
  function subjectLabel(kind) {
8176
7569
  return kind === "EVAL_SET" ? "eval" : "preference";
8177
7570
  }
8178
- function toRow4(o) {
7571
+ function toRow3(o) {
8179
7572
  return {
8180
7573
  id: o.id,
8181
7574
  name: o.name.length > 40 ? `${o.name.slice(0, 37)}...` : o.name,
@@ -8204,7 +7597,7 @@ function trialRow(t) {
8204
7597
  id: t.id
8205
7598
  };
8206
7599
  }
8207
- function printDetail4(o) {
7600
+ function printDetail3(o) {
8208
7601
  console.log(`id: ${o.id}`);
8209
7602
  console.log(`name: ${o.name}`);
8210
7603
  console.log(
@@ -8269,6 +7662,18 @@ function printChange(content) {
8269
7662
  console.log(doc.after || "(empty)");
8270
7663
  }
8271
7664
  }
7665
+ function printRoundPreview(preview) {
7666
+ for (const trial of preview.trials) {
7667
+ console.log(trial.title);
7668
+ for (const change of trial.changes ?? []) {
7669
+ console.log(`=== ${change.path}`);
7670
+ console.log(change.hunks);
7671
+ }
7672
+ for (const path2 of trial.droppedFiles ?? [])
7673
+ console.log(` ${path2}: dropped`);
7674
+ }
7675
+ console.log(`previewDigest ${preview.previewDigest}`);
7676
+ }
8272
7677
  function printEstimate(e) {
8273
7678
  console.log(
8274
7679
  `plan: ${e.sampleCount} session${e.sampleCount === 1 ? "" : "s"} per trial \xD7 up to ${e.maxRounds} rounds`
@@ -8316,7 +7721,7 @@ function addPlanOptions(command) {
8316
7721
  "the one harness/model every session runs on, e.g. claude-code:claude-opus-4-8"
8317
7722
  );
8318
7723
  }
8319
- function register19(program2) {
7724
+ function register18(program2) {
8320
7725
  const group = program2.command("optimizations").alias("optimize").description(
8321
7726
  "Start, steer, and read optimizations: Gauge changes one owned surface per trial and reports the best measured change against the baseline"
8322
7727
  );
@@ -8338,14 +7743,14 @@ function register19(program2) {
8338
7743
  }
8339
7744
  );
8340
7745
  if (resolveOutput(cmd) === "json") printJson(res.items);
8341
- else printItems(res.items.map(toRow4), "table");
7746
+ else printItems(res.items.map(toRow3), "table");
8342
7747
  }
8343
7748
  );
8344
7749
  group.command("get <id>").description("One optimization: settings, score, and its trial ladder").action(async (id, _opts, cmd) => {
8345
7750
  const org = resolveOrg(cmd);
8346
- const detail = await createClient().get(itemPath2(org, id));
7751
+ const detail = await createClient().get(itemPath(org, id));
8347
7752
  if (resolveOutput(cmd) === "json") printJson(detail);
8348
- else printDetail4(detail);
7753
+ else printDetail3(detail);
8349
7754
  });
8350
7755
  addSubjectOptions(
8351
7756
  group.command("diagnose").description(
@@ -8428,7 +7833,7 @@ function register19(program2) {
8428
7833
  opts.yes
8429
7834
  );
8430
7835
  const detail = await createClient().post(
8431
- `${itemPath2(org, id)}/cancel`,
7836
+ `${itemPath(org, id)}/cancel`,
8432
7837
  {}
8433
7838
  );
8434
7839
  if (resolveOutput(cmd) === "json") printJson(detail);
@@ -8452,7 +7857,7 @@ function register19(program2) {
8452
7857
  }
8453
7858
  );
8454
7859
  if (resolveOutput(cmd) === "json") printJson(detail);
8455
- else printDetail4(detail);
7860
+ else printDetail3(detail);
8456
7861
  }
8457
7862
  );
8458
7863
  addPlanOptions(
@@ -8471,11 +7876,11 @@ function register19(program2) {
8471
7876
  if (!Object.keys(body).length)
8472
7877
  throw new CliError("usage", "pass plan flags, --name, or --file");
8473
7878
  const detail = await createClient().patch(
8474
- itemPath2(resolveOrg(cmd), id),
7879
+ itemPath(resolveOrg(cmd), id),
8475
7880
  body
8476
7881
  );
8477
7882
  if (resolveOutput(cmd) === "json") printJson(detail);
8478
- else printDetail4(detail);
7883
+ else printDetail3(detail);
8479
7884
  }
8480
7885
  );
8481
7886
  addPlanOptions(
@@ -8486,11 +7891,11 @@ function register19(program2) {
8486
7891
  const client = createClient();
8487
7892
  const plan = planFromOpts(opts);
8488
7893
  const creditCap = parseCreditEstimate(opts.creditCap);
8489
- const current = await client.get(itemPath2(org, id));
7894
+ const current = await client.get(itemPath(org, id));
8490
7895
  if (current.status !== "DRAFT")
8491
7896
  throw new CliError(
8492
7897
  "usage",
8493
- "only a draft can start; use resume or continue instead"
7898
+ "only a draft can start; use continue instead"
8494
7899
  );
8495
7900
  const target = plan.target ?? (current.settings.pinnedAgent ? {
8496
7901
  agent: current.settings.pinnedAgent,
@@ -8518,13 +7923,13 @@ function register19(program2) {
8518
7923
  `Start baseline for ${id}? Estimated full optimization: ${creditCap ?? estimate.estimate} credits, not a spending cap.`,
8519
7924
  opts.yes
8520
7925
  );
8521
- const detail = await client.post(`${itemPath2(org, id)}/start`, {
7926
+ const detail = await client.post(`${itemPath(org, id)}/start`, {
8522
7927
  ...plan,
8523
7928
  name: opts.name,
8524
7929
  creditCap
8525
7930
  });
8526
7931
  if (resolveOutput(cmd) === "json") printJson(detail);
8527
- else printDetail4(detail);
7932
+ else printDetail3(detail);
8528
7933
  }
8529
7934
  );
8530
7935
  group.command("launch <id>").description(
@@ -8535,7 +7940,7 @@ function register19(program2) {
8535
7940
  opts.yes
8536
7941
  );
8537
7942
  const result = await createClient().post(
8538
- `${itemPath2(resolveOrg(cmd), id)}/rounds/current/launch`,
7943
+ `${itemPath(resolveOrg(cmd), id)}/rounds/current/launch`,
8539
7944
  {}
8540
7945
  );
8541
7946
  if (resolveOutput(cmd) === "json") printJson(result);
@@ -8559,26 +7964,16 @@ function register19(program2) {
8559
7964
  opts.yes
8560
7965
  );
8561
7966
  const detail = await createClient().post(
8562
- `${itemPath2(resolveOrg(cmd), id)}/continue`,
7967
+ `${itemPath(resolveOrg(cmd), id)}/continue`,
8563
7968
  { rounds, maxTrialsPerRound }
8564
7969
  );
8565
7970
  if (resolveOutput(cmd) === "json") printJson(detail);
8566
- else printDetail4(detail);
7971
+ else printDetail3(detail);
8567
7972
  }
8568
7973
  );
8569
- group.command("resume <id>").description(
8570
- "Resume a legacy paused optimization with interactive authoring"
8571
- ).action(async (id, _opts, cmd) => {
8572
- const detail = await createClient().post(
8573
- `${itemPath2(resolveOrg(cmd), id)}/resume`,
8574
- {}
8575
- );
8576
- if (resolveOutput(cmd) === "json") printJson(detail);
8577
- else printDetail4(detail);
8578
- });
8579
7974
  group.command("activity <id>").description("Read the optimization's decision log").option("--after <timestamp>", "entries after this ISO timestamp").option("--limit <n>", "maximum entries (1\u2013500)").action(
8580
7975
  async (id, opts, cmd) => {
8581
- const res = await createClient().get(`${itemPath2(resolveOrg(cmd), id)}/activity`, {
7976
+ const res = await createClient().get(`${itemPath(resolveOrg(cmd), id)}/activity`, {
8582
7977
  after: opts.after,
8583
7978
  limit: parseCount(opts.limit, "--limit", 500)
8584
7979
  });
@@ -8597,7 +7992,7 @@ function register19(program2) {
8597
7992
  );
8598
7993
  group.command("chat <id>").description("Resolve your optimization chat and print its URL path").action(async (id, _opts, cmd) => {
8599
7994
  const res = await createClient().post(
8600
- `${itemPath2(resolveOrg(cmd), id)}/chat`,
7995
+ `${itemPath(resolveOrg(cmd), id)}/chat`,
8601
7996
  {}
8602
7997
  );
8603
7998
  if (resolveOutput(cmd) === "json") printJson(res);
@@ -8608,7 +8003,7 @@ function register19(program2) {
8608
8003
  `Delete optimization ${id}, its rounds, trials, and activity? Session history is kept.`,
8609
8004
  opts.yes
8610
8005
  );
8611
- await createClient().delete(itemPath2(resolveOrg(cmd), id));
8006
+ await createClient().delete(itemPath(resolveOrg(cmd), id));
8612
8007
  if (resolveOutput(cmd) === "json") printJson({ deleted: id });
8613
8008
  else console.log(`Deleted ${id}.`);
8614
8009
  });
@@ -8620,7 +8015,7 @@ function register19(program2) {
8620
8015
  opts.yes
8621
8016
  );
8622
8017
  const detail = await createClient().post(
8623
- `${itemPath2(org, id)}/complete`,
8018
+ `${itemPath(org, id)}/complete`,
8624
8019
  opts.adopt ? { adoptTrialId: opts.adopt } : {}
8625
8020
  );
8626
8021
  if (resolveOutput(cmd) === "json") printJson(detail);
@@ -8643,8 +8038,8 @@ function register19(program2) {
8643
8038
  const intervalMs = Math.max(interval * 1e3, 2e3);
8644
8039
  let last = "";
8645
8040
  for (; ; ) {
8646
- const detail = await client.get(itemPath2(org, id));
8647
- const trials2 = detail.rounds.flatMap((round) => round.trials);
8041
+ const detail = await client.get(itemPath(org, id));
8042
+ const trials2 = detail.rounds.flatMap((round2) => round2.trials);
8648
8043
  const line = `${detail.status}${detail.stopReason ? ` (${detail.stopReason})` : ""} \xB7 round ${detail.round}/${detail.maxRounds} \xB7 ${pct(detail.before)} \u2192 ${pct(detail.after)} \xB7 ${detail.creditsSpent} credits spent \xB7 ${trials2.filter((t) => t.status === "RUNNING").map((t) => t.key).join(",") || "idle"}`;
8649
8044
  if (line !== last) {
8650
8045
  last = line;
@@ -8653,19 +8048,73 @@ function register19(program2) {
8653
8048
  const needsInput = awaitingInput(detail);
8654
8049
  if (watchStops(detail, !!opts.follow)) {
8655
8050
  if (resolveOutput(cmd) === "json") printJson(detail);
8656
- else printDetail4(detail);
8051
+ else printDetail3(detail);
8657
8052
  if (needsInput) process.exitCode = NEEDS_INPUT_EXIT;
8658
8053
  return;
8659
8054
  }
8660
- await sleep3(intervalMs);
8055
+ await sleep2(intervalMs);
8661
8056
  }
8662
8057
  }
8663
8058
  );
8059
+ group.command("authoring <id>").description(
8060
+ "What the next round may change: kinds, CLI targets and commands, baseline invocations, revision"
8061
+ ).action(async (id, _opts, cmd) => {
8062
+ printJson(
8063
+ await createClient().get(`${itemPath(resolveOrg(cmd), id)}/authoring`)
8064
+ );
8065
+ });
8066
+ group.command("invocation <id> <invocationId>").description(
8067
+ "One baseline CLI invocation from `authoring`, with its recorded command evidence"
8068
+ ).action(
8069
+ async (id, invocationId, _opts, cmd) => {
8070
+ printJson(
8071
+ await createClient().get(
8072
+ `${itemPath(resolveOrg(cmd), id)}/authoring/target`,
8073
+ { cliInvocationId: invocationId }
8074
+ )
8075
+ );
8076
+ }
8077
+ );
8078
+ group.command("cli-change <id>").description(
8079
+ "Build a CLI_INTERVENTION bundle from {targetId, commandId, selector, operations, shippingIntent}; use the output as intervention.after in a round file. Saves nothing"
8080
+ ).requiredOption("--file <path>", "the change JSON; '-' for stdin").action(async (id, opts, cmd) => {
8081
+ printJson(
8082
+ await createClient().post(
8083
+ `${itemPath(resolveOrg(cmd), id)}/cli-changes`,
8084
+ readObject(opts.file)
8085
+ )
8086
+ );
8087
+ });
8088
+ const round = group.command("round").description(
8089
+ "Preview and save the round waiting to launch. A round file is {revision, trials: [{trial: {title, hypothesis, lever, intervention}, files?}]}; revision comes from `authoring`"
8090
+ );
8091
+ round.command("preview <id>").description("Validate a round file and print its diff and previewDigest").requiredOption("--file <path>", "the round JSON; '-' for stdin").action(async (id, opts, cmd) => {
8092
+ const preview = await createClient().post(
8093
+ `${itemPath(resolveOrg(cmd), id)}/rounds/current/preview`,
8094
+ readObject(opts.file)
8095
+ );
8096
+ if (resolveOutput(cmd) === "json") printJson(preview);
8097
+ else printRoundPreview(preview);
8098
+ });
8099
+ round.command("save <id>").description(
8100
+ "Save a previewed round as drafts, replacing every pending draft. Never launches"
8101
+ ).requiredOption("--file <path>", "the round JSON you previewed").requiredOption("--digest <digest>", "previewDigest from `round preview`").action(
8102
+ async (id, opts, cmd) => {
8103
+ const result = await createClient().put(
8104
+ `${itemPath(resolveOrg(cmd), id)}/rounds/current`,
8105
+ { ...readObject(opts.file), previewDigest: opts.digest }
8106
+ );
8107
+ if (resolveOutput(cmd) === "json") printJson(result);
8108
+ else
8109
+ for (const trial of result.trials)
8110
+ console.log(`Saved ${trial.key} "${trial.title}"`);
8111
+ }
8112
+ );
8664
8113
  const trials = group.command("trials").description("List, author, and run trials");
8665
8114
  trials.command("list <id>").description("Every trial of an optimization with score and verdict").action(async (id, _opts, cmd) => {
8666
8115
  const org = resolveOrg(cmd);
8667
8116
  const res = await createClient().get(
8668
- `${itemPath2(org, id)}/trials`
8117
+ `${itemPath(org, id)}/trials`
8669
8118
  );
8670
8119
  if (resolveOutput(cmd) === "json") printJson(res.items);
8671
8120
  else printItems(res.items.map(trialRow), "table");
@@ -8683,7 +8132,7 @@ function register19(program2) {
8683
8132
  "local directory holding the complete edited bundle, SKILL.md included"
8684
8133
  ).option("--page <url>", "docs page to rewrite (with --body-file)").option("--body-file <path>", "the rewritten page body; '-' for stdin").option("--fork-run <runId>", "fork-at-fetch source run for a docs rewrite").option(
8685
8134
  "--fork-boundary <seq>",
8686
- "fork-at-fetch boundary from `gauge experiments boundaries`"
8135
+ "fork-at-fetch boundary from `gauge runs fork-boundaries`"
8687
8136
  ).option(
8688
8137
  "--launch",
8689
8138
  "run the trial after saving (spends credits); otherwise save a draft"
@@ -8699,7 +8148,7 @@ function register19(program2) {
8699
8148
  `Run trial "${body.trial.title}" on ${id} now? Spends credits.`,
8700
8149
  opts.yes
8701
8150
  );
8702
- const result = await createClient().post(`${itemPath2(org, id)}/trials`, body);
8151
+ const result = await createClient().post(`${itemPath(org, id)}/trials`, body);
8703
8152
  if (resolveOutput(cmd) === "json") printJson(result);
8704
8153
  else if (result.replayed)
8705
8154
  console.log(
@@ -8732,6 +8181,16 @@ function register19(program2) {
8732
8181
  );
8733
8182
  }
8734
8183
  );
8184
+ trials.command("remove <id> <trialId>").description("Drop one draft trial from the round waiting to launch").option("--yes", "skip the confirmation").action(
8185
+ async (id, trialId, opts, cmd) => {
8186
+ await confirmOrAbort(`Remove draft ${trialId} from ${id}?`, opts.yes);
8187
+ const detail = await createClient().delete(
8188
+ trialPath(resolveOrg(cmd), id, trialId)
8189
+ );
8190
+ if (resolveOutput(cmd) === "json") printJson(detail);
8191
+ else console.log(`Removed ${trialId}.`);
8192
+ }
8193
+ );
8735
8194
  group.command("trial <id> <trialId>").description("One trial by id or key (B0, R1.1, \u2026) with its sessions").action(
8736
8195
  async (id, trialId, _opts, cmd) => {
8737
8196
  const org = resolveOrg(cmd);
@@ -8795,7 +8254,7 @@ function register19(program2) {
8795
8254
  ).requiredOption("--url <url>", "the page URL").action(async (id, opts, cmd) => {
8796
8255
  const org = resolveOrg(cmd);
8797
8256
  const res = await createClient().get(
8798
- `${itemPath2(org, id)}/page`,
8257
+ `${itemPath(org, id)}/page`,
8799
8258
  { url: opts.url }
8800
8259
  );
8801
8260
  if (resolveOutput(cmd) === "json") printJson(res);
@@ -8806,7 +8265,7 @@ function register19(program2) {
8806
8265
  // src/commands/org.ts
8807
8266
  var org_exports = {};
8808
8267
  __export(org_exports, {
8809
- register: () => register20
8268
+ register: () => register19
8810
8269
  });
8811
8270
  function printSettings(s) {
8812
8271
  console.log(`slug: ${s.slug}`);
@@ -8820,7 +8279,7 @@ function printSettings(s) {
8820
8279
  );
8821
8280
  console.log(`auto-join: ${s.autoJoinDomain ?? "off"}`);
8822
8281
  }
8823
- function register20(program2) {
8282
+ function register19(program2) {
8824
8283
  const group = program2.command("org").description(
8825
8284
  "This org's settings, read-only (see `gauge orgs` for the org list)"
8826
8285
  );
@@ -8837,12 +8296,12 @@ function register20(program2) {
8837
8296
  // src/commands/orgs.ts
8838
8297
  var orgs_exports2 = {};
8839
8298
  __export(orgs_exports2, {
8840
- register: () => register21
8299
+ register: () => register20
8841
8300
  });
8842
8301
  function isDefault(org, defaultOrg) {
8843
8302
  return defaultOrg !== void 0 && (org.slug === defaultOrg || org.publicId === defaultOrg);
8844
8303
  }
8845
- function register21(program2) {
8304
+ function register20(program2) {
8846
8305
  const orgs = program2.command("orgs").description("Organizations");
8847
8306
  orgs.command("list").description("List orgs you belong to").action(async (_opts, command) => {
8848
8307
  const output = resolveOutput(command);
@@ -8913,12 +8372,12 @@ function register21(program2) {
8913
8372
  // src/commands/personas.ts
8914
8373
  var personas_exports2 = {};
8915
8374
  __export(personas_exports2, {
8916
- register: () => register22
8375
+ register: () => register21
8917
8376
  });
8918
8377
  function personasPath(org) {
8919
8378
  return `/api/v1/orgs/${encodeURIComponent(org)}/personas`;
8920
8379
  }
8921
- function register22(program2) {
8380
+ function register21(program2) {
8922
8381
  const group = program2.command("personas").description("Manage simulated-user personas for eval and visibility runs");
8923
8382
  group.command("list").description("List the org's personas").action(async (_opts, cmd) => {
8924
8383
  const org = resolveOrg(cmd);
@@ -8991,7 +8450,7 @@ function register22(program2) {
8991
8450
  // src/commands/query.ts
8992
8451
  var query_exports2 = {};
8993
8452
  __export(query_exports2, {
8994
- register: () => register23
8453
+ register: () => register22
8995
8454
  });
8996
8455
  var collect3 = (value, prev = []) => [
8997
8456
  ...prev,
@@ -9183,7 +8642,7 @@ async function showMetadata(command, mode, dataset) {
9183
8642
  console.error(`dataset: ${ds.name} \u2014 ${ds.grain}`);
9184
8643
  printItems(rows, "table");
9185
8644
  }
9186
- function register23(program2) {
8645
+ function register22(program2) {
9187
8646
  const group = program2.command("query").description(
9188
8647
  "Flexible reports over your event warehouse (run a report, or discover the catalog)"
9189
8648
  );
@@ -9219,7 +8678,7 @@ function register23(program2) {
9219
8678
  // src/commands/repos.ts
9220
8679
  var repos_exports2 = {};
9221
8680
  __export(repos_exports2, {
9222
- register: () => register24
8681
+ register: () => register23
9223
8682
  });
9224
8683
  function reposPath(org) {
9225
8684
  return `/api/v1/orgs/${encodeURIComponent(org)}/repos`;
@@ -9227,7 +8686,7 @@ function reposPath(org) {
9227
8686
  async function fetchAllRepos(client, org) {
9228
8687
  return fetchAllPages(client, reposPath(org));
9229
8688
  }
9230
- function toRow5(repo) {
8689
+ function toRow4(repo) {
9231
8690
  return {
9232
8691
  name: repo.name,
9233
8692
  url: repo.url,
@@ -9242,7 +8701,7 @@ function toRow5(repo) {
9242
8701
  function syncWarning(repo) {
9243
8702
  return `warning: GitHub metadata sync failed; retry with \`gauge repos resync ${repo.url}\``;
9244
8703
  }
9245
- function register24(program2) {
8704
+ function register23(program2) {
9246
8705
  const repos = program2.command("repos").description("Manage repositories");
9247
8706
  repos.command("list").description("List repositories (yours + read-only Gauge-provided ones)").action(async (_opts, command) => {
9248
8707
  const org = resolveOrg(command);
@@ -9252,7 +8711,7 @@ function register24(program2) {
9252
8711
  printJson(items);
9253
8712
  return;
9254
8713
  }
9255
- printItems(items.map(toRow5), "table");
8714
+ printItems(items.map(toRow4), "table");
9256
8715
  });
9257
8716
  repos.command("add <url>").description("Add a repository (pulls languages/size/stars from GitHub)").option(
9258
8717
  "--ref <ref>",
@@ -9339,10 +8798,10 @@ function register24(program2) {
9339
8798
  // src/commands/runRequests.ts
9340
8799
  var runRequests_exports2 = {};
9341
8800
  __export(runRequests_exports2, {
9342
- register: () => register25
8801
+ register: () => register24
9343
8802
  });
9344
8803
  var pollIntervalMs = 5e3;
9345
- function register25(program2) {
8804
+ function register24(program2) {
9346
8805
  program2.command("run-requests").description("Read a durable launch and its aggregate verdict").command("wait <id>").description("Wait for all sessions and judging in a launch request").action(async (id, _opts, cmd) => {
9347
8806
  const org = resolveOrg(cmd);
9348
8807
  const path2 = `/api/v1/orgs/${encodeURIComponent(org)}/run-requests/${encodeURIComponent(id)}`;
@@ -9377,7 +8836,7 @@ function register25(program2) {
9377
8836
  // src/commands/runs.ts
9378
8837
  var runs_exports2 = {};
9379
8838
  __export(runs_exports2, {
9380
- register: () => register26
8839
+ register: () => register25
9381
8840
  });
9382
8841
  function runPath(id) {
9383
8842
  return `/api/v1/runs/${encodeURIComponent(id)}`;
@@ -9398,7 +8857,7 @@ function compact(value, max = 140) {
9398
8857
  const one = s.replace(/\s+/g, " ").trim();
9399
8858
  return one.length > max ? `${one.slice(0, max - 1)}\u2026` : one;
9400
8859
  }
9401
- function toRow6(run) {
8860
+ function toRow5(run) {
9402
8861
  const selected = run.selectedProvider?.slug ?? "";
9403
8862
  const observed = run.observedProvider?.slug;
9404
8863
  return {
@@ -9637,7 +9096,7 @@ async function streamRun(id, json, opts) {
9637
9096
  if (drainTimer) clearTimeout(drainTimer);
9638
9097
  }
9639
9098
  }
9640
- function register26(program2) {
9099
+ function register25(program2) {
9641
9100
  const runs = program2.command("runs").description("Inspect and manage runs");
9642
9101
  runs.command("list").description("List runs (newest first)").option("--status <status>", "filter by status, e.g. running,queued").option("--batch <id>", "filter by batch").option("--prompt <id>", "filter by prompt").option("--experiment <experiment>", "filter by experiment label").option("--eval-set <id>", "filter by eval set").option("--since <window>", "e.g. 24h, 7d, or an ISO date").option("--limit <n>", "page size (1-200)", "50").option("--cursor <cursor>", "resume from a previous page's nextCursor").action(
9643
9102
  async (opts, command) => {
@@ -9660,7 +9119,7 @@ function register26(program2) {
9660
9119
  printJson(page);
9661
9120
  return;
9662
9121
  }
9663
- printItems(page.items.map(toRow6), "table");
9122
+ printItems(page.items.map(toRow5), "table");
9664
9123
  if (page.nextCursor) {
9665
9124
  console.error(
9666
9125
  `(more results \u2014 rerun with --cursor ${page.nextCursor})`
@@ -9776,7 +9235,7 @@ function register26(program2) {
9776
9235
  var skills_exports2 = {};
9777
9236
  __export(skills_exports2, {
9778
9237
  buildSkillEditBody: () => buildSkillEditBody,
9779
- register: () => register27
9238
+ register: () => register26
9780
9239
  });
9781
9240
  function skillsPath(org) {
9782
9241
  return `/api/v1/orgs/${encodeURIComponent(org)}/skills`;
@@ -9838,7 +9297,7 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
9838
9297
  throw new CliError("usage", "nothing to change");
9839
9298
  return body;
9840
9299
  }
9841
- function register27(program2) {
9300
+ function register26(program2) {
9842
9301
  const group = program2.command("skills").description("Manage agent skills used by eval and visibility runs");
9843
9302
  group.command("list").description("List the org's skills with their newest version").action(async (_opts, cmd) => {
9844
9303
  const org = resolveOrg(cmd);
@@ -9979,7 +9438,7 @@ function register27(program2) {
9979
9438
  // src/commands/stats.ts
9980
9439
  var stats_exports2 = {};
9981
9440
  __export(stats_exports2, {
9982
- register: () => register28
9441
+ register: () => register27
9983
9442
  });
9984
9443
  function addFilterOptions(cmd) {
9985
9444
  return cmd.option("--prompt <id>", "filter to a single prompt").option("--tag <ids>", "comma-separated tag ids").option("--repo <urls>", "comma-separated base repo urls").option("--language <langs>", "comma-separated repo languages").option("--framework <names>", "comma-separated repo frameworks").option("--size <buckets>", "comma-separated codebase-size buckets").option("--branded", "only branded prompts").option("--unbranded", "only non-branded prompts").option("--limit <n>", "max rows (default 50)").option("--full", "return all rows (up to 1000)");
@@ -10012,7 +9471,7 @@ function noteFreshness2(f) {
10012
9471
  );
10013
9472
  }
10014
9473
  }
10015
- async function runStats(command, resource, opts, toRow8) {
9474
+ async function runStats(command, resource, opts, toRow7) {
10016
9475
  const org = resolveOrg(command);
10017
9476
  const output = resolveOutput(command);
10018
9477
  const res = await createClient().get(
@@ -10023,7 +9482,7 @@ async function runStats(command, resource, opts, toRow8) {
10023
9482
  printJson(res);
10024
9483
  return;
10025
9484
  }
10026
- printItems(res.items.map(toRow8), "table");
9485
+ printItems(res.items.map(toRow7), "table");
10027
9486
  noteFreshness2(res.freshness);
10028
9487
  }
10029
9488
  var rankingRow = (r) => ({
@@ -10062,7 +9521,7 @@ var domainRow = (r) => ({
10062
9521
  rate: pct3(r.rate),
10063
9522
  requests: r.requests
10064
9523
  });
10065
- function register28(program2) {
9524
+ function register27(program2) {
10066
9525
  const group = program2.command("stats").description("Read-only analytics over your runs");
10067
9526
  addFilterOptions(
10068
9527
  group.command("rankings").description("Brands ranked by install rate")
@@ -10094,7 +9553,7 @@ function register28(program2) {
10094
9553
  // src/commands/status.ts
10095
9554
  var status_exports = {};
10096
9555
  __export(status_exports, {
10097
- register: () => register29
9556
+ register: () => register28
10098
9557
  });
10099
9558
  function pct4(rate) {
10100
9559
  return rate == null ? "\u2014" : `${Math.round(rate * 100)}%`;
@@ -10104,7 +9563,7 @@ function delta2(pp) {
10104
9563
  const rounded = Math.round(pp);
10105
9564
  return rounded === 0 ? "" : ` (${rounded > 0 ? "+" : ""}${rounded}pp)`;
10106
9565
  }
10107
- function register29(program2) {
9566
+ function register28(program2) {
10108
9567
  program2.command("status").description("One-shot org summary: actions, visibility, agent experience").action(async (_opts, cmd) => {
10109
9568
  const org = resolveOrg(cmd);
10110
9569
  const s = await createClient().get(
@@ -10166,12 +9625,12 @@ function register29(program2) {
10166
9625
  // src/commands/tags.ts
10167
9626
  var tags_exports2 = {};
10168
9627
  __export(tags_exports2, {
10169
- register: () => register30
9628
+ register: () => register29
10170
9629
  });
10171
9630
  function tagsPath(org) {
10172
9631
  return `/api/v1/orgs/${encodeURIComponent(org)}/tags`;
10173
9632
  }
10174
- function register30(program2) {
9633
+ function register29(program2) {
10175
9634
  const group = program2.command("tags").description("Manage org tags");
10176
9635
  group.command("list").description("List tags").action(async (_opts, cmd) => {
10177
9636
  const org = resolveOrg(cmd);
@@ -10214,9 +9673,9 @@ function register30(program2) {
10214
9673
  // src/commands/usage.ts
10215
9674
  var usage_exports = {};
10216
9675
  __export(usage_exports, {
10217
- register: () => register31
9676
+ register: () => register30
10218
9677
  });
10219
- function register31(program2) {
9678
+ function register30(program2) {
10220
9679
  program2.command("usage").description("List credit ledger entries").option("--since <window>", 'e.g. "30d", "24h", or an ISO date').option("--limit <n>", "page size (1-200)", parseLimit, 50).option("--cursor <cursor>", "resume from a previous page's nextCursor").action(
10221
9680
  async (opts, cmd) => {
10222
9681
  const org = resolveOrg(cmd);
@@ -10263,7 +9722,7 @@ function register31(program2) {
10263
9722
  // src/commands/visibility.ts
10264
9723
  var visibility_exports2 = {};
10265
9724
  __export(visibility_exports2, {
10266
- register: () => register32,
9725
+ register: () => register31,
10267
9726
  visibilityPath: () => visibilityPath
10268
9727
  });
10269
9728
  import { Option as Option3 } from "commander";
@@ -10295,7 +9754,7 @@ function brandsLabel(v) {
10295
9754
  if (v.kind === "HEAD_TO_HEAD") return `${v.brandA} vs ${v.brandB}`;
10296
9755
  return v.branded ? v.brandA ?? "branded" : "organic";
10297
9756
  }
10298
- function toRow7(v) {
9757
+ function toRow6(v) {
10299
9758
  return {
10300
9759
  id: v.id,
10301
9760
  name: v.name,
@@ -10307,7 +9766,7 @@ function toRow7(v) {
10307
9766
  "last run": v.lastRunAt ?? "-"
10308
9767
  };
10309
9768
  }
10310
- function printDetail5(v) {
9769
+ function printDetail4(v) {
10311
9770
  console.log(`id: ${v.id}`);
10312
9771
  console.log(`name: ${v.name}`);
10313
9772
  console.log(`kind: ${v.kind}`);
@@ -10342,7 +9801,7 @@ function registerPreferenceGroup(group) {
10342
9801
  visibilityPath(org)
10343
9802
  );
10344
9803
  if (resolveOutput(cmd) === "json") printJson(res.items);
10345
- else printItems(res.items.map(toRow7), "table");
9804
+ else printItems(res.items.map(toRow6), "table");
10346
9805
  });
10347
9806
  group.command("get <id>").description("Show one preference prompt").action(async (id, _opts, cmd) => {
10348
9807
  const org = resolveOrg(cmd);
@@ -10350,7 +9809,7 @@ function registerPreferenceGroup(group) {
10350
9809
  `${visibilityPath(org)}/${encodeURIComponent(id)}`
10351
9810
  );
10352
9811
  if (resolveOutput(cmd) === "json") printJson(vp);
10353
- else printDetail5(vp);
9812
+ else printDetail4(vp);
10354
9813
  });
10355
9814
  addRunSettingsCreateOptions(
10356
9815
  group.command("create").description(
@@ -10619,7 +10078,7 @@ function registerPreferenceGroup(group) {
10619
10078
  );
10620
10079
  });
10621
10080
  }
10622
- function register32(program2) {
10081
+ function register31(program2) {
10623
10082
  const preference = program2.command("preference").description("Manage Agent Preference prompts and measured markets");
10624
10083
  registerPreferenceGroup(preference);
10625
10084
  const legacy = program2.command("visibility", { hidden: true });
@@ -10655,7 +10114,6 @@ for (const group of [
10655
10114
  runs_exports2,
10656
10115
  runRequests_exports2,
10657
10116
  optimizations_exports2,
10658
- experiments_exports2,
10659
10117
  apply_exports,
10660
10118
  batches_exports,
10661
10119
  brands_exports2,