@felspar/sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -22
- package/dist/chunks/{chunk-7HN5KUTJ.js → chunk-FVPYJVF5.js} +1 -1
- package/dist/chunks/{chunk-3YVYBD4H.js → chunk-MIPPJBXB.js} +704 -449
- package/dist/chunks/{chunk-2RV7RPXW.js → chunk-ZHMUQJT2.js} +3 -2
- 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-hosted-client.d.ts +507 -0
- package/package.json +1 -6
- package/bin/felspar-sdk.mjs +0 -10
- package/bin/skill.mjs +0 -33
- package/skills/felspar/SKILL.md +0 -134
|
@@ -292,13 +292,13 @@ var contentPartsLimits = Object.freeze({
|
|
|
292
292
|
maxLogicalDepth: canonicalJsonLimits.maxDepth
|
|
293
293
|
});
|
|
294
294
|
var encoder = new TextEncoder();
|
|
295
|
-
function utf8(
|
|
296
|
-
if (
|
|
297
|
-
return encoder.encode(
|
|
295
|
+
function utf8(text8) {
|
|
296
|
+
if (text8.length >= 64) {
|
|
297
|
+
return encoder.encode(text8).byteLength;
|
|
298
298
|
}
|
|
299
299
|
let bytes = 0;
|
|
300
|
-
for (let index = 0; index <
|
|
301
|
-
const code =
|
|
300
|
+
for (let index = 0; index < text8.length; index += 1) {
|
|
301
|
+
const code = text8.codePointAt(index) ?? 0;
|
|
302
302
|
if (code < 128) {
|
|
303
303
|
bytes += 1;
|
|
304
304
|
} else if (code < 2048) {
|
|
@@ -312,8 +312,8 @@ function utf8(text7) {
|
|
|
312
312
|
}
|
|
313
313
|
return bytes;
|
|
314
314
|
}
|
|
315
|
-
async function sha256(
|
|
316
|
-
const hash = new Uint8Array(await crypto.subtle.digest("SHA-256", encoder.encode(
|
|
315
|
+
async function sha256(text8) {
|
|
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
319
|
function reference(digest28) {
|
|
@@ -491,12 +491,12 @@ async function packContentParts(value) {
|
|
|
491
491
|
}
|
|
492
492
|
parts.sort(byDigest);
|
|
493
493
|
const head = canonicalizeJson({ schema: draftContentPartsFormat, root: root.value, parts });
|
|
494
|
-
const
|
|
495
|
-
const storedBytes = utf8(
|
|
494
|
+
const text8 = [head, ...parts.map((part) => state.parts.get(part) ?? "")].join("\n");
|
|
495
|
+
const storedBytes = utf8(text8);
|
|
496
496
|
admitStored(parts.length, storedBytes);
|
|
497
497
|
return {
|
|
498
498
|
digest: digest28,
|
|
499
|
-
text:
|
|
499
|
+
text: text8,
|
|
500
500
|
parts: parts.length,
|
|
501
501
|
storedBytes,
|
|
502
502
|
logicalBytes: root.logical.bytes,
|
|
@@ -1273,6 +1273,21 @@ function clauseIdentity(clause) {
|
|
|
1273
1273
|
function isSameClause(left, right) {
|
|
1274
1274
|
return clauseIdentity(left) === clauseIdentity(right);
|
|
1275
1275
|
}
|
|
1276
|
+
function choiceValues(clause) {
|
|
1277
|
+
if ("equals" in clause) {
|
|
1278
|
+
return [clause.equals];
|
|
1279
|
+
}
|
|
1280
|
+
return "oneOf" in clause ? clause.oneOf : [];
|
|
1281
|
+
}
|
|
1282
|
+
function isGuardImplied(guard, clause) {
|
|
1283
|
+
if (isSameClause(guard, clause)) {
|
|
1284
|
+
return true;
|
|
1285
|
+
}
|
|
1286
|
+
const allowed = choiceValues(guard);
|
|
1287
|
+
const values = choiceValues(clause);
|
|
1288
|
+
const isSameKey = clause.key === guard.key;
|
|
1289
|
+
return isSameKey && values.length > 0 && values.every((value) => allowed.includes(value));
|
|
1290
|
+
}
|
|
1276
1291
|
function isPolicyValid(proposal, context3) {
|
|
1277
1292
|
const clauses2 = [
|
|
1278
1293
|
...proposal.rules.flatMap((rule3) => rule3.when),
|
|
@@ -1330,11 +1345,11 @@ function inspectRuleGuards(proposal, context3) {
|
|
|
1330
1345
|
for (const [index, rule3] of proposal.rules.entries()) {
|
|
1331
1346
|
for (const clause of rule3.when) {
|
|
1332
1347
|
const gates = isRelational ? conditionKeys(clause).flatMap((key3) => activationGuards(key3, requirements3)) : requirements3.get(clause.key)?.requiredWhen ?? [];
|
|
1333
|
-
if (gates.some((gate) => rule3.when.every((candidate2) => !
|
|
1348
|
+
if (gates.some((gate) => rule3.when.every((candidate2) => !isGuardImplied(gate, candidate2)))) {
|
|
1334
1349
|
context3.addIssue({
|
|
1335
1350
|
code: "custom",
|
|
1336
1351
|
path: ["rules", index],
|
|
1337
|
-
message: "Conditional rule must include every
|
|
1352
|
+
message: "Conditional rule must include every activation predicate, or an answer condition on its key within its answers"
|
|
1338
1353
|
});
|
|
1339
1354
|
}
|
|
1340
1355
|
}
|
|
@@ -1438,7 +1453,7 @@ import { z as z14 } from "zod";
|
|
|
1438
1453
|
|
|
1439
1454
|
// ../schemas/src/draft-scoring-references.ts
|
|
1440
1455
|
function hasClause(clauses2, expected2) {
|
|
1441
|
-
return clauses2.some((clause) =>
|
|
1456
|
+
return clauses2.some((clause) => isGuardImplied(expected2, clause));
|
|
1442
1457
|
}
|
|
1443
1458
|
function mayOverlap(left, right, definitions) {
|
|
1444
1459
|
for (const clause of left) {
|
|
@@ -1461,7 +1476,7 @@ function clauseIssues(clause, scope2) {
|
|
|
1461
1476
|
}
|
|
1462
1477
|
for (const key3 of conditionKeys(clause)) {
|
|
1463
1478
|
if (activationGuards(key3, byKey).some((guard) => !hasClause(active, guard))) {
|
|
1464
|
-
issues.push("Scoring applicability must include every
|
|
1479
|
+
issues.push("Scoring applicability must include every requirement activation guard, or an answer condition on its key within its answers");
|
|
1465
1480
|
}
|
|
1466
1481
|
}
|
|
1467
1482
|
return issues;
|
|
@@ -1469,8 +1484,8 @@ function clauseIssues(clause, scope2) {
|
|
|
1469
1484
|
function inspectScoringReferences(scoring, requirements3, context3) {
|
|
1470
1485
|
const definitions = new Map(requirements3.map((row2) => [row2.definition.key, row2.definition]));
|
|
1471
1486
|
const byKey = new Map(requirements3.map((row2) => [row2.definition.key, row2]));
|
|
1472
|
-
for (const [index,
|
|
1473
|
-
const active =
|
|
1487
|
+
for (const [index, criterion3] of scoring.criteria.entries()) {
|
|
1488
|
+
const active = criterion3.activeWhen ?? [];
|
|
1474
1489
|
const fail = (message) => {
|
|
1475
1490
|
context3.addIssue({ code: "custom", path: ["criteria", index], message });
|
|
1476
1491
|
};
|
|
@@ -1479,15 +1494,15 @@ function inspectScoringReferences(scoring, requirements3, context3) {
|
|
|
1479
1494
|
fail("Scoring applicability requires unconditional requirements");
|
|
1480
1495
|
}
|
|
1481
1496
|
}
|
|
1482
|
-
const all = [...active, ...
|
|
1497
|
+
const all = [...active, ...criterion3.cases.flatMap((item) => item.when)];
|
|
1483
1498
|
for (const clause of all) {
|
|
1484
1499
|
const messages = clauseIssues(clause, { active, definitions, byKey });
|
|
1485
1500
|
for (const message of messages) {
|
|
1486
1501
|
fail(message);
|
|
1487
1502
|
}
|
|
1488
1503
|
}
|
|
1489
|
-
for (const [caseIndex, item] of
|
|
1490
|
-
if (
|
|
1504
|
+
for (const [caseIndex, item] of criterion3.cases.entries()) {
|
|
1505
|
+
if (criterion3.cases.slice(caseIndex + 1).some((other) => mayOverlap(item.when, other.when, definitions))) {
|
|
1491
1506
|
fail("Scoring contribution cases must be provably disjoint");
|
|
1492
1507
|
}
|
|
1493
1508
|
}
|
|
@@ -1519,7 +1534,7 @@ function inspectScoredPolicy(proposal, context3) {
|
|
|
1519
1534
|
}
|
|
1520
1535
|
inspectScoringReferences(scoring, proposal.requirements, context3);
|
|
1521
1536
|
const ids3 = new Set(rules2.map((rule3) => rule3.id));
|
|
1522
|
-
if (gates.some((
|
|
1537
|
+
if (gates.some((id13) => !ids3.has(id13))) {
|
|
1523
1538
|
fail("Unknown mandatory gate rule");
|
|
1524
1539
|
}
|
|
1525
1540
|
if (rules2.every((rule3) => gates.includes(rule3.id))) {
|
|
@@ -1532,7 +1547,7 @@ function inspectScoredPolicy(proposal, context3) {
|
|
|
1532
1547
|
if (isGate ? hasRange || rule3.when.length === 0 : !hasRange) {
|
|
1533
1548
|
fail("Mandatory gates require fact predicates only; other rules require score ranges");
|
|
1534
1549
|
}
|
|
1535
|
-
if (rule3.overrides.some((
|
|
1550
|
+
if (rule3.overrides.some((id13) => gates.includes(id13) !== isGate)) {
|
|
1536
1551
|
fail("Explicit overrides cannot cross mandatory-gate and score-band classes");
|
|
1537
1552
|
}
|
|
1538
1553
|
const range2 = rule3.scoreRange;
|
|
@@ -1620,19 +1635,19 @@ function hasCycle(rules2) {
|
|
|
1620
1635
|
const graph = new Map(rules2.map((item) => [item.id, item.overrides]));
|
|
1621
1636
|
const visiting = /* @__PURE__ */ new Set();
|
|
1622
1637
|
const visited = /* @__PURE__ */ new Set();
|
|
1623
|
-
const hasPathCycle = (
|
|
1624
|
-
if (visiting.has(
|
|
1638
|
+
const hasPathCycle = (id13) => {
|
|
1639
|
+
if (visiting.has(id13)) {
|
|
1625
1640
|
return true;
|
|
1626
1641
|
}
|
|
1627
|
-
if (visited.has(
|
|
1642
|
+
if (visited.has(id13)) {
|
|
1628
1643
|
return false;
|
|
1629
1644
|
}
|
|
1630
|
-
visiting.add(
|
|
1631
|
-
if ((graph.get(
|
|
1645
|
+
visiting.add(id13);
|
|
1646
|
+
if ((graph.get(id13) ?? []).some(hasPathCycle)) {
|
|
1632
1647
|
return true;
|
|
1633
1648
|
}
|
|
1634
|
-
visiting.delete(
|
|
1635
|
-
visited.add(
|
|
1649
|
+
visiting.delete(id13);
|
|
1650
|
+
visited.add(id13);
|
|
1636
1651
|
return false;
|
|
1637
1652
|
};
|
|
1638
1653
|
return rules2.some((item) => hasPathCycle(item.id));
|
|
@@ -1661,11 +1676,11 @@ function inspectRules(proposal, context3) {
|
|
|
1661
1676
|
fail("Undeclared condition key or value");
|
|
1662
1677
|
}
|
|
1663
1678
|
}
|
|
1664
|
-
if (item.overrides.some((
|
|
1679
|
+
if (item.overrides.some((id13) => id13 === item.id || !ids3.has(id13))) {
|
|
1665
1680
|
fail("Unknown or self override");
|
|
1666
1681
|
}
|
|
1667
|
-
if (item.overrides.some((
|
|
1668
|
-
const target = byId.get(
|
|
1682
|
+
if (item.overrides.some((id13) => {
|
|
1683
|
+
const target = byId.get(id13);
|
|
1669
1684
|
return target !== void 0 && draftRulePriority(target) > draftRulePriority(item);
|
|
1670
1685
|
})) {
|
|
1671
1686
|
fail("Override points to a higher priority tier");
|
|
@@ -1838,8 +1853,8 @@ function checkExpected(candidate2, context3) {
|
|
|
1838
1853
|
}
|
|
1839
1854
|
unique2(result.observationIds, context3, ["expected", "observationIds"]);
|
|
1840
1855
|
const observationIds = new Set(candidate2.observations.map((entry2) => entry2.id));
|
|
1841
|
-
for (const [index,
|
|
1842
|
-
requireBinding2(observationIds.has(
|
|
1856
|
+
for (const [index, id13] of result.observationIds.entries()) {
|
|
1857
|
+
requireBinding2(observationIds.has(id13), context3, {
|
|
1843
1858
|
path: ["expected", "observationIds", index],
|
|
1844
1859
|
message: "Unknown observation"
|
|
1845
1860
|
});
|
|
@@ -2131,7 +2146,7 @@ var bundleNodeLimit = 65536;
|
|
|
2131
2146
|
function boundedDraftInput(limits2) {
|
|
2132
2147
|
return z21.unknown().transform((input, context3) => {
|
|
2133
2148
|
let nodes = 0;
|
|
2134
|
-
let
|
|
2149
|
+
let text8 = 0;
|
|
2135
2150
|
const budgetError = new Error("Draft input budget exceeded or non-data input");
|
|
2136
2151
|
function copy(value, depth) {
|
|
2137
2152
|
nodes += 1;
|
|
@@ -2139,8 +2154,8 @@ function boundedDraftInput(limits2) {
|
|
|
2139
2154
|
throw budgetError;
|
|
2140
2155
|
}
|
|
2141
2156
|
if (typeof value === "string") {
|
|
2142
|
-
|
|
2143
|
-
if (value.length > limits2.stringLength ||
|
|
2157
|
+
text8 += value.length;
|
|
2158
|
+
if (value.length > limits2.stringLength || text8 > limits2.totalText) {
|
|
2144
2159
|
throw budgetError;
|
|
2145
2160
|
}
|
|
2146
2161
|
return value;
|
|
@@ -2192,7 +2207,7 @@ function boundedDraftInput(limits2) {
|
|
|
2192
2207
|
});
|
|
2193
2208
|
}
|
|
2194
2209
|
var isUnicodeText = (value) => !/[\uD800-\uDFFF]/u.test(value);
|
|
2195
|
-
var isSplitCharacter = (
|
|
2210
|
+
var isSplitCharacter = (text8, offset) => offset > 0 && offset < text8.length && /[\uDC00-\uDFFF]/u.test(text8.charAt(offset));
|
|
2196
2211
|
var sourceText = DraftSourceReferenceSchema.omit({ contentDigest: true }).extend({
|
|
2197
2212
|
text: z21.string().min(1).max(1048576).refine(isUnicodeText, "Lone Unicode surrogate"),
|
|
2198
2213
|
offsetUnit: z21.literal("utf16_code_units"),
|
|
@@ -3023,13 +3038,13 @@ function areSubjectsValid(subjects, isIsolated) {
|
|
|
3023
3038
|
function areEscalationsValid(escalations, context3) {
|
|
3024
3039
|
const { isIsolated, outcomes } = context3;
|
|
3025
3040
|
const ids3 = new Set(escalations.routes.map((row2) => row2.id));
|
|
3026
|
-
const named = [escalations.unresolved, escalations.attemptLimit].filter((
|
|
3041
|
+
const named = [escalations.unresolved, escalations.attemptLimit].filter((id13) => id13 !== null);
|
|
3027
3042
|
return [
|
|
3028
3043
|
ids3.size === escalations.routes.length,
|
|
3029
3044
|
escalations.routes.every((row2) => isIsolated(row2.entryId, "routing_jobs")),
|
|
3030
3045
|
hasUniqueValues(escalations.outcomes.map((row2) => row2.outcome)),
|
|
3031
3046
|
escalations.outcomes.every((row2) => ids3.has(row2.escalation) && outcomes.has(row2.outcome)),
|
|
3032
|
-
named.every((
|
|
3047
|
+
named.every((id13) => ids3.has(id13))
|
|
3033
3048
|
].every(Boolean);
|
|
3034
3049
|
}
|
|
3035
3050
|
function isGuideValid(guide, isIsolated) {
|
|
@@ -3119,7 +3134,7 @@ var DraftContextSelectionPlanSchema = z31.strictObject({
|
|
|
3119
3134
|
if (candidateIds.length > 64 || !hasUniqueIds(candidateIds) || !hasUniqueIds(plan.groups.map((item) => item.id)) || !hasUniqueIds(plan.entries.map((item) => item.id))) {
|
|
3120
3135
|
context3.addIssue({ code: "custom", message: "Duplicate identities or too many candidates" });
|
|
3121
3136
|
}
|
|
3122
|
-
if (plan.requiredIds.some((
|
|
3137
|
+
if (plan.requiredIds.some((id13) => candidateIds.includes(id13))) {
|
|
3123
3138
|
context3.addIssue({ code: "custom", message: "Global required root cannot be a candidate" });
|
|
3124
3139
|
}
|
|
3125
3140
|
const guidanceId = plan.unresolvedGuidanceEntryId;
|
|
@@ -3710,7 +3725,7 @@ var DraftApplicationReleaseSchema = z43.strictObject({
|
|
|
3710
3725
|
});
|
|
3711
3726
|
|
|
3712
3727
|
// ../schemas/src/draft-hosted-application.ts
|
|
3713
|
-
import { z as
|
|
3728
|
+
import { z as z53 } from "zod";
|
|
3714
3729
|
|
|
3715
3730
|
// ../schemas/src/draft-source-instant.ts
|
|
3716
3731
|
var localPattern = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?([^.\d].*)$/u;
|
|
@@ -4368,60 +4383,244 @@ var HostedOutputChecksSchema = z49.strictObject({
|
|
|
4368
4383
|
}
|
|
4369
4384
|
});
|
|
4370
4385
|
|
|
4386
|
+
// ../schemas/src/draft-pack-revision.ts
|
|
4387
|
+
import { z as z52 } from "zod";
|
|
4388
|
+
|
|
4389
|
+
// ../schemas/src/draft-pack-draft-outputs.ts
|
|
4390
|
+
import { z as z50 } from "zod";
|
|
4391
|
+
var identifier21 = z50.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/u, "Use lowercase letters, digits, - and _");
|
|
4392
|
+
var quote = z50.string().min(1).max(4e3);
|
|
4393
|
+
var wording = z50.string().min(1).max(artifactLintLimits.maxLiteralUnits).regex(/\S/u, "Wording needs a visible character").refine(isWellFormedText, "Wording has a broken character");
|
|
4394
|
+
var packDraftOutputLimits = {
|
|
4395
|
+
maxOutputs: 8,
|
|
4396
|
+
maxChecks: 16,
|
|
4397
|
+
maxQuestions: 24,
|
|
4398
|
+
maxContext: 8,
|
|
4399
|
+
defaultCharacters: 8e3,
|
|
4400
|
+
maxCharacters: artifactLintLimits.maxSectionUnits
|
|
4401
|
+
};
|
|
4402
|
+
var wordingCheck = (max) => z50.strictObject({ id: identifier21, quote, wording: z50.array(wording).min(1).max(max) });
|
|
4403
|
+
var PackDraftOutputSchema = z50.strictObject({
|
|
4404
|
+
id: identifier21,
|
|
4405
|
+
what: quote,
|
|
4406
|
+
outcomes: z50.array(identifier21).min(1).max(64).refine(hasUniqueValues, "Duplicate outcome"),
|
|
4407
|
+
maxCharacters: z50.number().int().min(1).max(packDraftOutputLimits.maxCharacters).optional(),
|
|
4408
|
+
context: z50.array(z50.strictObject({ id: identifier21, quote })).min(1).max(packDraftOutputLimits.maxContext).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate context id").optional(),
|
|
4409
|
+
require: z50.array(wordingCheck(artifactLintLimits.maxAlternatives)).max(packDraftOutputLimits.maxChecks).optional(),
|
|
4410
|
+
prohibit: z50.array(wordingCheck(artifactLintLimits.maxLiterals)).max(packDraftOutputLimits.maxChecks).optional(),
|
|
4411
|
+
ask: z50.array(z50.strictObject({
|
|
4412
|
+
id: identifier21,
|
|
4413
|
+
quote,
|
|
4414
|
+
kind: z50.enum(["require", "prohibit"]),
|
|
4415
|
+
question: z50.string().min(1).max(2e3).regex(/\S/u)
|
|
4416
|
+
})).max(packDraftOutputLimits.maxQuestions).optional(),
|
|
4417
|
+
states: z50.array(z50.strictObject({
|
|
4418
|
+
id: identifier21,
|
|
4419
|
+
quote,
|
|
4420
|
+
question: identifier21,
|
|
4421
|
+
wording: z50.record(identifier21, z50.array(wording).min(1).max(8)).optional()
|
|
4422
|
+
})).max(packDraftOutputLimits.maxQuestions).optional()
|
|
4423
|
+
}).refine((output) => {
|
|
4424
|
+
const ids3 = [
|
|
4425
|
+
...output.require ?? [],
|
|
4426
|
+
...output.prohibit ?? [],
|
|
4427
|
+
...output.ask ?? [],
|
|
4428
|
+
...output.states ?? []
|
|
4429
|
+
];
|
|
4430
|
+
return hasUniqueValues(ids3.map((row2) => row2.id));
|
|
4431
|
+
}, "Duplicate check id").refine((output) => {
|
|
4432
|
+
return (output.ask?.length ?? 0) + (output.states?.length ?? 0) <= packDraftOutputLimits.maxQuestions;
|
|
4433
|
+
}, `At most ${packDraftOutputLimits.maxQuestions} asked questions and stated answers together`).refine((output) => {
|
|
4434
|
+
return (output.require?.length ?? 0) + (output.prohibit?.length ?? 0) + (output.ask?.length ?? 0) + (output.states?.length ?? 0) > 0;
|
|
4435
|
+
}, "An output needs at least one check");
|
|
4436
|
+
var PackDraftOutputsSchema = z50.array(PackDraftOutputSchema).min(1).max(packDraftOutputLimits.maxOutputs).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate output");
|
|
4437
|
+
|
|
4438
|
+
// ../schemas/src/draft-pack-draft-scoring.ts
|
|
4439
|
+
import { z as z51 } from "zod";
|
|
4440
|
+
var points = z51.number().min(0).max(1e6);
|
|
4441
|
+
var PackDraftScoreSchema = z51.strictObject({
|
|
4442
|
+
lt: points.optional(),
|
|
4443
|
+
lte: points.optional(),
|
|
4444
|
+
gt: points.optional(),
|
|
4445
|
+
gte: points.optional(),
|
|
4446
|
+
eq: points.optional(),
|
|
4447
|
+
quote: draftQuote
|
|
4448
|
+
}).superRefine((value, context3) => {
|
|
4449
|
+
const lower = Number(value.gt !== void 0) + Number(value.gte !== void 0);
|
|
4450
|
+
const upper = Number(value.lt !== void 0) + Number(value.lte !== void 0);
|
|
4451
|
+
const hasEquality = value.eq !== void 0;
|
|
4452
|
+
if (lower + upper + Number(hasEquality) === 0) {
|
|
4453
|
+
context3.addIssue({ code: "custom", message: "Give a bound: lt, lte, gt, gte or eq" });
|
|
4454
|
+
} else if (lower > 1 || upper > 1) {
|
|
4455
|
+
context3.addIssue({ code: "custom", message: "At most one lower and one upper bound" });
|
|
4456
|
+
} else if (hasEquality && lower + upper > 0) {
|
|
4457
|
+
context3.addIssue({ code: "custom", message: "eq stands alone" });
|
|
4458
|
+
}
|
|
4459
|
+
});
|
|
4460
|
+
var contribution2 = z51.strictObject({
|
|
4461
|
+
id: draftIdentifier,
|
|
4462
|
+
points,
|
|
4463
|
+
quote: draftQuote,
|
|
4464
|
+
when: PackDraftConditionsSchema
|
|
4465
|
+
});
|
|
4466
|
+
var criterion2 = z51.strictObject({
|
|
4467
|
+
id: draftIdentifier,
|
|
4468
|
+
meaning: draftQuote,
|
|
4469
|
+
activeWhen: PackDraftConditionsSchema.optional(),
|
|
4470
|
+
points: z51.array(contribution2).min(1).max(16).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate points id"),
|
|
4471
|
+
otherwise: z51.strictObject({ points, quote: draftQuote }).optional()
|
|
4472
|
+
});
|
|
4473
|
+
var PackDraftScoringSchema = z51.strictObject({
|
|
4474
|
+
scale: z51.union([z51.literal(1), z51.literal(100)]).optional(),
|
|
4475
|
+
criteria: z51.array(criterion2).min(1).max(16).refine((rows) => hasUniqueValues(rows.map((row2) => row2.id)), "Duplicate criterion")
|
|
4476
|
+
});
|
|
4477
|
+
var packDraftScoreExpectation = {
|
|
4478
|
+
score: z51.number().min(0).optional(),
|
|
4479
|
+
points: z51.record(draftIdentifier, z51.number().min(0).nullable()).optional()
|
|
4480
|
+
};
|
|
4481
|
+
|
|
4482
|
+
// ../schemas/src/draft-pack-revision.ts
|
|
4483
|
+
var KeptPackDraftSchema = z52.looseObject({
|
|
4484
|
+
schema: z52.string().regex(/^felspar\.pack-draft\/v\d{1,3}$/u),
|
|
4485
|
+
job: z52.string().min(1).max(200)
|
|
4486
|
+
});
|
|
4487
|
+
var id6 = z52.string().min(1).max(200);
|
|
4488
|
+
var text7 = z52.string().min(1).max(262144);
|
|
4489
|
+
var texts = z52.array(z52.string()).max(8);
|
|
4490
|
+
var when = PackDraftConditionsSchema;
|
|
4491
|
+
var conventions = packConventionFields;
|
|
4492
|
+
var PackOutlineSchema = z52.strictObject({
|
|
4493
|
+
schema: z52.literal("felspar.pack-outline/v0"),
|
|
4494
|
+
job: id6,
|
|
4495
|
+
purpose: text7.nullable(),
|
|
4496
|
+
useWhen: texts,
|
|
4497
|
+
notFor: texts,
|
|
4498
|
+
owner: text7.nullable(),
|
|
4499
|
+
evidenceKinds: z52.array(id6).max(8),
|
|
4500
|
+
maxEvidenceAgeDays: z52.number().int().min(1).nullable(),
|
|
4501
|
+
numberStyle: z52.enum(numberStyles).nullable(),
|
|
4502
|
+
dateOrder: conventions.dateOrder.unwrap().nullable(),
|
|
4503
|
+
timeZone: z52.string().min(1).max(64).nullable(),
|
|
4504
|
+
subject: id6.nullable(),
|
|
4505
|
+
subjects: z52.array(z52.strictObject({
|
|
4506
|
+
id: id6,
|
|
4507
|
+
definition: text7,
|
|
4508
|
+
identifier: z52.string().nullable(),
|
|
4509
|
+
example: z52.string().nullable(),
|
|
4510
|
+
match: z52.string(),
|
|
4511
|
+
relationships: z52.array(z52.strictObject({
|
|
4512
|
+
name: id6,
|
|
4513
|
+
subject: id6,
|
|
4514
|
+
cardinality: z52.enum(["one", "many"]),
|
|
4515
|
+
required: z52.boolean(),
|
|
4516
|
+
definition: text7
|
|
4517
|
+
})).max(16),
|
|
4518
|
+
identity: PackDraftIdentitySchema.nullable()
|
|
4519
|
+
})).max(16),
|
|
4520
|
+
escalations: z52.array(z52.strictObject({ id: id6, quote: text7 })).max(16),
|
|
4521
|
+
questions: z52.array(z52.strictObject({
|
|
4522
|
+
key: id6,
|
|
4523
|
+
type: z52.enum(["enum", "boolean", "number", "date"]),
|
|
4524
|
+
meaning: text7,
|
|
4525
|
+
about: id6.nullable(),
|
|
4526
|
+
askOnlyWhen: z52.string().nullable(),
|
|
4527
|
+
when: when.nullable(),
|
|
4528
|
+
unit: z52.string().nullable(),
|
|
4529
|
+
unitWords: z52.array(z52.string()).max(16).nullable(),
|
|
4530
|
+
integer: z52.boolean().nullable(),
|
|
4531
|
+
minimum: z52.number().nullable(),
|
|
4532
|
+
maximum: z52.number().nullable(),
|
|
4533
|
+
answers: z52.array(z52.strictObject({
|
|
4534
|
+
value: id6,
|
|
4535
|
+
meaning: z52.string().nullable(),
|
|
4536
|
+
inclusions: texts,
|
|
4537
|
+
exclusions: texts,
|
|
4538
|
+
examples: texts,
|
|
4539
|
+
edgeCases: texts
|
|
4540
|
+
})).max(64),
|
|
4541
|
+
whereToLook: texts
|
|
4542
|
+
})).max(64),
|
|
4543
|
+
outcomes: z52.array(z52.strictObject({ id: id6, nextStep: text7.nullable(), escalate: id6.nullable() })).max(64),
|
|
4544
|
+
whenUnresolved: z52.strictObject({ quote: text7, escalate: id6.nullable() }).nullable(),
|
|
4545
|
+
attempts: z52.strictObject({ max: z52.number().int(), escalate: id6.nullable() }).nullable(),
|
|
4546
|
+
rules: z52.array(z52.strictObject({
|
|
4547
|
+
id: id6,
|
|
4548
|
+
meaning: text7,
|
|
4549
|
+
outcome: id6,
|
|
4550
|
+
when: when.nullable(),
|
|
4551
|
+
conditions: z52.string().nullable(),
|
|
4552
|
+
scoreRange: z52.record(z52.string(), z52.unknown()).nullable(),
|
|
4553
|
+
score: PackDraftScoreSchema.nullable(),
|
|
4554
|
+
gate: z52.boolean()
|
|
4555
|
+
})).max(256),
|
|
4556
|
+
scoring: PackDraftScoringSchema.nullable(),
|
|
4557
|
+
cases: z52.array(z52.strictObject({
|
|
4558
|
+
id: id6,
|
|
4559
|
+
why: z52.string().nullable(),
|
|
4560
|
+
facts: z52.record(id6, caseFactSchema),
|
|
4561
|
+
decisionDate: CalendarDateSchema.nullable(),
|
|
4562
|
+
subject: z52.strictObject({ id: id6 }).nullable(),
|
|
4563
|
+
expect: z52.strictObject({ outcome: id6, rule: id6, score: z52.number().nullable() })
|
|
4564
|
+
})).max(200),
|
|
4565
|
+
outputChecks: PackDraftOutputsSchema.nullable(),
|
|
4566
|
+
notKept: z52.array(z52.strictObject({ path: z52.string().min(1), reason: z52.string().min(1) })).max(64)
|
|
4567
|
+
});
|
|
4568
|
+
|
|
4371
4569
|
// ../schemas/src/draft-hosted-application.ts
|
|
4372
|
-
var
|
|
4570
|
+
var id7 = z53.string().min(1).max(200).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:@-]*$/u);
|
|
4373
4571
|
var digest23 = DraftApplicationReleaseSchema.shape.releaseDigest;
|
|
4374
|
-
var HostedSourceInputSchema =
|
|
4375
|
-
sourceId:
|
|
4376
|
-
revision:
|
|
4377
|
-
title:
|
|
4378
|
-
text:
|
|
4379
|
-
});
|
|
4380
|
-
var HostedProposalInputV0Schema =
|
|
4381
|
-
sourceObjectId:
|
|
4572
|
+
var HostedSourceInputSchema = z53.strictObject({
|
|
4573
|
+
sourceId: id7,
|
|
4574
|
+
revision: id7,
|
|
4575
|
+
title: z53.string().min(1).max(200),
|
|
4576
|
+
text: z53.string().min(1).max(1048576)
|
|
4577
|
+
});
|
|
4578
|
+
var HostedProposalInputV0Schema = z53.strictObject({
|
|
4579
|
+
sourceObjectId: id7,
|
|
4382
4580
|
expectedSourceDigest: digest23,
|
|
4383
4581
|
material: DraftApplicationJobMaterialSchema,
|
|
4384
4582
|
compilation: DraftCompilationSchema
|
|
4385
4583
|
});
|
|
4386
|
-
var HostedProposalInputV2Schema =
|
|
4387
|
-
schema:
|
|
4388
|
-
sourceObjectId:
|
|
4584
|
+
var HostedProposalInputV2Schema = z53.strictObject({
|
|
4585
|
+
schema: z53.literal("felspar.hosted-proposal.draft/v2"),
|
|
4586
|
+
sourceObjectId: id7,
|
|
4389
4587
|
expectedSourceDigest: digest23,
|
|
4390
4588
|
material: DraftApplicationJobMaterialV2Schema,
|
|
4391
|
-
outputChecks: HostedOutputChecksSchema.optional()
|
|
4589
|
+
outputChecks: HostedOutputChecksSchema.optional(),
|
|
4590
|
+
draft: KeptPackDraftSchema.optional()
|
|
4392
4591
|
});
|
|
4393
|
-
var HostedProposalInputSchema =
|
|
4592
|
+
var HostedProposalInputSchema = z53.union([
|
|
4394
4593
|
HostedProposalInputV2Schema,
|
|
4395
4594
|
HostedProposalInputV0Schema
|
|
4396
4595
|
]);
|
|
4397
|
-
var HostedApprovalInputSchema =
|
|
4596
|
+
var HostedApprovalInputSchema = z53.strictObject({
|
|
4398
4597
|
expectedProposalDigest: digest23,
|
|
4399
|
-
reviewedMeaning:
|
|
4400
|
-
reviewedFixtures:
|
|
4401
|
-
reviewNote:
|
|
4598
|
+
reviewedMeaning: z53.literal(true),
|
|
4599
|
+
reviewedFixtures: z53.literal(true),
|
|
4600
|
+
reviewNote: z53.string().min(1).max(2e3)
|
|
4402
4601
|
});
|
|
4403
|
-
var HostedReleaseInputSchema =
|
|
4404
|
-
var HostedReleaseBundleSchema =
|
|
4602
|
+
var HostedReleaseInputSchema = z53.strictObject({ expectedApprovalDigest: digest23 });
|
|
4603
|
+
var HostedReleaseBundleSchema = z53.strictObject({
|
|
4405
4604
|
release: DraftApplicationReleaseSchema,
|
|
4406
4605
|
material: DraftAnyApplicationJobMaterialSchema,
|
|
4407
|
-
approvalObjectId:
|
|
4606
|
+
approvalObjectId: id7,
|
|
4408
4607
|
approvalDigest: digest23,
|
|
4409
4608
|
proposalDigest: digest23,
|
|
4410
4609
|
sourceDigest: digest23,
|
|
4411
4610
|
verifiedCompilation: DraftVerifiedCompilationSchema.optional()
|
|
4412
4611
|
});
|
|
4413
|
-
var HostedJobInputSchema =
|
|
4414
|
-
executionId:
|
|
4612
|
+
var HostedJobInputSchema = z53.strictObject({
|
|
4613
|
+
executionId: id7,
|
|
4415
4614
|
expectedReleaseDigest: digest23,
|
|
4416
4615
|
material: DraftAnyApplicationJobMaterialSchema
|
|
4417
4616
|
});
|
|
4418
|
-
var HostedSuppliedJobInputSchema =
|
|
4419
|
-
mode:
|
|
4420
|
-
executionId:
|
|
4617
|
+
var HostedSuppliedJobInputSchema = z53.strictObject({
|
|
4618
|
+
mode: z53.literal("supplied"),
|
|
4619
|
+
executionId: id7,
|
|
4421
4620
|
expectedReleaseDigest: digest23,
|
|
4422
4621
|
expectedAuthorityDigest: digest23,
|
|
4423
|
-
jobId:
|
|
4424
|
-
entityId:
|
|
4622
|
+
jobId: id7,
|
|
4623
|
+
entityId: id7,
|
|
4425
4624
|
evidence: DraftRequiredDecisionSchema.shape.evidence,
|
|
4426
4625
|
passages: DraftLayeredEvaluationSchema.shape.passages.max(256)
|
|
4427
4626
|
});
|
|
@@ -4431,97 +4630,97 @@ var hostedFactsLimits = {
|
|
|
4431
4630
|
maxFactsBytes: 524288,
|
|
4432
4631
|
maxQuestions: 64
|
|
4433
4632
|
};
|
|
4434
|
-
var factSourceId =
|
|
4435
|
-
var observedAt =
|
|
4436
|
-
var factSource =
|
|
4437
|
-
class:
|
|
4633
|
+
var factSourceId = z53.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.`);
|
|
4634
|
+
var observedAt = z53.string().refine((value) => normalizedSourceInstant(value) !== null, "observed_at_invalid").transform((value) => normalizedSourceInstant(value) ?? value).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.`);
|
|
4635
|
+
var factSource = z53.strictObject({
|
|
4636
|
+
class: id7,
|
|
4438
4637
|
id: factSourceId,
|
|
4439
|
-
revision:
|
|
4440
|
-
locator:
|
|
4638
|
+
revision: id7.optional(),
|
|
4639
|
+
locator: z53.string().min(1).max(4096).optional(),
|
|
4441
4640
|
observedAt,
|
|
4442
|
-
sensitivity:
|
|
4641
|
+
sensitivity: id7.optional()
|
|
4443
4642
|
});
|
|
4444
|
-
var excerptText =
|
|
4445
|
-
var about =
|
|
4446
|
-
var HostedExcerptSchema =
|
|
4447
|
-
var HostedValueFactSchema =
|
|
4448
|
-
value:
|
|
4643
|
+
var excerptText = z53.string().min(1).refine((text8) => text8.length <= hostedFactsLimits.maxExcerptCharacters, "text_too_long");
|
|
4644
|
+
var about = z53.string().min(1).max(200).optional();
|
|
4645
|
+
var HostedExcerptSchema = z53.strictObject({ text: excerptText, source: factSource, about });
|
|
4646
|
+
var HostedValueFactSchema = z53.strictObject({
|
|
4647
|
+
value: z53.union([z53.string().min(1).max(200), z53.number(), z53.boolean()]),
|
|
4449
4648
|
source: factSource.extend({ excerpt: excerptText.optional() }),
|
|
4450
4649
|
about
|
|
4451
4650
|
});
|
|
4452
|
-
var HostedFactSchema =
|
|
4651
|
+
var HostedFactSchema = z53.union([
|
|
4453
4652
|
HostedValueFactSchema,
|
|
4454
4653
|
HostedExcerptSchema,
|
|
4455
|
-
|
|
4654
|
+
z53.array(HostedExcerptSchema).min(1).refine((excerpts2) => excerpts2.length <= hostedFactsLimits.maxExcerptsPerQuestion, "too_many_excerpts")
|
|
4456
4655
|
]);
|
|
4457
4656
|
function factsBytes(facts) {
|
|
4458
4657
|
const encoder2 = new TextEncoder();
|
|
4459
4658
|
return encoder2.encode(JSON.stringify(facts)).length;
|
|
4460
4659
|
}
|
|
4461
|
-
var HostedFactsJobInputSchema =
|
|
4462
|
-
mode:
|
|
4463
|
-
executionId:
|
|
4660
|
+
var HostedFactsJobInputSchema = z53.strictObject({
|
|
4661
|
+
mode: z53.literal("facts"),
|
|
4662
|
+
executionId: id7,
|
|
4464
4663
|
expectedReleaseDigest: digest23,
|
|
4465
|
-
jobId:
|
|
4466
|
-
entityId:
|
|
4664
|
+
jobId: id7,
|
|
4665
|
+
entityId: id7,
|
|
4467
4666
|
related: HostedRelatedSubjectsSchema.optional(),
|
|
4468
|
-
identity:
|
|
4469
|
-
facts:
|
|
4667
|
+
identity: z53.record(z53.string().min(1).max(128), z53.string().min(1).max(200)).optional(),
|
|
4668
|
+
facts: z53.record(id7, HostedFactSchema).refine((facts) => Object.keys(facts).length <= hostedFactsLimits.maxQuestions, "too_many_questions").refine((facts) => factsBytes(facts) <= hostedFactsLimits.maxFactsBytes, "request_too_large")
|
|
4470
4669
|
});
|
|
4471
4670
|
var HostedFactsRequestSchema = HostedFactsJobInputSchema.extend({
|
|
4472
|
-
entityId:
|
|
4671
|
+
entityId: id7.optional()
|
|
4473
4672
|
});
|
|
4474
|
-
var HostedJobRequestSchema =
|
|
4673
|
+
var HostedJobRequestSchema = z53.union([
|
|
4475
4674
|
HostedJobInputSchema,
|
|
4476
4675
|
HostedSuppliedJobInputSchema,
|
|
4477
4676
|
HostedFactsJobInputSchema
|
|
4478
4677
|
]);
|
|
4479
|
-
var HostedClassificationResultSchema =
|
|
4480
|
-
key:
|
|
4481
|
-
observationId:
|
|
4678
|
+
var HostedClassificationResultSchema = z53.strictObject({
|
|
4679
|
+
key: id7,
|
|
4680
|
+
observationId: id7,
|
|
4482
4681
|
record: DraftNormalizedEvidenceSchema.shape.normalizations.element,
|
|
4483
|
-
reason:
|
|
4484
|
-
cached:
|
|
4682
|
+
reason: z53.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable(),
|
|
4683
|
+
cached: z53.boolean()
|
|
4485
4684
|
});
|
|
4486
4685
|
function retainsFactsExactly(record) {
|
|
4487
4686
|
const hasFacts = record.facts !== void 0 && record.judgments !== void 0 && record.judgmentsDigest !== void 0;
|
|
4488
4687
|
return record.schema === "felspar.hosted-supplied-execution/v3" === hasFacts;
|
|
4489
4688
|
}
|
|
4490
|
-
var HostedSuppliedExecutionRecordSchema =
|
|
4491
|
-
schema:
|
|
4689
|
+
var HostedSuppliedExecutionRecordSchema = z53.strictObject({
|
|
4690
|
+
schema: z53.enum([
|
|
4492
4691
|
"felspar.hosted-supplied-execution/v1",
|
|
4493
4692
|
"felspar.hosted-supplied-execution/v2",
|
|
4494
4693
|
"felspar.hosted-supplied-execution/v3"
|
|
4495
4694
|
]),
|
|
4496
|
-
release:
|
|
4497
|
-
evaluationTime:
|
|
4695
|
+
release: z53.strictObject({ releaseId: id7, releaseDigest: digest23, materialDigest: digest23 }),
|
|
4696
|
+
evaluationTime: z53.iso.datetime(),
|
|
4498
4697
|
input: HostedSuppliedJobInputSchema,
|
|
4499
4698
|
facts: HostedFactsJobInputSchema.optional(),
|
|
4500
|
-
judgments:
|
|
4699
|
+
judgments: z53.array(HostedClassificationResultSchema).max(192).optional(),
|
|
4501
4700
|
judgmentsDigest: digest23.optional(),
|
|
4502
|
-
expansion:
|
|
4503
|
-
job:
|
|
4701
|
+
expansion: z53.literal("agreeing-excerpts").optional(),
|
|
4702
|
+
job: z53.record(z53.string(), z53.unknown())
|
|
4504
4703
|
}).refine(retainsFactsExactly, "Version 3 records, and only they, retain facts with their judgments");
|
|
4505
|
-
var HostedObjectSchema =
|
|
4506
|
-
id:
|
|
4507
|
-
kind:
|
|
4704
|
+
var HostedObjectSchema = z53.strictObject({
|
|
4705
|
+
id: id7,
|
|
4706
|
+
kind: z53.enum(["source", "proposal", "approval", "release", "evidence", "result", "execution"]),
|
|
4508
4707
|
payloadDigest: digest23,
|
|
4509
|
-
objectKey:
|
|
4510
|
-
parentId:
|
|
4511
|
-
status:
|
|
4512
|
-
metadata:
|
|
4513
|
-
});
|
|
4514
|
-
var HostedJobResultSchema =
|
|
4515
|
-
status:
|
|
4516
|
-
reason:
|
|
4517
|
-
result:
|
|
4518
|
-
executionId:
|
|
4519
|
-
releaseId:
|
|
4708
|
+
objectKey: z53.string().min(1).max(1e3),
|
|
4709
|
+
parentId: id7.nullable(),
|
|
4710
|
+
status: z53.enum(["active", "released", "revoked"]),
|
|
4711
|
+
metadata: z53.record(z53.string(), z53.unknown())
|
|
4712
|
+
});
|
|
4713
|
+
var HostedJobResultSchema = z53.object({
|
|
4714
|
+
status: z53.string(),
|
|
4715
|
+
reason: z53.string().nullable(),
|
|
4716
|
+
result: z53.object({
|
|
4717
|
+
executionId: z53.string(),
|
|
4718
|
+
releaseId: id7,
|
|
4520
4719
|
releaseDigest: digest23,
|
|
4521
|
-
outcome:
|
|
4522
|
-
scoring:
|
|
4523
|
-
context:
|
|
4524
|
-
receipt:
|
|
4720
|
+
outcome: z53.string().nullable(),
|
|
4721
|
+
scoring: z53.unknown(),
|
|
4722
|
+
context: z53.unknown(),
|
|
4723
|
+
receipt: z53.unknown()
|
|
4525
4724
|
}).loose().nullable()
|
|
4526
4725
|
});
|
|
4527
4726
|
|
|
@@ -4530,12 +4729,12 @@ var limits = hostedFactsLimits;
|
|
|
4530
4729
|
var formatFix = "The request does not match the facts request format at this path; follow input.example from get_job_requirements (input.jsonSchema in the REST brief).";
|
|
4531
4730
|
var fixes = {
|
|
4532
4731
|
observed_at_invalid: "Send observedAt as the date and time the source was read, with Z or an offset: for example 2026-10-21T10:00:00Z or 2026-10-21T12:00+02:00. A date alone, a time with no offset or words such as yesterday are not accepted.",
|
|
4533
|
-
source_id_invalid: `Send source.id as the source's own ID or address, such as
|
|
4732
|
+
source_id_invalid: `Send source.id as the source's own ID or address, such as a ticket number or a document URL with its query: at most ${draftSourceIdLimit} characters, starting with a letter or digit, using URL characters only (percent-encode spaces and non-ASCII characters).`,
|
|
4534
4733
|
unknown_question: "This question is not in the released job. Use the question keys from describe.",
|
|
4535
4734
|
source_class_not_accepted: "This question does not accept this source class. Send an excerpt from a source class the question's evidence policy in describe lists.",
|
|
4536
4735
|
value_not_in_excerpt: "The quoted words do not state this value. Quote the exact words that state it, or send the text without a typed value.",
|
|
4537
4736
|
duplicate_excerpt: "The same words from the same source were sent twice for this question. Send each excerpt once.",
|
|
4538
|
-
duplicate_source_locator: "Another excerpt in this request names the same source and locator with different words. Give each passage its own locator (for example the
|
|
4737
|
+
duplicate_source_locator: "Another excerpt in this request names the same source and locator with different words. Give each passage its own locator (for example the document URL with the section heading after #, or the message ID); the same words may answer several questions.",
|
|
4539
4738
|
label_needs_mapping: "Felspar decides answer choices and yes/no questions from source text. Send the words the source says, not a label.",
|
|
4540
4739
|
value_not_allowed: "A typed value must be a finite number for a number question or a YYYY-MM-DD date for a date question.",
|
|
4541
4740
|
answer_choice_needs_excerpt: "Send this question in a facts request with the source text; Felspar classifies answer choices itself.",
|
|
@@ -4545,6 +4744,7 @@ var fixes = {
|
|
|
4545
4744
|
request_too_large: `The facts in one request are at most ${limits.maxFactsBytes} bytes. Send shorter excerpts.`,
|
|
4546
4745
|
release_changed: "The release changed. Describe the job again and resend with the current release digest.",
|
|
4547
4746
|
job_mismatch: "This release serves a different job. Use the job and release from describe.",
|
|
4747
|
+
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.",
|
|
4548
4748
|
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.",
|
|
4549
4749
|
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.",
|
|
4550
4750
|
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.",
|
|
@@ -4566,14 +4766,45 @@ var fixes = {
|
|
|
4566
4766
|
invalid_body: "The body must be JSON or content parts within the size limit.",
|
|
4567
4767
|
context_graph_invalid: "Felspar would block every decision of this pack because of the context issues listed. Build the pack again from its draft with check_pack until it is clean, then propose it again; a pack with these issues can't be proposed, approved or released.",
|
|
4568
4768
|
forbidden: "This caller may not run this job on this release, or the release is not available. Check the release ID and the caller's access.",
|
|
4769
|
+
access_denied: "This caller may not do this, or what it names is not available to it. Use a job list_jobs shows; if it should be there, ask a workspace owner to add the job to this agent on the Felspar web page.",
|
|
4770
|
+
unauthenticated: "No credential was sent. Send the agent key as a Bearer token, or sign in.",
|
|
4771
|
+
invalid_arguments: "The tool's arguments don't match its input schema. Correct the field at each issue's path and call the tool again.",
|
|
4772
|
+
not_found: "No Felspar route matches this path and method. Check the URL against the REST reference.",
|
|
4773
|
+
check_not_found: "No output check by this caller with this ID on this job. Send the checkId from your own check_output result.",
|
|
4774
|
+
history_not_found: "No case history matches. Check the case ID.",
|
|
4775
|
+
history_unavailable: "Case history could not be read or changed just now. Try again later.",
|
|
4776
|
+
no_current_release: "The job has no current release to compare with. Release a first version, then backtest later changes.",
|
|
4777
|
+
source_access_required: "Your own connection can't read a document behind this object. Connect or reconnect it on the Felspar Sources page, or ask the document's owner to share it.",
|
|
4778
|
+
operation_unavailable: "Felspar could not complete this request. Try again later with the same request; if it keeps failing, tell a person.",
|
|
4569
4779
|
source_read_failed: "Felspar couldn't read the document's current version with your own connection. If access is not_connected or reconnect, connect or reconnect Google Drive on the Felspar Sources page; if no_access, ask the document's owner to share it with you; otherwise try again later.",
|
|
4570
4780
|
source_text_not_allowed: "An MCP client can't submit text as a source. To use a document's newest text, call add_current_version with its sourceObjectId from list_sources.",
|
|
4571
4781
|
source_not_connected: "This source was not added from a connected document. Use a sourceObjectId from list_sources.",
|
|
4782
|
+
pack_not_found: "No released version or proposal of this job matches. Call list_jobs for the workspace's jobs, their current release and open proposals; for a job not yet released, pass a proposalId it lists.",
|
|
4783
|
+
proposal_out_of_date: "A newer version of this job was released after this proposal was made, so it can't be approved or released. Update it: read_pack for the live pack, apply the change again, preview_change, then propose_pack, which replaces your earlier proposal.",
|
|
4784
|
+
proposal_closed: "This proposal was released, rejected, withdrawn or replaced by a newer proposal, so nothing more can be done with it. Call list_jobs for the job's open proposals.",
|
|
4785
|
+
not_proposer: "Only the person who made a proposal may withdraw it; an approver may reject it.",
|
|
4786
|
+
not_job_approver: "Only this job's owner and named approvers, or a workspace owner, may approve, release or reject its proposals. details.owners names who may; ask one of them to review it on the Felspar web page.",
|
|
4787
|
+
withdraw_on_web_page: "Withdraw a proposal on the Felspar web page, or propose the job again, which replaces your earlier proposal.",
|
|
4788
|
+
change_request_needs_release: "This job has no release yet, so there is no document version to propose changes on. Draft its first pack with check_pack and propose_pack.",
|
|
4789
|
+
change_request_quote_invalid: "Each change must quote a passage exactly as it is in the release's version of the document (read_source on the source list_jobs names), found exactly once, with changes that don't overlap and a replacement that differs. details.problems names each change by its index: quote_not_found, quote_not_unique (quote more of the passage), edits_overlap or edit_unchanged.",
|
|
4790
|
+
change_request_definition_reason_required: "Give a reason for each definition the revised pack adds or changes: add { id, reason } under definitions for every id details.definitions lists.",
|
|
4791
|
+
change_request_definition_unknown: "A definition under definitions is not one the revised pack adds or changes. Use the question key or question/answer IDs from the revised pack's diff, or drop it.",
|
|
4792
|
+
change_request_too_large: "This change request is too large to store. Split it into smaller change requests.",
|
|
4793
|
+
change_request_not_found: "No change request with this ID. Call list_change_requests for the job's change requests.",
|
|
4794
|
+
change_request_edit_not_found: "The change request has no change at this index. Use an index from its changes, or leave edit out to comment on the whole request.",
|
|
4795
|
+
change_request_comment_limit: "This change request has as many comments as it can hold. Continue the discussion on the Felspar web page.",
|
|
4796
|
+
change_request_closed: "This change request is already closed.",
|
|
4797
|
+
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.",
|
|
4798
|
+
proposal_draft_invalid: "A proposal's draft must be a valid felspar.pack-draft for the proposal's own job. Propose with propose_pack, which keeps the draft it checked.",
|
|
4799
|
+
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.",
|
|
4800
|
+
preview_reinterpret_blocked: "Fix the draft's blocking findings (check_pack lists them) before previewing with reinterpret: true. A preview without reinterpret still runs.",
|
|
4801
|
+
pack_job_mismatch: "That release or proposal belongs to another job. Pass the jobId list_jobs shows with it.",
|
|
4572
4802
|
decision_not_found: "Check the output against a decision this caller made: send the executionId from your get_job_decision result for this job.",
|
|
4573
4803
|
decision_not_decided: "This decision has no outcome, so nothing is written for it. Follow its next step instead.",
|
|
4574
4804
|
no_output_checks: "This job's release declares no output checks. Use the decision's next step; nothing is checked before sending.",
|
|
4575
4805
|
output_not_required: "The decided outcome does not require this output. Send one of the outputs listed in required, or none when it is empty.",
|
|
4576
4806
|
output_too_large: "The text is longer than this output allows. Shorten it and check again.",
|
|
4807
|
+
invalid_input: "The request does not match the format. Correct each issue at its path: follow input.example from get_job_requirements (input.jsonSchema in the REST brief).",
|
|
4577
4808
|
invalid_type: formatFix,
|
|
4578
4809
|
invalid_union: formatFix,
|
|
4579
4810
|
invalid_value: formatFix,
|
|
@@ -4582,231 +4813,252 @@ var fixes = {
|
|
|
4582
4813
|
too_big: formatFix,
|
|
4583
4814
|
too_small: formatFix
|
|
4584
4815
|
};
|
|
4816
|
+
var hostedRefusalCodes = Object.freeze(Object.keys(fixes));
|
|
4585
4817
|
function hostedRefusalFix(code) {
|
|
4586
4818
|
return Object.hasOwn(fixes, code) ? fixes[code] ?? null : null;
|
|
4587
4819
|
}
|
|
4820
|
+
var retried = /* @__PURE__ */ new Set(["rate_limited", "history_unavailable", "operation_unavailable"]);
|
|
4821
|
+
var escalated = /* @__PURE__ */ new Set([
|
|
4822
|
+
"unauthenticated",
|
|
4823
|
+
"forbidden",
|
|
4824
|
+
"access_denied",
|
|
4825
|
+
"job_retired",
|
|
4826
|
+
"attempt_limit_reached",
|
|
4827
|
+
"source_access_required",
|
|
4828
|
+
"source_read_failed",
|
|
4829
|
+
"no_current_release"
|
|
4830
|
+
]);
|
|
4831
|
+
function hostedRefusalRecovery(code) {
|
|
4832
|
+
if (!Object.hasOwn(fixes, code)) {
|
|
4833
|
+
return null;
|
|
4834
|
+
}
|
|
4835
|
+
if (retried.has(code)) {
|
|
4836
|
+
return "retry";
|
|
4837
|
+
}
|
|
4838
|
+
return escalated.has(code) ? "escalate" : "fix_input";
|
|
4839
|
+
}
|
|
4588
4840
|
|
|
4589
4841
|
// ../schemas/src/draft-hosted-job-description.ts
|
|
4590
|
-
import { z as
|
|
4842
|
+
import { z as z55 } from "zod";
|
|
4591
4843
|
|
|
4592
4844
|
// ../schemas/src/draft-hosted-output-guides.ts
|
|
4593
|
-
import { z as
|
|
4594
|
-
var
|
|
4595
|
-
var located =
|
|
4596
|
-
text:
|
|
4597
|
-
locator:
|
|
4845
|
+
import { z as z54 } from "zod";
|
|
4846
|
+
var id8 = z54.string().min(1).max(200);
|
|
4847
|
+
var located = z54.strictObject({
|
|
4848
|
+
text: z54.string().min(1).max(262144),
|
|
4849
|
+
locator: z54.string().min(1).max(4096)
|
|
4598
4850
|
});
|
|
4599
4851
|
var hostedOutputGuideLimits = { maxOutputs: 8, maxContext: 8, maxChecks: 64 };
|
|
4600
|
-
var HostedOutputGuideSchema =
|
|
4601
|
-
id:
|
|
4852
|
+
var HostedOutputGuideSchema = z54.strictObject({
|
|
4853
|
+
id: id8,
|
|
4602
4854
|
what: located,
|
|
4603
|
-
maxCharacters:
|
|
4604
|
-
context:
|
|
4605
|
-
checks:
|
|
4606
|
-
check:
|
|
4607
|
-
rule:
|
|
4608
|
-
must:
|
|
4855
|
+
maxCharacters: z54.number().int().min(1),
|
|
4856
|
+
context: z54.array(located.extend({ id: id8 })).max(hostedOutputGuideLimits.maxContext).optional(),
|
|
4857
|
+
checks: z54.array(z54.strictObject({
|
|
4858
|
+
check: id8,
|
|
4859
|
+
rule: z54.string().nullable(),
|
|
4860
|
+
must: z54.string().min(1).max(8e3)
|
|
4609
4861
|
})).max(hostedOutputGuideLimits.maxChecks)
|
|
4610
4862
|
});
|
|
4611
|
-
var HostedOutputGuidesSchema =
|
|
4863
|
+
var HostedOutputGuidesSchema = z54.array(HostedOutputGuideSchema).max(hostedOutputGuideLimits.maxOutputs);
|
|
4612
4864
|
|
|
4613
4865
|
// ../schemas/src/draft-hosted-job-description.ts
|
|
4614
|
-
var
|
|
4866
|
+
var id9 = z55.string().min(1).max(200);
|
|
4615
4867
|
var digest24 = DraftApplicationReleaseSchema.shape.releaseDigest;
|
|
4616
4868
|
var { requirements, rules } = DraftRequiredProposalSchema.shape;
|
|
4617
|
-
var quotedText =
|
|
4618
|
-
text:
|
|
4869
|
+
var quotedText = z55.strictObject({
|
|
4870
|
+
text: z55.string().min(1).max(262144),
|
|
4619
4871
|
source: DraftSourceReferenceSchema.omit({ contentDigest: true }).extend({
|
|
4620
|
-
locator:
|
|
4872
|
+
locator: z55.string().min(1).max(4096),
|
|
4621
4873
|
contentDigest: digest24
|
|
4622
4874
|
}),
|
|
4623
|
-
parts:
|
|
4875
|
+
parts: z55.array(z55.strictObject({ locator: z55.string().min(1).max(4096), text: z55.string() })).max(16)
|
|
4624
4876
|
});
|
|
4625
4877
|
var subjectShape = {
|
|
4626
|
-
identifier:
|
|
4627
|
-
example:
|
|
4628
|
-
match:
|
|
4878
|
+
identifier: z55.string().min(1).max(200),
|
|
4879
|
+
example: z55.string().min(1).max(200),
|
|
4880
|
+
match: z55.enum(subjectMatchRules)
|
|
4629
4881
|
};
|
|
4630
|
-
var HostedJobSubjectSchema =
|
|
4631
|
-
type:
|
|
4882
|
+
var HostedJobSubjectSchema = z55.strictObject({
|
|
4883
|
+
type: id9,
|
|
4632
4884
|
definition: quotedText,
|
|
4633
4885
|
identifier: subjectShape.identifier.optional(),
|
|
4634
4886
|
example: subjectShape.example.optional(),
|
|
4635
4887
|
match: subjectShape.match,
|
|
4636
|
-
related:
|
|
4637
|
-
relationship:
|
|
4888
|
+
related: z55.array(z55.strictObject({
|
|
4889
|
+
relationship: id9,
|
|
4638
4890
|
meaning: quotedText,
|
|
4639
|
-
cardinality:
|
|
4640
|
-
required:
|
|
4641
|
-
subject:
|
|
4891
|
+
cardinality: z55.enum(relationshipCardinalities),
|
|
4892
|
+
required: z55.boolean(),
|
|
4893
|
+
subject: id9,
|
|
4642
4894
|
definition: quotedText,
|
|
4643
4895
|
...subjectShape
|
|
4644
4896
|
})).max(16),
|
|
4645
|
-
send:
|
|
4897
|
+
send: z55.string().min(1).max(2e4)
|
|
4646
4898
|
});
|
|
4647
|
-
var HostedJobEscalationsSchema =
|
|
4648
|
-
routes:
|
|
4649
|
-
unresolved:
|
|
4650
|
-
attemptLimit:
|
|
4651
|
-
rule:
|
|
4899
|
+
var HostedJobEscalationsSchema = z55.strictObject({
|
|
4900
|
+
routes: z55.array(z55.strictObject({ id: id9, quote: quotedText })).min(1).max(16),
|
|
4901
|
+
unresolved: id9.nullable(),
|
|
4902
|
+
attemptLimit: id9.nullable(),
|
|
4903
|
+
rule: z55.string().min(1).max(1e3)
|
|
4652
4904
|
});
|
|
4653
|
-
var HostedEscalationSchema =
|
|
4654
|
-
id:
|
|
4655
|
-
trigger:
|
|
4905
|
+
var HostedEscalationSchema = z55.strictObject({
|
|
4906
|
+
id: id9,
|
|
4907
|
+
trigger: z55.enum(escalationTriggers),
|
|
4656
4908
|
why: quotedText
|
|
4657
4909
|
});
|
|
4658
|
-
var HostedJobDescriptionSchema =
|
|
4659
|
-
schema:
|
|
4660
|
-
job:
|
|
4910
|
+
var HostedJobDescriptionSchema = z55.strictObject({
|
|
4911
|
+
schema: z55.literal("felspar.hosted-job-description.draft/v0"),
|
|
4912
|
+
job: id9,
|
|
4661
4913
|
purpose: quotedText.optional(),
|
|
4662
|
-
useWhen:
|
|
4663
|
-
notFor:
|
|
4914
|
+
useWhen: z55.array(quotedText).max(8).optional(),
|
|
4915
|
+
notFor: z55.array(quotedText).max(8).optional(),
|
|
4664
4916
|
owner: quotedText.optional(),
|
|
4665
4917
|
subject: HostedJobSubjectSchema.optional(),
|
|
4666
|
-
identity:
|
|
4667
|
-
mode:
|
|
4668
|
-
send:
|
|
4669
|
-
fields:
|
|
4670
|
-
question:
|
|
4918
|
+
identity: z55.strictObject({
|
|
4919
|
+
mode: z55.enum(identityModes),
|
|
4920
|
+
send: z55.string().min(1).max(4e3),
|
|
4921
|
+
fields: z55.array(z55.strictObject({ name: id9, ...subjectShape })).max(8).optional(),
|
|
4922
|
+
question: id9.optional()
|
|
4671
4923
|
}).optional(),
|
|
4672
|
-
trustDomain:
|
|
4673
|
-
release:
|
|
4674
|
-
releaseId:
|
|
4924
|
+
trustDomain: id9,
|
|
4925
|
+
release: z55.strictObject({
|
|
4926
|
+
releaseId: id9,
|
|
4675
4927
|
releaseDigest: digest24,
|
|
4676
4928
|
materialDigest: digest24,
|
|
4677
4929
|
expectedAuthorityDigest: digest24
|
|
4678
4930
|
}),
|
|
4679
4931
|
resolutionPolicy: DraftRequiredProposalSchema.shape.resolutionPolicy,
|
|
4680
|
-
questions:
|
|
4681
|
-
key:
|
|
4682
|
-
type:
|
|
4932
|
+
questions: z55.array(requirements.element.extend({
|
|
4933
|
+
key: id9,
|
|
4934
|
+
type: z55.enum(["enum", "boolean", "number", "date"]),
|
|
4683
4935
|
meaning: quotedText,
|
|
4684
|
-
answer:
|
|
4685
|
-
send:
|
|
4686
|
-
valueFormat:
|
|
4687
|
-
interpretation:
|
|
4688
|
-
threshold:
|
|
4689
|
-
applies:
|
|
4690
|
-
dependsOn:
|
|
4691
|
-
appliesWhen:
|
|
4936
|
+
answer: z55.strictObject({
|
|
4937
|
+
send: z55.enum(["text", "text_or_value"]),
|
|
4938
|
+
valueFormat: z55.enum(["number", "calendar-date"]).nullable(),
|
|
4939
|
+
interpretation: z55.enum(["classified", "exact_read", "unsupported"]),
|
|
4940
|
+
threshold: z55.number().gt(0).max(1).nullable(),
|
|
4941
|
+
applies: z55.enum(["always", "conditional"]),
|
|
4942
|
+
dependsOn: z55.array(id9).max(32),
|
|
4943
|
+
appliesWhen: z55.string().min(1).max(2e3).nullable(),
|
|
4692
4944
|
reading: ExactReaderSchema.optional()
|
|
4693
4945
|
}),
|
|
4694
|
-
answers:
|
|
4695
|
-
value:
|
|
4696
|
-
meaning:
|
|
4697
|
-
inclusions:
|
|
4698
|
-
exclusions:
|
|
4699
|
-
examples:
|
|
4700
|
-
edgeCases:
|
|
4946
|
+
answers: z55.array(z55.strictObject({
|
|
4947
|
+
value: id9,
|
|
4948
|
+
meaning: z55.string().nullable(),
|
|
4949
|
+
inclusions: z55.array(z55.string()).max(8),
|
|
4950
|
+
exclusions: z55.array(z55.string()).max(8),
|
|
4951
|
+
examples: z55.array(z55.string()).max(8),
|
|
4952
|
+
edgeCases: z55.array(z55.string()).max(8)
|
|
4701
4953
|
})).max(64).optional(),
|
|
4702
|
-
whereToLook:
|
|
4703
|
-
about:
|
|
4954
|
+
whereToLook: z55.array(quotedText).max(8).optional(),
|
|
4955
|
+
about: z55.strictObject({ relationship: id9, subject: id9 }).optional()
|
|
4704
4956
|
})).max(64),
|
|
4705
|
-
rules:
|
|
4706
|
-
outcomes:
|
|
4707
|
-
id:
|
|
4957
|
+
rules: z55.array(rules.element.extend({ text: quotedText })).max(256),
|
|
4958
|
+
outcomes: z55.array(z55.strictObject({
|
|
4959
|
+
id: id9,
|
|
4708
4960
|
meaning: quotedText.nullable(),
|
|
4709
4961
|
nextStep: quotedText.nullable().optional(),
|
|
4710
4962
|
outputs: HostedOutputGuidesSchema.optional(),
|
|
4711
|
-
escalate:
|
|
4963
|
+
escalate: id9.optional()
|
|
4712
4964
|
})).max(64),
|
|
4713
4965
|
escalations: HostedJobEscalationsSchema.optional(),
|
|
4714
4966
|
whenUnresolved: quotedText.nullable().optional(),
|
|
4715
|
-
attempts:
|
|
4716
|
-
max:
|
|
4717
|
-
withProgress:
|
|
4718
|
-
rule:
|
|
4967
|
+
attempts: z55.strictObject({
|
|
4968
|
+
max: z55.number().int().min(1).max(10),
|
|
4969
|
+
withProgress: z55.number().int().min(1).max(10),
|
|
4970
|
+
rule: z55.string().min(1).max(1e3)
|
|
4719
4971
|
}).optional(),
|
|
4720
|
-
guidance:
|
|
4721
|
-
input:
|
|
4722
|
-
jsonSchema:
|
|
4972
|
+
guidance: z55.strictObject({ gather: z55.string().min(1).max(2e3) }),
|
|
4973
|
+
input: z55.strictObject({
|
|
4974
|
+
jsonSchema: z55.record(z55.string(), z55.unknown()),
|
|
4723
4975
|
example: HostedFactsJobInputSchema.nullable(),
|
|
4724
|
-
exampleNote:
|
|
4976
|
+
exampleNote: z55.string().max(1e3)
|
|
4725
4977
|
}),
|
|
4726
|
-
limits:
|
|
4727
|
-
maxEvidenceItems:
|
|
4728
|
-
maxPassages:
|
|
4729
|
-
facts:
|
|
4730
|
-
maxExcerptCharacters:
|
|
4731
|
-
maxExcerptsPerQuestion:
|
|
4732
|
-
maxFactsBytes:
|
|
4733
|
-
maxQuestions:
|
|
4978
|
+
limits: z55.strictObject({
|
|
4979
|
+
maxEvidenceItems: z55.number().int().positive(),
|
|
4980
|
+
maxPassages: z55.number().int().positive(),
|
|
4981
|
+
facts: z55.strictObject({
|
|
4982
|
+
maxExcerptCharacters: z55.literal(hostedFactsLimits.maxExcerptCharacters),
|
|
4983
|
+
maxExcerptsPerQuestion: z55.literal(hostedFactsLimits.maxExcerptsPerQuestion),
|
|
4984
|
+
maxFactsBytes: z55.literal(hostedFactsLimits.maxFactsBytes),
|
|
4985
|
+
maxQuestions: z55.literal(hostedFactsLimits.maxQuestions)
|
|
4734
4986
|
})
|
|
4735
4987
|
})
|
|
4736
4988
|
});
|
|
4737
|
-
var interpretedExcerpt =
|
|
4738
|
-
id:
|
|
4739
|
-
method:
|
|
4740
|
-
status:
|
|
4741
|
-
value:
|
|
4742
|
-
reasons:
|
|
4743
|
-
classification:
|
|
4744
|
-
candidate:
|
|
4745
|
-
probability:
|
|
4746
|
-
abstention:
|
|
4747
|
-
threshold:
|
|
4748
|
-
alternatives:
|
|
4989
|
+
var interpretedExcerpt = z55.strictObject({
|
|
4990
|
+
id: id9,
|
|
4991
|
+
method: z55.enum(["value", "exact_read", "classified"]),
|
|
4992
|
+
status: z55.enum(["accepted", "needs_evidence", "not_needed"]),
|
|
4993
|
+
value: z55.union([z55.string(), z55.number(), z55.boolean()]).optional(),
|
|
4994
|
+
reasons: z55.array(z55.string()),
|
|
4995
|
+
classification: z55.strictObject({
|
|
4996
|
+
candidate: z55.string().nullable(),
|
|
4997
|
+
probability: z55.number().min(0).max(1).nullable(),
|
|
4998
|
+
abstention: z55.number().min(0).max(1).nullable(),
|
|
4999
|
+
threshold: z55.number().min(0).max(1),
|
|
5000
|
+
alternatives: z55.array(z55.strictObject({ value: z55.string(), probability: z55.number() }))
|
|
4749
5001
|
}).optional()
|
|
4750
5002
|
});
|
|
4751
|
-
var ruleSummary =
|
|
4752
|
-
var HostedJobExplanationSchema =
|
|
4753
|
-
schema:
|
|
4754
|
-
decision:
|
|
4755
|
-
needs:
|
|
4756
|
-
key:
|
|
4757
|
-
status:
|
|
4758
|
-
reasons:
|
|
4759
|
-
acceptedSourceClasses:
|
|
4760
|
-
maxAgeMs:
|
|
5003
|
+
var ruleSummary = z55.strictObject({ id: id9, outcome: id9, text: quotedText });
|
|
5004
|
+
var HostedJobExplanationSchema = z55.strictObject({
|
|
5005
|
+
schema: z55.literal("felspar.hosted-job-explanation.draft/v0"),
|
|
5006
|
+
decision: z55.strictObject({ status: z55.string().nullable(), reasons: z55.array(z55.string()) }),
|
|
5007
|
+
needs: z55.array(z55.strictObject({
|
|
5008
|
+
key: id9,
|
|
5009
|
+
status: z55.string(),
|
|
5010
|
+
reasons: z55.array(z55.string()),
|
|
5011
|
+
acceptedSourceClasses: z55.array(z55.string()),
|
|
5012
|
+
maxAgeMs: z55.number().int().nonnegative(),
|
|
4761
5013
|
requiredWhen: HostedJobDescriptionSchema.shape.questions.element.shape.requiredWhen,
|
|
4762
|
-
excerpts:
|
|
5014
|
+
excerpts: z55.array(interpretedExcerpt).optional()
|
|
4763
5015
|
})),
|
|
4764
|
-
why:
|
|
4765
|
-
rules:
|
|
4766
|
-
overrides:
|
|
4767
|
-
suppressedRuleIds:
|
|
4768
|
-
evidence:
|
|
5016
|
+
why: z55.strictObject({
|
|
5017
|
+
rules: z55.array(ruleSummary),
|
|
5018
|
+
overrides: z55.array(z55.strictObject({ by: id9, target: id9 })),
|
|
5019
|
+
suppressedRuleIds: z55.array(id9),
|
|
5020
|
+
evidence: z55.array(z55.record(z55.string(), z55.unknown()))
|
|
4769
5021
|
}).nullable(),
|
|
4770
|
-
context:
|
|
4771
|
-
reviewNeeds:
|
|
4772
|
-
evidenceFreshUntil:
|
|
5022
|
+
context: z55.strictObject({ status: z55.string(), reason: z55.string().nullable() }).nullable(),
|
|
5023
|
+
reviewNeeds: z55.array(z55.string()),
|
|
5024
|
+
evidenceFreshUntil: z55.iso.datetime().nullable()
|
|
4773
5025
|
});
|
|
4774
|
-
var HostedReceiptVerificationInputSchema =
|
|
5026
|
+
var HostedReceiptVerificationInputSchema = z55.strictObject({
|
|
4775
5027
|
receipt: DraftJobReceiptSchema,
|
|
4776
5028
|
expectedReceiptDigest: digest24,
|
|
4777
5029
|
deliveredCapsule: DraftContextVerificationOptionsSchema.shape.deliveredCapsule
|
|
4778
5030
|
});
|
|
4779
|
-
var HostedReceiptVerificationSchema =
|
|
4780
|
-
authority:
|
|
4781
|
-
status:
|
|
4782
|
-
mismatches:
|
|
4783
|
-
decided:
|
|
4784
|
-
jobId:
|
|
4785
|
-
entityId:
|
|
4786
|
-
releaseId:
|
|
4787
|
-
outcome:
|
|
4788
|
-
case:
|
|
4789
|
-
subject:
|
|
4790
|
-
type:
|
|
4791
|
-
related:
|
|
5031
|
+
var HostedReceiptVerificationSchema = z55.strictObject({
|
|
5032
|
+
authority: z55.literal("unapproved"),
|
|
5033
|
+
status: z55.enum(["reproduced", "mismatch"]),
|
|
5034
|
+
mismatches: z55.array(z55.string()),
|
|
5035
|
+
decided: z55.strictObject({
|
|
5036
|
+
jobId: id9,
|
|
5037
|
+
entityId: id9,
|
|
5038
|
+
releaseId: id9,
|
|
5039
|
+
outcome: id9.nullable(),
|
|
5040
|
+
case: z55.strictObject({ id: id9, mode: z55.enum(identityModes) }).optional(),
|
|
5041
|
+
subject: z55.strictObject({
|
|
5042
|
+
type: id9,
|
|
5043
|
+
related: z55.array(z55.strictObject({ relationship: id9, subject: id9, id: id9, questions: z55.array(id9).max(64) })).max(256)
|
|
4792
5044
|
}).optional(),
|
|
4793
5045
|
escalation: HostedEscalationSchema.omit({ why: true }).optional()
|
|
4794
5046
|
}).optional()
|
|
4795
5047
|
});
|
|
4796
5048
|
|
|
4797
5049
|
// ../schemas/src/draft-hosted-output-check-record.ts
|
|
4798
|
-
import { z as
|
|
5050
|
+
import { z as z58 } from "zod";
|
|
4799
5051
|
|
|
4800
5052
|
// ../schemas/src/draft-artifact-lint.ts
|
|
4801
|
-
import { z as
|
|
5053
|
+
import { z as z57 } from "zod";
|
|
4802
5054
|
|
|
4803
5055
|
// ../schemas/src/draft-job-obligations.ts
|
|
4804
|
-
import { z as
|
|
4805
|
-
var
|
|
5056
|
+
import { z as z56 } from "zod";
|
|
5057
|
+
var id10 = DraftApplicationScopeSchema.shape.authorityId;
|
|
4806
5058
|
var digest25 = DraftJobReceiptSchema.shape.receiptDigest;
|
|
4807
5059
|
var outcome2 = DraftJobObligationsOutcomeSchema;
|
|
4808
5060
|
var DraftApplicationJobMaterialV3Schema = DraftApplicationJobMaterialV2Schema.extend({
|
|
4809
|
-
schema:
|
|
5061
|
+
schema: z56.literal("felspar.application-job-material.draft/v3"),
|
|
4810
5062
|
obligations: DraftJobObligationsSchema
|
|
4811
5063
|
}).superRefine((value, context3) => {
|
|
4812
5064
|
if (context3.issues.length > 0) {
|
|
@@ -4834,57 +5086,57 @@ var DraftApplicationJobMaterialV3Schema = DraftApplicationJobMaterialV2Schema.ex
|
|
|
4834
5086
|
}
|
|
4835
5087
|
});
|
|
4836
5088
|
var HostedProposalInputV3Schema = HostedProposalInputV2Schema.extend({
|
|
4837
|
-
schema:
|
|
5089
|
+
schema: z56.literal("felspar.hosted-proposal.draft/v3"),
|
|
4838
5090
|
material: DraftApplicationJobMaterialV3Schema
|
|
4839
5091
|
});
|
|
4840
5092
|
var jobObligationsReplayRoutes = ["supplied", "evaluated"];
|
|
4841
5093
|
var replayRoutes = new Set(jobObligationsReplayRoutes);
|
|
4842
5094
|
var DraftJobObligationsExecutionSchema = DraftAnyJobExecutionSchema.refine((execution) => replayRoutes.has(execution.invocation.route), "Obligations assessments support supplied and evaluated native executions");
|
|
4843
|
-
var DraftJobObligationsNativeResultSchema =
|
|
4844
|
-
authority:
|
|
4845
|
-
discovery:
|
|
4846
|
-
executed:
|
|
5095
|
+
var DraftJobObligationsNativeResultSchema = z56.strictObject({
|
|
5096
|
+
authority: z56.literal("unapproved"),
|
|
5097
|
+
discovery: z56.record(z56.string(), z56.unknown()),
|
|
5098
|
+
executed: z56.record(z56.string(), z56.unknown()),
|
|
4847
5099
|
receipt: DraftJobReceiptSchema
|
|
4848
5100
|
});
|
|
4849
|
-
var DraftJobObligationsInputSchema =
|
|
5101
|
+
var DraftJobObligationsInputSchema = z56.strictObject({
|
|
4850
5102
|
release: DraftApplicationReleaseSchema,
|
|
4851
|
-
material:
|
|
5103
|
+
material: z56.union([DraftApplicationJobMaterialV3Schema, DraftAnyApplicationJobMaterialSchema]),
|
|
4852
5104
|
execution: DraftJobObligationsExecutionSchema,
|
|
4853
5105
|
expectedReceiptDigest: digest25,
|
|
4854
5106
|
job: DraftJobObligationsNativeResultSchema,
|
|
4855
5107
|
explanation: HostedJobExplanationSchema,
|
|
4856
|
-
invocation: DraftJobObligationsScopeSchema.extend({ caseId:
|
|
5108
|
+
invocation: DraftJobObligationsScopeSchema.extend({ caseId: id10 })
|
|
4857
5109
|
});
|
|
4858
|
-
var requirements2 =
|
|
4859
|
-
status:
|
|
5110
|
+
var requirements2 = z56.strictObject({
|
|
5111
|
+
status: z56.enum(["established", "unresolved"]),
|
|
4860
5112
|
scope: DraftJobObligationsScopeSchema,
|
|
4861
5113
|
artifacts: outcome2.shape.artifacts,
|
|
4862
5114
|
approvals: outcome2.shape.approvals,
|
|
4863
|
-
unresolved:
|
|
5115
|
+
unresolved: z56.array(z56.strictObject({ scopeRef: id10, reasonCodes: z56.array(id10).min(1).max(64) })).max(64)
|
|
4864
5116
|
});
|
|
4865
|
-
var nextReference =
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
5117
|
+
var nextReference = z56.discriminatedUnion("kind", [
|
|
5118
|
+
z56.strictObject({ kind: z56.literal("evidence_need"), id: id10 }),
|
|
5119
|
+
z56.strictObject({ kind: z56.literal("artifact_requirement"), id: id10 }),
|
|
5120
|
+
z56.strictObject({ kind: z56.literal("approval_requirement"), id: id10 }),
|
|
5121
|
+
z56.strictObject({ kind: z56.literal("unresolved_scope"), scopeRef: id10 })
|
|
4870
5122
|
]);
|
|
4871
|
-
var DraftJobObligationsAssessmentBodySchema =
|
|
4872
|
-
schema:
|
|
4873
|
-
binding:
|
|
5123
|
+
var DraftJobObligationsAssessmentBodySchema = z56.strictObject({
|
|
5124
|
+
schema: z56.literal("felspar.job-obligations-assessment.draft/v0"),
|
|
5125
|
+
binding: z56.strictObject({
|
|
4874
5126
|
releaseDigest: digest25,
|
|
4875
5127
|
materialDigest: digest25,
|
|
4876
5128
|
nativeReceiptDigest: digest25,
|
|
4877
|
-
jobId:
|
|
5129
|
+
jobId: id10,
|
|
4878
5130
|
applicationScope: DraftApplicationScopeSchema,
|
|
4879
|
-
caseId:
|
|
4880
|
-
entityId:
|
|
4881
|
-
evaluationTime:
|
|
4882
|
-
purposeRef:
|
|
4883
|
-
useRef:
|
|
5131
|
+
caseId: id10,
|
|
5132
|
+
entityId: id10,
|
|
5133
|
+
evaluationTime: z56.iso.datetime({ offset: true }),
|
|
5134
|
+
purposeRef: id10,
|
|
5135
|
+
useRef: id10.nullable()
|
|
4884
5136
|
}),
|
|
4885
5137
|
requirements: requirements2,
|
|
4886
|
-
next:
|
|
4887
|
-
kind:
|
|
5138
|
+
next: z56.strictObject({
|
|
5139
|
+
kind: z56.enum([
|
|
4888
5140
|
"stop",
|
|
4889
5141
|
"review_required",
|
|
4890
5142
|
"gather_evidence",
|
|
@@ -4892,8 +5144,8 @@ var DraftJobObligationsAssessmentBodySchema = z53.strictObject({
|
|
|
4892
5144
|
"verify_before_action",
|
|
4893
5145
|
"return_result"
|
|
4894
5146
|
]),
|
|
4895
|
-
reasonCodes:
|
|
4896
|
-
refs:
|
|
5147
|
+
reasonCodes: z56.array(id10).max(64),
|
|
5148
|
+
refs: z56.array(nextReference).max(64)
|
|
4897
5149
|
})
|
|
4898
5150
|
});
|
|
4899
5151
|
function isNextRefDeclared(ref, required) {
|
|
@@ -4930,48 +5182,48 @@ var DraftJobObligationsAssessmentSchema = DraftJobObligationsAssessmentBodySchem
|
|
|
4930
5182
|
});
|
|
4931
5183
|
|
|
4932
5184
|
// ../schemas/src/draft-artifact-lint.ts
|
|
4933
|
-
var
|
|
5185
|
+
var id11 = DraftApplicationScopeSchema.shape.authorityId;
|
|
4934
5186
|
var digest26 = DraftJobReceiptSchema.shape.receiptDigest;
|
|
4935
5187
|
var passage3 = ArtifactSpecificationSchema;
|
|
4936
|
-
var plainArtifact =
|
|
4937
|
-
id:
|
|
4938
|
-
revision:
|
|
4939
|
-
mediaType:
|
|
4940
|
-
exportProfile:
|
|
4941
|
-
content:
|
|
5188
|
+
var plainArtifact = z57.strictObject({
|
|
5189
|
+
id: id11,
|
|
5190
|
+
revision: id11,
|
|
5191
|
+
mediaType: z57.literal("text/plain"),
|
|
5192
|
+
exportProfile: id11.nullable(),
|
|
5193
|
+
content: z57.string().max(artifactLintLimits.maxTotalBytes),
|
|
4942
5194
|
expectedContentDigest: digest26
|
|
4943
5195
|
});
|
|
4944
|
-
var structuredArtifact =
|
|
4945
|
-
id:
|
|
4946
|
-
revision:
|
|
4947
|
-
mediaType:
|
|
4948
|
-
exportProfile:
|
|
5196
|
+
var structuredArtifact = z57.strictObject({
|
|
5197
|
+
id: id11,
|
|
5198
|
+
revision: id11,
|
|
5199
|
+
mediaType: z57.literal("application/vnd.felspar.structured-output+json"),
|
|
5200
|
+
exportProfile: id11.nullable(),
|
|
4949
5201
|
content: DraftStructuredOutputSchema,
|
|
4950
5202
|
expectedContentDigest: digest26
|
|
4951
5203
|
});
|
|
4952
|
-
var ArtifactLintArtifactSchema =
|
|
5204
|
+
var ArtifactLintArtifactSchema = z57.discriminatedUnion("mediaType", [
|
|
4953
5205
|
plainArtifact,
|
|
4954
5206
|
structuredArtifact
|
|
4955
5207
|
]);
|
|
4956
|
-
var ArtifactLintDecisionSchema =
|
|
5208
|
+
var ArtifactLintDecisionSchema = z57.strictObject({
|
|
4957
5209
|
inputs: DraftJobObligationsInputSchema,
|
|
4958
5210
|
assessment: DraftJobObligationsAssessmentSchema,
|
|
4959
5211
|
expectedAssessmentDigest: digest26
|
|
4960
5212
|
});
|
|
4961
|
-
var ArtifactLintInputSchema =
|
|
4962
|
-
schema:
|
|
4963
|
-
requestId:
|
|
5213
|
+
var ArtifactLintInputSchema = z57.strictObject({
|
|
5214
|
+
schema: z57.literal("felspar.lint.draft/v1"),
|
|
5215
|
+
requestId: id11,
|
|
4964
5216
|
release: DraftApplicationReleaseSchema,
|
|
4965
5217
|
material: DraftApplicationJobMaterialV3Schema,
|
|
4966
5218
|
manifest: ArtifactCheckManifestSchema,
|
|
4967
5219
|
expectedManifestDigest: digest26,
|
|
4968
|
-
attachedObligations:
|
|
4969
|
-
attachedCase:
|
|
5220
|
+
attachedObligations: z57.strictObject({ expectedObligationsDigest: digest26 }).optional(),
|
|
5221
|
+
attachedCase: z57.strictObject({
|
|
4970
5222
|
decisionReceiptDigest: digest26,
|
|
4971
|
-
answers:
|
|
5223
|
+
answers: z57.array(z57.strictObject({ key: id11, value: z57.union([z57.string().min(1).max(200), z57.null()]) })).max(256)
|
|
4972
5224
|
}).optional(),
|
|
4973
|
-
case:
|
|
4974
|
-
artifactRequirementId:
|
|
5225
|
+
case: z57.strictObject({ caseId: id11, purposeRef: id11, useRef: id11.nullable() }),
|
|
5226
|
+
artifactRequirementId: id11.nullable(),
|
|
4975
5227
|
decision: ArtifactLintDecisionSchema.nullable(),
|
|
4976
5228
|
artifact: ArtifactLintArtifactSchema
|
|
4977
5229
|
});
|
|
@@ -4984,11 +5236,11 @@ var artifactCheckStatuses = [
|
|
|
4984
5236
|
"not_applicable",
|
|
4985
5237
|
"skipped"
|
|
4986
5238
|
];
|
|
4987
|
-
var range =
|
|
4988
|
-
sectionId:
|
|
4989
|
-
start:
|
|
4990
|
-
end:
|
|
4991
|
-
offsetUnit:
|
|
5239
|
+
var range = z57.strictObject({
|
|
5240
|
+
sectionId: id11,
|
|
5241
|
+
start: z57.number().int().min(0).max(artifactLintLimits.maxSectionUnits),
|
|
5242
|
+
end: z57.number().int().min(1).max(artifactLintLimits.maxSectionUnits),
|
|
5243
|
+
offsetUnit: z57.literal("utf16_code_units")
|
|
4992
5244
|
});
|
|
4993
5245
|
var findingCodes = [
|
|
4994
5246
|
"section_missing",
|
|
@@ -5016,148 +5268,148 @@ var findingCodes = [
|
|
|
5016
5268
|
"evaluation_budget_exceeded",
|
|
5017
5269
|
"evaluation_skipped"
|
|
5018
5270
|
];
|
|
5019
|
-
var ArtifactFindingSchema =
|
|
5020
|
-
code:
|
|
5021
|
-
checkId:
|
|
5022
|
-
severity:
|
|
5271
|
+
var ArtifactFindingSchema = z57.strictObject({
|
|
5272
|
+
code: z57.enum(findingCodes),
|
|
5273
|
+
checkId: id11.nullable(),
|
|
5274
|
+
severity: z57.enum(["error", "warning"]),
|
|
5023
5275
|
specification: passage3.nullable(),
|
|
5024
5276
|
location: range.nullable(),
|
|
5025
|
-
insertionAnchor:
|
|
5026
|
-
literalIndex:
|
|
5027
|
-
});
|
|
5028
|
-
var ArtifactCheckObservationSchema =
|
|
5029
|
-
checkId:
|
|
5030
|
-
kind:
|
|
5031
|
-
required:
|
|
5032
|
-
method:
|
|
5033
|
-
status:
|
|
5034
|
-
occurrences:
|
|
5035
|
-
parsedValue:
|
|
5036
|
-
caseValue:
|
|
5037
|
-
});
|
|
5038
|
-
var ArtifactLintRecordBodySchema =
|
|
5039
|
-
schema:
|
|
5040
|
-
requestId:
|
|
5041
|
-
status:
|
|
5042
|
-
caseContext:
|
|
5043
|
-
binding:
|
|
5277
|
+
insertionAnchor: z57.strictObject({ sectionId: id11.nullable(), at: z57.number().int().min(0) }).nullable(),
|
|
5278
|
+
literalIndex: z57.number().int().min(0).max(artifactLintLimits.maxLiterals).nullable()
|
|
5279
|
+
});
|
|
5280
|
+
var ArtifactCheckObservationSchema = z57.strictObject({
|
|
5281
|
+
checkId: id11,
|
|
5282
|
+
kind: z57.enum(artifactCheckKinds),
|
|
5283
|
+
required: z57.boolean(),
|
|
5284
|
+
method: z57.enum(["deterministic", "semantic"]),
|
|
5285
|
+
status: z57.enum(artifactCheckStatuses),
|
|
5286
|
+
occurrences: z57.number().int().min(0),
|
|
5287
|
+
parsedValue: z57.number().nullable(),
|
|
5288
|
+
caseValue: z57.number().nullable()
|
|
5289
|
+
});
|
|
5290
|
+
var ArtifactLintRecordBodySchema = z57.strictObject({
|
|
5291
|
+
schema: z57.literal("felspar.lint-record.draft/v1"),
|
|
5292
|
+
requestId: id11,
|
|
5293
|
+
status: z57.enum(["pass", "revise", "unavailable", "review_required"]),
|
|
5294
|
+
caseContext: z57.enum(["bound", "not_required"]),
|
|
5295
|
+
binding: z57.strictObject({
|
|
5044
5296
|
scope: DraftApplicationScopeSchema,
|
|
5045
|
-
releaseId:
|
|
5297
|
+
releaseId: id11,
|
|
5046
5298
|
releaseDigest: digest26,
|
|
5047
5299
|
materialDigest: digest26,
|
|
5048
5300
|
obligationsDigest: digest26.optional(),
|
|
5049
5301
|
caseFactsDigest: digest26.optional(),
|
|
5050
|
-
jobId:
|
|
5051
|
-
manifestId:
|
|
5302
|
+
jobId: id11,
|
|
5303
|
+
manifestId: id11,
|
|
5052
5304
|
manifestDigest: digest26,
|
|
5053
|
-
contract:
|
|
5054
|
-
caseId:
|
|
5055
|
-
purposeRef:
|
|
5056
|
-
useRef:
|
|
5057
|
-
artifactRequirementId:
|
|
5305
|
+
contract: z57.strictObject({ id: id11, digest: digest26 }),
|
|
5306
|
+
caseId: id11,
|
|
5307
|
+
purposeRef: id11,
|
|
5308
|
+
useRef: id11.nullable(),
|
|
5309
|
+
artifactRequirementId: id11.nullable(),
|
|
5058
5310
|
decisionReceiptDigest: digest26.nullable(),
|
|
5059
5311
|
obligationsAssessmentDigest: digest26.nullable()
|
|
5060
5312
|
}),
|
|
5061
|
-
artifact:
|
|
5062
|
-
id:
|
|
5063
|
-
revision:
|
|
5064
|
-
mediaType:
|
|
5065
|
-
exportProfile:
|
|
5313
|
+
artifact: z57.strictObject({
|
|
5314
|
+
id: id11,
|
|
5315
|
+
revision: id11,
|
|
5316
|
+
mediaType: z57.enum(artifactLintMediaTypes),
|
|
5317
|
+
exportProfile: id11.nullable(),
|
|
5066
5318
|
contentDigest: digest26,
|
|
5067
|
-
sections:
|
|
5068
|
-
id:
|
|
5069
|
-
units:
|
|
5319
|
+
sections: z57.array(z57.strictObject({
|
|
5320
|
+
id: id11,
|
|
5321
|
+
units: z57.number().int().min(0),
|
|
5070
5322
|
contentDigest: digest26.nullable()
|
|
5071
5323
|
})).max(artifactLintLimits.maxSections)
|
|
5072
5324
|
}),
|
|
5073
|
-
checks:
|
|
5074
|
-
findings:
|
|
5325
|
+
checks: z57.array(ArtifactCheckObservationSchema).max(artifactLintLimits.maxChecks),
|
|
5326
|
+
findings: z57.array(ArtifactFindingSchema).max(2048),
|
|
5075
5327
|
semantic: ArtifactSemanticRecordSchema.nullable(),
|
|
5076
|
-
coverage:
|
|
5077
|
-
scope:
|
|
5078
|
-
declared:
|
|
5079
|
-
applicable:
|
|
5080
|
-
completed:
|
|
5081
|
-
required:
|
|
5082
|
-
requiredCompleted:
|
|
5083
|
-
textAssigned:
|
|
5084
|
-
semantic:
|
|
5085
|
-
nativeDocumentLayout:
|
|
5328
|
+
coverage: z57.strictObject({
|
|
5329
|
+
scope: z57.literal("declared_checks_only"),
|
|
5330
|
+
declared: z57.number().int().min(0),
|
|
5331
|
+
applicable: z57.number().int().min(0),
|
|
5332
|
+
completed: z57.number().int().min(0),
|
|
5333
|
+
required: z57.number().int().min(0),
|
|
5334
|
+
requiredCompleted: z57.number().int().min(0),
|
|
5335
|
+
textAssigned: z57.enum(["complete", "incomplete"]),
|
|
5336
|
+
semantic: z57.enum(["not_declared", "complete", "incomplete"]),
|
|
5337
|
+
nativeDocumentLayout: z57.literal("not_checked")
|
|
5086
5338
|
}),
|
|
5087
|
-
actionAuthorized:
|
|
5339
|
+
actionAuthorized: z57.literal(false)
|
|
5088
5340
|
});
|
|
5089
5341
|
var ArtifactLintRecordSchema = ArtifactLintRecordBodySchema.extend({
|
|
5090
5342
|
recordDigest: digest26
|
|
5091
5343
|
});
|
|
5092
|
-
var ArtifactLintReceiptSchema =
|
|
5093
|
-
schema:
|
|
5344
|
+
var ArtifactLintReceiptSchema = z57.strictObject({
|
|
5345
|
+
schema: z57.literal("felspar.lint-receipt.draft/v1"),
|
|
5094
5346
|
recordDigest: digest26,
|
|
5095
5347
|
releaseDigest: digest26,
|
|
5096
5348
|
manifestDigest: digest26,
|
|
5097
5349
|
contractDigest: digest26,
|
|
5098
|
-
caseId:
|
|
5099
|
-
caseContext:
|
|
5350
|
+
caseId: id11,
|
|
5351
|
+
caseContext: z57.enum(["bound", "not_required"]),
|
|
5100
5352
|
decisionReceiptDigest: digest26.nullable(),
|
|
5101
5353
|
obligationsAssessmentDigest: digest26.nullable(),
|
|
5102
|
-
artifactId:
|
|
5103
|
-
artifactRevision:
|
|
5354
|
+
artifactId: id11,
|
|
5355
|
+
artifactRevision: id11,
|
|
5104
5356
|
artifactDigest: digest26,
|
|
5105
|
-
actionAuthorized:
|
|
5357
|
+
actionAuthorized: z57.literal(false),
|
|
5106
5358
|
receiptDigest: digest26
|
|
5107
5359
|
});
|
|
5108
5360
|
|
|
5109
5361
|
// ../schemas/src/draft-hosted-output-check-record.ts
|
|
5110
|
-
var
|
|
5362
|
+
var id12 = DraftApplicationScopeSchema.shape.authorityId;
|
|
5111
5363
|
var digest27 = DraftJobReceiptSchema.shape.receiptDigest;
|
|
5112
|
-
var HostedOutputCheckInputSchema =
|
|
5113
|
-
executionId:
|
|
5114
|
-
output:
|
|
5115
|
-
text:
|
|
5116
|
-
revision:
|
|
5117
|
-
});
|
|
5118
|
-
var HostedOutputCheckRecordSchema =
|
|
5119
|
-
schema:
|
|
5120
|
-
checkId:
|
|
5121
|
-
jobId:
|
|
5122
|
-
output:
|
|
5123
|
-
decision:
|
|
5124
|
-
release:
|
|
5364
|
+
var HostedOutputCheckInputSchema = z58.strictObject({
|
|
5365
|
+
executionId: id12,
|
|
5366
|
+
output: id12.optional(),
|
|
5367
|
+
text: z58.string().min(1).max(artifactLintLimits.maxTotalBytes).refine(isWellFormedText, "text_not_well_formed"),
|
|
5368
|
+
revision: id12.optional()
|
|
5369
|
+
});
|
|
5370
|
+
var HostedOutputCheckRecordSchema = z58.strictObject({
|
|
5371
|
+
schema: z58.literal("felspar.hosted-output-check/v0"),
|
|
5372
|
+
checkId: id12,
|
|
5373
|
+
jobId: id12,
|
|
5374
|
+
output: id12,
|
|
5375
|
+
decision: z58.strictObject({ executionId: id12, outcome: id12, receiptDigest: digest27 }),
|
|
5376
|
+
release: z58.strictObject({ releaseId: id12, releaseDigest: digest27 }),
|
|
5125
5377
|
record: ArtifactLintRecordSchema,
|
|
5126
5378
|
receipt: ArtifactLintReceiptSchema.nullable(),
|
|
5127
|
-
evaluation:
|
|
5128
|
-
modelCalls:
|
|
5129
|
-
reason:
|
|
5379
|
+
evaluation: z58.strictObject({
|
|
5380
|
+
modelCalls: z58.number().int().min(0),
|
|
5381
|
+
reason: z58.string().regex(/^[a-z][a-z_]{2,63}$/u).nullable()
|
|
5130
5382
|
})
|
|
5131
5383
|
});
|
|
5132
5384
|
|
|
5133
5385
|
// src/draft-hosted-client.ts
|
|
5134
|
-
import { z as
|
|
5135
|
-
var digestText =
|
|
5136
|
-
var HostedOutputCheckReplySchema =
|
|
5137
|
-
status:
|
|
5138
|
-
checkId:
|
|
5139
|
-
output:
|
|
5140
|
-
findings:
|
|
5141
|
-
receipt:
|
|
5142
|
-
decision:
|
|
5143
|
-
actionAuthorized:
|
|
5386
|
+
import { z as z59 } from "zod";
|
|
5387
|
+
var digestText = z59.string().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
5388
|
+
var HostedOutputCheckReplySchema = z59.object({
|
|
5389
|
+
status: z59.enum(["pass", "revise", "review_required", "unavailable"]),
|
|
5390
|
+
checkId: z59.string(),
|
|
5391
|
+
output: z59.string(),
|
|
5392
|
+
findings: z59.array(z59.record(z59.string(), z59.unknown())),
|
|
5393
|
+
receipt: z59.object({ receiptDigest: digestText, artifactDigest: digestText }).loose().nullable(),
|
|
5394
|
+
decision: z59.object({ executionId: z59.string(), receiptDigest: digestText }),
|
|
5395
|
+
actionAuthorized: z59.literal(false)
|
|
5144
5396
|
}).loose();
|
|
5145
|
-
var quotedWords =
|
|
5146
|
-
var FelsparCaseSchema =
|
|
5147
|
-
var FelsparRelatedSchema =
|
|
5148
|
-
relationship:
|
|
5149
|
-
subject:
|
|
5150
|
-
id:
|
|
5151
|
-
questions:
|
|
5152
|
-
});
|
|
5153
|
-
var FelsparResultSubjectSchema =
|
|
5154
|
-
type:
|
|
5155
|
-
id:
|
|
5156
|
-
related:
|
|
5157
|
-
});
|
|
5158
|
-
var FelsparEscalationSchema =
|
|
5159
|
-
id:
|
|
5160
|
-
trigger:
|
|
5397
|
+
var quotedWords = z59.object({ text: z59.string() }).loose();
|
|
5398
|
+
var FelsparCaseSchema = z59.object({ id: z59.string().min(1).max(200), mode: z59.enum(identityModes) });
|
|
5399
|
+
var FelsparRelatedSchema = z59.object({
|
|
5400
|
+
relationship: z59.string(),
|
|
5401
|
+
subject: z59.string(),
|
|
5402
|
+
id: z59.string(),
|
|
5403
|
+
questions: z59.array(z59.string())
|
|
5404
|
+
});
|
|
5405
|
+
var FelsparResultSubjectSchema = z59.object({
|
|
5406
|
+
type: z59.string(),
|
|
5407
|
+
id: z59.string(),
|
|
5408
|
+
related: z59.array(FelsparRelatedSchema)
|
|
5409
|
+
});
|
|
5410
|
+
var FelsparEscalationSchema = z59.object({
|
|
5411
|
+
id: z59.string().min(1).max(200),
|
|
5412
|
+
trigger: z59.enum(escalationTriggers),
|
|
5161
5413
|
why: quotedWords
|
|
5162
5414
|
});
|
|
5163
5415
|
var FelsparJobResultSchema = HostedJobResultSchema.extend({
|
|
@@ -5165,11 +5417,11 @@ var FelsparJobResultSchema = HostedJobResultSchema.extend({
|
|
|
5165
5417
|
case: FelsparCaseSchema.optional(),
|
|
5166
5418
|
subject: FelsparResultSubjectSchema.optional(),
|
|
5167
5419
|
escalation: FelsparEscalationSchema.optional(),
|
|
5168
|
-
missing:
|
|
5420
|
+
missing: z59.array(z59.string()).optional()
|
|
5169
5421
|
}).nullable()
|
|
5170
5422
|
});
|
|
5171
|
-
var FelsparJobListSchema =
|
|
5172
|
-
jobs:
|
|
5423
|
+
var FelsparJobListSchema = z59.object({
|
|
5424
|
+
jobs: z59.array(z59.object({ id: z59.string().min(1).max(200) })).max(256)
|
|
5173
5425
|
});
|
|
5174
5426
|
var hostedPartsContentType = "application/x.felspar-content-parts";
|
|
5175
5427
|
async function partsBody(value) {
|
|
@@ -5221,27 +5473,29 @@ ${jobId}`;
|
|
|
5221
5473
|
return result;
|
|
5222
5474
|
};
|
|
5223
5475
|
}
|
|
5224
|
-
var refusalCode =
|
|
5225
|
-
var fieldPath =
|
|
5226
|
-
var refusalEscalationSchema =
|
|
5227
|
-
id:
|
|
5228
|
-
trigger:
|
|
5229
|
-
why:
|
|
5476
|
+
var refusalCode = z59.string().regex(/^[a-z][a-z_]{2,63}$/u);
|
|
5477
|
+
var fieldPath = z59.array(z59.string().max(256)).max(32);
|
|
5478
|
+
var refusalEscalationSchema = z59.object({
|
|
5479
|
+
id: z59.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@-]{0,199}$/u),
|
|
5480
|
+
trigger: z59.enum(escalationTriggers),
|
|
5481
|
+
why: z59.object({ text: z59.string().max(2e4) })
|
|
5230
5482
|
});
|
|
5231
|
-
var refusalSchema =
|
|
5483
|
+
var refusalSchema = z59.object({
|
|
5232
5484
|
error: refusalCode,
|
|
5233
5485
|
path: fieldPath.optional(),
|
|
5234
|
-
currentReleaseDigest:
|
|
5235
|
-
retryAfterSeconds:
|
|
5236
|
-
escalation:
|
|
5237
|
-
issues:
|
|
5486
|
+
currentReleaseDigest: z59.string().regex(/^sha256:[a-f0-9]{64}$/u).optional(),
|
|
5487
|
+
retryAfterSeconds: z59.number().int().min(1).max(3600).optional(),
|
|
5488
|
+
escalation: z59.unknown().optional(),
|
|
5489
|
+
issues: z59.array(z59.object({ code: refusalCode, path: fieldPath })).max(64).optional()
|
|
5238
5490
|
}).transform(({ escalation: named, ...value }) => {
|
|
5239
5491
|
const fix = hostedRefusalFix(value.error);
|
|
5492
|
+
const recovery = hostedRefusalRecovery(value.error);
|
|
5240
5493
|
const escalation = refusalEscalationSchema.safeParse(named).data;
|
|
5241
5494
|
return {
|
|
5242
5495
|
...value,
|
|
5243
5496
|
...escalation !== void 0 && { escalation },
|
|
5244
5497
|
...fix !== null && { fix },
|
|
5498
|
+
...recovery !== null && { recovery },
|
|
5245
5499
|
...value.issues && {
|
|
5246
5500
|
issues: value.issues.map((issue) => {
|
|
5247
5501
|
const issueFix = hostedRefusalFix(issue.code);
|
|
@@ -5262,8 +5516,8 @@ var FelsparRequestError = class extends Error {
|
|
|
5262
5516
|
}
|
|
5263
5517
|
};
|
|
5264
5518
|
async function refusalOf(response) {
|
|
5265
|
-
const
|
|
5266
|
-
const parsed = refusalSchema.safeParse(
|
|
5519
|
+
const text8 = await response.text();
|
|
5520
|
+
const parsed = refusalSchema.safeParse(text8.length <= 65536 ? JSON.parse(text8) : null);
|
|
5267
5521
|
return parsed.success ? parsed.data : null;
|
|
5268
5522
|
}
|
|
5269
5523
|
async function requestError(response) {
|
|
@@ -5295,9 +5549,10 @@ function agentCalls(call) {
|
|
|
5295
5549
|
const objectId = HostedObjectSchema.shape.id;
|
|
5296
5550
|
return {
|
|
5297
5551
|
listJobs: async () => await call("/v0/jobs", FelsparJobListSchema),
|
|
5298
|
-
|
|
5552
|
+
describeCurrentJob: async (job) => await call(`/v0/jobs/${encodeURIComponent(objectId.parse(job))}/brief`, HostedJobDescriptionSchema),
|
|
5553
|
+
resolveJob: async (id13, value) => {
|
|
5299
5554
|
const input = HostedSuppliedJobInputSchema.parse(value);
|
|
5300
|
-
const releaseId = objectId.parse(
|
|
5555
|
+
const releaseId = objectId.parse(id13);
|
|
5301
5556
|
const path3 = `/v0/releases/${encodeURIComponent(releaseId)}/jobs`;
|
|
5302
5557
|
return pinnedResult(await call(path3, FelsparJobResultSchema, input), releaseId, input);
|
|
5303
5558
|
}
|
|
@@ -5342,16 +5597,16 @@ function createHostedFelsparClient(configuration) {
|
|
|
5342
5597
|
return {
|
|
5343
5598
|
submitSource: async (value) => await call("/v0/sources", HostedObjectSchema, HostedSourceInputSchema.parse(value)),
|
|
5344
5599
|
submitProposal: async (value) => await call("/v0/proposals", HostedObjectSchema, HostedProposalInputSchema.parse(value)),
|
|
5345
|
-
approveProposal: async (
|
|
5346
|
-
releasePack: async (
|
|
5347
|
-
loadRelease: async (
|
|
5348
|
-
describeJob: async (
|
|
5600
|
+
approveProposal: async (id13, value) => await call(`/v0/proposals/${encodeURIComponent(objectId.parse(id13))}/approve`, HostedObjectSchema, HostedApprovalInputSchema.parse(value)),
|
|
5601
|
+
releasePack: async (id13, value) => await call(`/v0/approvals/${encodeURIComponent(objectId.parse(id13))}/release`, DraftApplicationReleaseSchema, HostedReleaseInputSchema.parse(value)),
|
|
5602
|
+
loadRelease: async (id13) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id13))}`, HostedReleaseBundleSchema),
|
|
5603
|
+
describeJob: async (id13, job) => await describe(objectId.parse(id13), objectId.parse(job)),
|
|
5349
5604
|
verifyReceipt: async (executionObjectId, value) => await call(`/v0/executions/${encodeURIComponent(objectId.parse(executionObjectId))}/verify`, HostedReceiptVerificationSchema, HostedReceiptVerificationInputSchema.parse(value)),
|
|
5350
5605
|
...outputCheckCalls(call),
|
|
5351
|
-
executeJob: async (
|
|
5606
|
+
executeJob: async (id13, value) => await call(`/v0/releases/${encodeURIComponent(objectId.parse(id13))}/jobs`, HostedJobResultSchema, HostedJobInputSchema.parse(value)),
|
|
5352
5607
|
...agentCalls(call),
|
|
5353
|
-
resolveFacts: async (
|
|
5354
|
-
const releaseId = objectId.parse(
|
|
5608
|
+
resolveFacts: async (id13, value) => {
|
|
5609
|
+
const releaseId = objectId.parse(id13);
|
|
5355
5610
|
const input = await factsRequest(value, async (jobId) => await describe(releaseId, jobId));
|
|
5356
5611
|
const path3 = `/v0/releases/${encodeURIComponent(releaseId)}/jobs`;
|
|
5357
5612
|
return pinnedResult(await call(path3, FelsparJobResultSchema, input), releaseId, input);
|