@themoltnet/agent-daemon 0.29.5 → 0.29.7

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 CHANGED
@@ -102,7 +102,7 @@ host-exec command is safe to run without a dialog.
102
102
  ### Remote runtime profiles
103
103
 
104
104
  The canonical user-facing guide lives in the public docs:
105
- [Agent Daemon § Remote runtime profiles](https://docs.themolt.net/use/agent-daemon.html#remote-runtime-profiles).
105
+ [Running Agents § Runtime Profiles](https://docs.themolt.net/operate/running-agents#runtime-profiles).
106
106
 
107
107
  ## Correlation anchors
108
108
 
package/dist/main.js CHANGED
@@ -4826,7 +4826,7 @@ _Object_({
4826
4826
  * (server-side schema check). Self-assessment is a truthful self-rating,
4827
4827
  * NOT enforcement — `verification.passed=false` does not block /complete
4828
4828
  * and does not affect `acceptedAttemptN`. See
4829
- * `docs/understand/agent-runtime.md` for the full producer/judge flow.
4829
+ * `docs/use/tasks-and-runtime.md` for the full producer/judge flow.
4830
4830
  *
4831
4831
  * **Binding evaluation** (judgment tasks: `assess_brief`, `judge_pack`).
4832
4832
  * A separate task whose IS the application of `successCriteria` to
@@ -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 {
@@ -10564,6 +10600,7 @@ async function resolveRuntimeProfile(options) {
10564
10600
  allowedWorkspaceModes: profile.allowedWorkspaceModes,
10565
10601
  requiredEnv: profile.requiredEnv,
10566
10602
  requiredTools: profile.requiredTools,
10603
+ context: profile.context ?? [],
10567
10604
  sandboxConfig: profile.sandbox,
10568
10605
  mountPath: resolve(options.cwd),
10569
10606
  source: `runtime-profile:${profile.id}`
@@ -11265,6 +11302,7 @@ async function runPolling(opts) {
11265
11302
  maxOutputTokens: profile.maxOutputTokens,
11266
11303
  sandboxConfig: sandbox.config,
11267
11304
  forwardEnv: profile.requiredEnv,
11305
+ runtimeProfileContext: profile.context,
11268
11306
  makeExecutionPlan: (task) => executionPlans.getOrCreate(task),
11269
11307
  makeOnTurnEvent: makeTurnEventHandlerFactory(taskLogger),
11270
11308
  maxTurns: common.maxTurns,
@@ -11520,6 +11558,7 @@ async function runOnce(argv) {
11520
11558
  maxOutputTokens: profile.maxOutputTokens,
11521
11559
  sandboxConfig: sandbox.config,
11522
11560
  forwardEnv: profile.requiredEnv,
11561
+ runtimeProfileContext: profile.context,
11523
11562
  makeExecutionPlan: (claimedTask) => executionPlans.getOrCreate(claimedTask),
11524
11563
  onTurnEvent: makeTurnEventHandler(rootLogger, { taskId }),
11525
11564
  maxTurns: opts.maxTurns,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/agent-daemon",
3
- "version": "0.29.5",
3
+ "version": "0.29.7",
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.",
@@ -51,17 +51,17 @@
51
51
  "@opentelemetry/semantic-conventions": "^1.39.0",
52
52
  "pino": "^10.3.1",
53
53
  "pino-pretty": "^13.1.3",
54
- "@themoltnet/agent-runtime": "0.35.0",
55
54
  "@themoltnet/sdk": "0.119.0",
56
- "@themoltnet/pi-extension": "0.33.0"
55
+ "@themoltnet/pi-extension": "0.33.1",
56
+ "@themoltnet/agent-runtime": "0.35.1"
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
  },