@withgauge/cli 0.9.0 → 0.10.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.
- package/README.md +2 -1
- package/dist/index.js +1487 -302
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -116,6 +116,34 @@ var sessionUsageSchema = z3.object({
|
|
|
116
116
|
cacheReadInputTokens: z3.number().int().nonnegative(),
|
|
117
117
|
cacheCreationInputTokens: z3.number().int().nonnegative()
|
|
118
118
|
});
|
|
119
|
+
var sessionFindingSchema = z3.object({
|
|
120
|
+
title: z3.string().min(1).max(160),
|
|
121
|
+
detail: z3.string().min(1).max(600),
|
|
122
|
+
evidence: z3.array(
|
|
123
|
+
z3.object({
|
|
124
|
+
seq: z3.number().int().nonnegative(),
|
|
125
|
+
quote: z3.string().min(1).max(500)
|
|
126
|
+
})
|
|
127
|
+
).min(1).max(4)
|
|
128
|
+
});
|
|
129
|
+
var onboardingSchema = z3.object({
|
|
130
|
+
status: z3.enum(["verified", "login_required", "not_verified"]),
|
|
131
|
+
detail: z3.string().min(1).max(600),
|
|
132
|
+
evidence: z3.array(
|
|
133
|
+
z3.object({
|
|
134
|
+
kind: z3.enum(["credentials", "operation", "blocker"]),
|
|
135
|
+
seq: z3.number().int().nonnegative(),
|
|
136
|
+
quote: z3.string().min(1).max(500)
|
|
137
|
+
})
|
|
138
|
+
).max(6)
|
|
139
|
+
});
|
|
140
|
+
var sessionAnalysisSchema = z3.object({
|
|
141
|
+
status: z3.enum(["complete", "unavailable"]),
|
|
142
|
+
onboarding: onboardingSchema.optional(),
|
|
143
|
+
hallucinatedUrls: z3.array(sessionFindingSchema).max(8),
|
|
144
|
+
blockers: z3.array(sessionFindingSchema).max(8),
|
|
145
|
+
suggestedChanges: z3.array(sessionFindingSchema).max(8)
|
|
146
|
+
});
|
|
119
147
|
var sessionSchema = z3.object({
|
|
120
148
|
id: z3.string().regex(/^[a-z0-9-]+$/),
|
|
121
149
|
name: z3.string().min(1),
|
|
@@ -126,10 +154,43 @@ var sessionSchema = z3.object({
|
|
|
126
154
|
auth: z3.number().int(),
|
|
127
155
|
pricing: z3.number().int(),
|
|
128
156
|
pricingReview: z3.string(),
|
|
157
|
+
analysis: sessionAnalysisSchema.optional(),
|
|
129
158
|
/** The alg run id the transcript was recorded from. */
|
|
130
159
|
run: z3.string().min(1),
|
|
131
160
|
completed: z3.boolean(),
|
|
132
|
-
usage: sessionUsageSchema.nullable()
|
|
161
|
+
usage: sessionUsageSchema.nullable(),
|
|
162
|
+
/** Public Gauge run page. Null while unpublished (e.g. a private
|
|
163
|
+
* calibration org) — never a guessed org-scoped URL. */
|
|
164
|
+
gaugeUrl: z3.string().url().nullable().default(null)
|
|
165
|
+
});
|
|
166
|
+
var sessionProgressStatusSchema = z3.enum([
|
|
167
|
+
"queued",
|
|
168
|
+
"running",
|
|
169
|
+
"complete",
|
|
170
|
+
"failed",
|
|
171
|
+
"timed_out"
|
|
172
|
+
]);
|
|
173
|
+
var checkProgressStatusSchema = z3.enum([
|
|
174
|
+
"queued",
|
|
175
|
+
"scanning",
|
|
176
|
+
"fundamentals_ready",
|
|
177
|
+
"sessions_queued",
|
|
178
|
+
"sessions_running",
|
|
179
|
+
"complete",
|
|
180
|
+
"failed"
|
|
181
|
+
]);
|
|
182
|
+
var progressSchema = z3.object({
|
|
183
|
+
status: checkProgressStatusSchema,
|
|
184
|
+
/** Checks ahead of this one in the sessions queue; null when unknown. */
|
|
185
|
+
queuePosition: z3.number().int().nonnegative().nullable(),
|
|
186
|
+
/** When the daily USD budget that is holding this check's sessions back
|
|
187
|
+
* resets (the next 00:00 UTC). Null unless the check is waiting on it.
|
|
188
|
+
* Optional: the contract landed before the budget was specified, so a
|
|
189
|
+
* reader that predates it still parses. */
|
|
190
|
+
resumesAt: z3.string().datetime().nullable().optional(),
|
|
191
|
+
sessions: z3.array(
|
|
192
|
+
z3.object({ id: z3.string().min(1), status: sessionProgressStatusSchema })
|
|
193
|
+
)
|
|
133
194
|
});
|
|
134
195
|
var accessSchema = z3.object({
|
|
135
196
|
status: checkStatusSchema,
|
|
@@ -140,7 +201,36 @@ var gradeSchema = z3.object({
|
|
|
140
201
|
letter: z3.string().min(1),
|
|
141
202
|
score: z3.number().int(),
|
|
142
203
|
maxScore: z3.number().int().positive(),
|
|
143
|
-
status: z3.string()
|
|
204
|
+
status: z3.string(),
|
|
205
|
+
/** True until the calibration corpus backing the grade is annotated.
|
|
206
|
+
* `publishableScore` stays null while this is true. */
|
|
207
|
+
provisional: z3.boolean().default(true)
|
|
208
|
+
});
|
|
209
|
+
var verdictSchema = z3.object({
|
|
210
|
+
headline: z3.string().min(1),
|
|
211
|
+
detail: z3.string().min(1)
|
|
212
|
+
});
|
|
213
|
+
var recentCheckSchema = z3.object({
|
|
214
|
+
domain: z3.string().min(1),
|
|
215
|
+
/** ISO date (YYYY-MM-DD) the report was completed. */
|
|
216
|
+
date: z3.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
217
|
+
grade: gradeSchema,
|
|
218
|
+
verdict: z3.object({ headline: z3.string().min(1) }),
|
|
219
|
+
logoUrl: z3.string().url().nullable().default(null),
|
|
220
|
+
/** See `reportSchema.logoTone`. */
|
|
221
|
+
logoTone: z3.enum(["light", "dark"]).nullable().default(null),
|
|
222
|
+
/** The product's name as the fast pass read it (see `reportSchema`). */
|
|
223
|
+
productName: z3.string().nullable().default(null),
|
|
224
|
+
completedAt: z3.string().datetime()
|
|
225
|
+
});
|
|
226
|
+
var recentChecksSchema = z3.array(recentCheckSchema);
|
|
227
|
+
var applicabilitySchema = z3.enum([
|
|
228
|
+
"developer-product",
|
|
229
|
+
"not-applicable"
|
|
230
|
+
]);
|
|
231
|
+
var homepageNegotiationSchema = z3.object({
|
|
232
|
+
markdown: z3.boolean(),
|
|
233
|
+
contentType: z3.string()
|
|
144
234
|
});
|
|
145
235
|
var reportSchema = z3.object({
|
|
146
236
|
domain: z3.string().min(1),
|
|
@@ -151,11 +241,32 @@ var reportSchema = z3.object({
|
|
|
151
241
|
sessionSummary: z3.string(),
|
|
152
242
|
access: accessSchema,
|
|
153
243
|
grade: gradeSchema,
|
|
244
|
+
verdict: verdictSchema,
|
|
154
245
|
checks: z3.array(fundamentalSchema).min(1),
|
|
155
246
|
surfaces: z3.array(surfaceSchema),
|
|
156
247
|
sessions: z3.array(sessionSchema),
|
|
157
248
|
/** Surface kinds that were not assessed at all (not absent, not failing). */
|
|
158
|
-
unassessed: z3.array(z3.string())
|
|
249
|
+
unassessed: z3.array(z3.string()),
|
|
250
|
+
/** Live status while the check is still in flight. Absent once the caller
|
|
251
|
+
* has no better source than the final report (e.g. recorded fixtures). */
|
|
252
|
+
progress: progressSchema.optional(),
|
|
253
|
+
/** `apple-touch-icon` / `icon`, else null. Never guessed. */
|
|
254
|
+
logoUrl: z3.string().url().nullable().default(null),
|
|
255
|
+
/** Whether `logoUrl`'s mark is light or dark, measured from its pixels by
|
|
256
|
+
* the fast pass, so the card can pick a ground it shows up against. Null
|
|
257
|
+
* when no icon was measured (none declared, an `.ico`, a fetch failure) —
|
|
258
|
+
* "unknown", never a guess. */
|
|
259
|
+
logoTone: z3.enum(["light", "dark"]).nullable().default(null),
|
|
260
|
+
/** `og:site_name`, else the `<title>` before its first separator, else
|
|
261
|
+
* null — the fast pass's reading, never guessed (the domain is the
|
|
262
|
+
* reader's fallback, so "no name" and "the name is the domain" stay
|
|
263
|
+
* distinguishable). The header shows it above the domain. */
|
|
264
|
+
productName: z3.string().nullable().default(null),
|
|
265
|
+
/** See `applicabilitySchema` above. */
|
|
266
|
+
applicability: applicabilitySchema.default("developer-product"),
|
|
267
|
+
/** Null when unmeasured (a report stored before this field existed, or the
|
|
268
|
+
* fetch failed for our own reasons) — never a guess. */
|
|
269
|
+
homepageNegotiation: homepageNegotiationSchema.nullable().default(null)
|
|
159
270
|
});
|
|
160
271
|
var sessionEventSchema = z3.looseObject({
|
|
161
272
|
type: z3.string(),
|
|
@@ -167,6 +278,15 @@ var transcriptSchema = z3.object({
|
|
|
167
278
|
model: z3.string().min(1),
|
|
168
279
|
events: z3.array(sessionEventSchema)
|
|
169
280
|
});
|
|
281
|
+
var liveTranscriptSchema = z3.object({
|
|
282
|
+
id: z3.string().min(1),
|
|
283
|
+
status: sessionProgressStatusSchema,
|
|
284
|
+
/** True once nothing further will ever arrive for this session (it has
|
|
285
|
+
* settled, one way or another) — the signal to stop polling. */
|
|
286
|
+
complete: z3.boolean(),
|
|
287
|
+
events: z3.array(sessionEventSchema),
|
|
288
|
+
nextAfter: z3.number().int().nonnegative()
|
|
289
|
+
});
|
|
170
290
|
|
|
171
291
|
// ../packages/api-schemas/src/batteries.ts
|
|
172
292
|
var batteries_exports = {};
|
|
@@ -2115,6 +2235,15 @@ var reingestSkillResponseSchema = z24.object({
|
|
|
2115
2235
|
/** True = "already current": the source content matches the newest version. */
|
|
2116
2236
|
unchanged: z24.boolean()
|
|
2117
2237
|
});
|
|
2238
|
+
var addSkillVersionBodySchema = z24.object({
|
|
2239
|
+
reference: z24.string().min(1),
|
|
2240
|
+
/** Omitted defaults to the ref name (branch/tag), else the anchor. */
|
|
2241
|
+
label: z24.string().min(1).max(120).optional()
|
|
2242
|
+
});
|
|
2243
|
+
var addSkillVersionResponseSchema = z24.object({
|
|
2244
|
+
label: z24.string(),
|
|
2245
|
+
unchanged: z24.boolean()
|
|
2246
|
+
});
|
|
2118
2247
|
var skillRunWireSchema = z24.object({
|
|
2119
2248
|
runId: z24.string(),
|
|
2120
2249
|
agent: z24.string(),
|
|
@@ -2317,375 +2446,844 @@ var meResponseSchema = z26.object({
|
|
|
2317
2446
|
orgs: z26.array(meOrgSchema)
|
|
2318
2447
|
});
|
|
2319
2448
|
|
|
2320
|
-
// ../packages/api-schemas/src/
|
|
2449
|
+
// ../packages/api-schemas/src/optimizations.ts
|
|
2450
|
+
import { z as z29 } from "zod";
|
|
2451
|
+
|
|
2452
|
+
// ../packages/api-schemas/src/climb.ts
|
|
2453
|
+
import { z as z28 } from "zod";
|
|
2454
|
+
|
|
2455
|
+
// ../packages/api-schemas/src/climb-kinds.ts
|
|
2456
|
+
var LEVER_KINDS = [
|
|
2457
|
+
"DOCS",
|
|
2458
|
+
"MARKETING_SITE",
|
|
2459
|
+
"SDK",
|
|
2460
|
+
"CLI",
|
|
2461
|
+
"SKILL"
|
|
2462
|
+
];
|
|
2463
|
+
var INTERVENTION_KINDS = [
|
|
2464
|
+
"BASELINE",
|
|
2465
|
+
"ADD_SKILL",
|
|
2466
|
+
"REMOVE_SKILL",
|
|
2467
|
+
"EDIT_SKILL",
|
|
2468
|
+
"REWRITE_DOCS",
|
|
2469
|
+
"PACKAGE_VERSION",
|
|
2470
|
+
"PACKAGE_CONTENT",
|
|
2471
|
+
"CLI_VERSION"
|
|
2472
|
+
];
|
|
2473
|
+
var LEVER_INTERVENTIONS = {
|
|
2474
|
+
DOCS: ["REWRITE_DOCS"],
|
|
2475
|
+
MARKETING_SITE: ["REWRITE_DOCS"],
|
|
2476
|
+
SDK: ["PACKAGE_VERSION", "PACKAGE_CONTENT"],
|
|
2477
|
+
CLI: ["CLI_VERSION"],
|
|
2478
|
+
SKILL: ["ADD_SKILL", "REMOVE_SKILL", "EDIT_SKILL"]
|
|
2479
|
+
};
|
|
2480
|
+
|
|
2481
|
+
// ../packages/api-schemas/src/sandbox-overrides.ts
|
|
2321
2482
|
import { z as z27 } from "zod";
|
|
2322
|
-
var
|
|
2483
|
+
var SANDBOX_OVERRIDE_KINDS = ["packages", "clis"];
|
|
2484
|
+
var ecosystemSchema = z27.enum(["npm", "pypi", "cargo", "go", "gem"]);
|
|
2485
|
+
var overrideFilesSchema = z27.array(
|
|
2486
|
+
z27.object({
|
|
2487
|
+
path: z27.string().min(1).refine(
|
|
2488
|
+
(path) => !path.startsWith("/") && !path.includes("\\") && !path.split("/").includes(".."),
|
|
2489
|
+
"Use a relative path within the target"
|
|
2490
|
+
),
|
|
2491
|
+
body: z27.string()
|
|
2492
|
+
}).strict()
|
|
2493
|
+
).min(1);
|
|
2494
|
+
var contentShape = {
|
|
2495
|
+
version: z27.string().trim().min(1).optional(),
|
|
2496
|
+
files: overrideFilesSchema.optional()
|
|
2497
|
+
};
|
|
2498
|
+
var hasContent = (value) => value.version !== void 0 || value.files !== void 0;
|
|
2499
|
+
var sandboxOverridesSchema = z27.object({
|
|
2500
|
+
version: z27.literal(1),
|
|
2501
|
+
packages: z27.array(
|
|
2502
|
+
z27.object({
|
|
2503
|
+
ecosystem: ecosystemSchema,
|
|
2504
|
+
name: z27.string().trim().min(1),
|
|
2505
|
+
...contentShape
|
|
2506
|
+
}).strict().refine(hasContent, "Specify a version or files")
|
|
2507
|
+
).optional(),
|
|
2508
|
+
clis: z27.array(
|
|
2509
|
+
z27.object({
|
|
2510
|
+
name: z27.string().trim().min(1),
|
|
2511
|
+
...contentShape
|
|
2512
|
+
}).strict().refine(hasContent, "Specify a version or files")
|
|
2513
|
+
).optional()
|
|
2514
|
+
}).strict().superRefine((value, ctx) => {
|
|
2515
|
+
const identities = {
|
|
2516
|
+
packages: (value.packages ?? []).map(
|
|
2517
|
+
(entry) => JSON.stringify([entry.ecosystem, entry.name])
|
|
2518
|
+
),
|
|
2519
|
+
clis: (value.clis ?? []).map((entry) => entry.name)
|
|
2520
|
+
};
|
|
2521
|
+
for (const kind of SANDBOX_OVERRIDE_KINDS) {
|
|
2522
|
+
if (new Set(identities[kind]).size !== identities[kind].length)
|
|
2523
|
+
ctx.addIssue({
|
|
2524
|
+
code: "custom",
|
|
2525
|
+
path: [kind],
|
|
2526
|
+
message: "Duplicate override identity"
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2529
|
+
if (new TextEncoder().encode(JSON.stringify(value)).byteLength >= 1e6)
|
|
2530
|
+
ctx.addIssue({
|
|
2531
|
+
code: "custom",
|
|
2532
|
+
message: "Sandbox overrides must be under 1 MB"
|
|
2533
|
+
});
|
|
2534
|
+
});
|
|
2535
|
+
|
|
2536
|
+
// ../packages/api-schemas/src/climb.ts
|
|
2537
|
+
var climbSubjectKindSchema = z28.enum(["EVAL_SET", "VISIBILITY_PROMPT"]);
|
|
2538
|
+
var leverKindSchema = z28.enum(LEVER_KINDS);
|
|
2539
|
+
var interventionKindSchema = z28.enum(INTERVENTION_KINDS);
|
|
2540
|
+
var skill = z28.object({ skillVersionId: z28.string().min(1) }).strict();
|
|
2541
|
+
var empty = z28.object({}).strict();
|
|
2542
|
+
function validateFixtureIntervention(value, ctx) {
|
|
2543
|
+
const result = webFixtureSchema.safeParse({ version: 1, ...value });
|
|
2544
|
+
if (!result.success) {
|
|
2545
|
+
for (const issue of result.error.issues) {
|
|
2546
|
+
ctx.addIssue({
|
|
2547
|
+
code: "custom",
|
|
2548
|
+
path: issue.path,
|
|
2549
|
+
message: issue.message
|
|
2550
|
+
});
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
var interventionSchema = z28.discriminatedUnion("kind", [
|
|
2555
|
+
z28.object({ kind: z28.literal("BASELINE"), after: empty }),
|
|
2556
|
+
z28.object({ kind: z28.literal("ADD_SKILL"), after: skill }),
|
|
2557
|
+
z28.object({ kind: z28.literal("REMOVE_SKILL"), before: skill, after: empty }),
|
|
2558
|
+
z28.object({ kind: z28.literal("EDIT_SKILL"), before: skill, after: skill }),
|
|
2559
|
+
z28.object({
|
|
2560
|
+
kind: z28.literal("REWRITE_DOCS"),
|
|
2561
|
+
before: z28.json().optional(),
|
|
2562
|
+
after: z28.object({ pages: webFixtureSchema.shape.pages.unwrap().min(1) }).strict().superRefine(validateFixtureIntervention)
|
|
2563
|
+
}),
|
|
2564
|
+
z28.object({
|
|
2565
|
+
kind: z28.literal("PACKAGE_VERSION"),
|
|
2566
|
+
after: z28.object({
|
|
2567
|
+
ecosystem: ecosystemSchema,
|
|
2568
|
+
name: z28.string().min(1),
|
|
2569
|
+
version: z28.string().min(1)
|
|
2570
|
+
}).strict()
|
|
2571
|
+
}),
|
|
2572
|
+
z28.object({
|
|
2573
|
+
kind: z28.literal("PACKAGE_CONTENT"),
|
|
2574
|
+
after: z28.object({
|
|
2575
|
+
ecosystem: ecosystemSchema,
|
|
2576
|
+
name: z28.string().min(1),
|
|
2577
|
+
files: overrideFilesSchema
|
|
2578
|
+
}).strict()
|
|
2579
|
+
}),
|
|
2580
|
+
z28.object({
|
|
2581
|
+
kind: z28.literal("CLI_VERSION"),
|
|
2582
|
+
after: z28.object({ name: z28.string().min(1), version: z28.string().min(1) }).strict()
|
|
2583
|
+
})
|
|
2584
|
+
]);
|
|
2585
|
+
var climbSettingsSchema = z28.object({
|
|
2586
|
+
maxRounds: z28.number().int().positive().default(5),
|
|
2587
|
+
sampleCount: z28.number().int().positive().default(1),
|
|
2588
|
+
creditCap: z28.number().int().nonnegative(),
|
|
2589
|
+
exploreModel: z28.string().min(1).optional(),
|
|
2590
|
+
autoAdopt: z28.boolean().default(false),
|
|
2591
|
+
targetScore: z28.number().min(0).max(1).default(1),
|
|
2592
|
+
// Narrow the subject's whole roster to one slot, for the baseline and every
|
|
2593
|
+
// trial alike. A subject rostering ten models otherwise multiplies every
|
|
2594
|
+
// trial by ten, and a one-model trial measured against a ten-model baseline
|
|
2595
|
+
// is not a comparison. `pinnedModel` empty means the agent's default model.
|
|
2596
|
+
pinnedAgent: schedulableAgentSchema.optional(),
|
|
2597
|
+
pinnedModel: z28.string().optional()
|
|
2598
|
+
}).strict().refine((value) => value.pinnedAgent !== void 0 || !value.pinnedModel, {
|
|
2599
|
+
path: ["pinnedAgent"],
|
|
2600
|
+
message: "Pin an agent with the model"
|
|
2601
|
+
});
|
|
2602
|
+
var climbConfigSnapshotSchema = z28.object({
|
|
2603
|
+
promptText: z28.string(),
|
|
2604
|
+
scenario: z28.enum(["GREENFIELD", "MIGRATION"]),
|
|
2605
|
+
repoUrl: z28.string().nullable(),
|
|
2606
|
+
repoRef: z28.string().nullable(),
|
|
2607
|
+
profileId: z28.string().nullable(),
|
|
2608
|
+
profileName: z28.string().nullable(),
|
|
2609
|
+
profileDescription: z28.string().nullable(),
|
|
2610
|
+
profileModel: z28.string().nullable(),
|
|
2611
|
+
limits: z28.json(),
|
|
2612
|
+
agents: z28.array(agentConfigSchema).min(1),
|
|
2613
|
+
skillRefs: z28.array(z28.string()),
|
|
2614
|
+
mcpRefs: z28.array(z28.string()),
|
|
2615
|
+
skillVersionIds: z28.array(z28.string()),
|
|
2616
|
+
mcpServerVersionIds: z28.array(z28.string()),
|
|
2617
|
+
skillSet: z28.json().nullable(),
|
|
2618
|
+
mcpSet: z28.json().nullable(),
|
|
2619
|
+
connectionIds: z28.array(z28.string()),
|
|
2620
|
+
connectionSet: z28.json().nullable(),
|
|
2621
|
+
agentContext: z28.json().nullable(),
|
|
2622
|
+
agentContextDigest: z28.string().nullable(),
|
|
2623
|
+
webFixture: webFixtureSchema.nullable(),
|
|
2624
|
+
sandboxOverrides: sandboxOverridesSchema.nullable(),
|
|
2625
|
+
visibilityScenarioId: z28.string().nullable()
|
|
2626
|
+
}).strict();
|
|
2627
|
+
var targetRefSchema = z28.object({
|
|
2628
|
+
kind: z28.string().min(1),
|
|
2629
|
+
id: z28.string().optional(),
|
|
2630
|
+
url: z28.url().optional(),
|
|
2631
|
+
package: z28.string().optional()
|
|
2632
|
+
}).strict();
|
|
2633
|
+
var trialInputSchema = z28.object({
|
|
2634
|
+
title: z28.string().trim().min(1).max(200),
|
|
2635
|
+
hypothesis: z28.string().max(4e3).optional(),
|
|
2636
|
+
lever: leverKindSchema,
|
|
2637
|
+
targetRef: targetRefSchema.optional(),
|
|
2638
|
+
intervention: interventionSchema,
|
|
2639
|
+
authorMode: z28.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL")
|
|
2640
|
+
}).strict().superRefine((value, ctx) => {
|
|
2641
|
+
const allowed = LEVER_INTERVENTIONS[value.lever];
|
|
2642
|
+
if (!allowed.includes(value.intervention.kind))
|
|
2643
|
+
ctx.addIssue({
|
|
2644
|
+
code: "custom",
|
|
2645
|
+
path: ["intervention", "kind"],
|
|
2646
|
+
message: "This intervention does not change the selected lever"
|
|
2647
|
+
});
|
|
2648
|
+
});
|
|
2649
|
+
|
|
2650
|
+
// ../packages/api-schemas/src/optimizations.ts
|
|
2651
|
+
var OPTIMIZATION_STATUSES = [
|
|
2652
|
+
"ACTIVE",
|
|
2653
|
+
"PAUSED",
|
|
2654
|
+
"DONE",
|
|
2655
|
+
"ARCHIVED"
|
|
2656
|
+
];
|
|
2657
|
+
var optimizationStatusSchema = z29.enum(OPTIMIZATION_STATUSES);
|
|
2658
|
+
var ROUND_STATUSES = [
|
|
2659
|
+
"PROPOSING",
|
|
2660
|
+
"RUNNING",
|
|
2661
|
+
"JUDGING",
|
|
2662
|
+
"SETTLED",
|
|
2663
|
+
"FAILED",
|
|
2664
|
+
"CANCELED"
|
|
2665
|
+
];
|
|
2666
|
+
var TRIAL_STATUSES = [
|
|
2667
|
+
"DRAFT",
|
|
2668
|
+
"RUNNING",
|
|
2669
|
+
"SETTLED",
|
|
2670
|
+
"FAILED",
|
|
2671
|
+
"CANCELED"
|
|
2672
|
+
];
|
|
2673
|
+
var TRIAL_VERDICTS = [
|
|
2674
|
+
"BETTER",
|
|
2675
|
+
"WORSE",
|
|
2676
|
+
"INCONCLUSIVE",
|
|
2677
|
+
"NOT_EVALUABLE"
|
|
2678
|
+
];
|
|
2679
|
+
var OPTIMIZATION_EFFORTS = [
|
|
2680
|
+
{ value: "LOW", label: "Quick", sampleCount: 1, maxRounds: 3 },
|
|
2681
|
+
{ value: "MEDIUM", label: "Standard", sampleCount: 1, maxRounds: 5 },
|
|
2682
|
+
{ value: "HIGH", label: "Thorough", sampleCount: 2, maxRounds: 8 },
|
|
2683
|
+
{ value: "XHIGH", label: "Exhaustive", sampleCount: 3, maxRounds: 12 }
|
|
2684
|
+
];
|
|
2685
|
+
var optimizationEffortSchema = z29.enum(
|
|
2686
|
+
OPTIMIZATION_EFFORTS.map((preset) => preset.value)
|
|
2687
|
+
);
|
|
2688
|
+
var listOptimizationsQuerySchema = z29.object({
|
|
2689
|
+
status: z29.string().optional().transform(
|
|
2690
|
+
(value) => value ? value.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean) : void 0
|
|
2691
|
+
).pipe(z29.array(optimizationStatusSchema).optional()),
|
|
2692
|
+
subjectKind: climbSubjectKindSchema.optional(),
|
|
2693
|
+
subjectId: z29.string().min(1).optional(),
|
|
2694
|
+
limit: z29.coerce.number().int().min(1).max(200).default(50)
|
|
2695
|
+
});
|
|
2696
|
+
var optimizationSummarySchema = z29.object({
|
|
2697
|
+
id: z29.string(),
|
|
2698
|
+
name: z29.string(),
|
|
2699
|
+
status: optimizationStatusSchema,
|
|
2700
|
+
mode: z29.enum(["MANUAL", "AUTO"]),
|
|
2701
|
+
stopReason: z29.string().nullable(),
|
|
2702
|
+
subjectKind: climbSubjectKindSchema,
|
|
2703
|
+
subjectId: z29.string(),
|
|
2704
|
+
subjectName: z29.string(),
|
|
2705
|
+
lever: leverKindSchema.nullable(),
|
|
2706
|
+
round: z29.number().int(),
|
|
2707
|
+
maxRounds: z29.number().int(),
|
|
2708
|
+
/** Starting baseline score, 0..1. */
|
|
2709
|
+
before: z29.number().nullable(),
|
|
2710
|
+
/** Score of the adopted tip, 0..1. */
|
|
2711
|
+
after: z29.number().nullable(),
|
|
2712
|
+
/** Percentage-point change from the starting baseline to the adopted tip. */
|
|
2713
|
+
delta: z29.number().nullable(),
|
|
2714
|
+
/** Score after each round, baseline first. */
|
|
2715
|
+
path: z29.array(z29.number()),
|
|
2716
|
+
creditsSpent: z29.number().int(),
|
|
2717
|
+
creditsReserved: z29.number().int(),
|
|
2718
|
+
summary: z29.string().nullable(),
|
|
2719
|
+
href: z29.string(),
|
|
2720
|
+
createdAt: z29.string(),
|
|
2721
|
+
updatedAt: z29.string()
|
|
2722
|
+
});
|
|
2723
|
+
var listOptimizationsResponseSchema = z29.object({
|
|
2724
|
+
items: z29.array(optimizationSummarySchema)
|
|
2725
|
+
});
|
|
2726
|
+
var targetSchema = z29.object({
|
|
2727
|
+
agent: schedulableAgentSchema.optional(),
|
|
2728
|
+
/** Empty or omitted means the agent's default model. */
|
|
2729
|
+
model: z29.string().optional()
|
|
2730
|
+
});
|
|
2731
|
+
var planShape = {
|
|
2732
|
+
effort: optimizationEffortSchema.optional(),
|
|
2733
|
+
sampleCount: z29.number().int().min(1).max(100).optional(),
|
|
2734
|
+
maxRounds: z29.number().int().min(1).max(100).optional()
|
|
2735
|
+
};
|
|
2736
|
+
function refinePlan(value, ctx) {
|
|
2737
|
+
if (value.effort && (value.sampleCount || value.maxRounds))
|
|
2738
|
+
ctx.addIssue({
|
|
2739
|
+
code: "custom",
|
|
2740
|
+
path: ["effort"],
|
|
2741
|
+
message: "Pass effort or sampleCount/maxRounds, not both"
|
|
2742
|
+
});
|
|
2743
|
+
if (value.target?.model && !value.target.agent)
|
|
2744
|
+
ctx.addIssue({
|
|
2745
|
+
code: "custom",
|
|
2746
|
+
path: ["target", "agent"],
|
|
2747
|
+
message: "Pin an agent with the model"
|
|
2748
|
+
});
|
|
2749
|
+
}
|
|
2750
|
+
var startOptimizationBodySchema = z29.object({
|
|
2751
|
+
subjectKind: climbSubjectKindSchema,
|
|
2752
|
+
subjectId: z29.string().min(1),
|
|
2753
|
+
name: z29.string().trim().min(1).max(200).optional(),
|
|
2754
|
+
...planShape,
|
|
2755
|
+
creditCap: z29.number().int().nonnegative().optional(),
|
|
2756
|
+
autoAdopt: z29.boolean().default(true),
|
|
2757
|
+
targetScore: z29.number().min(0).max(1).optional(),
|
|
2758
|
+
target: targetSchema.extend({ agent: schedulableAgentSchema })
|
|
2759
|
+
}).strict().superRefine(refinePlan);
|
|
2760
|
+
var estimateOptimizationBodySchema = z29.object({
|
|
2761
|
+
subjectKind: climbSubjectKindSchema,
|
|
2762
|
+
subjectId: z29.string().min(1),
|
|
2763
|
+
...planShape,
|
|
2764
|
+
target: targetSchema.optional()
|
|
2765
|
+
}).strict().superRefine(refinePlan);
|
|
2766
|
+
var optimizationEstimateSchema = z29.object({
|
|
2767
|
+
sampleCount: z29.number().int(),
|
|
2768
|
+
maxRounds: z29.number().int(),
|
|
2769
|
+
runsPerTrial: z29.number(),
|
|
2770
|
+
executionCredits: z29.number(),
|
|
2771
|
+
judgeCredits: z29.number(),
|
|
2772
|
+
leverPassCredits: z29.number(),
|
|
2773
|
+
trialCredits: z29.number(),
|
|
2774
|
+
/** Whole credits for the full climb; this is what start reserves. */
|
|
2775
|
+
estimate: z29.number().int()
|
|
2776
|
+
});
|
|
2777
|
+
var diagnoseBodySchema = z29.object({
|
|
2778
|
+
subjectKind: climbSubjectKindSchema,
|
|
2779
|
+
subjectId: z29.string().min(1)
|
|
2780
|
+
}).strict();
|
|
2781
|
+
var diagnosisSchema = z29.object({
|
|
2782
|
+
id: z29.string(),
|
|
2783
|
+
status: z29.enum(["GENERATING", "READY", "FAILED"]),
|
|
2784
|
+
subjectKind: climbSubjectKindSchema,
|
|
2785
|
+
subjectId: z29.string(),
|
|
2786
|
+
runCount: z29.number().int(),
|
|
2787
|
+
summary: z29.string().nullable(),
|
|
2788
|
+
recommendedLever: leverKindSchema.nullable(),
|
|
2789
|
+
recommendedTarget: z29.unknown().nullable(),
|
|
2790
|
+
clusters: z29.array(
|
|
2791
|
+
z29.object({
|
|
2792
|
+
title: z29.string(),
|
|
2793
|
+
failureMode: z29.string(),
|
|
2794
|
+
criterionIds: z29.array(z29.string()),
|
|
2795
|
+
runIds: z29.array(z29.string()),
|
|
2796
|
+
lever: leverKindSchema.nullable(),
|
|
2797
|
+
targetRef: z29.unknown().nullable(),
|
|
2798
|
+
confidence: z29.number()
|
|
2799
|
+
})
|
|
2800
|
+
),
|
|
2801
|
+
createdAt: z29.string()
|
|
2802
|
+
});
|
|
2803
|
+
var trialRunSchema = z29.object({
|
|
2804
|
+
id: z29.string(),
|
|
2805
|
+
status: z29.string(),
|
|
2806
|
+
passed: z29.boolean().nullable(),
|
|
2807
|
+
criteria: z29.array(
|
|
2808
|
+
z29.object({ name: z29.string(), passed: z29.boolean(), reasoning: z29.string() })
|
|
2809
|
+
),
|
|
2810
|
+
levers: z29.array(
|
|
2811
|
+
z29.object({
|
|
2812
|
+
lever: z29.string(),
|
|
2813
|
+
attributed: z29.boolean(),
|
|
2814
|
+
note: z29.string().nullable()
|
|
2815
|
+
})
|
|
2816
|
+
)
|
|
2817
|
+
});
|
|
2818
|
+
var trialSchema = z29.object({
|
|
2819
|
+
id: z29.string(),
|
|
2820
|
+
climbId: z29.string(),
|
|
2821
|
+
roundNumber: z29.number().int(),
|
|
2822
|
+
key: z29.string(),
|
|
2823
|
+
parentTrialId: z29.string().nullable(),
|
|
2824
|
+
parentKey: z29.string().nullable(),
|
|
2825
|
+
title: z29.string(),
|
|
2826
|
+
hypothesis: z29.string().nullable(),
|
|
2827
|
+
lever: leverKindSchema.nullable(),
|
|
2828
|
+
kind: interventionKindSchema,
|
|
2829
|
+
status: z29.enum(TRIAL_STATUSES),
|
|
2830
|
+
verdict: z29.enum(TRIAL_VERDICTS).nullable(),
|
|
2831
|
+
score: z29.number().nullable(),
|
|
2832
|
+
baselineScore: z29.number().nullable(),
|
|
2833
|
+
/** Judged sessions behind `score`. */
|
|
2834
|
+
sessions: z29.number().int(),
|
|
2835
|
+
explore: z29.boolean(),
|
|
2836
|
+
isBaseline: z29.boolean(),
|
|
2837
|
+
adopted: z29.boolean(),
|
|
2838
|
+
adoptedAt: z29.string().nullable(),
|
|
2839
|
+
outcome: z29.string().nullable(),
|
|
2840
|
+
/** The kind-specific `after` payload (skill version id, pages, package). */
|
|
2841
|
+
after: z29.unknown(),
|
|
2842
|
+
before: z29.unknown(),
|
|
2843
|
+
runs: z29.array(trialRunSchema),
|
|
2844
|
+
createdAt: z29.string()
|
|
2845
|
+
});
|
|
2846
|
+
var roundSchema = z29.object({
|
|
2847
|
+
id: z29.string(),
|
|
2848
|
+
number: z29.number().int(),
|
|
2849
|
+
status: z29.enum(ROUND_STATUSES),
|
|
2850
|
+
narrative: z29.string().nullable(),
|
|
2851
|
+
trials: z29.array(trialSchema)
|
|
2852
|
+
});
|
|
2853
|
+
var optimizationDetailSchema = optimizationSummarySchema.extend({
|
|
2854
|
+
baselineTrialId: z29.string().nullable(),
|
|
2855
|
+
settings: z29.object({
|
|
2856
|
+
sampleCount: z29.number().int(),
|
|
2857
|
+
maxRounds: z29.number().int(),
|
|
2858
|
+
creditCap: z29.number().int(),
|
|
2859
|
+
autoAdopt: z29.boolean(),
|
|
2860
|
+
targetScore: z29.number(),
|
|
2861
|
+
exploreModel: z29.string().nullable(),
|
|
2862
|
+
pinnedAgent: z29.string().nullable(),
|
|
2863
|
+
pinnedModel: z29.string().nullable()
|
|
2864
|
+
}),
|
|
2865
|
+
diagnosis: diagnosisSchema.nullable(),
|
|
2866
|
+
rounds: z29.array(roundSchema)
|
|
2867
|
+
});
|
|
2868
|
+
var listTrialsResponseSchema = z29.object({
|
|
2869
|
+
items: z29.array(trialSchema)
|
|
2870
|
+
});
|
|
2871
|
+
var trialDocumentSchema = z29.object({
|
|
2872
|
+
path: z29.string(),
|
|
2873
|
+
before: z29.string(),
|
|
2874
|
+
after: z29.string()
|
|
2875
|
+
});
|
|
2876
|
+
var trialContentSchema = z29.object({
|
|
2877
|
+
trialId: z29.string(),
|
|
2878
|
+
kind: interventionKindSchema,
|
|
2879
|
+
documents: z29.array(trialDocumentSchema),
|
|
2880
|
+
/** Full page bodies for a docs rewrite, ready to paste; null otherwise. */
|
|
2881
|
+
copyableBody: z29.string().nullable(),
|
|
2882
|
+
configSnapshot: z29.unknown()
|
|
2883
|
+
});
|
|
2884
|
+
var createTrialBodySchema = z29.object({
|
|
2885
|
+
trial: trialInputSchema,
|
|
2886
|
+
files: overrideFilesSchema.optional(),
|
|
2887
|
+
fork: z29.object({ runId: z29.string().min(1), boundarySeq: z29.string().min(1) }).strict().optional(),
|
|
2888
|
+
launch: z29.boolean().default(true)
|
|
2889
|
+
}).strict();
|
|
2890
|
+
var proposeBodySchema = z29.object({
|
|
2891
|
+
request: z29.string().trim().max(4e3).optional(),
|
|
2892
|
+
lever: leverKindSchema.optional(),
|
|
2893
|
+
kind: interventionKindSchema.optional(),
|
|
2894
|
+
targetVersionId: z29.string().min(1).optional()
|
|
2895
|
+
}).strict();
|
|
2896
|
+
var proposalSchema = z29.object({
|
|
2897
|
+
trial: trialInputSchema,
|
|
2898
|
+
files: overrideFilesSchema.optional()
|
|
2899
|
+
});
|
|
2900
|
+
var proposeResponseSchema = z29.object({
|
|
2901
|
+
items: z29.array(proposalSchema)
|
|
2902
|
+
});
|
|
2903
|
+
var skillFilesResponseSchema = z29.object({
|
|
2904
|
+
versionId: z29.string(),
|
|
2905
|
+
files: overrideFilesSchema
|
|
2906
|
+
});
|
|
2907
|
+
var pageBodyResponseSchema = z29.object({
|
|
2908
|
+
url: z29.string(),
|
|
2909
|
+
body: z29.string(),
|
|
2910
|
+
contentType: z29.string().optional()
|
|
2911
|
+
});
|
|
2912
|
+
var launchTrialResponseSchema = z29.object({
|
|
2913
|
+
trialId: z29.string(),
|
|
2914
|
+
batchIds: z29.array(z29.string()),
|
|
2915
|
+
runIds: z29.array(z29.string())
|
|
2916
|
+
});
|
|
2917
|
+
|
|
2918
|
+
// ../packages/api-schemas/src/orgs.ts
|
|
2919
|
+
import { z as z30 } from "zod";
|
|
2920
|
+
var createOrgRequestSchema = z30.object({
|
|
2323
2921
|
/** Workspace display name; the slug is derived server-side. */
|
|
2324
|
-
name:
|
|
2922
|
+
name: z30.string().trim().min(1).max(200),
|
|
2325
2923
|
/** Optional company site (logo source; stamped onto the org). */
|
|
2326
|
-
website:
|
|
2924
|
+
website: z30.string().trim().max(300).optional()
|
|
2327
2925
|
});
|
|
2328
|
-
var createOrgResponseSchema =
|
|
2329
|
-
slug:
|
|
2330
|
-
name:
|
|
2926
|
+
var createOrgResponseSchema = z30.object({
|
|
2927
|
+
slug: z30.string(),
|
|
2928
|
+
name: z30.string(),
|
|
2331
2929
|
// LOCAL orgs never have a Gauge publicId.
|
|
2332
|
-
publicId:
|
|
2930
|
+
publicId: z30.string().nullable()
|
|
2333
2931
|
});
|
|
2334
|
-
var orgSettingsSchema =
|
|
2335
|
-
slug:
|
|
2336
|
-
name:
|
|
2337
|
-
publicId:
|
|
2338
|
-
website:
|
|
2932
|
+
var orgSettingsSchema = z30.object({
|
|
2933
|
+
slug: z30.string(),
|
|
2934
|
+
name: z30.string(),
|
|
2935
|
+
publicId: z30.string().nullable(),
|
|
2936
|
+
website: z30.string().nullable(),
|
|
2339
2937
|
/** Per-run max-spend override in USD; null = the server default. */
|
|
2340
|
-
maxSpendUsd:
|
|
2341
|
-
overageEnabled:
|
|
2938
|
+
maxSpendUsd: z30.number().nullable(),
|
|
2939
|
+
overageEnabled: z30.boolean(),
|
|
2342
2940
|
/** Per-cycle overage cap in credits; null = uncapped. */
|
|
2343
|
-
overageCapCredits:
|
|
2941
|
+
overageCapCredits: z30.number().int().nullable(),
|
|
2344
2942
|
/** Domain claimed for same-domain auto-join; null = off. */
|
|
2345
|
-
autoJoinDomain:
|
|
2943
|
+
autoJoinDomain: z30.string().nullable()
|
|
2346
2944
|
});
|
|
2347
|
-
var orgMemberSchema =
|
|
2348
|
-
userId:
|
|
2349
|
-
name:
|
|
2350
|
-
email:
|
|
2351
|
-
joinedAt:
|
|
2945
|
+
var orgMemberSchema = z30.object({
|
|
2946
|
+
userId: z30.string(),
|
|
2947
|
+
name: z30.string().nullable(),
|
|
2948
|
+
email: z30.string().nullable(),
|
|
2949
|
+
joinedAt: z30.string()
|
|
2352
2950
|
});
|
|
2353
|
-
var listMembersResponseSchema =
|
|
2354
|
-
items:
|
|
2951
|
+
var listMembersResponseSchema = z30.object({
|
|
2952
|
+
items: z30.array(orgMemberSchema)
|
|
2355
2953
|
});
|
|
2356
2954
|
|
|
2357
2955
|
// ../packages/api-schemas/src/personas.ts
|
|
2358
|
-
import { z as
|
|
2359
|
-
var personaSchema =
|
|
2360
|
-
id:
|
|
2361
|
-
name:
|
|
2362
|
-
description:
|
|
2956
|
+
import { z as z31 } from "zod";
|
|
2957
|
+
var personaSchema = z31.object({
|
|
2958
|
+
id: z31.string(),
|
|
2959
|
+
name: z31.string(),
|
|
2960
|
+
description: z31.string(),
|
|
2363
2961
|
/** The judge model this persona calls (Claude only). */
|
|
2364
|
-
model:
|
|
2365
|
-
createdAt:
|
|
2366
|
-
updatedAt:
|
|
2962
|
+
model: z31.string(),
|
|
2963
|
+
createdAt: z31.string(),
|
|
2964
|
+
updatedAt: z31.string()
|
|
2367
2965
|
});
|
|
2368
|
-
var listPersonasResponseSchema =
|
|
2369
|
-
items:
|
|
2966
|
+
var listPersonasResponseSchema = z31.object({
|
|
2967
|
+
items: z31.array(personaSchema)
|
|
2370
2968
|
});
|
|
2371
|
-
var createPersonaBodySchema =
|
|
2372
|
-
name:
|
|
2373
|
-
description:
|
|
2969
|
+
var createPersonaBodySchema = z31.object({
|
|
2970
|
+
name: z31.string().min(1).max(120),
|
|
2971
|
+
description: z31.string().min(1)
|
|
2374
2972
|
});
|
|
2375
|
-
var updatePersonaBodySchema =
|
|
2376
|
-
name:
|
|
2377
|
-
description:
|
|
2973
|
+
var updatePersonaBodySchema = z31.object({
|
|
2974
|
+
name: z31.string().min(1).max(120).optional(),
|
|
2975
|
+
description: z31.string().min(1).optional()
|
|
2378
2976
|
});
|
|
2379
2977
|
|
|
2380
2978
|
// ../packages/api-schemas/src/prompts.ts
|
|
2381
|
-
import { z as
|
|
2979
|
+
import { z as z34 } from "zod";
|
|
2382
2980
|
|
|
2383
2981
|
// ../packages/api-schemas/src/tags.ts
|
|
2384
|
-
import { z as
|
|
2385
|
-
var tagSchema =
|
|
2386
|
-
id:
|
|
2387
|
-
name:
|
|
2982
|
+
import { z as z32 } from "zod";
|
|
2983
|
+
var tagSchema = z32.object({
|
|
2984
|
+
id: z32.string(),
|
|
2985
|
+
name: z32.string(),
|
|
2388
2986
|
/** A Mantine palette name (e.g. "blue", "grape"); unknown values are
|
|
2389
2987
|
* normalized server-side to the default ("gray"). */
|
|
2390
|
-
color:
|
|
2988
|
+
color: z32.string()
|
|
2391
2989
|
});
|
|
2392
|
-
var createTagBodySchema =
|
|
2393
|
-
name:
|
|
2394
|
-
color:
|
|
2990
|
+
var createTagBodySchema = z32.object({
|
|
2991
|
+
name: z32.string().min(1),
|
|
2992
|
+
color: z32.string().optional()
|
|
2395
2993
|
});
|
|
2396
|
-
var updateTagBodySchema =
|
|
2397
|
-
name:
|
|
2398
|
-
color:
|
|
2994
|
+
var updateTagBodySchema = z32.object({
|
|
2995
|
+
name: z32.string().min(1).optional(),
|
|
2996
|
+
color: z32.string().optional()
|
|
2399
2997
|
});
|
|
2400
2998
|
var tagListResponseSchema = listResponseSchema(tagSchema);
|
|
2401
2999
|
|
|
2402
3000
|
// ../packages/api-schemas/src/topics.ts
|
|
2403
|
-
import { z as
|
|
2404
|
-
var topicSchema =
|
|
2405
|
-
id:
|
|
2406
|
-
name:
|
|
3001
|
+
import { z as z33 } from "zod";
|
|
3002
|
+
var topicSchema = z33.object({
|
|
3003
|
+
id: z33.string(),
|
|
3004
|
+
name: z33.string()
|
|
2407
3005
|
});
|
|
2408
|
-
var createTopicBodySchema =
|
|
2409
|
-
name:
|
|
3006
|
+
var createTopicBodySchema = z33.object({
|
|
3007
|
+
name: z33.string().min(1, "name is required")
|
|
2410
3008
|
});
|
|
2411
3009
|
var topicListResponseSchema = listResponseSchema(topicSchema);
|
|
2412
3010
|
|
|
2413
3011
|
// ../packages/api-schemas/src/prompts.ts
|
|
2414
|
-
var promptSummarySchema =
|
|
2415
|
-
id:
|
|
2416
|
-
text:
|
|
2417
|
-
isBranded:
|
|
3012
|
+
var promptSummarySchema = z34.object({
|
|
3013
|
+
id: z34.string(),
|
|
3014
|
+
text: z34.string(),
|
|
3015
|
+
isBranded: z34.boolean(),
|
|
2418
3016
|
/** Battery-spec identity (idempotent applies); null for UI/CLI-created prompts. */
|
|
2419
|
-
externalKey:
|
|
3017
|
+
externalKey: z34.string().nullable(),
|
|
2420
3018
|
topic: topicSchema.nullable(),
|
|
2421
|
-
tags:
|
|
2422
|
-
createdAt:
|
|
3019
|
+
tags: z34.array(tagSchema),
|
|
3020
|
+
createdAt: z34.string()
|
|
2423
3021
|
});
|
|
2424
3022
|
var promptListResponseSchema = listResponseSchema(promptSummarySchema);
|
|
2425
3023
|
var listPromptsQuerySchema = listQuerySchema.extend({
|
|
2426
|
-
topic:
|
|
2427
|
-
tag:
|
|
2428
|
-
q:
|
|
2429
|
-
});
|
|
2430
|
-
var createPromptBodySchema =
|
|
2431
|
-
text:
|
|
2432
|
-
isBranded:
|
|
2433
|
-
topic:
|
|
2434
|
-
tags:
|
|
2435
|
-
});
|
|
2436
|
-
var updatePromptBodySchema =
|
|
2437
|
-
text:
|
|
2438
|
-
isBranded:
|
|
2439
|
-
topicId:
|
|
2440
|
-
tags:
|
|
2441
|
-
});
|
|
2442
|
-
var runPromptBodySchema =
|
|
3024
|
+
topic: z34.string().min(1).optional(),
|
|
3025
|
+
tag: z34.string().min(1).optional(),
|
|
3026
|
+
q: z34.string().min(1).optional()
|
|
3027
|
+
});
|
|
3028
|
+
var createPromptBodySchema = z34.object({
|
|
3029
|
+
text: z34.string().min(1, "text is required"),
|
|
3030
|
+
isBranded: z34.boolean().default(false),
|
|
3031
|
+
topic: z34.string().min(1).optional(),
|
|
3032
|
+
tags: z34.array(z34.string().min(1)).default([])
|
|
3033
|
+
});
|
|
3034
|
+
var updatePromptBodySchema = z34.object({
|
|
3035
|
+
text: z34.string().min(1).optional(),
|
|
3036
|
+
isBranded: z34.boolean().optional(),
|
|
3037
|
+
topicId: z34.string().min(1).nullish(),
|
|
3038
|
+
tags: z34.array(z34.string().min(1)).optional()
|
|
3039
|
+
});
|
|
3040
|
+
var runPromptBodySchema = z34.object({
|
|
2443
3041
|
/** Preferred paired representation; each agent may pin its own model tiers. */
|
|
2444
|
-
agentConfigs:
|
|
3042
|
+
agentConfigs: z34.array(agentConfigInputSchema).min(1).optional(),
|
|
2445
3043
|
/** Legacy agent set (no per-agent pins), kept during the API transition. */
|
|
2446
|
-
agents:
|
|
2447
|
-
repoUrl:
|
|
2448
|
-
repoRef:
|
|
2449
|
-
samplesPerCycle:
|
|
3044
|
+
agents: z34.array(z34.enum(["CLAUDE_CODE", "CODEX_CLI", "CURSOR"])).min(1, "Select at least one agent").default(["CLAUDE_CODE", "CODEX_CLI"]),
|
|
3045
|
+
repoUrl: z34.string().min(1).nullish(),
|
|
3046
|
+
repoRef: z34.string().min(1).nullish(),
|
|
3047
|
+
samplesPerCycle: z34.number().int().min(1).max(10).default(1),
|
|
2450
3048
|
webFixture: webFixtureSchema.optional()
|
|
2451
3049
|
});
|
|
2452
|
-
var runPromptResponseSchema =
|
|
2453
|
-
batchIds:
|
|
2454
|
-
runIds:
|
|
2455
|
-
blocked:
|
|
3050
|
+
var runPromptResponseSchema = z34.object({
|
|
3051
|
+
batchIds: z34.array(z34.string()),
|
|
3052
|
+
runIds: z34.array(z34.string()),
|
|
3053
|
+
blocked: z34.enum(["insufficient_credits", "needs_provider_key"]).optional()
|
|
2456
3054
|
});
|
|
2457
3055
|
|
|
2458
3056
|
// ../packages/api-schemas/src/repos.ts
|
|
2459
|
-
import { z as
|
|
3057
|
+
import { z as z35 } from "zod";
|
|
2460
3058
|
var REPO_SIZE_BUCKETS = [
|
|
2461
3059
|
"small",
|
|
2462
3060
|
"medium",
|
|
2463
3061
|
"large",
|
|
2464
3062
|
"xlarge"
|
|
2465
3063
|
];
|
|
2466
|
-
var repoSizeBucketSchema =
|
|
2467
|
-
var repoSchema =
|
|
2468
|
-
url:
|
|
2469
|
-
name:
|
|
2470
|
-
isSystem:
|
|
2471
|
-
languages:
|
|
2472
|
-
frameworks:
|
|
3064
|
+
var repoSizeBucketSchema = z35.enum(REPO_SIZE_BUCKETS);
|
|
3065
|
+
var repoSchema = z35.object({
|
|
3066
|
+
url: z35.string(),
|
|
3067
|
+
name: z35.string(),
|
|
3068
|
+
isSystem: z35.boolean(),
|
|
3069
|
+
languages: z35.array(z35.string()),
|
|
3070
|
+
frameworks: z35.array(z35.string()),
|
|
2473
3071
|
/** Faceted labels (complexity:L2, buildable:yes, stack:nextjs, …). */
|
|
2474
|
-
tags:
|
|
2475
|
-
primaryLanguage:
|
|
2476
|
-
sizeKb:
|
|
3072
|
+
tags: z35.array(z35.string()),
|
|
3073
|
+
primaryLanguage: z35.string(),
|
|
3074
|
+
sizeKb: z35.number(),
|
|
2477
3075
|
sizeBucket: repoSizeBucketSchema.nullable(),
|
|
2478
|
-
stars:
|
|
3076
|
+
stars: z35.number()
|
|
2479
3077
|
});
|
|
2480
3078
|
var repoListResponseSchema = listResponseSchema(repoSchema);
|
|
2481
|
-
var addRepoBodySchema =
|
|
2482
|
-
url:
|
|
3079
|
+
var addRepoBodySchema = z35.object({
|
|
3080
|
+
url: z35.string().min(1, "url is required"),
|
|
2483
3081
|
/**
|
|
2484
3082
|
* Reserved (accepted, not yet persisted): the catalog keys repos by URL only
|
|
2485
3083
|
* — `fact_repo` has no ref column and metadata sync always reads the default
|
|
2486
3084
|
* branch. Kept in the wire format so `gauge repos add --ref` is stable once
|
|
2487
3085
|
* the catalog learns refs.
|
|
2488
3086
|
*/
|
|
2489
|
-
ref:
|
|
3087
|
+
ref: z35.string().min(1).optional(),
|
|
2490
3088
|
/** Display name; defaults to the `owner/repo` label of the URL. */
|
|
2491
|
-
name:
|
|
3089
|
+
name: z35.string().min(1).optional(),
|
|
2492
3090
|
/** Manual override; defaults to frameworks detected from the repo's manifests. */
|
|
2493
|
-
frameworks:
|
|
2494
|
-
tags:
|
|
3091
|
+
frameworks: z35.array(z35.string()).optional(),
|
|
3092
|
+
tags: z35.array(z35.string()).optional()
|
|
2495
3093
|
});
|
|
2496
|
-
var updateRepoBodySchema =
|
|
2497
|
-
url:
|
|
2498
|
-
name:
|
|
2499
|
-
frameworks:
|
|
2500
|
-
tags:
|
|
3094
|
+
var updateRepoBodySchema = z35.object({
|
|
3095
|
+
url: z35.string().min(1, "url is required"),
|
|
3096
|
+
name: z35.string().min(1).optional(),
|
|
3097
|
+
frameworks: z35.array(z35.string()).optional(),
|
|
3098
|
+
tags: z35.array(z35.string()).optional()
|
|
2501
3099
|
});
|
|
2502
|
-
var resyncRepoBodySchema =
|
|
2503
|
-
url:
|
|
3100
|
+
var resyncRepoBodySchema = z35.object({
|
|
3101
|
+
url: z35.string().min(1, "url is required")
|
|
2504
3102
|
});
|
|
2505
|
-
var deleteRepoQuerySchema =
|
|
2506
|
-
url:
|
|
3103
|
+
var deleteRepoQuerySchema = z35.object({
|
|
3104
|
+
url: z35.string().min(1, "url is required")
|
|
2507
3105
|
});
|
|
2508
|
-
var repoSyncResultSchema =
|
|
3106
|
+
var repoSyncResultSchema = z35.object({
|
|
2509
3107
|
repo: repoSchema,
|
|
2510
|
-
synced:
|
|
3108
|
+
synced: z35.boolean()
|
|
2511
3109
|
});
|
|
2512
3110
|
|
|
2513
3111
|
// ../packages/api-schemas/src/summary.ts
|
|
2514
|
-
import { z as
|
|
3112
|
+
import { z as z36 } from "zod";
|
|
2515
3113
|
function cardResultSchema(data) {
|
|
2516
|
-
return
|
|
2517
|
-
|
|
2518
|
-
|
|
3114
|
+
return z36.union([
|
|
3115
|
+
z36.object({ ok: z36.literal(true), data }),
|
|
3116
|
+
z36.object({ ok: z36.literal(false), error: z36.string() })
|
|
2519
3117
|
]);
|
|
2520
3118
|
}
|
|
2521
|
-
var summaryActionSchema =
|
|
2522
|
-
id:
|
|
2523
|
-
title:
|
|
2524
|
-
priority:
|
|
2525
|
-
status:
|
|
2526
|
-
evidenceCount:
|
|
2527
|
-
});
|
|
2528
|
-
var summaryAeCardSchema =
|
|
2529
|
-
id:
|
|
2530
|
-
name:
|
|
2531
|
-
judgedRuns:
|
|
2532
|
-
passRate:
|
|
3119
|
+
var summaryActionSchema = z36.object({
|
|
3120
|
+
id: z36.string(),
|
|
3121
|
+
title: z36.string(),
|
|
3122
|
+
priority: z36.string(),
|
|
3123
|
+
status: z36.string(),
|
|
3124
|
+
evidenceCount: z36.number().int()
|
|
3125
|
+
});
|
|
3126
|
+
var summaryAeCardSchema = z36.object({
|
|
3127
|
+
id: z36.string(),
|
|
3128
|
+
name: z36.string(),
|
|
3129
|
+
judgedRuns: z36.number().int(),
|
|
3130
|
+
passRate: z36.number().nullable(),
|
|
2533
3131
|
/** pp delta vs the prior 30d; null with no prior. */
|
|
2534
|
-
deltaPP:
|
|
2535
|
-
});
|
|
2536
|
-
var summaryVisibilityCardSchema =
|
|
2537
|
-
name:
|
|
2538
|
-
owned:
|
|
2539
|
-
name:
|
|
2540
|
-
rank:
|
|
2541
|
-
chosenRate:
|
|
2542
|
-
mentionRate:
|
|
3132
|
+
deltaPP: z36.number().nullable()
|
|
3133
|
+
});
|
|
3134
|
+
var summaryVisibilityCardSchema = z36.object({
|
|
3135
|
+
name: z36.string(),
|
|
3136
|
+
owned: z36.object({
|
|
3137
|
+
name: z36.string(),
|
|
3138
|
+
rank: z36.number(),
|
|
3139
|
+
chosenRate: z36.number(),
|
|
3140
|
+
mentionRate: z36.number()
|
|
2543
3141
|
}).nullable(),
|
|
2544
|
-
chosenDeltaPP:
|
|
3142
|
+
chosenDeltaPP: z36.number().nullable()
|
|
2545
3143
|
});
|
|
2546
|
-
var homeSummarySchema =
|
|
2547
|
-
hasAnyRuns:
|
|
2548
|
-
lastSynthesisAt:
|
|
2549
|
-
actions: cardResultSchema(
|
|
3144
|
+
var homeSummarySchema = z36.object({
|
|
3145
|
+
hasAnyRuns: z36.boolean(),
|
|
3146
|
+
lastSynthesisAt: z36.string().nullable(),
|
|
3147
|
+
actions: cardResultSchema(z36.array(summaryActionSchema)),
|
|
2550
3148
|
visibility: cardResultSchema(
|
|
2551
|
-
|
|
2552
|
-
cards:
|
|
2553
|
-
marketsTotal:
|
|
2554
|
-
promptCount:
|
|
3149
|
+
z36.object({
|
|
3150
|
+
cards: z36.array(summaryVisibilityCardSchema),
|
|
3151
|
+
marketsTotal: z36.number().int(),
|
|
3152
|
+
promptCount: z36.number().int()
|
|
2555
3153
|
})
|
|
2556
3154
|
),
|
|
2557
3155
|
agentExperience: cardResultSchema(
|
|
2558
|
-
|
|
2559
|
-
cards:
|
|
2560
|
-
total:
|
|
2561
|
-
setCount:
|
|
3156
|
+
z36.object({
|
|
3157
|
+
cards: z36.array(summaryAeCardSchema),
|
|
3158
|
+
total: z36.number().int(),
|
|
3159
|
+
setCount: z36.number().int()
|
|
2562
3160
|
})
|
|
2563
3161
|
),
|
|
2564
|
-
notableSessions: cardResultSchema(
|
|
3162
|
+
notableSessions: cardResultSchema(z36.array(z36.unknown()))
|
|
2565
3163
|
});
|
|
2566
3164
|
|
|
2567
3165
|
// ../packages/api-schemas/src/tokens.ts
|
|
2568
|
-
import { z as
|
|
2569
|
-
var apiTokenSchema =
|
|
2570
|
-
id:
|
|
2571
|
-
name:
|
|
3166
|
+
import { z as z37 } from "zod";
|
|
3167
|
+
var apiTokenSchema = z37.object({
|
|
3168
|
+
id: z37.string(),
|
|
3169
|
+
name: z37.string(),
|
|
2572
3170
|
/** Last 4 chars of the plaintext, for recognizability (non-secret). */
|
|
2573
|
-
last4:
|
|
2574
|
-
expiresAt:
|
|
2575
|
-
lastUsedAt:
|
|
2576
|
-
createdAt:
|
|
2577
|
-
revokedAt:
|
|
2578
|
-
});
|
|
2579
|
-
var createTokenRequestSchema =
|
|
2580
|
-
name:
|
|
3171
|
+
last4: z37.string(),
|
|
3172
|
+
expiresAt: z37.iso.datetime().nullable(),
|
|
3173
|
+
lastUsedAt: z37.iso.datetime().nullable(),
|
|
3174
|
+
createdAt: z37.iso.datetime(),
|
|
3175
|
+
revokedAt: z37.iso.datetime().nullable()
|
|
3176
|
+
});
|
|
3177
|
+
var createTokenRequestSchema = z37.object({
|
|
3178
|
+
name: z37.string().min(1).max(100),
|
|
2581
3179
|
/** ISO-8601 datetime; omit for no expiry. */
|
|
2582
|
-
expiresAt:
|
|
3180
|
+
expiresAt: z37.iso.datetime({ offset: true }).optional()
|
|
2583
3181
|
});
|
|
2584
3182
|
var createTokenResponseSchema = apiTokenSchema.extend({
|
|
2585
|
-
token:
|
|
3183
|
+
token: z37.string()
|
|
2586
3184
|
});
|
|
2587
3185
|
var listTokensResponseSchema = listResponseSchema(apiTokenSchema);
|
|
2588
3186
|
|
|
2589
3187
|
// ../packages/api-schemas/src/visibility.ts
|
|
2590
|
-
import { z as
|
|
3188
|
+
import { z as z38 } from "zod";
|
|
2591
3189
|
var VISIBILITY_PROMPT_KINDS = ["HEAD_TO_HEAD", "RECOMMEND"];
|
|
2592
|
-
var visibilityPromptKindSchema =
|
|
3190
|
+
var visibilityPromptKindSchema = z38.enum(VISIBILITY_PROMPT_KINDS);
|
|
2593
3191
|
var visibilityPromptSchema = visibilityPromptSettingsSchema.extend({
|
|
2594
|
-
id:
|
|
2595
|
-
name:
|
|
3192
|
+
id: z38.string(),
|
|
3193
|
+
name: z38.string(),
|
|
2596
3194
|
kind: visibilityPromptKindSchema,
|
|
2597
|
-
promptText:
|
|
3195
|
+
promptText: z38.string(),
|
|
2598
3196
|
/** HEAD_TO_HEAD is always branded; RECOMMEND may be either. */
|
|
2599
|
-
branded:
|
|
2600
|
-
brandA:
|
|
2601
|
-
brandB:
|
|
2602
|
-
market:
|
|
2603
|
-
position:
|
|
2604
|
-
createdAt:
|
|
3197
|
+
branded: z38.boolean(),
|
|
3198
|
+
brandA: z38.string().nullable(),
|
|
3199
|
+
brandB: z38.string().nullable(),
|
|
3200
|
+
market: z38.object({ id: z38.string(), slug: z38.string(), name: z38.string() }).nullable(),
|
|
3201
|
+
position: z38.number().int(),
|
|
3202
|
+
createdAt: z38.string(),
|
|
2605
3203
|
/** User tag names on the hidden backing prompt (Surface:* excluded). */
|
|
2606
|
-
tags:
|
|
2607
|
-
runCount:
|
|
2608
|
-
lastRunAt:
|
|
2609
|
-
scenarios:
|
|
3204
|
+
tags: z38.array(z38.string()),
|
|
3205
|
+
runCount: z38.number().int(),
|
|
3206
|
+
lastRunAt: z38.string().nullable(),
|
|
3207
|
+
scenarios: z38.array(visibilityScenarioSchema)
|
|
2610
3208
|
});
|
|
2611
|
-
var listVisibilityPromptsResponseSchema =
|
|
2612
|
-
items:
|
|
3209
|
+
var listVisibilityPromptsResponseSchema = z38.object({
|
|
3210
|
+
items: z38.array(visibilityPromptSchema)
|
|
2613
3211
|
});
|
|
2614
|
-
var createVisibilityPromptBodySchema =
|
|
2615
|
-
name:
|
|
2616
|
-
promptText:
|
|
3212
|
+
var createVisibilityPromptBodySchema = z38.object({
|
|
3213
|
+
name: z38.string().min(1),
|
|
3214
|
+
promptText: z38.string().min(1),
|
|
2617
3215
|
kind: visibilityPromptKindSchema,
|
|
2618
|
-
branded:
|
|
3216
|
+
branded: z38.boolean().optional(),
|
|
2619
3217
|
/** Required pair for HEAD_TO_HEAD (order-independent). */
|
|
2620
|
-
brandA:
|
|
2621
|
-
brandB:
|
|
3218
|
+
brandA: z38.string().nullish(),
|
|
3219
|
+
brandB: z38.string().nullish(),
|
|
2622
3220
|
/** Measured market id from the org's tracked set. */
|
|
2623
|
-
marketId:
|
|
2624
|
-
tags:
|
|
3221
|
+
marketId: z38.string().nullish(),
|
|
3222
|
+
tags: z38.array(z38.string()).optional(),
|
|
2625
3223
|
agents: visibilityPromptSettingsInputShape.agents.optional(),
|
|
2626
3224
|
skillRefs: visibilityPromptSettingsInputShape.skillRefs,
|
|
2627
3225
|
mcpRefs: visibilityPromptSettingsInputShape.mcpRefs,
|
|
2628
3226
|
connectionIds: visibilityPromptSettingsInputShape.connectionIds,
|
|
2629
3227
|
cadence: visibilityPromptSettingsInputShape.cadence,
|
|
2630
3228
|
sampleCount: visibilityPromptSettingsInputShape.sampleCount,
|
|
2631
|
-
scenarios:
|
|
3229
|
+
scenarios: z38.array(visibilityScenarioInputSchema).optional().default([])
|
|
2632
3230
|
}).strict();
|
|
2633
|
-
var synthesizeResponseSchema =
|
|
3231
|
+
var synthesizeResponseSchema = z38.object({
|
|
2634
3232
|
/** False when the pre-check found no new evidence and nothing was queued. */
|
|
2635
|
-
queued:
|
|
2636
|
-
});
|
|
2637
|
-
var updateVisibilityPromptBodySchema =
|
|
2638
|
-
name:
|
|
2639
|
-
promptText:
|
|
2640
|
-
branded:
|
|
2641
|
-
brandA:
|
|
2642
|
-
brandB:
|
|
2643
|
-
marketId:
|
|
2644
|
-
tags:
|
|
3233
|
+
queued: z38.boolean()
|
|
3234
|
+
});
|
|
3235
|
+
var updateVisibilityPromptBodySchema = z38.object({
|
|
3236
|
+
name: z38.string().min(1).optional(),
|
|
3237
|
+
promptText: z38.string().min(1).optional(),
|
|
3238
|
+
branded: z38.boolean().optional(),
|
|
3239
|
+
brandA: z38.string().nullish(),
|
|
3240
|
+
brandB: z38.string().nullish(),
|
|
3241
|
+
marketId: z38.string().nullish(),
|
|
3242
|
+
tags: z38.array(z38.string()).optional(),
|
|
2645
3243
|
...visibilityPromptSettingsPatchShape,
|
|
2646
3244
|
/** Replaces the whole scenario set when present. */
|
|
2647
|
-
scenarios:
|
|
3245
|
+
scenarios: z38.array(visibilityScenarioInputSchema).optional()
|
|
2648
3246
|
}).strict();
|
|
2649
|
-
var runVisibilityPromptResponseSchema =
|
|
2650
|
-
batchIds:
|
|
2651
|
-
runIds:
|
|
3247
|
+
var runVisibilityPromptResponseSchema = z38.object({
|
|
3248
|
+
batchIds: z38.array(z38.string()),
|
|
3249
|
+
runIds: z38.array(z38.string())
|
|
2652
3250
|
});
|
|
2653
|
-
var visibilityPromptRunSchema =
|
|
2654
|
-
id:
|
|
2655
|
-
status:
|
|
3251
|
+
var visibilityPromptRunSchema = z38.object({
|
|
3252
|
+
id: z38.string(),
|
|
3253
|
+
status: z38.string(),
|
|
2656
3254
|
agent: agentSchema,
|
|
2657
|
-
model:
|
|
2658
|
-
resolvedModel:
|
|
2659
|
-
createdAt:
|
|
2660
|
-
startedAt:
|
|
2661
|
-
finishedAt:
|
|
2662
|
-
failureReason:
|
|
2663
|
-
verdict:
|
|
2664
|
-
status:
|
|
2665
|
-
error:
|
|
2666
|
-
payload:
|
|
3255
|
+
model: z38.string().nullable(),
|
|
3256
|
+
resolvedModel: z38.string().nullable(),
|
|
3257
|
+
createdAt: z38.string(),
|
|
3258
|
+
startedAt: z38.string().nullable(),
|
|
3259
|
+
finishedAt: z38.string().nullable(),
|
|
3260
|
+
failureReason: z38.string().nullable(),
|
|
3261
|
+
verdict: z38.object({
|
|
3262
|
+
status: z38.string(),
|
|
3263
|
+
error: z38.string().nullable(),
|
|
3264
|
+
payload: z38.unknown().nullable()
|
|
2667
3265
|
}).nullable()
|
|
2668
3266
|
});
|
|
2669
|
-
var listVisibilityPromptRunsResponseSchema =
|
|
2670
|
-
items:
|
|
3267
|
+
var listVisibilityPromptRunsResponseSchema = z38.object({
|
|
3268
|
+
items: z38.array(visibilityPromptRunSchema)
|
|
2671
3269
|
});
|
|
2672
|
-
var orgMarketSchema =
|
|
2673
|
-
marketId:
|
|
2674
|
-
slug:
|
|
2675
|
-
name:
|
|
3270
|
+
var orgMarketSchema = z38.object({
|
|
3271
|
+
marketId: z38.string(),
|
|
3272
|
+
slug: z38.string(),
|
|
3273
|
+
name: z38.string(),
|
|
2676
3274
|
/** The one line saying what the market measures. */
|
|
2677
|
-
capability:
|
|
3275
|
+
capability: z38.string(),
|
|
2678
3276
|
/** SUGGESTED (the matcher) | USER (a human picked it). */
|
|
2679
|
-
source:
|
|
3277
|
+
source: z38.string()
|
|
2680
3278
|
});
|
|
2681
3279
|
var addableMarketSchema = orgMarketSchema.omit({ source: true });
|
|
2682
|
-
var listMarketsResponseSchema =
|
|
2683
|
-
tracked:
|
|
3280
|
+
var listMarketsResponseSchema = z38.object({
|
|
3281
|
+
tracked: z38.array(orgMarketSchema),
|
|
2684
3282
|
/** Published markets the org does not track yet (closed set — no free-text
|
|
2685
3283
|
* market creation). */
|
|
2686
|
-
addable:
|
|
3284
|
+
addable: z38.array(addableMarketSchema)
|
|
2687
3285
|
});
|
|
2688
|
-
var addMarketBodySchema =
|
|
3286
|
+
var addMarketBodySchema = z38.object({ marketId: z38.string().min(1) });
|
|
2689
3287
|
|
|
2690
3288
|
// src/version.ts
|
|
2691
3289
|
import { createRequire } from "module";
|
|
@@ -3069,7 +3667,7 @@ __export(apply_exports, {
|
|
|
3069
3667
|
register: () => register2
|
|
3070
3668
|
});
|
|
3071
3669
|
import { readFileSync as readFileSync3 } from "fs";
|
|
3072
|
-
import { z as
|
|
3670
|
+
import { z as z39 } from "zod";
|
|
3073
3671
|
function assertRequiredExperiment(spec, required) {
|
|
3074
3672
|
if (required.length === 0) {
|
|
3075
3673
|
throw new CliError(
|
|
@@ -3221,7 +3819,7 @@ function register2(program2) {
|
|
|
3221
3819
|
).option("--schema", "print the battery spec JSON Schema and exit").option("--example", "print a minimal example battery spec and exit").action(
|
|
3222
3820
|
async (opts, command) => {
|
|
3223
3821
|
if (opts.schema) {
|
|
3224
|
-
printJson(
|
|
3822
|
+
printJson(z39.toJSONSchema(batteries_exports.batterySpecSchema));
|
|
3225
3823
|
return;
|
|
3226
3824
|
}
|
|
3227
3825
|
if (opts.example) {
|
|
@@ -4785,7 +5383,9 @@ function printDetail2(e) {
|
|
|
4785
5383
|
}
|
|
4786
5384
|
}
|
|
4787
5385
|
function register10(program2) {
|
|
4788
|
-
const group = program2.command("experiments").description(
|
|
5386
|
+
const group = program2.command("experiments").description(
|
|
5387
|
+
"Author, launch, and read Fixer content experiments (legacy: orgs with Optimizations answer 409 on writes; use `gauge optimizations`)"
|
|
5388
|
+
);
|
|
4789
5389
|
group.command("list").description("List the org's experiments").option(
|
|
4790
5390
|
"--status <statuses>",
|
|
4791
5391
|
"comma-separated statuses (e.g. RUNNING,COMPLETE)"
|
|
@@ -5589,10 +6189,594 @@ Using workspace ${orgSlug}.`
|
|
|
5589
6189
|
);
|
|
5590
6190
|
}
|
|
5591
6191
|
|
|
6192
|
+
// src/commands/optimizations.ts
|
|
6193
|
+
var optimizations_exports2 = {};
|
|
6194
|
+
__export(optimizations_exports2, {
|
|
6195
|
+
parseEffort: () => parseEffort,
|
|
6196
|
+
parseStatuses: () => parseStatuses,
|
|
6197
|
+
parseSubject: () => parseSubject,
|
|
6198
|
+
parseTarget: () => parseTarget,
|
|
6199
|
+
planFromOpts: () => planFromOpts,
|
|
6200
|
+
register: () => register16,
|
|
6201
|
+
trialBodyFromOpts: () => trialBodyFromOpts
|
|
6202
|
+
});
|
|
6203
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
6204
|
+
var TERMINAL2 = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
|
|
6205
|
+
var EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
6206
|
+
function basePath(org) {
|
|
6207
|
+
return `/api/v1/orgs/${encodeURIComponent(org)}/optimizations`;
|
|
6208
|
+
}
|
|
6209
|
+
function itemPath2(org, id) {
|
|
6210
|
+
return `${basePath(org)}/${encodeURIComponent(id)}`;
|
|
6211
|
+
}
|
|
6212
|
+
function trialPath(org, id, trialId) {
|
|
6213
|
+
return `${itemPath2(org, id)}/trials/${encodeURIComponent(trialId)}`;
|
|
6214
|
+
}
|
|
6215
|
+
function readText2(path) {
|
|
6216
|
+
return readFileSync9(path === "-" ? 0 : path, "utf8");
|
|
6217
|
+
}
|
|
6218
|
+
function sleep3(ms) {
|
|
6219
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6220
|
+
}
|
|
6221
|
+
function parseSubject(opts) {
|
|
6222
|
+
if (opts.eval && opts.preference)
|
|
6223
|
+
throw new CliError("usage", "pass --eval or --preference, not both");
|
|
6224
|
+
if (opts.eval) return { subjectKind: "EVAL_SET", subjectId: opts.eval };
|
|
6225
|
+
if (opts.preference)
|
|
6226
|
+
return { subjectKind: "VISIBILITY_PROMPT", subjectId: opts.preference };
|
|
6227
|
+
throw new CliError("usage", "pass --eval <id> or --preference <id>");
|
|
6228
|
+
}
|
|
6229
|
+
function parseTarget(raw) {
|
|
6230
|
+
const spec = parseAgentSpec(raw);
|
|
6231
|
+
if (spec.models.length > 1)
|
|
6232
|
+
throw new CliError(
|
|
6233
|
+
"usage",
|
|
6234
|
+
`--target "${raw}" names several models; an optimization pins exactly one`
|
|
6235
|
+
);
|
|
6236
|
+
return spec.models.length ? { agent: spec.agent, model: spec.models[0] } : { agent: spec.agent };
|
|
6237
|
+
}
|
|
6238
|
+
function parseEffort(raw) {
|
|
6239
|
+
const value = raw.trim().toLowerCase();
|
|
6240
|
+
if (!EFFORTS.includes(value))
|
|
6241
|
+
throw new CliError(
|
|
6242
|
+
"usage",
|
|
6243
|
+
`--effort must be one of ${EFFORTS.join(", ")} (got "${raw}")`
|
|
6244
|
+
);
|
|
6245
|
+
return value.toUpperCase();
|
|
6246
|
+
}
|
|
6247
|
+
function parseCount(raw, flag) {
|
|
6248
|
+
if (raw === void 0) return void 0;
|
|
6249
|
+
const n = Number(raw);
|
|
6250
|
+
if (!Number.isInteger(n) || n < 1)
|
|
6251
|
+
throw new CliError("usage", `${flag} must be a positive integer`);
|
|
6252
|
+
return n;
|
|
6253
|
+
}
|
|
6254
|
+
function planFromOpts(opts) {
|
|
6255
|
+
if (opts.effort && (opts.samples || opts.rounds))
|
|
6256
|
+
throw new CliError(
|
|
6257
|
+
"usage",
|
|
6258
|
+
"pass --effort or --samples/--rounds, not both"
|
|
6259
|
+
);
|
|
6260
|
+
return {
|
|
6261
|
+
effort: opts.effort ? parseEffort(opts.effort) : void 0,
|
|
6262
|
+
sampleCount: parseCount(opts.samples, "--samples"),
|
|
6263
|
+
maxRounds: parseCount(opts.rounds, "--rounds"),
|
|
6264
|
+
target: opts.target ? parseTarget(opts.target) : void 0
|
|
6265
|
+
};
|
|
6266
|
+
}
|
|
6267
|
+
function parseStatuses(raw) {
|
|
6268
|
+
if (!raw) return void 0;
|
|
6269
|
+
const parts = raw.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean);
|
|
6270
|
+
for (const part of parts)
|
|
6271
|
+
if (!["ACTIVE", "PAUSED", "DONE", "ARCHIVED"].includes(part))
|
|
6272
|
+
throw new CliError(
|
|
6273
|
+
"usage",
|
|
6274
|
+
`unknown status "${part}" (expected ACTIVE, PAUSED, DONE, ARCHIVED)`
|
|
6275
|
+
);
|
|
6276
|
+
return parts.join(",");
|
|
6277
|
+
}
|
|
6278
|
+
function trialBodyFromOpts(opts, read = readText2) {
|
|
6279
|
+
const launch = opts.launch !== false;
|
|
6280
|
+
const fork = opts.forkRun || opts.forkBoundary ? (() => {
|
|
6281
|
+
if (!opts.forkRun || !opts.forkBoundary)
|
|
6282
|
+
throw new CliError(
|
|
6283
|
+
"usage",
|
|
6284
|
+
"--fork-run and --fork-boundary go together"
|
|
6285
|
+
);
|
|
6286
|
+
return { runId: opts.forkRun, boundarySeq: opts.forkBoundary };
|
|
6287
|
+
})() : void 0;
|
|
6288
|
+
if (opts.file) {
|
|
6289
|
+
const parsed = JSON.parse(read(opts.file));
|
|
6290
|
+
const pick = parseCount(opts.pick, "--pick") ?? 1;
|
|
6291
|
+
let chosen;
|
|
6292
|
+
if (Array.isArray(parsed)) {
|
|
6293
|
+
if (pick > parsed.length)
|
|
6294
|
+
throw new CliError(
|
|
6295
|
+
"usage",
|
|
6296
|
+
`--pick ${pick} but the file holds ${parsed.length} proposal${parsed.length === 1 ? "" : "s"}`
|
|
6297
|
+
);
|
|
6298
|
+
chosen = parsed[pick - 1];
|
|
6299
|
+
} else {
|
|
6300
|
+
if (opts.pick !== void 0)
|
|
6301
|
+
throw new CliError("usage", "--pick applies to a proposals array");
|
|
6302
|
+
chosen = parsed;
|
|
6303
|
+
}
|
|
6304
|
+
const record = chosen;
|
|
6305
|
+
const body = "trial" in record ? record : { trial: record };
|
|
6306
|
+
return { ...body, ...fork ? { fork } : {}, launch };
|
|
6307
|
+
}
|
|
6308
|
+
if (!opts.title) throw new CliError("usage", "--title is required");
|
|
6309
|
+
const lever = opts.lever?.toUpperCase();
|
|
6310
|
+
const kind = opts.kind?.toUpperCase();
|
|
6311
|
+
let intervention;
|
|
6312
|
+
if (opts.page || opts.bodyFile) {
|
|
6313
|
+
if (!opts.page || !opts.bodyFile)
|
|
6314
|
+
throw new CliError("usage", "--page and --body-file go together");
|
|
6315
|
+
intervention = {
|
|
6316
|
+
kind: "REWRITE_DOCS",
|
|
6317
|
+
after: { pages: [{ url: opts.page, body: read(opts.bodyFile) }] }
|
|
6318
|
+
};
|
|
6319
|
+
} else if (opts.removeSkill) {
|
|
6320
|
+
intervention = {
|
|
6321
|
+
kind: "REMOVE_SKILL",
|
|
6322
|
+
before: { skillVersionId: opts.removeSkill },
|
|
6323
|
+
after: {}
|
|
6324
|
+
};
|
|
6325
|
+
} else if (opts.skillVersion) {
|
|
6326
|
+
intervention = {
|
|
6327
|
+
kind: kind ?? "ADD_SKILL",
|
|
6328
|
+
after: { skillVersionId: opts.skillVersion },
|
|
6329
|
+
...kind === "EDIT_SKILL" ? { before: { skillVersionId: opts.skillVersion } } : {}
|
|
6330
|
+
};
|
|
6331
|
+
} else {
|
|
6332
|
+
throw new CliError(
|
|
6333
|
+
"usage",
|
|
6334
|
+
"describe the change: --skill-version <id>, --remove-skill <id>, --page <url> --body-file <path>, or --file <proposal.json>"
|
|
6335
|
+
);
|
|
6336
|
+
}
|
|
6337
|
+
const trial = {
|
|
6338
|
+
title: opts.title,
|
|
6339
|
+
hypothesis: opts.hypothesis,
|
|
6340
|
+
lever: lever ?? (intervention.kind === "REWRITE_DOCS" ? "DOCS" : "SKILL"),
|
|
6341
|
+
intervention,
|
|
6342
|
+
authorMode: "MANUAL"
|
|
6343
|
+
};
|
|
6344
|
+
return { trial, ...fork ? { fork } : {}, launch };
|
|
6345
|
+
}
|
|
6346
|
+
function pct(value) {
|
|
6347
|
+
return value === null || value === void 0 ? "\u2014" : `${Math.round(value * 100)}%`;
|
|
6348
|
+
}
|
|
6349
|
+
function subjectLabel(kind) {
|
|
6350
|
+
return kind === "EVAL_SET" ? "eval" : "preference";
|
|
6351
|
+
}
|
|
6352
|
+
function toRow4(o) {
|
|
6353
|
+
return {
|
|
6354
|
+
id: o.id,
|
|
6355
|
+
name: o.name.length > 40 ? `${o.name.slice(0, 37)}...` : o.name,
|
|
6356
|
+
status: o.status,
|
|
6357
|
+
subject: `${subjectLabel(o.subjectKind)} ${o.subjectName}`,
|
|
6358
|
+
round: `${o.round}/${o.maxRounds}`,
|
|
6359
|
+
baseline: pct(o.before),
|
|
6360
|
+
now: pct(o.after),
|
|
6361
|
+
delta: o.delta === null ? "\u2014" : `${o.delta > 0 ? "+" : ""}${o.delta}pt`,
|
|
6362
|
+
credits: `${o.creditsSpent}/${o.creditsReserved}`,
|
|
6363
|
+
updated: o.updatedAt
|
|
6364
|
+
};
|
|
6365
|
+
}
|
|
6366
|
+
function trialRow(t) {
|
|
6367
|
+
return {
|
|
6368
|
+
key: t.key,
|
|
6369
|
+
round: t.roundNumber,
|
|
6370
|
+
title: t.title.length > 48 ? `${t.title.slice(0, 45)}...` : t.title,
|
|
6371
|
+
surface: t.lever ?? "",
|
|
6372
|
+
change: t.kind,
|
|
6373
|
+
"builds on": t.parentKey ?? "",
|
|
6374
|
+
status: t.status,
|
|
6375
|
+
score: pct(t.score),
|
|
6376
|
+
result: t.verdict ?? "",
|
|
6377
|
+
sessions: t.sessions,
|
|
6378
|
+
adopted: t.adopted ? "yes" : "",
|
|
6379
|
+
id: t.id
|
|
6380
|
+
};
|
|
6381
|
+
}
|
|
6382
|
+
function printDetail3(o) {
|
|
6383
|
+
console.log(`id: ${o.id}`);
|
|
6384
|
+
console.log(`name: ${o.name}`);
|
|
6385
|
+
console.log(
|
|
6386
|
+
`status: ${o.status}${o.stopReason ? ` (${o.stopReason})` : ""}`
|
|
6387
|
+
);
|
|
6388
|
+
console.log(`mode: ${o.mode === "AUTO" ? "Gauge-led" : "manual"}`);
|
|
6389
|
+
console.log(
|
|
6390
|
+
`subject: ${subjectLabel(o.subjectKind)} ${o.subjectName} (${o.subjectId})`
|
|
6391
|
+
);
|
|
6392
|
+
console.log(
|
|
6393
|
+
`target: ${o.settings.pinnedAgent ?? "(subject roster)"}${o.settings.pinnedModel ? `:${o.settings.pinnedModel}` : ""}`
|
|
6394
|
+
);
|
|
6395
|
+
console.log(
|
|
6396
|
+
`plan: ${o.settings.sampleCount} session${o.settings.sampleCount === 1 ? "" : "s"} per trial, up to ${o.settings.maxRounds} rounds, auto-adopt ${o.settings.autoAdopt ? "on" : "off"}`
|
|
6397
|
+
);
|
|
6398
|
+
console.log(`credits: ${o.creditsSpent} spent of ${o.settings.creditCap}`);
|
|
6399
|
+
console.log(
|
|
6400
|
+
`score: ${pct(o.before)} \u2192 ${pct(o.after)}${o.delta === null ? "" : ` (${o.delta > 0 ? "+" : ""}${o.delta}pt)`}`
|
|
6401
|
+
);
|
|
6402
|
+
if (o.summary) console.log(`summary: ${o.summary}`);
|
|
6403
|
+
if (o.diagnosis?.summary) console.log(`diagnosis: ${o.diagnosis.summary}`);
|
|
6404
|
+
console.log("trials:");
|
|
6405
|
+
printItems(o.rounds.flatMap((round) => round.trials).map(trialRow), "table");
|
|
6406
|
+
for (const round of o.rounds)
|
|
6407
|
+
if (round.narrative)
|
|
6408
|
+
console.log(`round ${round.number}: ${round.narrative}`);
|
|
6409
|
+
}
|
|
6410
|
+
function printTrial(t) {
|
|
6411
|
+
console.log(`key: ${t.key} (round ${t.roundNumber}) \u2014 ${t.id}`);
|
|
6412
|
+
console.log(`title: ${t.title}`);
|
|
6413
|
+
if (t.hypothesis) console.log(`hypothesis: ${t.hypothesis}`);
|
|
6414
|
+
console.log(`change: ${t.kind}${t.lever ? ` on ${t.lever}` : ""}`);
|
|
6415
|
+
console.log(`builds on: ${t.parentKey ?? "\u2014"}`);
|
|
6416
|
+
console.log(
|
|
6417
|
+
`status: ${t.status}${t.verdict ? ` \xB7 ${t.verdict}` : ""}${t.adopted ? " \xB7 adopted" : ""}`
|
|
6418
|
+
);
|
|
6419
|
+
console.log(
|
|
6420
|
+
`score: ${pct(t.baselineScore)} \u2192 ${pct(t.score)} over ${t.sessions} session${t.sessions === 1 ? "" : "s"}`
|
|
6421
|
+
);
|
|
6422
|
+
if (t.outcome) console.log(`outcome: ${t.outcome}`);
|
|
6423
|
+
if (t.runs.length) {
|
|
6424
|
+
console.log("sessions:");
|
|
6425
|
+
for (const run of t.runs) {
|
|
6426
|
+
const verdict = run.passed === null ? "unjudged" : run.passed ? "pass" : "fail";
|
|
6427
|
+
console.log(` ${run.id}: ${run.status} \xB7 ${verdict}`);
|
|
6428
|
+
for (const criterion of run.criteria)
|
|
6429
|
+
console.log(` ${criterion.passed ? "\u2713" : "\u2717"} ${criterion.name}`);
|
|
6430
|
+
}
|
|
6431
|
+
}
|
|
6432
|
+
}
|
|
6433
|
+
function printChange(content) {
|
|
6434
|
+
for (const doc of content.documents) {
|
|
6435
|
+
console.log(`=== ${doc.path}`);
|
|
6436
|
+
console.log("--- before");
|
|
6437
|
+
console.log(doc.before || "(empty)");
|
|
6438
|
+
console.log("+++ after");
|
|
6439
|
+
console.log(doc.after || "(empty)");
|
|
6440
|
+
}
|
|
6441
|
+
}
|
|
6442
|
+
function printEstimate(e) {
|
|
6443
|
+
console.log(
|
|
6444
|
+
`plan: ${e.sampleCount} session${e.sampleCount === 1 ? "" : "s"} per trial \xD7 up to ${e.maxRounds} rounds`
|
|
6445
|
+
);
|
|
6446
|
+
console.log(`per trial: ${e.trialCredits.toFixed(1)} credits`);
|
|
6447
|
+
console.log(`estimate: ${e.estimate} credits (reserved as the cap)`);
|
|
6448
|
+
}
|
|
6449
|
+
function printDiagnosis(d) {
|
|
6450
|
+
console.log(`id: ${d.id}`);
|
|
6451
|
+
console.log(`status: ${d.status} over ${d.runCount} sessions`);
|
|
6452
|
+
console.log(`summary: ${d.summary ?? "(none)"}`);
|
|
6453
|
+
console.log(`recommended: ${d.recommendedLever ?? "no single lever"}`);
|
|
6454
|
+
if (d.clusters.length) {
|
|
6455
|
+
console.log("opportunities:");
|
|
6456
|
+
for (const cluster of d.clusters)
|
|
6457
|
+
console.log(
|
|
6458
|
+
` - ${cluster.title} [${cluster.lever ?? "?"} \xB7 ${Math.round(cluster.confidence * 100)}%] ${cluster.failureMode}`
|
|
6459
|
+
);
|
|
6460
|
+
}
|
|
6461
|
+
}
|
|
6462
|
+
function addSubjectOptions(command) {
|
|
6463
|
+
return command.option("--eval <id>", "an Agent Experience eval").option("--preference <id>", "an Agent Preference prompt");
|
|
6464
|
+
}
|
|
6465
|
+
function addPlanOptions(command) {
|
|
6466
|
+
return command.option(
|
|
6467
|
+
"--effort <level>",
|
|
6468
|
+
"low (1\xD73), medium (1\xD75, default), high (2\xD78), xhigh (3\xD712)"
|
|
6469
|
+
).option("--samples <n>", "sessions per trial (instead of --effort)").option("--rounds <n>", "maximum rounds (instead of --effort)").option(
|
|
6470
|
+
"--target <agent[:model]>",
|
|
6471
|
+
"the one harness/model every session runs on, e.g. claude-code:claude-opus-4-8"
|
|
6472
|
+
);
|
|
6473
|
+
}
|
|
6474
|
+
function register16(program2) {
|
|
6475
|
+
const group = program2.command("optimizations").alias("optimize").description(
|
|
6476
|
+
"Start, steer, and read optimizations: Gauge changes one owned surface per trial and adopts what improves an eval or preference prompt"
|
|
6477
|
+
);
|
|
6478
|
+
group.command("list").description("List the org's optimizations, newest activity first").option("--status <statuses>", "comma-separated: ACTIVE,PAUSED,DONE").option("--eval <id>", "only optimizations on this eval").option("--preference <id>", "only optimizations on this preference prompt").option("--limit <n>", "max rows (default 50)").action(
|
|
6479
|
+
async (opts, cmd) => {
|
|
6480
|
+
const org = resolveOrg(cmd);
|
|
6481
|
+
const subject = opts.eval || opts.preference ? parseSubject(opts) : void 0;
|
|
6482
|
+
const res = await createClient().get(
|
|
6483
|
+
basePath(org),
|
|
6484
|
+
{
|
|
6485
|
+
status: parseStatuses(opts.status),
|
|
6486
|
+
subjectKind: subject?.subjectKind,
|
|
6487
|
+
subjectId: subject?.subjectId,
|
|
6488
|
+
limit: opts.limit
|
|
6489
|
+
}
|
|
6490
|
+
);
|
|
6491
|
+
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
6492
|
+
else printItems(res.items.map(toRow4), "table");
|
|
6493
|
+
}
|
|
6494
|
+
);
|
|
6495
|
+
group.command("get <id>").description("One optimization: settings, score, and its trial ladder").action(async (id, _opts, cmd) => {
|
|
6496
|
+
const org = resolveOrg(cmd);
|
|
6497
|
+
const detail = await createClient().get(itemPath2(org, id));
|
|
6498
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6499
|
+
else printDetail3(detail);
|
|
6500
|
+
});
|
|
6501
|
+
addSubjectOptions(
|
|
6502
|
+
group.command("diagnose").description(
|
|
6503
|
+
"Improvement opportunities for an eval or preference prompt from its judged sessions"
|
|
6504
|
+
)
|
|
6505
|
+
).action(async (opts, cmd) => {
|
|
6506
|
+
const org = resolveOrg(cmd);
|
|
6507
|
+
const diagnosis = await createClient().post(
|
|
6508
|
+
`${basePath(org)}/diagnoses`,
|
|
6509
|
+
parseSubject(opts)
|
|
6510
|
+
);
|
|
6511
|
+
if (resolveOutput(cmd) === "json") printJson(diagnosis);
|
|
6512
|
+
else printDiagnosis(diagnosis);
|
|
6513
|
+
});
|
|
6514
|
+
addPlanOptions(
|
|
6515
|
+
addSubjectOptions(
|
|
6516
|
+
group.command("estimate").description("Price an optimization before starting it")
|
|
6517
|
+
)
|
|
6518
|
+
).action(async (opts, cmd) => {
|
|
6519
|
+
const org = resolveOrg(cmd);
|
|
6520
|
+
const estimate = await createClient().post(
|
|
6521
|
+
`${basePath(org)}/estimate`,
|
|
6522
|
+
{ ...parseSubject(opts), ...planFromOpts(opts) }
|
|
6523
|
+
);
|
|
6524
|
+
if (resolveOutput(cmd) === "json") printJson(estimate);
|
|
6525
|
+
else printEstimate(estimate);
|
|
6526
|
+
});
|
|
6527
|
+
addPlanOptions(
|
|
6528
|
+
addSubjectOptions(
|
|
6529
|
+
group.command("start").description(
|
|
6530
|
+
"Start a Gauge-led optimization (reserves the estimate as the credit cap)"
|
|
6531
|
+
)
|
|
6532
|
+
)
|
|
6533
|
+
).option("--name <name>", "climb name (default: from the diagnosis)").option("--credit-cap <n>", "reserve this many credits instead").option("--target-score <0-1>", "stop once the score reaches this").option("--no-auto-adopt", "keep improvements pending until you adopt them").option("--yes", "skip the confirmation").action(
|
|
6534
|
+
async (opts, cmd) => {
|
|
6535
|
+
const org = resolveOrg(cmd);
|
|
6536
|
+
if (!opts.target)
|
|
6537
|
+
throw new CliError(
|
|
6538
|
+
"usage",
|
|
6539
|
+
"--target <agent[:model]> is required; see `gauge models list`"
|
|
6540
|
+
);
|
|
6541
|
+
const subject = parseSubject(opts);
|
|
6542
|
+
const plan = planFromOpts(opts);
|
|
6543
|
+
const creditCap = parseCount(opts.creditCap, "--credit-cap");
|
|
6544
|
+
const targetScore = opts.targetScore === void 0 ? void 0 : Number(opts.targetScore);
|
|
6545
|
+
if (targetScore !== void 0 && (Number.isNaN(targetScore) || targetScore < 0 || targetScore > 1))
|
|
6546
|
+
throw new CliError("usage", "--target-score must be between 0 and 1");
|
|
6547
|
+
const client = createClient();
|
|
6548
|
+
const estimate = await client.post(
|
|
6549
|
+
`${basePath(org)}/estimate`,
|
|
6550
|
+
{ ...subject, ...plan }
|
|
6551
|
+
);
|
|
6552
|
+
const cap = creditCap ?? estimate.estimate;
|
|
6553
|
+
await confirmOrAbort(
|
|
6554
|
+
`Start an optimization on ${subjectLabel(subject.subjectKind)} ${subject.subjectId}? Up to ${estimate.maxRounds} rounds, ${estimate.sampleCount} session${estimate.sampleCount === 1 ? "" : "s"} per trial, reserving ${cap} credits.`,
|
|
6555
|
+
opts.yes
|
|
6556
|
+
);
|
|
6557
|
+
const detail = await client.post(basePath(org), {
|
|
6558
|
+
...subject,
|
|
6559
|
+
...plan,
|
|
6560
|
+
name: opts.name,
|
|
6561
|
+
creditCap,
|
|
6562
|
+
autoAdopt: opts.autoAdopt,
|
|
6563
|
+
targetScore
|
|
6564
|
+
});
|
|
6565
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6566
|
+
else {
|
|
6567
|
+
console.log(
|
|
6568
|
+
`Started ${detail.id} "${detail.name}" \u2014 ${detail.creditsReserved} credits reserved. Follow it with \`gauge optimizations watch ${detail.id}\`.`
|
|
6569
|
+
);
|
|
6570
|
+
}
|
|
6571
|
+
}
|
|
6572
|
+
);
|
|
6573
|
+
for (const command of ["pause", "resume", "cancel"]) {
|
|
6574
|
+
group.command(`${command} <id>`).description(
|
|
6575
|
+
{
|
|
6576
|
+
pause: "Pause an active optimization (running sessions finish)",
|
|
6577
|
+
resume: "Resume a paused optimization",
|
|
6578
|
+
cancel: "Cancel an optimization: stops in-flight sessions and releases unspent credits"
|
|
6579
|
+
}[command]
|
|
6580
|
+
).option("--yes", "skip the confirmation (cancel only)").action(async (id, opts, cmd) => {
|
|
6581
|
+
const org = resolveOrg(cmd);
|
|
6582
|
+
if (command === "cancel")
|
|
6583
|
+
await confirmOrAbort(
|
|
6584
|
+
`Cancel optimization ${id}? In-flight sessions stop and the reservation is released.`,
|
|
6585
|
+
opts.yes
|
|
6586
|
+
);
|
|
6587
|
+
const detail = await createClient().post(
|
|
6588
|
+
`${itemPath2(org, id)}/${command}`,
|
|
6589
|
+
{}
|
|
6590
|
+
);
|
|
6591
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6592
|
+
else
|
|
6593
|
+
console.log(
|
|
6594
|
+
`${detail.id}: ${detail.status}${detail.stopReason ? ` (${detail.stopReason})` : ""}`
|
|
6595
|
+
);
|
|
6596
|
+
});
|
|
6597
|
+
}
|
|
6598
|
+
group.command("watch <id>").description("Follow an optimization until it stops, printing each change").option("--interval <seconds>", "poll interval (default 15)").action(async (id, opts, cmd) => {
|
|
6599
|
+
const org = resolveOrg(cmd);
|
|
6600
|
+
const client = createClient();
|
|
6601
|
+
const intervalMs = Math.max(Number(opts.interval ?? 15) * 1e3, 2e3);
|
|
6602
|
+
let last = "";
|
|
6603
|
+
for (; ; ) {
|
|
6604
|
+
const detail = await client.get(itemPath2(org, id));
|
|
6605
|
+
const trials2 = detail.rounds.flatMap((round) => round.trials);
|
|
6606
|
+
const line = `${detail.status} \xB7 round ${detail.round}/${detail.maxRounds} \xB7 ${pct(detail.before)} \u2192 ${pct(detail.after)} \xB7 ${detail.creditsSpent}/${detail.settings.creditCap} credits \xB7 ${trials2.filter((t) => t.status === "RUNNING").map((t) => t.key).join(",") || "idle"}`;
|
|
6607
|
+
if (line !== last) {
|
|
6608
|
+
last = line;
|
|
6609
|
+
console.error(line);
|
|
6610
|
+
}
|
|
6611
|
+
if (TERMINAL2.has(detail.status)) {
|
|
6612
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6613
|
+
else printDetail3(detail);
|
|
6614
|
+
return;
|
|
6615
|
+
}
|
|
6616
|
+
await sleep3(intervalMs);
|
|
6617
|
+
}
|
|
6618
|
+
});
|
|
6619
|
+
const trials = group.command("trials").description("List, author, and run trials");
|
|
6620
|
+
trials.command("list <id>").description("Every trial of an optimization with score and verdict").action(async (id, _opts, cmd) => {
|
|
6621
|
+
const org = resolveOrg(cmd);
|
|
6622
|
+
const res = await createClient().get(
|
|
6623
|
+
`${itemPath2(org, id)}/trials`
|
|
6624
|
+
);
|
|
6625
|
+
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
6626
|
+
else printItems(res.items.map(trialRow), "table");
|
|
6627
|
+
});
|
|
6628
|
+
trials.command("add <id>").description(
|
|
6629
|
+
"Author a trial on a manual optimization and run it (spends credits)"
|
|
6630
|
+
).option(
|
|
6631
|
+
"--file <path>",
|
|
6632
|
+
"a proposal JSON: one {trial, files?} or the array `propose -o json` prints; '-' for stdin"
|
|
6633
|
+
).option("--pick <n>", "which proposal to take from an array (default 1)").option("--title <text>", "what the change is").option("--hypothesis <text>", "why it should help").option("--lever <lever>", "DOCS, MARKETING_SITE, SKILL, SDK, CLI").option(
|
|
6634
|
+
"--kind <kind>",
|
|
6635
|
+
"ADD_SKILL (default with --skill-version), EDIT_SKILL"
|
|
6636
|
+
).option("--skill-version <id>", "skill version to add (or edit via --file)").option("--remove-skill <id>", "skill version to remove from the baseline").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(
|
|
6637
|
+
"--fork-boundary <seq>",
|
|
6638
|
+
"fork-at-fetch boundary from `gauge experiments boundaries`"
|
|
6639
|
+
).option(
|
|
6640
|
+
"--no-launch",
|
|
6641
|
+
"save the trial as a draft; run it with `trials run`"
|
|
6642
|
+
).option("--yes", "skip the confirmation").action(
|
|
6643
|
+
async (id, opts, cmd) => {
|
|
6644
|
+
const org = resolveOrg(cmd);
|
|
6645
|
+
const body = trialBodyFromOpts(opts);
|
|
6646
|
+
if (body.launch !== false)
|
|
6647
|
+
await confirmOrAbort(
|
|
6648
|
+
`Run trial "${body.trial.title}" on ${id} now? Spends credits.`,
|
|
6649
|
+
opts.yes
|
|
6650
|
+
);
|
|
6651
|
+
const result = await createClient().post(`${itemPath2(org, id)}/trials`, body);
|
|
6652
|
+
if (resolveOutput(cmd) === "json") printJson(result);
|
|
6653
|
+
else
|
|
6654
|
+
console.log(
|
|
6655
|
+
`${result.launch ? "Running" : "Saved"} ${result.trial.key} "${result.trial.title}"${result.launch ? ` \u2014 ${result.launch.runIds.length} session${result.launch.runIds.length === 1 ? "" : "s"}` : ""}`
|
|
6656
|
+
);
|
|
6657
|
+
}
|
|
6658
|
+
);
|
|
6659
|
+
trials.command("run <id> <trialId>").description("Run a draft trial now (spends credits)").option("--yes", "skip the confirmation").action(
|
|
6660
|
+
async (id, trialId, opts, cmd) => {
|
|
6661
|
+
const org = resolveOrg(cmd);
|
|
6662
|
+
await confirmOrAbort(
|
|
6663
|
+
`Run trial ${trialId} now? Spends credits.`,
|
|
6664
|
+
opts.yes
|
|
6665
|
+
);
|
|
6666
|
+
const result = await createClient().post(
|
|
6667
|
+
`${trialPath(org, id, trialId)}/launch`,
|
|
6668
|
+
{}
|
|
6669
|
+
);
|
|
6670
|
+
if (resolveOutput(cmd) === "json") printJson(result);
|
|
6671
|
+
else
|
|
6672
|
+
console.log(
|
|
6673
|
+
`Started ${result.runIds.length} session${result.runIds.length === 1 ? "" : "s"} for ${trialId}`
|
|
6674
|
+
);
|
|
6675
|
+
}
|
|
6676
|
+
);
|
|
6677
|
+
group.command("trial <id> <trialId>").description("One trial by id or key (B0, T1, \u2026) with its sessions").action(
|
|
6678
|
+
async (id, trialId, _opts, cmd) => {
|
|
6679
|
+
const org = resolveOrg(cmd);
|
|
6680
|
+
const trial = await createClient().get(
|
|
6681
|
+
trialPath(org, id, trialId)
|
|
6682
|
+
);
|
|
6683
|
+
if (resolveOutput(cmd) === "json") printJson(trial);
|
|
6684
|
+
else printTrial(trial);
|
|
6685
|
+
}
|
|
6686
|
+
);
|
|
6687
|
+
group.command("change <id> <trialId>").description("The change a trial made: before and after text per document").option("--body", "print only the pasteable page body of a docs rewrite").action(
|
|
6688
|
+
async (id, trialId, opts, cmd) => {
|
|
6689
|
+
const org = resolveOrg(cmd);
|
|
6690
|
+
const content = await createClient().get(
|
|
6691
|
+
`${trialPath(org, id, trialId)}/content`
|
|
6692
|
+
);
|
|
6693
|
+
if (resolveOutput(cmd) === "json") printJson(content);
|
|
6694
|
+
else if (opts.body) {
|
|
6695
|
+
if (content.copyableBody === null)
|
|
6696
|
+
throw new CliError(
|
|
6697
|
+
"usage",
|
|
6698
|
+
"this trial is not a docs rewrite; drop --body"
|
|
6699
|
+
);
|
|
6700
|
+
console.log(content.copyableBody);
|
|
6701
|
+
} else printChange(content);
|
|
6702
|
+
}
|
|
6703
|
+
);
|
|
6704
|
+
group.command("adopt <id> <trialId>").description(
|
|
6705
|
+
"Make a settled BETTER trial the moving baseline (the eval itself is unchanged)"
|
|
6706
|
+
).action(
|
|
6707
|
+
async (id, trialId, _opts, cmd) => {
|
|
6708
|
+
const org = resolveOrg(cmd);
|
|
6709
|
+
const detail = await createClient().post(
|
|
6710
|
+
`${trialPath(org, id, trialId)}/adopt`,
|
|
6711
|
+
{}
|
|
6712
|
+
);
|
|
6713
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6714
|
+
else
|
|
6715
|
+
console.log(
|
|
6716
|
+
`Adopted ${trialId}; baseline is now ${pct(detail.after)}`
|
|
6717
|
+
);
|
|
6718
|
+
}
|
|
6719
|
+
);
|
|
6720
|
+
group.command("propose <id>").description(
|
|
6721
|
+
"Ask Gauge's proposer for one to three trial drafts (nothing runs; feed one to `trials add --file`)"
|
|
6722
|
+
).option("--request <text>", "steer the proposer").option("--lever <lever>", "keep to one lever").option("--kind <kind>", "keep to one change kind").option("--target-version <id>", "keep to one skill version").action(
|
|
6723
|
+
async (id, opts, cmd) => {
|
|
6724
|
+
const org = resolveOrg(cmd);
|
|
6725
|
+
const res = await createClient().post(
|
|
6726
|
+
`${itemPath2(org, id)}/propose`,
|
|
6727
|
+
{
|
|
6728
|
+
request: opts.request,
|
|
6729
|
+
lever: opts.lever?.toUpperCase(),
|
|
6730
|
+
kind: opts.kind?.toUpperCase(),
|
|
6731
|
+
targetVersionId: opts.targetVersion
|
|
6732
|
+
}
|
|
6733
|
+
);
|
|
6734
|
+
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
6735
|
+
else {
|
|
6736
|
+
for (const [index, proposal] of res.items.entries()) {
|
|
6737
|
+
console.log(
|
|
6738
|
+
`[${index + 1}] ${proposal.trial.title} \u2014 ${proposal.trial.intervention.kind} on ${proposal.trial.lever}`
|
|
6739
|
+
);
|
|
6740
|
+
if (proposal.trial.hypothesis)
|
|
6741
|
+
console.log(` ${proposal.trial.hypothesis}`);
|
|
6742
|
+
}
|
|
6743
|
+
console.error(
|
|
6744
|
+
"Save them with `-o json > proposals.json`, then `gauge optimizations trials add <id> --file proposals.json --pick <n>`."
|
|
6745
|
+
);
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6748
|
+
);
|
|
6749
|
+
group.command("skill-files <versionId>").description(
|
|
6750
|
+
"The text files of a skill version, the base an EDIT_SKILL trial edits"
|
|
6751
|
+
).action(async (versionId, _opts, cmd) => {
|
|
6752
|
+
const org = resolveOrg(cmd);
|
|
6753
|
+
const res = await createClient().get(
|
|
6754
|
+
`${basePath(org)}/skill-versions/${encodeURIComponent(versionId)}`
|
|
6755
|
+
);
|
|
6756
|
+
if (resolveOutput(cmd) === "json") printJson(res);
|
|
6757
|
+
else
|
|
6758
|
+
for (const file of res.files) {
|
|
6759
|
+
console.log(`=== ${file.path}`);
|
|
6760
|
+
console.log(file.body);
|
|
6761
|
+
}
|
|
6762
|
+
});
|
|
6763
|
+
group.command("page <id>").description(
|
|
6764
|
+
"The baseline body of a docs page, the base a REWRITE_DOCS trial edits"
|
|
6765
|
+
).requiredOption("--url <url>", "the page URL").action(async (id, opts, cmd) => {
|
|
6766
|
+
const org = resolveOrg(cmd);
|
|
6767
|
+
const res = await createClient().get(
|
|
6768
|
+
`${itemPath2(org, id)}/page`,
|
|
6769
|
+
{ url: opts.url }
|
|
6770
|
+
);
|
|
6771
|
+
if (resolveOutput(cmd) === "json") printJson(res);
|
|
6772
|
+
else console.log(res.body);
|
|
6773
|
+
});
|
|
6774
|
+
}
|
|
6775
|
+
|
|
5592
6776
|
// src/commands/org.ts
|
|
5593
6777
|
var org_exports = {};
|
|
5594
6778
|
__export(org_exports, {
|
|
5595
|
-
register: () =>
|
|
6779
|
+
register: () => register17
|
|
5596
6780
|
});
|
|
5597
6781
|
function printSettings(s) {
|
|
5598
6782
|
console.log(`slug: ${s.slug}`);
|
|
@@ -5606,7 +6790,7 @@ function printSettings(s) {
|
|
|
5606
6790
|
);
|
|
5607
6791
|
console.log(`auto-join: ${s.autoJoinDomain ?? "off"}`);
|
|
5608
6792
|
}
|
|
5609
|
-
function
|
|
6793
|
+
function register17(program2) {
|
|
5610
6794
|
const group = program2.command("org").description(
|
|
5611
6795
|
"This org's settings, read-only (see `gauge orgs` for the org list)"
|
|
5612
6796
|
);
|
|
@@ -5623,12 +6807,12 @@ function register16(program2) {
|
|
|
5623
6807
|
// src/commands/orgs.ts
|
|
5624
6808
|
var orgs_exports2 = {};
|
|
5625
6809
|
__export(orgs_exports2, {
|
|
5626
|
-
register: () =>
|
|
6810
|
+
register: () => register18
|
|
5627
6811
|
});
|
|
5628
6812
|
function isDefault(org, defaultOrg) {
|
|
5629
6813
|
return defaultOrg !== void 0 && (org.slug === defaultOrg || org.publicId === defaultOrg);
|
|
5630
6814
|
}
|
|
5631
|
-
function
|
|
6815
|
+
function register18(program2) {
|
|
5632
6816
|
const orgs = program2.command("orgs").description("Organizations");
|
|
5633
6817
|
orgs.command("list").description("List orgs you belong to").action(async (_opts, command) => {
|
|
5634
6818
|
const output = resolveOutput(command);
|
|
@@ -5699,12 +6883,12 @@ function register17(program2) {
|
|
|
5699
6883
|
// src/commands/personas.ts
|
|
5700
6884
|
var personas_exports2 = {};
|
|
5701
6885
|
__export(personas_exports2, {
|
|
5702
|
-
register: () =>
|
|
6886
|
+
register: () => register19
|
|
5703
6887
|
});
|
|
5704
6888
|
function personasPath(org) {
|
|
5705
6889
|
return `/api/v1/orgs/${encodeURIComponent(org)}/personas`;
|
|
5706
6890
|
}
|
|
5707
|
-
function
|
|
6891
|
+
function register19(program2) {
|
|
5708
6892
|
const group = program2.command("personas").description("Manage simulated-user personas for eval and visibility runs");
|
|
5709
6893
|
group.command("list").description("List the org's personas").action(async (_opts, cmd) => {
|
|
5710
6894
|
const org = resolveOrg(cmd);
|
|
@@ -5777,7 +6961,7 @@ function register18(program2) {
|
|
|
5777
6961
|
// src/commands/query.ts
|
|
5778
6962
|
var query_exports2 = {};
|
|
5779
6963
|
__export(query_exports2, {
|
|
5780
|
-
register: () =>
|
|
6964
|
+
register: () => register20
|
|
5781
6965
|
});
|
|
5782
6966
|
var collect3 = (value, prev = []) => [
|
|
5783
6967
|
...prev,
|
|
@@ -5882,7 +7066,7 @@ async function buildSpec(opts) {
|
|
|
5882
7066
|
}
|
|
5883
7067
|
return spec;
|
|
5884
7068
|
}
|
|
5885
|
-
var
|
|
7069
|
+
var pct2 = (n) => `${(n * 100).toFixed(1)}%`;
|
|
5886
7070
|
function noteFreshness(f) {
|
|
5887
7071
|
if (!f.available) {
|
|
5888
7072
|
console.error(
|
|
@@ -5916,7 +7100,7 @@ ${res.sql}
|
|
|
5916
7100
|
const out = {};
|
|
5917
7101
|
for (const col of res.columns) {
|
|
5918
7102
|
const v = row[col.key];
|
|
5919
|
-
out[col.key] = rateKeys.has(col.key) && typeof v === "number" ?
|
|
7103
|
+
out[col.key] = rateKeys.has(col.key) && typeof v === "number" ? pct2(v) : v;
|
|
5920
7104
|
}
|
|
5921
7105
|
return out;
|
|
5922
7106
|
});
|
|
@@ -5969,7 +7153,7 @@ async function showMetadata(command, mode, dataset) {
|
|
|
5969
7153
|
console.error(`dataset: ${ds.name} \u2014 ${ds.grain}`);
|
|
5970
7154
|
printItems(rows, "table");
|
|
5971
7155
|
}
|
|
5972
|
-
function
|
|
7156
|
+
function register20(program2) {
|
|
5973
7157
|
const group = program2.command("query").description(
|
|
5974
7158
|
"Flexible reports over your event warehouse (run a report, or discover the catalog)"
|
|
5975
7159
|
);
|
|
@@ -6005,7 +7189,7 @@ function register19(program2) {
|
|
|
6005
7189
|
// src/commands/repos.ts
|
|
6006
7190
|
var repos_exports2 = {};
|
|
6007
7191
|
__export(repos_exports2, {
|
|
6008
|
-
register: () =>
|
|
7192
|
+
register: () => register21
|
|
6009
7193
|
});
|
|
6010
7194
|
function reposPath(org) {
|
|
6011
7195
|
return `/api/v1/orgs/${encodeURIComponent(org)}/repos`;
|
|
@@ -6013,7 +7197,7 @@ function reposPath(org) {
|
|
|
6013
7197
|
async function fetchAllRepos(client, org) {
|
|
6014
7198
|
return fetchAllPages(client, reposPath(org));
|
|
6015
7199
|
}
|
|
6016
|
-
function
|
|
7200
|
+
function toRow5(repo) {
|
|
6017
7201
|
return {
|
|
6018
7202
|
name: repo.name,
|
|
6019
7203
|
url: repo.url,
|
|
@@ -6028,7 +7212,7 @@ function toRow4(repo) {
|
|
|
6028
7212
|
function syncWarning(repo) {
|
|
6029
7213
|
return `warning: GitHub metadata sync failed; retry with \`gauge repos resync ${repo.url}\``;
|
|
6030
7214
|
}
|
|
6031
|
-
function
|
|
7215
|
+
function register21(program2) {
|
|
6032
7216
|
const repos = program2.command("repos").description("Manage repositories");
|
|
6033
7217
|
repos.command("list").description("List repositories (yours + read-only Gauge-provided ones)").action(async (_opts, command) => {
|
|
6034
7218
|
const org = resolveOrg(command);
|
|
@@ -6038,7 +7222,7 @@ function register20(program2) {
|
|
|
6038
7222
|
printJson(items);
|
|
6039
7223
|
return;
|
|
6040
7224
|
}
|
|
6041
|
-
printItems(items.map(
|
|
7225
|
+
printItems(items.map(toRow5), "table");
|
|
6042
7226
|
});
|
|
6043
7227
|
repos.command("add <url>").description("Add a repository (pulls languages/size/stars from GitHub)").option(
|
|
6044
7228
|
"--ref <ref>",
|
|
@@ -6125,7 +7309,7 @@ function register20(program2) {
|
|
|
6125
7309
|
// src/commands/runs.ts
|
|
6126
7310
|
var runs_exports2 = {};
|
|
6127
7311
|
__export(runs_exports2, {
|
|
6128
|
-
register: () =>
|
|
7312
|
+
register: () => register22
|
|
6129
7313
|
});
|
|
6130
7314
|
function runPath(id) {
|
|
6131
7315
|
return `/api/v1/runs/${encodeURIComponent(id)}`;
|
|
@@ -6146,7 +7330,7 @@ function compact(value, max = 140) {
|
|
|
6146
7330
|
const one = s.replace(/\s+/g, " ").trim();
|
|
6147
7331
|
return one.length > max ? `${one.slice(0, max - 1)}\u2026` : one;
|
|
6148
7332
|
}
|
|
6149
|
-
function
|
|
7333
|
+
function toRow6(run) {
|
|
6150
7334
|
const selected = run.selectedProvider?.slug ?? "";
|
|
6151
7335
|
const observed = run.observedProvider?.slug;
|
|
6152
7336
|
return {
|
|
@@ -6385,7 +7569,7 @@ async function streamRun(id, json, opts) {
|
|
|
6385
7569
|
if (drainTimer) clearTimeout(drainTimer);
|
|
6386
7570
|
}
|
|
6387
7571
|
}
|
|
6388
|
-
function
|
|
7572
|
+
function register22(program2) {
|
|
6389
7573
|
const runs = program2.command("runs").description("Inspect and manage runs");
|
|
6390
7574
|
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(
|
|
6391
7575
|
async (opts, command) => {
|
|
@@ -6408,7 +7592,7 @@ function register21(program2) {
|
|
|
6408
7592
|
printJson(page);
|
|
6409
7593
|
return;
|
|
6410
7594
|
}
|
|
6411
|
-
printItems(page.items.map(
|
|
7595
|
+
printItems(page.items.map(toRow6), "table");
|
|
6412
7596
|
if (page.nextCursor) {
|
|
6413
7597
|
console.error(
|
|
6414
7598
|
`(more results \u2014 rerun with --cursor ${page.nextCursor})`
|
|
@@ -6509,7 +7693,7 @@ function register21(program2) {
|
|
|
6509
7693
|
var skills_exports2 = {};
|
|
6510
7694
|
__export(skills_exports2, {
|
|
6511
7695
|
buildSkillEditBody: () => buildSkillEditBody,
|
|
6512
|
-
register: () =>
|
|
7696
|
+
register: () => register23
|
|
6513
7697
|
});
|
|
6514
7698
|
function skillsPath(org) {
|
|
6515
7699
|
return `/api/v1/orgs/${encodeURIComponent(org)}/skills`;
|
|
@@ -6571,7 +7755,7 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
|
6571
7755
|
throw new CliError("usage", "nothing to change");
|
|
6572
7756
|
return body;
|
|
6573
7757
|
}
|
|
6574
|
-
function
|
|
7758
|
+
function register23(program2) {
|
|
6575
7759
|
const group = program2.command("skills").description("Manage agent skills used by eval and visibility runs");
|
|
6576
7760
|
group.command("list").description("List the org's skills with their newest version").action(async (_opts, cmd) => {
|
|
6577
7761
|
const org = resolveOrg(cmd);
|
|
@@ -6593,21 +7777,21 @@ function register22(program2) {
|
|
|
6593
7777
|
});
|
|
6594
7778
|
group.command("get <ref>").description("Show one skill: source, note, every version").action(async (ref, _opts, cmd) => {
|
|
6595
7779
|
const org = resolveOrg(cmd);
|
|
6596
|
-
const
|
|
7780
|
+
const skill2 = await createClient().get(
|
|
6597
7781
|
skillPath(org, ref)
|
|
6598
7782
|
);
|
|
6599
7783
|
if (resolveOutput(cmd) === "json") {
|
|
6600
|
-
printJson(
|
|
7784
|
+
printJson(skill2);
|
|
6601
7785
|
return;
|
|
6602
7786
|
}
|
|
6603
|
-
console.log(`name: ${
|
|
6604
|
-
console.log(`id: ${
|
|
6605
|
-
console.log(`note: ${
|
|
6606
|
-
console.log(`source: ${sourceLabel(
|
|
7787
|
+
console.log(`name: ${skill2.name}`);
|
|
7788
|
+
console.log(`id: ${skill2.id}`);
|
|
7789
|
+
console.log(`note: ${skill2.note ?? "(none)"}`);
|
|
7790
|
+
console.log(`source: ${sourceLabel(skill2.source) || "(untracked)"}`);
|
|
6607
7791
|
console.log("versions:");
|
|
6608
|
-
for (const v of
|
|
7792
|
+
for (const v of skill2.versions)
|
|
6609
7793
|
console.log(
|
|
6610
|
-
` ${
|
|
7794
|
+
` ${skill2.name}@${v.label} ${v.contentDigest.slice(0, 19)} ${v.createdAt}`
|
|
6611
7795
|
);
|
|
6612
7796
|
});
|
|
6613
7797
|
group.command("add <reference>").description("Ingest a skill from owner/repo[/skill][#ref] or a GitHub URL").option("--as <handle>", "our handle (default: the directory basename)").option(
|
|
@@ -6652,8 +7836,8 @@ function register22(program2) {
|
|
|
6652
7836
|
const org = resolveOrg(cmd);
|
|
6653
7837
|
const client = createClient();
|
|
6654
7838
|
const body = await buildSkillEditBody(opts, async () => {
|
|
6655
|
-
const
|
|
6656
|
-
return
|
|
7839
|
+
const skill2 = await client.get(skillPath(org, ref));
|
|
7840
|
+
return skill2.source;
|
|
6657
7841
|
});
|
|
6658
7842
|
const updated = await client.patch(
|
|
6659
7843
|
skillPath(org, ref),
|
|
@@ -6712,7 +7896,7 @@ function register22(program2) {
|
|
|
6712
7896
|
// src/commands/stats.ts
|
|
6713
7897
|
var stats_exports2 = {};
|
|
6714
7898
|
__export(stats_exports2, {
|
|
6715
|
-
register: () =>
|
|
7899
|
+
register: () => register24
|
|
6716
7900
|
});
|
|
6717
7901
|
function addFilterOptions(cmd) {
|
|
6718
7902
|
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)");
|
|
@@ -6732,7 +7916,7 @@ function filterQuery(opts) {
|
|
|
6732
7916
|
limit: opts.full ? "1000" : opts.limit
|
|
6733
7917
|
};
|
|
6734
7918
|
}
|
|
6735
|
-
var
|
|
7919
|
+
var pct3 = (rate) => `${(rate * 100).toFixed(1)}%`;
|
|
6736
7920
|
var delta = (d) => d === null || d === 0 ? "\u2014" : d > 0 ? `+${d}` : String(d);
|
|
6737
7921
|
function noteFreshness2(f) {
|
|
6738
7922
|
if (!f.available) {
|
|
@@ -6745,7 +7929,7 @@ function noteFreshness2(f) {
|
|
|
6745
7929
|
);
|
|
6746
7930
|
}
|
|
6747
7931
|
}
|
|
6748
|
-
async function runStats(command, resource, opts,
|
|
7932
|
+
async function runStats(command, resource, opts, toRow8) {
|
|
6749
7933
|
const org = resolveOrg(command);
|
|
6750
7934
|
const output = resolveOutput(command);
|
|
6751
7935
|
const res = await createClient().get(
|
|
@@ -6756,7 +7940,7 @@ async function runStats(command, resource, opts, toRow7) {
|
|
|
6756
7940
|
printJson(res);
|
|
6757
7941
|
return;
|
|
6758
7942
|
}
|
|
6759
|
-
printItems(res.items.map(
|
|
7943
|
+
printItems(res.items.map(toRow8), "table");
|
|
6760
7944
|
noteFreshness2(res.freshness);
|
|
6761
7945
|
}
|
|
6762
7946
|
var rankingRow = (r) => ({
|
|
@@ -6764,8 +7948,8 @@ var rankingRow = (r) => ({
|
|
|
6764
7948
|
brand: r.brandName,
|
|
6765
7949
|
kind: r.kind,
|
|
6766
7950
|
installs: r.installs,
|
|
6767
|
-
"install%":
|
|
6768
|
-
"mention%":
|
|
7951
|
+
"install%": pct3(r.installRate),
|
|
7952
|
+
"mention%": pct3(r.mentionRate),
|
|
6769
7953
|
delta: delta(r.deltaRank)
|
|
6770
7954
|
});
|
|
6771
7955
|
var packageRow = (r) => ({
|
|
@@ -6774,28 +7958,28 @@ var packageRow = (r) => ({
|
|
|
6774
7958
|
brand: r.brandName,
|
|
6775
7959
|
kind: r.kind,
|
|
6776
7960
|
installs: r.installs,
|
|
6777
|
-
rate:
|
|
7961
|
+
rate: pct3(r.rate)
|
|
6778
7962
|
});
|
|
6779
7963
|
var brandRow = (r) => ({
|
|
6780
7964
|
brand: r.brandName,
|
|
6781
7965
|
kind: r.kind,
|
|
6782
7966
|
installs: r.installs,
|
|
6783
|
-
rate:
|
|
7967
|
+
rate: pct3(r.rate)
|
|
6784
7968
|
});
|
|
6785
7969
|
var funnelRow = (r) => ({
|
|
6786
7970
|
brand: r.brandName,
|
|
6787
7971
|
kind: r.kind,
|
|
6788
|
-
"mention%":
|
|
6789
|
-
"install%":
|
|
7972
|
+
"mention%": pct3(r.mentionRate),
|
|
7973
|
+
"install%": pct3(r.installRate)
|
|
6790
7974
|
});
|
|
6791
7975
|
var domainRow = (r) => ({
|
|
6792
7976
|
domain: r.domain,
|
|
6793
7977
|
brand: r.brandName,
|
|
6794
7978
|
runs: r.runs,
|
|
6795
|
-
rate:
|
|
7979
|
+
rate: pct3(r.rate),
|
|
6796
7980
|
requests: r.requests
|
|
6797
7981
|
});
|
|
6798
|
-
function
|
|
7982
|
+
function register24(program2) {
|
|
6799
7983
|
const group = program2.command("stats").description("Read-only analytics over your runs");
|
|
6800
7984
|
addFilterOptions(
|
|
6801
7985
|
group.command("rankings").description("Brands ranked by install rate")
|
|
@@ -6827,9 +8011,9 @@ function register23(program2) {
|
|
|
6827
8011
|
// src/commands/status.ts
|
|
6828
8012
|
var status_exports = {};
|
|
6829
8013
|
__export(status_exports, {
|
|
6830
|
-
register: () =>
|
|
8014
|
+
register: () => register25
|
|
6831
8015
|
});
|
|
6832
|
-
function
|
|
8016
|
+
function pct4(rate) {
|
|
6833
8017
|
return rate == null ? "\u2014" : `${Math.round(rate * 100)}%`;
|
|
6834
8018
|
}
|
|
6835
8019
|
function delta2(pp) {
|
|
@@ -6837,7 +8021,7 @@ function delta2(pp) {
|
|
|
6837
8021
|
const rounded = Math.round(pp);
|
|
6838
8022
|
return rounded === 0 ? "" : ` (${rounded > 0 ? "+" : ""}${rounded}pp)`;
|
|
6839
8023
|
}
|
|
6840
|
-
function
|
|
8024
|
+
function register25(program2) {
|
|
6841
8025
|
program2.command("status").description("One-shot org summary: actions, visibility, agent experience").action(async (_opts, cmd) => {
|
|
6842
8026
|
const org = resolveOrg(cmd);
|
|
6843
8027
|
const s = await createClient().get(
|
|
@@ -6862,7 +8046,7 @@ function register24(program2) {
|
|
|
6862
8046
|
} else {
|
|
6863
8047
|
for (const card of s.agentExperience.data.cards) {
|
|
6864
8048
|
console.log(
|
|
6865
|
-
` ${card.name}: ${
|
|
8049
|
+
` ${card.name}: ${pct4(card.passRate)}${delta2(card.deltaPP)} over ${card.judgedRuns} judged run(s)`
|
|
6866
8050
|
);
|
|
6867
8051
|
}
|
|
6868
8052
|
const extra = s.agentExperience.data.setCount - s.agentExperience.data.cards.length;
|
|
@@ -6875,7 +8059,7 @@ function register24(program2) {
|
|
|
6875
8059
|
console.log(" (no visibility runs in the last 30 days)");
|
|
6876
8060
|
} else {
|
|
6877
8061
|
for (const card of s.visibility.data.cards) {
|
|
6878
|
-
const owned = card.owned ? `${card.owned.name} #${card.owned.rank}, chosen ${
|
|
8062
|
+
const owned = card.owned ? `${card.owned.name} #${card.owned.rank}, chosen ${pct4(card.owned.chosenRate)}${delta2(card.chosenDeltaPP)}` : "no owned brand ranked";
|
|
6879
8063
|
console.log(` ${card.name}: ${owned}`);
|
|
6880
8064
|
}
|
|
6881
8065
|
}
|
|
@@ -6899,12 +8083,12 @@ function register24(program2) {
|
|
|
6899
8083
|
// src/commands/tags.ts
|
|
6900
8084
|
var tags_exports2 = {};
|
|
6901
8085
|
__export(tags_exports2, {
|
|
6902
|
-
register: () =>
|
|
8086
|
+
register: () => register26
|
|
6903
8087
|
});
|
|
6904
8088
|
function tagsPath(org) {
|
|
6905
8089
|
return `/api/v1/orgs/${encodeURIComponent(org)}/tags`;
|
|
6906
8090
|
}
|
|
6907
|
-
function
|
|
8091
|
+
function register26(program2) {
|
|
6908
8092
|
const group = program2.command("tags").description("Manage org tags");
|
|
6909
8093
|
group.command("list").description("List tags").action(async (_opts, cmd) => {
|
|
6910
8094
|
const org = resolveOrg(cmd);
|
|
@@ -6947,9 +8131,9 @@ function register25(program2) {
|
|
|
6947
8131
|
// src/commands/usage.ts
|
|
6948
8132
|
var usage_exports = {};
|
|
6949
8133
|
__export(usage_exports, {
|
|
6950
|
-
register: () =>
|
|
8134
|
+
register: () => register27
|
|
6951
8135
|
});
|
|
6952
|
-
function
|
|
8136
|
+
function register27(program2) {
|
|
6953
8137
|
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(
|
|
6954
8138
|
async (opts, cmd) => {
|
|
6955
8139
|
const org = resolveOrg(cmd);
|
|
@@ -6996,7 +8180,7 @@ function register26(program2) {
|
|
|
6996
8180
|
// src/commands/visibility.ts
|
|
6997
8181
|
var visibility_exports2 = {};
|
|
6998
8182
|
__export(visibility_exports2, {
|
|
6999
|
-
register: () =>
|
|
8183
|
+
register: () => register28,
|
|
7000
8184
|
visibilityPath: () => visibilityPath
|
|
7001
8185
|
});
|
|
7002
8186
|
function visibilityPath(org) {
|
|
@@ -7027,7 +8211,7 @@ function brandsLabel(v) {
|
|
|
7027
8211
|
if (v.kind === "HEAD_TO_HEAD") return `${v.brandA} vs ${v.brandB}`;
|
|
7028
8212
|
return v.branded ? v.brandA ?? "branded" : "organic";
|
|
7029
8213
|
}
|
|
7030
|
-
function
|
|
8214
|
+
function toRow7(v) {
|
|
7031
8215
|
return {
|
|
7032
8216
|
id: v.id,
|
|
7033
8217
|
name: v.name,
|
|
@@ -7039,7 +8223,7 @@ function toRow6(v) {
|
|
|
7039
8223
|
"last run": v.lastRunAt ?? "-"
|
|
7040
8224
|
};
|
|
7041
8225
|
}
|
|
7042
|
-
function
|
|
8226
|
+
function printDetail4(v) {
|
|
7043
8227
|
console.log(`id: ${v.id}`);
|
|
7044
8228
|
console.log(`name: ${v.name}`);
|
|
7045
8229
|
console.log(`kind: ${v.kind}`);
|
|
@@ -7074,7 +8258,7 @@ function registerPreferenceGroup(group) {
|
|
|
7074
8258
|
visibilityPath(org)
|
|
7075
8259
|
);
|
|
7076
8260
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
7077
|
-
else printItems(res.items.map(
|
|
8261
|
+
else printItems(res.items.map(toRow7), "table");
|
|
7078
8262
|
});
|
|
7079
8263
|
group.command("get <id>").description("Show one preference prompt").action(async (id, _opts, cmd) => {
|
|
7080
8264
|
const org = resolveOrg(cmd);
|
|
@@ -7082,7 +8266,7 @@ function registerPreferenceGroup(group) {
|
|
|
7082
8266
|
`${visibilityPath(org)}/${encodeURIComponent(id)}`
|
|
7083
8267
|
);
|
|
7084
8268
|
if (resolveOutput(cmd) === "json") printJson(vp);
|
|
7085
|
-
else
|
|
8269
|
+
else printDetail4(vp);
|
|
7086
8270
|
});
|
|
7087
8271
|
addRunSettingsCreateOptions(
|
|
7088
8272
|
group.command("create").description(
|
|
@@ -7345,7 +8529,7 @@ function registerPreferenceGroup(group) {
|
|
|
7345
8529
|
);
|
|
7346
8530
|
});
|
|
7347
8531
|
}
|
|
7348
|
-
function
|
|
8532
|
+
function register28(program2) {
|
|
7349
8533
|
const preference = program2.command("preference").description("Manage Agent Preference prompts and measured markets");
|
|
7350
8534
|
registerPreferenceGroup(preference);
|
|
7351
8535
|
const legacy = program2.command("visibility", { hidden: true });
|
|
@@ -7377,6 +8561,7 @@ for (const group of [
|
|
|
7377
8561
|
mcp_exports2,
|
|
7378
8562
|
repos_exports2,
|
|
7379
8563
|
runs_exports2,
|
|
8564
|
+
optimizations_exports2,
|
|
7380
8565
|
experiments_exports2,
|
|
7381
8566
|
apply_exports,
|
|
7382
8567
|
batches_exports,
|