@anyswarm/core 0.5.1 → 0.6.0

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 (301) hide show
  1. package/AGENTS.md +20 -5
  2. package/README.md +69 -55
  3. package/dist/examples/README.md +138 -77
  4. package/dist/examples/authoring/README.md +4 -4
  5. package/dist/examples/autoresearch/README.md +108 -16
  6. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
  7. package/dist/examples/autoresearch/config.d.ts +48 -5
  8. package/dist/examples/autoresearch/config.js +57 -23
  9. package/dist/examples/autoresearch/demo.d.ts +12 -4
  10. package/dist/examples/autoresearch/demo.js +65 -22
  11. package/dist/examples/autoresearch/eject.json +2 -0
  12. package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
  13. package/dist/examples/autoresearch/frontiercs2-config.js +14 -0
  14. package/dist/examples/autoresearch/frontiercs2.d.ts +18 -1
  15. package/dist/examples/autoresearch/frontiercs2.js +71 -14
  16. package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
  17. package/dist/examples/autoresearch/prepare-demo.js +46 -0
  18. package/dist/examples/autoresearch/prepare.d.ts +105 -53
  19. package/dist/examples/autoresearch/prepare.js +126 -57
  20. package/dist/examples/autoresearch/project.d.ts +6 -95
  21. package/dist/examples/autoresearch/project.js +131 -45
  22. package/dist/examples/autoresearch/research-service.d.ts +16 -1
  23. package/dist/examples/autoresearch/research-service.js +84 -44
  24. package/dist/examples/code/README.md +25 -17
  25. package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
  26. package/dist/examples/code/config.d.ts +1 -0
  27. package/dist/examples/first-harness/AGENTS.md +25 -0
  28. package/dist/examples/first-harness/README.md +136 -0
  29. package/dist/examples/first-harness/config.d.ts +9 -8
  30. package/dist/examples/first-harness/config.js +33 -26
  31. package/dist/examples/first-harness/eject.json +14 -0
  32. package/dist/examples/first-harness/handoff.js +3 -3
  33. package/dist/examples/first-harness/harness.d.ts +14 -18
  34. package/dist/examples/first-harness/harness.js +102 -77
  35. package/dist/examples/first-harness/input/README.md +7 -0
  36. package/dist/examples/first-harness/session.js +2 -1
  37. package/dist/examples/first-harness/tsconfig.json +2 -1
  38. package/dist/examples/harness-session/README.md +4 -4
  39. package/dist/examples/lead-worker/README.md +1 -1
  40. package/dist/examples/lead-worker/project-config.d.ts +1 -0
  41. package/dist/examples/messages/README.md +2 -2
  42. package/dist/examples/notes/README.md +5 -5
  43. package/dist/examples/notes/config.d.ts +1 -0
  44. package/dist/examples/parallel-swarm/AGENTS.md +32 -0
  45. package/dist/examples/parallel-swarm/README.md +136 -0
  46. package/dist/examples/parallel-swarm/board-service.js +25 -8
  47. package/dist/examples/parallel-swarm/board.d.ts +31 -1
  48. package/dist/examples/parallel-swarm/board.js +98 -13
  49. package/dist/examples/parallel-swarm/config.d.ts +11 -0
  50. package/dist/examples/parallel-swarm/config.js +39 -0
  51. package/dist/examples/parallel-swarm/eject.json +5 -0
  52. package/dist/examples/parallel-swarm/harness.d.ts +26 -20
  53. package/dist/examples/parallel-swarm/harness.js +77 -76
  54. package/dist/examples/parallel-swarm/report.d.ts +12 -0
  55. package/dist/examples/parallel-swarm/report.js +30 -0
  56. package/dist/examples/peermesh/README.md +1 -1
  57. package/dist/examples/peermesh/project-config.d.ts +1 -0
  58. package/dist/examples/services/agent-control/README.md +1 -1
  59. package/dist/examples/services/mathlib-search/README.md +1 -1
  60. package/dist/examples/services/mcp-managed/README.md +1 -1
  61. package/dist/examples/services/persistent-board/README.md +6 -3
  62. package/dist/examples/subagents/AGENTS.md +35 -0
  63. package/dist/examples/subagents/README.md +129 -93
  64. package/dist/examples/subagents/config.d.ts +2 -10
  65. package/dist/examples/subagents/config.js +9 -16
  66. package/dist/examples/subagents/eject.json +17 -0
  67. package/dist/examples/subagents/handoff-config.d.ts +41 -0
  68. package/dist/examples/subagents/handoff-config.js +13 -0
  69. package/dist/examples/subagents/model.d.ts +3 -0
  70. package/dist/examples/subagents/model.js +19 -0
  71. package/dist/examples/substrate/README.md +12 -6
  72. package/dist/examples/substrate/config.d.ts +1 -0
  73. package/dist/examples/substrate/project-config.d.ts +1 -0
  74. package/dist/examples/super/README.md +34 -22
  75. package/dist/examples/super/actions.d.ts +1 -1
  76. package/dist/examples/super/actions.js +11 -11
  77. package/dist/examples/super/config.js +3 -3
  78. package/dist/examples/super/eject.json +1 -1
  79. package/dist/examples/super/location.js +1 -1
  80. package/dist/examples/super/operator.d.ts +1 -0
  81. package/dist/examples/super/operator.js +31 -0
  82. package/dist/examples/super/project.d.ts +0 -107
  83. package/dist/examples/super/project.js +1 -3
  84. package/dist/examples/taskpool/README.md +1 -1
  85. package/dist/examples/taskpool/config.d.ts +1 -0
  86. package/dist/examples/taskpool/deploy/service-hosts/service-authority-snapshot.d.ts +4 -4
  87. package/dist/scripts/anyswarm-arguments.d.ts +7 -25
  88. package/dist/scripts/anyswarm-arguments.js +69 -97
  89. package/dist/scripts/anyswarm-eject.js +1 -1
  90. package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
  91. package/dist/scripts/anyswarm-harnesses.js +1 -22
  92. package/dist/scripts/anyswarm-installation.d.ts +7 -40
  93. package/dist/scripts/anyswarm-installation.js +17 -291
  94. package/dist/scripts/anyswarm-launch.d.ts +6 -36
  95. package/dist/scripts/anyswarm-launch.js +32 -81
  96. package/dist/scripts/anyswarm-progress.d.ts +6 -0
  97. package/dist/scripts/anyswarm-progress.js +133 -0
  98. package/dist/scripts/anyswarm-project.d.ts +1 -9
  99. package/dist/scripts/anyswarm-project.js +40 -127
  100. package/dist/scripts/anyswarm-source-runner.js +9 -41
  101. package/dist/scripts/anyswarm.js +6 -26
  102. package/dist/scripts/build-provenance.json +1 -1
  103. package/dist/scripts/generate-architecture-coverage.js +1 -1
  104. package/dist/scripts/generate-architecture-prompts.js +18 -10
  105. package/dist/scripts/local-environment.d.ts +13 -7
  106. package/dist/scripts/local-environment.js +73 -21
  107. package/dist/scripts/local-setup.d.ts +3 -0
  108. package/dist/scripts/local-setup.js +153 -118
  109. package/dist/scripts/pack-release.js +31 -4
  110. package/dist/src/core/index.js +1 -1
  111. package/dist/src/core/sandbox/opensandbox-backend.js +10 -4
  112. package/dist/src/core/sandbox/sandbox-connection.d.ts +9 -2
  113. package/dist/src/core/sandbox/sandbox-connection.js +22 -7
  114. package/dist/src/core/worker-image.js +1 -1
  115. package/dist/src/harness/project-harness.d.ts +1 -0
  116. package/dist/src/harness/project-harness.js +5 -4
  117. package/dist/src/harness/project-rpc-client.js +19 -0
  118. package/dist/src/harness/project-runtime.js +3 -1
  119. package/dist/src/harness/typescript-loader.d.ts +2 -0
  120. package/dist/src/harness/typescript-loader.js +26 -8
  121. package/dist/src/trace-viewer/command.mjs +6 -3
  122. package/dist/src/trace-viewer/public/app.js +239 -59
  123. package/dist/src/trace-viewer/public/index.html +5 -0
  124. package/dist/src/trace-viewer/public/style.css +22 -0
  125. package/dist/src/trace-viewer/reader.mjs +242 -26
  126. package/dist/src/trace-viewer/run-root.d.mts +1 -0
  127. package/dist/src/trace-viewer/run-root.mjs +7 -0
  128. package/dist/src/trace-viewer/server.mjs +3 -1
  129. package/docs/INDEX.md +11 -9
  130. package/docs/architecture/04-services.md +1 -1
  131. package/docs/architecture/06-observability-experiments.md +21 -7
  132. package/docs/architecture/07-run-configuration.md +118 -19
  133. package/docs/architecture/08-prompts.md +21 -2
  134. package/docs/architecture/10-service-api-reference.md +12 -5
  135. package/docs/architecture/12-code-coverage.md +157 -115
  136. package/docs/architecture/15-core-runtime.md +1 -1
  137. package/docs/architecture/16-pi-opensandbox-backend.md +2 -0
  138. package/docs/architecture/17-harness-reporting.md +79 -1
  139. package/docs/architecture/22-website.md +52 -20
  140. package/docs/architecture/23-project-harness.md +109 -37
  141. package/docs/architecture/26-code.md +20 -5
  142. package/docs/architecture/27-personal.md +23 -8
  143. package/docs/architecture/28-autoresearch.md +18 -12
  144. package/docs/architecture/INDEX.md +1 -2
  145. package/docs/architecture/prompts/11-first-sdk-harness.md +9 -9
  146. package/docs/architecture/prompts/16-parallel-swarm.md +46 -13
  147. package/docs/architecture/prompts/22-autoresearch.md +9 -2
  148. package/docs/architecture/prompts/source-manifest.json +76 -52
  149. package/docs/architecture/source-map.json +445 -105
  150. package/docs/designs/core-harness/01-core.md +2 -2
  151. package/docs/designs/core-harness/06-project-harness.md +3 -3
  152. package/docs/designs/core-harness/README.md +2 -2
  153. package/docs/en/agents.md +1 -1
  154. package/docs/en/autoresearch.md +41 -0
  155. package/docs/en/blog/100b-tokens.md +157 -0
  156. package/docs/en/build-your-harness.md +47 -22
  157. package/docs/en/changelog.md +29 -1
  158. package/docs/en/first-harness.md +40 -32
  159. package/docs/en/harnesses/index.md +23 -23
  160. package/docs/en/harnesses/lead-worker.md +1 -1
  161. package/docs/en/harnesses/peermesh.md +2 -2
  162. package/docs/en/harnesses/subagents.md +10 -31
  163. package/docs/en/harnesses/substrate.md +4 -4
  164. package/docs/en/harnesses/taskpool.md +2 -2
  165. package/docs/en/latest.md +30 -5
  166. package/docs/en/overview.md +22 -22
  167. package/docs/en/quickstart.md +69 -56
  168. package/docs/en/reference/api.md +1 -1
  169. package/docs/en/reference/cli.md +47 -85
  170. package/docs/en/sandbox.md +3 -3
  171. package/docs/en/trace-viewer.md +32 -12
  172. package/docs/operations/trace-viewer.md +26 -11
  173. package/docs/third-party-notices.md +0 -1
  174. package/docs/workflows/development.md +160 -118
  175. package/docs/workflows/release-and-docs-versioning.md +207 -54
  176. package/docs/workflows/release-cli-acceptance.md +162 -0
  177. package/docs/zh/agents.md +1 -1
  178. package/docs/zh/autoresearch.md +41 -0
  179. package/docs/zh/blog/100b-tokens.md +102 -0
  180. package/docs/zh/build-your-harness.md +48 -23
  181. package/docs/zh/changelog.md +29 -1
  182. package/docs/zh/first-harness.md +43 -35
  183. package/docs/zh/harnesses/index.md +23 -23
  184. package/docs/zh/harnesses/lead-worker.md +1 -1
  185. package/docs/zh/harnesses/peermesh.md +2 -2
  186. package/docs/zh/harnesses/subagents.md +10 -31
  187. package/docs/zh/harnesses/substrate.md +4 -4
  188. package/docs/zh/harnesses/taskpool.md +2 -2
  189. package/docs/zh/latest.md +30 -5
  190. package/docs/zh/overview.md +23 -23
  191. package/docs/zh/quickstart.md +66 -57
  192. package/docs/zh/reference/api.md +1 -1
  193. package/docs/zh/reference/cli.md +19 -79
  194. package/docs/zh/sandbox.md +3 -3
  195. package/docs/zh/trace-viewer.md +32 -12
  196. package/examples/README.md +138 -77
  197. package/examples/authoring/README.md +4 -4
  198. package/examples/autoresearch/README.md +108 -16
  199. package/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
  200. package/examples/autoresearch/config.ts +64 -25
  201. package/examples/autoresearch/demo.ts +75 -22
  202. package/examples/autoresearch/eject.json +2 -0
  203. package/examples/autoresearch/frontiercs2-config.ts +15 -0
  204. package/examples/autoresearch/frontiercs2.ts +64 -11
  205. package/examples/autoresearch/prepare-demo.ts +44 -0
  206. package/examples/autoresearch/prepare.ts +134 -60
  207. package/examples/autoresearch/project.ts +120 -44
  208. package/examples/autoresearch/research-service.ts +91 -41
  209. package/examples/code/README.md +25 -17
  210. package/examples/code/REQUIREMENTS.zh.md +3 -3
  211. package/examples/first-harness/AGENTS.md +25 -0
  212. package/examples/first-harness/README.md +136 -0
  213. package/examples/first-harness/config.ts +41 -27
  214. package/examples/first-harness/eject.json +14 -0
  215. package/examples/first-harness/handoff.ts +3 -3
  216. package/examples/first-harness/harness.ts +104 -72
  217. package/examples/first-harness/input/README.md +7 -0
  218. package/examples/first-harness/session.ts +2 -1
  219. package/examples/first-harness/tsconfig.json +2 -1
  220. package/examples/harness-session/README.md +4 -4
  221. package/examples/lead-worker/README.md +1 -1
  222. package/examples/messages/README.md +2 -2
  223. package/examples/notes/README.md +5 -5
  224. package/examples/parallel-swarm/AGENTS.md +32 -0
  225. package/examples/parallel-swarm/README.md +136 -0
  226. package/examples/parallel-swarm/board-service.ts +28 -9
  227. package/examples/parallel-swarm/board.ts +107 -13
  228. package/examples/parallel-swarm/config.ts +47 -0
  229. package/examples/parallel-swarm/eject.json +5 -0
  230. package/examples/parallel-swarm/harness.ts +83 -71
  231. package/examples/parallel-swarm/report.ts +33 -0
  232. package/examples/peermesh/README.md +1 -1
  233. package/examples/services/agent-control/README.md +1 -1
  234. package/examples/services/mathlib-search/README.md +1 -1
  235. package/examples/services/mcp-managed/README.md +1 -1
  236. package/examples/services/persistent-board/README.md +6 -3
  237. package/examples/subagents/AGENTS.md +35 -0
  238. package/examples/subagents/README.md +129 -93
  239. package/examples/subagents/config.ts +9 -15
  240. package/examples/subagents/eject.json +17 -0
  241. package/examples/subagents/handoff-config.ts +14 -0
  242. package/examples/subagents/model.ts +20 -0
  243. package/examples/substrate/README.md +12 -6
  244. package/examples/super/README.md +34 -22
  245. package/examples/super/actions.ts +11 -11
  246. package/examples/super/config.ts +3 -3
  247. package/examples/super/eject.json +1 -1
  248. package/examples/super/location.ts +1 -1
  249. package/examples/super/operator.ts +28 -0
  250. package/examples/super/project.ts +1 -3
  251. package/examples/taskpool/README.md +1 -1
  252. package/npm-shrinkwrap.development.json +46 -1538
  253. package/npm-shrinkwrap.json +10 -43
  254. package/package.development.json +3 -6
  255. package/package.json +3 -5
  256. package/scripts/anyswarm-arguments.ts +67 -96
  257. package/scripts/anyswarm-eject.ts +1 -1
  258. package/scripts/anyswarm-harnesses.ts +1 -18
  259. package/scripts/anyswarm-installation.ts +18 -294
  260. package/scripts/anyswarm-launch.ts +30 -102
  261. package/scripts/anyswarm-progress.ts +125 -0
  262. package/scripts/anyswarm-project.ts +31 -123
  263. package/scripts/anyswarm-source-runner.ts +9 -36
  264. package/scripts/anyswarm.ts +4 -24
  265. package/scripts/generate-architecture-coverage.ts +1 -1
  266. package/scripts/generate-architecture-prompts.ts +21 -10
  267. package/scripts/local-environment.ts +79 -21
  268. package/scripts/local-setup.ts +150 -105
  269. package/scripts/pack-release.ts +28 -4
  270. package/src/core/index.ts +1 -1
  271. package/src/core/sandbox/opensandbox-backend.ts +10 -4
  272. package/src/core/sandbox/sandbox-connection.ts +22 -7
  273. package/src/core/worker-image.ts +1 -1
  274. package/src/harness/project-harness.ts +5 -4
  275. package/src/harness/project-rpc-client.ts +23 -0
  276. package/src/harness/project-runtime.ts +2 -1
  277. package/src/harness/typescript-loader.ts +28 -8
  278. package/src/trace-viewer/command.mjs +6 -3
  279. package/src/trace-viewer/public/app.js +239 -59
  280. package/src/trace-viewer/public/index.html +5 -0
  281. package/src/trace-viewer/public/style.css +22 -0
  282. package/src/trace-viewer/reader.mjs +242 -26
  283. package/src/trace-viewer/run-root.d.mts +1 -0
  284. package/src/trace-viewer/run-root.mjs +7 -0
  285. package/src/trace-viewer/server.mjs +3 -1
  286. package/dist/scripts/anyswarm-applications.d.ts +0 -19
  287. package/dist/scripts/anyswarm-applications.js +0 -19
  288. package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
  289. package/dist/scripts/anyswarm-tui-config.js +0 -189
  290. package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
  291. package/dist/scripts/anyswarm-tui-session.js +0 -304
  292. package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
  293. package/dist/scripts/anyswarm-tui-terminal.js +0 -154
  294. package/dist/scripts/anyswarm-tui.d.ts +0 -2
  295. package/dist/scripts/anyswarm-tui.js +0 -1012
  296. package/docs/architecture/25-foreground-tui.md +0 -51
  297. package/scripts/anyswarm-applications.ts +0 -39
  298. package/scripts/anyswarm-tui-config.ts +0 -174
  299. package/scripts/anyswarm-tui-session.ts +0 -295
  300. package/scripts/anyswarm-tui-terminal.ts +0 -147
  301. package/scripts/anyswarm-tui.ts +0 -912
@@ -59,6 +59,8 @@ const state = {
59
59
  inspectorGeneration: 0,
60
60
  pageGeneration: 0,
61
61
  sidebarOpen: true,
62
+ root: null,
63
+ rootStatus: null,
62
64
  };
63
65
 
64
66
  let mmBuiltKey = "";
@@ -69,6 +71,10 @@ let swimlaneDragged = false;
69
71
  let timelineLoadTimer = null;
70
72
  let timelineSearchTimer = null;
71
73
  let eventSearchTimer = null;
74
+ let runListTimer = null;
75
+ let runListRequest = null;
76
+ let pageActive = true;
77
+ let runListSignature = null;
72
78
 
73
79
  function element(tag, className, text) {
74
80
  const node = document.createElement(tag);
@@ -219,13 +225,18 @@ function navigationKey(hash, search, query) {
219
225
  function saveNavigation(replace = false) {
220
226
  navigationParameters(); // Scrub legacy addresses even while a Run is loading.
221
227
  if (!state.run || state.restoring || !window.history) return;
222
- const params = new URLSearchParams({ run: state.run.id, view: state.view, scale: state.scale, memberView: state.memberView });
223
- const fields = { member: state.memberFilter, agent: state.agentFilter, track: state.trackFilter,
228
+ const reportOnly = state.run.kind === "harness";
229
+ const params = new URLSearchParams(reportOnly
230
+ ? { run: state.run.id, view: "artifacts" }
231
+ : { run: state.run.id, view: state.view, scale: state.scale, memberView: state.memberView });
232
+ const fields = reportOnly ? {} : { member: state.memberFilter, agent: state.agentFilter, track: state.trackFilter,
224
233
  eventAgent: $("#agent-filter").value, type: $("#type-filter").value,
225
234
  attention: $("#attention-filter").checked ? "1" : "" };
226
235
  for (const [key, value] of Object.entries(fields)) if (value) params.set(key, value);
227
- params.set("from", String(Math.round(state.domainStart + state.winStart)));
228
- params.set("to", String(Math.round(state.domainStart + state.winEnd)));
236
+ if (!reportOnly) {
237
+ params.set("from", String(Math.round(state.domainStart + state.winStart)));
238
+ params.set("to", String(Math.round(state.domainStart + state.winEnd)));
239
+ }
229
240
  if (state.inspection) {
230
241
  params.set("selection", state.inspection.kind);
231
242
  params.set("key", state.inspection.key);
@@ -243,6 +254,13 @@ function saveNavigation(replace = false) {
243
254
  }
244
255
 
245
256
  async function applyNavigation(params, generation) {
257
+ if (state.run.kind === "harness") {
258
+ switchView("artifacts");
259
+ if (params.get("selection") === "file" && params.get("key")) {
260
+ await inspectFile(params.get("key"), 0, false, params.get("identity"));
261
+ }
262
+ return;
263
+ }
246
264
  state.memberView = params.get("memberView") === "instances" ? "instances" : "members";
247
265
  state.memberFilter = (state.run.members ?? []).some(member => member.id === params.get("member")) ? params.get("member") : "";
248
266
  state.agentFilter = params.get("agent") ?? "";
@@ -294,31 +312,100 @@ async function restoreNavigation() {
294
312
  // ============================================================================
295
313
  // RUN LIST & LOADING
296
314
  // ============================================================================
297
- async function loadRuns() {
298
- navigationParameters(); // Remove legacy search text before the first request.
299
- try {
300
- $("#error").hidden = true;
315
+ function stopRunListPolling() {
316
+ clearTimeout(runListTimer);
317
+ runListTimer = null;
318
+ }
319
+
320
+ function scheduleRunListPolling() {
321
+ stopRunListPolling();
322
+ if (!pageActive || document.visibilityState === "hidden") return;
323
+ runListTimer = setTimeout(() => {
324
+ runListTimer = null;
325
+ loadRuns();
326
+ }, 2000);
327
+ // The same browser script runs in the Node client tests; its idle timer must
328
+ // not keep a completed test process alive. Browser timers have no unref.
329
+ runListTimer?.unref?.();
330
+ }
331
+
332
+ function renderRunRoot() {
333
+ const root = $("#run-root");
334
+ if (root) {
335
+ root.hidden = !state.root;
336
+ root.textContent = state.root ?? "";
337
+ root.title = state.root ?? "";
338
+ }
339
+ const status = $("#run-list-status");
340
+ if (status) status.textContent = state.rootStatus === "missing"
341
+ ? "Waiting for the Run directory."
342
+ : "New Runs appear automatically.";
343
+ $("#empty-help").textContent = state.runs.length
344
+ ? "Choose a Run from the sidebar."
345
+ : state.rootStatus === "missing"
346
+ ? "The Run directory does not exist yet. Waiting for the first saved Run."
347
+ : "No Runs found in the configured root. Waiting for saved Run records.";
348
+ }
349
+
350
+ async function refreshHarnessReport() {
351
+ if (state.run?.kind !== "harness" || state.restoring) return;
352
+ const generation = state.generation;
353
+ const id = state.run.id;
354
+ const run = await api(runPath());
355
+ if (generation !== state.generation || state.run?.id !== id || state.run.kind !== "harness") return;
356
+ if (JSON.stringify(run) !== JSON.stringify(state.run)) {
357
+ state.run = run;
358
+ const focusedFile = document.activeElement?.dataset?.filePath;
359
+ const focusedAction = document.activeElement?.dataset?.reportAction;
360
+ renderSummary();
361
+ if (focusedAction) {
362
+ for (const action of document.querySelectorAll("[data-report-action]")) {
363
+ if (action.dataset.reportAction === focusedAction) action.focus({ preventScroll: true });
364
+ }
365
+ } else if (focusedFile) {
366
+ for (const row of $("#files").children) {
367
+ if (row.dataset.filePath === focusedFile) row.focus({ preventScroll: true });
368
+ }
369
+ }
370
+ }
371
+ }
372
+
373
+ function loadRuns() {
374
+ // Manual refresh, visibility changes and the timer share the same request.
375
+ if (runListRequest) return runListRequest;
376
+ stopRunListPolling();
377
+ runListRequest = (async () => {
378
+ navigationParameters(); // Remove legacy search text before the first request.
301
379
  const result = await api("/api/runs");
302
380
  state.runs = result.runs ?? result;
303
- renderRuns();
381
+ if (typeof result.root === "string") state.root = result.root;
382
+ state.rootStatus = result.rootStatus ?? null;
383
+ const signature = JSON.stringify(state.runs);
384
+ if (signature !== runListSignature) {
385
+ renderRuns();
386
+ runListSignature = signature;
387
+ }
388
+ renderRunRoot();
304
389
  const navigation = navigationParameters();
305
390
  const requested = navigation.get("run");
306
- if (!state.run) {
307
- if (requested && state.runs.some((run) => run.id === requested)) {
308
- await openRun(requested, navigation);
309
- } else if (requested) {
310
- throw new Error("The linked Run is unavailable");
311
- } else if (state.runs.length === 1) {
312
- await openRun(state.runs[0].id);
313
- }
314
- }
315
- if (!state.runs.length) {
316
- $("#empty-help").textContent =
317
- "No Runs found in the configured root. Add a recorded Run directory, then refresh.";
318
- }
319
- } catch (error) {
320
- showError(error);
321
- }
391
+ if (!state.run && !state.restoring) {
392
+ // A saved Harness link remains addressable after the list deduplicates it
393
+ // with its Runtime. The backend validates that explicit identity.
394
+ if (requested) await openRun(requested, navigation);
395
+ else if (state.runs.length === 1) await openRun(state.runs[0].id);
396
+ } else await refreshHarnessReport();
397
+ if ($("#run-list-error")) $("#run-list-error").hidden = true;
398
+ })().catch(error => {
399
+ const banner = $("#run-list-error");
400
+ if (banner) {
401
+ banner.hidden = false;
402
+ banner.textContent = `Could not refresh Runs: ${error.message ?? String(error)}`;
403
+ } else showError(error);
404
+ }).finally(() => {
405
+ runListRequest = null;
406
+ scheduleRunListPolling();
407
+ });
408
+ return runListRequest;
322
409
  }
323
410
 
324
411
  function renderRuns() {
@@ -329,13 +416,19 @@ function renderRuns() {
329
416
  .includes(query),
330
417
  );
331
418
  $("#run-count").textContent = `RUNS (${runs.length})`;
332
- $("#runs").replaceChildren();
419
+ const container = $("#runs");
420
+ const scrollTop = container.scrollTop;
421
+ const focusedId = document.activeElement?.dataset?.runId;
422
+ let focusedCard;
423
+ container.replaceChildren();
333
424
  for (const run of runs) {
334
425
  const card = button(
335
426
  "",
336
427
  `run-card${state.run?.id === run.id ? " selected" : ""}`,
337
428
  () => openRun(run.id).catch(showError),
338
429
  );
430
+ card.dataset.runId = run.id;
431
+ if (run.id === focusedId) focusedCard = card;
339
432
  card.setAttribute(
340
433
  "aria-current",
341
434
  state.run?.id === run.id ? "page" : "false",
@@ -355,7 +448,7 @@ function renderRuns() {
355
448
  document.createTextNode(statusText),
356
449
  );
357
450
  top.append(
358
- element("span", "muted", `${run.agentCount ?? 0} agents`),
451
+ element("span", "muted", run.kind === "harness" ? "Harness report" : `${run.agentCount ?? 0} agents`),
359
452
  statusWrap,
360
453
  );
361
454
  const title = element("div", "run-card-title", run.label ?? shortId(run.id));
@@ -374,6 +467,8 @@ function renderRuns() {
374
467
  if (!runs.length) {
375
468
  $("#runs").append(element("p", "empty-state", "No matching Runs."));
376
469
  }
470
+ focusedCard?.focus({ preventScroll: true });
471
+ container.scrollTop = scrollTop;
377
472
  }
378
473
 
379
474
  async function openRun(id, navigation) {
@@ -387,6 +482,7 @@ async function openRun(id, navigation) {
387
482
  clearTimeout(timelineSearchTimer);
388
483
  clearTimeout(eventSearchTimer);
389
484
  state.stream?.close();
485
+ state.stream = null;
390
486
  const runView = $("#run-view");
391
487
  runView.inert = true;
392
488
  let restored = false;
@@ -422,15 +518,22 @@ async function openRun(id, navigation) {
422
518
  $("#event-search").value = "";
423
519
  $("#attention-filter").checked = false;
424
520
  $("#timeline-search").value = "";
425
- renderTimelineSearch();
426
- rebuildTimelineModel(true);
427
- renderSummary();
428
- renderRuns();
429
- if (navigation) await applyNavigation(navigation, generation);
430
- else await loadPage(0);
521
+ if (run.kind === "harness") {
522
+ switchView("artifacts");
523
+ renderSummary();
524
+ renderRuns();
525
+ if (navigation) await applyNavigation(navigation, generation);
526
+ } else {
527
+ renderTimelineSearch();
528
+ rebuildTimelineModel(true);
529
+ renderSummary();
530
+ renderRuns();
531
+ if (navigation) await applyNavigation(navigation, generation);
532
+ else await loadPage(0);
533
+ }
431
534
  if (generation !== state.generation) return;
432
535
  restored = true;
433
- connectLive(run.cursor ?? 0);
536
+ if (run.kind !== "harness") connectLive(run.cursor ?? 0);
434
537
  } catch (error) {
435
538
  if (generation === state.generation) throw error;
436
539
  } finally {
@@ -657,8 +760,39 @@ function panByFraction(fracDelta) {
657
760
  function renderSummary() {
658
761
  const run = state.run;
659
762
  if (!run) return;
763
+ const reportOnly = run.kind === "harness";
764
+ for (const tab of document.querySelectorAll("[data-view]")) {
765
+ tab.hidden = reportOnly && tab.dataset.view !== "artifacts";
766
+ }
767
+ $("#follow").hidden = reportOnly;
768
+ $("#cursor-readout").hidden = reportOnly;
660
769
  $("#run-title").textContent = run.label ?? "Run trace";
661
770
  $("#run-harness").textContent = run.harness ?? "Trace";
771
+ if (reportOnly) {
772
+ $("#run-subtitle").textContent = `HARNESS RUN ${run.runId ?? run.id}`;
773
+ $("#live-state").textContent = "Saved Harness report";
774
+ $("#live-state").classList.remove("connected");
775
+ renderStatusCells([
776
+ ["Business outcome", run.outcome?.status ?? run.status],
777
+ ["Export", run.export ?? "Not recorded"],
778
+ ["Cleanup", run.cleanup ?? "Not recorded"],
779
+ ]);
780
+ $("#service-states")?.replaceChildren();
781
+ $("#attention")?.replaceChildren();
782
+ const notice = element("div", "gap");
783
+ const gaps = (run.gaps ?? []).map(gap => element("div", "gap", gap.message ?? pretty(gap)));
784
+ if (run.linkedRuntime) {
785
+ notice.append(element("span", "", "A matching Runtime record is available. "));
786
+ const openRuntime = button("Open Runtime trace", "button", () => openRun(run.linkedRuntime.id).catch(showError));
787
+ openRuntime.dataset.reportAction = "runtime";
788
+ notice.append(openRuntime);
789
+ } else {
790
+ notice.textContent = (gaps.length ? "" : "No Runtime record found. ") + "Showing the saved Harness report.";
791
+ }
792
+ $("#gaps").replaceChildren(notice, ...gaps);
793
+ renderFiles();
794
+ return;
795
+ }
662
796
  $("#run-subtitle").textContent =
663
797
  `RUNTIME ${run.runtimeId ?? run.id} · ${
664
798
  Number.isFinite(dateValue(run.startedAt))
@@ -689,21 +823,7 @@ function renderSummary() {
689
823
  ["Model / Service / Tool", `${modelCnt} / ${svcCnt} / ${toolCnt}`],
690
824
  ["Cleanup", run.cleanup],
691
825
  ];
692
- $("#status-strip").replaceChildren(
693
- ...cells.map(([label, value]) => {
694
- const cell = element("div", "status-cell");
695
- cell.append(
696
- element("div", "status-label", label),
697
- element(
698
- "div",
699
- `status-value ${statusClass(value)}`,
700
- statusLabel(value),
701
- ),
702
- );
703
- cell.title = pretty(value);
704
- return cell;
705
- }),
706
- );
826
+ renderStatusCells(cells);
707
827
 
708
828
  const serviceStates = $("#service-states");
709
829
  if (serviceStates) {
@@ -778,6 +898,18 @@ function renderSummary() {
778
898
  renderAttention();
779
899
  }
780
900
 
901
+ function renderStatusCells(cells) {
902
+ $("#status-strip").replaceChildren(...cells.map(([label, value]) => {
903
+ const cell = element("div", "status-cell");
904
+ cell.append(
905
+ element("div", "status-label", label),
906
+ element("div", `status-value ${statusClass(value)}`, statusLabel(value)),
907
+ );
908
+ cell.title = pretty(value);
909
+ return cell;
910
+ }));
911
+ }
912
+
781
913
  // ============================================================================
782
914
  // PERSISTENT 60FPS OVERVIEW MINIMAP NAVIGATOR
783
915
  // ============================================================================
@@ -2131,11 +2263,14 @@ function renderFiles() {
2131
2263
  );
2132
2264
  outcome.append(heading, element("pre", "outcome-body", pretty(state.run.outcome)));
2133
2265
 
2134
- outcome.append(rawSection("Recorded verification", state.run.verification ?? "Not recorded"), rawSection("Pending cleanup resources", state.run.pendingResources ?? "Not recorded"), rawSection("Export status", state.run.export ?? "Not recorded"));
2266
+ outcome.append(rawSection("Recorded verification", state.run.verification ?? "Not recorded", "verification"), rawSection("Pending cleanup resources", state.run.pendingResources ?? "Not recorded", "cleanup"), rawSection("Export status", state.run.export ?? "Not recorded", "export"));
2135
2267
  const files = $("#files");
2136
2268
  files.replaceChildren();
2137
2269
  for (const file of state.run.files ?? []) {
2138
- const row = button("", "file-row", () => inspectFile(file.path));
2270
+ const identity = typeof file.sha256 === "string" && /^[a-f0-9]{64}$/i.test(file.sha256)
2271
+ ? `sha256:${file.sha256.toLowerCase()}` : undefined;
2272
+ const row = button("", "file-row", () => inspectFile(file.path, 0, false, identity));
2273
+ row.dataset.filePath = file.path;
2139
2274
  row.append(
2140
2275
  element("span", "", file.path + (file.availability ? ` · ${file.availability}` : "") + (file.sha256 ? ` · SHA-256 ${file.sha256}` : "")),
2141
2276
  element(
@@ -2166,6 +2301,7 @@ function closeInspector() {
2166
2301
  state.inspection = null;
2167
2302
  saveNavigation();
2168
2303
  $("#inspector").hidden = true;
2304
+ if (state.run?.kind === "harness") return;
2169
2305
  renderSwimlane();
2170
2306
  renderTrajectory();
2171
2307
  renderEvents();
@@ -2186,21 +2322,23 @@ function appendMetadata(container, values) {
2186
2322
  container.append(list);
2187
2323
  }
2188
2324
 
2189
- function rawSection(title, value) {
2325
+ function rawSection(title, value, reportAction) {
2190
2326
  const section = inspectorSection(title);
2191
2327
  const heading = section.firstChild;
2192
2328
  const toolbar = element("div", "raw-toolbar");
2329
+ const text = element("pre", "", pretty(value));
2193
2330
  const copy = button("Copy", "button", async () => {
2194
2331
  try {
2195
- await navigator.clipboard.writeText(pretty(value));
2332
+ await navigator.clipboard.writeText(text.textContent);
2196
2333
  copy.textContent = "Copied";
2197
2334
  setTimeout(() => (copy.textContent = "Copy"), 1200);
2198
2335
  } catch {
2199
2336
  copy.textContent = "Copy unavailable";
2200
2337
  }
2201
2338
  });
2339
+ if (reportAction) copy.dataset.reportAction = reportAction;
2202
2340
  toolbar.append(heading, copy);
2203
- section.append(toolbar, element("pre", "", pretty(value)));
2341
+ section.append(toolbar, text);
2204
2342
  return section;
2205
2343
  }
2206
2344
 
@@ -2347,9 +2485,11 @@ function renderRecordDetail(detail) {
2347
2485
  }
2348
2486
 
2349
2487
  const nodes = [title];
2488
+ const omittedRecord = !Object.hasOwn(detail, "record");
2489
+ const omittedMessage = "Source record body is unavailable in this preview.";
2350
2490
 
2351
2491
  if (state.inspectorMode === "raw") {
2352
- nodes.push(rawSection("Raw source record", detail.record));
2492
+ nodes.push(omittedRecord ? element("p", "gap", omittedMessage) : rawSection("Raw source record", detail.record));
2353
2493
  } else {
2354
2494
  const metadata = inspectorSection("Recorded identity");
2355
2495
  appendMetadata(metadata, [
@@ -2366,13 +2506,32 @@ function renderRecordDetail(detail) {
2366
2506
  ]);
2367
2507
  nodes.push(metadata);
2368
2508
 
2509
+ if (detail.research) {
2510
+ const section = inspectorSection("Research evidence");
2511
+ appendMetadata(section, [
2512
+ ["Candidate", (detail.record?.candidate ?? event.candidate)], ["Patch SHA-256", (detail.record?.sha256 ?? event.sha256)],
2513
+ ["Parent candidate", (detail.record?.basedOn ?? event.basedOn)], ["Official job", (detail.record?.officialJob ?? event.officialJob)],
2514
+ ["Official payload digest", (detail.record?.payloadDigest ?? event.payloadDigest)], ["Score", (detail.record?.score ?? event.score)],
2515
+ ]);
2516
+ for (const file of detail.research.files) {
2517
+ if (file.status !== "verified") section.append(element("p", "gap", `${file.path}: ${file.status}`));
2518
+ }
2519
+ for (const related of detail.research.related) {
2520
+ section.append(button(`${related.label} · ${agentLabel(related.agentId)} ↗`, "file-row", () => locateRecord(related.id).catch(showError)));
2521
+ }
2522
+ if (detail.research.relatedTotal > detail.research.related.length) {
2523
+ section.append(element("p", "muted", `Showing ${detail.research.related.length} of ${detail.research.relatedTotal} related records. Search the timeline by patch SHA-256 for all matches.`));
2524
+ }
2525
+ nodes.push(section);
2526
+ }
2527
+
2369
2528
  if (Object.hasOwn(detail, "serviceStates")) nodes.push(...serviceStateSections(detail.serviceStates));
2370
2529
 
2371
2530
  if (detail.contextMatches?.length) {
2372
2531
  nodes.push(contextMatchesSection(detail.contextMatches));
2373
2532
  }
2374
2533
 
2375
- if (detail.truncated) nodes.push(element("p", "gap", "Record display is truncated. Open the related raw file and load further ranges."));
2534
+ if (detail.truncated && !omittedRecord) nodes.push(element("p", "gap", "Record display is truncated. Open the related raw file and load further ranges."));
2376
2535
  const request = requestEvidence(detail.record);
2377
2536
  if (request) {
2378
2537
  const fields = inspectorSection("Saved request payload");
@@ -2402,14 +2561,14 @@ function renderRecordDetail(detail) {
2402
2561
  sec.append(stack);
2403
2562
  nodes.push(sec);
2404
2563
  } else {
2405
- nodes.push(rawSection("Source record", detail.record));
2564
+ nodes.push(omittedRecord ? element("p", "gap", omittedMessage) : rawSection("Source record", detail.record));
2406
2565
  }
2407
2566
 
2408
2567
  const relatedFiles = (detail.files ?? []).filter(file => !detail.serviceStates?.some(snapshot => snapshot.path === file.path));
2409
2568
  if (relatedFiles.length) {
2410
2569
  const files = inspectorSection("Related evidence");
2411
2570
  for (const file of relatedFiles) {
2412
- files.append(button(file.path, "file-row", () => inspectFile(file.path)));
2571
+ files.append(button(file.path, "file-row", () => inspectFile(file.path, 0, false, file.identity)));
2413
2572
  }
2414
2573
  nodes.push(files);
2415
2574
  }
@@ -2588,6 +2747,10 @@ async function inspectFile(path, offset = 0, append = false, identity) {
2588
2747
  );
2589
2748
  more.id = "load-file-more";
2590
2749
  $("#inspector-content").append(more);
2750
+ } else if (file.previewLimited) {
2751
+ $("#inspector-content").append(
2752
+ element("p", "gap", "End of the static preview. Open the original Run in the installed Trace Viewer for the full file."),
2753
+ );
2591
2754
  }
2592
2755
  } catch (error) {
2593
2756
  if (generation === state.inspectorGeneration) {
@@ -2603,6 +2766,8 @@ async function inspectFile(path, offset = 0, append = false, identity) {
2603
2766
  // ============================================================================
2604
2767
  function connectLive(cursor) {
2605
2768
  state.stream?.close();
2769
+ state.stream = null;
2770
+ if (!pageActive || state.run?.kind === "harness") return;
2606
2771
  const generation = state.generation;
2607
2772
  const stream = new EventSource(
2608
2773
  runPath(`/live?cursor=${encodeURIComponent(cursor)}`),
@@ -2750,6 +2915,7 @@ function connectLive(cursor) {
2750
2915
  }
2751
2916
 
2752
2917
  function switchView(view) {
2918
+ if (state.run?.kind === "harness") view = "artifacts";
2753
2919
  state.view = view;
2754
2920
  saveNavigation();
2755
2921
  for (const item of document.querySelectorAll("[data-view]")) {
@@ -2935,5 +3101,19 @@ window.addEventListener("keydown", (event) => {
2935
3101
 
2936
3102
  window.addEventListener("popstate", restoreNavigation);
2937
3103
  window.addEventListener("hashchange", restoreNavigation);
2938
- window.addEventListener("pagehide", () => state.stream?.close());
3104
+ window.addEventListener("pagehide", () => {
3105
+ pageActive = false;
3106
+ stopRunListPolling();
3107
+ state.stream?.close();
3108
+ state.stream = null;
3109
+ });
3110
+ window.addEventListener("pageshow", () => {
3111
+ pageActive = true;
3112
+ loadRuns();
3113
+ if (state.run && state.run.kind !== "harness" && !state.stream) connectLive(state.run.cursor ?? 0);
3114
+ });
3115
+ document.addEventListener?.("visibilitychange", () => {
3116
+ if (document.visibilityState === "hidden") stopRunListPolling();
3117
+ else if (pageActive) loadRuns();
3118
+ });
2939
3119
  loadRuns();
@@ -85,6 +85,11 @@
85
85
  aria-label="Find a Run"
86
86
  />
87
87
  </label>
88
+ <div class="run-root-info">
89
+ <code id="run-root" hidden></code>
90
+ <span id="run-list-status">New Runs appear automatically.</span>
91
+ <span id="run-list-error" role="status" hidden></span>
92
+ </div>
88
93
  <nav id="runs" aria-label="Choose a Run">
89
94
  <p class="muted empty-state">Loading Runs…</p>
90
95
  </nav>
@@ -303,6 +303,26 @@ h3 {
303
303
  gap: 6px;
304
304
  }
305
305
 
306
+ .run-root-info {
307
+ display: grid;
308
+ gap: 5px;
309
+ margin: 0 4px 12px;
310
+ color: var(--muted);
311
+ font-size: 10px;
312
+ line-height: 1.5;
313
+ }
314
+
315
+ #run-root {
316
+ overflow-wrap: anywhere;
317
+ max-height: 5em;
318
+ overflow: auto;
319
+ user-select: text;
320
+ }
321
+
322
+ #run-list-error {
323
+ color: var(--red);
324
+ }
325
+
306
326
  .run-card {
307
327
  display: block;
308
328
  width: 100%;
@@ -1201,6 +1221,7 @@ h3 {
1201
1221
 
1202
1222
  .inspector-header {
1203
1223
  display: flex;
1224
+ flex-wrap: wrap;
1204
1225
  justify-content: space-between;
1205
1226
  align-items: center;
1206
1227
  gap: 10px;
@@ -1212,6 +1233,7 @@ h3 {
1212
1233
 
1213
1234
  .inspector-header-actions {
1214
1235
  display: flex;
1236
+ flex-wrap: wrap;
1215
1237
  align-items: center;
1216
1238
  gap: 8px;
1217
1239
  }