@jetcrab/pi-desk 1.1.25 → 1.1.29-dev

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 (340) hide show
  1. package/package.json +1 -1
  2. package/src/app/api/work-sessions/search/route.ts +1 -0
  3. package/src/app/project-preview/page.tsx +1 -3
  4. package/src/client/l2_biz/project-preview/hooks/l2-use-project-preview.ts +1 -14
  5. package/src/client/l2_biz/project-preview/l2-project-preview-dialog.tsx +0 -1
  6. package/src/client/l2_biz/project-preview/l2-project-preview-page.tsx +0 -1
  7. package/src/client/l2_biz/project-preview/l2-project-preview.tsx +1 -4
  8. package/src/client/l2_biz/project-preview/views/l2-project-branch-select.tsx +42 -3
  9. package/src/client/l2_biz/workbench/git-workspace/l2-git-workspace-runtime.ts +11 -10
  10. package/src/client/l2_biz/workbench/hooks/l2-work-session-search.ts +52 -0
  11. package/src/client/l2_biz/workbench/hooks/l2-workbench-branch-picker.ts +42 -7
  12. package/src/client/l2_biz/workbench/hooks/l2-workbench-session-history.ts +143 -131
  13. package/src/client/l2_biz/workbench/hooks/l2-workbench-session-search.ts +97 -0
  14. package/src/client/l2_biz/workbench/l2-work-session-columns.tsx +8 -0
  15. package/src/client/l2_biz/workbench/l2-work-session-sidebar.tsx +129 -10
  16. package/src/client/l2_biz/workbench/l2-workbench-biz.ts +20 -2
  17. package/src/client/l2_biz/workbench/l2-workbench-branch-filter-preferences.ts +34 -0
  18. package/src/client/l2_biz/workbench/l2-workbench-branch-picker.tsx +34 -71
  19. package/src/client/l2_biz/workbench/l2-workbench-chat-input-runtime.ts +38 -1
  20. package/src/client/l2_biz/workbench/l2-workbench-chat-view.tsx +11 -1
  21. package/src/client/l2_biz/workbench/l2-workbench-picker-dialog.tsx +55 -215
  22. package/src/client/l2_biz/workbench/l2-workbench.tsx +20 -38
  23. package/src/client/l2_biz/workbench/views/l2-workbench-session-search.tsx +123 -0
  24. package/src/client/l3_modules/conversation/l3-conversation-messages.tsx +43 -4
  25. package/src/client/l3_modules/project-files/l3-markdown-preview.module.css +1 -1
  26. package/src/client/l3_modules/project-files/l3-project-document-git.ts +13 -29
  27. package/src/client/l3_modules/project-files/l3-project-document-view.tsx +1 -4
  28. package/src/client/l3_modules/project-files/l3-project-file-browser.module.css +14 -18
  29. package/src/client/l3_modules/project-files/l3-project-file-browser.tsx +52 -95
  30. package/src/client/l3_modules/project-files/l3-project-file-runtime.ts +52 -21
  31. package/src/client/l3_modules/project-files/l3-project-file-tabs.tsx +41 -62
  32. package/src/client/l3_modules/project-files/l3-project-git-runtime.ts +5 -4
  33. package/src/client/l3_modules/project-files/l3-use-project-refresh.ts +36 -0
  34. package/src/client/l3_modules/project-files/views/l3-project-search-results.tsx +2 -2
  35. package/src/client/l3_modules/project-files/views/l3-project-tree-folder.tsx +86 -0
  36. package/src/client/l4_foundation/ui/file-icons/README.md +1 -1
  37. package/src/client/l4_foundation/ui/file-icons/l4-file-icon.tsx +49 -2
  38. package/src/common/l2_biz/pi-session/l2-pi-session-contract.ts +11 -24
  39. package/src/common/l2_biz/project-preview/l2-project-preview-navigation.ts +5 -12
  40. package/src/common/l2_biz/work-session/l2-work-session-search-contract.ts +26 -0
  41. package/src/common/l2_biz/work-session/l2-work-session-tree-contract.ts +9 -1
  42. package/src/common/l2_biz/workbench/l2-workbench-locale-messages.ts +12 -0
  43. package/src/common/l2_biz/workbench/l2-workbench-picker-messages.ts +6 -2
  44. package/src/common/l3_modules/conversation/l3-conversation-locale-messages.ts +2 -0
  45. package/src/common/l3_modules/pi/l3-pi-session-search-contract.ts +26 -0
  46. package/src/common/l4_foundation/locale/l4-host-error-messages.ts +2 -0
  47. package/src/server/l1_entry/api/l1-work-session-branch-route.ts +21 -15
  48. package/src/server/l1_entry/api/l1-work-session-search-route.ts +38 -0
  49. package/src/server/l2_biz/work-session/l2-work-session-chat-runtime.ts +4 -2
  50. package/src/server/l2_biz/work-session/l2-work-session-manage.ts +46 -10
  51. package/src/server/l3_modules/work-session/l3-work-session.ts +11 -6
  52. package/src/server/l4_foundation/pi/l4-pi-chat-worker.ts +35 -2
  53. package/src/server/l4_foundation/pi/l4-pi-session-history-catalog.ts +62 -113
  54. package/src/server/l4_foundation/pi/l4-pi-session-search.ts +166 -0
  55. package/src/server/l4_foundation/pi/l4-pi-work-session-runtime.ts +66 -5
  56. package/src/server/l4_foundation/process/l4-process-tree.js +159 -40
  57. package/temp/build/pi-desk/release/.next/BUILD_ID +1 -1
  58. package/temp/build/pi-desk/release/.next/app-path-routes-manifest.json +1 -0
  59. package/temp/build/pi-desk/release/.next/build-manifest.json +2 -2
  60. package/temp/build/pi-desk/release/.next/prerender-manifest.json +3 -3
  61. package/temp/build/pi-desk/release/.next/required-server-files.js +3 -3
  62. package/temp/build/pi-desk/release/.next/required-server-files.json +3 -3
  63. package/temp/build/pi-desk/release/.next/routes-manifest.json +6 -0
  64. package/temp/build/pi-desk/release/.next/server/app/_global-error/page.js +1 -1
  65. package/temp/build/pi-desk/release/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  66. package/temp/build/pi-desk/release/.next/server/app/_global-error.html +1 -1
  67. package/temp/build/pi-desk/release/.next/server/app/_global-error.rsc +1 -1
  68. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  69. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  70. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  71. package/temp/build/pi-desk/release/.next/server/app/_not-found/page.js +1 -1
  72. package/temp/build/pi-desk/release/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  73. package/temp/build/pi-desk/release/.next/server/app/api/auth/login/route.js +2 -2
  74. package/temp/build/pi-desk/release/.next/server/app/api/auth/logout/route.js +1 -1
  75. package/temp/build/pi-desk/release/.next/server/app/api/auth-settings/get/route.js +1 -1
  76. package/temp/build/pi-desk/release/.next/server/app/api/auth-settings/replace/route.js +1 -1
  77. package/temp/build/pi-desk/release/.next/server/app/api/capability-modes/get/route.js +1 -1
  78. package/temp/build/pi-desk/release/.next/server/app/api/capability-modes/replace/route.js +1 -1
  79. package/temp/build/pi-desk/release/.next/server/app/api/chat/context/get/route.js +1 -1
  80. package/temp/build/pi-desk/release/.next/server/app/api/chat/images/get/route.js +1 -1
  81. package/temp/build/pi-desk/release/.next/server/app/api/chat/messages/get/route.js +1 -1
  82. package/temp/build/pi-desk/release/.next/server/app/api/health/route.js +1 -1
  83. package/temp/build/pi-desk/release/.next/server/app/api/mcp-check/get/route.js +1 -1
  84. package/temp/build/pi-desk/release/.next/server/app/api/mcp-settings/del/route.js +1 -1
  85. package/temp/build/pi-desk/release/.next/server/app/api/mcp-settings/get/route.js +1 -1
  86. package/temp/build/pi-desk/release/.next/server/app/api/mcp-settings/replace/route.js +1 -1
  87. package/temp/build/pi-desk/release/.next/server/app/api/model-catalog/list/route.js +1 -1
  88. package/temp/build/pi-desk/release/.next/server/app/api/model-settings/get/route.js +1 -1
  89. package/temp/build/pi-desk/release/.next/server/app/api/model-settings/preview/route.js +1 -1
  90. package/temp/build/pi-desk/release/.next/server/app/api/model-settings/replace/route.js +1 -1
  91. package/temp/build/pi-desk/release/.next/server/app/api/pi/directories/list/route.js +1 -1
  92. package/temp/build/pi-desk/release/.next/server/app/api/pi/directory-entries/list/route.js +1 -1
  93. package/temp/build/pi-desk/release/.next/server/app/api/pi/directory-ignores/list/route.js +1 -1
  94. package/temp/build/pi-desk/release/.next/server/app/api/pi/directory-ignores/replace/route.js +1 -1
  95. package/temp/build/pi-desk/release/.next/server/app/api/pi/models/list/route.js +1 -1
  96. package/temp/build/pi-desk/release/.next/server/app/api/pi/session-user-messages/list/route.js +1 -1
  97. package/temp/build/pi-desk/release/.next/server/app/api/pi/sessions/list/route.js +1 -1
  98. package/temp/build/pi-desk/release/.next/server/app/api/plugin-catalog/get/route.js +1 -1
  99. package/temp/build/pi-desk/release/.next/server/app/api/plugin-catalog/search/route.js +1 -1
  100. package/temp/build/pi-desk/release/.next/server/app/api/plugin-catalog/settings-get/route.js +1 -1
  101. package/temp/build/pi-desk/release/.next/server/app/api/plugin-catalog/settings-replace/route.js +1 -1
  102. package/temp/build/pi-desk/release/.next/server/app/api/plugins/add/route.js +1 -1
  103. package/temp/build/pi-desk/release/.next/server/app/api/plugins/apply/route.js +1 -1
  104. package/temp/build/pi-desk/release/.next/server/app/api/plugins/batch/route.js +1 -1
  105. package/temp/build/pi-desk/release/.next/server/app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route.js +1 -1
  106. package/temp/build/pi-desk/release/.next/server/app/api/plugins/del/route.js +1 -1
  107. package/temp/build/pi-desk/release/.next/server/app/api/plugins/enabled-set/route.js +1 -1
  108. package/temp/build/pi-desk/release/.next/server/app/api/plugins/get/route.js +1 -1
  109. package/temp/build/pi-desk/release/.next/server/app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route.js +1 -1
  110. package/temp/build/pi-desk/release/.next/server/app/api/plugins/list/route.js +1 -1
  111. package/temp/build/pi-desk/release/.next/server/app/api/plugins/reload/route.js +1 -1
  112. package/temp/build/pi-desk/release/.next/server/app/api/plugins/update/route.js +1 -1
  113. package/temp/build/pi-desk/release/.next/server/app/api/project-files/get/route.js +2 -2
  114. package/temp/build/pi-desk/release/.next/server/app/api/project-files/list/route.js +1 -1
  115. package/temp/build/pi-desk/release/.next/server/app/api/project-files/reveal/route.js +1 -1
  116. package/temp/build/pi-desk/release/.next/server/app/api/project-files/search/route.js +1 -1
  117. package/temp/build/pi-desk/release/.next/server/app/api/project-git/get/route.js +2 -2
  118. package/temp/build/pi-desk/release/.next/server/app/api/project-git-branches/list/route.js +2 -2
  119. package/temp/build/pi-desk/release/.next/server/app/api/project-git-changes/list/route.js +1 -1
  120. package/temp/build/pi-desk/release/.next/server/app/api/project-git-diff/get/route.js +2 -2
  121. package/temp/build/pi-desk/release/.next/server/app/api/project-git-heads/get/route.js +1 -1
  122. package/temp/build/pi-desk/release/.next/server/app/api/project-git-log/list/route.js +2 -2
  123. package/temp/build/pi-desk/release/.next/server/app/api/project-model-default/get/route.js +1 -1
  124. package/temp/build/pi-desk/release/.next/server/app/api/project-model-default/replace/route.js +1 -1
  125. package/temp/build/pi-desk/release/.next/server/app/api/skill-files/get/route.js +1 -1
  126. package/temp/build/pi-desk/release/.next/server/app/api/skill-files/list/route.js +1 -1
  127. package/temp/build/pi-desk/release/.next/server/app/api/skill-files/replace/route.js +1 -1
  128. package/temp/build/pi-desk/release/.next/server/app/api/skills/list/route.js +1 -1
  129. package/temp/build/pi-desk/release/.next/server/app/api/task-center/images/get/route.js +1 -1
  130. package/temp/build/pi-desk/release/.next/server/app/api/task-center/messages/get/route.js +1 -1
  131. package/temp/build/pi-desk/release/.next/server/app/api/work-session-git-branch/add/route.js +1 -1
  132. package/temp/build/pi-desk/release/.next/server/app/api/work-session-git-branch/replace/route.js +1 -1
  133. package/temp/build/pi-desk/release/.next/server/app/api/work-session-tree/get/route.js +1 -1
  134. package/temp/build/pi-desk/release/.next/server/app/api/work-session-tree-entry/get/route.js +1 -1
  135. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/add/route.js +1 -1
  136. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/branch/route.js +1 -1
  137. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/del/route.js +1 -1
  138. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/rename/route.js +1 -1
  139. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/replace/route.js +1 -1
  140. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/search/route.js +1 -0
  141. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/search/route_client-reference-manifest.js +1 -0
  142. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/sort/route.js +1 -1
  143. package/temp/build/pi-desk/release/.next/server/app/favicon.ico/route.js +1 -1
  144. package/temp/build/pi-desk/release/.next/server/app/login/page.js +1 -1
  145. package/temp/build/pi-desk/release/.next/server/app/login/page_client-reference-manifest.js +1 -1
  146. package/temp/build/pi-desk/release/.next/server/app/page.js +138 -138
  147. package/temp/build/pi-desk/release/.next/server/app/page_client-reference-manifest.js +1 -1
  148. package/temp/build/pi-desk/release/.next/server/app/project-preview/page.js +1 -1
  149. package/temp/build/pi-desk/release/.next/server/app/project-preview/page_client-reference-manifest.js +1 -1
  150. package/temp/build/pi-desk/release/.next/server/app-paths-manifest.json +1 -0
  151. package/temp/build/pi-desk/release/.next/server/chunks/23054.js +2 -2
  152. package/temp/build/pi-desk/release/.next/server/chunks/25406.js +8 -8
  153. package/temp/build/pi-desk/release/.next/server/chunks/27344.js +3 -3
  154. package/temp/build/pi-desk/release/.next/server/chunks/3108.js +3 -3
  155. package/temp/build/pi-desk/release/.next/server/chunks/35985.js +2 -2
  156. package/temp/build/pi-desk/release/.next/server/chunks/41856.js +1 -0
  157. package/temp/build/pi-desk/release/.next/server/chunks/62900.js +235 -0
  158. package/temp/build/pi-desk/release/.next/server/chunks/6917.js +1 -1
  159. package/temp/build/pi-desk/release/.next/server/chunks/81363.js +1 -1
  160. package/temp/build/pi-desk/release/.next/server/chunks/81912.js +3 -0
  161. package/temp/build/pi-desk/release/.next/server/chunks/92386.js +2 -2
  162. package/temp/build/pi-desk/release/.next/server/middleware-build-manifest.js +1 -1
  163. package/temp/build/pi-desk/release/.next/server/pages/500.html +1 -1
  164. package/temp/build/pi-desk/release/.next/server/server-reference-manifest.json +1 -1
  165. package/temp/build/pi-desk/release/.next/static/Yyfg-r17aYmEzlYYlIwDo/_buildManifest.js +1 -0
  166. package/temp/build/pi-desk/release/.next/static/chunks/10043-9d6c3735418ccaf9.js +238 -0
  167. package/temp/build/pi-desk/release/.next/static/chunks/11937-ac71fb0f7cef482a.js +1 -0
  168. package/temp/build/pi-desk/release/.next/static/chunks/30669-ffa76d39e0e25194.js +1 -0
  169. package/temp/build/pi-desk/release/.next/static/chunks/36643-f60e98278740073c.js +3 -0
  170. package/temp/build/pi-desk/release/.next/static/chunks/65232-a8571f78020eede2.js +15 -0
  171. package/temp/build/pi-desk/release/.next/static/chunks/{51474-8dc714cb76b2e60a.js → 65350-23bb961d87addf14.js} +3 -3
  172. package/temp/build/pi-desk/release/.next/static/chunks/app/_global-error/page-295cb63da5f7262f.js +1 -0
  173. package/temp/build/pi-desk/release/.next/static/chunks/app/_not-found/page-295cb63da5f7262f.js +1 -0
  174. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth/login/route-295cb63da5f7262f.js +1 -0
  175. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth/logout/route-295cb63da5f7262f.js +1 -0
  176. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth-settings/get/route-295cb63da5f7262f.js +1 -0
  177. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth-settings/replace/route-295cb63da5f7262f.js +1 -0
  178. package/temp/build/pi-desk/release/.next/static/chunks/app/api/capability-modes/get/route-295cb63da5f7262f.js +1 -0
  179. package/temp/build/pi-desk/release/.next/static/chunks/app/api/capability-modes/replace/route-295cb63da5f7262f.js +1 -0
  180. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/context/get/route-295cb63da5f7262f.js +1 -0
  181. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/images/get/route-295cb63da5f7262f.js +1 -0
  182. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/messages/get/route-295cb63da5f7262f.js +1 -0
  183. package/temp/build/pi-desk/release/.next/static/chunks/app/api/health/route-295cb63da5f7262f.js +1 -0
  184. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-check/get/route-295cb63da5f7262f.js +1 -0
  185. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/del/route-295cb63da5f7262f.js +1 -0
  186. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/get/route-295cb63da5f7262f.js +1 -0
  187. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/replace/route-295cb63da5f7262f.js +1 -0
  188. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-catalog/list/route-295cb63da5f7262f.js +1 -0
  189. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/get/route-295cb63da5f7262f.js +1 -0
  190. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/preview/route-295cb63da5f7262f.js +1 -0
  191. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/replace/route-295cb63da5f7262f.js +1 -0
  192. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directories/list/route-295cb63da5f7262f.js +1 -0
  193. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-entries/list/route-295cb63da5f7262f.js +1 -0
  194. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-ignores/list/route-295cb63da5f7262f.js +1 -0
  195. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-ignores/replace/route-295cb63da5f7262f.js +1 -0
  196. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/models/list/route-295cb63da5f7262f.js +1 -0
  197. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/session-user-messages/list/route-295cb63da5f7262f.js +1 -0
  198. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/sessions/list/route-295cb63da5f7262f.js +1 -0
  199. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/get/route-295cb63da5f7262f.js +1 -0
  200. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/search/route-295cb63da5f7262f.js +1 -0
  201. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/settings-get/route-295cb63da5f7262f.js +1 -0
  202. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/settings-replace/route-295cb63da5f7262f.js +1 -0
  203. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/add/route-295cb63da5f7262f.js +1 -0
  204. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/apply/route-295cb63da5f7262f.js +1 -0
  205. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/batch/route-295cb63da5f7262f.js +1 -0
  206. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route-295cb63da5f7262f.js +1 -0
  207. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/del/route-295cb63da5f7262f.js +1 -0
  208. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/enabled-set/route-295cb63da5f7262f.js +1 -0
  209. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/get/route-295cb63da5f7262f.js +1 -0
  210. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route-295cb63da5f7262f.js +1 -0
  211. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/list/route-295cb63da5f7262f.js +1 -0
  212. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/reload/route-295cb63da5f7262f.js +1 -0
  213. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/update/route-295cb63da5f7262f.js +1 -0
  214. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/get/route-295cb63da5f7262f.js +1 -0
  215. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/list/route-295cb63da5f7262f.js +1 -0
  216. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/reveal/route-295cb63da5f7262f.js +1 -0
  217. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/search/route-295cb63da5f7262f.js +1 -0
  218. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git/get/route-295cb63da5f7262f.js +1 -0
  219. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-branches/list/route-295cb63da5f7262f.js +1 -0
  220. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-changes/list/route-295cb63da5f7262f.js +1 -0
  221. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-diff/get/route-295cb63da5f7262f.js +1 -0
  222. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-heads/get/route-295cb63da5f7262f.js +1 -0
  223. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-log/list/route-295cb63da5f7262f.js +1 -0
  224. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-model-default/get/route-295cb63da5f7262f.js +1 -0
  225. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-model-default/replace/route-295cb63da5f7262f.js +1 -0
  226. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/get/route-295cb63da5f7262f.js +1 -0
  227. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/list/route-295cb63da5f7262f.js +1 -0
  228. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/replace/route-295cb63da5f7262f.js +1 -0
  229. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skills/list/route-295cb63da5f7262f.js +1 -0
  230. package/temp/build/pi-desk/release/.next/static/chunks/app/api/task-center/images/get/route-295cb63da5f7262f.js +1 -0
  231. package/temp/build/pi-desk/release/.next/static/chunks/app/api/task-center/messages/get/route-295cb63da5f7262f.js +1 -0
  232. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-git-branch/add/route-295cb63da5f7262f.js +1 -0
  233. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-git-branch/replace/route-295cb63da5f7262f.js +1 -0
  234. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-tree/get/route-295cb63da5f7262f.js +1 -0
  235. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-tree-entry/get/route-295cb63da5f7262f.js +1 -0
  236. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/add/route-295cb63da5f7262f.js +1 -0
  237. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/branch/route-295cb63da5f7262f.js +1 -0
  238. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/del/route-295cb63da5f7262f.js +1 -0
  239. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/rename/route-295cb63da5f7262f.js +1 -0
  240. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/replace/route-295cb63da5f7262f.js +1 -0
  241. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/search/route-295cb63da5f7262f.js +1 -0
  242. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/sort/route-295cb63da5f7262f.js +1 -0
  243. package/temp/build/pi-desk/release/.next/static/chunks/app/layout-2c6a573d3004516e.js +1 -0
  244. package/temp/build/pi-desk/release/.next/static/chunks/app/login/{page-0d3d4827802108e5.js → page-0df9df996aa68060.js} +1 -1
  245. package/temp/build/pi-desk/release/.next/static/chunks/app/page-f78be007d97f0d95.js +158 -0
  246. package/temp/build/pi-desk/release/.next/static/chunks/app/project-preview/{page-038b6c14e03ed878.js → page-e1dbfcfc0f333e01.js} +1 -1
  247. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/app-error-295cb63da5f7262f.js +1 -0
  248. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/forbidden-295cb63da5f7262f.js +1 -0
  249. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/unauthorized-295cb63da5f7262f.js +1 -0
  250. package/temp/build/pi-desk/release/.next/static/css/{1e780a4936aa6ba3.css → 2bb393927ba8f71d.css} +1 -1
  251. package/temp/build/pi-desk/release/.next/static/css/3a07dcc86ffdf88c.css +1 -0
  252. package/temp/build/pi-desk/release/.next/static/css/a677e7fbf6e2173e.css +1 -0
  253. package/temp/build/pi-desk/release/.next/trace-build +1 -1
  254. package/temp/build/pi-desk/release/.next/server/chunks/35348.js +0 -3
  255. package/temp/build/pi-desk/release/.next/server/chunks/56830.js +0 -235
  256. package/temp/build/pi-desk/release/.next/server/chunks/80780.js +0 -1
  257. package/temp/build/pi-desk/release/.next/static/6a4eIEjmpW5l8Qlgtzzzg/_buildManifest.js +0 -1
  258. package/temp/build/pi-desk/release/.next/static/chunks/11937-1d0a9822f2c7995b.js +0 -1
  259. package/temp/build/pi-desk/release/.next/static/chunks/14197-3d3ddd426ac06c9c.js +0 -3
  260. package/temp/build/pi-desk/release/.next/static/chunks/37313-d5970e2d0c270d22.js +0 -238
  261. package/temp/build/pi-desk/release/.next/static/chunks/65232-ef4e5a4174f62faf.js +0 -15
  262. package/temp/build/pi-desk/release/.next/static/chunks/79267-7d21d7cdbd7cfca1.js +0 -1
  263. package/temp/build/pi-desk/release/.next/static/chunks/app/_global-error/page-9969fe0baa238786.js +0 -1
  264. package/temp/build/pi-desk/release/.next/static/chunks/app/_not-found/page-9969fe0baa238786.js +0 -1
  265. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth/login/route-9969fe0baa238786.js +0 -1
  266. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth/logout/route-9969fe0baa238786.js +0 -1
  267. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth-settings/get/route-9969fe0baa238786.js +0 -1
  268. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth-settings/replace/route-9969fe0baa238786.js +0 -1
  269. package/temp/build/pi-desk/release/.next/static/chunks/app/api/capability-modes/get/route-9969fe0baa238786.js +0 -1
  270. package/temp/build/pi-desk/release/.next/static/chunks/app/api/capability-modes/replace/route-9969fe0baa238786.js +0 -1
  271. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/context/get/route-9969fe0baa238786.js +0 -1
  272. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/images/get/route-9969fe0baa238786.js +0 -1
  273. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/messages/get/route-9969fe0baa238786.js +0 -1
  274. package/temp/build/pi-desk/release/.next/static/chunks/app/api/health/route-9969fe0baa238786.js +0 -1
  275. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-check/get/route-9969fe0baa238786.js +0 -1
  276. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/del/route-9969fe0baa238786.js +0 -1
  277. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/get/route-9969fe0baa238786.js +0 -1
  278. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/replace/route-9969fe0baa238786.js +0 -1
  279. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-catalog/list/route-9969fe0baa238786.js +0 -1
  280. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/get/route-9969fe0baa238786.js +0 -1
  281. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/preview/route-9969fe0baa238786.js +0 -1
  282. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/replace/route-9969fe0baa238786.js +0 -1
  283. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directories/list/route-9969fe0baa238786.js +0 -1
  284. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-entries/list/route-9969fe0baa238786.js +0 -1
  285. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-ignores/list/route-9969fe0baa238786.js +0 -1
  286. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-ignores/replace/route-9969fe0baa238786.js +0 -1
  287. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/models/list/route-9969fe0baa238786.js +0 -1
  288. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/session-user-messages/list/route-9969fe0baa238786.js +0 -1
  289. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/sessions/list/route-9969fe0baa238786.js +0 -1
  290. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/get/route-9969fe0baa238786.js +0 -1
  291. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/search/route-9969fe0baa238786.js +0 -1
  292. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/settings-get/route-9969fe0baa238786.js +0 -1
  293. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/settings-replace/route-9969fe0baa238786.js +0 -1
  294. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/add/route-9969fe0baa238786.js +0 -1
  295. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/apply/route-9969fe0baa238786.js +0 -1
  296. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/batch/route-9969fe0baa238786.js +0 -1
  297. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route-9969fe0baa238786.js +0 -1
  298. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/del/route-9969fe0baa238786.js +0 -1
  299. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/enabled-set/route-9969fe0baa238786.js +0 -1
  300. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/get/route-9969fe0baa238786.js +0 -1
  301. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route-9969fe0baa238786.js +0 -1
  302. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/list/route-9969fe0baa238786.js +0 -1
  303. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/reload/route-9969fe0baa238786.js +0 -1
  304. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/update/route-9969fe0baa238786.js +0 -1
  305. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/get/route-9969fe0baa238786.js +0 -1
  306. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/list/route-9969fe0baa238786.js +0 -1
  307. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/reveal/route-9969fe0baa238786.js +0 -1
  308. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/search/route-9969fe0baa238786.js +0 -1
  309. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git/get/route-9969fe0baa238786.js +0 -1
  310. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-branches/list/route-9969fe0baa238786.js +0 -1
  311. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-changes/list/route-9969fe0baa238786.js +0 -1
  312. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-diff/get/route-9969fe0baa238786.js +0 -1
  313. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-heads/get/route-9969fe0baa238786.js +0 -1
  314. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-log/list/route-9969fe0baa238786.js +0 -1
  315. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-model-default/get/route-9969fe0baa238786.js +0 -1
  316. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-model-default/replace/route-9969fe0baa238786.js +0 -1
  317. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/get/route-9969fe0baa238786.js +0 -1
  318. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/list/route-9969fe0baa238786.js +0 -1
  319. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/replace/route-9969fe0baa238786.js +0 -1
  320. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skills/list/route-9969fe0baa238786.js +0 -1
  321. package/temp/build/pi-desk/release/.next/static/chunks/app/api/task-center/images/get/route-9969fe0baa238786.js +0 -1
  322. package/temp/build/pi-desk/release/.next/static/chunks/app/api/task-center/messages/get/route-9969fe0baa238786.js +0 -1
  323. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-git-branch/add/route-9969fe0baa238786.js +0 -1
  324. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-git-branch/replace/route-9969fe0baa238786.js +0 -1
  325. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-tree/get/route-9969fe0baa238786.js +0 -1
  326. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-tree-entry/get/route-9969fe0baa238786.js +0 -1
  327. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/add/route-9969fe0baa238786.js +0 -1
  328. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/branch/route-9969fe0baa238786.js +0 -1
  329. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/del/route-9969fe0baa238786.js +0 -1
  330. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/rename/route-9969fe0baa238786.js +0 -1
  331. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/replace/route-9969fe0baa238786.js +0 -1
  332. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/sort/route-9969fe0baa238786.js +0 -1
  333. package/temp/build/pi-desk/release/.next/static/chunks/app/layout-20718f1503910291.js +0 -1
  334. package/temp/build/pi-desk/release/.next/static/chunks/app/page-18d63fd3920dfae0.js +0 -158
  335. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/app-error-9969fe0baa238786.js +0 -1
  336. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/forbidden-9969fe0baa238786.js +0 -1
  337. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/unauthorized-9969fe0baa238786.js +0 -1
  338. package/temp/build/pi-desk/release/.next/static/css/2c3b0c0ff1f49c68.css +0 -1
  339. package/temp/build/pi-desk/release/.next/static/css/c43b04c244a64fb4.css +0 -1
  340. /package/temp/build/pi-desk/release/.next/static/{6a4eIEjmpW5l8Qlgtzzzg → Yyfg-r17aYmEzlYYlIwDo}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (()=>{var a={};a.id=86637,a.ids=[86637],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},2002:(a,b,c)=>{"use strict";c.d(b,{Od:()=>s,tU:()=>o,hE:()=>r,Sp:()=>g,P9:()=>f,_G:()=>k,Vc:()=>j});var d=c(59473);c(48452);let e=d.Ik({key:d.Yj().min(1).max(160),params:d.g1(d.Yj().min(1).max(80),d.KC([d.Yj().max(1e3),d.ai().finite()])).optional()}).strict(),f=4001,g=4003,h=d.Yj().trim().min(1),i=d.Yj().uuid();function j(a){return Object.freeze({op:"req",path:h.parse(a.path),inputSchema:a.inputSchema,outputSchema:a.outputSchema,...void 0===a.timeoutMs?{}:{timeoutMs:d.ai().int().positive().parse(a.timeoutMs)}})}function k(a){return Object.freeze({op:"push",path:h.parse(a.path),bodySchema:a.bodySchema})}let l=d.Ik({op:d.eu("req"),path:h,requestId:i}).strict(),m=d.Ik({op:d.eu("resp"),path:h,requestId:i}).strict(),n=d.Ik({op:d.eu("push"),path:h}).strict(),o=d.Ik({head:l,body:d.Pq()}).strict(),p=d.Ik({head:m,body:d.Ik({code:d.eu(0),msg:d.eu(""),data:d.Pq()}).strict()}).strict(),q=d.Ik({head:m,body:d.Ik({code:d.ai().int().positive(),msg:d.Yj().min(1),data:d.ch(),i18n:e.optional()}).strict()}).strict(),r=d.KC([p,q]),s=d.Ik({head:n,body:d.Pq()}).strict()},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},8602:(a,b,c)=>{"use strict";function d(a,b=200){return Response.json({code:0,msg:"",data:a},{status:b})}function e(a,b,c){let d={code:a,msg:b,data:null,...c?{i18n:c}:{}};return Response.json(d,{status:a})}c.d(b,{e:()=>e,n:()=>d})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13578:(a,b,c)=>{"use strict";c.d(b,{IC:()=>h,J:()=>i,eL:()=>f});var d=c(77598),e=c(57075);class f extends Error{constructor(a,b){super(`Plugin Browser resource was not found: ${a}/${b}`),this.name="L4PiPluginBrowserResourceNotFoundError"}}class g{replace(a){let b=new Set(a.map(a=>a.pluginName));if(b.size!==a.length)throw Error("Browser Entry 清单包含重复插件");if(a.reduce((a,b)=>a+b.snapshot.size,0)>0x8000000)throw Error("Browser 活动资源超过容量上限");for(let[a,c]of this.recordsByPlugin)b.has(a)||(this.recordsByPlugin.delete(a),this.retire(c));let c=a.map(a=>{let b=this.recordsByPlugin.get(a.pluginName),c=b?.resourceKey===a.resourceKey&&b.entryPath===a.entryPath?b:{pluginName:a.pluginName,resourceGroup:(0,d.randomBytes)(24).toString("base64url"),resourceKey:a.resourceKey,entryPath:a.entryPath,snapshot:a.snapshot,retiredAt:null};return b!==c&&(b&&this.retire(b),this.recordsByPlugin.set(a.pluginName,c),this.recordsByGroup.set(c.resourceGroup,c)),{resourceGroup:c.resourceGroup,url:`/api/plugins/browser-resources/${c.resourceGroup}/entry.js`,entry:a}});return this.prune(),c}async read(a,b){this.prune();let c=this.recordsByGroup.get(a),d=!(!b||b.length>4096||b.startsWith("/")||b.includes("\\")||b.includes("\0"))&&b.endsWith(".js")&&b.split("/").every(a=>""!==a&&"."!==a&&".."!==a)?c?.snapshot.modules.get(b):void 0;if(!d)throw new f(a,b);return{stream:e.Readable.toWeb(e.Readable.from([d.content])),size:d.content.length,etag:d.etag}}dispose(){this.pruneTimer&&clearTimeout(this.pruneTimer),this.pruneTimer=null,this.recordsByPlugin.clear(),this.recordsByGroup.clear()}retire(a){a.retiredAt??=Date.now()}prune(){this.pruneTimer&&clearTimeout(this.pruneTimer),this.pruneTimer=null;let a=Date.now(),b=[...this.recordsByGroup.values()].filter(a=>null!==a.retiredAt).sort((a,b)=>a.retiredAt-b.retiredAt),c=b.reduce((a,b)=>a+b.snapshot.size,0),d=b.length;for(let e of b)(a-e.retiredAt>=6e4||d>32||c>0x4000000)&&(this.recordsByGroup.delete(e.resourceGroup),c-=e.snapshot.size,d-=1);let e=b.find(a=>this.recordsByGroup.has(a.resourceGroup));e&&(this.pruneTimer=setTimeout(()=>this.prune(),Math.max(1,e.retiredAt+6e4-a)),this.pruneTimer.unref())}constructor(){this.recordsByPlugin=new Map,this.recordsByGroup=new Map,this.pruneTimer=null}}function h(){return globalThis.__piDeskPluginBrowserResourceRegistry||(globalThis.__piDeskPluginBrowserResourceRegistry=new g),globalThis.__piDeskPluginBrowserResourceRegistry}function i(){globalThis.__piDeskPluginBrowserResourceRegistry?.dispose(),globalThis.__piDeskPluginBrowserResourceRegistry=void 0}},17862:()=>{},24187:(a,b,c)=>{"use strict";c.d(b,{Dz:()=>h,f7:()=>g,tv:()=>f});var d=c(59473);let e=d.Yj().trim().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),f=e,g=e,h=d.g1(d.Yj(),d.Pq());d.Yj().trim().min(3).max(129).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/);let i=d.k5(["plugin","server","rocket","settings","panel","message","terminal","file","folder","bot","wrench","database","globe"]);d.gM("type",[d.Ik({type:d.eu("builtin"),name:i}).strict(),d.Ik({type:d.eu("svg"),content:d.Yj().trim().min(1).max(16384)}).strict()])},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},35166:()=>{},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48452:(a,b,c)=>{"use strict";c.d(b,{Y:()=>f,n:()=>e});var d=c(59473);let e="X-Pi-Desk-Client-Id",f=d.Yj().uuid()},49210:(a,b,c)=>{"use strict";a.exports=c(44870)},57075:a=>{"use strict";a.exports=require("node:stream")},59587:(a,b,c)=>{"use strict";c.d(b,{Jz:()=>g,bm:()=>n,iT:()=>i,sd:()=>j});var d=c(59473),e=c(2002),f=c(24187);let g=d.Yj().min(32).max(128).regex(/^[A-Za-z0-9_-]+$/),h="/api/plugins/host-runtime/v1",i=Object.freeze({imports:Object.freeze({react:`${h}/base.js`,"react/jsx-runtime":`${h}/base.js`,"react/jsx-dev-runtime":`${h}/base.js`,"react-dom":`${h}/base.js`,"react-dom/client":`${h}/base.js`,"@jetcrab/pi-desk-sdk/react/base":`${h}/base.js`,"@jetcrab/pi-desk-sdk/react/markdown":`${h}/markdown.js`})}),j=d.eu("v1"),k=d.Ik({pluginName:f.tv,url:d.Yj().regex(/^\/api\/plugins\/browser-resources\/[A-Za-z0-9_-]{32,128}\/entry\.js$/,"Browser Entry URL 无效")}).strict(),l=d.Ik({}).strict(),m=d.Ik({entries:d.YO(k)}).strict(),n=Object.freeze({list:(0,e.Vc)({path:"plugins/browser-entries/list",inputSchema:l,outputSchema:m})})},61435:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route",pathname:"/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]",filename:"route",bundlePath:"app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route.ts",nextConfigOutput:"",userland:()=>c(63986),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63986:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>h});var d=c(59587),e=c(8602),f=c(13578);function g(a,b){return{"Cache-Control":"no-cache","Content-Type":"text/javascript; charset=utf-8",ETag:a,"X-Content-Type-Options":"nosniff",...void 0===b?{}:{"Content-Length":String(b)}}}async function h(a,b){let{resourceGroup:c,resourcePath:h}=await b.params,i=d.Jz.safeParse(c),j=h.join("/");if(!i.success||!j.endsWith(".js"))return(0,e.e)(404,"插件资源不存在",{key:"errors:pluginResourceMissing"});try{let b=await (0,f.IC)().read(i.data,j);if(a.headers.get("If-None-Match")===b.etag)return new Response(null,{status:304,headers:g(b.etag)});return new Response(b.stream,{status:200,headers:g(b.etag,b.size)})}catch(a){if(a instanceof f.eL||a instanceof Error&&"L4PiPluginBrowserResourceNotFoundError"===a.name)return(0,e.e)(404,"插件资源不存在",{key:"errors:pluginResourceMissing"});return console.error("[Pi Desk][PluginBrowserResourceApi] 读取 Browser 资源失败",{resourceGroup:i.data,resourcePath:j,errorName:a instanceof Error?a.name:"UnknownError"}),(0,e.e)(500,"读取插件资源失败",{key:"errors:pluginResourceReadFailed"})}}},77598:a=>{"use strict";a.exports=require("node:crypto")},81147:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473],()=>b(b.s=61435));module.exports=c})();
1
+ (()=>{var a={};a.id=86637,a.ids=[86637],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},2002:(a,b,c)=>{"use strict";c.d(b,{Od:()=>s,tU:()=>o,hE:()=>r,Sp:()=>g,P9:()=>f,_G:()=>k,Vc:()=>j});var d=c(59473);c(48452);let e=d.Ik({key:d.Yj().min(1).max(160),params:d.g1(d.Yj().min(1).max(80),d.KC([d.Yj().max(1e3),d.ai().finite()])).optional()}).strict(),f=4001,g=4003,h=d.Yj().trim().min(1),i=d.Yj().uuid();function j(a){return Object.freeze({op:"req",path:h.parse(a.path),inputSchema:a.inputSchema,outputSchema:a.outputSchema,...void 0===a.timeoutMs?{}:{timeoutMs:d.ai().int().positive().parse(a.timeoutMs)}})}function k(a){return Object.freeze({op:"push",path:h.parse(a.path),bodySchema:a.bodySchema})}let l=d.Ik({op:d.eu("req"),path:h,requestId:i}).strict(),m=d.Ik({op:d.eu("resp"),path:h,requestId:i}).strict(),n=d.Ik({op:d.eu("push"),path:h}).strict(),o=d.Ik({head:l,body:d.Pq()}).strict(),p=d.Ik({head:m,body:d.Ik({code:d.eu(0),msg:d.eu(""),data:d.Pq()}).strict()}).strict(),q=d.Ik({head:m,body:d.Ik({code:d.ai().int().positive(),msg:d.Yj().min(1),data:d.ch(),i18n:e.optional()}).strict()}).strict(),r=d.KC([p,q]),s=d.Ik({head:n,body:d.Pq()}).strict()},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},8602:(a,b,c)=>{"use strict";function d(a,b=200){return Response.json({code:0,msg:"",data:a},{status:b})}function e(a,b,c){let d={code:a,msg:b,data:null,...c?{i18n:c}:{}};return Response.json(d,{status:a})}c.d(b,{e:()=>e,n:()=>d})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13578:(a,b,c)=>{"use strict";c.d(b,{IC:()=>h,J:()=>i,eL:()=>f});var d=c(77598),e=c(57075);class f extends Error{constructor(a,b){super(`Plugin Browser resource was not found: ${a}/${b}`),this.name="L4PiPluginBrowserResourceNotFoundError"}}class g{replace(a){let b=new Set(a.map(a=>a.pluginName));if(b.size!==a.length)throw Error("Browser Entry 清单包含重复插件");if(a.reduce((a,b)=>a+b.snapshot.size,0)>0x8000000)throw Error("Browser 活动资源超过容量上限");for(let[a,c]of this.recordsByPlugin)b.has(a)||(this.recordsByPlugin.delete(a),this.retire(c));let c=a.map(a=>{let b=this.recordsByPlugin.get(a.pluginName),c=b?.resourceKey===a.resourceKey&&b.entryPath===a.entryPath?b:{pluginName:a.pluginName,resourceGroup:(0,d.randomBytes)(24).toString("base64url"),resourceKey:a.resourceKey,entryPath:a.entryPath,snapshot:a.snapshot,retiredAt:null};return b!==c&&(b&&this.retire(b),this.recordsByPlugin.set(a.pluginName,c),this.recordsByGroup.set(c.resourceGroup,c)),{resourceGroup:c.resourceGroup,url:`/api/plugins/browser-resources/${c.resourceGroup}/entry.js`,entry:a}});return this.prune(),c}async read(a,b){this.prune();let c=this.recordsByGroup.get(a),d=!(!b||b.length>4096||b.startsWith("/")||b.includes("\\")||b.includes("\0"))&&b.endsWith(".js")&&b.split("/").every(a=>""!==a&&"."!==a&&".."!==a)?c?.snapshot.modules.get(b):void 0;if(!d)throw new f(a,b);return{stream:e.Readable.toWeb(e.Readable.from([d.content])),size:d.content.length,etag:d.etag}}dispose(){this.pruneTimer&&clearTimeout(this.pruneTimer),this.pruneTimer=null,this.recordsByPlugin.clear(),this.recordsByGroup.clear()}retire(a){a.retiredAt??=Date.now()}prune(){this.pruneTimer&&clearTimeout(this.pruneTimer),this.pruneTimer=null;let a=Date.now(),b=[...this.recordsByGroup.values()].filter(a=>null!==a.retiredAt).sort((a,b)=>a.retiredAt-b.retiredAt),c=b.reduce((a,b)=>a+b.snapshot.size,0),d=b.length;for(let e of b)(a-e.retiredAt>=6e4||d>32||c>0x4000000)&&(this.recordsByGroup.delete(e.resourceGroup),c-=e.snapshot.size,d-=1);let e=b.find(a=>this.recordsByGroup.has(a.resourceGroup));e&&(this.pruneTimer=setTimeout(()=>this.prune(),Math.max(1,e.retiredAt+6e4-a)),this.pruneTimer.unref())}constructor(){this.recordsByPlugin=new Map,this.recordsByGroup=new Map,this.pruneTimer=null}}function h(){return globalThis.__piDeskPluginBrowserResourceRegistry||(globalThis.__piDeskPluginBrowserResourceRegistry=new g),globalThis.__piDeskPluginBrowserResourceRegistry}function i(){globalThis.__piDeskPluginBrowserResourceRegistry?.dispose(),globalThis.__piDeskPluginBrowserResourceRegistry=void 0}},17862:()=>{},24187:(a,b,c)=>{"use strict";c.d(b,{Dz:()=>h,f7:()=>g,tv:()=>f});var d=c(59473);let e=d.Yj().trim().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),f=e,g=e,h=d.g1(d.Yj(),d.Pq());d.Yj().trim().min(3).max(129).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/);let i=d.k5(["plugin","server","rocket","settings","panel","message","terminal","file","folder","bot","wrench","database","globe"]);d.gM("type",[d.Ik({type:d.eu("builtin"),name:i}).strict(),d.Ik({type:d.eu("svg"),content:d.Yj().trim().min(1).max(16384)}).strict()])},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},35166:()=>{},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48452:(a,b,c)=>{"use strict";c.d(b,{Y:()=>f,n:()=>e});var d=c(59473);let e="X-Pi-Desk-Client-Id",f=d.Yj().uuid()},49210:(a,b,c)=>{"use strict";a.exports=c(44870)},56579:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route",pathname:"/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]",filename:"route",bundlePath:"app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route.ts",nextConfigOutput:"",userland:()=>c(63986),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},57075:a=>{"use strict";a.exports=require("node:stream")},59587:(a,b,c)=>{"use strict";c.d(b,{Jz:()=>g,bm:()=>n,iT:()=>i,sd:()=>j});var d=c(59473),e=c(2002),f=c(24187);let g=d.Yj().min(32).max(128).regex(/^[A-Za-z0-9_-]+$/),h="/api/plugins/host-runtime/v1",i=Object.freeze({imports:Object.freeze({react:`${h}/base.js`,"react/jsx-runtime":`${h}/base.js`,"react/jsx-dev-runtime":`${h}/base.js`,"react-dom":`${h}/base.js`,"react-dom/client":`${h}/base.js`,"@jetcrab/pi-desk-sdk/react/base":`${h}/base.js`,"@jetcrab/pi-desk-sdk/react/markdown":`${h}/markdown.js`})}),j=d.eu("v1"),k=d.Ik({pluginName:f.tv,url:d.Yj().regex(/^\/api\/plugins\/browser-resources\/[A-Za-z0-9_-]{32,128}\/entry\.js$/,"Browser Entry URL 无效")}).strict(),l=d.Ik({}).strict(),m=d.Ik({entries:d.YO(k)}).strict(),n=Object.freeze({list:(0,e.Vc)({path:"plugins/browser-entries/list",inputSchema:l,outputSchema:m})})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63986:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>h});var d=c(59587),e=c(8602),f=c(13578);function g(a,b){return{"Cache-Control":"no-cache","Content-Type":"text/javascript; charset=utf-8",ETag:a,"X-Content-Type-Options":"nosniff",...void 0===b?{}:{"Content-Length":String(b)}}}async function h(a,b){let{resourceGroup:c,resourcePath:h}=await b.params,i=d.Jz.safeParse(c),j=h.join("/");if(!i.success||!j.endsWith(".js"))return(0,e.e)(404,"插件资源不存在",{key:"errors:pluginResourceMissing"});try{let b=await (0,f.IC)().read(i.data,j);if(a.headers.get("If-None-Match")===b.etag)return new Response(null,{status:304,headers:g(b.etag)});return new Response(b.stream,{status:200,headers:g(b.etag,b.size)})}catch(a){if(a instanceof f.eL||a instanceof Error&&"L4PiPluginBrowserResourceNotFoundError"===a.name)return(0,e.e)(404,"插件资源不存在",{key:"errors:pluginResourceMissing"});return console.error("[Pi Desk][PluginBrowserResourceApi] 读取 Browser 资源失败",{resourceGroup:i.data,resourcePath:j,errorName:a instanceof Error?a.name:"UnknownError"}),(0,e.e)(500,"读取插件资源失败",{key:"errors:pluginResourceReadFailed"})}}},77598:a=>{"use strict";a.exports=require("node:crypto")},81147:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473],()=>b(b.s=56579));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=24768,a.ids=[24768],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},42124:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.Cn});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},53541:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/del/route",pathname:"/api/plugins/del",filename:"route",bundlePath:"app/api/plugins/del/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/del/route.ts",nextConfigOutput:"",userland:()=>c(42124),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/del/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93736:a=>{a.exports=import("jiti")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=53541));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=24768,a.ids=[24768],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},39385:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/del/route",pathname:"/api/plugins/del",filename:"route",bundlePath:"app/api/plugins/del/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/del/route.ts",nextConfigOutput:"",userland:()=>c(42124),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/del/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},42124:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.Cn});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93736:a=>{a.exports=import("jiti")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=39385));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=97411,a.ids=[97411],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91445:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.AV});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},93736:a=>{a.exports=import("jiti")},98355:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/enabled-set/route",pathname:"/api/plugins/enabled-set",filename:"route",bundlePath:"app/api/plugins/enabled-set/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/enabled-set/route.ts",nextConfigOutput:"",userland:()=>c(91445),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/enabled-set/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=98355));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=97411,a.ids=[97411],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},46203:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/enabled-set/route",pathname:"/api/plugins/enabled-set",filename:"route",bundlePath:"app/api/plugins/enabled-set/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/enabled-set/route.ts",nextConfigOutput:"",userland:()=>c(91445),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/enabled-set/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91445:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.AV});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},93736:a=>{a.exports=import("jiti")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=46203));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=10307,a.ids=[10307],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},515:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/get/route",pathname:"/api/plugins/get",filename:"route",bundlePath:"app/api/plugins/get/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/get/route.ts",nextConfigOutput:"",userland:()=>c(54845),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/get/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},54845:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.ZX});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93736:a=>{a.exports=import("jiti")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=515));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=10307,a.ids=[10307],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},39403:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/get/route",pathname:"/api/plugins/get",filename:"route",bundlePath:"app/api/plugins/get/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/get/route.ts",nextConfigOutput:"",userland:()=>c(54845),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/get/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},54845:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.ZX});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93736:a=>{a.exports=import("jiti")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=39403));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=67069,a.ids=[67069],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},2002:(a,b,c)=>{"use strict";c.d(b,{Od:()=>s,tU:()=>o,hE:()=>r,Sp:()=>g,P9:()=>f,_G:()=>k,Vc:()=>j});var d=c(59473);c(48452);let e=d.Ik({key:d.Yj().min(1).max(160),params:d.g1(d.Yj().min(1).max(80),d.KC([d.Yj().max(1e3),d.ai().finite()])).optional()}).strict(),f=4001,g=4003,h=d.Yj().trim().min(1),i=d.Yj().uuid();function j(a){return Object.freeze({op:"req",path:h.parse(a.path),inputSchema:a.inputSchema,outputSchema:a.outputSchema,...void 0===a.timeoutMs?{}:{timeoutMs:d.ai().int().positive().parse(a.timeoutMs)}})}function k(a){return Object.freeze({op:"push",path:h.parse(a.path),bodySchema:a.bodySchema})}let l=d.Ik({op:d.eu("req"),path:h,requestId:i}).strict(),m=d.Ik({op:d.eu("resp"),path:h,requestId:i}).strict(),n=d.Ik({op:d.eu("push"),path:h}).strict(),o=d.Ik({head:l,body:d.Pq()}).strict(),p=d.Ik({head:m,body:d.Ik({code:d.eu(0),msg:d.eu(""),data:d.Pq()}).strict()}).strict(),q=d.Ik({head:m,body:d.Ik({code:d.ai().int().positive(),msg:d.Yj().min(1),data:d.ch(),i18n:e.optional()}).strict()}).strict(),r=d.KC([p,q]),s=d.Ik({head:n,body:d.Pq()}).strict()},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},8602:(a,b,c)=>{"use strict";function d(a,b=200){return Response.json({code:0,msg:"",data:a},{status:b})}function e(a,b,c){let d={code:a,msg:b,data:null,...c?{i18n:c}:{}};return Response.json(d,{status:a})}c.d(b,{e:()=>e,n:()=>d})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},17862:()=>{},18975:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route",pathname:"/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]",filename:"route",bundlePath:"app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route.ts",nextConfigOutput:"",userland:()=>c(44365),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},24187:(a,b,c)=>{"use strict";c.d(b,{Dz:()=>h,f7:()=>g,tv:()=>f});var d=c(59473);let e=d.Yj().trim().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),f=e,g=e,h=d.g1(d.Yj(),d.Pq());d.Yj().trim().min(3).max(129).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/);let i=d.k5(["plugin","server","rocket","settings","panel","message","terminal","file","folder","bot","wrench","database","globe"]);d.gM("type",[d.Ik({type:d.eu("builtin"),name:i}).strict(),d.Ik({type:d.eu("svg"),content:d.Yj().trim().min(1).max(16384)}).strict()])},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},35166:()=>{},44365:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>q});var d=c(59587),e=c(8602),f=c(73024),g=c(51455),h=c(76760),i=c(57075);let j=(0,h.join)("node_modules","@jetcrab","pi-desk-sdk","dist","host-runtime"),k=null;class l extends Error{constructor(a){super(`Pi Desk Host Browser resource was not found: ${a}`),this.name="L4PiPluginHostBrowserResourceNotFoundError"}}class m extends Error{constructor(a){super(`Pi Desk Host Browser Runtime is unavailable: ${a instanceof Error?a.message:String(a)}`),this.name="L4PiPluginHostBrowserRuntimeUnavailableError"}}function n(a,b){let c=(0,h.relative)(a,b);return""===c||!c.startsWith("..")&&!(0,h.isAbsolute)(c)}async function o(a){let b,c,d,e=function(a){if(!a||a.length>4096||a.startsWith("/")||a.includes("\\")||a.includes("\0")||!a.endsWith(".js"))return null;let b=a.split("/");return b.some(a=>!a||"."===a||".."===a)?null:b}(a);if(!e)throw new l(a);let o=function(){if(k)return k;let a=process.argv[1]?.trim(),b=[a?(0,h.dirname)((0,h.resolve)(a)):null,process.cwd()].filter(a=>null!==a),c=new Set;for(let a of b){let b=a;for(;!c.has(b);){c.add(b);try{return k=(0,f.realpathSync)((0,h.join)(b,j))}catch{let a=(0,h.dirname)(b);if(a===b)break;b=a}}}throw new m(Error("Cannot locate @jetcrab/pi-desk-sdk Host Runtime directory"))}(),p=(0,h.resolve)(o,...e);if(!n(o,p))throw new l(a);try{[b,c]=await Promise.all([(0,g.realpath)(o),(0,g.realpath)(p)])}catch(b){throw console.warn("[Pi Desk][PluginHostRuntime] 公共资源路径解析失败",{resourcePath:a,rootPath:o,requestedPath:p,errorName:b instanceof Error?b.name:"UnknownError",message:b instanceof Error?b.message:String(b)}),new l(a)}if(!n(b,c))throw new l(a);try{d=await (0,g.stat)(c)}catch{throw new l(a)}if(!d.isFile())throw new l(a);let q=`W/"${d.size.toString(16)}-${Math.trunc(d.mtimeMs).toString(16)}"`;return{stream:i.Readable.toWeb((0,f.createReadStream)(c)),size:d.size,etag:q}}function p(a,b){return{"Cache-Control":"no-cache","Content-Type":"text/javascript; charset=utf-8",ETag:a,"X-Content-Type-Options":"nosniff",...void 0===b?{}:{"Content-Length":String(b)}}}async function q(a,b){let{runtimeVersion:c,resourcePath:f}=await b.params,g=d.sd.safeParse(c),h=f.join("/");if(!g.success||!h.endsWith(".js"))return(0,e.e)(404,"Host 公共插件资源不存在",{key:"errors:hostResourceMissing"});try{let b=await o(h);if(a.headers.get("If-None-Match")===b.etag)return new Response(null,{status:304,headers:p(b.etag)});return new Response(b.stream,{status:200,headers:p(b.etag,b.size)})}catch(a){if(a instanceof l)return(0,e.e)(404,"Host 公共插件资源不存在",{key:"errors:hostResourceMissing"});if(a instanceof m)return console.error("[Pi Desk][PluginHostRuntimeApi] 公共 Runtime 不可用",{runtimeVersion:g.data,resourcePath:h,errorName:a.name,message:a.message}),(0,e.e)(503,"Host 公共插件 Runtime 尚未构建",{key:"errors:hostRuntimeUnavailable"});return console.error("[Pi Desk][PluginHostRuntimeApi] 读取公共资源失败",{runtimeVersion:g.data,resourcePath:h,errorName:a instanceof Error?a.name:"UnknownError"}),(0,e.e)(500,"读取 Host 公共插件资源失败",{key:"errors:hostResourceReadFailed"})}}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48452:(a,b,c)=>{"use strict";c.d(b,{Y:()=>f,n:()=>e});var d=c(59473);let e="X-Pi-Desk-Client-Id",f=d.Yj().uuid()},49210:(a,b,c)=>{"use strict";a.exports=c(44870)},51455:a=>{"use strict";a.exports=require("node:fs/promises")},57075:a=>{"use strict";a.exports=require("node:stream")},59587:(a,b,c)=>{"use strict";c.d(b,{Jz:()=>g,bm:()=>n,iT:()=>i,sd:()=>j});var d=c(59473),e=c(2002),f=c(24187);let g=d.Yj().min(32).max(128).regex(/^[A-Za-z0-9_-]+$/),h="/api/plugins/host-runtime/v1",i=Object.freeze({imports:Object.freeze({react:`${h}/base.js`,"react/jsx-runtime":`${h}/base.js`,"react/jsx-dev-runtime":`${h}/base.js`,"react-dom":`${h}/base.js`,"react-dom/client":`${h}/base.js`,"@jetcrab/pi-desk-sdk/react/base":`${h}/base.js`,"@jetcrab/pi-desk-sdk/react/markdown":`${h}/markdown.js`})}),j=d.eu("v1"),k=d.Ik({pluginName:f.tv,url:d.Yj().regex(/^\/api\/plugins\/browser-resources\/[A-Za-z0-9_-]{32,128}\/entry\.js$/,"Browser Entry URL 无效")}).strict(),l=d.Ik({}).strict(),m=d.Ik({entries:d.YO(k)}).strict(),n=Object.freeze({list:(0,e.Vc)({path:"plugins/browser-entries/list",inputSchema:l,outputSchema:m})})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},76760:a=>{"use strict";a.exports=require("node:path")},81147:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473],()=>b(b.s=18975));module.exports=c})();
1
+ (()=>{var a={};a.id=67069,a.ids=[67069],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},2002:(a,b,c)=>{"use strict";c.d(b,{Od:()=>s,tU:()=>o,hE:()=>r,Sp:()=>g,P9:()=>f,_G:()=>k,Vc:()=>j});var d=c(59473);c(48452);let e=d.Ik({key:d.Yj().min(1).max(160),params:d.g1(d.Yj().min(1).max(80),d.KC([d.Yj().max(1e3),d.ai().finite()])).optional()}).strict(),f=4001,g=4003,h=d.Yj().trim().min(1),i=d.Yj().uuid();function j(a){return Object.freeze({op:"req",path:h.parse(a.path),inputSchema:a.inputSchema,outputSchema:a.outputSchema,...void 0===a.timeoutMs?{}:{timeoutMs:d.ai().int().positive().parse(a.timeoutMs)}})}function k(a){return Object.freeze({op:"push",path:h.parse(a.path),bodySchema:a.bodySchema})}let l=d.Ik({op:d.eu("req"),path:h,requestId:i}).strict(),m=d.Ik({op:d.eu("resp"),path:h,requestId:i}).strict(),n=d.Ik({op:d.eu("push"),path:h}).strict(),o=d.Ik({head:l,body:d.Pq()}).strict(),p=d.Ik({head:m,body:d.Ik({code:d.eu(0),msg:d.eu(""),data:d.Pq()}).strict()}).strict(),q=d.Ik({head:m,body:d.Ik({code:d.ai().int().positive(),msg:d.Yj().min(1),data:d.ch(),i18n:e.optional()}).strict()}).strict(),r=d.KC([p,q]),s=d.Ik({head:n,body:d.Pq()}).strict()},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},8602:(a,b,c)=>{"use strict";function d(a,b=200){return Response.json({code:0,msg:"",data:a},{status:b})}function e(a,b,c){let d={code:a,msg:b,data:null,...c?{i18n:c}:{}};return Response.json(d,{status:a})}c.d(b,{e:()=>e,n:()=>d})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},17862:()=>{},24187:(a,b,c)=>{"use strict";c.d(b,{Dz:()=>h,f7:()=>g,tv:()=>f});var d=c(59473);let e=d.Yj().trim().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),f=e,g=e,h=d.g1(d.Yj(),d.Pq());d.Yj().trim().min(3).max(129).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/);let i=d.k5(["plugin","server","rocket","settings","panel","message","terminal","file","folder","bot","wrench","database","globe"]);d.gM("type",[d.Ik({type:d.eu("builtin"),name:i}).strict(),d.Ik({type:d.eu("svg"),content:d.Yj().trim().min(1).max(16384)}).strict()])},27463:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route",pathname:"/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]",filename:"route",bundlePath:"app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route.ts",nextConfigOutput:"",userland:()=>c(44365),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},35166:()=>{},44365:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>q});var d=c(59587),e=c(8602),f=c(73024),g=c(51455),h=c(76760),i=c(57075);let j=(0,h.join)("node_modules","@jetcrab","pi-desk-sdk","dist","host-runtime"),k=null;class l extends Error{constructor(a){super(`Pi Desk Host Browser resource was not found: ${a}`),this.name="L4PiPluginHostBrowserResourceNotFoundError"}}class m extends Error{constructor(a){super(`Pi Desk Host Browser Runtime is unavailable: ${a instanceof Error?a.message:String(a)}`),this.name="L4PiPluginHostBrowserRuntimeUnavailableError"}}function n(a,b){let c=(0,h.relative)(a,b);return""===c||!c.startsWith("..")&&!(0,h.isAbsolute)(c)}async function o(a){let b,c,d,e=function(a){if(!a||a.length>4096||a.startsWith("/")||a.includes("\\")||a.includes("\0")||!a.endsWith(".js"))return null;let b=a.split("/");return b.some(a=>!a||"."===a||".."===a)?null:b}(a);if(!e)throw new l(a);let o=function(){if(k)return k;let a=process.argv[1]?.trim(),b=[a?(0,h.dirname)((0,h.resolve)(a)):null,process.cwd()].filter(a=>null!==a),c=new Set;for(let a of b){let b=a;for(;!c.has(b);){c.add(b);try{return k=(0,f.realpathSync)((0,h.join)(b,j))}catch{let a=(0,h.dirname)(b);if(a===b)break;b=a}}}throw new m(Error("Cannot locate @jetcrab/pi-desk-sdk Host Runtime directory"))}(),p=(0,h.resolve)(o,...e);if(!n(o,p))throw new l(a);try{[b,c]=await Promise.all([(0,g.realpath)(o),(0,g.realpath)(p)])}catch(b){throw console.warn("[Pi Desk][PluginHostRuntime] 公共资源路径解析失败",{resourcePath:a,rootPath:o,requestedPath:p,errorName:b instanceof Error?b.name:"UnknownError",message:b instanceof Error?b.message:String(b)}),new l(a)}if(!n(b,c))throw new l(a);try{d=await (0,g.stat)(c)}catch{throw new l(a)}if(!d.isFile())throw new l(a);let q=`W/"${d.size.toString(16)}-${Math.trunc(d.mtimeMs).toString(16)}"`;return{stream:i.Readable.toWeb((0,f.createReadStream)(c)),size:d.size,etag:q}}function p(a,b){return{"Cache-Control":"no-cache","Content-Type":"text/javascript; charset=utf-8",ETag:a,"X-Content-Type-Options":"nosniff",...void 0===b?{}:{"Content-Length":String(b)}}}async function q(a,b){let{runtimeVersion:c,resourcePath:f}=await b.params,g=d.sd.safeParse(c),h=f.join("/");if(!g.success||!h.endsWith(".js"))return(0,e.e)(404,"Host 公共插件资源不存在",{key:"errors:hostResourceMissing"});try{let b=await o(h);if(a.headers.get("If-None-Match")===b.etag)return new Response(null,{status:304,headers:p(b.etag)});return new Response(b.stream,{status:200,headers:p(b.etag,b.size)})}catch(a){if(a instanceof l)return(0,e.e)(404,"Host 公共插件资源不存在",{key:"errors:hostResourceMissing"});if(a instanceof m)return console.error("[Pi Desk][PluginHostRuntimeApi] 公共 Runtime 不可用",{runtimeVersion:g.data,resourcePath:h,errorName:a.name,message:a.message}),(0,e.e)(503,"Host 公共插件 Runtime 尚未构建",{key:"errors:hostRuntimeUnavailable"});return console.error("[Pi Desk][PluginHostRuntimeApi] 读取公共资源失败",{runtimeVersion:g.data,resourcePath:h,errorName:a instanceof Error?a.name:"UnknownError"}),(0,e.e)(500,"读取 Host 公共插件资源失败",{key:"errors:hostResourceReadFailed"})}}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48452:(a,b,c)=>{"use strict";c.d(b,{Y:()=>f,n:()=>e});var d=c(59473);let e="X-Pi-Desk-Client-Id",f=d.Yj().uuid()},49210:(a,b,c)=>{"use strict";a.exports=c(44870)},51455:a=>{"use strict";a.exports=require("node:fs/promises")},57075:a=>{"use strict";a.exports=require("node:stream")},59587:(a,b,c)=>{"use strict";c.d(b,{Jz:()=>g,bm:()=>n,iT:()=>i,sd:()=>j});var d=c(59473),e=c(2002),f=c(24187);let g=d.Yj().min(32).max(128).regex(/^[A-Za-z0-9_-]+$/),h="/api/plugins/host-runtime/v1",i=Object.freeze({imports:Object.freeze({react:`${h}/base.js`,"react/jsx-runtime":`${h}/base.js`,"react/jsx-dev-runtime":`${h}/base.js`,"react-dom":`${h}/base.js`,"react-dom/client":`${h}/base.js`,"@jetcrab/pi-desk-sdk/react/base":`${h}/base.js`,"@jetcrab/pi-desk-sdk/react/markdown":`${h}/markdown.js`})}),j=d.eu("v1"),k=d.Ik({pluginName:f.tv,url:d.Yj().regex(/^\/api\/plugins\/browser-resources\/[A-Za-z0-9_-]{32,128}\/entry\.js$/,"Browser Entry URL 无效")}).strict(),l=d.Ik({}).strict(),m=d.Ik({entries:d.YO(k)}).strict(),n=Object.freeze({list:(0,e.Vc)({path:"plugins/browser-entries/list",inputSchema:l,outputSchema:m})})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},76760:a=>{"use strict";a.exports=require("node:path")},81147:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473],()=>b(b.s=27463));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=12037,a.ids=[12037],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},52293:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/list/route",pathname:"/api/plugins/list",filename:"route",bundlePath:"app/api/plugins/list/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/list/route.ts",nextConfigOutput:"",userland:()=>c(66989),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/list/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66989:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.Kx});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93736:a=>{a.exports=import("jiti")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=52293));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=12037,a.ids=[12037],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66989:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.Kx});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93736:a=>{a.exports=import("jiti")},98457:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/list/route",pathname:"/api/plugins/list",filename:"route",bundlePath:"app/api/plugins/list/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/list/route.ts",nextConfigOutput:"",userland:()=>c(66989),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/list/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=98457));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=41106,a.ids=[41106],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},27783:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/reload/route",pathname:"/api/plugins/reload",filename:"route",bundlePath:"app/api/plugins/reload/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/reload/route.ts",nextConfigOutput:"",userland:()=>c(86264),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/reload/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86264:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.RK});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93736:a=>{a.exports=import("jiti")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=27783));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=41106,a.ids=[41106],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13768:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AV:()=>u,CM:()=>v,Cn:()=>w,Kx:()=>q,RK:()=>y,ZX:()=>r,gX:()=>t,uY:()=>s,w5:()=>x});var e=c(26519),f=c(16438),g=c(47574),h=c(6415),i=c(8602),j=c(2476),k=c(44095),l=a([f,g,k]);async function m(a){try{return await a.json()}catch{return null}}function n(a,b){return a instanceof f.eq||a instanceof Error&&"L2PluginManagementOperationConflictError"===a.name?(0,i.e)(409,a.message):a instanceof g.VB?(0,i.e)(409,a.message,{key:"errors:pluginReloadBlocked",params:{workId:a.workId,reason:a.reason.slice(0,1e3)}}):a instanceof k.y?(0,i.e)(409,a.message,{key:"errors:pluginRuntimeBusy"}):a instanceof f.b7?(0,i.e)(409,a.message,{key:"errors:pluginRestartPending"}):a instanceof f.oO?(0,i.e)(409,a.message,{key:"errors:pluginRestartUnavailable"}):a instanceof Error&&(a instanceof f.aJ||a instanceof j.l||"L2PluginManagementNotFoundError"===a.name||"L4PiPluginSourceNotFoundError"===a.name)&&"source"in a&&"string"==typeof a.source?(0,i.e)(404,a.message,{key:"errors:pluginNotFound",params:{source:a.source.slice(0,1e3)}}):a instanceof f.Uf?(0,i.e)(400,a.message):(console.error("[Pi Desk][PluginManagementApi] 插件操作失败",{action:b,errorName:a instanceof Error?a.name:"UnknownError",message:a instanceof Error?a.message:String(a)}),(0,i.e)(500,a instanceof Error&&a.message?a.message:`${b}失败`))}async function o(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.MF.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await c(d.data.mode))}catch(a){return n(a,b)}}async function p(a,b,c){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let d=e.SW.safeParse(await m(a));if(!d.success)return(0,i.e)(400,"插件来源无效",{key:"errors:pluginSourceInvalid"});try{return(0,i.n)(await c(d.data.source))}catch(a){return n(a,b)}}async function q(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.FX.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().list(b.data))}catch(a){return n(a,"查询插件")}}function r(a){return p(a,"查询插件详情",a=>(0,f.ZY)().get(a))}async function s(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.i.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"安装参数无效",{key:"errors:invalidInput"});try{let{source:a,...c}=b.data;return(0,i.n)(await (0,f.ZY)().add(a,c))}catch(a){return n(a,"安装插件")}}async function t(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.Rw.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"批量参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().batch(b.data))}catch(a){return n(a,"批量维护插件")}}async function u(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.o0.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"启用参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().setEnabled(b.data.source,b.data.enabled))}catch(a){return n(a,"切换插件状态")}}function v(a){return p(a,"更新插件",a=>(0,f.ZY)().update(a))}function w(a){return p(a,"删除插件",a=>(0,f.ZY)().del(a))}async function x(a){if(!(0,h.N)(a))return(0,i.e)(400,"客户端标识无效",{key:"errors:invalidClient"});let b=e.jH.safeParse(await m(a));if(!b.success)return(0,i.e)(400,"请求参数无效",{key:"errors:invalidInput"});try{return(0,i.n)(await (0,f.ZY)().apply(b.data.sources))}catch(a){return n(a,"加载插件变更")}}function y(a){return o(a,"重启 Pi Desk",a=>(0,f.ZY)().reload(a))}[f,g,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},28802:a=>{a.exports=import("@earendil-works/pi-ai")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{a.exports=require("node:child_process")},38522:a=>{a.exports=require("node:zlib")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{a.exports=require("node:os")},49210:(a,b,c)=>{a.exports=c(44870)},51455:a=>{a.exports=require("node:fs/promises")},57975:a=>{a.exports=require("node:util")},58500:a=>{a.exports=require("node:timers/promises")},60815:a=>{a.exports=import("typebox")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71951:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(49210),e=c(97155),f=c(70754),g=c(37332),h=c(59674),i=c(58022),j=c(261),k=c(26844),l=c(2966),m=c(85806),n=c(88685),o=c(81147),p=c(3905),q=c(11543),r=c(58912),s=c(86439),t=c(91678);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/plugins/reload/route",pathname:"/api/plugins/reload",filename:"route",bundlePath:"app/api/plugins/reload/route"},distDir:"temp/build/pi-desk/release/.next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/pi-desk/pi-desk/src/app/api/plugins/reload/route.ts",nextConfigOutput:"",userland:()=>c(86264),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/reload/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},73024:a=>{a.exports=require("node:fs")},73136:a=>{a.exports=require("node:url")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80481:a=>{a.exports=require("node:readline")},81147:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(70595),e=c(39346),f=c(3905);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},86264:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>e.RK});var e=c(13768),f=a([e]);e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93736:a=>{a.exports=import("jiti")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[43416,59473,3108,78262,92386,6917,58330,16438],()=>b(b.s=71951));module.exports=c})();