@withgauge/cli 0.16.0 → 0.17.1
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 +49 -8
- package/dist/index.js +1655 -1623
- package/package.json +2 -4
- package/scripts/install-skill.mjs +0 -64
package/dist/index.js
CHANGED
|
@@ -824,40 +824,40 @@ var catalogManifestSchema = z9.object({
|
|
|
824
824
|
const cells = /* @__PURE__ */ new Set();
|
|
825
825
|
for (const model of manifest.models) {
|
|
826
826
|
for (const harness of model.harnesses) {
|
|
827
|
-
const
|
|
828
|
-
if (cells.has(
|
|
829
|
-
ctx.addIssue({ code: "custom", message: `Duplicate cell ${
|
|
830
|
-
cells.add(
|
|
827
|
+
const id2 = `${model.slug}:${harness.slug}`;
|
|
828
|
+
if (cells.has(id2))
|
|
829
|
+
ctx.addIssue({ code: "custom", message: `Duplicate cell ${id2}` });
|
|
830
|
+
cells.add(id2);
|
|
831
831
|
const protocol = harness.slug === "claude-code" ? "ANTHROPIC_MESSAGES" : harness.slug === "codex" ? "OPENAI_RESPONSES" : "OPENAI_CHAT_COMPLETIONS";
|
|
832
832
|
if (model.protocol !== protocol)
|
|
833
833
|
ctx.addIssue({
|
|
834
834
|
code: "custom",
|
|
835
|
-
message: `Unsupported harness protocol for ${
|
|
835
|
+
message: `Unsupported harness protocol for ${id2}: expected ${protocol}`
|
|
836
836
|
});
|
|
837
837
|
if ((harness.contextWindowTokens ?? model.contextWindowTokens) > model.contextWindowTokens)
|
|
838
838
|
ctx.addIssue({
|
|
839
839
|
code: "custom",
|
|
840
|
-
message: `Harness context exceeds deployment for ${
|
|
840
|
+
message: `Harness context exceeds deployment for ${id2}`
|
|
841
841
|
});
|
|
842
842
|
if (model.maxOutputTokens !== null && harness.maxOutputTokens != null && harness.maxOutputTokens > model.maxOutputTokens)
|
|
843
843
|
ctx.addIssue({
|
|
844
844
|
code: "custom",
|
|
845
|
-
message: `Harness output exceeds deployment for ${
|
|
845
|
+
message: `Harness output exceeds deployment for ${id2}`
|
|
846
846
|
});
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
const releases = /* @__PURE__ */ new Set();
|
|
850
850
|
for (const release of manifest.releases) {
|
|
851
|
-
const
|
|
852
|
-
if (releases.has(
|
|
853
|
-
ctx.addIssue({ code: "custom", message: `Duplicate release ${
|
|
854
|
-
releases.add(
|
|
851
|
+
const id2 = `${release.harness}:${release.releaseVersion}`;
|
|
852
|
+
if (releases.has(id2))
|
|
853
|
+
ctx.addIssue({ code: "custom", message: `Duplicate release ${id2}` });
|
|
854
|
+
releases.add(id2);
|
|
855
855
|
if (!manifest.models.some(
|
|
856
856
|
(m) => m.harnesses.some(
|
|
857
857
|
(h) => h.slug === release.harness && h.releaseVersion === release.releaseVersion
|
|
858
858
|
)
|
|
859
859
|
))
|
|
860
|
-
ctx.addIssue({ code: "custom", message: `Unused release ${
|
|
860
|
+
ctx.addIssue({ code: "custom", message: `Unused release ${id2}` });
|
|
861
861
|
}
|
|
862
862
|
});
|
|
863
863
|
var catalogRequestSchema = z9.object({
|
|
@@ -1755,6 +1755,22 @@ var observedProviderSchema = z19.object({
|
|
|
1755
1755
|
slug: z19.string(),
|
|
1756
1756
|
source: observedProviderSourceSchema
|
|
1757
1757
|
});
|
|
1758
|
+
var RUN_TRIGGER_SOURCES = [
|
|
1759
|
+
"UNKNOWN",
|
|
1760
|
+
"UI",
|
|
1761
|
+
"API",
|
|
1762
|
+
"CADENCE",
|
|
1763
|
+
"STAFF",
|
|
1764
|
+
"OPERATOR",
|
|
1765
|
+
"GITHUB"
|
|
1766
|
+
];
|
|
1767
|
+
var runTriggerSourceSchema = z19.enum(RUN_TRIGGER_SOURCES);
|
|
1768
|
+
var runTriggeredBySchema = z19.object({
|
|
1769
|
+
source: runTriggerSourceSchema,
|
|
1770
|
+
userId: z19.string().nullable(),
|
|
1771
|
+
email: z19.string().nullable()
|
|
1772
|
+
});
|
|
1773
|
+
var runCreditsChargedSchema = z19.number().int().nullable();
|
|
1758
1774
|
var runStatusFilterSchema = z19.string().transform(
|
|
1759
1775
|
(raw) => raw.split(",").map((s) => s.trim().toUpperCase()).filter(Boolean)
|
|
1760
1776
|
).pipe(z19.array(runStatusSchema).min(1));
|
|
@@ -1791,6 +1807,8 @@ var runListItemSchema = z19.object({
|
|
|
1791
1807
|
evalSetId: z19.string().nullable(),
|
|
1792
1808
|
turns: z19.number().int().nullable(),
|
|
1793
1809
|
usdCost: z19.number().nullable(),
|
|
1810
|
+
creditsCharged: runCreditsChargedSchema.optional(),
|
|
1811
|
+
triggeredBy: runTriggeredBySchema.optional(),
|
|
1794
1812
|
durationMs: z19.number().int().nullable(),
|
|
1795
1813
|
exitReason: z19.string().nullable(),
|
|
1796
1814
|
createdAt: z19.string(),
|
|
@@ -2178,6 +2196,8 @@ var evalSetRunSchema = z22.object({
|
|
|
2178
2196
|
startedAt: z22.string().nullable(),
|
|
2179
2197
|
finishedAt: z22.string().nullable(),
|
|
2180
2198
|
failureReason: z22.string().nullable(),
|
|
2199
|
+
creditsCharged: runCreditsChargedSchema.optional(),
|
|
2200
|
+
triggeredBy: runTriggeredBySchema.optional(),
|
|
2181
2201
|
judge: z22.object({ status: z22.string(), error: z22.string().nullable() }).nullable(),
|
|
2182
2202
|
criterionResults: z22.array(
|
|
2183
2203
|
z22.object({
|
|
@@ -2188,9 +2208,7 @@ var evalSetRunSchema = z22.object({
|
|
|
2188
2208
|
})
|
|
2189
2209
|
)
|
|
2190
2210
|
});
|
|
2191
|
-
var listEvalSetRunsResponseSchema =
|
|
2192
|
-
items: z22.array(evalSetRunSchema)
|
|
2193
|
-
});
|
|
2211
|
+
var listEvalSetRunsResponseSchema = listResponseSchema(evalSetRunSchema);
|
|
2194
2212
|
|
|
2195
2213
|
// ../packages/api-schemas/src/executionTargets.ts
|
|
2196
2214
|
import { z as z23 } from "zod";
|
|
@@ -2572,578 +2590,468 @@ var meResponseSchema = z28.object({
|
|
|
2572
2590
|
});
|
|
2573
2591
|
|
|
2574
2592
|
// ../packages/api-schemas/src/optimizations.ts
|
|
2575
|
-
import { z as
|
|
2593
|
+
import { z as z33 } from "zod";
|
|
2576
2594
|
|
|
2577
|
-
// ../packages/api-schemas/src/cli-
|
|
2595
|
+
// ../packages/api-schemas/src/cli-rule-evidence.ts
|
|
2578
2596
|
import { z as z29 } from "zod";
|
|
2579
|
-
var
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
),
|
|
2587
|
-
"Use a workspace-relative path without traversal"
|
|
2588
|
-
);
|
|
2589
|
-
var sourcedValue = z29.discriminatedUnion("source", [
|
|
2590
|
-
z29.object({ source: z29.literal("literal"), value: z29.string().max(8192) }).strict(),
|
|
2591
|
-
z29.object({ source: z29.literal("localFact"), key: envKey }).strict()
|
|
2592
|
-
]);
|
|
2593
|
-
var cliLaunchFormSchema = z29.enum([
|
|
2594
|
-
"native",
|
|
2595
|
-
"path",
|
|
2596
|
-
"symlink",
|
|
2597
|
-
"shebang",
|
|
2598
|
-
"node-script",
|
|
2599
|
-
"python-script",
|
|
2600
|
-
"python-module",
|
|
2601
|
-
"execveat-path",
|
|
2602
|
-
"execveat-fd"
|
|
2603
|
-
]);
|
|
2604
|
-
var cliObservationReasonSchema = z29.enum([
|
|
2605
|
-
"eligible",
|
|
2606
|
-
"other-target",
|
|
2607
|
-
"other-command",
|
|
2608
|
-
"selector-mismatch",
|
|
2609
|
-
"unknown-command",
|
|
2610
|
-
"identity-unresolved",
|
|
2611
|
-
"artifact-mismatch",
|
|
2612
|
-
"runtime-mismatch",
|
|
2613
|
-
"launch-form",
|
|
2614
|
-
"io-profile",
|
|
2615
|
-
"operation-profile",
|
|
2616
|
-
"descriptor-lifetime"
|
|
2617
|
-
]);
|
|
2618
|
-
var cliIoProfileSchema = z29.enum([
|
|
2619
|
-
"pipes",
|
|
2620
|
-
"redirected",
|
|
2621
|
-
"shared-descriptor",
|
|
2622
|
-
"pty"
|
|
2623
|
-
]);
|
|
2624
|
-
var cliObservationSchema = z29.object({
|
|
2625
|
-
invocationId: z29.string().regex(/^[a-f0-9]{32}$/),
|
|
2626
|
-
targetId: token,
|
|
2627
|
-
commandId: token.nullable(),
|
|
2628
|
-
entrypointSha256: digest,
|
|
2629
|
-
runtimeSha256: digest.nullable(),
|
|
2630
|
-
launchForm: cliLaunchFormSchema.nullable(),
|
|
2631
|
-
ioProfile: cliIoProfileSchema.nullable(),
|
|
2632
|
-
reason: cliObservationReasonSchema
|
|
2633
|
-
});
|
|
2634
|
-
var cliCoverageSchema = z29.object({
|
|
2635
|
-
attempt: z29.number().int().nonnegative(),
|
|
2636
|
-
observedInvocationCount: z29.number().int().nonnegative().nullable(),
|
|
2637
|
-
invocationCount: z29.number().int().nonnegative(),
|
|
2638
|
-
appliedInvocationCount: z29.number().int().nonnegative(),
|
|
2639
|
-
incompleteCount: z29.number().int().nonnegative(),
|
|
2640
|
-
unsupportedCount: z29.number().int().nonnegative(),
|
|
2641
|
-
instrumentationFailed: z29.boolean(),
|
|
2642
|
-
observations: z29.array(cliObservationSchema),
|
|
2643
|
-
unsupportedDiagnostics: z29.array(z29.string())
|
|
2644
|
-
});
|
|
2645
|
-
var cliOperationKindSchema = z29.enum([
|
|
2646
|
-
"ensureOption",
|
|
2647
|
-
"replaceOption",
|
|
2648
|
-
"setEnv",
|
|
2649
|
-
"streamOutput",
|
|
2650
|
-
"completeOutput",
|
|
2651
|
-
"structuredStdin",
|
|
2652
|
-
"promptRecipe",
|
|
2653
|
-
"generatedFile"
|
|
2597
|
+
var cliRuleDeliverySchema = z29.enum([
|
|
2598
|
+
"applied",
|
|
2599
|
+
"matched_unchanged",
|
|
2600
|
+
"not_exercised",
|
|
2601
|
+
"failed",
|
|
2602
|
+
"partial",
|
|
2603
|
+
"unavailable"
|
|
2654
2604
|
]);
|
|
2655
|
-
var
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
var cliTargetSchema = z29.object({
|
|
2666
|
-
id: token,
|
|
2667
|
-
vendor: token,
|
|
2668
|
-
package: token,
|
|
2669
|
-
version: token.nullable(),
|
|
2670
|
-
/** Published artifact identity and exact executable/entrypoint identity. */
|
|
2671
|
-
artifactSha256: digest.nullable(),
|
|
2672
|
-
entrypointSha256: digest.nullable(),
|
|
2673
|
-
/** Trace-derived recognition hints. Actual bytes are captured by record mode. */
|
|
2674
|
-
discovery: z29.object({
|
|
2675
|
-
ecosystem: token.nullable(),
|
|
2676
|
-
program: token,
|
|
2677
|
-
executables: z29.array(token).max(20)
|
|
2678
|
-
}).strict().optional(),
|
|
2679
|
-
ownershipEvidence: z29.string().min(1).max(2048),
|
|
2680
|
-
entrypoints: z29.array(z29.string().min(1).max(1024)).max(20),
|
|
2681
|
-
/** Flags accepted before the subcommand, with explicit value arity. */
|
|
2682
|
-
globalOptions: z29.array(z29.object({ flag: optionFlag, takesValue: z29.boolean() }).strict()).max(100),
|
|
2683
|
-
launchForms: z29.array(cliLaunchFormSchema).min(1),
|
|
2684
|
-
ioProfiles: z29.array(cliIoProfileSchema).min(1),
|
|
2685
|
-
commands: z29.array(
|
|
2605
|
+
var cliRuleInvocationResultSchema = z29.object({
|
|
2606
|
+
invocationId: z29.string(),
|
|
2607
|
+
ruleId: z29.string(),
|
|
2608
|
+
engineSha256: z29.string(),
|
|
2609
|
+
entrypointSha256: z29.string(),
|
|
2610
|
+
outcome: z29.number().nullable(),
|
|
2611
|
+
complete: z29.boolean(),
|
|
2612
|
+
deliveryFailure: z29.boolean().nullable(),
|
|
2613
|
+
failureReason: z29.string().nullable().optional(),
|
|
2614
|
+
inputs: z29.array(
|
|
2686
2615
|
z29.object({
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
})
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2616
|
+
operationId: z29.string(),
|
|
2617
|
+
kind: z29.string(),
|
|
2618
|
+
key: z29.string(),
|
|
2619
|
+
source: z29.string(),
|
|
2620
|
+
sourceKey: z29.string(),
|
|
2621
|
+
present: z29.boolean(),
|
|
2622
|
+
sourceBytes: z29.number(),
|
|
2623
|
+
applied: z29.boolean(),
|
|
2624
|
+
preflight: z29.boolean(),
|
|
2625
|
+
deliveredBytes: z29.number(),
|
|
2626
|
+
originalStdin: z29.literal("not_read")
|
|
2627
|
+
})
|
|
2628
|
+
).max(50).default([]),
|
|
2629
|
+
operations: z29.array(
|
|
2630
|
+
z29.object({
|
|
2631
|
+
id: z29.string(),
|
|
2632
|
+
kind: z29.string(),
|
|
2633
|
+
count: z29.number().nullable()
|
|
2634
|
+
})
|
|
2635
|
+
).max(50),
|
|
2636
|
+
excerpts: z29.array(
|
|
2637
|
+
z29.object({
|
|
2638
|
+
stream: z29.enum(["stdout", "stderr", "combined", "stdin"]),
|
|
2639
|
+
before: z29.string().max(4096),
|
|
2640
|
+
after: z29.string().max(4096),
|
|
2641
|
+
originalBytes: z29.number().nullable(),
|
|
2642
|
+
deliveredBytes: z29.number().nullable(),
|
|
2643
|
+
omitted: z29.boolean(),
|
|
2644
|
+
redacted: z29.boolean().optional(),
|
|
2645
|
+
beforeTruncated: z29.boolean().optional(),
|
|
2646
|
+
afterTruncated: z29.boolean().optional(),
|
|
2647
|
+
omissionReason: z29.string().max(128).optional()
|
|
2648
|
+
})
|
|
2649
|
+
).max(4)
|
|
2650
|
+
});
|
|
2651
|
+
var cliRuleSummarySchema = z29.object({
|
|
2652
|
+
protocolVersion: z29.literal(3),
|
|
2653
|
+
bundleSha256: z29.string(),
|
|
2654
|
+
journalSha256: z29.string().nullable(),
|
|
2655
|
+
journalComplete: z29.boolean(),
|
|
2656
|
+
journalLimited: z29.boolean(),
|
|
2657
|
+
delivery: cliRuleDeliverySchema,
|
|
2658
|
+
appliedInvocations: z29.number(),
|
|
2659
|
+
matchedInvocations: z29.number(),
|
|
2660
|
+
recognizedInvocations: z29.number().optional(),
|
|
2661
|
+
unmatchedInvocations: z29.number().optional(),
|
|
2662
|
+
unsupportedInvocations: z29.number(),
|
|
2663
|
+
retainedExcerptBytes: z29.number(),
|
|
2664
|
+
diagnostics: z29.array(z29.string().max(256)).max(50),
|
|
2665
|
+
observations: z29.array(
|
|
2666
|
+
z29.object({
|
|
2667
|
+
invocationId: z29.string(),
|
|
2668
|
+
ruleId: z29.string().nullable(),
|
|
2669
|
+
reason: z29.string(),
|
|
2670
|
+
entrypointSha256: z29.string().nullable(),
|
|
2671
|
+
launchForm: z29.string().nullable(),
|
|
2672
|
+
ioProfile: z29.string().nullable()
|
|
2673
|
+
})
|
|
2674
|
+
).max(200).optional()
|
|
2675
|
+
});
|
|
2676
|
+
var cliRuleCoverageSchema = z29.object({
|
|
2677
|
+
invocationCount: z29.number(),
|
|
2678
|
+
observedInvocationCount: z29.number().nullable(),
|
|
2679
|
+
appliedInvocationCount: z29.number(),
|
|
2680
|
+
incompleteCount: z29.number(),
|
|
2681
|
+
unsupportedCount: z29.number(),
|
|
2682
|
+
instrumentationFailed: z29.boolean(),
|
|
2683
|
+
unsupportedDiagnostics: z29.array(z29.string()),
|
|
2684
|
+
v3: cliRuleSummarySchema,
|
|
2685
|
+
invocations: z29.array(cliRuleInvocationResultSchema).default([])
|
|
2686
|
+
});
|
|
2687
|
+
|
|
2688
|
+
// ../packages/api-schemas/src/climb.ts
|
|
2689
|
+
import { z as z32 } from "zod";
|
|
2690
|
+
|
|
2691
|
+
// ../packages/api-schemas/src/cli-rules.ts
|
|
2692
|
+
import { z as z30 } from "zod";
|
|
2693
|
+
|
|
2694
|
+
// ../packages/api-schemas/src/cli-rule-arguments.ts
|
|
2695
|
+
function parseCliRuleArguments(argv, arity) {
|
|
2696
|
+
const value = {
|
|
2697
|
+
positionals: [],
|
|
2698
|
+
options: /* @__PURE__ */ new Map(),
|
|
2699
|
+
endOptions: argv.length
|
|
2700
|
+
};
|
|
2701
|
+
for (let i = 0; i < argv.length; i++) {
|
|
2702
|
+
const token = argv[i];
|
|
2703
|
+
if (token === "--") {
|
|
2704
|
+
value.endOptions = i;
|
|
2705
|
+
value.positionals.push(...argv.slice(i + 1));
|
|
2706
|
+
break;
|
|
2707
|
+
}
|
|
2708
|
+
if (!token.startsWith("-") || token === "-") {
|
|
2709
|
+
value.positionals.push(token);
|
|
2710
|
+
continue;
|
|
2711
|
+
}
|
|
2712
|
+
const equal = token.indexOf("=");
|
|
2713
|
+
const flag2 = equal < 0 ? token : token.slice(0, equal);
|
|
2714
|
+
if (!Object.hasOwn(arity, flag2) || !flag2.startsWith("--") && flag2.length !== 2)
|
|
2715
|
+
return { kind: "ambiguous", reason: "unknown_option" };
|
|
2716
|
+
if (arity[flag2] === 0) {
|
|
2717
|
+
if (equal >= 0) return { kind: "ambiguous", reason: "unexpected_value" };
|
|
2718
|
+
value.options.set(flag2, { index: i, width: 1 });
|
|
2719
|
+
} else if (equal >= 0) {
|
|
2720
|
+
value.options.set(flag2, {
|
|
2721
|
+
index: i,
|
|
2722
|
+
width: 1,
|
|
2723
|
+
value: token.slice(equal + 1)
|
|
2717
2724
|
});
|
|
2718
|
-
|
|
2719
|
-
if (
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
"setEnv",
|
|
2753
|
-
capabilities2.settings.length > 0,
|
|
2754
|
-
"Environment changes need supported settings"
|
|
2755
|
-
);
|
|
2756
|
-
requires(
|
|
2757
|
-
"ensureOption",
|
|
2758
|
-
capabilities2.options.length > 0,
|
|
2759
|
-
"Arguments need supported options"
|
|
2760
|
-
);
|
|
2761
|
-
requires(
|
|
2762
|
-
"replaceOption",
|
|
2763
|
-
capabilities2.options.length > 0,
|
|
2764
|
-
"Arguments need supported options"
|
|
2765
|
-
);
|
|
2766
|
-
}
|
|
2767
|
-
});
|
|
2768
|
-
var CLI_CATALOG_MAX_TARGETS = 100;
|
|
2769
|
-
var cliCatalogSchema = z29.object({
|
|
2770
|
-
version: z29.union([z29.literal(1), z29.literal(2)]),
|
|
2771
|
-
engineVersion: token,
|
|
2772
|
-
digest,
|
|
2773
|
-
targets: z29.array(cliTargetSchema).max(CLI_CATALOG_MAX_TARGETS)
|
|
2774
|
-
}).strict().superRefine((catalog, ctx) => {
|
|
2775
|
-
if (catalog.version === 1 && (!catalog.targets.length || catalog.targets.some((target) => target.discovery)))
|
|
2725
|
+
} else {
|
|
2726
|
+
if (i + 1 === argv.length || argv[i + 1] === "--")
|
|
2727
|
+
return { kind: "ambiguous", reason: "missing_value" };
|
|
2728
|
+
value.options.set(flag2, { index: i, width: 2, value: argv[i + 1] });
|
|
2729
|
+
i++;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
return { kind: "parsed", value };
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
// ../packages/api-schemas/src/cli-rules.ts
|
|
2736
|
+
var CLI_RULE_LIMITS = {
|
|
2737
|
+
bundleBytes: 2 * 1024 * 1024,
|
|
2738
|
+
jsonTokens: 4e4,
|
|
2739
|
+
rules: 50,
|
|
2740
|
+
operations: 50,
|
|
2741
|
+
arguments: 256,
|
|
2742
|
+
argumentBytes: 4095,
|
|
2743
|
+
literalBytes: 8192,
|
|
2744
|
+
bufferBytes: 2 * 1024 * 1024,
|
|
2745
|
+
bufferWaitMs: 5e3,
|
|
2746
|
+
maxBufferWaitMs: 12e4,
|
|
2747
|
+
expansionBytes: 64 * 1024 * 1024,
|
|
2748
|
+
excerptBytes: 4096,
|
|
2749
|
+
attemptExcerptBytes: 256 * 1024,
|
|
2750
|
+
journalBytes: 4 * 1024 * 1024,
|
|
2751
|
+
supervisorTasks: 4096
|
|
2752
|
+
};
|
|
2753
|
+
var encoder = new TextEncoder();
|
|
2754
|
+
var cliUtf8Bytes = (value) => encoder.encode(value).length;
|
|
2755
|
+
var text = (max, nonempty = false) => z30.string().superRefine((value, ctx) => {
|
|
2756
|
+
if (nonempty && !value.length || cliUtf8Bytes(value) > max || /\0|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(
|
|
2757
|
+
value
|
|
2758
|
+
))
|
|
2776
2759
|
ctx.addIssue({
|
|
2777
2760
|
code: "custom",
|
|
2778
|
-
message: "
|
|
2761
|
+
message: `Use valid non-NUL UTF-8 text of at most ${max} bytes${nonempty ? ", not empty" : ""}`
|
|
2779
2762
|
});
|
|
2780
|
-
catalog.targets.forEach((target, index) => {
|
|
2781
|
-
if (catalog.targets.findIndex((other) => other.id === target.id) !== index)
|
|
2782
|
-
ctx.addIssue({
|
|
2783
|
-
code: "custom",
|
|
2784
|
-
path: ["targets", index, "id"],
|
|
2785
|
-
message: "Duplicate target ID"
|
|
2786
|
-
});
|
|
2787
|
-
});
|
|
2788
2763
|
});
|
|
2789
|
-
var
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2764
|
+
var id = z30.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/);
|
|
2765
|
+
var flag = z30.string().regex(/^(?:-[A-Za-z0-9]|--[A-Za-z0-9][A-Za-z0-9-]{0,125})$/);
|
|
2766
|
+
var envKey = z30.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,126}$/);
|
|
2767
|
+
var arg = text(CLI_RULE_LIMITS.argumentBytes);
|
|
2768
|
+
var literal = text(CLI_RULE_LIMITS.literalBytes);
|
|
2769
|
+
var stream = z30.enum(["stdout", "stderr", "combined"]);
|
|
2770
|
+
var exit = z30.discriminatedUnion("kind", [
|
|
2771
|
+
z30.object({ kind: z30.literal("any") }).strict(),
|
|
2772
|
+
z30.object({
|
|
2773
|
+
kind: z30.literal("code"),
|
|
2774
|
+
value: z30.number().int().min(0).max(255)
|
|
2794
2775
|
}).strict()
|
|
2795
2776
|
]);
|
|
2796
|
-
var
|
|
2797
|
-
|
|
2798
|
-
|
|
2777
|
+
var buffer = {
|
|
2778
|
+
maxBufferBytes: z30.number().int().min(1).max(CLI_RULE_LIMITS.bufferBytes).default(CLI_RULE_LIMITS.bufferBytes),
|
|
2779
|
+
maxWaitMs: z30.number().int().min(1).max(CLI_RULE_LIMITS.maxBufferWaitMs).default(CLI_RULE_LIMITS.bufferWaitMs)
|
|
2780
|
+
};
|
|
2781
|
+
var source = (value) => z30.discriminatedUnion("source", [
|
|
2782
|
+
z30.object({ source: z30.literal("literal"), value }).strict(),
|
|
2783
|
+
z30.object({ source: z30.literal("localFact"), key: envKey }).strict()
|
|
2784
|
+
]);
|
|
2785
|
+
function cliBoundedPattern(pattern) {
|
|
2799
2786
|
let at = pattern.startsWith("^") ? 1 : 0;
|
|
2800
2787
|
const end = pattern.endsWith("$") && pattern.length > at ? pattern.length - 1 : pattern.length;
|
|
2801
2788
|
let stars = 0;
|
|
2802
|
-
let
|
|
2789
|
+
let literals = 0;
|
|
2803
2790
|
while (at < end) {
|
|
2804
2791
|
const char = pattern[at];
|
|
2805
2792
|
if (char === "\\") {
|
|
2806
2793
|
if (++at >= end || !"\\.^$*+?[]{}()|".includes(pattern[at])) return false;
|
|
2807
|
-
|
|
2794
|
+
literals++;
|
|
2808
2795
|
} else if (char === "." && pattern[at + 1] === "*") {
|
|
2809
2796
|
if (++stars > 1) return false;
|
|
2810
2797
|
at++;
|
|
2811
|
-
} else if (".^$*+?[]{}()|\n\r".includes(char))
|
|
2812
|
-
|
|
2813
|
-
} else {
|
|
2814
|
-
literalBytes++;
|
|
2815
|
-
}
|
|
2798
|
+
} else if (".^$*+?[]{}()|\n\r".includes(char)) return false;
|
|
2799
|
+
else literals++;
|
|
2816
2800
|
at++;
|
|
2817
2801
|
}
|
|
2818
|
-
return
|
|
2802
|
+
return literals > 0;
|
|
2819
2803
|
}
|
|
2820
|
-
var
|
|
2821
|
-
|
|
2822
|
-
kind:
|
|
2823
|
-
|
|
2824
|
-
|
|
2804
|
+
var cliRuleTargetSchema = z30.discriminatedUnion("kind", [
|
|
2805
|
+
z30.object({
|
|
2806
|
+
kind: z30.literal("npmBin"),
|
|
2807
|
+
packageName: z30.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/),
|
|
2808
|
+
program: z30.string().max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/)
|
|
2825
2809
|
}).strict(),
|
|
2826
|
-
|
|
2827
|
-
kind:
|
|
2828
|
-
|
|
2829
|
-
|
|
2810
|
+
z30.object({
|
|
2811
|
+
kind: z30.literal("path"),
|
|
2812
|
+
path: text(1024, true).refine(
|
|
2813
|
+
(value) => !value.includes("\\") && !value.split("/").includes(".."),
|
|
2814
|
+
"Use a sandbox path without traversal"
|
|
2815
|
+
)
|
|
2816
|
+
}).strict()
|
|
2817
|
+
]);
|
|
2818
|
+
var cliRuleSelectorSchema = z30.discriminatedUnion("kind", [
|
|
2819
|
+
z30.object({
|
|
2820
|
+
kind: z30.literal("exact"),
|
|
2821
|
+
argv: z30.array(arg).max(CLI_RULE_LIMITS.arguments - 1)
|
|
2830
2822
|
}).strict(),
|
|
2831
|
-
|
|
2832
|
-
kind:
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2823
|
+
z30.object({
|
|
2824
|
+
kind: z30.literal("command"),
|
|
2825
|
+
positionals: z30.object({
|
|
2826
|
+
mode: z30.enum(["exact", "prefix"]),
|
|
2827
|
+
tokens: z30.array(arg).max(CLI_RULE_LIMITS.arguments - 1)
|
|
2828
|
+
}).strict(),
|
|
2829
|
+
optionsPresent: z30.array(flag).max(100).default([]),
|
|
2830
|
+
optionsAbsent: z30.array(flag).max(100).default([]),
|
|
2831
|
+
optionValues: z30.record(flag, arg).default({})
|
|
2832
|
+
}).strict()
|
|
2833
|
+
]);
|
|
2834
|
+
var cliRuleOperationSchema = z30.discriminatedUnion("kind", [
|
|
2835
|
+
z30.object({
|
|
2836
|
+
id,
|
|
2837
|
+
kind: z30.literal("replaceOutput"),
|
|
2838
|
+
stream,
|
|
2839
|
+
exit,
|
|
2840
|
+
replacement: literal,
|
|
2841
|
+
...buffer
|
|
2836
2842
|
}).strict(),
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2843
|
+
z30.object({
|
|
2844
|
+
id,
|
|
2845
|
+
kind: z30.literal("streamOutput"),
|
|
2846
|
+
stream,
|
|
2847
|
+
edit: z30.object({ find: text(8192, true), replace: literal }).strict()
|
|
2841
2848
|
}).strict(),
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2849
|
+
z30.object({
|
|
2850
|
+
id,
|
|
2851
|
+
kind: z30.literal("completeOutput"),
|
|
2852
|
+
stream,
|
|
2853
|
+
exit,
|
|
2854
|
+
replace: literal,
|
|
2855
|
+
...buffer,
|
|
2856
|
+
matcher: z30.discriminatedUnion("kind", [
|
|
2857
|
+
z30.object({ kind: z30.literal("literal"), text: text(8192, true) }).strict(),
|
|
2858
|
+
z30.object({
|
|
2859
|
+
kind: z30.literal("re2"),
|
|
2860
|
+
pattern: text(2048, true).refine(
|
|
2861
|
+
cliBoundedPattern,
|
|
2862
|
+
"Use literals, optional anchors, and at most one greedy .*"
|
|
2855
2863
|
)
|
|
2856
2864
|
}).strict()
|
|
2857
|
-
])
|
|
2858
|
-
replace: z29.string().max(8192),
|
|
2859
|
-
exit: exitPredicate
|
|
2865
|
+
])
|
|
2860
2866
|
}).strict(),
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
callerInput: z29.literal("replace"),
|
|
2867
|
-
eof: z29.literal("close")
|
|
2867
|
+
z30.object({
|
|
2868
|
+
id,
|
|
2869
|
+
kind: z30.literal("ensureOption"),
|
|
2870
|
+
option: flag,
|
|
2871
|
+
value: source(arg).optional()
|
|
2868
2872
|
}).strict(),
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
prompt: z29.string().min(1).max(4096),
|
|
2875
|
-
response: sourcedValue,
|
|
2876
|
-
timeoutMs: z29.number().int().min(1).max(12e4)
|
|
2877
|
-
}).strict()
|
|
2878
|
-
).min(1).max(20),
|
|
2879
|
-
overallTimeoutMs: z29.number().int().min(1).max(6e5),
|
|
2880
|
-
completion: z29.string().min(1).max(4096)
|
|
2873
|
+
z30.object({
|
|
2874
|
+
id,
|
|
2875
|
+
kind: z30.literal("replaceOption"),
|
|
2876
|
+
option: flag,
|
|
2877
|
+
value: source(arg)
|
|
2881
2878
|
}).strict(),
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2879
|
+
z30.object({
|
|
2880
|
+
id,
|
|
2881
|
+
kind: z30.literal("setEnv"),
|
|
2882
|
+
key: envKey,
|
|
2883
|
+
value: source(arg),
|
|
2884
|
+
whenAbsent: z30.boolean()
|
|
2885
|
+
}).strict(),
|
|
2886
|
+
z30.object({
|
|
2887
|
+
id,
|
|
2888
|
+
kind: z30.literal("structuredStdin"),
|
|
2889
|
+
format: z30.enum(["text", "json", "jsonl"]),
|
|
2890
|
+
payload: source(literal),
|
|
2891
|
+
timing: z30.literal("onLaunch"),
|
|
2892
|
+
callerInput: z30.literal("replace"),
|
|
2893
|
+
eof: z30.literal("close")
|
|
2890
2894
|
}).strict()
|
|
2891
2895
|
]);
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
}).strict();
|
|
2912
|
-
var cliInterventionSchema = z29.object({
|
|
2913
|
-
schemaVersion: z29.union([z29.literal(1), z29.literal(2)]),
|
|
2914
|
-
identityPolicy: z29.literal("artifact").optional(),
|
|
2915
|
-
engineVersion: token,
|
|
2916
|
-
engineSha256: digest.nullable(),
|
|
2917
|
-
bundleSha256: digest,
|
|
2918
|
-
catalog: cliCatalogSchema,
|
|
2919
|
-
mode: z29.enum(["record", "trial"]),
|
|
2920
|
-
captureProfiles: z29.array(cliIoProfileSchema).min(1),
|
|
2921
|
-
activeTargetId: token.nullable(),
|
|
2922
|
-
activeCommandId: token.nullable(),
|
|
2923
|
-
selector: z29.object({
|
|
2924
|
-
optionPresent: z29.array(optionFlag).max(20),
|
|
2925
|
-
optionAbsent: z29.array(optionFlag).max(20)
|
|
2926
|
-
}).strict().nullable(),
|
|
2927
|
-
baselineInvocations: z29.array(baselineInvocationSchema).max(500),
|
|
2928
|
-
operations: z29.array(operationSchema).max(50),
|
|
2929
|
-
limits: z29.object({
|
|
2930
|
-
completedStreamBytes: z29.number().int().min(1).max(2 * 1024 * 1024),
|
|
2931
|
-
replacementBytes: z29.number().int().min(1).max(8192),
|
|
2932
|
-
generatedFileBytes: z29.number().int().min(1).max(2 * 1024 * 1024),
|
|
2933
|
-
generatedAggregateBytes: z29.number().int().min(1).max(8 * 1024 * 1024),
|
|
2934
|
-
generatedFileCount: z29.number().int().min(1).max(50)
|
|
2935
|
-
}).strict(),
|
|
2936
|
-
shippingIntent: z29.enum([
|
|
2937
|
-
"default",
|
|
2938
|
-
"message",
|
|
2939
|
-
"interaction",
|
|
2940
|
-
"invocation-guidance",
|
|
2941
|
-
"template"
|
|
2942
|
-
]).nullable()
|
|
2943
|
-
}).strict().superRefine((bundle, ctx) => {
|
|
2896
|
+
function cliStructuredInputValid(format, payload) {
|
|
2897
|
+
if (format === "text") return true;
|
|
2898
|
+
const records = format === "json" ? [payload] : payload.replace(/\r?\n$/, "").split("\n");
|
|
2899
|
+
try {
|
|
2900
|
+
return records.every((record2) => {
|
|
2901
|
+
if (!record2.trim()) return false;
|
|
2902
|
+
JSON.parse(record2);
|
|
2903
|
+
return true;
|
|
2904
|
+
});
|
|
2905
|
+
} catch {
|
|
2906
|
+
return false;
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
var cliRuleSchema = z30.object({
|
|
2910
|
+
id,
|
|
2911
|
+
selector: cliRuleSelectorSchema,
|
|
2912
|
+
optionArity: z30.record(flag, z30.union([z30.literal(0), z30.literal(1)])).default({}),
|
|
2913
|
+
operations: z30.array(cliRuleOperationSchema).min(1).max(CLI_RULE_LIMITS.operations)
|
|
2914
|
+
}).strict().superRefine((rule, ctx) => {
|
|
2944
2915
|
const fail = (path3, message2) => ctx.addIssue({ code: "custom", path: path3, message: message2 });
|
|
2945
|
-
if (
|
|
2946
|
-
fail(["
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
["
|
|
2952
|
-
"
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
bundle.baselineInvocations.forEach((invocation, index) => {
|
|
2966
|
-
const command2 = bundle.catalog.targets.find((target2) => target2.id === invocation.targetId)?.commands.find((item) => item.id === invocation.commandId);
|
|
2967
|
-
for (const [fileIndex, file] of invocation.recordFiles.entries()) {
|
|
2968
|
-
if (command2?.capabilities.generatedPaths[file.pathIndex] !== file.path || file.status === "generated" && !file.generatedSha256 || file.status === "not-exercised" && file.generatedSha256 !== file.beforeSha256)
|
|
2969
|
-
fail(
|
|
2970
|
-
["baselineInvocations", index, "recordFiles", fileIndex],
|
|
2971
|
-
"Recorded file does not match the qualified command"
|
|
2972
|
-
);
|
|
2973
|
-
}
|
|
2974
|
-
});
|
|
2975
|
-
if (bundle.engineVersion !== bundle.catalog.engineVersion)
|
|
2976
|
-
fail(["engineVersion"], "Engine and catalog versions differ");
|
|
2977
|
-
if (bundle.mode === "record") {
|
|
2978
|
-
if (bundle.activeTargetId || bundle.activeCommandId || bundle.selector || bundle.operations.length || bundle.shippingIntent)
|
|
2979
|
-
fail(["mode"], "Record mode cannot select or modify a command");
|
|
2980
|
-
return;
|
|
2916
|
+
if (Object.keys(rule.optionArity).length > 100)
|
|
2917
|
+
fail(["optionArity"], "At most 100 option arities per rule");
|
|
2918
|
+
const arity = (key2, expected) => Object.hasOwn(rule.optionArity, key2) && (expected === void 0 || rule.optionArity[key2] === expected);
|
|
2919
|
+
if (rule.selector.kind === "command") {
|
|
2920
|
+
const selector = rule.selector;
|
|
2921
|
+
for (const [field, flags] of [
|
|
2922
|
+
["optionsPresent", selector.optionsPresent],
|
|
2923
|
+
["optionsAbsent", selector.optionsAbsent],
|
|
2924
|
+
["optionValues", Object.keys(selector.optionValues)]
|
|
2925
|
+
]) {
|
|
2926
|
+
if (new Set(flags).size !== flags.length)
|
|
2927
|
+
fail(["selector", field], "Duplicate option predicate");
|
|
2928
|
+
for (const key2 of flags)
|
|
2929
|
+
if (!arity(key2, field === "optionValues" ? 1 : void 0))
|
|
2930
|
+
fail(["selector", field], `Declare ${key2}'s option arity`);
|
|
2931
|
+
}
|
|
2932
|
+
if (selector.optionsAbsent.some(
|
|
2933
|
+
(key2) => selector.optionsPresent.includes(key2) || Object.hasOwn(selector.optionValues, key2)
|
|
2934
|
+
))
|
|
2935
|
+
fail(["selector"], "An absent option cannot also be required");
|
|
2981
2936
|
}
|
|
2982
|
-
|
|
2983
|
-
(
|
|
2984
|
-
)
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
if (!target || !command) {
|
|
2989
|
-
fail(
|
|
2990
|
-
["activeCommandId"],
|
|
2991
|
-
"Select a qualified command in the frozen catalog"
|
|
2937
|
+
if (rule.selector.kind === "exact" && rule.operations.some(
|
|
2938
|
+
(op) => op.kind === "ensureOption" || op.kind === "replaceOption"
|
|
2939
|
+
)) {
|
|
2940
|
+
const parsed = parseCliRuleArguments(
|
|
2941
|
+
rule.selector.argv,
|
|
2942
|
+
rule.optionArity
|
|
2992
2943
|
);
|
|
2993
|
-
|
|
2994
|
-
}
|
|
2995
|
-
if (!bundle.selector) fail(["selector"], "A trial needs token predicates");
|
|
2996
|
-
else {
|
|
2997
|
-
for (const flag of [
|
|
2998
|
-
...bundle.selector.optionPresent,
|
|
2999
|
-
...bundle.selector.optionAbsent
|
|
3000
|
-
])
|
|
3001
|
-
if (!command.capabilities.options.some((option) => option.flag === flag))
|
|
3002
|
-
fail(["selector"], `Unsupported selector option: ${flag}`);
|
|
3003
|
-
if (bundle.selector.optionPresent.some(
|
|
3004
|
-
(flag) => bundle.selector?.optionAbsent.includes(flag)
|
|
3005
|
-
))
|
|
2944
|
+
if (parsed.kind === "ambiguous")
|
|
3006
2945
|
fail(
|
|
3007
|
-
["
|
|
3008
|
-
|
|
2946
|
+
["optionArity"],
|
|
2947
|
+
`Exact rules with argument edits must parse their argv (${parsed.reason}); declare each option's arity and supply its required value`
|
|
3009
2948
|
);
|
|
3010
2949
|
}
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
if (bundle.captureProfiles.includes("pty")) {
|
|
3022
|
-
for (const [index, operation] of bundle.operations.entries()) {
|
|
3023
|
-
if (operation.kind === "structuredStdin")
|
|
2950
|
+
const ids = /* @__PURE__ */ new Set();
|
|
2951
|
+
const outputs = /* @__PURE__ */ new Map();
|
|
2952
|
+
let stdin = false;
|
|
2953
|
+
for (const [index, op] of rule.operations.entries()) {
|
|
2954
|
+
const path3 = ["operations", index];
|
|
2955
|
+
if (ids.has(op.id))
|
|
2956
|
+
fail([...path3, "id"], "Duplicate operation ID within rule");
|
|
2957
|
+
ids.add(op.id);
|
|
2958
|
+
if (op.kind === "ensureOption" || op.kind === "replaceOption") {
|
|
2959
|
+
if (!arity(op.option, op.value === void 0 ? 0 : 1))
|
|
3024
2960
|
fail(
|
|
3025
|
-
|
|
3026
|
-
"
|
|
2961
|
+
path3,
|
|
2962
|
+
"Argument operation value must agree with declared option arity"
|
|
3027
2963
|
);
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
);
|
|
3037
|
-
if (bundle.operations.some(
|
|
3038
|
-
(item) => (item.kind === "streamOutput" || item.kind === "completeOutput") && item.stream === "combined"
|
|
3039
|
-
) && !bundle.baselineInvocations.some(
|
|
3040
|
-
(item) => item.targetId === target.id && item.commandId === command.id && item.artifactSha256 === target.artifactSha256 && (target.discovery !== void 0 || item.entrypointSha256 === target.entrypointSha256) && target.launchForms.includes(item.launchForm) && (item.ioProfile === "shared-descriptor" || item.ioProfile === "pty") && target.ioProfiles.includes(item.ioProfile) && bundle.captureProfiles.includes(item.ioProfile)
|
|
3041
|
-
))
|
|
3042
|
-
fail(
|
|
3043
|
-
["operations"],
|
|
3044
|
-
"Combined output requires a shared-descriptor or PTY baseline profile"
|
|
3045
|
-
);
|
|
3046
|
-
if (!bundle.baselineInvocations.some(
|
|
3047
|
-
(item) => item.targetId === target.id && item.commandId === command.id && item.artifactSha256 === target.artifactSha256 && (target.discovery !== void 0 || item.entrypointSha256 === target.entrypointSha256) && target.launchForms.includes(item.launchForm) && target.ioProfiles.includes(item.ioProfile) && bundle.captureProfiles.includes(item.ioProfile)
|
|
3048
|
-
))
|
|
3049
|
-
fail(
|
|
3050
|
-
["baselineInvocations"],
|
|
3051
|
-
"No baseline invocation matches this exact command, artifact, launch form, and I/O profile"
|
|
3052
|
-
);
|
|
3053
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3054
|
-
const changedEnvironment = new Set(
|
|
3055
|
-
bundle.operations.flatMap(
|
|
3056
|
-
(item) => item.kind === "setEnv" ? [item.key] : []
|
|
3057
|
-
)
|
|
3058
|
-
);
|
|
3059
|
-
bundle.operations.forEach((operation, index) => {
|
|
3060
|
-
const path3 = ["operations", index];
|
|
3061
|
-
if (!command.capabilities.operations.includes(operation.kind))
|
|
3062
|
-
fail(path3, `${operation.kind} is not qualified for this command`);
|
|
3063
|
-
if ("option" in operation && !command.capabilities.options.some(
|
|
3064
|
-
(option) => option.flag === operation.option
|
|
3065
|
-
))
|
|
3066
|
-
fail(path3, "Option is not supported by this version");
|
|
3067
|
-
if (operation.kind === "ensureOption" || operation.kind === "replaceOption") {
|
|
3068
|
-
const option = command.capabilities.options.find(
|
|
3069
|
-
(item) => item.flag === operation.option
|
|
3070
|
-
);
|
|
3071
|
-
if (option && option.takesValue !== (operation.value !== void 0))
|
|
3072
|
-
fail(path3, "Option value does not match its qualified arity");
|
|
3073
|
-
}
|
|
3074
|
-
if (operation.kind === "setEnv" && !command.capabilities.settings.includes(operation.key))
|
|
3075
|
-
fail(path3, "Environment setting is not supported by this version");
|
|
3076
|
-
if (operation.kind === "structuredStdin" && !command.capabilities.stdinFormats.includes(operation.format))
|
|
3077
|
-
fail(path3, "Stdin format is not qualified");
|
|
3078
|
-
if (operation.kind === "structuredStdin" && operation.payload.source === "literal" && operation.format !== "text") {
|
|
3079
|
-
const records = operation.format === "json" ? [operation.payload.value] : operation.payload.value.trimEnd().split("\n");
|
|
3080
|
-
try {
|
|
3081
|
-
if (records.some((record2) => !record2.trim()))
|
|
3082
|
-
throw new Error("Empty structured stdin record");
|
|
3083
|
-
for (const record2 of records) JSON.parse(record2);
|
|
3084
|
-
} catch {
|
|
2964
|
+
} else if (op.kind === "structuredStdin") {
|
|
2965
|
+
if (stdin) fail(path3, "Only one structured stdin operation per rule");
|
|
2966
|
+
stdin = true;
|
|
2967
|
+
if (op.payload.source === "literal" && !cliStructuredInputValid(op.format, op.payload.value))
|
|
2968
|
+
fail(path3, "Payload does not match its declared JSON/JSONL format");
|
|
2969
|
+
} else if ("stream" in op) {
|
|
2970
|
+
const previous = outputs.get(op.stream);
|
|
2971
|
+
if (previous && (previous.kind !== op.kind || op.kind === "replaceOutput"))
|
|
3085
2972
|
fail(
|
|
3086
2973
|
path3,
|
|
3087
|
-
"
|
|
2974
|
+
"Use one whole replacement or a chain of one output kind per stream"
|
|
3088
2975
|
);
|
|
3089
|
-
|
|
2976
|
+
if (previous && op.kind === "completeOutput" && (previous.bytes !== op.maxBufferBytes || previous.wait !== op.maxWaitMs))
|
|
2977
|
+
fail(
|
|
2978
|
+
path3,
|
|
2979
|
+
"Completed operations on one stream must share buffer bounds"
|
|
2980
|
+
);
|
|
2981
|
+
outputs.set(op.stream, {
|
|
2982
|
+
kind: op.kind,
|
|
2983
|
+
..."maxBufferBytes" in op ? { bytes: op.maxBufferBytes, wait: op.maxWaitMs } : {}
|
|
2984
|
+
});
|
|
3090
2985
|
}
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
if (operation.kind === "generatedFile" && !command.capabilities.generatedPaths.includes(operation.path))
|
|
3094
|
-
fail(path3, "Output path is not attributed to this command");
|
|
3095
|
-
if (operation.kind === "generatedFile" && !bundle.baselineInvocations.some(
|
|
3096
|
-
(invocation) => invocation.targetId === target.id && invocation.commandId === command.id && invocation.recordFiles.some(
|
|
3097
|
-
(file) => file.path === operation.path && file.status === "generated" && file.beforeSha256 === operation.beforeSha256 && file.generatedSha256 === operation.generatedSha256
|
|
3098
|
-
)
|
|
3099
|
-
))
|
|
3100
|
-
fail(
|
|
3101
|
-
path3,
|
|
3102
|
-
"No attributed baseline file matches the preimage and real generated bytes"
|
|
3103
|
-
);
|
|
3104
|
-
if (operation.kind === "streamOutput" && !command.capabilities.outputModes.includes("streaming"))
|
|
3105
|
-
fail(path3, "Streaming output is not qualified");
|
|
3106
|
-
if (operation.kind === "completeOutput" && !command.capabilities.outputModes.includes("completed"))
|
|
3107
|
-
fail(path3, "Completed output is not qualified");
|
|
3108
|
-
if (operation.kind === "streamOutput" && operation.edit.find === operation.edit.replace || operation.kind === "generatedFile" && operation.edit.find === operation.edit.replace || operation.kind === "completeOutput" && operation.matcher.kind === "literal" && operation.matcher.text === operation.replace)
|
|
3109
|
-
fail(path3, "A trial operation must change the matched content");
|
|
3110
|
-
const sources = [
|
|
3111
|
-
"value" in operation ? operation.value : null,
|
|
3112
|
-
operation.kind === "structuredStdin" ? operation.payload : null,
|
|
3113
|
-
...operation.kind === "promptRecipe" ? operation.steps.map((step) => step.response) : []
|
|
3114
|
-
];
|
|
3115
|
-
if (sources.some(
|
|
3116
|
-
(source) => source?.source === "localFact" && !command.capabilities.localFacts.includes(source.key)
|
|
3117
|
-
))
|
|
3118
|
-
fail(path3, "Local fact is not declared non-secret for this command");
|
|
3119
|
-
if (sources.some(
|
|
3120
|
-
(source) => source?.source === "localFact" && changedEnvironment.has(source.key)
|
|
3121
|
-
))
|
|
3122
|
-
fail(
|
|
3123
|
-
path3,
|
|
3124
|
-
"A local fact cannot be changed by another operation in the same trial"
|
|
3125
|
-
);
|
|
3126
|
-
const conflict = operation.kind === "ensureOption" || operation.kind === "replaceOption" ? `option:${operation.option}` : operation.kind === "setEnv" ? `env:${operation.key}` : operation.kind === "structuredStdin" ? "stdin" : operation.kind === "promptRecipe" ? `prompt:${operation.recipeId}` : operation.kind === "generatedFile" ? `file:${operation.path}` : null;
|
|
3127
|
-
if (conflict && seen.has(conflict))
|
|
3128
|
-
fail(path3, "Conflicting operation on the same input or output");
|
|
3129
|
-
if (conflict) seen.add(conflict);
|
|
3130
|
-
});
|
|
3131
|
-
if (bundle.operations.filter((item) => item.kind === "generatedFile").length > bundle.limits.generatedFileCount)
|
|
2986
|
+
}
|
|
2987
|
+
if (outputs.has("combined") && outputs.size > 1)
|
|
3132
2988
|
fail(
|
|
3133
|
-
["
|
|
3134
|
-
"
|
|
2989
|
+
["operations"],
|
|
2990
|
+
"Combined output cannot be mixed with separate-stream output"
|
|
3135
2991
|
);
|
|
3136
2992
|
});
|
|
3137
|
-
var
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
2993
|
+
var body = {
|
|
2994
|
+
schemaVersion: z30.literal(3),
|
|
2995
|
+
target: cliRuleTargetSchema,
|
|
2996
|
+
rules: z30.array(cliRuleSchema).min(1).max(CLI_RULE_LIMITS.rules),
|
|
2997
|
+
shippingIntent: z30.enum([
|
|
2998
|
+
"default",
|
|
2999
|
+
"message",
|
|
3000
|
+
"interaction",
|
|
3001
|
+
"invocation-guidance",
|
|
3002
|
+
"template"
|
|
3003
|
+
])
|
|
3004
|
+
};
|
|
3005
|
+
function jsonTokenCount(value) {
|
|
3006
|
+
if (Array.isArray(value))
|
|
3007
|
+
return 1 + value.reduce((sum, item) => sum + jsonTokenCount(item), 0);
|
|
3008
|
+
if (value && typeof value === "object")
|
|
3009
|
+
return 1 + Object.values(value).reduce(
|
|
3010
|
+
(sum, item) => sum + 1 + jsonTokenCount(item),
|
|
3011
|
+
0
|
|
3012
|
+
);
|
|
3013
|
+
return 1;
|
|
3014
|
+
}
|
|
3015
|
+
function validateBundle(value, ctx) {
|
|
3016
|
+
if (new Set(value.rules.map((rule) => rule.id)).size !== value.rules.length)
|
|
3017
|
+
ctx.addIssue({
|
|
3018
|
+
code: "custom",
|
|
3019
|
+
path: ["rules"],
|
|
3020
|
+
message: "Duplicate rule ID"
|
|
3021
|
+
});
|
|
3022
|
+
if (value.rules.reduce((count, rule) => count + rule.operations.length, 0) > CLI_RULE_LIMITS.operations)
|
|
3023
|
+
ctx.addIssue({
|
|
3024
|
+
code: "custom",
|
|
3025
|
+
path: ["rules"],
|
|
3026
|
+
message: "At most 50 operations across the bundle"
|
|
3027
|
+
});
|
|
3028
|
+
if (cliUtf8Bytes(JSON.stringify(value)) > CLI_RULE_LIMITS.bundleBytes)
|
|
3029
|
+
ctx.addIssue({ code: "custom", message: "CLI bundle exceeds 2 MiB" });
|
|
3030
|
+
if (jsonTokenCount(value) > CLI_RULE_LIMITS.jsonTokens)
|
|
3031
|
+
ctx.addIssue({
|
|
3032
|
+
code: "custom",
|
|
3033
|
+
message: "CLI bundle exceeds the native JSON token bound"
|
|
3034
|
+
});
|
|
3035
|
+
}
|
|
3036
|
+
var cliRuleAuthorInputSchema = z30.object(body).strict().superRefine(validateBundle);
|
|
3037
|
+
var normalizedLimits = z30.object({
|
|
3038
|
+
expansionBytes: z30.literal(CLI_RULE_LIMITS.expansionBytes),
|
|
3039
|
+
excerptBytes: z30.literal(CLI_RULE_LIMITS.excerptBytes),
|
|
3040
|
+
attemptExcerptBytes: z30.literal(CLI_RULE_LIMITS.attemptExcerptBytes),
|
|
3041
|
+
journalBytes: z30.literal(CLI_RULE_LIMITS.journalBytes),
|
|
3042
|
+
supervisorTasks: z30.literal(CLI_RULE_LIMITS.supervisorTasks)
|
|
3043
|
+
}).strict().default({
|
|
3044
|
+
expansionBytes: CLI_RULE_LIMITS.expansionBytes,
|
|
3045
|
+
excerptBytes: CLI_RULE_LIMITS.excerptBytes,
|
|
3046
|
+
attemptExcerptBytes: CLI_RULE_LIMITS.attemptExcerptBytes,
|
|
3047
|
+
journalBytes: CLI_RULE_LIMITS.journalBytes,
|
|
3048
|
+
supervisorTasks: CLI_RULE_LIMITS.supervisorTasks
|
|
3049
|
+
});
|
|
3050
|
+
var cliRuleBundleSchema = z30.object({
|
|
3051
|
+
...body,
|
|
3052
|
+
limits: normalizedLimits,
|
|
3053
|
+
bundleSha256: z30.string().regex(/^[a-f0-9]{64}$/)
|
|
3054
|
+
}).strict().superRefine(validateBundle);
|
|
3147
3055
|
|
|
3148
3056
|
// ../packages/api-schemas/src/climb-kinds.ts
|
|
3149
3057
|
var LEVER_KINDS = [
|
|
@@ -3173,35 +3081,35 @@ var LEVER_INTERVENTIONS = {
|
|
|
3173
3081
|
};
|
|
3174
3082
|
|
|
3175
3083
|
// ../packages/api-schemas/src/sandbox-overrides.ts
|
|
3176
|
-
import { z as
|
|
3084
|
+
import { z as z31 } from "zod";
|
|
3177
3085
|
var SANDBOX_OVERRIDE_KINDS = ["packages", "clis"];
|
|
3178
|
-
var ecosystemSchema =
|
|
3179
|
-
var overrideFilesSchema =
|
|
3180
|
-
|
|
3181
|
-
path:
|
|
3086
|
+
var ecosystemSchema = z31.enum(["npm", "pypi", "cargo", "go", "gem"]);
|
|
3087
|
+
var overrideFilesSchema = z31.array(
|
|
3088
|
+
z31.object({
|
|
3089
|
+
path: z31.string().min(1).refine(
|
|
3182
3090
|
(path3) => !path3.startsWith("/") && !path3.includes("\\") && !path3.split("/").includes(".."),
|
|
3183
3091
|
"Use a relative path within the target"
|
|
3184
3092
|
),
|
|
3185
|
-
body:
|
|
3093
|
+
body: z31.string()
|
|
3186
3094
|
}).strict()
|
|
3187
3095
|
).min(1);
|
|
3188
3096
|
var contentShape = {
|
|
3189
|
-
version:
|
|
3097
|
+
version: z31.string().trim().min(1).optional(),
|
|
3190
3098
|
files: overrideFilesSchema.optional()
|
|
3191
3099
|
};
|
|
3192
3100
|
var hasContent = (value) => value.version !== void 0 || value.files !== void 0;
|
|
3193
|
-
var sandboxOverridesSchema =
|
|
3194
|
-
version:
|
|
3195
|
-
packages:
|
|
3196
|
-
|
|
3101
|
+
var sandboxOverridesSchema = z31.object({
|
|
3102
|
+
version: z31.literal(1),
|
|
3103
|
+
packages: z31.array(
|
|
3104
|
+
z31.object({
|
|
3197
3105
|
ecosystem: ecosystemSchema,
|
|
3198
|
-
name:
|
|
3106
|
+
name: z31.string().trim().min(1),
|
|
3199
3107
|
...contentShape
|
|
3200
3108
|
}).strict().refine(hasContent, "Specify a version or files")
|
|
3201
3109
|
).optional(),
|
|
3202
|
-
clis:
|
|
3203
|
-
|
|
3204
|
-
name:
|
|
3110
|
+
clis: z31.array(
|
|
3111
|
+
z31.object({
|
|
3112
|
+
name: z31.string().trim().min(1),
|
|
3205
3113
|
...contentShape
|
|
3206
3114
|
}).strict().refine(hasContent, "Specify a version or files")
|
|
3207
3115
|
).optional()
|
|
@@ -3228,11 +3136,11 @@ var sandboxOverridesSchema = z30.object({
|
|
|
3228
3136
|
});
|
|
3229
3137
|
|
|
3230
3138
|
// ../packages/api-schemas/src/climb.ts
|
|
3231
|
-
var climbSubjectKindSchema =
|
|
3232
|
-
var leverKindSchema =
|
|
3233
|
-
var interventionKindSchema =
|
|
3234
|
-
var skill =
|
|
3235
|
-
var empty =
|
|
3139
|
+
var climbSubjectKindSchema = z32.enum(["EVAL_SET", "VISIBILITY_PROMPT"]);
|
|
3140
|
+
var leverKindSchema = z32.enum(LEVER_KINDS);
|
|
3141
|
+
var interventionKindSchema = z32.enum(INTERVENTION_KINDS);
|
|
3142
|
+
var skill = z32.object({ skillVersionId: z32.string().min(1) }).strict();
|
|
3143
|
+
var empty = z32.object({}).strict();
|
|
3236
3144
|
function validateFixtureIntervention(value, ctx) {
|
|
3237
3145
|
const result = webFixtureSchema.safeParse({ version: 1, ...value });
|
|
3238
3146
|
if (!result.success) {
|
|
@@ -3245,75 +3153,73 @@ function validateFixtureIntervention(value, ctx) {
|
|
|
3245
3153
|
}
|
|
3246
3154
|
}
|
|
3247
3155
|
}
|
|
3248
|
-
var interventionSchema =
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
kind:
|
|
3255
|
-
before:
|
|
3256
|
-
after:
|
|
3156
|
+
var interventionSchema = z32.discriminatedUnion("kind", [
|
|
3157
|
+
z32.object({ kind: z32.literal("BASELINE"), after: empty }),
|
|
3158
|
+
z32.object({ kind: z32.literal("ADD_SKILL"), after: skill }),
|
|
3159
|
+
z32.object({ kind: z32.literal("REMOVE_SKILL"), before: skill, after: empty }),
|
|
3160
|
+
z32.object({ kind: z32.literal("EDIT_SKILL"), before: skill, after: skill }),
|
|
3161
|
+
z32.object({
|
|
3162
|
+
kind: z32.literal("REWRITE_DOCS"),
|
|
3163
|
+
before: z32.json().optional(),
|
|
3164
|
+
after: z32.object({ pages: webFixtureSchema.shape.pages.unwrap().min(1) }).strict().superRefine(validateFixtureIntervention)
|
|
3257
3165
|
}),
|
|
3258
|
-
|
|
3259
|
-
kind:
|
|
3260
|
-
after:
|
|
3166
|
+
z32.object({
|
|
3167
|
+
kind: z32.literal("PACKAGE_VERSION"),
|
|
3168
|
+
after: z32.object({
|
|
3261
3169
|
ecosystem: ecosystemSchema,
|
|
3262
|
-
name:
|
|
3263
|
-
version:
|
|
3170
|
+
name: z32.string().min(1),
|
|
3171
|
+
version: z32.string().min(1)
|
|
3264
3172
|
}).strict()
|
|
3265
3173
|
}),
|
|
3266
|
-
|
|
3267
|
-
kind:
|
|
3268
|
-
after:
|
|
3174
|
+
z32.object({
|
|
3175
|
+
kind: z32.literal("PACKAGE_CONTENT"),
|
|
3176
|
+
after: z32.object({
|
|
3269
3177
|
ecosystem: ecosystemSchema,
|
|
3270
|
-
name:
|
|
3178
|
+
name: z32.string().min(1),
|
|
3271
3179
|
files: overrideFilesSchema
|
|
3272
3180
|
}).strict()
|
|
3273
3181
|
}),
|
|
3274
|
-
|
|
3275
|
-
kind:
|
|
3276
|
-
after:
|
|
3182
|
+
z32.object({
|
|
3183
|
+
kind: z32.literal("CLI_VERSION"),
|
|
3184
|
+
after: z32.object({ name: z32.string().min(1), version: z32.string().min(1) }).strict()
|
|
3277
3185
|
}),
|
|
3278
|
-
|
|
3279
|
-
kind:
|
|
3280
|
-
after:
|
|
3281
|
-
message: "A CLI trial requires a trial-mode bundle"
|
|
3282
|
-
})
|
|
3186
|
+
z32.object({
|
|
3187
|
+
kind: z32.literal("CLI_INTERVENTION"),
|
|
3188
|
+
after: cliRuleBundleSchema
|
|
3283
3189
|
})
|
|
3284
3190
|
]);
|
|
3285
|
-
var climbSettingsSchema =
|
|
3286
|
-
maxRounds:
|
|
3287
|
-
sampleCount:
|
|
3288
|
-
creditCap:
|
|
3289
|
-
targetScore:
|
|
3191
|
+
var climbSettingsSchema = z32.object({
|
|
3192
|
+
maxRounds: z32.number().int().positive().default(5),
|
|
3193
|
+
sampleCount: z32.number().int().positive().default(1),
|
|
3194
|
+
creditCap: z32.number().int().nonnegative(),
|
|
3195
|
+
targetScore: z32.number().min(0).max(1).default(1),
|
|
3290
3196
|
// Narrow the subject's whole roster to one slot, for the baseline and every
|
|
3291
3197
|
// trial alike. A subject rostering ten models otherwise multiplies every
|
|
3292
3198
|
// trial by ten, and a one-model trial measured against a ten-model baseline
|
|
3293
3199
|
// is not a comparison. `pinnedModel` empty means the agent's default model.
|
|
3294
3200
|
pinnedAgent: schedulableAgentSchema.optional(),
|
|
3295
|
-
pinnedModel:
|
|
3296
|
-
maxTrialsPerRound:
|
|
3201
|
+
pinnedModel: z32.string().optional(),
|
|
3202
|
+
maxTrialsPerRound: z32.number().int().min(1).max(10).default(3),
|
|
3297
3203
|
// The round a continuation started at; the no-improvement counter
|
|
3298
3204
|
// restarts here.
|
|
3299
|
-
continuedAtRound:
|
|
3205
|
+
continuedAtRound: z32.number().int().nonnegative().optional()
|
|
3300
3206
|
}).strip().refine((value) => value.pinnedAgent !== void 0 || !value.pinnedModel, {
|
|
3301
3207
|
path: ["pinnedAgent"],
|
|
3302
3208
|
message: "Pin an agent with the model"
|
|
3303
3209
|
});
|
|
3304
|
-
var climbDirectionSchema =
|
|
3305
|
-
focus:
|
|
3306
|
-
preserve:
|
|
3307
|
-
exclude:
|
|
3308
|
-
notes:
|
|
3309
|
-
});
|
|
3310
|
-
var climbDirectionPatchSchema =
|
|
3311
|
-
focus:
|
|
3312
|
-
preserve:
|
|
3313
|
-
exclude:
|
|
3314
|
-
notes:
|
|
3210
|
+
var climbDirectionSchema = z32.object({
|
|
3211
|
+
focus: z32.string().trim().max(2e3).nullable().default(null),
|
|
3212
|
+
preserve: z32.array(z32.string().trim().min(1).max(500)).max(20).default([]),
|
|
3213
|
+
exclude: z32.array(z32.string().trim().min(1).max(500)).max(20).default([]),
|
|
3214
|
+
notes: z32.string().trim().max(4e3).nullable().default(null)
|
|
3215
|
+
});
|
|
3216
|
+
var climbDirectionPatchSchema = z32.object({
|
|
3217
|
+
focus: z32.string().trim().max(2e3).nullable().optional(),
|
|
3218
|
+
preserve: z32.array(z32.string().trim().min(1).max(500)).max(20).optional(),
|
|
3219
|
+
exclude: z32.array(z32.string().trim().min(1).max(500)).max(20).optional(),
|
|
3220
|
+
notes: z32.string().trim().max(4e3).nullable().optional(),
|
|
3315
3221
|
/** One line on why this was recorded; becomes the DIRECTION row summary. */
|
|
3316
|
-
rationale:
|
|
3222
|
+
rationale: z32.string().trim().max(500).optional()
|
|
3317
3223
|
}).strict();
|
|
3318
3224
|
var CLIMB_ACTIVITY_KINDS = [
|
|
3319
3225
|
"STARTED",
|
|
@@ -3332,74 +3238,74 @@ var CLIMB_ACTIVITY_KINDS = [
|
|
|
3332
3238
|
"CONTINUED",
|
|
3333
3239
|
"CANCELED"
|
|
3334
3240
|
];
|
|
3335
|
-
var climbActivityKindSchema =
|
|
3336
|
-
var proposerTraceStepSchema =
|
|
3337
|
-
tool:
|
|
3338
|
-
args:
|
|
3339
|
-
result:
|
|
3340
|
-
isError:
|
|
3341
|
-
});
|
|
3342
|
-
var proposerTraceSchema =
|
|
3343
|
-
steps:
|
|
3344
|
-
reasoning:
|
|
3345
|
-
durationMs:
|
|
3346
|
-
model:
|
|
3347
|
-
});
|
|
3348
|
-
var climbActivitySchema =
|
|
3349
|
-
id:
|
|
3350
|
-
climbId:
|
|
3351
|
-
roundId:
|
|
3352
|
-
trialId:
|
|
3241
|
+
var climbActivityKindSchema = z32.enum(CLIMB_ACTIVITY_KINDS);
|
|
3242
|
+
var proposerTraceStepSchema = z32.object({
|
|
3243
|
+
tool: z32.string(),
|
|
3244
|
+
args: z32.string(),
|
|
3245
|
+
result: z32.string().nullable(),
|
|
3246
|
+
isError: z32.boolean().optional()
|
|
3247
|
+
});
|
|
3248
|
+
var proposerTraceSchema = z32.object({
|
|
3249
|
+
steps: z32.array(proposerTraceStepSchema),
|
|
3250
|
+
reasoning: z32.string(),
|
|
3251
|
+
durationMs: z32.number().int().nonnegative(),
|
|
3252
|
+
model: z32.string()
|
|
3253
|
+
});
|
|
3254
|
+
var climbActivitySchema = z32.object({
|
|
3255
|
+
id: z32.string(),
|
|
3256
|
+
climbId: z32.string(),
|
|
3257
|
+
roundId: z32.string().nullable(),
|
|
3258
|
+
trialId: z32.string().nullable(),
|
|
3353
3259
|
kind: climbActivityKindSchema,
|
|
3354
|
-
actorUserId:
|
|
3355
|
-
actorName:
|
|
3356
|
-
summary:
|
|
3357
|
-
detail:
|
|
3358
|
-
createdAt:
|
|
3359
|
-
});
|
|
3360
|
-
var activityQuerySchema =
|
|
3361
|
-
after:
|
|
3362
|
-
limit:
|
|
3363
|
-
});
|
|
3364
|
-
var climbConfigSnapshotSchema =
|
|
3365
|
-
promptText:
|
|
3366
|
-
scenario:
|
|
3367
|
-
repoUrl:
|
|
3368
|
-
repoRef:
|
|
3369
|
-
profileId:
|
|
3370
|
-
profileName:
|
|
3371
|
-
profileDescription:
|
|
3372
|
-
profileModel:
|
|
3373
|
-
limits:
|
|
3374
|
-
agents:
|
|
3375
|
-
skillRefs:
|
|
3376
|
-
mcpRefs:
|
|
3377
|
-
skillVersionIds:
|
|
3378
|
-
mcpServerVersionIds:
|
|
3379
|
-
skillSet:
|
|
3380
|
-
mcpSet:
|
|
3381
|
-
connectionIds:
|
|
3382
|
-
connectionSet:
|
|
3383
|
-
agentContext:
|
|
3384
|
-
agentContextDigest:
|
|
3260
|
+
actorUserId: z32.string().nullable(),
|
|
3261
|
+
actorName: z32.string().nullable(),
|
|
3262
|
+
summary: z32.string(),
|
|
3263
|
+
detail: z32.unknown().nullable(),
|
|
3264
|
+
createdAt: z32.string()
|
|
3265
|
+
});
|
|
3266
|
+
var activityQuerySchema = z32.object({
|
|
3267
|
+
after: z32.string().datetime().optional(),
|
|
3268
|
+
limit: z32.coerce.number().int().min(1).max(500).default(500)
|
|
3269
|
+
});
|
|
3270
|
+
var climbConfigSnapshotSchema = z32.object({
|
|
3271
|
+
promptText: z32.string(),
|
|
3272
|
+
scenario: z32.enum(["GREENFIELD", "MIGRATION"]),
|
|
3273
|
+
repoUrl: z32.string().nullable(),
|
|
3274
|
+
repoRef: z32.string().nullable(),
|
|
3275
|
+
profileId: z32.string().nullable(),
|
|
3276
|
+
profileName: z32.string().nullable(),
|
|
3277
|
+
profileDescription: z32.string().nullable(),
|
|
3278
|
+
profileModel: z32.string().nullable(),
|
|
3279
|
+
limits: z32.json(),
|
|
3280
|
+
agents: z32.array(agentConfigSchema).min(1),
|
|
3281
|
+
skillRefs: z32.array(z32.string()),
|
|
3282
|
+
mcpRefs: z32.array(z32.string()),
|
|
3283
|
+
skillVersionIds: z32.array(z32.string()),
|
|
3284
|
+
mcpServerVersionIds: z32.array(z32.string()),
|
|
3285
|
+
skillSet: z32.json().nullable(),
|
|
3286
|
+
mcpSet: z32.json().nullable(),
|
|
3287
|
+
connectionIds: z32.array(z32.string()),
|
|
3288
|
+
connectionSet: z32.json().nullable(),
|
|
3289
|
+
agentContext: z32.json().nullable(),
|
|
3290
|
+
agentContextDigest: z32.string().nullable(),
|
|
3385
3291
|
webFixture: webFixtureSchema.nullable(),
|
|
3386
|
-
cliIntervention:
|
|
3292
|
+
cliIntervention: cliRuleBundleSchema.nullable().default(null),
|
|
3387
3293
|
sandboxOverrides: sandboxOverridesSchema.nullable(),
|
|
3388
|
-
visibilityScenarioId:
|
|
3294
|
+
visibilityScenarioId: z32.string().nullable()
|
|
3389
3295
|
}).strict();
|
|
3390
|
-
var targetRefSchema =
|
|
3391
|
-
kind:
|
|
3392
|
-
id:
|
|
3393
|
-
url:
|
|
3394
|
-
package:
|
|
3296
|
+
var targetRefSchema = z32.object({
|
|
3297
|
+
kind: z32.string().min(1),
|
|
3298
|
+
id: z32.string().optional(),
|
|
3299
|
+
url: z32.url().optional(),
|
|
3300
|
+
package: z32.string().optional()
|
|
3395
3301
|
}).strict();
|
|
3396
|
-
var trialInputSchema =
|
|
3397
|
-
title:
|
|
3398
|
-
hypothesis:
|
|
3302
|
+
var trialInputSchema = z32.object({
|
|
3303
|
+
title: z32.string().trim().min(1).max(200),
|
|
3304
|
+
hypothesis: z32.string().max(4e3).optional(),
|
|
3399
3305
|
lever: leverKindSchema,
|
|
3400
3306
|
targetRef: targetRefSchema.optional(),
|
|
3401
3307
|
intervention: interventionSchema,
|
|
3402
|
-
authorMode:
|
|
3308
|
+
authorMode: z32.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL")
|
|
3403
3309
|
}).strict().superRefine((value, ctx) => {
|
|
3404
3310
|
const allowed = LEVER_INTERVENTIONS[value.lever];
|
|
3405
3311
|
if (!allowed.includes(value.intervention.kind))
|
|
@@ -3418,7 +3324,7 @@ var OPTIMIZATION_STATUSES = [
|
|
|
3418
3324
|
"DONE",
|
|
3419
3325
|
"ARCHIVED"
|
|
3420
3326
|
];
|
|
3421
|
-
var optimizationStatusSchema =
|
|
3327
|
+
var optimizationStatusSchema = z33.enum(OPTIMIZATION_STATUSES);
|
|
3422
3328
|
var ROUND_STATUSES = [
|
|
3423
3329
|
"PROPOSING",
|
|
3424
3330
|
"PROPOSED",
|
|
@@ -3447,61 +3353,61 @@ var OPTIMIZATION_EFFORTS = [
|
|
|
3447
3353
|
{ value: "HIGH", label: "Thorough", sampleCount: 2, maxRounds: 8 },
|
|
3448
3354
|
{ value: "XHIGH", label: "Exhaustive", sampleCount: 3, maxRounds: 12 }
|
|
3449
3355
|
];
|
|
3450
|
-
var optimizationEffortSchema =
|
|
3356
|
+
var optimizationEffortSchema = z33.enum(
|
|
3451
3357
|
OPTIMIZATION_EFFORTS.map((preset) => preset.value)
|
|
3452
3358
|
);
|
|
3453
|
-
var listOptimizationsQuerySchema =
|
|
3454
|
-
status:
|
|
3359
|
+
var listOptimizationsQuerySchema = z33.object({
|
|
3360
|
+
status: z33.string().optional().transform(
|
|
3455
3361
|
(value) => value ? value.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean) : void 0
|
|
3456
|
-
).pipe(
|
|
3362
|
+
).pipe(z33.array(optimizationStatusSchema).optional()),
|
|
3457
3363
|
subjectKind: climbSubjectKindSchema.optional(),
|
|
3458
|
-
subjectId:
|
|
3459
|
-
limit:
|
|
3364
|
+
subjectId: z33.string().min(1).optional(),
|
|
3365
|
+
limit: z33.coerce.number().int().min(1).max(200).default(50),
|
|
3460
3366
|
/** Drafts are workspaces, not runs; older clients never see them. */
|
|
3461
|
-
includeDrafts:
|
|
3367
|
+
includeDrafts: z33.union([z33.boolean(), z33.string()]).optional().transform((value) => value === true || value === "true" || value === "1")
|
|
3462
3368
|
});
|
|
3463
|
-
var optimizationSummarySchema =
|
|
3464
|
-
id:
|
|
3465
|
-
name:
|
|
3369
|
+
var optimizationSummarySchema = z33.object({
|
|
3370
|
+
id: z33.string(),
|
|
3371
|
+
name: z33.string(),
|
|
3466
3372
|
status: optimizationStatusSchema,
|
|
3467
|
-
mode:
|
|
3373
|
+
mode: z33.enum(["MANUAL", "AUTO"]),
|
|
3468
3374
|
/** Autonomous launches every proposed round; interactive waits for one. */
|
|
3469
|
-
autonomous:
|
|
3470
|
-
stopReason:
|
|
3375
|
+
autonomous: z33.boolean(),
|
|
3376
|
+
stopReason: z33.string().nullable(),
|
|
3471
3377
|
subjectKind: climbSubjectKindSchema,
|
|
3472
|
-
subjectId:
|
|
3473
|
-
subjectName:
|
|
3378
|
+
subjectId: z33.string(),
|
|
3379
|
+
subjectName: z33.string(),
|
|
3474
3380
|
lever: leverKindSchema.nullable(),
|
|
3475
|
-
round:
|
|
3476
|
-
maxRounds:
|
|
3381
|
+
round: z33.number().int(),
|
|
3382
|
+
maxRounds: z33.number().int(),
|
|
3477
3383
|
/** Starting baseline score, 0..1. */
|
|
3478
|
-
before:
|
|
3384
|
+
before: z33.number().nullable(),
|
|
3479
3385
|
/** Score of the marked winner, or best BETTER trial, 0..1. */
|
|
3480
|
-
after:
|
|
3386
|
+
after: z33.number().nullable(),
|
|
3481
3387
|
/** Percentage-point change from the baseline to the winner or best BETTER trial. */
|
|
3482
|
-
delta:
|
|
3388
|
+
delta: z33.number().nullable(),
|
|
3483
3389
|
/** Score after each round, baseline first. */
|
|
3484
|
-
path:
|
|
3485
|
-
creditsSpent:
|
|
3486
|
-
creditsReserved:
|
|
3487
|
-
summary:
|
|
3488
|
-
href:
|
|
3489
|
-
createdAt:
|
|
3490
|
-
updatedAt:
|
|
3491
|
-
});
|
|
3492
|
-
var listOptimizationsResponseSchema =
|
|
3493
|
-
items:
|
|
3494
|
-
});
|
|
3495
|
-
var targetSchema =
|
|
3390
|
+
path: z33.array(z33.number()),
|
|
3391
|
+
creditsSpent: z33.number().int(),
|
|
3392
|
+
creditsReserved: z33.number().int(),
|
|
3393
|
+
summary: z33.string().nullable(),
|
|
3394
|
+
href: z33.string(),
|
|
3395
|
+
createdAt: z33.string(),
|
|
3396
|
+
updatedAt: z33.string()
|
|
3397
|
+
});
|
|
3398
|
+
var listOptimizationsResponseSchema = z33.object({
|
|
3399
|
+
items: z33.array(optimizationSummarySchema)
|
|
3400
|
+
});
|
|
3401
|
+
var targetSchema = z33.object({
|
|
3496
3402
|
agent: schedulableAgentSchema.optional(),
|
|
3497
3403
|
/** Empty or omitted means the agent's default model. */
|
|
3498
|
-
model:
|
|
3404
|
+
model: z33.string().optional()
|
|
3499
3405
|
});
|
|
3500
3406
|
var planShape = {
|
|
3501
3407
|
effort: optimizationEffortSchema.optional(),
|
|
3502
|
-
sampleCount:
|
|
3503
|
-
maxRounds:
|
|
3504
|
-
maxTrialsPerRound:
|
|
3408
|
+
sampleCount: z33.number().int().min(1).max(100).optional(),
|
|
3409
|
+
maxRounds: z33.number().int().min(1).max(100).optional(),
|
|
3410
|
+
maxTrialsPerRound: z33.number().int().min(1).max(10).optional()
|
|
3505
3411
|
};
|
|
3506
3412
|
function refinePlan(value, ctx) {
|
|
3507
3413
|
if (value.effort && (value.sampleCount || value.maxRounds))
|
|
@@ -3517,18 +3423,18 @@ function refinePlan(value, ctx) {
|
|
|
3517
3423
|
message: "Pin an agent with the model"
|
|
3518
3424
|
});
|
|
3519
3425
|
}
|
|
3520
|
-
var startOptimizationBodySchema =
|
|
3426
|
+
var startOptimizationBodySchema = z33.object({
|
|
3521
3427
|
subjectKind: climbSubjectKindSchema,
|
|
3522
|
-
subjectId:
|
|
3523
|
-
name:
|
|
3428
|
+
subjectId: z33.string().min(1),
|
|
3429
|
+
name: z33.string().trim().min(1).max(200).optional(),
|
|
3524
3430
|
...planShape,
|
|
3525
|
-
creditCap:
|
|
3526
|
-
targetScore:
|
|
3431
|
+
creditCap: z33.number().int().nonnegative().optional(),
|
|
3432
|
+
targetScore: z33.number().min(0).max(1).optional(),
|
|
3527
3433
|
target: targetSchema.extend({ agent: schedulableAgentSchema })
|
|
3528
3434
|
}).strict().superRefine(refinePlan);
|
|
3529
|
-
var estimateOptimizationBodySchema =
|
|
3435
|
+
var estimateOptimizationBodySchema = z33.object({
|
|
3530
3436
|
subjectKind: climbSubjectKindSchema,
|
|
3531
|
-
subjectId:
|
|
3437
|
+
subjectId: z33.string().min(1),
|
|
3532
3438
|
...planShape,
|
|
3533
3439
|
target: targetSchema.optional()
|
|
3534
3440
|
}).strict().superRefine(refinePlan);
|
|
@@ -3540,105 +3446,105 @@ var RUN_CREDIT_BASES = [
|
|
|
3540
3446
|
"byok",
|
|
3541
3447
|
"reserve"
|
|
3542
3448
|
];
|
|
3543
|
-
var runCreditBasisSchema =
|
|
3544
|
-
var optimizationEstimateSchema =
|
|
3545
|
-
sampleCount:
|
|
3546
|
-
maxRounds:
|
|
3547
|
-
runsPerTrial:
|
|
3548
|
-
executionCredits:
|
|
3549
|
-
judgeCredits:
|
|
3550
|
-
leverPassCredits:
|
|
3551
|
-
trialCredits:
|
|
3449
|
+
var runCreditBasisSchema = z33.enum(RUN_CREDIT_BASES);
|
|
3450
|
+
var optimizationEstimateSchema = z33.object({
|
|
3451
|
+
sampleCount: z33.number().int(),
|
|
3452
|
+
maxRounds: z33.number().int(),
|
|
3453
|
+
runsPerTrial: z33.number(),
|
|
3454
|
+
executionCredits: z33.number(),
|
|
3455
|
+
judgeCredits: z33.number(),
|
|
3456
|
+
leverPassCredits: z33.number(),
|
|
3457
|
+
trialCredits: z33.number(),
|
|
3552
3458
|
/** Estimate, not a reservation or enforced spending cap. */
|
|
3553
|
-
estimate:
|
|
3459
|
+
estimate: z33.number().int(),
|
|
3554
3460
|
/** True when no price or history covered a model: a bound, not a forecast. */
|
|
3555
|
-
approximate:
|
|
3461
|
+
approximate: z33.boolean().default(false),
|
|
3556
3462
|
/** Which rung priced the run, so the UI can say why a figure is what it is. */
|
|
3557
3463
|
basis: runCreditBasisSchema.optional()
|
|
3558
3464
|
});
|
|
3559
|
-
var diagnoseBodySchema =
|
|
3465
|
+
var diagnoseBodySchema = z33.object({
|
|
3560
3466
|
subjectKind: climbSubjectKindSchema,
|
|
3561
|
-
subjectId:
|
|
3467
|
+
subjectId: z33.string().min(1)
|
|
3562
3468
|
}).strict();
|
|
3563
|
-
var diagnosisSchema =
|
|
3564
|
-
id:
|
|
3565
|
-
status:
|
|
3469
|
+
var diagnosisSchema = z33.object({
|
|
3470
|
+
id: z33.string(),
|
|
3471
|
+
status: z33.enum(["GENERATING", "READY", "FAILED"]),
|
|
3566
3472
|
subjectKind: climbSubjectKindSchema,
|
|
3567
|
-
subjectId:
|
|
3568
|
-
runCount:
|
|
3569
|
-
summary:
|
|
3473
|
+
subjectId: z33.string(),
|
|
3474
|
+
runCount: z33.number().int(),
|
|
3475
|
+
summary: z33.string().nullable(),
|
|
3570
3476
|
recommendedLever: leverKindSchema.nullable(),
|
|
3571
|
-
recommendedTarget:
|
|
3572
|
-
clusters:
|
|
3573
|
-
|
|
3574
|
-
title:
|
|
3575
|
-
failureMode:
|
|
3576
|
-
criterionIds:
|
|
3577
|
-
runIds:
|
|
3477
|
+
recommendedTarget: z33.unknown().nullable(),
|
|
3478
|
+
clusters: z33.array(
|
|
3479
|
+
z33.object({
|
|
3480
|
+
title: z33.string(),
|
|
3481
|
+
failureMode: z33.string(),
|
|
3482
|
+
criterionIds: z33.array(z33.string()),
|
|
3483
|
+
runIds: z33.array(z33.string()),
|
|
3578
3484
|
lever: leverKindSchema.nullable(),
|
|
3579
|
-
targetRef:
|
|
3580
|
-
confidence:
|
|
3485
|
+
targetRef: z33.unknown().nullable(),
|
|
3486
|
+
confidence: z33.number()
|
|
3581
3487
|
})
|
|
3582
3488
|
),
|
|
3583
|
-
unsupportedLevers:
|
|
3584
|
-
createdAt:
|
|
3585
|
-
});
|
|
3586
|
-
var trialRunSchema =
|
|
3587
|
-
id:
|
|
3588
|
-
status:
|
|
3589
|
-
failureReason:
|
|
3590
|
-
exitReason:
|
|
3591
|
-
cliCoverage:
|
|
3592
|
-
passed:
|
|
3593
|
-
criteria:
|
|
3594
|
-
|
|
3489
|
+
unsupportedLevers: z33.array(leverKindSchema).default([]),
|
|
3490
|
+
createdAt: z33.string()
|
|
3491
|
+
});
|
|
3492
|
+
var trialRunSchema = z33.object({
|
|
3493
|
+
id: z33.string(),
|
|
3494
|
+
status: z33.string(),
|
|
3495
|
+
failureReason: z33.string().nullable(),
|
|
3496
|
+
exitReason: z33.string().nullable(),
|
|
3497
|
+
cliCoverage: cliRuleCoverageSchema.nullable().optional(),
|
|
3498
|
+
passed: z33.boolean().nullable(),
|
|
3499
|
+
criteria: z33.array(
|
|
3500
|
+
z33.object({ name: z33.string(), passed: z33.boolean(), reasoning: z33.string() })
|
|
3595
3501
|
),
|
|
3596
|
-
levers:
|
|
3597
|
-
|
|
3598
|
-
lever:
|
|
3599
|
-
attributed:
|
|
3600
|
-
note:
|
|
3502
|
+
levers: z33.array(
|
|
3503
|
+
z33.object({
|
|
3504
|
+
lever: z33.string(),
|
|
3505
|
+
attributed: z33.boolean(),
|
|
3506
|
+
note: z33.string().nullable()
|
|
3601
3507
|
})
|
|
3602
3508
|
)
|
|
3603
3509
|
});
|
|
3604
|
-
var trialSchema =
|
|
3605
|
-
id:
|
|
3606
|
-
climbId:
|
|
3607
|
-
roundNumber:
|
|
3608
|
-
key:
|
|
3510
|
+
var trialSchema = z33.object({
|
|
3511
|
+
id: z33.string(),
|
|
3512
|
+
climbId: z33.string(),
|
|
3513
|
+
roundNumber: z33.number().int(),
|
|
3514
|
+
key: z33.string(),
|
|
3609
3515
|
/** @deprecated All trials branch from the baseline. */
|
|
3610
|
-
parentTrialId:
|
|
3516
|
+
parentTrialId: z33.string().nullable(),
|
|
3611
3517
|
/** @deprecated Always the baseline key for non-baseline trials. */
|
|
3612
|
-
parentKey:
|
|
3613
|
-
title:
|
|
3614
|
-
hypothesis:
|
|
3518
|
+
parentKey: z33.string().nullable(),
|
|
3519
|
+
title: z33.string(),
|
|
3520
|
+
hypothesis: z33.string().nullable(),
|
|
3615
3521
|
lever: leverKindSchema.nullable(),
|
|
3616
3522
|
kind: interventionKindSchema,
|
|
3617
|
-
status:
|
|
3618
|
-
verdict:
|
|
3619
|
-
score:
|
|
3620
|
-
baselineScore:
|
|
3523
|
+
status: z33.enum(TRIAL_STATUSES),
|
|
3524
|
+
verdict: z33.enum(TRIAL_VERDICTS).nullable(),
|
|
3525
|
+
score: z33.number().nullable(),
|
|
3526
|
+
baselineScore: z33.number().nullable(),
|
|
3621
3527
|
/** Judged sessions behind `score`. */
|
|
3622
|
-
sessions:
|
|
3528
|
+
sessions: z33.number().int(),
|
|
3623
3529
|
/** Sessions that FAILED or TIMED_OUT; `score` leaves them out. */
|
|
3624
|
-
failedSessions:
|
|
3625
|
-
isBaseline:
|
|
3530
|
+
failedSessions: z33.number().int(),
|
|
3531
|
+
isBaseline: z33.boolean(),
|
|
3626
3532
|
/** The user marked this trial as the winner; it does not move the baseline. */
|
|
3627
|
-
adopted:
|
|
3628
|
-
adoptedAt:
|
|
3629
|
-
outcome:
|
|
3533
|
+
adopted: z33.boolean(),
|
|
3534
|
+
adoptedAt: z33.string().nullable(),
|
|
3535
|
+
outcome: z33.string().nullable(),
|
|
3630
3536
|
/** The kind-specific `after` payload (skill version id, pages, package). */
|
|
3631
|
-
after:
|
|
3632
|
-
before:
|
|
3633
|
-
runs:
|
|
3634
|
-
createdAt:
|
|
3635
|
-
});
|
|
3636
|
-
var roundSchema =
|
|
3637
|
-
id:
|
|
3638
|
-
number:
|
|
3639
|
-
status:
|
|
3640
|
-
narrative:
|
|
3641
|
-
trials:
|
|
3537
|
+
after: z33.unknown(),
|
|
3538
|
+
before: z33.unknown(),
|
|
3539
|
+
runs: z33.array(trialRunSchema),
|
|
3540
|
+
createdAt: z33.string()
|
|
3541
|
+
});
|
|
3542
|
+
var roundSchema = z33.object({
|
|
3543
|
+
id: z33.string(),
|
|
3544
|
+
number: z33.number().int(),
|
|
3545
|
+
status: z33.enum(ROUND_STATUSES),
|
|
3546
|
+
narrative: z33.string().nullable(),
|
|
3547
|
+
trials: z33.array(trialSchema)
|
|
3642
3548
|
});
|
|
3643
3549
|
var OPTIMIZATION_NEXT_ACTIONS = [
|
|
3644
3550
|
"START",
|
|
@@ -3649,366 +3555,420 @@ var OPTIMIZATION_NEXT_ACTIONS = [
|
|
|
3649
3555
|
"RESUME",
|
|
3650
3556
|
"NONE"
|
|
3651
3557
|
];
|
|
3652
|
-
var optimizationNextActionSchema =
|
|
3558
|
+
var optimizationNextActionSchema = z33.enum(OPTIMIZATION_NEXT_ACTIONS);
|
|
3653
3559
|
var optimizationDetailSchema = optimizationSummarySchema.extend({
|
|
3654
|
-
baselineTrialId:
|
|
3560
|
+
baselineTrialId: z33.string().nullable(),
|
|
3655
3561
|
/** The one thing a client does next. WAIT and NONE need nobody. */
|
|
3656
3562
|
nextAction: optimizationNextActionSchema,
|
|
3657
|
-
settings:
|
|
3658
|
-
sampleCount:
|
|
3659
|
-
maxRounds:
|
|
3660
|
-
maxTrialsPerRound:
|
|
3661
|
-
creditCap:
|
|
3662
|
-
targetScore:
|
|
3663
|
-
pinnedAgent:
|
|
3664
|
-
pinnedModel:
|
|
3665
|
-
continuedAtRound:
|
|
3563
|
+
settings: z33.object({
|
|
3564
|
+
sampleCount: z33.number().int(),
|
|
3565
|
+
maxRounds: z33.number().int(),
|
|
3566
|
+
maxTrialsPerRound: z33.number().int(),
|
|
3567
|
+
creditCap: z33.number().int(),
|
|
3568
|
+
targetScore: z33.number(),
|
|
3569
|
+
pinnedAgent: z33.string().nullable(),
|
|
3570
|
+
pinnedModel: z33.string().nullable(),
|
|
3571
|
+
continuedAtRound: z33.number().int().nullable()
|
|
3666
3572
|
}),
|
|
3667
3573
|
direction: climbDirectionSchema,
|
|
3668
|
-
rounds:
|
|
3574
|
+
rounds: z33.array(roundSchema)
|
|
3669
3575
|
});
|
|
3670
|
-
var optimizationHandoffSchema =
|
|
3671
|
-
trialId:
|
|
3672
|
-
trialKey:
|
|
3673
|
-
prompt:
|
|
3576
|
+
var optimizationHandoffSchema = z33.object({
|
|
3577
|
+
trialId: z33.string(),
|
|
3578
|
+
trialKey: z33.string(),
|
|
3579
|
+
prompt: z33.string()
|
|
3674
3580
|
});
|
|
3675
|
-
var listTrialsResponseSchema =
|
|
3676
|
-
items:
|
|
3581
|
+
var listTrialsResponseSchema = z33.object({
|
|
3582
|
+
items: z33.array(trialSchema)
|
|
3677
3583
|
});
|
|
3678
|
-
var trialDocumentSchema =
|
|
3679
|
-
path:
|
|
3680
|
-
before:
|
|
3681
|
-
after:
|
|
3584
|
+
var trialDocumentSchema = z33.object({
|
|
3585
|
+
path: z33.string(),
|
|
3586
|
+
before: z33.string(),
|
|
3587
|
+
after: z33.string()
|
|
3682
3588
|
});
|
|
3683
|
-
var trialContentSchema =
|
|
3684
|
-
trialId:
|
|
3589
|
+
var trialContentSchema = z33.object({
|
|
3590
|
+
trialId: z33.string(),
|
|
3685
3591
|
kind: interventionKindSchema,
|
|
3686
|
-
documents:
|
|
3592
|
+
documents: z33.array(trialDocumentSchema),
|
|
3687
3593
|
/** Full page bodies for a docs rewrite, ready to paste; null otherwise. */
|
|
3688
|
-
copyableBody:
|
|
3689
|
-
configSnapshot:
|
|
3594
|
+
copyableBody: z33.string().nullable(),
|
|
3595
|
+
configSnapshot: z33.unknown()
|
|
3690
3596
|
});
|
|
3691
|
-
var createTrialBodySchema =
|
|
3597
|
+
var createTrialBodySchema = z33.object({
|
|
3692
3598
|
trial: trialInputSchema,
|
|
3693
3599
|
files: overrideFilesSchema.optional(),
|
|
3694
|
-
fork:
|
|
3695
|
-
launch:
|
|
3600
|
+
fork: z33.object({ runId: z33.string().min(1), boundarySeq: z33.string().min(1) }).strict().optional(),
|
|
3601
|
+
launch: z33.boolean().default(false),
|
|
3696
3602
|
/** Replays return the trial the first call created instead of a second
|
|
3697
3603
|
* one. Scoped to the optimization. */
|
|
3698
|
-
idempotencyKey:
|
|
3604
|
+
idempotencyKey: z33.string().min(1).max(200).optional()
|
|
3699
3605
|
}).strict();
|
|
3700
|
-
var skillFilesResponseSchema =
|
|
3701
|
-
versionId:
|
|
3606
|
+
var skillFilesResponseSchema = z33.object({
|
|
3607
|
+
versionId: z33.string(),
|
|
3702
3608
|
files: overrideFilesSchema
|
|
3703
3609
|
});
|
|
3704
|
-
var pageBodyResponseSchema =
|
|
3705
|
-
url:
|
|
3706
|
-
body:
|
|
3707
|
-
contentType:
|
|
3610
|
+
var pageBodyResponseSchema = z33.object({
|
|
3611
|
+
url: z33.string(),
|
|
3612
|
+
body: z33.string(),
|
|
3613
|
+
contentType: z33.string().optional()
|
|
3708
3614
|
});
|
|
3709
|
-
var launchTrialResponseSchema =
|
|
3710
|
-
trialId:
|
|
3711
|
-
batchIds:
|
|
3712
|
-
runIds:
|
|
3615
|
+
var launchTrialResponseSchema = z33.object({
|
|
3616
|
+
trialId: z33.string(),
|
|
3617
|
+
batchIds: z33.array(z33.string()),
|
|
3618
|
+
runIds: z33.array(z33.string())
|
|
3713
3619
|
});
|
|
3714
|
-
var createDraftOptimizationBodySchema =
|
|
3620
|
+
var createDraftOptimizationBodySchema = z33.object({
|
|
3715
3621
|
subjectKind: climbSubjectKindSchema,
|
|
3716
|
-
subjectId:
|
|
3717
|
-
name:
|
|
3622
|
+
subjectId: z33.string().min(1),
|
|
3623
|
+
name: z33.string().trim().min(1).max(200).optional(),
|
|
3718
3624
|
...planShape,
|
|
3719
3625
|
target: targetSchema.optional(),
|
|
3720
|
-
autonomous:
|
|
3626
|
+
autonomous: z33.boolean().optional()
|
|
3721
3627
|
}).strict().superRefine(refinePlan);
|
|
3722
3628
|
var planPatchShape = {
|
|
3723
|
-
name:
|
|
3629
|
+
name: z33.string().trim().min(1).max(200).optional(),
|
|
3724
3630
|
...planShape,
|
|
3725
3631
|
target: targetSchema.optional()
|
|
3726
3632
|
};
|
|
3727
|
-
var optimizationPlanPatchSchema =
|
|
3728
|
-
var startDraftOptimizationBodySchema =
|
|
3633
|
+
var optimizationPlanPatchSchema = z33.object(planPatchShape).strict().superRefine(refinePlan);
|
|
3634
|
+
var startDraftOptimizationBodySchema = z33.object({
|
|
3729
3635
|
...planPatchShape,
|
|
3730
|
-
creditCap:
|
|
3636
|
+
creditCap: z33.number().int().nonnegative().optional()
|
|
3731
3637
|
}).strict().superRefine(refinePlan);
|
|
3732
|
-
var setModeBodySchema =
|
|
3733
|
-
var launchRoundResponseSchema =
|
|
3734
|
-
roundNumber:
|
|
3735
|
-
launched:
|
|
3638
|
+
var setModeBodySchema = z33.object({ autonomous: z33.boolean() }).strict();
|
|
3639
|
+
var launchRoundResponseSchema = z33.object({
|
|
3640
|
+
roundNumber: z33.number().int().nullable(),
|
|
3641
|
+
launched: z33.array(z33.string()),
|
|
3736
3642
|
/** True when nothing was left to launch: someone else got there first. */
|
|
3737
|
-
alreadyLaunched:
|
|
3643
|
+
alreadyLaunched: z33.boolean()
|
|
3738
3644
|
});
|
|
3739
|
-
var resolveChatResponseSchema =
|
|
3740
|
-
chatId:
|
|
3741
|
-
href:
|
|
3645
|
+
var resolveChatResponseSchema = z33.object({
|
|
3646
|
+
chatId: z33.string(),
|
|
3647
|
+
href: z33.string()
|
|
3742
3648
|
});
|
|
3743
|
-
var continueOptimizationBodySchema =
|
|
3744
|
-
rounds:
|
|
3745
|
-
maxTrialsPerRound:
|
|
3649
|
+
var continueOptimizationBodySchema = z33.object({
|
|
3650
|
+
rounds: z33.number().int().min(1).max(20).default(1),
|
|
3651
|
+
maxTrialsPerRound: z33.number().int().min(1).max(10).optional()
|
|
3746
3652
|
}).strict();
|
|
3747
|
-
var patchOptimizationBodySchema =
|
|
3653
|
+
var patchOptimizationBodySchema = z33.object({
|
|
3748
3654
|
...planPatchShape,
|
|
3749
3655
|
direction: climbDirectionPatchSchema.optional(),
|
|
3750
|
-
autonomous:
|
|
3656
|
+
autonomous: z33.boolean().optional()
|
|
3751
3657
|
}).strict().superRefine(refinePlan);
|
|
3752
3658
|
|
|
3753
3659
|
// ../packages/api-schemas/src/orgs.ts
|
|
3754
|
-
import { z as
|
|
3755
|
-
var createOrgRequestSchema =
|
|
3660
|
+
import { z as z34 } from "zod";
|
|
3661
|
+
var createOrgRequestSchema = z34.object({
|
|
3756
3662
|
/** Workspace display name; the slug is derived server-side. */
|
|
3757
|
-
name:
|
|
3663
|
+
name: z34.string().trim().min(1).max(200),
|
|
3758
3664
|
/** Optional company site (logo source; stamped onto the org). */
|
|
3759
|
-
website:
|
|
3665
|
+
website: z34.string().trim().max(300).optional()
|
|
3760
3666
|
});
|
|
3761
|
-
var createOrgResponseSchema =
|
|
3762
|
-
slug:
|
|
3763
|
-
name:
|
|
3667
|
+
var createOrgResponseSchema = z34.object({
|
|
3668
|
+
slug: z34.string(),
|
|
3669
|
+
name: z34.string(),
|
|
3764
3670
|
// LOCAL orgs never have a Gauge publicId.
|
|
3765
|
-
publicId:
|
|
3671
|
+
publicId: z34.string().nullable()
|
|
3766
3672
|
});
|
|
3767
|
-
var orgSettingsSchema =
|
|
3768
|
-
slug:
|
|
3769
|
-
name:
|
|
3770
|
-
publicId:
|
|
3771
|
-
website:
|
|
3673
|
+
var orgSettingsSchema = z34.object({
|
|
3674
|
+
slug: z34.string(),
|
|
3675
|
+
name: z34.string(),
|
|
3676
|
+
publicId: z34.string().nullable(),
|
|
3677
|
+
website: z34.string().nullable(),
|
|
3772
3678
|
/** Per-run max-spend override in USD; null = the server default. */
|
|
3773
|
-
maxSpendUsd:
|
|
3774
|
-
overageEnabled:
|
|
3679
|
+
maxSpendUsd: z34.number().nullable(),
|
|
3680
|
+
overageEnabled: z34.boolean(),
|
|
3775
3681
|
/** Per-cycle overage cap in credits; null = uncapped. */
|
|
3776
|
-
overageCapCredits:
|
|
3682
|
+
overageCapCredits: z34.number().int().nullable(),
|
|
3777
3683
|
/** Domain claimed for same-domain auto-join; null = off. */
|
|
3778
|
-
autoJoinDomain:
|
|
3684
|
+
autoJoinDomain: z34.string().nullable()
|
|
3779
3685
|
});
|
|
3780
|
-
var orgMemberSchema =
|
|
3781
|
-
userId:
|
|
3782
|
-
name:
|
|
3783
|
-
email:
|
|
3784
|
-
joinedAt:
|
|
3686
|
+
var orgMemberSchema = z34.object({
|
|
3687
|
+
userId: z34.string(),
|
|
3688
|
+
name: z34.string().nullable(),
|
|
3689
|
+
email: z34.string().nullable(),
|
|
3690
|
+
joinedAt: z34.string()
|
|
3785
3691
|
});
|
|
3786
|
-
var listMembersResponseSchema =
|
|
3787
|
-
items:
|
|
3692
|
+
var listMembersResponseSchema = z34.object({
|
|
3693
|
+
items: z34.array(orgMemberSchema)
|
|
3788
3694
|
});
|
|
3789
3695
|
|
|
3790
3696
|
// ../packages/api-schemas/src/personas.ts
|
|
3791
|
-
import { z as
|
|
3792
|
-
var personaSchema =
|
|
3793
|
-
id:
|
|
3794
|
-
name:
|
|
3795
|
-
description:
|
|
3697
|
+
import { z as z35 } from "zod";
|
|
3698
|
+
var personaSchema = z35.object({
|
|
3699
|
+
id: z35.string(),
|
|
3700
|
+
name: z35.string(),
|
|
3701
|
+
description: z35.string(),
|
|
3796
3702
|
/** The judge model this persona calls (Claude only). */
|
|
3797
|
-
model:
|
|
3798
|
-
createdAt:
|
|
3799
|
-
updatedAt:
|
|
3703
|
+
model: z35.string(),
|
|
3704
|
+
createdAt: z35.string(),
|
|
3705
|
+
updatedAt: z35.string()
|
|
3800
3706
|
});
|
|
3801
|
-
var listPersonasResponseSchema =
|
|
3802
|
-
items:
|
|
3707
|
+
var listPersonasResponseSchema = z35.object({
|
|
3708
|
+
items: z35.array(personaSchema)
|
|
3803
3709
|
});
|
|
3804
|
-
var createPersonaBodySchema =
|
|
3805
|
-
name:
|
|
3806
|
-
description:
|
|
3710
|
+
var createPersonaBodySchema = z35.object({
|
|
3711
|
+
name: z35.string().min(1).max(120),
|
|
3712
|
+
description: z35.string().min(1)
|
|
3807
3713
|
});
|
|
3808
|
-
var updatePersonaBodySchema =
|
|
3809
|
-
name:
|
|
3810
|
-
description:
|
|
3714
|
+
var updatePersonaBodySchema = z35.object({
|
|
3715
|
+
name: z35.string().min(1).max(120).optional(),
|
|
3716
|
+
description: z35.string().min(1).optional()
|
|
3811
3717
|
});
|
|
3812
3718
|
|
|
3813
3719
|
// ../packages/api-schemas/src/prompts.ts
|
|
3814
|
-
import { z as
|
|
3720
|
+
import { z as z38 } from "zod";
|
|
3815
3721
|
|
|
3816
3722
|
// ../packages/api-schemas/src/tags.ts
|
|
3817
|
-
import { z as
|
|
3818
|
-
var tagSchema =
|
|
3819
|
-
id:
|
|
3820
|
-
name:
|
|
3723
|
+
import { z as z36 } from "zod";
|
|
3724
|
+
var tagSchema = z36.object({
|
|
3725
|
+
id: z36.string(),
|
|
3726
|
+
name: z36.string(),
|
|
3821
3727
|
/** A Mantine palette name (e.g. "blue", "grape"); unknown values are
|
|
3822
3728
|
* normalized server-side to the default ("gray"). */
|
|
3823
|
-
color:
|
|
3729
|
+
color: z36.string()
|
|
3824
3730
|
});
|
|
3825
|
-
var createTagBodySchema =
|
|
3826
|
-
name:
|
|
3827
|
-
color:
|
|
3731
|
+
var createTagBodySchema = z36.object({
|
|
3732
|
+
name: z36.string().min(1),
|
|
3733
|
+
color: z36.string().optional()
|
|
3828
3734
|
});
|
|
3829
|
-
var updateTagBodySchema =
|
|
3830
|
-
name:
|
|
3831
|
-
color:
|
|
3735
|
+
var updateTagBodySchema = z36.object({
|
|
3736
|
+
name: z36.string().min(1).optional(),
|
|
3737
|
+
color: z36.string().optional()
|
|
3832
3738
|
});
|
|
3833
3739
|
var tagListResponseSchema = listResponseSchema(tagSchema);
|
|
3834
3740
|
|
|
3835
3741
|
// ../packages/api-schemas/src/topics.ts
|
|
3836
|
-
import { z as
|
|
3837
|
-
var topicSchema =
|
|
3838
|
-
id:
|
|
3839
|
-
name:
|
|
3742
|
+
import { z as z37 } from "zod";
|
|
3743
|
+
var topicSchema = z37.object({
|
|
3744
|
+
id: z37.string(),
|
|
3745
|
+
name: z37.string()
|
|
3840
3746
|
});
|
|
3841
|
-
var createTopicBodySchema =
|
|
3842
|
-
name:
|
|
3747
|
+
var createTopicBodySchema = z37.object({
|
|
3748
|
+
name: z37.string().min(1, "name is required")
|
|
3843
3749
|
});
|
|
3844
3750
|
var topicListResponseSchema = listResponseSchema(topicSchema);
|
|
3845
3751
|
|
|
3846
3752
|
// ../packages/api-schemas/src/prompts.ts
|
|
3847
|
-
var promptSummarySchema =
|
|
3848
|
-
id:
|
|
3849
|
-
text:
|
|
3850
|
-
isBranded:
|
|
3753
|
+
var promptSummarySchema = z38.object({
|
|
3754
|
+
id: z38.string(),
|
|
3755
|
+
text: z38.string(),
|
|
3756
|
+
isBranded: z38.boolean(),
|
|
3851
3757
|
/** Battery-spec identity (idempotent applies); null for UI/CLI-created prompts. */
|
|
3852
|
-
externalKey:
|
|
3758
|
+
externalKey: z38.string().nullable(),
|
|
3853
3759
|
topic: topicSchema.nullable(),
|
|
3854
|
-
tags:
|
|
3855
|
-
createdAt:
|
|
3760
|
+
tags: z38.array(tagSchema),
|
|
3761
|
+
createdAt: z38.string()
|
|
3856
3762
|
});
|
|
3857
3763
|
var promptListResponseSchema = listResponseSchema(promptSummarySchema);
|
|
3858
3764
|
var listPromptsQuerySchema = listQuerySchema.extend({
|
|
3859
|
-
topic:
|
|
3860
|
-
tag:
|
|
3861
|
-
q:
|
|
3862
|
-
});
|
|
3863
|
-
var createPromptBodySchema =
|
|
3864
|
-
text:
|
|
3865
|
-
isBranded:
|
|
3866
|
-
topic:
|
|
3867
|
-
tags:
|
|
3868
|
-
});
|
|
3869
|
-
var updatePromptBodySchema =
|
|
3870
|
-
text:
|
|
3871
|
-
isBranded:
|
|
3872
|
-
topicId:
|
|
3873
|
-
tags:
|
|
3874
|
-
});
|
|
3875
|
-
var runPromptBodySchema =
|
|
3765
|
+
topic: z38.string().min(1).optional(),
|
|
3766
|
+
tag: z38.string().min(1).optional(),
|
|
3767
|
+
q: z38.string().min(1).optional()
|
|
3768
|
+
});
|
|
3769
|
+
var createPromptBodySchema = z38.object({
|
|
3770
|
+
text: z38.string().min(1, "text is required"),
|
|
3771
|
+
isBranded: z38.boolean().default(false),
|
|
3772
|
+
topic: z38.string().min(1).optional(),
|
|
3773
|
+
tags: z38.array(z38.string().min(1)).default([])
|
|
3774
|
+
});
|
|
3775
|
+
var updatePromptBodySchema = z38.object({
|
|
3776
|
+
text: z38.string().min(1).optional(),
|
|
3777
|
+
isBranded: z38.boolean().optional(),
|
|
3778
|
+
topicId: z38.string().min(1).nullish(),
|
|
3779
|
+
tags: z38.array(z38.string().min(1)).optional()
|
|
3780
|
+
});
|
|
3781
|
+
var runPromptBodySchema = z38.object({
|
|
3876
3782
|
/** Preferred paired representation; each agent may pin its own model tiers. */
|
|
3877
|
-
agentConfigs:
|
|
3783
|
+
agentConfigs: z38.array(agentConfigInputSchema).min(1).optional(),
|
|
3878
3784
|
/** Legacy agent set (no per-agent pins), kept during the API transition. */
|
|
3879
|
-
agents:
|
|
3880
|
-
repoUrl:
|
|
3881
|
-
repoRef:
|
|
3882
|
-
samplesPerCycle:
|
|
3785
|
+
agents: z38.array(z38.enum(["CLAUDE_CODE", "CODEX_CLI", "CURSOR"])).min(1, "Select at least one agent").default(["CLAUDE_CODE", "CODEX_CLI"]),
|
|
3786
|
+
repoUrl: z38.string().min(1).nullish(),
|
|
3787
|
+
repoRef: z38.string().min(1).nullish(),
|
|
3788
|
+
samplesPerCycle: z38.number().int().min(1).max(10).default(1),
|
|
3883
3789
|
webFixture: webFixtureSchema.optional()
|
|
3884
3790
|
});
|
|
3885
|
-
var runPromptResponseSchema =
|
|
3886
|
-
batchIds:
|
|
3887
|
-
runIds:
|
|
3888
|
-
blocked:
|
|
3791
|
+
var runPromptResponseSchema = z38.object({
|
|
3792
|
+
batchIds: z38.array(z38.string()),
|
|
3793
|
+
runIds: z38.array(z38.string()),
|
|
3794
|
+
blocked: z38.enum(["insufficient_credits", "needs_provider_key"]).optional()
|
|
3889
3795
|
});
|
|
3890
3796
|
|
|
3891
3797
|
// ../packages/api-schemas/src/repos.ts
|
|
3892
|
-
import { z as
|
|
3798
|
+
import { z as z39 } from "zod";
|
|
3893
3799
|
var REPO_SIZE_BUCKETS = [
|
|
3894
3800
|
"small",
|
|
3895
3801
|
"medium",
|
|
3896
3802
|
"large",
|
|
3897
3803
|
"xlarge"
|
|
3898
3804
|
];
|
|
3899
|
-
var repoSizeBucketSchema =
|
|
3900
|
-
var repoSchema =
|
|
3901
|
-
url:
|
|
3902
|
-
name:
|
|
3903
|
-
isSystem:
|
|
3904
|
-
languages:
|
|
3905
|
-
frameworks:
|
|
3805
|
+
var repoSizeBucketSchema = z39.enum(REPO_SIZE_BUCKETS);
|
|
3806
|
+
var repoSchema = z39.object({
|
|
3807
|
+
url: z39.string(),
|
|
3808
|
+
name: z39.string(),
|
|
3809
|
+
isSystem: z39.boolean(),
|
|
3810
|
+
languages: z39.array(z39.string()),
|
|
3811
|
+
frameworks: z39.array(z39.string()),
|
|
3906
3812
|
/** Faceted labels (complexity:L2, buildable:yes, stack:nextjs, …). */
|
|
3907
|
-
tags:
|
|
3908
|
-
primaryLanguage:
|
|
3909
|
-
sizeKb:
|
|
3813
|
+
tags: z39.array(z39.string()),
|
|
3814
|
+
primaryLanguage: z39.string(),
|
|
3815
|
+
sizeKb: z39.number(),
|
|
3910
3816
|
sizeBucket: repoSizeBucketSchema.nullable(),
|
|
3911
|
-
stars:
|
|
3817
|
+
stars: z39.number()
|
|
3912
3818
|
});
|
|
3913
3819
|
var repoListResponseSchema = listResponseSchema(repoSchema);
|
|
3914
|
-
var addRepoBodySchema =
|
|
3915
|
-
url:
|
|
3820
|
+
var addRepoBodySchema = z39.object({
|
|
3821
|
+
url: z39.string().min(1, "url is required"),
|
|
3916
3822
|
/**
|
|
3917
3823
|
* Reserved (accepted, not yet persisted): the catalog keys repos by URL only
|
|
3918
3824
|
* — `fact_repo` has no ref column and metadata sync always reads the default
|
|
3919
3825
|
* branch. Kept in the wire format so `gauge repos add --ref` is stable once
|
|
3920
3826
|
* the catalog learns refs.
|
|
3921
3827
|
*/
|
|
3922
|
-
ref:
|
|
3828
|
+
ref: z39.string().min(1).optional(),
|
|
3923
3829
|
/** Display name; defaults to the `owner/repo` label of the URL. */
|
|
3924
|
-
name:
|
|
3830
|
+
name: z39.string().min(1).optional(),
|
|
3925
3831
|
/** Manual override; defaults to frameworks detected from the repo's manifests. */
|
|
3926
|
-
frameworks:
|
|
3927
|
-
tags:
|
|
3832
|
+
frameworks: z39.array(z39.string()).optional(),
|
|
3833
|
+
tags: z39.array(z39.string()).optional()
|
|
3928
3834
|
});
|
|
3929
|
-
var updateRepoBodySchema =
|
|
3930
|
-
url:
|
|
3931
|
-
name:
|
|
3932
|
-
frameworks:
|
|
3933
|
-
tags:
|
|
3835
|
+
var updateRepoBodySchema = z39.object({
|
|
3836
|
+
url: z39.string().min(1, "url is required"),
|
|
3837
|
+
name: z39.string().min(1).optional(),
|
|
3838
|
+
frameworks: z39.array(z39.string()).optional(),
|
|
3839
|
+
tags: z39.array(z39.string()).optional()
|
|
3934
3840
|
});
|
|
3935
|
-
var resyncRepoBodySchema =
|
|
3936
|
-
url:
|
|
3841
|
+
var resyncRepoBodySchema = z39.object({
|
|
3842
|
+
url: z39.string().min(1, "url is required")
|
|
3937
3843
|
});
|
|
3938
|
-
var deleteRepoQuerySchema =
|
|
3939
|
-
url:
|
|
3844
|
+
var deleteRepoQuerySchema = z39.object({
|
|
3845
|
+
url: z39.string().min(1, "url is required")
|
|
3940
3846
|
});
|
|
3941
|
-
var repoSyncResultSchema =
|
|
3847
|
+
var repoSyncResultSchema = z39.object({
|
|
3942
3848
|
repo: repoSchema,
|
|
3943
|
-
synced:
|
|
3849
|
+
synced: z39.boolean()
|
|
3944
3850
|
});
|
|
3945
3851
|
|
|
3946
3852
|
// ../packages/api-schemas/src/runAddons.ts
|
|
3947
|
-
import { z as
|
|
3948
|
-
var runAddonsSchema =
|
|
3949
|
-
browser:
|
|
3950
|
-
session:
|
|
3951
|
-
projectId:
|
|
3952
|
-
region:
|
|
3853
|
+
import { z as z40 } from "zod";
|
|
3854
|
+
var runAddonsSchema = z40.object({
|
|
3855
|
+
browser: z40.object({
|
|
3856
|
+
session: z40.string().min(1),
|
|
3857
|
+
projectId: z40.number().int().positive(),
|
|
3858
|
+
region: z40.literal("us").default("us")
|
|
3953
3859
|
}).strict().optional()
|
|
3954
3860
|
}).strict();
|
|
3955
3861
|
|
|
3956
3862
|
// ../packages/api-schemas/src/runDefinitions.ts
|
|
3957
|
-
import { z as
|
|
3863
|
+
import { z as z44 } from "zod";
|
|
3958
3864
|
|
|
3959
|
-
// ../packages/api-schemas/src/
|
|
3865
|
+
// ../packages/api-schemas/src/preference.ts
|
|
3960
3866
|
import { z as z41 } from "zod";
|
|
3867
|
+
var preferenceDefinitionSchema = z41.discriminatedUnion("kind", [
|
|
3868
|
+
z41.object({
|
|
3869
|
+
kind: z41.literal("open-ended"),
|
|
3870
|
+
branded: z41.boolean().default(false)
|
|
3871
|
+
}).strict(),
|
|
3872
|
+
z41.object({
|
|
3873
|
+
kind: z41.literal("head-to-head"),
|
|
3874
|
+
brandA: z41.string().trim().min(1),
|
|
3875
|
+
brandB: z41.string().trim().min(1)
|
|
3876
|
+
}).strict().refine(
|
|
3877
|
+
(p) => p.brandA.toLowerCase() !== p.brandB.toLowerCase(),
|
|
3878
|
+
"A head-to-head needs two different brands"
|
|
3879
|
+
)
|
|
3880
|
+
]);
|
|
3881
|
+
var preferenceSnapshotSchema = z41.object({ version: z41.literal(1), preference: preferenceDefinitionSchema }).strict();
|
|
3882
|
+
var headToHeadSchema = z41.object({
|
|
3883
|
+
kind: z41.literal("HEAD_TO_HEAD"),
|
|
3884
|
+
winner: z41.enum(["A", "B", "neither"]),
|
|
3885
|
+
brandA: z41.string(),
|
|
3886
|
+
brandB: z41.string(),
|
|
3887
|
+
rationale: z41.string(),
|
|
3888
|
+
brandAReasoning: z41.string(),
|
|
3889
|
+
brandBReasoning: z41.string(),
|
|
3890
|
+
brandAWhyRaised: z41.string().optional(),
|
|
3891
|
+
brandBWhyRaised: z41.string().optional()
|
|
3892
|
+
});
|
|
3893
|
+
var recommendPickSchema = z41.object({
|
|
3894
|
+
brand: z41.string(),
|
|
3895
|
+
rank: z41.number().int(),
|
|
3896
|
+
adopted: z41.boolean(),
|
|
3897
|
+
reasoning: z41.string().optional(),
|
|
3898
|
+
whyRaised: z41.string().optional()
|
|
3899
|
+
});
|
|
3900
|
+
var recommendSchema = z41.object({
|
|
3901
|
+
kind: z41.literal("RECOMMEND"),
|
|
3902
|
+
picks: z41.array(recommendPickSchema).default([]),
|
|
3903
|
+
singlePick: z41.boolean(),
|
|
3904
|
+
complianceNote: z41.string()
|
|
3905
|
+
});
|
|
3906
|
+
var visibilityVerdictSchema = z41.discriminatedUnion("kind", [
|
|
3907
|
+
headToHeadSchema,
|
|
3908
|
+
recommendSchema
|
|
3909
|
+
]);
|
|
3910
|
+
function preferenceSelectionLabel(verdict) {
|
|
3911
|
+
if (verdict.kind === "HEAD_TO_HEAD")
|
|
3912
|
+
return verdict.winner === "A" ? verdict.brandA : verdict.winner === "B" ? verdict.brandB : "Neither";
|
|
3913
|
+
if (!verdict.singlePick)
|
|
3914
|
+
return verdict.picks.length ? "No clear selection" : "No selection";
|
|
3915
|
+
return verdict.picks.find((pick) => pick.rank === 1)?.brand ?? "No selection";
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3918
|
+
// ../packages/api-schemas/src/runDefinitionInputs.ts
|
|
3919
|
+
import { z as z43 } from "zod";
|
|
3961
3920
|
|
|
3962
3921
|
// ../packages/api-schemas/src/runPlan.ts
|
|
3963
|
-
import { z as
|
|
3964
|
-
var runPlanCriterionSchema =
|
|
3965
|
-
id:
|
|
3966
|
-
name:
|
|
3967
|
-
rubric:
|
|
3922
|
+
import { z as z42 } from "zod";
|
|
3923
|
+
var runPlanCriterionSchema = z42.object({
|
|
3924
|
+
id: z42.string().min(1),
|
|
3925
|
+
name: z42.string(),
|
|
3926
|
+
rubric: z42.string()
|
|
3968
3927
|
});
|
|
3969
|
-
var criteriaSnapshotV1Schema =
|
|
3970
|
-
version:
|
|
3928
|
+
var criteriaSnapshotV1Schema = z42.object({
|
|
3929
|
+
version: z42.literal(1),
|
|
3971
3930
|
// File-authored criteria have no saved EvalSet; their identity is frozen
|
|
3972
3931
|
// in the request and result rows retain the criterion text without an FK.
|
|
3973
|
-
evalSetId:
|
|
3974
|
-
criteria:
|
|
3975
|
-
});
|
|
3976
|
-
var runPlanCaseSchema =
|
|
3977
|
-
id:
|
|
3978
|
-
prompt:
|
|
3979
|
-
workspace:
|
|
3980
|
-
repoUrl:
|
|
3981
|
-
repoRef:
|
|
3932
|
+
evalSetId: z42.string().min(1).nullable(),
|
|
3933
|
+
criteria: z42.array(runPlanCriterionSchema)
|
|
3934
|
+
});
|
|
3935
|
+
var runPlanCaseSchema = z42.object({
|
|
3936
|
+
id: z42.string().min(1),
|
|
3937
|
+
prompt: z42.object({ id: z42.string().min(1), text: z42.string() }),
|
|
3938
|
+
workspace: z42.object({
|
|
3939
|
+
repoUrl: z42.string().nullable(),
|
|
3940
|
+
repoRef: z42.string().nullable()
|
|
3982
3941
|
}),
|
|
3983
|
-
agents:
|
|
3942
|
+
agents: z42.array(
|
|
3984
3943
|
agentConfigSchema.extend({
|
|
3985
3944
|
// Validated against the current catalog request schema when lowered.
|
|
3986
|
-
catalogSelections:
|
|
3945
|
+
catalogSelections: z42.record(z42.string(), z42.unknown()).optional()
|
|
3987
3946
|
})
|
|
3988
3947
|
),
|
|
3989
|
-
samples:
|
|
3990
|
-
evalSetId:
|
|
3948
|
+
samples: z42.number().int().min(1).max(50),
|
|
3949
|
+
evalSetId: z42.string().min(1).optional(),
|
|
3991
3950
|
criteriaSnapshot: criteriaSnapshotV1Schema.optional(),
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
3951
|
+
preferenceSnapshot: preferenceSnapshotSchema.optional(),
|
|
3952
|
+
sourceRepoCommit: z42.string().nullable().optional(),
|
|
3953
|
+
experiment: z42.string().nullable().optional(),
|
|
3954
|
+
membershipTagIds: z42.array(z42.string()).optional(),
|
|
3955
|
+
profile: z42.object({
|
|
3956
|
+
id: z42.string(),
|
|
3957
|
+
name: z42.string(),
|
|
3958
|
+
description: z42.string(),
|
|
3959
|
+
model: z42.string()
|
|
4000
3960
|
}).nullable().optional(),
|
|
4001
3961
|
skillSet: skillSetSchema.optional(),
|
|
4002
3962
|
mcpSet: mcpSetSchema.optional(),
|
|
4003
3963
|
connectionSet: connectionSetSchema.optional(),
|
|
4004
3964
|
// The server's agentContextSnapshotV1Schema validates this at lowering.
|
|
4005
|
-
agentContext:
|
|
4006
|
-
agentContextDigest:
|
|
3965
|
+
agentContext: z42.unknown().optional(),
|
|
3966
|
+
agentContextDigest: z42.string().nullable().optional(),
|
|
4007
3967
|
addons: runAddonsSchema.optional(),
|
|
4008
3968
|
/** Names of resources the coordinator must prepare before expansion. */
|
|
4009
|
-
inputs:
|
|
3969
|
+
inputs: z42.array(z42.string().min(1)).default([])
|
|
4010
3970
|
});
|
|
4011
|
-
var inputPathSchema =
|
|
3971
|
+
var inputPathSchema = z42.string().min(1).max(256).regex(
|
|
4012
3972
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: Reject unsafe control characters in authored paths.
|
|
4013
3973
|
/^(?![!/])(?!.*[\\\x00-\x1f\x7f])(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*\/\/)(?!.*\/$).+$/,
|
|
4014
3974
|
"Expected a repository-relative path or glob without traversal"
|
|
@@ -4043,20 +4003,20 @@ var reservedBinaryCommands = [
|
|
|
4043
4003
|
"pi",
|
|
4044
4004
|
"wizard"
|
|
4045
4005
|
];
|
|
4046
|
-
var binaryCommandSchema =
|
|
4006
|
+
var binaryCommandSchema = z42.string().max(128).regex(
|
|
4047
4007
|
/^[A-Za-z0-9_][A-Za-z0-9_.+-]*$/,
|
|
4048
4008
|
"Expected a command name without paths or shell syntax"
|
|
4049
4009
|
).refine(
|
|
4050
4010
|
(name) => !reservedBinaryCommands.includes(name),
|
|
4051
4011
|
"Command is reserved for Gauge workspace setup or the agent harness; choose another command name"
|
|
4052
4012
|
);
|
|
4053
|
-
var binaryUseSchema =
|
|
4054
|
-
type:
|
|
4055
|
-
paths:
|
|
4056
|
-
platform:
|
|
4013
|
+
var binaryUseSchema = z42.object({
|
|
4014
|
+
type: z42.literal("binary"),
|
|
4015
|
+
paths: z42.array(inputPathSchema).min(1).max(32),
|
|
4016
|
+
platform: z42.literal("linux-x64").describe(
|
|
4057
4017
|
"Linux x86-64 ELF executables compatible with the consumer sandbox. No system packages are installed."
|
|
4058
4018
|
),
|
|
4059
|
-
commands:
|
|
4019
|
+
commands: z42.record(
|
|
4060
4020
|
binaryCommandSchema,
|
|
4061
4021
|
inputPathSchema.regex(
|
|
4062
4022
|
/^[^*?{}[\]]+$/,
|
|
@@ -4067,62 +4027,62 @@ var binaryUseSchema = z40.object({
|
|
|
4067
4027
|
"Declare between 1 and 32 commands"
|
|
4068
4028
|
).meta({ minProperties: 1, maxProperties: 32 })
|
|
4069
4029
|
}).strict();
|
|
4070
|
-
var inputUseSchema =
|
|
4030
|
+
var inputUseSchema = z42.discriminatedUnion("type", [
|
|
4071
4031
|
binaryUseSchema,
|
|
4072
4032
|
websiteUseSchema,
|
|
4073
|
-
|
|
4074
|
-
type:
|
|
4075
|
-
paths:
|
|
4033
|
+
z42.object({
|
|
4034
|
+
type: z42.literal("files"),
|
|
4035
|
+
paths: z42.array(inputPathSchema).min(1).max(32).optional()
|
|
4076
4036
|
}).strict(),
|
|
4077
|
-
|
|
4078
|
-
type:
|
|
4037
|
+
z42.object({
|
|
4038
|
+
type: z42.literal("npm-cli"),
|
|
4079
4039
|
package: inputPathSchema,
|
|
4080
|
-
install:
|
|
4040
|
+
install: z42.enum(["environment", "workspace"]).optional()
|
|
4081
4041
|
}).strict(),
|
|
4082
|
-
|
|
4083
|
-
type:
|
|
4042
|
+
z42.object({
|
|
4043
|
+
type: z42.literal("npm-package"),
|
|
4084
4044
|
package: inputPathSchema,
|
|
4085
|
-
install:
|
|
4045
|
+
install: z42.enum(["environment", "workspace"]).optional()
|
|
4086
4046
|
}).strict(),
|
|
4087
|
-
|
|
4088
|
-
type:
|
|
4089
|
-
root:
|
|
4047
|
+
z42.object({
|
|
4048
|
+
type: z42.literal("skill"),
|
|
4049
|
+
root: z42.union([z42.literal("."), inputPathSchema]).refine(
|
|
4090
4050
|
(path3) => !/[*?{}[\]]/.test(path3),
|
|
4091
4051
|
"Skill root must be an explicit directory"
|
|
4092
4052
|
)
|
|
4093
4053
|
}).strict()
|
|
4094
4054
|
]);
|
|
4095
|
-
var inputSourceSchema =
|
|
4096
|
-
|
|
4097
|
-
type:
|
|
4098
|
-
paths:
|
|
4055
|
+
var inputSourceSchema = z42.discriminatedUnion("type", [
|
|
4056
|
+
z42.object({
|
|
4057
|
+
type: z42.literal("git"),
|
|
4058
|
+
paths: z42.array(inputPathSchema).min(1).max(32)
|
|
4099
4059
|
}).strict(),
|
|
4100
|
-
|
|
4101
|
-
type:
|
|
4060
|
+
z42.object({
|
|
4061
|
+
type: z42.literal("github-actions"),
|
|
4102
4062
|
// Omit to discover the sole artifact from the selected workflow run.
|
|
4103
4063
|
// Names are supplied by CI and need not encode the PR head revision.
|
|
4104
|
-
artifact:
|
|
4064
|
+
artifact: z42.string().min(1).max(256).optional()
|
|
4105
4065
|
}).strict()
|
|
4106
4066
|
]);
|
|
4107
|
-
var runPlanResourceSchema =
|
|
4108
|
-
name:
|
|
4109
|
-
type:
|
|
4110
|
-
source:
|
|
4067
|
+
var runPlanResourceSchema = z42.object({
|
|
4068
|
+
name: z42.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
4069
|
+
type: z42.literal("input"),
|
|
4070
|
+
source: z42.discriminatedUnion("type", [
|
|
4111
4071
|
commentSourceSchema.extend({
|
|
4112
|
-
repoUrl:
|
|
4113
|
-
commit:
|
|
4072
|
+
repoUrl: z42.string(),
|
|
4073
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i)
|
|
4114
4074
|
}).strict(),
|
|
4115
4075
|
deploymentSourceSchema.extend({
|
|
4116
|
-
repoUrl:
|
|
4117
|
-
commit:
|
|
4076
|
+
repoUrl: z42.string(),
|
|
4077
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i)
|
|
4118
4078
|
}).strict(),
|
|
4119
4079
|
inputSourceSchema.options[0].extend({
|
|
4120
|
-
repoUrl:
|
|
4121
|
-
commit:
|
|
4080
|
+
repoUrl: z42.string(),
|
|
4081
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i)
|
|
4122
4082
|
}).strict(),
|
|
4123
4083
|
inputSourceSchema.options[1].extend({
|
|
4124
|
-
repoUrl:
|
|
4125
|
-
commit:
|
|
4084
|
+
repoUrl: z42.string(),
|
|
4085
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i),
|
|
4126
4086
|
workflow: inputPathSchema
|
|
4127
4087
|
}).strict()
|
|
4128
4088
|
]),
|
|
@@ -4131,42 +4091,47 @@ var runPlanResourceSchema = z40.object({
|
|
|
4131
4091
|
(r) => r.use.type === "website" === (r.source.type === "github-deployment" || r.source.type === "github-pr-comment"),
|
|
4132
4092
|
"Website inputs require a deployment or PR comment source; file inputs require git or Actions"
|
|
4133
4093
|
);
|
|
4134
|
-
var runPlanSchema =
|
|
4135
|
-
version:
|
|
4094
|
+
var runPlanSchema = z42.object({
|
|
4095
|
+
version: z42.literal(1),
|
|
4136
4096
|
/** Existing launches keep their current measurement semantics. */
|
|
4137
|
-
measurementMode:
|
|
4138
|
-
|
|
4139
|
-
|
|
4097
|
+
measurementMode: z42.enum([
|
|
4098
|
+
"EXISTING",
|
|
4099
|
+
"AGENT_EXPERIENCE",
|
|
4100
|
+
"AGENT_PREFERENCE",
|
|
4101
|
+
"MIXED"
|
|
4102
|
+
]),
|
|
4103
|
+
cases: z42.array(runPlanCaseSchema).min(1),
|
|
4104
|
+
resources: z42.array(runPlanResourceSchema).default([]),
|
|
4140
4105
|
/** Server-populated context retained across deferred preparation. */
|
|
4141
|
-
launch:
|
|
4142
|
-
origin:
|
|
4143
|
-
|
|
4144
|
-
initiator:
|
|
4145
|
-
userId:
|
|
4146
|
-
email:
|
|
4106
|
+
launch: z42.object({
|
|
4107
|
+
origin: z42.discriminatedUnion("initiator", [
|
|
4108
|
+
z42.object({
|
|
4109
|
+
initiator: z42.literal("API"),
|
|
4110
|
+
userId: z42.string().min(1),
|
|
4111
|
+
email: z42.string().nullable()
|
|
4147
4112
|
}).strict(),
|
|
4148
|
-
|
|
4149
|
-
initiator:
|
|
4150
|
-
userId:
|
|
4151
|
-
email:
|
|
4113
|
+
z42.object({
|
|
4114
|
+
initiator: z42.literal("GITHUB"),
|
|
4115
|
+
userId: z42.null(),
|
|
4116
|
+
email: z42.null()
|
|
4152
4117
|
}).strict()
|
|
4153
4118
|
]),
|
|
4154
|
-
funding:
|
|
4155
|
-
queueClass:
|
|
4119
|
+
funding: z42.enum(["ORG", "PLATFORM"]),
|
|
4120
|
+
queueClass: z42.literal("INTERACTIVE")
|
|
4156
4121
|
}).strict().optional(),
|
|
4157
|
-
provenance:
|
|
4158
|
-
definition:
|
|
4159
|
-
repoUrl:
|
|
4160
|
-
commit:
|
|
4161
|
-
digest:
|
|
4122
|
+
provenance: z42.object({
|
|
4123
|
+
definition: z42.object({
|
|
4124
|
+
repoUrl: z42.string().min(1),
|
|
4125
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i),
|
|
4126
|
+
digest: z42.string().min(1),
|
|
4162
4127
|
/** File submissions are asserted by the caller until server-side
|
|
4163
4128
|
* committed-byte fetching is available. */
|
|
4164
|
-
verification:
|
|
4129
|
+
verification: z42.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED"]).optional()
|
|
4165
4130
|
}).optional(),
|
|
4166
|
-
liveDependencies:
|
|
4167
|
-
|
|
4168
|
-
name:
|
|
4169
|
-
url:
|
|
4131
|
+
liveDependencies: z42.array(
|
|
4132
|
+
z42.object({
|
|
4133
|
+
name: z42.string().min(1),
|
|
4134
|
+
url: z42.string().url().optional()
|
|
4170
4135
|
})
|
|
4171
4136
|
).default([])
|
|
4172
4137
|
})
|
|
@@ -4190,17 +4155,23 @@ var runPlanSchema = z40.object({
|
|
|
4190
4155
|
commandOwners.set(command, resource.name);
|
|
4191
4156
|
}
|
|
4192
4157
|
}
|
|
4193
|
-
if (plan.measurementMode
|
|
4158
|
+
if (plan.measurementMode !== "EXISTING" && !item.agents.length)
|
|
4194
4159
|
ctx.addIssue({
|
|
4195
4160
|
code: "custom",
|
|
4196
4161
|
path: ["cases", index, "agents"],
|
|
4197
|
-
message: "
|
|
4162
|
+
message: "File cases require a selected agent"
|
|
4198
4163
|
});
|
|
4199
|
-
if (plan.measurementMode
|
|
4164
|
+
if (plan.measurementMode !== "EXISTING" && !item.preferenceSnapshot && !item.criteriaSnapshot?.criteria.length)
|
|
4200
4165
|
ctx.addIssue({
|
|
4201
4166
|
code: "custom",
|
|
4202
4167
|
path: ["cases", index, "criteriaSnapshot"],
|
|
4203
|
-
message: "
|
|
4168
|
+
message: "File cases require criteria or preference"
|
|
4169
|
+
});
|
|
4170
|
+
if (item.preferenceSnapshot && (item.criteriaSnapshot || item.evalSetId))
|
|
4171
|
+
ctx.addIssue({
|
|
4172
|
+
code: "custom",
|
|
4173
|
+
path: ["cases", index],
|
|
4174
|
+
message: "Specify exactly one measurement per case"
|
|
4204
4175
|
});
|
|
4205
4176
|
if (item.criteriaSnapshot && item.criteriaSnapshot.evalSetId !== (item.evalSetId ?? null))
|
|
4206
4177
|
ctx.addIssue({
|
|
@@ -4232,43 +4203,43 @@ var runPlanSchema = z40.object({
|
|
|
4232
4203
|
});
|
|
4233
4204
|
|
|
4234
4205
|
// ../packages/api-schemas/src/runDefinitionInputs.ts
|
|
4235
|
-
var definitionInputSourceSchema =
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
type:
|
|
4206
|
+
var definitionInputSourceSchema = z43.discriminatedUnion("type", [
|
|
4207
|
+
z43.object({ type: z43.literal("git") }).strict(),
|
|
4208
|
+
z43.object({
|
|
4209
|
+
type: z43.literal("github-actions"),
|
|
4239
4210
|
workflow: inputPathSchema.regex(/^\.github\/workflows\/[^/*?{}[\]]+\.ya?ml$/).describe(
|
|
4240
4211
|
"Workflow file in this repository, for example .github/workflows/build.yml."
|
|
4241
4212
|
),
|
|
4242
|
-
artifact:
|
|
4213
|
+
artifact: z43.string().min(1).max(256).optional().describe(
|
|
4243
4214
|
"Upload name or pattern. Omit only when the workflow produces exactly one artifact."
|
|
4244
4215
|
)
|
|
4245
4216
|
}).strict()
|
|
4246
4217
|
]);
|
|
4247
|
-
var skillInputPathSchema =
|
|
4218
|
+
var skillInputPathSchema = z43.union([z43.literal("."), inputPathSchema.regex(/^[^*?{}[\]]+$/)]).describe(
|
|
4248
4219
|
"Explicit Skill directory or ZIP/tar.gz file containing SKILL.md at its root."
|
|
4249
4220
|
);
|
|
4250
|
-
var runDefinitionInputSchema =
|
|
4221
|
+
var runDefinitionInputSchema = z43.discriminatedUnion("type", [
|
|
4251
4222
|
binaryUseSchema.extend({ source: definitionInputSourceSchema }).strict(),
|
|
4252
4223
|
websiteUseSchema.extend({ source: websiteSourceSchema }).strict(),
|
|
4253
|
-
|
|
4254
|
-
type:
|
|
4224
|
+
z43.object({
|
|
4225
|
+
type: z43.literal("npm-package"),
|
|
4255
4226
|
source: definitionInputSourceSchema,
|
|
4256
4227
|
path: inputPathSchema.describe(
|
|
4257
4228
|
"Path or glob selecting exactly one packed npm .tgz file."
|
|
4258
4229
|
),
|
|
4259
|
-
install:
|
|
4230
|
+
install: z43.enum(["environment", "workspace"]).default("environment").describe(
|
|
4260
4231
|
"environment exposes the package's commands on PATH; workspace adds a consumer application dependency."
|
|
4261
4232
|
)
|
|
4262
4233
|
}).strict(),
|
|
4263
|
-
|
|
4264
|
-
type:
|
|
4234
|
+
z43.object({
|
|
4235
|
+
type: z43.literal("skill"),
|
|
4265
4236
|
source: definitionInputSourceSchema,
|
|
4266
4237
|
path: skillInputPathSchema
|
|
4267
4238
|
}).strict(),
|
|
4268
|
-
|
|
4269
|
-
type:
|
|
4239
|
+
z43.object({
|
|
4240
|
+
type: z43.literal("files"),
|
|
4270
4241
|
source: definitionInputSourceSchema,
|
|
4271
|
-
paths:
|
|
4242
|
+
paths: z43.array(inputPathSchema).min(1).max(32).describe(
|
|
4272
4243
|
"Files or globs selected from the committed Git tree or the uploaded artifact."
|
|
4273
4244
|
)
|
|
4274
4245
|
}).strict()
|
|
@@ -4302,7 +4273,7 @@ function compileDefinitionInput(name, input, repoUrl, commit) {
|
|
|
4302
4273
|
}
|
|
4303
4274
|
|
|
4304
4275
|
// ../packages/api-schemas/src/runDefinitions.ts
|
|
4305
|
-
var uncredentialedRepoUrlSchema =
|
|
4276
|
+
var uncredentialedRepoUrlSchema = z44.string().min(1).refine((raw) => {
|
|
4306
4277
|
if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(raw)) return true;
|
|
4307
4278
|
try {
|
|
4308
4279
|
const url = new URL(raw);
|
|
@@ -4311,54 +4282,67 @@ var uncredentialedRepoUrlSchema = z42.string().min(1).refine((raw) => {
|
|
|
4311
4282
|
return false;
|
|
4312
4283
|
}
|
|
4313
4284
|
}, "Repository URL must not contain embedded credentials or query parameters");
|
|
4314
|
-
var runDefinitionChecksSchema =
|
|
4315
|
-
var runDefinitionConfigSchema =
|
|
4316
|
-
agents:
|
|
4317
|
-
sampleCount:
|
|
4285
|
+
var runDefinitionChecksSchema = z44.object({ paths: z44.array(inputPathSchema).min(1).max(32) }).strict();
|
|
4286
|
+
var runDefinitionConfigSchema = z44.object({
|
|
4287
|
+
agents: z44.array(agentConfigInputSchema).min(1),
|
|
4288
|
+
sampleCount: z44.number().int().min(1).max(50).optional(),
|
|
4318
4289
|
repoUrl: uncredentialedRepoUrlSchema.nullable().optional(),
|
|
4319
|
-
repoRef:
|
|
4320
|
-
profileId:
|
|
4290
|
+
repoRef: z44.string().min(1).nullable().optional(),
|
|
4291
|
+
profileId: z44.string().min(1).nullable().optional(),
|
|
4321
4292
|
skillRefs: assetRefListSchema.optional(),
|
|
4322
4293
|
mcpRefs: assetRefListSchema.optional(),
|
|
4323
|
-
connectionIds:
|
|
4294
|
+
connectionIds: z44.array(z44.string().min(1)).max(32).optional(),
|
|
4324
4295
|
addons: runAddonsSchema.optional(),
|
|
4325
|
-
inputs:
|
|
4296
|
+
inputs: z44.array(z44.string()).optional(),
|
|
4326
4297
|
checks: runDefinitionChecksSchema.optional()
|
|
4327
4298
|
}).strict();
|
|
4328
|
-
var runDefinitionFileConfigSchema =
|
|
4329
|
-
version:
|
|
4330
|
-
org:
|
|
4299
|
+
var runDefinitionFileConfigSchema = z44.object({
|
|
4300
|
+
version: z44.literal(2).default(2),
|
|
4301
|
+
org: z44.string().min(1).optional(),
|
|
4331
4302
|
checks: runDefinitionChecksSchema.optional(),
|
|
4332
|
-
cases:
|
|
4333
|
-
inputs:
|
|
4334
|
-
|
|
4303
|
+
cases: z44.array(inputPathSchema).min(1).max(32).default(["gauge-evals/**/*.md"]),
|
|
4304
|
+
inputs: z44.record(
|
|
4305
|
+
z44.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
4335
4306
|
runDefinitionInputSchema
|
|
4336
4307
|
).refine(
|
|
4337
4308
|
(inputs) => Object.keys(inputs).length <= 32,
|
|
4338
4309
|
"At most 32 inputs are allowed"
|
|
4339
4310
|
).meta({ maxProperties: 32 }).default({})
|
|
4340
4311
|
}).strict();
|
|
4341
|
-
var runDefinitionCriterionSchema =
|
|
4342
|
-
var
|
|
4343
|
-
criteria:
|
|
4312
|
+
var runDefinitionCriterionSchema = z44.object({ name: z44.string().min(1), rubric: z44.string().min(1) }).strict();
|
|
4313
|
+
var caseMeasurement = {
|
|
4314
|
+
criteria: z44.array(runDefinitionCriterionSchema).min(1).optional(),
|
|
4315
|
+
preference: preferenceDefinitionSchema.optional()
|
|
4316
|
+
};
|
|
4317
|
+
function exactlyOneMeasurement(item) {
|
|
4318
|
+
return item.criteria !== void 0 !== (item.preference !== void 0);
|
|
4319
|
+
}
|
|
4320
|
+
var runDefinitionFrontmatterSchema = z44.object({
|
|
4321
|
+
...caseMeasurement,
|
|
4344
4322
|
config: runDefinitionConfigSchema
|
|
4345
|
-
}).strict()
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4323
|
+
}).strict().refine(
|
|
4324
|
+
exactlyOneMeasurement,
|
|
4325
|
+
"Specify exactly one of criteria or preference"
|
|
4326
|
+
);
|
|
4327
|
+
var runDefinitionCaseSchema = z44.object({
|
|
4328
|
+
path: z44.string().min(1),
|
|
4329
|
+
prompt: z44.string().min(1),
|
|
4330
|
+
...caseMeasurement,
|
|
4350
4331
|
config: runDefinitionConfigSchema
|
|
4351
|
-
}).strict()
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4332
|
+
}).strict().refine(
|
|
4333
|
+
exactlyOneMeasurement,
|
|
4334
|
+
"Specify exactly one of criteria or preference"
|
|
4335
|
+
);
|
|
4336
|
+
var runDefinitionSubmissionSchema = z44.object({
|
|
4337
|
+
version: z44.literal(2),
|
|
4338
|
+
source: z44.object({
|
|
4355
4339
|
repoUrl: uncredentialedRepoUrlSchema,
|
|
4356
|
-
commit:
|
|
4357
|
-
digest:
|
|
4358
|
-
verification:
|
|
4340
|
+
commit: z44.string().regex(/^[a-f0-9]{40}$/i),
|
|
4341
|
+
digest: z44.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4342
|
+
verification: z44.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED"])
|
|
4359
4343
|
}).strict(),
|
|
4360
|
-
resources:
|
|
4361
|
-
cases:
|
|
4344
|
+
resources: z44.array(runPlanResourceSchema).max(32).default([]),
|
|
4345
|
+
cases: z44.array(runDefinitionCaseSchema).min(1).max(20)
|
|
4362
4346
|
}).strict().superRefine((definition, ctx) => {
|
|
4363
4347
|
const paths = /* @__PURE__ */ new Set();
|
|
4364
4348
|
for (const [index, item] of definition.cases.entries()) {
|
|
@@ -4401,54 +4385,55 @@ var runDefinitionPublicSubmissionSchema = runDefinitionSubmissionSchema.refine(
|
|
|
4401
4385
|
message: "Only the GitHub App may verify committed bytes"
|
|
4402
4386
|
}
|
|
4403
4387
|
);
|
|
4404
|
-
var runDefinitionPlanResponseSchema =
|
|
4388
|
+
var runDefinitionPlanResponseSchema = z44.object({
|
|
4405
4389
|
source: runDefinitionSubmissionSchema.shape.source,
|
|
4406
|
-
measurementMode:
|
|
4407
|
-
cases:
|
|
4408
|
-
|
|
4409
|
-
path:
|
|
4410
|
-
agents:
|
|
4411
|
-
samples:
|
|
4412
|
-
expectedRuns:
|
|
4413
|
-
workspace:
|
|
4414
|
-
repoUrl:
|
|
4415
|
-
repoRef:
|
|
4390
|
+
measurementMode: z44.enum(["AGENT_EXPERIENCE", "AGENT_PREFERENCE", "MIXED"]),
|
|
4391
|
+
cases: z44.array(
|
|
4392
|
+
z44.object({
|
|
4393
|
+
path: z44.string(),
|
|
4394
|
+
agents: z44.array(agentConfigSchema),
|
|
4395
|
+
samples: z44.number().int().nonnegative(),
|
|
4396
|
+
expectedRuns: z44.number().int().nonnegative(),
|
|
4397
|
+
workspace: z44.object({
|
|
4398
|
+
repoUrl: z44.string().nullable(),
|
|
4399
|
+
repoRef: z44.string().nullable()
|
|
4416
4400
|
}),
|
|
4417
|
-
criteriaCount:
|
|
4418
|
-
|
|
4401
|
+
criteriaCount: z44.number().int().nonnegative(),
|
|
4402
|
+
preference: preferenceDefinitionSchema.optional(),
|
|
4403
|
+
inputs: z44.array(z44.string())
|
|
4419
4404
|
})
|
|
4420
4405
|
),
|
|
4421
|
-
resources:
|
|
4422
|
-
|
|
4423
|
-
name:
|
|
4424
|
-
type:
|
|
4425
|
-
source:
|
|
4406
|
+
resources: z44.array(
|
|
4407
|
+
z44.object({
|
|
4408
|
+
name: z44.string(),
|
|
4409
|
+
type: z44.literal("input"),
|
|
4410
|
+
source: z44.enum([
|
|
4426
4411
|
"git",
|
|
4427
4412
|
"github-actions",
|
|
4428
4413
|
"github-deployment",
|
|
4429
4414
|
"github-pr-comment"
|
|
4430
4415
|
]),
|
|
4431
4416
|
use: inputUseSchema,
|
|
4432
|
-
readiness:
|
|
4433
|
-
detail:
|
|
4434
|
-
commands:
|
|
4417
|
+
readiness: z44.enum(["READY", "WAITING", "FAILED"]),
|
|
4418
|
+
detail: z44.string().optional(),
|
|
4419
|
+
commands: z44.array(z44.string()).optional()
|
|
4435
4420
|
})
|
|
4436
4421
|
),
|
|
4437
|
-
expectedRuns:
|
|
4438
|
-
canRun:
|
|
4422
|
+
expectedRuns: z44.number().int().nonnegative(),
|
|
4423
|
+
canRun: z44.boolean()
|
|
4439
4424
|
});
|
|
4440
|
-
var runDefinitionRunResponseSchema =
|
|
4441
|
-
runRequestId:
|
|
4442
|
-
batchIds:
|
|
4443
|
-
runIds:
|
|
4444
|
-
requestedRuns:
|
|
4445
|
-
createdRuns:
|
|
4446
|
-
aggregateUrl:
|
|
4425
|
+
var runDefinitionRunResponseSchema = z44.object({
|
|
4426
|
+
runRequestId: z44.string(),
|
|
4427
|
+
batchIds: z44.array(z44.string()),
|
|
4428
|
+
runIds: z44.array(z44.string()),
|
|
4429
|
+
requestedRuns: z44.number().int().nonnegative(),
|
|
4430
|
+
createdRuns: z44.number().int().nonnegative(),
|
|
4431
|
+
aggregateUrl: z44.string()
|
|
4447
4432
|
});
|
|
4448
4433
|
|
|
4449
4434
|
// ../packages/api-schemas/src/runRequests.ts
|
|
4450
|
-
import { z as
|
|
4451
|
-
var runRequestStatusSchema =
|
|
4435
|
+
import { z as z45 } from "zod";
|
|
4436
|
+
var runRequestStatusSchema = z45.enum([
|
|
4452
4437
|
"PENDING",
|
|
4453
4438
|
"PREPARING",
|
|
4454
4439
|
"RUNNING",
|
|
@@ -4456,9 +4441,10 @@ var runRequestStatusSchema = z43.enum([
|
|
|
4456
4441
|
"FAILED",
|
|
4457
4442
|
"CANCELED"
|
|
4458
4443
|
]);
|
|
4459
|
-
var runRequestResultSchema =
|
|
4444
|
+
var runRequestResultSchema = z45.enum([
|
|
4460
4445
|
"PENDING",
|
|
4461
4446
|
"PASSED",
|
|
4447
|
+
"MEASURED",
|
|
4462
4448
|
"QUALITY_FAILED",
|
|
4463
4449
|
"EXECUTION_FAILED",
|
|
4464
4450
|
"INPUT_FAILED",
|
|
@@ -4466,224 +4452,229 @@ var runRequestResultSchema = z43.enum([
|
|
|
4466
4452
|
"INCOMPLETE",
|
|
4467
4453
|
"CANCELED"
|
|
4468
4454
|
]);
|
|
4469
|
-
var runRequestCriterionResultSchema =
|
|
4470
|
-
criterionId:
|
|
4471
|
-
name:
|
|
4472
|
-
passed:
|
|
4473
|
-
reasoning:
|
|
4474
|
-
});
|
|
4475
|
-
var runRequestRunSchema =
|
|
4476
|
-
id:
|
|
4477
|
-
batchId:
|
|
4478
|
-
status:
|
|
4455
|
+
var runRequestCriterionResultSchema = z45.object({
|
|
4456
|
+
criterionId: z45.string().nullable(),
|
|
4457
|
+
name: z45.string(),
|
|
4458
|
+
passed: z45.boolean(),
|
|
4459
|
+
reasoning: z45.string().nullable()
|
|
4460
|
+
});
|
|
4461
|
+
var runRequestRunSchema = z45.object({
|
|
4462
|
+
id: z45.string(),
|
|
4463
|
+
batchId: z45.string(),
|
|
4464
|
+
status: z45.string(),
|
|
4479
4465
|
agent: agentSchema,
|
|
4480
|
-
model:
|
|
4466
|
+
model: z45.string(),
|
|
4481
4467
|
result: runRequestResultSchema,
|
|
4482
|
-
judge:
|
|
4483
|
-
criterionResults:
|
|
4468
|
+
judge: z45.object({ status: z45.string() }).nullable(),
|
|
4469
|
+
criterionResults: z45.array(runRequestCriterionResultSchema),
|
|
4470
|
+
preference: visibilityVerdictSchema.nullable().optional(),
|
|
4471
|
+
measurement: z45.enum(["experience", "preference"]).optional()
|
|
4484
4472
|
});
|
|
4485
|
-
var runRequestResponseSchema =
|
|
4486
|
-
id:
|
|
4473
|
+
var runRequestResponseSchema = z45.object({
|
|
4474
|
+
id: z45.string(),
|
|
4487
4475
|
status: runRequestStatusSchema,
|
|
4488
4476
|
result: runRequestResultSchema,
|
|
4489
|
-
error:
|
|
4490
|
-
inputs:
|
|
4491
|
-
settled:
|
|
4492
|
-
counts:
|
|
4493
|
-
requestedRuns:
|
|
4494
|
-
createdRuns:
|
|
4495
|
-
terminalRuns:
|
|
4496
|
-
judgedRuns:
|
|
4497
|
-
passedRuns:
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4477
|
+
error: z45.string().nullable().optional(),
|
|
4478
|
+
inputs: z45.unknown().optional(),
|
|
4479
|
+
settled: z45.boolean(),
|
|
4480
|
+
counts: z45.object({
|
|
4481
|
+
requestedRuns: z45.number().int().nonnegative(),
|
|
4482
|
+
createdRuns: z45.number().int().nonnegative(),
|
|
4483
|
+
terminalRuns: z45.number().int().nonnegative(),
|
|
4484
|
+
judgedRuns: z45.number().int().nonnegative(),
|
|
4485
|
+
passedRuns: z45.number().int().nonnegative(),
|
|
4486
|
+
measuredRuns: z45.number().int().nonnegative().optional(),
|
|
4487
|
+
qualityFailedRuns: z45.number().int().nonnegative(),
|
|
4488
|
+
executionFailedRuns: z45.number().int().nonnegative(),
|
|
4489
|
+
judgeFailedRuns: z45.number().int().nonnegative(),
|
|
4490
|
+
pendingRuns: z45.number().int().nonnegative()
|
|
4502
4491
|
}),
|
|
4503
|
-
batches:
|
|
4504
|
-
|
|
4492
|
+
batches: z45.array(
|
|
4493
|
+
z45.object({ id: z45.string(), runs: z45.array(runRequestRunSchema) })
|
|
4505
4494
|
),
|
|
4506
|
-
createdAt:
|
|
4507
|
-
updatedAt:
|
|
4508
|
-
finishedAt:
|
|
4495
|
+
createdAt: z45.string(),
|
|
4496
|
+
updatedAt: z45.string(),
|
|
4497
|
+
finishedAt: z45.string().nullable()
|
|
4509
4498
|
});
|
|
4510
4499
|
|
|
4511
4500
|
// ../packages/api-schemas/src/summary.ts
|
|
4512
|
-
import { z as
|
|
4501
|
+
import { z as z46 } from "zod";
|
|
4513
4502
|
function cardResultSchema(data) {
|
|
4514
|
-
return
|
|
4515
|
-
|
|
4516
|
-
|
|
4503
|
+
return z46.union([
|
|
4504
|
+
z46.object({ ok: z46.literal(true), data }),
|
|
4505
|
+
z46.object({ ok: z46.literal(false), error: z46.string() })
|
|
4517
4506
|
]);
|
|
4518
4507
|
}
|
|
4519
|
-
var summaryActionSchema =
|
|
4520
|
-
id:
|
|
4521
|
-
title:
|
|
4522
|
-
priority:
|
|
4523
|
-
status:
|
|
4524
|
-
evidenceCount:
|
|
4525
|
-
});
|
|
4526
|
-
var summaryAeCardSchema =
|
|
4527
|
-
id:
|
|
4528
|
-
name:
|
|
4529
|
-
judgedRuns:
|
|
4530
|
-
passRate:
|
|
4508
|
+
var summaryActionSchema = z46.object({
|
|
4509
|
+
id: z46.string(),
|
|
4510
|
+
title: z46.string(),
|
|
4511
|
+
priority: z46.string(),
|
|
4512
|
+
status: z46.string(),
|
|
4513
|
+
evidenceCount: z46.number().int()
|
|
4514
|
+
});
|
|
4515
|
+
var summaryAeCardSchema = z46.object({
|
|
4516
|
+
id: z46.string(),
|
|
4517
|
+
name: z46.string(),
|
|
4518
|
+
judgedRuns: z46.number().int(),
|
|
4519
|
+
passRate: z46.number().nullable(),
|
|
4531
4520
|
/** pp delta vs the prior 30d; null with no prior. */
|
|
4532
|
-
deltaPP:
|
|
4533
|
-
});
|
|
4534
|
-
var summaryVisibilityCardSchema =
|
|
4535
|
-
name:
|
|
4536
|
-
owned:
|
|
4537
|
-
name:
|
|
4538
|
-
rank:
|
|
4539
|
-
chosenRate:
|
|
4540
|
-
mentionRate:
|
|
4521
|
+
deltaPP: z46.number().nullable()
|
|
4522
|
+
});
|
|
4523
|
+
var summaryVisibilityCardSchema = z46.object({
|
|
4524
|
+
name: z46.string(),
|
|
4525
|
+
owned: z46.object({
|
|
4526
|
+
name: z46.string(),
|
|
4527
|
+
rank: z46.number(),
|
|
4528
|
+
chosenRate: z46.number(),
|
|
4529
|
+
mentionRate: z46.number()
|
|
4541
4530
|
}).nullable(),
|
|
4542
|
-
chosenDeltaPP:
|
|
4531
|
+
chosenDeltaPP: z46.number().nullable()
|
|
4543
4532
|
});
|
|
4544
|
-
var homeSummarySchema =
|
|
4545
|
-
hasAnyRuns:
|
|
4546
|
-
lastSynthesisAt:
|
|
4547
|
-
actions: cardResultSchema(
|
|
4533
|
+
var homeSummarySchema = z46.object({
|
|
4534
|
+
hasAnyRuns: z46.boolean(),
|
|
4535
|
+
lastSynthesisAt: z46.string().nullable(),
|
|
4536
|
+
actions: cardResultSchema(z46.array(summaryActionSchema)),
|
|
4548
4537
|
visibility: cardResultSchema(
|
|
4549
|
-
|
|
4550
|
-
cards:
|
|
4551
|
-
marketsTotal:
|
|
4552
|
-
promptCount:
|
|
4538
|
+
z46.object({
|
|
4539
|
+
cards: z46.array(summaryVisibilityCardSchema),
|
|
4540
|
+
marketsTotal: z46.number().int(),
|
|
4541
|
+
promptCount: z46.number().int()
|
|
4553
4542
|
})
|
|
4554
4543
|
),
|
|
4555
4544
|
agentExperience: cardResultSchema(
|
|
4556
|
-
|
|
4557
|
-
cards:
|
|
4558
|
-
total:
|
|
4559
|
-
setCount:
|
|
4545
|
+
z46.object({
|
|
4546
|
+
cards: z46.array(summaryAeCardSchema),
|
|
4547
|
+
total: z46.number().int(),
|
|
4548
|
+
setCount: z46.number().int()
|
|
4560
4549
|
})
|
|
4561
4550
|
),
|
|
4562
|
-
notableSessions: cardResultSchema(
|
|
4551
|
+
notableSessions: cardResultSchema(z46.array(z46.unknown()))
|
|
4563
4552
|
});
|
|
4564
4553
|
|
|
4565
4554
|
// ../packages/api-schemas/src/tokens.ts
|
|
4566
|
-
import { z as
|
|
4567
|
-
var apiTokenSchema =
|
|
4568
|
-
id:
|
|
4569
|
-
name:
|
|
4555
|
+
import { z as z47 } from "zod";
|
|
4556
|
+
var apiTokenSchema = z47.object({
|
|
4557
|
+
id: z47.string(),
|
|
4558
|
+
name: z47.string(),
|
|
4570
4559
|
/** Last 4 chars of the plaintext, for recognizability (non-secret). */
|
|
4571
|
-
last4:
|
|
4572
|
-
expiresAt:
|
|
4573
|
-
lastUsedAt:
|
|
4574
|
-
createdAt:
|
|
4575
|
-
revokedAt:
|
|
4576
|
-
});
|
|
4577
|
-
var createTokenRequestSchema =
|
|
4578
|
-
name:
|
|
4560
|
+
last4: z47.string(),
|
|
4561
|
+
expiresAt: z47.iso.datetime().nullable(),
|
|
4562
|
+
lastUsedAt: z47.iso.datetime().nullable(),
|
|
4563
|
+
createdAt: z47.iso.datetime(),
|
|
4564
|
+
revokedAt: z47.iso.datetime().nullable()
|
|
4565
|
+
});
|
|
4566
|
+
var createTokenRequestSchema = z47.object({
|
|
4567
|
+
name: z47.string().min(1).max(100),
|
|
4579
4568
|
/** ISO-8601 datetime; omit for no expiry. */
|
|
4580
|
-
expiresAt:
|
|
4569
|
+
expiresAt: z47.iso.datetime({ offset: true }).optional()
|
|
4581
4570
|
});
|
|
4582
4571
|
var createTokenResponseSchema = apiTokenSchema.extend({
|
|
4583
|
-
token:
|
|
4572
|
+
token: z47.string()
|
|
4584
4573
|
});
|
|
4585
4574
|
var listTokensResponseSchema = listResponseSchema(apiTokenSchema);
|
|
4586
4575
|
|
|
4587
4576
|
// ../packages/api-schemas/src/visibility.ts
|
|
4588
|
-
import { z as
|
|
4577
|
+
import { z as z48 } from "zod";
|
|
4589
4578
|
var VISIBILITY_PROMPT_KINDS = ["HEAD_TO_HEAD", "RECOMMEND"];
|
|
4590
|
-
var visibilityPromptKindSchema =
|
|
4579
|
+
var visibilityPromptKindSchema = z48.enum(VISIBILITY_PROMPT_KINDS);
|
|
4591
4580
|
var visibilityPromptSchema = visibilityPromptSettingsSchema.extend({
|
|
4592
|
-
id:
|
|
4593
|
-
name:
|
|
4581
|
+
id: z48.string(),
|
|
4582
|
+
name: z48.string(),
|
|
4594
4583
|
kind: visibilityPromptKindSchema,
|
|
4595
|
-
promptText:
|
|
4584
|
+
promptText: z48.string(),
|
|
4596
4585
|
/** HEAD_TO_HEAD is always branded; RECOMMEND may be either. */
|
|
4597
|
-
branded:
|
|
4598
|
-
brandA:
|
|
4599
|
-
brandB:
|
|
4600
|
-
market:
|
|
4601
|
-
position:
|
|
4602
|
-
createdAt:
|
|
4586
|
+
branded: z48.boolean(),
|
|
4587
|
+
brandA: z48.string().nullable(),
|
|
4588
|
+
brandB: z48.string().nullable(),
|
|
4589
|
+
market: z48.object({ id: z48.string(), slug: z48.string(), name: z48.string() }).nullable(),
|
|
4590
|
+
position: z48.number().int(),
|
|
4591
|
+
createdAt: z48.string(),
|
|
4603
4592
|
/** User tag names on the hidden backing prompt (Surface:* excluded). */
|
|
4604
|
-
tags:
|
|
4605
|
-
runCount:
|
|
4606
|
-
lastRunAt:
|
|
4607
|
-
scenarios:
|
|
4593
|
+
tags: z48.array(z48.string()),
|
|
4594
|
+
runCount: z48.number().int(),
|
|
4595
|
+
lastRunAt: z48.string().nullable(),
|
|
4596
|
+
scenarios: z48.array(visibilityScenarioSchema)
|
|
4608
4597
|
});
|
|
4609
|
-
var listVisibilityPromptsResponseSchema =
|
|
4610
|
-
items:
|
|
4598
|
+
var listVisibilityPromptsResponseSchema = z48.object({
|
|
4599
|
+
items: z48.array(visibilityPromptSchema)
|
|
4611
4600
|
});
|
|
4612
|
-
var createVisibilityPromptBodySchema =
|
|
4613
|
-
name:
|
|
4614
|
-
promptText:
|
|
4601
|
+
var createVisibilityPromptBodySchema = z48.object({
|
|
4602
|
+
name: z48.string().min(1),
|
|
4603
|
+
promptText: z48.string().min(1),
|
|
4615
4604
|
kind: visibilityPromptKindSchema,
|
|
4616
|
-
branded:
|
|
4605
|
+
branded: z48.boolean().optional(),
|
|
4617
4606
|
/** Required pair for HEAD_TO_HEAD (order-independent). */
|
|
4618
|
-
brandA:
|
|
4619
|
-
brandB:
|
|
4607
|
+
brandA: z48.string().nullish(),
|
|
4608
|
+
brandB: z48.string().nullish(),
|
|
4620
4609
|
/** Measured market id from the org's tracked set. */
|
|
4621
|
-
marketId:
|
|
4622
|
-
tags:
|
|
4610
|
+
marketId: z48.string().nullish(),
|
|
4611
|
+
tags: z48.array(z48.string()).optional(),
|
|
4623
4612
|
agents: visibilityPromptSettingsInputShape.agents.optional(),
|
|
4624
4613
|
skillRefs: visibilityPromptSettingsInputShape.skillRefs,
|
|
4625
4614
|
mcpRefs: visibilityPromptSettingsInputShape.mcpRefs,
|
|
4626
4615
|
connectionIds: visibilityPromptSettingsInputShape.connectionIds,
|
|
4627
4616
|
cadence: visibilityPromptSettingsInputShape.cadence,
|
|
4628
4617
|
sampleCount: visibilityPromptSettingsInputShape.sampleCount,
|
|
4629
|
-
scenarios:
|
|
4618
|
+
scenarios: z48.array(visibilityScenarioInputSchema).optional().default([])
|
|
4630
4619
|
}).strict();
|
|
4631
|
-
var synthesizeResponseSchema =
|
|
4620
|
+
var synthesizeResponseSchema = z48.object({
|
|
4632
4621
|
/** False when the pre-check found no new evidence and nothing was queued. */
|
|
4633
|
-
queued:
|
|
4634
|
-
});
|
|
4635
|
-
var updateVisibilityPromptBodySchema =
|
|
4636
|
-
name:
|
|
4637
|
-
promptText:
|
|
4638
|
-
branded:
|
|
4639
|
-
brandA:
|
|
4640
|
-
brandB:
|
|
4641
|
-
marketId:
|
|
4642
|
-
tags:
|
|
4622
|
+
queued: z48.boolean()
|
|
4623
|
+
});
|
|
4624
|
+
var updateVisibilityPromptBodySchema = z48.object({
|
|
4625
|
+
name: z48.string().min(1).optional(),
|
|
4626
|
+
promptText: z48.string().min(1).optional(),
|
|
4627
|
+
branded: z48.boolean().optional(),
|
|
4628
|
+
brandA: z48.string().nullish(),
|
|
4629
|
+
brandB: z48.string().nullish(),
|
|
4630
|
+
marketId: z48.string().nullish(),
|
|
4631
|
+
tags: z48.array(z48.string()).optional(),
|
|
4643
4632
|
...visibilityPromptSettingsPatchShape,
|
|
4644
4633
|
/** Replaces the whole scenario set when present. */
|
|
4645
|
-
scenarios:
|
|
4634
|
+
scenarios: z48.array(visibilityScenarioInputSchema).optional()
|
|
4646
4635
|
}).strict();
|
|
4647
|
-
var runVisibilityPromptResponseSchema =
|
|
4648
|
-
batchIds:
|
|
4649
|
-
runIds:
|
|
4636
|
+
var runVisibilityPromptResponseSchema = z48.object({
|
|
4637
|
+
batchIds: z48.array(z48.string()),
|
|
4638
|
+
runIds: z48.array(z48.string())
|
|
4650
4639
|
});
|
|
4651
|
-
var visibilityPromptRunSchema =
|
|
4652
|
-
id:
|
|
4653
|
-
status:
|
|
4640
|
+
var visibilityPromptRunSchema = z48.object({
|
|
4641
|
+
id: z48.string(),
|
|
4642
|
+
status: z48.string(),
|
|
4654
4643
|
agent: agentSchema,
|
|
4655
|
-
model:
|
|
4656
|
-
resolvedModel:
|
|
4657
|
-
createdAt:
|
|
4658
|
-
startedAt:
|
|
4659
|
-
finishedAt:
|
|
4660
|
-
failureReason:
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4644
|
+
model: z48.string().nullable(),
|
|
4645
|
+
resolvedModel: z48.string().nullable(),
|
|
4646
|
+
createdAt: z48.string(),
|
|
4647
|
+
startedAt: z48.string().nullable(),
|
|
4648
|
+
finishedAt: z48.string().nullable(),
|
|
4649
|
+
failureReason: z48.string().nullable(),
|
|
4650
|
+
creditsCharged: runCreditsChargedSchema.optional(),
|
|
4651
|
+
triggeredBy: runTriggeredBySchema.optional(),
|
|
4652
|
+
verdict: z48.object({
|
|
4653
|
+
status: z48.string(),
|
|
4654
|
+
error: z48.string().nullable(),
|
|
4655
|
+
payload: z48.unknown().nullable()
|
|
4665
4656
|
}).nullable()
|
|
4666
4657
|
});
|
|
4667
|
-
var listVisibilityPromptRunsResponseSchema =
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
var orgMarketSchema =
|
|
4671
|
-
marketId:
|
|
4672
|
-
slug:
|
|
4673
|
-
name:
|
|
4658
|
+
var listVisibilityPromptRunsResponseSchema = listResponseSchema(
|
|
4659
|
+
visibilityPromptRunSchema
|
|
4660
|
+
);
|
|
4661
|
+
var orgMarketSchema = z48.object({
|
|
4662
|
+
marketId: z48.string(),
|
|
4663
|
+
slug: z48.string(),
|
|
4664
|
+
name: z48.string(),
|
|
4674
4665
|
/** The one line saying what the market measures. */
|
|
4675
|
-
capability:
|
|
4666
|
+
capability: z48.string(),
|
|
4676
4667
|
/** SUGGESTED (the matcher) | USER (a human picked it). */
|
|
4677
|
-
source:
|
|
4668
|
+
source: z48.string()
|
|
4678
4669
|
});
|
|
4679
4670
|
var addableMarketSchema = orgMarketSchema.omit({ source: true });
|
|
4680
|
-
var listMarketsResponseSchema =
|
|
4681
|
-
tracked:
|
|
4671
|
+
var listMarketsResponseSchema = z48.object({
|
|
4672
|
+
tracked: z48.array(orgMarketSchema),
|
|
4682
4673
|
/** Published markets the org does not track yet (closed set — no free-text
|
|
4683
4674
|
* market creation). */
|
|
4684
|
-
addable:
|
|
4675
|
+
addable: z48.array(addableMarketSchema)
|
|
4685
4676
|
});
|
|
4686
|
-
var addMarketBodySchema =
|
|
4677
|
+
var addMarketBodySchema = z48.object({ marketId: z48.string().min(1) });
|
|
4687
4678
|
|
|
4688
4679
|
// src/version.ts
|
|
4689
4680
|
import { createRequire } from "module";
|
|
@@ -4751,9 +4742,9 @@ function resolveToken() {
|
|
|
4751
4742
|
return null;
|
|
4752
4743
|
}
|
|
4753
4744
|
}
|
|
4754
|
-
function saveToken(
|
|
4745
|
+
function saveToken(token) {
|
|
4755
4746
|
mkdirSync2(configDir(), { recursive: true, mode: 448 });
|
|
4756
|
-
writeFileSync2(credentialsPath(), `${
|
|
4747
|
+
writeFileSync2(credentialsPath(), `${token.trim()}
|
|
4757
4748
|
`, {
|
|
4758
4749
|
encoding: "utf8",
|
|
4759
4750
|
mode: 384
|
|
@@ -4802,14 +4793,14 @@ var ApiClient = class {
|
|
|
4802
4793
|
async get(path3, query) {
|
|
4803
4794
|
return this.request("GET", path3, { query });
|
|
4804
4795
|
}
|
|
4805
|
-
async post(path3,
|
|
4806
|
-
return this.request("POST", path3, { body, query });
|
|
4796
|
+
async post(path3, body2, query) {
|
|
4797
|
+
return this.request("POST", path3, { body: body2, query });
|
|
4807
4798
|
}
|
|
4808
|
-
async patch(path3,
|
|
4809
|
-
return this.request("PATCH", path3, { body, query });
|
|
4799
|
+
async patch(path3, body2, query) {
|
|
4800
|
+
return this.request("PATCH", path3, { body: body2, query });
|
|
4810
4801
|
}
|
|
4811
|
-
async put(path3,
|
|
4812
|
-
return this.request("PUT", path3, { body, query });
|
|
4802
|
+
async put(path3, body2, query) {
|
|
4803
|
+
return this.request("PUT", path3, { body: body2, query });
|
|
4813
4804
|
}
|
|
4814
4805
|
async delete(path3, query) {
|
|
4815
4806
|
return this.request("DELETE", path3, { query });
|
|
@@ -4831,20 +4822,20 @@ var ApiClient = class {
|
|
|
4831
4822
|
}
|
|
4832
4823
|
const reader = res.body.getReader();
|
|
4833
4824
|
const decoder = new TextDecoder();
|
|
4834
|
-
let
|
|
4825
|
+
let buffer2 = "";
|
|
4835
4826
|
try {
|
|
4836
4827
|
while (true) {
|
|
4837
4828
|
const { done, value } = await reader.read();
|
|
4838
4829
|
if (done) break;
|
|
4839
|
-
|
|
4840
|
-
let boundary =
|
|
4830
|
+
buffer2 += decoder.decode(value, { stream: true });
|
|
4831
|
+
let boundary = buffer2.indexOf("\n\n");
|
|
4841
4832
|
while (boundary !== -1) {
|
|
4842
|
-
const raw =
|
|
4833
|
+
const raw = buffer2.slice(0, boundary);
|
|
4843
4834
|
const event = parseSseFrame(raw);
|
|
4844
|
-
|
|
4835
|
+
buffer2 = buffer2.slice(boundary + 2);
|
|
4845
4836
|
if (event) onEvent(event);
|
|
4846
4837
|
else if (raw.trimStart().startsWith(":")) options.onComment?.();
|
|
4847
|
-
boundary =
|
|
4838
|
+
boundary = buffer2.indexOf("\n\n");
|
|
4848
4839
|
}
|
|
4849
4840
|
}
|
|
4850
4841
|
} catch (error) {
|
|
@@ -4895,13 +4886,13 @@ var ApiClient = class {
|
|
|
4895
4886
|
});
|
|
4896
4887
|
if (!res.ok) throw await this.toError(res);
|
|
4897
4888
|
if (res.status === 204) return void 0;
|
|
4898
|
-
const
|
|
4899
|
-
if (!
|
|
4889
|
+
const text2 = await res.text();
|
|
4890
|
+
if (!text2) return void 0;
|
|
4900
4891
|
const contentType = res.headers.get("content-type") ?? "";
|
|
4901
4892
|
if (contentType.includes("application/json")) {
|
|
4902
|
-
return JSON.parse(
|
|
4893
|
+
return JSON.parse(text2);
|
|
4903
4894
|
}
|
|
4904
|
-
return
|
|
4895
|
+
return text2;
|
|
4905
4896
|
}
|
|
4906
4897
|
async toError(res) {
|
|
4907
4898
|
try {
|
|
@@ -5049,10 +5040,10 @@ function register(program2) {
|
|
|
5049
5040
|
);
|
|
5050
5041
|
});
|
|
5051
5042
|
group.command("status <id> <status>").description("Transition an action: open | resolved | dismissed").option("--note <text>", "resolution note (recorded when closing)").action(
|
|
5052
|
-
async (
|
|
5043
|
+
async (id2, status, opts, cmd) => {
|
|
5053
5044
|
const org = resolveOrg(cmd);
|
|
5054
5045
|
const updated = await createClient().patch(
|
|
5055
|
-
`${actionsPath(org)}/${encodeURIComponent(
|
|
5046
|
+
`${actionsPath(org)}/${encodeURIComponent(id2)}`,
|
|
5056
5047
|
{ status: parseStatus(status), note: opts.note }
|
|
5057
5048
|
);
|
|
5058
5049
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
@@ -5068,7 +5059,7 @@ __export(apply_exports, {
|
|
|
5068
5059
|
register: () => register2
|
|
5069
5060
|
});
|
|
5070
5061
|
import { readFileSync as readFileSync3 } from "fs";
|
|
5071
|
-
import { z as
|
|
5062
|
+
import { z as z49 } from "zod";
|
|
5072
5063
|
function assertRequiredExperiment(spec, required) {
|
|
5073
5064
|
if (required.length === 0) {
|
|
5074
5065
|
throw new CliError(
|
|
@@ -5201,7 +5192,7 @@ function printApplied(res) {
|
|
|
5201
5192
|
console.log(
|
|
5202
5193
|
`Applied${res.experiment ? ` (experiment: ${res.experiment})` : ""} \u2014 ${res.batchIds.length} batch(es), ${res.runIds.length} run(s) enqueued`
|
|
5203
5194
|
);
|
|
5204
|
-
for (const
|
|
5195
|
+
for (const id2 of res.runIds) console.log(` run ${id2}`);
|
|
5205
5196
|
if (res.runIds.length > 0) {
|
|
5206
5197
|
console.error(`(watch one live: gauge runs watch ${res.runIds[0]})`);
|
|
5207
5198
|
}
|
|
@@ -5220,7 +5211,7 @@ function register2(program2) {
|
|
|
5220
5211
|
).option("--schema", "print the battery spec JSON Schema and exit").option("--example", "print a minimal example battery spec and exit").action(
|
|
5221
5212
|
async (opts, command) => {
|
|
5222
5213
|
if (opts.schema) {
|
|
5223
|
-
printJson(
|
|
5214
|
+
printJson(z49.toJSONSchema(batteries_exports.batterySpecSchema));
|
|
5224
5215
|
return;
|
|
5225
5216
|
}
|
|
5226
5217
|
if (opts.example) {
|
|
@@ -5414,9 +5405,9 @@ async function browserLogin() {
|
|
|
5414
5405
|
);
|
|
5415
5406
|
}
|
|
5416
5407
|
const exchange = parsed.data;
|
|
5417
|
-
const
|
|
5418
|
-
const me = await fetchMe(new ApiClient({ token
|
|
5419
|
-
saveToken(
|
|
5408
|
+
const token = exchange.accessToken;
|
|
5409
|
+
const me = await fetchMe(new ApiClient({ token }));
|
|
5410
|
+
saveToken(token);
|
|
5420
5411
|
console.log(`Token saved to ${credentialsPath()}`);
|
|
5421
5412
|
printIdentity(me);
|
|
5422
5413
|
} finally {
|
|
@@ -5426,7 +5417,7 @@ async function browserLogin() {
|
|
|
5426
5417
|
}
|
|
5427
5418
|
}
|
|
5428
5419
|
var DEVICE_ENDPOINT = "/api/v1/device";
|
|
5429
|
-
async function bootstrapPost(path3,
|
|
5420
|
+
async function bootstrapPost(path3, body2) {
|
|
5430
5421
|
const base = resolveBaseUrl().replace(/\/+$/, "");
|
|
5431
5422
|
let res;
|
|
5432
5423
|
try {
|
|
@@ -5437,7 +5428,7 @@ async function bootstrapPost(path3, body) {
|
|
|
5437
5428
|
Accept: "application/json",
|
|
5438
5429
|
"User-Agent": USER_AGENT
|
|
5439
5430
|
},
|
|
5440
|
-
body: JSON.stringify(
|
|
5431
|
+
body: JSON.stringify(body2)
|
|
5441
5432
|
});
|
|
5442
5433
|
} catch (e) {
|
|
5443
5434
|
throw new CliError(
|
|
@@ -5445,10 +5436,10 @@ async function bootstrapPost(path3, body) {
|
|
|
5445
5436
|
`Request to ${base} failed: ${e instanceof Error ? e.message : String(e)}`
|
|
5446
5437
|
);
|
|
5447
5438
|
}
|
|
5448
|
-
const
|
|
5439
|
+
const text2 = await res.text();
|
|
5449
5440
|
if (!res.ok) {
|
|
5450
5441
|
try {
|
|
5451
|
-
const parsed = errorEnvelopeSchema.safeParse(JSON.parse(
|
|
5442
|
+
const parsed = errorEnvelopeSchema.safeParse(JSON.parse(text2));
|
|
5452
5443
|
if (parsed.success) {
|
|
5453
5444
|
throw new CliError(parsed.data.error.code, parsed.data.error.message);
|
|
5454
5445
|
}
|
|
@@ -5460,7 +5451,7 @@ async function bootstrapPost(path3, body) {
|
|
|
5460
5451
|
`Authentication request failed: HTTP ${res.status} ${res.statusText}`.trim()
|
|
5461
5452
|
);
|
|
5462
5453
|
}
|
|
5463
|
-
return JSON.parse(
|
|
5454
|
+
return JSON.parse(text2);
|
|
5464
5455
|
}
|
|
5465
5456
|
async function deviceLogin(opts) {
|
|
5466
5457
|
const start = await bootstrapPost(
|
|
@@ -5520,10 +5511,10 @@ async function deviceLogin(opts) {
|
|
|
5520
5511
|
"The sign-in request expired before it was approved. Re-run it to try again."
|
|
5521
5512
|
);
|
|
5522
5513
|
case "approved": {
|
|
5523
|
-
const
|
|
5514
|
+
const token = result.accessToken;
|
|
5524
5515
|
try {
|
|
5525
|
-
const me = await fetchMe(new ApiClient({ token
|
|
5526
|
-
return { token
|
|
5516
|
+
const me = await fetchMe(new ApiClient({ token }));
|
|
5517
|
+
return { token, me };
|
|
5527
5518
|
} catch (e) {
|
|
5528
5519
|
throw new CliError(
|
|
5529
5520
|
"network",
|
|
@@ -5560,15 +5551,15 @@ async function withTokenLogin() {
|
|
|
5560
5551
|
if (process.stdin.isTTY) {
|
|
5561
5552
|
console.error("Paste your API token, then press Enter:");
|
|
5562
5553
|
}
|
|
5563
|
-
const
|
|
5564
|
-
if (!
|
|
5554
|
+
const token = (await readStdin()).trim();
|
|
5555
|
+
if (!token.startsWith(TOKEN_PREFIX)) {
|
|
5565
5556
|
throw new CliError(
|
|
5566
5557
|
"usage",
|
|
5567
5558
|
`Expected a token starting with ${TOKEN_PREFIX} on stdin`
|
|
5568
5559
|
);
|
|
5569
5560
|
}
|
|
5570
|
-
const me = await fetchMe(new ApiClient({ token
|
|
5571
|
-
saveToken(
|
|
5561
|
+
const me = await fetchMe(new ApiClient({ token }));
|
|
5562
|
+
saveToken(token);
|
|
5572
5563
|
console.log(`Token saved to ${credentialsPath()}`);
|
|
5573
5564
|
printIdentity(me);
|
|
5574
5565
|
}
|
|
@@ -5636,8 +5627,8 @@ function register3(program2) {
|
|
|
5636
5627
|
throw new CliError("usage", "--email requires --device.");
|
|
5637
5628
|
}
|
|
5638
5629
|
if (opts.device) {
|
|
5639
|
-
const { token
|
|
5640
|
-
saveToken(
|
|
5630
|
+
const { token, me } = await deviceLogin({ email: opts.email });
|
|
5631
|
+
saveToken(token);
|
|
5641
5632
|
console.log(`Token saved to ${credentialsPath()}`);
|
|
5642
5633
|
printIdentity(me);
|
|
5643
5634
|
} else if (opts.withToken) {
|
|
@@ -5659,8 +5650,8 @@ function register3(program2) {
|
|
|
5659
5650
|
});
|
|
5660
5651
|
auth.command("status").description("Show the current auth state").action(async (_opts, command) => {
|
|
5661
5652
|
const output = resolveOutput(command);
|
|
5662
|
-
const
|
|
5663
|
-
if (
|
|
5653
|
+
const source2 = tokenSource();
|
|
5654
|
+
if (source2 === "none") {
|
|
5664
5655
|
throw new CliError(
|
|
5665
5656
|
"unauthorized",
|
|
5666
5657
|
"Not logged in. Run `gauge auth login` or set GAUGE_API_TOKEN."
|
|
@@ -5673,7 +5664,7 @@ function register3(program2) {
|
|
|
5673
5664
|
if (e instanceof CliError && e.code === "unauthorized") {
|
|
5674
5665
|
throw new CliError(
|
|
5675
5666
|
"unauthorized",
|
|
5676
|
-
`Token (source: ${
|
|
5667
|
+
`Token (source: ${source2}) was rejected \u2014 it may be revoked or expired. Run \`gauge auth login\`.`
|
|
5677
5668
|
);
|
|
5678
5669
|
}
|
|
5679
5670
|
throw e;
|
|
@@ -5681,7 +5672,7 @@ function register3(program2) {
|
|
|
5681
5672
|
if (output === "json") {
|
|
5682
5673
|
printJson({
|
|
5683
5674
|
authenticated: true,
|
|
5684
|
-
source,
|
|
5675
|
+
source: source2,
|
|
5685
5676
|
apiUrl: resolveBaseUrl(),
|
|
5686
5677
|
...me
|
|
5687
5678
|
});
|
|
@@ -5689,7 +5680,7 @@ function register3(program2) {
|
|
|
5689
5680
|
}
|
|
5690
5681
|
printIdentity(me);
|
|
5691
5682
|
console.log(
|
|
5692
|
-
`Token source: ${
|
|
5683
|
+
`Token source: ${source2 === "env" ? "GAUGE_API_TOKEN environment variable" : credentialsPath()}`
|
|
5693
5684
|
);
|
|
5694
5685
|
});
|
|
5695
5686
|
const tokens2 = auth.command("tokens").description("Manage API tokens");
|
|
@@ -5723,11 +5714,11 @@ function register3(program2) {
|
|
|
5723
5714
|
console.log("Store it now \u2014 it won't be shown again.");
|
|
5724
5715
|
}
|
|
5725
5716
|
);
|
|
5726
|
-
tokens2.command("revoke <id>").description("Revoke an API token").action(async (
|
|
5717
|
+
tokens2.command("revoke <id>").description("Revoke an API token").action(async (id2, _opts, command) => {
|
|
5727
5718
|
await createClient().delete(
|
|
5728
|
-
`${TOKENS_PATH}/${encodeURIComponent(
|
|
5719
|
+
`${TOKENS_PATH}/${encodeURIComponent(id2)}`
|
|
5729
5720
|
);
|
|
5730
|
-
if (resolveOutput(command) !== "json") console.log(`Revoked ${
|
|
5721
|
+
if (resolveOutput(command) !== "json") console.log(`Revoked ${id2}`);
|
|
5731
5722
|
});
|
|
5732
5723
|
program2.command("whoami").description("Show the authenticated user and their orgs").action(async (_opts, command) => {
|
|
5733
5724
|
await whoami(resolveOutput(command));
|
|
@@ -5836,12 +5827,12 @@ function readPromptText(opts) {
|
|
|
5836
5827
|
throw new CliError("usage", "pass exactly one of --text or --file");
|
|
5837
5828
|
}
|
|
5838
5829
|
if (opts.text !== void 0) return opts.text;
|
|
5839
|
-
const
|
|
5830
|
+
const text2 = readFileSync4(
|
|
5840
5831
|
opts.file === "-" ? 0 : opts.file,
|
|
5841
5832
|
"utf8"
|
|
5842
5833
|
).trim();
|
|
5843
|
-
if (!
|
|
5844
|
-
return
|
|
5834
|
+
if (!text2) throw new CliError("usage", "prompt file is empty");
|
|
5835
|
+
return text2;
|
|
5845
5836
|
}
|
|
5846
5837
|
|
|
5847
5838
|
// src/commands/batches.ts
|
|
@@ -5884,9 +5875,9 @@ function register4(program2) {
|
|
|
5884
5875
|
}
|
|
5885
5876
|
}
|
|
5886
5877
|
);
|
|
5887
|
-
batches.command("get <id>").description("Show a batch and its runs").action(async (
|
|
5878
|
+
batches.command("get <id>").description("Show a batch and its runs").action(async (id2, _opts, command) => {
|
|
5888
5879
|
const batch = await createClient().get(
|
|
5889
|
-
`/api/v1/batches/${encodeURIComponent(
|
|
5880
|
+
`/api/v1/batches/${encodeURIComponent(id2)}`
|
|
5890
5881
|
);
|
|
5891
5882
|
if (resolveOutput(command) === "json") {
|
|
5892
5883
|
printJson(batch);
|
|
@@ -6063,7 +6054,7 @@ function register6(program2) {
|
|
|
6063
6054
|
"replace packages, repeatable",
|
|
6064
6055
|
collect2
|
|
6065
6056
|
).option("--clear-packages", "remove all packages").action(
|
|
6066
|
-
async (
|
|
6057
|
+
async (id2, opts, cmd) => {
|
|
6067
6058
|
const patch = {};
|
|
6068
6059
|
if (opts.name !== void 0) patch.name = opts.name;
|
|
6069
6060
|
if (opts.kind !== void 0) patch.kind = opts.kind.toUpperCase();
|
|
@@ -6081,19 +6072,19 @@ function register6(program2) {
|
|
|
6081
6072
|
}
|
|
6082
6073
|
const org = resolveOrg(cmd);
|
|
6083
6074
|
const row2 = await createClient().patch(
|
|
6084
|
-
`${brandsPath(org)}/${encodeURIComponent(
|
|
6075
|
+
`${brandsPath(org)}/${encodeURIComponent(id2)}`,
|
|
6085
6076
|
patch
|
|
6086
6077
|
);
|
|
6087
6078
|
if (resolveOutput(cmd) === "json") printJson(row2);
|
|
6088
6079
|
else console.log(`Updated brand ${row2.id} (${row2.name})`);
|
|
6089
6080
|
}
|
|
6090
6081
|
);
|
|
6091
|
-
group.command("rm <id>").description("Delete a brand").action(async (
|
|
6082
|
+
group.command("rm <id>").description("Delete a brand").action(async (id2, _opts, cmd) => {
|
|
6092
6083
|
const org = resolveOrg(cmd);
|
|
6093
6084
|
await createClient().delete(
|
|
6094
|
-
`${brandsPath(org)}/${encodeURIComponent(
|
|
6085
|
+
`${brandsPath(org)}/${encodeURIComponent(id2)}`
|
|
6095
6086
|
);
|
|
6096
|
-
if (resolveOutput(cmd) !== "json") console.log(`Deleted brand ${
|
|
6087
|
+
if (resolveOutput(cmd) !== "json") console.log(`Deleted brand ${id2}`);
|
|
6097
6088
|
});
|
|
6098
6089
|
}
|
|
6099
6090
|
|
|
@@ -6126,10 +6117,10 @@ function printDetail(canary, json) {
|
|
|
6126
6117
|
);
|
|
6127
6118
|
}
|
|
6128
6119
|
}
|
|
6129
|
-
async function waitForCanary(
|
|
6120
|
+
async function waitForCanary(id2) {
|
|
6130
6121
|
const client = createClient();
|
|
6131
6122
|
while (true) {
|
|
6132
|
-
const canary = await client.get(`${path}/${
|
|
6123
|
+
const canary = await client.get(`${path}/${id2}`);
|
|
6133
6124
|
if (terminal.has(canary.status)) return canary;
|
|
6134
6125
|
await new Promise((resolve3) => setTimeout(resolve3, 1e4));
|
|
6135
6126
|
}
|
|
@@ -6150,9 +6141,9 @@ function register7(program2, opts = {}) {
|
|
|
6150
6141
|
process.exitCode = 1;
|
|
6151
6142
|
}
|
|
6152
6143
|
);
|
|
6153
|
-
canary.command("get <id>").option("--json", "print JSON").action(async (
|
|
6144
|
+
canary.command("get <id>").option("--json", "print JSON").action(async (id2, opts2) => {
|
|
6154
6145
|
printDetail(
|
|
6155
|
-
await createClient().get(`${path}/${
|
|
6146
|
+
await createClient().get(`${path}/${id2}`),
|
|
6156
6147
|
Boolean(opts2.json)
|
|
6157
6148
|
);
|
|
6158
6149
|
});
|
|
@@ -6696,8 +6687,8 @@ function utf8(bytes, path3) {
|
|
|
6696
6687
|
}
|
|
6697
6688
|
}
|
|
6698
6689
|
function parseRunDefinitionCase(path3, bytes) {
|
|
6699
|
-
const
|
|
6700
|
-
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(
|
|
6690
|
+
const source2 = utf8(bytes, path3);
|
|
6691
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(source2);
|
|
6701
6692
|
if (!match)
|
|
6702
6693
|
throw new Error(`${path3}: expected YAML frontmatter between --- lines`);
|
|
6703
6694
|
const document = parseDocument(match[1], { uniqueKeys: true });
|
|
@@ -6867,7 +6858,7 @@ import { minimatch as minimatch2 } from "minimatch";
|
|
|
6867
6858
|
import { parseDocument as parseDocument2 } from "yaml";
|
|
6868
6859
|
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
6869
6860
|
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
6870
|
-
var check = (
|
|
6861
|
+
var check = (id2, state, detail) => ({ id: id2, state, detail });
|
|
6871
6862
|
var dynamic = (value) => typeof value !== "string" || value.includes("${{");
|
|
6872
6863
|
var condition = (value) => {
|
|
6873
6864
|
if (value === void 0 || value === true) return true;
|
|
@@ -6945,12 +6936,12 @@ function workingFiles(root) {
|
|
|
6945
6936
|
}
|
|
6946
6937
|
function workflowChecks(root, input) {
|
|
6947
6938
|
if (input.source.type !== "github-actions") return [];
|
|
6948
|
-
const
|
|
6939
|
+
const source2 = input.source;
|
|
6949
6940
|
const checks = [];
|
|
6950
6941
|
let workflow;
|
|
6951
6942
|
try {
|
|
6952
6943
|
const document = parseDocument2(
|
|
6953
|
-
read(root,
|
|
6944
|
+
read(root, source2.workflow).toString("utf8"),
|
|
6954
6945
|
{ uniqueKeys: true }
|
|
6955
6946
|
);
|
|
6956
6947
|
if (document.errors.length)
|
|
@@ -6962,7 +6953,7 @@ function workflowChecks(root, input) {
|
|
|
6962
6953
|
check(
|
|
6963
6954
|
"workflow",
|
|
6964
6955
|
"yes",
|
|
6965
|
-
`${
|
|
6956
|
+
`${source2.workflow} exists with a parseable YAML jobs mapping`
|
|
6966
6957
|
)
|
|
6967
6958
|
);
|
|
6968
6959
|
} catch (error) {
|
|
@@ -6984,14 +6975,14 @@ function workflowChecks(root, input) {
|
|
|
6984
6975
|
);
|
|
6985
6976
|
const candidates = uploads.filter(({ step }) => {
|
|
6986
6977
|
const name = record(step.with).name ?? "artifact";
|
|
6987
|
-
return !
|
|
6978
|
+
return !source2.artifact || dynamic(name) || minimatch2(String(name), source2.artifact, { nonegate: true });
|
|
6988
6979
|
});
|
|
6989
6980
|
const recognizedUpload = candidates.length === 1 && !dynamic(record(candidates[0].step.with).name ?? "artifact");
|
|
6990
6981
|
checks.push(
|
|
6991
6982
|
check(
|
|
6992
6983
|
"artifact-upload",
|
|
6993
6984
|
recognizedUpload ? "yes" : "unknown",
|
|
6994
|
-
recognizedUpload ? `One direct upload step declares the matching artifact ${String(record(candidates[0].step.with).name ?? "artifact")}` : candidates.length ? `Found ${candidates.length} potentially matching upload step(s); resolve dynamic artifact names or overlapping uploads to establish a unique selection` : `No direct upload step matches ${
|
|
6985
|
+
recognizedUpload ? `One direct upload step declares the matching artifact ${String(record(candidates[0].step.with).name ?? "artifact")}` : candidates.length ? `Found ${candidates.length} potentially matching upload step(s); resolve dynamic artifact names or overlapping uploads to establish a unique selection` : `No direct upload step matches ${source2.artifact ?? "the configured artifact"}; ${opaque ? "inspect the referenced reusable workflows or custom actions" : "inspect build scripts or declare a matching actions/upload-artifact step"}`
|
|
6995
6986
|
)
|
|
6996
6987
|
);
|
|
6997
6988
|
for (const [index, { job, jobCondition, step }] of candidates.entries()) {
|
|
@@ -7000,10 +6991,10 @@ function workflowChecks(root, input) {
|
|
|
7000
6991
|
String(step.uses)
|
|
7001
6992
|
);
|
|
7002
6993
|
const major = version ? Number(version[1]) : void 0;
|
|
7003
|
-
let state =
|
|
6994
|
+
let state = source2.artifact && dynamic(options.name ?? "artifact") ? "unknown" : major === 7 ? options.archive === true || options.archive === "true" ? "yes" : options.archive === void 0 || options.archive === false || options.archive === "false" ? "no" : "unknown" : major !== void 0 && major >= 4 && major <= 6 ? "yes" : "unknown";
|
|
7004
6995
|
const conditional = jobCondition === void 0 || condition(step.if) === void 0;
|
|
7005
6996
|
if (state === "no" && conditional) state = "unknown";
|
|
7006
|
-
const detail =
|
|
6997
|
+
const detail = source2.artifact && dynamic(options.name ?? "artifact") ? "Resolve the artifact name expression to determine whether this upload is selected" : major === 7 ? options.archive === true || options.archive === "true" ? "archive: true declares a ZIP artifact" : options.archive === void 0 || options.archive === false || options.archive === "false" ? `archive: true is required for Gauge's ZIP download${conditional ? "; resolve the upload condition to determine whether this incompatible upload is selected" : ""}` : "Resolve the archive expression; Gauge requires archive: true" : major !== void 0 && major >= 4 && major <= 6 ? "This action version produces ZIP artifacts" : "Resolve the pinned action version; ZIP format is recognized for upload-artifact v4\u2013v7 (v7 requires archive: true)";
|
|
7007
6998
|
checks.push(
|
|
7008
6999
|
check(
|
|
7009
7000
|
`artifact-format.${index}`,
|
|
@@ -7392,7 +7383,7 @@ function register12(program2) {
|
|
|
7392
7383
|
console.log(`Expected sessions: ${result.expectedRuns}`);
|
|
7393
7384
|
for (const item of result.cases)
|
|
7394
7385
|
console.log(
|
|
7395
|
-
` ${item.path}: ${item.expectedRuns} sessions, ${item.criteriaCount} criteria`
|
|
7386
|
+
` ${item.path}: ${item.expectedRuns} sessions, ${item.preference ? `${item.preference.kind} preference (advisory)` : `${item.criteriaCount} criteria`}`
|
|
7396
7387
|
);
|
|
7397
7388
|
for (const resource of result.resources) {
|
|
7398
7389
|
const use = resource.use;
|
|
@@ -7442,10 +7433,10 @@ function register12(program2) {
|
|
|
7442
7433
|
else printItems(res.items.map(toRow2), "table");
|
|
7443
7434
|
}
|
|
7444
7435
|
);
|
|
7445
|
-
group.command("get <id>").description("Show one eval set: configuration, criteria, cadence").action(async (
|
|
7436
|
+
group.command("get <id>").description("Show one eval set: configuration, criteria, cadence").action(async (id2, _opts, cmd) => {
|
|
7446
7437
|
const org = resolveOrg(cmd);
|
|
7447
7438
|
const evalSet = await createClient().get(
|
|
7448
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7439
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}`
|
|
7449
7440
|
);
|
|
7450
7441
|
if (resolveOutput(cmd) === "json") printJson(evalSet);
|
|
7451
7442
|
else printDetail2(evalSet);
|
|
@@ -7474,7 +7465,7 @@ function register12(program2) {
|
|
|
7474
7465
|
"usage",
|
|
7475
7466
|
"at least one --criterion (or --criteria-file) is required"
|
|
7476
7467
|
);
|
|
7477
|
-
const
|
|
7468
|
+
const body2 = {
|
|
7478
7469
|
name: opts.name,
|
|
7479
7470
|
promptText: readPromptText(opts),
|
|
7480
7471
|
...ownedConfigFromOpts(opts),
|
|
@@ -7487,7 +7478,7 @@ function register12(program2) {
|
|
|
7487
7478
|
);
|
|
7488
7479
|
const created = await createClient().post(
|
|
7489
7480
|
evalSetsPath(org),
|
|
7490
|
-
|
|
7481
|
+
body2
|
|
7491
7482
|
);
|
|
7492
7483
|
if (resolveOutput(cmd) === "json") printJson(created);
|
|
7493
7484
|
else console.log(`Created eval set ${created.id}`);
|
|
@@ -7514,34 +7505,34 @@ function register12(program2) {
|
|
|
7514
7505
|
collect,
|
|
7515
7506
|
[]
|
|
7516
7507
|
).option("--clear-tags", "remove all user tags").action(
|
|
7517
|
-
async (
|
|
7508
|
+
async (id2, opts, cmd) => {
|
|
7518
7509
|
const org = resolveOrg(cmd);
|
|
7519
|
-
const
|
|
7520
|
-
if (opts.name !== void 0)
|
|
7510
|
+
const body2 = ownedConfigPatchFromOpts(opts);
|
|
7511
|
+
if (opts.name !== void 0) body2.name = opts.name;
|
|
7521
7512
|
if (opts.text !== void 0 || opts.file !== void 0)
|
|
7522
|
-
|
|
7513
|
+
body2.promptText = readPromptText(opts);
|
|
7523
7514
|
const criteria = criteriaFromOpts(opts);
|
|
7524
|
-
if (criteria)
|
|
7515
|
+
if (criteria) body2.criteria = criteria;
|
|
7525
7516
|
if (opts.tag.length > 0 && opts.clearTags)
|
|
7526
7517
|
throw new CliError("usage", "--tag and --clear-tags conflict");
|
|
7527
|
-
if (opts.clearTags)
|
|
7528
|
-
else if (opts.tag.length > 0)
|
|
7529
|
-
if (Object.keys(
|
|
7518
|
+
if (opts.clearTags) body2.tags = [];
|
|
7519
|
+
else if (opts.tag.length > 0) body2.tags = opts.tag;
|
|
7520
|
+
if (Object.keys(body2).length === 0)
|
|
7530
7521
|
throw new CliError("usage", "nothing to change");
|
|
7531
7522
|
const updated = await createClient().patch(
|
|
7532
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7533
|
-
|
|
7523
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}`,
|
|
7524
|
+
body2
|
|
7534
7525
|
);
|
|
7535
7526
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
7536
7527
|
else console.log(`Updated eval set ${updated.id}`);
|
|
7537
7528
|
}
|
|
7538
7529
|
);
|
|
7539
|
-
group.command("rm <id>").description("Delete an eval set (its run history survives)").action(async (
|
|
7530
|
+
group.command("rm <id>").description("Delete an eval set (its run history survives)").action(async (id2, _opts, cmd) => {
|
|
7540
7531
|
const org = resolveOrg(cmd);
|
|
7541
7532
|
await createClient().delete(
|
|
7542
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7533
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}`
|
|
7543
7534
|
);
|
|
7544
|
-
if (resolveOutput(cmd) !== "json") console.log(`Deleted eval set ${
|
|
7535
|
+
if (resolveOutput(cmd) !== "json") console.log(`Deleted eval set ${id2}`);
|
|
7545
7536
|
});
|
|
7546
7537
|
group.command("run [id]").description(
|
|
7547
7538
|
staffCommandsVisible() ? "Run an eval set now with its stored configuration (superusers run without billing the org by default)" : "Run an eval set now with its stored configuration"
|
|
@@ -7554,9 +7545,9 @@ function register12(program2) {
|
|
|
7554
7545
|
"--files <paths...>",
|
|
7555
7546
|
"committed Markdown paths or globs (default gauge-evals/**/*.md)"
|
|
7556
7547
|
).option("--yes", "skip the confirmation").action(
|
|
7557
|
-
async (
|
|
7558
|
-
if (opts.files !== void 0 ||
|
|
7559
|
-
if (
|
|
7548
|
+
async (id2, opts, cmd) => {
|
|
7549
|
+
if (opts.files !== void 0 || id2 === void 0) {
|
|
7550
|
+
if (id2 !== void 0)
|
|
7560
7551
|
throw new CliError(
|
|
7561
7552
|
"usage",
|
|
7562
7553
|
"pass either an eval ID or --files, not both"
|
|
@@ -7584,7 +7575,7 @@ function register12(program2) {
|
|
|
7584
7575
|
opts.yes
|
|
7585
7576
|
);
|
|
7586
7577
|
const result = await createClient().post(
|
|
7587
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7578
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}/run`,
|
|
7588
7579
|
opts.billToOrg ? { billToOrg: true } : {}
|
|
7589
7580
|
);
|
|
7590
7581
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -7594,36 +7585,45 @@ function register12(program2) {
|
|
|
7594
7585
|
);
|
|
7595
7586
|
}
|
|
7596
7587
|
);
|
|
7597
|
-
group.command("runs <id>").description("The eval set's run log with per-criterion verdicts").option("--limit <n>", "
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7588
|
+
group.command("runs <id>").description("The eval set's run log with per-criterion verdicts").option("--limit <n>", "page size (1-500, default 100)").option("--cursor <cursor>", "resume from a previous page's nextCursor").action(
|
|
7589
|
+
async (id2, opts, cmd) => {
|
|
7590
|
+
const org = resolveOrg(cmd);
|
|
7591
|
+
const res = await createClient().get(
|
|
7592
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}/runs`,
|
|
7593
|
+
{ limit: opts.limit, cursor: opts.cursor }
|
|
7594
|
+
);
|
|
7595
|
+
if (resolveOutput(cmd) === "json") {
|
|
7596
|
+
printJson(res);
|
|
7597
|
+
return;
|
|
7598
|
+
}
|
|
7599
|
+
printItems(
|
|
7600
|
+
res.items.map((r) => ({
|
|
7601
|
+
id: r.id,
|
|
7602
|
+
status: r.status,
|
|
7603
|
+
agent: r.agent,
|
|
7604
|
+
model: r.resolvedModel ?? r.model ?? "",
|
|
7605
|
+
source: r.triggeredBy?.source ?? "",
|
|
7606
|
+
credits: r.creditsCharged ?? "",
|
|
7607
|
+
created: r.createdAt,
|
|
7608
|
+
judge: r.judge?.status ?? "-",
|
|
7609
|
+
verdicts: r.criterionResults.length === 0 ? "-" : `${r.criterionResults.filter((c) => c.passed).length}/${r.criterionResults.length} passed`
|
|
7610
|
+
})),
|
|
7611
|
+
"table"
|
|
7612
|
+
);
|
|
7613
|
+
if (res.nextCursor) {
|
|
7614
|
+
console.error(
|
|
7615
|
+
`(more results \u2014 rerun with --cursor ${res.nextCursor})`
|
|
7616
|
+
);
|
|
7617
|
+
}
|
|
7606
7618
|
}
|
|
7607
|
-
|
|
7608
|
-
res.items.map((r) => ({
|
|
7609
|
-
id: r.id,
|
|
7610
|
-
status: r.status,
|
|
7611
|
-
agent: r.agent,
|
|
7612
|
-
model: r.resolvedModel ?? r.model ?? "",
|
|
7613
|
-
created: r.createdAt,
|
|
7614
|
-
judge: r.judge?.status ?? "-",
|
|
7615
|
-
verdicts: r.criterionResults.length === 0 ? "-" : `${r.criterionResults.filter((c) => c.passed).length}/${r.criterionResults.length} passed`
|
|
7616
|
-
})),
|
|
7617
|
-
"table"
|
|
7618
|
-
);
|
|
7619
|
-
});
|
|
7619
|
+
);
|
|
7620
7620
|
group.command("tag <id>").description("Replace an eval set's user tags (Surface:* is preserved)").option(
|
|
7621
7621
|
"--tag <name>",
|
|
7622
7622
|
"tag name, create-on-type (repeatable)",
|
|
7623
7623
|
collect,
|
|
7624
7624
|
[]
|
|
7625
7625
|
).option("--clear", "remove all user tags").action(
|
|
7626
|
-
async (
|
|
7626
|
+
async (id2, opts, cmd) => {
|
|
7627
7627
|
const org = resolveOrg(cmd);
|
|
7628
7628
|
if (opts.tag.length > 0 && opts.clear)
|
|
7629
7629
|
throw new CliError("usage", "--tag and --clear conflict");
|
|
@@ -7633,7 +7633,7 @@ function register12(program2) {
|
|
|
7633
7633
|
"pass --tag <name> (repeatable) or --clear"
|
|
7634
7634
|
);
|
|
7635
7635
|
const updated = await createClient().patch(
|
|
7636
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7636
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}`,
|
|
7637
7637
|
{ tags: opts.clear ? [] : opts.tag }
|
|
7638
7638
|
);
|
|
7639
7639
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
@@ -7681,6 +7681,10 @@ Choose a roster for the question and budget. For exploratory testing, start with
|
|
|
7681
7681
|
|
|
7682
7682
|
Background: [Open models as preference proxies](https://www.withgauge.com/blog/open-models-useful-proxies-data-from-1000-sessions/).
|
|
7683
7683
|
|
|
7684
|
+
## Git-authored Agent Preference
|
|
7685
|
+
Replace \`criteria\` with \`preference: { kind: open-ended }\`, adding \`branded: true\` when the prompt names brands. For a comparison use \`preference: { kind: head-to-head, brandA: PostHog, brandB: Amplitude }\`. Specify exactly one of criteria/preference; the body remains the task and must name the comparison brands itself.
|
|
7686
|
+
Existing per-case settings, inputs, and path filters apply. The app's preference analyst reports advisory choices; competitor selections never fail criteria. Preference-only checks finish neutral; mixed suites retain experience gating. The wait command succeeds for MEASURED/PASSED and fails on operational errors. No base/head delta is inferred.
|
|
7687
|
+
|
|
7684
7688
|
## Migration prompt and criteria
|
|
7685
7689
|
|
|
7686
7690
|
This example tests migration of an existing feature-flag application across browser and server workflows. Its starting repository contains the application, while attached connections supply destination credentials. The source account's targeting configuration is unavailable.
|
|
@@ -7728,7 +7732,7 @@ Explain product choices in their task context, then identify changes worth testi
|
|
|
7728
7732
|
|
|
7729
7733
|
## Establish the measurement
|
|
7730
7734
|
|
|
7731
|
-
Define the question, product role, cohort, and time window. Record prompts, repository revisions, personas, model/harness targets, attached resources, and interventions so comparisons remain interpretable. Open-ended choices and forced head-to-head comparisons answer different questions.
|
|
7735
|
+
Define the question, product role, cohort, and time window. Record prompts, repository revisions, personas, model/harness targets, attached resources, and interventions so comparisons remain interpretable. Open-ended choices and forced head-to-head comparisons answer different questions. Git-authored Markdown cases replace criteria with a preference block: kind open-ended (optionally branded: true), or kind head-to-head with brandA and brandB. The body is the prompt. Use gauge evals verify/plan/run; PR selections are advisory and use the app analyst.
|
|
7732
7736
|
|
|
7733
7737
|
Use \`gauge preference list -o json\` and \`gauge preference get <id> -o json\` to orient, \`gauge runs list --prompt <id> -o json\` for sessions, and \`gauge runs insight <run-id> -o json\` plus \`gauge runs logs <run-id> -o json\` for judgments and trace evidence. Follow \`nextCursor\` across list pages; one page is not the whole cohort. Inspect command help for available filters and configuration.
|
|
7734
7738
|
|
|
@@ -8192,15 +8196,15 @@ function register15(program2) {
|
|
|
8192
8196
|
const org = resolveOrg(cmd);
|
|
8193
8197
|
if (opts.note !== void 0 && opts.clearNote)
|
|
8194
8198
|
throw new CliError("usage", "--note and --clear-note conflict");
|
|
8195
|
-
const
|
|
8196
|
-
if (opts.rename !== void 0)
|
|
8197
|
-
if (opts.clearNote)
|
|
8198
|
-
else if (opts.note !== void 0)
|
|
8199
|
-
if (Object.keys(
|
|
8199
|
+
const body2 = {};
|
|
8200
|
+
if (opts.rename !== void 0) body2.name = opts.rename;
|
|
8201
|
+
if (opts.clearNote) body2.note = null;
|
|
8202
|
+
else if (opts.note !== void 0) body2.note = opts.note;
|
|
8203
|
+
if (Object.keys(body2).length === 0)
|
|
8200
8204
|
throw new CliError("usage", "nothing to change");
|
|
8201
8205
|
const updated = await createClient().patch(
|
|
8202
8206
|
serverPath(org, ref),
|
|
8203
|
-
|
|
8207
|
+
body2
|
|
8204
8208
|
);
|
|
8205
8209
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
8206
8210
|
else console.log(`Updated MCP server ${updated.name}`);
|
|
@@ -8425,11 +8429,11 @@ var TERMINAL = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
|
|
|
8425
8429
|
function basePath(org) {
|
|
8426
8430
|
return `/api/v1/orgs/${encodeURIComponent(org)}/optimizations`;
|
|
8427
8431
|
}
|
|
8428
|
-
function itemPath(org,
|
|
8429
|
-
return `${basePath(org)}/${encodeURIComponent(
|
|
8432
|
+
function itemPath(org, id2) {
|
|
8433
|
+
return `${basePath(org)}/${encodeURIComponent(id2)}`;
|
|
8430
8434
|
}
|
|
8431
|
-
function trialPath(org,
|
|
8432
|
-
return `${itemPath(org,
|
|
8435
|
+
function trialPath(org, id2, trialId) {
|
|
8436
|
+
return `${itemPath(org, id2)}/trials/${encodeURIComponent(trialId)}`;
|
|
8433
8437
|
}
|
|
8434
8438
|
var FAILED_RUN = /* @__PURE__ */ new Set(["FAILED", "TIMED_OUT"]);
|
|
8435
8439
|
function readText(path3) {
|
|
@@ -8455,13 +8459,13 @@ function parseTarget(raw) {
|
|
|
8455
8459
|
);
|
|
8456
8460
|
return spec.models.length ? { agent: spec.agent, model: spec.models[0] } : { agent: spec.agent };
|
|
8457
8461
|
}
|
|
8458
|
-
function parseCount(raw,
|
|
8462
|
+
function parseCount(raw, flag2, max = 100) {
|
|
8459
8463
|
if (raw === void 0) return void 0;
|
|
8460
8464
|
const n = Number(raw);
|
|
8461
8465
|
if (!Number.isInteger(n) || n < 1 || n > max)
|
|
8462
8466
|
throw new CliError(
|
|
8463
8467
|
"usage",
|
|
8464
|
-
`${
|
|
8468
|
+
`${flag2} must be a positive integer no greater than ${max}`
|
|
8465
8469
|
);
|
|
8466
8470
|
return n;
|
|
8467
8471
|
}
|
|
@@ -8571,9 +8575,9 @@ function trialBodyFromOpts(opts, read2 = readText, walk) {
|
|
|
8571
8575
|
"the trial file must contain an object or a non-empty array of objects"
|
|
8572
8576
|
);
|
|
8573
8577
|
const record2 = chosen;
|
|
8574
|
-
const
|
|
8578
|
+
const body2 = "trial" in record2 ? record2 : { trial: record2 };
|
|
8575
8579
|
return {
|
|
8576
|
-
...
|
|
8580
|
+
...body2,
|
|
8577
8581
|
...fork ? { fork } : {},
|
|
8578
8582
|
...idempotencyKey ? { idempotencyKey } : {},
|
|
8579
8583
|
launch
|
|
@@ -8737,8 +8741,8 @@ function printDetail3(o) {
|
|
|
8737
8741
|
console.log(`round ${round.number}: ${round.narrative}`);
|
|
8738
8742
|
for (const line of trials.flatMap(trialWarnings)) console.error(line);
|
|
8739
8743
|
}
|
|
8740
|
-
function runDetails(
|
|
8741
|
-
return `(details: \`gauge runs get ${
|
|
8744
|
+
function runDetails(id2) {
|
|
8745
|
+
return `(details: \`gauge runs get ${id2}\`, \`gauge runs logs ${id2}\`)`;
|
|
8742
8746
|
}
|
|
8743
8747
|
function trialWarnings(t) {
|
|
8744
8748
|
const total = `${t.runs.length} session${t.runs.length === 1 ? "" : "s"}`;
|
|
@@ -8860,9 +8864,9 @@ function register19(program2) {
|
|
|
8860
8864
|
else printItems(res.items.map(toRow3), "table");
|
|
8861
8865
|
}
|
|
8862
8866
|
);
|
|
8863
|
-
group.command("get <id>").description("One optimization: settings, score, and its trial ladder").action(async (
|
|
8867
|
+
group.command("get <id>").description("One optimization: settings, score, and its trial ladder").action(async (id2, _opts, cmd) => {
|
|
8864
8868
|
const org = resolveOrg(cmd);
|
|
8865
|
-
const detail = await createClient().get(itemPath(org,
|
|
8869
|
+
const detail = await createClient().get(itemPath(org, id2));
|
|
8866
8870
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8867
8871
|
else printDetail3(detail);
|
|
8868
8872
|
});
|
|
@@ -8911,14 +8915,14 @@ function register19(program2) {
|
|
|
8911
8915
|
}
|
|
8912
8916
|
}
|
|
8913
8917
|
);
|
|
8914
|
-
group.command("cancel <id>").description("Cancel an optimization and stop its in-flight sessions").option("--yes", "skip the confirmation").action(async (
|
|
8918
|
+
group.command("cancel <id>").description("Cancel an optimization and stop its in-flight sessions").option("--yes", "skip the confirmation").action(async (id2, opts, cmd) => {
|
|
8915
8919
|
const org = resolveOrg(cmd);
|
|
8916
8920
|
await confirmOrAbort(
|
|
8917
|
-
`Cancel optimization ${
|
|
8921
|
+
`Cancel optimization ${id2}? In-flight sessions stop; completed usage remains billed.`,
|
|
8918
8922
|
opts.yes
|
|
8919
8923
|
);
|
|
8920
8924
|
const detail = await createClient().post(
|
|
8921
|
-
`${itemPath(org,
|
|
8925
|
+
`${itemPath(org, id2)}/cancel`,
|
|
8922
8926
|
{}
|
|
8923
8927
|
);
|
|
8924
8928
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -8951,17 +8955,17 @@ function register19(program2) {
|
|
|
8951
8955
|
"--file <path>",
|
|
8952
8956
|
"PATCH body JSON (name, direction, target); '-' for stdin"
|
|
8953
8957
|
).action(
|
|
8954
|
-
async (
|
|
8955
|
-
const
|
|
8958
|
+
async (id2, opts, cmd) => {
|
|
8959
|
+
const body2 = {
|
|
8956
8960
|
...opts.file ? readObject(opts.file) : {},
|
|
8957
8961
|
...targetFromOpts(opts),
|
|
8958
8962
|
...opts.name ? { name: opts.name } : {}
|
|
8959
8963
|
};
|
|
8960
|
-
if (!Object.keys(
|
|
8964
|
+
if (!Object.keys(body2).length)
|
|
8961
8965
|
throw new CliError("usage", "pass --target, --name, or --file");
|
|
8962
8966
|
const detail = await createClient().patch(
|
|
8963
|
-
itemPath(resolveOrg(cmd),
|
|
8964
|
-
|
|
8967
|
+
itemPath(resolveOrg(cmd), id2),
|
|
8968
|
+
body2
|
|
8965
8969
|
);
|
|
8966
8970
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8967
8971
|
else printDetail3(detail);
|
|
@@ -8970,11 +8974,11 @@ function register19(program2) {
|
|
|
8970
8974
|
addTargetOption(
|
|
8971
8975
|
group.command("start-draft <id>").description("Start an existing draft's baseline (spends credits)")
|
|
8972
8976
|
).option("--name <name>", "optimization name").option("--yes", "skip the confirmation").action(
|
|
8973
|
-
async (
|
|
8977
|
+
async (id2, opts, cmd) => {
|
|
8974
8978
|
const org = resolveOrg(cmd);
|
|
8975
8979
|
const client = createClient();
|
|
8976
8980
|
const plan = targetFromOpts(opts);
|
|
8977
|
-
const current = await client.get(itemPath(org,
|
|
8981
|
+
const current = await client.get(itemPath(org, id2));
|
|
8978
8982
|
if (current.status !== "DRAFT")
|
|
8979
8983
|
throw new CliError(
|
|
8980
8984
|
"usage",
|
|
@@ -8986,10 +8990,10 @@ function register19(program2) {
|
|
|
8986
8990
|
"--target is required until the draft has an agent/model"
|
|
8987
8991
|
);
|
|
8988
8992
|
await confirmOrAbort(
|
|
8989
|
-
`Start the baseline for ${
|
|
8993
|
+
`Start the baseline for ${id2}? It spends credits now.`,
|
|
8990
8994
|
opts.yes
|
|
8991
8995
|
);
|
|
8992
|
-
const detail = await client.post(`${itemPath(org,
|
|
8996
|
+
const detail = await client.post(`${itemPath(org, id2)}/start`, {
|
|
8993
8997
|
...plan,
|
|
8994
8998
|
name: opts.name
|
|
8995
8999
|
});
|
|
@@ -8999,13 +9003,13 @@ function register19(program2) {
|
|
|
8999
9003
|
);
|
|
9000
9004
|
group.command("launch <id>").description(
|
|
9001
9005
|
"Launch all saved trials in the current round (spends credits)"
|
|
9002
|
-
).option("--yes", "skip the confirmation").action(async (
|
|
9006
|
+
).option("--yes", "skip the confirmation").action(async (id2, opts, cmd) => {
|
|
9003
9007
|
await confirmOrAbort(
|
|
9004
|
-
`Launch the current round of ${
|
|
9008
|
+
`Launch the current round of ${id2}? Spends credits.`,
|
|
9005
9009
|
opts.yes
|
|
9006
9010
|
);
|
|
9007
9011
|
const result = await createClient().post(
|
|
9008
|
-
`${itemPath(resolveOrg(cmd),
|
|
9012
|
+
`${itemPath(resolveOrg(cmd), id2)}/rounds/current/launch`,
|
|
9009
9013
|
{}
|
|
9010
9014
|
);
|
|
9011
9015
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -9016,21 +9020,21 @@ function register19(program2) {
|
|
|
9016
9020
|
});
|
|
9017
9021
|
group.command("continue <id>").description(
|
|
9018
9022
|
"Reopen a finished optimization for another round against its fixed baseline"
|
|
9019
|
-
).option("--yes", "skip the confirmation").action(async (
|
|
9023
|
+
).option("--yes", "skip the confirmation").action(async (id2, opts, cmd) => {
|
|
9020
9024
|
await confirmOrAbort(
|
|
9021
|
-
`Reopen ${
|
|
9025
|
+
`Reopen ${id2} for another round? Saved trials still require launch.`,
|
|
9022
9026
|
opts.yes
|
|
9023
9027
|
);
|
|
9024
9028
|
const detail = await createClient().post(
|
|
9025
|
-
`${itemPath(resolveOrg(cmd),
|
|
9029
|
+
`${itemPath(resolveOrg(cmd), id2)}/continue`,
|
|
9026
9030
|
{}
|
|
9027
9031
|
);
|
|
9028
9032
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
9029
9033
|
else printDetail3(detail);
|
|
9030
9034
|
});
|
|
9031
9035
|
group.command("activity <id>").description("Read the optimization's decision log").option("--after <timestamp>", "entries after this ISO timestamp").option("--limit <n>", "maximum entries (1\u2013500)").action(
|
|
9032
|
-
async (
|
|
9033
|
-
const res = await createClient().get(`${itemPath(resolveOrg(cmd),
|
|
9036
|
+
async (id2, opts, cmd) => {
|
|
9037
|
+
const res = await createClient().get(`${itemPath(resolveOrg(cmd), id2)}/activity`, {
|
|
9034
9038
|
after: opts.after,
|
|
9035
9039
|
limit: parseCount(opts.limit, "--limit", 500)
|
|
9036
9040
|
});
|
|
@@ -9047,32 +9051,32 @@ function register19(program2) {
|
|
|
9047
9051
|
);
|
|
9048
9052
|
}
|
|
9049
9053
|
);
|
|
9050
|
-
group.command("chat <id>").description("Resolve your optimization chat and print its URL path").action(async (
|
|
9054
|
+
group.command("chat <id>").description("Resolve your optimization chat and print its URL path").action(async (id2, _opts, cmd) => {
|
|
9051
9055
|
const res = await createClient().post(
|
|
9052
|
-
`${itemPath(resolveOrg(cmd),
|
|
9056
|
+
`${itemPath(resolveOrg(cmd), id2)}/chat`,
|
|
9053
9057
|
{}
|
|
9054
9058
|
);
|
|
9055
9059
|
if (resolveOutput(cmd) === "json") printJson(res);
|
|
9056
9060
|
else console.log(res.href);
|
|
9057
9061
|
});
|
|
9058
|
-
group.command("delete <id>").description("Delete an optimization, retaining billed session history").option("--yes", "skip the confirmation").action(async (
|
|
9062
|
+
group.command("delete <id>").description("Delete an optimization, retaining billed session history").option("--yes", "skip the confirmation").action(async (id2, opts, cmd) => {
|
|
9059
9063
|
await confirmOrAbort(
|
|
9060
|
-
`Delete optimization ${
|
|
9064
|
+
`Delete optimization ${id2}, its rounds, trials, and activity? Session history is kept.`,
|
|
9061
9065
|
opts.yes
|
|
9062
9066
|
);
|
|
9063
|
-
await createClient().delete(itemPath(resolveOrg(cmd),
|
|
9064
|
-
if (resolveOutput(cmd) === "json") printJson({ deleted:
|
|
9065
|
-
else console.log(`Deleted ${
|
|
9067
|
+
await createClient().delete(itemPath(resolveOrg(cmd), id2));
|
|
9068
|
+
if (resolveOutput(cmd) === "json") printJson({ deleted: id2 });
|
|
9069
|
+
else console.log(`Deleted ${id2}.`);
|
|
9066
9070
|
});
|
|
9067
9071
|
group.command("complete <id>").description("Complete an optimization: it reads as Finished, not canceled").option("--adopt <trialId>", "mark this settled trial as the winner").option("--yes", "skip the confirmation").action(
|
|
9068
|
-
async (
|
|
9072
|
+
async (id2, opts, cmd) => {
|
|
9069
9073
|
const org = resolveOrg(cmd);
|
|
9070
9074
|
await confirmOrAbort(
|
|
9071
|
-
`Complete optimization ${
|
|
9075
|
+
`Complete optimization ${id2}? No further rounds run; unspent credits are released.`,
|
|
9072
9076
|
opts.yes
|
|
9073
9077
|
);
|
|
9074
9078
|
const detail = await createClient().post(
|
|
9075
|
-
`${itemPath(org,
|
|
9079
|
+
`${itemPath(org, id2)}/complete`,
|
|
9076
9080
|
opts.adopt ? { adoptTrialId: opts.adopt } : {}
|
|
9077
9081
|
);
|
|
9078
9082
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -9083,7 +9087,7 @@ function register19(program2) {
|
|
|
9083
9087
|
group.command("watch <id>").description(
|
|
9084
9088
|
`Follow until finished or awaiting input (exit ${NEEDS_INPUT_EXIT} when it needs you); --follow keeps waiting`
|
|
9085
9089
|
).option("--interval <seconds>", "poll interval (default 15)").option("--follow", "keep polling while awaiting authoring or launch").action(
|
|
9086
|
-
async (
|
|
9090
|
+
async (id2, opts, cmd) => {
|
|
9087
9091
|
const org = resolveOrg(cmd);
|
|
9088
9092
|
const client = createClient();
|
|
9089
9093
|
const interval = Number(opts.interval ?? 15);
|
|
@@ -9095,7 +9099,7 @@ function register19(program2) {
|
|
|
9095
9099
|
const intervalMs = Math.max(interval * 1e3, 2e3);
|
|
9096
9100
|
let last = "";
|
|
9097
9101
|
for (; ; ) {
|
|
9098
|
-
const detail = await client.get(itemPath(org,
|
|
9102
|
+
const detail = await client.get(itemPath(org, id2));
|
|
9099
9103
|
const trials2 = detail.rounds.flatMap((round2) => round2.trials);
|
|
9100
9104
|
const failed = trials2.reduce(
|
|
9101
9105
|
(sum, trial) => sum + trial.failedSessions,
|
|
@@ -9119,18 +9123,18 @@ function register19(program2) {
|
|
|
9119
9123
|
);
|
|
9120
9124
|
group.command("authoring <id>").description(
|
|
9121
9125
|
"What the next round may change: kinds, CLI targets and commands, baseline invocations, revision"
|
|
9122
|
-
).action(async (
|
|
9126
|
+
).action(async (id2, _opts, cmd) => {
|
|
9123
9127
|
printJson(
|
|
9124
|
-
await createClient().get(`${itemPath(resolveOrg(cmd),
|
|
9128
|
+
await createClient().get(`${itemPath(resolveOrg(cmd), id2)}/authoring`)
|
|
9125
9129
|
);
|
|
9126
9130
|
});
|
|
9127
9131
|
group.command("invocation <id> <invocationId>").description(
|
|
9128
9132
|
"One baseline CLI invocation from `authoring`, with its recorded command evidence"
|
|
9129
9133
|
).action(
|
|
9130
|
-
async (
|
|
9134
|
+
async (id2, invocationId, _opts, cmd) => {
|
|
9131
9135
|
printJson(
|
|
9132
9136
|
await createClient().get(
|
|
9133
|
-
`${itemPath(resolveOrg(cmd),
|
|
9137
|
+
`${itemPath(resolveOrg(cmd), id2)}/authoring/target`,
|
|
9134
9138
|
{ cliInvocationId: invocationId }
|
|
9135
9139
|
)
|
|
9136
9140
|
);
|
|
@@ -9138,10 +9142,10 @@ function register19(program2) {
|
|
|
9138
9142
|
);
|
|
9139
9143
|
group.command("cli-change <id>").description(
|
|
9140
9144
|
"Build a CLI_INTERVENTION bundle from {targetId, commandId, selector, operations, shippingIntent}; use the output as intervention.after in a round file. Saves nothing"
|
|
9141
|
-
).requiredOption("--file <path>", "the change JSON; '-' for stdin").action(async (
|
|
9145
|
+
).requiredOption("--file <path>", "the change JSON; '-' for stdin").action(async (id2, opts, cmd) => {
|
|
9142
9146
|
printJson(
|
|
9143
9147
|
await createClient().post(
|
|
9144
|
-
`${itemPath(resolveOrg(cmd),
|
|
9148
|
+
`${itemPath(resolveOrg(cmd), id2)}/cli-changes`,
|
|
9145
9149
|
readObject(opts.file)
|
|
9146
9150
|
)
|
|
9147
9151
|
);
|
|
@@ -9149,9 +9153,9 @@ function register19(program2) {
|
|
|
9149
9153
|
const round = group.command("round").description(
|
|
9150
9154
|
"Preview and save the round waiting to launch. A round file is {revision, trials: [{trial: {title, hypothesis, lever, intervention}, files?}]}; revision comes from `authoring`"
|
|
9151
9155
|
);
|
|
9152
|
-
round.command("preview <id>").description("Validate a round file and print its diff and previewDigest").requiredOption("--file <path>", "the round JSON; '-' for stdin").action(async (
|
|
9156
|
+
round.command("preview <id>").description("Validate a round file and print its diff and previewDigest").requiredOption("--file <path>", "the round JSON; '-' for stdin").action(async (id2, opts, cmd) => {
|
|
9153
9157
|
const preview = await createClient().post(
|
|
9154
|
-
`${itemPath(resolveOrg(cmd),
|
|
9158
|
+
`${itemPath(resolveOrg(cmd), id2)}/rounds/current/preview`,
|
|
9155
9159
|
readObject(opts.file)
|
|
9156
9160
|
);
|
|
9157
9161
|
if (resolveOutput(cmd) === "json") printJson(preview);
|
|
@@ -9160,9 +9164,9 @@ function register19(program2) {
|
|
|
9160
9164
|
round.command("save <id>").description(
|
|
9161
9165
|
"Save a previewed round as drafts, replacing every pending draft. Never launches"
|
|
9162
9166
|
).requiredOption("--file <path>", "the round JSON you previewed").requiredOption("--digest <digest>", "previewDigest from `round preview`").action(
|
|
9163
|
-
async (
|
|
9167
|
+
async (id2, opts, cmd) => {
|
|
9164
9168
|
const result = await createClient().put(
|
|
9165
|
-
`${itemPath(resolveOrg(cmd),
|
|
9169
|
+
`${itemPath(resolveOrg(cmd), id2)}/rounds/current`,
|
|
9166
9170
|
{ ...readObject(opts.file), previewDigest: opts.digest }
|
|
9167
9171
|
);
|
|
9168
9172
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -9172,10 +9176,10 @@ function register19(program2) {
|
|
|
9172
9176
|
}
|
|
9173
9177
|
);
|
|
9174
9178
|
const trials = group.command("trials").description("List, author, and run trials");
|
|
9175
|
-
trials.command("list <id>").description("Every trial of an optimization with score and verdict").action(async (
|
|
9179
|
+
trials.command("list <id>").description("Every trial of an optimization with score and verdict").action(async (id2, _opts, cmd) => {
|
|
9176
9180
|
const org = resolveOrg(cmd);
|
|
9177
9181
|
const res = await createClient().get(
|
|
9178
|
-
`${itemPath(org,
|
|
9182
|
+
`${itemPath(org, id2)}/trials`
|
|
9179
9183
|
);
|
|
9180
9184
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
9181
9185
|
else printItems(res.items.map(trialRow), "table");
|
|
@@ -9201,15 +9205,15 @@ function register19(program2) {
|
|
|
9201
9205
|
"--idempotency-key <key>",
|
|
9202
9206
|
"a retry with this key returns the first call's trial instead of a second one"
|
|
9203
9207
|
).option("--yes", "skip the confirmation").action(
|
|
9204
|
-
async (
|
|
9208
|
+
async (id2, opts, cmd) => {
|
|
9205
9209
|
const org = resolveOrg(cmd);
|
|
9206
|
-
const
|
|
9207
|
-
if (
|
|
9210
|
+
const body2 = trialBodyFromOpts(opts);
|
|
9211
|
+
if (body2.launch !== false)
|
|
9208
9212
|
await confirmOrAbort(
|
|
9209
|
-
`Run trial "${
|
|
9213
|
+
`Run trial "${body2.trial.title}" on ${id2} now? Spends credits.`,
|
|
9210
9214
|
opts.yes
|
|
9211
9215
|
);
|
|
9212
|
-
const result = await createClient().post(`${itemPath(org,
|
|
9216
|
+
const result = await createClient().post(`${itemPath(org, id2)}/trials`, body2);
|
|
9213
9217
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
9214
9218
|
else if (result.replayed)
|
|
9215
9219
|
console.log(
|
|
@@ -9225,14 +9229,14 @@ function register19(program2) {
|
|
|
9225
9229
|
printJson(trialTemplate(opts.kind));
|
|
9226
9230
|
});
|
|
9227
9231
|
trials.command("run <id> <trialId>").description("Run a draft trial now (spends credits)").option("--yes", "skip the confirmation").action(
|
|
9228
|
-
async (
|
|
9232
|
+
async (id2, trialId, opts, cmd) => {
|
|
9229
9233
|
const org = resolveOrg(cmd);
|
|
9230
9234
|
await confirmOrAbort(
|
|
9231
9235
|
`Run trial ${trialId} now? Spends credits.`,
|
|
9232
9236
|
opts.yes
|
|
9233
9237
|
);
|
|
9234
9238
|
const result = await createClient().post(
|
|
9235
|
-
`${trialPath(org,
|
|
9239
|
+
`${trialPath(org, id2, trialId)}/launch`,
|
|
9236
9240
|
{}
|
|
9237
9241
|
);
|
|
9238
9242
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -9243,30 +9247,30 @@ function register19(program2) {
|
|
|
9243
9247
|
}
|
|
9244
9248
|
);
|
|
9245
9249
|
trials.command("remove <id> <trialId>").description("Drop one draft trial from the round waiting to launch").option("--yes", "skip the confirmation").action(
|
|
9246
|
-
async (
|
|
9247
|
-
await confirmOrAbort(`Remove draft ${trialId} from ${
|
|
9250
|
+
async (id2, trialId, opts, cmd) => {
|
|
9251
|
+
await confirmOrAbort(`Remove draft ${trialId} from ${id2}?`, opts.yes);
|
|
9248
9252
|
const detail = await createClient().delete(
|
|
9249
|
-
trialPath(resolveOrg(cmd),
|
|
9253
|
+
trialPath(resolveOrg(cmd), id2, trialId)
|
|
9250
9254
|
);
|
|
9251
9255
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
9252
9256
|
else console.log(`Removed ${trialId}.`);
|
|
9253
9257
|
}
|
|
9254
9258
|
);
|
|
9255
9259
|
group.command("trial <id> <trialId>").description("One trial by id or key (B0, R1.1, \u2026) with its sessions").action(
|
|
9256
|
-
async (
|
|
9260
|
+
async (id2, trialId, _opts, cmd) => {
|
|
9257
9261
|
const org = resolveOrg(cmd);
|
|
9258
9262
|
const trial = await createClient().get(
|
|
9259
|
-
trialPath(org,
|
|
9263
|
+
trialPath(org, id2, trialId)
|
|
9260
9264
|
);
|
|
9261
9265
|
if (resolveOutput(cmd) === "json") printJson(trial);
|
|
9262
9266
|
else printTrial(trial);
|
|
9263
9267
|
}
|
|
9264
9268
|
);
|
|
9265
9269
|
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(
|
|
9266
|
-
async (
|
|
9270
|
+
async (id2, trialId, opts, cmd) => {
|
|
9267
9271
|
const org = resolveOrg(cmd);
|
|
9268
9272
|
const content = await createClient().get(
|
|
9269
|
-
`${trialPath(org,
|
|
9273
|
+
`${trialPath(org, id2, trialId)}/content`
|
|
9270
9274
|
);
|
|
9271
9275
|
if (resolveOutput(cmd) === "json") printJson(content);
|
|
9272
9276
|
else if (opts.body) {
|
|
@@ -9282,14 +9286,14 @@ function register19(program2) {
|
|
|
9282
9286
|
group.command("adopt <id> <trialId>").description(
|
|
9283
9287
|
"Mark a settled trial as the winner without changing the baseline"
|
|
9284
9288
|
).option("--yes", "skip the confirmation").action(
|
|
9285
|
-
async (
|
|
9289
|
+
async (id2, trialId, opts, cmd) => {
|
|
9286
9290
|
const org = resolveOrg(cmd);
|
|
9287
9291
|
await confirmOrAbort(
|
|
9288
|
-
`Mark ${trialId} as the winner on ${
|
|
9292
|
+
`Mark ${trialId} as the winner on ${id2}?`,
|
|
9289
9293
|
opts.yes
|
|
9290
9294
|
);
|
|
9291
9295
|
const detail = await createClient().post(
|
|
9292
|
-
`${trialPath(org,
|
|
9296
|
+
`${trialPath(org, id2, trialId)}/adopt`,
|
|
9293
9297
|
{}
|
|
9294
9298
|
);
|
|
9295
9299
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -9298,9 +9302,9 @@ function register19(program2) {
|
|
|
9298
9302
|
);
|
|
9299
9303
|
group.command("handoff <id>").description(
|
|
9300
9304
|
"The instructions a coding agent follows to land the winning trial in your source, as the web app's Copy instructions for agent"
|
|
9301
|
-
).action(async (
|
|
9305
|
+
).action(async (id2, _opts, cmd) => {
|
|
9302
9306
|
const handoff = await createClient().get(
|
|
9303
|
-
`${itemPath(resolveOrg(cmd),
|
|
9307
|
+
`${itemPath(resolveOrg(cmd), id2)}/handoff`
|
|
9304
9308
|
);
|
|
9305
9309
|
if (resolveOutput(cmd) === "json") printJson(handoff);
|
|
9306
9310
|
else process.stdout.write(handoff.prompt);
|
|
@@ -9321,10 +9325,10 @@ function register19(program2) {
|
|
|
9321
9325
|
});
|
|
9322
9326
|
group.command("page <id>").description(
|
|
9323
9327
|
"The baseline body of a docs page, the base a docs-rewrite trial edits"
|
|
9324
|
-
).requiredOption("--url <url>", "the page URL").action(async (
|
|
9328
|
+
).requiredOption("--url <url>", "the page URL").action(async (id2, opts, cmd) => {
|
|
9325
9329
|
const org = resolveOrg(cmd);
|
|
9326
9330
|
const res = await createClient().get(
|
|
9327
|
-
`${itemPath(org,
|
|
9331
|
+
`${itemPath(org, id2)}/page`,
|
|
9328
9332
|
{ url: opts.url }
|
|
9329
9333
|
);
|
|
9330
9334
|
if (resolveOutput(cmd) === "json") printJson(res);
|
|
@@ -9465,10 +9469,10 @@ function register22(program2) {
|
|
|
9465
9469
|
"table"
|
|
9466
9470
|
);
|
|
9467
9471
|
});
|
|
9468
|
-
group.command("get <id>").description("Show one persona").action(async (
|
|
9472
|
+
group.command("get <id>").description("Show one persona").action(async (id2, _opts, cmd) => {
|
|
9469
9473
|
const org = resolveOrg(cmd);
|
|
9470
9474
|
const persona = await createClient().get(
|
|
9471
|
-
`${personasPath(org)}/${encodeURIComponent(
|
|
9475
|
+
`${personasPath(org)}/${encodeURIComponent(id2)}`
|
|
9472
9476
|
);
|
|
9473
9477
|
if (resolveOutput(cmd) === "json") {
|
|
9474
9478
|
printJson(persona);
|
|
@@ -9494,12 +9498,12 @@ function register22(program2) {
|
|
|
9494
9498
|
}
|
|
9495
9499
|
);
|
|
9496
9500
|
group.command("edit <id>").description("Update a persona").option("--name <name>", "rename the persona").option("--description <text>", "replace the notes").action(
|
|
9497
|
-
async (
|
|
9501
|
+
async (id2, opts, cmd) => {
|
|
9498
9502
|
const org = resolveOrg(cmd);
|
|
9499
9503
|
if (opts.name === void 0 && opts.description === void 0)
|
|
9500
9504
|
throw new CliError("usage", "nothing to change");
|
|
9501
9505
|
const updated = await createClient().patch(
|
|
9502
|
-
`${personasPath(org)}/${encodeURIComponent(
|
|
9506
|
+
`${personasPath(org)}/${encodeURIComponent(id2)}`,
|
|
9503
9507
|
{ name: opts.name, description: opts.description }
|
|
9504
9508
|
);
|
|
9505
9509
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
@@ -9508,12 +9512,12 @@ function register22(program2) {
|
|
|
9508
9512
|
);
|
|
9509
9513
|
group.command("rm <id>").description(
|
|
9510
9514
|
"Delete a persona (run configurations fall back to the default persona)"
|
|
9511
|
-
).action(async (
|
|
9515
|
+
).action(async (id2, _opts, cmd) => {
|
|
9512
9516
|
const org = resolveOrg(cmd);
|
|
9513
9517
|
await createClient().delete(
|
|
9514
|
-
`${personasPath(org)}/${encodeURIComponent(
|
|
9518
|
+
`${personasPath(org)}/${encodeURIComponent(id2)}`
|
|
9515
9519
|
);
|
|
9516
|
-
if (resolveOutput(cmd) !== "json") console.log(`Deleted persona ${
|
|
9520
|
+
if (resolveOutput(cmd) !== "json") console.log(`Deleted persona ${id2}`);
|
|
9517
9521
|
});
|
|
9518
9522
|
}
|
|
9519
9523
|
|
|
@@ -9825,15 +9829,15 @@ function register24(program2) {
|
|
|
9825
9829
|
);
|
|
9826
9830
|
if (opts.tag.length > 0 && opts.clearTags)
|
|
9827
9831
|
throw new CliError("usage", "--tag and --clear-tags conflict");
|
|
9828
|
-
const
|
|
9829
|
-
if (opts.name !== void 0)
|
|
9830
|
-
if (opts.clearFrameworks)
|
|
9831
|
-
else if (opts.framework.length > 0)
|
|
9832
|
-
if (opts.clearTags)
|
|
9833
|
-
else if (opts.tag.length > 0)
|
|
9834
|
-
if (Object.keys(
|
|
9832
|
+
const body2 = { url };
|
|
9833
|
+
if (opts.name !== void 0) body2.name = opts.name;
|
|
9834
|
+
if (opts.clearFrameworks) body2.frameworks = [];
|
|
9835
|
+
else if (opts.framework.length > 0) body2.frameworks = opts.framework;
|
|
9836
|
+
if (opts.clearTags) body2.tags = [];
|
|
9837
|
+
else if (opts.tag.length > 0) body2.tags = opts.tag;
|
|
9838
|
+
if (Object.keys(body2).length === 1)
|
|
9835
9839
|
throw new CliError("usage", "nothing to change");
|
|
9836
|
-
const repo = await createClient().patch(reposPath(org),
|
|
9840
|
+
const repo = await createClient().patch(reposPath(org), body2);
|
|
9837
9841
|
if (resolveOutput(command) === "json") printJson(repo);
|
|
9838
9842
|
else console.log(`Updated ${repo.name} (${repo.url})`);
|
|
9839
9843
|
}
|
|
@@ -9872,29 +9876,36 @@ __export(runRequests_exports2, {
|
|
|
9872
9876
|
});
|
|
9873
9877
|
var pollIntervalMs = 5e3;
|
|
9874
9878
|
function register25(program2) {
|
|
9875
|
-
program2.command("run-requests").description("Read a durable launch and its aggregate verdict").command("wait <id>").description("Wait for all sessions and judging in a launch request").action(async (
|
|
9879
|
+
program2.command("run-requests").description("Read a durable launch and its aggregate verdict").command("wait <id>").description("Wait for all sessions and judging in a launch request").action(async (id2, _opts, cmd) => {
|
|
9876
9880
|
const org = resolveOrg(cmd);
|
|
9877
|
-
const path3 = `/api/v1/orgs/${encodeURIComponent(org)}/run-requests/${encodeURIComponent(
|
|
9881
|
+
const path3 = `/api/v1/orgs/${encodeURIComponent(org)}/run-requests/${encodeURIComponent(id2)}`;
|
|
9878
9882
|
const client = createClient();
|
|
9879
9883
|
let lastStatus = "";
|
|
9880
9884
|
while (true) {
|
|
9881
9885
|
const result = await client.get(path3);
|
|
9882
9886
|
if (resolveOutput(cmd) !== "json" && result.status !== lastStatus) {
|
|
9883
|
-
console.error(`Run request ${
|
|
9887
|
+
console.error(`Run request ${id2}: ${result.status}`);
|
|
9884
9888
|
lastStatus = result.status;
|
|
9885
9889
|
}
|
|
9886
9890
|
if (result.settled) {
|
|
9887
9891
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
9888
9892
|
else {
|
|
9893
|
+
const measured = result.counts.measuredRuns ?? 0;
|
|
9889
9894
|
console.log(
|
|
9890
|
-
`${result.result}: ${result.counts.passedRuns}/${result.counts.createdRuns} passed sessions (${result.counts.judgedRuns} judged)`
|
|
9895
|
+
measured > 0 ? `${result.result}: ${measured} preference sessions measured${result.counts.passedRuns ? `; ${result.counts.passedRuns} experience sessions passed` : ""}` : `${result.result}: ${result.counts.passedRuns}/${result.counts.createdRuns} passed sessions (${result.counts.judgedRuns} judged)`
|
|
9891
9896
|
);
|
|
9897
|
+
for (const batch of result.batches)
|
|
9898
|
+
for (const run of batch.runs)
|
|
9899
|
+
if (run.preference)
|
|
9900
|
+
console.log(
|
|
9901
|
+
` ${run.id}: ${preferenceSelectionLabel(run.preference)} (advisory)`
|
|
9902
|
+
);
|
|
9892
9903
|
console.log(`Request: ${result.id}`);
|
|
9893
9904
|
}
|
|
9894
|
-
if (result.result !== "PASSED")
|
|
9905
|
+
if (result.result !== "PASSED" && result.result !== "MEASURED")
|
|
9895
9906
|
throw new CliError(
|
|
9896
9907
|
"internal",
|
|
9897
|
-
`Run request ${
|
|
9908
|
+
`Run request ${id2}: ${result.result}`
|
|
9898
9909
|
);
|
|
9899
9910
|
return;
|
|
9900
9911
|
}
|
|
@@ -9908,11 +9919,11 @@ var runs_exports2 = {};
|
|
|
9908
9919
|
__export(runs_exports2, {
|
|
9909
9920
|
register: () => register26
|
|
9910
9921
|
});
|
|
9911
|
-
function runPath(
|
|
9912
|
-
return `/api/v1/runs/${encodeURIComponent(
|
|
9922
|
+
function runPath(id2) {
|
|
9923
|
+
return `/api/v1/runs/${encodeURIComponent(id2)}`;
|
|
9913
9924
|
}
|
|
9914
|
-
function streamPath(
|
|
9915
|
-
return `/api/runs/${encodeURIComponent(
|
|
9925
|
+
function streamPath(id2) {
|
|
9926
|
+
return `/api/runs/${encodeURIComponent(id2)}/stream`;
|
|
9916
9927
|
}
|
|
9917
9928
|
function fmtDuration(ms) {
|
|
9918
9929
|
if (ms == null) return "";
|
|
@@ -9922,6 +9933,10 @@ function fmtDuration(ms) {
|
|
|
9922
9933
|
function fmtUsd(v) {
|
|
9923
9934
|
return v == null ? "" : `$${v.toFixed(2)}`;
|
|
9924
9935
|
}
|
|
9936
|
+
function fmtTriggeredBy(t) {
|
|
9937
|
+
if (!t) return "";
|
|
9938
|
+
return t.email ? `${t.source} (${t.email})` : t.source;
|
|
9939
|
+
}
|
|
9925
9940
|
function compact(value, max = 140) {
|
|
9926
9941
|
const s = typeof value === "string" ? value : JSON.stringify(value) ?? "null";
|
|
9927
9942
|
const one = s.replace(/\s+/g, " ").trim();
|
|
@@ -9937,8 +9952,10 @@ function toRow5(run) {
|
|
|
9937
9952
|
model: run.modelDisplayName ?? run.resolvedModel ?? run.model,
|
|
9938
9953
|
provider: observed && observed !== selected ? `${selected || "?"} \u2192 ${observed}` : selected || observed || "",
|
|
9939
9954
|
experiment: run.experiment ?? "",
|
|
9955
|
+
source: run.triggeredBy?.source ?? "",
|
|
9940
9956
|
turns: run.turns ?? "",
|
|
9941
9957
|
cost: fmtUsd(run.usdCost),
|
|
9958
|
+
credits: run.creditsCharged ?? "",
|
|
9942
9959
|
duration: fmtDuration(run.durationMs),
|
|
9943
9960
|
created: run.createdAt,
|
|
9944
9961
|
prompt: compact(run.promptSnippet, 48)
|
|
@@ -9975,7 +9992,9 @@ function detailLines(run) {
|
|
|
9975
9992
|
],
|
|
9976
9993
|
["Attempt", String(run.attempt)],
|
|
9977
9994
|
["Turns", run.turns == null ? "\u2014" : String(run.turns)],
|
|
9995
|
+
["Triggered by", fmtTriggeredBy(run.triggeredBy) || "\u2014"],
|
|
9978
9996
|
["Cost", fmtUsd(run.usdCost) || "\u2014"],
|
|
9997
|
+
["Credits", run.creditsCharged == null ? "\u2014" : String(run.creditsCharged)],
|
|
9979
9998
|
["Duration", fmtDuration(run.durationMs) || "\u2014"],
|
|
9980
9999
|
["Exit reason", run.exitReason ?? "\u2014"],
|
|
9981
10000
|
["Failure reason", run.failureReason ?? "\u2014"],
|
|
@@ -10099,7 +10118,7 @@ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
|
10099
10118
|
]);
|
|
10100
10119
|
var STATUS_POLL_MS = 5e3;
|
|
10101
10120
|
var TERMINAL_DRAIN_MS = 2e3;
|
|
10102
|
-
async function streamRun(
|
|
10121
|
+
async function streamRun(id2, json, opts) {
|
|
10103
10122
|
const client = createClient();
|
|
10104
10123
|
const controller = new AbortController();
|
|
10105
10124
|
let timer;
|
|
@@ -10117,7 +10136,7 @@ async function streamRun(id, json, opts) {
|
|
|
10117
10136
|
poller = setInterval(() => {
|
|
10118
10137
|
if (inFlight || drainTimer) return;
|
|
10119
10138
|
inFlight = true;
|
|
10120
|
-
client.get(runPath(
|
|
10139
|
+
client.get(runPath(id2)).then((run) => {
|
|
10121
10140
|
if (drainTimer || !TERMINAL_STATUSES.has(run.status)) return;
|
|
10122
10141
|
if (poller) clearInterval(poller);
|
|
10123
10142
|
drainTimer = setTimeout(() => {
|
|
@@ -10134,7 +10153,7 @@ async function streamRun(id, json, opts) {
|
|
|
10134
10153
|
}
|
|
10135
10154
|
try {
|
|
10136
10155
|
await client.sse(
|
|
10137
|
-
streamPath(
|
|
10156
|
+
streamPath(id2),
|
|
10138
10157
|
(frame) => {
|
|
10139
10158
|
const event = parseEvent(frame.data);
|
|
10140
10159
|
if (!event) return;
|
|
@@ -10197,8 +10216,10 @@ function register26(program2) {
|
|
|
10197
10216
|
}
|
|
10198
10217
|
}
|
|
10199
10218
|
);
|
|
10200
|
-
runs.command("get <id>").description(
|
|
10201
|
-
|
|
10219
|
+
runs.command("get <id>").description(
|
|
10220
|
+
"Show a run (status, trigger source, cost, credits, turns, exit reason)"
|
|
10221
|
+
).action(async (id2, _opts, command) => {
|
|
10222
|
+
const run = await createClient().get(runPath(id2));
|
|
10202
10223
|
if (resolveOutput(command) === "json") {
|
|
10203
10224
|
printJson(run);
|
|
10204
10225
|
return;
|
|
@@ -10209,9 +10230,9 @@ function register26(program2) {
|
|
|
10209
10230
|
console.log(`${label.padEnd(width)} ${value}`);
|
|
10210
10231
|
}
|
|
10211
10232
|
});
|
|
10212
|
-
runs.command("insight <id>").description("Show the run's LLM analysis (decisions)").action(async (
|
|
10233
|
+
runs.command("insight <id>").description("Show the run's LLM analysis (decisions)").action(async (id2, _opts, command) => {
|
|
10213
10234
|
const insight = await createClient().get(
|
|
10214
|
-
`${runPath(
|
|
10235
|
+
`${runPath(id2)}/insight`
|
|
10215
10236
|
);
|
|
10216
10237
|
if (resolveOutput(command) === "json") {
|
|
10217
10238
|
printJson(insight);
|
|
@@ -10221,9 +10242,9 @@ function register26(program2) {
|
|
|
10221
10242
|
});
|
|
10222
10243
|
runs.command("regrade <id>").description(
|
|
10223
10244
|
"Re-judge the run against its eval set's current criteria (no new session)"
|
|
10224
|
-
).action(async (
|
|
10245
|
+
).action(async (id2, _opts, command) => {
|
|
10225
10246
|
const result = await createClient().post(
|
|
10226
|
-
`${runPath(
|
|
10247
|
+
`${runPath(id2)}/regrade`
|
|
10227
10248
|
);
|
|
10228
10249
|
if (resolveOutput(command) === "json") {
|
|
10229
10250
|
printJson(result);
|
|
@@ -10236,31 +10257,31 @@ function register26(program2) {
|
|
|
10236
10257
|
});
|
|
10237
10258
|
runs.command("watch <id>").description(
|
|
10238
10259
|
"Stream normalized trace events live (SSE; exits when the run finishes)"
|
|
10239
|
-
).action(async (
|
|
10240
|
-
await streamRun(
|
|
10260
|
+
).action(async (id2, _opts, command) => {
|
|
10261
|
+
await streamRun(id2, resolveOutput(command) === "json", {
|
|
10241
10262
|
idleMs: 0,
|
|
10242
10263
|
firstEventMs: 0,
|
|
10243
10264
|
pollStatus: true
|
|
10244
10265
|
});
|
|
10245
10266
|
});
|
|
10246
|
-
runs.command("logs <id>").description("Dump the run's trace events so far, then exit (non-follow)").action(async (
|
|
10247
|
-
await streamRun(
|
|
10267
|
+
runs.command("logs <id>").description("Dump the run's trace events so far, then exit (non-follow)").action(async (id2, _opts, command) => {
|
|
10268
|
+
await streamRun(id2, resolveOutput(command) === "json", {
|
|
10248
10269
|
idleMs: 2e3,
|
|
10249
10270
|
firstEventMs: 15e3,
|
|
10250
10271
|
stopAtLiveMs: Date.now() - 2e3
|
|
10251
10272
|
});
|
|
10252
10273
|
});
|
|
10253
|
-
runs.command("diff <id>").description("Print the run's working-tree diff to stdout").action(async (
|
|
10254
|
-
const diff = await createClient().get(`${runPath(
|
|
10274
|
+
runs.command("diff <id>").description("Print the run's working-tree diff to stdout").action(async (id2) => {
|
|
10275
|
+
const diff = await createClient().get(`${runPath(id2)}/diff`);
|
|
10255
10276
|
if (!diff) {
|
|
10256
10277
|
console.error("(no diff)");
|
|
10257
10278
|
return;
|
|
10258
10279
|
}
|
|
10259
10280
|
process.stdout.write(diff);
|
|
10260
10281
|
});
|
|
10261
|
-
runs.command("fork <id>").description("Fork a finished run from its latest conversation checkpoint").requiredOption("--prompt <text>", "continuation prompt for the child run").action(async (
|
|
10282
|
+
runs.command("fork <id>").description("Fork a finished run from its latest conversation checkpoint").requiredOption("--prompt <text>", "continuation prompt for the child run").action(async (id2, opts, command) => {
|
|
10262
10283
|
const result = await createClient().post(
|
|
10263
|
-
`${runPath(
|
|
10284
|
+
`${runPath(id2)}/fork`,
|
|
10264
10285
|
{ prompt: opts.prompt }
|
|
10265
10286
|
);
|
|
10266
10287
|
if (resolveOutput(command) === "json") {
|
|
@@ -10274,9 +10295,9 @@ function register26(program2) {
|
|
|
10274
10295
|
});
|
|
10275
10296
|
runs.command("fork-boundaries <id>").description(
|
|
10276
10297
|
"The run's forkable fetch boundaries + checkpoint availability"
|
|
10277
|
-
).action(async (
|
|
10298
|
+
).action(async (id2) => {
|
|
10278
10299
|
const result = await createClient().get(
|
|
10279
|
-
`${runPath(
|
|
10300
|
+
`${runPath(id2)}/fork-boundaries`
|
|
10280
10301
|
);
|
|
10281
10302
|
printJson(result);
|
|
10282
10303
|
});
|
|
@@ -10286,9 +10307,9 @@ function register26(program2) {
|
|
|
10286
10307
|
);
|
|
10287
10308
|
printJson(result);
|
|
10288
10309
|
});
|
|
10289
|
-
runs.command("cancel <id>").description("Request cancellation of a run").action(async (
|
|
10310
|
+
runs.command("cancel <id>").description("Request cancellation of a run").action(async (id2, _opts, command) => {
|
|
10290
10311
|
const result = await createClient().post(
|
|
10291
|
-
`${runPath(
|
|
10312
|
+
`${runPath(id2)}/cancel`
|
|
10292
10313
|
);
|
|
10293
10314
|
if (resolveOutput(command) === "json") {
|
|
10294
10315
|
printJson(result);
|
|
@@ -10331,11 +10352,11 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
|
10331
10352
|
throw new CliError("usage", "--auto-ingest expects true or false");
|
|
10332
10353
|
autoIngest = opts.autoIngest === "true";
|
|
10333
10354
|
}
|
|
10334
|
-
const
|
|
10335
|
-
if (opts.rename !== void 0)
|
|
10336
|
-
if (opts.clearNote)
|
|
10337
|
-
else if (opts.note !== void 0)
|
|
10338
|
-
if (opts.clearSource)
|
|
10355
|
+
const body2 = {};
|
|
10356
|
+
if (opts.rename !== void 0) body2.name = opts.rename;
|
|
10357
|
+
if (opts.clearNote) body2.note = null;
|
|
10358
|
+
else if (opts.note !== void 0) body2.note = opts.note;
|
|
10359
|
+
if (opts.clearSource) body2.source = null;
|
|
10339
10360
|
else if (opts.source !== void 0) {
|
|
10340
10361
|
const m = opts.source.match(/^([^#]+\/[^#/]+)#([^/]+)(?:\/(.+))?$/);
|
|
10341
10362
|
if (!m)
|
|
@@ -10343,7 +10364,7 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
|
10343
10364
|
"usage",
|
|
10344
10365
|
'invalid --source (expected "owner/repo#branch" or "owner/repo#branch/subpath")'
|
|
10345
10366
|
);
|
|
10346
|
-
|
|
10367
|
+
body2.source = {
|
|
10347
10368
|
repoFullName: m[1],
|
|
10348
10369
|
ref: m[2],
|
|
10349
10370
|
subpath: m[3],
|
|
@@ -10356,16 +10377,16 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
|
10356
10377
|
"usage",
|
|
10357
10378
|
"this skill has no tracked source \u2014 set one first with --source owner/repo#branch"
|
|
10358
10379
|
);
|
|
10359
|
-
|
|
10380
|
+
body2.source = {
|
|
10360
10381
|
repoFullName: current.repoFullName,
|
|
10361
10382
|
ref: current.ref,
|
|
10362
10383
|
subpath: current.subpath || void 0,
|
|
10363
10384
|
autoIngest
|
|
10364
10385
|
};
|
|
10365
10386
|
}
|
|
10366
|
-
if (Object.keys(
|
|
10387
|
+
if (Object.keys(body2).length === 0)
|
|
10367
10388
|
throw new CliError("usage", "nothing to change");
|
|
10368
|
-
return
|
|
10389
|
+
return body2;
|
|
10369
10390
|
}
|
|
10370
10391
|
function register27(program2) {
|
|
10371
10392
|
const group = program2.command("skills").description("Manage agent skills used by eval and visibility runs");
|
|
@@ -10447,13 +10468,13 @@ function register27(program2) {
|
|
|
10447
10468
|
).action(async (ref, opts, cmd) => {
|
|
10448
10469
|
const org = resolveOrg(cmd);
|
|
10449
10470
|
const client = createClient();
|
|
10450
|
-
const
|
|
10471
|
+
const body2 = await buildSkillEditBody(opts, async () => {
|
|
10451
10472
|
const skill2 = await client.get(skillPath(org, ref));
|
|
10452
10473
|
return skill2.source;
|
|
10453
10474
|
});
|
|
10454
10475
|
const updated = await client.patch(
|
|
10455
10476
|
skillPath(org, ref),
|
|
10456
|
-
|
|
10477
|
+
body2
|
|
10457
10478
|
);
|
|
10458
10479
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
10459
10480
|
else console.log(`Updated skill ${updated.name}`);
|
|
@@ -10852,9 +10873,9 @@ function scenarioRow(scenario) {
|
|
|
10852
10873
|
persona: scenario.profile?.name ?? "(default)"
|
|
10853
10874
|
};
|
|
10854
10875
|
}
|
|
10855
|
-
var KIND_CHOICES = ["head-to-head", "
|
|
10876
|
+
var KIND_CHOICES = ["head-to-head", "open-ended"];
|
|
10856
10877
|
function parseKind(raw) {
|
|
10857
|
-
const upper = raw.trim().toUpperCase().replace(/-/g, "_");
|
|
10878
|
+
const upper = raw === "open-ended" ? "RECOMMEND" : raw.trim().toUpperCase().replace(/-/g, "_");
|
|
10858
10879
|
if (upper !== "HEAD_TO_HEAD" && upper !== "RECOMMEND")
|
|
10859
10880
|
throw new CliError(
|
|
10860
10881
|
"usage",
|
|
@@ -10870,7 +10891,7 @@ function toRow6(v) {
|
|
|
10870
10891
|
return {
|
|
10871
10892
|
id: v.id,
|
|
10872
10893
|
name: v.name,
|
|
10873
|
-
kind: v.kind,
|
|
10894
|
+
kind: v.kind === "RECOMMEND" ? "open-ended" : "head-to-head",
|
|
10874
10895
|
brands: brandsLabel(v),
|
|
10875
10896
|
market: v.market?.slug ?? "",
|
|
10876
10897
|
tags: v.tags.join(", "),
|
|
@@ -10881,7 +10902,9 @@ function toRow6(v) {
|
|
|
10881
10902
|
function printDetail4(v) {
|
|
10882
10903
|
console.log(`id: ${v.id}`);
|
|
10883
10904
|
console.log(`name: ${v.name}`);
|
|
10884
|
-
console.log(
|
|
10905
|
+
console.log(
|
|
10906
|
+
`kind: ${v.kind === "RECOMMEND" ? "open-ended" : "head-to-head"}`
|
|
10907
|
+
);
|
|
10885
10908
|
console.log(`brands: ${brandsLabel(v)}`);
|
|
10886
10909
|
console.log(
|
|
10887
10910
|
`market: ${v.market ? `${v.market.name} (${v.market.slug})` : "(none)"}`
|
|
@@ -10915,10 +10938,10 @@ function registerPreferenceGroup(group) {
|
|
|
10915
10938
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
10916
10939
|
else printItems(res.items.map(toRow6), "table");
|
|
10917
10940
|
});
|
|
10918
|
-
group.command("get <id>").description("Show one preference prompt").action(async (
|
|
10941
|
+
group.command("get <id>").description("Show one preference prompt").action(async (id2, _opts, cmd) => {
|
|
10919
10942
|
const org = resolveOrg(cmd);
|
|
10920
10943
|
const vp = await createClient().get(
|
|
10921
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
10944
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`
|
|
10922
10945
|
);
|
|
10923
10946
|
if (resolveOutput(cmd) === "json") printJson(vp);
|
|
10924
10947
|
else printDetail4(vp);
|
|
@@ -10926,7 +10949,7 @@ function registerPreferenceGroup(group) {
|
|
|
10926
10949
|
addRunSettingsCreateOptions(
|
|
10927
10950
|
group.command("create").description(
|
|
10928
10951
|
"Create a preference prompt. Run-settings flags set its roster, resources, cadence, and samples; --repo/--ref/--persona add its first scenario. Omit them all for a bare definition on the org's default roster."
|
|
10929
|
-
).requiredOption("--name <name>", "preference prompt name").requiredOption("--kind <kind>", KIND_CHOICES.join(" | ")).option("--text <text>", "prompt text inline").option("--file <path>", 'prompt text from a file ("-" for stdin)').option("--brand-a <name>", "first brand (required for head-to-head)").option("--brand-b <name>", "second brand (required for head-to-head)").option("--branded", "
|
|
10952
|
+
).requiredOption("--name <name>", "preference prompt name").requiredOption("--kind <kind>", KIND_CHOICES.join(" | ")).option("--text <text>", "prompt text inline").option("--file <path>", 'prompt text from a file ("-" for stdin)').option("--brand-a <name>", "first brand (required for head-to-head)").option("--brand-b <name>", "second brand (required for head-to-head)").option("--branded", "an open-ended prompt that names a brand").option(
|
|
10930
10953
|
"--repo <url>",
|
|
10931
10954
|
"first scenario's repository (default: empty project)"
|
|
10932
10955
|
).option("--ref <ref>", "branch, tag, or commit (with --repo)").option("--persona <profileId>", "first scenario's persona profile id")
|
|
@@ -10944,7 +10967,7 @@ function registerPreferenceGroup(group) {
|
|
|
10944
10967
|
if (opts.ref !== void 0 && opts.repo === void 0)
|
|
10945
10968
|
throw new CliError("usage", "--ref requires --repo");
|
|
10946
10969
|
const hasScenario = opts.repo !== void 0 || opts.persona !== void 0;
|
|
10947
|
-
const
|
|
10970
|
+
const body2 = {
|
|
10948
10971
|
name: opts.name,
|
|
10949
10972
|
promptText: readPromptText(opts),
|
|
10950
10973
|
kind: parseKind(opts.kind),
|
|
@@ -10964,7 +10987,7 @@ function registerPreferenceGroup(group) {
|
|
|
10964
10987
|
};
|
|
10965
10988
|
const created = await createClient().post(
|
|
10966
10989
|
visibilityPath(org),
|
|
10967
|
-
|
|
10990
|
+
body2
|
|
10968
10991
|
);
|
|
10969
10992
|
if (resolveOutput(cmd) === "json") printJson(created);
|
|
10970
10993
|
else console.log(`Created preference prompt ${created.id}`);
|
|
@@ -10983,51 +11006,51 @@ function registerPreferenceGroup(group) {
|
|
|
10983
11006
|
[]
|
|
10984
11007
|
).option("--clear-tags", "remove all user tags")
|
|
10985
11008
|
).action(
|
|
10986
|
-
async (
|
|
11009
|
+
async (id2, opts, cmd) => {
|
|
10987
11010
|
const org = resolveOrg(cmd);
|
|
10988
|
-
const
|
|
11011
|
+
const body2 = {
|
|
10989
11012
|
...runSettingsPatchFromOpts(opts)
|
|
10990
11013
|
};
|
|
10991
|
-
if (opts.name !== void 0)
|
|
11014
|
+
if (opts.name !== void 0) body2.name = opts.name;
|
|
10992
11015
|
if (opts.text !== void 0 || opts.file !== void 0)
|
|
10993
|
-
|
|
10994
|
-
if (opts.brandA !== void 0)
|
|
10995
|
-
if (opts.brandB !== void 0)
|
|
11016
|
+
body2.promptText = readPromptText(opts);
|
|
11017
|
+
if (opts.brandA !== void 0) body2.brandA = opts.brandA;
|
|
11018
|
+
if (opts.brandB !== void 0) body2.brandB = opts.brandB;
|
|
10996
11019
|
if (opts.branded && opts.organic)
|
|
10997
11020
|
throw new CliError("usage", "--branded and --organic conflict");
|
|
10998
|
-
if (opts.branded)
|
|
10999
|
-
else if (opts.organic)
|
|
11021
|
+
if (opts.branded) body2.branded = true;
|
|
11022
|
+
else if (opts.organic) body2.branded = false;
|
|
11000
11023
|
if (opts.market !== void 0 && opts.clearMarket)
|
|
11001
11024
|
throw new CliError("usage", "--market and --clear-market conflict");
|
|
11002
|
-
if (opts.clearMarket)
|
|
11003
|
-
else if (opts.market !== void 0)
|
|
11025
|
+
if (opts.clearMarket) body2.marketId = null;
|
|
11026
|
+
else if (opts.market !== void 0) body2.marketId = opts.market;
|
|
11004
11027
|
if (opts.tag.length > 0 && opts.clearTags)
|
|
11005
11028
|
throw new CliError("usage", "--tag and --clear-tags conflict");
|
|
11006
|
-
if (opts.clearTags)
|
|
11007
|
-
else if (opts.tag.length > 0)
|
|
11008
|
-
if (Object.keys(
|
|
11029
|
+
if (opts.clearTags) body2.tags = [];
|
|
11030
|
+
else if (opts.tag.length > 0) body2.tags = opts.tag;
|
|
11031
|
+
if (Object.keys(body2).length === 0)
|
|
11009
11032
|
throw new CliError("usage", "nothing to change");
|
|
11010
11033
|
const updated = await createClient().patch(
|
|
11011
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11012
|
-
|
|
11034
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`,
|
|
11035
|
+
body2
|
|
11013
11036
|
);
|
|
11014
11037
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
11015
11038
|
else console.log(`Updated preference prompt ${updated.id}`);
|
|
11016
11039
|
}
|
|
11017
11040
|
);
|
|
11018
|
-
group.command("rm <id>").description("Delete a preference prompt (its run history survives)").action(async (
|
|
11041
|
+
group.command("rm <id>").description("Delete a preference prompt (its run history survives)").action(async (id2, _opts, cmd) => {
|
|
11019
11042
|
const org = resolveOrg(cmd);
|
|
11020
11043
|
await createClient().delete(
|
|
11021
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11044
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`
|
|
11022
11045
|
);
|
|
11023
11046
|
if (resolveOutput(cmd) !== "json")
|
|
11024
|
-
console.log(`Deleted preference prompt ${
|
|
11047
|
+
console.log(`Deleted preference prompt ${id2}`);
|
|
11025
11048
|
});
|
|
11026
11049
|
const scenarios = group.command("scenarios").description("The repo \xD7 persona scenarios a preference prompt runs in");
|
|
11027
|
-
scenarios.command("list <id>").description("List a preference prompt's scenarios").action(async (
|
|
11050
|
+
scenarios.command("list <id>").description("List a preference prompt's scenarios").action(async (id2, _opts, cmd) => {
|
|
11028
11051
|
const org = resolveOrg(cmd);
|
|
11029
11052
|
const vp = await createClient().get(
|
|
11030
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11053
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`
|
|
11031
11054
|
);
|
|
11032
11055
|
if (resolveOutput(cmd) === "json") printJson(vp.scenarios);
|
|
11033
11056
|
else printItems(vp.scenarios.map(scenarioRow), "table");
|
|
@@ -11036,12 +11059,12 @@ function registerPreferenceGroup(group) {
|
|
|
11036
11059
|
"--persona <profileId>",
|
|
11037
11060
|
"persona profile id (default persona if omitted)"
|
|
11038
11061
|
).action(
|
|
11039
|
-
async (
|
|
11062
|
+
async (id2, opts, cmd) => {
|
|
11040
11063
|
const org = resolveOrg(cmd);
|
|
11041
11064
|
if (opts.ref !== void 0 && opts.repo === void 0)
|
|
11042
11065
|
throw new CliError("usage", "--ref requires --repo");
|
|
11043
11066
|
const created = await createClient().post(
|
|
11044
|
-
scenariosPath(org,
|
|
11067
|
+
scenariosPath(org, id2),
|
|
11045
11068
|
{
|
|
11046
11069
|
repoUrl: opts.repo ?? null,
|
|
11047
11070
|
repoRef: opts.ref ?? null,
|
|
@@ -11052,10 +11075,10 @@ function registerPreferenceGroup(group) {
|
|
|
11052
11075
|
else console.log(`Added scenario ${created.id}`);
|
|
11053
11076
|
}
|
|
11054
11077
|
);
|
|
11055
|
-
scenarios.command("rm <id>").description("Remove one scenario").requiredOption("--scenario <scenarioId>", "scenario id to remove").action(async (
|
|
11078
|
+
scenarios.command("rm <id>").description("Remove one scenario").requiredOption("--scenario <scenarioId>", "scenario id to remove").action(async (id2, opts, cmd) => {
|
|
11056
11079
|
const org = resolveOrg(cmd);
|
|
11057
11080
|
await createClient().delete(
|
|
11058
|
-
`${scenariosPath(org,
|
|
11081
|
+
`${scenariosPath(org, id2)}/${encodeURIComponent(opts.scenario)}`
|
|
11059
11082
|
);
|
|
11060
11083
|
if (resolveOutput(cmd) !== "json")
|
|
11061
11084
|
console.log(`Removed scenario ${opts.scenario}`);
|
|
@@ -11071,14 +11094,14 @@ function registerPreferenceGroup(group) {
|
|
|
11071
11094
|
"bill this run to the org's credits instead (superusers)"
|
|
11072
11095
|
).hideHelp(!staffCommandsVisible())
|
|
11073
11096
|
).option("--yes", "skip the confirmation").action(
|
|
11074
|
-
async (
|
|
11097
|
+
async (id2, opts, cmd) => {
|
|
11075
11098
|
const org = resolveOrg(cmd);
|
|
11076
11099
|
await confirmOrAbort(
|
|
11077
11100
|
opts.scenario.length > 0 ? `Run ${opts.scenario.length} selected scenario${opts.scenario.length === 1 ? "" : "s"} with the stored settings now?` : "Run every scenario of this prompt with the stored settings now?",
|
|
11078
11101
|
opts.yes
|
|
11079
11102
|
);
|
|
11080
11103
|
const result = await createClient().post(
|
|
11081
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11104
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}/run`,
|
|
11082
11105
|
{
|
|
11083
11106
|
...opts.billToOrg ? { billToOrg: true } : {},
|
|
11084
11107
|
visibilityScenarioIds: opts.scenario.length > 0 ? opts.scenario : void 0
|
|
@@ -11107,35 +11130,44 @@ function registerPreferenceGroup(group) {
|
|
|
11107
11130
|
result.queued ? "Synthesis queued \u2014 insights land on the Agent Preference page shortly" : "Nothing new since the last pass \u2014 no synthesis queued"
|
|
11108
11131
|
);
|
|
11109
11132
|
});
|
|
11110
|
-
group.command("runs <id>").description("The prompt's run log with Agent Preference verdicts").option("--limit <n>", "
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11133
|
+
group.command("runs <id>").description("The prompt's run log with Agent Preference verdicts").option("--limit <n>", "page size (1-500, default 100)").option("--cursor <cursor>", "resume from a previous page's nextCursor").action(
|
|
11134
|
+
async (id2, opts, cmd) => {
|
|
11135
|
+
const org = resolveOrg(cmd);
|
|
11136
|
+
const res = await createClient().get(
|
|
11137
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}/runs`,
|
|
11138
|
+
{ limit: opts.limit, cursor: opts.cursor }
|
|
11139
|
+
);
|
|
11140
|
+
if (resolveOutput(cmd) === "json") {
|
|
11141
|
+
printJson(res);
|
|
11142
|
+
return;
|
|
11143
|
+
}
|
|
11144
|
+
printItems(
|
|
11145
|
+
res.items.map((r) => ({
|
|
11146
|
+
id: r.id,
|
|
11147
|
+
status: r.status,
|
|
11148
|
+
agent: r.agent,
|
|
11149
|
+
model: r.resolvedModel ?? r.model ?? "",
|
|
11150
|
+
source: r.triggeredBy?.source ?? "",
|
|
11151
|
+
credits: r.creditsCharged ?? "",
|
|
11152
|
+
created: r.createdAt,
|
|
11153
|
+
verdict: r.verdict?.status ?? "-"
|
|
11154
|
+
})),
|
|
11155
|
+
"table"
|
|
11156
|
+
);
|
|
11157
|
+
if (res.nextCursor) {
|
|
11158
|
+
console.error(
|
|
11159
|
+
`(more results \u2014 rerun with --cursor ${res.nextCursor})`
|
|
11160
|
+
);
|
|
11161
|
+
}
|
|
11119
11162
|
}
|
|
11120
|
-
|
|
11121
|
-
res.items.map((r) => ({
|
|
11122
|
-
id: r.id,
|
|
11123
|
-
status: r.status,
|
|
11124
|
-
agent: r.agent,
|
|
11125
|
-
model: r.resolvedModel ?? r.model ?? "",
|
|
11126
|
-
created: r.createdAt,
|
|
11127
|
-
verdict: r.verdict?.status ?? "-"
|
|
11128
|
-
})),
|
|
11129
|
-
"table"
|
|
11130
|
-
);
|
|
11131
|
-
});
|
|
11163
|
+
);
|
|
11132
11164
|
group.command("tag <id>").description("Replace a preference prompt's user tags").option(
|
|
11133
11165
|
"--tag <name>",
|
|
11134
11166
|
"tag name, create-on-type (repeatable)",
|
|
11135
11167
|
collect,
|
|
11136
11168
|
[]
|
|
11137
11169
|
).option("--clear", "remove all user tags").action(
|
|
11138
|
-
async (
|
|
11170
|
+
async (id2, opts, cmd) => {
|
|
11139
11171
|
const org = resolveOrg(cmd);
|
|
11140
11172
|
if (opts.tag.length > 0 && opts.clear)
|
|
11141
11173
|
throw new CliError("usage", "--tag and --clear conflict");
|
|
@@ -11145,7 +11177,7 @@ function registerPreferenceGroup(group) {
|
|
|
11145
11177
|
"pass --tag <name> (repeatable) or --clear"
|
|
11146
11178
|
);
|
|
11147
11179
|
const updated = await createClient().patch(
|
|
11148
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11180
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`,
|
|
11149
11181
|
{ tags: opts.clear ? [] : opts.tag }
|
|
11150
11182
|
);
|
|
11151
11183
|
if (resolveOutput(cmd) === "json") printJson(updated);
|