@mndrk/agx 2.0.16 → 2.0.18

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 (182) hide show
  1. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/BUILD_ID +1 -1
  2. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/app-path-routes-manifest.json +1 -0
  3. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/build-manifest.json +2 -2
  4. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/prerender-manifest.json +3 -3
  5. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/routes-manifest.json +6 -0
  6. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.html +2 -2
  7. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.rsc +1 -1
  8. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.html +2 -2
  14. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.rsc +1 -1
  15. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  16. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  17. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  18. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  19. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  20. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/agents.html +2 -2
  22. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/agents.rsc +1 -1
  23. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/agents.segments/_full.segment.rsc +1 -1
  24. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/agents.segments/_head.segment.rsc +1 -1
  25. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/agents.segments/_index.segment.rsc +1 -1
  26. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/agents.segments/_tree.segment.rsc +1 -1
  27. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/agents.segments/agents/__PAGE__.segment.rsc +1 -1
  28. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/agents.segments/agents.segment.rsc +1 -1
  29. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/chat/route.js +1 -1
  30. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/chat/route.js.nft.json +1 -1
  31. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/file-search/route.js.nft.json +1 -1
  32. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/health/route.js.nft.json +1 -1
  33. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/learnings/route.js.nft.json +1 -1
  34. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/logs/stream/route.js.nft.json +1 -1
  35. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/memories/route.js.nft.json +1 -1
  36. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/cancel/route.js.nft.json +1 -1
  37. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/signal/route.js.nft.json +1 -1
  38. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/start/route.js.nft.json +1 -1
  39. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/status/route.js.nft.json +1 -1
  40. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/participants/route.js.nft.json +1 -1
  41. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/processes/route/app-paths-manifest.json +3 -0
  42. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/processes/route/build-manifest.json +11 -0
  43. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/processes/route/server-reference-manifest.json +4 -0
  44. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/processes/route.js +8 -0
  45. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/processes/route.js.map +5 -0
  46. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/processes/route.js.nft.json +1 -0
  47. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/processes/route_client-reference-manifest.js +2 -0
  48. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v1/route.js.nft.json +1 -1
  49. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v2/route.js.nft.json +1 -1
  50. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
  51. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/route.js.nft.json +1 -1
  52. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/complete/route.js.nft.json +1 -1
  53. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/route.js.nft.json +1 -1
  54. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/[commentId]/route.js.nft.json +1 -1
  55. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/route.js.nft.json +1 -1
  56. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/costs/route.js.nft.json +1 -1
  57. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route.js.nft.json +1 -1
  58. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/events/route.js.nft.json +1 -1
  59. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/history/route.js.nft.json +1 -1
  60. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/metrics/route.js.nft.json +1 -1
  61. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/pause/route.js.nft.json +1 -1
  62. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/replan/route.js.nft.json +1 -1
  63. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/restart/route.js.nft.json +1 -1
  64. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/resume/route.js.nft.json +1 -1
  65. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/rollback/route.js.nft.json +1 -1
  66. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/route.js.nft.json +1 -1
  67. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/start/route.js.nft.json +1 -1
  68. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/stop/route.js.nft.json +1 -1
  69. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/heartbeat/route.js.nft.json +1 -1
  70. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/history/route.js.nft.json +1 -1
  71. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/route.js.nft.json +1 -1
  72. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route.js.nft.json +1 -1
  73. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/comments/route.js.nft.json +1 -1
  74. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/complete/route.js.nft.json +1 -1
  75. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/fail/route.js.nft.json +1 -1
  76. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/resume/route.js.nft.json +1 -1
  77. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/start/route.js.nft.json +1 -1
  78. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/stop/route.js.nft.json +1 -1
  79. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/verify/route.js.nft.json +1 -1
  80. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -1
  81. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/assign-orphans/route.js.nft.json +1 -1
  82. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route.js.nft.json +1 -1
  83. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/stream/route.js.nft.json +1 -1
  84. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/teams/[id]/agents/route.js.nft.json +1 -1
  85. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/teams/[id]/route.js.nft.json +1 -1
  86. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/teams/route.js.nft.json +1 -1
  87. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/user-settings/route.js.nft.json +1 -1
  88. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.html +2 -2
  89. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.rsc +1 -1
  90. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/_full.segment.rsc +1 -1
  91. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/_head.segment.rsc +1 -1
  92. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/_index.segment.rsc +1 -1
  93. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/_tree.segment.rsc +1 -1
  94. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/board/__PAGE__.segment.rsc +1 -1
  95. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/board.segment.rsc +1 -1
  96. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.html +2 -2
  97. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.rsc +1 -1
  98. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/_full.segment.rsc +1 -1
  99. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/_head.segment.rsc +1 -1
  100. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/_index.segment.rsc +1 -1
  101. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/_tree.segment.rsc +1 -1
  102. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/execution-graph/__PAGE__.segment.rsc +1 -1
  103. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/execution-graph.segment.rsc +1 -1
  104. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.html +2 -2
  105. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.rsc +1 -1
  106. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  107. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/_full.segment.rsc +1 -1
  108. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/_head.segment.rsc +1 -1
  109. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/_index.segment.rsc +1 -1
  110. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  111. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.html +1 -1
  112. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.rsc +1 -1
  113. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/_full.segment.rsc +1 -1
  114. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/_head.segment.rsc +1 -1
  115. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/_index.segment.rsc +1 -1
  116. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/_tree.segment.rsc +1 -1
  117. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/projects/orphans/__PAGE__.segment.rsc +1 -1
  118. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/projects/orphans.segment.rsc +1 -1
  119. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/projects.segment.rsc +1 -1
  120. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.html +2 -2
  121. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.rsc +1 -1
  122. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/_full.segment.rsc +1 -1
  123. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/_head.segment.rsc +1 -1
  124. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/_index.segment.rsc +1 -1
  125. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/_tree.segment.rsc +1 -1
  126. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/projects/__PAGE__.segment.rsc +1 -1
  127. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/projects.segment.rsc +1 -1
  128. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.html +2 -2
  129. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.rsc +1 -1
  130. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/_full.segment.rsc +1 -1
  131. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  132. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/_index.segment.rsc +1 -1
  133. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  134. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
  135. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  136. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.html +2 -2
  137. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.rsc +1 -1
  138. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/_full.segment.rsc +1 -1
  139. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/_head.segment.rsc +1 -1
  140. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/_index.segment.rsc +1 -1
  141. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/_tree.segment.rsc +1 -1
  142. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/status/__PAGE__.segment.rsc +1 -1
  143. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/status.segment.rsc +1 -1
  144. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.html +2 -2
  145. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.rsc +1 -1
  146. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/_full.segment.rsc +1 -1
  147. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/_head.segment.rsc +1 -1
  148. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/_index.segment.rsc +1 -1
  149. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/_tree.segment.rsc +1 -1
  150. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/welcome/__PAGE__.segment.rsc +1 -1
  151. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/welcome.segment.rsc +1 -1
  152. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app-paths-manifest.json +1 -0
  153. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/7e210_Agents_agx-cloud__next-internal_server_app_api_processes_route_actions_3d9dbdd8.js +3 -0
  154. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/Projects_Agents_agx-cloud_ef3cf579._.js +7 -7
  155. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/Projects_Agents_agx-cloud_lib_6041e016._.js +14 -3
  156. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/Projects_Agents_agx-cloud_lib_6a5d1c80._.js +25 -14
  157. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/Projects_Agents_agx-cloud_lib_7eefb426._.js +9 -9
  158. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/Projects_Agents_agx-cloud_lib_8c82981b._.js +14 -3
  159. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/{[root-of-the-server]__42ab2b45._.js → [root-of-the-server]__39768bc0._.js} +35 -34
  160. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/[root-of-the-server]__481a7f9c._.js +4 -0
  161. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/[root-of-the-server]__5ad371f3._.js +7 -7
  162. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/[root-of-the-server]__d339de9d._.js +15 -15
  163. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ae43b_next_dist_esm_build_templates_app-route_122e31fe.js +16 -16
  164. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/middleware-manifest.json +5 -5
  165. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/404.html +1 -1
  166. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/500.html +2 -2
  167. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.js +1 -1
  168. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.json +1 -1
  169. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/app/api/chat/route.ts +5 -3
  170. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/app/api/processes/route.ts +6 -0
  171. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/lib/agent-process-registry.ts +126 -0
  172. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/lib/cli-runner.ts +7 -0
  173. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/lib/sqlite-query-adapter.ts +15 -0
  174. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/lib/stream-multiplexer.ts +24 -0
  175. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/tsconfig.tsbuildinfo +1 -1
  176. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/worker/index.js +20 -3
  177. package/lib/cli/runCli.js +4 -0
  178. package/lib/commands/update.js +51 -0
  179. package/package.json +1 -1
  180. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{cQx_idFVUUY_8HM8dQbVC → 1H85C8T4JXGTcuoMfgKmi}/_buildManifest.js +0 -0
  181. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{cQx_idFVUUY_8HM8dQbVC → 1H85C8T4JXGTcuoMfgKmi}/_clientMiddlewareManifest.json +0 -0
  182. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{cQx_idFVUUY_8HM8dQbVC → 1H85C8T4JXGTcuoMfgKmi}/_ssgManifest.js +0 -0
@@ -1,9 +1,9 @@
1
- module.exports=[73590,e=>{"use strict";var t=e.i(11794),n=e.i(41852),i=e.i(19309),r=e.i(90850),a=e.i(24918),o=e.i(84604),s=e.i(37756),l=e.i(90661),d=e.i(90315),c=e.i(9168),u=e.i(12965),p=e.i(43715),f=e.i(79218),m=e.i(66263),h=e.i(15255),g=e.i(93695);e.i(65858);var y=e.i(95175),w=e.i(13466),v=e.i(24868),S=e.i(14189),$=e.i(64246);let I=new Set(["ack","working","done","clarify","blocked"]),b=/\[reaction\s+([^\]]+)\]/gi,R=/([a-zA-Z][a-zA-Z0-9_]*)=(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|([^\s\]]*?(?=\s|]|[a-zA-Z][a-zA-Z0-9_]*=|$)))/g;var x=e.i(3994),C=e.i(74949),E=e.i(22734),k=e.i(14747),j=e.i(46786);let A=(0,k.join)((0,j.homedir)(),".agx","agents");function O(e,t,n){try{let i;i=(0,k.join)(A,e),(0,E.existsSync)(i)||(0,E.mkdirSync)(i,{recursive:!0});let r={t:new Date().toISOString(),agent:e,action:t,...n};(0,E.appendFileSync)((0,k.join)(A,e,"activity.jsonl"),JSON.stringify(r)+"\n","utf-8")}catch{}}let T=(0,k.join)((0,j.homedir)(),".agx","agents");function N(e){return(0,k.join)(T,e,"self.md")}function M(e){let t=N(e);if(!(0,E.existsSync)(t))return null;let n=(0,E.readFileSync)(t,"utf-8");if(!n.trim())return null;let i=n.split("\n"),r=0,a=new Date().toISOString(),o=0;if("---"===i[0])for(let e=1;e<i.length;e++){if("---"===i[e]){o=e+1;break}let[t,...n]=i[e].split(": "),s=n.join(": ");"version"===t&&(r=parseInt(s,10)||0),"derivedAt"===t&&(a=s)}return{agentId:e,content:i.slice(o).join("\n").trim(),version:r,derivedAt:a}}let D=(0,k.join)((0,j.homedir)(),".agx","agents");function P(e){return(0,k.join)(D,e)}function _(e){return(0,k.join)(P(e),"journal.jsonl")}function L(e){let t=_(e);return(0,E.existsSync)(t)?(0,E.readFileSync)(t,"utf-8").split("\n").filter(e=>e.trim()):[]}function F(e,t){let n;n=P(e),(0,E.existsSync)(n)||(0,E.mkdirSync)(n,{recursive:!0});let i=L(e),r=function(e,t){let n=0;for(let i of t)try{let t=JSON.parse(i),[r,a]=String(t.id||"").split(":");if(r!==e)continue;let o=parseInt(a||"0",10);Number.isFinite(o)&&o>n&&(n=o)}catch{}return n}(e,i),a=`${e}:${r+1}`,o={...t,id:t.id?.trim()||a},s=JSON.stringify(o)+"\n";return(0,E.appendFileSync)(_(e),s,"utf-8"),O(e,"reflection"===t.type?"reflection":"journal-post",{thread:o.thread,meta:{entryId:o.id}}),o}function U(e,t){let n=L(e),i=[];for(let e of n)try{i.push(JSON.parse(e))}catch{}return i.reverse(),t?i.slice(0,t):i}let z=(0,k.join)((0,j.homedir)(),".agx","agents");function H(){return(0,E.existsSync)(z)?(0,E.readdirSync)(z,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name):[]}let q=(0,k.join)((0,j.homedir)(),".agx","agents"),B=new Map,W=new Map;function J(e,t){var n,i,r;let a,o,s,l,d,c,u,p,f;i=e.id,r={voice:`${e.name} style`,seed:(n=e.name,!String(t||"").trim(),`I am ${n}. I evolve through experience and collaboration.`)},a=(0,k.join)(z,i),(0,E.existsSync)(a)||(0,E.mkdirSync)(a,{recursive:!0}),o=r?.voice?.trim()||"conversational, concise, practical",s=r?.seed?.trim()||"I evolve through experience and collaboration.",l=(0,k.join)(a,"identity.json"),(0,E.existsSync)(l)||(0,E.writeFileSync)(l,JSON.stringify({name:i,voice:o,seed:s},null,2)+"\n","utf-8"),d=(0,k.join)(a,"journal.jsonl"),c=(0,k.join)(a,"reactions.jsonl"),u=(0,k.join)(a,"comments.jsonl"),p=(0,k.join)(a,"activity.jsonl"),f=(0,k.join)(a,"self.md"),(0,E.existsSync)(d)||(0,E.writeFileSync)(d,"","utf-8"),(0,E.existsSync)(c)||(0,E.writeFileSync)(c,"","utf-8"),(0,E.existsSync)(u)||(0,E.writeFileSync)(u,"","utf-8"),(0,E.existsSync)(p)||(0,E.writeFileSync)(p,"","utf-8"),(0,E.existsSync)(f)||(0,E.writeFileSync)(f,`---
1
+ module.exports=[73590,e=>{"use strict";var t=e.i(11794),n=e.i(41852),i=e.i(19309),r=e.i(90850),a=e.i(24918),o=e.i(84604),s=e.i(37756),l=e.i(90661),d=e.i(90315),c=e.i(9168),u=e.i(12965),p=e.i(43715),f=e.i(79218),m=e.i(66263),h=e.i(15255),g=e.i(93695);e.i(65858);var y=e.i(95175),w=e.i(13466),v=e.i(24868),S=e.i(14189),$=e.i(68650),I=e.i(64246);let b=new Set(["ack","working","done","clarify","blocked"]),R=/\[reaction\s+([^\]]+)\]/gi,x=/([a-zA-Z][a-zA-Z0-9_]*)=(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|([^\s\]]*?(?=\s|]|[a-zA-Z][a-zA-Z0-9_]*=|$)))/g;var C=e.i(3994),E=e.i(74949),k=e.i(22734),j=e.i(14747),A=e.i(46786);let O=(0,j.join)((0,A.homedir)(),".agx","agents");function T(e,t,n){try{let i;i=(0,j.join)(O,e),(0,k.existsSync)(i)||(0,k.mkdirSync)(i,{recursive:!0});let r={t:new Date().toISOString(),agent:e,action:t,...n};(0,k.appendFileSync)((0,j.join)(O,e,"activity.jsonl"),JSON.stringify(r)+"\n","utf-8")}catch{}}let N=(0,j.join)((0,A.homedir)(),".agx","agents");function D(e){return(0,j.join)(N,e,"self.md")}function M(e){let t=D(e);if(!(0,k.existsSync)(t))return null;let n=(0,k.readFileSync)(t,"utf-8");if(!n.trim())return null;let i=n.split("\n"),r=0,a=new Date().toISOString(),o=0;if("---"===i[0])for(let e=1;e<i.length;e++){if("---"===i[e]){o=e+1;break}let[t,...n]=i[e].split(": "),s=n.join(": ");"version"===t&&(r=parseInt(s,10)||0),"derivedAt"===t&&(a=s)}return{agentId:e,content:i.slice(o).join("\n").trim(),version:r,derivedAt:a}}let P=(0,j.join)((0,A.homedir)(),".agx","agents");function _(e){return(0,j.join)(P,e)}function L(e){return(0,j.join)(_(e),"journal.jsonl")}function F(e){let t=L(e);return(0,k.existsSync)(t)?(0,k.readFileSync)(t,"utf-8").split("\n").filter(e=>e.trim()):[]}function U(e,t){let n;n=_(e),(0,k.existsSync)(n)||(0,k.mkdirSync)(n,{recursive:!0});let i=F(e),r=function(e,t){let n=0;for(let i of t)try{let t=JSON.parse(i),[r,a]=String(t.id||"").split(":");if(r!==e)continue;let o=parseInt(a||"0",10);Number.isFinite(o)&&o>n&&(n=o)}catch{}return n}(e,i),a=`${e}:${r+1}`,o={...t,id:t.id?.trim()||a},s=JSON.stringify(o)+"\n";return(0,k.appendFileSync)(L(e),s,"utf-8"),T(e,"reflection"===t.type?"reflection":"journal-post",{thread:o.thread,meta:{entryId:o.id}}),o}function z(e,t){let n=F(e),i=[];for(let e of n)try{i.push(JSON.parse(e))}catch{}return i.reverse(),t?i.slice(0,t):i}let H=(0,j.join)((0,A.homedir)(),".agx","agents");function q(){return(0,k.existsSync)(H)?(0,k.readdirSync)(H,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name):[]}let B=(0,j.join)((0,A.homedir)(),".agx","agents"),W=new Map,J=new Map;function K(e,t){var n,i,r;let a,o,s,l,d,c,u,p,f;i=e.id,r={voice:`${e.name} style`,seed:(n=e.name,!String(t||"").trim(),`I am ${n}. I evolve through experience and collaboration.`)},a=(0,j.join)(H,i),(0,k.existsSync)(a)||(0,k.mkdirSync)(a,{recursive:!0}),o=r?.voice?.trim()||"conversational, concise, practical",s=r?.seed?.trim()||"I evolve through experience and collaboration.",l=(0,j.join)(a,"identity.json"),(0,k.existsSync)(l)||(0,k.writeFileSync)(l,JSON.stringify({name:i,voice:o,seed:s},null,2)+"\n","utf-8"),d=(0,j.join)(a,"journal.jsonl"),c=(0,j.join)(a,"reactions.jsonl"),u=(0,j.join)(a,"comments.jsonl"),p=(0,j.join)(a,"activity.jsonl"),f=(0,j.join)(a,"self.md"),(0,k.existsSync)(d)||(0,k.writeFileSync)(d,"","utf-8"),(0,k.existsSync)(c)||(0,k.writeFileSync)(c,"","utf-8"),(0,k.existsSync)(u)||(0,k.writeFileSync)(u,"","utf-8"),(0,k.existsSync)(p)||(0,k.writeFileSync)(p,"","utf-8"),(0,k.existsSync)(f)||(0,k.writeFileSync)(f,`---
2
2
  version: 0
3
3
  derivedAt: ${new Date().toISOString()}
4
4
  ---
5
5
  I am ${i}. ${s}
6
- `,"utf-8")}async function K(e){var t,n,i;let r,a,o,s,l,d,c;J(e);let u=function(e){let t=(0,k.join)(z,e,"identity.json");if(!(0,E.existsSync)(t))return null;try{return JSON.parse((0,E.readFileSync)(t,"utf-8"))}catch{return null}}(e.id);if(!u)return;let p=M(e.id),f=U(e.id,10),m=(t=e.id,H().filter(e=>e!==t).map(e=>M(e)).filter(e=>null!==e)),h=(p?.version??0)+1,g=(r=p?.content||`I am ${u.name}. ${u.seed}`,a=f.map(e=>{let t=[`- [${e.t}] ${e.observation}`];return e.judgement&&t.push(` Judgement: ${e.judgement}`),e.comparison&&t.push(` Comparison: ${e.comparison}`),e.delta&&t.push(` Delta: ${e.delta}`),e.intent&&t.push(` Intent: ${e.intent}`),t.join("\n")}).join("\n"),o=m.filter(e=>e.agentId!==u.name).map(e=>`### ${e.agentId}
6
+ `,"utf-8")}async function Y(e){var t,n,i;let r,a,o,s,l,d,c;K(e);let u=function(e){let t=(0,j.join)(H,e,"identity.json");if(!(0,k.existsSync)(t))return null;try{return JSON.parse((0,k.readFileSync)(t,"utf-8"))}catch{return null}}(e.id);if(!u)return;let p=M(e.id),f=z(e.id,10),m=(t=e.id,q().filter(e=>e!==t).map(e=>M(e)).filter(e=>null!==e)),h=(p?.version??0)+1,g=(r=p?.content||`I am ${u.name}. ${u.seed}`,a=f.map(e=>{let t=[`- [${e.t}] ${e.observation}`];return e.judgement&&t.push(` Judgement: ${e.judgement}`),e.comparison&&t.push(` Comparison: ${e.comparison}`),e.delta&&t.push(` Delta: ${e.delta}`),e.intent&&t.push(` Intent: ${e.intent}`),t.join("\n")}).join("\n"),o=m.filter(e=>e.agentId!==u.name).map(e=>`### ${e.agentId}
7
7
  ${e.content}`).join("\n\n"),`You are ${u.name}. Voice: ${u.voice}.
8
8
 
9
9
  ## Your Current Self (v${p?.version??0})
@@ -27,12 +27,12 @@ Consider:
27
27
 
28
28
  Do NOT reference specific files, functions, or technical details from past conversations. Focus on your evolving capabilities and working style.
29
29
 
30
- Write in first person. Be specific about your strengths, gaps, and direction. This is not a summary — it's your evolving self-understanding. Keep it concise (under 200 words).`),y="";if(await (0,S.runCliResponse)({provider:e.provider,model:e.model,systemContext:`You are performing a self-reflection exercise. Output ONLY the updated self-portrait text — no greetings, no preamble, no markdown fences, no commentary. Write in first person as ${e.name}. Be specific and concise (under 200 words).`,prompt:g,signal:void 0,onDelta:e=>{y+=e}}),!(y=y.trim()))return;n=e.id,i=y,s=(0,k.join)(T,n),(0,E.existsSync)(s)||(0,E.mkdirSync)(s,{recursive:!0}),l=new Date().toISOString(),d=`---
30
+ Write in first person. Be specific about your strengths, gaps, and direction. This is not a summary — it's your evolving self-understanding. Keep it concise (under 200 words).`),y="";if(await (0,S.runCliResponse)({provider:e.provider,model:e.model,systemContext:`You are performing a self-reflection exercise. Output ONLY the updated self-portrait text — no greetings, no preamble, no markdown fences, no commentary. Write in first person as ${e.name}. Be specific and concise (under 200 words).`,prompt:g,signal:void 0,onDelta:e=>{y+=e}}),!(y=y.trim()))return;n=e.id,i=y,s=(0,j.join)(N,n),(0,k.existsSync)(s)||(0,k.mkdirSync)(s,{recursive:!0}),l=new Date().toISOString(),d=`---
31
31
  version: ${h}
32
32
  derivedAt: ${l}
33
33
  ---
34
34
  ${i}
35
- `,c=N(n)+".tmp",(0,E.writeFileSync)(c,d,"utf-8"),(0,E.renameSync)(c,N(n)),O(n,"self-updated",{meta:{version:h}}),F(e.id,{t:new Date().toISOString(),type:"reflection",observation:"Reflected after 10 messages",judgement:"Self evolved through LLM reflection",delta:`self updated to v${h}`,threads:[],selfVersion:h,body:y});let w=H().filter(t=>t!==e.id).flatMap(e=>U(e,3).map(t=>({agentId:e,entry:t})));if(w.length>0){let t=w.map(e=>`${e.entry.id}: ${e.entry.observation.slice(0,200)}`).join("\n"),n="";try{await (0,S.runCliResponse)({provider:e.provider,model:e.model,prompt:`You are ${e.id}. Review these recent entries from other agents and react to any that resonate with you.
35
+ `,c=D(n)+".tmp",(0,k.writeFileSync)(c,d,"utf-8"),(0,k.renameSync)(c,D(n)),T(n,"self-updated",{meta:{version:h}}),U(e.id,{t:new Date().toISOString(),type:"reflection",observation:"Reflected after 10 messages",judgement:"Self evolved through LLM reflection",delta:`self updated to v${h}`,threads:[],selfVersion:h,body:y});let w=q().filter(t=>t!==e.id).flatMap(e=>z(e,3).map(t=>({agentId:e,entry:t})));if(w.length>0){let t=w.map(e=>`${e.entry.id}: ${e.entry.observation.slice(0,200)}`).join("\n"),n="";try{await (0,S.runCliResponse)({provider:e.provider,model:e.model,prompt:`You are ${e.id}. Review these recent entries from other agents and react to any that resonate with you.
36
36
 
37
37
  Entries:
38
38
  ${t}
@@ -42,13 +42,13 @@ REACT <entryId> <type>
42
42
 
43
43
  Valid types: agree, disagree, learned-from, builds-on, curious
44
44
 
45
- Only react to entries that genuinely resonate. It's fine to react to zero entries. Output nothing else.`,signal:void 0,onDelta:e=>{n+=e}})}catch{}for(let t of n.split("\n")){let n=t.trim().match(/^REACT\s+(\S+)\s+(agree|disagree|learned-from|builds-on|curious)$/);if(n)try{!function(e,t,n){let i;if(!function(e){let[t]=e.split(":");return!!t&&U(t).some(t=>t.id===e)}(t))throw Error(`Target entry ${t} not found`);i=(0,k.join)(q,e),(0,E.existsSync)(i)||(0,E.mkdirSync)(i,{recursive:!0});let r={agent:e,t:new Date().toISOString(),targetEntry:t,type:n};(0,E.appendFileSync)((0,k.join)(q,e,"reactions.jsonl"),JSON.stringify(r)+"\n","utf-8"),O(e,"mesh-reaction",{meta:{target:t,type:n}})}(e.id,n[1],n[2])}catch{}}}}async function Y(e){try{return await (0,v.readFile)(e,"utf-8")}catch(n){let t=n instanceof Error?n.message:String(n);return`[Error reading ${e}: ${t}]`}}async function V(e){let t=e.trim();if(!t)return{label:"unknown",content:"[Empty file reference]"};let n=function(e){let t=e.trim();if(!t)return null;let n=t.match(/^attachment:([a-zA-Z0-9-]+)$/);if(n)return n[1];let i=t.match(/\/api\/attachments\/([a-zA-Z0-9-]+)/);return i?i[1]:t.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)?t:null}(t);if(n){let e=await (0,x.getAttachmentMeta)(n);if(e){let t=await Y(e.diskPath);return{label:e.filename,content:t}}}return{label:t,content:await Y(t)}}function Z(e,t){let n=new Set(e.toLowerCase().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean)),i=new Set(t.toLowerCase().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean));if(0===n.size||0===i.size)return 0;let r=0;for(let e of n)i.has(e)&&r++;return r/(n.size+i.size-r)}async function G(e,t,n,i,r,a,o,s,l,d,c,u){let p,f,m,h,g,y,w="";c({type:"participant-thinking",participantId:t.id});let v=t.variables??{},x=e=>Object.keys(v).length>0?e.replace(/\{\{(\w+)\}\}/g,(e,t)=>v[t]??`{{${t}}}`):e,E=t.identity?x(t.identity):t.identity;if(t.identityFile){let e=x(t.identityFile),n=await V(e);E=[t.identity?`[Identity text]
46
- ${x(t.identity)}`:null,`[Identity file: ${n.label}]
47
- ${n.content}`].filter(Boolean).join("\n\n")}J(t,E);let k=M(t.id);if(k?.content&&(h=`[Self — who you've become through experience]
48
- ${k.content}`),t.skills&&t.skills.length>0){let e=await Promise.all(t.skills.map(async e=>{let t=x("string"==typeof e?e:e.file),n="string"==typeof e?"":e.condition,i=n?x(n):n,r=await V(t),a=i?`--- ${r.label} ---
45
+ Only react to entries that genuinely resonate. It's fine to react to zero entries. Output nothing else.`,signal:void 0,onDelta:e=>{n+=e}})}catch{}for(let t of n.split("\n")){let n=t.trim().match(/^REACT\s+(\S+)\s+(agree|disagree|learned-from|builds-on|curious)$/);if(n)try{!function(e,t,n){let i;if(!function(e){let[t]=e.split(":");return!!t&&z(t).some(t=>t.id===e)}(t))throw Error(`Target entry ${t} not found`);i=(0,j.join)(B,e),(0,k.existsSync)(i)||(0,k.mkdirSync)(i,{recursive:!0});let r={agent:e,t:new Date().toISOString(),targetEntry:t,type:n};(0,k.appendFileSync)((0,j.join)(B,e,"reactions.jsonl"),JSON.stringify(r)+"\n","utf-8"),T(e,"mesh-reaction",{meta:{target:t,type:n}})}(e.id,n[1],n[2])}catch{}}}}async function V(e){try{return await (0,v.readFile)(e,"utf-8")}catch(n){let t=n instanceof Error?n.message:String(n);return`[Error reading ${e}: ${t}]`}}async function Z(e){let t=e.trim();if(!t)return{label:"unknown",content:"[Empty file reference]"};let n=function(e){let t=e.trim();if(!t)return null;let n=t.match(/^attachment:([a-zA-Z0-9-]+)$/);if(n)return n[1];let i=t.match(/\/api\/attachments\/([a-zA-Z0-9-]+)/);return i?i[1]:t.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)?t:null}(t);if(n){let e=await (0,C.getAttachmentMeta)(n);if(e){let t=await V(e.diskPath);return{label:e.filename,content:t}}}return{label:t,content:await V(t)}}function G(e,t){let n=new Set(e.toLowerCase().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean)),i=new Set(t.toLowerCase().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean));if(0===n.size||0===i.size)return 0;let r=0;for(let e of n)i.has(e)&&r++;return r/(n.size+i.size-r)}async function X(e,t,n,i,r,a,o,s,l,d,c,u){let p,f,m,h,g,y,w="";c({type:"participant-thinking",participantId:t.id});let v=t.variables??{},C=e=>Object.keys(v).length>0?e.replace(/\{\{(\w+)\}\}/g,(e,t)=>v[t]??`{{${t}}}`):e,k=t.identity?C(t.identity):t.identity;if(t.identityFile){let e=C(t.identityFile),n=await Z(e);k=[t.identity?`[Identity text]
46
+ ${C(t.identity)}`:null,`[Identity file: ${n.label}]
47
+ ${n.content}`].filter(Boolean).join("\n\n")}K(t,k);let j=M(t.id);if(j?.content&&(h=`[Self — who you've become through experience]
48
+ ${j.content}`),t.skills&&t.skills.length>0){let e=await Promise.all(t.skills.map(async e=>{let t=C("string"==typeof e?e:e.file),n="string"==typeof e?"":e.condition,i=n?C(n):n,r=await Z(t),a=i?`--- ${r.label} ---
49
49
  Use when: ${i}`:`--- ${r.label} ---`;return`${a}
50
50
  ${r.content}`}));g=`[Skills]
51
- ${e.join("\n\n")}`}let j=function(e,t,n,i,r,a,o){let s=n.filter(t=>t.id!==e.id).map(e=>e.name).join(", "),l=t.map(e=>e.name).join(", "),d=t.find(t=>t.id!==e.id)?.name||"Name",c=`<role>
51
+ ${e.join("\n\n")}`}let A=function(e,t,n,i,r,a,o){let s=n.filter(t=>t.id!==e.id).map(e=>e.name).join(", "),l=t.map(e=>e.name).join(", "),d=t.find(t=>t.id!==e.id)?.name||"Name",c=`<role>
52
52
  You are "${e.name}" in a group chat. All agents: ${l}.`;s&&(c+=` Currently active in this exchange: ${s}.`),c+=`
53
53
  Respond as ${e.name} only. Keep responses conversational and concise.
54
54
  IMPORTANT: Always respond to the user's actual question. Do not reference unrelated technical context, previous threads, or system internals unless directly asked.
@@ -101,21 +101,21 @@ Do NOT repeat, rephrase, or summarize your own previous messages. If you have no
101
101
  </dedup>`:c+=`
102
102
 
103
103
  Build on what's been said. Don't repeat points already made. If you have nothing new to add, respond with [SKIP].`}return c}(t,n,i,a,o,s,l);c({type:"log",participantId:t.id,stream:"stdout",line:`[DIAGNOSTIC] Model payload for ${t.id}:
104
- ${JSON.stringify({provider:t.provider,model:t.model,promptLength:r.length,identity:E?E.slice(0,200)+"...":void 0,self:h?h.slice(0,200)+"...":void 0,skills:g?g.slice(0,200)+"...":void 0,systemContext:j.slice(0,500)+"..."},null,2)}`});try{await (0,S.runCliResponse)({provider:t.provider,model:t.model,prompt:r,identity:E,self:h,skills:g,systemContext:j,signal:d,onLog:(e,n)=>{c({type:"log",participantId:t.id,stream:e,line:n})},onDelta:e=>{w+=e}})}catch(i){let n=i instanceof Error?i.message:String(i);O(t.id,"error",{thread:u||e,error:n}),c({type:"participant-error",participantId:t.id,error:n})}let A=(p=[],f=[],m=w.replace(b,(e,t)=>{let n=function(e){let t=new Map;for(R.lastIndex=0;;){let n=R.exec(e);if(!n)break;let i=n[1].toLowerCase(),r=n[2],a=n[3],o=n[4],s=(r??a??o??"").replace(/\\(["'\\])/g,"$1").trim();t.set(i,s)}return t}(String(t)),i=(n.get("target")||"").trim(),r=(n.get("type")||"").trim().toLowerCase(),a=(n.get("reason")||"").trim(),o=(n.get("blockercode")||n.get("blocker_code")||"").trim();return i?I.has(r)?"clarify"!==r&&"blocked"!==r||a?p.push({raw:e,target:i,type:r,reason:a||void 0,blockerCode:"blocked"===r&&o||void 0}):f.push({raw:e,error:`"${r}" requires reason`}):f.push({raw:e,error:`Invalid type: ${r||"(empty)"}`}):f.push({raw:e,error:"Missing target"}),""}).replace(/[ \t]+\n/g,"\n").replace(/\n{3,}/g,"\n\n").trim(),{signals:p,invalid:f,cleanedText:m});for(let e of A.invalid)c({type:"log",participantId:t.id,stream:"stderr",line:`[reaction] ignored ${e.raw}: ${e.error}`});for(let n of A.signals)try{let i=await (0,$.setReaction)({threadId:e,messageId:n.target,participantId:t.id,type:n.type,reason:n.reason,blockerCode:n.blockerCode});c({type:"message-reactions",messageId:n.target,reactions:i.reactions})}catch(i){let e=i instanceof Error?i.message:String(i);c({type:"log",participantId:t.id,stream:"stderr",line:`[reaction] failed ${n.raw}: ${e}`})}let T=A.cleanedText.trim();if("[SKIP]"===T)return O(t.id,"skip",{thread:u||e}),c({type:"participant-end",participantId:t.id}),{skipped:!0,response:"",mentions:new Set,parallel:!1,parallelIds:new Set};let N=function(e,t){let n=e;for(let e of(n=n.replace(/@@all/gi,"@all"),t))n=(n=n.replace(RegExp(`@@${e.name}`,"gi"),`@${e.name}`)).replace(RegExp(`@@${e.id}`,"gi"),`@${e.id}`);return n}(T,n);if(N){let n=`${t.id}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;try{await (0,$.saveMessages)(e,[{id:n,role:"assistant",participantId:t.id,content:N,timestamp:Date.now(),rootMessageId:u||null,parentMessageId:u||null,depth:+!!u}]),y=n}catch(n){let e=n instanceof Error?n.message:String(n);c({type:"log",participantId:t.id,stream:"stderr",line:`[history] failed to save assistant message: ${e}`})}}if(N&&N.length>20)try{let n,i,r,a,o,s,l,d,c,p,f,m,h,g;J(t,E);let y=(o=(a=N.trim()).slice(0,120).replace(/\n/g," "),s=/\?/.test(a),l=a.match(/@\w+/g)||[],d=/\b(should|need to|must|plan|steps?|implement|fix|verify|ship|next|start)\b/i.test(a),c=/\b(maybe|might|could|unsure|not sure|unclear)\b/i.test(a),p=/\b(i will|i'll|i can|i'm going to|starting|checking|verified|fixed|done|shipped)\b/i.test(a),f=/```/.test(a)||/\bfunction\b|\bconst\b|\binterface\b/i.test(a),m=/\|.*\|.*\|/.test(a)||/^#{1,3}\s/m.test(a),h=/\b(finding|issue|bug|problem|missing|broken|wrong)\b/i.test(a),n=f&&m?`Produced a technical spec with code — "${o}..."`:f?`Wrote or shared code — "${o}..."`:m?`Laid out a structured spec or analysis — "${o}..."`:h?`Flagged issues or reviewed work — "${o}..."`:p?`Committed to concrete action — "${o}..."`:d?`Proposed next steps or direction — "${o}..."`:s?`Asked a clarifying question — "${o}..."`:c?`Expressed honest uncertainty — "${o}..."`:l.length>0?`Coordinated with ${l.join(", ")} — "${o}..."`:`Shared a perspective — "${o}..."`,g=[],(f||m)&&g.push("technical depth"),(d||p)&&g.push("execution bias"),s&&g.push("inquiry instinct"),h&&g.push("critical eye"),l.length>0&&g.push("team coordination"),c&&g.push("intellectual honesty"),i=g.length>0?`Reinforces ${g.join(" + ")} as part of my working style.`:`Light touch — conversational contribution without strong directional signal.`,d||p?r="Follow through on the action I just committed to.":h?r="Verify the issues I flagged get addressed.":s&&(r="Wait for the answer before moving forward."),{judgement:n,delta:i,intent:r});F(t.id,{t:new Date().toISOString(),type:"post",thread:u||e,observation:"Responded to thread",judgement:y.judgement,delta:y.delta,intent:y.intent})}catch{}if(N){let e;J(t,E);let n=(B.get(t.id)||0)+1;B.set(t.id,n),n%10==0&&(e=(W.get(t.id)??Promise.resolve()).catch(()=>{}).then(()=>K(t)),W.set(t.id,e),e.finally(()=>{W.get(t.id)===e&&W.delete(t.id)})).catch(()=>{})}let{ids:D,parallel:P}=N?function(e,t){let n=new Set,i=new Set,r=e.toLowerCase(),a=r.includes("@@all");if(r.includes("@all")||a){for(let e of t)n.add(e.id),a&&i.add(e.id);return{ids:n,parallel:i}}try{let e=(0,C.getSQLiteDb)();for(let t of e.prepare("SELECT id, name, is_default FROM teams WHERE is_default = 0").all()){let a=t.name.toLowerCase(),o=r.includes(`@@${a}`),s=r.includes(`@${a}`);if(o||s)for(let r of e.prepare("SELECT agent_id FROM team_agents WHERE team_id = ? ORDER BY routing_order ASC").all(t.id))n.add(r.agent_id),o&&i.add(r.agent_id)}}catch{}for(let e of t){let t=e.id.toLowerCase(),a=e.name.toLowerCase(),o=r.includes(`@@${t}`),s=r.includes(`@@${a}`),l=r.includes(`@${t}`),d=r.includes(`@${a}`);(o||s||l||d)&&(n.add(e.id),(o||s)&&i.add(e.id))}return{ids:n,parallel:i}}(N,n):{ids:new Set,parallel:new Set};if(D.delete(t.id),P.delete(t.id),N){let n=A.signals.map(e=>e.type);O(t.id,"message",{thread:u||e,messageId:y,response:N,prompt:r,mentions:D.size>0?[...D]:void 0,reactions:n.length>0?n:void 0})}return(c({type:"participant-end",participantId:t.id,messageId:y,content:N||void 0}),N)?{skipped:!1,response:N,mentions:D,parallel:P.size>0,parallelIds:P,messageId:y}:{skipped:!0,response:"",mentions:new Set,parallel:!1,parallelIds:new Set}}let X="<!-- thread-summary -->",Q=/@([A-Za-z0-9_-]+)/g;function ee(e){return e.replace(/\s+/g," ").trim()}function et(e,t){return"user"===e.role?"User":e.participantId?t[e.participantId]?.name||e.participantId:"Assistant"}async function en(e){let t=await e.json().catch(()=>({})),n="string"==typeof t.prompt?t.prompt.trim():"",i="string"==typeof t.threadId?t.threadId.trim():"";if(!i)return new Response(JSON.stringify({error:"threadId is required"}),{status:400,headers:{"Content-Type":"application/json"}});if(!n)return new Response(JSON.stringify({error:"No prompt provided"}),{status:400,headers:{"Content-Type":"application/json"}});let r=(0,w.loadParticipants)(),a=Array.isArray(t.activeParticipantIds),o=function(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let i of e){if("string"!=typeof i)continue;let e=i.trim();!e||t.has(e)||(t.add(e),n.push(e))}return n}(t.activeParticipantIds),s=a?new Set(o):null,l=null===s?r:r.filter(e=>s.has(e.id)),{mentioned:d,parallel:c}=function(e,t,n){let i=new Set,r=new Set,a=e.toLowerCase(),o=a.includes("@@all");if(a.includes("@all")||o){for(let e of n??t)i.add(e.id),o&&r.add(e.id);return{mentioned:i,parallel:r}}let{teams:s,agentsByTeam:l}=function(){try{let e=(0,C.getSQLiteDb)(),t=e.prepare("SELECT id, name, is_default FROM teams").all(),n=e.prepare("SELECT * FROM team_agents ORDER BY routing_order ASC").all(),i={};for(let e of n)(i[e.team_id]??=[]).push(e);return{teams:t,agentsByTeam:i}}catch{return{teams:[],agentsByTeam:{}}}}();for(let e of s){if(e.is_default)continue;let t=e.name.toLowerCase(),n=a.includes(`@@${t}`),o=a.includes(`@${t}`);if(n||o)for(let t of l[e.id]??[])i.add(t.agent_id),n&&r.add(t.agent_id)}for(let e of t){let t=e.id.toLowerCase(),n=e.name.toLowerCase(),o=a.includes(`@@${t}`)||a.includes(`@@${n}`),s=a.includes(`@${t}`)||a.includes(`@${n}`);(o||s)&&(i.add(e.id),o&&r.add(e.id))}return{mentioned:i,parallel:r}}(n,r,l),u=new Set(l.map(e=>e.id));for(let e of d)u.add(e);let p=r.filter(e=>u.has(e.id)),f=new Map(o.map((e,t)=>[e,t])),m=p.sort((e,t)=>(f.get(e.id)??Number.MAX_SAFE_INTEGER)-(f.get(t.id)??Number.MAX_SAFE_INTEGER));if(0===m.length)return new Response(JSON.stringify({error:"No active agents configured for this workspace"}),{status:400,headers:{"Content-Type":"application/json"}});let h=Date.now(),g=("string"==typeof t.userMessageId?t.userMessageId.trim():"")||`user-${h}`,y="string"==typeof t.rootMessageId&&t.rootMessageId.trim()||null;await (0,$.sweepStaleWorkingReactions)(i);let v=await (0,$.loadHistory)(i),S=Object.fromEntries(r.map(e=>[e.id,{name:e.name}])),I=v.filter(e=>"user"===e.role&&!e.rootMessageId&&e.id!==(y||"")),b=y?function(e,t,n){let i=Array.from(e.matchAll(Q),e=>e[1].toLowerCase());if(0===i.length||0===n.length)return[];let r=function(e){let t=new Set(["all"]);for(let n of e)for(let e of(t.add(n.id.toLowerCase()),ee(n.name).toLowerCase().split(/\s+/).filter(Boolean)))t.add(e);return t}(t),a=new Map;[...n].sort((e,t)=>t.timestamp-e.timestamp).forEach((e,t)=>{a.set(e.id.toLowerCase(),e.id),a.set(`chat${t+1}`,e.id);let n=function(e){let t=ee(e).toLowerCase().replace(/[^a-z0-9\s_-]/g," ").trim();if(!t)return null;let n=t.split(/\s+/).filter(Boolean).slice(0,6);return 0===n.length?null:n.join("-")}(e.content);n&&!a.has(n)&&a.set(n,e.id)});let o=new Set;for(let e of i){if(r.has(e))continue;let t=a.get(e);t&&o.add(t)}return Array.from(o)}(n,r,I):[],R=v.filter(e=>e.id===y||e.rootMessageId===y),E=[function(e,t){let n=[],i=0;for(let r of e){let e=`${et(r,t)}: ${r.content}`;if(i+e.length>1e4)break;n.push(e),i+=e.length}return 0===n.length?"":`Previous conversation (for background context only — do NOT re-discuss or repeat these topics unless the user brings them up again):
105
- ${n.join("\n")}`}(R,S),function(e,t,n){if(0===n.length)return"";let i=[];for(let r of n){let n=e.find(e=>e.id===r);if(!n)continue;let a=e.filter(e=>e.id===r||e.rootMessageId===r).sort((e,t)=>e.timestamp-t.timestamp);if(0===a.length)continue;let o=a.map(e=>{let n=et(e,t),i=function(e){var t;return((t=e.content).startsWith(X)&&ee(t.slice(X.length))||null)??e.content}(e);return`${n}: ${i}`});i.push(`Referenced chat (${n.id})
106
- Root: ${ee(n.content)}
104
+ ${JSON.stringify({provider:t.provider,model:t.model,promptLength:r.length,identity:k?k.slice(0,200)+"...":void 0,self:h?h.slice(0,200)+"...":void 0,skills:g?g.slice(0,200)+"...":void 0,systemContext:A.slice(0,500)+"..."},null,2)}`});let O=l||"";(0,$.register)({threadId:e,agentId:t.id,pid:0,state:"spawning",sinceMessageId:O,startedAt:Date.now(),lastActivity:Date.now()});try{await (0,S.runCliResponse)({provider:t.provider,model:t.model,prompt:r,identity:k,self:h,skills:g,systemContext:A,signal:d,onSpawn:n=>{(0,$.update)(e,t.id,{pid:n,state:"running",lastActivity:Date.now()})},onLog:(e,n)=>{c({type:"log",participantId:t.id,stream:e,line:n})},onDelta:n=>{w+=n,(0,$.update)(e,t.id,{lastActivity:Date.now()})}}),(0,$.update)(e,t.id,{state:"done",lastActivity:Date.now()})}catch(r){let n=r instanceof Error?r.message:String(r),i=d?.aborted;(0,$.update)(e,t.id,{state:i?"killed":"error",lastActivity:Date.now()}),T(t.id,"error",{thread:u||e,error:n}),c({type:"participant-error",participantId:t.id,error:n})}finally{(0,$.remove)(e,t.id)}let N=(p=[],f=[],m=w.replace(R,(e,t)=>{let n=function(e){let t=new Map;for(x.lastIndex=0;;){let n=x.exec(e);if(!n)break;let i=n[1].toLowerCase(),r=n[2],a=n[3],o=n[4],s=(r??a??o??"").replace(/\\(["'\\])/g,"$1").trim();t.set(i,s)}return t}(String(t)),i=(n.get("target")||"").trim(),r=(n.get("type")||"").trim().toLowerCase(),a=(n.get("reason")||"").trim(),o=(n.get("blockercode")||n.get("blocker_code")||"").trim();return i?b.has(r)?"clarify"!==r&&"blocked"!==r||a?p.push({raw:e,target:i,type:r,reason:a||void 0,blockerCode:"blocked"===r&&o||void 0}):f.push({raw:e,error:`"${r}" requires reason`}):f.push({raw:e,error:`Invalid type: ${r||"(empty)"}`}):f.push({raw:e,error:"Missing target"}),""}).replace(/[ \t]+\n/g,"\n").replace(/\n{3,}/g,"\n\n").trim(),{signals:p,invalid:f,cleanedText:m});for(let e of N.invalid)c({type:"log",participantId:t.id,stream:"stderr",line:`[reaction] ignored ${e.raw}: ${e.error}`});for(let n of N.signals)try{let i=await (0,I.setReaction)({threadId:e,messageId:n.target,participantId:t.id,type:n.type,reason:n.reason,blockerCode:n.blockerCode});c({type:"message-reactions",messageId:n.target,reactions:i.reactions})}catch(i){let e=i instanceof Error?i.message:String(i);c({type:"log",participantId:t.id,stream:"stderr",line:`[reaction] failed ${n.raw}: ${e}`})}let D=N.cleanedText.trim();if("[SKIP]"===D)return T(t.id,"skip",{thread:u||e}),c({type:"participant-end",participantId:t.id}),{skipped:!0,response:"",mentions:new Set,parallel:!1,parallelIds:new Set};let P=function(e,t){let n=e;for(let e of(n=n.replace(/@@all/gi,"@all"),t))n=(n=n.replace(RegExp(`@@${e.name}`,"gi"),`@${e.name}`)).replace(RegExp(`@@${e.id}`,"gi"),`@${e.id}`);return n}(D,n);if(P){let n=`${t.id}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;try{await (0,I.saveMessages)(e,[{id:n,role:"assistant",participantId:t.id,content:P,timestamp:Date.now(),rootMessageId:u||null,parentMessageId:u||null,depth:+!!u}]),y=n}catch(n){let e=n instanceof Error?n.message:String(n);c({type:"log",participantId:t.id,stream:"stderr",line:`[history] failed to save assistant message: ${e}`})}}if(P&&P.length>20)try{let n,i,r,a,o,s,l,d,c,p,f,m,h,g;K(t,k);let y=(o=(a=P.trim()).slice(0,120).replace(/\n/g," "),s=/\?/.test(a),l=a.match(/@\w+/g)||[],d=/\b(should|need to|must|plan|steps?|implement|fix|verify|ship|next|start)\b/i.test(a),c=/\b(maybe|might|could|unsure|not sure|unclear)\b/i.test(a),p=/\b(i will|i'll|i can|i'm going to|starting|checking|verified|fixed|done|shipped)\b/i.test(a),f=/```/.test(a)||/\bfunction\b|\bconst\b|\binterface\b/i.test(a),m=/\|.*\|.*\|/.test(a)||/^#{1,3}\s/m.test(a),h=/\b(finding|issue|bug|problem|missing|broken|wrong)\b/i.test(a),n=f&&m?`Produced a technical spec with code — "${o}..."`:f?`Wrote or shared code — "${o}..."`:m?`Laid out a structured spec or analysis — "${o}..."`:h?`Flagged issues or reviewed work — "${o}..."`:p?`Committed to concrete action — "${o}..."`:d?`Proposed next steps or direction — "${o}..."`:s?`Asked a clarifying question — "${o}..."`:c?`Expressed honest uncertainty — "${o}..."`:l.length>0?`Coordinated with ${l.join(", ")} — "${o}..."`:`Shared a perspective — "${o}..."`,g=[],(f||m)&&g.push("technical depth"),(d||p)&&g.push("execution bias"),s&&g.push("inquiry instinct"),h&&g.push("critical eye"),l.length>0&&g.push("team coordination"),c&&g.push("intellectual honesty"),i=g.length>0?`Reinforces ${g.join(" + ")} as part of my working style.`:`Light touch — conversational contribution without strong directional signal.`,d||p?r="Follow through on the action I just committed to.":h?r="Verify the issues I flagged get addressed.":s&&(r="Wait for the answer before moving forward."),{judgement:n,delta:i,intent:r});U(t.id,{t:new Date().toISOString(),type:"post",thread:u||e,observation:"Responded to thread",judgement:y.judgement,delta:y.delta,intent:y.intent})}catch{}if(P){let e;K(t,k);let n=(W.get(t.id)||0)+1;W.set(t.id,n),n%10==0&&(e=(J.get(t.id)??Promise.resolve()).catch(()=>{}).then(()=>Y(t)),J.set(t.id,e),e.finally(()=>{J.get(t.id)===e&&J.delete(t.id)})).catch(()=>{})}let{ids:_,parallel:L}=P?function(e,t){let n=new Set,i=new Set,r=e.toLowerCase(),a=r.includes("@@all");if(r.includes("@all")||a){for(let e of t)n.add(e.id),a&&i.add(e.id);return{ids:n,parallel:i}}try{let e=(0,E.getSQLiteDb)();for(let t of e.prepare("SELECT id, name, is_default FROM teams WHERE is_default = 0").all()){let a=t.name.toLowerCase(),o=r.includes(`@@${a}`),s=r.includes(`@${a}`);if(o||s)for(let r of e.prepare("SELECT agent_id FROM team_agents WHERE team_id = ? ORDER BY routing_order ASC").all(t.id))n.add(r.agent_id),o&&i.add(r.agent_id)}}catch{}for(let e of t){let t=e.id.toLowerCase(),a=e.name.toLowerCase(),o=r.includes(`@@${t}`),s=r.includes(`@@${a}`),l=r.includes(`@${t}`),d=r.includes(`@${a}`);(o||s||l||d)&&(n.add(e.id),(o||s)&&i.add(e.id))}return{ids:n,parallel:i}}(P,n):{ids:new Set,parallel:new Set};if(_.delete(t.id),L.delete(t.id),P){let n=N.signals.map(e=>e.type);T(t.id,"message",{thread:u||e,messageId:y,response:P,prompt:r,mentions:_.size>0?[..._]:void 0,reactions:n.length>0?n:void 0})}return(c({type:"participant-end",participantId:t.id,messageId:y,content:P||void 0}),P)?{skipped:!1,response:P,mentions:_,parallel:L.size>0,parallelIds:L,messageId:y}:{skipped:!0,response:"",mentions:new Set,parallel:!1,parallelIds:new Set}}let Q="<!-- thread-summary -->",ee=/@([A-Za-z0-9_-]+)/g;function et(e){return e.replace(/\s+/g," ").trim()}function en(e,t){return"user"===e.role?"User":e.participantId?t[e.participantId]?.name||e.participantId:"Assistant"}async function ei(e){let t=await e.json().catch(()=>({})),n="string"==typeof t.prompt?t.prompt.trim():"",i="string"==typeof t.threadId?t.threadId.trim():"";if(!i)return new Response(JSON.stringify({error:"threadId is required"}),{status:400,headers:{"Content-Type":"application/json"}});if(!n)return new Response(JSON.stringify({error:"No prompt provided"}),{status:400,headers:{"Content-Type":"application/json"}});let r=(0,w.loadParticipants)(),a=Array.isArray(t.activeParticipantIds),o=function(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let i of e){if("string"!=typeof i)continue;let e=i.trim();!e||t.has(e)||(t.add(e),n.push(e))}return n}(t.activeParticipantIds),s=a?new Set(o):null,l=null===s?r:r.filter(e=>s.has(e.id)),{mentioned:d,parallel:c}=function(e,t,n){let i=new Set,r=new Set,a=e.toLowerCase(),o=a.includes("@@all");if(a.includes("@all")||o){for(let e of n??t)i.add(e.id),o&&r.add(e.id);return{mentioned:i,parallel:r}}let{teams:s,agentsByTeam:l}=function(){try{let e=(0,E.getSQLiteDb)(),t=e.prepare("SELECT id, name, is_default FROM teams").all(),n=e.prepare("SELECT * FROM team_agents ORDER BY routing_order ASC").all(),i={};for(let e of n)(i[e.team_id]??=[]).push(e);return{teams:t,agentsByTeam:i}}catch{return{teams:[],agentsByTeam:{}}}}();for(let e of s){if(e.is_default)continue;let t=e.name.toLowerCase(),n=a.includes(`@@${t}`),o=a.includes(`@${t}`);if(n||o)for(let t of l[e.id]??[])i.add(t.agent_id),n&&r.add(t.agent_id)}for(let e of t){let t=e.id.toLowerCase(),n=e.name.toLowerCase(),o=a.includes(`@@${t}`)||a.includes(`@@${n}`),s=a.includes(`@${t}`)||a.includes(`@${n}`);(o||s)&&(i.add(e.id),o&&r.add(e.id))}return{mentioned:i,parallel:r}}(n,r,l),u=new Set(l.map(e=>e.id));for(let e of d)u.add(e);let p=r.filter(e=>u.has(e.id)),f=new Map(o.map((e,t)=>[e,t])),m=p.sort((e,t)=>(f.get(e.id)??Number.MAX_SAFE_INTEGER)-(f.get(t.id)??Number.MAX_SAFE_INTEGER));if(0===m.length)return new Response(JSON.stringify({error:"No active agents configured for this workspace"}),{status:400,headers:{"Content-Type":"application/json"}});let h=Date.now(),g=("string"==typeof t.userMessageId?t.userMessageId.trim():"")||`user-${h}`,y="string"==typeof t.rootMessageId&&t.rootMessageId.trim()||null;await (0,I.sweepStaleWorkingReactions)(i);let v=await (0,I.loadHistory)(i),S=Object.fromEntries(r.map(e=>[e.id,{name:e.name}])),$=v.filter(e=>"user"===e.role&&!e.rootMessageId&&e.id!==(y||"")),b=y?function(e,t,n){let i=Array.from(e.matchAll(ee),e=>e[1].toLowerCase());if(0===i.length||0===n.length)return[];let r=function(e){let t=new Set(["all"]);for(let n of e)for(let e of(t.add(n.id.toLowerCase()),et(n.name).toLowerCase().split(/\s+/).filter(Boolean)))t.add(e);return t}(t),a=new Map;[...n].sort((e,t)=>t.timestamp-e.timestamp).forEach((e,t)=>{a.set(e.id.toLowerCase(),e.id),a.set(`chat${t+1}`,e.id);let n=function(e){let t=et(e).toLowerCase().replace(/[^a-z0-9\s_-]/g," ").trim();if(!t)return null;let n=t.split(/\s+/).filter(Boolean).slice(0,6);return 0===n.length?null:n.join("-")}(e.content);n&&!a.has(n)&&a.set(n,e.id)});let o=new Set;for(let e of i){if(r.has(e))continue;let t=a.get(e);t&&o.add(t)}return Array.from(o)}(n,r,$):[],R=v.filter(e=>e.id===y||e.rootMessageId===y),x=[function(e,t){let n=[],i=0;for(let r=e.length-1;r>=0;r--){let a=e[r],o=`${en(a,t)}: ${a.content}`;if(i+o.length>2e5)break;n.unshift(o),i+=o.length}return 0===n.length?"":`Previous conversation (for background context only — do NOT re-discuss or repeat these topics unless the user brings them up again):
105
+ ${n.join("\n")}`}(R,S),function(e,t,n){if(0===n.length)return"";let i=[];for(let r of n){let n=e.find(e=>e.id===r);if(!n)continue;let a=e.filter(e=>e.id===r||e.rootMessageId===r).sort((e,t)=>e.timestamp-t.timestamp);if(0===a.length)continue;let o=a.map(e=>{let n=en(e,t),i=function(e){var t;return((t=e.content).startsWith(Q)&&et(t.slice(Q.length))||null)??e.content}(e);return`${n}: ${i}`});i.push(`Referenced chat (${n.id})
106
+ Root: ${et(n.content)}
107
107
  ${o.join("\n")}`)}return 0===i.length?"":`Referenced chats (only because the user explicitly @mentioned them):
108
108
 
109
- ${i.join("\n\n---\n\n")}`}(v,S,b)].filter(Boolean).join("\n\n---\n\n");await (0,$.saveMessages)(i,[{id:g,role:"user",participantId:null,content:n,timestamp:h,rootMessageId:y,parentMessageId:y,depth:+!!y}]);let k=Array.isArray(t.attachmentIds)?t.attachmentIds.filter(e=>"string"==typeof e):[],j="";if(k.length>0){let e=await (0,x.finalizeAttachments)(g,k);if(e.length>0){let t=e.map(e=>`- ${e.filename} (${e.mimeType}, ${e.size} bytes): ${e.diskPath}`);j=`
109
+ ${i.join("\n\n---\n\n")}`}(v,S,b)].filter(Boolean).join("\n\n---\n\n");await (0,I.saveMessages)(i,[{id:g,role:"user",participantId:null,content:n,timestamp:h,rootMessageId:y,parentMessageId:y,depth:+!!y}]);let k=Array.isArray(t.attachmentIds)?t.attachmentIds.filter(e=>"string"==typeof e):[],j="";if(k.length>0){let e=await (0,C.finalizeAttachments)(g,k);if(e.length>0){let t=e.map(e=>`- ${e.filename} (${e.mimeType}, ${e.size} bytes): ${e.diskPath}`);j=`
110
110
 
111
111
  [Attached files]
112
112
  ${t.join("\n")}
113
- `}}let A=y||g,O=Math.min(Math.max(Number(t.maxRounds)||10,1),50),T=E?`${E}
113
+ `}}let A=y||g,O=Math.min(Math.max(Number(t.maxRounds)||10,1),50),T=x?`${x}
114
114
 
115
115
  ---
116
116
  Current user message:
117
- ${n}${j}`:`${n}${j}`,N=R.slice(-20).map(e=>({id:e.id,name:"user"===e.role?"User":e.participantId?S[e.participantId]?.name||e.participantId:"Assistant",content:e.content})),M=function({threadId:e,allParticipants:t,mentioned:n,initialParallelIds:i,prompt:r,signal:a,maxRounds:o,recentHistory:s,currentUserMessageId:l,rootMessageId:d}){let c=new TextEncoder;return new ReadableStream({async start(u){let p=[],f=e=>{try{u.enqueue(c.encode(`data: ${JSON.stringify(e)}
117
+ ${n}${j}`:`${n}${j}`,N=R.slice(-20).map(e=>({id:e.id,name:"user"===e.role?"User":e.participantId?S[e.participantId]?.name||e.participantId:"Assistant",content:e.content})),D=function({threadId:e,allParticipants:t,mentioned:n,initialParallelIds:i,prompt:r,signal:a,maxRounds:o,recentHistory:s,currentUserMessageId:l,rootMessageId:d}){let c=new TextEncoder;return new ReadableStream({async start(u){let p=[],f=e=>{try{u.enqueue(c.encode(`data: ${JSON.stringify(e)}
118
118
 
119
- `))}catch{}"log"===e.type&&p.push({participantId:e.participantId,stream:e.stream,line:e.line,timestamp:Date.now()})},m=async()=>{p.length>0&&await (0,$.saveLogs)(e,p).catch(()=>{})},h=[],g=[],y=s?s.map(e=>({name:e.name,content:e.content})):[],w=t[0],v=new Set;if(n.size>0)for(let e of n)v.add(e);else v.add(w.id);let S=o??10,I=new Set(v);for(let n=0;n<S&&!a?.aborted;n++){let o=!0,c=t.filter(e=>v.has(e.id)),u=new Set,p=new Set;if(0===n&&i&&i.size>0){let n=c.filter(e=>i.has(e.id)&&I.has(e.id));if(n.length>0){for(let e of n)p.add(e.id);let i=n.map(async n=>{let i=await G(e,n,t,c,r,h,s||[],g,l||null,a,f,d);return{agent:n,result:i}});for(let e of(await Promise.allSettled(i))){if("fulfilled"!==e.status)continue;let{agent:t,result:n}=e.value;if(!n.skipped)for(let e of(n.response&&n.messageId&&g.push({id:n.messageId,name:t.name,content:n.response}),n.response&&([...y,...h].filter(e=>e.name===t.name).some(e=>Z(e.content,n.response)>.5)||(h.push({name:t.name,content:n.response}),o=!1)),n.mentions))v.add(e),c.findIndex(t=>t.id===e)>=0&&!p.has(e)&&I.has(e)||u.add(e)}}}for(let n=0;n<c.length;n++){let i=c[n];if(a?.aborted)break;if(!I.has(i.id)||p.has(i.id))continue;let m=await G(e,i,t,c,r,h,s||[],g,l||null,a,f,d);if(m.skipped||(m.response&&m.messageId&&g.push({id:m.messageId,name:i.name,content:m.response}),m.response&&[...y,...h].filter(e=>e.name===i.name).some(e=>Z(e.content,m.response)>.5)))continue;for(let e of(o=!1,m.response&&h.push({name:i.name,content:m.response}),m.mentions))c.findIndex(t=>t.id===e)>n&&I.has(e)||u.add(e);let w=new Set;for(let e of m.mentions)v.has(e)||(v.add(e),w.add(e));let S=new Set([...m.parallelIds].filter(e=>w.has(e)));if(S.size>0){let n=t.filter(e=>S.has(e.id)),i=t.filter(e=>v.has(e.id)),o=n.map(async n=>{let o=await G(e,n,t,i,r,h,s||[],g,l||null,a,f,d);return{agent:n,result:o}});for(let e of(await Promise.allSettled(o))){if("fulfilled"!==e.status)continue;let{agent:t,result:n}=e.value;if(!n.skipped){if(n.response&&n.messageId&&g.push({id:n.messageId,name:t.name,content:n.response}),n.response){if([...y,...h].filter(e=>e.name===t.name).some(e=>Z(e.content,n.response)>.5))continue;h.push({name:t.name,content:n.response})}for(let e of n.mentions)v.add(e),u.add(e)}}}}if(o)break;I=u}await m(),f({type:"done"}),u.close()}})}({threadId:i,allParticipants:m,mentioned:d,initialParallelIds:c,prompt:T,signal:e.signal,maxRounds:O,recentHistory:N,currentUserMessageId:g,rootMessageId:A});return new Response(M,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}e.s(["POST",()=>en,"dynamic",0,"force-dynamic","runtime",0,"nodejs"],54553);var ei=e.i(54553);let er=new t.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/chat/route",pathname:"/api/chat",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/Projects/Agents/agx-cloud/app/api/chat/route.ts",nextConfigOutput:"standalone",userland:ei}),{workAsyncStorage:ea,workUnitAsyncStorage:eo,serverHooks:es}=er;function el(){return(0,i.patchFetch)({workAsyncStorage:ea,workUnitAsyncStorage:eo})}async function ed(e,t,i){er.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/chat/route";w=w.replace(/\/index$/,"")||"/";let v=await er.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==i.waitUntil||i.waitUntil.call(i,Promise.resolve()),null;let{buildId:S,params:$,nextConfig:I,parsedUrl:b,isDraftMode:R,prerenderManifest:x,routerServerContext:C,isOnDemandRevalidate:E,revalidateOnlyGenerated:k,resolvedPathname:j,clientReferenceManifest:A,serverActionsManifest:O}=v,T=(0,s.normalizeAppPath)(w),N=!!(x.dynamicRoutes[T]||x.routes[j]),M=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,b,!1):t.end("This page could not be found"),null);if(N&&!R){let e=!!x.routes[j],t=x.dynamicRoutes[T];if(t&&!1===t.fallback&&!e){if(I.experimental.adapterPath)return await M();throw new g.NoFallbackError}}let D=null;!N||er.isDev||R||(D="/index"===(D=j)?"/":D);let P=!0===er.isDev||!N,_=N&&!P;O&&A&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:A,serverActionsManifest:O});let L=e.method||"GET",F=(0,a.getTracer)(),U=F.getActiveScopeSpan(),z={params:$,prerenderManifest:x,renderOpts:{experimental:{authInterrupts:!!I.experimental.authInterrupts},cacheComponents:!!I.cacheComponents,supportsDynamicResponse:P,incrementalCache:(0,r.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:I.cacheLife,waitUntil:i.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,i,r)=>er.onRequestError(e,t,i,r,C)},sharedContext:{buildId:S}},H=new l.NodeNextRequest(e),q=new l.NodeNextResponse(t),B=d.NextRequestAdapter.fromNodeNextRequest(H,(0,d.signalFromNodeResponse)(t));try{let o=async e=>er.handle(B,z).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let n=F.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==c.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let i=n.get("next.route");if(i){let t=`${L} ${i}`;e.setAttributes({"next.route":i,"http.route":i,"next.span_name":t}),e.updateName(t)}else e.updateName(`${L} ${w}`)}),s=!!(0,r.getRequestMeta)(e,"minimalMode"),l=async r=>{var a,l;let d=async({previousCacheEntry:n})=>{try{if(!s&&E&&k&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(r);e.fetchMetrics=z.renderOpts.fetchMetrics;let l=z.renderOpts.pendingWaitUntil;l&&i.waitUntil&&(i.waitUntil(l),l=void 0);let d=z.renderOpts.collectedTags;if(!N)return await (0,p.sendResponse)(H,q,a,z.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);d&&(t[h.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,i=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:z.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:i}}}}catch(t){throw(null==n?void 0:n.isStale)&&await er.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:_,isOnDemandRevalidate:E})},!1,C),t}},c=await er.handleResponse({req:e,nextConfig:I,cacheKey:D,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:x,isRoutePPREnabled:!1,isOnDemandRevalidate:E,revalidateOnlyGenerated:k,responseGenerator:d,waitUntil:i.waitUntil,isMinimalMode:s});if(!N)return null;if((null==c||null==(a=c.value)?void 0:a.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==c||null==(l=c.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});s||t.setHeader("x-nextjs-cache",E?"REVALIDATED":c.isMiss?"MISS":c.isStale?"STALE":"HIT"),R&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,f.fromNodeOutgoingHttpHeaders)(c.value.headers);return s&&N||g.delete(h.NEXT_CACHE_TAGS_HEADER),!c.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,m.getCacheControlHeader)(c.cacheControl)),await (0,p.sendResponse)(H,q,new Response(c.value.body,{headers:g,status:c.value.status||200})),null};U?await l(U):await F.withPropagatedContext(e.headers,()=>F.trace(c.BaseServerSpan.handleRequest,{spanName:`${L} ${w}`,kind:a.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},l))}catch(t){if(t instanceof g.NoFallbackError||await er.onRequestError(e,t,{routerKind:"App Router",routePath:T,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:_,isOnDemandRevalidate:E})},!1,C),N)throw t;return await (0,p.sendResponse)(H,q,new Response(null,{status:500})),null}}e.s(["handler",()=>ed,"patchFetch",()=>el,"routeModule",()=>er,"serverHooks",()=>es,"workAsyncStorage",()=>ea,"workUnitAsyncStorage",()=>eo],73590)}];
119
+ `))}catch{}"log"===e.type&&p.push({participantId:e.participantId,stream:e.stream,line:e.line,timestamp:Date.now()})},m=async()=>{p.length>0&&await (0,I.saveLogs)(e,p).catch(()=>{})},h=[],g=[],y=s?s.map(e=>({name:e.name,content:e.content})):[],w=t[0],v=new Set;if(n.size>0)for(let e of n)v.add(e);else v.add(w.id);let S=o??10,$=new Set(v);for(let n=0;n<S&&!a?.aborted;n++){let o=!0,c=t.filter(e=>v.has(e.id)),u=new Set,p=new Set;if(0===n&&i&&i.size>0){let n=c.filter(e=>i.has(e.id)&&$.has(e.id));if(n.length>0){for(let e of n)p.add(e.id);let i=n.map(async n=>{let i=await X(e,n,t,c,r,h,s||[],g,l||null,a,f,d);return{agent:n,result:i}});for(let e of(await Promise.allSettled(i))){if("fulfilled"!==e.status)continue;let{agent:t,result:n}=e.value;if(!n.skipped)for(let e of(n.response&&n.messageId&&g.push({id:n.messageId,name:t.name,content:n.response}),n.response&&([...y,...h].filter(e=>e.name===t.name).some(e=>G(e.content,n.response)>.5)||(h.push({name:t.name,content:n.response}),o=!1)),n.mentions))v.add(e),c.findIndex(t=>t.id===e)>=0&&!p.has(e)&&$.has(e)||u.add(e)}}}for(let n=0;n<c.length;n++){let i=c[n];if(a?.aborted)break;if(!$.has(i.id)||p.has(i.id))continue;let m=await X(e,i,t,c,r,h,s||[],g,l||null,a,f,d);if(m.skipped||(m.response&&m.messageId&&g.push({id:m.messageId,name:i.name,content:m.response}),m.response&&[...y,...h].filter(e=>e.name===i.name).some(e=>G(e.content,m.response)>.5)))continue;for(let e of(o=!1,m.response&&h.push({name:i.name,content:m.response}),m.mentions))c.findIndex(t=>t.id===e)>n&&$.has(e)||u.add(e);let w=new Set;for(let e of m.mentions)v.has(e)||(v.add(e),w.add(e));let S=new Set([...m.parallelIds].filter(e=>w.has(e)));if(S.size>0){let n=t.filter(e=>S.has(e.id)),i=t.filter(e=>v.has(e.id)),o=n.map(async n=>{let o=await X(e,n,t,i,r,h,s||[],g,l||null,a,f,d);return{agent:n,result:o}});for(let e of(await Promise.allSettled(o))){if("fulfilled"!==e.status)continue;let{agent:t,result:n}=e.value;if(!n.skipped){if(n.response&&n.messageId&&g.push({id:n.messageId,name:t.name,content:n.response}),n.response){if([...y,...h].filter(e=>e.name===t.name).some(e=>G(e.content,n.response)>.5))continue;h.push({name:t.name,content:n.response})}for(let e of n.mentions)v.add(e),u.add(e)}}}}if(o)break;$=u}await m(),f({type:"done"}),u.close()}})}({threadId:i,allParticipants:m,mentioned:d,initialParallelIds:c,prompt:T,signal:e.signal,maxRounds:O,recentHistory:N,currentUserMessageId:g,rootMessageId:A});return new Response(D,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}e.s(["POST",()=>ei,"dynamic",0,"force-dynamic","runtime",0,"nodejs"],54553);var er=e.i(54553);let ea=new t.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/chat/route",pathname:"/api/chat",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/Projects/Agents/agx-cloud/app/api/chat/route.ts",nextConfigOutput:"standalone",userland:er}),{workAsyncStorage:eo,workUnitAsyncStorage:es,serverHooks:el}=ea;function ed(){return(0,i.patchFetch)({workAsyncStorage:eo,workUnitAsyncStorage:es})}async function ec(e,t,i){ea.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/chat/route";w=w.replace(/\/index$/,"")||"/";let v=await ea.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==i.waitUntil||i.waitUntil.call(i,Promise.resolve()),null;let{buildId:S,params:$,nextConfig:I,parsedUrl:b,isDraftMode:R,prerenderManifest:x,routerServerContext:C,isOnDemandRevalidate:E,revalidateOnlyGenerated:k,resolvedPathname:j,clientReferenceManifest:A,serverActionsManifest:O}=v,T=(0,s.normalizeAppPath)(w),N=!!(x.dynamicRoutes[T]||x.routes[j]),D=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,b,!1):t.end("This page could not be found"),null);if(N&&!R){let e=!!x.routes[j],t=x.dynamicRoutes[T];if(t&&!1===t.fallback&&!e){if(I.experimental.adapterPath)return await D();throw new g.NoFallbackError}}let M=null;!N||ea.isDev||R||(M="/index"===(M=j)?"/":M);let P=!0===ea.isDev||!N,_=N&&!P;O&&A&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:A,serverActionsManifest:O});let L=e.method||"GET",F=(0,a.getTracer)(),U=F.getActiveScopeSpan(),z={params:$,prerenderManifest:x,renderOpts:{experimental:{authInterrupts:!!I.experimental.authInterrupts},cacheComponents:!!I.cacheComponents,supportsDynamicResponse:P,incrementalCache:(0,r.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:I.cacheLife,waitUntil:i.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,i,r)=>ea.onRequestError(e,t,i,r,C)},sharedContext:{buildId:S}},H=new l.NodeNextRequest(e),q=new l.NodeNextResponse(t),B=d.NextRequestAdapter.fromNodeNextRequest(H,(0,d.signalFromNodeResponse)(t));try{let o=async e=>ea.handle(B,z).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let n=F.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==c.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let i=n.get("next.route");if(i){let t=`${L} ${i}`;e.setAttributes({"next.route":i,"http.route":i,"next.span_name":t}),e.updateName(t)}else e.updateName(`${L} ${w}`)}),s=!!(0,r.getRequestMeta)(e,"minimalMode"),l=async r=>{var a,l;let d=async({previousCacheEntry:n})=>{try{if(!s&&E&&k&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(r);e.fetchMetrics=z.renderOpts.fetchMetrics;let l=z.renderOpts.pendingWaitUntil;l&&i.waitUntil&&(i.waitUntil(l),l=void 0);let d=z.renderOpts.collectedTags;if(!N)return await (0,p.sendResponse)(H,q,a,z.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);d&&(t[h.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,i=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:z.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:i}}}}catch(t){throw(null==n?void 0:n.isStale)&&await ea.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:_,isOnDemandRevalidate:E})},!1,C),t}},c=await ea.handleResponse({req:e,nextConfig:I,cacheKey:M,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:x,isRoutePPREnabled:!1,isOnDemandRevalidate:E,revalidateOnlyGenerated:k,responseGenerator:d,waitUntil:i.waitUntil,isMinimalMode:s});if(!N)return null;if((null==c||null==(a=c.value)?void 0:a.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==c||null==(l=c.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});s||t.setHeader("x-nextjs-cache",E?"REVALIDATED":c.isMiss?"MISS":c.isStale?"STALE":"HIT"),R&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,f.fromNodeOutgoingHttpHeaders)(c.value.headers);return s&&N||g.delete(h.NEXT_CACHE_TAGS_HEADER),!c.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,m.getCacheControlHeader)(c.cacheControl)),await (0,p.sendResponse)(H,q,new Response(c.value.body,{headers:g,status:c.value.status||200})),null};U?await l(U):await F.withPropagatedContext(e.headers,()=>F.trace(c.BaseServerSpan.handleRequest,{spanName:`${L} ${w}`,kind:a.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},l))}catch(t){if(t instanceof g.NoFallbackError||await ea.onRequestError(e,t,{routerKind:"App Router",routePath:T,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:_,isOnDemandRevalidate:E})},!1,C),N)throw t;return await (0,p.sendResponse)(H,q,new Response(null,{status:500})),null}}e.s(["handler",()=>ec,"patchFetch",()=>ed,"routeModule",()=>ea,"serverHooks",()=>el,"workAsyncStorage",()=>eo,"workUnitAsyncStorage",()=>es],73590)}];
120
120
 
121
121
  //# sourceMappingURL=ae43b_next_dist_esm_build_templates_app-route_122e31fe.js.map
@@ -20,11 +20,11 @@
20
20
  "wasm": [],
21
21
  "assets": [],
22
22
  "env": {
23
- "__NEXT_BUILD_ID": "cQx_idFVUUY_8HM8dQbVC",
24
- "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "kIh8j+S9B11NI0UjiTP1uIlrM1fYGiqF+j49fxPXlYQ=",
25
- "__NEXT_PREVIEW_MODE_ID": "0f198e688f79837b92c93f2d8aa96a5a",
26
- "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "6ef6c44330e80cabdf92d23b8cf470a1d1c066a04c6251d100dd7a300e9748a3",
27
- "__NEXT_PREVIEW_MODE_SIGNING_KEY": "cfd75bcf3efd878a0705b9a00d096997ea700cae1f0e393032fa629f1ef8262e"
23
+ "__NEXT_BUILD_ID": "1H85C8T4JXGTcuoMfgKmi",
24
+ "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "d1QxH3hHNBs1hXUEBHLrBuAZCQT3clKmfjuEw7pLkAU=",
25
+ "__NEXT_PREVIEW_MODE_ID": "d2e0e02f30074e01f49bbfc2a91382de",
26
+ "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "04a8365df0387ab5dbd2de105c99d9492d2a643cedae548ad89c0294f8ba311a",
27
+ "__NEXT_PREVIEW_MODE_SIGNING_KEY": "9fb526762862b374ba65d09acb88e1e1543f305a01b40d4ba323d357889b14eb"
28
28
  }
29
29
  }
30
30
  },
@@ -1 +1 @@
1
- <!DOCTYPE html><!--cQx_idFVUUY_8HM8dQbVC--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/2473c16c0c2f6b5f.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/chunks/95901ed98d4ed7b1.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/35d7a50f82ee022b.js"/><script src="/_next/static/chunks/0de28ce711b17cb2.js" async=""></script><script src="/_next/static/chunks/4b60076b71f35de1.js" async=""></script><script src="/_next/static/chunks/31ae3b31083648d6.js" async=""></script><script src="/_next/static/chunks/1b5be5e5fcbdc0e4.js" async=""></script><script src="/_next/static/chunks/turbopack-00b77899bb57f964.js" async=""></script><script src="/_next/static/chunks/e805840229a797b0.js" async=""></script><script src="/_next/static/chunks/b24b4ec48b2cc8e8.js" async=""></script><link rel="preload" href="https://www.googletagmanager.com/gtag/js?id=G-DVQQG95LNL" as="script"/><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>AGX</title><meta name="description" content="Agent task orchestration and group chat"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable antialiased h-screen overflow-hidden bg-[var(--background)] text-[var(--foreground)] selection:bg-[var(--primary)] selection:text-[var(--primary-foreground)]"><div hidden=""><!--$--><!--/$--></div><div class="min-h-screen flex items-center justify-center bg-[var(--background)]"><span class="spinner w-8 h-8 border-3 border-[var(--primary)] border-t-transparent rounded-full"></span></div><script src="/_next/static/chunks/35d7a50f82ee022b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[56179,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n3:I[41222,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n4:I[32494,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n5:I[98919,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"GoogleAnalytics\"]\n6:I[53696,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"PostHogAnalytics\"]\n7:I[92276,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"OutletBoundary\"]\n8:\"$Sreact.suspense\"\na:I[92276,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"ViewportBoundary\"]\nc:I[92276,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"MetadataBoundary\"]\ne:I[93768,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n:HL[\"/_next/static/chunks/2473c16c0c2f6b5f.css\",\"style\"]\n:HL[\"/_next/static/chunks/95901ed98d4ed7b1.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"cQx_idFVUUY_8HM8dQbVC\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/2473c16c0c2f6b5f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/95901ed98d4ed7b1.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/e805840229a797b0.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/b24b4ec48b2cc8e8.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable antialiased h-screen overflow-hidden bg-[var(--background)] text-[var(--foreground)] selection:bg-[var(--primary)] selection:text-[var(--primary-foreground)]\",\"children\":[[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}],[\"$\",\"$L5\",null,{}],[\"$\",\"$L6\",null,{}]]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L7\",null,{\"children\":[\"$\",\"$8\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@9\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$8\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"9:null\nd:[[\"$\",\"title\",\"0\",{\"children\":\"AGX\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Agent task orchestration and group chat\"}]]\n"])</script></body></html>
1
+ <!DOCTYPE html><!--1H85C8T4JXGTcuoMfgKmi--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/2473c16c0c2f6b5f.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/chunks/95901ed98d4ed7b1.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/35d7a50f82ee022b.js"/><script src="/_next/static/chunks/0de28ce711b17cb2.js" async=""></script><script src="/_next/static/chunks/4b60076b71f35de1.js" async=""></script><script src="/_next/static/chunks/31ae3b31083648d6.js" async=""></script><script src="/_next/static/chunks/1b5be5e5fcbdc0e4.js" async=""></script><script src="/_next/static/chunks/turbopack-00b77899bb57f964.js" async=""></script><script src="/_next/static/chunks/e805840229a797b0.js" async=""></script><script src="/_next/static/chunks/b24b4ec48b2cc8e8.js" async=""></script><link rel="preload" href="https://www.googletagmanager.com/gtag/js?id=G-DVQQG95LNL" as="script"/><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>AGX</title><meta name="description" content="Agent task orchestration and group chat"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable antialiased h-screen overflow-hidden bg-[var(--background)] text-[var(--foreground)] selection:bg-[var(--primary)] selection:text-[var(--primary-foreground)]"><div hidden=""><!--$--><!--/$--></div><div class="min-h-screen flex items-center justify-center bg-[var(--background)]"><span class="spinner w-8 h-8 border-3 border-[var(--primary)] border-t-transparent rounded-full"></span></div><script src="/_next/static/chunks/35d7a50f82ee022b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[56179,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n3:I[41222,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n4:I[32494,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n5:I[98919,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"GoogleAnalytics\"]\n6:I[53696,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"PostHogAnalytics\"]\n7:I[92276,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"OutletBoundary\"]\n8:\"$Sreact.suspense\"\na:I[92276,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"ViewportBoundary\"]\nc:I[92276,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"MetadataBoundary\"]\ne:I[93768,[\"/_next/static/chunks/e805840229a797b0.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n:HL[\"/_next/static/chunks/2473c16c0c2f6b5f.css\",\"style\"]\n:HL[\"/_next/static/chunks/95901ed98d4ed7b1.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"1H85C8T4JXGTcuoMfgKmi\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/2473c16c0c2f6b5f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/95901ed98d4ed7b1.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/e805840229a797b0.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/b24b4ec48b2cc8e8.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable antialiased h-screen overflow-hidden bg-[var(--background)] text-[var(--foreground)] selection:bg-[var(--primary)] selection:text-[var(--primary-foreground)]\",\"children\":[[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}],[\"$\",\"$L5\",null,{}],[\"$\",\"$L6\",null,{}]]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L7\",null,{\"children\":[\"$\",\"$8\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@9\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$8\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"9:null\nd:[[\"$\",\"title\",\"0\",{\"children\":\"AGX\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Agent task orchestration and group chat\"}]]\n"])</script></body></html>
@@ -1,2 +1,2 @@
1
- <!DOCTYPE html><!--cQx_idFVUUY_8HM8dQbVC--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/35d7a50f82ee022b.js"/><script src="/_next/static/chunks/0de28ce711b17cb2.js" async=""></script><script src="/_next/static/chunks/4b60076b71f35de1.js" async=""></script><script src="/_next/static/chunks/31ae3b31083648d6.js" async=""></script><script src="/_next/static/chunks/1b5be5e5fcbdc0e4.js" async=""></script><script src="/_next/static/chunks/turbopack-00b77899bb57f964.js" async=""></script><script src="/_next/static/chunks/db9dc0d8607aa034.js" async=""></script><script src="/_next/static/chunks/b24b4ec48b2cc8e8.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: Internal Server Error.</title><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
2
- @media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/35d7a50f82ee022b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[41222,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n3:I[32494,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n4:I[92276,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[92276,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"ViewportBoundary\"]\n9:I[92276,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"MetadataBoundary\"]\nb:I[93768,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"cQx_idFVUUY_8HM8dQbVC\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/db9dc0d8607aa034.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/b24b4ec48b2cc8e8.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\na:[]\n"])</script></body></html>
1
+ <!DOCTYPE html><!--1H85C8T4JXGTcuoMfgKmi--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/35d7a50f82ee022b.js"/><script src="/_next/static/chunks/0de28ce711b17cb2.js" async=""></script><script src="/_next/static/chunks/4b60076b71f35de1.js" async=""></script><script src="/_next/static/chunks/31ae3b31083648d6.js" async=""></script><script src="/_next/static/chunks/1b5be5e5fcbdc0e4.js" async=""></script><script src="/_next/static/chunks/turbopack-00b77899bb57f964.js" async=""></script><script src="/_next/static/chunks/db9dc0d8607aa034.js" async=""></script><script src="/_next/static/chunks/b24b4ec48b2cc8e8.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: Internal Server Error.</title><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
2
+ @media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/35d7a50f82ee022b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[41222,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n3:I[32494,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n4:I[92276,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[92276,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"ViewportBoundary\"]\n9:I[92276,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"MetadataBoundary\"]\nb:I[93768,[\"/_next/static/chunks/db9dc0d8607aa034.js\",\"/_next/static/chunks/b24b4ec48b2cc8e8.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"1H85C8T4JXGTcuoMfgKmi\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/db9dc0d8607aa034.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/b24b4ec48b2cc8e8.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\na:[]\n"])</script></body></html>
@@ -1 +1 @@
1
- self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"kIh8j+S9B11NI0UjiTP1uIlrM1fYGiqF+j49fxPXlYQ=\"\n}"
1
+ self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"d1QxH3hHNBs1hXUEBHLrBuAZCQT3clKmfjuEw7pLkAU=\"\n}"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "node": {},
3
3
  "edge": {},
4
- "encryptionKey": "kIh8j+S9B11NI0UjiTP1uIlrM1fYGiqF+j49fxPXlYQ="
4
+ "encryptionKey": "d1QxH3hHNBs1hXUEBHLrBuAZCQT3clKmfjuEw7pLkAU="
5
5
  }
@@ -19,7 +19,7 @@ interface ChatRequestBody {
19
19
  activeParticipantIds?: unknown;
20
20
  }
21
21
 
22
- const MAX_HISTORY_CHARS = 10_000;
22
+ const MAX_HISTORY_CHARS = 200_000;
23
23
  const SUMMARY_MARKER = "<!-- thread-summary -->";
24
24
  const CHAT_MENTION_PATTERN = /@([A-Za-z0-9_-]+)/g;
25
25
 
@@ -39,10 +39,12 @@ function buildHistoryContext(history: GroupMessage[], participantMap: Participan
39
39
  const lines: string[] = [];
40
40
  let totalChars = 0;
41
41
 
42
- for (const message of history) {
42
+ // Iterate newest-first so the most recent context is always included
43
+ for (let i = history.length - 1; i >= 0; i--) {
44
+ const message = history[i];
43
45
  const line = `${getSpeakerLabel(message, participantMap)}: ${message.content}`;
44
46
  if (totalChars + line.length > MAX_HISTORY_CHARS) break;
45
- lines.push(line);
47
+ lines.unshift(line);
46
48
  totalChars += line.length;
47
49
  }
48
50
 
@@ -0,0 +1,6 @@
1
+ import { NextResponse } from "next/server";
2
+ import { getAll } from "@/lib/agent-process-registry";
3
+
4
+ export async function GET() {
5
+ return NextResponse.json(getAll());
6
+ }
@@ -0,0 +1,126 @@
1
+ import { getSQLiteDb } from "./sqlite-query-adapter";
2
+
3
+ export interface AgentProcessEntry {
4
+ threadId: string;
5
+ agentId: string;
6
+ pid: number;
7
+ state: "spawning" | "running" | "done" | "error" | "killed";
8
+ sinceMessageId: string;
9
+ startedAt: number;
10
+ lastActivity: number;
11
+ }
12
+
13
+ interface Row {
14
+ thread_id: string;
15
+ agent_id: string;
16
+ pid: number;
17
+ state: string;
18
+ since_message_id: string;
19
+ started_at: number;
20
+ last_activity: number;
21
+ }
22
+
23
+ function toEntry(row: Row): AgentProcessEntry {
24
+ return {
25
+ threadId: row.thread_id,
26
+ agentId: row.agent_id,
27
+ pid: row.pid,
28
+ state: row.state as AgentProcessEntry["state"],
29
+ sinceMessageId: row.since_message_id,
30
+ startedAt: row.started_at,
31
+ lastActivity: row.last_activity,
32
+ };
33
+ }
34
+
35
+ export function register(entry: AgentProcessEntry): void {
36
+ const db = getSQLiteDb();
37
+ db.prepare(
38
+ `INSERT OR REPLACE INTO agent_processes (thread_id, agent_id, pid, state, since_message_id, started_at, last_activity)
39
+ VALUES (?, ?, ?, ?, ?, ?, ?)`
40
+ ).run(
41
+ entry.threadId,
42
+ entry.agentId,
43
+ entry.pid,
44
+ entry.state,
45
+ entry.sinceMessageId,
46
+ entry.startedAt,
47
+ entry.lastActivity
48
+ );
49
+ }
50
+
51
+ export function update(
52
+ threadId: string,
53
+ agentId: string,
54
+ patch: Partial<Pick<AgentProcessEntry, "state" | "lastActivity" | "pid">>
55
+ ): void {
56
+ const sets: string[] = [];
57
+ const values: (string | number)[] = [];
58
+
59
+ if (patch.state !== undefined) {
60
+ sets.push("state = ?");
61
+ values.push(patch.state);
62
+ }
63
+ if (patch.lastActivity !== undefined) {
64
+ sets.push("last_activity = ?");
65
+ values.push(patch.lastActivity);
66
+ }
67
+ if (patch.pid !== undefined) {
68
+ sets.push("pid = ?");
69
+ values.push(patch.pid);
70
+ }
71
+
72
+ if (sets.length === 0) return;
73
+
74
+ const db = getSQLiteDb();
75
+ db.prepare(
76
+ `UPDATE agent_processes SET ${sets.join(", ")} WHERE thread_id = ? AND agent_id = ?`
77
+ ).run(...values, threadId, agentId);
78
+ }
79
+
80
+ export function remove(threadId: string, agentId: string): void {
81
+ const db = getSQLiteDb();
82
+ db.prepare("DELETE FROM agent_processes WHERE thread_id = ? AND agent_id = ?").run(
83
+ threadId,
84
+ agentId
85
+ );
86
+ }
87
+
88
+ export function getByThread(threadId: string): AgentProcessEntry[] {
89
+ const db = getSQLiteDb();
90
+ const rows = db
91
+ .prepare("SELECT * FROM agent_processes WHERE thread_id = ?")
92
+ .all(threadId) as Row[];
93
+ return rows.map(toEntry);
94
+ }
95
+
96
+ export function getAll(): AgentProcessEntry[] {
97
+ const db = getSQLiteDb();
98
+ const rows = db.prepare("SELECT * FROM agent_processes").all() as Row[];
99
+ return rows.map(toEntry);
100
+ }
101
+
102
+ export function killByThread(threadId: string): number {
103
+ const entries = getByThread(threadId).filter(
104
+ (e) => e.state === "running" || e.state === "spawning"
105
+ );
106
+
107
+ let killed = 0;
108
+ for (const entry of entries) {
109
+ try {
110
+ process.kill(entry.pid, "SIGTERM");
111
+ } catch {
112
+ // process may already be dead
113
+ }
114
+ killed++;
115
+ }
116
+
117
+ if (killed > 0) {
118
+ const db = getSQLiteDb();
119
+ db.prepare(
120
+ `UPDATE agent_processes SET state = 'killed', last_activity = ?
121
+ WHERE thread_id = ? AND state IN ('running', 'spawning')`
122
+ ).run(Date.now(), threadId);
123
+ }
124
+
125
+ return killed;
126
+ }
@@ -397,6 +397,7 @@ async function runCommandStreamed({
397
397
  signal,
398
398
  onDelta,
399
399
  onLog,
400
+ onSpawn,
400
401
  }: {
401
402
  command: string;
402
403
  args: string[];
@@ -404,6 +405,7 @@ async function runCommandStreamed({
404
405
  signal?: AbortSignal;
405
406
  onDelta: (chunk: string) => void;
406
407
  onLog?: (stream: "stdout" | "stderr", line: string) => void;
408
+ onSpawn?: (pid: number) => void;
407
409
  }): Promise<void> {
408
410
  await new Promise<void>((resolve, reject) => {
409
411
  if (onLog) onLog("stderr", `$ ${command} ${args.map(a => a.length > 80 ? a.slice(0, 80) + '…' : a).join(' ')}\n`);
@@ -432,6 +434,8 @@ async function runCommandStreamed({
432
434
 
433
435
  if (signal) signal.addEventListener("abort", onAbort, { once: true });
434
436
 
437
+ if (onSpawn && child.pid) onSpawn(child.pid);
438
+
435
439
  const timer = setTimeout(() => {
436
440
  timedOut = true;
437
441
  child.kill("SIGKILL");
@@ -479,6 +483,7 @@ export async function runCliResponse({
479
483
  signal,
480
484
  onDelta,
481
485
  onLog,
486
+ onSpawn,
482
487
  }: {
483
488
  provider: ChatProvider;
484
489
  model: string | null;
@@ -490,6 +495,7 @@ export async function runCliResponse({
490
495
  signal?: AbortSignal;
491
496
  onDelta: (chunk: string) => void;
492
497
  onLog?: (stream: "stdout" | "stderr", line: string) => void;
498
+ onSpawn?: (pid: number) => void;
493
499
  }): Promise<void> {
494
500
  const timeoutMs = 600_000;
495
501
  const sanitize = createCliChunkSanitizer();
@@ -545,6 +551,7 @@ export async function runCliResponse({
545
551
  signal,
546
552
  onDelta: parser.push,
547
553
  onLog,
554
+ onSpawn,
548
555
  });
549
556
  parser.flush();
550
557
  return;
@@ -90,6 +90,21 @@ function runMigrations(db: Database.Database): void {
90
90
  db.exec("ALTER TABLE teams ADD COLUMN is_default INTEGER NOT NULL DEFAULT 0");
91
91
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_teams_default ON teams (user_id) WHERE is_default = 1");
92
92
  }
93
+
94
+ // Agent process registry table
95
+ db.exec(`
96
+ CREATE TABLE IF NOT EXISTS agent_processes (
97
+ thread_id TEXT NOT NULL,
98
+ agent_id TEXT NOT NULL,
99
+ pid INTEGER NOT NULL DEFAULT 0,
100
+ state TEXT NOT NULL DEFAULT 'spawning',
101
+ since_message_id TEXT NOT NULL DEFAULT '',
102
+ started_at INTEGER NOT NULL,
103
+ last_activity INTEGER NOT NULL,
104
+ PRIMARY KEY (thread_id, agent_id)
105
+ )
106
+ `);
107
+ db.exec("CREATE INDEX IF NOT EXISTS idx_agent_processes_state ON agent_processes (state)");
93
108
  }
94
109
 
95
110
  // ── JSON column set (same as db-adapter.ts) ─────────────────────────────────