@ashx-j/lunr 0.2.25 → 0.2.27

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 (729) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/LICENSE +22 -0
  3. package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -1
  4. package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
  5. package/dist/builtin-extensions/ashxj-thinking.js +1 -1
  6. package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
  7. package/dist/builtin-extensions/ashxj-tui.d.ts +11 -1
  8. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  9. package/dist/builtin-extensions/ashxj-tui.js +6 -10
  10. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  11. package/dist/builtin-extensions/index.d.ts.map +1 -1
  12. package/dist/builtin-extensions/index.js +1 -0
  13. package/dist/builtin-extensions/index.js.map +1 -1
  14. package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
  15. package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
  16. package/dist/builtin-extensions/lunr-computer-use.js +179 -0
  17. package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
  18. package/dist/builtin-extensions/lunr-cron.d.ts +4 -5
  19. package/dist/builtin-extensions/lunr-cron.d.ts.map +1 -1
  20. package/dist/builtin-extensions/lunr-cron.js +94 -108
  21. package/dist/builtin-extensions/lunr-cron.js.map +1 -1
  22. package/dist/builtin-extensions/lunr-local-providers/local-servers.d.ts.map +1 -1
  23. package/dist/builtin-extensions/lunr-local-providers/local-servers.js +3 -1
  24. package/dist/builtin-extensions/lunr-local-providers/local-servers.js.map +1 -1
  25. package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.d.ts.map +1 -1
  26. package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.js +2 -2
  27. package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.js.map +1 -1
  28. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.d.ts.map +1 -1
  29. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js +1 -1
  30. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js.map +1 -1
  31. package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.d.ts.map +1 -1
  32. package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.js +1 -1
  33. package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.js.map +1 -1
  34. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  35. package/dist/builtin-extensions/pi-intercom/index.js +2 -2
  36. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  37. package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.d.ts +1 -1
  38. package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.d.ts.map +1 -1
  39. package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.js +1 -1
  40. package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.js.map +1 -1
  41. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
  42. package/dist/builtin-extensions/pi-lsp-extension/src/index.js +1 -15
  43. package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
  44. package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.d.ts +6 -0
  45. package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.d.ts.map +1 -1
  46. package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.js +187 -132
  47. package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.js.map +1 -1
  48. package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.d.ts +8 -0
  49. package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.d.ts.map +1 -1
  50. package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.js +142 -112
  51. package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.js.map +1 -1
  52. package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.d.ts +12 -1
  53. package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.d.ts.map +1 -1
  54. package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.js +14 -7
  55. package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.js.map +1 -1
  56. package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.d.ts +11 -3
  57. package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.d.ts.map +1 -1
  58. package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.js +67 -41
  59. package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.js.map +1 -1
  60. package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.d.ts +4 -2
  61. package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.d.ts.map +1 -1
  62. package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.js +3 -0
  63. package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.js.map +1 -1
  64. package/dist/builtin-extensions/pi-mcp-adapter/commands.d.ts +2 -1
  65. package/dist/builtin-extensions/pi-mcp-adapter/commands.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-mcp-adapter/commands.js +6 -6
  67. package/dist/builtin-extensions/pi-mcp-adapter/commands.js.map +1 -1
  68. package/dist/builtin-extensions/pi-mcp-adapter/config.d.ts +1 -1
  69. package/dist/builtin-extensions/pi-mcp-adapter/config.d.ts.map +1 -1
  70. package/dist/builtin-extensions/pi-mcp-adapter/config.js +11 -5
  71. package/dist/builtin-extensions/pi-mcp-adapter/config.js.map +1 -1
  72. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -1
  73. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +2 -2
  74. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -1
  75. package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.d.ts.map +1 -1
  76. package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.js +1 -1
  77. package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.js.map +1 -1
  78. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  79. package/dist/builtin-extensions/pi-mcp-adapter/index.js +48 -40
  80. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  81. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
  82. package/dist/builtin-extensions/pi-mcp-adapter/init.js +3 -1
  83. package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
  84. package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.d.ts +12 -40
  85. package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.d.ts.map +1 -1
  86. package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.js +166 -235
  87. package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.js.map +1 -1
  88. package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.d.ts +5 -0
  89. package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.d.ts.map +1 -1
  90. package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.js +43 -13
  91. package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.js.map +1 -1
  92. package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.d.ts +14 -3
  93. package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.d.ts.map +1 -1
  94. package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.js +73 -21
  95. package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.js.map +1 -1
  96. package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.d.ts.map +1 -1
  97. package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.js +4 -4
  98. package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.js.map +1 -1
  99. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
  100. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +2 -2
  101. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
  102. package/dist/builtin-extensions/pi-mcp-adapter/state.d.ts +2 -0
  103. package/dist/builtin-extensions/pi-mcp-adapter/state.d.ts.map +1 -1
  104. package/dist/builtin-extensions/pi-mcp-adapter/state.js.map +1 -1
  105. package/dist/builtin-extensions/pi-ollama-cloud/index.d.ts +1 -1
  106. package/dist/builtin-extensions/pi-ollama-cloud/index.d.ts.map +1 -1
  107. package/dist/builtin-extensions/pi-ollama-cloud/index.js +1 -1
  108. package/dist/builtin-extensions/pi-ollama-cloud/index.js.map +1 -1
  109. package/dist/builtin-extensions/pi-ollama-cloud/models.d.ts +11 -5
  110. package/dist/builtin-extensions/pi-ollama-cloud/models.d.ts.map +1 -1
  111. package/dist/builtin-extensions/pi-ollama-cloud/models.js +12 -32
  112. package/dist/builtin-extensions/pi-ollama-cloud/models.js.map +1 -1
  113. package/dist/builtin-extensions/pi-prompt-template-model/index.d.ts.map +1 -1
  114. package/dist/builtin-extensions/pi-prompt-template-model/index.js +5 -3
  115. package/dist/builtin-extensions/pi-prompt-template-model/index.js.map +1 -1
  116. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts +2 -1
  117. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -1
  118. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +21 -12
  119. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -1
  120. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -1
  121. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +7 -24
  122. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -1
  123. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  124. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +39 -77
  125. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  126. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  127. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +1 -1
  128. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  129. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -4
  130. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  131. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +8 -5
  132. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  133. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +1 -1
  134. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
  135. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +15 -31
  136. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -1
  137. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
  138. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +7 -2
  139. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
  140. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +1 -0
  141. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
  142. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +21 -4
  143. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
  144. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
  145. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +11 -4
  146. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
  147. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  148. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +121 -25
  149. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  150. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  151. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +25 -5
  152. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  153. package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.d.ts +1 -0
  154. package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.d.ts.map +1 -1
  155. package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.js +5 -0
  156. package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.js.map +1 -1
  157. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
  158. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
  159. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
  160. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
  161. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +1 -1
  162. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
  163. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +1 -1
  164. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
  165. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +7 -8
  166. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
  167. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js +60 -32
  168. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
  169. package/dist/builtin-extensions/pi-subagents/src/shared/utils.d.ts +1 -1
  170. package/dist/builtin-extensions/pi-subagents/src/shared/utils.d.ts.map +1 -1
  171. package/dist/builtin-extensions/pi-subagents/src/shared/utils.js +15 -5
  172. package/dist/builtin-extensions/pi-subagents/src/shared/utils.js.map +1 -1
  173. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
  174. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +4 -3
  175. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
  176. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -1
  177. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +1 -1
  178. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -1
  179. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +2 -1
  180. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  181. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +22 -11
  182. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  183. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts.map +1 -1
  184. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js +3 -3
  185. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -1
  186. package/dist/builtin-extensions/pi-tps.d.ts.map +1 -1
  187. package/dist/builtin-extensions/pi-tps.js +20 -17
  188. package/dist/builtin-extensions/pi-tps.js.map +1 -1
  189. package/dist/builtin-extensions/pi-web-access/activity.d.ts +1 -0
  190. package/dist/builtin-extensions/pi-web-access/activity.d.ts.map +1 -1
  191. package/dist/builtin-extensions/pi-web-access/activity.js +27 -5
  192. package/dist/builtin-extensions/pi-web-access/activity.js.map +1 -1
  193. package/dist/builtin-extensions/pi-web-access/bounded-body.d.ts +3 -0
  194. package/dist/builtin-extensions/pi-web-access/bounded-body.d.ts.map +1 -0
  195. package/dist/builtin-extensions/pi-web-access/bounded-body.js +43 -0
  196. package/dist/builtin-extensions/pi-web-access/bounded-body.js.map +1 -0
  197. package/dist/builtin-extensions/pi-web-access/content-page.d.ts +24 -0
  198. package/dist/builtin-extensions/pi-web-access/content-page.d.ts.map +1 -0
  199. package/dist/builtin-extensions/pi-web-access/content-page.js +57 -0
  200. package/dist/builtin-extensions/pi-web-access/content-page.js.map +1 -0
  201. package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -1
  202. package/dist/builtin-extensions/pi-web-access/extract.js +7 -2
  203. package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -1
  204. package/dist/builtin-extensions/pi-web-access/github-extract.d.ts +0 -1
  205. package/dist/builtin-extensions/pi-web-access/github-extract.d.ts.map +1 -1
  206. package/dist/builtin-extensions/pi-web-access/github-extract.js +147 -36
  207. package/dist/builtin-extensions/pi-web-access/github-extract.js.map +1 -1
  208. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  209. package/dist/builtin-extensions/pi-web-access/index.js +48 -73
  210. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  211. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts +12 -4
  212. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts.map +1 -1
  213. package/dist/builtin-extensions/pi-web-access/session-cleanup.js +35 -12
  214. package/dist/builtin-extensions/pi-web-access/session-cleanup.js.map +1 -1
  215. package/dist/builtin-extensions/pi-web-access/storage.d.ts +9 -6
  216. package/dist/builtin-extensions/pi-web-access/storage.d.ts.map +1 -1
  217. package/dist/builtin-extensions/pi-web-access/storage.js +36 -24
  218. package/dist/builtin-extensions/pi-web-access/storage.js.map +1 -1
  219. package/dist/builtin-extensions/simple-pi-memory.d.ts +1 -1
  220. package/dist/builtin-extensions/simple-pi-memory.d.ts.map +1 -1
  221. package/dist/builtin-extensions/simple-pi-memory.js +1 -1
  222. package/dist/builtin-extensions/simple-pi-memory.js.map +1 -1
  223. package/dist/cli/install-cli.d.ts.map +1 -1
  224. package/dist/cli/install-cli.js +38 -30
  225. package/dist/cli/install-cli.js.map +1 -1
  226. package/dist/core/agent-session-runtime.d.ts +13 -0
  227. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  228. package/dist/core/agent-session-runtime.js +75 -11
  229. package/dist/core/agent-session-runtime.js.map +1 -1
  230. package/dist/core/agent-session-services.d.ts +1 -0
  231. package/dist/core/agent-session-services.d.ts.map +1 -1
  232. package/dist/core/agent-session-services.js +1 -0
  233. package/dist/core/agent-session-services.js.map +1 -1
  234. package/dist/core/agent-session.d.ts +40 -6
  235. package/dist/core/agent-session.d.ts.map +1 -1
  236. package/dist/core/agent-session.js +309 -76
  237. package/dist/core/agent-session.js.map +1 -1
  238. package/dist/core/browser/runtime.d.ts +2 -0
  239. package/dist/core/browser/runtime.d.ts.map +1 -1
  240. package/dist/core/browser/runtime.js +80 -45
  241. package/dist/core/browser/runtime.js.map +1 -1
  242. package/dist/core/browser/setup.d.ts.map +1 -1
  243. package/dist/core/browser/setup.js +12 -1
  244. package/dist/core/browser/setup.js.map +1 -1
  245. package/dist/core/computer-use/adapter.d.ts +28 -0
  246. package/dist/core/computer-use/adapter.d.ts.map +1 -0
  247. package/dist/core/computer-use/adapter.js +138 -0
  248. package/dist/core/computer-use/adapter.js.map +1 -0
  249. package/dist/core/computer-use/image.d.ts +27 -0
  250. package/dist/core/computer-use/image.d.ts.map +1 -0
  251. package/dist/core/computer-use/image.js +84 -0
  252. package/dist/core/computer-use/image.js.map +1 -0
  253. package/dist/core/computer-use/lease.d.ts +18 -0
  254. package/dist/core/computer-use/lease.d.ts.map +1 -0
  255. package/dist/core/computer-use/lease.js +129 -0
  256. package/dist/core/computer-use/lease.js.map +1 -0
  257. package/dist/core/computer-use/macos-runtime.d.ts +14 -0
  258. package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
  259. package/dist/core/computer-use/macos-runtime.js +148 -0
  260. package/dist/core/computer-use/macos-runtime.js.map +1 -0
  261. package/dist/core/computer-use/policy.d.ts +19 -0
  262. package/dist/core/computer-use/policy.d.ts.map +1 -0
  263. package/dist/core/computer-use/policy.js +67 -0
  264. package/dist/core/computer-use/policy.js.map +1 -0
  265. package/dist/core/computer-use/release.generated.d.ts +31 -0
  266. package/dist/core/computer-use/release.generated.d.ts.map +1 -0
  267. package/dist/core/computer-use/release.generated.js +36 -0
  268. package/dist/core/computer-use/release.generated.js.map +1 -0
  269. package/dist/core/computer-use/runtime.d.ts +13 -0
  270. package/dist/core/computer-use/runtime.d.ts.map +1 -0
  271. package/dist/core/computer-use/runtime.js +158 -0
  272. package/dist/core/computer-use/runtime.js.map +1 -0
  273. package/dist/core/computer-use/schemas.d.ts +100 -0
  274. package/dist/core/computer-use/schemas.d.ts.map +1 -0
  275. package/dist/core/computer-use/schemas.js +96 -0
  276. package/dist/core/computer-use/schemas.js.map +1 -0
  277. package/dist/core/computer-use/windows-desktop.d.ts +3 -0
  278. package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
  279. package/dist/core/computer-use/windows-desktop.js +48 -0
  280. package/dist/core/computer-use/windows-desktop.js.map +1 -0
  281. package/dist/core/computer-use/workflow.d.ts +38 -0
  282. package/dist/core/computer-use/workflow.d.ts.map +1 -0
  283. package/dist/core/computer-use/workflow.js +900 -0
  284. package/dist/core/computer-use/workflow.js.map +1 -0
  285. package/dist/core/cron/jobs.d.ts +26 -8
  286. package/dist/core/cron/jobs.d.ts.map +1 -1
  287. package/dist/core/cron/jobs.js +357 -232
  288. package/dist/core/cron/jobs.js.map +1 -1
  289. package/dist/core/cron/origin-context.d.ts +1 -0
  290. package/dist/core/cron/origin-context.d.ts.map +1 -1
  291. package/dist/core/cron/origin-context.js.map +1 -1
  292. package/dist/core/cron/scheduler.d.ts +22 -17
  293. package/dist/core/cron/scheduler.d.ts.map +1 -1
  294. package/dist/core/cron/scheduler.js +153 -73
  295. package/dist/core/cron/scheduler.js.map +1 -1
  296. package/dist/core/extensions/index.d.ts +1 -1
  297. package/dist/core/extensions/index.d.ts.map +1 -1
  298. package/dist/core/extensions/index.js.map +1 -1
  299. package/dist/core/extensions/loader.d.ts.map +1 -1
  300. package/dist/core/extensions/loader.js +4 -0
  301. package/dist/core/extensions/loader.js.map +1 -1
  302. package/dist/core/extensions/runner.d.ts +1 -0
  303. package/dist/core/extensions/runner.d.ts.map +1 -1
  304. package/dist/core/extensions/runner.js +8 -0
  305. package/dist/core/extensions/runner.js.map +1 -1
  306. package/dist/core/extensions/types.d.ts +8 -0
  307. package/dist/core/extensions/types.d.ts.map +1 -1
  308. package/dist/core/extensions/types.js.map +1 -1
  309. package/dist/core/footer-data-provider.d.ts +4 -0
  310. package/dist/core/footer-data-provider.d.ts.map +1 -1
  311. package/dist/core/footer-data-provider.js +22 -1
  312. package/dist/core/footer-data-provider.js.map +1 -1
  313. package/dist/core/large-subagent-launch.d.ts +1 -1
  314. package/dist/core/large-subagent-launch.d.ts.map +1 -1
  315. package/dist/core/large-subagent-launch.js +7 -7
  316. package/dist/core/large-subagent-launch.js.map +1 -1
  317. package/dist/core/model-registry.d.ts +2 -0
  318. package/dist/core/model-registry.d.ts.map +1 -1
  319. package/dist/core/model-registry.js +5 -0
  320. package/dist/core/model-registry.js.map +1 -1
  321. package/dist/core/model-runtime.d.ts +4 -1
  322. package/dist/core/model-runtime.d.ts.map +1 -1
  323. package/dist/core/model-runtime.js +40 -4
  324. package/dist/core/model-runtime.js.map +1 -1
  325. package/dist/core/package-manager.d.ts.map +1 -1
  326. package/dist/core/package-manager.js.map +1 -1
  327. package/dist/core/permissions.d.ts +4 -4
  328. package/dist/core/permissions.d.ts.map +1 -1
  329. package/dist/core/permissions.js +25 -38
  330. package/dist/core/permissions.js.map +1 -1
  331. package/dist/core/plan-mode.d.ts +5 -13
  332. package/dist/core/plan-mode.d.ts.map +1 -1
  333. package/dist/core/plan-mode.js +135 -116
  334. package/dist/core/plan-mode.js.map +1 -1
  335. package/dist/core/project-trust.d.ts.map +1 -1
  336. package/dist/core/project-trust.js +1 -1
  337. package/dist/core/project-trust.js.map +1 -1
  338. package/dist/core/prompt-resource-bridge.d.ts +12 -0
  339. package/dist/core/prompt-resource-bridge.d.ts.map +1 -0
  340. package/dist/core/prompt-resource-bridge.js +9 -0
  341. package/dist/core/prompt-resource-bridge.js.map +1 -0
  342. package/dist/core/protected-targets.d.ts +6 -0
  343. package/dist/core/protected-targets.d.ts.map +1 -0
  344. package/dist/core/protected-targets.js +45 -0
  345. package/dist/core/protected-targets.js.map +1 -0
  346. package/dist/core/resource-loader.d.ts.map +1 -1
  347. package/dist/core/resource-loader.js +7 -0
  348. package/dist/core/resource-loader.js.map +1 -1
  349. package/dist/core/rollback.d.ts +19 -3
  350. package/dist/core/rollback.d.ts.map +1 -1
  351. package/dist/core/rollback.js +172 -56
  352. package/dist/core/rollback.js.map +1 -1
  353. package/dist/core/runtime-credentials.d.ts +3 -0
  354. package/dist/core/runtime-credentials.d.ts.map +1 -1
  355. package/dist/core/runtime-credentials.js +14 -1
  356. package/dist/core/runtime-credentials.js.map +1 -1
  357. package/dist/core/sdk.d.ts +3 -0
  358. package/dist/core/sdk.d.ts.map +1 -1
  359. package/dist/core/sdk.js +1 -0
  360. package/dist/core/sdk.js.map +1 -1
  361. package/dist/core/session-manager.d.ts +6 -0
  362. package/dist/core/session-manager.d.ts.map +1 -1
  363. package/dist/core/session-manager.js +95 -32
  364. package/dist/core/session-manager.js.map +1 -1
  365. package/dist/core/session-ownership.d.ts.map +1 -1
  366. package/dist/core/session-ownership.js +8 -3
  367. package/dist/core/session-ownership.js.map +1 -1
  368. package/dist/core/session-retention.d.ts.map +1 -1
  369. package/dist/core/session-retention.js +18 -7
  370. package/dist/core/session-retention.js.map +1 -1
  371. package/dist/core/session-startup-settings.d.ts +10 -0
  372. package/dist/core/session-startup-settings.d.ts.map +1 -0
  373. package/dist/core/session-startup-settings.js +70 -0
  374. package/dist/core/session-startup-settings.js.map +1 -0
  375. package/dist/core/settings-manager.d.ts +6 -0
  376. package/dist/core/settings-manager.d.ts.map +1 -1
  377. package/dist/core/settings-manager.js +19 -0
  378. package/dist/core/settings-manager.js.map +1 -1
  379. package/dist/core/subagent-event-transport.d.ts +3 -0
  380. package/dist/core/subagent-event-transport.d.ts.map +1 -0
  381. package/dist/core/subagent-event-transport.js +61 -0
  382. package/dist/core/subagent-event-transport.js.map +1 -0
  383. package/dist/core/subscriptions.d.ts +16 -7
  384. package/dist/core/subscriptions.d.ts.map +1 -1
  385. package/dist/core/subscriptions.js +96 -55
  386. package/dist/core/subscriptions.js.map +1 -1
  387. package/dist/core/trust-manager.d.ts +2 -1
  388. package/dist/core/trust-manager.d.ts.map +1 -1
  389. package/dist/core/trust-manager.js +6 -1
  390. package/dist/core/trust-manager.js.map +1 -1
  391. package/dist/core/update-check.d.ts.map +1 -1
  392. package/dist/core/update-check.js.map +1 -1
  393. package/dist/core/usage-adapters/kimi-coding.d.ts +2 -2
  394. package/dist/core/usage-adapters/kimi-coding.d.ts.map +1 -1
  395. package/dist/core/usage-adapters/kimi-coding.js +2 -2
  396. package/dist/core/usage-adapters/kimi-coding.js.map +1 -1
  397. package/dist/core/usage-adapters/openai-codex.d.ts +3 -2
  398. package/dist/core/usage-adapters/openai-codex.d.ts.map +1 -1
  399. package/dist/core/usage-adapters/openai-codex.js +3 -3
  400. package/dist/core/usage-adapters/openai-codex.js.map +1 -1
  401. package/dist/core/usage-adapters/xai.d.ts +2 -2
  402. package/dist/core/usage-adapters/xai.d.ts.map +1 -1
  403. package/dist/core/usage-adapters/xai.js +3 -3
  404. package/dist/core/usage-adapters/xai.js.map +1 -1
  405. package/dist/core/usage-adapters/zai.d.ts +2 -2
  406. package/dist/core/usage-adapters/zai.d.ts.map +1 -1
  407. package/dist/core/usage-adapters/zai.js +2 -2
  408. package/dist/core/usage-adapters/zai.js.map +1 -1
  409. package/dist/core/usage-service.d.ts +9 -2
  410. package/dist/core/usage-service.d.ts.map +1 -1
  411. package/dist/core/usage-service.js +95 -50
  412. package/dist/core/usage-service.js.map +1 -1
  413. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  414. package/dist/gateway/adapters/discord.js +2 -2
  415. package/dist/gateway/adapters/discord.js.map +1 -1
  416. package/dist/gateway/agent-bridge.d.ts +9 -1
  417. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  418. package/dist/gateway/agent-bridge.js +91 -37
  419. package/dist/gateway/agent-bridge.js.map +1 -1
  420. package/dist/gateway/approval.d.ts.map +1 -1
  421. package/dist/gateway/approval.js +3 -3
  422. package/dist/gateway/approval.js.map +1 -1
  423. package/dist/gateway/authz.d.ts +4 -4
  424. package/dist/gateway/authz.d.ts.map +1 -1
  425. package/dist/gateway/authz.js +8 -12
  426. package/dist/gateway/authz.js.map +1 -1
  427. package/dist/gateway/buttons.d.ts +8 -1
  428. package/dist/gateway/buttons.d.ts.map +1 -1
  429. package/dist/gateway/buttons.js +76 -18
  430. package/dist/gateway/buttons.js.map +1 -1
  431. package/dist/gateway/commands.d.ts +1 -0
  432. package/dist/gateway/commands.d.ts.map +1 -1
  433. package/dist/gateway/commands.js +12 -10
  434. package/dist/gateway/commands.js.map +1 -1
  435. package/dist/gateway/cron.d.ts +12 -11
  436. package/dist/gateway/cron.d.ts.map +1 -1
  437. package/dist/gateway/cron.js +85 -62
  438. package/dist/gateway/cron.js.map +1 -1
  439. package/dist/gateway/index.d.ts.map +1 -1
  440. package/dist/gateway/index.js +5 -4
  441. package/dist/gateway/index.js.map +1 -1
  442. package/dist/gateway/mobile-commands.d.ts +1 -0
  443. package/dist/gateway/mobile-commands.d.ts.map +1 -1
  444. package/dist/gateway/mobile-commands.js +64 -22
  445. package/dist/gateway/mobile-commands.js.map +1 -1
  446. package/dist/gateway/presenter.d.ts +12 -2
  447. package/dist/gateway/presenter.d.ts.map +1 -1
  448. package/dist/gateway/presenter.js +74 -39
  449. package/dist/gateway/presenter.js.map +1 -1
  450. package/dist/gateway/router.d.ts +2 -2
  451. package/dist/gateway/router.d.ts.map +1 -1
  452. package/dist/gateway/router.js +22 -9
  453. package/dist/gateway/router.js.map +1 -1
  454. package/dist/gateway/service.d.ts +2 -0
  455. package/dist/gateway/service.d.ts.map +1 -1
  456. package/dist/gateway/service.js +153 -0
  457. package/dist/gateway/service.js.map +1 -1
  458. package/dist/gateway/setup.d.ts.map +1 -1
  459. package/dist/gateway/setup.js +6 -4
  460. package/dist/gateway/setup.js.map +1 -1
  461. package/dist/main.d.ts.map +1 -1
  462. package/dist/main.js +86 -33
  463. package/dist/main.js.map +1 -1
  464. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  465. package/dist/modes/interactive/components/assistant-message.js +6 -4
  466. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  467. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -1
  468. package/dist/modes/interactive/components/copyable-text.js +3 -2
  469. package/dist/modes/interactive/components/copyable-text.js.map +1 -1
  470. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  471. package/dist/modes/interactive/components/extension-editor.js +1 -1
  472. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  473. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  474. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  475. package/dist/modes/interactive/components/settings-selector.js +20 -0
  476. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  477. package/dist/modes/interactive/interactive-mode.d.ts +2 -2
  478. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  479. package/dist/modes/interactive/interactive-mode.js +104 -109
  480. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  481. package/dist/modes/interactive/smooth-streaming.d.ts.map +1 -1
  482. package/dist/modes/interactive/smooth-streaming.js.map +1 -1
  483. package/dist/modes/print-mode.d.ts.map +1 -1
  484. package/dist/modes/print-mode.js +9 -1
  485. package/dist/modes/print-mode.js.map +1 -1
  486. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  487. package/dist/modes/rpc/rpc-mode.js +2 -1
  488. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  489. package/dist/node-runtime/adapter-247RTYLS.js +16 -0
  490. package/dist/node-runtime/agent-session-services-KDMSPQDY.js +53 -0
  491. package/dist/node-runtime/{brave-UWDA3I22.js → brave-2AFFAXNN.js} +1 -1
  492. package/dist/node-runtime/{builtin-extensions-ZLAX7TUH.js → builtin-extensions-OX6KELNX.js} +9 -7
  493. package/dist/node-runtime/{chunk-QH6YL7VK.js → chunk-252ZVPPF.js} +3 -3
  494. package/dist/node-runtime/{chunk-PCEW76PM.js → chunk-2OIPYKLZ.js} +6 -6
  495. package/dist/node-runtime/{chunk-XBWPBZBN.js → chunk-2SWW7KMW.js} +1 -1
  496. package/dist/node-runtime/{chunk-UQUCFAJ3.js → chunk-2VIW3IMF.js} +40 -7
  497. package/dist/node-runtime/{chunk-UOEDI7RP.js → chunk-4KNKQGHM.js} +2 -2
  498. package/dist/node-runtime/{chunk-FQMM2EZ2.js → chunk-64XTQNLA.js} +29 -7
  499. package/dist/node-runtime/{chunk-NRKGMJYU.js → chunk-6O3IW3IA.js} +2 -2
  500. package/dist/node-runtime/{chunk-5ZQXRPMC.js → chunk-6ZZHGUSA.js} +2 -2
  501. package/dist/node-runtime/chunk-A2WO6WIN.js +1197 -0
  502. package/dist/node-runtime/{chunk-ZXSGTGJ6.js → chunk-APVM5NEU.js} +169 -148
  503. package/dist/node-runtime/{chunk-RC7DMV45.js → chunk-AYHH7YSD.js} +205 -144
  504. package/dist/node-runtime/{chunk-LWYIVUGV.js → chunk-B2IBAXNX.js} +48 -31
  505. package/dist/node-runtime/{chunk-M3LZLQW2.js → chunk-BDRGN3L2.js} +1 -0
  506. package/dist/node-runtime/{chunk-GJ2RDBRL.js → chunk-BYC6RKCN.js} +4 -2
  507. package/dist/node-runtime/{chunk-KWIYUUZK.js → chunk-C3P6Q3B2.js} +469 -283
  508. package/dist/node-runtime/{chunk-YCUZEGJG.js → chunk-DQSCFU7R.js} +17 -8
  509. package/dist/node-runtime/chunk-EBLAZVSA.js +4170 -0
  510. package/dist/node-runtime/{chunk-2KIPT4HJ.js → chunk-EPR2F3GU.js} +68 -20
  511. package/dist/node-runtime/{chunk-CSFI6YXL.js → chunk-ES6PBSIE.js} +1 -1
  512. package/dist/node-runtime/{chunk-IF24A3FH.js → chunk-EVM653DD.js} +4 -4
  513. package/dist/node-runtime/{chunk-HTFRRDSF.js → chunk-F2SMQ6ES.js} +3 -2
  514. package/dist/node-runtime/chunk-F2V2F4ZG.js +114 -0
  515. package/dist/node-runtime/chunk-FE3WZI7F.js +290 -0
  516. package/dist/node-runtime/{chunk-GYIXXQAO.js → chunk-FIRA54AC.js} +2 -5
  517. package/dist/node-runtime/{chunk-6VYZ5UFP.js → chunk-FLGEEH27.js} +1 -1
  518. package/dist/node-runtime/{chunk-5EFIU3OM.js → chunk-FTKEZL27.js} +1 -1
  519. package/dist/node-runtime/chunk-FY4A63RK.js +73 -0
  520. package/dist/node-runtime/chunk-FYIFPFXE.js +98 -0
  521. package/dist/node-runtime/{chunk-HMBGROQK.js → chunk-GLDXBBL6.js} +3 -3
  522. package/dist/node-runtime/{chunk-KWA4OC2J.js → chunk-H6YBCWKG.js} +1 -1
  523. package/dist/node-runtime/{chunk-2MI5OPMN.js → chunk-HNNHHJAB.js} +68 -50
  524. package/dist/node-runtime/{chunk-6XL67VVY.js → chunk-HUD2RFJW.js} +17 -2
  525. package/dist/node-runtime/{chunk-I54LGHWM.js → chunk-I2H5QMWW.js} +3 -3
  526. package/dist/node-runtime/chunk-IAZSK7KK.js +108 -0
  527. package/dist/node-runtime/{chunk-2HHLJWGD.js → chunk-IHHTWSXN.js} +9 -9
  528. package/dist/node-runtime/{chunk-DAPBPCBP.js → chunk-IPP5BIV5.js} +25 -3
  529. package/dist/node-runtime/{chunk-QFWG2RVL.js → chunk-IXG6F4NT.js} +11 -0
  530. package/dist/node-runtime/{chunk-RDDAZOMU.js → chunk-JL4HYQXK.js} +1 -1
  531. package/dist/node-runtime/{chunk-CDVHZOOK.js → chunk-JQYNHAKX.js} +1 -1
  532. package/dist/node-runtime/{chunk-WF7PGWRZ.js → chunk-JWEVT363.js} +37 -28
  533. package/dist/node-runtime/{chunk-2HMIRK7W.js → chunk-LHV3V67B.js} +5 -5
  534. package/dist/node-runtime/{chunk-UAEOTO52.js → chunk-MNQXDFPV.js} +6 -2
  535. package/dist/node-runtime/{chunk-IJIFHRTB.js → chunk-MQPKUHRN.js} +165 -85
  536. package/dist/node-runtime/{chunk-MPKSOJBT.js → chunk-NHATCSOI.js} +4 -7
  537. package/dist/node-runtime/{chunk-RMQZU2YU.js → chunk-NNNR3QIY.js} +1 -1
  538. package/dist/node-runtime/{chunk-RWTKOC3B.js → chunk-QBTJG3UM.js} +1 -1
  539. package/dist/node-runtime/{chunk-E4D3IGP2.js → chunk-QNVMKNNN.js} +20 -17
  540. package/dist/node-runtime/{chunk-GS42T6MX.js → chunk-QW3AAHWN.js} +1 -1
  541. package/dist/node-runtime/{chunk-7S3T6YEA.js → chunk-R4WSB2MQ.js} +5 -5
  542. package/dist/node-runtime/{chunk-B4HP6ZWM.js → chunk-RHCGYWO7.js} +1 -1
  543. package/dist/node-runtime/{chunk-3XPLBUEM.js → chunk-RLGY2QIL.js} +49 -59
  544. package/dist/node-runtime/{chunk-KKUTQQV7.js → chunk-RYRGL7P4.js} +1 -1
  545. package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-TCT6PCUR.js} +47 -115
  546. package/dist/node-runtime/chunk-U5F4IC7R.js +53 -0
  547. package/dist/node-runtime/{chunk-OCVIXVTZ.js → chunk-UBWW2PID.js} +13 -2
  548. package/dist/node-runtime/{chunk-HFVZUPFJ.js → chunk-UNUZICC4.js} +3 -3
  549. package/dist/node-runtime/{chunk-LQP3RB67.js → chunk-UYRKUKFE.js} +1 -1
  550. package/dist/node-runtime/{chunk-DSIKTUPW.js → chunk-VSUEAI7O.js} +2993 -3820
  551. package/dist/node-runtime/{chunk-NAY6UUQZ.js → chunk-WDIVLMOH.js} +1 -1
  552. package/dist/node-runtime/{chunk-E24EO34J.js → chunk-WPXUR3HE.js} +1 -1
  553. package/dist/node-runtime/{chunk-SLVOAQOY.js → chunk-WXYNALHD.js} +113 -1
  554. package/dist/node-runtime/{chunk-KJ6DWS3K.js → chunk-XEOCUEUJ.js} +121 -60
  555. package/dist/node-runtime/chunk-YD3IZAZ7.js +47 -0
  556. package/dist/node-runtime/chunk-YSB6URMT.js +41 -0
  557. package/dist/node-runtime/{chunk-VQFSUJJG.js → chunk-ZDJUR45D.js} +430 -129
  558. package/dist/node-runtime/{chunk-YDO2F2IA.js → chunk-ZEVFBFNF.js} +95 -142
  559. package/dist/node-runtime/chunk-ZIQUS5QO.js +180 -0
  560. package/dist/node-runtime/cli-runtime.js +4 -4
  561. package/dist/node-runtime/{command-6WDOYKS6.js → command-3HMSY6W2.js} +5 -5
  562. package/dist/node-runtime/{commands-NZLSOHPE.js → commands-D6A6H4TS.js} +11 -16
  563. package/dist/node-runtime/commands-OCSSEEWJ.js +37 -0
  564. package/dist/node-runtime/{config-QDD5PUE2.js → config-CU7M7BTK.js} +1 -1
  565. package/dist/node-runtime/{config-D4QUPAHX.js → config-DS7XLMEM.js} +2 -2
  566. package/dist/node-runtime/{direct-tool-executor-77GW4F5P.js → direct-tool-executor-2QJXVQD2.js} +8 -10
  567. package/dist/node-runtime/{exa-LL64QZR2.js → exa-6VBZNPGE.js} +1 -1
  568. package/dist/node-runtime/{export-html-VM4J2MNR.js → export-html-BRWF5AHI.js} +4 -4
  569. package/dist/node-runtime/{extension-input-E7BJZ35H.js → extension-input-VBBMX7YV.js} +5 -5
  570. package/dist/node-runtime/{extension-selector-WU42XDTU.js → extension-selector-T5AOG5XB.js} +5 -5
  571. package/dist/node-runtime/{extract-EQJE7FZZ.js → extract-BFX2N35A.js} +3 -3
  572. package/dist/node-runtime/{gateway-INAYBF4Q.js → gateway-6623C2U3.js} +61 -53
  573. package/dist/node-runtime/{gemini-search-35OCRFLN.js → gemini-search-C66QHDT6.js} +2 -2
  574. package/dist/node-runtime/{gemini-url-context-UQY3PHHW.js → gemini-url-context-T7DEK73R.js} +3 -3
  575. package/dist/node-runtime/{github-extract-F64RZOEA.js → github-extract-HOGE3D6F.js} +107 -38
  576. package/dist/node-runtime/{goal-NJEE5CTU.js → goal-AIHEDUYA.js} +5 -5
  577. package/dist/node-runtime/index.js +54 -48
  578. package/dist/node-runtime/{init-HS6NQXSK.js → init-JBQJIPYI.js} +3 -4
  579. package/dist/node-runtime/{install-cli-KL4UDDAD.js → install-cli-INGHIVBY.js} +30 -25
  580. package/dist/node-runtime/interactive-mode-FM5DNUSW.js +74 -0
  581. package/dist/node-runtime/{interactive-view-NGFAMHPW.js → interactive-view-K33PM4OS.js} +8 -8
  582. package/dist/node-runtime/{lsp-manager-3ASUSO4T.js → lsp-manager-S554V5HR.js} +240 -155
  583. package/dist/node-runtime/{lunr-browser-IR7TL3J7.js → lunr-browser-H4FDOR3C.js} +7 -7
  584. package/dist/node-runtime/lunr-computer-use-VDP2QNRQ.js +158 -0
  585. package/dist/node-runtime/{lunr-cron-LWIZJM2N.js → lunr-cron-LKVA5CZZ.js} +94 -79
  586. package/dist/node-runtime/main.js +42 -39
  587. package/dist/node-runtime/{mobile-commands-J7OJEKFO.js → mobile-commands-XT3NQXLD.js} +13 -12
  588. package/dist/node-runtime/{model-runtime-OO5HFLWE.js → model-runtime-MZ2JMDV4.js} +4 -4
  589. package/dist/node-runtime/{openai-search-B3MSNCQA.js → openai-search-K72LJDYN.js} +1 -1
  590. package/dist/node-runtime/{package-manager-cli-VYZM5WHN.js → package-manager-cli-CYM262SI.js} +20 -19
  591. package/dist/node-runtime/{parallel-AI2MNSCU.js → parallel-X724NCNU.js} +1 -1
  592. package/dist/node-runtime/{perplexity-QVJW3I35.js → perplexity-RDHQHVMK.js} +2 -2
  593. package/dist/node-runtime/{pi-intercom-QM53RLTS.js → pi-intercom-NHHEPBMI.js} +2 -2
  594. package/dist/node-runtime/{pi-mcp-adapter-5UKBZP44.js → pi-mcp-adapter-PP3GQJQ2.js} +98 -94
  595. package/dist/node-runtime/{pi-ollama-cloud-2F3Y2QNM.js → pi-ollama-cloud-4MNWIMFN.js} +11 -24
  596. package/dist/node-runtime/{pi-prompt-template-model-QWTCGLJU.js → pi-prompt-template-model-FTGELLS5.js} +32 -36
  597. package/dist/node-runtime/{pi-subagents-DNY7EAIG.js → pi-subagents-LT3CTO4E.js} +114 -116
  598. package/dist/node-runtime/{pi-web-access-WTGMNZ32.js → pi-web-access-Z3LP246C.js} +144 -108
  599. package/dist/node-runtime/{print-mode-XSFM26EL.js → print-mode-2XHN5SUA.js} +4 -3
  600. package/dist/node-runtime/{process-registry-4FAKZQOL.js → process-registry-Q4QWIU33.js} +3 -3
  601. package/dist/node-runtime/{proxy-modes-LGEUYD7R.js → proxy-modes-VEGC6QG5.js} +9 -13
  602. package/dist/node-runtime/rpc-entry.js +42 -39
  603. package/dist/node-runtime/{rpc-mode-O3XV4SID.js → rpc-mode-32DHJPEJ.js} +4 -4
  604. package/dist/node-runtime/{runtime-4VA6JKNF.js → runtime-EDUUGAQD.js} +56 -46
  605. package/dist/node-runtime/runtime-UGXM4NPQ.js +21 -0
  606. package/dist/node-runtime/{runtime-bridges-VRDDR73P.js → runtime-bridges-DNKMNJCF.js} +8 -7
  607. package/dist/node-runtime/{service-MDQIPQ26.js → service-IHLGFLBT.js} +6 -4
  608. package/dist/node-runtime/{session-handoff-GWARVEWT.js → session-handoff-LNSPDTKY.js} +4 -4
  609. package/dist/node-runtime/{session-manager-JB5J6XBN.js → session-manager-YIFIAVGC.js} +3 -3
  610. package/dist/node-runtime/{session-selector-GIM4DHQ2.js → session-selector-I73U3EIO.js} +7 -7
  611. package/dist/node-runtime/{settings-manager-J4SPQPDJ.js → settings-manager-P2TKGYTR.js} +6 -5
  612. package/dist/node-runtime/{setup-JBKOLJ6F.js → setup-H7CCELIL.js} +15 -1
  613. package/dist/node-runtime/{setup-CQ2NLVK5.js → setup-OLQ4GXWS.js} +22 -21
  614. package/dist/node-runtime/{src-IVPNZ2BX.js → src-6RV4PXKJ.js} +64 -36
  615. package/dist/node-runtime/{subagent-executor-KZZQGAKV.js → subagent-executor-Q5F7DBVM.js} +141 -62
  616. package/dist/node-runtime/{tavily-WEZFVFP7.js → tavily-KZBFYQB6.js} +1 -1
  617. package/dist/node-runtime/{theme-UOO5RVFN.js → theme-YLVZKKZD.js} +2 -2
  618. package/dist/node-runtime/{trust-manager-MMISNCYO.js → trust-manager-ZCU76D23.js} +2 -2
  619. package/dist/node-runtime/{update-cli-GTFJC7XK.js → update-cli-F3XXJANQ.js} +7 -6
  620. package/dist/node-runtime/{usage-service-LFB2SWYV.js → usage-service-CPAGBED5.js} +1 -1
  621. package/dist/node-runtime/{video-extract-OOZHR7SU.js → video-extract-UPKYIBW3.js} +3 -3
  622. package/dist/node-runtime/workflow-ICDI4N3J.js +767 -0
  623. package/dist/node-runtime/{youtube-extract-FNPAUNHU.js → youtube-extract-77NT7FWH.js} +4 -4
  624. package/dist/utils/clipboard-image.d.ts.map +1 -1
  625. package/dist/utils/clipboard-image.js.map +1 -1
  626. package/dist/utils/exif-orientation.d.ts.map +1 -1
  627. package/dist/utils/exif-orientation.js +25 -10
  628. package/dist/utils/exif-orientation.js.map +1 -1
  629. package/dist/utils/image-resize-core.d.ts +2 -0
  630. package/dist/utils/image-resize-core.d.ts.map +1 -1
  631. package/dist/utils/image-resize-core.js +12 -0
  632. package/dist/utils/image-resize-core.js.map +1 -1
  633. package/dist/utils/paths.d.ts +4 -0
  634. package/dist/utils/paths.d.ts.map +1 -1
  635. package/dist/utils/paths.js +33 -2
  636. package/dist/utils/paths.js.map +1 -1
  637. package/dist/utils/sanitize-terminal-text.d.ts +7 -0
  638. package/dist/utils/sanitize-terminal-text.d.ts.map +1 -0
  639. package/dist/utils/sanitize-terminal-text.js +67 -0
  640. package/dist/utils/sanitize-terminal-text.js.map +1 -0
  641. package/docs/browser.md +1 -1
  642. package/docs/computer-use.md +362 -0
  643. package/docs/custom-provider.md +3 -3
  644. package/docs/extensions.md +8 -4
  645. package/docs/features.md +22 -12
  646. package/docs/keybindings.md +1 -1
  647. package/docs/models.md +5 -5
  648. package/docs/packages.md +1 -1
  649. package/docs/providers.md +2 -2
  650. package/docs/rpc.md +7 -7
  651. package/docs/security.md +10 -5
  652. package/docs/sessions.md +2 -2
  653. package/docs/skills.md +1 -1
  654. package/docs/terminal-setup.md +7 -7
  655. package/docs/themes.md +1 -1
  656. package/docs/usage.md +1 -1
  657. package/examples/extensions/auto-commit-on-exit.ts +1 -1
  658. package/examples/extensions/bash-spawn-hook.ts +1 -1
  659. package/examples/extensions/built-in-tool-renderer.ts +1 -1
  660. package/examples/extensions/claude-rules.ts +1 -1
  661. package/examples/extensions/commands.ts +1 -1
  662. package/examples/extensions/custom-compaction.ts +1 -1
  663. package/examples/extensions/custom-provider-anthropic/index.ts +3 -3
  664. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  665. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  666. package/examples/extensions/custom-provider-gitlab-duo/index.ts +1 -1
  667. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  668. package/examples/extensions/doom-overlay/index.ts +1 -1
  669. package/examples/extensions/git-merge-and-resolve.ts +2 -2
  670. package/examples/extensions/gondolin/index.ts +1 -1
  671. package/examples/extensions/gondolin/package-lock.json +2 -2
  672. package/examples/extensions/gondolin/package.json +1 -1
  673. package/examples/extensions/hidden-thinking-label.ts +1 -1
  674. package/examples/extensions/inline-bash.ts +2 -2
  675. package/examples/extensions/input-transform-streaming.ts +2 -2
  676. package/examples/extensions/input-transform.ts +2 -2
  677. package/examples/extensions/interactive-shell.ts +1 -1
  678. package/examples/extensions/kimi-deferred-tools.ts +1 -1
  679. package/examples/extensions/mac-system-theme.ts +1 -1
  680. package/examples/extensions/minimal-mode.ts +1 -1
  681. package/examples/extensions/modal-editor.ts +1 -1
  682. package/examples/extensions/model-status.ts +1 -1
  683. package/examples/extensions/notify.ts +3 -3
  684. package/examples/extensions/overlay-qa-tests.ts +1 -1
  685. package/examples/extensions/overlay-test.ts +1 -1
  686. package/examples/extensions/pirate.ts +1 -1
  687. package/examples/extensions/preset.ts +3 -3
  688. package/examples/extensions/project-trust.ts +4 -4
  689. package/examples/extensions/prompt-customizer.ts +1 -1
  690. package/examples/extensions/rainbow-editor.ts +1 -1
  691. package/examples/extensions/rpc-demo.ts +1 -1
  692. package/examples/extensions/sandbox/index.ts +7 -7
  693. package/examples/extensions/sandbox/package-lock.json +2 -2
  694. package/examples/extensions/sandbox/package.json +1 -1
  695. package/examples/extensions/shutdown-command.ts +5 -5
  696. package/examples/extensions/ssh.ts +2 -2
  697. package/examples/extensions/subagent/README.md +3 -3
  698. package/examples/extensions/subagent/index.ts +2 -2
  699. package/examples/extensions/titlebar-spinner.ts +1 -1
  700. package/examples/extensions/tool-override.ts +1 -1
  701. package/examples/extensions/tools.ts +1 -1
  702. package/examples/extensions/with-deps/package-lock.json +2 -2
  703. package/examples/extensions/with-deps/package.json +1 -1
  704. package/examples/extensions/working-indicator.ts +1 -1
  705. package/examples/extensions/working-message-test.ts +1 -1
  706. package/examples/sdk/01-minimal.ts +1 -1
  707. package/examples/sdk/03-custom-prompt.ts +1 -1
  708. package/examples/sdk/04-skills.ts +1 -1
  709. package/examples/sdk/06-extensions.ts +2 -2
  710. package/examples/sdk/08-prompt-templates.ts +1 -1
  711. package/install-lock/package-lock.json +3841 -0
  712. package/install-lock/package.json +18 -0
  713. package/native/computer-use/LICENSE.md +21 -0
  714. package/npm-shrinkwrap.json +3858 -0
  715. package/package.json +15 -9
  716. package/dist/modes/interactive/components/exit-card.d.ts +0 -22
  717. package/dist/modes/interactive/components/exit-card.d.ts.map +0 -1
  718. package/dist/modes/interactive/components/exit-card.js +0 -69
  719. package/dist/modes/interactive/components/exit-card.js.map +0 -1
  720. package/dist/node-runtime/agent-session-services-YXXFCP5J.js +0 -49
  721. package/dist/node-runtime/chunk-4HXHDDCF.js +0 -16
  722. package/dist/node-runtime/chunk-4TLO4PO2.js +0 -3427
  723. package/dist/node-runtime/chunk-AUXVGBO4.js +0 -19
  724. package/dist/node-runtime/chunk-OVX6X377.js +0 -50
  725. package/dist/node-runtime/chunk-QTU6AKNJ.js +0 -773
  726. package/dist/node-runtime/chunk-TORR5XBV.js +0 -356
  727. package/dist/node-runtime/commands-QC6VUZJQ.js +0 -36
  728. package/dist/node-runtime/interactive-mode-Z5M7WYYZ.js +0 -72
  729. package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +0 -32
@@ -0,0 +1,767 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ DriverCallError
4
+ } from "./chunk-FE3WZI7F.js";
5
+ import {
6
+ computerSchemas
7
+ } from "./chunk-FYIFPFXE.js";
8
+ import "./chunk-VSUEAI7O.js";
9
+ import {
10
+ assertOwnedPath
11
+ } from "./chunk-ZIQUS5QO.js";
12
+ import "./chunk-BI3DHYCN.js";
13
+ import "./chunk-PL6JKXWI.js";
14
+ import {
15
+ resizeImage
16
+ } from "./chunk-TCT6PCUR.js";
17
+ import {
18
+ require_proper_lockfile
19
+ } from "./chunk-URD2SLIT.js";
20
+ import {
21
+ loadPhoton
22
+ } from "./chunk-RQ2Q5IYR.js";
23
+ import "./chunk-64XTQNLA.js";
24
+ import "./chunk-Q4Q6D4IY.js";
25
+ import {
26
+ __toESM
27
+ } from "./chunk-BRJX2PRC.js";
28
+
29
+ // packages/coding-agent/dist/core/computer-use/workflow.js
30
+ import { randomUUID as randomUUID2 } from "node:crypto";
31
+ import { setTimeout as delay } from "node:timers/promises";
32
+
33
+ // packages/coding-agent/dist/core/computer-use/image.js
34
+ import { createHash } from "node:crypto";
35
+ function screenshotDimensions(image) {
36
+ if (image.mimeType !== "image/png" || image.data.length > 64 * 1024 * 1024)
37
+ throw new Error("Expected a bounded PNG screenshot.");
38
+ let bytes = Buffer.from(image.data, "base64");
39
+ if (bytes.length < 24 || !bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])))
40
+ throw new Error("Invalid screenshot PNG.");
41
+ let width = bytes.readUInt32BE(16), height = bytes.readUInt32BE(20);
42
+ if (!width || !height || width > 16384 || height > 16384 || width * height > 4e7)
43
+ throw new Error("Screenshot dimensions exceed the supported capture budget.");
44
+ return { width, height };
45
+ }
46
+ async function prepareComputerImage(image, crop) {
47
+ let source = screenshotDimensions(image), region = crop ?? { x: 0, y: 0, ...source };
48
+ if (![region.x, region.y, region.width, region.height].every(Number.isInteger) || region.x < 0 || region.y < 0 || region.width < 1 || region.height < 1 || region.x + region.width > source.width || region.y + region.height > source.height)
49
+ throw new Error("Crop is outside the captured image.");
50
+ let bytes = Buffer.from(image.data, "base64"), fingerprint;
51
+ if (crop) {
52
+ let photon = await loadPhoton();
53
+ if (!photon)
54
+ throw new Error("Image processing is unavailable; crop refused.");
55
+ let original = photon.PhotonImage.new_from_byteslice(bytes);
56
+ try {
57
+ if (original.get_width() !== source.width || original.get_height() !== source.height)
58
+ throw new Error("Decoded screenshot dimensions changed.");
59
+ fingerprint = createHash("sha256").update(`${source.width}x${source.height}:`).update(original.get_raw_pixels()).digest("hex");
60
+ let cropped = photon.crop(original, region.x, region.y, region.x + region.width, region.y + region.height);
61
+ try {
62
+ bytes = cropped.get_bytes();
63
+ } finally {
64
+ cropped.free();
65
+ }
66
+ } finally {
67
+ original.free();
68
+ }
69
+ }
70
+ let ratio = Math.min(1, 1280 / Math.max(region.width, region.height), Math.sqrt(1e6 / (region.width * region.height))), resized = await resizeImage(bytes, "image/png", {
71
+ maxWidth: Math.max(1, Math.floor(region.width * ratio)),
72
+ maxHeight: Math.max(1, Math.floor(region.height * ratio)),
73
+ maxBytes: 1.5 * 1024 * 1024,
74
+ includePixelFingerprint: !crop
75
+ });
76
+ if (!resized || resized.originalWidth !== region.width || resized.originalHeight !== region.height || resized.width < 1 || resized.height < 1 || resized.width > 1280 || resized.height > 1280 || resized.width * resized.height > 1e6)
77
+ throw new Error("Screenshot could not be decoded within the image budget.");
78
+ if (fingerprint ??= resized.fingerprint, !fingerprint)
79
+ throw new Error("Screenshot pixel identity could not be verified.");
80
+ return {
81
+ fingerprint,
82
+ image: { type: "image", data: resized.data, mimeType: resized.mimeType },
83
+ width: resized.width,
84
+ height: resized.height,
85
+ sourceWidth: source.width,
86
+ sourceHeight: source.height,
87
+ region,
88
+ scaleX: region.width / resized.width,
89
+ scaleY: region.height / resized.height
90
+ };
91
+ }
92
+
93
+ // packages/coding-agent/dist/core/computer-use/lease.js
94
+ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
95
+ import { randomUUID } from "node:crypto";
96
+ import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
97
+ import { userInfo } from "node:os";
98
+ import { join } from "node:path";
99
+ var DesktopLease = class {
100
+ identity = randomUUID();
101
+ owned = !1;
102
+ tail = Promise.resolve();
103
+ closed = !1;
104
+ controller = new AbortController();
105
+ get signal() {
106
+ return this.controller.signal;
107
+ }
108
+ directory;
109
+ constructor(directory = join(userInfo().homedir, ".lunr", "desktop")) {
110
+ this.directory = directory;
111
+ }
112
+ async owner() {
113
+ try {
114
+ let value = JSON.parse(await readFile(join(this.directory, "workflow-owner.json"), "utf8"));
115
+ if (!value || typeof value != "object" || !("pid" in value) || typeof value.pid != "number" || !Number.isInteger(value.pid) || value.pid < 1 || !("identity" in value) || typeof value.identity != "string")
116
+ throw new Error("Invalid desktop owner record; refusing takeover.");
117
+ let processes = "processes" in value ? value.processes : [];
118
+ if (!Array.isArray(processes) || !processes.every((pid) => Number.isInteger(pid) && pid > 0))
119
+ throw new Error("Invalid runtime owner record; refusing takeover.");
120
+ return { pid: value.pid, identity: value.identity, processes };
121
+ } catch (error) {
122
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
123
+ return;
124
+ throw error;
125
+ }
126
+ }
127
+ async withOwnerLock(operation) {
128
+ let release = await import_proper_lockfile.default.lock(this.directory, {
129
+ lockfilePath: join(this.directory, "workflow-acquire.lock"),
130
+ retries: 0,
131
+ stale: 1e4
132
+ });
133
+ try {
134
+ await operation();
135
+ } finally {
136
+ await release();
137
+ }
138
+ }
139
+ async writeOwner(owner) {
140
+ let temporary = join(this.directory, `workflow-owner-${randomUUID()}.tmp`);
141
+ try {
142
+ await writeFile(temporary, JSON.stringify(owner), { mode: 384, flag: "wx" }), await rename(temporary, join(this.directory, "workflow-owner.json"));
143
+ } finally {
144
+ await rm(temporary, { force: !0 });
145
+ }
146
+ }
147
+ async acquire() {
148
+ await assertOwnedPath(this.directory), await mkdir(this.directory, { recursive: !0, mode: 448 }), await this.withOwnerLock(async () => {
149
+ let owner = await this.owner();
150
+ if (owner && [owner.pid, ...owner.processes].some((pid) => {
151
+ try {
152
+ return process.kill(pid, 0), !0;
153
+ } catch (error) {
154
+ return !(error instanceof Error && "code" in error && error.code === "ESRCH");
155
+ }
156
+ }))
157
+ throw new Error("Desktop busy: another lunR workflow owns this user's desktop. Retry only after it ends.");
158
+ await this.writeOwner({ pid: process.pid, identity: this.identity }), this.owned = !0;
159
+ });
160
+ }
161
+ async trackProcess(pid) {
162
+ await this.withOwnerLock(async () => {
163
+ let owner = await this.owner();
164
+ if (!owner || owner.identity !== this.identity || !Number.isInteger(pid) || pid < 1)
165
+ throw new Error("Cannot bind runtime to the desktop lease.");
166
+ owner.processes.includes(pid) || owner.processes.push(pid), await this.writeOwner(owner);
167
+ });
168
+ }
169
+ run(operation, signal) {
170
+ let result = this.tail.then(async () => {
171
+ if (this.closed)
172
+ throw new Error("Desktop workflow ended. Start a new workflow and observe again.");
173
+ if (signal?.throwIfAborted(), this.owned || await this.acquire(), (await this.owner())?.identity !== this.identity)
174
+ throw this.closed = !0, this.controller.abort(new Error("Desktop lease lost.")), new Error("Desktop lease lost. Input refused.");
175
+ return signal?.throwIfAborted(), operation();
176
+ });
177
+ return this.tail = result.catch(() => {
178
+ }), result;
179
+ }
180
+ async close() {
181
+ this.closed = !0, this.controller.abort(), await this.tail, this.owned && (await this.withOwnerLock(async () => {
182
+ (await this.owner())?.identity === this.identity && await rm(join(this.directory, "workflow-owner.json"));
183
+ }), this.owned = !1);
184
+ }
185
+ };
186
+
187
+ // packages/coding-agent/dist/core/computer-use/workflow.js
188
+ function driverData(reply) {
189
+ if (reply.structuredContent && typeof reply.structuredContent == "object" && !Array.isArray(reply.structuredContent))
190
+ return Object.fromEntries(Object.entries(reply.structuredContent));
191
+ if (Array.isArray(reply.content)) {
192
+ for (let item of reply.content)
193
+ if (!(item.type !== "text" || typeof item.text != "string"))
194
+ try {
195
+ let value = JSON.parse(item.text);
196
+ if (value && typeof value == "object" && !Array.isArray(value))
197
+ return Object.fromEntries(Object.entries(value));
198
+ } catch {
199
+ }
200
+ }
201
+ return {};
202
+ }
203
+ function plainLaunchReason(reply) {
204
+ if (reply.structuredContent || !Array.isArray(reply.content))
205
+ return;
206
+ let text = reply.content.find((item) => item.type === "text")?.text;
207
+ if (typeof text == "string") {
208
+ if (/^App name lookup for .+ is (?:temporarily unavailable|unavailable).+No app was launched;/s.test(text))
209
+ return "app_lookup_unavailable";
210
+ if (/^App .+ was not found in shell:AppsFolder or by Windows PATH\/association lookup:/s.test(text))
211
+ return "app_not_found";
212
+ if (/^Launch of .+ timed out after 15s/s.test(text))
213
+ return "launch_timeout_unknown";
214
+ if (/^(?:Failed to launch|Task error): /s.test(text))
215
+ return "launch_native_error_unknown";
216
+ }
217
+ }
218
+ function driverRefused(reply) {
219
+ let data = driverData(reply), acknowledged = data.activated === !0 || data.success === !0 || data.verified === !0 || data.effect === "confirmed", uncertain = [data.status, data.effect].some((value) => value === "partial" || value === "unverifiable");
220
+ return reply.isError === !0 || plainLaunchReason(reply) !== void 0 || data.refusal !== void 0 && data.refusal !== null && data.refusal !== !1 || data.error !== void 0 && data.error !== null && data.error !== !1 || data.effect === "refused" || data.status === "refused" || data.status === "failed" || data.success === !1 || [
221
+ "window_target_mismatch",
222
+ "window_target_not_found",
223
+ "background_unavailable",
224
+ "foreground_unavailable",
225
+ "type_text_incomplete",
226
+ "verification_failed"
227
+ ].includes(String(data.code)) || data.status !== void 0 && !acknowledged && !uncertain && !["ok", "success", "completed"].includes(String(data.status)) || data.code !== void 0 && data.code !== 0 && !acknowledged && !uncertain;
228
+ }
229
+ function record(value) {
230
+ return value !== null && typeof value == "object" && !Array.isArray(value) ? Object.fromEntries(Object.entries(value)) : {};
231
+ }
232
+ function select(data, keys) {
233
+ let result = {};
234
+ for (let key of keys) {
235
+ let value = data[key];
236
+ ["name", "app_name", "title"].includes(key) && typeof value == "string" ? result[key] = value.slice(0, 240) : (["active", "running", "is_on_screen", "minimized"].includes(key) && typeof value == "boolean" || ["pid", "window_id", "x", "y", "width", "height"].includes(key) && typeof value == "number" && Number.isSafeInteger(value)) && (result[key] = value);
237
+ }
238
+ return result;
239
+ }
240
+ function typingRecovery(data, text) {
241
+ if (typeof text != "string")
242
+ return {};
243
+ let requested = data.requested_chars, delivered = data.delivered_chars;
244
+ if (typeof requested != "number" || !Number.isSafeInteger(requested) || requested < 0 || requested > 2e4 || requested !== Array.from(text).length)
245
+ return {};
246
+ let validDelivered = typeof delivered == "number" && Number.isSafeInteger(delivered) && delivered >= 0 && delivered <= requested;
247
+ return {
248
+ requested_chars: requested,
249
+ delivered_chars: validDelivered ? delivered : void 0,
250
+ retryable: validDelivered && data.retry_from_character === delivered && typeof data.retryable == "boolean" ? data.retryable : void 0,
251
+ retry_from_character: validDelivered && data.retry_from_character === delivered ? delivered : void 0
252
+ };
253
+ }
254
+ var nativeCodes = /* @__PURE__ */ new Set([
255
+ "background_unavailable",
256
+ "background_occluded",
257
+ "background_uipi_blocked",
258
+ "window_target_mismatch",
259
+ "window_target_not_found",
260
+ "type_text_incomplete",
261
+ "foreground_unavailable",
262
+ "foreground_rejected",
263
+ "stale_target",
264
+ "target_not_found",
265
+ "verification_failed",
266
+ "tool_invocation_failed"
267
+ ]);
268
+ function safeCode(value) {
269
+ return typeof value == "string" && nativeCodes.has(value) ? value : void 0;
270
+ }
271
+ function nativeReason(reply) {
272
+ let data = driverData(reply), code = safeCode(data.code) ?? safeCode(record(data.refusal).code) ?? safeCode(record(data.error).code) ?? safeCode(data.refusal) ?? safeCode(data.error);
273
+ return code || (plainLaunchReason(reply) ? plainLaunchReason(reply) : "native_error_unknown");
274
+ }
275
+ function outcome(reply, text) {
276
+ let data = driverData(reply), refused = driverRefused(reply), partial = data.effect === "partial" || data.status === "partial";
277
+ return {
278
+ phase: refused || partial ? "native_result" : "native_request",
279
+ code: refused || partial ? nativeReason(reply) : void 0,
280
+ native_code: safeCode(data.code) ?? safeCode(record(data.refusal).code) ?? safeCode(record(data.error).code),
281
+ status: typeof data.status == "string" && ["ok", "success", "completed", "partial", "refused", "failed"].includes(data.status) ? data.status : void 0,
282
+ effect: typeof data.effect == "string" && ["confirmed", "partial", "unverifiable", "refused"].includes(data.effect) ? data.effect : void 0,
283
+ verified: typeof data.verified == "boolean" ? data.verified : void 0,
284
+ success: typeof data.success == "boolean" ? data.success : void 0,
285
+ activated: typeof data.activated == "boolean" ? data.activated : void 0,
286
+ escalation: record(data.escalation).recommended === "foreground" ? "foreground" : void 0,
287
+ input: partial && typingRecovery(data, text).delivered_chars !== void 0 ? "partial" : refused || partial ? "uncertain" : "dispatched",
288
+ applicationEffect: "unverified",
289
+ ...typingRecovery(data, text)
290
+ };
291
+ }
292
+ function abortable(pending, signal) {
293
+ return new Promise((resolve, reject) => {
294
+ let abort = () => {
295
+ signal.removeEventListener("abort", abort), reject(signal.reason ?? new Error("Computer operation cancelled."));
296
+ };
297
+ signal.addEventListener("abort", abort, { once: !0 }), pending.then((value) => {
298
+ signal.removeEventListener("abort", abort), resolve(value);
299
+ }, (error) => {
300
+ signal.removeEventListener("abort", abort), reject(error);
301
+ }), signal.aborted && abort();
302
+ });
303
+ }
304
+ var freshActionGuidance = "Get a fresh capture of the exact target before any next action, including window focus. Copy its token exactly. No input was sent by this call; earlier calls may have had an effect.", CaptureError = class extends Error {
305
+ code;
306
+ constructor(code) {
307
+ super(code), this.code = code;
308
+ }
309
+ }, ObservationError = class extends Error {
310
+ code;
311
+ constructor(code, message) {
312
+ super(`Stale observation. ${message}`), this.code = code;
313
+ }
314
+ };
315
+ function targetFrom(input) {
316
+ if (input.desktop === !0) {
317
+ if (input.pid !== void 0 || input.window_id !== void 0)
318
+ throw new Error("Desktop target cannot include pid/window_id.");
319
+ return { desktop: !0 };
320
+ }
321
+ if (typeof input.pid != "number" || !Number.isInteger(input.pid) || input.pid < 1 || typeof input.window_id != "number" || !Number.isInteger(input.window_id) || input.window_id < 1)
322
+ throw new Error("Window target requires positive integer pid and window_id.");
323
+ return { pid: input.pid, window_id: input.window_id };
324
+ }
325
+ function sameTarget(a, b) {
326
+ return a.desktop === !0 ? b.desktop === !0 : b.desktop !== !0 && a.pid === b.pid && a.window_id === b.window_id;
327
+ }
328
+ var ComputerWorkflow = class {
329
+ observation;
330
+ lastCapture;
331
+ lastAction;
332
+ abort = new AbortController();
333
+ closing;
334
+ driver;
335
+ lease;
336
+ constructor(driver, lease = new DesktopLease()) {
337
+ this.driver = driver, this.lease = lease, this.driver.setProcessObserver?.((pid) => this.lease.trackProcess(pid));
338
+ }
339
+ fresh(input, previous) {
340
+ if (!previous)
341
+ throw new ObservationError("observation_unavailable", "No active observation is available.");
342
+ if (previous.token !== input.observation)
343
+ throw new ObservationError("observation_mismatch", "Token does not match the active observation.");
344
+ if (!sameTarget(previous.target, targetFrom(input)))
345
+ throw new ObservationError("observation_target_mismatch", "Token belongs to a different target.");
346
+ if (Date.now() - previous.time > 3e4)
347
+ throw new ObservationError("observation_expired", "The active observation is older than 30 seconds.");
348
+ return previous;
349
+ }
350
+ async capture(target, signal, previous, crop) {
351
+ let time = Date.now(), reply = await abortable(this.driver.call(target.desktop ? "get_desktop_state" : "get_window_state", target.desktop ? {} : {
352
+ pid: target.pid,
353
+ window_id: target.window_id,
354
+ include_accessibility_tree: !1,
355
+ include_screenshot: !0,
356
+ max_dimension: 2560
357
+ }, signal), signal);
358
+ if (driverRefused(reply))
359
+ throw new CaptureError(nativeReason(reply));
360
+ let data = driverData(reply), images = Array.isArray(reply.content) ? reply.content.filter((item) => item.type === "image") : [];
361
+ if (images.length !== 1 || typeof images[0].data != "string" || typeof images[0].mimeType != "string")
362
+ throw new CaptureError("screenshot_unavailable");
363
+ let image = { type: "image", data: images[0].data, mimeType: images[0].mimeType }, dimensions;
364
+ try {
365
+ dimensions = screenshotDimensions(image);
366
+ } catch {
367
+ throw new CaptureError("image_decode_failed");
368
+ }
369
+ if (data.screenshot_frame_valid === !1 || data.screenshot_error != null || dimensions.width !== data.screenshot_width || dimensions.height !== data.screenshot_height)
370
+ throw new CaptureError("image_frame_invalid");
371
+ let geometry = JSON.stringify(select(record(data.window_bounds), ["x", "y", "width", "height"]));
372
+ if (crop && previous && (previous.sourceWidth !== dimensions.width || previous.sourceHeight !== dimensions.height || previous.geometry !== geometry))
373
+ throw new CaptureError("target_geometry_changed");
374
+ let prepared;
375
+ try {
376
+ prepared = await abortable(prepareComputerImage(image, crop), signal);
377
+ } catch (error) {
378
+ throw signal.aborted ? error : new CaptureError("image_decode_failed");
379
+ }
380
+ return signal.throwIfAborted(), { ...prepared, token: randomUUID2(), target, time, fingerprint: prepared.fingerprint, geometry };
381
+ }
382
+ imageResult(observation, extra = {}) {
383
+ this.observation = observation;
384
+ let { width, height, region, sourceWidth, sourceHeight, scaleX, scaleY, target, token } = observation, failed = extra.failed === !0;
385
+ return {
386
+ content: [
387
+ {
388
+ type: "text",
389
+ text: JSON.stringify({
390
+ ...extra,
391
+ observation: token,
392
+ target,
393
+ captured_at: observation.time,
394
+ expires_at: observation.time + 3e4,
395
+ image: { width, height },
396
+ mapping: { sourceWidth, sourceHeight, ...region, scaleX, scaleY },
397
+ coordinates: "Use returned-image pixels; mapping is applied automatically."
398
+ })
399
+ },
400
+ observation.image
401
+ ],
402
+ details: { observation: token, computer: { failed, workflow: "ready" } },
403
+ isError: failed
404
+ };
405
+ }
406
+ crop(input, previous) {
407
+ let crop = record(input.crop), { x, y, width, height } = crop;
408
+ if (typeof x != "number" || typeof y != "number" || typeof width != "number" || typeof height != "number" || ![x, y, width, height].every(Number.isFinite) || x < 0 || y < 0 || width <= 0 || height <= 0 || x + width > previous.width || y + height > previous.height || Object.keys(crop).some((key) => !["x", "y", "width", "height"].includes(key)))
409
+ throw new Error("Crop must fit the latest returned image.");
410
+ let left = Math.floor(previous.region.x + x * previous.scaleX), top = Math.floor(previous.region.y + y * previous.scaleY), right = Math.min(previous.sourceWidth, Math.ceil(previous.region.x + (x + width) * previous.scaleX)), bottom = Math.min(previous.sourceHeight, Math.ceil(previous.region.y + (y + height) * previous.scaleY));
411
+ return { x: left, y: top, width: right - left, height: bottom - top };
412
+ }
413
+ action(name, input, previous) {
414
+ let args = previous.target.desktop ? { scope: "desktop" } : { pid: previous.target.pid, window_id: previous.target.window_id };
415
+ if (previous.target.desktop && input.foreground !== !0)
416
+ throw new Error("Desktop input requires foreground=true.");
417
+ name !== "computer_window" && name !== "computer_hover" && (args.delivery_mode = input.foreground === !0 ? "foreground" : "background");
418
+ for (let key of ["x", "y", "from_x", "from_y", "to_x", "to_y"]) {
419
+ if (name === "computer_window")
420
+ break;
421
+ let value = input[key];
422
+ if (value === void 0)
423
+ continue;
424
+ let horizontal = key.endsWith("x");
425
+ if (typeof value != "number" || !Number.isFinite(value) || value < 0 || value >= (horizontal ? previous.width : previous.height))
426
+ throw new Error("Coordinate outside the observed image.");
427
+ args[key] = (horizontal ? previous.region.x : previous.region.y) + value * (horizontal ? previous.scaleX : previous.scaleY);
428
+ }
429
+ if (input.x === void 0 != (input.y === void 0))
430
+ throw new Error("Provide a complete x/y pair.");
431
+ if (previous.target.desktop && ["computer_key", "computer_text"].includes(name) && input.x !== void 0)
432
+ throw new Error("Desktop keyboard input uses the observed focused field. Change focus with a separate grounded click.");
433
+ let operation;
434
+ switch (name) {
435
+ case "computer_hover":
436
+ if (process.platform !== "win32" || !previous.target.desktop || input.desktop !== !0 || input.foreground !== !0 || input.x === void 0 || input.y === void 0)
437
+ throw new Error("Hover requires a Windows foreground desktop image and x/y coordinates.");
438
+ operation = "move_cursor";
439
+ break;
440
+ case "computer_click":
441
+ case "computer_scroll":
442
+ if (input.x === void 0 || input.y === void 0)
443
+ throw new Error("This action requires x/y image coordinates.");
444
+ operation = name === "computer_click" ? "click" : "scroll";
445
+ for (let key of name === "computer_click" ? ["button", "count", "modifier"] : ["direction", "amount", "by"])
446
+ input[key] !== void 0 && (args[key] = input[key]);
447
+ break;
448
+ case "computer_drag":
449
+ if (!["from_x", "from_y", "to_x", "to_y"].every((key) => typeof args[key] == "number"))
450
+ throw new Error("Drag requires both endpoints.");
451
+ operation = "drag";
452
+ break;
453
+ case "computer_key": {
454
+ if (input.key === void 0 == (input.keys === void 0))
455
+ throw new Error("Provide key OR keys.");
456
+ let keys = Array.isArray(input.keys) ? input.keys : void 0, last = keys?.at(-1), modifiers = /* @__PURE__ */ new Set(["ctrl", "control", "shift", "alt", "win", "windows", "cmd", "command"]), foregroundShortcut = process.platform === "win32" && input.foreground === !0 && input.x === void 0 && keys !== void 0 && keys.length >= 2 && keys.slice(0, -1).every((key) => typeof key == "string" && modifiers.has(key.toLowerCase())) && typeof last == "string" && !modifiers.has(last.toLowerCase());
457
+ operation = input.keys === void 0 || foregroundShortcut ? "press_key" : "hotkey", foregroundShortcut ? (args.key = last, args.modifiers = keys.slice(0, -1)) : args[input.keys === void 0 ? "key" : "keys"] = input.keys ?? input.key;
458
+ break;
459
+ }
460
+ case "computer_text":
461
+ operation = "type_text", args.text = input.text;
462
+ break;
463
+ case "computer_window":
464
+ if (previous.target.desktop)
465
+ throw new Error("Window management requires an exact window target.");
466
+ if (input.action === "frame") {
467
+ for (let key of ["x", "y", "width", "height"]) {
468
+ let value = input[key];
469
+ if (typeof value != "number" || !Number.isFinite(value) || ["width", "height"].includes(key) && value <= 0)
470
+ throw new Error("Frame requires valid x/y/width/height.");
471
+ args[key] = value;
472
+ }
473
+ operation = "set_window_frame";
474
+ } else if (input.action === "focus" && ["x", "y", "width", "height"].every((key) => input[key] === void 0))
475
+ operation = "bring_to_front";
476
+ else
477
+ throw new Error("Use frame or focus. Minimize/restore uses a fresh image click on the visible control.");
478
+ break;
479
+ default:
480
+ throw new Error("Unknown computer action.");
481
+ }
482
+ return { operation, args };
483
+ }
484
+ async execute(name, input, signal) {
485
+ let combined = AbortSignal.any([
486
+ this.abort.signal,
487
+ this.lease.signal,
488
+ AbortSignal.timeout(9e4),
489
+ ...signal ? [signal] : []
490
+ ]), inputDispatched = !1, failureCode = "workflow_unavailable", phase = "validation", currentPhase = () => phase, operationName = name, actionTarget, actionOutcome;
491
+ try {
492
+ let result = await this.lease.run(async () => {
493
+ failureCode = "invalid_arguments";
494
+ let previous = this.observation;
495
+ if (name !== "computer_apps" && (this.observation = void 0), !Object.hasOwn(computerSchemas, name))
496
+ throw new Error("Unknown computer operation.");
497
+ let schema = computerSchemas[name];
498
+ if (Object.keys(input).some((key) => !Object.hasOwn(schema.properties, key)))
499
+ throw new Error("Unsupported computer argument. Use image coordinates only.");
500
+ if (name === "computer_apps" || name === "computer_launch") {
501
+ let operation2 = name === "computer_launch" ? "launch_app" : input.pid === void 0 ? "list_apps" : "list_windows";
502
+ if (operationName = operation2, input.include_windows !== void 0 && (name !== "computer_apps" || typeof input.include_windows != "boolean" || input.include_windows && (input.pid !== void 0 || typeof input.query != "string" || !input.query.trim())))
503
+ throw new Error("include_windows requires a named app query without pid.");
504
+ if (input.pid !== void 0 && (typeof input.pid != "number" || !Number.isSafeInteger(input.pid) || input.pid < 1))
505
+ throw new Error("Window lookup requires a positive pid.");
506
+ if (name === "computer_launch" && (typeof input.name != "string" || !input.name.trim() || input.name.length > 500))
507
+ throw new Error("Launch requires a nonblank name.");
508
+ if (input.query !== void 0 && (typeof input.query != "string" || !input.query.trim() || Array.from(input.query).length > 240))
509
+ throw new Error("Discovery query must be a nonblank string of at most 240 characters.");
510
+ let query = typeof input.query == "string" ? input.query.trim() : void 0, needle = query?.toLowerCase(), offset = input.offset ?? 0;
511
+ if (typeof offset != "number" || !Number.isSafeInteger(offset) || offset < 0)
512
+ throw new Error("Discovery offset must be a nonnegative safe integer.");
513
+ let args2 = name === "computer_launch" ? { name: input.name } : input.pid === void 0 ? {} : { pid: input.pid };
514
+ combined.throwIfAborted(), inputDispatched = name === "computer_launch", phase = "native_request", failureCode = "discovery_failed";
515
+ let reply2 = await abortable(this.driver.call(operation2, args2, combined), combined), data = driverData(reply2), discovered = data.apps ?? data.windows, rows = Array.isArray(discovered) && needle ? discovered.filter((row) => {
516
+ let item = record(row);
517
+ return [item.name, item.app_name, item.title].some((value) => typeof value == "string" && value.toLowerCase().includes(needle));
518
+ }) : discovered, metadata = Array.isArray(rows) ? rows.slice(offset, offset + 50).map((row) => {
519
+ let item = record(row);
520
+ return {
521
+ ...select(item, [
522
+ "pid",
523
+ "window_id",
524
+ "name",
525
+ "app_name",
526
+ "title",
527
+ "active",
528
+ "running",
529
+ "is_on_screen",
530
+ "minimized"
531
+ ]),
532
+ bounds: item.bounds ? select(record(item.bounds), ["x", "y", "width", "height"]) : void 0
533
+ };
534
+ }) : void 0, remaining = Array.isArray(rows) ? Math.max(0, rows.length - offset - (metadata?.length ?? 0)) : 0, failed2 = driverRefused(reply2), pid = typeof data.pid == "number" && Number.isSafeInteger(data.pid) && data.pid > 0 ? data.pid : void 0, launchWindows = Array.isArray(data.windows) ? data.windows.slice(0, 50).map((row) => {
535
+ let item = record(row);
536
+ return {
537
+ ...select(item, ["window_id", "title", "is_on_screen", "minimized"]),
538
+ bounds: item.bounds ? select(record(item.bounds), ["x", "y", "width", "height"]) : void 0
539
+ };
540
+ }) : [], returnedId = data.window_id ?? (Array.isArray(data.windows) && data.windows.length === 1 ? record(data.windows[0]).window_id : void 0), windowId = typeof returnedId == "number" && Number.isSafeInteger(returnedId) && returnedId > 0 ? returnedId : void 0, windowsByPid, guidance = remaining ? "Pass next_offset as offset with the same pid and query. Lists refresh per call." : input.pid !== void 0 ? "Use computer_observe({pid,window_id}) for an exact returned window." : "App query filters app identities, not every window title. Use computer_apps({pid}) to find windows for a running app.";
541
+ if (name === "computer_apps" && input.include_windows === !0 && !failed2) {
542
+ let pids = [
543
+ ...new Set((Array.isArray(rows) ? rows : []).map((row) => record(row).pid).filter((value) => typeof value == "number" && Number.isSafeInteger(value) && value > 0))
544
+ ];
545
+ if (pids.length > 5)
546
+ guidance = "More than five running processes matched. Narrow the query or choose one positive pid with computer_apps({pid}); no arbitrary process was selected.";
547
+ else {
548
+ windowsByPid = [];
549
+ let budget = 50;
550
+ for (let matchingPid of pids) {
551
+ combined.throwIfAborted();
552
+ try {
553
+ let windowsReply = await abortable(this.driver.call("list_windows", { pid: matchingPid }, combined), combined), windows = driverData(windowsReply).windows;
554
+ if (driverRefused(windowsReply) || !Array.isArray(windows)) {
555
+ windowsByPid.push({
556
+ pid: matchingPid,
557
+ error: driverRefused(windowsReply) ? nativeReason(windowsReply) : "windows_unavailable"
558
+ });
559
+ continue;
560
+ }
561
+ let subset = windows.slice(0, budget).map((row) => {
562
+ let item = record(row);
563
+ return {
564
+ ...select(item, [
565
+ "pid",
566
+ "window_id",
567
+ "name",
568
+ "app_name",
569
+ "title",
570
+ "active",
571
+ "running",
572
+ "is_on_screen",
573
+ "minimized"
574
+ ]),
575
+ bounds: item.bounds ? select(record(item.bounds), ["x", "y", "width", "height"]) : void 0
576
+ };
577
+ }), omitted = windows.length - subset.length;
578
+ windowsByPid.push({
579
+ pid: matchingPid,
580
+ windows: subset,
581
+ omitted: omitted || void 0,
582
+ next_offset: omitted ? subset.length : void 0
583
+ }), budget -= subset.length;
584
+ } catch (error) {
585
+ if (combined.aborted || error instanceof DriverCallError)
586
+ throw error;
587
+ windowsByPid.push({ pid: matchingPid, error: "window_lookup_failed" });
588
+ }
589
+ }
590
+ guidance = "Use computer_observe({pid,window_id}) for a returned window. For omitted windows use computer_apps({pid,offset:next_offset}). Per-PID failures need a targeted lookup.";
591
+ }
592
+ }
593
+ return name === "computer_launch" && (guidance = pid && windowId && !failed2 ? `Use computer_observe({pid:${pid},window_id:${windowId}}) before input.` : `Launch ${failed2 ? "may have completed despite an unsuccessful reply" : "returned no exact window"}. Use computer_apps({${pid ? `pid:${pid}` : `query:${JSON.stringify(input.name)}`}}) before another launch or input.`), {
594
+ content: [
595
+ {
596
+ type: "text",
597
+ text: JSON.stringify({
598
+ kind: name === "computer_launch" ? "launch" : input.pid === void 0 ? "apps" : "windows",
599
+ operation: operation2,
600
+ ...name === "computer_launch" ? outcome(reply2) : { phase: "native_result", code: failed2 ? nativeReason(reply2) : void 0 },
601
+ input: name === "computer_launch" ? "not_applicable" : void 0,
602
+ launch: name === "computer_launch" ? plainLaunchReason(reply2) === "app_lookup_unavailable" ? "not_started" : failed2 ? "completion_uncertain" : "acknowledged" : void 0,
603
+ ...select(data, ["pid", "window_id", "name", "title"]),
604
+ window_id: name === "computer_launch" ? windowId : select(data, ["window_id"]).window_id,
605
+ windows: name === "computer_launch" ? launchWindows : void 0,
606
+ items: name === "computer_launch" ? void 0 : metadata,
607
+ windows_by_pid: windowsByPid,
608
+ query,
609
+ offset,
610
+ total: Array.isArray(rows) ? rows.length : void 0,
611
+ omitted: remaining || void 0,
612
+ next_offset: remaining ? offset + 50 : void 0,
613
+ guidance
614
+ })
615
+ }
616
+ ],
617
+ details: { computer: { failed: failed2, workflow: "ready" } },
618
+ isError: failed2
619
+ };
620
+ }
621
+ let target = targetFrom(input);
622
+ if (actionTarget = target, name === "computer_observe") {
623
+ phase = "observation_capture";
624
+ let crop = input.crop === void 0 ? void 0 : this.crop(input, this.fresh(input, previous));
625
+ failureCode = "capture_failed";
626
+ let captured = await this.capture(target, combined, previous, crop), unchanged = this.lastCapture?.fingerprint === captured.fingerprint && sameTarget(this.lastCapture.target, target), repeats = crop ? 0 : unchanged ? (this.lastCapture?.repeats ?? 0) + 1 : 1;
627
+ return this.lastCapture = { fingerprint: captured.fingerprint, target, repeats }, repeats >= 3 ? {
628
+ content: [
629
+ {
630
+ type: "text",
631
+ text: JSON.stringify({
632
+ phase: "observation_capture",
633
+ code: "unchanged_polling_limit",
634
+ guidance: "Three captures are unchanged. Stop polling and reconsider the target or approach. No input token issued."
635
+ })
636
+ }
637
+ ],
638
+ details: { computer: { failed: !0, workflow: "stopped" } },
639
+ isError: !0
640
+ } : this.imageResult(captured, { unchanged });
641
+ }
642
+ let grounded = this.fresh(input, previous), { operation, args } = this.action(name, input, grounded), { button = "left", count = 1, modifier = [], ...clickArgs } = args, signature = JSON.stringify({
643
+ operation,
644
+ args: operation === "click" ? {
645
+ ...clickArgs,
646
+ button,
647
+ count,
648
+ modifier: Array.isArray(modifier) ? [...new Set(modifier)].sort() : modifier
649
+ } : args
650
+ });
651
+ if (this.lastAction?.unchanged && this.lastAction.signature === signature && this.lastAction.fingerprint === grounded.fingerprint)
652
+ throw new Error("The identical action had no visible change. Choose a different grounded action; never retry blindly.");
653
+ combined.throwIfAborted(), inputDispatched = !0, phase = "native_request", operationName = operation;
654
+ let reply = await abortable(this.driver.call(operation, args, combined), combined);
655
+ combined.throwIfAborted(), actionOutcome = outcome(reply, name === "computer_text" ? input.text : void 0);
656
+ let recoveryGuidance = actionOutcome.retry_from_character !== void 0 ? "Verify the field in a fresh image before considering any remaining suffix. retry_from_character is a zero-based Unicode code-point offset, not UTF-16. retryable is driver advice, not authorization to retry." : void 0, failed = driverRefused(reply) || driverData(reply).effect === "partial" || driverData(reply).status === "partial", backgroundUnavailable = actionOutcome.code === "background_unavailable";
657
+ name === "computer_hover" && await delay(700, void 0, { signal: combined }), phase = "post_action_capture";
658
+ try {
659
+ let after = await this.capture(target, combined), unchanged = after.fingerprint === grounded.fingerprint;
660
+ return this.lastAction = { signature, fingerprint: after.fingerprint, unchanged }, this.lastCapture = {
661
+ fingerprint: after.fingerprint,
662
+ target,
663
+ repeats: failed && this.lastCapture?.fingerprint === after.fingerprint && sameTarget(this.lastCapture.target, target) ? this.lastCapture.repeats : 0
664
+ }, this.imageResult(after, {
665
+ kind: "action",
666
+ operation,
667
+ target,
668
+ ...actionOutcome,
669
+ failed,
670
+ unchanged,
671
+ guidance: [
672
+ "Inspect the post-action image before another action. No visible change does not prove failure; never repeat blindly.",
673
+ backgroundUnavailable ? "After this fresh capture, foreground input may be considered if permitted, not another background shortcut." : void 0,
674
+ recoveryGuidance
675
+ ].filter(Boolean).join(" ")
676
+ });
677
+ } catch (error) {
678
+ if (combined.throwIfAborted(), !(error instanceof CaptureError))
679
+ throw error;
680
+ return this.lastAction = { signature, fingerprint: grounded.fingerprint, unchanged: !0 }, {
681
+ content: [
682
+ {
683
+ type: "text",
684
+ text: JSON.stringify({
685
+ kind: "action",
686
+ operation,
687
+ target,
688
+ ...actionOutcome,
689
+ phase: "post_action_capture",
690
+ capture_error: error.code,
691
+ observation: "unavailable",
692
+ guidance: `Input may have taken effect. ${["target_not_found", "window_target_not_found", "window_target_mismatch"].includes(error.code) ? "Use computer_apps({pid}) or observe the desktop to find the target." : "Get a fresh capture of the exact target"} before another action; never repeat blindly. ${recoveryGuidance ?? ""}`
693
+ })
694
+ }
695
+ ],
696
+ details: { computer: { failed: !0, workflow: "ready" } },
697
+ isError: !0
698
+ };
699
+ }
700
+ }, combined);
701
+ return result.details.computer.workflow !== "ready" ? this.finish(result) : result;
702
+ } catch (error) {
703
+ error instanceof DriverCallError && !(currentPhase() === "post_action_capture" && actionOutcome) && (phase = error.phase, inputDispatched = error.dispatched);
704
+ let failurePhase = currentPhase(), fatal = combined.aborted || this.abort.signal.aborted || this.lease.signal.aborted || error instanceof DriverCallError || !(error instanceof ObservationError || error instanceof CaptureError || failurePhase === "validation" || failurePhase === "observation_capture" && !inputDispatched), code = error instanceof ObservationError || error instanceof CaptureError ? error.code : inputDispatched && failurePhase === "post_action_capture" ? "capture_transport_failed" : error instanceof DriverCallError ? error.dispatched ? "input_dispatch_failed" : "adapter_preflight_failed" : inputDispatched ? "input_dispatch_failed" : failurePhase === "validation" ? "invalid_arguments" : failureCode, message = name === "computer_launch" ? inputDispatched ? "Launch request began; activation may have occurred." : "No launch request was sent by this call." : inputDispatched ? "Input may have taken effect; request began." : "No input was sent by this call.", guidance = inputDispatched ? name === "computer_launch" ? `Use computer_apps({query:${JSON.stringify(input.name)}) before considering another launch.` : `Get a fresh capture of the exact target before another action. Input may have taken effect; inspect the field before deciding and never repeat blindly. ${actionOutcome?.retry_from_character !== void 0 ? "Verify the field in a fresh image before considering any remaining suffix. retry_from_character is a zero-based Unicode code-point offset, not UTF-16." : ""}` : freshActionGuidance, result = {
705
+ content: [
706
+ {
707
+ type: "text",
708
+ text: JSON.stringify({
709
+ kind: name === "computer_apps" ? "apps" : name === "computer_launch" ? "launch" : name === "computer_observe" ? "observation" : "action",
710
+ operation: operationName,
711
+ target: actionTarget,
712
+ ...actionOutcome,
713
+ action_outcome: actionOutcome,
714
+ phase: failurePhase,
715
+ code,
716
+ input: name === "computer_apps" ? void 0 : name === "computer_launch" ? "not_applicable" : inputDispatched ? "uncertain" : "not_dispatched",
717
+ request: name === "computer_launch" ? inputDispatched ? "sent" : "not_sent" : void 0,
718
+ applicationEffect: "unverified",
719
+ observation: "unavailable",
720
+ capture_error: failurePhase === "post_action_capture" ? code : void 0,
721
+ message,
722
+ guidance
723
+ })
724
+ }
725
+ ],
726
+ details: { computer: { failed: !0, workflow: fatal ? "stopped" : "ready" } },
727
+ isError: !0
728
+ };
729
+ return fatal ? this.finish(result) : result;
730
+ }
731
+ }
732
+ async finish(result) {
733
+ try {
734
+ return await this.close(), {
735
+ ...result,
736
+ details: { ...result.details, computer: { failed: result.details.computer.failed, workflow: "stopped" } }
737
+ };
738
+ } catch {
739
+ return {
740
+ content: [
741
+ ...result.content,
742
+ {
743
+ type: "text",
744
+ text: JSON.stringify({
745
+ phase: "cleanup",
746
+ cleanup: "unconfirmed",
747
+ guidance: "Desktop ownership retained until shutdown is confirmed."
748
+ })
749
+ }
750
+ ],
751
+ details: { ...result.details, computer: { failed: !0, workflow: "cleanup_unconfirmed" } },
752
+ isError: !0
753
+ };
754
+ }
755
+ }
756
+ close() {
757
+ return this.abort.abort(), this.observation = void 0, this.closing ??= this.stop(), this.closing;
758
+ }
759
+ async stop() {
760
+ await this.driver.close(), await this.lease.close();
761
+ }
762
+ };
763
+ export {
764
+ ComputerWorkflow,
765
+ driverData,
766
+ driverRefused
767
+ };