@withgauge/cli 0.9.0 → 0.10.2
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 +1591 -319
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -80,6 +80,8 @@ import { z as z3 } from "zod";
|
|
|
80
80
|
var checkStatusSchema = z3.enum(["pass", "attention", "unassessed"]);
|
|
81
81
|
var checklistItemSchema = z3.object({
|
|
82
82
|
label: z3.string().min(1),
|
|
83
|
+
/** Still running; distinct from a completed, unassessed finding. */
|
|
84
|
+
pending: z3.boolean().optional(),
|
|
83
85
|
status: checkStatusSchema,
|
|
84
86
|
evidence: z3.string().min(1),
|
|
85
87
|
/** Present when the item is backed by observed coding sessions rather than a
|
|
@@ -116,6 +118,34 @@ var sessionUsageSchema = z3.object({
|
|
|
116
118
|
cacheReadInputTokens: z3.number().int().nonnegative(),
|
|
117
119
|
cacheCreationInputTokens: z3.number().int().nonnegative()
|
|
118
120
|
});
|
|
121
|
+
var sessionFindingSchema = z3.object({
|
|
122
|
+
title: z3.string().min(1).max(160),
|
|
123
|
+
detail: z3.string().min(1).max(600),
|
|
124
|
+
evidence: z3.array(
|
|
125
|
+
z3.object({
|
|
126
|
+
seq: z3.number().int().nonnegative(),
|
|
127
|
+
quote: z3.string().min(1).max(500)
|
|
128
|
+
})
|
|
129
|
+
).min(1).max(4)
|
|
130
|
+
});
|
|
131
|
+
var onboardingSchema = z3.object({
|
|
132
|
+
status: z3.enum(["verified", "login_required", "not_verified"]),
|
|
133
|
+
detail: z3.string().min(1).max(600),
|
|
134
|
+
evidence: z3.array(
|
|
135
|
+
z3.object({
|
|
136
|
+
kind: z3.enum(["credentials", "operation", "blocker"]),
|
|
137
|
+
seq: z3.number().int().nonnegative(),
|
|
138
|
+
quote: z3.string().min(1).max(500)
|
|
139
|
+
})
|
|
140
|
+
).max(6)
|
|
141
|
+
});
|
|
142
|
+
var sessionAnalysisSchema = z3.object({
|
|
143
|
+
status: z3.enum(["complete", "unavailable"]),
|
|
144
|
+
onboarding: onboardingSchema.optional(),
|
|
145
|
+
hallucinatedUrls: z3.array(sessionFindingSchema).max(8),
|
|
146
|
+
blockers: z3.array(sessionFindingSchema).max(8),
|
|
147
|
+
suggestedChanges: z3.array(sessionFindingSchema).max(8)
|
|
148
|
+
});
|
|
119
149
|
var sessionSchema = z3.object({
|
|
120
150
|
id: z3.string().regex(/^[a-z0-9-]+$/),
|
|
121
151
|
name: z3.string().min(1),
|
|
@@ -126,10 +156,44 @@ var sessionSchema = z3.object({
|
|
|
126
156
|
auth: z3.number().int(),
|
|
127
157
|
pricing: z3.number().int(),
|
|
128
158
|
pricingReview: z3.string(),
|
|
159
|
+
analysis: sessionAnalysisSchema.optional(),
|
|
129
160
|
/** The alg run id the transcript was recorded from. */
|
|
130
161
|
run: z3.string().min(1),
|
|
131
162
|
completed: z3.boolean(),
|
|
132
|
-
usage: sessionUsageSchema.nullable()
|
|
163
|
+
usage: sessionUsageSchema.nullable(),
|
|
164
|
+
/** Public Gauge run page. Null while unpublished (e.g. a private
|
|
165
|
+
* calibration org) — never a guessed org-scoped URL. */
|
|
166
|
+
gaugeUrl: z3.string().url().nullable().default(null)
|
|
167
|
+
});
|
|
168
|
+
var sessionProgressStatusSchema = z3.enum([
|
|
169
|
+
"queued",
|
|
170
|
+
"running",
|
|
171
|
+
"complete",
|
|
172
|
+
"failed",
|
|
173
|
+
"timed_out"
|
|
174
|
+
]);
|
|
175
|
+
var checkProgressStatusSchema = z3.enum([
|
|
176
|
+
"queued",
|
|
177
|
+
"scanning",
|
|
178
|
+
"fundamentals_ready",
|
|
179
|
+
"sessions_queued",
|
|
180
|
+
"sessions_running",
|
|
181
|
+
"complete",
|
|
182
|
+
"failed"
|
|
183
|
+
]);
|
|
184
|
+
var progressSchema = z3.object({
|
|
185
|
+
revision: z3.string().optional(),
|
|
186
|
+
status: checkProgressStatusSchema,
|
|
187
|
+
/** Checks ahead of this one in the sessions queue; null when unknown. */
|
|
188
|
+
queuePosition: z3.number().int().nonnegative().nullable(),
|
|
189
|
+
/** When the daily USD budget that is holding this check's sessions back
|
|
190
|
+
* resets (the next 00:00 UTC). Null unless the check is waiting on it.
|
|
191
|
+
* Optional: the contract landed before the budget was specified, so a
|
|
192
|
+
* reader that predates it still parses. */
|
|
193
|
+
resumesAt: z3.string().datetime().nullable().optional(),
|
|
194
|
+
sessions: z3.array(
|
|
195
|
+
z3.object({ id: z3.string().min(1), status: sessionProgressStatusSchema })
|
|
196
|
+
)
|
|
133
197
|
});
|
|
134
198
|
var accessSchema = z3.object({
|
|
135
199
|
status: checkStatusSchema,
|
|
@@ -140,7 +204,36 @@ var gradeSchema = z3.object({
|
|
|
140
204
|
letter: z3.string().min(1),
|
|
141
205
|
score: z3.number().int(),
|
|
142
206
|
maxScore: z3.number().int().positive(),
|
|
143
|
-
status: z3.string()
|
|
207
|
+
status: z3.string(),
|
|
208
|
+
/** True until the calibration corpus backing the grade is annotated.
|
|
209
|
+
* `publishableScore` stays null while this is true. */
|
|
210
|
+
provisional: z3.boolean().default(true)
|
|
211
|
+
});
|
|
212
|
+
var verdictSchema = z3.object({
|
|
213
|
+
headline: z3.string().min(1),
|
|
214
|
+
detail: z3.string().min(1)
|
|
215
|
+
});
|
|
216
|
+
var recentCheckSchema = z3.object({
|
|
217
|
+
domain: z3.string().min(1),
|
|
218
|
+
/** ISO date (YYYY-MM-DD) the report was completed. */
|
|
219
|
+
date: z3.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
220
|
+
grade: gradeSchema,
|
|
221
|
+
verdict: z3.object({ headline: z3.string().min(1) }),
|
|
222
|
+
logoUrl: z3.string().url().nullable().default(null),
|
|
223
|
+
/** See `reportSchema.logoTone`. */
|
|
224
|
+
logoTone: z3.enum(["light", "dark"]).nullable().default(null),
|
|
225
|
+
/** The product's name as the fast pass read it (see `reportSchema`). */
|
|
226
|
+
productName: z3.string().nullable().default(null),
|
|
227
|
+
completedAt: z3.string().datetime()
|
|
228
|
+
});
|
|
229
|
+
var recentChecksSchema = z3.array(recentCheckSchema);
|
|
230
|
+
var applicabilitySchema = z3.enum([
|
|
231
|
+
"developer-product",
|
|
232
|
+
"not-applicable"
|
|
233
|
+
]);
|
|
234
|
+
var homepageNegotiationSchema = z3.object({
|
|
235
|
+
markdown: z3.boolean(),
|
|
236
|
+
contentType: z3.string()
|
|
144
237
|
});
|
|
145
238
|
var reportSchema = z3.object({
|
|
146
239
|
domain: z3.string().min(1),
|
|
@@ -151,11 +244,32 @@ var reportSchema = z3.object({
|
|
|
151
244
|
sessionSummary: z3.string(),
|
|
152
245
|
access: accessSchema,
|
|
153
246
|
grade: gradeSchema,
|
|
247
|
+
verdict: verdictSchema,
|
|
154
248
|
checks: z3.array(fundamentalSchema).min(1),
|
|
155
249
|
surfaces: z3.array(surfaceSchema),
|
|
156
250
|
sessions: z3.array(sessionSchema),
|
|
157
251
|
/** Surface kinds that were not assessed at all (not absent, not failing). */
|
|
158
|
-
unassessed: z3.array(z3.string())
|
|
252
|
+
unassessed: z3.array(z3.string()),
|
|
253
|
+
/** Live status while the check is still in flight. Absent once the caller
|
|
254
|
+
* has no better source than the final report (e.g. recorded fixtures). */
|
|
255
|
+
progress: progressSchema.optional(),
|
|
256
|
+
/** `apple-touch-icon` / `icon`, else null. Never guessed. */
|
|
257
|
+
logoUrl: z3.string().url().nullable().default(null),
|
|
258
|
+
/** Whether `logoUrl`'s mark is light or dark, measured from its pixels by
|
|
259
|
+
* the fast pass, so the card can pick a ground it shows up against. Null
|
|
260
|
+
* when no icon was measured (none declared, an `.ico`, a fetch failure) —
|
|
261
|
+
* "unknown", never a guess. */
|
|
262
|
+
logoTone: z3.enum(["light", "dark"]).nullable().default(null),
|
|
263
|
+
/** `og:site_name`, else the `<title>` before its first separator, else
|
|
264
|
+
* null — the fast pass's reading, never guessed (the domain is the
|
|
265
|
+
* reader's fallback, so "no name" and "the name is the domain" stay
|
|
266
|
+
* distinguishable). The header shows it above the domain. */
|
|
267
|
+
productName: z3.string().nullable().default(null),
|
|
268
|
+
/** See `applicabilitySchema` above. */
|
|
269
|
+
applicability: applicabilitySchema.default("developer-product"),
|
|
270
|
+
/** Null when unmeasured (a report stored before this field existed, or the
|
|
271
|
+
* fetch failed for our own reasons) — never a guess. */
|
|
272
|
+
homepageNegotiation: homepageNegotiationSchema.nullable().default(null)
|
|
159
273
|
});
|
|
160
274
|
var sessionEventSchema = z3.looseObject({
|
|
161
275
|
type: z3.string(),
|
|
@@ -167,6 +281,15 @@ var transcriptSchema = z3.object({
|
|
|
167
281
|
model: z3.string().min(1),
|
|
168
282
|
events: z3.array(sessionEventSchema)
|
|
169
283
|
});
|
|
284
|
+
var liveTranscriptSchema = z3.object({
|
|
285
|
+
id: z3.string().min(1),
|
|
286
|
+
status: sessionProgressStatusSchema,
|
|
287
|
+
/** True once nothing further will ever arrive for this session (it has
|
|
288
|
+
* settled, one way or another) — the signal to stop polling. */
|
|
289
|
+
complete: z3.boolean(),
|
|
290
|
+
events: z3.array(sessionEventSchema),
|
|
291
|
+
nextAfter: z3.number().int().nonnegative()
|
|
292
|
+
});
|
|
170
293
|
|
|
171
294
|
// ../packages/api-schemas/src/batteries.ts
|
|
172
295
|
var batteries_exports = {};
|
|
@@ -851,6 +974,19 @@ var connectionSetSchema = z10.array(connectionSetEntrySchema).max(
|
|
|
851
974
|
MAX_CONNECTION_SET_ENTRIES,
|
|
852
975
|
`a run may attach at most ${MAX_CONNECTION_SET_ENTRIES} connections`
|
|
853
976
|
);
|
|
977
|
+
var connectionSummarySchema = z10.object({
|
|
978
|
+
id: z10.string(),
|
|
979
|
+
handle: z10.string(),
|
|
980
|
+
providerName: z10.string(),
|
|
981
|
+
credentialKey: z10.string(),
|
|
982
|
+
allowedHosts: z10.array(z10.string()),
|
|
983
|
+
profileSlug: z10.string(),
|
|
984
|
+
profileLabel: z10.string(),
|
|
985
|
+
kind: z10.enum(["static", "oauth"]),
|
|
986
|
+
last4: z10.string().nullable(),
|
|
987
|
+
createdAt: z10.string()
|
|
988
|
+
}).strict();
|
|
989
|
+
var listConnectionsResponseSchema = z10.object({ items: z10.array(connectionSummarySchema) }).strict();
|
|
854
990
|
|
|
855
991
|
// ../packages/api-schemas/src/dashboards.ts
|
|
856
992
|
import { z as z13 } from "zod";
|
|
@@ -955,6 +1091,8 @@ var whereClauseSchema = z12.object({
|
|
|
955
1091
|
});
|
|
956
1092
|
var queryFiltersSchema = z12.object({
|
|
957
1093
|
prompt: z12.string(),
|
|
1094
|
+
visibilityPrompt: z12.array(z12.string()),
|
|
1095
|
+
preferenceOnly: z12.boolean(),
|
|
958
1096
|
topic: z12.array(z12.string()),
|
|
959
1097
|
tag: z12.array(z12.string()),
|
|
960
1098
|
repo: z12.array(z12.string()),
|
|
@@ -1042,11 +1180,24 @@ var widgetEncodingSchema = z13.object({
|
|
|
1042
1180
|
y: z13.array(z13.string())
|
|
1043
1181
|
// metric keys for the value axis
|
|
1044
1182
|
}).partial();
|
|
1183
|
+
var preferenceSpecSchema = z13.object({
|
|
1184
|
+
dataset: z13.literal("preference"),
|
|
1185
|
+
report: z13.enum([
|
|
1186
|
+
"ranking",
|
|
1187
|
+
"head_to_head",
|
|
1188
|
+
"recommended_over_time",
|
|
1189
|
+
"mentioned_over_time"
|
|
1190
|
+
])
|
|
1191
|
+
});
|
|
1192
|
+
var widgetSpecSchema = z13.union([
|
|
1193
|
+
querySpecSchema,
|
|
1194
|
+
preferenceSpecSchema
|
|
1195
|
+
]);
|
|
1045
1196
|
var widgetFields = {
|
|
1046
1197
|
id: z13.string().min(1),
|
|
1047
1198
|
title: z13.string(),
|
|
1048
1199
|
viz: vizTypeSchema,
|
|
1049
|
-
spec:
|
|
1200
|
+
spec: widgetSpecSchema,
|
|
1050
1201
|
// 12-col grid placement.
|
|
1051
1202
|
x: z13.number().int().min(0).max(11),
|
|
1052
1203
|
y: z13.number().int().min(0),
|
|
@@ -2115,6 +2266,15 @@ var reingestSkillResponseSchema = z24.object({
|
|
|
2115
2266
|
/** True = "already current": the source content matches the newest version. */
|
|
2116
2267
|
unchanged: z24.boolean()
|
|
2117
2268
|
});
|
|
2269
|
+
var addSkillVersionBodySchema = z24.object({
|
|
2270
|
+
reference: z24.string().min(1),
|
|
2271
|
+
/** Omitted defaults to the ref name (branch/tag), else the anchor. */
|
|
2272
|
+
label: z24.string().min(1).max(120).optional()
|
|
2273
|
+
});
|
|
2274
|
+
var addSkillVersionResponseSchema = z24.object({
|
|
2275
|
+
label: z24.string(),
|
|
2276
|
+
unchanged: z24.boolean()
|
|
2277
|
+
});
|
|
2118
2278
|
var skillRunWireSchema = z24.object({
|
|
2119
2279
|
runId: z24.string(),
|
|
2120
2280
|
agent: z24.string(),
|
|
@@ -2317,375 +2477,857 @@ var meResponseSchema = z26.object({
|
|
|
2317
2477
|
orgs: z26.array(meOrgSchema)
|
|
2318
2478
|
});
|
|
2319
2479
|
|
|
2320
|
-
// ../packages/api-schemas/src/
|
|
2480
|
+
// ../packages/api-schemas/src/optimizations.ts
|
|
2481
|
+
import { z as z29 } from "zod";
|
|
2482
|
+
|
|
2483
|
+
// ../packages/api-schemas/src/climb.ts
|
|
2484
|
+
import { z as z28 } from "zod";
|
|
2485
|
+
|
|
2486
|
+
// ../packages/api-schemas/src/climb-kinds.ts
|
|
2487
|
+
var LEVER_KINDS = [
|
|
2488
|
+
"DOCS",
|
|
2489
|
+
"MARKETING_SITE",
|
|
2490
|
+
"SDK",
|
|
2491
|
+
"CLI",
|
|
2492
|
+
"SKILL"
|
|
2493
|
+
];
|
|
2494
|
+
var INTERVENTION_KINDS = [
|
|
2495
|
+
"BASELINE",
|
|
2496
|
+
"ADD_SKILL",
|
|
2497
|
+
"REMOVE_SKILL",
|
|
2498
|
+
"EDIT_SKILL",
|
|
2499
|
+
"REWRITE_DOCS",
|
|
2500
|
+
"PACKAGE_VERSION",
|
|
2501
|
+
"PACKAGE_CONTENT",
|
|
2502
|
+
"CLI_VERSION"
|
|
2503
|
+
];
|
|
2504
|
+
var LEVER_INTERVENTIONS = {
|
|
2505
|
+
DOCS: ["REWRITE_DOCS"],
|
|
2506
|
+
MARKETING_SITE: ["REWRITE_DOCS"],
|
|
2507
|
+
SDK: ["PACKAGE_VERSION", "PACKAGE_CONTENT"],
|
|
2508
|
+
CLI: ["CLI_VERSION"],
|
|
2509
|
+
SKILL: ["ADD_SKILL", "REMOVE_SKILL", "EDIT_SKILL"]
|
|
2510
|
+
};
|
|
2511
|
+
|
|
2512
|
+
// ../packages/api-schemas/src/sandbox-overrides.ts
|
|
2321
2513
|
import { z as z27 } from "zod";
|
|
2322
|
-
var
|
|
2514
|
+
var SANDBOX_OVERRIDE_KINDS = ["packages", "clis"];
|
|
2515
|
+
var ecosystemSchema = z27.enum(["npm", "pypi", "cargo", "go", "gem"]);
|
|
2516
|
+
var overrideFilesSchema = z27.array(
|
|
2517
|
+
z27.object({
|
|
2518
|
+
path: z27.string().min(1).refine(
|
|
2519
|
+
(path) => !path.startsWith("/") && !path.includes("\\") && !path.split("/").includes(".."),
|
|
2520
|
+
"Use a relative path within the target"
|
|
2521
|
+
),
|
|
2522
|
+
body: z27.string()
|
|
2523
|
+
}).strict()
|
|
2524
|
+
).min(1);
|
|
2525
|
+
var contentShape = {
|
|
2526
|
+
version: z27.string().trim().min(1).optional(),
|
|
2527
|
+
files: overrideFilesSchema.optional()
|
|
2528
|
+
};
|
|
2529
|
+
var hasContent = (value) => value.version !== void 0 || value.files !== void 0;
|
|
2530
|
+
var sandboxOverridesSchema = z27.object({
|
|
2531
|
+
version: z27.literal(1),
|
|
2532
|
+
packages: z27.array(
|
|
2533
|
+
z27.object({
|
|
2534
|
+
ecosystem: ecosystemSchema,
|
|
2535
|
+
name: z27.string().trim().min(1),
|
|
2536
|
+
...contentShape
|
|
2537
|
+
}).strict().refine(hasContent, "Specify a version or files")
|
|
2538
|
+
).optional(),
|
|
2539
|
+
clis: z27.array(
|
|
2540
|
+
z27.object({
|
|
2541
|
+
name: z27.string().trim().min(1),
|
|
2542
|
+
...contentShape
|
|
2543
|
+
}).strict().refine(hasContent, "Specify a version or files")
|
|
2544
|
+
).optional()
|
|
2545
|
+
}).strict().superRefine((value, ctx) => {
|
|
2546
|
+
const identities = {
|
|
2547
|
+
packages: (value.packages ?? []).map(
|
|
2548
|
+
(entry) => JSON.stringify([entry.ecosystem, entry.name])
|
|
2549
|
+
),
|
|
2550
|
+
clis: (value.clis ?? []).map((entry) => entry.name)
|
|
2551
|
+
};
|
|
2552
|
+
for (const kind of SANDBOX_OVERRIDE_KINDS) {
|
|
2553
|
+
if (new Set(identities[kind]).size !== identities[kind].length)
|
|
2554
|
+
ctx.addIssue({
|
|
2555
|
+
code: "custom",
|
|
2556
|
+
path: [kind],
|
|
2557
|
+
message: "Duplicate override identity"
|
|
2558
|
+
});
|
|
2559
|
+
}
|
|
2560
|
+
if (new TextEncoder().encode(JSON.stringify(value)).byteLength >= 1e6)
|
|
2561
|
+
ctx.addIssue({
|
|
2562
|
+
code: "custom",
|
|
2563
|
+
message: "Sandbox overrides must be under 1 MB"
|
|
2564
|
+
});
|
|
2565
|
+
});
|
|
2566
|
+
|
|
2567
|
+
// ../packages/api-schemas/src/climb.ts
|
|
2568
|
+
var climbSubjectKindSchema = z28.enum(["EVAL_SET", "VISIBILITY_PROMPT"]);
|
|
2569
|
+
var leverKindSchema = z28.enum(LEVER_KINDS);
|
|
2570
|
+
var interventionKindSchema = z28.enum(INTERVENTION_KINDS);
|
|
2571
|
+
var skill = z28.object({ skillVersionId: z28.string().min(1) }).strict();
|
|
2572
|
+
var empty = z28.object({}).strict();
|
|
2573
|
+
function validateFixtureIntervention(value, ctx) {
|
|
2574
|
+
const result = webFixtureSchema.safeParse({ version: 1, ...value });
|
|
2575
|
+
if (!result.success) {
|
|
2576
|
+
for (const issue of result.error.issues) {
|
|
2577
|
+
ctx.addIssue({
|
|
2578
|
+
code: "custom",
|
|
2579
|
+
path: issue.path,
|
|
2580
|
+
message: issue.message
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
var interventionSchema = z28.discriminatedUnion("kind", [
|
|
2586
|
+
z28.object({ kind: z28.literal("BASELINE"), after: empty }),
|
|
2587
|
+
z28.object({ kind: z28.literal("ADD_SKILL"), after: skill }),
|
|
2588
|
+
z28.object({ kind: z28.literal("REMOVE_SKILL"), before: skill, after: empty }),
|
|
2589
|
+
z28.object({ kind: z28.literal("EDIT_SKILL"), before: skill, after: skill }),
|
|
2590
|
+
z28.object({
|
|
2591
|
+
kind: z28.literal("REWRITE_DOCS"),
|
|
2592
|
+
before: z28.json().optional(),
|
|
2593
|
+
after: z28.object({ pages: webFixtureSchema.shape.pages.unwrap().min(1) }).strict().superRefine(validateFixtureIntervention)
|
|
2594
|
+
}),
|
|
2595
|
+
z28.object({
|
|
2596
|
+
kind: z28.literal("PACKAGE_VERSION"),
|
|
2597
|
+
after: z28.object({
|
|
2598
|
+
ecosystem: ecosystemSchema,
|
|
2599
|
+
name: z28.string().min(1),
|
|
2600
|
+
version: z28.string().min(1)
|
|
2601
|
+
}).strict()
|
|
2602
|
+
}),
|
|
2603
|
+
z28.object({
|
|
2604
|
+
kind: z28.literal("PACKAGE_CONTENT"),
|
|
2605
|
+
after: z28.object({
|
|
2606
|
+
ecosystem: ecosystemSchema,
|
|
2607
|
+
name: z28.string().min(1),
|
|
2608
|
+
files: overrideFilesSchema
|
|
2609
|
+
}).strict()
|
|
2610
|
+
}),
|
|
2611
|
+
z28.object({
|
|
2612
|
+
kind: z28.literal("CLI_VERSION"),
|
|
2613
|
+
after: z28.object({ name: z28.string().min(1), version: z28.string().min(1) }).strict()
|
|
2614
|
+
})
|
|
2615
|
+
]);
|
|
2616
|
+
var climbSettingsSchema = z28.object({
|
|
2617
|
+
maxRounds: z28.number().int().positive().default(5),
|
|
2618
|
+
sampleCount: z28.number().int().positive().default(1),
|
|
2619
|
+
creditCap: z28.number().int().nonnegative(),
|
|
2620
|
+
exploreModel: z28.string().min(1).optional(),
|
|
2621
|
+
autoAdopt: z28.boolean().default(false),
|
|
2622
|
+
targetScore: z28.number().min(0).max(1).default(1),
|
|
2623
|
+
// Narrow the subject's whole roster to one slot, for the baseline and every
|
|
2624
|
+
// trial alike. A subject rostering ten models otherwise multiplies every
|
|
2625
|
+
// trial by ten, and a one-model trial measured against a ten-model baseline
|
|
2626
|
+
// is not a comparison. `pinnedModel` empty means the agent's default model.
|
|
2627
|
+
pinnedAgent: schedulableAgentSchema.optional(),
|
|
2628
|
+
pinnedModel: z28.string().optional()
|
|
2629
|
+
}).strict().refine((value) => value.pinnedAgent !== void 0 || !value.pinnedModel, {
|
|
2630
|
+
path: ["pinnedAgent"],
|
|
2631
|
+
message: "Pin an agent with the model"
|
|
2632
|
+
});
|
|
2633
|
+
var climbConfigSnapshotSchema = z28.object({
|
|
2634
|
+
promptText: z28.string(),
|
|
2635
|
+
scenario: z28.enum(["GREENFIELD", "MIGRATION"]),
|
|
2636
|
+
repoUrl: z28.string().nullable(),
|
|
2637
|
+
repoRef: z28.string().nullable(),
|
|
2638
|
+
profileId: z28.string().nullable(),
|
|
2639
|
+
profileName: z28.string().nullable(),
|
|
2640
|
+
profileDescription: z28.string().nullable(),
|
|
2641
|
+
profileModel: z28.string().nullable(),
|
|
2642
|
+
limits: z28.json(),
|
|
2643
|
+
agents: z28.array(agentConfigSchema).min(1),
|
|
2644
|
+
skillRefs: z28.array(z28.string()),
|
|
2645
|
+
mcpRefs: z28.array(z28.string()),
|
|
2646
|
+
skillVersionIds: z28.array(z28.string()),
|
|
2647
|
+
mcpServerVersionIds: z28.array(z28.string()),
|
|
2648
|
+
skillSet: z28.json().nullable(),
|
|
2649
|
+
mcpSet: z28.json().nullable(),
|
|
2650
|
+
connectionIds: z28.array(z28.string()),
|
|
2651
|
+
connectionSet: z28.json().nullable(),
|
|
2652
|
+
agentContext: z28.json().nullable(),
|
|
2653
|
+
agentContextDigest: z28.string().nullable(),
|
|
2654
|
+
webFixture: webFixtureSchema.nullable(),
|
|
2655
|
+
sandboxOverrides: sandboxOverridesSchema.nullable(),
|
|
2656
|
+
visibilityScenarioId: z28.string().nullable()
|
|
2657
|
+
}).strict();
|
|
2658
|
+
var targetRefSchema = z28.object({
|
|
2659
|
+
kind: z28.string().min(1),
|
|
2660
|
+
id: z28.string().optional(),
|
|
2661
|
+
url: z28.url().optional(),
|
|
2662
|
+
package: z28.string().optional()
|
|
2663
|
+
}).strict();
|
|
2664
|
+
var trialInputSchema = z28.object({
|
|
2665
|
+
title: z28.string().trim().min(1).max(200),
|
|
2666
|
+
hypothesis: z28.string().max(4e3).optional(),
|
|
2667
|
+
lever: leverKindSchema,
|
|
2668
|
+
targetRef: targetRefSchema.optional(),
|
|
2669
|
+
intervention: interventionSchema,
|
|
2670
|
+
authorMode: z28.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL")
|
|
2671
|
+
}).strict().superRefine((value, ctx) => {
|
|
2672
|
+
const allowed = LEVER_INTERVENTIONS[value.lever];
|
|
2673
|
+
if (!allowed.includes(value.intervention.kind))
|
|
2674
|
+
ctx.addIssue({
|
|
2675
|
+
code: "custom",
|
|
2676
|
+
path: ["intervention", "kind"],
|
|
2677
|
+
message: "This intervention does not change the selected lever"
|
|
2678
|
+
});
|
|
2679
|
+
});
|
|
2680
|
+
|
|
2681
|
+
// ../packages/api-schemas/src/optimizations.ts
|
|
2682
|
+
var OPTIMIZATION_STATUSES = [
|
|
2683
|
+
"ACTIVE",
|
|
2684
|
+
"PAUSED",
|
|
2685
|
+
"DONE",
|
|
2686
|
+
"ARCHIVED"
|
|
2687
|
+
];
|
|
2688
|
+
var optimizationStatusSchema = z29.enum(OPTIMIZATION_STATUSES);
|
|
2689
|
+
var ROUND_STATUSES = [
|
|
2690
|
+
"PROPOSING",
|
|
2691
|
+
"RUNNING",
|
|
2692
|
+
"JUDGING",
|
|
2693
|
+
"SETTLED",
|
|
2694
|
+
"FAILED",
|
|
2695
|
+
"CANCELED"
|
|
2696
|
+
];
|
|
2697
|
+
var TRIAL_STATUSES = [
|
|
2698
|
+
"DRAFT",
|
|
2699
|
+
"RUNNING",
|
|
2700
|
+
"SETTLED",
|
|
2701
|
+
"FAILED",
|
|
2702
|
+
"CANCELED"
|
|
2703
|
+
];
|
|
2704
|
+
var TRIAL_VERDICTS = [
|
|
2705
|
+
"BETTER",
|
|
2706
|
+
"WORSE",
|
|
2707
|
+
"INCONCLUSIVE",
|
|
2708
|
+
"NOT_EVALUABLE"
|
|
2709
|
+
];
|
|
2710
|
+
var OPTIMIZATION_EFFORTS = [
|
|
2711
|
+
{ value: "LOW", label: "Quick", sampleCount: 1, maxRounds: 3 },
|
|
2712
|
+
{ value: "MEDIUM", label: "Standard", sampleCount: 1, maxRounds: 5 },
|
|
2713
|
+
{ value: "HIGH", label: "Thorough", sampleCount: 2, maxRounds: 8 },
|
|
2714
|
+
{ value: "XHIGH", label: "Exhaustive", sampleCount: 3, maxRounds: 12 }
|
|
2715
|
+
];
|
|
2716
|
+
var optimizationEffortSchema = z29.enum(
|
|
2717
|
+
OPTIMIZATION_EFFORTS.map((preset) => preset.value)
|
|
2718
|
+
);
|
|
2719
|
+
var listOptimizationsQuerySchema = z29.object({
|
|
2720
|
+
status: z29.string().optional().transform(
|
|
2721
|
+
(value) => value ? value.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean) : void 0
|
|
2722
|
+
).pipe(z29.array(optimizationStatusSchema).optional()),
|
|
2723
|
+
subjectKind: climbSubjectKindSchema.optional(),
|
|
2724
|
+
subjectId: z29.string().min(1).optional(),
|
|
2725
|
+
limit: z29.coerce.number().int().min(1).max(200).default(50)
|
|
2726
|
+
});
|
|
2727
|
+
var optimizationSummarySchema = z29.object({
|
|
2728
|
+
id: z29.string(),
|
|
2729
|
+
name: z29.string(),
|
|
2730
|
+
status: optimizationStatusSchema,
|
|
2731
|
+
mode: z29.enum(["MANUAL", "AUTO"]),
|
|
2732
|
+
stopReason: z29.string().nullable(),
|
|
2733
|
+
subjectKind: climbSubjectKindSchema,
|
|
2734
|
+
subjectId: z29.string(),
|
|
2735
|
+
subjectName: z29.string(),
|
|
2736
|
+
lever: leverKindSchema.nullable(),
|
|
2737
|
+
round: z29.number().int(),
|
|
2738
|
+
maxRounds: z29.number().int(),
|
|
2739
|
+
/** Starting baseline score, 0..1. */
|
|
2740
|
+
before: z29.number().nullable(),
|
|
2741
|
+
/** Score of the adopted tip, 0..1. */
|
|
2742
|
+
after: z29.number().nullable(),
|
|
2743
|
+
/** Percentage-point change from the starting baseline to the adopted tip. */
|
|
2744
|
+
delta: z29.number().nullable(),
|
|
2745
|
+
/** Score after each round, baseline first. */
|
|
2746
|
+
path: z29.array(z29.number()),
|
|
2747
|
+
creditsSpent: z29.number().int(),
|
|
2748
|
+
creditsReserved: z29.number().int(),
|
|
2749
|
+
summary: z29.string().nullable(),
|
|
2750
|
+
href: z29.string(),
|
|
2751
|
+
createdAt: z29.string(),
|
|
2752
|
+
updatedAt: z29.string()
|
|
2753
|
+
});
|
|
2754
|
+
var listOptimizationsResponseSchema = z29.object({
|
|
2755
|
+
items: z29.array(optimizationSummarySchema)
|
|
2756
|
+
});
|
|
2757
|
+
var targetSchema = z29.object({
|
|
2758
|
+
agent: schedulableAgentSchema.optional(),
|
|
2759
|
+
/** Empty or omitted means the agent's default model. */
|
|
2760
|
+
model: z29.string().optional()
|
|
2761
|
+
});
|
|
2762
|
+
var planShape = {
|
|
2763
|
+
effort: optimizationEffortSchema.optional(),
|
|
2764
|
+
sampleCount: z29.number().int().min(1).max(100).optional(),
|
|
2765
|
+
maxRounds: z29.number().int().min(1).max(100).optional()
|
|
2766
|
+
};
|
|
2767
|
+
function refinePlan(value, ctx) {
|
|
2768
|
+
if (value.effort && (value.sampleCount || value.maxRounds))
|
|
2769
|
+
ctx.addIssue({
|
|
2770
|
+
code: "custom",
|
|
2771
|
+
path: ["effort"],
|
|
2772
|
+
message: "Pass effort or sampleCount/maxRounds, not both"
|
|
2773
|
+
});
|
|
2774
|
+
if (value.target?.model && !value.target.agent)
|
|
2775
|
+
ctx.addIssue({
|
|
2776
|
+
code: "custom",
|
|
2777
|
+
path: ["target", "agent"],
|
|
2778
|
+
message: "Pin an agent with the model"
|
|
2779
|
+
});
|
|
2780
|
+
}
|
|
2781
|
+
var startOptimizationBodySchema = z29.object({
|
|
2782
|
+
subjectKind: climbSubjectKindSchema,
|
|
2783
|
+
subjectId: z29.string().min(1),
|
|
2784
|
+
name: z29.string().trim().min(1).max(200).optional(),
|
|
2785
|
+
...planShape,
|
|
2786
|
+
creditCap: z29.number().int().nonnegative().optional(),
|
|
2787
|
+
autoAdopt: z29.boolean().default(true),
|
|
2788
|
+
targetScore: z29.number().min(0).max(1).optional(),
|
|
2789
|
+
target: targetSchema.extend({ agent: schedulableAgentSchema })
|
|
2790
|
+
}).strict().superRefine(refinePlan);
|
|
2791
|
+
var estimateOptimizationBodySchema = z29.object({
|
|
2792
|
+
subjectKind: climbSubjectKindSchema,
|
|
2793
|
+
subjectId: z29.string().min(1),
|
|
2794
|
+
...planShape,
|
|
2795
|
+
target: targetSchema.optional()
|
|
2796
|
+
}).strict().superRefine(refinePlan);
|
|
2797
|
+
var RUN_CREDIT_BASES = [
|
|
2798
|
+
"subject-history",
|
|
2799
|
+
"model-history",
|
|
2800
|
+
"catalog-rates",
|
|
2801
|
+
"platform-history",
|
|
2802
|
+
"byok",
|
|
2803
|
+
"reserve"
|
|
2804
|
+
];
|
|
2805
|
+
var runCreditBasisSchema = z29.enum(RUN_CREDIT_BASES);
|
|
2806
|
+
var optimizationEstimateSchema = z29.object({
|
|
2807
|
+
sampleCount: z29.number().int(),
|
|
2808
|
+
maxRounds: z29.number().int(),
|
|
2809
|
+
runsPerTrial: z29.number(),
|
|
2810
|
+
executionCredits: z29.number(),
|
|
2811
|
+
judgeCredits: z29.number(),
|
|
2812
|
+
leverPassCredits: z29.number(),
|
|
2813
|
+
trialCredits: z29.number(),
|
|
2814
|
+
/** Whole credits for the full climb; this is what start reserves. */
|
|
2815
|
+
estimate: z29.number().int(),
|
|
2816
|
+
/** True when no price or history covered a model: a bound, not a forecast. */
|
|
2817
|
+
approximate: z29.boolean().default(false),
|
|
2818
|
+
/** Which rung priced the run, so the UI can say why a figure is what it is. */
|
|
2819
|
+
basis: runCreditBasisSchema.optional()
|
|
2820
|
+
});
|
|
2821
|
+
var diagnoseBodySchema = z29.object({
|
|
2822
|
+
subjectKind: climbSubjectKindSchema,
|
|
2823
|
+
subjectId: z29.string().min(1)
|
|
2824
|
+
}).strict();
|
|
2825
|
+
var diagnosisSchema = z29.object({
|
|
2826
|
+
id: z29.string(),
|
|
2827
|
+
status: z29.enum(["GENERATING", "READY", "FAILED"]),
|
|
2828
|
+
subjectKind: climbSubjectKindSchema,
|
|
2829
|
+
subjectId: z29.string(),
|
|
2830
|
+
runCount: z29.number().int(),
|
|
2831
|
+
summary: z29.string().nullable(),
|
|
2832
|
+
recommendedLever: leverKindSchema.nullable(),
|
|
2833
|
+
recommendedTarget: z29.unknown().nullable(),
|
|
2834
|
+
clusters: z29.array(
|
|
2835
|
+
z29.object({
|
|
2836
|
+
title: z29.string(),
|
|
2837
|
+
failureMode: z29.string(),
|
|
2838
|
+
criterionIds: z29.array(z29.string()),
|
|
2839
|
+
runIds: z29.array(z29.string()),
|
|
2840
|
+
lever: leverKindSchema.nullable(),
|
|
2841
|
+
targetRef: z29.unknown().nullable(),
|
|
2842
|
+
confidence: z29.number()
|
|
2843
|
+
})
|
|
2844
|
+
),
|
|
2845
|
+
createdAt: z29.string()
|
|
2846
|
+
});
|
|
2847
|
+
var trialRunSchema = z29.object({
|
|
2848
|
+
id: z29.string(),
|
|
2849
|
+
status: z29.string(),
|
|
2850
|
+
passed: z29.boolean().nullable(),
|
|
2851
|
+
criteria: z29.array(
|
|
2852
|
+
z29.object({ name: z29.string(), passed: z29.boolean(), reasoning: z29.string() })
|
|
2853
|
+
),
|
|
2854
|
+
levers: z29.array(
|
|
2855
|
+
z29.object({
|
|
2856
|
+
lever: z29.string(),
|
|
2857
|
+
attributed: z29.boolean(),
|
|
2858
|
+
note: z29.string().nullable()
|
|
2859
|
+
})
|
|
2860
|
+
)
|
|
2861
|
+
});
|
|
2862
|
+
var trialSchema = z29.object({
|
|
2863
|
+
id: z29.string(),
|
|
2864
|
+
climbId: z29.string(),
|
|
2865
|
+
roundNumber: z29.number().int(),
|
|
2866
|
+
key: z29.string(),
|
|
2867
|
+
parentTrialId: z29.string().nullable(),
|
|
2868
|
+
parentKey: z29.string().nullable(),
|
|
2869
|
+
title: z29.string(),
|
|
2870
|
+
hypothesis: z29.string().nullable(),
|
|
2871
|
+
lever: leverKindSchema.nullable(),
|
|
2872
|
+
kind: interventionKindSchema,
|
|
2873
|
+
status: z29.enum(TRIAL_STATUSES),
|
|
2874
|
+
verdict: z29.enum(TRIAL_VERDICTS).nullable(),
|
|
2875
|
+
score: z29.number().nullable(),
|
|
2876
|
+
baselineScore: z29.number().nullable(),
|
|
2877
|
+
/** Judged sessions behind `score`. */
|
|
2878
|
+
sessions: z29.number().int(),
|
|
2879
|
+
explore: z29.boolean(),
|
|
2880
|
+
isBaseline: z29.boolean(),
|
|
2881
|
+
adopted: z29.boolean(),
|
|
2882
|
+
adoptedAt: z29.string().nullable(),
|
|
2883
|
+
outcome: z29.string().nullable(),
|
|
2884
|
+
/** The kind-specific `after` payload (skill version id, pages, package). */
|
|
2885
|
+
after: z29.unknown(),
|
|
2886
|
+
before: z29.unknown(),
|
|
2887
|
+
runs: z29.array(trialRunSchema),
|
|
2888
|
+
createdAt: z29.string()
|
|
2889
|
+
});
|
|
2890
|
+
var roundSchema = z29.object({
|
|
2891
|
+
id: z29.string(),
|
|
2892
|
+
number: z29.number().int(),
|
|
2893
|
+
status: z29.enum(ROUND_STATUSES),
|
|
2894
|
+
narrative: z29.string().nullable(),
|
|
2895
|
+
trials: z29.array(trialSchema)
|
|
2896
|
+
});
|
|
2897
|
+
var optimizationDetailSchema = optimizationSummarySchema.extend({
|
|
2898
|
+
baselineTrialId: z29.string().nullable(),
|
|
2899
|
+
settings: z29.object({
|
|
2900
|
+
sampleCount: z29.number().int(),
|
|
2901
|
+
maxRounds: z29.number().int(),
|
|
2902
|
+
creditCap: z29.number().int(),
|
|
2903
|
+
autoAdopt: z29.boolean(),
|
|
2904
|
+
targetScore: z29.number(),
|
|
2905
|
+
exploreModel: z29.string().nullable(),
|
|
2906
|
+
pinnedAgent: z29.string().nullable(),
|
|
2907
|
+
pinnedModel: z29.string().nullable()
|
|
2908
|
+
}),
|
|
2909
|
+
diagnosis: diagnosisSchema.nullable(),
|
|
2910
|
+
rounds: z29.array(roundSchema)
|
|
2911
|
+
});
|
|
2912
|
+
var listTrialsResponseSchema = z29.object({
|
|
2913
|
+
items: z29.array(trialSchema)
|
|
2914
|
+
});
|
|
2915
|
+
var trialDocumentSchema = z29.object({
|
|
2916
|
+
path: z29.string(),
|
|
2917
|
+
before: z29.string(),
|
|
2918
|
+
after: z29.string()
|
|
2919
|
+
});
|
|
2920
|
+
var trialContentSchema = z29.object({
|
|
2921
|
+
trialId: z29.string(),
|
|
2922
|
+
kind: interventionKindSchema,
|
|
2923
|
+
documents: z29.array(trialDocumentSchema),
|
|
2924
|
+
/** Full page bodies for a docs rewrite, ready to paste; null otherwise. */
|
|
2925
|
+
copyableBody: z29.string().nullable(),
|
|
2926
|
+
configSnapshot: z29.unknown()
|
|
2927
|
+
});
|
|
2928
|
+
var createTrialBodySchema = z29.object({
|
|
2929
|
+
trial: trialInputSchema,
|
|
2930
|
+
files: overrideFilesSchema.optional(),
|
|
2931
|
+
fork: z29.object({ runId: z29.string().min(1), boundarySeq: z29.string().min(1) }).strict().optional(),
|
|
2932
|
+
launch: z29.boolean().default(true)
|
|
2933
|
+
}).strict();
|
|
2934
|
+
var proposeBodySchema = z29.object({
|
|
2935
|
+
request: z29.string().trim().max(4e3).optional(),
|
|
2936
|
+
lever: leverKindSchema.optional(),
|
|
2937
|
+
kind: interventionKindSchema.optional(),
|
|
2938
|
+
targetVersionId: z29.string().min(1).optional()
|
|
2939
|
+
}).strict();
|
|
2940
|
+
var proposalSchema = z29.object({
|
|
2941
|
+
trial: trialInputSchema,
|
|
2942
|
+
files: overrideFilesSchema.optional()
|
|
2943
|
+
});
|
|
2944
|
+
var proposeResponseSchema = z29.object({
|
|
2945
|
+
items: z29.array(proposalSchema)
|
|
2946
|
+
});
|
|
2947
|
+
var skillFilesResponseSchema = z29.object({
|
|
2948
|
+
versionId: z29.string(),
|
|
2949
|
+
files: overrideFilesSchema
|
|
2950
|
+
});
|
|
2951
|
+
var pageBodyResponseSchema = z29.object({
|
|
2952
|
+
url: z29.string(),
|
|
2953
|
+
body: z29.string(),
|
|
2954
|
+
contentType: z29.string().optional()
|
|
2955
|
+
});
|
|
2956
|
+
var launchTrialResponseSchema = z29.object({
|
|
2957
|
+
trialId: z29.string(),
|
|
2958
|
+
batchIds: z29.array(z29.string()),
|
|
2959
|
+
runIds: z29.array(z29.string())
|
|
2960
|
+
});
|
|
2961
|
+
|
|
2962
|
+
// ../packages/api-schemas/src/orgs.ts
|
|
2963
|
+
import { z as z30 } from "zod";
|
|
2964
|
+
var createOrgRequestSchema = z30.object({
|
|
2323
2965
|
/** Workspace display name; the slug is derived server-side. */
|
|
2324
|
-
name:
|
|
2966
|
+
name: z30.string().trim().min(1).max(200),
|
|
2325
2967
|
/** Optional company site (logo source; stamped onto the org). */
|
|
2326
|
-
website:
|
|
2968
|
+
website: z30.string().trim().max(300).optional()
|
|
2327
2969
|
});
|
|
2328
|
-
var createOrgResponseSchema =
|
|
2329
|
-
slug:
|
|
2330
|
-
name:
|
|
2970
|
+
var createOrgResponseSchema = z30.object({
|
|
2971
|
+
slug: z30.string(),
|
|
2972
|
+
name: z30.string(),
|
|
2331
2973
|
// LOCAL orgs never have a Gauge publicId.
|
|
2332
|
-
publicId:
|
|
2974
|
+
publicId: z30.string().nullable()
|
|
2333
2975
|
});
|
|
2334
|
-
var orgSettingsSchema =
|
|
2335
|
-
slug:
|
|
2336
|
-
name:
|
|
2337
|
-
publicId:
|
|
2338
|
-
website:
|
|
2976
|
+
var orgSettingsSchema = z30.object({
|
|
2977
|
+
slug: z30.string(),
|
|
2978
|
+
name: z30.string(),
|
|
2979
|
+
publicId: z30.string().nullable(),
|
|
2980
|
+
website: z30.string().nullable(),
|
|
2339
2981
|
/** Per-run max-spend override in USD; null = the server default. */
|
|
2340
|
-
maxSpendUsd:
|
|
2341
|
-
overageEnabled:
|
|
2982
|
+
maxSpendUsd: z30.number().nullable(),
|
|
2983
|
+
overageEnabled: z30.boolean(),
|
|
2342
2984
|
/** Per-cycle overage cap in credits; null = uncapped. */
|
|
2343
|
-
overageCapCredits:
|
|
2985
|
+
overageCapCredits: z30.number().int().nullable(),
|
|
2344
2986
|
/** Domain claimed for same-domain auto-join; null = off. */
|
|
2345
|
-
autoJoinDomain:
|
|
2987
|
+
autoJoinDomain: z30.string().nullable()
|
|
2346
2988
|
});
|
|
2347
|
-
var orgMemberSchema =
|
|
2348
|
-
userId:
|
|
2349
|
-
name:
|
|
2350
|
-
email:
|
|
2351
|
-
joinedAt:
|
|
2989
|
+
var orgMemberSchema = z30.object({
|
|
2990
|
+
userId: z30.string(),
|
|
2991
|
+
name: z30.string().nullable(),
|
|
2992
|
+
email: z30.string().nullable(),
|
|
2993
|
+
joinedAt: z30.string()
|
|
2352
2994
|
});
|
|
2353
|
-
var listMembersResponseSchema =
|
|
2354
|
-
items:
|
|
2995
|
+
var listMembersResponseSchema = z30.object({
|
|
2996
|
+
items: z30.array(orgMemberSchema)
|
|
2355
2997
|
});
|
|
2356
2998
|
|
|
2357
2999
|
// ../packages/api-schemas/src/personas.ts
|
|
2358
|
-
import { z as
|
|
2359
|
-
var personaSchema =
|
|
2360
|
-
id:
|
|
2361
|
-
name:
|
|
2362
|
-
description:
|
|
3000
|
+
import { z as z31 } from "zod";
|
|
3001
|
+
var personaSchema = z31.object({
|
|
3002
|
+
id: z31.string(),
|
|
3003
|
+
name: z31.string(),
|
|
3004
|
+
description: z31.string(),
|
|
2363
3005
|
/** The judge model this persona calls (Claude only). */
|
|
2364
|
-
model:
|
|
2365
|
-
createdAt:
|
|
2366
|
-
updatedAt:
|
|
3006
|
+
model: z31.string(),
|
|
3007
|
+
createdAt: z31.string(),
|
|
3008
|
+
updatedAt: z31.string()
|
|
2367
3009
|
});
|
|
2368
|
-
var listPersonasResponseSchema =
|
|
2369
|
-
items:
|
|
3010
|
+
var listPersonasResponseSchema = z31.object({
|
|
3011
|
+
items: z31.array(personaSchema)
|
|
2370
3012
|
});
|
|
2371
|
-
var createPersonaBodySchema =
|
|
2372
|
-
name:
|
|
2373
|
-
description:
|
|
3013
|
+
var createPersonaBodySchema = z31.object({
|
|
3014
|
+
name: z31.string().min(1).max(120),
|
|
3015
|
+
description: z31.string().min(1)
|
|
2374
3016
|
});
|
|
2375
|
-
var updatePersonaBodySchema =
|
|
2376
|
-
name:
|
|
2377
|
-
description:
|
|
3017
|
+
var updatePersonaBodySchema = z31.object({
|
|
3018
|
+
name: z31.string().min(1).max(120).optional(),
|
|
3019
|
+
description: z31.string().min(1).optional()
|
|
2378
3020
|
});
|
|
2379
3021
|
|
|
2380
3022
|
// ../packages/api-schemas/src/prompts.ts
|
|
2381
|
-
import { z as
|
|
3023
|
+
import { z as z34 } from "zod";
|
|
2382
3024
|
|
|
2383
3025
|
// ../packages/api-schemas/src/tags.ts
|
|
2384
|
-
import { z as
|
|
2385
|
-
var tagSchema =
|
|
2386
|
-
id:
|
|
2387
|
-
name:
|
|
3026
|
+
import { z as z32 } from "zod";
|
|
3027
|
+
var tagSchema = z32.object({
|
|
3028
|
+
id: z32.string(),
|
|
3029
|
+
name: z32.string(),
|
|
2388
3030
|
/** A Mantine palette name (e.g. "blue", "grape"); unknown values are
|
|
2389
3031
|
* normalized server-side to the default ("gray"). */
|
|
2390
|
-
color:
|
|
3032
|
+
color: z32.string()
|
|
2391
3033
|
});
|
|
2392
|
-
var createTagBodySchema =
|
|
2393
|
-
name:
|
|
2394
|
-
color:
|
|
3034
|
+
var createTagBodySchema = z32.object({
|
|
3035
|
+
name: z32.string().min(1),
|
|
3036
|
+
color: z32.string().optional()
|
|
2395
3037
|
});
|
|
2396
|
-
var updateTagBodySchema =
|
|
2397
|
-
name:
|
|
2398
|
-
color:
|
|
3038
|
+
var updateTagBodySchema = z32.object({
|
|
3039
|
+
name: z32.string().min(1).optional(),
|
|
3040
|
+
color: z32.string().optional()
|
|
2399
3041
|
});
|
|
2400
3042
|
var tagListResponseSchema = listResponseSchema(tagSchema);
|
|
2401
3043
|
|
|
2402
3044
|
// ../packages/api-schemas/src/topics.ts
|
|
2403
|
-
import { z as
|
|
2404
|
-
var topicSchema =
|
|
2405
|
-
id:
|
|
2406
|
-
name:
|
|
3045
|
+
import { z as z33 } from "zod";
|
|
3046
|
+
var topicSchema = z33.object({
|
|
3047
|
+
id: z33.string(),
|
|
3048
|
+
name: z33.string()
|
|
2407
3049
|
});
|
|
2408
|
-
var createTopicBodySchema =
|
|
2409
|
-
name:
|
|
3050
|
+
var createTopicBodySchema = z33.object({
|
|
3051
|
+
name: z33.string().min(1, "name is required")
|
|
2410
3052
|
});
|
|
2411
3053
|
var topicListResponseSchema = listResponseSchema(topicSchema);
|
|
2412
3054
|
|
|
2413
3055
|
// ../packages/api-schemas/src/prompts.ts
|
|
2414
|
-
var promptSummarySchema =
|
|
2415
|
-
id:
|
|
2416
|
-
text:
|
|
2417
|
-
isBranded:
|
|
3056
|
+
var promptSummarySchema = z34.object({
|
|
3057
|
+
id: z34.string(),
|
|
3058
|
+
text: z34.string(),
|
|
3059
|
+
isBranded: z34.boolean(),
|
|
2418
3060
|
/** Battery-spec identity (idempotent applies); null for UI/CLI-created prompts. */
|
|
2419
|
-
externalKey:
|
|
3061
|
+
externalKey: z34.string().nullable(),
|
|
2420
3062
|
topic: topicSchema.nullable(),
|
|
2421
|
-
tags:
|
|
2422
|
-
createdAt:
|
|
3063
|
+
tags: z34.array(tagSchema),
|
|
3064
|
+
createdAt: z34.string()
|
|
2423
3065
|
});
|
|
2424
3066
|
var promptListResponseSchema = listResponseSchema(promptSummarySchema);
|
|
2425
3067
|
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 =
|
|
3068
|
+
topic: z34.string().min(1).optional(),
|
|
3069
|
+
tag: z34.string().min(1).optional(),
|
|
3070
|
+
q: z34.string().min(1).optional()
|
|
3071
|
+
});
|
|
3072
|
+
var createPromptBodySchema = z34.object({
|
|
3073
|
+
text: z34.string().min(1, "text is required"),
|
|
3074
|
+
isBranded: z34.boolean().default(false),
|
|
3075
|
+
topic: z34.string().min(1).optional(),
|
|
3076
|
+
tags: z34.array(z34.string().min(1)).default([])
|
|
3077
|
+
});
|
|
3078
|
+
var updatePromptBodySchema = z34.object({
|
|
3079
|
+
text: z34.string().min(1).optional(),
|
|
3080
|
+
isBranded: z34.boolean().optional(),
|
|
3081
|
+
topicId: z34.string().min(1).nullish(),
|
|
3082
|
+
tags: z34.array(z34.string().min(1)).optional()
|
|
3083
|
+
});
|
|
3084
|
+
var runPromptBodySchema = z34.object({
|
|
2443
3085
|
/** Preferred paired representation; each agent may pin its own model tiers. */
|
|
2444
|
-
agentConfigs:
|
|
3086
|
+
agentConfigs: z34.array(agentConfigInputSchema).min(1).optional(),
|
|
2445
3087
|
/** Legacy agent set (no per-agent pins), kept during the API transition. */
|
|
2446
|
-
agents:
|
|
2447
|
-
repoUrl:
|
|
2448
|
-
repoRef:
|
|
2449
|
-
samplesPerCycle:
|
|
3088
|
+
agents: z34.array(z34.enum(["CLAUDE_CODE", "CODEX_CLI", "CURSOR"])).min(1, "Select at least one agent").default(["CLAUDE_CODE", "CODEX_CLI"]),
|
|
3089
|
+
repoUrl: z34.string().min(1).nullish(),
|
|
3090
|
+
repoRef: z34.string().min(1).nullish(),
|
|
3091
|
+
samplesPerCycle: z34.number().int().min(1).max(10).default(1),
|
|
2450
3092
|
webFixture: webFixtureSchema.optional()
|
|
2451
3093
|
});
|
|
2452
|
-
var runPromptResponseSchema =
|
|
2453
|
-
batchIds:
|
|
2454
|
-
runIds:
|
|
2455
|
-
blocked:
|
|
3094
|
+
var runPromptResponseSchema = z34.object({
|
|
3095
|
+
batchIds: z34.array(z34.string()),
|
|
3096
|
+
runIds: z34.array(z34.string()),
|
|
3097
|
+
blocked: z34.enum(["insufficient_credits", "needs_provider_key"]).optional()
|
|
2456
3098
|
});
|
|
2457
3099
|
|
|
2458
3100
|
// ../packages/api-schemas/src/repos.ts
|
|
2459
|
-
import { z as
|
|
3101
|
+
import { z as z35 } from "zod";
|
|
2460
3102
|
var REPO_SIZE_BUCKETS = [
|
|
2461
3103
|
"small",
|
|
2462
3104
|
"medium",
|
|
2463
3105
|
"large",
|
|
2464
3106
|
"xlarge"
|
|
2465
3107
|
];
|
|
2466
|
-
var repoSizeBucketSchema =
|
|
2467
|
-
var repoSchema =
|
|
2468
|
-
url:
|
|
2469
|
-
name:
|
|
2470
|
-
isSystem:
|
|
2471
|
-
languages:
|
|
2472
|
-
frameworks:
|
|
3108
|
+
var repoSizeBucketSchema = z35.enum(REPO_SIZE_BUCKETS);
|
|
3109
|
+
var repoSchema = z35.object({
|
|
3110
|
+
url: z35.string(),
|
|
3111
|
+
name: z35.string(),
|
|
3112
|
+
isSystem: z35.boolean(),
|
|
3113
|
+
languages: z35.array(z35.string()),
|
|
3114
|
+
frameworks: z35.array(z35.string()),
|
|
2473
3115
|
/** Faceted labels (complexity:L2, buildable:yes, stack:nextjs, …). */
|
|
2474
|
-
tags:
|
|
2475
|
-
primaryLanguage:
|
|
2476
|
-
sizeKb:
|
|
3116
|
+
tags: z35.array(z35.string()),
|
|
3117
|
+
primaryLanguage: z35.string(),
|
|
3118
|
+
sizeKb: z35.number(),
|
|
2477
3119
|
sizeBucket: repoSizeBucketSchema.nullable(),
|
|
2478
|
-
stars:
|
|
3120
|
+
stars: z35.number()
|
|
2479
3121
|
});
|
|
2480
3122
|
var repoListResponseSchema = listResponseSchema(repoSchema);
|
|
2481
|
-
var addRepoBodySchema =
|
|
2482
|
-
url:
|
|
3123
|
+
var addRepoBodySchema = z35.object({
|
|
3124
|
+
url: z35.string().min(1, "url is required"),
|
|
2483
3125
|
/**
|
|
2484
3126
|
* Reserved (accepted, not yet persisted): the catalog keys repos by URL only
|
|
2485
3127
|
* — `fact_repo` has no ref column and metadata sync always reads the default
|
|
2486
3128
|
* branch. Kept in the wire format so `gauge repos add --ref` is stable once
|
|
2487
3129
|
* the catalog learns refs.
|
|
2488
3130
|
*/
|
|
2489
|
-
ref:
|
|
3131
|
+
ref: z35.string().min(1).optional(),
|
|
2490
3132
|
/** Display name; defaults to the `owner/repo` label of the URL. */
|
|
2491
|
-
name:
|
|
3133
|
+
name: z35.string().min(1).optional(),
|
|
2492
3134
|
/** Manual override; defaults to frameworks detected from the repo's manifests. */
|
|
2493
|
-
frameworks:
|
|
2494
|
-
tags:
|
|
3135
|
+
frameworks: z35.array(z35.string()).optional(),
|
|
3136
|
+
tags: z35.array(z35.string()).optional()
|
|
2495
3137
|
});
|
|
2496
|
-
var updateRepoBodySchema =
|
|
2497
|
-
url:
|
|
2498
|
-
name:
|
|
2499
|
-
frameworks:
|
|
2500
|
-
tags:
|
|
3138
|
+
var updateRepoBodySchema = z35.object({
|
|
3139
|
+
url: z35.string().min(1, "url is required"),
|
|
3140
|
+
name: z35.string().min(1).optional(),
|
|
3141
|
+
frameworks: z35.array(z35.string()).optional(),
|
|
3142
|
+
tags: z35.array(z35.string()).optional()
|
|
2501
3143
|
});
|
|
2502
|
-
var resyncRepoBodySchema =
|
|
2503
|
-
url:
|
|
3144
|
+
var resyncRepoBodySchema = z35.object({
|
|
3145
|
+
url: z35.string().min(1, "url is required")
|
|
2504
3146
|
});
|
|
2505
|
-
var deleteRepoQuerySchema =
|
|
2506
|
-
url:
|
|
3147
|
+
var deleteRepoQuerySchema = z35.object({
|
|
3148
|
+
url: z35.string().min(1, "url is required")
|
|
2507
3149
|
});
|
|
2508
|
-
var repoSyncResultSchema =
|
|
3150
|
+
var repoSyncResultSchema = z35.object({
|
|
2509
3151
|
repo: repoSchema,
|
|
2510
|
-
synced:
|
|
3152
|
+
synced: z35.boolean()
|
|
2511
3153
|
});
|
|
2512
3154
|
|
|
2513
3155
|
// ../packages/api-schemas/src/summary.ts
|
|
2514
|
-
import { z as
|
|
3156
|
+
import { z as z36 } from "zod";
|
|
2515
3157
|
function cardResultSchema(data) {
|
|
2516
|
-
return
|
|
2517
|
-
|
|
2518
|
-
|
|
3158
|
+
return z36.union([
|
|
3159
|
+
z36.object({ ok: z36.literal(true), data }),
|
|
3160
|
+
z36.object({ ok: z36.literal(false), error: z36.string() })
|
|
2519
3161
|
]);
|
|
2520
3162
|
}
|
|
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:
|
|
3163
|
+
var summaryActionSchema = z36.object({
|
|
3164
|
+
id: z36.string(),
|
|
3165
|
+
title: z36.string(),
|
|
3166
|
+
priority: z36.string(),
|
|
3167
|
+
status: z36.string(),
|
|
3168
|
+
evidenceCount: z36.number().int()
|
|
3169
|
+
});
|
|
3170
|
+
var summaryAeCardSchema = z36.object({
|
|
3171
|
+
id: z36.string(),
|
|
3172
|
+
name: z36.string(),
|
|
3173
|
+
judgedRuns: z36.number().int(),
|
|
3174
|
+
passRate: z36.number().nullable(),
|
|
2533
3175
|
/** 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:
|
|
3176
|
+
deltaPP: z36.number().nullable()
|
|
3177
|
+
});
|
|
3178
|
+
var summaryVisibilityCardSchema = z36.object({
|
|
3179
|
+
name: z36.string(),
|
|
3180
|
+
owned: z36.object({
|
|
3181
|
+
name: z36.string(),
|
|
3182
|
+
rank: z36.number(),
|
|
3183
|
+
chosenRate: z36.number(),
|
|
3184
|
+
mentionRate: z36.number()
|
|
2543
3185
|
}).nullable(),
|
|
2544
|
-
chosenDeltaPP:
|
|
3186
|
+
chosenDeltaPP: z36.number().nullable()
|
|
2545
3187
|
});
|
|
2546
|
-
var homeSummarySchema =
|
|
2547
|
-
hasAnyRuns:
|
|
2548
|
-
lastSynthesisAt:
|
|
2549
|
-
actions: cardResultSchema(
|
|
3188
|
+
var homeSummarySchema = z36.object({
|
|
3189
|
+
hasAnyRuns: z36.boolean(),
|
|
3190
|
+
lastSynthesisAt: z36.string().nullable(),
|
|
3191
|
+
actions: cardResultSchema(z36.array(summaryActionSchema)),
|
|
2550
3192
|
visibility: cardResultSchema(
|
|
2551
|
-
|
|
2552
|
-
cards:
|
|
2553
|
-
marketsTotal:
|
|
2554
|
-
promptCount:
|
|
3193
|
+
z36.object({
|
|
3194
|
+
cards: z36.array(summaryVisibilityCardSchema),
|
|
3195
|
+
marketsTotal: z36.number().int(),
|
|
3196
|
+
promptCount: z36.number().int()
|
|
2555
3197
|
})
|
|
2556
3198
|
),
|
|
2557
3199
|
agentExperience: cardResultSchema(
|
|
2558
|
-
|
|
2559
|
-
cards:
|
|
2560
|
-
total:
|
|
2561
|
-
setCount:
|
|
3200
|
+
z36.object({
|
|
3201
|
+
cards: z36.array(summaryAeCardSchema),
|
|
3202
|
+
total: z36.number().int(),
|
|
3203
|
+
setCount: z36.number().int()
|
|
2562
3204
|
})
|
|
2563
3205
|
),
|
|
2564
|
-
notableSessions: cardResultSchema(
|
|
3206
|
+
notableSessions: cardResultSchema(z36.array(z36.unknown()))
|
|
2565
3207
|
});
|
|
2566
3208
|
|
|
2567
3209
|
// ../packages/api-schemas/src/tokens.ts
|
|
2568
|
-
import { z as
|
|
2569
|
-
var apiTokenSchema =
|
|
2570
|
-
id:
|
|
2571
|
-
name:
|
|
3210
|
+
import { z as z37 } from "zod";
|
|
3211
|
+
var apiTokenSchema = z37.object({
|
|
3212
|
+
id: z37.string(),
|
|
3213
|
+
name: z37.string(),
|
|
2572
3214
|
/** 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:
|
|
3215
|
+
last4: z37.string(),
|
|
3216
|
+
expiresAt: z37.iso.datetime().nullable(),
|
|
3217
|
+
lastUsedAt: z37.iso.datetime().nullable(),
|
|
3218
|
+
createdAt: z37.iso.datetime(),
|
|
3219
|
+
revokedAt: z37.iso.datetime().nullable()
|
|
3220
|
+
});
|
|
3221
|
+
var createTokenRequestSchema = z37.object({
|
|
3222
|
+
name: z37.string().min(1).max(100),
|
|
2581
3223
|
/** ISO-8601 datetime; omit for no expiry. */
|
|
2582
|
-
expiresAt:
|
|
3224
|
+
expiresAt: z37.iso.datetime({ offset: true }).optional()
|
|
2583
3225
|
});
|
|
2584
3226
|
var createTokenResponseSchema = apiTokenSchema.extend({
|
|
2585
|
-
token:
|
|
3227
|
+
token: z37.string()
|
|
2586
3228
|
});
|
|
2587
3229
|
var listTokensResponseSchema = listResponseSchema(apiTokenSchema);
|
|
2588
3230
|
|
|
2589
3231
|
// ../packages/api-schemas/src/visibility.ts
|
|
2590
|
-
import { z as
|
|
3232
|
+
import { z as z38 } from "zod";
|
|
2591
3233
|
var VISIBILITY_PROMPT_KINDS = ["HEAD_TO_HEAD", "RECOMMEND"];
|
|
2592
|
-
var visibilityPromptKindSchema =
|
|
3234
|
+
var visibilityPromptKindSchema = z38.enum(VISIBILITY_PROMPT_KINDS);
|
|
2593
3235
|
var visibilityPromptSchema = visibilityPromptSettingsSchema.extend({
|
|
2594
|
-
id:
|
|
2595
|
-
name:
|
|
3236
|
+
id: z38.string(),
|
|
3237
|
+
name: z38.string(),
|
|
2596
3238
|
kind: visibilityPromptKindSchema,
|
|
2597
|
-
promptText:
|
|
3239
|
+
promptText: z38.string(),
|
|
2598
3240
|
/** HEAD_TO_HEAD is always branded; RECOMMEND may be either. */
|
|
2599
|
-
branded:
|
|
2600
|
-
brandA:
|
|
2601
|
-
brandB:
|
|
2602
|
-
market:
|
|
2603
|
-
position:
|
|
2604
|
-
createdAt:
|
|
3241
|
+
branded: z38.boolean(),
|
|
3242
|
+
brandA: z38.string().nullable(),
|
|
3243
|
+
brandB: z38.string().nullable(),
|
|
3244
|
+
market: z38.object({ id: z38.string(), slug: z38.string(), name: z38.string() }).nullable(),
|
|
3245
|
+
position: z38.number().int(),
|
|
3246
|
+
createdAt: z38.string(),
|
|
2605
3247
|
/** User tag names on the hidden backing prompt (Surface:* excluded). */
|
|
2606
|
-
tags:
|
|
2607
|
-
runCount:
|
|
2608
|
-
lastRunAt:
|
|
2609
|
-
scenarios:
|
|
3248
|
+
tags: z38.array(z38.string()),
|
|
3249
|
+
runCount: z38.number().int(),
|
|
3250
|
+
lastRunAt: z38.string().nullable(),
|
|
3251
|
+
scenarios: z38.array(visibilityScenarioSchema)
|
|
2610
3252
|
});
|
|
2611
|
-
var listVisibilityPromptsResponseSchema =
|
|
2612
|
-
items:
|
|
3253
|
+
var listVisibilityPromptsResponseSchema = z38.object({
|
|
3254
|
+
items: z38.array(visibilityPromptSchema)
|
|
2613
3255
|
});
|
|
2614
|
-
var createVisibilityPromptBodySchema =
|
|
2615
|
-
name:
|
|
2616
|
-
promptText:
|
|
3256
|
+
var createVisibilityPromptBodySchema = z38.object({
|
|
3257
|
+
name: z38.string().min(1),
|
|
3258
|
+
promptText: z38.string().min(1),
|
|
2617
3259
|
kind: visibilityPromptKindSchema,
|
|
2618
|
-
branded:
|
|
3260
|
+
branded: z38.boolean().optional(),
|
|
2619
3261
|
/** Required pair for HEAD_TO_HEAD (order-independent). */
|
|
2620
|
-
brandA:
|
|
2621
|
-
brandB:
|
|
3262
|
+
brandA: z38.string().nullish(),
|
|
3263
|
+
brandB: z38.string().nullish(),
|
|
2622
3264
|
/** Measured market id from the org's tracked set. */
|
|
2623
|
-
marketId:
|
|
2624
|
-
tags:
|
|
3265
|
+
marketId: z38.string().nullish(),
|
|
3266
|
+
tags: z38.array(z38.string()).optional(),
|
|
2625
3267
|
agents: visibilityPromptSettingsInputShape.agents.optional(),
|
|
2626
3268
|
skillRefs: visibilityPromptSettingsInputShape.skillRefs,
|
|
2627
3269
|
mcpRefs: visibilityPromptSettingsInputShape.mcpRefs,
|
|
2628
3270
|
connectionIds: visibilityPromptSettingsInputShape.connectionIds,
|
|
2629
3271
|
cadence: visibilityPromptSettingsInputShape.cadence,
|
|
2630
3272
|
sampleCount: visibilityPromptSettingsInputShape.sampleCount,
|
|
2631
|
-
scenarios:
|
|
3273
|
+
scenarios: z38.array(visibilityScenarioInputSchema).optional().default([])
|
|
2632
3274
|
}).strict();
|
|
2633
|
-
var synthesizeResponseSchema =
|
|
3275
|
+
var synthesizeResponseSchema = z38.object({
|
|
2634
3276
|
/** 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:
|
|
3277
|
+
queued: z38.boolean()
|
|
3278
|
+
});
|
|
3279
|
+
var updateVisibilityPromptBodySchema = z38.object({
|
|
3280
|
+
name: z38.string().min(1).optional(),
|
|
3281
|
+
promptText: z38.string().min(1).optional(),
|
|
3282
|
+
branded: z38.boolean().optional(),
|
|
3283
|
+
brandA: z38.string().nullish(),
|
|
3284
|
+
brandB: z38.string().nullish(),
|
|
3285
|
+
marketId: z38.string().nullish(),
|
|
3286
|
+
tags: z38.array(z38.string()).optional(),
|
|
2645
3287
|
...visibilityPromptSettingsPatchShape,
|
|
2646
3288
|
/** Replaces the whole scenario set when present. */
|
|
2647
|
-
scenarios:
|
|
3289
|
+
scenarios: z38.array(visibilityScenarioInputSchema).optional()
|
|
2648
3290
|
}).strict();
|
|
2649
|
-
var runVisibilityPromptResponseSchema =
|
|
2650
|
-
batchIds:
|
|
2651
|
-
runIds:
|
|
3291
|
+
var runVisibilityPromptResponseSchema = z38.object({
|
|
3292
|
+
batchIds: z38.array(z38.string()),
|
|
3293
|
+
runIds: z38.array(z38.string())
|
|
2652
3294
|
});
|
|
2653
|
-
var visibilityPromptRunSchema =
|
|
2654
|
-
id:
|
|
2655
|
-
status:
|
|
3295
|
+
var visibilityPromptRunSchema = z38.object({
|
|
3296
|
+
id: z38.string(),
|
|
3297
|
+
status: z38.string(),
|
|
2656
3298
|
agent: agentSchema,
|
|
2657
|
-
model:
|
|
2658
|
-
resolvedModel:
|
|
2659
|
-
createdAt:
|
|
2660
|
-
startedAt:
|
|
2661
|
-
finishedAt:
|
|
2662
|
-
failureReason:
|
|
2663
|
-
verdict:
|
|
2664
|
-
status:
|
|
2665
|
-
error:
|
|
2666
|
-
payload:
|
|
3299
|
+
model: z38.string().nullable(),
|
|
3300
|
+
resolvedModel: z38.string().nullable(),
|
|
3301
|
+
createdAt: z38.string(),
|
|
3302
|
+
startedAt: z38.string().nullable(),
|
|
3303
|
+
finishedAt: z38.string().nullable(),
|
|
3304
|
+
failureReason: z38.string().nullable(),
|
|
3305
|
+
verdict: z38.object({
|
|
3306
|
+
status: z38.string(),
|
|
3307
|
+
error: z38.string().nullable(),
|
|
3308
|
+
payload: z38.unknown().nullable()
|
|
2667
3309
|
}).nullable()
|
|
2668
3310
|
});
|
|
2669
|
-
var listVisibilityPromptRunsResponseSchema =
|
|
2670
|
-
items:
|
|
3311
|
+
var listVisibilityPromptRunsResponseSchema = z38.object({
|
|
3312
|
+
items: z38.array(visibilityPromptRunSchema)
|
|
2671
3313
|
});
|
|
2672
|
-
var orgMarketSchema =
|
|
2673
|
-
marketId:
|
|
2674
|
-
slug:
|
|
2675
|
-
name:
|
|
3314
|
+
var orgMarketSchema = z38.object({
|
|
3315
|
+
marketId: z38.string(),
|
|
3316
|
+
slug: z38.string(),
|
|
3317
|
+
name: z38.string(),
|
|
2676
3318
|
/** The one line saying what the market measures. */
|
|
2677
|
-
capability:
|
|
3319
|
+
capability: z38.string(),
|
|
2678
3320
|
/** SUGGESTED (the matcher) | USER (a human picked it). */
|
|
2679
|
-
source:
|
|
3321
|
+
source: z38.string()
|
|
2680
3322
|
});
|
|
2681
3323
|
var addableMarketSchema = orgMarketSchema.omit({ source: true });
|
|
2682
|
-
var listMarketsResponseSchema =
|
|
2683
|
-
tracked:
|
|
3324
|
+
var listMarketsResponseSchema = z38.object({
|
|
3325
|
+
tracked: z38.array(orgMarketSchema),
|
|
2684
3326
|
/** Published markets the org does not track yet (closed set — no free-text
|
|
2685
3327
|
* market creation). */
|
|
2686
|
-
addable:
|
|
3328
|
+
addable: z38.array(addableMarketSchema)
|
|
2687
3329
|
});
|
|
2688
|
-
var addMarketBodySchema =
|
|
3330
|
+
var addMarketBodySchema = z38.object({ marketId: z38.string().min(1) });
|
|
2689
3331
|
|
|
2690
3332
|
// src/version.ts
|
|
2691
3333
|
import { createRequire } from "module";
|
|
@@ -3069,7 +3711,7 @@ __export(apply_exports, {
|
|
|
3069
3711
|
register: () => register2
|
|
3070
3712
|
});
|
|
3071
3713
|
import { readFileSync as readFileSync3 } from "fs";
|
|
3072
|
-
import { z as
|
|
3714
|
+
import { z as z39 } from "zod";
|
|
3073
3715
|
function assertRequiredExperiment(spec, required) {
|
|
3074
3716
|
if (required.length === 0) {
|
|
3075
3717
|
throw new CliError(
|
|
@@ -3221,7 +3863,7 @@ function register2(program2) {
|
|
|
3221
3863
|
).option("--schema", "print the battery spec JSON Schema and exit").option("--example", "print a minimal example battery spec and exit").action(
|
|
3222
3864
|
async (opts, command) => {
|
|
3223
3865
|
if (opts.schema) {
|
|
3224
|
-
printJson(
|
|
3866
|
+
printJson(z39.toJSONSchema(batteries_exports.batterySpecSchema));
|
|
3225
3867
|
return;
|
|
3226
3868
|
}
|
|
3227
3869
|
if (opts.example) {
|
|
@@ -4131,16 +4773,50 @@ function register7(program2) {
|
|
|
4131
4773
|
});
|
|
4132
4774
|
}
|
|
4133
4775
|
|
|
4776
|
+
// src/commands/connections.ts
|
|
4777
|
+
var connections_exports2 = {};
|
|
4778
|
+
__export(connections_exports2, {
|
|
4779
|
+
register: () => register8
|
|
4780
|
+
});
|
|
4781
|
+
function connectionsPath(org) {
|
|
4782
|
+
return `/api/v1/orgs/${encodeURIComponent(org)}/connections`;
|
|
4783
|
+
}
|
|
4784
|
+
function register8(program2) {
|
|
4785
|
+
const group = program2.command("connections").alias("credentials").description("Inspect the org's stored credentials (no secrets)");
|
|
4786
|
+
group.command("list").description("List credentials with the ids --connection accepts").action(async (_opts, cmd) => {
|
|
4787
|
+
const org = resolveOrg(cmd);
|
|
4788
|
+
const res = await createClient().get(
|
|
4789
|
+
connectionsPath(org)
|
|
4790
|
+
);
|
|
4791
|
+
if (resolveOutput(cmd) === "json") {
|
|
4792
|
+
printJson(res.items);
|
|
4793
|
+
return;
|
|
4794
|
+
}
|
|
4795
|
+
printItems(
|
|
4796
|
+
res.items.map((c) => ({
|
|
4797
|
+
id: c.id,
|
|
4798
|
+
name: c.handle,
|
|
4799
|
+
vendor: c.profileLabel,
|
|
4800
|
+
placeholder: c.credentialKey,
|
|
4801
|
+
domains: c.allowedHosts.join(", "),
|
|
4802
|
+
kind: c.kind,
|
|
4803
|
+
value: c.last4 ? `\xB7\xB7\xB7\xB7${c.last4}` : ""
|
|
4804
|
+
})),
|
|
4805
|
+
"table"
|
|
4806
|
+
);
|
|
4807
|
+
});
|
|
4808
|
+
}
|
|
4809
|
+
|
|
4134
4810
|
// src/commands/dashboards.ts
|
|
4135
4811
|
var dashboards_exports2 = {};
|
|
4136
4812
|
__export(dashboards_exports2, {
|
|
4137
|
-
register: () =>
|
|
4813
|
+
register: () => register9
|
|
4138
4814
|
});
|
|
4139
4815
|
import { readFileSync as readFileSync5 } from "fs";
|
|
4140
4816
|
function dashboardsPath(org) {
|
|
4141
4817
|
return `/api/v1/orgs/${encodeURIComponent(org)}/dashboards`;
|
|
4142
4818
|
}
|
|
4143
|
-
function
|
|
4819
|
+
function register9(program2) {
|
|
4144
4820
|
const group = program2.command("dashboards").description("Saved dashboards (CRUD + view filters; layout is UI-only)");
|
|
4145
4821
|
group.command("list").description("List your dashboard library").action(async (_opts, cmd) => {
|
|
4146
4822
|
const org = resolveOrg(cmd);
|
|
@@ -4242,7 +4918,7 @@ var evals_exports2 = {};
|
|
|
4242
4918
|
__export(evals_exports2, {
|
|
4243
4919
|
evalSetsPath: () => evalSetsPath,
|
|
4244
4920
|
parseCriterion: () => parseCriterion,
|
|
4245
|
-
register: () =>
|
|
4921
|
+
register: () => register10
|
|
4246
4922
|
});
|
|
4247
4923
|
import { readFileSync as readFileSync6 } from "fs";
|
|
4248
4924
|
|
|
@@ -4531,7 +5207,7 @@ function printDetail(e) {
|
|
|
4531
5207
|
console.log("criteria:");
|
|
4532
5208
|
for (const c of e.criteria) console.log(` [${c.id}] ${c.name}: ${c.rubric}`);
|
|
4533
5209
|
}
|
|
4534
|
-
function
|
|
5210
|
+
function register10(program2) {
|
|
4535
5211
|
const group = program2.command("evals").description("Manage eval sets (judged agent-experience measurements)");
|
|
4536
5212
|
group.command("list").description("List the org's eval sets with pass-rate stats").option(
|
|
4537
5213
|
"--agents <agents>",
|
|
@@ -4721,7 +5397,7 @@ function register9(program2) {
|
|
|
4721
5397
|
// src/commands/experiments.ts
|
|
4722
5398
|
var experiments_exports2 = {};
|
|
4723
5399
|
__export(experiments_exports2, {
|
|
4724
|
-
register: () =>
|
|
5400
|
+
register: () => register11,
|
|
4725
5401
|
rewriteContentType: () => rewriteContentType
|
|
4726
5402
|
});
|
|
4727
5403
|
import { readFileSync as readFileSync7 } from "fs";
|
|
@@ -4784,8 +5460,10 @@ function printDetail2(e) {
|
|
|
4784
5460
|
}
|
|
4785
5461
|
}
|
|
4786
5462
|
}
|
|
4787
|
-
function
|
|
4788
|
-
const group = program2.command("experiments").description(
|
|
5463
|
+
function register11(program2) {
|
|
5464
|
+
const group = program2.command("experiments").description(
|
|
5465
|
+
"Author, launch, and read Fixer content experiments (legacy: orgs with Optimizations answer 409 on writes; use `gauge optimizations`)"
|
|
5466
|
+
);
|
|
4789
5467
|
group.command("list").description("List the org's experiments").option(
|
|
4790
5468
|
"--status <statuses>",
|
|
4791
5469
|
"comma-separated statuses (e.g. RUNNING,COMPLETE)"
|
|
@@ -5131,7 +5809,7 @@ function register10(program2) {
|
|
|
5131
5809
|
// src/commands/keys.ts
|
|
5132
5810
|
var keys_exports2 = {};
|
|
5133
5811
|
__export(keys_exports2, {
|
|
5134
|
-
register: () =>
|
|
5812
|
+
register: () => register12
|
|
5135
5813
|
});
|
|
5136
5814
|
function keysPath(org) {
|
|
5137
5815
|
return `/api/v1/orgs/${encodeURIComponent(org)}/provider-keys`;
|
|
@@ -5174,7 +5852,7 @@ async function readKeyInput(opts) {
|
|
|
5174
5852
|
}
|
|
5175
5853
|
return key;
|
|
5176
5854
|
}
|
|
5177
|
-
function
|
|
5855
|
+
function register12(program2) {
|
|
5178
5856
|
const group = program2.command("keys").description("Manage BYOK provider keys (write-only; reads show last4)");
|
|
5179
5857
|
group.command("set <provider>").description(
|
|
5180
5858
|
"Set a provider key (anthropic|openai); reads it from stdin or GAUGE_PROVIDER_KEY"
|
|
@@ -5230,7 +5908,7 @@ function register11(program2) {
|
|
|
5230
5908
|
// src/commands/mcp.ts
|
|
5231
5909
|
var mcp_exports2 = {};
|
|
5232
5910
|
__export(mcp_exports2, {
|
|
5233
|
-
register: () =>
|
|
5911
|
+
register: () => register13
|
|
5234
5912
|
});
|
|
5235
5913
|
import { readFileSync as readFileSync8 } from "fs";
|
|
5236
5914
|
function mcpPath(org) {
|
|
@@ -5277,7 +5955,7 @@ function specFromOpts(opts) {
|
|
|
5277
5955
|
...tools.length ? { tools } : {}
|
|
5278
5956
|
};
|
|
5279
5957
|
}
|
|
5280
|
-
function
|
|
5958
|
+
function register13(program2) {
|
|
5281
5959
|
const group = program2.command("mcp").description("Manage MCP servers used by eval and visibility runs");
|
|
5282
5960
|
group.command("list").description("List the org's MCP servers with their newest version").action(async (_opts, cmd) => {
|
|
5283
5961
|
const org = resolveOrg(cmd);
|
|
@@ -5408,9 +6086,9 @@ function register12(program2) {
|
|
|
5408
6086
|
// src/commands/members.ts
|
|
5409
6087
|
var members_exports = {};
|
|
5410
6088
|
__export(members_exports, {
|
|
5411
|
-
register: () =>
|
|
6089
|
+
register: () => register14
|
|
5412
6090
|
});
|
|
5413
|
-
function
|
|
6091
|
+
function register14(program2) {
|
|
5414
6092
|
const group = program2.command("members").description("Team members and pending invites (read-only)");
|
|
5415
6093
|
group.command("list").description("List members and pending invites").action(async (_opts, cmd) => {
|
|
5416
6094
|
const org = resolveOrg(cmd);
|
|
@@ -5452,7 +6130,7 @@ var models_exports = {};
|
|
|
5452
6130
|
__export(models_exports, {
|
|
5453
6131
|
capabilityLabel: () => capabilityLabel,
|
|
5454
6132
|
executionTargetsPath: () => executionTargetsPath,
|
|
5455
|
-
register: () =>
|
|
6133
|
+
register: () => register15
|
|
5456
6134
|
});
|
|
5457
6135
|
function executionTargetsPath(org) {
|
|
5458
6136
|
return `/api/v1/orgs/${encodeURIComponent(org)}/execution-targets`;
|
|
@@ -5460,7 +6138,7 @@ function executionTargetsPath(org) {
|
|
|
5460
6138
|
function capabilityLabel(capabilities) {
|
|
5461
6139
|
return Object.entries(capabilities).filter(([, supported]) => supported).map(([name]) => name === "agentContext" ? "context" : name).join(", ");
|
|
5462
6140
|
}
|
|
5463
|
-
function
|
|
6141
|
+
function register15(program2) {
|
|
5464
6142
|
const group = program2.command("models").description("Discover supported models, harnesses, and providers");
|
|
5465
6143
|
group.command("list", { isDefault: true }).description("List execution targets available to the organization").action(async (_opts, cmd) => {
|
|
5466
6144
|
const org = resolveOrg(cmd);
|
|
@@ -5487,7 +6165,7 @@ function register14(program2) {
|
|
|
5487
6165
|
// src/commands/onboard.ts
|
|
5488
6166
|
var onboard_exports = {};
|
|
5489
6167
|
__export(onboard_exports, {
|
|
5490
|
-
register: () =>
|
|
6168
|
+
register: () => register16
|
|
5491
6169
|
});
|
|
5492
6170
|
function orgNameFromEmail(email) {
|
|
5493
6171
|
const domain = email?.split("@")[1] ?? "";
|
|
@@ -5495,7 +6173,7 @@ function orgNameFromEmail(email) {
|
|
|
5495
6173
|
if (!base) return "My Workspace";
|
|
5496
6174
|
return base.charAt(0).toUpperCase() + base.slice(1);
|
|
5497
6175
|
}
|
|
5498
|
-
function
|
|
6176
|
+
function register16(program2) {
|
|
5499
6177
|
program2.command("onboard").description(
|
|
5500
6178
|
"Self-serve onboarding: sign in (device flow) and create your first workspace"
|
|
5501
6179
|
).option("--email <email>", "email a sign-in link (device-flow convenience)").option("--org-name <name>", "workspace name (default: from your email)").option("--website <url>", "company site (scanned to seed the workspace)").option("--new", "create a new workspace even if you already belong to one").option(
|
|
@@ -5589,10 +6267,602 @@ Using workspace ${orgSlug}.`
|
|
|
5589
6267
|
);
|
|
5590
6268
|
}
|
|
5591
6269
|
|
|
6270
|
+
// src/commands/optimizations.ts
|
|
6271
|
+
var optimizations_exports2 = {};
|
|
6272
|
+
__export(optimizations_exports2, {
|
|
6273
|
+
parseEffort: () => parseEffort,
|
|
6274
|
+
parseStatuses: () => parseStatuses,
|
|
6275
|
+
parseSubject: () => parseSubject,
|
|
6276
|
+
parseTarget: () => parseTarget,
|
|
6277
|
+
planFromOpts: () => planFromOpts,
|
|
6278
|
+
register: () => register17,
|
|
6279
|
+
trialBodyFromOpts: () => trialBodyFromOpts
|
|
6280
|
+
});
|
|
6281
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
6282
|
+
var TERMINAL2 = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
|
|
6283
|
+
var EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
6284
|
+
function basePath(org) {
|
|
6285
|
+
return `/api/v1/orgs/${encodeURIComponent(org)}/optimizations`;
|
|
6286
|
+
}
|
|
6287
|
+
function itemPath2(org, id) {
|
|
6288
|
+
return `${basePath(org)}/${encodeURIComponent(id)}`;
|
|
6289
|
+
}
|
|
6290
|
+
function trialPath(org, id, trialId) {
|
|
6291
|
+
return `${itemPath2(org, id)}/trials/${encodeURIComponent(trialId)}`;
|
|
6292
|
+
}
|
|
6293
|
+
function readText2(path) {
|
|
6294
|
+
return readFileSync9(path === "-" ? 0 : path, "utf8");
|
|
6295
|
+
}
|
|
6296
|
+
function sleep3(ms) {
|
|
6297
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6298
|
+
}
|
|
6299
|
+
function parseSubject(opts) {
|
|
6300
|
+
if (opts.eval && opts.preference)
|
|
6301
|
+
throw new CliError("usage", "pass --eval or --preference, not both");
|
|
6302
|
+
if (opts.eval) return { subjectKind: "EVAL_SET", subjectId: opts.eval };
|
|
6303
|
+
if (opts.preference)
|
|
6304
|
+
return { subjectKind: "VISIBILITY_PROMPT", subjectId: opts.preference };
|
|
6305
|
+
throw new CliError("usage", "pass --eval <id> or --preference <id>");
|
|
6306
|
+
}
|
|
6307
|
+
function parseTarget(raw) {
|
|
6308
|
+
const spec = parseAgentSpec(raw);
|
|
6309
|
+
if (spec.models.length > 1)
|
|
6310
|
+
throw new CliError(
|
|
6311
|
+
"usage",
|
|
6312
|
+
`--target "${raw}" names several models; an optimization pins exactly one`
|
|
6313
|
+
);
|
|
6314
|
+
return spec.models.length ? { agent: spec.agent, model: spec.models[0] } : { agent: spec.agent };
|
|
6315
|
+
}
|
|
6316
|
+
function parseEffort(raw) {
|
|
6317
|
+
const value = raw.trim().toLowerCase();
|
|
6318
|
+
if (!EFFORTS.includes(value))
|
|
6319
|
+
throw new CliError(
|
|
6320
|
+
"usage",
|
|
6321
|
+
`--effort must be one of ${EFFORTS.join(", ")} (got "${raw}")`
|
|
6322
|
+
);
|
|
6323
|
+
return value.toUpperCase();
|
|
6324
|
+
}
|
|
6325
|
+
function parseCount(raw, flag) {
|
|
6326
|
+
if (raw === void 0) return void 0;
|
|
6327
|
+
const n = Number(raw);
|
|
6328
|
+
if (!Number.isInteger(n) || n < 1)
|
|
6329
|
+
throw new CliError("usage", `${flag} must be a positive integer`);
|
|
6330
|
+
return n;
|
|
6331
|
+
}
|
|
6332
|
+
function planFromOpts(opts) {
|
|
6333
|
+
if (opts.effort && (opts.samples || opts.rounds))
|
|
6334
|
+
throw new CliError(
|
|
6335
|
+
"usage",
|
|
6336
|
+
"pass --effort or --samples/--rounds, not both"
|
|
6337
|
+
);
|
|
6338
|
+
return {
|
|
6339
|
+
effort: opts.effort ? parseEffort(opts.effort) : void 0,
|
|
6340
|
+
sampleCount: parseCount(opts.samples, "--samples"),
|
|
6341
|
+
maxRounds: parseCount(opts.rounds, "--rounds"),
|
|
6342
|
+
target: opts.target ? parseTarget(opts.target) : void 0
|
|
6343
|
+
};
|
|
6344
|
+
}
|
|
6345
|
+
function parseStatuses(raw) {
|
|
6346
|
+
if (!raw) return void 0;
|
|
6347
|
+
const parts = raw.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean);
|
|
6348
|
+
for (const part of parts)
|
|
6349
|
+
if (!["ACTIVE", "PAUSED", "DONE", "ARCHIVED"].includes(part))
|
|
6350
|
+
throw new CliError(
|
|
6351
|
+
"usage",
|
|
6352
|
+
`unknown status "${part}" (expected ACTIVE, PAUSED, DONE, ARCHIVED)`
|
|
6353
|
+
);
|
|
6354
|
+
return parts.join(",");
|
|
6355
|
+
}
|
|
6356
|
+
function trialBodyFromOpts(opts, read = readText2) {
|
|
6357
|
+
const launch = opts.launch !== false;
|
|
6358
|
+
const fork = opts.forkRun || opts.forkBoundary ? (() => {
|
|
6359
|
+
if (!opts.forkRun || !opts.forkBoundary)
|
|
6360
|
+
throw new CliError(
|
|
6361
|
+
"usage",
|
|
6362
|
+
"--fork-run and --fork-boundary go together"
|
|
6363
|
+
);
|
|
6364
|
+
return { runId: opts.forkRun, boundarySeq: opts.forkBoundary };
|
|
6365
|
+
})() : void 0;
|
|
6366
|
+
if (opts.file) {
|
|
6367
|
+
const parsed = JSON.parse(read(opts.file));
|
|
6368
|
+
const pick = parseCount(opts.pick, "--pick") ?? 1;
|
|
6369
|
+
let chosen;
|
|
6370
|
+
if (Array.isArray(parsed)) {
|
|
6371
|
+
if (pick > parsed.length)
|
|
6372
|
+
throw new CliError(
|
|
6373
|
+
"usage",
|
|
6374
|
+
`--pick ${pick} but the file holds ${parsed.length} proposal${parsed.length === 1 ? "" : "s"}`
|
|
6375
|
+
);
|
|
6376
|
+
chosen = parsed[pick - 1];
|
|
6377
|
+
} else {
|
|
6378
|
+
if (opts.pick !== void 0)
|
|
6379
|
+
throw new CliError("usage", "--pick applies to a proposals array");
|
|
6380
|
+
chosen = parsed;
|
|
6381
|
+
}
|
|
6382
|
+
const record = chosen;
|
|
6383
|
+
const body = "trial" in record ? record : { trial: record };
|
|
6384
|
+
return { ...body, ...fork ? { fork } : {}, launch };
|
|
6385
|
+
}
|
|
6386
|
+
if (!opts.title) throw new CliError("usage", "--title is required");
|
|
6387
|
+
const lever = opts.lever?.toUpperCase();
|
|
6388
|
+
const kind = opts.kind?.toUpperCase();
|
|
6389
|
+
let intervention;
|
|
6390
|
+
if (opts.page || opts.bodyFile) {
|
|
6391
|
+
if (!opts.page || !opts.bodyFile)
|
|
6392
|
+
throw new CliError("usage", "--page and --body-file go together");
|
|
6393
|
+
intervention = {
|
|
6394
|
+
kind: "REWRITE_DOCS",
|
|
6395
|
+
after: { pages: [{ url: opts.page, body: read(opts.bodyFile) }] }
|
|
6396
|
+
};
|
|
6397
|
+
} else if (opts.removeSkill) {
|
|
6398
|
+
intervention = {
|
|
6399
|
+
kind: "REMOVE_SKILL",
|
|
6400
|
+
before: { skillVersionId: opts.removeSkill },
|
|
6401
|
+
after: {}
|
|
6402
|
+
};
|
|
6403
|
+
} else if (opts.skillVersion) {
|
|
6404
|
+
intervention = {
|
|
6405
|
+
kind: kind ?? "ADD_SKILL",
|
|
6406
|
+
after: { skillVersionId: opts.skillVersion },
|
|
6407
|
+
...kind === "EDIT_SKILL" ? { before: { skillVersionId: opts.skillVersion } } : {}
|
|
6408
|
+
};
|
|
6409
|
+
} else {
|
|
6410
|
+
throw new CliError(
|
|
6411
|
+
"usage",
|
|
6412
|
+
"describe the change: --skill-version <id>, --remove-skill <id>, --page <url> --body-file <path>, or --file <proposal.json>"
|
|
6413
|
+
);
|
|
6414
|
+
}
|
|
6415
|
+
const trial = {
|
|
6416
|
+
title: opts.title,
|
|
6417
|
+
hypothesis: opts.hypothesis,
|
|
6418
|
+
lever: lever ?? (intervention.kind === "REWRITE_DOCS" ? "DOCS" : "SKILL"),
|
|
6419
|
+
intervention,
|
|
6420
|
+
authorMode: "MANUAL"
|
|
6421
|
+
};
|
|
6422
|
+
return { trial, ...fork ? { fork } : {}, launch };
|
|
6423
|
+
}
|
|
6424
|
+
function pct(value) {
|
|
6425
|
+
return value === null || value === void 0 ? "\u2014" : `${Math.round(value * 100)}%`;
|
|
6426
|
+
}
|
|
6427
|
+
function subjectLabel(kind) {
|
|
6428
|
+
return kind === "EVAL_SET" ? "eval" : "preference";
|
|
6429
|
+
}
|
|
6430
|
+
function toRow4(o) {
|
|
6431
|
+
return {
|
|
6432
|
+
id: o.id,
|
|
6433
|
+
name: o.name.length > 40 ? `${o.name.slice(0, 37)}...` : o.name,
|
|
6434
|
+
status: o.status,
|
|
6435
|
+
subject: `${subjectLabel(o.subjectKind)} ${o.subjectName}`,
|
|
6436
|
+
round: `${o.round}/${o.maxRounds}`,
|
|
6437
|
+
baseline: pct(o.before),
|
|
6438
|
+
now: pct(o.after),
|
|
6439
|
+
delta: o.delta === null ? "\u2014" : `${o.delta > 0 ? "+" : ""}${o.delta}pt`,
|
|
6440
|
+
credits: `${o.creditsSpent}/${o.creditsReserved}`,
|
|
6441
|
+
updated: o.updatedAt
|
|
6442
|
+
};
|
|
6443
|
+
}
|
|
6444
|
+
function trialRow(t) {
|
|
6445
|
+
return {
|
|
6446
|
+
key: t.key,
|
|
6447
|
+
round: t.roundNumber,
|
|
6448
|
+
title: t.title.length > 48 ? `${t.title.slice(0, 45)}...` : t.title,
|
|
6449
|
+
surface: t.lever ?? "",
|
|
6450
|
+
change: t.kind,
|
|
6451
|
+
"builds on": t.parentKey ?? "",
|
|
6452
|
+
status: t.status,
|
|
6453
|
+
score: pct(t.score),
|
|
6454
|
+
result: t.verdict ?? "",
|
|
6455
|
+
sessions: t.sessions,
|
|
6456
|
+
adopted: t.adopted ? "yes" : "",
|
|
6457
|
+
id: t.id
|
|
6458
|
+
};
|
|
6459
|
+
}
|
|
6460
|
+
function printDetail3(o) {
|
|
6461
|
+
console.log(`id: ${o.id}`);
|
|
6462
|
+
console.log(`name: ${o.name}`);
|
|
6463
|
+
console.log(
|
|
6464
|
+
`status: ${o.status}${o.stopReason ? ` (${o.stopReason})` : ""}`
|
|
6465
|
+
);
|
|
6466
|
+
console.log(`mode: ${o.mode === "AUTO" ? "Gauge-led" : "manual"}`);
|
|
6467
|
+
console.log(
|
|
6468
|
+
`subject: ${subjectLabel(o.subjectKind)} ${o.subjectName} (${o.subjectId})`
|
|
6469
|
+
);
|
|
6470
|
+
console.log(
|
|
6471
|
+
`target: ${o.settings.pinnedAgent ?? "(subject roster)"}${o.settings.pinnedModel ? `:${o.settings.pinnedModel}` : ""}`
|
|
6472
|
+
);
|
|
6473
|
+
console.log(
|
|
6474
|
+
`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"}`
|
|
6475
|
+
);
|
|
6476
|
+
console.log(`credits: ${o.creditsSpent} spent of ${o.settings.creditCap}`);
|
|
6477
|
+
console.log(
|
|
6478
|
+
`score: ${pct(o.before)} \u2192 ${pct(o.after)}${o.delta === null ? "" : ` (${o.delta > 0 ? "+" : ""}${o.delta}pt)`}`
|
|
6479
|
+
);
|
|
6480
|
+
if (o.summary) console.log(`summary: ${o.summary}`);
|
|
6481
|
+
if (o.diagnosis?.summary) console.log(`diagnosis: ${o.diagnosis.summary}`);
|
|
6482
|
+
console.log("trials:");
|
|
6483
|
+
printItems(o.rounds.flatMap((round) => round.trials).map(trialRow), "table");
|
|
6484
|
+
for (const round of o.rounds)
|
|
6485
|
+
if (round.narrative)
|
|
6486
|
+
console.log(`round ${round.number}: ${round.narrative}`);
|
|
6487
|
+
}
|
|
6488
|
+
function printTrial(t) {
|
|
6489
|
+
console.log(`key: ${t.key} (round ${t.roundNumber}) \u2014 ${t.id}`);
|
|
6490
|
+
console.log(`title: ${t.title}`);
|
|
6491
|
+
if (t.hypothesis) console.log(`hypothesis: ${t.hypothesis}`);
|
|
6492
|
+
console.log(`change: ${t.kind}${t.lever ? ` on ${t.lever}` : ""}`);
|
|
6493
|
+
console.log(`builds on: ${t.parentKey ?? "\u2014"}`);
|
|
6494
|
+
console.log(
|
|
6495
|
+
`status: ${t.status}${t.verdict ? ` \xB7 ${t.verdict}` : ""}${t.adopted ? " \xB7 adopted" : ""}`
|
|
6496
|
+
);
|
|
6497
|
+
console.log(
|
|
6498
|
+
`score: ${pct(t.baselineScore)} \u2192 ${pct(t.score)} over ${t.sessions} session${t.sessions === 1 ? "" : "s"}`
|
|
6499
|
+
);
|
|
6500
|
+
if (t.outcome) console.log(`outcome: ${t.outcome}`);
|
|
6501
|
+
if (t.runs.length) {
|
|
6502
|
+
console.log("sessions:");
|
|
6503
|
+
for (const run of t.runs) {
|
|
6504
|
+
const verdict = run.passed === null ? "unjudged" : run.passed ? "pass" : "fail";
|
|
6505
|
+
console.log(` ${run.id}: ${run.status} \xB7 ${verdict}`);
|
|
6506
|
+
for (const criterion of run.criteria)
|
|
6507
|
+
console.log(` ${criterion.passed ? "\u2713" : "\u2717"} ${criterion.name}`);
|
|
6508
|
+
}
|
|
6509
|
+
}
|
|
6510
|
+
}
|
|
6511
|
+
function printChange(content) {
|
|
6512
|
+
for (const doc of content.documents) {
|
|
6513
|
+
console.log(`=== ${doc.path}`);
|
|
6514
|
+
console.log("--- before");
|
|
6515
|
+
console.log(doc.before || "(empty)");
|
|
6516
|
+
console.log("+++ after");
|
|
6517
|
+
console.log(doc.after || "(empty)");
|
|
6518
|
+
}
|
|
6519
|
+
}
|
|
6520
|
+
function printEstimate(e) {
|
|
6521
|
+
console.log(
|
|
6522
|
+
`plan: ${e.sampleCount} session${e.sampleCount === 1 ? "" : "s"} per trial \xD7 up to ${e.maxRounds} rounds`
|
|
6523
|
+
);
|
|
6524
|
+
console.log(`per trial: ${e.trialCredits.toFixed(1)} credits`);
|
|
6525
|
+
console.log(`estimate: ${e.estimate} credits (reserved as the cap)`);
|
|
6526
|
+
if (e.basis === "byok")
|
|
6527
|
+
console.log(
|
|
6528
|
+
"note: flat rate \u2014 your own key buys the tokens, so every model costs the same"
|
|
6529
|
+
);
|
|
6530
|
+
else if (e.approximate)
|
|
6531
|
+
console.log(
|
|
6532
|
+
"note: no price or past run covers this model, so the figure is the credit hold, not a forecast"
|
|
6533
|
+
);
|
|
6534
|
+
}
|
|
6535
|
+
function printDiagnosis(d) {
|
|
6536
|
+
console.log(`id: ${d.id}`);
|
|
6537
|
+
console.log(`status: ${d.status} over ${d.runCount} sessions`);
|
|
6538
|
+
console.log(`summary: ${d.summary ?? "(none)"}`);
|
|
6539
|
+
console.log(`recommended: ${d.recommendedLever ?? "no single lever"}`);
|
|
6540
|
+
if (d.clusters.length) {
|
|
6541
|
+
console.log("opportunities:");
|
|
6542
|
+
for (const cluster of d.clusters)
|
|
6543
|
+
console.log(
|
|
6544
|
+
` - ${cluster.title} [${cluster.lever ?? "?"} \xB7 ${Math.round(cluster.confidence * 100)}%] ${cluster.failureMode}`
|
|
6545
|
+
);
|
|
6546
|
+
}
|
|
6547
|
+
}
|
|
6548
|
+
function addSubjectOptions(command) {
|
|
6549
|
+
return command.option("--eval <id>", "an Agent Experience eval").option("--preference <id>", "an Agent Preference prompt");
|
|
6550
|
+
}
|
|
6551
|
+
function addPlanOptions(command) {
|
|
6552
|
+
return command.option(
|
|
6553
|
+
"--effort <level>",
|
|
6554
|
+
"low (1\xD73), medium (1\xD75, default), high (2\xD78), xhigh (3\xD712)"
|
|
6555
|
+
).option("--samples <n>", "sessions per trial (instead of --effort)").option("--rounds <n>", "maximum rounds (instead of --effort)").option(
|
|
6556
|
+
"--target <agent[:model]>",
|
|
6557
|
+
"the one harness/model every session runs on, e.g. claude-code:claude-opus-4-8"
|
|
6558
|
+
);
|
|
6559
|
+
}
|
|
6560
|
+
function register17(program2) {
|
|
6561
|
+
const group = program2.command("optimizations").alias("optimize").description(
|
|
6562
|
+
"Start, steer, and read optimizations: Gauge changes one owned surface per trial and adopts what improves an eval or preference prompt"
|
|
6563
|
+
);
|
|
6564
|
+
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(
|
|
6565
|
+
async (opts, cmd) => {
|
|
6566
|
+
const org = resolveOrg(cmd);
|
|
6567
|
+
const subject = opts.eval || opts.preference ? parseSubject(opts) : void 0;
|
|
6568
|
+
const res = await createClient().get(
|
|
6569
|
+
basePath(org),
|
|
6570
|
+
{
|
|
6571
|
+
status: parseStatuses(opts.status),
|
|
6572
|
+
subjectKind: subject?.subjectKind,
|
|
6573
|
+
subjectId: subject?.subjectId,
|
|
6574
|
+
limit: opts.limit
|
|
6575
|
+
}
|
|
6576
|
+
);
|
|
6577
|
+
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
6578
|
+
else printItems(res.items.map(toRow4), "table");
|
|
6579
|
+
}
|
|
6580
|
+
);
|
|
6581
|
+
group.command("get <id>").description("One optimization: settings, score, and its trial ladder").action(async (id, _opts, cmd) => {
|
|
6582
|
+
const org = resolveOrg(cmd);
|
|
6583
|
+
const detail = await createClient().get(itemPath2(org, id));
|
|
6584
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6585
|
+
else printDetail3(detail);
|
|
6586
|
+
});
|
|
6587
|
+
addSubjectOptions(
|
|
6588
|
+
group.command("diagnose").description(
|
|
6589
|
+
"Improvement opportunities for an eval or preference prompt from its judged sessions"
|
|
6590
|
+
)
|
|
6591
|
+
).action(async (opts, cmd) => {
|
|
6592
|
+
const org = resolveOrg(cmd);
|
|
6593
|
+
const diagnosis = await createClient().post(
|
|
6594
|
+
`${basePath(org)}/diagnoses`,
|
|
6595
|
+
parseSubject(opts)
|
|
6596
|
+
);
|
|
6597
|
+
if (resolveOutput(cmd) === "json") printJson(diagnosis);
|
|
6598
|
+
else printDiagnosis(diagnosis);
|
|
6599
|
+
});
|
|
6600
|
+
addPlanOptions(
|
|
6601
|
+
addSubjectOptions(
|
|
6602
|
+
group.command("estimate").description("Price an optimization before starting it")
|
|
6603
|
+
)
|
|
6604
|
+
).action(async (opts, cmd) => {
|
|
6605
|
+
const org = resolveOrg(cmd);
|
|
6606
|
+
const estimate = await createClient().post(
|
|
6607
|
+
`${basePath(org)}/estimate`,
|
|
6608
|
+
{ ...parseSubject(opts), ...planFromOpts(opts) }
|
|
6609
|
+
);
|
|
6610
|
+
if (resolveOutput(cmd) === "json") printJson(estimate);
|
|
6611
|
+
else printEstimate(estimate);
|
|
6612
|
+
});
|
|
6613
|
+
addPlanOptions(
|
|
6614
|
+
addSubjectOptions(
|
|
6615
|
+
group.command("start").description(
|
|
6616
|
+
"Start a Gauge-led optimization (reserves the estimate as the credit cap)"
|
|
6617
|
+
)
|
|
6618
|
+
)
|
|
6619
|
+
).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(
|
|
6620
|
+
async (opts, cmd) => {
|
|
6621
|
+
const org = resolveOrg(cmd);
|
|
6622
|
+
if (!opts.target)
|
|
6623
|
+
throw new CliError(
|
|
6624
|
+
"usage",
|
|
6625
|
+
"--target <agent[:model]> is required; see `gauge models list`"
|
|
6626
|
+
);
|
|
6627
|
+
const subject = parseSubject(opts);
|
|
6628
|
+
const plan = planFromOpts(opts);
|
|
6629
|
+
const creditCap = parseCount(opts.creditCap, "--credit-cap");
|
|
6630
|
+
const targetScore = opts.targetScore === void 0 ? void 0 : Number(opts.targetScore);
|
|
6631
|
+
if (targetScore !== void 0 && (Number.isNaN(targetScore) || targetScore < 0 || targetScore > 1))
|
|
6632
|
+
throw new CliError("usage", "--target-score must be between 0 and 1");
|
|
6633
|
+
const client = createClient();
|
|
6634
|
+
const estimate = await client.post(
|
|
6635
|
+
`${basePath(org)}/estimate`,
|
|
6636
|
+
{ ...subject, ...plan }
|
|
6637
|
+
);
|
|
6638
|
+
const cap = creditCap ?? estimate.estimate;
|
|
6639
|
+
await confirmOrAbort(
|
|
6640
|
+
`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.`,
|
|
6641
|
+
opts.yes
|
|
6642
|
+
);
|
|
6643
|
+
const detail = await client.post(basePath(org), {
|
|
6644
|
+
...subject,
|
|
6645
|
+
...plan,
|
|
6646
|
+
name: opts.name,
|
|
6647
|
+
creditCap,
|
|
6648
|
+
autoAdopt: opts.autoAdopt,
|
|
6649
|
+
targetScore
|
|
6650
|
+
});
|
|
6651
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6652
|
+
else {
|
|
6653
|
+
console.log(
|
|
6654
|
+
`Started ${detail.id} "${detail.name}" \u2014 ${detail.creditsReserved} credits reserved. Follow it with \`gauge optimizations watch ${detail.id}\`.`
|
|
6655
|
+
);
|
|
6656
|
+
}
|
|
6657
|
+
}
|
|
6658
|
+
);
|
|
6659
|
+
for (const command of ["pause", "resume", "cancel"]) {
|
|
6660
|
+
group.command(`${command} <id>`).description(
|
|
6661
|
+
{
|
|
6662
|
+
pause: "Pause an active optimization (running sessions finish)",
|
|
6663
|
+
resume: "Resume a paused optimization",
|
|
6664
|
+
cancel: "Cancel an optimization: stops in-flight sessions and releases unspent credits"
|
|
6665
|
+
}[command]
|
|
6666
|
+
).option("--yes", "skip the confirmation (cancel only)").action(async (id, opts, cmd) => {
|
|
6667
|
+
const org = resolveOrg(cmd);
|
|
6668
|
+
if (command === "cancel")
|
|
6669
|
+
await confirmOrAbort(
|
|
6670
|
+
`Cancel optimization ${id}? In-flight sessions stop and the reservation is released.`,
|
|
6671
|
+
opts.yes
|
|
6672
|
+
);
|
|
6673
|
+
const detail = await createClient().post(
|
|
6674
|
+
`${itemPath2(org, id)}/${command}`,
|
|
6675
|
+
{}
|
|
6676
|
+
);
|
|
6677
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6678
|
+
else
|
|
6679
|
+
console.log(
|
|
6680
|
+
`${detail.id}: ${detail.status}${detail.stopReason ? ` (${detail.stopReason})` : ""}`
|
|
6681
|
+
);
|
|
6682
|
+
});
|
|
6683
|
+
}
|
|
6684
|
+
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) => {
|
|
6685
|
+
const org = resolveOrg(cmd);
|
|
6686
|
+
const client = createClient();
|
|
6687
|
+
const intervalMs = Math.max(Number(opts.interval ?? 15) * 1e3, 2e3);
|
|
6688
|
+
let last = "";
|
|
6689
|
+
for (; ; ) {
|
|
6690
|
+
const detail = await client.get(itemPath2(org, id));
|
|
6691
|
+
const trials2 = detail.rounds.flatMap((round) => round.trials);
|
|
6692
|
+
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"}`;
|
|
6693
|
+
if (line !== last) {
|
|
6694
|
+
last = line;
|
|
6695
|
+
console.error(line);
|
|
6696
|
+
}
|
|
6697
|
+
if (TERMINAL2.has(detail.status)) {
|
|
6698
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6699
|
+
else printDetail3(detail);
|
|
6700
|
+
return;
|
|
6701
|
+
}
|
|
6702
|
+
await sleep3(intervalMs);
|
|
6703
|
+
}
|
|
6704
|
+
});
|
|
6705
|
+
const trials = group.command("trials").description("List, author, and run trials");
|
|
6706
|
+
trials.command("list <id>").description("Every trial of an optimization with score and verdict").action(async (id, _opts, cmd) => {
|
|
6707
|
+
const org = resolveOrg(cmd);
|
|
6708
|
+
const res = await createClient().get(
|
|
6709
|
+
`${itemPath2(org, id)}/trials`
|
|
6710
|
+
);
|
|
6711
|
+
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
6712
|
+
else printItems(res.items.map(trialRow), "table");
|
|
6713
|
+
});
|
|
6714
|
+
trials.command("add <id>").description(
|
|
6715
|
+
"Author a trial on a manual optimization and run it (spends credits)"
|
|
6716
|
+
).option(
|
|
6717
|
+
"--file <path>",
|
|
6718
|
+
"a proposal JSON: one {trial, files?} or the array `propose -o json` prints; '-' for stdin"
|
|
6719
|
+
).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(
|
|
6720
|
+
"--kind <kind>",
|
|
6721
|
+
"ADD_SKILL (default with --skill-version), EDIT_SKILL"
|
|
6722
|
+
).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(
|
|
6723
|
+
"--fork-boundary <seq>",
|
|
6724
|
+
"fork-at-fetch boundary from `gauge experiments boundaries`"
|
|
6725
|
+
).option(
|
|
6726
|
+
"--no-launch",
|
|
6727
|
+
"save the trial as a draft; run it with `trials run`"
|
|
6728
|
+
).option("--yes", "skip the confirmation").action(
|
|
6729
|
+
async (id, opts, cmd) => {
|
|
6730
|
+
const org = resolveOrg(cmd);
|
|
6731
|
+
const body = trialBodyFromOpts(opts);
|
|
6732
|
+
if (body.launch !== false)
|
|
6733
|
+
await confirmOrAbort(
|
|
6734
|
+
`Run trial "${body.trial.title}" on ${id} now? Spends credits.`,
|
|
6735
|
+
opts.yes
|
|
6736
|
+
);
|
|
6737
|
+
const result = await createClient().post(`${itemPath2(org, id)}/trials`, body);
|
|
6738
|
+
if (resolveOutput(cmd) === "json") printJson(result);
|
|
6739
|
+
else
|
|
6740
|
+
console.log(
|
|
6741
|
+
`${result.launch ? "Running" : "Saved"} ${result.trial.key} "${result.trial.title}"${result.launch ? ` \u2014 ${result.launch.runIds.length} session${result.launch.runIds.length === 1 ? "" : "s"}` : ""}`
|
|
6742
|
+
);
|
|
6743
|
+
}
|
|
6744
|
+
);
|
|
6745
|
+
trials.command("run <id> <trialId>").description("Run a draft trial now (spends credits)").option("--yes", "skip the confirmation").action(
|
|
6746
|
+
async (id, trialId, opts, cmd) => {
|
|
6747
|
+
const org = resolveOrg(cmd);
|
|
6748
|
+
await confirmOrAbort(
|
|
6749
|
+
`Run trial ${trialId} now? Spends credits.`,
|
|
6750
|
+
opts.yes
|
|
6751
|
+
);
|
|
6752
|
+
const result = await createClient().post(
|
|
6753
|
+
`${trialPath(org, id, trialId)}/launch`,
|
|
6754
|
+
{}
|
|
6755
|
+
);
|
|
6756
|
+
if (resolveOutput(cmd) === "json") printJson(result);
|
|
6757
|
+
else
|
|
6758
|
+
console.log(
|
|
6759
|
+
`Started ${result.runIds.length} session${result.runIds.length === 1 ? "" : "s"} for ${trialId}`
|
|
6760
|
+
);
|
|
6761
|
+
}
|
|
6762
|
+
);
|
|
6763
|
+
group.command("trial <id> <trialId>").description("One trial by id or key (B0, T1, \u2026) with its sessions").action(
|
|
6764
|
+
async (id, trialId, _opts, cmd) => {
|
|
6765
|
+
const org = resolveOrg(cmd);
|
|
6766
|
+
const trial = await createClient().get(
|
|
6767
|
+
trialPath(org, id, trialId)
|
|
6768
|
+
);
|
|
6769
|
+
if (resolveOutput(cmd) === "json") printJson(trial);
|
|
6770
|
+
else printTrial(trial);
|
|
6771
|
+
}
|
|
6772
|
+
);
|
|
6773
|
+
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(
|
|
6774
|
+
async (id, trialId, opts, cmd) => {
|
|
6775
|
+
const org = resolveOrg(cmd);
|
|
6776
|
+
const content = await createClient().get(
|
|
6777
|
+
`${trialPath(org, id, trialId)}/content`
|
|
6778
|
+
);
|
|
6779
|
+
if (resolveOutput(cmd) === "json") printJson(content);
|
|
6780
|
+
else if (opts.body) {
|
|
6781
|
+
if (content.copyableBody === null)
|
|
6782
|
+
throw new CliError(
|
|
6783
|
+
"usage",
|
|
6784
|
+
"this trial is not a docs rewrite; drop --body"
|
|
6785
|
+
);
|
|
6786
|
+
console.log(content.copyableBody);
|
|
6787
|
+
} else printChange(content);
|
|
6788
|
+
}
|
|
6789
|
+
);
|
|
6790
|
+
group.command("adopt <id> <trialId>").description(
|
|
6791
|
+
"Make a settled BETTER trial the moving baseline (the eval itself is unchanged)"
|
|
6792
|
+
).action(
|
|
6793
|
+
async (id, trialId, _opts, cmd) => {
|
|
6794
|
+
const org = resolveOrg(cmd);
|
|
6795
|
+
const detail = await createClient().post(
|
|
6796
|
+
`${trialPath(org, id, trialId)}/adopt`,
|
|
6797
|
+
{}
|
|
6798
|
+
);
|
|
6799
|
+
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
6800
|
+
else
|
|
6801
|
+
console.log(
|
|
6802
|
+
`Adopted ${trialId}; baseline is now ${pct(detail.after)}`
|
|
6803
|
+
);
|
|
6804
|
+
}
|
|
6805
|
+
);
|
|
6806
|
+
group.command("propose <id>").description(
|
|
6807
|
+
"Ask Gauge's proposer for one to three trial drafts (nothing runs; feed one to `trials add --file`)"
|
|
6808
|
+
).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(
|
|
6809
|
+
async (id, opts, cmd) => {
|
|
6810
|
+
const org = resolveOrg(cmd);
|
|
6811
|
+
const res = await createClient().post(
|
|
6812
|
+
`${itemPath2(org, id)}/propose`,
|
|
6813
|
+
{
|
|
6814
|
+
request: opts.request,
|
|
6815
|
+
lever: opts.lever?.toUpperCase(),
|
|
6816
|
+
kind: opts.kind?.toUpperCase(),
|
|
6817
|
+
targetVersionId: opts.targetVersion
|
|
6818
|
+
}
|
|
6819
|
+
);
|
|
6820
|
+
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
6821
|
+
else {
|
|
6822
|
+
for (const [index, proposal] of res.items.entries()) {
|
|
6823
|
+
console.log(
|
|
6824
|
+
`[${index + 1}] ${proposal.trial.title} \u2014 ${proposal.trial.intervention.kind} on ${proposal.trial.lever}`
|
|
6825
|
+
);
|
|
6826
|
+
if (proposal.trial.hypothesis)
|
|
6827
|
+
console.log(` ${proposal.trial.hypothesis}`);
|
|
6828
|
+
}
|
|
6829
|
+
console.error(
|
|
6830
|
+
"Save them with `-o json > proposals.json`, then `gauge optimizations trials add <id> --file proposals.json --pick <n>`."
|
|
6831
|
+
);
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6834
|
+
);
|
|
6835
|
+
group.command("skill-files <versionId>").description(
|
|
6836
|
+
"The text files of a skill version, the base an EDIT_SKILL trial edits"
|
|
6837
|
+
).action(async (versionId, _opts, cmd) => {
|
|
6838
|
+
const org = resolveOrg(cmd);
|
|
6839
|
+
const res = await createClient().get(
|
|
6840
|
+
`${basePath(org)}/skill-versions/${encodeURIComponent(versionId)}`
|
|
6841
|
+
);
|
|
6842
|
+
if (resolveOutput(cmd) === "json") printJson(res);
|
|
6843
|
+
else
|
|
6844
|
+
for (const file of res.files) {
|
|
6845
|
+
console.log(`=== ${file.path}`);
|
|
6846
|
+
console.log(file.body);
|
|
6847
|
+
}
|
|
6848
|
+
});
|
|
6849
|
+
group.command("page <id>").description(
|
|
6850
|
+
"The baseline body of a docs page, the base a REWRITE_DOCS trial edits"
|
|
6851
|
+
).requiredOption("--url <url>", "the page URL").action(async (id, opts, cmd) => {
|
|
6852
|
+
const org = resolveOrg(cmd);
|
|
6853
|
+
const res = await createClient().get(
|
|
6854
|
+
`${itemPath2(org, id)}/page`,
|
|
6855
|
+
{ url: opts.url }
|
|
6856
|
+
);
|
|
6857
|
+
if (resolveOutput(cmd) === "json") printJson(res);
|
|
6858
|
+
else console.log(res.body);
|
|
6859
|
+
});
|
|
6860
|
+
}
|
|
6861
|
+
|
|
5592
6862
|
// src/commands/org.ts
|
|
5593
6863
|
var org_exports = {};
|
|
5594
6864
|
__export(org_exports, {
|
|
5595
|
-
register: () =>
|
|
6865
|
+
register: () => register18
|
|
5596
6866
|
});
|
|
5597
6867
|
function printSettings(s) {
|
|
5598
6868
|
console.log(`slug: ${s.slug}`);
|
|
@@ -5606,7 +6876,7 @@ function printSettings(s) {
|
|
|
5606
6876
|
);
|
|
5607
6877
|
console.log(`auto-join: ${s.autoJoinDomain ?? "off"}`);
|
|
5608
6878
|
}
|
|
5609
|
-
function
|
|
6879
|
+
function register18(program2) {
|
|
5610
6880
|
const group = program2.command("org").description(
|
|
5611
6881
|
"This org's settings, read-only (see `gauge orgs` for the org list)"
|
|
5612
6882
|
);
|
|
@@ -5623,12 +6893,12 @@ function register16(program2) {
|
|
|
5623
6893
|
// src/commands/orgs.ts
|
|
5624
6894
|
var orgs_exports2 = {};
|
|
5625
6895
|
__export(orgs_exports2, {
|
|
5626
|
-
register: () =>
|
|
6896
|
+
register: () => register19
|
|
5627
6897
|
});
|
|
5628
6898
|
function isDefault(org, defaultOrg) {
|
|
5629
6899
|
return defaultOrg !== void 0 && (org.slug === defaultOrg || org.publicId === defaultOrg);
|
|
5630
6900
|
}
|
|
5631
|
-
function
|
|
6901
|
+
function register19(program2) {
|
|
5632
6902
|
const orgs = program2.command("orgs").description("Organizations");
|
|
5633
6903
|
orgs.command("list").description("List orgs you belong to").action(async (_opts, command) => {
|
|
5634
6904
|
const output = resolveOutput(command);
|
|
@@ -5699,12 +6969,12 @@ function register17(program2) {
|
|
|
5699
6969
|
// src/commands/personas.ts
|
|
5700
6970
|
var personas_exports2 = {};
|
|
5701
6971
|
__export(personas_exports2, {
|
|
5702
|
-
register: () =>
|
|
6972
|
+
register: () => register20
|
|
5703
6973
|
});
|
|
5704
6974
|
function personasPath(org) {
|
|
5705
6975
|
return `/api/v1/orgs/${encodeURIComponent(org)}/personas`;
|
|
5706
6976
|
}
|
|
5707
|
-
function
|
|
6977
|
+
function register20(program2) {
|
|
5708
6978
|
const group = program2.command("personas").description("Manage simulated-user personas for eval and visibility runs");
|
|
5709
6979
|
group.command("list").description("List the org's personas").action(async (_opts, cmd) => {
|
|
5710
6980
|
const org = resolveOrg(cmd);
|
|
@@ -5777,7 +7047,7 @@ function register18(program2) {
|
|
|
5777
7047
|
// src/commands/query.ts
|
|
5778
7048
|
var query_exports2 = {};
|
|
5779
7049
|
__export(query_exports2, {
|
|
5780
|
-
register: () =>
|
|
7050
|
+
register: () => register21
|
|
5781
7051
|
});
|
|
5782
7052
|
var collect3 = (value, prev = []) => [
|
|
5783
7053
|
...prev,
|
|
@@ -5882,7 +7152,7 @@ async function buildSpec(opts) {
|
|
|
5882
7152
|
}
|
|
5883
7153
|
return spec;
|
|
5884
7154
|
}
|
|
5885
|
-
var
|
|
7155
|
+
var pct2 = (n) => `${(n * 100).toFixed(1)}%`;
|
|
5886
7156
|
function noteFreshness(f) {
|
|
5887
7157
|
if (!f.available) {
|
|
5888
7158
|
console.error(
|
|
@@ -5916,7 +7186,7 @@ ${res.sql}
|
|
|
5916
7186
|
const out = {};
|
|
5917
7187
|
for (const col of res.columns) {
|
|
5918
7188
|
const v = row[col.key];
|
|
5919
|
-
out[col.key] = rateKeys.has(col.key) && typeof v === "number" ?
|
|
7189
|
+
out[col.key] = rateKeys.has(col.key) && typeof v === "number" ? pct2(v) : v;
|
|
5920
7190
|
}
|
|
5921
7191
|
return out;
|
|
5922
7192
|
});
|
|
@@ -5969,7 +7239,7 @@ async function showMetadata(command, mode, dataset) {
|
|
|
5969
7239
|
console.error(`dataset: ${ds.name} \u2014 ${ds.grain}`);
|
|
5970
7240
|
printItems(rows, "table");
|
|
5971
7241
|
}
|
|
5972
|
-
function
|
|
7242
|
+
function register21(program2) {
|
|
5973
7243
|
const group = program2.command("query").description(
|
|
5974
7244
|
"Flexible reports over your event warehouse (run a report, or discover the catalog)"
|
|
5975
7245
|
);
|
|
@@ -6005,7 +7275,7 @@ function register19(program2) {
|
|
|
6005
7275
|
// src/commands/repos.ts
|
|
6006
7276
|
var repos_exports2 = {};
|
|
6007
7277
|
__export(repos_exports2, {
|
|
6008
|
-
register: () =>
|
|
7278
|
+
register: () => register22
|
|
6009
7279
|
});
|
|
6010
7280
|
function reposPath(org) {
|
|
6011
7281
|
return `/api/v1/orgs/${encodeURIComponent(org)}/repos`;
|
|
@@ -6013,7 +7283,7 @@ function reposPath(org) {
|
|
|
6013
7283
|
async function fetchAllRepos(client, org) {
|
|
6014
7284
|
return fetchAllPages(client, reposPath(org));
|
|
6015
7285
|
}
|
|
6016
|
-
function
|
|
7286
|
+
function toRow5(repo) {
|
|
6017
7287
|
return {
|
|
6018
7288
|
name: repo.name,
|
|
6019
7289
|
url: repo.url,
|
|
@@ -6028,7 +7298,7 @@ function toRow4(repo) {
|
|
|
6028
7298
|
function syncWarning(repo) {
|
|
6029
7299
|
return `warning: GitHub metadata sync failed; retry with \`gauge repos resync ${repo.url}\``;
|
|
6030
7300
|
}
|
|
6031
|
-
function
|
|
7301
|
+
function register22(program2) {
|
|
6032
7302
|
const repos = program2.command("repos").description("Manage repositories");
|
|
6033
7303
|
repos.command("list").description("List repositories (yours + read-only Gauge-provided ones)").action(async (_opts, command) => {
|
|
6034
7304
|
const org = resolveOrg(command);
|
|
@@ -6038,7 +7308,7 @@ function register20(program2) {
|
|
|
6038
7308
|
printJson(items);
|
|
6039
7309
|
return;
|
|
6040
7310
|
}
|
|
6041
|
-
printItems(items.map(
|
|
7311
|
+
printItems(items.map(toRow5), "table");
|
|
6042
7312
|
});
|
|
6043
7313
|
repos.command("add <url>").description("Add a repository (pulls languages/size/stars from GitHub)").option(
|
|
6044
7314
|
"--ref <ref>",
|
|
@@ -6125,7 +7395,7 @@ function register20(program2) {
|
|
|
6125
7395
|
// src/commands/runs.ts
|
|
6126
7396
|
var runs_exports2 = {};
|
|
6127
7397
|
__export(runs_exports2, {
|
|
6128
|
-
register: () =>
|
|
7398
|
+
register: () => register23
|
|
6129
7399
|
});
|
|
6130
7400
|
function runPath(id) {
|
|
6131
7401
|
return `/api/v1/runs/${encodeURIComponent(id)}`;
|
|
@@ -6146,7 +7416,7 @@ function compact(value, max = 140) {
|
|
|
6146
7416
|
const one = s.replace(/\s+/g, " ").trim();
|
|
6147
7417
|
return one.length > max ? `${one.slice(0, max - 1)}\u2026` : one;
|
|
6148
7418
|
}
|
|
6149
|
-
function
|
|
7419
|
+
function toRow6(run) {
|
|
6150
7420
|
const selected = run.selectedProvider?.slug ?? "";
|
|
6151
7421
|
const observed = run.observedProvider?.slug;
|
|
6152
7422
|
return {
|
|
@@ -6385,7 +7655,7 @@ async function streamRun(id, json, opts) {
|
|
|
6385
7655
|
if (drainTimer) clearTimeout(drainTimer);
|
|
6386
7656
|
}
|
|
6387
7657
|
}
|
|
6388
|
-
function
|
|
7658
|
+
function register23(program2) {
|
|
6389
7659
|
const runs = program2.command("runs").description("Inspect and manage runs");
|
|
6390
7660
|
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
7661
|
async (opts, command) => {
|
|
@@ -6408,7 +7678,7 @@ function register21(program2) {
|
|
|
6408
7678
|
printJson(page);
|
|
6409
7679
|
return;
|
|
6410
7680
|
}
|
|
6411
|
-
printItems(page.items.map(
|
|
7681
|
+
printItems(page.items.map(toRow6), "table");
|
|
6412
7682
|
if (page.nextCursor) {
|
|
6413
7683
|
console.error(
|
|
6414
7684
|
`(more results \u2014 rerun with --cursor ${page.nextCursor})`
|
|
@@ -6509,7 +7779,7 @@ function register21(program2) {
|
|
|
6509
7779
|
var skills_exports2 = {};
|
|
6510
7780
|
__export(skills_exports2, {
|
|
6511
7781
|
buildSkillEditBody: () => buildSkillEditBody,
|
|
6512
|
-
register: () =>
|
|
7782
|
+
register: () => register24
|
|
6513
7783
|
});
|
|
6514
7784
|
function skillsPath(org) {
|
|
6515
7785
|
return `/api/v1/orgs/${encodeURIComponent(org)}/skills`;
|
|
@@ -6571,7 +7841,7 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
|
6571
7841
|
throw new CliError("usage", "nothing to change");
|
|
6572
7842
|
return body;
|
|
6573
7843
|
}
|
|
6574
|
-
function
|
|
7844
|
+
function register24(program2) {
|
|
6575
7845
|
const group = program2.command("skills").description("Manage agent skills used by eval and visibility runs");
|
|
6576
7846
|
group.command("list").description("List the org's skills with their newest version").action(async (_opts, cmd) => {
|
|
6577
7847
|
const org = resolveOrg(cmd);
|
|
@@ -6593,21 +7863,21 @@ function register22(program2) {
|
|
|
6593
7863
|
});
|
|
6594
7864
|
group.command("get <ref>").description("Show one skill: source, note, every version").action(async (ref, _opts, cmd) => {
|
|
6595
7865
|
const org = resolveOrg(cmd);
|
|
6596
|
-
const
|
|
7866
|
+
const skill2 = await createClient().get(
|
|
6597
7867
|
skillPath(org, ref)
|
|
6598
7868
|
);
|
|
6599
7869
|
if (resolveOutput(cmd) === "json") {
|
|
6600
|
-
printJson(
|
|
7870
|
+
printJson(skill2);
|
|
6601
7871
|
return;
|
|
6602
7872
|
}
|
|
6603
|
-
console.log(`name: ${
|
|
6604
|
-
console.log(`id: ${
|
|
6605
|
-
console.log(`note: ${
|
|
6606
|
-
console.log(`source: ${sourceLabel(
|
|
7873
|
+
console.log(`name: ${skill2.name}`);
|
|
7874
|
+
console.log(`id: ${skill2.id}`);
|
|
7875
|
+
console.log(`note: ${skill2.note ?? "(none)"}`);
|
|
7876
|
+
console.log(`source: ${sourceLabel(skill2.source) || "(untracked)"}`);
|
|
6607
7877
|
console.log("versions:");
|
|
6608
|
-
for (const v of
|
|
7878
|
+
for (const v of skill2.versions)
|
|
6609
7879
|
console.log(
|
|
6610
|
-
` ${
|
|
7880
|
+
` ${skill2.name}@${v.label} ${v.contentDigest.slice(0, 19)} ${v.createdAt}`
|
|
6611
7881
|
);
|
|
6612
7882
|
});
|
|
6613
7883
|
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 +7922,8 @@ function register22(program2) {
|
|
|
6652
7922
|
const org = resolveOrg(cmd);
|
|
6653
7923
|
const client = createClient();
|
|
6654
7924
|
const body = await buildSkillEditBody(opts, async () => {
|
|
6655
|
-
const
|
|
6656
|
-
return
|
|
7925
|
+
const skill2 = await client.get(skillPath(org, ref));
|
|
7926
|
+
return skill2.source;
|
|
6657
7927
|
});
|
|
6658
7928
|
const updated = await client.patch(
|
|
6659
7929
|
skillPath(org, ref),
|
|
@@ -6712,7 +7982,7 @@ function register22(program2) {
|
|
|
6712
7982
|
// src/commands/stats.ts
|
|
6713
7983
|
var stats_exports2 = {};
|
|
6714
7984
|
__export(stats_exports2, {
|
|
6715
|
-
register: () =>
|
|
7985
|
+
register: () => register25
|
|
6716
7986
|
});
|
|
6717
7987
|
function addFilterOptions(cmd) {
|
|
6718
7988
|
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 +8002,7 @@ function filterQuery(opts) {
|
|
|
6732
8002
|
limit: opts.full ? "1000" : opts.limit
|
|
6733
8003
|
};
|
|
6734
8004
|
}
|
|
6735
|
-
var
|
|
8005
|
+
var pct3 = (rate) => `${(rate * 100).toFixed(1)}%`;
|
|
6736
8006
|
var delta = (d) => d === null || d === 0 ? "\u2014" : d > 0 ? `+${d}` : String(d);
|
|
6737
8007
|
function noteFreshness2(f) {
|
|
6738
8008
|
if (!f.available) {
|
|
@@ -6745,7 +8015,7 @@ function noteFreshness2(f) {
|
|
|
6745
8015
|
);
|
|
6746
8016
|
}
|
|
6747
8017
|
}
|
|
6748
|
-
async function runStats(command, resource, opts,
|
|
8018
|
+
async function runStats(command, resource, opts, toRow8) {
|
|
6749
8019
|
const org = resolveOrg(command);
|
|
6750
8020
|
const output = resolveOutput(command);
|
|
6751
8021
|
const res = await createClient().get(
|
|
@@ -6756,7 +8026,7 @@ async function runStats(command, resource, opts, toRow7) {
|
|
|
6756
8026
|
printJson(res);
|
|
6757
8027
|
return;
|
|
6758
8028
|
}
|
|
6759
|
-
printItems(res.items.map(
|
|
8029
|
+
printItems(res.items.map(toRow8), "table");
|
|
6760
8030
|
noteFreshness2(res.freshness);
|
|
6761
8031
|
}
|
|
6762
8032
|
var rankingRow = (r) => ({
|
|
@@ -6764,8 +8034,8 @@ var rankingRow = (r) => ({
|
|
|
6764
8034
|
brand: r.brandName,
|
|
6765
8035
|
kind: r.kind,
|
|
6766
8036
|
installs: r.installs,
|
|
6767
|
-
"install%":
|
|
6768
|
-
"mention%":
|
|
8037
|
+
"install%": pct3(r.installRate),
|
|
8038
|
+
"mention%": pct3(r.mentionRate),
|
|
6769
8039
|
delta: delta(r.deltaRank)
|
|
6770
8040
|
});
|
|
6771
8041
|
var packageRow = (r) => ({
|
|
@@ -6774,28 +8044,28 @@ var packageRow = (r) => ({
|
|
|
6774
8044
|
brand: r.brandName,
|
|
6775
8045
|
kind: r.kind,
|
|
6776
8046
|
installs: r.installs,
|
|
6777
|
-
rate:
|
|
8047
|
+
rate: pct3(r.rate)
|
|
6778
8048
|
});
|
|
6779
8049
|
var brandRow = (r) => ({
|
|
6780
8050
|
brand: r.brandName,
|
|
6781
8051
|
kind: r.kind,
|
|
6782
8052
|
installs: r.installs,
|
|
6783
|
-
rate:
|
|
8053
|
+
rate: pct3(r.rate)
|
|
6784
8054
|
});
|
|
6785
8055
|
var funnelRow = (r) => ({
|
|
6786
8056
|
brand: r.brandName,
|
|
6787
8057
|
kind: r.kind,
|
|
6788
|
-
"mention%":
|
|
6789
|
-
"install%":
|
|
8058
|
+
"mention%": pct3(r.mentionRate),
|
|
8059
|
+
"install%": pct3(r.installRate)
|
|
6790
8060
|
});
|
|
6791
8061
|
var domainRow = (r) => ({
|
|
6792
8062
|
domain: r.domain,
|
|
6793
8063
|
brand: r.brandName,
|
|
6794
8064
|
runs: r.runs,
|
|
6795
|
-
rate:
|
|
8065
|
+
rate: pct3(r.rate),
|
|
6796
8066
|
requests: r.requests
|
|
6797
8067
|
});
|
|
6798
|
-
function
|
|
8068
|
+
function register25(program2) {
|
|
6799
8069
|
const group = program2.command("stats").description("Read-only analytics over your runs");
|
|
6800
8070
|
addFilterOptions(
|
|
6801
8071
|
group.command("rankings").description("Brands ranked by install rate")
|
|
@@ -6827,9 +8097,9 @@ function register23(program2) {
|
|
|
6827
8097
|
// src/commands/status.ts
|
|
6828
8098
|
var status_exports = {};
|
|
6829
8099
|
__export(status_exports, {
|
|
6830
|
-
register: () =>
|
|
8100
|
+
register: () => register26
|
|
6831
8101
|
});
|
|
6832
|
-
function
|
|
8102
|
+
function pct4(rate) {
|
|
6833
8103
|
return rate == null ? "\u2014" : `${Math.round(rate * 100)}%`;
|
|
6834
8104
|
}
|
|
6835
8105
|
function delta2(pp) {
|
|
@@ -6837,7 +8107,7 @@ function delta2(pp) {
|
|
|
6837
8107
|
const rounded = Math.round(pp);
|
|
6838
8108
|
return rounded === 0 ? "" : ` (${rounded > 0 ? "+" : ""}${rounded}pp)`;
|
|
6839
8109
|
}
|
|
6840
|
-
function
|
|
8110
|
+
function register26(program2) {
|
|
6841
8111
|
program2.command("status").description("One-shot org summary: actions, visibility, agent experience").action(async (_opts, cmd) => {
|
|
6842
8112
|
const org = resolveOrg(cmd);
|
|
6843
8113
|
const s = await createClient().get(
|
|
@@ -6862,7 +8132,7 @@ function register24(program2) {
|
|
|
6862
8132
|
} else {
|
|
6863
8133
|
for (const card of s.agentExperience.data.cards) {
|
|
6864
8134
|
console.log(
|
|
6865
|
-
` ${card.name}: ${
|
|
8135
|
+
` ${card.name}: ${pct4(card.passRate)}${delta2(card.deltaPP)} over ${card.judgedRuns} judged run(s)`
|
|
6866
8136
|
);
|
|
6867
8137
|
}
|
|
6868
8138
|
const extra = s.agentExperience.data.setCount - s.agentExperience.data.cards.length;
|
|
@@ -6875,7 +8145,7 @@ function register24(program2) {
|
|
|
6875
8145
|
console.log(" (no visibility runs in the last 30 days)");
|
|
6876
8146
|
} else {
|
|
6877
8147
|
for (const card of s.visibility.data.cards) {
|
|
6878
|
-
const owned = card.owned ? `${card.owned.name} #${card.owned.rank}, chosen ${
|
|
8148
|
+
const owned = card.owned ? `${card.owned.name} #${card.owned.rank}, chosen ${pct4(card.owned.chosenRate)}${delta2(card.chosenDeltaPP)}` : "no owned brand ranked";
|
|
6879
8149
|
console.log(` ${card.name}: ${owned}`);
|
|
6880
8150
|
}
|
|
6881
8151
|
}
|
|
@@ -6899,12 +8169,12 @@ function register24(program2) {
|
|
|
6899
8169
|
// src/commands/tags.ts
|
|
6900
8170
|
var tags_exports2 = {};
|
|
6901
8171
|
__export(tags_exports2, {
|
|
6902
|
-
register: () =>
|
|
8172
|
+
register: () => register27
|
|
6903
8173
|
});
|
|
6904
8174
|
function tagsPath(org) {
|
|
6905
8175
|
return `/api/v1/orgs/${encodeURIComponent(org)}/tags`;
|
|
6906
8176
|
}
|
|
6907
|
-
function
|
|
8177
|
+
function register27(program2) {
|
|
6908
8178
|
const group = program2.command("tags").description("Manage org tags");
|
|
6909
8179
|
group.command("list").description("List tags").action(async (_opts, cmd) => {
|
|
6910
8180
|
const org = resolveOrg(cmd);
|
|
@@ -6947,9 +8217,9 @@ function register25(program2) {
|
|
|
6947
8217
|
// src/commands/usage.ts
|
|
6948
8218
|
var usage_exports = {};
|
|
6949
8219
|
__export(usage_exports, {
|
|
6950
|
-
register: () =>
|
|
8220
|
+
register: () => register28
|
|
6951
8221
|
});
|
|
6952
|
-
function
|
|
8222
|
+
function register28(program2) {
|
|
6953
8223
|
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
8224
|
async (opts, cmd) => {
|
|
6955
8225
|
const org = resolveOrg(cmd);
|
|
@@ -6996,7 +8266,7 @@ function register26(program2) {
|
|
|
6996
8266
|
// src/commands/visibility.ts
|
|
6997
8267
|
var visibility_exports2 = {};
|
|
6998
8268
|
__export(visibility_exports2, {
|
|
6999
|
-
register: () =>
|
|
8269
|
+
register: () => register29,
|
|
7000
8270
|
visibilityPath: () => visibilityPath
|
|
7001
8271
|
});
|
|
7002
8272
|
function visibilityPath(org) {
|
|
@@ -7027,7 +8297,7 @@ function brandsLabel(v) {
|
|
|
7027
8297
|
if (v.kind === "HEAD_TO_HEAD") return `${v.brandA} vs ${v.brandB}`;
|
|
7028
8298
|
return v.branded ? v.brandA ?? "branded" : "organic";
|
|
7029
8299
|
}
|
|
7030
|
-
function
|
|
8300
|
+
function toRow7(v) {
|
|
7031
8301
|
return {
|
|
7032
8302
|
id: v.id,
|
|
7033
8303
|
name: v.name,
|
|
@@ -7039,7 +8309,7 @@ function toRow6(v) {
|
|
|
7039
8309
|
"last run": v.lastRunAt ?? "-"
|
|
7040
8310
|
};
|
|
7041
8311
|
}
|
|
7042
|
-
function
|
|
8312
|
+
function printDetail4(v) {
|
|
7043
8313
|
console.log(`id: ${v.id}`);
|
|
7044
8314
|
console.log(`name: ${v.name}`);
|
|
7045
8315
|
console.log(`kind: ${v.kind}`);
|
|
@@ -7074,7 +8344,7 @@ function registerPreferenceGroup(group) {
|
|
|
7074
8344
|
visibilityPath(org)
|
|
7075
8345
|
);
|
|
7076
8346
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
7077
|
-
else printItems(res.items.map(
|
|
8347
|
+
else printItems(res.items.map(toRow7), "table");
|
|
7078
8348
|
});
|
|
7079
8349
|
group.command("get <id>").description("Show one preference prompt").action(async (id, _opts, cmd) => {
|
|
7080
8350
|
const org = resolveOrg(cmd);
|
|
@@ -7082,7 +8352,7 @@ function registerPreferenceGroup(group) {
|
|
|
7082
8352
|
`${visibilityPath(org)}/${encodeURIComponent(id)}`
|
|
7083
8353
|
);
|
|
7084
8354
|
if (resolveOutput(cmd) === "json") printJson(vp);
|
|
7085
|
-
else
|
|
8355
|
+
else printDetail4(vp);
|
|
7086
8356
|
});
|
|
7087
8357
|
addRunSettingsCreateOptions(
|
|
7088
8358
|
group.command("create").description(
|
|
@@ -7345,7 +8615,7 @@ function registerPreferenceGroup(group) {
|
|
|
7345
8615
|
);
|
|
7346
8616
|
});
|
|
7347
8617
|
}
|
|
7348
|
-
function
|
|
8618
|
+
function register29(program2) {
|
|
7349
8619
|
const preference = program2.command("preference").description("Manage Agent Preference prompts and measured markets");
|
|
7350
8620
|
registerPreferenceGroup(preference);
|
|
7351
8621
|
const legacy = program2.command("visibility", { hidden: true });
|
|
@@ -7375,8 +8645,10 @@ for (const group of [
|
|
|
7375
8645
|
personas_exports2,
|
|
7376
8646
|
skills_exports2,
|
|
7377
8647
|
mcp_exports2,
|
|
8648
|
+
connections_exports2,
|
|
7378
8649
|
repos_exports2,
|
|
7379
8650
|
runs_exports2,
|
|
8651
|
+
optimizations_exports2,
|
|
7380
8652
|
experiments_exports2,
|
|
7381
8653
|
apply_exports,
|
|
7382
8654
|
batches_exports,
|