@mndrk/agx 1.4.64 → 2.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (532) hide show
  1. package/README.md +2 -1
  2. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/BUILD_ID +1 -1
  3. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/app-build-manifest.json +391 -142
  4. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/app-path-routes-manifest.json +43 -16
  5. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/build-manifest.json +7 -7
  6. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/dynamic-css-manifest.json +1 -0
  7. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/prerender-manifest.json +57 -9
  8. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/required-server-files.json +2 -0
  9. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/routes-manifest.json +197 -0
  10. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found/page.js +3 -3
  11. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found/page.js.nft.json +1 -1
  12. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found/page_client-reference-manifest.js +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 +6 -5
  15. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/audit/route.js +1 -1
  16. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/audit/route.js.nft.json +1 -1
  17. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/audit/route_client-reference-manifest.js +1 -1
  18. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
  19. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/[...nextauth]/route_client-reference-manifest.js +1 -1
  20. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/daemon-secret/route.js +1 -1
  21. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/daemon-secret/route.js.nft.json +1 -1
  22. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/daemon-secret/route_client-reference-manifest.js +1 -1
  23. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/device/code/route.js.nft.json +1 -1
  24. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/device/code/route_client-reference-manifest.js +1 -1
  25. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/device/token/route.js.nft.json +1 -1
  26. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/device/token/route_client-reference-manifest.js +1 -1
  27. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/refresh/route.js.nft.json +1 -1
  28. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/refresh/route_client-reference-manifest.js +1 -1
  29. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  30. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  31. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/chat/history/route.js +28 -0
  32. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/chat/history/route.js.nft.json +1 -0
  33. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/chat/history/route_client-reference-manifest.js +1 -0
  34. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/chat/route.js +111 -0
  35. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/chat/route.js.nft.json +1 -0
  36. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/chat/route_client-reference-manifest.js +1 -0
  37. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/domains/[id]/route.js.nft.json +1 -1
  38. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/domains/[id]/route_client-reference-manifest.js +1 -1
  39. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/domains/route.js.nft.json +1 -1
  40. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/domains/route_client-reference-manifest.js +1 -1
  41. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/health/route.js.nft.json +1 -1
  42. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  43. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/learnings/route.js +1 -1
  44. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/learnings/route.js.nft.json +1 -1
  45. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/learnings/route_client-reference-manifest.js +1 -1
  46. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/logs/stream/route.js.nft.json +1 -1
  47. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/logs/stream/route_client-reference-manifest.js +1 -1
  48. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/cancel/route.js.nft.json +1 -1
  49. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  50. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/signal/route.js.nft.json +1 -1
  51. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/signal/route_client-reference-manifest.js +1 -1
  52. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/start/route.js +1 -1
  53. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/start/route.js.nft.json +1 -1
  54. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/start/route_client-reference-manifest.js +1 -1
  55. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/status/route.js +1 -1
  56. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/status/route.js.nft.json +1 -1
  57. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/status/route_client-reference-manifest.js +1 -1
  58. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v1/route.js +1 -0
  59. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v1/route.js.nft.json +1 -0
  60. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v1/route_client-reference-manifest.js +1 -0
  61. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v2/route.js +1 -0
  62. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v2/route.js.nft.json +1 -0
  63. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v2/route_client-reference-manifest.js +1 -0
  64. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/route.js +1 -1
  65. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
  66. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
  67. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/route.js +1 -1
  68. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/route.js.nft.json +1 -1
  69. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  70. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/providers/route.js +1 -1
  71. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/providers/route.js.nft.json +1 -1
  72. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  73. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/complete/route.js +1 -1
  74. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/complete/route.js.nft.json +1 -1
  75. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/complete/route_client-reference-manifest.js +1 -1
  76. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/route.js +1 -1
  77. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/route.js.nft.json +1 -1
  78. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/route_client-reference-manifest.js +1 -1
  79. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/stage-prompts/route.js +1 -1
  80. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/stage-prompts/route.js.nft.json +1 -1
  81. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/stage-prompts/route_client-reference-manifest.js +1 -1
  82. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/[commentId]/route.js +1 -1
  83. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/[commentId]/route.js.nft.json +1 -1
  84. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/[commentId]/route_client-reference-manifest.js +1 -1
  85. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/route.js +1 -1
  86. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/route.js.nft.json +1 -1
  87. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/route_client-reference-manifest.js +1 -1
  88. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/costs/route.js +1 -1
  89. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/costs/route.js.nft.json +1 -1
  90. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/costs/route_client-reference-manifest.js +1 -1
  91. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route.js +1 -1
  92. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route.js.nft.json +1 -1
  93. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route_client-reference-manifest.js +1 -1
  94. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/events/route.js +1 -0
  95. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/events/route.js.nft.json +1 -0
  96. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/events/route_client-reference-manifest.js +1 -0
  97. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/history/route.js +1 -0
  98. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/history/route.js.nft.json +1 -0
  99. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/history/route_client-reference-manifest.js +1 -0
  100. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/metrics/route.js +1 -0
  101. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/metrics/route.js.nft.json +1 -0
  102. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/metrics/route_client-reference-manifest.js +1 -0
  103. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/pause/route.js +1 -0
  104. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/pause/route.js.nft.json +1 -0
  105. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/pause/route_client-reference-manifest.js +1 -0
  106. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/replan/route.js +1 -0
  107. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/replan/route.js.nft.json +1 -0
  108. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/replan/route_client-reference-manifest.js +1 -0
  109. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/restart/route.js +1 -0
  110. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/restart/route.js.nft.json +1 -0
  111. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/restart/route_client-reference-manifest.js +1 -0
  112. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/resume/route.js +1 -0
  113. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/resume/route.js.nft.json +1 -0
  114. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/resume/route_client-reference-manifest.js +1 -0
  115. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/rollback/route.js +1 -0
  116. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/rollback/route.js.nft.json +1 -0
  117. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/rollback/route_client-reference-manifest.js +1 -0
  118. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/route.js +1 -0
  119. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/route.js.nft.json +1 -0
  120. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/route_client-reference-manifest.js +1 -0
  121. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/start/route.js +1 -0
  122. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/start/route.js.nft.json +1 -0
  123. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/start/route_client-reference-manifest.js +1 -0
  124. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/stop/route.js +74 -0
  125. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/stop/route.js.nft.json +1 -0
  126. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/stop/route_client-reference-manifest.js +1 -0
  127. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/heartbeat/route.js.nft.json +1 -1
  128. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/heartbeat/route_client-reference-manifest.js +1 -1
  129. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/history/route.js +1 -1
  130. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/history/route.js.nft.json +1 -1
  131. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/history/route_client-reference-manifest.js +1 -1
  132. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/route.js +74 -1
  133. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/route.js.nft.json +1 -1
  134. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/route_client-reference-manifest.js +1 -1
  135. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route.js.nft.json +1 -1
  136. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route_client-reference-manifest.js +1 -1
  137. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/comments/route.js +1 -0
  138. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/comments/route.js.nft.json +1 -0
  139. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/comments/route_client-reference-manifest.js +1 -0
  140. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/complete/route.js +1 -0
  141. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/complete/route.js.nft.json +1 -0
  142. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/complete/route_client-reference-manifest.js +1 -0
  143. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/fail/route.js +1 -0
  144. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/fail/route.js.nft.json +1 -0
  145. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/fail/route_client-reference-manifest.js +1 -0
  146. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/resume/route.js +1 -0
  147. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/resume/route.js.nft.json +1 -0
  148. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/resume/route_client-reference-manifest.js +1 -0
  149. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/start/route.js +1 -0
  150. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/start/route.js.nft.json +1 -0
  151. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/start/route_client-reference-manifest.js +1 -0
  152. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/stop/route.js +1 -0
  153. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/stop/route.js.nft.json +1 -0
  154. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/stop/route_client-reference-manifest.js +1 -0
  155. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/verify/route.js +1 -0
  156. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/verify/route.js.nft.json +1 -0
  157. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/verify/route_client-reference-manifest.js +1 -0
  158. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/restart-stage/route.js +1 -1
  159. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/restart-stage/route.js.nft.json +1 -1
  160. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/restart-stage/route_client-reference-manifest.js +1 -1
  161. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/route.js +4 -4
  162. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -1
  163. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -1
  164. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/assign-orphans/route.js +1 -0
  165. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/assign-orphans/route.js.nft.json +1 -0
  166. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/assign-orphans/route_client-reference-manifest.js +1 -0
  167. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route.js +1 -1
  168. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route.js.nft.json +1 -1
  169. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -1
  170. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/stream/route.js.nft.json +1 -1
  171. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/stream/route_client-reference-manifest.js +1 -1
  172. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/user-settings/route.js +1 -1
  173. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/user-settings/route.js.nft.json +1 -1
  174. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/user-settings/route_client-reference-manifest.js +1 -1
  175. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/nodes/route.js +1 -1
  176. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/nodes/route.js.nft.json +1 -1
  177. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/nodes/route_client-reference-manifest.js +1 -1
  178. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/route.js +1 -1
  179. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/route.js.nft.json +1 -1
  180. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/route_client-reference-manifest.js +1 -1
  181. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/route.js +1 -1
  182. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/route.js.nft.json +1 -1
  183. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  184. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/callback/route.js.nft.json +1 -1
  185. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/callback/route_client-reference-manifest.js +1 -1
  186. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device/page.js +5 -5
  187. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device/page.js.nft.json +1 -1
  188. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device/page_client-reference-manifest.js +1 -1
  189. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device.html +1 -1
  190. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device.rsc +7 -6
  191. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page.js +5 -10
  192. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page.js.nft.json +1 -1
  193. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  194. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard.html +2 -2
  195. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard.rsc +8 -6
  196. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph/page.js +17 -0
  197. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph/page.js.nft.json +1 -0
  198. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph/page_client-reference-manifest.js +1 -0
  199. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.html +13 -0
  200. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.meta +7 -0
  201. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.rsc +23 -0
  202. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.html +2 -2
  203. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.rsc +6 -5
  204. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login/page.js +4 -4
  205. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login/page.js.nft.json +1 -1
  206. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login/page_client-reference-manifest.js +1 -1
  207. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login.html +2 -2
  208. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login.rsc +7 -6
  209. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/page.js +3 -3
  210. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/page.js.nft.json +1 -1
  211. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/page_client-reference-manifest.js +1 -1
  212. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/graph/[taskId]/page.js +2 -0
  213. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/graph/[taskId]/page.js.nft.json +1 -0
  214. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/graph/[taskId]/page_client-reference-manifest.js +1 -0
  215. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page.js +3 -3
  216. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  217. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  218. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/[taskId]/page.js +2 -0
  219. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/[taskId]/page.js.nft.json +1 -0
  220. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -0
  221. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page.js +2 -7
  222. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page.js.nft.json +1 -1
  223. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page_client-reference-manifest.js +1 -1
  224. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/workflow/page.js +2 -13
  225. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/workflow/page.js.nft.json +1 -1
  226. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/workflow/page_client-reference-manifest.js +1 -1
  227. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans/page.js +2 -0
  228. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans/page.js.nft.json +1 -0
  229. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans/page_client-reference-manifest.js +1 -0
  230. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.html +1 -0
  231. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.meta +7 -0
  232. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.rsc +24 -0
  233. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/page.js +3 -8
  234. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/page.js.nft.json +1 -1
  235. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  236. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.html +2 -2
  237. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.rsc +7 -6
  238. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings/page.js +2 -13
  239. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings/page.js.nft.json +1 -1
  240. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  241. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.html +2 -2
  242. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.rsc +7 -6
  243. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app-paths-manifest.json +43 -16
  244. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/1175.js +1 -0
  245. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/1891.js +1 -0
  246. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/{5611.js → 2341.js} +2 -2
  247. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/3009.js +9 -17
  248. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/359.js +91 -0
  249. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/4183.js +1 -0
  250. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/4483.js +145 -0
  251. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/4684.js +53 -0
  252. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/5047.js +1 -0
  253. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/5336.js +3 -0
  254. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/5873.js +1 -1
  255. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/5998.js +1 -0
  256. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/6317.js +3 -3
  257. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/7143.js +1 -1
  258. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/7552.js +74 -0
  259. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/7625.js +12 -0
  260. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/8100.js +17 -0
  261. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/8521.js +1 -1
  262. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/8879.js +11 -0
  263. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/9218.js +74 -0
  264. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/9764.js +37 -0
  265. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/9933.js +2 -0
  266. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/dynamic-css-manifest.js +1 -0
  267. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/functions-config-manifest.json +4 -2
  268. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/instrumentation.js +1 -1
  269. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/middleware-build-manifest.js +1 -1
  270. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/middleware-manifest.json +5 -5
  271. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/middleware.js +1 -1
  272. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/404.html +1 -1
  273. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/_app.js +1 -1
  274. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/_app.js.nft.json +1 -1
  275. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/_document.js +1 -1
  276. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/_document.js.nft.json +1 -1
  277. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/_error.js +3 -3
  278. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/_error.js.nft.json +1 -1
  279. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages-manifest.json +1 -1
  280. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.js +1 -1
  281. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.json +1 -1
  282. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/1560-c96304e8b5b09982.js +49 -0
  283. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/1a258343-bcfff2df53db439e.js +1 -0
  284. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/3634-903008664601478e.js +1 -0
  285. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/4380-34fd8d852553a877.js +1 -0
  286. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/5182-23ff4470a8cd697e.js +1 -0
  287. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/5962-e45590f9f1f0fb6a.js +1 -0
  288. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/6488-dc0cbab539e14b14.js +1 -0
  289. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/7329-81a6c7ab69ca4a52.js +1 -0
  290. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/9092-1eed225ca8c0f4b5.js +13 -0
  291. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/9337-41c7297232fc7095.js +1 -0
  292. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/968-bbc30100546b7647.js +1 -0
  293. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/9855-e3fbd51dd373e0c5.js +3 -0
  294. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/audit/route-4146f5e9f52467cf.js +1 -0
  295. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/[...nextauth]/route-4146f5e9f52467cf.js +1 -0
  296. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/daemon-secret/route-4146f5e9f52467cf.js +1 -0
  297. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/device/code/route-4146f5e9f52467cf.js +1 -0
  298. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/device/token/route-4146f5e9f52467cf.js +1 -0
  299. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/refresh/route-4146f5e9f52467cf.js +1 -0
  300. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/status/route-4146f5e9f52467cf.js +1 -0
  301. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/chat/history/route-4146f5e9f52467cf.js +1 -0
  302. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/chat/route-4146f5e9f52467cf.js +1 -0
  303. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/[id]/route-4146f5e9f52467cf.js +1 -0
  304. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/route-4146f5e9f52467cf.js +1 -0
  305. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/health/route-4146f5e9f52467cf.js +1 -0
  306. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/learnings/route-4146f5e9f52467cf.js +1 -0
  307. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/logs/stream/route-4146f5e9f52467cf.js +1 -0
  308. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/cancel/route-4146f5e9f52467cf.js +1 -0
  309. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/signal/route-4146f5e9f52467cf.js +1 -0
  310. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/start/route-4146f5e9f52467cf.js +1 -0
  311. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/status/route-4146f5e9f52467cf.js +1 -0
  312. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/[id]/migrate-v1/route-4146f5e9f52467cf.js +1 -0
  313. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/[id]/migrate-v2/route-4146f5e9f52467cf.js +1 -0
  314. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/[id]/route-4146f5e9f52467cf.js +1 -0
  315. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/route-4146f5e9f52467cf.js +1 -0
  316. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/providers/route-4146f5e9f52467cf.js +1 -0
  317. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/complete/route-4146f5e9f52467cf.js +1 -0
  318. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/route-4146f5e9f52467cf.js +1 -0
  319. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/stage-prompts/route-4146f5e9f52467cf.js +1 -0
  320. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/[commentId]/route-4146f5e9f52467cf.js +1 -0
  321. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/route-4146f5e9f52467cf.js +1 -0
  322. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/costs/route-4146f5e9f52467cf.js +1 -0
  323. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/dependencies/route-4146f5e9f52467cf.js +1 -0
  324. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/events/route-4146f5e9f52467cf.js +1 -0
  325. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/history/route-4146f5e9f52467cf.js +1 -0
  326. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/metrics/route-4146f5e9f52467cf.js +1 -0
  327. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/pause/route-4146f5e9f52467cf.js +1 -0
  328. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/replan/route-4146f5e9f52467cf.js +1 -0
  329. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/restart/route-4146f5e9f52467cf.js +1 -0
  330. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/resume/route-4146f5e9f52467cf.js +1 -0
  331. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/rollback/route-4146f5e9f52467cf.js +1 -0
  332. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/route-4146f5e9f52467cf.js +1 -0
  333. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/start/route-4146f5e9f52467cf.js +1 -0
  334. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/graph/stop/route-4146f5e9f52467cf.js +1 -0
  335. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/heartbeat/route-4146f5e9f52467cf.js +1 -0
  336. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/history/route-4146f5e9f52467cf.js +1 -0
  337. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/route-4146f5e9f52467cf.js +1 -0
  338. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/stream/route-4146f5e9f52467cf.js +1 -0
  339. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/nodes/[nodeId]/comments/route-4146f5e9f52467cf.js +1 -0
  340. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/nodes/[nodeId]/complete/route-4146f5e9f52467cf.js +1 -0
  341. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/nodes/[nodeId]/fail/route-4146f5e9f52467cf.js +1 -0
  342. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/nodes/[nodeId]/resume/route-4146f5e9f52467cf.js +1 -0
  343. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/nodes/[nodeId]/start/route-4146f5e9f52467cf.js +1 -0
  344. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/nodes/[nodeId]/stop/route-4146f5e9f52467cf.js +1 -0
  345. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/nodes/[nodeId]/verify/route-4146f5e9f52467cf.js +1 -0
  346. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/restart-stage/route-4146f5e9f52467cf.js +1 -0
  347. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/route-4146f5e9f52467cf.js +1 -0
  348. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/assign-orphans/route-4146f5e9f52467cf.js +1 -0
  349. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/route-4146f5e9f52467cf.js +1 -0
  350. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/stream/route-4146f5e9f52467cf.js +1 -0
  351. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/user-settings/route-4146f5e9f52467cf.js +1 -0
  352. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/nodes/route-4146f5e9f52467cf.js +1 -0
  353. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/route-4146f5e9f52467cf.js +1 -0
  354. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/route-4146f5e9f52467cf.js +1 -0
  355. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/callback/route-4146f5e9f52467cf.js +1 -0
  356. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/device/page-360e0d9743267f83.js +1 -0
  357. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/dashboard/page-9fc2f72aa263afbf.js +1 -0
  358. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/execution-graph/page-3d2f92c9f3a9c32b.js +1 -0
  359. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/layout-b1371d0718b61729.js +1 -0
  360. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/login/page-cc727e6121024adf.js +1 -0
  361. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/graph/[taskId]/page-35e701dd9d03607a.js +1 -0
  362. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/layout-3497c64539d1d0d6.js +1 -0
  363. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/page-7c440360390120d2.js +1 -0
  364. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/tasks/[taskId]/page-b5a1aca4ff048270.js +1 -0
  365. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/tasks/page-d324777fc0d2b28e.js +1 -0
  366. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/workflow/page-d944b3d435e6c096.js +1 -0
  367. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/orphans/page-f2d9a658ebd59e25.js +1 -0
  368. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/page-cfa09df7a60e3c9e.js +1 -0
  369. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/settings/page-5d8b5e8b4a41e553.js +1 -0
  370. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/ba12c10f-bf8f81460a1e4961.js +1 -0
  371. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/pages/_app-d4c3a651e078ce62.js +1 -0
  372. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/pages/_error-645f0cf542a3bcc5.js +1 -0
  373. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/{webpack-d282787ed3063711.js → webpack-ba6fd5b47c63daed.js} +1 -1
  374. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/css/599369d853c61df7.css +31 -0
  375. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/css/cecf148132e1eabb.css +1 -0
  376. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/css/fa5c997ce0e64112.css +1 -0
  377. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/ouqRjDQF23L-SLuiHJHB7/_buildManifest.js +1 -0
  378. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/api/context.js +81 -0
  379. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/api/diag.js +93 -0
  380. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/api/metrics.js +61 -0
  381. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/api/propagation.js +89 -0
  382. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/api/trace.js +79 -0
  383. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js +63 -0
  384. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js +55 -0
  385. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js +23 -0
  386. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/baggage/utils.js +51 -0
  387. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js +38 -0
  388. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/context/context.js +55 -0
  389. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/context-api.js +24 -0
  390. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js +59 -0
  391. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js +57 -0
  392. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js +45 -0
  393. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/diag/types.js +44 -0
  394. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/diag-api.js +29 -0
  395. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/index.js +81 -0
  396. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/internal/global-utils.js +64 -0
  397. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/internal/semver.js +122 -0
  398. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/metrics/Metric.js +25 -0
  399. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js +127 -0
  400. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js +31 -0
  401. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/metrics-api.js +24 -0
  402. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/platform/index.js +29 -0
  403. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js +22 -0
  404. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/platform/node/index.js +29 -0
  405. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js +34 -0
  406. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js +41 -0
  407. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/propagation-api.js +24 -0
  408. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js +69 -0
  409. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js +75 -0
  410. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js +32 -0
  411. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js +55 -0
  412. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js +54 -0
  413. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js +42 -0
  414. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/context-utils.js +82 -0
  415. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js +103 -0
  416. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js +46 -0
  417. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js +24 -0
  418. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js +27 -0
  419. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/span_kind.js +46 -0
  420. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js +49 -0
  421. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/status.js +23 -0
  422. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js +26 -0
  423. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/trace-api.js +24 -0
  424. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/build/src/version.js +21 -0
  425. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/@opentelemetry/api/package.json +113 -0
  426. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/package.json +17 -1
  427. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/pages/_app.tsx +5 -0
  428. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/pages/_document.tsx +13 -0
  429. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/scripts/migrate-v1-to-v2.ts +34 -0
  430. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/worker/index.js +104 -20
  431. package/lib/cli/chat/index.js +203 -0
  432. package/lib/cli/cloud/aggregate.js +4 -0
  433. package/lib/cli/cloud/command.js +3 -0
  434. package/lib/cli/cloud/executeGraphV2.js +1791 -0
  435. package/lib/cli/cloud/executeVerifySingle.js +5 -1
  436. package/lib/cli/cloud/executeVerifySwarm.js +5 -1
  437. package/lib/cli/cloud/index.js +6 -0
  438. package/lib/cli/cloud/iterations.js +56 -1
  439. package/lib/cli/cloud/persist.js +1 -2
  440. package/lib/cli/cloud/prompts.js +9 -3
  441. package/lib/cli/cloud/taskLogger.js +37 -28
  442. package/lib/cli/cloudArtifacts.js +29 -12
  443. package/lib/cli/configStore.js +15 -4
  444. package/lib/cli/daemon.js +98 -25
  445. package/lib/cli/interactiveMenu.js +8 -15
  446. package/lib/cli/runCli.js +732 -71
  447. package/lib/cli/v2TaskRouting.js +82 -0
  448. package/lib/cloud/status.js +12 -6
  449. package/lib/cloud-sync.js +267 -0
  450. package/lib/commands/chat.js +95 -0
  451. package/lib/commands/daemonBoard.js +132 -0
  452. package/lib/executor.js +334 -9
  453. package/lib/graph/constants.js +25 -0
  454. package/lib/graph/scheduler.js +137 -0
  455. package/lib/graph/types.js +24 -0
  456. package/lib/prompts/cloudTask.js +12 -6
  457. package/lib/prompts/resume.js +353 -0
  458. package/lib/prompts/templates.js +27 -11
  459. package/lib/stage-requirements.js +2 -2
  460. package/lib/storage/checkpoints.js +222 -0
  461. package/lib/storage/git.js +147 -0
  462. package/lib/storage/graph.js +80 -0
  463. package/lib/storage/index.js +12 -0
  464. package/lib/storage/paths.js +11 -0
  465. package/lib/storage/state.js +2 -0
  466. package/lib/verify-gate.js +301 -0
  467. package/package.json +16 -2
  468. package/templates/stack/postgres/init/001_agx_board_schema.sql +122 -2
  469. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/6158.js +0 -19
  470. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/8666.js +0 -23
  471. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/9159.js +0 -93
  472. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/500.html +0 -1
  473. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/FYPvFkL9PvoVJhHnr9Upx/_buildManifest.js +0 -1
  474. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/5608-674cd57e975c9b36.js +0 -1
  475. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/650-38439e55899ae2bf.js +0 -15
  476. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/8960-720130c8c9bf5b1c.js +0 -1
  477. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/9337-f4cb4820efca03a1.js +0 -1
  478. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/audit/route-bee7977512f30f17.js +0 -1
  479. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/[...nextauth]/route-bee7977512f30f17.js +0 -1
  480. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/daemon-secret/route-bee7977512f30f17.js +0 -1
  481. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/device/code/route-bee7977512f30f17.js +0 -1
  482. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/device/token/route-bee7977512f30f17.js +0 -1
  483. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/refresh/route-bee7977512f30f17.js +0 -1
  484. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/status/route-bee7977512f30f17.js +0 -1
  485. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/[id]/route-bee7977512f30f17.js +0 -1
  486. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/route-bee7977512f30f17.js +0 -1
  487. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/health/route-bee7977512f30f17.js +0 -1
  488. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/learnings/route-bee7977512f30f17.js +0 -1
  489. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/logs/stream/route-bee7977512f30f17.js +0 -1
  490. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/cancel/route-bee7977512f30f17.js +0 -1
  491. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/signal/route-bee7977512f30f17.js +0 -1
  492. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/start/route-bee7977512f30f17.js +0 -1
  493. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/status/route-bee7977512f30f17.js +0 -1
  494. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/[id]/route-bee7977512f30f17.js +0 -1
  495. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/route-bee7977512f30f17.js +0 -1
  496. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/providers/route-bee7977512f30f17.js +0 -1
  497. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/complete/route-bee7977512f30f17.js +0 -1
  498. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/route-bee7977512f30f17.js +0 -1
  499. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/stage-prompts/route-bee7977512f30f17.js +0 -1
  500. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/[commentId]/route-bee7977512f30f17.js +0 -1
  501. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/route-bee7977512f30f17.js +0 -1
  502. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/costs/route-bee7977512f30f17.js +0 -1
  503. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/dependencies/route-bee7977512f30f17.js +0 -1
  504. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/heartbeat/route-bee7977512f30f17.js +0 -1
  505. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/history/route-bee7977512f30f17.js +0 -1
  506. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/route-bee7977512f30f17.js +0 -1
  507. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/stream/route-bee7977512f30f17.js +0 -1
  508. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/restart-stage/route-bee7977512f30f17.js +0 -1
  509. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/route-bee7977512f30f17.js +0 -1
  510. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/route-bee7977512f30f17.js +0 -1
  511. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/stream/route-bee7977512f30f17.js +0 -1
  512. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/user-settings/route-bee7977512f30f17.js +0 -1
  513. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/nodes/route-bee7977512f30f17.js +0 -1
  514. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/route-bee7977512f30f17.js +0 -1
  515. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/route-bee7977512f30f17.js +0 -1
  516. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/callback/route-bee7977512f30f17.js +0 -1
  517. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/device/page-bd5f443ef9da0c0a.js +0 -1
  518. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/dashboard/page-6140206ded1cc4ae.js +0 -1
  519. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/layout-6b46da9e6091abb3.js +0 -1
  520. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/login/page-8172fa023b259e7e.js +0 -1
  521. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/layout-11d4290500b37271.js +0 -1
  522. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/page-d097a2c0e0fc17cf.js +0 -1
  523. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/tasks/page-444e63f0464b1d40.js +0 -1
  524. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/workflow/page-9ccbd3d9db1bcef8.js +0 -1
  525. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/page-6c545e9e5f5f66bc.js +0 -1
  526. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/settings/page-749ebaf650848f08.js +0 -1
  527. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/pages/_app-6c8c2371b16a04b8.js +0 -1
  528. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/pages/_error-94812ad32cad7365.js +0 -1
  529. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/css/ea93fda1b0bdd3b9.css +0 -1
  530. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/next/dist/pages/_app.js +0 -42
  531. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/node_modules/next/dist/pages/_document.js +0 -834
  532. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{FYPvFkL9PvoVJhHnr9Upx → ouqRjDQF23L-SLuiHJHB7}/_ssgManifest.js +0 -0
@@ -0,0 +1,1791 @@
1
+ /* eslint-disable no-console */
2
+ 'use strict';
3
+
4
+ const os = require('os');
5
+ const { tick: schedulerTick } = require('../../graph/scheduler');
6
+ const { DEFAULT_EXECUTION_POLICY, INCOMPLETE_FOR_DONE_STATUSES } = require('../../graph/types');
7
+ const { runVerifyGate } = require('../../verify-gate');
8
+
9
+ function deepClone(value) {
10
+ return JSON.parse(JSON.stringify(value));
11
+ }
12
+
13
+ function nowIso() {
14
+ return new Date().toISOString();
15
+ }
16
+
17
+ function sleep(ms) {
18
+ return new Promise((resolve) => setTimeout(resolve, ms));
19
+ }
20
+
21
+ function asObject(value) {
22
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : null;
23
+ }
24
+
25
+ const VALID_NODE_STATUSES = new Set([
26
+ 'pending',
27
+ 'running',
28
+ 'awaiting_human',
29
+ 'done',
30
+ 'passed',
31
+ 'failed',
32
+ 'blocked',
33
+ 'skipped',
34
+ ]);
35
+
36
+ const VALID_EDGE_CONDITIONS = new Set(['on_success', 'on_failure', 'always']);
37
+
38
+ function normalizeNodeStatus(status) {
39
+ const normalized = String(status || '').trim().toLowerCase();
40
+ if (!normalized) return 'pending';
41
+ if (VALID_NODE_STATUSES.has(normalized)) return normalized;
42
+ return normalized;
43
+ }
44
+
45
+ function normalizeNodeType(type) {
46
+ const normalized = String(type || '').trim().toLowerCase();
47
+ if (!normalized) return 'work';
48
+ if (normalized === 'spike') return 'work';
49
+ if (normalized === 'work' || normalized === 'gate' || normalized === 'root' || normalized === 'fork' || normalized === 'join' || normalized === 'conditional') {
50
+ return normalized;
51
+ }
52
+ return normalized;
53
+ }
54
+
55
+ function normalizeEdgeType(type) {
56
+ const normalized = String(type || '').trim().toLowerCase();
57
+ return normalized === 'soft' ? 'soft' : 'hard';
58
+ }
59
+
60
+ function normalizeEdgeCondition(condition) {
61
+ const normalized = String(condition || '').trim().toLowerCase();
62
+ if (!normalized) return 'on_success';
63
+ return VALID_EDGE_CONDITIONS.has(normalized) ? normalized : 'on_success';
64
+ }
65
+
66
+ function normalizeGraphExecutionFields(graph) {
67
+ if (!asObject(graph?.nodes)) graph.nodes = {};
68
+ if (!Array.isArray(graph?.edges)) graph.edges = [];
69
+
70
+ for (const [nodeId, rawNode] of Object.entries(graph.nodes)) {
71
+ const node = asObject(rawNode);
72
+ if (!node) continue;
73
+ node.type = normalizeNodeType(node.type);
74
+ node.status = normalizeNodeStatus(node.status);
75
+ if (typeof node.gateType === 'string') {
76
+ node.gateType = node.gateType.trim().toLowerCase();
77
+ }
78
+ if (asObject(node.verificationStrategy) && typeof node.verificationStrategy.type === 'string') {
79
+ node.verificationStrategy.type = node.verificationStrategy.type.trim().toLowerCase();
80
+ }
81
+ if (Array.isArray(node.deps)) {
82
+ node.deps = Array.from(new Set(
83
+ node.deps.map((dep) => String(dep || '').trim()).filter((dep) => dep && dep !== nodeId)
84
+ ));
85
+ } else {
86
+ node.deps = [];
87
+ }
88
+ }
89
+
90
+ graph.edges = graph.edges
91
+ .filter((edge) => asObject(edge))
92
+ .map((edge) => ({
93
+ ...edge,
94
+ from: String(edge.from || '').trim(),
95
+ to: String(edge.to || '').trim(),
96
+ type: normalizeEdgeType(edge.type),
97
+ condition: normalizeEdgeCondition(edge.condition),
98
+ }))
99
+ .filter((edge) => edge.from && edge.to && graph.nodes[edge.from] && graph.nodes[edge.to]);
100
+
101
+ if (asObject(graph.doneCriteria) && Array.isArray(graph.doneCriteria.completionSinkNodeIds)) {
102
+ graph.doneCriteria.completionSinkNodeIds = Array.from(new Set(
103
+ graph.doneCriteria.completionSinkNodeIds
104
+ .map((id) => String(id || '').trim())
105
+ .filter((id) => id && graph.nodes[id])
106
+ ));
107
+ }
108
+ }
109
+
110
+ function parseFrontmatterFromContent(content) {
111
+ if (!content) return {};
112
+ const text = String(content);
113
+ const match = text.match(/^---\n([\s\S]*?)\n---\n/);
114
+ if (!match) return {};
115
+ const frontmatter = {};
116
+ for (const line of match[1].split('\n')) {
117
+ const idx = line.indexOf(':');
118
+ if (idx <= 0) continue;
119
+ const key = line.slice(0, idx).trim();
120
+ const value = line.slice(idx + 1).trim();
121
+ if (key) frontmatter[key] = value;
122
+ }
123
+ return frontmatter;
124
+ }
125
+
126
+ function normalizeApprovalMode(value) {
127
+ const normalized = String(value || '').trim().toLowerCase();
128
+ if (!normalized) return null;
129
+ if (
130
+ normalized === 'auto'
131
+ || normalized === 'auto_approve'
132
+ || normalized === 'auto-approve'
133
+ || normalized === 'automatic'
134
+ ) {
135
+ return 'auto';
136
+ }
137
+ if (
138
+ normalized === 'manual'
139
+ || normalized === 'human'
140
+ || normalized === 'require_approval'
141
+ || normalized === 'require-approval'
142
+ ) {
143
+ return 'manual';
144
+ }
145
+ return null;
146
+ }
147
+
148
+ function resolveTaskApprovalMode(task) {
149
+ const frontmatter = parseFrontmatterFromContent(task?.content || '');
150
+ const candidates = [
151
+ task?.approval_mode,
152
+ task?.approvalMode,
153
+ task?.approval,
154
+ frontmatter.approval_mode,
155
+ frontmatter.approval,
156
+ ];
157
+ for (const candidate of candidates) {
158
+ const mode = normalizeApprovalMode(candidate);
159
+ if (mode) return mode;
160
+ }
161
+
162
+ if (task?.auto_approve === true || task?.autoApprove === true) {
163
+ return 'auto';
164
+ }
165
+ if (task?.auto_approve === false || task?.autoApprove === false) {
166
+ return 'manual';
167
+ }
168
+ return 'manual';
169
+ }
170
+
171
+ function readEmbeddedGraph(task) {
172
+ const candidates = [
173
+ task?.execution_graph,
174
+ task?.executionGraph,
175
+ task?.graph,
176
+ ];
177
+ for (const candidate of candidates) {
178
+ const obj = asObject(candidate);
179
+ if (obj) return deepClone(obj);
180
+ }
181
+ return null;
182
+ }
183
+
184
+ function readGraphFromResponse(response) {
185
+ if (!response) return null;
186
+ if (asObject(response?.graph)) return deepClone(response.graph);
187
+ if (asObject(response?.execution_graph)) return deepClone(response.execution_graph);
188
+ if (asObject(response?.executionGraph)) return deepClone(response.executionGraph);
189
+ if (asObject(response)) return deepClone(response);
190
+ return null;
191
+ }
192
+
193
+ function normalizeGraph(graph, taskId) {
194
+ const normalized = asObject(graph);
195
+ if (!normalized) return null;
196
+
197
+ if (!normalized.id && typeof normalized.graph_id === 'string' && normalized.graph_id.trim()) {
198
+ normalized.id = normalized.graph_id.trim();
199
+ }
200
+ if (!normalized.taskId) normalized.taskId = taskId;
201
+ if (!normalized.mode) normalized.mode = 'PROJECT';
202
+ if (!Number.isInteger(normalized.graphVersion) || normalized.graphVersion < 1) {
203
+ normalized.graphVersion = 1;
204
+ }
205
+ if (!asObject(normalized.policy)) normalized.policy = {};
206
+ normalized.policy = { ...DEFAULT_EXECUTION_POLICY, ...normalized.policy };
207
+ if (!asObject(normalized.doneCriteria)) {
208
+ normalized.doneCriteria = {
209
+ allRequiredGatesPassed: true,
210
+ noRunnableOrPendingWork: true,
211
+ completionSinkNodeIds: [],
212
+ customCriteria: [],
213
+ };
214
+ }
215
+ if (!asObject(normalized.nodes)) normalized.nodes = {};
216
+ if (!Array.isArray(normalized.edges)) normalized.edges = [];
217
+ if (!Array.isArray(normalized.runtimeEvents)) normalized.runtimeEvents = [];
218
+ normalizeGraphExecutionFields(normalized);
219
+
220
+ return normalized;
221
+ }
222
+
223
+ function assertGraphShape(graph, taskId) {
224
+ if (!graph) throw new Error(`[v2-required] Task ${taskId} has no execution graph payload.`);
225
+ if (typeof graph.id !== 'string' || !graph.id.trim()) {
226
+ throw new Error(`[v2-required] Task ${taskId} graph is missing id.`);
227
+ }
228
+ if (!asObject(graph.nodes)) {
229
+ throw new Error(`[v2-required] Task ${taskId} graph.nodes must be an object.`);
230
+ }
231
+ if (!Array.isArray(graph.edges)) {
232
+ throw new Error(`[v2-required] Task ${taskId} graph.edges must be an array.`);
233
+ }
234
+ }
235
+
236
+ function nodeStatusFingerprint(graph) {
237
+ return Object.keys(graph.nodes || {})
238
+ .sort()
239
+ .map((nodeId) => `${nodeId}:${graph.nodes[nodeId]?.status || 'unknown'}`)
240
+ .join('|');
241
+ }
242
+
243
+ function isNodeIncomplete(status) {
244
+ return INCOMPLETE_FOR_DONE_STATUSES.includes(status);
245
+ }
246
+
247
+ function collectNodeIdsByStatus(graph, statuses) {
248
+ const allowed = new Set(statuses);
249
+ return Object.keys(graph.nodes || {}).filter((nodeId) => allowed.has(graph.nodes[nodeId]?.status));
250
+ }
251
+
252
+ function unresolvedPendingNodes(graph) {
253
+ return collectNodeIdsByStatus(graph, ['pending', 'blocked', 'awaiting_human']);
254
+ }
255
+
256
+ function hasIncompleteNodes(graph) {
257
+ return Object.values(graph.nodes || {}).some((node) => node && isNodeIncomplete(node.status));
258
+ }
259
+
260
+ function hasFailedNodes(graph) {
261
+ return Object.values(graph.nodes || {}).some((node) => node && node.status === 'failed');
262
+ }
263
+
264
+ function allCompletionSinksPassed(graph) {
265
+ const sinkIds = Array.isArray(graph?.doneCriteria?.completionSinkNodeIds)
266
+ ? graph.doneCriteria.completionSinkNodeIds
267
+ : [];
268
+ if (sinkIds.length === 0) return !hasFailedNodes(graph);
269
+ return sinkIds.every((nodeId) => {
270
+ const status = graph.nodes?.[nodeId]?.status;
271
+ return status === 'done' || status === 'passed';
272
+ });
273
+ }
274
+
275
+ function isPlanNode(nodeId, node) {
276
+ return nodeId === 'plan' || /generate.*execution.*plan/i.test(node?.title || '');
277
+ }
278
+
279
+ const LOCKED_PAST_PLAN_STATUSES = new Set(['done', 'passed', 'skipped']);
280
+ const TERMINAL_NODE_STATUSES = new Set(['done', 'passed', 'failed', 'skipped']);
281
+
282
+ function isTerminalStatus(status) {
283
+ return TERMINAL_NODE_STATUSES.has(normalizeNodeStatus(status));
284
+ }
285
+
286
+ function collectPlanNodeIds(graph, planNodeId, previousDraftNodeIds = []) {
287
+ const ids = new Set();
288
+ for (const [nodeId, node] of Object.entries(graph?.nodes || {})) {
289
+ if (node?.generatedByPlanNodeId === planNodeId) ids.add(nodeId);
290
+ }
291
+ for (const id of (Array.isArray(previousDraftNodeIds) ? previousDraftNodeIds : [])) {
292
+ const normalized = String(id || '').trim();
293
+ if (normalized && graph?.nodes?.[normalized]) ids.add(normalized);
294
+ }
295
+ return Array.from(ids);
296
+ }
297
+
298
+ function collectDescendantNodeIds(graph, startNodeId) {
299
+ const start = String(startNodeId || '').trim();
300
+ if (!start || !graph?.nodes?.[start]) return [];
301
+ const adjacency = new Map();
302
+ for (const edge of (Array.isArray(graph?.edges) ? graph.edges : [])) {
303
+ const from = String(edge?.from || '').trim();
304
+ const to = String(edge?.to || '').trim();
305
+ if (!from || !to || !graph?.nodes?.[from] || !graph?.nodes?.[to]) continue;
306
+ if (!adjacency.has(from)) adjacency.set(from, new Set());
307
+ adjacency.get(from).add(to);
308
+ }
309
+
310
+ const visited = new Set();
311
+ const queue = [...(adjacency.get(start) || [])];
312
+ while (queue.length > 0) {
313
+ const nodeId = queue.shift();
314
+ if (!nodeId || visited.has(nodeId)) continue;
315
+ visited.add(nodeId);
316
+ const next = adjacency.get(nodeId);
317
+ if (next) {
318
+ for (const target of next) {
319
+ if (!visited.has(target)) queue.push(target);
320
+ }
321
+ }
322
+ }
323
+ return Array.from(visited);
324
+ }
325
+
326
+ function resolveStartNodeId(task, graph) {
327
+ const candidates = [
328
+ task?.start_node_id,
329
+ task?.startNodeId,
330
+ task?.start_node,
331
+ task?.startNode,
332
+ task?.execution?.start_node_id,
333
+ task?.execution?.startNodeId,
334
+ task?.run_options?.start_node_id,
335
+ task?.runOptions?.startNodeId,
336
+ graph?.start_node_id,
337
+ graph?.startNodeId,
338
+ graph?.startNode,
339
+ ];
340
+
341
+ for (const candidate of candidates) {
342
+ const nodeId = String(candidate || '').trim();
343
+ if (nodeId && graph?.nodes?.[nodeId]) {
344
+ return nodeId;
345
+ }
346
+ }
347
+
348
+ return null;
349
+ }
350
+
351
+ function resetNodeForRerun(node) {
352
+ if (!node || typeof node !== 'object') return;
353
+ node.status = 'pending';
354
+ node.startedAt = undefined;
355
+ node.completedAt = undefined;
356
+ node.error = undefined;
357
+ if (node.type === 'work') {
358
+ node.output = undefined;
359
+ node.attempts = 0;
360
+ }
361
+ if (node.type === 'gate') {
362
+ node.verificationResult = undefined;
363
+ node.verifyFailures = undefined;
364
+ }
365
+ }
366
+
367
+ function resetDownstreamApprovalGates(graph, startNodeId) {
368
+ const resetGateIds = [];
369
+ for (const nodeId of collectDescendantNodeIds(graph, startNodeId)) {
370
+ const node = graph?.nodes?.[nodeId];
371
+ if (!node || node.type !== 'gate') continue;
372
+ const gateType = String(node.gateType || '').trim().toLowerCase();
373
+ if (gateType !== 'approval_gate') continue;
374
+ resetNodeForRerun(node);
375
+ resetGateIds.push(nodeId);
376
+ }
377
+ return resetGateIds;
378
+ }
379
+
380
+ function applyStartNodeSelection(graph, task) {
381
+ const startNodeId = resolveStartNodeId(task, graph);
382
+ if (!startNodeId) {
383
+ return { activeStartNodeId: null, wasWorkNodeRerun: false, resetApprovalGateIds: [] };
384
+ }
385
+
386
+ const node = graph?.nodes?.[startNodeId];
387
+ if (!node) {
388
+ return { activeStartNodeId: null, wasWorkNodeRerun: false, resetApprovalGateIds: [] };
389
+ }
390
+
391
+ const previousStatus = normalizeNodeStatus(node.status);
392
+ const wasWorkNodeRerun = node.type === 'work' && (
393
+ isTerminalStatus(previousStatus) || previousStatus === 'awaiting_human' || previousStatus === 'blocked'
394
+ );
395
+
396
+ if (wasWorkNodeRerun || previousStatus === 'failed') {
397
+ resetNodeForRerun(node);
398
+ }
399
+
400
+ const resetApprovalGateIds = wasWorkNodeRerun
401
+ ? resetDownstreamApprovalGates(graph, startNodeId)
402
+ : [];
403
+
404
+ return {
405
+ activeStartNodeId: startNodeId,
406
+ wasWorkNodeRerun,
407
+ resetApprovalGateIds,
408
+ };
409
+ }
410
+
411
+ function summarizePlanNodesForPrompt(graph, nodeIds) {
412
+ const summaries = [];
413
+ for (const nodeId of nodeIds) {
414
+ const node = graph?.nodes?.[nodeId];
415
+ if (!node) continue;
416
+ summaries.push({
417
+ id: nodeId,
418
+ type: node.type,
419
+ status: node.status,
420
+ title: node.title || nodeId,
421
+ deps: Array.isArray(node.deps) ? node.deps : [],
422
+ workType: node.type === 'work' ? (node.workType || 'implementation') : undefined,
423
+ });
424
+ }
425
+ return summaries;
426
+ }
427
+
428
+ function buildPlanReplanContext({
429
+ graph,
430
+ planNodeId,
431
+ previousDraftNodeIds = [],
432
+ anchorNodeId = 'plan-approval',
433
+ preserveLockedPastNodes = true,
434
+ }) {
435
+ const explicitPlanNodeIds = collectPlanNodeIds(graph, planNodeId, previousDraftNodeIds);
436
+ const topoPlanNodeIds = collectDescendantNodeIds(graph, anchorNodeId)
437
+ .filter((nodeId) => nodeId !== planNodeId && nodeId !== anchorNodeId);
438
+ const planNodeIds = Array.from(new Set([...explicitPlanNodeIds, ...topoPlanNodeIds]));
439
+ const lockedNodeIds = preserveLockedPastNodes
440
+ ? planNodeIds.filter((nodeId) => LOCKED_PAST_PLAN_STATUSES.has(graph?.nodes?.[nodeId]?.status))
441
+ : [];
442
+ const lockedNodesById = {};
443
+ for (const nodeId of lockedNodeIds) {
444
+ lockedNodesById[nodeId] = deepClone(graph.nodes[nodeId]);
445
+ }
446
+ return {
447
+ planNodeIds,
448
+ lockedNodeIds,
449
+ lockedNodesById,
450
+ planNodeSummaries: summarizePlanNodesForPrompt(graph, planNodeIds),
451
+ };
452
+ }
453
+
454
+ function normalizeWorkType(rawType, rawWorkType) {
455
+ const type = String(rawType || '').trim().toLowerCase();
456
+ const workType = String(rawWorkType || '').trim().toLowerCase();
457
+ if (type === 'spike' || workType === 'spike') return 'spike';
458
+ return 'implementation';
459
+ }
460
+
461
+ function normalizeStringList(values) {
462
+ if (!Array.isArray(values)) return [];
463
+ return Array.from(new Set(
464
+ values
465
+ .map((item) => String(item || '').trim())
466
+ .filter(Boolean)
467
+ ));
468
+ }
469
+
470
+ function resolveTaskPromptBody(task) {
471
+ const description = String(task?.description || '').trim();
472
+ if (description) return description;
473
+ return String(task?.content || '').trim();
474
+ }
475
+
476
+ function isUiUxTask(task) {
477
+ const title = String(task?.title || task?.goal || task?.user_request || '').toLowerCase();
478
+ const body = resolveTaskPromptBody(task).toLowerCase();
479
+ const text = `${title}\n${body}`;
480
+ return /(ui|ux|frontend|front-end|interface|chat|component|design|accessibility|responsive)/.test(text);
481
+ }
482
+
483
+ function isArchitectureHeavyTask(task) {
484
+ const title = String(task?.title || task?.goal || task?.user_request || '').toLowerCase();
485
+ const body = resolveTaskPromptBody(task).toLowerCase();
486
+ const text = `${title}\n${body}`;
487
+ return /(architecture|system|backend|frontend|api|route|database|schema|table|repository|service layer|data flow|lifecycle|worker|celery|integration)/.test(text);
488
+ }
489
+
490
+ function buildPlanNodePrompt({ task, replanContext = null }) {
491
+ const taskTitle = String(task?.title || task?.goal || task?.user_request || '').trim() || 'Untitled task';
492
+ const taskContent = resolveTaskPromptBody(task);
493
+ const uiUxRequired = isUiUxTask(task);
494
+ const architectureRequired = isArchitectureHeavyTask(task);
495
+ const hasExistingPlan = Array.isArray(replanContext?.planNodeIds) && replanContext.planNodeIds.length > 0;
496
+ const lockedIds = Array.isArray(replanContext?.lockedNodeIds) ? replanContext.lockedNodeIds : [];
497
+ const planSummaries = Array.isArray(replanContext?.planNodeSummaries) ? replanContext.planNodeSummaries : [];
498
+ const planSnapshot = planSummaries.length > 0 ? JSON.stringify(planSummaries, null, 2) : '[]';
499
+
500
+ return [
501
+ 'GENERATE WORK GRAPH',
502
+ '',
503
+ `Task: ${taskTitle}`,
504
+ taskContent ? `Description: ${taskContent}` : null,
505
+ uiUxRequired ? 'This task is UI/UX-facing: include explicit UI and UX work breakdown.' : null,
506
+ architectureRequired ? 'This task is architecture-heavy: include backend, frontend, and data-layer change coverage.' : null,
507
+ hasExistingPlan ? 'You are RE-SCOPING an existing graph. Update the graph from the current state; do not duplicate branches.' : null,
508
+ hasExistingPlan ? `Locked past nodes (MUST stay unchanged): ${lockedIds.length ? lockedIds.join(', ') : '(none)'}` : null,
509
+ hasExistingPlan ? 'Current plan snapshot (node id, type, status, deps, title):' : null,
510
+ hasExistingPlan ? planSnapshot : null,
511
+ '',
512
+ 'Analyze this task and create a detailed work graph as a JSON graph.',
513
+ 'The graph should break down the work into concrete steps.',
514
+ 'Scoping only: do not implement, do not run tools, do not describe file edits.',
515
+ '',
516
+ 'Output ONLY a JSON object with this exact structure (no markdown, no explanation):',
517
+ '{',
518
+ ' "nodes": {',
519
+ ' "<node-id>": {',
520
+ ' "type": "work|spike|gate",',
521
+ ' "title": "<short title>",',
522
+ ' "description": "<what to do>",',
523
+ ' "where": ["<specific subsystem/file/table/API route touched>"],',
524
+ ' "whatChanges": ["<specific change to make in each touched area>"],',
525
+ ' "acceptanceCriteria": ["<verifiable outcome>"],',
526
+ ' "todos": ["<concrete implementation task>"],',
527
+ ' "checks": ["<test/check command or assertion>"],',
528
+ ' "estimateMinutes": <number>,',
529
+ ' "deps": ["<dependency-node-id>"]',
530
+ ' }',
531
+ ' },',
532
+ ' "edges": [',
533
+ ' { "from": "<source-node-id>", "to": "<target-node-id>", "type": "hard" }',
534
+ ' ]',
535
+ '}',
536
+ '',
537
+ 'Rules:',
538
+ '- Node IDs should be descriptive kebab-case (e.g. "implement-auth", "add-tests")',
539
+ '- First node(s) should have empty deps: []',
540
+ '- Include a final "quality-gate" node with type "gate" and gateType "quality_gate"',
541
+ '- Include a final "handoff-gate" node with type "gate" and gateType "handoff_gate" (deps on quality-gate)',
542
+ '- Keep it practical: 3-8 work nodes for most tasks',
543
+ '- You may use "type": "spike" for discovery/research nodes; these are treated as work nodes with workType "spike"',
544
+ '- Each edge must match a dep relationship',
545
+ '- Every work node MUST include non-empty where and whatChanges arrays',
546
+ '- Every work node MUST include non-empty acceptanceCriteria, todos, and checks arrays',
547
+ uiUxRequired
548
+ ? '- Include dedicated UI/UX work: UI structure/components, UX states/flows, and accessibility/responsive behavior'
549
+ : null,
550
+ architectureRequired
551
+ ? '- Decompose by layers/domains. Plan must identify concrete backend/API, frontend/UI, and database/schema touchpoints'
552
+ : null,
553
+ hasExistingPlan
554
+ ? '- Keep locked past nodes unchanged. You may omit them from output, but if included they must be identical'
555
+ : null,
556
+ hasExistingPlan
557
+ ? '- Only re-plan remaining/future work from current graph state. Avoid creating parallel duplicate tails/heads'
558
+ : null,
559
+ '- Do not include prose before or after the JSON object',
560
+ ].filter(Boolean).join('\n');
561
+ }
562
+
563
+ function parsePlanOutput(rawOutput) {
564
+ const text = String(rawOutput || '').trim();
565
+ // Extract JSON from the output (handle markdown code blocks)
566
+ const jsonMatch = text.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/) || [null, text];
567
+ const jsonStr = (jsonMatch[1] || text).trim();
568
+
569
+ try {
570
+ const parsed = JSON.parse(jsonStr);
571
+ const nodes = parsed.nodes || {};
572
+ const edges = parsed.edges || [];
573
+
574
+ // Validate basic structure
575
+ if (!asObject(nodes) || Object.keys(nodes).length === 0) {
576
+ return null;
577
+ }
578
+
579
+ // Normalize nodes — ensure required fields
580
+ const normalizedNodes = {};
581
+ for (const [id, node] of Object.entries(nodes)) {
582
+ const n = node || {};
583
+ const rawType = String(n.type || 'work').trim().toLowerCase();
584
+ const isGate = rawType === 'gate';
585
+ const normalizedType = isGate ? 'gate' : 'work';
586
+ const workType = normalizeWorkType(rawType, n.workType);
587
+ normalizedNodes[id] = {
588
+ type: normalizedType,
589
+ status: 'pending',
590
+ title: n.title || id,
591
+ description: n.description || '',
592
+ deps: Array.isArray(n.deps) ? n.deps : [],
593
+ ...(normalizedType === 'work' ? {
594
+ workType,
595
+ attempts: 0,
596
+ maxAttempts: n.maxAttempts || 2,
597
+ retryPolicy: n.retryPolicy || { backoffMs: 5000, onExhaust: 'escalate' },
598
+ estimateMinutes: n.estimateMinutes || 15,
599
+ where: normalizeStringList(n.where),
600
+ whatChanges: normalizeStringList(n.whatChanges),
601
+ acceptanceCriteria: normalizeStringList(n.acceptanceCriteria),
602
+ todos: normalizeStringList(n.todos),
603
+ verification: normalizeStringList(Array.isArray(n.checks) ? n.checks : n.verification),
604
+ } : {}),
605
+ ...(normalizedType === 'gate' ? {
606
+ gateType: n.gateType || 'progress',
607
+ required: n.required !== false,
608
+ verificationStrategy: n.verificationStrategy || {
609
+ type: n.gateType === 'handoff_gate' ? 'human' : 'auto',
610
+ },
611
+ } : {}),
612
+ };
613
+ }
614
+
615
+ // Normalize edges
616
+ const normalizedEdges = edges
617
+ .filter((e) => e && e.from && e.to)
618
+ .map((e) => ({
619
+ from: e.from,
620
+ to: e.to,
621
+ type: e.type || 'hard',
622
+ condition: e.condition || 'on_success',
623
+ }));
624
+
625
+ return { nodes: normalizedNodes, edges: normalizedEdges };
626
+ } catch {
627
+ return null;
628
+ }
629
+ }
630
+
631
+ function validateProposedPlan(proposedGraph, task, options = {}) {
632
+ const reasons = [];
633
+ const nodes = asObject(proposedGraph?.nodes) || {};
634
+ const nodeEntries = Object.entries(nodes);
635
+ const workNodes = nodeEntries.filter(([, node]) => node?.type === 'work');
636
+ const gateNodes = nodeEntries.filter(([, node]) => node?.type === 'gate');
637
+ const lockedNodesById = asObject(options?.lockedNodesById) || {};
638
+ const anchorNodeId = String(options?.anchorNodeId || 'plan-approval');
639
+
640
+ if (workNodes.length === 0) {
641
+ reasons.push('Work graph must include at least one work node.');
642
+ }
643
+
644
+ for (const [nodeId, node] of workNodes) {
645
+ const where = normalizeStringList(node?.where);
646
+ const whatChanges = normalizeStringList(node?.whatChanges);
647
+ const acceptanceCriteria = normalizeStringList(node?.acceptanceCriteria);
648
+ const todos = normalizeStringList(node?.todos);
649
+ const checks = normalizeStringList(node?.verification);
650
+ if (where.length === 0) {
651
+ reasons.push(`Work node "${nodeId}" is missing where (target touchpoints).`);
652
+ }
653
+ if (whatChanges.length === 0) {
654
+ reasons.push(`Work node "${nodeId}" is missing whatChanges.`);
655
+ }
656
+ if (acceptanceCriteria.length === 0) {
657
+ reasons.push(`Work node "${nodeId}" is missing acceptanceCriteria.`);
658
+ }
659
+ if (todos.length === 0) {
660
+ reasons.push(`Work node "${nodeId}" is missing todos.`);
661
+ }
662
+ if (checks.length === 0) {
663
+ reasons.push(`Work node "${nodeId}" is missing checks.`);
664
+ }
665
+ }
666
+
667
+ const hasQualityGate = gateNodes.some(([, node]) => String(node?.gateType || '').toLowerCase() === 'quality_gate');
668
+ const hasHandoffGate = gateNodes.some(([, node]) => String(node?.gateType || '').toLowerCase() === 'handoff_gate');
669
+ if (!hasQualityGate) reasons.push('Work graph must include a quality-gate node with gateType "quality_gate".');
670
+ if (!hasHandoffGate) reasons.push('Work graph must include a handoff-gate node with gateType "handoff_gate".');
671
+
672
+ for (const [lockedId, lockedNode] of Object.entries(lockedNodesById)) {
673
+ const proposedNode = nodes[lockedId];
674
+ if (!proposedNode) continue;
675
+ const lockedSpec = canonicalNodeSpecForCompare(lockedNode, anchorNodeId);
676
+ const proposedSpec = canonicalNodeSpecForCompare(proposedNode, anchorNodeId);
677
+ if (stableStringify(lockedSpec) !== stableStringify(proposedSpec)) {
678
+ reasons.push(`Locked past node "${lockedId}" must remain unchanged.`);
679
+ }
680
+ }
681
+
682
+ if (isUiUxTask(task)) {
683
+ const searchable = workNodes
684
+ .map(([, node]) => {
685
+ const title = String(node?.title || '');
686
+ const description = String(node?.description || '');
687
+ const where = normalizeStringList(node?.where).join(' ');
688
+ const whatChanges = normalizeStringList(node?.whatChanges).join(' ');
689
+ const acceptanceCriteria = normalizeStringList(node?.acceptanceCriteria).join(' ');
690
+ const todos = normalizeStringList(node?.todos).join(' ');
691
+ return `${title} ${description} ${where} ${whatChanges} ${acceptanceCriteria} ${todos}`.toLowerCase();
692
+ })
693
+ .join('\n');
694
+ const hasUiCoverage = /(ui|interface|component|layout|view)/.test(searchable);
695
+ const hasUxCoverage = /(ux|flow|state|loading|empty|error|accessibility|responsive|keyboard)/.test(searchable);
696
+ if (!hasUiCoverage) reasons.push('UI/UX task requires at least one node with explicit UI/component scope.');
697
+ if (!hasUxCoverage) reasons.push('UI/UX task requires UX states/flows (loading, empty, error, accessibility, responsive, etc.).');
698
+ }
699
+
700
+ if (isArchitectureHeavyTask(task)) {
701
+ if (workNodes.length < 5) {
702
+ reasons.push('Architecture-heavy task should decompose into at least 5 work nodes.');
703
+ }
704
+ const searchable = workNodes
705
+ .map(([, node]) => {
706
+ const title = String(node?.title || '');
707
+ const description = String(node?.description || '');
708
+ const where = normalizeStringList(node?.where).join(' ');
709
+ const whatChanges = normalizeStringList(node?.whatChanges).join(' ');
710
+ return `${title} ${description} ${where} ${whatChanges}`.toLowerCase();
711
+ })
712
+ .join('\n');
713
+ const hasBackendCoverage = /(backend|fastapi|api|route|service|repository|worker|celery|job)/.test(searchable);
714
+ const hasFrontendCoverage = /(frontend|react|ui|page|component|modal|dashboard)/.test(searchable);
715
+ const hasDataCoverage = /(database|postgres|schema|table|migration|model|query)/.test(searchable);
716
+ if (!hasBackendCoverage) reasons.push('Architecture-heavy task requires explicit backend/API touchpoints.');
717
+ if (!hasFrontendCoverage) reasons.push('Architecture-heavy task requires explicit frontend/UI touchpoints.');
718
+ if (!hasDataCoverage) reasons.push('Architecture-heavy task requires explicit data/schema touchpoints.');
719
+ }
720
+
721
+ return { ok: reasons.length === 0, reasons };
722
+ }
723
+
724
+ function normalizeDraftNodeType(type) {
725
+ if (type === 'spike') return 'work';
726
+ if (type === 'work' || type === 'gate' || type === 'fork' || type === 'join' || type === 'conditional') {
727
+ return type;
728
+ }
729
+ return 'work';
730
+ }
731
+
732
+ function sanitizeNodeId(raw, fallback = 'draft-node') {
733
+ const trimmed = String(raw || '').trim();
734
+ const normalized = trimmed
735
+ .replace(/[^a-zA-Z0-9_-]/g, '-')
736
+ .replace(/-+/g, '-')
737
+ .replace(/^-|-$/g, '');
738
+ return normalized || fallback;
739
+ }
740
+
741
+ function edgeFingerprint(edge) {
742
+ const from = String(edge?.from || '');
743
+ const to = String(edge?.to || '');
744
+ const type = String(edge?.type || 'hard');
745
+ const condition = String(edge?.condition || 'on_success');
746
+ return `${from}|${to}|${type}|${condition}`;
747
+ }
748
+
749
+ function stableStringify(value) {
750
+ if (Array.isArray(value)) {
751
+ return `[${value.map((item) => stableStringify(item)).join(',')}]`;
752
+ }
753
+ if (value && typeof value === 'object') {
754
+ const keys = Object.keys(value).sort();
755
+ return `{${keys.map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`).join(',')}}`;
756
+ }
757
+ return JSON.stringify(value);
758
+ }
759
+
760
+ function canonicalNodeSpecForCompare(node, anchorNodeId) {
761
+ const type = normalizeDraftNodeType(node?.type);
762
+ const spec = {
763
+ type,
764
+ workType: type === 'work' ? normalizeWorkType(node?.type, node?.workType) : undefined,
765
+ title: String(node?.title || '').trim(),
766
+ description: String(node?.description || '').trim(),
767
+ where: normalizeStringList(node?.where),
768
+ whatChanges: normalizeStringList(node?.whatChanges),
769
+ acceptanceCriteria: normalizeStringList(node?.acceptanceCriteria),
770
+ todos: normalizeStringList(node?.todos),
771
+ verification: normalizeStringList(node?.verification),
772
+ gateType: type === 'gate' ? String(node?.gateType || 'progress') : undefined,
773
+ required: type === 'gate' ? node?.required !== false : undefined,
774
+ verificationStrategy: type === 'gate' ? (asObject(node?.verificationStrategy) || {}) : undefined,
775
+ estimateMinutes: type === 'work' ? (Number.isFinite(node?.estimateMinutes) ? Number(node.estimateMinutes) : 15) : undefined,
776
+ maxAttempts: type === 'work' ? (Number.isInteger(node?.maxAttempts) ? Number(node.maxAttempts) : 2) : undefined,
777
+ retryPolicy: type === 'work' ? (asObject(node?.retryPolicy) || { backoffMs: 5000, onExhaust: 'escalate' }) : undefined,
778
+ };
779
+ const deps = Array.isArray(node?.deps) ? node.deps : [];
780
+ spec.deps = Array.from(new Set(
781
+ deps
782
+ .map((dep) => String(dep || '').trim())
783
+ .filter(Boolean)
784
+ .filter((dep) => dep !== anchorNodeId)
785
+ )).sort();
786
+ return spec;
787
+ }
788
+
789
+ function mergeProposedDraftGraph({ graph, proposedGraph, anchorNodeId = 'plan-approval', sourcePlanNodeId = 'plan' }) {
790
+ const draftNodes = asObject(proposedGraph?.nodes) || {};
791
+ const draftEdges = Array.isArray(proposedGraph?.edges) ? proposedGraph.edges : [];
792
+ const sourceIds = Object.keys(draftNodes);
793
+ if (sourceIds.length === 0) {
794
+ return { graph, draftNodeIds: [], sinkNodeIds: [] };
795
+ }
796
+
797
+ const mergedGraph = graph;
798
+ if (!asObject(mergedGraph.nodes)) mergedGraph.nodes = {};
799
+ if (!Array.isArray(mergedGraph.edges)) mergedGraph.edges = [];
800
+ if (!asObject(mergedGraph.doneCriteria)) mergedGraph.doneCriteria = {};
801
+
802
+ const usedIds = new Set(Object.keys(mergedGraph.nodes));
803
+ const idMap = {};
804
+
805
+ for (const sourceId of sourceIds) {
806
+ const base = sanitizeNodeId(sourceId);
807
+ let candidate = base;
808
+ if (usedIds.has(candidate)) {
809
+ candidate = `draft-${base}`;
810
+ }
811
+ let suffix = 2;
812
+ while (usedIds.has(candidate)) {
813
+ candidate = `${base}-${suffix}`;
814
+ suffix += 1;
815
+ }
816
+ idMap[sourceId] = candidate;
817
+ usedIds.add(candidate);
818
+ }
819
+
820
+ const mappedNodeIds = Object.values(idMap);
821
+ const mappedNodeSet = new Set(mappedNodeIds);
822
+
823
+ for (const sourceId of sourceIds) {
824
+ const mappedId = idMap[sourceId];
825
+ const raw = asObject(draftNodes[sourceId]) || {};
826
+ const type = normalizeDraftNodeType(raw.type);
827
+ const depsRaw = Array.isArray(raw.deps) ? raw.deps : [];
828
+ const deps = Array.from(new Set(
829
+ depsRaw
830
+ .map((dep) => String(dep || '').trim())
831
+ .filter(Boolean)
832
+ .map((dep) => idMap[dep] || dep)
833
+ .filter((dep) => dep !== mappedId)
834
+ ));
835
+
836
+ const nextNode = {
837
+ ...raw,
838
+ type,
839
+ status: 'pending',
840
+ deps,
841
+ generatedByPlanNodeId: sourcePlanNodeId,
842
+ planNodeKey: sourceId,
843
+ };
844
+
845
+ if (type === 'work') {
846
+ nextNode.title = String(raw.title || mappedId).trim() || mappedId;
847
+ nextNode.workType = normalizeWorkType(raw.type, raw.workType);
848
+ nextNode.attempts = Number.isInteger(raw.attempts) ? raw.attempts : 0;
849
+ nextNode.maxAttempts = Number.isInteger(raw.maxAttempts) ? raw.maxAttempts : 2;
850
+ nextNode.retryPolicy = asObject(raw.retryPolicy) || { backoffMs: 5000, onExhaust: 'escalate' };
851
+ nextNode.estimateMinutes = Number.isFinite(raw.estimateMinutes) ? raw.estimateMinutes : 15;
852
+ } else if (type === 'gate') {
853
+ nextNode.gateType = String(raw.gateType || 'progress');
854
+ nextNode.required = raw.required !== false;
855
+ nextNode.verificationStrategy = asObject(raw.verificationStrategy) || {
856
+ type: nextNode.gateType === 'handoff_gate' ? 'human' : 'auto',
857
+ };
858
+ } else if (type === 'join') {
859
+ nextNode.joinStrategy = raw.joinStrategy || 'all';
860
+ } else if (type === 'conditional') {
861
+ nextNode.condition = asObject(raw.condition) || { expression: 'true', inputFrom: deps[0] || mappedId };
862
+ nextNode.thenBranch = Array.isArray(raw.thenBranch) ? raw.thenBranch.map((id) => idMap[id] || id) : [];
863
+ nextNode.elseBranch = Array.isArray(raw.elseBranch) ? raw.elseBranch.map((id) => idMap[id] || id) : [];
864
+ }
865
+
866
+ nextNode.deps = Array.from(new Set(
867
+ (Array.isArray(nextNode.deps) ? nextNode.deps : [])
868
+ .map((dep) => String(dep || '').trim())
869
+ .filter(Boolean)
870
+ ));
871
+
872
+ mergedGraph.nodes[mappedId] = nextNode;
873
+ }
874
+
875
+ const edgeSet = new Set(mergedGraph.edges.map((edge) => edgeFingerprint(edge)));
876
+ const addEdge = (edge) => {
877
+ if (!edge || !edge.from || !edge.to) return;
878
+ if (!mergedGraph.nodes[edge.from] || !mergedGraph.nodes[edge.to]) return;
879
+ const normalized = {
880
+ from: String(edge.from),
881
+ to: String(edge.to),
882
+ type: edge.type === 'soft' ? 'soft' : 'hard',
883
+ condition: edge.condition || 'on_success',
884
+ };
885
+ const key = edgeFingerprint(normalized);
886
+ if (edgeSet.has(key)) return;
887
+ edgeSet.add(key);
888
+ mergedGraph.edges.push(normalized);
889
+ };
890
+
891
+ for (const rawEdge of draftEdges) {
892
+ const from = idMap[String(rawEdge?.from || '').trim()] || String(rawEdge?.from || '').trim();
893
+ const to = idMap[String(rawEdge?.to || '').trim()] || String(rawEdge?.to || '').trim();
894
+ addEdge({
895
+ from,
896
+ to,
897
+ type: rawEdge?.type || 'hard',
898
+ condition: rawEdge?.condition || 'on_success',
899
+ });
900
+ }
901
+
902
+ const anchorExists = Boolean(mergedGraph.nodes[anchorNodeId]);
903
+ if (anchorExists) {
904
+ for (const nodeId of mappedNodeIds) {
905
+ const node = mergedGraph.nodes[nodeId];
906
+ if (!node) continue;
907
+ const deps = Array.isArray(node.deps) ? node.deps : [];
908
+ const filteredDeps = Array.from(new Set(
909
+ deps.filter((dep) => dep && dep !== nodeId && mergedGraph.nodes[dep])
910
+ ));
911
+ if (!filteredDeps.includes(anchorNodeId)) {
912
+ filteredDeps.push(anchorNodeId);
913
+ }
914
+ addEdge({
915
+ from: anchorNodeId,
916
+ to: nodeId,
917
+ type: 'hard',
918
+ condition: 'on_success',
919
+ });
920
+ node.deps = filteredDeps;
921
+ }
922
+ }
923
+
924
+ const draftInternalEdges = mergedGraph.edges.filter(
925
+ (edge) => mappedNodeSet.has(edge.from) && mappedNodeSet.has(edge.to)
926
+ );
927
+ const sinkNodeIds = mappedNodeIds.filter(
928
+ (nodeId) => !draftInternalEdges.some((edge) => edge.from === nodeId)
929
+ );
930
+
931
+ if (sinkNodeIds.length > 0) {
932
+ const existingSinks = Array.isArray(mergedGraph.doneCriteria.completionSinkNodeIds)
933
+ ? mergedGraph.doneCriteria.completionSinkNodeIds
934
+ : [];
935
+ mergedGraph.doneCriteria.completionSinkNodeIds = Array.from(new Set([
936
+ ...existingSinks.filter((id) => id !== anchorNodeId),
937
+ ...sinkNodeIds,
938
+ ]));
939
+ }
940
+
941
+ return { graph: mergedGraph, draftNodeIds: mappedNodeIds, sinkNodeIds };
942
+ }
943
+
944
+ function stripLockedNodesFromProposedGraph(proposedGraph, lockedNodeIds) {
945
+ const lockedIdSet = new Set(
946
+ (Array.isArray(lockedNodeIds) ? lockedNodeIds : [])
947
+ .map((id) => String(id || '').trim())
948
+ .filter(Boolean)
949
+ );
950
+ const srcNodes = asObject(proposedGraph?.nodes) || {};
951
+ const srcEdges = Array.isArray(proposedGraph?.edges) ? proposedGraph.edges : [];
952
+ const nextNodes = {};
953
+ for (const [id, node] of Object.entries(srcNodes)) {
954
+ if (lockedIdSet.has(id)) continue;
955
+ nextNodes[id] = node;
956
+ }
957
+ const nextEdges = srcEdges.filter((edge) => {
958
+ const from = String(edge?.from || '').trim();
959
+ const to = String(edge?.to || '').trim();
960
+ if (!from || !to) return false;
961
+ return !(lockedIdSet.has(from) && lockedIdSet.has(to));
962
+ });
963
+ return { nodes: nextNodes, edges: nextEdges };
964
+ }
965
+
966
+ function replacePlanGraph({
967
+ graph,
968
+ planNodeId,
969
+ proposedGraph,
970
+ anchorNodeId = 'plan-approval',
971
+ previousDraftNodeIds = [],
972
+ lockedNodeIds = [],
973
+ }) {
974
+ const mergedGraph = graph;
975
+ if (!asObject(mergedGraph.nodes)) mergedGraph.nodes = {};
976
+ if (!Array.isArray(mergedGraph.edges)) mergedGraph.edges = [];
977
+ if (!asObject(mergedGraph.doneCriteria)) mergedGraph.doneCriteria = {};
978
+
979
+ const explicitPlanNodeIds = collectPlanNodeIds(mergedGraph, planNodeId, previousDraftNodeIds);
980
+ const topoPlanNodeIds = collectDescendantNodeIds(mergedGraph, anchorNodeId)
981
+ .filter((nodeId) => nodeId !== planNodeId && nodeId !== anchorNodeId);
982
+ const previousPlanNodeIds = Array.from(new Set([...explicitPlanNodeIds, ...topoPlanNodeIds]));
983
+ const previousPlanNodeSet = new Set(previousPlanNodeIds);
984
+ const lockedNodeSet = new Set(
985
+ (Array.isArray(lockedNodeIds) ? lockedNodeIds : [])
986
+ .map((id) => String(id || '').trim())
987
+ .filter((id) => previousPlanNodeSet.has(id) && mergedGraph.nodes[id])
988
+ );
989
+
990
+ const removableNodeIds = previousPlanNodeIds.filter((id) => !lockedNodeSet.has(id));
991
+ const removableNodeSet = new Set(removableNodeIds);
992
+ for (const nodeId of removableNodeIds) {
993
+ delete mergedGraph.nodes[nodeId];
994
+ }
995
+ mergedGraph.edges = mergedGraph.edges.filter((edge) => !removableNodeSet.has(edge?.from) && !removableNodeSet.has(edge?.to));
996
+ for (const node of Object.values(mergedGraph.nodes)) {
997
+ if (!node || !Array.isArray(node.deps)) continue;
998
+ node.deps = node.deps.filter((dep) => !removableNodeSet.has(dep));
999
+ }
1000
+
1001
+ const sanitizedProposedGraph = stripLockedNodesFromProposedGraph(proposedGraph, Array.from(lockedNodeSet));
1002
+ const { graph: replacedGraph, draftNodeIds: newDraftNodeIds } = mergeProposedDraftGraph({
1003
+ graph: mergedGraph,
1004
+ proposedGraph: sanitizedProposedGraph,
1005
+ anchorNodeId,
1006
+ sourcePlanNodeId: planNodeId,
1007
+ });
1008
+
1009
+ const currentPlanNodeIds = Object.entries(replacedGraph.nodes)
1010
+ .filter(([, node]) => node && node.generatedByPlanNodeId === planNodeId)
1011
+ .map(([nodeId]) => nodeId);
1012
+ const currentPlanNodeSet = new Set(currentPlanNodeIds);
1013
+ const planInternalEdges = replacedGraph.edges.filter(
1014
+ (edge) => currentPlanNodeSet.has(edge.from) && currentPlanNodeSet.has(edge.to)
1015
+ );
1016
+ const sinkNodeIds = currentPlanNodeIds.filter(
1017
+ (nodeId) => !planInternalEdges.some((edge) => edge.from === nodeId)
1018
+ );
1019
+ const nonPlanSinks = (Array.isArray(replacedGraph.doneCriteria.completionSinkNodeIds)
1020
+ ? replacedGraph.doneCriteria.completionSinkNodeIds
1021
+ : []).filter((id) => !previousPlanNodeSet.has(id) && !currentPlanNodeSet.has(id));
1022
+ replacedGraph.doneCriteria.completionSinkNodeIds = Array.from(new Set([
1023
+ ...nonPlanSinks,
1024
+ ...sinkNodeIds,
1025
+ ]));
1026
+
1027
+ return {
1028
+ graph: replacedGraph,
1029
+ draftNodeIds: Array.from(new Set([...currentPlanNodeIds, ...newDraftNodeIds])),
1030
+ sinkNodeIds,
1031
+ };
1032
+ }
1033
+
1034
+ function formatPromptList(label, items) {
1035
+ const values = normalizeStringList(items);
1036
+ if (values.length === 0) return null;
1037
+ return [
1038
+ `${label}:`,
1039
+ ...values.map((item) => `- ${item}`),
1040
+ ].join('\n');
1041
+ }
1042
+
1043
+ function buildWorkNodePrompt({ task, nodeId, node }) {
1044
+ const taskTitle = String(task?.title || task?.goal || task?.user_request || '').trim() || 'Untitled task';
1045
+ const taskContent = resolveTaskPromptBody(task);
1046
+ const nodeTitle = String(node?.title || '').trim() || nodeId;
1047
+ const nodeDescription = String(node?.description || '').trim();
1048
+ const workType = String(node?.workType || '').trim();
1049
+ const where = formatPromptList('Where (targets)', node?.where);
1050
+ const whatChanges = formatPromptList('Planned Changes', node?.whatChanges);
1051
+ const acceptanceCriteria = formatPromptList('Acceptance Criteria', node?.acceptanceCriteria);
1052
+ const todos = formatPromptList('To Dos', node?.todos);
1053
+ const verification = formatPromptList('Validation Expectations', node?.verification);
1054
+
1055
+ return [
1056
+ 'WORK NODE',
1057
+ '',
1058
+ `Task: ${taskTitle}`,
1059
+ taskContent ? `Task Objective: ${taskContent}` : null,
1060
+ `Node ID: ${nodeId}`,
1061
+ `Node Title: ${nodeTitle}`,
1062
+ workType ? `Work Type: ${workType}` : null,
1063
+ nodeDescription ? `Node Description: ${nodeDescription}` : null,
1064
+ where,
1065
+ whatChanges,
1066
+ acceptanceCriteria,
1067
+ todos,
1068
+ verification,
1069
+ '',
1070
+ 'Do the work required for this node. Apply changes directly to the repository.',
1071
+ 'Use the plan details above as requirements for implementation.',
1072
+ 'Keep output concise and include a short implementation summary and validation notes.',
1073
+ ].filter(Boolean).join('\n');
1074
+ }
1075
+
1076
+ function buildVerificationChecks(node) {
1077
+ const checks = node?.verificationStrategy?.checks;
1078
+ if (!Array.isArray(checks)) return [];
1079
+ return checks
1080
+ .map((item) => String(item || '').trim())
1081
+ .filter(Boolean);
1082
+ }
1083
+
1084
+ async function loadGraphForTask({ taskId, task, cloudRequest }) {
1085
+ const embedded = readEmbeddedGraph(task);
1086
+ if (embedded) return normalizeGraph(embedded, taskId);
1087
+
1088
+ if (typeof cloudRequest !== 'function') {
1089
+ throw new Error(`[v2-required] Task ${taskId} missing embedded graph and no cloud graph loader is available.`);
1090
+ }
1091
+
1092
+ const attemptsRaw = Number(process.env.AGX_V2_GRAPH_LOAD_RETRIES || 3);
1093
+ const maxAttempts = Number.isFinite(attemptsRaw) && attemptsRaw > 0 ? Math.floor(attemptsRaw) : 3;
1094
+ let response;
1095
+ let lastErr = null;
1096
+
1097
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
1098
+ try {
1099
+ response = await cloudRequest('GET', `/api/tasks/${taskId}/graph`);
1100
+ lastErr = null;
1101
+ break;
1102
+ } catch (err) {
1103
+ lastErr = err;
1104
+ if (attempt < maxAttempts) {
1105
+ const backoffMs = Math.min(2000, 250 * (2 ** (attempt - 1)));
1106
+ await sleep(backoffMs);
1107
+ }
1108
+ }
1109
+ }
1110
+
1111
+ if (lastErr) {
1112
+ throw new Error(`[v2-required] Failed to load graph for task ${taskId} via GET /api/tasks/${taskId}/graph after ${maxAttempts} attempt(s): ${lastErr?.message || lastErr}`);
1113
+ }
1114
+
1115
+ const parsed = normalizeGraph(readGraphFromResponse(response), taskId);
1116
+ if (!parsed) {
1117
+ throw new Error(`[v2-required] Graph endpoint returned invalid payload for task ${taskId}.`);
1118
+ }
1119
+ return parsed;
1120
+ }
1121
+
1122
+ async function persistGraphToCloud({ cloudRequest, taskId, graph }) {
1123
+ if (typeof cloudRequest !== 'function') return graph;
1124
+
1125
+ const basePatch = {
1126
+ graphId: graph.id,
1127
+ mode: graph.mode,
1128
+ nodes: graph.nodes,
1129
+ edges: graph.edges,
1130
+ policy: graph.policy,
1131
+ doneCriteria: graph.doneCriteria,
1132
+ ifMatchGraphVersion: graph.graphVersion,
1133
+ };
1134
+
1135
+ const payloads = [
1136
+ // Prefer minimal top-level patch shape accepted by /api/tasks/:id/graph.
1137
+ basePatch,
1138
+ // Fallback: wrapped graph shape for backward-compatible board runtimes.
1139
+ { graph: basePatch, ifMatchGraphVersion: graph.graphVersion },
1140
+ ];
1141
+
1142
+ let lastErr = null;
1143
+ for (const payload of payloads) {
1144
+ try {
1145
+ const response = await cloudRequest('PATCH', `/api/tasks/${taskId}/graph`, payload);
1146
+ const responseGraph = normalizeGraph(readGraphFromResponse(response), taskId);
1147
+ if (!responseGraph) return graph;
1148
+ // Some cloud runtimes only echo structural graph fields. Preserve local
1149
+ // execution-state fields so terminal decisions remain accurate.
1150
+ responseGraph.status = responseGraph.status || graph.status;
1151
+ responseGraph.startedAt = responseGraph.startedAt || graph.startedAt;
1152
+ responseGraph.completedAt = responseGraph.completedAt || graph.completedAt;
1153
+ responseGraph.timedOutAt = responseGraph.timedOutAt || graph.timedOutAt;
1154
+ if (!Array.isArray(responseGraph.runtimeEvents) || responseGraph.runtimeEvents.length === 0) {
1155
+ responseGraph.runtimeEvents = Array.isArray(graph.runtimeEvents) ? graph.runtimeEvents : [];
1156
+ }
1157
+ return responseGraph;
1158
+ } catch (err) {
1159
+ lastErr = err;
1160
+ }
1161
+ }
1162
+
1163
+ throw new Error(`[v2-required] Failed to persist graph for task ${taskId} via PATCH /api/tasks/${taskId}/graph: ${lastErr?.message || lastErr}`);
1164
+ }
1165
+
1166
+ function makeDecision({ outcome, message, nextPrompt = '', graph, extra = {} }) {
1167
+ return {
1168
+ done: outcome === 'done',
1169
+ decision: outcome,
1170
+ explanation: message,
1171
+ final_result: message,
1172
+ next_prompt: nextPrompt,
1173
+ summary: message,
1174
+ graph_id: graph?.id || null,
1175
+ graph_version: graph?.graphVersion || null,
1176
+ ...extra,
1177
+ };
1178
+ }
1179
+
1180
+ function createNodeScopedLogger(logger, nodeId) {
1181
+ const normalizedNodeId = typeof nodeId === 'string' && nodeId.trim() ? nodeId.trim() : null;
1182
+ if (!logger || typeof logger.log !== 'function' || !normalizedNodeId) {
1183
+ return logger;
1184
+ }
1185
+ return {
1186
+ log(type, data) {
1187
+ logger.log(type, data, normalizedNodeId);
1188
+ },
1189
+ flushAll: typeof logger.flushAll === 'function'
1190
+ ? () => logger.flushAll()
1191
+ : undefined,
1192
+ };
1193
+ }
1194
+
1195
+ function createCloudExecuteGraphV2(env) {
1196
+ const {
1197
+ logExecutionFlow,
1198
+ abortIfCancelled,
1199
+ createDaemonArtifactsRecorder,
1200
+ runSingleAgentIteration,
1201
+ runSingleAgentPlanIteration,
1202
+ buildLocalRunIndexEntry,
1203
+ finalizeRunSafe,
1204
+ } = env || {};
1205
+
1206
+ const baseProcEnv = typeof process !== 'undefined' && process.env ? process.env : {};
1207
+
1208
+ async function executeWorkNode({
1209
+ taskId,
1210
+ task,
1211
+ provider,
1212
+ model,
1213
+ nodeId,
1214
+ node,
1215
+ graphRun,
1216
+ artifacts,
1217
+ logger,
1218
+ cancellationWatcher,
1219
+ }) {
1220
+ const prompt = buildWorkNodePrompt({ task, nodeId, node });
1221
+ artifacts.recordPrompt(`Node Prompt (${nodeId})`, prompt);
1222
+ const nodeLogger = createNodeScopedLogger(logger, nodeId);
1223
+
1224
+ const output = await runSingleAgentIteration({
1225
+ taskId,
1226
+ task,
1227
+ provider,
1228
+ model,
1229
+ prompt,
1230
+ env: {
1231
+ ...baseProcEnv,
1232
+ AGX_RUN_ROOT: graphRun?.paths?.root || '',
1233
+ AGX_RUN_PLAN_DIR: graphRun?.paths?.plan || '',
1234
+ AGX_RUN_ARTIFACTS_DIR: graphRun?.paths?.artifacts || '',
1235
+ },
1236
+ logger: nodeLogger,
1237
+ artifacts,
1238
+ cancellationWatcher,
1239
+ cwd: process.cwd(),
1240
+ });
1241
+
1242
+ artifacts.recordOutput(`Node Output (${nodeId})`, output || '');
1243
+ return output;
1244
+ }
1245
+
1246
+ async function executePlanNode({
1247
+ taskId,
1248
+ task,
1249
+ provider,
1250
+ model,
1251
+ nodeId,
1252
+ node,
1253
+ graphRun,
1254
+ artifacts,
1255
+ logger,
1256
+ cancellationWatcher,
1257
+ replanContext = null,
1258
+ }) {
1259
+ const prompt = buildPlanNodePrompt({ task, replanContext });
1260
+ artifacts.recordPrompt(`Plan Prompt (${nodeId})`, prompt);
1261
+ const nodeLogger = createNodeScopedLogger(logger, nodeId);
1262
+
1263
+ const planIterationRunner = typeof runSingleAgentPlanIteration === 'function'
1264
+ ? runSingleAgentPlanIteration
1265
+ : runSingleAgentIteration;
1266
+
1267
+ const runPlanner = async (planPrompt) => planIterationRunner({
1268
+ taskId,
1269
+ task,
1270
+ provider,
1271
+ model,
1272
+ prompt: planPrompt,
1273
+ env: {
1274
+ ...baseProcEnv,
1275
+ AGX_RUN_ROOT: graphRun?.paths?.root || '',
1276
+ AGX_RUN_PLAN_DIR: graphRun?.paths?.plan || '',
1277
+ AGX_RUN_ARTIFACTS_DIR: graphRun?.paths?.artifacts || '',
1278
+ },
1279
+ logger: nodeLogger,
1280
+ artifacts,
1281
+ cancellationWatcher,
1282
+ cwd: process.cwd(),
1283
+ });
1284
+
1285
+ let rawOutput = await runPlanner(prompt);
1286
+ artifacts.recordOutput(`Plan Output (${nodeId})`, rawOutput || '');
1287
+
1288
+ let proposedGraph = parsePlanOutput(rawOutput);
1289
+ let planValidation = validateProposedPlan(proposedGraph, task, {
1290
+ lockedNodesById: replanContext?.lockedNodesById,
1291
+ anchorNodeId: 'plan-approval',
1292
+ });
1293
+ if (!proposedGraph || !planValidation.ok) {
1294
+ const reasons = !proposedGraph
1295
+ ? ['First planner response was not valid graph JSON.']
1296
+ : planValidation.reasons;
1297
+ artifacts.recordOutput(`Plan Validation Error (${nodeId})`, reasons.join('\n'));
1298
+ const retryPrompt = [
1299
+ prompt,
1300
+ '',
1301
+ 'Your previous response did not pass plan validation.',
1302
+ 'Fix all issues below and return only valid JSON:',
1303
+ ...reasons.slice(0, 12).map((reason) => `- ${reason}`),
1304
+ '',
1305
+ 'No markdown, no explanations, no implementation steps.',
1306
+ ].join('\n');
1307
+ rawOutput = await runPlanner(retryPrompt);
1308
+ artifacts.recordOutput(`Plan Output Retry (${nodeId})`, rawOutput || '');
1309
+ proposedGraph = parsePlanOutput(rawOutput);
1310
+ planValidation = validateProposedPlan(proposedGraph, task, {
1311
+ lockedNodesById: replanContext?.lockedNodesById,
1312
+ anchorNodeId: 'plan-approval',
1313
+ });
1314
+ }
1315
+ if (!proposedGraph) {
1316
+ throw new Error('LLM plan output could not be parsed into a valid graph structure');
1317
+ }
1318
+ if (!planValidation.ok) {
1319
+ throw new Error(`LLM plan output missing required plan details: ${planValidation.reasons.join(' | ')}`);
1320
+ }
1321
+
1322
+ artifacts.recordOutput(`Proposed Graph (${nodeId})`, JSON.stringify(proposedGraph, null, 2));
1323
+ return proposedGraph;
1324
+ }
1325
+
1326
+ async function executeGateNode({ node, cwd, onLog, approvalMode }) {
1327
+ const gateType = String(node?.gateType || 'progress').toLowerCase();
1328
+ if (approvalMode === 'auto' && gateType === 'approval_gate') {
1329
+ return {
1330
+ status: 'passed',
1331
+ verificationResult: {
1332
+ passed: true,
1333
+ checks: [],
1334
+ verifiedAt: nowIso(),
1335
+ verifiedBy: 'auto_approval',
1336
+ },
1337
+ reason: 'Task approval mode is auto; approval gate auto-approved.',
1338
+ };
1339
+ }
1340
+
1341
+ const strategy = String(node?.verificationStrategy?.type || 'auto').toLowerCase();
1342
+ if (strategy === 'human') {
1343
+ return {
1344
+ status: 'awaiting_human',
1345
+ verificationResult: {
1346
+ passed: false,
1347
+ checks: [],
1348
+ verifiedAt: nowIso(),
1349
+ verifiedBy: 'human',
1350
+ },
1351
+ reason: 'Gate requires human verification.',
1352
+ };
1353
+ }
1354
+
1355
+ const checks = buildVerificationChecks(node);
1356
+ const gateResult = await runVerifyGate({
1357
+ criteria: checks,
1358
+ cwd,
1359
+ verifyFailures: Number(node?.verifyFailures || 0),
1360
+ onLog: (line) => onLog?.(line),
1361
+ });
1362
+
1363
+ if (gateResult.forceAction) {
1364
+ return {
1365
+ status: 'failed',
1366
+ verificationResult: {
1367
+ passed: false,
1368
+ checks: gateResult.results || [],
1369
+ verifiedAt: nowIso(),
1370
+ verifiedBy: 'agent',
1371
+ },
1372
+ reason: gateResult.reason || 'Verification gate exhausted retries.',
1373
+ verifyFailures: gateResult.verifyFailures,
1374
+ };
1375
+ }
1376
+
1377
+ if (gateResult.needsLlm) {
1378
+ return {
1379
+ status: 'awaiting_human',
1380
+ verificationResult: {
1381
+ passed: false,
1382
+ checks: gateResult.results || [],
1383
+ verifiedAt: nowIso(),
1384
+ verifiedBy: 'agent',
1385
+ },
1386
+ reason: 'Gate includes semantic checks and requires human verification.',
1387
+ verifyFailures: gateResult.verifyFailures,
1388
+ };
1389
+ }
1390
+
1391
+ return {
1392
+ status: gateResult.passed ? 'passed' : 'failed',
1393
+ verificationResult: {
1394
+ passed: Boolean(gateResult.passed),
1395
+ checks: gateResult.results || [],
1396
+ verifiedAt: nowIso(),
1397
+ verifiedBy: 'agent',
1398
+ },
1399
+ reason: gateResult.passed ? 'Gate checks passed.' : 'Gate checks failed.',
1400
+ verifyFailures: gateResult.verifyFailures,
1401
+ };
1402
+ }
1403
+
1404
+ async function runV2GraphExecutionLoop({
1405
+ taskId,
1406
+ task,
1407
+ provider,
1408
+ model,
1409
+ logger,
1410
+ storage,
1411
+ projectSlug,
1412
+ taskSlug,
1413
+ stageLocal,
1414
+ initialPromptContext,
1415
+ cancellationWatcher,
1416
+ cloudRequest,
1417
+ }) {
1418
+ logExecutionFlow('runV2GraphExecutionLoop', 'input', `taskId=${taskId}, provider=${provider}, model=${model}, stage=${stageLocal}`);
1419
+
1420
+ const maxTicksRaw = Number(process.env.AGX_V2_MAX_TICKS || 200);
1421
+ const maxTicks = Number.isFinite(maxTicksRaw) && maxTicksRaw > 0 ? Math.floor(maxTicksRaw) : 200;
1422
+
1423
+ const graphRun = await storage.createRun({
1424
+ projectSlug,
1425
+ taskSlug,
1426
+ stage: stageLocal || 'execute',
1427
+ engine: provider,
1428
+ model: model || undefined,
1429
+ });
1430
+ const artifacts = createDaemonArtifactsRecorder({ storage, run: graphRun, taskId });
1431
+ if (initialPromptContext) {
1432
+ artifacts.recordPrompt('Initial Task Context', initialPromptContext);
1433
+ }
1434
+ try {
1435
+ let graph = await loadGraphForTask({ taskId, task, cloudRequest });
1436
+ assertGraphShape(graph, taskId);
1437
+ const taskApprovalMode = resolveTaskApprovalMode(task);
1438
+ const startNodeSelection = applyStartNodeSelection(graph, task);
1439
+ const activeStartNodeId = startNodeSelection.activeStartNodeId;
1440
+
1441
+ graph.startedAt = graph.startedAt || nowIso();
1442
+ artifacts.recordOutput('Graph Loaded', JSON.stringify({
1443
+ graphId: graph.id,
1444
+ graphVersion: graph.graphVersion,
1445
+ mode: graph.mode,
1446
+ approvalMode: taskApprovalMode,
1447
+ startNodeId: activeStartNodeId || undefined,
1448
+ startNodeRerun: startNodeSelection.wasWorkNodeRerun,
1449
+ resetApprovalGateIds: startNodeSelection.resetApprovalGateIds,
1450
+ nodeCount: Object.keys(graph.nodes || {}).length,
1451
+ edgeCount: Array.isArray(graph.edges) ? graph.edges.length : 0,
1452
+ }, null, 2));
1453
+
1454
+ await storage.writeTaskGraph(projectSlug, taskSlug, graph);
1455
+ graph = await persistGraphToCloud({ cloudRequest, taskId, graph });
1456
+ assertGraphShape(graph, taskId);
1457
+
1458
+ let tickCount = 0;
1459
+ let stalledTicks = 0;
1460
+ let previousFingerprint = nodeStatusFingerprint(graph);
1461
+
1462
+ while (tickCount < maxTicks) {
1463
+ tickCount += 1;
1464
+ await abortIfCancelled(cancellationWatcher);
1465
+ logExecutionFlow('runV2GraphExecutionLoop', 'processing', `taskId=${taskId}, tick=${tickCount}`);
1466
+
1467
+ const tickNow = nowIso();
1468
+ const tickResult = schedulerTick(graph, {
1469
+ now: tickNow,
1470
+ allowedNodeIds: activeStartNodeId ? [activeStartNodeId] : undefined,
1471
+ });
1472
+ graph = tickResult?.graph ? tickResult.graph : graph;
1473
+ if (!Array.isArray(graph.runtimeEvents)) graph.runtimeEvents = [];
1474
+ for (const event of (tickResult?.events || [])) {
1475
+ graph.runtimeEvents.push({
1476
+ ...event,
1477
+ graphId: graph.id,
1478
+ timestamp: event?.timestamp || tickNow,
1479
+ });
1480
+ }
1481
+
1482
+ // Persist scheduler transitions (e.g. pending -> running) immediately so
1483
+ // UI reflects in-flight execution before potentially long node work begins.
1484
+ if ((tickResult?.events || []).length > 0) {
1485
+ graph.updatedAt = nowIso();
1486
+ await storage.writeTaskGraph(projectSlug, taskSlug, graph);
1487
+ graph = await persistGraphToCloud({ cloudRequest, taskId, graph });
1488
+ assertGraphShape(graph, taskId);
1489
+ }
1490
+
1491
+ const runnableNodeIds = collectNodeIdsByStatus(graph, ['running']);
1492
+ let progressedThisTick = false;
1493
+
1494
+ for (const nodeId of runnableNodeIds) {
1495
+ const node = graph.nodes[nodeId];
1496
+ if (!node || node.status !== 'running') continue;
1497
+
1498
+ const startedAt = node.startedAt || tickNow;
1499
+ const startedMs = Date.parse(startedAt);
1500
+ node.startedAt = startedAt;
1501
+
1502
+ if (node.type === 'work' && isPlanNode(nodeId, node)) {
1503
+ // Special handling: plan node generates a draft execution graph
1504
+ try {
1505
+ const previousDraftNodeIds = Array.isArray(node?.output?.draftNodeIds) ? node.output.draftNodeIds : [];
1506
+ const isPlanRerun = Boolean(node?.completedAt) || Boolean(asObject(node?.output)?.proposedGraph);
1507
+ const replanContext = isPlanRerun
1508
+ ? null
1509
+ : buildPlanReplanContext({
1510
+ graph,
1511
+ planNodeId: nodeId,
1512
+ previousDraftNodeIds,
1513
+ anchorNodeId: 'plan-approval',
1514
+ preserveLockedPastNodes: true,
1515
+ });
1516
+ const proposedGraph = await executePlanNode({
1517
+ taskId,
1518
+ task,
1519
+ provider,
1520
+ model,
1521
+ nodeId,
1522
+ node,
1523
+ graphRun,
1524
+ artifacts,
1525
+ logger,
1526
+ cancellationWatcher,
1527
+ replanContext,
1528
+ });
1529
+ const { draftNodeIds, sinkNodeIds } = replacePlanGraph({
1530
+ graph,
1531
+ planNodeId: nodeId,
1532
+ proposedGraph,
1533
+ anchorNodeId: 'plan-approval',
1534
+ previousDraftNodeIds,
1535
+ lockedNodeIds: replanContext?.lockedNodeIds || [],
1536
+ });
1537
+ node.status = 'done';
1538
+ node.error = undefined;
1539
+ node.output = {
1540
+ ...(asObject(node.output) || {}),
1541
+ proposedGraph,
1542
+ draftNodeIds,
1543
+ draftSinkNodeIds: sinkNodeIds,
1544
+ summary: `Generated execution plan with ${draftNodeIds.length} draft nodes`,
1545
+ completedAt: nowIso(),
1546
+ };
1547
+ // Mark root as graphCreated
1548
+ const rootNode = graph.nodes.root || graph.nodes.ROOT;
1549
+ if (rootNode && rootNode.graphCreated === false) {
1550
+ rootNode.graphCreated = true;
1551
+ }
1552
+ progressedThisTick = true;
1553
+ } catch (err) {
1554
+ const attempts = Number(node.attempts || 0) + 1;
1555
+ node.attempts = attempts;
1556
+ node.error = String(err?.message || err || 'plan generation failed');
1557
+ const maxAttempts = Number.isInteger(node.maxAttempts) ? node.maxAttempts : 1;
1558
+ if (attempts < maxAttempts) {
1559
+ node.status = 'pending';
1560
+ } else {
1561
+ node.status = 'failed';
1562
+ node.completedAt = nowIso();
1563
+ }
1564
+ progressedThisTick = true;
1565
+ }
1566
+ } else if (node.type === 'work') {
1567
+ try {
1568
+ const output = await executeWorkNode({
1569
+ taskId,
1570
+ task,
1571
+ provider,
1572
+ model,
1573
+ nodeId,
1574
+ node,
1575
+ graphRun,
1576
+ artifacts,
1577
+ logger,
1578
+ cancellationWatcher,
1579
+ });
1580
+ node.status = 'done';
1581
+ node.error = undefined;
1582
+ node.output = {
1583
+ ...(asObject(node.output) || {}),
1584
+ summary: String(output || '').slice(0, 8000),
1585
+ completedAt: nowIso(),
1586
+ };
1587
+ progressedThisTick = true;
1588
+ } catch (err) {
1589
+ const attempts = Number(node.attempts || 0) + 1;
1590
+ node.attempts = attempts;
1591
+ node.error = String(err?.message || err || 'work node failed');
1592
+ const maxAttempts = Number.isInteger(node.maxAttempts) ? node.maxAttempts : 1;
1593
+ if (attempts < maxAttempts) {
1594
+ node.status = 'pending';
1595
+ } else {
1596
+ node.status = 'failed';
1597
+ node.completedAt = nowIso();
1598
+ }
1599
+ progressedThisTick = true;
1600
+ }
1601
+ } else if (node.type === 'gate') {
1602
+ const nodeLogger = createNodeScopedLogger(logger, nodeId);
1603
+ const gateResult = await executeGateNode({
1604
+ node,
1605
+ cwd: os.homedir(),
1606
+ onLog: (line) => nodeLogger?.log?.('system', `[v2-gate][${nodeId}] ${line}\n`),
1607
+ approvalMode: taskApprovalMode,
1608
+ });
1609
+ node.status = gateResult.status;
1610
+ node.verificationResult = gateResult.verificationResult;
1611
+ node.verifyFailures = gateResult.verifyFailures;
1612
+ node.error = gateResult.status === 'failed' ? gateResult.reason : undefined;
1613
+ progressedThisTick = true;
1614
+ } else {
1615
+ node.status = 'done';
1616
+ progressedThisTick = true;
1617
+ }
1618
+
1619
+ if (node.status === 'done' || node.status === 'passed' || node.status === 'failed' || node.status === 'skipped') {
1620
+ node.completedAt = node.completedAt || nowIso();
1621
+ if (Number.isFinite(startedMs)) {
1622
+ const elapsedMs = Math.max(0, Date.now() - startedMs);
1623
+ node.actualMinutes = Math.max(1, Math.round(elapsedMs / 60000));
1624
+ }
1625
+ }
1626
+ }
1627
+
1628
+ graph.updatedAt = nowIso();
1629
+ await storage.writeTaskGraph(projectSlug, taskSlug, graph);
1630
+ graph = await persistGraphToCloud({ cloudRequest, taskId, graph });
1631
+ assertGraphShape(graph, taskId);
1632
+
1633
+ if (activeStartNodeId) {
1634
+ const selectedNode = graph.nodes?.[activeStartNodeId];
1635
+ const selectedStatus = normalizeNodeStatus(selectedNode?.status);
1636
+ if (selectedNode && isTerminalStatus(selectedStatus)) {
1637
+ const singleNodeSucceeded = selectedStatus === 'done' || selectedStatus === 'passed' || selectedStatus === 'skipped';
1638
+ const summary = singleNodeSucceeded
1639
+ ? `v2 graph start node "${activeStartNodeId}" completed with status ${selectedStatus}.`
1640
+ : `v2 graph start node "${activeStartNodeId}" failed with status ${selectedStatus}.`;
1641
+ await artifacts.flush();
1642
+ await finalizeRunSafe(storage, graphRun, {
1643
+ status: singleNodeSucceeded ? 'done' : 'failed',
1644
+ reason: singleNodeSucceeded
1645
+ ? `v2 start node completed (${activeStartNodeId})`
1646
+ : `v2 start node failed (${activeStartNodeId})`,
1647
+ });
1648
+ const runIndexEntry = await buildLocalRunIndexEntry(storage, graphRun, singleNodeSucceeded ? 'done' : 'failed');
1649
+ return {
1650
+ code: singleNodeSucceeded ? 0 : 1,
1651
+ decision: makeDecision({
1652
+ outcome: singleNodeSucceeded ? 'done' : 'failed',
1653
+ message: summary,
1654
+ graph,
1655
+ extra: {
1656
+ start_node_id: activeStartNodeId,
1657
+ start_node_status: selectedStatus,
1658
+ },
1659
+ }),
1660
+ lastRun: graphRun,
1661
+ runIndexEntry,
1662
+ };
1663
+ }
1664
+ }
1665
+
1666
+ const fingerprint = nodeStatusFingerprint(graph);
1667
+ if (progressedThisTick || fingerprint !== previousFingerprint) {
1668
+ stalledTicks = 0;
1669
+ } else {
1670
+ stalledTicks += 1;
1671
+ }
1672
+ previousFingerprint = fingerprint;
1673
+
1674
+ if (!hasIncompleteNodes(graph)) {
1675
+ graph.completedAt = graph.completedAt || nowIso();
1676
+ graph.status = allCompletionSinksPassed(graph) ? 'done' : 'failed';
1677
+ await storage.writeTaskGraph(projectSlug, taskSlug, graph);
1678
+ graph = await persistGraphToCloud({ cloudRequest, taskId, graph });
1679
+
1680
+ const summary = graph.status === 'done'
1681
+ ? `v2 graph ${graph.id} completed successfully (version ${graph.graphVersion}).`
1682
+ : `v2 graph ${graph.id} finished with failures (version ${graph.graphVersion}).`;
1683
+
1684
+ artifacts.recordOutput('Graph Final State', JSON.stringify({
1685
+ graphId: graph.id,
1686
+ graphVersion: graph.graphVersion,
1687
+ status: graph.status,
1688
+ completedAt: graph.completedAt,
1689
+ }, null, 2));
1690
+ await artifacts.flush();
1691
+ await finalizeRunSafe(storage, graphRun, {
1692
+ status: graph.status === 'done' ? 'done' : 'failed',
1693
+ reason: graph.status === 'done'
1694
+ ? `v2 graph completed (${graph.id})`
1695
+ : `v2 graph finished with failed nodes (${graph.id})`,
1696
+ });
1697
+
1698
+ const runIndexEntry = await buildLocalRunIndexEntry(storage, graphRun, graph.status);
1699
+ return {
1700
+ code: graph.status === 'done' ? 0 : 1,
1701
+ decision: makeDecision({
1702
+ outcome: graph.status === 'done' ? 'done' : 'failed',
1703
+ message: summary,
1704
+ graph,
1705
+ }),
1706
+ lastRun: graphRun,
1707
+ runIndexEntry,
1708
+ };
1709
+ }
1710
+
1711
+ const awaitingHuman = collectNodeIdsByStatus(graph, ['awaiting_human']);
1712
+ if (awaitingHuman.length > 0) {
1713
+ await artifacts.flush();
1714
+ await finalizeRunSafe(storage, graphRun, {
1715
+ status: 'blocked',
1716
+ reason: `v2 graph awaiting human verification (${awaitingHuman.join(', ')})`,
1717
+ });
1718
+ const runIndexEntry = await buildLocalRunIndexEntry(storage, graphRun, 'blocked');
1719
+ return {
1720
+ code: 1,
1721
+ decision: makeDecision({
1722
+ outcome: 'blocked',
1723
+ message: `v2 graph ${graph.id} requires human verification for: ${awaitingHuman.join(', ')}`,
1724
+ nextPrompt: 'Complete required human verification and re-run.',
1725
+ graph,
1726
+ }),
1727
+ lastRun: graphRun,
1728
+ runIndexEntry,
1729
+ };
1730
+ }
1731
+
1732
+ if (stalledTicks >= 3) {
1733
+ const blockers = unresolvedPendingNodes(graph);
1734
+ await artifacts.flush();
1735
+ await finalizeRunSafe(storage, graphRun, {
1736
+ status: 'blocked',
1737
+ reason: `v2 graph stalled: ${blockers.join(', ') || 'no runnable nodes'}`,
1738
+ });
1739
+ const runIndexEntry = await buildLocalRunIndexEntry(storage, graphRun, 'blocked');
1740
+ return {
1741
+ code: 1,
1742
+ decision: makeDecision({
1743
+ outcome: 'blocked',
1744
+ message: `v2 graph ${graph.id} stalled; no runnable nodes after ${stalledTicks} ticks.`,
1745
+ nextPrompt: blockers.length
1746
+ ? `Investigate blocked nodes: ${blockers.join(', ')}`
1747
+ : 'Investigate graph dependencies and node statuses.',
1748
+ graph,
1749
+ }),
1750
+ lastRun: graphRun,
1751
+ runIndexEntry,
1752
+ };
1753
+ }
1754
+ }
1755
+
1756
+ await artifacts.flush();
1757
+ await finalizeRunSafe(storage, graphRun, {
1758
+ status: 'failed',
1759
+ reason: `v2 graph exceeded max ticks (${maxTicks}).`,
1760
+ });
1761
+ const runIndexEntry = await buildLocalRunIndexEntry(storage, graphRun, 'failed');
1762
+ return {
1763
+ code: 1,
1764
+ decision: makeDecision({
1765
+ outcome: 'failed',
1766
+ message: `v2 graph execution exceeded max ticks (${maxTicks}) without completion.`,
1767
+ graph,
1768
+ }),
1769
+ lastRun: graphRun,
1770
+ runIndexEntry,
1771
+ };
1772
+ } catch (err) {
1773
+ const message = String(err?.message || err || 'v2 graph execution failed');
1774
+ artifacts.recordOutput('V2 Graph Error', message);
1775
+ await artifacts.flush();
1776
+ if (!graphRun?.finalized) {
1777
+ try {
1778
+ await storage.failRun(graphRun, {
1779
+ error: message,
1780
+ code: 'V2_GRAPH_EXECUTION_FAILED',
1781
+ });
1782
+ } catch { }
1783
+ }
1784
+ throw err;
1785
+ }
1786
+ }
1787
+
1788
+ return { runV2GraphExecutionLoop };
1789
+ }
1790
+
1791
+ module.exports = { createCloudExecuteGraphV2 };