@themoltnet/agent-daemon 0.29.5 → 0.29.6
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/main.js +36 -0
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -10048,6 +10048,7 @@ var NON_RETRYABLE_CODES = new Set([
|
|
|
10048
10048
|
"bad_api_key",
|
|
10049
10049
|
"invalid_api_key",
|
|
10050
10050
|
"invalid_model",
|
|
10051
|
+
"max_turns_exceeded",
|
|
10051
10052
|
"output_rejected_by_server",
|
|
10052
10053
|
"output_validation_failed",
|
|
10053
10054
|
"submit_output_missing",
|
|
@@ -10080,6 +10081,7 @@ var NON_RETRYABLE_MESSAGE_PATTERNS = [
|
|
|
10080
10081
|
/\binvalid (?:api )?key\b/i,
|
|
10081
10082
|
/\bmissing credentials?\b/i,
|
|
10082
10083
|
/\bmodel .*not (?:found|registered|available)\b/i,
|
|
10084
|
+
/\bpath escapes workspace\b/i,
|
|
10083
10085
|
/\bunknown task type\b/i,
|
|
10084
10086
|
/\bvalidation failed\b/i,
|
|
10085
10087
|
/\bcancelled\b/i,
|
|
@@ -10246,6 +10248,20 @@ async function finalizeTask(agent, output, ctx = {}) {
|
|
|
10246
10248
|
...daemonState ? { daemonState } : {}
|
|
10247
10249
|
});
|
|
10248
10250
|
} catch (err) {
|
|
10251
|
+
if (isCompleteWorkflowResultTimeout(err)) {
|
|
10252
|
+
const settled = await getSettledTaskAfterCompleteTimeout(agent, output.taskId, ctx);
|
|
10253
|
+
if (settled?.status === "completed") {
|
|
10254
|
+
await maybeWriteAnchors(output, ctx);
|
|
10255
|
+
return;
|
|
10256
|
+
}
|
|
10257
|
+
ctx.log?.("complete-result-timeout-without-fail-fallback", {
|
|
10258
|
+
err,
|
|
10259
|
+
taskId: output.taskId,
|
|
10260
|
+
attemptN: output.attemptN,
|
|
10261
|
+
...settled?.status ? { status: settled.status } : {}
|
|
10262
|
+
});
|
|
10263
|
+
throw err;
|
|
10264
|
+
}
|
|
10249
10265
|
const classified = await prepareAttemptFailure(agent, output, errorToFailReason(err), ctx);
|
|
10250
10266
|
ctx.log?.("complete-rejected-falling-back-to-fail", { err });
|
|
10251
10267
|
ctx.log?.("attempt-failure-classified", classificationLogFields(classified, {
|
|
@@ -10273,6 +10289,26 @@ async function finalizeTask(agent, output, ctx = {}) {
|
|
|
10273
10289
|
}));
|
|
10274
10290
|
await agent.tasks.failAttempt(output.taskId, output.attemptN, { error: classified.error });
|
|
10275
10291
|
}
|
|
10292
|
+
function isCompleteWorkflowResultTimeout(err) {
|
|
10293
|
+
if (!(err instanceof MoltNetError)) return false;
|
|
10294
|
+
const detail = err.detail ?? err.message;
|
|
10295
|
+
return err.statusCode === 409 && typeof detail === "string" && detail.includes("Complete workflow timed out waiting for result");
|
|
10296
|
+
}
|
|
10297
|
+
async function getSettledTaskAfterCompleteTimeout(agent, taskId, ctx) {
|
|
10298
|
+
try {
|
|
10299
|
+
const task = await agent.tasks.get(taskId);
|
|
10300
|
+
return isTerminalTaskStatus(task.status) ? task : null;
|
|
10301
|
+
} catch (err) {
|
|
10302
|
+
ctx.log?.("complete-result-timeout-state-fetch-failed", {
|
|
10303
|
+
err,
|
|
10304
|
+
taskId
|
|
10305
|
+
});
|
|
10306
|
+
return null;
|
|
10307
|
+
}
|
|
10308
|
+
}
|
|
10309
|
+
function isTerminalTaskStatus(status) {
|
|
10310
|
+
return status === "completed" || status === "failed" || status === "cancelled" || status === "expired";
|
|
10311
|
+
}
|
|
10276
10312
|
function errorToFailReason(err) {
|
|
10277
10313
|
if (err instanceof MoltNetError) {
|
|
10278
10314
|
if (err.code !== "VALIDATION_FAILED" && err.statusCode !== 400) return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/agent-daemon",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.6",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "MoltNet agent daemon — claims and executes tasks (fulfill_brief, assess_brief) from the MoltNet task-service via Pi-headless. CLI: moltnet-agent.",
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"pino": "^10.3.1",
|
|
53
53
|
"pino-pretty": "^13.1.3",
|
|
54
54
|
"@themoltnet/agent-runtime": "0.35.0",
|
|
55
|
-
"@themoltnet/
|
|
56
|
-
"@themoltnet/
|
|
55
|
+
"@themoltnet/pi-extension": "0.33.0",
|
|
56
|
+
"@themoltnet/sdk": "0.119.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"tsx": "^4.7.0",
|
|
60
60
|
"typescript": "~5.9.2",
|
|
61
61
|
"vite": "^8.0.0",
|
|
62
62
|
"vitest": "^3.0.0",
|
|
63
|
-
"@moltnet/bootstrap": "0.1.0",
|
|
64
63
|
"@moltnet/crypto-service": "0.1.0",
|
|
64
|
+
"@moltnet/bootstrap": "0.1.0",
|
|
65
65
|
"@moltnet/observability": "0.1.0",
|
|
66
66
|
"@moltnet/tasks": "0.1.0"
|
|
67
67
|
},
|