@sapienx/agentos 0.3.13 → 0.4.1

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.
Files changed (200) hide show
  1. package/README.md +1 -1
  2. package/bin/agentos.js +1 -2
  3. package/bundle/.next/BUILD_ID +1 -1
  4. package/bundle/.next/app-path-routes-manifest.json +11 -9
  5. package/bundle/.next/build-manifest.json +3 -3
  6. package/bundle/.next/prerender-manifest.json +3 -3
  7. package/bundle/.next/react-loadable-manifest.json +3 -3
  8. package/bundle/.next/required-server-files.json +16 -0
  9. package/bundle/.next/routes-manifest.json +14 -0
  10. package/bundle/.next/server/app/_global-error/page.js +3 -3
  11. package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  12. package/bundle/.next/server/app/_global-error.html +1 -1
  13. package/bundle/.next/server/app/_global-error.rsc +1 -1
  14. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  15. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  16. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  17. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/bundle/.next/server/app/_not-found/page.js +2 -2
  21. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/bundle/.next/server/app/_not-found.html +1 -1
  23. package/bundle/.next/server/app/_not-found.rsc +3 -3
  24. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  25. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  26. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  27. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  28. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  29. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  30. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +8 -1
  31. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
  32. package/bundle/.next/server/app/api/agents/route.js +1 -1
  33. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  34. package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
  35. package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
  36. package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
  37. package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
  38. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  39. package/bundle/.next/server/app/api/mission/route.js +1 -1
  40. package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
  41. package/bundle/.next/server/app/api/models/catalog/route.js +1 -0
  42. package/bundle/.next/server/app/api/models/catalog/route.js.nft.json +1 -0
  43. package/bundle/.next/server/app/api/models/catalog/route_client-reference-manifest.js +1 -0
  44. package/bundle/.next/server/app/api/models/providers/route.js +2 -2
  45. package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
  46. package/bundle/.next/server/app/api/onboarding/models/route.js +7 -7
  47. package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
  48. package/bundle/.next/server/app/api/onboarding/route.js +8 -8
  49. package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  50. package/bundle/.next/server/app/api/openclaw/capabilities/route.js +3 -3
  51. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +2 -2
  52. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  53. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
  54. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
  55. package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
  56. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  57. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
  58. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  59. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
  60. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  61. package/bundle/.next/server/app/api/planner/route.js +1 -1
  62. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  63. package/bundle/.next/server/app/api/reset/route.js +3 -3
  64. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  65. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
  66. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  67. package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
  68. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  69. package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
  70. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  71. package/bundle/.next/server/app/api/snapshot/route.js +1 -1
  72. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  73. package/bundle/.next/server/app/api/stream/route.js +2 -2
  74. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  75. package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
  76. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
  77. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
  78. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
  79. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
  80. package/bundle/.next/server/app/api/update/route.js +4 -4
  81. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  82. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -1
  83. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
  84. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
  85. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
  86. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
  87. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
  88. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -0
  89. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -0
  90. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route_client-reference-manifest.js +1 -0
  91. package/bundle/.next/server/app/api/workspaces/route.js +2 -2
  92. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  93. package/bundle/.next/server/app/page.js +44 -41
  94. package/bundle/.next/server/app/page.js.nft.json +1 -1
  95. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  96. package/bundle/.next/server/app-paths-manifest.json +11 -9
  97. package/bundle/.next/server/chunks/199.js +412 -0
  98. package/bundle/.next/server/chunks/639.js +98 -0
  99. package/bundle/.next/server/chunks/661.js +1 -1
  100. package/bundle/.next/server/functions-config-manifest.json +3 -1
  101. package/bundle/.next/server/middleware-build-manifest.js +1 -1
  102. package/bundle/.next/server/middleware-react-loadable-manifest.js +1 -1
  103. package/bundle/.next/server/pages/404.html +1 -1
  104. package/bundle/.next/server/pages/500.html +1 -1
  105. package/bundle/.next/server/server-reference-manifest.json +1 -1
  106. package/bundle/.next/static/9OX9mutnH1gpbuj6hICVB/_buildManifest.js +1 -0
  107. package/bundle/.next/static/chunks/{1364.5bd755c8584fcbc8.js → 2999.fef298fbe30cd4bd.js} +1 -1
  108. package/bundle/.next/static/chunks/5261.29ae1e1fe185a617.js +1 -0
  109. package/bundle/.next/static/chunks/7963-6bd42810c5733ae8.js +15 -0
  110. package/bundle/.next/static/chunks/app/_global-error/page-cde9c645dcfceb9f.js +1 -0
  111. package/bundle/.next/static/chunks/app/_not-found/page-cde9c645dcfceb9f.js +1 -0
  112. package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-cde9c645dcfceb9f.js +1 -0
  113. package/bundle/.next/static/chunks/app/api/agents/route-cde9c645dcfceb9f.js +1 -0
  114. package/bundle/.next/static/chunks/app/api/diagnostics/route-cde9c645dcfceb9f.js +1 -0
  115. package/bundle/.next/static/chunks/app/api/files/reveal/route-cde9c645dcfceb9f.js +1 -0
  116. package/bundle/.next/static/chunks/app/api/gateway/control/route-cde9c645dcfceb9f.js +1 -0
  117. package/bundle/.next/static/chunks/app/api/mission/route-cde9c645dcfceb9f.js +1 -0
  118. package/bundle/.next/static/chunks/app/api/models/catalog/route-cde9c645dcfceb9f.js +1 -0
  119. package/bundle/.next/static/chunks/app/api/models/providers/route-cde9c645dcfceb9f.js +1 -0
  120. package/bundle/.next/static/chunks/app/api/onboarding/models/route-cde9c645dcfceb9f.js +1 -0
  121. package/bundle/.next/static/chunks/app/api/onboarding/route-cde9c645dcfceb9f.js +1 -0
  122. package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-cde9c645dcfceb9f.js +1 -0
  123. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-cde9c645dcfceb9f.js +1 -0
  124. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-cde9c645dcfceb9f.js +1 -0
  125. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-cde9c645dcfceb9f.js +1 -0
  126. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-cde9c645dcfceb9f.js +1 -0
  127. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-cde9c645dcfceb9f.js +1 -0
  128. package/bundle/.next/static/chunks/app/api/planner/route-cde9c645dcfceb9f.js +1 -0
  129. package/bundle/.next/static/chunks/app/api/reset/route-cde9c645dcfceb9f.js +1 -0
  130. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-cde9c645dcfceb9f.js +1 -0
  131. package/bundle/.next/static/chunks/app/api/settings/gateway/route-cde9c645dcfceb9f.js +1 -0
  132. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-cde9c645dcfceb9f.js +1 -0
  133. package/bundle/.next/static/chunks/app/api/snapshot/route-cde9c645dcfceb9f.js +1 -0
  134. package/bundle/.next/static/chunks/app/api/stream/route-cde9c645dcfceb9f.js +1 -0
  135. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-cde9c645dcfceb9f.js +1 -0
  136. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-cde9c645dcfceb9f.js +1 -0
  137. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-cde9c645dcfceb9f.js +1 -0
  138. package/bundle/.next/static/chunks/app/api/update/route-cde9c645dcfceb9f.js +1 -0
  139. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-cde9c645dcfceb9f.js +1 -0
  140. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-cde9c645dcfceb9f.js +1 -0
  141. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-cde9c645dcfceb9f.js +1 -0
  142. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-cde9c645dcfceb9f.js +1 -0
  143. package/bundle/.next/static/chunks/app/api/workspaces/route-cde9c645dcfceb9f.js +1 -0
  144. package/bundle/.next/static/chunks/app/not-found-cde9c645dcfceb9f.js +1 -0
  145. package/bundle/.next/static/chunks/app/page-7bc93c9b4ee30f58.js +179 -0
  146. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-cde9c645dcfceb9f.js +1 -0
  147. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-cde9c645dcfceb9f.js +1 -0
  148. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-cde9c645dcfceb9f.js +1 -0
  149. package/bundle/.next/static/chunks/{webpack-4fdc6767ef8ff7b1.js → webpack-e0accbaa78fb0b56.js} +1 -1
  150. package/bundle/.next/static/css/9f1b31fd4086df59.css +3 -0
  151. package/bundle/package.json +1 -1
  152. package/bundle/public/readme/mission-control-hero.svg +2 -2
  153. package/bundle/public/site.webmanifest +1 -1
  154. package/bundle/scripts/openclaw-mission-dispatch-runner.mjs +180 -9
  155. package/bundle/server.js +1 -1
  156. package/package.json +2 -2
  157. package/bundle/.next/server/chunks/212.js +0 -98
  158. package/bundle/.next/server/chunks/49.js +0 -420
  159. package/bundle/.next/static/E1q9ZtkD74uwvDRq3uoCz/_buildManifest.js +0 -1
  160. package/bundle/.next/static/chunks/1506.ec91294c1cbc454f.js +0 -1
  161. package/bundle/.next/static/chunks/5954-fd2a9c905dcede3c.js +0 -15
  162. package/bundle/.next/static/chunks/app/_global-error/page-1a770949224cd2a0.js +0 -1
  163. package/bundle/.next/static/chunks/app/_not-found/page-1a770949224cd2a0.js +0 -1
  164. package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-1a770949224cd2a0.js +0 -1
  165. package/bundle/.next/static/chunks/app/api/agents/route-1a770949224cd2a0.js +0 -1
  166. package/bundle/.next/static/chunks/app/api/diagnostics/route-1a770949224cd2a0.js +0 -1
  167. package/bundle/.next/static/chunks/app/api/files/reveal/route-1a770949224cd2a0.js +0 -1
  168. package/bundle/.next/static/chunks/app/api/gateway/control/route-1a770949224cd2a0.js +0 -1
  169. package/bundle/.next/static/chunks/app/api/mission/route-1a770949224cd2a0.js +0 -1
  170. package/bundle/.next/static/chunks/app/api/models/providers/route-1a770949224cd2a0.js +0 -1
  171. package/bundle/.next/static/chunks/app/api/onboarding/models/route-1a770949224cd2a0.js +0 -1
  172. package/bundle/.next/static/chunks/app/api/onboarding/route-1a770949224cd2a0.js +0 -1
  173. package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-1a770949224cd2a0.js +0 -1
  174. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-1a770949224cd2a0.js +0 -1
  175. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-1a770949224cd2a0.js +0 -1
  176. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-1a770949224cd2a0.js +0 -1
  177. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-1a770949224cd2a0.js +0 -1
  178. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-1a770949224cd2a0.js +0 -1
  179. package/bundle/.next/static/chunks/app/api/planner/route-1a770949224cd2a0.js +0 -1
  180. package/bundle/.next/static/chunks/app/api/reset/route-1a770949224cd2a0.js +0 -1
  181. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-1a770949224cd2a0.js +0 -1
  182. package/bundle/.next/static/chunks/app/api/settings/gateway/route-1a770949224cd2a0.js +0 -1
  183. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-1a770949224cd2a0.js +0 -1
  184. package/bundle/.next/static/chunks/app/api/snapshot/route-1a770949224cd2a0.js +0 -1
  185. package/bundle/.next/static/chunks/app/api/stream/route-1a770949224cd2a0.js +0 -1
  186. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-1a770949224cd2a0.js +0 -1
  187. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-1a770949224cd2a0.js +0 -1
  188. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-1a770949224cd2a0.js +0 -1
  189. package/bundle/.next/static/chunks/app/api/update/route-1a770949224cd2a0.js +0 -1
  190. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-1a770949224cd2a0.js +0 -1
  191. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-1a770949224cd2a0.js +0 -1
  192. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-1a770949224cd2a0.js +0 -1
  193. package/bundle/.next/static/chunks/app/api/workspaces/route-1a770949224cd2a0.js +0 -1
  194. package/bundle/.next/static/chunks/app/not-found-1a770949224cd2a0.js +0 -1
  195. package/bundle/.next/static/chunks/app/page-e7ca3c6ffb09198b.js +0 -176
  196. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-1a770949224cd2a0.js +0 -1
  197. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-1a770949224cd2a0.js +0 -1
  198. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-1a770949224cd2a0.js +0 -1
  199. package/bundle/.next/static/css/e20ab76ee4e77d93.css +0 -3
  200. /package/bundle/.next/static/{E1q9ZtkD74uwvDRq3uoCz → 9OX9mutnH1gpbuj6hICVB}/_ssgManifest.js +0 -0
@@ -1,11 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawn } from "node:child_process";
4
- import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
4
+ import { appendFile, mkdir, readFile, rename, writeFile } from "node:fs/promises";
5
5
  import path from "node:path";
6
6
 
7
7
  const recordPath = process.argv[2];
8
8
  const heartbeatIntervalMs = 15_000;
9
+ const runnerDiagnosticJsonKeys = new Set([
10
+ "cause",
11
+ "code",
12
+ "details",
13
+ "error",
14
+ "message",
15
+ "reason",
16
+ "stack",
17
+ "stderr",
18
+ "stdout",
19
+ "warning"
20
+ ]);
9
21
 
10
22
  if (!recordPath) {
11
23
  process.exit(1);
@@ -21,6 +33,10 @@ async function main() {
21
33
  const openClawBin = process.env.OPENCLAW_BIN || "openclaw";
22
34
  const startedAt = new Date().toISOString();
23
35
  const sessionId = typeof record.sessionId === "string" && record.sessionId.trim() ? record.sessionId.trim() : null;
36
+ const runnerLogPath = resolveRunnerLogPath(record);
37
+ let logWriteQueue = Promise.resolve();
38
+ let stdoutLineBuffer = "";
39
+ let stderrLineBuffer = "";
24
40
 
25
41
  await mutateRecord((current) => ({
26
42
  ...current,
@@ -31,9 +47,15 @@ async function main() {
31
47
  ...(current.runner || {}),
32
48
  pid: process.pid,
33
49
  startedAt,
34
- lastHeartbeatAt: startedAt
50
+ lastHeartbeatAt: startedAt,
51
+ logPath: runnerLogPath
35
52
  }
36
53
  }));
54
+ await enqueueRunnerStatus(
55
+ sessionId
56
+ ? `Dispatch runner booted for agent ${record.agentId} on session ${sessionId}.`
57
+ : `Dispatch runner booted for agent ${record.agentId}.`
58
+ );
37
59
 
38
60
  const child = spawn(
39
61
  openClawBin,
@@ -67,9 +89,13 @@ async function main() {
67
89
  pid: process.pid,
68
90
  childPid: child.pid ?? latest.runner?.childPid ?? null,
69
91
  startedAt: latest.runner?.startedAt || startedAt,
70
- lastHeartbeatAt: startedAt
92
+ lastHeartbeatAt: startedAt,
93
+ logPath: latest.runner?.logPath || runnerLogPath
71
94
  }
72
95
  }));
96
+ await enqueueRunnerStatus(
97
+ `Launched OpenClaw agent process${child.pid ? ` (pid ${child.pid})` : ""}.`
98
+ );
73
99
 
74
100
  const currentAfterSpawn = await readRecord();
75
101
  if (currentAfterSpawn && typeof currentAfterSpawn.status === "string" && currentAfterSpawn.status !== "running") {
@@ -89,14 +115,19 @@ async function main() {
89
115
  }, heartbeatIntervalMs);
90
116
 
91
117
  child.stdout.on("data", (chunk) => {
92
- stdout += chunk.toString();
118
+ const text = chunk.toString();
119
+ stdout += text;
120
+ void consumeRunnerStream("stdout", text);
93
121
  });
94
122
 
95
123
  child.stderr.on("data", (chunk) => {
96
- stderr += chunk.toString();
124
+ const text = chunk.toString();
125
+ stderr += text;
126
+ void consumeRunnerStream("stderr", text);
97
127
  });
98
128
 
99
129
  child.on("error", (error) => {
130
+ void enqueueRunnerStatus(`OpenClaw process error: ${error.message}`);
100
131
  void finalize({
101
132
  status: "stalled",
102
133
  result: null,
@@ -106,6 +137,7 @@ async function main() {
106
137
 
107
138
  child.on("close", (code) => {
108
139
  void (async () => {
140
+ await flushBufferedRunnerOutput();
109
141
  const current = await readRecord();
110
142
 
111
143
  if (current && typeof current.status === "string" && current.status !== "running") {
@@ -118,6 +150,7 @@ async function main() {
118
150
  const payload = tryParseMissionPayload(stdout || stderr);
119
151
 
120
152
  if (code === 0 && payload && !isFailurePayload(payload)) {
153
+ await enqueueRunnerStatus("OpenClaw exited successfully and returned a mission payload.");
121
154
  void finalize({
122
155
  status: "completed",
123
156
  result: payload,
@@ -126,6 +159,11 @@ async function main() {
126
159
  return;
127
160
  }
128
161
 
162
+ await enqueueRunnerStatus(
163
+ code === 0
164
+ ? "OpenClaw exited successfully but did not return a usable mission payload."
165
+ : `OpenClaw exited with code ${typeof code === "number" ? code : "unknown"}.`
166
+ );
129
167
  void finalize({
130
168
  status: "stalled",
131
169
  result: payload,
@@ -175,6 +213,7 @@ async function main() {
175
213
 
176
214
  settled = true;
177
215
  clearInterval(heartbeat);
216
+ await flushBufferedRunnerOutput();
178
217
  const finishedAt = new Date().toISOString();
179
218
 
180
219
  await mutateRecord((current) => ({
@@ -188,12 +227,85 @@ async function main() {
188
227
  pid: process.pid,
189
228
  startedAt: current.runner?.startedAt || startedAt,
190
229
  finishedAt,
191
- lastHeartbeatAt: finishedAt
230
+ lastHeartbeatAt: finishedAt,
231
+ logPath: current.runner?.logPath || runnerLogPath
192
232
  }
193
233
  }));
194
234
 
235
+ await logWriteQueue;
195
236
  process.exit(0);
196
237
  }
238
+
239
+ function enqueueRunnerStatus(text) {
240
+ return enqueueRunnerLog("status", text);
241
+ }
242
+
243
+ function enqueueRunnerLog(stream, text) {
244
+ const normalized = normalizeRunnerLogText(text);
245
+
246
+ if (!normalized) {
247
+ return Promise.resolve();
248
+ }
249
+
250
+ const entry = {
251
+ id: `runner-log:${Date.now()}:${Math.random().toString(36).slice(2, 8)}`,
252
+ timestamp: new Date().toISOString(),
253
+ stream,
254
+ text: normalized
255
+ };
256
+
257
+ logWriteQueue = logWriteQueue
258
+ .then(() => appendRunnerLogEntry(runnerLogPath, entry))
259
+ .catch(() => undefined);
260
+
261
+ return logWriteQueue;
262
+ }
263
+
264
+ async function consumeRunnerStream(stream, chunk) {
265
+ if (stream === "stdout") {
266
+ stdoutLineBuffer += chunk;
267
+ } else {
268
+ stderrLineBuffer += chunk;
269
+ }
270
+
271
+ const buffer = stream === "stdout" ? stdoutLineBuffer : stderrLineBuffer;
272
+ const lines = buffer.split(/\r?\n/);
273
+ const remainder = lines.pop() ?? "";
274
+
275
+ if (stream === "stdout") {
276
+ stdoutLineBuffer = remainder;
277
+ } else {
278
+ stderrLineBuffer = remainder;
279
+ }
280
+
281
+ for (const line of lines) {
282
+ const normalized = normalizeRunnerLogText(line);
283
+
284
+ if (!normalized || shouldSkipRunnerLogLine(stream, normalized)) {
285
+ continue;
286
+ }
287
+
288
+ await enqueueRunnerLog(stream, normalized);
289
+ }
290
+ }
291
+
292
+ async function flushBufferedRunnerOutput() {
293
+ for (const [stream, pending] of [
294
+ ["stdout", stdoutLineBuffer],
295
+ ["stderr", stderrLineBuffer]
296
+ ]) {
297
+ const normalized = normalizeRunnerLogText(pending);
298
+
299
+ if (!normalized || shouldSkipRunnerLogLine(stream, normalized)) {
300
+ continue;
301
+ }
302
+
303
+ await enqueueRunnerLog(stream, normalized);
304
+ }
305
+
306
+ stdoutLineBuffer = "";
307
+ stderrLineBuffer = "";
308
+ }
197
309
  }
198
310
 
199
311
  async function readRecord() {
@@ -219,6 +331,57 @@ async function writeJsonAtomic(targetPath, value) {
219
331
  await rename(tempPath, targetPath);
220
332
  }
221
333
 
334
+ async function appendRunnerLogEntry(targetPath, entry) {
335
+ await mkdir(path.dirname(targetPath), { recursive: true });
336
+ await appendFile(targetPath, `${JSON.stringify(entry)}\n`, "utf8");
337
+ }
338
+
339
+ function resolveRunnerLogPath(record) {
340
+ const existingPath = record?.runner?.logPath;
341
+ return typeof existingPath === "string" && existingPath.trim() ? existingPath.trim() : `${recordPath}.log.jsonl`;
342
+ }
343
+
344
+ function normalizeRunnerLogText(value) {
345
+ return String(value || "")
346
+ .replace(/\u0000/g, "")
347
+ .trim()
348
+ .slice(0, 400);
349
+ }
350
+
351
+ function shouldSkipRunnerLogLine(stream, text) {
352
+ if (stream === "stdout" && Boolean(tryParseMissionPayload(text))) {
353
+ return true;
354
+ }
355
+
356
+ return isIgnorableRunnerLogLine(text);
357
+ }
358
+
359
+ function isIgnorableRunnerLogLine(text) {
360
+ const normalized = String(text || "").trim();
361
+
362
+ if (!normalized) {
363
+ return true;
364
+ }
365
+
366
+ if (/^[\[\]{}(),]+$/.test(normalized)) {
367
+ return true;
368
+ }
369
+
370
+ const quotedPropertyMatch = normalized.match(/^"([^"]+)"\s*:\s*(.+?)(,)?$/);
371
+
372
+ if (quotedPropertyMatch) {
373
+ return !runnerDiagnosticJsonKeys.has(quotedPropertyMatch[1].toLowerCase());
374
+ }
375
+
376
+ const barePropertyMatch = normalized.match(/^([A-Za-z0-9_.-]+)\s*:\s*(.+)$/);
377
+
378
+ if (barePropertyMatch) {
379
+ return false;
380
+ }
381
+
382
+ return false;
383
+ }
384
+
222
385
  function tryParseMissionPayload(text) {
223
386
  const trimmed = String(text || "").trim();
224
387
 
@@ -276,18 +439,26 @@ function extractFailureMessage(stderr, stdout) {
276
439
 
277
440
  main().catch(async (error) => {
278
441
  try {
442
+ const failedAt = new Date().toISOString();
279
443
  await mutateRecord((current) => ({
280
444
  ...current,
281
445
  status: "stalled",
282
- updatedAt: new Date().toISOString(),
446
+ updatedAt: failedAt,
283
447
  error: error instanceof Error ? error.message : "Mission dispatch runner failed unexpectedly.",
284
448
  runner: {
285
449
  ...(current.runner || {}),
286
450
  pid: process.pid,
287
- finishedAt: new Date().toISOString(),
288
- lastHeartbeatAt: new Date().toISOString()
451
+ finishedAt: failedAt,
452
+ lastHeartbeatAt: failedAt,
453
+ logPath: current.runner?.logPath || `${recordPath}.log.jsonl`
289
454
  }
290
455
  }));
456
+ await appendRunnerLogEntry(`${recordPath}.log.jsonl`, {
457
+ id: `runner-log:${Date.now()}:${Math.random().toString(36).slice(2, 8)}`,
458
+ timestamp: failedAt,
459
+ stream: "status",
460
+ text: error instanceof Error ? error.message : "Mission dispatch runner failed unexpectedly."
461
+ });
291
462
  } catch {}
292
463
 
293
464
  process.exit(1);
package/bundle/server.js CHANGED
@@ -9,7 +9,7 @@ const currentPort = parseInt(process.env.PORT, 10) || 3000
9
9
  const hostname = process.env.HOSTNAME || '0.0.0.0'
10
10
 
11
11
  let keepAliveTimeout = parseInt(process.env.KEEP_ALIVE_TIMEOUT, 10)
12
- const nextConfig = {"env":{},"webpack":null,"typescript":{"ignoreBuildErrors":false},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.mjs","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":false,"customCacheHandler":false},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{"serverFunctions":true,"browserToTerminal":"warn"},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":"/Users/kazimakgul/Documents/GitHub/AgentOS","cacheComponents":false,"cacheLife":{"default":{"stale":300,"revalidate":900,"expire":4294967294},"seconds":{"stale":30,"revalidate":1,"expire":60},"minutes":{"stale":300,"revalidate":60,"expire":3600},"hours":{"stale":300,"revalidate":3600,"expire":86400},"days":{"stale":300,"revalidate":86400,"expire":604800},"weeks":{"stale":300,"revalidate":604800,"expire":2592000},"max":{"stale":300,"revalidate":2592000,"expire":31536000}},"cacheHandlers":{},"experimental":{"appNewScrollHandler":false,"useSkewCookie":false,"cssChunking":true,"multiZoneDraftMode":false,"appNavFailHandling":false,"prerenderEarlyExit":true,"serverMinification":true,"linkNoTouchStart":false,"caseSensitiveRoutes":false,"cachedNavigations":false,"partialFallbacks":false,"dynamicOnHover":false,"varyParams":false,"prefetchInlining":false,"preloadEntriesOnStart":true,"clientRouterFilter":true,"clientRouterFilterRedirects":false,"fetchCacheKeyPrefix":"","proxyPrefetch":"flexible","optimisticClientCache":true,"manualClientBasePath":false,"cpus":9,"memoryBasedWorkersCount":false,"imgOptConcurrency":null,"imgOptTimeoutInSeconds":7,"imgOptMaxInputPixels":268402689,"imgOptSequentialRead":null,"imgOptSkipMetadata":null,"isrFlushToDisk":true,"workerThreads":false,"optimizeCss":false,"nextScriptWorkers":false,"scrollRestoration":false,"externalDir":false,"disableOptimizedLoading":false,"gzipSize":true,"craCompat":false,"esmExternals":true,"fullySpecified":false,"swcTraceProfiling":false,"forceSwcTransforms":false,"largePageDataBytes":128000,"typedEnv":false,"parallelServerCompiles":false,"parallelServerBuildTraces":false,"ppr":false,"authInterrupts":false,"webpackMemoryOptimizations":false,"optimizeServerReact":true,"strictRouteTypes":false,"viewTransition":false,"removeUncaughtErrorAndRejectionListeners":false,"validateRSCRequestHeaders":false,"staleTimes":{"dynamic":0,"static":300},"reactDebugChannel":true,"serverComponentsHmrCache":true,"staticGenerationMaxConcurrency":8,"staticGenerationMinPagesPerWorker":25,"transitionIndicator":false,"gestureTransition":false,"inlineCss":false,"useCache":false,"globalNotFound":false,"browserDebugInfoInTerminal":"warn","lockDistDir":true,"proxyClientMaxBodySize":10485760,"hideLogsAfterAbort":false,"mcpServer":true,"turbopackFileSystemCacheForDev":true,"turbopackFileSystemCacheForBuild":false,"turbopackInferModuleSideEffects":true,"turbopackPluginRuntimeStrategy":"childProcesses","optimizePackageImports":["lucide-react","date-fns","lodash-es","ramda","antd","react-bootstrap","ahooks","@ant-design/icons","@headlessui/react","@headlessui-float/react","@heroicons/react/20/solid","@heroicons/react/24/solid","@heroicons/react/24/outline","@visx/visx","@tremor/react","rxjs","@mui/material","@mui/icons-material","recharts","react-use","effect","@effect/schema","@effect/platform","@effect/platform-node","@effect/platform-browser","@effect/platform-bun","@effect/sql","@effect/sql-mssql","@effect/sql-mysql2","@effect/sql-pg","@effect/sql-sqlite-node","@effect/sql-sqlite-bun","@effect/sql-sqlite-wasm","@effect/sql-sqlite-react-native","@effect/rpc","@effect/rpc-http","@effect/typeclass","@effect/experimental","@effect/opentelemetry","@material-ui/core","@material-ui/icons","@tabler/icons-react","mui-core","react-icons/ai","react-icons/bi","react-icons/bs","react-icons/cg","react-icons/ci","react-icons/di","react-icons/fa","react-icons/fa6","react-icons/fc","react-icons/fi","react-icons/gi","react-icons/go","react-icons/gr","react-icons/hi","react-icons/hi2","react-icons/im","react-icons/io","react-icons/io5","react-icons/lia","react-icons/lib","react-icons/lu","react-icons/md","react-icons/pi","react-icons/ri","react-icons/rx","react-icons/si","react-icons/sl","react-icons/tb","react-icons/tfi","react-icons/ti","react-icons/vsc","react-icons/wi"],"trustHostHeader":false,"isExperimentalCompile":false},"htmlLimitedBots":"[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight","bundlePagesRouterDependencies":false,"configFileName":"next.config.mjs","turbopack":{"root":"/Users/kazimakgul/Documents/GitHub/AgentOS"},"distDirRoot":".next"}
12
+ const nextConfig = {"env":{},"webpack":null,"typescript":{"ignoreBuildErrors":false},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.mjs","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":false,"customCacheHandler":false},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{"serverFunctions":true,"browserToTerminal":"warn"},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":"/Users/kazimakgul/Documents/GitHub/AgentOS","cacheComponents":false,"cacheLife":{"default":{"stale":300,"revalidate":900,"expire":4294967294},"seconds":{"stale":30,"revalidate":1,"expire":60},"minutes":{"stale":300,"revalidate":60,"expire":3600},"hours":{"stale":300,"revalidate":3600,"expire":86400},"days":{"stale":300,"revalidate":86400,"expire":604800},"weeks":{"stale":300,"revalidate":604800,"expire":2592000},"max":{"stale":300,"revalidate":2592000,"expire":31536000}},"cacheHandlers":{},"experimental":{"appNewScrollHandler":false,"useSkewCookie":false,"cssChunking":true,"multiZoneDraftMode":false,"appNavFailHandling":false,"prerenderEarlyExit":true,"serverMinification":true,"linkNoTouchStart":false,"caseSensitiveRoutes":false,"cachedNavigations":false,"partialFallbacks":false,"dynamicOnHover":false,"varyParams":false,"prefetchInlining":false,"preloadEntriesOnStart":true,"clientRouterFilter":true,"clientRouterFilterRedirects":false,"fetchCacheKeyPrefix":"","proxyPrefetch":"flexible","optimisticClientCache":true,"manualClientBasePath":false,"cpus":9,"memoryBasedWorkersCount":false,"imgOptConcurrency":null,"imgOptTimeoutInSeconds":7,"imgOptMaxInputPixels":268402689,"imgOptSequentialRead":null,"imgOptSkipMetadata":null,"isrFlushToDisk":true,"workerThreads":false,"optimizeCss":false,"nextScriptWorkers":false,"scrollRestoration":false,"externalDir":false,"disableOptimizedLoading":false,"gzipSize":true,"craCompat":false,"esmExternals":true,"fullySpecified":false,"swcTraceProfiling":false,"forceSwcTransforms":false,"largePageDataBytes":128000,"typedEnv":false,"parallelServerCompiles":false,"parallelServerBuildTraces":false,"ppr":false,"authInterrupts":false,"webpackMemoryOptimizations":false,"optimizeServerReact":true,"strictRouteTypes":false,"viewTransition":false,"removeUncaughtErrorAndRejectionListeners":false,"validateRSCRequestHeaders":false,"staleTimes":{"dynamic":0,"static":300},"reactDebugChannel":true,"serverComponentsHmrCache":true,"staticGenerationMaxConcurrency":8,"staticGenerationMinPagesPerWorker":25,"transitionIndicator":false,"gestureTransition":false,"inlineCss":false,"useCache":false,"globalNotFound":false,"browserDebugInfoInTerminal":"warn","lockDistDir":true,"proxyClientMaxBodySize":10485760,"hideLogsAfterAbort":false,"mcpServer":true,"turbopackFileSystemCacheForDev":true,"turbopackFileSystemCacheForBuild":false,"turbopackInferModuleSideEffects":true,"turbopackPluginRuntimeStrategy":"childProcesses","optimizePackageImports":["lucide-react","date-fns","lodash-es","ramda","antd","react-bootstrap","ahooks","@ant-design/icons","@headlessui/react","@headlessui-float/react","@heroicons/react/20/solid","@heroicons/react/24/solid","@heroicons/react/24/outline","@visx/visx","@tremor/react","rxjs","@mui/material","@mui/icons-material","recharts","react-use","effect","@effect/schema","@effect/platform","@effect/platform-node","@effect/platform-browser","@effect/platform-bun","@effect/sql","@effect/sql-mssql","@effect/sql-mysql2","@effect/sql-pg","@effect/sql-sqlite-node","@effect/sql-sqlite-bun","@effect/sql-sqlite-wasm","@effect/sql-sqlite-react-native","@effect/rpc","@effect/rpc-http","@effect/typeclass","@effect/experimental","@effect/opentelemetry","@material-ui/core","@material-ui/icons","@tabler/icons-react","mui-core","react-icons/ai","react-icons/bi","react-icons/bs","react-icons/cg","react-icons/ci","react-icons/di","react-icons/fa","react-icons/fa6","react-icons/fc","react-icons/fi","react-icons/gi","react-icons/go","react-icons/gr","react-icons/hi","react-icons/hi2","react-icons/im","react-icons/io","react-icons/io5","react-icons/lia","react-icons/lib","react-icons/lu","react-icons/md","react-icons/pi","react-icons/ri","react-icons/rx","react-icons/si","react-icons/sl","react-icons/tb","react-icons/tfi","react-icons/ti","react-icons/vsc","react-icons/wi"],"trustHostHeader":false,"isExperimentalCompile":false},"htmlLimitedBots":"[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight","bundlePagesRouterDependencies":false,"configFileName":"next.config.mjs","outputFileTracingExcludes":{"/*":["./AGENTS.md","./README.md","./docs/**/*","./eslint.config.mjs","./next-env.d.ts","./next.config.mjs","./package-lock.json","./pnpm-lock.yaml","./pnpm-workspace.yaml","./tailwind.config.ts","./tests/**/*","./tsconfig.json"]},"turbopack":{"root":"/Users/kazimakgul/Documents/GitHub/AgentOS"},"distDirRoot":".next"}
13
13
 
14
14
  process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig)
15
15
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sapienx/agentos",
3
- "version": "0.3.13",
4
- "description": "AgentOS Mission Control launcher",
3
+ "version": "0.4.1",
4
+ "description": "AgentOS control plane launcher",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "agentos": "bin/agentos.js"