@parcha/agentrun-dsl 0.1.0-beta.2 → 0.1.0-beta.200
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 +172 -22
- package/dist/author-references.d.ts +8 -0
- package/dist/author-references.js +8 -0
- package/dist/author.d.ts +97 -0
- package/dist/author.js +329 -0
- package/dist/authoring.js +5 -4
- package/dist/cli.js +19 -13
- package/dist/code-exec.d.ts +25 -0
- package/dist/code-exec.js +180 -5
- package/dist/decision-provider.d.ts +166 -0
- package/dist/decision-provider.js +238 -0
- package/dist/decision-receipts.d.ts +159 -0
- package/dist/decision-receipts.js +93 -0
- package/dist/dry-run.d.ts +45 -2
- package/dist/dry-run.js +159 -27
- package/dist/edit.d.ts +149 -0
- package/dist/edit.js +1415 -0
- package/dist/evidence.d.ts +19 -0
- package/dist/evidence.js +63 -0
- package/dist/graph.d.ts +169 -0
- package/dist/graph.js +433 -0
- package/dist/index.d.ts +20 -7
- package/dist/index.js +17 -7
- package/dist/inspection.d.ts +5 -0
- package/dist/inspection.js +16 -3
- package/dist/job.d.ts +14 -0
- package/dist/job.js +5 -0
- package/dist/long-timer.d.ts +7 -0
- package/dist/long-timer.js +22 -0
- package/dist/observer-snapshot.d.ts +3 -0
- package/dist/observer-snapshot.js +46 -0
- package/dist/pattern-screen.d.ts +14 -0
- package/dist/pattern-screen.js +451 -0
- package/dist/predicates.d.ts +33 -0
- package/dist/predicates.js +81 -5
- package/dist/record.d.ts +4 -0
- package/dist/record.js +6 -0
- package/dist/recovery/binding.d.ts +10 -0
- package/dist/recovery/binding.js +44 -0
- package/dist/recovery/call-key.d.ts +9 -0
- package/dist/recovery/call-key.js +17 -0
- package/dist/recovery/canonical-hash.d.ts +7 -0
- package/dist/recovery/canonical-hash.js +22 -0
- package/dist/recovery/driver.d.ts +245 -0
- package/dist/recovery/driver.js +1347 -0
- package/dist/recovery/errors.d.ts +31 -0
- package/dist/recovery/errors.js +51 -0
- package/dist/recovery/execution-path.d.ts +53 -0
- package/dist/recovery/execution-path.js +167 -0
- package/dist/recovery/file-store.d.ts +7 -0
- package/dist/recovery/file-store.js +131 -0
- package/dist/recovery/frozen-snapshot.d.ts +274 -0
- package/dist/recovery/frozen-snapshot.js +187 -0
- package/dist/recovery/handoff-receipts.d.ts +7 -0
- package/dist/recovery/handoff-receipts.js +11 -0
- package/dist/recovery/index.d.ts +14 -0
- package/dist/recovery/index.js +13 -0
- package/dist/recovery/item-state.d.ts +48 -0
- package/dist/recovery/item-state.js +89 -0
- package/dist/recovery/journal.d.ts +28 -0
- package/dist/recovery/journal.js +139 -0
- package/dist/recovery/memory-store.d.ts +4 -0
- package/dist/recovery/memory-store.js +20 -0
- package/dist/recovery/store.d.ts +105 -0
- package/dist/recovery/store.js +6 -0
- package/dist/recovery/testing/conformance.d.ts +4 -0
- package/dist/recovery/testing/conformance.js +268 -0
- package/dist/recovery/testing/crash-points.d.ts +18 -0
- package/dist/recovery/testing/crash-points.js +43 -0
- package/dist/recovery/testing/crash-sweep.d.ts +65 -0
- package/dist/recovery/testing/crash-sweep.js +146 -0
- package/dist/recovery/testing/index.d.ts +3 -0
- package/dist/recovery/testing/index.js +4 -0
- package/dist/recovery/testing/preload.d.ts +1 -0
- package/dist/recovery/testing/preload.js +3 -0
- package/dist/recovery/transport-facts.d.ts +23 -0
- package/dist/recovery/transport-facts.js +46 -0
- package/dist/recovery/with-recovery.d.ts +50 -0
- package/dist/recovery/with-recovery.js +144 -0
- package/dist/submit-envelope.d.ts +9 -0
- package/dist/submit-envelope.js +44 -0
- package/dist/system-one.d.ts +37 -2
- package/dist/system-one.js +146 -11
- package/dist/testing/decision-provider.d.ts +32 -0
- package/dist/testing/decision-provider.js +183 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/vocabulary.d.ts +50 -0
- package/dist/vocabulary.js +84 -0
- package/dist/workflow-shape.d.ts +7 -0
- package/dist/workflow-shape.js +119 -69
- package/dist/workflow.d.ts +309 -29
- package/dist/workflow.js +1664 -487
- package/dist/zod-json-contract.js +6 -8
- package/package.json +33 -5
- package/schema/workflow.schema.json +599 -12
- package/skills/author/SKILL.md +125 -0
- package/skills/author/examples/evidence-gate.input.json +6 -0
- package/skills/author/examples/evidence-gate.json +125 -0
- package/skills/author/examples/read-file.input.json +1 -0
- package/skills/author/examples/read-file.json +44 -0
- package/skills/author/examples/read-source-decision.input.json +4 -0
- package/skills/author/examples/read-source-decision.json +37 -0
- package/skills/author/examples/release-note.txt +10 -0
- package/skills/author/examples/review-release-notes.input.json +6 -0
- package/skills/author/examples/review-release-notes.json +123 -0
- package/skills/author/references/jev-decisions.md +170 -0
- package/skills/author/references/language.md +123 -0
- package/skills/author/references/sdk-authoring.md +11 -0
- package/skills/author/references/workflow-format.md +137 -0
package/dist/edit.d.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/** A workflow document as JSON: an object whose `root` is a node. */
|
|
2
|
+
export type WorkflowDocument = Record<string, unknown>;
|
|
3
|
+
/** A node as JSON: an object whose `node` is its kind. */
|
|
4
|
+
export type WorkflowNodeJson = Record<string, unknown>;
|
|
5
|
+
/** Where a child sits under its parent node: the pointer segments from the parent to it. A chain's `steps` and a
|
|
6
|
+
* parallel's `branches` hold many, by index; a map's or a loop's `body`, a route branch's `branches/<name>/body` (the
|
|
7
|
+
* name pointer-escaped, as in a graph path) and a child workflow's `workflow/root` hold one. The document holds its
|
|
8
|
+
* root at `root`, under the parent path `""`. */
|
|
9
|
+
export type Slot = "root" | "steps" | "branches" | "body" | "workflow/root" | `branches/${string}/body`;
|
|
10
|
+
/** What an operation returns: the next document and what happened to the nodes of the one it was given. */
|
|
11
|
+
export type EditResult = {
|
|
12
|
+
doc: WorkflowDocument;
|
|
13
|
+
/** Each node whose path changed, from its path before to its path after, in the input's document order. */
|
|
14
|
+
moved: Map<string, string>;
|
|
15
|
+
/** The paths, in the result, of the nodes the input did not have. */
|
|
16
|
+
added: string[];
|
|
17
|
+
/** The paths, in the input, of the nodes the result does not have. */
|
|
18
|
+
removed: string[];
|
|
19
|
+
/** The paths, in the result, of the nodes that were kept with their own fields changed. */
|
|
20
|
+
changed: string[];
|
|
21
|
+
};
|
|
22
|
+
/** What rename returns: an EditResult, and the code and shell sources in scope that mention the old key. */
|
|
23
|
+
export type RenameResult = EditResult & {
|
|
24
|
+
mentions: string[];
|
|
25
|
+
};
|
|
26
|
+
/** What duplicate returns: an EditResult, and the paths, in the result, of the copy's code and shell sources that
|
|
27
|
+
* mention a key the copy writes under a fresh name, by its old name. */
|
|
28
|
+
export type DuplicateResult = EditResult & {
|
|
29
|
+
mentions: string[];
|
|
30
|
+
};
|
|
31
|
+
/** Every code an EditError carries. */
|
|
32
|
+
export declare const EDIT_ERROR_CODES: readonly ["DOCUMENT_INVALID", "PATH_NOT_FOUND", "SLOT_INVALID", "INDEX_OUT_OF_RANGE", "NODE_INVALID", "FIELD_INVALID", "NAME_INVALID", "NAME_TAKEN", "NAME_SHARED", "BRANCH_NOT_FOUND", "BRANCH_TAKEN", "BRANCH_IN_USE", "MOVE_INTO_SELF", "WRAP_INVALID", "UNWRAP_INVALID", "STRUCTURE_INVALID", "SCHEMA_NOT_FOUND", "SCHEMA_IN_USE", "SCHEMA_INVALID"];
|
|
33
|
+
export type EditErrorCode = typeof EDIT_ERROR_CODES[number];
|
|
34
|
+
/** The one error the operations throw. `path` is the node it is about, in the input document where that node existed
|
|
35
|
+
* there; `related` names other nodes the error is about: the one holding a taken name, the other writers of a key. */
|
|
36
|
+
export declare class EditError extends Error {
|
|
37
|
+
readonly code: EditErrorCode;
|
|
38
|
+
readonly path: string;
|
|
39
|
+
readonly related: readonly string[];
|
|
40
|
+
constructor(code: EditErrorCode, path: string, message: string, related?: readonly string[]);
|
|
41
|
+
}
|
|
42
|
+
/** The placeholder a required field takes in a new node: a value insert accepts and the validator flags until someone
|
|
43
|
+
* fills it in (an empty text, an empty state map, a predicate with no name, a deadline of 0 seconds), or, for a loop's
|
|
44
|
+
* `maxIters`, the smallest bound. placeholderNode and wrap fill fields from it. */
|
|
45
|
+
export declare const FIELD_PLACEHOLDERS: Readonly<Record<string, unknown>>;
|
|
46
|
+
/** The fields setField writes on this node: its kind's (and its route form's) own fields, without `node` and the child
|
|
47
|
+
* slots. A property panel lists these. */
|
|
48
|
+
export declare function editableFields(node: WorkflowNodeJson): string[];
|
|
49
|
+
/** The fields the schema requires of this node's kind (and its route form), `node` included. */
|
|
50
|
+
export declare function requiredFields(node: WorkflowNodeJson): string[];
|
|
51
|
+
/** Where the node at `path` sits: its parent's path, the slot it is in, and its index there (0 in a slot that holds one
|
|
52
|
+
* node). Undefined when no node sits there. */
|
|
53
|
+
export declare function locate(doc: WorkflowDocument, path: string): {
|
|
54
|
+
parentPath: string;
|
|
55
|
+
slot: Slot;
|
|
56
|
+
index: number;
|
|
57
|
+
} | undefined;
|
|
58
|
+
/** Put `node` (copied) into `slot` of the node at `parentPath`, at `index`. In a chain's steps or a parallel's branches
|
|
59
|
+
* the index is a position, 0 to the count. A slot that holds one node takes index 0 when empty; when it holds a node,
|
|
60
|
+
* 0 puts the new one first and 1 puts it last, in a new chain of the two. */
|
|
61
|
+
export declare function insert(doc: WorkflowDocument, parentPath: string, slot: Slot, index: number, node: WorkflowNodeJson): EditResult;
|
|
62
|
+
/** Take out the node at `path`, and everything inside it. */
|
|
63
|
+
export declare function remove(doc: WorkflowDocument, path: string): EditResult;
|
|
64
|
+
/** Move the node at `fromPath` into `slot` of the node at `toParentPath`, at `index`, counted in the document as given:
|
|
65
|
+
* the drop point a canvas shows. A node never moves inside itself. */
|
|
66
|
+
export declare function move(doc: WorkflowDocument, fromPath: string, toParentPath: string, slot: Slot, index: number): EditResult;
|
|
67
|
+
/** Put a copy of the node at `path` right after it: the next step or branch, or, in a slot that holds one node, the
|
|
68
|
+
* second step of a new chain. Every node of the copy gets a fresh label, every key it writes a fresh name, and its own
|
|
69
|
+
* references follow its keys; the copy's code and shell sources that mention an old key are listed in `mentions`. */
|
|
70
|
+
export declare function duplicate(doc: WorkflowDocument, path: string): DuplicateResult;
|
|
71
|
+
/** The containers wrap makes. */
|
|
72
|
+
export type WrapKind = "map" | "loop" | "route" | "parallel" | "chain";
|
|
73
|
+
/** Put the nodes at `paths` (one node, or consecutive steps or branches of one container, in any order) into a new
|
|
74
|
+
* container of `kind`, where the first of them was. A map's, loop's or route's body is the one node or a chain of
|
|
75
|
+
* them; a parallel takes each as a branch. The new container's fields are placeholders the validator flags. */
|
|
76
|
+
export declare function wrap(doc: WorkflowDocument, paths: readonly string[], kind: WrapKind): EditResult;
|
|
77
|
+
/** Put the children of the container at `path` where it was: a chain's steps or a parallel's branches, the body of a
|
|
78
|
+
* map or a loop, or the body of the route branch `branch` names. Into a chain they are spliced; a parallel's branches
|
|
79
|
+
* join an enclosing parallel; a slot that holds one node takes one child, or a chain of a parallel's branches. */
|
|
80
|
+
export declare function unwrap(doc: WorkflowDocument, path: string, branch?: string): EditResult;
|
|
81
|
+
/** Add a branch to the parallel or route at `path`: `node` (copied) last among a parallel's branches, or as the body of
|
|
82
|
+
* a new route branch `name`, after the others. */
|
|
83
|
+
export declare function addBranch(doc: WorkflowDocument, path: string, node: WorkflowNodeJson, name?: string): EditResult;
|
|
84
|
+
/** Take out a branch of the parallel or route at `path`: a parallel's by its index, a route's by its name. */
|
|
85
|
+
export declare function removeBranch(doc: WorkflowDocument, path: string, branch: string | number): EditResult;
|
|
86
|
+
/** Rename branch `from` of the route at `path` to `to`, in its place among the others; `otherwise` and `unsure` follow. */
|
|
87
|
+
export declare function renameBranch(doc: WorkflowDocument, path: string, from: string, to: string): EditResult;
|
|
88
|
+
/** Write `value` (copied) at the field of the node at `path`, in its place; `undefined` removes an optional field. */
|
|
89
|
+
export declare function setField(doc: WorkflowDocument, path: string, field: string, value: unknown): EditResult;
|
|
90
|
+
/** Rename the label of the node at `path`. When the label is the key the node writes (an agent, decide, extract or code
|
|
91
|
+
* node with no `as`), every reference in scope follows it, and the code and shell sources in scope that mention the old
|
|
92
|
+
* key are listed in `mentions`, unchanged: a code node's own code included, when it names the key. */
|
|
93
|
+
export declare function rename(doc: WorkflowDocument, path: string, name: string): RenameResult;
|
|
94
|
+
/** Which key renameKey renames: the node's `as` (the default), or a map's `failedAs`. */
|
|
95
|
+
export type RenameKeyOptions = {
|
|
96
|
+
field?: "as" | "failedAs";
|
|
97
|
+
};
|
|
98
|
+
/** Rename the state key the node at `path` writes: its `as` when it has one, else its label when the label is the key
|
|
99
|
+
* (an agent, decide, extract or code node with no `as`, where this is `rename`); or, with `field: "failedAs"`, the key a
|
|
100
|
+
* map writes its failed items under. Every reference in scope follows it, `<key>$answers` and `<key>$verify` included,
|
|
101
|
+
* and the code and shell sources in scope that mention the old key are listed in `mentions`, unchanged. */
|
|
102
|
+
export declare function renameKey(doc: WorkflowDocument, path: string, name: string, options?: RenameKeyOptions): RenameResult;
|
|
103
|
+
/** Write `criteria`, the text Jev reads to choose it, on branch `branch` of the judged route at `path`, in its place;
|
|
104
|
+
* `undefined` removes it. A route by value matches its branches by name and takes no criteria. */
|
|
105
|
+
export declare function setBranchCriteria(doc: WorkflowDocument, path: string, branch: string, criteria: string | undefined): EditResult;
|
|
106
|
+
/** The JSON Pointers of the values that name schema `id` of a scope ("" for the document, or a workflow node's path
|
|
107
|
+
* for its child's schemas): the workflow's `input.schemaId` and `output.schemaId`, a `$ref` from another of its
|
|
108
|
+
* schemas, and the `out` and `verify.out` of its nodes (a workflow node's `out` names its parent's schema). */
|
|
109
|
+
export declare function schemaUsers(doc: WorkflowDocument, id: string, scope?: string): string[];
|
|
110
|
+
/** Write `schema` (copied) as schema `id` of a scope ("" for the document, or a workflow node's path for its child), in
|
|
111
|
+
* its place when it exists; `undefined` removes it, unless something still names it (`schemaUsers`). */
|
|
112
|
+
export declare function setSchema(doc: WorkflowDocument, id: string, schema: Record<string, unknown> | undefined, scope?: string): EditResult;
|
|
113
|
+
/** A name a node may read, and what gives it: the path of the node that writes it, "input" (the workflow's input, or a
|
|
114
|
+
* child's), or "engine" (a map body's `item` and `item_index`). */
|
|
115
|
+
export type NameInScope = {
|
|
116
|
+
name: string;
|
|
117
|
+
from: string;
|
|
118
|
+
};
|
|
119
|
+
/** The names the node at `path` may read, each with what gives it, by the scope rules rename carries a key along: its
|
|
120
|
+
* workflow's input keys, a map body's `item` and `item_index`, and the keys (with their `<key>$answers` and
|
|
121
|
+
* `<key>$verify`) of each node whose write it runs after and sees. With `field`, the names that one field of the node
|
|
122
|
+
* reads, where it sees more than the rest: a map's `resultPath` its body's keys and item, a loop's `until` its body's
|
|
123
|
+
* keys, `verify` the node's own `as` and `submission`, a pick's or sift's `describe` its own `item` and `item_index`,
|
|
124
|
+
* and a workflow node's `workflow` (its child's `output.path`) the child's state. */
|
|
125
|
+
export declare function namesInScope(doc: WorkflowDocument, path: string, field?: string): NameInScope[];
|
|
126
|
+
/** A reference a node makes: the JSON Pointer of the value it sits in, the name it reads (the head of its path), and
|
|
127
|
+
* `optional` for a whole-string placeholder marked `?` (`"{plan?}"`), which the engine fills with null while unset. */
|
|
128
|
+
export type NodeRead = {
|
|
129
|
+
pointer: string;
|
|
130
|
+
name: string;
|
|
131
|
+
optional?: true;
|
|
132
|
+
};
|
|
133
|
+
/** Each `{placeholder}` and state path the node at `path` reads, in its fields' order: the references rename carries,
|
|
134
|
+
* found by the same walk. A workflow node's include its child's `output.path`, which reads the child's state. */
|
|
135
|
+
export declare function readsOf(doc: WorkflowDocument, path: string): NodeRead[];
|
|
136
|
+
/** The `{placeholder` open at `offset` in `text`: the index of its `{` and the name typed after it up to the cursor, by
|
|
137
|
+
* the placeholder grammar (letters, digits, "_", "." and "$"; a reference may start with `state.`). Undefined when no
|
|
138
|
+
* placeholder's name holds the cursor. The placeholder may already be closed after it. */
|
|
139
|
+
export declare function openPlaceholderAt(text: string, offset: number): {
|
|
140
|
+
start: number;
|
|
141
|
+
prefix: string;
|
|
142
|
+
} | undefined;
|
|
143
|
+
/** `base`, or its stem (`base` without a `_<n>` ending) with the smallest `_<n>` from 2, so that no label, key,
|
|
144
|
+
* reference, input key or word of code of any scope of the document holds it, nor an engine key or a name
|
|
145
|
+
* `Object.prototype` has. `base` is a state key name. */
|
|
146
|
+
export declare function freshName(doc: WorkflowDocument, base: string): string;
|
|
147
|
+
/** The smallest node of `kind` for `doc`: its required fields in the schema's order, a fresh name as its label (and its
|
|
148
|
+
* `as`, where it needs one), and each other field's placeholder. A container is made by wrapping nodes that exist. */
|
|
149
|
+
export declare function placeholderNode(doc: WorkflowDocument, kind: string): WorkflowNodeJson;
|