@boardwalk-labs/runner 0.2.8 → 0.2.10
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.
|
@@ -112,6 +112,24 @@ function errorHint(err) {
|
|
|
112
112
|
const hint = err.hint;
|
|
113
113
|
return typeof hint === "string" && hint !== "" ? hint : undefined;
|
|
114
114
|
}
|
|
115
|
+
/** A machine-readable error code shaped like one: SCREAMING_SNAKE, as an engine `EngineError.code`
|
|
116
|
+
* (`VALIDATION`, `PROVIDER_ERROR`, …) and a Node syscall error (`ENOENT`) both are. */
|
|
117
|
+
const ERROR_CODE_RE = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
118
|
+
/**
|
|
119
|
+
* The SEMANTIC code of a thrown error, preferred over its class name. An engine `EngineError` carries
|
|
120
|
+
* `code: "VALIDATION"`; reporting `err.name` instead surfaced the useless `"EngineError"` on every
|
|
121
|
+
* hosted failure (and `"Error"` for anything else). Duck-typed for the same reason as {@link errorHint}.
|
|
122
|
+
*
|
|
123
|
+
* Two guards, because a thrown value is author-controlled: the SCREAMING_SNAKE shape keeps prose (or a
|
|
124
|
+
* stray object field) out of a field the UI renders as a code, and the CALLER redacts the result — an
|
|
125
|
+
* uppercase-alnum secret would satisfy the pattern, so the shape check is hygiene, not the boundary.
|
|
126
|
+
*/
|
|
127
|
+
function errorCode(err) {
|
|
128
|
+
if (typeof err !== "object" || err === null)
|
|
129
|
+
return undefined;
|
|
130
|
+
const code = err.code;
|
|
131
|
+
return typeof code === "string" && ERROR_CODE_RE.test(code) ? code : undefined;
|
|
132
|
+
}
|
|
115
133
|
/**
|
|
116
134
|
* Run a workflow program to completion. Installs the host + input, extracts the VERIFIED artifact +
|
|
117
135
|
* dynamic-imports its entry (which runs the body), and returns the terminal result. Always tears the
|
|
@@ -153,13 +171,20 @@ export async function runWorkflowProgram(args, deps) {
|
|
|
153
171
|
// the same untrusted inputs as the message and could echo a resolved secret.
|
|
154
172
|
const rawHint = errorHint(err);
|
|
155
173
|
const hint = rawHint === undefined ? undefined : redactText(rawHint);
|
|
174
|
+
// The error's own code when it has one ("VALIDATION"), else the class name ("Error"). Redacted
|
|
175
|
+
// like the rest: it is read off an author-controlled throw, not trusted to be a literal.
|
|
176
|
+
const rawCode = errorCode(err);
|
|
177
|
+
const code = rawCode !== undefined
|
|
178
|
+
? redactText(rawCode)
|
|
179
|
+
: err instanceof Error
|
|
180
|
+
? err.name
|
|
181
|
+
: "PROGRAM_ERROR";
|
|
156
182
|
log.error("program_failed", { runId: args.runId, error: message });
|
|
157
183
|
return {
|
|
158
184
|
kind: "failed",
|
|
159
185
|
output: null,
|
|
160
186
|
error: {
|
|
161
|
-
|
|
162
|
-
code: err instanceof Error ? err.name : "PROGRAM_ERROR",
|
|
187
|
+
code,
|
|
163
188
|
message,
|
|
164
189
|
...(hint === undefined ? {} : { hint }),
|
|
165
190
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boardwalk-labs/runner",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "Boardwalk self-hosted runner: execute cloud-scheduled runs on your own machines. Currently: the canonical runner contract types.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"prebuild": "prebuildify --napi --strip -t 24.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@boardwalk-labs/engine": "0.2.
|
|
56
|
+
"@boardwalk-labs/engine": "0.2.8",
|
|
57
57
|
"@boardwalk-labs/workflow": "0.2.2",
|
|
58
58
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
59
59
|
"node-gyp-build": "^4.8.4",
|