@jetcrab/pi-desk 1.1.12 → 1.1.13-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 (315) hide show
  1. package/docs/plugins.md +21 -1
  2. package/package.json +2 -2
  3. package/src/app/api/work-sessions/rename/route.ts +1 -0
  4. package/src/client/l2_biz/auth/l2-login.tsx +1 -1
  5. package/src/client/l2_biz/plugin-host/l2-plugin-session-sidebar-tab.tsx +6 -2
  6. package/src/client/l2_biz/settings/l2-auth-settings.tsx +1 -1
  7. package/src/client/l2_biz/settings/views/l2-appearance-settings.tsx +1 -16
  8. package/src/client/l2_biz/task-center/l2-task-center.tsx +4 -30
  9. package/src/client/l2_biz/workbench/file-workspace/l2-plugin-standalone-file-preview.tsx +45 -7
  10. package/src/client/l2_biz/workbench/hooks/l2-work-session-rename.ts +57 -0
  11. package/src/client/l2_biz/workbench/l2-work-session-columns.tsx +0 -11
  12. package/src/client/l2_biz/workbench/l2-work-session-sidebar.tsx +107 -6
  13. package/src/client/l2_biz/workbench/l2-workbench-biz.ts +5 -0
  14. package/src/client/l2_biz/workbench/l2-workbench-chat-composer.tsx +333 -350
  15. package/src/client/l2_biz/workbench/l2-workbench.tsx +46 -1
  16. package/src/client/l2_biz/workbench/views/l2-work-session-rename-dialog.tsx +88 -0
  17. package/src/client/l3_modules/project-files/l3-markdown-preview.module.css +81 -0
  18. package/src/client/l3_modules/project-files/l3-markdown-preview.tsx +52 -0
  19. package/src/client/l3_modules/project-files/l3-project-document-view.tsx +26 -8
  20. package/src/client/l3_modules/project-files/l3-project-file-runtime.ts +16 -1
  21. package/src/client/l3_modules/project-files/l3-project-text-preview.ts +5 -0
  22. package/src/client/l3_modules/work-session-visual/l3-work-session-visual-effects.module.css +0 -36
  23. package/src/client/l3_modules/work-session-visual/l3-work-session-visual-view.tsx +0 -5
  24. package/src/client/l4_foundation/plugin-host/l4-plugin-host-runtime.ts +71 -1
  25. package/src/client/l4_foundation/styles/l4-globals.css +0 -19
  26. package/src/client/l4_foundation/ui/code/l4-code-preview.tsx +2 -1
  27. package/src/common/l2_biz/auth/l2-auth-contract.ts +2 -2
  28. package/src/common/l2_biz/auth/l2-auth-messages.ts +2 -2
  29. package/src/common/l2_biz/settings/l2-settings-messages.ts +0 -6
  30. package/src/common/l2_biz/work-session/l2-work-session-contract.ts +9 -0
  31. package/src/common/l2_biz/workbench/l2-workbench-locale-messages.ts +6 -0
  32. package/src/common/l3_modules/project-files/l3-project-files-locale-messages.ts +4 -0
  33. package/src/common/l4_foundation/locale/l4-host-error-messages.ts +6 -0
  34. package/src/server/l1_entry/api/l1-work-session-rename-route.ts +52 -0
  35. package/src/server/l2_biz/work-session/l2-work-session-chat-runtime.ts +5 -0
  36. package/src/server/l2_biz/work-session/l2-work-session-manage.ts +13 -0
  37. package/src/server/l3_modules/work-session/l3-work-session.ts +4 -0
  38. package/src/server/l4_foundation/pi/l4-pi-chat-worker.ts +12 -1
  39. package/src/server/l4_foundation/pi/l4-pi-work-session-runtime.ts +5 -0
  40. package/temp/build/pi-desk/release/.next/BUILD_ID +1 -1
  41. package/temp/build/pi-desk/release/.next/app-path-routes-manifest.json +1 -0
  42. package/temp/build/pi-desk/release/.next/build-manifest.json +3 -3
  43. package/temp/build/pi-desk/release/.next/prerender-manifest.json +3 -3
  44. package/temp/build/pi-desk/release/.next/react-loadable-manifest.json +1 -2
  45. package/temp/build/pi-desk/release/.next/required-server-files.js +3 -3
  46. package/temp/build/pi-desk/release/.next/required-server-files.json +3 -3
  47. package/temp/build/pi-desk/release/.next/routes-manifest.json +6 -0
  48. package/temp/build/pi-desk/release/.next/server/app/_global-error/page.js +1 -1
  49. package/temp/build/pi-desk/release/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  50. package/temp/build/pi-desk/release/.next/server/app/_global-error.html +1 -1
  51. package/temp/build/pi-desk/release/.next/server/app/_global-error.rsc +1 -1
  52. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  53. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  54. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  55. package/temp/build/pi-desk/release/.next/server/app/_not-found/page.js +1 -1
  56. package/temp/build/pi-desk/release/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  57. package/temp/build/pi-desk/release/.next/server/app/api/auth/login/route.js +2 -2
  58. package/temp/build/pi-desk/release/.next/server/app/api/auth/logout/route.js +1 -1
  59. package/temp/build/pi-desk/release/.next/server/app/api/auth-settings/get/route.js +1 -1
  60. package/temp/build/pi-desk/release/.next/server/app/api/auth-settings/replace/route.js +1 -1
  61. package/temp/build/pi-desk/release/.next/server/app/api/capability-modes/get/route.js +1 -1
  62. package/temp/build/pi-desk/release/.next/server/app/api/capability-modes/replace/route.js +1 -1
  63. package/temp/build/pi-desk/release/.next/server/app/api/chat/context/get/route.js +1 -1
  64. package/temp/build/pi-desk/release/.next/server/app/api/chat/images/get/route.js +1 -1
  65. package/temp/build/pi-desk/release/.next/server/app/api/chat/messages/get/route.js +1 -1
  66. package/temp/build/pi-desk/release/.next/server/app/api/health/route.js +1 -1
  67. package/temp/build/pi-desk/release/.next/server/app/api/mcp-check/get/route.js +1 -1
  68. package/temp/build/pi-desk/release/.next/server/app/api/mcp-settings/del/route.js +1 -1
  69. package/temp/build/pi-desk/release/.next/server/app/api/mcp-settings/get/route.js +1 -1
  70. package/temp/build/pi-desk/release/.next/server/app/api/mcp-settings/replace/route.js +1 -1
  71. package/temp/build/pi-desk/release/.next/server/app/api/model-catalog/list/route.js +1 -1
  72. package/temp/build/pi-desk/release/.next/server/app/api/model-settings/get/route.js +1 -1
  73. package/temp/build/pi-desk/release/.next/server/app/api/model-settings/replace/route.js +1 -1
  74. package/temp/build/pi-desk/release/.next/server/app/api/pi/directories/list/route.js +1 -1
  75. package/temp/build/pi-desk/release/.next/server/app/api/pi/directory-entries/list/route.js +1 -1
  76. package/temp/build/pi-desk/release/.next/server/app/api/pi/directory-ignores/list/route.js +1 -1
  77. package/temp/build/pi-desk/release/.next/server/app/api/pi/directory-ignores/replace/route.js +1 -1
  78. package/temp/build/pi-desk/release/.next/server/app/api/pi/models/list/route.js +1 -1
  79. package/temp/build/pi-desk/release/.next/server/app/api/pi/session-user-messages/list/route.js +1 -1
  80. package/temp/build/pi-desk/release/.next/server/app/api/pi/sessions/list/route.js +1 -1
  81. package/temp/build/pi-desk/release/.next/server/app/api/plugin-catalog/get/route.js +1 -1
  82. package/temp/build/pi-desk/release/.next/server/app/api/plugin-catalog/search/route.js +1 -1
  83. package/temp/build/pi-desk/release/.next/server/app/api/plugin-catalog/settings-get/route.js +1 -1
  84. package/temp/build/pi-desk/release/.next/server/app/api/plugin-catalog/settings-replace/route.js +1 -1
  85. package/temp/build/pi-desk/release/.next/server/app/api/plugins/add/route.js +1 -1
  86. package/temp/build/pi-desk/release/.next/server/app/api/plugins/apply/route.js +1 -1
  87. package/temp/build/pi-desk/release/.next/server/app/api/plugins/batch/route.js +1 -1
  88. package/temp/build/pi-desk/release/.next/server/app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route.js +1 -1
  89. package/temp/build/pi-desk/release/.next/server/app/api/plugins/del/route.js +1 -1
  90. package/temp/build/pi-desk/release/.next/server/app/api/plugins/enabled-set/route.js +1 -1
  91. package/temp/build/pi-desk/release/.next/server/app/api/plugins/get/route.js +1 -1
  92. package/temp/build/pi-desk/release/.next/server/app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route.js +1 -1
  93. package/temp/build/pi-desk/release/.next/server/app/api/plugins/list/route.js +1 -1
  94. package/temp/build/pi-desk/release/.next/server/app/api/plugins/reload/route.js +1 -1
  95. package/temp/build/pi-desk/release/.next/server/app/api/plugins/update/route.js +1 -1
  96. package/temp/build/pi-desk/release/.next/server/app/api/project-files/get/route.js +1 -1
  97. package/temp/build/pi-desk/release/.next/server/app/api/project-files/list/route.js +1 -1
  98. package/temp/build/pi-desk/release/.next/server/app/api/project-files/reveal/route.js +1 -1
  99. package/temp/build/pi-desk/release/.next/server/app/api/project-files/search/route.js +1 -1
  100. package/temp/build/pi-desk/release/.next/server/app/api/project-git/get/route.js +1 -1
  101. package/temp/build/pi-desk/release/.next/server/app/api/project-git-branches/list/route.js +1 -1
  102. package/temp/build/pi-desk/release/.next/server/app/api/project-git-changes/list/route.js +1 -1
  103. package/temp/build/pi-desk/release/.next/server/app/api/project-git-diff/get/route.js +1 -1
  104. package/temp/build/pi-desk/release/.next/server/app/api/project-git-heads/get/route.js +1 -1
  105. package/temp/build/pi-desk/release/.next/server/app/api/project-git-log/list/route.js +1 -1
  106. package/temp/build/pi-desk/release/.next/server/app/api/project-model-default/get/route.js +1 -1
  107. package/temp/build/pi-desk/release/.next/server/app/api/project-model-default/replace/route.js +1 -1
  108. package/temp/build/pi-desk/release/.next/server/app/api/skill-files/get/route.js +1 -1
  109. package/temp/build/pi-desk/release/.next/server/app/api/skill-files/list/route.js +1 -1
  110. package/temp/build/pi-desk/release/.next/server/app/api/skill-files/replace/route.js +1 -1
  111. package/temp/build/pi-desk/release/.next/server/app/api/skills/list/route.js +1 -1
  112. package/temp/build/pi-desk/release/.next/server/app/api/task-center/images/get/route.js +1 -1
  113. package/temp/build/pi-desk/release/.next/server/app/api/task-center/messages/get/route.js +1 -1
  114. package/temp/build/pi-desk/release/.next/server/app/api/work-session-git-branch/add/route.js +1 -1
  115. package/temp/build/pi-desk/release/.next/server/app/api/work-session-git-branch/replace/route.js +1 -1
  116. package/temp/build/pi-desk/release/.next/server/app/api/work-session-tree/get/route.js +1 -1
  117. package/temp/build/pi-desk/release/.next/server/app/api/work-session-tree-entry/get/route.js +1 -1
  118. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/add/route.js +1 -1
  119. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/branch/route.js +1 -1
  120. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/del/route.js +1 -1
  121. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/rename/route.js +1 -0
  122. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/rename/route_client-reference-manifest.js +1 -0
  123. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/replace/route.js +1 -1
  124. package/temp/build/pi-desk/release/.next/server/app/api/work-sessions/sort/route.js +1 -1
  125. package/temp/build/pi-desk/release/.next/server/app/favicon.ico/route.js +1 -1
  126. package/temp/build/pi-desk/release/.next/server/app/login/page.js +1 -1
  127. package/temp/build/pi-desk/release/.next/server/app/login/page_client-reference-manifest.js +1 -1
  128. package/temp/build/pi-desk/release/.next/server/app/page.js +80 -314
  129. package/temp/build/pi-desk/release/.next/server/app/page_client-reference-manifest.js +1 -1
  130. package/temp/build/pi-desk/release/.next/server/app-paths-manifest.json +1 -0
  131. package/temp/build/pi-desk/release/.next/server/chunks/23054.js +1 -1
  132. package/temp/build/pi-desk/release/.next/server/chunks/25406.js +8 -8
  133. package/temp/build/pi-desk/release/.next/server/chunks/33658.js +296 -0
  134. package/temp/build/pi-desk/release/.next/server/chunks/35985.js +5 -5
  135. package/temp/build/pi-desk/release/.next/server/chunks/48180.js +1 -1
  136. package/temp/build/pi-desk/release/.next/server/chunks/49900.js +2 -2
  137. package/temp/build/pi-desk/release/.next/server/chunks/6917.js +1 -1
  138. package/temp/build/pi-desk/release/.next/server/chunks/82499.js +3 -3
  139. package/temp/build/pi-desk/release/.next/server/chunks/92386.js +3 -3
  140. package/temp/build/pi-desk/release/.next/server/chunks/94296.js +2 -2
  141. package/temp/build/pi-desk/release/.next/server/middleware-build-manifest.js +1 -1
  142. package/temp/build/pi-desk/release/.next/server/middleware-react-loadable-manifest.js +1 -1
  143. package/temp/build/pi-desk/release/.next/server/pages/500.html +1 -1
  144. package/temp/build/pi-desk/release/.next/server/server-reference-manifest.json +1 -1
  145. package/temp/build/pi-desk/release/.next/static/YdOQ7klRBI5tJb5NpDVLW/_buildManifest.js +1 -0
  146. package/temp/build/pi-desk/release/.next/static/chunks/31087-ba426d09d6f68bfd.js +1 -0
  147. package/temp/build/pi-desk/release/.next/static/chunks/39654-b5fedd762ea0312e.js +238 -0
  148. package/temp/build/pi-desk/release/.next/static/chunks/49516-cc4dcd84d64ab4fe.js +81 -0
  149. package/temp/build/pi-desk/release/.next/static/chunks/75130-d2ca74894aff8085.js +13 -0
  150. package/temp/build/pi-desk/release/.next/static/chunks/app/_global-error/page-5137efe26947191b.js +1 -0
  151. package/temp/build/pi-desk/release/.next/static/chunks/app/_not-found/page-5137efe26947191b.js +1 -0
  152. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth/login/route-5137efe26947191b.js +1 -0
  153. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth/logout/route-5137efe26947191b.js +1 -0
  154. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth-settings/get/route-5137efe26947191b.js +1 -0
  155. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth-settings/replace/route-5137efe26947191b.js +1 -0
  156. package/temp/build/pi-desk/release/.next/static/chunks/app/api/capability-modes/get/route-5137efe26947191b.js +1 -0
  157. package/temp/build/pi-desk/release/.next/static/chunks/app/api/capability-modes/replace/route-5137efe26947191b.js +1 -0
  158. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/context/get/route-5137efe26947191b.js +1 -0
  159. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/images/get/route-5137efe26947191b.js +1 -0
  160. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/messages/get/route-5137efe26947191b.js +1 -0
  161. package/temp/build/pi-desk/release/.next/static/chunks/app/api/health/route-5137efe26947191b.js +1 -0
  162. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-check/get/route-5137efe26947191b.js +1 -0
  163. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/del/route-5137efe26947191b.js +1 -0
  164. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/get/route-5137efe26947191b.js +1 -0
  165. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/replace/route-5137efe26947191b.js +1 -0
  166. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-catalog/list/route-5137efe26947191b.js +1 -0
  167. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/get/route-5137efe26947191b.js +1 -0
  168. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/replace/route-5137efe26947191b.js +1 -0
  169. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directories/list/route-5137efe26947191b.js +1 -0
  170. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-entries/list/route-5137efe26947191b.js +1 -0
  171. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-ignores/list/route-5137efe26947191b.js +1 -0
  172. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-ignores/replace/route-5137efe26947191b.js +1 -0
  173. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/models/list/route-5137efe26947191b.js +1 -0
  174. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/session-user-messages/list/route-5137efe26947191b.js +1 -0
  175. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/sessions/list/route-5137efe26947191b.js +1 -0
  176. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/get/route-5137efe26947191b.js +1 -0
  177. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/search/route-5137efe26947191b.js +1 -0
  178. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/settings-get/route-5137efe26947191b.js +1 -0
  179. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/settings-replace/route-5137efe26947191b.js +1 -0
  180. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/add/route-5137efe26947191b.js +1 -0
  181. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/apply/route-5137efe26947191b.js +1 -0
  182. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/batch/route-5137efe26947191b.js +1 -0
  183. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route-5137efe26947191b.js +1 -0
  184. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/del/route-5137efe26947191b.js +1 -0
  185. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/enabled-set/route-5137efe26947191b.js +1 -0
  186. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/get/route-5137efe26947191b.js +1 -0
  187. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route-5137efe26947191b.js +1 -0
  188. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/list/route-5137efe26947191b.js +1 -0
  189. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/reload/route-5137efe26947191b.js +1 -0
  190. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/update/route-5137efe26947191b.js +1 -0
  191. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/get/route-5137efe26947191b.js +1 -0
  192. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/list/route-5137efe26947191b.js +1 -0
  193. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/reveal/route-5137efe26947191b.js +1 -0
  194. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/search/route-5137efe26947191b.js +1 -0
  195. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git/get/route-5137efe26947191b.js +1 -0
  196. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-branches/list/route-5137efe26947191b.js +1 -0
  197. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-changes/list/route-5137efe26947191b.js +1 -0
  198. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-diff/get/route-5137efe26947191b.js +1 -0
  199. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-heads/get/route-5137efe26947191b.js +1 -0
  200. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-log/list/route-5137efe26947191b.js +1 -0
  201. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-model-default/get/route-5137efe26947191b.js +1 -0
  202. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-model-default/replace/route-5137efe26947191b.js +1 -0
  203. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/get/route-5137efe26947191b.js +1 -0
  204. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/list/route-5137efe26947191b.js +1 -0
  205. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/replace/route-5137efe26947191b.js +1 -0
  206. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skills/list/route-5137efe26947191b.js +1 -0
  207. package/temp/build/pi-desk/release/.next/static/chunks/app/api/task-center/images/get/route-5137efe26947191b.js +1 -0
  208. package/temp/build/pi-desk/release/.next/static/chunks/app/api/task-center/messages/get/route-5137efe26947191b.js +1 -0
  209. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-git-branch/add/route-5137efe26947191b.js +1 -0
  210. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-git-branch/replace/route-5137efe26947191b.js +1 -0
  211. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-tree/get/route-5137efe26947191b.js +1 -0
  212. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-tree-entry/get/route-5137efe26947191b.js +1 -0
  213. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/add/route-5137efe26947191b.js +1 -0
  214. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/branch/route-5137efe26947191b.js +1 -0
  215. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/del/route-5137efe26947191b.js +1 -0
  216. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/rename/route-5137efe26947191b.js +1 -0
  217. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/replace/route-5137efe26947191b.js +1 -0
  218. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/sort/route-5137efe26947191b.js +1 -0
  219. package/temp/build/pi-desk/release/.next/static/chunks/app/layout-358978b7cfe69a5f.js +3 -0
  220. package/temp/build/pi-desk/release/.next/static/chunks/app/login/page-84892b06243891f0.js +1 -0
  221. package/temp/build/pi-desk/release/.next/static/chunks/app/page-cc05e71bf51adb57.js +158 -0
  222. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/app-error-5137efe26947191b.js +1 -0
  223. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/forbidden-5137efe26947191b.js +1 -0
  224. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/unauthorized-5137efe26947191b.js +1 -0
  225. package/temp/build/pi-desk/release/.next/static/chunks/webpack-40a782fc8a3535b9.js +1 -0
  226. package/temp/build/pi-desk/release/.next/static/css/095a062e18f96657.css +1 -0
  227. package/temp/build/pi-desk/release/.next/static/css/{adb1d4e48dd43c0a.css → 949d0d1a99d5de92.css} +1 -1
  228. package/temp/build/pi-desk/release/.next/trace-build +1 -1
  229. package/src/client/l2_biz/workbench/hooks/l2-work-session-column-motion.ts +0 -87
  230. package/src/client/l3_modules/work-session-visual/l3-work-session-status-border.tsx +0 -66
  231. package/src/client/l4_foundation/ui/l4-power-saving.ts +0 -45
  232. package/src/client/l4_foundation/ui/l4-window-reveal.ts +0 -30
  233. package/temp/build/pi-desk/release/.next/server/chunks/56284.js +0 -62
  234. package/temp/build/pi-desk/release/.next/static/96geGVI-j_dC6I3k-XFCB/_buildManifest.js +0 -1
  235. package/temp/build/pi-desk/release/.next/static/chunks/31087-333cae396a52f232.js +0 -1
  236. package/temp/build/pi-desk/release/.next/static/chunks/45992-92d8b8b10fcfbb6b.js +0 -13
  237. package/temp/build/pi-desk/release/.next/static/chunks/47340-c1c09c77c1a88514.js +0 -318
  238. package/temp/build/pi-desk/release/.next/static/chunks/57208-d6d38167dabb91e4.js +0 -1
  239. package/temp/build/pi-desk/release/.next/static/chunks/app/_global-error/page-dde4fd973791f7f7.js +0 -1
  240. package/temp/build/pi-desk/release/.next/static/chunks/app/_not-found/page-dde4fd973791f7f7.js +0 -1
  241. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth/login/route-dde4fd973791f7f7.js +0 -1
  242. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth/logout/route-dde4fd973791f7f7.js +0 -1
  243. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth-settings/get/route-dde4fd973791f7f7.js +0 -1
  244. package/temp/build/pi-desk/release/.next/static/chunks/app/api/auth-settings/replace/route-dde4fd973791f7f7.js +0 -1
  245. package/temp/build/pi-desk/release/.next/static/chunks/app/api/capability-modes/get/route-dde4fd973791f7f7.js +0 -1
  246. package/temp/build/pi-desk/release/.next/static/chunks/app/api/capability-modes/replace/route-dde4fd973791f7f7.js +0 -1
  247. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/context/get/route-dde4fd973791f7f7.js +0 -1
  248. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/images/get/route-dde4fd973791f7f7.js +0 -1
  249. package/temp/build/pi-desk/release/.next/static/chunks/app/api/chat/messages/get/route-dde4fd973791f7f7.js +0 -1
  250. package/temp/build/pi-desk/release/.next/static/chunks/app/api/health/route-dde4fd973791f7f7.js +0 -1
  251. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-check/get/route-dde4fd973791f7f7.js +0 -1
  252. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/del/route-dde4fd973791f7f7.js +0 -1
  253. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/get/route-dde4fd973791f7f7.js +0 -1
  254. package/temp/build/pi-desk/release/.next/static/chunks/app/api/mcp-settings/replace/route-dde4fd973791f7f7.js +0 -1
  255. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-catalog/list/route-dde4fd973791f7f7.js +0 -1
  256. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/get/route-dde4fd973791f7f7.js +0 -1
  257. package/temp/build/pi-desk/release/.next/static/chunks/app/api/model-settings/replace/route-dde4fd973791f7f7.js +0 -1
  258. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directories/list/route-dde4fd973791f7f7.js +0 -1
  259. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-entries/list/route-dde4fd973791f7f7.js +0 -1
  260. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-ignores/list/route-dde4fd973791f7f7.js +0 -1
  261. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/directory-ignores/replace/route-dde4fd973791f7f7.js +0 -1
  262. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/models/list/route-dde4fd973791f7f7.js +0 -1
  263. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/session-user-messages/list/route-dde4fd973791f7f7.js +0 -1
  264. package/temp/build/pi-desk/release/.next/static/chunks/app/api/pi/sessions/list/route-dde4fd973791f7f7.js +0 -1
  265. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/get/route-dde4fd973791f7f7.js +0 -1
  266. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/search/route-dde4fd973791f7f7.js +0 -1
  267. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/settings-get/route-dde4fd973791f7f7.js +0 -1
  268. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugin-catalog/settings-replace/route-dde4fd973791f7f7.js +0 -1
  269. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/add/route-dde4fd973791f7f7.js +0 -1
  270. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/apply/route-dde4fd973791f7f7.js +0 -1
  271. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/batch/route-dde4fd973791f7f7.js +0 -1
  272. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/browser-resources/[resourceGroup]/[...resourcePath]/route-dde4fd973791f7f7.js +0 -1
  273. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/del/route-dde4fd973791f7f7.js +0 -1
  274. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/enabled-set/route-dde4fd973791f7f7.js +0 -1
  275. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/get/route-dde4fd973791f7f7.js +0 -1
  276. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/host-runtime/[runtimeVersion]/[...resourcePath]/route-dde4fd973791f7f7.js +0 -1
  277. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/list/route-dde4fd973791f7f7.js +0 -1
  278. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/reload/route-dde4fd973791f7f7.js +0 -1
  279. package/temp/build/pi-desk/release/.next/static/chunks/app/api/plugins/update/route-dde4fd973791f7f7.js +0 -1
  280. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/get/route-dde4fd973791f7f7.js +0 -1
  281. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/list/route-dde4fd973791f7f7.js +0 -1
  282. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/reveal/route-dde4fd973791f7f7.js +0 -1
  283. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-files/search/route-dde4fd973791f7f7.js +0 -1
  284. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git/get/route-dde4fd973791f7f7.js +0 -1
  285. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-branches/list/route-dde4fd973791f7f7.js +0 -1
  286. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-changes/list/route-dde4fd973791f7f7.js +0 -1
  287. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-diff/get/route-dde4fd973791f7f7.js +0 -1
  288. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-heads/get/route-dde4fd973791f7f7.js +0 -1
  289. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-git-log/list/route-dde4fd973791f7f7.js +0 -1
  290. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-model-default/get/route-dde4fd973791f7f7.js +0 -1
  291. package/temp/build/pi-desk/release/.next/static/chunks/app/api/project-model-default/replace/route-dde4fd973791f7f7.js +0 -1
  292. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/get/route-dde4fd973791f7f7.js +0 -1
  293. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/list/route-dde4fd973791f7f7.js +0 -1
  294. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skill-files/replace/route-dde4fd973791f7f7.js +0 -1
  295. package/temp/build/pi-desk/release/.next/static/chunks/app/api/skills/list/route-dde4fd973791f7f7.js +0 -1
  296. package/temp/build/pi-desk/release/.next/static/chunks/app/api/task-center/images/get/route-dde4fd973791f7f7.js +0 -1
  297. package/temp/build/pi-desk/release/.next/static/chunks/app/api/task-center/messages/get/route-dde4fd973791f7f7.js +0 -1
  298. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-git-branch/add/route-dde4fd973791f7f7.js +0 -1
  299. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-git-branch/replace/route-dde4fd973791f7f7.js +0 -1
  300. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-tree/get/route-dde4fd973791f7f7.js +0 -1
  301. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-session-tree-entry/get/route-dde4fd973791f7f7.js +0 -1
  302. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/add/route-dde4fd973791f7f7.js +0 -1
  303. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/branch/route-dde4fd973791f7f7.js +0 -1
  304. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/del/route-dde4fd973791f7f7.js +0 -1
  305. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/replace/route-dde4fd973791f7f7.js +0 -1
  306. package/temp/build/pi-desk/release/.next/static/chunks/app/api/work-sessions/sort/route-dde4fd973791f7f7.js +0 -1
  307. package/temp/build/pi-desk/release/.next/static/chunks/app/layout-839162b6cfae8347.js +0 -3
  308. package/temp/build/pi-desk/release/.next/static/chunks/app/login/page-4532a3bbee48e219.js +0 -1
  309. package/temp/build/pi-desk/release/.next/static/chunks/app/page-4b6367cde5c04597.js +0 -158
  310. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/app-error-dde4fd973791f7f7.js +0 -1
  311. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/forbidden-dde4fd973791f7f7.js +0 -1
  312. package/temp/build/pi-desk/release/.next/static/chunks/next/dist/client/components/builtin/unauthorized-dde4fd973791f7f7.js +0 -1
  313. package/temp/build/pi-desk/release/.next/static/chunks/webpack-735430d61da52e9d.js +0 -1
  314. package/temp/build/pi-desk/release/.next/static/css/4a5dda7ff3a82c4a.css +0 -1
  315. /package/temp/build/pi-desk/release/.next/static/{96geGVI-j_dC6I3k-XFCB → YdOQ7klRBI5tJb5NpDVLW}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";exports.id=48180,exports.ids=[48180],exports.modules={25799:(a,b,c)=>{c.r(b),c.d(b,{default:()=>f});var d=c(19737);let e=Object.freeze(JSON.parse('{"displayName":"F#","name":"fsharp","patterns":[{"include":"#compiler_directives"},{"include":"#comments"},{"include":"#constants"},{"include":"#strings"},{"include":"#chars"},{"include":"#double_tick"},{"include":"#definition"},{"include":"#abstract_definition"},{"include":"#attributes"},{"include":"#modules"},{"include":"#anonymous_functions"},{"include":"#du_declaration"},{"include":"#record_declaration"},{"include":"#records"},{"include":"#strp_inlined"},{"include":"#keywords"},{"include":"#cexprs"},{"include":"#text"}],"repository":{"abstract_definition":{"begin":"\\\\b(static\\\\s+)?(abstract)\\\\s+(member)?(\\\\s+\\\\[<.*>])?\\\\s*([,.0-9_`[:alpha:]\\\\s]+)(<)?","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.fsharp"},"3":{"name":"keyword.fsharp"},"4":{"name":"support.function.attribute.fsharp"},"5":{"name":"keyword.symbol.fsharp"}},"end":"\\\\s*(with)\\\\b|=|$","endCaptures":{"1":{"name":"keyword.fsharp"}},"name":"abstract.definition.fsharp","patterns":[{"include":"#comments"},{"include":"#common_declaration"},{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"},"3":{"name":"keyword.symbol.fsharp"},"4":{"name":"entity.name.type.fsharp"}},"match":"(\\\\??)([ \'.0-9^_`[:alpha:]]+)\\\\s*(:)((?!with\\\\b)\\\\b([ \'.0-9^_`\\\\w]+))?"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"comments":"Here we need the \\\\w modifier in order to check that the words isn\'t blacklisted","match":"(?!with|get|set\\\\b)\\\\s*([\'.0-9^_`\\\\w]+)"},{"include":"#keywords"}]},"anonymous_functions":{"patterns":[{"begin":"\\\\b(fun)\\\\b","beginCaptures":{"1":{"name":"keyword.fsharp"}},"end":"(->)","endCaptures":{"1":{"name":"keyword.symbol.arrow.fsharp"}},"name":"function.anonymous","patterns":[{"include":"#comments"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"\\\\s*(?=(->))","endCaptures":{"1":{"name":"keyword.symbol.arrow.fsharp"}},"patterns":[{"include":"#member_declaration"}]},{"include":"#variables"}]}]},"anonymous_record_declaration":{"begin":"(\\\\{\\\\|)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\|})","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"keyword.symbol.fsharp"}},"match":"[ \'0-9^_`[:alpha:]]+(:)"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([ \'0-9^_`[:alpha:]]+)"},{"include":"#anonymous_record_declaration"},{"include":"#keywords"}]},"attributes":{"patterns":[{"begin":"\\\\[<","end":">?]","name":"support.function.attribute.fsharp","patterns":[{"include":"$self"}]}]},"cexprs":{"patterns":[{"captures":{"0":{"name":"keyword.fsharp"}},"match":"\\\\b(async|seq|promise|task|maybe|asyncMaybe|controller|scope|application|pipeline)(?=\\\\s*\\\\{)","name":"cexpr.fsharp"}]},"chars":{"patterns":[{"captures":{"1":{"name":"string.quoted.single.fsharp"}},"match":"(\'\\\\\\\\?.\')","name":"char.fsharp"}]},"comments":{"patterns":[{"begin":"^\\\\s*(\\\\(\\\\*\\\\*(?!\\\\)))((?!\\\\*\\\\)).)*$","beginCaptures":{"1":{"name":"comment.block.fsharp"}},"name":"comment.block.markdown.fsharp","patterns":[{"include":"text.html.markdown"}],"while":"^(?!\\\\s*(\\\\*)+\\\\)\\\\s*$)","whileCaptures":{"1":{"name":"comment.block.fsharp"}}},{"begin":"(\\\\(\\\\*(?!\\\\)))","beginCaptures":{"1":{"name":"comment.block.fsharp"}},"end":"(\\\\*+\\\\))","endCaptures":{"1":{"name":"comment.block.fsharp"}},"name":"comment.block.fsharp","patterns":[{"comments":"Capture // when inside of (* *) like that the rule which capture comments starting by // is not trigger. See https://github.com/ionide/ionide-fsgrammar/issues/155","match":"//","name":"fast-capture.comment.line.double-slash.fsharp"},{"comments":"Capture (*) when inside of (* *) so that it doesn\'t prematurely end the comment block.","match":"\\\\(\\\\*\\\\)","name":"fast-capture.comment.line.mul-operator.fsharp"},{"include":"#comments"}]},{"captures":{"1":{"name":"comment.block.fsharp"}},"match":"((?<!\\\\()(\\\\*)+\\\\))","name":"comment.block.markdown.fsharp.end"},{"begin":"(?<![!%\\\\&+-/<-@^|])///(?!/)","name":"comment.line.markdown.fsharp","patterns":[{"include":"text.html.markdown"}],"while":"(?<![!%\\\\&+-/<-@^|])///(?!/)"},{"match":"(?<![!%\\\\&+-/<-@^|])//(.*)$","name":"comment.line.double-slash.fsharp"}]},"common_binding_definition":{"patterns":[{"include":"#comments"},{"include":"#attributes"},{"begin":"(:)\\\\s*(\\\\()\\\\s*((?:static |)member)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"keyword.fsharp"}},"comments":"SRTP syntax support","end":"(\\\\))\\\\s*((?=,)|(?==))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(\\\\^[\'.0-9_[:alpha:]]+)"},{"include":"#variables"},{"include":"#keywords"}]},{"begin":"(:)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\)\\\\s*(([ \'.0-9?^_`[:alpha:]]*)))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"}},"patterns":[{"include":"#tuple_signature"}]},{"begin":"(:)\\\\s*(\\\\^[\'.0-9_[:alpha:]]+)\\\\s*(when)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"},"3":{"name":"keyword.fsharp"}},"end":"(?=:)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"match":"\\\\b(and|when|or)\\\\b","name":"keyword.fsharp"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([\'.0-9^_[:alpha:]]+)"},{"match":"([()])","name":"keyword.symbol.fsharp"}]},{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"},"4":{"name":"entity.name.type.fsharp"}},"match":"(:)\\\\s*([ \'.0-9?^_`[:alpha:]]+)(\\\\|\\\\s*(null))?"},{"captures":{"1":{"name":"keyword.symbol.arrow.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"entity.name.type.fsharp"}},"match":"(->)\\\\s*(\\\\()?\\\\s*([ \'.0-9?^_`[:alpha:]]+)*"},{"begin":"(\\\\*)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\)\\\\s*(([ \'.0-9?^_`[:alpha:]]+))*)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"}},"patterns":[{"include":"#tuple_signature"}]},{"begin":"(\\\\*)(\\\\s*([ \'.0-9?^_`[:alpha:]]+))*","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"}},"end":"(?==)|(?=\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#tuple_signature"}]},{"begin":"(<+(?!\\\\s*\\\\)))","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"beginComment":"The group (?![[:space:]]*\\\\) is for protection against overload operator. static member (<)","end":"((?<!:)>|\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"endComment":"The group (?<!:) prevent us from stopping on :> when using SRTP synthax","patterns":[{"include":"#generic_declaration"}]},{"include":"#anonymous_record_declaration"},{"begin":"(\\\\{)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(})","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#record_signature"}]},{"include":"#definition"},{"include":"#variables"},{"include":"#keywords"}]},"common_declaration":{"patterns":[{"begin":"\\\\s*(->)\\\\s*([ \'.0-9^_`[:alpha:]]+)(<)","beginCaptures":{"1":{"name":"keyword.symbol.arrow.fsharp"},"2":{"name":"entity.name.type.fsharp"},"3":{"name":"keyword.symbol.fsharp"}},"end":"(>)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([ \'.0-9^_`[:alpha:]]+)"},{"include":"#keywords"}]},{"captures":{"1":{"name":"keyword.symbol.arrow.fsharp"},"2":{"name":"entity.name.type.fsharp"}},"match":"\\\\s*(->)\\\\s*(?!with|get|set\\\\b)\\\\b([\'.0-9^_`\\\\w]+)"},{"include":"#anonymous_record_declaration"},{"begin":"(\\\\??)([ \'.0-9^_`[:alpha:]]+)\\\\s*(:)(\\\\s*([ \'.0-9?^_`[:alpha:]]+)(<))","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"},"3":{"name":"keyword.symbol.fsharp"},"4":{"name":"keyword.symbol.fsharp"},"5":{"name":"entity.name.type.fsharp"}},"end":"(>)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([ \'.0-9^_`[:alpha:]]+)"},{"include":"#keywords"}]}]},"compiler_directives":{"patterns":[{"captures":{},"match":"\\\\s?(#(?:if|elif|elseif|else|endif|light|nowarn|warnon))","name":"keyword.control.directive.fsharp"}]},"constants":{"patterns":[{"match":"\\\\(\\\\)","name":"keyword.symbol.fsharp"},{"match":"\\\\b-?[0-9][0-9_]*((\\\\.(?!\\\\.)([0-9][0-9_]*([Ee][-+]??[0-9][0-9_]*)?)?)|([Ee][-+]??[0-9][0-9_]*))","name":"constant.numeric.float.fsharp"},{"match":"\\\\b(-?((0([Xx])\\\\h[_\\\\h]*)|(0([Oo])[0-7][0-7_]*)|(0([Bb])[01][01_]*)|([0-9][0-9_]*)))","name":"constant.numeric.integer.nativeint.fsharp"},{"match":"\\\\b(true|false)\\\\b","name":"constant.language.boolean.fsharp"},{"match":"\\\\b(null|void)\\\\b","name":"constant.other.fsharp"}]},"definition":{"patterns":[{"begin":"\\\\b(let mutable|static let mutable|static let|let inline|let|and inline|and|member val|member inline|static member inline|static member val|static member|default|member|override|let!)(\\\\s+rec|mutable)?(\\\\s+\\\\[<.*>])?\\\\s*(private|internal|public)?\\\\s+(\\\\[[^-=]*]|[_[:alpha:]]([.0-9_[:alpha:]]+)*|``[_[:alpha:]]([.0-9_`[:alpha:]\\\\s]+|(?<=,)\\\\s)*)?","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.fsharp"},"3":{"name":"support.function.attribute.fsharp"},"4":{"name":"storage.modifier.fsharp"},"5":{"name":"variable.fsharp"}},"end":"\\\\s*((with(?: inline|))\\\\b|(=|\\\\n+=|(?<==)))","endCaptures":{"2":{"name":"keyword.fsharp"},"3":{"name":"keyword.symbol.fsharp"}},"name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]},{"begin":"\\\\b(use!??|and!??)\\\\s+(\\\\[[^-=]*]|[_[:alpha:]]([.0-9_[:alpha:]]+)*|``[_[:alpha:]]([.0-9_`[:alpha:]\\\\s]+|(?<=,)\\\\s)*)?","beginCaptures":{"1":{"name":"keyword.fsharp"}},"end":"\\\\s*(=)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]},{"begin":"(?<=with|and)\\\\s*\\\\b(([gs]et)\\\\s*(?=\\\\())(\\\\[[^-=]*]|[_[:alpha:]]([.0-9_[:alpha:]]+)*|``[_[:alpha:]]([.0-9_`[:alpha:]\\\\s]+|(?<=,)\\\\s)*)?","beginCaptures":{"4":{"name":"variable.fsharp"}},"end":"\\\\s*(=|\\\\n+=|(?<==))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]},{"begin":"\\\\b(static val mutable|val mutable|val inline|val)(\\\\s+rec|mutable)?(\\\\s+\\\\[<.*>])?\\\\s*(private|internal|public)?\\\\s+(\\\\[[^-=]*]|[_[:alpha:]]([,.0-9_[:alpha:]]+)*|``[_[:alpha:]]([,.0-9_`[:alpha:]\\\\s]+|(?<=,)\\\\s)*)?","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.fsharp"},"3":{"name":"support.function.attribute.fsharp"},"4":{"name":"storage.modifier.fsharp"},"5":{"name":"variable.fsharp"}},"end":"\\\\n$","name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]},{"begin":"\\\\b(new)\\\\b\\\\s+(\\\\()","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]}]},"double_tick":{"patterns":[{"captures":{"1":{"name":"string.quoted.single.fsharp"},"2":{"name":"variable.other.binding.fsharp"},"3":{"name":"string.quoted.single.fsharp"}},"match":"(``)([^`]*)(``)","name":"variable.other.binding.fsharp"}]},"du_declaration":{"patterns":[{"begin":"\\\\b(of)\\\\b","beginCaptures":{"1":{"name":"keyword.fsharp"}},"end":"$|(\\\\|)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"du_declaration.fsharp","patterns":[{"include":"#comments"},{"captures":{"1":{"name":"variable.parameter.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"entity.name.type.fsharp"}},"match":"([\'.0-9<>^_`[:alpha:]]+|``[ \'.0-9<>^_[:alpha:]]+``)\\\\s*(:)\\\\s*([\'.0-9<>^_`[:alpha:]]+|``[ \'.0-9<>^_[:alpha:]]+``)"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(``([ \'.0-9^_[:alpha:]]+)``|[\'.0-9^_`[:alpha:]]+)"},{"include":"#anonymous_record_declaration"},{"include":"#keywords"}]}]},"generic_declaration":{"patterns":[{"begin":"(:)\\\\s*(\\\\()\\\\s*((?:static |)member)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"keyword.fsharp"}},"comments":"SRTP syntax support","end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#member_declaration"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([\'^])[\'.0-9_[:alpha:]]+)"},{"include":"#variables"},{"include":"#keywords"}]},{"match":"\\\\b(private|to|public|internal|function|yield!?|class|exception|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let!|return!?|interface|with|abstract|enum|member|try|finally|and|when|or|use!??|struct|while|mutable|assert|base|done|downcast|downto|extern|fixed|global|lazy|upcast|not)(?!\')\\\\b","name":"keyword.fsharp"},{"match":":","name":"keyword.symbol.fsharp"},{"include":"#constants"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([\'^])[\'.0-9_[:alpha:]]+)"},{"begin":"(<)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(>)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([\'^])[\'.0-9_[:alpha:]]+)"},{"include":"#tuple_signature"},{"include":"#generic_declaration"}]},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([ \'.0-9?^_`[:alpha:]]+))+"},{"include":"#tuple_signature"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"comments":"Here we need the \\\\w modifier in order to check that the words are allowed","match":"(?!when|and|or\\\\b)\\\\b([\'.0-9^_`\\\\w]+)"},{"captures":{"1":{"name":"keyword.symbol.fsharp"}},"comments":"Prevent captures of `|>` as a keyword when defining custom operator like `<|>`","match":"(\\\\|)"},{"include":"#keywords"}]},"keywords":{"patterns":[{"match":"\\\\b(private|public|internal)\\\\b","name":"storage.modifier"},{"match":"\\\\b(private|to|public|internal|function|class|exception|delegate|of|new|as|begin|end|inherit|let!|interface|abstract|enum|member|and|when|or|use!??|struct|mutable|assert|base|done|downcast|downto|extern|fixed|global|lazy|upcast|not)(?!\')\\\\b","name":"keyword.fsharp"},{"match":"\\\\b(match|yield!??|with|if|then|else|elif|for|in|return!?|try|finally|while|do)(?!\')\\\\b","name":"keyword.control"},{"match":"(->|<-)","name":"keyword.symbol.arrow.fsharp"},{"match":"[.?]*(&&&|\\\\|\\\\|\\\\||\\\\^\\\\^\\\\^|~~~|~\\\\+|~-|<<<|>>>|\\\\|>|:>|:\\\\?>|[]:;\\\\[]|<>|[=@]|\\\\|\\\\||&&|[%\\\\&_{|}]|\\\\.\\\\.|[!*-\\\\-/>^]|>=|>>|<=??|[()]|<<)[.?]*","name":"keyword.symbol.fsharp"}]},"member_declaration":{"patterns":[{"include":"#comments"},{"include":"#common_declaration"},{"begin":"(:)\\\\s*(\\\\()\\\\s*((?:static |)member)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"keyword.fsharp"}},"comments":"SRTP syntax support","end":"(\\\\))\\\\s*((?=,)|(?==))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#member_declaration"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(\\\\^[\'.0-9_[:alpha:]]+)"},{"include":"#variables"},{"include":"#keywords"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(\\\\^[\'.0-9_[:alpha:]]+)"},{"match":"\\\\b(and|when|or)\\\\b","name":"keyword.fsharp"},{"match":"([()])","name":"keyword.symbol.fsharp"},{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"},"3":{"name":"keyword.symbol.fsharp"},"4":{"name":"entity.name.type.fsharp"},"7":{"name":"entity.name.type.fsharp"}},"match":"(\\\\??)([\'.0-9^_`[:alpha:]]+|``[ \',.0-:^_`[:alpha:]]+``)\\\\s*(:?)(\\\\s*([ \'.0-9<>?_`[:alpha:]]+))?(\\\\|\\\\s*(null))?"},{"include":"#keywords"}]},"modules":{"patterns":[{"begin":"\\\\b(?:(namespace global)|(namespace|module)\\\\s*(public|internal|private|rec)?\\\\s+([`|[:alpha:]][ \'.0-9_[:alpha:]]*))","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.fsharp"},"3":{"name":"storage.modifier.fsharp"},"4":{"name":"entity.name.section.fsharp"}},"end":"(\\\\s?=|\\\\s|$)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"entity.name.section.fsharp","patterns":[{"captures":{"1":{"name":"punctuation.separator.namespace-reference.fsharp"},"2":{"name":"entity.name.section.fsharp"}},"match":"(\\\\.)([A-Z][\'0-9_[:alpha:]]*)","name":"entity.name.section.fsharp"}]},{"begin":"\\\\b(open(?: type|))\\\\s+([`|[:alpha:]][\'0-9_[:alpha:]]*)(?=(\\\\.[A-Z][0-9_[:alpha:]]*)*)","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"entity.name.section.fsharp"}},"end":"(\\\\s|$)","name":"namespace.open.fsharp","patterns":[{"captures":{"1":{"name":"punctuation.separator.namespace-reference.fsharp"},"2":{"name":"entity.name.section.fsharp"}},"match":"(\\\\.)(\\\\p{alpha}[\'0-9_[:alpha:]]*)","name":"entity.name.section.fsharp"},{"include":"#comments"}]},{"begin":"^\\\\s*(module)\\\\s+([A-Z][\'0-9_[:alpha:]]*)\\\\s*(=)\\\\s*([A-Z][\'0-9_[:alpha:]]*)","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"entity.name.type.namespace.fsharp"},"3":{"name":"keyword.symbol.fsharp"},"4":{"name":"entity.name.section.fsharp"}},"end":"(\\\\s|$)","name":"namespace.alias.fsharp","patterns":[{"captures":{"1":{"name":"punctuation.separator.namespace-reference.fsharp"},"2":{"name":"entity.name.section.fsharp"}},"match":"(\\\\.)([A-Z][\'0-9_[:alpha:]]*)","name":"entity.name.section.fsharp"}]}]},"record_declaration":{"patterns":[{"begin":"(\\\\{)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(?<=})","patterns":[{"include":"#comments"},{"begin":"(((mutable)\\\\s\\\\p{alpha}+)|[\'.0-9<>^_`[:alpha:]]*)\\\\s*((?<!:):(?!:))\\\\s*","beginCaptures":{"3":{"name":"keyword.fsharp"},"4":{"name":"keyword.symbol.fsharp"}},"end":"$|([;}])","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#comments"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([ \'0-9^_`[:alpha:]]+)"},{"include":"#keywords"}]},{"include":"#compiler_directives"},{"include":"#constants"},{"include":"#strings"},{"include":"#chars"},{"include":"#double_tick"},{"include":"#definition"},{"include":"#attributes"},{"include":"#anonymous_functions"},{"include":"#keywords"},{"include":"#cexprs"},{"include":"#text"}]}]},"record_signature":{"patterns":[{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"}},"match":"[ \'0-9^_`[:alpha:]]+(=)([ \'0-9^_`[:alpha:]]+)"},{"begin":"(\\\\{)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(})","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"}},"match":"[ \'0-9^_`[:alpha:]]+(=)([ \'0-9^_`[:alpha:]]+)"},{"include":"#record_signature"}]},{"include":"#keywords"}]},"records":{"patterns":[{"begin":"\\\\b(type)\\\\s+(private|internal|public)?\\\\s*","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"storage.modifier.fsharp"}},"end":"\\\\s*((with)|((as)\\\\s+([\'0-9[:alpha:]]+))|(=)|[\\\\n=]|(\\\\(\\\\)))","endCaptures":{"2":{"name":"keyword.fsharp"},"3":{"name":"keyword.fsharp"},"4":{"name":"keyword.fsharp"},"5":{"name":"variable.parameter.fsharp"},"6":{"name":"keyword.symbol.fsharp"},"7":{"name":"keyword.symbol.fsharp"}},"name":"record.fsharp","patterns":[{"include":"#comments"},{"include":"#attributes"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([\'.0-9^_[:alpha:]]+|``[ \',.0-:^_`[:alpha:]]+``)"},{"begin":"(<)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"((?<!:)>)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([\'^])``[ ,.0-:^_`[:alpha:]]+``|([\'^])[.0-:^_`[:alpha:]]+)"},{"match":"\\\\b(interface|with|abstract|and|when|or|not|struct|equality|comparison|unmanaged|delegate|enum)\\\\b","name":"keyword.fsharp"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"keyword.fsharp"}},"match":"(static member|member|new)"},{"include":"#common_binding_definition"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"comments":"Here we need the \\\\w modifier in order to check that the words isn\'t blacklisted","match":"([\'.0-9^_`\\\\w]+)"},{"include":"#keywords"}]},{"captures":{"1":{"name":"storage.modifier.fsharp"}},"match":"\\\\s*(private|internal|public)"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"\\\\s*(?=(=)|[\\\\n=]|(\\\\(\\\\))|(as))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#member_declaration"}]},{"include":"#keywords"}]}]},"string_formatter":{"patterns":[{"captures":{"1":{"name":"keyword.format.specifier.fsharp"}},"match":"(%0?-?(\\\\d+)?(([at])|(\\\\.\\\\d+)?([EFGMefg])|([Xbcdiosux])|([Obs])|(\\\\+?A)))","name":"entity.name.type.format.specifier.fsharp"}]},"strings":{"patterns":[{"begin":"(?=[^\\\\\\\\])(@\\")","beginCaptures":{"1":{"name":"punctuation.definition.string.begin.fsharp"}},"end":"(\\")(?!\\")","endCaptures":{"1":{"name":"punctuation.definition.string.end.fsharp"}},"name":"string.quoted.literal.fsharp","patterns":[{"match":"\\"(\\")","name":"constant.character.string.escape.fsharp"}]},{"begin":"(?=[^\\\\\\\\])(\\"\\"\\")","beginCaptures":{"1":{"name":"punctuation.definition.string.begin.fsharp"}},"end":"(\\"\\"\\")","endCaptures":{"1":{"name":"punctuation.definition.string.end.fsharp"}},"name":"string.quoted.triple.fsharp","patterns":[{"include":"#string_formatter"}]},{"begin":"(?=[^\\\\\\\\])(\\")","beginCaptures":{"1":{"name":"punctuation.definition.string.begin.fsharp"}},"end":"(\\")","endCaptures":{"1":{"name":"punctuation.definition.string.end.fsharp"}},"name":"string.quoted.double.fsharp","patterns":[{"match":"\\\\\\\\$[\\\\t ]*","name":"punctuation.separator.string.ignore-eol.fsharp"},{"match":"\\\\\\\\([\\"\'\\\\\\\\abfnrtv]|([01][0-9][0-9]|2[0-4][0-9]|25[0-5])|(x\\\\h{2})|(u\\\\h{4})|(U00(0\\\\h|10)\\\\h{4}))","name":"constant.character.string.escape.fsharp"},{"match":"\\\\\\\\(([0-9]{1,3})|(x\\\\S{0,2})|(u\\\\S{0,4})|(U\\\\S{0,8})|\\\\S)","name":"invalid.illegal.character.string.fsharp"},{"include":"#string_formatter"}]}]},"strp_inlined":{"patterns":[{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#strp_inlined_body"}]}]},"strp_inlined_body":{"patterns":[{"include":"#comments"},{"include":"#anonymous_functions"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(\\\\^[\'.0-9_[:alpha:]]+)"},{"match":"\\\\b(and|when|or)\\\\b","name":"keyword.fsharp"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#strp_inlined_body"}]},{"captures":{"1":{"name":"keyword.fsharp"},"2":{"name":"variable.fsharp"},"3":{"name":"keyword.symbol.fsharp"}},"match":"((?:static |)member)\\\\s*([\'.0-9<>^_`[:alpha:]]+|``[ \'.0-9<>^_[:alpha:]]+``)\\\\s*(:)"},{"include":"#compiler_directives"},{"include":"#constants"},{"include":"#strings"},{"include":"#chars"},{"include":"#double_tick"},{"include":"#keywords"},{"include":"#text"},{"include":"#definition"},{"include":"#attributes"},{"include":"#keywords"},{"include":"#cexprs"},{"include":"#text"}]},"text":{"patterns":[{"match":"\\\\\\\\","name":"text.fsharp"}]},"tuple_signature":{"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([ \'.0-9?^_`[:alpha:]]+))+"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([ \'.0-9?^_`[:alpha:]]+))+"},{"include":"#tuple_signature"}]},{"include":"#keywords"}]},"variables":{"patterns":[{"match":"\\\\(\\\\)","name":"keyword.symbol.fsharp"},{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"}},"match":"(\\\\??)(``[ \',.0-:^_`[:alpha:]]+``|(?!private|struct\\\\b)\\\\b[ \'.0-9<>^_`\\\\w[:alpha:]]+)"}]}},"scopeName":"source.fsharp","embeddedLangs":["markdown"],"aliases":["f#","fs"]}')),f=[...d.default,e]}};
1
+ "use strict";exports.id=48180,exports.ids=[48180],exports.modules={48180:(a,b,c)=>{c.r(b),c.d(b,{default:()=>f});var d=c(19737);let e=Object.freeze(JSON.parse('{"displayName":"F#","name":"fsharp","patterns":[{"include":"#compiler_directives"},{"include":"#comments"},{"include":"#constants"},{"include":"#strings"},{"include":"#chars"},{"include":"#double_tick"},{"include":"#definition"},{"include":"#abstract_definition"},{"include":"#attributes"},{"include":"#modules"},{"include":"#anonymous_functions"},{"include":"#du_declaration"},{"include":"#record_declaration"},{"include":"#records"},{"include":"#strp_inlined"},{"include":"#keywords"},{"include":"#cexprs"},{"include":"#text"}],"repository":{"abstract_definition":{"begin":"\\\\b(static\\\\s+)?(abstract)\\\\s+(member)?(\\\\s+\\\\[<.*>])?\\\\s*([,.0-9_`[:alpha:]\\\\s]+)(<)?","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.fsharp"},"3":{"name":"keyword.fsharp"},"4":{"name":"support.function.attribute.fsharp"},"5":{"name":"keyword.symbol.fsharp"}},"end":"\\\\s*(with)\\\\b|=|$","endCaptures":{"1":{"name":"keyword.fsharp"}},"name":"abstract.definition.fsharp","patterns":[{"include":"#comments"},{"include":"#common_declaration"},{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"},"3":{"name":"keyword.symbol.fsharp"},"4":{"name":"entity.name.type.fsharp"}},"match":"(\\\\??)([ \'.0-9^_`[:alpha:]]+)\\\\s*(:)((?!with\\\\b)\\\\b([ \'.0-9^_`\\\\w]+))?"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"comments":"Here we need the \\\\w modifier in order to check that the words isn\'t blacklisted","match":"(?!with|get|set\\\\b)\\\\s*([\'.0-9^_`\\\\w]+)"},{"include":"#keywords"}]},"anonymous_functions":{"patterns":[{"begin":"\\\\b(fun)\\\\b","beginCaptures":{"1":{"name":"keyword.fsharp"}},"end":"(->)","endCaptures":{"1":{"name":"keyword.symbol.arrow.fsharp"}},"name":"function.anonymous","patterns":[{"include":"#comments"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"\\\\s*(?=(->))","endCaptures":{"1":{"name":"keyword.symbol.arrow.fsharp"}},"patterns":[{"include":"#member_declaration"}]},{"include":"#variables"}]}]},"anonymous_record_declaration":{"begin":"(\\\\{\\\\|)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\|})","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"keyword.symbol.fsharp"}},"match":"[ \'0-9^_`[:alpha:]]+(:)"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([ \'0-9^_`[:alpha:]]+)"},{"include":"#anonymous_record_declaration"},{"include":"#keywords"}]},"attributes":{"patterns":[{"begin":"\\\\[<","end":">?]","name":"support.function.attribute.fsharp","patterns":[{"include":"$self"}]}]},"cexprs":{"patterns":[{"captures":{"0":{"name":"keyword.fsharp"}},"match":"\\\\b(async|seq|promise|task|maybe|asyncMaybe|controller|scope|application|pipeline)(?=\\\\s*\\\\{)","name":"cexpr.fsharp"}]},"chars":{"patterns":[{"captures":{"1":{"name":"string.quoted.single.fsharp"}},"match":"(\'\\\\\\\\?.\')","name":"char.fsharp"}]},"comments":{"patterns":[{"begin":"^\\\\s*(\\\\(\\\\*\\\\*(?!\\\\)))((?!\\\\*\\\\)).)*$","beginCaptures":{"1":{"name":"comment.block.fsharp"}},"name":"comment.block.markdown.fsharp","patterns":[{"include":"text.html.markdown"}],"while":"^(?!\\\\s*(\\\\*)+\\\\)\\\\s*$)","whileCaptures":{"1":{"name":"comment.block.fsharp"}}},{"begin":"(\\\\(\\\\*(?!\\\\)))","beginCaptures":{"1":{"name":"comment.block.fsharp"}},"end":"(\\\\*+\\\\))","endCaptures":{"1":{"name":"comment.block.fsharp"}},"name":"comment.block.fsharp","patterns":[{"comments":"Capture // when inside of (* *) like that the rule which capture comments starting by // is not trigger. See https://github.com/ionide/ionide-fsgrammar/issues/155","match":"//","name":"fast-capture.comment.line.double-slash.fsharp"},{"comments":"Capture (*) when inside of (* *) so that it doesn\'t prematurely end the comment block.","match":"\\\\(\\\\*\\\\)","name":"fast-capture.comment.line.mul-operator.fsharp"},{"include":"#comments"}]},{"captures":{"1":{"name":"comment.block.fsharp"}},"match":"((?<!\\\\()(\\\\*)+\\\\))","name":"comment.block.markdown.fsharp.end"},{"begin":"(?<![!%\\\\&+-/<-@^|])///(?!/)","name":"comment.line.markdown.fsharp","patterns":[{"include":"text.html.markdown"}],"while":"(?<![!%\\\\&+-/<-@^|])///(?!/)"},{"match":"(?<![!%\\\\&+-/<-@^|])//(.*)$","name":"comment.line.double-slash.fsharp"}]},"common_binding_definition":{"patterns":[{"include":"#comments"},{"include":"#attributes"},{"begin":"(:)\\\\s*(\\\\()\\\\s*((?:static |)member)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"keyword.fsharp"}},"comments":"SRTP syntax support","end":"(\\\\))\\\\s*((?=,)|(?==))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(\\\\^[\'.0-9_[:alpha:]]+)"},{"include":"#variables"},{"include":"#keywords"}]},{"begin":"(:)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\)\\\\s*(([ \'.0-9?^_`[:alpha:]]*)))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"}},"patterns":[{"include":"#tuple_signature"}]},{"begin":"(:)\\\\s*(\\\\^[\'.0-9_[:alpha:]]+)\\\\s*(when)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"},"3":{"name":"keyword.fsharp"}},"end":"(?=:)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"match":"\\\\b(and|when|or)\\\\b","name":"keyword.fsharp"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([\'.0-9^_[:alpha:]]+)"},{"match":"([()])","name":"keyword.symbol.fsharp"}]},{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"},"4":{"name":"entity.name.type.fsharp"}},"match":"(:)\\\\s*([ \'.0-9?^_`[:alpha:]]+)(\\\\|\\\\s*(null))?"},{"captures":{"1":{"name":"keyword.symbol.arrow.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"entity.name.type.fsharp"}},"match":"(->)\\\\s*(\\\\()?\\\\s*([ \'.0-9?^_`[:alpha:]]+)*"},{"begin":"(\\\\*)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\)\\\\s*(([ \'.0-9?^_`[:alpha:]]+))*)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"}},"patterns":[{"include":"#tuple_signature"}]},{"begin":"(\\\\*)(\\\\s*([ \'.0-9?^_`[:alpha:]]+))*","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"entity.name.type.fsharp"}},"end":"(?==)|(?=\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#tuple_signature"}]},{"begin":"(<+(?!\\\\s*\\\\)))","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"beginComment":"The group (?![[:space:]]*\\\\) is for protection against overload operator. static member (<)","end":"((?<!:)>|\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"endComment":"The group (?<!:) prevent us from stopping on :> when using SRTP synthax","patterns":[{"include":"#generic_declaration"}]},{"include":"#anonymous_record_declaration"},{"begin":"(\\\\{)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(})","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#record_signature"}]},{"include":"#definition"},{"include":"#variables"},{"include":"#keywords"}]},"common_declaration":{"patterns":[{"begin":"\\\\s*(->)\\\\s*([ \'.0-9^_`[:alpha:]]+)(<)","beginCaptures":{"1":{"name":"keyword.symbol.arrow.fsharp"},"2":{"name":"entity.name.type.fsharp"},"3":{"name":"keyword.symbol.fsharp"}},"end":"(>)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([ \'.0-9^_`[:alpha:]]+)"},{"include":"#keywords"}]},{"captures":{"1":{"name":"keyword.symbol.arrow.fsharp"},"2":{"name":"entity.name.type.fsharp"}},"match":"\\\\s*(->)\\\\s*(?!with|get|set\\\\b)\\\\b([\'.0-9^_`\\\\w]+)"},{"include":"#anonymous_record_declaration"},{"begin":"(\\\\??)([ \'.0-9^_`[:alpha:]]+)\\\\s*(:)(\\\\s*([ \'.0-9?^_`[:alpha:]]+)(<))","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"},"3":{"name":"keyword.symbol.fsharp"},"4":{"name":"keyword.symbol.fsharp"},"5":{"name":"entity.name.type.fsharp"}},"end":"(>)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([ \'.0-9^_`[:alpha:]]+)"},{"include":"#keywords"}]}]},"compiler_directives":{"patterns":[{"captures":{},"match":"\\\\s?(#(?:if|elif|elseif|else|endif|light|nowarn|warnon))","name":"keyword.control.directive.fsharp"}]},"constants":{"patterns":[{"match":"\\\\(\\\\)","name":"keyword.symbol.fsharp"},{"match":"\\\\b-?[0-9][0-9_]*((\\\\.(?!\\\\.)([0-9][0-9_]*([Ee][-+]??[0-9][0-9_]*)?)?)|([Ee][-+]??[0-9][0-9_]*))","name":"constant.numeric.float.fsharp"},{"match":"\\\\b(-?((0([Xx])\\\\h[_\\\\h]*)|(0([Oo])[0-7][0-7_]*)|(0([Bb])[01][01_]*)|([0-9][0-9_]*)))","name":"constant.numeric.integer.nativeint.fsharp"},{"match":"\\\\b(true|false)\\\\b","name":"constant.language.boolean.fsharp"},{"match":"\\\\b(null|void)\\\\b","name":"constant.other.fsharp"}]},"definition":{"patterns":[{"begin":"\\\\b(let mutable|static let mutable|static let|let inline|let|and inline|and|member val|member inline|static member inline|static member val|static member|default|member|override|let!)(\\\\s+rec|mutable)?(\\\\s+\\\\[<.*>])?\\\\s*(private|internal|public)?\\\\s+(\\\\[[^-=]*]|[_[:alpha:]]([.0-9_[:alpha:]]+)*|``[_[:alpha:]]([.0-9_`[:alpha:]\\\\s]+|(?<=,)\\\\s)*)?","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.fsharp"},"3":{"name":"support.function.attribute.fsharp"},"4":{"name":"storage.modifier.fsharp"},"5":{"name":"variable.fsharp"}},"end":"\\\\s*((with(?: inline|))\\\\b|(=|\\\\n+=|(?<==)))","endCaptures":{"2":{"name":"keyword.fsharp"},"3":{"name":"keyword.symbol.fsharp"}},"name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]},{"begin":"\\\\b(use!??|and!??)\\\\s+(\\\\[[^-=]*]|[_[:alpha:]]([.0-9_[:alpha:]]+)*|``[_[:alpha:]]([.0-9_`[:alpha:]\\\\s]+|(?<=,)\\\\s)*)?","beginCaptures":{"1":{"name":"keyword.fsharp"}},"end":"\\\\s*(=)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]},{"begin":"(?<=with|and)\\\\s*\\\\b(([gs]et)\\\\s*(?=\\\\())(\\\\[[^-=]*]|[_[:alpha:]]([.0-9_[:alpha:]]+)*|``[_[:alpha:]]([.0-9_`[:alpha:]\\\\s]+|(?<=,)\\\\s)*)?","beginCaptures":{"4":{"name":"variable.fsharp"}},"end":"\\\\s*(=|\\\\n+=|(?<==))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]},{"begin":"\\\\b(static val mutable|val mutable|val inline|val)(\\\\s+rec|mutable)?(\\\\s+\\\\[<.*>])?\\\\s*(private|internal|public)?\\\\s+(\\\\[[^-=]*]|[_[:alpha:]]([,.0-9_[:alpha:]]+)*|``[_[:alpha:]]([,.0-9_`[:alpha:]\\\\s]+|(?<=,)\\\\s)*)?","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.fsharp"},"3":{"name":"support.function.attribute.fsharp"},"4":{"name":"storage.modifier.fsharp"},"5":{"name":"variable.fsharp"}},"end":"\\\\n$","name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]},{"begin":"\\\\b(new)\\\\b\\\\s+(\\\\()","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"binding.fsharp","patterns":[{"include":"#common_binding_definition"}]}]},"double_tick":{"patterns":[{"captures":{"1":{"name":"string.quoted.single.fsharp"},"2":{"name":"variable.other.binding.fsharp"},"3":{"name":"string.quoted.single.fsharp"}},"match":"(``)([^`]*)(``)","name":"variable.other.binding.fsharp"}]},"du_declaration":{"patterns":[{"begin":"\\\\b(of)\\\\b","beginCaptures":{"1":{"name":"keyword.fsharp"}},"end":"$|(\\\\|)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"du_declaration.fsharp","patterns":[{"include":"#comments"},{"captures":{"1":{"name":"variable.parameter.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"entity.name.type.fsharp"}},"match":"([\'.0-9<>^_`[:alpha:]]+|``[ \'.0-9<>^_[:alpha:]]+``)\\\\s*(:)\\\\s*([\'.0-9<>^_`[:alpha:]]+|``[ \'.0-9<>^_[:alpha:]]+``)"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(``([ \'.0-9^_[:alpha:]]+)``|[\'.0-9^_`[:alpha:]]+)"},{"include":"#anonymous_record_declaration"},{"include":"#keywords"}]}]},"generic_declaration":{"patterns":[{"begin":"(:)\\\\s*(\\\\()\\\\s*((?:static |)member)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"keyword.fsharp"}},"comments":"SRTP syntax support","end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#member_declaration"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([\'^])[\'.0-9_[:alpha:]]+)"},{"include":"#variables"},{"include":"#keywords"}]},{"match":"\\\\b(private|to|public|internal|function|yield!?|class|exception|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let!|return!?|interface|with|abstract|enum|member|try|finally|and|when|or|use!??|struct|while|mutable|assert|base|done|downcast|downto|extern|fixed|global|lazy|upcast|not)(?!\')\\\\b","name":"keyword.fsharp"},{"match":":","name":"keyword.symbol.fsharp"},{"include":"#constants"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([\'^])[\'.0-9_[:alpha:]]+)"},{"begin":"(<)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(>)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([\'^])[\'.0-9_[:alpha:]]+)"},{"include":"#tuple_signature"},{"include":"#generic_declaration"}]},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([ \'.0-9?^_`[:alpha:]]+))+"},{"include":"#tuple_signature"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"comments":"Here we need the \\\\w modifier in order to check that the words are allowed","match":"(?!when|and|or\\\\b)\\\\b([\'.0-9^_`\\\\w]+)"},{"captures":{"1":{"name":"keyword.symbol.fsharp"}},"comments":"Prevent captures of `|>` as a keyword when defining custom operator like `<|>`","match":"(\\\\|)"},{"include":"#keywords"}]},"keywords":{"patterns":[{"match":"\\\\b(private|public|internal)\\\\b","name":"storage.modifier"},{"match":"\\\\b(private|to|public|internal|function|class|exception|delegate|of|new|as|begin|end|inherit|let!|interface|abstract|enum|member|and|when|or|use!??|struct|mutable|assert|base|done|downcast|downto|extern|fixed|global|lazy|upcast|not)(?!\')\\\\b","name":"keyword.fsharp"},{"match":"\\\\b(match|yield!??|with|if|then|else|elif|for|in|return!?|try|finally|while|do)(?!\')\\\\b","name":"keyword.control"},{"match":"(->|<-)","name":"keyword.symbol.arrow.fsharp"},{"match":"[.?]*(&&&|\\\\|\\\\|\\\\||\\\\^\\\\^\\\\^|~~~|~\\\\+|~-|<<<|>>>|\\\\|>|:>|:\\\\?>|[]:;\\\\[]|<>|[=@]|\\\\|\\\\||&&|[%\\\\&_{|}]|\\\\.\\\\.|[!*-\\\\-/>^]|>=|>>|<=??|[()]|<<)[.?]*","name":"keyword.symbol.fsharp"}]},"member_declaration":{"patterns":[{"include":"#comments"},{"include":"#common_declaration"},{"begin":"(:)\\\\s*(\\\\()\\\\s*((?:static |)member)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"keyword.symbol.fsharp"},"3":{"name":"keyword.fsharp"}},"comments":"SRTP syntax support","end":"(\\\\))\\\\s*((?=,)|(?==))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#member_declaration"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(\\\\^[\'.0-9_[:alpha:]]+)"},{"include":"#variables"},{"include":"#keywords"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(\\\\^[\'.0-9_[:alpha:]]+)"},{"match":"\\\\b(and|when|or)\\\\b","name":"keyword.fsharp"},{"match":"([()])","name":"keyword.symbol.fsharp"},{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"},"3":{"name":"keyword.symbol.fsharp"},"4":{"name":"entity.name.type.fsharp"},"7":{"name":"entity.name.type.fsharp"}},"match":"(\\\\??)([\'.0-9^_`[:alpha:]]+|``[ \',.0-:^_`[:alpha:]]+``)\\\\s*(:?)(\\\\s*([ \'.0-9<>?_`[:alpha:]]+))?(\\\\|\\\\s*(null))?"},{"include":"#keywords"}]},"modules":{"patterns":[{"begin":"\\\\b(?:(namespace global)|(namespace|module)\\\\s*(public|internal|private|rec)?\\\\s+([`|[:alpha:]][ \'.0-9_[:alpha:]]*))","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"keyword.fsharp"},"3":{"name":"storage.modifier.fsharp"},"4":{"name":"entity.name.section.fsharp"}},"end":"(\\\\s?=|\\\\s|$)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"name":"entity.name.section.fsharp","patterns":[{"captures":{"1":{"name":"punctuation.separator.namespace-reference.fsharp"},"2":{"name":"entity.name.section.fsharp"}},"match":"(\\\\.)([A-Z][\'0-9_[:alpha:]]*)","name":"entity.name.section.fsharp"}]},{"begin":"\\\\b(open(?: type|))\\\\s+([`|[:alpha:]][\'0-9_[:alpha:]]*)(?=(\\\\.[A-Z][0-9_[:alpha:]]*)*)","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"entity.name.section.fsharp"}},"end":"(\\\\s|$)","name":"namespace.open.fsharp","patterns":[{"captures":{"1":{"name":"punctuation.separator.namespace-reference.fsharp"},"2":{"name":"entity.name.section.fsharp"}},"match":"(\\\\.)(\\\\p{alpha}[\'0-9_[:alpha:]]*)","name":"entity.name.section.fsharp"},{"include":"#comments"}]},{"begin":"^\\\\s*(module)\\\\s+([A-Z][\'0-9_[:alpha:]]*)\\\\s*(=)\\\\s*([A-Z][\'0-9_[:alpha:]]*)","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"entity.name.type.namespace.fsharp"},"3":{"name":"keyword.symbol.fsharp"},"4":{"name":"entity.name.section.fsharp"}},"end":"(\\\\s|$)","name":"namespace.alias.fsharp","patterns":[{"captures":{"1":{"name":"punctuation.separator.namespace-reference.fsharp"},"2":{"name":"entity.name.section.fsharp"}},"match":"(\\\\.)([A-Z][\'0-9_[:alpha:]]*)","name":"entity.name.section.fsharp"}]}]},"record_declaration":{"patterns":[{"begin":"(\\\\{)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(?<=})","patterns":[{"include":"#comments"},{"begin":"(((mutable)\\\\s\\\\p{alpha}+)|[\'.0-9<>^_`[:alpha:]]*)\\\\s*((?<!:):(?!:))\\\\s*","beginCaptures":{"3":{"name":"keyword.fsharp"},"4":{"name":"keyword.symbol.fsharp"}},"end":"$|([;}])","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#comments"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([ \'0-9^_`[:alpha:]]+)"},{"include":"#keywords"}]},{"include":"#compiler_directives"},{"include":"#constants"},{"include":"#strings"},{"include":"#chars"},{"include":"#double_tick"},{"include":"#definition"},{"include":"#attributes"},{"include":"#anonymous_functions"},{"include":"#keywords"},{"include":"#cexprs"},{"include":"#text"}]}]},"record_signature":{"patterns":[{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"}},"match":"[ \'0-9^_`[:alpha:]]+(=)([ \'0-9^_`[:alpha:]]+)"},{"begin":"(\\\\{)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(})","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"}},"match":"[ \'0-9^_`[:alpha:]]+(=)([ \'0-9^_`[:alpha:]]+)"},{"include":"#record_signature"}]},{"include":"#keywords"}]},"records":{"patterns":[{"begin":"\\\\b(type)\\\\s+(private|internal|public)?\\\\s*","beginCaptures":{"1":{"name":"keyword.fsharp"},"2":{"name":"storage.modifier.fsharp"}},"end":"\\\\s*((with)|((as)\\\\s+([\'0-9[:alpha:]]+))|(=)|[\\\\n=]|(\\\\(\\\\)))","endCaptures":{"2":{"name":"keyword.fsharp"},"3":{"name":"keyword.fsharp"},"4":{"name":"keyword.fsharp"},"5":{"name":"variable.parameter.fsharp"},"6":{"name":"keyword.symbol.fsharp"},"7":{"name":"keyword.symbol.fsharp"}},"name":"record.fsharp","patterns":[{"include":"#comments"},{"include":"#attributes"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"([\'.0-9^_[:alpha:]]+|``[ \',.0-:^_`[:alpha:]]+``)"},{"begin":"(<)","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"((?<!:)>)","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([\'^])``[ ,.0-:^_`[:alpha:]]+``|([\'^])[.0-:^_`[:alpha:]]+)"},{"match":"\\\\b(interface|with|abstract|and|when|or|not|struct|equality|comparison|unmanaged|delegate|enum)\\\\b","name":"keyword.fsharp"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"keyword.fsharp"}},"match":"(static member|member|new)"},{"include":"#common_binding_definition"}]},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"comments":"Here we need the \\\\w modifier in order to check that the words isn\'t blacklisted","match":"([\'.0-9^_`\\\\w]+)"},{"include":"#keywords"}]},{"captures":{"1":{"name":"storage.modifier.fsharp"}},"match":"\\\\s*(private|internal|public)"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"\\\\s*(?=(=)|[\\\\n=]|(\\\\(\\\\))|(as))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#member_declaration"}]},{"include":"#keywords"}]}]},"string_formatter":{"patterns":[{"captures":{"1":{"name":"keyword.format.specifier.fsharp"}},"match":"(%0?-?(\\\\d+)?(([at])|(\\\\.\\\\d+)?([EFGMefg])|([Xbcdiosux])|([Obs])|(\\\\+?A)))","name":"entity.name.type.format.specifier.fsharp"}]},"strings":{"patterns":[{"begin":"(?=[^\\\\\\\\])(@\\")","beginCaptures":{"1":{"name":"punctuation.definition.string.begin.fsharp"}},"end":"(\\")(?!\\")","endCaptures":{"1":{"name":"punctuation.definition.string.end.fsharp"}},"name":"string.quoted.literal.fsharp","patterns":[{"match":"\\"(\\")","name":"constant.character.string.escape.fsharp"}]},{"begin":"(?=[^\\\\\\\\])(\\"\\"\\")","beginCaptures":{"1":{"name":"punctuation.definition.string.begin.fsharp"}},"end":"(\\"\\"\\")","endCaptures":{"1":{"name":"punctuation.definition.string.end.fsharp"}},"name":"string.quoted.triple.fsharp","patterns":[{"include":"#string_formatter"}]},{"begin":"(?=[^\\\\\\\\])(\\")","beginCaptures":{"1":{"name":"punctuation.definition.string.begin.fsharp"}},"end":"(\\")","endCaptures":{"1":{"name":"punctuation.definition.string.end.fsharp"}},"name":"string.quoted.double.fsharp","patterns":[{"match":"\\\\\\\\$[\\\\t ]*","name":"punctuation.separator.string.ignore-eol.fsharp"},{"match":"\\\\\\\\([\\"\'\\\\\\\\abfnrtv]|([01][0-9][0-9]|2[0-4][0-9]|25[0-5])|(x\\\\h{2})|(u\\\\h{4})|(U00(0\\\\h|10)\\\\h{4}))","name":"constant.character.string.escape.fsharp"},{"match":"\\\\\\\\(([0-9]{1,3})|(x\\\\S{0,2})|(u\\\\S{0,4})|(U\\\\S{0,8})|\\\\S)","name":"invalid.illegal.character.string.fsharp"},{"include":"#string_formatter"}]}]},"strp_inlined":{"patterns":[{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#strp_inlined_body"}]}]},"strp_inlined_body":{"patterns":[{"include":"#comments"},{"include":"#anonymous_functions"},{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(\\\\^[\'.0-9_[:alpha:]]+)"},{"match":"\\\\b(and|when|or)\\\\b","name":"keyword.fsharp"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"include":"#strp_inlined_body"}]},{"captures":{"1":{"name":"keyword.fsharp"},"2":{"name":"variable.fsharp"},"3":{"name":"keyword.symbol.fsharp"}},"match":"((?:static |)member)\\\\s*([\'.0-9<>^_`[:alpha:]]+|``[ \'.0-9<>^_[:alpha:]]+``)\\\\s*(:)"},{"include":"#compiler_directives"},{"include":"#constants"},{"include":"#strings"},{"include":"#chars"},{"include":"#double_tick"},{"include":"#keywords"},{"include":"#text"},{"include":"#definition"},{"include":"#attributes"},{"include":"#keywords"},{"include":"#cexprs"},{"include":"#text"}]},"text":{"patterns":[{"match":"\\\\\\\\","name":"text.fsharp"}]},"tuple_signature":{"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([ \'.0-9?^_`[:alpha:]]+))+"},{"begin":"(\\\\()","beginCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"end":"(\\\\))","endCaptures":{"1":{"name":"keyword.symbol.fsharp"}},"patterns":[{"captures":{"1":{"name":"entity.name.type.fsharp"}},"match":"(([ \'.0-9?^_`[:alpha:]]+))+"},{"include":"#tuple_signature"}]},{"include":"#keywords"}]},"variables":{"patterns":[{"match":"\\\\(\\\\)","name":"keyword.symbol.fsharp"},{"captures":{"1":{"name":"keyword.symbol.fsharp"},"2":{"name":"variable.parameter.fsharp"}},"match":"(\\\\??)(``[ \',.0-:^_`[:alpha:]]+``|(?!private|struct\\\\b)\\\\b[ \'.0-9<>^_`\\\\w[:alpha:]]+)"}]}},"scopeName":"source.fsharp","embeddedLangs":["markdown"],"aliases":["f#","fs"]}')),f=[...d.default,e]}};
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=49900,exports.ids=[49900],exports.modules={15991:(a,b,c)=>{c.d(b,{N:()=>d});let d={en:{title:"Sign in to Pi Desk",subtitle:"Continue your work.",protection:"Sign-in protection",enabled:"Enabled",disabled:"Not enabled",publicAccess:"Anyone who can reach this service can open the workspace.",changePassword:"Change password",setPassword:"Set a password",newPassword:"New password",passwordHint:"12–256 characters; use at least three of: uppercase letters, lowercase letters, numbers and symbols. No leading/trailing spaces, line breaks or invisible control characters.",generatePassword:"Generate password",generatePasswordHint:"Generate a random 16-character password",generatePasswordFailed:"Unable to generate a password. Please try again.",saveEffect:"Keep your password safe. Saving requires all devices to sign in again.",enable:"Enable sign-in protection",saveAndSignIn:"Save and sign in again",saving:"Saving…",logout:"Sign out",signingOut:"Signing out…",logoutFailed:"Unable to sign out. Please try again later.",logoutInvalid:"Invalid sign-out request.",logoutCrossOriginDenied:"Cross-site sign-out requests are not allowed.",disable:"Disable protection",disableTitle:"Disable sign-in protection?",disableDescription:"Anyone who can reach this service will be able to open the workspace. Continue?",recovery:"Forgot your password?",recoveryDescription:"Delete this file on the device running the service, then refresh the page to restore access.",settingsFailed:"Unable to load or save sign-in protection settings.",settingsInvalid:"The password does not meet the requirements shown below the field.",configUnavailable:"Unable to read sign-in protection settings. Repair the configuration or delete auth.json and set it up again.",crossOriginDenied:"Cross-site changes to sign-in protection are not allowed.",password:"Password",submit:"Sign in",submitting:"Signing in…",loginFailed:"Unable to sign in",invalidResponse:"Invalid response from the sign-in service",invalidCredentials:"Sign-in failed. Check your sign-in details and try again.",invalidInput:"Sign-in failed. Check your sign-in details and try again.",unavailable:"Sign-in is temporarily unavailable. Please try again later.",tooManyAttempts:"Too many sign-in attempts. Please try again later.",loginAlertTitle:"Unusual sign-in activity",loginAlertDescription:"More than 5 consecutive sign-in failures. Check whether these attempts were yours.",invalidClient:"Invalid client identifier"},"zh-CN":{title:"登录 Pi Desk",subtitle:"继续你的工作会话",protection:"登录保护",enabled:"已启用",disabled:"未启用",publicAccess:"任何能够访问此服务的人都可以进入工作台。",changePassword:"修改密码",setPassword:"设置密码",newPassword:"新密码",passwordHint:"12–256 个字符,至少包含大写字母、小写字母、数字、符号中的三类;不能有首尾空白、换行或不可见控制字符。",generatePassword:"生成密码",generatePasswordHint:"随机生成 16 位密码",generatePasswordFailed:"生成密码失败,请重试。",saveEffect:"请妥善保存密码。保存后,所有设备都需要重新登录。",enable:"启用登录保护",saveAndSignIn:"保存并重新登录",saving:"正在保存…",logout:"退出登录",signingOut:"正在退出…",logoutFailed:"退出登录失败,请稍后重试。",logoutInvalid:"退出登录参数无效。",logoutCrossOriginDenied:"不允许跨站退出登录。",disable:"关闭保护",disableTitle:"关闭登录保护?",disableDescription:"关闭后,任何能够访问此服务的人都可以直接进入工作台。是否继续?",recovery:"忘记密码?",recoveryDescription:"在运行服务的设备上删除下面的文件,然后刷新页面,即可恢复访问。",settingsFailed:"登录保护设置处理失败。",settingsInvalid:"密码不符合要求,请按输入框下方的规则调整。",configUnavailable:"登录保护配置无法读取,请修复配置或删除 auth.json 后重新设置。",crossOriginDenied:"不允许跨站修改登录保护。",password:"密码",submit:"登录",submitting:"正在登录",loginFailed:"登录失败",invalidResponse:"登录服务响应无效",invalidCredentials:"登录失败,请检查登录信息后重试。",invalidInput:"登录失败,请检查登录信息后重试。",unavailable:"登录暂不可用,请稍后重试。",tooManyAttempts:"登录尝试过多,请稍后重试。",loginAlertTitle:"登录异常提醒",loginAlertDescription:"登录已连续失败超过 5 次,请确认是否为本人操作。",invalidClient:"客户端标识无效"}}},30010:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{fA:()=>m,hZ:()=>j,s6:()=>k});var e=c(58311),f=c(70788),g=c(95220),h=c(61035),i=a([h]);h=(i.then?(await i)():i)[0];let l={mode:(0,g.P)()?"basic":"normal",notifications:[],plugins:{},capabilityModes:{},settings:{region:{locale:"en",timeZone:"UTC"}}};class m extends Error{constructor(a){super(`App Runtime target does not exist: ${a}`),this.name="L3AppRuntimeTargetNotFoundError"}}class n{constructor(a){this.settingsStore=a,this.runtime=e.GR.parse(l),this.listeners=new Set,this.disposed=!1,a?(this.runtime=e.GR.parse({...this.runtime,settings:a.getSnapshot()}),this.unsubscribeSettings=a.subscribe(()=>{this.applyInternal({key:"settings",update:a.getSnapshot()})})):this.unsubscribeSettings=null}readSnapshot(){return structuredClone(this.runtime)}subscribe(a){if(this.disposed)throw Error("App Runtime has been disposed");return this.listeners.add(a),()=>{this.listeners.delete(a)}}applyInternal(a){if(this.disposed)throw Error("App Runtime has been disposed");let b={type:"update",...a};this.runtime=(0,f.b)(this.runtime,b),this.publish(b)}applyClient(a){if(this.disposed)throw Error("App Runtime has been disposed");if("settings"===a.key){if(!this.settingsStore)throw Error("共享设置尚未就绪");return this.settingsStore.update(a.update.region)}if(!this.runtime.notifications.some(b=>b.notificationId===a.update.notificationId))throw new m(a.update.notificationId);this.applyInternal(a)}replace(a){if(this.disposed)throw Error("App Runtime has been disposed");let b={type:"replace",runtime:e.GR.parse(a)};this.runtime=(0,f.b)(this.runtime,b),this.publish(b)}dispose(){this.disposed||(this.disposed=!0,this.unsubscribeSettings?.(),this.runtime=e.GR.parse(l),this.listeners.clear())}publish(a){for(let b of[...this.listeners])b(structuredClone(a))}}function j(){return globalThis.__piDeskAppRuntime||(globalThis.__piDeskAppRuntime=new n((0,h.J)())),globalThis.__piDeskAppRuntime}function k(){let a=globalThis.__piDeskAppRuntime;globalThis.__piDeskAppRuntime=void 0,a?.dispose()}d()}catch(a){d(a)}})},42616:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Oe:()=>o,UI:()=>p,cW:()=>s,rH:()=>n,wK:()=>q,yJ:()=>r});var e=c(51071),f=c(42897),g=c(55341),h=c(86166),i=c(61035),j=c(15991),k=a([f,g,h,i]);[f,g,h,i]=k.then?(await k)():k;let r="pi-desk-session";function l(a){let b=(0,h.UM)(),c=globalThis.__piDeskLoginAttempts??=new WeakMap,d=c.get(b);if(d||(d={failures:0,publisher:b.createPublisher()},c.set(b,d)),a){d.failures=0;return}if(d.failures+=1,!(d.failures<=5)){6===d.failures&&console.warn("[Pi Desk][Auth] 连续登录失败超过阈值,发布登录异常提醒");try{let a=(0,i.J)().getSnapshot().region.locale,b=j.N[a];d.publisher.publish({key:"auth:login-failures",level:"warning",title:b.loginAlertTitle,description:b.loginAlertDescription})}catch(a){console.error("[Pi Desk][Auth] 登录异常提醒发布失败",{errorName:a instanceof Error?a.name:"UnknownError"})}}}class s extends Error{constructor(){super("请先登录"),this.name="L2AuthRequiredError"}}function m(a,b){return null===a||(0,e.aJ)((0,e.nV)(b,r),a.sessionSecret)}async function n(a){let b=(0,f.f4)();if(!b)return l(!0),{cookieName:r,token:"",maxAgeSeconds:0};let c=await (0,f.Z3)(a.password,b.passwordHash);if((0,f.f4)()?.sessionSecret!==b.sessionSecret)return null;if(!c)return l(!1),null;let d=Date.now();return(0,g.h)({loggedInAt:d}),l(!0),{cookieName:r,token:(0,e.y9)(b.sessionSecret,2592e3,d),maxAgeSeconds:2592e3}}function o(a){return m((0,f.f4)(),a)}function p(a){let b=(0,f.f4)();if(!m(b,a))throw new s;return{enabled:null!==b,configPath:(0,f.oz)()}}function q(a,b){let c=(globalThis.__piDeskAuthMutation??Promise.resolve()).then(async()=>{let c=(0,f.f4)();if(!m(c,b))throw new s;let d=null===a.password?null:{passwordHash:await (0,f.Ac)(a.password)};if((0,f.f4)()?.sessionSecret!==c?.sessionSecret)throw new s;(0,f.Mj)(d),l(!0),console.info("[Pi Desk][Auth] 登录保护已更新",{enabled:null!==d})});return globalThis.__piDeskAuthMutation=c.catch(()=>void 0),c}d()}catch(a){d(a)}})},42897:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Ac:()=>q,Mj:()=>s,Z3:()=>r,f4:()=>o,mm:()=>w,n5:()=>x,oz:()=>k});var e=c(71473),f=c(77598),g=c(73024),h=c(76760),i=c(59473),j=a([e]);e=(j.then?(await j)():j)[0];let t=i.Ik({passwordHash:i.Yj().regex(/^scrypt:[a-f0-9]{32}:[a-f0-9]{128}$/)}).strict(),u=t.extend({username:i.Yj().trim().min(1).max(64).optional()}),v=0;class w extends Error{constructor(){super("登录尝试过多,请稍后重试。"),this.name="L4AuthBusyError"}}class x extends Error{constructor(){super("登录保护配置无法读取,请修复配置或删除 auth.json 后重新设置"),this.name="L4AuthConfigError"}}function k(){return(0,h.join)((0,e.M)(),"auth.json")}function l(){return(0,h.join)((0,e.M)(),"auth-session-key")}function m(a){return a instanceof Error&&"code"in a&&"ENOENT"===a.code}function n(){let a=(0,g.readFileSync)(l(),"utf8").trim();if(!/^[a-f0-9]{64}$/.test(a))throw new x;return a}function o(){let a;try{a=(0,g.readFileSync)(k(),"utf8")}catch(a){if(m(a))return null;throw new x}try{let b=u.parse(JSON.parse(a)),c=void 0===b.username?[b.passwordHash]:[b.username,b.passwordHash],d=(0,f.createHmac)("sha256",n()).update(JSON.stringify(c)).digest("hex");return{passwordHash:b.passwordHash,sessionSecret:d}}catch{throw new x}}function p(a,b){return new Promise((c,d)=>{(0,f.scrypt)(a,Buffer.from(b,"hex"),64,{N:32768,r:8,p:1,maxmem:0x4000000},(a,b)=>{a?d(a):c(b)})})}async function q(a){let b=(0,f.randomBytes)(16).toString("hex"),c=await p(a,b);return`scrypt:${b}:${c.toString("hex")}`}async function r(a,b){if(v>=2)throw new w;v+=1;try{let[,c,d]=b.split(":"),e=await p(a,c);return(0,f.timingSafeEqual)(e,Buffer.from(d,"hex"))}finally{v-=1}}function s(a){let b=k();if(!a){try{(0,g.unlinkSync)(b)}catch(a){if(!m(a))throw a}return}let c=t.parse(a);(0,g.mkdirSync)((0,h.dirname)(b),{recursive:!0}),null===o()&&(0,g.writeFileSync)(l(),`${(0,f.randomBytes)(32).toString("hex")}
1
+ "use strict";exports.id=49900,exports.ids=[49900],exports.modules={15991:(a,b,c)=>{c.d(b,{N:()=>d});let d={en:{title:"Sign in to Pi Desk",subtitle:"Continue your work.",protection:"Sign-in protection",enabled:"Enabled",disabled:"Not enabled",publicAccess:"Anyone who can reach this service can open the workspace.",changePassword:"Change password",setPassword:"Set a password",newPassword:"New password",passwordHint:"12–64 characters; use at least three of: uppercase letters, lowercase letters, numbers and symbols. No leading/trailing spaces, line breaks or invisible control characters.",generatePassword:"Generate password",generatePasswordHint:"Generate a random 16-character password",generatePasswordFailed:"Unable to generate a password. Please try again.",saveEffect:"Keep your password safe. Saving requires all devices to sign in again.",enable:"Enable sign-in protection",saveAndSignIn:"Save and sign in again",saving:"Saving…",logout:"Sign out",signingOut:"Signing out…",logoutFailed:"Unable to sign out. Please try again later.",logoutInvalid:"Invalid sign-out request.",logoutCrossOriginDenied:"Cross-site sign-out requests are not allowed.",disable:"Disable protection",disableTitle:"Disable sign-in protection?",disableDescription:"Anyone who can reach this service will be able to open the workspace. Continue?",recovery:"Forgot your password?",recoveryDescription:"Delete this file on the device running the service, then refresh the page to restore access.",settingsFailed:"Unable to load or save sign-in protection settings.",settingsInvalid:"The password does not meet the requirements shown below the field.",configUnavailable:"Unable to read sign-in protection settings. Repair the configuration or delete auth.json and set it up again.",crossOriginDenied:"Cross-site changes to sign-in protection are not allowed.",password:"Password",submit:"Sign in",submitting:"Signing in…",loginFailed:"Unable to sign in",invalidResponse:"Invalid response from the sign-in service",invalidCredentials:"Sign-in failed. Check your sign-in details and try again.",invalidInput:"Sign-in failed. Check your sign-in details and try again.",unavailable:"Sign-in is temporarily unavailable. Please try again later.",tooManyAttempts:"Too many sign-in attempts. Please try again later.",loginAlertTitle:"Unusual sign-in activity",loginAlertDescription:"More than 5 consecutive sign-in failures. Check whether these attempts were yours.",invalidClient:"Invalid client identifier"},"zh-CN":{title:"登录 Pi Desk",subtitle:"继续你的工作会话",protection:"登录保护",enabled:"已启用",disabled:"未启用",publicAccess:"任何能够访问此服务的人都可以进入工作台。",changePassword:"修改密码",setPassword:"设置密码",newPassword:"新密码",passwordHint:"12–64 个字符,至少包含大写字母、小写字母、数字、符号中的三类;不能有首尾空白、换行或不可见控制字符。",generatePassword:"生成密码",generatePasswordHint:"随机生成 16 位密码",generatePasswordFailed:"生成密码失败,请重试。",saveEffect:"请妥善保存密码。保存后,所有设备都需要重新登录。",enable:"启用登录保护",saveAndSignIn:"保存并重新登录",saving:"正在保存…",logout:"退出登录",signingOut:"正在退出…",logoutFailed:"退出登录失败,请稍后重试。",logoutInvalid:"退出登录参数无效。",logoutCrossOriginDenied:"不允许跨站退出登录。",disable:"关闭保护",disableTitle:"关闭登录保护?",disableDescription:"关闭后,任何能够访问此服务的人都可以直接进入工作台。是否继续?",recovery:"忘记密码?",recoveryDescription:"在运行服务的设备上删除下面的文件,然后刷新页面,即可恢复访问。",settingsFailed:"登录保护设置处理失败。",settingsInvalid:"密码不符合要求,请按输入框下方的规则调整。",configUnavailable:"登录保护配置无法读取,请修复配置或删除 auth.json 后重新设置。",crossOriginDenied:"不允许跨站修改登录保护。",password:"密码",submit:"登录",submitting:"正在登录",loginFailed:"登录失败",invalidResponse:"登录服务响应无效",invalidCredentials:"登录失败,请检查登录信息后重试。",invalidInput:"登录失败,请检查登录信息后重试。",unavailable:"登录暂不可用,请稍后重试。",tooManyAttempts:"登录尝试过多,请稍后重试。",loginAlertTitle:"登录异常提醒",loginAlertDescription:"登录已连续失败超过 5 次,请确认是否为本人操作。",invalidClient:"客户端标识无效"}}},30010:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{fA:()=>m,hZ:()=>j,s6:()=>k});var e=c(58311),f=c(70788),g=c(95220),h=c(61035),i=a([h]);h=(i.then?(await i)():i)[0];let l={mode:(0,g.P)()?"basic":"normal",notifications:[],plugins:{},capabilityModes:{},settings:{region:{locale:"en",timeZone:"UTC"}}};class m extends Error{constructor(a){super(`App Runtime target does not exist: ${a}`),this.name="L3AppRuntimeTargetNotFoundError"}}class n{constructor(a){this.settingsStore=a,this.runtime=e.GR.parse(l),this.listeners=new Set,this.disposed=!1,a?(this.runtime=e.GR.parse({...this.runtime,settings:a.getSnapshot()}),this.unsubscribeSettings=a.subscribe(()=>{this.applyInternal({key:"settings",update:a.getSnapshot()})})):this.unsubscribeSettings=null}readSnapshot(){return structuredClone(this.runtime)}subscribe(a){if(this.disposed)throw Error("App Runtime has been disposed");return this.listeners.add(a),()=>{this.listeners.delete(a)}}applyInternal(a){if(this.disposed)throw Error("App Runtime has been disposed");let b={type:"update",...a};this.runtime=(0,f.b)(this.runtime,b),this.publish(b)}applyClient(a){if(this.disposed)throw Error("App Runtime has been disposed");if("settings"===a.key){if(!this.settingsStore)throw Error("共享设置尚未就绪");return this.settingsStore.update(a.update.region)}if(!this.runtime.notifications.some(b=>b.notificationId===a.update.notificationId))throw new m(a.update.notificationId);this.applyInternal(a)}replace(a){if(this.disposed)throw Error("App Runtime has been disposed");let b={type:"replace",runtime:e.GR.parse(a)};this.runtime=(0,f.b)(this.runtime,b),this.publish(b)}dispose(){this.disposed||(this.disposed=!0,this.unsubscribeSettings?.(),this.runtime=e.GR.parse(l),this.listeners.clear())}publish(a){for(let b of[...this.listeners])b(structuredClone(a))}}function j(){return globalThis.__piDeskAppRuntime||(globalThis.__piDeskAppRuntime=new n((0,h.J)())),globalThis.__piDeskAppRuntime}function k(){let a=globalThis.__piDeskAppRuntime;globalThis.__piDeskAppRuntime=void 0,a?.dispose()}d()}catch(a){d(a)}})},42616:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Oe:()=>o,UI:()=>p,cW:()=>s,rH:()=>n,wK:()=>q,yJ:()=>r});var e=c(51071),f=c(42897),g=c(55341),h=c(86166),i=c(61035),j=c(15991),k=a([f,g,h,i]);[f,g,h,i]=k.then?(await k)():k;let r="pi-desk-session";function l(a){let b=(0,h.UM)(),c=globalThis.__piDeskLoginAttempts??=new WeakMap,d=c.get(b);if(d||(d={failures:0,publisher:b.createPublisher()},c.set(b,d)),a){d.failures=0;return}if(d.failures+=1,!(d.failures<=5)){6===d.failures&&console.warn("[Pi Desk][Auth] 连续登录失败超过阈值,发布登录异常提醒");try{let a=(0,i.J)().getSnapshot().region.locale,b=j.N[a];d.publisher.publish({key:"auth:login-failures",level:"warning",title:b.loginAlertTitle,description:b.loginAlertDescription})}catch(a){console.error("[Pi Desk][Auth] 登录异常提醒发布失败",{errorName:a instanceof Error?a.name:"UnknownError"})}}}class s extends Error{constructor(){super("请先登录"),this.name="L2AuthRequiredError"}}function m(a,b){return null===a||(0,e.aJ)((0,e.nV)(b,r),a.sessionSecret)}async function n(a){let b=(0,f.f4)();if(!b)return l(!0),{cookieName:r,token:"",maxAgeSeconds:0};let c=await (0,f.Z3)(a.password,b.passwordHash);if((0,f.f4)()?.sessionSecret!==b.sessionSecret)return null;if(!c)return l(!1),null;let d=Date.now();return(0,g.h)({loggedInAt:d}),l(!0),{cookieName:r,token:(0,e.y9)(b.sessionSecret,2592e3,d),maxAgeSeconds:2592e3}}function o(a){return m((0,f.f4)(),a)}function p(a){let b=(0,f.f4)();if(!m(b,a))throw new s;return{enabled:null!==b,configPath:(0,f.oz)()}}function q(a,b){let c=(globalThis.__piDeskAuthMutation??Promise.resolve()).then(async()=>{let c=(0,f.f4)();if(!m(c,b))throw new s;let d=null===a.password?null:{passwordHash:await (0,f.Ac)(a.password)};if((0,f.f4)()?.sessionSecret!==c?.sessionSecret)throw new s;(0,f.Mj)(d),l(!0),console.info("[Pi Desk][Auth] 登录保护已更新",{enabled:null!==d})});return globalThis.__piDeskAuthMutation=c.catch(()=>void 0),c}d()}catch(a){d(a)}})},42897:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Ac:()=>q,Mj:()=>s,Z3:()=>r,f4:()=>o,mm:()=>w,n5:()=>x,oz:()=>k});var e=c(71473),f=c(77598),g=c(73024),h=c(76760),i=c(59473),j=a([e]);e=(j.then?(await j)():j)[0];let t=i.Ik({passwordHash:i.Yj().regex(/^scrypt:[a-f0-9]{32}:[a-f0-9]{128}$/)}).strict(),u=t.extend({username:i.Yj().trim().min(1).max(64).optional()}),v=0;class w extends Error{constructor(){super("登录尝试过多,请稍后重试。"),this.name="L4AuthBusyError"}}class x extends Error{constructor(){super("登录保护配置无法读取,请修复配置或删除 auth.json 后重新设置"),this.name="L4AuthConfigError"}}function k(){return(0,h.join)((0,e.M)(),"auth.json")}function l(){return(0,h.join)((0,e.M)(),"auth-session-key")}function m(a){return a instanceof Error&&"code"in a&&"ENOENT"===a.code}function n(){let a=(0,g.readFileSync)(l(),"utf8").trim();if(!/^[a-f0-9]{64}$/.test(a))throw new x;return a}function o(){let a;try{a=(0,g.readFileSync)(k(),"utf8")}catch(a){if(m(a))return null;throw new x}try{let b=u.parse(JSON.parse(a)),c=void 0===b.username?[b.passwordHash]:[b.username,b.passwordHash],d=(0,f.createHmac)("sha256",n()).update(JSON.stringify(c)).digest("hex");return{passwordHash:b.passwordHash,sessionSecret:d}}catch{throw new x}}function p(a,b){return new Promise((c,d)=>{(0,f.scrypt)(a,Buffer.from(b,"hex"),64,{N:32768,r:8,p:1,maxmem:0x4000000},(a,b)=>{a?d(a):c(b)})})}async function q(a){let b=(0,f.randomBytes)(16).toString("hex"),c=await p(a,b);return`scrypt:${b}:${c.toString("hex")}`}async function r(a,b){if(v>=2)throw new w;v+=1;try{let[,c,d]=b.split(":"),e=await p(a,c);return(0,f.timingSafeEqual)(e,Buffer.from(d,"hex"))}finally{v-=1}}function s(a){let b=k();if(!a){try{(0,g.unlinkSync)(b)}catch(a){if(!m(a))throw a}return}let c=t.parse(a);(0,g.mkdirSync)((0,h.dirname)(b),{recursive:!0}),null===o()&&(0,g.writeFileSync)(l(),`${(0,f.randomBytes)(32).toString("hex")}
2
2
  `,{mode:384}),n(),(0,g.chmodSync)(l(),384);let d=`${b}.${process.pid}.${(0,f.randomUUID)()}.tmp`;try{(0,g.writeFileSync)(d,`${JSON.stringify(c,null,2)}
3
- `,{mode:384}),(0,g.renameSync)(d,b)}finally{try{(0,g.unlinkSync)(d)}catch(a){if(!m(a))throw a}}}d()}catch(a){d(a)}})},51071:(a,b,c)=>{c.d(b,{Il:()=>k,aJ:()=>i,es:()=>l,nV:()=>j,y9:()=>h});var d=c(77598);let e=/^(\d+)\.([a-f0-9]{64})$/;function f(a){return(0,d.createHash)("sha256").update(a,"utf8").digest()}function g(a,b){return(0,d.createHmac)("sha256",b).update(`Pi Desk web session:${a}`,"utf8").digest("hex")}function h(a,b,c=Date.now()){let d=c+1e3*b;if(!Number.isSafeInteger(d))throw Error("登录会话过期时间无效");return`${d}.${g(d,a)}`}function i(a,b,c=Date.now()){var h,j;if(!a||!b)return!1;let k=e.exec(a);if(!k)return!1;let l=Number(k[1]);return!!Number.isSafeInteger(l)&&!(l<c)&&(h=k[2],j=g(l,b),(0,d.timingSafeEqual)(f(h),f(j)))}function j(a,b){if(a)for(let c of a.split(";")){let a=c.indexOf("=");if(!(a<0)&&c.slice(0,a).trim()===b)try{return decodeURIComponent(c.slice(a+1).trim())}catch{break}}}function k(a,b){return"https:"===new URL(a).protocol||b?.split(",",1)[0]?.trim().toLowerCase()==="https"}function l(a,b,c,d){let e=[`${a}=${encodeURIComponent(b)}`,"Path=/",`Max-Age=${c}`,"HttpOnly","SameSite=Strict"];return d&&e.push("Secure"),e.join("; ")}},53461:(a,b,c)=>{c.d(b,{F1:()=>g,G6:()=>j,Kc:()=>m,SD:()=>i,W:()=>e,Xm:()=>h,mj:()=>f,uZ:()=>l});var d=c(59473);let e=d.Ik({password:d.Yj().min(1).max(256)}).strict(),f=d.Ik({}).strict(),g=d.Ik({}).strict(),h=d.Ik({}).strict(),i=d.Ik({}).strict(),j=d.Ik({enabled:d.zM(),configPath:d.Yj()}).strict(),k=d.Yj().min(12).max(256).refine(a=>a===a.trim()&&!/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(a)).refine(a=>[/[A-Z]/,/[a-z]/,/[0-9]/,/[\p{P}\p{S}]/u].filter(b=>b.test(a)).length>=3),l=d.KC([e.extend({password:k}),d.Ik({password:d.ch()}).strict()]),m=d.Ik({}).strict()},55341:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{h:()=>k});var e=c(71473),f=c(77598),g=c(73024),h=c(76760),i=c(59473),j=a([e]);e=(j.then?(await j)():j)[0];let l=i.Ik({loggedInAt:i.ai().int().nonnegative()}),m=i.YO(l);function k(a){let b=l.parse(a),c=(0,h.join)((0,e.M)(),"login-records.json"),d=[...function(a){if(!(0,g.existsSync)(a))return[];try{return m.parse(JSON.parse((0,g.readFileSync)(a,"utf8")))}catch(a){return console.warn("[Pi Desk][LoginRecordStore] 登录记录文件无效,将重新创建",{errorName:a instanceof Error?a.name:"UnknownError"}),[]}}(c),b].slice(-100);(0,g.mkdirSync)((0,h.dirname)(c),{recursive:!0});let i=`${c}.${process.pid}.${(0,f.randomUUID)()}.tmp`;try{(0,g.writeFileSync)(i,`${JSON.stringify(d,null,2)}
3
+ `,{mode:384}),(0,g.renameSync)(d,b)}finally{try{(0,g.unlinkSync)(d)}catch(a){if(!m(a))throw a}}}d()}catch(a){d(a)}})},51071:(a,b,c)=>{c.d(b,{Il:()=>k,aJ:()=>i,es:()=>l,nV:()=>j,y9:()=>h});var d=c(77598);let e=/^(\d+)\.([a-f0-9]{64})$/;function f(a){return(0,d.createHash)("sha256").update(a,"utf8").digest()}function g(a,b){return(0,d.createHmac)("sha256",b).update(`Pi Desk web session:${a}`,"utf8").digest("hex")}function h(a,b,c=Date.now()){let d=c+1e3*b;if(!Number.isSafeInteger(d))throw Error("登录会话过期时间无效");return`${d}.${g(d,a)}`}function i(a,b,c=Date.now()){var h,j;if(!a||!b)return!1;let k=e.exec(a);if(!k)return!1;let l=Number(k[1]);return!!Number.isSafeInteger(l)&&!(l<c)&&(h=k[2],j=g(l,b),(0,d.timingSafeEqual)(f(h),f(j)))}function j(a,b){if(a)for(let c of a.split(";")){let a=c.indexOf("=");if(!(a<0)&&c.slice(0,a).trim()===b)try{return decodeURIComponent(c.slice(a+1).trim())}catch{break}}}function k(a,b){return"https:"===new URL(a).protocol||b?.split(",",1)[0]?.trim().toLowerCase()==="https"}function l(a,b,c,d){let e=[`${a}=${encodeURIComponent(b)}`,"Path=/",`Max-Age=${c}`,"HttpOnly","SameSite=Strict"];return d&&e.push("Secure"),e.join("; ")}},53461:(a,b,c)=>{c.d(b,{F1:()=>g,G6:()=>j,Kc:()=>m,SD:()=>i,W:()=>e,Xm:()=>h,mj:()=>f,uZ:()=>l});var d=c(59473);let e=d.Ik({password:d.Yj().min(1).max(64)}).strict(),f=d.Ik({}).strict(),g=d.Ik({}).strict(),h=d.Ik({}).strict(),i=d.Ik({}).strict(),j=d.Ik({enabled:d.zM(),configPath:d.Yj()}).strict(),k=d.Yj().min(12).max(64).refine(a=>a===a.trim()&&!/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(a)).refine(a=>[/[A-Z]/,/[a-z]/,/[0-9]/,/[\p{P}\p{S}]/u].filter(b=>b.test(a)).length>=3),l=d.KC([e.extend({password:k}),d.Ik({password:d.ch()}).strict()]),m=d.Ik({}).strict()},55341:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{h:()=>k});var e=c(71473),f=c(77598),g=c(73024),h=c(76760),i=c(59473),j=a([e]);e=(j.then?(await j)():j)[0];let l=i.Ik({loggedInAt:i.ai().int().nonnegative()}),m=i.YO(l);function k(a){let b=l.parse(a),c=(0,h.join)((0,e.M)(),"login-records.json"),d=[...function(a){if(!(0,g.existsSync)(a))return[];try{return m.parse(JSON.parse((0,g.readFileSync)(a,"utf8")))}catch(a){return console.warn("[Pi Desk][LoginRecordStore] 登录记录文件无效,将重新创建",{errorName:a instanceof Error?a.name:"UnknownError"}),[]}}(c),b].slice(-100);(0,g.mkdirSync)((0,h.dirname)(c),{recursive:!0});let i=`${c}.${process.pid}.${(0,f.randomUUID)()}.tmp`;try{(0,g.writeFileSync)(i,`${JSON.stringify(d,null,2)}
4
4
  `,"utf8"),(0,g.renameSync)(i,c)}finally{(0,g.existsSync)(i)&&(0,g.unlinkSync)(i)}}d()}catch(a){d(a)}})},70788:(a,b,c)=>{c.d(b,{b:()=>e});var d=c(58311);function e(a,b){if("replace"===b.type)return d.GR.parse(b.runtime);if("notifications"===b.key)return d.GR.parse({...a,notifications:function(a,b){if("add"===b.type){if(a.some(a=>a.notificationId===b.notification.notificationId))throw Error(`Notification already exists: ${b.notification.notificationId}`);return[...a,b.notification]}let c=a.findIndex(a=>a.notificationId===b.notificationId);if(c<0)throw Error(`Notification does not exist: ${b.notificationId}`);if("delete"===b.type)return a.filter(a=>a.notificationId!==b.notificationId);let d=[...a];return d[c]={...a[c],...b.changes},d}(a.notifications,b.update)});if("settings"===b.key)return d.GR.parse({...a,settings:b.update});if("capabilityModes"===b.key)return d.GR.parse({...a,capabilityModes:b.update});let c={...a.plugins};if(null===b.update.state){if(!(b.update.pluginName in c))throw Error(`Plugin global state does not exist: ${b.update.pluginName}`);delete c[b.update.pluginName]}else c[b.update.pluginName]=b.update.state;return d.GR.parse({...a,plugins:c})}},86166:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{HM:()=>l,UM:()=>k});var e=c(77598),f=c(57975),g=c(58311),h=c(24187),i=c(30010),j=a([i]);i=(j.then?(await j)():j)[0];class m extends Error{constructor(a){super(`Notification does not exist: ${a}`),this.name="L3AppNotificationNotFoundError"}}class n extends Error{constructor(a){super(`Notification is owned by another publisher: ${a}`),this.name="L3AppNotificationOwnerError"}}class o{constructor(a=(0,i.hZ)()){this.runtime=a,this.ownersByNotificationId=new Map,this.disposed=!1,this.unsubscribe=a.subscribe(a=>{if("replace"===a.type){let b=new Set(a.runtime.notifications.map(a=>a.notificationId));for(let a of this.ownersByNotificationId.keys())b.has(a)||this.ownersByNotificationId.delete(a);return}"notifications"===a.key&&"delete"===a.update.type&&this.ownersByNotificationId.delete(a.update.notificationId)})}createPublisher(){this.ensureActive();let a={},b=!0;return{publish:c=>{if(!b)throw Error("App Notification Publisher has been disposed");return this.publish(a,c)},update:(c,d)=>{if(!b)throw Error("App Notification Publisher has been disposed");this.update(a,c,d)},delete:c=>{if(!b)throw Error("App Notification Publisher has been disposed");this.delete(a,c)},dispose:()=>{b&&(b=!1,this.releaseOwner(a))}}}publishPlugin(a,b){this.ensureActive();let c=h.tv.parse(a),d=g.MQ.parse(b);return this.publish(c,{key:d.key,level:d.level,title:d.title,...void 0===d.description?{}:{description:d.description},event:d.event?{type:"plugin",pluginName:c,name:d.event.name,data:d.event.data}:null})}updatePlugin(a,b,c){this.ensureActive(),this.update(h.tv.parse(a),b,g.A8.parse(c))}deletePlugin(a,b){this.ensureActive(),this.delete(h.tv.parse(a),b)}releasePlugin(a){this.disposed||this.releaseOwner(h.tv.parse(a))}dispose(){this.disposed||(this.disposed=!0,this.unsubscribe(),this.ownersByNotificationId.clear())}publish(a,b){if(this.ensureActive(),b.event?.type==="plugin"&&Buffer.byteLength(JSON.stringify(b.event.data),"utf8")>65536)throw Error("Plugin notification event data exceeds 64KB");let c=g.UH.optional().parse(b.key),d=this.runtime.readSnapshot().notifications,h=void 0===c?void 0:d.find(b=>{let d=this.ownersByNotificationId.get(b.notificationId);return d?.owner===a&&d.key===c}),i=g.Xo.parse({notificationId:h?.notificationId??(0,e.randomUUID)(),level:b.level,title:b.title,description:b.description??null,createdAt:h?.createdAt??Date.now(),event:b.event??null});if(h){let b={level:i.level,title:i.title,description:i.description,event:i.event};return h.level===b.level&&h.title===b.title&&h.description===b.description&&(0,f.isDeepStrictEqual)(h.event,b.event)||this.update(a,h.notificationId,b),h.notificationId}let j=d.length>=100?d[0]:void 0;j&&this.runtime.applyInternal({key:"notifications",update:{type:"delete",notificationId:j.notificationId}}),this.ownersByNotificationId.set(i.notificationId,{owner:a,key:c});try{this.runtime.applyInternal({key:"notifications",update:{type:"add",notification:i}})}catch(a){throw this.ownersByNotificationId.delete(i.notificationId),a}return i.notificationId}update(a,b,c){this.ensureActive(),this.assertOwner(a,b),this.runtime.applyInternal({key:"notifications",update:{type:"update",notificationId:b,changes:g.Wh.parse(c)}})}delete(a,b){this.ensureActive(),this.assertOwner(a,b),this.runtime.applyInternal({key:"notifications",update:{type:"delete",notificationId:b}})}releaseOwner(a){let b=new Set(this.runtime.readSnapshot().notifications.map(a=>a.notificationId));for(let c of[...this.ownersByNotificationId.entries()].filter(([,b])=>b.owner===a).map(([a])=>a)){if(!b.has(c)){this.ownersByNotificationId.delete(c);continue}this.runtime.applyInternal({key:"notifications",update:{type:"delete",notificationId:c}})}}assertOwner(a,b){let c=this.ownersByNotificationId.get(b);if(!c)throw new m(b);if(c.owner!==a)throw new n(b)}ensureActive(){if(this.disposed)throw Error("App Notification Runtime has been disposed")}}function k(){return globalThis.__piDeskAppNotificationRuntime||(globalThis.__piDeskAppNotificationRuntime=new o),globalThis.__piDeskAppNotificationRuntime}function l(){let a=globalThis.__piDeskAppNotificationRuntime;globalThis.__piDeskAppNotificationRuntime=void 0,a?.dispose()}d()}catch(a){d(a)}})}};
@@ -1 +1 @@
1
- "use strict";exports.id=6917,exports.ids=[6917],exports.modules={18:(a,b,c)=>{c.d(b,{FR:()=>m,kn:()=>l,zR:()=>k});var d=c(89409),e=c(25984);function f(a){return`${a.location.index}:${a.location.entryId}`}let g={user:["viewKey","hasDetail"],assistant:["viewKey","status","hasDetail","usage"],tool:["viewKey","status","hasDetail","usage"],bash:["viewKey","status","hasDetail"],custom:["viewKey","hasDetail"]};function h(a,b,c){if(!b)return a;let e={...a,...b};return"summary"===c?d.Hf.parse(e):d.D8.parse(e)}function i(a,b){if(Array.isArray(a.parent)){if("number"!=typeof a.key)throw Error("Increment array key is invalid");a.parent[a.key]=b;return}if("string"!=typeof a.key)throw Error("Increment object key is invalid");a.parent[a.key]=b}function j(a,b,c){let e=structuredClone(a),f=function(a,b){if(0===b.length)throw Error("Increment cannot append to the message layer root");let c=a;for(let a of b.slice(0,-1)){if("number"==typeof a){if(!Array.isArray(c)||a>=c.length)throw Error(`Increment array path does not exist: ${a}`);c=c[a];continue}if(!c||"object"!=typeof c||Array.isArray(c))throw Error(`Increment object path does not exist: ${a}`);if(!Object.hasOwn(c,a))throw Error(`Increment object field does not exist: ${a}`);c=c[a]}let d=b.at(-1);if("number"==typeof d){if(!Array.isArray(c)||d>=c.length)throw Error(`Increment array target does not exist: ${d}`);return{parent:c,key:d,value:c[d]}}if(!c||"object"!=typeof c||Array.isArray(c))throw Error(`Increment object target does not exist: ${d}`);if(!Object.hasOwn(c,d))throw Error(`Increment target does not exist: ${d}`);return{parent:c,key:d,value:c[d]}}(e,b);if("string"==typeof c){if("string"!=typeof f.value)throw Error("Increment target is not a string");return i(f,`${f.value}${c}`),d.Hf.parse(e)}if(!Array.isArray(f.value))throw Error("Increment target is not an array");return i(f,[...f.value,...c]),d.Hf.parse(e)}function k(a,b,c){let e=new Map(a.messages.filter(a=>void 0!==a.detail).map(a=>[f(a),a]));return{messages:b.map(a=>{let b=e.get(f(a));return a.fixed.hasDetail&&b&&b.fixed.type===a.fixed.type&&b.fixed.viewKey===a.fixed.viewKey&&void 0!==b.detail?d.mj.parse({...a,detail:b.detail}):a}),temporaryMessages:[...c]}}function l(a,b){if("message_start"===b.type){if(a.temporaryMessages.some(a=>a.location.tempId===b.snapshot.location.tempId))throw Error(`Temporary conversation message already exists: ${b.snapshot.location.tempId}`);return{...a,temporaryMessages:[...a.temporaryMessages,b.snapshot]}}let c=a.temporaryMessages.findIndex(a=>a.location.tempId===b.location.tempId);if(c<0)throw Error(`Temporary conversation message was not found: ${b.location.tempId}`);if("message_update"===b.type){let f=[...a.temporaryMessages];return f[c]=function(a,b){var c,f;if(a.location.tempId!==b.location.tempId)throw Error(`Conversation update tempId mismatch: ${b.location.tempId}`);let i=(c=a.fixed,(f=b.fixed)?(!function(a,b,c){let d=Object.keys(a).filter(a=>!b.includes(a));if(d.length>0)throw Error(`${c} patch contains fields invalid for the current message: ${d}`)}(f,g[c.type],`${c.type} fixed`),d.q5.parse({...c,...f})):c),k=h(a.summary,b.summary,"summary"),l=a.detail;if(void 0!==b.detail||Object.keys(b.increments??{}).some(a=>"detail"===(0,e.U)(a).root)){if(b.fixed?.hasDetail===!1)throw Error("Realtime detail cannot be updated while explicitly clearing hasDetail");i.hasDetail||(i=d.q5.parse({...i,hasDetail:!0}))}for(let[a,c]of(b.detail&&(l=h(l??{},b.detail,"detail")),Object.entries(b.increments??{}))){let b=(0,e.U)(a);"summary"===b.root?k=j(k,b.segments,c):l=j(l??{},b.segments,c)}return i.hasDetail||(l=void 0),d.s4.parse({location:a.location,fixed:i,summary:k,...void 0===l?{}:{detail:l}})}(f[c],b),{...a,temporaryMessages:f}}if("message_discard"===b.type)return{...a,temporaryMessages:a.temporaryMessages.filter(a=>a.location.tempId!==b.location.tempId)};if(b.durable.index!==a.messages.length)throw Error(`Conversation commit index is not continuous: expected ${a.messages.length}, received ${b.durable.index}`);if(a.messages.some(a=>a.location.entryId===b.durable.entryId))throw Error(`Conversation commit entryId already exists: ${b.durable.entryId}`);let{detail:f,fixed:i,...k}=a.temporaryMessages[c],l=d.mj.parse({...k,location:b.durable,fixed:{...i,timestampMs:b.fixed.timestampMs},...i.hasDetail&&void 0!==f?{detail:f}:{}});return{messages:[...a.messages,l],temporaryMessages:a.temporaryMessages.filter(a=>a.location.tempId!==b.location.tempId)}}function m(a,b){return"durable_append"===b.type?function(a,b){let c=a.messages.length;if(b.messages[0]?.location.index!==c)throw Error(`Conversation append index is not continuous: expected ${c}, received ${b.messages[0]?.location.index}`);let d=new Set(a.messages.map(a=>a.location.entryId));for(let a of b.messages){if(d.has(a.location.entryId))throw Error(`Conversation append entryId already exists: ${a.location.entryId}`);d.add(a.location.entryId)}return{...a,messages:[...a.messages,...b.messages]}}(a,b):l(a,b)}},610:(a,b,c)=>{c.d(b,{PS:()=>k,ef:()=>i,gK:()=>j,hS:()=>h,mv:()=>n});var d=c(59473),e=c(89409),f=c(2364),g=c(25984);let h=d.Ik({type:d.eu("message_start"),snapshot:e.s4}).strict(),i=d.Ik({type:d.eu("message_update"),location:e.fb,fixed:e.dG.optional(),summary:e.XW.optional(),detail:e.wH.optional(),increments:e.fK.optional()}).strict().superRefine((a,b)=>{if(!a.fixed&&!a.summary&&!a.detail&&!a.increments)return void b.addIssue({code:"custom",message:"message update requires a changed layer"});let c=[];for(let b of Object.keys(a.increments??{}))try{c.push({raw:b,parsed:(0,g.U)(b)})}catch{}for(let d of c){let c="summary"===d.parsed.root?Object.keys(a.summary??{}):Object.keys(a.detail??{}),e=d.parsed.segments[0];(0===d.parsed.segments.length||"string"==typeof e&&c.includes(e))&&b.addIssue({code:"custom",message:"replacement and increment paths cannot overlap",path:["increments",d.raw]})}for(let a=0;a<c.length;a+=1)for(let d=a+1;d<c.length;d+=1){let e=c[a],f=c[d];((0,g.v)(e.parsed,f.parsed)||(0,g.v)(f.parsed,e.parsed))&&b.addIssue({code:"custom",message:"increment parent and child paths cannot overlap",path:["increments",f.raw]})}}),j=d.Ik({type:d.eu("message_commit"),location:e.fb,durable:e.V6,fixed:d.Ik({timestampMs:f.k}).strict()}).strict(),k=d.Ik({type:d.eu("message_discard"),location:e.fb}).strict(),l=d.Ik({type:d.eu("durable_append"),messages:d.YO(e.mj).min(1)}).strict().superRefine((a,b)=>{let c=new Set;for(let[d,e]of a.messages.entries())d>0&&e.location.index!==a.messages[d-1].location.index+1&&b.addIssue({code:"custom",message:"durable append message indexes must be continuous",path:["messages",d,"location","index"]}),c.has(e.location.entryId)&&b.addIssue({code:"custom",message:"durable append entryId values must be unique",path:["messages",d,"location","entryId"]}),c.add(e.location.entryId)}),m=d.KC([h,i,j,k]),n=d.KC([l,m])},2002:(a,b,c)=>{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()},2364:(a,b,c)=>{c.d(b,{k:()=>d});let d=c(59473).ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER)},12683:(a,b,c)=>{c.d(b,{FF:()=>h,LK:()=>i});var d=c(59473),e=c(24187),f=c(43037);let g=d.Ik({name:d.Yj().trim().min(1),description:d.Yj(),parameters:e.Dz}).strict(),h=d.Ik({source:f.Pi}).strict(),i=d.Ik({systemPrompt:d.Yj(),tools:d.YO(g)}).strict()},24187:(a,b,c)=>{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()])},25984:(a,b,c)=>{function d(a){if(!/^(0|[1-9]\d*)$/.test(a))return a;let b=Number(a);if(!Number.isSafeInteger(b))throw Error(`Increment array index is invalid: ${a}`);return b}function e(a){if(!a||a.length>1024)throw Error("Increment path length is invalid");let b=[],c="",e=!1;for(let d of a){if(e){if("."!==d&&"\\"!==d)throw Error(`Increment path contains an invalid escape: \\${d}`);c+=d,e=!1;continue}if("\\"===d){e=!0;continue}if("."===d){if(!c)throw Error("Increment path contains an empty segment");b.push(c),c="";continue}c+=d}if(e)throw Error("Increment path ends with an escape");if(!c)throw Error("Increment path contains an empty segment");b.push(c);let f=b.shift();if("summary"!==f&&"detail"!==f)throw Error("Increment path root must be summary or detail");return{root:f,segments:b.map(d)}}function f(a,b){return a.root===b.root&&!(a.segments.length>b.segments.length)&&a.segments.every((a,c)=>a===b.segments[c])}c.d(b,{U:()=>e,v:()=>f})},40750:(a,b,c)=>{c.d(b,{L6:()=>e,k_:()=>f});var d=c(18);let e={extensionMode:"normal",presentationMode:"normal",initializationError:null,queues:{steering:[],followUp:[]},model:null,capabilityMode:null,contextUsage:null,plugins:{}};function f(a,b){if("session_sync"===b.type){if("full"===b.mode)return{...(0,d.zR)(a,b.messages,b.temporaryMessages),runtime:b.runtime};let c=a.messages.at(-1);if(!c||c.location.index!==b.baseCursor.index||c.location.entryId!==b.baseCursor.entryId)throw Error("Incremental chat sync does not match the current durable cursor");let e=new Set(a.messages.map(a=>a.location.entryId));for(let a of b.messages){if(e.has(a.location.entryId))throw Error(`Incremental chat sync contains a duplicate entryId: ${a.location.entryId}`);e.add(a.location.entryId)}return{messages:[...a.messages,...b.messages],temporaryMessages:b.temporaryMessages,runtime:b.runtime}}return"runtime_update"===b.type?{...a,runtime:b.runtime}:{...(0,d.kn)(a,b),runtime:a.runtime}}Object.freeze({messages:[],temporaryMessages:[],runtime:e})},41468:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Cz:()=>j,Ht:()=>g.H,NA:()=>k,QS:()=>i});var e=c(96459),f=c(79626),g=c(72904),h=a([e]);function i(a,b,c,d=!1,g="temporary",h=!1){return(0,f.d)(a,b,c,h?[]:(0,e.WE)().readMessageDeclarations(),d,g)}function j(a,b,c,d,g,h=!1){return(0,f.N)(a,b,c,d,g,h?[]:(0,e.WE)().readMessageDeclarations())}function k(a){let{detail:b,...c}=a;return c}e=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},43037:(a,b,c)=>{c.d(b,{DK:()=>r,Pi:()=>q,R3:()=>m,TV:()=>A,UR:()=>s,VK:()=>D,kF:()=>F,mB:()=>G,oc:()=>C,ps:()=>E,w$:()=>w,wR:()=>p,wf:()=>B,xE:()=>n,xh:()=>t,yI:()=>o});var d=c(59473),e=c(20369),f=c(54733),g=c(89409),h=c(62977),i=c(96089);let j=g.Pc,k=g.LJ,l=g.mh,m=g.fb,n=g.lJ,o=g.s4,p=g.mj,q=i.R,r=d.Ik({index:k,entryId:f.C3}).strict(),s=d.KC([d.ch(),r]),t=l.extend({data:d.Yj().min(1)}).strict(),u=h.$,v=d.Ik({tempId:j,text:d.Yj(),images:d.YO(l).max(10)}).strict(),w=d.Ik({provider:d.Yj().trim().min(1),modelId:d.Yj().trim().min(1),thinkingLevel:u}).strict(),x=d.Ik({tokens:d.ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER).nullable(),contextWindow:d.ai().int().positive().max(Number.MAX_SAFE_INTEGER)}).strict(),y=d.g1(d.Yj(),d.Pq()),z=d.g1(d.Yj().min(1),y),A=d.k5(["normal","basic"]),B=d.Ik({extensionMode:A.default("normal"),presentationMode:A.default("normal"),initializationError:d.Yj().max(32e3).nullable().default(null),queues:d.Ik({steering:d.YO(v),followUp:d.YO(v)}).strict(),model:w.nullable(),capabilityMode:e.rY.nullable(),contextUsage:x.nullable(),plugins:z}).strict(),C=g.RX.extend({runtime:B}).strict(),D=d.Ik({sessionId:f.Kx,branchId:f._A,entryId:f.C3}).strict(),E=g.XM,F=D.extend({imageIndex:d.ai().int().nonnegative()}).strict(),G=g.y0},47574:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{VB:()=>t,dM:()=>q,hr:()=>r,nJ:()=>s,yO:()=>u});var e=c(76760),f=c(69503),g=c(12683),h=c(43037),i=c(40750),j=c(95220),k=c(32980),l=c(41468),m=c(72498),n=a([k,l,m]);[k,l,m]=n.then?(await n)():n;class q extends Error{constructor(a){super(`Chat source is not current: ${a.workId}/${a.sessionId}/${a.branchId}`),this.name="L2ChatSourceBindingError"}}class r extends Error{constructor(a){super(`Chat message was not found: ${a}`),this.name="L2ChatMessageNotFoundError"}}class s extends Error{constructor(a){super(`Chat commands are blocked by WorkSession lifecycle: ${a}`),this.name="L2ChatLifecycleBlockedError"}}class t extends Error{constructor(a,b){super(`工作会话 ${a} 阻止插件重载:${b}`),this.workId=a,this.reason=b,this.name="L2PluginReloadBlockedError"}}function o(a){try{return structuredClone(a)}catch{let{declaration:b,...c}=a;return structuredClone(c)}}function p(a,b){return JSON.stringify(a)===JSON.stringify(b)}class u{async initialize(a){let b=a.map(a=>this.buildRecord(a));for(let a of(this.recordsByWorkId.clear(),b))this.recordsByWorkId.set(a.source.workId,a)}addWorkSession(a){this.recordsByWorkId.set(a.workId,this.buildRecord(a))}async replaceWorkSession(a,b){let c=this.recordsByWorkId.get(a.workId)?.source;await this.closeRecord(a.workId),c&&this.publish({type:"source_invalidated",source:c}),this.recordsByWorkId.set(b.workId,this.buildRecord(b)),a.sessionId!==b.sessionId&&await (0,m.gb)(a.sessionId)}async refreshWorkSession(a){let b=this.recordsByWorkId.get(a.workId)?.source;await this.closeRecord(a.workId),b&&this.publish({type:"source_invalidated",source:b}),this.recordsByWorkId.set(a.workId,this.buildRecord(a))}async removeWorkSession(a){let b=this.recordsByWorkId.get(a.workId)?.source;await this.closeRecord(a.workId),b&&this.publish({type:"source_invalidated",source:b}),await (0,m.gb)(a.sessionId)}async pauseWorkSession(a){let b=this.recordsByWorkId.get(a);b&&(b.acceptingCommands=!1,(0,m.ls)(b.source.sessionId).nativeUi.cancelAll(),await b.commandTail)}resumeWorkSession(a){let b=this.recordsByWorkId.get(a);b&&(b.acceptingCommands=!0)}async pauseForProcessRestart(){let a=[...this.recordsByWorkId.values()],b=a.map(a=>({record:a,reason:this.pluginReloadBlockReason(a)})).find(a=>null!==a.reason);if(b?.reason)throw new t(b.record.source.workId,b.reason);for(let b of a)b.acceptingCommands=!1;await Promise.all(a.map(a=>a.commandTail));let c=a.map(a=>({record:a,reason:this.pluginReloadBlockReason(a)})).find(a=>null!==a.reason);if(c?.reason){for(let b of a)b.acceptingCommands=!0;throw new t(c.record.source.workId,c.reason)}let d=!0;return()=>{if(d)for(let b of(d=!1,a))this.recordsByWorkId.get(b.source.workId)===b&&(b.acceptingCommands=!0)}}metadataFor(a){return this.recordFor(a).metadata}statusFor(a){return this.statusForRecord(this.recordFor(a))}statusForRecord(a){return a.mainRunning?"main_running":a.backgroundTaskIds.size>0?"background_running":a.completedPending?"completed":"idle"}acknowledgeCompleted(a){let b=this.recordsByWorkId.get(a);if(!b||!b.completedPending)return!1;let c=this.statusForRecord(b);return b.completedPending=!1,this.publishRecordChanged(a,b.metadata,c),!0}isCurrentSource(a){let b=h.Pi.parse(a),c=this.recordsByWorkId.get(b.workId);return void 0!==c&&this.matches(c.source,b)}getProjectPreviewContext(a,b){let c=this.recordsByWorkId.get(a.workId);if(!c||c.workSession!==a)return null;let d=(0,f.Yj)((0,e.resolve)(b)),g=d===(0,f.Yj)((0,e.resolve)(a.cwd)),h=()=>(0,f.D)(c.state.runtime.plugins[f.s6]).directories.find(a=>(0,f.Yj)(a)===d),i=g?a.cwd:h();if(!i)return null;let j=()=>this.recordsByWorkId.get(a.workId)===c&&c.acceptingCommands&&this.matches(c.source,this.sourceFor(a))&&(g||void 0!==h());return j()?{cwd:i,isCurrent:j}:null}refreshPluginMessages(){for(let a of this.recordsByWorkId.values())if("basic"!==a.state.runtime.presentationMode)try{this.reprojectRecord(a,a.state.runtime.presentationMode)}catch(b){console.error("[Pi Desk][WorkSessionChatRuntime] 插件消息刷新失败,保留已有聊天",{workId:a.source.workId,message:b instanceof Error?b.message:String(b)})}}setPresentation(a,b){let c=this.currentRecord(a);return this.enqueueCommand(c,async()=>{if(((0,j.P)()||"basic"===c.state.runtime.extensionMode)&&"normal"===b)throw Error("基础模式不启用插件消息展示,请先恢复插件聊天");c.state.runtime.presentationMode!==b&&this.reprojectRecord(c,b)})}reprojectRecord(a,b){let c=(0,m.ls)(a.source.sessionId).readChatSnapshot(),d=new Map(c.entries.map(a=>[a.entryId,a])),e="basic"===b,f=a.state.messages.map(b=>{let c=d.get(b.location.entryId);if(!c)throw Error(`无法重新投影消息:${b.location.entryId}`);return(0,l.Cz)(b.location.index,c.entryId,c.timestampMs,c.message,a.source,e)}),g=a.state.temporaryMessages.map(b=>{let c=a.rawTemporaryMessages.get(b.location.tempId);if(!c)throw Error(`临时消息基线尚不可重投影:${b.location.tempId}`);return(0,l.QS)(b.location.tempId,c,a.source,!1,"update",e)});a.state={messages:f,temporaryMessages:g,runtime:{...a.state.runtime,presentationMode:b}},a.forceFullSync=!0,a.sourceEventVersion+=1,this.publish({type:"source_event",source:a.source,version:a.sourceEventVersion,event:this.createSync(a.source,null).event})}prepareSource(a){let b=this.currentRecord(a);return this.enqueueCommand(b,()=>this.syncRecordRuntime(b))}async syncRecordRuntime(a){let b=a.source,c=h.wf.parse({...await (0,m.ls)(b.sessionId).readChatRuntime(),presentationMode:a.state.runtime.presentationMode});this.isCurrentSource(b)&&(p(a.state.runtime,c)||this.applySourceEvent(b,{type:"runtime_update",runtime:c}),"basic"===c.extensionMode&&"basic"!==a.state.runtime.presentationMode&&this.reprojectRecord(a,"basic"))}createSync(a,b){let c=this.currentRecord(a),d=c.source,e=c.state.messages,f=c.state.temporaryMessages,g=c.state.runtime,h=null===b?void 0:e[b.index],i=null!==b&&h?.location.entryId===b.entryId;return null===b||i||console.warn("[Pi Desk][WorkSessionChatRuntime] 客户端消息 cursor 不匹配,回退全量",{workId:d.workId,sessionId:d.sessionId,branchId:d.branchId,clientCursorIndex:b.index,clientCursorEntryId:b.entryId,serverEntryIdAtIndex:h?.location.entryId??null,serverLatestIndex:e.at(-1)?.location.index??-1}),{event:null!==b&&i&&!c.forceFullSync?{type:"session_sync",mode:"incremental",baseCursor:b,messages:e.slice(b.index+1).map(l.NA),temporaryMessages:f,runtime:g}:{type:"session_sync",mode:"full",baseCursor:null,messages:e.map(l.NA),temporaryMessages:f,runtime:g},watermark:c.sourceEventVersion}}getImage(a){let b=h.kF.parse(a),c=this.recordForSession(b.sessionId,b.branchId),d=c.state.messages.find(a=>a.location.entryId===b.entryId);if(!d||"user"!==d.fixed.type&&"tool"!==d.fixed.type)throw new r(`${b.entryId}/${b.imageIndex}`);return h.mB.parse((0,m.ls)(c.source.sessionId).readChatImage(b.entryId,b.imageIndex))}getMessageDetail(a){let b=h.VK.parse(a),c=this.recordForSession(b.sessionId,b.branchId).state.messages.find(a=>a.location.entryId===b.entryId);if(!c)throw new r(b.entryId);return h.ps.parse({index:c.location.index,entryId:c.location.entryId,detail:c.detail??null})}getModelContext(a){let b=g.FF.parse(a),c=this.currentRecord(b.source);return this.enqueueCommand(c,async()=>g.LK.parse(await (0,m.ls)(c.source.sessionId).readModelContext()))}send(a){let b=this.currentRecord(a.source);if((0,m.ls)(a.source.sessionId).nativeUi.hasPending)return Promise.reject(Error("请先处理当前插件问题,或停止当前任务"));let c=()=>b.workSession.send({mode:a.mode,text:a.text,images:a.images});return b.compactionStart?b.acceptingCommands?b.compactionStart.then(a=>{if(!b.acceptingCommands)throw new s(b.source.workId);return a?c():this.enqueueCommand(b,c)}):Promise.reject(new s(b.source.workId)):this.enqueueCommand(b,c)}interrupt(a){let b=this.currentRecord(a);return(0,m.ls)(a.sessionId).nativeUi.hasPending?b.workSession.interrupt():this.enqueueCommand(b,()=>b.workSession.interrupt())}compact(a){let b,c=this.currentRecord(a);if(c.compactionStart)return Promise.reject(Error("上下文正在压缩"));let d=new Promise(a=>{b=a});c.compactionStart=d;let e=this.enqueueCommand(c,()=>{try{let a=(0,m.ls)(c.source.sessionId).compact();return b(!0),a}catch(a){throw b(!1),a}});return e.then(()=>{b(!1),c.compactionStart===d&&(c.compactionStart=null)},()=>{b(!1),c.compactionStart===d&&(c.compactionStart=null)}),e}reload(a,b){let c=this.currentRecord(a);return(0,m.ls)(a.sessionId).nativeUi.cancelAll(),this.enqueueCommand(c,async()=>{try{await (0,m.ls)(c.source.sessionId).reload(b)}finally{this.recordsByWorkId.get(a.workId)===c&&(await this.syncRecordRuntime(c),"basic"===c.state.runtime.extensionMode&&"basic"!==c.state.runtime.presentationMode&&this.reprojectRecord(c,"basic"))}})}restoreQueuedMessages(a){let b=this.currentRecord(a);return this.enqueueCommand(b,()=>b.workSession.restoreQueuedMessages())}setModel(a){let b=this.currentRecord(a.source);return this.enqueueCommand(b,()=>b.workSession.setModel(a.model))}setCapabilityMode(a){let b=this.currentRecord(a.source);return this.enqueueCommand(b,()=>(0,m.ls)(b.source.sessionId).setCapabilityMode(a.capabilityMode))}invokePluginMethod(a){let b=this.currentRecord(a.source);return this.enqueueCommand(b,()=>(0,m.ls)(b.source.sessionId).invokePluginMethod(b.source,a.pluginName,a.method,a.input))}listNativeCommands(a){let b=this.currentRecord(a);return this.enqueueCommand(b,()=>(0,m.ls)(b.source.sessionId).listNativeCommands())}executeNativeCommand(a,b,c){let d=this.currentRecord(a);return this.enqueueCommand(d,()=>(0,m.ls)(d.source.sessionId).executeNativeCommand(b,c))}listNativeTools(a){let b=this.currentRecord(a);return this.enqueueCommand(b,()=>(0,m.ls)(b.source.sessionId).listNativeTools())}executeDirectBash(a,b){let c=this.currentRecord(a);return c.directBashActive?Promise.reject(new k.yT):(c.directBashActive=!0,this.enqueueCommand(c,()=>(0,m.ls)(c.source.sessionId).executeDirectBash(b)).finally(()=>{c.directBashActive=!1}))}abortDirectBash(a){let b=this.currentRecord(a);return(0,m.ls)(b.source.sessionId).abortDirectBash()}subscribe(a){return this.listeners.add(a),()=>this.listeners.delete(a)}subscribeRecordChanges(a){return this.recordListeners.add(a),()=>this.recordListeners.delete(a)}subscribePluginPush(a){return this.pluginPushListeners.add(a),()=>this.pluginPushListeners.delete(a)}buildRecord(a){let b=this.sourceFor(a),c=(0,m.ls)(a.sessionId),d=c.readChatSnapshot(),e=d.entries.map((a,c)=>(0,l.Cz)(c,a.entryId,a.timestampMs,a.message,b,(0,j.P)())),f=h.oc.parse({messages:e,temporaryMessages:[],runtime:{...i.L6,extensionMode:(0,j.P)()?"basic":"normal",presentationMode:(0,j.P)()?"basic":"normal"}}),g=f.messages.find(a=>"user"===a.fixed.type),k=g?h.xE.safeParse(g.summary):null,n=k?.success&&k.data.text.trim()||null,o={workSession:a,source:b,state:f,sourceEventVersion:0,forceFullSync:(0,j.P)(),rawTemporaryMessages:new Map,metadata:{sessionTitle:d.sessionName??n,messageCounts:{user:f.messages.filter(a=>"user"===a.fixed.type).length,total:f.messages.length},lastMessageUpdatedAt:f.messages.at(-1)?.fixed.timestampMs??null},mainRunning:!1,backgroundTaskIds:new Set(c.readChatBackgroundTaskIds()),completedPending:!1,acceptingCommands:!0,directBashActive:!1,compactionStart:null,commandTail:Promise.resolve(),unsubscribeWorker:()=>void 0};return o.unsubscribeWorker=c.subscribeChat(a=>this.handleWorkerEvent(o,a)),o}handleWorkerEvent(a,b){if(this.recordsByWorkId.get(a.source.workId)!==a)return;let c=a.metadata,d=this.statusForRecord(a);switch(b.type){case"message_start":a.rawTemporaryMessages.set(b.tempId,o(b.message)),this.applySourceEvent(a.source,{type:"message_start",snapshot:(0,l.QS)(b.tempId,b.message,a.source,!1,"temporary","basic"===a.state.runtime.presentationMode)});return;case"message_update":{let c=a.state.temporaryMessages.find(a=>a.location.tempId===b.tempId);if(!c)throw Error(`Temporary chat message was not found: ${b.tempId}`);a.rawTemporaryMessages.set(b.tempId,o(b.message));let d=(0,l.Ht)(c,(0,l.QS)(b.tempId,b.message,a.source,!1,"update","basic"===a.state.runtime.presentationMode));d&&this.applySourceEvent(a.source,d);return}case"message_commit":{let c=a.state.temporaryMessages.find(a=>a.location.tempId===b.tempId);if(!c)throw Error(`Temporary chat message was not found: ${b.tempId}`);let d=(0,l.QS)(b.tempId,b.message,a.source,!1,"final","basic"===a.state.runtime.presentationMode),e=(0,l.Ht)(c,d);e&&this.applySourceEvent(a.source,e),this.replaceCanonicalTemporary(a,b.tempId,b.message),a.rawTemporaryMessages.delete(b.tempId),this.applySourceEvent(a.source,{type:"message_commit",location:{tempId:b.tempId},durable:{index:a.state.messages.length,entryId:b.entryId},fixed:{timestampMs:b.timestampMs}});return}case"message_discard":a.rawTemporaryMessages.delete(b.tempId),this.applySourceEvent(a.source,{type:"message_discard",location:{tempId:b.tempId}});return;case"plugin_push":this.publishPluginPush({pluginName:b.pluginName,target:{scope:"session",source:a.source},event:b.event,data:structuredClone(b.data)});return;case"runtime_changed":{let c=h.wf.parse({...b.runtime,presentationMode:a.state.runtime.presentationMode});p(a.state.runtime,c)||this.applySourceEvent(a.source,{type:"runtime_update",runtime:c}),"basic"===c.extensionMode&&"basic"!==a.state.runtime.presentationMode&&this.reprojectRecord(a,"basic");return}case"agent_started":if(a.mainRunning)return;a.mainRunning=!0,a.completedPending=!1,this.publishRecordChanged(a.source.workId,c,d);return;case"main_operation_cancelled":case"main_operation_finished":if(!a.mainRunning)return;a.mainRunning=!1,a.completedPending=!1,this.publishRecordChanged(a.source.workId,c,d);return;case"agent_settled":{let b=a.mainRunning||a.backgroundTaskIds.size>0;a.mainRunning=!1,b&&0===a.backgroundTaskIds.size&&(a.completedPending=!0),this.publishRecordChanged(a.source.workId,c,d);return}case"background_tasks_changed":{let e=a.mainRunning||a.backgroundTaskIds.size>0;a.backgroundTaskIds=new Set(b.taskIds),e&&!a.mainRunning&&0===a.backgroundTaskIds.size&&(a.completedPending=!0),this.publishRecordChanged(a.source.workId,c,d);return}case"session_info_changed":a.metadata={...a.metadata,sessionTitle:b.sessionTitle},this.publishRecordChanged(a.source.workId,c,d);return}}replaceCanonicalTemporary(a,b,c){let d=a.state.temporaryMessages.findIndex(a=>a.location.tempId===b);if(d<0)throw Error(`Temporary chat message was not found: ${b}`);let e=[...a.state.temporaryMessages];e[d]=(0,l.QS)(b,c,a.source,!0,"final","basic"===a.state.runtime.presentationMode),a.state={...a.state,temporaryMessages:e}}applySourceEvent(a,b){let c=this.currentRecord(a),d=c.source;if(c.state=(0,i.k_)(c.state,b),c.sourceEventVersion+=1,"message_commit"===b.type){let a=c.state.messages[b.durable.index];if(!a||a.location.entryId!==b.durable.entryId)throw Error(`Committed chat message is missing: ${b.durable.index}/${b.durable.entryId}`);let e=c.metadata;c.metadata=this.metadataFromState(c),this.publishRecordChanged(d.workId,e,this.statusForRecord(c))}this.publish({type:"source_event",source:d,version:c.sourceEventVersion,event:b})}metadataFromState(a){let b=a.state.messages.find(a=>"user"===a.fixed.type),c=b?h.xE.safeParse(b.summary):null,d=c?.success&&c.data.text.trim()||null;return{sessionTitle:a.metadata.sessionTitle??d,messageCounts:{user:a.state.messages.filter(a=>"user"===a.fixed.type).length,total:a.state.messages.length},lastMessageUpdatedAt:a.state.messages.at(-1)?.fixed.timestampMs??null}}enqueueCommand(a,b){if(!a.acceptingCommands)return Promise.reject(new s(a.source.workId));let c=a.commandTail.then(b,b);return a.commandTail=c.then(()=>void 0,()=>void 0),c}pluginReloadBlockReason(a){return(0,m.ls)(a.source.sessionId).nativeUi.hasPending?"原生插件问题正在等待回答":a.directBashActive?"Direct Bash 正在运行":a.mainRunning?"主 Agent 正在运行":a.backgroundTaskIds.size>0?"插件后台任务正在运行":(0,m.ls)(a.source.sessionId).readPluginReloadBlockReason()}async closeRecord(a){let b=this.recordsByWorkId.get(a);b&&(b.acceptingCommands=!1,(0,m.ls)(b.source.sessionId).nativeUi.cancelAll(),await b.commandTail,b.unsubscribeWorker(),b.rawTemporaryMessages.clear(),this.recordsByWorkId.delete(a))}recordFor(a){let b=this.recordsByWorkId.get(a.workId);if(!b||!this.matches(b.source,this.sourceFor(a)))throw Error(`WorkSession chat state is not initialized: ${a.workId}`);return b}sourceFor(a){return h.Pi.parse({workId:a.workId,sessionId:a.sessionId,branchId:a.branchId})}currentRecord(a){let b=h.Pi.parse(a),c=this.recordsByWorkId.get(b.workId);if(!c||!this.matches(c.source,b))throw new q(b);return c}recordForSession(a,b){let c=[...this.recordsByWorkId.values()].find(c=>c.source.sessionId===a&&c.source.branchId===b);if(c)return c;throw new q({workId:"unknown",sessionId:a,branchId:b})}matches(a,b){return a.workId===b.workId&&a.sessionId===b.sessionId&&a.branchId===b.branchId}publishPluginPush(a){for(let b of[...this.pluginPushListeners])try{b(a)}catch(b){console.error("[Pi Desk][WorkSessionChatRuntime] Plugin Push 监听器执行失败",{pluginName:a.pluginName,event:a.event,errorName:b instanceof Error?b.name:"UnknownError"})}}publish(a){for(let b of[...this.listeners])try{b(a)}catch(b){console.error("[Pi Desk][WorkSessionChatRuntime] Source 事件监听器执行失败",{eventType:a.type,workId:a.source.workId,errorName:b instanceof Error?b.name:"UnknownError"})}}publishRecordChanged(a,b,c){for(let d of[...this.recordListeners])try{d(a,b,c)}catch(b){console.error("[Pi Desk][WorkSessionChatRuntime] Record 监听器执行失败",{workId:a,errorName:b instanceof Error?b.name:"UnknownError"})}}constructor(){this.recordsByWorkId=new Map,this.listeners=new Set,this.recordListeners=new Set,this.pluginPushListeners=new Set}}d()}catch(a){d(a)}})},48452:(a,b,c)=>{c.d(b,{Y:()=>f,n:()=>e});var d=c(59473);let e="X-Pi-Desk-Client-Id",f=d.Yj().uuid()},54733:(a,b,c)=>{c.d(b,{AA:()=>p,Bn:()=>u,C3:()=>j,Ck:()=>s,ER:()=>m,Jl:()=>v,Kx:()=>i,MT:()=>l,MY:()=>q,Ms:()=>w,TO:()=>n,_A:()=>k,eW:()=>g,ik:()=>h,jw:()=>o,kg:()=>r,uX:()=>t});var d=c(59473),e=c(83905),f=c(2364);let g=d.Yj().trim().min(1),h=e.m4,i=e.$E,j=e.Rv,k=d.Yj().trim().min(1),l=d.ai().int().nonnegative(),m=d.Ik({workId:g,cwd:h,sessionId:i}).strict(),n=d.YO(m),o=d.k5(["main_running","background_running","completed","idle"]),p=d.Ik({user:d.ai().int().nonnegative(),total:d.ai().int().nonnegative()}).strict().refine(a=>a.user<=a.total,{message:"user message count cannot exceed total message count"}),q=m.extend({branchId:k,projectName:d.Yj().trim().min(1),sessionTitle:d.Yj().trim().min(1).nullable(),status:o,messageCounts:p,lastMessageUpdatedAt:f.k.nullable()}).strict(),r=d.Ik({workSessions:d.YO(q),pinnedCount:l}).strict().refine(a=>a.pinnedCount<=a.workSessions.length,{message:"pinnedCount cannot exceed work session count",path:["pinnedCount"]}),s=d.Ik({cwd:h,sessionId:i.optional()}).strict(),t=d.Ik({workSession:q}).strict(),u=d.Ik({workId:g}).strict(),v=d.Ik({workIds:d.YO(g),pinnedCount:l}).strict().superRefine((a,b)=>{new Set(a.workIds).size!==a.workIds.length&&b.addIssue({code:"custom",message:"workIds cannot contain duplicates",path:["workIds"]}),a.pinnedCount>a.workIds.length&&b.addIssue({code:"custom",message:"pinnedCount cannot exceed workIds length",path:["pinnedCount"]})}),w=d.KC([d.Ik({workId:g,cwd:h,sessionId:i}).strict(),d.Ik({workId:g}).strict()])},62977:(a,b,c)=>{c.d(b,{$:()=>d});let d=c(59473).k5(["off","minimal","low","medium","high","xhigh","max"])},72904:(a,b,c)=>{c.d(b,{H:()=>g});var d=c(610);function e(a,b){return JSON.stringify(a)===JSON.stringify(b)}function f(a,b,c,d,f){for(let g of new Set([...Object.keys(b),...Object.keys(c)])){let h=b[g],i=Object.hasOwn(c,g),j=i?c[g]:null;if(e(h,j))continue;let k=i?function(a,b){if("string"==typeof a&&"string"==typeof b&&b.startsWith(a))return b.slice(a.length)||null;if(Array.isArray(a)&&Array.isArray(b)&&a.length<=b.length&&a.every((a,c)=>e(a,b[c]))){let c=b.slice(a.length);return c.length>0?c:null}return null}(h,j):null;null!==k?f[`${a}.${g.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}`]=k:d[g]=j}}function g(a,b){var c,e;let g;if(a.fixed.type!==b.fixed.type)throw Error(`Chat message type changed: ${a.fixed.type}/${b.fixed.type}`);let h=(g={},a.fixed.viewKey!==b.fixed.viewKey&&(g.viewKey=b.fixed.viewKey),"status"in a.fixed&&"status"in b.fixed&&a.fixed.status!==b.fixed.status&&(g.status=b.fixed.status),a.fixed.hasDetail!==b.fixed.hasDetail&&(g.hasDetail=b.fixed.hasDetail),"usage"in a.fixed&&"usage"in b.fixed&&(c=a.fixed.usage)!==(e=b.fixed.usage)&&(null===c||null===e||c.inputTokens!==e.inputTokens||c.outputTokens!==e.outputTokens||c.cacheReadTokens!==e.cacheReadTokens||c.costUsd!==e.costUsd)&&(g.usage=b.fixed.usage),Object.keys(g).length>0?g:void 0),i={},j={},k={};f("summary",a.summary,b.summary,i,k),b.fixed.hasDetail&&f("detail",a.detail??{},b.detail??{},j,k);let l=Object.keys(i).length>0,m=Object.keys(j).length>0,n=Object.keys(k).length>0;return h||l||m||n?d.ef.parse({type:"message_update",location:a.location,...h?{fixed:h}:{},...l?{summary:i}:{},...m?{detail:j}:{},...n?{increments:k}:{}}):null}},79626:(a,b,c)=>{c.d(b,{N:()=>u,d:()=>t});var d=c(89409),e=c(59473),f=c(63719);let g=e.Ik({mode:e.k5(["sync","async"]),message:e.Yj()}).strict(),h="pi-desk/message-declaration-error",i=new WeakMap,j=e.Ik({viewKey:e.Yj().trim().min(3).max(129).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/),summary:e.g1(e.Yj(),e.Pq()),detail:e.g1(e.Yj(),e.Pq()).nullable()}).strict();function k(a){switch(a.type){case"user":return"pi-desk/user";case"assistant":return"pi-desk/assistant";case"tool":{let b=a.name.toLowerCase().split(".").at(-1);if("pidesk"===b)return"pi-desk/pidesk";if("bash"===b)return"pi-desk/bash-tool";if("codemode"===b)return"pi-desk/codemode";return"read"===b||"write"===b||"edit"===b?`pi-desk/${b}`:"pi-desk/tool"}case"bash":return"pi-desk/bash";case"custom":return"pi-desk/custom";case"compaction":return"pi-desk/compaction"}}function l(a){return null===a||"object"!=typeof a||Array.isArray(a)?null:a}function m(a){return l(a.result)}function n(a,b){return{...a.summary,path:function(a){let b=a.arguments.path??a.arguments.file_path;if("string"!=typeof b)return null;let c=f.eC.safeParse(b);return c.success?c.data:null}(b)}}function o(a){if(a.declaration)return a.declaration.message;switch(a.type){case"user":return{kind:"user",text:a.text,images:a.images};case"assistant":return{kind:"assistant",text:a.text,thinking:a.thinking,stopReason:a.status};case"tool":return{kind:"tool",toolName:a.name,toolCallId:"",arguments:{},partialResult:null,result:a.output?{output:a.output}:null,isError:"error"===a.status};case"bash":return{kind:"bash",command:a.command,output:a.output,exitCode:"completed"===a.status?0:null,cancelled:"aborted"===a.status,truncated:!1};case"custom":return{kind:"custom",customType:"display-message",content:a.text,details:null};case"compaction":return{kind:"custom",customType:"pi-desk/compaction",content:"",details:a.summary?{text:a.summary}:null}}}function p(a,b,c){return{pluginName:"pi-desk",declarationName:a,builtin:!0,declaration:{priority:b,match:c,project:a=>a.defaultProjection}}}let q=[p("pidesk",-900,a=>"tool"===a.message.kind&&"pidesk"===a.message.toolName),p("read",-900,a=>"tool"===a.message.kind&&"read"===a.message.toolName),p("write",-900,a=>"tool"===a.message.kind&&"write"===a.message.toolName),p("edit",-900,a=>"tool"===a.message.kind&&"edit"===a.message.toolName),p("bash-tool",-900,a=>"tool"===a.message.kind&&"bash"===a.message.toolName),p("user",-1e3,a=>"user"===a.message.kind),p("assistant",-1e3,a=>"assistant"===a.message.kind),p("tool",-1e3,a=>"tool"===a.message.kind),p("bash",-1e3,a=>"bash"===a.message.kind),p("custom",-1e3,a=>"custom"===a.message.kind)];function r(a){var b;let c=a.error instanceof Error?a.error:null,d=a.candidate;for(let b of d?[d]:a.candidates??[]){let d=i.get(b.declaration)??new Set;d.has(a.phase)||(d.add(a.phase),i.set(b.declaration,d),console.warn("[Pi Desk][MessageDeclaration] 插件投影失败,保留基础展示入口",{pluginName:b.pluginName,declarationName:b.declarationName,phase:a.phase,message:(c?.message??"Message Declaration conflict").slice(0,2e3)}))}return{viewKey:h,summary:{text:"string"==typeof a.defaultProjection.summary.text?a.defaultProjection.summary.text:"",phase:a.phase,pluginName:d?.pluginName??null,declarationName:d?.declarationName??null},detail:{phase:a.phase,pluginName:d?.pluginName??null,declarationName:d?.declarationName??null,priority:d?.declaration.priority??null,errorName:c?.name??null,errorMessage:c?.message??String(a.error??"Message Declaration conflict"),errorStack:c?.stack??null,conflicts:(a.candidates??[]).map(a=>({pluginName:a.pluginName,declarationName:a.declarationName,priority:a.declaration.priority})),defaultProjection:{viewKey:(b=a.defaultProjection).viewKey,summary:b.summary,detail:b.detail}}}}function s(a,b,c,e,f,i,p){let s=function(a){let b=function(a){switch(a.type){case"user":return{viewKey:k(a),summary:{text:function(a){let b=a.text.lastIndexOf("\n\n");if(0===a.images.length||b<0)return a.text;let c=a.text.slice(b+2).split("\n");return c.length>a.images.length?a.text:c.every(b=>{let c=/^\[Image: original \d+x\d+, displayed at (\d+)x(\d+)\. Multiply coordinates by \d+\.\d{2} to map to original image\.\]$/.exec(b);return null!==c&&a.images.some(a=>a.width===Number(c[1])&&a.height===Number(c[2]))})?a.text.slice(0,b):a.text}(a),images:a.images.map(a=>({...a}))},detail:null};case"assistant":return{viewKey:k(a),summary:{text:a.text,errorMessage:a.errorMessage,...void 0===a.model?{}:{model:a.model}},detail:a.thinking.length>0?{thinking:a.thinking}:null};case"tool":{let b=k(a),c={...a.images?.length&&["pi-desk/tool","pi-desk/read","pi-desk/codemode"].includes(b)?{images:a.images.map(a=>({...a}))}:{},name:a.name,reasoning:a.reasoning,inputPreview:a.inputPreview,activity:a.activity},d=a.durationMs??null,e=a.startedAtMs??null,f={viewKey:b,summary:"pi-desk/bash-tool"===b?{...c,timing:null!==d?{durationMs:d}:null!==e?{startedAtMs:e}:null}:c,detail:"pi-desk/codemode"===b?{output:a.output,...a.nestedCalls?{nestedCalls:a.nestedCalls}:{}}:a.output?{output:a.output}:null},h=o(a);return"tool"===h.kind?function(a,b){let c=function(a){let b=m(a);if(!b)return null;let c=b.content;if("string"==typeof c)return c;if(Array.isArray(c)){let a=[],b=!1;for(let d of c){let c=l(d);c?.type==="text"&&"string"==typeof c.text&&(b=!0,a.push(c.text))}if(b)return a.join("\n")}return"string"==typeof b.output?b.output:null}(b)??("string"==typeof a.detail?.output?a.detail.output:null);switch(a.viewKey){case"pi-desk/pidesk":{let d=c??"";try{let a=g.safeParse(JSON.parse(d));a.success&&(d=a.data.message)}catch{}return{viewKey:a.viewKey,summary:{input:b.arguments},detail:{output:d}}}case"pi-desk/read":let d;return{viewKey:a.viewKey,summary:n(a,b),detail:Array.isArray(d=m(b)?.content)&&d.some(a=>{let b=l(a);return b?.type==="image"})||null===c?null:{content:c}};case"pi-desk/edit":{let d=l(m(b)?.details??null)?.diff;return{viewKey:a.viewKey,summary:n(a,b),detail:b.isError||"string"!=typeof d?null===c?null:{kind:"output",content:c}:{kind:"diff",content:d}}}case"pi-desk/write":{let d=b.arguments.content;return{viewKey:a.viewKey,summary:n(a,b),detail:b.isError&&null!==c?{kind:"output",content:c}:"string"==typeof d?{kind:"content",content:d}:null===c?null:{kind:"output",content:c}}}default:return a}}(f,h):f}case"bash":return{viewKey:k(a),summary:{command:a.command},detail:a.output?{output:a.output}:null};case"custom":return{viewKey:k(a),summary:{text:a.text},detail:null};case"compaction":return{viewKey:k(a),summary:{},detail:a.summary?{text:a.summary}:null}}}(a.message);if("compaction"===a.message.type)return b;let c={source:a.source,stage:a.stage,message:o(a.message),raw:a.message.declaration?.raw??a.message,defaultProjection:b},d=[...(a.declarations??[]).map(a=>({...a,builtin:!1})),...q];for(let a of[...new Set(d.map(a=>a.declaration.priority))].sort((a,b)=>b-a)){let e,f=d.filter(b=>b.declaration.priority===a),g=[];for(let a of f)try{a.declaration.match(c)&&g.push(a)}catch(c){return r({phase:"match",candidate:a,error:c,defaultProjection:b})}if(0===g.length)continue;if(g.length>1)return r({phase:"conflict",candidates:g,defaultProjection:b});let i=g[0];try{e=i.declaration.project(c)}catch(a){return r({phase:"project",candidate:i,error:a,defaultProjection:b})}try{return function(a,b){let c=j.parse(a);if(!b&&c.viewKey===h)throw Error("Host reserved Message Declaration Error viewKey cannot be registered");return c}(e,i.builtin)}catch(a){return r({phase:"validate",candidate:i,error:a,defaultProjection:b})}}return b}({source:e,stage:f,message:c,declarations:p}),t="tool"===c.type||"bash"===c.type||"custom"===c.type||"compaction"===c.type,u=null!==s.detail&&(!t||i),v={location:a,fixed:function(a,b,c){let d={timestampMs:a,viewKey:c.viewKey,hasDetail:null!==c.detail};switch(b.type){case"user":return{...d,type:"user"};case"assistant":return{...d,type:"assistant",status:b.status,usage:b.usage};case"tool":return{...d,type:"tool",status:b.status,usage:b.usage};case"bash":return{...d,type:"bash",status:b.status};case"custom":case"compaction":return{...d,type:"custom"}}}(b,c,s),summary:s.summary,...u?{detail:s.detail}:{}};return"tempId"in a?d.s4.parse(v):d.mj.parse(v)}function t(a,b,c,d,e=!1,f="temporary"){return s({tempId:a},null,b,c,f,e,d)}function u(a,b,c,d,e,f){return s({index:a,entryId:b},c,d,e,"durable",!0,f)}},83905:(a,b,c)=>{c.d(b,{$E:()=>f,Rv:()=>g,m4:()=>e});var d=c(59473);let e=d.Yj().trim().min(1),f=d.Yj().trim().min(1),g=d.Yj().trim().min(1)},89409:(a,b,c)=>{c.d(b,{D8:()=>I,Hf:()=>H,LJ:()=>j,Pc:()=>i,RX:()=>T,V6:()=>t,XM:()=>U,XW:()=>P,dG:()=>O,fK:()=>S,fb:()=>s,lJ:()=>B,mh:()=>m,mj:()=>M,q5:()=>A,s4:()=>L,wH:()=>Q,y0:()=>V});var d=c(59473),e=c(83905),f=c(63719),g=c(2364),h=c(25984);let i=d.Yj().uuid(),j=d.ai().int().nonnegative(),k=d.Yj().trim().min(3).max(129).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/),l=d.k5(["image/jpeg","image/png","image/webp","image/gif"]),m=d.Ik({mimeType:l,width:d.ai().int().positive(),height:d.ai().int().positive()}).strict(),n=d.k5(["running","completed","error","aborted"]),o=d.k5(["running","completed","error"]),p=d.ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER),q=d.Ik({inputTokens:p,outputTokens:p,cacheReadTokens:p,costUsd:d.ai().finite().nonnegative()}).strict(),r=d.Yj().trim().min(1).nullable(),s=d.Ik({tempId:i}).strict(),t=d.Ik({index:j,entryId:e.Rv}).strict(),u=d.Ik({timestampMs:g.k.nullable(),type:d.eu("user"),viewKey:k,hasDetail:d.zM()}).strict(),v=d.Ik({timestampMs:g.k.nullable(),type:d.eu("assistant"),viewKey:k,status:n,hasDetail:d.zM(),usage:q}).strict(),w=d.Ik({timestampMs:g.k.nullable(),type:d.eu("tool"),viewKey:k,status:o,hasDetail:d.zM(),usage:q.nullable()}).strict(),x=d.Ik({timestampMs:g.k.nullable(),type:d.eu("bash"),viewKey:k,status:n,hasDetail:d.zM()}).strict(),y=d.Ik({timestampMs:g.k.nullable(),type:d.eu("custom"),viewKey:k,hasDetail:d.zM()}).strict();function z(a){let b=u.extend({timestampMs:a}).strict(),c=v.extend({timestampMs:a}).strict(),e=w.extend({timestampMs:a}).strict(),f=x.extend({timestampMs:a}).strict(),g=y.extend({timestampMs:a}).strict();return{user:b,assistant:c,tool:e,bash:f,custom:g,message:d.gM("type",[b,c,e,f,g])}}d.gM("type",[u,v,w,x,y]);let A=z(d.ch()).message;z(g.k).message;let B=d.Ik({text:d.Yj(),images:d.YO(m)}).strict(),C=d.Ik({provider:d.Yj(),modelId:d.Yj()}).strict();d.Ik({text:d.Yj(),errorMessage:d.Yj().nullable().default(null),model:C.nullable().optional()}).strict();let D={name:d.Yj().trim().min(1),reasoning:r,inputPreview:r,activity:r};function E(){return d.Ik({...D,path:f.eC.nullable()}).strict()}d.Ik({...D,images:d.YO(m).optional()}).strict();let F=d.KC([d.Ik({startedAtMs:g.k}).strict(),d.Ik({durationMs:d.ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER)}).strict()]);d.Ik({...D,timing:F.nullable()}).strict(),E().extend({images:d.YO(m).optional()}).strict(),E(),E(),d.Ik({command:d.Yj().min(1)}).strict(),d.Ik({text:d.Yj()}).strict(),d.Ik({thinking:d.Yj()}).strict();let G=d.Ik({complete:d.zM(),calls:d.YO(d.Ik({name:d.Yj(),arguments:d.g1(d.Yj(),d.Pq()).optional(),argumentsBytes:d.ai().int().nonnegative().optional(),status:d.k5(["ok","error","unfinished"]),durationMs:d.ai().finite().nonnegative().optional(),error:d.Yj().optional()}).strict())}).strict();d.Ik({output:d.Yj(),nestedCalls:G.optional()}).strict(),d.Ik({output:d.Yj()}).strict(),d.Ik({content:d.Yj()}).strict(),d.gM("kind",[d.Ik({kind:d.eu("diff"),content:d.Yj()}).strict(),d.Ik({kind:d.eu("output"),content:d.Yj()}).strict()]),d.gM("kind",[d.Ik({kind:d.eu("content"),content:d.Yj()}).strict(),d.Ik({kind:d.eu("output"),content:d.Yj()}).strict()]),d.Ik({output:d.Yj()}).strict(),d.Ik({text:d.Yj().min(1)}).strict();let H=d.g1(d.Yj(),d.Pq()),I=d.g1(d.Yj(),d.Pq()),J=d.KC([I,d.ch()]);function K(a,b){return d.Ik({location:a,fixed:z(b).message,summary:H,detail:I.optional()}).strict().superRefine((a,b)=>{void 0===a.detail||a.fixed.hasDetail||b.addIssue({code:"custom",message:"message detail requires hasDetail=true",path:["detail"]})})}let L=K(s,d.ch()),M=K(t,g.k);function N(a,b){0===Object.keys(a).length&&b.addIssue({code:"custom",message:"patch requires at least one changed field"})}let O=d.Ik({viewKey:k.optional(),status:d.KC([n,o]).optional(),hasDetail:d.zM().optional(),usage:q.nullable().optional()}).strict().superRefine(N),P=d.g1(d.Yj(),d.Pq()).superRefine(N),Q=d.g1(d.Yj(),d.Pq()).superRefine(N),R=d.KC([d.Yj().min(1),d.YO(d.Pq()).min(1)]),S=d.g1(d.Yj(),R).superRefine((a,b)=>{for(let c of(N(a,b),Object.keys(a)))try{(0,h.U)(c)}catch(a){b.addIssue({code:"custom",message:a instanceof Error?a.message:"increment path is invalid",path:[c]})}}),T=d.Ik({messages:d.YO(M),temporaryMessages:d.YO(L)}).strict(),U=d.Ik({index:j,entryId:e.Rv,detail:J}).strict(),V=d.Ik({mimeType:l,data:d.Yj().min(1)}).strict()},96089:(a,b,c)=>{c.d(b,{R:()=>f});var d=c(59473),e=c(83905);let f=d.Ik({workId:d.Yj().trim().min(1),sessionId:e.$E,branchId:d.Yj().trim().min(1)}).strict()}};
1
+ "use strict";exports.id=6917,exports.ids=[6917],exports.modules={18:(a,b,c)=>{c.d(b,{FR:()=>m,kn:()=>l,zR:()=>k});var d=c(89409),e=c(25984);function f(a){return`${a.location.index}:${a.location.entryId}`}let g={user:["viewKey","hasDetail"],assistant:["viewKey","status","hasDetail","usage"],tool:["viewKey","status","hasDetail","usage"],bash:["viewKey","status","hasDetail"],custom:["viewKey","hasDetail"]};function h(a,b,c){if(!b)return a;let e={...a,...b};return"summary"===c?d.Hf.parse(e):d.D8.parse(e)}function i(a,b){if(Array.isArray(a.parent)){if("number"!=typeof a.key)throw Error("Increment array key is invalid");a.parent[a.key]=b;return}if("string"!=typeof a.key)throw Error("Increment object key is invalid");a.parent[a.key]=b}function j(a,b,c){let e=structuredClone(a),f=function(a,b){if(0===b.length)throw Error("Increment cannot append to the message layer root");let c=a;for(let a of b.slice(0,-1)){if("number"==typeof a){if(!Array.isArray(c)||a>=c.length)throw Error(`Increment array path does not exist: ${a}`);c=c[a];continue}if(!c||"object"!=typeof c||Array.isArray(c))throw Error(`Increment object path does not exist: ${a}`);if(!Object.hasOwn(c,a))throw Error(`Increment object field does not exist: ${a}`);c=c[a]}let d=b.at(-1);if("number"==typeof d){if(!Array.isArray(c)||d>=c.length)throw Error(`Increment array target does not exist: ${d}`);return{parent:c,key:d,value:c[d]}}if(!c||"object"!=typeof c||Array.isArray(c))throw Error(`Increment object target does not exist: ${d}`);if(!Object.hasOwn(c,d))throw Error(`Increment target does not exist: ${d}`);return{parent:c,key:d,value:c[d]}}(e,b);if("string"==typeof c){if("string"!=typeof f.value)throw Error("Increment target is not a string");return i(f,`${f.value}${c}`),d.Hf.parse(e)}if(!Array.isArray(f.value))throw Error("Increment target is not an array");return i(f,[...f.value,...c]),d.Hf.parse(e)}function k(a,b,c){let e=new Map(a.messages.filter(a=>void 0!==a.detail).map(a=>[f(a),a]));return{messages:b.map(a=>{let b=e.get(f(a));return a.fixed.hasDetail&&b&&b.fixed.type===a.fixed.type&&b.fixed.viewKey===a.fixed.viewKey&&void 0!==b.detail?d.mj.parse({...a,detail:b.detail}):a}),temporaryMessages:[...c]}}function l(a,b){if("message_start"===b.type){if(a.temporaryMessages.some(a=>a.location.tempId===b.snapshot.location.tempId))throw Error(`Temporary conversation message already exists: ${b.snapshot.location.tempId}`);return{...a,temporaryMessages:[...a.temporaryMessages,b.snapshot]}}let c=a.temporaryMessages.findIndex(a=>a.location.tempId===b.location.tempId);if(c<0)throw Error(`Temporary conversation message was not found: ${b.location.tempId}`);if("message_update"===b.type){let f=[...a.temporaryMessages];return f[c]=function(a,b){var c,f;if(a.location.tempId!==b.location.tempId)throw Error(`Conversation update tempId mismatch: ${b.location.tempId}`);let i=(c=a.fixed,(f=b.fixed)?(!function(a,b,c){let d=Object.keys(a).filter(a=>!b.includes(a));if(d.length>0)throw Error(`${c} patch contains fields invalid for the current message: ${d}`)}(f,g[c.type],`${c.type} fixed`),d.q5.parse({...c,...f})):c),k=h(a.summary,b.summary,"summary"),l=a.detail;if(void 0!==b.detail||Object.keys(b.increments??{}).some(a=>"detail"===(0,e.U)(a).root)){if(b.fixed?.hasDetail===!1)throw Error("Realtime detail cannot be updated while explicitly clearing hasDetail");i.hasDetail||(i=d.q5.parse({...i,hasDetail:!0}))}for(let[a,c]of(b.detail&&(l=h(l??{},b.detail,"detail")),Object.entries(b.increments??{}))){let b=(0,e.U)(a);"summary"===b.root?k=j(k,b.segments,c):l=j(l??{},b.segments,c)}return i.hasDetail||(l=void 0),d.s4.parse({location:a.location,fixed:i,summary:k,...void 0===l?{}:{detail:l}})}(f[c],b),{...a,temporaryMessages:f}}if("message_discard"===b.type)return{...a,temporaryMessages:a.temporaryMessages.filter(a=>a.location.tempId!==b.location.tempId)};if(b.durable.index!==a.messages.length)throw Error(`Conversation commit index is not continuous: expected ${a.messages.length}, received ${b.durable.index}`);if(a.messages.some(a=>a.location.entryId===b.durable.entryId))throw Error(`Conversation commit entryId already exists: ${b.durable.entryId}`);let{detail:f,fixed:i,...k}=a.temporaryMessages[c],l=d.mj.parse({...k,location:b.durable,fixed:{...i,timestampMs:b.fixed.timestampMs},...i.hasDetail&&void 0!==f?{detail:f}:{}});return{messages:[...a.messages,l],temporaryMessages:a.temporaryMessages.filter(a=>a.location.tempId!==b.location.tempId)}}function m(a,b){return"durable_append"===b.type?function(a,b){let c=a.messages.length;if(b.messages[0]?.location.index!==c)throw Error(`Conversation append index is not continuous: expected ${c}, received ${b.messages[0]?.location.index}`);let d=new Set(a.messages.map(a=>a.location.entryId));for(let a of b.messages){if(d.has(a.location.entryId))throw Error(`Conversation append entryId already exists: ${a.location.entryId}`);d.add(a.location.entryId)}return{...a,messages:[...a.messages,...b.messages]}}(a,b):l(a,b)}},610:(a,b,c)=>{c.d(b,{PS:()=>k,ef:()=>i,gK:()=>j,hS:()=>h,mv:()=>n});var d=c(59473),e=c(89409),f=c(2364),g=c(25984);let h=d.Ik({type:d.eu("message_start"),snapshot:e.s4}).strict(),i=d.Ik({type:d.eu("message_update"),location:e.fb,fixed:e.dG.optional(),summary:e.XW.optional(),detail:e.wH.optional(),increments:e.fK.optional()}).strict().superRefine((a,b)=>{if(!a.fixed&&!a.summary&&!a.detail&&!a.increments)return void b.addIssue({code:"custom",message:"message update requires a changed layer"});let c=[];for(let b of Object.keys(a.increments??{}))try{c.push({raw:b,parsed:(0,g.U)(b)})}catch{}for(let d of c){let c="summary"===d.parsed.root?Object.keys(a.summary??{}):Object.keys(a.detail??{}),e=d.parsed.segments[0];(0===d.parsed.segments.length||"string"==typeof e&&c.includes(e))&&b.addIssue({code:"custom",message:"replacement and increment paths cannot overlap",path:["increments",d.raw]})}for(let a=0;a<c.length;a+=1)for(let d=a+1;d<c.length;d+=1){let e=c[a],f=c[d];((0,g.v)(e.parsed,f.parsed)||(0,g.v)(f.parsed,e.parsed))&&b.addIssue({code:"custom",message:"increment parent and child paths cannot overlap",path:["increments",f.raw]})}}),j=d.Ik({type:d.eu("message_commit"),location:e.fb,durable:e.V6,fixed:d.Ik({timestampMs:f.k}).strict()}).strict(),k=d.Ik({type:d.eu("message_discard"),location:e.fb}).strict(),l=d.Ik({type:d.eu("durable_append"),messages:d.YO(e.mj).min(1)}).strict().superRefine((a,b)=>{let c=new Set;for(let[d,e]of a.messages.entries())d>0&&e.location.index!==a.messages[d-1].location.index+1&&b.addIssue({code:"custom",message:"durable append message indexes must be continuous",path:["messages",d,"location","index"]}),c.has(e.location.entryId)&&b.addIssue({code:"custom",message:"durable append entryId values must be unique",path:["messages",d,"location","entryId"]}),c.add(e.location.entryId)}),m=d.KC([h,i,j,k]),n=d.KC([l,m])},2002:(a,b,c)=>{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()},2364:(a,b,c)=>{c.d(b,{k:()=>d});let d=c(59473).ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER)},12683:(a,b,c)=>{c.d(b,{FF:()=>h,LK:()=>i});var d=c(59473),e=c(24187),f=c(43037);let g=d.Ik({name:d.Yj().trim().min(1),description:d.Yj(),parameters:e.Dz}).strict(),h=d.Ik({source:f.Pi}).strict(),i=d.Ik({systemPrompt:d.Yj(),tools:d.YO(g)}).strict()},24187:(a,b,c)=>{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()])},25984:(a,b,c)=>{function d(a){if(!/^(0|[1-9]\d*)$/.test(a))return a;let b=Number(a);if(!Number.isSafeInteger(b))throw Error(`Increment array index is invalid: ${a}`);return b}function e(a){if(!a||a.length>1024)throw Error("Increment path length is invalid");let b=[],c="",e=!1;for(let d of a){if(e){if("."!==d&&"\\"!==d)throw Error(`Increment path contains an invalid escape: \\${d}`);c+=d,e=!1;continue}if("\\"===d){e=!0;continue}if("."===d){if(!c)throw Error("Increment path contains an empty segment");b.push(c),c="";continue}c+=d}if(e)throw Error("Increment path ends with an escape");if(!c)throw Error("Increment path contains an empty segment");b.push(c);let f=b.shift();if("summary"!==f&&"detail"!==f)throw Error("Increment path root must be summary or detail");return{root:f,segments:b.map(d)}}function f(a,b){return a.root===b.root&&!(a.segments.length>b.segments.length)&&a.segments.every((a,c)=>a===b.segments[c])}c.d(b,{U:()=>e,v:()=>f})},40750:(a,b,c)=>{c.d(b,{L6:()=>e,k_:()=>f});var d=c(18);let e={extensionMode:"normal",presentationMode:"normal",initializationError:null,queues:{steering:[],followUp:[]},model:null,capabilityMode:null,contextUsage:null,plugins:{}};function f(a,b){if("session_sync"===b.type){if("full"===b.mode)return{...(0,d.zR)(a,b.messages,b.temporaryMessages),runtime:b.runtime};let c=a.messages.at(-1);if(!c||c.location.index!==b.baseCursor.index||c.location.entryId!==b.baseCursor.entryId)throw Error("Incremental chat sync does not match the current durable cursor");let e=new Set(a.messages.map(a=>a.location.entryId));for(let a of b.messages){if(e.has(a.location.entryId))throw Error(`Incremental chat sync contains a duplicate entryId: ${a.location.entryId}`);e.add(a.location.entryId)}return{messages:[...a.messages,...b.messages],temporaryMessages:b.temporaryMessages,runtime:b.runtime}}return"runtime_update"===b.type?{...a,runtime:b.runtime}:{...(0,d.kn)(a,b),runtime:a.runtime}}Object.freeze({messages:[],temporaryMessages:[],runtime:e})},41468:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Cz:()=>j,Ht:()=>g.H,NA:()=>k,QS:()=>i});var e=c(96459),f=c(79626),g=c(72904),h=a([e]);function i(a,b,c,d=!1,g="temporary",h=!1){return(0,f.d)(a,b,c,h?[]:(0,e.WE)().readMessageDeclarations(),d,g)}function j(a,b,c,d,g,h=!1){return(0,f.N)(a,b,c,d,g,h?[]:(0,e.WE)().readMessageDeclarations())}function k(a){let{detail:b,...c}=a;return c}e=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},43037:(a,b,c)=>{c.d(b,{DK:()=>r,Pi:()=>q,R3:()=>m,TV:()=>A,UR:()=>s,VK:()=>D,kF:()=>F,mB:()=>G,oc:()=>C,ps:()=>E,w$:()=>w,wR:()=>p,wf:()=>B,xE:()=>n,xh:()=>t,yI:()=>o});var d=c(59473),e=c(20369),f=c(54733),g=c(89409),h=c(62977),i=c(96089);let j=g.Pc,k=g.LJ,l=g.mh,m=g.fb,n=g.lJ,o=g.s4,p=g.mj,q=i.R,r=d.Ik({index:k,entryId:f.C3}).strict(),s=d.KC([d.ch(),r]),t=l.extend({data:d.Yj().min(1)}).strict(),u=h.$,v=d.Ik({tempId:j,text:d.Yj(),images:d.YO(l).max(10)}).strict(),w=d.Ik({provider:d.Yj().trim().min(1),modelId:d.Yj().trim().min(1),thinkingLevel:u}).strict(),x=d.Ik({tokens:d.ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER).nullable(),contextWindow:d.ai().int().positive().max(Number.MAX_SAFE_INTEGER)}).strict(),y=d.g1(d.Yj(),d.Pq()),z=d.g1(d.Yj().min(1),y),A=d.k5(["normal","basic"]),B=d.Ik({extensionMode:A.default("normal"),presentationMode:A.default("normal"),initializationError:d.Yj().max(32e3).nullable().default(null),queues:d.Ik({steering:d.YO(v),followUp:d.YO(v)}).strict(),model:w.nullable(),capabilityMode:e.rY.nullable(),contextUsage:x.nullable(),plugins:z}).strict(),C=g.RX.extend({runtime:B}).strict(),D=d.Ik({sessionId:f.Kx,branchId:f._A,entryId:f.C3}).strict(),E=g.XM,F=D.extend({imageIndex:d.ai().int().nonnegative()}).strict(),G=g.y0},47574:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{VB:()=>t,dM:()=>q,hr:()=>r,nJ:()=>s,yO:()=>u});var e=c(76760),f=c(69503),g=c(12683),h=c(43037),i=c(40750),j=c(95220),k=c(32980),l=c(41468),m=c(72498),n=a([k,l,m]);[k,l,m]=n.then?(await n)():n;class q extends Error{constructor(a){super(`Chat source is not current: ${a.workId}/${a.sessionId}/${a.branchId}`),this.name="L2ChatSourceBindingError"}}class r extends Error{constructor(a){super(`Chat message was not found: ${a}`),this.name="L2ChatMessageNotFoundError"}}class s extends Error{constructor(a){super(`Chat commands are blocked by WorkSession lifecycle: ${a}`),this.name="L2ChatLifecycleBlockedError"}}class t extends Error{constructor(a,b){super(`工作会话 ${a} 阻止插件重载:${b}`),this.workId=a,this.reason=b,this.name="L2PluginReloadBlockedError"}}function o(a){try{return structuredClone(a)}catch{let{declaration:b,...c}=a;return structuredClone(c)}}function p(a,b){return JSON.stringify(a)===JSON.stringify(b)}class u{async initialize(a){let b=a.map(a=>this.buildRecord(a));for(let a of(this.recordsByWorkId.clear(),b))this.recordsByWorkId.set(a.source.workId,a)}addWorkSession(a){this.recordsByWorkId.set(a.workId,this.buildRecord(a))}async replaceWorkSession(a,b){let c=this.recordsByWorkId.get(a.workId)?.source;await this.closeRecord(a.workId),c&&this.publish({type:"source_invalidated",source:c}),this.recordsByWorkId.set(b.workId,this.buildRecord(b)),a.sessionId!==b.sessionId&&await (0,m.gb)(a.sessionId)}async refreshWorkSession(a){let b=this.recordsByWorkId.get(a.workId)?.source;await this.closeRecord(a.workId),b&&this.publish({type:"source_invalidated",source:b}),this.recordsByWorkId.set(a.workId,this.buildRecord(a))}async removeWorkSession(a){let b=this.recordsByWorkId.get(a.workId)?.source;await this.closeRecord(a.workId),b&&this.publish({type:"source_invalidated",source:b}),await (0,m.gb)(a.sessionId)}async pauseWorkSession(a){let b=this.recordsByWorkId.get(a);b&&(b.acceptingCommands=!1,(0,m.ls)(b.source.sessionId).nativeUi.cancelAll(),await b.commandTail)}resumeWorkSession(a){let b=this.recordsByWorkId.get(a);b&&(b.acceptingCommands=!0)}async pauseForProcessRestart(){let a=[...this.recordsByWorkId.values()],b=a.map(a=>({record:a,reason:this.pluginReloadBlockReason(a)})).find(a=>null!==a.reason);if(b?.reason)throw new t(b.record.source.workId,b.reason);for(let b of a)b.acceptingCommands=!1;await Promise.all(a.map(a=>a.commandTail));let c=a.map(a=>({record:a,reason:this.pluginReloadBlockReason(a)})).find(a=>null!==a.reason);if(c?.reason){for(let b of a)b.acceptingCommands=!0;throw new t(c.record.source.workId,c.reason)}let d=!0;return()=>{if(d)for(let b of(d=!1,a))this.recordsByWorkId.get(b.source.workId)===b&&(b.acceptingCommands=!0)}}metadataFor(a){return this.recordFor(a).metadata}statusFor(a){return this.statusForRecord(this.recordFor(a))}statusForRecord(a){return a.mainRunning?"main_running":a.backgroundTaskIds.size>0?"background_running":a.completedPending?"completed":"idle"}acknowledgeCompleted(a){let b=this.recordsByWorkId.get(a);if(!b||!b.completedPending)return!1;let c=this.statusForRecord(b);return b.completedPending=!1,this.publishRecordChanged(a,b.metadata,c),!0}isCurrentSource(a){let b=h.Pi.parse(a),c=this.recordsByWorkId.get(b.workId);return void 0!==c&&this.matches(c.source,b)}getProjectPreviewContext(a,b){let c=this.recordsByWorkId.get(a.workId);if(!c||c.workSession!==a)return null;let d=(0,f.Yj)((0,e.resolve)(b)),g=d===(0,f.Yj)((0,e.resolve)(a.cwd)),h=()=>(0,f.D)(c.state.runtime.plugins[f.s6]).directories.find(a=>(0,f.Yj)(a)===d),i=g?a.cwd:h();if(!i)return null;let j=()=>this.recordsByWorkId.get(a.workId)===c&&c.acceptingCommands&&this.matches(c.source,this.sourceFor(a))&&(g||void 0!==h());return j()?{cwd:i,isCurrent:j}:null}refreshPluginMessages(){for(let a of this.recordsByWorkId.values())if("basic"!==a.state.runtime.presentationMode)try{this.reprojectRecord(a,a.state.runtime.presentationMode)}catch(b){console.error("[Pi Desk][WorkSessionChatRuntime] 插件消息刷新失败,保留已有聊天",{workId:a.source.workId,message:b instanceof Error?b.message:String(b)})}}setPresentation(a,b){let c=this.currentRecord(a);return this.enqueueCommand(c,async()=>{if(((0,j.P)()||"basic"===c.state.runtime.extensionMode)&&"normal"===b)throw Error("基础模式不启用插件消息展示,请先恢复插件聊天");c.state.runtime.presentationMode!==b&&this.reprojectRecord(c,b)})}reprojectRecord(a,b){let c=(0,m.ls)(a.source.sessionId).readChatSnapshot(),d=new Map(c.entries.map(a=>[a.entryId,a])),e="basic"===b,f=a.state.messages.map(b=>{let c=d.get(b.location.entryId);if(!c)throw Error(`无法重新投影消息:${b.location.entryId}`);return(0,l.Cz)(b.location.index,c.entryId,c.timestampMs,c.message,a.source,e)}),g=a.state.temporaryMessages.map(b=>{let c=a.rawTemporaryMessages.get(b.location.tempId);if(!c)throw Error(`临时消息基线尚不可重投影:${b.location.tempId}`);return(0,l.QS)(b.location.tempId,c,a.source,!1,"update",e)});a.state={messages:f,temporaryMessages:g,runtime:{...a.state.runtime,presentationMode:b}},a.forceFullSync=!0,a.sourceEventVersion+=1,this.publish({type:"source_event",source:a.source,version:a.sourceEventVersion,event:this.createSync(a.source,null).event})}prepareSource(a){let b=this.currentRecord(a);return this.enqueueCommand(b,()=>this.syncRecordRuntime(b))}async syncRecordRuntime(a){let b=a.source,c=h.wf.parse({...await (0,m.ls)(b.sessionId).readChatRuntime(),presentationMode:a.state.runtime.presentationMode});this.isCurrentSource(b)&&(p(a.state.runtime,c)||this.applySourceEvent(b,{type:"runtime_update",runtime:c}),"basic"===c.extensionMode&&"basic"!==a.state.runtime.presentationMode&&this.reprojectRecord(a,"basic"))}createSync(a,b){let c=this.currentRecord(a),d=c.source,e=c.state.messages,f=c.state.temporaryMessages,g=c.state.runtime,h=null===b?void 0:e[b.index],i=null!==b&&h?.location.entryId===b.entryId;return null===b||i||console.warn("[Pi Desk][WorkSessionChatRuntime] 客户端消息 cursor 不匹配,回退全量",{workId:d.workId,sessionId:d.sessionId,branchId:d.branchId,clientCursorIndex:b.index,clientCursorEntryId:b.entryId,serverEntryIdAtIndex:h?.location.entryId??null,serverLatestIndex:e.at(-1)?.location.index??-1}),{event:null!==b&&i&&!c.forceFullSync?{type:"session_sync",mode:"incremental",baseCursor:b,messages:e.slice(b.index+1).map(l.NA),temporaryMessages:f,runtime:g}:{type:"session_sync",mode:"full",baseCursor:null,messages:e.map(l.NA),temporaryMessages:f,runtime:g},watermark:c.sourceEventVersion}}getImage(a){let b=h.kF.parse(a),c=this.recordForSession(b.sessionId,b.branchId),d=c.state.messages.find(a=>a.location.entryId===b.entryId);if(!d||"user"!==d.fixed.type&&"tool"!==d.fixed.type)throw new r(`${b.entryId}/${b.imageIndex}`);return h.mB.parse((0,m.ls)(c.source.sessionId).readChatImage(b.entryId,b.imageIndex))}getMessageDetail(a){let b=h.VK.parse(a),c=this.recordForSession(b.sessionId,b.branchId).state.messages.find(a=>a.location.entryId===b.entryId);if(!c)throw new r(b.entryId);return h.ps.parse({index:c.location.index,entryId:c.location.entryId,detail:c.detail??null})}getModelContext(a){let b=g.FF.parse(a),c=this.currentRecord(b.source);return this.enqueueCommand(c,async()=>g.LK.parse(await (0,m.ls)(c.source.sessionId).readModelContext()))}send(a){let b=this.currentRecord(a.source);if((0,m.ls)(a.source.sessionId).nativeUi.hasPending)return Promise.reject(Error("请先处理当前插件问题,或停止当前任务"));let c=()=>b.workSession.send({mode:a.mode,text:a.text,images:a.images});return b.compactionStart?b.acceptingCommands?b.compactionStart.then(a=>{if(!b.acceptingCommands)throw new s(b.source.workId);return a?c():this.enqueueCommand(b,c)}):Promise.reject(new s(b.source.workId)):this.enqueueCommand(b,c)}interrupt(a){let b=this.currentRecord(a);return(0,m.ls)(a.sessionId).nativeUi.hasPending?b.workSession.interrupt():this.enqueueCommand(b,()=>b.workSession.interrupt())}compact(a){let b,c=this.currentRecord(a);if(c.compactionStart)return Promise.reject(Error("上下文正在压缩"));let d=new Promise(a=>{b=a});c.compactionStart=d;let e=this.enqueueCommand(c,()=>{try{let a=(0,m.ls)(c.source.sessionId).compact();return b(!0),a}catch(a){throw b(!1),a}});return e.then(()=>{b(!1),c.compactionStart===d&&(c.compactionStart=null)},()=>{b(!1),c.compactionStart===d&&(c.compactionStart=null)}),e}reload(a,b){let c=this.currentRecord(a);return(0,m.ls)(a.sessionId).nativeUi.cancelAll(),this.enqueueCommand(c,async()=>{try{await (0,m.ls)(c.source.sessionId).reload(b)}finally{this.recordsByWorkId.get(a.workId)===c&&(await this.syncRecordRuntime(c),"basic"===c.state.runtime.extensionMode&&"basic"!==c.state.runtime.presentationMode&&this.reprojectRecord(c,"basic"))}})}restoreQueuedMessages(a){let b=this.currentRecord(a);return this.enqueueCommand(b,()=>b.workSession.restoreQueuedMessages())}setTitle(a,b){let c=this.recordFor(a);return this.enqueueCommand(c,()=>c.workSession.setTitle(b))}setModel(a){let b=this.currentRecord(a.source);return this.enqueueCommand(b,()=>b.workSession.setModel(a.model))}setCapabilityMode(a){let b=this.currentRecord(a.source);return this.enqueueCommand(b,()=>(0,m.ls)(b.source.sessionId).setCapabilityMode(a.capabilityMode))}invokePluginMethod(a){let b=this.currentRecord(a.source);return this.enqueueCommand(b,()=>(0,m.ls)(b.source.sessionId).invokePluginMethod(b.source,a.pluginName,a.method,a.input))}listNativeCommands(a){let b=this.currentRecord(a);return this.enqueueCommand(b,()=>(0,m.ls)(b.source.sessionId).listNativeCommands())}executeNativeCommand(a,b,c){let d=this.currentRecord(a);return this.enqueueCommand(d,()=>(0,m.ls)(d.source.sessionId).executeNativeCommand(b,c))}listNativeTools(a){let b=this.currentRecord(a);return this.enqueueCommand(b,()=>(0,m.ls)(b.source.sessionId).listNativeTools())}executeDirectBash(a,b){let c=this.currentRecord(a);return c.directBashActive?Promise.reject(new k.yT):(c.directBashActive=!0,this.enqueueCommand(c,()=>(0,m.ls)(c.source.sessionId).executeDirectBash(b)).finally(()=>{c.directBashActive=!1}))}abortDirectBash(a){let b=this.currentRecord(a);return(0,m.ls)(b.source.sessionId).abortDirectBash()}subscribe(a){return this.listeners.add(a),()=>this.listeners.delete(a)}subscribeRecordChanges(a){return this.recordListeners.add(a),()=>this.recordListeners.delete(a)}subscribePluginPush(a){return this.pluginPushListeners.add(a),()=>this.pluginPushListeners.delete(a)}buildRecord(a){let b=this.sourceFor(a),c=(0,m.ls)(a.sessionId),d=c.readChatSnapshot(),e=d.entries.map((a,c)=>(0,l.Cz)(c,a.entryId,a.timestampMs,a.message,b,(0,j.P)())),f=h.oc.parse({messages:e,temporaryMessages:[],runtime:{...i.L6,extensionMode:(0,j.P)()?"basic":"normal",presentationMode:(0,j.P)()?"basic":"normal"}}),g=f.messages.find(a=>"user"===a.fixed.type),k=g?h.xE.safeParse(g.summary):null,n=k?.success&&k.data.text.trim()||null,o={workSession:a,source:b,state:f,sourceEventVersion:0,forceFullSync:(0,j.P)(),rawTemporaryMessages:new Map,metadata:{sessionTitle:d.sessionName??n,messageCounts:{user:f.messages.filter(a=>"user"===a.fixed.type).length,total:f.messages.length},lastMessageUpdatedAt:f.messages.at(-1)?.fixed.timestampMs??null},mainRunning:!1,backgroundTaskIds:new Set(c.readChatBackgroundTaskIds()),completedPending:!1,acceptingCommands:!0,directBashActive:!1,compactionStart:null,commandTail:Promise.resolve(),unsubscribeWorker:()=>void 0};return o.unsubscribeWorker=c.subscribeChat(a=>this.handleWorkerEvent(o,a)),o}handleWorkerEvent(a,b){if(this.recordsByWorkId.get(a.source.workId)!==a)return;let c=a.metadata,d=this.statusForRecord(a);switch(b.type){case"message_start":a.rawTemporaryMessages.set(b.tempId,o(b.message)),this.applySourceEvent(a.source,{type:"message_start",snapshot:(0,l.QS)(b.tempId,b.message,a.source,!1,"temporary","basic"===a.state.runtime.presentationMode)});return;case"message_update":{let c=a.state.temporaryMessages.find(a=>a.location.tempId===b.tempId);if(!c)throw Error(`Temporary chat message was not found: ${b.tempId}`);a.rawTemporaryMessages.set(b.tempId,o(b.message));let d=(0,l.Ht)(c,(0,l.QS)(b.tempId,b.message,a.source,!1,"update","basic"===a.state.runtime.presentationMode));d&&this.applySourceEvent(a.source,d);return}case"message_commit":{let c=a.state.temporaryMessages.find(a=>a.location.tempId===b.tempId);if(!c)throw Error(`Temporary chat message was not found: ${b.tempId}`);let d=(0,l.QS)(b.tempId,b.message,a.source,!1,"final","basic"===a.state.runtime.presentationMode),e=(0,l.Ht)(c,d);e&&this.applySourceEvent(a.source,e),this.replaceCanonicalTemporary(a,b.tempId,b.message),a.rawTemporaryMessages.delete(b.tempId),this.applySourceEvent(a.source,{type:"message_commit",location:{tempId:b.tempId},durable:{index:a.state.messages.length,entryId:b.entryId},fixed:{timestampMs:b.timestampMs}});return}case"message_discard":a.rawTemporaryMessages.delete(b.tempId),this.applySourceEvent(a.source,{type:"message_discard",location:{tempId:b.tempId}});return;case"plugin_push":this.publishPluginPush({pluginName:b.pluginName,target:{scope:"session",source:a.source},event:b.event,data:structuredClone(b.data)});return;case"runtime_changed":{let c=h.wf.parse({...b.runtime,presentationMode:a.state.runtime.presentationMode});p(a.state.runtime,c)||this.applySourceEvent(a.source,{type:"runtime_update",runtime:c}),"basic"===c.extensionMode&&"basic"!==a.state.runtime.presentationMode&&this.reprojectRecord(a,"basic");return}case"agent_started":if(a.mainRunning)return;a.mainRunning=!0,a.completedPending=!1,this.publishRecordChanged(a.source.workId,c,d);return;case"main_operation_cancelled":case"main_operation_finished":if(!a.mainRunning)return;a.mainRunning=!1,a.completedPending=!1,this.publishRecordChanged(a.source.workId,c,d);return;case"agent_settled":{let b=a.mainRunning||a.backgroundTaskIds.size>0;a.mainRunning=!1,b&&0===a.backgroundTaskIds.size&&(a.completedPending=!0),this.publishRecordChanged(a.source.workId,c,d);return}case"background_tasks_changed":{let e=a.mainRunning||a.backgroundTaskIds.size>0;a.backgroundTaskIds=new Set(b.taskIds),e&&!a.mainRunning&&0===a.backgroundTaskIds.size&&(a.completedPending=!0),this.publishRecordChanged(a.source.workId,c,d);return}case"session_info_changed":a.metadata={...a.metadata,sessionTitle:b.sessionTitle},this.publishRecordChanged(a.source.workId,c,d);return}}replaceCanonicalTemporary(a,b,c){let d=a.state.temporaryMessages.findIndex(a=>a.location.tempId===b);if(d<0)throw Error(`Temporary chat message was not found: ${b}`);let e=[...a.state.temporaryMessages];e[d]=(0,l.QS)(b,c,a.source,!0,"final","basic"===a.state.runtime.presentationMode),a.state={...a.state,temporaryMessages:e}}applySourceEvent(a,b){let c=this.currentRecord(a),d=c.source;if(c.state=(0,i.k_)(c.state,b),c.sourceEventVersion+=1,"message_commit"===b.type){let a=c.state.messages[b.durable.index];if(!a||a.location.entryId!==b.durable.entryId)throw Error(`Committed chat message is missing: ${b.durable.index}/${b.durable.entryId}`);let e=c.metadata;c.metadata=this.metadataFromState(c),this.publishRecordChanged(d.workId,e,this.statusForRecord(c))}this.publish({type:"source_event",source:d,version:c.sourceEventVersion,event:b})}metadataFromState(a){let b=a.state.messages.find(a=>"user"===a.fixed.type),c=b?h.xE.safeParse(b.summary):null,d=c?.success&&c.data.text.trim()||null;return{sessionTitle:a.metadata.sessionTitle??d,messageCounts:{user:a.state.messages.filter(a=>"user"===a.fixed.type).length,total:a.state.messages.length},lastMessageUpdatedAt:a.state.messages.at(-1)?.fixed.timestampMs??null}}enqueueCommand(a,b){if(!a.acceptingCommands)return Promise.reject(new s(a.source.workId));let c=a.commandTail.then(b,b);return a.commandTail=c.then(()=>void 0,()=>void 0),c}pluginReloadBlockReason(a){return(0,m.ls)(a.source.sessionId).nativeUi.hasPending?"原生插件问题正在等待回答":a.directBashActive?"Direct Bash 正在运行":a.mainRunning?"主 Agent 正在运行":a.backgroundTaskIds.size>0?"插件后台任务正在运行":(0,m.ls)(a.source.sessionId).readPluginReloadBlockReason()}async closeRecord(a){let b=this.recordsByWorkId.get(a);b&&(b.acceptingCommands=!1,(0,m.ls)(b.source.sessionId).nativeUi.cancelAll(),await b.commandTail,b.unsubscribeWorker(),b.rawTemporaryMessages.clear(),this.recordsByWorkId.delete(a))}recordFor(a){let b=this.recordsByWorkId.get(a.workId);if(!b||!this.matches(b.source,this.sourceFor(a)))throw Error(`WorkSession chat state is not initialized: ${a.workId}`);return b}sourceFor(a){return h.Pi.parse({workId:a.workId,sessionId:a.sessionId,branchId:a.branchId})}currentRecord(a){let b=h.Pi.parse(a),c=this.recordsByWorkId.get(b.workId);if(!c||!this.matches(c.source,b))throw new q(b);return c}recordForSession(a,b){let c=[...this.recordsByWorkId.values()].find(c=>c.source.sessionId===a&&c.source.branchId===b);if(c)return c;throw new q({workId:"unknown",sessionId:a,branchId:b})}matches(a,b){return a.workId===b.workId&&a.sessionId===b.sessionId&&a.branchId===b.branchId}publishPluginPush(a){for(let b of[...this.pluginPushListeners])try{b(a)}catch(b){console.error("[Pi Desk][WorkSessionChatRuntime] Plugin Push 监听器执行失败",{pluginName:a.pluginName,event:a.event,errorName:b instanceof Error?b.name:"UnknownError"})}}publish(a){for(let b of[...this.listeners])try{b(a)}catch(b){console.error("[Pi Desk][WorkSessionChatRuntime] Source 事件监听器执行失败",{eventType:a.type,workId:a.source.workId,errorName:b instanceof Error?b.name:"UnknownError"})}}publishRecordChanged(a,b,c){for(let d of[...this.recordListeners])try{d(a,b,c)}catch(b){console.error("[Pi Desk][WorkSessionChatRuntime] Record 监听器执行失败",{workId:a,errorName:b instanceof Error?b.name:"UnknownError"})}}constructor(){this.recordsByWorkId=new Map,this.listeners=new Set,this.recordListeners=new Set,this.pluginPushListeners=new Set}}d()}catch(a){d(a)}})},48452:(a,b,c)=>{c.d(b,{Y:()=>f,n:()=>e});var d=c(59473);let e="X-Pi-Desk-Client-Id",f=d.Yj().uuid()},54733:(a,b,c)=>{c.d(b,{AA:()=>p,Bn:()=>v,C3:()=>j,Ck:()=>s,ER:()=>m,Jl:()=>w,Kx:()=>i,MT:()=>l,MY:()=>q,Ms:()=>x,TO:()=>n,_A:()=>k,eW:()=>g,ik:()=>h,jw:()=>o,kg:()=>r,qL:()=>u,uX:()=>t});var d=c(59473),e=c(83905),f=c(2364);let g=d.Yj().trim().min(1),h=e.m4,i=e.$E,j=e.Rv,k=d.Yj().trim().min(1),l=d.ai().int().nonnegative(),m=d.Ik({workId:g,cwd:h,sessionId:i}).strict(),n=d.YO(m),o=d.k5(["main_running","background_running","completed","idle"]),p=d.Ik({user:d.ai().int().nonnegative(),total:d.ai().int().nonnegative()}).strict().refine(a=>a.user<=a.total,{message:"user message count cannot exceed total message count"}),q=m.extend({branchId:k,projectName:d.Yj().trim().min(1),sessionTitle:d.Yj().trim().min(1).nullable(),status:o,messageCounts:p,lastMessageUpdatedAt:f.k.nullable()}).strict(),r=d.Ik({workSessions:d.YO(q),pinnedCount:l}).strict().refine(a=>a.pinnedCount<=a.workSessions.length,{message:"pinnedCount cannot exceed work session count",path:["pinnedCount"]}),s=d.Ik({cwd:h,sessionId:i.optional()}).strict(),t=d.Ik({workSession:q}).strict(),u=d.Ik({workId:g,sessionId:i,title:d.Yj().trim().min(1)}).strict(),v=d.Ik({workId:g}).strict(),w=d.Ik({workIds:d.YO(g),pinnedCount:l}).strict().superRefine((a,b)=>{new Set(a.workIds).size!==a.workIds.length&&b.addIssue({code:"custom",message:"workIds cannot contain duplicates",path:["workIds"]}),a.pinnedCount>a.workIds.length&&b.addIssue({code:"custom",message:"pinnedCount cannot exceed workIds length",path:["pinnedCount"]})}),x=d.KC([d.Ik({workId:g,cwd:h,sessionId:i}).strict(),d.Ik({workId:g}).strict()])},62977:(a,b,c)=>{c.d(b,{$:()=>d});let d=c(59473).k5(["off","minimal","low","medium","high","xhigh","max"])},72904:(a,b,c)=>{c.d(b,{H:()=>g});var d=c(610);function e(a,b){return JSON.stringify(a)===JSON.stringify(b)}function f(a,b,c,d,f){for(let g of new Set([...Object.keys(b),...Object.keys(c)])){let h=b[g],i=Object.hasOwn(c,g),j=i?c[g]:null;if(e(h,j))continue;let k=i?function(a,b){if("string"==typeof a&&"string"==typeof b&&b.startsWith(a))return b.slice(a.length)||null;if(Array.isArray(a)&&Array.isArray(b)&&a.length<=b.length&&a.every((a,c)=>e(a,b[c]))){let c=b.slice(a.length);return c.length>0?c:null}return null}(h,j):null;null!==k?f[`${a}.${g.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}`]=k:d[g]=j}}function g(a,b){var c,e;let g;if(a.fixed.type!==b.fixed.type)throw Error(`Chat message type changed: ${a.fixed.type}/${b.fixed.type}`);let h=(g={},a.fixed.viewKey!==b.fixed.viewKey&&(g.viewKey=b.fixed.viewKey),"status"in a.fixed&&"status"in b.fixed&&a.fixed.status!==b.fixed.status&&(g.status=b.fixed.status),a.fixed.hasDetail!==b.fixed.hasDetail&&(g.hasDetail=b.fixed.hasDetail),"usage"in a.fixed&&"usage"in b.fixed&&(c=a.fixed.usage)!==(e=b.fixed.usage)&&(null===c||null===e||c.inputTokens!==e.inputTokens||c.outputTokens!==e.outputTokens||c.cacheReadTokens!==e.cacheReadTokens||c.costUsd!==e.costUsd)&&(g.usage=b.fixed.usage),Object.keys(g).length>0?g:void 0),i={},j={},k={};f("summary",a.summary,b.summary,i,k),b.fixed.hasDetail&&f("detail",a.detail??{},b.detail??{},j,k);let l=Object.keys(i).length>0,m=Object.keys(j).length>0,n=Object.keys(k).length>0;return h||l||m||n?d.ef.parse({type:"message_update",location:a.location,...h?{fixed:h}:{},...l?{summary:i}:{},...m?{detail:j}:{},...n?{increments:k}:{}}):null}},79626:(a,b,c)=>{c.d(b,{N:()=>u,d:()=>t});var d=c(89409),e=c(59473),f=c(63719);let g=e.Ik({mode:e.k5(["sync","async"]),message:e.Yj()}).strict(),h="pi-desk/message-declaration-error",i=new WeakMap,j=e.Ik({viewKey:e.Yj().trim().min(3).max(129).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/),summary:e.g1(e.Yj(),e.Pq()),detail:e.g1(e.Yj(),e.Pq()).nullable()}).strict();function k(a){switch(a.type){case"user":return"pi-desk/user";case"assistant":return"pi-desk/assistant";case"tool":{let b=a.name.toLowerCase().split(".").at(-1);if("pidesk"===b)return"pi-desk/pidesk";if("bash"===b)return"pi-desk/bash-tool";if("codemode"===b)return"pi-desk/codemode";return"read"===b||"write"===b||"edit"===b?`pi-desk/${b}`:"pi-desk/tool"}case"bash":return"pi-desk/bash";case"custom":return"pi-desk/custom";case"compaction":return"pi-desk/compaction"}}function l(a){return null===a||"object"!=typeof a||Array.isArray(a)?null:a}function m(a){return l(a.result)}function n(a,b){return{...a.summary,path:function(a){let b=a.arguments.path??a.arguments.file_path;if("string"!=typeof b)return null;let c=f.eC.safeParse(b);return c.success?c.data:null}(b)}}function o(a){if(a.declaration)return a.declaration.message;switch(a.type){case"user":return{kind:"user",text:a.text,images:a.images};case"assistant":return{kind:"assistant",text:a.text,thinking:a.thinking,stopReason:a.status};case"tool":return{kind:"tool",toolName:a.name,toolCallId:"",arguments:{},partialResult:null,result:a.output?{output:a.output}:null,isError:"error"===a.status};case"bash":return{kind:"bash",command:a.command,output:a.output,exitCode:"completed"===a.status?0:null,cancelled:"aborted"===a.status,truncated:!1};case"custom":return{kind:"custom",customType:"display-message",content:a.text,details:null};case"compaction":return{kind:"custom",customType:"pi-desk/compaction",content:"",details:a.summary?{text:a.summary}:null}}}function p(a,b,c){return{pluginName:"pi-desk",declarationName:a,builtin:!0,declaration:{priority:b,match:c,project:a=>a.defaultProjection}}}let q=[p("pidesk",-900,a=>"tool"===a.message.kind&&"pidesk"===a.message.toolName),p("read",-900,a=>"tool"===a.message.kind&&"read"===a.message.toolName),p("write",-900,a=>"tool"===a.message.kind&&"write"===a.message.toolName),p("edit",-900,a=>"tool"===a.message.kind&&"edit"===a.message.toolName),p("bash-tool",-900,a=>"tool"===a.message.kind&&"bash"===a.message.toolName),p("user",-1e3,a=>"user"===a.message.kind),p("assistant",-1e3,a=>"assistant"===a.message.kind),p("tool",-1e3,a=>"tool"===a.message.kind),p("bash",-1e3,a=>"bash"===a.message.kind),p("custom",-1e3,a=>"custom"===a.message.kind)];function r(a){var b;let c=a.error instanceof Error?a.error:null,d=a.candidate;for(let b of d?[d]:a.candidates??[]){let d=i.get(b.declaration)??new Set;d.has(a.phase)||(d.add(a.phase),i.set(b.declaration,d),console.warn("[Pi Desk][MessageDeclaration] 插件投影失败,保留基础展示入口",{pluginName:b.pluginName,declarationName:b.declarationName,phase:a.phase,message:(c?.message??"Message Declaration conflict").slice(0,2e3)}))}return{viewKey:h,summary:{text:"string"==typeof a.defaultProjection.summary.text?a.defaultProjection.summary.text:"",phase:a.phase,pluginName:d?.pluginName??null,declarationName:d?.declarationName??null},detail:{phase:a.phase,pluginName:d?.pluginName??null,declarationName:d?.declarationName??null,priority:d?.declaration.priority??null,errorName:c?.name??null,errorMessage:c?.message??String(a.error??"Message Declaration conflict"),errorStack:c?.stack??null,conflicts:(a.candidates??[]).map(a=>({pluginName:a.pluginName,declarationName:a.declarationName,priority:a.declaration.priority})),defaultProjection:{viewKey:(b=a.defaultProjection).viewKey,summary:b.summary,detail:b.detail}}}}function s(a,b,c,e,f,i,p){let s=function(a){let b=function(a){switch(a.type){case"user":return{viewKey:k(a),summary:{text:function(a){let b=a.text.lastIndexOf("\n\n");if(0===a.images.length||b<0)return a.text;let c=a.text.slice(b+2).split("\n");return c.length>a.images.length?a.text:c.every(b=>{let c=/^\[Image: original \d+x\d+, displayed at (\d+)x(\d+)\. Multiply coordinates by \d+\.\d{2} to map to original image\.\]$/.exec(b);return null!==c&&a.images.some(a=>a.width===Number(c[1])&&a.height===Number(c[2]))})?a.text.slice(0,b):a.text}(a),images:a.images.map(a=>({...a}))},detail:null};case"assistant":return{viewKey:k(a),summary:{text:a.text,errorMessage:a.errorMessage,...void 0===a.model?{}:{model:a.model}},detail:a.thinking.length>0?{thinking:a.thinking}:null};case"tool":{let b=k(a),c={...a.images?.length&&["pi-desk/tool","pi-desk/read","pi-desk/codemode"].includes(b)?{images:a.images.map(a=>({...a}))}:{},name:a.name,reasoning:a.reasoning,inputPreview:a.inputPreview,activity:a.activity},d=a.durationMs??null,e=a.startedAtMs??null,f={viewKey:b,summary:"pi-desk/bash-tool"===b?{...c,timing:null!==d?{durationMs:d}:null!==e?{startedAtMs:e}:null}:c,detail:"pi-desk/codemode"===b?{output:a.output,...a.nestedCalls?{nestedCalls:a.nestedCalls}:{}}:a.output?{output:a.output}:null},h=o(a);return"tool"===h.kind?function(a,b){let c=function(a){let b=m(a);if(!b)return null;let c=b.content;if("string"==typeof c)return c;if(Array.isArray(c)){let a=[],b=!1;for(let d of c){let c=l(d);c?.type==="text"&&"string"==typeof c.text&&(b=!0,a.push(c.text))}if(b)return a.join("\n")}return"string"==typeof b.output?b.output:null}(b)??("string"==typeof a.detail?.output?a.detail.output:null);switch(a.viewKey){case"pi-desk/pidesk":{let d=c??"";try{let a=g.safeParse(JSON.parse(d));a.success&&(d=a.data.message)}catch{}return{viewKey:a.viewKey,summary:{input:b.arguments},detail:{output:d}}}case"pi-desk/read":let d;return{viewKey:a.viewKey,summary:n(a,b),detail:Array.isArray(d=m(b)?.content)&&d.some(a=>{let b=l(a);return b?.type==="image"})||null===c?null:{content:c}};case"pi-desk/edit":{let d=l(m(b)?.details??null)?.diff;return{viewKey:a.viewKey,summary:n(a,b),detail:b.isError||"string"!=typeof d?null===c?null:{kind:"output",content:c}:{kind:"diff",content:d}}}case"pi-desk/write":{let d=b.arguments.content;return{viewKey:a.viewKey,summary:n(a,b),detail:b.isError&&null!==c?{kind:"output",content:c}:"string"==typeof d?{kind:"content",content:d}:null===c?null:{kind:"output",content:c}}}default:return a}}(f,h):f}case"bash":return{viewKey:k(a),summary:{command:a.command},detail:a.output?{output:a.output}:null};case"custom":return{viewKey:k(a),summary:{text:a.text},detail:null};case"compaction":return{viewKey:k(a),summary:{},detail:a.summary?{text:a.summary}:null}}}(a.message);if("compaction"===a.message.type)return b;let c={source:a.source,stage:a.stage,message:o(a.message),raw:a.message.declaration?.raw??a.message,defaultProjection:b},d=[...(a.declarations??[]).map(a=>({...a,builtin:!1})),...q];for(let a of[...new Set(d.map(a=>a.declaration.priority))].sort((a,b)=>b-a)){let e,f=d.filter(b=>b.declaration.priority===a),g=[];for(let a of f)try{a.declaration.match(c)&&g.push(a)}catch(c){return r({phase:"match",candidate:a,error:c,defaultProjection:b})}if(0===g.length)continue;if(g.length>1)return r({phase:"conflict",candidates:g,defaultProjection:b});let i=g[0];try{e=i.declaration.project(c)}catch(a){return r({phase:"project",candidate:i,error:a,defaultProjection:b})}try{return function(a,b){let c=j.parse(a);if(!b&&c.viewKey===h)throw Error("Host reserved Message Declaration Error viewKey cannot be registered");return c}(e,i.builtin)}catch(a){return r({phase:"validate",candidate:i,error:a,defaultProjection:b})}}return b}({source:e,stage:f,message:c,declarations:p}),t="tool"===c.type||"bash"===c.type||"custom"===c.type||"compaction"===c.type,u=null!==s.detail&&(!t||i),v={location:a,fixed:function(a,b,c){let d={timestampMs:a,viewKey:c.viewKey,hasDetail:null!==c.detail};switch(b.type){case"user":return{...d,type:"user"};case"assistant":return{...d,type:"assistant",status:b.status,usage:b.usage};case"tool":return{...d,type:"tool",status:b.status,usage:b.usage};case"bash":return{...d,type:"bash",status:b.status};case"custom":case"compaction":return{...d,type:"custom"}}}(b,c,s),summary:s.summary,...u?{detail:s.detail}:{}};return"tempId"in a?d.s4.parse(v):d.mj.parse(v)}function t(a,b,c,d,e=!1,f="temporary"){return s({tempId:a},null,b,c,f,e,d)}function u(a,b,c,d,e,f){return s({index:a,entryId:b},c,d,e,"durable",!0,f)}},83905:(a,b,c)=>{c.d(b,{$E:()=>f,Rv:()=>g,m4:()=>e});var d=c(59473);let e=d.Yj().trim().min(1),f=d.Yj().trim().min(1),g=d.Yj().trim().min(1)},89409:(a,b,c)=>{c.d(b,{D8:()=>I,Hf:()=>H,LJ:()=>j,Pc:()=>i,RX:()=>T,V6:()=>t,XM:()=>U,XW:()=>P,dG:()=>O,fK:()=>S,fb:()=>s,lJ:()=>B,mh:()=>m,mj:()=>M,q5:()=>A,s4:()=>L,wH:()=>Q,y0:()=>V});var d=c(59473),e=c(83905),f=c(63719),g=c(2364),h=c(25984);let i=d.Yj().uuid(),j=d.ai().int().nonnegative(),k=d.Yj().trim().min(3).max(129).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/),l=d.k5(["image/jpeg","image/png","image/webp","image/gif"]),m=d.Ik({mimeType:l,width:d.ai().int().positive(),height:d.ai().int().positive()}).strict(),n=d.k5(["running","completed","error","aborted"]),o=d.k5(["running","completed","error"]),p=d.ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER),q=d.Ik({inputTokens:p,outputTokens:p,cacheReadTokens:p,costUsd:d.ai().finite().nonnegative()}).strict(),r=d.Yj().trim().min(1).nullable(),s=d.Ik({tempId:i}).strict(),t=d.Ik({index:j,entryId:e.Rv}).strict(),u=d.Ik({timestampMs:g.k.nullable(),type:d.eu("user"),viewKey:k,hasDetail:d.zM()}).strict(),v=d.Ik({timestampMs:g.k.nullable(),type:d.eu("assistant"),viewKey:k,status:n,hasDetail:d.zM(),usage:q}).strict(),w=d.Ik({timestampMs:g.k.nullable(),type:d.eu("tool"),viewKey:k,status:o,hasDetail:d.zM(),usage:q.nullable()}).strict(),x=d.Ik({timestampMs:g.k.nullable(),type:d.eu("bash"),viewKey:k,status:n,hasDetail:d.zM()}).strict(),y=d.Ik({timestampMs:g.k.nullable(),type:d.eu("custom"),viewKey:k,hasDetail:d.zM()}).strict();function z(a){let b=u.extend({timestampMs:a}).strict(),c=v.extend({timestampMs:a}).strict(),e=w.extend({timestampMs:a}).strict(),f=x.extend({timestampMs:a}).strict(),g=y.extend({timestampMs:a}).strict();return{user:b,assistant:c,tool:e,bash:f,custom:g,message:d.gM("type",[b,c,e,f,g])}}d.gM("type",[u,v,w,x,y]);let A=z(d.ch()).message;z(g.k).message;let B=d.Ik({text:d.Yj(),images:d.YO(m)}).strict(),C=d.Ik({provider:d.Yj(),modelId:d.Yj()}).strict();d.Ik({text:d.Yj(),errorMessage:d.Yj().nullable().default(null),model:C.nullable().optional()}).strict();let D={name:d.Yj().trim().min(1),reasoning:r,inputPreview:r,activity:r};function E(){return d.Ik({...D,path:f.eC.nullable()}).strict()}d.Ik({...D,images:d.YO(m).optional()}).strict();let F=d.KC([d.Ik({startedAtMs:g.k}).strict(),d.Ik({durationMs:d.ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER)}).strict()]);d.Ik({...D,timing:F.nullable()}).strict(),E().extend({images:d.YO(m).optional()}).strict(),E(),E(),d.Ik({command:d.Yj().min(1)}).strict(),d.Ik({text:d.Yj()}).strict(),d.Ik({thinking:d.Yj()}).strict();let G=d.Ik({complete:d.zM(),calls:d.YO(d.Ik({name:d.Yj(),arguments:d.g1(d.Yj(),d.Pq()).optional(),argumentsBytes:d.ai().int().nonnegative().optional(),status:d.k5(["ok","error","unfinished"]),durationMs:d.ai().finite().nonnegative().optional(),error:d.Yj().optional()}).strict())}).strict();d.Ik({output:d.Yj(),nestedCalls:G.optional()}).strict(),d.Ik({output:d.Yj()}).strict(),d.Ik({content:d.Yj()}).strict(),d.gM("kind",[d.Ik({kind:d.eu("diff"),content:d.Yj()}).strict(),d.Ik({kind:d.eu("output"),content:d.Yj()}).strict()]),d.gM("kind",[d.Ik({kind:d.eu("content"),content:d.Yj()}).strict(),d.Ik({kind:d.eu("output"),content:d.Yj()}).strict()]),d.Ik({output:d.Yj()}).strict(),d.Ik({text:d.Yj().min(1)}).strict();let H=d.g1(d.Yj(),d.Pq()),I=d.g1(d.Yj(),d.Pq()),J=d.KC([I,d.ch()]);function K(a,b){return d.Ik({location:a,fixed:z(b).message,summary:H,detail:I.optional()}).strict().superRefine((a,b)=>{void 0===a.detail||a.fixed.hasDetail||b.addIssue({code:"custom",message:"message detail requires hasDetail=true",path:["detail"]})})}let L=K(s,d.ch()),M=K(t,g.k);function N(a,b){0===Object.keys(a).length&&b.addIssue({code:"custom",message:"patch requires at least one changed field"})}let O=d.Ik({viewKey:k.optional(),status:d.KC([n,o]).optional(),hasDetail:d.zM().optional(),usage:q.nullable().optional()}).strict().superRefine(N),P=d.g1(d.Yj(),d.Pq()).superRefine(N),Q=d.g1(d.Yj(),d.Pq()).superRefine(N),R=d.KC([d.Yj().min(1),d.YO(d.Pq()).min(1)]),S=d.g1(d.Yj(),R).superRefine((a,b)=>{for(let c of(N(a,b),Object.keys(a)))try{(0,h.U)(c)}catch(a){b.addIssue({code:"custom",message:a instanceof Error?a.message:"increment path is invalid",path:[c]})}}),T=d.Ik({messages:d.YO(M),temporaryMessages:d.YO(L)}).strict(),U=d.Ik({index:j,entryId:e.Rv,detail:J}).strict(),V=d.Ik({mimeType:l,data:d.Yj().min(1)}).strict()},96089:(a,b,c)=>{c.d(b,{R:()=>f});var d=c(59473),e=c(83905);let f=d.Ik({workId:d.Yj().trim().min(1),sessionId:e.$E,branchId:d.Yj().trim().min(1)}).strict()}};