@parcha/agentrun-dsl 0.1.0-beta.304 → 0.1.0-beta.305
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 +2 -0
- package/package.json +13 -1
package/README.md
CHANGED
|
@@ -188,6 +188,8 @@ The schema helpers resolve the owning workflow's schema catalog; `stageSchemaFor
|
|
|
188
188
|
|
|
189
189
|
`@parcha/agentrun-dsl/edit` edits a workflow document as JSON, one pure function per edit, for a visual editor, a CLI or a server. It imports only the graph and the node vocabulary, so a browser bundles it, and it names a node by its graph path. `insert(doc, parentPath, slot, index, node)`, `remove(doc, path)`, `move(doc, fromPath, toParentPath, slot, index)`, `duplicate(doc, path)`, `wrap(doc, paths, kind)` (in a map, loop, route, parallel or chain), `unwrap(doc, path, branch?)`, `addBranch(doc, path, node, name?)`, `removeBranch(doc, path, branch)`, `renameBranch(doc, path, from, to)`, `setField(doc, path, field, value)`, `rename(doc, path, name)` and `renameKey(doc, path, name, options?)` each return `{ doc, moved, added, removed, changed }`. `doc` is the next document: the input is never mutated, and every subtree the edit did not touch is shared with it, byte for byte. `moved` maps each node whose path changed, old path to new; `added` and `removed` list the nodes only one of the two documents has; `changed` lists the nodes whose own fields changed. A slot is where a child sits under its parent: `steps`, `branches`, `body`, `branches/<name>/body`, `workflow/root`, or `root` under the parent path `""`; `locate(doc, path)` says which one holds a node, and `move` counts its index in the document as given, the drop point between two steps. An edit that would break the document's structure (a report inside a map, a chain with no steps, a parallel with one branch, a node of no known kind or without a required field) throws an `EditError` with a `code` from `EDIT_ERROR_CODES` and the `path` it is about, and writes nothing. Whether each reference is produced and each field filled in is still `validateWorkflow`'s to say: `wrap` gives its new container placeholders the validator flags on it (an empty `itemsPath`, `valuePath` or `until` predicate). `rename` changes a label. When the label is the key the node writes (an agent, decide, extract or code node with no `as`; a code node writes there when its code returns something other than a record), every `{placeholder}` and state path that reads the key in scope follows it, and the code and shell sources that mention it, or one of its `<key>$...` keys, are listed in `mentions`, unchanged. A renamed code node's own code is listed too when it names the key, since a record it returns with that key still writes the old name. `renameKey` renames the key a node writes the same way: its `as` when it has one, any kind's, else its label when that is the key, where it gives the document `rename` gives; `{ field: "failedAs" }` renames a map's `failedAs` instead. No edit gives a label, an `as`, a `failedAs` or a route branch a name `Object.prototype` has (`constructor`, `toString`, `__proto__` and the rest) or `prototype`: `rename`, `renameKey`, `renameBranch` and `setField` refuse one, and `insert` and `addBranch` refuse a node with one anywhere inside it; `validateWorkflow` refuses a document written with one (`NODE_FIELD_INVALID`, saying to rename it). With `{ reservedNames: "warn" }`, the check a run makes of a document already stored (`runWorkflow` and `runWorkflowSlice` make it so), each such name is a warning instead, listed in the result's `reserved` (`{ path, field, name }`): the engine reads every label, key, branch and state path as an own key, so a stored document that has one runs as written, and a read of `constructor` that nothing wrote is unset. No edit gives a label a `/` either, since a run names a child workflow's steps `<child>/<step>` and a label `a/b` beside a child `a`'s step `b` would name two nodes: `rename`, `setField`, `insert` and `addBranch` refuse one, `duplicate` gives a copy of a stored one `_` for each `/` (`read/write` copies as `read_write_2`), and `validateWorkflow` refuses a document written with one, or warns of it under `reservedNames: "warn"` (listed in `reserved` as a `label`). A stored document whose `/` label does name a node twice is still refused where a run needs each name once (frozen recovery's duplicate-label check). `renameBranch` carries the route's `otherwise` and `unsure`, but not a value elsewhere that compares against the old branch name (a `field_equals` on the route's `as`, or the value a route by value reads), which the caller must change. `duplicate` copies code as it is, so a copied code node writes the same record keys as its source: duplicating a code branch of a parallel gives two branches that write one key, which the run refuses. The copy's reads of a copied code node's label follow its fresh label, so when that code returns a record naming the old label, those reads find nothing; `duplicate` lists the copy's code and shell sources that mention a key it renamed in `mentions`, as `rename` does. `editableFields(node)` and `requiredFields(node)` are the schema's fields for a node, as `setField` writes them.
|
|
190
190
|
|
|
191
|
+
Three more subpaths import no other package and none of Node's builtins, so an editor in a browser bundles them beside `./graph` and `./edit`. `@parcha/agentrun-dsl/vocabulary` is the closed vocabulary the validator admits: `WORKFLOW_NODE_KINDS`, the generative and judgment kinds, `NODE_FIELDS` per kind, and the enumerations a field takes (`EFFORT_LEVELS`, `THINKING_LEVELS`, `MODEL_TIERS`, `CALL_TRANSPORTS`, `AGENT_CONTEXTS`). `@parcha/agentrun-dsl/pointer-warning` is the text format of a warning about one part of a workflow: `formatPointerWarning(code, pointer, message)` writes it and `parsePointerWarning(text)` reads back `{ code, pointer, message }`, or `null` for any other text, so a canvas draws the warning on the node its JSON Pointer names. `@parcha/agentrun-dsl/system-one` holds the System One question and answer types and their pure functions: `compileQuestions(schema)` turns an output schema into the questions a judgment node asks, or lists why it can't, and `answersToValue(answers, questions)` reads the answers back as the node's value.
|
|
192
|
+
|
|
191
193
|
The same module answers what a property panel asks. `setBranchCriteria(doc, path, branch, criteria)` writes or removes (`undefined`) a judged route branch's criteria. `setSchema(doc, id, schema, scope?)` writes or removes a schema of the document, or of the child workflow of the workflow node at `scope`, and refuses to remove one that `schemaUsers(doc, id, scope?)` says is named: it lists the JSON Pointers of the workflow's `input.schemaId` and `output.schemaId`, each node's `out` and `verify.out`, and each `$ref` to `#/definitions/<id>` in another schema. `setWorkflowField(doc, field, value)` writes the document's own `input` or `output` (`{ schemaId }`, and the output's optional `path`), or removes the input (`undefined`); `outputNames(doc)` lists the names that `path` may read, as `namesInScope` lists a node's: the input keys and the keys written outside any map body or child workflow, a terminal's fixed key among them (`report_markdown` for a report or a prose artifact, `artifact` for a file artifact). Like `namesInScope`, it cannot list a key only a code node's returned record writes. `namesInScope(doc, path, field?)` lists the names the node at `path` may read, each `{ name, from }` with `from` the path of the node that writes it, `"input"` or `"engine"` (a map body's `item` and `item_index`), by the scope rules `rename` carries a key along; `field` asks for one field where it sees more (a map's `resultPath`, a loop's `until`, `verify`, a pick's or sift's `describe`, a workflow node's `workflow`). It cannot list a key only a code node's returned record writes, nor the keys of an input whose schema lists no properties. `readsOf(doc, path)` lists each `{placeholder}` and state path the node reads as `{ pointer, name }`, the references `rename` carries, and `openPlaceholderAt(text, offset)` finds the `{` open at a cursor and the name typed after it. `freshName(doc, base)` gives `base` or `<base>_<n>`, free in every scope (a child workflow's with no node yet included), and `placeholderNode(doc, kind)` the smallest node of a kind that holds no nodes, each required field holding its `FIELD_PLACEHOLDERS` value, which the validator flags until it is filled in.
|
|
192
194
|
|
|
193
195
|
The separate `@parcha/agentrun-dsl/demo` entrypoint provides the support-triage example. `@parcha/agentrun-dsl/schema` provides the generated workflow JSON Schema, a JSON file: import it with `import schema from '@parcha/agentrun-dsl/schema' with { type: 'json' };` (a plain `import` throws `ERR_IMPORT_ATTRIBUTE_MISSING`), or load it with `require('@parcha/agentrun-dsl/schema')` in CommonJS.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-dsl",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.305",
|
|
4
4
|
"description": "Composable, typed workflows for agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
"types": "./dist/edit.d.ts",
|
|
21
21
|
"import": "./dist/edit.js"
|
|
22
22
|
},
|
|
23
|
+
"./vocabulary": {
|
|
24
|
+
"types": "./dist/vocabulary.d.ts",
|
|
25
|
+
"import": "./dist/vocabulary.js"
|
|
26
|
+
},
|
|
27
|
+
"./pointer-warning": {
|
|
28
|
+
"types": "./dist/pointer-warning.d.ts",
|
|
29
|
+
"import": "./dist/pointer-warning.js"
|
|
30
|
+
},
|
|
31
|
+
"./system-one": {
|
|
32
|
+
"types": "./dist/system-one.d.ts",
|
|
33
|
+
"import": "./dist/system-one.js"
|
|
34
|
+
},
|
|
23
35
|
"./demo": {
|
|
24
36
|
"types": "./dist/demo.d.ts",
|
|
25
37
|
"import": "./dist/demo.js"
|