@ashx-j/lunr-dev 0.2.16-dev.9.1 → 0.2.19-dev.10.1

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 (255) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/README.md +7 -1
  3. package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
  4. package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
  5. package/dist/builtin-extensions/ashxj-thinking.js +44 -19
  6. package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
  7. package/dist/builtin-extensions/index.d.ts.map +1 -1
  8. package/dist/builtin-extensions/index.js +1 -0
  9. package/dist/builtin-extensions/index.js.map +1 -1
  10. package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
  11. package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
  12. package/dist/builtin-extensions/lunr-computer-use.js +157 -0
  13. package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
  14. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-lsp-extension/src/index.js +10 -3
  16. package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
  17. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +5 -1
  18. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -1
  19. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +26 -4
  20. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -1
  21. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  22. package/dist/builtin-extensions/pi-mcp-adapter/index.js +37 -27
  23. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  24. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
  25. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
  26. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
  27. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
  28. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  29. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +52 -23
  30. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  31. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  32. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +6 -2
  33. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  34. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
  35. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  36. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
  37. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  38. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts +10 -0
  39. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
  40. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
  41. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
  42. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  43. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +3 -16
  44. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  45. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
  47. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
  48. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
  49. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +1 -0
  50. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  51. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +70 -30
  52. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  53. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  54. package/dist/builtin-extensions/pi-web-access/index.js +103 -102
  55. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  56. package/dist/core/agent-session-services.d.ts.map +1 -1
  57. package/dist/core/agent-session-services.js +1 -1
  58. package/dist/core/agent-session-services.js.map +1 -1
  59. package/dist/core/computer-use/adapter.d.ts +23 -0
  60. package/dist/core/computer-use/adapter.d.ts.map +1 -0
  61. package/dist/core/computer-use/adapter.js +116 -0
  62. package/dist/core/computer-use/adapter.js.map +1 -0
  63. package/dist/core/computer-use/lease.d.ts +18 -0
  64. package/dist/core/computer-use/lease.d.ts.map +1 -0
  65. package/dist/core/computer-use/lease.js +129 -0
  66. package/dist/core/computer-use/lease.js.map +1 -0
  67. package/dist/core/computer-use/macos-runtime.d.ts +14 -0
  68. package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
  69. package/dist/core/computer-use/macos-runtime.js +148 -0
  70. package/dist/core/computer-use/macos-runtime.js.map +1 -0
  71. package/dist/core/computer-use/policy.d.ts +19 -0
  72. package/dist/core/computer-use/policy.d.ts.map +1 -0
  73. package/dist/core/computer-use/policy.js +66 -0
  74. package/dist/core/computer-use/policy.js.map +1 -0
  75. package/dist/core/computer-use/release.generated.d.ts +31 -0
  76. package/dist/core/computer-use/release.generated.d.ts.map +1 -0
  77. package/dist/core/computer-use/release.generated.js +36 -0
  78. package/dist/core/computer-use/release.generated.js.map +1 -0
  79. package/dist/core/computer-use/runtime.d.ts +13 -0
  80. package/dist/core/computer-use/runtime.d.ts.map +1 -0
  81. package/dist/core/computer-use/runtime.js +158 -0
  82. package/dist/core/computer-use/runtime.js.map +1 -0
  83. package/dist/core/computer-use/schemas.d.ts +88 -0
  84. package/dist/core/computer-use/schemas.d.ts.map +1 -0
  85. package/dist/core/computer-use/schemas.js +80 -0
  86. package/dist/core/computer-use/schemas.js.map +1 -0
  87. package/dist/core/computer-use/windows-desktop.d.ts +3 -0
  88. package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
  89. package/dist/core/computer-use/windows-desktop.js +48 -0
  90. package/dist/core/computer-use/windows-desktop.js.map +1 -0
  91. package/dist/core/computer-use/workflow.d.ts +24 -0
  92. package/dist/core/computer-use/workflow.d.ts.map +1 -0
  93. package/dist/core/computer-use/workflow.js +330 -0
  94. package/dist/core/computer-use/workflow.js.map +1 -0
  95. package/dist/core/keybindings.d.ts +2 -2
  96. package/dist/core/keybindings.d.ts.map +1 -1
  97. package/dist/core/keybindings.js +2 -2
  98. package/dist/core/keybindings.js.map +1 -1
  99. package/dist/core/model-runtime.d.ts +0 -3
  100. package/dist/core/model-runtime.d.ts.map +1 -1
  101. package/dist/core/model-runtime.js +1 -10
  102. package/dist/core/model-runtime.js.map +1 -1
  103. package/dist/core/package-manager.d.ts.map +1 -1
  104. package/dist/core/package-manager.js +1 -1
  105. package/dist/core/package-manager.js.map +1 -1
  106. package/dist/core/permissions.d.ts +1 -1
  107. package/dist/core/permissions.d.ts.map +1 -1
  108. package/dist/core/permissions.js +23 -7
  109. package/dist/core/permissions.js.map +1 -1
  110. package/dist/core/plan-mode.d.ts.map +1 -1
  111. package/dist/core/plan-mode.js +9 -0
  112. package/dist/core/plan-mode.js.map +1 -1
  113. package/dist/core/rollback.d.ts.map +1 -1
  114. package/dist/core/rollback.js +13 -90
  115. package/dist/core/rollback.js.map +1 -1
  116. package/dist/core/session-manager.d.ts +0 -1
  117. package/dist/core/session-manager.d.ts.map +1 -1
  118. package/dist/core/session-manager.js +21 -79
  119. package/dist/core/session-manager.js.map +1 -1
  120. package/dist/core/settings-manager.d.ts +6 -0
  121. package/dist/core/settings-manager.d.ts.map +1 -1
  122. package/dist/core/settings-manager.js +19 -0
  123. package/dist/core/settings-manager.js.map +1 -1
  124. package/dist/dev-cli.js +0 -0
  125. package/dist/gateway/agent-bridge.d.ts +6 -1
  126. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  127. package/dist/gateway/agent-bridge.js +23 -6
  128. package/dist/gateway/agent-bridge.js.map +1 -1
  129. package/dist/gateway/cron.d.ts +1 -1
  130. package/dist/gateway/cron.d.ts.map +1 -1
  131. package/dist/gateway/cron.js +23 -7
  132. package/dist/gateway/cron.js.map +1 -1
  133. package/dist/modes/interactive/components/footer.d.ts +4 -2
  134. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  135. package/dist/modes/interactive/components/footer.js +23 -32
  136. package/dist/modes/interactive/components/footer.js.map +1 -1
  137. package/dist/modes/interactive/components/processes-selector.d.ts +2 -3
  138. package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -1
  139. package/dist/modes/interactive/components/processes-selector.js +5 -10
  140. package/dist/modes/interactive/components/processes-selector.js.map +1 -1
  141. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  142. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  143. package/dist/modes/interactive/components/settings-selector.js +20 -0
  144. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  145. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  146. package/dist/modes/interactive/interactive-mode.js +18 -8
  147. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  148. package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
  149. package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
  150. package/dist/modes/interactive/thinking-level-slash.js +23 -0
  151. package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
  152. package/dist/node-runtime/adapter-AZMY335J.js +279 -0
  153. package/dist/node-runtime/{agent-session-services-IFJMSX7Z.js → agent-session-services-RSGP5GDN.js} +15 -12
  154. package/dist/node-runtime/{builtin-extensions-LYZ3BFWQ.js → builtin-extensions-7STLFW3A.js} +4 -3
  155. package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -0
  156. package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-4SJWFTUP.js} +1 -1
  157. package/dist/node-runtime/{chunk-AJX357CL.js → chunk-5NWQCSKR.js} +20 -1013
  158. package/dist/node-runtime/chunk-5OLJGVCB.js +68 -0
  159. package/dist/node-runtime/chunk-5Q45AVQG.js +108 -0
  160. package/dist/node-runtime/{chunk-TQNSPERU.js → chunk-5SQDLSZJ.js} +1 -1
  161. package/dist/node-runtime/{chunk-F4VQFJI2.js → chunk-6SPPH4FY.js} +4 -4
  162. package/dist/node-runtime/{chunk-PBC2Y6GS.js → chunk-6UB6NKA3.js} +29 -72
  163. package/dist/node-runtime/{chunk-A2KQXUJD.js → chunk-7AFOFSDY.js} +1 -1
  164. package/dist/node-runtime/chunk-BKAZ6BKX.js +2185 -0
  165. package/dist/node-runtime/{chunk-AHSTJBIB.js → chunk-EH2LJQPM.js} +4 -4
  166. package/dist/node-runtime/{chunk-N77MY65L.js → chunk-FLYMHKCS.js} +25 -25
  167. package/dist/node-runtime/{chunk-5P7PZMRU.js → chunk-HRS4HMDX.js} +1 -1
  168. package/dist/node-runtime/{chunk-IPA627GP.js → chunk-ISQDQIZN.js} +4 -4
  169. package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-J7QGQD45.js} +1 -1
  170. package/dist/node-runtime/{chunk-WOVTOV5P.js → chunk-JT6YCS5B.js} +29 -34
  171. package/dist/node-runtime/chunk-JZHEUQRL.js +180 -0
  172. package/dist/node-runtime/{chunk-ZKMFUD3Q.js → chunk-K72NVGUB.js} +3 -3
  173. package/dist/node-runtime/{chunk-ECD5L7YI.js → chunk-LCACDWHJ.js} +389 -15
  174. package/dist/node-runtime/{chunk-2QKLKMKC.js → chunk-LTXUQJI4.js} +1 -1
  175. package/dist/node-runtime/{chunk-MKKH27PH.js → chunk-LWJXTA6Z.js} +274 -2416
  176. package/dist/node-runtime/{chunk-EDBJNRSM.js → chunk-MGSB2C3M.js} +1 -1
  177. package/dist/node-runtime/{chunk-CDFZEWPU.js → chunk-MUMMMTW4.js} +6 -2
  178. package/dist/node-runtime/{chunk-YF63P5ZT.js → chunk-OTT6JMPU.js} +10 -67
  179. package/dist/node-runtime/{chunk-PGAJ5MO5.js → chunk-T5GM5BFH.js} +1 -1
  180. package/dist/node-runtime/{chunk-PCGNAY2O.js → chunk-TAP7QTUT.js} +38 -16
  181. package/dist/node-runtime/{chunk-4TLO4PO2.js → chunk-U6C7VTR5.js} +7 -1401
  182. package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
  183. package/dist/node-runtime/{chunk-QH42CDX3.js → chunk-W7S2REEG.js} +111 -84
  184. package/dist/node-runtime/{chunk-LZAW4ZX3.js → chunk-ZRDIMBEQ.js} +27 -9
  185. package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-ZSEZY3II.js} +5 -100
  186. package/dist/node-runtime/cli-runtime.js +1 -1
  187. package/dist/node-runtime/{command-L3LAHDIH.js → command-6UXQ6XZN.js} +1 -1
  188. package/dist/node-runtime/{commands-RL5YBW5I.js → commands-LGR5VT5X.js} +6 -4
  189. package/dist/node-runtime/{direct-tool-executor-JVDXTO7A.js → direct-tool-executor-TDJS7TBD.js} +9 -6
  190. package/dist/node-runtime/{export-html-KR26FOUZ.js → export-html-E4DT6ZJQ.js} +1 -1
  191. package/dist/node-runtime/{extract-XLQSJN4V.js → extract-IUCVZCWC.js} +2 -2
  192. package/dist/node-runtime/{gateway-X2TI5X7F.js → gateway-3OLC4GQN.js} +22 -367
  193. package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-NCIDF7NE.js} +1 -1
  194. package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-OKIN7AIP.js} +2 -2
  195. package/dist/node-runtime/image-resize-6ZPBFMWW.js +11 -0
  196. package/dist/node-runtime/index.js +53 -49
  197. package/dist/node-runtime/{init-NJV2T55N.js → init-EKE277AG.js} +6 -4
  198. package/dist/node-runtime/{interactive-mode-KOM35YF2.js → interactive-mode-S5M26CQ7.js} +20 -17
  199. package/dist/node-runtime/{interactive-view-U6OILKF3.js → interactive-view-N6F4KUIT.js} +3 -5
  200. package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +206 -0
  201. package/dist/node-runtime/{lunr-cron-YJ5UHYRD.js → lunr-cron-KKBOGAEF.js} +7 -1
  202. package/dist/node-runtime/main.js +24 -21
  203. package/dist/node-runtime/{mcp-auth-flow-QIXHW6QN.js → mcp-auth-flow-YL6RWPYG.js} +2 -1
  204. package/dist/node-runtime/{package-manager-cli-TZZHJCVI.js → package-manager-cli-C4EJOO5Q.js} +8 -6
  205. package/dist/node-runtime/{pi-mcp-adapter-QFB37AVN.js → pi-mcp-adapter-DPTJGAAL.js} +33 -27
  206. package/dist/node-runtime/{pi-subagents-7XJ4H53P.js → pi-subagents-VKCLYIBY.js} +103 -76
  207. package/dist/node-runtime/{pi-web-access-DPGAVKOA.js → pi-web-access-BV6DSZOP.js} +72 -69
  208. package/dist/node-runtime/{proxy-modes-HEEFK4KC.js → proxy-modes-R64LU6WZ.js} +12 -9
  209. package/dist/node-runtime/rpc-entry.js +24 -21
  210. package/dist/node-runtime/runtime-3SB5ATHQ.js +21 -0
  211. package/dist/node-runtime/{runtime-bridges-PPHNBFWL.js → runtime-bridges-UJ5WJJLN.js} +3 -3
  212. package/dist/node-runtime/{session-manager-MQNBYACL.js → session-manager-QEMZBMTM.js} +3 -5
  213. package/dist/node-runtime/{session-selector-5AZLJS6U.js → session-selector-URVJLOTK.js} +2 -2
  214. package/dist/node-runtime/{settings-manager-5LF2VQWC.js → settings-manager-K6IPIQTI.js} +3 -1
  215. package/dist/node-runtime/{src-Y7JSCK64.js → src-GPFAU3N6.js} +30 -10
  216. package/dist/node-runtime/{subagent-executor-5RNDEPIJ.js → subagent-executor-EFLTO32A.js} +39 -21
  217. package/dist/node-runtime/{update-cli-A253SZ7P.js → update-cli-I6OVDRPL.js} +3 -1
  218. package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-ETA5RA7U.js} +2 -2
  219. package/dist/node-runtime/workflow-SA34S4VX.js +325 -0
  220. package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-SRVGNN26.js} +2 -2
  221. package/dist/rpc.d.ts +3 -0
  222. package/dist/rpc.d.ts.map +1 -0
  223. package/dist/rpc.js +18 -0
  224. package/dist/rpc.js.map +1 -0
  225. package/dist/startup/interactive-view.d.ts.map +1 -1
  226. package/dist/startup/interactive-view.js +1 -2
  227. package/dist/startup/interactive-view.js.map +1 -1
  228. package/docs/computer-use.md +277 -0
  229. package/docs/development.md +0 -32
  230. package/docs/features.md +2 -2
  231. package/docs/interactive-startup.md +10 -3
  232. package/docs/keybindings.md +2 -2
  233. package/docs/terminal-setup.md +1 -1
  234. package/docs/usage.md +1 -1
  235. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  236. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  237. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  238. package/examples/extensions/gondolin/package-lock.json +2 -2
  239. package/examples/extensions/gondolin/package.json +1 -1
  240. package/examples/extensions/hidden-thinking-label.ts +1 -1
  241. package/examples/extensions/sandbox/package-lock.json +2 -2
  242. package/examples/extensions/sandbox/package.json +1 -1
  243. package/examples/extensions/with-deps/package-lock.json +2 -2
  244. package/examples/extensions/with-deps/package.json +1 -1
  245. package/install-lock/package-lock.json +3827 -0
  246. package/install-lock/package.json +18 -0
  247. package/native/computer-use/LICENSE.md +21 -0
  248. package/npm-shrinkwrap.json +3808 -0
  249. package/package.json +16 -10
  250. package/dist/startup/interactive-shell.d.ts +0 -55
  251. package/dist/startup/interactive-shell.d.ts.map +0 -1
  252. package/dist/startup/interactive-shell.js +0 -264
  253. package/dist/startup/interactive-shell.js.map +0 -1
  254. package/dist/node-runtime/{chunk-YSKSB3BJ.js → chunk-CH6OL6P2.js} +2 -2
  255. package/dist/node-runtime/{chunk-VSELYKWU.js → chunk-EHMBW7FA.js} +3 -3
@@ -0,0 +1,68 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+
3
+ // packages/coding-agent/dist/core/computer-use/policy.js
4
+ var settingsListeners = /* @__PURE__ */ new Set();
5
+ function computerSettingsChanged(settings) {
6
+ for (let listener of settingsListeners)
7
+ listener(settings);
8
+ }
9
+ function onComputerSettingsChanged(listener) {
10
+ return settingsListeners.add(listener), () => {
11
+ settingsListeners.delete(listener);
12
+ };
13
+ }
14
+ var COMPUTER_TOOLS = [
15
+ "computer_load",
16
+ "computer_apps",
17
+ "computer_observe",
18
+ "computer_click",
19
+ "computer_drag",
20
+ "computer_key",
21
+ "computer_text",
22
+ "computer_window",
23
+ "computer_launch",
24
+ "computer_scroll",
25
+ "computer_end"
26
+ ];
27
+ function computerPolicy(name, input) {
28
+ if (name.startsWith("computer_"))
29
+ switch (name) {
30
+ case "computer_load":
31
+ case "computer_apps":
32
+ case "computer_observe":
33
+ case "computer_end":
34
+ return { observation: !0, foreground: !1 };
35
+ case "computer_click":
36
+ case "computer_drag":
37
+ case "computer_key":
38
+ case "computer_text":
39
+ case "computer_scroll":
40
+ return { observation: !1, foreground: input.foreground === !0 || input.desktop === !0 };
41
+ case "computer_window":
42
+ case "computer_launch":
43
+ return { observation: !1, foreground: !0 };
44
+ default:
45
+ throw new Error(`Unknown computer operation: ${name}`);
46
+ }
47
+ }
48
+ function computerRefusal(name, input, policy) {
49
+ let operation = computerPolicy(name, input);
50
+ if (!operation)
51
+ return "Unknown computer operation.";
52
+ if (policy.child)
53
+ return "Computer tools are available only to main agents.";
54
+ if (!policy.enabled)
55
+ return "Computer use is disabled in settings.";
56
+ if (operation.foreground && !policy.foreground)
57
+ return "Foreground control is disabled. Use background operations.";
58
+ if (!policy.vision && (name !== "computer_window" && (input.x !== void 0 || input.y !== void 0) || name === "computer_drag" || input.screenshot === !0 || input.desktop === !0))
59
+ return "This model cannot receive images. Use accessibility elements or select an image-capable model.";
60
+ }
61
+
62
+ export {
63
+ computerSettingsChanged,
64
+ onComputerSettingsChanged,
65
+ COMPUTER_TOOLS,
66
+ computerPolicy,
67
+ computerRefusal
68
+ };
@@ -0,0 +1,108 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ applyExifOrientation,
4
+ formatDimensionNote,
5
+ resizeImage
6
+ } from "./chunk-ZSEZY3II.js";
7
+ import {
8
+ loadPhoton
9
+ } from "./chunk-RQ2Q5IYR.js";
10
+
11
+ // packages/coding-agent/dist/utils/image-convert.js
12
+ async function convertImageBytesToPng(bytes) {
13
+ let photon = await loadPhoton();
14
+ if (!photon)
15
+ return null;
16
+ try {
17
+ let rawImage = photon.PhotonImage.new_from_byteslice(bytes), image = applyExifOrientation(photon, rawImage, bytes);
18
+ image !== rawImage && rawImage.free();
19
+ try {
20
+ return new Uint8Array(image.get_bytes());
21
+ } finally {
22
+ image.free();
23
+ }
24
+ } catch {
25
+ return null;
26
+ }
27
+ }
28
+ async function convertToPng(base64Data, mimeType) {
29
+ if (mimeType === "image/png")
30
+ return { data: base64Data, mimeType };
31
+ let bytes = new Uint8Array(Buffer.from(base64Data, "base64")), pngBytes = await convertImageBytesToPng(bytes);
32
+ return pngBytes ? {
33
+ data: Buffer.from(pngBytes).toString("base64"),
34
+ mimeType: "image/png"
35
+ } : null;
36
+ }
37
+
38
+ // packages/coding-agent/dist/utils/image-process.js
39
+ function baseMimeType(mimeType) {
40
+ return mimeType.split(";")[0]?.trim().toLowerCase() ?? mimeType.toLowerCase();
41
+ }
42
+ function normalizeSupportedImageMimeType(mimeType) {
43
+ switch (baseMimeType(mimeType)) {
44
+ case "image/png":
45
+ return "image/png";
46
+ case "image/jpeg":
47
+ case "image/jpg":
48
+ return "image/jpeg";
49
+ case "image/gif":
50
+ return "image/gif";
51
+ case "image/webp":
52
+ return "image/webp";
53
+ default:
54
+ return null;
55
+ }
56
+ }
57
+ async function normalizeImage(bytes, mimeType) {
58
+ let normalizedMimeType = normalizeSupportedImageMimeType(mimeType);
59
+ if (normalizedMimeType)
60
+ return { bytes, mimeType: normalizedMimeType };
61
+ let pngBytes = await convertImageBytesToPng(bytes);
62
+ return pngBytes ? {
63
+ bytes: pngBytes,
64
+ mimeType: "image/png",
65
+ convertedFrom: baseMimeType(mimeType)
66
+ } : null;
67
+ }
68
+ function conversionHint(from, to) {
69
+ if (!(!from || from === to))
70
+ return `[Image converted from ${from} to ${to}.]`;
71
+ }
72
+ async function processImage(bytes, mimeType, options) {
73
+ let autoResizeImages = options?.autoResizeImages ?? !0, normalized = await normalizeImage(bytes, mimeType);
74
+ if (!normalized)
75
+ return {
76
+ ok: !1,
77
+ message: "[Image omitted: could not be converted to a supported inline image format.]"
78
+ };
79
+ if (autoResizeImages) {
80
+ let resized = await resizeImage(normalized.bytes, normalized.mimeType, options?.resizeOptions);
81
+ if (!resized)
82
+ return {
83
+ ok: !1,
84
+ message: "[Image omitted: could not be resized below the inline image size limit.]"
85
+ };
86
+ let hints2 = [], convertedHint2 = conversionHint(normalized.convertedFrom, resized.mimeType);
87
+ convertedHint2 && hints2.push(convertedHint2);
88
+ let dimensionNote = formatDimensionNote(resized);
89
+ return dimensionNote && hints2.push(dimensionNote), {
90
+ ok: !0,
91
+ data: resized.data,
92
+ mimeType: resized.mimeType,
93
+ hints: hints2
94
+ };
95
+ }
96
+ let hints = [], convertedHint = conversionHint(normalized.convertedFrom, normalized.mimeType);
97
+ return convertedHint && hints.push(convertedHint), {
98
+ ok: !0,
99
+ data: Buffer.from(normalized.bytes).toString("base64"),
100
+ mimeType: normalized.mimeType,
101
+ hints
102
+ };
103
+ }
104
+
105
+ export {
106
+ convertToPng,
107
+ processImage
108
+ };
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  buildSessionContext,
7
7
  sessionEntryToContextMessages
8
- } from "./chunk-PBC2Y6GS.js";
8
+ } from "./chunk-6UB6NKA3.js";
9
9
  import {
10
10
  convertToLlm,
11
11
  createBranchSummaryMessage,
@@ -4,10 +4,7 @@ import {
4
4
  ServerError,
5
5
  logger,
6
6
  wrapError
7
- } from "./chunk-MKKH27PH.js";
8
- import {
9
- UrlElicitationRequiredError
10
- } from "./chunk-4TLO4PO2.js";
7
+ } from "./chunk-BKAZ6BKX.js";
11
8
  import {
12
9
  UI_STREAM_HOST_CONTEXT_KEY,
13
10
  UI_STREAM_REQUEST_META_KEY,
@@ -15,6 +12,9 @@ import {
15
12
  extractUiPromptText,
16
13
  getVisualizationStreamEnvelope
17
14
  } from "./chunk-ARC4KOTI.js";
15
+ import {
16
+ UrlElicitationRequiredError
17
+ } from "./chunk-2IDTZAG5.js";
18
18
 
19
19
  // packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/tool-registrar.js
20
20
  function transformMcpContent(content) {
@@ -73,12 +73,13 @@ function migrateSessionEntries(entries) {
73
73
  function parseSessionEntries(content) {
74
74
  let entries = [], lines = content.trim().split(`
75
75
  `);
76
- for (let [index, line] of lines.entries()) {
77
- if (!line.trim())
78
- continue;
79
- let entry = parseSessionEntryLine(line, `line ${index + 1}`);
80
- entry && entries.push(entry);
81
- }
76
+ for (let line of lines)
77
+ if (line.trim())
78
+ try {
79
+ let entry = JSON.parse(line);
80
+ entries.push(entry);
81
+ } catch {
82
+ }
82
83
  return entries;
83
84
  }
84
85
  function getLatestCompactionEntry(entries) {
@@ -87,40 +88,13 @@ function getLatestCompactionEntry(entries) {
87
88
  return entries[i];
88
89
  return null;
89
90
  }
90
- function validateSessionGraph(entries) {
91
+ function buildEntryIndex(entries, byId) {
92
+ if (byId)
93
+ return byId;
91
94
  let index = /* @__PURE__ */ new Map();
92
- for (let entry of entries) {
93
- if (typeof entry.id != "string" || !entry.id)
94
- throw new Error("Session graph is corrupt: every entry must have a non-empty id");
95
- if (index.has(entry.id))
96
- throw new Error(`Session graph is corrupt: duplicate entry id "${entry.id}"`);
95
+ for (let entry of entries)
97
96
  index.set(entry.id, entry);
98
- }
99
- for (let entry of entries) {
100
- if (entry.parentId === entry.id)
101
- throw new Error(`Session graph is corrupt: entry "${entry.id}" links to itself`);
102
- if (entry.parentId !== null && !index.has(entry.parentId))
103
- throw new Error(`Session graph is corrupt: entry "${entry.id}" has missing parent "${entry.parentId}"`);
104
- }
105
- let complete = /* @__PURE__ */ new Set();
106
- for (let entry of entries) {
107
- if (complete.has(entry.id))
108
- continue;
109
- let path = [], positions = /* @__PURE__ */ new Map(), current = entry;
110
- for (; current && !complete.has(current.id); ) {
111
- let position = positions.get(current.id);
112
- if (position !== void 0) {
113
- let cycle = [...path.slice(position), current.id].join(" -> ");
114
- throw new Error(`Session graph is corrupt: parent cycle detected (${cycle})`);
115
- }
116
- positions.set(current.id, path.length), path.push(current.id), current = current.parentId === null ? void 0 : index.get(current.parentId);
117
- }
118
- for (let id of path)
119
- complete.add(id);
120
- }
121
- }
122
- function buildEntryIndex(entries, byId) {
123
- return byId || (validateSessionGraph(entries), new Map(entries.map((entry) => [entry.id, entry])));
97
+ return index;
124
98
  }
125
99
  function buildSessionPath(entries, leafId, byId) {
126
100
  let index = buildEntryIndex(entries, byId), leaf;
@@ -128,14 +102,9 @@ function buildSessionPath(entries, leafId, byId) {
128
102
  return [];
129
103
  if (leafId && (leaf = index.get(leafId)), leaf ??= entries[entries.length - 1], !leaf)
130
104
  return [];
131
- let path = [], visited = /* @__PURE__ */ new Set(), current = leaf;
132
- for (; current; ) {
133
- if (visited.has(current.id))
134
- throw new Error(`Session graph is corrupt: parent cycle detected at entry "${current.id}"`);
135
- if (visited.add(current.id), path.push(current), current.parentId && !index.has(current.parentId))
136
- throw new Error(`Session graph is corrupt: entry "${current.id}" has missing parent "${current.parentId}"`);
137
- current = current.parentId ? index.get(current.parentId) : void 0;
138
- }
105
+ let path = [], current = leaf;
106
+ for (; current; )
107
+ path.push(current), current = current.parentId ? index.get(current.parentId) : void 0;
139
108
  return path.reverse(), path;
140
109
  }
141
110
  function getSessionContextSettings(path) {
@@ -182,14 +151,13 @@ function getDefaultSessionDir(cwd, agentDir = getAgentDir()) {
182
151
  return existsSync(sessionDir) || mkdirSync(sessionDir, { recursive: !0 }), sessionDir;
183
152
  }
184
153
  var SESSION_READ_BUFFER_SIZE = 1024 * 1024;
185
- function parseSessionEntryLine(line, location) {
186
- let trimmed = line.replace(/\u0000/g, "").trim();
187
- if (!trimmed)
154
+ function parseSessionEntryLine(line) {
155
+ if (!line.trim())
188
156
  return null;
189
157
  try {
190
- return JSON.parse(trimmed);
158
+ return JSON.parse(line);
191
159
  } catch {
192
- throw new Error(location ? `Malformed session line ${location}` : "Malformed session line");
160
+ return null;
193
161
  }
194
162
  }
195
163
  function loadEntriesFromFile(filePath) {
@@ -198,7 +166,7 @@ function loadEntriesFromFile(filePath) {
198
166
  return [];
199
167
  let entries = [], fd = openSync(resolvedFilePath, "r");
200
168
  try {
201
- let decoder = new StringDecoder("utf8"), buffer = Buffer.allocUnsafe(SESSION_READ_BUFFER_SIZE), pending = "", lineNumber = 0;
169
+ let decoder = new StringDecoder("utf8"), buffer = Buffer.allocUnsafe(SESSION_READ_BUFFER_SIZE), pending = "";
202
170
  for (; ; ) {
203
171
  let bytesRead = readSync(fd, buffer, 0, buffer.length, null);
204
172
  if (bytesRead === 0)
@@ -207,18 +175,15 @@ function loadEntriesFromFile(filePath) {
207
175
  let lineStart = 0, newlineIndex = pending.indexOf(`
208
176
  `, lineStart);
209
177
  for (; newlineIndex !== -1; ) {
210
- lineNumber++;
211
- let entry = parseSessionEntryLine(pending.slice(lineStart, newlineIndex), `in ${resolvedFilePath}:${lineNumber}`);
178
+ let entry = parseSessionEntryLine(pending.slice(lineStart, newlineIndex));
212
179
  entry && entries.push(entry), lineStart = newlineIndex + 1, newlineIndex = pending.indexOf(`
213
180
  `, lineStart);
214
181
  }
215
182
  pending = pending.slice(lineStart);
216
183
  }
217
- if (pending += decoder.end(), pending.trim()) {
218
- lineNumber++;
219
- let finalEntry = parseSessionEntryLine(pending, `in ${resolvedFilePath}:${lineNumber}`);
220
- finalEntry && entries.push(finalEntry);
221
- }
184
+ pending += decoder.end();
185
+ let finalEntry = parseSessionEntryLine(pending);
186
+ finalEntry && entries.push(finalEntry);
222
187
  } finally {
223
188
  closeSync(fd);
224
189
  }
@@ -381,9 +346,7 @@ var SessionManager = class _SessionManager {
381
346
  return;
382
347
  }
383
348
  let header = this.fileEntries.find((e) => e.type === "session");
384
- if (!header)
385
- throw new Error(`Session file is not a valid pi session: ${this.sessionFile}`);
386
- this.sessionId = header.id, migrateToCurrentVersion(this.fileEntries) && this._rewriteFile(), this._buildIndex(), this.flushed = !0;
349
+ this.sessionId = header?.id ?? createSessionId(), migrateToCurrentVersion(this.fileEntries) && this._rewriteFile(), this._buildIndex(), this.flushed = !0;
387
350
  } else {
388
351
  let explicitPath = this.sessionFile;
389
352
  this.newSession(), this.sessionFile = explicitPath;
@@ -406,7 +369,7 @@ var SessionManager = class _SessionManager {
406
369
  return this.sessionFile;
407
370
  }
408
371
  _buildIndex() {
409
- validateSessionGraph(this.fileEntries.filter((entry) => entry.type !== "session")), this.byId.clear(), this.labelsById.clear(), this.labelTimestampsById.clear(), this.leafId = null;
372
+ this.byId.clear(), this.labelsById.clear(), this.labelTimestampsById.clear(), this.leafId = null;
410
373
  for (let entry of this.fileEntries)
411
374
  entry.type !== "session" && (this.byId.set(entry.id, entry), this.leafId = entry.id, entry.type === "label" && (entry.label ? (this.labelsById.set(entry.targetId, entry.label), this.labelTimestampsById.set(entry.targetId, entry.timestamp)) : (this.labelsById.delete(entry.targetId), this.labelTimestampsById.delete(entry.targetId))));
412
375
  }
@@ -624,14 +587,9 @@ var SessionManager = class _SessionManager {
624
587
  * Use buildSessionContext() to get the resolved messages for the LLM.
625
588
  */
626
589
  getBranch(fromId) {
627
- let path = [], visited = /* @__PURE__ */ new Set(), startId = fromId ?? this.leafId, current = startId ? this.byId.get(startId) : void 0;
628
- for (; current; ) {
629
- if (visited.has(current.id))
630
- throw new Error(`Session graph is corrupt: parent cycle detected at entry "${current.id}"`);
631
- if (visited.add(current.id), path.push(current), current.parentId && !this.byId.has(current.parentId))
632
- throw new Error(`Session graph is corrupt: entry "${current.id}" has missing parent "${current.parentId}"`);
633
- current = current.parentId ? this.byId.get(current.parentId) : void 0;
634
- }
590
+ let path = [], startId = fromId ?? this.leafId, current = startId ? this.byId.get(startId) : void 0;
591
+ for (; current; )
592
+ path.push(current), current = current.parentId ? this.byId.get(current.parentId) : void 0;
635
593
  return path.reverse(), path;
636
594
  }
637
595
  /**
@@ -892,7 +850,6 @@ export {
892
850
  migrateSessionEntries,
893
851
  parseSessionEntries,
894
852
  getLatestCompactionEntry,
895
- validateSessionGraph,
896
853
  sessionEntryToContextMessages,
897
854
  buildContextEntries,
898
855
  buildSessionContext,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  estimateTokens
4
- } from "./chunk-TQNSPERU.js";
4
+ } from "./chunk-5SQDLSZJ.js";
5
5
 
6
6
  // packages/coding-agent/dist/core/context-breakdown.js
7
7
  var CHARS_PER_TOKEN = 4, PROJECT_CONTEXT_RE = /<project_context>[\s\S]*?<\/project_context>/, PROJECT_INSTRUCTIONS_RE = /<project_instructions(?:\s+path="([^"]*)")?>([\s\S]*?)<\/project_instructions>/g, SKILLS_BLOCK_RE = /\n\nThe following skills provide specialized instructions for specific tasks\.[\s\S]*<\/available_skills>/;