@parcha/agentrun-dsl 0.1.0-beta.210 → 0.1.0-beta.211
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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pointer-warning.d.ts +14 -0
- package/dist/pointer-warning.js +22 -0
- package/dist/recovery/driver.d.ts +1 -7
- package/dist/workflow.js +2 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export type { WorkflowInspection, WorkflowInspectionNode } from "./inspection.js
|
|
|
18
18
|
export { runWorkflowSlice, assertWorkflowCapabilities, desugarWorkflow, stageSchemaForNode, submissionSchemaForNode, mergeStageDelta, REPORT_SCHEMA, SHELL_RESULT_SCHEMA, childSteps, declaredWrites, artifactNodeIsProse, schemaProblems, HOST_STATE_KEY, normalizeStringNullsForSchema, placeholderValue, placeholdersOf, } from "./workflow.js";
|
|
19
19
|
export { compileTransform, compileTransformSyntax, deniedGlobalReferences, type TransformOutcome, transformScript } from "./code-exec.js";
|
|
20
20
|
export { resolveSchemaForWorkflow } from "./schema-references.js";
|
|
21
|
+
export { formatPointerWarning, parsePointerWarning, type PointerWarning } from "./pointer-warning.js";
|
|
21
22
|
export { patternRisk, PATTERN_SCREEN_LIMITS } from "./pattern-screen.js";
|
|
22
23
|
export { submitParameters } from "./submit-envelope.js";
|
|
23
24
|
export { getPath, predicateMatches } from "./predicates.js";
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ normalizeStringNullsForSchema,
|
|
|
16
16
|
placeholderValue, placeholdersOf, } from "./workflow.js";
|
|
17
17
|
export { compileTransform, compileTransformSyntax, deniedGlobalReferences, transformScript } from "./code-exec.js";
|
|
18
18
|
export { resolveSchemaForWorkflow } from "./schema-references.js";
|
|
19
|
+
export { formatPointerWarning, parsePointerWarning } from "./pointer-warning.js";
|
|
19
20
|
export { patternRisk, PATTERN_SCREEN_LIMITS } from "./pattern-screen.js";
|
|
20
21
|
export { submitParameters } from "./submit-envelope.js";
|
|
21
22
|
export { getPath, predicateMatches } from "./predicates.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A warning's parts: the validation code, the JSON Pointer (RFC 6901) of what it is about ("" for the document), and
|
|
2
|
+
* the message. */
|
|
3
|
+
export type PointerWarning = {
|
|
4
|
+
code: string;
|
|
5
|
+
pointer: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
/** `<code> at <pointer>: <message>`, or `<code>: <message>` for the pointer "". A route branch's name may hold ": ", and
|
|
9
|
+
* so may a pointer through it: in the text, the pointer's ":" is written `%3A` and its "%" `%25` (as a URI fragment
|
|
10
|
+
* writes them), so the first ":" after " at " ends the pointer. A pointer with neither reads as it is. */
|
|
11
|
+
export declare function formatPointerWarning(code: string, pointer: string, message: string): string;
|
|
12
|
+
/** The parts of a text `formatPointerWarning` wrote, its pointer as written in the workflow, or null for any other text
|
|
13
|
+
* (or a value that is not a string). */
|
|
14
|
+
export declare function parsePointerWarning(text: unknown): PointerWarning | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// A warning about one part of a workflow, as text: its code, the JSON Pointer of what it is about, and its words. The
|
|
2
|
+
// validator writes one when it checks references against keys it derived from the input schema (a finding that would be
|
|
3
|
+
// an error with the input given), and a reader (the console's canvas, say) reads the pointer back to draw the warning on
|
|
4
|
+
// its node. Both sides use this pair, so the format has one definition. This module imports nothing: a reader takes it
|
|
5
|
+
// without the validator.
|
|
6
|
+
/** `<code> at <pointer>: <message>`, or `<code>: <message>` for the pointer "". A route branch's name may hold ": ", and
|
|
7
|
+
* so may a pointer through it: in the text, the pointer's ":" is written `%3A` and its "%" `%25` (as a URI fragment
|
|
8
|
+
* writes them), so the first ":" after " at " ends the pointer. A pointer with neither reads as it is. */
|
|
9
|
+
export function formatPointerWarning(code, pointer, message) {
|
|
10
|
+
return `${code}${pointer ? ` at ${pointer.replace(/[%:]/g, (c) => (c === "%" ? "%25" : "%3A"))}` : ""}: ${message}`;
|
|
11
|
+
}
|
|
12
|
+
const POINTER_WARNING = /^([A-Z][A-Z0-9_]*)(?: at ([^:]+))?: ([\s\S]*)$/;
|
|
13
|
+
/** The parts of a text `formatPointerWarning` wrote, its pointer as written in the workflow, or null for any other text
|
|
14
|
+
* (or a value that is not a string). */
|
|
15
|
+
export function parsePointerWarning(text) {
|
|
16
|
+
if (typeof text !== "string")
|
|
17
|
+
return null;
|
|
18
|
+
const parts = POINTER_WARNING.exec(text);
|
|
19
|
+
if (!parts)
|
|
20
|
+
return null;
|
|
21
|
+
return { code: parts[1], pointer: (parts[2] ?? "").replace(/%(25|3A)/g, (_, hex) => (hex === "25" ? "%" : ":")), message: parts[3] };
|
|
22
|
+
}
|
|
@@ -116,13 +116,7 @@ export declare function openRecovery(store: RecoveryStore, workflow: Workflow, o
|
|
|
116
116
|
wait: (node: import("../workflow.js").CallNode, ms: number, item?: import("../workflow.js").MapItem, executionPath?: string) => Promise<void>;
|
|
117
117
|
fail?: (node: WorkflowNode, results: unknown[], error: unknown, executionPath?: string) => Promise<void>;
|
|
118
118
|
failItem?: (node: WorkflowNode, failure: import("../workflow.js").MapItemFailure, executionPath?: string) => Promise<void>;
|
|
119
|
-
itemFailure?: (node: WorkflowNode, executionPath
|
|
120
|
-
/** One write in the keyed layout: the driver's record without what lies in map items, the records of the items that
|
|
121
|
-
* changed, and the states first referenced now. `admitting` is an effect admitted in this write; `owner` the item that
|
|
122
|
-
* lists it. */
|
|
123
|
-
? /** One write in the keyed layout: the driver's record without what lies in map items, the records of the items that
|
|
124
|
-
* changed, and the states first referenced now. `admitting` is an effect admitted in this write; `owner` the item that
|
|
125
|
-
* lists it. */: string) => Promise<import("../workflow.js").MapItemFailure | undefined>;
|
|
119
|
+
itemFailure?: (node: WorkflowNode, executionPath?: string) => Promise<import("../workflow.js").MapItemFailure | undefined>;
|
|
126
120
|
decision?: (id: string) => Promise<import("../decision-receipts.js").DecisionReceipt | undefined>;
|
|
127
121
|
};
|
|
128
122
|
signal: AbortSignal;
|
package/dist/workflow.js
CHANGED
|
@@ -8,6 +8,7 @@ import { chargedCost, DecisionProviderError } from "./decision-provider.js";
|
|
|
8
8
|
import { DECISION_ERROR_MAX, DECISION_RECEIPT_VERSION, DECISION_INTERRUPTED, DECISION_REFUSED, DECISION_STATE_MAX_BYTES } from "./decision-receipts.js";
|
|
9
9
|
import { Compile } from "typebox/compile";
|
|
10
10
|
import { riskyPatterns } from "./pattern-screen.js";
|
|
11
|
+
import { formatPointerWarning } from "./pointer-warning.js";
|
|
11
12
|
import { compileTransform, compileTransformSyntax } from "./code-exec.js";
|
|
12
13
|
import { workflowShapeIssues } from "./workflow-shape.js";
|
|
13
14
|
import { resolveSchemaForWorkflow } from "./schema-references.js";
|
|
@@ -476,7 +477,7 @@ export function validateWorkflow(workflow, opts) {
|
|
|
476
477
|
/** A finding of the reachability checks: an error with the input keys given, a warning with derived ones. */
|
|
477
478
|
const unreached = (code, path, message) => {
|
|
478
479
|
if (derived)
|
|
479
|
-
derivedWarnings.push(
|
|
480
|
+
derivedWarnings.push(formatPointerWarning(code, path, message));
|
|
480
481
|
else
|
|
481
482
|
fail(code, path, message);
|
|
482
483
|
};
|