@parcha/agentrun-dsl 0.1.0-beta.29 → 0.1.0-beta.30
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.
|
@@ -9,6 +9,8 @@ export declare const DECISION_INTERRUPTED = "decision_interrupted";
|
|
|
9
9
|
/** The most of the state a receipt keeps, as UTF-8 JSON bytes: a larger state is kept as the first this many bytes of its
|
|
10
10
|
* JSON text, with `state_truncated: true`. */
|
|
11
11
|
export declare const DECISION_STATE_MAX_BYTES: number;
|
|
12
|
+
/** The most of a request's error a receipt keeps, in characters; a longer one is kept to it with `error_truncated`. */
|
|
13
|
+
export declare const DECISION_ERROR_MAX: number;
|
|
12
14
|
/** An image a request carried, as its receipt names it: the token the request used, the reference the host loaded, and
|
|
13
15
|
* the image's SHA-256, type and size (never the bytes). The digest fields are null when the image was never loaded (a
|
|
14
16
|
* request that failed before its images were read). */
|
|
@@ -131,7 +133,10 @@ export type DecisionReceipt = {
|
|
|
131
133
|
* its JSON text (a string) with `state_truncated: true`. Absent on a receipt recorded before it was kept. */
|
|
132
134
|
state?: unknown;
|
|
133
135
|
state_truncated?: boolean;
|
|
136
|
+
/** The request's error, whole up to `DECISION_ERROR_MAX` characters: a host redacts it before it cuts it for a person.
|
|
137
|
+
* A longer one is kept to that many with `error_truncated: true`; one recorded before was cut at 2000. */
|
|
134
138
|
error?: string;
|
|
139
|
+
error_truncated?: boolean;
|
|
135
140
|
};
|
|
136
141
|
/** The action a receipt's answers and rule determine, recomputed without a model call: for an answered
|
|
137
142
|
* receipt it equals `receipt.action`. Null for a receipt that decided nothing. */
|
|
@@ -8,6 +8,8 @@ export const DECISION_INTERRUPTED = "decision_interrupted";
|
|
|
8
8
|
/** The most of the state a receipt keeps, as UTF-8 JSON bytes: a larger state is kept as the first this many bytes of its
|
|
9
9
|
* JSON text, with `state_truncated: true`. */
|
|
10
10
|
export const DECISION_STATE_MAX_BYTES = 64 * 1024;
|
|
11
|
+
/** The most of a request's error a receipt keeps, in characters; a longer one is kept to it with `error_truncated`. */
|
|
12
|
+
export const DECISION_ERROR_MAX = 64 * 1024;
|
|
11
13
|
/** The action a receipt's answers and rule determine, recomputed without a model call: for an answered
|
|
12
14
|
* receipt it equals `receipt.action`. Null for a receipt that decided nothing. */
|
|
13
15
|
export function rederiveDecision(receipt) {
|
package/dist/workflow.js
CHANGED
|
@@ -5,7 +5,7 @@ import { predicateMatches, getPath, MECHANICAL_PREDICATE_NAMES } from "./predica
|
|
|
5
5
|
import { DECISION_NODE_FIELDS, DECISION_TIMEOUT_MAX_MS, WORKFLOW_NODE_KINDS, NODE_FIELDS, HOST_NODE_FIELDS, IGNORED_NODE_FIELDS, WORKFLOW_PREDICATES, FIELD_TYPES, THINKING_LEVELS, MODEL_TIERS, AGENT_CONTEXTS, CALL_TRANSPORTS, CALL_RETRY_CLASSES, EFFECT_FAILURE_CODES, PROSE_ARTIFACT_TYPES } from "./vocabulary.js";
|
|
6
6
|
import { validateAnswers, answerConfidence, answersSidecar, answersToValue, compileQuestions, refusedQuestions, SYSTEM_ONE_LIMITS } from "./system-one.js";
|
|
7
7
|
import { chargedCost, DecisionProviderError } from "./decision-provider.js";
|
|
8
|
-
import { DECISION_RECEIPT_VERSION, DECISION_INTERRUPTED, DECISION_REFUSED, DECISION_STATE_MAX_BYTES } from "./decision-receipts.js";
|
|
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 { compileTransform, compileTransformSyntax } from "./code-exec.js";
|
|
11
11
|
import { workflowShapeIssues } from "./workflow-shape.js";
|
|
@@ -13,6 +13,9 @@ import { resolveSchemaForWorkflow } from "./schema-references.js";
|
|
|
13
13
|
export { resolveSchemaForWorkflow } from "./schema-references.js";
|
|
14
14
|
import { setLongTimeout } from "./long-timer.js";
|
|
15
15
|
import { isRecoveryError } from "./recovery/errors.js";
|
|
16
|
+
/** A request's error as its receipt keeps it: whole up to DECISION_ERROR_MAX characters, a longer one cut there and
|
|
17
|
+
* marked, so a host redacts it before it cuts it and holds a cut one's tail back (decision-receipts.ts). */
|
|
18
|
+
const errorOfReceipt = (text) => text.length > DECISION_ERROR_MAX ? { error: text.slice(0, DECISION_ERROR_MAX), error_truncated: true } : { error: text };
|
|
16
19
|
export const routesByValue = (node) => typeof node.valuePath === "string";
|
|
17
20
|
export function artifactNodeIsProse(node) {
|
|
18
21
|
return PROSE_ARTIFACT_TYPES.includes(node.type);
|
|
@@ -2287,7 +2290,7 @@ async function decide(deps, ask, settle) {
|
|
|
2287
2290
|
...(evidenceOf(result) ? { evidence: evidenceOf(result) } : {}),
|
|
2288
2291
|
...(images ? { images: imagesOf(result) } : {}),
|
|
2289
2292
|
state: seen.state, state_truncated: seen.truncated,
|
|
2290
|
-
...(outcome.error !== undefined ?
|
|
2293
|
+
...(outcome.error !== undefined ? errorOfReceipt(String(outcome.error instanceof EscalationSignal ? outcome.error.escalation.summary : outcome.error?.message || outcome.error)) : {}),
|
|
2291
2294
|
};
|
|
2292
2295
|
};
|
|
2293
2296
|
/** Records `made`; with `failure`, the request's own failure, a recorder that also fails surfaces both. */
|