@mndrk/agx 1.4.60 → 1.4.62

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 (179) hide show
  1. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/BUILD_ID +1 -1
  2. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/app-build-manifest.json +86 -79
  3. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/app-path-routes-manifest.json +11 -10
  4. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/build-manifest.json +2 -2
  5. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/prerender-manifest.json +15 -15
  6. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/routes-manifest.json +8 -0
  7. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.html +2 -2
  9. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.rsc +1 -1
  10. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/audit/route_client-reference-manifest.js +1 -1
  11. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/[...nextauth]/route_client-reference-manifest.js +1 -1
  12. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/daemon-secret/route_client-reference-manifest.js +1 -1
  13. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/device/code/route_client-reference-manifest.js +1 -1
  14. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/device/token/route_client-reference-manifest.js +1 -1
  15. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/refresh/route_client-reference-manifest.js +1 -1
  16. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  17. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/domains/[id]/route_client-reference-manifest.js +1 -1
  18. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/domains/route_client-reference-manifest.js +1 -1
  19. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  20. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/learnings/route_client-reference-manifest.js +1 -1
  21. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/logs/stream/route_client-reference-manifest.js +1 -1
  22. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  23. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/signal/route_client-reference-manifest.js +1 -1
  24. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/start/route_client-reference-manifest.js +1 -1
  25. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/status/route_client-reference-manifest.js +1 -1
  26. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
  27. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  28. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  29. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/complete/route_client-reference-manifest.js +1 -1
  30. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/route_client-reference-manifest.js +1 -1
  31. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/stage-prompts/route_client-reference-manifest.js +1 -1
  32. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/[commentId]/route_client-reference-manifest.js +1 -1
  33. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/route_client-reference-manifest.js +1 -1
  34. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/costs/route_client-reference-manifest.js +1 -1
  35. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route.js +1 -1
  36. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route_client-reference-manifest.js +1 -1
  37. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/heartbeat/route_client-reference-manifest.js +1 -1
  38. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/history/route_client-reference-manifest.js +1 -1
  39. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/route_client-reference-manifest.js +1 -1
  40. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route.js +11 -0
  41. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route.js.nft.json +1 -0
  42. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route_client-reference-manifest.js +1 -0
  43. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/restart-stage/route_client-reference-manifest.js +1 -1
  44. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -1
  45. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route.js +1 -1
  46. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -1
  47. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/stream/route_client-reference-manifest.js +1 -1
  48. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/user-settings/route_client-reference-manifest.js +1 -1
  49. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/nodes/route_client-reference-manifest.js +1 -1
  50. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/[id]/route_client-reference-manifest.js +1 -1
  51. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  52. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/callback/route_client-reference-manifest.js +1 -1
  53. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device/page.js +4 -4
  54. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device/page_client-reference-manifest.js +1 -1
  55. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device.html +1 -1
  56. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/auth/device.rsc +2 -2
  57. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page.js +2 -2
  58. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page.js.nft.json +1 -1
  59. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  60. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard.html +2 -2
  61. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/dashboard.rsc +2 -2
  62. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.html +2 -2
  63. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.rsc +1 -1
  64. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login/page_client-reference-manifest.js +1 -1
  65. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login.html +2 -2
  66. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/login.rsc +1 -1
  67. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/page_client-reference-manifest.js +1 -1
  68. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page.js +2 -2
  69. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  70. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  71. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page.js +2 -2
  72. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page.js.nft.json +1 -1
  73. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/tasks/page_client-reference-manifest.js +1 -1
  74. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/workflow/page_client-reference-manifest.js +1 -1
  75. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  76. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.html +2 -2
  77. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.rsc +1 -1
  78. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  79. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.html +2 -2
  80. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.rsc +1 -1
  81. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app-paths-manifest.json +11 -10
  82. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/6317.js +3 -3
  83. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/7143.js +1 -1
  84. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/8666.js +23 -0
  85. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/functions-config-manifest.json +1 -0
  86. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/middleware-manifest.json +5 -5
  87. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/404.html +1 -1
  88. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/500.html +1 -1
  89. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages-manifest.json +1 -1
  90. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.js +1 -1
  91. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.json +1 -1
  92. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/8960-720130c8c9bf5b1c.js +1 -0
  93. 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
  94. 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
  95. 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
  96. 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
  97. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/device/token/route-bee7977512f30f17.js +1 -0
  98. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/refresh/route-bee7977512f30f17.js +1 -0
  99. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/status/route-bee7977512f30f17.js +1 -0
  100. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/[id]/route-bee7977512f30f17.js +1 -0
  101. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/route-bee7977512f30f17.js +1 -0
  102. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/health/route-bee7977512f30f17.js +1 -0
  103. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/learnings/route-bee7977512f30f17.js +1 -0
  104. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/logs/stream/route-bee7977512f30f17.js +1 -0
  105. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/cancel/route-bee7977512f30f17.js +1 -0
  106. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/signal/route-bee7977512f30f17.js +1 -0
  107. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/start/route-bee7977512f30f17.js +1 -0
  108. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/status/route-bee7977512f30f17.js +1 -0
  109. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/[id]/route-bee7977512f30f17.js +1 -0
  110. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/route-bee7977512f30f17.js +1 -0
  111. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/providers/route-bee7977512f30f17.js +1 -0
  112. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/complete/route-bee7977512f30f17.js +1 -0
  113. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/route-bee7977512f30f17.js +1 -0
  114. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/stage-prompts/route-bee7977512f30f17.js +1 -0
  115. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/[commentId]/route-bee7977512f30f17.js +1 -0
  116. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/route-bee7977512f30f17.js +1 -0
  117. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/costs/route-bee7977512f30f17.js +1 -0
  118. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/dependencies/route-bee7977512f30f17.js +1 -0
  119. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/heartbeat/route-bee7977512f30f17.js +1 -0
  120. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/history/route-bee7977512f30f17.js +1 -0
  121. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/route-bee7977512f30f17.js +1 -0
  122. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/stream/route-bee7977512f30f17.js +1 -0
  123. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/restart-stage/route-bee7977512f30f17.js +1 -0
  124. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/route-bee7977512f30f17.js +1 -0
  125. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/route-bee7977512f30f17.js +1 -0
  126. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/stream/route-bee7977512f30f17.js +1 -0
  127. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/user-settings/route-bee7977512f30f17.js +1 -0
  128. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/nodes/route-bee7977512f30f17.js +1 -0
  129. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/route-bee7977512f30f17.js +1 -0
  130. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/route-bee7977512f30f17.js +1 -0
  131. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/callback/route-bee7977512f30f17.js +1 -0
  132. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/device/{page-cd3ba0bfb22773fb.js → page-39c6907dc645eb6f.js} +1 -1
  133. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/dashboard/{page-ea6ccecbfa743b53.js → page-d35f0d29790d06ca.js} +1 -1
  134. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/{page-7357b68f3783a0b4.js → page-d097a2c0e0fc17cf.js} +1 -1
  135. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/projects/[slug]/tasks/{page-ec17b64371f48524.js → page-444e63f0464b1d40.js} +1 -1
  136. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/worker/index.js +356 -9
  137. package/lib/cli/runCli.js +132 -25
  138. package/lib/commands/templates.js +83 -0
  139. package/lib/notifications/webhooks.js +123 -0
  140. package/lib/templates.js +123 -0
  141. package/package.json +3 -2
  142. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/2298.js +0 -23
  143. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/2456-972d3e5278eb4a3a.js +0 -1
  144. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/device/token/route-04c3c3cacd67004b.js +0 -1
  145. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/refresh/route-04c3c3cacd67004b.js +0 -1
  146. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/auth/status/route-04c3c3cacd67004b.js +0 -1
  147. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/[id]/route-04c3c3cacd67004b.js +0 -1
  148. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/domains/route-04c3c3cacd67004b.js +0 -1
  149. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/health/route-04c3c3cacd67004b.js +0 -1
  150. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/learnings/route-04c3c3cacd67004b.js +0 -1
  151. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/logs/stream/route-04c3c3cacd67004b.js +0 -1
  152. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/cancel/route-04c3c3cacd67004b.js +0 -1
  153. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/signal/route-04c3c3cacd67004b.js +0 -1
  154. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/start/route-04c3c3cacd67004b.js +0 -1
  155. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/orchestrator/tasks/[taskId]/status/route-04c3c3cacd67004b.js +0 -1
  156. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/[id]/route-04c3c3cacd67004b.js +0 -1
  157. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/projects/route-04c3c3cacd67004b.js +0 -1
  158. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/providers/route-04c3c3cacd67004b.js +0 -1
  159. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/complete/route-04c3c3cacd67004b.js +0 -1
  160. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/queue/route-04c3c3cacd67004b.js +0 -1
  161. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/stage-prompts/route-04c3c3cacd67004b.js +0 -1
  162. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/[commentId]/route-04c3c3cacd67004b.js +0 -1
  163. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/comments/route-04c3c3cacd67004b.js +0 -1
  164. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/costs/route-04c3c3cacd67004b.js +0 -1
  165. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/dependencies/route-04c3c3cacd67004b.js +0 -1
  166. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/heartbeat/route-04c3c3cacd67004b.js +0 -1
  167. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/history/route-04c3c3cacd67004b.js +0 -1
  168. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/logs/route-04c3c3cacd67004b.js +0 -1
  169. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/restart-stage/route-04c3c3cacd67004b.js +0 -1
  170. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/[id]/route-04c3c3cacd67004b.js +0 -1
  171. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/route-04c3c3cacd67004b.js +0 -1
  172. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/tasks/stream/route-04c3c3cacd67004b.js +0 -1
  173. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/user-settings/route-04c3c3cacd67004b.js +0 -1
  174. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/nodes/route-04c3c3cacd67004b.js +0 -1
  175. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/[id]/route-04c3c3cacd67004b.js +0 -1
  176. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/api/workflows/route-04c3c3cacd67004b.js +0 -1
  177. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/app/auth/callback/route-04c3c3cacd67004b.js +0 -1
  178. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{m7Mclkg8JzCtUB7pFYMks → _knBrbKtV87NnpUclVMJo}/_buildManifest.js +0 -0
  179. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{m7Mclkg8JzCtUB7pFYMks → _knBrbKtV87NnpUclVMJo}/_ssgManifest.js +0 -0
package/lib/cli/runCli.js CHANGED
@@ -72,6 +72,7 @@ const { handleSkillCommand } = require('./skills');
72
72
  const { runOnboarding, showConfigStatus, runConfigMenu } = require('./onboarding');
73
73
  const { runInteractiveMenu } = require('./interactiveMenu');
74
74
  const cloudArtifacts = require('./cloudArtifacts');
75
+ const { sendWebhookEvent } = require('../notifications/webhooks');
75
76
  const fallbackExtractSection = (markdown, heading) => {
76
77
  if (!markdown) return '';
77
78
  const pattern = new RegExp(`^##\\s+${heading}\\s*$`, 'im');
@@ -100,6 +101,8 @@ const {
100
101
  } = require('./util');
101
102
  const { createCloudRunner } = require('./cloud');
102
103
  const daemon = require('./daemon');
104
+ const { loadTemplate, renderTemplateContent } = require('../templates');
105
+ const { slugify } = require('../storage/paths');
103
106
  const {
104
107
  DAEMON_PID_FILE,
105
108
  DAEMON_LOG_FILE,
@@ -1045,6 +1048,44 @@ async function checkOnboarding() {
1045
1048
  localArtifacts && lastRun ? `(Local run id: ${lastRun.run_id}, stage: ${lastRun.stage})` : '',
1046
1049
  ].filter(Boolean).join('\n'));
1047
1050
 
1051
+ const stageName = completionResult?.newStage
1052
+ || completionResult?.task?.stage
1053
+ || task?.stage
1054
+ || null;
1055
+ const statusRaw = completionResult?.task?.status ?? task?.status ?? null;
1056
+ const eventPayload = {
1057
+ taskId,
1058
+ taskSlug: task?.slug || null,
1059
+ projectSlug: task?.project_slug || task?.project?.slug || null,
1060
+ stage: stageName,
1061
+ stageLocal,
1062
+ status: statusRaw,
1063
+ decision: decisionPayload.decision,
1064
+ summary: decisionPayload.summary || null,
1065
+ final_result: decisionPayload.final_result || null,
1066
+ run_id: lastRun?.run_id || null,
1067
+ duration_ms: Date.now() - taskStart,
1068
+ };
1069
+ const emitWebhook = async (eventName) => {
1070
+ try {
1071
+ await sendWebhookEvent(eventName, eventPayload);
1072
+ } catch (err) {
1073
+ const message = err?.message || String(err);
1074
+ logger.log('error', `[daemon] webhook ${eventName} failed: ${message}\n`);
1075
+ }
1076
+ };
1077
+
1078
+ await emitWebhook('task.stage_complete');
1079
+ if (decisionPayload.decision === 'failed') {
1080
+ await emitWebhook('task.failed');
1081
+ } else if (decisionPayload.decision === 'blocked') {
1082
+ await emitWebhook('task.blocked');
1083
+ }
1084
+ const normalizedStatus = typeof statusRaw === 'string' ? statusRaw.trim().toLowerCase() : '';
1085
+ if (normalizedStatus === 'completed' || (decisionPayload.decision === 'done' && String(stageName || '').toLowerCase() === 'done')) {
1086
+ await emitWebhook('task.completed');
1087
+ }
1088
+
1048
1089
  {
1049
1090
  const detailRaw = String(decisionPayload.summary || decisionPayload.explanation || '').trim();
1050
1091
  const detail = detailRaw ? detailRaw.replace(/\s+/g, ' ').slice(0, 320) : '';
@@ -1185,29 +1226,29 @@ async function checkOnboarding() {
1185
1226
  // ============================================================
1186
1227
 
1187
1228
  // Provider aliases for convenience
1188
- const PROVIDER_ALIASES = {
1189
- 'c': 'claude', 'cl': 'claude', 'claude': 'claude',
1190
- 'x': 'codex', 'codex': 'codex',
1191
- 'g': 'gemini', 'gem': 'gemini', 'gemini': 'gemini',
1192
- 'o': 'ollama', 'ol': 'ollama', 'ollama': 'ollama'
1193
- };
1194
-
1195
- function collectFlagValues(args, flag) {
1196
- const values = [];
1197
- const consumedIndices = new Set();
1198
- for (let i = 0; i < args.length; i += 1) {
1199
- if (args[i] === flag) {
1200
- consumedIndices.add(i);
1201
- const next = args[i + 1];
1202
- if (typeof next === 'string' && next.length) {
1203
- values.push(next);
1204
- consumedIndices.add(i + 1);
1229
+ const PROVIDER_ALIASES = {
1230
+ 'c': 'claude', 'cl': 'claude', 'claude': 'claude',
1231
+ 'x': 'codex', 'codex': 'codex',
1232
+ 'g': 'gemini', 'gem': 'gemini', 'gemini': 'gemini',
1233
+ 'o': 'ollama', 'ol': 'ollama', 'ollama': 'ollama'
1234
+ };
1235
+
1236
+ function collectFlagValues(args, flag) {
1237
+ const values = [];
1238
+ const consumedIndices = new Set();
1239
+ for (let i = 0; i < args.length; i += 1) {
1240
+ if (args[i] === flag) {
1241
+ consumedIndices.add(i);
1242
+ const next = args[i + 1];
1243
+ if (typeof next === 'string' && next.length) {
1244
+ values.push(next);
1245
+ consumedIndices.add(i + 1);
1246
+ }
1247
+ i += 1;
1205
1248
  }
1206
- i += 1;
1207
1249
  }
1250
+ return { values, consumedIndices };
1208
1251
  }
1209
- return { values, consumedIndices };
1210
- }
1211
1252
 
1212
1253
  // ============================================================
1213
1254
  // LOCAL-FIRST CLI COMMANDS
@@ -1223,6 +1264,12 @@ function collectFlagValues(args, flag) {
1223
1264
  if (handled) return true;
1224
1265
  }
1225
1266
 
1267
+ {
1268
+ const { maybeHandleTemplateCommand } = require('../commands/templates');
1269
+ const handled = await maybeHandleTemplateCommand({ cmd, args, ctx: { c } });
1270
+ if (handled) return true;
1271
+ }
1272
+
1226
1273
  // Local-first command handlers live in lib/commands/local.js.
1227
1274
 
1228
1275
  // ============================================================
@@ -1250,6 +1297,7 @@ function collectFlagValues(args, flag) {
1250
1297
  process.exit(1);
1251
1298
  }
1252
1299
  }
1300
+ const providerArgProvided = provider !== null;
1253
1301
 
1254
1302
  // Parse --model / -m
1255
1303
  let model = null;
@@ -1257,6 +1305,7 @@ function collectFlagValues(args, flag) {
1257
1305
  if (modelIdx !== -1 && args[modelIdx + 1]) {
1258
1306
  model = args[modelIdx + 1];
1259
1307
  }
1308
+ const modelArgProvided = model !== null;
1260
1309
  let projectSlug = null;
1261
1310
  const projectIdx = args.findIndex(a => a === '--project');
1262
1311
  if (projectIdx !== -1 && args[projectIdx + 1]) {
@@ -1288,15 +1337,40 @@ function collectFlagValues(args, flag) {
1288
1337
  const resolvedType = normalizeTicketType(args[ticketTypeIdx + 1]);
1289
1338
  ticketType = resolvedType === 'spike' ? 'spike' : 'task';
1290
1339
  }
1340
+ let templateName = null;
1341
+ const templateIdx = args.findIndex(a => a === '--template');
1342
+ if (templateIdx !== -1 && args[templateIdx + 1]) {
1343
+ templateName = args[templateIdx + 1];
1344
+ }
1291
1345
 
1292
1346
  // Default provider from config
1293
1347
  if (!provider) {
1294
1348
  const config = loadConfig();
1295
1349
  provider = config?.defaultProvider || 'claude';
1296
1350
  }
1351
+ if (template) {
1352
+ if (!providerArgProvided && template.provider) {
1353
+ provider = template.provider;
1354
+ }
1355
+ if (!modelArgProvided && template.model) {
1356
+ model = template.model;
1357
+ }
1358
+ }
1297
1359
 
1298
1360
  // Extract goal text (filter out flags)
1299
- const flagsToRemove = ['--json', '--run', '-r', '--provider', '-P', '--model', '-m', '--project', '--type', '--ticket-type'];
1361
+ const flagsToRemove = [
1362
+ '--json',
1363
+ '--run',
1364
+ '-r',
1365
+ '--provider',
1366
+ '-P',
1367
+ '--model',
1368
+ '-m',
1369
+ '--project',
1370
+ '--type',
1371
+ '--ticket-type',
1372
+ '--template',
1373
+ ];
1300
1374
  const goalParts = [];
1301
1375
  for (let i = 1; i < args.length; i++) {
1302
1376
  if (dependsOnSkipIndices.has(i)) {
@@ -1307,11 +1381,12 @@ function collectFlagValues(args, flag) {
1307
1381
  if (args[i] === '--model' || args[i] === '-m') i++;
1308
1382
  if (args[i] === '--project') i++;
1309
1383
  if (args[i] === '--type' || args[i] === '--ticket-type') i++;
1384
+ if (args[i] === '--template') i++;
1310
1385
  continue;
1311
1386
  }
1312
1387
  goalParts.push(args[i]);
1313
1388
  }
1314
- const goalText = goalParts.join(' ');
1389
+ const goalText = goalParts.join(' ').trim();
1315
1390
 
1316
1391
  if (!goalText) {
1317
1392
  if (jsonMode) {
@@ -1322,6 +1397,21 @@ function collectFlagValues(args, flag) {
1322
1397
  process.exit(1);
1323
1398
  }
1324
1399
 
1400
+ let template = null;
1401
+ if (templateName) {
1402
+ try {
1403
+ template = await loadTemplate(templateName);
1404
+ } catch (err) {
1405
+ const message = err?.message || `Template "${templateName}" not found`;
1406
+ if (jsonMode) {
1407
+ console.log(JSON.stringify({ error: message }));
1408
+ } else {
1409
+ console.log(`${c.red}✗${c.reset} ${message}`);
1410
+ }
1411
+ process.exit(1);
1412
+ }
1413
+ }
1414
+
1325
1415
  try {
1326
1416
  let projectId = null;
1327
1417
  if (projectSlug) {
@@ -1348,8 +1438,25 @@ function collectFlagValues(args, flag) {
1348
1438
  if (projectId) frontmatter.push(`project_id: ${projectId}`);
1349
1439
  if (model) frontmatter.push(`model: ${model}`);
1350
1440
  if (ticketType) frontmatter.push(`type: ${ticketType}`);
1351
-
1352
- const content = `---\n${frontmatter.join('\n')}\n---\n\n# ${goalText}\n`;
1441
+ if (template) frontmatter.push(`template: ${template.slug}`);
1442
+
1443
+ let bodyContent = `# ${goalText}\n`;
1444
+ if (template) {
1445
+ const rendered = renderTemplateContent(template.content, {
1446
+ title: goalText,
1447
+ goal: goalText,
1448
+ slug: slugify(goalText, { maxLength: 64 }),
1449
+ project: projectSlug || '',
1450
+ template: template.slug,
1451
+ });
1452
+ if (rendered && rendered.trim()) {
1453
+ bodyContent = rendered;
1454
+ }
1455
+ }
1456
+ if (!bodyContent.endsWith('\n')) {
1457
+ bodyContent += '\n';
1458
+ }
1459
+ const content = `---\n${frontmatter.join('\n')}\n---\n\n${bodyContent}`;
1353
1460
 
1354
1461
  const payload = { content };
1355
1462
  if (dependsOnValues.length) {
@@ -2330,7 +2437,7 @@ function collectFlagValues(args, flag) {
2330
2437
  if (config?.token) {
2331
2438
  esOptions.headers = { Authorization: `Bearer ${config.token}` };
2332
2439
  }
2333
- const streamUrl = `${config.apiUrl}/api/logs/stream?taskId=${encodeURIComponent(taskId)}`;
2440
+ const streamUrl = `${config.apiUrl}/api/tasks/${encodeURIComponent(taskId)}/logs/stream`;
2334
2441
  const es = new EventSource(streamUrl, esOptions);
2335
2442
 
2336
2443
  es.onmessage = (event) => {
@@ -0,0 +1,83 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { listTemplates, createTemplate, getTemplatesDir } = require('../templates');
6
+
7
+ function getFlagValue(args, flag) {
8
+ const idx = args.findIndex(a => a === flag);
9
+ if (idx === -1) return null;
10
+ return args[idx + 1] || null;
11
+ }
12
+
13
+ async function maybeHandleTemplateCommand({ cmd, args, ctx }) {
14
+ if (cmd !== 'templates') {
15
+ return false;
16
+ }
17
+ const { c } = ctx || {};
18
+ const subcommand = args[1];
19
+
20
+ switch (subcommand) {
21
+ case 'list':
22
+ case 'ls': {
23
+ const templates = await listTemplates();
24
+ if (args.includes('--json')) {
25
+ console.log(JSON.stringify({ templates }));
26
+ process.exit(0);
27
+ }
28
+ console.log(`${c?.bold || ''}Templates (${templates.length})${c?.reset || ''}`);
29
+ console.log(`Directory: ${getTemplatesDir()}`);
30
+ if (!templates.length) {
31
+ console.log(' No templates found. Use `agx templates create <name>` to add one.');
32
+ process.exit(0);
33
+ }
34
+ console.log('');
35
+ for (const template of templates) {
36
+ const info = [];
37
+ if (template.description) info.push(template.description);
38
+ if (template.provider) info.push(`provider=${template.provider}`);
39
+ if (template.model) info.push(`model=${template.model}`);
40
+ const displayName = template.name === template.slug
41
+ ? template.slug
42
+ : `${template.name} (${template.slug})`;
43
+ console.log(` ${displayName}${info.length ? ` (${info.join(', ')})` : ''}`);
44
+ }
45
+ process.exit(0);
46
+ }
47
+ case 'create': {
48
+ const name = args[2];
49
+ if (!name) {
50
+ console.log('Usage: agx templates create <name> [--description "desc"] [--provider claude] [--model claude-sonnet-4-5] [--content-file ./template.md]');
51
+ process.exit(1);
52
+ }
53
+
54
+ const description = getFlagValue(args, '--description');
55
+ const provider = getFlagValue(args, '--provider');
56
+ const model = getFlagValue(args, '--model');
57
+ const contentInline = getFlagValue(args, '--content');
58
+ const contentFile = getFlagValue(args, '--content-file');
59
+ let content = contentInline;
60
+ if (!content && contentFile) {
61
+ try {
62
+ content = await fs.promises.readFile(path.resolve(contentFile), 'utf8');
63
+ } catch (err) {
64
+ console.log(`${c?.red || ''}Error:${c?.reset || ''} Could not read content file: ${err.message}`);
65
+ process.exit(1);
66
+ }
67
+ }
68
+
69
+ const created = await createTemplate({ name, description, provider, model, content });
70
+ console.log(`${c?.green || ''}✓${c?.reset || ''} Template created: ${created.slug}`);
71
+ console.log(` Path: ${created.file}`);
72
+ process.exit(0);
73
+ }
74
+ default:
75
+ console.log(`Template Commands:
76
+ agx templates list List available templates
77
+ agx templates create <name> Scaffold a new template file (options: --description, --provider, --model, --content-file)
78
+ `);
79
+ process.exit(0);
80
+ }
81
+ }
82
+
83
+ module.exports = { maybeHandleTemplateCommand };
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ const { loadConfig } = require('../cli/configStore');
4
+
5
+ const SUPPORTED_EVENTS = Object.freeze([
6
+ 'task.created',
7
+ 'task.stage_complete',
8
+ 'task.completed',
9
+ 'task.failed',
10
+ 'task.blocked',
11
+ ]);
12
+
13
+ const WILDCARD_EVENT = '*';
14
+
15
+ function normalizeEventName(value) {
16
+ if (!value && value !== 0) return '';
17
+ const candidate = String(value || '').trim().toLowerCase();
18
+ if (!candidate) return '';
19
+ if (candidate === WILDCARD_EVENT) return WILDCARD_EVENT;
20
+ if (candidate.endsWith('.*')) {
21
+ return candidate;
22
+ }
23
+ return SUPPORTED_EVENTS.includes(candidate) ? candidate : '';
24
+ }
25
+
26
+ function normalizeEventsInput(value) {
27
+ if (value === undefined || value === null) {
28
+ return [WILDCARD_EVENT];
29
+ }
30
+ const parts = [];
31
+ if (Array.isArray(value)) {
32
+ for (const item of value) {
33
+ const normalized = normalizeEventName(item);
34
+ if (normalized) parts.push(normalized);
35
+ }
36
+ } else if (typeof value === 'string') {
37
+ for (const item of value.split(',')) {
38
+ const normalized = normalizeEventName(item);
39
+ if (normalized) parts.push(normalized);
40
+ }
41
+ }
42
+ if (parts.length === 0) {
43
+ return [WILDCARD_EVENT];
44
+ }
45
+ return Array.from(new Set(parts));
46
+ }
47
+
48
+ function normalizeWebhookEntry(entry) {
49
+ if (!entry || typeof entry !== 'object') return null;
50
+ const url = typeof entry.url === 'string' ? entry.url.trim() : '';
51
+ if (!url) return null;
52
+ const events = normalizeEventsInput(entry.events);
53
+ if (!events.length) return null;
54
+ return { url, events };
55
+ }
56
+
57
+ function parseWebhookEntries(config) {
58
+ const source = config ?? loadConfig();
59
+ if (!source || !Array.isArray(source.webhooks)) return [];
60
+ return source.webhooks
61
+ .map(normalizeWebhookEntry)
62
+ .filter((entry) => entry !== null);
63
+ }
64
+
65
+ function eventMatches(entry, eventName) {
66
+ if (!entry || !eventName) return false;
67
+ const normalized = String(eventName).trim().toLowerCase();
68
+ if (!normalized) return false;
69
+ if (!Array.isArray(entry.events)) return false;
70
+ if (entry.events.includes(WILDCARD_EVENT)) return true;
71
+ if (entry.events.includes(normalized)) return true;
72
+ return entry.events.some((event) => event.endsWith('.*') && normalized.startsWith(event.slice(0, -1)));
73
+ }
74
+
75
+ async function sendWebhookEvent(eventName, payload = null, options = {}) {
76
+ const normalizedEvent = normalizeEventName(eventName);
77
+ if (!normalizedEvent) return [];
78
+
79
+ const entries = Array.isArray(options.webhooks)
80
+ ? options.webhooks
81
+ : parseWebhookEntries(options.config);
82
+
83
+ if (!entries.length) return [];
84
+
85
+ const matches = entries.filter((entry) => eventMatches(entry, normalizedEvent));
86
+ if (!matches.length) return [];
87
+
88
+ const fetchFn = options.fetch ?? globalThis.fetch;
89
+ if (typeof fetchFn !== 'function') return matches;
90
+
91
+ const timestamp = options.timestamp || new Date().toISOString();
92
+ const body = JSON.stringify({ event: normalizedEvent, timestamp, payload });
93
+ const logger = options.logger || console;
94
+
95
+ const results = await Promise.allSettled(
96
+ matches.map((match) => fetchFn(match.url, {
97
+ method: 'POST',
98
+ headers: {
99
+ 'Content-Type': 'application/json',
100
+ 'X-AGX-Event': normalizedEvent,
101
+ },
102
+ body,
103
+ }))
104
+ );
105
+
106
+ results.forEach((result, index) => {
107
+ if (result.status === 'rejected') {
108
+ if (logger && typeof logger.error === 'function') {
109
+ logger.error(`Webhook failed (${matches[index].url}): ${String(result.reason)}`);
110
+ }
111
+ }
112
+ });
113
+
114
+ return matches;
115
+ }
116
+
117
+ module.exports = {
118
+ SUPPORTED_EVENTS,
119
+ normalizeWebhookEntry,
120
+ parseWebhookEntries,
121
+ eventMatches,
122
+ sendWebhookEvent,
123
+ };
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const yaml = require('yaml');
6
+ const { CONFIG_DIR } = require('./config/paths');
7
+ const { slugify } = require('./storage/paths');
8
+
9
+ const TEMPLATES_DIR = path.join(CONFIG_DIR, 'templates');
10
+ const TEMPLATE_EXTENSIONS = ['.yaml', '.yml'];
11
+
12
+ function getTemplatesDir() {
13
+ return TEMPLATES_DIR;
14
+ }
15
+
16
+ async function ensureTemplatesDir() {
17
+ await fs.promises.mkdir(TEMPLATES_DIR, { recursive: true });
18
+ }
19
+
20
+ function normalizeTemplateSlug(name) {
21
+ if (!name || typeof name !== 'string') {
22
+ throw new Error('Template name is required');
23
+ }
24
+ const slug = slugify(name, { maxLength: 64 });
25
+ if (!slug) {
26
+ throw new Error('Template name must contain letters or numbers');
27
+ }
28
+ return slug;
29
+ }
30
+
31
+ function templateFilePath(slug) {
32
+ return path.join(TEMPLATES_DIR, `${slug}.yaml`);
33
+ }
34
+
35
+ async function readTemplateFile(filePath) {
36
+ const raw = await fs.promises.readFile(filePath, 'utf8');
37
+ const parsed = yaml.parse(raw) || {};
38
+ return parsed;
39
+ }
40
+
41
+ function normalizeTemplateObject(slug, raw) {
42
+ return {
43
+ slug,
44
+ name: raw.name || slug,
45
+ description: raw.description || '',
46
+ provider: raw.provider || null,
47
+ model: raw.model || null,
48
+ content: typeof raw.content === 'string' ? raw.content : '',
49
+ file: templateFilePath(slug),
50
+ };
51
+ }
52
+
53
+ async function createTemplate({ name, description = '', provider = '', model = '', content = '' }) {
54
+ const slug = normalizeTemplateSlug(name);
55
+ await ensureTemplatesDir();
56
+ const filePath = templateFilePath(slug);
57
+ if (fs.existsSync(filePath)) {
58
+ throw new Error(`Template "${slug}" already exists`);
59
+ }
60
+
61
+ const displayName = typeof name === 'string' && name.trim()
62
+ ? name.trim()
63
+ : slug;
64
+ const payload = {
65
+ name: displayName,
66
+ description: description || `Template ${displayName}`,
67
+ provider: provider || undefined,
68
+ model: model || undefined,
69
+ content: content || '# {{title}}\n\nDescribe the workflow here.\n',
70
+ };
71
+
72
+ const serialized = yaml.stringify(payload).trim() + '\n';
73
+ await fs.promises.writeFile(filePath, serialized, 'utf8');
74
+ return { slug, file: filePath };
75
+ }
76
+
77
+ async function listTemplates() {
78
+ await ensureTemplatesDir();
79
+ const entries = await fs.promises.readdir(TEMPLATES_DIR, { withFileTypes: true });
80
+ const templates = [];
81
+ for (const entry of entries) {
82
+ if (!entry.isFile()) continue;
83
+ const ext = path.extname(entry.name).toLowerCase();
84
+ if (!TEMPLATE_EXTENSIONS.includes(ext)) continue;
85
+ const slug = normalizeTemplateSlug(path.basename(entry.name, ext));
86
+ try {
87
+ const data = await readTemplateFile(path.join(TEMPLATES_DIR, entry.name));
88
+ templates.push(normalizeTemplateObject(slug, data));
89
+ } catch (err) {
90
+ // skip invalid templates
91
+ }
92
+ }
93
+
94
+ return templates.sort((a, b) => a.name.localeCompare(b.name));
95
+ }
96
+
97
+ async function loadTemplate(name) {
98
+ const slug = normalizeTemplateSlug(name);
99
+ const filePath = templateFilePath(slug);
100
+ if (!fs.existsSync(filePath)) {
101
+ throw new Error(`Template "${slug}" not found`);
102
+ }
103
+ const raw = await readTemplateFile(filePath);
104
+ return normalizeTemplateObject(slug, raw);
105
+ }
106
+
107
+ function renderTemplateContent(content, context = {}) {
108
+ if (!content || typeof content !== 'string') return '';
109
+ return content.replace(/{{\s*([a-zA-Z0-9_.-]+)\s*}}/g, (match, key) => {
110
+ const value = context && typeof context === 'object' ? context[key] : undefined;
111
+ if (value === undefined || value === null) return '';
112
+ return String(value);
113
+ });
114
+ }
115
+
116
+ module.exports = {
117
+ getTemplatesDir,
118
+ createTemplate,
119
+ listTemplates,
120
+ loadTemplate,
121
+ renderTemplateContent,
122
+ ensureTemplatesDir,
123
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mndrk/agx",
3
- "version": "1.4.60",
3
+ "version": "1.4.62",
4
4
  "description": "Autonomous AI Agent Orchestrator for Claude, Gemini, and Ollama",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -50,7 +50,8 @@
50
50
  "execa": "^5.1.1",
51
51
  "p-map": "^7.0.4",
52
52
  "p-retry": "^7.1.1",
53
- "posthog-node": "^5.24.15"
53
+ "posthog-node": "^4.18.0",
54
+ "yaml": "^2.8.2"
54
55
  },
55
56
  "devDependencies": {
56
57
  "esbuild": "^0.25.0",