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