@mndrk/agx 1.4.61 → 1.4.63

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 (188) hide show
  1. package/README.md +40 -0
  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 +98 -91
  4. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/app-path-routes-manifest.json +15 -14
  5. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/build-manifest.json +2 -2
  6. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/prerender-manifest.json +15 -15
  7. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/routes-manifest.json +8 -0
  8. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.html +2 -2
  10. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.rsc +1 -1
  11. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/audit/route_client-reference-manifest.js +1 -1
  12. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/[...nextauth]/route_client-reference-manifest.js +1 -1
  13. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/daemon-secret/route_client-reference-manifest.js +1 -1
  14. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/device/code/route_client-reference-manifest.js +1 -1
  15. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/device/token/route_client-reference-manifest.js +1 -1
  16. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/refresh/route_client-reference-manifest.js +1 -1
  17. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  18. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/domains/[id]/route_client-reference-manifest.js +1 -1
  19. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/domains/route_client-reference-manifest.js +1 -1
  20. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  21. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/learnings/route_client-reference-manifest.js +1 -1
  22. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/logs/stream/route_client-reference-manifest.js +1 -1
  23. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  24. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/signal/route_client-reference-manifest.js +1 -1
  25. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/start/route_client-reference-manifest.js +1 -1
  26. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/status/route_client-reference-manifest.js +1 -1
  27. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
  28. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  29. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  30. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/complete/route_client-reference-manifest.js +1 -1
  31. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/route_client-reference-manifest.js +1 -1
  32. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/stage-prompts/route_client-reference-manifest.js +1 -1
  33. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/[commentId]/route_client-reference-manifest.js +1 -1
  34. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/route_client-reference-manifest.js +1 -1
  35. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/costs/route_client-reference-manifest.js +1 -1
  36. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route.js +1 -1
  37. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route_client-reference-manifest.js +1 -1
  38. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/heartbeat/route_client-reference-manifest.js +1 -1
  39. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/history/route_client-reference-manifest.js +1 -1
  40. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/route_client-reference-manifest.js +1 -1
  41. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route.js +11 -0
  42. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route.js.nft.json +1 -0
  43. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route_client-reference-manifest.js +1 -0
  44. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/restart-stage/route_client-reference-manifest.js +1 -1
  45. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -1
  46. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route.js +1 -1
  47. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -1
  48. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/stream/route_client-reference-manifest.js +1 -1
  49. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/user-settings/route_client-reference-manifest.js +1 -1
  50. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/nodes/route_client-reference-manifest.js +1 -1
  51. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/route_client-reference-manifest.js +1 -1
  52. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  53. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/callback/route_client-reference-manifest.js +1 -1
  54. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device/page.js +4 -4
  55. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device/page_client-reference-manifest.js +1 -1
  56. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device.html +1 -1
  57. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device.rsc +2 -2
  58. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page.js +2 -2
  59. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page.js.nft.json +1 -1
  60. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  61. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard.html +2 -2
  62. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard.rsc +2 -2
  63. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.html +2 -2
  64. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.rsc +1 -1
  65. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login/page_client-reference-manifest.js +1 -1
  66. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login.html +2 -2
  67. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login.rsc +1 -1
  68. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/page_client-reference-manifest.js +1 -1
  69. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page.js +2 -2
  70. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  71. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  72. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page.js +2 -2
  73. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page.js.nft.json +1 -1
  74. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page_client-reference-manifest.js +1 -1
  75. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/workflow/page_client-reference-manifest.js +1 -1
  76. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  77. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.html +2 -2
  78. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.rsc +1 -1
  79. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  80. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.html +2 -2
  81. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.rsc +1 -1
  82. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app-paths-manifest.json +15 -14
  83. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/6317.js +3 -3
  84. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/7143.js +1 -1
  85. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/8521.js +1 -1
  86. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/{4269.js → 8666.js} +2 -2
  87. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/functions-config-manifest.json +1 -0
  88. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/middleware-manifest.json +5 -5
  89. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/404.html +1 -1
  90. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/500.html +1 -1
  91. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages-manifest.json +1 -1
  92. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.js +1 -1
  93. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.json +1 -1
  94. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/{3424-b2ffdccf784b0ce5.js → 8960-720130c8c9bf5b1c.js} +1 -1
  95. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/{auth/daemon-secret/route-04c3c3cacd67004b.js → audit/route-bee7977512f30f17.js} +1 -1
  96. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/{device/code/route-04c3c3cacd67004b.js → [...nextauth]/route-bee7977512f30f17.js} +1 -1
  97. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/{audit/route-04c3c3cacd67004b.js → auth/daemon-secret/route-bee7977512f30f17.js} +1 -1
  98. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/{[...nextauth]/route-04c3c3cacd67004b.js → device/code/route-bee7977512f30f17.js} +1 -1
  99. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/device/token/route-bee7977512f30f17.js +1 -0
  100. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/refresh/route-bee7977512f30f17.js +1 -0
  101. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/status/route-bee7977512f30f17.js +1 -0
  102. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/[id]/route-bee7977512f30f17.js +1 -0
  103. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/route-bee7977512f30f17.js +1 -0
  104. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/health/route-bee7977512f30f17.js +1 -0
  105. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/learnings/route-bee7977512f30f17.js +1 -0
  106. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/logs/stream/route-bee7977512f30f17.js +1 -0
  107. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/cancel/route-bee7977512f30f17.js +1 -0
  108. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/signal/route-bee7977512f30f17.js +1 -0
  109. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/start/route-bee7977512f30f17.js +1 -0
  110. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/status/route-bee7977512f30f17.js +1 -0
  111. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/[id]/route-bee7977512f30f17.js +1 -0
  112. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/route-bee7977512f30f17.js +1 -0
  113. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/providers/route-bee7977512f30f17.js +1 -0
  114. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/complete/route-bee7977512f30f17.js +1 -0
  115. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/route-bee7977512f30f17.js +1 -0
  116. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/stage-prompts/route-bee7977512f30f17.js +1 -0
  117. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/[commentId]/route-bee7977512f30f17.js +1 -0
  118. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/route-bee7977512f30f17.js +1 -0
  119. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/costs/route-bee7977512f30f17.js +1 -0
  120. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/dependencies/route-bee7977512f30f17.js +1 -0
  121. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/heartbeat/route-bee7977512f30f17.js +1 -0
  122. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/history/route-bee7977512f30f17.js +1 -0
  123. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/route-bee7977512f30f17.js +1 -0
  124. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/stream/route-bee7977512f30f17.js +1 -0
  125. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/restart-stage/route-bee7977512f30f17.js +1 -0
  126. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/route-bee7977512f30f17.js +1 -0
  127. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/route-bee7977512f30f17.js +1 -0
  128. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/stream/route-bee7977512f30f17.js +1 -0
  129. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/user-settings/route-bee7977512f30f17.js +1 -0
  130. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/nodes/route-bee7977512f30f17.js +1 -0
  131. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/route-bee7977512f30f17.js +1 -0
  132. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/route-bee7977512f30f17.js +1 -0
  133. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/callback/route-bee7977512f30f17.js +1 -0
  134. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/device/page-06eeddaf1bb867c3.js +1 -0
  135. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/dashboard/page-6140206ded1cc4ae.js +1 -0
  136. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/{page-f1c8a838c838b996.js → page-d097a2c0e0fc17cf.js} +1 -1
  137. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/tasks/{page-c76247052ae5aa25.js → page-444e63f0464b1d40.js} +1 -1
  138. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/worker/index.js +364 -9
  139. package/lib/cli/cloud/prompts.js +35 -133
  140. package/lib/cli/runCli.js +282 -33
  141. package/lib/cli/skillText.js +1 -56
  142. package/lib/cli/templateDefaults.js +22 -0
  143. package/lib/commands/templates.js +83 -0
  144. package/lib/executor.js +8 -40
  145. package/lib/notifications/webhooks.js +123 -0
  146. package/lib/prompts/cloudTask.js +35 -75
  147. package/lib/prompts/templates.js +356 -0
  148. package/lib/templates.js +123 -0
  149. package/package.json +3 -2
  150. package/templates/stack/postgres/init/001_agx_board_schema.sql +17 -0
  151. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/device/token/route-04c3c3cacd67004b.js +0 -1
  152. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/refresh/route-04c3c3cacd67004b.js +0 -1
  153. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/status/route-04c3c3cacd67004b.js +0 -1
  154. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/[id]/route-04c3c3cacd67004b.js +0 -1
  155. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/route-04c3c3cacd67004b.js +0 -1
  156. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/health/route-04c3c3cacd67004b.js +0 -1
  157. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/learnings/route-04c3c3cacd67004b.js +0 -1
  158. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/logs/stream/route-04c3c3cacd67004b.js +0 -1
  159. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/cancel/route-04c3c3cacd67004b.js +0 -1
  160. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/signal/route-04c3c3cacd67004b.js +0 -1
  161. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/start/route-04c3c3cacd67004b.js +0 -1
  162. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/status/route-04c3c3cacd67004b.js +0 -1
  163. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/[id]/route-04c3c3cacd67004b.js +0 -1
  164. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/route-04c3c3cacd67004b.js +0 -1
  165. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/providers/route-04c3c3cacd67004b.js +0 -1
  166. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/complete/route-04c3c3cacd67004b.js +0 -1
  167. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/route-04c3c3cacd67004b.js +0 -1
  168. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/stage-prompts/route-04c3c3cacd67004b.js +0 -1
  169. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/[commentId]/route-04c3c3cacd67004b.js +0 -1
  170. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/route-04c3c3cacd67004b.js +0 -1
  171. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/costs/route-04c3c3cacd67004b.js +0 -1
  172. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/dependencies/route-04c3c3cacd67004b.js +0 -1
  173. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/heartbeat/route-04c3c3cacd67004b.js +0 -1
  174. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/history/route-04c3c3cacd67004b.js +0 -1
  175. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/route-04c3c3cacd67004b.js +0 -1
  176. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/restart-stage/route-04c3c3cacd67004b.js +0 -1
  177. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/route-04c3c3cacd67004b.js +0 -1
  178. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/route-04c3c3cacd67004b.js +0 -1
  179. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/stream/route-04c3c3cacd67004b.js +0 -1
  180. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/user-settings/route-04c3c3cacd67004b.js +0 -1
  181. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/nodes/route-04c3c3cacd67004b.js +0 -1
  182. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/route-04c3c3cacd67004b.js +0 -1
  183. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/route-04c3c3cacd67004b.js +0 -1
  184. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/callback/route-04c3c3cacd67004b.js +0 -1
  185. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/device/page-1c6069a7a4dd058d.js +0 -1
  186. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/dashboard/page-445516e005034dd0.js +0 -1
  187. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{x2zqTGbGGK8nA-dlhcQDx → o_Dsarly6P4c-yqsBEkNM}/_buildManifest.js +0 -0
  188. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{x2zqTGbGGK8nA-dlhcQDx → o_Dsarly6P4c-yqsBEkNM}/_ssgManifest.js +0 -0
@@ -11768,11 +11768,11 @@ var init_worker = __esm({
11768
11768
  loopDelayPromise = null;
11769
11769
  beenNotified = false;
11770
11770
  runPromise = null;
11771
- constructor({ id, name, options, interval, fetch, onFetch, onError }) {
11771
+ constructor({ id, name, options, interval, fetch: fetch2, onFetch, onError }) {
11772
11772
  this.id = id;
11773
11773
  this.name = name;
11774
11774
  this.options = options;
11775
- this.fetch = fetch;
11775
+ this.fetch = fetch2;
11776
11776
  this.onFetch = onFetch;
11777
11777
  this.onError = onError;
11778
11778
  this.interval = interval;
@@ -12181,7 +12181,7 @@ var init_manager = __esm({
12181
12181
  }
12182
12182
  const firstWorkerId = (0, import_node_crypto.randomUUID)({ disableEntropyCache: true });
12183
12183
  const createWorker = (workerId) => {
12184
- const fetch = () => {
12184
+ const fetch2 = () => {
12185
12185
  const ignoreGroups = localGroupConcurrency != null ? this.#getGroupsAtLocalCapacity(name) : void 0;
12186
12186
  return this.fetch(name, { batchSize, includeMetadata, priority, orderByCreatedOn, groupConcurrency, ignoreGroups });
12187
12187
  };
@@ -12214,7 +12214,7 @@ var init_manager = __esm({
12214
12214
  const onError = (error) => {
12215
12215
  this.emit(events.error, { ...error, message: error.message, stack: error.stack, queue: name, worker: workerId });
12216
12216
  };
12217
- return new worker_default({ id: workerId, name, options, interval, fetch, onFetch, onError });
12217
+ return new worker_default({ id: workerId, name, options, interval, fetch: fetch2, onFetch, onError });
12218
12218
  };
12219
12219
  for (let i = 0; i < localConcurrency; i++) {
12220
12220
  const workerId = i === 0 ? firstWorkerId : (0, import_node_crypto.randomUUID)({ disableEntropyCache: true });
@@ -18581,6 +18581,14 @@ var QueryBuilder = class {
18581
18581
  params.push(toSqlValue(value));
18582
18582
  return `${column} IS NOT DISTINCT FROM $${params.length}`;
18583
18583
  }
18584
+ if (op === "ilike") {
18585
+ params.push(toSqlValue(value));
18586
+ return `${column} ILIKE $${params.length}`;
18587
+ }
18588
+ if (op === "like") {
18589
+ params.push(toSqlValue(value));
18590
+ return `${column} LIKE $${params.length}`;
18591
+ }
18584
18592
  return "1=1";
18585
18593
  });
18586
18594
  if (clauses.length > 0) {
@@ -18872,8 +18880,129 @@ function isDependencyBlockedReason(reason) {
18872
18880
  return typeof reason === "string" && reason.startsWith(DEPENDENCY_BLOCKED_REASON_PREFIX);
18873
18881
  }
18874
18882
 
18875
- // ../agx-cloud/lib/db.ts
18883
+ // ../agx-cloud/lib/notifications/constants.ts
18884
+ var NOTIFICATION_EVENT_OPTIONS = [
18885
+ {
18886
+ value: "task.created",
18887
+ label: "Task created",
18888
+ description: "Fires immediately when a new task is added to the queue."
18889
+ },
18890
+ {
18891
+ value: "task.stage_complete",
18892
+ label: "Stage completed",
18893
+ description: "Emitted whenever a stage finishes and the task advances."
18894
+ },
18895
+ {
18896
+ value: "task.completed",
18897
+ label: "Task completed",
18898
+ description: "When the task reaches a completed status (done)."
18899
+ },
18900
+ {
18901
+ value: "task.failed",
18902
+ label: "Task failed",
18903
+ description: "When the task may have errored, including cancellations."
18904
+ },
18905
+ {
18906
+ value: "task.blocked",
18907
+ label: "Task blocked",
18908
+ description: "When the agent raises the task as blocked awaiting manual input."
18909
+ }
18910
+ ];
18911
+ var NOTIFICATION_EVENT_VALUES = NOTIFICATION_EVENT_OPTIONS.map((option) => option.value);
18912
+
18913
+ // ../agx-cloud/lib/notifications/index.ts
18914
+ var SchemaNotReadyError = class extends Error {
18915
+ };
18876
18916
  function isMissingRelationError(error, relation) {
18917
+ if (!error || typeof error !== "object") return false;
18918
+ const code = error.code;
18919
+ const message = typeof error.message === "string" ? error.message : "";
18920
+ return code === "42P01" || code === "PGRST205" || message.includes(`relation "${relation}" does not exist`) || message.includes(`Could not find the table 'agx.${relation}'`) || message.includes(`Could not find the table 'public.${relation}'`);
18921
+ }
18922
+ function mapWebhookRecord(raw) {
18923
+ const events5 = Array.isArray(raw.events) ? raw.events.filter((value) => typeof value === "string").map((value) => value.trim()).filter(
18924
+ (value) => NOTIFICATION_EVENT_VALUES.includes(value)
18925
+ ) : [];
18926
+ return {
18927
+ id: String(raw.id),
18928
+ user_id: String(raw.user_id),
18929
+ url: String(raw.url),
18930
+ name: raw.name != null ? String(raw.name) : null,
18931
+ events: events5,
18932
+ enabled: raw.enabled !== false,
18933
+ created_at: String(raw.created_at),
18934
+ updated_at: String(raw.updated_at)
18935
+ };
18936
+ }
18937
+ async function handleRelationError(relation, error) {
18938
+ if (isMissingRelationError(error, relation)) {
18939
+ throw new SchemaNotReadyError(`Missing relation: ${relation}`);
18940
+ }
18941
+ throw error;
18942
+ }
18943
+ async function listNotificationWebhooks(userId) {
18944
+ const db = createAdminDbClient();
18945
+ const { data, error } = await db.from("notification_webhooks").select("*").eq("user_id", userId).order("created_at", { ascending: false });
18946
+ if (error) {
18947
+ await handleRelationError("notification_webhooks", error);
18948
+ }
18949
+ if (!data) return [];
18950
+ return (Array.isArray(data) ? data : [data]).map(mapWebhookRecord);
18951
+ }
18952
+ async function notifyTaskEvent(payload) {
18953
+ if (!payload.userId) return;
18954
+ let endpoints = [];
18955
+ try {
18956
+ endpoints = await listNotificationWebhooks(payload.userId);
18957
+ } catch (error) {
18958
+ if (error instanceof SchemaNotReadyError) {
18959
+ console.debug("[notifications] notification_webhooks schema not ready, skipping");
18960
+ return;
18961
+ }
18962
+ console.error("[notifications] failed to load webhooks", error);
18963
+ return;
18964
+ }
18965
+ const targets = endpoints.filter(
18966
+ (endpoint) => endpoint.enabled && endpoint.events.includes(payload.eventType)
18967
+ );
18968
+ if (!targets.length) return;
18969
+ const timestamp = payload.timestamp || (/* @__PURE__ */ new Date()).toISOString();
18970
+ const body = {
18971
+ eventType: payload.eventType,
18972
+ taskId: payload.taskId,
18973
+ userId: payload.userId,
18974
+ title: payload.title || null,
18975
+ slug: payload.slug || null,
18976
+ stage: payload.stage || null,
18977
+ previousStage: payload.previousStage || null,
18978
+ nextStage: payload.nextStage || null,
18979
+ status: payload.status || null,
18980
+ error: payload.error || null,
18981
+ timestamp,
18982
+ details: payload.details || {}
18983
+ };
18984
+ await Promise.all(
18985
+ targets.map(async (endpoint) => {
18986
+ try {
18987
+ const response = await fetch(endpoint.url, {
18988
+ method: "POST",
18989
+ headers: { "Content-Type": "application/json" },
18990
+ body: JSON.stringify(body)
18991
+ });
18992
+ if (!response.ok) {
18993
+ console.error(
18994
+ `[notifications] webhook ${endpoint.url} responded with ${response.status}`
18995
+ );
18996
+ }
18997
+ } catch (error) {
18998
+ console.error(`[notifications] failed to send to ${endpoint.url}`, error);
18999
+ }
19000
+ })
19001
+ );
19002
+ }
19003
+
19004
+ // ../agx-cloud/lib/db.ts
19005
+ function isMissingRelationError2(error, relation) {
18877
19006
  if (!error) return false;
18878
19007
  const message = typeof error.message === "string" ? error.message : "";
18879
19008
  return error.code === "42P01" || error.code === "PGRST205" || message.includes(`relation "${relation}" does not exist`) || message.includes(`Could not find the table 'agx.${relation}'`) || message.includes(`Could not find the table 'public.${relation}'`);
@@ -19084,13 +19213,36 @@ async function updateTask(id, content, userId, options) {
19084
19213
  }
19085
19214
  await ensureTaskDependencyState(data, userId);
19086
19215
  const refreshed = await getTask(data.id, userId);
19087
- return refreshed || data;
19216
+ const taskRecord = refreshed || data;
19217
+ const resolvedUserId = userId || taskRecord.user_id;
19218
+ if (resolvedUserId) {
19219
+ const eventTimestamp = taskRecord.created_at || (/* @__PURE__ */ new Date()).toISOString();
19220
+ const details = {
19221
+ dependsOn: Array.isArray(taskRecord.depends_on) ? taskRecord.depends_on : [],
19222
+ project: taskRecord.project || null,
19223
+ projectId: taskRecord.project_id || null,
19224
+ workflowId: taskRecord.workflow_id || null,
19225
+ createdBy: taskRecord.created_by || null
19226
+ };
19227
+ void notifyTaskEvent({
19228
+ taskId: taskRecord.id,
19229
+ userId: resolvedUserId,
19230
+ eventType: "task.created",
19231
+ title: taskRecord.title || null,
19232
+ slug: taskRecord.slug || null,
19233
+ stage: taskRecord.stage || null,
19234
+ status: taskRecord.status || null,
19235
+ timestamp: eventTimestamp,
19236
+ details
19237
+ });
19238
+ }
19239
+ return taskRecord;
19088
19240
  }
19089
19241
  async function getWorkflowNodes(workflowId) {
19090
19242
  const db = createAdminDbClient();
19091
19243
  const { data, error } = await db.from("workflow_nodes").select("*").eq("workflow_id", workflowId).order("position", { ascending: true });
19092
19244
  if (error) {
19093
- if (isMissingRelationError(error, "workflow_nodes")) return [];
19245
+ if (isMissingRelationError2(error, "workflow_nodes")) return [];
19094
19246
  throw error;
19095
19247
  }
19096
19248
  return data || [];
@@ -19099,7 +19251,7 @@ async function getWorkflowNodeByName(workflowId, name) {
19099
19251
  const db = createAdminDbClient();
19100
19252
  const { data, error } = await db.from("workflow_nodes").select("*").eq("workflow_id", workflowId).eq("name", name).maybeSingle();
19101
19253
  if (error) {
19102
- if (isMissingRelationError(error, "workflow_nodes")) return null;
19254
+ if (isMissingRelationError2(error, "workflow_nodes")) return null;
19103
19255
  throw error;
19104
19256
  }
19105
19257
  return data;
@@ -19108,7 +19260,7 @@ async function getWorkflowTransitionsFromNode(workflowId, fromNodeId) {
19108
19260
  const db = createAdminDbClient();
19109
19261
  const { data, error } = await db.from("workflow_transitions").select("*").eq("workflow_id", workflowId).eq("from_node_id", fromNodeId).order("priority", { ascending: true });
19110
19262
  if (error) {
19111
- if (isMissingRelationError(error, "workflow_transitions")) return [];
19263
+ if (isMissingRelationError2(error, "workflow_transitions")) return [];
19112
19264
  throw error;
19113
19265
  }
19114
19266
  return data || [];
@@ -19135,6 +19287,24 @@ var DEFAULT_STAGE_SEQUENCE = [
19135
19287
  "done"
19136
19288
  ];
19137
19289
  var STANDARD_STAGE_SEQUENCES = [DEFAULT_STAGE_SEQUENCE];
19290
+ function normalizeTicketType(value) {
19291
+ if (typeof value !== "string") return "task";
19292
+ const normalized = value.trim().toLowerCase();
19293
+ if (normalized === "spike" || normalized === "spikes") return "spike";
19294
+ return "task";
19295
+ }
19296
+ function getTicketType(frontmatter, markdownBody) {
19297
+ const typeKeys = ["ticket_type", "type", "issue_type", "kind"];
19298
+ for (const key of typeKeys) {
19299
+ if (normalizeTicketType(frontmatter[key]) === "spike") return "spike";
19300
+ }
19301
+ const titleMatch = markdownBody.match(/^#\s+(.+)$/m);
19302
+ const title = titleMatch?.[1]?.trim().toLowerCase() || "";
19303
+ if (title.startsWith("spike:") || title.startsWith("[spike]")) {
19304
+ return "spike";
19305
+ }
19306
+ return "task";
19307
+ }
19138
19308
  function getNextStage(currentStage, ticketType) {
19139
19309
  if (ticketType === "spike") {
19140
19310
  if (currentStage === "ideation") return "planning";
@@ -19334,6 +19504,131 @@ ${stringifyFrontmatter(frontmatter)}
19334
19504
  ${body}`;
19335
19505
  }
19336
19506
 
19507
+ // ../agx-cloud/lib/dependency-manager.ts
19508
+ var READY_STATUS = "completed";
19509
+ function describeDependency2(dep) {
19510
+ return dep.title || dep.slug || dep.id || "(unknown)";
19511
+ }
19512
+ function summarizeRecord(record, id) {
19513
+ if (!record) {
19514
+ return { id: id || "" };
19515
+ }
19516
+ return {
19517
+ id: record.id || id || "",
19518
+ title: record.title || void 0,
19519
+ slug: record.slug || void 0,
19520
+ status: record.status,
19521
+ stage: record.stage
19522
+ };
19523
+ }
19524
+ async function fetchTasksByIds(ids, userId) {
19525
+ if (!ids.length) return [];
19526
+ const db = createAdminDbClient();
19527
+ let query = db.from("tasks").select("id, title, slug, status, stage").in("id", ids);
19528
+ if (userId) {
19529
+ query = query.eq("user_id", userId);
19530
+ }
19531
+ const { data } = await query;
19532
+ const map = /* @__PURE__ */ new Map();
19533
+ if (Array.isArray(data)) {
19534
+ for (const row of data) {
19535
+ if (row && row.id) {
19536
+ map.set(row.id, summarizeRecord(row, row.id));
19537
+ }
19538
+ }
19539
+ }
19540
+ return ids.map((id) => map.get(id) || { id });
19541
+ }
19542
+ function formatMissingDependencies(missing) {
19543
+ if (!missing.length) return "";
19544
+ const maxItems = 3;
19545
+ const entries = missing.slice(0, maxItems).map((dep) => {
19546
+ const label = describeDependency2(dep);
19547
+ const suffix = dep.status ? ` (${dep.status})` : "";
19548
+ return `${label}${suffix}`;
19549
+ });
19550
+ let message = `Waiting on dependencies: ${entries.join(", ")}`;
19551
+ if (missing.length > maxItems) {
19552
+ message += ` +${missing.length - maxItems} more`;
19553
+ }
19554
+ return message;
19555
+ }
19556
+ async function getMissingDependencies(task, userId) {
19557
+ const dependsOn = Array.isArray(task.depends_on) ? task.depends_on : [];
19558
+ if (!dependsOn.length) return [];
19559
+ const records = await fetchTasksByIds(dependsOn, userId);
19560
+ return records.filter((dep) => (dep.status || "") !== READY_STATUS);
19561
+ }
19562
+ async function attemptStartTask(taskId, userId, options) {
19563
+ const resolvedUserId = userId || LOCAL_USER.id;
19564
+ const task = await getTask(taskId, resolvedUserId);
19565
+ if (!task) {
19566
+ throw new Error(`Task not found: ${taskId}`);
19567
+ }
19568
+ const missingDependencies = await getMissingDependencies(task, resolvedUserId);
19569
+ if (missingDependencies.length) {
19570
+ const reason = formatMissingDependencies(missingDependencies);
19571
+ const adminDb2 = createAdminDbClient();
19572
+ const { error: error2 } = await adminDb2.from("tasks").update({
19573
+ status: "blocked",
19574
+ blocked_reason: reason,
19575
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
19576
+ }).eq("id", taskId);
19577
+ if (error2 && error2.code !== "42703") {
19578
+ throw error2;
19579
+ }
19580
+ return {
19581
+ started: false,
19582
+ missingDependencies,
19583
+ blockedReason: reason
19584
+ };
19585
+ }
19586
+ if (!options?.force && task.status === "queued" && !task.blocked_reason) {
19587
+ return {
19588
+ started: false,
19589
+ missingDependencies: [],
19590
+ alreadyQueued: true
19591
+ };
19592
+ }
19593
+ const { frontmatter, body } = parseFrontmatter(task.content || "");
19594
+ const ticketType = options?.ticketType ?? getTicketType(frontmatter, body);
19595
+ const boss2 = await getBoss();
19596
+ const jobId = await boss2.send(QUEUE_NAMES.TASK_PROCESS, {
19597
+ taskId,
19598
+ userId: resolvedUserId,
19599
+ signal: "start",
19600
+ ticketType
19601
+ });
19602
+ const adminDb = createAdminDbClient();
19603
+ const { error } = await adminDb.from("tasks").update({
19604
+ status: "queued",
19605
+ blocked_reason: null,
19606
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
19607
+ }).eq("id", taskId);
19608
+ if (error && error.code !== "42703") {
19609
+ throw error;
19610
+ }
19611
+ return {
19612
+ started: Boolean(jobId),
19613
+ jobId,
19614
+ missingDependencies: [],
19615
+ ticketType
19616
+ };
19617
+ }
19618
+ async function triggerDependentTasks(taskId, userId) {
19619
+ const resolvedUserId = userId || LOCAL_USER.id;
19620
+ const db = createAdminDbClient();
19621
+ let query = db.from("tasks").select("id").contains("depends_on", [taskId]);
19622
+ if (userId) {
19623
+ query = query.eq("user_id", userId);
19624
+ }
19625
+ const { data } = await query;
19626
+ if (!Array.isArray(data) || !data.length) return;
19627
+ await Promise.all(
19628
+ data.map((row) => row?.id).filter(Boolean).map((dependentId) => attemptStartTask(dependentId, resolvedUserId))
19629
+ );
19630
+ }
19631
+
19337
19632
  // ../agx-cloud/lib/orchestrator/activities.ts
19338
19633
  function isMissingStageDecisionsError(error) {
19339
19634
  if (!error || typeof error !== "object") return false;
@@ -19375,6 +19670,15 @@ async function applyStageTransitionActivity(input) {
19375
19670
  if (!task) {
19376
19671
  throw new Error(`Task ${input.taskId} not found`);
19377
19672
  }
19673
+ const previousStage = task.stage || null;
19674
+ const eventTimestamp = (/* @__PURE__ */ new Date()).toISOString();
19675
+ const baseNotification = {
19676
+ taskId: input.taskId,
19677
+ userId: input.userId,
19678
+ title: task.title || null,
19679
+ slug: task.slug || null,
19680
+ timestamp: eventTimestamp
19681
+ };
19378
19682
  const { frontmatter, body } = parseFrontmatter(task.content);
19379
19683
  frontmatter.stage = input.nextStage;
19380
19684
  frontmatter.status = input.nextStatus;
@@ -19395,6 +19699,43 @@ async function applyStageTransitionActivity(input) {
19395
19699
  }).eq("id", input.taskId).eq("user_id", input.userId);
19396
19700
  if (input.nextStatus === "completed") {
19397
19701
  await db.from("tasks").update({ completed_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", input.taskId).eq("user_id", input.userId);
19702
+ await triggerDependentTasks(input.taskId, input.userId);
19703
+ }
19704
+ const shouldEmitStageComplete = input.nextStatus !== "blocked" && input.nextStatus !== "failed";
19705
+ if (shouldEmitStageComplete) {
19706
+ void notifyTaskEvent({
19707
+ ...baseNotification,
19708
+ eventType: "task.stage_complete",
19709
+ stage: previousStage,
19710
+ previousStage,
19711
+ nextStage: input.nextStage,
19712
+ status: input.nextStatus,
19713
+ details: { nextStatus: input.nextStatus }
19714
+ });
19715
+ }
19716
+ if (input.nextStatus === "completed") {
19717
+ void notifyTaskEvent({
19718
+ ...baseNotification,
19719
+ eventType: "task.completed",
19720
+ stage: input.nextStage,
19721
+ status: input.nextStatus,
19722
+ details: {
19723
+ previousStage,
19724
+ nextStage: input.nextStage
19725
+ }
19726
+ });
19727
+ }
19728
+ if (input.nextStatus === "failed") {
19729
+ void notifyTaskEvent({
19730
+ ...baseNotification,
19731
+ eventType: "task.failed",
19732
+ stage: input.nextStage,
19733
+ status: input.nextStatus,
19734
+ error: input.error,
19735
+ details: {
19736
+ previousStage
19737
+ }
19738
+ });
19398
19739
  }
19399
19740
  }
19400
19741
  async function appendTaskLogActivity(input) {
@@ -19418,6 +19759,20 @@ async function markCancelledActivity(input) {
19418
19759
  error: input.reason || "Cancelled",
19419
19760
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
19420
19761
  }).eq("id", input.taskId).eq("user_id", input.userId);
19762
+ void notifyTaskEvent({
19763
+ taskId: input.taskId,
19764
+ userId: input.userId,
19765
+ eventType: "task.failed",
19766
+ title: task.title || null,
19767
+ slug: task.slug || null,
19768
+ stage: task.stage || null,
19769
+ status: "failed",
19770
+ error: input.reason || "Cancelled",
19771
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
19772
+ details: {
19773
+ previousStage: task.stage || null
19774
+ }
19775
+ });
19421
19776
  }
19422
19777
 
19423
19778
  // ../agx-cloud/lib/orchestrator/processor.ts
@@ -1,6 +1,8 @@
1
1
  /* eslint-disable no-console */
2
2
  'use strict';
3
3
 
4
+ const { interpolate, AGGREGATOR_PROMPT, EXECUTE_ITERATION, VERIFY_PROMPT } = require('../../prompts/templates');
5
+
4
6
  function createCloudPromptHelpers(env) {
5
7
  const { path, truncateForPrompt, VERIFY_PROMPT_MAX_CHARS } = env || {};
6
8
 
@@ -49,57 +51,20 @@ function createCloudPromptHelpers(env) {
49
51
  '- artifacts/ (additional artifacts, if any)',
50
52
  ].join('\n');
51
53
 
52
- return `You are the decision aggregator for a ${role} run.
53
-
54
- Task ID: ${taskId}
55
- Title: ${task?.title || taskId}
56
- Stage: ${task?.stage || 'unknown'}
57
-
58
- User Request:
59
- """
60
- ${task?.title}
61
- ${task?.content}
62
- ---
63
- Task Thread:
64
- ${taskComments.map(c => `${c.author}: ${c.content}`).join('\n')}
65
- """
66
-
67
- Stage Objective: ${stagePrompt}
68
- Stage Completion Requirement: ${stageRequirement}
69
-
70
- Local run artifacts folder: ${runRoot || '(not available)'}
71
- Key run files:
72
- ${runFiles}
73
-
74
- Relevant files referenced during execution (detected from output/logs):
75
- ${refsBlock}
76
-
77
- Decide if the task is done. If not, provide the next instruction for another iteration.
78
- Only set "done": true when the Stage Completion Requirement is satisfied.
79
-
80
- You may think through your analysis first, but you MUST end your response with valid JSON.
81
-
82
- Output contract (strict):
83
- - You may include thinking/reasoning at the start of your response
84
- - Your response MUST end with exactly one raw JSON object
85
- - Do not use markdown/code fences/backticks around the JSON
86
- - Do not add commentary after the JSON
87
- - Use double-quoted keys and strings
88
- - Keep newlines escaped inside strings
89
- - If "done" is false, "next_prompt" must be a non-empty actionable instruction
90
-
91
- The final JSON in your response must have this exact shape:
92
- {
93
- "done": false,
94
- "decision": "done|blocked|not_done|failed",
95
- "explanation": "clear explanation of the decision",
96
- "final_result": "final result if done, empty string otherwise",
97
- "next_prompt": "specific actionable instruction for next iteration",
98
- "summary": "brief summary of current state"
99
- }
100
-
101
- If uncertain, still return valid JSON with decision "failed" and explain why in "explanation".
102
- `;
54
+ return interpolate(AGGREGATOR_PROMPT, {
55
+ role,
56
+ taskId,
57
+ title: task?.title || taskId,
58
+ stage: task?.stage || 'unknown',
59
+ taskTitle: task?.title,
60
+ taskContent: task?.content,
61
+ taskComments: taskComments.map(c => `${c.author}: ${c.content}`).join('\n'),
62
+ stagePrompt,
63
+ stageRequirement,
64
+ runRoot: runRoot || '(not available)',
65
+ runFiles,
66
+ refsBlock,
67
+ });
103
68
  }
104
69
 
105
70
  function truncateForPromptLocal(text, maxChars) {
@@ -114,26 +79,10 @@ If uncertain, still return valid JSON with decision "failed" and explain why in
114
79
  ? nextPrompt.trim()
115
80
  : 'Pick the next concrete step and implement it.';
116
81
 
117
- return [
118
- 'EXECUTE PHASE',
119
- `Iteration: ${iteration}`,
120
- '',
121
- 'Keep output concise and avoid dumping full file contents or long logs.',
122
- 'If you need to reference code, cite paths and describe changes instead of pasting whole files.',
123
- '',
124
- 'Output contract:',
125
- '- Start with "PLAN:" then 2-5 bullets.',
126
- '- Do the work.',
127
- '- End with "IMPLEMENTATION SUMMARY:" bullets:',
128
- ' - Changed: (paths only, 10 max)',
129
- ' - Commands: (what you ran)',
130
- ' - Notes:',
131
- '',
132
- `Task for this iteration: ${instruction}`,
133
- '',
134
- 'Do not output JSON in this phase.',
135
- ''
136
- ].join('\n');
82
+ return interpolate(EXECUTE_ITERATION, {
83
+ iteration,
84
+ instruction,
85
+ });
137
86
  }
138
87
 
139
88
  function buildVerifyPrompt({ taskId, task, stagePrompt, stageRequirement, gitSummary, verifyResults, iteration, lastRunPath, agentOutput }) {
@@ -161,68 +110,21 @@ If uncertain, still return valid JSON with decision "failed" and explain why in
161
110
 
162
111
  const runRoot = lastRunPath ? String(lastRunPath) : '';
163
112
 
164
- const prompt = `You are the verifier for an agx run.
165
-
166
- Task ID: ${taskId}
167
- Title: ${title || taskId}
168
- Stage: ${task?.stage || 'unknown'}
169
- Iteration: ${iteration}
170
-
171
- Stage Objective: ${stagePrompt}
172
- Stage Completion Requirement: ${stageRequirement}
173
-
174
- Local run artifacts folder: ${runRoot || '(not available)'}
175
-
176
- User Request:
177
- """
178
- ${title}
179
- ${content}
180
- """
181
-
182
- Target state evidence:
183
- - Before reviewing git status or diff, first ask whether the target state already exists and fully satisfies the user request.
184
- - Check the agent output and verification command logs for evidence (files, folders, config values, summaries) that the desired outcome is already in place, even if the diff is empty.
185
- - If those signals show the target is already achieved and verification commands pass, treat the work as done without requiring new diffs; only rely on git status/diff when the target state is missing or unclear.
186
-
187
- Repo summary (git):
188
- Status (porcelain):
189
- ${statusShort || '(none)'}
190
-
191
- Diff (stat):
192
- ${diffShort || '(none)'}
193
-
194
- Verification commands:
195
- ${cmdLines}
196
-
197
- Agent output (last iteration):
198
- ${agentOutputShort || '(not available)'}
199
-
200
- Decide if the stage is complete. Use verification commands as evidence.
201
- Ignore unrelated working tree changes; focus on whether the user request is satisfied.
202
- If not complete, provide the next smallest instruction for another iteration.
203
- Set "done": true when the user request is satisfied and the evidence supports it. Treat the stage objective/requirement as guidance, not a keyword checklist.
204
-
205
- IMPORTANT: Before you look at the git status/diff, first ask whether the target state already exists and the user request is satisfied. Check the agent output and verification command logs for evidence (files, folders, config values, summaries) that the outcome is already in place, even if the diff is empty. Treat that as "target achieved" and you may mark the stage done without requiring new diffs. Use git status/diff only when the target state is missing or unclear and you need to verify what changed to reach it. If verification commands pass and the evidence shows the desired result already exists, mark the work done.
206
-
207
- Output contract (strict): your response MUST be exactly one raw JSON object with this shape:
208
- {
209
- "done": false,
210
- "decision": "done|blocked|not_done|failed",
211
- "explanation": "clear explanation of the decision",
212
- "final_result": "final result if done, empty string otherwise",
213
- "next_prompt": "specific actionable instruction for next iteration",
214
- "summary": "brief summary of current state",
215
- "plan_md": "PLAN markdown for this iteration (newlines escaped)",
216
- "implementation_summary_md": "IMPLEMENTATION SUMMARY markdown (newlines escaped)",
217
- "verification_md": "VERIFICATION markdown (newlines escaped)"
218
- }
219
-
220
- Rules:
221
- - Use double-quoted keys and strings.
222
- - Keep newlines escaped inside strings (use \\n).
223
- - Keep the markdown fields short and checklist-style.
224
- - Always fill "explanation". For "blocked", include what is blocking and what input/action would unblock. For "failed", include what failed (command/tool/error) and a recovery step.
225
- `;
113
+ const prompt = interpolate(VERIFY_PROMPT, {
114
+ taskId,
115
+ title: title || taskId,
116
+ stage: task?.stage || 'unknown',
117
+ iteration,
118
+ stagePrompt,
119
+ stageRequirement,
120
+ runRoot: runRoot || '(not available)',
121
+ requestTitle: title,
122
+ requestContent: content,
123
+ statusShort: statusShort || '(none)',
124
+ diffShort: diffShort || '(none)',
125
+ cmdLines,
126
+ agentOutputShort: agentOutputShort || '(not available)',
127
+ });
226
128
 
227
129
  return (typeof truncateForPrompt === 'function'
228
130
  ? truncateForPrompt(prompt, VERIFY_PROMPT_MAX_CHARS)