@withgauge/cli 0.17.1 → 0.18.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.
Files changed (3) hide show
  1. package/README.md +63 -15
  2. package/dist/index.js +1952 -1560
  3. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1834,8 +1834,8 @@ var runSkillSchema = z19.discriminatedUnion("source", [
1834
1834
  z19.object({
1835
1835
  source: z19.literal("input"),
1836
1836
  name: z19.string(),
1837
- /** Full commit SHA the Skill was prepared from. */
1838
- commit: z19.string(),
1837
+ /** Null when the Skill was supplied directly. */
1838
+ commit: z19.string().nullable(),
1839
1839
  /** The GitHub PR that launched the run; null for API launches. */
1840
1840
  pullNumber: z19.number().int().nullable()
1841
1841
  })
@@ -2590,11 +2590,51 @@ var meResponseSchema = z28.object({
2590
2590
  });
2591
2591
 
2592
2592
  // ../packages/api-schemas/src/optimizations.ts
2593
- import { z as z33 } from "zod";
2593
+ import { z as z35 } from "zod";
2594
2594
 
2595
- // ../packages/api-schemas/src/cli-rule-evidence.ts
2595
+ // ../packages/api-schemas/src/candidate-delivery.ts
2596
2596
  import { z as z29 } from "zod";
2597
- var cliRuleDeliverySchema = z29.enum([
2597
+ var candidateDeliverySchema = z29.object({
2598
+ runId: z29.string(),
2599
+ attempt: z29.number().int().nonnegative(),
2600
+ surface: z29.enum(["docs", "cli"]),
2601
+ candidateDigest: z29.string(),
2602
+ installed: z29.boolean(),
2603
+ evidenceComplete: z29.boolean(),
2604
+ exposure: z29.enum(["exercised", "not_exercised", "unknown"]),
2605
+ deliveryFailures: z29.number().int().nonnegative(),
2606
+ observedArtifacts: z29.array(z29.string()).max(512),
2607
+ expectedArtifacts: z29.array(z29.string()).max(512)
2608
+ });
2609
+
2610
+ // ../packages/api-schemas/src/candidate-starts.ts
2611
+ import { z as z30 } from "zod";
2612
+ var slot = {
2613
+ configurationIndex: z30.number().int().nonnegative(),
2614
+ repetitionIndex: z30.number().int().nonnegative()
2615
+ };
2616
+ var candidateStartSchema = z30.discriminatedUnion("kind", [
2617
+ z30.object({
2618
+ ...slot,
2619
+ kind: z30.literal("checkpoint"),
2620
+ checkpointId: z30.string().min(1)
2621
+ }).strict(),
2622
+ z30.object({
2623
+ ...slot,
2624
+ kind: z30.literal("fresh"),
2625
+ reason: z30.string().min(1).max(1024)
2626
+ }).strict()
2627
+ ]);
2628
+ var candidateStartsSchema = z30.array(candidateStartSchema).refine(
2629
+ (rows) => new Set(
2630
+ rows.map((row2) => `${row2.configurationIndex}:${row2.repetitionIndex}`)
2631
+ ).size === rows.length,
2632
+ "Each candidate run has one starting point"
2633
+ );
2634
+
2635
+ // ../packages/api-schemas/src/cli-rule-evidence.ts
2636
+ import { z as z31 } from "zod";
2637
+ var cliRuleDeliverySchema = z31.enum([
2598
2638
  "applied",
2599
2639
  "matched_unchanged",
2600
2640
  "not_exercised",
@@ -2602,94 +2642,94 @@ var cliRuleDeliverySchema = z29.enum([
2602
2642
  "partial",
2603
2643
  "unavailable"
2604
2644
  ]);
2605
- var cliRuleInvocationResultSchema = z29.object({
2606
- invocationId: z29.string(),
2607
- ruleId: z29.string(),
2608
- engineSha256: z29.string(),
2609
- entrypointSha256: z29.string(),
2610
- outcome: z29.number().nullable(),
2611
- complete: z29.boolean(),
2612
- deliveryFailure: z29.boolean().nullable(),
2613
- failureReason: z29.string().nullable().optional(),
2614
- inputs: z29.array(
2615
- z29.object({
2616
- operationId: z29.string(),
2617
- kind: z29.string(),
2618
- key: z29.string(),
2619
- source: z29.string(),
2620
- sourceKey: z29.string(),
2621
- present: z29.boolean(),
2622
- sourceBytes: z29.number(),
2623
- applied: z29.boolean(),
2624
- preflight: z29.boolean(),
2625
- deliveredBytes: z29.number(),
2626
- originalStdin: z29.literal("not_read")
2645
+ var cliRuleInvocationResultSchema = z31.object({
2646
+ invocationId: z31.string(),
2647
+ ruleId: z31.string(),
2648
+ engineSha256: z31.string(),
2649
+ entrypointSha256: z31.string(),
2650
+ outcome: z31.number().nullable(),
2651
+ complete: z31.boolean(),
2652
+ deliveryFailure: z31.boolean().nullable(),
2653
+ failureReason: z31.string().nullable().optional(),
2654
+ inputs: z31.array(
2655
+ z31.object({
2656
+ operationId: z31.string(),
2657
+ kind: z31.string(),
2658
+ key: z31.string(),
2659
+ source: z31.string(),
2660
+ sourceKey: z31.string(),
2661
+ present: z31.boolean(),
2662
+ sourceBytes: z31.number(),
2663
+ applied: z31.boolean(),
2664
+ preflight: z31.boolean(),
2665
+ deliveredBytes: z31.number(),
2666
+ originalStdin: z31.literal("not_read")
2627
2667
  })
2628
2668
  ).max(50).default([]),
2629
- operations: z29.array(
2630
- z29.object({
2631
- id: z29.string(),
2632
- kind: z29.string(),
2633
- count: z29.number().nullable()
2669
+ operations: z31.array(
2670
+ z31.object({
2671
+ id: z31.string(),
2672
+ kind: z31.string(),
2673
+ count: z31.number().nullable()
2634
2674
  })
2635
2675
  ).max(50),
2636
- excerpts: z29.array(
2637
- z29.object({
2638
- stream: z29.enum(["stdout", "stderr", "combined", "stdin"]),
2639
- before: z29.string().max(4096),
2640
- after: z29.string().max(4096),
2641
- originalBytes: z29.number().nullable(),
2642
- deliveredBytes: z29.number().nullable(),
2643
- omitted: z29.boolean(),
2644
- redacted: z29.boolean().optional(),
2645
- beforeTruncated: z29.boolean().optional(),
2646
- afterTruncated: z29.boolean().optional(),
2647
- omissionReason: z29.string().max(128).optional()
2676
+ excerpts: z31.array(
2677
+ z31.object({
2678
+ stream: z31.enum(["stdout", "stderr", "combined", "stdin"]),
2679
+ before: z31.string().max(4096),
2680
+ after: z31.string().max(4096),
2681
+ originalBytes: z31.number().nullable(),
2682
+ deliveredBytes: z31.number().nullable(),
2683
+ omitted: z31.boolean(),
2684
+ redacted: z31.boolean().optional(),
2685
+ beforeTruncated: z31.boolean().optional(),
2686
+ afterTruncated: z31.boolean().optional(),
2687
+ omissionReason: z31.string().max(128).optional()
2648
2688
  })
2649
2689
  ).max(4)
2650
2690
  });
2651
- var cliRuleSummarySchema = z29.object({
2652
- protocolVersion: z29.literal(3),
2653
- bundleSha256: z29.string(),
2654
- journalSha256: z29.string().nullable(),
2655
- journalComplete: z29.boolean(),
2656
- journalLimited: z29.boolean(),
2691
+ var cliRuleSummarySchema = z31.object({
2692
+ protocolVersion: z31.literal(3),
2693
+ bundleSha256: z31.string(),
2694
+ journalSha256: z31.string().nullable(),
2695
+ journalComplete: z31.boolean(),
2696
+ journalLimited: z31.boolean(),
2657
2697
  delivery: cliRuleDeliverySchema,
2658
- appliedInvocations: z29.number(),
2659
- matchedInvocations: z29.number(),
2660
- recognizedInvocations: z29.number().optional(),
2661
- unmatchedInvocations: z29.number().optional(),
2662
- unsupportedInvocations: z29.number(),
2663
- retainedExcerptBytes: z29.number(),
2664
- diagnostics: z29.array(z29.string().max(256)).max(50),
2665
- observations: z29.array(
2666
- z29.object({
2667
- invocationId: z29.string(),
2668
- ruleId: z29.string().nullable(),
2669
- reason: z29.string(),
2670
- entrypointSha256: z29.string().nullable(),
2671
- launchForm: z29.string().nullable(),
2672
- ioProfile: z29.string().nullable()
2698
+ appliedInvocations: z31.number(),
2699
+ matchedInvocations: z31.number(),
2700
+ recognizedInvocations: z31.number().optional(),
2701
+ unmatchedInvocations: z31.number().optional(),
2702
+ unsupportedInvocations: z31.number(),
2703
+ retainedExcerptBytes: z31.number(),
2704
+ diagnostics: z31.array(z31.string().max(256)).max(50),
2705
+ observations: z31.array(
2706
+ z31.object({
2707
+ invocationId: z31.string(),
2708
+ ruleId: z31.string().nullable(),
2709
+ reason: z31.string(),
2710
+ entrypointSha256: z31.string().nullable(),
2711
+ launchForm: z31.string().nullable(),
2712
+ ioProfile: z31.string().nullable()
2673
2713
  })
2674
2714
  ).max(200).optional()
2675
2715
  });
2676
- var cliRuleCoverageSchema = z29.object({
2677
- invocationCount: z29.number(),
2678
- observedInvocationCount: z29.number().nullable(),
2679
- appliedInvocationCount: z29.number(),
2680
- incompleteCount: z29.number(),
2681
- unsupportedCount: z29.number(),
2682
- instrumentationFailed: z29.boolean(),
2683
- unsupportedDiagnostics: z29.array(z29.string()),
2716
+ var cliRuleCoverageSchema = z31.object({
2717
+ invocationCount: z31.number(),
2718
+ observedInvocationCount: z31.number().nullable(),
2719
+ appliedInvocationCount: z31.number(),
2720
+ incompleteCount: z31.number(),
2721
+ unsupportedCount: z31.number(),
2722
+ instrumentationFailed: z31.boolean(),
2723
+ unsupportedDiagnostics: z31.array(z31.string()),
2684
2724
  v3: cliRuleSummarySchema,
2685
- invocations: z29.array(cliRuleInvocationResultSchema).default([])
2725
+ invocations: z31.array(cliRuleInvocationResultSchema).default([])
2686
2726
  });
2687
2727
 
2688
2728
  // ../packages/api-schemas/src/climb.ts
2689
- import { z as z32 } from "zod";
2729
+ import { z as z34 } from "zod";
2690
2730
 
2691
2731
  // ../packages/api-schemas/src/cli-rules.ts
2692
- import { z as z30 } from "zod";
2732
+ import { z as z32 } from "zod";
2693
2733
 
2694
2734
  // ../packages/api-schemas/src/cli-rule-arguments.ts
2695
2735
  function parseCliRuleArguments(argv, arity) {
@@ -2752,7 +2792,7 @@ var CLI_RULE_LIMITS = {
2752
2792
  };
2753
2793
  var encoder = new TextEncoder();
2754
2794
  var cliUtf8Bytes = (value) => encoder.encode(value).length;
2755
- var text = (max, nonempty = false) => z30.string().superRefine((value, ctx) => {
2795
+ var text = (max, nonempty = false) => z32.string().superRefine((value, ctx) => {
2756
2796
  if (nonempty && !value.length || cliUtf8Bytes(value) > max || /\0|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(
2757
2797
  value
2758
2798
  ))
@@ -2761,26 +2801,26 @@ var text = (max, nonempty = false) => z30.string().superRefine((value, ctx) => {
2761
2801
  message: `Use valid non-NUL UTF-8 text of at most ${max} bytes${nonempty ? ", not empty" : ""}`
2762
2802
  });
2763
2803
  });
2764
- var id = z30.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/);
2765
- var flag = z30.string().regex(/^(?:-[A-Za-z0-9]|--[A-Za-z0-9][A-Za-z0-9-]{0,125})$/);
2766
- var envKey = z30.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,126}$/);
2804
+ var id = z32.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/);
2805
+ var flag = z32.string().regex(/^(?:-[A-Za-z0-9]|--[A-Za-z0-9][A-Za-z0-9-]{0,125})$/);
2806
+ var envKey = z32.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,126}$/);
2767
2807
  var arg = text(CLI_RULE_LIMITS.argumentBytes);
2768
2808
  var literal = text(CLI_RULE_LIMITS.literalBytes);
2769
- var stream = z30.enum(["stdout", "stderr", "combined"]);
2770
- var exit = z30.discriminatedUnion("kind", [
2771
- z30.object({ kind: z30.literal("any") }).strict(),
2772
- z30.object({
2773
- kind: z30.literal("code"),
2774
- value: z30.number().int().min(0).max(255)
2809
+ var stream = z32.enum(["stdout", "stderr", "combined"]);
2810
+ var exit = z32.discriminatedUnion("kind", [
2811
+ z32.object({ kind: z32.literal("any") }).strict(),
2812
+ z32.object({
2813
+ kind: z32.literal("code"),
2814
+ value: z32.number().int().min(0).max(255)
2775
2815
  }).strict()
2776
2816
  ]);
2777
2817
  var buffer = {
2778
- maxBufferBytes: z30.number().int().min(1).max(CLI_RULE_LIMITS.bufferBytes).default(CLI_RULE_LIMITS.bufferBytes),
2779
- maxWaitMs: z30.number().int().min(1).max(CLI_RULE_LIMITS.maxBufferWaitMs).default(CLI_RULE_LIMITS.bufferWaitMs)
2818
+ maxBufferBytes: z32.number().int().min(1).max(CLI_RULE_LIMITS.bufferBytes).default(CLI_RULE_LIMITS.bufferBytes),
2819
+ maxWaitMs: z32.number().int().min(1).max(CLI_RULE_LIMITS.maxBufferWaitMs).default(CLI_RULE_LIMITS.bufferWaitMs)
2780
2820
  };
2781
- var source = (value) => z30.discriminatedUnion("source", [
2782
- z30.object({ source: z30.literal("literal"), value }).strict(),
2783
- z30.object({ source: z30.literal("localFact"), key: envKey }).strict()
2821
+ var source = (value) => z32.discriminatedUnion("source", [
2822
+ z32.object({ source: z32.literal("literal"), value }).strict(),
2823
+ z32.object({ source: z32.literal("localFact"), key: envKey }).strict()
2784
2824
  ]);
2785
2825
  function cliBoundedPattern(pattern) {
2786
2826
  let at = pattern.startsWith("^") ? 1 : 0;
@@ -2801,62 +2841,62 @@ function cliBoundedPattern(pattern) {
2801
2841
  }
2802
2842
  return literals > 0;
2803
2843
  }
2804
- var cliRuleTargetSchema = z30.discriminatedUnion("kind", [
2805
- z30.object({
2806
- kind: z30.literal("npmBin"),
2807
- packageName: z30.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/),
2808
- program: z30.string().max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/)
2844
+ var cliRuleTargetSchema = z32.discriminatedUnion("kind", [
2845
+ z32.object({
2846
+ kind: z32.literal("npmBin"),
2847
+ packageName: z32.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/),
2848
+ program: z32.string().max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/)
2809
2849
  }).strict(),
2810
- z30.object({
2811
- kind: z30.literal("path"),
2850
+ z32.object({
2851
+ kind: z32.literal("path"),
2812
2852
  path: text(1024, true).refine(
2813
2853
  (value) => !value.includes("\\") && !value.split("/").includes(".."),
2814
2854
  "Use a sandbox path without traversal"
2815
2855
  )
2816
2856
  }).strict()
2817
2857
  ]);
2818
- var cliRuleSelectorSchema = z30.discriminatedUnion("kind", [
2819
- z30.object({
2820
- kind: z30.literal("exact"),
2821
- argv: z30.array(arg).max(CLI_RULE_LIMITS.arguments - 1)
2858
+ var cliRuleSelectorSchema = z32.discriminatedUnion("kind", [
2859
+ z32.object({
2860
+ kind: z32.literal("exact"),
2861
+ argv: z32.array(arg).max(CLI_RULE_LIMITS.arguments - 1)
2822
2862
  }).strict(),
2823
- z30.object({
2824
- kind: z30.literal("command"),
2825
- positionals: z30.object({
2826
- mode: z30.enum(["exact", "prefix"]),
2827
- tokens: z30.array(arg).max(CLI_RULE_LIMITS.arguments - 1)
2863
+ z32.object({
2864
+ kind: z32.literal("command"),
2865
+ positionals: z32.object({
2866
+ mode: z32.enum(["exact", "prefix"]),
2867
+ tokens: z32.array(arg).max(CLI_RULE_LIMITS.arguments - 1)
2828
2868
  }).strict(),
2829
- optionsPresent: z30.array(flag).max(100).default([]),
2830
- optionsAbsent: z30.array(flag).max(100).default([]),
2831
- optionValues: z30.record(flag, arg).default({})
2869
+ optionsPresent: z32.array(flag).max(100).default([]),
2870
+ optionsAbsent: z32.array(flag).max(100).default([]),
2871
+ optionValues: z32.record(flag, arg).default({})
2832
2872
  }).strict()
2833
2873
  ]);
2834
- var cliRuleOperationSchema = z30.discriminatedUnion("kind", [
2835
- z30.object({
2874
+ var cliRuleOperationSchema = z32.discriminatedUnion("kind", [
2875
+ z32.object({
2836
2876
  id,
2837
- kind: z30.literal("replaceOutput"),
2877
+ kind: z32.literal("replaceOutput"),
2838
2878
  stream,
2839
2879
  exit,
2840
2880
  replacement: literal,
2841
2881
  ...buffer
2842
2882
  }).strict(),
2843
- z30.object({
2883
+ z32.object({
2844
2884
  id,
2845
- kind: z30.literal("streamOutput"),
2885
+ kind: z32.literal("streamOutput"),
2846
2886
  stream,
2847
- edit: z30.object({ find: text(8192, true), replace: literal }).strict()
2887
+ edit: z32.object({ find: text(8192, true), replace: literal }).strict()
2848
2888
  }).strict(),
2849
- z30.object({
2889
+ z32.object({
2850
2890
  id,
2851
- kind: z30.literal("completeOutput"),
2891
+ kind: z32.literal("completeOutput"),
2852
2892
  stream,
2853
2893
  exit,
2854
2894
  replace: literal,
2855
2895
  ...buffer,
2856
- matcher: z30.discriminatedUnion("kind", [
2857
- z30.object({ kind: z30.literal("literal"), text: text(8192, true) }).strict(),
2858
- z30.object({
2859
- kind: z30.literal("re2"),
2896
+ matcher: z32.discriminatedUnion("kind", [
2897
+ z32.object({ kind: z32.literal("literal"), text: text(8192, true) }).strict(),
2898
+ z32.object({
2899
+ kind: z32.literal("re2"),
2860
2900
  pattern: text(2048, true).refine(
2861
2901
  cliBoundedPattern,
2862
2902
  "Use literals, optional anchors, and at most one greedy .*"
@@ -2864,33 +2904,33 @@ var cliRuleOperationSchema = z30.discriminatedUnion("kind", [
2864
2904
  }).strict()
2865
2905
  ])
2866
2906
  }).strict(),
2867
- z30.object({
2907
+ z32.object({
2868
2908
  id,
2869
- kind: z30.literal("ensureOption"),
2909
+ kind: z32.literal("ensureOption"),
2870
2910
  option: flag,
2871
2911
  value: source(arg).optional()
2872
2912
  }).strict(),
2873
- z30.object({
2913
+ z32.object({
2874
2914
  id,
2875
- kind: z30.literal("replaceOption"),
2915
+ kind: z32.literal("replaceOption"),
2876
2916
  option: flag,
2877
2917
  value: source(arg)
2878
2918
  }).strict(),
2879
- z30.object({
2919
+ z32.object({
2880
2920
  id,
2881
- kind: z30.literal("setEnv"),
2921
+ kind: z32.literal("setEnv"),
2882
2922
  key: envKey,
2883
2923
  value: source(arg),
2884
- whenAbsent: z30.boolean()
2924
+ whenAbsent: z32.boolean()
2885
2925
  }).strict(),
2886
- z30.object({
2926
+ z32.object({
2887
2927
  id,
2888
- kind: z30.literal("structuredStdin"),
2889
- format: z30.enum(["text", "json", "jsonl"]),
2928
+ kind: z32.literal("structuredStdin"),
2929
+ format: z32.enum(["text", "json", "jsonl"]),
2890
2930
  payload: source(literal),
2891
- timing: z30.literal("onLaunch"),
2892
- callerInput: z30.literal("replace"),
2893
- eof: z30.literal("close")
2931
+ timing: z32.literal("onLaunch"),
2932
+ callerInput: z32.literal("replace"),
2933
+ eof: z32.literal("close")
2894
2934
  }).strict()
2895
2935
  ]);
2896
2936
  function cliStructuredInputValid(format, payload) {
@@ -2906,11 +2946,11 @@ function cliStructuredInputValid(format, payload) {
2906
2946
  return false;
2907
2947
  }
2908
2948
  }
2909
- var cliRuleSchema = z30.object({
2949
+ var cliRuleSchema = z32.object({
2910
2950
  id,
2911
2951
  selector: cliRuleSelectorSchema,
2912
- optionArity: z30.record(flag, z30.union([z30.literal(0), z30.literal(1)])).default({}),
2913
- operations: z30.array(cliRuleOperationSchema).min(1).max(CLI_RULE_LIMITS.operations)
2952
+ optionArity: z32.record(flag, z32.union([z32.literal(0), z32.literal(1)])).default({}),
2953
+ operations: z32.array(cliRuleOperationSchema).min(1).max(CLI_RULE_LIMITS.operations)
2914
2954
  }).strict().superRefine((rule, ctx) => {
2915
2955
  const fail = (path3, message2) => ctx.addIssue({ code: "custom", path: path3, message: message2 });
2916
2956
  if (Object.keys(rule.optionArity).length > 100)
@@ -2991,10 +3031,10 @@ var cliRuleSchema = z30.object({
2991
3031
  );
2992
3032
  });
2993
3033
  var body = {
2994
- schemaVersion: z30.literal(3),
3034
+ schemaVersion: z32.literal(3),
2995
3035
  target: cliRuleTargetSchema,
2996
- rules: z30.array(cliRuleSchema).min(1).max(CLI_RULE_LIMITS.rules),
2997
- shippingIntent: z30.enum([
3036
+ rules: z32.array(cliRuleSchema).min(1).max(CLI_RULE_LIMITS.rules),
3037
+ shippingIntent: z32.enum([
2998
3038
  "default",
2999
3039
  "message",
3000
3040
  "interaction",
@@ -3033,13 +3073,13 @@ function validateBundle(value, ctx) {
3033
3073
  message: "CLI bundle exceeds the native JSON token bound"
3034
3074
  });
3035
3075
  }
3036
- var cliRuleAuthorInputSchema = z30.object(body).strict().superRefine(validateBundle);
3037
- var normalizedLimits = z30.object({
3038
- expansionBytes: z30.literal(CLI_RULE_LIMITS.expansionBytes),
3039
- excerptBytes: z30.literal(CLI_RULE_LIMITS.excerptBytes),
3040
- attemptExcerptBytes: z30.literal(CLI_RULE_LIMITS.attemptExcerptBytes),
3041
- journalBytes: z30.literal(CLI_RULE_LIMITS.journalBytes),
3042
- supervisorTasks: z30.literal(CLI_RULE_LIMITS.supervisorTasks)
3076
+ var cliRuleAuthorInputSchema = z32.object(body).strict().superRefine(validateBundle);
3077
+ var normalizedLimits = z32.object({
3078
+ expansionBytes: z32.literal(CLI_RULE_LIMITS.expansionBytes),
3079
+ excerptBytes: z32.literal(CLI_RULE_LIMITS.excerptBytes),
3080
+ attemptExcerptBytes: z32.literal(CLI_RULE_LIMITS.attemptExcerptBytes),
3081
+ journalBytes: z32.literal(CLI_RULE_LIMITS.journalBytes),
3082
+ supervisorTasks: z32.literal(CLI_RULE_LIMITS.supervisorTasks)
3043
3083
  }).strict().default({
3044
3084
  expansionBytes: CLI_RULE_LIMITS.expansionBytes,
3045
3085
  excerptBytes: CLI_RULE_LIMITS.excerptBytes,
@@ -3047,10 +3087,10 @@ var normalizedLimits = z30.object({
3047
3087
  journalBytes: CLI_RULE_LIMITS.journalBytes,
3048
3088
  supervisorTasks: CLI_RULE_LIMITS.supervisorTasks
3049
3089
  });
3050
- var cliRuleBundleSchema = z30.object({
3090
+ var cliRuleBundleSchema = z32.object({
3051
3091
  ...body,
3052
3092
  limits: normalizedLimits,
3053
- bundleSha256: z30.string().regex(/^[a-f0-9]{64}$/)
3093
+ bundleSha256: z32.string().regex(/^[a-f0-9]{64}$/)
3054
3094
  }).strict().superRefine(validateBundle);
3055
3095
 
3056
3096
  // ../packages/api-schemas/src/climb-kinds.ts
@@ -3081,35 +3121,35 @@ var LEVER_INTERVENTIONS = {
3081
3121
  };
3082
3122
 
3083
3123
  // ../packages/api-schemas/src/sandbox-overrides.ts
3084
- import { z as z31 } from "zod";
3124
+ import { z as z33 } from "zod";
3085
3125
  var SANDBOX_OVERRIDE_KINDS = ["packages", "clis"];
3086
- var ecosystemSchema = z31.enum(["npm", "pypi", "cargo", "go", "gem"]);
3087
- var overrideFilesSchema = z31.array(
3088
- z31.object({
3089
- path: z31.string().min(1).refine(
3126
+ var ecosystemSchema = z33.enum(["npm", "pypi", "cargo", "go", "gem"]);
3127
+ var overrideFilesSchema = z33.array(
3128
+ z33.object({
3129
+ path: z33.string().min(1).refine(
3090
3130
  (path3) => !path3.startsWith("/") && !path3.includes("\\") && !path3.split("/").includes(".."),
3091
3131
  "Use a relative path within the target"
3092
3132
  ),
3093
- body: z31.string()
3133
+ body: z33.string()
3094
3134
  }).strict()
3095
3135
  ).min(1);
3096
3136
  var contentShape = {
3097
- version: z31.string().trim().min(1).optional(),
3137
+ version: z33.string().trim().min(1).optional(),
3098
3138
  files: overrideFilesSchema.optional()
3099
3139
  };
3100
3140
  var hasContent = (value) => value.version !== void 0 || value.files !== void 0;
3101
- var sandboxOverridesSchema = z31.object({
3102
- version: z31.literal(1),
3103
- packages: z31.array(
3104
- z31.object({
3141
+ var sandboxOverridesSchema = z33.object({
3142
+ version: z33.literal(1),
3143
+ packages: z33.array(
3144
+ z33.object({
3105
3145
  ecosystem: ecosystemSchema,
3106
- name: z31.string().trim().min(1),
3146
+ name: z33.string().trim().min(1),
3107
3147
  ...contentShape
3108
3148
  }).strict().refine(hasContent, "Specify a version or files")
3109
3149
  ).optional(),
3110
- clis: z31.array(
3111
- z31.object({
3112
- name: z31.string().trim().min(1),
3150
+ clis: z33.array(
3151
+ z33.object({
3152
+ name: z33.string().trim().min(1),
3113
3153
  ...contentShape
3114
3154
  }).strict().refine(hasContent, "Specify a version or files")
3115
3155
  ).optional()
@@ -3136,11 +3176,11 @@ var sandboxOverridesSchema = z31.object({
3136
3176
  });
3137
3177
 
3138
3178
  // ../packages/api-schemas/src/climb.ts
3139
- var climbSubjectKindSchema = z32.enum(["EVAL_SET", "VISIBILITY_PROMPT"]);
3140
- var leverKindSchema = z32.enum(LEVER_KINDS);
3141
- var interventionKindSchema = z32.enum(INTERVENTION_KINDS);
3142
- var skill = z32.object({ skillVersionId: z32.string().min(1) }).strict();
3143
- var empty = z32.object({}).strict();
3179
+ var climbSubjectKindSchema = z34.enum(["EVAL_SET", "VISIBILITY_PROMPT"]);
3180
+ var leverKindSchema = z34.enum(LEVER_KINDS);
3181
+ var interventionKindSchema = z34.enum(INTERVENTION_KINDS);
3182
+ var skill = z34.object({ skillVersionId: z34.string().min(1) }).strict();
3183
+ var empty = z34.object({}).strict();
3144
3184
  function validateFixtureIntervention(value, ctx) {
3145
3185
  const result = webFixtureSchema.safeParse({ version: 1, ...value });
3146
3186
  if (!result.success) {
@@ -3153,73 +3193,73 @@ function validateFixtureIntervention(value, ctx) {
3153
3193
  }
3154
3194
  }
3155
3195
  }
3156
- var interventionSchema = z32.discriminatedUnion("kind", [
3157
- z32.object({ kind: z32.literal("BASELINE"), after: empty }),
3158
- z32.object({ kind: z32.literal("ADD_SKILL"), after: skill }),
3159
- z32.object({ kind: z32.literal("REMOVE_SKILL"), before: skill, after: empty }),
3160
- z32.object({ kind: z32.literal("EDIT_SKILL"), before: skill, after: skill }),
3161
- z32.object({
3162
- kind: z32.literal("REWRITE_DOCS"),
3163
- before: z32.json().optional(),
3164
- after: z32.object({ pages: webFixtureSchema.shape.pages.unwrap().min(1) }).strict().superRefine(validateFixtureIntervention)
3196
+ var interventionSchema = z34.discriminatedUnion("kind", [
3197
+ z34.object({ kind: z34.literal("BASELINE"), after: empty }),
3198
+ z34.object({ kind: z34.literal("ADD_SKILL"), after: skill }),
3199
+ z34.object({ kind: z34.literal("REMOVE_SKILL"), before: skill, after: empty }),
3200
+ z34.object({ kind: z34.literal("EDIT_SKILL"), before: skill, after: skill }),
3201
+ z34.object({
3202
+ kind: z34.literal("REWRITE_DOCS"),
3203
+ before: z34.json().optional(),
3204
+ after: z34.object({ pages: webFixtureSchema.shape.pages.unwrap().min(1) }).strict().superRefine(validateFixtureIntervention)
3165
3205
  }),
3166
- z32.object({
3167
- kind: z32.literal("PACKAGE_VERSION"),
3168
- after: z32.object({
3206
+ z34.object({
3207
+ kind: z34.literal("PACKAGE_VERSION"),
3208
+ after: z34.object({
3169
3209
  ecosystem: ecosystemSchema,
3170
- name: z32.string().min(1),
3171
- version: z32.string().min(1)
3210
+ name: z34.string().min(1),
3211
+ version: z34.string().min(1)
3172
3212
  }).strict()
3173
3213
  }),
3174
- z32.object({
3175
- kind: z32.literal("PACKAGE_CONTENT"),
3176
- after: z32.object({
3214
+ z34.object({
3215
+ kind: z34.literal("PACKAGE_CONTENT"),
3216
+ after: z34.object({
3177
3217
  ecosystem: ecosystemSchema,
3178
- name: z32.string().min(1),
3218
+ name: z34.string().min(1),
3179
3219
  files: overrideFilesSchema
3180
3220
  }).strict()
3181
3221
  }),
3182
- z32.object({
3183
- kind: z32.literal("CLI_VERSION"),
3184
- after: z32.object({ name: z32.string().min(1), version: z32.string().min(1) }).strict()
3222
+ z34.object({
3223
+ kind: z34.literal("CLI_VERSION"),
3224
+ after: z34.object({ name: z34.string().min(1), version: z34.string().min(1) }).strict()
3185
3225
  }),
3186
- z32.object({
3187
- kind: z32.literal("CLI_INTERVENTION"),
3226
+ z34.object({
3227
+ kind: z34.literal("CLI_INTERVENTION"),
3188
3228
  after: cliRuleBundleSchema
3189
3229
  })
3190
3230
  ]);
3191
- var climbSettingsSchema = z32.object({
3192
- maxRounds: z32.number().int().positive().default(5),
3193
- sampleCount: z32.number().int().positive().default(1),
3194
- creditCap: z32.number().int().nonnegative(),
3195
- targetScore: z32.number().min(0).max(1).default(1),
3231
+ var climbSettingsSchema = z34.object({
3232
+ maxRounds: z34.number().int().positive().default(5),
3233
+ sampleCount: z34.number().int().positive().default(1),
3234
+ creditCap: z34.number().int().nonnegative(),
3235
+ targetScore: z34.number().min(0).max(1).default(1),
3196
3236
  // Narrow the subject's whole roster to one slot, for the baseline and every
3197
3237
  // trial alike. A subject rostering ten models otherwise multiplies every
3198
3238
  // trial by ten, and a one-model trial measured against a ten-model baseline
3199
3239
  // is not a comparison. `pinnedModel` empty means the agent's default model.
3200
3240
  pinnedAgent: schedulableAgentSchema.optional(),
3201
- pinnedModel: z32.string().optional(),
3202
- maxTrialsPerRound: z32.number().int().min(1).max(10).default(3),
3241
+ pinnedModel: z34.string().optional(),
3242
+ maxTrialsPerRound: z34.number().int().min(1).max(10).default(3),
3203
3243
  // The round a continuation started at; the no-improvement counter
3204
3244
  // restarts here.
3205
- continuedAtRound: z32.number().int().nonnegative().optional()
3245
+ continuedAtRound: z34.number().int().nonnegative().optional()
3206
3246
  }).strip().refine((value) => value.pinnedAgent !== void 0 || !value.pinnedModel, {
3207
3247
  path: ["pinnedAgent"],
3208
3248
  message: "Pin an agent with the model"
3209
3249
  });
3210
- var climbDirectionSchema = z32.object({
3211
- focus: z32.string().trim().max(2e3).nullable().default(null),
3212
- preserve: z32.array(z32.string().trim().min(1).max(500)).max(20).default([]),
3213
- exclude: z32.array(z32.string().trim().min(1).max(500)).max(20).default([]),
3214
- notes: z32.string().trim().max(4e3).nullable().default(null)
3215
- });
3216
- var climbDirectionPatchSchema = z32.object({
3217
- focus: z32.string().trim().max(2e3).nullable().optional(),
3218
- preserve: z32.array(z32.string().trim().min(1).max(500)).max(20).optional(),
3219
- exclude: z32.array(z32.string().trim().min(1).max(500)).max(20).optional(),
3220
- notes: z32.string().trim().max(4e3).nullable().optional(),
3250
+ var climbDirectionSchema = z34.object({
3251
+ focus: z34.string().trim().max(2e3).nullable().default(null),
3252
+ preserve: z34.array(z34.string().trim().min(1).max(500)).max(20).default([]),
3253
+ exclude: z34.array(z34.string().trim().min(1).max(500)).max(20).default([]),
3254
+ notes: z34.string().trim().max(4e3).nullable().default(null)
3255
+ });
3256
+ var climbDirectionPatchSchema = z34.object({
3257
+ focus: z34.string().trim().max(2e3).nullable().optional(),
3258
+ preserve: z34.array(z34.string().trim().min(1).max(500)).max(20).optional(),
3259
+ exclude: z34.array(z34.string().trim().min(1).max(500)).max(20).optional(),
3260
+ notes: z34.string().trim().max(4e3).nullable().optional(),
3221
3261
  /** One line on why this was recorded; becomes the DIRECTION row summary. */
3222
- rationale: z32.string().trim().max(500).optional()
3262
+ rationale: z34.string().trim().max(500).optional()
3223
3263
  }).strict();
3224
3264
  var CLIMB_ACTIVITY_KINDS = [
3225
3265
  "STARTED",
@@ -3238,74 +3278,75 @@ var CLIMB_ACTIVITY_KINDS = [
3238
3278
  "CONTINUED",
3239
3279
  "CANCELED"
3240
3280
  ];
3241
- var climbActivityKindSchema = z32.enum(CLIMB_ACTIVITY_KINDS);
3242
- var proposerTraceStepSchema = z32.object({
3243
- tool: z32.string(),
3244
- args: z32.string(),
3245
- result: z32.string().nullable(),
3246
- isError: z32.boolean().optional()
3247
- });
3248
- var proposerTraceSchema = z32.object({
3249
- steps: z32.array(proposerTraceStepSchema),
3250
- reasoning: z32.string(),
3251
- durationMs: z32.number().int().nonnegative(),
3252
- model: z32.string()
3253
- });
3254
- var climbActivitySchema = z32.object({
3255
- id: z32.string(),
3256
- climbId: z32.string(),
3257
- roundId: z32.string().nullable(),
3258
- trialId: z32.string().nullable(),
3281
+ var climbActivityKindSchema = z34.enum(CLIMB_ACTIVITY_KINDS);
3282
+ var proposerTraceStepSchema = z34.object({
3283
+ tool: z34.string(),
3284
+ args: z34.string(),
3285
+ result: z34.string().nullable(),
3286
+ isError: z34.boolean().optional()
3287
+ });
3288
+ var proposerTraceSchema = z34.object({
3289
+ steps: z34.array(proposerTraceStepSchema),
3290
+ reasoning: z34.string(),
3291
+ durationMs: z34.number().int().nonnegative(),
3292
+ model: z34.string()
3293
+ });
3294
+ var climbActivitySchema = z34.object({
3295
+ id: z34.string(),
3296
+ climbId: z34.string(),
3297
+ roundId: z34.string().nullable(),
3298
+ trialId: z34.string().nullable(),
3259
3299
  kind: climbActivityKindSchema,
3260
- actorUserId: z32.string().nullable(),
3261
- actorName: z32.string().nullable(),
3262
- summary: z32.string(),
3263
- detail: z32.unknown().nullable(),
3264
- createdAt: z32.string()
3265
- });
3266
- var activityQuerySchema = z32.object({
3267
- after: z32.string().datetime().optional(),
3268
- limit: z32.coerce.number().int().min(1).max(500).default(500)
3269
- });
3270
- var climbConfigSnapshotSchema = z32.object({
3271
- promptText: z32.string(),
3272
- scenario: z32.enum(["GREENFIELD", "MIGRATION"]),
3273
- repoUrl: z32.string().nullable(),
3274
- repoRef: z32.string().nullable(),
3275
- profileId: z32.string().nullable(),
3276
- profileName: z32.string().nullable(),
3277
- profileDescription: z32.string().nullable(),
3278
- profileModel: z32.string().nullable(),
3279
- limits: z32.json(),
3280
- agents: z32.array(agentConfigSchema).min(1),
3281
- skillRefs: z32.array(z32.string()),
3282
- mcpRefs: z32.array(z32.string()),
3283
- skillVersionIds: z32.array(z32.string()),
3284
- mcpServerVersionIds: z32.array(z32.string()),
3285
- skillSet: z32.json().nullable(),
3286
- mcpSet: z32.json().nullable(),
3287
- connectionIds: z32.array(z32.string()),
3288
- connectionSet: z32.json().nullable(),
3289
- agentContext: z32.json().nullable(),
3290
- agentContextDigest: z32.string().nullable(),
3300
+ actorUserId: z34.string().nullable(),
3301
+ actorName: z34.string().nullable(),
3302
+ summary: z34.string(),
3303
+ detail: z34.unknown().nullable(),
3304
+ createdAt: z34.string()
3305
+ });
3306
+ var activityQuerySchema = z34.object({
3307
+ after: z34.string().datetime().optional(),
3308
+ limit: z34.coerce.number().int().min(1).max(500).default(500)
3309
+ });
3310
+ var climbConfigSnapshotSchema = z34.object({
3311
+ promptText: z34.string(),
3312
+ scenario: z34.enum(["GREENFIELD", "MIGRATION"]),
3313
+ repoUrl: z34.string().nullable(),
3314
+ repoRef: z34.string().nullable(),
3315
+ profileId: z34.string().nullable(),
3316
+ profileName: z34.string().nullable(),
3317
+ profileDescription: z34.string().nullable(),
3318
+ profileModel: z34.string().nullable(),
3319
+ limits: z34.json(),
3320
+ agents: z34.array(agentConfigSchema).min(1),
3321
+ skillRefs: z34.array(z34.string()),
3322
+ mcpRefs: z34.array(z34.string()),
3323
+ skillVersionIds: z34.array(z34.string()),
3324
+ mcpServerVersionIds: z34.array(z34.string()),
3325
+ skillSet: z34.json().nullable(),
3326
+ mcpSet: z34.json().nullable(),
3327
+ connectionIds: z34.array(z34.string()),
3328
+ connectionSet: z34.json().nullable(),
3329
+ agentContext: z34.json().nullable(),
3330
+ agentContextDigest: z34.string().nullable(),
3291
3331
  webFixture: webFixtureSchema.nullable(),
3292
3332
  cliIntervention: cliRuleBundleSchema.nullable().default(null),
3293
3333
  sandboxOverrides: sandboxOverridesSchema.nullable(),
3294
- visibilityScenarioId: z32.string().nullable()
3334
+ visibilityScenarioId: z34.string().nullable()
3295
3335
  }).strict();
3296
- var targetRefSchema = z32.object({
3297
- kind: z32.string().min(1),
3298
- id: z32.string().optional(),
3299
- url: z32.url().optional(),
3300
- package: z32.string().optional()
3336
+ var targetRefSchema = z34.object({
3337
+ kind: z34.string().min(1),
3338
+ id: z34.string().optional(),
3339
+ url: z34.url().optional(),
3340
+ package: z34.string().optional()
3301
3341
  }).strict();
3302
- var trialInputSchema = z32.object({
3303
- title: z32.string().trim().min(1).max(200),
3304
- hypothesis: z32.string().max(4e3).optional(),
3342
+ var trialInputSchema = z34.object({
3343
+ title: z34.string().trim().min(1).max(200),
3344
+ hypothesis: z34.string().max(4e3).optional(),
3305
3345
  lever: leverKindSchema,
3306
3346
  targetRef: targetRefSchema.optional(),
3307
3347
  intervention: interventionSchema,
3308
- authorMode: z32.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL")
3348
+ authorMode: z34.enum(["MANUAL", "DIRECT", "PROPOSE"]).default("MANUAL"),
3349
+ startingPoints: candidateStartsSchema.optional()
3309
3350
  }).strict().superRefine((value, ctx) => {
3310
3351
  const allowed = LEVER_INTERVENTIONS[value.lever];
3311
3352
  if (!allowed.includes(value.intervention.kind))
@@ -3324,7 +3365,7 @@ var OPTIMIZATION_STATUSES = [
3324
3365
  "DONE",
3325
3366
  "ARCHIVED"
3326
3367
  ];
3327
- var optimizationStatusSchema = z33.enum(OPTIMIZATION_STATUSES);
3368
+ var optimizationStatusSchema = z35.enum(OPTIMIZATION_STATUSES);
3328
3369
  var ROUND_STATUSES = [
3329
3370
  "PROPOSING",
3330
3371
  "PROPOSED",
@@ -3353,61 +3394,61 @@ var OPTIMIZATION_EFFORTS = [
3353
3394
  { value: "HIGH", label: "Thorough", sampleCount: 2, maxRounds: 8 },
3354
3395
  { value: "XHIGH", label: "Exhaustive", sampleCount: 3, maxRounds: 12 }
3355
3396
  ];
3356
- var optimizationEffortSchema = z33.enum(
3397
+ var optimizationEffortSchema = z35.enum(
3357
3398
  OPTIMIZATION_EFFORTS.map((preset) => preset.value)
3358
3399
  );
3359
- var listOptimizationsQuerySchema = z33.object({
3360
- status: z33.string().optional().transform(
3400
+ var listOptimizationsQuerySchema = z35.object({
3401
+ status: z35.string().optional().transform(
3361
3402
  (value) => value ? value.split(",").map((part) => part.trim().toUpperCase()).filter(Boolean) : void 0
3362
- ).pipe(z33.array(optimizationStatusSchema).optional()),
3403
+ ).pipe(z35.array(optimizationStatusSchema).optional()),
3363
3404
  subjectKind: climbSubjectKindSchema.optional(),
3364
- subjectId: z33.string().min(1).optional(),
3365
- limit: z33.coerce.number().int().min(1).max(200).default(50),
3405
+ subjectId: z35.string().min(1).optional(),
3406
+ limit: z35.coerce.number().int().min(1).max(200).default(50),
3366
3407
  /** Drafts are workspaces, not runs; older clients never see them. */
3367
- includeDrafts: z33.union([z33.boolean(), z33.string()]).optional().transform((value) => value === true || value === "true" || value === "1")
3408
+ includeDrafts: z35.union([z35.boolean(), z35.string()]).optional().transform((value) => value === true || value === "true" || value === "1")
3368
3409
  });
3369
- var optimizationSummarySchema = z33.object({
3370
- id: z33.string(),
3371
- name: z33.string(),
3410
+ var optimizationSummarySchema = z35.object({
3411
+ id: z35.string(),
3412
+ name: z35.string(),
3372
3413
  status: optimizationStatusSchema,
3373
- mode: z33.enum(["MANUAL", "AUTO"]),
3414
+ mode: z35.enum(["MANUAL", "AUTO"]),
3374
3415
  /** Autonomous launches every proposed round; interactive waits for one. */
3375
- autonomous: z33.boolean(),
3376
- stopReason: z33.string().nullable(),
3416
+ autonomous: z35.boolean(),
3417
+ stopReason: z35.string().nullable(),
3377
3418
  subjectKind: climbSubjectKindSchema,
3378
- subjectId: z33.string(),
3379
- subjectName: z33.string(),
3419
+ subjectId: z35.string(),
3420
+ subjectName: z35.string(),
3380
3421
  lever: leverKindSchema.nullable(),
3381
- round: z33.number().int(),
3382
- maxRounds: z33.number().int(),
3422
+ round: z35.number().int(),
3423
+ maxRounds: z35.number().int(),
3383
3424
  /** Starting baseline score, 0..1. */
3384
- before: z33.number().nullable(),
3425
+ before: z35.number().nullable(),
3385
3426
  /** Score of the marked winner, or best BETTER trial, 0..1. */
3386
- after: z33.number().nullable(),
3427
+ after: z35.number().nullable(),
3387
3428
  /** Percentage-point change from the baseline to the winner or best BETTER trial. */
3388
- delta: z33.number().nullable(),
3429
+ delta: z35.number().nullable(),
3389
3430
  /** Score after each round, baseline first. */
3390
- path: z33.array(z33.number()),
3391
- creditsSpent: z33.number().int(),
3392
- creditsReserved: z33.number().int(),
3393
- summary: z33.string().nullable(),
3394
- href: z33.string(),
3395
- createdAt: z33.string(),
3396
- updatedAt: z33.string()
3397
- });
3398
- var listOptimizationsResponseSchema = z33.object({
3399
- items: z33.array(optimizationSummarySchema)
3400
- });
3401
- var targetSchema = z33.object({
3431
+ path: z35.array(z35.number()),
3432
+ creditsSpent: z35.number().int(),
3433
+ creditsReserved: z35.number().int(),
3434
+ summary: z35.string().nullable(),
3435
+ href: z35.string(),
3436
+ createdAt: z35.string(),
3437
+ updatedAt: z35.string()
3438
+ });
3439
+ var listOptimizationsResponseSchema = z35.object({
3440
+ items: z35.array(optimizationSummarySchema)
3441
+ });
3442
+ var targetSchema = z35.object({
3402
3443
  agent: schedulableAgentSchema.optional(),
3403
3444
  /** Empty or omitted means the agent's default model. */
3404
- model: z33.string().optional()
3445
+ model: z35.string().optional()
3405
3446
  });
3406
3447
  var planShape = {
3407
3448
  effort: optimizationEffortSchema.optional(),
3408
- sampleCount: z33.number().int().min(1).max(100).optional(),
3409
- maxRounds: z33.number().int().min(1).max(100).optional(),
3410
- maxTrialsPerRound: z33.number().int().min(1).max(10).optional()
3449
+ sampleCount: z35.number().int().min(1).max(100).optional(),
3450
+ maxRounds: z35.number().int().min(1).max(100).optional(),
3451
+ maxTrialsPerRound: z35.number().int().min(1).max(10).optional()
3411
3452
  };
3412
3453
  function refinePlan(value, ctx) {
3413
3454
  if (value.effort && (value.sampleCount || value.maxRounds))
@@ -3423,18 +3464,18 @@ function refinePlan(value, ctx) {
3423
3464
  message: "Pin an agent with the model"
3424
3465
  });
3425
3466
  }
3426
- var startOptimizationBodySchema = z33.object({
3467
+ var startOptimizationBodySchema = z35.object({
3427
3468
  subjectKind: climbSubjectKindSchema,
3428
- subjectId: z33.string().min(1),
3429
- name: z33.string().trim().min(1).max(200).optional(),
3469
+ subjectId: z35.string().min(1),
3470
+ name: z35.string().trim().min(1).max(200).optional(),
3430
3471
  ...planShape,
3431
- creditCap: z33.number().int().nonnegative().optional(),
3432
- targetScore: z33.number().min(0).max(1).optional(),
3472
+ creditCap: z35.number().int().nonnegative().optional(),
3473
+ targetScore: z35.number().min(0).max(1).optional(),
3433
3474
  target: targetSchema.extend({ agent: schedulableAgentSchema })
3434
3475
  }).strict().superRefine(refinePlan);
3435
- var estimateOptimizationBodySchema = z33.object({
3476
+ var estimateOptimizationBodySchema = z35.object({
3436
3477
  subjectKind: climbSubjectKindSchema,
3437
- subjectId: z33.string().min(1),
3478
+ subjectId: z35.string().min(1),
3438
3479
  ...planShape,
3439
3480
  target: targetSchema.optional()
3440
3481
  }).strict().superRefine(refinePlan);
@@ -3446,105 +3487,127 @@ var RUN_CREDIT_BASES = [
3446
3487
  "byok",
3447
3488
  "reserve"
3448
3489
  ];
3449
- var runCreditBasisSchema = z33.enum(RUN_CREDIT_BASES);
3450
- var optimizationEstimateSchema = z33.object({
3451
- sampleCount: z33.number().int(),
3452
- maxRounds: z33.number().int(),
3453
- runsPerTrial: z33.number(),
3454
- executionCredits: z33.number(),
3455
- judgeCredits: z33.number(),
3456
- leverPassCredits: z33.number(),
3457
- trialCredits: z33.number(),
3490
+ var runCreditBasisSchema = z35.enum(RUN_CREDIT_BASES);
3491
+ var optimizationEstimateSchema = z35.object({
3492
+ sampleCount: z35.number().int(),
3493
+ maxRounds: z35.number().int(),
3494
+ runsPerTrial: z35.number(),
3495
+ executionCredits: z35.number(),
3496
+ judgeCredits: z35.number(),
3497
+ leverPassCredits: z35.number(),
3498
+ trialCredits: z35.number(),
3458
3499
  /** Estimate, not a reservation or enforced spending cap. */
3459
- estimate: z33.number().int(),
3500
+ estimate: z35.number().int(),
3460
3501
  /** True when no price or history covered a model: a bound, not a forecast. */
3461
- approximate: z33.boolean().default(false),
3502
+ approximate: z35.boolean().default(false),
3462
3503
  /** Which rung priced the run, so the UI can say why a figure is what it is. */
3463
3504
  basis: runCreditBasisSchema.optional()
3464
3505
  });
3465
- var diagnoseBodySchema = z33.object({
3506
+ var diagnoseBodySchema = z35.object({
3466
3507
  subjectKind: climbSubjectKindSchema,
3467
- subjectId: z33.string().min(1)
3508
+ subjectId: z35.string().min(1)
3468
3509
  }).strict();
3469
- var diagnosisSchema = z33.object({
3470
- id: z33.string(),
3471
- status: z33.enum(["GENERATING", "READY", "FAILED"]),
3510
+ var diagnosisSchema = z35.object({
3511
+ id: z35.string(),
3512
+ status: z35.enum(["GENERATING", "READY", "FAILED"]),
3472
3513
  subjectKind: climbSubjectKindSchema,
3473
- subjectId: z33.string(),
3474
- runCount: z33.number().int(),
3475
- summary: z33.string().nullable(),
3514
+ subjectId: z35.string(),
3515
+ runCount: z35.number().int(),
3516
+ summary: z35.string().nullable(),
3476
3517
  recommendedLever: leverKindSchema.nullable(),
3477
- recommendedTarget: z33.unknown().nullable(),
3478
- clusters: z33.array(
3479
- z33.object({
3480
- title: z33.string(),
3481
- failureMode: z33.string(),
3482
- criterionIds: z33.array(z33.string()),
3483
- runIds: z33.array(z33.string()),
3518
+ recommendedTarget: z35.unknown().nullable(),
3519
+ clusters: z35.array(
3520
+ z35.object({
3521
+ title: z35.string(),
3522
+ failureMode: z35.string(),
3523
+ criterionIds: z35.array(z35.string()),
3524
+ runIds: z35.array(z35.string()),
3484
3525
  lever: leverKindSchema.nullable(),
3485
- targetRef: z33.unknown().nullable(),
3486
- confidence: z33.number()
3526
+ targetRef: z35.unknown().nullable(),
3527
+ confidence: z35.number()
3487
3528
  })
3488
3529
  ),
3489
- unsupportedLevers: z33.array(leverKindSchema).default([]),
3490
- createdAt: z33.string()
3491
- });
3492
- var trialRunSchema = z33.object({
3493
- id: z33.string(),
3494
- status: z33.string(),
3495
- failureReason: z33.string().nullable(),
3496
- exitReason: z33.string().nullable(),
3530
+ unsupportedLevers: z35.array(leverKindSchema).default([]),
3531
+ createdAt: z35.string()
3532
+ });
3533
+ var candidateExecutionSchema = z35.object({
3534
+ runId: z35.string(),
3535
+ startMode: z35.enum(["checkpoint", "fresh"]),
3536
+ checkpointId: z35.string().nullable(),
3537
+ sourceRunId: z35.string().nullable(),
3538
+ status: z35.string(),
3539
+ continuation: z35.literal("running-process").optional(),
3540
+ sourceAttempt: z35.number().int().positive().optional(),
3541
+ estimatedSavedWork: z35.object({
3542
+ elapsedMs: z35.number().nonnegative(),
3543
+ usage: z35.object({
3544
+ input_tokens: z35.number().nonnegative(),
3545
+ output_tokens: z35.number().nonnegative(),
3546
+ cache_read_input_tokens: z35.number().nonnegative(),
3547
+ cache_creation_input_tokens: z35.number().nonnegative()
3548
+ }),
3549
+ attribution: z35.literal("approximate")
3550
+ }).optional()
3551
+ });
3552
+ var trialRunSchema = z35.object({
3553
+ id: z35.string(),
3554
+ status: z35.string(),
3555
+ failureReason: z35.string().nullable(),
3556
+ exitReason: z35.string().nullable(),
3557
+ candidateDelivery: candidateDeliverySchema.nullable().optional(),
3558
+ candidateExecution: candidateExecutionSchema.nullable().optional(),
3497
3559
  cliCoverage: cliRuleCoverageSchema.nullable().optional(),
3498
- passed: z33.boolean().nullable(),
3499
- criteria: z33.array(
3500
- z33.object({ name: z33.string(), passed: z33.boolean(), reasoning: z33.string() })
3560
+ passed: z35.boolean().nullable(),
3561
+ criteria: z35.array(
3562
+ z35.object({ name: z35.string(), passed: z35.boolean(), reasoning: z35.string() })
3501
3563
  ),
3502
- levers: z33.array(
3503
- z33.object({
3504
- lever: z33.string(),
3505
- attributed: z33.boolean(),
3506
- note: z33.string().nullable()
3564
+ levers: z35.array(
3565
+ z35.object({
3566
+ lever: z35.string(),
3567
+ attributed: z35.boolean(),
3568
+ note: z35.string().nullable()
3507
3569
  })
3508
3570
  )
3509
3571
  });
3510
- var trialSchema = z33.object({
3511
- id: z33.string(),
3512
- climbId: z33.string(),
3513
- roundNumber: z33.number().int(),
3514
- key: z33.string(),
3572
+ var trialSchema = z35.object({
3573
+ id: z35.string(),
3574
+ climbId: z35.string(),
3575
+ roundNumber: z35.number().int(),
3576
+ key: z35.string(),
3515
3577
  /** @deprecated All trials branch from the baseline. */
3516
- parentTrialId: z33.string().nullable(),
3578
+ parentTrialId: z35.string().nullable(),
3517
3579
  /** @deprecated Always the baseline key for non-baseline trials. */
3518
- parentKey: z33.string().nullable(),
3519
- title: z33.string(),
3520
- hypothesis: z33.string().nullable(),
3580
+ parentKey: z35.string().nullable(),
3581
+ title: z35.string(),
3582
+ hypothesis: z35.string().nullable(),
3521
3583
  lever: leverKindSchema.nullable(),
3522
3584
  kind: interventionKindSchema,
3523
- status: z33.enum(TRIAL_STATUSES),
3524
- verdict: z33.enum(TRIAL_VERDICTS).nullable(),
3525
- score: z33.number().nullable(),
3526
- baselineScore: z33.number().nullable(),
3585
+ status: z35.enum(TRIAL_STATUSES),
3586
+ verdict: z35.enum(TRIAL_VERDICTS).nullable(),
3587
+ score: z35.number().nullable(),
3588
+ baselineScore: z35.number().nullable(),
3527
3589
  /** Judged sessions behind `score`. */
3528
- sessions: z33.number().int(),
3590
+ sessions: z35.number().int(),
3529
3591
  /** Sessions that FAILED or TIMED_OUT; `score` leaves them out. */
3530
- failedSessions: z33.number().int(),
3531
- isBaseline: z33.boolean(),
3592
+ failedSessions: z35.number().int(),
3593
+ isBaseline: z35.boolean(),
3532
3594
  /** The user marked this trial as the winner; it does not move the baseline. */
3533
- adopted: z33.boolean(),
3534
- adoptedAt: z33.string().nullable(),
3535
- outcome: z33.string().nullable(),
3595
+ adopted: z35.boolean(),
3596
+ adoptedAt: z35.string().nullable(),
3597
+ outcome: z35.string().nullable(),
3536
3598
  /** The kind-specific `after` payload (skill version id, pages, package). */
3537
- after: z33.unknown(),
3538
- before: z33.unknown(),
3539
- runs: z33.array(trialRunSchema),
3540
- createdAt: z33.string()
3541
- });
3542
- var roundSchema = z33.object({
3543
- id: z33.string(),
3544
- number: z33.number().int(),
3545
- status: z33.enum(ROUND_STATUSES),
3546
- narrative: z33.string().nullable(),
3547
- trials: z33.array(trialSchema)
3599
+ after: z35.unknown(),
3600
+ before: z35.unknown(),
3601
+ startingPoints: candidateStartsSchema.optional(),
3602
+ runs: z35.array(trialRunSchema),
3603
+ createdAt: z35.string()
3604
+ });
3605
+ var roundSchema = z35.object({
3606
+ id: z35.string(),
3607
+ number: z35.number().int(),
3608
+ status: z35.enum(ROUND_STATUSES),
3609
+ narrative: z35.string().nullable(),
3610
+ trials: z35.array(trialSchema)
3548
3611
  });
3549
3612
  var OPTIMIZATION_NEXT_ACTIONS = [
3550
3613
  "START",
@@ -3555,355 +3618,355 @@ var OPTIMIZATION_NEXT_ACTIONS = [
3555
3618
  "RESUME",
3556
3619
  "NONE"
3557
3620
  ];
3558
- var optimizationNextActionSchema = z33.enum(OPTIMIZATION_NEXT_ACTIONS);
3621
+ var optimizationNextActionSchema = z35.enum(OPTIMIZATION_NEXT_ACTIONS);
3559
3622
  var optimizationDetailSchema = optimizationSummarySchema.extend({
3560
- baselineTrialId: z33.string().nullable(),
3623
+ baselineTrialId: z35.string().nullable(),
3561
3624
  /** The one thing a client does next. WAIT and NONE need nobody. */
3562
3625
  nextAction: optimizationNextActionSchema,
3563
- settings: z33.object({
3564
- sampleCount: z33.number().int(),
3565
- maxRounds: z33.number().int(),
3566
- maxTrialsPerRound: z33.number().int(),
3567
- creditCap: z33.number().int(),
3568
- targetScore: z33.number(),
3569
- pinnedAgent: z33.string().nullable(),
3570
- pinnedModel: z33.string().nullable(),
3571
- continuedAtRound: z33.number().int().nullable()
3626
+ settings: z35.object({
3627
+ sampleCount: z35.number().int(),
3628
+ maxRounds: z35.number().int(),
3629
+ maxTrialsPerRound: z35.number().int(),
3630
+ creditCap: z35.number().int(),
3631
+ targetScore: z35.number(),
3632
+ pinnedAgent: z35.string().nullable(),
3633
+ pinnedModel: z35.string().nullable(),
3634
+ continuedAtRound: z35.number().int().nullable()
3572
3635
  }),
3573
3636
  direction: climbDirectionSchema,
3574
- rounds: z33.array(roundSchema)
3637
+ rounds: z35.array(roundSchema)
3575
3638
  });
3576
- var optimizationHandoffSchema = z33.object({
3577
- trialId: z33.string(),
3578
- trialKey: z33.string(),
3579
- prompt: z33.string()
3639
+ var optimizationHandoffSchema = z35.object({
3640
+ trialId: z35.string(),
3641
+ trialKey: z35.string(),
3642
+ prompt: z35.string()
3580
3643
  });
3581
- var listTrialsResponseSchema = z33.object({
3582
- items: z33.array(trialSchema)
3644
+ var listTrialsResponseSchema = z35.object({
3645
+ items: z35.array(trialSchema)
3583
3646
  });
3584
- var trialDocumentSchema = z33.object({
3585
- path: z33.string(),
3586
- before: z33.string(),
3587
- after: z33.string()
3647
+ var trialDocumentSchema = z35.object({
3648
+ path: z35.string(),
3649
+ before: z35.string(),
3650
+ after: z35.string()
3588
3651
  });
3589
- var trialContentSchema = z33.object({
3590
- trialId: z33.string(),
3652
+ var trialContentSchema = z35.object({
3653
+ trialId: z35.string(),
3591
3654
  kind: interventionKindSchema,
3592
- documents: z33.array(trialDocumentSchema),
3655
+ documents: z35.array(trialDocumentSchema),
3593
3656
  /** Full page bodies for a docs rewrite, ready to paste; null otherwise. */
3594
- copyableBody: z33.string().nullable(),
3595
- configSnapshot: z33.unknown()
3657
+ copyableBody: z35.string().nullable(),
3658
+ configSnapshot: z35.unknown()
3596
3659
  });
3597
- var createTrialBodySchema = z33.object({
3660
+ var createTrialBodySchema = z35.object({
3598
3661
  trial: trialInputSchema,
3599
3662
  files: overrideFilesSchema.optional(),
3600
- fork: z33.object({ runId: z33.string().min(1), boundarySeq: z33.string().min(1) }).strict().optional(),
3601
- launch: z33.boolean().default(false),
3663
+ fork: z35.object({ runId: z35.string().min(1), boundarySeq: z35.string().min(1) }).strict().optional(),
3664
+ launch: z35.boolean().default(false),
3602
3665
  /** Replays return the trial the first call created instead of a second
3603
3666
  * one. Scoped to the optimization. */
3604
- idempotencyKey: z33.string().min(1).max(200).optional()
3667
+ idempotencyKey: z35.string().min(1).max(200).optional()
3605
3668
  }).strict();
3606
- var skillFilesResponseSchema = z33.object({
3607
- versionId: z33.string(),
3669
+ var skillFilesResponseSchema = z35.object({
3670
+ versionId: z35.string(),
3608
3671
  files: overrideFilesSchema
3609
3672
  });
3610
- var pageBodyResponseSchema = z33.object({
3611
- url: z33.string(),
3612
- body: z33.string(),
3613
- contentType: z33.string().optional()
3673
+ var pageBodyResponseSchema = z35.object({
3674
+ url: z35.string(),
3675
+ body: z35.string(),
3676
+ contentType: z35.string().optional()
3614
3677
  });
3615
- var launchTrialResponseSchema = z33.object({
3616
- trialId: z33.string(),
3617
- batchIds: z33.array(z33.string()),
3618
- runIds: z33.array(z33.string())
3678
+ var launchTrialResponseSchema = z35.object({
3679
+ trialId: z35.string(),
3680
+ batchIds: z35.array(z35.string()),
3681
+ runIds: z35.array(z35.string())
3619
3682
  });
3620
- var createDraftOptimizationBodySchema = z33.object({
3683
+ var createDraftOptimizationBodySchema = z35.object({
3621
3684
  subjectKind: climbSubjectKindSchema,
3622
- subjectId: z33.string().min(1),
3623
- name: z33.string().trim().min(1).max(200).optional(),
3685
+ subjectId: z35.string().min(1),
3686
+ name: z35.string().trim().min(1).max(200).optional(),
3624
3687
  ...planShape,
3625
3688
  target: targetSchema.optional(),
3626
- autonomous: z33.boolean().optional()
3689
+ autonomous: z35.boolean().optional()
3627
3690
  }).strict().superRefine(refinePlan);
3628
3691
  var planPatchShape = {
3629
- name: z33.string().trim().min(1).max(200).optional(),
3692
+ name: z35.string().trim().min(1).max(200).optional(),
3630
3693
  ...planShape,
3631
3694
  target: targetSchema.optional()
3632
3695
  };
3633
- var optimizationPlanPatchSchema = z33.object(planPatchShape).strict().superRefine(refinePlan);
3634
- var startDraftOptimizationBodySchema = z33.object({
3696
+ var optimizationPlanPatchSchema = z35.object(planPatchShape).strict().superRefine(refinePlan);
3697
+ var startDraftOptimizationBodySchema = z35.object({
3635
3698
  ...planPatchShape,
3636
- creditCap: z33.number().int().nonnegative().optional()
3699
+ creditCap: z35.number().int().nonnegative().optional()
3637
3700
  }).strict().superRefine(refinePlan);
3638
- var setModeBodySchema = z33.object({ autonomous: z33.boolean() }).strict();
3639
- var launchRoundResponseSchema = z33.object({
3640
- roundNumber: z33.number().int().nullable(),
3641
- launched: z33.array(z33.string()),
3701
+ var setModeBodySchema = z35.object({ autonomous: z35.boolean() }).strict();
3702
+ var launchRoundResponseSchema = z35.object({
3703
+ roundNumber: z35.number().int().nullable(),
3704
+ launched: z35.array(z35.string()),
3642
3705
  /** True when nothing was left to launch: someone else got there first. */
3643
- alreadyLaunched: z33.boolean()
3706
+ alreadyLaunched: z35.boolean()
3644
3707
  });
3645
- var resolveChatResponseSchema = z33.object({
3646
- chatId: z33.string(),
3647
- href: z33.string()
3708
+ var resolveChatResponseSchema = z35.object({
3709
+ chatId: z35.string(),
3710
+ href: z35.string()
3648
3711
  });
3649
- var continueOptimizationBodySchema = z33.object({
3650
- rounds: z33.number().int().min(1).max(20).default(1),
3651
- maxTrialsPerRound: z33.number().int().min(1).max(10).optional()
3712
+ var continueOptimizationBodySchema = z35.object({
3713
+ rounds: z35.number().int().min(1).max(20).default(1),
3714
+ maxTrialsPerRound: z35.number().int().min(1).max(10).optional()
3652
3715
  }).strict();
3653
- var patchOptimizationBodySchema = z33.object({
3716
+ var patchOptimizationBodySchema = z35.object({
3654
3717
  ...planPatchShape,
3655
3718
  direction: climbDirectionPatchSchema.optional(),
3656
- autonomous: z33.boolean().optional()
3719
+ autonomous: z35.boolean().optional()
3657
3720
  }).strict().superRefine(refinePlan);
3658
3721
 
3659
3722
  // ../packages/api-schemas/src/orgs.ts
3660
- import { z as z34 } from "zod";
3661
- var createOrgRequestSchema = z34.object({
3723
+ import { z as z36 } from "zod";
3724
+ var createOrgRequestSchema = z36.object({
3662
3725
  /** Workspace display name; the slug is derived server-side. */
3663
- name: z34.string().trim().min(1).max(200),
3726
+ name: z36.string().trim().min(1).max(200),
3664
3727
  /** Optional company site (logo source; stamped onto the org). */
3665
- website: z34.string().trim().max(300).optional()
3728
+ website: z36.string().trim().max(300).optional()
3666
3729
  });
3667
- var createOrgResponseSchema = z34.object({
3668
- slug: z34.string(),
3669
- name: z34.string(),
3730
+ var createOrgResponseSchema = z36.object({
3731
+ slug: z36.string(),
3732
+ name: z36.string(),
3670
3733
  // LOCAL orgs never have a Gauge publicId.
3671
- publicId: z34.string().nullable()
3734
+ publicId: z36.string().nullable()
3672
3735
  });
3673
- var orgSettingsSchema = z34.object({
3674
- slug: z34.string(),
3675
- name: z34.string(),
3676
- publicId: z34.string().nullable(),
3677
- website: z34.string().nullable(),
3736
+ var orgSettingsSchema = z36.object({
3737
+ slug: z36.string(),
3738
+ name: z36.string(),
3739
+ publicId: z36.string().nullable(),
3740
+ website: z36.string().nullable(),
3678
3741
  /** Per-run max-spend override in USD; null = the server default. */
3679
- maxSpendUsd: z34.number().nullable(),
3680
- overageEnabled: z34.boolean(),
3742
+ maxSpendUsd: z36.number().nullable(),
3743
+ overageEnabled: z36.boolean(),
3681
3744
  /** Per-cycle overage cap in credits; null = uncapped. */
3682
- overageCapCredits: z34.number().int().nullable(),
3745
+ overageCapCredits: z36.number().int().nullable(),
3683
3746
  /** Domain claimed for same-domain auto-join; null = off. */
3684
- autoJoinDomain: z34.string().nullable()
3747
+ autoJoinDomain: z36.string().nullable()
3685
3748
  });
3686
- var orgMemberSchema = z34.object({
3687
- userId: z34.string(),
3688
- name: z34.string().nullable(),
3689
- email: z34.string().nullable(),
3690
- joinedAt: z34.string()
3749
+ var orgMemberSchema = z36.object({
3750
+ userId: z36.string(),
3751
+ name: z36.string().nullable(),
3752
+ email: z36.string().nullable(),
3753
+ joinedAt: z36.string()
3691
3754
  });
3692
- var listMembersResponseSchema = z34.object({
3693
- items: z34.array(orgMemberSchema)
3755
+ var listMembersResponseSchema = z36.object({
3756
+ items: z36.array(orgMemberSchema)
3694
3757
  });
3695
3758
 
3696
3759
  // ../packages/api-schemas/src/personas.ts
3697
- import { z as z35 } from "zod";
3698
- var personaSchema = z35.object({
3699
- id: z35.string(),
3700
- name: z35.string(),
3701
- description: z35.string(),
3760
+ import { z as z37 } from "zod";
3761
+ var personaSchema = z37.object({
3762
+ id: z37.string(),
3763
+ name: z37.string(),
3764
+ description: z37.string(),
3702
3765
  /** The judge model this persona calls (Claude only). */
3703
- model: z35.string(),
3704
- createdAt: z35.string(),
3705
- updatedAt: z35.string()
3766
+ model: z37.string(),
3767
+ createdAt: z37.string(),
3768
+ updatedAt: z37.string()
3706
3769
  });
3707
- var listPersonasResponseSchema = z35.object({
3708
- items: z35.array(personaSchema)
3770
+ var listPersonasResponseSchema = z37.object({
3771
+ items: z37.array(personaSchema)
3709
3772
  });
3710
- var createPersonaBodySchema = z35.object({
3711
- name: z35.string().min(1).max(120),
3712
- description: z35.string().min(1)
3773
+ var createPersonaBodySchema = z37.object({
3774
+ name: z37.string().min(1).max(120),
3775
+ description: z37.string().min(1)
3713
3776
  });
3714
- var updatePersonaBodySchema = z35.object({
3715
- name: z35.string().min(1).max(120).optional(),
3716
- description: z35.string().min(1).optional()
3777
+ var updatePersonaBodySchema = z37.object({
3778
+ name: z37.string().min(1).max(120).optional(),
3779
+ description: z37.string().min(1).optional()
3717
3780
  });
3718
3781
 
3719
3782
  // ../packages/api-schemas/src/prompts.ts
3720
- import { z as z38 } from "zod";
3783
+ import { z as z40 } from "zod";
3721
3784
 
3722
3785
  // ../packages/api-schemas/src/tags.ts
3723
- import { z as z36 } from "zod";
3724
- var tagSchema = z36.object({
3725
- id: z36.string(),
3726
- name: z36.string(),
3786
+ import { z as z38 } from "zod";
3787
+ var tagSchema = z38.object({
3788
+ id: z38.string(),
3789
+ name: z38.string(),
3727
3790
  /** A Mantine palette name (e.g. "blue", "grape"); unknown values are
3728
3791
  * normalized server-side to the default ("gray"). */
3729
- color: z36.string()
3792
+ color: z38.string()
3730
3793
  });
3731
- var createTagBodySchema = z36.object({
3732
- name: z36.string().min(1),
3733
- color: z36.string().optional()
3794
+ var createTagBodySchema = z38.object({
3795
+ name: z38.string().min(1),
3796
+ color: z38.string().optional()
3734
3797
  });
3735
- var updateTagBodySchema = z36.object({
3736
- name: z36.string().min(1).optional(),
3737
- color: z36.string().optional()
3798
+ var updateTagBodySchema = z38.object({
3799
+ name: z38.string().min(1).optional(),
3800
+ color: z38.string().optional()
3738
3801
  });
3739
3802
  var tagListResponseSchema = listResponseSchema(tagSchema);
3740
3803
 
3741
3804
  // ../packages/api-schemas/src/topics.ts
3742
- import { z as z37 } from "zod";
3743
- var topicSchema = z37.object({
3744
- id: z37.string(),
3745
- name: z37.string()
3805
+ import { z as z39 } from "zod";
3806
+ var topicSchema = z39.object({
3807
+ id: z39.string(),
3808
+ name: z39.string()
3746
3809
  });
3747
- var createTopicBodySchema = z37.object({
3748
- name: z37.string().min(1, "name is required")
3810
+ var createTopicBodySchema = z39.object({
3811
+ name: z39.string().min(1, "name is required")
3749
3812
  });
3750
3813
  var topicListResponseSchema = listResponseSchema(topicSchema);
3751
3814
 
3752
3815
  // ../packages/api-schemas/src/prompts.ts
3753
- var promptSummarySchema = z38.object({
3754
- id: z38.string(),
3755
- text: z38.string(),
3756
- isBranded: z38.boolean(),
3816
+ var promptSummarySchema = z40.object({
3817
+ id: z40.string(),
3818
+ text: z40.string(),
3819
+ isBranded: z40.boolean(),
3757
3820
  /** Battery-spec identity (idempotent applies); null for UI/CLI-created prompts. */
3758
- externalKey: z38.string().nullable(),
3821
+ externalKey: z40.string().nullable(),
3759
3822
  topic: topicSchema.nullable(),
3760
- tags: z38.array(tagSchema),
3761
- createdAt: z38.string()
3823
+ tags: z40.array(tagSchema),
3824
+ createdAt: z40.string()
3762
3825
  });
3763
3826
  var promptListResponseSchema = listResponseSchema(promptSummarySchema);
3764
3827
  var listPromptsQuerySchema = listQuerySchema.extend({
3765
- topic: z38.string().min(1).optional(),
3766
- tag: z38.string().min(1).optional(),
3767
- q: z38.string().min(1).optional()
3768
- });
3769
- var createPromptBodySchema = z38.object({
3770
- text: z38.string().min(1, "text is required"),
3771
- isBranded: z38.boolean().default(false),
3772
- topic: z38.string().min(1).optional(),
3773
- tags: z38.array(z38.string().min(1)).default([])
3774
- });
3775
- var updatePromptBodySchema = z38.object({
3776
- text: z38.string().min(1).optional(),
3777
- isBranded: z38.boolean().optional(),
3778
- topicId: z38.string().min(1).nullish(),
3779
- tags: z38.array(z38.string().min(1)).optional()
3780
- });
3781
- var runPromptBodySchema = z38.object({
3828
+ topic: z40.string().min(1).optional(),
3829
+ tag: z40.string().min(1).optional(),
3830
+ q: z40.string().min(1).optional()
3831
+ });
3832
+ var createPromptBodySchema = z40.object({
3833
+ text: z40.string().min(1, "text is required"),
3834
+ isBranded: z40.boolean().default(false),
3835
+ topic: z40.string().min(1).optional(),
3836
+ tags: z40.array(z40.string().min(1)).default([])
3837
+ });
3838
+ var updatePromptBodySchema = z40.object({
3839
+ text: z40.string().min(1).optional(),
3840
+ isBranded: z40.boolean().optional(),
3841
+ topicId: z40.string().min(1).nullish(),
3842
+ tags: z40.array(z40.string().min(1)).optional()
3843
+ });
3844
+ var runPromptBodySchema = z40.object({
3782
3845
  /** Preferred paired representation; each agent may pin its own model tiers. */
3783
- agentConfigs: z38.array(agentConfigInputSchema).min(1).optional(),
3846
+ agentConfigs: z40.array(agentConfigInputSchema).min(1).optional(),
3784
3847
  /** Legacy agent set (no per-agent pins), kept during the API transition. */
3785
- agents: z38.array(z38.enum(["CLAUDE_CODE", "CODEX_CLI", "CURSOR"])).min(1, "Select at least one agent").default(["CLAUDE_CODE", "CODEX_CLI"]),
3786
- repoUrl: z38.string().min(1).nullish(),
3787
- repoRef: z38.string().min(1).nullish(),
3788
- samplesPerCycle: z38.number().int().min(1).max(10).default(1),
3848
+ agents: z40.array(z40.enum(["CLAUDE_CODE", "CODEX_CLI", "CURSOR"])).min(1, "Select at least one agent").default(["CLAUDE_CODE", "CODEX_CLI"]),
3849
+ repoUrl: z40.string().min(1).nullish(),
3850
+ repoRef: z40.string().min(1).nullish(),
3851
+ samplesPerCycle: z40.number().int().min(1).max(10).default(1),
3789
3852
  webFixture: webFixtureSchema.optional()
3790
3853
  });
3791
- var runPromptResponseSchema = z38.object({
3792
- batchIds: z38.array(z38.string()),
3793
- runIds: z38.array(z38.string()),
3794
- blocked: z38.enum(["insufficient_credits", "needs_provider_key"]).optional()
3854
+ var runPromptResponseSchema = z40.object({
3855
+ batchIds: z40.array(z40.string()),
3856
+ runIds: z40.array(z40.string()),
3857
+ blocked: z40.enum(["insufficient_credits", "needs_provider_key"]).optional()
3795
3858
  });
3796
3859
 
3797
3860
  // ../packages/api-schemas/src/repos.ts
3798
- import { z as z39 } from "zod";
3861
+ import { z as z41 } from "zod";
3799
3862
  var REPO_SIZE_BUCKETS = [
3800
3863
  "small",
3801
3864
  "medium",
3802
3865
  "large",
3803
3866
  "xlarge"
3804
3867
  ];
3805
- var repoSizeBucketSchema = z39.enum(REPO_SIZE_BUCKETS);
3806
- var repoSchema = z39.object({
3807
- url: z39.string(),
3808
- name: z39.string(),
3809
- isSystem: z39.boolean(),
3810
- languages: z39.array(z39.string()),
3811
- frameworks: z39.array(z39.string()),
3868
+ var repoSizeBucketSchema = z41.enum(REPO_SIZE_BUCKETS);
3869
+ var repoSchema = z41.object({
3870
+ url: z41.string(),
3871
+ name: z41.string(),
3872
+ isSystem: z41.boolean(),
3873
+ languages: z41.array(z41.string()),
3874
+ frameworks: z41.array(z41.string()),
3812
3875
  /** Faceted labels (complexity:L2, buildable:yes, stack:nextjs, …). */
3813
- tags: z39.array(z39.string()),
3814
- primaryLanguage: z39.string(),
3815
- sizeKb: z39.number(),
3876
+ tags: z41.array(z41.string()),
3877
+ primaryLanguage: z41.string(),
3878
+ sizeKb: z41.number(),
3816
3879
  sizeBucket: repoSizeBucketSchema.nullable(),
3817
- stars: z39.number()
3880
+ stars: z41.number()
3818
3881
  });
3819
3882
  var repoListResponseSchema = listResponseSchema(repoSchema);
3820
- var addRepoBodySchema = z39.object({
3821
- url: z39.string().min(1, "url is required"),
3883
+ var addRepoBodySchema = z41.object({
3884
+ url: z41.string().min(1, "url is required"),
3822
3885
  /**
3823
3886
  * Reserved (accepted, not yet persisted): the catalog keys repos by URL only
3824
3887
  * — `fact_repo` has no ref column and metadata sync always reads the default
3825
3888
  * branch. Kept in the wire format so `gauge repos add --ref` is stable once
3826
3889
  * the catalog learns refs.
3827
3890
  */
3828
- ref: z39.string().min(1).optional(),
3891
+ ref: z41.string().min(1).optional(),
3829
3892
  /** Display name; defaults to the `owner/repo` label of the URL. */
3830
- name: z39.string().min(1).optional(),
3893
+ name: z41.string().min(1).optional(),
3831
3894
  /** Manual override; defaults to frameworks detected from the repo's manifests. */
3832
- frameworks: z39.array(z39.string()).optional(),
3833
- tags: z39.array(z39.string()).optional()
3895
+ frameworks: z41.array(z41.string()).optional(),
3896
+ tags: z41.array(z41.string()).optional()
3834
3897
  });
3835
- var updateRepoBodySchema = z39.object({
3836
- url: z39.string().min(1, "url is required"),
3837
- name: z39.string().min(1).optional(),
3838
- frameworks: z39.array(z39.string()).optional(),
3839
- tags: z39.array(z39.string()).optional()
3898
+ var updateRepoBodySchema = z41.object({
3899
+ url: z41.string().min(1, "url is required"),
3900
+ name: z41.string().min(1).optional(),
3901
+ frameworks: z41.array(z41.string()).optional(),
3902
+ tags: z41.array(z41.string()).optional()
3840
3903
  });
3841
- var resyncRepoBodySchema = z39.object({
3842
- url: z39.string().min(1, "url is required")
3904
+ var resyncRepoBodySchema = z41.object({
3905
+ url: z41.string().min(1, "url is required")
3843
3906
  });
3844
- var deleteRepoQuerySchema = z39.object({
3845
- url: z39.string().min(1, "url is required")
3907
+ var deleteRepoQuerySchema = z41.object({
3908
+ url: z41.string().min(1, "url is required")
3846
3909
  });
3847
- var repoSyncResultSchema = z39.object({
3910
+ var repoSyncResultSchema = z41.object({
3848
3911
  repo: repoSchema,
3849
- synced: z39.boolean()
3912
+ synced: z41.boolean()
3850
3913
  });
3851
3914
 
3852
3915
  // ../packages/api-schemas/src/runAddons.ts
3853
- import { z as z40 } from "zod";
3854
- var runAddonsSchema = z40.object({
3855
- browser: z40.object({
3856
- session: z40.string().min(1),
3857
- projectId: z40.number().int().positive(),
3858
- region: z40.literal("us").default("us")
3916
+ import { z as z42 } from "zod";
3917
+ var runAddonsSchema = z42.object({
3918
+ browser: z42.object({
3919
+ session: z42.string().min(1),
3920
+ projectId: z42.number().int().positive(),
3921
+ region: z42.literal("us").default("us")
3859
3922
  }).strict().optional()
3860
3923
  }).strict();
3861
3924
 
3862
3925
  // ../packages/api-schemas/src/runDefinitions.ts
3863
- import { z as z44 } from "zod";
3926
+ import { z as z46 } from "zod";
3864
3927
 
3865
3928
  // ../packages/api-schemas/src/preference.ts
3866
- import { z as z41 } from "zod";
3867
- var preferenceDefinitionSchema = z41.discriminatedUnion("kind", [
3868
- z41.object({
3869
- kind: z41.literal("open-ended"),
3870
- branded: z41.boolean().default(false)
3929
+ import { z as z43 } from "zod";
3930
+ var preferenceDefinitionSchema = z43.discriminatedUnion("kind", [
3931
+ z43.object({
3932
+ kind: z43.literal("open-ended"),
3933
+ branded: z43.boolean().default(false)
3871
3934
  }).strict(),
3872
- z41.object({
3873
- kind: z41.literal("head-to-head"),
3874
- brandA: z41.string().trim().min(1),
3875
- brandB: z41.string().trim().min(1)
3935
+ z43.object({
3936
+ kind: z43.literal("head-to-head"),
3937
+ brandA: z43.string().trim().min(1),
3938
+ brandB: z43.string().trim().min(1)
3876
3939
  }).strict().refine(
3877
3940
  (p) => p.brandA.toLowerCase() !== p.brandB.toLowerCase(),
3878
3941
  "A head-to-head needs two different brands"
3879
3942
  )
3880
3943
  ]);
3881
- var preferenceSnapshotSchema = z41.object({ version: z41.literal(1), preference: preferenceDefinitionSchema }).strict();
3882
- var headToHeadSchema = z41.object({
3883
- kind: z41.literal("HEAD_TO_HEAD"),
3884
- winner: z41.enum(["A", "B", "neither"]),
3885
- brandA: z41.string(),
3886
- brandB: z41.string(),
3887
- rationale: z41.string(),
3888
- brandAReasoning: z41.string(),
3889
- brandBReasoning: z41.string(),
3890
- brandAWhyRaised: z41.string().optional(),
3891
- brandBWhyRaised: z41.string().optional()
3892
- });
3893
- var recommendPickSchema = z41.object({
3894
- brand: z41.string(),
3895
- rank: z41.number().int(),
3896
- adopted: z41.boolean(),
3897
- reasoning: z41.string().optional(),
3898
- whyRaised: z41.string().optional()
3899
- });
3900
- var recommendSchema = z41.object({
3901
- kind: z41.literal("RECOMMEND"),
3902
- picks: z41.array(recommendPickSchema).default([]),
3903
- singlePick: z41.boolean(),
3904
- complianceNote: z41.string()
3905
- });
3906
- var visibilityVerdictSchema = z41.discriminatedUnion("kind", [
3944
+ var preferenceSnapshotSchema = z43.object({ version: z43.literal(1), preference: preferenceDefinitionSchema }).strict();
3945
+ var headToHeadSchema = z43.object({
3946
+ kind: z43.literal("HEAD_TO_HEAD"),
3947
+ winner: z43.enum(["A", "B", "neither"]),
3948
+ brandA: z43.string(),
3949
+ brandB: z43.string(),
3950
+ rationale: z43.string(),
3951
+ brandAReasoning: z43.string(),
3952
+ brandBReasoning: z43.string(),
3953
+ brandAWhyRaised: z43.string().optional(),
3954
+ brandBWhyRaised: z43.string().optional()
3955
+ });
3956
+ var recommendPickSchema = z43.object({
3957
+ brand: z43.string(),
3958
+ rank: z43.number().int(),
3959
+ adopted: z43.boolean(),
3960
+ reasoning: z43.string().optional(),
3961
+ whyRaised: z43.string().optional()
3962
+ });
3963
+ var recommendSchema = z43.object({
3964
+ kind: z43.literal("RECOMMEND"),
3965
+ picks: z43.array(recommendPickSchema).default([]),
3966
+ singlePick: z43.boolean(),
3967
+ complianceNote: z43.string()
3968
+ });
3969
+ var visibilityVerdictSchema = z43.discriminatedUnion("kind", [
3907
3970
  headToHeadSchema,
3908
3971
  recommendSchema
3909
3972
  ]);
@@ -3916,59 +3979,59 @@ function preferenceSelectionLabel(verdict) {
3916
3979
  }
3917
3980
 
3918
3981
  // ../packages/api-schemas/src/runDefinitionInputs.ts
3919
- import { z as z43 } from "zod";
3982
+ import { z as z45 } from "zod";
3920
3983
 
3921
3984
  // ../packages/api-schemas/src/runPlan.ts
3922
- import { z as z42 } from "zod";
3923
- var runPlanCriterionSchema = z42.object({
3924
- id: z42.string().min(1),
3925
- name: z42.string(),
3926
- rubric: z42.string()
3985
+ import { z as z44 } from "zod";
3986
+ var runPlanCriterionSchema = z44.object({
3987
+ id: z44.string().min(1),
3988
+ name: z44.string(),
3989
+ rubric: z44.string()
3927
3990
  });
3928
- var criteriaSnapshotV1Schema = z42.object({
3929
- version: z42.literal(1),
3991
+ var criteriaSnapshotV1Schema = z44.object({
3992
+ version: z44.literal(1),
3930
3993
  // File-authored criteria have no saved EvalSet; their identity is frozen
3931
3994
  // in the request and result rows retain the criterion text without an FK.
3932
- evalSetId: z42.string().min(1).nullable(),
3933
- criteria: z42.array(runPlanCriterionSchema)
3934
- });
3935
- var runPlanCaseSchema = z42.object({
3936
- id: z42.string().min(1),
3937
- prompt: z42.object({ id: z42.string().min(1), text: z42.string() }),
3938
- workspace: z42.object({
3939
- repoUrl: z42.string().nullable(),
3940
- repoRef: z42.string().nullable()
3995
+ evalSetId: z44.string().min(1).nullable(),
3996
+ criteria: z44.array(runPlanCriterionSchema)
3997
+ });
3998
+ var runPlanCaseSchema = z44.object({
3999
+ id: z44.string().min(1),
4000
+ prompt: z44.object({ id: z44.string().min(1), text: z44.string() }),
4001
+ workspace: z44.object({
4002
+ repoUrl: z44.string().nullable(),
4003
+ repoRef: z44.string().nullable()
3941
4004
  }),
3942
- agents: z42.array(
4005
+ agents: z44.array(
3943
4006
  agentConfigSchema.extend({
3944
4007
  // Validated against the current catalog request schema when lowered.
3945
- catalogSelections: z42.record(z42.string(), z42.unknown()).optional()
4008
+ catalogSelections: z44.record(z44.string(), z44.unknown()).optional()
3946
4009
  })
3947
4010
  ),
3948
- samples: z42.number().int().min(1).max(50),
3949
- evalSetId: z42.string().min(1).optional(),
4011
+ samples: z44.number().int().min(1).max(50),
4012
+ evalSetId: z44.string().min(1).optional(),
3950
4013
  criteriaSnapshot: criteriaSnapshotV1Schema.optional(),
3951
4014
  preferenceSnapshot: preferenceSnapshotSchema.optional(),
3952
- sourceRepoCommit: z42.string().nullable().optional(),
3953
- experiment: z42.string().nullable().optional(),
3954
- membershipTagIds: z42.array(z42.string()).optional(),
3955
- profile: z42.object({
3956
- id: z42.string(),
3957
- name: z42.string(),
3958
- description: z42.string(),
3959
- model: z42.string()
4015
+ sourceRepoCommit: z44.string().nullable().optional(),
4016
+ experiment: z44.string().nullable().optional(),
4017
+ membershipTagIds: z44.array(z44.string()).optional(),
4018
+ profile: z44.object({
4019
+ id: z44.string(),
4020
+ name: z44.string(),
4021
+ description: z44.string(),
4022
+ model: z44.string()
3960
4023
  }).nullable().optional(),
3961
4024
  skillSet: skillSetSchema.optional(),
3962
4025
  mcpSet: mcpSetSchema.optional(),
3963
4026
  connectionSet: connectionSetSchema.optional(),
3964
4027
  // The server's agentContextSnapshotV1Schema validates this at lowering.
3965
- agentContext: z42.unknown().optional(),
3966
- agentContextDigest: z42.string().nullable().optional(),
4028
+ agentContext: z44.unknown().optional(),
4029
+ agentContextDigest: z44.string().nullable().optional(),
3967
4030
  addons: runAddonsSchema.optional(),
3968
4031
  /** Names of resources the coordinator must prepare before expansion. */
3969
- inputs: z42.array(z42.string().min(1)).default([])
4032
+ inputs: z44.array(z44.string().min(1)).default([])
3970
4033
  });
3971
- var inputPathSchema = z42.string().min(1).max(256).regex(
4034
+ var inputPathSchema = z44.string().min(1).max(256).regex(
3972
4035
  // biome-ignore lint/suspicious/noControlCharactersInRegex: Reject unsafe control characters in authored paths.
3973
4036
  /^(?![!/])(?!.*[\\\x00-\x1f\x7f])(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*\/\/)(?!.*\/$).+$/,
3974
4037
  "Expected a repository-relative path or glob without traversal"
@@ -4003,20 +4066,20 @@ var reservedBinaryCommands = [
4003
4066
  "pi",
4004
4067
  "wizard"
4005
4068
  ];
4006
- var binaryCommandSchema = z42.string().max(128).regex(
4069
+ var binaryCommandSchema = z44.string().max(128).regex(
4007
4070
  /^[A-Za-z0-9_][A-Za-z0-9_.+-]*$/,
4008
4071
  "Expected a command name without paths or shell syntax"
4009
4072
  ).refine(
4010
4073
  (name) => !reservedBinaryCommands.includes(name),
4011
4074
  "Command is reserved for Gauge workspace setup or the agent harness; choose another command name"
4012
4075
  );
4013
- var binaryUseSchema = z42.object({
4014
- type: z42.literal("binary"),
4015
- paths: z42.array(inputPathSchema).min(1).max(32),
4016
- platform: z42.literal("linux-x64").describe(
4076
+ var binaryUseSchema = z44.object({
4077
+ type: z44.literal("binary"),
4078
+ paths: z44.array(inputPathSchema).min(1).max(32),
4079
+ platform: z44.literal("linux-x64").describe(
4017
4080
  "Linux x86-64 ELF executables compatible with the consumer sandbox. No system packages are installed."
4018
4081
  ),
4019
- commands: z42.record(
4082
+ commands: z44.record(
4020
4083
  binaryCommandSchema,
4021
4084
  inputPathSchema.regex(
4022
4085
  /^[^*?{}[\]]+$/,
@@ -4027,111 +4090,118 @@ var binaryUseSchema = z42.object({
4027
4090
  "Declare between 1 and 32 commands"
4028
4091
  ).meta({ minProperties: 1, maxProperties: 32 })
4029
4092
  }).strict();
4030
- var inputUseSchema = z42.discriminatedUnion("type", [
4093
+ var inputUseSchema = z44.discriminatedUnion("type", [
4031
4094
  binaryUseSchema,
4032
4095
  websiteUseSchema,
4033
- z42.object({
4034
- type: z42.literal("files"),
4035
- paths: z42.array(inputPathSchema).min(1).max(32).optional()
4096
+ z44.object({
4097
+ type: z44.literal("files"),
4098
+ paths: z44.array(inputPathSchema).min(1).max(32).optional()
4036
4099
  }).strict(),
4037
- z42.object({
4038
- type: z42.literal("npm-cli"),
4100
+ z44.object({
4101
+ type: z44.literal("npm-cli"),
4039
4102
  package: inputPathSchema,
4040
- install: z42.enum(["environment", "workspace"]).optional()
4103
+ install: z44.enum(["environment", "workspace"]).optional()
4041
4104
  }).strict(),
4042
- z42.object({
4043
- type: z42.literal("npm-package"),
4105
+ z44.object({
4106
+ type: z44.literal("npm-package"),
4044
4107
  package: inputPathSchema,
4045
- install: z42.enum(["environment", "workspace"]).optional()
4108
+ install: z44.enum(["environment", "workspace"]).optional()
4046
4109
  }).strict(),
4047
- z42.object({
4048
- type: z42.literal("skill"),
4049
- root: z42.union([z42.literal("."), inputPathSchema]).refine(
4110
+ z44.object({
4111
+ type: z44.literal("skill"),
4112
+ root: z44.union([z44.literal("."), inputPathSchema]).refine(
4050
4113
  (path3) => !/[*?{}[\]]/.test(path3),
4051
4114
  "Skill root must be an explicit directory"
4052
4115
  )
4053
4116
  }).strict()
4054
4117
  ]);
4055
- var inputSourceSchema = z42.discriminatedUnion("type", [
4056
- z42.object({
4057
- type: z42.literal("git"),
4058
- paths: z42.array(inputPathSchema).min(1).max(32)
4118
+ var inputSourceSchema = z44.discriminatedUnion("type", [
4119
+ z44.object({
4120
+ type: z44.literal("git"),
4121
+ paths: z44.array(inputPathSchema).min(1).max(32)
4059
4122
  }).strict(),
4060
- z42.object({
4061
- type: z42.literal("github-actions"),
4123
+ z44.object({
4124
+ type: z44.literal("github-actions"),
4062
4125
  // Omit to discover the sole artifact from the selected workflow run.
4063
4126
  // Names are supplied by CI and need not encode the PR head revision.
4064
- artifact: z42.string().min(1).max(256).optional()
4127
+ artifact: z44.string().min(1).max(256).optional()
4065
4128
  }).strict()
4066
4129
  ]);
4067
- var runPlanResourceSchema = z42.object({
4068
- name: z42.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
4069
- type: z42.literal("input"),
4070
- source: z42.discriminatedUnion("type", [
4130
+ var runPlanResourceSchema = z44.object({
4131
+ name: z44.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
4132
+ type: z44.literal("input"),
4133
+ source: z44.discriminatedUnion("type", [
4134
+ z44.object({
4135
+ type: z44.literal("upload"),
4136
+ sha256: z44.string().regex(/^sha256:[a-f0-9]{64}$/),
4137
+ bytes: z44.number().int().positive().max(512 * 1024 * 1024),
4138
+ repoUrl: z44.string().nullable(),
4139
+ commit: z44.string().regex(/^[a-f0-9]{40}$/i).nullable()
4140
+ }).strict(),
4071
4141
  commentSourceSchema.extend({
4072
- repoUrl: z42.string(),
4073
- commit: z42.string().regex(/^[a-f0-9]{40}$/i)
4142
+ repoUrl: z44.string(),
4143
+ commit: z44.string().regex(/^[a-f0-9]{40}$/i)
4074
4144
  }).strict(),
4075
4145
  deploymentSourceSchema.extend({
4076
- repoUrl: z42.string(),
4077
- commit: z42.string().regex(/^[a-f0-9]{40}$/i)
4146
+ repoUrl: z44.string(),
4147
+ commit: z44.string().regex(/^[a-f0-9]{40}$/i)
4078
4148
  }).strict(),
4079
4149
  inputSourceSchema.options[0].extend({
4080
- repoUrl: z42.string(),
4081
- commit: z42.string().regex(/^[a-f0-9]{40}$/i)
4150
+ repoUrl: z44.string(),
4151
+ commit: z44.string().regex(/^[a-f0-9]{40}$/i)
4082
4152
  }).strict(),
4083
4153
  inputSourceSchema.options[1].extend({
4084
- repoUrl: z42.string(),
4085
- commit: z42.string().regex(/^[a-f0-9]{40}$/i),
4154
+ repoUrl: z44.string(),
4155
+ commit: z44.string().regex(/^[a-f0-9]{40}$/i),
4086
4156
  workflow: inputPathSchema
4087
4157
  }).strict()
4088
4158
  ]),
4089
4159
  use: inputUseSchema
4090
4160
  }).strict().refine(
4091
4161
  (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 git or Actions"
4162
+ "Website inputs require a deployment or PR comment source; file inputs require Git, Actions, or an upload"
4093
4163
  );
4094
- var runPlanSchema = z42.object({
4095
- version: z42.literal(1),
4164
+ var runPlanSchema = z44.object({
4165
+ version: z44.literal(1),
4096
4166
  /** Existing launches keep their current measurement semantics. */
4097
- measurementMode: z42.enum([
4167
+ measurementMode: z44.enum([
4098
4168
  "EXISTING",
4099
4169
  "AGENT_EXPERIENCE",
4100
4170
  "AGENT_PREFERENCE",
4101
4171
  "MIXED"
4102
4172
  ]),
4103
- cases: z42.array(runPlanCaseSchema).min(1),
4104
- resources: z42.array(runPlanResourceSchema).default([]),
4173
+ cases: z44.array(runPlanCaseSchema).min(1),
4174
+ resources: z44.array(runPlanResourceSchema).default([]),
4105
4175
  /** Server-populated context retained across deferred preparation. */
4106
- launch: z42.object({
4107
- origin: z42.discriminatedUnion("initiator", [
4108
- z42.object({
4109
- initiator: z42.literal("API"),
4110
- userId: z42.string().min(1),
4111
- email: z42.string().nullable()
4176
+ launch: z44.object({
4177
+ origin: z44.discriminatedUnion("initiator", [
4178
+ z44.object({
4179
+ initiator: z44.literal("API"),
4180
+ userId: z44.string().min(1),
4181
+ email: z44.string().nullable()
4112
4182
  }).strict(),
4113
- z42.object({
4114
- initiator: z42.literal("GITHUB"),
4115
- userId: z42.null(),
4116
- email: z42.null()
4183
+ z44.object({
4184
+ initiator: z44.literal("GITHUB"),
4185
+ userId: z44.null(),
4186
+ email: z44.null()
4117
4187
  }).strict()
4118
4188
  ]),
4119
- funding: z42.enum(["ORG", "PLATFORM"]),
4120
- queueClass: z42.literal("INTERACTIVE")
4189
+ funding: z44.enum(["ORG", "PLATFORM"]),
4190
+ queueClass: z44.literal("INTERACTIVE")
4121
4191
  }).strict().optional(),
4122
- provenance: z42.object({
4123
- definition: z42.object({
4124
- repoUrl: z42.string().min(1),
4125
- commit: z42.string().regex(/^[a-f0-9]{40}$/i),
4126
- digest: z42.string().min(1),
4192
+ provenance: z44.object({
4193
+ definition: z44.object({
4194
+ repoUrl: z44.string().min(1).nullable(),
4195
+ commit: z44.string().regex(/^[a-f0-9]{40}$/i).nullable(),
4196
+ digest: z44.string().min(1),
4127
4197
  /** File submissions are asserted by the caller until server-side
4128
4198
  * committed-byte fetching is available. */
4129
- verification: z42.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED"]).optional()
4199
+ verification: z44.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED", "LOCAL"]).optional()
4130
4200
  }).optional(),
4131
- liveDependencies: z42.array(
4132
- z42.object({
4133
- name: z42.string().min(1),
4134
- url: z42.string().url().optional()
4201
+ liveDependencies: z44.array(
4202
+ z44.object({
4203
+ name: z44.string().min(1),
4204
+ url: z44.string().url().optional()
4135
4205
  })
4136
4206
  ).default([])
4137
4207
  })
@@ -4203,43 +4273,43 @@ var runPlanSchema = z42.object({
4203
4273
  });
4204
4274
 
4205
4275
  // ../packages/api-schemas/src/runDefinitionInputs.ts
4206
- var definitionInputSourceSchema = z43.discriminatedUnion("type", [
4207
- z43.object({ type: z43.literal("git") }).strict(),
4208
- z43.object({
4209
- type: z43.literal("github-actions"),
4276
+ var definitionInputSourceSchema = z45.discriminatedUnion("type", [
4277
+ z45.object({ type: z45.literal("git") }).strict(),
4278
+ z45.object({
4279
+ type: z45.literal("github-actions"),
4210
4280
  workflow: inputPathSchema.regex(/^\.github\/workflows\/[^/*?{}[\]]+\.ya?ml$/).describe(
4211
4281
  "Workflow file in this repository, for example .github/workflows/build.yml."
4212
4282
  ),
4213
- artifact: z43.string().min(1).max(256).optional().describe(
4283
+ artifact: z45.string().min(1).max(256).optional().describe(
4214
4284
  "Upload name or pattern. Omit only when the workflow produces exactly one artifact."
4215
4285
  )
4216
4286
  }).strict()
4217
4287
  ]);
4218
- var skillInputPathSchema = z43.union([z43.literal("."), inputPathSchema.regex(/^[^*?{}[\]]+$/)]).describe(
4288
+ var skillInputPathSchema = z45.union([z45.literal("."), inputPathSchema.regex(/^[^*?{}[\]]+$/)]).describe(
4219
4289
  "Explicit Skill directory or ZIP/tar.gz file containing SKILL.md at its root."
4220
4290
  );
4221
- var runDefinitionInputSchema = z43.discriminatedUnion("type", [
4222
- binaryUseSchema.extend({ source: definitionInputSourceSchema }).strict(),
4291
+ var runDefinitionInputSchema = z45.discriminatedUnion("type", [
4292
+ binaryUseSchema.extend({ source: definitionInputSourceSchema.default({ type: "git" }) }).strict(),
4223
4293
  websiteUseSchema.extend({ source: websiteSourceSchema }).strict(),
4224
- z43.object({
4225
- type: z43.literal("npm-package"),
4226
- source: definitionInputSourceSchema,
4294
+ z45.object({
4295
+ type: z45.literal("npm-package"),
4296
+ source: definitionInputSourceSchema.default({ type: "git" }),
4227
4297
  path: inputPathSchema.describe(
4228
4298
  "Path or glob selecting exactly one packed npm .tgz file."
4229
4299
  ),
4230
- install: z43.enum(["environment", "workspace"]).default("environment").describe(
4300
+ install: z45.enum(["environment", "workspace"]).default("environment").describe(
4231
4301
  "environment exposes the package's commands on PATH; workspace adds a consumer application dependency."
4232
4302
  )
4233
4303
  }).strict(),
4234
- z43.object({
4235
- type: z43.literal("skill"),
4236
- source: definitionInputSourceSchema,
4304
+ z45.object({
4305
+ type: z45.literal("skill"),
4306
+ source: definitionInputSourceSchema.default({ type: "git" }),
4237
4307
  path: skillInputPathSchema
4238
4308
  }).strict(),
4239
- z43.object({
4240
- type: z43.literal("files"),
4241
- source: definitionInputSourceSchema,
4242
- paths: z43.array(inputPathSchema).min(1).max(32).describe(
4309
+ z45.object({
4310
+ type: z45.literal("files"),
4311
+ source: definitionInputSourceSchema.default({ type: "git" }),
4312
+ paths: z45.array(inputPathSchema).min(1).max(32).describe(
4243
4313
  "Files or globs selected from the committed Git tree or the uploaded artifact."
4244
4314
  )
4245
4315
  }).strict()
@@ -4273,7 +4343,11 @@ function compileDefinitionInput(name, input, repoUrl, commit) {
4273
4343
  }
4274
4344
 
4275
4345
  // ../packages/api-schemas/src/runDefinitions.ts
4276
- var uncredentialedRepoUrlSchema = z44.string().min(1).refine((raw) => {
4346
+ var inputUploadSpecSchema = z46.object({
4347
+ sha256: z46.string().regex(/^sha256:[a-f0-9]{64}$/),
4348
+ bytes: z46.number().int().positive().max(512 * 1024 * 1024)
4349
+ }).strict();
4350
+ var uncredentialedRepoUrlSchema = z46.string().min(1).refine((raw) => {
4277
4351
  if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(raw)) return true;
4278
4352
  try {
4279
4353
  const url = new URL(raw);
@@ -4282,68 +4356,84 @@ var uncredentialedRepoUrlSchema = z44.string().min(1).refine((raw) => {
4282
4356
  return false;
4283
4357
  }
4284
4358
  }, "Repository URL must not contain embedded credentials or query parameters");
4285
- var runDefinitionChecksSchema = z44.object({ paths: z44.array(inputPathSchema).min(1).max(32) }).strict();
4286
- var runDefinitionConfigSchema = z44.object({
4287
- agents: z44.array(agentConfigInputSchema).min(1),
4288
- sampleCount: z44.number().int().min(1).max(50).optional(),
4359
+ var runDefinitionChecksSchema = z46.object({ paths: z46.array(inputPathSchema).min(1).max(32) }).strict();
4360
+ var runDefinitionConfigSchema = z46.object({
4361
+ agents: z46.array(agentConfigInputSchema).min(1),
4362
+ sampleCount: z46.number().int().min(1).max(50).optional(),
4289
4363
  repoUrl: uncredentialedRepoUrlSchema.nullable().optional(),
4290
- repoRef: z44.string().min(1).nullable().optional(),
4291
- profileId: z44.string().min(1).nullable().optional(),
4364
+ repoRef: z46.string().min(1).nullable().optional(),
4365
+ profileId: z46.string().min(1).nullable().optional(),
4292
4366
  skillRefs: assetRefListSchema.optional(),
4293
4367
  mcpRefs: assetRefListSchema.optional(),
4294
- connectionIds: z44.array(z44.string().min(1)).max(32).optional(),
4368
+ connectionIds: z46.array(z46.string().min(1)).max(32).optional(),
4295
4369
  addons: runAddonsSchema.optional(),
4296
- inputs: z44.array(z44.string()).optional(),
4370
+ inputs: z46.array(z46.string()).optional(),
4297
4371
  checks: runDefinitionChecksSchema.optional()
4298
4372
  }).strict();
4299
- var runDefinitionFileConfigSchema = z44.object({
4300
- version: z44.literal(2).default(2),
4301
- org: z44.string().min(1).optional(),
4373
+ var runDefinitionFileConfigSchema = z46.object({
4374
+ version: z46.literal(2).default(2),
4375
+ org: z46.string().min(1).optional(),
4302
4376
  checks: runDefinitionChecksSchema.optional(),
4303
- cases: z44.array(inputPathSchema).min(1).max(32).default(["gauge-evals/**/*.md"]),
4304
- inputs: z44.record(
4305
- z44.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
4377
+ cases: z46.array(inputPathSchema).min(1).max(32).default(["gauge-evals/**/*.md"]),
4378
+ inputs: z46.record(
4379
+ z46.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
4306
4380
  runDefinitionInputSchema
4307
4381
  ).refine(
4308
4382
  (inputs) => Object.keys(inputs).length <= 32,
4309
4383
  "At most 32 inputs are allowed"
4310
4384
  ).meta({ maxProperties: 32 }).default({})
4311
4385
  }).strict();
4312
- var runDefinitionCriterionSchema = z44.object({ name: z44.string().min(1), rubric: z44.string().min(1) }).strict();
4386
+ var runDefinitionCriterionSchema = z46.object({ name: z46.string().min(1), rubric: z46.string().min(1) }).strict();
4313
4387
  var caseMeasurement = {
4314
- criteria: z44.array(runDefinitionCriterionSchema).min(1).optional(),
4388
+ criteria: z46.array(runDefinitionCriterionSchema).min(1).optional(),
4315
4389
  preference: preferenceDefinitionSchema.optional()
4316
4390
  };
4317
4391
  function exactlyOneMeasurement(item) {
4318
4392
  return item.criteria !== void 0 !== (item.preference !== void 0);
4319
4393
  }
4320
- var runDefinitionFrontmatterSchema = z44.object({
4394
+ var runDefinitionFrontmatterSchema = z46.object({
4321
4395
  ...caseMeasurement,
4322
4396
  config: runDefinitionConfigSchema
4323
4397
  }).strict().refine(
4324
4398
  exactlyOneMeasurement,
4325
4399
  "Specify exactly one of criteria or preference"
4326
4400
  );
4327
- var runDefinitionCaseSchema = z44.object({
4328
- path: z44.string().min(1),
4329
- prompt: z44.string().min(1),
4401
+ var runDefinitionCaseSchema = z46.object({
4402
+ path: z46.string().min(1),
4403
+ prompt: z46.string().min(1),
4330
4404
  ...caseMeasurement,
4331
4405
  config: runDefinitionConfigSchema
4332
4406
  }).strict().refine(
4333
4407
  exactlyOneMeasurement,
4334
4408
  "Specify exactly one of criteria or preference"
4335
4409
  );
4336
- var runDefinitionSubmissionSchema = z44.object({
4337
- version: z44.literal(2),
4338
- source: z44.object({
4339
- repoUrl: uncredentialedRepoUrlSchema,
4340
- commit: z44.string().regex(/^[a-f0-9]{40}$/i),
4341
- digest: z44.string().regex(/^sha256:[a-f0-9]{64}$/),
4342
- verification: z44.enum(["SUBMITTED_UNVERIFIED", "GITHUB_VERIFIED"])
4410
+ var runDefinitionSubmissionSchema = z46.object({
4411
+ version: z46.literal(2),
4412
+ source: z46.object({
4413
+ repoUrl: uncredentialedRepoUrlSchema.nullable(),
4414
+ commit: z46.string().regex(/^[a-f0-9]{40}$/i).nullable(),
4415
+ digest: z46.string().regex(/^sha256:[a-f0-9]{64}$/),
4416
+ verification: z46.enum([
4417
+ "SUBMITTED_UNVERIFIED",
4418
+ "GITHUB_VERIFIED",
4419
+ "LOCAL"
4420
+ ])
4343
4421
  }).strict(),
4344
- resources: z44.array(runPlanResourceSchema).max(32).default([]),
4345
- cases: z44.array(runDefinitionCaseSchema).min(1).max(20)
4422
+ resources: z46.array(runPlanResourceSchema).max(32).default([]),
4423
+ cases: z46.array(runDefinitionCaseSchema).min(1).max(20)
4346
4424
  }).strict().superRefine((definition, ctx) => {
4425
+ if (definition.source.verification !== "LOCAL" && (!definition.source.repoUrl || !definition.source.commit))
4426
+ ctx.addIssue({
4427
+ code: "custom",
4428
+ path: ["source"],
4429
+ message: "Committed definitions require a repository and commit"
4430
+ });
4431
+ if (definition.source.verification === "GITHUB_VERIFIED" && definition.resources.some((r) => r.source.type === "upload"))
4432
+ ctx.addIssue({
4433
+ code: "custom",
4434
+ path: ["resources"],
4435
+ message: "GitHub definitions cannot contain uploaded inputs"
4436
+ });
4347
4437
  const paths = /* @__PURE__ */ new Set();
4348
4438
  for (const [index, item] of definition.cases.entries()) {
4349
4439
  if (paths.has(item.path))
@@ -4379,61 +4469,62 @@ var runDefinitionSubmissionSchema = z44.object({
4379
4469
  }
4380
4470
  });
4381
4471
  var runDefinitionPublicSubmissionSchema = runDefinitionSubmissionSchema.refine(
4382
- (definition) => definition.source.verification === "SUBMITTED_UNVERIFIED",
4472
+ (definition) => definition.source.verification !== "GITHUB_VERIFIED",
4383
4473
  {
4384
4474
  path: ["source", "verification"],
4385
4475
  message: "Only the GitHub App may verify committed bytes"
4386
4476
  }
4387
4477
  );
4388
- var runDefinitionPlanResponseSchema = z44.object({
4478
+ var runDefinitionPlanResponseSchema = z46.object({
4389
4479
  source: runDefinitionSubmissionSchema.shape.source,
4390
- measurementMode: z44.enum(["AGENT_EXPERIENCE", "AGENT_PREFERENCE", "MIXED"]),
4391
- cases: z44.array(
4392
- z44.object({
4393
- path: z44.string(),
4394
- agents: z44.array(agentConfigSchema),
4395
- samples: z44.number().int().nonnegative(),
4396
- expectedRuns: z44.number().int().nonnegative(),
4397
- workspace: z44.object({
4398
- repoUrl: z44.string().nullable(),
4399
- repoRef: z44.string().nullable()
4480
+ measurementMode: z46.enum(["AGENT_EXPERIENCE", "AGENT_PREFERENCE", "MIXED"]),
4481
+ cases: z46.array(
4482
+ z46.object({
4483
+ path: z46.string(),
4484
+ agents: z46.array(agentConfigSchema),
4485
+ samples: z46.number().int().nonnegative(),
4486
+ expectedRuns: z46.number().int().nonnegative(),
4487
+ workspace: z46.object({
4488
+ repoUrl: z46.string().nullable(),
4489
+ repoRef: z46.string().nullable()
4400
4490
  }),
4401
- criteriaCount: z44.number().int().nonnegative(),
4491
+ criteriaCount: z46.number().int().nonnegative(),
4402
4492
  preference: preferenceDefinitionSchema.optional(),
4403
- inputs: z44.array(z44.string())
4493
+ inputs: z46.array(z46.string())
4404
4494
  })
4405
4495
  ),
4406
- resources: z44.array(
4407
- z44.object({
4408
- name: z44.string(),
4409
- type: z44.literal("input"),
4410
- source: z44.enum([
4496
+ resources: z46.array(
4497
+ z46.object({
4498
+ name: z46.string(),
4499
+ type: z46.literal("input"),
4500
+ source: z46.enum([
4411
4501
  "git",
4412
4502
  "github-actions",
4413
4503
  "github-deployment",
4414
- "github-pr-comment"
4504
+ "github-pr-comment",
4505
+ "upload"
4415
4506
  ]),
4416
4507
  use: inputUseSchema,
4417
- readiness: z44.enum(["READY", "WAITING", "FAILED"]),
4418
- detail: z44.string().optional(),
4419
- commands: z44.array(z44.string()).optional()
4508
+ readiness: z46.enum(["READY", "WAITING", "FAILED"]),
4509
+ detail: z46.string().optional(),
4510
+ commands: z46.array(z46.string()).optional()
4420
4511
  })
4421
4512
  ),
4422
- expectedRuns: z44.number().int().nonnegative(),
4423
- canRun: z44.boolean()
4513
+ expectedRuns: z46.number().int().nonnegative(),
4514
+ canRun: z46.boolean()
4424
4515
  });
4425
- var runDefinitionRunResponseSchema = z44.object({
4426
- runRequestId: z44.string(),
4427
- batchIds: z44.array(z44.string()),
4428
- runIds: z44.array(z44.string()),
4429
- requestedRuns: z44.number().int().nonnegative(),
4430
- createdRuns: z44.number().int().nonnegative(),
4431
- aggregateUrl: z44.string()
4516
+ var runDefinitionRunResponseSchema = z46.object({
4517
+ runRequestId: z46.string(),
4518
+ batchIds: z46.array(z46.string()),
4519
+ runIds: z46.array(z46.string()),
4520
+ requestedRuns: z46.number().int().nonnegative(),
4521
+ createdRuns: z46.number().int().nonnegative(),
4522
+ aggregateUrl: z46.string()
4432
4523
  });
4433
4524
 
4434
4525
  // ../packages/api-schemas/src/runRequests.ts
4435
- import { z as z45 } from "zod";
4436
- var runRequestStatusSchema = z45.enum([
4526
+ import { z as z47 } from "zod";
4527
+ var runRequestStatusSchema = z47.enum([
4437
4528
  "PENDING",
4438
4529
  "PREPARING",
4439
4530
  "RUNNING",
@@ -4441,7 +4532,7 @@ var runRequestStatusSchema = z45.enum([
4441
4532
  "FAILED",
4442
4533
  "CANCELED"
4443
4534
  ]);
4444
- var runRequestResultSchema = z45.enum([
4535
+ var runRequestResultSchema = z47.enum([
4445
4536
  "PENDING",
4446
4537
  "PASSED",
4447
4538
  "MEASURED",
@@ -4452,229 +4543,230 @@ var runRequestResultSchema = z45.enum([
4452
4543
  "INCOMPLETE",
4453
4544
  "CANCELED"
4454
4545
  ]);
4455
- var runRequestCriterionResultSchema = z45.object({
4456
- criterionId: z45.string().nullable(),
4457
- name: z45.string(),
4458
- passed: z45.boolean(),
4459
- reasoning: z45.string().nullable()
4460
- });
4461
- var runRequestRunSchema = z45.object({
4462
- id: z45.string(),
4463
- batchId: z45.string(),
4464
- status: z45.string(),
4546
+ var runRequestCriterionResultSchema = z47.object({
4547
+ criterionId: z47.string().nullable(),
4548
+ name: z47.string(),
4549
+ passed: z47.boolean(),
4550
+ reasoning: z47.string().nullable()
4551
+ });
4552
+ var runRequestRunSchema = z47.object({
4553
+ id: z47.string(),
4554
+ url: z47.string().url().optional(),
4555
+ batchId: z47.string(),
4556
+ status: z47.string(),
4465
4557
  agent: agentSchema,
4466
- model: z45.string(),
4558
+ model: z47.string(),
4467
4559
  result: runRequestResultSchema,
4468
- judge: z45.object({ status: z45.string() }).nullable(),
4469
- criterionResults: z45.array(runRequestCriterionResultSchema),
4560
+ judge: z47.object({ status: z47.string() }).nullable(),
4561
+ criterionResults: z47.array(runRequestCriterionResultSchema),
4470
4562
  preference: visibilityVerdictSchema.nullable().optional(),
4471
- measurement: z45.enum(["experience", "preference"]).optional()
4563
+ measurement: z47.enum(["experience", "preference"]).optional()
4472
4564
  });
4473
- var runRequestResponseSchema = z45.object({
4474
- id: z45.string(),
4565
+ var runRequestResponseSchema = z47.object({
4566
+ id: z47.string(),
4475
4567
  status: runRequestStatusSchema,
4476
4568
  result: runRequestResultSchema,
4477
- error: z45.string().nullable().optional(),
4478
- inputs: z45.unknown().optional(),
4479
- settled: z45.boolean(),
4480
- counts: z45.object({
4481
- requestedRuns: z45.number().int().nonnegative(),
4482
- createdRuns: z45.number().int().nonnegative(),
4483
- terminalRuns: z45.number().int().nonnegative(),
4484
- judgedRuns: z45.number().int().nonnegative(),
4485
- passedRuns: z45.number().int().nonnegative(),
4486
- measuredRuns: z45.number().int().nonnegative().optional(),
4487
- qualityFailedRuns: z45.number().int().nonnegative(),
4488
- executionFailedRuns: z45.number().int().nonnegative(),
4489
- judgeFailedRuns: z45.number().int().nonnegative(),
4490
- pendingRuns: z45.number().int().nonnegative()
4569
+ error: z47.string().nullable().optional(),
4570
+ inputs: z47.unknown().optional(),
4571
+ settled: z47.boolean(),
4572
+ counts: z47.object({
4573
+ requestedRuns: z47.number().int().nonnegative(),
4574
+ createdRuns: z47.number().int().nonnegative(),
4575
+ terminalRuns: z47.number().int().nonnegative(),
4576
+ judgedRuns: z47.number().int().nonnegative(),
4577
+ passedRuns: z47.number().int().nonnegative(),
4578
+ measuredRuns: z47.number().int().nonnegative().optional(),
4579
+ qualityFailedRuns: z47.number().int().nonnegative(),
4580
+ executionFailedRuns: z47.number().int().nonnegative(),
4581
+ judgeFailedRuns: z47.number().int().nonnegative(),
4582
+ pendingRuns: z47.number().int().nonnegative()
4491
4583
  }),
4492
- batches: z45.array(
4493
- z45.object({ id: z45.string(), runs: z45.array(runRequestRunSchema) })
4584
+ batches: z47.array(
4585
+ z47.object({ id: z47.string(), runs: z47.array(runRequestRunSchema) })
4494
4586
  ),
4495
- createdAt: z45.string(),
4496
- updatedAt: z45.string(),
4497
- finishedAt: z45.string().nullable()
4587
+ createdAt: z47.string(),
4588
+ updatedAt: z47.string(),
4589
+ finishedAt: z47.string().nullable()
4498
4590
  });
4499
4591
 
4500
4592
  // ../packages/api-schemas/src/summary.ts
4501
- import { z as z46 } from "zod";
4593
+ import { z as z48 } from "zod";
4502
4594
  function cardResultSchema(data) {
4503
- return z46.union([
4504
- z46.object({ ok: z46.literal(true), data }),
4505
- z46.object({ ok: z46.literal(false), error: z46.string() })
4595
+ return z48.union([
4596
+ z48.object({ ok: z48.literal(true), data }),
4597
+ z48.object({ ok: z48.literal(false), error: z48.string() })
4506
4598
  ]);
4507
4599
  }
4508
- var summaryActionSchema = z46.object({
4509
- id: z46.string(),
4510
- title: z46.string(),
4511
- priority: z46.string(),
4512
- status: z46.string(),
4513
- evidenceCount: z46.number().int()
4514
- });
4515
- var summaryAeCardSchema = z46.object({
4516
- id: z46.string(),
4517
- name: z46.string(),
4518
- judgedRuns: z46.number().int(),
4519
- passRate: z46.number().nullable(),
4600
+ var summaryActionSchema = z48.object({
4601
+ id: z48.string(),
4602
+ title: z48.string(),
4603
+ priority: z48.string(),
4604
+ status: z48.string(),
4605
+ evidenceCount: z48.number().int()
4606
+ });
4607
+ var summaryAeCardSchema = z48.object({
4608
+ id: z48.string(),
4609
+ name: z48.string(),
4610
+ judgedRuns: z48.number().int(),
4611
+ passRate: z48.number().nullable(),
4520
4612
  /** pp delta vs the prior 30d; null with no prior. */
4521
- deltaPP: z46.number().nullable()
4522
- });
4523
- var summaryVisibilityCardSchema = z46.object({
4524
- name: z46.string(),
4525
- owned: z46.object({
4526
- name: z46.string(),
4527
- rank: z46.number(),
4528
- chosenRate: z46.number(),
4529
- mentionRate: z46.number()
4613
+ deltaPP: z48.number().nullable()
4614
+ });
4615
+ var summaryVisibilityCardSchema = z48.object({
4616
+ name: z48.string(),
4617
+ owned: z48.object({
4618
+ name: z48.string(),
4619
+ rank: z48.number(),
4620
+ chosenRate: z48.number(),
4621
+ mentionRate: z48.number()
4530
4622
  }).nullable(),
4531
- chosenDeltaPP: z46.number().nullable()
4623
+ chosenDeltaPP: z48.number().nullable()
4532
4624
  });
4533
- var homeSummarySchema = z46.object({
4534
- hasAnyRuns: z46.boolean(),
4535
- lastSynthesisAt: z46.string().nullable(),
4536
- actions: cardResultSchema(z46.array(summaryActionSchema)),
4625
+ var homeSummarySchema = z48.object({
4626
+ hasAnyRuns: z48.boolean(),
4627
+ lastSynthesisAt: z48.string().nullable(),
4628
+ actions: cardResultSchema(z48.array(summaryActionSchema)),
4537
4629
  visibility: cardResultSchema(
4538
- z46.object({
4539
- cards: z46.array(summaryVisibilityCardSchema),
4540
- marketsTotal: z46.number().int(),
4541
- promptCount: z46.number().int()
4630
+ z48.object({
4631
+ cards: z48.array(summaryVisibilityCardSchema),
4632
+ marketsTotal: z48.number().int(),
4633
+ promptCount: z48.number().int()
4542
4634
  })
4543
4635
  ),
4544
4636
  agentExperience: cardResultSchema(
4545
- z46.object({
4546
- cards: z46.array(summaryAeCardSchema),
4547
- total: z46.number().int(),
4548
- setCount: z46.number().int()
4637
+ z48.object({
4638
+ cards: z48.array(summaryAeCardSchema),
4639
+ total: z48.number().int(),
4640
+ setCount: z48.number().int()
4549
4641
  })
4550
4642
  ),
4551
- notableSessions: cardResultSchema(z46.array(z46.unknown()))
4643
+ notableSessions: cardResultSchema(z48.array(z48.unknown()))
4552
4644
  });
4553
4645
 
4554
4646
  // ../packages/api-schemas/src/tokens.ts
4555
- import { z as z47 } from "zod";
4556
- var apiTokenSchema = z47.object({
4557
- id: z47.string(),
4558
- name: z47.string(),
4647
+ import { z as z49 } from "zod";
4648
+ var apiTokenSchema = z49.object({
4649
+ id: z49.string(),
4650
+ name: z49.string(),
4559
4651
  /** Last 4 chars of the plaintext, for recognizability (non-secret). */
4560
- last4: z47.string(),
4561
- expiresAt: z47.iso.datetime().nullable(),
4562
- lastUsedAt: z47.iso.datetime().nullable(),
4563
- createdAt: z47.iso.datetime(),
4564
- revokedAt: z47.iso.datetime().nullable()
4565
- });
4566
- var createTokenRequestSchema = z47.object({
4567
- name: z47.string().min(1).max(100),
4652
+ last4: z49.string(),
4653
+ expiresAt: z49.iso.datetime().nullable(),
4654
+ lastUsedAt: z49.iso.datetime().nullable(),
4655
+ createdAt: z49.iso.datetime(),
4656
+ revokedAt: z49.iso.datetime().nullable()
4657
+ });
4658
+ var createTokenRequestSchema = z49.object({
4659
+ name: z49.string().min(1).max(100),
4568
4660
  /** ISO-8601 datetime; omit for no expiry. */
4569
- expiresAt: z47.iso.datetime({ offset: true }).optional()
4661
+ expiresAt: z49.iso.datetime({ offset: true }).optional()
4570
4662
  });
4571
4663
  var createTokenResponseSchema = apiTokenSchema.extend({
4572
- token: z47.string()
4664
+ token: z49.string()
4573
4665
  });
4574
4666
  var listTokensResponseSchema = listResponseSchema(apiTokenSchema);
4575
4667
 
4576
4668
  // ../packages/api-schemas/src/visibility.ts
4577
- import { z as z48 } from "zod";
4669
+ import { z as z50 } from "zod";
4578
4670
  var VISIBILITY_PROMPT_KINDS = ["HEAD_TO_HEAD", "RECOMMEND"];
4579
- var visibilityPromptKindSchema = z48.enum(VISIBILITY_PROMPT_KINDS);
4671
+ var visibilityPromptKindSchema = z50.enum(VISIBILITY_PROMPT_KINDS);
4580
4672
  var visibilityPromptSchema = visibilityPromptSettingsSchema.extend({
4581
- id: z48.string(),
4582
- name: z48.string(),
4673
+ id: z50.string(),
4674
+ name: z50.string(),
4583
4675
  kind: visibilityPromptKindSchema,
4584
- promptText: z48.string(),
4676
+ promptText: z50.string(),
4585
4677
  /** HEAD_TO_HEAD is always branded; RECOMMEND may be either. */
4586
- branded: z48.boolean(),
4587
- brandA: z48.string().nullable(),
4588
- brandB: z48.string().nullable(),
4589
- market: z48.object({ id: z48.string(), slug: z48.string(), name: z48.string() }).nullable(),
4590
- position: z48.number().int(),
4591
- createdAt: z48.string(),
4678
+ branded: z50.boolean(),
4679
+ brandA: z50.string().nullable(),
4680
+ brandB: z50.string().nullable(),
4681
+ market: z50.object({ id: z50.string(), slug: z50.string(), name: z50.string() }).nullable(),
4682
+ position: z50.number().int(),
4683
+ createdAt: z50.string(),
4592
4684
  /** User tag names on the hidden backing prompt (Surface:* excluded). */
4593
- tags: z48.array(z48.string()),
4594
- runCount: z48.number().int(),
4595
- lastRunAt: z48.string().nullable(),
4596
- scenarios: z48.array(visibilityScenarioSchema)
4685
+ tags: z50.array(z50.string()),
4686
+ runCount: z50.number().int(),
4687
+ lastRunAt: z50.string().nullable(),
4688
+ scenarios: z50.array(visibilityScenarioSchema)
4597
4689
  });
4598
- var listVisibilityPromptsResponseSchema = z48.object({
4599
- items: z48.array(visibilityPromptSchema)
4690
+ var listVisibilityPromptsResponseSchema = z50.object({
4691
+ items: z50.array(visibilityPromptSchema)
4600
4692
  });
4601
- var createVisibilityPromptBodySchema = z48.object({
4602
- name: z48.string().min(1),
4603
- promptText: z48.string().min(1),
4693
+ var createVisibilityPromptBodySchema = z50.object({
4694
+ name: z50.string().min(1),
4695
+ promptText: z50.string().min(1),
4604
4696
  kind: visibilityPromptKindSchema,
4605
- branded: z48.boolean().optional(),
4697
+ branded: z50.boolean().optional(),
4606
4698
  /** Required pair for HEAD_TO_HEAD (order-independent). */
4607
- brandA: z48.string().nullish(),
4608
- brandB: z48.string().nullish(),
4699
+ brandA: z50.string().nullish(),
4700
+ brandB: z50.string().nullish(),
4609
4701
  /** Measured market id from the org's tracked set. */
4610
- marketId: z48.string().nullish(),
4611
- tags: z48.array(z48.string()).optional(),
4702
+ marketId: z50.string().nullish(),
4703
+ tags: z50.array(z50.string()).optional(),
4612
4704
  agents: visibilityPromptSettingsInputShape.agents.optional(),
4613
4705
  skillRefs: visibilityPromptSettingsInputShape.skillRefs,
4614
4706
  mcpRefs: visibilityPromptSettingsInputShape.mcpRefs,
4615
4707
  connectionIds: visibilityPromptSettingsInputShape.connectionIds,
4616
4708
  cadence: visibilityPromptSettingsInputShape.cadence,
4617
4709
  sampleCount: visibilityPromptSettingsInputShape.sampleCount,
4618
- scenarios: z48.array(visibilityScenarioInputSchema).optional().default([])
4710
+ scenarios: z50.array(visibilityScenarioInputSchema).optional().default([])
4619
4711
  }).strict();
4620
- var synthesizeResponseSchema = z48.object({
4712
+ var synthesizeResponseSchema = z50.object({
4621
4713
  /** False when the pre-check found no new evidence and nothing was queued. */
4622
- queued: z48.boolean()
4623
- });
4624
- var updateVisibilityPromptBodySchema = z48.object({
4625
- name: z48.string().min(1).optional(),
4626
- promptText: z48.string().min(1).optional(),
4627
- branded: z48.boolean().optional(),
4628
- brandA: z48.string().nullish(),
4629
- brandB: z48.string().nullish(),
4630
- marketId: z48.string().nullish(),
4631
- tags: z48.array(z48.string()).optional(),
4714
+ queued: z50.boolean()
4715
+ });
4716
+ var updateVisibilityPromptBodySchema = z50.object({
4717
+ name: z50.string().min(1).optional(),
4718
+ promptText: z50.string().min(1).optional(),
4719
+ branded: z50.boolean().optional(),
4720
+ brandA: z50.string().nullish(),
4721
+ brandB: z50.string().nullish(),
4722
+ marketId: z50.string().nullish(),
4723
+ tags: z50.array(z50.string()).optional(),
4632
4724
  ...visibilityPromptSettingsPatchShape,
4633
4725
  /** Replaces the whole scenario set when present. */
4634
- scenarios: z48.array(visibilityScenarioInputSchema).optional()
4726
+ scenarios: z50.array(visibilityScenarioInputSchema).optional()
4635
4727
  }).strict();
4636
- var runVisibilityPromptResponseSchema = z48.object({
4637
- batchIds: z48.array(z48.string()),
4638
- runIds: z48.array(z48.string())
4728
+ var runVisibilityPromptResponseSchema = z50.object({
4729
+ batchIds: z50.array(z50.string()),
4730
+ runIds: z50.array(z50.string())
4639
4731
  });
4640
- var visibilityPromptRunSchema = z48.object({
4641
- id: z48.string(),
4642
- status: z48.string(),
4732
+ var visibilityPromptRunSchema = z50.object({
4733
+ id: z50.string(),
4734
+ status: z50.string(),
4643
4735
  agent: agentSchema,
4644
- model: z48.string().nullable(),
4645
- resolvedModel: z48.string().nullable(),
4646
- createdAt: z48.string(),
4647
- startedAt: z48.string().nullable(),
4648
- finishedAt: z48.string().nullable(),
4649
- failureReason: z48.string().nullable(),
4736
+ model: z50.string().nullable(),
4737
+ resolvedModel: z50.string().nullable(),
4738
+ createdAt: z50.string(),
4739
+ startedAt: z50.string().nullable(),
4740
+ finishedAt: z50.string().nullable(),
4741
+ failureReason: z50.string().nullable(),
4650
4742
  creditsCharged: runCreditsChargedSchema.optional(),
4651
4743
  triggeredBy: runTriggeredBySchema.optional(),
4652
- verdict: z48.object({
4653
- status: z48.string(),
4654
- error: z48.string().nullable(),
4655
- payload: z48.unknown().nullable()
4744
+ verdict: z50.object({
4745
+ status: z50.string(),
4746
+ error: z50.string().nullable(),
4747
+ payload: z50.unknown().nullable()
4656
4748
  }).nullable()
4657
4749
  });
4658
4750
  var listVisibilityPromptRunsResponseSchema = listResponseSchema(
4659
4751
  visibilityPromptRunSchema
4660
4752
  );
4661
- var orgMarketSchema = z48.object({
4662
- marketId: z48.string(),
4663
- slug: z48.string(),
4664
- name: z48.string(),
4753
+ var orgMarketSchema = z50.object({
4754
+ marketId: z50.string(),
4755
+ slug: z50.string(),
4756
+ name: z50.string(),
4665
4757
  /** The one line saying what the market measures. */
4666
- capability: z48.string(),
4758
+ capability: z50.string(),
4667
4759
  /** SUGGESTED (the matcher) | USER (a human picked it). */
4668
- source: z48.string()
4760
+ source: z50.string()
4669
4761
  });
4670
4762
  var addableMarketSchema = orgMarketSchema.omit({ source: true });
4671
- var listMarketsResponseSchema = z48.object({
4672
- tracked: z48.array(orgMarketSchema),
4763
+ var listMarketsResponseSchema = z50.object({
4764
+ tracked: z50.array(orgMarketSchema),
4673
4765
  /** Published markets the org does not track yet (closed set — no free-text
4674
4766
  * market creation). */
4675
- addable: z48.array(addableMarketSchema)
4767
+ addable: z50.array(addableMarketSchema)
4676
4768
  });
4677
- var addMarketBodySchema = z48.object({ marketId: z48.string().min(1) });
4769
+ var addMarketBodySchema = z50.object({ marketId: z50.string().min(1) });
4678
4770
 
4679
4771
  // src/version.ts
4680
4772
  import { createRequire } from "module";
@@ -5059,7 +5151,7 @@ __export(apply_exports, {
5059
5151
  register: () => register2
5060
5152
  });
5061
5153
  import { readFileSync as readFileSync3 } from "fs";
5062
- import { z as z49 } from "zod";
5154
+ import { z as z51 } from "zod";
5063
5155
  function assertRequiredExperiment(spec, required) {
5064
5156
  if (required.length === 0) {
5065
5157
  throw new CliError(
@@ -5211,7 +5303,7 @@ function register2(program2) {
5211
5303
  ).option("--schema", "print the battery spec JSON Schema and exit").option("--example", "print a minimal example battery spec and exit").action(
5212
5304
  async (opts, command) => {
5213
5305
  if (opts.schema) {
5214
- printJson(z49.toJSONSchema(batteries_exports.batterySpecSchema));
5306
+ printJson(z51.toJSONSchema(batteries_exports.batterySpecSchema));
5215
5307
  return;
5216
5308
  }
5217
5309
  if (opts.example) {
@@ -5323,7 +5415,7 @@ async function browserLogin() {
5323
5415
  const codeVerifier = randomBytes(32).toString("base64url");
5324
5416
  const codeChallenge = createHash("sha256").update(codeVerifier).digest("base64url");
5325
5417
  const server = createServer();
5326
- const codePromise = new Promise((resolve3, reject) => {
5418
+ const codePromise = new Promise((resolve4, reject) => {
5327
5419
  server.on("request", (req, res) => {
5328
5420
  const url = new URL(req.url ?? "/", "http://127.0.0.1");
5329
5421
  if (url.pathname !== "/callback") {
@@ -5346,15 +5438,15 @@ async function browserLogin() {
5346
5438
  "content-type": "text/plain; charset=utf-8"
5347
5439
  });
5348
5440
  res.end("Authorized. Return to your terminal.");
5349
- resolve3(code);
5441
+ resolve4(code);
5350
5442
  });
5351
5443
  server.on(
5352
5444
  "error",
5353
5445
  (e) => reject(new CliError("network", `Loopback listener failed: ${e.message}`))
5354
5446
  );
5355
5447
  });
5356
- await new Promise((resolve3) => {
5357
- server.listen(0, "127.0.0.1", resolve3);
5448
+ await new Promise((resolve4) => {
5449
+ server.listen(0, "127.0.0.1", resolve4);
5358
5450
  });
5359
5451
  const address = server.address();
5360
5452
  if (!address || typeof address === "string") {
@@ -5983,10 +6075,10 @@ function splitList(raw) {
5983
6075
  return raw.split(",").map((v) => v.trim()).filter(Boolean);
5984
6076
  }
5985
6077
  function parsePackage(raw) {
5986
- const sep4 = raw.lastIndexOf(":");
5987
- if (sep4 === -1) return { name: raw.trim(), ecosystem: null };
5988
- const name = raw.slice(0, sep4).trim();
5989
- const ecosystem = raw.slice(sep4 + 1).trim();
6078
+ const sep5 = raw.lastIndexOf(":");
6079
+ if (sep5 === -1) return { name: raw.trim(), ecosystem: null };
6080
+ const name = raw.slice(0, sep5).trim();
6081
+ const ecosystem = raw.slice(sep5 + 1).trim();
5990
6082
  if (!name) throw new CliError("usage", `Invalid package "${raw}"`);
5991
6083
  if (!ECOSYSTEMS.includes(ecosystem)) {
5992
6084
  throw new CliError(
@@ -6122,7 +6214,7 @@ async function waitForCanary(id2) {
6122
6214
  while (true) {
6123
6215
  const canary = await client.get(`${path}/${id2}`);
6124
6216
  if (terminal.has(canary.status)) return canary;
6125
- await new Promise((resolve3) => setTimeout(resolve3, 1e4));
6217
+ await new Promise((resolve4) => setTimeout(resolve4, 1e4));
6126
6218
  }
6127
6219
  }
6128
6220
  function register7(program2, opts = {}) {
@@ -6240,7 +6332,7 @@ function register8(program2, options = {}) {
6240
6332
  throw new Error(
6241
6333
  `Canary failed: ${JSON.stringify(status.runs)}`
6242
6334
  );
6243
- await new Promise((resolve3) => setTimeout(resolve3, 5e3));
6335
+ await new Promise((resolve4) => setTimeout(resolve4, 5e3));
6244
6336
  }
6245
6337
  throw new Error(
6246
6338
  `Canary timed out; runs continue. Inspect ${runIds.join(",")} then activate with --runs.`
@@ -6455,7 +6547,7 @@ async function confirmOrAbort(question, yes) {
6455
6547
  }
6456
6548
  const rl = createInterface2({ input: process.stdin, output: process.stderr });
6457
6549
  const answer = await new Promise(
6458
- (resolve3) => rl.question(`${question} [y/N] `, resolve3)
6550
+ (resolve4) => rl.question(`${question} [y/N] `, resolve4)
6459
6551
  );
6460
6552
  rl.close();
6461
6553
  if (!/^y(es)?$/i.test(answer.trim())) {
@@ -6463,198 +6555,108 @@ async function confirmOrAbort(question, yes) {
6463
6555
  }
6464
6556
  }
6465
6557
 
6466
- // src/lib/ownedConfig.ts
6467
- function parseCadence(raw) {
6468
- const cadence = (raw ?? "NONE").trim().toUpperCase();
6469
- if (!["NONE", "DAILY", "WEEKLY", "MONTHLY"].includes(cadence))
6470
- throw new CliError(
6471
- "usage",
6472
- `invalid cadence "${raw}" (expected none, daily, weekly, or monthly)`
6558
+ // src/lib/localRunInputs.ts
6559
+ import { execFileSync as execFileSync2 } from "child_process";
6560
+ import { createHash as createHash3 } from "crypto";
6561
+ import { createReadStream } from "fs";
6562
+ import { lstat, mkdtemp, readdir, rm, stat } from "fs/promises";
6563
+ import { tmpdir } from "os";
6564
+ import {
6565
+ basename,
6566
+ dirname,
6567
+ isAbsolute as isAbsolute2,
6568
+ join as join4,
6569
+ relative as relative2,
6570
+ resolve as resolve2,
6571
+ sep as sep2
6572
+ } from "path";
6573
+ import { setTimeout as delay } from "timers/promises";
6574
+
6575
+ // ../packages/api-schemas/src/compileRunDefinition.ts
6576
+ import { createHash as createHash2 } from "crypto";
6577
+ import { parseDocument } from "yaml";
6578
+ function utf8(bytes, path3) {
6579
+ try {
6580
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
6581
+ } catch {
6582
+ throw new Error(`${path3} is not UTF-8 text`);
6583
+ }
6584
+ }
6585
+ function parseRunDefinitionCase(path3, bytes) {
6586
+ const source2 = utf8(bytes, path3);
6587
+ const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(source2);
6588
+ if (!match)
6589
+ throw new Error(`${path3}: expected YAML frontmatter between --- lines`);
6590
+ const document = parseDocument(match[1], { uniqueKeys: true });
6591
+ if (document.errors.length)
6592
+ throw new Error(
6593
+ `${path3}: ${document.errors.map((error) => error.message).join("; ")}`
6473
6594
  );
6474
- return cadence;
6595
+ const parsed = runDefinitionFrontmatterSchema.safeParse(document.toJS());
6596
+ if (!parsed.success) throw new Error(`${path3}: ${parsed.error.message}`);
6597
+ const prompt = match[2].trim();
6598
+ if (!prompt) throw new Error(`${path3}: Markdown body is empty`);
6599
+ return { path: path3, prompt, ...parsed.data };
6475
6600
  }
6476
- function parseSampleCount(raw) {
6477
- const value = Number(raw ?? "1");
6478
- if (!Number.isSafeInteger(value) || value < 1 || value > 50)
6479
- throw new CliError("usage", "--samples must be an integer from 1 to 50");
6480
- return value;
6601
+ function compileRunDefinitionFromBlobs(input) {
6602
+ if (input.repoUrl !== null && !uncredentialedRepoUrlSchema.safeParse(input.repoUrl).success)
6603
+ throw new Error("Git origin must not contain embedded credentials");
6604
+ if (input.commit !== null && !/^[a-f0-9]{40}$/i.test(input.commit))
6605
+ throw new Error("Expected a full Git commit SHA");
6606
+ if (input.casePaths.length === 0)
6607
+ throw new Error("At least one Markdown case is required");
6608
+ if (new Set(input.casePaths).size !== input.casePaths.length)
6609
+ throw new Error("Case paths must be unique");
6610
+ const configBytes = input.blobs.get("gauge.json");
6611
+ let config;
6612
+ if (configBytes) {
6613
+ try {
6614
+ config = runDefinitionFileConfigSchema.parse(
6615
+ JSON.parse(utf8(configBytes, "gauge.json"))
6616
+ );
6617
+ } catch (error) {
6618
+ throw new Error(
6619
+ `gauge.json: ${error instanceof Error ? error.message : error}`
6620
+ );
6621
+ }
6622
+ }
6623
+ const cases = input.casePaths.map((path3) => {
6624
+ const bytes = input.blobs.get(path3);
6625
+ if (!path3.endsWith(".md") || !bytes)
6626
+ throw new Error(`Missing Markdown case: ${path3}`);
6627
+ return parseRunDefinitionCase(path3, bytes);
6628
+ });
6629
+ const hash = createHash2("sha256");
6630
+ hash.update("gauge-run-definition-v2\0");
6631
+ for (const [path3, bytes] of [...input.blobs.entries()].sort(
6632
+ ([a], [b]) => a < b ? -1 : a > b ? 1 : 0
6633
+ )) {
6634
+ hash.update(path3);
6635
+ hash.update("\0");
6636
+ hash.update(String(bytes.length));
6637
+ hash.update("\0");
6638
+ hash.update(bytes);
6639
+ hash.update("\0");
6640
+ }
6641
+ const submission = runDefinitionSubmissionSchema.parse({
6642
+ version: 2,
6643
+ source: {
6644
+ repoUrl: input.repoUrl,
6645
+ commit: input.commit,
6646
+ digest: `sha256:${hash.digest("hex")}`,
6647
+ verification: input.verification
6648
+ },
6649
+ resources: input.resources ?? Object.entries(config?.inputs ?? {}).map(([name, item]) => {
6650
+ if (!input.repoUrl || !input.commit)
6651
+ throw new Error(
6652
+ `Supply --input ${name}=<path> outside a Git checkout with an origin`
6653
+ );
6654
+ return compileDefinitionInput(name, item, input.repoUrl, input.commit);
6655
+ }),
6656
+ cases
6657
+ });
6658
+ return { definition: submission, org: config?.org };
6481
6659
  }
6482
- function addOwnedConfigCreateOptions(command) {
6483
- 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(
6484
- "--agent <agent[:m1,m2]>",
6485
- "agent and optional model pins (repeatable)",
6486
- collect,
6487
- []
6488
- ).option(
6489
- "--skill <name@label>",
6490
- "staged skill (repeatable)",
6491
- collect,
6492
- []
6493
- ).option(
6494
- "--mcp <name@label>",
6495
- "MCP server (repeatable)",
6496
- collect,
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
6660
 
6659
6661
  // ../packages/api-schemas/src/inputPaths.ts
6660
6662
  import { minimatch } from "minimatch";
@@ -6676,222 +6678,51 @@ function matchInputPaths(paths, patterns, options = {}) {
6676
6678
  return [...selected].sort();
6677
6679
  }
6678
6680
 
6679
- // ../packages/api-schemas/src/compileRunDefinition.ts
6680
- import { createHash as createHash2 } from "crypto";
6681
- import { parseDocument } from "yaml";
6682
- function utf8(bytes, path3) {
6681
+ // src/lib/localRunInputs.ts
6682
+ import { create as tar } from "tar";
6683
+
6684
+ // src/lib/verifyEvals.ts
6685
+ import { execFileSync } from "child_process";
6686
+ import { lstatSync, readdirSync, readFileSync as readFileSync6, realpathSync } from "fs";
6687
+ import { isAbsolute, join as join3, relative, resolve, sep } from "path";
6688
+ import { minimatch as minimatch2 } from "minimatch";
6689
+ import { parseDocument as parseDocument2 } from "yaml";
6690
+ var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
6691
+ var message = (error) => error instanceof Error ? error.message : String(error);
6692
+ var check = (id2, state, detail) => ({ id: id2, state, detail });
6693
+ var dynamic = (value) => typeof value !== "string" || value.includes("${{");
6694
+ var condition = (value) => {
6695
+ if (value === void 0 || value === true) return true;
6696
+ if (value === false) return false;
6697
+ if (typeof value === "string") {
6698
+ const compact2 = value.replace(/\s/g, "");
6699
+ if (compact2 === "true" || compact2 === `\${{true}}`) return true;
6700
+ if (compact2 === "false" || compact2 === `\${{false}}`) return false;
6701
+ }
6702
+ return void 0;
6703
+ };
6704
+ function git(cwd, args) {
6705
+ return execFileSync("git", args, {
6706
+ cwd,
6707
+ encoding: "utf8",
6708
+ stdio: ["ignore", "pipe", "pipe"],
6709
+ maxBuffer: 16 * 1024 * 1024
6710
+ });
6711
+ }
6712
+ function rootDirectory(cwd) {
6683
6713
  try {
6684
- return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
6714
+ return git(cwd, ["rev-parse", "--show-toplevel"]).trim();
6685
6715
  } catch {
6686
- throw new Error(`${path3} is not UTF-8 text`);
6716
+ return resolve(cwd);
6687
6717
  }
6688
6718
  }
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 };
6704
- }
6705
- function compileRunDefinitionFromBlobs(input) {
6706
- if (!uncredentialedRepoUrlSchema.safeParse(input.repoUrl).success)
6707
- throw new Error("Git origin must not contain embedded credentials");
6708
- if (!/^[a-f0-9]{40}$/i.test(input.commit))
6709
- throw new Error("Expected a full Git commit SHA");
6710
- if (input.casePaths.length === 0)
6711
- throw new Error("At least one Markdown case is required");
6712
- if (new Set(input.casePaths).size !== input.casePaths.length)
6713
- throw new Error("Case paths must be unique");
6714
- const configBytes = input.blobs.get("gauge.json");
6715
- let config;
6716
- if (configBytes) {
6717
- try {
6718
- config = runDefinitionFileConfigSchema.parse(
6719
- JSON.parse(utf8(configBytes, "gauge.json"))
6720
- );
6721
- } catch (error) {
6722
- throw new Error(
6723
- `gauge.json: ${error instanceof Error ? error.message : error}`
6724
- );
6725
- }
6726
- }
6727
- const cases = input.casePaths.map((path3) => {
6728
- const bytes = input.blobs.get(path3);
6729
- if (!path3.endsWith(".md") || !bytes)
6730
- throw new Error(`Missing committed Markdown case: ${path3}`);
6731
- return parseRunDefinitionCase(path3, bytes);
6732
- });
6733
- const hash = createHash2("sha256");
6734
- hash.update("gauge-run-definition-v2\0");
6735
- for (const [path3, bytes] of [...input.blobs.entries()].sort(
6736
- ([a], [b]) => a < b ? -1 : a > b ? 1 : 0
6737
- )) {
6738
- hash.update(path3);
6739
- hash.update("\0");
6740
- hash.update(String(bytes.length));
6741
- hash.update("\0");
6742
- hash.update(bytes);
6743
- hash.update("\0");
6744
- }
6745
- const submission = runDefinitionSubmissionSchema.parse({
6746
- version: 2,
6747
- source: {
6748
- repoUrl: input.repoUrl,
6749
- commit: input.commit,
6750
- digest: `sha256:${hash.digest("hex")}`,
6751
- verification: input.verification
6752
- },
6753
- resources: Object.entries(config?.inputs ?? {}).map(
6754
- ([name, item]) => compileDefinitionInput(name, item, input.repoUrl, input.commit)
6755
- ),
6756
- cases
6757
- });
6758
- return { definition: submission, org: config?.org };
6759
- }
6760
-
6761
- // src/lib/runDefinitionFiles.ts
6762
- function git(cwd, args) {
6763
- try {
6764
- return execFileSync("git", args, {
6765
- cwd,
6766
- encoding: "buffer",
6767
- maxBuffer: 10 * 1024 * 1024,
6768
- stdio: ["ignore", "pipe", "pipe"]
6769
- });
6770
- } catch (error) {
6771
- const detail = error && typeof error === "object" && "stderr" in error ? String(error.stderr).trim() : String(error);
6772
- throw new CliError("usage", `git ${args[0]} failed: ${detail}`);
6773
- }
6774
- }
6775
- function committedBlob(root, commit, path3) {
6776
- return git(root, ["show", `${commit}:${path3}`]);
6777
- }
6778
- function relativeGitPath(root, cwd, input) {
6779
- if (!input || input.includes("\0"))
6780
- throw new CliError("usage", `expected a case path or glob: ${input}`);
6781
- const absolute = resolve(cwd, input);
6782
- const path3 = relative(root, absolute);
6783
- if (!path3 || path3 === ".." || path3.startsWith(`..${sep}`) || isAbsolute(path3))
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;
6790
- }
6791
- function loadCommittedRunDefinitionWithContext(files = [], cwd = process.cwd()) {
6792
- const root = git(cwd, ["rev-parse", "--show-toplevel"]).toString("utf8").trim();
6793
- const commit = git(root, ["rev-parse", "--verify", "HEAD^{commit}"]).toString("utf8").trim();
6794
- let repoUrl;
6795
- try {
6796
- repoUrl = git(root, ["remote", "get-url", "origin"]).toString("utf8").trim();
6797
- } catch {
6798
- throw new CliError(
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;
6719
+ function regularFile(root, path3) {
6720
+ const full = join3(root, path3);
6721
+ try {
6722
+ const rel = relative(realpathSync(root), realpathSync(full));
6723
+ return rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel) && lstatSync(full).isFile();
6724
+ } catch {
6725
+ return false;
6895
6726
  }
6896
6727
  }
6897
6728
  function read(root, path3) {
@@ -6904,7 +6735,7 @@ function read(root, path3) {
6904
6735
  function workingFiles(root) {
6905
6736
  let paths;
6906
6737
  try {
6907
- paths = git2(root, [
6738
+ paths = git(root, [
6908
6739
  "ls-files",
6909
6740
  "--cached",
6910
6741
  "--others",
@@ -7008,22 +6839,22 @@ function workflowChecks(root, input) {
7008
6839
  );
7009
6840
  const events = typeof workflow.on === "string" ? [workflow.on] : Array.isArray(workflow.on) ? workflow.on : Object.keys(record(workflow.on));
7010
6841
  const pr = events.includes("pull_request");
7011
- const safe = (step) => {
6842
+ const recognizedCheckout = (step) => {
7012
6843
  const options = record(step.with);
7013
6844
  if (options.repository !== void 0) return false;
7014
6845
  if (!events.length || options.ref !== void 0 && typeof options.ref !== "string")
7015
6846
  return false;
7016
6847
  const ref = typeof options.ref === "string" ? options.ref.replace(/\s/g, "") : "";
7017
- return ref === `\${{github.event.pull_request.head.sha||github.sha}}` || pr && events.every((event) => event === "pull_request") && ref === `\${{github.event.pull_request.head.sha}}` || !pr && events.every(
7018
- (event) => event === "push" || event === "workflow_dispatch"
7019
- ) && (!ref || ref === `\${{github.sha}}`);
6848
+ return events.every(
6849
+ (event) => ["pull_request", "push", "workflow_dispatch"].includes(event)
6850
+ ) && (!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
6851
  };
7021
- const checkoutState = checkouts.length > 0 && checkouts.every(({ step }) => safe(step)) ? "yes" : "unknown";
6852
+ const checkoutState = checkouts.length > 0 && checkouts.every(({ step }) => recognizedCheckout(step)) ? "yes" : "unknown";
7022
6853
  checks.push(
7023
6854
  check(
7024
6855
  "candidate-checkout",
7025
6856
  checkoutState,
7026
- checkoutState === "yes" ? "Recognized candidate-revision checkout syntax" : pr && checkouts.some(({ step }) => record(step.with).ref === void 0) ? "Default pull_request checkout uses a merge commit; explicitly select github.event.pull_request.head.sha. Other build steps may override checkout" : "Could not establish candidate checkout; inspect checkout refs, custom actions, and build scripts"
6857
+ 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
6858
  )
7028
6859
  );
7029
6860
  const filtered = Object.values(record(workflow.on)).some(
@@ -7140,136 +6971,673 @@ function verifyEvals(cwd = process.cwd()) {
7140
6971
  result.status = result.summary.no > 0 ? "failed" : result.summary.unknown > 0 ? "incomplete" : "passed";
7141
6972
  return result;
7142
6973
  };
7143
- let raw = {};
7144
- let files;
6974
+ let raw = {};
6975
+ let files;
6976
+ try {
6977
+ files = workingFiles(root);
6978
+ } catch (error) {
6979
+ result.global.push(check("working-tree", "no", message(error)));
6980
+ return finish();
6981
+ }
6982
+ try {
6983
+ result.facts.configFilePresent = files.includes("gauge.json") || regularFile(root, "gauge.json");
6984
+ if (result.facts.configFilePresent)
6985
+ raw = JSON.parse(read(root, "gauge.json").toString("utf8"));
6986
+ else
6987
+ result.info.push({
6988
+ id: "config-file-absent",
6989
+ detail: "Optional gauge.json is absent; using default case discovery and no inputs"
6990
+ });
6991
+ } catch (error) {
6992
+ result.global.push(check("configuration", "no", message(error)));
6993
+ return finish();
6994
+ }
6995
+ const config = runDefinitionFileConfigSchema.safeParse(raw);
6996
+ result.global.push(
6997
+ check(
6998
+ "configuration",
6999
+ config.success ? "yes" : "no",
7000
+ config.success ? "Configuration matches the supported gauge.json schema" : config.error.message
7001
+ )
7002
+ );
7003
+ const rawInputs = record(record(raw).inputs);
7004
+ for (const [name, value] of Object.entries(rawInputs).sort(
7005
+ ([a], [b]) => a.localeCompare(b)
7006
+ )) {
7007
+ const parsed = runDefinitionInputSchema.safeParse(value);
7008
+ result.inputs.push({
7009
+ name,
7010
+ checks: parsed.success ? inputChecks(root, files, parsed.data) : [check("configuration", "no", parsed.error.message)]
7011
+ });
7012
+ }
7013
+ if (config.success) {
7014
+ try {
7015
+ const paths = matchInputPaths(files, config.data.cases, {
7016
+ allowEmptySelection: true
7017
+ });
7018
+ if (paths.length > 20 || paths.some((path3) => !path3.endsWith(".md")))
7019
+ throw new Error("Expected at most 20 Markdown cases");
7020
+ result.facts.caseCount = paths.length;
7021
+ if (paths.length)
7022
+ result.global.push(
7023
+ check(
7024
+ "case-discovery",
7025
+ "yes",
7026
+ `${paths.length} working-tree case(s) selected`
7027
+ )
7028
+ );
7029
+ else
7030
+ result.info.push({
7031
+ id: "no-cases",
7032
+ detail: "No eval cases found; input-only setup is valid, but no evaluations will run"
7033
+ });
7034
+ for (const path3 of paths) {
7035
+ try {
7036
+ const item = parseRunDefinitionCase(path3, read(root, path3));
7037
+ const missing = (item.config.inputs ?? []).filter(
7038
+ (name) => !Object.hasOwn(config.data.inputs, name)
7039
+ );
7040
+ if (missing.length)
7041
+ throw new Error(`${path3}: Unknown input(s): ${missing.join(", ")}`);
7042
+ const commandOwners = /* @__PURE__ */ new Map();
7043
+ for (const name of new Set(
7044
+ item.config.inputs ?? Object.keys(config.data.inputs)
7045
+ )) {
7046
+ const input = config.data.inputs[name];
7047
+ if (input.type !== "binary") continue;
7048
+ for (const command of Object.keys(input.commands)) {
7049
+ const owner = commandOwners.get(command);
7050
+ if (owner)
7051
+ throw new Error(
7052
+ `${path3}: Inputs ${owner} and ${name} both expose command ${command}; choose distinct commands or separate cases`
7053
+ );
7054
+ commandOwners.set(command, name);
7055
+ }
7056
+ }
7057
+ result.global.push(
7058
+ check(
7059
+ `case.${path3}`,
7060
+ "yes",
7061
+ "Case syntax, input references, and declared command names are valid"
7062
+ )
7063
+ );
7064
+ } catch (error) {
7065
+ result.global.push(check(`case.${path3}`, "no", message(error)));
7066
+ }
7067
+ }
7068
+ } catch (error) {
7069
+ result.global.push(
7070
+ check(
7071
+ "case-discovery",
7072
+ "no",
7073
+ message(error).replace("committed files", "working-tree files")
7074
+ )
7075
+ );
7076
+ }
7077
+ } else
7078
+ result.info.push({
7079
+ id: "case-validation-skipped",
7080
+ detail: "Fix gauge.json before validating cases and input references"
7081
+ });
7082
+ return finish();
7083
+ }
7084
+ function printEvalVerification(result) {
7085
+ console.log(`Local static verification: ${result.root}`);
7086
+ const print = (checks) => {
7087
+ for (const item of checks)
7088
+ console.log(` [${item.state}] ${item.id}: ${item.detail}`);
7089
+ };
7090
+ console.log("Global");
7091
+ print(result.global);
7092
+ for (const input of result.inputs) {
7093
+ console.log(`Input: ${input.name}`);
7094
+ print(input.checks);
7095
+ }
7096
+ for (const item of result.info)
7097
+ console.log(`[info] ${item.id}: ${item.detail}`);
7098
+ console.log(
7099
+ `Static verification ${result.status}: ${result.summary.yes} yes, ${result.summary.no} no, ${result.summary.unknown} unknown.`
7100
+ );
7101
+ console.log(
7102
+ "Scope: repository setup only. Live delivery, account settings, and sandbox execution were not tested; no sessions were launched."
7103
+ );
7104
+ }
7105
+
7106
+ // src/lib/localRunInputs.ts
7107
+ var LIMIT = 512 * 1024 * 1024;
7108
+ function parseInputOverrides(values) {
7109
+ const overrides = /* @__PURE__ */ new Map();
7110
+ for (const value of values) {
7111
+ const split = value.indexOf("=");
7112
+ const name = value.slice(0, split);
7113
+ const path3 = value.slice(split + 1);
7114
+ if (split < 1 || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name) || !path3)
7115
+ throw new CliError("usage", "--input expects name=path");
7116
+ if (overrides.has(name))
7117
+ throw new CliError("usage", `Duplicate --input: ${name}`);
7118
+ overrides.set(name, path3);
7119
+ }
7120
+ return overrides;
7121
+ }
7122
+ async function packLocalInput(resource, supplied, output) {
7123
+ const path3 = resolve2(supplied);
7124
+ const info = await lstat(path3);
7125
+ if (!info.isFile() && !info.isDirectory())
7126
+ throw new CliError(
7127
+ "usage",
7128
+ `Input must be an ordinary file or directory: ${supplied}`
7129
+ );
7130
+ let use = resource.use;
7131
+ if (use.type === "website")
7132
+ throw new CliError(
7133
+ "usage",
7134
+ "Website inputs cannot be supplied as local files"
7135
+ );
7136
+ if (use.type === "skill") {
7137
+ if (info.isFile() && !isSkillArchive(path3))
7138
+ throw new CliError(
7139
+ "usage",
7140
+ "Supply a Skill directory, .zip, or .tar.gz archive"
7141
+ );
7142
+ use = { ...use, root: info.isDirectory() ? "." : basename(path3) };
7143
+ } else if (use.type === "npm-package" || use.type === "npm-cli") {
7144
+ if (!info.isFile() || !path3.endsWith(".tgz"))
7145
+ throw new CliError("usage", "Supply the packed npm .tgz file");
7146
+ use = { ...use, package: basename(path3) };
7147
+ } else if (!info.isDirectory())
7148
+ throw new CliError("usage", "Files and binary inputs require a directory");
7149
+ const root = info.isDirectory() ? path3 : dirname(path3);
7150
+ const paths = [];
7151
+ const walk = async (directory) => {
7152
+ for (const entry of await readdir(join4(root, directory), {
7153
+ withFileTypes: true
7154
+ })) {
7155
+ if ([".git", "node_modules", ".aws", ".ssh", ".npmrc", ".pypirc"].includes(
7156
+ entry.name
7157
+ ) || entry.name === ".env" || entry.name.startsWith(".env."))
7158
+ continue;
7159
+ const next = directory ? `${directory}/${entry.name}` : entry.name;
7160
+ if (entry.isSymbolicLink() || !entry.isFile() && !entry.isDirectory())
7161
+ throw new CliError(
7162
+ "usage",
7163
+ `Input contains a link or special file: ${next}`
7164
+ );
7165
+ if (entry.isDirectory()) await walk(next);
7166
+ else paths.push(next);
7167
+ if (paths.length > 2e4)
7168
+ throw new CliError("usage", "Input exceeds 20,000 files");
7169
+ }
7170
+ };
7171
+ if (info.isDirectory()) await walk("");
7172
+ else paths.push(basename(path3));
7173
+ const selected = (use.type === "files" || use.type === "binary") && use.paths ? matchInputPaths(paths, use.paths) : paths.sort();
7174
+ if (!selected.length)
7175
+ throw new CliError("usage", "Input contains no selected files");
7176
+ if (use.type === "skill" && info.isDirectory() && !selected.includes("SKILL.md"))
7177
+ throw new CliError(
7178
+ "usage",
7179
+ "Skill directory must contain SKILL.md at its root"
7180
+ );
7181
+ let total = 0;
7182
+ for (const file of selected) {
7183
+ inputPathSchema.parse(file);
7184
+ const entry = await lstat(join4(root, file));
7185
+ if (!entry.isFile())
7186
+ throw new CliError(
7187
+ "usage",
7188
+ `Input file changed or is not an ordinary file: ${file}`
7189
+ );
7190
+ total += entry.size;
7191
+ if (total > LIMIT) throw new CliError("usage", "Input exceeds 512 MiB");
7192
+ }
7193
+ await tar(
7194
+ {
7195
+ cwd: root,
7196
+ file: output,
7197
+ gzip: true,
7198
+ portable: true,
7199
+ noMtime: true,
7200
+ follow: false,
7201
+ noDirRecurse: true
7202
+ },
7203
+ // tar treats a leading @ as an instruction to read another archive.
7204
+ selected.map((file) => `./${file}`)
7205
+ );
7206
+ const bytes = (await stat(output)).size;
7207
+ if (bytes > LIMIT)
7208
+ throw new CliError("usage", "Input archive exceeds 512 MiB");
7209
+ const hash = createHash3("sha256");
7210
+ for await (const chunk of createReadStream(output)) hash.update(chunk);
7211
+ return {
7212
+ use,
7213
+ upload: { path: output, bytes, sha256: `sha256:${hash.digest("hex")}` }
7214
+ };
7215
+ }
7216
+ async function loadLocalRunDefinition(files, values, cwd = process.cwd()) {
7217
+ const directory = await mkdtemp(join4(tmpdir(), "gauge-inputs-"));
7218
+ const cleanup = () => rm(directory, { recursive: true, force: true });
7219
+ try {
7220
+ const root = rootDirectory(cwd);
7221
+ const paths = workingFiles(root);
7222
+ const blobs = /* @__PURE__ */ new Map();
7223
+ if (paths.includes("gauge.json"))
7224
+ blobs.set("gauge.json", read(root, "gauge.json"));
7225
+ const configBytes = blobs.get("gauge.json");
7226
+ const config = runDefinitionFileConfigSchema.parse(
7227
+ configBytes ? JSON.parse(configBytes.toString("utf8")) : {}
7228
+ );
7229
+ const patterns = files.length ? files.map((file) => {
7230
+ const path3 = relative2(root, resolve2(cwd, file));
7231
+ if (!path3 || path3 === ".." || path3.startsWith(`..${sep2}`) || isAbsolute2(path3))
7232
+ throw new CliError(
7233
+ "usage",
7234
+ "Case paths must be inside the definition directory"
7235
+ );
7236
+ return path3.split(sep2).join("/");
7237
+ }) : config.cases;
7238
+ const cases = matchInputPaths(paths, patterns);
7239
+ if (!cases.length || cases.length > 20 || cases.some((path3) => !path3.endsWith(".md")))
7240
+ throw new CliError("usage", "Expected 1\u201320 Markdown cases");
7241
+ for (const path3 of cases) blobs.set(path3, read(root, path3));
7242
+ const selected = new Set(
7243
+ cases.flatMap(
7244
+ (path3) => parseRunDefinitionCase(path3, blobs.get(path3) ?? Buffer.alloc(0)).config.inputs ?? Object.keys(config.inputs)
7245
+ )
7246
+ );
7247
+ const overrides = parseInputOverrides(values);
7248
+ for (const name of overrides.keys()) {
7249
+ if (!(name in config.inputs))
7250
+ throw new CliError("usage", `Unknown input: ${name}`);
7251
+ if (!selected.has(name))
7252
+ throw new CliError(
7253
+ "usage",
7254
+ `Input is not used by the selected cases: ${name}`
7255
+ );
7256
+ }
7257
+ const git3 = (args) => {
7258
+ try {
7259
+ return execFileSync2("git", args, {
7260
+ cwd: root,
7261
+ encoding: "utf8",
7262
+ stdio: ["ignore", "pipe", "pipe"]
7263
+ }).trim();
7264
+ } catch {
7265
+ return null;
7266
+ }
7267
+ };
7268
+ const commit = git3(["rev-parse", "--verify", "HEAD^{commit}"]);
7269
+ const origin = git3(["remote", "get-url", "origin"]);
7270
+ const repoUrl = origin && uncredentialedRepoUrlSchema.safeParse(origin).success ? origin : null;
7271
+ const resources = [];
7272
+ const uploads = [];
7273
+ for (const [name, input] of Object.entries(config.inputs)) {
7274
+ if (!selected.has(name)) continue;
7275
+ const original = compileDefinitionInput(
7276
+ name,
7277
+ input,
7278
+ repoUrl ?? "",
7279
+ commit ?? ""
7280
+ );
7281
+ const supplied = overrides.get(name);
7282
+ if (supplied !== void 0) {
7283
+ const { use, upload } = await packLocalInput(
7284
+ original,
7285
+ resolve2(cwd, supplied),
7286
+ join4(directory, `${name}.tar.gz`)
7287
+ );
7288
+ uploads.push(upload);
7289
+ resources.push({
7290
+ ...original,
7291
+ use,
7292
+ source: {
7293
+ type: "upload",
7294
+ sha256: upload.sha256,
7295
+ bytes: upload.bytes,
7296
+ repoUrl,
7297
+ commit
7298
+ }
7299
+ });
7300
+ } else {
7301
+ if (!repoUrl || !commit)
7302
+ throw new CliError(
7303
+ "usage",
7304
+ `Supply --input ${name}=<path>; its configured source requires a Git checkout with an origin`
7305
+ );
7306
+ resources.push(original);
7307
+ }
7308
+ }
7309
+ return {
7310
+ ...compileRunDefinitionFromBlobs({
7311
+ repoUrl,
7312
+ commit,
7313
+ resources,
7314
+ blobs,
7315
+ casePaths: cases,
7316
+ verification: "LOCAL"
7317
+ }),
7318
+ uploads,
7319
+ cleanup
7320
+ };
7321
+ } catch (error) {
7322
+ await cleanup();
7323
+ throw error;
7324
+ }
7325
+ }
7326
+ async function uploadLocalInputs(client, org, uploads) {
7327
+ for (const input of uploads) {
7328
+ const signed = await client.post(
7329
+ `/api/v1/orgs/${encodeURIComponent(org)}/run-definitions/uploads`,
7330
+ { sha256: input.sha256, bytes: input.bytes }
7331
+ );
7332
+ const signal = AbortSignal.timeout(10 * 60 * 1e3);
7333
+ for (let attempt = 0; attempt < 3; attempt++) {
7334
+ const body2 = createReadStream(input.path);
7335
+ let response;
7336
+ try {
7337
+ response = await fetch(signed.url, {
7338
+ method: "PUT",
7339
+ headers: signed.headers,
7340
+ body: body2,
7341
+ duplex: "half",
7342
+ redirect: "error",
7343
+ signal
7344
+ });
7345
+ } finally {
7346
+ body2.destroy();
7347
+ }
7348
+ await response.body?.cancel();
7349
+ if (response.ok || response.status === 412) break;
7350
+ if (response.status !== 409 || attempt === 2)
7351
+ throw new CliError(
7352
+ "network",
7353
+ `Input upload failed (${response.status})`
7354
+ );
7355
+ await delay(100 * 2 ** attempt, void 0, { signal });
7356
+ }
7357
+ }
7358
+ }
7359
+
7360
+ // src/lib/ownedConfig.ts
7361
+ function parseCadence(raw) {
7362
+ const cadence = (raw ?? "NONE").trim().toUpperCase();
7363
+ if (!["NONE", "DAILY", "WEEKLY", "MONTHLY"].includes(cadence))
7364
+ throw new CliError(
7365
+ "usage",
7366
+ `invalid cadence "${raw}" (expected none, daily, weekly, or monthly)`
7367
+ );
7368
+ return cadence;
7369
+ }
7370
+ function parseSampleCount(raw) {
7371
+ const value = Number(raw ?? "1");
7372
+ if (!Number.isSafeInteger(value) || value < 1 || value > 50)
7373
+ throw new CliError("usage", "--samples must be an integer from 1 to 50");
7374
+ return value;
7375
+ }
7376
+ function addOwnedConfigCreateOptions(command) {
7377
+ 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(
7378
+ "--agent <agent[:m1,m2]>",
7379
+ "agent and optional model pins (repeatable)",
7380
+ collect,
7381
+ []
7382
+ ).option(
7383
+ "--skill <name@label>",
7384
+ "staged skill (repeatable)",
7385
+ collect,
7386
+ []
7387
+ ).option(
7388
+ "--mcp <name@label>",
7389
+ "MCP server (repeatable)",
7390
+ collect,
7391
+ []
7392
+ ).option(
7393
+ "--connection <id>",
7394
+ "connection id (repeatable)",
7395
+ collect,
7396
+ []
7397
+ ).option("--cadence <cadence>", "none | daily | weekly | monthly", "none").option("--samples <n>", "sample count from 1 to 50", "1");
7398
+ }
7399
+ function addOwnedConfigEditOptions(command) {
7400
+ return command.option(
7401
+ "--repo <url>",
7402
+ "set the repository URL (keeps an existing ref pin)"
7403
+ ).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(
7404
+ "--agent <agent[:m1,m2]>",
7405
+ "replace agents and model pins (repeatable)",
7406
+ collect,
7407
+ []
7408
+ ).option(
7409
+ "--skill <name@label>",
7410
+ "replace skills (repeatable)",
7411
+ collect,
7412
+ []
7413
+ ).option("--clear-skills", "remove all skills").option(
7414
+ "--mcp <name@label>",
7415
+ "replace MCP servers (repeatable)",
7416
+ collect,
7417
+ []
7418
+ ).option("--clear-mcp", "remove all MCP servers").option(
7419
+ "--connection <id>",
7420
+ "replace connections (repeatable)",
7421
+ collect,
7422
+ []
7423
+ ).option("--clear-connections", "remove all connections").option("--cadence <cadence>", "none | daily | weekly | monthly").option("--samples <n>", "sample count from 1 to 50");
7424
+ }
7425
+ function ownedConfigFromOpts(opts) {
7426
+ if (opts.ref !== void 0 && opts.repo === void 0)
7427
+ throw new CliError("usage", "--ref requires --repo");
7428
+ if (opts.agent.length === 0)
7429
+ throw new CliError("usage", "at least one --agent is required");
7430
+ return {
7431
+ repoUrl: opts.repo ?? null,
7432
+ repoRef: opts.ref ?? null,
7433
+ profileId: opts.persona ?? null,
7434
+ agents: buildAgentRoster(opts.agent),
7435
+ skillRefs: validateAssetRefs("skill", opts.skill),
7436
+ mcpRefs: validateAssetRefs("mcp", opts.mcp),
7437
+ connectionIds: opts.connection,
7438
+ cadence: parseCadence(opts.cadence),
7439
+ sampleCount: parseSampleCount(opts.samples)
7440
+ };
7441
+ }
7442
+ function ownedConfigPatchFromOpts(opts) {
7443
+ const patch = {};
7444
+ if ((opts.repo !== void 0 || opts.ref !== void 0) && opts.clearRepo)
7445
+ throw new CliError("usage", "--repo/--ref and --clear-repo conflict");
7446
+ if (opts.ref !== void 0 && opts.clearRef)
7447
+ throw new CliError("usage", "--ref and --clear-ref conflict");
7448
+ if (opts.clearRepo) {
7449
+ patch.repoUrl = null;
7450
+ patch.repoRef = null;
7451
+ } else {
7452
+ if (opts.repo !== void 0) patch.repoUrl = opts.repo;
7453
+ if (opts.clearRef) patch.repoRef = null;
7454
+ else if (opts.ref !== void 0) patch.repoRef = opts.ref;
7455
+ }
7456
+ if (opts.persona !== void 0 && opts.clearPersona)
7457
+ throw new CliError("usage", "--persona and --clear-persona conflict");
7458
+ if (opts.clearPersona) patch.profileId = null;
7459
+ else if (opts.persona !== void 0) patch.profileId = opts.persona;
7460
+ if (opts.agent.length > 0) patch.agents = buildAgentRoster(opts.agent);
7461
+ if (opts.skill.length > 0 && opts.clearSkills)
7462
+ throw new CliError("usage", "--skill and --clear-skills conflict");
7463
+ if (opts.clearSkills) patch.skillRefs = [];
7464
+ else if (opts.skill.length > 0)
7465
+ patch.skillRefs = validateAssetRefs("skill", opts.skill);
7466
+ if (opts.mcp.length > 0 && opts.clearMcp)
7467
+ throw new CliError("usage", "--mcp and --clear-mcp conflict");
7468
+ if (opts.clearMcp) patch.mcpRefs = [];
7469
+ else if (opts.mcp.length > 0)
7470
+ patch.mcpRefs = validateAssetRefs("mcp", opts.mcp);
7471
+ if (opts.connection.length > 0 && opts.clearConnections)
7472
+ throw new CliError(
7473
+ "usage",
7474
+ "--connection and --clear-connections conflict"
7475
+ );
7476
+ if (opts.clearConnections) patch.connectionIds = [];
7477
+ else if (opts.connection.length > 0) patch.connectionIds = opts.connection;
7478
+ if (opts.cadence !== void 0) patch.cadence = parseCadence(opts.cadence);
7479
+ if (opts.samples !== void 0)
7480
+ patch.sampleCount = parseSampleCount(opts.samples);
7481
+ return patch;
7482
+ }
7483
+ function addRunSettingsCreateOptions(command) {
7484
+ return command.option(
7485
+ "--agent <agent[:m1,m2]>",
7486
+ "agent and optional model pins (repeatable)",
7487
+ collect,
7488
+ []
7489
+ ).option(
7490
+ "--skill <name@label>",
7491
+ "staged skill (repeatable)",
7492
+ collect,
7493
+ []
7494
+ ).option(
7495
+ "--mcp <name@label>",
7496
+ "MCP server (repeatable)",
7497
+ collect,
7498
+ []
7499
+ ).option(
7500
+ "--connection <id>",
7501
+ "connection id (repeatable)",
7502
+ collect,
7503
+ []
7504
+ ).option("--cadence <cadence>", "none | daily | weekly | monthly", "none").option("--samples <n>", "sample count from 1 to 50", "1");
7505
+ }
7506
+ function addRunSettingsEditOptions(command) {
7507
+ return command.option(
7508
+ "--agent <agent[:m1,m2]>",
7509
+ "replace agents and model pins (repeatable)",
7510
+ collect,
7511
+ []
7512
+ ).option(
7513
+ "--skill <name@label>",
7514
+ "replace skills (repeatable)",
7515
+ collect,
7516
+ []
7517
+ ).option("--clear-skills", "remove all skills").option(
7518
+ "--mcp <name@label>",
7519
+ "replace MCP servers (repeatable)",
7520
+ collect,
7521
+ []
7522
+ ).option("--clear-mcp", "remove all MCP servers").option(
7523
+ "--connection <id>",
7524
+ "replace connections (repeatable)",
7525
+ collect,
7526
+ []
7527
+ ).option("--clear-connections", "remove all connections").option("--cadence <cadence>", "none | daily | weekly | monthly").option("--samples <n>", "sample count from 1 to 50");
7528
+ }
7529
+ function hasRunSettingsFlags(opts) {
7530
+ return opts.agent.length > 0 || opts.skill.length > 0 || opts.mcp.length > 0 || opts.connection.length > 0 || opts.cadence.toUpperCase() !== "NONE" || opts.samples !== "1";
7531
+ }
7532
+ function runSettingsFromOpts(opts) {
7533
+ return {
7534
+ ...opts.agent.length > 0 ? { agents: buildAgentRoster(opts.agent) } : {},
7535
+ skillRefs: validateAssetRefs("skill", opts.skill),
7536
+ mcpRefs: validateAssetRefs("mcp", opts.mcp),
7537
+ connectionIds: opts.connection,
7538
+ cadence: parseCadence(opts.cadence),
7539
+ sampleCount: parseSampleCount(opts.samples)
7540
+ };
7541
+ }
7542
+ function runSettingsPatchFromOpts(opts) {
7543
+ return ownedConfigPatchFromOpts(opts);
7544
+ }
7545
+ function cadenceLabel(cadence) {
7546
+ return cadence === "NONE" ? "manual" : cadence.toLowerCase();
7547
+ }
7548
+
7549
+ // src/lib/runDefinitionFiles.ts
7550
+ import { execFileSync as execFileSync3 } from "child_process";
7551
+ import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve3, sep as sep3 } from "path";
7552
+ function git2(cwd, args) {
7145
7553
  try {
7146
- files = workingFiles(root);
7554
+ return execFileSync3("git", args, {
7555
+ cwd,
7556
+ encoding: "buffer",
7557
+ maxBuffer: 10 * 1024 * 1024,
7558
+ stdio: ["ignore", "pipe", "pipe"]
7559
+ });
7147
7560
  } catch (error) {
7148
- result.global.push(check("working-tree", "no", message(error)));
7149
- return finish();
7561
+ const detail = error && typeof error === "object" && "stderr" in error ? String(error.stderr).trim() : String(error);
7562
+ throw new CliError("usage", `git ${args[0]} failed: ${detail}`);
7150
7563
  }
7564
+ }
7565
+ function committedBlob(root, commit, path3) {
7566
+ return git2(root, ["show", `${commit}:${path3}`]);
7567
+ }
7568
+ function relativeGitPath(root, cwd, input) {
7569
+ if (!input || input.includes("\0"))
7570
+ throw new CliError("usage", `expected a case path or glob: ${input}`);
7571
+ const absolute = resolve3(cwd, input);
7572
+ const path3 = relative3(root, absolute);
7573
+ if (!path3 || path3 === ".." || path3.startsWith(`..${sep3}`) || isAbsolute3(path3))
7574
+ throw new CliError(
7575
+ "usage",
7576
+ `case path is outside this Git repository: ${input}`
7577
+ );
7578
+ const gitPath = path3.split(sep3).join("/");
7579
+ return gitPath;
7580
+ }
7581
+ function loadCommittedRunDefinitionWithContext(files = [], cwd = process.cwd()) {
7582
+ const root = git2(cwd, ["rev-parse", "--show-toplevel"]).toString("utf8").trim();
7583
+ const commit = git2(root, ["rev-parse", "--verify", "HEAD^{commit}"]).toString("utf8").trim();
7584
+ let repoUrl;
7151
7585
  try {
7152
- result.facts.configFilePresent = files.includes("gauge.json") || regularFile(root, "gauge.json");
7153
- if (result.facts.configFilePresent)
7154
- raw = JSON.parse(read(root, "gauge.json").toString("utf8"));
7155
- else
7156
- result.info.push({
7157
- id: "config-file-absent",
7158
- detail: "Optional gauge.json is absent; using default case discovery and no inputs"
7159
- });
7586
+ repoUrl = git2(root, ["remote", "get-url", "origin"]).toString("utf8").trim();
7587
+ } catch {
7588
+ throw new CliError(
7589
+ "usage",
7590
+ "Git origin is required to identify the committed definition repository"
7591
+ );
7592
+ }
7593
+ if (!uncredentialedRepoUrlSchema.safeParse(repoUrl).success)
7594
+ throw new CliError(
7595
+ "usage",
7596
+ "Git origin must be a repository URL without embedded credentials or query parameters"
7597
+ );
7598
+ const blobs = /* @__PURE__ */ new Map();
7599
+ const hasConfig = git2(root, ["ls-tree", "--name-only", commit, "--", "gauge.json"]).toString("utf8").trim() === "gauge.json";
7600
+ if (hasConfig) {
7601
+ blobs.set("gauge.json", committedBlob(root, commit, "gauge.json"));
7602
+ }
7603
+ let paths;
7604
+ try {
7605
+ const config = runDefinitionFileConfigSchema.parse(
7606
+ blobs.has("gauge.json") ? JSON.parse(blobs.get("gauge.json").toString("utf8")) : {}
7607
+ );
7608
+ 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));
7609
+ const patterns = files.length ? files.map((file) => relativeGitPath(root, cwd, file)) : config.cases;
7610
+ paths = matchInputPaths(tree, patterns);
7611
+ if (paths.length > 20 || paths.some((path3) => !path3.endsWith(".md")))
7612
+ throw new Error("Expected 1\u201320 committed Markdown cases");
7613
+ for (const path3 of paths)
7614
+ blobs.set(path3, committedBlob(root, commit, path3));
7160
7615
  } catch (error) {
7161
- result.global.push(check("configuration", "no", message(error)));
7162
- return finish();
7616
+ throw new CliError(
7617
+ "usage",
7618
+ error instanceof Error ? error.message : String(error)
7619
+ );
7163
7620
  }
7164
- const config = runDefinitionFileConfigSchema.safeParse(raw);
7165
- result.global.push(
7166
- check(
7167
- "configuration",
7168
- config.success ? "yes" : "no",
7169
- config.success ? "Configuration matches the supported gauge.json schema" : config.error.message
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)]
7621
+ try {
7622
+ const result = compileRunDefinitionFromBlobs({
7623
+ repoUrl,
7624
+ commit,
7625
+ casePaths: paths,
7626
+ blobs,
7627
+ verification: "SUBMITTED_UNVERIFIED"
7180
7628
  });
7629
+ return { definition: result.definition, org: result.org };
7630
+ } catch (error) {
7631
+ throw new CliError(
7632
+ "usage",
7633
+ error instanceof Error ? error.message : String(error)
7634
+ );
7181
7635
  }
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
7636
  }
7253
- function printEvalVerification(result) {
7254
- console.log(`Local static verification: ${result.root}`);
7255
- const print = (checks) => {
7256
- for (const item of checks)
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
- );
7637
+
7638
+ // src/lib/staff.ts
7639
+ function staffCommandsVisible(config = readConfig()) {
7640
+ return config.staff === true;
7273
7641
  }
7274
7642
 
7275
7643
  // src/commands/evals.ts
@@ -7358,63 +7726,73 @@ function register12(program2) {
7358
7726
  else printEvalVerification(result);
7359
7727
  if (result.summary.no > 0) process.exitCode = 1;
7360
7728
  });
7361
- group.command("plan").description(
7362
- "Validate committed Markdown cases and preview a Git-native run"
7363
- ).option(
7729
+ group.command("plan").description("Preview evaluation cases without starting sessions").option(
7364
7730
  "--files <paths...>",
7365
- "committed Markdown paths or globs (default gauge-evals/**/*.md)"
7366
- ).action(async (opts, cmd) => {
7367
- const { definition, org: fileOrg } = loadCommittedRunDefinitionWithContext(opts.files ?? []);
7368
- const org = resolveOrg(cmd, fileOrg);
7369
- const result = await createClient().post(
7370
- `/api/v1/orgs/${encodeURIComponent(org)}/run-definitions/plan`,
7371
- definition
7372
- );
7373
- if (resolveOutput(cmd) === "json") {
7374
- printJson(result);
7375
- return;
7376
- }
7377
- console.log(
7378
- `Definition: ${result.source.commit} (${result.source.digest})`
7379
- );
7380
- console.log(
7381
- "Provenance: submitted by CLI; server has not verified Git bytes"
7382
- );
7383
- console.log(`Expected sessions: ${result.expectedRuns}`);
7384
- for (const item of result.cases)
7731
+ "Markdown paths or globs (default gauge-evals/**/*.md)"
7732
+ ).option(
7733
+ "--input <name=path>",
7734
+ "supply a local input and use current eval files (repeatable)",
7735
+ collect,
7736
+ []
7737
+ ).action(
7738
+ async (opts, cmd) => {
7739
+ const local = opts.input.length ? await loadLocalRunDefinition(opts.files ?? [], opts.input) : void 0;
7740
+ const { definition, org: fileOrg } = local ?? loadCommittedRunDefinitionWithContext(opts.files ?? []);
7741
+ let org;
7742
+ try {
7743
+ org = resolveOrg(cmd, fileOrg);
7744
+ if (local)
7745
+ await uploadLocalInputs(createClient(), org, local.uploads);
7746
+ } finally {
7747
+ await local?.cleanup();
7748
+ }
7749
+ const result = await createClient().post(
7750
+ `/api/v1/orgs/${encodeURIComponent(org)}/run-definitions/plan`,
7751
+ definition
7752
+ );
7753
+ if (resolveOutput(cmd) === "json") {
7754
+ printJson(result);
7755
+ return;
7756
+ }
7385
7757
  console.log(
7386
- ` ${item.path}: ${item.expectedRuns} sessions, ${item.preference ? `${item.preference.kind} preference (advisory)` : `${item.criteriaCount} criteria`}`
7758
+ `Definition: ${result.source.verification === "LOCAL" ? "current files" : result.source.commit}`
7387
7759
  );
7388
- for (const resource of result.resources) {
7389
- const use = resource.use;
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";
7394
- console.log(
7395
- ` ${label}: ${resource.commands === void 0 ? "determined when the input is prepared" : resource.commands.join(", ") || "none (library)"}`
7396
- );
7397
- } else if (use.type === "binary") {
7398
- console.log(
7399
- ` ${resource.name}: native executable \u2192 ${use.platform}`
7400
- );
7760
+ console.log(`Expected sessions: ${result.expectedRuns}`);
7761
+ for (const item of result.cases)
7401
7762
  console.log(
7402
- ` Commands on PATH: ${Object.keys(use.commands).join(", ")}`
7763
+ ` ${item.path}: ${item.expectedRuns} sessions, ${item.preference ? `${item.preference.kind} preference (advisory)` : `${item.criteriaCount} criteria`}`
7403
7764
  );
7765
+ for (const resource of result.resources) {
7766
+ const use = resource.use;
7767
+ if (use.type === "npm-package" || use.type === "npm-cli") {
7768
+ const install = use.install ?? "environment";
7769
+ console.log(` ${resource.name}: npm package \u2192 ${install}`);
7770
+ const label = install === "environment" ? "Commands on PATH" : "Package commands";
7771
+ console.log(
7772
+ ` ${label}: ${resource.commands === void 0 ? "determined when the input is prepared" : resource.commands.join(", ") || "none (library)"}`
7773
+ );
7774
+ } else if (use.type === "binary") {
7775
+ console.log(
7776
+ ` ${resource.name}: native executable \u2192 ${use.platform}`
7777
+ );
7778
+ console.log(
7779
+ ` Commands on PATH: ${Object.keys(use.commands).join(", ")}`
7780
+ );
7781
+ console.log(
7782
+ " Requires compatible system libraries; Gauge does not install OS packages."
7783
+ );
7784
+ } else console.log(` ${resource.name}: ${use.type}`);
7785
+ if (resource.detail) console.log(` ${resource.detail}`);
7786
+ }
7787
+ if (result.resources.length) {
7404
7788
  console.log(
7405
- " Requires compatible system libraries; Gauge does not install OS packages."
7789
+ `Inputs: ${result.resources.map((r) => `${r.name} (${r.source}, ${r.readiness})`).join(", ")}`
7406
7790
  );
7407
- } else console.log(` ${resource.name}: ${use.type}`);
7408
- if (resource.detail) console.log(` ${resource.detail}`);
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.");
7791
+ if (!result.canRun)
7792
+ console.log("Resolve the input errors before launching.");
7793
+ }
7416
7794
  }
7417
- });
7795
+ );
7418
7796
  group.command("list").description("List the org's eval sets with pass-rate stats").option(
7419
7797
  "--agents <agents>",
7420
7798
  "filter stats to these agents, e.g. claude-code,codex"
@@ -7535,7 +7913,7 @@ function register12(program2) {
7535
7913
  if (resolveOutput(cmd) !== "json") console.log(`Deleted eval set ${id2}`);
7536
7914
  });
7537
7915
  group.command("run [id]").description(
7538
- staffCommandsVisible() ? "Run an eval set now with its stored configuration (superusers run without billing the org by default)" : "Run an eval set now with its stored configuration"
7916
+ 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
7917
  ).addOption(
7540
7918
  new Option2(
7541
7919
  "--bill-to-org",
@@ -7543,18 +7921,31 @@ function register12(program2) {
7543
7921
  ).hideHelp(!staffCommandsVisible())
7544
7922
  ).option(
7545
7923
  "--files <paths...>",
7546
- "committed Markdown paths or globs (default gauge-evals/**/*.md)"
7924
+ "Markdown paths or globs (default gauge-evals/**/*.md)"
7925
+ ).option(
7926
+ "--input <name=path>",
7927
+ "supply a local input and use current eval files (repeatable)",
7928
+ collect,
7929
+ []
7547
7930
  ).option("--yes", "skip the confirmation").action(
7548
7931
  async (id2, opts, cmd) => {
7549
- if (opts.files !== void 0 || id2 === void 0) {
7932
+ if (opts.files !== void 0 || opts.input.length || id2 === void 0) {
7550
7933
  if (id2 !== void 0)
7551
7934
  throw new CliError(
7552
7935
  "usage",
7553
- "pass either an eval ID or --files, not both"
7936
+ "pass either an eval ID or file-based options, not both"
7554
7937
  );
7555
- const { definition, org: fileOrg } = loadCommittedRunDefinitionWithContext(opts.files ?? []);
7556
- const org2 = resolveOrg(cmd, fileOrg);
7557
- await confirmOrAbort("Run these committed eval cases now?", opts.yes);
7938
+ const local = opts.input.length ? await loadLocalRunDefinition(opts.files ?? [], opts.input) : void 0;
7939
+ const { definition, org: fileOrg } = local ?? loadCommittedRunDefinitionWithContext(opts.files ?? []);
7940
+ let org2;
7941
+ try {
7942
+ org2 = resolveOrg(cmd, fileOrg);
7943
+ await confirmOrAbort("Run these eval cases now?", opts.yes);
7944
+ if (local)
7945
+ await uploadLocalInputs(createClient(), org2, local.uploads);
7946
+ } finally {
7947
+ await local?.cleanup();
7948
+ }
7558
7949
  const result2 = await createClient().post(
7559
7950
  `/api/v1/orgs/${encodeURIComponent(org2)}/run-definitions/run`,
7560
7951
  definition,
@@ -7565,7 +7956,9 @@ function register12(program2) {
7565
7956
  console.log(
7566
7957
  `Started ${result2.createdRuns}/${result2.requestedRuns} sessions in request ${result2.runRequestId}`
7567
7958
  );
7568
- console.log(`Wait: gauge run-requests wait ${result2.runRequestId}`);
7959
+ console.log(
7960
+ `Wait: gauge --org ${org2} run-requests wait ${result2.runRequestId}`
7961
+ );
7569
7962
  }
7570
7963
  return;
7571
7964
  }
@@ -7648,7 +8041,7 @@ __export(instructions_exports, {
7648
8041
  register: () => register13
7649
8042
  });
7650
8043
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
7651
- import { join as join4 } from "path";
8044
+ import { join as join5 } from "path";
7652
8045
 
7653
8046
  // src/instructions/evals.ts
7654
8047
  var EVALS = `---
@@ -7667,6 +8060,9 @@ description: Create and review Gauge eval prompts, model selections, and judging
7667
8060
  - 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
8061
  - 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
8062
  - 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.
8063
+ - 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, choose **Require approval**; 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.
8064
+ - 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.
8065
+ - 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
8066
  - 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
8067
 
7672
8068
  ## Model selection
@@ -7695,14 +8091,10 @@ A bad version of this migration prompt would add specific features, such as a fl
7695
8091
 
7696
8092
  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
8093
 
7698
- For the migration, express the user's goal:
7699
-
7700
8094
  > 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
8095
 
7702
8096
  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
8097
 
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
8098
  ### Define observable success
7707
8099
 
7708
8100
  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.
@@ -7934,8 +8326,8 @@ function register13(program2) {
7934
8326
  return;
7935
8327
  }
7936
8328
  const name = topic ? resolveTopic(topic).name : TOPICS.root.name;
7937
- const dir = join4(opts.dir ?? INSTALL_ROOT, name);
7938
- const path3 = join4(dir, "SKILL.md");
8329
+ const dir = join5(opts.dir ?? INSTALL_ROOT, name);
8330
+ const path3 = join5(dir, "SKILL.md");
7939
8331
  mkdirSync3(dir, { recursive: true });
7940
8332
  writeFileSync3(path3, markdown);
7941
8333
  console.log(`Wrote ${path3}`);
@@ -8424,7 +8816,7 @@ __export(optimizations_exports2, {
8424
8816
  watchStops: () => watchStops
8425
8817
  });
8426
8818
  import { readdirSync as readdirSync2, readFileSync as readFileSync9, statSync } from "fs";
8427
- import { join as join5, relative as relative3, sep as sep3 } from "path";
8819
+ import { join as join6, relative as relative4, sep as sep4 } from "path";
8428
8820
  var TERMINAL = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
8429
8821
  function basePath(org) {
8430
8822
  return `/api/v1/orgs/${encodeURIComponent(org)}/optimizations`;
@@ -8440,7 +8832,7 @@ function readText(path3) {
8440
8832
  return readFileSync9(path3 === "-" ? 0 : path3, "utf8");
8441
8833
  }
8442
8834
  function sleep2(ms) {
8443
- return new Promise((resolve3) => setTimeout(resolve3, ms));
8835
+ return new Promise((resolve4) => setTimeout(resolve4, ms));
8444
8836
  }
8445
8837
  function parseSubject(opts) {
8446
8838
  if (opts.eval && opts.preference)
@@ -8515,7 +8907,7 @@ function readSkillDir(dir, read2 = readText, walk = listFiles) {
8515
8907
  if (!paths.length)
8516
8908
  throw new CliError("usage", `no files under ${dir} to send`);
8517
8909
  const files = paths.map((path3) => ({
8518
- path: relative3(dir, path3).split(sep3).join("/"),
8910
+ path: relative4(dir, path3).split(sep4).join("/"),
8519
8911
  body: read2(path3)
8520
8912
  }));
8521
8913
  if (!files.some((file) => file.path === "SKILL.md"))
@@ -8533,7 +8925,7 @@ function listFiles(dir) {
8533
8925
  throw new CliError("usage", `cannot read the directory ${dir}`);
8534
8926
  }
8535
8927
  return entries.flatMap((entry) => {
8536
- const path3 = join5(dir, entry);
8928
+ const path3 = join6(dir, entry);
8537
8929
  return statSync(path3).isDirectory() ? listFiles(path3) : [path3];
8538
8930
  });
8539
8931
  }
@@ -9909,7 +10301,7 @@ function register25(program2) {
9909
10301
  );
9910
10302
  return;
9911
10303
  }
9912
- await new Promise((resolve3) => setTimeout(resolve3, pollIntervalMs));
10304
+ await new Promise((resolve4) => setTimeout(resolve4, pollIntervalMs));
9913
10305
  }
9914
10306
  });
9915
10307
  }