@parcha/agentrun-dsl 0.1.0-beta.33 → 0.1.0-beta.331
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/NOTICE +2 -0
- package/README.md +10 -4
- package/dist/author-references.d.ts +2 -2
- package/dist/author-references.js +2 -2
- package/dist/author.d.ts +0 -2
- package/dist/author.js +7 -6
- package/dist/authoring.js +3 -2
- package/dist/cli.js +2 -1
- package/dist/code-exec.d.ts +19 -0
- package/dist/code-exec.js +54 -5
- package/dist/decision-provider.d.ts +11 -2
- package/dist/decision-provider.js +9 -3
- package/dist/decision-receipts.d.ts +19 -3
- package/dist/dry-run.d.ts +31 -1
- package/dist/dry-run.js +103 -14
- package/dist/edit.d.ts +158 -0
- package/dist/edit.js +1486 -0
- package/dist/evidence.js +2 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.js +12 -8
- package/dist/pattern-screen.d.ts +14 -0
- package/dist/pattern-screen.js +451 -0
- package/dist/pointer-warning.d.ts +14 -0
- package/dist/pointer-warning.js +22 -0
- package/dist/predicates.d.ts +23 -3
- package/dist/predicates.js +48 -6
- package/dist/record.d.ts +4 -0
- package/dist/record.js +6 -0
- package/dist/recovery/binding.js +2 -1
- package/dist/recovery/call-key.d.ts +0 -4
- package/dist/recovery/call-key.js +0 -7
- package/dist/recovery/driver.d.ts +9 -14
- package/dist/recovery/driver.js +29 -26
- package/dist/recovery/frozen-snapshot.js +8 -8
- package/dist/recovery/handoff-receipts.d.ts +0 -35
- package/dist/recovery/handoff-receipts.js +2 -44
- package/dist/recovery/index.d.ts +2 -7
- package/dist/recovery/index.js +2 -6
- package/dist/recovery/item-state.d.ts +2 -1
- package/dist/recovery/item-state.js +7 -13
- package/dist/recovery/with-recovery.js +4 -2
- package/dist/submit-envelope.d.ts +1 -1
- package/dist/submit-envelope.js +11 -7
- package/dist/system-one.d.ts +0 -4
- package/dist/system-one.js +7 -8
- package/dist/vocabulary.d.ts +7 -2
- package/dist/vocabulary.js +7 -1
- package/dist/workflow-shape.js +4 -2
- package/dist/workflow.d.ts +58 -13
- package/dist/workflow.js +399 -180
- package/dist/zod-json-contract.js +6 -8
- package/package.json +18 -2
- package/schema/workflow.schema.json +93 -0
- package/skills/author/references/jev-decisions.md +10 -5
- package/skills/author/references/language.md +5 -4
- package/dist/recovery/effect-failure.d.ts +0 -34
- package/dist/recovery/effect-failure.js +0 -62
- package/dist/recovery/handoff-block.d.ts +0 -36
- package/dist/recovery/handoff-block.js +0 -148
- package/dist/recovery/handoff-digest.d.ts +0 -58
- package/dist/recovery/handoff-digest.js +0 -195
- package/dist/recovery/handoff-files.d.ts +0 -54
- package/dist/recovery/handoff-files.js +0 -162
- package/dist/recovery/handoff-redact.d.ts +0 -12
- package/dist/recovery/handoff-redact.js +0 -44
- package/dist/recovery/handoff.d.ts +0 -44
- package/dist/recovery/handoff.js +0 -46
package/dist/system-one.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { isRecord } from "./record.js";
|
|
1
2
|
export const SYSTEM_ONE_LIMITS = { maxChoiceOptions: 240, minScoreLevels: 2, maxScoreLevels: 10 };
|
|
2
|
-
export const SYSTEM_ONE_DEFAULT_MODEL = "jev-latest";
|
|
3
3
|
const CRITERIA = "criteria";
|
|
4
4
|
export function compileQuestions(schema, definitions = {}) {
|
|
5
5
|
const errors = [];
|
|
@@ -45,10 +45,10 @@ export function compileQuestions(schema, definitions = {}) {
|
|
|
45
45
|
}
|
|
46
46
|
const map = Object.create(null);
|
|
47
47
|
for (const option of spec.enum) {
|
|
48
|
-
const text =
|
|
48
|
+
const text = isRecord(criteria) ? criteria[option] : undefined;
|
|
49
49
|
map[option] = typeof text === "string" && text.trim() ? text.trim() : null;
|
|
50
50
|
}
|
|
51
|
-
if (
|
|
51
|
+
if (isRecord(criteria)) {
|
|
52
52
|
const unknown = Object.keys(criteria).filter((k) => !spec.enum.includes(k));
|
|
53
53
|
if (unknown.length)
|
|
54
54
|
errors.push(`property "${id}": criteria name options the enum does not have: ${unknown.join(", ")}`);
|
|
@@ -57,7 +57,7 @@ export function compileQuestions(schema, definitions = {}) {
|
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
if (types.length === 1 && types[0] === "boolean") {
|
|
60
|
-
const c =
|
|
60
|
+
const c = isRecord(criteria) ? criteria : undefined;
|
|
61
61
|
questions[id] = { type: "noul", instructions, ...(c ? { criteria: { ...(typeof c.true === "string" ? { true: c.true } : {}), ...(typeof c.false === "string" ? { false: c.false } : {}) } } : {}) };
|
|
62
62
|
continue;
|
|
63
63
|
}
|
|
@@ -211,7 +211,7 @@ function scoreContradictsDistribution(score, probabilities) {
|
|
|
211
211
|
return score - step > max + 1e-5 || score + step < min - 1e-5;
|
|
212
212
|
}
|
|
213
213
|
export function validateAnswers(questions, answers) {
|
|
214
|
-
if (!
|
|
214
|
+
if (!isRecord(answers))
|
|
215
215
|
throw new SystemOneError("System One response carries no answers", null, undefined, "answers_shape");
|
|
216
216
|
const answerKeys = Object.keys(answers);
|
|
217
217
|
if (answerKeys.length !== Object.keys(questions).length || answerKeys.some(id => !Object.hasOwn(questions, id)))
|
|
@@ -254,7 +254,7 @@ export function validateAnswers(questions, answers) {
|
|
|
254
254
|
if (!roundedFromUnitMass(Object.values(a.probabilities)))
|
|
255
255
|
throw new SystemOneError("System One answer: probabilities must sum to 1", null, undefined, "probability_mass");
|
|
256
256
|
if (q.type === "score") {
|
|
257
|
-
if (!
|
|
257
|
+
if (!isRecord(a.legend) || Object.keys(a.legend).length !== expectedKeys.length || q.criteria.some((text, index) => a.legend[String(index)] !== text))
|
|
258
258
|
throw new SystemOneError("System One answer: legend must match the score criteria", null, undefined, "score_legend");
|
|
259
259
|
if (scoreContradictsDistribution(a.score, a.probabilities))
|
|
260
260
|
throw new SystemOneError("System One answer: score must match its weighted distribution", null, undefined, "score_consistency");
|
|
@@ -271,10 +271,9 @@ export function refusedQuestions(answers) {
|
|
|
271
271
|
}
|
|
272
272
|
/** What `answersToValue` throws for a refused answer: the backstop. A decision node never gets this far, since `decide()`
|
|
273
273
|
* escalates the run for review (DECISION_REFUSED) on a refusal first. */
|
|
274
|
-
|
|
274
|
+
function refusalError(ids) {
|
|
275
275
|
return new SystemOneError(`System One refused ${ids.length === 1 ? "question" : "questions"} ${ids.map((id) => `"${id}"`).join(", ")}`, null, undefined, "refusal");
|
|
276
276
|
}
|
|
277
|
-
const isRecord = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
278
277
|
/** The confidence TypeSafe documents for Jev (docs.typesafe.ai/confidence), computed from an answer's probabilities: for a
|
|
279
278
|
* choice of n options, (p - 1/n) / (1 - 1/n) for the chosen option's p, floored at 0; for a score of n levels, 1 minus
|
|
280
279
|
* the probability-weighted distance from the most likely level (the lowest, on a tie) over that distance for an even
|
package/dist/vocabulary.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export declare const IGNORED_NODE_FIELDS: {
|
|
|
21
21
|
readonly [Kind in WorkflowNodeKind]?: readonly string[];
|
|
22
22
|
};
|
|
23
23
|
/** Predicates that read a state value. `poll` accepts only these, and `not` holds only one of these. */
|
|
24
|
-
export declare const MECHANICAL_PREDICATES: readonly ["field_equals", "field_true", "in", "count_gte", "gte", "lt", "empty", "no_new_items", "field_type", "not"];
|
|
24
|
+
export declare const MECHANICAL_PREDICATES: readonly ["field_equals", "field_true", "in", "count_gte", "gte", "lt", "empty", "no_new_items", "field_type", "quote_missing", "not"];
|
|
25
25
|
/** Every predicate `loop.until` and `escalate.when` accept: the mechanical set plus `ask`, a yes/no judge question. */
|
|
26
|
-
export declare const WORKFLOW_PREDICATES: readonly ["field_equals", "field_true", "in", "count_gte", "gte", "lt", "empty", "no_new_items", "field_type", "not", "ask"];
|
|
26
|
+
export declare const WORKFLOW_PREDICATES: readonly ["field_equals", "field_true", "in", "count_gte", "gte", "lt", "empty", "no_new_items", "field_type", "quote_missing", "not", "ask"];
|
|
27
27
|
export type WorkflowPredicateName = typeof WORKFLOW_PREDICATES[number];
|
|
28
28
|
/** The fields each predicate takes. */
|
|
29
29
|
export declare const PREDICATE_FIELDS: {
|
|
@@ -48,3 +48,8 @@ export declare const CALL_RETRY_CLASSES: readonly ["timeout", "http_5xx", "http_
|
|
|
48
48
|
export declare const EFFECT_FAILURE_CODES: readonly ["effect_timeout", "effect_exit", "effect_transport", "effect_not_granted", "effect_produces_missing", "effect_path_escape", "effect_code_unsafe", "output_invalid", "state_invalid", "effect_unknown_transport"];
|
|
49
49
|
/** Artifact types the engine itself treats as prose (the report writer). Every other type names a file. */
|
|
50
50
|
export declare const PROSE_ARTIFACT_TYPES: readonly ["markdown", "report"];
|
|
51
|
+
/** Whether `name` is one an object's prototype has (`constructor`, `toString`, `__proto__` and the rest of
|
|
52
|
+
* `Object.prototype`'s own names), or `prototype`. As a label, an `as`, a `failedAs` or a route branch, a read of one that
|
|
53
|
+
* nothing wrote would find the prototype's value: the editor refuses to write such a name (edit.ts), and the validator
|
|
54
|
+
* refuses a document that has one (workflow.ts). */
|
|
55
|
+
export declare const isPrototypeName: (name: string) => boolean;
|
package/dist/vocabulary.js
CHANGED
|
@@ -43,7 +43,7 @@ export const IGNORED_NODE_FIELDS = {
|
|
|
43
43
|
decide: ["samples", "voteField"],
|
|
44
44
|
};
|
|
45
45
|
/** Predicates that read a state value. `poll` accepts only these, and `not` holds only one of these. */
|
|
46
|
-
export const MECHANICAL_PREDICATES = ["field_equals", "field_true", "in", "count_gte", "gte", "lt", "empty", "no_new_items", "field_type", "not"];
|
|
46
|
+
export const MECHANICAL_PREDICATES = ["field_equals", "field_true", "in", "count_gte", "gte", "lt", "empty", "no_new_items", "field_type", "quote_missing", "not"];
|
|
47
47
|
/** Every predicate `loop.until` and `escalate.when` accept: the mechanical set plus `ask`, a yes/no judge question. */
|
|
48
48
|
export const WORKFLOW_PREDICATES = [...MECHANICAL_PREDICATES, "ask"];
|
|
49
49
|
/** The fields each predicate takes. */
|
|
@@ -57,6 +57,7 @@ export const PREDICATE_FIELDS = {
|
|
|
57
57
|
empty: ["path"],
|
|
58
58
|
no_new_items: ["key"],
|
|
59
59
|
field_type: ["path", "type"],
|
|
60
|
+
quote_missing: ["path", "field", "pages"],
|
|
60
61
|
not: ["of"],
|
|
61
62
|
ask: ["instructions", "state", "criteria", "gte", ...DECISION_NODE_FIELDS],
|
|
62
63
|
};
|
|
@@ -81,3 +82,8 @@ export const EFFECT_FAILURE_CODES = [
|
|
|
81
82
|
];
|
|
82
83
|
/** Artifact types the engine itself treats as prose (the report writer). Every other type names a file. */
|
|
83
84
|
export const PROSE_ARTIFACT_TYPES = ["markdown", "report"];
|
|
85
|
+
/** Whether `name` is one an object's prototype has (`constructor`, `toString`, `__proto__` and the rest of
|
|
86
|
+
* `Object.prototype`'s own names), or `prototype`. As a label, an `as`, a `failedAs` or a route branch, a read of one that
|
|
87
|
+
* nothing wrote would find the prototype's value: the editor refuses to write such a name (edit.ts), and the validator
|
|
88
|
+
* refuses a document that has one (workflow.ts). */
|
|
89
|
+
export const isPrototypeName = (name) => name === "prototype" || Object.hasOwn(Object.prototype, name);
|
package/dist/workflow-shape.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { Compile } from "typebox/compile";
|
|
3
|
-
|
|
3
|
+
import { isRecord } from "./record.js";
|
|
4
|
+
// A named require lets deployment tracers retain the schema beside this package.
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const documentSchema = require("../schema/workflow.schema.json");
|
|
4
7
|
const fullValidator = Compile(documentSchema);
|
|
5
|
-
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6
8
|
// Diagnostics only: the full validator below remains the acceptance authority.
|
|
7
9
|
// Its union errors can fill the entire error limit with unrelated node kinds.
|
|
8
10
|
// Select the declared discriminator's schema, checking nested nodes separately so
|
package/dist/workflow.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type AcceptPredicate } from "./predicates.js";
|
|
|
2
2
|
import { EFFECT_FAILURE_CODES } from "./vocabulary.js";
|
|
3
3
|
import { type ConfidenceSource, type SystemOneAnswer, type SystemOneQuestion } from "./system-one.js";
|
|
4
4
|
import { type CostBasis, type DecisionEvidence, type DecisionProvider } from "./decision-provider.js";
|
|
5
|
-
import { type DecisionImageDigest, type DecisionReceipt } from "./decision-receipts.js";
|
|
5
|
+
import { type DecisionImageDigest, type DecisionReceipt, type DecisionStateSent } from "./decision-receipts.js";
|
|
6
6
|
export { resolveSchemaForWorkflow } from "./schema-references.js";
|
|
7
7
|
/** The model tier a node asks for: `fast` (the cheap tier), `strong` (the host's stronger model),
|
|
8
8
|
* or the kind's default. A router that sends the few thin cases to `strong` buys depth only where the
|
|
@@ -320,7 +320,6 @@ export type ArtifactState = {
|
|
|
320
320
|
};
|
|
321
321
|
export declare function artifactNodeIsProse(node: ArtifactNode): boolean;
|
|
322
322
|
export declare function desugarWorkflow(workflow: Workflow): Workflow;
|
|
323
|
-
export declare function terminalArtifactType(workflow: Workflow): string | null;
|
|
324
323
|
/** A predicate a `call` evaluates against ITS OWN RESULT: paths are result-relative. */
|
|
325
324
|
export type CallPredicate = MechanicalPredicate;
|
|
326
325
|
export type PollClause = {
|
|
@@ -467,7 +466,20 @@ export type HostPolicy = {
|
|
|
467
466
|
state: Record<string, unknown>;
|
|
468
467
|
}) => Record<string, unknown> | undefined;
|
|
469
468
|
};
|
|
469
|
+
/** What one map node may fan out to: at most `items` items, and at most `copiedChars` characters of state copied for them
|
|
470
|
+
* in all. Each item runs on its own copy of the workflow's state (the list it maps over included), so a map's copies
|
|
471
|
+
* cost its items times its state: ten thousand items over a state that holds them is a hundred million values. Past
|
|
472
|
+
* either limit the map fails before it runs an item (WorkflowStateError, reason "map_too_large"). The state is measured
|
|
473
|
+
* as JSON would write it, about its bytes. */
|
|
474
|
+
export type MapLimits = {
|
|
475
|
+
items: number;
|
|
476
|
+
copiedChars: number;
|
|
477
|
+
};
|
|
478
|
+
/** The limits a map runs under when WorkflowDeps.mapLimits sets none. */
|
|
479
|
+
export declare const MAP_LIMITS: Readonly<MapLimits>;
|
|
470
480
|
export type WorkflowDeps = {
|
|
481
|
+
/** Either of a map node's limits (MapLimits), each MAP_LIMITS's unless given as a number. */
|
|
482
|
+
mapLimits?: Partial<MapLimits>;
|
|
471
483
|
maxQuestionsPerRequest?: number;
|
|
472
484
|
/** Most UTF-8 bytes of JSON state one judge request may carry (the Jev adapter's `maxStateBytes`
|
|
473
485
|
* measure). A `sift` that would exceed it, or `maxQuestionsPerRequest`, is split into several
|
|
@@ -588,6 +600,9 @@ export type WorkflowDeps = {
|
|
|
588
600
|
provider?: string;
|
|
589
601
|
/** The images the request carried, by digest (never the bytes), as the host loaded them. */
|
|
590
602
|
images?: DecisionImageDigest[];
|
|
603
|
+
/** The state the provider sent, and the values it cut, when it cut any to fit its model's context: the receipt
|
|
604
|
+
* records it, not the state asked. A failed request's DecisionProviderError carries it as `stateSent`. */
|
|
605
|
+
state_sent?: DecisionStateSent;
|
|
591
606
|
}>;
|
|
592
607
|
/** Records one typed-question request and what its answers decide. It is awaited before the answers
|
|
593
608
|
* reach state, an event or a branch, so a durable recorder holds every decision the run acted on; a
|
|
@@ -628,6 +643,9 @@ export type WorkflowDeps = {
|
|
|
628
643
|
sop?: string;
|
|
629
644
|
skill?: string;
|
|
630
645
|
signal?: AbortSignal;
|
|
646
|
+
/** Called at each node's visit, before it runs (a loop's body each iteration, a map's body for each item): a host that
|
|
647
|
+
* bounds the work a run does (a dry run's steps and deadline) counts it here, and throws to stop the run. */
|
|
648
|
+
onVisit?: (node: WorkflowNode) => void;
|
|
631
649
|
/** Best-effort observation only: thrown errors and rejected promises are ignored.
|
|
632
650
|
* Observers are never awaited. Use required checkpoints for durable lifecycle gates. */
|
|
633
651
|
onEvent?: (event: WorkflowEvent) => void;
|
|
@@ -653,25 +671,22 @@ export type DecisionExchange = {
|
|
|
653
671
|
export declare const declaredWrites: (node: WorkflowNode | undefined) => Set<string>;
|
|
654
672
|
export declare const childSteps: (child: Workflow | undefined) => WorkflowNode[] | null;
|
|
655
673
|
/** A failed effect: its retry class (null when the failure is not transient by nature), its closed code,
|
|
656
|
-
*
|
|
674
|
+
* what the host observed (`detail`, written onto the attempt's `effect.failed` event), and how long the
|
|
675
|
+
* provider asked the caller to wait before trying again (`retryAfterMs`, a Retry-After the host parsed).
|
|
676
|
+
* A retry waits at least `retryAfterMs`; a value that is not a finite number >= 0 is dropped. The engine
|
|
677
|
+
* sets no ceiling on it beyond the poll budget, so a host that reads it from a third party bounds it first. */
|
|
657
678
|
export declare class EffectFailure extends Error {
|
|
658
679
|
readonly retryClass: CallRetryClass | null;
|
|
659
680
|
readonly code: EffectFailureCode | null;
|
|
660
681
|
readonly detail?: Record<string, unknown>;
|
|
682
|
+
readonly retryAfterMs?: number;
|
|
661
683
|
constructor(message: string, retryClass?: CallRetryClass | null, options?: {
|
|
662
684
|
code?: EffectFailureCode | null;
|
|
663
685
|
detail?: Record<string, unknown>;
|
|
664
686
|
cause?: unknown;
|
|
687
|
+
retryAfterMs?: number;
|
|
665
688
|
});
|
|
666
689
|
}
|
|
667
|
-
export declare function parseCsvRows(text: string): string[][];
|
|
668
|
-
export declare function buildReferenceContext(files: Record<string, string>): {
|
|
669
|
-
references: Record<string, string>;
|
|
670
|
-
references_parsed: Record<string, {
|
|
671
|
-
header: string[];
|
|
672
|
-
rows: string[][];
|
|
673
|
-
}>;
|
|
674
|
-
};
|
|
675
690
|
export declare function normalizeStringNullsForSchema(value: unknown, schema: Record<string, unknown> | undefined, depth?: number, root?: Record<string, unknown> | undefined): unknown;
|
|
676
691
|
export declare function workflowSha256(workflow: Workflow): string;
|
|
677
692
|
/** Bound the complete document before any recursive schema or semantic traversal. Shared
|
|
@@ -689,12 +704,24 @@ export type ValidationIssue = {
|
|
|
689
704
|
code: ValidationCode;
|
|
690
705
|
message: string;
|
|
691
706
|
};
|
|
707
|
+
/** A reserved name (vocabulary.ts isPrototypeName: Object.prototype's own names, and "prototype") where a document puts a
|
|
708
|
+
* name: a node's `label`, `as` or `failedAs`, or a route's branch. Or a label holding "/", which a run puts between a
|
|
709
|
+
* child workflow's label and its steps' (`<child>/<step>`): a label `a/b` beside a child `a`'s step `b` would name two
|
|
710
|
+
* nodes. `path` is the node's JSON Pointer. */
|
|
711
|
+
export type ReservedName = {
|
|
712
|
+
path: string;
|
|
713
|
+
field: "label" | "as" | "failedAs" | "branch";
|
|
714
|
+
name: string;
|
|
715
|
+
};
|
|
692
716
|
/** Whether a workflow can run, checked without running it: `errors` refuse it, `warnings` advise and never refuse.
|
|
693
717
|
* Set `executeCode: false` for untrusted author feedback: check syntax and mechanical contracts without evaluating
|
|
694
718
|
* authored expressions or probing transforms. That is not execution admission; trusted/default validation and runtime
|
|
695
719
|
* output checks remain authoritative. */
|
|
696
720
|
export type ValidateWorkflowOptions = {
|
|
697
721
|
executeCode?: boolean;
|
|
722
|
+
/** The run's input, or only its keys: what the reachability checks (STATE_PATH_UNPRODUCED, STATE_PATH_EXCLUDED) start
|
|
723
|
+
* from, and what they find is an error. Neither given, the input schema's `properties` stand in, and what they find is
|
|
724
|
+
* a warning. */
|
|
698
725
|
input?: Record<string, unknown>;
|
|
699
726
|
inputKeys?: string[];
|
|
700
727
|
probeContext?: {
|
|
@@ -707,16 +734,34 @@ export type ValidateWorkflowOptions = {
|
|
|
707
734
|
/** The host's tool names. Given, a node that names a tool outside them (a model or artifact node's `tools`, a call
|
|
708
735
|
* node's `tool`) is refused here. Absent, tool names are not checked until a node runs. */
|
|
709
736
|
tools?: readonly string[];
|
|
737
|
+
/** A reserved name as a label, `as`, `failedAs` or route branch, or a label holding "/" (ReservedName). "refuse" (the
|
|
738
|
+
* default, a save's check): each is a NODE_FIELD_INVALID issue saying to rename it. "warn" (a run's check of a document
|
|
739
|
+
* already stored): none is an issue; each is a warning, and `reserved` lists them in document order. The engine reads
|
|
740
|
+
* every name as an own key, so a stored document that has one runs as written; one whose "/" label names a node twice
|
|
741
|
+
* is still refused where a run needs each name once (recovery's duplicate-label check). */
|
|
742
|
+
reservedNames?: "refuse" | "warn";
|
|
710
743
|
};
|
|
711
744
|
export declare function validateWorkflow(workflow: Workflow, opts?: ValidateWorkflowOptions): {
|
|
712
745
|
ok: true;
|
|
713
746
|
warnings?: string[];
|
|
747
|
+
reserved?: ReservedName[];
|
|
714
748
|
} | {
|
|
715
749
|
ok: false;
|
|
716
750
|
errors: string[];
|
|
717
751
|
issues: ValidationIssue[];
|
|
718
752
|
warnings?: string[];
|
|
753
|
+
reserved?: ReservedName[];
|
|
719
754
|
};
|
|
755
|
+
/** The value a `{path}` placeholder reads from state, in interpolation's lookup order: the path as written, else, for a
|
|
756
|
+
* `state.` path, the path after `state.` (so `{state.x}` reads a real `state` key first). undefined when neither
|
|
757
|
+
* resolves. Every placeholder the engine fills reads through it; a static check of what a step reads can too. */
|
|
758
|
+
export declare function placeholderValue(state: Record<string, unknown>, path: string): unknown;
|
|
759
|
+
/** The placeholders a state value's string holds, as interpolateValue fills them: a whole string is one, marked optional
|
|
760
|
+
* (`"{draft?}"`) or not; inside a longer string only unmarked ones are. For a host check of what a step reads. */
|
|
761
|
+
export declare function placeholdersOf(text: string): {
|
|
762
|
+
path: string;
|
|
763
|
+
optional: boolean;
|
|
764
|
+
}[];
|
|
720
765
|
export declare class EscalationSignal extends Error {
|
|
721
766
|
readonly escalation: Escalation;
|
|
722
767
|
constructor(escalation: Escalation);
|
|
@@ -788,9 +833,9 @@ export declare class WorkflowCodeError extends Error {
|
|
|
788
833
|
export declare class WorkflowStateError extends Error {
|
|
789
834
|
readonly stage: string;
|
|
790
835
|
readonly path: string;
|
|
791
|
-
readonly reason: "required_nonempty" | "missing_interpolation" | "expected_list" | "empty_selection" | "missing_map_result" | "parallel_write_conflict" | "reserved_state_key" | "route_missing" | "route_unknown" | "route_type";
|
|
836
|
+
readonly reason: "required_nonempty" | "missing_interpolation" | "expected_list" | "empty_selection" | "missing_map_result" | "map_too_large" | "parallel_write_conflict" | "reserved_state_key" | "route_missing" | "route_unknown" | "route_type";
|
|
792
837
|
readonly code = "state_invalid";
|
|
793
|
-
constructor(summary: string, stage: string, path: string, reason: "required_nonempty" | "missing_interpolation" | "expected_list" | "empty_selection" | "missing_map_result" | "parallel_write_conflict" | "reserved_state_key" | "route_missing" | "route_unknown" | "route_type");
|
|
838
|
+
constructor(summary: string, stage: string, path: string, reason: "required_nonempty" | "missing_interpolation" | "expected_list" | "empty_selection" | "missing_map_result" | "map_too_large" | "parallel_write_conflict" | "reserved_state_key" | "route_missing" | "route_unknown" | "route_type");
|
|
794
839
|
}
|
|
795
840
|
/** A map item that ended on its failure (`onItemFailure: "collect"`), as `failedAs` holds it: the item's index, the
|
|
796
841
|
* label of the node that failed, the failure's code and its message (at most 300 characters). `needs_review` marks an
|