@withgauge/cli 0.17.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -72
- package/dist/index.js +2092 -1597
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -577,6 +577,8 @@ var billingStatusSchema = z6.object({
|
|
|
577
577
|
holdsPerRun: workloadCreditStateSchema(z6.number()),
|
|
578
578
|
/** Can the org fund at least one more run of each workload right now. */
|
|
579
579
|
canRunByWorkload: workloadCreditStateSchema(z6.boolean()),
|
|
580
|
+
/** Invoiced subscriptions only: how far below zero the org may spend. */
|
|
581
|
+
creditLine: z6.object({ limitUsd: z6.number(), usedUsd: z6.number() }).nullable().optional(),
|
|
580
582
|
// --- Deprecated. Retained for v1 compatibility; removal needs an API-version
|
|
581
583
|
// decision. Overage is retired, so these are always inert.
|
|
582
584
|
/** @deprecated Use `currentSku.tierLabel`. */
|
|
@@ -597,7 +599,9 @@ var LEDGER_KINDS = [
|
|
|
597
599
|
"RUN_REFUND",
|
|
598
600
|
"OVERAGE_DEBIT",
|
|
599
601
|
"ADMIN_ADJUST",
|
|
600
|
-
"EXPIRY"
|
|
602
|
+
"EXPIRY",
|
|
603
|
+
"CREDIT_LINE_SETTLE",
|
|
604
|
+
"CREDIT_LINE_CARRY"
|
|
601
605
|
];
|
|
602
606
|
var ledgerKindSchema = z6.enum(LEDGER_KINDS);
|
|
603
607
|
var usageEntrySchema = z6.object({
|
|
@@ -1834,8 +1838,8 @@ var runSkillSchema = z19.discriminatedUnion("source", [
|
|
|
1834
1838
|
z19.object({
|
|
1835
1839
|
source: z19.literal("input"),
|
|
1836
1840
|
name: z19.string(),
|
|
1837
|
-
/**
|
|
1838
|
-
commit: z19.string(),
|
|
1841
|
+
/** Null when the Skill was supplied directly. */
|
|
1842
|
+
commit: z19.string().nullable(),
|
|
1839
1843
|
/** The GitHub PR that launched the run; null for API launches. */
|
|
1840
1844
|
pullNumber: z19.number().int().nullable()
|
|
1841
1845
|
})
|
|
@@ -2590,11 +2594,51 @@ var meResponseSchema = z28.object({
|
|
|
2590
2594
|
});
|
|
2591
2595
|
|
|
2592
2596
|
// ../packages/api-schemas/src/optimizations.ts
|
|
2593
|
-
import { z as
|
|
2597
|
+
import { z as z35 } from "zod";
|
|
2594
2598
|
|
|
2595
|
-
// ../packages/api-schemas/src/
|
|
2599
|
+
// ../packages/api-schemas/src/candidate-delivery.ts
|
|
2596
2600
|
import { z as z29 } from "zod";
|
|
2597
|
-
var
|
|
2601
|
+
var candidateDeliverySchema = z29.object({
|
|
2602
|
+
runId: z29.string(),
|
|
2603
|
+
attempt: z29.number().int().nonnegative(),
|
|
2604
|
+
surface: z29.enum(["docs", "cli"]),
|
|
2605
|
+
candidateDigest: z29.string(),
|
|
2606
|
+
installed: z29.boolean(),
|
|
2607
|
+
evidenceComplete: z29.boolean(),
|
|
2608
|
+
exposure: z29.enum(["exercised", "not_exercised", "unknown"]),
|
|
2609
|
+
deliveryFailures: z29.number().int().nonnegative(),
|
|
2610
|
+
observedArtifacts: z29.array(z29.string()).max(512),
|
|
2611
|
+
expectedArtifacts: z29.array(z29.string()).max(512)
|
|
2612
|
+
});
|
|
2613
|
+
|
|
2614
|
+
// ../packages/api-schemas/src/candidate-starts.ts
|
|
2615
|
+
import { z as z30 } from "zod";
|
|
2616
|
+
var slot = {
|
|
2617
|
+
configurationIndex: z30.number().int().nonnegative(),
|
|
2618
|
+
repetitionIndex: z30.number().int().nonnegative()
|
|
2619
|
+
};
|
|
2620
|
+
var candidateStartSchema = z30.discriminatedUnion("kind", [
|
|
2621
|
+
z30.object({
|
|
2622
|
+
...slot,
|
|
2623
|
+
kind: z30.literal("checkpoint"),
|
|
2624
|
+
checkpointId: z30.string().min(1)
|
|
2625
|
+
}).strict(),
|
|
2626
|
+
z30.object({
|
|
2627
|
+
...slot,
|
|
2628
|
+
kind: z30.literal("fresh"),
|
|
2629
|
+
reason: z30.string().min(1).max(1024)
|
|
2630
|
+
}).strict()
|
|
2631
|
+
]);
|
|
2632
|
+
var candidateStartsSchema = z30.array(candidateStartSchema).refine(
|
|
2633
|
+
(rows) => new Set(
|
|
2634
|
+
rows.map((row2) => `${row2.configurationIndex}:${row2.repetitionIndex}`)
|
|
2635
|
+
).size === rows.length,
|
|
2636
|
+
"Each candidate run has one starting point"
|
|
2637
|
+
);
|
|
2638
|
+
|
|
2639
|
+
// ../packages/api-schemas/src/cli-rule-evidence.ts
|
|
2640
|
+
import { z as z31 } from "zod";
|
|
2641
|
+
var cliRuleDeliverySchema = z31.enum([
|
|
2598
2642
|
"applied",
|
|
2599
2643
|
"matched_unchanged",
|
|
2600
2644
|
"not_exercised",
|
|
@@ -2602,94 +2646,94 @@ var cliRuleDeliverySchema = z29.enum([
|
|
|
2602
2646
|
"partial",
|
|
2603
2647
|
"unavailable"
|
|
2604
2648
|
]);
|
|
2605
|
-
var cliRuleInvocationResultSchema =
|
|
2606
|
-
invocationId:
|
|
2607
|
-
ruleId:
|
|
2608
|
-
engineSha256:
|
|
2609
|
-
entrypointSha256:
|
|
2610
|
-
outcome:
|
|
2611
|
-
complete:
|
|
2612
|
-
deliveryFailure:
|
|
2613
|
-
failureReason:
|
|
2614
|
-
inputs:
|
|
2615
|
-
|
|
2616
|
-
operationId:
|
|
2617
|
-
kind:
|
|
2618
|
-
key:
|
|
2619
|
-
source:
|
|
2620
|
-
sourceKey:
|
|
2621
|
-
present:
|
|
2622
|
-
sourceBytes:
|
|
2623
|
-
applied:
|
|
2624
|
-
preflight:
|
|
2625
|
-
deliveredBytes:
|
|
2626
|
-
originalStdin:
|
|
2649
|
+
var cliRuleInvocationResultSchema = z31.object({
|
|
2650
|
+
invocationId: z31.string(),
|
|
2651
|
+
ruleId: z31.string(),
|
|
2652
|
+
engineSha256: z31.string(),
|
|
2653
|
+
entrypointSha256: z31.string(),
|
|
2654
|
+
outcome: z31.number().nullable(),
|
|
2655
|
+
complete: z31.boolean(),
|
|
2656
|
+
deliveryFailure: z31.boolean().nullable(),
|
|
2657
|
+
failureReason: z31.string().nullable().optional(),
|
|
2658
|
+
inputs: z31.array(
|
|
2659
|
+
z31.object({
|
|
2660
|
+
operationId: z31.string(),
|
|
2661
|
+
kind: z31.string(),
|
|
2662
|
+
key: z31.string(),
|
|
2663
|
+
source: z31.string(),
|
|
2664
|
+
sourceKey: z31.string(),
|
|
2665
|
+
present: z31.boolean(),
|
|
2666
|
+
sourceBytes: z31.number(),
|
|
2667
|
+
applied: z31.boolean(),
|
|
2668
|
+
preflight: z31.boolean(),
|
|
2669
|
+
deliveredBytes: z31.number(),
|
|
2670
|
+
originalStdin: z31.literal("not_read")
|
|
2627
2671
|
})
|
|
2628
2672
|
).max(50).default([]),
|
|
2629
|
-
operations:
|
|
2630
|
-
|
|
2631
|
-
id:
|
|
2632
|
-
kind:
|
|
2633
|
-
count:
|
|
2673
|
+
operations: z31.array(
|
|
2674
|
+
z31.object({
|
|
2675
|
+
id: z31.string(),
|
|
2676
|
+
kind: z31.string(),
|
|
2677
|
+
count: z31.number().nullable()
|
|
2634
2678
|
})
|
|
2635
2679
|
).max(50),
|
|
2636
|
-
excerpts:
|
|
2637
|
-
|
|
2638
|
-
stream:
|
|
2639
|
-
before:
|
|
2640
|
-
after:
|
|
2641
|
-
originalBytes:
|
|
2642
|
-
deliveredBytes:
|
|
2643
|
-
omitted:
|
|
2644
|
-
redacted:
|
|
2645
|
-
beforeTruncated:
|
|
2646
|
-
afterTruncated:
|
|
2647
|
-
omissionReason:
|
|
2680
|
+
excerpts: z31.array(
|
|
2681
|
+
z31.object({
|
|
2682
|
+
stream: z31.enum(["stdout", "stderr", "combined", "stdin"]),
|
|
2683
|
+
before: z31.string().max(4096),
|
|
2684
|
+
after: z31.string().max(4096),
|
|
2685
|
+
originalBytes: z31.number().nullable(),
|
|
2686
|
+
deliveredBytes: z31.number().nullable(),
|
|
2687
|
+
omitted: z31.boolean(),
|
|
2688
|
+
redacted: z31.boolean().optional(),
|
|
2689
|
+
beforeTruncated: z31.boolean().optional(),
|
|
2690
|
+
afterTruncated: z31.boolean().optional(),
|
|
2691
|
+
omissionReason: z31.string().max(128).optional()
|
|
2648
2692
|
})
|
|
2649
2693
|
).max(4)
|
|
2650
2694
|
});
|
|
2651
|
-
var cliRuleSummarySchema =
|
|
2652
|
-
protocolVersion:
|
|
2653
|
-
bundleSha256:
|
|
2654
|
-
journalSha256:
|
|
2655
|
-
journalComplete:
|
|
2656
|
-
journalLimited:
|
|
2695
|
+
var cliRuleSummarySchema = z31.object({
|
|
2696
|
+
protocolVersion: z31.literal(3),
|
|
2697
|
+
bundleSha256: z31.string(),
|
|
2698
|
+
journalSha256: z31.string().nullable(),
|
|
2699
|
+
journalComplete: z31.boolean(),
|
|
2700
|
+
journalLimited: z31.boolean(),
|
|
2657
2701
|
delivery: cliRuleDeliverySchema,
|
|
2658
|
-
appliedInvocations:
|
|
2659
|
-
matchedInvocations:
|
|
2660
|
-
recognizedInvocations:
|
|
2661
|
-
unmatchedInvocations:
|
|
2662
|
-
unsupportedInvocations:
|
|
2663
|
-
retainedExcerptBytes:
|
|
2664
|
-
diagnostics:
|
|
2665
|
-
observations:
|
|
2666
|
-
|
|
2667
|
-
invocationId:
|
|
2668
|
-
ruleId:
|
|
2669
|
-
reason:
|
|
2670
|
-
entrypointSha256:
|
|
2671
|
-
launchForm:
|
|
2672
|
-
ioProfile:
|
|
2702
|
+
appliedInvocations: z31.number(),
|
|
2703
|
+
matchedInvocations: z31.number(),
|
|
2704
|
+
recognizedInvocations: z31.number().optional(),
|
|
2705
|
+
unmatchedInvocations: z31.number().optional(),
|
|
2706
|
+
unsupportedInvocations: z31.number(),
|
|
2707
|
+
retainedExcerptBytes: z31.number(),
|
|
2708
|
+
diagnostics: z31.array(z31.string().max(256)).max(50),
|
|
2709
|
+
observations: z31.array(
|
|
2710
|
+
z31.object({
|
|
2711
|
+
invocationId: z31.string(),
|
|
2712
|
+
ruleId: z31.string().nullable(),
|
|
2713
|
+
reason: z31.string(),
|
|
2714
|
+
entrypointSha256: z31.string().nullable(),
|
|
2715
|
+
launchForm: z31.string().nullable(),
|
|
2716
|
+
ioProfile: z31.string().nullable()
|
|
2673
2717
|
})
|
|
2674
2718
|
).max(200).optional()
|
|
2675
2719
|
});
|
|
2676
|
-
var cliRuleCoverageSchema =
|
|
2677
|
-
invocationCount:
|
|
2678
|
-
observedInvocationCount:
|
|
2679
|
-
appliedInvocationCount:
|
|
2680
|
-
incompleteCount:
|
|
2681
|
-
unsupportedCount:
|
|
2682
|
-
instrumentationFailed:
|
|
2683
|
-
unsupportedDiagnostics:
|
|
2720
|
+
var cliRuleCoverageSchema = z31.object({
|
|
2721
|
+
invocationCount: z31.number(),
|
|
2722
|
+
observedInvocationCount: z31.number().nullable(),
|
|
2723
|
+
appliedInvocationCount: z31.number(),
|
|
2724
|
+
incompleteCount: z31.number(),
|
|
2725
|
+
unsupportedCount: z31.number(),
|
|
2726
|
+
instrumentationFailed: z31.boolean(),
|
|
2727
|
+
unsupportedDiagnostics: z31.array(z31.string()),
|
|
2684
2728
|
v3: cliRuleSummarySchema,
|
|
2685
|
-
invocations:
|
|
2729
|
+
invocations: z31.array(cliRuleInvocationResultSchema).default([])
|
|
2686
2730
|
});
|
|
2687
2731
|
|
|
2688
2732
|
// ../packages/api-schemas/src/climb.ts
|
|
2689
|
-
import { z as
|
|
2733
|
+
import { z as z34 } from "zod";
|
|
2690
2734
|
|
|
2691
2735
|
// ../packages/api-schemas/src/cli-rules.ts
|
|
2692
|
-
import { z as
|
|
2736
|
+
import { z as z32 } from "zod";
|
|
2693
2737
|
|
|
2694
2738
|
// ../packages/api-schemas/src/cli-rule-arguments.ts
|
|
2695
2739
|
function parseCliRuleArguments(argv, arity) {
|
|
@@ -2752,7 +2796,7 @@ var CLI_RULE_LIMITS = {
|
|
|
2752
2796
|
};
|
|
2753
2797
|
var encoder = new TextEncoder();
|
|
2754
2798
|
var cliUtf8Bytes = (value) => encoder.encode(value).length;
|
|
2755
|
-
var text = (max, nonempty = false) =>
|
|
2799
|
+
var text = (max, nonempty = false) => z32.string().superRefine((value, ctx) => {
|
|
2756
2800
|
if (nonempty && !value.length || cliUtf8Bytes(value) > max || /\0|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(
|
|
2757
2801
|
value
|
|
2758
2802
|
))
|
|
@@ -2761,26 +2805,26 @@ var text = (max, nonempty = false) => z30.string().superRefine((value, ctx) => {
|
|
|
2761
2805
|
message: `Use valid non-NUL UTF-8 text of at most ${max} bytes${nonempty ? ", not empty" : ""}`
|
|
2762
2806
|
});
|
|
2763
2807
|
});
|
|
2764
|
-
var id =
|
|
2765
|
-
var flag =
|
|
2766
|
-
var envKey =
|
|
2808
|
+
var id = z32.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/);
|
|
2809
|
+
var flag = z32.string().regex(/^(?:-[A-Za-z0-9]|--[A-Za-z0-9][A-Za-z0-9-]{0,125})$/);
|
|
2810
|
+
var envKey = z32.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,126}$/);
|
|
2767
2811
|
var arg = text(CLI_RULE_LIMITS.argumentBytes);
|
|
2768
2812
|
var literal = text(CLI_RULE_LIMITS.literalBytes);
|
|
2769
|
-
var stream =
|
|
2770
|
-
var exit =
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
kind:
|
|
2774
|
-
value:
|
|
2813
|
+
var stream = z32.enum(["stdout", "stderr", "combined"]);
|
|
2814
|
+
var exit = z32.discriminatedUnion("kind", [
|
|
2815
|
+
z32.object({ kind: z32.literal("any") }).strict(),
|
|
2816
|
+
z32.object({
|
|
2817
|
+
kind: z32.literal("code"),
|
|
2818
|
+
value: z32.number().int().min(0).max(255)
|
|
2775
2819
|
}).strict()
|
|
2776
2820
|
]);
|
|
2777
2821
|
var buffer = {
|
|
2778
|
-
maxBufferBytes:
|
|
2779
|
-
maxWaitMs:
|
|
2822
|
+
maxBufferBytes: z32.number().int().min(1).max(CLI_RULE_LIMITS.bufferBytes).default(CLI_RULE_LIMITS.bufferBytes),
|
|
2823
|
+
maxWaitMs: z32.number().int().min(1).max(CLI_RULE_LIMITS.maxBufferWaitMs).default(CLI_RULE_LIMITS.bufferWaitMs)
|
|
2780
2824
|
};
|
|
2781
|
-
var source = (value) =>
|
|
2782
|
-
|
|
2783
|
-
|
|
2825
|
+
var source = (value) => z32.discriminatedUnion("source", [
|
|
2826
|
+
z32.object({ source: z32.literal("literal"), value }).strict(),
|
|
2827
|
+
z32.object({ source: z32.literal("localFact"), key: envKey }).strict()
|
|
2784
2828
|
]);
|
|
2785
2829
|
function cliBoundedPattern(pattern) {
|
|
2786
2830
|
let at = pattern.startsWith("^") ? 1 : 0;
|
|
@@ -2801,62 +2845,62 @@ function cliBoundedPattern(pattern) {
|
|
|
2801
2845
|
}
|
|
2802
2846
|
return literals > 0;
|
|
2803
2847
|
}
|
|
2804
|
-
var cliRuleTargetSchema =
|
|
2805
|
-
|
|
2806
|
-
kind:
|
|
2807
|
-
packageName:
|
|
2808
|
-
program:
|
|
2848
|
+
var cliRuleTargetSchema = z32.discriminatedUnion("kind", [
|
|
2849
|
+
z32.object({
|
|
2850
|
+
kind: z32.literal("npmBin"),
|
|
2851
|
+
packageName: z32.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/),
|
|
2852
|
+
program: z32.string().max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/)
|
|
2809
2853
|
}).strict(),
|
|
2810
|
-
|
|
2811
|
-
kind:
|
|
2854
|
+
z32.object({
|
|
2855
|
+
kind: z32.literal("path"),
|
|
2812
2856
|
path: text(1024, true).refine(
|
|
2813
2857
|
(value) => !value.includes("\\") && !value.split("/").includes(".."),
|
|
2814
2858
|
"Use a sandbox path without traversal"
|
|
2815
2859
|
)
|
|
2816
2860
|
}).strict()
|
|
2817
2861
|
]);
|
|
2818
|
-
var cliRuleSelectorSchema =
|
|
2819
|
-
|
|
2820
|
-
kind:
|
|
2821
|
-
argv:
|
|
2862
|
+
var cliRuleSelectorSchema = z32.discriminatedUnion("kind", [
|
|
2863
|
+
z32.object({
|
|
2864
|
+
kind: z32.literal("exact"),
|
|
2865
|
+
argv: z32.array(arg).max(CLI_RULE_LIMITS.arguments - 1)
|
|
2822
2866
|
}).strict(),
|
|
2823
|
-
|
|
2824
|
-
kind:
|
|
2825
|
-
positionals:
|
|
2826
|
-
mode:
|
|
2827
|
-
tokens:
|
|
2867
|
+
z32.object({
|
|
2868
|
+
kind: z32.literal("command"),
|
|
2869
|
+
positionals: z32.object({
|
|
2870
|
+
mode: z32.enum(["exact", "prefix"]),
|
|
2871
|
+
tokens: z32.array(arg).max(CLI_RULE_LIMITS.arguments - 1)
|
|
2828
2872
|
}).strict(),
|
|
2829
|
-
optionsPresent:
|
|
2830
|
-
optionsAbsent:
|
|
2831
|
-
optionValues:
|
|
2873
|
+
optionsPresent: z32.array(flag).max(100).default([]),
|
|
2874
|
+
optionsAbsent: z32.array(flag).max(100).default([]),
|
|
2875
|
+
optionValues: z32.record(flag, arg).default({})
|
|
2832
2876
|
}).strict()
|
|
2833
2877
|
]);
|
|
2834
|
-
var cliRuleOperationSchema =
|
|
2835
|
-
|
|
2878
|
+
var cliRuleOperationSchema = z32.discriminatedUnion("kind", [
|
|
2879
|
+
z32.object({
|
|
2836
2880
|
id,
|
|
2837
|
-
kind:
|
|
2881
|
+
kind: z32.literal("replaceOutput"),
|
|
2838
2882
|
stream,
|
|
2839
2883
|
exit,
|
|
2840
2884
|
replacement: literal,
|
|
2841
2885
|
...buffer
|
|
2842
2886
|
}).strict(),
|
|
2843
|
-
|
|
2887
|
+
z32.object({
|
|
2844
2888
|
id,
|
|
2845
|
-
kind:
|
|
2889
|
+
kind: z32.literal("streamOutput"),
|
|
2846
2890
|
stream,
|
|
2847
|
-
edit:
|
|
2891
|
+
edit: z32.object({ find: text(8192, true), replace: literal }).strict()
|
|
2848
2892
|
}).strict(),
|
|
2849
|
-
|
|
2893
|
+
z32.object({
|
|
2850
2894
|
id,
|
|
2851
|
-
kind:
|
|
2895
|
+
kind: z32.literal("completeOutput"),
|
|
2852
2896
|
stream,
|
|
2853
2897
|
exit,
|
|
2854
2898
|
replace: literal,
|
|
2855
2899
|
...buffer,
|
|
2856
|
-
matcher:
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
kind:
|
|
2900
|
+
matcher: z32.discriminatedUnion("kind", [
|
|
2901
|
+
z32.object({ kind: z32.literal("literal"), text: text(8192, true) }).strict(),
|
|
2902
|
+
z32.object({
|
|
2903
|
+
kind: z32.literal("re2"),
|
|
2860
2904
|
pattern: text(2048, true).refine(
|
|
2861
2905
|
cliBoundedPattern,
|
|
2862
2906
|
"Use literals, optional anchors, and at most one greedy .*"
|
|
@@ -2864,33 +2908,33 @@ var cliRuleOperationSchema = z30.discriminatedUnion("kind", [
|
|
|
2864
2908
|
}).strict()
|
|
2865
2909
|
])
|
|
2866
2910
|
}).strict(),
|
|
2867
|
-
|
|
2911
|
+
z32.object({
|
|
2868
2912
|
id,
|
|
2869
|
-
kind:
|
|
2913
|
+
kind: z32.literal("ensureOption"),
|
|
2870
2914
|
option: flag,
|
|
2871
2915
|
value: source(arg).optional()
|
|
2872
2916
|
}).strict(),
|
|
2873
|
-
|
|
2917
|
+
z32.object({
|
|
2874
2918
|
id,
|
|
2875
|
-
kind:
|
|
2919
|
+
kind: z32.literal("replaceOption"),
|
|
2876
2920
|
option: flag,
|
|
2877
2921
|
value: source(arg)
|
|
2878
2922
|
}).strict(),
|
|
2879
|
-
|
|
2923
|
+
z32.object({
|
|
2880
2924
|
id,
|
|
2881
|
-
kind:
|
|
2925
|
+
kind: z32.literal("setEnv"),
|
|
2882
2926
|
key: envKey,
|
|
2883
2927
|
value: source(arg),
|
|
2884
|
-
whenAbsent:
|
|
2928
|
+
whenAbsent: z32.boolean()
|
|
2885
2929
|
}).strict(),
|
|
2886
|
-
|
|
2930
|
+
z32.object({
|
|
2887
2931
|
id,
|
|
2888
|
-
kind:
|
|
2889
|
-
format:
|
|
2932
|
+
kind: z32.literal("structuredStdin"),
|
|
2933
|
+
format: z32.enum(["text", "json", "jsonl"]),
|
|
2890
2934
|
payload: source(literal),
|
|
2891
|
-
timing:
|
|
2892
|
-
callerInput:
|
|
2893
|
-
eof:
|
|
2935
|
+
timing: z32.literal("onLaunch"),
|
|
2936
|
+
callerInput: z32.literal("replace"),
|
|
2937
|
+
eof: z32.literal("close")
|
|
2894
2938
|
}).strict()
|
|
2895
2939
|
]);
|
|
2896
2940
|
function cliStructuredInputValid(format, payload) {
|
|
@@ -2906,11 +2950,11 @@ function cliStructuredInputValid(format, payload) {
|
|
|
2906
2950
|
return false;
|
|
2907
2951
|
}
|
|
2908
2952
|
}
|
|
2909
|
-
var cliRuleSchema =
|
|
2953
|
+
var cliRuleSchema = z32.object({
|
|
2910
2954
|
id,
|
|
2911
2955
|
selector: cliRuleSelectorSchema,
|
|
2912
|
-
optionArity:
|
|
2913
|
-
operations:
|
|
2956
|
+
optionArity: z32.record(flag, z32.union([z32.literal(0), z32.literal(1)])).default({}),
|
|
2957
|
+
operations: z32.array(cliRuleOperationSchema).min(1).max(CLI_RULE_LIMITS.operations)
|
|
2914
2958
|
}).strict().superRefine((rule, ctx) => {
|
|
2915
2959
|
const fail = (path3, message2) => ctx.addIssue({ code: "custom", path: path3, message: message2 });
|
|
2916
2960
|
if (Object.keys(rule.optionArity).length > 100)
|
|
@@ -2991,10 +3035,10 @@ var cliRuleSchema = z30.object({
|
|
|
2991
3035
|
);
|
|
2992
3036
|
});
|
|
2993
3037
|
var body = {
|
|
2994
|
-
schemaVersion:
|
|
3038
|
+
schemaVersion: z32.literal(3),
|
|
2995
3039
|
target: cliRuleTargetSchema,
|
|
2996
|
-
rules:
|
|
2997
|
-
shippingIntent:
|
|
3040
|
+
rules: z32.array(cliRuleSchema).min(1).max(CLI_RULE_LIMITS.rules),
|
|
3041
|
+
shippingIntent: z32.enum([
|
|
2998
3042
|
"default",
|
|
2999
3043
|
"message",
|
|
3000
3044
|
"interaction",
|
|
@@ -3033,13 +3077,13 @@ function validateBundle(value, ctx) {
|
|
|
3033
3077
|
message: "CLI bundle exceeds the native JSON token bound"
|
|
3034
3078
|
});
|
|
3035
3079
|
}
|
|
3036
|
-
var cliRuleAuthorInputSchema =
|
|
3037
|
-
var normalizedLimits =
|
|
3038
|
-
expansionBytes:
|
|
3039
|
-
excerptBytes:
|
|
3040
|
-
attemptExcerptBytes:
|
|
3041
|
-
journalBytes:
|
|
3042
|
-
supervisorTasks:
|
|
3080
|
+
var cliRuleAuthorInputSchema = z32.object(body).strict().superRefine(validateBundle);
|
|
3081
|
+
var normalizedLimits = z32.object({
|
|
3082
|
+
expansionBytes: z32.literal(CLI_RULE_LIMITS.expansionBytes),
|
|
3083
|
+
excerptBytes: z32.literal(CLI_RULE_LIMITS.excerptBytes),
|
|
3084
|
+
attemptExcerptBytes: z32.literal(CLI_RULE_LIMITS.attemptExcerptBytes),
|
|
3085
|
+
journalBytes: z32.literal(CLI_RULE_LIMITS.journalBytes),
|
|
3086
|
+
supervisorTasks: z32.literal(CLI_RULE_LIMITS.supervisorTasks)
|
|
3043
3087
|
}).strict().default({
|
|
3044
3088
|
expansionBytes: CLI_RULE_LIMITS.expansionBytes,
|
|
3045
3089
|
excerptBytes: CLI_RULE_LIMITS.excerptBytes,
|
|
@@ -3047,10 +3091,10 @@ var normalizedLimits = z30.object({
|
|
|
3047
3091
|
journalBytes: CLI_RULE_LIMITS.journalBytes,
|
|
3048
3092
|
supervisorTasks: CLI_RULE_LIMITS.supervisorTasks
|
|
3049
3093
|
});
|
|
3050
|
-
var cliRuleBundleSchema =
|
|
3094
|
+
var cliRuleBundleSchema = z32.object({
|
|
3051
3095
|
...body,
|
|
3052
3096
|
limits: normalizedLimits,
|
|
3053
|
-
bundleSha256:
|
|
3097
|
+
bundleSha256: z32.string().regex(/^[a-f0-9]{64}$/)
|
|
3054
3098
|
}).strict().superRefine(validateBundle);
|
|
3055
3099
|
|
|
3056
3100
|
// ../packages/api-schemas/src/climb-kinds.ts
|
|
@@ -3081,35 +3125,35 @@ var LEVER_INTERVENTIONS = {
|
|
|
3081
3125
|
};
|
|
3082
3126
|
|
|
3083
3127
|
// ../packages/api-schemas/src/sandbox-overrides.ts
|
|
3084
|
-
import { z as
|
|
3128
|
+
import { z as z33 } from "zod";
|
|
3085
3129
|
var SANDBOX_OVERRIDE_KINDS = ["packages", "clis"];
|
|
3086
|
-
var ecosystemSchema =
|
|
3087
|
-
var overrideFilesSchema =
|
|
3088
|
-
|
|
3089
|
-
path:
|
|
3130
|
+
var ecosystemSchema = z33.enum(["npm", "pypi", "cargo", "go", "gem"]);
|
|
3131
|
+
var overrideFilesSchema = z33.array(
|
|
3132
|
+
z33.object({
|
|
3133
|
+
path: z33.string().min(1).refine(
|
|
3090
3134
|
(path3) => !path3.startsWith("/") && !path3.includes("\\") && !path3.split("/").includes(".."),
|
|
3091
3135
|
"Use a relative path within the target"
|
|
3092
3136
|
),
|
|
3093
|
-
body:
|
|
3137
|
+
body: z33.string()
|
|
3094
3138
|
}).strict()
|
|
3095
3139
|
).min(1);
|
|
3096
3140
|
var contentShape = {
|
|
3097
|
-
version:
|
|
3141
|
+
version: z33.string().trim().min(1).optional(),
|
|
3098
3142
|
files: overrideFilesSchema.optional()
|
|
3099
3143
|
};
|
|
3100
3144
|
var hasContent = (value) => value.version !== void 0 || value.files !== void 0;
|
|
3101
|
-
var sandboxOverridesSchema =
|
|
3102
|
-
version:
|
|
3103
|
-
packages:
|
|
3104
|
-
|
|
3145
|
+
var sandboxOverridesSchema = z33.object({
|
|
3146
|
+
version: z33.literal(1),
|
|
3147
|
+
packages: z33.array(
|
|
3148
|
+
z33.object({
|
|
3105
3149
|
ecosystem: ecosystemSchema,
|
|
3106
|
-
name:
|
|
3150
|
+
name: z33.string().trim().min(1),
|
|
3107
3151
|
...contentShape
|
|
3108
3152
|
}).strict().refine(hasContent, "Specify a version or files")
|
|
3109
3153
|
).optional(),
|
|
3110
|
-
clis:
|
|
3111
|
-
|
|
3112
|
-
name:
|
|
3154
|
+
clis: z33.array(
|
|
3155
|
+
z33.object({
|
|
3156
|
+
name: z33.string().trim().min(1),
|
|
3113
3157
|
...contentShape
|
|
3114
3158
|
}).strict().refine(hasContent, "Specify a version or files")
|
|
3115
3159
|
).optional()
|
|
@@ -3136,11 +3180,11 @@ var sandboxOverridesSchema = z31.object({
|
|
|
3136
3180
|
});
|
|
3137
3181
|
|
|
3138
3182
|
// ../packages/api-schemas/src/climb.ts
|
|
3139
|
-
var climbSubjectKindSchema =
|
|
3140
|
-
var leverKindSchema =
|
|
3141
|
-
var interventionKindSchema =
|
|
3142
|
-
var skill =
|
|
3143
|
-
var empty =
|
|
3183
|
+
var climbSubjectKindSchema = z34.enum(["EVAL_SET", "VISIBILITY_PROMPT"]);
|
|
3184
|
+
var leverKindSchema = z34.enum(LEVER_KINDS);
|
|
3185
|
+
var interventionKindSchema = z34.enum(INTERVENTION_KINDS);
|
|
3186
|
+
var skill = z34.object({ skillVersionId: z34.string().min(1) }).strict();
|
|
3187
|
+
var empty = z34.object({}).strict();
|
|
3144
3188
|
function validateFixtureIntervention(value, ctx) {
|
|
3145
3189
|
const result = webFixtureSchema.safeParse({ version: 1, ...value });
|
|
3146
3190
|
if (!result.success) {
|
|
@@ -3153,73 +3197,73 @@ function validateFixtureIntervention(value, ctx) {
|
|
|
3153
3197
|
}
|
|
3154
3198
|
}
|
|
3155
3199
|
}
|
|
3156
|
-
var interventionSchema =
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
kind:
|
|
3163
|
-
before:
|
|
3164
|
-
after:
|
|
3200
|
+
var interventionSchema = z34.discriminatedUnion("kind", [
|
|
3201
|
+
z34.object({ kind: z34.literal("BASELINE"), after: empty }),
|
|
3202
|
+
z34.object({ kind: z34.literal("ADD_SKILL"), after: skill }),
|
|
3203
|
+
z34.object({ kind: z34.literal("REMOVE_SKILL"), before: skill, after: empty }),
|
|
3204
|
+
z34.object({ kind: z34.literal("EDIT_SKILL"), before: skill, after: skill }),
|
|
3205
|
+
z34.object({
|
|
3206
|
+
kind: z34.literal("REWRITE_DOCS"),
|
|
3207
|
+
before: z34.json().optional(),
|
|
3208
|
+
after: z34.object({ pages: webFixtureSchema.shape.pages.unwrap().min(1) }).strict().superRefine(validateFixtureIntervention)
|
|
3165
3209
|
}),
|
|
3166
|
-
|
|
3167
|
-
kind:
|
|
3168
|
-
after:
|
|
3210
|
+
z34.object({
|
|
3211
|
+
kind: z34.literal("PACKAGE_VERSION"),
|
|
3212
|
+
after: z34.object({
|
|
3169
3213
|
ecosystem: ecosystemSchema,
|
|
3170
|
-
name:
|
|
3171
|
-
version:
|
|
3214
|
+
name: z34.string().min(1),
|
|
3215
|
+
version: z34.string().min(1)
|
|
3172
3216
|
}).strict()
|
|
3173
3217
|
}),
|
|
3174
|
-
|
|
3175
|
-
kind:
|
|
3176
|
-
after:
|
|
3218
|
+
z34.object({
|
|
3219
|
+
kind: z34.literal("PACKAGE_CONTENT"),
|
|
3220
|
+
after: z34.object({
|
|
3177
3221
|
ecosystem: ecosystemSchema,
|
|
3178
|
-
name:
|
|
3222
|
+
name: z34.string().min(1),
|
|
3179
3223
|
files: overrideFilesSchema
|
|
3180
3224
|
}).strict()
|
|
3181
3225
|
}),
|
|
3182
|
-
|
|
3183
|
-
kind:
|
|
3184
|
-
after:
|
|
3226
|
+
z34.object({
|
|
3227
|
+
kind: z34.literal("CLI_VERSION"),
|
|
3228
|
+
after: z34.object({ name: z34.string().min(1), version: z34.string().min(1) }).strict()
|
|
3185
3229
|
}),
|
|
3186
|
-
|
|
3187
|
-
kind:
|
|
3230
|
+
z34.object({
|
|
3231
|
+
kind: z34.literal("CLI_INTERVENTION"),
|
|
3188
3232
|
after: cliRuleBundleSchema
|
|
3189
3233
|
})
|
|
3190
3234
|
]);
|
|
3191
|
-
var climbSettingsSchema =
|
|
3192
|
-
maxRounds:
|
|
3193
|
-
sampleCount:
|
|
3194
|
-
creditCap:
|
|
3195
|
-
targetScore:
|
|
3235
|
+
var climbSettingsSchema = z34.object({
|
|
3236
|
+
maxRounds: z34.number().int().positive().default(5),
|
|
3237
|
+
sampleCount: z34.number().int().positive().default(1),
|
|
3238
|
+
creditCap: z34.number().int().nonnegative(),
|
|
3239
|
+
targetScore: z34.number().min(0).max(1).default(1),
|
|
3196
3240
|
// Narrow the subject's whole roster to one slot, for the baseline and every
|
|
3197
3241
|
// trial alike. A subject rostering ten models otherwise multiplies every
|
|
3198
3242
|
// trial by ten, and a one-model trial measured against a ten-model baseline
|
|
3199
3243
|
// is not a comparison. `pinnedModel` empty means the agent's default model.
|
|
3200
3244
|
pinnedAgent: schedulableAgentSchema.optional(),
|
|
3201
|
-
pinnedModel:
|
|
3202
|
-
maxTrialsPerRound:
|
|
3245
|
+
pinnedModel: z34.string().optional(),
|
|
3246
|
+
maxTrialsPerRound: z34.number().int().min(1).max(10).default(3),
|
|
3203
3247
|
// The round a continuation started at; the no-improvement counter
|
|
3204
3248
|
// restarts here.
|
|
3205
|
-
continuedAtRound:
|
|
3249
|
+
continuedAtRound: z34.number().int().nonnegative().optional()
|
|
3206
3250
|
}).strip().refine((value) => value.pinnedAgent !== void 0 || !value.pinnedModel, {
|
|
3207
3251
|
path: ["pinnedAgent"],
|
|
3208
3252
|
message: "Pin an agent with the model"
|
|
3209
3253
|
});
|
|
3210
|
-
var climbDirectionSchema =
|
|
3211
|
-
focus:
|
|
3212
|
-
preserve:
|
|
3213
|
-
exclude:
|
|
3214
|
-
notes:
|
|
3215
|
-
});
|
|
3216
|
-
var climbDirectionPatchSchema =
|
|
3217
|
-
focus:
|
|
3218
|
-
preserve:
|
|
3219
|
-
exclude:
|
|
3220
|
-
notes:
|
|
3254
|
+
var climbDirectionSchema = z34.object({
|
|
3255
|
+
focus: z34.string().trim().max(2e3).nullable().default(null),
|
|
3256
|
+
preserve: z34.array(z34.string().trim().min(1).max(500)).max(20).default([]),
|
|
3257
|
+
exclude: z34.array(z34.string().trim().min(1).max(500)).max(20).default([]),
|
|
3258
|
+
notes: z34.string().trim().max(4e3).nullable().default(null)
|
|
3259
|
+
});
|
|
3260
|
+
var climbDirectionPatchSchema = z34.object({
|
|
3261
|
+
focus: z34.string().trim().max(2e3).nullable().optional(),
|
|
3262
|
+
preserve: z34.array(z34.string().trim().min(1).max(500)).max(20).optional(),
|
|
3263
|
+
exclude: z34.array(z34.string().trim().min(1).max(500)).max(20).optional(),
|
|
3264
|
+
notes: z34.string().trim().max(4e3).nullable().optional(),
|
|
3221
3265
|
/** One line on why this was recorded; becomes the DIRECTION row summary. */
|
|
3222
|
-
rationale:
|
|
3266
|
+
rationale: z34.string().trim().max(500).optional()
|
|
3223
3267
|
}).strict();
|
|
3224
3268
|
var CLIMB_ACTIVITY_KINDS = [
|
|
3225
3269
|
"STARTED",
|
|
@@ -3238,74 +3282,75 @@ var CLIMB_ACTIVITY_KINDS = [
|
|
|
3238
3282
|
"CONTINUED",
|
|
3239
3283
|
"CANCELED"
|
|
3240
3284
|
];
|
|
3241
|
-
var climbActivityKindSchema =
|
|
3242
|
-
var proposerTraceStepSchema =
|
|
3243
|
-
tool:
|
|
3244
|
-
args:
|
|
3245
|
-
result:
|
|
3246
|
-
isError:
|
|
3247
|
-
});
|
|
3248
|
-
var proposerTraceSchema =
|
|
3249
|
-
steps:
|
|
3250
|
-
reasoning:
|
|
3251
|
-
durationMs:
|
|
3252
|
-
model:
|
|
3253
|
-
});
|
|
3254
|
-
var climbActivitySchema =
|
|
3255
|
-
id:
|
|
3256
|
-
climbId:
|
|
3257
|
-
roundId:
|
|
3258
|
-
trialId:
|
|
3285
|
+
var climbActivityKindSchema = z34.enum(CLIMB_ACTIVITY_KINDS);
|
|
3286
|
+
var proposerTraceStepSchema = z34.object({
|
|
3287
|
+
tool: z34.string(),
|
|
3288
|
+
args: z34.string(),
|
|
3289
|
+
result: z34.string().nullable(),
|
|
3290
|
+
isError: z34.boolean().optional()
|
|
3291
|
+
});
|
|
3292
|
+
var proposerTraceSchema = z34.object({
|
|
3293
|
+
steps: z34.array(proposerTraceStepSchema),
|
|
3294
|
+
reasoning: z34.string(),
|
|
3295
|
+
durationMs: z34.number().int().nonnegative(),
|
|
3296
|
+
model: z34.string()
|
|
3297
|
+
});
|
|
3298
|
+
var climbActivitySchema = z34.object({
|
|
3299
|
+
id: z34.string(),
|
|
3300
|
+
climbId: z34.string(),
|
|
3301
|
+
roundId: z34.string().nullable(),
|
|
3302
|
+
trialId: z34.string().nullable(),
|
|
3259
3303
|
kind: climbActivityKindSchema,
|
|
3260
|
-
actorUserId:
|
|
3261
|
-
actorName:
|
|
3262
|
-
summary:
|
|
3263
|
-
detail:
|
|
3264
|
-
createdAt:
|
|
3265
|
-
});
|
|
3266
|
-
var activityQuerySchema =
|
|
3267
|
-
after:
|
|
3268
|
-
limit:
|
|
3269
|
-
});
|
|
3270
|
-
var climbConfigSnapshotSchema =
|
|
3271
|
-
promptText:
|
|
3272
|
-
scenario:
|
|
3273
|
-
repoUrl:
|
|
3274
|
-
repoRef:
|
|
3275
|
-
profileId:
|
|
3276
|
-
profileName:
|
|
3277
|
-
profileDescription:
|
|
3278
|
-
profileModel:
|
|
3279
|
-
limits:
|
|
3280
|
-
agents:
|
|
3281
|
-
skillRefs:
|
|
3282
|
-
mcpRefs:
|
|
3283
|
-
skillVersionIds:
|
|
3284
|
-
mcpServerVersionIds:
|
|
3285
|
-
skillSet:
|
|
3286
|
-
mcpSet:
|
|
3287
|
-
connectionIds:
|
|
3288
|
-
connectionSet:
|
|
3289
|
-
agentContext:
|
|
3290
|
-
agentContextDigest:
|
|
3304
|
+
actorUserId: z34.string().nullable(),
|
|
3305
|
+
actorName: z34.string().nullable(),
|
|
3306
|
+
summary: z34.string(),
|
|
3307
|
+
detail: z34.unknown().nullable(),
|
|
3308
|
+
createdAt: z34.string()
|
|
3309
|
+
});
|
|
3310
|
+
var activityQuerySchema = z34.object({
|
|
3311
|
+
after: z34.string().datetime().optional(),
|
|
3312
|
+
limit: z34.coerce.number().int().min(1).max(500).default(500)
|
|
3313
|
+
});
|
|
3314
|
+
var climbConfigSnapshotSchema = z34.object({
|
|
3315
|
+
promptText: z34.string(),
|
|
3316
|
+
scenario: z34.enum(["GREENFIELD", "MIGRATION"]),
|
|
3317
|
+
repoUrl: z34.string().nullable(),
|
|
3318
|
+
repoRef: z34.string().nullable(),
|
|
3319
|
+
profileId: z34.string().nullable(),
|
|
3320
|
+
profileName: z34.string().nullable(),
|
|
3321
|
+
profileDescription: z34.string().nullable(),
|
|
3322
|
+
profileModel: z34.string().nullable(),
|
|
3323
|
+
limits: z34.json(),
|
|
3324
|
+
agents: z34.array(agentConfigSchema).min(1),
|
|
3325
|
+
skillRefs: z34.array(z34.string()),
|
|
3326
|
+
mcpRefs: z34.array(z34.string()),
|
|
3327
|
+
skillVersionIds: z34.array(z34.string()),
|
|
3328
|
+
mcpServerVersionIds: z34.array(z34.string()),
|
|
3329
|
+
skillSet: z34.json().nullable(),
|
|
3330
|
+
mcpSet: z34.json().nullable(),
|
|
3331
|
+
connectionIds: z34.array(z34.string()),
|
|
3332
|
+
connectionSet: z34.json().nullable(),
|
|
3333
|
+
agentContext: z34.json().nullable(),
|
|
3334
|
+
agentContextDigest: z34.string().nullable(),
|
|
3291
3335
|
webFixture: webFixtureSchema.nullable(),
|
|
3292
3336
|
cliIntervention: cliRuleBundleSchema.nullable().default(null),
|
|
3293
3337
|
sandboxOverrides: sandboxOverridesSchema.nullable(),
|
|
3294
|
-
visibilityScenarioId:
|
|
3338
|
+
visibilityScenarioId: z34.string().nullable()
|
|
3295
3339
|
}).strict();
|
|
3296
|
-
var targetRefSchema =
|
|
3297
|
-
kind:
|
|
3298
|
-
id:
|
|
3299
|
-
url:
|
|
3300
|
-
package:
|
|
3340
|
+
var targetRefSchema = z34.object({
|
|
3341
|
+
kind: z34.string().min(1),
|
|
3342
|
+
id: z34.string().optional(),
|
|
3343
|
+
url: z34.url().optional(),
|
|
3344
|
+
package: z34.string().optional()
|
|
3301
3345
|
}).strict();
|
|
3302
|
-
var trialInputSchema =
|
|
3303
|
-
title:
|
|
3304
|
-
hypothesis:
|
|
3346
|
+
var trialInputSchema = z34.object({
|
|
3347
|
+
title: z34.string().trim().min(1).max(200),
|
|
3348
|
+
hypothesis: z34.string().max(4e3).optional(),
|
|
3305
3349
|
lever: leverKindSchema,
|
|
3306
3350
|
targetRef: targetRefSchema.optional(),
|
|
3307
3351
|
intervention: interventionSchema,
|
|
3308
|
-
authorMode:
|
|
3352
|
+
authorMode: z34.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL"),
|
|
3353
|
+
startingPoints: candidateStartsSchema.optional()
|
|
3309
3354
|
}).strict().superRefine((value, ctx) => {
|
|
3310
3355
|
const allowed = LEVER_INTERVENTIONS[value.lever];
|
|
3311
3356
|
if (!allowed.includes(value.intervention.kind))
|
|
@@ -3324,7 +3369,7 @@ var OPTIMIZATION_STATUSES = [
|
|
|
3324
3369
|
"DONE",
|
|
3325
3370
|
"ARCHIVED"
|
|
3326
3371
|
];
|
|
3327
|
-
var optimizationStatusSchema =
|
|
3372
|
+
var optimizationStatusSchema = z35.enum(OPTIMIZATION_STATUSES);
|
|
3328
3373
|
var ROUND_STATUSES = [
|
|
3329
3374
|
"PROPOSING",
|
|
3330
3375
|
"PROPOSED",
|
|
@@ -3353,61 +3398,103 @@ var OPTIMIZATION_EFFORTS = [
|
|
|
3353
3398
|
{ value: "HIGH", label: "Thorough", sampleCount: 2, maxRounds: 8 },
|
|
3354
3399
|
{ value: "XHIGH", label: "Exhaustive", sampleCount: 3, maxRounds: 12 }
|
|
3355
3400
|
];
|
|
3356
|
-
var optimizationEffortSchema =
|
|
3401
|
+
var optimizationEffortSchema = z35.enum(
|
|
3357
3402
|
OPTIMIZATION_EFFORTS.map((preset) => preset.value)
|
|
3358
3403
|
);
|
|
3359
|
-
var listOptimizationsQuerySchema =
|
|
3360
|
-
status:
|
|
3404
|
+
var listOptimizationsQuerySchema = z35.object({
|
|
3405
|
+
status: z35.string().optional().transform(
|
|
3361
3406
|
(value) => value ? value.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean) : void 0
|
|
3362
|
-
).pipe(
|
|
3407
|
+
).pipe(z35.array(optimizationStatusSchema).optional()),
|
|
3363
3408
|
subjectKind: climbSubjectKindSchema.optional(),
|
|
3364
|
-
subjectId:
|
|
3365
|
-
limit:
|
|
3409
|
+
subjectId: z35.string().min(1).optional(),
|
|
3410
|
+
limit: z35.coerce.number().int().min(1).max(200).default(50),
|
|
3366
3411
|
/** Drafts are workspaces, not runs; older clients never see them. */
|
|
3367
|
-
includeDrafts:
|
|
3412
|
+
includeDrafts: z35.union([z35.boolean(), z35.string()]).optional().transform((value) => value === true || value === "true" || value === "1")
|
|
3368
3413
|
});
|
|
3369
|
-
var optimizationSummarySchema =
|
|
3370
|
-
id:
|
|
3371
|
-
name:
|
|
3414
|
+
var optimizationSummarySchema = z35.object({
|
|
3415
|
+
id: z35.string(),
|
|
3416
|
+
name: z35.string(),
|
|
3372
3417
|
status: optimizationStatusSchema,
|
|
3373
|
-
mode:
|
|
3418
|
+
mode: z35.enum(["MANUAL", "AUTO"]),
|
|
3374
3419
|
/** Autonomous launches every proposed round; interactive waits for one. */
|
|
3375
|
-
autonomous:
|
|
3376
|
-
stopReason:
|
|
3420
|
+
autonomous: z35.boolean(),
|
|
3421
|
+
stopReason: z35.string().nullable(),
|
|
3377
3422
|
subjectKind: climbSubjectKindSchema,
|
|
3378
|
-
subjectId:
|
|
3379
|
-
subjectName:
|
|
3423
|
+
subjectId: z35.string(),
|
|
3424
|
+
subjectName: z35.string(),
|
|
3380
3425
|
lever: leverKindSchema.nullable(),
|
|
3381
|
-
round:
|
|
3382
|
-
maxRounds:
|
|
3426
|
+
round: z35.number().int(),
|
|
3427
|
+
maxRounds: z35.number().int(),
|
|
3383
3428
|
/** Starting baseline score, 0..1. */
|
|
3384
|
-
before:
|
|
3429
|
+
before: z35.number().nullable(),
|
|
3385
3430
|
/** Score of the marked winner, or best BETTER trial, 0..1. */
|
|
3386
|
-
after:
|
|
3431
|
+
after: z35.number().nullable(),
|
|
3387
3432
|
/** Percentage-point change from the baseline to the winner or best BETTER trial. */
|
|
3388
|
-
delta:
|
|
3433
|
+
delta: z35.number().nullable(),
|
|
3389
3434
|
/** Score after each round, baseline first. */
|
|
3390
|
-
path:
|
|
3391
|
-
creditsSpent:
|
|
3392
|
-
creditsReserved:
|
|
3393
|
-
summary:
|
|
3394
|
-
href:
|
|
3395
|
-
createdAt:
|
|
3396
|
-
updatedAt:
|
|
3397
|
-
});
|
|
3398
|
-
var listOptimizationsResponseSchema =
|
|
3399
|
-
items:
|
|
3400
|
-
});
|
|
3401
|
-
var
|
|
3435
|
+
path: z35.array(z35.number()),
|
|
3436
|
+
creditsSpent: z35.number().int(),
|
|
3437
|
+
creditsReserved: z35.number().int(),
|
|
3438
|
+
summary: z35.string().nullable(),
|
|
3439
|
+
href: z35.string(),
|
|
3440
|
+
createdAt: z35.string(),
|
|
3441
|
+
updatedAt: z35.string()
|
|
3442
|
+
});
|
|
3443
|
+
var listOptimizationsResponseSchema = z35.object({
|
|
3444
|
+
items: z35.array(optimizationSummarySchema)
|
|
3445
|
+
});
|
|
3446
|
+
var baselineDiscoveryQuerySchema = z35.object({
|
|
3447
|
+
subjectKind: climbSubjectKindSchema,
|
|
3448
|
+
subjectId: z35.string().min(1),
|
|
3449
|
+
limit: z35.coerce.number().int().min(1).max(100).default(50),
|
|
3450
|
+
cursor: z35.string().min(1).optional()
|
|
3451
|
+
}).strict();
|
|
3452
|
+
var baselineRunSchema = z35.object({
|
|
3453
|
+
resolvedModel: z35.string().nullable(),
|
|
3454
|
+
runId: z35.string(),
|
|
3455
|
+
agent: z35.string(),
|
|
3456
|
+
model: z35.string(),
|
|
3457
|
+
status: z35.string(),
|
|
3458
|
+
createdAt: z35.string(),
|
|
3459
|
+
outcome: z35.object({
|
|
3460
|
+
passedCriteria: z35.number(),
|
|
3461
|
+
totalCriteria: z35.number(),
|
|
3462
|
+
judgingStatus: z35.string().nullable()
|
|
3463
|
+
}),
|
|
3464
|
+
surfaces: z35.array(
|
|
3465
|
+
z35.object({
|
|
3466
|
+
lever: z35.string(),
|
|
3467
|
+
label: z35.string(),
|
|
3468
|
+
targetRef: z35.unknown(),
|
|
3469
|
+
evidence: z35.unknown(),
|
|
3470
|
+
command: z35.unknown().optional()
|
|
3471
|
+
})
|
|
3472
|
+
),
|
|
3473
|
+
evidenceStatus: z35.object({
|
|
3474
|
+
surfaces: z35.string().nullable(),
|
|
3475
|
+
cli: z35.string().nullable()
|
|
3476
|
+
}),
|
|
3477
|
+
eligibility: z35.object({
|
|
3478
|
+
eligible: z35.boolean(),
|
|
3479
|
+
reason: z35.string().nullable(),
|
|
3480
|
+
baselineRunIds: z35.array(z35.string())
|
|
3481
|
+
})
|
|
3482
|
+
});
|
|
3483
|
+
var baselineDiscoveryResponseSchema = z35.object({
|
|
3484
|
+
items: z35.array(baselineRunSchema),
|
|
3485
|
+
nextCursor: z35.string().nullable(),
|
|
3486
|
+
note: z35.string()
|
|
3487
|
+
});
|
|
3488
|
+
var targetSchema = z35.object({
|
|
3402
3489
|
agent: schedulableAgentSchema.optional(),
|
|
3403
3490
|
/** Empty or omitted means the agent's default model. */
|
|
3404
|
-
model:
|
|
3491
|
+
model: z35.string().optional()
|
|
3405
3492
|
});
|
|
3406
3493
|
var planShape = {
|
|
3407
3494
|
effort: optimizationEffortSchema.optional(),
|
|
3408
|
-
sampleCount:
|
|
3409
|
-
maxRounds:
|
|
3410
|
-
maxTrialsPerRound:
|
|
3495
|
+
sampleCount: z35.number().int().min(1).max(100).optional(),
|
|
3496
|
+
maxRounds: z35.number().int().min(1).max(100).optional(),
|
|
3497
|
+
maxTrialsPerRound: z35.number().int().min(1).max(10).optional()
|
|
3411
3498
|
};
|
|
3412
3499
|
function refinePlan(value, ctx) {
|
|
3413
3500
|
if (value.effort && (value.sampleCount || value.maxRounds))
|
|
@@ -3423,18 +3510,26 @@ function refinePlan(value, ctx) {
|
|
|
3423
3510
|
message: "Pin an agent with the model"
|
|
3424
3511
|
});
|
|
3425
3512
|
}
|
|
3426
|
-
var startOptimizationBodySchema =
|
|
3513
|
+
var startOptimizationBodySchema = z35.object({
|
|
3427
3514
|
subjectKind: climbSubjectKindSchema,
|
|
3428
|
-
subjectId:
|
|
3429
|
-
name:
|
|
3515
|
+
subjectId: z35.string().min(1),
|
|
3516
|
+
name: z35.string().trim().min(1).max(200).optional(),
|
|
3430
3517
|
...planShape,
|
|
3431
|
-
creditCap:
|
|
3432
|
-
targetScore:
|
|
3433
|
-
target: targetSchema.extend({ agent: schedulableAgentSchema })
|
|
3434
|
-
|
|
3435
|
-
|
|
3518
|
+
creditCap: z35.number().int().nonnegative().optional(),
|
|
3519
|
+
targetScore: z35.number().min(0).max(1).optional(),
|
|
3520
|
+
target: targetSchema.extend({ agent: schedulableAgentSchema }).optional(),
|
|
3521
|
+
fromRun: z35.string().min(1).optional()
|
|
3522
|
+
}).strict().superRefine(refinePlan).superRefine((value, ctx) => {
|
|
3523
|
+
if (!!value.target === !!value.fromRun)
|
|
3524
|
+
ctx.addIssue({
|
|
3525
|
+
code: "custom",
|
|
3526
|
+
message: "Pass target or fromRun, not both",
|
|
3527
|
+
path: ["target"]
|
|
3528
|
+
});
|
|
3529
|
+
});
|
|
3530
|
+
var estimateOptimizationBodySchema = z35.object({
|
|
3436
3531
|
subjectKind: climbSubjectKindSchema,
|
|
3437
|
-
subjectId:
|
|
3532
|
+
subjectId: z35.string().min(1),
|
|
3438
3533
|
...planShape,
|
|
3439
3534
|
target: targetSchema.optional()
|
|
3440
3535
|
}).strict().superRefine(refinePlan);
|
|
@@ -3446,105 +3541,127 @@ var RUN_CREDIT_BASES = [
|
|
|
3446
3541
|
"byok",
|
|
3447
3542
|
"reserve"
|
|
3448
3543
|
];
|
|
3449
|
-
var runCreditBasisSchema =
|
|
3450
|
-
var optimizationEstimateSchema =
|
|
3451
|
-
sampleCount:
|
|
3452
|
-
maxRounds:
|
|
3453
|
-
runsPerTrial:
|
|
3454
|
-
executionCredits:
|
|
3455
|
-
judgeCredits:
|
|
3456
|
-
leverPassCredits:
|
|
3457
|
-
trialCredits:
|
|
3544
|
+
var runCreditBasisSchema = z35.enum(RUN_CREDIT_BASES);
|
|
3545
|
+
var optimizationEstimateSchema = z35.object({
|
|
3546
|
+
sampleCount: z35.number().int(),
|
|
3547
|
+
maxRounds: z35.number().int(),
|
|
3548
|
+
runsPerTrial: z35.number(),
|
|
3549
|
+
executionCredits: z35.number(),
|
|
3550
|
+
judgeCredits: z35.number(),
|
|
3551
|
+
leverPassCredits: z35.number(),
|
|
3552
|
+
trialCredits: z35.number(),
|
|
3458
3553
|
/** Estimate, not a reservation or enforced spending cap. */
|
|
3459
|
-
estimate:
|
|
3554
|
+
estimate: z35.number().int(),
|
|
3460
3555
|
/** True when no price or history covered a model: a bound, not a forecast. */
|
|
3461
|
-
approximate:
|
|
3556
|
+
approximate: z35.boolean().default(false),
|
|
3462
3557
|
/** Which rung priced the run, so the UI can say why a figure is what it is. */
|
|
3463
3558
|
basis: runCreditBasisSchema.optional()
|
|
3464
3559
|
});
|
|
3465
|
-
var diagnoseBodySchema =
|
|
3560
|
+
var diagnoseBodySchema = z35.object({
|
|
3466
3561
|
subjectKind: climbSubjectKindSchema,
|
|
3467
|
-
subjectId:
|
|
3562
|
+
subjectId: z35.string().min(1)
|
|
3468
3563
|
}).strict();
|
|
3469
|
-
var diagnosisSchema =
|
|
3470
|
-
id:
|
|
3471
|
-
status:
|
|
3564
|
+
var diagnosisSchema = z35.object({
|
|
3565
|
+
id: z35.string(),
|
|
3566
|
+
status: z35.enum(["GENERATING", "READY", "FAILED"]),
|
|
3472
3567
|
subjectKind: climbSubjectKindSchema,
|
|
3473
|
-
subjectId:
|
|
3474
|
-
runCount:
|
|
3475
|
-
summary:
|
|
3568
|
+
subjectId: z35.string(),
|
|
3569
|
+
runCount: z35.number().int(),
|
|
3570
|
+
summary: z35.string().nullable(),
|
|
3476
3571
|
recommendedLever: leverKindSchema.nullable(),
|
|
3477
|
-
recommendedTarget:
|
|
3478
|
-
clusters:
|
|
3479
|
-
|
|
3480
|
-
title:
|
|
3481
|
-
failureMode:
|
|
3482
|
-
criterionIds:
|
|
3483
|
-
runIds:
|
|
3572
|
+
recommendedTarget: z35.unknown().nullable(),
|
|
3573
|
+
clusters: z35.array(
|
|
3574
|
+
z35.object({
|
|
3575
|
+
title: z35.string(),
|
|
3576
|
+
failureMode: z35.string(),
|
|
3577
|
+
criterionIds: z35.array(z35.string()),
|
|
3578
|
+
runIds: z35.array(z35.string()),
|
|
3484
3579
|
lever: leverKindSchema.nullable(),
|
|
3485
|
-
targetRef:
|
|
3486
|
-
confidence:
|
|
3580
|
+
targetRef: z35.unknown().nullable(),
|
|
3581
|
+
confidence: z35.number()
|
|
3487
3582
|
})
|
|
3488
3583
|
),
|
|
3489
|
-
unsupportedLevers:
|
|
3490
|
-
createdAt:
|
|
3491
|
-
});
|
|
3492
|
-
var
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3584
|
+
unsupportedLevers: z35.array(leverKindSchema).default([]),
|
|
3585
|
+
createdAt: z35.string()
|
|
3586
|
+
});
|
|
3587
|
+
var candidateExecutionSchema = z35.object({
|
|
3588
|
+
runId: z35.string(),
|
|
3589
|
+
startMode: z35.enum(["checkpoint", "fresh"]),
|
|
3590
|
+
checkpointId: z35.string().nullable(),
|
|
3591
|
+
sourceRunId: z35.string().nullable(),
|
|
3592
|
+
status: z35.string(),
|
|
3593
|
+
continuation: z35.literal("running-process").optional(),
|
|
3594
|
+
sourceAttempt: z35.number().int().positive().optional(),
|
|
3595
|
+
estimatedSavedWork: z35.object({
|
|
3596
|
+
elapsedMs: z35.number().nonnegative(),
|
|
3597
|
+
usage: z35.object({
|
|
3598
|
+
input_tokens: z35.number().nonnegative(),
|
|
3599
|
+
output_tokens: z35.number().nonnegative(),
|
|
3600
|
+
cache_read_input_tokens: z35.number().nonnegative(),
|
|
3601
|
+
cache_creation_input_tokens: z35.number().nonnegative()
|
|
3602
|
+
}),
|
|
3603
|
+
attribution: z35.literal("approximate")
|
|
3604
|
+
}).optional()
|
|
3605
|
+
});
|
|
3606
|
+
var trialRunSchema = z35.object({
|
|
3607
|
+
id: z35.string(),
|
|
3608
|
+
status: z35.string(),
|
|
3609
|
+
failureReason: z35.string().nullable(),
|
|
3610
|
+
exitReason: z35.string().nullable(),
|
|
3611
|
+
candidateDelivery: candidateDeliverySchema.nullable().optional(),
|
|
3612
|
+
candidateExecution: candidateExecutionSchema.nullable().optional(),
|
|
3497
3613
|
cliCoverage: cliRuleCoverageSchema.nullable().optional(),
|
|
3498
|
-
passed:
|
|
3499
|
-
criteria:
|
|
3500
|
-
|
|
3614
|
+
passed: z35.boolean().nullable(),
|
|
3615
|
+
criteria: z35.array(
|
|
3616
|
+
z35.object({ name: z35.string(), passed: z35.boolean(), reasoning: z35.string() })
|
|
3501
3617
|
),
|
|
3502
|
-
levers:
|
|
3503
|
-
|
|
3504
|
-
lever:
|
|
3505
|
-
attributed:
|
|
3506
|
-
note:
|
|
3618
|
+
levers: z35.array(
|
|
3619
|
+
z35.object({
|
|
3620
|
+
lever: z35.string(),
|
|
3621
|
+
attributed: z35.boolean(),
|
|
3622
|
+
note: z35.string().nullable()
|
|
3507
3623
|
})
|
|
3508
3624
|
)
|
|
3509
3625
|
});
|
|
3510
|
-
var trialSchema =
|
|
3511
|
-
id:
|
|
3512
|
-
climbId:
|
|
3513
|
-
roundNumber:
|
|
3514
|
-
key:
|
|
3626
|
+
var trialSchema = z35.object({
|
|
3627
|
+
id: z35.string(),
|
|
3628
|
+
climbId: z35.string(),
|
|
3629
|
+
roundNumber: z35.number().int(),
|
|
3630
|
+
key: z35.string(),
|
|
3515
3631
|
/** @deprecated All trials branch from the baseline. */
|
|
3516
|
-
parentTrialId:
|
|
3632
|
+
parentTrialId: z35.string().nullable(),
|
|
3517
3633
|
/** @deprecated Always the baseline key for non-baseline trials. */
|
|
3518
|
-
parentKey:
|
|
3519
|
-
title:
|
|
3520
|
-
hypothesis:
|
|
3634
|
+
parentKey: z35.string().nullable(),
|
|
3635
|
+
title: z35.string(),
|
|
3636
|
+
hypothesis: z35.string().nullable(),
|
|
3521
3637
|
lever: leverKindSchema.nullable(),
|
|
3522
3638
|
kind: interventionKindSchema,
|
|
3523
|
-
status:
|
|
3524
|
-
verdict:
|
|
3525
|
-
score:
|
|
3526
|
-
baselineScore:
|
|
3639
|
+
status: z35.enum(TRIAL_STATUSES),
|
|
3640
|
+
verdict: z35.enum(TRIAL_VERDICTS).nullable(),
|
|
3641
|
+
score: z35.number().nullable(),
|
|
3642
|
+
baselineScore: z35.number().nullable(),
|
|
3527
3643
|
/** Judged sessions behind `score`. */
|
|
3528
|
-
sessions:
|
|
3644
|
+
sessions: z35.number().int(),
|
|
3529
3645
|
/** Sessions that FAILED or TIMED_OUT; `score` leaves them out. */
|
|
3530
|
-
failedSessions:
|
|
3531
|
-
isBaseline:
|
|
3646
|
+
failedSessions: z35.number().int(),
|
|
3647
|
+
isBaseline: z35.boolean(),
|
|
3532
3648
|
/** The user marked this trial as the winner; it does not move the baseline. */
|
|
3533
|
-
adopted:
|
|
3534
|
-
adoptedAt:
|
|
3535
|
-
outcome:
|
|
3649
|
+
adopted: z35.boolean(),
|
|
3650
|
+
adoptedAt: z35.string().nullable(),
|
|
3651
|
+
outcome: z35.string().nullable(),
|
|
3536
3652
|
/** The kind-specific `after` payload (skill version id, pages, package). */
|
|
3537
|
-
after:
|
|
3538
|
-
before:
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3653
|
+
after: z35.unknown(),
|
|
3654
|
+
before: z35.unknown(),
|
|
3655
|
+
startingPoints: candidateStartsSchema.optional(),
|
|
3656
|
+
runs: z35.array(trialRunSchema),
|
|
3657
|
+
createdAt: z35.string()
|
|
3658
|
+
});
|
|
3659
|
+
var roundSchema = z35.object({
|
|
3660
|
+
id: z35.string(),
|
|
3661
|
+
number: z35.number().int(),
|
|
3662
|
+
status: z35.enum(ROUND_STATUSES),
|
|
3663
|
+
narrative: z35.string().nullable(),
|
|
3664
|
+
trials: z35.array(trialSchema)
|
|
3548
3665
|
});
|
|
3549
3666
|
var OPTIMIZATION_NEXT_ACTIONS = [
|
|
3550
3667
|
"START",
|
|
@@ -3555,355 +3672,356 @@ var OPTIMIZATION_NEXT_ACTIONS = [
|
|
|
3555
3672
|
"RESUME",
|
|
3556
3673
|
"NONE"
|
|
3557
3674
|
];
|
|
3558
|
-
var optimizationNextActionSchema =
|
|
3675
|
+
var optimizationNextActionSchema = z35.enum(OPTIMIZATION_NEXT_ACTIONS);
|
|
3559
3676
|
var optimizationDetailSchema = optimizationSummarySchema.extend({
|
|
3560
|
-
baselineTrialId:
|
|
3677
|
+
baselineTrialId: z35.string().nullable(),
|
|
3561
3678
|
/** The one thing a client does next. WAIT and NONE need nobody. */
|
|
3562
3679
|
nextAction: optimizationNextActionSchema,
|
|
3563
|
-
settings:
|
|
3564
|
-
sampleCount:
|
|
3565
|
-
maxRounds:
|
|
3566
|
-
maxTrialsPerRound:
|
|
3567
|
-
creditCap:
|
|
3568
|
-
targetScore:
|
|
3569
|
-
pinnedAgent:
|
|
3570
|
-
pinnedModel:
|
|
3571
|
-
continuedAtRound:
|
|
3680
|
+
settings: z35.object({
|
|
3681
|
+
sampleCount: z35.number().int(),
|
|
3682
|
+
maxRounds: z35.number().int(),
|
|
3683
|
+
maxTrialsPerRound: z35.number().int(),
|
|
3684
|
+
creditCap: z35.number().int(),
|
|
3685
|
+
targetScore: z35.number(),
|
|
3686
|
+
pinnedAgent: z35.string().nullable(),
|
|
3687
|
+
pinnedModel: z35.string().nullable(),
|
|
3688
|
+
continuedAtRound: z35.number().int().nullable()
|
|
3572
3689
|
}),
|
|
3573
3690
|
direction: climbDirectionSchema,
|
|
3574
|
-
rounds:
|
|
3691
|
+
rounds: z35.array(roundSchema)
|
|
3575
3692
|
});
|
|
3576
|
-
var optimizationHandoffSchema =
|
|
3577
|
-
trialId:
|
|
3578
|
-
trialKey:
|
|
3579
|
-
prompt:
|
|
3693
|
+
var optimizationHandoffSchema = z35.object({
|
|
3694
|
+
trialId: z35.string(),
|
|
3695
|
+
trialKey: z35.string(),
|
|
3696
|
+
prompt: z35.string()
|
|
3580
3697
|
});
|
|
3581
|
-
var listTrialsResponseSchema =
|
|
3582
|
-
items:
|
|
3698
|
+
var listTrialsResponseSchema = z35.object({
|
|
3699
|
+
items: z35.array(trialSchema)
|
|
3583
3700
|
});
|
|
3584
|
-
var trialDocumentSchema =
|
|
3585
|
-
path:
|
|
3586
|
-
before:
|
|
3587
|
-
after:
|
|
3701
|
+
var trialDocumentSchema = z35.object({
|
|
3702
|
+
path: z35.string(),
|
|
3703
|
+
before: z35.string(),
|
|
3704
|
+
after: z35.string()
|
|
3588
3705
|
});
|
|
3589
|
-
var trialContentSchema =
|
|
3590
|
-
trialId:
|
|
3706
|
+
var trialContentSchema = z35.object({
|
|
3707
|
+
trialId: z35.string(),
|
|
3591
3708
|
kind: interventionKindSchema,
|
|
3592
|
-
documents:
|
|
3709
|
+
documents: z35.array(trialDocumentSchema),
|
|
3593
3710
|
/** Full page bodies for a docs rewrite, ready to paste; null otherwise. */
|
|
3594
|
-
copyableBody:
|
|
3595
|
-
configSnapshot:
|
|
3711
|
+
copyableBody: z35.string().nullable(),
|
|
3712
|
+
configSnapshot: z35.unknown()
|
|
3596
3713
|
});
|
|
3597
|
-
var createTrialBodySchema =
|
|
3714
|
+
var createTrialBodySchema = z35.object({
|
|
3598
3715
|
trial: trialInputSchema,
|
|
3599
3716
|
files: overrideFilesSchema.optional(),
|
|
3600
|
-
fork:
|
|
3601
|
-
launch:
|
|
3717
|
+
fork: z35.object({ runId: z35.string().min(1), boundarySeq: z35.string().min(1) }).strict().optional(),
|
|
3718
|
+
launch: z35.boolean().default(false),
|
|
3602
3719
|
/** Replays return the trial the first call created instead of a second
|
|
3603
3720
|
* one. Scoped to the optimization. */
|
|
3604
|
-
idempotencyKey:
|
|
3721
|
+
idempotencyKey: z35.string().min(1).max(200).optional()
|
|
3605
3722
|
}).strict();
|
|
3606
|
-
var skillFilesResponseSchema =
|
|
3607
|
-
versionId:
|
|
3723
|
+
var skillFilesResponseSchema = z35.object({
|
|
3724
|
+
versionId: z35.string(),
|
|
3608
3725
|
files: overrideFilesSchema
|
|
3609
3726
|
});
|
|
3610
|
-
var pageBodyResponseSchema =
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3727
|
+
var pageBodyResponseSchema = z35.object({
|
|
3728
|
+
source: z35.string().optional(),
|
|
3729
|
+
url: z35.string(),
|
|
3730
|
+
body: z35.string(),
|
|
3731
|
+
contentType: z35.string().optional()
|
|
3614
3732
|
});
|
|
3615
|
-
var launchTrialResponseSchema =
|
|
3616
|
-
trialId:
|
|
3617
|
-
batchIds:
|
|
3618
|
-
runIds:
|
|
3733
|
+
var launchTrialResponseSchema = z35.object({
|
|
3734
|
+
trialId: z35.string(),
|
|
3735
|
+
batchIds: z35.array(z35.string()),
|
|
3736
|
+
runIds: z35.array(z35.string())
|
|
3619
3737
|
});
|
|
3620
|
-
var createDraftOptimizationBodySchema =
|
|
3738
|
+
var createDraftOptimizationBodySchema = z35.object({
|
|
3621
3739
|
subjectKind: climbSubjectKindSchema,
|
|
3622
|
-
subjectId:
|
|
3623
|
-
name:
|
|
3740
|
+
subjectId: z35.string().min(1),
|
|
3741
|
+
name: z35.string().trim().min(1).max(200).optional(),
|
|
3624
3742
|
...planShape,
|
|
3625
3743
|
target: targetSchema.optional(),
|
|
3626
|
-
autonomous:
|
|
3744
|
+
autonomous: z35.boolean().optional()
|
|
3627
3745
|
}).strict().superRefine(refinePlan);
|
|
3628
3746
|
var planPatchShape = {
|
|
3629
|
-
name:
|
|
3747
|
+
name: z35.string().trim().min(1).max(200).optional(),
|
|
3630
3748
|
...planShape,
|
|
3631
3749
|
target: targetSchema.optional()
|
|
3632
3750
|
};
|
|
3633
|
-
var optimizationPlanPatchSchema =
|
|
3634
|
-
var startDraftOptimizationBodySchema =
|
|
3751
|
+
var optimizationPlanPatchSchema = z35.object(planPatchShape).strict().superRefine(refinePlan);
|
|
3752
|
+
var startDraftOptimizationBodySchema = z35.object({
|
|
3635
3753
|
...planPatchShape,
|
|
3636
|
-
creditCap:
|
|
3754
|
+
creditCap: z35.number().int().nonnegative().optional()
|
|
3637
3755
|
}).strict().superRefine(refinePlan);
|
|
3638
|
-
var setModeBodySchema =
|
|
3639
|
-
var launchRoundResponseSchema =
|
|
3640
|
-
roundNumber:
|
|
3641
|
-
launched:
|
|
3756
|
+
var setModeBodySchema = z35.object({ autonomous: z35.boolean() }).strict();
|
|
3757
|
+
var launchRoundResponseSchema = z35.object({
|
|
3758
|
+
roundNumber: z35.number().int().nullable(),
|
|
3759
|
+
launched: z35.array(z35.string()),
|
|
3642
3760
|
/** True when nothing was left to launch: someone else got there first. */
|
|
3643
|
-
alreadyLaunched:
|
|
3761
|
+
alreadyLaunched: z35.boolean()
|
|
3644
3762
|
});
|
|
3645
|
-
var resolveChatResponseSchema =
|
|
3646
|
-
chatId:
|
|
3647
|
-
href:
|
|
3763
|
+
var resolveChatResponseSchema = z35.object({
|
|
3764
|
+
chatId: z35.string(),
|
|
3765
|
+
href: z35.string()
|
|
3648
3766
|
});
|
|
3649
|
-
var continueOptimizationBodySchema =
|
|
3650
|
-
rounds:
|
|
3651
|
-
maxTrialsPerRound:
|
|
3767
|
+
var continueOptimizationBodySchema = z35.object({
|
|
3768
|
+
rounds: z35.number().int().min(1).max(20).default(1),
|
|
3769
|
+
maxTrialsPerRound: z35.number().int().min(1).max(10).optional()
|
|
3652
3770
|
}).strict();
|
|
3653
|
-
var patchOptimizationBodySchema =
|
|
3771
|
+
var patchOptimizationBodySchema = z35.object({
|
|
3654
3772
|
...planPatchShape,
|
|
3655
3773
|
direction: climbDirectionPatchSchema.optional(),
|
|
3656
|
-
autonomous:
|
|
3774
|
+
autonomous: z35.boolean().optional()
|
|
3657
3775
|
}).strict().superRefine(refinePlan);
|
|
3658
3776
|
|
|
3659
3777
|
// ../packages/api-schemas/src/orgs.ts
|
|
3660
|
-
import { z as
|
|
3661
|
-
var createOrgRequestSchema =
|
|
3778
|
+
import { z as z36 } from "zod";
|
|
3779
|
+
var createOrgRequestSchema = z36.object({
|
|
3662
3780
|
/** Workspace display name; the slug is derived server-side. */
|
|
3663
|
-
name:
|
|
3781
|
+
name: z36.string().trim().min(1).max(200),
|
|
3664
3782
|
/** Optional company site (logo source; stamped onto the org). */
|
|
3665
|
-
website:
|
|
3783
|
+
website: z36.string().trim().max(300).optional()
|
|
3666
3784
|
});
|
|
3667
|
-
var createOrgResponseSchema =
|
|
3668
|
-
slug:
|
|
3669
|
-
name:
|
|
3785
|
+
var createOrgResponseSchema = z36.object({
|
|
3786
|
+
slug: z36.string(),
|
|
3787
|
+
name: z36.string(),
|
|
3670
3788
|
// LOCAL orgs never have a Gauge publicId.
|
|
3671
|
-
publicId:
|
|
3789
|
+
publicId: z36.string().nullable()
|
|
3672
3790
|
});
|
|
3673
|
-
var orgSettingsSchema =
|
|
3674
|
-
slug:
|
|
3675
|
-
name:
|
|
3676
|
-
publicId:
|
|
3677
|
-
website:
|
|
3791
|
+
var orgSettingsSchema = z36.object({
|
|
3792
|
+
slug: z36.string(),
|
|
3793
|
+
name: z36.string(),
|
|
3794
|
+
publicId: z36.string().nullable(),
|
|
3795
|
+
website: z36.string().nullable(),
|
|
3678
3796
|
/** Per-run max-spend override in USD; null = the server default. */
|
|
3679
|
-
maxSpendUsd:
|
|
3680
|
-
overageEnabled:
|
|
3797
|
+
maxSpendUsd: z36.number().nullable(),
|
|
3798
|
+
overageEnabled: z36.boolean(),
|
|
3681
3799
|
/** Per-cycle overage cap in credits; null = uncapped. */
|
|
3682
|
-
overageCapCredits:
|
|
3800
|
+
overageCapCredits: z36.number().int().nullable(),
|
|
3683
3801
|
/** Domain claimed for same-domain auto-join; null = off. */
|
|
3684
|
-
autoJoinDomain:
|
|
3802
|
+
autoJoinDomain: z36.string().nullable()
|
|
3685
3803
|
});
|
|
3686
|
-
var orgMemberSchema =
|
|
3687
|
-
userId:
|
|
3688
|
-
name:
|
|
3689
|
-
email:
|
|
3690
|
-
joinedAt:
|
|
3804
|
+
var orgMemberSchema = z36.object({
|
|
3805
|
+
userId: z36.string(),
|
|
3806
|
+
name: z36.string().nullable(),
|
|
3807
|
+
email: z36.string().nullable(),
|
|
3808
|
+
joinedAt: z36.string()
|
|
3691
3809
|
});
|
|
3692
|
-
var listMembersResponseSchema =
|
|
3693
|
-
items:
|
|
3810
|
+
var listMembersResponseSchema = z36.object({
|
|
3811
|
+
items: z36.array(orgMemberSchema)
|
|
3694
3812
|
});
|
|
3695
3813
|
|
|
3696
3814
|
// ../packages/api-schemas/src/personas.ts
|
|
3697
|
-
import { z as
|
|
3698
|
-
var personaSchema =
|
|
3699
|
-
id:
|
|
3700
|
-
name:
|
|
3701
|
-
description:
|
|
3815
|
+
import { z as z37 } from "zod";
|
|
3816
|
+
var personaSchema = z37.object({
|
|
3817
|
+
id: z37.string(),
|
|
3818
|
+
name: z37.string(),
|
|
3819
|
+
description: z37.string(),
|
|
3702
3820
|
/** The judge model this persona calls (Claude only). */
|
|
3703
|
-
model:
|
|
3704
|
-
createdAt:
|
|
3705
|
-
updatedAt:
|
|
3821
|
+
model: z37.string(),
|
|
3822
|
+
createdAt: z37.string(),
|
|
3823
|
+
updatedAt: z37.string()
|
|
3706
3824
|
});
|
|
3707
|
-
var listPersonasResponseSchema =
|
|
3708
|
-
items:
|
|
3825
|
+
var listPersonasResponseSchema = z37.object({
|
|
3826
|
+
items: z37.array(personaSchema)
|
|
3709
3827
|
});
|
|
3710
|
-
var createPersonaBodySchema =
|
|
3711
|
-
name:
|
|
3712
|
-
description:
|
|
3828
|
+
var createPersonaBodySchema = z37.object({
|
|
3829
|
+
name: z37.string().min(1).max(120),
|
|
3830
|
+
description: z37.string().min(1)
|
|
3713
3831
|
});
|
|
3714
|
-
var updatePersonaBodySchema =
|
|
3715
|
-
name:
|
|
3716
|
-
description:
|
|
3832
|
+
var updatePersonaBodySchema = z37.object({
|
|
3833
|
+
name: z37.string().min(1).max(120).optional(),
|
|
3834
|
+
description: z37.string().min(1).optional()
|
|
3717
3835
|
});
|
|
3718
3836
|
|
|
3719
3837
|
// ../packages/api-schemas/src/prompts.ts
|
|
3720
|
-
import { z as
|
|
3838
|
+
import { z as z40 } from "zod";
|
|
3721
3839
|
|
|
3722
3840
|
// ../packages/api-schemas/src/tags.ts
|
|
3723
|
-
import { z as
|
|
3724
|
-
var tagSchema =
|
|
3725
|
-
id:
|
|
3726
|
-
name:
|
|
3841
|
+
import { z as z38 } from "zod";
|
|
3842
|
+
var tagSchema = z38.object({
|
|
3843
|
+
id: z38.string(),
|
|
3844
|
+
name: z38.string(),
|
|
3727
3845
|
/** A Mantine palette name (e.g. "blue", "grape"); unknown values are
|
|
3728
3846
|
* normalized server-side to the default ("gray"). */
|
|
3729
|
-
color:
|
|
3847
|
+
color: z38.string()
|
|
3730
3848
|
});
|
|
3731
|
-
var createTagBodySchema =
|
|
3732
|
-
name:
|
|
3733
|
-
color:
|
|
3849
|
+
var createTagBodySchema = z38.object({
|
|
3850
|
+
name: z38.string().min(1),
|
|
3851
|
+
color: z38.string().optional()
|
|
3734
3852
|
});
|
|
3735
|
-
var updateTagBodySchema =
|
|
3736
|
-
name:
|
|
3737
|
-
color:
|
|
3853
|
+
var updateTagBodySchema = z38.object({
|
|
3854
|
+
name: z38.string().min(1).optional(),
|
|
3855
|
+
color: z38.string().optional()
|
|
3738
3856
|
});
|
|
3739
3857
|
var tagListResponseSchema = listResponseSchema(tagSchema);
|
|
3740
3858
|
|
|
3741
3859
|
// ../packages/api-schemas/src/topics.ts
|
|
3742
|
-
import { z as
|
|
3743
|
-
var topicSchema =
|
|
3744
|
-
id:
|
|
3745
|
-
name:
|
|
3860
|
+
import { z as z39 } from "zod";
|
|
3861
|
+
var topicSchema = z39.object({
|
|
3862
|
+
id: z39.string(),
|
|
3863
|
+
name: z39.string()
|
|
3746
3864
|
});
|
|
3747
|
-
var createTopicBodySchema =
|
|
3748
|
-
name:
|
|
3865
|
+
var createTopicBodySchema = z39.object({
|
|
3866
|
+
name: z39.string().min(1, "name is required")
|
|
3749
3867
|
});
|
|
3750
3868
|
var topicListResponseSchema = listResponseSchema(topicSchema);
|
|
3751
3869
|
|
|
3752
3870
|
// ../packages/api-schemas/src/prompts.ts
|
|
3753
|
-
var promptSummarySchema =
|
|
3754
|
-
id:
|
|
3755
|
-
text:
|
|
3756
|
-
isBranded:
|
|
3871
|
+
var promptSummarySchema = z40.object({
|
|
3872
|
+
id: z40.string(),
|
|
3873
|
+
text: z40.string(),
|
|
3874
|
+
isBranded: z40.boolean(),
|
|
3757
3875
|
/** Battery-spec identity (idempotent applies); null for UI/CLI-created prompts. */
|
|
3758
|
-
externalKey:
|
|
3876
|
+
externalKey: z40.string().nullable(),
|
|
3759
3877
|
topic: topicSchema.nullable(),
|
|
3760
|
-
tags:
|
|
3761
|
-
createdAt:
|
|
3878
|
+
tags: z40.array(tagSchema),
|
|
3879
|
+
createdAt: z40.string()
|
|
3762
3880
|
});
|
|
3763
3881
|
var promptListResponseSchema = listResponseSchema(promptSummarySchema);
|
|
3764
3882
|
var listPromptsQuerySchema = listQuerySchema.extend({
|
|
3765
|
-
topic:
|
|
3766
|
-
tag:
|
|
3767
|
-
q:
|
|
3768
|
-
});
|
|
3769
|
-
var createPromptBodySchema =
|
|
3770
|
-
text:
|
|
3771
|
-
isBranded:
|
|
3772
|
-
topic:
|
|
3773
|
-
tags:
|
|
3774
|
-
});
|
|
3775
|
-
var updatePromptBodySchema =
|
|
3776
|
-
text:
|
|
3777
|
-
isBranded:
|
|
3778
|
-
topicId:
|
|
3779
|
-
tags:
|
|
3780
|
-
});
|
|
3781
|
-
var runPromptBodySchema =
|
|
3883
|
+
topic: z40.string().min(1).optional(),
|
|
3884
|
+
tag: z40.string().min(1).optional(),
|
|
3885
|
+
q: z40.string().min(1).optional()
|
|
3886
|
+
});
|
|
3887
|
+
var createPromptBodySchema = z40.object({
|
|
3888
|
+
text: z40.string().min(1, "text is required"),
|
|
3889
|
+
isBranded: z40.boolean().default(false),
|
|
3890
|
+
topic: z40.string().min(1).optional(),
|
|
3891
|
+
tags: z40.array(z40.string().min(1)).default([])
|
|
3892
|
+
});
|
|
3893
|
+
var updatePromptBodySchema = z40.object({
|
|
3894
|
+
text: z40.string().min(1).optional(),
|
|
3895
|
+
isBranded: z40.boolean().optional(),
|
|
3896
|
+
topicId: z40.string().min(1).nullish(),
|
|
3897
|
+
tags: z40.array(z40.string().min(1)).optional()
|
|
3898
|
+
});
|
|
3899
|
+
var runPromptBodySchema = z40.object({
|
|
3782
3900
|
/** Preferred paired representation; each agent may pin its own model tiers. */
|
|
3783
|
-
agentConfigs:
|
|
3901
|
+
agentConfigs: z40.array(agentConfigInputSchema).min(1).optional(),
|
|
3784
3902
|
/** Legacy agent set (no per-agent pins), kept during the API transition. */
|
|
3785
|
-
agents:
|
|
3786
|
-
repoUrl:
|
|
3787
|
-
repoRef:
|
|
3788
|
-
samplesPerCycle:
|
|
3903
|
+
agents: z40.array(z40.enum(["CLAUDE_CODE", "CODEX_CLI", "CURSOR"])).min(1, "Select at least one agent").default(["CLAUDE_CODE", "CODEX_CLI"]),
|
|
3904
|
+
repoUrl: z40.string().min(1).nullish(),
|
|
3905
|
+
repoRef: z40.string().min(1).nullish(),
|
|
3906
|
+
samplesPerCycle: z40.number().int().min(1).max(10).default(1),
|
|
3789
3907
|
webFixture: webFixtureSchema.optional()
|
|
3790
3908
|
});
|
|
3791
|
-
var runPromptResponseSchema =
|
|
3792
|
-
batchIds:
|
|
3793
|
-
runIds:
|
|
3794
|
-
blocked:
|
|
3909
|
+
var runPromptResponseSchema = z40.object({
|
|
3910
|
+
batchIds: z40.array(z40.string()),
|
|
3911
|
+
runIds: z40.array(z40.string()),
|
|
3912
|
+
blocked: z40.enum(["insufficient_credits", "needs_provider_key"]).optional()
|
|
3795
3913
|
});
|
|
3796
3914
|
|
|
3797
3915
|
// ../packages/api-schemas/src/repos.ts
|
|
3798
|
-
import { z as
|
|
3916
|
+
import { z as z41 } from "zod";
|
|
3799
3917
|
var REPO_SIZE_BUCKETS = [
|
|
3800
3918
|
"small",
|
|
3801
3919
|
"medium",
|
|
3802
3920
|
"large",
|
|
3803
3921
|
"xlarge"
|
|
3804
3922
|
];
|
|
3805
|
-
var repoSizeBucketSchema =
|
|
3806
|
-
var repoSchema =
|
|
3807
|
-
url:
|
|
3808
|
-
name:
|
|
3809
|
-
isSystem:
|
|
3810
|
-
languages:
|
|
3811
|
-
frameworks:
|
|
3923
|
+
var repoSizeBucketSchema = z41.enum(REPO_SIZE_BUCKETS);
|
|
3924
|
+
var repoSchema = z41.object({
|
|
3925
|
+
url: z41.string(),
|
|
3926
|
+
name: z41.string(),
|
|
3927
|
+
isSystem: z41.boolean(),
|
|
3928
|
+
languages: z41.array(z41.string()),
|
|
3929
|
+
frameworks: z41.array(z41.string()),
|
|
3812
3930
|
/** Faceted labels (complexity:L2, buildable:yes, stack:nextjs, …). */
|
|
3813
|
-
tags:
|
|
3814
|
-
primaryLanguage:
|
|
3815
|
-
sizeKb:
|
|
3931
|
+
tags: z41.array(z41.string()),
|
|
3932
|
+
primaryLanguage: z41.string(),
|
|
3933
|
+
sizeKb: z41.number(),
|
|
3816
3934
|
sizeBucket: repoSizeBucketSchema.nullable(),
|
|
3817
|
-
stars:
|
|
3935
|
+
stars: z41.number()
|
|
3818
3936
|
});
|
|
3819
3937
|
var repoListResponseSchema = listResponseSchema(repoSchema);
|
|
3820
|
-
var addRepoBodySchema =
|
|
3821
|
-
url:
|
|
3938
|
+
var addRepoBodySchema = z41.object({
|
|
3939
|
+
url: z41.string().min(1, "url is required"),
|
|
3822
3940
|
/**
|
|
3823
3941
|
* Reserved (accepted, not yet persisted): the catalog keys repos by URL only
|
|
3824
3942
|
* — `fact_repo` has no ref column and metadata sync always reads the default
|
|
3825
3943
|
* branch. Kept in the wire format so `gauge repos add --ref` is stable once
|
|
3826
3944
|
* the catalog learns refs.
|
|
3827
3945
|
*/
|
|
3828
|
-
ref:
|
|
3946
|
+
ref: z41.string().min(1).optional(),
|
|
3829
3947
|
/** Display name; defaults to the `owner/repo` label of the URL. */
|
|
3830
|
-
name:
|
|
3948
|
+
name: z41.string().min(1).optional(),
|
|
3831
3949
|
/** Manual override; defaults to frameworks detected from the repo's manifests. */
|
|
3832
|
-
frameworks:
|
|
3833
|
-
tags:
|
|
3950
|
+
frameworks: z41.array(z41.string()).optional(),
|
|
3951
|
+
tags: z41.array(z41.string()).optional()
|
|
3834
3952
|
});
|
|
3835
|
-
var updateRepoBodySchema =
|
|
3836
|
-
url:
|
|
3837
|
-
name:
|
|
3838
|
-
frameworks:
|
|
3839
|
-
tags:
|
|
3953
|
+
var updateRepoBodySchema = z41.object({
|
|
3954
|
+
url: z41.string().min(1, "url is required"),
|
|
3955
|
+
name: z41.string().min(1).optional(),
|
|
3956
|
+
frameworks: z41.array(z41.string()).optional(),
|
|
3957
|
+
tags: z41.array(z41.string()).optional()
|
|
3840
3958
|
});
|
|
3841
|
-
var resyncRepoBodySchema =
|
|
3842
|
-
url:
|
|
3959
|
+
var resyncRepoBodySchema = z41.object({
|
|
3960
|
+
url: z41.string().min(1, "url is required")
|
|
3843
3961
|
});
|
|
3844
|
-
var deleteRepoQuerySchema =
|
|
3845
|
-
url:
|
|
3962
|
+
var deleteRepoQuerySchema = z41.object({
|
|
3963
|
+
url: z41.string().min(1, "url is required")
|
|
3846
3964
|
});
|
|
3847
|
-
var repoSyncResultSchema =
|
|
3965
|
+
var repoSyncResultSchema = z41.object({
|
|
3848
3966
|
repo: repoSchema,
|
|
3849
|
-
synced:
|
|
3967
|
+
synced: z41.boolean()
|
|
3850
3968
|
});
|
|
3851
3969
|
|
|
3852
3970
|
// ../packages/api-schemas/src/runAddons.ts
|
|
3853
|
-
import { z as
|
|
3854
|
-
var runAddonsSchema =
|
|
3855
|
-
browser:
|
|
3856
|
-
session:
|
|
3857
|
-
projectId:
|
|
3858
|
-
region:
|
|
3971
|
+
import { z as z42 } from "zod";
|
|
3972
|
+
var runAddonsSchema = z42.object({
|
|
3973
|
+
browser: z42.object({
|
|
3974
|
+
session: z42.string().min(1),
|
|
3975
|
+
projectId: z42.number().int().positive(),
|
|
3976
|
+
region: z42.literal("us").default("us")
|
|
3859
3977
|
}).strict().optional()
|
|
3860
3978
|
}).strict();
|
|
3861
3979
|
|
|
3862
3980
|
// ../packages/api-schemas/src/runDefinitions.ts
|
|
3863
|
-
import { z as
|
|
3981
|
+
import { z as z46 } from "zod";
|
|
3864
3982
|
|
|
3865
3983
|
// ../packages/api-schemas/src/preference.ts
|
|
3866
|
-
import { z as
|
|
3867
|
-
var preferenceDefinitionSchema =
|
|
3868
|
-
|
|
3869
|
-
kind:
|
|
3870
|
-
branded:
|
|
3984
|
+
import { z as z43 } from "zod";
|
|
3985
|
+
var preferenceDefinitionSchema = z43.discriminatedUnion("kind", [
|
|
3986
|
+
z43.object({
|
|
3987
|
+
kind: z43.literal("open-ended"),
|
|
3988
|
+
branded: z43.boolean().default(false)
|
|
3871
3989
|
}).strict(),
|
|
3872
|
-
|
|
3873
|
-
kind:
|
|
3874
|
-
brandA:
|
|
3875
|
-
brandB:
|
|
3990
|
+
z43.object({
|
|
3991
|
+
kind: z43.literal("head-to-head"),
|
|
3992
|
+
brandA: z43.string().trim().min(1),
|
|
3993
|
+
brandB: z43.string().trim().min(1)
|
|
3876
3994
|
}).strict().refine(
|
|
3877
3995
|
(p) => p.brandA.toLowerCase() !== p.brandB.toLowerCase(),
|
|
3878
3996
|
"A head-to-head needs two different brands"
|
|
3879
3997
|
)
|
|
3880
3998
|
]);
|
|
3881
|
-
var preferenceSnapshotSchema =
|
|
3882
|
-
var headToHeadSchema =
|
|
3883
|
-
kind:
|
|
3884
|
-
winner:
|
|
3885
|
-
brandA:
|
|
3886
|
-
brandB:
|
|
3887
|
-
rationale:
|
|
3888
|
-
brandAReasoning:
|
|
3889
|
-
brandBReasoning:
|
|
3890
|
-
brandAWhyRaised:
|
|
3891
|
-
brandBWhyRaised:
|
|
3892
|
-
});
|
|
3893
|
-
var recommendPickSchema =
|
|
3894
|
-
brand:
|
|
3895
|
-
rank:
|
|
3896
|
-
adopted:
|
|
3897
|
-
reasoning:
|
|
3898
|
-
whyRaised:
|
|
3899
|
-
});
|
|
3900
|
-
var recommendSchema =
|
|
3901
|
-
kind:
|
|
3902
|
-
picks:
|
|
3903
|
-
singlePick:
|
|
3904
|
-
complianceNote:
|
|
3905
|
-
});
|
|
3906
|
-
var visibilityVerdictSchema =
|
|
3999
|
+
var preferenceSnapshotSchema = z43.object({ version: z43.literal(1), preference: preferenceDefinitionSchema }).strict();
|
|
4000
|
+
var headToHeadSchema = z43.object({
|
|
4001
|
+
kind: z43.literal("HEAD_TO_HEAD"),
|
|
4002
|
+
winner: z43.enum(["A", "B", "neither"]),
|
|
4003
|
+
brandA: z43.string(),
|
|
4004
|
+
brandB: z43.string(),
|
|
4005
|
+
rationale: z43.string(),
|
|
4006
|
+
brandAReasoning: z43.string(),
|
|
4007
|
+
brandBReasoning: z43.string(),
|
|
4008
|
+
brandAWhyRaised: z43.string().optional(),
|
|
4009
|
+
brandBWhyRaised: z43.string().optional()
|
|
4010
|
+
});
|
|
4011
|
+
var recommendPickSchema = z43.object({
|
|
4012
|
+
brand: z43.string(),
|
|
4013
|
+
rank: z43.number().int(),
|
|
4014
|
+
adopted: z43.boolean(),
|
|
4015
|
+
reasoning: z43.string().optional(),
|
|
4016
|
+
whyRaised: z43.string().optional()
|
|
4017
|
+
});
|
|
4018
|
+
var recommendSchema = z43.object({
|
|
4019
|
+
kind: z43.literal("RECOMMEND"),
|
|
4020
|
+
picks: z43.array(recommendPickSchema).default([]),
|
|
4021
|
+
singlePick: z43.boolean(),
|
|
4022
|
+
complianceNote: z43.string()
|
|
4023
|
+
});
|
|
4024
|
+
var visibilityVerdictSchema = z43.discriminatedUnion("kind", [
|
|
3907
4025
|
headToHeadSchema,
|
|
3908
4026
|
recommendSchema
|
|
3909
4027
|
]);
|
|
@@ -3916,59 +4034,59 @@ function preferenceSelectionLabel(verdict) {
|
|
|
3916
4034
|
}
|
|
3917
4035
|
|
|
3918
4036
|
// ../packages/api-schemas/src/runDefinitionInputs.ts
|
|
3919
|
-
import { z as
|
|
4037
|
+
import { z as z45 } from "zod";
|
|
3920
4038
|
|
|
3921
4039
|
// ../packages/api-schemas/src/runPlan.ts
|
|
3922
|
-
import { z as
|
|
3923
|
-
var runPlanCriterionSchema =
|
|
3924
|
-
id:
|
|
3925
|
-
name:
|
|
3926
|
-
rubric:
|
|
4040
|
+
import { z as z44 } from "zod";
|
|
4041
|
+
var runPlanCriterionSchema = z44.object({
|
|
4042
|
+
id: z44.string().min(1),
|
|
4043
|
+
name: z44.string(),
|
|
4044
|
+
rubric: z44.string()
|
|
3927
4045
|
});
|
|
3928
|
-
var criteriaSnapshotV1Schema =
|
|
3929
|
-
version:
|
|
4046
|
+
var criteriaSnapshotV1Schema = z44.object({
|
|
4047
|
+
version: z44.literal(1),
|
|
3930
4048
|
// File-authored criteria have no saved EvalSet; their identity is frozen
|
|
3931
4049
|
// in the request and result rows retain the criterion text without an FK.
|
|
3932
|
-
evalSetId:
|
|
3933
|
-
criteria:
|
|
3934
|
-
});
|
|
3935
|
-
var runPlanCaseSchema =
|
|
3936
|
-
id:
|
|
3937
|
-
prompt:
|
|
3938
|
-
workspace:
|
|
3939
|
-
repoUrl:
|
|
3940
|
-
repoRef:
|
|
4050
|
+
evalSetId: z44.string().min(1).nullable(),
|
|
4051
|
+
criteria: z44.array(runPlanCriterionSchema)
|
|
4052
|
+
});
|
|
4053
|
+
var runPlanCaseSchema = z44.object({
|
|
4054
|
+
id: z44.string().min(1),
|
|
4055
|
+
prompt: z44.object({ id: z44.string().min(1), text: z44.string() }),
|
|
4056
|
+
workspace: z44.object({
|
|
4057
|
+
repoUrl: z44.string().nullable(),
|
|
4058
|
+
repoRef: z44.string().nullable()
|
|
3941
4059
|
}),
|
|
3942
|
-
agents:
|
|
4060
|
+
agents: z44.array(
|
|
3943
4061
|
agentConfigSchema.extend({
|
|
3944
4062
|
// Validated against the current catalog request schema when lowered.
|
|
3945
|
-
catalogSelections:
|
|
4063
|
+
catalogSelections: z44.record(z44.string(), z44.unknown()).optional()
|
|
3946
4064
|
})
|
|
3947
4065
|
),
|
|
3948
|
-
samples:
|
|
3949
|
-
evalSetId:
|
|
4066
|
+
samples: z44.number().int().min(1).max(50),
|
|
4067
|
+
evalSetId: z44.string().min(1).optional(),
|
|
3950
4068
|
criteriaSnapshot: criteriaSnapshotV1Schema.optional(),
|
|
3951
4069
|
preferenceSnapshot: preferenceSnapshotSchema.optional(),
|
|
3952
|
-
sourceRepoCommit:
|
|
3953
|
-
experiment:
|
|
3954
|
-
membershipTagIds:
|
|
3955
|
-
profile:
|
|
3956
|
-
id:
|
|
3957
|
-
name:
|
|
3958
|
-
description:
|
|
3959
|
-
model:
|
|
4070
|
+
sourceRepoCommit: z44.string().nullable().optional(),
|
|
4071
|
+
experiment: z44.string().nullable().optional(),
|
|
4072
|
+
membershipTagIds: z44.array(z44.string()).optional(),
|
|
4073
|
+
profile: z44.object({
|
|
4074
|
+
id: z44.string(),
|
|
4075
|
+
name: z44.string(),
|
|
4076
|
+
description: z44.string(),
|
|
4077
|
+
model: z44.string()
|
|
3960
4078
|
}).nullable().optional(),
|
|
3961
4079
|
skillSet: skillSetSchema.optional(),
|
|
3962
4080
|
mcpSet: mcpSetSchema.optional(),
|
|
3963
4081
|
connectionSet: connectionSetSchema.optional(),
|
|
3964
4082
|
// The server's agentContextSnapshotV1Schema validates this at lowering.
|
|
3965
|
-
agentContext:
|
|
3966
|
-
agentContextDigest:
|
|
4083
|
+
agentContext: z44.unknown().optional(),
|
|
4084
|
+
agentContextDigest: z44.string().nullable().optional(),
|
|
3967
4085
|
addons: runAddonsSchema.optional(),
|
|
3968
4086
|
/** Names of resources the coordinator must prepare before expansion. */
|
|
3969
|
-
inputs:
|
|
4087
|
+
inputs: z44.array(z44.string().min(1)).default([])
|
|
3970
4088
|
});
|
|
3971
|
-
var inputPathSchema =
|
|
4089
|
+
var inputPathSchema = z44.string().min(1).max(256).regex(
|
|
3972
4090
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: Reject unsafe control characters in authored paths.
|
|
3973
4091
|
/^(?![!/])(?!.*[\\\x00-\x1f\x7f])(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*\/\/)(?!.*\/$).+$/,
|
|
3974
4092
|
"Expected a repository-relative path or glob without traversal"
|
|
@@ -4003,20 +4121,20 @@ var reservedBinaryCommands = [
|
|
|
4003
4121
|
"pi",
|
|
4004
4122
|
"wizard"
|
|
4005
4123
|
];
|
|
4006
|
-
var binaryCommandSchema =
|
|
4124
|
+
var binaryCommandSchema = z44.string().max(128).regex(
|
|
4007
4125
|
/^[A-Za-z0-9_][A-Za-z0-9_.+-]*$/,
|
|
4008
4126
|
"Expected a command name without paths or shell syntax"
|
|
4009
4127
|
).refine(
|
|
4010
4128
|
(name) => !reservedBinaryCommands.includes(name),
|
|
4011
4129
|
"Command is reserved for Gauge workspace setup or the agent harness; choose another command name"
|
|
4012
4130
|
);
|
|
4013
|
-
var binaryUseSchema =
|
|
4014
|
-
type:
|
|
4015
|
-
paths:
|
|
4016
|
-
platform:
|
|
4131
|
+
var binaryUseSchema = z44.object({
|
|
4132
|
+
type: z44.literal("binary"),
|
|
4133
|
+
paths: z44.array(inputPathSchema).min(1).max(32),
|
|
4134
|
+
platform: z44.literal("linux-x64").describe(
|
|
4017
4135
|
"Linux x86-64 ELF executables compatible with the consumer sandbox. No system packages are installed."
|
|
4018
4136
|
),
|
|
4019
|
-
commands:
|
|
4137
|
+
commands: z44.record(
|
|
4020
4138
|
binaryCommandSchema,
|
|
4021
4139
|
inputPathSchema.regex(
|
|
4022
4140
|
/^[^*?{}[\]]+$/,
|
|
@@ -4027,111 +4145,118 @@ var binaryUseSchema = z42.object({
|
|
|
4027
4145
|
"Declare between 1 and 32 commands"
|
|
4028
4146
|
).meta({ minProperties: 1, maxProperties: 32 })
|
|
4029
4147
|
}).strict();
|
|
4030
|
-
var inputUseSchema =
|
|
4148
|
+
var inputUseSchema = z44.discriminatedUnion("type", [
|
|
4031
4149
|
binaryUseSchema,
|
|
4032
4150
|
websiteUseSchema,
|
|
4033
|
-
|
|
4034
|
-
type:
|
|
4035
|
-
paths:
|
|
4151
|
+
z44.object({
|
|
4152
|
+
type: z44.literal("files"),
|
|
4153
|
+
paths: z44.array(inputPathSchema).min(1).max(32).optional()
|
|
4036
4154
|
}).strict(),
|
|
4037
|
-
|
|
4038
|
-
type:
|
|
4155
|
+
z44.object({
|
|
4156
|
+
type: z44.literal("npm-cli"),
|
|
4039
4157
|
package: inputPathSchema,
|
|
4040
|
-
install:
|
|
4158
|
+
install: z44.enum(["environment", "workspace"]).optional()
|
|
4041
4159
|
}).strict(),
|
|
4042
|
-
|
|
4043
|
-
type:
|
|
4160
|
+
z44.object({
|
|
4161
|
+
type: z44.literal("npm-package"),
|
|
4044
4162
|
package: inputPathSchema,
|
|
4045
|
-
install:
|
|
4163
|
+
install: z44.enum(["environment", "workspace"]).optional()
|
|
4046
4164
|
}).strict(),
|
|
4047
|
-
|
|
4048
|
-
type:
|
|
4049
|
-
root:
|
|
4165
|
+
z44.object({
|
|
4166
|
+
type: z44.literal("skill"),
|
|
4167
|
+
root: z44.union([z44.literal("."), inputPathSchema]).refine(
|
|
4050
4168
|
(path3) => !/[*?{}[\]]/.test(path3),
|
|
4051
4169
|
"Skill root must be an explicit directory"
|
|
4052
4170
|
)
|
|
4053
4171
|
}).strict()
|
|
4054
4172
|
]);
|
|
4055
|
-
var inputSourceSchema =
|
|
4056
|
-
|
|
4057
|
-
type:
|
|
4058
|
-
paths:
|
|
4173
|
+
var inputSourceSchema = z44.discriminatedUnion("type", [
|
|
4174
|
+
z44.object({
|
|
4175
|
+
type: z44.literal("git"),
|
|
4176
|
+
paths: z44.array(inputPathSchema).min(1).max(32)
|
|
4059
4177
|
}).strict(),
|
|
4060
|
-
|
|
4061
|
-
type:
|
|
4178
|
+
z44.object({
|
|
4179
|
+
type: z44.literal("github-actions"),
|
|
4062
4180
|
// Omit to discover the sole artifact from the selected workflow run.
|
|
4063
4181
|
// Names are supplied by CI and need not encode the PR head revision.
|
|
4064
|
-
artifact:
|
|
4182
|
+
artifact: z44.string().min(1).max(256).optional()
|
|
4065
4183
|
}).strict()
|
|
4066
4184
|
]);
|
|
4067
|
-
var runPlanResourceSchema =
|
|
4068
|
-
name:
|
|
4069
|
-
type:
|
|
4070
|
-
source:
|
|
4185
|
+
var runPlanResourceSchema = z44.object({
|
|
4186
|
+
name: z44.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
4187
|
+
type: z44.literal("input"),
|
|
4188
|
+
source: z44.discriminatedUnion("type", [
|
|
4189
|
+
z44.object({
|
|
4190
|
+
type: z44.literal("upload"),
|
|
4191
|
+
sha256: z44.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4192
|
+
bytes: z44.number().int().positive().max(512 * 1024 * 1024),
|
|
4193
|
+
repoUrl: z44.string().nullable(),
|
|
4194
|
+
commit: z44.string().regex(/^[a-f0-9]{40}$/i).nullable()
|
|
4195
|
+
}).strict(),
|
|
4071
4196
|
commentSourceSchema.extend({
|
|
4072
|
-
repoUrl:
|
|
4073
|
-
commit:
|
|
4197
|
+
repoUrl: z44.string(),
|
|
4198
|
+
commit: z44.string().regex(/^[a-f0-9]{40}$/i)
|
|
4074
4199
|
}).strict(),
|
|
4075
4200
|
deploymentSourceSchema.extend({
|
|
4076
|
-
repoUrl:
|
|
4077
|
-
commit:
|
|
4201
|
+
repoUrl: z44.string(),
|
|
4202
|
+
commit: z44.string().regex(/^[a-f0-9]{40}$/i)
|
|
4078
4203
|
}).strict(),
|
|
4079
4204
|
inputSourceSchema.options[0].extend({
|
|
4080
|
-
repoUrl:
|
|
4081
|
-
commit:
|
|
4205
|
+
repoUrl: z44.string(),
|
|
4206
|
+
commit: z44.string().regex(/^[a-f0-9]{40}$/i)
|
|
4082
4207
|
}).strict(),
|
|
4083
4208
|
inputSourceSchema.options[1].extend({
|
|
4084
|
-
repoUrl:
|
|
4085
|
-
commit:
|
|
4209
|
+
repoUrl: z44.string(),
|
|
4210
|
+
commit: z44.string().regex(/^[a-f0-9]{40}$/i),
|
|
4086
4211
|
workflow: inputPathSchema
|
|
4087
4212
|
}).strict()
|
|
4088
4213
|
]),
|
|
4089
4214
|
use: inputUseSchema
|
|
4090
4215
|
}).strict().refine(
|
|
4091
4216
|
(r) => r.use.type === "website" === (r.source.type === "github-deployment" || r.source.type === "github-pr-comment"),
|
|
4092
|
-
"Website inputs require a deployment or PR comment source; file inputs require
|
|
4217
|
+
"Website inputs require a deployment or PR comment source; file inputs require Git, Actions, or an upload"
|
|
4093
4218
|
);
|
|
4094
|
-
var runPlanSchema =
|
|
4095
|
-
version:
|
|
4219
|
+
var runPlanSchema = z44.object({
|
|
4220
|
+
version: z44.literal(1),
|
|
4096
4221
|
/** Existing launches keep their current measurement semantics. */
|
|
4097
|
-
measurementMode:
|
|
4222
|
+
measurementMode: z44.enum([
|
|
4098
4223
|
"EXISTING",
|
|
4099
4224
|
"AGENT_EXPERIENCE",
|
|
4100
4225
|
"AGENT_PREFERENCE",
|
|
4101
4226
|
"MIXED"
|
|
4102
4227
|
]),
|
|
4103
|
-
cases:
|
|
4104
|
-
resources:
|
|
4228
|
+
cases: z44.array(runPlanCaseSchema).min(1),
|
|
4229
|
+
resources: z44.array(runPlanResourceSchema).default([]),
|
|
4105
4230
|
/** Server-populated context retained across deferred preparation. */
|
|
4106
|
-
launch:
|
|
4107
|
-
origin:
|
|
4108
|
-
|
|
4109
|
-
initiator:
|
|
4110
|
-
userId:
|
|
4111
|
-
email:
|
|
4231
|
+
launch: z44.object({
|
|
4232
|
+
origin: z44.discriminatedUnion("initiator", [
|
|
4233
|
+
z44.object({
|
|
4234
|
+
initiator: z44.literal("API"),
|
|
4235
|
+
userId: z44.string().min(1),
|
|
4236
|
+
email: z44.string().nullable()
|
|
4112
4237
|
}).strict(),
|
|
4113
|
-
|
|
4114
|
-
initiator:
|
|
4115
|
-
userId:
|
|
4116
|
-
email:
|
|
4238
|
+
z44.object({
|
|
4239
|
+
initiator: z44.literal("GITHUB"),
|
|
4240
|
+
userId: z44.null(),
|
|
4241
|
+
email: z44.null()
|
|
4117
4242
|
}).strict()
|
|
4118
4243
|
]),
|
|
4119
|
-
funding:
|
|
4120
|
-
queueClass:
|
|
4244
|
+
funding: z44.enum(["ORG", "PLATFORM"]),
|
|
4245
|
+
queueClass: z44.literal("INTERACTIVE")
|
|
4121
4246
|
}).strict().optional(),
|
|
4122
|
-
provenance:
|
|
4123
|
-
definition:
|
|
4124
|
-
repoUrl:
|
|
4125
|
-
commit:
|
|
4126
|
-
digest:
|
|
4247
|
+
provenance: z44.object({
|
|
4248
|
+
definition: z44.object({
|
|
4249
|
+
repoUrl: z44.string().min(1).nullable(),
|
|
4250
|
+
commit: z44.string().regex(/^[a-f0-9]{40}$/i).nullable(),
|
|
4251
|
+
digest: z44.string().min(1),
|
|
4127
4252
|
/** File submissions are asserted by the caller until server-side
|
|
4128
4253
|
* committed-byte fetching is available. */
|
|
4129
|
-
verification:
|
|
4254
|
+
verification: z44.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED", "LOCAL"]).optional()
|
|
4130
4255
|
}).optional(),
|
|
4131
|
-
liveDependencies:
|
|
4132
|
-
|
|
4133
|
-
name:
|
|
4134
|
-
url:
|
|
4256
|
+
liveDependencies: z44.array(
|
|
4257
|
+
z44.object({
|
|
4258
|
+
name: z44.string().min(1),
|
|
4259
|
+
url: z44.string().url().optional()
|
|
4135
4260
|
})
|
|
4136
4261
|
).default([])
|
|
4137
4262
|
})
|
|
@@ -4203,43 +4328,43 @@ var runPlanSchema = z42.object({
|
|
|
4203
4328
|
});
|
|
4204
4329
|
|
|
4205
4330
|
// ../packages/api-schemas/src/runDefinitionInputs.ts
|
|
4206
|
-
var definitionInputSourceSchema =
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
type:
|
|
4331
|
+
var definitionInputSourceSchema = z45.discriminatedUnion("type", [
|
|
4332
|
+
z45.object({ type: z45.literal("git") }).strict(),
|
|
4333
|
+
z45.object({
|
|
4334
|
+
type: z45.literal("github-actions"),
|
|
4210
4335
|
workflow: inputPathSchema.regex(/^\.github\/workflows\/[^/*?{}[\]]+\.ya?ml$/).describe(
|
|
4211
4336
|
"Workflow file in this repository, for example .github/workflows/build.yml."
|
|
4212
4337
|
),
|
|
4213
|
-
artifact:
|
|
4338
|
+
artifact: z45.string().min(1).max(256).optional().describe(
|
|
4214
4339
|
"Upload name or pattern. Omit only when the workflow produces exactly one artifact."
|
|
4215
4340
|
)
|
|
4216
4341
|
}).strict()
|
|
4217
4342
|
]);
|
|
4218
|
-
var skillInputPathSchema =
|
|
4343
|
+
var skillInputPathSchema = z45.union([z45.literal("."), inputPathSchema.regex(/^[^*?{}[\]]+$/)]).describe(
|
|
4219
4344
|
"Explicit Skill directory or ZIP/tar.gz file containing SKILL.md at its root."
|
|
4220
4345
|
);
|
|
4221
|
-
var runDefinitionInputSchema =
|
|
4222
|
-
binaryUseSchema.extend({ source: definitionInputSourceSchema }).strict(),
|
|
4346
|
+
var runDefinitionInputSchema = z45.discriminatedUnion("type", [
|
|
4347
|
+
binaryUseSchema.extend({ source: definitionInputSourceSchema.default({ type: "git" }) }).strict(),
|
|
4223
4348
|
websiteUseSchema.extend({ source: websiteSourceSchema }).strict(),
|
|
4224
|
-
|
|
4225
|
-
type:
|
|
4226
|
-
source: definitionInputSourceSchema,
|
|
4349
|
+
z45.object({
|
|
4350
|
+
type: z45.literal("npm-package"),
|
|
4351
|
+
source: definitionInputSourceSchema.default({ type: "git" }),
|
|
4227
4352
|
path: inputPathSchema.describe(
|
|
4228
4353
|
"Path or glob selecting exactly one packed npm .tgz file."
|
|
4229
4354
|
),
|
|
4230
|
-
install:
|
|
4355
|
+
install: z45.enum(["environment", "workspace"]).default("environment").describe(
|
|
4231
4356
|
"environment exposes the package's commands on PATH; workspace adds a consumer application dependency."
|
|
4232
4357
|
)
|
|
4233
4358
|
}).strict(),
|
|
4234
|
-
|
|
4235
|
-
type:
|
|
4236
|
-
source: definitionInputSourceSchema,
|
|
4359
|
+
z45.object({
|
|
4360
|
+
type: z45.literal("skill"),
|
|
4361
|
+
source: definitionInputSourceSchema.default({ type: "git" }),
|
|
4237
4362
|
path: skillInputPathSchema
|
|
4238
4363
|
}).strict(),
|
|
4239
|
-
|
|
4240
|
-
type:
|
|
4241
|
-
source: definitionInputSourceSchema,
|
|
4242
|
-
paths:
|
|
4364
|
+
z45.object({
|
|
4365
|
+
type: z45.literal("files"),
|
|
4366
|
+
source: definitionInputSourceSchema.default({ type: "git" }),
|
|
4367
|
+
paths: z45.array(inputPathSchema).min(1).max(32).describe(
|
|
4243
4368
|
"Files or globs selected from the committed Git tree or the uploaded artifact."
|
|
4244
4369
|
)
|
|
4245
4370
|
}).strict()
|
|
@@ -4273,7 +4398,11 @@ function compileDefinitionInput(name, input, repoUrl, commit) {
|
|
|
4273
4398
|
}
|
|
4274
4399
|
|
|
4275
4400
|
// ../packages/api-schemas/src/runDefinitions.ts
|
|
4276
|
-
var
|
|
4401
|
+
var inputUploadSpecSchema = z46.object({
|
|
4402
|
+
sha256: z46.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4403
|
+
bytes: z46.number().int().positive().max(512 * 1024 * 1024)
|
|
4404
|
+
}).strict();
|
|
4405
|
+
var uncredentialedRepoUrlSchema = z46.string().min(1).refine((raw) => {
|
|
4277
4406
|
if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(raw)) return true;
|
|
4278
4407
|
try {
|
|
4279
4408
|
const url = new URL(raw);
|
|
@@ -4282,68 +4411,84 @@ var uncredentialedRepoUrlSchema = z44.string().min(1).refine((raw) => {
|
|
|
4282
4411
|
return false;
|
|
4283
4412
|
}
|
|
4284
4413
|
}, "Repository URL must not contain embedded credentials or query parameters");
|
|
4285
|
-
var runDefinitionChecksSchema =
|
|
4286
|
-
var runDefinitionConfigSchema =
|
|
4287
|
-
agents:
|
|
4288
|
-
sampleCount:
|
|
4414
|
+
var runDefinitionChecksSchema = z46.object({ paths: z46.array(inputPathSchema).min(1).max(32) }).strict();
|
|
4415
|
+
var runDefinitionConfigSchema = z46.object({
|
|
4416
|
+
agents: z46.array(agentConfigInputSchema).min(1),
|
|
4417
|
+
sampleCount: z46.number().int().min(1).max(50).optional(),
|
|
4289
4418
|
repoUrl: uncredentialedRepoUrlSchema.nullable().optional(),
|
|
4290
|
-
repoRef:
|
|
4291
|
-
profileId:
|
|
4419
|
+
repoRef: z46.string().min(1).nullable().optional(),
|
|
4420
|
+
profileId: z46.string().min(1).nullable().optional(),
|
|
4292
4421
|
skillRefs: assetRefListSchema.optional(),
|
|
4293
4422
|
mcpRefs: assetRefListSchema.optional(),
|
|
4294
|
-
connectionIds:
|
|
4423
|
+
connectionIds: z46.array(z46.string().min(1)).max(32).optional(),
|
|
4295
4424
|
addons: runAddonsSchema.optional(),
|
|
4296
|
-
inputs:
|
|
4425
|
+
inputs: z46.array(z46.string()).optional(),
|
|
4297
4426
|
checks: runDefinitionChecksSchema.optional()
|
|
4298
4427
|
}).strict();
|
|
4299
|
-
var runDefinitionFileConfigSchema =
|
|
4300
|
-
version:
|
|
4301
|
-
org:
|
|
4428
|
+
var runDefinitionFileConfigSchema = z46.object({
|
|
4429
|
+
version: z46.literal(2).default(2),
|
|
4430
|
+
org: z46.string().min(1).optional(),
|
|
4302
4431
|
checks: runDefinitionChecksSchema.optional(),
|
|
4303
|
-
cases:
|
|
4304
|
-
inputs:
|
|
4305
|
-
|
|
4432
|
+
cases: z46.array(inputPathSchema).min(1).max(32).default(["gauge-evals/**/*.md"]),
|
|
4433
|
+
inputs: z46.record(
|
|
4434
|
+
z46.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
4306
4435
|
runDefinitionInputSchema
|
|
4307
4436
|
).refine(
|
|
4308
4437
|
(inputs) => Object.keys(inputs).length <= 32,
|
|
4309
4438
|
"At most 32 inputs are allowed"
|
|
4310
4439
|
).meta({ maxProperties: 32 }).default({})
|
|
4311
4440
|
}).strict();
|
|
4312
|
-
var runDefinitionCriterionSchema =
|
|
4441
|
+
var runDefinitionCriterionSchema = z46.object({ name: z46.string().min(1), rubric: z46.string().min(1) }).strict();
|
|
4313
4442
|
var caseMeasurement = {
|
|
4314
|
-
criteria:
|
|
4443
|
+
criteria: z46.array(runDefinitionCriterionSchema).min(1).optional(),
|
|
4315
4444
|
preference: preferenceDefinitionSchema.optional()
|
|
4316
4445
|
};
|
|
4317
4446
|
function exactlyOneMeasurement(item) {
|
|
4318
4447
|
return item.criteria !== void 0 !== (item.preference !== void 0);
|
|
4319
4448
|
}
|
|
4320
|
-
var runDefinitionFrontmatterSchema =
|
|
4449
|
+
var runDefinitionFrontmatterSchema = z46.object({
|
|
4321
4450
|
...caseMeasurement,
|
|
4322
4451
|
config: runDefinitionConfigSchema
|
|
4323
4452
|
}).strict().refine(
|
|
4324
4453
|
exactlyOneMeasurement,
|
|
4325
4454
|
"Specify exactly one of criteria or preference"
|
|
4326
4455
|
);
|
|
4327
|
-
var runDefinitionCaseSchema =
|
|
4328
|
-
path:
|
|
4329
|
-
prompt:
|
|
4456
|
+
var runDefinitionCaseSchema = z46.object({
|
|
4457
|
+
path: z46.string().min(1),
|
|
4458
|
+
prompt: z46.string().min(1),
|
|
4330
4459
|
...caseMeasurement,
|
|
4331
4460
|
config: runDefinitionConfigSchema
|
|
4332
4461
|
}).strict().refine(
|
|
4333
4462
|
exactlyOneMeasurement,
|
|
4334
4463
|
"Specify exactly one of criteria or preference"
|
|
4335
4464
|
);
|
|
4336
|
-
var runDefinitionSubmissionSchema =
|
|
4337
|
-
version:
|
|
4338
|
-
source:
|
|
4339
|
-
repoUrl: uncredentialedRepoUrlSchema,
|
|
4340
|
-
commit:
|
|
4341
|
-
digest:
|
|
4342
|
-
verification:
|
|
4465
|
+
var runDefinitionSubmissionSchema = z46.object({
|
|
4466
|
+
version: z46.literal(2),
|
|
4467
|
+
source: z46.object({
|
|
4468
|
+
repoUrl: uncredentialedRepoUrlSchema.nullable(),
|
|
4469
|
+
commit: z46.string().regex(/^[a-f0-9]{40}$/i).nullable(),
|
|
4470
|
+
digest: z46.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4471
|
+
verification: z46.enum([
|
|
4472
|
+
"SUBMITTED_UNVERIFIED",
|
|
4473
|
+
"GITHUB_VERIFIED",
|
|
4474
|
+
"LOCAL"
|
|
4475
|
+
])
|
|
4343
4476
|
}).strict(),
|
|
4344
|
-
resources:
|
|
4345
|
-
cases:
|
|
4477
|
+
resources: z46.array(runPlanResourceSchema).max(32).default([]),
|
|
4478
|
+
cases: z46.array(runDefinitionCaseSchema).min(1).max(20)
|
|
4346
4479
|
}).strict().superRefine((definition, ctx) => {
|
|
4480
|
+
if (definition.source.verification !== "LOCAL" && (!definition.source.repoUrl || !definition.source.commit))
|
|
4481
|
+
ctx.addIssue({
|
|
4482
|
+
code: "custom",
|
|
4483
|
+
path: ["source"],
|
|
4484
|
+
message: "Committed definitions require a repository and commit"
|
|
4485
|
+
});
|
|
4486
|
+
if (definition.source.verification === "GITHUB_VERIFIED" && definition.resources.some((r) => r.source.type === "upload"))
|
|
4487
|
+
ctx.addIssue({
|
|
4488
|
+
code: "custom",
|
|
4489
|
+
path: ["resources"],
|
|
4490
|
+
message: "GitHub definitions cannot contain uploaded inputs"
|
|
4491
|
+
});
|
|
4347
4492
|
const paths = /* @__PURE__ */ new Set();
|
|
4348
4493
|
for (const [index, item] of definition.cases.entries()) {
|
|
4349
4494
|
if (paths.has(item.path))
|
|
@@ -4379,61 +4524,62 @@ var runDefinitionSubmissionSchema = z44.object({
|
|
|
4379
4524
|
}
|
|
4380
4525
|
});
|
|
4381
4526
|
var runDefinitionPublicSubmissionSchema = runDefinitionSubmissionSchema.refine(
|
|
4382
|
-
(definition) => definition.source.verification
|
|
4527
|
+
(definition) => definition.source.verification !== "GITHUB_VERIFIED",
|
|
4383
4528
|
{
|
|
4384
4529
|
path: ["source", "verification"],
|
|
4385
4530
|
message: "Only the GitHub App may verify committed bytes"
|
|
4386
4531
|
}
|
|
4387
4532
|
);
|
|
4388
|
-
var runDefinitionPlanResponseSchema =
|
|
4533
|
+
var runDefinitionPlanResponseSchema = z46.object({
|
|
4389
4534
|
source: runDefinitionSubmissionSchema.shape.source,
|
|
4390
|
-
measurementMode:
|
|
4391
|
-
cases:
|
|
4392
|
-
|
|
4393
|
-
path:
|
|
4394
|
-
agents:
|
|
4395
|
-
samples:
|
|
4396
|
-
expectedRuns:
|
|
4397
|
-
workspace:
|
|
4398
|
-
repoUrl:
|
|
4399
|
-
repoRef:
|
|
4535
|
+
measurementMode: z46.enum(["AGENT_EXPERIENCE", "AGENT_PREFERENCE", "MIXED"]),
|
|
4536
|
+
cases: z46.array(
|
|
4537
|
+
z46.object({
|
|
4538
|
+
path: z46.string(),
|
|
4539
|
+
agents: z46.array(agentConfigSchema),
|
|
4540
|
+
samples: z46.number().int().nonnegative(),
|
|
4541
|
+
expectedRuns: z46.number().int().nonnegative(),
|
|
4542
|
+
workspace: z46.object({
|
|
4543
|
+
repoUrl: z46.string().nullable(),
|
|
4544
|
+
repoRef: z46.string().nullable()
|
|
4400
4545
|
}),
|
|
4401
|
-
criteriaCount:
|
|
4546
|
+
criteriaCount: z46.number().int().nonnegative(),
|
|
4402
4547
|
preference: preferenceDefinitionSchema.optional(),
|
|
4403
|
-
inputs:
|
|
4548
|
+
inputs: z46.array(z46.string())
|
|
4404
4549
|
})
|
|
4405
4550
|
),
|
|
4406
|
-
resources:
|
|
4407
|
-
|
|
4408
|
-
name:
|
|
4409
|
-
type:
|
|
4410
|
-
source:
|
|
4551
|
+
resources: z46.array(
|
|
4552
|
+
z46.object({
|
|
4553
|
+
name: z46.string(),
|
|
4554
|
+
type: z46.literal("input"),
|
|
4555
|
+
source: z46.enum([
|
|
4411
4556
|
"git",
|
|
4412
4557
|
"github-actions",
|
|
4413
4558
|
"github-deployment",
|
|
4414
|
-
"github-pr-comment"
|
|
4559
|
+
"github-pr-comment",
|
|
4560
|
+
"upload"
|
|
4415
4561
|
]),
|
|
4416
4562
|
use: inputUseSchema,
|
|
4417
|
-
readiness:
|
|
4418
|
-
detail:
|
|
4419
|
-
commands:
|
|
4563
|
+
readiness: z46.enum(["READY", "WAITING", "FAILED"]),
|
|
4564
|
+
detail: z46.string().optional(),
|
|
4565
|
+
commands: z46.array(z46.string()).optional()
|
|
4420
4566
|
})
|
|
4421
4567
|
),
|
|
4422
|
-
expectedRuns:
|
|
4423
|
-
canRun:
|
|
4568
|
+
expectedRuns: z46.number().int().nonnegative(),
|
|
4569
|
+
canRun: z46.boolean()
|
|
4424
4570
|
});
|
|
4425
|
-
var runDefinitionRunResponseSchema =
|
|
4426
|
-
runRequestId:
|
|
4427
|
-
batchIds:
|
|
4428
|
-
runIds:
|
|
4429
|
-
requestedRuns:
|
|
4430
|
-
createdRuns:
|
|
4431
|
-
aggregateUrl:
|
|
4571
|
+
var runDefinitionRunResponseSchema = z46.object({
|
|
4572
|
+
runRequestId: z46.string(),
|
|
4573
|
+
batchIds: z46.array(z46.string()),
|
|
4574
|
+
runIds: z46.array(z46.string()),
|
|
4575
|
+
requestedRuns: z46.number().int().nonnegative(),
|
|
4576
|
+
createdRuns: z46.number().int().nonnegative(),
|
|
4577
|
+
aggregateUrl: z46.string()
|
|
4432
4578
|
});
|
|
4433
4579
|
|
|
4434
4580
|
// ../packages/api-schemas/src/runRequests.ts
|
|
4435
|
-
import { z as
|
|
4436
|
-
var runRequestStatusSchema =
|
|
4581
|
+
import { z as z47 } from "zod";
|
|
4582
|
+
var runRequestStatusSchema = z47.enum([
|
|
4437
4583
|
"PENDING",
|
|
4438
4584
|
"PREPARING",
|
|
4439
4585
|
"RUNNING",
|
|
@@ -4441,7 +4587,7 @@ var runRequestStatusSchema = z45.enum([
|
|
|
4441
4587
|
"FAILED",
|
|
4442
4588
|
"CANCELED"
|
|
4443
4589
|
]);
|
|
4444
|
-
var runRequestResultSchema =
|
|
4590
|
+
var runRequestResultSchema = z47.enum([
|
|
4445
4591
|
"PENDING",
|
|
4446
4592
|
"PASSED",
|
|
4447
4593
|
"MEASURED",
|
|
@@ -4452,229 +4598,230 @@ var runRequestResultSchema = z45.enum([
|
|
|
4452
4598
|
"INCOMPLETE",
|
|
4453
4599
|
"CANCELED"
|
|
4454
4600
|
]);
|
|
4455
|
-
var runRequestCriterionResultSchema =
|
|
4456
|
-
criterionId:
|
|
4457
|
-
name:
|
|
4458
|
-
passed:
|
|
4459
|
-
reasoning:
|
|
4460
|
-
});
|
|
4461
|
-
var runRequestRunSchema =
|
|
4462
|
-
id:
|
|
4463
|
-
|
|
4464
|
-
|
|
4601
|
+
var runRequestCriterionResultSchema = z47.object({
|
|
4602
|
+
criterionId: z47.string().nullable(),
|
|
4603
|
+
name: z47.string(),
|
|
4604
|
+
passed: z47.boolean(),
|
|
4605
|
+
reasoning: z47.string().nullable()
|
|
4606
|
+
});
|
|
4607
|
+
var runRequestRunSchema = z47.object({
|
|
4608
|
+
id: z47.string(),
|
|
4609
|
+
url: z47.string().url().optional(),
|
|
4610
|
+
batchId: z47.string(),
|
|
4611
|
+
status: z47.string(),
|
|
4465
4612
|
agent: agentSchema,
|
|
4466
|
-
model:
|
|
4613
|
+
model: z47.string(),
|
|
4467
4614
|
result: runRequestResultSchema,
|
|
4468
|
-
judge:
|
|
4469
|
-
criterionResults:
|
|
4615
|
+
judge: z47.object({ status: z47.string() }).nullable(),
|
|
4616
|
+
criterionResults: z47.array(runRequestCriterionResultSchema),
|
|
4470
4617
|
preference: visibilityVerdictSchema.nullable().optional(),
|
|
4471
|
-
measurement:
|
|
4618
|
+
measurement: z47.enum(["experience", "preference"]).optional()
|
|
4472
4619
|
});
|
|
4473
|
-
var runRequestResponseSchema =
|
|
4474
|
-
id:
|
|
4620
|
+
var runRequestResponseSchema = z47.object({
|
|
4621
|
+
id: z47.string(),
|
|
4475
4622
|
status: runRequestStatusSchema,
|
|
4476
4623
|
result: runRequestResultSchema,
|
|
4477
|
-
error:
|
|
4478
|
-
inputs:
|
|
4479
|
-
settled:
|
|
4480
|
-
counts:
|
|
4481
|
-
requestedRuns:
|
|
4482
|
-
createdRuns:
|
|
4483
|
-
terminalRuns:
|
|
4484
|
-
judgedRuns:
|
|
4485
|
-
passedRuns:
|
|
4486
|
-
measuredRuns:
|
|
4487
|
-
qualityFailedRuns:
|
|
4488
|
-
executionFailedRuns:
|
|
4489
|
-
judgeFailedRuns:
|
|
4490
|
-
pendingRuns:
|
|
4624
|
+
error: z47.string().nullable().optional(),
|
|
4625
|
+
inputs: z47.unknown().optional(),
|
|
4626
|
+
settled: z47.boolean(),
|
|
4627
|
+
counts: z47.object({
|
|
4628
|
+
requestedRuns: z47.number().int().nonnegative(),
|
|
4629
|
+
createdRuns: z47.number().int().nonnegative(),
|
|
4630
|
+
terminalRuns: z47.number().int().nonnegative(),
|
|
4631
|
+
judgedRuns: z47.number().int().nonnegative(),
|
|
4632
|
+
passedRuns: z47.number().int().nonnegative(),
|
|
4633
|
+
measuredRuns: z47.number().int().nonnegative().optional(),
|
|
4634
|
+
qualityFailedRuns: z47.number().int().nonnegative(),
|
|
4635
|
+
executionFailedRuns: z47.number().int().nonnegative(),
|
|
4636
|
+
judgeFailedRuns: z47.number().int().nonnegative(),
|
|
4637
|
+
pendingRuns: z47.number().int().nonnegative()
|
|
4491
4638
|
}),
|
|
4492
|
-
batches:
|
|
4493
|
-
|
|
4639
|
+
batches: z47.array(
|
|
4640
|
+
z47.object({ id: z47.string(), runs: z47.array(runRequestRunSchema) })
|
|
4494
4641
|
),
|
|
4495
|
-
createdAt:
|
|
4496
|
-
updatedAt:
|
|
4497
|
-
finishedAt:
|
|
4642
|
+
createdAt: z47.string(),
|
|
4643
|
+
updatedAt: z47.string(),
|
|
4644
|
+
finishedAt: z47.string().nullable()
|
|
4498
4645
|
});
|
|
4499
4646
|
|
|
4500
4647
|
// ../packages/api-schemas/src/summary.ts
|
|
4501
|
-
import { z as
|
|
4648
|
+
import { z as z48 } from "zod";
|
|
4502
4649
|
function cardResultSchema(data) {
|
|
4503
|
-
return
|
|
4504
|
-
|
|
4505
|
-
|
|
4650
|
+
return z48.union([
|
|
4651
|
+
z48.object({ ok: z48.literal(true), data }),
|
|
4652
|
+
z48.object({ ok: z48.literal(false), error: z48.string() })
|
|
4506
4653
|
]);
|
|
4507
4654
|
}
|
|
4508
|
-
var summaryActionSchema =
|
|
4509
|
-
id:
|
|
4510
|
-
title:
|
|
4511
|
-
priority:
|
|
4512
|
-
status:
|
|
4513
|
-
evidenceCount:
|
|
4514
|
-
});
|
|
4515
|
-
var summaryAeCardSchema =
|
|
4516
|
-
id:
|
|
4517
|
-
name:
|
|
4518
|
-
judgedRuns:
|
|
4519
|
-
passRate:
|
|
4655
|
+
var summaryActionSchema = z48.object({
|
|
4656
|
+
id: z48.string(),
|
|
4657
|
+
title: z48.string(),
|
|
4658
|
+
priority: z48.string(),
|
|
4659
|
+
status: z48.string(),
|
|
4660
|
+
evidenceCount: z48.number().int()
|
|
4661
|
+
});
|
|
4662
|
+
var summaryAeCardSchema = z48.object({
|
|
4663
|
+
id: z48.string(),
|
|
4664
|
+
name: z48.string(),
|
|
4665
|
+
judgedRuns: z48.number().int(),
|
|
4666
|
+
passRate: z48.number().nullable(),
|
|
4520
4667
|
/** pp delta vs the prior 30d; null with no prior. */
|
|
4521
|
-
deltaPP:
|
|
4522
|
-
});
|
|
4523
|
-
var summaryVisibilityCardSchema =
|
|
4524
|
-
name:
|
|
4525
|
-
owned:
|
|
4526
|
-
name:
|
|
4527
|
-
rank:
|
|
4528
|
-
chosenRate:
|
|
4529
|
-
mentionRate:
|
|
4668
|
+
deltaPP: z48.number().nullable()
|
|
4669
|
+
});
|
|
4670
|
+
var summaryVisibilityCardSchema = z48.object({
|
|
4671
|
+
name: z48.string(),
|
|
4672
|
+
owned: z48.object({
|
|
4673
|
+
name: z48.string(),
|
|
4674
|
+
rank: z48.number(),
|
|
4675
|
+
chosenRate: z48.number(),
|
|
4676
|
+
mentionRate: z48.number()
|
|
4530
4677
|
}).nullable(),
|
|
4531
|
-
chosenDeltaPP:
|
|
4678
|
+
chosenDeltaPP: z48.number().nullable()
|
|
4532
4679
|
});
|
|
4533
|
-
var homeSummarySchema =
|
|
4534
|
-
hasAnyRuns:
|
|
4535
|
-
lastSynthesisAt:
|
|
4536
|
-
actions: cardResultSchema(
|
|
4680
|
+
var homeSummarySchema = z48.object({
|
|
4681
|
+
hasAnyRuns: z48.boolean(),
|
|
4682
|
+
lastSynthesisAt: z48.string().nullable(),
|
|
4683
|
+
actions: cardResultSchema(z48.array(summaryActionSchema)),
|
|
4537
4684
|
visibility: cardResultSchema(
|
|
4538
|
-
|
|
4539
|
-
cards:
|
|
4540
|
-
marketsTotal:
|
|
4541
|
-
promptCount:
|
|
4685
|
+
z48.object({
|
|
4686
|
+
cards: z48.array(summaryVisibilityCardSchema),
|
|
4687
|
+
marketsTotal: z48.number().int(),
|
|
4688
|
+
promptCount: z48.number().int()
|
|
4542
4689
|
})
|
|
4543
4690
|
),
|
|
4544
4691
|
agentExperience: cardResultSchema(
|
|
4545
|
-
|
|
4546
|
-
cards:
|
|
4547
|
-
total:
|
|
4548
|
-
setCount:
|
|
4692
|
+
z48.object({
|
|
4693
|
+
cards: z48.array(summaryAeCardSchema),
|
|
4694
|
+
total: z48.number().int(),
|
|
4695
|
+
setCount: z48.number().int()
|
|
4549
4696
|
})
|
|
4550
4697
|
),
|
|
4551
|
-
notableSessions: cardResultSchema(
|
|
4698
|
+
notableSessions: cardResultSchema(z48.array(z48.unknown()))
|
|
4552
4699
|
});
|
|
4553
4700
|
|
|
4554
4701
|
// ../packages/api-schemas/src/tokens.ts
|
|
4555
|
-
import { z as
|
|
4556
|
-
var apiTokenSchema =
|
|
4557
|
-
id:
|
|
4558
|
-
name:
|
|
4702
|
+
import { z as z49 } from "zod";
|
|
4703
|
+
var apiTokenSchema = z49.object({
|
|
4704
|
+
id: z49.string(),
|
|
4705
|
+
name: z49.string(),
|
|
4559
4706
|
/** Last 4 chars of the plaintext, for recognizability (non-secret). */
|
|
4560
|
-
last4:
|
|
4561
|
-
expiresAt:
|
|
4562
|
-
lastUsedAt:
|
|
4563
|
-
createdAt:
|
|
4564
|
-
revokedAt:
|
|
4565
|
-
});
|
|
4566
|
-
var createTokenRequestSchema =
|
|
4567
|
-
name:
|
|
4707
|
+
last4: z49.string(),
|
|
4708
|
+
expiresAt: z49.iso.datetime().nullable(),
|
|
4709
|
+
lastUsedAt: z49.iso.datetime().nullable(),
|
|
4710
|
+
createdAt: z49.iso.datetime(),
|
|
4711
|
+
revokedAt: z49.iso.datetime().nullable()
|
|
4712
|
+
});
|
|
4713
|
+
var createTokenRequestSchema = z49.object({
|
|
4714
|
+
name: z49.string().min(1).max(100),
|
|
4568
4715
|
/** ISO-8601 datetime; omit for no expiry. */
|
|
4569
|
-
expiresAt:
|
|
4716
|
+
expiresAt: z49.iso.datetime({ offset: true }).optional()
|
|
4570
4717
|
});
|
|
4571
4718
|
var createTokenResponseSchema = apiTokenSchema.extend({
|
|
4572
|
-
token:
|
|
4719
|
+
token: z49.string()
|
|
4573
4720
|
});
|
|
4574
4721
|
var listTokensResponseSchema = listResponseSchema(apiTokenSchema);
|
|
4575
4722
|
|
|
4576
4723
|
// ../packages/api-schemas/src/visibility.ts
|
|
4577
|
-
import { z as
|
|
4724
|
+
import { z as z50 } from "zod";
|
|
4578
4725
|
var VISIBILITY_PROMPT_KINDS = ["HEAD_TO_HEAD", "RECOMMEND"];
|
|
4579
|
-
var visibilityPromptKindSchema =
|
|
4726
|
+
var visibilityPromptKindSchema = z50.enum(VISIBILITY_PROMPT_KINDS);
|
|
4580
4727
|
var visibilityPromptSchema = visibilityPromptSettingsSchema.extend({
|
|
4581
|
-
id:
|
|
4582
|
-
name:
|
|
4728
|
+
id: z50.string(),
|
|
4729
|
+
name: z50.string(),
|
|
4583
4730
|
kind: visibilityPromptKindSchema,
|
|
4584
|
-
promptText:
|
|
4731
|
+
promptText: z50.string(),
|
|
4585
4732
|
/** HEAD_TO_HEAD is always branded; RECOMMEND may be either. */
|
|
4586
|
-
branded:
|
|
4587
|
-
brandA:
|
|
4588
|
-
brandB:
|
|
4589
|
-
market:
|
|
4590
|
-
position:
|
|
4591
|
-
createdAt:
|
|
4733
|
+
branded: z50.boolean(),
|
|
4734
|
+
brandA: z50.string().nullable(),
|
|
4735
|
+
brandB: z50.string().nullable(),
|
|
4736
|
+
market: z50.object({ id: z50.string(), slug: z50.string(), name: z50.string() }).nullable(),
|
|
4737
|
+
position: z50.number().int(),
|
|
4738
|
+
createdAt: z50.string(),
|
|
4592
4739
|
/** User tag names on the hidden backing prompt (Surface:* excluded). */
|
|
4593
|
-
tags:
|
|
4594
|
-
runCount:
|
|
4595
|
-
lastRunAt:
|
|
4596
|
-
scenarios:
|
|
4740
|
+
tags: z50.array(z50.string()),
|
|
4741
|
+
runCount: z50.number().int(),
|
|
4742
|
+
lastRunAt: z50.string().nullable(),
|
|
4743
|
+
scenarios: z50.array(visibilityScenarioSchema)
|
|
4597
4744
|
});
|
|
4598
|
-
var listVisibilityPromptsResponseSchema =
|
|
4599
|
-
items:
|
|
4745
|
+
var listVisibilityPromptsResponseSchema = z50.object({
|
|
4746
|
+
items: z50.array(visibilityPromptSchema)
|
|
4600
4747
|
});
|
|
4601
|
-
var createVisibilityPromptBodySchema =
|
|
4602
|
-
name:
|
|
4603
|
-
promptText:
|
|
4748
|
+
var createVisibilityPromptBodySchema = z50.object({
|
|
4749
|
+
name: z50.string().min(1),
|
|
4750
|
+
promptText: z50.string().min(1),
|
|
4604
4751
|
kind: visibilityPromptKindSchema,
|
|
4605
|
-
branded:
|
|
4752
|
+
branded: z50.boolean().optional(),
|
|
4606
4753
|
/** Required pair for HEAD_TO_HEAD (order-independent). */
|
|
4607
|
-
brandA:
|
|
4608
|
-
brandB:
|
|
4754
|
+
brandA: z50.string().nullish(),
|
|
4755
|
+
brandB: z50.string().nullish(),
|
|
4609
4756
|
/** Measured market id from the org's tracked set. */
|
|
4610
|
-
marketId:
|
|
4611
|
-
tags:
|
|
4757
|
+
marketId: z50.string().nullish(),
|
|
4758
|
+
tags: z50.array(z50.string()).optional(),
|
|
4612
4759
|
agents: visibilityPromptSettingsInputShape.agents.optional(),
|
|
4613
4760
|
skillRefs: visibilityPromptSettingsInputShape.skillRefs,
|
|
4614
4761
|
mcpRefs: visibilityPromptSettingsInputShape.mcpRefs,
|
|
4615
4762
|
connectionIds: visibilityPromptSettingsInputShape.connectionIds,
|
|
4616
4763
|
cadence: visibilityPromptSettingsInputShape.cadence,
|
|
4617
4764
|
sampleCount: visibilityPromptSettingsInputShape.sampleCount,
|
|
4618
|
-
scenarios:
|
|
4765
|
+
scenarios: z50.array(visibilityScenarioInputSchema).optional().default([])
|
|
4619
4766
|
}).strict();
|
|
4620
|
-
var synthesizeResponseSchema =
|
|
4767
|
+
var synthesizeResponseSchema = z50.object({
|
|
4621
4768
|
/** False when the pre-check found no new evidence and nothing was queued. */
|
|
4622
|
-
queued:
|
|
4623
|
-
});
|
|
4624
|
-
var updateVisibilityPromptBodySchema =
|
|
4625
|
-
name:
|
|
4626
|
-
promptText:
|
|
4627
|
-
branded:
|
|
4628
|
-
brandA:
|
|
4629
|
-
brandB:
|
|
4630
|
-
marketId:
|
|
4631
|
-
tags:
|
|
4769
|
+
queued: z50.boolean()
|
|
4770
|
+
});
|
|
4771
|
+
var updateVisibilityPromptBodySchema = z50.object({
|
|
4772
|
+
name: z50.string().min(1).optional(),
|
|
4773
|
+
promptText: z50.string().min(1).optional(),
|
|
4774
|
+
branded: z50.boolean().optional(),
|
|
4775
|
+
brandA: z50.string().nullish(),
|
|
4776
|
+
brandB: z50.string().nullish(),
|
|
4777
|
+
marketId: z50.string().nullish(),
|
|
4778
|
+
tags: z50.array(z50.string()).optional(),
|
|
4632
4779
|
...visibilityPromptSettingsPatchShape,
|
|
4633
4780
|
/** Replaces the whole scenario set when present. */
|
|
4634
|
-
scenarios:
|
|
4781
|
+
scenarios: z50.array(visibilityScenarioInputSchema).optional()
|
|
4635
4782
|
}).strict();
|
|
4636
|
-
var runVisibilityPromptResponseSchema =
|
|
4637
|
-
batchIds:
|
|
4638
|
-
runIds:
|
|
4783
|
+
var runVisibilityPromptResponseSchema = z50.object({
|
|
4784
|
+
batchIds: z50.array(z50.string()),
|
|
4785
|
+
runIds: z50.array(z50.string())
|
|
4639
4786
|
});
|
|
4640
|
-
var visibilityPromptRunSchema =
|
|
4641
|
-
id:
|
|
4642
|
-
status:
|
|
4787
|
+
var visibilityPromptRunSchema = z50.object({
|
|
4788
|
+
id: z50.string(),
|
|
4789
|
+
status: z50.string(),
|
|
4643
4790
|
agent: agentSchema,
|
|
4644
|
-
model:
|
|
4645
|
-
resolvedModel:
|
|
4646
|
-
createdAt:
|
|
4647
|
-
startedAt:
|
|
4648
|
-
finishedAt:
|
|
4649
|
-
failureReason:
|
|
4791
|
+
model: z50.string().nullable(),
|
|
4792
|
+
resolvedModel: z50.string().nullable(),
|
|
4793
|
+
createdAt: z50.string(),
|
|
4794
|
+
startedAt: z50.string().nullable(),
|
|
4795
|
+
finishedAt: z50.string().nullable(),
|
|
4796
|
+
failureReason: z50.string().nullable(),
|
|
4650
4797
|
creditsCharged: runCreditsChargedSchema.optional(),
|
|
4651
4798
|
triggeredBy: runTriggeredBySchema.optional(),
|
|
4652
|
-
verdict:
|
|
4653
|
-
status:
|
|
4654
|
-
error:
|
|
4655
|
-
payload:
|
|
4799
|
+
verdict: z50.object({
|
|
4800
|
+
status: z50.string(),
|
|
4801
|
+
error: z50.string().nullable(),
|
|
4802
|
+
payload: z50.unknown().nullable()
|
|
4656
4803
|
}).nullable()
|
|
4657
4804
|
});
|
|
4658
4805
|
var listVisibilityPromptRunsResponseSchema = listResponseSchema(
|
|
4659
4806
|
visibilityPromptRunSchema
|
|
4660
4807
|
);
|
|
4661
|
-
var orgMarketSchema =
|
|
4662
|
-
marketId:
|
|
4663
|
-
slug:
|
|
4664
|
-
name:
|
|
4808
|
+
var orgMarketSchema = z50.object({
|
|
4809
|
+
marketId: z50.string(),
|
|
4810
|
+
slug: z50.string(),
|
|
4811
|
+
name: z50.string(),
|
|
4665
4812
|
/** The one line saying what the market measures. */
|
|
4666
|
-
capability:
|
|
4813
|
+
capability: z50.string(),
|
|
4667
4814
|
/** SUGGESTED (the matcher) | USER (a human picked it). */
|
|
4668
|
-
source:
|
|
4815
|
+
source: z50.string()
|
|
4669
4816
|
});
|
|
4670
4817
|
var addableMarketSchema = orgMarketSchema.omit({ source: true });
|
|
4671
|
-
var listMarketsResponseSchema =
|
|
4672
|
-
tracked:
|
|
4818
|
+
var listMarketsResponseSchema = z50.object({
|
|
4819
|
+
tracked: z50.array(orgMarketSchema),
|
|
4673
4820
|
/** Published markets the org does not track yet (closed set — no free-text
|
|
4674
4821
|
* market creation). */
|
|
4675
|
-
addable:
|
|
4822
|
+
addable: z50.array(addableMarketSchema)
|
|
4676
4823
|
});
|
|
4677
|
-
var addMarketBodySchema =
|
|
4824
|
+
var addMarketBodySchema = z50.object({ marketId: z50.string().min(1) });
|
|
4678
4825
|
|
|
4679
4826
|
// src/version.ts
|
|
4680
4827
|
import { createRequire } from "module";
|
|
@@ -5059,7 +5206,7 @@ __export(apply_exports, {
|
|
|
5059
5206
|
register: () => register2
|
|
5060
5207
|
});
|
|
5061
5208
|
import { readFileSync as readFileSync3 } from "fs";
|
|
5062
|
-
import { z as
|
|
5209
|
+
import { z as z51 } from "zod";
|
|
5063
5210
|
function assertRequiredExperiment(spec, required) {
|
|
5064
5211
|
if (required.length === 0) {
|
|
5065
5212
|
throw new CliError(
|
|
@@ -5211,7 +5358,7 @@ function register2(program2) {
|
|
|
5211
5358
|
).option("--schema", "print the battery spec JSON Schema and exit").option("--example", "print a minimal example battery spec and exit").action(
|
|
5212
5359
|
async (opts, command) => {
|
|
5213
5360
|
if (opts.schema) {
|
|
5214
|
-
printJson(
|
|
5361
|
+
printJson(z51.toJSONSchema(batteries_exports.batterySpecSchema));
|
|
5215
5362
|
return;
|
|
5216
5363
|
}
|
|
5217
5364
|
if (opts.example) {
|
|
@@ -5323,7 +5470,7 @@ async function browserLogin() {
|
|
|
5323
5470
|
const codeVerifier = randomBytes(32).toString("base64url");
|
|
5324
5471
|
const codeChallenge = createHash("sha256").update(codeVerifier).digest("base64url");
|
|
5325
5472
|
const server = createServer();
|
|
5326
|
-
const codePromise = new Promise((
|
|
5473
|
+
const codePromise = new Promise((resolve4, reject) => {
|
|
5327
5474
|
server.on("request", (req, res) => {
|
|
5328
5475
|
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
5329
5476
|
if (url.pathname !== "/callback") {
|
|
@@ -5346,15 +5493,15 @@ async function browserLogin() {
|
|
|
5346
5493
|
"content-type": "text/plain; charset=utf-8"
|
|
5347
5494
|
});
|
|
5348
5495
|
res.end("Authorized. Return to your terminal.");
|
|
5349
|
-
|
|
5496
|
+
resolve4(code);
|
|
5350
5497
|
});
|
|
5351
5498
|
server.on(
|
|
5352
5499
|
"error",
|
|
5353
5500
|
(e) => reject(new CliError("network", `Loopback listener failed: ${e.message}`))
|
|
5354
5501
|
);
|
|
5355
5502
|
});
|
|
5356
|
-
await new Promise((
|
|
5357
|
-
server.listen(0, "127.0.0.1",
|
|
5503
|
+
await new Promise((resolve4) => {
|
|
5504
|
+
server.listen(0, "127.0.0.1", resolve4);
|
|
5358
5505
|
});
|
|
5359
5506
|
const address = server.address();
|
|
5360
5507
|
if (!address || typeof address === "string") {
|
|
@@ -5983,10 +6130,10 @@ function splitList(raw) {
|
|
|
5983
6130
|
return raw.split(",").map((v) => v.trim()).filter(Boolean);
|
|
5984
6131
|
}
|
|
5985
6132
|
function parsePackage(raw) {
|
|
5986
|
-
const
|
|
5987
|
-
if (
|
|
5988
|
-
const name = raw.slice(0,
|
|
5989
|
-
const ecosystem = raw.slice(
|
|
6133
|
+
const sep5 = raw.lastIndexOf(":");
|
|
6134
|
+
if (sep5 === -1) return { name: raw.trim(), ecosystem: null };
|
|
6135
|
+
const name = raw.slice(0, sep5).trim();
|
|
6136
|
+
const ecosystem = raw.slice(sep5 + 1).trim();
|
|
5990
6137
|
if (!name) throw new CliError("usage", `Invalid package "${raw}"`);
|
|
5991
6138
|
if (!ECOSYSTEMS.includes(ecosystem)) {
|
|
5992
6139
|
throw new CliError(
|
|
@@ -6122,7 +6269,7 @@ async function waitForCanary(id2) {
|
|
|
6122
6269
|
while (true) {
|
|
6123
6270
|
const canary = await client.get(`${path}/${id2}`);
|
|
6124
6271
|
if (terminal.has(canary.status)) return canary;
|
|
6125
|
-
await new Promise((
|
|
6272
|
+
await new Promise((resolve4) => setTimeout(resolve4, 1e4));
|
|
6126
6273
|
}
|
|
6127
6274
|
}
|
|
6128
6275
|
function register7(program2, opts = {}) {
|
|
@@ -6240,7 +6387,7 @@ function register8(program2, options = {}) {
|
|
|
6240
6387
|
throw new Error(
|
|
6241
6388
|
`Canary failed: ${JSON.stringify(status.runs)}`
|
|
6242
6389
|
);
|
|
6243
|
-
await new Promise((
|
|
6390
|
+
await new Promise((resolve4) => setTimeout(resolve4, 5e3));
|
|
6244
6391
|
}
|
|
6245
6392
|
throw new Error(
|
|
6246
6393
|
`Canary timed out; runs continue. Inspect ${runIds.join(",")} then activate with --runs.`
|
|
@@ -6455,7 +6602,7 @@ async function confirmOrAbort(question, yes) {
|
|
|
6455
6602
|
}
|
|
6456
6603
|
const rl = createInterface2({ input: process.stdin, output: process.stderr });
|
|
6457
6604
|
const answer = await new Promise(
|
|
6458
|
-
(
|
|
6605
|
+
(resolve4) => rl.question(`${question} [y/N] `, resolve4)
|
|
6459
6606
|
);
|
|
6460
6607
|
rl.close();
|
|
6461
6608
|
if (!/^y(es)?$/i.test(answer.trim())) {
|
|
@@ -6463,249 +6610,53 @@ async function confirmOrAbort(question, yes) {
|
|
|
6463
6610
|
}
|
|
6464
6611
|
}
|
|
6465
6612
|
|
|
6466
|
-
// src/lib/
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6613
|
+
// src/lib/localRunInputs.ts
|
|
6614
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
6615
|
+
import { createHash as createHash3 } from "crypto";
|
|
6616
|
+
import { createReadStream } from "fs";
|
|
6617
|
+
import { lstat, mkdtemp, readdir, rm, stat } from "fs/promises";
|
|
6618
|
+
import { tmpdir } from "os";
|
|
6619
|
+
import {
|
|
6620
|
+
basename,
|
|
6621
|
+
dirname,
|
|
6622
|
+
isAbsolute as isAbsolute2,
|
|
6623
|
+
join as join4,
|
|
6624
|
+
relative as relative2,
|
|
6625
|
+
resolve as resolve2,
|
|
6626
|
+
sep as sep2
|
|
6627
|
+
} from "path";
|
|
6628
|
+
import { setTimeout as delay } from "timers/promises";
|
|
6629
|
+
|
|
6630
|
+
// ../packages/api-schemas/src/compileRunDefinition.ts
|
|
6631
|
+
import { createHash as createHash2 } from "crypto";
|
|
6632
|
+
import { parseDocument } from "yaml";
|
|
6633
|
+
function utf8(bytes, path3) {
|
|
6634
|
+
try {
|
|
6635
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
6636
|
+
} catch {
|
|
6637
|
+
throw new Error(`${path3} is not UTF-8 text`);
|
|
6638
|
+
}
|
|
6481
6639
|
}
|
|
6482
|
-
function
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
)
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
).
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
[]
|
|
6498
|
-
).option(
|
|
6499
|
-
"--connection <id>",
|
|
6500
|
-
"connection id (repeatable)",
|
|
6501
|
-
collect,
|
|
6502
|
-
[]
|
|
6503
|
-
).option("--cadence <cadence>", "none | daily | weekly | monthly", "none").option("--samples <n>", "sample count from 1 to 50", "1");
|
|
6504
|
-
}
|
|
6505
|
-
function addOwnedConfigEditOptions(command) {
|
|
6506
|
-
return command.option(
|
|
6507
|
-
"--repo <url>",
|
|
6508
|
-
"set the repository URL (keeps an existing ref pin)"
|
|
6509
|
-
).option("--ref <ref>", "set the branch, tag, or commit pin").option("--clear-ref", "drop the ref pin (use the default branch)").option("--clear-repo", "reset to the default scaffold").option("--persona <profileId>", "set the persona profile id").option("--clear-persona", "use the default persona").option(
|
|
6510
|
-
"--agent <agent[:m1,m2]>",
|
|
6511
|
-
"replace agents and model pins (repeatable)",
|
|
6512
|
-
collect,
|
|
6513
|
-
[]
|
|
6514
|
-
).option(
|
|
6515
|
-
"--skill <name@label>",
|
|
6516
|
-
"replace skills (repeatable)",
|
|
6517
|
-
collect,
|
|
6518
|
-
[]
|
|
6519
|
-
).option("--clear-skills", "remove all skills").option(
|
|
6520
|
-
"--mcp <name@label>",
|
|
6521
|
-
"replace MCP servers (repeatable)",
|
|
6522
|
-
collect,
|
|
6523
|
-
[]
|
|
6524
|
-
).option("--clear-mcp", "remove all MCP servers").option(
|
|
6525
|
-
"--connection <id>",
|
|
6526
|
-
"replace connections (repeatable)",
|
|
6527
|
-
collect,
|
|
6528
|
-
[]
|
|
6529
|
-
).option("--clear-connections", "remove all connections").option("--cadence <cadence>", "none | daily | weekly | monthly").option("--samples <n>", "sample count from 1 to 50");
|
|
6530
|
-
}
|
|
6531
|
-
function ownedConfigFromOpts(opts) {
|
|
6532
|
-
if (opts.ref !== void 0 && opts.repo === void 0)
|
|
6533
|
-
throw new CliError("usage", "--ref requires --repo");
|
|
6534
|
-
if (opts.agent.length === 0)
|
|
6535
|
-
throw new CliError("usage", "at least one --agent is required");
|
|
6536
|
-
return {
|
|
6537
|
-
repoUrl: opts.repo ?? null,
|
|
6538
|
-
repoRef: opts.ref ?? null,
|
|
6539
|
-
profileId: opts.persona ?? null,
|
|
6540
|
-
agents: buildAgentRoster(opts.agent),
|
|
6541
|
-
skillRefs: validateAssetRefs("skill", opts.skill),
|
|
6542
|
-
mcpRefs: validateAssetRefs("mcp", opts.mcp),
|
|
6543
|
-
connectionIds: opts.connection,
|
|
6544
|
-
cadence: parseCadence(opts.cadence),
|
|
6545
|
-
sampleCount: parseSampleCount(opts.samples)
|
|
6546
|
-
};
|
|
6547
|
-
}
|
|
6548
|
-
function ownedConfigPatchFromOpts(opts) {
|
|
6549
|
-
const patch = {};
|
|
6550
|
-
if ((opts.repo !== void 0 || opts.ref !== void 0) && opts.clearRepo)
|
|
6551
|
-
throw new CliError("usage", "--repo/--ref and --clear-repo conflict");
|
|
6552
|
-
if (opts.ref !== void 0 && opts.clearRef)
|
|
6553
|
-
throw new CliError("usage", "--ref and --clear-ref conflict");
|
|
6554
|
-
if (opts.clearRepo) {
|
|
6555
|
-
patch.repoUrl = null;
|
|
6556
|
-
patch.repoRef = null;
|
|
6557
|
-
} else {
|
|
6558
|
-
if (opts.repo !== void 0) patch.repoUrl = opts.repo;
|
|
6559
|
-
if (opts.clearRef) patch.repoRef = null;
|
|
6560
|
-
else if (opts.ref !== void 0) patch.repoRef = opts.ref;
|
|
6561
|
-
}
|
|
6562
|
-
if (opts.persona !== void 0 && opts.clearPersona)
|
|
6563
|
-
throw new CliError("usage", "--persona and --clear-persona conflict");
|
|
6564
|
-
if (opts.clearPersona) patch.profileId = null;
|
|
6565
|
-
else if (opts.persona !== void 0) patch.profileId = opts.persona;
|
|
6566
|
-
if (opts.agent.length > 0) patch.agents = buildAgentRoster(opts.agent);
|
|
6567
|
-
if (opts.skill.length > 0 && opts.clearSkills)
|
|
6568
|
-
throw new CliError("usage", "--skill and --clear-skills conflict");
|
|
6569
|
-
if (opts.clearSkills) patch.skillRefs = [];
|
|
6570
|
-
else if (opts.skill.length > 0)
|
|
6571
|
-
patch.skillRefs = validateAssetRefs("skill", opts.skill);
|
|
6572
|
-
if (opts.mcp.length > 0 && opts.clearMcp)
|
|
6573
|
-
throw new CliError("usage", "--mcp and --clear-mcp conflict");
|
|
6574
|
-
if (opts.clearMcp) patch.mcpRefs = [];
|
|
6575
|
-
else if (opts.mcp.length > 0)
|
|
6576
|
-
patch.mcpRefs = validateAssetRefs("mcp", opts.mcp);
|
|
6577
|
-
if (opts.connection.length > 0 && opts.clearConnections)
|
|
6578
|
-
throw new CliError(
|
|
6579
|
-
"usage",
|
|
6580
|
-
"--connection and --clear-connections conflict"
|
|
6581
|
-
);
|
|
6582
|
-
if (opts.clearConnections) patch.connectionIds = [];
|
|
6583
|
-
else if (opts.connection.length > 0) patch.connectionIds = opts.connection;
|
|
6584
|
-
if (opts.cadence !== void 0) patch.cadence = parseCadence(opts.cadence);
|
|
6585
|
-
if (opts.samples !== void 0)
|
|
6586
|
-
patch.sampleCount = parseSampleCount(opts.samples);
|
|
6587
|
-
return patch;
|
|
6588
|
-
}
|
|
6589
|
-
function addRunSettingsCreateOptions(command) {
|
|
6590
|
-
return command.option(
|
|
6591
|
-
"--agent <agent[:m1,m2]>",
|
|
6592
|
-
"agent and optional model pins (repeatable)",
|
|
6593
|
-
collect,
|
|
6594
|
-
[]
|
|
6595
|
-
).option(
|
|
6596
|
-
"--skill <name@label>",
|
|
6597
|
-
"staged skill (repeatable)",
|
|
6598
|
-
collect,
|
|
6599
|
-
[]
|
|
6600
|
-
).option(
|
|
6601
|
-
"--mcp <name@label>",
|
|
6602
|
-
"MCP server (repeatable)",
|
|
6603
|
-
collect,
|
|
6604
|
-
[]
|
|
6605
|
-
).option(
|
|
6606
|
-
"--connection <id>",
|
|
6607
|
-
"connection id (repeatable)",
|
|
6608
|
-
collect,
|
|
6609
|
-
[]
|
|
6610
|
-
).option("--cadence <cadence>", "none | daily | weekly | monthly", "none").option("--samples <n>", "sample count from 1 to 50", "1");
|
|
6611
|
-
}
|
|
6612
|
-
function addRunSettingsEditOptions(command) {
|
|
6613
|
-
return command.option(
|
|
6614
|
-
"--agent <agent[:m1,m2]>",
|
|
6615
|
-
"replace agents and model pins (repeatable)",
|
|
6616
|
-
collect,
|
|
6617
|
-
[]
|
|
6618
|
-
).option(
|
|
6619
|
-
"--skill <name@label>",
|
|
6620
|
-
"replace skills (repeatable)",
|
|
6621
|
-
collect,
|
|
6622
|
-
[]
|
|
6623
|
-
).option("--clear-skills", "remove all skills").option(
|
|
6624
|
-
"--mcp <name@label>",
|
|
6625
|
-
"replace MCP servers (repeatable)",
|
|
6626
|
-
collect,
|
|
6627
|
-
[]
|
|
6628
|
-
).option("--clear-mcp", "remove all MCP servers").option(
|
|
6629
|
-
"--connection <id>",
|
|
6630
|
-
"replace connections (repeatable)",
|
|
6631
|
-
collect,
|
|
6632
|
-
[]
|
|
6633
|
-
).option("--clear-connections", "remove all connections").option("--cadence <cadence>", "none | daily | weekly | monthly").option("--samples <n>", "sample count from 1 to 50");
|
|
6634
|
-
}
|
|
6635
|
-
function hasRunSettingsFlags(opts) {
|
|
6636
|
-
return opts.agent.length > 0 || opts.skill.length > 0 || opts.mcp.length > 0 || opts.connection.length > 0 || opts.cadence.toUpperCase() !== "NONE" || opts.samples !== "1";
|
|
6637
|
-
}
|
|
6638
|
-
function runSettingsFromOpts(opts) {
|
|
6639
|
-
return {
|
|
6640
|
-
...opts.agent.length > 0 ? { agents: buildAgentRoster(opts.agent) } : {},
|
|
6641
|
-
skillRefs: validateAssetRefs("skill", opts.skill),
|
|
6642
|
-
mcpRefs: validateAssetRefs("mcp", opts.mcp),
|
|
6643
|
-
connectionIds: opts.connection,
|
|
6644
|
-
cadence: parseCadence(opts.cadence),
|
|
6645
|
-
sampleCount: parseSampleCount(opts.samples)
|
|
6646
|
-
};
|
|
6647
|
-
}
|
|
6648
|
-
function runSettingsPatchFromOpts(opts) {
|
|
6649
|
-
return ownedConfigPatchFromOpts(opts);
|
|
6650
|
-
}
|
|
6651
|
-
function cadenceLabel(cadence) {
|
|
6652
|
-
return cadence === "NONE" ? "manual" : cadence.toLowerCase();
|
|
6653
|
-
}
|
|
6654
|
-
|
|
6655
|
-
// src/lib/runDefinitionFiles.ts
|
|
6656
|
-
import { execFileSync } from "child_process";
|
|
6657
|
-
import { isAbsolute, relative, resolve, sep } from "path";
|
|
6658
|
-
|
|
6659
|
-
// ../packages/api-schemas/src/inputPaths.ts
|
|
6660
|
-
import { minimatch } from "minimatch";
|
|
6661
|
-
function matchInputPaths(paths, patterns, options = {}) {
|
|
6662
|
-
for (const pattern of patterns) inputPathSchema.parse(pattern);
|
|
6663
|
-
const selections = patterns.map((pattern) => ({
|
|
6664
|
-
pattern,
|
|
6665
|
-
matches: paths.filter(
|
|
6666
|
-
(path3) => minimatch(path3, pattern, { dot: true, nocase: false, nonegate: true })
|
|
6667
|
-
)
|
|
6668
|
-
}));
|
|
6669
|
-
if (options.allowEmptySelection && selections.every(({ matches }) => matches.length === 0))
|
|
6670
|
-
return [];
|
|
6671
|
-
const selected = /* @__PURE__ */ new Set();
|
|
6672
|
-
for (const { pattern, matches } of selections) {
|
|
6673
|
-
if (!matches.length) throw new Error(`No committed files match ${pattern}`);
|
|
6674
|
-
for (const path3 of matches) selected.add(path3);
|
|
6675
|
-
}
|
|
6676
|
-
return [...selected].sort();
|
|
6677
|
-
}
|
|
6678
|
-
|
|
6679
|
-
// ../packages/api-schemas/src/compileRunDefinition.ts
|
|
6680
|
-
import { createHash as createHash2 } from "crypto";
|
|
6681
|
-
import { parseDocument } from "yaml";
|
|
6682
|
-
function utf8(bytes, path3) {
|
|
6683
|
-
try {
|
|
6684
|
-
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
6685
|
-
} catch {
|
|
6686
|
-
throw new Error(`${path3} is not UTF-8 text`);
|
|
6687
|
-
}
|
|
6688
|
-
}
|
|
6689
|
-
function parseRunDefinitionCase(path3, bytes) {
|
|
6690
|
-
const source2 = utf8(bytes, path3);
|
|
6691
|
-
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(source2);
|
|
6692
|
-
if (!match)
|
|
6693
|
-
throw new Error(`${path3}: expected YAML frontmatter between --- lines`);
|
|
6694
|
-
const document = parseDocument(match[1], { uniqueKeys: true });
|
|
6695
|
-
if (document.errors.length)
|
|
6696
|
-
throw new Error(
|
|
6697
|
-
`${path3}: ${document.errors.map((error) => error.message).join("; ")}`
|
|
6698
|
-
);
|
|
6699
|
-
const parsed = runDefinitionFrontmatterSchema.safeParse(document.toJS());
|
|
6700
|
-
if (!parsed.success) throw new Error(`${path3}: ${parsed.error.message}`);
|
|
6701
|
-
const prompt = match[2].trim();
|
|
6702
|
-
if (!prompt) throw new Error(`${path3}: Markdown body is empty`);
|
|
6703
|
-
return { path: path3, prompt, ...parsed.data };
|
|
6640
|
+
function parseRunDefinitionCase(path3, bytes) {
|
|
6641
|
+
const source2 = utf8(bytes, path3);
|
|
6642
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(source2);
|
|
6643
|
+
if (!match)
|
|
6644
|
+
throw new Error(`${path3}: expected YAML frontmatter between --- lines`);
|
|
6645
|
+
const document = parseDocument(match[1], { uniqueKeys: true });
|
|
6646
|
+
if (document.errors.length)
|
|
6647
|
+
throw new Error(
|
|
6648
|
+
`${path3}: ${document.errors.map((error) => error.message).join("; ")}`
|
|
6649
|
+
);
|
|
6650
|
+
const parsed = runDefinitionFrontmatterSchema.safeParse(document.toJS());
|
|
6651
|
+
if (!parsed.success) throw new Error(`${path3}: ${parsed.error.message}`);
|
|
6652
|
+
const prompt = match[2].trim();
|
|
6653
|
+
if (!prompt) throw new Error(`${path3}: Markdown body is empty`);
|
|
6654
|
+
return { path: path3, prompt, ...parsed.data };
|
|
6704
6655
|
}
|
|
6705
6656
|
function compileRunDefinitionFromBlobs(input) {
|
|
6706
|
-
if (!uncredentialedRepoUrlSchema.safeParse(input.repoUrl).success)
|
|
6657
|
+
if (input.repoUrl !== null && !uncredentialedRepoUrlSchema.safeParse(input.repoUrl).success)
|
|
6707
6658
|
throw new Error("Git origin must not contain embedded credentials");
|
|
6708
|
-
if (!/^[a-f0-9]{40}$/i.test(input.commit))
|
|
6659
|
+
if (input.commit !== null && !/^[a-f0-9]{40}$/i.test(input.commit))
|
|
6709
6660
|
throw new Error("Expected a full Git commit SHA");
|
|
6710
6661
|
if (input.casePaths.length === 0)
|
|
6711
6662
|
throw new Error("At least one Markdown case is required");
|
|
@@ -6727,7 +6678,7 @@ function compileRunDefinitionFromBlobs(input) {
|
|
|
6727
6678
|
const cases = input.casePaths.map((path3) => {
|
|
6728
6679
|
const bytes = input.blobs.get(path3);
|
|
6729
6680
|
if (!path3.endsWith(".md") || !bytes)
|
|
6730
|
-
throw new Error(`Missing
|
|
6681
|
+
throw new Error(`Missing Markdown case: ${path3}`);
|
|
6731
6682
|
return parseRunDefinitionCase(path3, bytes);
|
|
6732
6683
|
});
|
|
6733
6684
|
const hash = createHash2("sha256");
|
|
@@ -6750,148 +6701,83 @@ function compileRunDefinitionFromBlobs(input) {
|
|
|
6750
6701
|
digest: `sha256:${hash.digest("hex")}`,
|
|
6751
6702
|
verification: input.verification
|
|
6752
6703
|
},
|
|
6753
|
-
resources: Object.entries(config?.inputs ?? {}).map(
|
|
6754
|
-
|
|
6755
|
-
|
|
6704
|
+
resources: input.resources ?? Object.entries(config?.inputs ?? {}).map(([name, item]) => {
|
|
6705
|
+
if (!input.repoUrl || !input.commit)
|
|
6706
|
+
throw new Error(
|
|
6707
|
+
`Supply --input ${name}=<path> outside a Git checkout with an origin`
|
|
6708
|
+
);
|
|
6709
|
+
return compileDefinitionInput(name, item, input.repoUrl, input.commit);
|
|
6710
|
+
}),
|
|
6756
6711
|
cases
|
|
6757
6712
|
});
|
|
6758
6713
|
return { definition: submission, org: config?.org };
|
|
6759
6714
|
}
|
|
6760
6715
|
|
|
6761
|
-
// src/
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
}
|
|
6771
|
-
|
|
6772
|
-
|
|
6716
|
+
// ../packages/api-schemas/src/inputPaths.ts
|
|
6717
|
+
import { minimatch } from "minimatch";
|
|
6718
|
+
function matchInputPaths(paths, patterns, options = {}) {
|
|
6719
|
+
for (const pattern of patterns) inputPathSchema.parse(pattern);
|
|
6720
|
+
const selections = patterns.map((pattern) => ({
|
|
6721
|
+
pattern,
|
|
6722
|
+
matches: paths.filter(
|
|
6723
|
+
(path3) => minimatch(path3, pattern, { dot: true, nocase: false, nonegate: true })
|
|
6724
|
+
)
|
|
6725
|
+
}));
|
|
6726
|
+
if (options.allowEmptySelection && selections.every(({ matches }) => matches.length === 0))
|
|
6727
|
+
return [];
|
|
6728
|
+
const selected = /* @__PURE__ */ new Set();
|
|
6729
|
+
for (const { pattern, matches } of selections) {
|
|
6730
|
+
if (!matches.length) throw new Error(`No committed files match ${pattern}`);
|
|
6731
|
+
for (const path3 of matches) selected.add(path3);
|
|
6773
6732
|
}
|
|
6733
|
+
return [...selected].sort();
|
|
6774
6734
|
}
|
|
6775
|
-
|
|
6776
|
-
|
|
6735
|
+
|
|
6736
|
+
// src/lib/localRunInputs.ts
|
|
6737
|
+
import { create as tar } from "tar";
|
|
6738
|
+
|
|
6739
|
+
// src/lib/verifyEvals.ts
|
|
6740
|
+
import { execFileSync } from "child_process";
|
|
6741
|
+
import { lstatSync, readdirSync, readFileSync as readFileSync6, realpathSync } from "fs";
|
|
6742
|
+
import { isAbsolute, join as join3, relative, resolve, sep } from "path";
|
|
6743
|
+
import { minimatch as minimatch2 } from "minimatch";
|
|
6744
|
+
import { parseDocument as parseDocument2 } from "yaml";
|
|
6745
|
+
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
6746
|
+
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
6747
|
+
var check = (id2, state, detail) => ({ id: id2, state, detail });
|
|
6748
|
+
var dynamic = (value) => typeof value !== "string" || value.includes("${{");
|
|
6749
|
+
var condition = (value) => {
|
|
6750
|
+
if (value === void 0 || value === true) return true;
|
|
6751
|
+
if (value === false) return false;
|
|
6752
|
+
if (typeof value === "string") {
|
|
6753
|
+
const compact2 = value.replace(/\s/g, "");
|
|
6754
|
+
if (compact2 === "true" || compact2 === `\${{true}}`) return true;
|
|
6755
|
+
if (compact2 === "false" || compact2 === `\${{false}}`) return false;
|
|
6756
|
+
}
|
|
6757
|
+
return void 0;
|
|
6758
|
+
};
|
|
6759
|
+
function git(cwd, args) {
|
|
6760
|
+
return execFileSync("git", args, {
|
|
6761
|
+
cwd,
|
|
6762
|
+
encoding: "utf8",
|
|
6763
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6764
|
+
maxBuffer: 16 * 1024 * 1024
|
|
6765
|
+
});
|
|
6777
6766
|
}
|
|
6778
|
-
function
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
throw new CliError(
|
|
6785
|
-
"usage",
|
|
6786
|
-
`case path is outside this Git repository: ${input}`
|
|
6787
|
-
);
|
|
6788
|
-
const gitPath = path3.split(sep).join("/");
|
|
6789
|
-
return gitPath;
|
|
6767
|
+
function rootDirectory(cwd) {
|
|
6768
|
+
try {
|
|
6769
|
+
return git(cwd, ["rev-parse", "--show-toplevel"]).trim();
|
|
6770
|
+
} catch {
|
|
6771
|
+
return resolve(cwd);
|
|
6772
|
+
}
|
|
6790
6773
|
}
|
|
6791
|
-
function
|
|
6792
|
-
const
|
|
6793
|
-
const commit = git(root, ["rev-parse", "--verify", "HEAD^{commit}"]).toString("utf8").trim();
|
|
6794
|
-
let repoUrl;
|
|
6774
|
+
function regularFile(root, path3) {
|
|
6775
|
+
const full = join3(root, path3);
|
|
6795
6776
|
try {
|
|
6796
|
-
|
|
6777
|
+
const rel = relative(realpathSync(root), realpathSync(full));
|
|
6778
|
+
return rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel) && lstatSync(full).isFile();
|
|
6797
6779
|
} catch {
|
|
6798
|
-
|
|
6799
|
-
"usage",
|
|
6800
|
-
"Git origin is required to identify the committed definition repository"
|
|
6801
|
-
);
|
|
6802
|
-
}
|
|
6803
|
-
if (!uncredentialedRepoUrlSchema.safeParse(repoUrl).success)
|
|
6804
|
-
throw new CliError(
|
|
6805
|
-
"usage",
|
|
6806
|
-
"Git origin must be a repository URL without embedded credentials or query parameters"
|
|
6807
|
-
);
|
|
6808
|
-
const blobs = /* @__PURE__ */ new Map();
|
|
6809
|
-
const hasConfig = git(root, ["ls-tree", "--name-only", commit, "--", "gauge.json"]).toString("utf8").trim() === "gauge.json";
|
|
6810
|
-
if (hasConfig) {
|
|
6811
|
-
blobs.set("gauge.json", committedBlob(root, commit, "gauge.json"));
|
|
6812
|
-
}
|
|
6813
|
-
let paths;
|
|
6814
|
-
try {
|
|
6815
|
-
const config = runDefinitionFileConfigSchema.parse(
|
|
6816
|
-
blobs.has("gauge.json") ? JSON.parse(blobs.get("gauge.json").toString("utf8")) : {}
|
|
6817
|
-
);
|
|
6818
|
-
const tree = git(root, ["ls-tree", "-r", "-z", commit]).toString("utf8").split("\0").filter((entry) => /^(100644|100755) blob /.test(entry)).map((entry) => entry.slice(entry.indexOf(" ") + 1));
|
|
6819
|
-
const patterns = files.length ? files.map((file) => relativeGitPath(root, cwd, file)) : config.cases;
|
|
6820
|
-
paths = matchInputPaths(tree, patterns);
|
|
6821
|
-
if (paths.length > 20 || paths.some((path3) => !path3.endsWith(".md")))
|
|
6822
|
-
throw new Error("Expected 1\u201320 committed Markdown cases");
|
|
6823
|
-
for (const path3 of paths)
|
|
6824
|
-
blobs.set(path3, committedBlob(root, commit, path3));
|
|
6825
|
-
} catch (error) {
|
|
6826
|
-
throw new CliError(
|
|
6827
|
-
"usage",
|
|
6828
|
-
error instanceof Error ? error.message : String(error)
|
|
6829
|
-
);
|
|
6830
|
-
}
|
|
6831
|
-
try {
|
|
6832
|
-
const result = compileRunDefinitionFromBlobs({
|
|
6833
|
-
repoUrl,
|
|
6834
|
-
commit,
|
|
6835
|
-
casePaths: paths,
|
|
6836
|
-
blobs,
|
|
6837
|
-
verification: "SUBMITTED_UNVERIFIED"
|
|
6838
|
-
});
|
|
6839
|
-
return { definition: result.definition, org: result.org };
|
|
6840
|
-
} catch (error) {
|
|
6841
|
-
throw new CliError(
|
|
6842
|
-
"usage",
|
|
6843
|
-
error instanceof Error ? error.message : String(error)
|
|
6844
|
-
);
|
|
6845
|
-
}
|
|
6846
|
-
}
|
|
6847
|
-
|
|
6848
|
-
// src/lib/staff.ts
|
|
6849
|
-
function staffCommandsVisible(config = readConfig()) {
|
|
6850
|
-
return config.staff === true;
|
|
6851
|
-
}
|
|
6852
|
-
|
|
6853
|
-
// src/lib/verifyEvals.ts
|
|
6854
|
-
import { execFileSync as execFileSync2 } from "child_process";
|
|
6855
|
-
import { lstatSync, readdirSync, readFileSync as readFileSync6, realpathSync } from "fs";
|
|
6856
|
-
import { isAbsolute as isAbsolute2, join as join3, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
|
|
6857
|
-
import { minimatch as minimatch2 } from "minimatch";
|
|
6858
|
-
import { parseDocument as parseDocument2 } from "yaml";
|
|
6859
|
-
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
6860
|
-
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
6861
|
-
var check = (id2, state, detail) => ({ id: id2, state, detail });
|
|
6862
|
-
var dynamic = (value) => typeof value !== "string" || value.includes("${{");
|
|
6863
|
-
var condition = (value) => {
|
|
6864
|
-
if (value === void 0 || value === true) return true;
|
|
6865
|
-
if (value === false) return false;
|
|
6866
|
-
if (typeof value === "string") {
|
|
6867
|
-
const compact2 = value.replace(/\s/g, "");
|
|
6868
|
-
if (compact2 === "true" || compact2 === `\${{true}}`) return true;
|
|
6869
|
-
if (compact2 === "false" || compact2 === `\${{false}}`) return false;
|
|
6870
|
-
}
|
|
6871
|
-
return void 0;
|
|
6872
|
-
};
|
|
6873
|
-
function git2(cwd, args) {
|
|
6874
|
-
return execFileSync2("git", args, {
|
|
6875
|
-
cwd,
|
|
6876
|
-
encoding: "utf8",
|
|
6877
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
6878
|
-
maxBuffer: 16 * 1024 * 1024
|
|
6879
|
-
});
|
|
6880
|
-
}
|
|
6881
|
-
function rootDirectory(cwd) {
|
|
6882
|
-
try {
|
|
6883
|
-
return git2(cwd, ["rev-parse", "--show-toplevel"]).trim();
|
|
6884
|
-
} catch {
|
|
6885
|
-
return resolve2(cwd);
|
|
6886
|
-
}
|
|
6887
|
-
}
|
|
6888
|
-
function regularFile(root, path3) {
|
|
6889
|
-
const full = join3(root, path3);
|
|
6890
|
-
try {
|
|
6891
|
-
const rel = relative2(realpathSync(root), realpathSync(full));
|
|
6892
|
-
return rel !== ".." && !rel.startsWith(`..${sep2}`) && !isAbsolute2(rel) && lstatSync(full).isFile();
|
|
6893
|
-
} catch {
|
|
6894
|
-
return false;
|
|
6780
|
+
return false;
|
|
6895
6781
|
}
|
|
6896
6782
|
}
|
|
6897
6783
|
function read(root, path3) {
|
|
@@ -6904,7 +6790,7 @@ function read(root, path3) {
|
|
|
6904
6790
|
function workingFiles(root) {
|
|
6905
6791
|
let paths;
|
|
6906
6792
|
try {
|
|
6907
|
-
paths =
|
|
6793
|
+
paths = git(root, [
|
|
6908
6794
|
"ls-files",
|
|
6909
6795
|
"--cached",
|
|
6910
6796
|
"--others",
|
|
@@ -7008,22 +6894,22 @@ function workflowChecks(root, input) {
|
|
|
7008
6894
|
);
|
|
7009
6895
|
const events = typeof workflow.on === "string" ? [workflow.on] : Array.isArray(workflow.on) ? workflow.on : Object.keys(record(workflow.on));
|
|
7010
6896
|
const pr = events.includes("pull_request");
|
|
7011
|
-
const
|
|
6897
|
+
const recognizedCheckout = (step) => {
|
|
7012
6898
|
const options = record(step.with);
|
|
7013
6899
|
if (options.repository !== void 0) return false;
|
|
7014
6900
|
if (!events.length || options.ref !== void 0 && typeof options.ref !== "string")
|
|
7015
6901
|
return false;
|
|
7016
6902
|
const ref = typeof options.ref === "string" ? options.ref.replace(/\s/g, "") : "";
|
|
7017
|
-
return
|
|
7018
|
-
(event) =>
|
|
7019
|
-
) && (!ref || ref === `\${{github.sha}}`)
|
|
6903
|
+
return events.every(
|
|
6904
|
+
(event) => ["pull_request", "push", "workflow_dispatch"].includes(event)
|
|
6905
|
+
) && (!ref || ref === `\${{github.sha}}`) || ref === `\${{github.event.pull_request.head.sha||github.sha}}` || pr && events.every((event) => event === "pull_request") && ref === `\${{github.event.pull_request.head.sha}}`;
|
|
7020
6906
|
};
|
|
7021
|
-
const checkoutState = checkouts.length > 0 && checkouts.every(({ step }) =>
|
|
6907
|
+
const checkoutState = checkouts.length > 0 && checkouts.every(({ step }) => recognizedCheckout(step)) ? "yes" : "unknown";
|
|
7022
6908
|
checks.push(
|
|
7023
6909
|
check(
|
|
7024
6910
|
"candidate-checkout",
|
|
7025
6911
|
checkoutState,
|
|
7026
|
-
checkoutState === "yes" ? "
|
|
6912
|
+
checkoutState === "yes" ? "Workflow checkout recognized, including the default PR merge checkout" : "Could not inspect checkout settings; check that your workflow builds the intended code"
|
|
7027
6913
|
)
|
|
7028
6914
|
);
|
|
7029
6915
|
const filtered = Object.values(record(workflow.on)).some(
|
|
@@ -7143,133 +7029,670 @@ function verifyEvals(cwd = process.cwd()) {
|
|
|
7143
7029
|
let raw = {};
|
|
7144
7030
|
let files;
|
|
7145
7031
|
try {
|
|
7146
|
-
files = workingFiles(root);
|
|
7147
|
-
} catch (error) {
|
|
7148
|
-
result.global.push(check("working-tree", "no", message(error)));
|
|
7149
|
-
return finish();
|
|
7032
|
+
files = workingFiles(root);
|
|
7033
|
+
} catch (error) {
|
|
7034
|
+
result.global.push(check("working-tree", "no", message(error)));
|
|
7035
|
+
return finish();
|
|
7036
|
+
}
|
|
7037
|
+
try {
|
|
7038
|
+
result.facts.configFilePresent = files.includes("gauge.json") || regularFile(root, "gauge.json");
|
|
7039
|
+
if (result.facts.configFilePresent)
|
|
7040
|
+
raw = JSON.parse(read(root, "gauge.json").toString("utf8"));
|
|
7041
|
+
else
|
|
7042
|
+
result.info.push({
|
|
7043
|
+
id: "config-file-absent",
|
|
7044
|
+
detail: "Optional gauge.json is absent; using default case discovery and no inputs"
|
|
7045
|
+
});
|
|
7046
|
+
} catch (error) {
|
|
7047
|
+
result.global.push(check("configuration", "no", message(error)));
|
|
7048
|
+
return finish();
|
|
7049
|
+
}
|
|
7050
|
+
const config = runDefinitionFileConfigSchema.safeParse(raw);
|
|
7051
|
+
result.global.push(
|
|
7052
|
+
check(
|
|
7053
|
+
"configuration",
|
|
7054
|
+
config.success ? "yes" : "no",
|
|
7055
|
+
config.success ? "Configuration matches the supported gauge.json schema" : config.error.message
|
|
7056
|
+
)
|
|
7057
|
+
);
|
|
7058
|
+
const rawInputs = record(record(raw).inputs);
|
|
7059
|
+
for (const [name, value] of Object.entries(rawInputs).sort(
|
|
7060
|
+
([a], [b]) => a.localeCompare(b)
|
|
7061
|
+
)) {
|
|
7062
|
+
const parsed = runDefinitionInputSchema.safeParse(value);
|
|
7063
|
+
result.inputs.push({
|
|
7064
|
+
name,
|
|
7065
|
+
checks: parsed.success ? inputChecks(root, files, parsed.data) : [check("configuration", "no", parsed.error.message)]
|
|
7066
|
+
});
|
|
7067
|
+
}
|
|
7068
|
+
if (config.success) {
|
|
7069
|
+
try {
|
|
7070
|
+
const paths = matchInputPaths(files, config.data.cases, {
|
|
7071
|
+
allowEmptySelection: true
|
|
7072
|
+
});
|
|
7073
|
+
if (paths.length > 20 || paths.some((path3) => !path3.endsWith(".md")))
|
|
7074
|
+
throw new Error("Expected at most 20 Markdown cases");
|
|
7075
|
+
result.facts.caseCount = paths.length;
|
|
7076
|
+
if (paths.length)
|
|
7077
|
+
result.global.push(
|
|
7078
|
+
check(
|
|
7079
|
+
"case-discovery",
|
|
7080
|
+
"yes",
|
|
7081
|
+
`${paths.length} working-tree case(s) selected`
|
|
7082
|
+
)
|
|
7083
|
+
);
|
|
7084
|
+
else
|
|
7085
|
+
result.info.push({
|
|
7086
|
+
id: "no-cases",
|
|
7087
|
+
detail: "No eval cases found; input-only setup is valid, but no evaluations will run"
|
|
7088
|
+
});
|
|
7089
|
+
for (const path3 of paths) {
|
|
7090
|
+
try {
|
|
7091
|
+
const item = parseRunDefinitionCase(path3, read(root, path3));
|
|
7092
|
+
const missing = (item.config.inputs ?? []).filter(
|
|
7093
|
+
(name) => !Object.hasOwn(config.data.inputs, name)
|
|
7094
|
+
);
|
|
7095
|
+
if (missing.length)
|
|
7096
|
+
throw new Error(`${path3}: Unknown input(s): ${missing.join(", ")}`);
|
|
7097
|
+
const commandOwners = /* @__PURE__ */ new Map();
|
|
7098
|
+
for (const name of new Set(
|
|
7099
|
+
item.config.inputs ?? Object.keys(config.data.inputs)
|
|
7100
|
+
)) {
|
|
7101
|
+
const input = config.data.inputs[name];
|
|
7102
|
+
if (input.type !== "binary") continue;
|
|
7103
|
+
for (const command of Object.keys(input.commands)) {
|
|
7104
|
+
const owner = commandOwners.get(command);
|
|
7105
|
+
if (owner)
|
|
7106
|
+
throw new Error(
|
|
7107
|
+
`${path3}: Inputs ${owner} and ${name} both expose command ${command}; choose distinct commands or separate cases`
|
|
7108
|
+
);
|
|
7109
|
+
commandOwners.set(command, name);
|
|
7110
|
+
}
|
|
7111
|
+
}
|
|
7112
|
+
result.global.push(
|
|
7113
|
+
check(
|
|
7114
|
+
`case.${path3}`,
|
|
7115
|
+
"yes",
|
|
7116
|
+
"Case syntax, input references, and declared command names are valid"
|
|
7117
|
+
)
|
|
7118
|
+
);
|
|
7119
|
+
} catch (error) {
|
|
7120
|
+
result.global.push(check(`case.${path3}`, "no", message(error)));
|
|
7121
|
+
}
|
|
7122
|
+
}
|
|
7123
|
+
} catch (error) {
|
|
7124
|
+
result.global.push(
|
|
7125
|
+
check(
|
|
7126
|
+
"case-discovery",
|
|
7127
|
+
"no",
|
|
7128
|
+
message(error).replace("committed files", "working-tree files")
|
|
7129
|
+
)
|
|
7130
|
+
);
|
|
7131
|
+
}
|
|
7132
|
+
} else
|
|
7133
|
+
result.info.push({
|
|
7134
|
+
id: "case-validation-skipped",
|
|
7135
|
+
detail: "Fix gauge.json before validating cases and input references"
|
|
7136
|
+
});
|
|
7137
|
+
return finish();
|
|
7138
|
+
}
|
|
7139
|
+
function printEvalVerification(result) {
|
|
7140
|
+
console.log(`Local static verification: ${result.root}`);
|
|
7141
|
+
const print = (checks) => {
|
|
7142
|
+
for (const item of checks)
|
|
7143
|
+
console.log(` [${item.state}] ${item.id}: ${item.detail}`);
|
|
7144
|
+
};
|
|
7145
|
+
console.log("Global");
|
|
7146
|
+
print(result.global);
|
|
7147
|
+
for (const input of result.inputs) {
|
|
7148
|
+
console.log(`Input: ${input.name}`);
|
|
7149
|
+
print(input.checks);
|
|
7150
|
+
}
|
|
7151
|
+
for (const item of result.info)
|
|
7152
|
+
console.log(`[info] ${item.id}: ${item.detail}`);
|
|
7153
|
+
console.log(
|
|
7154
|
+
`Static verification ${result.status}: ${result.summary.yes} yes, ${result.summary.no} no, ${result.summary.unknown} unknown.`
|
|
7155
|
+
);
|
|
7156
|
+
console.log(
|
|
7157
|
+
"Scope: repository setup only. Live delivery, account settings, and sandbox execution were not tested; no sessions were launched."
|
|
7158
|
+
);
|
|
7159
|
+
}
|
|
7160
|
+
|
|
7161
|
+
// src/lib/localRunInputs.ts
|
|
7162
|
+
var LIMIT = 512 * 1024 * 1024;
|
|
7163
|
+
function parseInputOverrides(values) {
|
|
7164
|
+
const overrides = /* @__PURE__ */ new Map();
|
|
7165
|
+
for (const value of values) {
|
|
7166
|
+
const split = value.indexOf("=");
|
|
7167
|
+
const name = value.slice(0, split);
|
|
7168
|
+
const path3 = value.slice(split + 1);
|
|
7169
|
+
if (split < 1 || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name) || !path3)
|
|
7170
|
+
throw new CliError("usage", "--input expects name=path");
|
|
7171
|
+
if (overrides.has(name))
|
|
7172
|
+
throw new CliError("usage", `Duplicate --input: ${name}`);
|
|
7173
|
+
overrides.set(name, path3);
|
|
7174
|
+
}
|
|
7175
|
+
return overrides;
|
|
7176
|
+
}
|
|
7177
|
+
async function packLocalInput(resource, supplied, output) {
|
|
7178
|
+
const path3 = resolve2(supplied);
|
|
7179
|
+
const info = await lstat(path3);
|
|
7180
|
+
if (!info.isFile() && !info.isDirectory())
|
|
7181
|
+
throw new CliError(
|
|
7182
|
+
"usage",
|
|
7183
|
+
`Input must be an ordinary file or directory: ${supplied}`
|
|
7184
|
+
);
|
|
7185
|
+
let use = resource.use;
|
|
7186
|
+
if (use.type === "website")
|
|
7187
|
+
throw new CliError(
|
|
7188
|
+
"usage",
|
|
7189
|
+
"Website inputs cannot be supplied as local files"
|
|
7190
|
+
);
|
|
7191
|
+
if (use.type === "skill") {
|
|
7192
|
+
if (info.isFile() && !isSkillArchive(path3))
|
|
7193
|
+
throw new CliError(
|
|
7194
|
+
"usage",
|
|
7195
|
+
"Supply a Skill directory, .zip, or .tar.gz archive"
|
|
7196
|
+
);
|
|
7197
|
+
use = { ...use, root: info.isDirectory() ? "." : basename(path3) };
|
|
7198
|
+
} else if (use.type === "npm-package" || use.type === "npm-cli") {
|
|
7199
|
+
if (!info.isFile() || !path3.endsWith(".tgz"))
|
|
7200
|
+
throw new CliError("usage", "Supply the packed npm .tgz file");
|
|
7201
|
+
use = { ...use, package: basename(path3) };
|
|
7202
|
+
} else if (!info.isDirectory())
|
|
7203
|
+
throw new CliError("usage", "Files and binary inputs require a directory");
|
|
7204
|
+
const root = info.isDirectory() ? path3 : dirname(path3);
|
|
7205
|
+
const paths = [];
|
|
7206
|
+
const walk = async (directory) => {
|
|
7207
|
+
for (const entry of await readdir(join4(root, directory), {
|
|
7208
|
+
withFileTypes: true
|
|
7209
|
+
})) {
|
|
7210
|
+
if ([".git", "node_modules", ".aws", ".ssh", ".npmrc", ".pypirc"].includes(
|
|
7211
|
+
entry.name
|
|
7212
|
+
) || entry.name === ".env" || entry.name.startsWith(".env."))
|
|
7213
|
+
continue;
|
|
7214
|
+
const next = directory ? `${directory}/${entry.name}` : entry.name;
|
|
7215
|
+
if (entry.isSymbolicLink() || !entry.isFile() && !entry.isDirectory())
|
|
7216
|
+
throw new CliError(
|
|
7217
|
+
"usage",
|
|
7218
|
+
`Input contains a link or special file: ${next}`
|
|
7219
|
+
);
|
|
7220
|
+
if (entry.isDirectory()) await walk(next);
|
|
7221
|
+
else paths.push(next);
|
|
7222
|
+
if (paths.length > 2e4)
|
|
7223
|
+
throw new CliError("usage", "Input exceeds 20,000 files");
|
|
7224
|
+
}
|
|
7225
|
+
};
|
|
7226
|
+
if (info.isDirectory()) await walk("");
|
|
7227
|
+
else paths.push(basename(path3));
|
|
7228
|
+
const selected = (use.type === "files" || use.type === "binary") && use.paths ? matchInputPaths(paths, use.paths) : paths.sort();
|
|
7229
|
+
if (!selected.length)
|
|
7230
|
+
throw new CliError("usage", "Input contains no selected files");
|
|
7231
|
+
if (use.type === "skill" && info.isDirectory() && !selected.includes("SKILL.md"))
|
|
7232
|
+
throw new CliError(
|
|
7233
|
+
"usage",
|
|
7234
|
+
"Skill directory must contain SKILL.md at its root"
|
|
7235
|
+
);
|
|
7236
|
+
let total = 0;
|
|
7237
|
+
for (const file of selected) {
|
|
7238
|
+
inputPathSchema.parse(file);
|
|
7239
|
+
const entry = await lstat(join4(root, file));
|
|
7240
|
+
if (!entry.isFile())
|
|
7241
|
+
throw new CliError(
|
|
7242
|
+
"usage",
|
|
7243
|
+
`Input file changed or is not an ordinary file: ${file}`
|
|
7244
|
+
);
|
|
7245
|
+
total += entry.size;
|
|
7246
|
+
if (total > LIMIT) throw new CliError("usage", "Input exceeds 512 MiB");
|
|
7247
|
+
}
|
|
7248
|
+
await tar(
|
|
7249
|
+
{
|
|
7250
|
+
cwd: root,
|
|
7251
|
+
file: output,
|
|
7252
|
+
gzip: true,
|
|
7253
|
+
portable: true,
|
|
7254
|
+
noMtime: true,
|
|
7255
|
+
follow: false,
|
|
7256
|
+
noDirRecurse: true
|
|
7257
|
+
},
|
|
7258
|
+
// tar treats a leading @ as an instruction to read another archive.
|
|
7259
|
+
selected.map((file) => `./${file}`)
|
|
7260
|
+
);
|
|
7261
|
+
const bytes = (await stat(output)).size;
|
|
7262
|
+
if (bytes > LIMIT)
|
|
7263
|
+
throw new CliError("usage", "Input archive exceeds 512 MiB");
|
|
7264
|
+
const hash = createHash3("sha256");
|
|
7265
|
+
for await (const chunk of createReadStream(output)) hash.update(chunk);
|
|
7266
|
+
return {
|
|
7267
|
+
use,
|
|
7268
|
+
upload: { path: output, bytes, sha256: `sha256:${hash.digest("hex")}` }
|
|
7269
|
+
};
|
|
7270
|
+
}
|
|
7271
|
+
async function loadLocalRunDefinition(files, values, cwd = process.cwd()) {
|
|
7272
|
+
const directory = await mkdtemp(join4(tmpdir(), "gauge-inputs-"));
|
|
7273
|
+
const cleanup = () => rm(directory, { recursive: true, force: true });
|
|
7274
|
+
try {
|
|
7275
|
+
const root = rootDirectory(cwd);
|
|
7276
|
+
const paths = workingFiles(root);
|
|
7277
|
+
const blobs = /* @__PURE__ */ new Map();
|
|
7278
|
+
if (paths.includes("gauge.json"))
|
|
7279
|
+
blobs.set("gauge.json", read(root, "gauge.json"));
|
|
7280
|
+
const configBytes = blobs.get("gauge.json");
|
|
7281
|
+
const config = runDefinitionFileConfigSchema.parse(
|
|
7282
|
+
configBytes ? JSON.parse(configBytes.toString("utf8")) : {}
|
|
7283
|
+
);
|
|
7284
|
+
const patterns = files.length ? files.map((file) => {
|
|
7285
|
+
const path3 = relative2(root, resolve2(cwd, file));
|
|
7286
|
+
if (!path3 || path3 === ".." || path3.startsWith(`..${sep2}`) || isAbsolute2(path3))
|
|
7287
|
+
throw new CliError(
|
|
7288
|
+
"usage",
|
|
7289
|
+
"Case paths must be inside the definition directory"
|
|
7290
|
+
);
|
|
7291
|
+
return path3.split(sep2).join("/");
|
|
7292
|
+
}) : config.cases;
|
|
7293
|
+
const cases = matchInputPaths(paths, patterns);
|
|
7294
|
+
if (!cases.length || cases.length > 20 || cases.some((path3) => !path3.endsWith(".md")))
|
|
7295
|
+
throw new CliError("usage", "Expected 1\u201320 Markdown cases");
|
|
7296
|
+
for (const path3 of cases) blobs.set(path3, read(root, path3));
|
|
7297
|
+
const selected = new Set(
|
|
7298
|
+
cases.flatMap(
|
|
7299
|
+
(path3) => parseRunDefinitionCase(path3, blobs.get(path3) ?? Buffer.alloc(0)).config.inputs ?? Object.keys(config.inputs)
|
|
7300
|
+
)
|
|
7301
|
+
);
|
|
7302
|
+
const overrides = parseInputOverrides(values);
|
|
7303
|
+
for (const name of overrides.keys()) {
|
|
7304
|
+
if (!(name in config.inputs))
|
|
7305
|
+
throw new CliError("usage", `Unknown input: ${name}`);
|
|
7306
|
+
if (!selected.has(name))
|
|
7307
|
+
throw new CliError(
|
|
7308
|
+
"usage",
|
|
7309
|
+
`Input is not used by the selected cases: ${name}`
|
|
7310
|
+
);
|
|
7311
|
+
}
|
|
7312
|
+
const git3 = (args) => {
|
|
7313
|
+
try {
|
|
7314
|
+
return execFileSync2("git", args, {
|
|
7315
|
+
cwd: root,
|
|
7316
|
+
encoding: "utf8",
|
|
7317
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7318
|
+
}).trim();
|
|
7319
|
+
} catch {
|
|
7320
|
+
return null;
|
|
7321
|
+
}
|
|
7322
|
+
};
|
|
7323
|
+
const commit = git3(["rev-parse", "--verify", "HEAD^{commit}"]);
|
|
7324
|
+
const origin = git3(["remote", "get-url", "origin"]);
|
|
7325
|
+
const repoUrl = origin && uncredentialedRepoUrlSchema.safeParse(origin).success ? origin : null;
|
|
7326
|
+
const resources = [];
|
|
7327
|
+
const uploads = [];
|
|
7328
|
+
for (const [name, input] of Object.entries(config.inputs)) {
|
|
7329
|
+
if (!selected.has(name)) continue;
|
|
7330
|
+
const original = compileDefinitionInput(
|
|
7331
|
+
name,
|
|
7332
|
+
input,
|
|
7333
|
+
repoUrl ?? "",
|
|
7334
|
+
commit ?? ""
|
|
7335
|
+
);
|
|
7336
|
+
const supplied = overrides.get(name);
|
|
7337
|
+
if (supplied !== void 0) {
|
|
7338
|
+
const { use, upload } = await packLocalInput(
|
|
7339
|
+
original,
|
|
7340
|
+
resolve2(cwd, supplied),
|
|
7341
|
+
join4(directory, `${name}.tar.gz`)
|
|
7342
|
+
);
|
|
7343
|
+
uploads.push(upload);
|
|
7344
|
+
resources.push({
|
|
7345
|
+
...original,
|
|
7346
|
+
use,
|
|
7347
|
+
source: {
|
|
7348
|
+
type: "upload",
|
|
7349
|
+
sha256: upload.sha256,
|
|
7350
|
+
bytes: upload.bytes,
|
|
7351
|
+
repoUrl,
|
|
7352
|
+
commit
|
|
7353
|
+
}
|
|
7354
|
+
});
|
|
7355
|
+
} else {
|
|
7356
|
+
if (!repoUrl || !commit)
|
|
7357
|
+
throw new CliError(
|
|
7358
|
+
"usage",
|
|
7359
|
+
`Supply --input ${name}=<path>; its configured source requires a Git checkout with an origin`
|
|
7360
|
+
);
|
|
7361
|
+
resources.push(original);
|
|
7362
|
+
}
|
|
7363
|
+
}
|
|
7364
|
+
return {
|
|
7365
|
+
...compileRunDefinitionFromBlobs({
|
|
7366
|
+
repoUrl,
|
|
7367
|
+
commit,
|
|
7368
|
+
resources,
|
|
7369
|
+
blobs,
|
|
7370
|
+
casePaths: cases,
|
|
7371
|
+
verification: "LOCAL"
|
|
7372
|
+
}),
|
|
7373
|
+
uploads,
|
|
7374
|
+
cleanup
|
|
7375
|
+
};
|
|
7376
|
+
} catch (error) {
|
|
7377
|
+
await cleanup();
|
|
7378
|
+
throw error;
|
|
7379
|
+
}
|
|
7380
|
+
}
|
|
7381
|
+
async function uploadLocalInputs(client, org, uploads) {
|
|
7382
|
+
for (const input of uploads) {
|
|
7383
|
+
const signed = await client.post(
|
|
7384
|
+
`/api/v1/orgs/${encodeURIComponent(org)}/run-definitions/uploads`,
|
|
7385
|
+
{ sha256: input.sha256, bytes: input.bytes }
|
|
7386
|
+
);
|
|
7387
|
+
const signal = AbortSignal.timeout(10 * 60 * 1e3);
|
|
7388
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
7389
|
+
const body2 = createReadStream(input.path);
|
|
7390
|
+
let response;
|
|
7391
|
+
try {
|
|
7392
|
+
response = await fetch(signed.url, {
|
|
7393
|
+
method: "PUT",
|
|
7394
|
+
headers: signed.headers,
|
|
7395
|
+
body: body2,
|
|
7396
|
+
duplex: "half",
|
|
7397
|
+
redirect: "error",
|
|
7398
|
+
signal
|
|
7399
|
+
});
|
|
7400
|
+
} finally {
|
|
7401
|
+
body2.destroy();
|
|
7402
|
+
}
|
|
7403
|
+
await response.body?.cancel();
|
|
7404
|
+
if (response.ok || response.status === 412) break;
|
|
7405
|
+
if (response.status !== 409 || attempt === 2)
|
|
7406
|
+
throw new CliError(
|
|
7407
|
+
"network",
|
|
7408
|
+
`Input upload failed (${response.status})`
|
|
7409
|
+
);
|
|
7410
|
+
await delay(100 * 2 ** attempt, void 0, { signal });
|
|
7411
|
+
}
|
|
7412
|
+
}
|
|
7413
|
+
}
|
|
7414
|
+
|
|
7415
|
+
// src/lib/ownedConfig.ts
|
|
7416
|
+
function parseCadence(raw) {
|
|
7417
|
+
const cadence = (raw ?? "NONE").trim().toUpperCase();
|
|
7418
|
+
if (!["NONE", "DAILY", "WEEKLY", "MONTHLY"].includes(cadence))
|
|
7419
|
+
throw new CliError(
|
|
7420
|
+
"usage",
|
|
7421
|
+
`invalid cadence "${raw}" (expected none, daily, weekly, or monthly)`
|
|
7422
|
+
);
|
|
7423
|
+
return cadence;
|
|
7424
|
+
}
|
|
7425
|
+
function parseSampleCount(raw) {
|
|
7426
|
+
const value = Number(raw ?? "1");
|
|
7427
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > 50)
|
|
7428
|
+
throw new CliError("usage", "--samples must be an integer from 1 to 50");
|
|
7429
|
+
return value;
|
|
7430
|
+
}
|
|
7431
|
+
function addOwnedConfigCreateOptions(command) {
|
|
7432
|
+
return command.option("--repo <url>", "repository URL (default: the Gauge scaffold)").option("--ref <ref>", "branch, tag, or commit (with --repo)").option("--persona <profileId>", "persona profile id").option(
|
|
7433
|
+
"--agent <agent[:m1,m2]>",
|
|
7434
|
+
"agent and optional model pins (repeatable)",
|
|
7435
|
+
collect,
|
|
7436
|
+
[]
|
|
7437
|
+
).option(
|
|
7438
|
+
"--skill <name@label>",
|
|
7439
|
+
"staged skill (repeatable)",
|
|
7440
|
+
collect,
|
|
7441
|
+
[]
|
|
7442
|
+
).option(
|
|
7443
|
+
"--mcp <name@label>",
|
|
7444
|
+
"MCP server (repeatable)",
|
|
7445
|
+
collect,
|
|
7446
|
+
[]
|
|
7447
|
+
).option(
|
|
7448
|
+
"--connection <id>",
|
|
7449
|
+
"connection id (repeatable)",
|
|
7450
|
+
collect,
|
|
7451
|
+
[]
|
|
7452
|
+
).option("--cadence <cadence>", "none | daily | weekly | monthly", "none").option("--samples <n>", "sample count from 1 to 50", "1");
|
|
7453
|
+
}
|
|
7454
|
+
function addOwnedConfigEditOptions(command) {
|
|
7455
|
+
return command.option(
|
|
7456
|
+
"--repo <url>",
|
|
7457
|
+
"set the repository URL (keeps an existing ref pin)"
|
|
7458
|
+
).option("--ref <ref>", "set the branch, tag, or commit pin").option("--clear-ref", "drop the ref pin (use the default branch)").option("--clear-repo", "reset to the default scaffold").option("--persona <profileId>", "set the persona profile id").option("--clear-persona", "use the default persona").option(
|
|
7459
|
+
"--agent <agent[:m1,m2]>",
|
|
7460
|
+
"replace agents and model pins (repeatable)",
|
|
7461
|
+
collect,
|
|
7462
|
+
[]
|
|
7463
|
+
).option(
|
|
7464
|
+
"--skill <name@label>",
|
|
7465
|
+
"replace skills (repeatable)",
|
|
7466
|
+
collect,
|
|
7467
|
+
[]
|
|
7468
|
+
).option("--clear-skills", "remove all skills").option(
|
|
7469
|
+
"--mcp <name@label>",
|
|
7470
|
+
"replace MCP servers (repeatable)",
|
|
7471
|
+
collect,
|
|
7472
|
+
[]
|
|
7473
|
+
).option("--clear-mcp", "remove all MCP servers").option(
|
|
7474
|
+
"--connection <id>",
|
|
7475
|
+
"replace connections (repeatable)",
|
|
7476
|
+
collect,
|
|
7477
|
+
[]
|
|
7478
|
+
).option("--clear-connections", "remove all connections").option("--cadence <cadence>", "none | daily | weekly | monthly").option("--samples <n>", "sample count from 1 to 50");
|
|
7479
|
+
}
|
|
7480
|
+
function ownedConfigFromOpts(opts) {
|
|
7481
|
+
if (opts.ref !== void 0 && opts.repo === void 0)
|
|
7482
|
+
throw new CliError("usage", "--ref requires --repo");
|
|
7483
|
+
if (opts.agent.length === 0)
|
|
7484
|
+
throw new CliError("usage", "at least one --agent is required");
|
|
7485
|
+
return {
|
|
7486
|
+
repoUrl: opts.repo ?? null,
|
|
7487
|
+
repoRef: opts.ref ?? null,
|
|
7488
|
+
profileId: opts.persona ?? null,
|
|
7489
|
+
agents: buildAgentRoster(opts.agent),
|
|
7490
|
+
skillRefs: validateAssetRefs("skill", opts.skill),
|
|
7491
|
+
mcpRefs: validateAssetRefs("mcp", opts.mcp),
|
|
7492
|
+
connectionIds: opts.connection,
|
|
7493
|
+
cadence: parseCadence(opts.cadence),
|
|
7494
|
+
sampleCount: parseSampleCount(opts.samples)
|
|
7495
|
+
};
|
|
7496
|
+
}
|
|
7497
|
+
function ownedConfigPatchFromOpts(opts) {
|
|
7498
|
+
const patch = {};
|
|
7499
|
+
if ((opts.repo !== void 0 || opts.ref !== void 0) && opts.clearRepo)
|
|
7500
|
+
throw new CliError("usage", "--repo/--ref and --clear-repo conflict");
|
|
7501
|
+
if (opts.ref !== void 0 && opts.clearRef)
|
|
7502
|
+
throw new CliError("usage", "--ref and --clear-ref conflict");
|
|
7503
|
+
if (opts.clearRepo) {
|
|
7504
|
+
patch.repoUrl = null;
|
|
7505
|
+
patch.repoRef = null;
|
|
7506
|
+
} else {
|
|
7507
|
+
if (opts.repo !== void 0) patch.repoUrl = opts.repo;
|
|
7508
|
+
if (opts.clearRef) patch.repoRef = null;
|
|
7509
|
+
else if (opts.ref !== void 0) patch.repoRef = opts.ref;
|
|
7510
|
+
}
|
|
7511
|
+
if (opts.persona !== void 0 && opts.clearPersona)
|
|
7512
|
+
throw new CliError("usage", "--persona and --clear-persona conflict");
|
|
7513
|
+
if (opts.clearPersona) patch.profileId = null;
|
|
7514
|
+
else if (opts.persona !== void 0) patch.profileId = opts.persona;
|
|
7515
|
+
if (opts.agent.length > 0) patch.agents = buildAgentRoster(opts.agent);
|
|
7516
|
+
if (opts.skill.length > 0 && opts.clearSkills)
|
|
7517
|
+
throw new CliError("usage", "--skill and --clear-skills conflict");
|
|
7518
|
+
if (opts.clearSkills) patch.skillRefs = [];
|
|
7519
|
+
else if (opts.skill.length > 0)
|
|
7520
|
+
patch.skillRefs = validateAssetRefs("skill", opts.skill);
|
|
7521
|
+
if (opts.mcp.length > 0 && opts.clearMcp)
|
|
7522
|
+
throw new CliError("usage", "--mcp and --clear-mcp conflict");
|
|
7523
|
+
if (opts.clearMcp) patch.mcpRefs = [];
|
|
7524
|
+
else if (opts.mcp.length > 0)
|
|
7525
|
+
patch.mcpRefs = validateAssetRefs("mcp", opts.mcp);
|
|
7526
|
+
if (opts.connection.length > 0 && opts.clearConnections)
|
|
7527
|
+
throw new CliError(
|
|
7528
|
+
"usage",
|
|
7529
|
+
"--connection and --clear-connections conflict"
|
|
7530
|
+
);
|
|
7531
|
+
if (opts.clearConnections) patch.connectionIds = [];
|
|
7532
|
+
else if (opts.connection.length > 0) patch.connectionIds = opts.connection;
|
|
7533
|
+
if (opts.cadence !== void 0) patch.cadence = parseCadence(opts.cadence);
|
|
7534
|
+
if (opts.samples !== void 0)
|
|
7535
|
+
patch.sampleCount = parseSampleCount(opts.samples);
|
|
7536
|
+
return patch;
|
|
7537
|
+
}
|
|
7538
|
+
function addRunSettingsCreateOptions(command) {
|
|
7539
|
+
return command.option(
|
|
7540
|
+
"--agent <agent[:m1,m2]>",
|
|
7541
|
+
"agent and optional model pins (repeatable)",
|
|
7542
|
+
collect,
|
|
7543
|
+
[]
|
|
7544
|
+
).option(
|
|
7545
|
+
"--skill <name@label>",
|
|
7546
|
+
"staged skill (repeatable)",
|
|
7547
|
+
collect,
|
|
7548
|
+
[]
|
|
7549
|
+
).option(
|
|
7550
|
+
"--mcp <name@label>",
|
|
7551
|
+
"MCP server (repeatable)",
|
|
7552
|
+
collect,
|
|
7553
|
+
[]
|
|
7554
|
+
).option(
|
|
7555
|
+
"--connection <id>",
|
|
7556
|
+
"connection id (repeatable)",
|
|
7557
|
+
collect,
|
|
7558
|
+
[]
|
|
7559
|
+
).option("--cadence <cadence>", "none | daily | weekly | monthly", "none").option("--samples <n>", "sample count from 1 to 50", "1");
|
|
7560
|
+
}
|
|
7561
|
+
function addRunSettingsEditOptions(command) {
|
|
7562
|
+
return command.option(
|
|
7563
|
+
"--agent <agent[:m1,m2]>",
|
|
7564
|
+
"replace agents and model pins (repeatable)",
|
|
7565
|
+
collect,
|
|
7566
|
+
[]
|
|
7567
|
+
).option(
|
|
7568
|
+
"--skill <name@label>",
|
|
7569
|
+
"replace skills (repeatable)",
|
|
7570
|
+
collect,
|
|
7571
|
+
[]
|
|
7572
|
+
).option("--clear-skills", "remove all skills").option(
|
|
7573
|
+
"--mcp <name@label>",
|
|
7574
|
+
"replace MCP servers (repeatable)",
|
|
7575
|
+
collect,
|
|
7576
|
+
[]
|
|
7577
|
+
).option("--clear-mcp", "remove all MCP servers").option(
|
|
7578
|
+
"--connection <id>",
|
|
7579
|
+
"replace connections (repeatable)",
|
|
7580
|
+
collect,
|
|
7581
|
+
[]
|
|
7582
|
+
).option("--clear-connections", "remove all connections").option("--cadence <cadence>", "none | daily | weekly | monthly").option("--samples <n>", "sample count from 1 to 50");
|
|
7583
|
+
}
|
|
7584
|
+
function hasRunSettingsFlags(opts) {
|
|
7585
|
+
return opts.agent.length > 0 || opts.skill.length > 0 || opts.mcp.length > 0 || opts.connection.length > 0 || opts.cadence.toUpperCase() !== "NONE" || opts.samples !== "1";
|
|
7586
|
+
}
|
|
7587
|
+
function runSettingsFromOpts(opts) {
|
|
7588
|
+
return {
|
|
7589
|
+
...opts.agent.length > 0 ? { agents: buildAgentRoster(opts.agent) } : {},
|
|
7590
|
+
skillRefs: validateAssetRefs("skill", opts.skill),
|
|
7591
|
+
mcpRefs: validateAssetRefs("mcp", opts.mcp),
|
|
7592
|
+
connectionIds: opts.connection,
|
|
7593
|
+
cadence: parseCadence(opts.cadence),
|
|
7594
|
+
sampleCount: parseSampleCount(opts.samples)
|
|
7595
|
+
};
|
|
7596
|
+
}
|
|
7597
|
+
function runSettingsPatchFromOpts(opts) {
|
|
7598
|
+
return ownedConfigPatchFromOpts(opts);
|
|
7599
|
+
}
|
|
7600
|
+
function cadenceLabel(cadence) {
|
|
7601
|
+
return cadence === "NONE" ? "manual" : cadence.toLowerCase();
|
|
7602
|
+
}
|
|
7603
|
+
|
|
7604
|
+
// src/lib/runDefinitionFiles.ts
|
|
7605
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
7606
|
+
import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve3, sep as sep3 } from "path";
|
|
7607
|
+
function git2(cwd, args) {
|
|
7608
|
+
try {
|
|
7609
|
+
return execFileSync3("git", args, {
|
|
7610
|
+
cwd,
|
|
7611
|
+
encoding: "buffer",
|
|
7612
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
7613
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7614
|
+
});
|
|
7615
|
+
} catch (error) {
|
|
7616
|
+
const detail = error && typeof error === "object" && "stderr" in error ? String(error.stderr).trim() : String(error);
|
|
7617
|
+
throw new CliError("usage", `git ${args[0]} failed: ${detail}`);
|
|
7618
|
+
}
|
|
7619
|
+
}
|
|
7620
|
+
function committedBlob(root, commit, path3) {
|
|
7621
|
+
return git2(root, ["show", `${commit}:${path3}`]);
|
|
7622
|
+
}
|
|
7623
|
+
function relativeGitPath(root, cwd, input) {
|
|
7624
|
+
if (!input || input.includes("\0"))
|
|
7625
|
+
throw new CliError("usage", `expected a case path or glob: ${input}`);
|
|
7626
|
+
const absolute = resolve3(cwd, input);
|
|
7627
|
+
const path3 = relative3(root, absolute);
|
|
7628
|
+
if (!path3 || path3 === ".." || path3.startsWith(`..${sep3}`) || isAbsolute3(path3))
|
|
7629
|
+
throw new CliError(
|
|
7630
|
+
"usage",
|
|
7631
|
+
`case path is outside this Git repository: ${input}`
|
|
7632
|
+
);
|
|
7633
|
+
const gitPath = path3.split(sep3).join("/");
|
|
7634
|
+
return gitPath;
|
|
7635
|
+
}
|
|
7636
|
+
function loadCommittedRunDefinitionWithContext(files = [], cwd = process.cwd()) {
|
|
7637
|
+
const root = git2(cwd, ["rev-parse", "--show-toplevel"]).toString("utf8").trim();
|
|
7638
|
+
const commit = git2(root, ["rev-parse", "--verify", "HEAD^{commit}"]).toString("utf8").trim();
|
|
7639
|
+
let repoUrl;
|
|
7640
|
+
try {
|
|
7641
|
+
repoUrl = git2(root, ["remote", "get-url", "origin"]).toString("utf8").trim();
|
|
7642
|
+
} catch {
|
|
7643
|
+
throw new CliError(
|
|
7644
|
+
"usage",
|
|
7645
|
+
"Git origin is required to identify the committed definition repository"
|
|
7646
|
+
);
|
|
7647
|
+
}
|
|
7648
|
+
if (!uncredentialedRepoUrlSchema.safeParse(repoUrl).success)
|
|
7649
|
+
throw new CliError(
|
|
7650
|
+
"usage",
|
|
7651
|
+
"Git origin must be a repository URL without embedded credentials or query parameters"
|
|
7652
|
+
);
|
|
7653
|
+
const blobs = /* @__PURE__ */ new Map();
|
|
7654
|
+
const hasConfig = git2(root, ["ls-tree", "--name-only", commit, "--", "gauge.json"]).toString("utf8").trim() === "gauge.json";
|
|
7655
|
+
if (hasConfig) {
|
|
7656
|
+
blobs.set("gauge.json", committedBlob(root, commit, "gauge.json"));
|
|
7150
7657
|
}
|
|
7658
|
+
let paths;
|
|
7151
7659
|
try {
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7660
|
+
const config = runDefinitionFileConfigSchema.parse(
|
|
7661
|
+
blobs.has("gauge.json") ? JSON.parse(blobs.get("gauge.json").toString("utf8")) : {}
|
|
7662
|
+
);
|
|
7663
|
+
const tree = git2(root, ["ls-tree", "-r", "-z", commit]).toString("utf8").split("\0").filter((entry) => /^(100644|100755) blob /.test(entry)).map((entry) => entry.slice(entry.indexOf(" ") + 1));
|
|
7664
|
+
const patterns = files.length ? files.map((file) => relativeGitPath(root, cwd, file)) : config.cases;
|
|
7665
|
+
paths = matchInputPaths(tree, patterns);
|
|
7666
|
+
if (paths.length > 20 || paths.some((path3) => !path3.endsWith(".md")))
|
|
7667
|
+
throw new Error("Expected 1\u201320 committed Markdown cases");
|
|
7668
|
+
for (const path3 of paths)
|
|
7669
|
+
blobs.set(path3, committedBlob(root, commit, path3));
|
|
7160
7670
|
} catch (error) {
|
|
7161
|
-
|
|
7162
|
-
|
|
7671
|
+
throw new CliError(
|
|
7672
|
+
"usage",
|
|
7673
|
+
error instanceof Error ? error.message : String(error)
|
|
7674
|
+
);
|
|
7163
7675
|
}
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
);
|
|
7172
|
-
const rawInputs = record(record(raw).inputs);
|
|
7173
|
-
for (const [name, value] of Object.entries(rawInputs).sort(
|
|
7174
|
-
([a], [b]) => a.localeCompare(b)
|
|
7175
|
-
)) {
|
|
7176
|
-
const parsed = runDefinitionInputSchema.safeParse(value);
|
|
7177
|
-
result.inputs.push({
|
|
7178
|
-
name,
|
|
7179
|
-
checks: parsed.success ? inputChecks(root, files, parsed.data) : [check("configuration", "no", parsed.error.message)]
|
|
7676
|
+
try {
|
|
7677
|
+
const result = compileRunDefinitionFromBlobs({
|
|
7678
|
+
repoUrl,
|
|
7679
|
+
commit,
|
|
7680
|
+
casePaths: paths,
|
|
7681
|
+
blobs,
|
|
7682
|
+
verification: "SUBMITTED_UNVERIFIED"
|
|
7180
7683
|
});
|
|
7684
|
+
return { definition: result.definition, org: result.org };
|
|
7685
|
+
} catch (error) {
|
|
7686
|
+
throw new CliError(
|
|
7687
|
+
"usage",
|
|
7688
|
+
error instanceof Error ? error.message : String(error)
|
|
7689
|
+
);
|
|
7181
7690
|
}
|
|
7182
|
-
if (config.success) {
|
|
7183
|
-
try {
|
|
7184
|
-
const paths = matchInputPaths(files, config.data.cases, {
|
|
7185
|
-
allowEmptySelection: true
|
|
7186
|
-
});
|
|
7187
|
-
if (paths.length > 20 || paths.some((path3) => !path3.endsWith(".md")))
|
|
7188
|
-
throw new Error("Expected at most 20 Markdown cases");
|
|
7189
|
-
result.facts.caseCount = paths.length;
|
|
7190
|
-
if (paths.length)
|
|
7191
|
-
result.global.push(
|
|
7192
|
-
check(
|
|
7193
|
-
"case-discovery",
|
|
7194
|
-
"yes",
|
|
7195
|
-
`${paths.length} working-tree case(s) selected`
|
|
7196
|
-
)
|
|
7197
|
-
);
|
|
7198
|
-
else
|
|
7199
|
-
result.info.push({
|
|
7200
|
-
id: "no-cases",
|
|
7201
|
-
detail: "No eval cases found; input-only setup is valid, but no evaluations will run"
|
|
7202
|
-
});
|
|
7203
|
-
for (const path3 of paths) {
|
|
7204
|
-
try {
|
|
7205
|
-
const item = parseRunDefinitionCase(path3, read(root, path3));
|
|
7206
|
-
const missing = (item.config.inputs ?? []).filter(
|
|
7207
|
-
(name) => !Object.hasOwn(config.data.inputs, name)
|
|
7208
|
-
);
|
|
7209
|
-
if (missing.length)
|
|
7210
|
-
throw new Error(`${path3}: Unknown input(s): ${missing.join(", ")}`);
|
|
7211
|
-
const commandOwners = /* @__PURE__ */ new Map();
|
|
7212
|
-
for (const name of new Set(
|
|
7213
|
-
item.config.inputs ?? Object.keys(config.data.inputs)
|
|
7214
|
-
)) {
|
|
7215
|
-
const input = config.data.inputs[name];
|
|
7216
|
-
if (input.type !== "binary") continue;
|
|
7217
|
-
for (const command of Object.keys(input.commands)) {
|
|
7218
|
-
const owner = commandOwners.get(command);
|
|
7219
|
-
if (owner)
|
|
7220
|
-
throw new Error(
|
|
7221
|
-
`${path3}: Inputs ${owner} and ${name} both expose command ${command}; choose distinct commands or separate cases`
|
|
7222
|
-
);
|
|
7223
|
-
commandOwners.set(command, name);
|
|
7224
|
-
}
|
|
7225
|
-
}
|
|
7226
|
-
result.global.push(
|
|
7227
|
-
check(
|
|
7228
|
-
`case.${path3}`,
|
|
7229
|
-
"yes",
|
|
7230
|
-
"Case syntax, input references, and declared command names are valid"
|
|
7231
|
-
)
|
|
7232
|
-
);
|
|
7233
|
-
} catch (error) {
|
|
7234
|
-
result.global.push(check(`case.${path3}`, "no", message(error)));
|
|
7235
|
-
}
|
|
7236
|
-
}
|
|
7237
|
-
} catch (error) {
|
|
7238
|
-
result.global.push(
|
|
7239
|
-
check(
|
|
7240
|
-
"case-discovery",
|
|
7241
|
-
"no",
|
|
7242
|
-
message(error).replace("committed files", "working-tree files")
|
|
7243
|
-
)
|
|
7244
|
-
);
|
|
7245
|
-
}
|
|
7246
|
-
} else
|
|
7247
|
-
result.info.push({
|
|
7248
|
-
id: "case-validation-skipped",
|
|
7249
|
-
detail: "Fix gauge.json before validating cases and input references"
|
|
7250
|
-
});
|
|
7251
|
-
return finish();
|
|
7252
7691
|
}
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
console.log(` [${item.state}] ${item.id}: ${item.detail}`);
|
|
7258
|
-
};
|
|
7259
|
-
console.log("Global");
|
|
7260
|
-
print(result.global);
|
|
7261
|
-
for (const input of result.inputs) {
|
|
7262
|
-
console.log(`Input: ${input.name}`);
|
|
7263
|
-
print(input.checks);
|
|
7264
|
-
}
|
|
7265
|
-
for (const item of result.info)
|
|
7266
|
-
console.log(`[info] ${item.id}: ${item.detail}`);
|
|
7267
|
-
console.log(
|
|
7268
|
-
`Static verification ${result.status}: ${result.summary.yes} yes, ${result.summary.no} no, ${result.summary.unknown} unknown.`
|
|
7269
|
-
);
|
|
7270
|
-
console.log(
|
|
7271
|
-
"Scope: repository setup only. Live delivery, account settings, and sandbox execution were not tested; no sessions were launched."
|
|
7272
|
-
);
|
|
7692
|
+
|
|
7693
|
+
// src/lib/staff.ts
|
|
7694
|
+
function staffCommandsVisible(config = readConfig()) {
|
|
7695
|
+
return config.staff === true;
|
|
7273
7696
|
}
|
|
7274
7697
|
|
|
7275
7698
|
// src/commands/evals.ts
|
|
@@ -7358,63 +7781,73 @@ function register12(program2) {
|
|
|
7358
7781
|
else printEvalVerification(result);
|
|
7359
7782
|
if (result.summary.no > 0) process.exitCode = 1;
|
|
7360
7783
|
});
|
|
7361
|
-
group.command("plan").description(
|
|
7362
|
-
"Validate committed Markdown cases and preview a Git-native run"
|
|
7363
|
-
).option(
|
|
7784
|
+
group.command("plan").description("Preview evaluation cases without starting sessions").option(
|
|
7364
7785
|
"--files <paths...>",
|
|
7365
|
-
"
|
|
7366
|
-
).
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
)
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7786
|
+
"Markdown paths or globs (default gauge-evals/**/*.md)"
|
|
7787
|
+
).option(
|
|
7788
|
+
"--input <name=path>",
|
|
7789
|
+
"supply a local input and use current eval files (repeatable)",
|
|
7790
|
+
collect,
|
|
7791
|
+
[]
|
|
7792
|
+
).action(
|
|
7793
|
+
async (opts, cmd) => {
|
|
7794
|
+
const local = opts.input.length ? await loadLocalRunDefinition(opts.files ?? [], opts.input) : void 0;
|
|
7795
|
+
const { definition, org: fileOrg } = local ?? loadCommittedRunDefinitionWithContext(opts.files ?? []);
|
|
7796
|
+
let org;
|
|
7797
|
+
try {
|
|
7798
|
+
org = resolveOrg(cmd, fileOrg);
|
|
7799
|
+
if (local)
|
|
7800
|
+
await uploadLocalInputs(createClient(), org, local.uploads);
|
|
7801
|
+
} finally {
|
|
7802
|
+
await local?.cleanup();
|
|
7803
|
+
}
|
|
7804
|
+
const result = await createClient().post(
|
|
7805
|
+
`/api/v1/orgs/${encodeURIComponent(org)}/run-definitions/plan`,
|
|
7806
|
+
definition
|
|
7807
|
+
);
|
|
7808
|
+
if (resolveOutput(cmd) === "json") {
|
|
7809
|
+
printJson(result);
|
|
7810
|
+
return;
|
|
7811
|
+
}
|
|
7385
7812
|
console.log(
|
|
7386
|
-
`
|
|
7813
|
+
`Definition: ${result.source.verification === "LOCAL" ? "current files" : result.source.commit}`
|
|
7387
7814
|
);
|
|
7388
|
-
|
|
7389
|
-
const
|
|
7390
|
-
if (use.type === "npm-package" || use.type === "npm-cli") {
|
|
7391
|
-
const install = use.install ?? "environment";
|
|
7392
|
-
console.log(` ${resource.name}: npm package \u2192 ${install}`);
|
|
7393
|
-
const label = install === "environment" ? "Commands on PATH" : "Package commands";
|
|
7815
|
+
console.log(`Expected sessions: ${result.expectedRuns}`);
|
|
7816
|
+
for (const item of result.cases)
|
|
7394
7817
|
console.log(
|
|
7395
|
-
`
|
|
7396
|
-
);
|
|
7397
|
-
} else if (use.type === "binary") {
|
|
7398
|
-
console.log(
|
|
7399
|
-
` ${resource.name}: native executable \u2192 ${use.platform}`
|
|
7400
|
-
);
|
|
7401
|
-
console.log(
|
|
7402
|
-
` Commands on PATH: ${Object.keys(use.commands).join(", ")}`
|
|
7818
|
+
` ${item.path}: ${item.expectedRuns} sessions, ${item.preference ? `${item.preference.kind} preference (advisory)` : `${item.criteriaCount} criteria`}`
|
|
7403
7819
|
);
|
|
7820
|
+
for (const resource of result.resources) {
|
|
7821
|
+
const use = resource.use;
|
|
7822
|
+
if (use.type === "npm-package" || use.type === "npm-cli") {
|
|
7823
|
+
const install = use.install ?? "environment";
|
|
7824
|
+
console.log(` ${resource.name}: npm package \u2192 ${install}`);
|
|
7825
|
+
const label = install === "environment" ? "Commands on PATH" : "Package commands";
|
|
7826
|
+
console.log(
|
|
7827
|
+
` ${label}: ${resource.commands === void 0 ? "determined when the input is prepared" : resource.commands.join(", ") || "none (library)"}`
|
|
7828
|
+
);
|
|
7829
|
+
} else if (use.type === "binary") {
|
|
7830
|
+
console.log(
|
|
7831
|
+
` ${resource.name}: native executable \u2192 ${use.platform}`
|
|
7832
|
+
);
|
|
7833
|
+
console.log(
|
|
7834
|
+
` Commands on PATH: ${Object.keys(use.commands).join(", ")}`
|
|
7835
|
+
);
|
|
7836
|
+
console.log(
|
|
7837
|
+
" Requires compatible system libraries; Gauge does not install OS packages."
|
|
7838
|
+
);
|
|
7839
|
+
} else console.log(` ${resource.name}: ${use.type}`);
|
|
7840
|
+
if (resource.detail) console.log(` ${resource.detail}`);
|
|
7841
|
+
}
|
|
7842
|
+
if (result.resources.length) {
|
|
7404
7843
|
console.log(
|
|
7405
|
-
|
|
7844
|
+
`Inputs: ${result.resources.map((r) => `${r.name} (${r.source}, ${r.readiness})`).join(", ")}`
|
|
7406
7845
|
);
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
if (result.resources.length) {
|
|
7411
|
-
console.log(
|
|
7412
|
-
`Inputs: ${result.resources.map((r) => `${r.name} (${r.source}, ${r.readiness})`).join(", ")}`
|
|
7413
|
-
);
|
|
7414
|
-
if (!result.canRun)
|
|
7415
|
-
console.log("Resolve the input errors before launching.");
|
|
7846
|
+
if (!result.canRun)
|
|
7847
|
+
console.log("Resolve the input errors before launching.");
|
|
7848
|
+
}
|
|
7416
7849
|
}
|
|
7417
|
-
|
|
7850
|
+
);
|
|
7418
7851
|
group.command("list").description("List the org's eval sets with pass-rate stats").option(
|
|
7419
7852
|
"--agents <agents>",
|
|
7420
7853
|
"filter stats to these agents, e.g. claude-code,codex"
|
|
@@ -7535,7 +7968,7 @@ function register12(program2) {
|
|
|
7535
7968
|
if (resolveOutput(cmd) !== "json") console.log(`Deleted eval set ${id2}`);
|
|
7536
7969
|
});
|
|
7537
7970
|
group.command("run [id]").description(
|
|
7538
|
-
staffCommandsVisible() ? "Run
|
|
7971
|
+
staffCommandsVisible() ? "Run evaluation cases or a saved eval set (superusers run without billing the org by default)" : "Run evaluation cases or a saved eval set"
|
|
7539
7972
|
).addOption(
|
|
7540
7973
|
new Option2(
|
|
7541
7974
|
"--bill-to-org",
|
|
@@ -7543,18 +7976,31 @@ function register12(program2) {
|
|
|
7543
7976
|
).hideHelp(!staffCommandsVisible())
|
|
7544
7977
|
).option(
|
|
7545
7978
|
"--files <paths...>",
|
|
7546
|
-
"
|
|
7979
|
+
"Markdown paths or globs (default gauge-evals/**/*.md)"
|
|
7980
|
+
).option(
|
|
7981
|
+
"--input <name=path>",
|
|
7982
|
+
"supply a local input and use current eval files (repeatable)",
|
|
7983
|
+
collect,
|
|
7984
|
+
[]
|
|
7547
7985
|
).option("--yes", "skip the confirmation").action(
|
|
7548
7986
|
async (id2, opts, cmd) => {
|
|
7549
|
-
if (opts.files !== void 0 || id2 === void 0) {
|
|
7987
|
+
if (opts.files !== void 0 || opts.input.length || id2 === void 0) {
|
|
7550
7988
|
if (id2 !== void 0)
|
|
7551
7989
|
throw new CliError(
|
|
7552
7990
|
"usage",
|
|
7553
|
-
"pass either an eval ID or
|
|
7991
|
+
"pass either an eval ID or file-based options, not both"
|
|
7554
7992
|
);
|
|
7555
|
-
const
|
|
7556
|
-
const
|
|
7557
|
-
|
|
7993
|
+
const local = opts.input.length ? await loadLocalRunDefinition(opts.files ?? [], opts.input) : void 0;
|
|
7994
|
+
const { definition, org: fileOrg } = local ?? loadCommittedRunDefinitionWithContext(opts.files ?? []);
|
|
7995
|
+
let org2;
|
|
7996
|
+
try {
|
|
7997
|
+
org2 = resolveOrg(cmd, fileOrg);
|
|
7998
|
+
await confirmOrAbort("Run these eval cases now?", opts.yes);
|
|
7999
|
+
if (local)
|
|
8000
|
+
await uploadLocalInputs(createClient(), org2, local.uploads);
|
|
8001
|
+
} finally {
|
|
8002
|
+
await local?.cleanup();
|
|
8003
|
+
}
|
|
7558
8004
|
const result2 = await createClient().post(
|
|
7559
8005
|
`/api/v1/orgs/${encodeURIComponent(org2)}/run-definitions/run`,
|
|
7560
8006
|
definition,
|
|
@@ -7565,7 +8011,9 @@ function register12(program2) {
|
|
|
7565
8011
|
console.log(
|
|
7566
8012
|
`Started ${result2.createdRuns}/${result2.requestedRuns} sessions in request ${result2.runRequestId}`
|
|
7567
8013
|
);
|
|
7568
|
-
console.log(
|
|
8014
|
+
console.log(
|
|
8015
|
+
`Wait: gauge --org ${org2} run-requests wait ${result2.runRequestId}`
|
|
8016
|
+
);
|
|
7569
8017
|
}
|
|
7570
8018
|
return;
|
|
7571
8019
|
}
|
|
@@ -7648,7 +8096,7 @@ __export(instructions_exports, {
|
|
|
7648
8096
|
register: () => register13
|
|
7649
8097
|
});
|
|
7650
8098
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
7651
|
-
import { join as
|
|
8099
|
+
import { join as join5 } from "path";
|
|
7652
8100
|
|
|
7653
8101
|
// src/instructions/evals.ts
|
|
7654
8102
|
var EVALS = `---
|
|
@@ -7667,6 +8115,9 @@ description: Create and review Gauge eval prompts, model selections, and judging
|
|
|
7667
8115
|
- Native command inputs use \`type: "binary"\`, \`platform: "linux-x64"\`, selected \`paths\`, and a \`commands\` map from command names to explicit relative ELF executable files. CI must upload already unpacked files. Gauge restores executable permissions and exposes declared commands on PATH; compatible system libraries are required, nested archives and arbitrary installers are unsupported.
|
|
7668
8116
|
- Automatic GitHub PR checks support root \`gauge.json\` \`checks.paths\` as a suite gate and per-case frontmatter \`config.checks.paths\` as a narrower filter. Both accept positive repository-relative globs. Cases without filters run when the suite gate passes; changes to \`gauge.json\` select all cases and edits to a case select that case. Explicit CLI launches and GitHub reruns ignore both filters. Failed/unfinished previous checks, changed target branches, and unavailable diffs run conservatively. \`config.inputs\` selects inputs, not triggers.
|
|
7669
8117
|
- Pilot before scaling; confirm before spending credits. Creating definitions does not authorize launching runs. Report sample counts and distinguish incorrect behavior, missing evidence, environment failures, and budget exhaustion.
|
|
8118
|
+
- Gauge tests artifacts from the PR's successful build; preserve CI's existing checkout settings, including the default merge checkout. Fork PRs are disabled by default. In Gauge's GitHub settings, check **Allow fork pull requests**; a workspace member then follows the GitHub check link to authorize that revision using workspace credits and connections. New revisions and explicit reruns need fresh approval. Inputs still determine readiness.
|
|
8119
|
+
- For authenticated MCP access, connect the account in Gauge, complete OAuth in the browser when required, and put the versioned server reference in case \`config.mcpRefs\`. Gauge manages session credentials; keep tokens out of prompts and Git.
|
|
8120
|
+
- To test local build output without the GitHub App, use \`gauge evals run --input name=path --yes -o json\`. Repeat \`--input\` for each input. This uses current evaluation files, including edits; other inputs keep their configured sources. Skills accept directories or archives, npm packages accept .tgz files, and file/binary inputs accept directories. Use \`gauge run-requests wait <id> -o json\` for the verdict, criterion results, and session links; failed checks exit nonzero while still returning JSON.
|
|
7670
8121
|
- Before committing setup changes, run \`gauge evals verify -o json\` for an offline working-tree checklist. Only attempted static checks are scored yes, no, or unknown; unknown means a specific declaration could not be resolved. Informational findings (such as zero cases) are separate. JSON includes a version, static status (passed/failed/incomplete), summary counts, global/per-input checks with stable IDs, facts, info, and excluded capabilities in notChecked. Exit 1 means a definite problem; exit 0 can still contain unknowns. Live delivery, account settings, and sandbox execution are outside this command's scope. It requires no login or PR and launches no sessions.
|
|
7671
8122
|
|
|
7672
8123
|
## Model selection
|
|
@@ -7695,14 +8146,10 @@ A bad version of this migration prompt would add specific features, such as a fl
|
|
|
7695
8146
|
|
|
7696
8147
|
Use the kind of language a user would naturally use to ask for a change. For example, "Let me pass a feature to the CLI and get instructions for it" describes the desired behavior without prescribing command registration or rendering code. Keep details the user actually requests; do not add exact specifications or UI/UX actions just to make grading easier.
|
|
7697
8148
|
|
|
7698
|
-
For the migration, express the user's goal:
|
|
7699
|
-
|
|
7700
8149
|
> Migrate this app from its current feature-flag provider to the replacement provider while preserving its existing functionality. Get it running locally, verify the migration works, and explain any limitations.
|
|
7701
8150
|
|
|
7702
8151
|
If the user also asks for a complete replacement, carry that decision into the rubric. Do not add backward compatibility or a gradual production rollout solely because a migration guide recommends them.
|
|
7703
8152
|
|
|
7704
|
-
This remains a substantial task. The agent must inspect the application, identify integration boundaries, discover suitable interfaces, implement the migration, and demonstrate the result. A short prompt does not imply a trivial outcome.
|
|
7705
|
-
|
|
7706
8153
|
### Define observable success
|
|
7707
8154
|
|
|
7708
8155
|
Inspect the starting application and relevant migration guidance before drafting criteria. For this application, success means existing browser and server workflows continue to work through the destination provider, live evaluations drive the running UI, and active dependencies on the source provider are removed when full replacement is requested. The rubric can assess behavior present in the source without dictating SDK methods, edited files, or an exact test sequence.
|
|
@@ -7776,7 +8223,7 @@ Gauge helps you understand and improve how coding agents discover and use your
|
|
|
7776
8223
|
product. It runs real agents in sandboxes under reproducible conditions, then
|
|
7777
8224
|
judges their work. Evals measure successful product use; Agent Preference
|
|
7778
8225
|
measures which tools agents choose and why. Optimizations test improvements to
|
|
7779
|
-
your docs and skills against those measurements.
|
|
8226
|
+
your docs, CLI, and skills against those measurements.
|
|
7780
8227
|
|
|
7781
8228
|
## Use Gauge and the CLI
|
|
7782
8229
|
|
|
@@ -7832,64 +8279,64 @@ Full guidance: \`gauge instructions preference\`.
|
|
|
7832
8279
|
|
|
7833
8280
|
### Optimization
|
|
7834
8281
|
|
|
7835
|
-
Gauge measures trials; you author
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
8282
|
+
Gauge measures trials; you author changes. First run \`gauge optimizations baselines\`
|
|
8283
|
+
for an eval or preference prompt to discover observed surfaces and eligible runs.
|
|
8284
|
+
Inspect source evidence, then start with \`--from-run\` to reuse the chosen baseline.
|
|
8285
|
+
Read authoring context, write a hypothesis, preview the complete change, save,
|
|
8286
|
+
and launch. Gauge resumes saved baseline states (checkpoints) when compatible, or starts fresh.
|
|
8287
|
+
Follow \`nextAction\`; watch exits 4 when input is needed. Verify actual change
|
|
8288
|
+
exposure, task scores, sample counts, and failed sessions separately. Keep the
|
|
8289
|
+
measurement fixed, confirm paid launches, and retry writes safely. Adopt the
|
|
8290
|
+
winner; use \`handoff\` for implementation in your source repository.
|
|
7844
8291
|
|
|
7845
8292
|
Full guidance: \`gauge instructions optimization\`.
|
|
7846
8293
|
`;
|
|
7847
8294
|
var OPTIMIZATIONS = `---
|
|
7848
8295
|
name: gauge-optimizations
|
|
7849
|
-
description:
|
|
7850
|
-
a Gauge eval or preference prompt.
|
|
8296
|
+
description: Discover observed surfaces, choose a baseline, and test docs, CLI,
|
|
8297
|
+
or skill changes against a Gauge eval or preference prompt.
|
|
7851
8298
|
---
|
|
7852
8299
|
|
|
7853
8300
|
# Optimizations
|
|
7854
8301
|
|
|
7855
|
-
Gauge measures
|
|
7856
|
-
against one change you wrote, judges the sessions, and reports which won.
|
|
7857
|
-
|
|
7858
|
-
Nothing touches your repository. A docs trial serves your text to the sandboxed
|
|
7859
|
-
agent in place of the live page. A skill trial swaps the version.
|
|
8302
|
+
Gauge measures; you author. Use -o json on reads. Discover before starting.
|
|
7860
8303
|
|
|
7861
8304
|
## The loop
|
|
7862
8305
|
|
|
7863
|
-
gauge optimizations
|
|
7864
|
-
gauge
|
|
7865
|
-
gauge
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
8306
|
+
gauge optimizations baselines --eval <id> -o json
|
|
8307
|
+
gauge runs insight <run-id> -o json
|
|
8308
|
+
gauge runs logs <run-id> -o json
|
|
8309
|
+
gauge optimizations start --eval <id> --from-run <run-id> --yes
|
|
8310
|
+
|
|
8311
|
+
Discovery returns observed owned surfaces, evidence, judging, eligibility, and nextCursor.
|
|
8312
|
+
Choose a run that encountered the surface you want to improve. Missing evidence is unknown.
|
|
8313
|
+
--from-run reuses its eligible baseline (possibly several runs) and inherits its model.
|
|
8314
|
+
Use --preference for preference prompts, or --target <agent:model> to establish a baseline.
|
|
8315
|
+
A new baseline may spend credits. Only use --yes for approved spending.
|
|
8316
|
+
|
|
8317
|
+
gauge optimizations watch <id> # exit 4 = your turn, not failure
|
|
8318
|
+
gauge optimizations authoring <id> # targets, guidance, revision
|
|
8319
|
+
gauge optimizations page <id> --url <url> -o json
|
|
8320
|
+
|
|
8321
|
+
Follow nextAction: WAIT \u2192 watch; AUTHOR_TRIAL \u2192 author; LAUNCH_ROUND \u2192 launch.
|
|
8322
|
+
Check page.source: scrape is current content, not the captured baseline response.
|
|
8323
|
+
Write one hypothesis and the complete change in round.json, using the authoring revision.
|
|
8324
|
+
Docs use exact find/replace edits or body with rewriteReason; skills use the complete bundle.
|
|
8325
|
+
CLI: cli-change --file takes v3 {schemaVersion:3,target,rules,shippingIntent}; put its output in intervention.after.
|
|
8326
|
+
|
|
8327
|
+
gauge optimizations round preview <id> --file round.json -o json
|
|
8328
|
+
gauge optimizations round save <id> --file round.json --digest <previewDigest>
|
|
8329
|
+
gauge optimizations launch <id> --yes
|
|
8330
|
+
gauge optimizations watch <id>
|
|
8331
|
+
gauge optimizations trial <id> <trial> -o json
|
|
8332
|
+
|
|
8333
|
+
Checkpoints are saved states of baseline runs: resuming one avoids repeating earlier work.
|
|
8334
|
+
Gauge selects checkpoints automatically before the affected interaction, or starts fresh with a reason.
|
|
8335
|
+
Omit startingPoints and fork flags; you do not select a checkpoint. Check candidateExecution,
|
|
8336
|
+
candidateDelivery (exposure, observedArtifacts, evidenceComplete), scores, counts, and failed sessions.
|
|
8337
|
+
Better scores alone are not proof. Keep eval/prompt/criteria fixed; repeat if inconclusive.
|
|
8338
|
+
Adopt <id> <trial> selects the winner; handoff <id> gives source instructions; complete <id> finishes.
|
|
8339
|
+
Neither deploys. Single-trial retries: trials add --idempotency-key. Optional: gauge optimizations diagnose.
|
|
7893
8340
|
`;
|
|
7894
8341
|
var TOPICS = {
|
|
7895
8342
|
root: { name: "gauge", markdown: ROOT },
|
|
@@ -7934,8 +8381,8 @@ function register13(program2) {
|
|
|
7934
8381
|
return;
|
|
7935
8382
|
}
|
|
7936
8383
|
const name = topic ? resolveTopic(topic).name : TOPICS.root.name;
|
|
7937
|
-
const dir =
|
|
7938
|
-
const path3 =
|
|
8384
|
+
const dir = join5(opts.dir ?? INSTALL_ROOT, name);
|
|
8385
|
+
const path3 = join5(dir, "SKILL.md");
|
|
7939
8386
|
mkdirSync3(dir, { recursive: true });
|
|
7940
8387
|
writeFileSync3(path3, markdown);
|
|
7941
8388
|
console.log(`Wrote ${path3}`);
|
|
@@ -8424,7 +8871,7 @@ __export(optimizations_exports2, {
|
|
|
8424
8871
|
watchStops: () => watchStops
|
|
8425
8872
|
});
|
|
8426
8873
|
import { readdirSync as readdirSync2, readFileSync as readFileSync9, statSync } from "fs";
|
|
8427
|
-
import { join as
|
|
8874
|
+
import { join as join6, relative as relative4, sep as sep4 } from "path";
|
|
8428
8875
|
var TERMINAL = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
|
|
8429
8876
|
function basePath(org) {
|
|
8430
8877
|
return `/api/v1/orgs/${encodeURIComponent(org)}/optimizations`;
|
|
@@ -8440,7 +8887,7 @@ function readText(path3) {
|
|
|
8440
8887
|
return readFileSync9(path3 === "-" ? 0 : path3, "utf8");
|
|
8441
8888
|
}
|
|
8442
8889
|
function sleep2(ms) {
|
|
8443
|
-
return new Promise((
|
|
8890
|
+
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
8444
8891
|
}
|
|
8445
8892
|
function parseSubject(opts) {
|
|
8446
8893
|
if (opts.eval && opts.preference)
|
|
@@ -8515,7 +8962,7 @@ function readSkillDir(dir, read2 = readText, walk = listFiles) {
|
|
|
8515
8962
|
if (!paths.length)
|
|
8516
8963
|
throw new CliError("usage", `no files under ${dir} to send`);
|
|
8517
8964
|
const files = paths.map((path3) => ({
|
|
8518
|
-
path:
|
|
8965
|
+
path: relative4(dir, path3).split(sep4).join("/"),
|
|
8519
8966
|
body: read2(path3)
|
|
8520
8967
|
}));
|
|
8521
8968
|
if (!files.some((file) => file.path === "SKILL.md"))
|
|
@@ -8533,7 +8980,7 @@ function listFiles(dir) {
|
|
|
8533
8980
|
throw new CliError("usage", `cannot read the directory ${dir}`);
|
|
8534
8981
|
}
|
|
8535
8982
|
return entries.flatMap((entry) => {
|
|
8536
|
-
const path3 =
|
|
8983
|
+
const path3 = join6(dir, entry);
|
|
8537
8984
|
return statSync(path3).isDirectory() ? listFiles(path3) : [path3];
|
|
8538
8985
|
});
|
|
8539
8986
|
}
|
|
@@ -8864,6 +9311,46 @@ function register19(program2) {
|
|
|
8864
9311
|
else printItems(res.items.map(toRow3), "table");
|
|
8865
9312
|
}
|
|
8866
9313
|
);
|
|
9314
|
+
addSubjectOptions(
|
|
9315
|
+
group.command("baselines").description(
|
|
9316
|
+
"Discover which ordinary runs exposed which owned surfaces, and whether they can seed an optimization"
|
|
9317
|
+
)
|
|
9318
|
+
).option("--limit <n>", "page size (1\u2013100)", "50").option("--cursor <cursor>", "nextCursor from the previous page").action(
|
|
9319
|
+
async (opts, cmd) => {
|
|
9320
|
+
const response = await createClient().get(
|
|
9321
|
+
`${basePath(resolveOrg(cmd))}/baselines`,
|
|
9322
|
+
{
|
|
9323
|
+
...parseSubject(opts),
|
|
9324
|
+
limit: parseCount(opts.limit, "--limit"),
|
|
9325
|
+
cursor: opts.cursor
|
|
9326
|
+
}
|
|
9327
|
+
);
|
|
9328
|
+
if (resolveOutput(cmd) === "json") printJson(response);
|
|
9329
|
+
else {
|
|
9330
|
+
printItems(
|
|
9331
|
+
response.items.flatMap(
|
|
9332
|
+
(run) => (run.surfaces.length ? run.surfaces : [{ lever: "\u2014", label: "No recorded surface evidence" }]).map((surface) => ({
|
|
9333
|
+
run: run.runId,
|
|
9334
|
+
model: run.model || run.resolvedModel || run.agent,
|
|
9335
|
+
date: run.createdAt.slice(0, 10),
|
|
9336
|
+
criteria: run.outcome.totalCriteria ? `${run.outcome.passedCriteria}/${run.outcome.totalCriteria}` : "\u2014",
|
|
9337
|
+
status: run.status,
|
|
9338
|
+
surface: surface.lever,
|
|
9339
|
+
target: surface.label,
|
|
9340
|
+
eligible: run.eligibility.eligible ? "yes" : "no"
|
|
9341
|
+
}))
|
|
9342
|
+
),
|
|
9343
|
+
"table"
|
|
9344
|
+
);
|
|
9345
|
+
for (const run of response.items)
|
|
9346
|
+
if (run.eligibility.reason)
|
|
9347
|
+
console.log(`${run.runId}: ${run.eligibility.reason}`);
|
|
9348
|
+
console.log(response.note);
|
|
9349
|
+
if (response.nextCursor)
|
|
9350
|
+
console.log(`More: --cursor ${response.nextCursor}`);
|
|
9351
|
+
}
|
|
9352
|
+
}
|
|
9353
|
+
);
|
|
8867
9354
|
group.command("get <id>").description("One optimization: settings, score, and its trial ladder").action(async (id2, _opts, cmd) => {
|
|
8868
9355
|
const org = resolveOrg(cmd);
|
|
8869
9356
|
const detail = await createClient().get(itemPath(org, id2));
|
|
@@ -8886,25 +9373,29 @@ function register19(program2) {
|
|
|
8886
9373
|
addTargetOption(
|
|
8887
9374
|
addSubjectOptions(
|
|
8888
9375
|
group.command("start").description(
|
|
8889
|
-
"
|
|
9376
|
+
"Reuse a selected baseline with --from-run, or establish one with --target"
|
|
8890
9377
|
)
|
|
8891
9378
|
)
|
|
9379
|
+
).option(
|
|
9380
|
+
"--from-run <runId>",
|
|
9381
|
+
"reuse the eligible baseline containing this run; inherits its model"
|
|
8892
9382
|
).option("--name <name>", "optimization name (default: from the subject)").option("--yes", "skip the confirmation").action(
|
|
8893
9383
|
async (opts, cmd) => {
|
|
8894
9384
|
const org = resolveOrg(cmd);
|
|
8895
|
-
if (
|
|
9385
|
+
if (!!opts.target === !!opts.fromRun)
|
|
8896
9386
|
throw new CliError(
|
|
8897
9387
|
"usage",
|
|
8898
|
-
"--target <agent[:model]
|
|
9388
|
+
"pass --from-run <runId> or --target <agent[:model]>, not both; discover runs with `gauge optimizations baselines`"
|
|
8899
9389
|
);
|
|
8900
9390
|
const subject = parseSubject(opts);
|
|
8901
9391
|
await confirmOrAbort(
|
|
8902
|
-
`Start an optimization on ${subjectLabel(subject.subjectKind)} ${subject.subjectId}?
|
|
9392
|
+
opts.fromRun ? `Start an optimization from the baseline containing ${opts.fromRun}?` : `Start an optimization on ${subjectLabel(subject.subjectKind)} ${subject.subjectId}? A new baseline may spend credits.`,
|
|
8903
9393
|
opts.yes
|
|
8904
9394
|
);
|
|
8905
9395
|
const detail = await createClient().post(basePath(org), {
|
|
8906
9396
|
...subject,
|
|
8907
9397
|
...targetFromOpts(opts),
|
|
9398
|
+
...opts.fromRun ? { fromRun: opts.fromRun } : {},
|
|
8908
9399
|
name: opts.name
|
|
8909
9400
|
});
|
|
8910
9401
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -9122,26 +9613,22 @@ function register19(program2) {
|
|
|
9122
9613
|
}
|
|
9123
9614
|
);
|
|
9124
9615
|
group.command("authoring <id>").description(
|
|
9125
|
-
"What the next round may change:
|
|
9616
|
+
"What the next round may change: exposed surfaces, CLI targets, baseline run evidence, revision"
|
|
9126
9617
|
).action(async (id2, _opts, cmd) => {
|
|
9127
9618
|
printJson(
|
|
9128
9619
|
await createClient().get(`${itemPath(resolveOrg(cmd), id2)}/authoring`)
|
|
9129
9620
|
);
|
|
9130
9621
|
});
|
|
9131
9622
|
group.command("invocation <id> <invocationId>").description(
|
|
9132
|
-
"
|
|
9133
|
-
).action(
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
)
|
|
9140
|
-
);
|
|
9141
|
-
}
|
|
9142
|
-
);
|
|
9623
|
+
"Retired: use authoring source run references and gauge runs logs"
|
|
9624
|
+
).action(() => {
|
|
9625
|
+
throw new CliError(
|
|
9626
|
+
"usage",
|
|
9627
|
+
"The invocation catalog is retired. Read `gauge optimizations authoring <id>` and `gauge runs logs <runId> --output json` for observed command evidence."
|
|
9628
|
+
);
|
|
9629
|
+
});
|
|
9143
9630
|
group.command("cli-change <id>").description(
|
|
9144
|
-
"
|
|
9631
|
+
"Validate and seal v3 {schemaVersion:3, target, rules, shippingIntent}; use the output as intervention.after in a round file. Saves nothing"
|
|
9145
9632
|
).requiredOption("--file <path>", "the change JSON; '-' for stdin").action(async (id2, opts, cmd) => {
|
|
9146
9633
|
printJson(
|
|
9147
9634
|
await createClient().post(
|
|
@@ -9332,7 +9819,15 @@ function register19(program2) {
|
|
|
9332
9819
|
{ url: opts.url }
|
|
9333
9820
|
);
|
|
9334
9821
|
if (resolveOutput(cmd) === "json") printJson(res);
|
|
9335
|
-
else
|
|
9822
|
+
else {
|
|
9823
|
+
if (res.source === "scrape")
|
|
9824
|
+
console.error(
|
|
9825
|
+
"Source: fresh scrape; this is not the captured baseline response."
|
|
9826
|
+
);
|
|
9827
|
+
else if (res.source === "none")
|
|
9828
|
+
console.error("No page body is available.");
|
|
9829
|
+
console.log(res.body);
|
|
9830
|
+
}
|
|
9336
9831
|
});
|
|
9337
9832
|
}
|
|
9338
9833
|
|
|
@@ -9909,7 +10404,7 @@ function register25(program2) {
|
|
|
9909
10404
|
);
|
|
9910
10405
|
return;
|
|
9911
10406
|
}
|
|
9912
|
-
await new Promise((
|
|
10407
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollIntervalMs));
|
|
9913
10408
|
}
|
|
9914
10409
|
});
|
|
9915
10410
|
}
|