@felspar/sdk 0.1.1 → 0.2.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.
@@ -505,16 +505,16 @@ async function packContentParts(value) {
505
505
  }
506
506
 
507
507
  // ../schemas/src/draft-application-access.ts
508
- import { z as z41 } from "zod";
508
+ import { z as z43 } from "zod";
509
509
 
510
510
  // ../schemas/src/draft-job-handoff.ts
511
- import { z as z40 } from "zod";
511
+ import { z as z42 } from "zod";
512
512
 
513
513
  // ../schemas/src/draft-requirements.ts
514
- import { z as z34 } from "zod";
514
+ import { z as z37 } from "zod";
515
515
 
516
516
  // ../schemas/src/draft-required-origins.ts
517
- import { z as z32 } from "zod";
517
+ import { z as z35 } from "zod";
518
518
 
519
519
  // ../schemas/src/draft-required-decision.ts
520
520
  import { z as z15 } from "zod";
@@ -1513,7 +1513,7 @@ function inspectScoredPolicy(proposal, context3) {
1513
1513
  }
1514
1514
  inspectScoringReferences(scoring, proposal.requirements, context3);
1515
1515
  const ids3 = new Set(rules2.map((rule3) => rule3.id));
1516
- if (gates.some((id11) => !ids3.has(id11))) {
1516
+ if (gates.some((id12) => !ids3.has(id12))) {
1517
1517
  fail("Unknown mandatory gate rule");
1518
1518
  }
1519
1519
  if (rules2.every((rule3) => gates.includes(rule3.id))) {
@@ -1526,7 +1526,7 @@ function inspectScoredPolicy(proposal, context3) {
1526
1526
  if (isGate ? hasRange || rule3.when.length === 0 : !hasRange) {
1527
1527
  fail("Mandatory gates require fact predicates only; other rules require score ranges");
1528
1528
  }
1529
- if (rule3.overrides.some((id11) => gates.includes(id11) !== isGate)) {
1529
+ if (rule3.overrides.some((id12) => gates.includes(id12) !== isGate)) {
1530
1530
  fail("Explicit overrides cannot cross mandatory-gate and score-band classes");
1531
1531
  }
1532
1532
  const range2 = rule3.scoreRange;
@@ -1614,19 +1614,19 @@ function hasCycle(rules2) {
1614
1614
  const graph = new Map(rules2.map((item) => [item.id, item.overrides]));
1615
1615
  const visiting = /* @__PURE__ */ new Set();
1616
1616
  const visited = /* @__PURE__ */ new Set();
1617
- const hasPathCycle = (id11) => {
1618
- if (visiting.has(id11)) {
1617
+ const hasPathCycle = (id12) => {
1618
+ if (visiting.has(id12)) {
1619
1619
  return true;
1620
1620
  }
1621
- if (visited.has(id11)) {
1621
+ if (visited.has(id12)) {
1622
1622
  return false;
1623
1623
  }
1624
- visiting.add(id11);
1625
- if ((graph.get(id11) ?? []).some(hasPathCycle)) {
1624
+ visiting.add(id12);
1625
+ if ((graph.get(id12) ?? []).some(hasPathCycle)) {
1626
1626
  return true;
1627
1627
  }
1628
- visiting.delete(id11);
1629
- visited.add(id11);
1628
+ visiting.delete(id12);
1629
+ visited.add(id12);
1630
1630
  return false;
1631
1631
  };
1632
1632
  return rules2.some((item) => hasPathCycle(item.id));
@@ -1655,11 +1655,11 @@ function inspectRules(proposal, context3) {
1655
1655
  fail("Undeclared condition key or value");
1656
1656
  }
1657
1657
  }
1658
- if (item.overrides.some((id11) => id11 === item.id || !ids3.has(id11))) {
1658
+ if (item.overrides.some((id12) => id12 === item.id || !ids3.has(id12))) {
1659
1659
  fail("Unknown or self override");
1660
1660
  }
1661
- if (item.overrides.some((id11) => {
1662
- const target = byId.get(id11);
1661
+ if (item.overrides.some((id12) => {
1662
+ const target = byId.get(id12);
1663
1663
  return target !== void 0 && draftRulePriority(target) > draftRulePriority(item);
1664
1664
  })) {
1665
1665
  fail("Override points to a higher priority tier");
@@ -1832,8 +1832,8 @@ function checkExpected(candidate2, context3) {
1832
1832
  }
1833
1833
  unique2(result.observationIds, context3, ["expected", "observationIds"]);
1834
1834
  const observationIds = new Set(candidate2.observations.map((entry2) => entry2.id));
1835
- for (const [index, id11] of result.observationIds.entries()) {
1836
- requireBinding2(observationIds.has(id11), context3, {
1835
+ for (const [index, id12] of result.observationIds.entries()) {
1836
+ requireBinding2(observationIds.has(id12), context3, {
1837
1837
  path: ["expected", "observationIds", index],
1838
1838
  message: "Unknown observation"
1839
1839
  });
@@ -2475,17 +2475,17 @@ var DraftRequiredNormalizationSchema = z25.strictObject({
2475
2475
  });
2476
2476
 
2477
2477
  // ../schemas/src/draft-required-context.ts
2478
- import { z as z31 } from "zod";
2478
+ import { z as z34 } from "zod";
2479
2479
 
2480
2480
  // ../schemas/src/draft-context-selection.ts
2481
- import { z as z28 } from "zod";
2481
+ import { z as z31 } from "zod";
2482
2482
 
2483
2483
  // ../schemas/src/draft-context.ts
2484
2484
  import { z as z27 } from "zod";
2485
2485
 
2486
2486
  // ../schemas/src/draft-primitive-mapping.ts
2487
2487
  import { z as z26 } from "zod";
2488
- var authorityPrimitives = [
2488
+ var requiredAuthorityPrimitives = [
2489
2489
  "actors",
2490
2490
  "decision_criteria",
2491
2491
  "source_signals",
@@ -2497,6 +2497,14 @@ var authorityPrimitives = [
2497
2497
  "gaps",
2498
2498
  "evaluations"
2499
2499
  ];
2500
+ var authorityPrimitives = [
2501
+ ...requiredAuthorityPrimitives,
2502
+ "subjects"
2503
+ ];
2504
+ function coversAuthorityPrimitives(listed) {
2505
+ const isSized = listed.length >= requiredAuthorityPrimitives.length && listed.length <= authorityPrimitives.length;
2506
+ return isSized && requiredAuthorityPrimitives.every((primitive) => listed.includes(primitive));
2507
+ }
2500
2508
  var label = z26.string().trim().min(1).max(2e3);
2501
2509
  var id = z26.string().min(1).max(200);
2502
2510
  var reference5 = z26.discriminatedUnion("kind", [
@@ -2519,7 +2527,8 @@ var kinds = {
2519
2527
  output_contracts: ["outcomes"],
2520
2528
  routing_jobs: ["job"],
2521
2529
  gaps: ["expectation"],
2522
- evaluations: ["expectation"]
2530
+ evaluations: ["expectation"],
2531
+ subjects: []
2523
2532
  };
2524
2533
  var category = z26.enum(authorityPrimitives);
2525
2534
  var row = z26.discriminatedUnion("status", [
@@ -2535,8 +2544,11 @@ var row = z26.discriminatedUnion("status", [
2535
2544
  var DraftPrimitiveMappingSchema = z26.strictObject({
2536
2545
  schema: z26.literal("felspar.primitive-mapping.draft/v0"),
2537
2546
  caseId: id,
2538
- rows: z26.array(row).length(authorityPrimitives.length)
2547
+ rows: z26.array(row).min(requiredAuthorityPrimitives.length).max(authorityPrimitives.length)
2539
2548
  }).superRefine((mapping, context3) => {
2549
+ if (!coversAuthorityPrimitives(mapping.rows.map((entry2) => entry2.primitive))) {
2550
+ context3.addIssue({ code: "custom", path: ["rows"], message: "Every category is explicit" });
2551
+ }
2540
2552
  const seen = /* @__PURE__ */ new Set();
2541
2553
  for (const [index, entry2] of mapping.rows.entries()) {
2542
2554
  const path3 = ["rows", index];
@@ -2717,39 +2729,342 @@ var DraftContextInputSchema = z27.strictObject({
2717
2729
  expectedPlanDigest: reference6.shape.contentDigest
2718
2730
  });
2719
2731
 
2732
+ // ../schemas/src/draft-pack-subjects.ts
2733
+ import { z as z30 } from "zod";
2734
+
2735
+ // ../schemas/src/draft-pack-draft-typed.ts
2736
+ import { z as z29 } from "zod";
2737
+
2738
+ // ../schemas/src/draft-exact-reader.ts
2739
+ import { z as z28 } from "zod";
2740
+ var exactNumberReaderVersion = "felspar.exact-number/v2";
2741
+ var exactDateReaderVersion = "felspar.exact-date/v2";
2742
+ var numberStyles = ["1,234.56", "1.234,56", "1 234,56", "1'234.56"];
2743
+ var dateOrders = ["unstated", "month-first", "day-first"];
2744
+ var knownCurrencies = [
2745
+ "AED",
2746
+ "ARS",
2747
+ "AUD",
2748
+ "BRL",
2749
+ "CAD",
2750
+ "CHF",
2751
+ "CLP",
2752
+ "CNY",
2753
+ "COP",
2754
+ "CZK",
2755
+ "DKK",
2756
+ "EGP",
2757
+ "EUR",
2758
+ "GBP",
2759
+ "HKD",
2760
+ "HUF",
2761
+ "IDR",
2762
+ "ILS",
2763
+ "INR",
2764
+ "ISK",
2765
+ "JPY",
2766
+ "KES",
2767
+ "KRW",
2768
+ "MXN",
2769
+ "MYR",
2770
+ "NGN",
2771
+ "NOK",
2772
+ "NZD",
2773
+ "PEN",
2774
+ "PHP",
2775
+ "PKR",
2776
+ "PLN",
2777
+ "RON",
2778
+ "RUB",
2779
+ "SAR",
2780
+ "SEK",
2781
+ "SGD",
2782
+ "THB",
2783
+ "TRY",
2784
+ "TWD",
2785
+ "UAH",
2786
+ "USD",
2787
+ "VND",
2788
+ "ZAR"
2789
+ ];
2790
+ var knownCurrencySet = new Set(knownCurrencies);
2791
+ function isKnownCurrency(code) {
2792
+ return knownCurrencySet.has(code);
2793
+ }
2794
+ var UnitWordSchema = z28.string().min(1).max(64).regex(/^\p{L}[\p{L}\p{N}'’ -]*\p{L}$|^\p{L}$/u, "Use a word or short phrase");
2795
+ var ExactNumberUnitSchema = z28.discriminatedUnion("kind", [
2796
+ z28.strictObject({
2797
+ kind: z28.literal("currency"),
2798
+ code: z28.string().regex(/^[A-Z]{3}$/u).refine(isKnownCurrency, "Not a currency code the reader recognises")
2799
+ }),
2800
+ z28.strictObject({ kind: z28.literal("percent") }),
2801
+ z28.strictObject({
2802
+ kind: z28.literal("count"),
2803
+ words: z28.array(UnitWordSchema).min(1).max(16).refine((words) => hasUniqueValues(words.map((word) => word.toLowerCase())), "Duplicate unit word")
2804
+ })
2805
+ ]);
2806
+ var ExactReaderSchema = z28.discriminatedUnion("version", [
2807
+ z28.strictObject({
2808
+ version: z28.literal(exactNumberReaderVersion),
2809
+ unit: ExactNumberUnitSchema,
2810
+ numberStyle: z28.enum(numberStyles)
2811
+ }),
2812
+ z28.strictObject({
2813
+ version: z28.literal(exactDateReaderVersion),
2814
+ dateOrder: z28.enum(dateOrders)
2815
+ })
2816
+ ]);
2817
+
2818
+ // ../schemas/src/draft-pack-draft-typed.ts
2819
+ var draftIdentifier = z29.string().min(1).max(128).regex(/^[a-z0-9][a-z0-9_-]*$/u, "Use lowercase letters, digits, - and _");
2820
+ var draftQuote = z29.string().min(1).max(4e3);
2821
+ var draftValue = draftIdentifier;
2822
+ var dayOffset = z29.number().int().min(-3660).max(3660);
2823
+ var PackDraftBoundSchema = z29.union([
2824
+ z29.number(),
2825
+ CalendarDateSchema,
2826
+ z29.strictObject({ question: draftIdentifier, days: dayOffset }),
2827
+ z29.strictObject({ decisionDate: dayOffset })
2828
+ ]);
2829
+ var PackDraftComparisonSchema = z29.strictObject({
2830
+ lt: PackDraftBoundSchema.optional(),
2831
+ lte: PackDraftBoundSchema.optional(),
2832
+ gt: PackDraftBoundSchema.optional(),
2833
+ gte: PackDraftBoundSchema.optional(),
2834
+ eq: PackDraftBoundSchema.optional(),
2835
+ quote: draftQuote
2836
+ }).superRefine((value, context3) => {
2837
+ const lower = Number(value.gt !== void 0) + Number(value.gte !== void 0);
2838
+ const upper = Number(value.lt !== void 0) + Number(value.lte !== void 0);
2839
+ const hasEquality = value.eq !== void 0;
2840
+ if (lower + upper + Number(hasEquality) === 0) {
2841
+ context3.addIssue({ code: "custom", message: "Give a bound: lt, lte, gt, gte or eq" });
2842
+ } else if (lower > 1 || upper > 1) {
2843
+ context3.addIssue({ code: "custom", message: "At most one lower and one upper bound" });
2844
+ } else if (hasEquality && lower + upper > 0) {
2845
+ context3.addIssue({ code: "custom", message: "eq stands alone" });
2846
+ }
2847
+ });
2848
+ var PackDraftConditionSchema = z29.union([
2849
+ draftValue,
2850
+ z29.array(draftValue).min(2).max(64),
2851
+ PackDraftComparisonSchema
2852
+ ]);
2853
+ var PackDraftConditionsSchema = z29.record(draftIdentifier, PackDraftConditionSchema);
2854
+ var questionTypes = ["number", "date"];
2855
+ var typedQuestionFields = {
2856
+ type: z29.enum(questionTypes).optional(),
2857
+ unit: z29.string().min(1).max(64).optional(),
2858
+ unitWords: z29.array(UnitWordSchema).min(1).max(16).optional(),
2859
+ integer: z29.boolean().optional(),
2860
+ minimum: z29.number().optional(),
2861
+ maximum: z29.number().optional()
2862
+ };
2863
+ var declaredDateOrders = [
2864
+ "month-first",
2865
+ "day-first"
2866
+ ];
2867
+ var packConventionFields = {
2868
+ numberStyle: z29.enum(numberStyles).optional(),
2869
+ dateOrder: z29.enum(declaredDateOrders).optional(),
2870
+ timeZone: z29.string().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_+/-]*$/u, "Use an IANA time zone name, such as Europe/Paris").refine(isTimeZone, "Unknown IANA time zone").optional()
2871
+ };
2872
+ var caseFactSchema = z29.union([draftValue, z29.number()]);
2873
+ var caseDecisionDate = CalendarDateSchema.optional();
2874
+
2875
+ // ../schemas/src/draft-pack-subjects.ts
2876
+ var subjectMatchRules = ["exact", "case-insensitive"];
2877
+ var subjectIdPattern = /^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u;
2878
+ var SubjectIdSchema = z30.string().min(1).max(200).regex(subjectIdPattern);
2879
+ var packSubjectLimits = {
2880
+ maxSubjects: 16,
2881
+ maxRelationships: 16,
2882
+ maxEscalations: 16,
2883
+ maxRelatedIds: 16
2884
+ };
2885
+ var relationshipCardinalities = ["one", "many"];
2886
+ var identifierText = z30.string().trim().min(1).max(200);
2887
+ var relationships = z30.array(z30.strictObject({
2888
+ name: draftIdentifier,
2889
+ subject: draftIdentifier,
2890
+ cardinality: z30.enum(relationshipCardinalities),
2891
+ required: z30.boolean().optional(),
2892
+ definition: draftQuote
2893
+ })).max(packSubjectLimits.maxRelationships).refine((rows) => hasUniqueValues(rows.map((row2) => row2.name)), "Duplicate relationship");
2894
+ var identityModes = ["provided", "fields", "content", "issued"];
2895
+ var identityField = z30.strictObject({
2896
+ name: draftIdentifier,
2897
+ identifier: identifierText,
2898
+ example: SubjectIdSchema,
2899
+ match: z30.enum(subjectMatchRules).optional()
2900
+ });
2901
+ var PackDraftIdentitySchema = z30.discriminatedUnion("mode", [
2902
+ z30.strictObject({ mode: z30.literal("provided") }),
2903
+ z30.strictObject({
2904
+ mode: z30.literal("fields"),
2905
+ fields: z30.array(identityField).min(1).max(8).refine((rows) => hasUniqueValues(rows.map((row2) => row2.name)), "Duplicate field")
2906
+ }),
2907
+ z30.strictObject({ mode: z30.literal("content"), question: draftIdentifier }),
2908
+ z30.strictObject({ mode: z30.literal("issued") })
2909
+ ]);
2910
+ var PackDraftSubjectSchema = z30.strictObject({
2911
+ id: draftIdentifier,
2912
+ definition: draftQuote,
2913
+ identifier: identifierText.optional(),
2914
+ example: SubjectIdSchema.optional(),
2915
+ identity: PackDraftIdentitySchema.optional(),
2916
+ match: z30.enum(subjectMatchRules).optional(),
2917
+ relationships: relationships.optional()
2918
+ });
2919
+ var PackDraftSubjectsSchema = z30.array(PackDraftSubjectSchema).min(1).max(packSubjectLimits.maxSubjects).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate subject");
2920
+ var PackDraftEscalationsSchema = z30.array(z30.strictObject({ id: draftIdentifier, quote: draftQuote })).min(1).max(packSubjectLimits.maxEscalations).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate escalation");
2921
+ var id2 = z30.string().min(1).max(256).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@-]*$/u);
2922
+ var ReleasedSubjectsSchema = z30.strictObject({
2923
+ job: id2,
2924
+ types: z30.array(z30.strictObject({
2925
+ id: id2,
2926
+ entryId: id2,
2927
+ identifier: identifierText.optional(),
2928
+ example: SubjectIdSchema.optional(),
2929
+ match: z30.enum(subjectMatchRules),
2930
+ relationships: z30.array(z30.strictObject({
2931
+ name: id2,
2932
+ subject: id2,
2933
+ cardinality: z30.enum(relationshipCardinalities),
2934
+ required: z30.boolean(),
2935
+ entryId: id2
2936
+ })).max(packSubjectLimits.maxRelationships)
2937
+ })).min(1).max(packSubjectLimits.maxSubjects),
2938
+ about: z30.array(z30.strictObject({ key: id2, relationship: id2 })).max(64)
2939
+ });
2940
+ var ReleasedEscalationsSchema = z30.strictObject({
2941
+ routes: z30.array(z30.strictObject({ id: id2, entryId: id2 })).min(1).max(packSubjectLimits.maxEscalations),
2942
+ outcomes: z30.array(z30.strictObject({ outcome: id2, escalation: id2 })).max(64),
2943
+ unresolved: id2.nullable(),
2944
+ attemptLimit: id2.nullable()
2945
+ });
2946
+ var ReleasedJobGuideSchema = z30.strictObject({
2947
+ purpose: id2.nullable(),
2948
+ useWhen: z30.array(id2).max(8),
2949
+ notFor: z30.array(id2).max(8),
2950
+ owner: id2.nullable()
2951
+ });
2952
+ var ReleasedIdentitySchema = z30.discriminatedUnion("mode", [
2953
+ z30.strictObject({ mode: z30.literal("provided") }),
2954
+ z30.strictObject({
2955
+ mode: z30.literal("fields"),
2956
+ fields: z30.array(z30.strictObject({
2957
+ name: id2,
2958
+ identifier: identifierText,
2959
+ example: SubjectIdSchema,
2960
+ match: z30.enum(subjectMatchRules)
2961
+ })).min(1).max(8)
2962
+ }),
2963
+ z30.strictObject({ mode: z30.literal("content"), question: id2 }),
2964
+ z30.strictObject({ mode: z30.literal("issued") })
2965
+ ]);
2966
+ var relatedId = z30.string().min(1).max(200);
2967
+ var HostedRelatedSubjectsSchema = z30.record(z30.string().min(1).max(128), z30.union([relatedId, z30.array(relatedId).min(1).max(packSubjectLimits.maxRelatedIds)])).refine((related) => Object.keys(related).length <= packSubjectLimits.maxRelationships, {
2968
+ message: "too_many_related"
2969
+ });
2970
+ var escalationTriggers = ["outcome", "unresolved", "attempt_limit"];
2971
+
2720
2972
  // ../schemas/src/draft-context-selection.ts
2721
2973
  var base2 = DraftContextPlanSchema.shape;
2722
2974
  var identifier15 = base2.job;
2723
2975
  var draftOutputPreparationContract = "felspar.structured-output-preparation/v1";
2724
2976
  var draftRequiredEvaluationContract = "felspar.required-evaluations/v1";
2725
- var evaluationValidation = z28.strictObject({
2726
- contract: z28.literal(draftRequiredEvaluationContract),
2727
- recipes: z28.array(z28.strictObject({ entryId: identifier15, expectedRecipeDigest: base2.artifactDigest })).min(1).max(8).refine((items) => hasUniqueValues(items.map((item) => item.entryId)), "Duplicate required recipe"),
2728
- maxRequests: z28.number().int().min(1).max(128),
2729
- maxTotalBytes: z28.number().int().min(1).max(65536)
2977
+ var evaluationValidation = z31.strictObject({
2978
+ contract: z31.literal(draftRequiredEvaluationContract),
2979
+ recipes: z31.array(z31.strictObject({ entryId: identifier15, expectedRecipeDigest: base2.artifactDigest })).min(1).max(8).refine((items) => hasUniqueValues(items.map((item) => item.entryId)), "Duplicate required recipe"),
2980
+ maxRequests: z31.number().int().min(1).max(128),
2981
+ maxTotalBytes: z31.number().int().min(1).max(65536)
2730
2982
  });
2731
2983
  var hasUniqueIds = (values) => hasUniqueValues(values);
2732
- var candidate = z28.strictObject({
2984
+ var candidate = z31.strictObject({
2733
2985
  entryId: identifier15,
2734
- outcomes: z28.array(identifier15).min(1).max(64).refine(hasUniqueIds, "Duplicate outcome"),
2735
- when: z28.array(z28.strictObject({ key: identifier15, equals: identifier15 })).max(16).refine((clauses2) => hasUniqueIds(clauses2.map((clause) => clause.key)), "Duplicate condition key"),
2736
- priority: z28.number().int().min(0).max(65535)
2986
+ outcomes: z31.array(identifier15).min(1).max(64).refine(hasUniqueIds, "Duplicate outcome"),
2987
+ when: z31.array(z31.strictObject({ key: identifier15, equals: identifier15 })).max(16).refine((clauses2) => hasUniqueIds(clauses2.map((clause) => clause.key)), "Duplicate condition key"),
2988
+ priority: z31.number().int().min(0).max(65535)
2737
2989
  });
2738
- var group = z28.strictObject({
2990
+ var group = z31.strictObject({
2739
2991
  id: identifier15,
2740
- min: z28.number().int().min(0).max(64),
2741
- max: z28.number().int().min(0).max(64),
2742
- candidates: z28.array(candidate).max(64)
2992
+ min: z31.number().int().min(0).max(64),
2993
+ max: z31.number().int().min(0).max(64),
2994
+ candidates: z31.array(candidate).max(64)
2743
2995
  }).refine((value) => value.min <= value.max, "Group minimum exceeds maximum");
2744
- var DraftContextSelectionPlanSchema = z28.strictObject({
2745
- schema: z28.enum([
2996
+ function areSubjectsValid(subjects, isIsolated) {
2997
+ const types = new Set(subjects.types.map((row2) => row2.id));
2998
+ const job = subjects.types.find((row2) => row2.id === subjects.job);
2999
+ const relationships2 = new Set(job?.relationships.map((row2) => row2.name));
3000
+ const isTypeValid = (row2) => {
3001
+ const names = row2.relationships.map((item) => item.name);
3002
+ const isLinked = row2.relationships.every((item) => types.has(item.subject) && isIsolated(item.entryId, "subjects"));
3003
+ return isIsolated(row2.entryId, "subjects") && hasUniqueValues(names) && isLinked;
3004
+ };
3005
+ return [
3006
+ subjects.types.length === types.size,
3007
+ job !== void 0,
3008
+ subjects.types.every((row2) => isTypeValid(row2)),
3009
+ hasUniqueValues(subjects.about.map((row2) => row2.key)),
3010
+ subjects.about.every((row2) => relationships2.has(row2.relationship))
3011
+ ].every(Boolean);
3012
+ }
3013
+ function areEscalationsValid(escalations, context3) {
3014
+ const { isIsolated, outcomes } = context3;
3015
+ const ids3 = new Set(escalations.routes.map((row2) => row2.id));
3016
+ const named = [escalations.unresolved, escalations.attemptLimit].filter((id12) => id12 !== null);
3017
+ return [
3018
+ ids3.size === escalations.routes.length,
3019
+ escalations.routes.every((row2) => isIsolated(row2.entryId, "routing_jobs")),
3020
+ hasUniqueValues(escalations.outcomes.map((row2) => row2.outcome)),
3021
+ escalations.outcomes.every((row2) => ids3.has(row2.escalation) && outcomes.has(row2.outcome)),
3022
+ named.every((id12) => ids3.has(id12))
3023
+ ].every(Boolean);
3024
+ }
3025
+ function isGuideValid(guide, isIsolated) {
3026
+ const listed = [
3027
+ ...guide.purpose === null ? [] : [[guide.purpose, "routing_jobs"]],
3028
+ ...guide.useWhen.map((entryId) => [entryId, "boundaries"]),
3029
+ ...guide.notFor.map((entryId) => [entryId, "boundaries"]),
3030
+ ...guide.owner === null ? [] : [[guide.owner, "actors"]]
3031
+ ];
3032
+ return listed.every(([entryId, primitive]) => isIsolated(entryId, primitive));
3033
+ }
3034
+ function subjectPlanIssues(plan) {
3035
+ const issues = [];
3036
+ const candidates = plan.groups.flatMap((item) => item.candidates);
3037
+ const isIsolated = (entryId, primitive) => {
3038
+ const entry2 = plan.entries.find((row2) => row2.id === entryId);
3039
+ return [
3040
+ entry2?.primitive === primitive,
3041
+ entry2?.dependencies.length === 0,
3042
+ !plan.requiredIds.includes(entryId),
3043
+ candidates.every((row2) => row2.entryId !== entryId),
3044
+ plan.entries.every((row2) => !row2.dependencies.includes(entryId))
3045
+ ].every(Boolean);
3046
+ };
3047
+ const outcomes = new Set(candidates.flatMap((row2) => row2.outcomes));
3048
+ if (plan.subjects !== void 0 && !areSubjectsValid(plan.subjects, isIsolated)) {
3049
+ issues.push("Subjects must be isolated subject entries whose references resolve");
3050
+ }
3051
+ if (plan.escalations !== void 0 && !areEscalationsValid(plan.escalations, { isIsolated, outcomes })) {
3052
+ issues.push("Escalations must be isolated routing entries whose references resolve");
3053
+ }
3054
+ if (plan.guide !== void 0 && !isGuideValid(plan.guide, isIsolated)) {
3055
+ issues.push("The job guide must be isolated entries of its kind");
3056
+ }
3057
+ return issues;
3058
+ }
3059
+ var DraftContextSelectionPlanSchema = z31.strictObject({
3060
+ schema: z31.enum([
2746
3061
  "felspar.context-selection.draft/v0",
2747
3062
  "felspar.context-selection.draft/v1",
2748
3063
  "felspar.context-selection.draft/v2"
2749
3064
  ]),
2750
3065
  evaluationValidation: evaluationValidation.optional(),
2751
- outputValidation: z28.strictObject({
2752
- contract: z28.literal(draftOutputPreparationContract),
3066
+ outputValidation: z31.strictObject({
3067
+ contract: z31.literal(draftOutputPreparationContract),
2753
3068
  entryId: identifier15,
2754
3069
  expectedContractDigest: base2.artifactDigest
2755
3070
  }).optional(),
@@ -2759,18 +3074,25 @@ var DraftContextSelectionPlanSchema = z28.strictObject({
2759
3074
  trustDomain: base2.trustDomain,
2760
3075
  outputSurface: identifier15,
2761
3076
  unresolvedGuidanceEntryId: identifier15.optional(),
2762
- attempts: z28.strictObject({
2763
- max: z28.number().int().min(1).max(10),
2764
- withProgress: z28.number().int().min(1).max(10)
3077
+ attempts: z31.strictObject({
3078
+ max: z31.number().int().min(1).max(10),
3079
+ withProgress: z31.number().int().min(1).max(10)
2765
3080
  }).refine((value) => value.withProgress >= value.max, "withProgress below max").optional(),
2766
3081
  entries: base2.entries,
2767
3082
  requiredIds: base2.requiredIds,
2768
3083
  budget: base2.budget,
2769
- groups: z28.array(group).min(1).max(8)
3084
+ groups: z31.array(group).min(1).max(8),
3085
+ subjects: ReleasedSubjectsSchema.optional(),
3086
+ escalations: ReleasedEscalationsSchema.optional(),
3087
+ guide: ReleasedJobGuideSchema.optional(),
3088
+ caseIdentity: ReleasedIdentitySchema.optional()
2770
3089
  }).superRefine((plan, context3) => {
2771
3090
  if (context3.issues.length > 0) {
2772
3091
  return;
2773
3092
  }
3093
+ for (const message of subjectPlanIssues(plan)) {
3094
+ context3.addIssue({ code: "custom", message });
3095
+ }
2774
3096
  if (plan.schema !== "felspar.context-selection.draft/v0" !== Boolean(plan.outputValidation)) {
2775
3097
  context3.addIssue({
2776
3098
  code: "custom",
@@ -2787,7 +3109,7 @@ var DraftContextSelectionPlanSchema = z28.strictObject({
2787
3109
  if (candidateIds.length > 64 || !hasUniqueIds(candidateIds) || !hasUniqueIds(plan.groups.map((item) => item.id)) || !hasUniqueIds(plan.entries.map((item) => item.id))) {
2788
3110
  context3.addIssue({ code: "custom", message: "Duplicate identities or too many candidates" });
2789
3111
  }
2790
- if (plan.requiredIds.some((id11) => candidateIds.includes(id11))) {
3112
+ if (plan.requiredIds.some((id12) => candidateIds.includes(id12))) {
2791
3113
  context3.addIssue({ code: "custom", message: "Global required root cannot be a candidate" });
2792
3114
  }
2793
3115
  const guidanceId = plan.unresolvedGuidanceEntryId;
@@ -2810,7 +3132,7 @@ var DraftContextSelectionPlanSchema = z28.strictObject({
2810
3132
  });
2811
3133
  }
2812
3134
  });
2813
- var DraftContextSelectionInputSchema = z28.strictObject({
3135
+ var DraftContextSelectionInputSchema = z31.strictObject({
2814
3136
  artifact: DraftContextInputSchema.shape.artifact,
2815
3137
  decision: DraftContextInputSchema.shape.decision,
2816
3138
  plan: DraftContextSelectionPlanSchema,
@@ -2819,22 +3141,22 @@ var DraftContextSelectionInputSchema = z28.strictObject({
2819
3141
  });
2820
3142
 
2821
3143
  // ../schemas/src/draft-origin-gates.ts
2822
- import { z as z30 } from "zod";
3144
+ import { z as z33 } from "zod";
2823
3145
 
2824
3146
  // ../schemas/src/draft-normalized-context.ts
2825
- import { z as z29 } from "zod";
3147
+ import { z as z32 } from "zod";
2826
3148
  var request = DraftCompiledRequestSchema.shape;
2827
3149
  var context = DraftContextSelectionInputSchema.shape;
2828
3150
  var compilation = DraftCandidateCompilationVerificationSchema.shape;
2829
3151
  var draftNormalizedContextContract = "felspar.normalized-context-run/v1";
2830
- var DraftNormalizedContextInputSchema = z29.strictObject({
3152
+ var DraftNormalizedContextInputSchema = z32.strictObject({
2831
3153
  normalization: DraftNormalizedEvidenceSchema,
2832
- compilation: z29.strictObject({
3154
+ compilation: z32.strictObject({
2833
3155
  artifact: compilation.artifact,
2834
3156
  binding: compilation.binding,
2835
3157
  fixtures: compilation.fixtures
2836
3158
  }),
2837
- request: z29.strictObject({
3159
+ request: z32.strictObject({
2838
3160
  expectedArtifactDigest: request.expectedArtifactDigest,
2839
3161
  job: request.job,
2840
3162
  trustDomain: request.trustDomain,
@@ -2845,10 +3167,10 @@ var DraftNormalizedContextInputSchema = z29.strictObject({
2845
3167
  requestedSurface: context.requestedSurface
2846
3168
  });
2847
3169
  var digest11 = context.expectedPlanDigest;
2848
- var DraftNormalizedContextReceiptBodySchema = z29.strictObject({
2849
- schema: z29.literal("felspar.normalized-context-receipt.draft/v0"),
2850
- authority: z29.literal("unapproved"),
2851
- runtimeContract: z29.literal(draftNormalizedContextContract),
3170
+ var DraftNormalizedContextReceiptBodySchema = z32.strictObject({
3171
+ schema: z32.literal("felspar.normalized-context-receipt.draft/v0"),
3172
+ authority: z32.literal("unapproved"),
3173
+ runtimeContract: z32.literal(draftNormalizedContextContract),
2852
3174
  inputDigest: digest11,
2853
3175
  resultDigest: digest11,
2854
3176
  artifactDigest: digest11,
@@ -2856,7 +3178,7 @@ var DraftNormalizedContextReceiptBodySchema = z29.strictObject({
2856
3178
  decisionRunDigest: digest11.nullable(),
2857
3179
  selectionPlanDigest: digest11,
2858
3180
  capsuleDigest: digest11.nullable(),
2859
- status: z29.enum(["ready", "blocked"])
3181
+ status: z32.enum(["ready", "blocked"])
2860
3182
  });
2861
3183
  var DraftNormalizedContextReceiptSchema = DraftNormalizedContextReceiptBodySchema.extend({
2862
3184
  receiptDigest: digest11
@@ -2866,25 +3188,25 @@ var DraftNormalizedContextReceiptSchema = DraftNormalizedContextReceiptBodySchem
2866
3188
  var DraftOriginBoundCompilationSchema = DraftSourceBoundCompilationSchema.extend({
2867
3189
  origins: DraftCandidateOriginsSchema
2868
3190
  });
2869
- var DraftContextOriginsSchema = z30.strictObject({
2870
- schema: z30.literal("felspar.context-origins.draft/v0"),
3191
+ var DraftContextOriginsSchema = z33.strictObject({
3192
+ schema: z33.literal("felspar.context-origins.draft/v0"),
2871
3193
  planDigest: DraftContextSelectionPlanSchema.shape.artifactDigest,
2872
- entries: z30.array(z30.strictObject({
3194
+ entries: z33.array(z33.strictObject({
2873
3195
  entryId: DraftContextSelectionPlanSchema.shape.job,
2874
3196
  origin: DraftAuthorityOriginSchema
2875
3197
  })).max(64)
2876
3198
  });
2877
- var DraftContextOriginInputSchema = z30.strictObject({
3199
+ var DraftContextOriginInputSchema = z33.strictObject({
2878
3200
  plan: DraftContextSelectionPlanSchema,
2879
3201
  origins: DraftContextOriginsSchema,
2880
3202
  bundle: DraftSourceTextBundleSchema,
2881
3203
  compositions: DraftSourceCompositionsSchema
2882
3204
  });
2883
- var DraftOriginBoundContextInputSchema = z30.strictObject({
2884
- schema: z30.literal("felspar.origin-bound-context.draft/v0"),
3205
+ var DraftOriginBoundContextInputSchema = z33.strictObject({
3206
+ schema: z33.literal("felspar.origin-bound-context.draft/v0"),
2885
3207
  input: DraftNormalizedContextInputSchema,
2886
3208
  origins: DraftCandidateOriginsSchema,
2887
- context: z30.strictObject({
3209
+ context: z33.strictObject({
2888
3210
  origins: DraftContextOriginsSchema,
2889
3211
  bundle: DraftSourceTextBundleSchema
2890
3212
  })
@@ -2893,9 +3215,9 @@ var DraftOriginBoundContextInputSchema = z30.strictObject({
2893
3215
  // ../schemas/src/draft-required-context.ts
2894
3216
  var context2 = DraftContextSelectionInputSchema.shape;
2895
3217
  var draftRequiredContextContract = "felspar.required-context-run/v1";
2896
- var DraftRequiredContextInputSchema = z31.strictObject({
3218
+ var DraftRequiredContextInputSchema = z34.strictObject({
2897
3219
  normalization: DraftRequiredNormalizationSchema,
2898
- compilation: z31.strictObject({
3220
+ compilation: z34.strictObject({
2899
3221
  artifact: DraftCompiledArtifactSchema,
2900
3222
  fixtures: DraftAnyCompilationSchema.shape.fixtures
2901
3223
  }),
@@ -2906,8 +3228,8 @@ var DraftRequiredContextInputSchema = z31.strictObject({
2906
3228
  contextOrigins: DraftContextOriginInputSchema.omit({ plan: true })
2907
3229
  });
2908
3230
  var DraftRequiredContextReceiptBodySchema = DraftNormalizedContextReceiptBodySchema.extend({
2909
- schema: z31.literal("felspar.required-context-receipt.draft/v0"),
2910
- runtimeContract: z31.literal(draftRequiredContextContract),
3231
+ schema: z34.literal("felspar.required-context-receipt.draft/v0"),
3232
+ runtimeContract: z34.literal(draftRequiredContextContract),
2911
3233
  compilationDigest: context2.expectedPlanDigest,
2912
3234
  contextOriginsDigest: context2.expectedPlanDigest
2913
3235
  });
@@ -2919,12 +3241,12 @@ var DraftRequiredContextReceiptSchema = DraftRequiredContextReceiptBodySchema.ex
2919
3241
  var normalization = DraftRequiredNormalizationSchema.shape;
2920
3242
  var packet = DraftNormalizedEvidenceSchema.shape;
2921
3243
  var digest12 = packet.expectedSemanticBundleDigest;
2922
- var path2 = z32.string().max(512).regex(/^\/authority\//u);
2923
- var DraftRequiredAuthoritySchema = z32.strictObject({
3244
+ var path2 = z35.string().max(512).regex(/^\/authority\//u);
3245
+ var DraftRequiredAuthoritySchema = z35.strictObject({
2924
3246
  proposal: normalization.proposal,
2925
- normalizationContract: z32.literal(conditionalNormalizationContract).optional(),
3247
+ normalizationContract: z35.literal(conditionalNormalizationContract).optional(),
2926
3248
  bindings: normalization.bindings,
2927
- materials: z32.array(z32.strictObject({
3249
+ materials: z35.array(z35.strictObject({
2928
3250
  key: normalization.bindings.element.shape.key,
2929
3251
  semantics: packet.semantics,
2930
3252
  evaluatorContract: packet.evaluatorContract
@@ -2951,12 +3273,12 @@ var DraftRequiredAuthoritySchema = z32.strictObject({
2951
3273
  });
2952
3274
  }
2953
3275
  });
2954
- var DraftRequiredOriginsSchema = z32.strictObject({
2955
- schema: z32.literal("felspar.required-origins.draft/v0"),
3276
+ var DraftRequiredOriginsSchema = z35.strictObject({
3277
+ schema: z35.literal("felspar.required-origins.draft/v0"),
2956
3278
  authorityDigest: digest12,
2957
- entries: z32.array(z32.strictObject({ path: path2, origin: DraftAuthorityOriginSchema })).max(1024)
3279
+ entries: z35.array(z35.strictObject({ path: path2, origin: DraftAuthorityOriginSchema })).max(1024)
2958
3280
  });
2959
- var DraftRequiredOriginInputSchema = z32.strictObject({
3281
+ var DraftRequiredOriginInputSchema = z35.strictObject({
2960
3282
  catalog: DraftRequiredAuthoritySchema,
2961
3283
  origins: DraftRequiredOriginsSchema,
2962
3284
  expectedAuthorityDigest: digest12,
@@ -2964,19 +3286,19 @@ var DraftRequiredOriginInputSchema = z32.strictObject({
2964
3286
  bundle: DraftSourceTextBundleSchema,
2965
3287
  compositions: DraftSourceCompositionsSchema
2966
3288
  });
2967
- var DraftCoveredRequiredContextSchema = z32.strictObject({
3289
+ var DraftCoveredRequiredContextSchema = z35.strictObject({
2968
3290
  authority: DraftRequiredOriginInputSchema,
2969
3291
  input: DraftRequiredContextInputSchema
2970
3292
  });
2971
- var DraftCoveredRequiredReceiptBodySchema = z32.strictObject({
2972
- schema: z32.literal("felspar.covered-required-receipt.draft/v0"),
2973
- authority: z32.literal("unapproved"),
3293
+ var DraftCoveredRequiredReceiptBodySchema = z35.strictObject({
3294
+ schema: z35.literal("felspar.covered-required-receipt.draft/v0"),
3295
+ authority: z35.literal("unapproved"),
2974
3296
  inputDigest: digest12,
2975
3297
  resultDigest: digest12,
2976
3298
  authorityDigest: digest12,
2977
3299
  originsDigest: digest12,
2978
3300
  capsuleDigest: digest12.nullable(),
2979
- status: z32.enum(["ready", "blocked"])
3301
+ status: z35.enum(["ready", "blocked"])
2980
3302
  });
2981
3303
  var DraftCoveredRequiredReceiptSchema = DraftCoveredRequiredReceiptBodySchema.extend({
2982
3304
  receiptDigest: digest12
@@ -2988,20 +3310,20 @@ var DraftRequiredPreparationSchema = DraftRequiredContextInputSchema.omit({
2988
3310
  authority: DraftRequiredOriginInputSchema,
2989
3311
  expectedArtifactDigest: digest12
2990
3312
  });
2991
- var DraftPreparedRequiredReadSchema = z32.strictObject({
3313
+ var DraftPreparedRequiredReadSchema = z35.strictObject({
2992
3314
  request: DraftRequiredContextInputSchema.shape.request,
2993
3315
  normalizations: normalization.normalizations
2994
3316
  });
2995
3317
 
2996
3318
  // ../schemas/src/draft-supplied-context.ts
2997
- import { z as z33 } from "zod";
3319
+ import { z as z36 } from "zod";
2998
3320
  var draftSuppliedContextContract = "felspar.supplied-context-run/v1";
2999
3321
  var draftSuppliedContextPartsContract = "felspar.supplied-context-run/v2";
3000
- var DraftSuppliedAuthoritySchema = z33.strictObject({
3322
+ var DraftSuppliedAuthoritySchema = z36.strictObject({
3001
3323
  proposal: DraftRequiredProposalSchema,
3002
- route: z33.strictObject({
3003
- kind: z33.literal("supplied_values"),
3004
- contract: z33.literal("felspar.declared-scalar-observations/v1")
3324
+ route: z36.strictObject({
3325
+ kind: z36.literal("supplied_values"),
3326
+ contract: z36.literal("felspar.declared-scalar-observations/v1")
3005
3327
  })
3006
3328
  });
3007
3329
  var DraftSuppliedOriginInputSchema = DraftRequiredOriginInputSchema.extend({
@@ -3010,7 +3332,7 @@ var DraftSuppliedOriginInputSchema = DraftRequiredOriginInputSchema.extend({
3010
3332
  var DraftSuppliedContextSchema = DraftRequiredContextInputSchema.omit({
3011
3333
  normalization: true
3012
3334
  }).extend({
3013
- schema: z33.literal("felspar.supplied-context.draft/v0"),
3335
+ schema: z36.literal("felspar.supplied-context.draft/v0"),
3014
3336
  authority: DraftSuppliedOriginInputSchema,
3015
3337
  evidence: DraftRequiredDecisionSchema.shape.evidence
3016
3338
  });
@@ -3018,7 +3340,7 @@ var DraftSuppliedPreparationSchema = DraftSuppliedContextSchema.omit({
3018
3340
  request: true,
3019
3341
  evidence: true
3020
3342
  }).extend({
3021
- schema: z33.literal("felspar.supplied-preparation.draft/v0"),
3343
+ schema: z36.literal("felspar.supplied-preparation.draft/v0"),
3022
3344
  expectedArtifactDigest: DraftSuppliedContextSchema.shape.request.shape.expectedArtifactDigest
3023
3345
  });
3024
3346
  var DraftPreparedSuppliedRequestSchema = DraftSuppliedContextSchema.pick({
@@ -3026,186 +3348,106 @@ var DraftPreparedSuppliedRequestSchema = DraftSuppliedContextSchema.pick({
3026
3348
  evidence: true
3027
3349
  });
3028
3350
  var DraftSuppliedReceiptBodySchema = DraftCoveredRequiredReceiptBodySchema.extend({
3029
- schema: z33.literal("felspar.supplied-context-receipt.draft/v0"),
3030
- runtimeContract: z33.enum([draftSuppliedContextContract, draftSuppliedContextPartsContract])
3351
+ schema: z36.literal("felspar.supplied-context-receipt.draft/v0"),
3352
+ runtimeContract: z36.enum([draftSuppliedContextContract, draftSuppliedContextPartsContract])
3031
3353
  });
3032
3354
  var DraftSuppliedReceiptSchema = DraftSuppliedReceiptBodySchema.extend({
3033
3355
  receiptDigest: DraftCoveredRequiredReceiptBodySchema.shape.inputDigest
3034
3356
  }).refine((receipt) => receipt.status === "ready" === (receipt.capsuleDigest !== null), "Only ready delivery has a capsule digest");
3035
3357
 
3036
3358
  // ../schemas/src/draft-requirements.ts
3037
- var request2 = z34.strictObject({
3038
- schema: z34.literal("felspar.requirements-request.draft/v0"),
3359
+ var request2 = z37.strictObject({
3360
+ schema: z37.literal("felspar.requirements-request.draft/v0"),
3039
3361
  job: DraftRequiredProposalSchema.shape.job,
3040
3362
  trustDomain: DraftRequiredProposalSchema.shape.trustDomain,
3041
- maxResponseBytes: z34.number().int().min(1).max(1048576)
3363
+ maxResponseBytes: z37.number().int().min(1).max(1048576)
3042
3364
  });
3043
- var DraftRequirementsRequestSchema = z34.discriminatedUnion("route", [
3365
+ var DraftRequirementsRequestSchema = z37.discriminatedUnion("route", [
3044
3366
  request2.extend({
3045
- route: z34.literal("normalized"),
3367
+ route: z37.literal("normalized"),
3046
3368
  authority: DraftRequiredOriginInputSchema
3047
3369
  }),
3048
3370
  request2.extend({
3049
- route: z34.literal("supplied"),
3371
+ route: z37.literal("supplied"),
3050
3372
  authority: DraftSuppliedOriginInputSchema
3051
3373
  })
3052
3374
  ]);
3053
3375
 
3054
3376
  // ../schemas/src/draft-typed-normalization.ts
3055
- import { z as z37 } from "zod";
3056
-
3057
- // ../schemas/src/draft-exact-reader.ts
3058
- import { z as z35 } from "zod";
3059
- var exactNumberReaderVersion = "felspar.exact-number/v2";
3060
- var exactDateReaderVersion = "felspar.exact-date/v2";
3061
- var numberStyles = ["1,234.56", "1.234,56", "1 234,56", "1'234.56"];
3062
- var dateOrders = ["unstated", "month-first", "day-first"];
3063
- var knownCurrencies = [
3064
- "AED",
3065
- "ARS",
3066
- "AUD",
3067
- "BRL",
3068
- "CAD",
3069
- "CHF",
3070
- "CLP",
3071
- "CNY",
3072
- "COP",
3073
- "CZK",
3074
- "DKK",
3075
- "EGP",
3076
- "EUR",
3077
- "GBP",
3078
- "HKD",
3079
- "HUF",
3080
- "IDR",
3081
- "ILS",
3082
- "INR",
3083
- "ISK",
3084
- "JPY",
3085
- "KES",
3086
- "KRW",
3087
- "MXN",
3088
- "MYR",
3089
- "NGN",
3090
- "NOK",
3091
- "NZD",
3092
- "PEN",
3093
- "PHP",
3094
- "PKR",
3095
- "PLN",
3096
- "RON",
3097
- "RUB",
3098
- "SAR",
3099
- "SEK",
3100
- "SGD",
3101
- "THB",
3102
- "TRY",
3103
- "TWD",
3104
- "UAH",
3105
- "USD",
3106
- "VND",
3107
- "ZAR"
3108
- ];
3109
- var knownCurrencySet = new Set(knownCurrencies);
3110
- function isKnownCurrency(code) {
3111
- return knownCurrencySet.has(code);
3112
- }
3113
- var UnitWordSchema = z35.string().min(1).max(64).regex(/^\p{L}[\p{L}\p{N}'’ -]*\p{L}$|^\p{L}$/u, "Use a word or short phrase");
3114
- var ExactNumberUnitSchema = z35.discriminatedUnion("kind", [
3115
- z35.strictObject({
3116
- kind: z35.literal("currency"),
3117
- code: z35.string().regex(/^[A-Z]{3}$/u).refine(isKnownCurrency, "Not a currency code the reader recognises")
3118
- }),
3119
- z35.strictObject({ kind: z35.literal("percent") }),
3120
- z35.strictObject({
3121
- kind: z35.literal("count"),
3122
- words: z35.array(UnitWordSchema).min(1).max(16).refine((words) => hasUniqueValues(words.map((word) => word.toLowerCase())), "Duplicate unit word")
3123
- })
3124
- ]);
3125
- var ExactReaderSchema = z35.discriminatedUnion("version", [
3126
- z35.strictObject({
3127
- version: z35.literal(exactNumberReaderVersion),
3128
- unit: ExactNumberUnitSchema,
3129
- numberStyle: z35.enum(numberStyles)
3130
- }),
3131
- z35.strictObject({
3132
- version: z35.literal(exactDateReaderVersion),
3133
- dateOrder: z35.enum(dateOrders)
3134
- })
3135
- ]);
3377
+ import { z as z39 } from "zod";
3136
3378
 
3137
3379
  // ../schemas/src/draft-scalar-selection.ts
3138
- import { z as z36 } from "zod";
3380
+ import { z as z38 } from "zod";
3139
3381
  var scalarSelectionConfidence = "candidate-selected-probability/v1";
3140
- var DraftScalarParserSchema = z36.discriminatedUnion("version", [
3141
- z36.strictObject({
3142
- version: z36.literal("iso-currency-decimal/v1"),
3143
- currency: z36.string().regex(/^[A-Z]{3}$/u)
3382
+ var DraftScalarParserSchema = z38.discriminatedUnion("version", [
3383
+ z38.strictObject({
3384
+ version: z38.literal("iso-currency-decimal/v1"),
3385
+ currency: z38.string().regex(/^[A-Z]{3}$/u)
3144
3386
  }),
3145
- z36.strictObject({ version: z36.literal("iso-calendar-date/v1") })
3387
+ z38.strictObject({ version: z38.literal("iso-calendar-date/v1") })
3146
3388
  ]);
3147
- var digest13 = z36.string().regex(/^sha256:[a-f0-9]{64}$/u);
3148
- var candidateId = z36.string().regex(/^candidate_(?:\d|[1-5]\d|6[0-3])$/u);
3149
- var DraftScalarSelectionSchema = z36.strictObject({
3150
- schema: z36.literal("felspar.scalar-candidate-selection.draft/v0"),
3389
+ var digest13 = z38.string().regex(/^sha256:[a-f0-9]{64}$/u);
3390
+ var candidateId = z38.string().regex(/^candidate_(?:\d|[1-5]\d|6[0-3])$/u);
3391
+ var DraftScalarSelectionSchema = z38.strictObject({
3392
+ schema: z38.literal("felspar.scalar-candidate-selection.draft/v0"),
3151
3393
  requestDigest: digest13,
3152
3394
  parser: DraftScalarParserSchema,
3153
- sourceText: z36.string().min(1).max(262144),
3395
+ sourceText: z38.string().min(1).max(262144),
3154
3396
  candidatesDigest: digest13,
3155
3397
  selectedCandidateId: candidateId.nullable(),
3156
- probabilities: z36.array(z36.strictObject({ value: candidateId, probability: z36.number().min(0).max(1) })).min(1).max(64),
3157
- abstentionProbability: z36.number().min(0).max(1),
3158
- providerConfidence: z36.number().min(0).max(1)
3398
+ probabilities: z38.array(z38.strictObject({ value: candidateId, probability: z38.number().min(0).max(1) })).min(1).max(64),
3399
+ abstentionProbability: z38.number().min(0).max(1),
3400
+ providerConfidence: z38.number().min(0).max(1)
3159
3401
  });
3160
3402
 
3161
3403
  // ../schemas/src/draft-typed-normalization.ts
3162
- var identifier16 = z37.string().min(1).max(200).regex(/\S/u);
3404
+ var identifier16 = z39.string().min(1).max(200).regex(/\S/u);
3163
3405
  var digest14 = DraftNormalizedEvidenceSchema.shape.expectedSemanticBundleDigest;
3164
3406
  var { evaluator: evaluator2 } = DraftNormalizedEvidenceSchema.shape.evaluatorContract.shape;
3165
3407
  var reference7 = DraftEvidenceValidationSchema.shape.observationChecks.shape.scope.shape.observations.element.shape.evidence;
3166
3408
  var key2 = { key: identifier16 };
3167
- var scalarRecipe = z37.strictObject({
3409
+ var scalarRecipe = z39.strictObject({
3168
3410
  ...key2,
3169
- kind: z37.literal("scalar"),
3411
+ kind: z39.literal("scalar"),
3170
3412
  definitionDigest: digest14,
3171
3413
  id: identifier16,
3172
3414
  version: identifier16,
3173
- instructions: z37.string().min(1).max(16384).regex(/\S/u),
3415
+ instructions: z39.string().min(1).max(16384).regex(/\S/u),
3174
3416
  evaluator: evaluator2,
3175
3417
  calibration: DraftNormalizedEvidenceSchema.shape.evaluatorContract.shape.calibration,
3176
- confidenceContract: z37.enum(["declared-scalar-confidence/v1", scalarSelectionConfidence]),
3418
+ confidenceContract: z39.enum(["declared-scalar-confidence/v1", scalarSelectionConfidence]),
3177
3419
  parser: DraftScalarParserSchema.optional(),
3178
- minimumConfidence: z37.number().gt(0).max(1),
3420
+ minimumConfidence: z39.number().gt(0).max(1),
3179
3421
  reader: ExactReaderSchema.optional()
3180
3422
  }).refine((recipe2) => recipe2.confidenceContract === scalarSelectionConfidence === Boolean(recipe2.parser), "A candidate-selection recipe requires its parser; legacy recipes cannot carry a parser");
3181
- var DraftInterpretationManifestSchema = z37.strictObject({
3182
- schema: z37.literal("felspar.typed-interpretation-manifest.draft/v0"),
3183
- authority: z37.literal("unapproved"),
3423
+ var DraftInterpretationManifestSchema = z39.strictObject({
3424
+ schema: z39.literal("felspar.typed-interpretation-manifest.draft/v0"),
3425
+ authority: z39.literal("unapproved"),
3184
3426
  authorityDigest: digest14,
3185
- recipes: z37.array(z37.discriminatedUnion("kind", [
3427
+ recipes: z39.array(z39.discriminatedUnion("kind", [
3186
3428
  scalarRecipe,
3187
- z37.strictObject({
3429
+ z39.strictObject({
3188
3430
  ...key2,
3189
- kind: z37.literal("enum"),
3431
+ kind: z39.literal("enum"),
3190
3432
  semanticBundleDigest: digest14,
3191
3433
  evaluatorContractDigest: digest14
3192
3434
  })
3193
3435
  ])).min(1).max(64).refine((items) => hasUniqueValues(items.map((item) => item.key)), "Duplicate recipe key")
3194
3436
  });
3195
- var judgment2 = z37.discriminatedUnion("status", [
3196
- z37.strictObject({
3197
- status: z37.literal("evaluated"),
3437
+ var judgment2 = z39.discriminatedUnion("status", [
3438
+ z39.strictObject({
3439
+ status: z39.literal("evaluated"),
3198
3440
  value: DraftEvidenceValueSchema,
3199
3441
  unit: identifier16.optional(),
3200
- confidence: z37.number().min(0).max(1)
3442
+ confidence: z39.number().min(0).max(1)
3201
3443
  }),
3202
- z37.strictObject({ status: z37.enum(["abstained", "timeout", "malformed", "review_required"]) })
3444
+ z39.strictObject({ status: z39.enum(["abstained", "timeout", "malformed", "review_required"]) })
3203
3445
  ]);
3204
- var scalarPacket = z37.strictObject({
3446
+ var scalarPacket = z39.strictObject({
3205
3447
  ...key2,
3206
- kind: z37.literal("scalar"),
3207
- evidence: z37.strictObject(DraftEvidenceValidationSchema.shape).omit({ results: true }),
3208
- records: z37.array(z37.strictObject({
3448
+ kind: z39.literal("scalar"),
3449
+ evidence: z39.strictObject(DraftEvidenceValidationSchema.shape).omit({ results: true }),
3450
+ records: z39.array(z39.strictObject({
3209
3451
  observationId: identifier16,
3210
3452
  evidence: reference7,
3211
3453
  recipeDigest: digest14,
@@ -3215,31 +3457,31 @@ var scalarPacket = z37.strictObject({
3215
3457
  selection: DraftScalarSelectionSchema.optional()
3216
3458
  })).max(64)
3217
3459
  });
3218
- var DraftTypedNormalizationSchema = z37.strictObject({
3219
- schema: z37.literal("felspar.typed-normalization.draft/v0"),
3460
+ var DraftTypedNormalizationSchema = z39.strictObject({
3461
+ schema: z39.literal("felspar.typed-normalization.draft/v0"),
3220
3462
  invocation: DraftSuppliedContextSchema.omit({ evidence: true }),
3221
3463
  manifest: DraftInterpretationManifestSchema,
3222
3464
  expectedManifestDigest: digest14,
3223
- packets: z37.array(z37.discriminatedUnion("kind", [
3465
+ packets: z39.array(z39.discriminatedUnion("kind", [
3224
3466
  scalarPacket,
3225
- z37.strictObject({ ...key2, kind: z37.literal("enum"), input: DraftNormalizedEvidenceSchema })
3467
+ z39.strictObject({ ...key2, kind: z39.literal("enum"), input: DraftNormalizedEvidenceSchema })
3226
3468
  ])).max(64).refine((items) => hasUniqueValues(items.map((item) => item.key)), "Duplicate packet key")
3227
3469
  });
3228
3470
  var DraftLayeredNormalizationSchema = DraftTypedNormalizationSchema.extend({
3229
- schema: z37.literal("felspar.typed-normalization.draft/v1")
3471
+ schema: z39.literal("felspar.typed-normalization.draft/v1")
3230
3472
  });
3231
3473
 
3232
3474
  // ../schemas/src/draft-context-receipt.ts
3233
- import { z as z38 } from "zod";
3475
+ import { z as z40 } from "zod";
3234
3476
  var digest15 = DraftContextSelectionInputSchema.shape.expectedPlanDigest;
3235
3477
  var { evaluationTime } = DraftContextSelectionInputSchema.shape.decision.shape.scope.shape;
3236
3478
  var draftContextRuntimeContract = "felspar.context-selection-run/v1";
3237
- var DraftContextReceiptBodySchema = z38.strictObject({
3238
- schema: z38.literal("felspar.context-receipt.draft/v0"),
3239
- authority: z38.literal("unapproved"),
3240
- stage: z38.literal("draft-context-selection"),
3241
- runtimeContract: z38.literal(draftContextRuntimeContract),
3242
- identityFormat: z38.literal("felspar.json-content-identity/v1"),
3479
+ var DraftContextReceiptBodySchema = z40.strictObject({
3480
+ schema: z40.literal("felspar.context-receipt.draft/v0"),
3481
+ authority: z40.literal("unapproved"),
3482
+ stage: z40.literal("draft-context-selection"),
3483
+ runtimeContract: z40.literal(draftContextRuntimeContract),
3484
+ identityFormat: z40.literal("felspar.json-content-identity/v1"),
3243
3485
  evaluationTime,
3244
3486
  inputDigest: digest15,
3245
3487
  artifactDigest: digest15,
@@ -3247,143 +3489,143 @@ var DraftContextReceiptBodySchema = z38.strictObject({
3247
3489
  decisionRunDigest: digest15,
3248
3490
  resultDigest: digest15,
3249
3491
  capsuleDigest: digest15.nullable(),
3250
- status: z38.enum(["ready", "blocked"])
3492
+ status: z40.enum(["ready", "blocked"])
3251
3493
  });
3252
3494
  var DraftContextReceiptSchema = DraftContextReceiptBodySchema.extend({
3253
3495
  receiptDigest: digest15
3254
3496
  }).refine((receipt) => receipt.status === "ready" === (receipt.capsuleDigest !== null), "Only a ready context receipt has a capsule digest");
3255
- var DraftContextVerificationOptionsSchema = z38.strictObject({
3497
+ var DraftContextVerificationOptionsSchema = z40.strictObject({
3256
3498
  expectedReceiptDigest: digest15,
3257
- deliveredCapsule: z38.record(z38.string(), z38.unknown()).nullable()
3499
+ deliveredCapsule: z40.record(z40.string(), z40.unknown()).nullable()
3258
3500
  });
3259
3501
 
3260
3502
  // ../schemas/src/draft-evaluation-requests.ts
3261
- import { z as z39 } from "zod";
3262
- var identifier17 = z39.string().min(1).max(200).regex(/\S/u);
3503
+ import { z as z41 } from "zod";
3504
+ var identifier17 = z41.string().min(1).max(200).regex(/\S/u);
3263
3505
  var digest16 = DraftTypedNormalizationSchema.shape.expectedManifestDigest;
3264
3506
  var [scalar2] = DraftTypedNormalizationSchema.shape.packets.element.options;
3265
3507
  var { reference: reference8 } = DraftEvidenceMetadataSchema.shape.sources.element.shape;
3266
- var DraftEvaluationRequestsSchema = z39.strictObject({
3267
- schema: z39.literal("felspar.evaluation-requests.draft/v0"),
3508
+ var DraftEvaluationRequestsSchema = z41.strictObject({
3509
+ schema: z41.literal("felspar.evaluation-requests.draft/v0"),
3268
3510
  invocation: DraftTypedNormalizationSchema.shape.invocation,
3269
3511
  manifest: DraftTypedNormalizationSchema.shape.manifest,
3270
3512
  expectedManifestDigest: digest16,
3271
- limits: z39.strictObject({
3272
- maxQuestions: z39.number().int().min(1).max(64),
3273
- maxRequestBytes: z39.number().int().min(1).max(1048576),
3274
- maxResponseBytes: z39.number().int().min(1).max(1048576)
3513
+ limits: z41.strictObject({
3514
+ maxQuestions: z41.number().int().min(1).max(64),
3515
+ maxRequestBytes: z41.number().int().min(1).max(1048576),
3516
+ maxResponseBytes: z41.number().int().min(1).max(1048576)
3275
3517
  }),
3276
- packets: z39.array(z39.discriminatedUnion("kind", [
3277
- z39.strictObject({
3518
+ packets: z41.array(z41.discriminatedUnion("kind", [
3519
+ z41.strictObject({
3278
3520
  key: identifier17,
3279
- kind: z39.literal("scalar"),
3521
+ kind: z41.literal("scalar"),
3280
3522
  evidence: DraftEvidenceMetadataSchema
3281
3523
  }),
3282
- z39.strictObject({
3524
+ z41.strictObject({
3283
3525
  key: identifier17,
3284
- kind: z39.literal("enum"),
3526
+ kind: z41.literal("enum"),
3285
3527
  input: DraftNormalizedEvidenceSchema.omit({ normalizations: true, attemptStatus: true })
3286
3528
  })
3287
3529
  ])).max(64).refine((items) => hasUniqueValues(items.map((item) => item.key)), "Duplicate preparation key"),
3288
- passages: z39.array(z39.strictObject({ reference: reference8, text: z39.string().min(1).max(262144) })).max(1024)
3530
+ passages: z41.array(z41.strictObject({ reference: reference8, text: z41.string().min(1).max(262144) })).max(1024)
3289
3531
  });
3290
- var DraftEvaluationResponseSchema = z39.strictObject({
3291
- schema: z39.literal("felspar.evaluation-response.draft/v0"),
3532
+ var DraftEvaluationResponseSchema = z41.strictObject({
3533
+ schema: z41.literal("felspar.evaluation-response.draft/v0"),
3292
3534
  requestDigest: digest16,
3293
- answers: z39.array(z39.discriminatedUnion("kind", [
3294
- z39.strictObject({
3535
+ answers: z41.array(z41.discriminatedUnion("kind", [
3536
+ z41.strictObject({
3295
3537
  key: identifier17,
3296
- kind: z39.literal("scalar"),
3538
+ kind: z41.literal("scalar"),
3297
3539
  records: scalar2.shape.records
3298
3540
  }),
3299
- z39.strictObject({
3541
+ z41.strictObject({
3300
3542
  key: identifier17,
3301
- kind: z39.literal("enum"),
3543
+ kind: z41.literal("enum"),
3302
3544
  records: DraftNormalizedEvidenceSchema.shape.normalizations
3303
3545
  })
3304
3546
  ])).max(16).refine((items) => hasUniqueValues(items.map((item) => item.key)), "Duplicate answer key")
3305
3547
  });
3306
- var DraftEvaluationResponsesSchema = z39.array(DraftEvaluationResponseSchema).max(2);
3548
+ var DraftEvaluationResponsesSchema = z41.array(DraftEvaluationResponseSchema).max(2);
3307
3549
  var DraftLayeredEvaluationSchema = DraftEvaluationRequestsSchema.extend({
3308
- schema: z39.literal("felspar.evaluation-requests.draft/v1"),
3550
+ schema: z41.literal("felspar.evaluation-requests.draft/v1"),
3309
3551
  limits: DraftEvaluationRequestsSchema.shape.limits.extend({
3310
- maxRounds: z39.number().int().min(1).max(16),
3311
- maxTotalQuestions: z39.number().int().min(1).max(64),
3312
- maxTotalRequestBytes: z39.number().int().min(1).max(1048576),
3313
- maxTotalResponseBytes: z39.number().int().min(1).max(1048576)
3552
+ maxRounds: z41.number().int().min(1).max(16),
3553
+ maxTotalQuestions: z41.number().int().min(1).max(64),
3554
+ maxTotalRequestBytes: z41.number().int().min(1).max(1048576),
3555
+ maxTotalResponseBytes: z41.number().int().min(1).max(1048576)
3314
3556
  })
3315
3557
  });
3316
- var DraftLayeredResponsesSchema = z39.array(DraftEvaluationResponseSchema).max(16);
3558
+ var DraftLayeredResponsesSchema = z41.array(DraftEvaluationResponseSchema).max(16);
3317
3559
 
3318
3560
  // ../schemas/src/draft-job-handoff.ts
3319
3561
  var digest17 = DraftContextVerificationOptionsSchema.shape.expectedReceiptDigest;
3320
3562
  var draftJobHandoffContract = "felspar.job-handoff/v1";
3321
- var DraftJobDiscoverySchema = z40.strictObject({
3322
- schema: z40.literal("felspar.job-discovery.draft/v0"),
3563
+ var DraftJobDiscoverySchema = z42.strictObject({
3564
+ schema: z42.literal("felspar.job-discovery.draft/v0"),
3323
3565
  requirements: DraftRequirementsRequestSchema,
3324
3566
  compilation: DraftRequiredContextInputSchema.shape.compilation,
3325
3567
  expectedArtifactDigest: digest17
3326
3568
  });
3327
3569
  var executionVersion0 = "felspar.job-execution.draft/v0";
3328
- var DraftJobExecutionSchema = z40.strictObject({
3329
- schema: z40.literal(executionVersion0),
3570
+ var DraftJobExecutionSchema = z42.strictObject({
3571
+ schema: z42.literal(executionVersion0),
3330
3572
  discovery: DraftJobDiscoverySchema,
3331
3573
  expectedHandoffDigest: digest17,
3332
- invocation: z40.discriminatedUnion("route", [
3333
- z40.strictObject({ route: z40.literal("normalized"), input: DraftCoveredRequiredContextSchema }),
3334
- z40.strictObject({ route: z40.literal("supplied"), input: DraftSuppliedContextSchema }),
3335
- z40.strictObject({ route: z40.literal("typed"), input: DraftTypedNormalizationSchema }),
3336
- z40.strictObject({ route: z40.literal("layered"), input: DraftLayeredNormalizationSchema }),
3337
- z40.strictObject({
3338
- route: z40.literal("evaluated"),
3574
+ invocation: z42.discriminatedUnion("route", [
3575
+ z42.strictObject({ route: z42.literal("normalized"), input: DraftCoveredRequiredContextSchema }),
3576
+ z42.strictObject({ route: z42.literal("supplied"), input: DraftSuppliedContextSchema }),
3577
+ z42.strictObject({ route: z42.literal("typed"), input: DraftTypedNormalizationSchema }),
3578
+ z42.strictObject({ route: z42.literal("layered"), input: DraftLayeredNormalizationSchema }),
3579
+ z42.strictObject({
3580
+ route: z42.literal("evaluated"),
3339
3581
  input: DraftLayeredEvaluationSchema,
3340
3582
  responses: DraftLayeredResponsesSchema
3341
3583
  })
3342
3584
  ])
3343
3585
  });
3344
- var DraftJobDiscoveryReferenceSchema = z40.strictObject({
3345
- schema: z40.literal("felspar.job-discovery-reference.draft/v1"),
3346
- route: z40.enum(["normalized", "supplied"]),
3586
+ var DraftJobDiscoveryReferenceSchema = z42.strictObject({
3587
+ schema: z42.literal("felspar.job-discovery-reference.draft/v1"),
3588
+ route: z42.enum(["normalized", "supplied"]),
3347
3589
  job: DraftRequirementsRequestSchema.options[0].shape.job,
3348
3590
  trustDomain: DraftRequirementsRequestSchema.options[0].shape.trustDomain,
3349
3591
  maxResponseBytes: DraftRequirementsRequestSchema.options[0].shape.maxResponseBytes,
3350
3592
  expectedArtifactDigest: digest17
3351
3593
  });
3352
- var DraftJobExecutionV1Schema = z40.strictObject({
3353
- schema: z40.literal("felspar.job-execution.draft/v1"),
3594
+ var DraftJobExecutionV1Schema = z42.strictObject({
3595
+ schema: z42.literal("felspar.job-execution.draft/v1"),
3354
3596
  discovery: DraftJobDiscoveryReferenceSchema,
3355
3597
  expectedHandoffDigest: digest17,
3356
3598
  invocation: DraftJobExecutionSchema.shape.invocation
3357
3599
  });
3358
- var DraftAnyJobExecutionSchema = z40.discriminatedUnion("schema", [
3600
+ var DraftAnyJobExecutionSchema = z42.discriminatedUnion("schema", [
3359
3601
  DraftJobExecutionSchema,
3360
3602
  DraftJobExecutionV1Schema
3361
3603
  ]);
3362
- var DraftJobReceiptBodySchema = z40.strictObject({
3363
- schema: z40.literal("felspar.job-handoff-receipt.draft/v0"),
3364
- authority: z40.literal("unapproved"),
3365
- runtimeContract: z40.literal(draftJobHandoffContract),
3366
- route: z40.enum(["normalized", "supplied", "typed", "layered", "evaluated"]),
3604
+ var DraftJobReceiptBodySchema = z42.strictObject({
3605
+ schema: z42.literal("felspar.job-handoff-receipt.draft/v0"),
3606
+ authority: z42.literal("unapproved"),
3607
+ runtimeContract: z42.literal(draftJobHandoffContract),
3608
+ route: z42.enum(["normalized", "supplied", "typed", "layered", "evaluated"]),
3367
3609
  inputDigest: digest17,
3368
3610
  handoffDigest: digest17,
3369
3611
  artifactDigest: digest17,
3370
3612
  downstreamRunDigest: digest17,
3371
3613
  capsuleDigest: digest17.nullable(),
3372
- status: z40.enum(["ready", "blocked"])
3614
+ status: z42.enum(["ready", "blocked"])
3373
3615
  });
3374
3616
  var DraftJobReceiptSchema = DraftJobReceiptBodySchema.extend({
3375
3617
  receiptDigest: digest17
3376
3618
  }).refine((receipt) => receipt.status === "ready" === (receipt.capsuleDigest !== null), "Only ready delivery has a capsule digest");
3377
- var DraftJobVerificationSchema = z40.strictObject({
3619
+ var DraftJobVerificationSchema = z42.strictObject({
3378
3620
  receipt: DraftJobReceiptSchema,
3379
3621
  retained: DraftAnyJobExecutionSchema,
3380
3622
  options: DraftContextVerificationOptionsSchema
3381
3623
  });
3382
3624
 
3383
3625
  // ../schemas/src/draft-application-access.ts
3384
- var identifier18 = z41.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@-]*$/u);
3626
+ var identifier18 = z43.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@-]*$/u);
3385
3627
  var digest18 = DraftJobExecutionSchema.shape.expectedHandoffDigest;
3386
- var instant = z41.iso.datetime({ offset: true });
3628
+ var instant = z43.iso.datetime({ offset: true });
3387
3629
  var applicationActions = [
3388
3630
  "submit_source",
3389
3631
  "submit_proposal",
@@ -3392,8 +3634,8 @@ var applicationActions = [
3392
3634
  "execute_job",
3393
3635
  "inspect_run"
3394
3636
  ];
3395
- var action = z41.enum(applicationActions);
3396
- var DraftApplicationScopeSchema = z41.strictObject({
3637
+ var action = z43.enum(applicationActions);
3638
+ var DraftApplicationScopeSchema = z43.strictObject({
3397
3639
  organizationId: identifier18,
3398
3640
  environmentId: identifier18,
3399
3641
  authorityId: identifier18
@@ -3403,40 +3645,40 @@ var DraftApplicationTargetSchema = DraftApplicationScopeSchema.extend({
3403
3645
  resourceId: identifier18,
3404
3646
  jobId: identifier18.nullable()
3405
3647
  }).refine((target) => target.action === "execute_job" === (target.jobId !== null), "Only job execution carries a job ID");
3406
- var DraftApplicationActorSchema = z41.strictObject({
3648
+ var DraftApplicationActorSchema = z43.strictObject({
3407
3649
  principalId: identifier18,
3408
3650
  organizationId: identifier18,
3409
- principalType: z41.enum(["user", "delegated_agent", "autonomous_agent"]),
3651
+ principalType: z43.enum(["user", "delegated_agent", "autonomous_agent"]),
3410
3652
  actingUserId: identifier18.nullable(),
3411
3653
  authenticatedAt: instant,
3412
3654
  expiresAt: instant,
3413
- permissionCeiling: z41.array(action).max(applicationActions.length)
3655
+ permissionCeiling: z43.array(action).max(applicationActions.length)
3414
3656
  }).refine((actor) => actor.principalType === "delegated_agent" === (actor.actingUserId !== null), "Delegated agents preserve the acting user");
3415
- var DraftApplicationPermissionSchema = z41.strictObject({
3657
+ var DraftApplicationPermissionSchema = z43.strictObject({
3416
3658
  target: DraftApplicationTargetSchema,
3417
3659
  principalId: identifier18,
3418
3660
  actingUserId: identifier18.nullable(),
3419
- allowed: z41.boolean(),
3661
+ allowed: z43.boolean(),
3420
3662
  checkedAt: instant,
3421
3663
  expiresAt: instant
3422
3664
  });
3423
- var DraftApplicationJobMaterialSchema = z41.strictObject({
3665
+ var DraftApplicationJobMaterialSchema = z43.strictObject({
3424
3666
  discovery: DraftJobExecutionSchema.shape.discovery,
3425
3667
  expectedHandoffDigest: digest18,
3426
3668
  input: DraftLayeredEvaluationSchema
3427
3669
  });
3428
- var DraftApplicationJobMaterialV2Schema = z41.strictObject({
3429
- schema: z41.literal("felspar.application-job-material.draft/v2"),
3670
+ var DraftApplicationJobMaterialV2Schema = z43.strictObject({
3671
+ schema: z43.literal("felspar.application-job-material.draft/v2"),
3430
3672
  discovery: DraftJobDiscoveryReferenceSchema,
3431
3673
  expectedHandoffDigest: digest18,
3432
3674
  input: DraftLayeredEvaluationSchema
3433
3675
  });
3434
- var DraftAnyApplicationJobMaterialSchema = z41.union([
3676
+ var DraftAnyApplicationJobMaterialSchema = z43.union([
3435
3677
  DraftApplicationJobMaterialV2Schema,
3436
3678
  DraftApplicationJobMaterialSchema
3437
3679
  ]);
3438
- var DraftApplicationJobRequestSchema = z41.strictObject({
3439
- schema: z41.literal("felspar.application-job-request.draft/v0"),
3680
+ var DraftApplicationJobRequestSchema = z43.strictObject({
3681
+ schema: z43.literal("felspar.application-job-request.draft/v0"),
3440
3682
  scope: DraftApplicationScopeSchema,
3441
3683
  releaseId: identifier18,
3442
3684
  expectedReleaseDigest: digest18,
@@ -3444,8 +3686,8 @@ var DraftApplicationJobRequestSchema = z41.strictObject({
3444
3686
  executionId: identifier18,
3445
3687
  material: DraftAnyApplicationJobMaterialSchema
3446
3688
  });
3447
- var DraftApplicationReleaseSchema = z41.strictObject({
3448
- schema: z41.literal("felspar.application-release.draft/v0"),
3689
+ var DraftApplicationReleaseSchema = z43.strictObject({
3690
+ schema: z43.literal("felspar.application-release.draft/v0"),
3449
3691
  scope: DraftApplicationScopeSchema,
3450
3692
  releaseId: identifier18,
3451
3693
  jobId: identifier18,
@@ -3454,50 +3696,50 @@ var DraftApplicationReleaseSchema = z41.strictObject({
3454
3696
  approvalId: identifier18,
3455
3697
  approvedMaterialDigest: digest18,
3456
3698
  releaseDigest: digest18,
3457
- status: z41.enum(["draft", "released", "revoked"])
3699
+ status: z43.enum(["draft", "released", "revoked"])
3458
3700
  });
3459
3701
 
3460
3702
  // ../schemas/src/draft-hosted-application.ts
3461
- import { z as z48 } from "zod";
3703
+ import { z as z50 } from "zod";
3462
3704
 
3463
3705
  // ../schemas/src/draft-hosted-output-checks.ts
3464
- import { z as z47 } from "zod";
3706
+ import { z as z49 } from "zod";
3465
3707
 
3466
3708
  // ../schemas/src/draft-artifact-check-manifest.ts
3467
- import { z as z45 } from "zod";
3709
+ import { z as z47 } from "zod";
3468
3710
 
3469
3711
  // ../schemas/src/draft-artifact-lint-semantic.ts
3470
- import { z as z44 } from "zod";
3712
+ import { z as z46 } from "zod";
3471
3713
 
3472
3714
  // ../schemas/src/draft-claim-evaluation-recipe.ts
3473
- import { z as z43 } from "zod";
3715
+ import { z as z45 } from "zod";
3474
3716
 
3475
3717
  // ../schemas/src/draft-output-check.ts
3476
- import { z as z42 } from "zod";
3718
+ import { z as z44 } from "zod";
3477
3719
  var identifier19 = DraftContextPlanSchema.shape.job;
3478
3720
  var digest19 = DraftJobReceiptBodySchema.shape.inputDigest;
3479
- var byteLimit = z42.number().int().min(1).max(65536);
3480
- var text5 = z42.string().max(16384);
3481
- var sectionRule = z42.discriminatedUnion("check", [
3482
- z42.strictObject({ id: identifier19, check: z42.literal("text"), maxBytes: byteLimit }),
3483
- z42.strictObject({
3721
+ var byteLimit = z44.number().int().min(1).max(65536);
3722
+ var text5 = z44.string().max(16384);
3723
+ var sectionRule = z44.discriminatedUnion("check", [
3724
+ z44.strictObject({ id: identifier19, check: z44.literal("text"), maxBytes: byteLimit }),
3725
+ z44.strictObject({
3484
3726
  id: identifier19,
3485
- check: z42.literal("exact"),
3727
+ check: z44.literal("exact"),
3486
3728
  maxBytes: byteLimit,
3487
- alternatives: z42.array(text5.min(1).regex(/\S/u)).min(1).max(8).refine(hasUniqueValues)
3729
+ alternatives: z44.array(text5.min(1).regex(/\S/u)).min(1).max(8).refine(hasUniqueValues)
3488
3730
  })
3489
3731
  ]);
3490
3732
  var draftOutputCheckerContract = "felspar.structured-output-check/v1";
3491
- var DraftOutputContractSchema = z42.strictObject({
3492
- schema: z42.literal("felspar.output-contract.draft/v0"),
3733
+ var DraftOutputContractSchema = z44.strictObject({
3734
+ schema: z44.literal("felspar.output-contract.draft/v0"),
3493
3735
  id: identifier19,
3494
- version: z42.number().int().min(1).max(65535),
3736
+ version: z44.number().int().min(1).max(65535),
3495
3737
  compiledArtifactDigest: digest19,
3496
3738
  job: identifier19,
3497
3739
  trustDomain: identifier19,
3498
3740
  outputSurface: identifier19,
3499
3741
  maxBytes: byteLimit,
3500
- sections: z42.array(sectionRule).min(1).max(16)
3742
+ sections: z44.array(sectionRule).min(1).max(16)
3501
3743
  }).superRefine((contract, context3) => {
3502
3744
  if (!hasUniqueValues(contract.sections.map((section) => section.id))) {
3503
3745
  context3.addIssue({ code: "custom", message: "Duplicate output section rule" });
@@ -3509,14 +3751,14 @@ var DraftOutputContractSchema = z42.strictObject({
3509
3751
  }
3510
3752
  }
3511
3753
  });
3512
- var DraftStructuredOutputSchema = z42.strictObject({
3513
- schema: z42.literal("felspar.structured-output.draft/v0"),
3754
+ var DraftStructuredOutputSchema = z44.strictObject({
3755
+ schema: z44.literal("felspar.structured-output.draft/v0"),
3514
3756
  id: identifier19,
3515
3757
  revision: identifier19,
3516
- sections: z42.array(z42.strictObject({ id: identifier19, text: text5 })).max(32).refine((sections) => hasUniqueValues(sections.map((section) => section.id)))
3758
+ sections: z44.array(z44.strictObject({ id: identifier19, text: text5 })).max(32).refine((sections) => hasUniqueValues(sections.map((section) => section.id)))
3517
3759
  });
3518
- var DraftOutputCheckSchema = z42.strictObject({
3519
- schema: z42.literal("felspar.output-check.draft/v0"),
3760
+ var DraftOutputCheckSchema = z44.strictObject({
3761
+ schema: z44.literal("felspar.output-check.draft/v0"),
3520
3762
  execution: DraftJobExecutionSchema,
3521
3763
  expectedJobReceiptDigest: digest19,
3522
3764
  contractEntryId: identifier19,
@@ -3524,8 +3766,8 @@ var DraftOutputCheckSchema = z42.strictObject({
3524
3766
  output: DraftStructuredOutputSchema,
3525
3767
  expectedOutputDigest: digest19
3526
3768
  });
3527
- var DraftOutputDiagnosticSchema = z42.strictObject({
3528
- code: z42.enum([
3769
+ var DraftOutputDiagnosticSchema = z44.strictObject({
3770
+ code: z44.enum([
3529
3771
  "upstream_blocked",
3530
3772
  "contract_coverage_incomplete",
3531
3773
  "contract_invalid",
@@ -3538,13 +3780,13 @@ var DraftOutputDiagnosticSchema = z42.strictObject({
3538
3780
  ]),
3539
3781
  sectionId: identifier19.nullable()
3540
3782
  });
3541
- var DraftOutputReceiptBodySchema = z42.strictObject({
3542
- schema: z42.literal("felspar.output-receipt.draft/v0"),
3543
- authority: z42.literal("unapproved"),
3544
- checkerContract: z42.literal(draftOutputCheckerContract),
3545
- coverage: z42.literal("declared_structure_and_exact_text"),
3546
- semanticEvaluation: z42.literal("not_performed"),
3547
- actionAuthorized: z42.literal(false),
3783
+ var DraftOutputReceiptBodySchema = z44.strictObject({
3784
+ schema: z44.literal("felspar.output-receipt.draft/v0"),
3785
+ authority: z44.literal("unapproved"),
3786
+ checkerContract: z44.literal(draftOutputCheckerContract),
3787
+ coverage: z44.literal("declared_structure_and_exact_text"),
3788
+ semanticEvaluation: z44.literal("not_performed"),
3789
+ actionAuthorized: z44.literal(false),
3548
3790
  inputDigest: digest19,
3549
3791
  jobReceiptDigest: digest19,
3550
3792
  compiledArtifactDigest: digest19,
@@ -3553,39 +3795,39 @@ var DraftOutputReceiptBodySchema = z42.strictObject({
3553
3795
  outputDigest: digest19,
3554
3796
  outputId: identifier19,
3555
3797
  outputRevision: identifier19,
3556
- status: z42.enum(["checks_passed", "invalid", "blocked"]),
3557
- structuralOnlySectionIds: z42.array(identifier19).max(16),
3558
- diagnostics: z42.array(DraftOutputDiagnosticSchema).max(81)
3798
+ status: z44.enum(["checks_passed", "invalid", "blocked"]),
3799
+ structuralOnlySectionIds: z44.array(identifier19).max(16),
3800
+ diagnostics: z44.array(DraftOutputDiagnosticSchema).max(81)
3559
3801
  });
3560
3802
  var DraftOutputReceiptSchema = DraftOutputReceiptBodySchema.extend({
3561
3803
  receiptDigest: digest19
3562
3804
  });
3563
- var DraftOutputVerificationOptionsSchema = z42.strictObject({
3805
+ var DraftOutputVerificationOptionsSchema = z44.strictObject({
3564
3806
  expectedReceiptDigest: digest19
3565
3807
  });
3566
3808
 
3567
3809
  // ../schemas/src/draft-claim-evaluation-recipe.ts
3568
3810
  var scope = DraftOutputContractSchema.shape;
3569
3811
  var identifier20 = scope.id;
3570
- var text6 = z43.string().min(1).max(2048).regex(/\S/u);
3571
- var ids2 = z43.array(identifier20).max(8).refine(hasUniqueValues, "Duplicate identifier");
3812
+ var text6 = z45.string().min(1).max(2048).regex(/\S/u);
3813
+ var ids2 = z45.array(identifier20).max(8).refine(hasUniqueValues, "Duplicate identifier");
3572
3814
  var { judgment: judgment3 } = DraftNormalizedEvidenceSchema.shape.normalizations.element.shape;
3573
- var option = z43.strictObject({
3815
+ var option = z45.strictObject({
3574
3816
  value: judgment3.options[0].shape.probabilities.element.shape.value,
3575
3817
  meaning: text6,
3576
- effect: z43.enum(["satisfied", "violated", "unresolved"])
3818
+ effect: z45.enum(["satisfied", "violated", "unresolved"])
3577
3819
  });
3578
- var question = z43.strictObject({
3820
+ var question = z45.strictObject({
3579
3821
  id: identifier20,
3580
3822
  sectionIds: ids2.min(1),
3581
3823
  instructions: text6,
3582
3824
  authorityEntryIds: ids2.min(1),
3583
3825
  evidenceKeys: ids2,
3584
- options: z43.array(option).min(2).max(8).refine((items) => hasUniqueValues(items.map((item) => item.value)), "Duplicate option").refine((items) => items.some((item) => item.effect === "unresolved"), "Explicit unresolved option required"),
3585
- minimumSelectedProbability: z43.number().gt(0).max(1)
3826
+ options: z45.array(option).min(2).max(8).refine((items) => hasUniqueValues(items.map((item) => item.value)), "Duplicate option").refine((items) => items.some((item) => item.effect === "unresolved"), "Explicit unresolved option required"),
3827
+ minimumSelectedProbability: z45.number().gt(0).max(1)
3586
3828
  });
3587
- var DraftClaimEvaluationRecipeSchema = z43.strictObject({
3588
- schema: z43.literal("felspar.claim-evaluation-recipe.draft/v0"),
3829
+ var DraftClaimEvaluationRecipeSchema = z45.strictObject({
3830
+ schema: z45.literal("felspar.claim-evaluation-recipe.draft/v0"),
3589
3831
  id: identifier20,
3590
3832
  version: identifier20,
3591
3833
  compiledArtifactDigest: scope.compiledArtifactDigest,
@@ -3595,16 +3837,16 @@ var DraftClaimEvaluationRecipeSchema = z43.strictObject({
3595
3837
  evaluator: DraftEvaluatorContractSchema.shape.evaluator,
3596
3838
  calibration: DraftEvaluatorContractSchema.shape.calibration,
3597
3839
  probabilityContract: DraftEvaluatorContractSchema.shape.probabilityContract,
3598
- questions: z43.array(question).min(1).max(8).refine((items) => hasUniqueValues(items.map((item) => item.id)), "Duplicate question"),
3599
- limits: z43.strictObject({
3600
- maxRequests: z43.number().int().min(1).max(128),
3601
- maxRequestBytes: z43.number().int().min(1).max(16384),
3602
- maxTotalBytes: z43.number().int().min(1).max(65536)
3840
+ questions: z45.array(question).min(1).max(8).refine((items) => hasUniqueValues(items.map((item) => item.id)), "Duplicate question"),
3841
+ limits: z45.strictObject({
3842
+ maxRequests: z45.number().int().min(1).max(128),
3843
+ maxRequestBytes: z45.number().int().min(1).max(16384),
3844
+ maxTotalBytes: z45.number().int().min(1).max(65536)
3603
3845
  })
3604
3846
  });
3605
3847
 
3606
3848
  // ../schemas/src/draft-artifact-lint-semantic.ts
3607
- var id2 = DraftApplicationScopeSchema.shape.authorityId;
3849
+ var id3 = DraftApplicationScopeSchema.shape.authorityId;
3608
3850
  var digest20 = DraftJobReceiptSchema.shape.receiptDigest;
3609
3851
  var recipe = DraftClaimEvaluationRecipeSchema.shape;
3610
3852
  var recipeQuestion = recipe.questions.element.shape;
@@ -3616,82 +3858,82 @@ var artifactSemanticLimits = {
3616
3858
  maxRequestBytes: 32768,
3617
3859
  maxTotalBytes: 1048576
3618
3860
  };
3619
- var ArtifactSemanticQuestionSchema = z44.strictObject({
3620
- id: id2,
3861
+ var ArtifactSemanticQuestionSchema = z46.strictObject({
3862
+ id: id3,
3621
3863
  instructions: recipeQuestion.instructions,
3622
3864
  options: recipeQuestion.options,
3623
3865
  minimumSelectedProbability: recipeQuestion.minimumSelectedProbability,
3624
- aggregation: z44.enum(["prohibit", "require", "match"])
3866
+ aggregation: z46.enum(["prohibit", "require", "match"])
3625
3867
  });
3626
- var ArtifactSemanticRecipeSchema = z44.strictObject({
3868
+ var ArtifactSemanticRecipeSchema = z46.strictObject({
3627
3869
  evaluator: recipe.evaluator,
3628
3870
  calibration: recipe.calibration,
3629
3871
  probabilityContract: recipe.probabilityContract,
3630
- questions: z44.array(ArtifactSemanticQuestionSchema).min(1).max(artifactSemanticLimits.maxQuestions),
3631
- limits: z44.strictObject({
3632
- maxEvaluations: z44.number().int().min(1).max(artifactSemanticLimits.maxEvaluations),
3633
- maxRequestBytes: z44.number().int().min(1).max(artifactSemanticLimits.maxRequestBytes),
3634
- maxTotalBytes: z44.number().int().min(1).max(artifactSemanticLimits.maxTotalBytes)
3872
+ questions: z46.array(ArtifactSemanticQuestionSchema).min(1).max(artifactSemanticLimits.maxQuestions),
3873
+ limits: z46.strictObject({
3874
+ maxEvaluations: z46.number().int().min(1).max(artifactSemanticLimits.maxEvaluations),
3875
+ maxRequestBytes: z46.number().int().min(1).max(artifactSemanticLimits.maxRequestBytes),
3876
+ maxTotalBytes: z46.number().int().min(1).max(artifactSemanticLimits.maxTotalBytes)
3635
3877
  })
3636
3878
  });
3637
- var ArtifactSemanticRequestSchema = z44.strictObject({
3638
- schema: z44.literal("felspar.artifact-question.draft/v1"),
3879
+ var ArtifactSemanticRequestSchema = z46.strictObject({
3880
+ schema: z46.literal("felspar.artifact-question.draft/v1"),
3639
3881
  preparationDigest: digest20,
3640
- unitId: id2,
3641
- sectionId: id2,
3642
- start: z44.number().int().min(0),
3643
- end: z44.number().int().min(1),
3882
+ unitId: id3,
3883
+ sectionId: id3,
3884
+ start: z46.number().int().min(0),
3885
+ end: z46.number().int().min(1),
3644
3886
  textDigest: digest20,
3645
- text: z44.string().min(1),
3646
- questionId: id2,
3887
+ text: z46.string().min(1),
3888
+ questionId: id3,
3647
3889
  instructions: recipeQuestion.instructions,
3648
- options: z44.array(z44.strictObject({ value: z44.string(), meaning: z44.string() })).min(2).max(8),
3649
- policy: z44.array(z44.strictObject({ sourceLocator: z44.string(), text: z44.string() })).min(1),
3890
+ options: z46.array(z46.strictObject({ value: z46.string(), meaning: z46.string() })).min(2).max(8),
3891
+ policy: z46.array(z46.strictObject({ sourceLocator: z46.string(), text: z46.string() })).min(1),
3650
3892
  evaluator: recipe.evaluator,
3651
3893
  calibration: recipe.calibration,
3652
3894
  requestDigest: digest20
3653
3895
  });
3654
- var ArtifactSemanticResponseSchema = z44.strictObject({
3655
- schema: z44.literal("felspar.artifact-question-response.draft/v1"),
3896
+ var ArtifactSemanticResponseSchema = z46.strictObject({
3897
+ schema: z46.literal("felspar.artifact-question-response.draft/v1"),
3656
3898
  preparationDigest: digest20,
3657
3899
  evaluator: recipe.evaluator,
3658
3900
  calibrationDigest: digest20,
3659
- answers: z44.array(z44.strictObject({ unitId: id2, questionId: id2, requestDigest: digest20, judgment: judgment4 })).max(artifactSemanticLimits.maxEvaluations)
3901
+ answers: z46.array(z46.strictObject({ unitId: id3, questionId: id3, requestDigest: digest20, judgment: judgment4 })).max(artifactSemanticLimits.maxEvaluations)
3660
3902
  });
3661
- var ArtifactSemanticJudgmentSchema = z44.strictObject({
3662
- unitId: id2,
3663
- sectionId: id2,
3664
- start: z44.number().int().min(0),
3665
- end: z44.number().int().min(1),
3903
+ var ArtifactSemanticJudgmentSchema = z46.strictObject({
3904
+ unitId: id3,
3905
+ sectionId: id3,
3906
+ start: z46.number().int().min(0),
3907
+ end: z46.number().int().min(1),
3666
3908
  textDigest: digest20,
3667
- questionId: id2,
3909
+ questionId: id3,
3668
3910
  requestDigest: digest20,
3669
3911
  judgment: judgment4.nullable(),
3670
- value: z44.string().nullable(),
3671
- effect: z44.enum(["satisfied", "violated", "unresolved", "unavailable", "not_stated"]),
3672
- reasons: z44.array(z44.string().max(128)).max(8)
3912
+ value: z46.string().nullable(),
3913
+ effect: z46.enum(["satisfied", "violated", "unresolved", "unavailable", "not_stated"]),
3914
+ reasons: z46.array(z46.string().max(128)).max(8)
3673
3915
  });
3674
- var ArtifactSemanticRecordSchema = z44.strictObject({
3675
- state: z44.enum(["ready", "skipped", "over_budget", "not_evaluated"]),
3916
+ var ArtifactSemanticRecordSchema = z46.strictObject({
3917
+ state: z46.enum(["ready", "skipped", "over_budget", "not_evaluated"]),
3676
3918
  preparationDigest: digest20,
3677
3919
  evaluator: ArtifactSemanticRecipeSchema.shape.evaluator,
3678
3920
  calibrationDigest: digest20,
3679
3921
  probabilityContract: ArtifactSemanticRecipeSchema.shape.probabilityContract,
3680
- questions: z44.array(ArtifactSemanticQuestionSchema.pick({
3922
+ questions: z46.array(ArtifactSemanticQuestionSchema.pick({
3681
3923
  id: true,
3682
3924
  minimumSelectedProbability: true,
3683
3925
  aggregation: true
3684
3926
  }).extend({
3685
- checkId: id2,
3686
- anchorSectionId: id2,
3687
- sectionsAvailable: z44.boolean(),
3688
- units: z44.number().int().min(0).max(artifactSemanticLimits.maxEvaluations),
3689
- options: z44.array(z44.strictObject({
3927
+ checkId: id3,
3928
+ anchorSectionId: id3,
3929
+ sectionsAvailable: z46.boolean(),
3930
+ units: z46.number().int().min(0).max(artifactSemanticLimits.maxEvaluations),
3931
+ options: z46.array(z46.strictObject({
3690
3932
  value: ArtifactSemanticQuestionSchema.shape.options.element.shape.value,
3691
- effect: z44.enum(["satisfied", "violated", "unresolved", "not_stated"])
3933
+ effect: z46.enum(["satisfied", "violated", "unresolved", "not_stated"])
3692
3934
  })).min(2).max(8)
3693
3935
  })).max(artifactSemanticLimits.maxQuestions),
3694
- judgments: z44.array(ArtifactSemanticJudgmentSchema).max(artifactSemanticLimits.maxEvaluations)
3936
+ judgments: z46.array(ArtifactSemanticJudgmentSchema).max(artifactSemanticLimits.maxEvaluations)
3695
3937
  });
3696
3938
  var caseNotStated = "not_stated";
3697
3939
  var abstain = "cannot_determine";
@@ -3734,7 +3976,7 @@ function inspectSemantic(manifest2, issue) {
3734
3976
  }
3735
3977
 
3736
3978
  // ../schemas/src/draft-artifact-check-manifest.ts
3737
- var id3 = DraftApplicationScopeSchema.shape.authorityId;
3979
+ var id4 = DraftApplicationScopeSchema.shape.authorityId;
3738
3980
  var digest21 = DraftJobReceiptSchema.shape.receiptDigest;
3739
3981
  var artifactLintLimits = {
3740
3982
  maxTotalBytes: 65536,
@@ -3749,12 +3991,12 @@ var artifactLintLimits = {
3749
3991
  function isWellFormedText(value) {
3750
3992
  return !/\p{Cs}/u.test(value);
3751
3993
  }
3752
- var literal = z45.string().min(1).max(artifactLintLimits.maxLiteralUnits).regex(/\S/u).refine(isWellFormedText);
3753
- var passage = z45.strictObject({
3754
- sourceLocator: z45.string().min(1).max(4096).regex(/\S/u),
3994
+ var literal = z47.string().min(1).max(artifactLintLimits.maxLiteralUnits).regex(/\S/u).refine(isWellFormedText);
3995
+ var passage = z47.strictObject({
3996
+ sourceLocator: z47.string().min(1).max(4096).regex(/\S/u),
3755
3997
  contentDigest: digest21
3756
3998
  });
3757
- var common = { id: id3, required: z45.boolean(), specification: passage };
3999
+ var common = { id: id4, required: z47.boolean(), specification: passage };
3758
4000
  var artifactCheckKinds = [
3759
4001
  "section",
3760
4002
  "required_wording",
@@ -3767,64 +4009,64 @@ var artifactLintMediaTypes = [
3767
4009
  "text/plain",
3768
4010
  "application/vnd.felspar.structured-output+json"
3769
4011
  ];
3770
- var sectionTargets = z45.array(id3).min(1).max(artifactLintLimits.maxSections);
3771
- var ArtifactCheckSchema = z45.discriminatedUnion("kind", [
3772
- z45.strictObject({ ...common, kind: z45.literal("section"), sectionId: id3 }),
3773
- z45.strictObject({
4012
+ var sectionTargets = z47.array(id4).min(1).max(artifactLintLimits.maxSections);
4013
+ var ArtifactCheckSchema = z47.discriminatedUnion("kind", [
4014
+ z47.strictObject({ ...common, kind: z47.literal("section"), sectionId: id4 }),
4015
+ z47.strictObject({
3774
4016
  ...common,
3775
- kind: z45.literal("required_wording"),
3776
- sectionId: id3,
3777
- alternatives: z45.array(literal).min(1).max(artifactLintLimits.maxAlternatives)
4017
+ kind: z47.literal("required_wording"),
4018
+ sectionId: id4,
4019
+ alternatives: z47.array(literal).min(1).max(artifactLintLimits.maxAlternatives)
3778
4020
  }),
3779
- z45.strictObject({
4021
+ z47.strictObject({
3780
4022
  ...common,
3781
- kind: z45.literal("prohibited_literal"),
4023
+ kind: z47.literal("prohibited_literal"),
3782
4024
  sectionIds: sectionTargets,
3783
- literals: z45.array(literal).min(1).max(artifactLintLimits.maxLiterals)
4025
+ literals: z47.array(literal).min(1).max(artifactLintLimits.maxLiterals)
3784
4026
  }),
3785
- z45.strictObject({
4027
+ z47.strictObject({
3786
4028
  ...common,
3787
- kind: z45.literal("field_value"),
3788
- sectionId: id3,
3789
- label: z45.string().min(1).max(128).regex(/^[^\s:](?:[^\n\r:]*[^\s:])?$/u).refine(isWellFormedText),
3790
- unit: z45.string().min(1).max(32).regex(/^\S+$/u).refine(isWellFormedText).nullable(),
3791
- evidenceKey: id3,
3792
- comparator: z45.enum(["eq", "lte", "gte"])
4029
+ kind: z47.literal("field_value"),
4030
+ sectionId: id4,
4031
+ label: z47.string().min(1).max(128).regex(/^[^\s:](?:[^\n\r:]*[^\s:])?$/u).refine(isWellFormedText),
4032
+ unit: z47.string().min(1).max(32).regex(/^\S+$/u).refine(isWellFormedText).nullable(),
4033
+ evidenceKey: id4,
4034
+ comparator: z47.enum(["eq", "lte", "gte"])
3793
4035
  }),
3794
- z45.strictObject({
4036
+ z47.strictObject({
3795
4037
  ...common,
3796
- kind: z45.literal("case_answer"),
4038
+ kind: z47.literal("case_answer"),
3797
4039
  sectionIds: sectionTargets,
3798
- fact: z45.discriminatedUnion("comparison", [
3799
- z45.strictObject({ key: id3, comparison: z45.literal("choice") }),
3800
- z45.strictObject({
3801
- key: id3,
3802
- comparison: z45.literal("number"),
4040
+ fact: z47.discriminatedUnion("comparison", [
4041
+ z47.strictObject({ key: id4, comparison: z47.literal("choice") }),
4042
+ z47.strictObject({
4043
+ key: id4,
4044
+ comparison: z47.literal("number"),
3803
4045
  reader: ExactReaderSchema.options[0]
3804
4046
  }),
3805
- z45.strictObject({
3806
- key: id3,
3807
- comparison: z45.literal("date"),
4047
+ z47.strictObject({
4048
+ key: id4,
4049
+ comparison: z47.literal("date"),
3808
4050
  reader: ExactReaderSchema.options[1]
3809
4051
  })
3810
4052
  ]),
3811
- answers: z45.array(z45.strictObject({
3812
- value: id3,
3813
- wording: z45.array(literal).max(artifactLintLimits.maxAlternatives)
4053
+ answers: z47.array(z47.strictObject({
4054
+ value: id4,
4055
+ wording: z47.array(literal).max(artifactLintLimits.maxAlternatives)
3814
4056
  })).max(artifactLintLimits.maxLiterals),
3815
- questionId: id3.nullable()
4057
+ questionId: id4.nullable()
3816
4058
  }),
3817
- z45.strictObject({
4059
+ z47.strictObject({
3818
4060
  ...common,
3819
- kind: z45.literal("semantic_question"),
4061
+ kind: z47.literal("semantic_question"),
3820
4062
  sectionIds: sectionTargets,
3821
- questionId: id3
4063
+ questionId: id4
3822
4064
  })
3823
4065
  ]);
3824
- var sectionDeclaration = z45.strictObject({
3825
- id: id3,
3826
- heading: z45.string().min(1).max(256).regex(/\S/u).refine((value) => !/[\n\r]/u.test(value) && isWellFormedText(value)).nullable(),
3827
- maxUnits: z45.number().int().min(1).max(artifactLintLimits.maxSectionUnits)
4066
+ var sectionDeclaration = z47.strictObject({
4067
+ id: id4,
4068
+ heading: z47.string().min(1).max(256).regex(/\S/u).refine((value) => !/[\n\r]/u.test(value) && isWellFormedText(value)).nullable(),
4069
+ maxUnits: z47.number().int().min(1).max(artifactLintLimits.maxSectionUnits)
3828
4070
  });
3829
4071
  function caseAnswerIssues(checks) {
3830
4072
  const issues = [];
@@ -3844,18 +4086,18 @@ function caseAnswerIssues(checks) {
3844
4086
  }
3845
4087
  return issues;
3846
4088
  }
3847
- var ArtifactCheckManifestSchema = z45.strictObject({
3848
- schema: z45.literal("felspar.artifact-check-manifest.draft/v1"),
3849
- id: id3,
3850
- version: z45.number().int().min(1).max(65535),
3851
- jobId: id3,
3852
- trustDomain: id3,
3853
- contract: z45.strictObject({ id: id3, digest: digest21 }),
3854
- parser: z45.enum(["body", "headings"]),
3855
- maxBytes: z45.number().int().min(1).max(artifactLintLimits.maxTotalBytes),
3856
- sections: z45.array(sectionDeclaration).min(1).max(artifactLintLimits.maxSections),
3857
- caseContext: z45.enum(["required", "not_required"]),
3858
- checks: z45.array(ArtifactCheckSchema).min(1).max(artifactLintLimits.maxChecks),
4089
+ var ArtifactCheckManifestSchema = z47.strictObject({
4090
+ schema: z47.literal("felspar.artifact-check-manifest.draft/v1"),
4091
+ id: id4,
4092
+ version: z47.number().int().min(1).max(65535),
4093
+ jobId: id4,
4094
+ trustDomain: id4,
4095
+ contract: z47.strictObject({ id: id4, digest: digest21 }),
4096
+ parser: z47.enum(["body", "headings"]),
4097
+ maxBytes: z47.number().int().min(1).max(artifactLintLimits.maxTotalBytes),
4098
+ sections: z47.array(sectionDeclaration).min(1).max(artifactLintLimits.maxSections),
4099
+ caseContext: z47.enum(["required", "not_required"]),
4100
+ checks: z47.array(ArtifactCheckSchema).min(1).max(artifactLintLimits.maxChecks),
3859
4101
  semantic: ArtifactSemanticRecipeSchema.nullable()
3860
4102
  }).superRefine((manifest2, context3) => {
3861
4103
  const issue = (message) => {
@@ -3900,11 +4142,11 @@ var ArtifactCheckManifestSchema = z45.strictObject({
3900
4142
  var ArtifactSpecificationSchema = passage;
3901
4143
 
3902
4144
  // ../schemas/src/draft-job-obligations-manifest.ts
3903
- import { z as z46 } from "zod";
3904
- var id4 = DraftApplicationScopeSchema.shape.authorityId;
4145
+ import { z as z48 } from "zod";
4146
+ var id5 = DraftApplicationScopeSchema.shape.authorityId;
3905
4147
  var digest22 = DraftJobReceiptSchema.shape.receiptDigest;
3906
4148
  var passage2 = {
3907
- sourceLocator: z46.string().min(1).max(4096).regex(/\S/u),
4149
+ sourceLocator: z48.string().min(1).max(4096).regex(/\S/u),
3908
4150
  contentDigest: digest22
3909
4151
  };
3910
4152
  var jobObligationsLimits = {
@@ -3915,41 +4157,41 @@ var jobObligationsLimits = {
3915
4157
  maxApprovalTargets: 16,
3916
4158
  maxManifestBytes: 65536
3917
4159
  };
3918
- var DraftJobObligationsScopeSchema = z46.strictObject({
3919
- purposeRef: id4,
3920
- useRef: id4.nullable()
4160
+ var DraftJobObligationsScopeSchema = z48.strictObject({
4161
+ purposeRef: id5,
4162
+ useRef: id5.nullable()
3921
4163
  });
3922
- var artifact = z46.strictObject({
3923
- id: id4,
3924
- role: id4,
3925
- contract: z46.strictObject({ id: id4, digest: digest22 }),
4164
+ var artifact = z48.strictObject({
4165
+ id: id5,
4166
+ role: id5,
4167
+ contract: z48.strictObject({ id: id5, digest: digest22 }),
3926
4168
  ...passage2
3927
4169
  });
3928
- var approval = z46.strictObject({
3929
- id: id4,
3930
- policy: z46.strictObject({ id: id4, ...passage2 }),
3931
- phase: z46.enum(["before_decision", "before_generation", "before_use"]),
3932
- appliesTo: z46.array(z46.discriminatedUnion("kind", [
3933
- z46.strictObject({ kind: z46.literal("decision") }),
3934
- z46.strictObject({ kind: z46.literal("artifact"), id: id4 }),
3935
- z46.strictObject({ kind: z46.literal("use") })
4170
+ var approval = z48.strictObject({
4171
+ id: id5,
4172
+ policy: z48.strictObject({ id: id5, ...passage2 }),
4173
+ phase: z48.enum(["before_decision", "before_generation", "before_use"]),
4174
+ appliesTo: z48.array(z48.discriminatedUnion("kind", [
4175
+ z48.strictObject({ kind: z48.literal("decision") }),
4176
+ z48.strictObject({ kind: z48.literal("artifact"), id: id5 }),
4177
+ z48.strictObject({ kind: z48.literal("use") })
3936
4178
  ])).min(1).max(jobObligationsLimits.maxApprovalTargets)
3937
4179
  });
3938
- var outcome = z46.strictObject({
3939
- outcomeId: id4,
4180
+ var outcome = z48.strictObject({
4181
+ outcomeId: id5,
3940
4182
  ...passage2,
3941
- contextRequired: z46.boolean(),
3942
- artifacts: z46.array(artifact).max(jobObligationsLimits.maxArtifacts),
3943
- approvals: z46.array(approval).max(jobObligationsLimits.maxApprovals)
4183
+ contextRequired: z48.boolean(),
4184
+ artifacts: z48.array(artifact).max(jobObligationsLimits.maxArtifacts),
4185
+ approvals: z48.array(approval).max(jobObligationsLimits.maxApprovals)
3944
4186
  });
3945
- var manifest = z46.strictObject({
3946
- schema: z46.literal("felspar.job-obligations.draft/v0"),
3947
- jobId: id4,
3948
- trustDomain: id4,
4187
+ var manifest = z48.strictObject({
4188
+ schema: z48.literal("felspar.job-obligations.draft/v0"),
4189
+ jobId: id5,
4190
+ trustDomain: id5,
3949
4191
  scope: DraftJobObligationsScopeSchema,
3950
4192
  source: DraftSourceReferenceSchema,
3951
- contracts: z46.array(z46.strictObject({ id: id4, ...passage2 })).max(jobObligationsLimits.maxContracts),
3952
- outcomes: z46.array(outcome).min(1).max(jobObligationsLimits.maxOutcomes)
4193
+ contracts: z48.array(z48.strictObject({ id: id5, ...passage2 })).max(jobObligationsLimits.maxContracts),
4194
+ outcomes: z48.array(outcome).min(1).max(jobObligationsLimits.maxOutcomes)
3953
4195
  });
3954
4196
  function unique3(values, context3, path3) {
3955
4197
  const distinct = new Set(values);
@@ -4020,10 +4262,10 @@ var DraftJobObligationsOutcomeSchema = outcome;
4020
4262
 
4021
4263
  // ../schemas/src/draft-hosted-output-checks.ts
4022
4264
  var hostedOutputCheckLimits = { maxOutputs: 8 };
4023
- var HostedOutputChecksSchema = z47.strictObject({
4024
- schema: z47.literal("felspar.output-checks.draft/v0"),
4265
+ var HostedOutputChecksSchema = z49.strictObject({
4266
+ schema: z49.literal("felspar.output-checks.draft/v0"),
4025
4267
  obligations: DraftJobObligationsSchema,
4026
- manifests: z47.array(ArtifactCheckManifestSchema).min(1).max(hostedOutputCheckLimits.maxOutputs)
4268
+ manifests: z49.array(ArtifactCheckManifestSchema).min(1).max(hostedOutputCheckLimits.maxOutputs)
4027
4269
  }).superRefine((value, context3) => {
4028
4270
  if (context3.issues.length > 0) {
4029
4271
  return;
@@ -4050,59 +4292,59 @@ var HostedOutputChecksSchema = z47.strictObject({
4050
4292
  });
4051
4293
 
4052
4294
  // ../schemas/src/draft-hosted-application.ts
4053
- var id5 = z48.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u);
4295
+ var id6 = z50.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u);
4054
4296
  var digest23 = DraftApplicationReleaseSchema.shape.releaseDigest;
4055
- var HostedSourceInputSchema = z48.strictObject({
4056
- sourceId: id5,
4057
- revision: id5,
4058
- title: z48.string().min(1).max(200),
4059
- text: z48.string().min(1).max(1048576)
4060
- });
4061
- var HostedProposalInputV0Schema = z48.strictObject({
4062
- sourceObjectId: id5,
4297
+ var HostedSourceInputSchema = z50.strictObject({
4298
+ sourceId: id6,
4299
+ revision: id6,
4300
+ title: z50.string().min(1).max(200),
4301
+ text: z50.string().min(1).max(1048576)
4302
+ });
4303
+ var HostedProposalInputV0Schema = z50.strictObject({
4304
+ sourceObjectId: id6,
4063
4305
  expectedSourceDigest: digest23,
4064
4306
  material: DraftApplicationJobMaterialSchema,
4065
4307
  compilation: DraftCompilationSchema
4066
4308
  });
4067
- var HostedProposalInputV2Schema = z48.strictObject({
4068
- schema: z48.literal("felspar.hosted-proposal.draft/v2"),
4069
- sourceObjectId: id5,
4309
+ var HostedProposalInputV2Schema = z50.strictObject({
4310
+ schema: z50.literal("felspar.hosted-proposal.draft/v2"),
4311
+ sourceObjectId: id6,
4070
4312
  expectedSourceDigest: digest23,
4071
4313
  material: DraftApplicationJobMaterialV2Schema,
4072
4314
  outputChecks: HostedOutputChecksSchema.optional()
4073
4315
  });
4074
- var HostedProposalInputSchema = z48.union([
4316
+ var HostedProposalInputSchema = z50.union([
4075
4317
  HostedProposalInputV2Schema,
4076
4318
  HostedProposalInputV0Schema
4077
4319
  ]);
4078
- var HostedApprovalInputSchema = z48.strictObject({
4320
+ var HostedApprovalInputSchema = z50.strictObject({
4079
4321
  expectedProposalDigest: digest23,
4080
- reviewedMeaning: z48.literal(true),
4081
- reviewedFixtures: z48.literal(true),
4082
- reviewNote: z48.string().min(1).max(2e3)
4322
+ reviewedMeaning: z50.literal(true),
4323
+ reviewedFixtures: z50.literal(true),
4324
+ reviewNote: z50.string().min(1).max(2e3)
4083
4325
  });
4084
- var HostedReleaseInputSchema = z48.strictObject({ expectedApprovalDigest: digest23 });
4085
- var HostedReleaseBundleSchema = z48.strictObject({
4326
+ var HostedReleaseInputSchema = z50.strictObject({ expectedApprovalDigest: digest23 });
4327
+ var HostedReleaseBundleSchema = z50.strictObject({
4086
4328
  release: DraftApplicationReleaseSchema,
4087
4329
  material: DraftAnyApplicationJobMaterialSchema,
4088
- approvalObjectId: id5,
4330
+ approvalObjectId: id6,
4089
4331
  approvalDigest: digest23,
4090
4332
  proposalDigest: digest23,
4091
4333
  sourceDigest: digest23,
4092
4334
  verifiedCompilation: DraftVerifiedCompilationSchema.optional()
4093
4335
  });
4094
- var HostedJobInputSchema = z48.strictObject({
4095
- executionId: id5,
4336
+ var HostedJobInputSchema = z50.strictObject({
4337
+ executionId: id6,
4096
4338
  expectedReleaseDigest: digest23,
4097
4339
  material: DraftAnyApplicationJobMaterialSchema
4098
4340
  });
4099
- var HostedSuppliedJobInputSchema = z48.strictObject({
4100
- mode: z48.literal("supplied"),
4101
- executionId: id5,
4341
+ var HostedSuppliedJobInputSchema = z50.strictObject({
4342
+ mode: z50.literal("supplied"),
4343
+ executionId: id6,
4102
4344
  expectedReleaseDigest: digest23,
4103
4345
  expectedAuthorityDigest: digest23,
4104
- jobId: id5,
4105
- entityId: id5,
4346
+ jobId: id6,
4347
+ entityId: id6,
4106
4348
  evidence: DraftRequiredDecisionSchema.shape.evidence,
4107
4349
  passages: DraftLayeredEvaluationSchema.shape.passages.max(256)
4108
4350
  });
@@ -4112,88 +4354,95 @@ var hostedFactsLimits = {
4112
4354
  maxFactsBytes: 524288,
4113
4355
  maxQuestions: 64
4114
4356
  };
4115
- var factSource = z48.strictObject({
4116
- class: id5,
4357
+ var factSource = z50.strictObject({
4358
+ class: id6,
4117
4359
  id: DraftSourceReferenceSchema.shape.sourceId,
4118
- revision: id5.optional(),
4119
- locator: z48.string().min(1).max(4096).optional(),
4360
+ revision: id6.optional(),
4361
+ locator: z50.string().min(1).max(4096).optional(),
4120
4362
  observedAt: DraftObservationChecksSchema.shape.evaluationTime,
4121
- sensitivity: id5.optional()
4363
+ sensitivity: id6.optional()
4122
4364
  });
4123
- var excerptText = z48.string().min(1).refine((text7) => text7.length <= hostedFactsLimits.maxExcerptCharacters, "text_too_long");
4124
- var HostedExcerptSchema = z48.strictObject({ text: excerptText, source: factSource });
4125
- var HostedValueFactSchema = z48.strictObject({
4126
- value: z48.union([z48.string().min(1).max(200), z48.number(), z48.boolean()]),
4127
- source: factSource.extend({ excerpt: excerptText.optional() })
4365
+ var excerptText = z50.string().min(1).refine((text7) => text7.length <= hostedFactsLimits.maxExcerptCharacters, "text_too_long");
4366
+ var about = z50.string().min(1).max(200).optional();
4367
+ var HostedExcerptSchema = z50.strictObject({ text: excerptText, source: factSource, about });
4368
+ var HostedValueFactSchema = z50.strictObject({
4369
+ value: z50.union([z50.string().min(1).max(200), z50.number(), z50.boolean()]),
4370
+ source: factSource.extend({ excerpt: excerptText.optional() }),
4371
+ about
4128
4372
  });
4129
- var HostedFactSchema = z48.union([
4373
+ var HostedFactSchema = z50.union([
4130
4374
  HostedValueFactSchema,
4131
4375
  HostedExcerptSchema,
4132
- z48.array(HostedExcerptSchema).min(1).refine((excerpts2) => excerpts2.length <= hostedFactsLimits.maxExcerptsPerQuestion, "too_many_excerpts")
4376
+ z50.array(HostedExcerptSchema).min(1).refine((excerpts2) => excerpts2.length <= hostedFactsLimits.maxExcerptsPerQuestion, "too_many_excerpts")
4133
4377
  ]);
4134
4378
  function factsBytes(facts) {
4135
4379
  const encoder2 = new TextEncoder();
4136
4380
  return encoder2.encode(JSON.stringify(facts)).length;
4137
4381
  }
4138
- var HostedFactsJobInputSchema = z48.strictObject({
4139
- mode: z48.literal("facts"),
4140
- executionId: id5,
4382
+ var HostedFactsJobInputSchema = z50.strictObject({
4383
+ mode: z50.literal("facts"),
4384
+ executionId: id6,
4141
4385
  expectedReleaseDigest: digest23,
4142
- jobId: id5,
4143
- entityId: id5,
4144
- facts: z48.record(id5, HostedFactSchema).refine((facts) => Object.keys(facts).length <= hostedFactsLimits.maxQuestions, "too_many_questions").refine((facts) => factsBytes(facts) <= hostedFactsLimits.maxFactsBytes, "request_too_large")
4386
+ jobId: id6,
4387
+ entityId: id6,
4388
+ related: HostedRelatedSubjectsSchema.optional(),
4389
+ identity: z50.record(z50.string().min(1).max(128), z50.string().min(1).max(200)).optional(),
4390
+ facts: z50.record(id6, HostedFactSchema).refine((facts) => Object.keys(facts).length <= hostedFactsLimits.maxQuestions, "too_many_questions").refine((facts) => factsBytes(facts) <= hostedFactsLimits.maxFactsBytes, "request_too_large")
4391
+ });
4392
+ var HostedFactsRequestSchema = HostedFactsJobInputSchema.extend({
4393
+ entityId: id6.optional()
4145
4394
  });
4146
- var HostedJobRequestSchema = z48.union([
4395
+ var HostedJobRequestSchema = z50.union([
4147
4396
  HostedJobInputSchema,
4148
4397
  HostedSuppliedJobInputSchema,
4149
4398
  HostedFactsJobInputSchema
4150
4399
  ]);
4151
- var HostedClassificationResultSchema = z48.strictObject({
4152
- key: id5,
4153
- observationId: id5,
4400
+ var HostedClassificationResultSchema = z50.strictObject({
4401
+ key: id6,
4402
+ observationId: id6,
4154
4403
  record: DraftNormalizedEvidenceSchema.shape.normalizations.element,
4155
- reason: z48.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable(),
4156
- cached: z48.boolean()
4404
+ reason: z50.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable(),
4405
+ cached: z50.boolean()
4157
4406
  });
4158
4407
  function retainsFactsExactly(record) {
4159
4408
  const hasFacts = record.facts !== void 0 && record.judgments !== void 0 && record.judgmentsDigest !== void 0;
4160
4409
  return record.schema === "felspar.hosted-supplied-execution/v3" === hasFacts;
4161
4410
  }
4162
- var HostedSuppliedExecutionRecordSchema = z48.strictObject({
4163
- schema: z48.enum([
4411
+ var HostedSuppliedExecutionRecordSchema = z50.strictObject({
4412
+ schema: z50.enum([
4164
4413
  "felspar.hosted-supplied-execution/v1",
4165
4414
  "felspar.hosted-supplied-execution/v2",
4166
4415
  "felspar.hosted-supplied-execution/v3"
4167
4416
  ]),
4168
- release: z48.strictObject({ releaseId: id5, releaseDigest: digest23, materialDigest: digest23 }),
4169
- evaluationTime: z48.iso.datetime(),
4417
+ release: z50.strictObject({ releaseId: id6, releaseDigest: digest23, materialDigest: digest23 }),
4418
+ evaluationTime: z50.iso.datetime(),
4170
4419
  input: HostedSuppliedJobInputSchema,
4171
4420
  facts: HostedFactsJobInputSchema.optional(),
4172
- judgments: z48.array(HostedClassificationResultSchema).max(192).optional(),
4421
+ judgments: z50.array(HostedClassificationResultSchema).max(192).optional(),
4173
4422
  judgmentsDigest: digest23.optional(),
4174
- expansion: z48.literal("agreeing-excerpts").optional(),
4175
- job: z48.record(z48.string(), z48.unknown())
4423
+ expansion: z50.literal("agreeing-excerpts").optional(),
4424
+ job: z50.record(z50.string(), z50.unknown())
4176
4425
  }).refine(retainsFactsExactly, "Version 3 records, and only they, retain facts with their judgments");
4177
- var HostedObjectSchema = z48.strictObject({
4178
- id: id5,
4179
- kind: z48.enum(["source", "proposal", "approval", "release", "evidence", "result", "execution"]),
4426
+ var HostedObjectSchema = z50.strictObject({
4427
+ id: id6,
4428
+ kind: z50.enum(["source", "proposal", "approval", "release", "evidence", "result", "execution"]),
4180
4429
  payloadDigest: digest23,
4181
- objectKey: z48.string().min(1).max(1e3),
4182
- parentId: id5.nullable(),
4183
- status: z48.enum(["active", "released", "revoked"]),
4184
- metadata: z48.record(z48.string(), z48.unknown())
4185
- });
4186
- var HostedJobResultSchema = z48.object({
4187
- status: z48.string(),
4188
- reason: z48.string().nullable(),
4189
- result: z48.object({
4190
- executionId: z48.string(),
4191
- releaseId: id5,
4430
+ objectKey: z50.string().min(1).max(1e3),
4431
+ parentId: id6.nullable(),
4432
+ status: z50.enum(["active", "released", "revoked"]),
4433
+ metadata: z50.record(z50.string(), z50.unknown())
4434
+ });
4435
+ var HostedJobResultSchema = z50.object({
4436
+ status: z50.string(),
4437
+ reason: z50.string().nullable(),
4438
+ result: z50.object({
4439
+ executionId: z50.string(),
4440
+ releaseId: id6,
4192
4441
  releaseDigest: digest23,
4193
- outcome: z48.string().nullable(),
4194
- scoring: z48.unknown(),
4195
- context: z48.unknown(),
4196
- receipt: z48.unknown()
4442
+ outcome: z50.string().nullable(),
4443
+ scoring: z50.unknown(),
4444
+ context: z50.unknown(),
4445
+ receipt: z50.unknown()
4197
4446
  }).loose().nullable()
4198
4447
  });
4199
4448
 
@@ -4215,7 +4464,22 @@ var fixes = {
4215
4464
  request_too_large: `The facts in one request are at most ${limits.maxFactsBytes} bytes. Send shorter excerpts.`,
4216
4465
  release_changed: "The release changed. Describe the job again and resend with the current release digest.",
4217
4466
  job_mismatch: "This release serves a different job. Use the job and release from describe.",
4218
- attempt_limit_reached: "This case has used its decision attempts. Don't ask again: escalate it with the next step from your last result.",
4467
+ attempt_limit_reached: "This case has used its decision attempts. Don't ask again: escalate it with the escalation this refusal names (report its id exactly), or with the next step from your last result.",
4468
+ subject_id_invalid: "Send the case's ID as the job's subject describes it (its identifier and example in the job requirements): letters, digits and . _ : @ - only.",
4469
+ unknown_relationship: "This job's subject has no relationship of this name. Use a relationship listed under subject.related in the job requirements, or leave related out.",
4470
+ related_subject_required: "A question you answered is about a related record. Send that record's ID under related.<relationship>, and quote that record for the question.",
4471
+ too_many_related: "Send at most 16 related record IDs.",
4472
+ entity_id_required: "This job identifies each case by the record's own ID: send it as entityId (entity_id over MCP), as the job requirements' identity says.",
4473
+ case_id_derived: "This job derives each case's ID from its fields or text. Leave entityId out, or send the case.id from an earlier result unchanged.",
4474
+ unknown_case_id: "This case ID was not issued to you for this job. Leave entityId out on a first decision; afterwards send exactly the case.id Felspar returned.",
4475
+ issued_case_limit: "You opened as many new cases on this job as one caller may in 24 hours. Reuse the case.id of the case you are working on instead of starting a new one.",
4476
+ identity_field_required: "This job identifies each case by fields: send every field the job requirements' identity lists, under identity.",
4477
+ identity_field_unknown: "This field is not one of the job's identity fields. Use the names its identity lists.",
4478
+ identity_field_invalid: "An identity field value uses letters, digits and . _ : @ - only, as its example shows.",
4479
+ content_required: "This job identifies each case by its text: send the text being judged under the question the identity names.",
4480
+ one_related_id: "This relationship is one record: send its ID as a single string under related.<relationship>, not a list.",
4481
+ related_id_required: "Several records were sent for this relationship: name the one this excerpt comes from in its about field.",
4482
+ unknown_related_id: "This excerpt's about names a record not sent under related for its relationship. Send that record's ID there, or correct about.",
4219
4483
  rate_limited: "This caller or workspace sent more decision requests in the last minute than its plan allows. Wait retryAfterSeconds, then resend the same request with the same execution ID. Send every question you have evidence for in one facts request per entity instead of one request per question, and spread a large run over time; for runs of thousands of entities, ask Felspar about batch scoring.",
4220
4484
  execution_id_reused: "This execution ID was already used for a different request. Use a new execution ID, or resend the original request unchanged.",
4221
4485
  invalid_body: "The body must be JSON or content parts within the size limit.",
@@ -4241,173 +4505,226 @@ function hostedRefusalFix(code) {
4241
4505
  }
4242
4506
 
4243
4507
  // ../schemas/src/draft-hosted-job-description.ts
4244
- import { z as z50 } from "zod";
4508
+ import { z as z52 } from "zod";
4245
4509
 
4246
4510
  // ../schemas/src/draft-hosted-output-guides.ts
4247
- import { z as z49 } from "zod";
4248
- var id6 = z49.string().min(1).max(200);
4249
- var located = z49.strictObject({
4250
- text: z49.string().min(1).max(262144),
4251
- locator: z49.string().min(1).max(4096)
4511
+ import { z as z51 } from "zod";
4512
+ var id7 = z51.string().min(1).max(200);
4513
+ var located = z51.strictObject({
4514
+ text: z51.string().min(1).max(262144),
4515
+ locator: z51.string().min(1).max(4096)
4252
4516
  });
4253
4517
  var hostedOutputGuideLimits = { maxOutputs: 8, maxContext: 8, maxChecks: 64 };
4254
- var HostedOutputGuideSchema = z49.strictObject({
4255
- id: id6,
4518
+ var HostedOutputGuideSchema = z51.strictObject({
4519
+ id: id7,
4256
4520
  what: located,
4257
- maxCharacters: z49.number().int().min(1),
4258
- context: z49.array(located.extend({ id: id6 })).max(hostedOutputGuideLimits.maxContext).optional(),
4259
- checks: z49.array(z49.strictObject({
4260
- check: id6,
4261
- rule: z49.string().nullable(),
4262
- must: z49.string().min(1).max(8e3)
4521
+ maxCharacters: z51.number().int().min(1),
4522
+ context: z51.array(located.extend({ id: id7 })).max(hostedOutputGuideLimits.maxContext).optional(),
4523
+ checks: z51.array(z51.strictObject({
4524
+ check: id7,
4525
+ rule: z51.string().nullable(),
4526
+ must: z51.string().min(1).max(8e3)
4263
4527
  })).max(hostedOutputGuideLimits.maxChecks)
4264
4528
  });
4265
- var HostedOutputGuidesSchema = z49.array(HostedOutputGuideSchema).max(hostedOutputGuideLimits.maxOutputs);
4529
+ var HostedOutputGuidesSchema = z51.array(HostedOutputGuideSchema).max(hostedOutputGuideLimits.maxOutputs);
4266
4530
 
4267
4531
  // ../schemas/src/draft-hosted-job-description.ts
4268
- var id7 = z50.string().min(1).max(200);
4532
+ var id8 = z52.string().min(1).max(200);
4269
4533
  var digest24 = DraftApplicationReleaseSchema.shape.releaseDigest;
4270
4534
  var { requirements, rules } = DraftRequiredProposalSchema.shape;
4271
- var quotedText = z50.strictObject({
4272
- text: z50.string().min(1).max(262144),
4535
+ var quotedText = z52.strictObject({
4536
+ text: z52.string().min(1).max(262144),
4273
4537
  source: DraftSourceReferenceSchema.omit({ contentDigest: true }).extend({
4274
- locator: z50.string().min(1).max(4096),
4538
+ locator: z52.string().min(1).max(4096),
4275
4539
  contentDigest: digest24
4276
4540
  }),
4277
- parts: z50.array(z50.strictObject({ locator: z50.string().min(1).max(4096), text: z50.string() })).max(16)
4278
- });
4279
- var HostedJobDescriptionSchema = z50.strictObject({
4280
- schema: z50.literal("felspar.hosted-job-description.draft/v0"),
4281
- job: id7,
4282
- trustDomain: id7,
4283
- release: z50.strictObject({
4284
- releaseId: id7,
4541
+ parts: z52.array(z52.strictObject({ locator: z52.string().min(1).max(4096), text: z52.string() })).max(16)
4542
+ });
4543
+ var subjectShape = {
4544
+ identifier: z52.string().min(1).max(200),
4545
+ example: z52.string().min(1).max(200),
4546
+ match: z52.enum(subjectMatchRules)
4547
+ };
4548
+ var HostedJobSubjectSchema = z52.strictObject({
4549
+ type: id8,
4550
+ definition: quotedText,
4551
+ identifier: subjectShape.identifier.optional(),
4552
+ example: subjectShape.example.optional(),
4553
+ match: subjectShape.match,
4554
+ related: z52.array(z52.strictObject({
4555
+ relationship: id8,
4556
+ meaning: quotedText,
4557
+ cardinality: z52.enum(relationshipCardinalities),
4558
+ required: z52.boolean(),
4559
+ subject: id8,
4560
+ definition: quotedText,
4561
+ ...subjectShape
4562
+ })).max(16),
4563
+ send: z52.string().min(1).max(2e4)
4564
+ });
4565
+ var HostedJobEscalationsSchema = z52.strictObject({
4566
+ routes: z52.array(z52.strictObject({ id: id8, quote: quotedText })).min(1).max(16),
4567
+ unresolved: id8.nullable(),
4568
+ attemptLimit: id8.nullable(),
4569
+ rule: z52.string().min(1).max(1e3)
4570
+ });
4571
+ var HostedEscalationSchema = z52.strictObject({
4572
+ id: id8,
4573
+ trigger: z52.enum(escalationTriggers),
4574
+ why: quotedText
4575
+ });
4576
+ var HostedJobDescriptionSchema = z52.strictObject({
4577
+ schema: z52.literal("felspar.hosted-job-description.draft/v0"),
4578
+ job: id8,
4579
+ purpose: quotedText.optional(),
4580
+ useWhen: z52.array(quotedText).max(8).optional(),
4581
+ notFor: z52.array(quotedText).max(8).optional(),
4582
+ owner: quotedText.optional(),
4583
+ subject: HostedJobSubjectSchema.optional(),
4584
+ identity: z52.strictObject({
4585
+ mode: z52.enum(identityModes),
4586
+ send: z52.string().min(1).max(4e3),
4587
+ fields: z52.array(z52.strictObject({ name: id8, ...subjectShape })).max(8).optional(),
4588
+ question: id8.optional()
4589
+ }).optional(),
4590
+ trustDomain: id8,
4591
+ release: z52.strictObject({
4592
+ releaseId: id8,
4285
4593
  releaseDigest: digest24,
4286
4594
  materialDigest: digest24,
4287
4595
  expectedAuthorityDigest: digest24
4288
4596
  }),
4289
4597
  resolutionPolicy: DraftRequiredProposalSchema.shape.resolutionPolicy,
4290
- questions: z50.array(requirements.element.extend({
4291
- key: id7,
4292
- type: z50.enum(["enum", "boolean", "number", "date"]),
4598
+ questions: z52.array(requirements.element.extend({
4599
+ key: id8,
4600
+ type: z52.enum(["enum", "boolean", "number", "date"]),
4293
4601
  meaning: quotedText,
4294
- answer: z50.strictObject({
4295
- send: z50.enum(["text", "text_or_value"]),
4296
- valueFormat: z50.enum(["number", "calendar-date"]).nullable(),
4297
- interpretation: z50.enum(["classified", "exact_read", "unsupported"]),
4298
- threshold: z50.number().gt(0).max(1).nullable(),
4299
- applies: z50.enum(["always", "conditional"]),
4300
- dependsOn: z50.array(id7).max(32),
4301
- appliesWhen: z50.string().min(1).max(2e3).nullable(),
4602
+ answer: z52.strictObject({
4603
+ send: z52.enum(["text", "text_or_value"]),
4604
+ valueFormat: z52.enum(["number", "calendar-date"]).nullable(),
4605
+ interpretation: z52.enum(["classified", "exact_read", "unsupported"]),
4606
+ threshold: z52.number().gt(0).max(1).nullable(),
4607
+ applies: z52.enum(["always", "conditional"]),
4608
+ dependsOn: z52.array(id8).max(32),
4609
+ appliesWhen: z52.string().min(1).max(2e3).nullable(),
4302
4610
  reading: ExactReaderSchema.optional()
4303
4611
  }),
4304
- answers: z50.array(z50.strictObject({
4305
- value: id7,
4306
- meaning: z50.string().nullable(),
4307
- inclusions: z50.array(z50.string()).max(8),
4308
- exclusions: z50.array(z50.string()).max(8),
4309
- examples: z50.array(z50.string()).max(8),
4310
- edgeCases: z50.array(z50.string()).max(8)
4612
+ answers: z52.array(z52.strictObject({
4613
+ value: id8,
4614
+ meaning: z52.string().nullable(),
4615
+ inclusions: z52.array(z52.string()).max(8),
4616
+ exclusions: z52.array(z52.string()).max(8),
4617
+ examples: z52.array(z52.string()).max(8),
4618
+ edgeCases: z52.array(z52.string()).max(8)
4311
4619
  })).max(64).optional(),
4312
- whereToLook: z50.array(quotedText).max(8).optional()
4620
+ whereToLook: z52.array(quotedText).max(8).optional(),
4621
+ about: z52.strictObject({ relationship: id8, subject: id8 }).optional()
4313
4622
  })).max(64),
4314
- rules: z50.array(rules.element.extend({ text: quotedText })).max(256),
4315
- outcomes: z50.array(z50.strictObject({
4316
- id: id7,
4623
+ rules: z52.array(rules.element.extend({ text: quotedText })).max(256),
4624
+ outcomes: z52.array(z52.strictObject({
4625
+ id: id8,
4317
4626
  meaning: quotedText.nullable(),
4318
4627
  nextStep: quotedText.nullable().optional(),
4319
- outputs: HostedOutputGuidesSchema.optional()
4628
+ outputs: HostedOutputGuidesSchema.optional(),
4629
+ escalate: id8.optional()
4320
4630
  })).max(64),
4631
+ escalations: HostedJobEscalationsSchema.optional(),
4321
4632
  whenUnresolved: quotedText.nullable().optional(),
4322
- attempts: z50.strictObject({
4323
- max: z50.number().int().min(1).max(10),
4324
- withProgress: z50.number().int().min(1).max(10),
4325
- rule: z50.string().min(1).max(1e3)
4633
+ attempts: z52.strictObject({
4634
+ max: z52.number().int().min(1).max(10),
4635
+ withProgress: z52.number().int().min(1).max(10),
4636
+ rule: z52.string().min(1).max(1e3)
4326
4637
  }).optional(),
4327
- guidance: z50.strictObject({ gather: z50.string().min(1).max(2e3) }),
4328
- input: z50.strictObject({
4329
- jsonSchema: z50.record(z50.string(), z50.unknown()),
4638
+ guidance: z52.strictObject({ gather: z52.string().min(1).max(2e3) }),
4639
+ input: z52.strictObject({
4640
+ jsonSchema: z52.record(z52.string(), z52.unknown()),
4330
4641
  example: HostedFactsJobInputSchema.nullable(),
4331
- exampleNote: z50.string().max(1e3)
4642
+ exampleNote: z52.string().max(1e3)
4332
4643
  }),
4333
- limits: z50.strictObject({
4334
- maxEvidenceItems: z50.number().int().positive(),
4335
- maxPassages: z50.number().int().positive(),
4336
- facts: z50.strictObject({
4337
- maxExcerptCharacters: z50.literal(hostedFactsLimits.maxExcerptCharacters),
4338
- maxExcerptsPerQuestion: z50.literal(hostedFactsLimits.maxExcerptsPerQuestion),
4339
- maxFactsBytes: z50.literal(hostedFactsLimits.maxFactsBytes),
4340
- maxQuestions: z50.literal(hostedFactsLimits.maxQuestions)
4644
+ limits: z52.strictObject({
4645
+ maxEvidenceItems: z52.number().int().positive(),
4646
+ maxPassages: z52.number().int().positive(),
4647
+ facts: z52.strictObject({
4648
+ maxExcerptCharacters: z52.literal(hostedFactsLimits.maxExcerptCharacters),
4649
+ maxExcerptsPerQuestion: z52.literal(hostedFactsLimits.maxExcerptsPerQuestion),
4650
+ maxFactsBytes: z52.literal(hostedFactsLimits.maxFactsBytes),
4651
+ maxQuestions: z52.literal(hostedFactsLimits.maxQuestions)
4341
4652
  })
4342
4653
  })
4343
4654
  });
4344
- var interpretedExcerpt = z50.strictObject({
4345
- id: id7,
4346
- method: z50.enum(["value", "exact_read", "classified"]),
4347
- status: z50.enum(["accepted", "needs_evidence", "not_needed"]),
4348
- value: z50.union([z50.string(), z50.number(), z50.boolean()]).optional(),
4349
- reasons: z50.array(z50.string()),
4350
- classification: z50.strictObject({
4351
- candidate: z50.string().nullable(),
4352
- probability: z50.number().min(0).max(1).nullable(),
4353
- abstention: z50.number().min(0).max(1).nullable(),
4354
- threshold: z50.number().min(0).max(1),
4355
- alternatives: z50.array(z50.strictObject({ value: z50.string(), probability: z50.number() }))
4655
+ var interpretedExcerpt = z52.strictObject({
4656
+ id: id8,
4657
+ method: z52.enum(["value", "exact_read", "classified"]),
4658
+ status: z52.enum(["accepted", "needs_evidence", "not_needed"]),
4659
+ value: z52.union([z52.string(), z52.number(), z52.boolean()]).optional(),
4660
+ reasons: z52.array(z52.string()),
4661
+ classification: z52.strictObject({
4662
+ candidate: z52.string().nullable(),
4663
+ probability: z52.number().min(0).max(1).nullable(),
4664
+ abstention: z52.number().min(0).max(1).nullable(),
4665
+ threshold: z52.number().min(0).max(1),
4666
+ alternatives: z52.array(z52.strictObject({ value: z52.string(), probability: z52.number() }))
4356
4667
  }).optional()
4357
4668
  });
4358
- var ruleSummary = z50.strictObject({ id: id7, outcome: id7, text: quotedText });
4359
- var HostedJobExplanationSchema = z50.strictObject({
4360
- schema: z50.literal("felspar.hosted-job-explanation.draft/v0"),
4361
- decision: z50.strictObject({ status: z50.string().nullable(), reasons: z50.array(z50.string()) }),
4362
- needs: z50.array(z50.strictObject({
4363
- key: id7,
4364
- status: z50.string(),
4365
- reasons: z50.array(z50.string()),
4366
- acceptedSourceClasses: z50.array(z50.string()),
4367
- maxAgeMs: z50.number().int().nonnegative(),
4669
+ var ruleSummary = z52.strictObject({ id: id8, outcome: id8, text: quotedText });
4670
+ var HostedJobExplanationSchema = z52.strictObject({
4671
+ schema: z52.literal("felspar.hosted-job-explanation.draft/v0"),
4672
+ decision: z52.strictObject({ status: z52.string().nullable(), reasons: z52.array(z52.string()) }),
4673
+ needs: z52.array(z52.strictObject({
4674
+ key: id8,
4675
+ status: z52.string(),
4676
+ reasons: z52.array(z52.string()),
4677
+ acceptedSourceClasses: z52.array(z52.string()),
4678
+ maxAgeMs: z52.number().int().nonnegative(),
4368
4679
  requiredWhen: HostedJobDescriptionSchema.shape.questions.element.shape.requiredWhen,
4369
- excerpts: z50.array(interpretedExcerpt).optional()
4680
+ excerpts: z52.array(interpretedExcerpt).optional()
4370
4681
  })),
4371
- why: z50.strictObject({
4372
- rules: z50.array(ruleSummary),
4373
- overrides: z50.array(z50.strictObject({ by: id7, target: id7 })),
4374
- suppressedRuleIds: z50.array(id7),
4375
- evidence: z50.array(z50.record(z50.string(), z50.unknown()))
4682
+ why: z52.strictObject({
4683
+ rules: z52.array(ruleSummary),
4684
+ overrides: z52.array(z52.strictObject({ by: id8, target: id8 })),
4685
+ suppressedRuleIds: z52.array(id8),
4686
+ evidence: z52.array(z52.record(z52.string(), z52.unknown()))
4376
4687
  }).nullable(),
4377
- context: z50.strictObject({ status: z50.string(), reason: z50.string().nullable() }).nullable(),
4378
- reviewNeeds: z50.array(z50.string()),
4379
- evidenceFreshUntil: z50.iso.datetime().nullable()
4688
+ context: z52.strictObject({ status: z52.string(), reason: z52.string().nullable() }).nullable(),
4689
+ reviewNeeds: z52.array(z52.string()),
4690
+ evidenceFreshUntil: z52.iso.datetime().nullable()
4380
4691
  });
4381
- var HostedReceiptVerificationInputSchema = z50.strictObject({
4692
+ var HostedReceiptVerificationInputSchema = z52.strictObject({
4382
4693
  receipt: DraftJobReceiptSchema,
4383
4694
  expectedReceiptDigest: digest24,
4384
4695
  deliveredCapsule: DraftContextVerificationOptionsSchema.shape.deliveredCapsule
4385
4696
  });
4386
- var HostedReceiptVerificationSchema = z50.strictObject({
4387
- authority: z50.literal("unapproved"),
4388
- status: z50.enum(["reproduced", "mismatch"]),
4389
- mismatches: z50.array(z50.string()),
4390
- decided: z50.strictObject({
4391
- jobId: id7,
4392
- entityId: id7,
4393
- releaseId: id7,
4394
- outcome: id7.nullable()
4697
+ var HostedReceiptVerificationSchema = z52.strictObject({
4698
+ authority: z52.literal("unapproved"),
4699
+ status: z52.enum(["reproduced", "mismatch"]),
4700
+ mismatches: z52.array(z52.string()),
4701
+ decided: z52.strictObject({
4702
+ jobId: id8,
4703
+ entityId: id8,
4704
+ releaseId: id8,
4705
+ outcome: id8.nullable(),
4706
+ case: z52.strictObject({ id: id8, mode: z52.enum(identityModes) }).optional(),
4707
+ subject: z52.strictObject({
4708
+ type: id8,
4709
+ related: z52.array(z52.strictObject({ relationship: id8, subject: id8, id: id8, questions: z52.array(id8).max(64) })).max(256)
4710
+ }).optional(),
4711
+ escalation: HostedEscalationSchema.omit({ why: true }).optional()
4395
4712
  }).optional()
4396
4713
  });
4397
4714
 
4398
4715
  // ../schemas/src/draft-hosted-output-check-record.ts
4399
- import { z as z53 } from "zod";
4716
+ import { z as z55 } from "zod";
4400
4717
 
4401
4718
  // ../schemas/src/draft-artifact-lint.ts
4402
- import { z as z52 } from "zod";
4719
+ import { z as z54 } from "zod";
4403
4720
 
4404
4721
  // ../schemas/src/draft-job-obligations.ts
4405
- import { z as z51 } from "zod";
4406
- var id8 = DraftApplicationScopeSchema.shape.authorityId;
4722
+ import { z as z53 } from "zod";
4723
+ var id9 = DraftApplicationScopeSchema.shape.authorityId;
4407
4724
  var digest25 = DraftJobReceiptSchema.shape.receiptDigest;
4408
4725
  var outcome2 = DraftJobObligationsOutcomeSchema;
4409
4726
  var DraftApplicationJobMaterialV3Schema = DraftApplicationJobMaterialV2Schema.extend({
4410
- schema: z51.literal("felspar.application-job-material.draft/v3"),
4727
+ schema: z53.literal("felspar.application-job-material.draft/v3"),
4411
4728
  obligations: DraftJobObligationsSchema
4412
4729
  }).superRefine((value, context3) => {
4413
4730
  if (context3.issues.length > 0) {
@@ -4435,57 +4752,57 @@ var DraftApplicationJobMaterialV3Schema = DraftApplicationJobMaterialV2Schema.ex
4435
4752
  }
4436
4753
  });
4437
4754
  var HostedProposalInputV3Schema = HostedProposalInputV2Schema.extend({
4438
- schema: z51.literal("felspar.hosted-proposal.draft/v3"),
4755
+ schema: z53.literal("felspar.hosted-proposal.draft/v3"),
4439
4756
  material: DraftApplicationJobMaterialV3Schema
4440
4757
  });
4441
4758
  var jobObligationsReplayRoutes = ["supplied", "evaluated"];
4442
4759
  var replayRoutes = new Set(jobObligationsReplayRoutes);
4443
4760
  var DraftJobObligationsExecutionSchema = DraftAnyJobExecutionSchema.refine((execution) => replayRoutes.has(execution.invocation.route), "Obligations assessments support supplied and evaluated native executions");
4444
- var DraftJobObligationsNativeResultSchema = z51.strictObject({
4445
- authority: z51.literal("unapproved"),
4446
- discovery: z51.record(z51.string(), z51.unknown()),
4447
- executed: z51.record(z51.string(), z51.unknown()),
4761
+ var DraftJobObligationsNativeResultSchema = z53.strictObject({
4762
+ authority: z53.literal("unapproved"),
4763
+ discovery: z53.record(z53.string(), z53.unknown()),
4764
+ executed: z53.record(z53.string(), z53.unknown()),
4448
4765
  receipt: DraftJobReceiptSchema
4449
4766
  });
4450
- var DraftJobObligationsInputSchema = z51.strictObject({
4767
+ var DraftJobObligationsInputSchema = z53.strictObject({
4451
4768
  release: DraftApplicationReleaseSchema,
4452
- material: z51.union([DraftApplicationJobMaterialV3Schema, DraftAnyApplicationJobMaterialSchema]),
4769
+ material: z53.union([DraftApplicationJobMaterialV3Schema, DraftAnyApplicationJobMaterialSchema]),
4453
4770
  execution: DraftJobObligationsExecutionSchema,
4454
4771
  expectedReceiptDigest: digest25,
4455
4772
  job: DraftJobObligationsNativeResultSchema,
4456
4773
  explanation: HostedJobExplanationSchema,
4457
- invocation: DraftJobObligationsScopeSchema.extend({ caseId: id8 })
4774
+ invocation: DraftJobObligationsScopeSchema.extend({ caseId: id9 })
4458
4775
  });
4459
- var requirements2 = z51.strictObject({
4460
- status: z51.enum(["established", "unresolved"]),
4776
+ var requirements2 = z53.strictObject({
4777
+ status: z53.enum(["established", "unresolved"]),
4461
4778
  scope: DraftJobObligationsScopeSchema,
4462
4779
  artifacts: outcome2.shape.artifacts,
4463
4780
  approvals: outcome2.shape.approvals,
4464
- unresolved: z51.array(z51.strictObject({ scopeRef: id8, reasonCodes: z51.array(id8).min(1).max(64) })).max(64)
4781
+ unresolved: z53.array(z53.strictObject({ scopeRef: id9, reasonCodes: z53.array(id9).min(1).max(64) })).max(64)
4465
4782
  });
4466
- var nextReference = z51.discriminatedUnion("kind", [
4467
- z51.strictObject({ kind: z51.literal("evidence_need"), id: id8 }),
4468
- z51.strictObject({ kind: z51.literal("artifact_requirement"), id: id8 }),
4469
- z51.strictObject({ kind: z51.literal("approval_requirement"), id: id8 }),
4470
- z51.strictObject({ kind: z51.literal("unresolved_scope"), scopeRef: id8 })
4783
+ var nextReference = z53.discriminatedUnion("kind", [
4784
+ z53.strictObject({ kind: z53.literal("evidence_need"), id: id9 }),
4785
+ z53.strictObject({ kind: z53.literal("artifact_requirement"), id: id9 }),
4786
+ z53.strictObject({ kind: z53.literal("approval_requirement"), id: id9 }),
4787
+ z53.strictObject({ kind: z53.literal("unresolved_scope"), scopeRef: id9 })
4471
4788
  ]);
4472
- var DraftJobObligationsAssessmentBodySchema = z51.strictObject({
4473
- schema: z51.literal("felspar.job-obligations-assessment.draft/v0"),
4474
- binding: z51.strictObject({
4789
+ var DraftJobObligationsAssessmentBodySchema = z53.strictObject({
4790
+ schema: z53.literal("felspar.job-obligations-assessment.draft/v0"),
4791
+ binding: z53.strictObject({
4475
4792
  releaseDigest: digest25,
4476
4793
  materialDigest: digest25,
4477
4794
  nativeReceiptDigest: digest25,
4478
- jobId: id8,
4795
+ jobId: id9,
4479
4796
  applicationScope: DraftApplicationScopeSchema,
4480
- caseId: id8,
4481
- entityId: id8,
4482
- evaluationTime: z51.iso.datetime({ offset: true }),
4483
- purposeRef: id8,
4484
- useRef: id8.nullable()
4797
+ caseId: id9,
4798
+ entityId: id9,
4799
+ evaluationTime: z53.iso.datetime({ offset: true }),
4800
+ purposeRef: id9,
4801
+ useRef: id9.nullable()
4485
4802
  }),
4486
4803
  requirements: requirements2,
4487
- next: z51.strictObject({
4488
- kind: z51.enum([
4804
+ next: z53.strictObject({
4805
+ kind: z53.enum([
4489
4806
  "stop",
4490
4807
  "review_required",
4491
4808
  "gather_evidence",
@@ -4493,8 +4810,8 @@ var DraftJobObligationsAssessmentBodySchema = z51.strictObject({
4493
4810
  "verify_before_action",
4494
4811
  "return_result"
4495
4812
  ]),
4496
- reasonCodes: z51.array(id8).max(64),
4497
- refs: z51.array(nextReference).max(64)
4813
+ reasonCodes: z53.array(id9).max(64),
4814
+ refs: z53.array(nextReference).max(64)
4498
4815
  })
4499
4816
  });
4500
4817
  function isNextRefDeclared(ref, required) {
@@ -4531,48 +4848,48 @@ var DraftJobObligationsAssessmentSchema = DraftJobObligationsAssessmentBodySchem
4531
4848
  });
4532
4849
 
4533
4850
  // ../schemas/src/draft-artifact-lint.ts
4534
- var id9 = DraftApplicationScopeSchema.shape.authorityId;
4851
+ var id10 = DraftApplicationScopeSchema.shape.authorityId;
4535
4852
  var digest26 = DraftJobReceiptSchema.shape.receiptDigest;
4536
4853
  var passage3 = ArtifactSpecificationSchema;
4537
- var plainArtifact = z52.strictObject({
4538
- id: id9,
4539
- revision: id9,
4540
- mediaType: z52.literal("text/plain"),
4541
- exportProfile: id9.nullable(),
4542
- content: z52.string().max(artifactLintLimits.maxTotalBytes),
4854
+ var plainArtifact = z54.strictObject({
4855
+ id: id10,
4856
+ revision: id10,
4857
+ mediaType: z54.literal("text/plain"),
4858
+ exportProfile: id10.nullable(),
4859
+ content: z54.string().max(artifactLintLimits.maxTotalBytes),
4543
4860
  expectedContentDigest: digest26
4544
4861
  });
4545
- var structuredArtifact = z52.strictObject({
4546
- id: id9,
4547
- revision: id9,
4548
- mediaType: z52.literal("application/vnd.felspar.structured-output+json"),
4549
- exportProfile: id9.nullable(),
4862
+ var structuredArtifact = z54.strictObject({
4863
+ id: id10,
4864
+ revision: id10,
4865
+ mediaType: z54.literal("application/vnd.felspar.structured-output+json"),
4866
+ exportProfile: id10.nullable(),
4550
4867
  content: DraftStructuredOutputSchema,
4551
4868
  expectedContentDigest: digest26
4552
4869
  });
4553
- var ArtifactLintArtifactSchema = z52.discriminatedUnion("mediaType", [
4870
+ var ArtifactLintArtifactSchema = z54.discriminatedUnion("mediaType", [
4554
4871
  plainArtifact,
4555
4872
  structuredArtifact
4556
4873
  ]);
4557
- var ArtifactLintDecisionSchema = z52.strictObject({
4874
+ var ArtifactLintDecisionSchema = z54.strictObject({
4558
4875
  inputs: DraftJobObligationsInputSchema,
4559
4876
  assessment: DraftJobObligationsAssessmentSchema,
4560
4877
  expectedAssessmentDigest: digest26
4561
4878
  });
4562
- var ArtifactLintInputSchema = z52.strictObject({
4563
- schema: z52.literal("felspar.lint.draft/v1"),
4564
- requestId: id9,
4879
+ var ArtifactLintInputSchema = z54.strictObject({
4880
+ schema: z54.literal("felspar.lint.draft/v1"),
4881
+ requestId: id10,
4565
4882
  release: DraftApplicationReleaseSchema,
4566
4883
  material: DraftApplicationJobMaterialV3Schema,
4567
4884
  manifest: ArtifactCheckManifestSchema,
4568
4885
  expectedManifestDigest: digest26,
4569
- attachedObligations: z52.strictObject({ expectedObligationsDigest: digest26 }).optional(),
4570
- attachedCase: z52.strictObject({
4886
+ attachedObligations: z54.strictObject({ expectedObligationsDigest: digest26 }).optional(),
4887
+ attachedCase: z54.strictObject({
4571
4888
  decisionReceiptDigest: digest26,
4572
- answers: z52.array(z52.strictObject({ key: id9, value: z52.union([z52.string().min(1).max(200), z52.null()]) })).max(256)
4889
+ answers: z54.array(z54.strictObject({ key: id10, value: z54.union([z54.string().min(1).max(200), z54.null()]) })).max(256)
4573
4890
  }).optional(),
4574
- case: z52.strictObject({ caseId: id9, purposeRef: id9, useRef: id9.nullable() }),
4575
- artifactRequirementId: id9.nullable(),
4891
+ case: z54.strictObject({ caseId: id10, purposeRef: id10, useRef: id10.nullable() }),
4892
+ artifactRequirementId: id10.nullable(),
4576
4893
  decision: ArtifactLintDecisionSchema.nullable(),
4577
4894
  artifact: ArtifactLintArtifactSchema
4578
4895
  });
@@ -4585,11 +4902,11 @@ var artifactCheckStatuses = [
4585
4902
  "not_applicable",
4586
4903
  "skipped"
4587
4904
  ];
4588
- var range = z52.strictObject({
4589
- sectionId: id9,
4590
- start: z52.number().int().min(0).max(artifactLintLimits.maxSectionUnits),
4591
- end: z52.number().int().min(1).max(artifactLintLimits.maxSectionUnits),
4592
- offsetUnit: z52.literal("utf16_code_units")
4905
+ var range = z54.strictObject({
4906
+ sectionId: id10,
4907
+ start: z54.number().int().min(0).max(artifactLintLimits.maxSectionUnits),
4908
+ end: z54.number().int().min(1).max(artifactLintLimits.maxSectionUnits),
4909
+ offsetUnit: z54.literal("utf16_code_units")
4593
4910
  });
4594
4911
  var findingCodes = [
4595
4912
  "section_missing",
@@ -4617,131 +4934,131 @@ var findingCodes = [
4617
4934
  "evaluation_budget_exceeded",
4618
4935
  "evaluation_skipped"
4619
4936
  ];
4620
- var ArtifactFindingSchema = z52.strictObject({
4621
- code: z52.enum(findingCodes),
4622
- checkId: id9.nullable(),
4623
- severity: z52.enum(["error", "warning"]),
4937
+ var ArtifactFindingSchema = z54.strictObject({
4938
+ code: z54.enum(findingCodes),
4939
+ checkId: id10.nullable(),
4940
+ severity: z54.enum(["error", "warning"]),
4624
4941
  specification: passage3.nullable(),
4625
4942
  location: range.nullable(),
4626
- insertionAnchor: z52.strictObject({ sectionId: id9.nullable(), at: z52.number().int().min(0) }).nullable(),
4627
- literalIndex: z52.number().int().min(0).max(artifactLintLimits.maxLiterals).nullable()
4628
- });
4629
- var ArtifactCheckObservationSchema = z52.strictObject({
4630
- checkId: id9,
4631
- kind: z52.enum(artifactCheckKinds),
4632
- required: z52.boolean(),
4633
- method: z52.enum(["deterministic", "semantic"]),
4634
- status: z52.enum(artifactCheckStatuses),
4635
- occurrences: z52.number().int().min(0),
4636
- parsedValue: z52.number().nullable(),
4637
- caseValue: z52.number().nullable()
4638
- });
4639
- var ArtifactLintRecordBodySchema = z52.strictObject({
4640
- schema: z52.literal("felspar.lint-record.draft/v1"),
4641
- requestId: id9,
4642
- status: z52.enum(["pass", "revise", "unavailable", "review_required"]),
4643
- caseContext: z52.enum(["bound", "not_required"]),
4644
- binding: z52.strictObject({
4943
+ insertionAnchor: z54.strictObject({ sectionId: id10.nullable(), at: z54.number().int().min(0) }).nullable(),
4944
+ literalIndex: z54.number().int().min(0).max(artifactLintLimits.maxLiterals).nullable()
4945
+ });
4946
+ var ArtifactCheckObservationSchema = z54.strictObject({
4947
+ checkId: id10,
4948
+ kind: z54.enum(artifactCheckKinds),
4949
+ required: z54.boolean(),
4950
+ method: z54.enum(["deterministic", "semantic"]),
4951
+ status: z54.enum(artifactCheckStatuses),
4952
+ occurrences: z54.number().int().min(0),
4953
+ parsedValue: z54.number().nullable(),
4954
+ caseValue: z54.number().nullable()
4955
+ });
4956
+ var ArtifactLintRecordBodySchema = z54.strictObject({
4957
+ schema: z54.literal("felspar.lint-record.draft/v1"),
4958
+ requestId: id10,
4959
+ status: z54.enum(["pass", "revise", "unavailable", "review_required"]),
4960
+ caseContext: z54.enum(["bound", "not_required"]),
4961
+ binding: z54.strictObject({
4645
4962
  scope: DraftApplicationScopeSchema,
4646
- releaseId: id9,
4963
+ releaseId: id10,
4647
4964
  releaseDigest: digest26,
4648
4965
  materialDigest: digest26,
4649
4966
  obligationsDigest: digest26.optional(),
4650
4967
  caseFactsDigest: digest26.optional(),
4651
- jobId: id9,
4652
- manifestId: id9,
4968
+ jobId: id10,
4969
+ manifestId: id10,
4653
4970
  manifestDigest: digest26,
4654
- contract: z52.strictObject({ id: id9, digest: digest26 }),
4655
- caseId: id9,
4656
- purposeRef: id9,
4657
- useRef: id9.nullable(),
4658
- artifactRequirementId: id9.nullable(),
4971
+ contract: z54.strictObject({ id: id10, digest: digest26 }),
4972
+ caseId: id10,
4973
+ purposeRef: id10,
4974
+ useRef: id10.nullable(),
4975
+ artifactRequirementId: id10.nullable(),
4659
4976
  decisionReceiptDigest: digest26.nullable(),
4660
4977
  obligationsAssessmentDigest: digest26.nullable()
4661
4978
  }),
4662
- artifact: z52.strictObject({
4663
- id: id9,
4664
- revision: id9,
4665
- mediaType: z52.enum(artifactLintMediaTypes),
4666
- exportProfile: id9.nullable(),
4979
+ artifact: z54.strictObject({
4980
+ id: id10,
4981
+ revision: id10,
4982
+ mediaType: z54.enum(artifactLintMediaTypes),
4983
+ exportProfile: id10.nullable(),
4667
4984
  contentDigest: digest26,
4668
- sections: z52.array(z52.strictObject({
4669
- id: id9,
4670
- units: z52.number().int().min(0),
4985
+ sections: z54.array(z54.strictObject({
4986
+ id: id10,
4987
+ units: z54.number().int().min(0),
4671
4988
  contentDigest: digest26.nullable()
4672
4989
  })).max(artifactLintLimits.maxSections)
4673
4990
  }),
4674
- checks: z52.array(ArtifactCheckObservationSchema).max(artifactLintLimits.maxChecks),
4675
- findings: z52.array(ArtifactFindingSchema).max(2048),
4991
+ checks: z54.array(ArtifactCheckObservationSchema).max(artifactLintLimits.maxChecks),
4992
+ findings: z54.array(ArtifactFindingSchema).max(2048),
4676
4993
  semantic: ArtifactSemanticRecordSchema.nullable(),
4677
- coverage: z52.strictObject({
4678
- scope: z52.literal("declared_checks_only"),
4679
- declared: z52.number().int().min(0),
4680
- applicable: z52.number().int().min(0),
4681
- completed: z52.number().int().min(0),
4682
- required: z52.number().int().min(0),
4683
- requiredCompleted: z52.number().int().min(0),
4684
- textAssigned: z52.enum(["complete", "incomplete"]),
4685
- semantic: z52.enum(["not_declared", "complete", "incomplete"]),
4686
- nativeDocumentLayout: z52.literal("not_checked")
4994
+ coverage: z54.strictObject({
4995
+ scope: z54.literal("declared_checks_only"),
4996
+ declared: z54.number().int().min(0),
4997
+ applicable: z54.number().int().min(0),
4998
+ completed: z54.number().int().min(0),
4999
+ required: z54.number().int().min(0),
5000
+ requiredCompleted: z54.number().int().min(0),
5001
+ textAssigned: z54.enum(["complete", "incomplete"]),
5002
+ semantic: z54.enum(["not_declared", "complete", "incomplete"]),
5003
+ nativeDocumentLayout: z54.literal("not_checked")
4687
5004
  }),
4688
- actionAuthorized: z52.literal(false)
5005
+ actionAuthorized: z54.literal(false)
4689
5006
  });
4690
5007
  var ArtifactLintRecordSchema = ArtifactLintRecordBodySchema.extend({
4691
5008
  recordDigest: digest26
4692
5009
  });
4693
- var ArtifactLintReceiptSchema = z52.strictObject({
4694
- schema: z52.literal("felspar.lint-receipt.draft/v1"),
5010
+ var ArtifactLintReceiptSchema = z54.strictObject({
5011
+ schema: z54.literal("felspar.lint-receipt.draft/v1"),
4695
5012
  recordDigest: digest26,
4696
5013
  releaseDigest: digest26,
4697
5014
  manifestDigest: digest26,
4698
5015
  contractDigest: digest26,
4699
- caseId: id9,
4700
- caseContext: z52.enum(["bound", "not_required"]),
5016
+ caseId: id10,
5017
+ caseContext: z54.enum(["bound", "not_required"]),
4701
5018
  decisionReceiptDigest: digest26.nullable(),
4702
5019
  obligationsAssessmentDigest: digest26.nullable(),
4703
- artifactId: id9,
4704
- artifactRevision: id9,
5020
+ artifactId: id10,
5021
+ artifactRevision: id10,
4705
5022
  artifactDigest: digest26,
4706
- actionAuthorized: z52.literal(false),
5023
+ actionAuthorized: z54.literal(false),
4707
5024
  receiptDigest: digest26
4708
5025
  });
4709
5026
 
4710
5027
  // ../schemas/src/draft-hosted-output-check-record.ts
4711
- var id10 = DraftApplicationScopeSchema.shape.authorityId;
5028
+ var id11 = DraftApplicationScopeSchema.shape.authorityId;
4712
5029
  var digest27 = DraftJobReceiptSchema.shape.receiptDigest;
4713
- var HostedOutputCheckInputSchema = z53.strictObject({
4714
- executionId: id10,
4715
- output: id10.optional(),
4716
- text: z53.string().min(1).max(artifactLintLimits.maxTotalBytes).refine(isWellFormedText, "text_not_well_formed"),
4717
- revision: id10.optional()
4718
- });
4719
- var HostedOutputCheckRecordSchema = z53.strictObject({
4720
- schema: z53.literal("felspar.hosted-output-check/v0"),
4721
- checkId: id10,
4722
- jobId: id10,
4723
- output: id10,
4724
- decision: z53.strictObject({ executionId: id10, outcome: id10, receiptDigest: digest27 }),
4725
- release: z53.strictObject({ releaseId: id10, releaseDigest: digest27 }),
5030
+ var HostedOutputCheckInputSchema = z55.strictObject({
5031
+ executionId: id11,
5032
+ output: id11.optional(),
5033
+ text: z55.string().min(1).max(artifactLintLimits.maxTotalBytes).refine(isWellFormedText, "text_not_well_formed"),
5034
+ revision: id11.optional()
5035
+ });
5036
+ var HostedOutputCheckRecordSchema = z55.strictObject({
5037
+ schema: z55.literal("felspar.hosted-output-check/v0"),
5038
+ checkId: id11,
5039
+ jobId: id11,
5040
+ output: id11,
5041
+ decision: z55.strictObject({ executionId: id11, outcome: id11, receiptDigest: digest27 }),
5042
+ release: z55.strictObject({ releaseId: id11, releaseDigest: digest27 }),
4726
5043
  record: ArtifactLintRecordSchema,
4727
5044
  receipt: ArtifactLintReceiptSchema.nullable(),
4728
- evaluation: z53.strictObject({
4729
- modelCalls: z53.number().int().min(0),
4730
- reason: z53.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable()
5045
+ evaluation: z55.strictObject({
5046
+ modelCalls: z55.number().int().min(0),
5047
+ reason: z55.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable()
4731
5048
  })
4732
5049
  });
4733
5050
 
4734
5051
  // src/draft-hosted-client.ts
4735
- import { z as z54 } from "zod";
4736
- var digestText = z54.string().regex(/^sha256:[a-f0-9]{64}$/u);
4737
- var HostedOutputCheckReplySchema = z54.object({
4738
- status: z54.enum(["pass", "revise", "review_required", "unavailable"]),
4739
- checkId: z54.string(),
4740
- output: z54.string(),
4741
- findings: z54.array(z54.record(z54.string(), z54.unknown())),
4742
- receipt: z54.object({ receiptDigest: digestText, artifactDigest: digestText }).loose().nullable(),
4743
- decision: z54.object({ executionId: z54.string(), receiptDigest: digestText }),
4744
- actionAuthorized: z54.literal(false)
5052
+ import { z as z56 } from "zod";
5053
+ var digestText = z56.string().regex(/^sha256:[a-f0-9]{64}$/u);
5054
+ var HostedOutputCheckReplySchema = z56.object({
5055
+ status: z56.enum(["pass", "revise", "review_required", "unavailable"]),
5056
+ checkId: z56.string(),
5057
+ output: z56.string(),
5058
+ findings: z56.array(z56.record(z56.string(), z56.unknown())),
5059
+ receipt: z56.object({ receiptDigest: digestText, artifactDigest: digestText }).loose().nullable(),
5060
+ decision: z56.object({ executionId: z56.string(), receiptDigest: digestText }),
5061
+ actionAuthorized: z56.literal(false)
4745
5062
  }).loose();
4746
5063
  var hostedPartsContentType = "application/x.felspar-content-parts";
4747
5064
  async function partsBody(value) {
@@ -4793,14 +5110,14 @@ ${jobId}`;
4793
5110
  return result;
4794
5111
  };
4795
5112
  }
4796
- var refusalCode = z54.string().regex(/^[a-z][a-z_]{2,63}$/u);
4797
- var fieldPath = z54.array(z54.string().max(256)).max(32);
4798
- var refusalSchema = z54.object({
5113
+ var refusalCode = z56.string().regex(/^[a-z][a-z_]{2,63}$/u);
5114
+ var fieldPath = z56.array(z56.string().max(256)).max(32);
5115
+ var refusalSchema = z56.object({
4799
5116
  error: refusalCode,
4800
5117
  path: fieldPath.optional(),
4801
- currentReleaseDigest: z54.string().regex(/^sha256:[a-f0-9]{64}$/u).optional(),
4802
- retryAfterSeconds: z54.number().int().min(1).max(3600).optional(),
4803
- issues: z54.array(z54.object({ code: refusalCode, path: fieldPath })).max(64).optional()
5118
+ currentReleaseDigest: z56.string().regex(/^sha256:[a-f0-9]{64}$/u).optional(),
5119
+ retryAfterSeconds: z56.number().int().min(1).max(3600).optional(),
5120
+ issues: z56.array(z56.object({ code: refusalCode, path: fieldPath })).max(64).optional()
4804
5121
  }).transform((value) => {
4805
5122
  const fix = hostedRefusalFix(value.error);
4806
5123
  return {
@@ -4894,22 +5211,22 @@ function createHostedFelsparClient(configuration) {
4894
5211
  return {
4895
5212
  submitSource: async (value) => await call("/v0/sources", HostedObjectSchema, HostedSourceInputSchema.parse(value)),
4896
5213
  submitProposal: async (value) => await call("/v0/proposals", HostedObjectSchema, HostedProposalInputSchema.parse(value)),
4897
- approveProposal: async (id11, value) => await call(`/v0/proposals/${encodeURIComponent(objectId.parse(id11))}/approve`, HostedObjectSchema, HostedApprovalInputSchema.parse(value)),
4898
- releasePack: async (id11, value) => await call(`/v0/approvals/${encodeURIComponent(objectId.parse(id11))}/release`, DraftApplicationReleaseSchema, HostedReleaseInputSchema.parse(value)),
4899
- loadRelease: async (id11) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id11))}`, HostedReleaseBundleSchema),
4900
- describeJob: async (id11, job) => await describe(objectId.parse(id11), objectId.parse(job)),
5214
+ approveProposal: async (id12, value) => await call(`/v0/proposals/${encodeURIComponent(objectId.parse(id12))}/approve`, HostedObjectSchema, HostedApprovalInputSchema.parse(value)),
5215
+ releasePack: async (id12, value) => await call(`/v0/approvals/${encodeURIComponent(objectId.parse(id12))}/release`, DraftApplicationReleaseSchema, HostedReleaseInputSchema.parse(value)),
5216
+ loadRelease: async (id12) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id12))}`, HostedReleaseBundleSchema),
5217
+ describeJob: async (id12, job) => await describe(objectId.parse(id12), objectId.parse(job)),
4901
5218
  verifyReceipt: async (executionObjectId, value) => await call(`/v0/executions/${encodeURIComponent(objectId.parse(executionObjectId))}/verify`, HostedReceiptVerificationSchema, HostedReceiptVerificationInputSchema.parse(value)),
4902
5219
  ...outputCheckCalls(call),
4903
- executeJob: async (id11, value) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id11))}/jobs`, HostedJobResultSchema, HostedJobInputSchema.parse(value)),
4904
- resolveFacts: async (id11, value) => {
4905
- const releaseId = objectId.parse(id11);
5220
+ executeJob: async (id12, value) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id12))}/jobs`, HostedJobResultSchema, HostedJobInputSchema.parse(value)),
5221
+ resolveFacts: async (id12, value) => {
5222
+ const releaseId = objectId.parse(id12);
4906
5223
  const input = await factsRequest(value, async (jobId) => await describe(releaseId, jobId));
4907
5224
  const path3 = `/v0/releases/${encodeURIComponent(releaseId)}/jobs`;
4908
5225
  return pinnedResult(await call(path3, HostedJobResultSchema, input), releaseId, input);
4909
5226
  },
4910
- resolveJob: async (id11, value) => {
5227
+ resolveJob: async (id12, value) => {
4911
5228
  const input = HostedSuppliedJobInputSchema.parse(value);
4912
- const releaseId = objectId.parse(id11);
5229
+ const releaseId = objectId.parse(id12);
4913
5230
  const response = await call(`/v0/releases/${encodeURIComponent(releaseId)}/jobs`, HostedJobResultSchema, input);
4914
5231
  return pinnedResult(response, releaseId, input);
4915
5232
  }