@felspar/sdk 0.4.1 → 0.4.2

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.
@@ -316,8 +316,8 @@ async function sha256(text8) {
316
316
  const hash = new Uint8Array(await crypto.subtle.digest("SHA-256", encoder.encode(text8)));
317
317
  return `sha256:${Array.from(hash, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
318
318
  }
319
- function reference(digest29) {
320
- return { [draftContentPartReferenceKey]: digest29 };
319
+ function reference(digest31) {
320
+ return { [draftContentPartReferenceKey]: digest31 };
321
321
  }
322
322
  var referenceBytes = utf8(canonicalizeJson(reference(`sha256:${"0".repeat(64)}`)));
323
323
  var logicalLimit = "Content parts exceed the logical byte, node or depth limit";
@@ -419,9 +419,9 @@ function storedForm(input, state) {
419
419
  if (known) {
420
420
  return known.value;
421
421
  }
422
- const digest29 = state.digests.get(input);
423
- if (digest29 !== void 0) {
424
- return reference(digest29);
422
+ const digest31 = state.digests.get(input);
423
+ if (digest31 !== void 0) {
424
+ return reference(digest31);
425
425
  }
426
426
  const node = state.measured.get(input);
427
427
  if (!node) {
@@ -460,10 +460,10 @@ async function splitRoot(value2, isCollecting, isFreezing = false) {
460
460
  }
461
461
  for (const node of state.order) {
462
462
  const token = canonicalizeJson(storedForm(node.input, state));
463
- const digest30 = await sha256(token);
464
- state.digests.set(node.input, digest30);
465
- state.parts.set(digest30, token);
466
- remember(node, reference(digest30), referenceBytes);
463
+ const digest32 = await sha256(token);
464
+ state.digests.set(node.input, digest32);
465
+ state.parts.set(digest32, token);
466
+ remember(node, reference(digest32), referenceBytes);
467
467
  }
468
468
  const stored = storedForm(value2, state);
469
469
  if (value2 !== null && typeof value2 === "object") {
@@ -472,8 +472,8 @@ async function splitRoot(value2, isCollecting, isFreezing = false) {
472
472
  remember(node, stored, node.tokenBytes);
473
473
  }
474
474
  }
475
- const digest29 = await sha256(canonicalizeJson(stored));
476
- return { state, root: { ...root, value: stored }, digest: digest29 };
475
+ const digest31 = await sha256(canonicalizeJson(stored));
476
+ return { state, root: { ...root, value: stored }, digest: digest31 };
477
477
  }
478
478
  function byDigest(left, right) {
479
479
  return left < right ? -1 : 1;
@@ -484,7 +484,7 @@ function admitStored(parts, bytes) {
484
484
  }
485
485
  }
486
486
  async function packContentParts(value2) {
487
- const { state, root, digest: digest29 } = await splitRoot(value2, true);
487
+ const { state, root, digest: digest31 } = await splitRoot(value2, true);
488
488
  const parts = [];
489
489
  for (const part of state.parts.keys()) {
490
490
  parts.push(part);
@@ -495,7 +495,7 @@ async function packContentParts(value2) {
495
495
  const storedBytes = utf8(text8);
496
496
  admitStored(parts.length, storedBytes);
497
497
  return {
498
- digest: digest29,
498
+ digest: digest31,
499
499
  text: text8,
500
500
  parts: parts.length,
501
501
  storedBytes,
@@ -1534,7 +1534,7 @@ function inspectScoredPolicy(proposal, context3) {
1534
1534
  }
1535
1535
  inspectScoringReferences(scoring, proposal.requirements, context3);
1536
1536
  const ids3 = new Set(rules2.map((rule3) => rule3.id));
1537
- if (gates.some((id14) => !ids3.has(id14))) {
1537
+ if (gates.some((id15) => !ids3.has(id15))) {
1538
1538
  fail("Unknown mandatory gate rule");
1539
1539
  }
1540
1540
  if (rules2.every((rule3) => gates.includes(rule3.id))) {
@@ -1547,7 +1547,7 @@ function inspectScoredPolicy(proposal, context3) {
1547
1547
  if (isGate ? hasRange || rule3.when.length === 0 : !hasRange) {
1548
1548
  fail("Mandatory gates require fact predicates only; other rules require score ranges");
1549
1549
  }
1550
- if (rule3.overrides.some((id14) => gates.includes(id14) !== isGate)) {
1550
+ if (rule3.overrides.some((id15) => gates.includes(id15) !== isGate)) {
1551
1551
  fail("Explicit overrides cannot cross mandatory-gate and score-band classes");
1552
1552
  }
1553
1553
  const range2 = rule3.scoreRange;
@@ -1570,6 +1570,7 @@ function areScoredRulesDisjoint(proposal, left, right) {
1570
1570
  // ../schemas/src/draft-required-decision.ts
1571
1571
  var typedResolutionPolicy = "strict-required-types/direct-overrides/v2";
1572
1572
  var valueAgreementOutcomeRegions = "outcome-regions";
1573
+ var freshnessStaleBeforeReview = "stale-before-review";
1573
1574
  var identifier8 = DraftEvidenceScopeSchema.shape.entityId;
1574
1575
  var duplicateIdentity = "Duplicate identity";
1575
1576
  var uniqueIds = z15.array(identifier8).max(64).refine(hasUniqueValues, duplicateIdentity);
@@ -1613,7 +1614,8 @@ var shape = z15.strictObject({
1613
1614
  scope: z15.strictObject({
1614
1615
  entityId: identifier8,
1615
1616
  evaluationTime: DraftObservationChecksSchema.shape.evaluationTime,
1616
- valueAgreement: z15.literal(valueAgreementOutcomeRegions).optional()
1617
+ valueAgreement: z15.literal(valueAgreementOutcomeRegions).optional(),
1618
+ freshness: z15.literal(freshnessStaleBeforeReview).optional()
1617
1619
  }),
1618
1620
  evidence: z15.array(DraftEvidenceValidationSchema).max(64)
1619
1621
  });
@@ -1658,19 +1660,19 @@ function hasCycle(rules2) {
1658
1660
  const graph = new Map(rules2.map((item) => [item.id, item.overrides]));
1659
1661
  const visiting = /* @__PURE__ */ new Set();
1660
1662
  const visited = /* @__PURE__ */ new Set();
1661
- const hasPathCycle = (id14) => {
1662
- if (visiting.has(id14)) {
1663
+ const hasPathCycle = (id15) => {
1664
+ if (visiting.has(id15)) {
1663
1665
  return true;
1664
1666
  }
1665
- if (visited.has(id14)) {
1667
+ if (visited.has(id15)) {
1666
1668
  return false;
1667
1669
  }
1668
- visiting.add(id14);
1669
- if ((graph.get(id14) ?? []).some(hasPathCycle)) {
1670
+ visiting.add(id15);
1671
+ if ((graph.get(id15) ?? []).some(hasPathCycle)) {
1670
1672
  return true;
1671
1673
  }
1672
- visiting.delete(id14);
1673
- visited.add(id14);
1674
+ visiting.delete(id15);
1675
+ visited.add(id15);
1674
1676
  return false;
1675
1677
  };
1676
1678
  return rules2.some((item) => hasPathCycle(item.id));
@@ -1699,11 +1701,11 @@ function inspectRules(proposal, context3) {
1699
1701
  fail("Undeclared condition key or value");
1700
1702
  }
1701
1703
  }
1702
- if (item.overrides.some((id14) => id14 === item.id || !ids3.has(id14))) {
1704
+ if (item.overrides.some((id15) => id15 === item.id || !ids3.has(id15))) {
1703
1705
  fail("Unknown or self override");
1704
1706
  }
1705
- if (item.overrides.some((id14) => {
1706
- const target2 = byId.get(id14);
1707
+ if (item.overrides.some((id15) => {
1708
+ const target2 = byId.get(id15);
1707
1709
  return target2 !== void 0 && draftRulePriority(target2) > draftRulePriority(item);
1708
1710
  })) {
1709
1711
  fail("Override points to a higher priority tier");
@@ -1876,8 +1878,8 @@ function checkExpected(candidate2, context3) {
1876
1878
  }
1877
1879
  unique2(result.observationIds, context3, ["expected", "observationIds"]);
1878
1880
  const observationIds = new Set(candidate2.observations.map((entry3) => entry3.id));
1879
- for (const [index, id14] of result.observationIds.entries()) {
1880
- requireBinding2(observationIds.has(id14), context3, {
1881
+ for (const [index, id15] of result.observationIds.entries()) {
1882
+ requireBinding2(observationIds.has(id15), context3, {
1881
1883
  path: ["expected", "observationIds", index],
1882
1884
  message: "Unknown observation"
1883
1885
  });
@@ -2261,11 +2263,11 @@ var sourceBundle = z21.strictObject({
2261
2263
  const identities = /* @__PURE__ */ new Set();
2262
2264
  for (const [sourceIndex, source3] of bundle.sources.entries()) {
2263
2265
  const at = ["sources", sourceIndex];
2264
- const identity = sourceKey(source3);
2265
- if (identities.has(identity)) {
2266
+ const identity2 = sourceKey(source3);
2267
+ if (identities.has(identity2)) {
2266
2268
  context3.addIssue({ code: "custom", path: at, message: "Duplicate source/revision" });
2267
2269
  }
2268
- identities.add(identity);
2270
+ identities.add(identity2);
2269
2271
  const locators2 = /* @__PURE__ */ new Set();
2270
2272
  for (const [index, passage4] of source3.passages.entries()) {
2271
2273
  const path3 = [...at, "passages", index];
@@ -2414,10 +2416,11 @@ var DraftEvaluatorContractSchema = z24.strictObject({
2414
2416
  evaluator,
2415
2417
  calibration: z24.strictObject({ id: identifier13, version: identifier13, contentDigest: digest9 }),
2416
2418
  minimumSelectedProbability: z24.number().gt(0).max(1),
2417
- inputContextContract: z24.enum(["job-entity-time/v1", "job-only/v2"]).optional(),
2419
+ inputContextContract: z24.enum(["job-entity-time/v1", "job-only/v2", "job-only/v3", "job-only/v4"]).optional(),
2418
2420
  probabilityContract: z24.enum([
2419
2421
  "closed-distribution-unique-maximum/v1",
2420
- "closed-distribution-with-abstention/v1"
2422
+ "closed-distribution-with-abstention/v1",
2423
+ "independent-option-support/v1"
2421
2424
  ])
2422
2425
  });
2423
2426
  var judgment = z24.discriminatedUnion("status", [
@@ -2425,11 +2428,25 @@ var judgment = z24.discriminatedUnion("status", [
2425
2428
  status: z24.literal("evaluated"),
2426
2429
  abstentionProbability: z24.number().min(0).max(1).optional(),
2427
2430
  promptInjectionProbability: z24.number().min(0).max(1).optional(),
2431
+ applicabilityProbability: z24.number().min(0).max(1).optional(),
2432
+ irrelevanceProbability: z24.number().min(0).max(1).optional(),
2433
+ independentOptions: z24.array(z24.strictObject({
2434
+ value: z24.string().min(1).max(200),
2435
+ supported: z24.number().min(0).max(1),
2436
+ ruledOut: z24.number().min(0).max(1),
2437
+ unresolved: z24.number().min(0).max(1)
2438
+ })).min(1).max(64).optional(),
2428
2439
  probabilities: z24.array(z24.strictObject({
2429
2440
  value: z24.string().min(1).max(200),
2430
2441
  probability: z24.number().min(0).max(1)
2431
- })).min(1).max(64)
2432
- }),
2442
+ })).max(64)
2443
+ }).refine((row2) => {
2444
+ if (row2.independentOptions === void 0) {
2445
+ return row2.probabilities.length > 0 && row2.applicabilityProbability === void 0 && row2.irrelevanceProbability === void 0;
2446
+ }
2447
+ const hasSignals = row2.applicabilityProbability !== void 0 && row2.promptInjectionProbability !== void 0 && row2.irrelevanceProbability !== void 0;
2448
+ return row2.probabilities.length === 0 && row2.abstentionProbability === void 0 && hasSignals;
2449
+ }, "Judgment score contracts must not be mixed"),
2433
2450
  z24.strictObject({ status: z24.enum(["abstained", "timeout", "malformed", "review_required"]) })
2434
2451
  ]);
2435
2452
  var DraftNormalizedEvidenceSchema = z24.strictObject({
@@ -3183,13 +3200,13 @@ function areSubjectsValid(subjects, isIsolated) {
3183
3200
  function areEscalationsValid(escalations, context3) {
3184
3201
  const { isIsolated, outcomes } = context3;
3185
3202
  const ids3 = new Set(escalations.routes.map((row2) => row2.id));
3186
- const named = [escalations.unresolved, escalations.attemptLimit].filter((id14) => id14 !== null);
3203
+ const named = [escalations.unresolved, escalations.attemptLimit].filter((id15) => id15 !== null);
3187
3204
  return [
3188
3205
  ids3.size === escalations.routes.length,
3189
3206
  escalations.routes.every((row2) => isIsolated(row2.entryId, "routing_jobs")),
3190
3207
  hasUniqueValues(escalations.outcomes.map((row2) => row2.outcome)),
3191
3208
  escalations.outcomes.every((row2) => ids3.has(row2.escalation) && outcomes.has(row2.outcome)),
3192
- named.every((id14) => ids3.has(id14))
3209
+ named.every((id15) => ids3.has(id15))
3193
3210
  ].every(Boolean);
3194
3211
  }
3195
3212
  function isGuideValid(guide, isIsolated) {
@@ -3279,7 +3296,7 @@ var DraftContextSelectionPlanSchema = z31.strictObject({
3279
3296
  if (candidateIds.length > 64 || !hasUniqueIds(candidateIds) || !hasUniqueIds(plan.groups.map((item) => item.id)) || !hasUniqueIds(plan.entries.map((item) => item.id))) {
3280
3297
  context3.addIssue({ code: "custom", message: "Duplicate identities or too many candidates" });
3281
3298
  }
3282
- if (plan.requiredIds.some((id14) => candidateIds.includes(id14))) {
3299
+ if (plan.requiredIds.some((id15) => candidateIds.includes(id15))) {
3283
3300
  context3.addIssue({ code: "custom", message: "Global required root cannot be a candidate" });
3284
3301
  }
3285
3302
  const guidanceId = plan.unresolvedGuidanceEntryId;
@@ -3870,7 +3887,20 @@ var DraftApplicationReleaseSchema = z43.strictObject({
3870
3887
  });
3871
3888
 
3872
3889
  // ../schemas/src/draft-hosted-application.ts
3873
- import { z as z57 } from "zod";
3890
+ import { z as z59 } from "zod";
3891
+
3892
+ // ../schemas/src/draft-decision-attempt.ts
3893
+ import { z as z44 } from "zod";
3894
+ var DecisionGraphAttemptSchema = z44.strictObject({
3895
+ schema: z44.literal("felspar.decision-attempt/v1"),
3896
+ executionId: z44.string().min(1).max(200),
3897
+ releaseId: z44.string().min(1).max(200),
3898
+ receiptDigest: z44.string().regex(/^sha256:[a-f0-9]{64}$/u),
3899
+ ordinal: z44.number().int().min(1).max(12),
3900
+ next: z44.enum(["decided", "retry", "escalate"]),
3901
+ remaining: z44.number().int().min(0).max(10),
3902
+ escalationId: z44.string().min(1).max(200).nullable()
3903
+ });
3874
3904
 
3875
3905
  // ../schemas/src/draft-source-instant.ts
3876
3906
  var localPattern = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?([^.\d].*)$/u;
@@ -3940,43 +3970,43 @@ function normalizedSourceInstant(value2) {
3940
3970
  }
3941
3971
 
3942
3972
  // ../schemas/src/draft-hosted-output-checks.ts
3943
- import { z as z49 } from "zod";
3973
+ import { z as z50 } from "zod";
3944
3974
 
3945
3975
  // ../schemas/src/draft-artifact-check-manifest.ts
3946
- import { z as z47 } from "zod";
3976
+ import { z as z48 } from "zod";
3947
3977
 
3948
3978
  // ../schemas/src/draft-artifact-lint-semantic.ts
3949
- import { z as z46 } from "zod";
3979
+ import { z as z47 } from "zod";
3950
3980
 
3951
3981
  // ../schemas/src/draft-claim-evaluation-recipe.ts
3952
- import { z as z45 } from "zod";
3982
+ import { z as z46 } from "zod";
3953
3983
 
3954
3984
  // ../schemas/src/draft-output-check.ts
3955
- import { z as z44 } from "zod";
3985
+ import { z as z45 } from "zod";
3956
3986
  var identifier19 = DraftContextPlanSchema.shape.job;
3957
3987
  var digest19 = DraftJobReceiptBodySchema.shape.inputDigest;
3958
- var byteLimit = z44.number().int().min(1).max(65536);
3959
- var text5 = z44.string().max(16384);
3960
- var sectionRule = z44.discriminatedUnion("check", [
3961
- z44.strictObject({ id: identifier19, check: z44.literal("text"), maxBytes: byteLimit }),
3962
- z44.strictObject({
3988
+ var byteLimit = z45.number().int().min(1).max(65536);
3989
+ var text5 = z45.string().max(16384);
3990
+ var sectionRule = z45.discriminatedUnion("check", [
3991
+ z45.strictObject({ id: identifier19, check: z45.literal("text"), maxBytes: byteLimit }),
3992
+ z45.strictObject({
3963
3993
  id: identifier19,
3964
- check: z44.literal("exact"),
3994
+ check: z45.literal("exact"),
3965
3995
  maxBytes: byteLimit,
3966
- alternatives: z44.array(text5.min(1).regex(/\S/u)).min(1).max(8).refine(hasUniqueValues)
3996
+ alternatives: z45.array(text5.min(1).regex(/\S/u)).min(1).max(8).refine(hasUniqueValues)
3967
3997
  })
3968
3998
  ]);
3969
3999
  var draftOutputCheckerContract = "felspar.structured-output-check/v1";
3970
- var DraftOutputContractSchema = z44.strictObject({
3971
- schema: z44.literal("felspar.output-contract.draft/v0"),
4000
+ var DraftOutputContractSchema = z45.strictObject({
4001
+ schema: z45.literal("felspar.output-contract.draft/v0"),
3972
4002
  id: identifier19,
3973
- version: z44.number().int().min(1).max(65535),
4003
+ version: z45.number().int().min(1).max(65535),
3974
4004
  compiledArtifactDigest: digest19,
3975
4005
  job: identifier19,
3976
4006
  trustDomain: identifier19,
3977
4007
  outputSurface: identifier19,
3978
4008
  maxBytes: byteLimit,
3979
- sections: z44.array(sectionRule).min(1).max(16)
4009
+ sections: z45.array(sectionRule).min(1).max(16)
3980
4010
  }).superRefine((contract, context3) => {
3981
4011
  if (!hasUniqueValues(contract.sections.map((section) => section.id))) {
3982
4012
  context3.addIssue({ code: "custom", message: "Duplicate output section rule" });
@@ -3988,14 +4018,14 @@ var DraftOutputContractSchema = z44.strictObject({
3988
4018
  }
3989
4019
  }
3990
4020
  });
3991
- var DraftStructuredOutputSchema = z44.strictObject({
3992
- schema: z44.literal("felspar.structured-output.draft/v0"),
4021
+ var DraftStructuredOutputSchema = z45.strictObject({
4022
+ schema: z45.literal("felspar.structured-output.draft/v0"),
3993
4023
  id: identifier19,
3994
4024
  revision: identifier19,
3995
- sections: z44.array(z44.strictObject({ id: identifier19, text: text5 })).max(32).refine((sections) => hasUniqueValues(sections.map((section) => section.id)))
4025
+ sections: z45.array(z45.strictObject({ id: identifier19, text: text5 })).max(32).refine((sections) => hasUniqueValues(sections.map((section) => section.id)))
3996
4026
  });
3997
- var DraftOutputCheckSchema = z44.strictObject({
3998
- schema: z44.literal("felspar.output-check.draft/v0"),
4027
+ var DraftOutputCheckSchema = z45.strictObject({
4028
+ schema: z45.literal("felspar.output-check.draft/v0"),
3999
4029
  execution: DraftJobExecutionSchema,
4000
4030
  expectedJobReceiptDigest: digest19,
4001
4031
  contractEntryId: identifier19,
@@ -4003,8 +4033,8 @@ var DraftOutputCheckSchema = z44.strictObject({
4003
4033
  output: DraftStructuredOutputSchema,
4004
4034
  expectedOutputDigest: digest19
4005
4035
  });
4006
- var DraftOutputDiagnosticSchema = z44.strictObject({
4007
- code: z44.enum([
4036
+ var DraftOutputDiagnosticSchema = z45.strictObject({
4037
+ code: z45.enum([
4008
4038
  "upstream_blocked",
4009
4039
  "contract_coverage_incomplete",
4010
4040
  "contract_invalid",
@@ -4017,13 +4047,13 @@ var DraftOutputDiagnosticSchema = z44.strictObject({
4017
4047
  ]),
4018
4048
  sectionId: identifier19.nullable()
4019
4049
  });
4020
- var DraftOutputReceiptBodySchema = z44.strictObject({
4021
- schema: z44.literal("felspar.output-receipt.draft/v0"),
4022
- authority: z44.literal("unapproved"),
4023
- checkerContract: z44.literal(draftOutputCheckerContract),
4024
- coverage: z44.literal("declared_structure_and_exact_text"),
4025
- semanticEvaluation: z44.literal("not_performed"),
4026
- actionAuthorized: z44.literal(false),
4050
+ var DraftOutputReceiptBodySchema = z45.strictObject({
4051
+ schema: z45.literal("felspar.output-receipt.draft/v0"),
4052
+ authority: z45.literal("unapproved"),
4053
+ checkerContract: z45.literal(draftOutputCheckerContract),
4054
+ coverage: z45.literal("declared_structure_and_exact_text"),
4055
+ semanticEvaluation: z45.literal("not_performed"),
4056
+ actionAuthorized: z45.literal(false),
4027
4057
  inputDigest: digest19,
4028
4058
  jobReceiptDigest: digest19,
4029
4059
  compiledArtifactDigest: digest19,
@@ -4032,39 +4062,39 @@ var DraftOutputReceiptBodySchema = z44.strictObject({
4032
4062
  outputDigest: digest19,
4033
4063
  outputId: identifier19,
4034
4064
  outputRevision: identifier19,
4035
- status: z44.enum(["checks_passed", "invalid", "blocked"]),
4036
- structuralOnlySectionIds: z44.array(identifier19).max(16),
4037
- diagnostics: z44.array(DraftOutputDiagnosticSchema).max(81)
4065
+ status: z45.enum(["checks_passed", "invalid", "blocked"]),
4066
+ structuralOnlySectionIds: z45.array(identifier19).max(16),
4067
+ diagnostics: z45.array(DraftOutputDiagnosticSchema).max(81)
4038
4068
  });
4039
4069
  var DraftOutputReceiptSchema = DraftOutputReceiptBodySchema.extend({
4040
4070
  receiptDigest: digest19
4041
4071
  });
4042
- var DraftOutputVerificationOptionsSchema = z44.strictObject({
4072
+ var DraftOutputVerificationOptionsSchema = z45.strictObject({
4043
4073
  expectedReceiptDigest: digest19
4044
4074
  });
4045
4075
 
4046
4076
  // ../schemas/src/draft-claim-evaluation-recipe.ts
4047
4077
  var scope = DraftOutputContractSchema.shape;
4048
4078
  var identifier20 = scope.id;
4049
- var text6 = z45.string().min(1).max(2048).regex(/\S/u);
4050
- var ids2 = z45.array(identifier20).max(8).refine(hasUniqueValues, "Duplicate identifier");
4079
+ var text6 = z46.string().min(1).max(2048).regex(/\S/u);
4080
+ var ids2 = z46.array(identifier20).max(8).refine(hasUniqueValues, "Duplicate identifier");
4051
4081
  var { judgment: judgment3 } = DraftNormalizedEvidenceSchema.shape.normalizations.element.shape;
4052
- var option = z45.strictObject({
4082
+ var option = z46.strictObject({
4053
4083
  value: judgment3.options[0].shape.probabilities.element.shape.value,
4054
4084
  meaning: text6,
4055
- effect: z45.enum(["satisfied", "violated", "unresolved"])
4085
+ effect: z46.enum(["satisfied", "violated", "unresolved"])
4056
4086
  });
4057
- var question = z45.strictObject({
4087
+ var question = z46.strictObject({
4058
4088
  id: identifier20,
4059
4089
  sectionIds: ids2.min(1),
4060
4090
  instructions: text6,
4061
4091
  authorityEntryIds: ids2.min(1),
4062
4092
  evidenceKeys: ids2,
4063
- 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"),
4064
- minimumSelectedProbability: z45.number().gt(0).max(1)
4093
+ options: z46.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"),
4094
+ minimumSelectedProbability: z46.number().gt(0).max(1)
4065
4095
  });
4066
- var DraftClaimEvaluationRecipeSchema = z45.strictObject({
4067
- schema: z45.literal("felspar.claim-evaluation-recipe.draft/v0"),
4096
+ var DraftClaimEvaluationRecipeSchema = z46.strictObject({
4097
+ schema: z46.literal("felspar.claim-evaluation-recipe.draft/v0"),
4068
4098
  id: identifier20,
4069
4099
  version: identifier20,
4070
4100
  compiledArtifactDigest: scope.compiledArtifactDigest,
@@ -4074,11 +4104,11 @@ var DraftClaimEvaluationRecipeSchema = z45.strictObject({
4074
4104
  evaluator: DraftEvaluatorContractSchema.shape.evaluator,
4075
4105
  calibration: DraftEvaluatorContractSchema.shape.calibration,
4076
4106
  probabilityContract: DraftEvaluatorContractSchema.shape.probabilityContract,
4077
- questions: z45.array(question).min(1).max(8).refine((items) => hasUniqueValues(items.map((item) => item.id)), "Duplicate question"),
4078
- limits: z45.strictObject({
4079
- maxRequests: z45.number().int().min(1).max(128),
4080
- maxRequestBytes: z45.number().int().min(1).max(16384),
4081
- maxTotalBytes: z45.number().int().min(1).max(65536)
4107
+ questions: z46.array(question).min(1).max(8).refine((items) => hasUniqueValues(items.map((item) => item.id)), "Duplicate question"),
4108
+ limits: z46.strictObject({
4109
+ maxRequests: z46.number().int().min(1).max(128),
4110
+ maxRequestBytes: z46.number().int().min(1).max(16384),
4111
+ maxTotalBytes: z46.number().int().min(1).max(65536)
4082
4112
  })
4083
4113
  });
4084
4114
 
@@ -4095,85 +4125,85 @@ var artifactSemanticLimits = {
4095
4125
  maxRequestBytes: 32768,
4096
4126
  maxTotalBytes: 16777216
4097
4127
  };
4098
- var ArtifactSemanticQuestionSchema = z46.strictObject({
4128
+ var ArtifactSemanticQuestionSchema = z47.strictObject({
4099
4129
  id: id3,
4100
4130
  instructions: recipeQuestion.instructions,
4101
4131
  options: recipeQuestion.options,
4102
4132
  minimumSelectedProbability: recipeQuestion.minimumSelectedProbability,
4103
- aggregation: z46.enum(["prohibit", "require", "match"])
4133
+ aggregation: z47.enum(["prohibit", "require", "match"])
4104
4134
  });
4105
- var ArtifactSemanticRecipeSchema = z46.strictObject({
4135
+ var ArtifactSemanticRecipeSchema = z47.strictObject({
4106
4136
  evaluator: recipe.evaluator,
4107
4137
  calibration: recipe.calibration,
4108
4138
  probabilityContract: recipe.probabilityContract,
4109
- questions: z46.array(ArtifactSemanticQuestionSchema).min(1).max(artifactSemanticLimits.maxQuestions),
4110
- limits: z46.strictObject({
4111
- maxEvaluations: z46.number().int().min(1).max(artifactSemanticLimits.maxEvaluations),
4112
- maxRequestBytes: z46.number().int().min(1).max(artifactSemanticLimits.maxRequestBytes),
4113
- maxTotalBytes: z46.number().int().min(1).max(artifactSemanticLimits.maxTotalBytes)
4139
+ questions: z47.array(ArtifactSemanticQuestionSchema).min(1).max(artifactSemanticLimits.maxQuestions),
4140
+ limits: z47.strictObject({
4141
+ maxEvaluations: z47.number().int().min(1).max(artifactSemanticLimits.maxEvaluations),
4142
+ maxRequestBytes: z47.number().int().min(1).max(artifactSemanticLimits.maxRequestBytes),
4143
+ maxTotalBytes: z47.number().int().min(1).max(artifactSemanticLimits.maxTotalBytes)
4114
4144
  })
4115
4145
  });
4116
- var ArtifactSemanticRequestSchema = z46.strictObject({
4117
- schema: z46.literal("felspar.artifact-question.draft/v1"),
4146
+ var ArtifactSemanticRequestSchema = z47.strictObject({
4147
+ schema: z47.literal("felspar.artifact-question.draft/v1"),
4118
4148
  preparationDigest: digest20,
4119
4149
  unitId: id3,
4120
4150
  sectionId: id3,
4121
- start: z46.number().int().min(0),
4122
- end: z46.number().int().min(1),
4151
+ start: z47.number().int().min(0),
4152
+ end: z47.number().int().min(1),
4123
4153
  textDigest: digest20,
4124
- text: z46.string().min(1),
4154
+ text: z47.string().min(1),
4125
4155
  questionId: id3,
4126
4156
  instructions: recipeQuestion.instructions,
4127
- options: z46.array(z46.strictObject({ value: z46.string(), meaning: z46.string() })).min(2).max(8),
4128
- policy: z46.array(z46.strictObject({ sourceLocator: z46.string(), text: z46.string() })).min(1),
4157
+ options: z47.array(z47.strictObject({ value: z47.string(), meaning: z47.string() })).min(2).max(8),
4158
+ policy: z47.array(z47.strictObject({ sourceLocator: z47.string(), text: z47.string() })).min(1),
4129
4159
  evaluator: recipe.evaluator,
4130
4160
  calibration: recipe.calibration,
4131
4161
  requestDigest: digest20
4132
4162
  });
4133
- var artifactInjectionScreen = z46.literal("paragraph-injection/v1");
4134
- var ArtifactSemanticResponseSchema = z46.strictObject({
4135
- schema: z46.literal("felspar.artifact-question-response.draft/v1"),
4163
+ var artifactInjectionScreen = z47.literal("paragraph-injection/v1");
4164
+ var ArtifactSemanticResponseSchema = z47.strictObject({
4165
+ schema: z47.literal("felspar.artifact-question-response.draft/v1"),
4136
4166
  screen: artifactInjectionScreen.optional(),
4137
4167
  preparationDigest: digest20,
4138
4168
  evaluator: recipe.evaluator,
4139
4169
  calibrationDigest: digest20,
4140
- answers: z46.array(z46.strictObject({ unitId: id3, questionId: id3, requestDigest: digest20, judgment: judgment4 })).max(artifactSemanticLimits.maxEvaluations)
4170
+ answers: z47.array(z47.strictObject({ unitId: id3, questionId: id3, requestDigest: digest20, judgment: judgment4 })).max(artifactSemanticLimits.maxEvaluations)
4141
4171
  });
4142
- var ArtifactSemanticJudgmentSchema = z46.strictObject({
4172
+ var ArtifactSemanticJudgmentSchema = z47.strictObject({
4143
4173
  unitId: id3,
4144
4174
  sectionId: id3,
4145
- start: z46.number().int().min(0),
4146
- end: z46.number().int().min(1),
4175
+ start: z47.number().int().min(0),
4176
+ end: z47.number().int().min(1),
4147
4177
  textDigest: digest20,
4148
4178
  questionId: id3,
4149
4179
  requestDigest: digest20,
4150
4180
  judgment: judgment4.nullable(),
4151
- value: z46.string().nullable(),
4152
- effect: z46.enum(["satisfied", "violated", "unresolved", "unavailable", "not_stated"]),
4153
- reasons: z46.array(z46.string().max(128)).max(8)
4181
+ value: z47.string().nullable(),
4182
+ effect: z47.enum(["satisfied", "violated", "unresolved", "unavailable", "not_stated"]),
4183
+ reasons: z47.array(z47.string().max(128)).max(8)
4154
4184
  });
4155
- var ArtifactSemanticRecordSchema = z46.strictObject({
4156
- state: z46.enum(["ready", "skipped", "over_budget", "not_evaluated"]),
4185
+ var ArtifactSemanticRecordSchema = z47.strictObject({
4186
+ state: z47.enum(["ready", "skipped", "over_budget", "not_evaluated"]),
4157
4187
  screen: artifactInjectionScreen.optional(),
4158
4188
  preparationDigest: digest20,
4159
4189
  evaluator: ArtifactSemanticRecipeSchema.shape.evaluator,
4160
4190
  calibrationDigest: digest20,
4161
4191
  probabilityContract: ArtifactSemanticRecipeSchema.shape.probabilityContract,
4162
- questions: z46.array(ArtifactSemanticQuestionSchema.pick({
4192
+ questions: z47.array(ArtifactSemanticQuestionSchema.pick({
4163
4193
  id: true,
4164
4194
  minimumSelectedProbability: true,
4165
4195
  aggregation: true
4166
4196
  }).extend({
4167
4197
  checkId: id3,
4168
4198
  anchorSectionId: id3,
4169
- sectionsAvailable: z46.boolean(),
4170
- units: z46.number().int().min(0).max(artifactSemanticLimits.maxEvaluations),
4171
- options: z46.array(z46.strictObject({
4199
+ sectionsAvailable: z47.boolean(),
4200
+ units: z47.number().int().min(0).max(artifactSemanticLimits.maxEvaluations),
4201
+ options: z47.array(z47.strictObject({
4172
4202
  value: ArtifactSemanticQuestionSchema.shape.options.element.shape.value,
4173
- effect: z46.enum(["satisfied", "violated", "unresolved", "not_stated"])
4203
+ effect: z47.enum(["satisfied", "violated", "unresolved", "not_stated"])
4174
4204
  })).min(2).max(8)
4175
4205
  })).max(artifactSemanticLimits.maxQuestions),
4176
- judgments: z46.array(ArtifactSemanticJudgmentSchema).max(artifactSemanticLimits.maxEvaluations)
4206
+ judgments: z47.array(ArtifactSemanticJudgmentSchema).max(artifactSemanticLimits.maxEvaluations)
4177
4207
  });
4178
4208
  var caseNotStated = "not_stated";
4179
4209
  var abstain = "cannot_determine";
@@ -4231,12 +4261,12 @@ var artifactLintLimits = {
4231
4261
  function isWellFormedText(value2) {
4232
4262
  return !/\p{Cs}/u.test(value2);
4233
4263
  }
4234
- var literal = z47.string().min(1).max(artifactLintLimits.maxLiteralUnits).regex(/\S/u).refine(isWellFormedText);
4235
- var passage = z47.strictObject({
4236
- sourceLocator: z47.string().min(1).max(4096).regex(/\S/u),
4264
+ var literal = z48.string().min(1).max(artifactLintLimits.maxLiteralUnits).regex(/\S/u).refine(isWellFormedText);
4265
+ var passage = z48.strictObject({
4266
+ sourceLocator: z48.string().min(1).max(4096).regex(/\S/u),
4237
4267
  contentDigest: digest21
4238
4268
  });
4239
- var common = { id: id4, required: z47.boolean(), specification: passage };
4269
+ var common = { id: id4, required: z48.boolean(), specification: passage };
4240
4270
  var artifactCheckKinds = [
4241
4271
  "section",
4242
4272
  "required_wording",
@@ -4249,64 +4279,64 @@ var artifactLintMediaTypes = [
4249
4279
  "text/plain",
4250
4280
  "application/vnd.felspar.structured-output+json"
4251
4281
  ];
4252
- var sectionTargets = z47.array(id4).min(1).max(artifactLintLimits.maxSections);
4253
- var ArtifactCheckSchema = z47.discriminatedUnion("kind", [
4254
- z47.strictObject({ ...common, kind: z47.literal("section"), sectionId: id4 }),
4255
- z47.strictObject({
4282
+ var sectionTargets = z48.array(id4).min(1).max(artifactLintLimits.maxSections);
4283
+ var ArtifactCheckSchema = z48.discriminatedUnion("kind", [
4284
+ z48.strictObject({ ...common, kind: z48.literal("section"), sectionId: id4 }),
4285
+ z48.strictObject({
4256
4286
  ...common,
4257
- kind: z47.literal("required_wording"),
4287
+ kind: z48.literal("required_wording"),
4258
4288
  sectionId: id4,
4259
- alternatives: z47.array(literal).min(1).max(artifactLintLimits.maxAlternatives)
4289
+ alternatives: z48.array(literal).min(1).max(artifactLintLimits.maxAlternatives)
4260
4290
  }),
4261
- z47.strictObject({
4291
+ z48.strictObject({
4262
4292
  ...common,
4263
- kind: z47.literal("prohibited_literal"),
4293
+ kind: z48.literal("prohibited_literal"),
4264
4294
  sectionIds: sectionTargets,
4265
- literals: z47.array(literal).min(1).max(artifactLintLimits.maxLiterals)
4295
+ literals: z48.array(literal).min(1).max(artifactLintLimits.maxLiterals)
4266
4296
  }),
4267
- z47.strictObject({
4297
+ z48.strictObject({
4268
4298
  ...common,
4269
- kind: z47.literal("field_value"),
4299
+ kind: z48.literal("field_value"),
4270
4300
  sectionId: id4,
4271
- label: z47.string().min(1).max(128).regex(/^[^\s:](?:[^\n\r:]*[^\s:])?$/u).refine(isWellFormedText),
4272
- unit: z47.string().min(1).max(32).regex(/^\S+$/u).refine(isWellFormedText).nullable(),
4301
+ label: z48.string().min(1).max(128).regex(/^[^\s:](?:[^\n\r:]*[^\s:])?$/u).refine(isWellFormedText),
4302
+ unit: z48.string().min(1).max(32).regex(/^\S+$/u).refine(isWellFormedText).nullable(),
4273
4303
  evidenceKey: id4,
4274
- comparator: z47.enum(["eq", "lte", "gte"])
4304
+ comparator: z48.enum(["eq", "lte", "gte"])
4275
4305
  }),
4276
- z47.strictObject({
4306
+ z48.strictObject({
4277
4307
  ...common,
4278
- kind: z47.literal("case_answer"),
4308
+ kind: z48.literal("case_answer"),
4279
4309
  sectionIds: sectionTargets,
4280
- fact: z47.discriminatedUnion("comparison", [
4281
- z47.strictObject({ key: id4, comparison: z47.literal("choice") }),
4282
- z47.strictObject({
4310
+ fact: z48.discriminatedUnion("comparison", [
4311
+ z48.strictObject({ key: id4, comparison: z48.literal("choice") }),
4312
+ z48.strictObject({
4283
4313
  key: id4,
4284
- comparison: z47.literal("number"),
4314
+ comparison: z48.literal("number"),
4285
4315
  reader: ExactReaderSchema.options[0]
4286
4316
  }),
4287
- z47.strictObject({
4317
+ z48.strictObject({
4288
4318
  key: id4,
4289
- comparison: z47.literal("date"),
4319
+ comparison: z48.literal("date"),
4290
4320
  reader: ExactReaderSchema.options[1]
4291
4321
  })
4292
4322
  ]),
4293
- answers: z47.array(z47.strictObject({
4323
+ answers: z48.array(z48.strictObject({
4294
4324
  value: id4,
4295
- wording: z47.array(literal).max(artifactLintLimits.maxAlternatives)
4325
+ wording: z48.array(literal).max(artifactLintLimits.maxAlternatives)
4296
4326
  })).max(artifactLintLimits.maxLiterals),
4297
4327
  questionId: id4.nullable()
4298
4328
  }),
4299
- z47.strictObject({
4329
+ z48.strictObject({
4300
4330
  ...common,
4301
- kind: z47.literal("semantic_question"),
4331
+ kind: z48.literal("semantic_question"),
4302
4332
  sectionIds: sectionTargets,
4303
4333
  questionId: id4
4304
4334
  })
4305
4335
  ]);
4306
- var sectionDeclaration = z47.strictObject({
4336
+ var sectionDeclaration = z48.strictObject({
4307
4337
  id: id4,
4308
- heading: z47.string().min(1).max(256).regex(/\S/u).refine((value2) => !/[\n\r]/u.test(value2) && isWellFormedText(value2)).nullable(),
4309
- maxUnits: z47.number().int().min(1).max(artifactLintLimits.maxSectionUnits)
4338
+ heading: z48.string().min(1).max(256).regex(/\S/u).refine((value2) => !/[\n\r]/u.test(value2) && isWellFormedText(value2)).nullable(),
4339
+ maxUnits: z48.number().int().min(1).max(artifactLintLimits.maxSectionUnits)
4310
4340
  });
4311
4341
  function caseAnswerIssues(checks) {
4312
4342
  const issues = [];
@@ -4326,18 +4356,18 @@ function caseAnswerIssues(checks) {
4326
4356
  }
4327
4357
  return issues;
4328
4358
  }
4329
- var ArtifactCheckManifestSchema = z47.strictObject({
4330
- schema: z47.literal("felspar.artifact-check-manifest.draft/v1"),
4359
+ var ArtifactCheckManifestSchema = z48.strictObject({
4360
+ schema: z48.literal("felspar.artifact-check-manifest.draft/v1"),
4331
4361
  id: id4,
4332
- version: z47.number().int().min(1).max(65535),
4362
+ version: z48.number().int().min(1).max(65535),
4333
4363
  jobId: id4,
4334
4364
  trustDomain: id4,
4335
- contract: z47.strictObject({ id: id4, digest: digest21 }),
4336
- parser: z47.enum(["body", "headings"]),
4337
- maxBytes: z47.number().int().min(1).max(artifactLintLimits.maxTotalBytes),
4338
- sections: z47.array(sectionDeclaration).min(1).max(artifactLintLimits.maxSections),
4339
- caseContext: z47.enum(["required", "not_required"]),
4340
- checks: z47.array(ArtifactCheckSchema).min(1).max(artifactLintLimits.maxChecks),
4365
+ contract: z48.strictObject({ id: id4, digest: digest21 }),
4366
+ parser: z48.enum(["body", "headings"]),
4367
+ maxBytes: z48.number().int().min(1).max(artifactLintLimits.maxTotalBytes),
4368
+ sections: z48.array(sectionDeclaration).min(1).max(artifactLintLimits.maxSections),
4369
+ caseContext: z48.enum(["required", "not_required"]),
4370
+ checks: z48.array(ArtifactCheckSchema).min(1).max(artifactLintLimits.maxChecks),
4341
4371
  semantic: ArtifactSemanticRecipeSchema.nullable()
4342
4372
  }).superRefine((manifest2, context3) => {
4343
4373
  const issue = (message) => {
@@ -4382,11 +4412,11 @@ var ArtifactCheckManifestSchema = z47.strictObject({
4382
4412
  var ArtifactSpecificationSchema = passage;
4383
4413
 
4384
4414
  // ../schemas/src/draft-job-obligations-manifest.ts
4385
- import { z as z48 } from "zod";
4415
+ import { z as z49 } from "zod";
4386
4416
  var id5 = DraftApplicationScopeSchema.shape.authorityId;
4387
4417
  var digest22 = DraftJobReceiptSchema.shape.receiptDigest;
4388
4418
  var passage2 = {
4389
- sourceLocator: z48.string().min(1).max(4096).regex(/\S/u),
4419
+ sourceLocator: z49.string().min(1).max(4096).regex(/\S/u),
4390
4420
  contentDigest: digest22
4391
4421
  };
4392
4422
  var jobObligationsLimits = {
@@ -4397,41 +4427,41 @@ var jobObligationsLimits = {
4397
4427
  maxApprovalTargets: 16,
4398
4428
  maxManifestBytes: 65536
4399
4429
  };
4400
- var DraftJobObligationsScopeSchema = z48.strictObject({
4430
+ var DraftJobObligationsScopeSchema = z49.strictObject({
4401
4431
  purposeRef: id5,
4402
4432
  useRef: id5.nullable()
4403
4433
  });
4404
- var artifact = z48.strictObject({
4434
+ var artifact = z49.strictObject({
4405
4435
  id: id5,
4406
4436
  role: id5,
4407
- contract: z48.strictObject({ id: id5, digest: digest22 }),
4437
+ contract: z49.strictObject({ id: id5, digest: digest22 }),
4408
4438
  ...passage2
4409
4439
  });
4410
- var approval = z48.strictObject({
4440
+ var approval = z49.strictObject({
4411
4441
  id: id5,
4412
- policy: z48.strictObject({ id: id5, ...passage2 }),
4413
- phase: z48.enum(["before_decision", "before_generation", "before_use"]),
4414
- appliesTo: z48.array(z48.discriminatedUnion("kind", [
4415
- z48.strictObject({ kind: z48.literal("decision") }),
4416
- z48.strictObject({ kind: z48.literal("artifact"), id: id5 }),
4417
- z48.strictObject({ kind: z48.literal("use") })
4442
+ policy: z49.strictObject({ id: id5, ...passage2 }),
4443
+ phase: z49.enum(["before_decision", "before_generation", "before_use"]),
4444
+ appliesTo: z49.array(z49.discriminatedUnion("kind", [
4445
+ z49.strictObject({ kind: z49.literal("decision") }),
4446
+ z49.strictObject({ kind: z49.literal("artifact"), id: id5 }),
4447
+ z49.strictObject({ kind: z49.literal("use") })
4418
4448
  ])).min(1).max(jobObligationsLimits.maxApprovalTargets)
4419
4449
  });
4420
- var outcome = z48.strictObject({
4450
+ var outcome = z49.strictObject({
4421
4451
  outcomeId: id5,
4422
4452
  ...passage2,
4423
- contextRequired: z48.boolean(),
4424
- artifacts: z48.array(artifact).max(jobObligationsLimits.maxArtifacts),
4425
- approvals: z48.array(approval).max(jobObligationsLimits.maxApprovals)
4453
+ contextRequired: z49.boolean(),
4454
+ artifacts: z49.array(artifact).max(jobObligationsLimits.maxArtifacts),
4455
+ approvals: z49.array(approval).max(jobObligationsLimits.maxApprovals)
4426
4456
  });
4427
- var manifest = z48.strictObject({
4428
- schema: z48.literal("felspar.job-obligations.draft/v0"),
4457
+ var manifest = z49.strictObject({
4458
+ schema: z49.literal("felspar.job-obligations.draft/v0"),
4429
4459
  jobId: id5,
4430
4460
  trustDomain: id5,
4431
4461
  scope: DraftJobObligationsScopeSchema,
4432
4462
  source: DraftSourceReferenceSchema,
4433
- contracts: z48.array(z48.strictObject({ id: id5, ...passage2 })).max(jobObligationsLimits.maxContracts),
4434
- outcomes: z48.array(outcome).min(1).max(jobObligationsLimits.maxOutcomes)
4463
+ contracts: z49.array(z49.strictObject({ id: id5, ...passage2 })).max(jobObligationsLimits.maxContracts),
4464
+ outcomes: z49.array(outcome).min(1).max(jobObligationsLimits.maxOutcomes)
4435
4465
  });
4436
4466
  function unique3(values, context3, path3) {
4437
4467
  const distinct = new Set(values);
@@ -4502,10 +4532,10 @@ var DraftJobObligationsOutcomeSchema = outcome;
4502
4532
 
4503
4533
  // ../schemas/src/draft-hosted-output-checks.ts
4504
4534
  var hostedOutputCheckLimits = { maxOutputs: 8 };
4505
- var HostedOutputChecksSchema = z49.strictObject({
4506
- schema: z49.literal("felspar.output-checks.draft/v0"),
4535
+ var HostedOutputChecksSchema = z50.strictObject({
4536
+ schema: z50.literal("felspar.output-checks.draft/v0"),
4507
4537
  obligations: DraftJobObligationsSchema,
4508
- manifests: z49.array(ArtifactCheckManifestSchema).min(1).max(hostedOutputCheckLimits.maxOutputs)
4538
+ manifests: z50.array(ArtifactCheckManifestSchema).min(1).max(hostedOutputCheckLimits.maxOutputs)
4509
4539
  }).superRefine((value2, context3) => {
4510
4540
  if (context3.issues.length > 0) {
4511
4541
  return;
@@ -4532,13 +4562,13 @@ var HostedOutputChecksSchema = z49.strictObject({
4532
4562
  });
4533
4563
 
4534
4564
  // ../schemas/src/draft-pack-revision.ts
4535
- import { z as z55 } from "zod";
4565
+ import { z as z56 } from "zod";
4536
4566
 
4537
4567
  // ../schemas/src/draft-pack-draft-outputs.ts
4538
- import { z as z50 } from "zod";
4539
- var identifier21 = z50.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/u, "Use lowercase letters, digits, - and _");
4540
- var quote = z50.string().min(1).max(4e3);
4541
- var wording = z50.string().min(1).max(artifactLintLimits.maxLiteralUnits).regex(/\S/u, "Wording needs a visible character").refine(isWellFormedText, "Wording has a broken character");
4568
+ import { z as z51 } from "zod";
4569
+ var identifier21 = z51.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/u, "Use lowercase letters, digits, - and _");
4570
+ var quote = z51.string().min(1).max(4e3);
4571
+ var wording = z51.string().min(1).max(artifactLintLimits.maxLiteralUnits).regex(/\S/u, "Wording needs a visible character").refine(isWellFormedText, "Wording has a broken character");
4542
4572
  var packDraftOutputLimits = {
4543
4573
  maxOutputs: 8,
4544
4574
  maxChecks: 16,
@@ -4547,26 +4577,26 @@ var packDraftOutputLimits = {
4547
4577
  defaultCharacters: 8e3,
4548
4578
  maxCharacters: artifactLintLimits.maxSectionUnits
4549
4579
  };
4550
- var wordingCheck = (max) => z50.strictObject({ id: identifier21, quote, wording: z50.array(wording).min(1).max(max) });
4551
- var PackDraftOutputSchema = z50.strictObject({
4580
+ var wordingCheck = (max) => z51.strictObject({ id: identifier21, quote, wording: z51.array(wording).min(1).max(max) });
4581
+ var PackDraftOutputSchema = z51.strictObject({
4552
4582
  id: identifier21,
4553
4583
  what: quote,
4554
- outcomes: z50.array(identifier21).min(1).max(64).refine(hasUniqueValues, "Duplicate outcome"),
4555
- maxCharacters: z50.number().int().min(1).max(packDraftOutputLimits.maxCharacters).optional(),
4556
- context: z50.array(z50.strictObject({ id: identifier21, quote })).min(1).max(packDraftOutputLimits.maxContext).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate context id").optional(),
4557
- require: z50.array(wordingCheck(artifactLintLimits.maxAlternatives)).max(packDraftOutputLimits.maxChecks).optional(),
4558
- prohibit: z50.array(wordingCheck(artifactLintLimits.maxLiterals)).max(packDraftOutputLimits.maxChecks).optional(),
4559
- ask: z50.array(z50.strictObject({
4584
+ outcomes: z51.array(identifier21).min(1).max(64).refine(hasUniqueValues, "Duplicate outcome"),
4585
+ maxCharacters: z51.number().int().min(1).max(packDraftOutputLimits.maxCharacters).optional(),
4586
+ context: z51.array(z51.strictObject({ id: identifier21, quote })).min(1).max(packDraftOutputLimits.maxContext).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate context id").optional(),
4587
+ require: z51.array(wordingCheck(artifactLintLimits.maxAlternatives)).max(packDraftOutputLimits.maxChecks).optional(),
4588
+ prohibit: z51.array(wordingCheck(artifactLintLimits.maxLiterals)).max(packDraftOutputLimits.maxChecks).optional(),
4589
+ ask: z51.array(z51.strictObject({
4560
4590
  id: identifier21,
4561
4591
  quote,
4562
- kind: z50.enum(["require", "prohibit"]),
4563
- question: z50.string().min(1).max(2e3).regex(/\S/u)
4592
+ kind: z51.enum(["require", "prohibit"]),
4593
+ question: z51.string().min(1).max(2e3).regex(/\S/u)
4564
4594
  })).max(packDraftOutputLimits.maxQuestions).optional(),
4565
- states: z50.array(z50.strictObject({
4595
+ states: z51.array(z51.strictObject({
4566
4596
  id: identifier21,
4567
4597
  quote,
4568
4598
  question: identifier21,
4569
- wording: z50.record(identifier21, z50.array(wording).min(1).max(8)).optional()
4599
+ wording: z51.record(identifier21, z51.array(wording).min(1).max(8)).optional()
4570
4600
  })).max(packDraftOutputLimits.maxQuestions).optional()
4571
4601
  }).refine((output) => {
4572
4602
  const ids3 = [
@@ -4581,12 +4611,12 @@ var PackDraftOutputSchema = z50.strictObject({
4581
4611
  }, `At most ${packDraftOutputLimits.maxQuestions} asked questions and stated answers together`).refine((output) => {
4582
4612
  return (output.require?.length ?? 0) + (output.prohibit?.length ?? 0) + (output.ask?.length ?? 0) + (output.states?.length ?? 0) > 0;
4583
4613
  }, "An output needs at least one check");
4584
- var PackDraftOutputsSchema = z50.array(PackDraftOutputSchema).min(1).max(packDraftOutputLimits.maxOutputs).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate output");
4614
+ var PackDraftOutputsSchema = z51.array(PackDraftOutputSchema).min(1).max(packDraftOutputLimits.maxOutputs).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate output");
4585
4615
 
4586
4616
  // ../schemas/src/draft-pack-draft-scoring.ts
4587
- import { z as z51 } from "zod";
4588
- var points = z51.number().min(0).max(1e6);
4589
- var PackDraftScoreSchema = z51.strictObject({
4617
+ import { z as z52 } from "zod";
4618
+ var points = z52.number().min(0).max(1e6);
4619
+ var PackDraftScoreSchema = z52.strictObject({
4590
4620
  lt: points.optional(),
4591
4621
  lte: points.optional(),
4592
4622
  gt: points.optional(),
@@ -4605,33 +4635,33 @@ var PackDraftScoreSchema = z51.strictObject({
4605
4635
  context3.addIssue({ code: "custom", message: "eq stands alone" });
4606
4636
  }
4607
4637
  });
4608
- var contribution2 = z51.strictObject({
4638
+ var contribution2 = z52.strictObject({
4609
4639
  id: draftIdentifier,
4610
4640
  points,
4611
4641
  quote: draftQuote,
4612
4642
  when: PackDraftConditionsSchema
4613
4643
  });
4614
- var criterion2 = z51.strictObject({
4644
+ var criterion2 = z52.strictObject({
4615
4645
  id: draftIdentifier,
4616
4646
  meaning: draftQuote,
4617
4647
  activeWhen: PackDraftConditionsSchema.optional(),
4618
- points: z51.array(contribution2).min(1).max(16).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate points id"),
4619
- otherwise: z51.strictObject({ points, quote: draftQuote }).optional()
4648
+ points: z52.array(contribution2).min(1).max(16).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate points id"),
4649
+ otherwise: z52.strictObject({ points, quote: draftQuote }).optional()
4620
4650
  });
4621
- var PackDraftScoringSchema = z51.strictObject({
4622
- scale: z51.union([z51.literal(1), z51.literal(100)]).optional(),
4623
- criteria: z51.array(criterion2).min(1).max(16).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate criterion")
4651
+ var PackDraftScoringSchema = z52.strictObject({
4652
+ scale: z52.union([z52.literal(1), z52.literal(100)]).optional(),
4653
+ criteria: z52.array(criterion2).min(1).max(16).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate criterion")
4624
4654
  });
4625
4655
  var packDraftScoreExpectation = {
4626
- score: z51.number().min(0).optional(),
4627
- points: z51.record(draftIdentifier, z51.number().min(0).nullable()).optional()
4656
+ score: z52.number().min(0).optional(),
4657
+ points: z52.record(draftIdentifier, z52.number().min(0).nullable()).optional()
4628
4658
  };
4629
4659
 
4630
4660
  // ../schemas/src/draft-pack-draft.ts
4631
- import { z as z54 } from "zod";
4661
+ import { z as z55 } from "zod";
4632
4662
 
4633
4663
  // ../schemas/src/draft-pack-draft-coverage.ts
4634
- import { z as z52 } from "zod";
4664
+ import { z as z53 } from "zod";
4635
4665
  var coverageDispositions = ["represented", "needs_review", "unsupported"];
4636
4666
  var coverageTargetKinds = [
4637
4667
  "question",
@@ -4655,16 +4685,16 @@ var coverageFields = [
4655
4685
  "outputChecks",
4656
4686
  "subject"
4657
4687
  ];
4658
- var target = z52.union([
4659
- ...coverageTargetKinds.map((kind) => z52.strictObject({ [kind]: draftIdentifier })),
4660
- z52.strictObject({ field: z52.enum(coverageFields) })
4688
+ var target = z53.union([
4689
+ ...coverageTargetKinds.map((kind) => z53.strictObject({ [kind]: draftIdentifier })),
4690
+ z53.strictObject({ field: z53.enum(coverageFields) })
4661
4691
  ]);
4662
- var entry2 = z52.strictObject({
4692
+ var entry2 = z53.strictObject({
4663
4693
  quote: draftQuote,
4664
- categories: z52.array(z52.enum(authorityPrimitives)).min(1).max(authorityPrimitives.length).refine(hasUniqueValues, "Duplicate category"),
4665
- disposition: z52.enum(coverageDispositions),
4666
- carriedBy: z52.array(target).min(1).max(16).optional(),
4667
- why: z52.string().min(1).max(600).optional()
4694
+ categories: z53.array(z53.enum(authorityPrimitives)).min(1).max(authorityPrimitives.length).refine(hasUniqueValues, "Duplicate category"),
4695
+ disposition: z53.enum(coverageDispositions),
4696
+ carriedBy: z53.array(target).min(1).max(16).optional(),
4697
+ why: z53.string().min(1).max(600).optional()
4668
4698
  }).superRefine((row2, context3) => {
4669
4699
  const isRepresented = row2.disposition === "represented";
4670
4700
  if (isRepresented && row2.carriedBy === void 0) {
@@ -4689,10 +4719,10 @@ var entry2 = z52.strictObject({
4689
4719
  });
4690
4720
  }
4691
4721
  });
4692
- var PackDraftCoverageSchema = z52.array(entry2).min(1).max(128);
4722
+ var PackDraftCoverageSchema = z53.array(entry2).min(1).max(128);
4693
4723
 
4694
4724
  // ../schemas/src/draft-pack-draft-readings.ts
4695
- import { z as z53 } from "zod";
4725
+ import { z as z54 } from "zod";
4696
4726
  var readingCheckLimits = {
4697
4727
  maxPerAnswer: 8,
4698
4728
  maxPerCheck: 96,
@@ -4700,13 +4730,13 @@ var readingCheckLimits = {
4700
4730
  maxCharacters: 2e3,
4701
4731
  maxLabelCharacters: 120
4702
4732
  };
4703
- var PackDraftReadingTestSchema = z53.strictObject({
4733
+ var PackDraftReadingTestSchema = z54.strictObject({
4704
4734
  id: draftIdentifier,
4705
4735
  question: draftIdentifier,
4706
- text: z53.string().trim().min(1).max(readingCheckLimits.maxCharacters),
4736
+ text: z54.string().trim().min(1).max(readingCheckLimits.maxCharacters),
4707
4737
  expect: draftValue
4708
4738
  });
4709
- var PackDraftReadingTestsSchema = z53.array(PackDraftReadingTestSchema).min(1).max(readingCheckLimits.maxKept).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate reading test");
4739
+ var PackDraftReadingTestsSchema = z54.array(PackDraftReadingTestSchema).min(1).max(readingCheckLimits.maxKept).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate reading test");
4710
4740
  function readingTestIssue(row2, questions, path3) {
4711
4741
  const question3 = questions.find((item) => item.key === row2.question);
4712
4742
  if (question3 === void 0 || question3.type !== void 0 || question3.derive !== void 0) {
@@ -4742,18 +4772,18 @@ function readingTestIssues(tests, questions) {
4742
4772
  }
4743
4773
  return issues;
4744
4774
  }
4745
- var variant = z53.strictObject({
4775
+ var variant = z54.strictObject({
4746
4776
  id: draftIdentifier.optional(),
4747
4777
  question: draftIdentifier,
4748
- text: z53.string().trim().min(1).max(readingCheckLimits.maxCharacters),
4778
+ text: z54.string().trim().min(1).max(readingCheckLimits.maxCharacters),
4749
4779
  expect: draftValue.optional(),
4750
- label: z53.string().trim().min(1).max(readingCheckLimits.maxLabelCharacters).optional()
4780
+ label: z54.string().trim().min(1).max(readingCheckLimits.maxLabelCharacters).optional()
4751
4781
  });
4752
- var ReadingCheckRequestSchema = z53.strictObject({
4753
- sourceObjectId: z53.string().min(1).max(200),
4754
- draft: z53.unknown(),
4755
- variants: z53.array(variant).max(readingCheckLimits.maxPerCheck).optional(),
4756
- includeTests: z53.boolean().default(true)
4782
+ var ReadingCheckRequestSchema = z54.strictObject({
4783
+ sourceObjectId: z54.string().min(1).max(200),
4784
+ draft: z54.unknown(),
4785
+ variants: z54.array(variant).max(readingCheckLimits.maxPerCheck).optional(),
4786
+ includeTests: z54.boolean().default(true)
4757
4787
  });
4758
4788
  var readingResults = ["as_expected", "different", "held", "read", "not_read"];
4759
4789
  var readingReasons = [
@@ -4765,36 +4795,36 @@ var readingReasons = [
4765
4795
  "limit_reached",
4766
4796
  "not_answered"
4767
4797
  ];
4768
- var probability = z53.number().min(0).max(1);
4769
- var ReadingOutcomeSchema = z53.strictObject({
4770
- id: z53.string().min(1).max(200),
4771
- origin: z53.enum(["test", "sent"]),
4772
- question: z53.string().min(1).max(200),
4773
- label: z53.string().optional(),
4774
- expect: z53.string().nullable(),
4775
- result: z53.enum(readingResults),
4776
- picked: z53.string().nullable(),
4777
- leaning: z53.string().nullable(),
4798
+ var probability = z54.number().min(0).max(1);
4799
+ var ReadingOutcomeSchema = z54.strictObject({
4800
+ id: z54.string().min(1).max(200),
4801
+ origin: z54.enum(["test", "sent"]),
4802
+ question: z54.string().min(1).max(200),
4803
+ label: z54.string().optional(),
4804
+ expect: z54.string().nullable(),
4805
+ result: z54.enum(readingResults),
4806
+ picked: z54.string().nullable(),
4807
+ leaning: z54.string().nullable(),
4778
4808
  confidence: probability.nullable(),
4779
4809
  bar: probability,
4780
- reason: z53.enum(readingReasons).nullable()
4810
+ reason: z54.enum(readingReasons).nullable()
4781
4811
  });
4782
- var count = z53.number().int().min(0);
4783
- var counts = z53.strictObject({
4812
+ var count = z54.number().int().min(0);
4813
+ var counts = z54.strictObject({
4784
4814
  as_expected: count,
4785
4815
  different: count,
4786
4816
  held: count,
4787
4817
  read: count,
4788
4818
  not_read: count
4789
4819
  });
4790
- var ReadingCheckSchema = z53.strictObject({
4791
- schema: z53.literal("felspar.reading-check/v0"),
4792
- authority: z53.literal("unapproved"),
4793
- jobId: z53.string(),
4794
- status: z53.enum(["clean", "misses", "incomplete"]),
4820
+ var ReadingCheckSchema = z54.strictObject({
4821
+ schema: z54.literal("felspar.reading-check/v0"),
4822
+ authority: z54.literal("unapproved"),
4823
+ jobId: z54.string(),
4824
+ status: z54.enum(["clean", "misses", "incomplete"]),
4795
4825
  counts,
4796
- questions: z53.array(z53.strictObject({ question: z53.string(), bar: probability, counts })),
4797
- readings: z53.array(ReadingOutcomeSchema)
4826
+ questions: z54.array(z54.strictObject({ question: z54.string(), bar: probability, counts })),
4827
+ readings: z54.array(ReadingOutcomeSchema)
4798
4828
  });
4799
4829
 
4800
4830
  // ../schemas/src/draft-pack-draft.ts
@@ -4808,18 +4838,18 @@ var packDraftVersions = [
4808
4838
  "felspar.pack-draft/v1",
4809
4839
  "felspar.pack-draft/v2"
4810
4840
  ];
4811
- var answers = z54.array(z54.strictObject({
4841
+ var answers = z55.array(z55.strictObject({
4812
4842
  value,
4813
4843
  meaning: quote2,
4814
- inclusions: z54.array(quote2).max(8).optional(),
4815
- exclusions: z54.array(quote2).max(8).optional(),
4816
- examples: z54.array(quote2).max(8).optional(),
4817
- edgeCases: z54.array(quote2).max(8).optional(),
4818
- noneOfThese: z54.literal(true).optional()
4844
+ inclusions: z55.array(quote2).max(8).optional(),
4845
+ exclusions: z55.array(quote2).max(8).optional(),
4846
+ examples: z55.array(quote2).max(8).optional(),
4847
+ edgeCases: z55.array(quote2).max(8).optional(),
4848
+ noneOfThese: z55.literal(true).optional()
4819
4849
  })).min(2).max(64).refine((rows) => hasUniqueValues(rows.map((row2) => row2.value)), "Duplicate answer").refine((rows) => rows.filter((row2) => row2.noneOfThese === true).length <= 1, "Only one answer may be noneOfThese");
4820
- var derive = z54.strictObject({
4850
+ var derive = z55.strictObject({
4821
4851
  from: identifier22,
4822
- when: z54.record(value, z54.union([value, z54.array(value).min(2).max(64)])),
4852
+ when: z55.record(value, z55.union([value, z55.array(value).min(2).max(64)])),
4823
4853
  otherwise: value.optional()
4824
4854
  });
4825
4855
  var notDerived = [
@@ -4864,26 +4894,26 @@ function deriveIssues(row2) {
4864
4894
  }
4865
4895
  return issues;
4866
4896
  }
4867
- var evidenceKinds = z54.array(identifier22).min(1).max(8).refine(hasUniqueValues, "Duplicate kind");
4868
- var evidenceAge = z54.number().int().min(1).max(3650);
4869
- var questionEvidence = z54.strictObject({
4897
+ var evidenceKinds = z55.array(identifier22).min(1).max(8).refine(hasUniqueValues, "Duplicate kind");
4898
+ var evidenceAge = z55.number().int().min(1).max(3650);
4899
+ var questionEvidence = z55.strictObject({
4870
4900
  evidenceKinds: evidenceKinds.optional(),
4871
4901
  maxEvidenceAgeDays: evidenceAge.optional(),
4872
4902
  quote: quote2
4873
4903
  }).refine((row2) => row2.evidenceKinds !== void 0 || row2.maxEvidenceAgeDays !== void 0, "Give evidenceKinds, maxEvidenceAgeDays or both");
4874
- var minimumConfidence = z54.number().min(0.5).max(0.99);
4875
- var question2 = z54.strictObject({
4904
+ var minimumConfidence = z55.number().min(0.5).max(0.99);
4905
+ var question2 = z55.strictObject({
4876
4906
  key: identifier22,
4877
4907
  meaning: quote2,
4878
4908
  answers: answers.optional(),
4879
4909
  ...typedQuestionFields,
4880
4910
  askOnlyWhen: conditions.optional(),
4881
- whereToLook: z54.array(quote2).max(8).optional(),
4911
+ whereToLook: z55.array(quote2).max(8).optional(),
4882
4912
  about: identifier22.optional(),
4883
4913
  derive: derive.optional(),
4884
4914
  evidence: questionEvidence.optional(),
4885
4915
  minimumConfidence: minimumConfidence.optional(),
4886
- highConsequence: z54.literal(true).optional()
4916
+ highConsequence: z55.literal(true).optional()
4887
4917
  }).superRefine((row2, context3) => {
4888
4918
  if (row2.type !== void 0 && row2.highConsequence !== void 0) {
4889
4919
  context3.addIssue({
@@ -4906,57 +4936,57 @@ var question2 = z54.strictObject({
4906
4936
  context3.addIssue({ code: "custom", ...issue });
4907
4937
  }
4908
4938
  });
4909
- var shape3 = z54.strictObject({
4910
- schema: z54.enum(packDraftVersions),
4939
+ var shape3 = z55.strictObject({
4940
+ schema: z55.enum(packDraftVersions),
4911
4941
  job: identifier22,
4912
4942
  purpose: quote2.optional(),
4913
- useWhen: z54.array(quote2).min(1).max(8).optional(),
4914
- notFor: z54.array(quote2).min(1).max(8).optional(),
4943
+ useWhen: z55.array(quote2).min(1).max(8).optional(),
4944
+ notFor: z55.array(quote2).min(1).max(8).optional(),
4915
4945
  owner: quote2.optional(),
4916
4946
  evidenceKinds,
4917
4947
  maxEvidenceAgeDays: evidenceAge,
4918
- manualFacts: z54.strictObject({ allowed: z54.literal(false), quote: quote2 }).optional(),
4948
+ manualFacts: z55.strictObject({ allowed: z55.literal(false), quote: quote2 }).optional(),
4919
4949
  ...packConventionFields,
4920
4950
  businessDays: PackDraftBusinessDaysSchema.optional(),
4921
- questions: z54.array(question2).min(1).max(64).refine((rows) => hasUniqueValues(rows.map((row2) => row2.key)), "Duplicate question"),
4951
+ questions: z55.array(question2).min(1).max(64).refine((rows) => hasUniqueValues(rows.map((row2) => row2.key)), "Duplicate question"),
4922
4952
  subjects: PackDraftSubjectsSchema.optional(),
4923
4953
  subject: identifier22.optional(),
4924
4954
  escalations: PackDraftEscalationsSchema.optional(),
4925
- outcomes: z54.array(z54.strictObject({
4955
+ outcomes: z55.array(z55.strictObject({
4926
4956
  id: identifier22,
4927
4957
  nextStep: quote2,
4928
4958
  escalate: identifier22.optional()
4929
4959
  })).min(1).max(64).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate outcome"),
4930
- whenUnresolved: z54.union([quote2, z54.strictObject({ quote: quote2, escalate: identifier22 })]),
4931
- attempts: z54.strictObject({
4932
- max: z54.number().int().min(1).max(10).optional(),
4960
+ whenUnresolved: z55.union([quote2, z55.strictObject({ quote: quote2, escalate: identifier22 })]),
4961
+ attempts: z55.strictObject({
4962
+ max: z55.number().int().min(1).max(10).optional(),
4933
4963
  escalate: identifier22.optional()
4934
4964
  }).optional(),
4935
4965
  scoring: PackDraftScoringSchema.optional(),
4936
- ruleOrder: z54.enum(ruleOrders).optional(),
4937
- rules: z54.array(z54.strictObject({
4966
+ ruleOrder: z55.enum(ruleOrders).optional(),
4967
+ rules: z55.array(z55.strictObject({
4938
4968
  id: identifier22,
4939
4969
  meaning: quote2,
4940
4970
  when: conditions.optional(),
4941
4971
  score: PackDraftScoreSchema.optional(),
4942
- gate: z54.literal(true).optional(),
4972
+ gate: z55.literal(true).optional(),
4943
4973
  outcome: identifier22,
4944
- except: z54.array(identifier22).min(1).max(16).refine(hasUniqueValues, "Duplicate rule").optional()
4974
+ except: z55.array(identifier22).min(1).max(16).refine(hasUniqueValues, "Duplicate rule").optional()
4945
4975
  })).min(1).max(256).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate rule"),
4946
- cases: z54.array(z54.strictObject({
4976
+ cases: z55.array(z55.strictObject({
4947
4977
  id: identifier22,
4948
- why: z54.string().min(1).max(2e3),
4949
- facts: z54.record(identifier22, caseFactSchema),
4978
+ why: z55.string().min(1).max(2e3),
4979
+ facts: z55.record(identifier22, caseFactSchema),
4950
4980
  decisionDate: caseDecisionDate,
4951
- subject: z54.strictObject({ id: SubjectIdSchema }).optional(),
4952
- expect: z54.union([
4953
- z54.strictObject({
4981
+ subject: z55.strictObject({ id: SubjectIdSchema }).optional(),
4982
+ expect: z55.union([
4983
+ z55.strictObject({
4954
4984
  outcome: identifier22,
4955
4985
  rule: identifier22,
4956
4986
  escalation: identifier22.optional(),
4957
4987
  ...packDraftScoreExpectation
4958
4988
  }),
4959
- z54.strictObject({ held: z54.enum(heldStates), ...packDraftScoreExpectation })
4989
+ z55.strictObject({ held: z55.enum(heldStates), ...packDraftScoreExpectation })
4960
4990
  ])
4961
4991
  })).min(1).max(200).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate case"),
4962
4992
  outputChecks: PackDraftOutputsSchema.optional(),
@@ -5019,107 +5049,107 @@ var PackDraftSchema = shape3.superRefine((draft, context3) => {
5019
5049
  });
5020
5050
 
5021
5051
  // ../schemas/src/draft-pack-revision.ts
5022
- var KeptPackDraftSchema = z55.looseObject({
5023
- schema: z55.string().regex(/^felspar\.pack-draft\/v\d{1,3}$/u),
5024
- job: z55.string().min(1).max(200)
5052
+ var KeptPackDraftSchema = z56.looseObject({
5053
+ schema: z56.string().regex(/^felspar\.pack-draft\/v\d{1,3}$/u),
5054
+ job: z56.string().min(1).max(200)
5025
5055
  });
5026
- var id6 = z55.string().min(1).max(200);
5027
- var text7 = z55.string().min(1).max(262144);
5028
- var texts = z55.array(z55.string()).max(8);
5056
+ var id6 = z56.string().min(1).max(200);
5057
+ var text7 = z56.string().min(1).max(262144);
5058
+ var texts = z56.array(z56.string()).max(8);
5029
5059
  var when = PackDraftConditionsSchema;
5030
5060
  var conventions = packConventionFields;
5031
- var PackOutlineSchema = z55.strictObject({
5032
- schema: z55.literal("felspar.pack-outline/v0"),
5061
+ var PackOutlineSchema = z56.strictObject({
5062
+ schema: z56.literal("felspar.pack-outline/v0"),
5033
5063
  job: id6,
5034
5064
  purpose: text7.nullable(),
5035
5065
  useWhen: texts,
5036
5066
  notFor: texts,
5037
5067
  owner: text7.nullable(),
5038
- evidenceKinds: z55.array(id6).max(8),
5039
- maxEvidenceAgeDays: z55.number().int().min(1).nullable(),
5040
- numberStyle: z55.enum(numberStyles).nullable(),
5068
+ evidenceKinds: z56.array(id6).max(8),
5069
+ maxEvidenceAgeDays: z56.number().int().min(1).nullable(),
5070
+ numberStyle: z56.enum(numberStyles).nullable(),
5041
5071
  dateOrder: conventions.dateOrder.unwrap().nullable(),
5042
- timeZone: z55.string().min(1).max(64).nullable(),
5072
+ timeZone: z56.string().min(1).max(64).nullable(),
5043
5073
  businessDays: PackDraftBusinessDaysSchema.nullable(),
5044
5074
  subject: id6.nullable(),
5045
- subjects: z55.array(z55.strictObject({
5075
+ subjects: z56.array(z56.strictObject({
5046
5076
  id: id6,
5047
5077
  definition: text7,
5048
- identifier: z55.string().nullable(),
5049
- example: z55.string().nullable(),
5050
- match: z55.string(),
5051
- relationships: z55.array(z55.strictObject({
5078
+ identifier: z56.string().nullable(),
5079
+ example: z56.string().nullable(),
5080
+ match: z56.string(),
5081
+ relationships: z56.array(z56.strictObject({
5052
5082
  name: id6,
5053
5083
  subject: id6,
5054
- cardinality: z55.enum(["one", "many"]),
5055
- required: z55.boolean(),
5084
+ cardinality: z56.enum(["one", "many"]),
5085
+ required: z56.boolean(),
5056
5086
  definition: text7
5057
5087
  })).max(16),
5058
5088
  identity: PackDraftIdentitySchema.nullable()
5059
5089
  })).max(16),
5060
- escalations: z55.array(z55.strictObject({ id: id6, quote: text7 })).max(16),
5061
- questions: z55.array(z55.strictObject({
5090
+ escalations: z56.array(z56.strictObject({ id: id6, quote: text7 })).max(16),
5091
+ questions: z56.array(z56.strictObject({
5062
5092
  key: id6,
5063
- type: z55.enum(["enum", "boolean", "number", "date"]),
5093
+ type: z56.enum(["enum", "boolean", "number", "date"]),
5064
5094
  meaning: text7,
5065
5095
  about: id6.nullable(),
5066
- askOnlyWhen: z55.string().nullable(),
5096
+ askOnlyWhen: z56.string().nullable(),
5067
5097
  when: when.nullable(),
5068
- unit: z55.string().nullable(),
5069
- unitWords: z55.array(z55.string()).max(16).nullable(),
5070
- integer: z55.boolean().nullable(),
5071
- minimum: z55.number().nullable(),
5072
- maximum: z55.number().nullable(),
5073
- answers: z55.array(z55.strictObject({
5098
+ unit: z56.string().nullable(),
5099
+ unitWords: z56.array(z56.string()).max(16).nullable(),
5100
+ integer: z56.boolean().nullable(),
5101
+ minimum: z56.number().nullable(),
5102
+ maximum: z56.number().nullable(),
5103
+ answers: z56.array(z56.strictObject({
5074
5104
  value: id6,
5075
- meaning: z55.string().nullable(),
5105
+ meaning: z56.string().nullable(),
5076
5106
  inclusions: texts,
5077
5107
  exclusions: texts,
5078
5108
  examples: texts,
5079
5109
  edgeCases: texts
5080
5110
  })).max(64),
5081
5111
  whereToLook: texts,
5082
- evidence: z55.strictObject({
5083
- evidenceKinds: z55.array(id6).max(8).nullable(),
5084
- maxEvidenceAgeDays: z55.number().int().min(1).nullable(),
5112
+ evidence: z56.strictObject({
5113
+ evidenceKinds: z56.array(id6).max(8).nullable(),
5114
+ maxEvidenceAgeDays: z56.number().int().min(1).nullable(),
5085
5115
  quote: text7
5086
5116
  }).nullable(),
5087
- minimumConfidence: z55.number().nullable()
5117
+ minimumConfidence: z56.number().nullable()
5088
5118
  })).max(64),
5089
- outcomes: z55.array(z55.strictObject({ id: id6, nextStep: text7.nullable(), escalate: id6.nullable() })).max(64),
5090
- whenUnresolved: z55.strictObject({ quote: text7, escalate: id6.nullable() }).nullable(),
5091
- attempts: z55.strictObject({ max: z55.number().int(), escalate: id6.nullable() }).nullable(),
5092
- rules: z55.array(z55.strictObject({
5119
+ outcomes: z56.array(z56.strictObject({ id: id6, nextStep: text7.nullable(), escalate: id6.nullable() })).max(64),
5120
+ whenUnresolved: z56.strictObject({ quote: text7, escalate: id6.nullable() }).nullable(),
5121
+ attempts: z56.strictObject({ max: z56.number().int(), escalate: id6.nullable() }).nullable(),
5122
+ rules: z56.array(z56.strictObject({
5093
5123
  id: id6,
5094
5124
  meaning: text7,
5095
5125
  outcome: id6,
5096
5126
  when: when.nullable(),
5097
- conditions: z55.string().nullable(),
5098
- scoreRange: z55.record(z55.string(), z55.unknown()).nullable(),
5127
+ conditions: z56.string().nullable(),
5128
+ scoreRange: z56.record(z56.string(), z56.unknown()).nullable(),
5099
5129
  score: PackDraftScoreSchema.nullable(),
5100
- gate: z55.boolean(),
5101
- except: z55.array(id6).max(16).nullable()
5130
+ gate: z56.boolean(),
5131
+ except: z56.array(id6).max(16).nullable()
5102
5132
  })).max(256),
5103
- ruleOrder: z55.enum(ruleOrders).nullable(),
5133
+ ruleOrder: z56.enum(ruleOrders).nullable(),
5104
5134
  scoring: PackDraftScoringSchema.nullable(),
5105
- cases: z55.array(z55.strictObject({
5135
+ cases: z56.array(z56.strictObject({
5106
5136
  id: id6,
5107
- why: z55.string().nullable(),
5108
- facts: z55.record(id6, caseFactSchema),
5137
+ why: z56.string().nullable(),
5138
+ facts: z56.record(id6, caseFactSchema),
5109
5139
  decisionDate: CalendarDateSchema.nullable(),
5110
- subject: z55.strictObject({ id: id6 }).nullable(),
5111
- expect: z55.union([
5112
- z55.strictObject({ outcome: id6, rule: id6, score: z55.number().nullable() }),
5113
- z55.strictObject({ held: z55.enum(heldStates), score: z55.number().nullable() })
5140
+ subject: z56.strictObject({ id: id6 }).nullable(),
5141
+ expect: z56.union([
5142
+ z56.strictObject({ outcome: id6, rule: id6, score: z56.number().nullable() }),
5143
+ z56.strictObject({ held: z56.enum(heldStates), score: z56.number().nullable() })
5114
5144
  ])
5115
5145
  })).max(200),
5116
5146
  outputChecks: PackDraftOutputsSchema.nullable(),
5117
- manualFacts: z55.strictObject({ allowed: z55.literal(false), quote: z55.string().min(1) }).nullable(),
5118
- notKept: z55.array(z55.strictObject({ path: z55.string().min(1), reason: z55.string().min(1) })).max(64)
5147
+ manualFacts: z56.strictObject({ allowed: z56.literal(false), quote: z56.string().min(1) }).nullable(),
5148
+ notKept: z56.array(z56.strictObject({ path: z56.string().min(1), reason: z56.string().min(1) })).max(64)
5119
5149
  });
5120
5150
 
5121
5151
  // ../schemas/src/draft-bar-calibration.ts
5122
- import { z as z56 } from "zod";
5152
+ import { z as z57 } from "zod";
5123
5153
  var barCalibrationPolicy = {
5124
5154
  lowestBar: 0.8,
5125
5155
  highestBar: 0.99,
@@ -5130,32 +5160,32 @@ var barCalibrationPolicy = {
5130
5160
  };
5131
5161
  var barCalibrationId = "felspar-backtest-bar";
5132
5162
  var barCalibrationVersion = "v1";
5133
- var id7 = z56.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u);
5134
- var digest23 = z56.string().regex(/^sha256:[a-f0-9]{64}$/u);
5135
- var share = z56.number().min(0).max(1);
5136
- var bar = z56.number().min(barCalibrationPolicy.lowestBar).max(barCalibrationPolicy.highestBar);
5137
- var BacktestLabelSchema = z56.strictObject({
5163
+ var id7 = z57.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u);
5164
+ var digest23 = z57.string().regex(/^sha256:[a-f0-9]{64}$/u);
5165
+ var share = z57.number().min(0).max(1);
5166
+ var bar = z57.number().min(barCalibrationPolicy.lowestBar).max(barCalibrationPolicy.highestBar);
5167
+ var BacktestLabelSchema = z57.strictObject({
5138
5168
  executionObjectId: id7,
5139
5169
  question: draftValue,
5140
5170
  answer: draftValue.nullable()
5141
5171
  });
5142
- var BacktestLabelsSchema = z56.array(BacktestLabelSchema).min(1).max(barCalibrationPolicy.maxLabels).refine((rows) => {
5172
+ var BacktestLabelsSchema = z57.array(BacktestLabelSchema).min(1).max(barCalibrationPolicy.maxLabels).refine((rows) => {
5143
5173
  const seen = new Set(rows.map((row2) => JSON.stringify([row2.executionObjectId, row2.question])));
5144
5174
  return seen.size === rows.length;
5145
5175
  }, "Label each question of a case once");
5146
5176
  var calibrationReadings = ["right", "wrong", "held"];
5147
- var caseRow = z56.strictObject({
5177
+ var caseRow = z57.strictObject({
5148
5178
  executionObjectId: id7,
5149
5179
  label: draftValue.nullable(),
5150
5180
  leaning: draftValue.nullable(),
5151
5181
  confidence: share.nullable(),
5152
- atCurrentBar: z56.enum(calibrationReadings),
5153
- atSuggestedBar: z56.enum(calibrationReadings).nullable()
5182
+ atCurrentBar: z57.enum(calibrationReadings),
5183
+ atSuggestedBar: z57.enum(calibrationReadings).nullable()
5154
5184
  });
5155
- var barRow = z56.strictObject({
5185
+ var barRow = z57.strictObject({
5156
5186
  bar,
5157
- decided: z56.number().int().min(0),
5158
- right: z56.number().int().min(0),
5187
+ decided: z57.number().int().min(0),
5188
+ right: z57.number().int().min(0),
5159
5189
  precision: share.nullable(),
5160
5190
  coverage: share
5161
5191
  });
@@ -5165,113 +5195,163 @@ var calibrationStatuses = [
5165
5195
  "coverage_gap",
5166
5196
  "needs_more_evidence_or_rewrite"
5167
5197
  ];
5168
- var QuestionCalibrationSchema = z56.strictObject({
5198
+ var QuestionCalibrationSchema = z57.strictObject({
5169
5199
  question: id7,
5170
- status: z56.enum(calibrationStatuses),
5171
- consequence: z56.enum(["ordinary", "strict"]),
5200
+ status: z57.enum(calibrationStatuses),
5201
+ consequence: z57.enum(["ordinary", "strict"]),
5172
5202
  target: share,
5173
5203
  currentBar: share,
5174
- labeled: z56.number().int().min(0),
5175
- insufficient: z56.number().int().min(0),
5176
- otherAnswers: z56.number().int().min(0),
5177
- notRead: z56.number().int().min(0),
5178
- suggestion: z56.strictObject({
5204
+ labeled: z57.number().int().min(0),
5205
+ insufficient: z57.number().int().min(0),
5206
+ otherAnswers: z57.number().int().min(0),
5207
+ notRead: z57.number().int().min(0),
5208
+ suggestion: z57.strictObject({
5179
5209
  bar,
5180
5210
  precision: share,
5181
5211
  coverage: share,
5182
- calibration: z56.strictObject({
5183
- id: z56.literal(barCalibrationId),
5184
- version: z56.literal(barCalibrationVersion),
5212
+ calibration: z57.strictObject({
5213
+ id: z57.literal(barCalibrationId),
5214
+ version: z57.literal(barCalibrationVersion),
5185
5215
  contentDigest: digest23
5186
5216
  })
5187
5217
  }).optional(),
5188
- bars: z56.array(barRow).max(20),
5189
- cases: z56.array(caseRow).max(50)
5218
+ bars: z57.array(barRow).max(20),
5219
+ cases: z57.array(caseRow).max(50)
5190
5220
  });
5191
- var BacktestCalibrationSchema = z56.strictObject({
5192
- schema: z56.literal("felspar.bar-calibration/v1"),
5221
+ var BacktestCalibrationSchema = z57.strictObject({
5222
+ schema: z57.literal("felspar.bar-calibration/v1"),
5193
5223
  calibrationDigest: digest23,
5194
- minimumCases: z56.number().int().min(1),
5195
- questions: z56.array(QuestionCalibrationSchema).max(64),
5196
- ignoredLabels: z56.number().int().min(0)
5224
+ minimumCases: z57.number().int().min(1),
5225
+ questions: z57.array(QuestionCalibrationSchema).max(64),
5226
+ ignoredLabels: z57.number().int().min(0)
5197
5227
  });
5198
- var AcceptedBarsSchema = z56.strictObject({
5199
- savedResultId: z56.string().regex(/^backtest-[a-f0-9]{32}$/u),
5228
+ var AcceptedBarsSchema = z57.strictObject({
5229
+ savedResultId: z57.string().regex(/^backtest-[a-f0-9]{32}$/u),
5200
5230
  calibrationDigest: digest23,
5201
- questions: z56.array(id7).min(1).max(64)
5231
+ questions: z57.array(id7).min(1).max(64)
5202
5232
  });
5203
5233
  var ReleaseCalibrationSchema = AcceptedBarsSchema.extend({
5204
- acceptedBy: z56.string().min(1).max(200),
5234
+ acceptedBy: z57.string().min(1).max(200),
5205
5235
  approvedMaterialDigest: digest23,
5206
- bars: z56.array(z56.strictObject({ question: id7, bar, calibrationDigest: digest23 })).min(1).max(64)
5236
+ bars: z57.array(z57.strictObject({ question: id7, bar, calibrationDigest: digest23 })).min(1).max(64)
5237
+ });
5238
+
5239
+ // ../schemas/src/draft-pack-environments.ts
5240
+ import { z as z58 } from "zod";
5241
+ var packEnvironments = ["staging", "production"];
5242
+ var PackEnvironmentSchema = z58.enum(packEnvironments);
5243
+ var packEnvironmentMoves = ["release", "stage", "promote", "rollback"];
5244
+ var PackEnvironmentMoveActionSchema = z58.enum(packEnvironmentMoves);
5245
+ var id8 = z58.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u);
5246
+ var digest24 = z58.string().regex(/^sha256:[a-f0-9]{64}$/u);
5247
+ var CandidateBindingSchema = z58.strictObject({
5248
+ candidateSourceObjectId: id8,
5249
+ capturedSourceObjectId: id8,
5250
+ providerRevision: id8,
5251
+ textDigest: digest24
5252
+ });
5253
+ var PackEnvironmentServedSchema = z58.strictObject({
5254
+ environment: PackEnvironmentSchema,
5255
+ releaseId: id8.nullable(),
5256
+ releaseDigest: digest24.nullable(),
5257
+ candidate: z58.boolean(),
5258
+ movedBy: z58.string().nullable(),
5259
+ movedAt: z58.string().nullable()
5260
+ });
5261
+ var PackEnvironmentMoveSchema = z58.strictObject({
5262
+ environment: PackEnvironmentSchema,
5263
+ action: PackEnvironmentMoveActionSchema,
5264
+ fromReleaseId: id8.nullable(),
5265
+ releaseId: id8,
5266
+ principalId: z58.string(),
5267
+ movedAt: z58.string(),
5268
+ binding: CandidateBindingSchema.nullable()
5269
+ });
5270
+ var PackEnvironmentsSchema = z58.strictObject({
5271
+ jobId: id8,
5272
+ staging: PackEnvironmentServedSchema,
5273
+ production: PackEnvironmentServedSchema,
5274
+ moves: z58.array(PackEnvironmentMoveSchema).max(50)
5275
+ });
5276
+ var PromoteInputSchema = z58.strictObject({
5277
+ expectedReleaseId: id8,
5278
+ writeBack: z58.literal(true).optional()
5279
+ });
5280
+ var RollbackInputSchema = z58.strictObject({ releaseId: id8, expectedReleaseId: id8 });
5281
+ var StageReleaseInputSchema = z58.strictObject({ releaseId: id8 });
5282
+ var StageCandidateInputSchema = z58.strictObject({
5283
+ reviewedMeaning: z58.literal(true),
5284
+ reviewedFixtures: z58.literal(true),
5285
+ reviewNote: z58.string().min(1).max(2e3)
5207
5286
  });
5208
5287
 
5209
5288
  // ../schemas/src/draft-hosted-application.ts
5210
- var id8 = z57.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u);
5211
- var digest24 = DraftApplicationReleaseSchema.shape.releaseDigest;
5212
- var HostedSourceInputSchema = z57.strictObject({
5213
- sourceId: id8,
5214
- revision: id8,
5215
- title: z57.string().min(1).max(200),
5216
- text: z57.string().min(1).max(1048576)
5217
- });
5218
- var HostedProposalInputV0Schema = z57.strictObject({
5219
- sourceObjectId: id8,
5220
- expectedSourceDigest: digest24,
5289
+ var id9 = z59.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u);
5290
+ var digest25 = DraftApplicationReleaseSchema.shape.releaseDigest;
5291
+ var HostedSourceInputSchema = z59.strictObject({
5292
+ sourceId: id9,
5293
+ revision: id9,
5294
+ title: z59.string().min(1).max(200),
5295
+ text: z59.string().min(1).max(1048576)
5296
+ });
5297
+ var HostedProposalInputV0Schema = z59.strictObject({
5298
+ sourceObjectId: id9,
5299
+ expectedSourceDigest: digest25,
5221
5300
  material: DraftApplicationJobMaterialSchema,
5222
5301
  compilation: DraftCompilationSchema
5223
5302
  });
5224
- var HostedManualFactsRuleSchema = z57.strictObject({
5225
- allowed: z57.literal(false),
5226
- text: z57.string().min(1).max(4e3),
5227
- sourceLocator: z57.string().min(1).max(4096),
5228
- contentDigest: digest24
5303
+ var HostedManualFactsRuleSchema = z59.strictObject({
5304
+ allowed: z59.literal(false),
5305
+ text: z59.string().min(1).max(4e3),
5306
+ sourceLocator: z59.string().min(1).max(4096),
5307
+ contentDigest: digest25
5229
5308
  });
5230
- var HostedProposalInputV2Schema = z57.strictObject({
5231
- schema: z57.literal("felspar.hosted-proposal.draft/v2"),
5232
- sourceObjectId: id8,
5233
- expectedSourceDigest: digest24,
5309
+ var HostedProposalInputV2Schema = z59.strictObject({
5310
+ schema: z59.literal("felspar.hosted-proposal.draft/v2"),
5311
+ sourceObjectId: id9,
5312
+ expectedSourceDigest: digest25,
5234
5313
  material: DraftApplicationJobMaterialV2Schema,
5235
5314
  outputChecks: HostedOutputChecksSchema.optional(),
5236
5315
  manualFacts: HostedManualFactsRuleSchema.optional(),
5237
5316
  draft: KeptPackDraftSchema.optional()
5238
5317
  });
5239
- var HostedProposalInputSchema = z57.union([
5318
+ var HostedProposalInputSchema = z59.union([
5240
5319
  HostedProposalInputV2Schema,
5241
5320
  HostedProposalInputV0Schema
5242
5321
  ]);
5243
- var HostedApprovalInputSchema = z57.strictObject({
5244
- expectedProposalDigest: digest24,
5245
- reviewedMeaning: z57.literal(true),
5246
- reviewedFixtures: z57.literal(true),
5247
- reviewNote: z57.string().min(1).max(2e3)
5248
- });
5249
- var HostedReleaseInputSchema = z57.strictObject({
5250
- expectedApprovalDigest: digest24,
5251
- acceptBars: AcceptedBarsSchema.optional()
5252
- });
5253
- var HostedReleaseBundleSchema = z57.strictObject({
5322
+ var HostedApprovalInputSchema = z59.strictObject({
5323
+ expectedProposalDigest: digest25,
5324
+ reviewedMeaning: z59.literal(true),
5325
+ reviewedFixtures: z59.literal(true),
5326
+ reviewNote: z59.string().min(1).max(2e3)
5327
+ });
5328
+ var HostedReleaseInputSchema = z59.strictObject({
5329
+ expectedApprovalDigest: digest25,
5330
+ acceptBars: AcceptedBarsSchema.optional(),
5331
+ environment: PackEnvironmentSchema.optional()
5332
+ });
5333
+ var HostedReleaseBundleSchema = z59.strictObject({
5254
5334
  release: DraftApplicationReleaseSchema,
5255
5335
  material: DraftAnyApplicationJobMaterialSchema,
5256
- approvalObjectId: id8,
5257
- approvalDigest: digest24,
5258
- proposalDigest: digest24,
5259
- sourceDigest: digest24,
5336
+ approvalObjectId: id9,
5337
+ approvalDigest: digest25,
5338
+ proposalDigest: digest25,
5339
+ sourceDigest: digest25,
5260
5340
  verifiedCompilation: DraftVerifiedCompilationSchema.optional(),
5261
5341
  calibration: ReleaseCalibrationSchema.optional()
5262
5342
  });
5263
- var HostedJobInputSchema = z57.strictObject({
5264
- executionId: id8,
5265
- expectedReleaseDigest: digest24,
5343
+ var HostedJobInputSchema = z59.strictObject({
5344
+ executionId: id9,
5345
+ expectedReleaseDigest: digest25,
5266
5346
  material: DraftAnyApplicationJobMaterialSchema
5267
5347
  });
5268
- var HostedSuppliedJobInputSchema = z57.strictObject({
5269
- mode: z57.literal("supplied"),
5270
- executionId: id8,
5271
- expectedReleaseDigest: digest24,
5272
- expectedAuthorityDigest: digest24,
5273
- jobId: id8,
5274
- entityId: id8,
5348
+ var HostedSuppliedJobInputSchema = z59.strictObject({
5349
+ mode: z59.literal("supplied"),
5350
+ executionId: id9,
5351
+ expectedReleaseDigest: digest25,
5352
+ expectedAuthorityDigest: digest25,
5353
+ jobId: id9,
5354
+ entityId: id9,
5275
5355
  evidence: DraftRequiredDecisionSchema.shape.evidence,
5276
5356
  passages: DraftLayeredEvaluationSchema.shape.passages.max(256)
5277
5357
  });
@@ -5281,18 +5361,18 @@ var hostedFactsLimits = {
5281
5361
  maxFactsBytes: 524288,
5282
5362
  maxQuestions: 64
5283
5363
  };
5284
- var factSourceId = z57.string().refine(isDraftSourceId, "source_id_invalid").describe(`The source's own ID or address, such as its page URL with any query: RFC 3986 characters, starting with a letter or digit, at most ${draftSourceIdLimit} characters.`);
5285
- var observedAt = z57.string().refine((value2) => normalizedSourceInstant(value2) !== null, "observed_at_invalid").transform((value2) => normalizedSourceInstant(value2) ?? value2).describe(`When the source was read: an RFC 3339 date and time with Z or an offset, such as 2026-10-21T10:00:00Z or 2026-10-21T12:00+02:00, at most ${sourceInstantMaxLength} characters. Stored in UTC.`);
5364
+ var factSourceId = z59.string().refine(isDraftSourceId, "source_id_invalid").describe(`The source's own ID or address, such as its page URL with any query: RFC 3986 characters, starting with a letter or digit, at most ${draftSourceIdLimit} characters.`);
5365
+ var observedAt = z59.string().refine((value2) => normalizedSourceInstant(value2) !== null, "observed_at_invalid").transform((value2) => normalizedSourceInstant(value2) ?? value2).describe(`When the source was read: an RFC 3339 date and time with Z or an offset, such as 2026-10-21T10:00:00Z or 2026-10-21T12:00+02:00, at most ${sourceInstantMaxLength} characters. Stored in UTC.`);
5286
5366
  var sourceFields = {
5287
- class: id8,
5367
+ class: id9,
5288
5368
  id: factSourceId,
5289
- revision: id8.optional(),
5290
- locator: z57.string().min(1).max(4096).optional(),
5369
+ revision: id9.optional(),
5370
+ locator: z59.string().min(1).max(4096).optional(),
5291
5371
  observedAt,
5292
- sensitivity: id8.optional()
5372
+ sensitivity: id9.optional()
5293
5373
  };
5294
5374
  var manualSourcePrefix = "felspar:";
5295
- var suppliedBy = z57.string().trim().min(1).max(200);
5375
+ var suppliedBy = z59.string().trim().min(1).max(200);
5296
5376
  var isReserved = (sourceId2) => sourceId2?.toLowerCase().startsWith(manualSourcePrefix) === true;
5297
5377
  function sourceIssues(source3) {
5298
5378
  if (source3.manual === true) {
@@ -5318,13 +5398,13 @@ function isAdmittedOrdinary(source3) {
5318
5398
  function isAdmitted(source3) {
5319
5399
  return source3.manual === true ? isAdmittedManual(source3) : isAdmittedOrdinary(source3);
5320
5400
  }
5321
- var excerptText = z57.string().min(1).refine((text8) => text8.length <= hostedFactsLimits.maxExcerptCharacters, "text_too_long");
5401
+ var excerptText = z59.string().min(1).refine((text8) => text8.length <= hostedFactsLimits.maxExcerptCharacters, "text_too_long");
5322
5402
  var valueSourceFields = { excerpt: excerptText.optional() };
5323
5403
  var requestSourceFields = {
5324
5404
  ...sourceFields,
5325
5405
  id: factSourceId.optional(),
5326
5406
  observedAt: observedAt.optional(),
5327
- manual: z57.literal(true).optional(),
5407
+ manual: z59.literal(true).optional(),
5328
5408
  suppliedBy: suppliedBy.optional()
5329
5409
  };
5330
5410
  function refusedSourceIssues(source3, context3) {
@@ -5335,34 +5415,34 @@ function refusedSourceIssues(source3, context3) {
5335
5415
  var admittedSourceFields = {
5336
5416
  ...sourceFields,
5337
5417
  id: factSourceId.optional(),
5338
- manual: z57.literal(true).optional(),
5418
+ manual: z59.literal(true).optional(),
5339
5419
  suppliedBy: suppliedBy.optional(),
5340
- by: id8.optional(),
5341
- stamped: z57.literal(true).optional()
5420
+ by: id9.optional(),
5421
+ stamped: z59.literal(true).optional()
5342
5422
  };
5343
- var requestSource = z57.strictObject(requestSourceFields).superRefine(refusedSourceIssues);
5344
- var requestValueSource = z57.strictObject({ ...requestSourceFields, ...valueSourceFields }).superRefine(refusedSourceIssues);
5345
- var admittedSource = z57.strictObject(admittedSourceFields).refine(isAdmitted, "source_not_admitted");
5346
- var admittedValueSource = z57.strictObject({ ...admittedSourceFields, ...valueSourceFields }).refine(isAdmitted, "source_not_admitted");
5347
- var about = z57.string().min(1).max(200).optional();
5423
+ var requestSource = z59.strictObject(requestSourceFields).superRefine(refusedSourceIssues);
5424
+ var requestValueSource = z59.strictObject({ ...requestSourceFields, ...valueSourceFields }).superRefine(refusedSourceIssues);
5425
+ var admittedSource = z59.strictObject(admittedSourceFields).refine(isAdmitted, "source_not_admitted");
5426
+ var admittedValueSource = z59.strictObject({ ...admittedSourceFields, ...valueSourceFields }).refine(isAdmitted, "source_not_admitted");
5427
+ var about = z59.string().min(1).max(200).optional();
5348
5428
  var hostedCaseRecordLimits = {
5349
5429
  maxExcerptsPerQuestion: 30,
5350
5430
  maxExcerpts: hostedFactsLimits.maxQuestions * hostedFactsLimits.maxExcerptsPerQuestion,
5351
5431
  maxAttempts: 12
5352
5432
  };
5353
5433
  function factSchemas(source3, valueSource, isRecord) {
5354
- const excerpt2 = z57.strictObject({ text: excerptText, source: source3, about });
5355
- const valueFact = z57.strictObject({
5356
- value: z57.union([z57.string().min(1).max(200), z57.number(), z57.boolean()]),
5434
+ const excerpt2 = z59.strictObject({ text: excerptText, source: source3, about });
5435
+ const valueFact = z59.strictObject({
5436
+ value: z59.union([z59.string().min(1).max(200), z59.number(), z59.boolean()]),
5357
5437
  source: valueSource,
5358
5438
  about
5359
5439
  });
5360
5440
  const cap = isRecord ? hostedCaseRecordLimits.maxExcerptsPerQuestion : hostedFactsLimits.maxExcerptsPerQuestion;
5361
- const listed = isRecord ? z57.union([excerpt2, valueFact]) : excerpt2;
5362
- const fact = z57.union([
5441
+ const listed = isRecord ? z59.union([excerpt2, valueFact]) : excerpt2;
5442
+ const fact = z59.union([
5363
5443
  valueFact,
5364
5444
  excerpt2,
5365
- z57.array(listed).min(1).refine((excerpts2) => excerpts2.length <= cap, "too_many_excerpts")
5445
+ z59.array(listed).min(1).refine((excerpts2) => excerpts2.length <= cap, "too_many_excerpts")
5366
5446
  ]);
5367
5447
  return { excerpt: excerpt2, valueFact, fact };
5368
5448
  }
@@ -5376,90 +5456,91 @@ function factsBytes(facts) {
5376
5456
  return encoder2.encode(JSON.stringify(facts)).length;
5377
5457
  }
5378
5458
  function questionsOf(fact) {
5379
- return z57.record(id8, fact).refine((facts) => Object.keys(facts).length <= hostedFactsLimits.maxQuestions, "too_many_questions");
5459
+ return z59.record(id9, fact).refine((facts) => Object.keys(facts).length <= hostedFactsLimits.maxQuestions, "too_many_questions");
5380
5460
  }
5381
5461
  function factsOf(fact) {
5382
5462
  return questionsOf(fact).refine((facts) => factsBytes(facts) <= hostedFactsLimits.maxFactsBytes, "request_too_large");
5383
5463
  }
5384
- var HostedFactsJobInputSchema = z57.strictObject({
5385
- mode: z57.literal("facts"),
5386
- executionId: id8,
5387
- expectedReleaseDigest: digest24,
5388
- jobId: id8,
5389
- entityId: id8,
5464
+ var HostedFactsJobInputSchema = z59.strictObject({
5465
+ mode: z59.literal("facts"),
5466
+ executionId: id9,
5467
+ expectedReleaseDigest: digest25,
5468
+ jobId: id9,
5469
+ entityId: id9,
5390
5470
  related: HostedRelatedSubjectsSchema.optional(),
5391
- identity: z57.record(z57.string().min(1).max(128), z57.string().min(1).max(200)).optional(),
5471
+ identity: z59.record(z59.string().min(1).max(128), z59.string().min(1).max(200)).optional(),
5392
5472
  facts: questionsOf(HostedFactSchema)
5393
5473
  });
5394
5474
  var HostedFactsRequestSchema = HostedFactsJobInputSchema.extend({
5395
- entityId: id8.optional(),
5475
+ entityId: id9.optional(),
5396
5476
  facts: factsOf(requestFacts.fact)
5397
5477
  });
5398
- var HostedJobRequestSchema = z57.union([
5478
+ var HostedJobRequestSchema = z59.union([
5399
5479
  HostedJobInputSchema,
5400
5480
  HostedSuppliedJobInputSchema,
5401
5481
  HostedFactsJobInputSchema
5402
5482
  ]);
5403
- var HostedClassificationResultSchema = z57.strictObject({
5404
- key: id8,
5405
- observationId: id8,
5483
+ var HostedClassificationResultSchema = z59.strictObject({
5484
+ key: id9,
5485
+ observationId: id9,
5406
5486
  record: DraftNormalizedEvidenceSchema.shape.normalizations.element,
5407
- reason: z57.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable(),
5408
- cached: z57.boolean()
5487
+ reason: z59.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable(),
5488
+ cached: z59.boolean()
5409
5489
  });
5410
5490
  function retainsFactsExactly(record) {
5411
5491
  const hasFacts = record.facts !== void 0 && record.judgments !== void 0 && record.judgmentsDigest !== void 0;
5412
5492
  return record.schema === "felspar.hosted-supplied-execution/v3" === hasFacts;
5413
5493
  }
5414
- var HostedCaseAttemptSchema = z57.strictObject({
5415
- executionId: id8,
5416
- added: z57.array(z57.string().min(1).max(draftSourceIdLimit + 4200)).max(192),
5417
- considered: z57.boolean()
5494
+ var HostedCaseAttemptSchema = z59.strictObject({
5495
+ executionId: id9,
5496
+ added: z59.array(z59.string().min(1).max(draftSourceIdLimit + 4200)).max(192),
5497
+ considered: z59.boolean()
5418
5498
  });
5419
- var HostedCaseRecordSchema = z57.strictObject({
5420
- rule: z57.literal("whole-case"),
5421
- attempt: z57.number().int().min(1).max(hostedCaseRecordLimits.maxAttempts + 1),
5422
- attempts: z57.array(HostedCaseAttemptSchema).min(1).max(hostedCaseRecordLimits.maxAttempts + 1),
5499
+ var HostedCaseRecordSchema = z59.strictObject({
5500
+ rule: z59.literal("whole-case"),
5501
+ attempt: z59.number().int().min(1).max(hostedCaseRecordLimits.maxAttempts + 1),
5502
+ attempts: z59.array(HostedCaseAttemptSchema).min(1).max(hostedCaseRecordLimits.maxAttempts + 1),
5423
5503
  facts: questionsOf(HostedFactSchema).optional()
5424
5504
  });
5425
- var HostedSuppliedExecutionRecordSchema = z57.strictObject({
5426
- schema: z57.enum([
5505
+ var HostedSuppliedExecutionRecordSchema = z59.strictObject({
5506
+ schema: z59.enum([
5427
5507
  "felspar.hosted-supplied-execution/v1",
5428
5508
  "felspar.hosted-supplied-execution/v2",
5429
5509
  "felspar.hosted-supplied-execution/v3"
5430
5510
  ]),
5431
- release: z57.strictObject({ releaseId: id8, releaseDigest: digest24, materialDigest: digest24 }),
5432
- evaluationTime: z57.iso.datetime(),
5511
+ release: z59.strictObject({ releaseId: id9, releaseDigest: digest25, materialDigest: digest25 }),
5512
+ evaluationTime: z59.iso.datetime(),
5433
5513
  input: HostedSuppliedJobInputSchema,
5434
5514
  facts: HostedFactsJobInputSchema.optional(),
5435
- judgments: z57.array(HostedClassificationResultSchema).max(192).optional(),
5436
- judgmentsDigest: digest24.optional(),
5437
- expansion: z57.literal("agreeing-excerpts").optional(),
5515
+ judgments: z59.array(HostedClassificationResultSchema).max(192).optional(),
5516
+ judgmentsDigest: digest25.optional(),
5517
+ expansion: z59.enum(["agreeing-excerpts", "agreeing-excerpts/v2"]).optional(),
5438
5518
  caseRecord: HostedCaseRecordSchema.optional(),
5439
- job: z57.record(z57.string(), z57.unknown())
5519
+ decisionAttempt: DecisionGraphAttemptSchema.optional(),
5520
+ job: z59.record(z59.string(), z59.unknown())
5440
5521
  }).refine(retainsFactsExactly, "Version 3 records, and only they, retain facts with their judgments").refine((record) => record.caseRecord === void 0 || record.facts !== void 0, {
5441
5522
  message: "Only a facts record keeps a case record"
5442
5523
  });
5443
- var HostedObjectSchema = z57.strictObject({
5444
- id: id8,
5445
- kind: z57.enum(["source", "proposal", "approval", "release", "evidence", "result", "execution"]),
5446
- payloadDigest: digest24,
5447
- objectKey: z57.string().min(1).max(1e3),
5448
- parentId: id8.nullable(),
5449
- status: z57.enum(["active", "released", "revoked"]),
5450
- metadata: z57.record(z57.string(), z57.unknown())
5451
- });
5452
- var HostedJobResultSchema = z57.object({
5453
- status: z57.string(),
5454
- reason: z57.string().nullable(),
5455
- result: z57.object({
5456
- executionId: z57.string(),
5457
- releaseId: id8,
5458
- releaseDigest: digest24,
5459
- outcome: z57.string().nullable(),
5460
- scoring: z57.unknown(),
5461
- context: z57.unknown(),
5462
- receipt: z57.unknown()
5524
+ var HostedObjectSchema = z59.strictObject({
5525
+ id: id9,
5526
+ kind: z59.enum(["source", "proposal", "approval", "release", "evidence", "result", "execution"]),
5527
+ payloadDigest: digest25,
5528
+ objectKey: z59.string().min(1).max(1e3),
5529
+ parentId: id9.nullable(),
5530
+ status: z59.enum(["active", "released", "revoked"]),
5531
+ metadata: z59.record(z59.string(), z59.unknown())
5532
+ });
5533
+ var HostedJobResultSchema = z59.object({
5534
+ status: z59.string(),
5535
+ reason: z59.string().nullable(),
5536
+ result: z59.object({
5537
+ executionId: z59.string(),
5538
+ releaseId: id9,
5539
+ releaseDigest: digest25,
5540
+ outcome: z59.string().nullable(),
5541
+ scoring: z59.unknown(),
5542
+ context: z59.unknown(),
5543
+ receipt: z59.unknown()
5463
5544
  }).loose().nullable()
5464
5545
  });
5465
5546
 
@@ -5491,6 +5572,7 @@ var fixes = {
5491
5572
  job_mismatch: "This release serves a different job. Use the job and release from describe.",
5492
5573
  job_retired: "The workspace owner retired this job. Don't call it again: use the job named in replacement (check it with list_jobs), or, if replacement is null, tell the person the job is retired and stop.",
5493
5574
  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.",
5575
+ case_in_progress: "This case is already being decided. Wait for the first attempt's decision, then resend that attempt unchanged with the same executionId to read it. Send new evidence only after it finishes.",
5494
5576
  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.",
5495
5577
  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.",
5496
5578
  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.",
@@ -5542,6 +5624,16 @@ var fixes = {
5542
5624
  change_request_comment_limit: "This change request has as many comments as it can hold. Continue the discussion on the Felspar web page.",
5543
5625
  change_request_closed: "This change request is already closed.",
5544
5626
  change_request_close_on_web_page: "Withdraw or reject a change request on the Felspar web page; opening the job's change request again replaces your earlier one.",
5627
+ environments_on_web_page: "Releasing to staging, promoting and rolling back are a person's click on the Felspar web page. Read which release each environment serves with read_environments and tell the person.",
5628
+ staging_agent_pinned: "A staging agent follows its jobs and is never pinned. Register it with its jobs on Latest, or register a production agent to pin a release.",
5629
+ nothing_staged: "Nothing is released to staging for this job. An approver releases a proposal or a change request's candidate to staging on the Felspar web page.",
5630
+ environment_release_unavailable: "Only a live release of this job that production has served can be staged or rolled back to. Pick one from the job's environments.",
5631
+ environment_moved: "The environment moved since the page was read: it no longer serves the release you expected. Reload the job's environments and decide again.",
5632
+ promotion_out_of_date: "Production moved after this staged release was proposed, so promoting it would replace newer production meaning. Propose the change again on production's current release, or roll production back on purpose.",
5633
+ document_not_captured: "Felspar has no captured version of this document to compare with the candidate. Add its current version (add_current_version or the Sources page), then promote again.",
5634
+ document_not_updated: "The document's newest captured version doesn't hold exactly the candidate's text. details.missing names the change request's changes still missing by index: edit the document to match, add its current version and promote again.",
5635
+ candidate_needs_promotion: "This proposal was built on a change request's text that the document may not hold, so it is released to staging, never straight to production. Release it to staging, then promote it once the document holds exactly that text.",
5636
+ change_request_not_stageable: "Only an open, up-to-date change request with a revised pack draft, built on production's current release, can be released to staging. Open the change request again on the current release.",
5545
5637
  proposal_draft_invalid: "A proposal's draft must be a valid felspar.pack-draft for the proposal's own job. Propose with propose_pack, which keeps the draft it checked.",
5546
5638
  preview_too_large: "This draft changes more than one preview can show (2,048 item changes or 64 breaking changes). Preview a smaller revision, or split the pack.",
5547
5639
  backtest_allowance_used: "This proposal has used its whole fresh-read allowance, which all its backtests share. Backtest it again without reinterpret: true: the answers already read are reused and nothing new is read.",
@@ -5572,7 +5664,12 @@ var hostedRefusalCodes = Object.freeze(Object.keys(fixes));
5572
5664
  function hostedRefusalFix(code) {
5573
5665
  return Object.hasOwn(fixes, code) ? fixes[code] ?? null : null;
5574
5666
  }
5575
- var retried = /* @__PURE__ */ new Set(["rate_limited", "history_unavailable", "operation_unavailable"]);
5667
+ var retried = /* @__PURE__ */ new Set([
5668
+ "case_in_progress",
5669
+ "rate_limited",
5670
+ "history_unavailable",
5671
+ "operation_unavailable"
5672
+ ]);
5576
5673
  var escalated = /* @__PURE__ */ new Set([
5577
5674
  "unauthenticated",
5578
5675
  "forbidden",
@@ -5594,243 +5691,244 @@ function hostedRefusalRecovery(code) {
5594
5691
  }
5595
5692
 
5596
5693
  // ../schemas/src/draft-hosted-job-description.ts
5597
- import { z as z59 } from "zod";
5694
+ import { z as z61 } from "zod";
5598
5695
 
5599
5696
  // ../schemas/src/draft-hosted-output-guides.ts
5600
- import { z as z58 } from "zod";
5601
- var id9 = z58.string().min(1).max(200);
5602
- var located = z58.strictObject({
5603
- text: z58.string().min(1).max(262144),
5604
- locator: z58.string().min(1).max(4096)
5697
+ import { z as z60 } from "zod";
5698
+ var id10 = z60.string().min(1).max(200);
5699
+ var located = z60.strictObject({
5700
+ text: z60.string().min(1).max(262144),
5701
+ locator: z60.string().min(1).max(4096)
5605
5702
  });
5606
5703
  var hostedOutputGuideLimits = { maxOutputs: 8, maxContext: 8, maxChecks: 64 };
5607
- var HostedOutputGuideSchema = z58.strictObject({
5608
- id: id9,
5704
+ var HostedOutputGuideSchema = z60.strictObject({
5705
+ id: id10,
5609
5706
  what: located,
5610
- maxCharacters: z58.number().int().min(1),
5611
- context: z58.array(located.extend({ id: id9 })).max(hostedOutputGuideLimits.maxContext).optional(),
5612
- checks: z58.array(z58.strictObject({
5613
- check: id9,
5614
- rule: z58.string().nullable(),
5615
- must: z58.string().min(1).max(8e3)
5707
+ maxCharacters: z60.number().int().min(1),
5708
+ context: z60.array(located.extend({ id: id10 })).max(hostedOutputGuideLimits.maxContext).optional(),
5709
+ checks: z60.array(z60.strictObject({
5710
+ check: id10,
5711
+ rule: z60.string().nullable(),
5712
+ must: z60.string().min(1).max(8e3)
5616
5713
  })).max(hostedOutputGuideLimits.maxChecks)
5617
5714
  });
5618
- var HostedOutputGuidesSchema = z58.array(HostedOutputGuideSchema).max(hostedOutputGuideLimits.maxOutputs);
5715
+ var HostedOutputGuidesSchema = z60.array(HostedOutputGuideSchema).max(hostedOutputGuideLimits.maxOutputs);
5619
5716
 
5620
5717
  // ../schemas/src/draft-hosted-job-description.ts
5621
- var id10 = z59.string().min(1).max(200);
5622
- var digest25 = DraftApplicationReleaseSchema.shape.releaseDigest;
5718
+ var id11 = z61.string().min(1).max(200);
5719
+ var digest26 = DraftApplicationReleaseSchema.shape.releaseDigest;
5623
5720
  var { requirements, rules } = DraftRequiredProposalSchema.shape;
5624
- var quotedText = z59.strictObject({
5625
- text: z59.string().min(1).max(262144),
5721
+ var quotedText = z61.strictObject({
5722
+ text: z61.string().min(1).max(262144),
5626
5723
  source: DraftSourceReferenceSchema.omit({ contentDigest: true }).extend({
5627
- locator: z59.string().min(1).max(4096),
5628
- contentDigest: digest25
5724
+ locator: z61.string().min(1).max(4096),
5725
+ contentDigest: digest26
5629
5726
  }),
5630
- parts: z59.array(z59.strictObject({ locator: z59.string().min(1).max(4096), text: z59.string() })).max(16)
5727
+ parts: z61.array(z61.strictObject({ locator: z61.string().min(1).max(4096), text: z61.string() })).max(16)
5631
5728
  });
5632
5729
  var subjectShape = {
5633
- identifier: z59.string().min(1).max(200),
5634
- example: z59.string().min(1).max(200),
5635
- match: z59.enum(subjectMatchRules)
5730
+ identifier: z61.string().min(1).max(200),
5731
+ example: z61.string().min(1).max(200),
5732
+ match: z61.enum(subjectMatchRules)
5636
5733
  };
5637
- var HostedJobSubjectSchema = z59.strictObject({
5638
- type: id10,
5734
+ var HostedJobSubjectSchema = z61.strictObject({
5735
+ type: id11,
5639
5736
  definition: quotedText,
5640
5737
  identifier: subjectShape.identifier.optional(),
5641
5738
  example: subjectShape.example.optional(),
5642
5739
  match: subjectShape.match,
5643
- related: z59.array(z59.strictObject({
5644
- relationship: id10,
5740
+ related: z61.array(z61.strictObject({
5741
+ relationship: id11,
5645
5742
  meaning: quotedText,
5646
- cardinality: z59.enum(relationshipCardinalities),
5647
- required: z59.boolean(),
5648
- subject: id10,
5743
+ cardinality: z61.enum(relationshipCardinalities),
5744
+ required: z61.boolean(),
5745
+ subject: id11,
5649
5746
  definition: quotedText,
5650
5747
  ...subjectShape
5651
5748
  })).max(16),
5652
- send: z59.string().min(1).max(2e4)
5749
+ send: z61.string().min(1).max(2e4)
5653
5750
  });
5654
- var HostedJobEscalationsSchema = z59.strictObject({
5655
- routes: z59.array(z59.strictObject({ id: id10, quote: quotedText })).min(1).max(16),
5656
- unresolved: id10.nullable(),
5657
- attemptLimit: id10.nullable(),
5658
- rule: z59.string().min(1).max(1e3)
5751
+ var HostedJobEscalationsSchema = z61.strictObject({
5752
+ routes: z61.array(z61.strictObject({ id: id11, quote: quotedText })).min(1).max(16),
5753
+ unresolved: id11.nullable(),
5754
+ attemptLimit: id11.nullable(),
5755
+ rule: z61.string().min(1).max(1e3)
5659
5756
  });
5660
- var HostedEscalationSchema = z59.strictObject({
5661
- id: id10,
5662
- trigger: z59.enum(escalationTriggers),
5757
+ var HostedEscalationSchema = z61.strictObject({
5758
+ id: id11,
5759
+ trigger: z61.enum(escalationTriggers),
5663
5760
  why: quotedText
5664
5761
  });
5665
- var HostedJobDescriptionSchema = z59.strictObject({
5666
- schema: z59.literal("felspar.hosted-job-description.draft/v0"),
5667
- job: id10,
5762
+ var HostedJobDescriptionSchema = z61.strictObject({
5763
+ schema: z61.literal("felspar.hosted-job-description.draft/v0"),
5764
+ job: id11,
5668
5765
  purpose: quotedText.optional(),
5669
- useWhen: z59.array(quotedText).max(8).optional(),
5670
- notFor: z59.array(quotedText).max(8).optional(),
5766
+ useWhen: z61.array(quotedText).max(8).optional(),
5767
+ notFor: z61.array(quotedText).max(8).optional(),
5671
5768
  owner: quotedText.optional(),
5672
5769
  subject: HostedJobSubjectSchema.optional(),
5673
- identity: z59.strictObject({
5674
- mode: z59.enum(identityModes),
5675
- send: z59.string().min(1).max(4e3),
5676
- fields: z59.array(z59.strictObject({ name: id10, ...subjectShape })).max(8).optional(),
5677
- question: id10.optional()
5770
+ identity: z61.strictObject({
5771
+ mode: z61.enum(identityModes),
5772
+ send: z61.string().min(1).max(4e3),
5773
+ fields: z61.array(z61.strictObject({ name: id11, ...subjectShape })).max(8).optional(),
5774
+ question: id11.optional()
5678
5775
  }).optional(),
5679
- manualFacts: z59.strictObject({ allowed: z59.literal(false), quote: z59.string().min(1).max(4e3) }).optional(),
5680
- trustDomain: id10,
5681
- release: z59.strictObject({
5682
- releaseId: id10,
5683
- releaseDigest: digest25,
5684
- materialDigest: digest25,
5685
- expectedAuthorityDigest: digest25
5776
+ manualFacts: z61.strictObject({ allowed: z61.literal(false), quote: z61.string().min(1).max(4e3) }).optional(),
5777
+ trustDomain: id11,
5778
+ release: z61.strictObject({
5779
+ releaseId: id11,
5780
+ releaseDigest: digest26,
5781
+ materialDigest: digest26,
5782
+ expectedAuthorityDigest: digest26
5686
5783
  }),
5687
5784
  resolutionPolicy: DraftRequiredProposalSchema.shape.resolutionPolicy,
5688
- questions: z59.array(requirements.element.extend({
5689
- key: id10,
5690
- type: z59.enum(["enum", "boolean", "number", "date"]),
5785
+ questions: z61.array(requirements.element.extend({
5786
+ key: id11,
5787
+ type: z61.enum(["enum", "boolean", "number", "date"]),
5691
5788
  meaning: quotedText,
5692
- answer: z59.strictObject({
5693
- send: z59.enum(["text", "text_or_value"]),
5694
- valueFormat: z59.enum(["number", "calendar-date"]).nullable(),
5695
- interpretation: z59.enum(["classified", "exact_read", "unsupported"]),
5696
- threshold: z59.number().gt(0).max(1).nullable(),
5697
- applies: z59.enum(["always", "conditional"]),
5698
- dependsOn: z59.array(id10).max(32),
5699
- appliesWhen: z59.string().min(1).max(2e3).nullable(),
5789
+ answer: z61.strictObject({
5790
+ send: z61.enum(["text", "text_or_value"]),
5791
+ valueFormat: z61.enum(["number", "calendar-date"]).nullable(),
5792
+ interpretation: z61.enum(["classified", "exact_read", "unsupported"]),
5793
+ threshold: z61.number().gt(0).max(1).nullable(),
5794
+ applies: z61.enum(["always", "conditional"]),
5795
+ dependsOn: z61.array(id11).max(32),
5796
+ appliesWhen: z61.string().min(1).max(2e3).nullable(),
5700
5797
  reading: ExactReaderSchema.optional()
5701
5798
  }),
5702
- answers: z59.array(z59.strictObject({
5703
- value: id10,
5704
- meaning: z59.string().nullable(),
5705
- inclusions: z59.array(z59.string()).max(8),
5706
- exclusions: z59.array(z59.string()).max(8),
5707
- examples: z59.array(z59.string()).max(8),
5708
- edgeCases: z59.array(z59.string()).max(8)
5799
+ answers: z61.array(z61.strictObject({
5800
+ value: id11,
5801
+ meaning: z61.string().nullable(),
5802
+ inclusions: z61.array(z61.string()).max(8),
5803
+ exclusions: z61.array(z61.string()).max(8),
5804
+ examples: z61.array(z61.string()).max(8),
5805
+ edgeCases: z61.array(z61.string()).max(8)
5709
5806
  })).max(64).optional(),
5710
- whereToLook: z59.array(quotedText).max(8).optional(),
5711
- about: z59.strictObject({ relationship: id10, subject: id10 }).optional()
5807
+ whereToLook: z61.array(quotedText).max(8).optional(),
5808
+ about: z61.strictObject({ relationship: id11, subject: id11 }).optional()
5712
5809
  })).max(64),
5713
- rules: z59.array(rules.element.extend({ text: quotedText })).max(256),
5714
- outcomes: z59.array(z59.strictObject({
5715
- id: id10,
5810
+ rules: z61.array(rules.element.extend({ text: quotedText })).max(256),
5811
+ outcomes: z61.array(z61.strictObject({
5812
+ id: id11,
5716
5813
  meaning: quotedText.nullable(),
5717
5814
  nextStep: quotedText.nullable().optional(),
5718
5815
  outputs: HostedOutputGuidesSchema.optional(),
5719
- escalate: id10.optional()
5816
+ escalate: id11.optional()
5720
5817
  })).max(64),
5721
5818
  escalations: HostedJobEscalationsSchema.optional(),
5722
5819
  whenUnresolved: quotedText.nullable().optional(),
5723
- attempts: z59.strictObject({
5724
- max: z59.number().int().min(1).max(10),
5725
- withProgress: z59.number().int().min(1).max(10),
5726
- rule: z59.string().min(1).max(1e3)
5820
+ attempts: z61.strictObject({
5821
+ max: z61.number().int().min(1).max(10),
5822
+ withProgress: z61.number().int().min(1).max(10),
5823
+ rule: z61.string().min(1).max(1e3)
5727
5824
  }).optional(),
5728
- guidance: z59.strictObject({ gather: z59.string().min(1).max(2e3) }),
5729
- input: z59.strictObject({
5730
- jsonSchema: z59.record(z59.string(), z59.unknown()),
5825
+ guidance: z61.strictObject({ gather: z61.string().min(1).max(2e3) }),
5826
+ input: z61.strictObject({
5827
+ jsonSchema: z61.record(z61.string(), z61.unknown()),
5731
5828
  example: HostedFactsJobInputSchema.nullable(),
5732
- exampleNote: z59.string().max(1e3)
5829
+ exampleNote: z61.string().max(1e3)
5733
5830
  }),
5734
- limits: z59.strictObject({
5735
- maxEvidenceItems: z59.number().int().positive(),
5736
- maxPassages: z59.number().int().positive(),
5737
- facts: z59.strictObject({
5738
- maxExcerptCharacters: z59.literal(hostedFactsLimits.maxExcerptCharacters),
5739
- maxExcerptsPerQuestion: z59.literal(hostedFactsLimits.maxExcerptsPerQuestion),
5740
- maxFactsBytes: z59.literal(hostedFactsLimits.maxFactsBytes),
5741
- maxQuestions: z59.literal(hostedFactsLimits.maxQuestions)
5831
+ limits: z61.strictObject({
5832
+ maxEvidenceItems: z61.number().int().positive(),
5833
+ maxPassages: z61.number().int().positive(),
5834
+ facts: z61.strictObject({
5835
+ maxExcerptCharacters: z61.literal(hostedFactsLimits.maxExcerptCharacters),
5836
+ maxExcerptsPerQuestion: z61.literal(hostedFactsLimits.maxExcerptsPerQuestion),
5837
+ maxFactsBytes: z61.literal(hostedFactsLimits.maxFactsBytes),
5838
+ maxQuestions: z61.literal(hostedFactsLimits.maxQuestions)
5742
5839
  })
5743
5840
  })
5744
5841
  });
5745
- var interpretedExcerpt = z59.strictObject({
5746
- id: id10,
5747
- method: z59.enum(["value", "exact_read", "classified"]),
5748
- status: z59.enum(["accepted", "needs_evidence", "not_needed"]),
5749
- value: z59.union([z59.string(), z59.number(), z59.boolean()]).optional(),
5750
- reasons: z59.array(z59.string()),
5751
- classification: z59.strictObject({
5752
- candidate: z59.string().nullable(),
5753
- probability: z59.number().min(0).max(1).nullable(),
5754
- abstention: z59.number().min(0).max(1).nullable(),
5755
- threshold: z59.number().min(0).max(1),
5756
- alternatives: z59.array(z59.strictObject({ value: z59.string(), probability: z59.number() }))
5842
+ var interpretedExcerpt = z61.strictObject({
5843
+ id: id11,
5844
+ method: z61.enum(["value", "exact_read", "classified"]),
5845
+ status: z61.enum(["accepted", "needs_evidence", "not_needed"]),
5846
+ value: z61.union([z61.string(), z61.number(), z61.boolean()]).optional(),
5847
+ reasons: z61.array(z61.string()),
5848
+ classification: z61.strictObject({
5849
+ candidate: z61.string().nullable(),
5850
+ probability: z61.number().min(0).max(1).nullable(),
5851
+ abstention: z61.number().min(0).max(1).nullable(),
5852
+ threshold: z61.number().min(0).max(1),
5853
+ alternatives: z61.array(z61.strictObject({ value: z61.string(), probability: z61.number() }))
5757
5854
  }).optional()
5758
5855
  });
5759
- var ruleSummary = z59.strictObject({ id: id10, outcome: id10, text: quotedText });
5760
- var HostedJobExplanationSchema = z59.strictObject({
5761
- schema: z59.literal("felspar.hosted-job-explanation.draft/v0"),
5762
- decision: z59.strictObject({ status: z59.string().nullable(), reasons: z59.array(z59.string()) }),
5763
- needs: z59.array(z59.strictObject({
5764
- key: id10,
5765
- status: z59.string(),
5766
- reasons: z59.array(z59.string()),
5767
- acceptedSourceClasses: z59.array(z59.string()),
5768
- maxAgeMs: z59.number().int().nonnegative(),
5856
+ var ruleSummary = z61.strictObject({ id: id11, outcome: id11, text: quotedText });
5857
+ var HostedJobExplanationSchema = z61.strictObject({
5858
+ schema: z61.literal("felspar.hosted-job-explanation.draft/v0"),
5859
+ decision: z61.strictObject({ status: z61.string().nullable(), reasons: z61.array(z61.string()) }),
5860
+ needs: z61.array(z61.strictObject({
5861
+ key: id11,
5862
+ status: z61.string(),
5863
+ reasons: z61.array(z61.string()),
5864
+ acceptedSourceClasses: z61.array(z61.string()),
5865
+ maxAgeMs: z61.number().int().nonnegative(),
5769
5866
  requiredWhen: HostedJobDescriptionSchema.shape.questions.element.shape.requiredWhen,
5770
- excerpts: z59.array(interpretedExcerpt).optional()
5867
+ excerpts: z61.array(interpretedExcerpt).optional()
5771
5868
  })),
5772
- why: z59.strictObject({
5773
- rules: z59.array(ruleSummary),
5774
- overrides: z59.array(z59.strictObject({ by: id10, target: id10 })),
5775
- suppressedRuleIds: z59.array(id10),
5776
- evidence: z59.array(z59.record(z59.string(), z59.unknown()))
5869
+ why: z61.strictObject({
5870
+ rules: z61.array(ruleSummary),
5871
+ overrides: z61.array(z61.strictObject({ by: id11, target: id11 })),
5872
+ suppressedRuleIds: z61.array(id11),
5873
+ evidence: z61.array(z61.record(z61.string(), z61.unknown()))
5777
5874
  }).nullable(),
5778
- context: z59.strictObject({ status: z59.string(), reason: z59.string().nullable() }).nullable(),
5779
- reviewNeeds: z59.array(z59.string()),
5780
- evidenceFreshUntil: z59.iso.datetime().nullable()
5875
+ context: z61.strictObject({ status: z61.string(), reason: z61.string().nullable() }).nullable(),
5876
+ reviewNeeds: z61.array(z61.string()),
5877
+ evidenceFreshUntil: z61.iso.datetime().nullable()
5781
5878
  });
5782
- var HostedReceiptVerificationInputSchema = z59.strictObject({
5879
+ var HostedReceiptVerificationInputSchema = z61.strictObject({
5783
5880
  receipt: DraftJobReceiptSchema,
5784
- expectedReceiptDigest: digest25,
5881
+ expectedReceiptDigest: digest26,
5785
5882
  deliveredCapsule: DraftContextVerificationOptionsSchema.shape.deliveredCapsule
5786
5883
  });
5787
- var HostedReceiptVerificationSchema = z59.strictObject({
5788
- authority: z59.literal("unapproved"),
5789
- status: z59.enum(["reproduced", "mismatch"]),
5790
- mismatches: z59.array(z59.string()),
5791
- decided: z59.strictObject({
5792
- jobId: id10,
5793
- entityId: id10,
5794
- releaseId: id10,
5795
- outcome: id10.nullable(),
5796
- case: z59.strictObject({ id: id10, mode: z59.enum(identityModes) }).optional(),
5797
- subject: z59.strictObject({
5798
- type: id10,
5799
- related: z59.array(z59.strictObject({ relationship: id10, subject: id10, id: id10, questions: z59.array(id10).max(64) })).max(256)
5884
+ var HostedReceiptVerificationSchema = z61.strictObject({
5885
+ authority: z61.literal("unapproved"),
5886
+ status: z61.enum(["reproduced", "mismatch"]),
5887
+ mismatches: z61.array(z61.string()),
5888
+ decided: z61.strictObject({
5889
+ jobId: id11,
5890
+ entityId: id11,
5891
+ releaseId: id11,
5892
+ outcome: id11.nullable(),
5893
+ environment: PackEnvironmentSchema.optional(),
5894
+ case: z61.strictObject({ id: id11, mode: z61.enum(identityModes) }).optional(),
5895
+ subject: z61.strictObject({
5896
+ type: id11,
5897
+ related: z61.array(z61.strictObject({ relationship: id11, subject: id11, id: id11, questions: z61.array(id11).max(64) })).max(256)
5800
5898
  }).optional(),
5801
5899
  escalation: HostedEscalationSchema.omit({ why: true }).optional(),
5802
- manualFacts: z59.array(z59.strictObject({
5803
- question: id10,
5804
- excerpt: z59.number().int().min(0).max(hostedCaseRecordLimits.maxExcerptsPerQuestion - 1),
5805
- via: z59.strictObject({
5806
- principal: id10,
5807
- agent: z59.strictObject({ name: z59.string(), accountable: id10 }).nullable()
5900
+ manualFacts: z61.array(z61.strictObject({
5901
+ question: id11,
5902
+ excerpt: z61.number().int().min(0).max(hostedCaseRecordLimits.maxExcerptsPerQuestion - 1),
5903
+ via: z61.strictObject({
5904
+ principal: id11,
5905
+ agent: z61.strictObject({ name: z61.string(), accountable: id11 }).nullable()
5808
5906
  }),
5809
- observedAt: z59.string(),
5810
- stampedByFelspar: z59.boolean(),
5811
- suppliedBy: z59.strictObject({ text: z59.string(), verified: z59.literal(false) }).optional()
5907
+ observedAt: z61.string(),
5908
+ stampedByFelspar: z61.boolean(),
5909
+ suppliedBy: z61.strictObject({ text: z61.string(), verified: z61.literal(false) }).optional()
5812
5910
  })).max(192).optional(),
5813
- caseRecord: z59.strictObject({
5814
- rule: z59.literal("whole-case"),
5815
- attempt: z59.number().int().min(1),
5816
- attempts: z59.array(HostedCaseAttemptSchema).max(hostedCaseRecordLimits.maxAttempts + 1)
5911
+ caseRecord: z61.strictObject({
5912
+ rule: z61.literal("whole-case"),
5913
+ attempt: z61.number().int().min(1),
5914
+ attempts: z61.array(HostedCaseAttemptSchema).max(hostedCaseRecordLimits.maxAttempts + 1)
5817
5915
  }).optional()
5818
5916
  }).optional()
5819
5917
  });
5820
5918
 
5821
5919
  // ../schemas/src/draft-hosted-output-check-record.ts
5822
- import { z as z62 } from "zod";
5920
+ import { z as z64 } from "zod";
5823
5921
 
5824
5922
  // ../schemas/src/draft-artifact-lint.ts
5825
- import { z as z61 } from "zod";
5923
+ import { z as z63 } from "zod";
5826
5924
 
5827
5925
  // ../schemas/src/draft-job-obligations.ts
5828
- import { z as z60 } from "zod";
5829
- var id11 = DraftApplicationScopeSchema.shape.authorityId;
5830
- var digest26 = DraftJobReceiptSchema.shape.receiptDigest;
5926
+ import { z as z62 } from "zod";
5927
+ var id12 = DraftApplicationScopeSchema.shape.authorityId;
5928
+ var digest27 = DraftJobReceiptSchema.shape.receiptDigest;
5831
5929
  var outcome2 = DraftJobObligationsOutcomeSchema;
5832
5930
  var DraftApplicationJobMaterialV3Schema = DraftApplicationJobMaterialV2Schema.extend({
5833
- schema: z60.literal("felspar.application-job-material.draft/v3"),
5931
+ schema: z62.literal("felspar.application-job-material.draft/v3"),
5834
5932
  obligations: DraftJobObligationsSchema
5835
5933
  }).superRefine((value2, context3) => {
5836
5934
  if (context3.issues.length > 0) {
@@ -5858,57 +5956,57 @@ var DraftApplicationJobMaterialV3Schema = DraftApplicationJobMaterialV2Schema.ex
5858
5956
  }
5859
5957
  });
5860
5958
  var HostedProposalInputV3Schema = HostedProposalInputV2Schema.extend({
5861
- schema: z60.literal("felspar.hosted-proposal.draft/v3"),
5959
+ schema: z62.literal("felspar.hosted-proposal.draft/v3"),
5862
5960
  material: DraftApplicationJobMaterialV3Schema
5863
5961
  });
5864
5962
  var jobObligationsReplayRoutes = ["supplied", "evaluated"];
5865
5963
  var replayRoutes = new Set(jobObligationsReplayRoutes);
5866
5964
  var DraftJobObligationsExecutionSchema = DraftAnyJobExecutionSchema.refine((execution) => replayRoutes.has(execution.invocation.route), "Obligations assessments support supplied and evaluated native executions");
5867
- var DraftJobObligationsNativeResultSchema = z60.strictObject({
5868
- authority: z60.literal("unapproved"),
5869
- discovery: z60.record(z60.string(), z60.unknown()),
5870
- executed: z60.record(z60.string(), z60.unknown()),
5965
+ var DraftJobObligationsNativeResultSchema = z62.strictObject({
5966
+ authority: z62.literal("unapproved"),
5967
+ discovery: z62.record(z62.string(), z62.unknown()),
5968
+ executed: z62.record(z62.string(), z62.unknown()),
5871
5969
  receipt: DraftJobReceiptSchema
5872
5970
  });
5873
- var DraftJobObligationsInputSchema = z60.strictObject({
5971
+ var DraftJobObligationsInputSchema = z62.strictObject({
5874
5972
  release: DraftApplicationReleaseSchema,
5875
- material: z60.union([DraftApplicationJobMaterialV3Schema, DraftAnyApplicationJobMaterialSchema]),
5973
+ material: z62.union([DraftApplicationJobMaterialV3Schema, DraftAnyApplicationJobMaterialSchema]),
5876
5974
  execution: DraftJobObligationsExecutionSchema,
5877
- expectedReceiptDigest: digest26,
5975
+ expectedReceiptDigest: digest27,
5878
5976
  job: DraftJobObligationsNativeResultSchema,
5879
5977
  explanation: HostedJobExplanationSchema,
5880
- invocation: DraftJobObligationsScopeSchema.extend({ caseId: id11 })
5978
+ invocation: DraftJobObligationsScopeSchema.extend({ caseId: id12 })
5881
5979
  });
5882
- var requirements2 = z60.strictObject({
5883
- status: z60.enum(["established", "unresolved"]),
5980
+ var requirements2 = z62.strictObject({
5981
+ status: z62.enum(["established", "unresolved"]),
5884
5982
  scope: DraftJobObligationsScopeSchema,
5885
5983
  artifacts: outcome2.shape.artifacts,
5886
5984
  approvals: outcome2.shape.approvals,
5887
- unresolved: z60.array(z60.strictObject({ scopeRef: id11, reasonCodes: z60.array(id11).min(1).max(64) })).max(64)
5985
+ unresolved: z62.array(z62.strictObject({ scopeRef: id12, reasonCodes: z62.array(id12).min(1).max(64) })).max(64)
5888
5986
  });
5889
- var nextReference = z60.discriminatedUnion("kind", [
5890
- z60.strictObject({ kind: z60.literal("evidence_need"), id: id11 }),
5891
- z60.strictObject({ kind: z60.literal("artifact_requirement"), id: id11 }),
5892
- z60.strictObject({ kind: z60.literal("approval_requirement"), id: id11 }),
5893
- z60.strictObject({ kind: z60.literal("unresolved_scope"), scopeRef: id11 })
5987
+ var nextReference = z62.discriminatedUnion("kind", [
5988
+ z62.strictObject({ kind: z62.literal("evidence_need"), id: id12 }),
5989
+ z62.strictObject({ kind: z62.literal("artifact_requirement"), id: id12 }),
5990
+ z62.strictObject({ kind: z62.literal("approval_requirement"), id: id12 }),
5991
+ z62.strictObject({ kind: z62.literal("unresolved_scope"), scopeRef: id12 })
5894
5992
  ]);
5895
- var DraftJobObligationsAssessmentBodySchema = z60.strictObject({
5896
- schema: z60.literal("felspar.job-obligations-assessment.draft/v0"),
5897
- binding: z60.strictObject({
5898
- releaseDigest: digest26,
5899
- materialDigest: digest26,
5900
- nativeReceiptDigest: digest26,
5901
- jobId: id11,
5993
+ var DraftJobObligationsAssessmentBodySchema = z62.strictObject({
5994
+ schema: z62.literal("felspar.job-obligations-assessment.draft/v0"),
5995
+ binding: z62.strictObject({
5996
+ releaseDigest: digest27,
5997
+ materialDigest: digest27,
5998
+ nativeReceiptDigest: digest27,
5999
+ jobId: id12,
5902
6000
  applicationScope: DraftApplicationScopeSchema,
5903
- caseId: id11,
5904
- entityId: id11,
5905
- evaluationTime: z60.iso.datetime({ offset: true }),
5906
- purposeRef: id11,
5907
- useRef: id11.nullable()
6001
+ caseId: id12,
6002
+ entityId: id12,
6003
+ evaluationTime: z62.iso.datetime({ offset: true }),
6004
+ purposeRef: id12,
6005
+ useRef: id12.nullable()
5908
6006
  }),
5909
6007
  requirements: requirements2,
5910
- next: z60.strictObject({
5911
- kind: z60.enum([
6008
+ next: z62.strictObject({
6009
+ kind: z62.enum([
5912
6010
  "stop",
5913
6011
  "review_required",
5914
6012
  "gather_evidence",
@@ -5916,8 +6014,8 @@ var DraftJobObligationsAssessmentBodySchema = z60.strictObject({
5916
6014
  "verify_before_action",
5917
6015
  "return_result"
5918
6016
  ]),
5919
- reasonCodes: z60.array(id11).max(64),
5920
- refs: z60.array(nextReference).max(64)
6017
+ reasonCodes: z62.array(id12).max(64),
6018
+ refs: z62.array(nextReference).max(64)
5921
6019
  })
5922
6020
  });
5923
6021
  function isNextRefDeclared(ref, required) {
@@ -5940,7 +6038,7 @@ function isNextRefDeclared(ref, required) {
5940
6038
  }
5941
6039
  }
5942
6040
  var DraftJobObligationsAssessmentSchema = DraftJobObligationsAssessmentBodySchema.extend({
5943
- assessmentDigest: digest26
6041
+ assessmentDigest: digest27
5944
6042
  }).superRefine((value2, context3) => {
5945
6043
  const { requirements: required } = value2;
5946
6044
  if (required.status === "established" !== (required.unresolved.length === 0) || required.status === "unresolved" && (required.artifacts.length > 0 || required.approvals.length > 0)) {
@@ -5954,48 +6052,48 @@ var DraftJobObligationsAssessmentSchema = DraftJobObligationsAssessmentBodySchem
5954
6052
  });
5955
6053
 
5956
6054
  // ../schemas/src/draft-artifact-lint.ts
5957
- var id12 = DraftApplicationScopeSchema.shape.authorityId;
5958
- var digest27 = DraftJobReceiptSchema.shape.receiptDigest;
6055
+ var id13 = DraftApplicationScopeSchema.shape.authorityId;
6056
+ var digest28 = DraftJobReceiptSchema.shape.receiptDigest;
5959
6057
  var passage3 = ArtifactSpecificationSchema;
5960
- var plainArtifact = z61.strictObject({
5961
- id: id12,
5962
- revision: id12,
5963
- mediaType: z61.literal("text/plain"),
5964
- exportProfile: id12.nullable(),
5965
- content: z61.string().max(artifactLintLimits.maxTotalBytes),
5966
- expectedContentDigest: digest27
5967
- });
5968
- var structuredArtifact = z61.strictObject({
5969
- id: id12,
5970
- revision: id12,
5971
- mediaType: z61.literal("application/vnd.felspar.structured-output+json"),
5972
- exportProfile: id12.nullable(),
6058
+ var plainArtifact = z63.strictObject({
6059
+ id: id13,
6060
+ revision: id13,
6061
+ mediaType: z63.literal("text/plain"),
6062
+ exportProfile: id13.nullable(),
6063
+ content: z63.string().max(artifactLintLimits.maxTotalBytes),
6064
+ expectedContentDigest: digest28
6065
+ });
6066
+ var structuredArtifact = z63.strictObject({
6067
+ id: id13,
6068
+ revision: id13,
6069
+ mediaType: z63.literal("application/vnd.felspar.structured-output+json"),
6070
+ exportProfile: id13.nullable(),
5973
6071
  content: DraftStructuredOutputSchema,
5974
- expectedContentDigest: digest27
6072
+ expectedContentDigest: digest28
5975
6073
  });
5976
- var ArtifactLintArtifactSchema = z61.discriminatedUnion("mediaType", [
6074
+ var ArtifactLintArtifactSchema = z63.discriminatedUnion("mediaType", [
5977
6075
  plainArtifact,
5978
6076
  structuredArtifact
5979
6077
  ]);
5980
- var ArtifactLintDecisionSchema = z61.strictObject({
6078
+ var ArtifactLintDecisionSchema = z63.strictObject({
5981
6079
  inputs: DraftJobObligationsInputSchema,
5982
6080
  assessment: DraftJobObligationsAssessmentSchema,
5983
- expectedAssessmentDigest: digest27
6081
+ expectedAssessmentDigest: digest28
5984
6082
  });
5985
- var ArtifactLintInputSchema = z61.strictObject({
5986
- schema: z61.literal("felspar.lint.draft/v1"),
5987
- requestId: id12,
6083
+ var ArtifactLintInputSchema = z63.strictObject({
6084
+ schema: z63.literal("felspar.lint.draft/v1"),
6085
+ requestId: id13,
5988
6086
  release: DraftApplicationReleaseSchema,
5989
6087
  material: DraftApplicationJobMaterialV3Schema,
5990
6088
  manifest: ArtifactCheckManifestSchema,
5991
- expectedManifestDigest: digest27,
5992
- attachedObligations: z61.strictObject({ expectedObligationsDigest: digest27 }).optional(),
5993
- attachedCase: z61.strictObject({
5994
- decisionReceiptDigest: digest27,
5995
- answers: z61.array(z61.strictObject({ key: id12, value: z61.union([z61.string().min(1).max(200), z61.null()]) })).max(256)
6089
+ expectedManifestDigest: digest28,
6090
+ attachedObligations: z63.strictObject({ expectedObligationsDigest: digest28 }).optional(),
6091
+ attachedCase: z63.strictObject({
6092
+ decisionReceiptDigest: digest28,
6093
+ answers: z63.array(z63.strictObject({ key: id13, value: z63.union([z63.string().min(1).max(200), z63.null()]) })).max(256)
5996
6094
  }).optional(),
5997
- case: z61.strictObject({ caseId: id12, purposeRef: id12, useRef: id12.nullable() }),
5998
- artifactRequirementId: id12.nullable(),
6095
+ case: z63.strictObject({ caseId: id13, purposeRef: id13, useRef: id13.nullable() }),
6096
+ artifactRequirementId: id13.nullable(),
5999
6097
  decision: ArtifactLintDecisionSchema.nullable(),
6000
6098
  artifact: ArtifactLintArtifactSchema
6001
6099
  });
@@ -6008,11 +6106,11 @@ var artifactCheckStatuses = [
6008
6106
  "not_applicable",
6009
6107
  "skipped"
6010
6108
  ];
6011
- var range = z61.strictObject({
6012
- sectionId: id12,
6013
- start: z61.number().int().min(0).max(artifactLintLimits.maxSectionUnits),
6014
- end: z61.number().int().min(1).max(artifactLintLimits.maxSectionUnits),
6015
- offsetUnit: z61.literal("utf16_code_units")
6109
+ var range = z63.strictObject({
6110
+ sectionId: id13,
6111
+ start: z63.number().int().min(0).max(artifactLintLimits.maxSectionUnits),
6112
+ end: z63.number().int().min(1).max(artifactLintLimits.maxSectionUnits),
6113
+ offsetUnit: z63.literal("utf16_code_units")
6016
6114
  });
6017
6115
  var findingCodes = [
6018
6116
  "section_missing",
@@ -6041,161 +6139,318 @@ var findingCodes = [
6041
6139
  "evaluation_budget_exceeded",
6042
6140
  "evaluation_skipped"
6043
6141
  ];
6044
- var ArtifactFindingSchema = z61.strictObject({
6045
- code: z61.enum(findingCodes),
6046
- checkId: id12.nullable(),
6047
- severity: z61.enum(["error", "warning"]),
6142
+ var ArtifactFindingSchema = z63.strictObject({
6143
+ code: z63.enum(findingCodes),
6144
+ checkId: id13.nullable(),
6145
+ severity: z63.enum(["error", "warning"]),
6048
6146
  specification: passage3.nullable(),
6049
6147
  location: range.nullable(),
6050
- insertionAnchor: z61.strictObject({ sectionId: id12.nullable(), at: z61.number().int().min(0) }).nullable(),
6051
- literalIndex: z61.number().int().min(0).max(artifactLintLimits.maxLiterals).nullable()
6052
- });
6053
- var ArtifactCheckObservationSchema = z61.strictObject({
6054
- checkId: id12,
6055
- kind: z61.enum(artifactCheckKinds),
6056
- required: z61.boolean(),
6057
- method: z61.enum(["deterministic", "semantic"]),
6058
- status: z61.enum(artifactCheckStatuses),
6059
- occurrences: z61.number().int().min(0),
6060
- parsedValue: z61.number().nullable(),
6061
- caseValue: z61.number().nullable()
6062
- });
6063
- var ArtifactLintRecordBodySchema = z61.strictObject({
6064
- schema: z61.literal("felspar.lint-record.draft/v1"),
6065
- requestId: id12,
6066
- status: z61.enum(["pass", "revise", "unavailable", "review_required"]),
6067
- caseContext: z61.enum(["bound", "not_required"]),
6068
- binding: z61.strictObject({
6148
+ insertionAnchor: z63.strictObject({ sectionId: id13.nullable(), at: z63.number().int().min(0) }).nullable(),
6149
+ literalIndex: z63.number().int().min(0).max(artifactLintLimits.maxLiterals).nullable()
6150
+ });
6151
+ var ArtifactCheckObservationSchema = z63.strictObject({
6152
+ checkId: id13,
6153
+ kind: z63.enum(artifactCheckKinds),
6154
+ required: z63.boolean(),
6155
+ method: z63.enum(["deterministic", "semantic"]),
6156
+ status: z63.enum(artifactCheckStatuses),
6157
+ occurrences: z63.number().int().min(0),
6158
+ parsedValue: z63.number().nullable(),
6159
+ caseValue: z63.number().nullable()
6160
+ });
6161
+ var ArtifactLintRecordBodySchema = z63.strictObject({
6162
+ schema: z63.literal("felspar.lint-record.draft/v1"),
6163
+ requestId: id13,
6164
+ status: z63.enum(["pass", "revise", "unavailable", "review_required"]),
6165
+ caseContext: z63.enum(["bound", "not_required"]),
6166
+ binding: z63.strictObject({
6069
6167
  scope: DraftApplicationScopeSchema,
6070
- releaseId: id12,
6071
- releaseDigest: digest27,
6072
- materialDigest: digest27,
6073
- obligationsDigest: digest27.optional(),
6074
- caseFactsDigest: digest27.optional(),
6075
- jobId: id12,
6076
- manifestId: id12,
6077
- manifestDigest: digest27,
6078
- contract: z61.strictObject({ id: id12, digest: digest27 }),
6079
- caseId: id12,
6080
- purposeRef: id12,
6081
- useRef: id12.nullable(),
6082
- artifactRequirementId: id12.nullable(),
6083
- decisionReceiptDigest: digest27.nullable(),
6084
- obligationsAssessmentDigest: digest27.nullable()
6168
+ releaseId: id13,
6169
+ releaseDigest: digest28,
6170
+ materialDigest: digest28,
6171
+ obligationsDigest: digest28.optional(),
6172
+ caseFactsDigest: digest28.optional(),
6173
+ jobId: id13,
6174
+ manifestId: id13,
6175
+ manifestDigest: digest28,
6176
+ contract: z63.strictObject({ id: id13, digest: digest28 }),
6177
+ caseId: id13,
6178
+ purposeRef: id13,
6179
+ useRef: id13.nullable(),
6180
+ artifactRequirementId: id13.nullable(),
6181
+ decisionReceiptDigest: digest28.nullable(),
6182
+ obligationsAssessmentDigest: digest28.nullable()
6085
6183
  }),
6086
- artifact: z61.strictObject({
6087
- id: id12,
6088
- revision: id12,
6089
- mediaType: z61.enum(artifactLintMediaTypes),
6090
- exportProfile: id12.nullable(),
6091
- contentDigest: digest27,
6092
- sections: z61.array(z61.strictObject({
6093
- id: id12,
6094
- units: z61.number().int().min(0),
6095
- contentDigest: digest27.nullable()
6184
+ artifact: z63.strictObject({
6185
+ id: id13,
6186
+ revision: id13,
6187
+ mediaType: z63.enum(artifactLintMediaTypes),
6188
+ exportProfile: id13.nullable(),
6189
+ contentDigest: digest28,
6190
+ sections: z63.array(z63.strictObject({
6191
+ id: id13,
6192
+ units: z63.number().int().min(0),
6193
+ contentDigest: digest28.nullable()
6096
6194
  })).max(artifactLintLimits.maxSections)
6097
6195
  }),
6098
- checks: z61.array(ArtifactCheckObservationSchema).max(artifactLintLimits.maxChecks),
6099
- findings: z61.array(ArtifactFindingSchema).max(2048),
6196
+ checks: z63.array(ArtifactCheckObservationSchema).max(artifactLintLimits.maxChecks),
6197
+ findings: z63.array(ArtifactFindingSchema).max(2048),
6100
6198
  semantic: ArtifactSemanticRecordSchema.nullable(),
6101
- coverage: z61.strictObject({
6102
- scope: z61.literal("declared_checks_only"),
6103
- declared: z61.number().int().min(0),
6104
- applicable: z61.number().int().min(0),
6105
- completed: z61.number().int().min(0),
6106
- required: z61.number().int().min(0),
6107
- requiredCompleted: z61.number().int().min(0),
6108
- textAssigned: z61.enum(["complete", "incomplete"]),
6109
- semantic: z61.enum(["not_declared", "complete", "incomplete"]),
6110
- nativeDocumentLayout: z61.literal("not_checked")
6199
+ coverage: z63.strictObject({
6200
+ scope: z63.literal("declared_checks_only"),
6201
+ declared: z63.number().int().min(0),
6202
+ applicable: z63.number().int().min(0),
6203
+ completed: z63.number().int().min(0),
6204
+ required: z63.number().int().min(0),
6205
+ requiredCompleted: z63.number().int().min(0),
6206
+ textAssigned: z63.enum(["complete", "incomplete"]),
6207
+ semantic: z63.enum(["not_declared", "complete", "incomplete"]),
6208
+ nativeDocumentLayout: z63.literal("not_checked")
6111
6209
  }),
6112
- actionAuthorized: z61.literal(false)
6210
+ actionAuthorized: z63.literal(false)
6113
6211
  });
6114
6212
  var ArtifactLintRecordSchema = ArtifactLintRecordBodySchema.extend({
6115
- recordDigest: digest27
6116
- });
6117
- var ArtifactLintReceiptSchema = z61.strictObject({
6118
- schema: z61.literal("felspar.lint-receipt.draft/v1"),
6119
- recordDigest: digest27,
6120
- releaseDigest: digest27,
6121
- manifestDigest: digest27,
6122
- contractDigest: digest27,
6123
- caseId: id12,
6124
- caseContext: z61.enum(["bound", "not_required"]),
6125
- decisionReceiptDigest: digest27.nullable(),
6126
- obligationsAssessmentDigest: digest27.nullable(),
6127
- artifactId: id12,
6128
- artifactRevision: id12,
6129
- artifactDigest: digest27,
6130
- actionAuthorized: z61.literal(false),
6131
- receiptDigest: digest27
6213
+ recordDigest: digest28
6214
+ });
6215
+ var ArtifactLintReceiptSchema = z63.strictObject({
6216
+ schema: z63.literal("felspar.lint-receipt.draft/v1"),
6217
+ recordDigest: digest28,
6218
+ releaseDigest: digest28,
6219
+ manifestDigest: digest28,
6220
+ contractDigest: digest28,
6221
+ caseId: id13,
6222
+ caseContext: z63.enum(["bound", "not_required"]),
6223
+ decisionReceiptDigest: digest28.nullable(),
6224
+ obligationsAssessmentDigest: digest28.nullable(),
6225
+ artifactId: id13,
6226
+ artifactRevision: id13,
6227
+ artifactDigest: digest28,
6228
+ actionAuthorized: z63.literal(false),
6229
+ receiptDigest: digest28
6132
6230
  });
6133
6231
 
6134
6232
  // ../schemas/src/draft-hosted-output-check-record.ts
6135
- var id13 = DraftApplicationScopeSchema.shape.authorityId;
6136
- var digest28 = DraftJobReceiptSchema.shape.receiptDigest;
6137
- var HostedOutputCheckInputSchema = z62.strictObject({
6138
- executionId: id13,
6139
- output: id13.optional(),
6140
- text: z62.string().min(1).max(artifactLintLimits.maxTotalBytes).refine(isWellFormedText, "text_not_well_formed"),
6141
- revision: id13.optional()
6142
- });
6143
- var HostedOutputCheckRecordSchema = z62.strictObject({
6144
- schema: z62.literal("felspar.hosted-output-check/v0"),
6145
- checkId: id13,
6146
- jobId: id13,
6147
- output: id13,
6148
- decision: z62.strictObject({ executionId: id13, outcome: id13, receiptDigest: digest28 }),
6149
- release: z62.strictObject({ releaseId: id13, releaseDigest: digest28 }),
6233
+ var id14 = DraftApplicationScopeSchema.shape.authorityId;
6234
+ var digest29 = DraftJobReceiptSchema.shape.receiptDigest;
6235
+ var HostedOutputCheckInputSchema = z64.strictObject({
6236
+ executionId: id14,
6237
+ output: id14.optional(),
6238
+ text: z64.string().min(1).max(artifactLintLimits.maxTotalBytes).refine(isWellFormedText, "text_not_well_formed"),
6239
+ revision: id14.optional()
6240
+ });
6241
+ var HostedOutputCheckRecordSchema = z64.strictObject({
6242
+ schema: z64.literal("felspar.hosted-output-check/v0"),
6243
+ checkId: id14,
6244
+ jobId: id14,
6245
+ output: id14,
6246
+ decision: z64.strictObject({ executionId: id14, outcome: id14, receiptDigest: digest29 }),
6247
+ release: z64.strictObject({ releaseId: id14, releaseDigest: digest29 }),
6150
6248
  record: ArtifactLintRecordSchema,
6151
6249
  receipt: ArtifactLintReceiptSchema.nullable(),
6152
- evaluation: z62.strictObject({
6153
- modelCalls: z62.number().int().min(0),
6154
- reason: z62.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable()
6250
+ evaluation: z64.strictObject({
6251
+ modelCalls: z64.number().int().min(0),
6252
+ reason: z64.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable()
6155
6253
  })
6156
6254
  });
6157
6255
 
6158
6256
  // src/draft-hosted-client.ts
6159
- import { z as z63 } from "zod";
6160
- var digestText = z63.string().regex(/^sha256:[a-f0-9]{64}$/u);
6161
- var HostedOutputCheckReplySchema = z63.object({
6162
- status: z63.enum(["pass", "revise", "review_required", "unavailable"]),
6163
- checkId: z63.string(),
6164
- output: z63.string(),
6165
- findings: z63.array(z63.record(z63.string(), z63.unknown())),
6166
- receipt: z63.object({ receiptDigest: digestText, artifactDigest: digestText }).loose().nullable(),
6167
- decision: z63.object({ executionId: z63.string(), receiptDigest: digestText }),
6168
- actionAuthorized: z63.literal(false)
6257
+ import { z as z67 } from "zod";
6258
+
6259
+ // ../schemas/src/draft-agent-responses.ts
6260
+ import { z as z65 } from "zod";
6261
+ var digestText = z65.string().regex(/^sha256:[a-f0-9]{64}$/u);
6262
+ var HostedOutputCheckReplySchema = z65.object({
6263
+ status: z65.enum(["pass", "revise", "review_required", "unavailable"]),
6264
+ checkId: z65.string(),
6265
+ output: z65.string(),
6266
+ findings: z65.array(z65.record(z65.string(), z65.unknown())),
6267
+ receipt: z65.object({ receiptDigest: digestText, artifactDigest: digestText }).loose().nullable(),
6268
+ decision: z65.object({ executionId: z65.string(), receiptDigest: digestText }),
6269
+ actionAuthorized: z65.literal(false)
6169
6270
  }).loose();
6170
- var quotedWords = z63.object({ text: z63.string() }).loose();
6171
- var FelsparCaseSchema = z63.object({ id: z63.string().min(1).max(200), mode: z63.enum(identityModes) });
6172
- var FelsparRelatedSchema = z63.object({
6173
- relationship: z63.string(),
6174
- subject: z63.string(),
6175
- id: z63.string(),
6176
- questions: z63.array(z63.string())
6177
- });
6178
- var FelsparResultSubjectSchema = z63.object({
6179
- type: z63.string(),
6180
- id: z63.string(),
6181
- related: z63.array(FelsparRelatedSchema)
6182
- });
6183
- var FelsparEscalationSchema = z63.object({
6184
- id: z63.string().min(1).max(200),
6185
- trigger: z63.enum(escalationTriggers),
6271
+ var quotedWords = z65.object({ text: z65.string() }).loose();
6272
+ var FelsparCaseSchema = z65.object({
6273
+ id: z65.string().min(1).max(200),
6274
+ mode: z65.enum(identityModes)
6275
+ });
6276
+ var FelsparRelatedSchema = z65.object({
6277
+ relationship: z65.string(),
6278
+ subject: z65.string(),
6279
+ id: z65.string(),
6280
+ questions: z65.array(z65.string())
6281
+ });
6282
+ var FelsparResultSubjectSchema = z65.object({
6283
+ type: z65.string(),
6284
+ id: z65.string(),
6285
+ related: z65.array(FelsparRelatedSchema)
6286
+ });
6287
+ var FelsparEscalationSchema = z65.object({
6288
+ id: z65.string().min(1).max(200),
6289
+ trigger: z65.enum(escalationTriggers),
6186
6290
  why: quotedWords
6187
6291
  });
6188
- var FelsparJobResultSchema = HostedJobResultSchema.extend({
6292
+ var AgentExecutedResponseSchema = HostedJobResultSchema.extend({
6189
6293
  result: HostedJobResultSchema.shape.result.unwrap().extend({
6190
6294
  case: FelsparCaseSchema.optional(),
6191
6295
  subject: FelsparResultSubjectSchema.optional(),
6192
6296
  escalation: FelsparEscalationSchema.optional(),
6193
- missing: z63.array(z63.string()).optional()
6297
+ missing: z65.array(z65.string()).optional()
6194
6298
  }).nullable()
6195
6299
  });
6196
- var FelsparJobListSchema = z63.object({
6197
- jobs: z63.array(z63.object({ id: z63.string().min(1).max(200) })).max(256)
6300
+ var AgentMissingRelatedResponseSchema = z65.object({
6301
+ status: z65.literal("gap"),
6302
+ reason: z65.literal("related_subject_missing"),
6303
+ result: AgentExecutedResponseSchema.shape.result.unwrap().pick({
6304
+ executionId: true,
6305
+ releaseId: true,
6306
+ releaseDigest: true,
6307
+ case: true,
6308
+ subject: true,
6309
+ escalation: true
6310
+ }).extend({
6311
+ outcome: z65.null(),
6312
+ receipt: z65.null(),
6313
+ missing: z65.array(z65.string()),
6314
+ explanation: z65.object({
6315
+ needs: z65.array(z65.object({
6316
+ key: z65.string(),
6317
+ status: z65.literal("missing"),
6318
+ reasons: z65.array(z65.string())
6319
+ }))
6320
+ })
6321
+ })
6322
+ });
6323
+ var FelsparJobResultSchema = z65.union([
6324
+ AgentExecutedResponseSchema,
6325
+ AgentMissingRelatedResponseSchema
6326
+ ]);
6327
+ var FelsparJobListSchema = z65.object({
6328
+ jobs: z65.array(z65.object({ id: z65.string().min(1).max(200) })).max(256)
6198
6329
  });
6330
+
6331
+ // ../schemas/src/draft-decision-graph.ts
6332
+ import { z as z66 } from "zod";
6333
+
6334
+ // ../schemas/src/draft-trace-budget.ts
6335
+ var traceGraphLimits = Object.freeze({ nodes: 2048, edges: 4096 });
6336
+
6337
+ // ../schemas/src/draft-decision-graph.ts
6338
+ var digest30 = DraftJobReceiptSchema.shape.receiptDigest;
6339
+ var identity = z66.string().min(1).max(200);
6340
+ var nodeId = z66.string().regex(/^n\d+$/u);
6341
+ var DecisionGraphStateSchema = z66.enum([
6342
+ "declared",
6343
+ "active",
6344
+ "inactive",
6345
+ "blocked",
6346
+ "suppressed"
6347
+ ]);
6348
+ var DecisionGraphTopologySchema = z66.strictObject({
6349
+ nodes: z66.array(z66.strictObject({
6350
+ id: nodeId,
6351
+ kind: z66.enum([
6352
+ "subject",
6353
+ "question",
6354
+ "rule",
6355
+ "selection",
6356
+ "outcome",
6357
+ "unresolved",
6358
+ "attempts",
6359
+ "retry",
6360
+ "escalation",
6361
+ "scoring",
6362
+ "score_criterion"
6363
+ ]),
6364
+ key: identity,
6365
+ lines: z66.array(z66.string().max(16384)).min(1).max(128),
6366
+ state: DecisionGraphStateSchema
6367
+ })).max(traceGraphLimits.nodes),
6368
+ edges: z66.array(z66.strictObject({
6369
+ from: nodeId,
6370
+ to: nodeId,
6371
+ kind: z66.enum([
6372
+ "asks",
6373
+ "depends_on",
6374
+ "considers",
6375
+ "selects",
6376
+ "overrides",
6377
+ "unresolved",
6378
+ "retry",
6379
+ "escalates",
6380
+ "scores"
6381
+ ]),
6382
+ state: DecisionGraphStateSchema
6383
+ })).max(traceGraphLimits.edges)
6384
+ }).superRefine((graph, context3) => {
6385
+ const ids3 = new Set(graph.nodes.map((node) => node.id));
6386
+ const edges = new Set(graph.edges.map(({ from, to, kind }) => JSON.stringify([from, to, kind])));
6387
+ if (ids3.size !== graph.nodes.length || edges.size !== graph.edges.length || graph.edges.some((edge) => !ids3.has(edge.from) || !ids3.has(edge.to))) {
6388
+ context3.addIssue({ code: "custom", message: "Duplicate or dangling graph identity" });
6389
+ }
6390
+ });
6391
+ var pins = {
6392
+ jobId: identity,
6393
+ releaseId: identity,
6394
+ releaseDigest: digest30,
6395
+ materialDigest: digest30
6396
+ };
6397
+ var DecisionGraphSchema = z66.discriminatedUnion("status", [
6398
+ z66.strictObject({
6399
+ schema: z66.literal("felspar.decision-graph/v1"),
6400
+ status: z66.literal("ready"),
6401
+ view: z66.enum(["release", "proposal", "run"]),
6402
+ ...pins,
6403
+ topologyDigest: digest30,
6404
+ graph: DecisionGraphTopologySchema,
6405
+ mermaid: z66.string().max(262144),
6406
+ proposalId: identity.optional(),
6407
+ executionObjectId: identity.optional(),
6408
+ receiptDigest: digest30.nullable(),
6409
+ evaluationTime: z66.iso.datetime().nullable(),
6410
+ attempt: DecisionGraphAttemptSchema.nullable(),
6411
+ dashboardUrl: z66.url().optional()
6412
+ }),
6413
+ z66.strictObject({
6414
+ schema: z66.literal("felspar.decision-graph/v1"),
6415
+ status: z66.literal("unavailable"),
6416
+ reason: z66.enum([
6417
+ "graph_limit_exceeded",
6418
+ "unsupported_material",
6419
+ "history_unavailable",
6420
+ "replay_mismatch"
6421
+ ]),
6422
+ dashboardUrl: z66.url().optional()
6423
+ })
6424
+ ]);
6425
+
6426
+ // src/draft-decision-graph-client.ts
6427
+ function decisionGraphCalls(call) {
6428
+ async function read(kind, id15) {
6429
+ const value2 = encodeURIComponent(HostedObjectSchema.shape.id.parse(id15));
6430
+ const graph = await call(`/v0/${kind}/${value2}/graph`, DecisionGraphSchema);
6431
+ if (graph.status !== "ready") {
6432
+ return graph;
6433
+ }
6434
+ const pins2 = {
6435
+ releases: graph.releaseId,
6436
+ proposals: graph.proposalId,
6437
+ executions: graph.executionObjectId
6438
+ };
6439
+ if (pins2[kind] !== id15) {
6440
+ throw new Error("Graph identity differs");
6441
+ }
6442
+ return graph;
6443
+ }
6444
+ return {
6445
+ getReleaseGraph: async (id15) => await read("releases", id15),
6446
+ getProposalGraph: async (id15) => await read("proposals", id15),
6447
+ getDecisionGraph: async (executionObjectId) => await read("executions", executionObjectId)
6448
+ };
6449
+ }
6450
+
6451
+ // src/draft-hosted-client.ts
6452
+ var FelsparJobResultSchema2 = FelsparJobResultSchema;
6453
+ var FelsparJobListSchema2 = FelsparJobListSchema;
6199
6454
  var hostedPartsContentType = "application/x.felspar-content-parts";
6200
6455
  async function partsBody(value2) {
6201
6456
  const packed = await packContentParts(value2);
@@ -6246,20 +6501,20 @@ ${jobId}`;
6246
6501
  return result;
6247
6502
  };
6248
6503
  }
6249
- var refusalCode = z63.string().regex(/^[a-z][a-z_]{2,63}$/u);
6250
- var fieldPath = z63.array(z63.string().max(256)).max(32);
6251
- var refusalEscalationSchema = z63.object({
6252
- id: z63.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@-]{0,199}$/u),
6253
- trigger: z63.enum(escalationTriggers),
6254
- why: z63.object({ text: z63.string().max(2e4) })
6504
+ var refusalCode = z67.string().regex(/^[a-z][a-z_]{2,63}$/u);
6505
+ var fieldPath = z67.array(z67.string().max(256)).max(32);
6506
+ var refusalEscalationSchema = z67.object({
6507
+ id: z67.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@-]{0,199}$/u),
6508
+ trigger: z67.enum(escalationTriggers),
6509
+ why: z67.object({ text: z67.string().max(2e4) })
6255
6510
  });
6256
- var refusalSchema = z63.object({
6511
+ var refusalSchema = z67.object({
6257
6512
  error: refusalCode,
6258
6513
  path: fieldPath.optional(),
6259
- currentReleaseDigest: z63.string().regex(/^sha256:[a-f0-9]{64}$/u).optional(),
6260
- retryAfterSeconds: z63.number().int().min(1).max(3600).optional(),
6261
- escalation: z63.unknown().optional(),
6262
- issues: z63.array(z63.object({ code: refusalCode, path: fieldPath })).max(64).optional()
6514
+ currentReleaseDigest: z67.string().regex(/^sha256:[a-f0-9]{64}$/u).optional(),
6515
+ retryAfterSeconds: z67.number().int().min(1).max(3600).optional(),
6516
+ escalation: z67.unknown().optional(),
6517
+ issues: z67.array(z67.object({ code: refusalCode, path: fieldPath })).max(64).optional()
6263
6518
  }).transform(({ escalation: named, ...value2 }) => {
6264
6519
  const fix = hostedRefusalFix(value2.error);
6265
6520
  const recovery = hostedRefusalRecovery(value2.error);
@@ -6321,13 +6576,13 @@ function outputCheckCalls(call) {
6321
6576
  function agentCalls(call) {
6322
6577
  const objectId = HostedObjectSchema.shape.id;
6323
6578
  return {
6324
- listJobs: async () => await call("/v0/jobs", FelsparJobListSchema),
6579
+ listJobs: async () => await call("/v0/jobs", FelsparJobListSchema2),
6325
6580
  describeCurrentJob: async (job) => await call(`/v0/jobs/${encodeURIComponent(objectId.parse(job))}/brief`, HostedJobDescriptionSchema),
6326
- resolveJob: async (id14, value2) => {
6581
+ resolveJob: async (id15, value2) => {
6327
6582
  const input = HostedSuppliedJobInputSchema.parse(value2);
6328
- const releaseId = objectId.parse(id14);
6583
+ const releaseId = objectId.parse(id15);
6329
6584
  const path3 = `/v0/releases/${encodeURIComponent(releaseId)}/jobs`;
6330
- return pinnedResult(await call(path3, FelsparJobResultSchema, input), releaseId, input);
6585
+ return pinnedResult(await call(path3, FelsparJobResultSchema2, input), releaseId, input);
6331
6586
  }
6332
6587
  };
6333
6588
  }
@@ -6368,21 +6623,22 @@ function createHostedFelsparClient(configuration) {
6368
6623
  const objectId = HostedObjectSchema.shape.id;
6369
6624
  const describe = jobDescriber(async (releaseId, jobId) => await call(describePath(releaseId, jobId), HostedJobDescriptionSchema));
6370
6625
  return {
6626
+ ...decisionGraphCalls(call),
6371
6627
  submitSource: async (value2) => await call("/v0/sources", HostedObjectSchema, HostedSourceInputSchema.parse(value2)),
6372
6628
  submitProposal: async (value2) => await call("/v0/proposals", HostedObjectSchema, HostedProposalInputSchema.parse(value2)),
6373
- approveProposal: async (id14, value2) => await call(`/v0/proposals/${encodeURIComponent(objectId.parse(id14))}/approve`, HostedObjectSchema, HostedApprovalInputSchema.parse(value2)),
6374
- releasePack: async (id14, value2) => await call(`/v0/approvals/${encodeURIComponent(objectId.parse(id14))}/release`, DraftApplicationReleaseSchema, HostedReleaseInputSchema.parse(value2)),
6375
- loadRelease: async (id14) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id14))}`, HostedReleaseBundleSchema),
6376
- describeJob: async (id14, job) => await describe(objectId.parse(id14), objectId.parse(job)),
6629
+ approveProposal: async (id15, value2) => await call(`/v0/proposals/${encodeURIComponent(objectId.parse(id15))}/approve`, HostedObjectSchema, HostedApprovalInputSchema.parse(value2)),
6630
+ releasePack: async (id15, value2) => await call(`/v0/approvals/${encodeURIComponent(objectId.parse(id15))}/release`, DraftApplicationReleaseSchema, HostedReleaseInputSchema.parse(value2)),
6631
+ loadRelease: async (id15) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id15))}`, HostedReleaseBundleSchema),
6632
+ describeJob: async (id15, job) => await describe(objectId.parse(id15), objectId.parse(job)),
6377
6633
  verifyReceipt: async (executionObjectId, value2) => await call(`/v0/executions/${encodeURIComponent(objectId.parse(executionObjectId))}/verify`, HostedReceiptVerificationSchema, HostedReceiptVerificationInputSchema.parse(value2)),
6378
6634
  ...outputCheckCalls(call),
6379
- executeJob: async (id14, value2) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id14))}/jobs`, HostedJobResultSchema, HostedJobInputSchema.parse(value2)),
6635
+ executeJob: async (id15, value2) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id15))}/jobs`, HostedJobResultSchema, HostedJobInputSchema.parse(value2)),
6380
6636
  ...agentCalls(call),
6381
- resolveFacts: async (id14, value2) => {
6382
- const releaseId = objectId.parse(id14);
6637
+ resolveFacts: async (id15, value2) => {
6638
+ const releaseId = objectId.parse(id15);
6383
6639
  const input = await factsRequest(value2, async (jobId) => await describe(releaseId, jobId));
6384
6640
  const path3 = `/v0/releases/${encodeURIComponent(releaseId)}/jobs`;
6385
- return pinnedResult(await call(path3, FelsparJobResultSchema, input), releaseId, input);
6641
+ return pinnedResult(await call(path3, FelsparJobResultSchema2, input), releaseId, input);
6386
6642
  }
6387
6643
  };
6388
6644
  }