@jiggai/kitchen 0.3.11 → 0.3.13

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 (299) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/_global-error.html +2 -2
  5. package/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/server/app/_not-found/page.js +1 -1
  12. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  13. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +1 -1
  15. package/.next/server/app/_not-found.rsc +3 -3
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  17. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  22. package/.next/server/app/agents/[agentId]/page.js +1 -1
  23. package/.next/server/app/agents/[agentId]/page.js.nft.json +1 -1
  24. package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/agents/add/route.js.nft.json +1 -1
  26. package/.next/server/app/api/agents/file/route.js.nft.json +1 -1
  27. package/.next/server/app/api/agents/files/route.js.nft.json +1 -1
  28. package/.next/server/app/api/agents/skills/install/route.js.nft.json +1 -1
  29. package/.next/server/app/api/agents/skills/route.js.nft.json +1 -1
  30. package/.next/server/app/api/agents/update/route.js.nft.json +1 -1
  31. package/.next/server/app/api/cron/delete/route.js.nft.json +1 -1
  32. package/.next/server/app/api/cron/jobs/route.js.nft.json +1 -1
  33. package/.next/server/app/api/cron/recipe-installed/route.js.nft.json +1 -1
  34. package/.next/server/app/api/cron/worker/route.js.nft.json +1 -1
  35. package/.next/server/app/api/goals/[id]/promote/route.js.nft.json +1 -1
  36. package/.next/server/app/api/goals/[id]/route.js.nft.json +1 -1
  37. package/.next/server/app/api/goals/route.js.nft.json +1 -1
  38. package/.next/server/app/api/ids/check/route.js.nft.json +1 -1
  39. package/.next/server/app/api/recipes/[id]/route.js.nft.json +1 -1
  40. package/.next/server/app/api/recipes/clone/route.js.nft.json +1 -1
  41. package/.next/server/app/api/recipes/custom-team/route.js.nft.json +1 -1
  42. package/.next/server/app/api/recipes/delete/route.js.nft.json +1 -1
  43. package/.next/server/app/api/recipes/local-agent-catalog/route.js.nft.json +1 -1
  44. package/.next/server/app/api/recipes/team-agents/route.js.nft.json +1 -1
  45. package/.next/server/app/api/scaffold/route.js.nft.json +1 -1
  46. package/.next/server/app/api/settings/cron-installation/route.js.nft.json +1 -1
  47. package/.next/server/app/api/teams/[teamId]/tickets/assign/route.js.nft.json +1 -1
  48. package/.next/server/app/api/teams/[teamId]/tickets/assignees/route.js.nft.json +1 -1
  49. package/.next/server/app/api/teams/[teamId]/tickets/comment/route.js.nft.json +1 -1
  50. package/.next/server/app/api/teams/[teamId]/tickets/delete/route.js.nft.json +1 -1
  51. package/.next/server/app/api/teams/[teamId]/tickets/move/route.js.nft.json +1 -1
  52. package/.next/server/app/api/teams/[teamId]/tickets/move-to-goals/route.js.nft.json +1 -1
  53. package/.next/server/app/api/teams/file/route.js.nft.json +1 -1
  54. package/.next/server/app/api/teams/files/route.js.nft.json +1 -1
  55. package/.next/server/app/api/teams/memory/route.js.nft.json +1 -1
  56. package/.next/server/app/api/teams/meta/route.js.nft.json +1 -1
  57. package/.next/server/app/api/teams/orchestrator/route.js.nft.json +1 -1
  58. package/.next/server/app/api/teams/remove-team/route.js.nft.json +1 -1
  59. package/.next/server/app/api/teams/skills/install/route.js.nft.json +1 -1
  60. package/.next/server/app/api/teams/skills/route.js.nft.json +1 -1
  61. package/.next/server/app/api/teams/workflow-runs/route.js.nft.json +1 -1
  62. package/.next/server/app/api/teams/workflow-templates/route.js.nft.json +1 -1
  63. package/.next/server/app/api/teams/workflows/route.js.nft.json +1 -1
  64. package/.next/server/app/api/tickets/assign/route.js.nft.json +1 -1
  65. package/.next/server/app/api/tickets/assignees/route.js.nft.json +1 -1
  66. package/.next/server/app/api/tickets/move/route.js.nft.json +1 -1
  67. package/.next/server/app/channels/page.js +1 -1
  68. package/.next/server/app/channels/page.js.nft.json +1 -1
  69. package/.next/server/app/channels/page_client-reference-manifest.js +1 -1
  70. package/.next/server/app/channels.html +2 -2
  71. package/.next/server/app/channels.rsc +4 -4
  72. package/.next/server/app/channels.segments/_full.segment.rsc +4 -4
  73. package/.next/server/app/channels.segments/_head.segment.rsc +1 -1
  74. package/.next/server/app/channels.segments/_index.segment.rsc +2 -2
  75. package/.next/server/app/channels.segments/_tree.segment.rsc +1 -1
  76. package/.next/server/app/channels.segments/channels/__PAGE__.segment.rsc +2 -2
  77. package/.next/server/app/channels.segments/channels.segment.rsc +1 -1
  78. package/.next/server/app/cron-jobs/page.js +1 -1
  79. package/.next/server/app/cron-jobs/page.js.nft.json +1 -1
  80. package/.next/server/app/cron-jobs/page_client-reference-manifest.js +1 -1
  81. package/.next/server/app/goals/[id]/page.js +1 -1
  82. package/.next/server/app/goals/[id]/page.js.nft.json +1 -1
  83. package/.next/server/app/goals/[id]/page_client-reference-manifest.js +1 -1
  84. package/.next/server/app/goals/new/page.js +1 -1
  85. package/.next/server/app/goals/new/page.js.nft.json +1 -1
  86. package/.next/server/app/goals/new/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/goals/new.html +2 -2
  88. package/.next/server/app/goals/new.rsc +4 -4
  89. package/.next/server/app/goals/new.segments/_full.segment.rsc +4 -4
  90. package/.next/server/app/goals/new.segments/_head.segment.rsc +1 -1
  91. package/.next/server/app/goals/new.segments/_index.segment.rsc +2 -2
  92. package/.next/server/app/goals/new.segments/_tree.segment.rsc +1 -1
  93. package/.next/server/app/goals/new.segments/goals/new/__PAGE__.segment.rsc +2 -2
  94. package/.next/server/app/goals/new.segments/goals/new.segment.rsc +1 -1
  95. package/.next/server/app/goals/new.segments/goals.segment.rsc +1 -1
  96. package/.next/server/app/goals/page.js +1 -1
  97. package/.next/server/app/goals/page.js.nft.json +1 -1
  98. package/.next/server/app/goals/page_client-reference-manifest.js +1 -1
  99. package/.next/server/app/goals.html +1 -1
  100. package/.next/server/app/goals.rsc +4 -4
  101. package/.next/server/app/goals.segments/_full.segment.rsc +4 -4
  102. package/.next/server/app/goals.segments/_head.segment.rsc +1 -1
  103. package/.next/server/app/goals.segments/_index.segment.rsc +2 -2
  104. package/.next/server/app/goals.segments/_tree.segment.rsc +1 -1
  105. package/.next/server/app/goals.segments/goals/__PAGE__.segment.rsc +2 -2
  106. package/.next/server/app/goals.segments/goals.segment.rsc +1 -1
  107. package/.next/server/app/page.js +3 -3
  108. package/.next/server/app/page.js.nft.json +1 -1
  109. package/.next/server/app/page_client-reference-manifest.js +1 -1
  110. package/.next/server/app/recipes/[id]/page.js +3 -3
  111. package/.next/server/app/recipes/[id]/page.js.nft.json +1 -1
  112. package/.next/server/app/recipes/[id]/page_client-reference-manifest.js +1 -1
  113. package/.next/server/app/recipes/page.js +1 -1
  114. package/.next/server/app/recipes/page.js.nft.json +1 -1
  115. package/.next/server/app/recipes/page_client-reference-manifest.js +1 -1
  116. package/.next/server/app/runs/page.js +2 -2
  117. package/.next/server/app/runs/page.js.nft.json +1 -1
  118. package/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  119. package/.next/server/app/settings/page.js +1 -1
  120. package/.next/server/app/settings/page.js.nft.json +1 -1
  121. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  122. package/.next/server/app/settings.html +1 -1
  123. package/.next/server/app/settings.rsc +4 -4
  124. package/.next/server/app/settings.segments/_full.segment.rsc +4 -4
  125. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  126. package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  127. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  128. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
  129. package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  130. package/.next/server/app/teams/[teamId]/page.js +3 -3
  131. package/.next/server/app/teams/[teamId]/page.js.nft.json +1 -1
  132. package/.next/server/app/teams/[teamId]/page_client-reference-manifest.js +1 -1
  133. package/.next/server/app/teams/[teamId]/runs/[workflowId]/[runId]/page.js +2 -2
  134. package/.next/server/app/teams/[teamId]/runs/[workflowId]/[runId]/page.js.nft.json +1 -1
  135. package/.next/server/app/teams/[teamId]/runs/[workflowId]/[runId]/page_client-reference-manifest.js +1 -1
  136. package/.next/server/app/teams/[teamId]/runs/page.js +1 -1
  137. package/.next/server/app/teams/[teamId]/runs/page.js.nft.json +1 -1
  138. package/.next/server/app/teams/[teamId]/runs/page_client-reference-manifest.js +1 -1
  139. package/.next/server/app/teams/[teamId]/tickets/[ticket]/page.js +1 -1
  140. package/.next/server/app/teams/[teamId]/tickets/[ticket]/page.js.nft.json +1 -1
  141. package/.next/server/app/teams/[teamId]/tickets/[ticket]/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/teams/[teamId]/tickets/page.js +2 -2
  143. package/.next/server/app/teams/[teamId]/tickets/page.js.nft.json +1 -1
  144. package/.next/server/app/teams/[teamId]/tickets/page_client-reference-manifest.js +1 -1
  145. package/.next/server/app/teams/[teamId]/workflows/[workflowId]/page.js +1 -1
  146. package/.next/server/app/teams/[teamId]/workflows/[workflowId]/page.js.nft.json +1 -1
  147. package/.next/server/app/teams/[teamId]/workflows/[workflowId]/page_client-reference-manifest.js +1 -1
  148. package/.next/server/app/teams/[teamId]/workflows/page.js +3 -3
  149. package/.next/server/app/teams/[teamId]/workflows/page.js.nft.json +1 -1
  150. package/.next/server/app/teams/[teamId]/workflows/page_client-reference-manifest.js +1 -1
  151. package/.next/server/app/tickets/[ticket]/page.js +1 -1
  152. package/.next/server/app/tickets/[ticket]/page.js.nft.json +1 -1
  153. package/.next/server/app/tickets/[ticket]/page_client-reference-manifest.js +1 -1
  154. package/.next/server/app/tickets/page.js +2 -2
  155. package/.next/server/app/tickets/page.js.nft.json +1 -1
  156. package/.next/server/app/tickets/page_client-reference-manifest.js +1 -1
  157. package/.next/server/chunks/[root-of-the-server]__01863a8b._.js +1 -1
  158. package/.next/server/chunks/[root-of-the-server]__01863a8b._.js.map +1 -1
  159. package/.next/server/chunks/[root-of-the-server]__04f289da._.js +1 -1
  160. package/.next/server/chunks/[root-of-the-server]__04f289da._.js.map +1 -1
  161. package/.next/server/chunks/[root-of-the-server]__05f5e243._.js +1 -1
  162. package/.next/server/chunks/[root-of-the-server]__05f5e243._.js.map +1 -1
  163. package/.next/server/chunks/[root-of-the-server]__0c4fc3d3._.js +1 -1
  164. package/.next/server/chunks/[root-of-the-server]__0c4fc3d3._.js.map +1 -1
  165. package/.next/server/chunks/[root-of-the-server]__1311d7a3._.js +1 -1
  166. package/.next/server/chunks/[root-of-the-server]__1311d7a3._.js.map +1 -1
  167. package/.next/server/chunks/[root-of-the-server]__1c6c2e43._.js +1 -1
  168. package/.next/server/chunks/[root-of-the-server]__1c6c2e43._.js.map +1 -1
  169. package/.next/server/chunks/[root-of-the-server]__3cfdf0b3._.js +2 -2
  170. package/.next/server/chunks/[root-of-the-server]__3cfdf0b3._.js.map +1 -1
  171. package/.next/server/chunks/[root-of-the-server]__3fdbc43e._.js +1 -1
  172. package/.next/server/chunks/[root-of-the-server]__3fdbc43e._.js.map +1 -1
  173. package/.next/server/chunks/[root-of-the-server]__453333f5._.js +1 -1
  174. package/.next/server/chunks/[root-of-the-server]__453333f5._.js.map +1 -1
  175. package/.next/server/chunks/[root-of-the-server]__47eb3111._.js +1 -1
  176. package/.next/server/chunks/[root-of-the-server]__47eb3111._.js.map +1 -1
  177. package/.next/server/chunks/[root-of-the-server]__502825d0._.js +2 -2
  178. package/.next/server/chunks/[root-of-the-server]__502825d0._.js.map +1 -1
  179. package/.next/server/chunks/[root-of-the-server]__50fe6ff8._.js +1 -1
  180. package/.next/server/chunks/[root-of-the-server]__50fe6ff8._.js.map +1 -1
  181. package/.next/server/chunks/[root-of-the-server]__51198e25._.js +1 -1
  182. package/.next/server/chunks/[root-of-the-server]__51198e25._.js.map +1 -1
  183. package/.next/server/chunks/[root-of-the-server]__542a081b._.js +1 -1
  184. package/.next/server/chunks/[root-of-the-server]__542a081b._.js.map +1 -1
  185. package/.next/server/chunks/[root-of-the-server]__5ceff0f3._.js +1 -1
  186. package/.next/server/chunks/[root-of-the-server]__5ceff0f3._.js.map +1 -1
  187. package/.next/server/chunks/[root-of-the-server]__5ea38a67._.js +1 -1
  188. package/.next/server/chunks/[root-of-the-server]__5ea38a67._.js.map +1 -1
  189. package/.next/server/chunks/[root-of-the-server]__698cf062._.js +1 -1
  190. package/.next/server/chunks/[root-of-the-server]__698cf062._.js.map +1 -1
  191. package/.next/server/chunks/[root-of-the-server]__69be1758._.js +1 -1
  192. package/.next/server/chunks/[root-of-the-server]__69be1758._.js.map +1 -1
  193. package/.next/server/chunks/[root-of-the-server]__69c45937._.js +1 -1
  194. package/.next/server/chunks/[root-of-the-server]__69c45937._.js.map +1 -1
  195. package/.next/server/chunks/[root-of-the-server]__6f4e90a0._.js +1 -1
  196. package/.next/server/chunks/[root-of-the-server]__6f4e90a0._.js.map +1 -1
  197. package/.next/server/chunks/[root-of-the-server]__7459129e._.js +1 -1
  198. package/.next/server/chunks/[root-of-the-server]__7459129e._.js.map +1 -1
  199. package/.next/server/chunks/[root-of-the-server]__7a331e51._.js +1 -1
  200. package/.next/server/chunks/[root-of-the-server]__7a331e51._.js.map +1 -1
  201. package/.next/server/chunks/[root-of-the-server]__7bf889c1._.js +1 -1
  202. package/.next/server/chunks/[root-of-the-server]__7bf889c1._.js.map +1 -1
  203. package/.next/server/chunks/[root-of-the-server]__864a08dd._.js +2 -2
  204. package/.next/server/chunks/[root-of-the-server]__864a08dd._.js.map +1 -1
  205. package/.next/server/chunks/[root-of-the-server]__89605574._.js +1 -1
  206. package/.next/server/chunks/[root-of-the-server]__89605574._.js.map +1 -1
  207. package/.next/server/chunks/[root-of-the-server]__8e27e9f7._.js +3 -3
  208. package/.next/server/chunks/[root-of-the-server]__8e27e9f7._.js.map +1 -1
  209. package/.next/server/chunks/[root-of-the-server]__95ddb81a._.js +1 -1
  210. package/.next/server/chunks/[root-of-the-server]__95ddb81a._.js.map +1 -1
  211. package/.next/server/chunks/[root-of-the-server]__99b12bcb._.js +1 -1
  212. package/.next/server/chunks/[root-of-the-server]__99b12bcb._.js.map +1 -1
  213. package/.next/server/chunks/[root-of-the-server]__9d0ea07b._.js +1 -1
  214. package/.next/server/chunks/[root-of-the-server]__9d0ea07b._.js.map +1 -1
  215. package/.next/server/chunks/[root-of-the-server]__a49c534d._.js +1 -1
  216. package/.next/server/chunks/[root-of-the-server]__a49c534d._.js.map +1 -1
  217. package/.next/server/chunks/[root-of-the-server]__a74a32d5._.js +1 -1
  218. package/.next/server/chunks/[root-of-the-server]__a74a32d5._.js.map +1 -1
  219. package/.next/server/chunks/[root-of-the-server]__b002764e._.js +1 -1
  220. package/.next/server/chunks/[root-of-the-server]__b002764e._.js.map +1 -1
  221. package/.next/server/chunks/[root-of-the-server]__b64936a3._.js +1 -1
  222. package/.next/server/chunks/[root-of-the-server]__b64936a3._.js.map +1 -1
  223. package/.next/server/chunks/[root-of-the-server]__bbdb6dcb._.js +2 -2
  224. package/.next/server/chunks/[root-of-the-server]__bbdb6dcb._.js.map +1 -1
  225. package/.next/server/chunks/[root-of-the-server]__bccfb2c0._.js +1 -1
  226. package/.next/server/chunks/[root-of-the-server]__bccfb2c0._.js.map +1 -1
  227. package/.next/server/chunks/[root-of-the-server]__d924e5ac._.js +1 -1
  228. package/.next/server/chunks/[root-of-the-server]__d924e5ac._.js.map +1 -1
  229. package/.next/server/chunks/[root-of-the-server]__e063a986._.js +1 -1
  230. package/.next/server/chunks/[root-of-the-server]__e063a986._.js.map +1 -1
  231. package/.next/server/chunks/[root-of-the-server]__e40409a2._.js +1 -1
  232. package/.next/server/chunks/[root-of-the-server]__e40409a2._.js.map +1 -1
  233. package/.next/server/chunks/[root-of-the-server]__e478ef0d._.js +1 -1
  234. package/.next/server/chunks/[root-of-the-server]__e478ef0d._.js.map +1 -1
  235. package/.next/server/chunks/[root-of-the-server]__fef7183d._.js +1 -1
  236. package/.next/server/chunks/[root-of-the-server]__fef7183d._.js.map +1 -1
  237. package/.next/server/chunks/[root-of-the-server]__ff69832c._.js +1 -1
  238. package/.next/server/chunks/[root-of-the-server]__ff69832c._.js.map +1 -1
  239. package/.next/server/chunks/ssr/[root-of-the-server]__02e6ccaa._.js +3 -0
  240. package/.next/server/chunks/ssr/[root-of-the-server]__02e6ccaa._.js.map +1 -0
  241. package/.next/server/chunks/ssr/[root-of-the-server]__0df430db._.js +3 -0
  242. package/.next/server/chunks/ssr/[root-of-the-server]__0df430db._.js.map +1 -0
  243. package/.next/server/chunks/ssr/[root-of-the-server]__162d7d9d._.js +3 -0
  244. package/.next/server/chunks/ssr/[root-of-the-server]__162d7d9d._.js.map +1 -0
  245. package/.next/server/chunks/ssr/[root-of-the-server]__17b046ea._.js +3 -0
  246. package/.next/server/chunks/ssr/[root-of-the-server]__17b046ea._.js.map +1 -0
  247. package/.next/server/chunks/ssr/[root-of-the-server]__255506f2._.js +3 -0
  248. package/.next/server/chunks/ssr/[root-of-the-server]__255506f2._.js.map +1 -0
  249. package/.next/server/chunks/ssr/[root-of-the-server]__3b880807._.js +3 -0
  250. package/.next/server/chunks/ssr/[root-of-the-server]__3b880807._.js.map +1 -0
  251. package/.next/server/chunks/ssr/[root-of-the-server]__471bc2e7._.js +1 -1
  252. package/.next/server/chunks/ssr/[root-of-the-server]__471bc2e7._.js.map +1 -1
  253. package/.next/server/chunks/ssr/[root-of-the-server]__49281b4c._.js +1 -1
  254. package/.next/server/chunks/ssr/[root-of-the-server]__49281b4c._.js.map +1 -1
  255. package/.next/server/chunks/ssr/[root-of-the-server]__8756d76d._.js +3 -0
  256. package/.next/server/chunks/ssr/[root-of-the-server]__8756d76d._.js.map +1 -0
  257. package/.next/server/chunks/ssr/[root-of-the-server]__8a588fad._.js +3 -0
  258. package/.next/server/chunks/ssr/[root-of-the-server]__8a588fad._.js.map +1 -0
  259. package/.next/server/chunks/ssr/[root-of-the-server]__9a7d79aa._.js +1 -1
  260. package/.next/server/chunks/ssr/[root-of-the-server]__9a7d79aa._.js.map +1 -1
  261. package/.next/server/chunks/ssr/[root-of-the-server]__c777e326._.js +3 -0
  262. package/.next/server/chunks/ssr/[root-of-the-server]__c777e326._.js.map +1 -0
  263. package/.next/server/chunks/ssr/_018dfe6b._.js +1 -1
  264. package/.next/server/chunks/ssr/_018dfe6b._.js.map +1 -1
  265. package/.next/server/chunks/ssr/b1a17_app_teams_[teamId]_workflows_[workflowId]_workflows-editor-client_tsx_5e714aa2._.js +1 -1
  266. package/.next/server/chunks/ssr/b1a17_app_teams_[teamId]_workflows_[workflowId]_workflows-editor-client_tsx_5e714aa2._.js.map +1 -1
  267. package/.next/server/chunks/ssr/src_app_HomeClient_tsx_f9f7568d._.js +1 -1
  268. package/.next/server/chunks/ssr/src_app_HomeClient_tsx_f9f7568d._.js.map +1 -1
  269. package/.next/server/pages/404.html +1 -1
  270. package/.next/server/pages/500.html +2 -2
  271. package/.next/server/server-reference-manifest.js +1 -1
  272. package/.next/server/server-reference-manifest.json +1 -1
  273. package/.next/static/chunks/{ecdc9465f0e4d954.js → 4d4876ec71727e38.js} +1 -1
  274. package/.next/static/chunks/{4f5e02a609758a0b.js → d7f5083b972391f7.js} +1 -1
  275. package/.next/static/chunks/f179280598d329b2.js +1 -0
  276. package/openclaw.plugin.json +1 -1
  277. package/package.json +1 -1
  278. package/.next/server/chunks/ssr/[root-of-the-server]__24c20736._.js +0 -3
  279. package/.next/server/chunks/ssr/[root-of-the-server]__24c20736._.js.map +0 -1
  280. package/.next/server/chunks/ssr/[root-of-the-server]__28f5d174._.js +0 -3
  281. package/.next/server/chunks/ssr/[root-of-the-server]__28f5d174._.js.map +0 -1
  282. package/.next/server/chunks/ssr/[root-of-the-server]__30619465._.js +0 -3
  283. package/.next/server/chunks/ssr/[root-of-the-server]__30619465._.js.map +0 -1
  284. package/.next/server/chunks/ssr/[root-of-the-server]__6bd48d33._.js +0 -3
  285. package/.next/server/chunks/ssr/[root-of-the-server]__6bd48d33._.js.map +0 -1
  286. package/.next/server/chunks/ssr/[root-of-the-server]__78972f52._.js +0 -3
  287. package/.next/server/chunks/ssr/[root-of-the-server]__78972f52._.js.map +0 -1
  288. package/.next/server/chunks/ssr/[root-of-the-server]__7fcc6175._.js +0 -3
  289. package/.next/server/chunks/ssr/[root-of-the-server]__7fcc6175._.js.map +0 -1
  290. package/.next/server/chunks/ssr/[root-of-the-server]__8e001110._.js +0 -3
  291. package/.next/server/chunks/ssr/[root-of-the-server]__8e001110._.js.map +0 -1
  292. package/.next/server/chunks/ssr/[root-of-the-server]__bd20cf10._.js +0 -3
  293. package/.next/server/chunks/ssr/[root-of-the-server]__bd20cf10._.js.map +0 -1
  294. package/.next/server/chunks/ssr/[root-of-the-server]__cefae8c8._.js +0 -3
  295. package/.next/server/chunks/ssr/[root-of-the-server]__cefae8c8._.js.map +0 -1
  296. package/.next/static/chunks/821af975ccc1f8d5.js +0 -1
  297. /package/.next/static/{pW5SAQ1dzPcsq_66yy5po → uTm9pVsF7AuRLSQKZwTWp}/_buildManifest.js +0 -0
  298. /package/.next/static/{pW5SAQ1dzPcsq_66yy5po → uTm9pVsF7AuRLSQKZwTWp}/_clientMiddlewareManifest.json +0 -0
  299. /package/.next/static/{pW5SAQ1dzPcsq_66yy5po → uTm9pVsF7AuRLSQKZwTWp}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/paths.ts","../../../src/lib/errors.ts","../../../src/lib/goals.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/goals/%5Bid%5D/route.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\ntype OpenClawConfig = {\n agents?: { defaults?: { workspace?: string } };\n gateway?: { port?: number; auth?: { token?: string } };\n tools?: {\n agentToAgent?: {\n enabled?: boolean;\n allow?: string[];\n };\n };\n plugins?: {\n installs?: { recipes?: { installPath?: string; sourcePath?: string } };\n load?: { paths?: string[] };\n };\n // OpenClaw message routing bindings (used for HITL approvals, etc.)\n bindings?: unknown[];\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(os.homedir(), \".openclaw\", \"openclaw.json\");\n const text = await fs.readFile(p, \"utf8\");\n return JSON.parse(text) as OpenClawConfig;\n}\n\nexport async function getWorkspaceDir() {\n const cfg = await readOpenClawConfig();\n const ws = cfg.agents?.defaults?.workspace;\n if (!ws) throw new Error(\"agents.defaults.workspace is not set in ~/.openclaw/openclaw.json\");\n return ws;\n}\n\nexport async function getWorkspaceRecipesDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"recipes\");\n}\n\nexport async function getWorkspaceGoalsDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = os.homedir();\n if (!home) throw new Error(\"Could not resolve home directory\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\n/** Team workspace dir derived from agents.defaults.workspace (sibling: .. / workspace-{teamId}) */\nexport function teamDirFromBaseWorkspace(baseWorkspace: string, teamId: string) {\n return path.resolve(baseWorkspace, \"..\", `workspace-${teamId}`);\n}\n\n/** Rejects path traversal and empty names; returns normalized name. */\nexport function assertSafeRelativeFileName(name: string): string {\n const n = name.replace(/\\\\/g, \"/\");\n if (!n || n.startsWith(\"/\") || n.includes(\"..\")) throw new Error(\"Invalid file name\");\n return n;\n}\n\nexport async function getBuiltinRecipesDir() {\n const cfg = await readOpenClawConfig();\n const p =\n cfg.plugins?.installs?.recipes?.installPath ||\n cfg.plugins?.installs?.recipes?.sourcePath ||\n cfg.plugins?.load?.paths?.[0];\n if (!p) throw new Error(\"Could not determine recipes plugin install path from ~/.openclaw/openclaw.json\");\n return path.join(p, \"recipes\", \"default\");\n}\n","/**\n * Extracts a string message from an unknown error value.\n * Used consistently across API routes and client components.\n */\nexport function errorMessage(e: unknown): string {\n return e instanceof Error ? e.message : String(e);\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { NextResponse } from \"next/server\";\nimport YAML from \"yaml\";\nimport { errorMessage } from \"@/lib/errors\";\nimport { getWorkspaceGoalsDir } from \"@/lib/paths\";\n\nexport type GoalStatus = \"planned\" | \"active\" | \"done\";\n\n/** Parses comma-separated string into trimmed non-empty array. */\nexport function parseCommaList(raw: string): string[] {\n return raw.split(\",\").map((s) => s.trim()).filter(Boolean);\n}\n\nexport type GoalFrontmatter = {\n id: string;\n title: string;\n status: GoalStatus;\n tags: string[];\n teams: string[];\n updatedAt: string; // ISO\n};\n\nexport type GoalSummary = GoalFrontmatter & {\n filename: string;\n};\n\nconst ID_RE = /^[a-z0-9][a-z0-9-]{1,63}$/;\n\nexport function assertSafeGoalId(id: string) {\n if (!ID_RE.test(id)) {\n throw new Error(\n `Invalid goal id \"${id}\". Use 2-64 chars: lowercase letters, numbers, hyphens. Example: \"increase-trial-activation\".`\n );\n }\n}\n\n/** Maps goal-related errors to HTTP status: 400 for validation, 500 for other. */\nexport function goalErrorStatus(msg: string): 400 | 500 {\n return /Invalid goal id|Path traversal/.test(msg) ? 400 : 500;\n}\n\n/** Returns NextResponse for goal API errors. Use in catch blocks. */\nexport function goalErrorResponse(e: unknown): NextResponse {\n const msg = errorMessage(e);\n const status = goalErrorStatus(msg);\n return NextResponse.json({ error: msg }, { status });\n}\n\nexport function splitFrontmatter(md: string): { fm: unknown; body: string } {\n if (md.startsWith(\"---\\n\")) {\n const end = md.indexOf(\"\\n---\\n\", 4);\n if (end !== -1) {\n const yamlText = md.slice(4, end + 1);\n const body = md.slice(end + 5);\n const fm = YAML.parse(yamlText) as unknown;\n return { fm: fm ?? {}, body };\n }\n }\n return { fm: {}, body: md };\n}\n\nexport function normalizeFrontmatter(input: unknown, fallbackId: string, fallbackTitle: string): GoalFrontmatter {\n const now = new Date().toISOString();\n const obj = (input && typeof input === \"object\") ? (input as Record<string, unknown>) : {};\n const id = String(obj.id ?? fallbackId).trim();\n const title = String(obj.title ?? fallbackTitle ?? id).trim() || id;\n const statusRaw = String(obj.status ?? \"planned\").trim();\n const status: GoalStatus = statusRaw === \"active\" || statusRaw === \"done\" ? statusRaw : \"planned\";\n const tags = Array.isArray(obj.tags) ? (obj.tags as unknown[]).map(String) : [];\n const teams = Array.isArray(obj.teams) ? (obj.teams as unknown[]).map(String) : [];\n const updatedAt = String(obj.updatedAt ?? now);\n\n return { id, title, status, tags, teams, updatedAt };\n}\n\nasync function ensureGoalsDir() {\n const dir = await getWorkspaceGoalsDir();\n await fs.mkdir(dir, { recursive: true });\n return dir;\n}\n\nasync function goalPathForId(id: string) {\n assertSafeGoalId(id);\n const root = await ensureGoalsDir();\n const full = path.join(root, `${id}.md`);\n const normalizedRoot = path.resolve(root) + path.sep;\n const normalizedFull = path.resolve(full);\n if (!normalizedFull.startsWith(normalizedRoot)) throw new Error(\"Path traversal rejected\");\n return { root, full };\n}\n\nexport async function listGoals(): Promise<GoalSummary[]> {\n const dir = await ensureGoalsDir();\n const files = (await fs.readdir(dir)).filter((f) => f.endsWith(\".md\"));\n\n const out: GoalSummary[] = [];\n for (const f of files) {\n const full = path.join(dir, f);\n const md = await fs.readFile(full, \"utf8\");\n const id = f.replace(/\\.md$/, \"\");\n const { fm } = splitFrontmatter(md);\n const normalized = normalizeFrontmatter(fm, id, id);\n out.push({ ...normalized, filename: f });\n }\n\n // sort: active first, then planned, then done; within status by updatedAt desc\n const rank: Record<GoalStatus, number> = { active: 0, planned: 1, done: 2 };\n out.sort((a, b) => {\n const ra = rank[a.status];\n const rb = rank[b.status];\n if (ra !== rb) return ra - rb;\n return String(b.updatedAt).localeCompare(String(a.updatedAt));\n });\n\n return out;\n}\n\nexport async function readGoal(id: string): Promise<{ frontmatter: GoalFrontmatter; body: string; raw: string } | null> {\n const { full } = await goalPathForId(id);\n try {\n const raw = await fs.readFile(full, \"utf8\");\n const { fm, body } = splitFrontmatter(raw);\n const fmObj = (fm && typeof fm === \"object\") ? (fm as Record<string, unknown>) : {};\n const frontmatter = normalizeFrontmatter(fm, id, String(fmObj.title ?? id));\n return { frontmatter, body, raw };\n } catch (e: unknown) {\n if (typeof e === \"object\" && e && (e as { code?: string }).code === \"ENOENT\") return null;\n throw e;\n }\n}\n\nexport async function writeGoal(params: {\n id: string;\n title: string;\n status?: GoalStatus;\n tags?: string[];\n teams?: string[];\n body: string;\n}): Promise<{ frontmatter: GoalFrontmatter; raw: string }>\n{\n const { id } = params;\n const { full } = await goalPathForId(id);\n\n const updatedAt = new Date().toISOString();\n const fm: GoalFrontmatter = {\n id,\n title: params.title,\n status: params.status ?? \"planned\",\n tags: params.tags ?? [],\n teams: params.teams ?? [],\n updatedAt,\n };\n\n const raw = `---\\n${YAML.stringify(fm).trim()}\\n---\\n\\n${(params.body ?? \"\").trim()}\\n`;\n await fs.writeFile(full, raw, \"utf8\");\n return { frontmatter: fm, raw };\n}\n\nexport async function deleteGoal(id: string): Promise<{ ok: true } | { ok: false; reason: \"not_found\" }> {\n const { full } = await goalPathForId(id);\n try {\n await fs.unlink(full);\n return { ok: true };\n } catch (e: unknown) {\n if (typeof e === \"object\" && e && (e as { code?: string }).code === \"ENOENT\") {\n return { ok: false, reason: \"not_found\" };\n }\n throw e;\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/goals/[id]/route\",\n pathname: \"/api/goals/[id]\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/goals/[id]/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/goals/[id]/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextResponse } from \"next/server\";\nimport { deleteGoal, goalErrorResponse, readGoal, writeGoal } from \"@/lib/goals\";\n\nexport async function GET(_req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params;\n try {\n const goal = await readGoal(id);\n if (!goal) return NextResponse.json({ error: \"Not found\" }, { status: 404 });\n return NextResponse.json({ goal: goal.frontmatter, body: goal.body, raw: goal.raw });\n } catch (e: unknown) {\n return goalErrorResponse(e);\n }\n}\n\nexport async function PUT(req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params;\n type GoalPutBody = {\n title: string;\n status?: \"planned\" | \"active\" | \"done\";\n tags?: string[];\n teams?: string[];\n body?: string;\n };\n\n try {\n const data = (await req.json()) as GoalPutBody;\n const title = String(data?.title ?? \"\").trim();\n if (!title) return NextResponse.json({ error: \"title is required\" }, { status: 400 });\n\n const result = await writeGoal({\n id,\n title,\n status: data?.status,\n tags: Array.isArray(data?.tags) ? data.tags : [],\n teams: Array.isArray(data?.teams) ? data.teams : [],\n body: String(data?.body ?? \"\"),\n });\n\n return NextResponse.json({ goal: result.frontmatter });\n } catch (e: unknown) {\n return goalErrorResponse(e);\n }\n}\n\nexport async function DELETE(_req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params;\n try {\n const result = await deleteGoal(id);\n if (!result.ok) return NextResponse.json({ error: \"Not found\" }, { status: 404 });\n return NextResponse.json({ ok: true });\n } catch (e: unknown) {\n return goalErrorResponse(e);\n }\n}\n"],"names":[],"mappings":"2sCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAmBO,eAAe,IACpB,IAAM,EAAI,EAAA,OAAI,CAAC,IAAI,CAAC,EAAA,OAAE,CAAC,OAAO,GAAI,YAAa,iBAE/C,OAAO,KAAK,KAAK,CAAC,AADL,MAAM,EAAA,OAAE,CAAC,QAAQ,CAAC,EAAG,QAEpC,CAEO,eAAe,IACpB,IAAM,EAAM,MAAM,IACZ,EAAK,EAAI,MAAM,EAAE,UAAU,UACjC,GAAI,CAAC,EAAI,MAAM,AAAI,MAAM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MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[3]}
1
+ {"version":3,"sources":["../../../src/lib/paths.ts","../../../src/lib/errors.ts","../../../src/lib/goals.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/goals/%5Bid%5D/route.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\ntype OpenClawConfig = {\n agents?: { defaults?: { workspace?: string } };\n gateway?: { port?: number; auth?: { token?: string } };\n tools?: {\n agentToAgent?: {\n enabled?: boolean;\n allow?: string[];\n };\n };\n plugins?: {\n installs?: { recipes?: { installPath?: string; sourcePath?: string } };\n load?: { paths?: string[] };\n };\n // OpenClaw message routing bindings (used for HITL approvals, etc.)\n bindings?: unknown[];\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(os.homedir(), \".openclaw\", \"openclaw.json\");\n const text = await fs.readFile(p, \"utf8\");\n return JSON.parse(text) as OpenClawConfig;\n}\n\nexport async function getWorkspaceDir() {\n const cfg = await readOpenClawConfig();\n const ws = cfg.agents?.defaults?.workspace;\n if (!ws) throw new Error(\"agents.defaults.workspace is not set in ~/.openclaw/openclaw.json\");\n return ws;\n}\n\nexport async function getWorkspaceRecipesDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"recipes\");\n}\n\nexport async function getWorkspaceGoalsDir() {\n const ws = await getWorkspaceDir();\n\n // Back-compat: some installs keep goals at <workspace>/goals.\n // Prefer that when present, otherwise fall back to <workspace>/notes/goals.\n const direct = path.join(ws, \"goals\");\n try {\n const st = await fs.stat(direct);\n if (st.isDirectory()) return direct;\n } catch {\n // ignore\n }\n\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = os.homedir();\n if (!home) throw new Error(\"Could not resolve home directory\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\n/** Team workspace dir derived from agents.defaults.workspace (sibling: .. / workspace-{teamId}) */\nexport function teamDirFromBaseWorkspace(baseWorkspace: string, teamId: string) {\n // Special-case: treat \"main\" as the personal workspace (agents.defaults.workspace).\n // This lets Kitchen expose a selectable \"main\" scope without creating a separate\n // ~/.openclaw/workspace-main folder.\n if (teamId === \"main\") return path.resolve(baseWorkspace);\n return path.resolve(baseWorkspace, \"..\", `workspace-${teamId}`);\n}\n\n/** Rejects path traversal and empty names; returns normalized name. */\nexport function assertSafeRelativeFileName(name: string): string {\n const n = name.replace(/\\\\/g, \"/\");\n if (!n || n.startsWith(\"/\") || n.includes(\"..\")) throw new Error(\"Invalid file name\");\n return n;\n}\n\nexport async function getBuiltinRecipesDir() {\n const cfg = await readOpenClawConfig();\n const p =\n cfg.plugins?.installs?.recipes?.installPath ||\n cfg.plugins?.installs?.recipes?.sourcePath ||\n cfg.plugins?.load?.paths?.[0];\n if (!p) throw new Error(\"Could not determine recipes plugin install path from ~/.openclaw/openclaw.json\");\n return path.join(p, \"recipes\", \"default\");\n}\n","/**\n * Extracts a string message from an unknown error value.\n * Used consistently across API routes and client components.\n */\nexport function errorMessage(e: unknown): string {\n return e instanceof Error ? e.message : String(e);\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { NextResponse } from \"next/server\";\nimport YAML from \"yaml\";\nimport { errorMessage } from \"@/lib/errors\";\nimport { getWorkspaceGoalsDir } from \"@/lib/paths\";\n\nexport type GoalStatus = \"planned\" | \"active\" | \"done\";\n\n/** Parses comma-separated string into trimmed non-empty array. */\nexport function parseCommaList(raw: string): string[] {\n return raw.split(\",\").map((s) => s.trim()).filter(Boolean);\n}\n\nexport type GoalFrontmatter = {\n id: string;\n title: string;\n status: GoalStatus;\n tags: string[];\n teams: string[];\n updatedAt: string; // ISO\n};\n\nexport type GoalSummary = GoalFrontmatter & {\n filename: string;\n};\n\nconst ID_RE = /^[a-z0-9][a-z0-9-]{1,63}$/;\n\nexport function assertSafeGoalId(id: string) {\n if (!ID_RE.test(id)) {\n throw new Error(\n `Invalid goal id \"${id}\". Use 2-64 chars: lowercase letters, numbers, hyphens. Example: \"increase-trial-activation\".`\n );\n }\n}\n\n/** Maps goal-related errors to HTTP status: 400 for validation, 500 for other. */\nexport function goalErrorStatus(msg: string): 400 | 500 {\n return /Invalid goal id|Path traversal/.test(msg) ? 400 : 500;\n}\n\n/** Returns NextResponse for goal API errors. Use in catch blocks. */\nexport function goalErrorResponse(e: unknown): NextResponse {\n const msg = errorMessage(e);\n const status = goalErrorStatus(msg);\n return NextResponse.json({ error: msg }, { status });\n}\n\nexport function splitFrontmatter(md: string): { fm: unknown; body: string } {\n if (md.startsWith(\"---\\n\")) {\n const end = md.indexOf(\"\\n---\\n\", 4);\n if (end !== -1) {\n const yamlText = md.slice(4, end + 1);\n const body = md.slice(end + 5);\n const fm = YAML.parse(yamlText) as unknown;\n return { fm: fm ?? {}, body };\n }\n }\n return { fm: {}, body: md };\n}\n\nexport function normalizeFrontmatter(input: unknown, fallbackId: string, fallbackTitle: string): GoalFrontmatter {\n const now = new Date().toISOString();\n const obj = (input && typeof input === \"object\") ? (input as Record<string, unknown>) : {};\n const id = String(obj.id ?? fallbackId).trim();\n const title = String(obj.title ?? fallbackTitle ?? id).trim() || id;\n const statusRaw = String(obj.status ?? \"planned\").trim();\n const status: GoalStatus = statusRaw === \"active\" || statusRaw === \"done\" ? statusRaw : \"planned\";\n const tags = Array.isArray(obj.tags) ? (obj.tags as unknown[]).map(String) : [];\n const teams = Array.isArray(obj.teams) ? (obj.teams as unknown[]).map(String) : [];\n const updatedAt = String(obj.updatedAt ?? now);\n\n return { id, title, status, tags, teams, updatedAt };\n}\n\nasync function ensureGoalsDir() {\n const dir = await getWorkspaceGoalsDir();\n await fs.mkdir(dir, { recursive: true });\n return dir;\n}\n\nasync function goalPathForId(id: string) {\n assertSafeGoalId(id);\n const root = await ensureGoalsDir();\n const full = path.join(root, `${id}.md`);\n const normalizedRoot = path.resolve(root) + path.sep;\n const normalizedFull = path.resolve(full);\n if (!normalizedFull.startsWith(normalizedRoot)) throw new Error(\"Path traversal rejected\");\n return { root, full };\n}\n\nexport async function listGoals(): Promise<GoalSummary[]> {\n const dir = await ensureGoalsDir();\n const files = (await fs.readdir(dir)).filter((f) => f.endsWith(\".md\"));\n\n const out: GoalSummary[] = [];\n for (const f of files) {\n const full = path.join(dir, f);\n const md = await fs.readFile(full, \"utf8\");\n const id = f.replace(/\\.md$/, \"\");\n const { fm } = splitFrontmatter(md);\n const normalized = normalizeFrontmatter(fm, id, id);\n out.push({ ...normalized, filename: f });\n }\n\n // sort: active first, then planned, then done; within status by updatedAt desc\n const rank: Record<GoalStatus, number> = { active: 0, planned: 1, done: 2 };\n out.sort((a, b) => {\n const ra = rank[a.status];\n const rb = rank[b.status];\n if (ra !== rb) return ra - rb;\n return String(b.updatedAt).localeCompare(String(a.updatedAt));\n });\n\n return out;\n}\n\nexport async function readGoal(id: string): Promise<{ frontmatter: GoalFrontmatter; body: string; raw: string } | null> {\n const { full } = await goalPathForId(id);\n try {\n const raw = await fs.readFile(full, \"utf8\");\n const { fm, body } = splitFrontmatter(raw);\n const fmObj = (fm && typeof fm === \"object\") ? (fm as Record<string, unknown>) : {};\n const frontmatter = normalizeFrontmatter(fm, id, String(fmObj.title ?? id));\n return { frontmatter, body, raw };\n } catch (e: unknown) {\n if (typeof e === \"object\" && e && (e as { code?: string }).code === \"ENOENT\") return null;\n throw e;\n }\n}\n\nexport async function writeGoal(params: {\n id: string;\n title: string;\n status?: GoalStatus;\n tags?: string[];\n teams?: string[];\n body: string;\n}): Promise<{ frontmatter: GoalFrontmatter; raw: string }>\n{\n const { id } = params;\n const { full } = await goalPathForId(id);\n\n const updatedAt = new Date().toISOString();\n const fm: GoalFrontmatter = {\n id,\n title: params.title,\n status: params.status ?? \"planned\",\n tags: params.tags ?? [],\n teams: params.teams ?? [],\n updatedAt,\n };\n\n const raw = `---\\n${YAML.stringify(fm).trim()}\\n---\\n\\n${(params.body ?? \"\").trim()}\\n`;\n await fs.writeFile(full, raw, \"utf8\");\n return { frontmatter: fm, raw };\n}\n\nexport async function deleteGoal(id: string): Promise<{ ok: true } | { ok: false; reason: \"not_found\" }> {\n const { full } = await goalPathForId(id);\n try {\n await fs.unlink(full);\n return { ok: true };\n } catch (e: unknown) {\n if (typeof e === \"object\" && e && (e as { code?: string }).code === \"ENOENT\") {\n return { ok: false, reason: \"not_found\" };\n }\n throw e;\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/goals/[id]/route\",\n pathname: \"/api/goals/[id]\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/goals/[id]/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/goals/[id]/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextResponse } from \"next/server\";\nimport { deleteGoal, goalErrorResponse, readGoal, writeGoal } from \"@/lib/goals\";\n\nexport async function GET(_req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params;\n try {\n const goal = await readGoal(id);\n if (!goal) return NextResponse.json({ error: \"Not found\" }, { status: 404 });\n return NextResponse.json({ goal: goal.frontmatter, body: goal.body, raw: goal.raw });\n } catch (e: unknown) {\n return goalErrorResponse(e);\n }\n}\n\nexport async function PUT(req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params;\n type GoalPutBody = {\n title: string;\n status?: \"planned\" | \"active\" | \"done\";\n tags?: string[];\n teams?: string[];\n body?: string;\n };\n\n try {\n const data = (await req.json()) as GoalPutBody;\n const title = String(data?.title ?? \"\").trim();\n if (!title) return NextResponse.json({ error: \"title is required\" }, { status: 400 });\n\n const result = await writeGoal({\n id,\n title,\n status: data?.status,\n tags: Array.isArray(data?.tags) ? data.tags : [],\n teams: Array.isArray(data?.teams) ? data.teams : [],\n body: String(data?.body ?? \"\"),\n });\n\n return NextResponse.json({ goal: result.frontmatter });\n } catch (e: unknown) {\n return goalErrorResponse(e);\n }\n}\n\nexport async function DELETE(_req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params;\n try {\n const result = await deleteGoal(id);\n if (!result.ok) return NextResponse.json({ error: \"Not found\" }, { status: 404 });\n return NextResponse.json({ ok: true });\n } catch (e: unknown) {\n return goalErrorResponse(e);\n }\n}\n"],"names":[],"mappings":"2sCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAmBO,eAAe,IACpB,IAAM,EAAI,EAAA,OAAI,CAAC,IAAI,CAAC,EAAA,OAAE,CAAC,OAAO,GAAI,YAAa,iBAE/C,OAAO,KAAK,KAAK,CAAC,AADL,MAAM,EAAA,OAAE,CAAC,QAAQ,CAAC,EAAG,QAEpC,CAEO,eAAe,IACpB,IAAM,EAAM,MAAM,IACZ,EAAK,EAAI,MAAM,EAAE,UAAU,UACjC,GAAI,CAAC,EAAI,MAAM,AAAI,MAAM,qEACzB,OAAO,CACT,CAEO,eAAe,IACpB,IAAM,EAAK,MAAM,IACjB,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAI,UACvB,CAEO,eAAe,IACpB,IAAM,EAAK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AQ,GAAG,CAAC,gBAAiB,CAAA,EAAA,EAAA,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[3]}
@@ -1,3 +1,3 @@
1
- module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},7367,e=>{"use strict";var t=e.i(12714),r=e.i(60526),a=e.i(50227);async function n(){let e=a.default.join(r.default.homedir(),".openclaw","openclaw.json");return JSON.parse(await t.default.readFile(e,"utf8"))}async function i(){let e=await n(),t=e.agents?.defaults?.workspace;if(!t)throw Error("agents.defaults.workspace is not set in ~/.openclaw/openclaw.json");return t}async function o(){let e=await i();return a.default.join(e,"recipes")}async function s(){let e=await i();return a.default.join(e,"notes","goals")}async function l(e){let t=r.default.homedir();if(!t)throw Error("Could not resolve home directory");return a.default.join(t,".openclaw",`workspace-${e}`)}function d(e,t){return a.default.resolve(e,"..",`workspace-${t}`)}function u(e){let t=e.replace(/\\/g,"/");if(!t||t.startsWith("/")||t.includes(".."))throw Error("Invalid file name");return t}async function c(){let e=await n(),t=e.plugins?.installs?.recipes?.installPath||e.plugins?.installs?.recipes?.sourcePath||e.plugins?.load?.paths?.[0];if(!t)throw Error("Could not determine recipes plugin install path from ~/.openclaw/openclaw.json");return a.default.join(t,"recipes","default")}e.s(["assertSafeRelativeFileName",()=>u,"getBuiltinRecipesDir",()=>c,"getTeamWorkspaceDir",()=>l,"getWorkspaceDir",()=>i,"getWorkspaceGoalsDir",()=>s,"getWorkspaceRecipesDir",()=>o,"readOpenClawConfig",()=>n,"teamDirFromBaseWorkspace",()=>d])},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},93518,e=>{"use strict";function t(e){if(!e.startsWith("---\n"))throw Error("Recipe markdown must start with YAML frontmatter (---)");let t=e.indexOf("\n---\n",4);if(-1===t)throw Error("Recipe frontmatter not terminated (---)");return{yamlText:e.slice(4,t+1),rest:e.slice(t+5)}}function r(e){let t=e.trim();if(!t)throw Error("role is required");if(!/^[a-z][a-z0-9-]{0,62}$/i.test(t))throw Error("role must be alphanumeric/dash");return t}e.s(["normalizeRole",()=>r,"splitRecipeFrontmatter",()=>t])},35154,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),i=e.i(61916),o=e.i(74677),s=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),m=e.i(10372),w=e.i(93695);e.i(52474);var g=e.i(220),x=e.i(12714),R=e.i(50227),v=e.i(89171),y=e.i(23008),E=e.i(7367),k=e.i(93518);let C=null;async function b(){let e=await (0,E.getWorkspaceRecipesDir)(),t=await (0,E.getBuiltinRecipesDir)();async function r(e){try{return(await x.default.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(".md")).map(e=>e.name)}catch{return[]}}let a=await r(e),n=await r(t),i=new Map;for(let e of n)i.set(R.default.basename(e,".md"),R.default.join(t,e));for(let t of a)i.set(R.default.basename(t,".md"),R.default.join(e,t));return Array.from(i.entries()).map(([e,t])=>({id:e,filePath:t})).sort((e,t)=>e.id.localeCompare(t.id))}async function j(){let e=R.default.resolve(await (0,E.getWorkspaceRecipesDir)(),".."),t=[];try{t=await x.default.readdir(e,{withFileTypes:!0})}catch{return new Set}let r=new Set;for(let a of t){if(!a.isDirectory()||!a.name.startsWith("workspace-"))continue;let t=R.default.join(e,a.name),n=R.default.join(t,"team.json");try{let e=await x.default.readFile(n,"utf8"),t=JSON.parse(e),a=String(t?.recipeId??"").trim();a&&r.add(a)}catch{}}return r}async function A(){let e=Date.now();if(C&&e-C.ts<3e5)return v.NextResponse.json({ok:!0,items:C.items,cached:!0});let t=await b(),r=[];for(let e of t){let t="";try{t=await x.default.readFile(e.filePath,"utf8")}catch{continue}r.push(...function(e,t){let r;try{r=function(e){let t=e.indexOf("---\n");if(-1===t)throw Error("Recipe markdown must include YAML frontmatter (---)");let r=e.slice(t),{yamlText:a}=(0,k.splitRecipeFrontmatter)(r);return y.default.parse(a)}(t)}catch{return[]}let a=r&&"object"==typeof r?r:{},n=String(a.kind??"").trim(),i=String(a.name??e).trim()||e,o=[];if("team"===n)for(let t of Array.isArray(a.agents)?a.agents:[]){let r=t&&"object"==typeof t?t:{},a=String(r.role??"").trim();if(!a)continue;let n=r.name?String(r.name).trim():"";o.push({kind:"team-role",recipeId:e,recipeName:i,roleId:a,roleName:n||void 0})}if("agent"===n){let t=a.description?String(a.description).trim():"";o.push({kind:"single-agent",recipeId:e,recipeName:i,description:t||void 0})}return o}(e.id,t))}let a=function(e,t){let r=new Set,a=new Map;for(let n of e){if("single-agent"===n.kind){let e=n.recipeId;if(r.has(e))continue;r.add(e);continue}let e=a.get(n.roleId);if(!e){a.set(n.roleId,n);continue}let i=t.has(e.recipeId),o=t.has(n.recipeId);(!i||o)&&!i&&o&&a.set(n.roleId,n)}let n=[];for(let t of e)if("single-agent"===t.kind){if(!r.has(t.recipeId))continue;r.delete(t.recipeId),n.push(t)}for(let e of a.values())n.push(e);return n}(r,await j());return a.sort((e,t)=>{if(e.kind!==t.kind)return"team-role"===e.kind?-1:1;let r=e.recipeId.localeCompare(t.recipeId);return r||("team-role"===e.kind&&"team-role"===t.kind?e.roleId.localeCompare(t.roleId):0)}),C={ts:e,items:a},v.NextResponse.json({ok:!0,items:a,cached:!1})}e.s(["GET",()=>A,"dynamic",0,"force-dynamic"],9557);var S=e.i(9557);let I=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/recipes/local-agent-catalog/route",pathname:"/api/recipes/local-agent-catalog",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/recipes/local-agent-catalog/route.ts",nextConfigOutput:"standalone",userland:S}),{workAsyncStorage:N,workUnitAsyncStorage:T,serverHooks:q}=I;function O(){return(0,a.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:T})}async function P(e,t,a){I.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/recipes/local-agent-catalog/route";x=x.replace(/\/index$/,"")||"/";let R=await I.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:v,params:y,nextConfig:E,parsedUrl:k,isDraftMode:C,prerenderManifest:b,routerServerContext:j,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,resolvedPathname:N,clientReferenceManifest:T,serverActionsManifest:q}=R,O=(0,s.normalizeAppPath)(x),P=!!(b.dynamicRoutes[O]||b.routes[N]),D=async()=>((null==j?void 0:j.render404)?await j.render404(e,t,k,!1):t.end("This page could not be found"),null);if(P&&!C){let e=!!b.routes[N],t=b.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await D();throw new w.NoFallbackError}}let _=null;!P||I.isDev||C||(_="/index"===(_=N)?"/":_);let F=!0===I.isDev||!P,H=P&&!F;q&&T&&(0,o.setManifestsSingleton)({page:x,clientReferenceManifest:T,serverActionsManifest:q});let M=e.method||"GET",U=(0,i.getTracer)(),W=U.getActiveScopeSpan(),$={params:y,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:F,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>I.onRequestError(e,t,a,n,j)},sharedContext:{buildId:v}},B=new l.NodeNextRequest(e),K=new l.NodeNextResponse(t),L=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let o=async e=>I.handle(L,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${x}`)}),s=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var i,l;let d=async({previousCacheEntry:r})=>{try{if(!s&&A&&S&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await o(n);e.fetchMetrics=$.renderOpts.fetchMetrics;let l=$.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=$.renderOpts.collectedTags;if(!P)return await (0,p.sendResponse)(B,K,i,$.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(i.headers);d&&(t[m.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,a=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await I.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:A})},!1,j),t}},u=await I.handleResponse({req:e,nextConfig:E,cacheKey:_,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:s});if(!P)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});s||t.setHeader("x-nextjs-cache",A?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let w=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return s&&P||w.delete(m.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||w.get("Cache-Control")||w.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(B,K,new Response(u.value.body,{headers:w,status:u.value.status||200})),null};W?await l(W):await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${x}`,kind:i.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof w.NoFallbackError||await I.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:A})},!1,j),P)throw t;return await (0,p.sendResponse)(B,K,new Response(null,{status:500})),null}}e.s(["handler",()=>P,"patchFetch",()=>O,"routeModule",()=>I,"serverHooks",()=>q,"workAsyncStorage",()=>N,"workUnitAsyncStorage",()=>T],35154)}];
1
+ module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},7367,e=>{"use strict";var t=e.i(12714),r=e.i(60526),a=e.i(50227);async function n(){let e=a.default.join(r.default.homedir(),".openclaw","openclaw.json");return JSON.parse(await t.default.readFile(e,"utf8"))}async function i(){let e=await n(),t=e.agents?.defaults?.workspace;if(!t)throw Error("agents.defaults.workspace is not set in ~/.openclaw/openclaw.json");return t}async function o(){let e=await i();return a.default.join(e,"recipes")}async function s(){let e=await i(),r=a.default.join(e,"goals");try{if((await t.default.stat(r)).isDirectory())return r}catch{}return a.default.join(e,"notes","goals")}async function l(e){let t=r.default.homedir();if(!t)throw Error("Could not resolve home directory");return a.default.join(t,".openclaw",`workspace-${e}`)}function d(e,t){return"main"===t?a.default.resolve(e):a.default.resolve(e,"..",`workspace-${t}`)}function u(e){let t=e.replace(/\\/g,"/");if(!t||t.startsWith("/")||t.includes(".."))throw Error("Invalid file name");return t}async function c(){let e=await n(),t=e.plugins?.installs?.recipes?.installPath||e.plugins?.installs?.recipes?.sourcePath||e.plugins?.load?.paths?.[0];if(!t)throw Error("Could not determine recipes plugin install path from ~/.openclaw/openclaw.json");return a.default.join(t,"recipes","default")}e.s(["assertSafeRelativeFileName",()=>u,"getBuiltinRecipesDir",()=>c,"getTeamWorkspaceDir",()=>l,"getWorkspaceDir",()=>i,"getWorkspaceGoalsDir",()=>s,"getWorkspaceRecipesDir",()=>o,"readOpenClawConfig",()=>n,"teamDirFromBaseWorkspace",()=>d])},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},93518,e=>{"use strict";function t(e){if(!e.startsWith("---\n"))throw Error("Recipe markdown must start with YAML frontmatter (---)");let t=e.indexOf("\n---\n",4);if(-1===t)throw Error("Recipe frontmatter not terminated (---)");return{yamlText:e.slice(4,t+1),rest:e.slice(t+5)}}function r(e){let t=e.trim();if(!t)throw Error("role is required");if(!/^[a-z][a-z0-9-]{0,62}$/i.test(t))throw Error("role must be alphanumeric/dash");return t}e.s(["normalizeRole",()=>r,"splitRecipeFrontmatter",()=>t])},35154,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),i=e.i(61916),o=e.i(74677),s=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),m=e.i(10372),w=e.i(93695);e.i(52474);var g=e.i(220),x=e.i(12714),R=e.i(50227),v=e.i(89171),y=e.i(23008),E=e.i(7367),k=e.i(93518);let C=null;async function j(){let e=await (0,E.getWorkspaceRecipesDir)(),t=await (0,E.getBuiltinRecipesDir)();async function r(e){try{return(await x.default.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(".md")).map(e=>e.name)}catch{return[]}}let a=await r(e),n=await r(t),i=new Map;for(let e of n)i.set(R.default.basename(e,".md"),R.default.join(t,e));for(let t of a)i.set(R.default.basename(t,".md"),R.default.join(e,t));return Array.from(i.entries()).map(([e,t])=>({id:e,filePath:t})).sort((e,t)=>e.id.localeCompare(t.id))}async function b(){let e=R.default.resolve(await (0,E.getWorkspaceRecipesDir)(),".."),t=[];try{t=await x.default.readdir(e,{withFileTypes:!0})}catch{return new Set}let r=new Set;for(let a of t){if(!a.isDirectory()||!a.name.startsWith("workspace-"))continue;let t=R.default.join(e,a.name),n=R.default.join(t,"team.json");try{let e=await x.default.readFile(n,"utf8"),t=JSON.parse(e),a=String(t?.recipeId??"").trim();a&&r.add(a)}catch{}}return r}async function A(){let e=Date.now();if(C&&e-C.ts<3e5)return v.NextResponse.json({ok:!0,items:C.items,cached:!0});let t=await j(),r=[];for(let e of t){let t="";try{t=await x.default.readFile(e.filePath,"utf8")}catch{continue}r.push(...function(e,t){let r;try{r=function(e){let t=e.indexOf("---\n");if(-1===t)throw Error("Recipe markdown must include YAML frontmatter (---)");let r=e.slice(t),{yamlText:a}=(0,k.splitRecipeFrontmatter)(r);return y.default.parse(a)}(t)}catch{return[]}let a=r&&"object"==typeof r?r:{},n=String(a.kind??"").trim(),i=String(a.name??e).trim()||e,o=[];if("team"===n)for(let t of Array.isArray(a.agents)?a.agents:[]){let r=t&&"object"==typeof t?t:{},a=String(r.role??"").trim();if(!a)continue;let n=r.name?String(r.name).trim():"";o.push({kind:"team-role",recipeId:e,recipeName:i,roleId:a,roleName:n||void 0})}if("agent"===n){let t=a.description?String(a.description).trim():"";o.push({kind:"single-agent",recipeId:e,recipeName:i,description:t||void 0})}return o}(e.id,t))}let a=function(e,t){let r=new Set,a=new Map;for(let n of e){if("single-agent"===n.kind){let e=n.recipeId;if(r.has(e))continue;r.add(e);continue}let e=a.get(n.roleId);if(!e){a.set(n.roleId,n);continue}let i=t.has(e.recipeId),o=t.has(n.recipeId);(!i||o)&&!i&&o&&a.set(n.roleId,n)}let n=[];for(let t of e)if("single-agent"===t.kind){if(!r.has(t.recipeId))continue;r.delete(t.recipeId),n.push(t)}for(let e of a.values())n.push(e);return n}(r,await b());return a.sort((e,t)=>{if(e.kind!==t.kind)return"team-role"===e.kind?-1:1;let r=e.recipeId.localeCompare(t.recipeId);return r||("team-role"===e.kind&&"team-role"===t.kind?e.roleId.localeCompare(t.roleId):0)}),C={ts:e,items:a},v.NextResponse.json({ok:!0,items:a,cached:!1})}e.s(["GET",()=>A,"dynamic",0,"force-dynamic"],9557);var S=e.i(9557);let I=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/recipes/local-agent-catalog/route",pathname:"/api/recipes/local-agent-catalog",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/recipes/local-agent-catalog/route.ts",nextConfigOutput:"standalone",userland:S}),{workAsyncStorage:N,workUnitAsyncStorage:T,serverHooks:q}=I;function O(){return(0,a.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:T})}async function P(e,t,a){I.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/recipes/local-agent-catalog/route";x=x.replace(/\/index$/,"")||"/";let R=await I.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:v,params:y,nextConfig:E,parsedUrl:k,isDraftMode:C,prerenderManifest:j,routerServerContext:b,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,resolvedPathname:N,clientReferenceManifest:T,serverActionsManifest:q}=R,O=(0,s.normalizeAppPath)(x),P=!!(j.dynamicRoutes[O]||j.routes[N]),D=async()=>((null==b?void 0:b.render404)?await b.render404(e,t,k,!1):t.end("This page could not be found"),null);if(P&&!C){let e=!!j.routes[N],t=j.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await D();throw new w.NoFallbackError}}let _=null;!P||I.isDev||C||(_="/index"===(_=N)?"/":_);let F=!0===I.isDev||!P,H=P&&!F;q&&T&&(0,o.setManifestsSingleton)({page:x,clientReferenceManifest:T,serverActionsManifest:q});let M=e.method||"GET",U=(0,i.getTracer)(),W=U.getActiveScopeSpan(),$={params:y,prerenderManifest:j,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:F,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>I.onRequestError(e,t,a,n,b)},sharedContext:{buildId:v}},B=new l.NodeNextRequest(e),K=new l.NodeNextResponse(t),L=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let o=async e=>I.handle(L,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${x}`)}),s=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var i,l;let d=async({previousCacheEntry:r})=>{try{if(!s&&A&&S&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await o(n);e.fetchMetrics=$.renderOpts.fetchMetrics;let l=$.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=$.renderOpts.collectedTags;if(!P)return await (0,p.sendResponse)(B,K,i,$.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(i.headers);d&&(t[m.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,a=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await I.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:A})},!1,b),t}},u=await I.handleResponse({req:e,nextConfig:E,cacheKey:_,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:j,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:s});if(!P)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});s||t.setHeader("x-nextjs-cache",A?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let w=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return s&&P||w.delete(m.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||w.get("Cache-Control")||w.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(B,K,new Response(u.value.body,{headers:w,status:u.value.status||200})),null};W?await l(W):await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${x}`,kind:i.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof w.NoFallbackError||await I.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:A})},!1,b),P)throw t;return await (0,p.sendResponse)(B,K,new Response(null,{status:500})),null}}e.s(["handler",()=>P,"patchFetch",()=>O,"routeModule",()=>I,"serverHooks",()=>q,"workAsyncStorage",()=>N,"workUnitAsyncStorage",()=>T],35154)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__95ddb81a._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/paths.ts","../../../src/lib/recipe-team-agents.ts","../../../src/app/api/recipes/local-agent-catalog/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\ntype OpenClawConfig = {\n agents?: { defaults?: { workspace?: string } };\n gateway?: { port?: number; auth?: { token?: string } };\n tools?: {\n agentToAgent?: {\n enabled?: boolean;\n allow?: string[];\n };\n };\n plugins?: {\n installs?: { recipes?: { installPath?: string; sourcePath?: string } };\n load?: { paths?: string[] };\n };\n // OpenClaw message routing bindings (used for HITL approvals, etc.)\n bindings?: unknown[];\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(os.homedir(), \".openclaw\", \"openclaw.json\");\n const text = await fs.readFile(p, \"utf8\");\n return JSON.parse(text) as OpenClawConfig;\n}\n\nexport async function getWorkspaceDir() {\n const cfg = await readOpenClawConfig();\n const ws = cfg.agents?.defaults?.workspace;\n if (!ws) throw new Error(\"agents.defaults.workspace is not set in ~/.openclaw/openclaw.json\");\n return ws;\n}\n\nexport async function getWorkspaceRecipesDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"recipes\");\n}\n\nexport async function getWorkspaceGoalsDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = os.homedir();\n if (!home) throw new Error(\"Could not resolve home directory\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\n/** Team workspace dir derived from agents.defaults.workspace (sibling: .. / workspace-{teamId}) */\nexport function teamDirFromBaseWorkspace(baseWorkspace: string, teamId: string) {\n return path.resolve(baseWorkspace, \"..\", `workspace-${teamId}`);\n}\n\n/** Rejects path traversal and empty names; returns normalized name. */\nexport function assertSafeRelativeFileName(name: string): string {\n const n = name.replace(/\\\\/g, \"/\");\n if (!n || n.startsWith(\"/\") || n.includes(\"..\")) throw new Error(\"Invalid file name\");\n return n;\n}\n\nexport async function getBuiltinRecipesDir() {\n const cfg = await readOpenClawConfig();\n const p =\n cfg.plugins?.installs?.recipes?.installPath ||\n cfg.plugins?.installs?.recipes?.sourcePath ||\n cfg.plugins?.load?.paths?.[0];\n if (!p) throw new Error(\"Could not determine recipes plugin install path from ~/.openclaw/openclaw.json\");\n return path.join(p, \"recipes\", \"default\");\n}\n","export function splitRecipeFrontmatter(md: string): { yamlText: string; rest: string } {\n if (!md.startsWith(\"---\\n\")) throw new Error(\"Recipe markdown must start with YAML frontmatter (---)\");\n const end = md.indexOf(\"\\n---\\n\", 4);\n if (end === -1) throw new Error(\"Recipe frontmatter not terminated (---)\");\n const yamlText = md.slice(4, end + 1);\n const rest = md.slice(end + 5);\n return { yamlText, rest };\n}\n\nexport function normalizeRole(role: string): string {\n const r = role.trim();\n if (!r) throw new Error(\"role is required\");\n if (!/^[a-z][a-z0-9-]{0,62}$/i.test(r)) throw new Error(\"role must be alphanumeric/dash\");\n return r;\n}\n\n/** Validates create-team or create-agent id. Returns error message or null. */\nexport function validateCreateId(\n recipe: { id: string } | null,\n id: string,\n entityLabel: \"team\" | \"agent\"\n): string | null {\n if (!recipe) return null;\n const t = id.trim();\n const label = entityLabel === \"team\" ? \"Team id\" : \"Agent id\";\n if (!t) return `${label} is required.`;\n if (t === recipe.id)\n return `${label} cannot be the same as the recipe id (${recipe.id}). Choose a new ${entityLabel} id.`;\n return null;\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { NextResponse } from \"next/server\";\nimport YAML from \"yaml\";\nimport { getBuiltinRecipesDir, getWorkspaceRecipesDir } from \"@/lib/paths\";\nimport { splitRecipeFrontmatter } from \"@/lib/recipe-team-agents\";\n\nexport const dynamic = \"force-dynamic\";\n\nconst CACHE_TTL_MS = 5 * 60 * 1000;\nlet cache: { ts: number; items: LocalAgentCatalogItem[] } | null = null;\n\nexport type LocalAgentCatalogItem =\n | {\n kind: \"team-role\";\n recipeId: string;\n recipeName?: string;\n roleId: string;\n roleName?: string;\n }\n | {\n kind: \"single-agent\";\n recipeId: string;\n recipeName?: string;\n description?: string;\n };\n\nfunction parseRecipeFrontmatter(md: string): unknown {\n // openclaw CLI (or plugin runner) can sometimes prepend banners/warnings.\n // Find the first frontmatter marker and parse from there.\n const start = md.indexOf(\"---\\n\");\n if (start === -1) throw new Error(\"Recipe markdown must include YAML frontmatter (---)\");\n const sliced = md.slice(start);\n const { yamlText } = splitRecipeFrontmatter(sliced);\n return YAML.parse(yamlText) as unknown;\n}\n\nasync function listLocalRecipeFiles(): Promise<Array<{ id: string; filePath: string }>> {\n const workspaceDir = await getWorkspaceRecipesDir();\n const builtinDir = await getBuiltinRecipesDir();\n\n async function readDir(dir: string): Promise<string[]> {\n try {\n const ents = await fs.readdir(dir, { withFileTypes: true });\n return ents.filter((e) => e.isFile() && e.name.endsWith(\".md\")).map((e) => e.name);\n } catch {\n return [];\n }\n }\n\n const workspaceFiles = await readDir(workspaceDir);\n const builtinFiles = await readDir(builtinDir);\n\n // Prefer workspace overrides over builtin (same id).\n const byId = new Map<string, string>();\n for (const f of builtinFiles) byId.set(path.basename(f, \".md\"), path.join(builtinDir, f));\n for (const f of workspaceFiles) byId.set(path.basename(f, \".md\"), path.join(workspaceDir, f));\n\n return Array.from(byId.entries())\n .map(([id, filePath]) => ({ id, filePath }))\n .sort((a, b) => a.id.localeCompare(b.id));\n}\n\nfunction extractCatalogItems(recipeId: string, md: string): LocalAgentCatalogItem[] {\n let fmRaw: unknown;\n try {\n fmRaw = parseRecipeFrontmatter(md);\n } catch {\n return [];\n }\n\n const fm = (fmRaw && typeof fmRaw === \"object\") ? (fmRaw as Record<string, unknown>) : {};\n const kind = String(fm[\"kind\"] ?? \"\").trim();\n const recipeName = String(fm[\"name\"] ?? recipeId).trim() || recipeId;\n\n const out: LocalAgentCatalogItem[] = [];\n\n if (kind === \"team\") {\n const agents = Array.isArray(fm[\"agents\"]) ? (fm[\"agents\"] as unknown[]) : [];\n for (const aRaw of agents) {\n const a = (aRaw && typeof aRaw === \"object\") ? (aRaw as Record<string, unknown>) : {};\n const roleId = String(a[\"role\"] ?? \"\").trim();\n if (!roleId) continue;\n const roleName = a[\"name\"] ? String(a[\"name\"]).trim() : \"\";\n out.push({\n kind: \"team-role\",\n recipeId,\n recipeName,\n roleId,\n roleName: roleName || undefined,\n });\n }\n }\n\n if (kind === \"agent\") {\n const description = fm[\"description\"] ? String(fm[\"description\"]).trim() : \"\";\n out.push({\n kind: \"single-agent\",\n recipeId,\n recipeName,\n description: description || undefined,\n });\n }\n\n return out;\n}\n\nasync function listActiveRecipeIds(): Promise<Set<string>> {\n // Active teams are the ones with an actual workspace-<teamId>/team.json.\n // We'll prefer their recipeId when multiple recipe files define the same roleId.\n const workspaceRoot = path.resolve(await getWorkspaceRecipesDir(), \"..\");\n let entries: Array<{ name: string; isDirectory: () => boolean }> = [];\n try {\n entries = await fs.readdir(workspaceRoot, { withFileTypes: true });\n } catch {\n return new Set<string>();\n }\n\n const active = new Set<string>();\n\n for (const ent of entries) {\n if (!ent.isDirectory()) continue;\n if (!ent.name.startsWith(\"workspace-\")) continue;\n const teamDir = path.join(workspaceRoot, ent.name);\n const metaPath = path.join(teamDir, \"team.json\");\n try {\n const raw = await fs.readFile(metaPath, \"utf8\");\n const meta = JSON.parse(raw) as { recipeId?: string };\n const recipeId = String(meta?.recipeId ?? \"\").trim();\n if (recipeId) active.add(recipeId);\n } catch {\n // ignore\n }\n }\n\n return active;\n}\n\nfunction dedupeItems(items: LocalAgentCatalogItem[], activeRecipeIds: Set<string>): LocalAgentCatalogItem[] {\n const seenAgents = new Set<string>();\n const bestRoleByRoleId = new Map<string, LocalAgentCatalogItem>();\n\n for (const it of items) {\n if (it.kind === \"single-agent\") {\n const key = it.recipeId;\n if (seenAgents.has(key)) continue;\n seenAgents.add(key);\n continue;\n }\n\n // Team role: dedupe by roleId across all recipes.\n const existing = bestRoleByRoleId.get(it.roleId);\n if (!existing) {\n bestRoleByRoleId.set(it.roleId, it);\n continue;\n }\n\n // Prefer an item whose recipeId is active.\n const existingActive = activeRecipeIds.has(existing.recipeId);\n const itActive = activeRecipeIds.has(it.recipeId);\n if (existingActive && !itActive) continue;\n if (!existingActive && itActive) {\n bestRoleByRoleId.set(it.roleId, it);\n }\n\n // Otherwise, keep the first (stable)\n }\n\n const out: LocalAgentCatalogItem[] = [];\n for (const it of items) {\n if (it.kind === \"single-agent\") {\n if (!seenAgents.has(it.recipeId)) continue;\n // ensure only first occurrence\n seenAgents.delete(it.recipeId);\n out.push(it);\n }\n }\n\n for (const v of bestRoleByRoleId.values()) out.push(v);\n\n return out;\n}\n\nexport async function GET() {\n const now = Date.now();\n if (cache && now - cache.ts < CACHE_TTL_MS) {\n return NextResponse.json({ ok: true, items: cache.items, cached: true });\n }\n\n const files = await listLocalRecipeFiles();\n\n const itemsRaw: LocalAgentCatalogItem[] = [];\n for (const r of files) {\n let md = \"\";\n try {\n md = await fs.readFile(r.filePath, \"utf8\");\n } catch {\n continue;\n }\n itemsRaw.push(...extractCatalogItems(r.id, md));\n }\n\n const activeRecipeIds = await listActiveRecipeIds();\n const items = dedupeItems(itemsRaw, activeRecipeIds);\n\n // Stable ordering: team roles first, then agents.\n items.sort((a, b) => {\n if (a.kind !== b.kind) return a.kind === \"team-role\" ? -1 : 1;\n const ar = a.recipeId.localeCompare(b.recipeId);\n if (ar) return ar;\n if (a.kind === \"team-role\" && b.kind === \"team-role\") return a.roleId.localeCompare(b.roleId);\n return 0;\n });\n\n cache = { ts: now, items };\n return NextResponse.json({ ok: true, items, cached: false });\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/recipes/local-agent-catalog/route\",\n pathname: \"/api/recipes/local-agent-catalog\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/recipes/local-agent-catalog/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/recipes/local-agent-catalog/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"2sCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAmBO,eAAe,IACpB,IAAM,EAAI,EAAA,OAAI,CAAC,IAAI,CAAC,EAAA,OAAE,CAAC,OAAO,GAAI,YAAa,iBAE/C,OAAO,KAAK,KAAK,CAAC,AADL,MAAM,EAAA,OAAE,CAAC,QAAQ,CAAC,EAAG,QAEpC,CAEO,eAAe,IACpB,IAAM,EAAM,MAAM,IACZ,EAAK,EAAI,MAAM,EAAE,UAAU,UACjC,GAAI,CAAC,EAAI,MAAM,AAAI,MAAM,qEACzB,OAAO,CACT,CAEO,eAAe,IACpB,IAAM,EAAK,MAAM,IACjB,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAI,UACvB,CAEO,eAAe,IACpB,IAAM,EAAK,MAAM,IACjB,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAI,QAAS,QAChC,CAEO,eAAe,EAAoB,CAAc,EACtD,IAAM,EAAO,EAAA,OAAE,CAAC,OAAO,GACvB,GAAI,CAAC,EAAM,MAAM,AAAI,MAAM,oCAC3B,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAM,YAAa,CAAC,UAAU,EAAE,EAAA,CAAQ,CAC3D,CAGO,SAAS,EAAyB,CAAqB,CAAE,CAAc,EAC5E,OAAO,EAAA,OAAI,CAAC,OAAO,CAAC,EAAe,KAAM,CAAC,UAAU,EAAE,EAAA,CAAQ,CAChE,CAGO,SAAS,EAA2B,CAAY,EACrD,IAAM,EAAI,EAAK,OAAO,CAAC,MAAO,KAC9B,GAAI,CAAC,GAAK,EAAE,UAAU,CAAC,MAAQ,EAAE,QAAQ,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AqB,EAAD,AAAS,GAAG,CAAC,kBAAkB,AAC7F,EAAQ,GAAG,CAAC,gBAAiB,CAAA,EAAA,EAAA,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAY,AAAZ,EAAa,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[3]}
1
+ {"version":3,"sources":["../../../src/lib/paths.ts","../../../src/lib/recipe-team-agents.ts","../../../src/app/api/recipes/local-agent-catalog/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\ntype OpenClawConfig = {\n agents?: { defaults?: { workspace?: string } };\n gateway?: { port?: number; auth?: { token?: string } };\n tools?: {\n agentToAgent?: {\n enabled?: boolean;\n allow?: string[];\n };\n };\n plugins?: {\n installs?: { recipes?: { installPath?: string; sourcePath?: string } };\n load?: { paths?: string[] };\n };\n // OpenClaw message routing bindings (used for HITL approvals, etc.)\n bindings?: unknown[];\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(os.homedir(), \".openclaw\", \"openclaw.json\");\n const text = await fs.readFile(p, \"utf8\");\n return JSON.parse(text) as OpenClawConfig;\n}\n\nexport async function getWorkspaceDir() {\n const cfg = await readOpenClawConfig();\n const ws = cfg.agents?.defaults?.workspace;\n if (!ws) throw new Error(\"agents.defaults.workspace is not set in ~/.openclaw/openclaw.json\");\n return ws;\n}\n\nexport async function getWorkspaceRecipesDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"recipes\");\n}\n\nexport async function getWorkspaceGoalsDir() {\n const ws = await getWorkspaceDir();\n\n // Back-compat: some installs keep goals at <workspace>/goals.\n // Prefer that when present, otherwise fall back to <workspace>/notes/goals.\n const direct = path.join(ws, \"goals\");\n try {\n const st = await fs.stat(direct);\n if (st.isDirectory()) return direct;\n } catch {\n // ignore\n }\n\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = os.homedir();\n if (!home) throw new Error(\"Could not resolve home directory\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\n/** Team workspace dir derived from agents.defaults.workspace (sibling: .. / workspace-{teamId}) */\nexport function teamDirFromBaseWorkspace(baseWorkspace: string, teamId: string) {\n // Special-case: treat \"main\" as the personal workspace (agents.defaults.workspace).\n // This lets Kitchen expose a selectable \"main\" scope without creating a separate\n // ~/.openclaw/workspace-main folder.\n if (teamId === \"main\") return path.resolve(baseWorkspace);\n return path.resolve(baseWorkspace, \"..\", `workspace-${teamId}`);\n}\n\n/** Rejects path traversal and empty names; returns normalized name. */\nexport function assertSafeRelativeFileName(name: string): string {\n const n = name.replace(/\\\\/g, \"/\");\n if (!n || n.startsWith(\"/\") || n.includes(\"..\")) throw new Error(\"Invalid file name\");\n return n;\n}\n\nexport async function getBuiltinRecipesDir() {\n const cfg = await readOpenClawConfig();\n const p =\n cfg.plugins?.installs?.recipes?.installPath ||\n cfg.plugins?.installs?.recipes?.sourcePath ||\n cfg.plugins?.load?.paths?.[0];\n if (!p) throw new Error(\"Could not determine recipes plugin install path from ~/.openclaw/openclaw.json\");\n return path.join(p, \"recipes\", \"default\");\n}\n","export function splitRecipeFrontmatter(md: string): { yamlText: string; rest: string } {\n if (!md.startsWith(\"---\\n\")) throw new Error(\"Recipe markdown must start with YAML frontmatter (---)\");\n const end = md.indexOf(\"\\n---\\n\", 4);\n if (end === -1) throw new Error(\"Recipe frontmatter not terminated (---)\");\n const yamlText = md.slice(4, end + 1);\n const rest = md.slice(end + 5);\n return { yamlText, rest };\n}\n\nexport function normalizeRole(role: string): string {\n const r = role.trim();\n if (!r) throw new Error(\"role is required\");\n if (!/^[a-z][a-z0-9-]{0,62}$/i.test(r)) throw new Error(\"role must be alphanumeric/dash\");\n return r;\n}\n\n/** Validates create-team or create-agent id. Returns error message or null. */\nexport function validateCreateId(\n recipe: { id: string } | null,\n id: string,\n entityLabel: \"team\" | \"agent\"\n): string | null {\n if (!recipe) return null;\n const t = id.trim();\n const label = entityLabel === \"team\" ? \"Team id\" : \"Agent id\";\n if (!t) return `${label} is required.`;\n if (t === recipe.id)\n return `${label} cannot be the same as the recipe id (${recipe.id}). Choose a new ${entityLabel} id.`;\n return null;\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { NextResponse } from \"next/server\";\nimport YAML from \"yaml\";\nimport { getBuiltinRecipesDir, getWorkspaceRecipesDir } from \"@/lib/paths\";\nimport { splitRecipeFrontmatter } from \"@/lib/recipe-team-agents\";\n\nexport const dynamic = \"force-dynamic\";\n\nconst CACHE_TTL_MS = 5 * 60 * 1000;\nlet cache: { ts: number; items: LocalAgentCatalogItem[] } | null = null;\n\nexport type LocalAgentCatalogItem =\n | {\n kind: \"team-role\";\n recipeId: string;\n recipeName?: string;\n roleId: string;\n roleName?: string;\n }\n | {\n kind: \"single-agent\";\n recipeId: string;\n recipeName?: string;\n description?: string;\n };\n\nfunction parseRecipeFrontmatter(md: string): unknown {\n // openclaw CLI (or plugin runner) can sometimes prepend banners/warnings.\n // Find the first frontmatter marker and parse from there.\n const start = md.indexOf(\"---\\n\");\n if (start === -1) throw new Error(\"Recipe markdown must include YAML frontmatter (---)\");\n const sliced = md.slice(start);\n const { yamlText } = splitRecipeFrontmatter(sliced);\n return YAML.parse(yamlText) as unknown;\n}\n\nasync function listLocalRecipeFiles(): Promise<Array<{ id: string; filePath: string }>> {\n const workspaceDir = await getWorkspaceRecipesDir();\n const builtinDir = await getBuiltinRecipesDir();\n\n async function readDir(dir: string): Promise<string[]> {\n try {\n const ents = await fs.readdir(dir, { withFileTypes: true });\n return ents.filter((e) => e.isFile() && e.name.endsWith(\".md\")).map((e) => e.name);\n } catch {\n return [];\n }\n }\n\n const workspaceFiles = await readDir(workspaceDir);\n const builtinFiles = await readDir(builtinDir);\n\n // Prefer workspace overrides over builtin (same id).\n const byId = new Map<string, string>();\n for (const f of builtinFiles) byId.set(path.basename(f, \".md\"), path.join(builtinDir, f));\n for (const f of workspaceFiles) byId.set(path.basename(f, \".md\"), path.join(workspaceDir, f));\n\n return Array.from(byId.entries())\n .map(([id, filePath]) => ({ id, filePath }))\n .sort((a, b) => a.id.localeCompare(b.id));\n}\n\nfunction extractCatalogItems(recipeId: string, md: string): LocalAgentCatalogItem[] {\n let fmRaw: unknown;\n try {\n fmRaw = parseRecipeFrontmatter(md);\n } catch {\n return [];\n }\n\n const fm = (fmRaw && typeof fmRaw === \"object\") ? (fmRaw as Record<string, unknown>) : {};\n const kind = String(fm[\"kind\"] ?? \"\").trim();\n const recipeName = String(fm[\"name\"] ?? recipeId).trim() || recipeId;\n\n const out: LocalAgentCatalogItem[] = [];\n\n if (kind === \"team\") {\n const agents = Array.isArray(fm[\"agents\"]) ? (fm[\"agents\"] as unknown[]) : [];\n for (const aRaw of agents) {\n const a = (aRaw && typeof aRaw === \"object\") ? (aRaw as Record<string, unknown>) : {};\n const roleId = String(a[\"role\"] ?? \"\").trim();\n if (!roleId) continue;\n const roleName = a[\"name\"] ? String(a[\"name\"]).trim() : \"\";\n out.push({\n kind: \"team-role\",\n recipeId,\n recipeName,\n roleId,\n roleName: roleName || undefined,\n });\n }\n }\n\n if (kind === \"agent\") {\n const description = fm[\"description\"] ? String(fm[\"description\"]).trim() : \"\";\n out.push({\n kind: \"single-agent\",\n recipeId,\n recipeName,\n description: description || undefined,\n });\n }\n\n return out;\n}\n\nasync function listActiveRecipeIds(): Promise<Set<string>> {\n // Active teams are the ones with an actual workspace-<teamId>/team.json.\n // We'll prefer their recipeId when multiple recipe files define the same roleId.\n const workspaceRoot = path.resolve(await getWorkspaceRecipesDir(), \"..\");\n let entries: Array<{ name: string; isDirectory: () => boolean }> = [];\n try {\n entries = await fs.readdir(workspaceRoot, { withFileTypes: true });\n } catch {\n return new Set<string>();\n }\n\n const active = new Set<string>();\n\n for (const ent of entries) {\n if (!ent.isDirectory()) continue;\n if (!ent.name.startsWith(\"workspace-\")) continue;\n const teamDir = path.join(workspaceRoot, ent.name);\n const metaPath = path.join(teamDir, \"team.json\");\n try {\n const raw = await fs.readFile(metaPath, \"utf8\");\n const meta = JSON.parse(raw) as { recipeId?: string };\n const recipeId = String(meta?.recipeId ?? \"\").trim();\n if (recipeId) active.add(recipeId);\n } catch {\n // ignore\n }\n }\n\n return active;\n}\n\nfunction dedupeItems(items: LocalAgentCatalogItem[], activeRecipeIds: Set<string>): LocalAgentCatalogItem[] {\n const seenAgents = new Set<string>();\n const bestRoleByRoleId = new Map<string, LocalAgentCatalogItem>();\n\n for (const it of items) {\n if (it.kind === \"single-agent\") {\n const key = it.recipeId;\n if (seenAgents.has(key)) continue;\n seenAgents.add(key);\n continue;\n }\n\n // Team role: dedupe by roleId across all recipes.\n const existing = bestRoleByRoleId.get(it.roleId);\n if (!existing) {\n bestRoleByRoleId.set(it.roleId, it);\n continue;\n }\n\n // Prefer an item whose recipeId is active.\n const existingActive = activeRecipeIds.has(existing.recipeId);\n const itActive = activeRecipeIds.has(it.recipeId);\n if (existingActive && !itActive) continue;\n if (!existingActive && itActive) {\n bestRoleByRoleId.set(it.roleId, it);\n }\n\n // Otherwise, keep the first (stable)\n }\n\n const out: LocalAgentCatalogItem[] = [];\n for (const it of items) {\n if (it.kind === \"single-agent\") {\n if (!seenAgents.has(it.recipeId)) continue;\n // ensure only first occurrence\n seenAgents.delete(it.recipeId);\n out.push(it);\n }\n }\n\n for (const v of bestRoleByRoleId.values()) out.push(v);\n\n return out;\n}\n\nexport async function GET() {\n const now = Date.now();\n if (cache && now - cache.ts < CACHE_TTL_MS) {\n return NextResponse.json({ ok: true, items: cache.items, cached: true });\n }\n\n const files = await listLocalRecipeFiles();\n\n const itemsRaw: LocalAgentCatalogItem[] = [];\n for (const r of files) {\n let md = \"\";\n try {\n md = await fs.readFile(r.filePath, \"utf8\");\n } catch {\n continue;\n }\n itemsRaw.push(...extractCatalogItems(r.id, md));\n }\n\n const activeRecipeIds = await listActiveRecipeIds();\n const items = dedupeItems(itemsRaw, activeRecipeIds);\n\n // Stable ordering: team roles first, then agents.\n items.sort((a, b) => {\n if (a.kind !== b.kind) return a.kind === \"team-role\" ? -1 : 1;\n const ar = a.recipeId.localeCompare(b.recipeId);\n if (ar) return ar;\n if (a.kind === \"team-role\" && b.kind === \"team-role\") return a.roleId.localeCompare(b.roleId);\n return 0;\n });\n\n cache = { ts: now, items };\n return NextResponse.json({ ok: true, items, cached: false });\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/recipes/local-agent-catalog/route\",\n pathname: \"/api/recipes/local-agent-catalog\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/recipes/local-agent-catalog/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/recipes/local-agent-catalog/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"2sCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAmBO,eAAe,IACpB,IAAM,EAAI,EAAA,OAAI,CAAC,IAAI,CAAC,EAAA,OAAE,CAAC,OAAO,GAAI,YAAa,i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AAA,EAAA,YAAY,AAAZ,EAAa,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[3]}
@@ -1,3 +1,3 @@
1
- module.exports=[40317,e=>{"use strict";function t(e){return e instanceof Error?e.message:String(e)}e.s(["errorMessage",()=>t])},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},12057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},59494,e=>{"use strict";function t(){let e=globalThis.__clawkitchen_api;if(!e)throw Error("ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)");return e}e.s(["getKitchenApi",()=>t])},5003,e=>{"use strict";var t=e.i(59494),r=e.i(74533);let n=(0,e.i(12057).promisify)(r.execFile);function a(e){return"string"==typeof e.stdout?e.stdout:e.stdout&&"object"==typeof e.stdout&&"toString"in e.stdout?String(e.stdout.toString()):""}function s(e,t){return"string"==typeof e.stderr?e.stderr:e.stderr&&"object"==typeof e.stderr&&"toString"in e.stderr?String(e.stderr.toString()):"string"==typeof e.message?e.message:String(t)}async function o(e){try{let t=await n("openclaw",e,{timeout:12e4,windowsHide:!0,maxBuffer:0xa00000});return{ok:!0,exitCode:0,stdout:String(t.stdout??""),stderr:String(t.stderr??"")}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:a(t),stderr:s(t,t)}}}async function i(e){if("cron"===e[0])return o(e);let r=(0,t.getKitchenApi)();try{let t=await r.runtime.system.runCommandWithTimeout(["openclaw",...e],{timeoutMs:12e4}),n=String(t.stdout??""),a=String(t.stderr??""),s="number"==typeof t.exitCode?t.exitCode:"number"==typeof t.code?t.code:"number"==typeof t.status?t.status:0;if(0!==s)return{ok:!1,exitCode:s,stdout:n,stderr:a};return{ok:!0,exitCode:0,stdout:n,stderr:a}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:a(t),stderr:s(t,t)}}}e.s(["runOpenClaw",()=>i])},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},7367,e=>{"use strict";var t=e.i(12714),r=e.i(60526),n=e.i(50227);async function a(){let e=n.default.join(r.default.homedir(),".openclaw","openclaw.json");return JSON.parse(await t.default.readFile(e,"utf8"))}async function s(){let e=await a(),t=e.agents?.defaults?.workspace;if(!t)throw Error("agents.defaults.workspace is not set in ~/.openclaw/openclaw.json");return t}async function o(){let e=await s();return n.default.join(e,"recipes")}async function i(){let e=await s();return n.default.join(e,"notes","goals")}async function u(e){let t=r.default.homedir();if(!t)throw Error("Could not resolve home directory");return n.default.join(t,".openclaw",`workspace-${e}`)}function l(e,t){return n.default.resolve(e,"..",`workspace-${t}`)}function d(e){let t=e.replace(/\\/g,"/");if(!t||t.startsWith("/")||t.includes(".."))throw Error("Invalid file name");return t}async function c(){let e=await a(),t=e.plugins?.installs?.recipes?.installPath||e.plugins?.installs?.recipes?.sourcePath||e.plugins?.load?.paths?.[0];if(!t)throw Error("Could not determine recipes plugin install path from ~/.openclaw/openclaw.json");return n.default.join(t,"recipes","default")}e.s(["assertSafeRelativeFileName",()=>d,"getBuiltinRecipesDir",()=>c,"getTeamWorkspaceDir",()=>u,"getWorkspaceDir",()=>s,"getWorkspaceGoalsDir",()=>i,"getWorkspaceRecipesDir",()=>o,"readOpenClawConfig",()=>a,"teamDirFromBaseWorkspace",()=>l])},85067,e=>{"use strict";var t=e.i(12714),r=e.i(50227),n=e.i(89171),a=e.i(5003);async function s(e){let{stdout:t}=await (0,a.runOpenClaw)(["agents","list","--json"]),r=JSON.parse(t).find(t=>t.id===e);if(!r?.workspace)throw Error(`Agent workspace not found for ${e}`);return r.workspace}var o=e.i(40317),i=e.i(7367);async function u(e){let t;try{t=await e.json()}catch{return n.NextResponse.json({ok:!1,error:"Invalid JSON"},{status:400})}return{body:t&&"object"==typeof t?t:{}}}function l(e){let t=Object.fromEntries(Object.entries(e).filter(([e])=>"ok"!==e));return n.NextResponse.json({ok:!0,...t})}async function d(e){try{return l(await e())}catch(e){return n.NextResponse.json({ok:!1,error:(0,o.errorMessage)(e)},{status:500})}}function c(e,t,r){let a=t.stdout?.trim(),s=t.stderr?.trim();return n.NextResponse.json({ok:!1,error:s||a||`openclaw ${e.join(" ")} failed (exit=${t.exitCode})`,stdout:t.stdout,stderr:t.stderr,...r},{status:500})}async function p(e){if(!e)return n.NextResponse.json({ok:!1,error:"teamId is required"},{status:400});let t=await (0,i.readOpenClawConfig)(),r=String(t.agents?.defaults?.workspace??"").trim();if(!r)return n.NextResponse.json({ok:!1,error:"agents.defaults.workspace not set"},{status:500});let a=(0,i.teamDirFromBaseWorkspace)(r,e);return{teamId:e,teamDir:a}}async function f(e){let{searchParams:t}=new URL(e.url);return p(String(t.get("teamId")??"").trim())}async function m(e,t){let r=await f(e);return r instanceof n.NextResponse?r:t(r)}async function g(e){return p(String(e.teamId??"").trim())}async function x(e){let{searchParams:t}=new URL(e.url);return w(String(t.get("agentId")??"").trim())}async function h(e){return w(String(e.agentId??"").trim())}async function w(e){if(!e)return n.NextResponse.json({ok:!1,error:"agentId is required"},{status:400});try{let t=await s(e);return{agentId:e,ws:t}}catch(e){return n.NextResponse.json({ok:!1,error:(0,o.errorMessage)(e)},{status:404})}}async function y(e,n){return Promise.all(n.map(async n=>{let a=r.default.join(e,n.name);try{let e=await t.default.stat(a);return{name:n.name,required:n.required,rationale:n.rationale,path:a,missing:!1,size:e.size,updatedAtMs:e.mtimeMs}}catch{return{name:n.name,required:n.required,rationale:n.rationale,path:a,missing:!0}}}))}e.s(["getAgentContextFromBody",()=>h,"getAgentContextFromQuery",()=>x,"getTeamContextFromBody",()=>g,"getTeamContextFromQuery",()=>f,"installSkillErrorResponse",()=>c,"jsonOkRest",()=>l,"listWorkspaceFiles",()=>y,"parseJsonBody",()=>u,"withStorageError",()=>d,"withTeamContextFromQuery",()=>m],85067)},38858,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),u=e.i(16795),l=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),m=e.i(26937),g=e.i(10372),x=e.i(93695);e.i(52474);var h=e.i(220),w=e.i(12714),y=e.i(50227),R=e.i(89171),v=e.i(40317),k=e.i(7367),C=e.i(85067);async function j(e){return(0,C.withTeamContextFromQuery)(e,async({teamId:t,teamDir:r})=>{let{searchParams:n}=new URL(e.url),a=String(n.get("name")??"").trim();if(!a)return R.NextResponse.json({ok:!1,error:"name is required"},{status:400});let s=(0,k.assertSafeRelativeFileName)(a),o=y.default.join(r,s);try{let e=await w.default.readFile(o,"utf8");return R.NextResponse.json({ok:!0,teamId:t,name:s,filePath:o,content:e})}catch(e){return R.NextResponse.json({ok:!1,error:(0,v.errorMessage)(e)},{status:404})}})}async function E(e){let t=await e.json(),r=await (0,C.getTeamContextFromBody)(t);if(r instanceof R.NextResponse)return r;let{teamId:n,teamDir:a}=r,s=String(t.name??"").trim(),o="string"==typeof t.content?t.content:null;if(!s)return R.NextResponse.json({ok:!1,error:"name is required"},{status:400});if(null===o)return R.NextResponse.json({ok:!1,error:"content is required"},{status:400});let i=(0,k.assertSafeRelativeFileName)(s),u=y.default.join(a,i);return await w.default.mkdir(y.default.dirname(u),{recursive:!0}),await w.default.writeFile(u,o,"utf8"),R.NextResponse.json({ok:!0,teamId:n,name:i,filePath:u})}e.s(["GET",()=>j,"PUT",()=>E],85706);var S=e.i(85706);let N=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/teams/file/route",pathname:"/api/teams/file",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/teams/file/route.ts",nextConfigOutput:"standalone",userland:S}),{workAsyncStorage:b,workUnitAsyncStorage:A,serverHooks:T}=N;function q(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:A})}async function O(e,t,n){N.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/teams/file/route";w=w.replace(/\/index$/,"")||"/";let y=await N.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,params:v,nextConfig:k,parsedUrl:C,isDraftMode:j,prerenderManifest:E,routerServerContext:S,isOnDemandRevalidate:b,revalidateOnlyGenerated:A,resolvedPathname:T,clientReferenceManifest:q,serverActionsManifest:O}=y,P=(0,i.normalizeAppPath)(w),F=!!(E.dynamicRoutes[P]||E.routes[T]),_=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,C,!1):t.end("This page could not be found"),null);if(F&&!j){let e=!!E.routes[T],t=E.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(k.experimental.adapterPath)return await _();throw new x.NoFallbackError}}let I=null;!F||N.isDev||j||(I="/index"===(I=T)?"/":I);let D=!0===N.isDev||!F,U=F&&!D;O&&q&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:q,serverActionsManifest:O});let M=e.method||"GET",H=(0,s.getTracer)(),$=H.getActiveScopeSpan(),B={params:v,prerenderManifest:E,renderOpts:{experimental:{authInterrupts:!!k.experimental.authInterrupts},cacheComponents:!!k.cacheComponents,supportsDynamicResponse:D,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:k.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>N.onRequestError(e,t,n,a,S)},sharedContext:{buildId:R}},K=new u.NodeNextRequest(e),W=new u.NodeNextResponse(t),L=l.NextRequestAdapter.fromNodeNextRequest(K,(0,l.signalFromNodeResponse)(t));try{let o=async e=>N.handle(L,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=H.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${w}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),u=async a=>{var s,u;let l=async({previousCacheEntry:r})=>{try{if(!i&&b&&A&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(a);e.fetchMetrics=B.renderOpts.fetchMetrics;let u=B.renderOpts.pendingWaitUntil;u&&n.waitUntil&&(n.waitUntil(u),u=void 0);let l=B.renderOpts.collectedTags;if(!F)return await (0,p.sendResponse)(K,W,s,B.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[g.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,n=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:h.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:b})},!1,S),t}},d=await N.handleResponse({req:e,nextConfig:k,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:E,isRoutePPREnabled:!1,isOnDemandRevalidate:b,revalidateOnlyGenerated:A,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:i});if(!F)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==h.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(u=d.value)?void 0:u.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",b?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),j&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return i&&F||x.delete(g.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,m.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(K,W,new Response(d.value.body,{headers:x,status:d.value.status||200})),null};$?await u($):await H.withPropagatedContext(e.headers,()=>H.trace(d.BaseServerSpan.handleRequest,{spanName:`${M} ${w}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},u))}catch(t){if(t instanceof x.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:b})},!1,S),F)throw t;return await (0,p.sendResponse)(K,W,new Response(null,{status:500})),null}}e.s(["handler",()=>O,"patchFetch",()=>q,"routeModule",()=>N,"serverHooks",()=>T,"workAsyncStorage",()=>b,"workUnitAsyncStorage",()=>A],38858)}];
1
+ module.exports=[40317,e=>{"use strict";function t(e){return e instanceof Error?e.message:String(e)}e.s(["errorMessage",()=>t])},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},12057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},59494,e=>{"use strict";function t(){let e=globalThis.__clawkitchen_api;if(!e)throw Error("ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)");return e}e.s(["getKitchenApi",()=>t])},5003,e=>{"use strict";var t=e.i(59494),r=e.i(74533);let n=(0,e.i(12057).promisify)(r.execFile);function a(e){return"string"==typeof e.stdout?e.stdout:e.stdout&&"object"==typeof e.stdout&&"toString"in e.stdout?String(e.stdout.toString()):""}function s(e,t){return"string"==typeof e.stderr?e.stderr:e.stderr&&"object"==typeof e.stderr&&"toString"in e.stderr?String(e.stderr.toString()):"string"==typeof e.message?e.message:String(t)}async function o(e){try{let t=await n("openclaw",e,{timeout:12e4,windowsHide:!0,maxBuffer:0xa00000});return{ok:!0,exitCode:0,stdout:String(t.stdout??""),stderr:String(t.stderr??"")}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:a(t),stderr:s(t,t)}}}async function i(e){if("cron"===e[0])return o(e);let r=(0,t.getKitchenApi)();try{let t=await r.runtime.system.runCommandWithTimeout(["openclaw",...e],{timeoutMs:12e4}),n=String(t.stdout??""),a=String(t.stderr??""),s="number"==typeof t.exitCode?t.exitCode:"number"==typeof t.code?t.code:"number"==typeof t.status?t.status:0;if(0!==s)return{ok:!1,exitCode:s,stdout:n,stderr:a};return{ok:!0,exitCode:0,stdout:n,stderr:a}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:a(t),stderr:s(t,t)}}}e.s(["runOpenClaw",()=>i])},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},7367,e=>{"use strict";var t=e.i(12714),r=e.i(60526),n=e.i(50227);async function a(){let e=n.default.join(r.default.homedir(),".openclaw","openclaw.json");return JSON.parse(await t.default.readFile(e,"utf8"))}async function s(){let e=await a(),t=e.agents?.defaults?.workspace;if(!t)throw Error("agents.defaults.workspace is not set in ~/.openclaw/openclaw.json");return t}async function o(){let e=await s();return n.default.join(e,"recipes")}async function i(){let e=await s(),r=n.default.join(e,"goals");try{if((await t.default.stat(r)).isDirectory())return r}catch{}return n.default.join(e,"notes","goals")}async function u(e){let t=r.default.homedir();if(!t)throw Error("Could not resolve home directory");return n.default.join(t,".openclaw",`workspace-${e}`)}function l(e,t){return"main"===t?n.default.resolve(e):n.default.resolve(e,"..",`workspace-${t}`)}function d(e){let t=e.replace(/\\/g,"/");if(!t||t.startsWith("/")||t.includes(".."))throw Error("Invalid file name");return t}async function c(){let e=await a(),t=e.plugins?.installs?.recipes?.installPath||e.plugins?.installs?.recipes?.sourcePath||e.plugins?.load?.paths?.[0];if(!t)throw Error("Could not determine recipes plugin install path from ~/.openclaw/openclaw.json");return n.default.join(t,"recipes","default")}e.s(["assertSafeRelativeFileName",()=>d,"getBuiltinRecipesDir",()=>c,"getTeamWorkspaceDir",()=>u,"getWorkspaceDir",()=>s,"getWorkspaceGoalsDir",()=>i,"getWorkspaceRecipesDir",()=>o,"readOpenClawConfig",()=>a,"teamDirFromBaseWorkspace",()=>l])},85067,e=>{"use strict";var t=e.i(12714),r=e.i(50227),n=e.i(89171),a=e.i(5003);async function s(e){let{stdout:t}=await (0,a.runOpenClaw)(["agents","list","--json"]),r=JSON.parse(t).find(t=>t.id===e);if(!r?.workspace)throw Error(`Agent workspace not found for ${e}`);return r.workspace}var o=e.i(40317),i=e.i(7367);async function u(e){let t;try{t=await e.json()}catch{return n.NextResponse.json({ok:!1,error:"Invalid JSON"},{status:400})}return{body:t&&"object"==typeof t?t:{}}}function l(e){let t=Object.fromEntries(Object.entries(e).filter(([e])=>"ok"!==e));return n.NextResponse.json({ok:!0,...t})}async function d(e){try{return l(await e())}catch(e){return n.NextResponse.json({ok:!1,error:(0,o.errorMessage)(e)},{status:500})}}function c(e,t,r){let a=t.stdout?.trim(),s=t.stderr?.trim();return n.NextResponse.json({ok:!1,error:s||a||`openclaw ${e.join(" ")} failed (exit=${t.exitCode})`,stdout:t.stdout,stderr:t.stderr,...r},{status:500})}async function p(e){if(!e)return n.NextResponse.json({ok:!1,error:"teamId is required"},{status:400});let t=await (0,i.readOpenClawConfig)(),r=String(t.agents?.defaults?.workspace??"").trim();if(!r)return n.NextResponse.json({ok:!1,error:"agents.defaults.workspace not set"},{status:500});let a=(0,i.teamDirFromBaseWorkspace)(r,e);return{teamId:e,teamDir:a}}async function f(e){let{searchParams:t}=new URL(e.url);return p(String(t.get("teamId")??"").trim())}async function m(e,t){let r=await f(e);return r instanceof n.NextResponse?r:t(r)}async function g(e){return p(String(e.teamId??"").trim())}async function h(e){let{searchParams:t}=new URL(e.url);return w(String(t.get("agentId")??"").trim())}async function x(e){return w(String(e.agentId??"").trim())}async function w(e){if(!e)return n.NextResponse.json({ok:!1,error:"agentId is required"},{status:400});try{let t=await s(e);return{agentId:e,ws:t}}catch(e){return n.NextResponse.json({ok:!1,error:(0,o.errorMessage)(e)},{status:404})}}async function y(e,n){return Promise.all(n.map(async n=>{let a=r.default.join(e,n.name);try{let e=await t.default.stat(a);return{name:n.name,required:n.required,rationale:n.rationale,path:a,missing:!1,size:e.size,updatedAtMs:e.mtimeMs}}catch{return{name:n.name,required:n.required,rationale:n.rationale,path:a,missing:!0}}}))}e.s(["getAgentContextFromBody",()=>x,"getAgentContextFromQuery",()=>h,"getTeamContextFromBody",()=>g,"getTeamContextFromQuery",()=>f,"installSkillErrorResponse",()=>c,"jsonOkRest",()=>l,"listWorkspaceFiles",()=>y,"parseJsonBody",()=>u,"withStorageError",()=>d,"withTeamContextFromQuery",()=>m],85067)},38858,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),u=e.i(16795),l=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),m=e.i(26937),g=e.i(10372),h=e.i(93695);e.i(52474);var x=e.i(220),w=e.i(12714),y=e.i(50227),R=e.i(89171),v=e.i(40317),k=e.i(7367),C=e.i(85067);async function j(e){return(0,C.withTeamContextFromQuery)(e,async({teamId:t,teamDir:r})=>{let{searchParams:n}=new URL(e.url),a=String(n.get("name")??"").trim();if(!a)return R.NextResponse.json({ok:!1,error:"name is required"},{status:400});let s=(0,k.assertSafeRelativeFileName)(a),o=y.default.join(r,s);try{let e=await w.default.readFile(o,"utf8");return R.NextResponse.json({ok:!0,teamId:t,name:s,filePath:o,content:e})}catch(e){return R.NextResponse.json({ok:!1,error:(0,v.errorMessage)(e)},{status:404})}})}async function E(e){let t=await e.json(),r=await (0,C.getTeamContextFromBody)(t);if(r instanceof R.NextResponse)return r;let{teamId:n,teamDir:a}=r,s=String(t.name??"").trim(),o="string"==typeof t.content?t.content:null;if(!s)return R.NextResponse.json({ok:!1,error:"name is required"},{status:400});if(null===o)return R.NextResponse.json({ok:!1,error:"content is required"},{status:400});let i=(0,k.assertSafeRelativeFileName)(s),u=y.default.join(a,i);return await w.default.mkdir(y.default.dirname(u),{recursive:!0}),await w.default.writeFile(u,o,"utf8"),R.NextResponse.json({ok:!0,teamId:n,name:i,filePath:u})}e.s(["GET",()=>j,"PUT",()=>E],85706);var S=e.i(85706);let N=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/teams/file/route",pathname:"/api/teams/file",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/teams/file/route.ts",nextConfigOutput:"standalone",userland:S}),{workAsyncStorage:b,workUnitAsyncStorage:A,serverHooks:T}=N;function q(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:A})}async function O(e,t,n){N.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/teams/file/route";w=w.replace(/\/index$/,"")||"/";let y=await N.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,params:v,nextConfig:k,parsedUrl:C,isDraftMode:j,prerenderManifest:E,routerServerContext:S,isOnDemandRevalidate:b,revalidateOnlyGenerated:A,resolvedPathname:T,clientReferenceManifest:q,serverActionsManifest:O}=y,P=(0,i.normalizeAppPath)(w),F=!!(E.dynamicRoutes[P]||E.routes[T]),_=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,C,!1):t.end("This page could not be found"),null);if(F&&!j){let e=!!E.routes[T],t=E.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(k.experimental.adapterPath)return await _();throw new h.NoFallbackError}}let I=null;!F||N.isDev||j||(I="/index"===(I=T)?"/":I);let D=!0===N.isDev||!F,U=F&&!D;O&&q&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:q,serverActionsManifest:O});let M=e.method||"GET",H=(0,s.getTracer)(),$=H.getActiveScopeSpan(),B={params:v,prerenderManifest:E,renderOpts:{experimental:{authInterrupts:!!k.experimental.authInterrupts},cacheComponents:!!k.cacheComponents,supportsDynamicResponse:D,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:k.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>N.onRequestError(e,t,n,a,S)},sharedContext:{buildId:R}},K=new u.NodeNextRequest(e),W=new u.NodeNextResponse(t),L=l.NextRequestAdapter.fromNodeNextRequest(K,(0,l.signalFromNodeResponse)(t));try{let o=async e=>N.handle(L,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=H.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${w}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),u=async a=>{var s,u;let l=async({previousCacheEntry:r})=>{try{if(!i&&b&&A&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(a);e.fetchMetrics=B.renderOpts.fetchMetrics;let u=B.renderOpts.pendingWaitUntil;u&&n.waitUntil&&(n.waitUntil(u),u=void 0);let l=B.renderOpts.collectedTags;if(!F)return await (0,p.sendResponse)(K,W,s,B.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[g.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,n=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:b})},!1,S),t}},d=await N.handleResponse({req:e,nextConfig:k,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:E,isRoutePPREnabled:!1,isOnDemandRevalidate:b,revalidateOnlyGenerated:A,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:i});if(!F)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(u=d.value)?void 0:u.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",b?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),j&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return i&&F||h.delete(g.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,m.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(K,W,new Response(d.value.body,{headers:h,status:d.value.status||200})),null};$?await u($):await H.withPropagatedContext(e.headers,()=>H.trace(d.BaseServerSpan.handleRequest,{spanName:`${M} ${w}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},u))}catch(t){if(t instanceof h.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:b})},!1,S),F)throw t;return await (0,p.sendResponse)(K,W,new Response(null,{status:500})),null}}e.s(["handler",()=>O,"patchFetch",()=>q,"routeModule",()=>N,"serverHooks",()=>T,"workAsyncStorage",()=>b,"workUnitAsyncStorage",()=>A],38858)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__99b12bcb._.js.map