@withgauge/cli 0.17.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 +2 -6
- package/dist/index.js +1485 -1597
- 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({
|
|
@@ -2590,578 +2590,468 @@ var meResponseSchema = z28.object({
|
|
|
2590
2590
|
});
|
|
2591
2591
|
|
|
2592
2592
|
// ../packages/api-schemas/src/optimizations.ts
|
|
2593
|
-
import { z as
|
|
2593
|
+
import { z as z33 } from "zod";
|
|
2594
2594
|
|
|
2595
|
-
// ../packages/api-schemas/src/cli-
|
|
2595
|
+
// ../packages/api-schemas/src/cli-rule-evidence.ts
|
|
2596
2596
|
import { z as z29 } from "zod";
|
|
2597
|
-
var
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
),
|
|
2605
|
-
"Use a workspace-relative path without traversal"
|
|
2606
|
-
);
|
|
2607
|
-
var sourcedValue = z29.discriminatedUnion("source", [
|
|
2608
|
-
z29.object({ source: z29.literal("literal"), value: z29.string().max(8192) }).strict(),
|
|
2609
|
-
z29.object({ source: z29.literal("localFact"), key: envKey }).strict()
|
|
2610
|
-
]);
|
|
2611
|
-
var cliLaunchFormSchema = z29.enum([
|
|
2612
|
-
"native",
|
|
2613
|
-
"path",
|
|
2614
|
-
"symlink",
|
|
2615
|
-
"shebang",
|
|
2616
|
-
"node-script",
|
|
2617
|
-
"python-script",
|
|
2618
|
-
"python-module",
|
|
2619
|
-
"execveat-path",
|
|
2620
|
-
"execveat-fd"
|
|
2621
|
-
]);
|
|
2622
|
-
var cliObservationReasonSchema = z29.enum([
|
|
2623
|
-
"eligible",
|
|
2624
|
-
"other-target",
|
|
2625
|
-
"other-command",
|
|
2626
|
-
"selector-mismatch",
|
|
2627
|
-
"unknown-command",
|
|
2628
|
-
"identity-unresolved",
|
|
2629
|
-
"artifact-mismatch",
|
|
2630
|
-
"runtime-mismatch",
|
|
2631
|
-
"launch-form",
|
|
2632
|
-
"io-profile",
|
|
2633
|
-
"operation-profile",
|
|
2634
|
-
"descriptor-lifetime"
|
|
2635
|
-
]);
|
|
2636
|
-
var cliIoProfileSchema = z29.enum([
|
|
2637
|
-
"pipes",
|
|
2638
|
-
"redirected",
|
|
2639
|
-
"shared-descriptor",
|
|
2640
|
-
"pty"
|
|
2641
|
-
]);
|
|
2642
|
-
var cliObservationSchema = z29.object({
|
|
2643
|
-
invocationId: z29.string().regex(/^[a-f0-9]{32}$/),
|
|
2644
|
-
targetId: token,
|
|
2645
|
-
commandId: token.nullable(),
|
|
2646
|
-
entrypointSha256: digest,
|
|
2647
|
-
runtimeSha256: digest.nullable(),
|
|
2648
|
-
launchForm: cliLaunchFormSchema.nullable(),
|
|
2649
|
-
ioProfile: cliIoProfileSchema.nullable(),
|
|
2650
|
-
reason: cliObservationReasonSchema
|
|
2651
|
-
});
|
|
2652
|
-
var cliCoverageSchema = z29.object({
|
|
2653
|
-
attempt: z29.number().int().nonnegative(),
|
|
2654
|
-
observedInvocationCount: z29.number().int().nonnegative().nullable(),
|
|
2655
|
-
invocationCount: z29.number().int().nonnegative(),
|
|
2656
|
-
appliedInvocationCount: z29.number().int().nonnegative(),
|
|
2657
|
-
incompleteCount: z29.number().int().nonnegative(),
|
|
2658
|
-
unsupportedCount: z29.number().int().nonnegative(),
|
|
2659
|
-
instrumentationFailed: z29.boolean(),
|
|
2660
|
-
observations: z29.array(cliObservationSchema),
|
|
2661
|
-
unsupportedDiagnostics: z29.array(z29.string())
|
|
2662
|
-
});
|
|
2663
|
-
var cliOperationKindSchema = z29.enum([
|
|
2664
|
-
"ensureOption",
|
|
2665
|
-
"replaceOption",
|
|
2666
|
-
"setEnv",
|
|
2667
|
-
"streamOutput",
|
|
2668
|
-
"completeOutput",
|
|
2669
|
-
"structuredStdin",
|
|
2670
|
-
"promptRecipe",
|
|
2671
|
-
"generatedFile"
|
|
2597
|
+
var cliRuleDeliverySchema = z29.enum([
|
|
2598
|
+
"applied",
|
|
2599
|
+
"matched_unchanged",
|
|
2600
|
+
"not_exercised",
|
|
2601
|
+
"failed",
|
|
2602
|
+
"partial",
|
|
2603
|
+
"unavailable"
|
|
2672
2604
|
]);
|
|
2673
|
-
var
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
var cliTargetSchema = z29.object({
|
|
2684
|
-
id: token,
|
|
2685
|
-
vendor: token,
|
|
2686
|
-
package: token,
|
|
2687
|
-
version: token.nullable(),
|
|
2688
|
-
/** Published artifact identity and exact executable/entrypoint identity. */
|
|
2689
|
-
artifactSha256: digest.nullable(),
|
|
2690
|
-
entrypointSha256: digest.nullable(),
|
|
2691
|
-
/** Trace-derived recognition hints. Actual bytes are captured by record mode. */
|
|
2692
|
-
discovery: z29.object({
|
|
2693
|
-
ecosystem: token.nullable(),
|
|
2694
|
-
program: token,
|
|
2695
|
-
executables: z29.array(token).max(20)
|
|
2696
|
-
}).strict().optional(),
|
|
2697
|
-
ownershipEvidence: z29.string().min(1).max(2048),
|
|
2698
|
-
entrypoints: z29.array(z29.string().min(1).max(1024)).max(20),
|
|
2699
|
-
/** Flags accepted before the subcommand, with explicit value arity. */
|
|
2700
|
-
globalOptions: z29.array(z29.object({ flag: optionFlag, takesValue: z29.boolean() }).strict()).max(100),
|
|
2701
|
-
launchForms: z29.array(cliLaunchFormSchema).min(1),
|
|
2702
|
-
ioProfiles: z29.array(cliIoProfileSchema).min(1),
|
|
2703
|
-
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(
|
|
2704
2615
|
z29.object({
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
})
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
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)
|
|
2735
2724
|
});
|
|
2736
|
-
|
|
2737
|
-
if (
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
"setEnv",
|
|
2771
|
-
capabilities2.settings.length > 0,
|
|
2772
|
-
"Environment changes need supported settings"
|
|
2773
|
-
);
|
|
2774
|
-
requires(
|
|
2775
|
-
"ensureOption",
|
|
2776
|
-
capabilities2.options.length > 0,
|
|
2777
|
-
"Arguments need supported options"
|
|
2778
|
-
);
|
|
2779
|
-
requires(
|
|
2780
|
-
"replaceOption",
|
|
2781
|
-
capabilities2.options.length > 0,
|
|
2782
|
-
"Arguments need supported options"
|
|
2783
|
-
);
|
|
2784
|
-
}
|
|
2785
|
-
});
|
|
2786
|
-
var CLI_CATALOG_MAX_TARGETS = 100;
|
|
2787
|
-
var cliCatalogSchema = z29.object({
|
|
2788
|
-
version: z29.union([z29.literal(1), z29.literal(2)]),
|
|
2789
|
-
engineVersion: token,
|
|
2790
|
-
digest,
|
|
2791
|
-
targets: z29.array(cliTargetSchema).max(CLI_CATALOG_MAX_TARGETS)
|
|
2792
|
-
}).strict().superRefine((catalog, ctx) => {
|
|
2793
|
-
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
|
+
))
|
|
2794
2759
|
ctx.addIssue({
|
|
2795
2760
|
code: "custom",
|
|
2796
|
-
message: "
|
|
2761
|
+
message: `Use valid non-NUL UTF-8 text of at most ${max} bytes${nonempty ? ", not empty" : ""}`
|
|
2797
2762
|
});
|
|
2798
|
-
catalog.targets.forEach((target, index) => {
|
|
2799
|
-
if (catalog.targets.findIndex((other) => other.id === target.id) !== index)
|
|
2800
|
-
ctx.addIssue({
|
|
2801
|
-
code: "custom",
|
|
2802
|
-
path: ["targets", index, "id"],
|
|
2803
|
-
message: "Duplicate target ID"
|
|
2804
|
-
});
|
|
2805
|
-
});
|
|
2806
2763
|
});
|
|
2807
|
-
var
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
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)
|
|
2812
2775
|
}).strict()
|
|
2813
2776
|
]);
|
|
2814
|
-
var
|
|
2815
|
-
|
|
2816
|
-
|
|
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) {
|
|
2817
2786
|
let at = pattern.startsWith("^") ? 1 : 0;
|
|
2818
2787
|
const end = pattern.endsWith("$") && pattern.length > at ? pattern.length - 1 : pattern.length;
|
|
2819
2788
|
let stars = 0;
|
|
2820
|
-
let
|
|
2789
|
+
let literals = 0;
|
|
2821
2790
|
while (at < end) {
|
|
2822
2791
|
const char = pattern[at];
|
|
2823
2792
|
if (char === "\\") {
|
|
2824
2793
|
if (++at >= end || !"\\.^$*+?[]{}()|".includes(pattern[at])) return false;
|
|
2825
|
-
|
|
2794
|
+
literals++;
|
|
2826
2795
|
} else if (char === "." && pattern[at + 1] === "*") {
|
|
2827
2796
|
if (++stars > 1) return false;
|
|
2828
2797
|
at++;
|
|
2829
|
-
} else if (".^$*+?[]{}()|\n\r".includes(char))
|
|
2830
|
-
|
|
2831
|
-
} else {
|
|
2832
|
-
literalBytes++;
|
|
2833
|
-
}
|
|
2798
|
+
} else if (".^$*+?[]{}()|\n\r".includes(char)) return false;
|
|
2799
|
+
else literals++;
|
|
2834
2800
|
at++;
|
|
2835
2801
|
}
|
|
2836
|
-
return
|
|
2802
|
+
return literals > 0;
|
|
2837
2803
|
}
|
|
2838
|
-
var
|
|
2839
|
-
|
|
2840
|
-
kind:
|
|
2841
|
-
|
|
2842
|
-
|
|
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._-]*$/)
|
|
2843
2809
|
}).strict(),
|
|
2844
|
-
|
|
2845
|
-
kind:
|
|
2846
|
-
|
|
2847
|
-
|
|
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)
|
|
2848
2822
|
}).strict(),
|
|
2849
|
-
|
|
2850
|
-
kind:
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
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
|
|
2854
2842
|
}).strict(),
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2843
|
+
z30.object({
|
|
2844
|
+
id,
|
|
2845
|
+
kind: z30.literal("streamOutput"),
|
|
2846
|
+
stream,
|
|
2847
|
+
edit: z30.object({ find: text(8192, true), replace: literal }).strict()
|
|
2859
2848
|
}).strict(),
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
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 .*"
|
|
2873
2863
|
)
|
|
2874
2864
|
}).strict()
|
|
2875
|
-
])
|
|
2876
|
-
replace: z29.string().max(8192),
|
|
2877
|
-
exit: exitPredicate
|
|
2865
|
+
])
|
|
2878
2866
|
}).strict(),
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
callerInput: z29.literal("replace"),
|
|
2885
|
-
eof: z29.literal("close")
|
|
2867
|
+
z30.object({
|
|
2868
|
+
id,
|
|
2869
|
+
kind: z30.literal("ensureOption"),
|
|
2870
|
+
option: flag,
|
|
2871
|
+
value: source(arg).optional()
|
|
2886
2872
|
}).strict(),
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2873
|
+
z30.object({
|
|
2874
|
+
id,
|
|
2875
|
+
kind: z30.literal("replaceOption"),
|
|
2876
|
+
option: flag,
|
|
2877
|
+
value: source(arg)
|
|
2878
|
+
}).strict(),
|
|
2879
|
+
z30.object({
|
|
2880
|
+
id,
|
|
2881
|
+
kind: z30.literal("setEnv"),
|
|
2882
|
+
key: envKey,
|
|
2883
|
+
value: source(arg),
|
|
2884
|
+
whenAbsent: z30.boolean()
|
|
2899
2885
|
}).strict(),
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
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")
|
|
2908
2894
|
}).strict()
|
|
2909
2895
|
]);
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
}).strict();
|
|
2930
|
-
var cliInterventionSchema = z29.object({
|
|
2931
|
-
schemaVersion: z29.union([z29.literal(1), z29.literal(2)]),
|
|
2932
|
-
identityPolicy: z29.literal("artifact").optional(),
|
|
2933
|
-
engineVersion: token,
|
|
2934
|
-
engineSha256: digest.nullable(),
|
|
2935
|
-
bundleSha256: digest,
|
|
2936
|
-
catalog: cliCatalogSchema,
|
|
2937
|
-
mode: z29.enum(["record", "trial"]),
|
|
2938
|
-
captureProfiles: z29.array(cliIoProfileSchema).min(1),
|
|
2939
|
-
activeTargetId: token.nullable(),
|
|
2940
|
-
activeCommandId: token.nullable(),
|
|
2941
|
-
selector: z29.object({
|
|
2942
|
-
optionPresent: z29.array(optionFlag).max(20),
|
|
2943
|
-
optionAbsent: z29.array(optionFlag).max(20)
|
|
2944
|
-
}).strict().nullable(),
|
|
2945
|
-
baselineInvocations: z29.array(baselineInvocationSchema).max(500),
|
|
2946
|
-
operations: z29.array(operationSchema).max(50),
|
|
2947
|
-
limits: z29.object({
|
|
2948
|
-
completedStreamBytes: z29.number().int().min(1).max(2 * 1024 * 1024),
|
|
2949
|
-
replacementBytes: z29.number().int().min(1).max(8192),
|
|
2950
|
-
generatedFileBytes: z29.number().int().min(1).max(2 * 1024 * 1024),
|
|
2951
|
-
generatedAggregateBytes: z29.number().int().min(1).max(8 * 1024 * 1024),
|
|
2952
|
-
generatedFileCount: z29.number().int().min(1).max(50)
|
|
2953
|
-
}).strict(),
|
|
2954
|
-
shippingIntent: z29.enum([
|
|
2955
|
-
"default",
|
|
2956
|
-
"message",
|
|
2957
|
-
"interaction",
|
|
2958
|
-
"invocation-guidance",
|
|
2959
|
-
"template"
|
|
2960
|
-
]).nullable()
|
|
2961
|
-
}).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) => {
|
|
2962
2915
|
const fail = (path3, message2) => ctx.addIssue({ code: "custom", path: path3, message: message2 });
|
|
2963
|
-
if (
|
|
2964
|
-
fail(["
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
["
|
|
2970
|
-
"
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
bundle.baselineInvocations.forEach((invocation, index) => {
|
|
2984
|
-
const command2 = bundle.catalog.targets.find((target2) => target2.id === invocation.targetId)?.commands.find((item) => item.id === invocation.commandId);
|
|
2985
|
-
for (const [fileIndex, file] of invocation.recordFiles.entries()) {
|
|
2986
|
-
if (command2?.capabilities.generatedPaths[file.pathIndex] !== file.path || file.status === "generated" && !file.generatedSha256 || file.status === "not-exercised" && file.generatedSha256 !== file.beforeSha256)
|
|
2987
|
-
fail(
|
|
2988
|
-
["baselineInvocations", index, "recordFiles", fileIndex],
|
|
2989
|
-
"Recorded file does not match the qualified command"
|
|
2990
|
-
);
|
|
2991
|
-
}
|
|
2992
|
-
});
|
|
2993
|
-
if (bundle.engineVersion !== bundle.catalog.engineVersion)
|
|
2994
|
-
fail(["engineVersion"], "Engine and catalog versions differ");
|
|
2995
|
-
if (bundle.mode === "record") {
|
|
2996
|
-
if (bundle.activeTargetId || bundle.activeCommandId || bundle.selector || bundle.operations.length || bundle.shippingIntent)
|
|
2997
|
-
fail(["mode"], "Record mode cannot select or modify a command");
|
|
2998
|
-
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");
|
|
2999
2936
|
}
|
|
3000
|
-
|
|
3001
|
-
(
|
|
3002
|
-
)
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
if (!target || !command) {
|
|
3007
|
-
fail(
|
|
3008
|
-
["activeCommandId"],
|
|
3009
|
-
"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
|
|
3010
2943
|
);
|
|
3011
|
-
|
|
3012
|
-
}
|
|
3013
|
-
if (!bundle.selector) fail(["selector"], "A trial needs token predicates");
|
|
3014
|
-
else {
|
|
3015
|
-
for (const flag of [
|
|
3016
|
-
...bundle.selector.optionPresent,
|
|
3017
|
-
...bundle.selector.optionAbsent
|
|
3018
|
-
])
|
|
3019
|
-
if (!command.capabilities.options.some((option) => option.flag === flag))
|
|
3020
|
-
fail(["selector"], `Unsupported selector option: ${flag}`);
|
|
3021
|
-
if (bundle.selector.optionPresent.some(
|
|
3022
|
-
(flag) => bundle.selector?.optionAbsent.includes(flag)
|
|
3023
|
-
))
|
|
2944
|
+
if (parsed.kind === "ambiguous")
|
|
3024
2945
|
fail(
|
|
3025
|
-
["
|
|
3026
|
-
|
|
2946
|
+
["optionArity"],
|
|
2947
|
+
`Exact rules with argument edits must parse their argv (${parsed.reason}); declare each option's arity and supply its required value`
|
|
3027
2948
|
);
|
|
3028
2949
|
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
if (bundle.captureProfiles.includes("pty")) {
|
|
3040
|
-
for (const [index, operation] of bundle.operations.entries()) {
|
|
3041
|
-
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))
|
|
3042
2960
|
fail(
|
|
3043
|
-
|
|
3044
|
-
"
|
|
2961
|
+
path3,
|
|
2962
|
+
"Argument operation value must agree with declared option arity"
|
|
3045
2963
|
);
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
);
|
|
3055
|
-
if (bundle.operations.some(
|
|
3056
|
-
(item) => (item.kind === "streamOutput" || item.kind === "completeOutput") && item.stream === "combined"
|
|
3057
|
-
) && !bundle.baselineInvocations.some(
|
|
3058
|
-
(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)
|
|
3059
|
-
))
|
|
3060
|
-
fail(
|
|
3061
|
-
["operations"],
|
|
3062
|
-
"Combined output requires a shared-descriptor or PTY baseline profile"
|
|
3063
|
-
);
|
|
3064
|
-
if (!bundle.baselineInvocations.some(
|
|
3065
|
-
(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)
|
|
3066
|
-
))
|
|
3067
|
-
fail(
|
|
3068
|
-
["baselineInvocations"],
|
|
3069
|
-
"No baseline invocation matches this exact command, artifact, launch form, and I/O profile"
|
|
3070
|
-
);
|
|
3071
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3072
|
-
const changedEnvironment = new Set(
|
|
3073
|
-
bundle.operations.flatMap(
|
|
3074
|
-
(item) => item.kind === "setEnv" ? [item.key] : []
|
|
3075
|
-
)
|
|
3076
|
-
);
|
|
3077
|
-
bundle.operations.forEach((operation, index) => {
|
|
3078
|
-
const path3 = ["operations", index];
|
|
3079
|
-
if (!command.capabilities.operations.includes(operation.kind))
|
|
3080
|
-
fail(path3, `${operation.kind} is not qualified for this command`);
|
|
3081
|
-
if ("option" in operation && !command.capabilities.options.some(
|
|
3082
|
-
(option) => option.flag === operation.option
|
|
3083
|
-
))
|
|
3084
|
-
fail(path3, "Option is not supported by this version");
|
|
3085
|
-
if (operation.kind === "ensureOption" || operation.kind === "replaceOption") {
|
|
3086
|
-
const option = command.capabilities.options.find(
|
|
3087
|
-
(item) => item.flag === operation.option
|
|
3088
|
-
);
|
|
3089
|
-
if (option && option.takesValue !== (operation.value !== void 0))
|
|
3090
|
-
fail(path3, "Option value does not match its qualified arity");
|
|
3091
|
-
}
|
|
3092
|
-
if (operation.kind === "setEnv" && !command.capabilities.settings.includes(operation.key))
|
|
3093
|
-
fail(path3, "Environment setting is not supported by this version");
|
|
3094
|
-
if (operation.kind === "structuredStdin" && !command.capabilities.stdinFormats.includes(operation.format))
|
|
3095
|
-
fail(path3, "Stdin format is not qualified");
|
|
3096
|
-
if (operation.kind === "structuredStdin" && operation.payload.source === "literal" && operation.format !== "text") {
|
|
3097
|
-
const records = operation.format === "json" ? [operation.payload.value] : operation.payload.value.trimEnd().split("\n");
|
|
3098
|
-
try {
|
|
3099
|
-
if (records.some((record2) => !record2.trim()))
|
|
3100
|
-
throw new Error("Empty structured stdin record");
|
|
3101
|
-
for (const record2 of records) JSON.parse(record2);
|
|
3102
|
-
} 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"))
|
|
3103
2972
|
fail(
|
|
3104
2973
|
path3,
|
|
3105
|
-
"
|
|
2974
|
+
"Use one whole replacement or a chain of one output kind per stream"
|
|
3106
2975
|
);
|
|
3107
|
-
|
|
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
|
+
});
|
|
3108
2985
|
}
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
if (operation.kind === "generatedFile" && !command.capabilities.generatedPaths.includes(operation.path))
|
|
3112
|
-
fail(path3, "Output path is not attributed to this command");
|
|
3113
|
-
if (operation.kind === "generatedFile" && !bundle.baselineInvocations.some(
|
|
3114
|
-
(invocation) => invocation.targetId === target.id && invocation.commandId === command.id && invocation.recordFiles.some(
|
|
3115
|
-
(file) => file.path === operation.path && file.status === "generated" && file.beforeSha256 === operation.beforeSha256 && file.generatedSha256 === operation.generatedSha256
|
|
3116
|
-
)
|
|
3117
|
-
))
|
|
3118
|
-
fail(
|
|
3119
|
-
path3,
|
|
3120
|
-
"No attributed baseline file matches the preimage and real generated bytes"
|
|
3121
|
-
);
|
|
3122
|
-
if (operation.kind === "streamOutput" && !command.capabilities.outputModes.includes("streaming"))
|
|
3123
|
-
fail(path3, "Streaming output is not qualified");
|
|
3124
|
-
if (operation.kind === "completeOutput" && !command.capabilities.outputModes.includes("completed"))
|
|
3125
|
-
fail(path3, "Completed output is not qualified");
|
|
3126
|
-
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)
|
|
3127
|
-
fail(path3, "A trial operation must change the matched content");
|
|
3128
|
-
const sources = [
|
|
3129
|
-
"value" in operation ? operation.value : null,
|
|
3130
|
-
operation.kind === "structuredStdin" ? operation.payload : null,
|
|
3131
|
-
...operation.kind === "promptRecipe" ? operation.steps.map((step) => step.response) : []
|
|
3132
|
-
];
|
|
3133
|
-
if (sources.some(
|
|
3134
|
-
(source) => source?.source === "localFact" && !command.capabilities.localFacts.includes(source.key)
|
|
3135
|
-
))
|
|
3136
|
-
fail(path3, "Local fact is not declared non-secret for this command");
|
|
3137
|
-
if (sources.some(
|
|
3138
|
-
(source) => source?.source === "localFact" && changedEnvironment.has(source.key)
|
|
3139
|
-
))
|
|
3140
|
-
fail(
|
|
3141
|
-
path3,
|
|
3142
|
-
"A local fact cannot be changed by another operation in the same trial"
|
|
3143
|
-
);
|
|
3144
|
-
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;
|
|
3145
|
-
if (conflict && seen.has(conflict))
|
|
3146
|
-
fail(path3, "Conflicting operation on the same input or output");
|
|
3147
|
-
if (conflict) seen.add(conflict);
|
|
3148
|
-
});
|
|
3149
|
-
if (bundle.operations.filter((item) => item.kind === "generatedFile").length > bundle.limits.generatedFileCount)
|
|
2986
|
+
}
|
|
2987
|
+
if (outputs.has("combined") && outputs.size > 1)
|
|
3150
2988
|
fail(
|
|
3151
|
-
["
|
|
3152
|
-
"
|
|
2989
|
+
["operations"],
|
|
2990
|
+
"Combined output cannot be mixed with separate-stream output"
|
|
3153
2991
|
);
|
|
3154
2992
|
});
|
|
3155
|
-
var
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
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);
|
|
3165
3055
|
|
|
3166
3056
|
// ../packages/api-schemas/src/climb-kinds.ts
|
|
3167
3057
|
var LEVER_KINDS = [
|
|
@@ -3191,35 +3081,35 @@ var LEVER_INTERVENTIONS = {
|
|
|
3191
3081
|
};
|
|
3192
3082
|
|
|
3193
3083
|
// ../packages/api-schemas/src/sandbox-overrides.ts
|
|
3194
|
-
import { z as
|
|
3084
|
+
import { z as z31 } from "zod";
|
|
3195
3085
|
var SANDBOX_OVERRIDE_KINDS = ["packages", "clis"];
|
|
3196
|
-
var ecosystemSchema =
|
|
3197
|
-
var overrideFilesSchema =
|
|
3198
|
-
|
|
3199
|
-
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(
|
|
3200
3090
|
(path3) => !path3.startsWith("/") && !path3.includes("\\") && !path3.split("/").includes(".."),
|
|
3201
3091
|
"Use a relative path within the target"
|
|
3202
3092
|
),
|
|
3203
|
-
body:
|
|
3093
|
+
body: z31.string()
|
|
3204
3094
|
}).strict()
|
|
3205
3095
|
).min(1);
|
|
3206
3096
|
var contentShape = {
|
|
3207
|
-
version:
|
|
3097
|
+
version: z31.string().trim().min(1).optional(),
|
|
3208
3098
|
files: overrideFilesSchema.optional()
|
|
3209
3099
|
};
|
|
3210
3100
|
var hasContent = (value) => value.version !== void 0 || value.files !== void 0;
|
|
3211
|
-
var sandboxOverridesSchema =
|
|
3212
|
-
version:
|
|
3213
|
-
packages:
|
|
3214
|
-
|
|
3101
|
+
var sandboxOverridesSchema = z31.object({
|
|
3102
|
+
version: z31.literal(1),
|
|
3103
|
+
packages: z31.array(
|
|
3104
|
+
z31.object({
|
|
3215
3105
|
ecosystem: ecosystemSchema,
|
|
3216
|
-
name:
|
|
3106
|
+
name: z31.string().trim().min(1),
|
|
3217
3107
|
...contentShape
|
|
3218
3108
|
}).strict().refine(hasContent, "Specify a version or files")
|
|
3219
3109
|
).optional(),
|
|
3220
|
-
clis:
|
|
3221
|
-
|
|
3222
|
-
name:
|
|
3110
|
+
clis: z31.array(
|
|
3111
|
+
z31.object({
|
|
3112
|
+
name: z31.string().trim().min(1),
|
|
3223
3113
|
...contentShape
|
|
3224
3114
|
}).strict().refine(hasContent, "Specify a version or files")
|
|
3225
3115
|
).optional()
|
|
@@ -3246,11 +3136,11 @@ var sandboxOverridesSchema = z30.object({
|
|
|
3246
3136
|
});
|
|
3247
3137
|
|
|
3248
3138
|
// ../packages/api-schemas/src/climb.ts
|
|
3249
|
-
var climbSubjectKindSchema =
|
|
3250
|
-
var leverKindSchema =
|
|
3251
|
-
var interventionKindSchema =
|
|
3252
|
-
var skill =
|
|
3253
|
-
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();
|
|
3254
3144
|
function validateFixtureIntervention(value, ctx) {
|
|
3255
3145
|
const result = webFixtureSchema.safeParse({ version: 1, ...value });
|
|
3256
3146
|
if (!result.success) {
|
|
@@ -3263,75 +3153,73 @@ function validateFixtureIntervention(value, ctx) {
|
|
|
3263
3153
|
}
|
|
3264
3154
|
}
|
|
3265
3155
|
}
|
|
3266
|
-
var interventionSchema =
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
kind:
|
|
3273
|
-
before:
|
|
3274
|
-
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)
|
|
3275
3165
|
}),
|
|
3276
|
-
|
|
3277
|
-
kind:
|
|
3278
|
-
after:
|
|
3166
|
+
z32.object({
|
|
3167
|
+
kind: z32.literal("PACKAGE_VERSION"),
|
|
3168
|
+
after: z32.object({
|
|
3279
3169
|
ecosystem: ecosystemSchema,
|
|
3280
|
-
name:
|
|
3281
|
-
version:
|
|
3170
|
+
name: z32.string().min(1),
|
|
3171
|
+
version: z32.string().min(1)
|
|
3282
3172
|
}).strict()
|
|
3283
3173
|
}),
|
|
3284
|
-
|
|
3285
|
-
kind:
|
|
3286
|
-
after:
|
|
3174
|
+
z32.object({
|
|
3175
|
+
kind: z32.literal("PACKAGE_CONTENT"),
|
|
3176
|
+
after: z32.object({
|
|
3287
3177
|
ecosystem: ecosystemSchema,
|
|
3288
|
-
name:
|
|
3178
|
+
name: z32.string().min(1),
|
|
3289
3179
|
files: overrideFilesSchema
|
|
3290
3180
|
}).strict()
|
|
3291
3181
|
}),
|
|
3292
|
-
|
|
3293
|
-
kind:
|
|
3294
|
-
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()
|
|
3295
3185
|
}),
|
|
3296
|
-
|
|
3297
|
-
kind:
|
|
3298
|
-
after:
|
|
3299
|
-
message: "A CLI trial requires a trial-mode bundle"
|
|
3300
|
-
})
|
|
3186
|
+
z32.object({
|
|
3187
|
+
kind: z32.literal("CLI_INTERVENTION"),
|
|
3188
|
+
after: cliRuleBundleSchema
|
|
3301
3189
|
})
|
|
3302
3190
|
]);
|
|
3303
|
-
var climbSettingsSchema =
|
|
3304
|
-
maxRounds:
|
|
3305
|
-
sampleCount:
|
|
3306
|
-
creditCap:
|
|
3307
|
-
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),
|
|
3308
3196
|
// Narrow the subject's whole roster to one slot, for the baseline and every
|
|
3309
3197
|
// trial alike. A subject rostering ten models otherwise multiplies every
|
|
3310
3198
|
// trial by ten, and a one-model trial measured against a ten-model baseline
|
|
3311
3199
|
// is not a comparison. `pinnedModel` empty means the agent's default model.
|
|
3312
3200
|
pinnedAgent: schedulableAgentSchema.optional(),
|
|
3313
|
-
pinnedModel:
|
|
3314
|
-
maxTrialsPerRound:
|
|
3201
|
+
pinnedModel: z32.string().optional(),
|
|
3202
|
+
maxTrialsPerRound: z32.number().int().min(1).max(10).default(3),
|
|
3315
3203
|
// The round a continuation started at; the no-improvement counter
|
|
3316
3204
|
// restarts here.
|
|
3317
|
-
continuedAtRound:
|
|
3205
|
+
continuedAtRound: z32.number().int().nonnegative().optional()
|
|
3318
3206
|
}).strip().refine((value) => value.pinnedAgent !== void 0 || !value.pinnedModel, {
|
|
3319
3207
|
path: ["pinnedAgent"],
|
|
3320
3208
|
message: "Pin an agent with the model"
|
|
3321
3209
|
});
|
|
3322
|
-
var climbDirectionSchema =
|
|
3323
|
-
focus:
|
|
3324
|
-
preserve:
|
|
3325
|
-
exclude:
|
|
3326
|
-
notes:
|
|
3327
|
-
});
|
|
3328
|
-
var climbDirectionPatchSchema =
|
|
3329
|
-
focus:
|
|
3330
|
-
preserve:
|
|
3331
|
-
exclude:
|
|
3332
|
-
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(),
|
|
3333
3221
|
/** One line on why this was recorded; becomes the DIRECTION row summary. */
|
|
3334
|
-
rationale:
|
|
3222
|
+
rationale: z32.string().trim().max(500).optional()
|
|
3335
3223
|
}).strict();
|
|
3336
3224
|
var CLIMB_ACTIVITY_KINDS = [
|
|
3337
3225
|
"STARTED",
|
|
@@ -3350,74 +3238,74 @@ var CLIMB_ACTIVITY_KINDS = [
|
|
|
3350
3238
|
"CONTINUED",
|
|
3351
3239
|
"CANCELED"
|
|
3352
3240
|
];
|
|
3353
|
-
var climbActivityKindSchema =
|
|
3354
|
-
var proposerTraceStepSchema =
|
|
3355
|
-
tool:
|
|
3356
|
-
args:
|
|
3357
|
-
result:
|
|
3358
|
-
isError:
|
|
3359
|
-
});
|
|
3360
|
-
var proposerTraceSchema =
|
|
3361
|
-
steps:
|
|
3362
|
-
reasoning:
|
|
3363
|
-
durationMs:
|
|
3364
|
-
model:
|
|
3365
|
-
});
|
|
3366
|
-
var climbActivitySchema =
|
|
3367
|
-
id:
|
|
3368
|
-
climbId:
|
|
3369
|
-
roundId:
|
|
3370
|
-
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(),
|
|
3371
3259
|
kind: climbActivityKindSchema,
|
|
3372
|
-
actorUserId:
|
|
3373
|
-
actorName:
|
|
3374
|
-
summary:
|
|
3375
|
-
detail:
|
|
3376
|
-
createdAt:
|
|
3377
|
-
});
|
|
3378
|
-
var activityQuerySchema =
|
|
3379
|
-
after:
|
|
3380
|
-
limit:
|
|
3381
|
-
});
|
|
3382
|
-
var climbConfigSnapshotSchema =
|
|
3383
|
-
promptText:
|
|
3384
|
-
scenario:
|
|
3385
|
-
repoUrl:
|
|
3386
|
-
repoRef:
|
|
3387
|
-
profileId:
|
|
3388
|
-
profileName:
|
|
3389
|
-
profileDescription:
|
|
3390
|
-
profileModel:
|
|
3391
|
-
limits:
|
|
3392
|
-
agents:
|
|
3393
|
-
skillRefs:
|
|
3394
|
-
mcpRefs:
|
|
3395
|
-
skillVersionIds:
|
|
3396
|
-
mcpServerVersionIds:
|
|
3397
|
-
skillSet:
|
|
3398
|
-
mcpSet:
|
|
3399
|
-
connectionIds:
|
|
3400
|
-
connectionSet:
|
|
3401
|
-
agentContext:
|
|
3402
|
-
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(),
|
|
3403
3291
|
webFixture: webFixtureSchema.nullable(),
|
|
3404
|
-
cliIntervention:
|
|
3292
|
+
cliIntervention: cliRuleBundleSchema.nullable().default(null),
|
|
3405
3293
|
sandboxOverrides: sandboxOverridesSchema.nullable(),
|
|
3406
|
-
visibilityScenarioId:
|
|
3294
|
+
visibilityScenarioId: z32.string().nullable()
|
|
3407
3295
|
}).strict();
|
|
3408
|
-
var targetRefSchema =
|
|
3409
|
-
kind:
|
|
3410
|
-
id:
|
|
3411
|
-
url:
|
|
3412
|
-
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()
|
|
3413
3301
|
}).strict();
|
|
3414
|
-
var trialInputSchema =
|
|
3415
|
-
title:
|
|
3416
|
-
hypothesis:
|
|
3302
|
+
var trialInputSchema = z32.object({
|
|
3303
|
+
title: z32.string().trim().min(1).max(200),
|
|
3304
|
+
hypothesis: z32.string().max(4e3).optional(),
|
|
3417
3305
|
lever: leverKindSchema,
|
|
3418
3306
|
targetRef: targetRefSchema.optional(),
|
|
3419
3307
|
intervention: interventionSchema,
|
|
3420
|
-
authorMode:
|
|
3308
|
+
authorMode: z32.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL")
|
|
3421
3309
|
}).strict().superRefine((value, ctx) => {
|
|
3422
3310
|
const allowed = LEVER_INTERVENTIONS[value.lever];
|
|
3423
3311
|
if (!allowed.includes(value.intervention.kind))
|
|
@@ -3436,7 +3324,7 @@ var OPTIMIZATION_STATUSES = [
|
|
|
3436
3324
|
"DONE",
|
|
3437
3325
|
"ARCHIVED"
|
|
3438
3326
|
];
|
|
3439
|
-
var optimizationStatusSchema =
|
|
3327
|
+
var optimizationStatusSchema = z33.enum(OPTIMIZATION_STATUSES);
|
|
3440
3328
|
var ROUND_STATUSES = [
|
|
3441
3329
|
"PROPOSING",
|
|
3442
3330
|
"PROPOSED",
|
|
@@ -3465,61 +3353,61 @@ var OPTIMIZATION_EFFORTS = [
|
|
|
3465
3353
|
{ value: "HIGH", label: "Thorough", sampleCount: 2, maxRounds: 8 },
|
|
3466
3354
|
{ value: "XHIGH", label: "Exhaustive", sampleCount: 3, maxRounds: 12 }
|
|
3467
3355
|
];
|
|
3468
|
-
var optimizationEffortSchema =
|
|
3356
|
+
var optimizationEffortSchema = z33.enum(
|
|
3469
3357
|
OPTIMIZATION_EFFORTS.map((preset) => preset.value)
|
|
3470
3358
|
);
|
|
3471
|
-
var listOptimizationsQuerySchema =
|
|
3472
|
-
status:
|
|
3359
|
+
var listOptimizationsQuerySchema = z33.object({
|
|
3360
|
+
status: z33.string().optional().transform(
|
|
3473
3361
|
(value) => value ? value.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean) : void 0
|
|
3474
|
-
).pipe(
|
|
3362
|
+
).pipe(z33.array(optimizationStatusSchema).optional()),
|
|
3475
3363
|
subjectKind: climbSubjectKindSchema.optional(),
|
|
3476
|
-
subjectId:
|
|
3477
|
-
limit:
|
|
3364
|
+
subjectId: z33.string().min(1).optional(),
|
|
3365
|
+
limit: z33.coerce.number().int().min(1).max(200).default(50),
|
|
3478
3366
|
/** Drafts are workspaces, not runs; older clients never see them. */
|
|
3479
|
-
includeDrafts:
|
|
3367
|
+
includeDrafts: z33.union([z33.boolean(), z33.string()]).optional().transform((value) => value === true || value === "true" || value === "1")
|
|
3480
3368
|
});
|
|
3481
|
-
var optimizationSummarySchema =
|
|
3482
|
-
id:
|
|
3483
|
-
name:
|
|
3369
|
+
var optimizationSummarySchema = z33.object({
|
|
3370
|
+
id: z33.string(),
|
|
3371
|
+
name: z33.string(),
|
|
3484
3372
|
status: optimizationStatusSchema,
|
|
3485
|
-
mode:
|
|
3373
|
+
mode: z33.enum(["MANUAL", "AUTO"]),
|
|
3486
3374
|
/** Autonomous launches every proposed round; interactive waits for one. */
|
|
3487
|
-
autonomous:
|
|
3488
|
-
stopReason:
|
|
3375
|
+
autonomous: z33.boolean(),
|
|
3376
|
+
stopReason: z33.string().nullable(),
|
|
3489
3377
|
subjectKind: climbSubjectKindSchema,
|
|
3490
|
-
subjectId:
|
|
3491
|
-
subjectName:
|
|
3378
|
+
subjectId: z33.string(),
|
|
3379
|
+
subjectName: z33.string(),
|
|
3492
3380
|
lever: leverKindSchema.nullable(),
|
|
3493
|
-
round:
|
|
3494
|
-
maxRounds:
|
|
3381
|
+
round: z33.number().int(),
|
|
3382
|
+
maxRounds: z33.number().int(),
|
|
3495
3383
|
/** Starting baseline score, 0..1. */
|
|
3496
|
-
before:
|
|
3384
|
+
before: z33.number().nullable(),
|
|
3497
3385
|
/** Score of the marked winner, or best BETTER trial, 0..1. */
|
|
3498
|
-
after:
|
|
3386
|
+
after: z33.number().nullable(),
|
|
3499
3387
|
/** Percentage-point change from the baseline to the winner or best BETTER trial. */
|
|
3500
|
-
delta:
|
|
3388
|
+
delta: z33.number().nullable(),
|
|
3501
3389
|
/** Score after each round, baseline first. */
|
|
3502
|
-
path:
|
|
3503
|
-
creditsSpent:
|
|
3504
|
-
creditsReserved:
|
|
3505
|
-
summary:
|
|
3506
|
-
href:
|
|
3507
|
-
createdAt:
|
|
3508
|
-
updatedAt:
|
|
3509
|
-
});
|
|
3510
|
-
var listOptimizationsResponseSchema =
|
|
3511
|
-
items:
|
|
3512
|
-
});
|
|
3513
|
-
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({
|
|
3514
3402
|
agent: schedulableAgentSchema.optional(),
|
|
3515
3403
|
/** Empty or omitted means the agent's default model. */
|
|
3516
|
-
model:
|
|
3404
|
+
model: z33.string().optional()
|
|
3517
3405
|
});
|
|
3518
3406
|
var planShape = {
|
|
3519
3407
|
effort: optimizationEffortSchema.optional(),
|
|
3520
|
-
sampleCount:
|
|
3521
|
-
maxRounds:
|
|
3522
|
-
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()
|
|
3523
3411
|
};
|
|
3524
3412
|
function refinePlan(value, ctx) {
|
|
3525
3413
|
if (value.effort && (value.sampleCount || value.maxRounds))
|
|
@@ -3535,18 +3423,18 @@ function refinePlan(value, ctx) {
|
|
|
3535
3423
|
message: "Pin an agent with the model"
|
|
3536
3424
|
});
|
|
3537
3425
|
}
|
|
3538
|
-
var startOptimizationBodySchema =
|
|
3426
|
+
var startOptimizationBodySchema = z33.object({
|
|
3539
3427
|
subjectKind: climbSubjectKindSchema,
|
|
3540
|
-
subjectId:
|
|
3541
|
-
name:
|
|
3428
|
+
subjectId: z33.string().min(1),
|
|
3429
|
+
name: z33.string().trim().min(1).max(200).optional(),
|
|
3542
3430
|
...planShape,
|
|
3543
|
-
creditCap:
|
|
3544
|
-
targetScore:
|
|
3431
|
+
creditCap: z33.number().int().nonnegative().optional(),
|
|
3432
|
+
targetScore: z33.number().min(0).max(1).optional(),
|
|
3545
3433
|
target: targetSchema.extend({ agent: schedulableAgentSchema })
|
|
3546
3434
|
}).strict().superRefine(refinePlan);
|
|
3547
|
-
var estimateOptimizationBodySchema =
|
|
3435
|
+
var estimateOptimizationBodySchema = z33.object({
|
|
3548
3436
|
subjectKind: climbSubjectKindSchema,
|
|
3549
|
-
subjectId:
|
|
3437
|
+
subjectId: z33.string().min(1),
|
|
3550
3438
|
...planShape,
|
|
3551
3439
|
target: targetSchema.optional()
|
|
3552
3440
|
}).strict().superRefine(refinePlan);
|
|
@@ -3558,105 +3446,105 @@ var RUN_CREDIT_BASES = [
|
|
|
3558
3446
|
"byok",
|
|
3559
3447
|
"reserve"
|
|
3560
3448
|
];
|
|
3561
|
-
var runCreditBasisSchema =
|
|
3562
|
-
var optimizationEstimateSchema =
|
|
3563
|
-
sampleCount:
|
|
3564
|
-
maxRounds:
|
|
3565
|
-
runsPerTrial:
|
|
3566
|
-
executionCredits:
|
|
3567
|
-
judgeCredits:
|
|
3568
|
-
leverPassCredits:
|
|
3569
|
-
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(),
|
|
3570
3458
|
/** Estimate, not a reservation or enforced spending cap. */
|
|
3571
|
-
estimate:
|
|
3459
|
+
estimate: z33.number().int(),
|
|
3572
3460
|
/** True when no price or history covered a model: a bound, not a forecast. */
|
|
3573
|
-
approximate:
|
|
3461
|
+
approximate: z33.boolean().default(false),
|
|
3574
3462
|
/** Which rung priced the run, so the UI can say why a figure is what it is. */
|
|
3575
3463
|
basis: runCreditBasisSchema.optional()
|
|
3576
3464
|
});
|
|
3577
|
-
var diagnoseBodySchema =
|
|
3465
|
+
var diagnoseBodySchema = z33.object({
|
|
3578
3466
|
subjectKind: climbSubjectKindSchema,
|
|
3579
|
-
subjectId:
|
|
3467
|
+
subjectId: z33.string().min(1)
|
|
3580
3468
|
}).strict();
|
|
3581
|
-
var diagnosisSchema =
|
|
3582
|
-
id:
|
|
3583
|
-
status:
|
|
3469
|
+
var diagnosisSchema = z33.object({
|
|
3470
|
+
id: z33.string(),
|
|
3471
|
+
status: z33.enum(["GENERATING", "READY", "FAILED"]),
|
|
3584
3472
|
subjectKind: climbSubjectKindSchema,
|
|
3585
|
-
subjectId:
|
|
3586
|
-
runCount:
|
|
3587
|
-
summary:
|
|
3473
|
+
subjectId: z33.string(),
|
|
3474
|
+
runCount: z33.number().int(),
|
|
3475
|
+
summary: z33.string().nullable(),
|
|
3588
3476
|
recommendedLever: leverKindSchema.nullable(),
|
|
3589
|
-
recommendedTarget:
|
|
3590
|
-
clusters:
|
|
3591
|
-
|
|
3592
|
-
title:
|
|
3593
|
-
failureMode:
|
|
3594
|
-
criterionIds:
|
|
3595
|
-
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()),
|
|
3596
3484
|
lever: leverKindSchema.nullable(),
|
|
3597
|
-
targetRef:
|
|
3598
|
-
confidence:
|
|
3485
|
+
targetRef: z33.unknown().nullable(),
|
|
3486
|
+
confidence: z33.number()
|
|
3599
3487
|
})
|
|
3600
3488
|
),
|
|
3601
|
-
unsupportedLevers:
|
|
3602
|
-
createdAt:
|
|
3603
|
-
});
|
|
3604
|
-
var trialRunSchema =
|
|
3605
|
-
id:
|
|
3606
|
-
status:
|
|
3607
|
-
failureReason:
|
|
3608
|
-
exitReason:
|
|
3609
|
-
cliCoverage:
|
|
3610
|
-
passed:
|
|
3611
|
-
criteria:
|
|
3612
|
-
|
|
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() })
|
|
3613
3501
|
),
|
|
3614
|
-
levers:
|
|
3615
|
-
|
|
3616
|
-
lever:
|
|
3617
|
-
attributed:
|
|
3618
|
-
note:
|
|
3502
|
+
levers: z33.array(
|
|
3503
|
+
z33.object({
|
|
3504
|
+
lever: z33.string(),
|
|
3505
|
+
attributed: z33.boolean(),
|
|
3506
|
+
note: z33.string().nullable()
|
|
3619
3507
|
})
|
|
3620
3508
|
)
|
|
3621
3509
|
});
|
|
3622
|
-
var trialSchema =
|
|
3623
|
-
id:
|
|
3624
|
-
climbId:
|
|
3625
|
-
roundNumber:
|
|
3626
|
-
key:
|
|
3510
|
+
var trialSchema = z33.object({
|
|
3511
|
+
id: z33.string(),
|
|
3512
|
+
climbId: z33.string(),
|
|
3513
|
+
roundNumber: z33.number().int(),
|
|
3514
|
+
key: z33.string(),
|
|
3627
3515
|
/** @deprecated All trials branch from the baseline. */
|
|
3628
|
-
parentTrialId:
|
|
3516
|
+
parentTrialId: z33.string().nullable(),
|
|
3629
3517
|
/** @deprecated Always the baseline key for non-baseline trials. */
|
|
3630
|
-
parentKey:
|
|
3631
|
-
title:
|
|
3632
|
-
hypothesis:
|
|
3518
|
+
parentKey: z33.string().nullable(),
|
|
3519
|
+
title: z33.string(),
|
|
3520
|
+
hypothesis: z33.string().nullable(),
|
|
3633
3521
|
lever: leverKindSchema.nullable(),
|
|
3634
3522
|
kind: interventionKindSchema,
|
|
3635
|
-
status:
|
|
3636
|
-
verdict:
|
|
3637
|
-
score:
|
|
3638
|
-
baselineScore:
|
|
3523
|
+
status: z33.enum(TRIAL_STATUSES),
|
|
3524
|
+
verdict: z33.enum(TRIAL_VERDICTS).nullable(),
|
|
3525
|
+
score: z33.number().nullable(),
|
|
3526
|
+
baselineScore: z33.number().nullable(),
|
|
3639
3527
|
/** Judged sessions behind `score`. */
|
|
3640
|
-
sessions:
|
|
3528
|
+
sessions: z33.number().int(),
|
|
3641
3529
|
/** Sessions that FAILED or TIMED_OUT; `score` leaves them out. */
|
|
3642
|
-
failedSessions:
|
|
3643
|
-
isBaseline:
|
|
3530
|
+
failedSessions: z33.number().int(),
|
|
3531
|
+
isBaseline: z33.boolean(),
|
|
3644
3532
|
/** The user marked this trial as the winner; it does not move the baseline. */
|
|
3645
|
-
adopted:
|
|
3646
|
-
adoptedAt:
|
|
3647
|
-
outcome:
|
|
3533
|
+
adopted: z33.boolean(),
|
|
3534
|
+
adoptedAt: z33.string().nullable(),
|
|
3535
|
+
outcome: z33.string().nullable(),
|
|
3648
3536
|
/** The kind-specific `after` payload (skill version id, pages, package). */
|
|
3649
|
-
after:
|
|
3650
|
-
before:
|
|
3651
|
-
runs:
|
|
3652
|
-
createdAt:
|
|
3653
|
-
});
|
|
3654
|
-
var roundSchema =
|
|
3655
|
-
id:
|
|
3656
|
-
number:
|
|
3657
|
-
status:
|
|
3658
|
-
narrative:
|
|
3659
|
-
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)
|
|
3660
3548
|
});
|
|
3661
3549
|
var OPTIMIZATION_NEXT_ACTIONS = [
|
|
3662
3550
|
"START",
|
|
@@ -3667,355 +3555,355 @@ var OPTIMIZATION_NEXT_ACTIONS = [
|
|
|
3667
3555
|
"RESUME",
|
|
3668
3556
|
"NONE"
|
|
3669
3557
|
];
|
|
3670
|
-
var optimizationNextActionSchema =
|
|
3558
|
+
var optimizationNextActionSchema = z33.enum(OPTIMIZATION_NEXT_ACTIONS);
|
|
3671
3559
|
var optimizationDetailSchema = optimizationSummarySchema.extend({
|
|
3672
|
-
baselineTrialId:
|
|
3560
|
+
baselineTrialId: z33.string().nullable(),
|
|
3673
3561
|
/** The one thing a client does next. WAIT and NONE need nobody. */
|
|
3674
3562
|
nextAction: optimizationNextActionSchema,
|
|
3675
|
-
settings:
|
|
3676
|
-
sampleCount:
|
|
3677
|
-
maxRounds:
|
|
3678
|
-
maxTrialsPerRound:
|
|
3679
|
-
creditCap:
|
|
3680
|
-
targetScore:
|
|
3681
|
-
pinnedAgent:
|
|
3682
|
-
pinnedModel:
|
|
3683
|
-
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()
|
|
3684
3572
|
}),
|
|
3685
3573
|
direction: climbDirectionSchema,
|
|
3686
|
-
rounds:
|
|
3574
|
+
rounds: z33.array(roundSchema)
|
|
3687
3575
|
});
|
|
3688
|
-
var optimizationHandoffSchema =
|
|
3689
|
-
trialId:
|
|
3690
|
-
trialKey:
|
|
3691
|
-
prompt:
|
|
3576
|
+
var optimizationHandoffSchema = z33.object({
|
|
3577
|
+
trialId: z33.string(),
|
|
3578
|
+
trialKey: z33.string(),
|
|
3579
|
+
prompt: z33.string()
|
|
3692
3580
|
});
|
|
3693
|
-
var listTrialsResponseSchema =
|
|
3694
|
-
items:
|
|
3581
|
+
var listTrialsResponseSchema = z33.object({
|
|
3582
|
+
items: z33.array(trialSchema)
|
|
3695
3583
|
});
|
|
3696
|
-
var trialDocumentSchema =
|
|
3697
|
-
path:
|
|
3698
|
-
before:
|
|
3699
|
-
after:
|
|
3584
|
+
var trialDocumentSchema = z33.object({
|
|
3585
|
+
path: z33.string(),
|
|
3586
|
+
before: z33.string(),
|
|
3587
|
+
after: z33.string()
|
|
3700
3588
|
});
|
|
3701
|
-
var trialContentSchema =
|
|
3702
|
-
trialId:
|
|
3589
|
+
var trialContentSchema = z33.object({
|
|
3590
|
+
trialId: z33.string(),
|
|
3703
3591
|
kind: interventionKindSchema,
|
|
3704
|
-
documents:
|
|
3592
|
+
documents: z33.array(trialDocumentSchema),
|
|
3705
3593
|
/** Full page bodies for a docs rewrite, ready to paste; null otherwise. */
|
|
3706
|
-
copyableBody:
|
|
3707
|
-
configSnapshot:
|
|
3594
|
+
copyableBody: z33.string().nullable(),
|
|
3595
|
+
configSnapshot: z33.unknown()
|
|
3708
3596
|
});
|
|
3709
|
-
var createTrialBodySchema =
|
|
3597
|
+
var createTrialBodySchema = z33.object({
|
|
3710
3598
|
trial: trialInputSchema,
|
|
3711
3599
|
files: overrideFilesSchema.optional(),
|
|
3712
|
-
fork:
|
|
3713
|
-
launch:
|
|
3600
|
+
fork: z33.object({ runId: z33.string().min(1), boundarySeq: z33.string().min(1) }).strict().optional(),
|
|
3601
|
+
launch: z33.boolean().default(false),
|
|
3714
3602
|
/** Replays return the trial the first call created instead of a second
|
|
3715
3603
|
* one. Scoped to the optimization. */
|
|
3716
|
-
idempotencyKey:
|
|
3604
|
+
idempotencyKey: z33.string().min(1).max(200).optional()
|
|
3717
3605
|
}).strict();
|
|
3718
|
-
var skillFilesResponseSchema =
|
|
3719
|
-
versionId:
|
|
3606
|
+
var skillFilesResponseSchema = z33.object({
|
|
3607
|
+
versionId: z33.string(),
|
|
3720
3608
|
files: overrideFilesSchema
|
|
3721
3609
|
});
|
|
3722
|
-
var pageBodyResponseSchema =
|
|
3723
|
-
url:
|
|
3724
|
-
body:
|
|
3725
|
-
contentType:
|
|
3610
|
+
var pageBodyResponseSchema = z33.object({
|
|
3611
|
+
url: z33.string(),
|
|
3612
|
+
body: z33.string(),
|
|
3613
|
+
contentType: z33.string().optional()
|
|
3726
3614
|
});
|
|
3727
|
-
var launchTrialResponseSchema =
|
|
3728
|
-
trialId:
|
|
3729
|
-
batchIds:
|
|
3730
|
-
runIds:
|
|
3615
|
+
var launchTrialResponseSchema = z33.object({
|
|
3616
|
+
trialId: z33.string(),
|
|
3617
|
+
batchIds: z33.array(z33.string()),
|
|
3618
|
+
runIds: z33.array(z33.string())
|
|
3731
3619
|
});
|
|
3732
|
-
var createDraftOptimizationBodySchema =
|
|
3620
|
+
var createDraftOptimizationBodySchema = z33.object({
|
|
3733
3621
|
subjectKind: climbSubjectKindSchema,
|
|
3734
|
-
subjectId:
|
|
3735
|
-
name:
|
|
3622
|
+
subjectId: z33.string().min(1),
|
|
3623
|
+
name: z33.string().trim().min(1).max(200).optional(),
|
|
3736
3624
|
...planShape,
|
|
3737
3625
|
target: targetSchema.optional(),
|
|
3738
|
-
autonomous:
|
|
3626
|
+
autonomous: z33.boolean().optional()
|
|
3739
3627
|
}).strict().superRefine(refinePlan);
|
|
3740
3628
|
var planPatchShape = {
|
|
3741
|
-
name:
|
|
3629
|
+
name: z33.string().trim().min(1).max(200).optional(),
|
|
3742
3630
|
...planShape,
|
|
3743
3631
|
target: targetSchema.optional()
|
|
3744
3632
|
};
|
|
3745
|
-
var optimizationPlanPatchSchema =
|
|
3746
|
-
var startDraftOptimizationBodySchema =
|
|
3633
|
+
var optimizationPlanPatchSchema = z33.object(planPatchShape).strict().superRefine(refinePlan);
|
|
3634
|
+
var startDraftOptimizationBodySchema = z33.object({
|
|
3747
3635
|
...planPatchShape,
|
|
3748
|
-
creditCap:
|
|
3636
|
+
creditCap: z33.number().int().nonnegative().optional()
|
|
3749
3637
|
}).strict().superRefine(refinePlan);
|
|
3750
|
-
var setModeBodySchema =
|
|
3751
|
-
var launchRoundResponseSchema =
|
|
3752
|
-
roundNumber:
|
|
3753
|
-
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()),
|
|
3754
3642
|
/** True when nothing was left to launch: someone else got there first. */
|
|
3755
|
-
alreadyLaunched:
|
|
3643
|
+
alreadyLaunched: z33.boolean()
|
|
3756
3644
|
});
|
|
3757
|
-
var resolveChatResponseSchema =
|
|
3758
|
-
chatId:
|
|
3759
|
-
href:
|
|
3645
|
+
var resolveChatResponseSchema = z33.object({
|
|
3646
|
+
chatId: z33.string(),
|
|
3647
|
+
href: z33.string()
|
|
3760
3648
|
});
|
|
3761
|
-
var continueOptimizationBodySchema =
|
|
3762
|
-
rounds:
|
|
3763
|
-
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()
|
|
3764
3652
|
}).strict();
|
|
3765
|
-
var patchOptimizationBodySchema =
|
|
3653
|
+
var patchOptimizationBodySchema = z33.object({
|
|
3766
3654
|
...planPatchShape,
|
|
3767
3655
|
direction: climbDirectionPatchSchema.optional(),
|
|
3768
|
-
autonomous:
|
|
3656
|
+
autonomous: z33.boolean().optional()
|
|
3769
3657
|
}).strict().superRefine(refinePlan);
|
|
3770
3658
|
|
|
3771
3659
|
// ../packages/api-schemas/src/orgs.ts
|
|
3772
|
-
import { z as
|
|
3773
|
-
var createOrgRequestSchema =
|
|
3660
|
+
import { z as z34 } from "zod";
|
|
3661
|
+
var createOrgRequestSchema = z34.object({
|
|
3774
3662
|
/** Workspace display name; the slug is derived server-side. */
|
|
3775
|
-
name:
|
|
3663
|
+
name: z34.string().trim().min(1).max(200),
|
|
3776
3664
|
/** Optional company site (logo source; stamped onto the org). */
|
|
3777
|
-
website:
|
|
3665
|
+
website: z34.string().trim().max(300).optional()
|
|
3778
3666
|
});
|
|
3779
|
-
var createOrgResponseSchema =
|
|
3780
|
-
slug:
|
|
3781
|
-
name:
|
|
3667
|
+
var createOrgResponseSchema = z34.object({
|
|
3668
|
+
slug: z34.string(),
|
|
3669
|
+
name: z34.string(),
|
|
3782
3670
|
// LOCAL orgs never have a Gauge publicId.
|
|
3783
|
-
publicId:
|
|
3671
|
+
publicId: z34.string().nullable()
|
|
3784
3672
|
});
|
|
3785
|
-
var orgSettingsSchema =
|
|
3786
|
-
slug:
|
|
3787
|
-
name:
|
|
3788
|
-
publicId:
|
|
3789
|
-
website:
|
|
3673
|
+
var orgSettingsSchema = z34.object({
|
|
3674
|
+
slug: z34.string(),
|
|
3675
|
+
name: z34.string(),
|
|
3676
|
+
publicId: z34.string().nullable(),
|
|
3677
|
+
website: z34.string().nullable(),
|
|
3790
3678
|
/** Per-run max-spend override in USD; null = the server default. */
|
|
3791
|
-
maxSpendUsd:
|
|
3792
|
-
overageEnabled:
|
|
3679
|
+
maxSpendUsd: z34.number().nullable(),
|
|
3680
|
+
overageEnabled: z34.boolean(),
|
|
3793
3681
|
/** Per-cycle overage cap in credits; null = uncapped. */
|
|
3794
|
-
overageCapCredits:
|
|
3682
|
+
overageCapCredits: z34.number().int().nullable(),
|
|
3795
3683
|
/** Domain claimed for same-domain auto-join; null = off. */
|
|
3796
|
-
autoJoinDomain:
|
|
3684
|
+
autoJoinDomain: z34.string().nullable()
|
|
3797
3685
|
});
|
|
3798
|
-
var orgMemberSchema =
|
|
3799
|
-
userId:
|
|
3800
|
-
name:
|
|
3801
|
-
email:
|
|
3802
|
-
joinedAt:
|
|
3686
|
+
var orgMemberSchema = z34.object({
|
|
3687
|
+
userId: z34.string(),
|
|
3688
|
+
name: z34.string().nullable(),
|
|
3689
|
+
email: z34.string().nullable(),
|
|
3690
|
+
joinedAt: z34.string()
|
|
3803
3691
|
});
|
|
3804
|
-
var listMembersResponseSchema =
|
|
3805
|
-
items:
|
|
3692
|
+
var listMembersResponseSchema = z34.object({
|
|
3693
|
+
items: z34.array(orgMemberSchema)
|
|
3806
3694
|
});
|
|
3807
3695
|
|
|
3808
3696
|
// ../packages/api-schemas/src/personas.ts
|
|
3809
|
-
import { z as
|
|
3810
|
-
var personaSchema =
|
|
3811
|
-
id:
|
|
3812
|
-
name:
|
|
3813
|
-
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(),
|
|
3814
3702
|
/** The judge model this persona calls (Claude only). */
|
|
3815
|
-
model:
|
|
3816
|
-
createdAt:
|
|
3817
|
-
updatedAt:
|
|
3703
|
+
model: z35.string(),
|
|
3704
|
+
createdAt: z35.string(),
|
|
3705
|
+
updatedAt: z35.string()
|
|
3818
3706
|
});
|
|
3819
|
-
var listPersonasResponseSchema =
|
|
3820
|
-
items:
|
|
3707
|
+
var listPersonasResponseSchema = z35.object({
|
|
3708
|
+
items: z35.array(personaSchema)
|
|
3821
3709
|
});
|
|
3822
|
-
var createPersonaBodySchema =
|
|
3823
|
-
name:
|
|
3824
|
-
description:
|
|
3710
|
+
var createPersonaBodySchema = z35.object({
|
|
3711
|
+
name: z35.string().min(1).max(120),
|
|
3712
|
+
description: z35.string().min(1)
|
|
3825
3713
|
});
|
|
3826
|
-
var updatePersonaBodySchema =
|
|
3827
|
-
name:
|
|
3828
|
-
description:
|
|
3714
|
+
var updatePersonaBodySchema = z35.object({
|
|
3715
|
+
name: z35.string().min(1).max(120).optional(),
|
|
3716
|
+
description: z35.string().min(1).optional()
|
|
3829
3717
|
});
|
|
3830
3718
|
|
|
3831
3719
|
// ../packages/api-schemas/src/prompts.ts
|
|
3832
|
-
import { z as
|
|
3720
|
+
import { z as z38 } from "zod";
|
|
3833
3721
|
|
|
3834
3722
|
// ../packages/api-schemas/src/tags.ts
|
|
3835
|
-
import { z as
|
|
3836
|
-
var tagSchema =
|
|
3837
|
-
id:
|
|
3838
|
-
name:
|
|
3723
|
+
import { z as z36 } from "zod";
|
|
3724
|
+
var tagSchema = z36.object({
|
|
3725
|
+
id: z36.string(),
|
|
3726
|
+
name: z36.string(),
|
|
3839
3727
|
/** A Mantine palette name (e.g. "blue", "grape"); unknown values are
|
|
3840
3728
|
* normalized server-side to the default ("gray"). */
|
|
3841
|
-
color:
|
|
3729
|
+
color: z36.string()
|
|
3842
3730
|
});
|
|
3843
|
-
var createTagBodySchema =
|
|
3844
|
-
name:
|
|
3845
|
-
color:
|
|
3731
|
+
var createTagBodySchema = z36.object({
|
|
3732
|
+
name: z36.string().min(1),
|
|
3733
|
+
color: z36.string().optional()
|
|
3846
3734
|
});
|
|
3847
|
-
var updateTagBodySchema =
|
|
3848
|
-
name:
|
|
3849
|
-
color:
|
|
3735
|
+
var updateTagBodySchema = z36.object({
|
|
3736
|
+
name: z36.string().min(1).optional(),
|
|
3737
|
+
color: z36.string().optional()
|
|
3850
3738
|
});
|
|
3851
3739
|
var tagListResponseSchema = listResponseSchema(tagSchema);
|
|
3852
3740
|
|
|
3853
3741
|
// ../packages/api-schemas/src/topics.ts
|
|
3854
|
-
import { z as
|
|
3855
|
-
var topicSchema =
|
|
3856
|
-
id:
|
|
3857
|
-
name:
|
|
3742
|
+
import { z as z37 } from "zod";
|
|
3743
|
+
var topicSchema = z37.object({
|
|
3744
|
+
id: z37.string(),
|
|
3745
|
+
name: z37.string()
|
|
3858
3746
|
});
|
|
3859
|
-
var createTopicBodySchema =
|
|
3860
|
-
name:
|
|
3747
|
+
var createTopicBodySchema = z37.object({
|
|
3748
|
+
name: z37.string().min(1, "name is required")
|
|
3861
3749
|
});
|
|
3862
3750
|
var topicListResponseSchema = listResponseSchema(topicSchema);
|
|
3863
3751
|
|
|
3864
3752
|
// ../packages/api-schemas/src/prompts.ts
|
|
3865
|
-
var promptSummarySchema =
|
|
3866
|
-
id:
|
|
3867
|
-
text:
|
|
3868
|
-
isBranded:
|
|
3753
|
+
var promptSummarySchema = z38.object({
|
|
3754
|
+
id: z38.string(),
|
|
3755
|
+
text: z38.string(),
|
|
3756
|
+
isBranded: z38.boolean(),
|
|
3869
3757
|
/** Battery-spec identity (idempotent applies); null for UI/CLI-created prompts. */
|
|
3870
|
-
externalKey:
|
|
3758
|
+
externalKey: z38.string().nullable(),
|
|
3871
3759
|
topic: topicSchema.nullable(),
|
|
3872
|
-
tags:
|
|
3873
|
-
createdAt:
|
|
3760
|
+
tags: z38.array(tagSchema),
|
|
3761
|
+
createdAt: z38.string()
|
|
3874
3762
|
});
|
|
3875
3763
|
var promptListResponseSchema = listResponseSchema(promptSummarySchema);
|
|
3876
3764
|
var listPromptsQuerySchema = listQuerySchema.extend({
|
|
3877
|
-
topic:
|
|
3878
|
-
tag:
|
|
3879
|
-
q:
|
|
3880
|
-
});
|
|
3881
|
-
var createPromptBodySchema =
|
|
3882
|
-
text:
|
|
3883
|
-
isBranded:
|
|
3884
|
-
topic:
|
|
3885
|
-
tags:
|
|
3886
|
-
});
|
|
3887
|
-
var updatePromptBodySchema =
|
|
3888
|
-
text:
|
|
3889
|
-
isBranded:
|
|
3890
|
-
topicId:
|
|
3891
|
-
tags:
|
|
3892
|
-
});
|
|
3893
|
-
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({
|
|
3894
3782
|
/** Preferred paired representation; each agent may pin its own model tiers. */
|
|
3895
|
-
agentConfigs:
|
|
3783
|
+
agentConfigs: z38.array(agentConfigInputSchema).min(1).optional(),
|
|
3896
3784
|
/** Legacy agent set (no per-agent pins), kept during the API transition. */
|
|
3897
|
-
agents:
|
|
3898
|
-
repoUrl:
|
|
3899
|
-
repoRef:
|
|
3900
|
-
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),
|
|
3901
3789
|
webFixture: webFixtureSchema.optional()
|
|
3902
3790
|
});
|
|
3903
|
-
var runPromptResponseSchema =
|
|
3904
|
-
batchIds:
|
|
3905
|
-
runIds:
|
|
3906
|
-
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()
|
|
3907
3795
|
});
|
|
3908
3796
|
|
|
3909
3797
|
// ../packages/api-schemas/src/repos.ts
|
|
3910
|
-
import { z as
|
|
3798
|
+
import { z as z39 } from "zod";
|
|
3911
3799
|
var REPO_SIZE_BUCKETS = [
|
|
3912
3800
|
"small",
|
|
3913
3801
|
"medium",
|
|
3914
3802
|
"large",
|
|
3915
3803
|
"xlarge"
|
|
3916
3804
|
];
|
|
3917
|
-
var repoSizeBucketSchema =
|
|
3918
|
-
var repoSchema =
|
|
3919
|
-
url:
|
|
3920
|
-
name:
|
|
3921
|
-
isSystem:
|
|
3922
|
-
languages:
|
|
3923
|
-
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()),
|
|
3924
3812
|
/** Faceted labels (complexity:L2, buildable:yes, stack:nextjs, …). */
|
|
3925
|
-
tags:
|
|
3926
|
-
primaryLanguage:
|
|
3927
|
-
sizeKb:
|
|
3813
|
+
tags: z39.array(z39.string()),
|
|
3814
|
+
primaryLanguage: z39.string(),
|
|
3815
|
+
sizeKb: z39.number(),
|
|
3928
3816
|
sizeBucket: repoSizeBucketSchema.nullable(),
|
|
3929
|
-
stars:
|
|
3817
|
+
stars: z39.number()
|
|
3930
3818
|
});
|
|
3931
3819
|
var repoListResponseSchema = listResponseSchema(repoSchema);
|
|
3932
|
-
var addRepoBodySchema =
|
|
3933
|
-
url:
|
|
3820
|
+
var addRepoBodySchema = z39.object({
|
|
3821
|
+
url: z39.string().min(1, "url is required"),
|
|
3934
3822
|
/**
|
|
3935
3823
|
* Reserved (accepted, not yet persisted): the catalog keys repos by URL only
|
|
3936
3824
|
* — `fact_repo` has no ref column and metadata sync always reads the default
|
|
3937
3825
|
* branch. Kept in the wire format so `gauge repos add --ref` is stable once
|
|
3938
3826
|
* the catalog learns refs.
|
|
3939
3827
|
*/
|
|
3940
|
-
ref:
|
|
3828
|
+
ref: z39.string().min(1).optional(),
|
|
3941
3829
|
/** Display name; defaults to the `owner/repo` label of the URL. */
|
|
3942
|
-
name:
|
|
3830
|
+
name: z39.string().min(1).optional(),
|
|
3943
3831
|
/** Manual override; defaults to frameworks detected from the repo's manifests. */
|
|
3944
|
-
frameworks:
|
|
3945
|
-
tags:
|
|
3832
|
+
frameworks: z39.array(z39.string()).optional(),
|
|
3833
|
+
tags: z39.array(z39.string()).optional()
|
|
3946
3834
|
});
|
|
3947
|
-
var updateRepoBodySchema =
|
|
3948
|
-
url:
|
|
3949
|
-
name:
|
|
3950
|
-
frameworks:
|
|
3951
|
-
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()
|
|
3952
3840
|
});
|
|
3953
|
-
var resyncRepoBodySchema =
|
|
3954
|
-
url:
|
|
3841
|
+
var resyncRepoBodySchema = z39.object({
|
|
3842
|
+
url: z39.string().min(1, "url is required")
|
|
3955
3843
|
});
|
|
3956
|
-
var deleteRepoQuerySchema =
|
|
3957
|
-
url:
|
|
3844
|
+
var deleteRepoQuerySchema = z39.object({
|
|
3845
|
+
url: z39.string().min(1, "url is required")
|
|
3958
3846
|
});
|
|
3959
|
-
var repoSyncResultSchema =
|
|
3847
|
+
var repoSyncResultSchema = z39.object({
|
|
3960
3848
|
repo: repoSchema,
|
|
3961
|
-
synced:
|
|
3849
|
+
synced: z39.boolean()
|
|
3962
3850
|
});
|
|
3963
3851
|
|
|
3964
3852
|
// ../packages/api-schemas/src/runAddons.ts
|
|
3965
|
-
import { z as
|
|
3966
|
-
var runAddonsSchema =
|
|
3967
|
-
browser:
|
|
3968
|
-
session:
|
|
3969
|
-
projectId:
|
|
3970
|
-
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")
|
|
3971
3859
|
}).strict().optional()
|
|
3972
3860
|
}).strict();
|
|
3973
3861
|
|
|
3974
3862
|
// ../packages/api-schemas/src/runDefinitions.ts
|
|
3975
|
-
import { z as
|
|
3863
|
+
import { z as z44 } from "zod";
|
|
3976
3864
|
|
|
3977
3865
|
// ../packages/api-schemas/src/preference.ts
|
|
3978
|
-
import { z as
|
|
3979
|
-
var preferenceDefinitionSchema =
|
|
3980
|
-
|
|
3981
|
-
kind:
|
|
3982
|
-
branded:
|
|
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)
|
|
3983
3871
|
}).strict(),
|
|
3984
|
-
|
|
3985
|
-
kind:
|
|
3986
|
-
brandA:
|
|
3987
|
-
brandB:
|
|
3872
|
+
z41.object({
|
|
3873
|
+
kind: z41.literal("head-to-head"),
|
|
3874
|
+
brandA: z41.string().trim().min(1),
|
|
3875
|
+
brandB: z41.string().trim().min(1)
|
|
3988
3876
|
}).strict().refine(
|
|
3989
3877
|
(p) => p.brandA.toLowerCase() !== p.brandB.toLowerCase(),
|
|
3990
3878
|
"A head-to-head needs two different brands"
|
|
3991
3879
|
)
|
|
3992
3880
|
]);
|
|
3993
|
-
var preferenceSnapshotSchema =
|
|
3994
|
-
var headToHeadSchema =
|
|
3995
|
-
kind:
|
|
3996
|
-
winner:
|
|
3997
|
-
brandA:
|
|
3998
|
-
brandB:
|
|
3999
|
-
rationale:
|
|
4000
|
-
brandAReasoning:
|
|
4001
|
-
brandBReasoning:
|
|
4002
|
-
brandAWhyRaised:
|
|
4003
|
-
brandBWhyRaised:
|
|
4004
|
-
});
|
|
4005
|
-
var recommendPickSchema =
|
|
4006
|
-
brand:
|
|
4007
|
-
rank:
|
|
4008
|
-
adopted:
|
|
4009
|
-
reasoning:
|
|
4010
|
-
whyRaised:
|
|
4011
|
-
});
|
|
4012
|
-
var recommendSchema =
|
|
4013
|
-
kind:
|
|
4014
|
-
picks:
|
|
4015
|
-
singlePick:
|
|
4016
|
-
complianceNote:
|
|
4017
|
-
});
|
|
4018
|
-
var visibilityVerdictSchema =
|
|
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", [
|
|
4019
3907
|
headToHeadSchema,
|
|
4020
3908
|
recommendSchema
|
|
4021
3909
|
]);
|
|
@@ -4028,59 +3916,59 @@ function preferenceSelectionLabel(verdict) {
|
|
|
4028
3916
|
}
|
|
4029
3917
|
|
|
4030
3918
|
// ../packages/api-schemas/src/runDefinitionInputs.ts
|
|
4031
|
-
import { z as
|
|
3919
|
+
import { z as z43 } from "zod";
|
|
4032
3920
|
|
|
4033
3921
|
// ../packages/api-schemas/src/runPlan.ts
|
|
4034
|
-
import { z as
|
|
4035
|
-
var runPlanCriterionSchema =
|
|
4036
|
-
id:
|
|
4037
|
-
name:
|
|
4038
|
-
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()
|
|
4039
3927
|
});
|
|
4040
|
-
var criteriaSnapshotV1Schema =
|
|
4041
|
-
version:
|
|
3928
|
+
var criteriaSnapshotV1Schema = z42.object({
|
|
3929
|
+
version: z42.literal(1),
|
|
4042
3930
|
// File-authored criteria have no saved EvalSet; their identity is frozen
|
|
4043
3931
|
// in the request and result rows retain the criterion text without an FK.
|
|
4044
|
-
evalSetId:
|
|
4045
|
-
criteria:
|
|
4046
|
-
});
|
|
4047
|
-
var runPlanCaseSchema =
|
|
4048
|
-
id:
|
|
4049
|
-
prompt:
|
|
4050
|
-
workspace:
|
|
4051
|
-
repoUrl:
|
|
4052
|
-
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()
|
|
4053
3941
|
}),
|
|
4054
|
-
agents:
|
|
3942
|
+
agents: z42.array(
|
|
4055
3943
|
agentConfigSchema.extend({
|
|
4056
3944
|
// Validated against the current catalog request schema when lowered.
|
|
4057
|
-
catalogSelections:
|
|
3945
|
+
catalogSelections: z42.record(z42.string(), z42.unknown()).optional()
|
|
4058
3946
|
})
|
|
4059
3947
|
),
|
|
4060
|
-
samples:
|
|
4061
|
-
evalSetId:
|
|
3948
|
+
samples: z42.number().int().min(1).max(50),
|
|
3949
|
+
evalSetId: z42.string().min(1).optional(),
|
|
4062
3950
|
criteriaSnapshot: criteriaSnapshotV1Schema.optional(),
|
|
4063
3951
|
preferenceSnapshot: preferenceSnapshotSchema.optional(),
|
|
4064
|
-
sourceRepoCommit:
|
|
4065
|
-
experiment:
|
|
4066
|
-
membershipTagIds:
|
|
4067
|
-
profile:
|
|
4068
|
-
id:
|
|
4069
|
-
name:
|
|
4070
|
-
description:
|
|
4071
|
-
model:
|
|
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()
|
|
4072
3960
|
}).nullable().optional(),
|
|
4073
3961
|
skillSet: skillSetSchema.optional(),
|
|
4074
3962
|
mcpSet: mcpSetSchema.optional(),
|
|
4075
3963
|
connectionSet: connectionSetSchema.optional(),
|
|
4076
3964
|
// The server's agentContextSnapshotV1Schema validates this at lowering.
|
|
4077
|
-
agentContext:
|
|
4078
|
-
agentContextDigest:
|
|
3965
|
+
agentContext: z42.unknown().optional(),
|
|
3966
|
+
agentContextDigest: z42.string().nullable().optional(),
|
|
4079
3967
|
addons: runAddonsSchema.optional(),
|
|
4080
3968
|
/** Names of resources the coordinator must prepare before expansion. */
|
|
4081
|
-
inputs:
|
|
3969
|
+
inputs: z42.array(z42.string().min(1)).default([])
|
|
4082
3970
|
});
|
|
4083
|
-
var inputPathSchema =
|
|
3971
|
+
var inputPathSchema = z42.string().min(1).max(256).regex(
|
|
4084
3972
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: Reject unsafe control characters in authored paths.
|
|
4085
3973
|
/^(?![!/])(?!.*[\\\x00-\x1f\x7f])(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*\/\/)(?!.*\/$).+$/,
|
|
4086
3974
|
"Expected a repository-relative path or glob without traversal"
|
|
@@ -4115,20 +4003,20 @@ var reservedBinaryCommands = [
|
|
|
4115
4003
|
"pi",
|
|
4116
4004
|
"wizard"
|
|
4117
4005
|
];
|
|
4118
|
-
var binaryCommandSchema =
|
|
4006
|
+
var binaryCommandSchema = z42.string().max(128).regex(
|
|
4119
4007
|
/^[A-Za-z0-9_][A-Za-z0-9_.+-]*$/,
|
|
4120
4008
|
"Expected a command name without paths or shell syntax"
|
|
4121
4009
|
).refine(
|
|
4122
4010
|
(name) => !reservedBinaryCommands.includes(name),
|
|
4123
4011
|
"Command is reserved for Gauge workspace setup or the agent harness; choose another command name"
|
|
4124
4012
|
);
|
|
4125
|
-
var binaryUseSchema =
|
|
4126
|
-
type:
|
|
4127
|
-
paths:
|
|
4128
|
-
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(
|
|
4129
4017
|
"Linux x86-64 ELF executables compatible with the consumer sandbox. No system packages are installed."
|
|
4130
4018
|
),
|
|
4131
|
-
commands:
|
|
4019
|
+
commands: z42.record(
|
|
4132
4020
|
binaryCommandSchema,
|
|
4133
4021
|
inputPathSchema.regex(
|
|
4134
4022
|
/^[^*?{}[\]]+$/,
|
|
@@ -4139,62 +4027,62 @@ var binaryUseSchema = z41.object({
|
|
|
4139
4027
|
"Declare between 1 and 32 commands"
|
|
4140
4028
|
).meta({ minProperties: 1, maxProperties: 32 })
|
|
4141
4029
|
}).strict();
|
|
4142
|
-
var inputUseSchema =
|
|
4030
|
+
var inputUseSchema = z42.discriminatedUnion("type", [
|
|
4143
4031
|
binaryUseSchema,
|
|
4144
4032
|
websiteUseSchema,
|
|
4145
|
-
|
|
4146
|
-
type:
|
|
4147
|
-
paths:
|
|
4033
|
+
z42.object({
|
|
4034
|
+
type: z42.literal("files"),
|
|
4035
|
+
paths: z42.array(inputPathSchema).min(1).max(32).optional()
|
|
4148
4036
|
}).strict(),
|
|
4149
|
-
|
|
4150
|
-
type:
|
|
4037
|
+
z42.object({
|
|
4038
|
+
type: z42.literal("npm-cli"),
|
|
4151
4039
|
package: inputPathSchema,
|
|
4152
|
-
install:
|
|
4040
|
+
install: z42.enum(["environment", "workspace"]).optional()
|
|
4153
4041
|
}).strict(),
|
|
4154
|
-
|
|
4155
|
-
type:
|
|
4042
|
+
z42.object({
|
|
4043
|
+
type: z42.literal("npm-package"),
|
|
4156
4044
|
package: inputPathSchema,
|
|
4157
|
-
install:
|
|
4045
|
+
install: z42.enum(["environment", "workspace"]).optional()
|
|
4158
4046
|
}).strict(),
|
|
4159
|
-
|
|
4160
|
-
type:
|
|
4161
|
-
root:
|
|
4047
|
+
z42.object({
|
|
4048
|
+
type: z42.literal("skill"),
|
|
4049
|
+
root: z42.union([z42.literal("."), inputPathSchema]).refine(
|
|
4162
4050
|
(path3) => !/[*?{}[\]]/.test(path3),
|
|
4163
4051
|
"Skill root must be an explicit directory"
|
|
4164
4052
|
)
|
|
4165
4053
|
}).strict()
|
|
4166
4054
|
]);
|
|
4167
|
-
var inputSourceSchema =
|
|
4168
|
-
|
|
4169
|
-
type:
|
|
4170
|
-
paths:
|
|
4055
|
+
var inputSourceSchema = z42.discriminatedUnion("type", [
|
|
4056
|
+
z42.object({
|
|
4057
|
+
type: z42.literal("git"),
|
|
4058
|
+
paths: z42.array(inputPathSchema).min(1).max(32)
|
|
4171
4059
|
}).strict(),
|
|
4172
|
-
|
|
4173
|
-
type:
|
|
4060
|
+
z42.object({
|
|
4061
|
+
type: z42.literal("github-actions"),
|
|
4174
4062
|
// Omit to discover the sole artifact from the selected workflow run.
|
|
4175
4063
|
// Names are supplied by CI and need not encode the PR head revision.
|
|
4176
|
-
artifact:
|
|
4064
|
+
artifact: z42.string().min(1).max(256).optional()
|
|
4177
4065
|
}).strict()
|
|
4178
4066
|
]);
|
|
4179
|
-
var runPlanResourceSchema =
|
|
4180
|
-
name:
|
|
4181
|
-
type:
|
|
4182
|
-
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", [
|
|
4183
4071
|
commentSourceSchema.extend({
|
|
4184
|
-
repoUrl:
|
|
4185
|
-
commit:
|
|
4072
|
+
repoUrl: z42.string(),
|
|
4073
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i)
|
|
4186
4074
|
}).strict(),
|
|
4187
4075
|
deploymentSourceSchema.extend({
|
|
4188
|
-
repoUrl:
|
|
4189
|
-
commit:
|
|
4076
|
+
repoUrl: z42.string(),
|
|
4077
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i)
|
|
4190
4078
|
}).strict(),
|
|
4191
4079
|
inputSourceSchema.options[0].extend({
|
|
4192
|
-
repoUrl:
|
|
4193
|
-
commit:
|
|
4080
|
+
repoUrl: z42.string(),
|
|
4081
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i)
|
|
4194
4082
|
}).strict(),
|
|
4195
4083
|
inputSourceSchema.options[1].extend({
|
|
4196
|
-
repoUrl:
|
|
4197
|
-
commit:
|
|
4084
|
+
repoUrl: z42.string(),
|
|
4085
|
+
commit: z42.string().regex(/^[a-f0-9]{40}$/i),
|
|
4198
4086
|
workflow: inputPathSchema
|
|
4199
4087
|
}).strict()
|
|
4200
4088
|
]),
|
|
@@ -4203,47 +4091,47 @@ var runPlanResourceSchema = z41.object({
|
|
|
4203
4091
|
(r) => r.use.type === "website" === (r.source.type === "github-deployment" || r.source.type === "github-pr-comment"),
|
|
4204
4092
|
"Website inputs require a deployment or PR comment source; file inputs require git or Actions"
|
|
4205
4093
|
);
|
|
4206
|
-
var runPlanSchema =
|
|
4207
|
-
version:
|
|
4094
|
+
var runPlanSchema = z42.object({
|
|
4095
|
+
version: z42.literal(1),
|
|
4208
4096
|
/** Existing launches keep their current measurement semantics. */
|
|
4209
|
-
measurementMode:
|
|
4097
|
+
measurementMode: z42.enum([
|
|
4210
4098
|
"EXISTING",
|
|
4211
4099
|
"AGENT_EXPERIENCE",
|
|
4212
4100
|
"AGENT_PREFERENCE",
|
|
4213
4101
|
"MIXED"
|
|
4214
4102
|
]),
|
|
4215
|
-
cases:
|
|
4216
|
-
resources:
|
|
4103
|
+
cases: z42.array(runPlanCaseSchema).min(1),
|
|
4104
|
+
resources: z42.array(runPlanResourceSchema).default([]),
|
|
4217
4105
|
/** Server-populated context retained across deferred preparation. */
|
|
4218
|
-
launch:
|
|
4219
|
-
origin:
|
|
4220
|
-
|
|
4221
|
-
initiator:
|
|
4222
|
-
userId:
|
|
4223
|
-
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()
|
|
4224
4112
|
}).strict(),
|
|
4225
|
-
|
|
4226
|
-
initiator:
|
|
4227
|
-
userId:
|
|
4228
|
-
email:
|
|
4113
|
+
z42.object({
|
|
4114
|
+
initiator: z42.literal("GITHUB"),
|
|
4115
|
+
userId: z42.null(),
|
|
4116
|
+
email: z42.null()
|
|
4229
4117
|
}).strict()
|
|
4230
4118
|
]),
|
|
4231
|
-
funding:
|
|
4232
|
-
queueClass:
|
|
4119
|
+
funding: z42.enum(["ORG", "PLATFORM"]),
|
|
4120
|
+
queueClass: z42.literal("INTERACTIVE")
|
|
4233
4121
|
}).strict().optional(),
|
|
4234
|
-
provenance:
|
|
4235
|
-
definition:
|
|
4236
|
-
repoUrl:
|
|
4237
|
-
commit:
|
|
4238
|
-
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),
|
|
4239
4127
|
/** File submissions are asserted by the caller until server-side
|
|
4240
4128
|
* committed-byte fetching is available. */
|
|
4241
|
-
verification:
|
|
4129
|
+
verification: z42.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED"]).optional()
|
|
4242
4130
|
}).optional(),
|
|
4243
|
-
liveDependencies:
|
|
4244
|
-
|
|
4245
|
-
name:
|
|
4246
|
-
url:
|
|
4131
|
+
liveDependencies: z42.array(
|
|
4132
|
+
z42.object({
|
|
4133
|
+
name: z42.string().min(1),
|
|
4134
|
+
url: z42.string().url().optional()
|
|
4247
4135
|
})
|
|
4248
4136
|
).default([])
|
|
4249
4137
|
})
|
|
@@ -4315,43 +4203,43 @@ var runPlanSchema = z41.object({
|
|
|
4315
4203
|
});
|
|
4316
4204
|
|
|
4317
4205
|
// ../packages/api-schemas/src/runDefinitionInputs.ts
|
|
4318
|
-
var definitionInputSourceSchema =
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
type:
|
|
4206
|
+
var definitionInputSourceSchema = z43.discriminatedUnion("type", [
|
|
4207
|
+
z43.object({ type: z43.literal("git") }).strict(),
|
|
4208
|
+
z43.object({
|
|
4209
|
+
type: z43.literal("github-actions"),
|
|
4322
4210
|
workflow: inputPathSchema.regex(/^\.github\/workflows\/[^/*?{}[\]]+\.ya?ml$/).describe(
|
|
4323
4211
|
"Workflow file in this repository, for example .github/workflows/build.yml."
|
|
4324
4212
|
),
|
|
4325
|
-
artifact:
|
|
4213
|
+
artifact: z43.string().min(1).max(256).optional().describe(
|
|
4326
4214
|
"Upload name or pattern. Omit only when the workflow produces exactly one artifact."
|
|
4327
4215
|
)
|
|
4328
4216
|
}).strict()
|
|
4329
4217
|
]);
|
|
4330
|
-
var skillInputPathSchema =
|
|
4218
|
+
var skillInputPathSchema = z43.union([z43.literal("."), inputPathSchema.regex(/^[^*?{}[\]]+$/)]).describe(
|
|
4331
4219
|
"Explicit Skill directory or ZIP/tar.gz file containing SKILL.md at its root."
|
|
4332
4220
|
);
|
|
4333
|
-
var runDefinitionInputSchema =
|
|
4221
|
+
var runDefinitionInputSchema = z43.discriminatedUnion("type", [
|
|
4334
4222
|
binaryUseSchema.extend({ source: definitionInputSourceSchema }).strict(),
|
|
4335
4223
|
websiteUseSchema.extend({ source: websiteSourceSchema }).strict(),
|
|
4336
|
-
|
|
4337
|
-
type:
|
|
4224
|
+
z43.object({
|
|
4225
|
+
type: z43.literal("npm-package"),
|
|
4338
4226
|
source: definitionInputSourceSchema,
|
|
4339
4227
|
path: inputPathSchema.describe(
|
|
4340
4228
|
"Path or glob selecting exactly one packed npm .tgz file."
|
|
4341
4229
|
),
|
|
4342
|
-
install:
|
|
4230
|
+
install: z43.enum(["environment", "workspace"]).default("environment").describe(
|
|
4343
4231
|
"environment exposes the package's commands on PATH; workspace adds a consumer application dependency."
|
|
4344
4232
|
)
|
|
4345
4233
|
}).strict(),
|
|
4346
|
-
|
|
4347
|
-
type:
|
|
4234
|
+
z43.object({
|
|
4235
|
+
type: z43.literal("skill"),
|
|
4348
4236
|
source: definitionInputSourceSchema,
|
|
4349
4237
|
path: skillInputPathSchema
|
|
4350
4238
|
}).strict(),
|
|
4351
|
-
|
|
4352
|
-
type:
|
|
4239
|
+
z43.object({
|
|
4240
|
+
type: z43.literal("files"),
|
|
4353
4241
|
source: definitionInputSourceSchema,
|
|
4354
|
-
paths:
|
|
4242
|
+
paths: z43.array(inputPathSchema).min(1).max(32).describe(
|
|
4355
4243
|
"Files or globs selected from the committed Git tree or the uploaded artifact."
|
|
4356
4244
|
)
|
|
4357
4245
|
}).strict()
|
|
@@ -4385,7 +4273,7 @@ function compileDefinitionInput(name, input, repoUrl, commit) {
|
|
|
4385
4273
|
}
|
|
4386
4274
|
|
|
4387
4275
|
// ../packages/api-schemas/src/runDefinitions.ts
|
|
4388
|
-
var uncredentialedRepoUrlSchema =
|
|
4276
|
+
var uncredentialedRepoUrlSchema = z44.string().min(1).refine((raw) => {
|
|
4389
4277
|
if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(raw)) return true;
|
|
4390
4278
|
try {
|
|
4391
4279
|
const url = new URL(raw);
|
|
@@ -4394,67 +4282,67 @@ var uncredentialedRepoUrlSchema = z43.string().min(1).refine((raw) => {
|
|
|
4394
4282
|
return false;
|
|
4395
4283
|
}
|
|
4396
4284
|
}, "Repository URL must not contain embedded credentials or query parameters");
|
|
4397
|
-
var runDefinitionChecksSchema =
|
|
4398
|
-
var runDefinitionConfigSchema =
|
|
4399
|
-
agents:
|
|
4400
|
-
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(),
|
|
4401
4289
|
repoUrl: uncredentialedRepoUrlSchema.nullable().optional(),
|
|
4402
|
-
repoRef:
|
|
4403
|
-
profileId:
|
|
4290
|
+
repoRef: z44.string().min(1).nullable().optional(),
|
|
4291
|
+
profileId: z44.string().min(1).nullable().optional(),
|
|
4404
4292
|
skillRefs: assetRefListSchema.optional(),
|
|
4405
4293
|
mcpRefs: assetRefListSchema.optional(),
|
|
4406
|
-
connectionIds:
|
|
4294
|
+
connectionIds: z44.array(z44.string().min(1)).max(32).optional(),
|
|
4407
4295
|
addons: runAddonsSchema.optional(),
|
|
4408
|
-
inputs:
|
|
4296
|
+
inputs: z44.array(z44.string()).optional(),
|
|
4409
4297
|
checks: runDefinitionChecksSchema.optional()
|
|
4410
4298
|
}).strict();
|
|
4411
|
-
var runDefinitionFileConfigSchema =
|
|
4412
|
-
version:
|
|
4413
|
-
org:
|
|
4299
|
+
var runDefinitionFileConfigSchema = z44.object({
|
|
4300
|
+
version: z44.literal(2).default(2),
|
|
4301
|
+
org: z44.string().min(1).optional(),
|
|
4414
4302
|
checks: runDefinitionChecksSchema.optional(),
|
|
4415
|
-
cases:
|
|
4416
|
-
inputs:
|
|
4417
|
-
|
|
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),
|
|
4418
4306
|
runDefinitionInputSchema
|
|
4419
4307
|
).refine(
|
|
4420
4308
|
(inputs) => Object.keys(inputs).length <= 32,
|
|
4421
4309
|
"At most 32 inputs are allowed"
|
|
4422
4310
|
).meta({ maxProperties: 32 }).default({})
|
|
4423
4311
|
}).strict();
|
|
4424
|
-
var runDefinitionCriterionSchema =
|
|
4312
|
+
var runDefinitionCriterionSchema = z44.object({ name: z44.string().min(1), rubric: z44.string().min(1) }).strict();
|
|
4425
4313
|
var caseMeasurement = {
|
|
4426
|
-
criteria:
|
|
4314
|
+
criteria: z44.array(runDefinitionCriterionSchema).min(1).optional(),
|
|
4427
4315
|
preference: preferenceDefinitionSchema.optional()
|
|
4428
4316
|
};
|
|
4429
4317
|
function exactlyOneMeasurement(item) {
|
|
4430
4318
|
return item.criteria !== void 0 !== (item.preference !== void 0);
|
|
4431
4319
|
}
|
|
4432
|
-
var runDefinitionFrontmatterSchema =
|
|
4320
|
+
var runDefinitionFrontmatterSchema = z44.object({
|
|
4433
4321
|
...caseMeasurement,
|
|
4434
4322
|
config: runDefinitionConfigSchema
|
|
4435
4323
|
}).strict().refine(
|
|
4436
4324
|
exactlyOneMeasurement,
|
|
4437
4325
|
"Specify exactly one of criteria or preference"
|
|
4438
4326
|
);
|
|
4439
|
-
var runDefinitionCaseSchema =
|
|
4440
|
-
path:
|
|
4441
|
-
prompt:
|
|
4327
|
+
var runDefinitionCaseSchema = z44.object({
|
|
4328
|
+
path: z44.string().min(1),
|
|
4329
|
+
prompt: z44.string().min(1),
|
|
4442
4330
|
...caseMeasurement,
|
|
4443
4331
|
config: runDefinitionConfigSchema
|
|
4444
4332
|
}).strict().refine(
|
|
4445
4333
|
exactlyOneMeasurement,
|
|
4446
4334
|
"Specify exactly one of criteria or preference"
|
|
4447
4335
|
);
|
|
4448
|
-
var runDefinitionSubmissionSchema =
|
|
4449
|
-
version:
|
|
4450
|
-
source:
|
|
4336
|
+
var runDefinitionSubmissionSchema = z44.object({
|
|
4337
|
+
version: z44.literal(2),
|
|
4338
|
+
source: z44.object({
|
|
4451
4339
|
repoUrl: uncredentialedRepoUrlSchema,
|
|
4452
|
-
commit:
|
|
4453
|
-
digest:
|
|
4454
|
-
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"])
|
|
4455
4343
|
}).strict(),
|
|
4456
|
-
resources:
|
|
4457
|
-
cases:
|
|
4344
|
+
resources: z44.array(runPlanResourceSchema).max(32).default([]),
|
|
4345
|
+
cases: z44.array(runDefinitionCaseSchema).min(1).max(20)
|
|
4458
4346
|
}).strict().superRefine((definition, ctx) => {
|
|
4459
4347
|
const paths = /* @__PURE__ */ new Set();
|
|
4460
4348
|
for (const [index, item] of definition.cases.entries()) {
|
|
@@ -4497,55 +4385,55 @@ var runDefinitionPublicSubmissionSchema = runDefinitionSubmissionSchema.refine(
|
|
|
4497
4385
|
message: "Only the GitHub App may verify committed bytes"
|
|
4498
4386
|
}
|
|
4499
4387
|
);
|
|
4500
|
-
var runDefinitionPlanResponseSchema =
|
|
4388
|
+
var runDefinitionPlanResponseSchema = z44.object({
|
|
4501
4389
|
source: runDefinitionSubmissionSchema.shape.source,
|
|
4502
|
-
measurementMode:
|
|
4503
|
-
cases:
|
|
4504
|
-
|
|
4505
|
-
path:
|
|
4506
|
-
agents:
|
|
4507
|
-
samples:
|
|
4508
|
-
expectedRuns:
|
|
4509
|
-
workspace:
|
|
4510
|
-
repoUrl:
|
|
4511
|
-
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()
|
|
4512
4400
|
}),
|
|
4513
|
-
criteriaCount:
|
|
4401
|
+
criteriaCount: z44.number().int().nonnegative(),
|
|
4514
4402
|
preference: preferenceDefinitionSchema.optional(),
|
|
4515
|
-
inputs:
|
|
4403
|
+
inputs: z44.array(z44.string())
|
|
4516
4404
|
})
|
|
4517
4405
|
),
|
|
4518
|
-
resources:
|
|
4519
|
-
|
|
4520
|
-
name:
|
|
4521
|
-
type:
|
|
4522
|
-
source:
|
|
4406
|
+
resources: z44.array(
|
|
4407
|
+
z44.object({
|
|
4408
|
+
name: z44.string(),
|
|
4409
|
+
type: z44.literal("input"),
|
|
4410
|
+
source: z44.enum([
|
|
4523
4411
|
"git",
|
|
4524
4412
|
"github-actions",
|
|
4525
4413
|
"github-deployment",
|
|
4526
4414
|
"github-pr-comment"
|
|
4527
4415
|
]),
|
|
4528
4416
|
use: inputUseSchema,
|
|
4529
|
-
readiness:
|
|
4530
|
-
detail:
|
|
4531
|
-
commands:
|
|
4417
|
+
readiness: z44.enum(["READY", "WAITING", "FAILED"]),
|
|
4418
|
+
detail: z44.string().optional(),
|
|
4419
|
+
commands: z44.array(z44.string()).optional()
|
|
4532
4420
|
})
|
|
4533
4421
|
),
|
|
4534
|
-
expectedRuns:
|
|
4535
|
-
canRun:
|
|
4422
|
+
expectedRuns: z44.number().int().nonnegative(),
|
|
4423
|
+
canRun: z44.boolean()
|
|
4536
4424
|
});
|
|
4537
|
-
var runDefinitionRunResponseSchema =
|
|
4538
|
-
runRequestId:
|
|
4539
|
-
batchIds:
|
|
4540
|
-
runIds:
|
|
4541
|
-
requestedRuns:
|
|
4542
|
-
createdRuns:
|
|
4543
|
-
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()
|
|
4544
4432
|
});
|
|
4545
4433
|
|
|
4546
4434
|
// ../packages/api-schemas/src/runRequests.ts
|
|
4547
|
-
import { z as
|
|
4548
|
-
var runRequestStatusSchema =
|
|
4435
|
+
import { z as z45 } from "zod";
|
|
4436
|
+
var runRequestStatusSchema = z45.enum([
|
|
4549
4437
|
"PENDING",
|
|
4550
4438
|
"PREPARING",
|
|
4551
4439
|
"RUNNING",
|
|
@@ -4553,7 +4441,7 @@ var runRequestStatusSchema = z44.enum([
|
|
|
4553
4441
|
"FAILED",
|
|
4554
4442
|
"CANCELED"
|
|
4555
4443
|
]);
|
|
4556
|
-
var runRequestResultSchema =
|
|
4444
|
+
var runRequestResultSchema = z45.enum([
|
|
4557
4445
|
"PENDING",
|
|
4558
4446
|
"PASSED",
|
|
4559
4447
|
"MEASURED",
|
|
@@ -4564,229 +4452,229 @@ var runRequestResultSchema = z44.enum([
|
|
|
4564
4452
|
"INCOMPLETE",
|
|
4565
4453
|
"CANCELED"
|
|
4566
4454
|
]);
|
|
4567
|
-
var runRequestCriterionResultSchema =
|
|
4568
|
-
criterionId:
|
|
4569
|
-
name:
|
|
4570
|
-
passed:
|
|
4571
|
-
reasoning:
|
|
4572
|
-
});
|
|
4573
|
-
var runRequestRunSchema =
|
|
4574
|
-
id:
|
|
4575
|
-
batchId:
|
|
4576
|
-
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(),
|
|
4577
4465
|
agent: agentSchema,
|
|
4578
|
-
model:
|
|
4466
|
+
model: z45.string(),
|
|
4579
4467
|
result: runRequestResultSchema,
|
|
4580
|
-
judge:
|
|
4581
|
-
criterionResults:
|
|
4468
|
+
judge: z45.object({ status: z45.string() }).nullable(),
|
|
4469
|
+
criterionResults: z45.array(runRequestCriterionResultSchema),
|
|
4582
4470
|
preference: visibilityVerdictSchema.nullable().optional(),
|
|
4583
|
-
measurement:
|
|
4471
|
+
measurement: z45.enum(["experience", "preference"]).optional()
|
|
4584
4472
|
});
|
|
4585
|
-
var runRequestResponseSchema =
|
|
4586
|
-
id:
|
|
4473
|
+
var runRequestResponseSchema = z45.object({
|
|
4474
|
+
id: z45.string(),
|
|
4587
4475
|
status: runRequestStatusSchema,
|
|
4588
4476
|
result: runRequestResultSchema,
|
|
4589
|
-
error:
|
|
4590
|
-
inputs:
|
|
4591
|
-
settled:
|
|
4592
|
-
counts:
|
|
4593
|
-
requestedRuns:
|
|
4594
|
-
createdRuns:
|
|
4595
|
-
terminalRuns:
|
|
4596
|
-
judgedRuns:
|
|
4597
|
-
passedRuns:
|
|
4598
|
-
measuredRuns:
|
|
4599
|
-
qualityFailedRuns:
|
|
4600
|
-
executionFailedRuns:
|
|
4601
|
-
judgeFailedRuns:
|
|
4602
|
-
pendingRuns:
|
|
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()
|
|
4603
4491
|
}),
|
|
4604
|
-
batches:
|
|
4605
|
-
|
|
4492
|
+
batches: z45.array(
|
|
4493
|
+
z45.object({ id: z45.string(), runs: z45.array(runRequestRunSchema) })
|
|
4606
4494
|
),
|
|
4607
|
-
createdAt:
|
|
4608
|
-
updatedAt:
|
|
4609
|
-
finishedAt:
|
|
4495
|
+
createdAt: z45.string(),
|
|
4496
|
+
updatedAt: z45.string(),
|
|
4497
|
+
finishedAt: z45.string().nullable()
|
|
4610
4498
|
});
|
|
4611
4499
|
|
|
4612
4500
|
// ../packages/api-schemas/src/summary.ts
|
|
4613
|
-
import { z as
|
|
4501
|
+
import { z as z46 } from "zod";
|
|
4614
4502
|
function cardResultSchema(data) {
|
|
4615
|
-
return
|
|
4616
|
-
|
|
4617
|
-
|
|
4503
|
+
return z46.union([
|
|
4504
|
+
z46.object({ ok: z46.literal(true), data }),
|
|
4505
|
+
z46.object({ ok: z46.literal(false), error: z46.string() })
|
|
4618
4506
|
]);
|
|
4619
4507
|
}
|
|
4620
|
-
var summaryActionSchema =
|
|
4621
|
-
id:
|
|
4622
|
-
title:
|
|
4623
|
-
priority:
|
|
4624
|
-
status:
|
|
4625
|
-
evidenceCount:
|
|
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()
|
|
4626
4514
|
});
|
|
4627
|
-
var summaryAeCardSchema =
|
|
4628
|
-
id:
|
|
4629
|
-
name:
|
|
4630
|
-
judgedRuns:
|
|
4631
|
-
passRate:
|
|
4515
|
+
var summaryAeCardSchema = z46.object({
|
|
4516
|
+
id: z46.string(),
|
|
4517
|
+
name: z46.string(),
|
|
4518
|
+
judgedRuns: z46.number().int(),
|
|
4519
|
+
passRate: z46.number().nullable(),
|
|
4632
4520
|
/** pp delta vs the prior 30d; null with no prior. */
|
|
4633
|
-
deltaPP:
|
|
4521
|
+
deltaPP: z46.number().nullable()
|
|
4634
4522
|
});
|
|
4635
|
-
var summaryVisibilityCardSchema =
|
|
4636
|
-
name:
|
|
4637
|
-
owned:
|
|
4638
|
-
name:
|
|
4639
|
-
rank:
|
|
4640
|
-
chosenRate:
|
|
4641
|
-
mentionRate:
|
|
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()
|
|
4642
4530
|
}).nullable(),
|
|
4643
|
-
chosenDeltaPP:
|
|
4531
|
+
chosenDeltaPP: z46.number().nullable()
|
|
4644
4532
|
});
|
|
4645
|
-
var homeSummarySchema =
|
|
4646
|
-
hasAnyRuns:
|
|
4647
|
-
lastSynthesisAt:
|
|
4648
|
-
actions: cardResultSchema(
|
|
4533
|
+
var homeSummarySchema = z46.object({
|
|
4534
|
+
hasAnyRuns: z46.boolean(),
|
|
4535
|
+
lastSynthesisAt: z46.string().nullable(),
|
|
4536
|
+
actions: cardResultSchema(z46.array(summaryActionSchema)),
|
|
4649
4537
|
visibility: cardResultSchema(
|
|
4650
|
-
|
|
4651
|
-
cards:
|
|
4652
|
-
marketsTotal:
|
|
4653
|
-
promptCount:
|
|
4538
|
+
z46.object({
|
|
4539
|
+
cards: z46.array(summaryVisibilityCardSchema),
|
|
4540
|
+
marketsTotal: z46.number().int(),
|
|
4541
|
+
promptCount: z46.number().int()
|
|
4654
4542
|
})
|
|
4655
4543
|
),
|
|
4656
4544
|
agentExperience: cardResultSchema(
|
|
4657
|
-
|
|
4658
|
-
cards:
|
|
4659
|
-
total:
|
|
4660
|
-
setCount:
|
|
4545
|
+
z46.object({
|
|
4546
|
+
cards: z46.array(summaryAeCardSchema),
|
|
4547
|
+
total: z46.number().int(),
|
|
4548
|
+
setCount: z46.number().int()
|
|
4661
4549
|
})
|
|
4662
4550
|
),
|
|
4663
|
-
notableSessions: cardResultSchema(
|
|
4551
|
+
notableSessions: cardResultSchema(z46.array(z46.unknown()))
|
|
4664
4552
|
});
|
|
4665
4553
|
|
|
4666
4554
|
// ../packages/api-schemas/src/tokens.ts
|
|
4667
|
-
import { z as
|
|
4668
|
-
var apiTokenSchema =
|
|
4669
|
-
id:
|
|
4670
|
-
name:
|
|
4555
|
+
import { z as z47 } from "zod";
|
|
4556
|
+
var apiTokenSchema = z47.object({
|
|
4557
|
+
id: z47.string(),
|
|
4558
|
+
name: z47.string(),
|
|
4671
4559
|
/** Last 4 chars of the plaintext, for recognizability (non-secret). */
|
|
4672
|
-
last4:
|
|
4673
|
-
expiresAt:
|
|
4674
|
-
lastUsedAt:
|
|
4675
|
-
createdAt:
|
|
4676
|
-
revokedAt:
|
|
4677
|
-
});
|
|
4678
|
-
var createTokenRequestSchema =
|
|
4679
|
-
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),
|
|
4680
4568
|
/** ISO-8601 datetime; omit for no expiry. */
|
|
4681
|
-
expiresAt:
|
|
4569
|
+
expiresAt: z47.iso.datetime({ offset: true }).optional()
|
|
4682
4570
|
});
|
|
4683
4571
|
var createTokenResponseSchema = apiTokenSchema.extend({
|
|
4684
|
-
token:
|
|
4572
|
+
token: z47.string()
|
|
4685
4573
|
});
|
|
4686
4574
|
var listTokensResponseSchema = listResponseSchema(apiTokenSchema);
|
|
4687
4575
|
|
|
4688
4576
|
// ../packages/api-schemas/src/visibility.ts
|
|
4689
|
-
import { z as
|
|
4577
|
+
import { z as z48 } from "zod";
|
|
4690
4578
|
var VISIBILITY_PROMPT_KINDS = ["HEAD_TO_HEAD", "RECOMMEND"];
|
|
4691
|
-
var visibilityPromptKindSchema =
|
|
4579
|
+
var visibilityPromptKindSchema = z48.enum(VISIBILITY_PROMPT_KINDS);
|
|
4692
4580
|
var visibilityPromptSchema = visibilityPromptSettingsSchema.extend({
|
|
4693
|
-
id:
|
|
4694
|
-
name:
|
|
4581
|
+
id: z48.string(),
|
|
4582
|
+
name: z48.string(),
|
|
4695
4583
|
kind: visibilityPromptKindSchema,
|
|
4696
|
-
promptText:
|
|
4584
|
+
promptText: z48.string(),
|
|
4697
4585
|
/** HEAD_TO_HEAD is always branded; RECOMMEND may be either. */
|
|
4698
|
-
branded:
|
|
4699
|
-
brandA:
|
|
4700
|
-
brandB:
|
|
4701
|
-
market:
|
|
4702
|
-
position:
|
|
4703
|
-
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(),
|
|
4704
4592
|
/** User tag names on the hidden backing prompt (Surface:* excluded). */
|
|
4705
|
-
tags:
|
|
4706
|
-
runCount:
|
|
4707
|
-
lastRunAt:
|
|
4708
|
-
scenarios:
|
|
4593
|
+
tags: z48.array(z48.string()),
|
|
4594
|
+
runCount: z48.number().int(),
|
|
4595
|
+
lastRunAt: z48.string().nullable(),
|
|
4596
|
+
scenarios: z48.array(visibilityScenarioSchema)
|
|
4709
4597
|
});
|
|
4710
|
-
var listVisibilityPromptsResponseSchema =
|
|
4711
|
-
items:
|
|
4598
|
+
var listVisibilityPromptsResponseSchema = z48.object({
|
|
4599
|
+
items: z48.array(visibilityPromptSchema)
|
|
4712
4600
|
});
|
|
4713
|
-
var createVisibilityPromptBodySchema =
|
|
4714
|
-
name:
|
|
4715
|
-
promptText:
|
|
4601
|
+
var createVisibilityPromptBodySchema = z48.object({
|
|
4602
|
+
name: z48.string().min(1),
|
|
4603
|
+
promptText: z48.string().min(1),
|
|
4716
4604
|
kind: visibilityPromptKindSchema,
|
|
4717
|
-
branded:
|
|
4605
|
+
branded: z48.boolean().optional(),
|
|
4718
4606
|
/** Required pair for HEAD_TO_HEAD (order-independent). */
|
|
4719
|
-
brandA:
|
|
4720
|
-
brandB:
|
|
4607
|
+
brandA: z48.string().nullish(),
|
|
4608
|
+
brandB: z48.string().nullish(),
|
|
4721
4609
|
/** Measured market id from the org's tracked set. */
|
|
4722
|
-
marketId:
|
|
4723
|
-
tags:
|
|
4610
|
+
marketId: z48.string().nullish(),
|
|
4611
|
+
tags: z48.array(z48.string()).optional(),
|
|
4724
4612
|
agents: visibilityPromptSettingsInputShape.agents.optional(),
|
|
4725
4613
|
skillRefs: visibilityPromptSettingsInputShape.skillRefs,
|
|
4726
4614
|
mcpRefs: visibilityPromptSettingsInputShape.mcpRefs,
|
|
4727
4615
|
connectionIds: visibilityPromptSettingsInputShape.connectionIds,
|
|
4728
4616
|
cadence: visibilityPromptSettingsInputShape.cadence,
|
|
4729
4617
|
sampleCount: visibilityPromptSettingsInputShape.sampleCount,
|
|
4730
|
-
scenarios:
|
|
4618
|
+
scenarios: z48.array(visibilityScenarioInputSchema).optional().default([])
|
|
4731
4619
|
}).strict();
|
|
4732
|
-
var synthesizeResponseSchema =
|
|
4620
|
+
var synthesizeResponseSchema = z48.object({
|
|
4733
4621
|
/** False when the pre-check found no new evidence and nothing was queued. */
|
|
4734
|
-
queued:
|
|
4735
|
-
});
|
|
4736
|
-
var updateVisibilityPromptBodySchema =
|
|
4737
|
-
name:
|
|
4738
|
-
promptText:
|
|
4739
|
-
branded:
|
|
4740
|
-
brandA:
|
|
4741
|
-
brandB:
|
|
4742
|
-
marketId:
|
|
4743
|
-
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(),
|
|
4744
4632
|
...visibilityPromptSettingsPatchShape,
|
|
4745
4633
|
/** Replaces the whole scenario set when present. */
|
|
4746
|
-
scenarios:
|
|
4634
|
+
scenarios: z48.array(visibilityScenarioInputSchema).optional()
|
|
4747
4635
|
}).strict();
|
|
4748
|
-
var runVisibilityPromptResponseSchema =
|
|
4749
|
-
batchIds:
|
|
4750
|
-
runIds:
|
|
4636
|
+
var runVisibilityPromptResponseSchema = z48.object({
|
|
4637
|
+
batchIds: z48.array(z48.string()),
|
|
4638
|
+
runIds: z48.array(z48.string())
|
|
4751
4639
|
});
|
|
4752
|
-
var visibilityPromptRunSchema =
|
|
4753
|
-
id:
|
|
4754
|
-
status:
|
|
4640
|
+
var visibilityPromptRunSchema = z48.object({
|
|
4641
|
+
id: z48.string(),
|
|
4642
|
+
status: z48.string(),
|
|
4755
4643
|
agent: agentSchema,
|
|
4756
|
-
model:
|
|
4757
|
-
resolvedModel:
|
|
4758
|
-
createdAt:
|
|
4759
|
-
startedAt:
|
|
4760
|
-
finishedAt:
|
|
4761
|
-
failureReason:
|
|
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(),
|
|
4762
4650
|
creditsCharged: runCreditsChargedSchema.optional(),
|
|
4763
4651
|
triggeredBy: runTriggeredBySchema.optional(),
|
|
4764
|
-
verdict:
|
|
4765
|
-
status:
|
|
4766
|
-
error:
|
|
4767
|
-
payload:
|
|
4652
|
+
verdict: z48.object({
|
|
4653
|
+
status: z48.string(),
|
|
4654
|
+
error: z48.string().nullable(),
|
|
4655
|
+
payload: z48.unknown().nullable()
|
|
4768
4656
|
}).nullable()
|
|
4769
4657
|
});
|
|
4770
4658
|
var listVisibilityPromptRunsResponseSchema = listResponseSchema(
|
|
4771
4659
|
visibilityPromptRunSchema
|
|
4772
4660
|
);
|
|
4773
|
-
var orgMarketSchema =
|
|
4774
|
-
marketId:
|
|
4775
|
-
slug:
|
|
4776
|
-
name:
|
|
4661
|
+
var orgMarketSchema = z48.object({
|
|
4662
|
+
marketId: z48.string(),
|
|
4663
|
+
slug: z48.string(),
|
|
4664
|
+
name: z48.string(),
|
|
4777
4665
|
/** The one line saying what the market measures. */
|
|
4778
|
-
capability:
|
|
4666
|
+
capability: z48.string(),
|
|
4779
4667
|
/** SUGGESTED (the matcher) | USER (a human picked it). */
|
|
4780
|
-
source:
|
|
4668
|
+
source: z48.string()
|
|
4781
4669
|
});
|
|
4782
4670
|
var addableMarketSchema = orgMarketSchema.omit({ source: true });
|
|
4783
|
-
var listMarketsResponseSchema =
|
|
4784
|
-
tracked:
|
|
4671
|
+
var listMarketsResponseSchema = z48.object({
|
|
4672
|
+
tracked: z48.array(orgMarketSchema),
|
|
4785
4673
|
/** Published markets the org does not track yet (closed set — no free-text
|
|
4786
4674
|
* market creation). */
|
|
4787
|
-
addable:
|
|
4675
|
+
addable: z48.array(addableMarketSchema)
|
|
4788
4676
|
});
|
|
4789
|
-
var addMarketBodySchema =
|
|
4677
|
+
var addMarketBodySchema = z48.object({ marketId: z48.string().min(1) });
|
|
4790
4678
|
|
|
4791
4679
|
// src/version.ts
|
|
4792
4680
|
import { createRequire } from "module";
|
|
@@ -4854,9 +4742,9 @@ function resolveToken() {
|
|
|
4854
4742
|
return null;
|
|
4855
4743
|
}
|
|
4856
4744
|
}
|
|
4857
|
-
function saveToken(
|
|
4745
|
+
function saveToken(token) {
|
|
4858
4746
|
mkdirSync2(configDir(), { recursive: true, mode: 448 });
|
|
4859
|
-
writeFileSync2(credentialsPath(), `${
|
|
4747
|
+
writeFileSync2(credentialsPath(), `${token.trim()}
|
|
4860
4748
|
`, {
|
|
4861
4749
|
encoding: "utf8",
|
|
4862
4750
|
mode: 384
|
|
@@ -4905,14 +4793,14 @@ var ApiClient = class {
|
|
|
4905
4793
|
async get(path3, query) {
|
|
4906
4794
|
return this.request("GET", path3, { query });
|
|
4907
4795
|
}
|
|
4908
|
-
async post(path3,
|
|
4909
|
-
return this.request("POST", path3, { body, query });
|
|
4796
|
+
async post(path3, body2, query) {
|
|
4797
|
+
return this.request("POST", path3, { body: body2, query });
|
|
4910
4798
|
}
|
|
4911
|
-
async patch(path3,
|
|
4912
|
-
return this.request("PATCH", path3, { body, query });
|
|
4799
|
+
async patch(path3, body2, query) {
|
|
4800
|
+
return this.request("PATCH", path3, { body: body2, query });
|
|
4913
4801
|
}
|
|
4914
|
-
async put(path3,
|
|
4915
|
-
return this.request("PUT", path3, { body, query });
|
|
4802
|
+
async put(path3, body2, query) {
|
|
4803
|
+
return this.request("PUT", path3, { body: body2, query });
|
|
4916
4804
|
}
|
|
4917
4805
|
async delete(path3, query) {
|
|
4918
4806
|
return this.request("DELETE", path3, { query });
|
|
@@ -4934,20 +4822,20 @@ var ApiClient = class {
|
|
|
4934
4822
|
}
|
|
4935
4823
|
const reader = res.body.getReader();
|
|
4936
4824
|
const decoder = new TextDecoder();
|
|
4937
|
-
let
|
|
4825
|
+
let buffer2 = "";
|
|
4938
4826
|
try {
|
|
4939
4827
|
while (true) {
|
|
4940
4828
|
const { done, value } = await reader.read();
|
|
4941
4829
|
if (done) break;
|
|
4942
|
-
|
|
4943
|
-
let boundary =
|
|
4830
|
+
buffer2 += decoder.decode(value, { stream: true });
|
|
4831
|
+
let boundary = buffer2.indexOf("\n\n");
|
|
4944
4832
|
while (boundary !== -1) {
|
|
4945
|
-
const raw =
|
|
4833
|
+
const raw = buffer2.slice(0, boundary);
|
|
4946
4834
|
const event = parseSseFrame(raw);
|
|
4947
|
-
|
|
4835
|
+
buffer2 = buffer2.slice(boundary + 2);
|
|
4948
4836
|
if (event) onEvent(event);
|
|
4949
4837
|
else if (raw.trimStart().startsWith(":")) options.onComment?.();
|
|
4950
|
-
boundary =
|
|
4838
|
+
boundary = buffer2.indexOf("\n\n");
|
|
4951
4839
|
}
|
|
4952
4840
|
}
|
|
4953
4841
|
} catch (error) {
|
|
@@ -4998,13 +4886,13 @@ var ApiClient = class {
|
|
|
4998
4886
|
});
|
|
4999
4887
|
if (!res.ok) throw await this.toError(res);
|
|
5000
4888
|
if (res.status === 204) return void 0;
|
|
5001
|
-
const
|
|
5002
|
-
if (!
|
|
4889
|
+
const text2 = await res.text();
|
|
4890
|
+
if (!text2) return void 0;
|
|
5003
4891
|
const contentType = res.headers.get("content-type") ?? "";
|
|
5004
4892
|
if (contentType.includes("application/json")) {
|
|
5005
|
-
return JSON.parse(
|
|
4893
|
+
return JSON.parse(text2);
|
|
5006
4894
|
}
|
|
5007
|
-
return
|
|
4895
|
+
return text2;
|
|
5008
4896
|
}
|
|
5009
4897
|
async toError(res) {
|
|
5010
4898
|
try {
|
|
@@ -5152,10 +5040,10 @@ function register(program2) {
|
|
|
5152
5040
|
);
|
|
5153
5041
|
});
|
|
5154
5042
|
group.command("status <id> <status>").description("Transition an action: open | resolved | dismissed").option("--note <text>", "resolution note (recorded when closing)").action(
|
|
5155
|
-
async (
|
|
5043
|
+
async (id2, status, opts, cmd) => {
|
|
5156
5044
|
const org = resolveOrg(cmd);
|
|
5157
5045
|
const updated = await createClient().patch(
|
|
5158
|
-
`${actionsPath(org)}/${encodeURIComponent(
|
|
5046
|
+
`${actionsPath(org)}/${encodeURIComponent(id2)}`,
|
|
5159
5047
|
{ status: parseStatus(status), note: opts.note }
|
|
5160
5048
|
);
|
|
5161
5049
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
@@ -5171,7 +5059,7 @@ __export(apply_exports, {
|
|
|
5171
5059
|
register: () => register2
|
|
5172
5060
|
});
|
|
5173
5061
|
import { readFileSync as readFileSync3 } from "fs";
|
|
5174
|
-
import { z as
|
|
5062
|
+
import { z as z49 } from "zod";
|
|
5175
5063
|
function assertRequiredExperiment(spec, required) {
|
|
5176
5064
|
if (required.length === 0) {
|
|
5177
5065
|
throw new CliError(
|
|
@@ -5304,7 +5192,7 @@ function printApplied(res) {
|
|
|
5304
5192
|
console.log(
|
|
5305
5193
|
`Applied${res.experiment ? ` (experiment: ${res.experiment})` : ""} \u2014 ${res.batchIds.length} batch(es), ${res.runIds.length} run(s) enqueued`
|
|
5306
5194
|
);
|
|
5307
|
-
for (const
|
|
5195
|
+
for (const id2 of res.runIds) console.log(` run ${id2}`);
|
|
5308
5196
|
if (res.runIds.length > 0) {
|
|
5309
5197
|
console.error(`(watch one live: gauge runs watch ${res.runIds[0]})`);
|
|
5310
5198
|
}
|
|
@@ -5323,7 +5211,7 @@ function register2(program2) {
|
|
|
5323
5211
|
).option("--schema", "print the battery spec JSON Schema and exit").option("--example", "print a minimal example battery spec and exit").action(
|
|
5324
5212
|
async (opts, command) => {
|
|
5325
5213
|
if (opts.schema) {
|
|
5326
|
-
printJson(
|
|
5214
|
+
printJson(z49.toJSONSchema(batteries_exports.batterySpecSchema));
|
|
5327
5215
|
return;
|
|
5328
5216
|
}
|
|
5329
5217
|
if (opts.example) {
|
|
@@ -5517,9 +5405,9 @@ async function browserLogin() {
|
|
|
5517
5405
|
);
|
|
5518
5406
|
}
|
|
5519
5407
|
const exchange = parsed.data;
|
|
5520
|
-
const
|
|
5521
|
-
const me = await fetchMe(new ApiClient({ token
|
|
5522
|
-
saveToken(
|
|
5408
|
+
const token = exchange.accessToken;
|
|
5409
|
+
const me = await fetchMe(new ApiClient({ token }));
|
|
5410
|
+
saveToken(token);
|
|
5523
5411
|
console.log(`Token saved to ${credentialsPath()}`);
|
|
5524
5412
|
printIdentity(me);
|
|
5525
5413
|
} finally {
|
|
@@ -5529,7 +5417,7 @@ async function browserLogin() {
|
|
|
5529
5417
|
}
|
|
5530
5418
|
}
|
|
5531
5419
|
var DEVICE_ENDPOINT = "/api/v1/device";
|
|
5532
|
-
async function bootstrapPost(path3,
|
|
5420
|
+
async function bootstrapPost(path3, body2) {
|
|
5533
5421
|
const base = resolveBaseUrl().replace(/\/+$/, "");
|
|
5534
5422
|
let res;
|
|
5535
5423
|
try {
|
|
@@ -5540,7 +5428,7 @@ async function bootstrapPost(path3, body) {
|
|
|
5540
5428
|
Accept: "application/json",
|
|
5541
5429
|
"User-Agent": USER_AGENT
|
|
5542
5430
|
},
|
|
5543
|
-
body: JSON.stringify(
|
|
5431
|
+
body: JSON.stringify(body2)
|
|
5544
5432
|
});
|
|
5545
5433
|
} catch (e) {
|
|
5546
5434
|
throw new CliError(
|
|
@@ -5548,10 +5436,10 @@ async function bootstrapPost(path3, body) {
|
|
|
5548
5436
|
`Request to ${base} failed: ${e instanceof Error ? e.message : String(e)}`
|
|
5549
5437
|
);
|
|
5550
5438
|
}
|
|
5551
|
-
const
|
|
5439
|
+
const text2 = await res.text();
|
|
5552
5440
|
if (!res.ok) {
|
|
5553
5441
|
try {
|
|
5554
|
-
const parsed = errorEnvelopeSchema.safeParse(JSON.parse(
|
|
5442
|
+
const parsed = errorEnvelopeSchema.safeParse(JSON.parse(text2));
|
|
5555
5443
|
if (parsed.success) {
|
|
5556
5444
|
throw new CliError(parsed.data.error.code, parsed.data.error.message);
|
|
5557
5445
|
}
|
|
@@ -5563,7 +5451,7 @@ async function bootstrapPost(path3, body) {
|
|
|
5563
5451
|
`Authentication request failed: HTTP ${res.status} ${res.statusText}`.trim()
|
|
5564
5452
|
);
|
|
5565
5453
|
}
|
|
5566
|
-
return JSON.parse(
|
|
5454
|
+
return JSON.parse(text2);
|
|
5567
5455
|
}
|
|
5568
5456
|
async function deviceLogin(opts) {
|
|
5569
5457
|
const start = await bootstrapPost(
|
|
@@ -5623,10 +5511,10 @@ async function deviceLogin(opts) {
|
|
|
5623
5511
|
"The sign-in request expired before it was approved. Re-run it to try again."
|
|
5624
5512
|
);
|
|
5625
5513
|
case "approved": {
|
|
5626
|
-
const
|
|
5514
|
+
const token = result.accessToken;
|
|
5627
5515
|
try {
|
|
5628
|
-
const me = await fetchMe(new ApiClient({ token
|
|
5629
|
-
return { token
|
|
5516
|
+
const me = await fetchMe(new ApiClient({ token }));
|
|
5517
|
+
return { token, me };
|
|
5630
5518
|
} catch (e) {
|
|
5631
5519
|
throw new CliError(
|
|
5632
5520
|
"network",
|
|
@@ -5663,15 +5551,15 @@ async function withTokenLogin() {
|
|
|
5663
5551
|
if (process.stdin.isTTY) {
|
|
5664
5552
|
console.error("Paste your API token, then press Enter:");
|
|
5665
5553
|
}
|
|
5666
|
-
const
|
|
5667
|
-
if (!
|
|
5554
|
+
const token = (await readStdin()).trim();
|
|
5555
|
+
if (!token.startsWith(TOKEN_PREFIX)) {
|
|
5668
5556
|
throw new CliError(
|
|
5669
5557
|
"usage",
|
|
5670
5558
|
`Expected a token starting with ${TOKEN_PREFIX} on stdin`
|
|
5671
5559
|
);
|
|
5672
5560
|
}
|
|
5673
|
-
const me = await fetchMe(new ApiClient({ token
|
|
5674
|
-
saveToken(
|
|
5561
|
+
const me = await fetchMe(new ApiClient({ token }));
|
|
5562
|
+
saveToken(token);
|
|
5675
5563
|
console.log(`Token saved to ${credentialsPath()}`);
|
|
5676
5564
|
printIdentity(me);
|
|
5677
5565
|
}
|
|
@@ -5739,8 +5627,8 @@ function register3(program2) {
|
|
|
5739
5627
|
throw new CliError("usage", "--email requires --device.");
|
|
5740
5628
|
}
|
|
5741
5629
|
if (opts.device) {
|
|
5742
|
-
const { token
|
|
5743
|
-
saveToken(
|
|
5630
|
+
const { token, me } = await deviceLogin({ email: opts.email });
|
|
5631
|
+
saveToken(token);
|
|
5744
5632
|
console.log(`Token saved to ${credentialsPath()}`);
|
|
5745
5633
|
printIdentity(me);
|
|
5746
5634
|
} else if (opts.withToken) {
|
|
@@ -5762,8 +5650,8 @@ function register3(program2) {
|
|
|
5762
5650
|
});
|
|
5763
5651
|
auth.command("status").description("Show the current auth state").action(async (_opts, command) => {
|
|
5764
5652
|
const output = resolveOutput(command);
|
|
5765
|
-
const
|
|
5766
|
-
if (
|
|
5653
|
+
const source2 = tokenSource();
|
|
5654
|
+
if (source2 === "none") {
|
|
5767
5655
|
throw new CliError(
|
|
5768
5656
|
"unauthorized",
|
|
5769
5657
|
"Not logged in. Run `gauge auth login` or set GAUGE_API_TOKEN."
|
|
@@ -5776,7 +5664,7 @@ function register3(program2) {
|
|
|
5776
5664
|
if (e instanceof CliError && e.code === "unauthorized") {
|
|
5777
5665
|
throw new CliError(
|
|
5778
5666
|
"unauthorized",
|
|
5779
|
-
`Token (source: ${
|
|
5667
|
+
`Token (source: ${source2}) was rejected \u2014 it may be revoked or expired. Run \`gauge auth login\`.`
|
|
5780
5668
|
);
|
|
5781
5669
|
}
|
|
5782
5670
|
throw e;
|
|
@@ -5784,7 +5672,7 @@ function register3(program2) {
|
|
|
5784
5672
|
if (output === "json") {
|
|
5785
5673
|
printJson({
|
|
5786
5674
|
authenticated: true,
|
|
5787
|
-
source,
|
|
5675
|
+
source: source2,
|
|
5788
5676
|
apiUrl: resolveBaseUrl(),
|
|
5789
5677
|
...me
|
|
5790
5678
|
});
|
|
@@ -5792,7 +5680,7 @@ function register3(program2) {
|
|
|
5792
5680
|
}
|
|
5793
5681
|
printIdentity(me);
|
|
5794
5682
|
console.log(
|
|
5795
|
-
`Token source: ${
|
|
5683
|
+
`Token source: ${source2 === "env" ? "GAUGE_API_TOKEN environment variable" : credentialsPath()}`
|
|
5796
5684
|
);
|
|
5797
5685
|
});
|
|
5798
5686
|
const tokens2 = auth.command("tokens").description("Manage API tokens");
|
|
@@ -5826,11 +5714,11 @@ function register3(program2) {
|
|
|
5826
5714
|
console.log("Store it now \u2014 it won't be shown again.");
|
|
5827
5715
|
}
|
|
5828
5716
|
);
|
|
5829
|
-
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) => {
|
|
5830
5718
|
await createClient().delete(
|
|
5831
|
-
`${TOKENS_PATH}/${encodeURIComponent(
|
|
5719
|
+
`${TOKENS_PATH}/${encodeURIComponent(id2)}`
|
|
5832
5720
|
);
|
|
5833
|
-
if (resolveOutput(command) !== "json") console.log(`Revoked ${
|
|
5721
|
+
if (resolveOutput(command) !== "json") console.log(`Revoked ${id2}`);
|
|
5834
5722
|
});
|
|
5835
5723
|
program2.command("whoami").description("Show the authenticated user and their orgs").action(async (_opts, command) => {
|
|
5836
5724
|
await whoami(resolveOutput(command));
|
|
@@ -5939,12 +5827,12 @@ function readPromptText(opts) {
|
|
|
5939
5827
|
throw new CliError("usage", "pass exactly one of --text or --file");
|
|
5940
5828
|
}
|
|
5941
5829
|
if (opts.text !== void 0) return opts.text;
|
|
5942
|
-
const
|
|
5830
|
+
const text2 = readFileSync4(
|
|
5943
5831
|
opts.file === "-" ? 0 : opts.file,
|
|
5944
5832
|
"utf8"
|
|
5945
5833
|
).trim();
|
|
5946
|
-
if (!
|
|
5947
|
-
return
|
|
5834
|
+
if (!text2) throw new CliError("usage", "prompt file is empty");
|
|
5835
|
+
return text2;
|
|
5948
5836
|
}
|
|
5949
5837
|
|
|
5950
5838
|
// src/commands/batches.ts
|
|
@@ -5987,9 +5875,9 @@ function register4(program2) {
|
|
|
5987
5875
|
}
|
|
5988
5876
|
}
|
|
5989
5877
|
);
|
|
5990
|
-
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) => {
|
|
5991
5879
|
const batch = await createClient().get(
|
|
5992
|
-
`/api/v1/batches/${encodeURIComponent(
|
|
5880
|
+
`/api/v1/batches/${encodeURIComponent(id2)}`
|
|
5993
5881
|
);
|
|
5994
5882
|
if (resolveOutput(command) === "json") {
|
|
5995
5883
|
printJson(batch);
|
|
@@ -6166,7 +6054,7 @@ function register6(program2) {
|
|
|
6166
6054
|
"replace packages, repeatable",
|
|
6167
6055
|
collect2
|
|
6168
6056
|
).option("--clear-packages", "remove all packages").action(
|
|
6169
|
-
async (
|
|
6057
|
+
async (id2, opts, cmd) => {
|
|
6170
6058
|
const patch = {};
|
|
6171
6059
|
if (opts.name !== void 0) patch.name = opts.name;
|
|
6172
6060
|
if (opts.kind !== void 0) patch.kind = opts.kind.toUpperCase();
|
|
@@ -6184,19 +6072,19 @@ function register6(program2) {
|
|
|
6184
6072
|
}
|
|
6185
6073
|
const org = resolveOrg(cmd);
|
|
6186
6074
|
const row2 = await createClient().patch(
|
|
6187
|
-
`${brandsPath(org)}/${encodeURIComponent(
|
|
6075
|
+
`${brandsPath(org)}/${encodeURIComponent(id2)}`,
|
|
6188
6076
|
patch
|
|
6189
6077
|
);
|
|
6190
6078
|
if (resolveOutput(cmd) === "json") printJson(row2);
|
|
6191
6079
|
else console.log(`Updated brand ${row2.id} (${row2.name})`);
|
|
6192
6080
|
}
|
|
6193
6081
|
);
|
|
6194
|
-
group.command("rm <id>").description("Delete a brand").action(async (
|
|
6082
|
+
group.command("rm <id>").description("Delete a brand").action(async (id2, _opts, cmd) => {
|
|
6195
6083
|
const org = resolveOrg(cmd);
|
|
6196
6084
|
await createClient().delete(
|
|
6197
|
-
`${brandsPath(org)}/${encodeURIComponent(
|
|
6085
|
+
`${brandsPath(org)}/${encodeURIComponent(id2)}`
|
|
6198
6086
|
);
|
|
6199
|
-
if (resolveOutput(cmd) !== "json") console.log(`Deleted brand ${
|
|
6087
|
+
if (resolveOutput(cmd) !== "json") console.log(`Deleted brand ${id2}`);
|
|
6200
6088
|
});
|
|
6201
6089
|
}
|
|
6202
6090
|
|
|
@@ -6229,10 +6117,10 @@ function printDetail(canary, json) {
|
|
|
6229
6117
|
);
|
|
6230
6118
|
}
|
|
6231
6119
|
}
|
|
6232
|
-
async function waitForCanary(
|
|
6120
|
+
async function waitForCanary(id2) {
|
|
6233
6121
|
const client = createClient();
|
|
6234
6122
|
while (true) {
|
|
6235
|
-
const canary = await client.get(`${path}/${
|
|
6123
|
+
const canary = await client.get(`${path}/${id2}`);
|
|
6236
6124
|
if (terminal.has(canary.status)) return canary;
|
|
6237
6125
|
await new Promise((resolve3) => setTimeout(resolve3, 1e4));
|
|
6238
6126
|
}
|
|
@@ -6253,9 +6141,9 @@ function register7(program2, opts = {}) {
|
|
|
6253
6141
|
process.exitCode = 1;
|
|
6254
6142
|
}
|
|
6255
6143
|
);
|
|
6256
|
-
canary.command("get <id>").option("--json", "print JSON").action(async (
|
|
6144
|
+
canary.command("get <id>").option("--json", "print JSON").action(async (id2, opts2) => {
|
|
6257
6145
|
printDetail(
|
|
6258
|
-
await createClient().get(`${path}/${
|
|
6146
|
+
await createClient().get(`${path}/${id2}`),
|
|
6259
6147
|
Boolean(opts2.json)
|
|
6260
6148
|
);
|
|
6261
6149
|
});
|
|
@@ -6799,8 +6687,8 @@ function utf8(bytes, path3) {
|
|
|
6799
6687
|
}
|
|
6800
6688
|
}
|
|
6801
6689
|
function parseRunDefinitionCase(path3, bytes) {
|
|
6802
|
-
const
|
|
6803
|
-
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);
|
|
6804
6692
|
if (!match)
|
|
6805
6693
|
throw new Error(`${path3}: expected YAML frontmatter between --- lines`);
|
|
6806
6694
|
const document = parseDocument(match[1], { uniqueKeys: true });
|
|
@@ -6970,7 +6858,7 @@ import { minimatch as minimatch2 } from "minimatch";
|
|
|
6970
6858
|
import { parseDocument as parseDocument2 } from "yaml";
|
|
6971
6859
|
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
6972
6860
|
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
6973
|
-
var check = (
|
|
6861
|
+
var check = (id2, state, detail) => ({ id: id2, state, detail });
|
|
6974
6862
|
var dynamic = (value) => typeof value !== "string" || value.includes("${{");
|
|
6975
6863
|
var condition = (value) => {
|
|
6976
6864
|
if (value === void 0 || value === true) return true;
|
|
@@ -7048,12 +6936,12 @@ function workingFiles(root) {
|
|
|
7048
6936
|
}
|
|
7049
6937
|
function workflowChecks(root, input) {
|
|
7050
6938
|
if (input.source.type !== "github-actions") return [];
|
|
7051
|
-
const
|
|
6939
|
+
const source2 = input.source;
|
|
7052
6940
|
const checks = [];
|
|
7053
6941
|
let workflow;
|
|
7054
6942
|
try {
|
|
7055
6943
|
const document = parseDocument2(
|
|
7056
|
-
read(root,
|
|
6944
|
+
read(root, source2.workflow).toString("utf8"),
|
|
7057
6945
|
{ uniqueKeys: true }
|
|
7058
6946
|
);
|
|
7059
6947
|
if (document.errors.length)
|
|
@@ -7065,7 +6953,7 @@ function workflowChecks(root, input) {
|
|
|
7065
6953
|
check(
|
|
7066
6954
|
"workflow",
|
|
7067
6955
|
"yes",
|
|
7068
|
-
`${
|
|
6956
|
+
`${source2.workflow} exists with a parseable YAML jobs mapping`
|
|
7069
6957
|
)
|
|
7070
6958
|
);
|
|
7071
6959
|
} catch (error) {
|
|
@@ -7087,14 +6975,14 @@ function workflowChecks(root, input) {
|
|
|
7087
6975
|
);
|
|
7088
6976
|
const candidates = uploads.filter(({ step }) => {
|
|
7089
6977
|
const name = record(step.with).name ?? "artifact";
|
|
7090
|
-
return !
|
|
6978
|
+
return !source2.artifact || dynamic(name) || minimatch2(String(name), source2.artifact, { nonegate: true });
|
|
7091
6979
|
});
|
|
7092
6980
|
const recognizedUpload = candidates.length === 1 && !dynamic(record(candidates[0].step.with).name ?? "artifact");
|
|
7093
6981
|
checks.push(
|
|
7094
6982
|
check(
|
|
7095
6983
|
"artifact-upload",
|
|
7096
6984
|
recognizedUpload ? "yes" : "unknown",
|
|
7097
|
-
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"}`
|
|
7098
6986
|
)
|
|
7099
6987
|
);
|
|
7100
6988
|
for (const [index, { job, jobCondition, step }] of candidates.entries()) {
|
|
@@ -7103,10 +6991,10 @@ function workflowChecks(root, input) {
|
|
|
7103
6991
|
String(step.uses)
|
|
7104
6992
|
);
|
|
7105
6993
|
const major = version ? Number(version[1]) : void 0;
|
|
7106
|
-
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";
|
|
7107
6995
|
const conditional = jobCondition === void 0 || condition(step.if) === void 0;
|
|
7108
6996
|
if (state === "no" && conditional) state = "unknown";
|
|
7109
|
-
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)";
|
|
7110
6998
|
checks.push(
|
|
7111
6999
|
check(
|
|
7112
7000
|
`artifact-format.${index}`,
|
|
@@ -7545,10 +7433,10 @@ function register12(program2) {
|
|
|
7545
7433
|
else printItems(res.items.map(toRow2), "table");
|
|
7546
7434
|
}
|
|
7547
7435
|
);
|
|
7548
|
-
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) => {
|
|
7549
7437
|
const org = resolveOrg(cmd);
|
|
7550
7438
|
const evalSet = await createClient().get(
|
|
7551
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7439
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}`
|
|
7552
7440
|
);
|
|
7553
7441
|
if (resolveOutput(cmd) === "json") printJson(evalSet);
|
|
7554
7442
|
else printDetail2(evalSet);
|
|
@@ -7577,7 +7465,7 @@ function register12(program2) {
|
|
|
7577
7465
|
"usage",
|
|
7578
7466
|
"at least one --criterion (or --criteria-file) is required"
|
|
7579
7467
|
);
|
|
7580
|
-
const
|
|
7468
|
+
const body2 = {
|
|
7581
7469
|
name: opts.name,
|
|
7582
7470
|
promptText: readPromptText(opts),
|
|
7583
7471
|
...ownedConfigFromOpts(opts),
|
|
@@ -7590,7 +7478,7 @@ function register12(program2) {
|
|
|
7590
7478
|
);
|
|
7591
7479
|
const created = await createClient().post(
|
|
7592
7480
|
evalSetsPath(org),
|
|
7593
|
-
|
|
7481
|
+
body2
|
|
7594
7482
|
);
|
|
7595
7483
|
if (resolveOutput(cmd) === "json") printJson(created);
|
|
7596
7484
|
else console.log(`Created eval set ${created.id}`);
|
|
@@ -7617,34 +7505,34 @@ function register12(program2) {
|
|
|
7617
7505
|
collect,
|
|
7618
7506
|
[]
|
|
7619
7507
|
).option("--clear-tags", "remove all user tags").action(
|
|
7620
|
-
async (
|
|
7508
|
+
async (id2, opts, cmd) => {
|
|
7621
7509
|
const org = resolveOrg(cmd);
|
|
7622
|
-
const
|
|
7623
|
-
if (opts.name !== void 0)
|
|
7510
|
+
const body2 = ownedConfigPatchFromOpts(opts);
|
|
7511
|
+
if (opts.name !== void 0) body2.name = opts.name;
|
|
7624
7512
|
if (opts.text !== void 0 || opts.file !== void 0)
|
|
7625
|
-
|
|
7513
|
+
body2.promptText = readPromptText(opts);
|
|
7626
7514
|
const criteria = criteriaFromOpts(opts);
|
|
7627
|
-
if (criteria)
|
|
7515
|
+
if (criteria) body2.criteria = criteria;
|
|
7628
7516
|
if (opts.tag.length > 0 && opts.clearTags)
|
|
7629
7517
|
throw new CliError("usage", "--tag and --clear-tags conflict");
|
|
7630
|
-
if (opts.clearTags)
|
|
7631
|
-
else if (opts.tag.length > 0)
|
|
7632
|
-
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)
|
|
7633
7521
|
throw new CliError("usage", "nothing to change");
|
|
7634
7522
|
const updated = await createClient().patch(
|
|
7635
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7636
|
-
|
|
7523
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}`,
|
|
7524
|
+
body2
|
|
7637
7525
|
);
|
|
7638
7526
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
7639
7527
|
else console.log(`Updated eval set ${updated.id}`);
|
|
7640
7528
|
}
|
|
7641
7529
|
);
|
|
7642
|
-
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) => {
|
|
7643
7531
|
const org = resolveOrg(cmd);
|
|
7644
7532
|
await createClient().delete(
|
|
7645
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7533
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}`
|
|
7646
7534
|
);
|
|
7647
|
-
if (resolveOutput(cmd) !== "json") console.log(`Deleted eval set ${
|
|
7535
|
+
if (resolveOutput(cmd) !== "json") console.log(`Deleted eval set ${id2}`);
|
|
7648
7536
|
});
|
|
7649
7537
|
group.command("run [id]").description(
|
|
7650
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"
|
|
@@ -7657,9 +7545,9 @@ function register12(program2) {
|
|
|
7657
7545
|
"--files <paths...>",
|
|
7658
7546
|
"committed Markdown paths or globs (default gauge-evals/**/*.md)"
|
|
7659
7547
|
).option("--yes", "skip the confirmation").action(
|
|
7660
|
-
async (
|
|
7661
|
-
if (opts.files !== void 0 ||
|
|
7662
|
-
if (
|
|
7548
|
+
async (id2, opts, cmd) => {
|
|
7549
|
+
if (opts.files !== void 0 || id2 === void 0) {
|
|
7550
|
+
if (id2 !== void 0)
|
|
7663
7551
|
throw new CliError(
|
|
7664
7552
|
"usage",
|
|
7665
7553
|
"pass either an eval ID or --files, not both"
|
|
@@ -7687,7 +7575,7 @@ function register12(program2) {
|
|
|
7687
7575
|
opts.yes
|
|
7688
7576
|
);
|
|
7689
7577
|
const result = await createClient().post(
|
|
7690
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7578
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}/run`,
|
|
7691
7579
|
opts.billToOrg ? { billToOrg: true } : {}
|
|
7692
7580
|
);
|
|
7693
7581
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -7698,10 +7586,10 @@ function register12(program2) {
|
|
|
7698
7586
|
}
|
|
7699
7587
|
);
|
|
7700
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(
|
|
7701
|
-
async (
|
|
7589
|
+
async (id2, opts, cmd) => {
|
|
7702
7590
|
const org = resolveOrg(cmd);
|
|
7703
7591
|
const res = await createClient().get(
|
|
7704
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7592
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}/runs`,
|
|
7705
7593
|
{ limit: opts.limit, cursor: opts.cursor }
|
|
7706
7594
|
);
|
|
7707
7595
|
if (resolveOutput(cmd) === "json") {
|
|
@@ -7735,7 +7623,7 @@ function register12(program2) {
|
|
|
7735
7623
|
collect,
|
|
7736
7624
|
[]
|
|
7737
7625
|
).option("--clear", "remove all user tags").action(
|
|
7738
|
-
async (
|
|
7626
|
+
async (id2, opts, cmd) => {
|
|
7739
7627
|
const org = resolveOrg(cmd);
|
|
7740
7628
|
if (opts.tag.length > 0 && opts.clear)
|
|
7741
7629
|
throw new CliError("usage", "--tag and --clear conflict");
|
|
@@ -7745,7 +7633,7 @@ function register12(program2) {
|
|
|
7745
7633
|
"pass --tag <name> (repeatable) or --clear"
|
|
7746
7634
|
);
|
|
7747
7635
|
const updated = await createClient().patch(
|
|
7748
|
-
`${evalSetsPath(org)}/${encodeURIComponent(
|
|
7636
|
+
`${evalSetsPath(org)}/${encodeURIComponent(id2)}`,
|
|
7749
7637
|
{ tags: opts.clear ? [] : opts.tag }
|
|
7750
7638
|
);
|
|
7751
7639
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
@@ -8308,15 +8196,15 @@ function register15(program2) {
|
|
|
8308
8196
|
const org = resolveOrg(cmd);
|
|
8309
8197
|
if (opts.note !== void 0 && opts.clearNote)
|
|
8310
8198
|
throw new CliError("usage", "--note and --clear-note conflict");
|
|
8311
|
-
const
|
|
8312
|
-
if (opts.rename !== void 0)
|
|
8313
|
-
if (opts.clearNote)
|
|
8314
|
-
else if (opts.note !== void 0)
|
|
8315
|
-
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)
|
|
8316
8204
|
throw new CliError("usage", "nothing to change");
|
|
8317
8205
|
const updated = await createClient().patch(
|
|
8318
8206
|
serverPath(org, ref),
|
|
8319
|
-
|
|
8207
|
+
body2
|
|
8320
8208
|
);
|
|
8321
8209
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
8322
8210
|
else console.log(`Updated MCP server ${updated.name}`);
|
|
@@ -8541,11 +8429,11 @@ var TERMINAL = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
|
|
|
8541
8429
|
function basePath(org) {
|
|
8542
8430
|
return `/api/v1/orgs/${encodeURIComponent(org)}/optimizations`;
|
|
8543
8431
|
}
|
|
8544
|
-
function itemPath(org,
|
|
8545
|
-
return `${basePath(org)}/${encodeURIComponent(
|
|
8432
|
+
function itemPath(org, id2) {
|
|
8433
|
+
return `${basePath(org)}/${encodeURIComponent(id2)}`;
|
|
8546
8434
|
}
|
|
8547
|
-
function trialPath(org,
|
|
8548
|
-
return `${itemPath(org,
|
|
8435
|
+
function trialPath(org, id2, trialId) {
|
|
8436
|
+
return `${itemPath(org, id2)}/trials/${encodeURIComponent(trialId)}`;
|
|
8549
8437
|
}
|
|
8550
8438
|
var FAILED_RUN = /* @__PURE__ */ new Set(["FAILED", "TIMED_OUT"]);
|
|
8551
8439
|
function readText(path3) {
|
|
@@ -8571,13 +8459,13 @@ function parseTarget(raw) {
|
|
|
8571
8459
|
);
|
|
8572
8460
|
return spec.models.length ? { agent: spec.agent, model: spec.models[0] } : { agent: spec.agent };
|
|
8573
8461
|
}
|
|
8574
|
-
function parseCount(raw,
|
|
8462
|
+
function parseCount(raw, flag2, max = 100) {
|
|
8575
8463
|
if (raw === void 0) return void 0;
|
|
8576
8464
|
const n = Number(raw);
|
|
8577
8465
|
if (!Number.isInteger(n) || n < 1 || n > max)
|
|
8578
8466
|
throw new CliError(
|
|
8579
8467
|
"usage",
|
|
8580
|
-
`${
|
|
8468
|
+
`${flag2} must be a positive integer no greater than ${max}`
|
|
8581
8469
|
);
|
|
8582
8470
|
return n;
|
|
8583
8471
|
}
|
|
@@ -8687,9 +8575,9 @@ function trialBodyFromOpts(opts, read2 = readText, walk) {
|
|
|
8687
8575
|
"the trial file must contain an object or a non-empty array of objects"
|
|
8688
8576
|
);
|
|
8689
8577
|
const record2 = chosen;
|
|
8690
|
-
const
|
|
8578
|
+
const body2 = "trial" in record2 ? record2 : { trial: record2 };
|
|
8691
8579
|
return {
|
|
8692
|
-
...
|
|
8580
|
+
...body2,
|
|
8693
8581
|
...fork ? { fork } : {},
|
|
8694
8582
|
...idempotencyKey ? { idempotencyKey } : {},
|
|
8695
8583
|
launch
|
|
@@ -8853,8 +8741,8 @@ function printDetail3(o) {
|
|
|
8853
8741
|
console.log(`round ${round.number}: ${round.narrative}`);
|
|
8854
8742
|
for (const line of trials.flatMap(trialWarnings)) console.error(line);
|
|
8855
8743
|
}
|
|
8856
|
-
function runDetails(
|
|
8857
|
-
return `(details: \`gauge runs get ${
|
|
8744
|
+
function runDetails(id2) {
|
|
8745
|
+
return `(details: \`gauge runs get ${id2}\`, \`gauge runs logs ${id2}\`)`;
|
|
8858
8746
|
}
|
|
8859
8747
|
function trialWarnings(t) {
|
|
8860
8748
|
const total = `${t.runs.length} session${t.runs.length === 1 ? "" : "s"}`;
|
|
@@ -8976,9 +8864,9 @@ function register19(program2) {
|
|
|
8976
8864
|
else printItems(res.items.map(toRow3), "table");
|
|
8977
8865
|
}
|
|
8978
8866
|
);
|
|
8979
|
-
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) => {
|
|
8980
8868
|
const org = resolveOrg(cmd);
|
|
8981
|
-
const detail = await createClient().get(itemPath(org,
|
|
8869
|
+
const detail = await createClient().get(itemPath(org, id2));
|
|
8982
8870
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8983
8871
|
else printDetail3(detail);
|
|
8984
8872
|
});
|
|
@@ -9027,14 +8915,14 @@ function register19(program2) {
|
|
|
9027
8915
|
}
|
|
9028
8916
|
}
|
|
9029
8917
|
);
|
|
9030
|
-
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) => {
|
|
9031
8919
|
const org = resolveOrg(cmd);
|
|
9032
8920
|
await confirmOrAbort(
|
|
9033
|
-
`Cancel optimization ${
|
|
8921
|
+
`Cancel optimization ${id2}? In-flight sessions stop; completed usage remains billed.`,
|
|
9034
8922
|
opts.yes
|
|
9035
8923
|
);
|
|
9036
8924
|
const detail = await createClient().post(
|
|
9037
|
-
`${itemPath(org,
|
|
8925
|
+
`${itemPath(org, id2)}/cancel`,
|
|
9038
8926
|
{}
|
|
9039
8927
|
);
|
|
9040
8928
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -9067,17 +8955,17 @@ function register19(program2) {
|
|
|
9067
8955
|
"--file <path>",
|
|
9068
8956
|
"PATCH body JSON (name, direction, target); '-' for stdin"
|
|
9069
8957
|
).action(
|
|
9070
|
-
async (
|
|
9071
|
-
const
|
|
8958
|
+
async (id2, opts, cmd) => {
|
|
8959
|
+
const body2 = {
|
|
9072
8960
|
...opts.file ? readObject(opts.file) : {},
|
|
9073
8961
|
...targetFromOpts(opts),
|
|
9074
8962
|
...opts.name ? { name: opts.name } : {}
|
|
9075
8963
|
};
|
|
9076
|
-
if (!Object.keys(
|
|
8964
|
+
if (!Object.keys(body2).length)
|
|
9077
8965
|
throw new CliError("usage", "pass --target, --name, or --file");
|
|
9078
8966
|
const detail = await createClient().patch(
|
|
9079
|
-
itemPath(resolveOrg(cmd),
|
|
9080
|
-
|
|
8967
|
+
itemPath(resolveOrg(cmd), id2),
|
|
8968
|
+
body2
|
|
9081
8969
|
);
|
|
9082
8970
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
9083
8971
|
else printDetail3(detail);
|
|
@@ -9086,11 +8974,11 @@ function register19(program2) {
|
|
|
9086
8974
|
addTargetOption(
|
|
9087
8975
|
group.command("start-draft <id>").description("Start an existing draft's baseline (spends credits)")
|
|
9088
8976
|
).option("--name <name>", "optimization name").option("--yes", "skip the confirmation").action(
|
|
9089
|
-
async (
|
|
8977
|
+
async (id2, opts, cmd) => {
|
|
9090
8978
|
const org = resolveOrg(cmd);
|
|
9091
8979
|
const client = createClient();
|
|
9092
8980
|
const plan = targetFromOpts(opts);
|
|
9093
|
-
const current = await client.get(itemPath(org,
|
|
8981
|
+
const current = await client.get(itemPath(org, id2));
|
|
9094
8982
|
if (current.status !== "DRAFT")
|
|
9095
8983
|
throw new CliError(
|
|
9096
8984
|
"usage",
|
|
@@ -9102,10 +8990,10 @@ function register19(program2) {
|
|
|
9102
8990
|
"--target is required until the draft has an agent/model"
|
|
9103
8991
|
);
|
|
9104
8992
|
await confirmOrAbort(
|
|
9105
|
-
`Start the baseline for ${
|
|
8993
|
+
`Start the baseline for ${id2}? It spends credits now.`,
|
|
9106
8994
|
opts.yes
|
|
9107
8995
|
);
|
|
9108
|
-
const detail = await client.post(`${itemPath(org,
|
|
8996
|
+
const detail = await client.post(`${itemPath(org, id2)}/start`, {
|
|
9109
8997
|
...plan,
|
|
9110
8998
|
name: opts.name
|
|
9111
8999
|
});
|
|
@@ -9115,13 +9003,13 @@ function register19(program2) {
|
|
|
9115
9003
|
);
|
|
9116
9004
|
group.command("launch <id>").description(
|
|
9117
9005
|
"Launch all saved trials in the current round (spends credits)"
|
|
9118
|
-
).option("--yes", "skip the confirmation").action(async (
|
|
9006
|
+
).option("--yes", "skip the confirmation").action(async (id2, opts, cmd) => {
|
|
9119
9007
|
await confirmOrAbort(
|
|
9120
|
-
`Launch the current round of ${
|
|
9008
|
+
`Launch the current round of ${id2}? Spends credits.`,
|
|
9121
9009
|
opts.yes
|
|
9122
9010
|
);
|
|
9123
9011
|
const result = await createClient().post(
|
|
9124
|
-
`${itemPath(resolveOrg(cmd),
|
|
9012
|
+
`${itemPath(resolveOrg(cmd), id2)}/rounds/current/launch`,
|
|
9125
9013
|
{}
|
|
9126
9014
|
);
|
|
9127
9015
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -9132,21 +9020,21 @@ function register19(program2) {
|
|
|
9132
9020
|
});
|
|
9133
9021
|
group.command("continue <id>").description(
|
|
9134
9022
|
"Reopen a finished optimization for another round against its fixed baseline"
|
|
9135
|
-
).option("--yes", "skip the confirmation").action(async (
|
|
9023
|
+
).option("--yes", "skip the confirmation").action(async (id2, opts, cmd) => {
|
|
9136
9024
|
await confirmOrAbort(
|
|
9137
|
-
`Reopen ${
|
|
9025
|
+
`Reopen ${id2} for another round? Saved trials still require launch.`,
|
|
9138
9026
|
opts.yes
|
|
9139
9027
|
);
|
|
9140
9028
|
const detail = await createClient().post(
|
|
9141
|
-
`${itemPath(resolveOrg(cmd),
|
|
9029
|
+
`${itemPath(resolveOrg(cmd), id2)}/continue`,
|
|
9142
9030
|
{}
|
|
9143
9031
|
);
|
|
9144
9032
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
9145
9033
|
else printDetail3(detail);
|
|
9146
9034
|
});
|
|
9147
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(
|
|
9148
|
-
async (
|
|
9149
|
-
const res = await createClient().get(`${itemPath(resolveOrg(cmd),
|
|
9036
|
+
async (id2, opts, cmd) => {
|
|
9037
|
+
const res = await createClient().get(`${itemPath(resolveOrg(cmd), id2)}/activity`, {
|
|
9150
9038
|
after: opts.after,
|
|
9151
9039
|
limit: parseCount(opts.limit, "--limit", 500)
|
|
9152
9040
|
});
|
|
@@ -9163,32 +9051,32 @@ function register19(program2) {
|
|
|
9163
9051
|
);
|
|
9164
9052
|
}
|
|
9165
9053
|
);
|
|
9166
|
-
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) => {
|
|
9167
9055
|
const res = await createClient().post(
|
|
9168
|
-
`${itemPath(resolveOrg(cmd),
|
|
9056
|
+
`${itemPath(resolveOrg(cmd), id2)}/chat`,
|
|
9169
9057
|
{}
|
|
9170
9058
|
);
|
|
9171
9059
|
if (resolveOutput(cmd) === "json") printJson(res);
|
|
9172
9060
|
else console.log(res.href);
|
|
9173
9061
|
});
|
|
9174
|
-
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) => {
|
|
9175
9063
|
await confirmOrAbort(
|
|
9176
|
-
`Delete optimization ${
|
|
9064
|
+
`Delete optimization ${id2}, its rounds, trials, and activity? Session history is kept.`,
|
|
9177
9065
|
opts.yes
|
|
9178
9066
|
);
|
|
9179
|
-
await createClient().delete(itemPath(resolveOrg(cmd),
|
|
9180
|
-
if (resolveOutput(cmd) === "json") printJson({ deleted:
|
|
9181
|
-
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}.`);
|
|
9182
9070
|
});
|
|
9183
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(
|
|
9184
|
-
async (
|
|
9072
|
+
async (id2, opts, cmd) => {
|
|
9185
9073
|
const org = resolveOrg(cmd);
|
|
9186
9074
|
await confirmOrAbort(
|
|
9187
|
-
`Complete optimization ${
|
|
9075
|
+
`Complete optimization ${id2}? No further rounds run; unspent credits are released.`,
|
|
9188
9076
|
opts.yes
|
|
9189
9077
|
);
|
|
9190
9078
|
const detail = await createClient().post(
|
|
9191
|
-
`${itemPath(org,
|
|
9079
|
+
`${itemPath(org, id2)}/complete`,
|
|
9192
9080
|
opts.adopt ? { adoptTrialId: opts.adopt } : {}
|
|
9193
9081
|
);
|
|
9194
9082
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -9199,7 +9087,7 @@ function register19(program2) {
|
|
|
9199
9087
|
group.command("watch <id>").description(
|
|
9200
9088
|
`Follow until finished or awaiting input (exit ${NEEDS_INPUT_EXIT} when it needs you); --follow keeps waiting`
|
|
9201
9089
|
).option("--interval <seconds>", "poll interval (default 15)").option("--follow", "keep polling while awaiting authoring or launch").action(
|
|
9202
|
-
async (
|
|
9090
|
+
async (id2, opts, cmd) => {
|
|
9203
9091
|
const org = resolveOrg(cmd);
|
|
9204
9092
|
const client = createClient();
|
|
9205
9093
|
const interval = Number(opts.interval ?? 15);
|
|
@@ -9211,7 +9099,7 @@ function register19(program2) {
|
|
|
9211
9099
|
const intervalMs = Math.max(interval * 1e3, 2e3);
|
|
9212
9100
|
let last = "";
|
|
9213
9101
|
for (; ; ) {
|
|
9214
|
-
const detail = await client.get(itemPath(org,
|
|
9102
|
+
const detail = await client.get(itemPath(org, id2));
|
|
9215
9103
|
const trials2 = detail.rounds.flatMap((round2) => round2.trials);
|
|
9216
9104
|
const failed = trials2.reduce(
|
|
9217
9105
|
(sum, trial) => sum + trial.failedSessions,
|
|
@@ -9235,18 +9123,18 @@ function register19(program2) {
|
|
|
9235
9123
|
);
|
|
9236
9124
|
group.command("authoring <id>").description(
|
|
9237
9125
|
"What the next round may change: kinds, CLI targets and commands, baseline invocations, revision"
|
|
9238
|
-
).action(async (
|
|
9126
|
+
).action(async (id2, _opts, cmd) => {
|
|
9239
9127
|
printJson(
|
|
9240
|
-
await createClient().get(`${itemPath(resolveOrg(cmd),
|
|
9128
|
+
await createClient().get(`${itemPath(resolveOrg(cmd), id2)}/authoring`)
|
|
9241
9129
|
);
|
|
9242
9130
|
});
|
|
9243
9131
|
group.command("invocation <id> <invocationId>").description(
|
|
9244
9132
|
"One baseline CLI invocation from `authoring`, with its recorded command evidence"
|
|
9245
9133
|
).action(
|
|
9246
|
-
async (
|
|
9134
|
+
async (id2, invocationId, _opts, cmd) => {
|
|
9247
9135
|
printJson(
|
|
9248
9136
|
await createClient().get(
|
|
9249
|
-
`${itemPath(resolveOrg(cmd),
|
|
9137
|
+
`${itemPath(resolveOrg(cmd), id2)}/authoring/target`,
|
|
9250
9138
|
{ cliInvocationId: invocationId }
|
|
9251
9139
|
)
|
|
9252
9140
|
);
|
|
@@ -9254,10 +9142,10 @@ function register19(program2) {
|
|
|
9254
9142
|
);
|
|
9255
9143
|
group.command("cli-change <id>").description(
|
|
9256
9144
|
"Build a CLI_INTERVENTION bundle from {targetId, commandId, selector, operations, shippingIntent}; use the output as intervention.after in a round file. Saves nothing"
|
|
9257
|
-
).requiredOption("--file <path>", "the change JSON; '-' for stdin").action(async (
|
|
9145
|
+
).requiredOption("--file <path>", "the change JSON; '-' for stdin").action(async (id2, opts, cmd) => {
|
|
9258
9146
|
printJson(
|
|
9259
9147
|
await createClient().post(
|
|
9260
|
-
`${itemPath(resolveOrg(cmd),
|
|
9148
|
+
`${itemPath(resolveOrg(cmd), id2)}/cli-changes`,
|
|
9261
9149
|
readObject(opts.file)
|
|
9262
9150
|
)
|
|
9263
9151
|
);
|
|
@@ -9265,9 +9153,9 @@ function register19(program2) {
|
|
|
9265
9153
|
const round = group.command("round").description(
|
|
9266
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`"
|
|
9267
9155
|
);
|
|
9268
|
-
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) => {
|
|
9269
9157
|
const preview = await createClient().post(
|
|
9270
|
-
`${itemPath(resolveOrg(cmd),
|
|
9158
|
+
`${itemPath(resolveOrg(cmd), id2)}/rounds/current/preview`,
|
|
9271
9159
|
readObject(opts.file)
|
|
9272
9160
|
);
|
|
9273
9161
|
if (resolveOutput(cmd) === "json") printJson(preview);
|
|
@@ -9276,9 +9164,9 @@ function register19(program2) {
|
|
|
9276
9164
|
round.command("save <id>").description(
|
|
9277
9165
|
"Save a previewed round as drafts, replacing every pending draft. Never launches"
|
|
9278
9166
|
).requiredOption("--file <path>", "the round JSON you previewed").requiredOption("--digest <digest>", "previewDigest from `round preview`").action(
|
|
9279
|
-
async (
|
|
9167
|
+
async (id2, opts, cmd) => {
|
|
9280
9168
|
const result = await createClient().put(
|
|
9281
|
-
`${itemPath(resolveOrg(cmd),
|
|
9169
|
+
`${itemPath(resolveOrg(cmd), id2)}/rounds/current`,
|
|
9282
9170
|
{ ...readObject(opts.file), previewDigest: opts.digest }
|
|
9283
9171
|
);
|
|
9284
9172
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -9288,10 +9176,10 @@ function register19(program2) {
|
|
|
9288
9176
|
}
|
|
9289
9177
|
);
|
|
9290
9178
|
const trials = group.command("trials").description("List, author, and run trials");
|
|
9291
|
-
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) => {
|
|
9292
9180
|
const org = resolveOrg(cmd);
|
|
9293
9181
|
const res = await createClient().get(
|
|
9294
|
-
`${itemPath(org,
|
|
9182
|
+
`${itemPath(org, id2)}/trials`
|
|
9295
9183
|
);
|
|
9296
9184
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
9297
9185
|
else printItems(res.items.map(trialRow), "table");
|
|
@@ -9317,15 +9205,15 @@ function register19(program2) {
|
|
|
9317
9205
|
"--idempotency-key <key>",
|
|
9318
9206
|
"a retry with this key returns the first call's trial instead of a second one"
|
|
9319
9207
|
).option("--yes", "skip the confirmation").action(
|
|
9320
|
-
async (
|
|
9208
|
+
async (id2, opts, cmd) => {
|
|
9321
9209
|
const org = resolveOrg(cmd);
|
|
9322
|
-
const
|
|
9323
|
-
if (
|
|
9210
|
+
const body2 = trialBodyFromOpts(opts);
|
|
9211
|
+
if (body2.launch !== false)
|
|
9324
9212
|
await confirmOrAbort(
|
|
9325
|
-
`Run trial "${
|
|
9213
|
+
`Run trial "${body2.trial.title}" on ${id2} now? Spends credits.`,
|
|
9326
9214
|
opts.yes
|
|
9327
9215
|
);
|
|
9328
|
-
const result = await createClient().post(`${itemPath(org,
|
|
9216
|
+
const result = await createClient().post(`${itemPath(org, id2)}/trials`, body2);
|
|
9329
9217
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
9330
9218
|
else if (result.replayed)
|
|
9331
9219
|
console.log(
|
|
@@ -9341,14 +9229,14 @@ function register19(program2) {
|
|
|
9341
9229
|
printJson(trialTemplate(opts.kind));
|
|
9342
9230
|
});
|
|
9343
9231
|
trials.command("run <id> <trialId>").description("Run a draft trial now (spends credits)").option("--yes", "skip the confirmation").action(
|
|
9344
|
-
async (
|
|
9232
|
+
async (id2, trialId, opts, cmd) => {
|
|
9345
9233
|
const org = resolveOrg(cmd);
|
|
9346
9234
|
await confirmOrAbort(
|
|
9347
9235
|
`Run trial ${trialId} now? Spends credits.`,
|
|
9348
9236
|
opts.yes
|
|
9349
9237
|
);
|
|
9350
9238
|
const result = await createClient().post(
|
|
9351
|
-
`${trialPath(org,
|
|
9239
|
+
`${trialPath(org, id2, trialId)}/launch`,
|
|
9352
9240
|
{}
|
|
9353
9241
|
);
|
|
9354
9242
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -9359,30 +9247,30 @@ function register19(program2) {
|
|
|
9359
9247
|
}
|
|
9360
9248
|
);
|
|
9361
9249
|
trials.command("remove <id> <trialId>").description("Drop one draft trial from the round waiting to launch").option("--yes", "skip the confirmation").action(
|
|
9362
|
-
async (
|
|
9363
|
-
await confirmOrAbort(`Remove draft ${trialId} from ${
|
|
9250
|
+
async (id2, trialId, opts, cmd) => {
|
|
9251
|
+
await confirmOrAbort(`Remove draft ${trialId} from ${id2}?`, opts.yes);
|
|
9364
9252
|
const detail = await createClient().delete(
|
|
9365
|
-
trialPath(resolveOrg(cmd),
|
|
9253
|
+
trialPath(resolveOrg(cmd), id2, trialId)
|
|
9366
9254
|
);
|
|
9367
9255
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
9368
9256
|
else console.log(`Removed ${trialId}.`);
|
|
9369
9257
|
}
|
|
9370
9258
|
);
|
|
9371
9259
|
group.command("trial <id> <trialId>").description("One trial by id or key (B0, R1.1, \u2026) with its sessions").action(
|
|
9372
|
-
async (
|
|
9260
|
+
async (id2, trialId, _opts, cmd) => {
|
|
9373
9261
|
const org = resolveOrg(cmd);
|
|
9374
9262
|
const trial = await createClient().get(
|
|
9375
|
-
trialPath(org,
|
|
9263
|
+
trialPath(org, id2, trialId)
|
|
9376
9264
|
);
|
|
9377
9265
|
if (resolveOutput(cmd) === "json") printJson(trial);
|
|
9378
9266
|
else printTrial(trial);
|
|
9379
9267
|
}
|
|
9380
9268
|
);
|
|
9381
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(
|
|
9382
|
-
async (
|
|
9270
|
+
async (id2, trialId, opts, cmd) => {
|
|
9383
9271
|
const org = resolveOrg(cmd);
|
|
9384
9272
|
const content = await createClient().get(
|
|
9385
|
-
`${trialPath(org,
|
|
9273
|
+
`${trialPath(org, id2, trialId)}/content`
|
|
9386
9274
|
);
|
|
9387
9275
|
if (resolveOutput(cmd) === "json") printJson(content);
|
|
9388
9276
|
else if (opts.body) {
|
|
@@ -9398,14 +9286,14 @@ function register19(program2) {
|
|
|
9398
9286
|
group.command("adopt <id> <trialId>").description(
|
|
9399
9287
|
"Mark a settled trial as the winner without changing the baseline"
|
|
9400
9288
|
).option("--yes", "skip the confirmation").action(
|
|
9401
|
-
async (
|
|
9289
|
+
async (id2, trialId, opts, cmd) => {
|
|
9402
9290
|
const org = resolveOrg(cmd);
|
|
9403
9291
|
await confirmOrAbort(
|
|
9404
|
-
`Mark ${trialId} as the winner on ${
|
|
9292
|
+
`Mark ${trialId} as the winner on ${id2}?`,
|
|
9405
9293
|
opts.yes
|
|
9406
9294
|
);
|
|
9407
9295
|
const detail = await createClient().post(
|
|
9408
|
-
`${trialPath(org,
|
|
9296
|
+
`${trialPath(org, id2, trialId)}/adopt`,
|
|
9409
9297
|
{}
|
|
9410
9298
|
);
|
|
9411
9299
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -9414,9 +9302,9 @@ function register19(program2) {
|
|
|
9414
9302
|
);
|
|
9415
9303
|
group.command("handoff <id>").description(
|
|
9416
9304
|
"The instructions a coding agent follows to land the winning trial in your source, as the web app's Copy instructions for agent"
|
|
9417
|
-
).action(async (
|
|
9305
|
+
).action(async (id2, _opts, cmd) => {
|
|
9418
9306
|
const handoff = await createClient().get(
|
|
9419
|
-
`${itemPath(resolveOrg(cmd),
|
|
9307
|
+
`${itemPath(resolveOrg(cmd), id2)}/handoff`
|
|
9420
9308
|
);
|
|
9421
9309
|
if (resolveOutput(cmd) === "json") printJson(handoff);
|
|
9422
9310
|
else process.stdout.write(handoff.prompt);
|
|
@@ -9437,10 +9325,10 @@ function register19(program2) {
|
|
|
9437
9325
|
});
|
|
9438
9326
|
group.command("page <id>").description(
|
|
9439
9327
|
"The baseline body of a docs page, the base a docs-rewrite trial edits"
|
|
9440
|
-
).requiredOption("--url <url>", "the page URL").action(async (
|
|
9328
|
+
).requiredOption("--url <url>", "the page URL").action(async (id2, opts, cmd) => {
|
|
9441
9329
|
const org = resolveOrg(cmd);
|
|
9442
9330
|
const res = await createClient().get(
|
|
9443
|
-
`${itemPath(org,
|
|
9331
|
+
`${itemPath(org, id2)}/page`,
|
|
9444
9332
|
{ url: opts.url }
|
|
9445
9333
|
);
|
|
9446
9334
|
if (resolveOutput(cmd) === "json") printJson(res);
|
|
@@ -9581,10 +9469,10 @@ function register22(program2) {
|
|
|
9581
9469
|
"table"
|
|
9582
9470
|
);
|
|
9583
9471
|
});
|
|
9584
|
-
group.command("get <id>").description("Show one persona").action(async (
|
|
9472
|
+
group.command("get <id>").description("Show one persona").action(async (id2, _opts, cmd) => {
|
|
9585
9473
|
const org = resolveOrg(cmd);
|
|
9586
9474
|
const persona = await createClient().get(
|
|
9587
|
-
`${personasPath(org)}/${encodeURIComponent(
|
|
9475
|
+
`${personasPath(org)}/${encodeURIComponent(id2)}`
|
|
9588
9476
|
);
|
|
9589
9477
|
if (resolveOutput(cmd) === "json") {
|
|
9590
9478
|
printJson(persona);
|
|
@@ -9610,12 +9498,12 @@ function register22(program2) {
|
|
|
9610
9498
|
}
|
|
9611
9499
|
);
|
|
9612
9500
|
group.command("edit <id>").description("Update a persona").option("--name <name>", "rename the persona").option("--description <text>", "replace the notes").action(
|
|
9613
|
-
async (
|
|
9501
|
+
async (id2, opts, cmd) => {
|
|
9614
9502
|
const org = resolveOrg(cmd);
|
|
9615
9503
|
if (opts.name === void 0 && opts.description === void 0)
|
|
9616
9504
|
throw new CliError("usage", "nothing to change");
|
|
9617
9505
|
const updated = await createClient().patch(
|
|
9618
|
-
`${personasPath(org)}/${encodeURIComponent(
|
|
9506
|
+
`${personasPath(org)}/${encodeURIComponent(id2)}`,
|
|
9619
9507
|
{ name: opts.name, description: opts.description }
|
|
9620
9508
|
);
|
|
9621
9509
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
@@ -9624,12 +9512,12 @@ function register22(program2) {
|
|
|
9624
9512
|
);
|
|
9625
9513
|
group.command("rm <id>").description(
|
|
9626
9514
|
"Delete a persona (run configurations fall back to the default persona)"
|
|
9627
|
-
).action(async (
|
|
9515
|
+
).action(async (id2, _opts, cmd) => {
|
|
9628
9516
|
const org = resolveOrg(cmd);
|
|
9629
9517
|
await createClient().delete(
|
|
9630
|
-
`${personasPath(org)}/${encodeURIComponent(
|
|
9518
|
+
`${personasPath(org)}/${encodeURIComponent(id2)}`
|
|
9631
9519
|
);
|
|
9632
|
-
if (resolveOutput(cmd) !== "json") console.log(`Deleted persona ${
|
|
9520
|
+
if (resolveOutput(cmd) !== "json") console.log(`Deleted persona ${id2}`);
|
|
9633
9521
|
});
|
|
9634
9522
|
}
|
|
9635
9523
|
|
|
@@ -9941,15 +9829,15 @@ function register24(program2) {
|
|
|
9941
9829
|
);
|
|
9942
9830
|
if (opts.tag.length > 0 && opts.clearTags)
|
|
9943
9831
|
throw new CliError("usage", "--tag and --clear-tags conflict");
|
|
9944
|
-
const
|
|
9945
|
-
if (opts.name !== void 0)
|
|
9946
|
-
if (opts.clearFrameworks)
|
|
9947
|
-
else if (opts.framework.length > 0)
|
|
9948
|
-
if (opts.clearTags)
|
|
9949
|
-
else if (opts.tag.length > 0)
|
|
9950
|
-
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)
|
|
9951
9839
|
throw new CliError("usage", "nothing to change");
|
|
9952
|
-
const repo = await createClient().patch(reposPath(org),
|
|
9840
|
+
const repo = await createClient().patch(reposPath(org), body2);
|
|
9953
9841
|
if (resolveOutput(command) === "json") printJson(repo);
|
|
9954
9842
|
else console.log(`Updated ${repo.name} (${repo.url})`);
|
|
9955
9843
|
}
|
|
@@ -9988,15 +9876,15 @@ __export(runRequests_exports2, {
|
|
|
9988
9876
|
});
|
|
9989
9877
|
var pollIntervalMs = 5e3;
|
|
9990
9878
|
function register25(program2) {
|
|
9991
|
-
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) => {
|
|
9992
9880
|
const org = resolveOrg(cmd);
|
|
9993
|
-
const path3 = `/api/v1/orgs/${encodeURIComponent(org)}/run-requests/${encodeURIComponent(
|
|
9881
|
+
const path3 = `/api/v1/orgs/${encodeURIComponent(org)}/run-requests/${encodeURIComponent(id2)}`;
|
|
9994
9882
|
const client = createClient();
|
|
9995
9883
|
let lastStatus = "";
|
|
9996
9884
|
while (true) {
|
|
9997
9885
|
const result = await client.get(path3);
|
|
9998
9886
|
if (resolveOutput(cmd) !== "json" && result.status !== lastStatus) {
|
|
9999
|
-
console.error(`Run request ${
|
|
9887
|
+
console.error(`Run request ${id2}: ${result.status}`);
|
|
10000
9888
|
lastStatus = result.status;
|
|
10001
9889
|
}
|
|
10002
9890
|
if (result.settled) {
|
|
@@ -10017,7 +9905,7 @@ function register25(program2) {
|
|
|
10017
9905
|
if (result.result !== "PASSED" && result.result !== "MEASURED")
|
|
10018
9906
|
throw new CliError(
|
|
10019
9907
|
"internal",
|
|
10020
|
-
`Run request ${
|
|
9908
|
+
`Run request ${id2}: ${result.result}`
|
|
10021
9909
|
);
|
|
10022
9910
|
return;
|
|
10023
9911
|
}
|
|
@@ -10031,11 +9919,11 @@ var runs_exports2 = {};
|
|
|
10031
9919
|
__export(runs_exports2, {
|
|
10032
9920
|
register: () => register26
|
|
10033
9921
|
});
|
|
10034
|
-
function runPath(
|
|
10035
|
-
return `/api/v1/runs/${encodeURIComponent(
|
|
9922
|
+
function runPath(id2) {
|
|
9923
|
+
return `/api/v1/runs/${encodeURIComponent(id2)}`;
|
|
10036
9924
|
}
|
|
10037
|
-
function streamPath(
|
|
10038
|
-
return `/api/runs/${encodeURIComponent(
|
|
9925
|
+
function streamPath(id2) {
|
|
9926
|
+
return `/api/runs/${encodeURIComponent(id2)}/stream`;
|
|
10039
9927
|
}
|
|
10040
9928
|
function fmtDuration(ms) {
|
|
10041
9929
|
if (ms == null) return "";
|
|
@@ -10230,7 +10118,7 @@ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
|
10230
10118
|
]);
|
|
10231
10119
|
var STATUS_POLL_MS = 5e3;
|
|
10232
10120
|
var TERMINAL_DRAIN_MS = 2e3;
|
|
10233
|
-
async function streamRun(
|
|
10121
|
+
async function streamRun(id2, json, opts) {
|
|
10234
10122
|
const client = createClient();
|
|
10235
10123
|
const controller = new AbortController();
|
|
10236
10124
|
let timer;
|
|
@@ -10248,7 +10136,7 @@ async function streamRun(id, json, opts) {
|
|
|
10248
10136
|
poller = setInterval(() => {
|
|
10249
10137
|
if (inFlight || drainTimer) return;
|
|
10250
10138
|
inFlight = true;
|
|
10251
|
-
client.get(runPath(
|
|
10139
|
+
client.get(runPath(id2)).then((run) => {
|
|
10252
10140
|
if (drainTimer || !TERMINAL_STATUSES.has(run.status)) return;
|
|
10253
10141
|
if (poller) clearInterval(poller);
|
|
10254
10142
|
drainTimer = setTimeout(() => {
|
|
@@ -10265,7 +10153,7 @@ async function streamRun(id, json, opts) {
|
|
|
10265
10153
|
}
|
|
10266
10154
|
try {
|
|
10267
10155
|
await client.sse(
|
|
10268
|
-
streamPath(
|
|
10156
|
+
streamPath(id2),
|
|
10269
10157
|
(frame) => {
|
|
10270
10158
|
const event = parseEvent(frame.data);
|
|
10271
10159
|
if (!event) return;
|
|
@@ -10330,8 +10218,8 @@ function register26(program2) {
|
|
|
10330
10218
|
);
|
|
10331
10219
|
runs.command("get <id>").description(
|
|
10332
10220
|
"Show a run (status, trigger source, cost, credits, turns, exit reason)"
|
|
10333
|
-
).action(async (
|
|
10334
|
-
const run = await createClient().get(runPath(
|
|
10221
|
+
).action(async (id2, _opts, command) => {
|
|
10222
|
+
const run = await createClient().get(runPath(id2));
|
|
10335
10223
|
if (resolveOutput(command) === "json") {
|
|
10336
10224
|
printJson(run);
|
|
10337
10225
|
return;
|
|
@@ -10342,9 +10230,9 @@ function register26(program2) {
|
|
|
10342
10230
|
console.log(`${label.padEnd(width)} ${value}`);
|
|
10343
10231
|
}
|
|
10344
10232
|
});
|
|
10345
|
-
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) => {
|
|
10346
10234
|
const insight = await createClient().get(
|
|
10347
|
-
`${runPath(
|
|
10235
|
+
`${runPath(id2)}/insight`
|
|
10348
10236
|
);
|
|
10349
10237
|
if (resolveOutput(command) === "json") {
|
|
10350
10238
|
printJson(insight);
|
|
@@ -10354,9 +10242,9 @@ function register26(program2) {
|
|
|
10354
10242
|
});
|
|
10355
10243
|
runs.command("regrade <id>").description(
|
|
10356
10244
|
"Re-judge the run against its eval set's current criteria (no new session)"
|
|
10357
|
-
).action(async (
|
|
10245
|
+
).action(async (id2, _opts, command) => {
|
|
10358
10246
|
const result = await createClient().post(
|
|
10359
|
-
`${runPath(
|
|
10247
|
+
`${runPath(id2)}/regrade`
|
|
10360
10248
|
);
|
|
10361
10249
|
if (resolveOutput(command) === "json") {
|
|
10362
10250
|
printJson(result);
|
|
@@ -10369,31 +10257,31 @@ function register26(program2) {
|
|
|
10369
10257
|
});
|
|
10370
10258
|
runs.command("watch <id>").description(
|
|
10371
10259
|
"Stream normalized trace events live (SSE; exits when the run finishes)"
|
|
10372
|
-
).action(async (
|
|
10373
|
-
await streamRun(
|
|
10260
|
+
).action(async (id2, _opts, command) => {
|
|
10261
|
+
await streamRun(id2, resolveOutput(command) === "json", {
|
|
10374
10262
|
idleMs: 0,
|
|
10375
10263
|
firstEventMs: 0,
|
|
10376
10264
|
pollStatus: true
|
|
10377
10265
|
});
|
|
10378
10266
|
});
|
|
10379
|
-
runs.command("logs <id>").description("Dump the run's trace events so far, then exit (non-follow)").action(async (
|
|
10380
|
-
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", {
|
|
10381
10269
|
idleMs: 2e3,
|
|
10382
10270
|
firstEventMs: 15e3,
|
|
10383
10271
|
stopAtLiveMs: Date.now() - 2e3
|
|
10384
10272
|
});
|
|
10385
10273
|
});
|
|
10386
|
-
runs.command("diff <id>").description("Print the run's working-tree diff to stdout").action(async (
|
|
10387
|
-
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`);
|
|
10388
10276
|
if (!diff) {
|
|
10389
10277
|
console.error("(no diff)");
|
|
10390
10278
|
return;
|
|
10391
10279
|
}
|
|
10392
10280
|
process.stdout.write(diff);
|
|
10393
10281
|
});
|
|
10394
|
-
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) => {
|
|
10395
10283
|
const result = await createClient().post(
|
|
10396
|
-
`${runPath(
|
|
10284
|
+
`${runPath(id2)}/fork`,
|
|
10397
10285
|
{ prompt: opts.prompt }
|
|
10398
10286
|
);
|
|
10399
10287
|
if (resolveOutput(command) === "json") {
|
|
@@ -10407,9 +10295,9 @@ function register26(program2) {
|
|
|
10407
10295
|
});
|
|
10408
10296
|
runs.command("fork-boundaries <id>").description(
|
|
10409
10297
|
"The run's forkable fetch boundaries + checkpoint availability"
|
|
10410
|
-
).action(async (
|
|
10298
|
+
).action(async (id2) => {
|
|
10411
10299
|
const result = await createClient().get(
|
|
10412
|
-
`${runPath(
|
|
10300
|
+
`${runPath(id2)}/fork-boundaries`
|
|
10413
10301
|
);
|
|
10414
10302
|
printJson(result);
|
|
10415
10303
|
});
|
|
@@ -10419,9 +10307,9 @@ function register26(program2) {
|
|
|
10419
10307
|
);
|
|
10420
10308
|
printJson(result);
|
|
10421
10309
|
});
|
|
10422
|
-
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) => {
|
|
10423
10311
|
const result = await createClient().post(
|
|
10424
|
-
`${runPath(
|
|
10312
|
+
`${runPath(id2)}/cancel`
|
|
10425
10313
|
);
|
|
10426
10314
|
if (resolveOutput(command) === "json") {
|
|
10427
10315
|
printJson(result);
|
|
@@ -10464,11 +10352,11 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
|
10464
10352
|
throw new CliError("usage", "--auto-ingest expects true or false");
|
|
10465
10353
|
autoIngest = opts.autoIngest === "true";
|
|
10466
10354
|
}
|
|
10467
|
-
const
|
|
10468
|
-
if (opts.rename !== void 0)
|
|
10469
|
-
if (opts.clearNote)
|
|
10470
|
-
else if (opts.note !== void 0)
|
|
10471
|
-
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;
|
|
10472
10360
|
else if (opts.source !== void 0) {
|
|
10473
10361
|
const m = opts.source.match(/^([^#]+\/[^#/]+)#([^/]+)(?:\/(.+))?$/);
|
|
10474
10362
|
if (!m)
|
|
@@ -10476,7 +10364,7 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
|
10476
10364
|
"usage",
|
|
10477
10365
|
'invalid --source (expected "owner/repo#branch" or "owner/repo#branch/subpath")'
|
|
10478
10366
|
);
|
|
10479
|
-
|
|
10367
|
+
body2.source = {
|
|
10480
10368
|
repoFullName: m[1],
|
|
10481
10369
|
ref: m[2],
|
|
10482
10370
|
subpath: m[3],
|
|
@@ -10489,16 +10377,16 @@ async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
|
10489
10377
|
"usage",
|
|
10490
10378
|
"this skill has no tracked source \u2014 set one first with --source owner/repo#branch"
|
|
10491
10379
|
);
|
|
10492
|
-
|
|
10380
|
+
body2.source = {
|
|
10493
10381
|
repoFullName: current.repoFullName,
|
|
10494
10382
|
ref: current.ref,
|
|
10495
10383
|
subpath: current.subpath || void 0,
|
|
10496
10384
|
autoIngest
|
|
10497
10385
|
};
|
|
10498
10386
|
}
|
|
10499
|
-
if (Object.keys(
|
|
10387
|
+
if (Object.keys(body2).length === 0)
|
|
10500
10388
|
throw new CliError("usage", "nothing to change");
|
|
10501
|
-
return
|
|
10389
|
+
return body2;
|
|
10502
10390
|
}
|
|
10503
10391
|
function register27(program2) {
|
|
10504
10392
|
const group = program2.command("skills").description("Manage agent skills used by eval and visibility runs");
|
|
@@ -10580,13 +10468,13 @@ function register27(program2) {
|
|
|
10580
10468
|
).action(async (ref, opts, cmd) => {
|
|
10581
10469
|
const org = resolveOrg(cmd);
|
|
10582
10470
|
const client = createClient();
|
|
10583
|
-
const
|
|
10471
|
+
const body2 = await buildSkillEditBody(opts, async () => {
|
|
10584
10472
|
const skill2 = await client.get(skillPath(org, ref));
|
|
10585
10473
|
return skill2.source;
|
|
10586
10474
|
});
|
|
10587
10475
|
const updated = await client.patch(
|
|
10588
10476
|
skillPath(org, ref),
|
|
10589
|
-
|
|
10477
|
+
body2
|
|
10590
10478
|
);
|
|
10591
10479
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
10592
10480
|
else console.log(`Updated skill ${updated.name}`);
|
|
@@ -11050,10 +10938,10 @@ function registerPreferenceGroup(group) {
|
|
|
11050
10938
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
11051
10939
|
else printItems(res.items.map(toRow6), "table");
|
|
11052
10940
|
});
|
|
11053
|
-
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) => {
|
|
11054
10942
|
const org = resolveOrg(cmd);
|
|
11055
10943
|
const vp = await createClient().get(
|
|
11056
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
10944
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`
|
|
11057
10945
|
);
|
|
11058
10946
|
if (resolveOutput(cmd) === "json") printJson(vp);
|
|
11059
10947
|
else printDetail4(vp);
|
|
@@ -11079,7 +10967,7 @@ function registerPreferenceGroup(group) {
|
|
|
11079
10967
|
if (opts.ref !== void 0 && opts.repo === void 0)
|
|
11080
10968
|
throw new CliError("usage", "--ref requires --repo");
|
|
11081
10969
|
const hasScenario = opts.repo !== void 0 || opts.persona !== void 0;
|
|
11082
|
-
const
|
|
10970
|
+
const body2 = {
|
|
11083
10971
|
name: opts.name,
|
|
11084
10972
|
promptText: readPromptText(opts),
|
|
11085
10973
|
kind: parseKind(opts.kind),
|
|
@@ -11099,7 +10987,7 @@ function registerPreferenceGroup(group) {
|
|
|
11099
10987
|
};
|
|
11100
10988
|
const created = await createClient().post(
|
|
11101
10989
|
visibilityPath(org),
|
|
11102
|
-
|
|
10990
|
+
body2
|
|
11103
10991
|
);
|
|
11104
10992
|
if (resolveOutput(cmd) === "json") printJson(created);
|
|
11105
10993
|
else console.log(`Created preference prompt ${created.id}`);
|
|
@@ -11118,51 +11006,51 @@ function registerPreferenceGroup(group) {
|
|
|
11118
11006
|
[]
|
|
11119
11007
|
).option("--clear-tags", "remove all user tags")
|
|
11120
11008
|
).action(
|
|
11121
|
-
async (
|
|
11009
|
+
async (id2, opts, cmd) => {
|
|
11122
11010
|
const org = resolveOrg(cmd);
|
|
11123
|
-
const
|
|
11011
|
+
const body2 = {
|
|
11124
11012
|
...runSettingsPatchFromOpts(opts)
|
|
11125
11013
|
};
|
|
11126
|
-
if (opts.name !== void 0)
|
|
11014
|
+
if (opts.name !== void 0) body2.name = opts.name;
|
|
11127
11015
|
if (opts.text !== void 0 || opts.file !== void 0)
|
|
11128
|
-
|
|
11129
|
-
if (opts.brandA !== void 0)
|
|
11130
|
-
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;
|
|
11131
11019
|
if (opts.branded && opts.organic)
|
|
11132
11020
|
throw new CliError("usage", "--branded and --organic conflict");
|
|
11133
|
-
if (opts.branded)
|
|
11134
|
-
else if (opts.organic)
|
|
11021
|
+
if (opts.branded) body2.branded = true;
|
|
11022
|
+
else if (opts.organic) body2.branded = false;
|
|
11135
11023
|
if (opts.market !== void 0 && opts.clearMarket)
|
|
11136
11024
|
throw new CliError("usage", "--market and --clear-market conflict");
|
|
11137
|
-
if (opts.clearMarket)
|
|
11138
|
-
else if (opts.market !== void 0)
|
|
11025
|
+
if (opts.clearMarket) body2.marketId = null;
|
|
11026
|
+
else if (opts.market !== void 0) body2.marketId = opts.market;
|
|
11139
11027
|
if (opts.tag.length > 0 && opts.clearTags)
|
|
11140
11028
|
throw new CliError("usage", "--tag and --clear-tags conflict");
|
|
11141
|
-
if (opts.clearTags)
|
|
11142
|
-
else if (opts.tag.length > 0)
|
|
11143
|
-
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)
|
|
11144
11032
|
throw new CliError("usage", "nothing to change");
|
|
11145
11033
|
const updated = await createClient().patch(
|
|
11146
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11147
|
-
|
|
11034
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`,
|
|
11035
|
+
body2
|
|
11148
11036
|
);
|
|
11149
11037
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
11150
11038
|
else console.log(`Updated preference prompt ${updated.id}`);
|
|
11151
11039
|
}
|
|
11152
11040
|
);
|
|
11153
|
-
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) => {
|
|
11154
11042
|
const org = resolveOrg(cmd);
|
|
11155
11043
|
await createClient().delete(
|
|
11156
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11044
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`
|
|
11157
11045
|
);
|
|
11158
11046
|
if (resolveOutput(cmd) !== "json")
|
|
11159
|
-
console.log(`Deleted preference prompt ${
|
|
11047
|
+
console.log(`Deleted preference prompt ${id2}`);
|
|
11160
11048
|
});
|
|
11161
11049
|
const scenarios = group.command("scenarios").description("The repo \xD7 persona scenarios a preference prompt runs in");
|
|
11162
|
-
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) => {
|
|
11163
11051
|
const org = resolveOrg(cmd);
|
|
11164
11052
|
const vp = await createClient().get(
|
|
11165
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11053
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`
|
|
11166
11054
|
);
|
|
11167
11055
|
if (resolveOutput(cmd) === "json") printJson(vp.scenarios);
|
|
11168
11056
|
else printItems(vp.scenarios.map(scenarioRow), "table");
|
|
@@ -11171,12 +11059,12 @@ function registerPreferenceGroup(group) {
|
|
|
11171
11059
|
"--persona <profileId>",
|
|
11172
11060
|
"persona profile id (default persona if omitted)"
|
|
11173
11061
|
).action(
|
|
11174
|
-
async (
|
|
11062
|
+
async (id2, opts, cmd) => {
|
|
11175
11063
|
const org = resolveOrg(cmd);
|
|
11176
11064
|
if (opts.ref !== void 0 && opts.repo === void 0)
|
|
11177
11065
|
throw new CliError("usage", "--ref requires --repo");
|
|
11178
11066
|
const created = await createClient().post(
|
|
11179
|
-
scenariosPath(org,
|
|
11067
|
+
scenariosPath(org, id2),
|
|
11180
11068
|
{
|
|
11181
11069
|
repoUrl: opts.repo ?? null,
|
|
11182
11070
|
repoRef: opts.ref ?? null,
|
|
@@ -11187,10 +11075,10 @@ function registerPreferenceGroup(group) {
|
|
|
11187
11075
|
else console.log(`Added scenario ${created.id}`);
|
|
11188
11076
|
}
|
|
11189
11077
|
);
|
|
11190
|
-
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) => {
|
|
11191
11079
|
const org = resolveOrg(cmd);
|
|
11192
11080
|
await createClient().delete(
|
|
11193
|
-
`${scenariosPath(org,
|
|
11081
|
+
`${scenariosPath(org, id2)}/${encodeURIComponent(opts.scenario)}`
|
|
11194
11082
|
);
|
|
11195
11083
|
if (resolveOutput(cmd) !== "json")
|
|
11196
11084
|
console.log(`Removed scenario ${opts.scenario}`);
|
|
@@ -11206,14 +11094,14 @@ function registerPreferenceGroup(group) {
|
|
|
11206
11094
|
"bill this run to the org's credits instead (superusers)"
|
|
11207
11095
|
).hideHelp(!staffCommandsVisible())
|
|
11208
11096
|
).option("--yes", "skip the confirmation").action(
|
|
11209
|
-
async (
|
|
11097
|
+
async (id2, opts, cmd) => {
|
|
11210
11098
|
const org = resolveOrg(cmd);
|
|
11211
11099
|
await confirmOrAbort(
|
|
11212
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?",
|
|
11213
11101
|
opts.yes
|
|
11214
11102
|
);
|
|
11215
11103
|
const result = await createClient().post(
|
|
11216
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11104
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}/run`,
|
|
11217
11105
|
{
|
|
11218
11106
|
...opts.billToOrg ? { billToOrg: true } : {},
|
|
11219
11107
|
visibilityScenarioIds: opts.scenario.length > 0 ? opts.scenario : void 0
|
|
@@ -11243,10 +11131,10 @@ function registerPreferenceGroup(group) {
|
|
|
11243
11131
|
);
|
|
11244
11132
|
});
|
|
11245
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(
|
|
11246
|
-
async (
|
|
11134
|
+
async (id2, opts, cmd) => {
|
|
11247
11135
|
const org = resolveOrg(cmd);
|
|
11248
11136
|
const res = await createClient().get(
|
|
11249
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11137
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}/runs`,
|
|
11250
11138
|
{ limit: opts.limit, cursor: opts.cursor }
|
|
11251
11139
|
);
|
|
11252
11140
|
if (resolveOutput(cmd) === "json") {
|
|
@@ -11279,7 +11167,7 @@ function registerPreferenceGroup(group) {
|
|
|
11279
11167
|
collect,
|
|
11280
11168
|
[]
|
|
11281
11169
|
).option("--clear", "remove all user tags").action(
|
|
11282
|
-
async (
|
|
11170
|
+
async (id2, opts, cmd) => {
|
|
11283
11171
|
const org = resolveOrg(cmd);
|
|
11284
11172
|
if (opts.tag.length > 0 && opts.clear)
|
|
11285
11173
|
throw new CliError("usage", "--tag and --clear conflict");
|
|
@@ -11289,7 +11177,7 @@ function registerPreferenceGroup(group) {
|
|
|
11289
11177
|
"pass --tag <name> (repeatable) or --clear"
|
|
11290
11178
|
);
|
|
11291
11179
|
const updated = await createClient().patch(
|
|
11292
|
-
`${visibilityPath(org)}/${encodeURIComponent(
|
|
11180
|
+
`${visibilityPath(org)}/${encodeURIComponent(id2)}`,
|
|
11293
11181
|
{ tags: opts.clear ? [] : opts.tag }
|
|
11294
11182
|
);
|
|
11295
11183
|
if (resolveOutput(cmd) === "json") printJson(updated);
|