@felspar/sdk 0.4.0 → 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.
- package/README.md +15 -1
- package/dist/chunks/{chunk-MIPPJBXB.js → chunk-4E64YLWE.js} +1982 -953
- package/dist/chunks/{chunk-ZHMUQJT2.js → chunk-FXW4IBGD.js} +1 -1
- package/dist/chunks/{chunk-FVPYJVF5.js → chunk-L2EHENY4.js} +1 -1
- package/dist/draft-action-gate-claude.js +2 -2
- package/dist/draft-action-gate-eve.js +3 -3
- package/dist/draft-action-gate-openai.js +2 -2
- package/dist/draft-action-gate.js +2 -2
- package/dist/draft-hosted-client.js +1 -1
- package/dist/eve.js +3 -3
- package/dist/types/draft-decision-graph-client.d.ts +143 -0
- package/dist/types/draft-hosted-client.d.ts +343 -67
- package/package.json +1 -1
|
@@ -51,26 +51,26 @@ function append(token, state, bytes = utf8Bytes(token)) {
|
|
|
51
51
|
state.parts.push(state.buffer);
|
|
52
52
|
state.buffer = "";
|
|
53
53
|
}
|
|
54
|
-
function quoted(
|
|
55
|
-
if (
|
|
54
|
+
function quoted(value2) {
|
|
55
|
+
if (value2.length > canonicalJsonLimits.maxBytes) {
|
|
56
56
|
throw new RangeError("Canonical JSON string exceeds the byte limit");
|
|
57
57
|
}
|
|
58
|
-
if (/[\uD800-\uDFFF]/u.test(
|
|
58
|
+
if (/[\uD800-\uDFFF]/u.test(value2)) {
|
|
59
59
|
throw new TypeError("Canonical JSON requires valid Unicode strings");
|
|
60
60
|
}
|
|
61
|
-
return JSON.stringify(
|
|
61
|
+
return JSON.stringify(value2);
|
|
62
62
|
}
|
|
63
|
-
function appendQuoted(
|
|
64
|
-
let
|
|
65
|
-
if (!
|
|
66
|
-
const token = quoted(
|
|
67
|
-
|
|
68
|
-
if (state.strings.size < 256 && state.stringBytes +
|
|
69
|
-
state.strings.set(
|
|
70
|
-
state.stringBytes +=
|
|
63
|
+
function appendQuoted(value2, state) {
|
|
64
|
+
let entry3 = state.strings.get(value2);
|
|
65
|
+
if (!entry3) {
|
|
66
|
+
const token = quoted(value2);
|
|
67
|
+
entry3 = { token, bytes: utf8Bytes(token) };
|
|
68
|
+
if (state.strings.size < 256 && state.stringBytes + entry3.bytes <= 65536) {
|
|
69
|
+
state.strings.set(value2, entry3);
|
|
70
|
+
state.stringBytes += entry3.bytes;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
append(
|
|
73
|
+
append(entry3.token, state, entry3.bytes);
|
|
74
74
|
}
|
|
75
75
|
function dataValue(input, key3) {
|
|
76
76
|
const descriptor = Object.getOwnPropertyDescriptor(input, key3);
|
|
@@ -131,13 +131,13 @@ function writeObject(input, state, depth) {
|
|
|
131
131
|
}
|
|
132
132
|
append("}", state);
|
|
133
133
|
}
|
|
134
|
-
function writeSealed(
|
|
135
|
-
state.nodes +=
|
|
136
|
-
if (depth +
|
|
134
|
+
function writeSealed(entry3, state, depth) {
|
|
135
|
+
state.nodes += entry3.nodes - 1;
|
|
136
|
+
if (depth + entry3.height > canonicalJsonLimits.maxDepth || state.nodes > canonicalJsonLimits.maxNodes) {
|
|
137
137
|
throw new RangeError("Canonical JSON exceeds the depth or node limit");
|
|
138
138
|
}
|
|
139
|
-
state.height = Math.max(state.height, depth +
|
|
140
|
-
append(
|
|
139
|
+
state.height = Math.max(state.height, depth + entry3.height);
|
|
140
|
+
append(entry3.json, state, entry3.bytes);
|
|
141
141
|
}
|
|
142
142
|
function writeContainer(input, state, depth) {
|
|
143
143
|
const sealed = sealedEntries.get(input);
|
|
@@ -266,12 +266,12 @@ function sealValue(input, depth, state) {
|
|
|
266
266
|
throw new RangeError("Canonical JSON exceeds the depth, node or byte limit");
|
|
267
267
|
}
|
|
268
268
|
Object.freeze(input);
|
|
269
|
-
const
|
|
269
|
+
const entry3 = { json, bytes, nodes, height };
|
|
270
270
|
sealedContainers.add(input);
|
|
271
271
|
if (bytes >= sealedEntryMinimumBytes) {
|
|
272
|
-
sealedEntries.set(input,
|
|
272
|
+
sealedEntries.set(input, entry3);
|
|
273
273
|
}
|
|
274
|
-
return
|
|
274
|
+
return entry3;
|
|
275
275
|
}
|
|
276
276
|
function sealCanonicalJson(input) {
|
|
277
277
|
sealValue(input, 0, { ancestors: /* @__PURE__ */ new Set() });
|
|
@@ -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(
|
|
320
|
-
return { [draftContentPartReferenceKey]:
|
|
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";
|
|
@@ -326,12 +326,12 @@ function admit(logical, depth) {
|
|
|
326
326
|
throw new RangeError(logicalLimit);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
function scalar(
|
|
330
|
-
if (
|
|
329
|
+
function scalar(value2) {
|
|
330
|
+
if (value2 === void 0 || typeof value2 === "function" || typeof value2 === "symbol") {
|
|
331
331
|
throw new TypeError("Content parts require JSON values");
|
|
332
332
|
}
|
|
333
|
-
const bytes = utf8(JSON.stringify(
|
|
334
|
-
return { value, tokenBytes: bytes, logical: { bytes, nodes: 1, height: 0 } };
|
|
333
|
+
const bytes = utf8(JSON.stringify(value2));
|
|
334
|
+
return { value: value2, tokenBytes: bytes, logical: { bytes, nodes: 1, height: 0 } };
|
|
335
335
|
}
|
|
336
336
|
function combine(keys, children) {
|
|
337
337
|
let tokenBytes = 2 + Math.max(children.length - 1, 0);
|
|
@@ -350,8 +350,8 @@ function combine(keys, children) {
|
|
|
350
350
|
}
|
|
351
351
|
var hydratedValues = /* @__PURE__ */ new WeakSet();
|
|
352
352
|
var knownSplits = /* @__PURE__ */ new WeakMap();
|
|
353
|
-
function isImmutable(
|
|
354
|
-
return hydratedValues.has(
|
|
353
|
+
function isImmutable(value2) {
|
|
354
|
+
return hydratedValues.has(value2) || isCanonicalJsonSealed(value2);
|
|
355
355
|
}
|
|
356
356
|
function entriesOf(input) {
|
|
357
357
|
const isArray = Array.isArray(input);
|
|
@@ -397,7 +397,7 @@ function measure(input, state, depth) {
|
|
|
397
397
|
throw new RangeError(logicalLimit);
|
|
398
398
|
}
|
|
399
399
|
const entries2 = entriesOf(input);
|
|
400
|
-
const children = entries2.map(([,
|
|
400
|
+
const children = entries2.map(([, value2]) => measure(value2, state, depth + 1));
|
|
401
401
|
const keys = Array.isArray(input) ? null : entries2.map(([key3]) => key3);
|
|
402
402
|
const { tokenBytes: tokenBytes2, logical } = combine(keys, children);
|
|
403
403
|
const isPart = tokenBytes2 >= contentPartsLimits.minPartBytes;
|
|
@@ -419,19 +419,19 @@ function storedForm(input, state) {
|
|
|
419
419
|
if (known) {
|
|
420
420
|
return known.value;
|
|
421
421
|
}
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
424
|
-
return reference(
|
|
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) {
|
|
428
428
|
throw new Error("Content parts lost a measured container");
|
|
429
429
|
}
|
|
430
|
-
return rebuild(input, node.entries, node.entries.map(([,
|
|
430
|
+
return rebuild(input, node.entries, node.entries.map(([, value2]) => storedForm(value2, state)));
|
|
431
431
|
}
|
|
432
|
-
function remember(node,
|
|
432
|
+
function remember(node, value2, tokenBytes) {
|
|
433
433
|
if (isImmutable(node.input)) {
|
|
434
|
-
knownSplits.set(node.input, { value, tokenBytes, logical: node.logical });
|
|
434
|
+
knownSplits.set(node.input, { value: value2, tokenBytes, logical: node.logical });
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
function isCanonicalDocumentSized(logical) {
|
|
@@ -446,7 +446,7 @@ function freezeMeasured(state) {
|
|
|
446
446
|
hydratedValues.add(node.input);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
async function splitRoot(
|
|
449
|
+
async function splitRoot(value2, isCollecting, isFreezing = false) {
|
|
450
450
|
const state = {
|
|
451
451
|
isCollecting,
|
|
452
452
|
measured: /* @__PURE__ */ new Map(),
|
|
@@ -454,26 +454,26 @@ async function splitRoot(value, isCollecting, isFreezing = false) {
|
|
|
454
454
|
digests: /* @__PURE__ */ new Map(),
|
|
455
455
|
parts: /* @__PURE__ */ new Map()
|
|
456
456
|
};
|
|
457
|
-
const root = measure(
|
|
457
|
+
const root = measure(value2, state, 0);
|
|
458
458
|
if (isFreezing) {
|
|
459
459
|
freezeMeasured(state);
|
|
460
460
|
}
|
|
461
461
|
for (const node of state.order) {
|
|
462
462
|
const token = canonicalizeJson(storedForm(node.input, state));
|
|
463
|
-
const
|
|
464
|
-
state.digests.set(node.input,
|
|
465
|
-
state.parts.set(
|
|
466
|
-
remember(node, reference(
|
|
467
|
-
}
|
|
468
|
-
const stored = storedForm(
|
|
469
|
-
if (
|
|
470
|
-
const node = state.measured.get(
|
|
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
|
+
}
|
|
468
|
+
const stored = storedForm(value2, state);
|
|
469
|
+
if (value2 !== null && typeof value2 === "object") {
|
|
470
|
+
const node = state.measured.get(value2);
|
|
471
471
|
if (node && !node.isPart) {
|
|
472
472
|
remember(node, stored, node.tokenBytes);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
const
|
|
476
|
-
return { state, root: { ...root, value: stored }, digest:
|
|
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;
|
|
@@ -483,8 +483,8 @@ function admitStored(parts, bytes) {
|
|
|
483
483
|
throw new RangeError("Content parts exceed the stored part or byte limit");
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
async function packContentParts(
|
|
487
|
-
const { state, root, digest:
|
|
486
|
+
async function packContentParts(value2) {
|
|
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(value) {
|
|
|
495
495
|
const storedBytes = utf8(text8);
|
|
496
496
|
admitStored(parts.length, storedBytes);
|
|
497
497
|
return {
|
|
498
|
-
digest:
|
|
498
|
+
digest: digest31,
|
|
499
499
|
text: text8,
|
|
500
500
|
parts: parts.length,
|
|
501
501
|
storedBytes,
|
|
@@ -524,12 +524,12 @@ import { z as z5 } from "zod";
|
|
|
524
524
|
|
|
525
525
|
// ../schemas/src/draft-calendar-date.ts
|
|
526
526
|
import { z as z2 } from "zod";
|
|
527
|
-
var CalendarDateSchema = z2.string().regex(/^(?!0000)\d{4}-\d{2}-\d{2}$/u).refine((
|
|
528
|
-
const instant2 = /* @__PURE__ */ new Date(`${
|
|
529
|
-
return Number.isFinite(instant2.getTime()) && instant2.toISOString().slice(0, 10) ===
|
|
527
|
+
var CalendarDateSchema = z2.string().regex(/^(?!0000)\d{4}-\d{2}-\d{2}$/u).refine((value2) => {
|
|
528
|
+
const instant2 = /* @__PURE__ */ new Date(`${value2}T00:00:00.000Z`);
|
|
529
|
+
return Number.isFinite(instant2.getTime()) && instant2.toISOString().slice(0, 10) === value2;
|
|
530
530
|
}, "Expected a real Gregorian calendar date in years 0001\u20139999");
|
|
531
|
-
function calendarDay(
|
|
532
|
-
return Date.parse(`${
|
|
531
|
+
function calendarDay(value2) {
|
|
532
|
+
return Date.parse(`${value2}T00:00:00.000Z`) / 864e5;
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
// ../schemas/src/draft-evidence-scope.ts
|
|
@@ -537,8 +537,8 @@ import { z as z3 } from "zod";
|
|
|
537
537
|
var identifier = z3.string().min(1).max(256).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@-]*$/u);
|
|
538
538
|
var draftSourceIdLimit = 2048;
|
|
539
539
|
var draftSourceIdPattern = /^[a-zA-Z0-9](?:[a-zA-Z0-9\-._~:/?#[\]@!$&'()*+,;=]|%[0-9a-fA-F]{2})*$/u;
|
|
540
|
-
function isDraftSourceId(
|
|
541
|
-
return
|
|
540
|
+
function isDraftSourceId(value2) {
|
|
541
|
+
return value2.length <= draftSourceIdLimit && draftSourceIdPattern.test(value2);
|
|
542
542
|
}
|
|
543
543
|
var sourceId = z3.string().min(1).max(draftSourceIdLimit).regex(draftSourceIdPattern);
|
|
544
544
|
var reference2 = z3.strictObject({
|
|
@@ -630,8 +630,8 @@ var businessCalendar = z5.strictObject({
|
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
632
|
if (calendar.holidays.some((day) => {
|
|
633
|
-
const
|
|
634
|
-
return
|
|
633
|
+
const value2 = calendarDay(day);
|
|
634
|
+
return value2 < calendarDay(calendar.validFrom) || value2 > calendarDay(calendar.validThrough);
|
|
635
635
|
})) {
|
|
636
636
|
context3.addIssue({ code: "custom", message: "Holiday outside declared calendar coverage" });
|
|
637
637
|
}
|
|
@@ -691,20 +691,20 @@ function unique(values, context3, path3) {
|
|
|
691
691
|
function checkAuthority(authority, context3) {
|
|
692
692
|
unique(authority.definition.allowedValues, context3, ["definition", "allowedValues"]);
|
|
693
693
|
unique(authority.allowedOutcomes, context3, ["allowedOutcomes"]);
|
|
694
|
-
unique(authority.rules.map((
|
|
694
|
+
unique(authority.rules.map((entry3) => entry3.id), context3, ["rules"]);
|
|
695
695
|
const values = new Set(authority.definition.allowedValues);
|
|
696
696
|
const outcomes = new Set(authority.allowedOutcomes);
|
|
697
|
-
for (const [index,
|
|
697
|
+
for (const [index, entry3] of authority.rules.entries()) {
|
|
698
698
|
const at = ["rules", index];
|
|
699
|
-
requireBinding(
|
|
699
|
+
requireBinding(entry3.when.key === authority.definition.key, context3, {
|
|
700
700
|
path: [...at, "when", "key"],
|
|
701
701
|
message: unknownDefinition
|
|
702
702
|
});
|
|
703
|
-
requireBinding(values.has(
|
|
703
|
+
requireBinding(values.has(entry3.when.equals), context3, {
|
|
704
704
|
path: [...at, "when", "equals"],
|
|
705
705
|
message: "Unknown definition value"
|
|
706
706
|
});
|
|
707
|
-
requireBinding(outcomes.has(
|
|
707
|
+
requireBinding(outcomes.has(entry3.outcome), context3, {
|
|
708
708
|
path: [...at, "outcome"],
|
|
709
709
|
message: "Unknown outcome"
|
|
710
710
|
});
|
|
@@ -769,15 +769,15 @@ var admission = z8.strictObject({
|
|
|
769
769
|
trustDomain: identifier5,
|
|
770
770
|
status: z8.enum(["approved", "revoked"])
|
|
771
771
|
});
|
|
772
|
-
function draftEvidenceReferenceKey(
|
|
773
|
-
return JSON.stringify([draftPassageKey(
|
|
772
|
+
function draftEvidenceReferenceKey(value2) {
|
|
773
|
+
return JSON.stringify([draftPassageKey(value2), value2.contentDigest]);
|
|
774
774
|
}
|
|
775
|
-
function draftAdmissionKey(
|
|
775
|
+
function draftAdmissionKey(value2) {
|
|
776
776
|
return JSON.stringify([
|
|
777
|
-
draftEvidenceReferenceKey(
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
777
|
+
draftEvidenceReferenceKey(value2.reference),
|
|
778
|
+
value2.purpose,
|
|
779
|
+
value2.sensitivity,
|
|
780
|
+
value2.trustDomain
|
|
781
781
|
]);
|
|
782
782
|
}
|
|
783
783
|
function requireCoverage({ expected: expected2, actual, path: path3 }, context3) {
|
|
@@ -909,9 +909,9 @@ import { z as z12 } from "zod";
|
|
|
909
909
|
|
|
910
910
|
// ../schemas/src/draft-decision-date.ts
|
|
911
911
|
import { z as z11 } from "zod";
|
|
912
|
-
function isTimeZone(
|
|
912
|
+
function isTimeZone(value2) {
|
|
913
913
|
try {
|
|
914
|
-
const format = new Intl.DateTimeFormat("en-US", { timeZone:
|
|
914
|
+
const format = new Intl.DateTimeFormat("en-US", { timeZone: value2 });
|
|
915
915
|
const options = format.resolvedOptions();
|
|
916
916
|
return options.timeZone.length > 0;
|
|
917
917
|
} catch {
|
|
@@ -992,22 +992,22 @@ function interval(clause, definition3) {
|
|
|
992
992
|
if (!bounds) {
|
|
993
993
|
return null;
|
|
994
994
|
}
|
|
995
|
-
const { minimum, maximum, operator, value } = bounds;
|
|
995
|
+
const { minimum, maximum, operator, value: value2 } = bounds;
|
|
996
996
|
return {
|
|
997
|
-
low: operator === "lt" || operator === "lte" ? minimum : Math.max(minimum,
|
|
998
|
-
high: operator === "gt" || operator === "gte" ? maximum : Math.min(maximum,
|
|
999
|
-
lowClosed: operator !== "gt" || minimum >
|
|
1000
|
-
highClosed: operator !== "lt" || maximum <
|
|
997
|
+
low: operator === "lt" || operator === "lte" ? minimum : Math.max(minimum, value2),
|
|
998
|
+
high: operator === "gt" || operator === "gte" ? maximum : Math.min(maximum, value2),
|
|
999
|
+
lowClosed: operator !== "gt" || minimum > value2,
|
|
1000
|
+
highClosed: operator !== "lt" || maximum < value2
|
|
1001
1001
|
};
|
|
1002
1002
|
}
|
|
1003
|
-
function nextNumber(
|
|
1004
|
-
if (
|
|
1003
|
+
function nextNumber(value2) {
|
|
1004
|
+
if (value2 === 0) {
|
|
1005
1005
|
return Number.MIN_VALUE;
|
|
1006
1006
|
}
|
|
1007
1007
|
const view = new DataView(new ArrayBuffer(8));
|
|
1008
|
-
view.setFloat64(0,
|
|
1008
|
+
view.setFloat64(0, value2);
|
|
1009
1009
|
const bits = view.getBigUint64(0);
|
|
1010
|
-
view.setBigUint64(0,
|
|
1010
|
+
view.setBigUint64(0, value2 > 0 ? bits + 1n : bits - 1n);
|
|
1011
1011
|
return view.getFloat64(0);
|
|
1012
1012
|
}
|
|
1013
1013
|
function isNonempty(range2, isInteger) {
|
|
@@ -1046,7 +1046,7 @@ function isConditionSupported(clause, definition3, definitions) {
|
|
|
1046
1046
|
return clause.key !== clause.compareFact.key && areCompatibleFacts(definition3, definitions?.get(clause.compareFact.key));
|
|
1047
1047
|
}
|
|
1048
1048
|
if ("allowedValues" in definition3) {
|
|
1049
|
-
return "oneOf" in clause ? clause.oneOf.every((
|
|
1049
|
+
return "oneOf" in clause ? clause.oneOf.every((value2) => definition3.allowedValues.includes(value2)) : "equals" in clause && typeof clause.equals === "string" && definition3.allowedValues.includes(clause.equals);
|
|
1050
1050
|
}
|
|
1051
1051
|
if (definition3.valueRule.type === "boolean") {
|
|
1052
1052
|
return "equals" in clause && typeof clause.equals === "boolean";
|
|
@@ -1066,7 +1066,7 @@ function relativeConditionsOverlap(left, right) {
|
|
|
1066
1066
|
const { operator: b, ...rightOffset } = right.relativeDate;
|
|
1067
1067
|
if (JSON.stringify(leftOffset) === JSON.stringify(rightOffset)) {
|
|
1068
1068
|
const signs = { eq: [0], lt: [-1], lte: [-1, 0], gt: [1], gte: [0, 1] };
|
|
1069
|
-
return signs[a].some((
|
|
1069
|
+
return signs[a].some((value2) => signs[b].includes(value2));
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
1072
1072
|
return null;
|
|
@@ -1127,12 +1127,12 @@ function areConditionsOverlapping(left, right, definition3) {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
if ("compareFact" in left && "compareFact" in right && left.compareFact.key === right.compareFact.key) {
|
|
1129
1129
|
const signs = { eq: [0], lt: [-1], lte: [-1, 0], gt: [1], gte: [0, 1] };
|
|
1130
|
-
return signs[left.compareFact.operator].some((
|
|
1130
|
+
return signs[left.compareFact.operator].some((value2) => signs[right.compareFact.operator].includes(value2));
|
|
1131
1131
|
}
|
|
1132
1132
|
const leftValues = optionsOf(left);
|
|
1133
1133
|
const rightValues = optionsOf(right);
|
|
1134
1134
|
if (leftValues && rightValues) {
|
|
1135
|
-
return leftValues.some((
|
|
1135
|
+
return leftValues.some((value2) => rightValues.includes(value2));
|
|
1136
1136
|
}
|
|
1137
1137
|
const a = interval(left, definition3);
|
|
1138
1138
|
const b = interval(right, definition3);
|
|
@@ -1286,7 +1286,7 @@ function isGuardImplied(guard, clause) {
|
|
|
1286
1286
|
const allowed = choiceValues(guard);
|
|
1287
1287
|
const values = choiceValues(clause);
|
|
1288
1288
|
const isSameKey = clause.key === guard.key;
|
|
1289
|
-
return isSameKey && values.length > 0 && values.every((
|
|
1289
|
+
return isSameKey && values.length > 0 && values.every((value2) => allowed.includes(value2));
|
|
1290
1290
|
}
|
|
1291
1291
|
function isPolicyValid(proposal, context3) {
|
|
1292
1292
|
const clauses2 = [
|
|
@@ -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((
|
|
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((
|
|
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;
|
|
@@ -1569,6 +1569,8 @@ function areScoredRulesDisjoint(proposal, left, right) {
|
|
|
1569
1569
|
|
|
1570
1570
|
// ../schemas/src/draft-required-decision.ts
|
|
1571
1571
|
var typedResolutionPolicy = "strict-required-types/direct-overrides/v2";
|
|
1572
|
+
var valueAgreementOutcomeRegions = "outcome-regions";
|
|
1573
|
+
var freshnessStaleBeforeReview = "stale-before-review";
|
|
1572
1574
|
var identifier8 = DraftEvidenceScopeSchema.shape.entityId;
|
|
1573
1575
|
var duplicateIdentity = "Duplicate identity";
|
|
1574
1576
|
var uniqueIds = z15.array(identifier8).max(64).refine(hasUniqueValues, duplicateIdentity);
|
|
@@ -1611,7 +1613,9 @@ var shape = z15.strictObject({
|
|
|
1611
1613
|
}),
|
|
1612
1614
|
scope: z15.strictObject({
|
|
1613
1615
|
entityId: identifier8,
|
|
1614
|
-
evaluationTime: DraftObservationChecksSchema.shape.evaluationTime
|
|
1616
|
+
evaluationTime: DraftObservationChecksSchema.shape.evaluationTime,
|
|
1617
|
+
valueAgreement: z15.literal(valueAgreementOutcomeRegions).optional(),
|
|
1618
|
+
freshness: z15.literal(freshnessStaleBeforeReview).optional()
|
|
1615
1619
|
}),
|
|
1616
1620
|
evidence: z15.array(DraftEvidenceValidationSchema).max(64)
|
|
1617
1621
|
});
|
|
@@ -1631,23 +1635,44 @@ function draftRulePriority(ranked) {
|
|
|
1631
1635
|
function hasDraftRulePrecedence(winner, other) {
|
|
1632
1636
|
return winner.overrides.includes(other.id) || draftRulePriority(winner) > draftRulePriority(other);
|
|
1633
1637
|
}
|
|
1638
|
+
function overlappingRulePairs(proposal) {
|
|
1639
|
+
const { rules: rules2, requirements: requirements3 } = proposal;
|
|
1640
|
+
const definitions = new Map(requirements3.map((item) => [item.definition.key, item.definition]));
|
|
1641
|
+
const pairs = [];
|
|
1642
|
+
for (const [index, item] of rules2.entries()) {
|
|
1643
|
+
const later = rules2.slice(index + 1);
|
|
1644
|
+
for (const [offset, other] of later.entries()) {
|
|
1645
|
+
if (item.outcome !== other.outcome && !areScoredRulesDisjoint(proposal, item, other) && hasOverlap(item, other, definitions)) {
|
|
1646
|
+
pairs.push([index, index + offset + 1]);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
return pairs;
|
|
1651
|
+
}
|
|
1652
|
+
function contradictoryRulePairs(proposal) {
|
|
1653
|
+
const { rules: rules2 } = proposal;
|
|
1654
|
+
return overlappingRulePairs(proposal).filter(([left, right]) => {
|
|
1655
|
+
const [item, other] = [rules2[left], rules2[right]];
|
|
1656
|
+
return item !== void 0 && other !== void 0 && !hasDraftRulePrecedence(item, other) && !hasDraftRulePrecedence(other, item);
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1634
1659
|
function hasCycle(rules2) {
|
|
1635
1660
|
const graph = new Map(rules2.map((item) => [item.id, item.overrides]));
|
|
1636
1661
|
const visiting = /* @__PURE__ */ new Set();
|
|
1637
1662
|
const visited = /* @__PURE__ */ new Set();
|
|
1638
|
-
const hasPathCycle = (
|
|
1639
|
-
if (visiting.has(
|
|
1663
|
+
const hasPathCycle = (id15) => {
|
|
1664
|
+
if (visiting.has(id15)) {
|
|
1640
1665
|
return true;
|
|
1641
1666
|
}
|
|
1642
|
-
if (visited.has(
|
|
1667
|
+
if (visited.has(id15)) {
|
|
1643
1668
|
return false;
|
|
1644
1669
|
}
|
|
1645
|
-
visiting.add(
|
|
1646
|
-
if ((graph.get(
|
|
1670
|
+
visiting.add(id15);
|
|
1671
|
+
if ((graph.get(id15) ?? []).some(hasPathCycle)) {
|
|
1647
1672
|
return true;
|
|
1648
1673
|
}
|
|
1649
|
-
visiting.delete(
|
|
1650
|
-
visited.add(
|
|
1674
|
+
visiting.delete(id15);
|
|
1675
|
+
visited.add(id15);
|
|
1651
1676
|
return false;
|
|
1652
1677
|
};
|
|
1653
1678
|
return rules2.some((item) => hasPathCycle(item.id));
|
|
@@ -1656,7 +1681,7 @@ function inspectRules(proposal, context3) {
|
|
|
1656
1681
|
const { rules: rules2, requirements: requirements3, allowedOutcomes } = proposal;
|
|
1657
1682
|
const definitions = new Map(requirements3.map((item) => [item.definition.key, item.definition]));
|
|
1658
1683
|
const ids3 = new Set(rules2.map((item) => item.id));
|
|
1659
|
-
const byId = new Map(rules2.map((
|
|
1684
|
+
const byId = new Map(rules2.map((entry3) => [entry3.id, entry3]));
|
|
1660
1685
|
for (const [index, item] of rules2.entries()) {
|
|
1661
1686
|
const fail = (message) => {
|
|
1662
1687
|
context3.addIssue({
|
|
@@ -1676,22 +1701,22 @@ function inspectRules(proposal, context3) {
|
|
|
1676
1701
|
fail("Undeclared condition key or value");
|
|
1677
1702
|
}
|
|
1678
1703
|
}
|
|
1679
|
-
if (item.overrides.some((
|
|
1704
|
+
if (item.overrides.some((id15) => id15 === item.id || !ids3.has(id15))) {
|
|
1680
1705
|
fail("Unknown or self override");
|
|
1681
1706
|
}
|
|
1682
|
-
if (item.overrides.some((
|
|
1683
|
-
const
|
|
1684
|
-
return
|
|
1707
|
+
if (item.overrides.some((id15) => {
|
|
1708
|
+
const target2 = byId.get(id15);
|
|
1709
|
+
return target2 !== void 0 && draftRulePriority(target2) > draftRulePriority(item);
|
|
1685
1710
|
})) {
|
|
1686
1711
|
fail("Override points to a higher priority tier");
|
|
1687
1712
|
}
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
}
|
|
1713
|
+
}
|
|
1714
|
+
for (const [index] of contradictoryRulePairs(proposal)) {
|
|
1715
|
+
context3.addIssue({
|
|
1716
|
+
code: "custom",
|
|
1717
|
+
path: ["rules", index],
|
|
1718
|
+
message: "Overlapping contradictory rules require a direct override"
|
|
1719
|
+
});
|
|
1695
1720
|
}
|
|
1696
1721
|
if (hasCycle(rules2)) {
|
|
1697
1722
|
context3.addIssue({ code: "custom", path: ["rules"], message: "Override cycle" });
|
|
@@ -1817,26 +1842,26 @@ function unique2(values, context3, path3) {
|
|
|
1817
1842
|
}
|
|
1818
1843
|
function checkObservations(candidate2, context3) {
|
|
1819
1844
|
const { authority, observations } = candidate2;
|
|
1820
|
-
unique2(observations.map((
|
|
1821
|
-
for (const [index,
|
|
1845
|
+
unique2(observations.map((entry3) => entry3.id), context3, ["observations"]);
|
|
1846
|
+
for (const [index, entry3] of observations.entries()) {
|
|
1822
1847
|
const at = ["observations", index];
|
|
1823
|
-
requireBinding2(
|
|
1848
|
+
requireBinding2(entry3.key === authority.definition.key, context3, {
|
|
1824
1849
|
path: [...at, "key"],
|
|
1825
1850
|
message: unknownDefinition2
|
|
1826
1851
|
});
|
|
1827
|
-
requireBinding2(authority.definition.allowedValues.includes(
|
|
1852
|
+
requireBinding2(authority.definition.allowedValues.includes(entry3.value), context3, {
|
|
1828
1853
|
path: [...at, "value"],
|
|
1829
1854
|
message: "Unknown definition value"
|
|
1830
1855
|
});
|
|
1831
|
-
requireBinding2(
|
|
1856
|
+
requireBinding2(entry3.definitionDigest === authority.definition.contentDigest, context3, {
|
|
1832
1857
|
path: [...at, "definitionDigest"],
|
|
1833
1858
|
message: "Definition fingerprint mismatch"
|
|
1834
1859
|
});
|
|
1835
|
-
requireBinding2(
|
|
1860
|
+
requireBinding2(entry3.evidence.entityId === candidate2.entityId, context3, {
|
|
1836
1861
|
path: [...at, "evidence", "entityId"],
|
|
1837
1862
|
message: "Evidence belongs to a different entity"
|
|
1838
1863
|
});
|
|
1839
|
-
requireBinding2(Date.parse(
|
|
1864
|
+
requireBinding2(Date.parse(entry3.observedAt) <= Date.parse(candidate2.evaluatedAt), context3, {
|
|
1840
1865
|
path: [...at, "observedAt"],
|
|
1841
1866
|
message: "Observation is later than evaluation"
|
|
1842
1867
|
});
|
|
@@ -1852,9 +1877,9 @@ function checkExpected(candidate2, context3) {
|
|
|
1852
1877
|
return;
|
|
1853
1878
|
}
|
|
1854
1879
|
unique2(result.observationIds, context3, ["expected", "observationIds"]);
|
|
1855
|
-
const observationIds = new Set(candidate2.observations.map((
|
|
1856
|
-
for (const [index,
|
|
1857
|
-
requireBinding2(observationIds.has(
|
|
1880
|
+
const observationIds = new Set(candidate2.observations.map((entry3) => entry3.id));
|
|
1881
|
+
for (const [index, id15] of result.observationIds.entries()) {
|
|
1882
|
+
requireBinding2(observationIds.has(id15), context3, {
|
|
1858
1883
|
path: ["expected", "observationIds", index],
|
|
1859
1884
|
message: "Unknown observation"
|
|
1860
1885
|
});
|
|
@@ -1866,7 +1891,7 @@ function checkExpected(candidate2, context3) {
|
|
|
1866
1891
|
path: ["expected", "outcome"],
|
|
1867
1892
|
message: "Unknown outcome"
|
|
1868
1893
|
});
|
|
1869
|
-
requireBinding2(candidate2.authority.rules.some((
|
|
1894
|
+
requireBinding2(candidate2.authority.rules.some((entry3) => entry3.id === result.ruleId), context3, { path: ["expected", "ruleId"], message: "Unknown rule" });
|
|
1870
1895
|
}
|
|
1871
1896
|
var DraftDecisionCaseSchema = shape2.superRefine((candidate2, context3) => {
|
|
1872
1897
|
checkObservations(candidate2, context3);
|
|
@@ -1994,10 +2019,10 @@ var expectation = z19.strictObject({
|
|
|
1994
2019
|
status: z19.enum(["ready", "blocked", "review_required", "stale", "conflict", "gap"]),
|
|
1995
2020
|
outcome: identifier11.nullable(),
|
|
1996
2021
|
selectedRuleIds: z19.array(identifier11).max(256).refine(hasUniqueValues, "Duplicate rule identity")
|
|
1997
|
-
}).superRefine((
|
|
1998
|
-
const hasOutcome =
|
|
1999
|
-
const hasRules =
|
|
2000
|
-
const isReady =
|
|
2022
|
+
}).superRefine((value2, context3) => {
|
|
2023
|
+
const hasOutcome = value2.outcome !== null;
|
|
2024
|
+
const hasRules = value2.selectedRuleIds.length > 0;
|
|
2025
|
+
const isReady = value2.status === "ready";
|
|
2001
2026
|
if (isReady ? !hasOutcome || !hasRules : hasOutcome || hasRules) {
|
|
2002
2027
|
context3.addIssue({
|
|
2003
2028
|
code: "custom",
|
|
@@ -2014,9 +2039,22 @@ var DraftEvidenceFixtureSchema = z19.strictObject({
|
|
|
2014
2039
|
...fixtureIdentity,
|
|
2015
2040
|
evidence: DraftRequiredDecisionSchema.shape.evidence
|
|
2016
2041
|
});
|
|
2042
|
+
var fixtureFact = z19.strictObject({
|
|
2043
|
+
key: identifier11,
|
|
2044
|
+
value: DraftEvidenceValueSchema,
|
|
2045
|
+
held: z19.enum(["stale", "review"]).optional(),
|
|
2046
|
+
conflictsWith: DraftEvidenceValueSchema.optional()
|
|
2047
|
+
}).superRefine((fact, context3) => {
|
|
2048
|
+
if (fact.held !== void 0 && fact.conflictsWith !== void 0) {
|
|
2049
|
+
context3.addIssue({ code: "custom", message: "A fact is stale, flagged or conflicting" });
|
|
2050
|
+
}
|
|
2051
|
+
if (fact.conflictsWith === fact.value) {
|
|
2052
|
+
context3.addIssue({ code: "custom", message: "Conflicting values must differ" });
|
|
2053
|
+
}
|
|
2054
|
+
});
|
|
2017
2055
|
var DraftFactFixtureSchema = z19.strictObject({
|
|
2018
2056
|
...fixtureIdentity,
|
|
2019
|
-
facts: z19.array(
|
|
2057
|
+
facts: z19.array(fixtureFact).max(64).refine((facts) => hasUniqueValues(facts.map((fact) => fact.key)), "Duplicate fact key")
|
|
2020
2058
|
});
|
|
2021
2059
|
var DraftAnyCompilationFixtureSchema = z19.union([
|
|
2022
2060
|
DraftEvidenceFixtureSchema,
|
|
@@ -2148,40 +2186,40 @@ function boundedDraftInput(limits2) {
|
|
|
2148
2186
|
let nodes = 0;
|
|
2149
2187
|
let text8 = 0;
|
|
2150
2188
|
const budgetError = new Error("Draft input budget exceeded or non-data input");
|
|
2151
|
-
function copy(
|
|
2189
|
+
function copy(value2, depth) {
|
|
2152
2190
|
nodes += 1;
|
|
2153
2191
|
if (nodes > limits2.nodes || depth > maxDepth) {
|
|
2154
2192
|
throw budgetError;
|
|
2155
2193
|
}
|
|
2156
|
-
if (typeof
|
|
2157
|
-
text8 +=
|
|
2158
|
-
if (
|
|
2194
|
+
if (typeof value2 === "string") {
|
|
2195
|
+
text8 += value2.length;
|
|
2196
|
+
if (value2.length > limits2.stringLength || text8 > limits2.totalText) {
|
|
2159
2197
|
throw budgetError;
|
|
2160
2198
|
}
|
|
2161
|
-
return
|
|
2199
|
+
return value2;
|
|
2162
2200
|
}
|
|
2163
|
-
if (
|
|
2164
|
-
return
|
|
2201
|
+
if (value2 === null || typeof value2 !== "object") {
|
|
2202
|
+
return value2;
|
|
2165
2203
|
}
|
|
2166
|
-
const isArray = Array.isArray(
|
|
2167
|
-
const prototype = Object.getPrototypeOf(
|
|
2204
|
+
const isArray = Array.isArray(value2);
|
|
2205
|
+
const prototype = Object.getPrototypeOf(value2);
|
|
2168
2206
|
if (prototype !== null && prototype !== (isArray ? Array.prototype : Object.prototype)) {
|
|
2169
2207
|
throw budgetError;
|
|
2170
2208
|
}
|
|
2171
|
-
if (isArray &&
|
|
2209
|
+
if (isArray && value2.length > limits2.arrayLength) {
|
|
2172
2210
|
throw budgetError;
|
|
2173
2211
|
}
|
|
2174
|
-
const output = isArray ? Array.from({ length:
|
|
2212
|
+
const output = isArray ? Array.from({ length: value2.length }) : {};
|
|
2175
2213
|
let properties = 0;
|
|
2176
|
-
for (const key3 in
|
|
2177
|
-
if (!Object.hasOwn(
|
|
2214
|
+
for (const key3 in value2) {
|
|
2215
|
+
if (!Object.hasOwn(value2, key3)) {
|
|
2178
2216
|
continue;
|
|
2179
2217
|
}
|
|
2180
2218
|
properties += 1;
|
|
2181
2219
|
if (properties > (isArray ? limits2.arrayLength : 32)) {
|
|
2182
2220
|
throw budgetError;
|
|
2183
2221
|
}
|
|
2184
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
2222
|
+
const descriptor = Object.getOwnPropertyDescriptor(value2, key3);
|
|
2185
2223
|
if (!descriptor || !("value" in descriptor)) {
|
|
2186
2224
|
throw budgetError;
|
|
2187
2225
|
}
|
|
@@ -2206,7 +2244,7 @@ function boundedDraftInput(limits2) {
|
|
|
2206
2244
|
}
|
|
2207
2245
|
});
|
|
2208
2246
|
}
|
|
2209
|
-
var isUnicodeText = (
|
|
2247
|
+
var isUnicodeText = (value2) => !/[\uD800-\uDFFF]/u.test(value2);
|
|
2210
2248
|
var isSplitCharacter = (text8, offset) => offset > 0 && offset < text8.length && /[\uDC00-\uDFFF]/u.test(text8.charAt(offset));
|
|
2211
2249
|
var sourceText = DraftSourceReferenceSchema.omit({ contentDigest: true }).extend({
|
|
2212
2250
|
text: z21.string().min(1).max(1048576).refine(isUnicodeText, "Lone Unicode surrogate"),
|
|
@@ -2225,11 +2263,11 @@ var sourceBundle = z21.strictObject({
|
|
|
2225
2263
|
const identities = /* @__PURE__ */ new Set();
|
|
2226
2264
|
for (const [sourceIndex, source3] of bundle.sources.entries()) {
|
|
2227
2265
|
const at = ["sources", sourceIndex];
|
|
2228
|
-
const
|
|
2229
|
-
if (identities.has(
|
|
2266
|
+
const identity2 = sourceKey(source3);
|
|
2267
|
+
if (identities.has(identity2)) {
|
|
2230
2268
|
context3.addIssue({ code: "custom", path: at, message: "Duplicate source/revision" });
|
|
2231
2269
|
}
|
|
2232
|
-
identities.add(
|
|
2270
|
+
identities.add(identity2);
|
|
2233
2271
|
const locators2 = /* @__PURE__ */ new Set();
|
|
2234
2272
|
for (const [index, passage4] of source3.passages.entries()) {
|
|
2235
2273
|
const path3 = [...at, "passages", index];
|
|
@@ -2378,10 +2416,11 @@ var DraftEvaluatorContractSchema = z24.strictObject({
|
|
|
2378
2416
|
evaluator,
|
|
2379
2417
|
calibration: z24.strictObject({ id: identifier13, version: identifier13, contentDigest: digest9 }),
|
|
2380
2418
|
minimumSelectedProbability: z24.number().gt(0).max(1),
|
|
2381
|
-
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(),
|
|
2382
2420
|
probabilityContract: z24.enum([
|
|
2383
2421
|
"closed-distribution-unique-maximum/v1",
|
|
2384
|
-
"closed-distribution-with-abstention/v1"
|
|
2422
|
+
"closed-distribution-with-abstention/v1",
|
|
2423
|
+
"independent-option-support/v1"
|
|
2385
2424
|
])
|
|
2386
2425
|
});
|
|
2387
2426
|
var judgment = z24.discriminatedUnion("status", [
|
|
@@ -2389,11 +2428,25 @@ var judgment = z24.discriminatedUnion("status", [
|
|
|
2389
2428
|
status: z24.literal("evaluated"),
|
|
2390
2429
|
abstentionProbability: z24.number().min(0).max(1).optional(),
|
|
2391
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(),
|
|
2392
2439
|
probabilities: z24.array(z24.strictObject({
|
|
2393
2440
|
value: z24.string().min(1).max(200),
|
|
2394
2441
|
probability: z24.number().min(0).max(1)
|
|
2395
|
-
})).
|
|
2396
|
-
})
|
|
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"),
|
|
2397
2450
|
z24.strictObject({ status: z24.enum(["abstained", "timeout", "malformed", "review_required"]) })
|
|
2398
2451
|
]);
|
|
2399
2452
|
var DraftNormalizedEvidenceSchema = z24.strictObject({
|
|
@@ -2571,22 +2624,22 @@ var DraftPrimitiveMappingSchema = z26.strictObject({
|
|
|
2571
2624
|
caseId: id,
|
|
2572
2625
|
rows: z26.array(row).min(requiredAuthorityPrimitives.length).max(authorityPrimitives.length)
|
|
2573
2626
|
}).superRefine((mapping, context3) => {
|
|
2574
|
-
if (!coversAuthorityPrimitives(mapping.rows.map((
|
|
2627
|
+
if (!coversAuthorityPrimitives(mapping.rows.map((entry3) => entry3.primitive))) {
|
|
2575
2628
|
context3.addIssue({ code: "custom", path: ["rows"], message: "Every category is explicit" });
|
|
2576
2629
|
}
|
|
2577
2630
|
const seen = /* @__PURE__ */ new Set();
|
|
2578
|
-
for (const [index,
|
|
2631
|
+
for (const [index, entry3] of mapping.rows.entries()) {
|
|
2579
2632
|
const path3 = ["rows", index];
|
|
2580
|
-
if (seen.has(
|
|
2633
|
+
if (seen.has(entry3.primitive)) {
|
|
2581
2634
|
context3.addIssue({ code: "custom", path: path3, message: "Duplicate primitive" });
|
|
2582
2635
|
}
|
|
2583
|
-
seen.add(
|
|
2584
|
-
if (
|
|
2636
|
+
seen.add(entry3.primitive);
|
|
2637
|
+
if (entry3.status !== "mapped") {
|
|
2585
2638
|
continue;
|
|
2586
2639
|
}
|
|
2587
2640
|
const references = /* @__PURE__ */ new Set();
|
|
2588
|
-
for (const [at, ref] of
|
|
2589
|
-
if (!kinds[
|
|
2641
|
+
for (const [at, ref] of entry3.references.entries()) {
|
|
2642
|
+
if (!kinds[entry3.primitive].includes(ref.kind)) {
|
|
2590
2643
|
context3.addIssue({
|
|
2591
2644
|
code: "custom",
|
|
2592
2645
|
path: [...path3, "references", at],
|
|
@@ -2606,7 +2659,7 @@ var DraftPrimitiveMappingSchema = z26.strictObject({
|
|
|
2606
2659
|
}
|
|
2607
2660
|
});
|
|
2608
2661
|
function readObservation(input, ref) {
|
|
2609
|
-
const index = input.observations.findIndex((
|
|
2662
|
+
const index = input.observations.findIndex((entry3) => entry3.id === ref.observationId);
|
|
2610
2663
|
const observation2 = input.observations[index];
|
|
2611
2664
|
if (!observation2) {
|
|
2612
2665
|
return void 0;
|
|
@@ -2642,7 +2695,7 @@ function readReference(input, ref) {
|
|
|
2642
2695
|
return { path: "expected", value: input.expected };
|
|
2643
2696
|
}
|
|
2644
2697
|
case "rule": {
|
|
2645
|
-
const index = authority.rules.findIndex((
|
|
2698
|
+
const index = authority.rules.findIndex((entry3) => entry3.id === ref.ruleId);
|
|
2646
2699
|
const rule3 = authority.rules[index];
|
|
2647
2700
|
return rule3 ? {
|
|
2648
2701
|
path: `authority.rules.${index}`,
|
|
@@ -2671,18 +2724,18 @@ var DraftMappedCaseSchema = z26.strictObject({
|
|
|
2671
2724
|
message: "Mapping belongs to a different case"
|
|
2672
2725
|
});
|
|
2673
2726
|
}
|
|
2674
|
-
for (const [index,
|
|
2675
|
-
if (
|
|
2727
|
+
for (const [index, entry3] of mapping.rows.entries()) {
|
|
2728
|
+
if (entry3.status !== "mapped") {
|
|
2676
2729
|
continue;
|
|
2677
2730
|
}
|
|
2678
|
-
if (
|
|
2731
|
+
if (entry3.primitive === "gaps" && input.expected.state === "ready") {
|
|
2679
2732
|
context3.addIssue({
|
|
2680
2733
|
code: "custom",
|
|
2681
2734
|
path: ["mapping", "rows", index],
|
|
2682
2735
|
message: "Ready expectation cannot demonstrate an unresolved gap or conflict"
|
|
2683
2736
|
});
|
|
2684
2737
|
}
|
|
2685
|
-
for (const [at, ref] of
|
|
2738
|
+
for (const [at, ref] of entry3.references.entries()) {
|
|
2686
2739
|
if (!readReference(input, ref)) {
|
|
2687
2740
|
context3.addIssue({
|
|
2688
2741
|
code: "custom",
|
|
@@ -2849,6 +2902,8 @@ var PackDraftBoundSchema = z29.union([
|
|
|
2849
2902
|
z29.number(),
|
|
2850
2903
|
CalendarDateSchema,
|
|
2851
2904
|
z29.strictObject({ question: draftIdentifier, days: dayOffset }),
|
|
2905
|
+
z29.strictObject({ question: draftIdentifier, businessDays: dayOffset }),
|
|
2906
|
+
z29.strictObject({ question: draftIdentifier }),
|
|
2852
2907
|
z29.strictObject({ decisionDate: dayOffset })
|
|
2853
2908
|
]);
|
|
2854
2909
|
var PackDraftComparisonSchema = z29.strictObject({
|
|
@@ -2858,10 +2913,10 @@ var PackDraftComparisonSchema = z29.strictObject({
|
|
|
2858
2913
|
gte: PackDraftBoundSchema.optional(),
|
|
2859
2914
|
eq: PackDraftBoundSchema.optional(),
|
|
2860
2915
|
quote: draftQuote
|
|
2861
|
-
}).superRefine((
|
|
2862
|
-
const lower = Number(
|
|
2863
|
-
const upper = Number(
|
|
2864
|
-
const hasEquality =
|
|
2916
|
+
}).superRefine((value2, context3) => {
|
|
2917
|
+
const lower = Number(value2.gt !== void 0) + Number(value2.gte !== void 0);
|
|
2918
|
+
const upper = Number(value2.lt !== void 0) + Number(value2.lte !== void 0);
|
|
2919
|
+
const hasEquality = value2.eq !== void 0;
|
|
2865
2920
|
if (lower + upper + Number(hasEquality) === 0) {
|
|
2866
2921
|
context3.addIssue({ code: "custom", message: "Give a bound: lt, lte, gt, gte or eq" });
|
|
2867
2922
|
} else if (lower > 1 || upper > 1) {
|
|
@@ -2876,6 +2931,9 @@ var PackDraftConditionSchema = z29.union([
|
|
|
2876
2931
|
PackDraftComparisonSchema
|
|
2877
2932
|
]);
|
|
2878
2933
|
var PackDraftConditionsSchema = z29.record(draftIdentifier, PackDraftConditionSchema);
|
|
2934
|
+
function isComparison(condition) {
|
|
2935
|
+
return typeof condition === "object" && !Array.isArray(condition);
|
|
2936
|
+
}
|
|
2879
2937
|
var questionTypes = ["number", "date"];
|
|
2880
2938
|
var typedQuestionFields = {
|
|
2881
2939
|
type: z29.enum(questionTypes).optional(),
|
|
@@ -2885,6 +2943,66 @@ var typedQuestionFields = {
|
|
|
2885
2943
|
minimum: z29.number().optional(),
|
|
2886
2944
|
maximum: z29.number().optional()
|
|
2887
2945
|
};
|
|
2946
|
+
function unitKindOf(unit) {
|
|
2947
|
+
if (unit === "percent") {
|
|
2948
|
+
return "percent";
|
|
2949
|
+
}
|
|
2950
|
+
return isKnownCurrency(unit) ? "currency" : "count";
|
|
2951
|
+
}
|
|
2952
|
+
function fieldIssue(question3, field) {
|
|
2953
|
+
return { path: [field], message: `A ${question3.type ?? "choice"} question has no ${field}` };
|
|
2954
|
+
}
|
|
2955
|
+
function fieldIssues(question3, allowed) {
|
|
2956
|
+
const fields = ["answers", "unit", "unitWords", "integer", "minimum", "maximum"];
|
|
2957
|
+
const present = fields.filter((field) => question3[field] !== void 0);
|
|
2958
|
+
return present.filter((field) => !allowed.includes(field)).map((field) => fieldIssue(question3, field));
|
|
2959
|
+
}
|
|
2960
|
+
function numberIssues(question3) {
|
|
2961
|
+
const issues = [];
|
|
2962
|
+
const { unit } = question3;
|
|
2963
|
+
if (unit === void 0) {
|
|
2964
|
+
return [
|
|
2965
|
+
{
|
|
2966
|
+
path: ["unit"],
|
|
2967
|
+
message: 'Give the unit: a currency code such as "USD", "percent", or a count noun'
|
|
2968
|
+
}
|
|
2969
|
+
];
|
|
2970
|
+
}
|
|
2971
|
+
const kind = unitKindOf(unit);
|
|
2972
|
+
if (kind === "count" && !/^[a-z][a-z0-9_-]*$/u.test(unit)) {
|
|
2973
|
+
issues.push({
|
|
2974
|
+
path: ["unit"],
|
|
2975
|
+
message: 'Use a currency code such as "USD", "percent", or a lowercase count noun'
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
if (kind === "count" && question3.unitWords === void 0) {
|
|
2979
|
+
issues.push({
|
|
2980
|
+
path: ["unitWords"],
|
|
2981
|
+
message: 'A count needs the words that name its unit next to its number, such as "claims"'
|
|
2982
|
+
});
|
|
2983
|
+
}
|
|
2984
|
+
if (kind !== "count" && question3.unitWords !== void 0) {
|
|
2985
|
+
issues.push({ path: ["unitWords"], message: "Only a count has unit words" });
|
|
2986
|
+
}
|
|
2987
|
+
const { minimum, maximum } = question3;
|
|
2988
|
+
if (minimum !== void 0 && maximum !== void 0 && minimum > maximum) {
|
|
2989
|
+
issues.push({ path: ["maximum"], message: "maximum is below minimum" });
|
|
2990
|
+
}
|
|
2991
|
+
return issues;
|
|
2992
|
+
}
|
|
2993
|
+
function questionIssues(question3) {
|
|
2994
|
+
if (question3.type === "number") {
|
|
2995
|
+
return [
|
|
2996
|
+
...fieldIssues(question3, ["unit", "unitWords", "integer", "minimum", "maximum"]),
|
|
2997
|
+
...numberIssues(question3)
|
|
2998
|
+
];
|
|
2999
|
+
}
|
|
3000
|
+
if (question3.type === "date") {
|
|
3001
|
+
return fieldIssues(question3, []);
|
|
3002
|
+
}
|
|
3003
|
+
const missing = question3.answers === void 0 ? [{ path: ["answers"], message: "A choice question needs answers" }] : [];
|
|
3004
|
+
return [...fieldIssues(question3, ["answers"]), ...missing];
|
|
3005
|
+
}
|
|
2888
3006
|
var declaredDateOrders = [
|
|
2889
3007
|
"month-first",
|
|
2890
3008
|
"day-first"
|
|
@@ -2894,7 +3012,51 @@ var packConventionFields = {
|
|
|
2894
3012
|
dateOrder: z29.enum(declaredDateOrders).optional(),
|
|
2895
3013
|
timeZone: z29.string().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_+/-]*$/u, "Use an IANA time zone name, such as Europe/Paris").refine(isTimeZone, "Unknown IANA time zone").optional()
|
|
2896
3014
|
};
|
|
2897
|
-
var
|
|
3015
|
+
var plainFact = z29.union([draftValue, z29.number()]);
|
|
3016
|
+
var heldFactSchema = z29.union([
|
|
3017
|
+
z29.strictObject({ missing: z29.literal(true) }),
|
|
3018
|
+
z29.strictObject({ stale: plainFact }),
|
|
3019
|
+
z29.strictObject({ review: plainFact }),
|
|
3020
|
+
z29.strictObject({ conflict: z29.tuple([plainFact, plainFact]) }).refine((fact) => fact.conflict[0] !== fact.conflict[1], "Conflicting readings must differ")
|
|
3021
|
+
]);
|
|
3022
|
+
var caseFactSchema = z29.union([plainFact, heldFactSchema]);
|
|
3023
|
+
var heldStates = ["missing", "stale", "conflict", "review"];
|
|
3024
|
+
var weekdayNames = [
|
|
3025
|
+
"sunday",
|
|
3026
|
+
"monday",
|
|
3027
|
+
"tuesday",
|
|
3028
|
+
"wednesday",
|
|
3029
|
+
"thursday",
|
|
3030
|
+
"friday",
|
|
3031
|
+
"saturday"
|
|
3032
|
+
];
|
|
3033
|
+
var calendarYear = z29.number().int().min(1900).max(2200);
|
|
3034
|
+
var PackDraftBusinessDaysSchema = z29.strictObject({
|
|
3035
|
+
workingDays: z29.array(z29.enum(weekdayNames)).min(1).max(7).refine(hasUniqueValues, "Duplicate working day"),
|
|
3036
|
+
quote: draftQuote,
|
|
3037
|
+
years: z29.strictObject({ from: calendarYear, through: calendarYear }),
|
|
3038
|
+
holidays: z29.array(z29.strictObject({ date: CalendarDateSchema, quote: draftQuote })).max(400).refine((rows) => hasUniqueValues(rows.map((row2) => row2.date)), "Duplicate holiday").optional()
|
|
3039
|
+
}).superRefine((calendar, context3) => {
|
|
3040
|
+
const { from, through } = calendar.years;
|
|
3041
|
+
if (through < from || through - from > 99) {
|
|
3042
|
+
context3.addIssue({
|
|
3043
|
+
code: "custom",
|
|
3044
|
+
path: ["years"],
|
|
3045
|
+
message: "years.through must be on or after years.from, within 100 years"
|
|
3046
|
+
});
|
|
3047
|
+
}
|
|
3048
|
+
const holidays = calendar.holidays ?? [];
|
|
3049
|
+
for (const [index, holiday] of holidays.entries()) {
|
|
3050
|
+
const year = Number(holiday.date.slice(0, 4));
|
|
3051
|
+
if (year < from || year > through) {
|
|
3052
|
+
context3.addIssue({
|
|
3053
|
+
code: "custom",
|
|
3054
|
+
path: ["holidays", index, "date"],
|
|
3055
|
+
message: "This holiday is outside the calendar's years"
|
|
3056
|
+
});
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
});
|
|
2898
3060
|
var caseDecisionDate = CalendarDateSchema.optional();
|
|
2899
3061
|
|
|
2900
3062
|
// ../schemas/src/draft-pack-subjects.ts
|
|
@@ -3017,7 +3179,7 @@ var group = z31.strictObject({
|
|
|
3017
3179
|
min: z31.number().int().min(0).max(64),
|
|
3018
3180
|
max: z31.number().int().min(0).max(64),
|
|
3019
3181
|
candidates: z31.array(candidate).max(64)
|
|
3020
|
-
}).refine((
|
|
3182
|
+
}).refine((value2) => value2.min <= value2.max, "Group minimum exceeds maximum");
|
|
3021
3183
|
function areSubjectsValid(subjects, isIsolated) {
|
|
3022
3184
|
const types = new Set(subjects.types.map((row2) => row2.id));
|
|
3023
3185
|
const job = subjects.types.find((row2) => row2.id === subjects.job);
|
|
@@ -3038,13 +3200,13 @@ function areSubjectsValid(subjects, isIsolated) {
|
|
|
3038
3200
|
function areEscalationsValid(escalations, context3) {
|
|
3039
3201
|
const { isIsolated, outcomes } = context3;
|
|
3040
3202
|
const ids3 = new Set(escalations.routes.map((row2) => row2.id));
|
|
3041
|
-
const named = [escalations.unresolved, escalations.attemptLimit].filter((
|
|
3203
|
+
const named = [escalations.unresolved, escalations.attemptLimit].filter((id15) => id15 !== null);
|
|
3042
3204
|
return [
|
|
3043
3205
|
ids3.size === escalations.routes.length,
|
|
3044
3206
|
escalations.routes.every((row2) => isIsolated(row2.entryId, "routing_jobs")),
|
|
3045
3207
|
hasUniqueValues(escalations.outcomes.map((row2) => row2.outcome)),
|
|
3046
3208
|
escalations.outcomes.every((row2) => ids3.has(row2.escalation) && outcomes.has(row2.outcome)),
|
|
3047
|
-
named.every((
|
|
3209
|
+
named.every((id15) => ids3.has(id15))
|
|
3048
3210
|
].every(Boolean);
|
|
3049
3211
|
}
|
|
3050
3212
|
function isGuideValid(guide, isIsolated) {
|
|
@@ -3060,10 +3222,10 @@ function subjectPlanIssues(plan) {
|
|
|
3060
3222
|
const issues = [];
|
|
3061
3223
|
const candidates = plan.groups.flatMap((item) => item.candidates);
|
|
3062
3224
|
const isIsolated = (entryId, primitive) => {
|
|
3063
|
-
const
|
|
3225
|
+
const entry3 = plan.entries.find((row2) => row2.id === entryId);
|
|
3064
3226
|
return [
|
|
3065
|
-
|
|
3066
|
-
|
|
3227
|
+
entry3?.primitive === primitive,
|
|
3228
|
+
entry3?.dependencies.length === 0,
|
|
3067
3229
|
!plan.requiredIds.includes(entryId),
|
|
3068
3230
|
candidates.every((row2) => row2.entryId !== entryId),
|
|
3069
3231
|
plan.entries.every((row2) => !row2.dependencies.includes(entryId))
|
|
@@ -3102,7 +3264,7 @@ var DraftContextSelectionPlanSchema = z31.strictObject({
|
|
|
3102
3264
|
attempts: z31.strictObject({
|
|
3103
3265
|
max: z31.number().int().min(1).max(10),
|
|
3104
3266
|
withProgress: z31.number().int().min(1).max(10)
|
|
3105
|
-
}).refine((
|
|
3267
|
+
}).refine((value2) => value2.withProgress >= value2.max, "withProgress below max").optional(),
|
|
3106
3268
|
entries: base2.entries,
|
|
3107
3269
|
requiredIds: base2.requiredIds,
|
|
3108
3270
|
budget: base2.budget,
|
|
@@ -3134,19 +3296,19 @@ var DraftContextSelectionPlanSchema = z31.strictObject({
|
|
|
3134
3296
|
if (candidateIds.length > 64 || !hasUniqueIds(candidateIds) || !hasUniqueIds(plan.groups.map((item) => item.id)) || !hasUniqueIds(plan.entries.map((item) => item.id))) {
|
|
3135
3297
|
context3.addIssue({ code: "custom", message: "Duplicate identities or too many candidates" });
|
|
3136
3298
|
}
|
|
3137
|
-
if (plan.requiredIds.some((
|
|
3299
|
+
if (plan.requiredIds.some((id15) => candidateIds.includes(id15))) {
|
|
3138
3300
|
context3.addIssue({ code: "custom", message: "Global required root cannot be a candidate" });
|
|
3139
3301
|
}
|
|
3140
3302
|
const guidanceId = plan.unresolvedGuidanceEntryId;
|
|
3141
3303
|
if (guidanceId === void 0) {
|
|
3142
3304
|
return;
|
|
3143
3305
|
}
|
|
3144
|
-
const
|
|
3306
|
+
const entry3 = plan.entries.find((row2) => row2.id === guidanceId);
|
|
3145
3307
|
if ([
|
|
3146
|
-
!
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3308
|
+
!entry3,
|
|
3309
|
+
entry3?.primitive !== "gaps",
|
|
3310
|
+
entry3?.dependencies.length,
|
|
3311
|
+
entry3?.conflictsWith.length,
|
|
3150
3312
|
plan.requiredIds.includes(guidanceId),
|
|
3151
3313
|
candidateIds.includes(guidanceId),
|
|
3152
3314
|
plan.entries.some((row2) => row2.dependencies.includes(guidanceId))
|
|
@@ -3669,7 +3831,7 @@ var DraftApplicationTargetSchema = DraftApplicationScopeSchema.extend({
|
|
|
3669
3831
|
action,
|
|
3670
3832
|
resourceId: identifier18,
|
|
3671
3833
|
jobId: identifier18.nullable()
|
|
3672
|
-
}).refine((
|
|
3834
|
+
}).refine((target2) => target2.action === "execute_job" === (target2.jobId !== null), "Only job execution carries a job ID");
|
|
3673
3835
|
var DraftApplicationActorSchema = z43.strictObject({
|
|
3674
3836
|
principalId: identifier18,
|
|
3675
3837
|
organizationId: identifier18,
|
|
@@ -3725,7 +3887,20 @@ var DraftApplicationReleaseSchema = z43.strictObject({
|
|
|
3725
3887
|
});
|
|
3726
3888
|
|
|
3727
3889
|
// ../schemas/src/draft-hosted-application.ts
|
|
3728
|
-
import { z as
|
|
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
|
+
});
|
|
3729
3904
|
|
|
3730
3905
|
// ../schemas/src/draft-source-instant.ts
|
|
3731
3906
|
var localPattern = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?([^.\d].*)$/u;
|
|
@@ -3765,11 +3940,11 @@ function utcOf(local, offset) {
|
|
|
3765
3940
|
const utc = date.toISOString();
|
|
3766
3941
|
return utcYear.test(utc) ? utc.slice(0, 19) : null;
|
|
3767
3942
|
}
|
|
3768
|
-
function normalizedSourceInstant(
|
|
3769
|
-
if (
|
|
3943
|
+
function normalizedSourceInstant(value2) {
|
|
3944
|
+
if (value2.length > sourceInstantMaxLength) {
|
|
3770
3945
|
return null;
|
|
3771
3946
|
}
|
|
3772
|
-
const match = localPattern.exec(
|
|
3947
|
+
const match = localPattern.exec(value2);
|
|
3773
3948
|
if (match === null) {
|
|
3774
3949
|
return null;
|
|
3775
3950
|
}
|
|
@@ -3795,62 +3970,62 @@ function normalizedSourceInstant(value) {
|
|
|
3795
3970
|
}
|
|
3796
3971
|
|
|
3797
3972
|
// ../schemas/src/draft-hosted-output-checks.ts
|
|
3798
|
-
import { z as
|
|
3973
|
+
import { z as z50 } from "zod";
|
|
3799
3974
|
|
|
3800
3975
|
// ../schemas/src/draft-artifact-check-manifest.ts
|
|
3801
|
-
import { z as
|
|
3976
|
+
import { z as z48 } from "zod";
|
|
3802
3977
|
|
|
3803
3978
|
// ../schemas/src/draft-artifact-lint-semantic.ts
|
|
3804
|
-
import { z as
|
|
3979
|
+
import { z as z47 } from "zod";
|
|
3805
3980
|
|
|
3806
3981
|
// ../schemas/src/draft-claim-evaluation-recipe.ts
|
|
3807
|
-
import { z as
|
|
3982
|
+
import { z as z46 } from "zod";
|
|
3808
3983
|
|
|
3809
3984
|
// ../schemas/src/draft-output-check.ts
|
|
3810
|
-
import { z as
|
|
3985
|
+
import { z as z45 } from "zod";
|
|
3811
3986
|
var identifier19 = DraftContextPlanSchema.shape.job;
|
|
3812
3987
|
var digest19 = DraftJobReceiptBodySchema.shape.inputDigest;
|
|
3813
|
-
var byteLimit =
|
|
3814
|
-
var text5 =
|
|
3815
|
-
var sectionRule =
|
|
3816
|
-
|
|
3817
|
-
|
|
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({
|
|
3818
3993
|
id: identifier19,
|
|
3819
|
-
check:
|
|
3994
|
+
check: z45.literal("exact"),
|
|
3820
3995
|
maxBytes: byteLimit,
|
|
3821
|
-
alternatives:
|
|
3996
|
+
alternatives: z45.array(text5.min(1).regex(/\S/u)).min(1).max(8).refine(hasUniqueValues)
|
|
3822
3997
|
})
|
|
3823
3998
|
]);
|
|
3824
3999
|
var draftOutputCheckerContract = "felspar.structured-output-check/v1";
|
|
3825
|
-
var DraftOutputContractSchema =
|
|
3826
|
-
schema:
|
|
4000
|
+
var DraftOutputContractSchema = z45.strictObject({
|
|
4001
|
+
schema: z45.literal("felspar.output-contract.draft/v0"),
|
|
3827
4002
|
id: identifier19,
|
|
3828
|
-
version:
|
|
4003
|
+
version: z45.number().int().min(1).max(65535),
|
|
3829
4004
|
compiledArtifactDigest: digest19,
|
|
3830
4005
|
job: identifier19,
|
|
3831
4006
|
trustDomain: identifier19,
|
|
3832
4007
|
outputSurface: identifier19,
|
|
3833
4008
|
maxBytes: byteLimit,
|
|
3834
|
-
sections:
|
|
4009
|
+
sections: z45.array(sectionRule).min(1).max(16)
|
|
3835
4010
|
}).superRefine((contract, context3) => {
|
|
3836
4011
|
if (!hasUniqueValues(contract.sections.map((section) => section.id))) {
|
|
3837
4012
|
context3.addIssue({ code: "custom", message: "Duplicate output section rule" });
|
|
3838
4013
|
}
|
|
3839
4014
|
const encoder2 = new TextEncoder();
|
|
3840
4015
|
for (const section of contract.sections) {
|
|
3841
|
-
if (section.check === "exact" && section.alternatives.some((
|
|
4016
|
+
if (section.check === "exact" && section.alternatives.some((value2) => encoder2.encode(value2).byteLength > section.maxBytes)) {
|
|
3842
4017
|
context3.addIssue({ code: "custom", message: "Exact alternative exceeds section budget" });
|
|
3843
4018
|
}
|
|
3844
4019
|
}
|
|
3845
4020
|
});
|
|
3846
|
-
var DraftStructuredOutputSchema =
|
|
3847
|
-
schema:
|
|
4021
|
+
var DraftStructuredOutputSchema = z45.strictObject({
|
|
4022
|
+
schema: z45.literal("felspar.structured-output.draft/v0"),
|
|
3848
4023
|
id: identifier19,
|
|
3849
4024
|
revision: identifier19,
|
|
3850
|
-
sections:
|
|
4025
|
+
sections: z45.array(z45.strictObject({ id: identifier19, text: text5 })).max(32).refine((sections) => hasUniqueValues(sections.map((section) => section.id)))
|
|
3851
4026
|
});
|
|
3852
|
-
var DraftOutputCheckSchema =
|
|
3853
|
-
schema:
|
|
4027
|
+
var DraftOutputCheckSchema = z45.strictObject({
|
|
4028
|
+
schema: z45.literal("felspar.output-check.draft/v0"),
|
|
3854
4029
|
execution: DraftJobExecutionSchema,
|
|
3855
4030
|
expectedJobReceiptDigest: digest19,
|
|
3856
4031
|
contractEntryId: identifier19,
|
|
@@ -3858,8 +4033,8 @@ var DraftOutputCheckSchema = z44.strictObject({
|
|
|
3858
4033
|
output: DraftStructuredOutputSchema,
|
|
3859
4034
|
expectedOutputDigest: digest19
|
|
3860
4035
|
});
|
|
3861
|
-
var DraftOutputDiagnosticSchema =
|
|
3862
|
-
code:
|
|
4036
|
+
var DraftOutputDiagnosticSchema = z45.strictObject({
|
|
4037
|
+
code: z45.enum([
|
|
3863
4038
|
"upstream_blocked",
|
|
3864
4039
|
"contract_coverage_incomplete",
|
|
3865
4040
|
"contract_invalid",
|
|
@@ -3872,13 +4047,13 @@ var DraftOutputDiagnosticSchema = z44.strictObject({
|
|
|
3872
4047
|
]),
|
|
3873
4048
|
sectionId: identifier19.nullable()
|
|
3874
4049
|
});
|
|
3875
|
-
var DraftOutputReceiptBodySchema =
|
|
3876
|
-
schema:
|
|
3877
|
-
authority:
|
|
3878
|
-
checkerContract:
|
|
3879
|
-
coverage:
|
|
3880
|
-
semanticEvaluation:
|
|
3881
|
-
actionAuthorized:
|
|
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),
|
|
3882
4057
|
inputDigest: digest19,
|
|
3883
4058
|
jobReceiptDigest: digest19,
|
|
3884
4059
|
compiledArtifactDigest: digest19,
|
|
@@ -3887,39 +4062,39 @@ var DraftOutputReceiptBodySchema = z44.strictObject({
|
|
|
3887
4062
|
outputDigest: digest19,
|
|
3888
4063
|
outputId: identifier19,
|
|
3889
4064
|
outputRevision: identifier19,
|
|
3890
|
-
status:
|
|
3891
|
-
structuralOnlySectionIds:
|
|
3892
|
-
diagnostics:
|
|
4065
|
+
status: z45.enum(["checks_passed", "invalid", "blocked"]),
|
|
4066
|
+
structuralOnlySectionIds: z45.array(identifier19).max(16),
|
|
4067
|
+
diagnostics: z45.array(DraftOutputDiagnosticSchema).max(81)
|
|
3893
4068
|
});
|
|
3894
4069
|
var DraftOutputReceiptSchema = DraftOutputReceiptBodySchema.extend({
|
|
3895
4070
|
receiptDigest: digest19
|
|
3896
4071
|
});
|
|
3897
|
-
var DraftOutputVerificationOptionsSchema =
|
|
4072
|
+
var DraftOutputVerificationOptionsSchema = z45.strictObject({
|
|
3898
4073
|
expectedReceiptDigest: digest19
|
|
3899
4074
|
});
|
|
3900
4075
|
|
|
3901
4076
|
// ../schemas/src/draft-claim-evaluation-recipe.ts
|
|
3902
4077
|
var scope = DraftOutputContractSchema.shape;
|
|
3903
4078
|
var identifier20 = scope.id;
|
|
3904
|
-
var text6 =
|
|
3905
|
-
var ids2 =
|
|
4079
|
+
var text6 = z46.string().min(1).max(2048).regex(/\S/u);
|
|
4080
|
+
var ids2 = z46.array(identifier20).max(8).refine(hasUniqueValues, "Duplicate identifier");
|
|
3906
4081
|
var { judgment: judgment3 } = DraftNormalizedEvidenceSchema.shape.normalizations.element.shape;
|
|
3907
|
-
var option =
|
|
4082
|
+
var option = z46.strictObject({
|
|
3908
4083
|
value: judgment3.options[0].shape.probabilities.element.shape.value,
|
|
3909
4084
|
meaning: text6,
|
|
3910
|
-
effect:
|
|
4085
|
+
effect: z46.enum(["satisfied", "violated", "unresolved"])
|
|
3911
4086
|
});
|
|
3912
|
-
var question =
|
|
4087
|
+
var question = z46.strictObject({
|
|
3913
4088
|
id: identifier20,
|
|
3914
4089
|
sectionIds: ids2.min(1),
|
|
3915
4090
|
instructions: text6,
|
|
3916
4091
|
authorityEntryIds: ids2.min(1),
|
|
3917
4092
|
evidenceKeys: ids2,
|
|
3918
|
-
options:
|
|
3919
|
-
minimumSelectedProbability:
|
|
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)
|
|
3920
4095
|
});
|
|
3921
|
-
var DraftClaimEvaluationRecipeSchema =
|
|
3922
|
-
schema:
|
|
4096
|
+
var DraftClaimEvaluationRecipeSchema = z46.strictObject({
|
|
4097
|
+
schema: z46.literal("felspar.claim-evaluation-recipe.draft/v0"),
|
|
3923
4098
|
id: identifier20,
|
|
3924
4099
|
version: identifier20,
|
|
3925
4100
|
compiledArtifactDigest: scope.compiledArtifactDigest,
|
|
@@ -3929,11 +4104,11 @@ var DraftClaimEvaluationRecipeSchema = z45.strictObject({
|
|
|
3929
4104
|
evaluator: DraftEvaluatorContractSchema.shape.evaluator,
|
|
3930
4105
|
calibration: DraftEvaluatorContractSchema.shape.calibration,
|
|
3931
4106
|
probabilityContract: DraftEvaluatorContractSchema.shape.probabilityContract,
|
|
3932
|
-
questions:
|
|
3933
|
-
limits:
|
|
3934
|
-
maxRequests:
|
|
3935
|
-
maxRequestBytes:
|
|
3936
|
-
maxTotalBytes:
|
|
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)
|
|
3937
4112
|
})
|
|
3938
4113
|
});
|
|
3939
4114
|
|
|
@@ -3950,92 +4125,95 @@ var artifactSemanticLimits = {
|
|
|
3950
4125
|
maxRequestBytes: 32768,
|
|
3951
4126
|
maxTotalBytes: 16777216
|
|
3952
4127
|
};
|
|
3953
|
-
var ArtifactSemanticQuestionSchema =
|
|
4128
|
+
var ArtifactSemanticQuestionSchema = z47.strictObject({
|
|
3954
4129
|
id: id3,
|
|
3955
4130
|
instructions: recipeQuestion.instructions,
|
|
3956
4131
|
options: recipeQuestion.options,
|
|
3957
4132
|
minimumSelectedProbability: recipeQuestion.minimumSelectedProbability,
|
|
3958
|
-
aggregation:
|
|
4133
|
+
aggregation: z47.enum(["prohibit", "require", "match"])
|
|
3959
4134
|
});
|
|
3960
|
-
var ArtifactSemanticRecipeSchema =
|
|
4135
|
+
var ArtifactSemanticRecipeSchema = z47.strictObject({
|
|
3961
4136
|
evaluator: recipe.evaluator,
|
|
3962
4137
|
calibration: recipe.calibration,
|
|
3963
4138
|
probabilityContract: recipe.probabilityContract,
|
|
3964
|
-
questions:
|
|
3965
|
-
limits:
|
|
3966
|
-
maxEvaluations:
|
|
3967
|
-
maxRequestBytes:
|
|
3968
|
-
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)
|
|
3969
4144
|
})
|
|
3970
4145
|
});
|
|
3971
|
-
var ArtifactSemanticRequestSchema =
|
|
3972
|
-
schema:
|
|
4146
|
+
var ArtifactSemanticRequestSchema = z47.strictObject({
|
|
4147
|
+
schema: z47.literal("felspar.artifact-question.draft/v1"),
|
|
3973
4148
|
preparationDigest: digest20,
|
|
3974
4149
|
unitId: id3,
|
|
3975
4150
|
sectionId: id3,
|
|
3976
|
-
start:
|
|
3977
|
-
end:
|
|
4151
|
+
start: z47.number().int().min(0),
|
|
4152
|
+
end: z47.number().int().min(1),
|
|
3978
4153
|
textDigest: digest20,
|
|
3979
|
-
text:
|
|
4154
|
+
text: z47.string().min(1),
|
|
3980
4155
|
questionId: id3,
|
|
3981
4156
|
instructions: recipeQuestion.instructions,
|
|
3982
|
-
options:
|
|
3983
|
-
policy:
|
|
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),
|
|
3984
4159
|
evaluator: recipe.evaluator,
|
|
3985
4160
|
calibration: recipe.calibration,
|
|
3986
4161
|
requestDigest: digest20
|
|
3987
4162
|
});
|
|
3988
|
-
var
|
|
3989
|
-
|
|
4163
|
+
var artifactInjectionScreen = z47.literal("paragraph-injection/v1");
|
|
4164
|
+
var ArtifactSemanticResponseSchema = z47.strictObject({
|
|
4165
|
+
schema: z47.literal("felspar.artifact-question-response.draft/v1"),
|
|
4166
|
+
screen: artifactInjectionScreen.optional(),
|
|
3990
4167
|
preparationDigest: digest20,
|
|
3991
4168
|
evaluator: recipe.evaluator,
|
|
3992
4169
|
calibrationDigest: digest20,
|
|
3993
|
-
answers:
|
|
4170
|
+
answers: z47.array(z47.strictObject({ unitId: id3, questionId: id3, requestDigest: digest20, judgment: judgment4 })).max(artifactSemanticLimits.maxEvaluations)
|
|
3994
4171
|
});
|
|
3995
|
-
var ArtifactSemanticJudgmentSchema =
|
|
4172
|
+
var ArtifactSemanticJudgmentSchema = z47.strictObject({
|
|
3996
4173
|
unitId: id3,
|
|
3997
4174
|
sectionId: id3,
|
|
3998
|
-
start:
|
|
3999
|
-
end:
|
|
4175
|
+
start: z47.number().int().min(0),
|
|
4176
|
+
end: z47.number().int().min(1),
|
|
4000
4177
|
textDigest: digest20,
|
|
4001
4178
|
questionId: id3,
|
|
4002
4179
|
requestDigest: digest20,
|
|
4003
4180
|
judgment: judgment4.nullable(),
|
|
4004
|
-
value:
|
|
4005
|
-
effect:
|
|
4006
|
-
reasons:
|
|
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)
|
|
4007
4184
|
});
|
|
4008
|
-
var ArtifactSemanticRecordSchema =
|
|
4009
|
-
state:
|
|
4185
|
+
var ArtifactSemanticRecordSchema = z47.strictObject({
|
|
4186
|
+
state: z47.enum(["ready", "skipped", "over_budget", "not_evaluated"]),
|
|
4187
|
+
screen: artifactInjectionScreen.optional(),
|
|
4010
4188
|
preparationDigest: digest20,
|
|
4011
4189
|
evaluator: ArtifactSemanticRecipeSchema.shape.evaluator,
|
|
4012
4190
|
calibrationDigest: digest20,
|
|
4013
4191
|
probabilityContract: ArtifactSemanticRecipeSchema.shape.probabilityContract,
|
|
4014
|
-
questions:
|
|
4192
|
+
questions: z47.array(ArtifactSemanticQuestionSchema.pick({
|
|
4015
4193
|
id: true,
|
|
4016
4194
|
minimumSelectedProbability: true,
|
|
4017
4195
|
aggregation: true
|
|
4018
4196
|
}).extend({
|
|
4019
4197
|
checkId: id3,
|
|
4020
4198
|
anchorSectionId: id3,
|
|
4021
|
-
sectionsAvailable:
|
|
4022
|
-
units:
|
|
4023
|
-
options:
|
|
4199
|
+
sectionsAvailable: z47.boolean(),
|
|
4200
|
+
units: z47.number().int().min(0).max(artifactSemanticLimits.maxEvaluations),
|
|
4201
|
+
options: z47.array(z47.strictObject({
|
|
4024
4202
|
value: ArtifactSemanticQuestionSchema.shape.options.element.shape.value,
|
|
4025
|
-
effect:
|
|
4203
|
+
effect: z47.enum(["satisfied", "violated", "unresolved", "not_stated"])
|
|
4026
4204
|
})).min(2).max(8)
|
|
4027
4205
|
})).max(artifactSemanticLimits.maxQuestions),
|
|
4028
|
-
judgments:
|
|
4206
|
+
judgments: z47.array(ArtifactSemanticJudgmentSchema).max(artifactSemanticLimits.maxEvaluations)
|
|
4029
4207
|
});
|
|
4030
4208
|
var caseNotStated = "not_stated";
|
|
4031
4209
|
var abstain = "cannot_determine";
|
|
4032
|
-
function isMatchOf(
|
|
4033
|
-
if (check?.kind !== "case_answer" ||
|
|
4034
|
-
return check?.kind === "semantic_question" &&
|
|
4210
|
+
function isMatchOf(question3, check) {
|
|
4211
|
+
if (check?.kind !== "case_answer" || question3.aggregation !== "match") {
|
|
4212
|
+
return check?.kind === "semantic_question" && question3.aggregation !== "match";
|
|
4035
4213
|
}
|
|
4036
|
-
const offered = new Set(
|
|
4214
|
+
const offered = new Set(question3.options.map((option2) => option2.value));
|
|
4037
4215
|
const expected2 = [...(check.answers ?? []).map((row2) => row2.value), caseNotStated, abstain];
|
|
4038
|
-
return offered.size ===
|
|
4216
|
+
return offered.size === question3.options.length && offered.size === expected2.length && expected2.every((value2) => offered.has(value2));
|
|
4039
4217
|
}
|
|
4040
4218
|
function isAsking(check) {
|
|
4041
4219
|
const isAsker = check.kind === "semantic_question" || check.kind === "case_answer";
|
|
@@ -4045,22 +4223,22 @@ function inspectSemantic(manifest2, issue) {
|
|
|
4045
4223
|
const askers = manifest2.checks.filter(isAsking);
|
|
4046
4224
|
const asked = askers.map((check) => check.questionId ?? "");
|
|
4047
4225
|
const questions = manifest2.semantic?.questions ?? [];
|
|
4048
|
-
for (const
|
|
4049
|
-
const asker = askers.find((check) => check.questionId ===
|
|
4050
|
-
if (!isMatchOf(
|
|
4226
|
+
for (const question3 of questions) {
|
|
4227
|
+
const asker = askers.find((check) => check.questionId === question3.id);
|
|
4228
|
+
if (!isMatchOf(question3, asker)) {
|
|
4051
4229
|
issue("A semantic question's aggregation differs from the check that asks it");
|
|
4052
4230
|
}
|
|
4053
4231
|
}
|
|
4054
4232
|
const distinctAsked = new Set(asked);
|
|
4055
|
-
if (distinctAsked.size !== asked.length || asked.length !== questions.length || questions.some((
|
|
4233
|
+
if (distinctAsked.size !== asked.length || asked.length !== questions.length || questions.some((question3) => !distinctAsked.has(question3.id))) {
|
|
4056
4234
|
issue("Every released semantic question is asked by exactly one check");
|
|
4057
4235
|
}
|
|
4058
|
-
for (const
|
|
4059
|
-
if (
|
|
4236
|
+
for (const question3 of questions) {
|
|
4237
|
+
if (question3.aggregation === "match") {
|
|
4060
4238
|
continue;
|
|
4061
4239
|
}
|
|
4062
|
-
const effects = new Set(
|
|
4063
|
-
const needed =
|
|
4240
|
+
const effects = new Set(question3.options.map((option2) => option2.effect));
|
|
4241
|
+
const needed = question3.aggregation === "prohibit" ? "violated" : "satisfied";
|
|
4064
4242
|
if (!effects.has(needed)) {
|
|
4065
4243
|
issue("A semantic question needs an option that can decide its aggregation");
|
|
4066
4244
|
}
|
|
@@ -4080,15 +4258,15 @@ var artifactLintLimits = {
|
|
|
4080
4258
|
maxLiteralUnits: 512,
|
|
4081
4259
|
maxOccurrencesPerCheck: 16
|
|
4082
4260
|
};
|
|
4083
|
-
function isWellFormedText(
|
|
4084
|
-
return !/\p{Cs}/u.test(
|
|
4261
|
+
function isWellFormedText(value2) {
|
|
4262
|
+
return !/\p{Cs}/u.test(value2);
|
|
4085
4263
|
}
|
|
4086
|
-
var literal =
|
|
4087
|
-
var passage =
|
|
4088
|
-
sourceLocator:
|
|
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),
|
|
4089
4267
|
contentDigest: digest21
|
|
4090
4268
|
});
|
|
4091
|
-
var common = { id: id4, required:
|
|
4269
|
+
var common = { id: id4, required: z48.boolean(), specification: passage };
|
|
4092
4270
|
var artifactCheckKinds = [
|
|
4093
4271
|
"section",
|
|
4094
4272
|
"required_wording",
|
|
@@ -4101,64 +4279,64 @@ var artifactLintMediaTypes = [
|
|
|
4101
4279
|
"text/plain",
|
|
4102
4280
|
"application/vnd.felspar.structured-output+json"
|
|
4103
4281
|
];
|
|
4104
|
-
var sectionTargets =
|
|
4105
|
-
var ArtifactCheckSchema =
|
|
4106
|
-
|
|
4107
|
-
|
|
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({
|
|
4108
4286
|
...common,
|
|
4109
|
-
kind:
|
|
4287
|
+
kind: z48.literal("required_wording"),
|
|
4110
4288
|
sectionId: id4,
|
|
4111
|
-
alternatives:
|
|
4289
|
+
alternatives: z48.array(literal).min(1).max(artifactLintLimits.maxAlternatives)
|
|
4112
4290
|
}),
|
|
4113
|
-
|
|
4291
|
+
z48.strictObject({
|
|
4114
4292
|
...common,
|
|
4115
|
-
kind:
|
|
4293
|
+
kind: z48.literal("prohibited_literal"),
|
|
4116
4294
|
sectionIds: sectionTargets,
|
|
4117
|
-
literals:
|
|
4295
|
+
literals: z48.array(literal).min(1).max(artifactLintLimits.maxLiterals)
|
|
4118
4296
|
}),
|
|
4119
|
-
|
|
4297
|
+
z48.strictObject({
|
|
4120
4298
|
...common,
|
|
4121
|
-
kind:
|
|
4299
|
+
kind: z48.literal("field_value"),
|
|
4122
4300
|
sectionId: id4,
|
|
4123
|
-
label:
|
|
4124
|
-
unit:
|
|
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(),
|
|
4125
4303
|
evidenceKey: id4,
|
|
4126
|
-
comparator:
|
|
4304
|
+
comparator: z48.enum(["eq", "lte", "gte"])
|
|
4127
4305
|
}),
|
|
4128
|
-
|
|
4306
|
+
z48.strictObject({
|
|
4129
4307
|
...common,
|
|
4130
|
-
kind:
|
|
4308
|
+
kind: z48.literal("case_answer"),
|
|
4131
4309
|
sectionIds: sectionTargets,
|
|
4132
|
-
fact:
|
|
4133
|
-
|
|
4134
|
-
|
|
4310
|
+
fact: z48.discriminatedUnion("comparison", [
|
|
4311
|
+
z48.strictObject({ key: id4, comparison: z48.literal("choice") }),
|
|
4312
|
+
z48.strictObject({
|
|
4135
4313
|
key: id4,
|
|
4136
|
-
comparison:
|
|
4314
|
+
comparison: z48.literal("number"),
|
|
4137
4315
|
reader: ExactReaderSchema.options[0]
|
|
4138
4316
|
}),
|
|
4139
|
-
|
|
4317
|
+
z48.strictObject({
|
|
4140
4318
|
key: id4,
|
|
4141
|
-
comparison:
|
|
4319
|
+
comparison: z48.literal("date"),
|
|
4142
4320
|
reader: ExactReaderSchema.options[1]
|
|
4143
4321
|
})
|
|
4144
4322
|
]),
|
|
4145
|
-
answers:
|
|
4323
|
+
answers: z48.array(z48.strictObject({
|
|
4146
4324
|
value: id4,
|
|
4147
|
-
wording:
|
|
4325
|
+
wording: z48.array(literal).max(artifactLintLimits.maxAlternatives)
|
|
4148
4326
|
})).max(artifactLintLimits.maxLiterals),
|
|
4149
4327
|
questionId: id4.nullable()
|
|
4150
4328
|
}),
|
|
4151
|
-
|
|
4329
|
+
z48.strictObject({
|
|
4152
4330
|
...common,
|
|
4153
|
-
kind:
|
|
4331
|
+
kind: z48.literal("semantic_question"),
|
|
4154
4332
|
sectionIds: sectionTargets,
|
|
4155
4333
|
questionId: id4
|
|
4156
4334
|
})
|
|
4157
4335
|
]);
|
|
4158
|
-
var sectionDeclaration =
|
|
4336
|
+
var sectionDeclaration = z48.strictObject({
|
|
4159
4337
|
id: id4,
|
|
4160
|
-
heading:
|
|
4161
|
-
maxUnits:
|
|
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)
|
|
4162
4340
|
});
|
|
4163
4341
|
function caseAnswerIssues(checks) {
|
|
4164
4342
|
const issues = [];
|
|
@@ -4178,18 +4356,18 @@ function caseAnswerIssues(checks) {
|
|
|
4178
4356
|
}
|
|
4179
4357
|
return issues;
|
|
4180
4358
|
}
|
|
4181
|
-
var ArtifactCheckManifestSchema =
|
|
4182
|
-
schema:
|
|
4359
|
+
var ArtifactCheckManifestSchema = z48.strictObject({
|
|
4360
|
+
schema: z48.literal("felspar.artifact-check-manifest.draft/v1"),
|
|
4183
4361
|
id: id4,
|
|
4184
|
-
version:
|
|
4362
|
+
version: z48.number().int().min(1).max(65535),
|
|
4185
4363
|
jobId: id4,
|
|
4186
4364
|
trustDomain: id4,
|
|
4187
|
-
contract:
|
|
4188
|
-
parser:
|
|
4189
|
-
maxBytes:
|
|
4190
|
-
sections:
|
|
4191
|
-
caseContext:
|
|
4192
|
-
checks:
|
|
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),
|
|
4193
4371
|
semantic: ArtifactSemanticRecipeSchema.nullable()
|
|
4194
4372
|
}).superRefine((manifest2, context3) => {
|
|
4195
4373
|
const issue = (message) => {
|
|
@@ -4234,11 +4412,11 @@ var ArtifactCheckManifestSchema = z47.strictObject({
|
|
|
4234
4412
|
var ArtifactSpecificationSchema = passage;
|
|
4235
4413
|
|
|
4236
4414
|
// ../schemas/src/draft-job-obligations-manifest.ts
|
|
4237
|
-
import { z as
|
|
4415
|
+
import { z as z49 } from "zod";
|
|
4238
4416
|
var id5 = DraftApplicationScopeSchema.shape.authorityId;
|
|
4239
4417
|
var digest22 = DraftJobReceiptSchema.shape.receiptDigest;
|
|
4240
4418
|
var passage2 = {
|
|
4241
|
-
sourceLocator:
|
|
4419
|
+
sourceLocator: z49.string().min(1).max(4096).regex(/\S/u),
|
|
4242
4420
|
contentDigest: digest22
|
|
4243
4421
|
};
|
|
4244
4422
|
var jobObligationsLimits = {
|
|
@@ -4249,41 +4427,41 @@ var jobObligationsLimits = {
|
|
|
4249
4427
|
maxApprovalTargets: 16,
|
|
4250
4428
|
maxManifestBytes: 65536
|
|
4251
4429
|
};
|
|
4252
|
-
var DraftJobObligationsScopeSchema =
|
|
4430
|
+
var DraftJobObligationsScopeSchema = z49.strictObject({
|
|
4253
4431
|
purposeRef: id5,
|
|
4254
4432
|
useRef: id5.nullable()
|
|
4255
4433
|
});
|
|
4256
|
-
var artifact =
|
|
4434
|
+
var artifact = z49.strictObject({
|
|
4257
4435
|
id: id5,
|
|
4258
4436
|
role: id5,
|
|
4259
|
-
contract:
|
|
4437
|
+
contract: z49.strictObject({ id: id5, digest: digest22 }),
|
|
4260
4438
|
...passage2
|
|
4261
4439
|
});
|
|
4262
|
-
var approval =
|
|
4440
|
+
var approval = z49.strictObject({
|
|
4263
4441
|
id: id5,
|
|
4264
|
-
policy:
|
|
4265
|
-
phase:
|
|
4266
|
-
appliesTo:
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
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") })
|
|
4270
4448
|
])).min(1).max(jobObligationsLimits.maxApprovalTargets)
|
|
4271
4449
|
});
|
|
4272
|
-
var outcome =
|
|
4450
|
+
var outcome = z49.strictObject({
|
|
4273
4451
|
outcomeId: id5,
|
|
4274
4452
|
...passage2,
|
|
4275
|
-
contextRequired:
|
|
4276
|
-
artifacts:
|
|
4277
|
-
approvals:
|
|
4453
|
+
contextRequired: z49.boolean(),
|
|
4454
|
+
artifacts: z49.array(artifact).max(jobObligationsLimits.maxArtifacts),
|
|
4455
|
+
approvals: z49.array(approval).max(jobObligationsLimits.maxApprovals)
|
|
4278
4456
|
});
|
|
4279
|
-
var manifest =
|
|
4280
|
-
schema:
|
|
4457
|
+
var manifest = z49.strictObject({
|
|
4458
|
+
schema: z49.literal("felspar.job-obligations.draft/v0"),
|
|
4281
4459
|
jobId: id5,
|
|
4282
4460
|
trustDomain: id5,
|
|
4283
4461
|
scope: DraftJobObligationsScopeSchema,
|
|
4284
4462
|
source: DraftSourceReferenceSchema,
|
|
4285
|
-
contracts:
|
|
4286
|
-
outcomes:
|
|
4463
|
+
contracts: z49.array(z49.strictObject({ id: id5, ...passage2 })).max(jobObligationsLimits.maxContracts),
|
|
4464
|
+
outcomes: z49.array(outcome).min(1).max(jobObligationsLimits.maxOutcomes)
|
|
4287
4465
|
});
|
|
4288
4466
|
function unique3(values, context3, path3) {
|
|
4289
4467
|
const distinct = new Set(values);
|
|
@@ -4291,16 +4469,16 @@ function unique3(values, context3, path3) {
|
|
|
4291
4469
|
context3.addIssue({ code: "custom", path: path3, message: "Duplicate obligation identity or target" });
|
|
4292
4470
|
}
|
|
4293
4471
|
}
|
|
4294
|
-
function isApprovalTargetValid(item,
|
|
4472
|
+
function isApprovalTargetValid(item, target2, useRef) {
|
|
4295
4473
|
switch (item.phase) {
|
|
4296
4474
|
case "before_decision": {
|
|
4297
|
-
return
|
|
4475
|
+
return target2.kind === "decision";
|
|
4298
4476
|
}
|
|
4299
4477
|
case "before_generation": {
|
|
4300
|
-
return
|
|
4478
|
+
return target2.kind === "artifact";
|
|
4301
4479
|
}
|
|
4302
4480
|
case "before_use": {
|
|
4303
|
-
return
|
|
4481
|
+
return target2.kind === "artifact" || target2.kind === "use" && useRef !== null;
|
|
4304
4482
|
}
|
|
4305
4483
|
default: {
|
|
4306
4484
|
return false;
|
|
@@ -4308,11 +4486,11 @@ function isApprovalTargetValid(item, target, useRef) {
|
|
|
4308
4486
|
}
|
|
4309
4487
|
}
|
|
4310
4488
|
function inspectApproval(item, binding, context3) {
|
|
4311
|
-
unique3(item.appliesTo.map((
|
|
4312
|
-
const artifacts = new Set(binding.selected.artifacts.map((
|
|
4313
|
-
for (const
|
|
4314
|
-
const isKnown =
|
|
4315
|
-
const isValid = isApprovalTargetValid(item,
|
|
4489
|
+
unique3(item.appliesTo.map((target2) => JSON.stringify(target2)), context3, ["approvals", item.id]);
|
|
4490
|
+
const artifacts = new Set(binding.selected.artifacts.map((entry3) => entry3.id));
|
|
4491
|
+
for (const target2 of item.appliesTo) {
|
|
4492
|
+
const isKnown = target2.kind !== "artifact" || artifacts.has(target2.id);
|
|
4493
|
+
const isValid = isApprovalTargetValid(item, target2, binding.scope.useRef);
|
|
4316
4494
|
if (!isKnown || !isValid) {
|
|
4317
4495
|
context3.addIssue({
|
|
4318
4496
|
code: "custom",
|
|
@@ -4322,18 +4500,18 @@ function inspectApproval(item, binding, context3) {
|
|
|
4322
4500
|
}
|
|
4323
4501
|
}
|
|
4324
4502
|
}
|
|
4325
|
-
function inspectManifest(
|
|
4503
|
+
function inspectManifest(value2, context3) {
|
|
4326
4504
|
if (context3.issues.length > 0) {
|
|
4327
4505
|
return;
|
|
4328
4506
|
}
|
|
4329
|
-
unique3(
|
|
4330
|
-
unique3(
|
|
4331
|
-
const contracts = new Map(
|
|
4332
|
-
for (const selected of
|
|
4333
|
-
unique3(selected.artifacts.map((
|
|
4334
|
-
unique3(selected.approvals.map((
|
|
4335
|
-
for (const
|
|
4336
|
-
if (contracts.get(
|
|
4507
|
+
unique3(value2.contracts.map((entry3) => entry3.id), context3, ["contracts"]);
|
|
4508
|
+
unique3(value2.outcomes.map((entry3) => entry3.outcomeId), context3, ["outcomes"]);
|
|
4509
|
+
const contracts = new Map(value2.contracts.map((entry3) => [entry3.id, entry3.contentDigest]));
|
|
4510
|
+
for (const selected of value2.outcomes) {
|
|
4511
|
+
unique3(selected.artifacts.map((entry3) => entry3.id), context3, ["outcomes", selected.outcomeId, "artifacts"]);
|
|
4512
|
+
unique3(selected.approvals.map((entry3) => entry3.id), context3, ["outcomes", selected.outcomeId, "approvals"]);
|
|
4513
|
+
for (const entry3 of selected.artifacts) {
|
|
4514
|
+
if (contracts.get(entry3.contract.id) !== entry3.contract.digest) {
|
|
4337
4515
|
context3.addIssue({
|
|
4338
4516
|
code: "custom",
|
|
4339
4517
|
message: "Dangling or mismatched specification reference"
|
|
@@ -4341,11 +4519,11 @@ function inspectManifest(value, context3) {
|
|
|
4341
4519
|
}
|
|
4342
4520
|
}
|
|
4343
4521
|
for (const item of selected.approvals) {
|
|
4344
|
-
inspectApproval(item, { selected, scope:
|
|
4522
|
+
inspectApproval(item, { selected, scope: value2.scope }, context3);
|
|
4345
4523
|
}
|
|
4346
4524
|
}
|
|
4347
4525
|
const encoder2 = new TextEncoder();
|
|
4348
|
-
if (encoder2.encode(JSON.stringify(
|
|
4526
|
+
if (encoder2.encode(JSON.stringify(value2)).length > jobObligationsLimits.maxManifestBytes) {
|
|
4349
4527
|
context3.addIssue({ code: "custom", message: "Obligations manifest byte limit exceeded" });
|
|
4350
4528
|
}
|
|
4351
4529
|
}
|
|
@@ -4354,19 +4532,19 @@ var DraftJobObligationsOutcomeSchema = outcome;
|
|
|
4354
4532
|
|
|
4355
4533
|
// ../schemas/src/draft-hosted-output-checks.ts
|
|
4356
4534
|
var hostedOutputCheckLimits = { maxOutputs: 8 };
|
|
4357
|
-
var HostedOutputChecksSchema =
|
|
4358
|
-
schema:
|
|
4535
|
+
var HostedOutputChecksSchema = z50.strictObject({
|
|
4536
|
+
schema: z50.literal("felspar.output-checks.draft/v0"),
|
|
4359
4537
|
obligations: DraftJobObligationsSchema,
|
|
4360
|
-
manifests:
|
|
4361
|
-
}).superRefine((
|
|
4538
|
+
manifests: z50.array(ArtifactCheckManifestSchema).min(1).max(hostedOutputCheckLimits.maxOutputs)
|
|
4539
|
+
}).superRefine((value2, context3) => {
|
|
4362
4540
|
if (context3.issues.length > 0) {
|
|
4363
4541
|
return;
|
|
4364
4542
|
}
|
|
4365
4543
|
const issue = (message) => {
|
|
4366
4544
|
context3.addIssue({ code: "custom", message });
|
|
4367
4545
|
};
|
|
4368
|
-
const { obligations, manifests } =
|
|
4369
|
-
const contracts = new Map(obligations.contracts.map((
|
|
4546
|
+
const { obligations, manifests } = value2;
|
|
4547
|
+
const contracts = new Map(obligations.contracts.map((entry3) => [entry3.id, entry3]));
|
|
4370
4548
|
const checked = new Set(manifests.map((manifest2) => manifest2.contract.id));
|
|
4371
4549
|
if (checked.size !== manifests.length) {
|
|
4372
4550
|
issue("One manifest per output contract");
|
|
@@ -4377,20 +4555,20 @@ var HostedOutputChecksSchema = z49.strictObject({
|
|
|
4377
4555
|
issue("A manifest differs from its job or contract");
|
|
4378
4556
|
}
|
|
4379
4557
|
}
|
|
4380
|
-
const required = obligations.outcomes.flatMap((
|
|
4558
|
+
const required = obligations.outcomes.flatMap((entry3) => entry3.artifacts.map((artifact2) => artifact2.contract.id));
|
|
4381
4559
|
if (required.some((contractId) => !checked.has(contractId)) || checked.size > contracts.size) {
|
|
4382
4560
|
issue("Every required output needs exactly one manifest");
|
|
4383
4561
|
}
|
|
4384
4562
|
});
|
|
4385
4563
|
|
|
4386
4564
|
// ../schemas/src/draft-pack-revision.ts
|
|
4387
|
-
import { z as
|
|
4565
|
+
import { z as z56 } from "zod";
|
|
4388
4566
|
|
|
4389
4567
|
// ../schemas/src/draft-pack-draft-outputs.ts
|
|
4390
|
-
import { z as
|
|
4391
|
-
var identifier21 =
|
|
4392
|
-
var quote =
|
|
4393
|
-
var wording =
|
|
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");
|
|
4394
4572
|
var packDraftOutputLimits = {
|
|
4395
4573
|
maxOutputs: 8,
|
|
4396
4574
|
maxChecks: 16,
|
|
@@ -4399,26 +4577,26 @@ var packDraftOutputLimits = {
|
|
|
4399
4577
|
defaultCharacters: 8e3,
|
|
4400
4578
|
maxCharacters: artifactLintLimits.maxSectionUnits
|
|
4401
4579
|
};
|
|
4402
|
-
var wordingCheck = (max) =>
|
|
4403
|
-
var PackDraftOutputSchema =
|
|
4580
|
+
var wordingCheck = (max) => z51.strictObject({ id: identifier21, quote, wording: z51.array(wording).min(1).max(max) });
|
|
4581
|
+
var PackDraftOutputSchema = z51.strictObject({
|
|
4404
4582
|
id: identifier21,
|
|
4405
4583
|
what: quote,
|
|
4406
|
-
outcomes:
|
|
4407
|
-
maxCharacters:
|
|
4408
|
-
context:
|
|
4409
|
-
require:
|
|
4410
|
-
prohibit:
|
|
4411
|
-
ask:
|
|
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({
|
|
4412
4590
|
id: identifier21,
|
|
4413
4591
|
quote,
|
|
4414
|
-
kind:
|
|
4415
|
-
question:
|
|
4592
|
+
kind: z51.enum(["require", "prohibit"]),
|
|
4593
|
+
question: z51.string().min(1).max(2e3).regex(/\S/u)
|
|
4416
4594
|
})).max(packDraftOutputLimits.maxQuestions).optional(),
|
|
4417
|
-
states:
|
|
4595
|
+
states: z51.array(z51.strictObject({
|
|
4418
4596
|
id: identifier21,
|
|
4419
4597
|
quote,
|
|
4420
4598
|
question: identifier21,
|
|
4421
|
-
wording:
|
|
4599
|
+
wording: z51.record(identifier21, z51.array(wording).min(1).max(8)).optional()
|
|
4422
4600
|
})).max(packDraftOutputLimits.maxQuestions).optional()
|
|
4423
4601
|
}).refine((output) => {
|
|
4424
4602
|
const ids3 = [
|
|
@@ -4433,22 +4611,22 @@ var PackDraftOutputSchema = z50.strictObject({
|
|
|
4433
4611
|
}, `At most ${packDraftOutputLimits.maxQuestions} asked questions and stated answers together`).refine((output) => {
|
|
4434
4612
|
return (output.require?.length ?? 0) + (output.prohibit?.length ?? 0) + (output.ask?.length ?? 0) + (output.states?.length ?? 0) > 0;
|
|
4435
4613
|
}, "An output needs at least one check");
|
|
4436
|
-
var PackDraftOutputsSchema =
|
|
4614
|
+
var PackDraftOutputsSchema = z51.array(PackDraftOutputSchema).min(1).max(packDraftOutputLimits.maxOutputs).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate output");
|
|
4437
4615
|
|
|
4438
4616
|
// ../schemas/src/draft-pack-draft-scoring.ts
|
|
4439
|
-
import { z as
|
|
4440
|
-
var points =
|
|
4441
|
-
var PackDraftScoreSchema =
|
|
4617
|
+
import { z as z52 } from "zod";
|
|
4618
|
+
var points = z52.number().min(0).max(1e6);
|
|
4619
|
+
var PackDraftScoreSchema = z52.strictObject({
|
|
4442
4620
|
lt: points.optional(),
|
|
4443
4621
|
lte: points.optional(),
|
|
4444
4622
|
gt: points.optional(),
|
|
4445
4623
|
gte: points.optional(),
|
|
4446
4624
|
eq: points.optional(),
|
|
4447
4625
|
quote: draftQuote
|
|
4448
|
-
}).superRefine((
|
|
4449
|
-
const lower = Number(
|
|
4450
|
-
const upper = Number(
|
|
4451
|
-
const hasEquality =
|
|
4626
|
+
}).superRefine((value2, context3) => {
|
|
4627
|
+
const lower = Number(value2.gt !== void 0) + Number(value2.gte !== void 0);
|
|
4628
|
+
const upper = Number(value2.lt !== void 0) + Number(value2.lte !== void 0);
|
|
4629
|
+
const hasEquality = value2.eq !== void 0;
|
|
4452
4630
|
if (lower + upper + Number(hasEquality) === 0) {
|
|
4453
4631
|
context3.addIssue({ code: "custom", message: "Give a bound: lt, lte, gt, gte or eq" });
|
|
4454
4632
|
} else if (lower > 1 || upper > 1) {
|
|
@@ -4457,170 +4635,723 @@ var PackDraftScoreSchema = z51.strictObject({
|
|
|
4457
4635
|
context3.addIssue({ code: "custom", message: "eq stands alone" });
|
|
4458
4636
|
}
|
|
4459
4637
|
});
|
|
4460
|
-
var contribution2 =
|
|
4638
|
+
var contribution2 = z52.strictObject({
|
|
4461
4639
|
id: draftIdentifier,
|
|
4462
4640
|
points,
|
|
4463
4641
|
quote: draftQuote,
|
|
4464
4642
|
when: PackDraftConditionsSchema
|
|
4465
4643
|
});
|
|
4466
|
-
var criterion2 =
|
|
4644
|
+
var criterion2 = z52.strictObject({
|
|
4467
4645
|
id: draftIdentifier,
|
|
4468
4646
|
meaning: draftQuote,
|
|
4469
4647
|
activeWhen: PackDraftConditionsSchema.optional(),
|
|
4470
|
-
points:
|
|
4471
|
-
otherwise:
|
|
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()
|
|
4472
4650
|
});
|
|
4473
|
-
var PackDraftScoringSchema =
|
|
4474
|
-
scale:
|
|
4475
|
-
criteria:
|
|
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")
|
|
4476
4654
|
});
|
|
4477
4655
|
var packDraftScoreExpectation = {
|
|
4478
|
-
score:
|
|
4479
|
-
points:
|
|
4656
|
+
score: z52.number().min(0).optional(),
|
|
4657
|
+
points: z52.record(draftIdentifier, z52.number().min(0).nullable()).optional()
|
|
4480
4658
|
};
|
|
4481
4659
|
|
|
4660
|
+
// ../schemas/src/draft-pack-draft.ts
|
|
4661
|
+
import { z as z55 } from "zod";
|
|
4662
|
+
|
|
4663
|
+
// ../schemas/src/draft-pack-draft-coverage.ts
|
|
4664
|
+
import { z as z53 } from "zod";
|
|
4665
|
+
var coverageDispositions = ["represented", "needs_review", "unsupported"];
|
|
4666
|
+
var coverageTargetKinds = [
|
|
4667
|
+
"question",
|
|
4668
|
+
"rule",
|
|
4669
|
+
"outcome",
|
|
4670
|
+
"escalation",
|
|
4671
|
+
"subject"
|
|
4672
|
+
];
|
|
4673
|
+
var coverageFields = [
|
|
4674
|
+
"purpose",
|
|
4675
|
+
"useWhen",
|
|
4676
|
+
"notFor",
|
|
4677
|
+
"owner",
|
|
4678
|
+
"evidenceKinds",
|
|
4679
|
+
"maxEvidenceAgeDays",
|
|
4680
|
+
"manualFacts",
|
|
4681
|
+
"businessDays",
|
|
4682
|
+
"whenUnresolved",
|
|
4683
|
+
"attempts",
|
|
4684
|
+
"scoring",
|
|
4685
|
+
"outputChecks",
|
|
4686
|
+
"subject"
|
|
4687
|
+
];
|
|
4688
|
+
var target = z53.union([
|
|
4689
|
+
...coverageTargetKinds.map((kind) => z53.strictObject({ [kind]: draftIdentifier })),
|
|
4690
|
+
z53.strictObject({ field: z53.enum(coverageFields) })
|
|
4691
|
+
]);
|
|
4692
|
+
var entry2 = z53.strictObject({
|
|
4693
|
+
quote: draftQuote,
|
|
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()
|
|
4698
|
+
}).superRefine((row2, context3) => {
|
|
4699
|
+
const isRepresented = row2.disposition === "represented";
|
|
4700
|
+
if (isRepresented && row2.carriedBy === void 0) {
|
|
4701
|
+
context3.addIssue({
|
|
4702
|
+
code: "custom",
|
|
4703
|
+
path: ["carriedBy"],
|
|
4704
|
+
message: "Name what carries a represented passage: a question, rule, outcome, escalation or subject"
|
|
4705
|
+
});
|
|
4706
|
+
}
|
|
4707
|
+
if (!isRepresented && row2.why === void 0) {
|
|
4708
|
+
context3.addIssue({
|
|
4709
|
+
code: "custom",
|
|
4710
|
+
path: ["why"],
|
|
4711
|
+
message: "Say why it is open or left out, for the owner"
|
|
4712
|
+
});
|
|
4713
|
+
}
|
|
4714
|
+
if (!isRepresented && row2.carriedBy !== void 0) {
|
|
4715
|
+
context3.addIssue({
|
|
4716
|
+
code: "custom",
|
|
4717
|
+
path: ["carriedBy"],
|
|
4718
|
+
message: "Only a represented passage is carried by the pack"
|
|
4719
|
+
});
|
|
4720
|
+
}
|
|
4721
|
+
});
|
|
4722
|
+
var PackDraftCoverageSchema = z53.array(entry2).min(1).max(128);
|
|
4723
|
+
|
|
4724
|
+
// ../schemas/src/draft-pack-draft-readings.ts
|
|
4725
|
+
import { z as z54 } from "zod";
|
|
4726
|
+
var readingCheckLimits = {
|
|
4727
|
+
maxPerAnswer: 8,
|
|
4728
|
+
maxPerCheck: 96,
|
|
4729
|
+
maxKept: 200,
|
|
4730
|
+
maxCharacters: 2e3,
|
|
4731
|
+
maxLabelCharacters: 120
|
|
4732
|
+
};
|
|
4733
|
+
var PackDraftReadingTestSchema = z54.strictObject({
|
|
4734
|
+
id: draftIdentifier,
|
|
4735
|
+
question: draftIdentifier,
|
|
4736
|
+
text: z54.string().trim().min(1).max(readingCheckLimits.maxCharacters),
|
|
4737
|
+
expect: draftValue
|
|
4738
|
+
});
|
|
4739
|
+
var PackDraftReadingTestsSchema = z54.array(PackDraftReadingTestSchema).min(1).max(readingCheckLimits.maxKept).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate reading test");
|
|
4740
|
+
function readingTestIssue(row2, questions, path3) {
|
|
4741
|
+
const question3 = questions.find((item) => item.key === row2.question);
|
|
4742
|
+
if (question3 === void 0 || question3.type !== void 0 || question3.derive !== void 0) {
|
|
4743
|
+
return {
|
|
4744
|
+
path: [...path3, "question"],
|
|
4745
|
+
message: `"${row2.question}" is not a choice question Felspar reads from text`
|
|
4746
|
+
};
|
|
4747
|
+
}
|
|
4748
|
+
const answers2 = question3.answers ?? [];
|
|
4749
|
+
return answers2.every((answer) => answer.value !== row2.expect) ? {
|
|
4750
|
+
path: [...path3, "expect"],
|
|
4751
|
+
message: `"${row2.expect}" is not one of the answers of "${row2.question}"`
|
|
4752
|
+
} : null;
|
|
4753
|
+
}
|
|
4754
|
+
function readingTestIssues(tests, questions) {
|
|
4755
|
+
const issues = [];
|
|
4756
|
+
const perAnswer = /* @__PURE__ */ new Map();
|
|
4757
|
+
const rows = tests ?? [];
|
|
4758
|
+
for (const [index, row2] of rows.entries()) {
|
|
4759
|
+
const path3 = ["readingTests", index];
|
|
4760
|
+
const issue = readingTestIssue(row2, questions, path3);
|
|
4761
|
+
const at = JSON.stringify([row2.question, row2.expect]);
|
|
4762
|
+
const count2 = (perAnswer.get(at) ?? 0) + 1;
|
|
4763
|
+
perAnswer.set(at, count2);
|
|
4764
|
+
if (issue !== null) {
|
|
4765
|
+
issues.push(issue);
|
|
4766
|
+
} else if (count2 > readingCheckLimits.maxPerAnswer) {
|
|
4767
|
+
issues.push({
|
|
4768
|
+
path: path3,
|
|
4769
|
+
message: `At most ${readingCheckLimits.maxPerAnswer} reading tests per answer`
|
|
4770
|
+
});
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
return issues;
|
|
4774
|
+
}
|
|
4775
|
+
var variant = z54.strictObject({
|
|
4776
|
+
id: draftIdentifier.optional(),
|
|
4777
|
+
question: draftIdentifier,
|
|
4778
|
+
text: z54.string().trim().min(1).max(readingCheckLimits.maxCharacters),
|
|
4779
|
+
expect: draftValue.optional(),
|
|
4780
|
+
label: z54.string().trim().min(1).max(readingCheckLimits.maxLabelCharacters).optional()
|
|
4781
|
+
});
|
|
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)
|
|
4787
|
+
});
|
|
4788
|
+
var readingResults = ["as_expected", "different", "held", "read", "not_read"];
|
|
4789
|
+
var readingReasons = [
|
|
4790
|
+
"below_bar",
|
|
4791
|
+
"cannot_tell",
|
|
4792
|
+
"tie",
|
|
4793
|
+
"looks_like_instructions",
|
|
4794
|
+
"evaluation_off",
|
|
4795
|
+
"limit_reached",
|
|
4796
|
+
"not_answered"
|
|
4797
|
+
];
|
|
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(),
|
|
4808
|
+
confidence: probability.nullable(),
|
|
4809
|
+
bar: probability,
|
|
4810
|
+
reason: z54.enum(readingReasons).nullable()
|
|
4811
|
+
});
|
|
4812
|
+
var count = z54.number().int().min(0);
|
|
4813
|
+
var counts = z54.strictObject({
|
|
4814
|
+
as_expected: count,
|
|
4815
|
+
different: count,
|
|
4816
|
+
held: count,
|
|
4817
|
+
read: count,
|
|
4818
|
+
not_read: count
|
|
4819
|
+
});
|
|
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"]),
|
|
4825
|
+
counts,
|
|
4826
|
+
questions: z54.array(z54.strictObject({ question: z54.string(), bar: probability, counts })),
|
|
4827
|
+
readings: z54.array(ReadingOutcomeSchema)
|
|
4828
|
+
});
|
|
4829
|
+
|
|
4830
|
+
// ../schemas/src/draft-pack-draft.ts
|
|
4831
|
+
var identifier22 = draftIdentifier;
|
|
4832
|
+
var quote2 = draftQuote;
|
|
4833
|
+
var value = draftValue;
|
|
4834
|
+
var conditions = PackDraftConditionsSchema;
|
|
4835
|
+
var ruleOrders = ["first-match", "unordered"];
|
|
4836
|
+
var packDraftVersions = [
|
|
4837
|
+
"felspar.pack-draft/v0",
|
|
4838
|
+
"felspar.pack-draft/v1",
|
|
4839
|
+
"felspar.pack-draft/v2"
|
|
4840
|
+
];
|
|
4841
|
+
var answers = z55.array(z55.strictObject({
|
|
4842
|
+
value,
|
|
4843
|
+
meaning: quote2,
|
|
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()
|
|
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");
|
|
4850
|
+
var derive = z55.strictObject({
|
|
4851
|
+
from: identifier22,
|
|
4852
|
+
when: z55.record(value, z55.union([value, z55.array(value).min(2).max(64)])),
|
|
4853
|
+
otherwise: value.optional()
|
|
4854
|
+
});
|
|
4855
|
+
var notDerived = [
|
|
4856
|
+
"type",
|
|
4857
|
+
"askOnlyWhen",
|
|
4858
|
+
"whereToLook",
|
|
4859
|
+
"about",
|
|
4860
|
+
"evidence",
|
|
4861
|
+
"minimumConfidence",
|
|
4862
|
+
"highConsequence"
|
|
4863
|
+
];
|
|
4864
|
+
function computedIssue(field) {
|
|
4865
|
+
return {
|
|
4866
|
+
path: [field],
|
|
4867
|
+
message: `A derived question is computed, never asked: it has no ${field}`
|
|
4868
|
+
};
|
|
4869
|
+
}
|
|
4870
|
+
function deriveIssues(row2) {
|
|
4871
|
+
const rule3 = row2.derive;
|
|
4872
|
+
if (rule3 === void 0) {
|
|
4873
|
+
return [];
|
|
4874
|
+
}
|
|
4875
|
+
const present = notDerived.filter((field) => row2[field] !== void 0);
|
|
4876
|
+
const issues = present.map(computedIssue);
|
|
4877
|
+
const values = new Set((row2.answers ?? []).map((answer) => answer.value));
|
|
4878
|
+
const named = [
|
|
4879
|
+
...Object.keys(rule3.when),
|
|
4880
|
+
...rule3.otherwise === void 0 ? [] : [rule3.otherwise]
|
|
4881
|
+
];
|
|
4882
|
+
const unknown = named.filter((item) => !values.has(item));
|
|
4883
|
+
for (const answer of unknown) {
|
|
4884
|
+
issues.push({ path: ["derive"], message: `"${answer}" is not one of this question's answers` });
|
|
4885
|
+
}
|
|
4886
|
+
if (rule3.otherwise !== void 0 && Object.hasOwn(rule3.when, rule3.otherwise)) {
|
|
4887
|
+
issues.push({
|
|
4888
|
+
path: ["derive", "otherwise"],
|
|
4889
|
+
message: "otherwise names an answer already in when"
|
|
4890
|
+
});
|
|
4891
|
+
}
|
|
4892
|
+
if ((row2.answers ?? []).some((answer) => answer.noneOfThese === true)) {
|
|
4893
|
+
issues.push({ path: ["answers"], message: "A derived question has no noneOfThese answer" });
|
|
4894
|
+
}
|
|
4895
|
+
return issues;
|
|
4896
|
+
}
|
|
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({
|
|
4900
|
+
evidenceKinds: evidenceKinds.optional(),
|
|
4901
|
+
maxEvidenceAgeDays: evidenceAge.optional(),
|
|
4902
|
+
quote: quote2
|
|
4903
|
+
}).refine((row2) => row2.evidenceKinds !== void 0 || row2.maxEvidenceAgeDays !== void 0, "Give evidenceKinds, maxEvidenceAgeDays or both");
|
|
4904
|
+
var minimumConfidence = z55.number().min(0.5).max(0.99);
|
|
4905
|
+
var question2 = z55.strictObject({
|
|
4906
|
+
key: identifier22,
|
|
4907
|
+
meaning: quote2,
|
|
4908
|
+
answers: answers.optional(),
|
|
4909
|
+
...typedQuestionFields,
|
|
4910
|
+
askOnlyWhen: conditions.optional(),
|
|
4911
|
+
whereToLook: z55.array(quote2).max(8).optional(),
|
|
4912
|
+
about: identifier22.optional(),
|
|
4913
|
+
derive: derive.optional(),
|
|
4914
|
+
evidence: questionEvidence.optional(),
|
|
4915
|
+
minimumConfidence: minimumConfidence.optional(),
|
|
4916
|
+
highConsequence: z55.literal(true).optional()
|
|
4917
|
+
}).superRefine((row2, context3) => {
|
|
4918
|
+
if (row2.type !== void 0 && row2.highConsequence !== void 0) {
|
|
4919
|
+
context3.addIssue({
|
|
4920
|
+
code: "custom",
|
|
4921
|
+
path: ["highConsequence"],
|
|
4922
|
+
message: "A number or date is read exactly, with no confidence bar to calibrate"
|
|
4923
|
+
});
|
|
4924
|
+
}
|
|
4925
|
+
if (row2.type !== void 0 && row2.minimumConfidence !== void 0) {
|
|
4926
|
+
context3.addIssue({
|
|
4927
|
+
code: "custom",
|
|
4928
|
+
path: ["minimumConfidence"],
|
|
4929
|
+
message: "A number or date is read exactly, with no confidence bar"
|
|
4930
|
+
});
|
|
4931
|
+
}
|
|
4932
|
+
for (const issue of questionIssues(row2)) {
|
|
4933
|
+
context3.addIssue({ code: "custom", ...issue });
|
|
4934
|
+
}
|
|
4935
|
+
for (const issue of deriveIssues(row2)) {
|
|
4936
|
+
context3.addIssue({ code: "custom", ...issue });
|
|
4937
|
+
}
|
|
4938
|
+
});
|
|
4939
|
+
var shape3 = z55.strictObject({
|
|
4940
|
+
schema: z55.enum(packDraftVersions),
|
|
4941
|
+
job: identifier22,
|
|
4942
|
+
purpose: quote2.optional(),
|
|
4943
|
+
useWhen: z55.array(quote2).min(1).max(8).optional(),
|
|
4944
|
+
notFor: z55.array(quote2).min(1).max(8).optional(),
|
|
4945
|
+
owner: quote2.optional(),
|
|
4946
|
+
evidenceKinds,
|
|
4947
|
+
maxEvidenceAgeDays: evidenceAge,
|
|
4948
|
+
manualFacts: z55.strictObject({ allowed: z55.literal(false), quote: quote2 }).optional(),
|
|
4949
|
+
...packConventionFields,
|
|
4950
|
+
businessDays: PackDraftBusinessDaysSchema.optional(),
|
|
4951
|
+
questions: z55.array(question2).min(1).max(64).refine((rows) => hasUniqueValues(rows.map((row2) => row2.key)), "Duplicate question"),
|
|
4952
|
+
subjects: PackDraftSubjectsSchema.optional(),
|
|
4953
|
+
subject: identifier22.optional(),
|
|
4954
|
+
escalations: PackDraftEscalationsSchema.optional(),
|
|
4955
|
+
outcomes: z55.array(z55.strictObject({
|
|
4956
|
+
id: identifier22,
|
|
4957
|
+
nextStep: quote2,
|
|
4958
|
+
escalate: identifier22.optional()
|
|
4959
|
+
})).min(1).max(64).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate outcome"),
|
|
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(),
|
|
4963
|
+
escalate: identifier22.optional()
|
|
4964
|
+
}).optional(),
|
|
4965
|
+
scoring: PackDraftScoringSchema.optional(),
|
|
4966
|
+
ruleOrder: z55.enum(ruleOrders).optional(),
|
|
4967
|
+
rules: z55.array(z55.strictObject({
|
|
4968
|
+
id: identifier22,
|
|
4969
|
+
meaning: quote2,
|
|
4970
|
+
when: conditions.optional(),
|
|
4971
|
+
score: PackDraftScoreSchema.optional(),
|
|
4972
|
+
gate: z55.literal(true).optional(),
|
|
4973
|
+
outcome: identifier22,
|
|
4974
|
+
except: z55.array(identifier22).min(1).max(16).refine(hasUniqueValues, "Duplicate rule").optional()
|
|
4975
|
+
})).min(1).max(256).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate rule"),
|
|
4976
|
+
cases: z55.array(z55.strictObject({
|
|
4977
|
+
id: identifier22,
|
|
4978
|
+
why: z55.string().min(1).max(2e3),
|
|
4979
|
+
facts: z55.record(identifier22, caseFactSchema),
|
|
4980
|
+
decisionDate: caseDecisionDate,
|
|
4981
|
+
subject: z55.strictObject({ id: SubjectIdSchema }).optional(),
|
|
4982
|
+
expect: z55.union([
|
|
4983
|
+
z55.strictObject({
|
|
4984
|
+
outcome: identifier22,
|
|
4985
|
+
rule: identifier22,
|
|
4986
|
+
escalation: identifier22.optional(),
|
|
4987
|
+
...packDraftScoreExpectation
|
|
4988
|
+
}),
|
|
4989
|
+
z55.strictObject({ held: z55.enum(heldStates), ...packDraftScoreExpectation })
|
|
4990
|
+
])
|
|
4991
|
+
})).min(1).max(200).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate case"),
|
|
4992
|
+
outputChecks: PackDraftOutputsSchema.optional(),
|
|
4993
|
+
readingTests: PackDraftReadingTestsSchema.optional(),
|
|
4994
|
+
coverage: PackDraftCoverageSchema.optional()
|
|
4995
|
+
});
|
|
4996
|
+
function comparisonPaths(when2, at) {
|
|
4997
|
+
const entries2 = Object.entries(when2 ?? {});
|
|
4998
|
+
return entries2.flatMap(([key3, condition]) => isComparison(condition) ? [[...at, key3]] : []);
|
|
4999
|
+
}
|
|
5000
|
+
function presentPaths(row2, fields, at) {
|
|
5001
|
+
return fields.filter((field) => row2[field] !== void 0).map((field) => [...at, field]);
|
|
5002
|
+
}
|
|
5003
|
+
function casePaths(row2, at) {
|
|
5004
|
+
const facts = Object.entries(row2.facts);
|
|
5005
|
+
const isTyped = (fact) => typeof fact !== "string";
|
|
5006
|
+
return [
|
|
5007
|
+
...presentPaths(row2, ["decisionDate"], at),
|
|
5008
|
+
...presentPaths(row2.expect, ["score", "points"], [...at, "expect"]),
|
|
5009
|
+
..."held" in row2.expect ? [[...at, "expect", "held"]] : [],
|
|
5010
|
+
...facts.flatMap(([key3, fact]) => isTyped(fact) ? [[...at, "facts", key3]] : [])
|
|
5011
|
+
];
|
|
5012
|
+
}
|
|
5013
|
+
function v1Paths(draft) {
|
|
5014
|
+
const paths = presentPaths(draft, ["numberStyle", "dateOrder", "timeZone", "scoring", "businessDays", "ruleOrder"], []);
|
|
5015
|
+
for (const [index, row2] of draft.questions.entries()) {
|
|
5016
|
+
const at = ["questions", String(index)];
|
|
5017
|
+
paths.push(...presentPaths(row2, ["type", "derive", "evidence", "minimumConfidence", "highConsequence"], at), ...comparisonPaths(row2.askOnlyWhen, [...at, "askOnlyWhen"]));
|
|
5018
|
+
}
|
|
5019
|
+
for (const [index, rule3] of draft.rules.entries()) {
|
|
5020
|
+
const at = ["rules", String(index)];
|
|
5021
|
+
paths.push(...presentPaths(rule3, ["score", "gate", "except"], at), ...comparisonPaths(rule3.when, [...at, "when"]));
|
|
5022
|
+
}
|
|
5023
|
+
for (const [index, row2] of draft.cases.entries()) {
|
|
5024
|
+
paths.push(...casePaths(row2, ["cases", String(index)]));
|
|
5025
|
+
}
|
|
5026
|
+
return paths;
|
|
5027
|
+
}
|
|
5028
|
+
var PackDraftSchema = shape3.superRefine((draft, context3) => {
|
|
5029
|
+
for (const issue of readingTestIssues(draft.readingTests, draft.questions)) {
|
|
5030
|
+
context3.addIssue({ code: "custom", ...issue });
|
|
5031
|
+
}
|
|
5032
|
+
if (draft.schema === "felspar.pack-draft/v2" && draft.purpose === void 0) {
|
|
5033
|
+
context3.addIssue({
|
|
5034
|
+
code: "custom",
|
|
5035
|
+
path: ["purpose"],
|
|
5036
|
+
message: "Quote the job's purpose: why it exists and what it resolves"
|
|
5037
|
+
});
|
|
5038
|
+
}
|
|
5039
|
+
if (draft.schema !== "felspar.pack-draft/v0") {
|
|
5040
|
+
return;
|
|
5041
|
+
}
|
|
5042
|
+
for (const path3 of v1Paths(draft)) {
|
|
5043
|
+
context3.addIssue({
|
|
5044
|
+
code: "custom",
|
|
5045
|
+
path: path3,
|
|
5046
|
+
message: 'Number and date questions, derived questions, thresholds, conventions, scoring, business days, exceptions, rule order, per-question evidence and held cases need "schema": "felspar.pack-draft/v1"'
|
|
5047
|
+
});
|
|
5048
|
+
}
|
|
5049
|
+
});
|
|
5050
|
+
|
|
4482
5051
|
// ../schemas/src/draft-pack-revision.ts
|
|
4483
|
-
var KeptPackDraftSchema =
|
|
4484
|
-
schema:
|
|
4485
|
-
job:
|
|
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)
|
|
4486
5055
|
});
|
|
4487
|
-
var id6 =
|
|
4488
|
-
var text7 =
|
|
4489
|
-
var texts =
|
|
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);
|
|
4490
5059
|
var when = PackDraftConditionsSchema;
|
|
4491
5060
|
var conventions = packConventionFields;
|
|
4492
|
-
var PackOutlineSchema =
|
|
4493
|
-
schema:
|
|
5061
|
+
var PackOutlineSchema = z56.strictObject({
|
|
5062
|
+
schema: z56.literal("felspar.pack-outline/v0"),
|
|
4494
5063
|
job: id6,
|
|
4495
5064
|
purpose: text7.nullable(),
|
|
4496
5065
|
useWhen: texts,
|
|
4497
5066
|
notFor: texts,
|
|
4498
5067
|
owner: text7.nullable(),
|
|
4499
|
-
evidenceKinds:
|
|
4500
|
-
maxEvidenceAgeDays:
|
|
4501
|
-
numberStyle:
|
|
5068
|
+
evidenceKinds: z56.array(id6).max(8),
|
|
5069
|
+
maxEvidenceAgeDays: z56.number().int().min(1).nullable(),
|
|
5070
|
+
numberStyle: z56.enum(numberStyles).nullable(),
|
|
4502
5071
|
dateOrder: conventions.dateOrder.unwrap().nullable(),
|
|
4503
|
-
timeZone:
|
|
5072
|
+
timeZone: z56.string().min(1).max(64).nullable(),
|
|
5073
|
+
businessDays: PackDraftBusinessDaysSchema.nullable(),
|
|
4504
5074
|
subject: id6.nullable(),
|
|
4505
|
-
subjects:
|
|
5075
|
+
subjects: z56.array(z56.strictObject({
|
|
4506
5076
|
id: id6,
|
|
4507
5077
|
definition: text7,
|
|
4508
|
-
identifier:
|
|
4509
|
-
example:
|
|
4510
|
-
match:
|
|
4511
|
-
relationships:
|
|
5078
|
+
identifier: z56.string().nullable(),
|
|
5079
|
+
example: z56.string().nullable(),
|
|
5080
|
+
match: z56.string(),
|
|
5081
|
+
relationships: z56.array(z56.strictObject({
|
|
4512
5082
|
name: id6,
|
|
4513
5083
|
subject: id6,
|
|
4514
|
-
cardinality:
|
|
4515
|
-
required:
|
|
5084
|
+
cardinality: z56.enum(["one", "many"]),
|
|
5085
|
+
required: z56.boolean(),
|
|
4516
5086
|
definition: text7
|
|
4517
5087
|
})).max(16),
|
|
4518
5088
|
identity: PackDraftIdentitySchema.nullable()
|
|
4519
5089
|
})).max(16),
|
|
4520
|
-
escalations:
|
|
4521
|
-
questions:
|
|
5090
|
+
escalations: z56.array(z56.strictObject({ id: id6, quote: text7 })).max(16),
|
|
5091
|
+
questions: z56.array(z56.strictObject({
|
|
4522
5092
|
key: id6,
|
|
4523
|
-
type:
|
|
5093
|
+
type: z56.enum(["enum", "boolean", "number", "date"]),
|
|
4524
5094
|
meaning: text7,
|
|
4525
5095
|
about: id6.nullable(),
|
|
4526
|
-
askOnlyWhen:
|
|
5096
|
+
askOnlyWhen: z56.string().nullable(),
|
|
4527
5097
|
when: when.nullable(),
|
|
4528
|
-
unit:
|
|
4529
|
-
unitWords:
|
|
4530
|
-
integer:
|
|
4531
|
-
minimum:
|
|
4532
|
-
maximum:
|
|
4533
|
-
answers:
|
|
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({
|
|
4534
5104
|
value: id6,
|
|
4535
|
-
meaning:
|
|
5105
|
+
meaning: z56.string().nullable(),
|
|
4536
5106
|
inclusions: texts,
|
|
4537
5107
|
exclusions: texts,
|
|
4538
5108
|
examples: texts,
|
|
4539
5109
|
edgeCases: texts
|
|
4540
5110
|
})).max(64),
|
|
4541
|
-
whereToLook: texts
|
|
5111
|
+
whereToLook: texts,
|
|
5112
|
+
evidence: z56.strictObject({
|
|
5113
|
+
evidenceKinds: z56.array(id6).max(8).nullable(),
|
|
5114
|
+
maxEvidenceAgeDays: z56.number().int().min(1).nullable(),
|
|
5115
|
+
quote: text7
|
|
5116
|
+
}).nullable(),
|
|
5117
|
+
minimumConfidence: z56.number().nullable()
|
|
4542
5118
|
})).max(64),
|
|
4543
|
-
outcomes:
|
|
4544
|
-
whenUnresolved:
|
|
4545
|
-
attempts:
|
|
4546
|
-
rules:
|
|
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({
|
|
4547
5123
|
id: id6,
|
|
4548
5124
|
meaning: text7,
|
|
4549
5125
|
outcome: id6,
|
|
4550
5126
|
when: when.nullable(),
|
|
4551
|
-
conditions:
|
|
4552
|
-
scoreRange:
|
|
5127
|
+
conditions: z56.string().nullable(),
|
|
5128
|
+
scoreRange: z56.record(z56.string(), z56.unknown()).nullable(),
|
|
4553
5129
|
score: PackDraftScoreSchema.nullable(),
|
|
4554
|
-
gate:
|
|
5130
|
+
gate: z56.boolean(),
|
|
5131
|
+
except: z56.array(id6).max(16).nullable()
|
|
4555
5132
|
})).max(256),
|
|
5133
|
+
ruleOrder: z56.enum(ruleOrders).nullable(),
|
|
4556
5134
|
scoring: PackDraftScoringSchema.nullable(),
|
|
4557
|
-
cases:
|
|
5135
|
+
cases: z56.array(z56.strictObject({
|
|
4558
5136
|
id: id6,
|
|
4559
|
-
why:
|
|
4560
|
-
facts:
|
|
5137
|
+
why: z56.string().nullable(),
|
|
5138
|
+
facts: z56.record(id6, caseFactSchema),
|
|
4561
5139
|
decisionDate: CalendarDateSchema.nullable(),
|
|
4562
|
-
subject:
|
|
4563
|
-
expect:
|
|
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() })
|
|
5144
|
+
])
|
|
4564
5145
|
})).max(200),
|
|
4565
5146
|
outputChecks: PackDraftOutputsSchema.nullable(),
|
|
4566
|
-
|
|
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)
|
|
5149
|
+
});
|
|
5150
|
+
|
|
5151
|
+
// ../schemas/src/draft-bar-calibration.ts
|
|
5152
|
+
import { z as z57 } from "zod";
|
|
5153
|
+
var barCalibrationPolicy = {
|
|
5154
|
+
lowestBar: 0.8,
|
|
5155
|
+
highestBar: 0.99,
|
|
5156
|
+
targets: { ordinary: 0.9, strict: 0.97 },
|
|
5157
|
+
minimumCases: 10,
|
|
5158
|
+
minimumDecided: 5,
|
|
5159
|
+
maxLabels: 400
|
|
5160
|
+
};
|
|
5161
|
+
var barCalibrationId = "felspar-backtest-bar";
|
|
5162
|
+
var barCalibrationVersion = "v1";
|
|
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({
|
|
5168
|
+
executionObjectId: id7,
|
|
5169
|
+
question: draftValue,
|
|
5170
|
+
answer: draftValue.nullable()
|
|
5171
|
+
});
|
|
5172
|
+
var BacktestLabelsSchema = z57.array(BacktestLabelSchema).min(1).max(barCalibrationPolicy.maxLabels).refine((rows) => {
|
|
5173
|
+
const seen = new Set(rows.map((row2) => JSON.stringify([row2.executionObjectId, row2.question])));
|
|
5174
|
+
return seen.size === rows.length;
|
|
5175
|
+
}, "Label each question of a case once");
|
|
5176
|
+
var calibrationReadings = ["right", "wrong", "held"];
|
|
5177
|
+
var caseRow = z57.strictObject({
|
|
5178
|
+
executionObjectId: id7,
|
|
5179
|
+
label: draftValue.nullable(),
|
|
5180
|
+
leaning: draftValue.nullable(),
|
|
5181
|
+
confidence: share.nullable(),
|
|
5182
|
+
atCurrentBar: z57.enum(calibrationReadings),
|
|
5183
|
+
atSuggestedBar: z57.enum(calibrationReadings).nullable()
|
|
5184
|
+
});
|
|
5185
|
+
var barRow = z57.strictObject({
|
|
5186
|
+
bar,
|
|
5187
|
+
decided: z57.number().int().min(0),
|
|
5188
|
+
right: z57.number().int().min(0),
|
|
5189
|
+
precision: share.nullable(),
|
|
5190
|
+
coverage: share
|
|
5191
|
+
});
|
|
5192
|
+
var calibrationStatuses = [
|
|
5193
|
+
"suggested",
|
|
5194
|
+
"too_few_cases",
|
|
5195
|
+
"coverage_gap",
|
|
5196
|
+
"needs_more_evidence_or_rewrite"
|
|
5197
|
+
];
|
|
5198
|
+
var QuestionCalibrationSchema = z57.strictObject({
|
|
5199
|
+
question: id7,
|
|
5200
|
+
status: z57.enum(calibrationStatuses),
|
|
5201
|
+
consequence: z57.enum(["ordinary", "strict"]),
|
|
5202
|
+
target: share,
|
|
5203
|
+
currentBar: share,
|
|
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({
|
|
5209
|
+
bar,
|
|
5210
|
+
precision: share,
|
|
5211
|
+
coverage: share,
|
|
5212
|
+
calibration: z57.strictObject({
|
|
5213
|
+
id: z57.literal(barCalibrationId),
|
|
5214
|
+
version: z57.literal(barCalibrationVersion),
|
|
5215
|
+
contentDigest: digest23
|
|
5216
|
+
})
|
|
5217
|
+
}).optional(),
|
|
5218
|
+
bars: z57.array(barRow).max(20),
|
|
5219
|
+
cases: z57.array(caseRow).max(50)
|
|
5220
|
+
});
|
|
5221
|
+
var BacktestCalibrationSchema = z57.strictObject({
|
|
5222
|
+
schema: z57.literal("felspar.bar-calibration/v1"),
|
|
5223
|
+
calibrationDigest: digest23,
|
|
5224
|
+
minimumCases: z57.number().int().min(1),
|
|
5225
|
+
questions: z57.array(QuestionCalibrationSchema).max(64),
|
|
5226
|
+
ignoredLabels: z57.number().int().min(0)
|
|
5227
|
+
});
|
|
5228
|
+
var AcceptedBarsSchema = z57.strictObject({
|
|
5229
|
+
savedResultId: z57.string().regex(/^backtest-[a-f0-9]{32}$/u),
|
|
5230
|
+
calibrationDigest: digest23,
|
|
5231
|
+
questions: z57.array(id7).min(1).max(64)
|
|
5232
|
+
});
|
|
5233
|
+
var ReleaseCalibrationSchema = AcceptedBarsSchema.extend({
|
|
5234
|
+
acceptedBy: z57.string().min(1).max(200),
|
|
5235
|
+
approvedMaterialDigest: digest23,
|
|
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)
|
|
4567
5286
|
});
|
|
4568
5287
|
|
|
4569
5288
|
// ../schemas/src/draft-hosted-application.ts
|
|
4570
|
-
var
|
|
4571
|
-
var
|
|
4572
|
-
var HostedSourceInputSchema =
|
|
4573
|
-
sourceId:
|
|
4574
|
-
revision:
|
|
4575
|
-
title:
|
|
4576
|
-
text:
|
|
4577
|
-
});
|
|
4578
|
-
var HostedProposalInputV0Schema =
|
|
4579
|
-
sourceObjectId:
|
|
4580
|
-
expectedSourceDigest:
|
|
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,
|
|
4581
5300
|
material: DraftApplicationJobMaterialSchema,
|
|
4582
5301
|
compilation: DraftCompilationSchema
|
|
4583
5302
|
});
|
|
4584
|
-
var
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
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
|
|
5308
|
+
});
|
|
5309
|
+
var HostedProposalInputV2Schema = z59.strictObject({
|
|
5310
|
+
schema: z59.literal("felspar.hosted-proposal.draft/v2"),
|
|
5311
|
+
sourceObjectId: id9,
|
|
5312
|
+
expectedSourceDigest: digest25,
|
|
4588
5313
|
material: DraftApplicationJobMaterialV2Schema,
|
|
4589
5314
|
outputChecks: HostedOutputChecksSchema.optional(),
|
|
5315
|
+
manualFacts: HostedManualFactsRuleSchema.optional(),
|
|
4590
5316
|
draft: KeptPackDraftSchema.optional()
|
|
4591
5317
|
});
|
|
4592
|
-
var HostedProposalInputSchema =
|
|
5318
|
+
var HostedProposalInputSchema = z59.union([
|
|
4593
5319
|
HostedProposalInputV2Schema,
|
|
4594
5320
|
HostedProposalInputV0Schema
|
|
4595
5321
|
]);
|
|
4596
|
-
var HostedApprovalInputSchema =
|
|
4597
|
-
expectedProposalDigest:
|
|
4598
|
-
reviewedMeaning:
|
|
4599
|
-
reviewedFixtures:
|
|
4600
|
-
reviewNote:
|
|
4601
|
-
});
|
|
4602
|
-
var HostedReleaseInputSchema =
|
|
4603
|
-
|
|
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({
|
|
4604
5334
|
release: DraftApplicationReleaseSchema,
|
|
4605
5335
|
material: DraftAnyApplicationJobMaterialSchema,
|
|
4606
|
-
approvalObjectId:
|
|
4607
|
-
approvalDigest:
|
|
4608
|
-
proposalDigest:
|
|
4609
|
-
sourceDigest:
|
|
4610
|
-
verifiedCompilation: DraftVerifiedCompilationSchema.optional()
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
5336
|
+
approvalObjectId: id9,
|
|
5337
|
+
approvalDigest: digest25,
|
|
5338
|
+
proposalDigest: digest25,
|
|
5339
|
+
sourceDigest: digest25,
|
|
5340
|
+
verifiedCompilation: DraftVerifiedCompilationSchema.optional(),
|
|
5341
|
+
calibration: ReleaseCalibrationSchema.optional()
|
|
5342
|
+
});
|
|
5343
|
+
var HostedJobInputSchema = z59.strictObject({
|
|
5344
|
+
executionId: id9,
|
|
5345
|
+
expectedReleaseDigest: digest25,
|
|
4615
5346
|
material: DraftAnyApplicationJobMaterialSchema
|
|
4616
5347
|
});
|
|
4617
|
-
var HostedSuppliedJobInputSchema =
|
|
4618
|
-
mode:
|
|
4619
|
-
executionId:
|
|
4620
|
-
expectedReleaseDigest:
|
|
4621
|
-
expectedAuthorityDigest:
|
|
4622
|
-
jobId:
|
|
4623
|
-
entityId:
|
|
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,
|
|
4624
5355
|
evidence: DraftRequiredDecisionSchema.shape.evidence,
|
|
4625
5356
|
passages: DraftLayeredEvaluationSchema.shape.passages.max(256)
|
|
4626
5357
|
});
|
|
@@ -4630,97 +5361,186 @@ var hostedFactsLimits = {
|
|
|
4630
5361
|
maxFactsBytes: 524288,
|
|
4631
5362
|
maxQuestions: 64
|
|
4632
5363
|
};
|
|
4633
|
-
var factSourceId =
|
|
4634
|
-
var observedAt =
|
|
4635
|
-
var
|
|
4636
|
-
class:
|
|
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.`);
|
|
5366
|
+
var sourceFields = {
|
|
5367
|
+
class: id9,
|
|
4637
5368
|
id: factSourceId,
|
|
4638
|
-
revision:
|
|
4639
|
-
locator:
|
|
5369
|
+
revision: id9.optional(),
|
|
5370
|
+
locator: z59.string().min(1).max(4096).optional(),
|
|
4640
5371
|
observedAt,
|
|
4641
|
-
sensitivity:
|
|
4642
|
-
}
|
|
4643
|
-
var
|
|
4644
|
-
var
|
|
4645
|
-
var
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
}
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
]
|
|
5372
|
+
sensitivity: id9.optional()
|
|
5373
|
+
};
|
|
5374
|
+
var manualSourcePrefix = "felspar:";
|
|
5375
|
+
var suppliedBy = z59.string().trim().min(1).max(200);
|
|
5376
|
+
var isReserved = (sourceId2) => sourceId2?.toLowerCase().startsWith(manualSourcePrefix) === true;
|
|
5377
|
+
function sourceIssues(source3) {
|
|
5378
|
+
if (source3.manual === true) {
|
|
5379
|
+
return [
|
|
5380
|
+
...source3.id === void 0 ? [] : [{ path: ["id"], code: "manual_source_id" }],
|
|
5381
|
+
...source3.revision === void 0 ? [] : [{ path: ["revision"], code: "manual_source_id" }]
|
|
5382
|
+
];
|
|
5383
|
+
}
|
|
5384
|
+
return [
|
|
5385
|
+
...source3.id === void 0 ? [{ path: ["id"], code: "source_id_required" }] : [],
|
|
5386
|
+
...isReserved(source3.id) ? [{ path: ["id"], code: "source_id_reserved" }] : [],
|
|
5387
|
+
...source3.observedAt === void 0 ? [{ path: ["observedAt"], code: "observed_at_required" }] : [],
|
|
5388
|
+
...source3.suppliedBy === void 0 ? [] : [{ path: ["suppliedBy"], code: "supplied_by_needs_manual" }]
|
|
5389
|
+
];
|
|
5390
|
+
}
|
|
5391
|
+
function isAdmittedManual(source3) {
|
|
5392
|
+
return source3.by !== void 0 && source3.id === void 0 && source3.revision === void 0;
|
|
5393
|
+
}
|
|
5394
|
+
function isAdmittedOrdinary(source3) {
|
|
5395
|
+
const isUnmarked = source3.by === void 0 && source3.stamped === void 0 && source3.suppliedBy === void 0;
|
|
5396
|
+
return source3.id !== void 0 && isUnmarked;
|
|
5397
|
+
}
|
|
5398
|
+
function isAdmitted(source3) {
|
|
5399
|
+
return source3.manual === true ? isAdmittedManual(source3) : isAdmittedOrdinary(source3);
|
|
5400
|
+
}
|
|
5401
|
+
var excerptText = z59.string().min(1).refine((text8) => text8.length <= hostedFactsLimits.maxExcerptCharacters, "text_too_long");
|
|
5402
|
+
var valueSourceFields = { excerpt: excerptText.optional() };
|
|
5403
|
+
var requestSourceFields = {
|
|
5404
|
+
...sourceFields,
|
|
5405
|
+
id: factSourceId.optional(),
|
|
5406
|
+
observedAt: observedAt.optional(),
|
|
5407
|
+
manual: z59.literal(true).optional(),
|
|
5408
|
+
suppliedBy: suppliedBy.optional()
|
|
5409
|
+
};
|
|
5410
|
+
function refusedSourceIssues(source3, context3) {
|
|
5411
|
+
for (const issue of sourceIssues(source3)) {
|
|
5412
|
+
context3.addIssue({ code: "custom", path: issue.path, message: issue.code });
|
|
5413
|
+
}
|
|
5414
|
+
}
|
|
5415
|
+
var admittedSourceFields = {
|
|
5416
|
+
...sourceFields,
|
|
5417
|
+
id: factSourceId.optional(),
|
|
5418
|
+
manual: z59.literal(true).optional(),
|
|
5419
|
+
suppliedBy: suppliedBy.optional(),
|
|
5420
|
+
by: id9.optional(),
|
|
5421
|
+
stamped: z59.literal(true).optional()
|
|
5422
|
+
};
|
|
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();
|
|
5428
|
+
var hostedCaseRecordLimits = {
|
|
5429
|
+
maxExcerptsPerQuestion: 30,
|
|
5430
|
+
maxExcerpts: hostedFactsLimits.maxQuestions * hostedFactsLimits.maxExcerptsPerQuestion,
|
|
5431
|
+
maxAttempts: 12
|
|
5432
|
+
};
|
|
5433
|
+
function factSchemas(source3, valueSource, isRecord) {
|
|
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()]),
|
|
5437
|
+
source: valueSource,
|
|
5438
|
+
about
|
|
5439
|
+
});
|
|
5440
|
+
const cap = isRecord ? hostedCaseRecordLimits.maxExcerptsPerQuestion : hostedFactsLimits.maxExcerptsPerQuestion;
|
|
5441
|
+
const listed = isRecord ? z59.union([excerpt2, valueFact]) : excerpt2;
|
|
5442
|
+
const fact = z59.union([
|
|
5443
|
+
valueFact,
|
|
5444
|
+
excerpt2,
|
|
5445
|
+
z59.array(listed).min(1).refine((excerpts2) => excerpts2.length <= cap, "too_many_excerpts")
|
|
5446
|
+
]);
|
|
5447
|
+
return { excerpt: excerpt2, valueFact, fact };
|
|
5448
|
+
}
|
|
5449
|
+
var admittedFacts = factSchemas(admittedSource, admittedValueSource, true);
|
|
5450
|
+
var requestFacts = factSchemas(requestSource, requestValueSource, false);
|
|
5451
|
+
var HostedExcerptSchema = admittedFacts.excerpt;
|
|
5452
|
+
var HostedValueFactSchema = admittedFacts.valueFact;
|
|
5453
|
+
var HostedFactSchema = admittedFacts.fact;
|
|
4656
5454
|
function factsBytes(facts) {
|
|
4657
5455
|
const encoder2 = new TextEncoder();
|
|
4658
5456
|
return encoder2.encode(JSON.stringify(facts)).length;
|
|
4659
5457
|
}
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
5458
|
+
function questionsOf(fact) {
|
|
5459
|
+
return z59.record(id9, fact).refine((facts) => Object.keys(facts).length <= hostedFactsLimits.maxQuestions, "too_many_questions");
|
|
5460
|
+
}
|
|
5461
|
+
function factsOf(fact) {
|
|
5462
|
+
return questionsOf(fact).refine((facts) => factsBytes(facts) <= hostedFactsLimits.maxFactsBytes, "request_too_large");
|
|
5463
|
+
}
|
|
5464
|
+
var HostedFactsJobInputSchema = z59.strictObject({
|
|
5465
|
+
mode: z59.literal("facts"),
|
|
5466
|
+
executionId: id9,
|
|
5467
|
+
expectedReleaseDigest: digest25,
|
|
5468
|
+
jobId: id9,
|
|
5469
|
+
entityId: id9,
|
|
4666
5470
|
related: HostedRelatedSubjectsSchema.optional(),
|
|
4667
|
-
identity:
|
|
4668
|
-
facts:
|
|
5471
|
+
identity: z59.record(z59.string().min(1).max(128), z59.string().min(1).max(200)).optional(),
|
|
5472
|
+
facts: questionsOf(HostedFactSchema)
|
|
4669
5473
|
});
|
|
4670
5474
|
var HostedFactsRequestSchema = HostedFactsJobInputSchema.extend({
|
|
4671
|
-
entityId:
|
|
5475
|
+
entityId: id9.optional(),
|
|
5476
|
+
facts: factsOf(requestFacts.fact)
|
|
4672
5477
|
});
|
|
4673
|
-
var HostedJobRequestSchema =
|
|
5478
|
+
var HostedJobRequestSchema = z59.union([
|
|
4674
5479
|
HostedJobInputSchema,
|
|
4675
5480
|
HostedSuppliedJobInputSchema,
|
|
4676
5481
|
HostedFactsJobInputSchema
|
|
4677
5482
|
]);
|
|
4678
|
-
var HostedClassificationResultSchema =
|
|
4679
|
-
key:
|
|
4680
|
-
observationId:
|
|
5483
|
+
var HostedClassificationResultSchema = z59.strictObject({
|
|
5484
|
+
key: id9,
|
|
5485
|
+
observationId: id9,
|
|
4681
5486
|
record: DraftNormalizedEvidenceSchema.shape.normalizations.element,
|
|
4682
|
-
reason:
|
|
4683
|
-
cached:
|
|
5487
|
+
reason: z59.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable(),
|
|
5488
|
+
cached: z59.boolean()
|
|
4684
5489
|
});
|
|
4685
5490
|
function retainsFactsExactly(record) {
|
|
4686
5491
|
const hasFacts = record.facts !== void 0 && record.judgments !== void 0 && record.judgmentsDigest !== void 0;
|
|
4687
5492
|
return record.schema === "felspar.hosted-supplied-execution/v3" === hasFacts;
|
|
4688
5493
|
}
|
|
4689
|
-
var
|
|
4690
|
-
|
|
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()
|
|
5498
|
+
});
|
|
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),
|
|
5503
|
+
facts: questionsOf(HostedFactSchema).optional()
|
|
5504
|
+
});
|
|
5505
|
+
var HostedSuppliedExecutionRecordSchema = z59.strictObject({
|
|
5506
|
+
schema: z59.enum([
|
|
4691
5507
|
"felspar.hosted-supplied-execution/v1",
|
|
4692
5508
|
"felspar.hosted-supplied-execution/v2",
|
|
4693
5509
|
"felspar.hosted-supplied-execution/v3"
|
|
4694
5510
|
]),
|
|
4695
|
-
release:
|
|
4696
|
-
evaluationTime:
|
|
5511
|
+
release: z59.strictObject({ releaseId: id9, releaseDigest: digest25, materialDigest: digest25 }),
|
|
5512
|
+
evaluationTime: z59.iso.datetime(),
|
|
4697
5513
|
input: HostedSuppliedJobInputSchema,
|
|
4698
5514
|
facts: HostedFactsJobInputSchema.optional(),
|
|
4699
|
-
judgments:
|
|
4700
|
-
judgmentsDigest:
|
|
4701
|
-
expansion:
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
status:
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
5515
|
+
judgments: z59.array(HostedClassificationResultSchema).max(192).optional(),
|
|
5516
|
+
judgmentsDigest: digest25.optional(),
|
|
5517
|
+
expansion: z59.enum(["agreeing-excerpts", "agreeing-excerpts/v2"]).optional(),
|
|
5518
|
+
caseRecord: HostedCaseRecordSchema.optional(),
|
|
5519
|
+
decisionAttempt: DecisionGraphAttemptSchema.optional(),
|
|
5520
|
+
job: z59.record(z59.string(), z59.unknown())
|
|
5521
|
+
}).refine(retainsFactsExactly, "Version 3 records, and only they, retain facts with their judgments").refine((record) => record.caseRecord === void 0 || record.facts !== void 0, {
|
|
5522
|
+
message: "Only a facts record keeps a case record"
|
|
5523
|
+
});
|
|
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()
|
|
4724
5544
|
}).loose().nullable()
|
|
4725
5545
|
});
|
|
4726
5546
|
|
|
@@ -4730,6 +5550,12 @@ var formatFix = "The request does not match the facts request format at this pat
|
|
|
4730
5550
|
var fixes = {
|
|
4731
5551
|
observed_at_invalid: "Send observedAt as the date and time the source was read, with Z or an offset: for example 2026-10-21T10:00:00Z or 2026-10-21T12:00+02:00. A date alone, a time with no offset or words such as yesterday are not accepted.",
|
|
4732
5552
|
source_id_invalid: `Send source.id as the source's own ID or address, such as a ticket number or a document URL with its query: at most ${draftSourceIdLimit} characters, starting with a letter or digit, using URL characters only (percent-encode spaces and non-ASCII characters).`,
|
|
5553
|
+
source_id_required: "Send source.id: the source's own ID or address. For words a person gave you, mark the source manual: true instead and leave id out.",
|
|
5554
|
+
observed_at_required: "Send source.observedAt: when the source was read, with Z or an offset. For words a person gave you, mark the source manual: true and Felspar stamps the time it received them.",
|
|
5555
|
+
source_id_reserved: "Source IDs starting with felspar: are Felspar's own. Send the source's own ID, or mark words a person gave you manual: true with no id.",
|
|
5556
|
+
manual_source_id: "A manual source takes no id or revision. Name the source the person gave in locator, such as the record or message it came from.",
|
|
5557
|
+
supplied_by_needs_manual: "suppliedBy is only for words a person gave you: mark that source manual: true, or leave suppliedBy out.",
|
|
5558
|
+
manual_facts_refused: "This job's pack refuses facts supplied by a person (its manualFacts setting). Quote the source record itself, with its source.id and observedAt, or leave the question out.",
|
|
4733
5559
|
unknown_question: "This question is not in the released job. Use the question keys from describe.",
|
|
4734
5560
|
source_class_not_accepted: "This question does not accept this source class. Send an excerpt from a source class the question's evidence policy in describe lists.",
|
|
4735
5561
|
value_not_in_excerpt: "The quoted words do not state this value. Quote the exact words that state it, or send the text without a typed value.",
|
|
@@ -4746,6 +5572,7 @@ var fixes = {
|
|
|
4746
5572
|
job_mismatch: "This release serves a different job. Use the job and release from describe.",
|
|
4747
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.",
|
|
4748
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.",
|
|
4749
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.",
|
|
4750
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.",
|
|
4751
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.",
|
|
@@ -4784,6 +5611,8 @@ var fixes = {
|
|
|
4784
5611
|
proposal_closed: "This proposal was released, rejected, withdrawn or replaced by a newer proposal, so nothing more can be done with it. Call list_jobs for the job's open proposals.",
|
|
4785
5612
|
not_proposer: "Only the person who made a proposal may withdraw it; an approver may reject it.",
|
|
4786
5613
|
not_job_approver: "Only this job's owner and named approvers, or a workspace owner, may approve, release or reject its proposals. details.owners names who may; ask one of them to review it on the Felspar web page.",
|
|
5614
|
+
own_proposal: "The person who proposed a change can't approve it while another approver can. details.reason says why; ask one of the job's other approvers to review it on the Felspar web page.",
|
|
5615
|
+
proposal_review_unavailable: "This proposal's review can't be read. Call list_jobs for the job's open proposals.",
|
|
4787
5616
|
withdraw_on_web_page: "Withdraw a proposal on the Felspar web page, or propose the job again, which replaces your earlier proposal.",
|
|
4788
5617
|
change_request_needs_release: "This job has no release yet, so there is no document version to propose changes on. Draft its first pack with check_pack and propose_pack.",
|
|
4789
5618
|
change_request_quote_invalid: "Each change must quote a passage exactly as it is in the release's version of the document (read_source on the source list_jobs names), found exactly once, with changes that don't overlap and a replacement that differs. details.problems names each change by its index: quote_not_found, quote_not_unique (quote more of the passage), edits_overlap or edit_unchanged.",
|
|
@@ -4795,9 +5624,27 @@ var fixes = {
|
|
|
4795
5624
|
change_request_comment_limit: "This change request has as many comments as it can hold. Continue the discussion on the Felspar web page.",
|
|
4796
5625
|
change_request_closed: "This change request is already closed.",
|
|
4797
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.",
|
|
4798
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.",
|
|
4799
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.",
|
|
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.",
|
|
4800
5640
|
preview_reinterpret_blocked: "Fix the draft's blocking findings (check_pack lists them) before previewing with reinterpret: true. A preview without reinterpret still runs.",
|
|
5641
|
+
readings_blocked: "Fix the draft's blocking findings (check_pack lists them) before check_readings reads its wording.",
|
|
5642
|
+
nothing_to_read: "Send phrasings in variants, or add readingTests to the draft: there is nothing to read.",
|
|
5643
|
+
too_many_readings: `Read at most ${readingCheckLimits.maxPerCheck} phrasings per check_readings call, the draft's readingTests included. Split them across calls, or send include_tests: false.`,
|
|
5644
|
+
too_many_per_answer: `Send at most ${readingCheckLimits.maxPerAnswer} phrasings per answer (and per question for phrasings with no expected answer), the draft's readingTests included.`,
|
|
5645
|
+
duplicate_reading: "Two phrasings have the same id (a readingTests id counts too). Give each its own id, or leave id out.",
|
|
5646
|
+
question_not_read: "check_readings reads only choice questions Felspar classifies from text: not number, date or derived questions. Use a choice question's key from the draft.",
|
|
5647
|
+
answer_not_in_question: "expect must be one of that question's answer values in the draft.",
|
|
4801
5648
|
pack_job_mismatch: "That release or proposal belongs to another job. Pass the jobId list_jobs shows with it.",
|
|
4802
5649
|
decision_not_found: "Check the output against a decision this caller made: send the executionId from your get_job_decision result for this job.",
|
|
4803
5650
|
decision_not_decided: "This decision has no outcome, so nothing is written for it. Follow its next step instead.",
|
|
@@ -4817,7 +5664,12 @@ var hostedRefusalCodes = Object.freeze(Object.keys(fixes));
|
|
|
4817
5664
|
function hostedRefusalFix(code) {
|
|
4818
5665
|
return Object.hasOwn(fixes, code) ? fixes[code] ?? null : null;
|
|
4819
5666
|
}
|
|
4820
|
-
var retried = /* @__PURE__ */ new Set([
|
|
5667
|
+
var retried = /* @__PURE__ */ new Set([
|
|
5668
|
+
"case_in_progress",
|
|
5669
|
+
"rate_limited",
|
|
5670
|
+
"history_unavailable",
|
|
5671
|
+
"operation_unavailable"
|
|
5672
|
+
]);
|
|
4821
5673
|
var escalated = /* @__PURE__ */ new Set([
|
|
4822
5674
|
"unauthenticated",
|
|
4823
5675
|
"forbidden",
|
|
@@ -4839,236 +5691,254 @@ function hostedRefusalRecovery(code) {
|
|
|
4839
5691
|
}
|
|
4840
5692
|
|
|
4841
5693
|
// ../schemas/src/draft-hosted-job-description.ts
|
|
4842
|
-
import { z as
|
|
5694
|
+
import { z as z61 } from "zod";
|
|
4843
5695
|
|
|
4844
5696
|
// ../schemas/src/draft-hosted-output-guides.ts
|
|
4845
|
-
import { z as
|
|
4846
|
-
var
|
|
4847
|
-
var located =
|
|
4848
|
-
text:
|
|
4849
|
-
locator:
|
|
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)
|
|
4850
5702
|
});
|
|
4851
5703
|
var hostedOutputGuideLimits = { maxOutputs: 8, maxContext: 8, maxChecks: 64 };
|
|
4852
|
-
var HostedOutputGuideSchema =
|
|
4853
|
-
id:
|
|
5704
|
+
var HostedOutputGuideSchema = z60.strictObject({
|
|
5705
|
+
id: id10,
|
|
4854
5706
|
what: located,
|
|
4855
|
-
maxCharacters:
|
|
4856
|
-
context:
|
|
4857
|
-
checks:
|
|
4858
|
-
check:
|
|
4859
|
-
rule:
|
|
4860
|
-
must:
|
|
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)
|
|
4861
5713
|
})).max(hostedOutputGuideLimits.maxChecks)
|
|
4862
5714
|
});
|
|
4863
|
-
var HostedOutputGuidesSchema =
|
|
5715
|
+
var HostedOutputGuidesSchema = z60.array(HostedOutputGuideSchema).max(hostedOutputGuideLimits.maxOutputs);
|
|
4864
5716
|
|
|
4865
5717
|
// ../schemas/src/draft-hosted-job-description.ts
|
|
4866
|
-
var
|
|
4867
|
-
var
|
|
5718
|
+
var id11 = z61.string().min(1).max(200);
|
|
5719
|
+
var digest26 = DraftApplicationReleaseSchema.shape.releaseDigest;
|
|
4868
5720
|
var { requirements, rules } = DraftRequiredProposalSchema.shape;
|
|
4869
|
-
var quotedText =
|
|
4870
|
-
text:
|
|
5721
|
+
var quotedText = z61.strictObject({
|
|
5722
|
+
text: z61.string().min(1).max(262144),
|
|
4871
5723
|
source: DraftSourceReferenceSchema.omit({ contentDigest: true }).extend({
|
|
4872
|
-
locator:
|
|
4873
|
-
contentDigest:
|
|
5724
|
+
locator: z61.string().min(1).max(4096),
|
|
5725
|
+
contentDigest: digest26
|
|
4874
5726
|
}),
|
|
4875
|
-
parts:
|
|
5727
|
+
parts: z61.array(z61.strictObject({ locator: z61.string().min(1).max(4096), text: z61.string() })).max(16)
|
|
4876
5728
|
});
|
|
4877
5729
|
var subjectShape = {
|
|
4878
|
-
identifier:
|
|
4879
|
-
example:
|
|
4880
|
-
match:
|
|
5730
|
+
identifier: z61.string().min(1).max(200),
|
|
5731
|
+
example: z61.string().min(1).max(200),
|
|
5732
|
+
match: z61.enum(subjectMatchRules)
|
|
4881
5733
|
};
|
|
4882
|
-
var HostedJobSubjectSchema =
|
|
4883
|
-
type:
|
|
5734
|
+
var HostedJobSubjectSchema = z61.strictObject({
|
|
5735
|
+
type: id11,
|
|
4884
5736
|
definition: quotedText,
|
|
4885
5737
|
identifier: subjectShape.identifier.optional(),
|
|
4886
5738
|
example: subjectShape.example.optional(),
|
|
4887
5739
|
match: subjectShape.match,
|
|
4888
|
-
related:
|
|
4889
|
-
relationship:
|
|
5740
|
+
related: z61.array(z61.strictObject({
|
|
5741
|
+
relationship: id11,
|
|
4890
5742
|
meaning: quotedText,
|
|
4891
|
-
cardinality:
|
|
4892
|
-
required:
|
|
4893
|
-
subject:
|
|
5743
|
+
cardinality: z61.enum(relationshipCardinalities),
|
|
5744
|
+
required: z61.boolean(),
|
|
5745
|
+
subject: id11,
|
|
4894
5746
|
definition: quotedText,
|
|
4895
5747
|
...subjectShape
|
|
4896
5748
|
})).max(16),
|
|
4897
|
-
send:
|
|
5749
|
+
send: z61.string().min(1).max(2e4)
|
|
4898
5750
|
});
|
|
4899
|
-
var HostedJobEscalationsSchema =
|
|
4900
|
-
routes:
|
|
4901
|
-
unresolved:
|
|
4902
|
-
attemptLimit:
|
|
4903
|
-
rule:
|
|
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)
|
|
4904
5756
|
});
|
|
4905
|
-
var HostedEscalationSchema =
|
|
4906
|
-
id:
|
|
4907
|
-
trigger:
|
|
5757
|
+
var HostedEscalationSchema = z61.strictObject({
|
|
5758
|
+
id: id11,
|
|
5759
|
+
trigger: z61.enum(escalationTriggers),
|
|
4908
5760
|
why: quotedText
|
|
4909
5761
|
});
|
|
4910
|
-
var HostedJobDescriptionSchema =
|
|
4911
|
-
schema:
|
|
4912
|
-
job:
|
|
5762
|
+
var HostedJobDescriptionSchema = z61.strictObject({
|
|
5763
|
+
schema: z61.literal("felspar.hosted-job-description.draft/v0"),
|
|
5764
|
+
job: id11,
|
|
4913
5765
|
purpose: quotedText.optional(),
|
|
4914
|
-
useWhen:
|
|
4915
|
-
notFor:
|
|
5766
|
+
useWhen: z61.array(quotedText).max(8).optional(),
|
|
5767
|
+
notFor: z61.array(quotedText).max(8).optional(),
|
|
4916
5768
|
owner: quotedText.optional(),
|
|
4917
5769
|
subject: HostedJobSubjectSchema.optional(),
|
|
4918
|
-
identity:
|
|
4919
|
-
mode:
|
|
4920
|
-
send:
|
|
4921
|
-
fields:
|
|
4922
|
-
question:
|
|
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()
|
|
4923
5775
|
}).optional(),
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
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
|
|
4930
5783
|
}),
|
|
4931
5784
|
resolutionPolicy: DraftRequiredProposalSchema.shape.resolutionPolicy,
|
|
4932
|
-
questions:
|
|
4933
|
-
key:
|
|
4934
|
-
type:
|
|
5785
|
+
questions: z61.array(requirements.element.extend({
|
|
5786
|
+
key: id11,
|
|
5787
|
+
type: z61.enum(["enum", "boolean", "number", "date"]),
|
|
4935
5788
|
meaning: quotedText,
|
|
4936
|
-
answer:
|
|
4937
|
-
send:
|
|
4938
|
-
valueFormat:
|
|
4939
|
-
interpretation:
|
|
4940
|
-
threshold:
|
|
4941
|
-
applies:
|
|
4942
|
-
dependsOn:
|
|
4943
|
-
appliesWhen:
|
|
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(),
|
|
4944
5797
|
reading: ExactReaderSchema.optional()
|
|
4945
5798
|
}),
|
|
4946
|
-
answers:
|
|
4947
|
-
value:
|
|
4948
|
-
meaning:
|
|
4949
|
-
inclusions:
|
|
4950
|
-
exclusions:
|
|
4951
|
-
examples:
|
|
4952
|
-
edgeCases:
|
|
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)
|
|
4953
5806
|
})).max(64).optional(),
|
|
4954
|
-
whereToLook:
|
|
4955
|
-
about:
|
|
5807
|
+
whereToLook: z61.array(quotedText).max(8).optional(),
|
|
5808
|
+
about: z61.strictObject({ relationship: id11, subject: id11 }).optional()
|
|
4956
5809
|
})).max(64),
|
|
4957
|
-
rules:
|
|
4958
|
-
outcomes:
|
|
4959
|
-
id:
|
|
5810
|
+
rules: z61.array(rules.element.extend({ text: quotedText })).max(256),
|
|
5811
|
+
outcomes: z61.array(z61.strictObject({
|
|
5812
|
+
id: id11,
|
|
4960
5813
|
meaning: quotedText.nullable(),
|
|
4961
5814
|
nextStep: quotedText.nullable().optional(),
|
|
4962
5815
|
outputs: HostedOutputGuidesSchema.optional(),
|
|
4963
|
-
escalate:
|
|
5816
|
+
escalate: id11.optional()
|
|
4964
5817
|
})).max(64),
|
|
4965
5818
|
escalations: HostedJobEscalationsSchema.optional(),
|
|
4966
5819
|
whenUnresolved: quotedText.nullable().optional(),
|
|
4967
|
-
attempts:
|
|
4968
|
-
max:
|
|
4969
|
-
withProgress:
|
|
4970
|
-
rule:
|
|
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)
|
|
4971
5824
|
}).optional(),
|
|
4972
|
-
guidance:
|
|
4973
|
-
input:
|
|
4974
|
-
jsonSchema:
|
|
5825
|
+
guidance: z61.strictObject({ gather: z61.string().min(1).max(2e3) }),
|
|
5826
|
+
input: z61.strictObject({
|
|
5827
|
+
jsonSchema: z61.record(z61.string(), z61.unknown()),
|
|
4975
5828
|
example: HostedFactsJobInputSchema.nullable(),
|
|
4976
|
-
exampleNote:
|
|
5829
|
+
exampleNote: z61.string().max(1e3)
|
|
4977
5830
|
}),
|
|
4978
|
-
limits:
|
|
4979
|
-
maxEvidenceItems:
|
|
4980
|
-
maxPassages:
|
|
4981
|
-
facts:
|
|
4982
|
-
maxExcerptCharacters:
|
|
4983
|
-
maxExcerptsPerQuestion:
|
|
4984
|
-
maxFactsBytes:
|
|
4985
|
-
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)
|
|
4986
5839
|
})
|
|
4987
5840
|
})
|
|
4988
5841
|
});
|
|
4989
|
-
var interpretedExcerpt =
|
|
4990
|
-
id:
|
|
4991
|
-
method:
|
|
4992
|
-
status:
|
|
4993
|
-
value:
|
|
4994
|
-
reasons:
|
|
4995
|
-
classification:
|
|
4996
|
-
candidate:
|
|
4997
|
-
probability:
|
|
4998
|
-
abstention:
|
|
4999
|
-
threshold:
|
|
5000
|
-
alternatives:
|
|
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() }))
|
|
5001
5854
|
}).optional()
|
|
5002
5855
|
});
|
|
5003
|
-
var ruleSummary =
|
|
5004
|
-
var HostedJobExplanationSchema =
|
|
5005
|
-
schema:
|
|
5006
|
-
decision:
|
|
5007
|
-
needs:
|
|
5008
|
-
key:
|
|
5009
|
-
status:
|
|
5010
|
-
reasons:
|
|
5011
|
-
acceptedSourceClasses:
|
|
5012
|
-
maxAgeMs:
|
|
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(),
|
|
5013
5866
|
requiredWhen: HostedJobDescriptionSchema.shape.questions.element.shape.requiredWhen,
|
|
5014
|
-
excerpts:
|
|
5867
|
+
excerpts: z61.array(interpretedExcerpt).optional()
|
|
5015
5868
|
})),
|
|
5016
|
-
why:
|
|
5017
|
-
rules:
|
|
5018
|
-
overrides:
|
|
5019
|
-
suppressedRuleIds:
|
|
5020
|
-
evidence:
|
|
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()))
|
|
5021
5874
|
}).nullable(),
|
|
5022
|
-
context:
|
|
5023
|
-
reviewNeeds:
|
|
5024
|
-
evidenceFreshUntil:
|
|
5875
|
+
context: z61.strictObject({ status: z61.string(), reason: z61.string().nullable() }).nullable(),
|
|
5876
|
+
reviewNeeds: z61.array(z61.string()),
|
|
5877
|
+
evidenceFreshUntil: z61.iso.datetime().nullable()
|
|
5025
5878
|
});
|
|
5026
|
-
var HostedReceiptVerificationInputSchema =
|
|
5879
|
+
var HostedReceiptVerificationInputSchema = z61.strictObject({
|
|
5027
5880
|
receipt: DraftJobReceiptSchema,
|
|
5028
|
-
expectedReceiptDigest:
|
|
5881
|
+
expectedReceiptDigest: digest26,
|
|
5029
5882
|
deliveredCapsule: DraftContextVerificationOptionsSchema.shape.deliveredCapsule
|
|
5030
5883
|
});
|
|
5031
|
-
var HostedReceiptVerificationSchema =
|
|
5032
|
-
authority:
|
|
5033
|
-
status:
|
|
5034
|
-
mismatches:
|
|
5035
|
-
decided:
|
|
5036
|
-
jobId:
|
|
5037
|
-
entityId:
|
|
5038
|
-
releaseId:
|
|
5039
|
-
outcome:
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
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)
|
|
5044
5898
|
}).optional(),
|
|
5045
|
-
escalation: HostedEscalationSchema.omit({ why: true }).optional()
|
|
5899
|
+
escalation: HostedEscalationSchema.omit({ why: true }).optional(),
|
|
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()
|
|
5906
|
+
}),
|
|
5907
|
+
observedAt: z61.string(),
|
|
5908
|
+
stampedByFelspar: z61.boolean(),
|
|
5909
|
+
suppliedBy: z61.strictObject({ text: z61.string(), verified: z61.literal(false) }).optional()
|
|
5910
|
+
})).max(192).optional(),
|
|
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)
|
|
5915
|
+
}).optional()
|
|
5046
5916
|
}).optional()
|
|
5047
5917
|
});
|
|
5048
5918
|
|
|
5049
5919
|
// ../schemas/src/draft-hosted-output-check-record.ts
|
|
5050
|
-
import { z as
|
|
5920
|
+
import { z as z64 } from "zod";
|
|
5051
5921
|
|
|
5052
5922
|
// ../schemas/src/draft-artifact-lint.ts
|
|
5053
|
-
import { z as
|
|
5923
|
+
import { z as z63 } from "zod";
|
|
5054
5924
|
|
|
5055
5925
|
// ../schemas/src/draft-job-obligations.ts
|
|
5056
|
-
import { z as
|
|
5057
|
-
var
|
|
5058
|
-
var
|
|
5926
|
+
import { z as z62 } from "zod";
|
|
5927
|
+
var id12 = DraftApplicationScopeSchema.shape.authorityId;
|
|
5928
|
+
var digest27 = DraftJobReceiptSchema.shape.receiptDigest;
|
|
5059
5929
|
var outcome2 = DraftJobObligationsOutcomeSchema;
|
|
5060
5930
|
var DraftApplicationJobMaterialV3Schema = DraftApplicationJobMaterialV2Schema.extend({
|
|
5061
|
-
schema:
|
|
5931
|
+
schema: z62.literal("felspar.application-job-material.draft/v3"),
|
|
5062
5932
|
obligations: DraftJobObligationsSchema
|
|
5063
|
-
}).superRefine((
|
|
5933
|
+
}).superRefine((value2, context3) => {
|
|
5064
5934
|
if (context3.issues.length > 0) {
|
|
5065
5935
|
return;
|
|
5066
5936
|
}
|
|
5067
|
-
const { obligations, discovery } =
|
|
5068
|
-
const { proposal } =
|
|
5937
|
+
const { obligations, discovery } = value2;
|
|
5938
|
+
const { proposal } = value2.input.invocation.authority.catalog;
|
|
5069
5939
|
const isSourceMatches = Object.entries(proposal.source).every(([key3, expected2]) => Reflect.get(obligations.source, key3) === expected2);
|
|
5070
|
-
const outcomes = new Set(obligations.outcomes.map((
|
|
5071
|
-
const isComplete = outcomes.size === proposal.allowedOutcomes.length && proposal.allowedOutcomes.every((
|
|
5940
|
+
const outcomes = new Set(obligations.outcomes.map((entry3) => entry3.outcomeId));
|
|
5941
|
+
const isComplete = outcomes.size === proposal.allowedOutcomes.length && proposal.allowedOutcomes.every((entry3) => outcomes.has(entry3));
|
|
5072
5942
|
const matches = [
|
|
5073
5943
|
isSourceMatches,
|
|
5074
5944
|
isComplete,
|
|
@@ -5086,57 +5956,57 @@ var DraftApplicationJobMaterialV3Schema = DraftApplicationJobMaterialV2Schema.ex
|
|
|
5086
5956
|
}
|
|
5087
5957
|
});
|
|
5088
5958
|
var HostedProposalInputV3Schema = HostedProposalInputV2Schema.extend({
|
|
5089
|
-
schema:
|
|
5959
|
+
schema: z62.literal("felspar.hosted-proposal.draft/v3"),
|
|
5090
5960
|
material: DraftApplicationJobMaterialV3Schema
|
|
5091
5961
|
});
|
|
5092
5962
|
var jobObligationsReplayRoutes = ["supplied", "evaluated"];
|
|
5093
5963
|
var replayRoutes = new Set(jobObligationsReplayRoutes);
|
|
5094
5964
|
var DraftJobObligationsExecutionSchema = DraftAnyJobExecutionSchema.refine((execution) => replayRoutes.has(execution.invocation.route), "Obligations assessments support supplied and evaluated native executions");
|
|
5095
|
-
var DraftJobObligationsNativeResultSchema =
|
|
5096
|
-
authority:
|
|
5097
|
-
discovery:
|
|
5098
|
-
executed:
|
|
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()),
|
|
5099
5969
|
receipt: DraftJobReceiptSchema
|
|
5100
5970
|
});
|
|
5101
|
-
var DraftJobObligationsInputSchema =
|
|
5971
|
+
var DraftJobObligationsInputSchema = z62.strictObject({
|
|
5102
5972
|
release: DraftApplicationReleaseSchema,
|
|
5103
|
-
material:
|
|
5973
|
+
material: z62.union([DraftApplicationJobMaterialV3Schema, DraftAnyApplicationJobMaterialSchema]),
|
|
5104
5974
|
execution: DraftJobObligationsExecutionSchema,
|
|
5105
|
-
expectedReceiptDigest:
|
|
5975
|
+
expectedReceiptDigest: digest27,
|
|
5106
5976
|
job: DraftJobObligationsNativeResultSchema,
|
|
5107
5977
|
explanation: HostedJobExplanationSchema,
|
|
5108
|
-
invocation: DraftJobObligationsScopeSchema.extend({ caseId:
|
|
5978
|
+
invocation: DraftJobObligationsScopeSchema.extend({ caseId: id12 })
|
|
5109
5979
|
});
|
|
5110
|
-
var requirements2 =
|
|
5111
|
-
status:
|
|
5980
|
+
var requirements2 = z62.strictObject({
|
|
5981
|
+
status: z62.enum(["established", "unresolved"]),
|
|
5112
5982
|
scope: DraftJobObligationsScopeSchema,
|
|
5113
5983
|
artifacts: outcome2.shape.artifacts,
|
|
5114
5984
|
approvals: outcome2.shape.approvals,
|
|
5115
|
-
unresolved:
|
|
5985
|
+
unresolved: z62.array(z62.strictObject({ scopeRef: id12, reasonCodes: z62.array(id12).min(1).max(64) })).max(64)
|
|
5116
5986
|
});
|
|
5117
|
-
var nextReference =
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
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 })
|
|
5122
5992
|
]);
|
|
5123
|
-
var DraftJobObligationsAssessmentBodySchema =
|
|
5124
|
-
schema:
|
|
5125
|
-
binding:
|
|
5126
|
-
releaseDigest:
|
|
5127
|
-
materialDigest:
|
|
5128
|
-
nativeReceiptDigest:
|
|
5129
|
-
jobId:
|
|
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,
|
|
5130
6000
|
applicationScope: DraftApplicationScopeSchema,
|
|
5131
|
-
caseId:
|
|
5132
|
-
entityId:
|
|
5133
|
-
evaluationTime:
|
|
5134
|
-
purposeRef:
|
|
5135
|
-
useRef:
|
|
6001
|
+
caseId: id12,
|
|
6002
|
+
entityId: id12,
|
|
6003
|
+
evaluationTime: z62.iso.datetime({ offset: true }),
|
|
6004
|
+
purposeRef: id12,
|
|
6005
|
+
useRef: id12.nullable()
|
|
5136
6006
|
}),
|
|
5137
6007
|
requirements: requirements2,
|
|
5138
|
-
next:
|
|
5139
|
-
kind:
|
|
6008
|
+
next: z62.strictObject({
|
|
6009
|
+
kind: z62.enum([
|
|
5140
6010
|
"stop",
|
|
5141
6011
|
"review_required",
|
|
5142
6012
|
"gather_evidence",
|
|
@@ -5144,20 +6014,20 @@ var DraftJobObligationsAssessmentBodySchema = z56.strictObject({
|
|
|
5144
6014
|
"verify_before_action",
|
|
5145
6015
|
"return_result"
|
|
5146
6016
|
]),
|
|
5147
|
-
reasonCodes:
|
|
5148
|
-
refs:
|
|
6017
|
+
reasonCodes: z62.array(id12).max(64),
|
|
6018
|
+
refs: z62.array(nextReference).max(64)
|
|
5149
6019
|
})
|
|
5150
6020
|
});
|
|
5151
6021
|
function isNextRefDeclared(ref, required) {
|
|
5152
6022
|
switch (ref.kind) {
|
|
5153
6023
|
case "artifact_requirement": {
|
|
5154
|
-
return required.artifacts.some((
|
|
6024
|
+
return required.artifacts.some((entry3) => entry3.id === ref.id);
|
|
5155
6025
|
}
|
|
5156
6026
|
case "approval_requirement": {
|
|
5157
|
-
return required.approvals.some((
|
|
6027
|
+
return required.approvals.some((entry3) => entry3.id === ref.id);
|
|
5158
6028
|
}
|
|
5159
6029
|
case "unresolved_scope": {
|
|
5160
|
-
return required.unresolved.some((
|
|
6030
|
+
return required.unresolved.some((entry3) => entry3.scopeRef === ref.scopeRef);
|
|
5161
6031
|
}
|
|
5162
6032
|
case "evidence_need": {
|
|
5163
6033
|
return true;
|
|
@@ -5168,13 +6038,13 @@ function isNextRefDeclared(ref, required) {
|
|
|
5168
6038
|
}
|
|
5169
6039
|
}
|
|
5170
6040
|
var DraftJobObligationsAssessmentSchema = DraftJobObligationsAssessmentBodySchema.extend({
|
|
5171
|
-
assessmentDigest:
|
|
5172
|
-
}).superRefine((
|
|
5173
|
-
const { requirements: required } =
|
|
6041
|
+
assessmentDigest: digest27
|
|
6042
|
+
}).superRefine((value2, context3) => {
|
|
6043
|
+
const { requirements: required } = value2;
|
|
5174
6044
|
if (required.status === "established" !== (required.unresolved.length === 0) || required.status === "unresolved" && (required.artifacts.length > 0 || required.approvals.length > 0)) {
|
|
5175
6045
|
context3.addIssue({ code: "custom", message: "Requirements completeness differs" });
|
|
5176
6046
|
}
|
|
5177
|
-
for (const ref of
|
|
6047
|
+
for (const ref of value2.next.refs) {
|
|
5178
6048
|
if (!isNextRefDeclared(ref, required)) {
|
|
5179
6049
|
context3.addIssue({ code: "custom", message: "Dangling next reference" });
|
|
5180
6050
|
}
|
|
@@ -5182,48 +6052,48 @@ var DraftJobObligationsAssessmentSchema = DraftJobObligationsAssessmentBodySchem
|
|
|
5182
6052
|
});
|
|
5183
6053
|
|
|
5184
6054
|
// ../schemas/src/draft-artifact-lint.ts
|
|
5185
|
-
var
|
|
5186
|
-
var
|
|
6055
|
+
var id13 = DraftApplicationScopeSchema.shape.authorityId;
|
|
6056
|
+
var digest28 = DraftJobReceiptSchema.shape.receiptDigest;
|
|
5187
6057
|
var passage3 = ArtifactSpecificationSchema;
|
|
5188
|
-
var plainArtifact =
|
|
5189
|
-
id:
|
|
5190
|
-
revision:
|
|
5191
|
-
mediaType:
|
|
5192
|
-
exportProfile:
|
|
5193
|
-
content:
|
|
5194
|
-
expectedContentDigest:
|
|
5195
|
-
});
|
|
5196
|
-
var structuredArtifact =
|
|
5197
|
-
id:
|
|
5198
|
-
revision:
|
|
5199
|
-
mediaType:
|
|
5200
|
-
exportProfile:
|
|
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(),
|
|
5201
6071
|
content: DraftStructuredOutputSchema,
|
|
5202
|
-
expectedContentDigest:
|
|
6072
|
+
expectedContentDigest: digest28
|
|
5203
6073
|
});
|
|
5204
|
-
var ArtifactLintArtifactSchema =
|
|
6074
|
+
var ArtifactLintArtifactSchema = z63.discriminatedUnion("mediaType", [
|
|
5205
6075
|
plainArtifact,
|
|
5206
6076
|
structuredArtifact
|
|
5207
6077
|
]);
|
|
5208
|
-
var ArtifactLintDecisionSchema =
|
|
6078
|
+
var ArtifactLintDecisionSchema = z63.strictObject({
|
|
5209
6079
|
inputs: DraftJobObligationsInputSchema,
|
|
5210
6080
|
assessment: DraftJobObligationsAssessmentSchema,
|
|
5211
|
-
expectedAssessmentDigest:
|
|
6081
|
+
expectedAssessmentDigest: digest28
|
|
5212
6082
|
});
|
|
5213
|
-
var ArtifactLintInputSchema =
|
|
5214
|
-
schema:
|
|
5215
|
-
requestId:
|
|
6083
|
+
var ArtifactLintInputSchema = z63.strictObject({
|
|
6084
|
+
schema: z63.literal("felspar.lint.draft/v1"),
|
|
6085
|
+
requestId: id13,
|
|
5216
6086
|
release: DraftApplicationReleaseSchema,
|
|
5217
6087
|
material: DraftApplicationJobMaterialV3Schema,
|
|
5218
6088
|
manifest: ArtifactCheckManifestSchema,
|
|
5219
|
-
expectedManifestDigest:
|
|
5220
|
-
attachedObligations:
|
|
5221
|
-
attachedCase:
|
|
5222
|
-
decisionReceiptDigest:
|
|
5223
|
-
answers:
|
|
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)
|
|
5224
6094
|
}).optional(),
|
|
5225
|
-
case:
|
|
5226
|
-
artifactRequirementId:
|
|
6095
|
+
case: z63.strictObject({ caseId: id13, purposeRef: id13, useRef: id13.nullable() }),
|
|
6096
|
+
artifactRequirementId: id13.nullable(),
|
|
5227
6097
|
decision: ArtifactLintDecisionSchema.nullable(),
|
|
5228
6098
|
artifact: ArtifactLintArtifactSchema
|
|
5229
6099
|
});
|
|
@@ -5236,11 +6106,11 @@ var artifactCheckStatuses = [
|
|
|
5236
6106
|
"not_applicable",
|
|
5237
6107
|
"skipped"
|
|
5238
6108
|
];
|
|
5239
|
-
var range =
|
|
5240
|
-
sectionId:
|
|
5241
|
-
start:
|
|
5242
|
-
end:
|
|
5243
|
-
offsetUnit:
|
|
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")
|
|
5244
6114
|
});
|
|
5245
6115
|
var findingCodes = [
|
|
5246
6116
|
"section_missing",
|
|
@@ -5261,6 +6131,7 @@ var findingCodes = [
|
|
|
5261
6131
|
"semantic_violation",
|
|
5262
6132
|
"semantic_missing",
|
|
5263
6133
|
"semantic_unresolved",
|
|
6134
|
+
"possible_prompt_injection",
|
|
5264
6135
|
"case_answer_conflict",
|
|
5265
6136
|
"case_answer_missing",
|
|
5266
6137
|
"case_answer_unconfirmed",
|
|
@@ -5268,174 +6139,331 @@ var findingCodes = [
|
|
|
5268
6139
|
"evaluation_budget_exceeded",
|
|
5269
6140
|
"evaluation_skipped"
|
|
5270
6141
|
];
|
|
5271
|
-
var ArtifactFindingSchema =
|
|
5272
|
-
code:
|
|
5273
|
-
checkId:
|
|
5274
|
-
severity:
|
|
6142
|
+
var ArtifactFindingSchema = z63.strictObject({
|
|
6143
|
+
code: z63.enum(findingCodes),
|
|
6144
|
+
checkId: id13.nullable(),
|
|
6145
|
+
severity: z63.enum(["error", "warning"]),
|
|
5275
6146
|
specification: passage3.nullable(),
|
|
5276
6147
|
location: range.nullable(),
|
|
5277
|
-
insertionAnchor:
|
|
5278
|
-
literalIndex:
|
|
5279
|
-
});
|
|
5280
|
-
var ArtifactCheckObservationSchema =
|
|
5281
|
-
checkId:
|
|
5282
|
-
kind:
|
|
5283
|
-
required:
|
|
5284
|
-
method:
|
|
5285
|
-
status:
|
|
5286
|
-
occurrences:
|
|
5287
|
-
parsedValue:
|
|
5288
|
-
caseValue:
|
|
5289
|
-
});
|
|
5290
|
-
var ArtifactLintRecordBodySchema =
|
|
5291
|
-
schema:
|
|
5292
|
-
requestId:
|
|
5293
|
-
status:
|
|
5294
|
-
caseContext:
|
|
5295
|
-
binding:
|
|
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({
|
|
5296
6167
|
scope: DraftApplicationScopeSchema,
|
|
5297
|
-
releaseId:
|
|
5298
|
-
releaseDigest:
|
|
5299
|
-
materialDigest:
|
|
5300
|
-
obligationsDigest:
|
|
5301
|
-
caseFactsDigest:
|
|
5302
|
-
jobId:
|
|
5303
|
-
manifestId:
|
|
5304
|
-
manifestDigest:
|
|
5305
|
-
contract:
|
|
5306
|
-
caseId:
|
|
5307
|
-
purposeRef:
|
|
5308
|
-
useRef:
|
|
5309
|
-
artifactRequirementId:
|
|
5310
|
-
decisionReceiptDigest:
|
|
5311
|
-
obligationsAssessmentDigest:
|
|
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()
|
|
5312
6183
|
}),
|
|
5313
|
-
artifact:
|
|
5314
|
-
id:
|
|
5315
|
-
revision:
|
|
5316
|
-
mediaType:
|
|
5317
|
-
exportProfile:
|
|
5318
|
-
contentDigest:
|
|
5319
|
-
sections:
|
|
5320
|
-
id:
|
|
5321
|
-
units:
|
|
5322
|
-
contentDigest:
|
|
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()
|
|
5323
6194
|
})).max(artifactLintLimits.maxSections)
|
|
5324
6195
|
}),
|
|
5325
|
-
checks:
|
|
5326
|
-
findings:
|
|
6196
|
+
checks: z63.array(ArtifactCheckObservationSchema).max(artifactLintLimits.maxChecks),
|
|
6197
|
+
findings: z63.array(ArtifactFindingSchema).max(2048),
|
|
5327
6198
|
semantic: ArtifactSemanticRecordSchema.nullable(),
|
|
5328
|
-
coverage:
|
|
5329
|
-
scope:
|
|
5330
|
-
declared:
|
|
5331
|
-
applicable:
|
|
5332
|
-
completed:
|
|
5333
|
-
required:
|
|
5334
|
-
requiredCompleted:
|
|
5335
|
-
textAssigned:
|
|
5336
|
-
semantic:
|
|
5337
|
-
nativeDocumentLayout:
|
|
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")
|
|
5338
6209
|
}),
|
|
5339
|
-
actionAuthorized:
|
|
6210
|
+
actionAuthorized: z63.literal(false)
|
|
5340
6211
|
});
|
|
5341
6212
|
var ArtifactLintRecordSchema = ArtifactLintRecordBodySchema.extend({
|
|
5342
|
-
recordDigest:
|
|
5343
|
-
});
|
|
5344
|
-
var ArtifactLintReceiptSchema =
|
|
5345
|
-
schema:
|
|
5346
|
-
recordDigest:
|
|
5347
|
-
releaseDigest:
|
|
5348
|
-
manifestDigest:
|
|
5349
|
-
contractDigest:
|
|
5350
|
-
caseId:
|
|
5351
|
-
caseContext:
|
|
5352
|
-
decisionReceiptDigest:
|
|
5353
|
-
obligationsAssessmentDigest:
|
|
5354
|
-
artifactId:
|
|
5355
|
-
artifactRevision:
|
|
5356
|
-
artifactDigest:
|
|
5357
|
-
actionAuthorized:
|
|
5358
|
-
receiptDigest:
|
|
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
|
|
5359
6230
|
});
|
|
5360
6231
|
|
|
5361
6232
|
// ../schemas/src/draft-hosted-output-check-record.ts
|
|
5362
|
-
var
|
|
5363
|
-
var
|
|
5364
|
-
var HostedOutputCheckInputSchema =
|
|
5365
|
-
executionId:
|
|
5366
|
-
output:
|
|
5367
|
-
text:
|
|
5368
|
-
revision:
|
|
5369
|
-
});
|
|
5370
|
-
var HostedOutputCheckRecordSchema =
|
|
5371
|
-
schema:
|
|
5372
|
-
checkId:
|
|
5373
|
-
jobId:
|
|
5374
|
-
output:
|
|
5375
|
-
decision:
|
|
5376
|
-
release:
|
|
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 }),
|
|
5377
6248
|
record: ArtifactLintRecordSchema,
|
|
5378
6249
|
receipt: ArtifactLintReceiptSchema.nullable(),
|
|
5379
|
-
evaluation:
|
|
5380
|
-
modelCalls:
|
|
5381
|
-
reason:
|
|
6250
|
+
evaluation: z64.strictObject({
|
|
6251
|
+
modelCalls: z64.number().int().min(0),
|
|
6252
|
+
reason: z64.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable()
|
|
5382
6253
|
})
|
|
5383
6254
|
});
|
|
5384
6255
|
|
|
5385
6256
|
// src/draft-hosted-client.ts
|
|
5386
|
-
import { z as
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
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)
|
|
5396
6270
|
}).loose();
|
|
5397
|
-
var quotedWords =
|
|
5398
|
-
var FelsparCaseSchema =
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
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),
|
|
5413
6290
|
why: quotedWords
|
|
5414
6291
|
});
|
|
5415
|
-
var
|
|
6292
|
+
var AgentExecutedResponseSchema = HostedJobResultSchema.extend({
|
|
5416
6293
|
result: HostedJobResultSchema.shape.result.unwrap().extend({
|
|
5417
6294
|
case: FelsparCaseSchema.optional(),
|
|
5418
6295
|
subject: FelsparResultSubjectSchema.optional(),
|
|
5419
6296
|
escalation: FelsparEscalationSchema.optional(),
|
|
5420
|
-
missing:
|
|
6297
|
+
missing: z65.array(z65.string()).optional()
|
|
5421
6298
|
}).nullable()
|
|
5422
6299
|
});
|
|
5423
|
-
var
|
|
5424
|
-
|
|
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
|
+
})
|
|
5425
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)
|
|
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;
|
|
5426
6454
|
var hostedPartsContentType = "application/x.felspar-content-parts";
|
|
5427
|
-
async function partsBody(
|
|
5428
|
-
const packed = await packContentParts(
|
|
6455
|
+
async function partsBody(value2) {
|
|
6456
|
+
const packed = await packContentParts(value2);
|
|
5429
6457
|
return packed.text;
|
|
5430
6458
|
}
|
|
5431
|
-
async function factsRequest(
|
|
5432
|
-
if (typeof
|
|
5433
|
-
return HostedFactsRequestSchema.parse({ mode: "facts", ...
|
|
6459
|
+
async function factsRequest(value2, describeRelease) {
|
|
6460
|
+
if (typeof value2.expectedReleaseDigest === "string") {
|
|
6461
|
+
return HostedFactsRequestSchema.parse({ mode: "facts", ...value2 });
|
|
5434
6462
|
}
|
|
5435
|
-
const described = await describeRelease(HostedObjectSchema.shape.id.parse(
|
|
6463
|
+
const described = await describeRelease(HostedObjectSchema.shape.id.parse(value2.jobId));
|
|
5436
6464
|
return HostedFactsRequestSchema.parse({
|
|
5437
6465
|
mode: "facts",
|
|
5438
|
-
...
|
|
6466
|
+
...value2,
|
|
5439
6467
|
expectedReleaseDigest: described.release.releaseDigest
|
|
5440
6468
|
});
|
|
5441
6469
|
}
|
|
@@ -5473,31 +6501,31 @@ ${jobId}`;
|
|
|
5473
6501
|
return result;
|
|
5474
6502
|
};
|
|
5475
6503
|
}
|
|
5476
|
-
var refusalCode =
|
|
5477
|
-
var fieldPath =
|
|
5478
|
-
var refusalEscalationSchema =
|
|
5479
|
-
id:
|
|
5480
|
-
trigger:
|
|
5481
|
-
why:
|
|
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) })
|
|
5482
6510
|
});
|
|
5483
|
-
var refusalSchema =
|
|
6511
|
+
var refusalSchema = z67.object({
|
|
5484
6512
|
error: refusalCode,
|
|
5485
6513
|
path: fieldPath.optional(),
|
|
5486
|
-
currentReleaseDigest:
|
|
5487
|
-
retryAfterSeconds:
|
|
5488
|
-
escalation:
|
|
5489
|
-
issues:
|
|
5490
|
-
}).transform(({ escalation: named, ...
|
|
5491
|
-
const fix = hostedRefusalFix(
|
|
5492
|
-
const recovery = hostedRefusalRecovery(
|
|
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()
|
|
6518
|
+
}).transform(({ escalation: named, ...value2 }) => {
|
|
6519
|
+
const fix = hostedRefusalFix(value2.error);
|
|
6520
|
+
const recovery = hostedRefusalRecovery(value2.error);
|
|
5493
6521
|
const escalation = refusalEscalationSchema.safeParse(named).data;
|
|
5494
6522
|
return {
|
|
5495
|
-
...
|
|
6523
|
+
...value2,
|
|
5496
6524
|
...escalation !== void 0 && { escalation },
|
|
5497
6525
|
...fix !== null && { fix },
|
|
5498
6526
|
...recovery !== null && { recovery },
|
|
5499
|
-
...
|
|
5500
|
-
issues:
|
|
6527
|
+
...value2.issues && {
|
|
6528
|
+
issues: value2.issues.map((issue) => {
|
|
5501
6529
|
const issueFix = hostedRefusalFix(issue.code);
|
|
5502
6530
|
return issueFix === null ? issue : { ...issue, fix: issueFix };
|
|
5503
6531
|
})
|
|
@@ -5541,20 +6569,20 @@ function outputCheckCalls(call) {
|
|
|
5541
6569
|
const objectId = HostedObjectSchema.shape.id;
|
|
5542
6570
|
const checksOf = (job) => `/v0/jobs/${encodeURIComponent(objectId.parse(job))}/output-checks`;
|
|
5543
6571
|
return {
|
|
5544
|
-
checkOutput: async (job,
|
|
6572
|
+
checkOutput: async (job, value2) => await call(checksOf(job), HostedOutputCheckReplySchema, HostedOutputCheckInputSchema.parse(value2)),
|
|
5545
6573
|
readOutputCheck: async (job, checkId) => await call(`${checksOf(job)}/${encodeURIComponent(objectId.parse(checkId))}`, HostedOutputCheckReplySchema)
|
|
5546
6574
|
};
|
|
5547
6575
|
}
|
|
5548
6576
|
function agentCalls(call) {
|
|
5549
6577
|
const objectId = HostedObjectSchema.shape.id;
|
|
5550
6578
|
return {
|
|
5551
|
-
listJobs: async () => await call("/v0/jobs",
|
|
6579
|
+
listJobs: async () => await call("/v0/jobs", FelsparJobListSchema2),
|
|
5552
6580
|
describeCurrentJob: async (job) => await call(`/v0/jobs/${encodeURIComponent(objectId.parse(job))}/brief`, HostedJobDescriptionSchema),
|
|
5553
|
-
resolveJob: async (
|
|
5554
|
-
const input = HostedSuppliedJobInputSchema.parse(
|
|
5555
|
-
const releaseId = objectId.parse(
|
|
6581
|
+
resolveJob: async (id15, value2) => {
|
|
6582
|
+
const input = HostedSuppliedJobInputSchema.parse(value2);
|
|
6583
|
+
const releaseId = objectId.parse(id15);
|
|
5556
6584
|
const path3 = `/v0/releases/${encodeURIComponent(releaseId)}/jobs`;
|
|
5557
|
-
return pinnedResult(await call(path3,
|
|
6585
|
+
return pinnedResult(await call(path3, FelsparJobResultSchema2, input), releaseId, input);
|
|
5558
6586
|
}
|
|
5559
6587
|
};
|
|
5560
6588
|
}
|
|
@@ -5573,14 +6601,14 @@ function createHostedFelsparClient(configuration) {
|
|
|
5573
6601
|
}
|
|
5574
6602
|
const authorization = authorizationOf(configuration);
|
|
5575
6603
|
const fetcher = configuration.fetcher ?? fetch;
|
|
5576
|
-
async function call(path3, schema,
|
|
6604
|
+
async function call(path3, schema, value2) {
|
|
5577
6605
|
const headers = new Headers(authorization === null ? {} : { Authorization: authorization });
|
|
5578
|
-
const body =
|
|
6606
|
+
const body = value2 === void 0 ? void 0 : await partsBody(value2);
|
|
5579
6607
|
if (body !== void 0) {
|
|
5580
6608
|
headers.set("Content-Type", hostedPartsContentType);
|
|
5581
6609
|
}
|
|
5582
6610
|
const response = await fetcher(`${origin.origin}${path3}`, {
|
|
5583
|
-
method:
|
|
6611
|
+
method: value2 === void 0 ? "GET" : "POST",
|
|
5584
6612
|
headers,
|
|
5585
6613
|
credentials: "include",
|
|
5586
6614
|
redirect: "error",
|
|
@@ -5595,21 +6623,22 @@ function createHostedFelsparClient(configuration) {
|
|
|
5595
6623
|
const objectId = HostedObjectSchema.shape.id;
|
|
5596
6624
|
const describe = jobDescriber(async (releaseId, jobId) => await call(describePath(releaseId, jobId), HostedJobDescriptionSchema));
|
|
5597
6625
|
return {
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
6626
|
+
...decisionGraphCalls(call),
|
|
6627
|
+
submitSource: async (value2) => await call("/v0/sources", HostedObjectSchema, HostedSourceInputSchema.parse(value2)),
|
|
6628
|
+
submitProposal: async (value2) => await call("/v0/proposals", HostedObjectSchema, HostedProposalInputSchema.parse(value2)),
|
|
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)),
|
|
6633
|
+
verifyReceipt: async (executionObjectId, value2) => await call(`/v0/executions/${encodeURIComponent(objectId.parse(executionObjectId))}/verify`, HostedReceiptVerificationSchema, HostedReceiptVerificationInputSchema.parse(value2)),
|
|
5605
6634
|
...outputCheckCalls(call),
|
|
5606
|
-
executeJob: async (
|
|
6635
|
+
executeJob: async (id15, value2) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id15))}/jobs`, HostedJobResultSchema, HostedJobInputSchema.parse(value2)),
|
|
5607
6636
|
...agentCalls(call),
|
|
5608
|
-
resolveFacts: async (
|
|
5609
|
-
const releaseId = objectId.parse(
|
|
5610
|
-
const input = await factsRequest(
|
|
6637
|
+
resolveFacts: async (id15, value2) => {
|
|
6638
|
+
const releaseId = objectId.parse(id15);
|
|
6639
|
+
const input = await factsRequest(value2, async (jobId) => await describe(releaseId, jobId));
|
|
5611
6640
|
const path3 = `/v0/releases/${encodeURIComponent(releaseId)}/jobs`;
|
|
5612
|
-
return pinnedResult(await call(path3,
|
|
6641
|
+
return pinnedResult(await call(path3, FelsparJobResultSchema2, input), releaseId, input);
|
|
5613
6642
|
}
|
|
5614
6643
|
};
|
|
5615
6644
|
}
|