ompgui 0.7.2 → 0.7.4

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 (338) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +8 -6
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/react-loadable-manifest.json +4 -4
  6. package/.next/required-server-files.js +2 -2
  7. package/.next/required-server-files.json +2 -2
  8. package/.next/routes-manifest.json +12 -0
  9. package/.next/server/app/_global-error/page.js +1 -1
  10. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_global-error.html +1 -1
  12. package/.next/server/app/_global-error.rsc +2 -2
  13. package/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
  14. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +2 -2
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page.js +1 -1
  17. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/server/app/_not-found.html +1 -1
  19. package/.next/server/app/_not-found.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  24. package/.next/server/app/api/agent/[id]/bash-output/route.js.nft.json +1 -1
  25. package/.next/server/app/api/agent/[id]/events/route.js +1 -1
  26. package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
  27. package/.next/server/app/api/agent/[id]/route.js +1 -1
  28. package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
  29. package/.next/server/app/api/agent/new/route.js +1 -1
  30. package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
  31. package/.next/server/app/api/agent/running/events/route.js +2 -2
  32. package/.next/server/app/api/agent/running/events/route.js.nft.json +1 -1
  33. package/.next/server/app/api/agents/[name]/route.js +1 -1
  34. package/.next/server/app/api/agents/[name]/route.js.nft.json +1 -1
  35. package/.next/server/app/api/agents/route.js +1 -1
  36. package/.next/server/app/api/agents/route.js.nft.json +1 -1
  37. package/.next/server/app/api/agents/unpack/route.js +1 -1
  38. package/.next/server/app/api/agents/unpack/route.js.nft.json +1 -1
  39. package/.next/server/app/api/app-update/route.js +1 -1
  40. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  41. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  42. package/.next/server/app/api/auth/api-key/[provider]/route.js.nft.json +1 -1
  43. package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
  44. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  45. package/.next/server/app/api/auth/providers/route.js +1 -1
  46. package/.next/server/app/api/cwd/browse/route.js +1 -1
  47. package/.next/server/app/api/cwd/browse/route.js.nft.json +1 -1
  48. package/.next/server/app/api/cwd/validate/route.js +2 -2
  49. package/.next/server/app/api/cwd/validate/route.js.nft.json +1 -1
  50. package/.next/server/app/api/daemon/route.js +1 -1
  51. package/.next/server/app/api/default-cwd/route.js +1 -1
  52. package/.next/server/app/api/default-cwd/route.js.nft.json +1 -1
  53. package/.next/server/app/api/file-index/route.js +1 -1
  54. package/.next/server/app/api/file-index/route.js.nft.json +1 -1
  55. package/.next/server/app/api/files/[...path]/route.js +1 -1
  56. package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -1
  57. package/.next/server/app/api/git/diff/route.js +2 -2
  58. package/.next/server/app/api/git/diff/route.js.nft.json +1 -1
  59. package/.next/server/app/api/git/status/route.js +2 -2
  60. package/.next/server/app/api/git/status/route.js.nft.json +1 -1
  61. package/.next/server/app/api/home/route.js +1 -1
  62. package/.next/server/app/api/mcp/route.js +3 -3
  63. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  64. package/.next/server/app/api/model-roles/route.js +1 -1
  65. package/.next/server/app/api/models/route.js +1 -1
  66. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  67. package/.next/server/app/api/models-config/connectivity/route.js +1 -0
  68. package/.next/server/app/api/models-config/connectivity/route.js.nft.json +1 -0
  69. package/.next/server/app/api/models-config/connectivity/route_client-reference-manifest.js +1 -0
  70. package/.next/server/app/api/models-config/route.js +1 -1
  71. package/.next/server/app/api/models-config/route.js.nft.json +1 -1
  72. package/.next/server/app/api/models-config/test/route.js +1 -1
  73. package/.next/server/app/api/omp-settings/route.js +1 -1
  74. package/.next/server/app/api/omp-update/route.js +2 -2
  75. package/.next/server/app/api/omp-update/route.js.nft.json +1 -1
  76. package/.next/server/app/api/omp-version/route.js +1 -1
  77. package/.next/server/app/api/plugins/route.js +1 -1
  78. package/.next/server/app/api/plugins/route.js.nft.json +1 -1
  79. package/.next/server/app/api/projects/route.js +2 -2
  80. package/.next/server/app/api/projects/route.js.nft.json +1 -1
  81. package/.next/server/app/api/providers/enable/route.js +1 -1
  82. package/.next/server/app/api/relay/devices/[id]/route.js +1 -1
  83. package/.next/server/app/api/relay/devices/route.js +1 -1
  84. package/.next/server/app/api/relay/pair/route.js +1 -1
  85. package/.next/server/app/api/sessions/[id]/archive/route.js +1 -1
  86. package/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
  87. package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -1
  88. package/.next/server/app/api/sessions/[id]/auto-name/route.js.nft.json +1 -1
  89. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  90. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
  91. package/.next/server/app/api/sessions/[id]/entries/[entryId]/media/route.js +1 -1
  92. package/.next/server/app/api/sessions/[id]/entries/[entryId]/media/route.js.nft.json +1 -1
  93. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  94. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js.nft.json +1 -1
  95. package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
  96. package/.next/server/app/api/sessions/[id]/export/route.js.nft.json +1 -1
  97. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  98. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  99. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  100. package/.next/server/app/api/sessions/[id]/state/route.js.nft.json +1 -1
  101. package/.next/server/app/api/sessions/[id]/subagents/[subagentId]/route.js +1 -1
  102. package/.next/server/app/api/sessions/[id]/subagents/[subagentId]/route.js.nft.json +1 -1
  103. package/.next/server/app/api/sessions/[id]/subagents/route.js +1 -1
  104. package/.next/server/app/api/sessions/[id]/subagents/route.js.nft.json +1 -1
  105. package/.next/server/app/api/sessions/archive/route.js +1 -1
  106. package/.next/server/app/api/sessions/archive/route.js.nft.json +1 -1
  107. package/.next/server/app/api/sessions/import/route.js +1 -1
  108. package/.next/server/app/api/sessions/import/route.js.nft.json +1 -1
  109. package/.next/server/app/api/sessions/route.js +1 -1
  110. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  111. package/.next/server/app/api/sessions/search/route.js +1 -0
  112. package/.next/server/app/api/sessions/search/route.js.nft.json +1 -0
  113. package/.next/server/app/api/sessions/search/route_client-reference-manifest.js +1 -0
  114. package/.next/server/app/api/skills/check/route.js +1 -1
  115. package/.next/server/app/api/skills/check/route.js.nft.json +1 -1
  116. package/.next/server/app/api/skills/install/route.js +1 -1
  117. package/.next/server/app/api/skills/install/route.js.nft.json +1 -1
  118. package/.next/server/app/api/skills/route.js +1 -1
  119. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  120. package/.next/server/app/api/skills/search/route.js +1 -1
  121. package/.next/server/app/api/skills/update/route.js +1 -1
  122. package/.next/server/app/api/skills/update/route.js.nft.json +1 -1
  123. package/.next/server/app/api/usage/route.js +1 -1
  124. package/.next/server/app/api/web-auth/session/route.js +1 -1
  125. package/.next/server/app/api/worktrees/route.js +1 -1
  126. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  127. package/.next/server/app/apple-icon.png/route.js +1 -1
  128. package/.next/server/app/favicon.ico/route.js +1 -1
  129. package/.next/server/app/icon.svg/route.js +1 -1
  130. package/.next/server/app/index.html +1 -1
  131. package/.next/server/app/index.rsc +3 -3
  132. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  133. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  134. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  135. package/.next/server/app/login/page.js +1 -1
  136. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  137. package/.next/server/app/login.html +1 -1
  138. package/.next/server/app/login.rsc +3 -3
  139. package/.next/server/app/login.segments/_full.segment.rsc +3 -3
  140. package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  141. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +3 -3
  142. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  143. package/.next/server/app/page.js +2 -2
  144. package/.next/server/app/page.js.nft.json +1 -1
  145. package/.next/server/app/page_client-reference-manifest.js +1 -1
  146. package/.next/server/app/pair/page.js +1 -1
  147. package/.next/server/app/pair/page_client-reference-manifest.js +1 -1
  148. package/.next/server/app/pair.html +1 -1
  149. package/.next/server/app/pair.rsc +3 -3
  150. package/.next/server/app/pair.segments/_full.segment.rsc +3 -3
  151. package/.next/server/app/pair.segments/_tree.segment.rsc +1 -1
  152. package/.next/server/app/pair.segments/pair/__PAGE__.segment.rsc +3 -3
  153. package/.next/server/app/relay/route.js +1 -1
  154. package/.next/server/app-paths-manifest.json +8 -6
  155. package/.next/server/chunks/1410.js +2 -0
  156. package/.next/server/chunks/1671.js +1 -1
  157. package/.next/server/chunks/2043.js +3 -3
  158. package/.next/server/chunks/2676.js +1 -1
  159. package/.next/server/chunks/3100.js +1 -1
  160. package/.next/server/chunks/3798.js +1 -1
  161. package/.next/server/chunks/4980.js +1 -1
  162. package/.next/server/chunks/5318.js +1 -1
  163. package/.next/server/chunks/6332.js +1 -1
  164. package/.next/server/chunks/6337.js +1 -1
  165. package/.next/server/chunks/6480.js +18 -0
  166. package/.next/server/chunks/7077.js +1 -1
  167. package/.next/server/chunks/714.js +3 -1
  168. package/.next/server/chunks/7226.js +107 -0
  169. package/.next/server/chunks/7779.js +1 -1
  170. package/.next/server/chunks/8573.js +11 -0
  171. package/.next/server/chunks/9145.js +1 -1
  172. package/.next/server/chunks/933.js +1 -1
  173. package/.next/server/functions-config-manifest.json +3 -1
  174. package/.next/server/instrumentation.js +1 -1
  175. package/.next/server/instrumentation.js.nft.json +1 -1
  176. package/.next/server/middleware-build-manifest.js +1 -1
  177. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  178. package/.next/server/pages/404.html +1 -1
  179. package/.next/server/pages/500.html +1 -1
  180. package/.next/server/server-reference-manifest.json +1 -1
  181. package/.next/static/chunks/3274.487a15bb28a8bf64.js +2 -0
  182. package/.next/static/chunks/4315-dfe6a33b10f1a366.js +1 -0
  183. package/.next/static/chunks/4318.65827559038c9692.js +17 -0
  184. package/.next/static/chunks/{4906-7dff29185f63f908.js → 4906-1472d0151646b3d8.js} +1 -1
  185. package/.next/static/chunks/app/_global-error/page-08a33f204a956c10.js +1 -0
  186. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-08a33f204a956c10.js +1 -0
  187. package/.next/static/chunks/app/api/agent/[id]/events/route-08a33f204a956c10.js +1 -0
  188. package/.next/static/chunks/app/api/agent/[id]/route-08a33f204a956c10.js +1 -0
  189. package/.next/static/chunks/app/api/agent/new/route-08a33f204a956c10.js +1 -0
  190. package/.next/static/chunks/app/api/agent/running/events/route-08a33f204a956c10.js +1 -0
  191. package/.next/static/chunks/app/api/agents/[name]/route-08a33f204a956c10.js +1 -0
  192. package/.next/static/chunks/app/api/agents/route-08a33f204a956c10.js +1 -0
  193. package/.next/static/chunks/app/api/agents/unpack/route-08a33f204a956c10.js +1 -0
  194. package/.next/static/chunks/app/api/app-update/route-08a33f204a956c10.js +1 -0
  195. package/.next/static/chunks/app/api/auth/all-providers/route-08a33f204a956c10.js +1 -0
  196. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-08a33f204a956c10.js +1 -0
  197. package/.next/static/chunks/app/api/auth/login/[provider]/route-08a33f204a956c10.js +1 -0
  198. package/.next/static/chunks/app/api/auth/logout/[provider]/route-08a33f204a956c10.js +1 -0
  199. package/.next/static/chunks/app/api/auth/providers/route-08a33f204a956c10.js +1 -0
  200. package/.next/static/chunks/app/api/cwd/browse/route-08a33f204a956c10.js +1 -0
  201. package/.next/static/chunks/app/api/cwd/validate/route-08a33f204a956c10.js +1 -0
  202. package/.next/static/chunks/app/api/daemon/route-08a33f204a956c10.js +1 -0
  203. package/.next/static/chunks/app/api/default-cwd/route-08a33f204a956c10.js +1 -0
  204. package/.next/static/chunks/app/api/file-index/route-08a33f204a956c10.js +1 -0
  205. package/.next/static/chunks/app/api/files/[...path]/route-08a33f204a956c10.js +1 -0
  206. package/.next/static/chunks/app/api/git/diff/route-08a33f204a956c10.js +1 -0
  207. package/.next/static/chunks/app/api/git/status/route-08a33f204a956c10.js +1 -0
  208. package/.next/static/chunks/app/api/home/route-08a33f204a956c10.js +1 -0
  209. package/.next/static/chunks/app/api/mcp/route-08a33f204a956c10.js +1 -0
  210. package/.next/static/chunks/app/api/model-roles/route-08a33f204a956c10.js +1 -0
  211. package/.next/static/chunks/app/api/models/route-08a33f204a956c10.js +1 -0
  212. package/.next/static/chunks/app/api/models-config/catalog/route-08a33f204a956c10.js +1 -0
  213. package/.next/static/chunks/app/api/models-config/connectivity/route-08a33f204a956c10.js +1 -0
  214. package/.next/static/chunks/app/api/models-config/route-08a33f204a956c10.js +1 -0
  215. package/.next/static/chunks/app/api/models-config/test/route-08a33f204a956c10.js +1 -0
  216. package/.next/static/chunks/app/api/omp-settings/route-08a33f204a956c10.js +1 -0
  217. package/.next/static/chunks/app/api/omp-update/route-08a33f204a956c10.js +1 -0
  218. package/.next/static/chunks/app/api/omp-version/route-08a33f204a956c10.js +1 -0
  219. package/.next/static/chunks/app/api/plugins/route-08a33f204a956c10.js +1 -0
  220. package/.next/static/chunks/app/api/projects/route-08a33f204a956c10.js +1 -0
  221. package/.next/static/chunks/app/api/providers/enable/route-08a33f204a956c10.js +1 -0
  222. package/.next/static/chunks/app/api/relay/devices/[id]/route-08a33f204a956c10.js +1 -0
  223. package/.next/static/chunks/app/api/relay/devices/route-08a33f204a956c10.js +1 -0
  224. package/.next/static/chunks/app/api/relay/pair/route-08a33f204a956c10.js +1 -0
  225. package/.next/static/chunks/app/api/sessions/[id]/archive/route-08a33f204a956c10.js +1 -0
  226. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-08a33f204a956c10.js +1 -0
  227. package/.next/static/chunks/app/api/sessions/[id]/context/route-08a33f204a956c10.js +1 -0
  228. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/media/route-08a33f204a956c10.js +1 -0
  229. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-08a33f204a956c10.js +1 -0
  230. package/.next/static/chunks/app/api/sessions/[id]/export/route-08a33f204a956c10.js +1 -0
  231. package/.next/static/chunks/app/api/sessions/[id]/route-08a33f204a956c10.js +1 -0
  232. package/.next/static/chunks/app/api/sessions/[id]/state/route-08a33f204a956c10.js +1 -0
  233. package/.next/static/chunks/app/api/sessions/[id]/subagents/[subagentId]/route-08a33f204a956c10.js +1 -0
  234. package/.next/static/chunks/app/api/sessions/[id]/subagents/route-08a33f204a956c10.js +1 -0
  235. package/.next/static/chunks/app/api/sessions/archive/route-08a33f204a956c10.js +1 -0
  236. package/.next/static/chunks/app/api/sessions/import/route-08a33f204a956c10.js +1 -0
  237. package/.next/static/chunks/app/api/sessions/route-08a33f204a956c10.js +1 -0
  238. package/.next/static/chunks/app/api/sessions/search/route-08a33f204a956c10.js +1 -0
  239. package/.next/static/chunks/app/api/skills/check/route-08a33f204a956c10.js +1 -0
  240. package/.next/static/chunks/app/api/skills/install/route-08a33f204a956c10.js +1 -0
  241. package/.next/static/chunks/app/api/skills/route-08a33f204a956c10.js +1 -0
  242. package/.next/static/chunks/app/api/skills/search/route-08a33f204a956c10.js +1 -0
  243. package/.next/static/chunks/app/api/skills/update/route-08a33f204a956c10.js +1 -0
  244. package/.next/static/chunks/app/api/usage/route-08a33f204a956c10.js +1 -0
  245. package/.next/static/chunks/app/api/web-auth/session/route-08a33f204a956c10.js +1 -0
  246. package/.next/static/chunks/app/api/worktrees/route-08a33f204a956c10.js +1 -0
  247. package/.next/static/chunks/app/manifest.webmanifest/route-08a33f204a956c10.js +1 -0
  248. package/.next/static/chunks/app/page-bca40f639be6becb.js +59 -0
  249. package/.next/static/chunks/app/relay/route-08a33f204a956c10.js +1 -0
  250. package/.next/static/chunks/next/dist/client/components/builtin/app-error-08a33f204a956c10.js +1 -0
  251. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-08a33f204a956c10.js +1 -0
  252. package/.next/static/chunks/next/dist/client/components/builtin/not-found-08a33f204a956c10.js +1 -0
  253. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-08a33f204a956c10.js +1 -0
  254. package/.next/static/chunks/webpack-b14269412e91a71d.js +1 -0
  255. package/.next/static/d7tCWD5FStyLazqHgLBLG/_buildManifest.js +1 -0
  256. package/README.ja.md +4 -1
  257. package/README.ko.md +6 -2
  258. package/README.md +7 -3
  259. package/README.zh-CN.md +4 -1
  260. package/bin/ompgui-update.js +11 -6
  261. package/bin/ompgui.js +6 -2
  262. package/package.json +2 -2
  263. package/.next/server/chunks/6209.js +0 -12
  264. package/.next/server/chunks/795.js +0 -105
  265. package/.next/server/chunks/8834.js +0 -18
  266. package/.next/static/Na7qed083WBP3X-plluRO/_buildManifest.js +0 -1
  267. package/.next/static/chunks/1012.477e42e5184b6aaa.js +0 -17
  268. package/.next/static/chunks/3274.2a04ea2716225057.js +0 -1
  269. package/.next/static/chunks/4315-142781649334beb2.js +0 -1
  270. package/.next/static/chunks/app/_global-error/page-710453b8adcf7d31.js +0 -1
  271. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-710453b8adcf7d31.js +0 -1
  272. package/.next/static/chunks/app/api/agent/[id]/events/route-710453b8adcf7d31.js +0 -1
  273. package/.next/static/chunks/app/api/agent/[id]/route-710453b8adcf7d31.js +0 -1
  274. package/.next/static/chunks/app/api/agent/new/route-710453b8adcf7d31.js +0 -1
  275. package/.next/static/chunks/app/api/agent/running/events/route-710453b8adcf7d31.js +0 -1
  276. package/.next/static/chunks/app/api/agents/[name]/route-710453b8adcf7d31.js +0 -1
  277. package/.next/static/chunks/app/api/agents/route-710453b8adcf7d31.js +0 -1
  278. package/.next/static/chunks/app/api/agents/unpack/route-710453b8adcf7d31.js +0 -1
  279. package/.next/static/chunks/app/api/app-update/route-710453b8adcf7d31.js +0 -1
  280. package/.next/static/chunks/app/api/auth/all-providers/route-710453b8adcf7d31.js +0 -1
  281. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-710453b8adcf7d31.js +0 -1
  282. package/.next/static/chunks/app/api/auth/login/[provider]/route-710453b8adcf7d31.js +0 -1
  283. package/.next/static/chunks/app/api/auth/logout/[provider]/route-710453b8adcf7d31.js +0 -1
  284. package/.next/static/chunks/app/api/auth/providers/route-710453b8adcf7d31.js +0 -1
  285. package/.next/static/chunks/app/api/cwd/browse/route-710453b8adcf7d31.js +0 -1
  286. package/.next/static/chunks/app/api/cwd/validate/route-710453b8adcf7d31.js +0 -1
  287. package/.next/static/chunks/app/api/daemon/route-710453b8adcf7d31.js +0 -1
  288. package/.next/static/chunks/app/api/default-cwd/route-710453b8adcf7d31.js +0 -1
  289. package/.next/static/chunks/app/api/file-index/route-710453b8adcf7d31.js +0 -1
  290. package/.next/static/chunks/app/api/files/[...path]/route-710453b8adcf7d31.js +0 -1
  291. package/.next/static/chunks/app/api/git/diff/route-710453b8adcf7d31.js +0 -1
  292. package/.next/static/chunks/app/api/git/status/route-710453b8adcf7d31.js +0 -1
  293. package/.next/static/chunks/app/api/home/route-710453b8adcf7d31.js +0 -1
  294. package/.next/static/chunks/app/api/mcp/route-710453b8adcf7d31.js +0 -1
  295. package/.next/static/chunks/app/api/model-roles/route-710453b8adcf7d31.js +0 -1
  296. package/.next/static/chunks/app/api/models/route-710453b8adcf7d31.js +0 -1
  297. package/.next/static/chunks/app/api/models-config/catalog/route-710453b8adcf7d31.js +0 -1
  298. package/.next/static/chunks/app/api/models-config/route-710453b8adcf7d31.js +0 -1
  299. package/.next/static/chunks/app/api/models-config/test/route-710453b8adcf7d31.js +0 -1
  300. package/.next/static/chunks/app/api/omp-settings/route-710453b8adcf7d31.js +0 -1
  301. package/.next/static/chunks/app/api/omp-update/route-710453b8adcf7d31.js +0 -1
  302. package/.next/static/chunks/app/api/omp-version/route-710453b8adcf7d31.js +0 -1
  303. package/.next/static/chunks/app/api/plugins/route-710453b8adcf7d31.js +0 -1
  304. package/.next/static/chunks/app/api/projects/route-710453b8adcf7d31.js +0 -1
  305. package/.next/static/chunks/app/api/providers/enable/route-710453b8adcf7d31.js +0 -1
  306. package/.next/static/chunks/app/api/relay/devices/[id]/route-710453b8adcf7d31.js +0 -1
  307. package/.next/static/chunks/app/api/relay/devices/route-710453b8adcf7d31.js +0 -1
  308. package/.next/static/chunks/app/api/relay/pair/route-710453b8adcf7d31.js +0 -1
  309. package/.next/static/chunks/app/api/sessions/[id]/archive/route-710453b8adcf7d31.js +0 -1
  310. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-710453b8adcf7d31.js +0 -1
  311. package/.next/static/chunks/app/api/sessions/[id]/context/route-710453b8adcf7d31.js +0 -1
  312. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/media/route-710453b8adcf7d31.js +0 -1
  313. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-710453b8adcf7d31.js +0 -1
  314. package/.next/static/chunks/app/api/sessions/[id]/export/route-710453b8adcf7d31.js +0 -1
  315. package/.next/static/chunks/app/api/sessions/[id]/route-710453b8adcf7d31.js +0 -1
  316. package/.next/static/chunks/app/api/sessions/[id]/state/route-710453b8adcf7d31.js +0 -1
  317. package/.next/static/chunks/app/api/sessions/[id]/subagents/[subagentId]/route-710453b8adcf7d31.js +0 -1
  318. package/.next/static/chunks/app/api/sessions/[id]/subagents/route-710453b8adcf7d31.js +0 -1
  319. package/.next/static/chunks/app/api/sessions/archive/route-710453b8adcf7d31.js +0 -1
  320. package/.next/static/chunks/app/api/sessions/import/route-710453b8adcf7d31.js +0 -1
  321. package/.next/static/chunks/app/api/sessions/route-710453b8adcf7d31.js +0 -1
  322. package/.next/static/chunks/app/api/skills/check/route-710453b8adcf7d31.js +0 -1
  323. package/.next/static/chunks/app/api/skills/install/route-710453b8adcf7d31.js +0 -1
  324. package/.next/static/chunks/app/api/skills/route-710453b8adcf7d31.js +0 -1
  325. package/.next/static/chunks/app/api/skills/search/route-710453b8adcf7d31.js +0 -1
  326. package/.next/static/chunks/app/api/skills/update/route-710453b8adcf7d31.js +0 -1
  327. package/.next/static/chunks/app/api/usage/route-710453b8adcf7d31.js +0 -1
  328. package/.next/static/chunks/app/api/web-auth/session/route-710453b8adcf7d31.js +0 -1
  329. package/.next/static/chunks/app/api/worktrees/route-710453b8adcf7d31.js +0 -1
  330. package/.next/static/chunks/app/manifest.webmanifest/route-710453b8adcf7d31.js +0 -1
  331. package/.next/static/chunks/app/page-f53564bcb292e1e5.js +0 -59
  332. package/.next/static/chunks/app/relay/route-710453b8adcf7d31.js +0 -1
  333. package/.next/static/chunks/next/dist/client/components/builtin/app-error-710453b8adcf7d31.js +0 -1
  334. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-710453b8adcf7d31.js +0 -1
  335. package/.next/static/chunks/next/dist/client/components/builtin/not-found-710453b8adcf7d31.js +0 -1
  336. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-710453b8adcf7d31.js +0 -1
  337. package/.next/static/chunks/webpack-4e02c722bd171663.js +0 -1
  338. /package/.next/static/{Na7qed083WBP3X-plluRO → d7tCWD5FStyLazqHgLBLG}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";exports.id=7779,exports.ids=[7779],exports.modules={28967:(a,b,c)=>{function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear()}function f(a){return{...a,modelError:"Model list is temporarily unavailable. Check your configuration and try again."}}function g(a,b){var c,e,f;let g,h,i=d(),j=i.entries.get(a);if(j&&j.expiresAt>Date.now())return Promise.resolve(j.data);let k=i.inFlight.get(a)??(c=i,e=a,f=b,g=c.generation,h=Promise.resolve().then(f).then(a=>{if(c.generation===g&&c.inFlight.get(e)===h){for(c.entries.delete(e);c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(e,{data:a,expiresAt:Date.now()+6e4})}return a}).finally(()=>{c.inFlight.get(e)===h&&c.inFlight.delete(e)}),c.inFlight.set(e,h),h);return j?(k.catch(()=>{}),Promise.resolve(j.data)):k}c.d(b,{Fw:()=>f,kn:()=>e,rC:()=>g})},87779:(a,b,c)=>{c.d(b,{A4:()=>T,HG:()=>U,rb:()=>P,Te:()=>V,OF:()=>$,Fn:()=>X});var d=c(29021),e=c(21820),f=c(78970),g=c(28967),h=c(13798),i=c(88501),j=c(78573),k=c(77598);let l={revision:0,items:[]},m="enqueue_message",n="recall_queued_message",o="delete_queued_message",p="promote_queued_message",q="get_message_queue",r="queue_stale_revision",s="queue_item_missing",t="queue_item_sending",u="queue_invalid",v="This message may already have been handed to the agent. It was not confirmed and will not be retried.",w=new Set([m,n,o,p,q]);class x extends Error{constructor(a,b){super(a),this.name="SessionQueueError",this.code=b}}function y(a){return"steer"===a||"followUp"===a}function z(a){return{type:"message_queue_update",queue:a}}function A(a,b){return b?{queue:a,recalled:b}:{queue:a}}function B(a){return Buffer.byteLength(a,"utf8")}function C(a){let b={id:a.id,text:a.text,lane:a.lane,status:a.status,...a.error?{error:a.error}:{}};return Object.freeze(b),b}class D{getSnapshot(){return this.snapshot}hasSending(){return this.items.some(a=>"sending"===a.status)}selectDispatchCandidate(a){if(!this.hasSending())return this.items.find(b=>"queued"===b.status&&b.lane===a)}enqueue(a){if(!y(a.lane))throw new x("lane must be steer or followUp",u);let b=this.assertText(a.text);if(this.items.length>=32)throw new x("The queue already holds 32 messages","queue_full");this.assertTotalBytes(B(b));let c=C({id:(0,k.randomUUID)(),lane:a.lane,text:b,status:"queued"});return this.items=[...this.items,c],this.publish()}promote(a,b){let c=this.requireMutable(a,b);if("followUp"!==c.lane||"queued"!==c.status)throw new x("Only a queued follow-up can be promoted to steer",u);let d=C({...c,lane:"steer",status:"queued"});return this.items=[d,...this.items.filter(b=>b.id!==a)],this.publish()}recall(a,b){let c=this.requireMutable(a,b);return this.items=this.items.filter(b=>b.id!==a),{item:c,snapshot:this.publish()}}delete(a,b){return this.requireMutable(a,b),this.items=this.items.filter(b=>b.id!==a),this.publish()}markSending(a){let b=this.items.find(b=>b.id===a);if(!b)throw new x("Queued message was not found",s);if("queued"!==b.status)throw new x("Queued message is already being sent",t);return this.replace(a,{...b,status:"sending"}),this.publish()}markFailed(a,b){let c=this.items.find(b=>b.id===a);return c?(this.replace(a,{...c,status:"failed",error:b}),this.publish()):this.snapshot}remove(a){return this.items.some(b=>b.id===a)?(this.items=this.items.filter(b=>b.id!==a),this.publish()):this.snapshot}failSending(a){return this.hasSending()?(this.items=this.items.map(b=>"sending"===b.status?C({...b,status:"failed",error:a}):b),this.publish()):this.snapshot}reset(){return this.items=[],this.revision=0,this.snapshot=l,this.snapshot}requireMutable(a,b){this.assertCas(b);let c=this.items.find(b=>b.id===a);if(!c)throw new x("Queued message was not found",s);if("sending"===c.status)throw new x("Queued message is already being sent",t);return c}assertCas(a){if("number"!=typeof a||a!==this.revision)throw new x("Queue revision is stale; reload the queue and retry",r)}assertText(a){if("string"!=typeof a)throw new x("Message text is required",u);if(0===a.length||0===a.trim().length)throw new x("Message text cannot be empty",u);if(B(a)>262144)throw new x("Message exceeds 262144 bytes","queue_item_too_large");return a}assertTotalBytes(a){let b=a;for(let a of this.items)b+=B(a.text);if(b>1048576)throw new x("Queue exceeds 1048576 bytes","queue_too_large")}replace(a,b){this.items=this.items.map(c=>c.id===a?C(b):c)}publish(){let a;this.revision+=1;let b={revision:this.revision,items:(Object.freeze(a=this.items.map(a=>C(a))),a)};return Object.freeze(b),this.snapshot=b,b}constructor(){this.revision=0,this.items=[],this.snapshot=l}}let E="This session is restarting — retry in a moment.";class F extends Error{constructor(a,b){super(a),this.name="WebRpcError",this.code=b}}let G=new Set(["select","confirm","input","editor","open_url"]),H=new Set(["abort","abort_and_prompt","set_thinking_level","cycle_thinking_level","cycle_model","get_available_models","set_auto_compaction","set_auto_retry","abort_retry","abort_bash","set_todos","set_steering_mode","set_follow_up_mode","set_interrupt_mode","get_branch_messages","get_messages","get_messages_page","export_html","handoff","get_subagents","get_subagent_messages","set_subagent_subscription","get_login_providers","login"]),I={navigate_tree:"Branch navigation is not supported over the omp RPC protocol",clear_queue:"Recalling queued messages is not supported over the omp RPC protocol",get_tools:"Per-session tool listing is not supported over the omp RPC protocol",set_tools:"Changing tools on a running session is not supported over the omp RPC protocol; tool presets apply to new sessions",extension_ui_input:"Extension custom UI is not supported over the omp RPC protocol"},J={find:"glob",search:"grep"},K=new Set(["ls"]),L=["bash","read","edit","write","grep","find","ls","task"].map(a=>a.toLowerCase()).sort().join(",");function M(a,b,c=!1){let d=[];if(a)d.push("--resume",a);else if(void 0!==b){let a=b.map(a=>a.toLowerCase()).sort().join(",");if(0===b.length)d.push("--no-tools");else if(a===L);else{let a=function(a){let b=[];for(let c of a){let a=c.toLowerCase();if(K.has(a))continue;let d=J[a]??a;b.includes(d)||b.push(d)}return b}(b);a.length>0&&d.push("--tools",a.join(","))}}return c&&!a&&d.push("--advisor"),d}function N(a){return a?.length?a:void 0}function O(a){return"string"==typeof a.toolCallId&&a.toolCallId?a.toolCallId:"string"==typeof a.id&&a.id?a.id:""}function P(a){if(a&&(0,d.existsSync)(a))return{cwd:a,fellBack:!1};try{let a=process.cwd();if(a&&(0,d.existsSync)(a))return{cwd:a,fellBack:!0}}catch{}return{cwd:(0,e.homedir)(),fellBack:!0}}function Q(a){a&&"object"==typeof a&&void 0===a.estimatedTokensAfter&&(a.estimatedTokensAfter=Math.round((a.summary?.length??0)/4))}class R{constructor(a,b,c){this.listeners=[],this.pendingUiRequests=new Map,this.uiExpiryTimers=new Map,this.extensionStatuses=new Map,this.extensionWidgets=new Map,this.promptRunning=!1,this.bashRunning=!1,this.streaming=!1,this.compacting=!1,this.fastModeEnabled=!1,this.idleTimer=null,this.destroyListeners=[],this.onIdentityChangeCallback=null,this.unsubscribeFrames=null,this.initPromise=null,this.restarting=!1,this.mcpListWaiter=null,this._alive=!0,this.hostToolNames=new Set,this.pendingHostTools=new Map,this.hostUriSchemes=new Map,this.pendingHostUris=new Map,this.messageQueue=new D,this.queueEpoch=0,this.queueDispatching=!1,this.queueDispatchAgain=!1,this.abortHoldsDispatch=!1,this.activeToolIds=new Set,this.nativeFollowUpDepth=0,this.nativeHandoffPending=0,this.nativeQueuedCount=0,this.nativeQueueStale=!1,this.nativeReconcileGeneration=0,this.destroyPromise=null,this._sessionId="",this._sessionFile="",this.sessionFileSignalTimer=null,this.proc=a,this.cwd=b,this.recordedCwd=c??null}get sessionId(){return this._sessionId}get sessionFile(){return this._sessionFile}isAlive(){return this._alive&&this.proc.isAlive}isRunning(){return this.isAlive()&&(this.promptRunning||this.streaming||this.compacting||this.bashRunning)}start(){this.unsubscribeFrames=this.proc.onFrame(a=>this.handleFrame(a)),this.resetIdleTimer(),Z()}waitUntilReady(){return this.initPromise||(this.initPromise=this.initialize()),this.initPromise}async initialize(){let a=await this.proc.waitReady(12e4);await this.proc.negotiateProtocol(a),await this.proc.sendCommand({type:"set_subagent_subscription",level:"events"}).catch(()=>{});let b=await this.proc.sendCommand({type:"get_state"});this.applyIdentity(b),this.recordedCwd&&this.recordedCwd!==this.cwd&&this.emit({type:"notice",level:"warning",message:`This session's working directory no longer exists; the agent is running in ${this.cwd}.`})}applyIdentity(a){this._sessionId=a.sessionId,this._sessionFile=a.sessionFile??"",this._sessionName=a.sessionName,this.streaming=a.isStreaming,this.compacting=a.isCompacting,this.fastModeEnabled=a.fastModeEnabled??a.fastMode??this.fastModeEnabled,this._sessionFile&&(0,j.O8)(this._sessionId,this._sessionFile)}handleProcessExit(a){if(!this._alive||this.restarting)return;let b=a.trim().split("\n").pop()??"";this.emit({type:"notice",level:"error",message:`The omp process for this session exited unexpectedly${b?`: ${b}`:"."}`}),(this.streaming||this.promptRunning)&&this.emit({type:"agent_end",isTerminal:!0,messages:[]}),this.destroy()}handleFrame(a){this.resetIdleTimer();let b=!1,c=!1;switch(a.type){case"command_output":{let b=this.mcpListWaiter;if(b&&"string"==typeof a.text){clearTimeout(b.timer),this.mcpListWaiter=null,b.resolve(a.text),Z();return}break}case"agent_start":!this.streaming&&this.nativeFollowUpDepth>0&&(this.nativeFollowUpDepth-=1),this.streaming=!0,(0,j.mD)(),b=!0,this._sessionFile&&!(0,d.existsSync)(this._sessionFile)&&this.signalWhenSessionFileAppears();break;case"agent_end":!1!==a.isTerminal&&(this.streaming=!1,this.promptRunning=!1,this.activeToolIds.clear(),(0,j.mD)(),this.nativeQueuedCount>0||this.nativeQueueStale?this.beginNativeQueueReconcile():c=!0);break;case"prompt_result":this.promptRunning=!1,c=!0;break;case"auto_compaction_start":this.compacting=!0;break;case"auto_compaction_end":this.compacting=!1,Q(a.result),(0,j.mD)(),c=!0;break;case"tool_execution_start":{let b=O(a);b&&this.activeToolIds.add(b);break}case"tool_execution_end":{let b=O(a);b&&this.activeToolIds.delete(b),c=!0;break}case"session_info_update":"string"==typeof a.title&&(this._sessionName=a.title),(0,j.mD)(),b=!0;break;case"response":if(!1===a.success&&"prompt"===a.command){this.promptRunning=!1,this.emit({type:"prompt_error",errorMessage:a.error??"Prompt failed"}),Z(),this.scheduleQueueDispatch();return}break;case"extension_ui_request":if(this.trackExtensionUiRequest(a))return void Z();break;case"host_tool_call":{let b="string"==typeof a.id?a.id:"",c="string"==typeof a.toolName?a.toolName:"";if(b&&c&&this.hostToolNames.has(c)&&this.listeners.length>0){this.pendingHostTools.set(b,a),this.emit(a),Z();return}this.rejectUnexpectedHostTool(a);return}case"host_tool_cancel":{let b="string"==typeof a.targetId?a.targetId:"";if(b&&this.pendingHostTools.delete(b)){this.emit(a),Z();return}break}case"host_uri_request":{let b="string"==typeof a.id?a.id:"",c=("string"==typeof a.url?a.url:"").split(":")[0]??"",d="write"===a.operation?"write":"read",e=this.hostUriSchemes.get(c);if(b&&c&&e&&("write"!==d||e.writable)&&this.listeners.length>0){this.pendingHostUris.set(b,a),this.emit(a),Z();return}this.proc.sendFrame({type:"host_uri_result",id:b,isError:!0,error:`URI scheme "${c}" is not registered by omp-web`});return}case"host_uri_cancel":{let b="string"==typeof a.targetId?a.targetId:"";if(b&&this.pendingHostUris.delete(b)){this.emit(a),Z();return}}}this.emit(a),Z({refreshSessionList:b}),c&&this.scheduleQueueDispatch()}forgetPendingUiRequest(a){this.pendingUiRequests.delete(a);let b=this.uiExpiryTimers.get(a);b&&(clearTimeout(b),this.uiExpiryTimers.delete(a))}clearPendingUiRequests(){for(let a of this.uiExpiryTimers.values())clearTimeout(a);this.uiExpiryTimers.clear(),this.pendingUiRequests.clear()}trackExtensionUiRequest(a){let b=a.method,c=a.id;if("cancel"===b)return this.forgetPendingUiRequest(a.targetId),!1;let d=!1;try{d=(0,i.rk)().settings.tools?.approval?.extension==="allow"}catch{}if("confirm"===b&&"string"==typeof a.title&&/^allow tool\s*:/i.test(a.title)&&d)return this.forgetPendingUiRequest(c),this.proc.sendFrame({type:"extension_ui_response",id:c,confirmed:!0}),!0;if(G.has(b)){this.forgetPendingUiRequest(c);let b="number"==typeof a.timeout?a.timeout:void 0;if(b&&b>0){a.expiresAt=Date.now()+b;let d=setTimeout(()=>this.forgetPendingUiRequest(c),b);d.unref?.(),this.uiExpiryTimers.set(c,d)}return this.pendingUiRequests.set(c,a),!1}if("setStatus"===b){let b=a.statusKey,c=a.statusText;return void 0===c?this.extensionStatuses.delete(b):this.extensionStatuses.set(b,c),!1}if("setWidget"===b){let b=a.widgetKey,c=a.widgetLines;void 0===c?this.extensionWidgets.delete(b):this.extensionWidgets.set(b,{key:b,lines:c,placement:a.widgetPlacement??"aboveEditor"})}return!1}rejectUnexpectedHostTool(a){let b="string"==typeof a.id?a.id:"";if(!b)return;let c="string"==typeof a.toolName?a.toolName:"unknown";this.proc.sendFrame({type:"host_tool_result",id:b,isError:!0,result:{content:[{type:"text",text:`Host tool "${c}" is not available in ompgui. Use OMP's built-in tools within the selected workspace.`}]}}),this.emit({type:"notice",level:"warning",message:`Rejected unavailable host tool: ${c}`})}rejectPendingHostTools(a){for(let b of this.pendingHostTools.keys())this.proc.sendFrame({type:"host_tool_result",id:b,isError:!0,result:{content:[{type:"text",text:a}]}});this.pendingHostTools.clear()}rejectPendingHostUris(a){for(let b of this.pendingHostUris.keys())this.proc.sendFrame({type:"host_uri_result",id:b,isError:!0,error:a});this.pendingHostUris.clear()}emit(a){for(let b of this.listeners)try{b(a)}catch{}}signalWhenSessionFileAppears(){if(this.sessionFileSignalTimer)return;let a=0,b=()=>{if(this.sessionFileSignalTimer=null,this._alive&&this._sessionFile){if(!(0,d.existsSync)(this._sessionFile)){(a+=1)<40&&(this.sessionFileSignalTimer=setTimeout(b,250));return}(0,j.mD)(),Z({refreshSessionList:!0})}};this.sessionFileSignalTimer=setTimeout(b,250)}resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this.isRunning()?this.resetIdleTimer():this.destroy()},6e5)}onEvent(a){this.listeners.push(a);let b=Date.now();for(let[c,d]of this.pendingUiRequests){let e=d.expiresAt;if(void 0!==e&&e<=b){this.forgetPendingUiRequest(c);continue}a(d)}return a(z(this.messageQueue.getSnapshot())),()=>{let b=this.listeners.indexOf(a);-1!==b&&this.listeners.splice(b,1),0===this.listeners.length&&(this.rejectPendingHostTools("The web UI disconnected while the agent was waiting for this host tool"),this.rejectPendingHostUris("The web UI disconnected while the agent was waiting for this URI request"))}}onDestroy(a){return this._alive?(this.destroyListeners.push(a),()=>{let b=this.destroyListeners.indexOf(a);-1!==b&&this.destroyListeners.splice(b,1)}):(a(),()=>{})}onIdentityChange(a){this.onIdentityChangeCallback=a}async withFinalRunningNotification(a){try{return await a()}finally{Z()}}async getMcpList(){let a,b;if(this.restarting)throw new F(E,"session_restarting");if(!this.isAlive())throw Error("Session is no longer running");if(this.isRunning())throw new F("Wait for the current run to finish","session_busy");if(this.mcpListWaiter)throw new F("MCP list is already loading","mcp_list_loading");this.promptRunning=!0,Z();let c=new Promise((c,d)=>{a=c,b=d});c.catch(()=>{});let d={resolve:a,reject:b,timer:void 0};d.timer=setTimeout(()=>{this.mcpListWaiter===d&&(this.mcpListWaiter=null,b(new F("Timed out while loading MCP servers","mcp_list_timeout")))},15e3),d.timer.unref?.(),this.mcpListWaiter=d;try{return await this.proc.sendCommand({type:"prompt",message:"/mcp list"}),await c}catch(a){throw this.mcpListWaiter===d&&(clearTimeout(d.timer),this.mcpListWaiter=null,d.reject(a instanceof Error?a:Error(String(a)))),a}finally{this.mcpListWaiter===d&&(clearTimeout(d.timer),this.mcpListWaiter=null),this.promptRunning=!1,Z()}}buildWebState(a){return this.streaming=a.isStreaming,this.compacting=a.isCompacting,this._sessionName=a.sessionName,this.nativeQueuedCount=a.queuedMessageCount??0,this.nativeQueueStale=!1,a.sessionId&&(this._sessionId=a.sessionId,this._sessionFile=a.sessionFile??this._sessionFile),{sessionId:a.sessionId,sessionFile:a.sessionFile??"",sessionName:a.sessionName,isStreaming:a.isStreaming,isPromptRunning:this.promptRunning,isBashRunning:this.bashRunning,isCompacting:a.isCompacting,autoCompactionEnabled:a.autoCompactionEnabled,autoRetryEnabled:a.autoRetryEnabled,interruptMode:a.interruptMode,steeringMode:a.steeringMode,followUpMode:a.followUpMode,model:a.model?{id:a.model.id,provider:a.model.provider,name:a.model.name,reasoning:a.model.reasoning,thinking:a.model.thinking?{efforts:a.model.thinking.efforts}:void 0}:void 0,messageCount:a.messageCount,queuedMessageCount:a.queuedMessageCount,messageQueue:this.queueSnapshotForClient(),contextUsage:a.contextUsage??null,systemPrompt:a.systemPrompt?.join("\n\n")??"",thinkingLevel:a.thinkingLevel??"off",fastModeEnabled:a.fastModeEnabled??a.fastMode??this.fastModeEnabled,fastModeActive:a.fastModeActive,todoPhases:a.todoPhases??[],extensionStatuses:Array.from(this.extensionStatuses,([a,b])=>({key:a,text:b})),extensionWidgets:Array.from(this.extensionWidgets.values())}}async refreshIdentityAfterSessionChange(){let a=this._sessionId,b=await this.proc.sendCommand({type:"get_state"});return this.applyIdentity(b),a&&a!==this._sessionId&&(this.discardQueue("Queued messages were discarded because the session changed."),this.onIdentityChangeCallback?.(a,this._sessionId)),(0,j.mD)(),this._sessionId}async restart(){if(this.restarting)throw new F(E,"session_restarting");let a=this._sessionFile,b=!!a&&(0,d.existsSync)(a),c=this.proc;this.restarting=!0,this.queueEpoch+=1,this.abortHoldsDispatch=!1,this.activeToolIds.clear(),this.nativeFollowUpDepth=0,this.nativeHandoffPending=0,this.nativeQueuedCount=0,this.nativeQueueStale=!1,this.nativeReconcileGeneration+=1,this.messageQueue.failSending(v),this.emitQueueSnapshot(),this.unsubscribeFrames?.();try{if(await c.dispose(),!this._alive)return;this.extensionStatuses.clear(),this.extensionWidgets.clear(),this.clearPendingUiRequests(),this.promptRunning=!1,this.bashRunning=!1,this.streaming=!1,this.compacting=!1;let d=new h.X({cwd:this.cwd,extraArgs:M(b?a:""),onExit:({stderrTail:a})=>{this.proc===d&&this.handleProcessExit(a)}});this.proc=d,this.unsubscribeFrames=d.onFrame(a=>this.handleFrame(a));try{let a=await d.waitReady(12e4);await d.negotiateProtocol(a),await d.sendCommand({type:"set_subagent_subscription",level:"events"}).catch(()=>{});let b=await d.sendCommand({type:"get_state"});this.applyIdentity(b)}catch(a){throw this.unsubscribeFrames?.(),this.unsubscribeFrames=null,d.dispose(),this.destroy(),a}}finally{this.restarting=!1}Z(),this.scheduleQueueDispatch()}async send(a){if(this.restarting)throw new F(E,"session_restarting");if(!this.isAlive())throw Error("Session is no longer running");this.resetIdleTimer();let b=a.type;if("prompt"===b||"steer"===b||"follow_up"===b){let b=(0,f.kc)(a.images);if(b)throw Error(b)}let c=I[b];if(c)throw new h.x(b,c,"unsupported");if("string"==typeof b&&w.has(b))return this.handleQueueCommand(a);switch(b){case"prompt":{if(this.bashRunning)throw Error("Cannot send a prompt while a shell command is running");let b=a.streamingBehavior;b||(this.abortHoldsDispatch=!1,this.promptRunning=!0,Z());try{let c=await this.forwardNativeHandoff({type:"prompt",message:a.message,...N(a.images)?{images:N(a.images)}:{},...b?{streamingBehavior:b}:{}},"followUp"===b);c?.agentInvoked===!1&&(b||(this.promptRunning=!1,this.emit({type:"prompt_result",agentInvoked:!1}),Z()),this.scheduleQueueDispatch())}catch(a){throw this.promptRunning=!1,Z(),a}return null}case"steer":case"follow_up":return await this.forwardNativeHandoff({type:b,message:a.message,...N(a.images)?{images:N(a.images)}:{}},"follow_up"===b),null;case"abort":return this.abortHoldsDispatch=!0,await this.withFinalRunningNotification(async()=>{await this.proc.sendCommand({type:"abort"}),this.promptRunning=!1}),null;case"get_state":{let a=await this.proc.sendCommand({type:"get_state"});return this.buildWebState(a)}case"set_model":{let{provider:b,modelId:c}=a,d=await this.proc.sendCommand({type:"set_model",provider:b,modelId:c});return(0,g.kn)(),(0,j.mD)(),{id:d.id,provider:d.provider}}case"set_fast_mode":{let b=!0===a.enabled,c=await this.proc.sendCommand({type:"set_fast_mode",enabled:b});return this.fastModeEnabled=c?.enabled??b,{enabled:this.fastModeEnabled,active:c?.active??!1}}case"fork":if(this.bashRunning)throw Error("Cannot fork while a shell command is running");if(this.queueEpoch+=1,this.messageQueue.failSending(v),this.emitQueueSnapshot(),(await this.proc.sendCommand({type:"branch",entryId:a.entryId})).cancelled)return{cancelled:!0};return{cancelled:!1,newSessionId:await this.refreshIdentityAfterSessionChange()};case"new_session":case"switch_session":{this.queueEpoch+=1,this.messageQueue.failSending(v),this.emitQueueSnapshot();let b=await this.proc.sendCommand(a);if(!b.cancelled)return{cancelled:!1,newSessionId:await this.refreshIdentityAfterSessionChange()};return b}case"compact":try{return await this.withFinalRunningNotification(async()=>{this.compacting=!0,Z();try{let b=await this.proc.sendCommand({type:"compact",...a.customInstructions?{customInstructions:a.customInstructions}:{}});return Q(b),b}finally{this.compacting=!1}})}finally{(0,j.mD)(),this.scheduleQueueDispatch()}case"abort_compaction":return this.abortHoldsDispatch=!0,await this.withFinalRunningNotification(()=>this.proc.sendCommand({type:"abort"})),null;case"set_session_name":{let b=a.name?.trim();if(!b)throw Error("Session name cannot be empty");return await this.proc.sendCommand({type:"set_session_name",name:b}),this._sessionName=b,(0,j.mD)(),null}case"get_session_stats":return{...await this.proc.sendCommand({type:"get_session_stats"}),sessionName:this._sessionName};case"get_last_assistant_text":return{text:(await this.proc.sendCommand({type:"get_last_assistant_text"})).text??""};case"get_commands":return await this.proc.sendCommand({type:"get_available_commands"});case"reload":return await this.restart(),{success:!0};case"extension_ui_response":{let{id:b,...c}=a;return this.forgetPendingUiRequest(b),this.proc.sendFrame({type:"extension_ui_response",id:b,...c}),null}case"bash":if(!0===a.excludeFromContext)throw new F("omp cannot run a shell command with its output excluded from the model context (`!!`): the RPC bash command has no exclusion option, so the output would silently enter the context anyway. Run it with a single `!` to share the output with the model, or use a terminal outside ompgui.","bash_exclude_unsupported");if(this.isRunning())throw Error("Cannot run a shell command while the session is busy");this.bashRunning=!0,Z();try{return await this.proc.sendCommand({type:"bash",command:a.command})}finally{this.bashRunning=!1,(0,j.mD)(),Z(),this.scheduleQueueDispatch()}case"set_host_tools":{let b=(Array.isArray(a.tools)?a.tools:[]).filter(a=>"string"==typeof a.name&&a.name);return this.hostToolNames=new Set(b.map(a=>a.name)),await this.proc.sendCommand({type:"set_host_tools",tools:b}),null}case"host_tool_result":return"string"==typeof a.id&&this.pendingHostTools.delete(a.id),await this.proc.sendCommand(a),null;case"set_host_uri_schemes":{let b=Array.isArray(a.schemes)?a.schemes:[];for(let a of(this.hostUriSchemes=new Map,b))"string"==typeof a.scheme&&a.scheme&&this.hostUriSchemes.set(a.scheme,{writable:!0===a.writable});return await this.proc.sendCommand({type:"set_host_uri_schemes",schemes:b}),null}case"host_uri_result":return"string"==typeof a.id&&this.pendingHostUris.delete(a.id),await this.proc.sendCommand(a),null;default:if(H.has(b)){let c=await this.proc.sendCommand(a);return"set_thinking_level"===b&&(0,j.mD)(),c??null}throw Error(`Unsupported command: ${b}`)}}handleQueueCommand(a){try{let b=a.type;switch(b){case m:if(!y(a.lane))throw new x("lane must be steer or followUp",u);if("string"!=typeof a.message)throw new x("message is required",u);return this.abortHoldsDispatch=!1,this.messageQueue.enqueue({lane:a.lane,text:a.message}),this.emitQueueSnapshot(),this.finishQueueCommand();case p:if("string"!=typeof a.id)throw new x("id is required",u);return this.abortHoldsDispatch=!1,this.messageQueue.promote(a.id,this.requireExpectedRevision(a)),this.emitQueueSnapshot(),this.finishQueueCommand();case n:{if("string"!=typeof a.id)throw new x("id is required",u);let{item:b}=this.messageQueue.recall(a.id,this.requireExpectedRevision(a));return this.emitQueueSnapshot(),this.finishQueueCommand(b)}case o:if("string"!=typeof a.id)throw new x("id is required",u);return this.messageQueue.delete(a.id,this.requireExpectedRevision(a)),this.emitQueueSnapshot(),this.finishQueueCommand();case q:return Promise.resolve(A(this.queueSnapshotForClient()));default:throw Error(`Unsupported command: ${b}`)}}catch(a){if(a instanceof x)throw new F(a.message,a.code);throw a}}requireExpectedRevision(a){if("number"!=typeof a.expectedRevision)throw new x("Queue revision is stale; reload the queue and retry",r);return a.expectedRevision}async finishQueueCommand(a){return await this.drainQueueDispatch(),A(this.queueSnapshotForClient(),a)}queueSnapshotForClient(){return{...this.messageQueue.getSnapshot(),nativeQueuedCount:this.nativeQueuedCount}}emitQueueSnapshot(){this.emit(z(this.queueSnapshotForClient()))}beginNativeQueueReconcile(){this.nativeQueueStale=!0,this.nativeReconcileGeneration+=1;let a=this.nativeReconcileGeneration,b=this.queueEpoch,c=this.proc;this.refreshNativeQueuedCount(a,b,c)}async refreshNativeQueuedCount(a,b,c){try{let d=await c.sendCommand({type:"get_state"});if(!this.nativeReconcileStillValid(a,b,c))return;this.nativeQueuedCount=d.queuedMessageCount??0,this.nativeQueueStale=!1}catch{if(!this.nativeReconcileStillValid(a,b,c))return;this.nativeQueuedCount=0,this.nativeQueueStale=!1}this.scheduleQueueDispatch()}nativeReconcileStillValid(a,b,c){return this._alive&&this.queueEpoch===b&&this.proc===c&&this.nativeReconcileGeneration===a}discardQueue(a){this.queueEpoch+=1;let b=this.messageQueue.getSnapshot().items.length>0;this.messageQueue.reset(),this.emitQueueSnapshot(),b&&this.emit({type:"notice",level:"warning",message:a})}scheduleQueueDispatch(){this.drainQueueDispatch()}async drainQueueDispatch(){if(this.queueDispatching){this.queueDispatchAgain=!0;return}this.queueDispatching=!0;try{do this.queueDispatchAgain=!1,await this.dispatchNextQueueItem();while(this.queueDispatchAgain)}catch{}finally{this.queueDispatching=!1,this.queueDispatchAgain&&this.scheduleQueueDispatch()}}canDispatchSteer(){return this.isAlive()&&!this.restarting&&this.streaming&&!this.compacting&&!this.bashRunning&&0===this.activeToolIds.size&&0===this.pendingHostTools.size&&0===this.nativeHandoffPending}canDispatchFollowUp(){return this.isAlive()&&!this.restarting&&!this.abortHoldsDispatch&&!this.promptRunning&&!this.streaming&&!this.compacting&&!this.bashRunning&&0===this.activeToolIds.size&&0===this.pendingHostTools.size&&0===this.nativeFollowUpDepth&&0===this.nativeHandoffPending&&!this.nativeQueueStale&&0===this.nativeQueuedCount}canDispatchIdlePrompt(){return this.canDispatchFollowUp()}async dispatchNextQueueItem(){for(;this.isAlive()&&!this.restarting;){if(this.messageQueue.hasSending())return;let a=this.messageQueue.selectDispatchCandidate("steer");if(a){if(this.canDispatchSteer()){await this.forwardQueueItem(a,"steer");continue}if(this.canDispatchIdlePrompt()){await this.forwardQueueItem(a);continue}return}let b=this.messageQueue.selectDispatchCandidate("followUp");if(b&&this.canDispatchFollowUp()){await this.forwardQueueItem(b);continue}return}}async forwardQueueItem(a,b){let c=this.queueEpoch,d=this.proc,e=this._sessionId;this.messageQueue.markSending(a.id),this.emitQueueSnapshot(),b||(this.promptRunning=!0,Z());try{let f=await d.sendCommand({type:"prompt",message:a.text,...b?{streamingBehavior:b}:{}},3e4);if(!this.queueForwardStillValid(c,d,e,a.id))return;this.messageQueue.remove(a.id),this.emitQueueSnapshot(),f?.agentInvoked!==!1||b||(this.promptRunning=!1,this.emit({type:"prompt_result",agentInvoked:!1}),Z())}catch(g){if(b||(this.promptRunning=!1),!this.queueForwardStillValid(c,d,e,a.id))return;let f=g instanceof Error&&/timed out/i.test(g.message)?v:`${v} ${g instanceof Error?g.message:String(g)}`;this.messageQueue.markFailed(a.id,f),this.emitQueueSnapshot(),this.emit({type:"notice",level:"warning",message:f}),Z()}}queueForwardStillValid(a,b,c,d){return!!this._alive&&this.queueEpoch===a&&this.proc===b&&(!c||this._sessionId===c)&&this.messageQueue.getSnapshot().items.some(a=>a.id===d&&"sending"===a.status)}async forwardNativeHandoff(a,b){this.nativeHandoffPending+=1,b&&(this.nativeFollowUpDepth+=1);try{var c;let d=await this.proc.sendCommand(a);return b&&(c=d)&&"object"==typeof c&&!1===c.agentInvoked&&(this.nativeFollowUpDepth=Math.max(0,this.nativeFollowUpDepth-1)),d}catch(a){throw b&&(this.nativeFollowUpDepth=Math.max(0,this.nativeFollowUpDepth-1)),a}finally{this.nativeHandoffPending=Math.max(0,this.nativeHandoffPending-1),this.scheduleQueueDispatch()}}destroy(){this.destroyAndWait()}async destroyAndWait(){if(this.destroyPromise)return this.destroyPromise;if(!this._alive)return;this._alive=!1,this.queueEpoch+=1,this.abortHoldsDispatch=!0,this.discardQueue("Queued messages were discarded because the session shut down."),this.idleTimer&&clearTimeout(this.idleTimer),this.sessionFileSignalTimer&&(clearTimeout(this.sessionFileSignalTimer),this.sessionFileSignalTimer=null),this.unsubscribeFrames?.(),this.clearPendingUiRequests(),this.mcpListWaiter&&(clearTimeout(this.mcpListWaiter.timer),this.mcpListWaiter.reject(Error("Session was closed while loading MCP servers")),this.mcpListWaiter=null);let a=this.proc.dispose().catch(()=>{}).then(()=>{for(let[a,b]of S())b===this&&S().delete(a)});for(let b of(this.destroyPromise=a,this.pendingHostTools.clear(),this.hostToolNames.clear(),this.pendingHostUris.clear(),this.hostUriSchemes.clear(),this.destroyListeners.splice(0)))try{b()}catch{}Z(),await a}}function S(){if(!globalThis.__ompSessions){globalThis.__ompSessions=new Map;let a=()=>globalThis.__ompSessions?.forEach(a=>a.destroy());process.once("exit",a),process.once("SIGINT",a),process.once("SIGTERM",a)}return globalThis.__ompSessions}function T(a){return S().get(a)}function U(){let a=new Set;for(let[b,c]of S())c.isRunning()&&a.add(c.sessionId||b);return[...a]}async function V(){let a=[...new Set(S().values())];return await Promise.all(a.map(a=>a.destroyAndWait())),a.length}function W(){return globalThis.__ompRunningListeners||(globalThis.__ompRunningListeners=new Set),globalThis.__ompRunningListeners}function X(a){let b=W();return b.add(a),()=>{b.delete(a)}}let Y="";function Z({refreshSessionList:a=!1}={}){let b=U(),c=JSON.stringify([...b].sort());if(c===Y&&!a)return;Y=c;let d={ids:b,refreshSessionList:a};for(let a of W())try{a(d)}catch{}}async function $(a,b,c,d,e=!1,f){let g=S(),i=(globalThis.__ompStartLocks||(globalThis.__ompStartLocks=new Map),globalThis.__ompStartLocks),j=g.get(a);for(;j&&!j.isAlive()&&j.destroyPromise;)await j.destroyPromise,j=g.get(a);if(j?.isAlive())return{session:j,realSessionId:a};let k=i.get(a);if(k)return k;let l=(async()=>{let a={},i=new R(new h.X({cwd:c,extraArgs:M(b,d,e),onExit:({stderrTail:b})=>a.wrapper?.handleProcessExit(b)}),c,f);a.wrapper=i,i.start();try{await i.waitUntilReady()}catch(a){throw await i.destroyAndWait(),a}let j=i.sessionId;return i.onIdentityChange((a,b)=>{g.get(a)===i&&g.delete(a),g.set(b,i)}),g.set(j,i),{session:i,realSessionId:j}})().finally(()=>i.delete(a));return i.set(a,l),l}}};
1
+ "use strict";exports.id=7779,exports.ids=[7779],exports.modules={28967:(a,b,c)=>{function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear()}function f(a){return{...a,modelError:"Model list is temporarily unavailable. Check your configuration and try again."}}function g(a,b){var c,e,f;let g,h,i=d(),j=i.entries.get(a);if(j&&j.expiresAt>Date.now())return Promise.resolve(j.data);let k=i.inFlight.get(a)??(c=i,e=a,f=b,g=c.generation,h=Promise.resolve().then(f).then(a=>{if(c.generation===g&&c.inFlight.get(e)===h){for(c.entries.delete(e);c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(e,{data:a,expiresAt:Date.now()+6e4})}return a}).finally(()=>{c.inFlight.get(e)===h&&c.inFlight.delete(e)}),c.inFlight.set(e,h),h);return j?(k.catch(()=>{}),Promise.resolve(j.data)):k}c.d(b,{Fw:()=>f,kn:()=>e,rC:()=>g})},87779:(a,b,c)=>{c.d(b,{A4:()=>T,HG:()=>U,rb:()=>P,Te:()=>V,OF:()=>$,Fn:()=>X});var d=c(29021),e=c(21820),f=c(78970),g=c(28967),h=c(13798),i=c(88501),j=c(78573),k=c(77598);let l={revision:0,items:[]},m="enqueue_message",n="recall_queued_message",o="delete_queued_message",p="promote_queued_message",q="get_message_queue",r="queue_stale_revision",s="queue_item_missing",t="queue_item_sending",u="queue_invalid",v="This message may already have been handed to the agent. It was not confirmed and will not be retried.",w=new Set([m,n,o,p,q]);class x extends Error{constructor(a,b){super(a),this.name="SessionQueueError",this.code=b}}function y(a){return"steer"===a||"followUp"===a}function z(a){return{type:"message_queue_update",queue:a}}function A(a,b){return b?{queue:a,recalled:b}:{queue:a}}function B(a){return Buffer.byteLength(a,"utf8")}function C(a){let b={id:a.id,text:a.text,lane:a.lane,status:a.status,...a.error?{error:a.error}:{},...a.attachments?{attachments:Object.freeze(a.attachments.map(a=>Object.freeze({...a})))}:{}};return Object.freeze(b),b}class D{getSnapshot(){return this.snapshot}hasSending(){return this.items.some(a=>"sending"===a.status)}selectDispatchCandidate(a){if(!this.hasSending())return this.items.find(b=>"queued"===b.status&&b.lane===a)}getImages(a){return this.imagePayloads.get(a)}enqueue(a){if(!y(a.lane))throw new x("lane must be steer or followUp",u);let b=(0,f.kc)(a.images);if(b)throw new x(b,u);let c=[],d=[],e=0;if(Array.isArray(a.images))for(let b of a.images){if("object"!=typeof b||null===b||!("data"in b)||!("mimeType"in b)||"string"!=typeof b.data||"string"!=typeof b.mimeType)throw new x("Each attachment must be an image",u);let a=(0,f.Si)(b.data);if(null===a)throw new x("Invalid image data",u);e+=a,c.push(Object.freeze({type:"image",data:b.data,mimeType:b.mimeType})),d.push({mimeType:b.mimeType,bytes:a})}if(this.imageBytes+e>0x6400000)throw new x("Queue image capacity exceeds 100MiB; remove or recall queued images first","queue_images_too_large");let g=this.assertText(a.text,c.length>0);if(this.items.length>=32)throw new x("The queue already holds 32 messages","queue_full");this.assertTotalBytes(B(g));let h=C({id:(0,k.randomUUID)(),lane:a.lane,text:g,status:"queued",...d.length?{attachments:d}:{}});return c.length&&this.imagePayloads.set(h.id,Object.freeze(c)),this.imageBytes+=e,this.items=[...this.items,h],this.publish()}promote(a,b){let c=this.requireMutable(a,b);if("followUp"!==c.lane||"queued"!==c.status)throw new x("Only a queued follow-up can be promoted to steer",u);let d=C({...c,lane:"steer",status:"queued"});return this.items=[d,...this.items.filter(b=>b.id!==a)],this.publish()}recall(a,b,c){let d=this.requireMutable(a,b),e=this.imagePayloads.get(a);if(void 0!==c){if(!Number.isSafeInteger(c)||c<=0)throw new x("Invalid recall response capacity",u);let a=B(JSON.stringify({queue:this.snapshot,recalled:d}))+256;for(let b of e??[])a+=b.data.length+B(JSON.stringify({type:"image",data:"",mimeType:b.mimeType}))+1;if(a>c)throw new x("These queued images exceed the remote recall transfer limit. Recall them from the web app instead; the queued message has not changed.","queue_recall_too_large")}return this.releaseImages(d),this.items=this.items.filter(b=>b.id!==a),{item:e?{...d,images:e}:d,snapshot:this.publish()}}delete(a,b){let c=this.requireMutable(a,b);return this.releaseImages(c),this.items=this.items.filter(b=>b.id!==a),this.publish()}markSending(a){let b=this.items.find(b=>b.id===a);if(!b)throw new x("Queued message was not found",s);if("queued"!==b.status)throw new x("Queued message is already being sent",t);return this.replace(a,{...b,status:"sending"}),this.publish()}markFailed(a,b){let c=this.items.find(b=>b.id===a);return c?(this.replace(a,{...c,status:"failed",error:b}),this.publish()):this.snapshot}remove(a){let b=this.items.find(b=>b.id===a);return b?(this.releaseImages(b),this.items=this.items.filter(b=>b.id!==a),this.publish()):this.snapshot}failSending(a){return this.hasSending()?(this.items=this.items.map(b=>"sending"===b.status?C({...b,status:"failed",error:a}):b),this.publish()):this.snapshot}reset(){return this.imagePayloads.clear(),this.imageBytes=0,this.items=[],this.revision=0,this.snapshot=l,this.snapshot}releaseImages(a){if(this.imagePayloads.delete(a.id))for(let b of a.attachments??[])this.imageBytes-=b.bytes}requireMutable(a,b){this.assertCas(b);let c=this.items.find(b=>b.id===a);if(!c)throw new x("Queued message was not found",s);if("sending"===c.status)throw new x("Queued message is already being sent",t);return c}assertCas(a){if("number"!=typeof a||a!==this.revision)throw new x("Queue revision is stale; reload the queue and retry",r)}assertText(a,b){if("string"!=typeof a)throw new x("Message text is required",u);if(!b&&0===a.trim().length)throw new x("Message text cannot be empty",u);if(B(a)>262144)throw new x("Message exceeds 262144 bytes","queue_item_too_large");return a}assertTotalBytes(a){let b=a;for(let a of this.items)b+=B(a.text);if(b>1048576)throw new x("Queue exceeds 1048576 bytes","queue_too_large")}replace(a,b){this.items=this.items.map(c=>c.id===a?C(b):c)}publish(){let a;this.revision+=1;let b={revision:this.revision,items:(Object.freeze(a=this.items.map(a=>C(a))),a)};return Object.freeze(b),this.snapshot=b,b}constructor(){this.revision=0,this.items=[],this.imagePayloads=new Map,this.imageBytes=0,this.snapshot=l}}let E="This session is restarting — retry in a moment.";class F extends Error{constructor(a,b){super(a),this.name="WebRpcError",this.code=b}}let G=new Set(["select","confirm","input","editor","open_url"]),H=new Set(["abort","abort_and_prompt","set_thinking_level","cycle_thinking_level","cycle_model","get_available_models","set_auto_compaction","set_auto_retry","abort_retry","abort_bash","set_todos","set_steering_mode","set_follow_up_mode","set_interrupt_mode","get_branch_messages","get_messages","get_messages_page","export_html","handoff","get_subagents","get_subagent_messages","set_subagent_subscription","get_login_providers","login"]),I={navigate_tree:"Branch navigation is not supported over the omp RPC protocol",clear_queue:"Recalling queued messages is not supported over the omp RPC protocol",get_tools:"Per-session tool listing is not supported over the omp RPC protocol",set_tools:"Changing tools on a running session is not supported over the omp RPC protocol; tool presets apply to new sessions",extension_ui_input:"Extension custom UI is not supported over the omp RPC protocol"},J={find:"glob",search:"grep"},K=new Set(["ls"]),L=["bash","read","edit","write","grep","find","ls","task"].map(a=>a.toLowerCase()).sort().join(",");function M(a,b,c=!1){let d=[];if(a)d.push("--resume",a);else if(void 0!==b){let a=b.map(a=>a.toLowerCase()).sort().join(",");if(0===b.length)d.push("--no-tools");else if(a===L);else{let a=function(a){let b=[];for(let c of a){let a=c.toLowerCase();if(K.has(a))continue;let d=J[a]??a;b.includes(d)||b.push(d)}return b}(b);a.length>0&&d.push("--tools",a.join(","))}}return c&&!a&&d.push("--advisor"),d}function N(a){return a?.length?a:void 0}function O(a){return"string"==typeof a.toolCallId&&a.toolCallId?a.toolCallId:"string"==typeof a.id&&a.id?a.id:""}function P(a){if(a&&(0,d.existsSync)(a))return{cwd:a,fellBack:!1};try{let a=process.cwd();if(a&&(0,d.existsSync)(a))return{cwd:a,fellBack:!0}}catch{}return{cwd:(0,e.homedir)(),fellBack:!0}}function Q(a){a&&"object"==typeof a&&void 0===a.estimatedTokensAfter&&(a.estimatedTokensAfter=Math.round((a.summary?.length??0)/4))}class R{constructor(a,b,c){this.listeners=[],this.pendingUiRequests=new Map,this.uiExpiryTimers=new Map,this.extensionStatuses=new Map,this.extensionWidgets=new Map,this.promptRunning=!1,this.bashRunning=!1,this.streaming=!1,this.compacting=!1,this.fastModeEnabled=!1,this.idleTimer=null,this.destroyListeners=[],this.onIdentityChangeCallback=null,this.unsubscribeFrames=null,this.initPromise=null,this.restarting=!1,this.mcpListWaiter=null,this._alive=!0,this.hostToolNames=new Set,this.pendingHostTools=new Map,this.hostUriSchemes=new Map,this.pendingHostUris=new Map,this.messageQueue=new D,this.queueEpoch=0,this.queueDispatching=!1,this.queueDispatchAgain=!1,this.abortHoldsDispatch=!1,this.activeToolIds=new Set,this.nativeFollowUpDepth=0,this.nativeHandoffPending=0,this.nativeQueuedCount=0,this.nativeQueueStale=!1,this.nativeReconcileGeneration=0,this.destroyPromise=null,this._sessionId="",this._sessionFile="",this.sessionFileSignalTimer=null,this.proc=a,this.cwd=b,this.recordedCwd=c??null}get sessionId(){return this._sessionId}get sessionFile(){return this._sessionFile}isAlive(){return this._alive&&this.proc.isAlive}isRunning(){return this.isAlive()&&(this.promptRunning||this.streaming||this.compacting||this.bashRunning)}start(){this.unsubscribeFrames=this.proc.onFrame(a=>this.handleFrame(a)),this.resetIdleTimer(),Z()}waitUntilReady(){return this.initPromise||(this.initPromise=this.initialize()),this.initPromise}async initialize(){let a=await this.proc.waitReady(12e4);await this.proc.negotiateProtocol(a),await this.proc.sendCommand({type:"set_subagent_subscription",level:"events"}).catch(()=>{});let b=await this.proc.sendCommand({type:"get_state"});this.applyIdentity(b),this.recordedCwd&&this.recordedCwd!==this.cwd&&this.emit({type:"notice",level:"warning",message:`This session's working directory no longer exists; the agent is running in ${this.cwd}.`})}applyIdentity(a){this._sessionId=a.sessionId,this._sessionFile=a.sessionFile??"",this._sessionName=a.sessionName,this.streaming=a.isStreaming,this.compacting=a.isCompacting,this.fastModeEnabled=a.fastModeEnabled??a.fastMode??this.fastModeEnabled,this._sessionFile&&(0,j.O8)(this._sessionId,this._sessionFile)}handleProcessExit(a){if(!this._alive||this.restarting)return;let b=a.trim().split("\n").pop()??"";this.emit({type:"notice",level:"error",message:`The omp process for this session exited unexpectedly${b?`: ${b}`:"."}`}),(this.streaming||this.promptRunning)&&this.emit({type:"agent_end",isTerminal:!0,messages:[]}),this.destroy()}handleFrame(a){this.resetIdleTimer();let b=!1,c=!1;switch(a.type){case"command_output":{let b=this.mcpListWaiter;if(b&&"string"==typeof a.text){clearTimeout(b.timer),this.mcpListWaiter=null,b.resolve(a.text),Z();return}break}case"agent_start":!this.streaming&&this.nativeFollowUpDepth>0&&(this.nativeFollowUpDepth-=1),this.streaming=!0,(0,j.mD)(),b=!0,this._sessionFile&&!(0,d.existsSync)(this._sessionFile)&&this.signalWhenSessionFileAppears();break;case"agent_end":!1!==a.isTerminal&&(this.streaming=!1,this.promptRunning=!1,this.activeToolIds.clear(),(0,j.mD)(),this.nativeQueuedCount>0||this.nativeQueueStale?this.beginNativeQueueReconcile():c=!0);break;case"prompt_result":this.promptRunning=!1,c=!0;break;case"auto_compaction_start":this.compacting=!0;break;case"auto_compaction_end":this.compacting=!1,Q(a.result),(0,j.mD)(),c=!0;break;case"tool_execution_start":{let b=O(a);b&&this.activeToolIds.add(b);break}case"tool_execution_end":{let b=O(a);b&&this.activeToolIds.delete(b),c=!0;break}case"session_info_update":"string"==typeof a.title&&(this._sessionName=a.title),(0,j.mD)(),b=!0;break;case"response":if(!1===a.success&&"prompt"===a.command){this.promptRunning=!1,this.emit({type:"prompt_error",errorMessage:a.error??"Prompt failed"}),Z(),this.scheduleQueueDispatch();return}break;case"extension_ui_request":if(this.trackExtensionUiRequest(a))return void Z();break;case"host_tool_call":{let b="string"==typeof a.id?a.id:"",c="string"==typeof a.toolName?a.toolName:"";if(b&&c&&this.hostToolNames.has(c)&&this.listeners.length>0){this.pendingHostTools.set(b,a),this.emit(a),Z();return}this.rejectUnexpectedHostTool(a);return}case"host_tool_cancel":{let b="string"==typeof a.targetId?a.targetId:"";if(b&&this.pendingHostTools.delete(b)){this.emit(a),Z();return}break}case"host_uri_request":{let b="string"==typeof a.id?a.id:"",c=("string"==typeof a.url?a.url:"").split(":")[0]??"",d="write"===a.operation?"write":"read",e=this.hostUriSchemes.get(c);if(b&&c&&e&&("write"!==d||e.writable)&&this.listeners.length>0){this.pendingHostUris.set(b,a),this.emit(a),Z();return}this.proc.sendFrame({type:"host_uri_result",id:b,isError:!0,error:`URI scheme "${c}" is not registered by omp-web`});return}case"host_uri_cancel":{let b="string"==typeof a.targetId?a.targetId:"";if(b&&this.pendingHostUris.delete(b)){this.emit(a),Z();return}}}this.emit(a),Z({refreshSessionList:b}),c&&this.scheduleQueueDispatch()}forgetPendingUiRequest(a){this.pendingUiRequests.delete(a);let b=this.uiExpiryTimers.get(a);b&&(clearTimeout(b),this.uiExpiryTimers.delete(a))}clearPendingUiRequests(){for(let a of this.uiExpiryTimers.values())clearTimeout(a);this.uiExpiryTimers.clear(),this.pendingUiRequests.clear()}trackExtensionUiRequest(a){let b=a.method,c=a.id;if("cancel"===b)return this.forgetPendingUiRequest(a.targetId),!1;let d=!1;try{d=(0,i.rk)().settings.tools?.approval?.extension==="allow"}catch{}if("confirm"===b&&"string"==typeof a.title&&/^allow tool\s*:/i.test(a.title)&&d)return this.forgetPendingUiRequest(c),this.proc.sendFrame({type:"extension_ui_response",id:c,confirmed:!0}),!0;if(G.has(b)){this.forgetPendingUiRequest(c);let b="number"==typeof a.timeout?a.timeout:void 0;if(void 0!==b&&Number.isFinite(b)&&b>0&&b<=0x7fffffff){a.expiresAt=Date.now()+b;let d=setTimeout(()=>{this.forgetPendingUiRequest(c),this.emit({type:"extension_ui_request",method:"cancel",id:`expired:${c}`,targetId:c})},b);d.unref?.(),this.uiExpiryTimers.set(c,d)}return this.pendingUiRequests.set(c,a),!1}if("setStatus"===b){let b=a.statusKey,c=a.statusText;return void 0===c?this.extensionStatuses.delete(b):this.extensionStatuses.set(b,c),!1}if("setWidget"===b){let b=a.widgetKey,c=a.widgetLines;void 0===c?this.extensionWidgets.delete(b):this.extensionWidgets.set(b,{key:b,lines:c,placement:a.widgetPlacement??"aboveEditor"})}return!1}rejectUnexpectedHostTool(a){let b="string"==typeof a.id?a.id:"";if(!b)return;let c="string"==typeof a.toolName?a.toolName:"unknown";this.proc.sendFrame({type:"host_tool_result",id:b,isError:!0,result:{content:[{type:"text",text:`Host tool "${c}" is not available in ompgui. Use OMP's built-in tools within the selected workspace.`}]}}),this.emit({type:"notice",level:"warning",message:`Rejected unavailable host tool: ${c}`})}rejectPendingHostTools(a){for(let b of this.pendingHostTools.keys())this.proc.sendFrame({type:"host_tool_result",id:b,isError:!0,result:{content:[{type:"text",text:a}]}});this.pendingHostTools.clear()}rejectPendingHostUris(a){for(let b of this.pendingHostUris.keys())this.proc.sendFrame({type:"host_uri_result",id:b,isError:!0,error:a});this.pendingHostUris.clear()}emit(a){for(let b of this.listeners)try{b(a)}catch{}}signalWhenSessionFileAppears(){if(this.sessionFileSignalTimer)return;let a=0,b=()=>{if(this.sessionFileSignalTimer=null,this._alive&&this._sessionFile){if(!(0,d.existsSync)(this._sessionFile)){(a+=1)<40&&(this.sessionFileSignalTimer=setTimeout(b,250));return}(0,j.mD)(),Z({refreshSessionList:!0})}};this.sessionFileSignalTimer=setTimeout(b,250)}resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this.isRunning()?this.resetIdleTimer():this.destroy()},6e5)}onEvent(a){this.listeners.push(a);let b=Date.now();for(let[a,c]of this.pendingUiRequests){let d=c.expiresAt;if(void 0!==d&&d<=b){this.forgetPendingUiRequest(a);continue}}for(let b of(a({type:"extension_ui_pending",ids:[...this.pendingUiRequests.keys()]}),this.pendingUiRequests.values()))a(b);return a(z(this.messageQueue.getSnapshot())),()=>{let b=this.listeners.indexOf(a);-1!==b&&this.listeners.splice(b,1),0===this.listeners.length&&(this.rejectPendingHostTools("The web UI disconnected while the agent was waiting for this host tool"),this.rejectPendingHostUris("The web UI disconnected while the agent was waiting for this URI request"))}}onDestroy(a){return this._alive?(this.destroyListeners.push(a),()=>{let b=this.destroyListeners.indexOf(a);-1!==b&&this.destroyListeners.splice(b,1)}):(a(),()=>{})}onIdentityChange(a){this.onIdentityChangeCallback=a}async withFinalRunningNotification(a){try{return await a()}finally{Z()}}async getMcpList(){let a,b;if(this.restarting)throw new F(E,"session_restarting");if(!this.isAlive())throw Error("Session is no longer running");if(this.isRunning())throw new F("Wait for the current run to finish","session_busy");if(this.mcpListWaiter)throw new F("MCP list is already loading","mcp_list_loading");this.promptRunning=!0,Z();let c=new Promise((c,d)=>{a=c,b=d});c.catch(()=>{});let d={resolve:a,reject:b,timer:void 0};d.timer=setTimeout(()=>{this.mcpListWaiter===d&&(this.mcpListWaiter=null,b(new F("Timed out while loading MCP servers","mcp_list_timeout")))},15e3),d.timer.unref?.(),this.mcpListWaiter=d;try{return await this.proc.sendCommand({type:"prompt",message:"/mcp list"}),await c}catch(a){throw this.mcpListWaiter===d&&(clearTimeout(d.timer),this.mcpListWaiter=null,d.reject(a instanceof Error?a:Error(String(a)))),a}finally{this.mcpListWaiter===d&&(clearTimeout(d.timer),this.mcpListWaiter=null),this.promptRunning=!1,Z()}}buildWebState(a){return this.streaming=a.isStreaming,this.compacting=a.isCompacting,this._sessionName=a.sessionName,this.nativeQueuedCount=a.queuedMessageCount??0,this.nativeQueueStale=!1,a.sessionId&&(this._sessionId=a.sessionId,this._sessionFile=a.sessionFile??this._sessionFile),{sessionId:a.sessionId,sessionFile:a.sessionFile??"",sessionName:a.sessionName,isStreaming:a.isStreaming,isPromptRunning:this.promptRunning,isBashRunning:this.bashRunning,isCompacting:a.isCompacting,autoCompactionEnabled:a.autoCompactionEnabled,autoRetryEnabled:a.autoRetryEnabled,interruptMode:a.interruptMode,steeringMode:a.steeringMode,followUpMode:a.followUpMode,model:a.model?{id:a.model.id,provider:a.model.provider,name:a.model.name,reasoning:a.model.reasoning,thinking:a.model.thinking?{efforts:a.model.thinking.efforts}:void 0}:void 0,messageCount:a.messageCount,queuedMessageCount:a.queuedMessageCount,messageQueue:this.queueSnapshotForClient(),contextUsage:a.contextUsage??null,systemPrompt:a.systemPrompt?.join("\n\n")??"",thinkingLevel:a.thinkingLevel??"off",fastModeEnabled:a.fastModeEnabled??a.fastMode??this.fastModeEnabled,fastModeActive:a.fastModeActive,todoPhases:a.todoPhases??[],extensionStatuses:Array.from(this.extensionStatuses,([a,b])=>({key:a,text:b})),extensionWidgets:Array.from(this.extensionWidgets.values())}}async refreshIdentityAfterSessionChange(){let a=this._sessionId,b=await this.proc.sendCommand({type:"get_state"});return this.applyIdentity(b),a&&a!==this._sessionId&&(this.clearPendingUiRequests(),this.emit({type:"extension_ui_pending",ids:[]}),this.discardQueue("Queued messages were discarded because the session changed."),this.onIdentityChangeCallback?.(a,this._sessionId)),(0,j.mD)(),this._sessionId}async restart(){if(this.restarting)throw new F(E,"session_restarting");let a=this._sessionFile,b=!!a&&(0,d.existsSync)(a),c=this.proc;this.restarting=!0,this.queueEpoch+=1,this.abortHoldsDispatch=!1,this.activeToolIds.clear(),this.nativeFollowUpDepth=0,this.nativeHandoffPending=0,this.nativeQueuedCount=0,this.nativeQueueStale=!1,this.nativeReconcileGeneration+=1,this.messageQueue.failSending(v),this.emitQueueSnapshot(),this.unsubscribeFrames?.();try{if(await c.dispose(),!this._alive)return;this.extensionStatuses.clear(),this.extensionWidgets.clear(),this.clearPendingUiRequests(),this.promptRunning=!1,this.bashRunning=!1,this.streaming=!1,this.compacting=!1;let d=new h.X({cwd:this.cwd,extraArgs:M(b?a:""),onExit:({stderrTail:a})=>{this.proc===d&&this.handleProcessExit(a)}});this.proc=d,this.unsubscribeFrames=d.onFrame(a=>this.handleFrame(a));try{let a=await d.waitReady(12e4);await d.negotiateProtocol(a),await d.sendCommand({type:"set_subagent_subscription",level:"events"}).catch(()=>{});let b=await d.sendCommand({type:"get_state"});this.applyIdentity(b)}catch(a){throw this.unsubscribeFrames?.(),this.unsubscribeFrames=null,d.dispose(),this.destroy(),a}}finally{this.restarting=!1}Z(),this.scheduleQueueDispatch()}async send(a){if(this.restarting)throw new F(E,"session_restarting");if(!this.isAlive())throw Error("Session is no longer running");this.resetIdleTimer();let b=a.type;if("prompt"===b||"steer"===b||"follow_up"===b){let b=(0,f.kc)(a.images);if(b)throw Error(b)}let c=I[b];if(c)throw new h.x(b,c,"unsupported");if("string"==typeof b&&w.has(b))return this.handleQueueCommand(a);switch(b){case"prompt":{if(this.bashRunning)throw Error("Cannot send a prompt while a shell command is running");let b=a.streamingBehavior;b||(this.abortHoldsDispatch=!1,this.promptRunning=!0,Z());try{let c=await this.forwardNativeHandoff({type:"prompt",message:a.message,...N(a.images)?{images:N(a.images)}:{},...b?{streamingBehavior:b}:{}},"followUp"===b);c?.agentInvoked===!1&&(b||(this.promptRunning=!1,this.emit({type:"prompt_result",agentInvoked:!1}),Z()),this.scheduleQueueDispatch())}catch(a){throw this.promptRunning=!1,Z(),a}return null}case"steer":case"follow_up":return await this.forwardNativeHandoff({type:b,message:a.message,...N(a.images)?{images:N(a.images)}:{}},"follow_up"===b),null;case"abort":return this.abortHoldsDispatch=!0,await this.withFinalRunningNotification(async()=>{await this.proc.sendCommand({type:"abort"}),this.promptRunning=!1}),null;case"get_state":{let a=await this.proc.sendCommand({type:"get_state"});return this.buildWebState(a)}case"set_model":{let{provider:b,modelId:c}=a,d=await this.proc.sendCommand({type:"set_model",provider:b,modelId:c});return(0,g.kn)(),(0,j.mD)(),{id:d.id,provider:d.provider}}case"set_fast_mode":{let b=!0===a.enabled,c=await this.proc.sendCommand({type:"set_fast_mode",enabled:b});return this.fastModeEnabled=c?.enabled??b,{enabled:this.fastModeEnabled,active:c?.active??!1}}case"fork":if(this.bashRunning)throw Error("Cannot fork while a shell command is running");if(this.queueEpoch+=1,this.messageQueue.failSending(v),this.emitQueueSnapshot(),(await this.proc.sendCommand({type:"branch",entryId:a.entryId})).cancelled)return{cancelled:!0};return{cancelled:!1,newSessionId:await this.refreshIdentityAfterSessionChange()};case"new_session":case"switch_session":{this.queueEpoch+=1,this.messageQueue.failSending(v),this.emitQueueSnapshot();let b=await this.proc.sendCommand(a);if(!b.cancelled)return{cancelled:!1,newSessionId:await this.refreshIdentityAfterSessionChange()};return b}case"compact":try{return await this.withFinalRunningNotification(async()=>{this.compacting=!0,Z();try{let b=await this.proc.sendCommand({type:"compact",...a.customInstructions?{customInstructions:a.customInstructions}:{}});return Q(b),b}finally{this.compacting=!1}})}finally{(0,j.mD)(),this.scheduleQueueDispatch()}case"abort_compaction":return this.abortHoldsDispatch=!0,await this.withFinalRunningNotification(()=>this.proc.sendCommand({type:"abort"})),null;case"set_session_name":{let b=a.name?.trim();if(!b)throw Error("Session name cannot be empty");return await this.proc.sendCommand({type:"set_session_name",name:b}),this._sessionName=b,(0,j.mD)(),null}case"get_session_stats":return{...await this.proc.sendCommand({type:"get_session_stats"}),sessionName:this._sessionName};case"get_last_assistant_text":return{text:(await this.proc.sendCommand({type:"get_last_assistant_text"})).text??""};case"get_commands":return await this.proc.sendCommand({type:"get_available_commands"});case"reload":return await this.restart(),{success:!0};case"extension_ui_response":{let b,c=a.id,d="string"==typeof c?this.pendingUiRequests.get(c):void 0;if(!d||"string"!=typeof c)throw new F("This dialog is no longer pending in this session","dialog_not_pending");if("number"==typeof d.expiresAt&&d.expiresAt<=Date.now())throw this.forgetPendingUiRequest(c),this.emit({type:"extension_ui_request",method:"cancel",id:`expired:${c}`,targetId:c}),new F("This dialog has expired","dialog_not_pending");if(!0===a.cancelled)b={cancelled:!0,...!0===a.timedOut?{timedOut:!0}:{}};else if("confirm"===d.method||"open_url"===d.method){if("boolean"!=typeof a.confirmed)throw new F("A boolean confirmation is required","invalid_dialog_response");b={confirmed:a.confirmed}}else{if("string"!=typeof a.value||a.value.length>3145728)throw new F("A dialog value of at most 3Mi characters is required","invalid_dialog_response");if("select"===d.method&&(!Array.isArray(d.options)||!d.options.includes(a.value)))throw new F("Select one of the offered options","invalid_dialog_response");b={value:a.value}}return this.proc.sendFrame({type:"extension_ui_response",id:c,...b}),this.forgetPendingUiRequest(c),this.emit({type:"extension_ui_request",method:"cancel",id:`answered:${c}`,targetId:c}),null}case"bash":if(!0===a.excludeFromContext)throw new F("omp cannot run a shell command with its output excluded from the model context (`!!`): the RPC bash command has no exclusion option, so the output would silently enter the context anyway. Run it with a single `!` to share the output with the model, or use a terminal outside ompgui.","bash_exclude_unsupported");if(this.isRunning())throw Error("Cannot run a shell command while the session is busy");this.bashRunning=!0,Z();try{return await this.proc.sendCommand({type:"bash",command:a.command})}finally{this.bashRunning=!1,(0,j.mD)(),Z(),this.scheduleQueueDispatch()}case"set_host_tools":{let b=(Array.isArray(a.tools)?a.tools:[]).filter(a=>"string"==typeof a.name&&a.name);return this.hostToolNames=new Set(b.map(a=>a.name)),await this.proc.sendCommand({type:"set_host_tools",tools:b}),null}case"host_tool_result":return"string"==typeof a.id&&this.pendingHostTools.delete(a.id),await this.proc.sendCommand(a),null;case"set_host_uri_schemes":{let b=Array.isArray(a.schemes)?a.schemes:[];for(let a of(this.hostUriSchemes=new Map,b))"string"==typeof a.scheme&&a.scheme&&this.hostUriSchemes.set(a.scheme,{writable:!0===a.writable});return await this.proc.sendCommand({type:"set_host_uri_schemes",schemes:b}),null}case"host_uri_result":return"string"==typeof a.id&&this.pendingHostUris.delete(a.id),await this.proc.sendCommand(a),null;default:if(H.has(b)){let c=await this.proc.sendCommand(a);return"set_thinking_level"===b&&(0,j.mD)(),c??null}throw Error(`Unsupported command: ${b}`)}}handleQueueCommand(a){try{let b=a.type;switch(b){case m:if(!y(a.lane))throw new x("lane must be steer or followUp",u);if("string"!=typeof a.message)throw new x("message is required",u);return this.messageQueue.enqueue({lane:a.lane,text:a.message,images:a.images}),this.abortHoldsDispatch=!1,this.emitQueueSnapshot(),this.finishQueueCommand();case p:if("string"!=typeof a.id)throw new x("id is required",u);return this.messageQueue.promote(a.id,this.requireExpectedRevision(a)),this.abortHoldsDispatch=!1,this.emitQueueSnapshot(),this.finishQueueCommand();case n:{if("string"!=typeof a.id)throw new x("id is required",u);let b=a.__relayRecallMaxBytes;if(void 0!==b&&"number"!=typeof b)throw new x("Invalid recall response capacity",u);let{item:c}=this.messageQueue.recall(a.id,this.requireExpectedRevision(a),b);this.emitQueueSnapshot();let d=A(this.queueSnapshotForClient(),c);return this.scheduleQueueDispatch(),Promise.resolve(d)}case o:if("string"!=typeof a.id)throw new x("id is required",u);return this.messageQueue.delete(a.id,this.requireExpectedRevision(a)),this.emitQueueSnapshot(),this.finishQueueCommand();case q:return Promise.resolve(A(this.queueSnapshotForClient()));default:throw Error(`Unsupported command: ${b}`)}}catch(a){if(a instanceof x)throw new F(a.message,a.code);throw a}}requireExpectedRevision(a){if("number"!=typeof a.expectedRevision)throw new x("Queue revision is stale; reload the queue and retry",r);return a.expectedRevision}async finishQueueCommand(){return await this.drainQueueDispatch(),A(this.queueSnapshotForClient())}queueSnapshotForClient(){return{...this.messageQueue.getSnapshot(),nativeQueuedCount:this.nativeQueuedCount}}emitQueueSnapshot(){this.emit(z(this.queueSnapshotForClient()))}beginNativeQueueReconcile(){this.nativeQueueStale=!0,this.nativeReconcileGeneration+=1;let a=this.nativeReconcileGeneration,b=this.queueEpoch,c=this.proc;this.refreshNativeQueuedCount(a,b,c)}async refreshNativeQueuedCount(a,b,c){try{let d=await c.sendCommand({type:"get_state"});if(!this.nativeReconcileStillValid(a,b,c))return;this.nativeQueuedCount=d.queuedMessageCount??0,this.nativeQueueStale=!1}catch{if(!this.nativeReconcileStillValid(a,b,c))return;this.nativeQueuedCount=0,this.nativeQueueStale=!1}this.scheduleQueueDispatch()}nativeReconcileStillValid(a,b,c){return this._alive&&this.queueEpoch===b&&this.proc===c&&this.nativeReconcileGeneration===a}discardQueue(a){this.queueEpoch+=1;let b=this.messageQueue.getSnapshot().items.length>0;this.messageQueue.reset(),this.emitQueueSnapshot(),b&&this.emit({type:"notice",level:"warning",message:a})}scheduleQueueDispatch(){this.drainQueueDispatch()}async drainQueueDispatch(){if(this.queueDispatching){this.queueDispatchAgain=!0;return}this.queueDispatching=!0;try{do this.queueDispatchAgain=!1,await this.dispatchNextQueueItem();while(this.queueDispatchAgain)}catch{}finally{this.queueDispatching=!1,this.queueDispatchAgain&&this.scheduleQueueDispatch()}}canDispatchSteer(){return this.isAlive()&&!this.restarting&&this.streaming&&!this.compacting&&!this.bashRunning&&0===this.activeToolIds.size&&0===this.pendingHostTools.size&&0===this.nativeHandoffPending}canDispatchFollowUp(){return this.isAlive()&&!this.restarting&&!this.abortHoldsDispatch&&!this.promptRunning&&!this.streaming&&!this.compacting&&!this.bashRunning&&0===this.activeToolIds.size&&0===this.pendingHostTools.size&&0===this.nativeFollowUpDepth&&0===this.nativeHandoffPending&&!this.nativeQueueStale&&0===this.nativeQueuedCount}canDispatchIdlePrompt(){return this.canDispatchFollowUp()}async dispatchNextQueueItem(){for(;this.isAlive()&&!this.restarting;){if(this.messageQueue.hasSending())return;let a=this.messageQueue.selectDispatchCandidate("steer");if(a){if(this.canDispatchSteer()){await this.forwardQueueItem(a,"steer");continue}if(this.canDispatchIdlePrompt()){await this.forwardQueueItem(a);continue}return}let b=this.messageQueue.selectDispatchCandidate("followUp");if(b&&this.canDispatchFollowUp()){await this.forwardQueueItem(b);continue}return}}async forwardQueueItem(a,b){let c=this.queueEpoch,d=this.proc,e=this._sessionId,f=this.messageQueue.getImages(a.id);this.messageQueue.markSending(a.id),this.emitQueueSnapshot(),b||(this.promptRunning=!0,Z());try{let g=await d.sendCommand({type:"prompt",message:a.text,...f?{images:f}:{},...b?{streamingBehavior:b}:{}},3e4);if(!this.queueForwardStillValid(c,d,e,a.id))return;this.messageQueue.remove(a.id),this.emitQueueSnapshot(),g?.agentInvoked!==!1||b||(this.promptRunning=!1,this.emit({type:"prompt_result",agentInvoked:!1}),Z())}catch(g){if(b||(this.promptRunning=!1),!this.queueForwardStillValid(c,d,e,a.id))return;let f=g instanceof Error&&/timed out/i.test(g.message)?v:`${v} ${g instanceof Error?g.message:String(g)}`;this.messageQueue.markFailed(a.id,f),this.emitQueueSnapshot(),this.emit({type:"notice",level:"warning",message:f}),Z()}}queueForwardStillValid(a,b,c,d){return!!this._alive&&this.queueEpoch===a&&this.proc===b&&(!c||this._sessionId===c)&&this.messageQueue.getSnapshot().items.some(a=>a.id===d&&"sending"===a.status)}async forwardNativeHandoff(a,b){this.nativeHandoffPending+=1,b&&(this.nativeFollowUpDepth+=1);try{var c;let d=await this.proc.sendCommand(a);return b&&(c=d)&&"object"==typeof c&&!1===c.agentInvoked&&(this.nativeFollowUpDepth=Math.max(0,this.nativeFollowUpDepth-1)),d}catch(a){throw b&&(this.nativeFollowUpDepth=Math.max(0,this.nativeFollowUpDepth-1)),a}finally{this.nativeHandoffPending=Math.max(0,this.nativeHandoffPending-1),this.scheduleQueueDispatch()}}destroy(){this.destroyAndWait()}async destroyAndWait(){if(this.destroyPromise)return this.destroyPromise;if(!this._alive)return;this._alive=!1,this.queueEpoch+=1,this.abortHoldsDispatch=!0,this.discardQueue("Queued messages were discarded because the session shut down."),this.idleTimer&&clearTimeout(this.idleTimer),this.sessionFileSignalTimer&&(clearTimeout(this.sessionFileSignalTimer),this.sessionFileSignalTimer=null),this.unsubscribeFrames?.(),this.clearPendingUiRequests(),this.mcpListWaiter&&(clearTimeout(this.mcpListWaiter.timer),this.mcpListWaiter.reject(Error("Session was closed while loading MCP servers")),this.mcpListWaiter=null);let a=this.proc.dispose().catch(()=>{}).then(()=>{for(let[a,b]of S())b===this&&S().delete(a)});for(let b of(this.destroyPromise=a,this.pendingHostTools.clear(),this.hostToolNames.clear(),this.pendingHostUris.clear(),this.hostUriSchemes.clear(),this.destroyListeners.splice(0)))try{b()}catch{}Z(),await a}}function S(){if(!globalThis.__ompSessions){globalThis.__ompSessions=new Map;let a=()=>globalThis.__ompSessions?.forEach(a=>a.destroy());process.once("exit",a),process.once("SIGINT",a),process.once("SIGTERM",a)}return globalThis.__ompSessions}function T(a){return S().get(a)}function U(){let a=new Set;for(let[b,c]of S())c.isRunning()&&a.add(c.sessionId||b);return[...a]}async function V(){let a=[...new Set(S().values())];return await Promise.all(a.map(a=>a.destroyAndWait())),a.length}function W(){return globalThis.__ompRunningListeners||(globalThis.__ompRunningListeners=new Set),globalThis.__ompRunningListeners}function X(a){let b=W();return b.add(a),()=>{b.delete(a)}}let Y="";function Z({refreshSessionList:a=!1}={}){let b=U(),c=JSON.stringify([...b].sort());if(c===Y&&!a)return;Y=c;let d={ids:b,refreshSessionList:a};for(let a of W())try{a(d)}catch{}}async function $(a,b,c,d,e=!1,f){let g=S(),i=(globalThis.__ompStartLocks||(globalThis.__ompStartLocks=new Map),globalThis.__ompStartLocks),j=g.get(a);for(;j&&!j.isAlive()&&j.destroyPromise;)await j.destroyPromise,j=g.get(a);if(j?.isAlive())return{session:j,realSessionId:a};let k=i.get(a);if(k)return k;let l=(async()=>{let a={},i=new R(new h.X({cwd:c,extraArgs:M(b,d,e),onExit:({stderrTail:b})=>a.wrapper?.handleProcessExit(b)}),c,f);a.wrapper=i,i.start();try{await i.waitUntilReady()}catch(a){throw await i.destroyAndWait(),a}let j=i.sessionId;return i.onIdentityChange((a,b)=>{g.get(a)===i&&g.delete(a),g.set(b,i)}),g.set(j,i),{session:i,realSessionId:j}})().finally(()=>i.delete(a));return i.set(a,l),l}}};
@@ -0,0 +1,11 @@
1
+ "use strict";exports.id=8573,exports.ids=[8573],exports.modules={57050:(a,b,c)=>{c.d(b,{D$:()=>f,bA:()=>g,tw:()=>e});var d=c(20565);function e(a){if(!(0,d.u4)(a))return;let b=(0,d.u4)(a.cost)?a.cost:void 0;if(!b)return;let c=(0,d.i)(b.total);if(void 0!==c)return c;let e=(0,d.i)(b.input),f=(0,d.i)(b.output);if(void 0!==e&&void 0!==f)return e+f}function f(a,b){if(!(0,d.u4)(a))return;let c=(0,d.i)(a.attempt),e=(0,d.oJ)(a.errorMessage);if(void 0!==c&&void 0!==e)return{attempt:c,errorMessage:b?b(e):e}}function g(a,b){if(!(0,d.u4)(a))return;let c={};for(let e of["source","mode","status","error"]){let f=(0,d.oJ)(a[e]);void 0!==f&&(c[e]=b?b(f):f)}return Object.keys(c).length>0?c:void 0}},74244:(a,b,c)=>{c.d(b,{z:()=>e});var d=c(58864);function e(a,b=process.platform){return(0,d.w)(a,b)}},78573:(a,b,c)=>{c.d(b,{Uv:()=>H,O8:()=>w,HA:()=>N,cr:()=>C,DK:()=>D,td:()=>E,mD:()=>q,BR:()=>x,dQ:()=>o,eP:()=>y,UB:()=>v,u1:()=>u,os:()=>t});var d=c(55511),e=c(29021),f=c(33873);c(85887);var g=c(63945),h=c(78970),i=c(20565),j=c(57050),k=c(45902),l=c(24923),m=c(74244);async function n(){let a=await (0,g.L1)(),b=new Map,c=new Set;for(let d of a)b.set((0,k.$)(d.path),d.id),c.add(d.id);let d=[...new Set(a.map(a=>a.cwd).filter(Boolean))],e=new Map;for(let a=0;a<d.length;a+=6){let b=d.slice(a,a+6);await Promise.all(b.map(async a=>{e.set(a,await (0,l.KI)(a))}))}return a.map(a=>{var d;let f;w(a.id,a.path);let g=a.cwd?e.get(a.cwd):void 0;return{path:a.path,id:a.id,cwd:a.cwd,name:a.title,created:a.created instanceof Date&&!Number.isNaN(a.created.getTime())?a.created.toISOString():a.modified.toISOString(),modified:a.modified.toISOString(),messageCount:a.messageCount,firstMessage:a.firstMessage||"(no messages)",parentSessionId:a.parentSessionPath?(d=a.parentSessionPath,(f=b.get((0,k.$)(d)))||(c.has(d)?d:void 0)):void 0,projectRoot:g?.projectRoot??a.cwd,projectKey:(0,m.z)(g?.projectRoot??a.cwd),...g?.isWorktree&&g.branch?{worktreeBranch:g.branch}:{}}})}async function o(){let a=globalThis.__piSessionListGeneration??0;if(globalThis.__piSessionListCache&&Date.now()-globalThis.__piSessionListCache.ts<p)return globalThis.__piSessionListCache.data;if(globalThis.__piSessionListPromise&&globalThis.__piSessionListPromiseGeneration===a)return globalThis.__piSessionListPromise;let b=n().then(b=>((globalThis.__piSessionListGeneration??0)===a&&(globalThis.__piSessionListCache={data:b,ts:Date.now()}),b)).finally(()=>{globalThis.__piSessionListPromise===b&&(globalThis.__piSessionListPromise=void 0,globalThis.__piSessionListPromiseGeneration=void 0)});return globalThis.__piSessionListPromise=b,globalThis.__piSessionListPromiseGeneration=a,b}let p=3e4;function q(){globalThis.__piSessionListGeneration=(globalThis.__piSessionListGeneration??0)+1,globalThis.__piSessionListCache=void 0,(0,g.I3)(),globalThis.__ompSessionDocumentCache?.clear()}function r(){return globalThis.__piSessionPathCache||(globalThis.__piSessionPathCache=new Map),globalThis.__piSessionPathCache}function s(){return globalThis.__piPathToSessionIdCache||(globalThis.__piPathToSessionIdCache=new Map),globalThis.__piPathToSessionIdCache}async function t(a){let b=r().get(a);if(b){if((0,e.existsSync)(b))return b;x(a),q()}await o();let c=r().get(a);return c?(0,e.existsSync)(c)?c:(x(a),null):null}async function u(a){let b=(0,k.$)(a),c=s().get(b);return c||(await o(),s().get(b))}async function v(a){if(!a)return;let b=await u(a);return b||(await t(a)?a:void 0)}function w(a,b){let c=(0,f.normalize)(b),d=(0,k.$)(c),e=r(),g=s(),h=e.get(a),i=h?(0,k.$)(h):void 0,j=g.get(d),l=j?e.get(j):void 0;i&&i!==d&&g.get(i)===a&&g.delete(i),j&&j!==a&&l&&(0,k.$)(l)===d&&e.delete(j),e.set(a,c),g.set(d,a)}function x(a){let b=r(),c=s(),d=b.get(a);b.delete(a);let e=d?(0,k.$)(d):void 0;e&&c.get(e)===a&&c.delete(e)}function y(a){return(0,g.Hb)(a)}function z(a){try{let b=(0,e.statSync)(a);return{dev:b.dev,ino:b.ino,size:b.size,mtimeMs:b.mtimeMs,ctimeMs:b.ctimeMs}}catch{return null}}function A(a,b){return a.dev===b.dev&&a.ino===b.ino&&a.size===b.size&&a.mtimeMs===b.mtimeMs&&a.ctimeMs===b.ctimeMs}function B(a){let b=[a];for(;b.length>0;){let a=b.pop();if(!(!a||Object.isFrozen(a))){for(let c of Object.values(a))"object"!=typeof c||null===c||Object.isFrozen(c)||b.push(c);Object.freeze(a)}}return a}function C(a){let b;try{b=e.realpathSync.native(a)}catch{return B((0,g.Fy)(a))}let c=z(b);if(!c)return B((0,g.Fy)(b));let d=(globalThis.__ompSessionDocumentCache||(globalThis.__ompSessionDocumentCache=new Map),globalThis.__ompSessionDocumentCache),f=d.get(b);if(f&&A(f.identity,c))return d.delete(b),d.set(b,f),f.document;let h=B((0,g.Fy)(b)),i=z(b);if(i&&A(c,i)&&i.size<=0x4000000){d.set(b,{identity:i,sourceBytes:i.size,document:h});let a=0;for(let b of d.values())a+=b.sourceBytes;for(;d.size>32||a>0x4000000;){let b=d.keys().next().value;if(void 0===b)break;let c=d.get(b);d.delete(b),a-=c?.sourceBytes??0}}return h}function D(a){return C(a).entries}function E(a,b){let c=(0,g.Ee)(a,b);if(!c||"message"!==c.type||!(0,i.u4)(c.message))return null;let e=c.message;if("toolResult"!==e.role)return null;let f="content"in e?e.content:void 0,j="details"in e?e.details:void 0,k=function(a,b){let c=new Set,e=[],f=!1,i=(a,b)=>{f=!0;let g=(0,h.Si)(a),i=null===g?null:(0,d.createHash)("sha256").update(a,"base64").digest("hex"),j=null===i?`inline:${b}\0${a}`:`image:${b}\0${i}`;c.has(j)||(c.add(j),e.push(g??(0,h.x)(a)))},j=(a,b)=>{f=!0;let d=`image:${b}\0${a}`;c.has(d)||(c.add(d),e.push((0,g.I8)(a)??0))},k=(a,b)=>{if("object"!=typeof a||null===a||Array.isArray(a)||b&&"image"!==a.type)return;let c=a.source;if("object"==typeof c&&null!==c&&!Array.isArray(c)&&"base64"===c.type&&"string"==typeof c.data){let a="string"==typeof c.media_type?c.media_type:"";if(!a.toLowerCase().startsWith("image/"))return;let b=c.data;if("string"!=typeof b)return;if((0,g.zW)(b)){let c=(0,g.G)(b);c&&j(c,a);return}i(b,a);return}if("string"==typeof a.data&&"string"==typeof a.mimeType){if(!a.mimeType.toLowerCase().startsWith("image/"))return;if((0,g.zW)(a.data)){let b=(0,g.G)(a.data);b&&j(b,a.mimeType);return}i(a.data,a.mimeType)}};try{if(Array.isArray(a))for(let b of a)k(b,!0);if("object"==typeof b&&null!==b&&!Array.isArray(b)){let a=b.images;if(Array.isArray(a))for(let b of a)k(b,!1)}}catch{}return f?e:null}(f,j);if(!k)return null;(0,h.gy)(k);let l=Array.isArray(f)?f.filter(a=>(0,i.u4)(a)&&"image"===a.type):[],m={type:"message",id:c.id,parentId:c.parentId,timestamp:c.timestamp,message:{role:"toolResult",toolCallId:"media",content:l,details:(0,i.u4)(j)&&Array.isArray(j.images)?{images:j.images}:void 0}},n=(0,g.qd)([m])[0],o=n?.type==="message"&&(0,i.u4)(n.message)?n.message:null;if(!o||"toolResult"!==o.role)return null;let p=(0,h.K8)({content:"content"in o?o.content:void 0,details:"details"in o?o.details:void 0}),q=Math.max(0,k.length-p.length);return p.length>0||q>0?{images:p,missingCount:q}:null}function F(a){if("message"!==a.type||!(0,i.u4)(a.message)||"string"!=typeof a.message.role)return null;let b=a.message;return"assistant"!==b.role||(void 0===b.provider||"string"==typeof b.provider)&&(void 0===b.model||"string"==typeof b.model)&&("string"==typeof b.content||Array.isArray(b.content))?b:null}function G(a){if(!Array.isArray(a))return null;let b=new Set(["pending","in_progress","completed","blocked","abandoned"]),c=[];for(let d of a){if(!(0,i.u4)(d)||"string"!=typeof d.name||!Array.isArray(d.tasks))return null;let a=[];for(let c of d.tasks){if(!(0,i.u4)(c)||"string"!=typeof c.content||"string"!=typeof c.status||!b.has(c.status)||void 0!==c.blocker&&"string"!=typeof c.blocker)return null;a.push({content:c.content,status:c.status,..."string"==typeof c.blocker?{blocker:c.blocker}:{}})}c.push({name:d.name,tasks:a})}return c}function H(a,b,c={}){let d,e={messages:[],entryIds:[],thinkingLevel:"off",model:null,todoPhases:[]},f=new Map;for(let b of a)f.set(b.id,b);if(null===b||(b&&(d=f.get(b)),d||(d=a[a.length-1]),!d))return e;let g=[],h=new Set,j=d;for(;j&&!h.has(j.id);)h.add(j.id),g.push(j),j=j.parentId?f.get(j.parentId):void 0;g.reverse();let k="off",l={},m=!1,n=null;for(let a of g)if("thinking_level_change"===a.type)k=a.configured??a.thinkingLevel??"off";else if("model_change"===a.type)if(a.model){let b=a.role??"default";l[b]=a.model,"default"===b&&(m=!0)}else a.provider&&a.modelId&&(l.default=`${a.provider}/${a.modelId}`,m=!0);else if("message"===a.type){let b=F(a);b?.role==="assistant"&&!m&&"string"==typeof b.provider&&b.provider.length>0&&"string"==typeof b.model&&b.model.length>0&&(l.default=`${b.provider}/${b.model}`)}else"compaction"===a.type&&(n=a);let o=[],p=[],q=a=>{var b;let d="compaction"===a.type?(b=a,{role:"custom",customType:"compaction",content:a.id===n?.id?b.summary:"[Superseded compaction summary elided after a newer compaction]",display:!0,details:{tokensBefore:b.tokensBefore,firstKeptEntryId:b.firstKeptEntryId},timestamp:I(b.timestamp)}):N(a,c);d&&(o.push(d),p.push(a.id))};if(n){let a=n;q(a);let b=g.findIndex(b=>"compaction"===b.type&&b.id===a.id),c=!1;for(let d=0;d<b;d++){let b=g[d];b.id===a.firstKeptEntryId&&(c=!0),c&&q(b)}for(let a=b+1;a<g.length;a++)q(g[a])}else for(let a of g)q(a);let r=null,s=l.default;if(s){let a=s.indexOf("/");r=a>0?{provider:s.slice(0,a),modelId:s.slice(a+1)}:{provider:"",modelId:s}}return{messages:o,entryIds:p,thinkingLevel:k,model:r,todoPhases:function(a,b){if(null===b||0===a.length)return[];let c=new Map(a.map(a=>[a.id,a])),d=b?c.get(b):a[a.length-1],e=new Set;for(;d&&!e.has(d.id);){let a=d;if(e.add(a.id),d=a.parentId?c.get(a.parentId):void 0,"custom"===a.type&&"user_todo_edit"===a.customType){let b=(0,i.u4)(a.data)?G(a.data.phases):null;if(b)return b}let b=F(a);if(b?.role==="toolResult"){if("todo"!==b.toolName||b.isError)continue;let a=(0,i.u4)(b.details)?G(b.details.phases):null;if(a)return a}}return[]}(a,b)}}function I(a){let b=Date.parse(a);return Number.isNaN(b)?void 0:b}function J(a){return a.length<=240?a:`${[...a].slice(0,240).join("")}…`}let K=["index","id","agent","agentSource","status","task","assignment","lastIntent","toolCount","requests","tokens","contextTokens","contextWindow","cost","durationMs","modelRole","resolvedModel","resolvedModelIsFallback","retryFailure"],L=["index","id","agent","agentSource","status","task","assignment","exitCode","truncated","structuredOutput","durationMs","tokens","requests","contextTokens","contextWindow","modelRole","resolvedModel","resolvedModelIsFallback","error","aborted","abortReason","outputPath","patchPath","branchName","retryFailure"];function M(a,b=!1){if("toolResult"!==a.role||void 0===a.details)return a;let{details:c,...d}=a;if((0,i.u4)(c)){let d=b?(0,h.K8)({content:[],details:c}):[],e={};if("string"==typeof c.patch&&(e.patch=c.patch),"string"==typeof c.diff&&(e.diff=c.diff),"task"===a.toolName){let a=function(a){let b={},c=Array.isArray(a.results)?a.results:[],d=Array.isArray(a.progress)?a.progress:[];if(0===c.length&&0===d.length&&!(0,i.u4)(a.async))return null;if("number"==typeof a.totalDurationMs&&(b.totalDurationMs=a.totalDurationMs),(0,i.u4)(a.async)){let c=function(a){if(!(0,i.u4)(a))return;let b={};for(let c of["state","jobId","type"])"string"==typeof a[c]&&(b[c]=J(a[c]));return Object.keys(b).length>0?b:void 0}(a.async);c&&(b.async=c)}let e=(a,b)=>{if(!(0,i.u4)(a))return null;let c={};for(let d of b)void 0!==a[d]&&(c[d]=a[d]);for(let a of["task","assignment","error","abortReason","lastIntent","agent","modelRole","resolvedModel","outputPath","patchPath","branchName"])"string"==typeof c[a]&&(c[a]=J(c[a]));if("number"!=typeof c.cost){let b=(0,j.tw)(a.usage);void 0!==b&&(c.cost=b)}if(void 0!==a.retryFailure){let b=(0,j.D$)(a.retryFailure,J);b?c.retryFailure=b:delete c.retryFailure}if(void 0!==a.structuredOutput){let b=(0,j.bA)(a.structuredOutput,J);b?c.structuredOutput=b:delete c.structuredOutput}return c};return d.length>0&&(b.progress=d.slice(0,50).map(a=>e(a,K)).filter(a=>null!==a)),c.length>0&&(b.results=c.slice(0,50).map(a=>e(a,L)).filter(a=>null!==a)),Object.keys(b).length>0?b:null}(c);a&&Object.assign(e,a)}let f=a;if(d.length>0&&Array.isArray(a.content)&&(f=function(a,b){if(!Array.isArray(a.content))return a;let c=new Set;for(let b of a.content){if(!(0,i.u4)(b)||"image"!==b.type)continue;let a=(0,h.K8)({content:[b],details:{}})[0];a&&"string"==typeof a.data&&"string"==typeof a.mimeType&&c.add(`${a.mimeType}\0${a.data}`)}let d=b.filter(a=>{if("string"!=typeof a.data||"string"!=typeof a.mimeType)return!1;let b=`${a.mimeType}\0${a.data}`;return!c.has(b)&&(c.add(b),!0)});return 0===d.length?a:{...a,content:[...a.content,...d]}}(a,d)),Object.keys(e).length>0)return{...f,details:e};let{details:g,...k}=f;return k}return d}function N(a,b){switch(a.type){case"message":{let c=F(a);if(!c)return null;if("developer"===c.role)return{role:"custom",customType:"developer",content:c.content,display:!0,timestamp:c.timestamp};if("pythonExecution"===c.role){let a=c.output?`
2
+ \`\`\`
3
+ ${c.output}
4
+ \`\`\``:"\n(no output)",b=c.cancelled?"\n(execution cancelled)":c.exitCode?`
5
+ Execution failed with code ${c.exitCode}`:"";return{role:"custom",customType:"python-execution",content:`Ran Python:
6
+ \`\`\`python
7
+ ${c.code}
8
+ \`\`\`${a}${b}`,display:!0,timestamp:c.timestamp}}if("fileMention"===c.role){let a=Array.isArray(c.files)?c.files.filter(a=>!!a&&"object"==typeof a&&"string"==typeof a.path):[];return{role:"custom",customType:"file-mention",content:`Attached file${1===a.length?"":"s"}:
9
+ ${a.map(a=>`- ${a.path}`).join("\n")}`,display:!0,timestamp:c.timestamp}}if("toolResult"===c.role){let d=!0===b.deferToolResultImages,e=(0,i.u4)(c.details)?c.details:void 0,f=(0,h.K8)({content:c.content,details:e}).length;if(d){let b=M(function(a){if("toolResult"!==a.role||!Array.isArray(a.content))return a;let b=0,c=0,d=new Set,e=a.content.filter(a=>{let e=function(a){let b,c;if(!(0,i.u4)(a)||"image"!==a.type||("string"==typeof a.data?(b=a.data,c="string"==typeof a.mimeType?a.mimeType:void 0):(0,i.u4)(a.source)&&"base64"===a.source.type&&"string"==typeof a.source.data&&(b=a.source.data,c="string"==typeof a.source.media_type?a.source.media_type:void 0),!b))return null;let d=b.endsWith("==")?2:+!!b.endsWith("=");return{bytes:Math.max(0,Math.floor(3*b.length/4)-d),mime:c}}(a);return!e||(b+=1,c+=e.bytes,e.mime&&d.add(e.mime),!1)});if(0===b)return a;let f=d.size>0?`: ${[...d].join(", ")}`:"";return e.push({type:"text",text:`[${b} tool result image${1===b?"":"s"} omitted from initial history payload${f}, ~${c} bytes]`}),{...a,content:e}}(c));return f>0&&"toolResult"===b.role?{...b,deferredImages:{entryId:a.id,count:f}}:b}return M(c,!0)}let d=M(function(a){if("assistant"!==a.role)return a;let b=a.content;if("string"==typeof b)return{...a,content:[{type:"text",text:b}]};if(!Array.isArray(b))return a;let c=b.map(a=>((0,i.u4)(a)&&"toolCall"===a.type?{type:"toolCall",toolCallId:"string"==typeof a.toolCallId?a.toolCallId:"string"==typeof a.id?a.id:"",toolName:"string"==typeof a.toolName?a.toolName:"string"==typeof a.name?a.name:"",input:"object"!=typeof a.input||null===a.input||Array.isArray(a.input)?"object"!=typeof a.arguments||null===a.arguments||Array.isArray(a.arguments)?{}:a.arguments:a.input}:null)??a);return{...a,content:c}}(c));if(!b.deferThinking||"assistant"!==d.role||!Array.isArray(d.content))return d;return{...d,content:d.content.map(a=>"thinking"===a.type&&"string"==typeof a.thinking&&""!==a.thinking.trim()?{...a,thinking:"",deferred:!0}:a)}}case"branch_summary":if(!a.summary)return null;return{role:"user",content:`*The conversation briefly explored another branch and returned with this summary:*
10
+
11
+ ${a.summary}`,timestamp:I(a.timestamp)};case"custom_message":return{role:"custom",customType:a.customType,content:a.content,display:a.display,details:a.details,timestamp:I(a.timestamp)};default:return null}}},78970:(a,b,c)=>{function d(a){if(!a||a.length%4!=0)return null;let b=a.endsWith("==")?2:+!!a.endsWith("="),c=a.length-b;for(let b=0;b<c;b+=1){var d;if(!((d=a.charCodeAt(b))>=65&&d<=90||d>=97&&d<=122||d>=48&&d<=57||43===d||47===d))return null}for(let b=c;b<a.length;b+=1)if("="!==a[b])return null;return a.length/4*3-b}function e(a){if(void 0===a)return null;if(!Array.isArray(a))return"images must be an array";if(a.length>10)return"A message can include at most 10 images";for(let b of a){if(!b||"object"!=typeof b||"image"!==b.type)return"Each attachment must be an image";if(!function(a){if(!a||"object"!=typeof a||"string"!=typeof a.data||"string"!=typeof a.mimeType||!a.mimeType.startsWith("image/"))return!1;let b=d(a.data);return null!==b&&b<=0xa00000}(b))return"Each image must be valid base64 image data of 10MB or smaller"}return null}function f(a){if("object"!=typeof a||null===a||Array.isArray(a))return null;let b=a.source;if("object"==typeof b&&null!==b&&!Array.isArray(b)&&"base64"===b.type&&"string"==typeof b.data){let a="string"==typeof b.media_type?b.media_type:"";return a.toLowerCase().startsWith("image/")?{type:"image",data:b.data,mimeType:a}:null}return"string"==typeof a.data&&"string"==typeof a.mimeType?a.mimeType.toLowerCase().startsWith("image/")?{type:"image",data:a.data,mimeType:a.mimeType}:null:null}c.d(b,{K8:()=>j,Si:()=>d,gy:()=>i,kc:()=>e,x:()=>h,zJ:()=>g});class g extends Error{constructor(a){super("count"===a?"Tool result images exceed the limit of 10 images":"per_image"===a?"Tool result image exceeds the per-image limit of 10MB":"Tool result images exceed the total limit of 25MB"),this.code="tool_result_images_too_large",this.name="ToolResultImagesTooLargeError",this.reason=a}}function h(a){return d(a)??Math.floor(3*a.length/4)}function i(a){if(a.length>10)throw new g("count");for(let b of a)if(b>0xa00000)throw new g("per_image");let b=0;for(let c of a)b+=c;if(b>0x1900000)throw new g("total")}function j(a){let b=new Set,c=[],d=a=>{if(!a||"string"!=typeof a.data||"string"!=typeof a.mimeType)return;let d=`${a.mimeType}\0${a.data}`;b.has(d)||(b.add(d),c.push(a))};try{if(a&&"object"==typeof a&&Array.isArray(a.content))for(let b of a.content)"object"!=typeof b||null===b||Array.isArray(b)||"image"===b.type&&d(f(b));let b=a&&"object"==typeof a?a.details:void 0;if("object"==typeof b&&null!==b&&!Array.isArray(b)){let a=b.images;if(Array.isArray(a))for(let b of a)d(f(b))}}catch{}return c}}};
@@ -1,2 +1,2 @@
1
1
  exports.id=9145,exports.ids=[9145],exports.modules={20565:(a,b,c)=>{"use strict";function d(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function e(a){return"string"==typeof a?a:void 0}function f(a){return"number"==typeof a&&Number.isFinite(a)?a:void 0}c.d(b,{i:()=>f,oJ:()=>e,u4:()=>d})},49621:(a,b,c)=>{"use strict";c.d(b,{f4:()=>i,xR:()=>q,mx:()=>t,Rm:()=>r,AY:()=>s});var d=c(77598),e=c(73024),f=c(76760),g=c(85887),h=c(20565);c(78970);let i=6e5;function j(a,b=16){return`${a}${(0,d.randomBytes)(b).toString("base64url")}`}function k(){return(0,f.resolve)((0,g.$M)(),"ompgui-relay.json")}function l(){return{version:1,serverId:j("s_"),devices:[],pairing:null}}function m(a){let b=k(),c=`${b}.lock`;(0,e.mkdirSync)((0,f.dirname)(c),{recursive:!0});let d=Date.now()+3e3;for(;;){let b=null;try{b=(0,e.openSync)(c,"wx")}catch(a){if("EEXIST"!==a.code)throw a;try{if(Date.now()-(0,e.statSync)(c).mtimeMs>1e4){(0,e.unlinkSync)(c);continue}}catch{continue}if(Date.now()>=d)throw Error("Timed out waiting for the ompgui relay device registry lock");!function(){let a=new SharedArrayBuffer(4);Atomics.wait(new Int32Array(a),0,0,25)}();continue}try{(0,e.writeSync)(b,String(process.pid))}finally{(0,e.closeSync)(b)}try{return a()}finally{try{(0,e.unlinkSync)(c)}catch{}}}}function n(){let a=k();if(!(0,e.existsSync)(a)){let a=l();return o(a),a}try{return function(a){try{let b=JSON.parse(a);if(!(0,h.u4)(b)||1!==b.version)return l();let c="string"==typeof b.serverId&&/^[A-Za-z0-9_-]{16,64}$/.test(b.serverId)?b.serverId:j("s_"),d=[];if(Array.isArray(b.devices))for(let a of b.devices)(0,h.u4)(a)&&"string"==typeof a.id&&a.id.startsWith("d_")&&"string"==typeof a.tokenHash&&64===a.tokenHash.length&&d.push({id:a.id,label:(("string"==typeof a.label?a.label:"")??"").replace(/[\u0000-\u001f\u007f]/g,"").trim().slice(0,64),tokenHash:a.tokenHash,createdAt:"string"==typeof a.createdAt?a.createdAt:new Date(0).toISOString(),lastSeenAt:"string"==typeof a.lastSeenAt?a.lastSeenAt:new Date(0).toISOString()});let e=null;if((0,h.u4)(b.pairing)){let a="string"==typeof b.pairing.secretHash?b.pairing.secretHash:"",c="number"==typeof b.pairing.expiresAt?b.pairing.expiresAt:0,d="string"==typeof b.pairing.relayUrl?b.pairing.relayUrl:"",f="string"==typeof b.pairing.createdAt?b.pairing.createdAt:new Date(0).toISOString();64===a.length&&c>0&&d&&(e={secretHash:a,expiresAt:c,relayUrl:d,createdAt:f})}let f="string"==typeof b.relayUrl?b.relayUrl:void 0;return{version:1,serverId:c,...f?{relayUrl:f}:{},devices:d,pairing:e}}catch{return l()}}((0,e.readFileSync)(a,"utf8"))}catch{return l()}}function o(a){let b=k();(0,e.mkdirSync)((0,f.dirname)(b),{recursive:!0});let c=`${b}.tmp-${process.pid}-${Date.now()}`;try{(0,e.writeFileSync)(c,`${JSON.stringify(a,null,2)}
2
- `,"utf8"),(0,e.renameSync)(c,b)}catch(a){try{(0,e.existsSync)(c)&&(0,e.unlinkSync)(c)}catch{}throw a}}function p(){return m(()=>n())}function q(a){let b=a.now??Date.now(),c=a.ttlMs??i,e=(0,d.randomBytes)(32).toString("base64url");return m(()=>{let f=n();return f.relayUrl=a.relayUrl,f.pairing={secretHash:(0,d.createHash)("sha256").update(e,"utf8").digest("hex"),expiresAt:b+c,relayUrl:a.relayUrl,createdAt:new Date(b).toISOString()},o(f),{secret:e,serverId:f.serverId,expiresAt:f.pairing.expiresAt,relayUrl:a.relayUrl}})}function r(){return p().devices.map(({id:a,label:b,createdAt:c,lastSeenAt:d})=>({id:a,label:b,createdAt:c,lastSeenAt:d}))}function s(a){return m(()=>{let b=n(),c=b.devices.filter(b=>b.id!==a);return c.length!==b.devices.length&&(b.devices=c,o(b),!0)})}function t(a=Date.now()){let b=p(),c=b.pairing&&b.pairing.expiresAt>a?b.pairing:null;return{serverId:b.serverId,...b.relayUrl?{relayUrl:b.relayUrl}:{},pairingExpiresAt:c?.expiresAt??null,deviceCount:b.devices.length}}},78335:()=>{},78970:(a,b,c)=>{"use strict";function d(a){if(!a||a.length%4!=0)return null;let b=a.endsWith("==")?2:+!!a.endsWith("="),c=a.length-b;for(let b=0;b<c;b+=1){var d;if(!((d=a.charCodeAt(b))>=65&&d<=90||d>=97&&d<=122||d>=48&&d<=57||43===d||47===d))return null}for(let b=c;b<a.length;b+=1)if("="!==a[b])return null;return a.length/4*3-b}function e(a){if(void 0===a)return null;if(!Array.isArray(a))return"images must be an array";if(a.length>10)return"A message can include at most 10 images";for(let b of a){if(!b||"object"!=typeof b||"image"!==b.type)return"Each attachment must be an image";if(!function(a){if(!a||"object"!=typeof a||"string"!=typeof a.data||"string"!=typeof a.mimeType||!a.mimeType.startsWith("image/"))return!1;let b=d(a.data);return null!==b&&b<=0xa00000}(b))return"Each image must be valid base64 image data of 10MB or smaller"}return null}function f(a){if("object"!=typeof a||null===a||Array.isArray(a))return null;let b=a.source;if("object"==typeof b&&null!==b&&!Array.isArray(b)&&"base64"===b.type&&"string"==typeof b.data){let a="string"==typeof b.media_type?b.media_type:"";return a.toLowerCase().startsWith("image/")?{type:"image",data:b.data,mimeType:a}:null}return"string"==typeof a.data&&"string"==typeof a.mimeType?a.mimeType.toLowerCase().startsWith("image/")?{type:"image",data:a.data,mimeType:a.mimeType}:null:null}c.d(b,{K8:()=>j,Si:()=>d,gy:()=>i,kc:()=>e,x:()=>h,zJ:()=>g});class g extends Error{constructor(a){super("count"===a?"Tool result images exceed the limit of 10 images":"per_image"===a?"Tool result image exceeds the per-image limit of 10MB":"Tool result images exceed the total limit of 25MB"),this.code="tool_result_images_too_large",this.name="ToolResultImagesTooLargeError",this.reason=a}}function h(a){return d(a)??Math.floor(3*a.length/4)}function i(a){if(a.length>10)throw new g("count");for(let b of a)if(b>0xa00000)throw new g("per_image");let b=0;for(let c of a)b+=c;if(b>0x1900000)throw new g("total")}function j(a){let b=new Set,c=[],d=a=>{if(!a||"string"!=typeof a.data||"string"!=typeof a.mimeType)return;let d=`${a.mimeType}\0${a.data}`;b.has(d)||(b.add(d),c.push(a))};try{if(a&&"object"==typeof a&&Array.isArray(a.content))for(let b of a.content)"object"!=typeof b||null===b||Array.isArray(b)||"image"===b.type&&d(f(b));let b=a&&"object"==typeof a?a.details:void 0;if("object"==typeof b&&null!==b&&!Array.isArray(b)){let a=b.images;if(Array.isArray(a))for(let b of a)d(f(b))}}catch{}return c}},85887:(a,b,c)=>{"use strict";c.d(b,{$M:()=>l,OK:()=>r,_8:()=>u,ny:()=>o,pA:()=>q,tE:()=>n,yG:()=>p});var d=c(29021),e=c(21820),f=c(33873);let g=/^[a-z0-9][a-z0-9._-]{0,63}$/,h=/^(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:\..*)?$/i;function i(a){let b=a?.trim();if(b&&"default"!==b){if("."===b||".."===b||b.endsWith(".")||!g.test(b)||h.test(b))throw Error(`Invalid OMP profile "${a}". Profile names must match ${g.source}, cannot be "." or "..", cannot end with ".", and cannot be a Windows reserved device name (CON, PRN, AUX, NUL, COM0-9, LPT0-9, or any of those with an extension).`);return b}}function j(){return void 0!==process.env.OMP_PROFILE?i(process.env.OMP_PROFILE):i(process.env.PI_PROFILE)}function k(){let a=f.join((0,e.homedir)(),process.env.PI_CONFIG_DIR||".omp"),b=j();return b?f.join(a,"profiles",b):a}function l(){let a=j(),b=process.env.PI_CODING_AGENT_DIR;return b&&!a?f.resolve(b):f.join(k(),"agent")}function m(a){let b=function(){let a,b;if("linux"!==process.platform&&"darwin"!==process.platform||(a=j(),(b=process.env.PI_CODING_AGENT_DIR)&&!a&&f.resolve(b)!==f.join(k(),"agent")))return;let c=process.env.XDG_DATA_HOME;if(c)try{let a=f.join(c,"omp"),b=j();if(b){let c=f.join(a,"profiles",b);return(0,d.existsSync)(c)?c:void 0}return(0,d.existsSync)(a)?a:void 0}catch{return}}();return f.join(b??l(),a)}function n(){return m("sessions")}function o(){return f.join(f.dirname(n()),"archive","sessions")}function p(){return m("blobs")}function q(){let a=l(),b=f.join(a,"config.yml");if((0,d.existsSync)(b))return b;let c=f.join(a,"config.yaml");return(0,d.existsSync)(c)?c:b}function r(){let a=l(),b=f.join(a,"models.yml");if((0,d.existsSync)(b))return b;let c=f.join(a,"models.yaml");return(0,d.existsSync)(c)?c:b}function s(a){try{return d.realpathSync.native(a)}catch{return a}}function t(a,b){let c=b.replace(/[/\\:]/g,"-");return c?a.endsWith("-")?`${a}${c}`:`${a}-${c}`:a}function u(a){let b,c=s(f.resolve(a)),d=s((0,e.homedir)()),g=s((0,e.tmpdir)()),h=f.relative(d,c),i=f.relative(g,c);return""!==h&&(h.startsWith("..")||f.isAbsolute(h))?""!==i&&(i.startsWith("..")||f.isAbsolute(i))?(b=f.resolve(c),`--${b.replace(/^[/\\]/,"").replace(/[/\\:]/g,"-")}--`):t("-tmp",i):t("-",h)}},96487:()=>{}};
2
+ `,"utf8"),(0,e.renameSync)(c,b)}catch(a){try{(0,e.existsSync)(c)&&(0,e.unlinkSync)(c)}catch{}throw a}}function p(){return m(()=>n())}function q(a){let b=a.now??Date.now(),c=a.ttlMs??i,e=(0,d.randomBytes)(32).toString("base64url");return m(()=>{let f=n();return f.relayUrl=a.relayUrl,f.pairing={secretHash:(0,d.createHash)("sha256").update(e,"utf8").digest("hex"),expiresAt:b+c,relayUrl:a.relayUrl,createdAt:new Date(b).toISOString()},o(f),{secret:e,serverId:f.serverId,expiresAt:f.pairing.expiresAt,relayUrl:a.relayUrl}})}function r(){return p().devices.map(({id:a,label:b,createdAt:c,lastSeenAt:d})=>({id:a,label:b,createdAt:c,lastSeenAt:d}))}function s(a){return m(()=>{let b=n(),c=b.devices.filter(b=>b.id!==a);return c.length!==b.devices.length&&(b.devices=c,o(b),!0)})}function t(a=Date.now()){let b=p(),c=b.pairing&&b.pairing.expiresAt>a?b.pairing:null;return{serverId:b.serverId,...b.relayUrl?{relayUrl:b.relayUrl}:{},pairingExpiresAt:c?.expiresAt??null,deviceCount:b.devices.length}}},78335:()=>{},78970:(a,b,c)=>{"use strict";function d(a){if(!a||a.length%4!=0)return null;let b=a.endsWith("==")?2:+!!a.endsWith("="),c=a.length-b;for(let b=0;b<c;b+=1){var d;if(!((d=a.charCodeAt(b))>=65&&d<=90||d>=97&&d<=122||d>=48&&d<=57||43===d||47===d))return null}for(let b=c;b<a.length;b+=1)if("="!==a[b])return null;return a.length/4*3-b}function e(a){if(void 0===a)return null;if(!Array.isArray(a))return"images must be an array";if(a.length>10)return"A message can include at most 10 images";for(let b of a){if(!b||"object"!=typeof b||"image"!==b.type)return"Each attachment must be an image";if(!function(a){if(!a||"object"!=typeof a||"string"!=typeof a.data||"string"!=typeof a.mimeType||!a.mimeType.startsWith("image/"))return!1;let b=d(a.data);return null!==b&&b<=0xa00000}(b))return"Each image must be valid base64 image data of 10MB or smaller"}return null}function f(a){if("object"!=typeof a||null===a||Array.isArray(a))return null;let b=a.source;if("object"==typeof b&&null!==b&&!Array.isArray(b)&&"base64"===b.type&&"string"==typeof b.data){let a="string"==typeof b.media_type?b.media_type:"";return a.toLowerCase().startsWith("image/")?{type:"image",data:b.data,mimeType:a}:null}return"string"==typeof a.data&&"string"==typeof a.mimeType?a.mimeType.toLowerCase().startsWith("image/")?{type:"image",data:a.data,mimeType:a.mimeType}:null:null}c.d(b,{K8:()=>j,Si:()=>d,gy:()=>i,kc:()=>e,x:()=>h,zJ:()=>g});class g extends Error{constructor(a){super("count"===a?"Tool result images exceed the limit of 10 images":"per_image"===a?"Tool result image exceeds the per-image limit of 10MB":"Tool result images exceed the total limit of 25MB"),this.code="tool_result_images_too_large",this.name="ToolResultImagesTooLargeError",this.reason=a}}function h(a){return d(a)??Math.floor(3*a.length/4)}function i(a){if(a.length>10)throw new g("count");for(let b of a)if(b>0xa00000)throw new g("per_image");let b=0;for(let c of a)b+=c;if(b>0x1900000)throw new g("total")}function j(a){let b=new Set,c=[],d=a=>{if(!a||"string"!=typeof a.data||"string"!=typeof a.mimeType)return;let d=`${a.mimeType}\0${a.data}`;b.has(d)||(b.add(d),c.push(a))};try{if(a&&"object"==typeof a&&Array.isArray(a.content))for(let b of a.content)"object"!=typeof b||null===b||Array.isArray(b)||"image"===b.type&&d(f(b));let b=a&&"object"==typeof a?a.details:void 0;if("object"==typeof b&&null!==b&&!Array.isArray(b)){let a=b.images;if(Array.isArray(a))for(let b of a)d(f(b))}}catch{}return c}},85887:(a,b,c)=>{"use strict";c.d(b,{$M:()=>l,OK:()=>r,_8:()=>u,ny:()=>o,oy:()=>j,pA:()=>q,tE:()=>n,yG:()=>p});var d=c(29021),e=c(21820),f=c(33873);let g=/^[a-z0-9][a-z0-9._-]{0,63}$/,h=/^(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:\..*)?$/i;function i(a){let b=a?.trim();if(b&&"default"!==b){if("."===b||".."===b||b.endsWith(".")||!g.test(b)||h.test(b))throw Error(`Invalid OMP profile "${a}". Profile names must match ${g.source}, cannot be "." or "..", cannot end with ".", and cannot be a Windows reserved device name (CON, PRN, AUX, NUL, COM0-9, LPT0-9, or any of those with an extension).`);return b}}function j(){return void 0!==process.env.OMP_PROFILE?i(process.env.OMP_PROFILE):i(process.env.PI_PROFILE)}function k(){let a=f.join((0,e.homedir)(),process.env.PI_CONFIG_DIR||".omp"),b=j();return b?f.join(a,"profiles",b):a}function l(){let a=j(),b=process.env.PI_CODING_AGENT_DIR;return b&&!a?f.resolve(b):f.join(k(),"agent")}function m(a){let b=function(){let a,b;if("linux"!==process.platform&&"darwin"!==process.platform||(a=j(),(b=process.env.PI_CODING_AGENT_DIR)&&!a&&f.resolve(b)!==f.join(k(),"agent")))return;let c=process.env.XDG_DATA_HOME;if(c)try{let a=f.join(c,"omp"),b=j();if(b){let c=f.join(a,"profiles",b);return(0,d.existsSync)(c)?c:void 0}return(0,d.existsSync)(a)?a:void 0}catch{return}}();return f.join(b??l(),a)}function n(){return m("sessions")}function o(){return f.join(f.dirname(n()),"archive","sessions")}function p(){return m("blobs")}function q(){let a=l(),b=f.join(a,"config.yml");if((0,d.existsSync)(b))return b;let c=f.join(a,"config.yaml");return(0,d.existsSync)(c)?c:b}function r(){let a=l(),b=f.join(a,"models.yml");if((0,d.existsSync)(b))return b;let c=f.join(a,"models.yaml");return(0,d.existsSync)(c)?c:b}function s(a){try{return d.realpathSync.native(a)}catch{return a}}function t(a,b){let c=b.replace(/[/\\:]/g,"-");return c?a.endsWith("-")?`${a}${c}`:`${a}-${c}`:a}function u(a){let b,c=s(f.resolve(a)),d=s((0,e.homedir)()),g=s((0,e.tmpdir)()),h=f.relative(d,c),i=f.relative(g,c);return""!==h&&(h.startsWith("..")||f.isAbsolute(h))?""!==i&&(i.startsWith("..")||f.isAbsolute(i))?(b=f.resolve(c),`--${b.replace(/^[/\\]/,"").replace(/[/\\:]/g,"-")}--`):t("-tmp",i):t("-",h)}},96487:()=>{}};