@code-yeongyu/senpi 2026.9.12-2 → 2026.9.12-3

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 (1459) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +1 -1
  3. package/dist/bun/cli.d.ts +2 -1
  4. package/dist/bun/cli.d.ts.map +1 -1
  5. package/dist/bun/cli.js +5 -8
  6. package/dist/bun/cli.js.map +1 -1
  7. package/dist/bun/runtime-setup.d.ts +2 -0
  8. package/dist/bun/runtime-setup.d.ts.map +1 -0
  9. package/dist/bun/runtime-setup.js +9 -0
  10. package/dist/bun/runtime-setup.js.map +1 -0
  11. package/dist/bun/sandbox-env-setup.d.ts +2 -0
  12. package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
  13. package/dist/bun/sandbox-env-setup.js +4 -0
  14. package/dist/bun/sandbox-env-setup.js.map +1 -0
  15. package/dist/cli/config-selector.d.ts.map +1 -1
  16. package/dist/cli/config-selector.js +2 -1
  17. package/dist/cli/config-selector.js.map +1 -1
  18. package/dist/cli/setup.d.ts +2 -0
  19. package/dist/cli/setup.d.ts.map +1 -0
  20. package/dist/cli/setup.js +12 -0
  21. package/dist/cli/setup.js.map +1 -0
  22. package/dist/cli.js +3 -0
  23. package/dist/cli.js.map +1 -1
  24. package/dist/client/index.d.ts +1 -2
  25. package/dist/client/index.d.ts.map +1 -1
  26. package/dist/client/index.js +1 -2
  27. package/dist/client/index.js.map +1 -1
  28. package/dist/config.d.ts +1 -0
  29. package/dist/config.d.ts.map +1 -1
  30. package/dist/config.js +1 -0
  31. package/dist/config.js.map +1 -1
  32. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  33. package/dist/core/agent-session-runtime.js +13 -5
  34. package/dist/core/agent-session-runtime.js.map +1 -1
  35. package/dist/core/agent-session.d.ts +41 -8
  36. package/dist/core/agent-session.d.ts.map +1 -1
  37. package/dist/core/agent-session.js +99 -36
  38. package/dist/core/agent-session.js.map +1 -1
  39. package/dist/core/compaction/branch-summarization.d.ts +1 -1
  40. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  41. package/dist/core/compaction/branch-summarization.js +6 -4
  42. package/dist/core/compaction/branch-summarization.js.map +1 -1
  43. package/dist/core/compaction-settings-access.d.ts +18 -2
  44. package/dist/core/compaction-settings-access.d.ts.map +1 -1
  45. package/dist/core/compaction-settings-access.js +35 -4
  46. package/dist/core/compaction-settings-access.js.map +1 -1
  47. package/dist/core/compaction-settings-resolver.d.ts +2 -2
  48. package/dist/core/compaction-settings-resolver.d.ts.map +1 -1
  49. package/dist/core/compaction-settings-resolver.js +6 -3
  50. package/dist/core/compaction-settings-resolver.js.map +1 -1
  51. package/dist/core/extensions/builtin/ask-user/extension.d.ts.map +1 -1
  52. package/dist/core/extensions/builtin/ask-user/extension.js +11 -0
  53. package/dist/core/extensions/builtin/ask-user/extension.js.map +1 -1
  54. package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
  55. package/dist/core/extensions/builtin/prompt-preset/presets.js +7 -1
  56. package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
  57. package/dist/core/extensions/loader.d.ts.map +1 -1
  58. package/dist/core/extensions/loader.js +4 -2
  59. package/dist/core/extensions/loader.js.map +1 -1
  60. package/dist/core/keybindings.d.ts +10 -0
  61. package/dist/core/keybindings.d.ts.map +1 -1
  62. package/dist/core/keybindings.js +8 -0
  63. package/dist/core/keybindings.js.map +1 -1
  64. package/dist/core/messages.d.ts +1 -1
  65. package/dist/core/messages.d.ts.map +1 -1
  66. package/dist/core/messages.js.map +1 -1
  67. package/dist/core/model-registry.d.ts +5 -1
  68. package/dist/core/model-registry.d.ts.map +1 -1
  69. package/dist/core/model-registry.js +8 -0
  70. package/dist/core/model-registry.js.map +1 -1
  71. package/dist/core/model-resolver.d.ts.map +1 -1
  72. package/dist/core/model-resolver.js +2 -0
  73. package/dist/core/model-resolver.js.map +1 -1
  74. package/dist/core/model-runtime.d.ts +1 -0
  75. package/dist/core/model-runtime.d.ts.map +1 -1
  76. package/dist/core/model-runtime.js +5 -2
  77. package/dist/core/model-runtime.js.map +1 -1
  78. package/dist/core/retry-fallback/settings.d.ts +2 -0
  79. package/dist/core/retry-fallback/settings.d.ts.map +1 -1
  80. package/dist/core/retry-fallback/settings.js.map +1 -1
  81. package/dist/core/session-manager.d.ts +3 -2
  82. package/dist/core/session-manager.d.ts.map +1 -1
  83. package/dist/core/session-manager.js +47 -7
  84. package/dist/core/session-manager.js.map +1 -1
  85. package/dist/core/settings-manager.d.ts +12 -5
  86. package/dist/core/settings-manager.d.ts.map +1 -1
  87. package/dist/core/settings-manager.js +18 -6
  88. package/dist/core/settings-manager.js.map +1 -1
  89. package/dist/core/settings-public-types.d.ts +1 -1
  90. package/dist/core/settings-public-types.d.ts.map +1 -1
  91. package/dist/core/settings-public-types.js.map +1 -1
  92. package/dist/core/skills.d.ts +1 -1
  93. package/dist/core/skills.d.ts.map +1 -1
  94. package/dist/core/skills.js +6 -2
  95. package/dist/core/skills.js.map +1 -1
  96. package/dist/core/system-prompt.d.ts.map +1 -1
  97. package/dist/core/system-prompt.js +8 -9
  98. package/dist/core/system-prompt.js.map +1 -1
  99. package/dist/core/tools/bash.d.ts.map +1 -1
  100. package/dist/core/tools/bash.js +3 -142
  101. package/dist/core/tools/bash.js.map +1 -1
  102. package/dist/core/tools/edit.d.ts +1 -12
  103. package/dist/core/tools/edit.d.ts.map +1 -1
  104. package/dist/core/tools/edit.js +4 -168
  105. package/dist/core/tools/edit.js.map +1 -1
  106. package/dist/core/tools/find.d.ts.map +1 -1
  107. package/dist/core/tools/find.js +2 -53
  108. package/dist/core/tools/find.js.map +1 -1
  109. package/dist/core/tools/grep.d.ts.map +1 -1
  110. package/dist/core/tools/grep.js +2 -58
  111. package/dist/core/tools/grep.js.map +1 -1
  112. package/dist/core/tools/ls.d.ts.map +1 -1
  113. package/dist/core/tools/ls.js +2 -47
  114. package/dist/core/tools/ls.js.map +1 -1
  115. package/dist/core/tools/read.d.ts +1 -4
  116. package/dist/core/tools/read.d.ts.map +1 -1
  117. package/dist/core/tools/read.js +4 -141
  118. package/dist/core/tools/read.js.map +1 -1
  119. package/dist/core/tools/renderers/bash.d.ts +12 -0
  120. package/dist/core/tools/renderers/bash.d.ts.map +1 -0
  121. package/dist/core/tools/renderers/bash.js +156 -0
  122. package/dist/core/tools/renderers/bash.js.map +1 -0
  123. package/dist/core/tools/renderers/edit.d.ts +23 -0
  124. package/dist/core/tools/renderers/edit.d.ts.map +1 -0
  125. package/dist/core/tools/renderers/edit.js +172 -0
  126. package/dist/core/tools/renderers/edit.js.map +1 -0
  127. package/dist/core/tools/renderers/find.d.ts +10 -0
  128. package/dist/core/tools/renderers/find.d.ts.map +1 -0
  129. package/dist/core/tools/renderers/find.js +64 -0
  130. package/dist/core/tools/renderers/find.js.map +1 -0
  131. package/dist/core/tools/renderers/grep.d.ts +10 -0
  132. package/dist/core/tools/renderers/grep.d.ts.map +1 -0
  133. package/dist/core/tools/renderers/grep.js +69 -0
  134. package/dist/core/tools/renderers/grep.js.map +1 -0
  135. package/dist/core/tools/renderers/index.d.ts +28 -0
  136. package/dist/core/tools/renderers/index.d.ts.map +1 -0
  137. package/dist/core/tools/renderers/index.js +47 -0
  138. package/dist/core/tools/renderers/index.js.map +1 -0
  139. package/dist/core/tools/renderers/ls.d.ts +10 -0
  140. package/dist/core/tools/renderers/ls.d.ts.map +1 -0
  141. package/dist/core/tools/renderers/ls.js +58 -0
  142. package/dist/core/tools/renderers/ls.js.map +1 -0
  143. package/dist/core/tools/renderers/read.d.ts +19 -0
  144. package/dist/core/tools/renderers/read.d.ts.map +1 -0
  145. package/dist/core/tools/renderers/read.js +149 -0
  146. package/dist/core/tools/renderers/read.js.map +1 -0
  147. package/dist/core/tools/renderers/write.d.ts +10 -0
  148. package/dist/core/tools/renderers/write.d.ts.map +1 -0
  149. package/dist/core/tools/renderers/write.js +162 -0
  150. package/dist/core/tools/renderers/write.js.map +1 -0
  151. package/dist/core/tools/write.d.ts.map +1 -1
  152. package/dist/core/tools/write.js +4 -153
  153. package/dist/core/tools/write.js.map +1 -1
  154. package/dist/index.d.ts +2 -2
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js.map +1 -1
  157. package/dist/migrations.d.ts.map +1 -1
  158. package/dist/migrations.js +2 -2
  159. package/dist/migrations.js.map +1 -1
  160. package/dist/modes/app-server/threads/turn-runtime.d.ts +3 -1
  161. package/dist/modes/app-server/threads/turn-runtime.d.ts.map +1 -1
  162. package/dist/modes/app-server/threads/turn-runtime.js.map +1 -1
  163. package/dist/modes/app-server/threads/turns.js +1 -1
  164. package/dist/modes/app-server/threads/turns.js.map +1 -1
  165. package/dist/modes/app-server/turn-adapter.js +4 -2
  166. package/dist/modes/app-server/turn-adapter.js.map +1 -1
  167. package/dist/modes/interactive/chat-viewport.d.ts +22 -0
  168. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
  169. package/dist/modes/interactive/chat-viewport.js +29 -0
  170. package/dist/modes/interactive/chat-viewport.js.map +1 -0
  171. package/dist/modes/interactive/components/ask-user-answer-key.d.ts +14 -0
  172. package/dist/modes/interactive/components/ask-user-answer-key.d.ts.map +1 -0
  173. package/dist/modes/interactive/components/ask-user-answer-key.js +65 -0
  174. package/dist/modes/interactive/components/ask-user-answer-key.js.map +1 -0
  175. package/dist/modes/interactive/components/ask-user-async-widget.d.ts +17 -14
  176. package/dist/modes/interactive/components/ask-user-async-widget.d.ts.map +1 -1
  177. package/dist/modes/interactive/components/ask-user-async-widget.js +47 -39
  178. package/dist/modes/interactive/components/ask-user-async-widget.js.map +1 -1
  179. package/dist/modes/interactive/components/assistant-message.d.ts +7 -0
  180. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  181. package/dist/modes/interactive/components/assistant-message.js +26 -2
  182. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  183. package/dist/modes/interactive/components/assistant-render-descriptors.d.ts +4 -0
  184. package/dist/modes/interactive/components/assistant-render-descriptors.d.ts.map +1 -1
  185. package/dist/modes/interactive/components/assistant-render-descriptors.js +8 -5
  186. package/dist/modes/interactive/components/assistant-render-descriptors.js.map +1 -1
  187. package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
  188. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  189. package/dist/modes/interactive/components/custom-editor.js +37 -1
  190. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  191. package/dist/modes/interactive/components/index.d.ts +1 -1
  192. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  193. package/dist/modes/interactive/components/index.js.map +1 -1
  194. package/dist/modes/interactive/components/scoped-models-selector.js +8 -8
  195. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  196. package/dist/modes/interactive/components/status-indicator.d.ts +4 -1
  197. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  198. package/dist/modes/interactive/components/status-indicator.js +14 -2
  199. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  200. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  201. package/dist/modes/interactive/components/thinking-selector.js +4 -4
  202. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  203. package/dist/modes/interactive/components/tool-execution-renderer.d.ts +4 -1
  204. package/dist/modes/interactive/components/tool-execution-renderer.d.ts.map +1 -1
  205. package/dist/modes/interactive/components/tool-execution-renderer.js +23 -10
  206. package/dist/modes/interactive/components/tool-execution-renderer.js.map +1 -1
  207. package/dist/modes/interactive/components/tool-execution-types.d.ts +18 -2
  208. package/dist/modes/interactive/components/tool-execution-types.d.ts.map +1 -1
  209. package/dist/modes/interactive/components/tool-execution-types.js.map +1 -1
  210. package/dist/modes/interactive/components/tool-execution.d.ts +3 -3
  211. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  212. package/dist/modes/interactive/components/tool-execution.js +5 -0
  213. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  214. package/dist/modes/interactive/interactive-mode.d.ts +10 -15
  215. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  216. package/dist/modes/interactive/interactive-mode.js +178 -138
  217. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  218. package/dist/modes/interactive/theme/dark.json +2 -1
  219. package/dist/modes/interactive/theme/grok-day.json +2 -1
  220. package/dist/modes/interactive/theme/grok-night.json +2 -1
  221. package/dist/modes/interactive/theme/light.json +2 -1
  222. package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
  223. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  224. package/dist/modes/interactive/theme/theme-controller.js +5 -0
  225. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  226. package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
  227. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  228. package/dist/modes/interactive/theme/theme-json.js +130 -0
  229. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  230. package/dist/modes/interactive/theme/theme-schema.json +6 -2
  231. package/dist/modes/interactive/theme/theme.d.ts +10 -5
  232. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  233. package/dist/modes/interactive/theme/theme.js +14 -117
  234. package/dist/modes/interactive/theme/theme.js.map +1 -1
  235. package/dist/modes/interactive/tips/catalog/input-tips.d.ts +5 -0
  236. package/dist/modes/interactive/tips/catalog/input-tips.d.ts.map +1 -1
  237. package/dist/modes/interactive/tips/catalog/input-tips.js +5 -0
  238. package/dist/modes/interactive/tips/catalog/input-tips.js.map +1 -1
  239. package/dist/modes/interactive/tui-renderer.d.ts +21 -0
  240. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
  241. package/dist/modes/interactive/tui-renderer.js +67 -0
  242. package/dist/modes/interactive/tui-renderer.js.map +1 -0
  243. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  244. package/dist/modes/rpc/connection-handler.js +8 -2
  245. package/dist/modes/rpc/connection-handler.js.map +1 -1
  246. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  247. package/dist/modes/rpc/rpc-client.js +11 -1
  248. package/dist/modes/rpc/rpc-client.js.map +1 -1
  249. package/dist/senpi +3 -0
  250. package/dist/utils/clipboard-command.d.ts +7 -0
  251. package/dist/utils/clipboard-command.d.ts.map +1 -0
  252. package/dist/utils/clipboard-command.js +45 -0
  253. package/dist/utils/clipboard-command.js.map +1 -0
  254. package/dist/utils/clipboard-image.d.ts.map +1 -1
  255. package/dist/utils/clipboard-image.js +52 -69
  256. package/dist/utils/clipboard-image.js.map +1 -1
  257. package/dist/utils/clipboard.d.ts.map +1 -1
  258. package/dist/utils/clipboard.js +49 -126
  259. package/dist/utils/clipboard.js.map +1 -1
  260. package/dist/utils/exif-orientation.d.ts.map +1 -1
  261. package/dist/utils/exif-orientation.js +2 -3
  262. package/dist/utils/exif-orientation.js.map +1 -1
  263. package/dist/utils/tools-manager.d.ts +1 -0
  264. package/dist/utils/tools-manager.d.ts.map +1 -1
  265. package/dist/utils/tools-manager.js +41 -19
  266. package/dist/utils/tools-manager.js.map +1 -1
  267. package/docs/compaction.md +39 -13
  268. package/docs/containerization.md +45 -0
  269. package/docs/development.md +19 -0
  270. package/docs/docs.json +4 -0
  271. package/docs/environment-variables.md +2 -0
  272. package/docs/extensions.md +21 -10
  273. package/docs/keybindings.md +7 -2
  274. package/docs/models.md +1 -1
  275. package/docs/providers.md +1 -1
  276. package/docs/rpc.md +2 -2
  277. package/docs/sdk.md +7 -0
  278. package/docs/session-format.md +52 -38
  279. package/docs/settings.md +40 -4
  280. package/docs/skills.md +1 -1
  281. package/docs/termux.md +0 -1
  282. package/docs/themes.md +8 -6
  283. package/docs/tui.md +22 -3
  284. package/examples/README.md +3 -0
  285. package/examples/extensions/dynamic-resources/dynamic.json +2 -0
  286. package/examples/plugins/pi-example-plugin/README.md +38 -0
  287. package/examples/plugins/pi-example-plugin/package.json +10 -0
  288. package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  289. package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
  290. package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  291. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js +1 -1
  292. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +3 -3
  293. package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +5 -0
  294. package/node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js +3 -0
  295. package/node_modules/@aws-sdk/core/dist-es/submodules/util/index.js +1 -0
  296. package/node_modules/@aws-sdk/core/dist-types/submodules/util/hasOwn.d.ts +4 -0
  297. package/node_modules/@aws-sdk/core/dist-types/submodules/util/index.d.ts +1 -0
  298. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/hasOwn.d.ts +1 -0
  299. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +1 -0
  300. package/node_modules/@aws-sdk/core/package.json +1 -1
  301. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  302. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  303. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  304. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  305. package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +2 -0
  306. package/node_modules/@aws-sdk/credential-provider-node/dist-es/runtime/memoize-chain.js +2 -0
  307. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  308. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  309. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/LICENSE +201 -0
  310. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/README.md +62 -0
  311. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +158 -0
  312. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/constants.js +2 -0
  313. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js +16 -0
  314. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +84 -0
  315. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js +8 -0
  316. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js +11 -0
  317. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js +10 -0
  318. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/index.js +4 -0
  319. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js +5 -0
  320. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js +7 -0
  321. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js +7 -0
  322. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js +8 -0
  323. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/constants.d.ts +8 -0
  324. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromEnvSigningName.d.ts +18 -0
  325. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromSso.d.ts +12 -0
  326. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromStatic.d.ts +9 -0
  327. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/getNewSsoOidcToken.d.ts +8 -0
  328. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/getSsoOidcClient.d.ts +7 -0
  329. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/index.d.ts +7 -0
  330. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/nodeProvider.d.ts +18 -0
  331. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/constants.d.ts +3 -0
  332. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromEnvSigningName.d.ts +8 -0
  333. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromSso.d.ts +10 -0
  334. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromStatic.d.ts +5 -0
  335. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/getNewSsoOidcToken.d.ts +9 -0
  336. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/getSsoOidcClient.d.ts +7 -0
  337. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/index.d.ts +7 -0
  338. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/nodeProvider.d.ts +3 -0
  339. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/validateTokenExpiry.d.ts +2 -0
  340. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/validateTokenKey.d.ts +1 -0
  341. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/writeSSOTokenToFile.d.ts +2 -0
  342. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/validateTokenExpiry.d.ts +5 -0
  343. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/validateTokenKey.d.ts +4 -0
  344. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/writeSSOTokenToFile.d.ts +5 -0
  345. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +69 -0
  346. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  347. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  348. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  349. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  350. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  351. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  352. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  353. package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
  354. package/node_modules/@aws-sdk/token-providers/package.json +1 -1
  355. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
  356. package/node_modules/@code-yeongyu/senpi-codemode/package.json +5 -5
  357. package/node_modules/@earendil-works/chord/README.md +205 -0
  358. package/node_modules/@earendil-works/chord/dist/api.d.ts +15 -0
  359. package/node_modules/@earendil-works/chord/dist/api.d.ts.map +1 -0
  360. package/node_modules/@earendil-works/chord/dist/api.js +72 -0
  361. package/node_modules/@earendil-works/chord/dist/api.js.map +1 -0
  362. package/node_modules/@earendil-works/chord/dist/bundler.d.ts +6 -0
  363. package/node_modules/@earendil-works/chord/dist/bundler.d.ts.map +1 -0
  364. package/node_modules/@earendil-works/chord/dist/bundler.js +3 -0
  365. package/node_modules/@earendil-works/chord/dist/bundler.js.map +1 -0
  366. package/node_modules/@earendil-works/chord/dist/context/index.d.ts +24 -0
  367. package/node_modules/@earendil-works/chord/dist/context/index.d.ts.map +1 -0
  368. package/node_modules/@earendil-works/chord/dist/context/index.js +97 -0
  369. package/node_modules/@earendil-works/chord/dist/context/index.js.map +1 -0
  370. package/node_modules/@earendil-works/chord/dist/delta/index.d.ts +119 -0
  371. package/node_modules/@earendil-works/chord/dist/delta/index.d.ts.map +1 -0
  372. package/node_modules/@earendil-works/chord/dist/delta/index.js +1209 -0
  373. package/node_modules/@earendil-works/chord/dist/delta/index.js.map +1 -0
  374. package/node_modules/@earendil-works/chord/dist/facets/host.d.ts +12 -0
  375. package/node_modules/@earendil-works/chord/dist/facets/host.d.ts.map +1 -0
  376. package/node_modules/@earendil-works/chord/dist/facets/host.js +762 -0
  377. package/node_modules/@earendil-works/chord/dist/facets/host.js.map +1 -0
  378. package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts +3 -0
  379. package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts.map +1 -0
  380. package/node_modules/@earendil-works/chord/dist/facets/loader.js +5 -0
  381. package/node_modules/@earendil-works/chord/dist/facets/loader.js.map +1 -0
  382. package/node_modules/@earendil-works/chord/dist/index.d.ts +11 -0
  383. package/node_modules/@earendil-works/chord/dist/index.d.ts.map +1 -0
  384. package/node_modules/@earendil-works/chord/dist/index.js +10 -0
  385. package/node_modules/@earendil-works/chord/dist/index.js.map +1 -0
  386. package/node_modules/@earendil-works/chord/dist/json.d.ts +4 -0
  387. package/node_modules/@earendil-works/chord/dist/json.d.ts.map +1 -0
  388. package/node_modules/@earendil-works/chord/dist/json.js +57 -0
  389. package/node_modules/@earendil-works/chord/dist/json.js.map +1 -0
  390. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts +30 -0
  391. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts.map +1 -0
  392. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +377 -0
  393. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js.map +1 -0
  394. package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts +26 -0
  395. package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts.map +1 -0
  396. package/node_modules/@earendil-works/chord/dist/node/bundle.js +183 -0
  397. package/node_modules/@earendil-works/chord/dist/node/bundle.js.map +1 -0
  398. package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts +36 -0
  399. package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts.map +1 -0
  400. package/node_modules/@earendil-works/chord/dist/node/manifest.js +6 -0
  401. package/node_modules/@earendil-works/chord/dist/node/manifest.js.map +1 -0
  402. package/node_modules/@earendil-works/chord/dist/node/package.d.ts +15 -0
  403. package/node_modules/@earendil-works/chord/dist/node/package.d.ts.map +1 -0
  404. package/node_modules/@earendil-works/chord/dist/node/package.js +199 -0
  405. package/node_modules/@earendil-works/chord/dist/node/package.js.map +1 -0
  406. package/node_modules/@earendil-works/chord/dist/node.d.ts +5 -0
  407. package/node_modules/@earendil-works/chord/dist/node.d.ts.map +1 -0
  408. package/node_modules/@earendil-works/chord/dist/node.js +3 -0
  409. package/node_modules/@earendil-works/chord/dist/node.js.map +1 -0
  410. package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts +11 -0
  411. package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts.map +1 -0
  412. package/node_modules/@earendil-works/chord/dist/services/consumer.js +535 -0
  413. package/node_modules/@earendil-works/chord/dist/services/consumer.js.map +1 -0
  414. package/node_modules/@earendil-works/chord/dist/services/errors.d.ts +8 -0
  415. package/node_modules/@earendil-works/chord/dist/services/errors.d.ts.map +1 -0
  416. package/node_modules/@earendil-works/chord/dist/services/errors.js +21 -0
  417. package/node_modules/@earendil-works/chord/dist/services/errors.js.map +1 -0
  418. package/node_modules/@earendil-works/chord/dist/services/handle.d.ts +15 -0
  419. package/node_modules/@earendil-works/chord/dist/services/handle.d.ts.map +1 -0
  420. package/node_modules/@earendil-works/chord/dist/services/handle.js +99 -0
  421. package/node_modules/@earendil-works/chord/dist/services/handle.js.map +1 -0
  422. package/node_modules/@earendil-works/chord/dist/services/instances.d.ts +25 -0
  423. package/node_modules/@earendil-works/chord/dist/services/instances.d.ts.map +1 -0
  424. package/node_modules/@earendil-works/chord/dist/services/instances.js +137 -0
  425. package/node_modules/@earendil-works/chord/dist/services/instances.js.map +1 -0
  426. package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts +5 -0
  427. package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts.map +1 -0
  428. package/node_modules/@earendil-works/chord/dist/services/loopback.js +15 -0
  429. package/node_modules/@earendil-works/chord/dist/services/loopback.js.map +1 -0
  430. package/node_modules/@earendil-works/chord/dist/services/provider.d.ts +37 -0
  431. package/node_modules/@earendil-works/chord/dist/services/provider.d.ts.map +1 -0
  432. package/node_modules/@earendil-works/chord/dist/services/provider.js +472 -0
  433. package/node_modules/@earendil-works/chord/dist/services/provider.js.map +1 -0
  434. package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +15 -0
  435. package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts.map +1 -0
  436. package/node_modules/@earendil-works/chord/dist/services/state-codec.js +115 -0
  437. package/node_modules/@earendil-works/chord/dist/services/state-codec.js.map +1 -0
  438. package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts +11 -0
  439. package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts.map +1 -0
  440. package/node_modules/@earendil-works/chord/dist/services/state-internals.js +10 -0
  441. package/node_modules/@earendil-works/chord/dist/services/state-internals.js.map +1 -0
  442. package/node_modules/@earendil-works/chord/dist/services/state.d.ts +23 -0
  443. package/node_modules/@earendil-works/chord/dist/services/state.d.ts.map +1 -0
  444. package/node_modules/@earendil-works/chord/dist/services/state.js +124 -0
  445. package/node_modules/@earendil-works/chord/dist/services/state.js.map +1 -0
  446. package/node_modules/@earendil-works/chord/dist/services/wire.d.ts +60 -0
  447. package/node_modules/@earendil-works/chord/dist/services/wire.d.ts.map +1 -0
  448. package/node_modules/@earendil-works/chord/dist/services/wire.js +173 -0
  449. package/node_modules/@earendil-works/chord/dist/services/wire.js.map +1 -0
  450. package/node_modules/@earendil-works/chord/dist/types.d.ts +203 -0
  451. package/node_modules/@earendil-works/chord/dist/types.d.ts.map +1 -0
  452. package/node_modules/@earendil-works/chord/dist/types.js +2 -0
  453. package/node_modules/@earendil-works/chord/dist/types.js.map +1 -0
  454. package/node_modules/@earendil-works/chord/package.json +73 -0
  455. package/node_modules/@earendil-works/pi-agent-core/README.md +4 -0
  456. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +639 -384
  457. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  458. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +5 -250
  459. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  460. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +12 -6
  461. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  462. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +33 -27
  463. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
  464. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +30 -8
  465. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
  466. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +53 -64
  467. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
  468. package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.d.ts +9 -0
  469. package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.d.ts.map +1 -0
  470. package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +35 -0
  471. package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js.map +1 -0
  472. package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts +9 -0
  473. package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts.map +1 -0
  474. package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +13 -0
  475. package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js.map +1 -0
  476. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +25 -28
  477. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
  478. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +368 -125
  479. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
  480. package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts +20 -38
  481. package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts.map +1 -1
  482. package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +233 -55
  483. package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js.map +1 -1
  484. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.d.ts +42 -0
  485. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.d.ts.map +1 -0
  486. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +82 -0
  487. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js.map +1 -0
  488. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts +22 -0
  489. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts.map +1 -0
  490. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +48 -0
  491. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js.map +1 -0
  492. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.d.ts +67 -0
  493. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.d.ts.map +1 -0
  494. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +121 -0
  495. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js.map +1 -0
  496. package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts +38 -0
  497. package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts.map +1 -0
  498. package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +404 -0
  499. package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js.map +1 -0
  500. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +2 -2
  501. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
  502. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
  503. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +3 -2
  504. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -1
  505. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +17 -17
  506. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -1
  507. package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts +93 -0
  508. package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts.map +1 -1
  509. package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js +39 -0
  510. package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js.map +1 -1
  511. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.d.ts +28 -0
  512. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.d.ts.map +1 -0
  513. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +173 -0
  514. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js.map +1 -0
  515. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.d.ts +8 -0
  516. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.d.ts.map +1 -0
  517. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +133 -0
  518. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js.map +1 -0
  519. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.d.ts +15 -0
  520. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.d.ts.map +1 -0
  521. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +179 -0
  522. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js.map +1 -0
  523. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.d.ts +8 -0
  524. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.d.ts.map +1 -0
  525. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +205 -0
  526. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js.map +1 -0
  527. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.d.ts +5 -0
  528. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.d.ts.map +1 -0
  529. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +140 -0
  530. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js.map +1 -0
  531. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.d.ts +8 -0
  532. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.d.ts.map +1 -0
  533. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +85 -0
  534. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js.map +1 -0
  535. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.d.ts +23 -0
  536. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.d.ts.map +1 -0
  537. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +394 -0
  538. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js.map +1 -0
  539. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.d.ts +4 -0
  540. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.d.ts.map +1 -0
  541. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +34 -0
  542. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js.map +1 -0
  543. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.d.ts +32 -0
  544. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.d.ts.map +1 -0
  545. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +929 -0
  546. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js.map +1 -0
  547. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.d.ts +7 -0
  548. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.d.ts.map +1 -0
  549. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +49 -0
  550. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js.map +1 -0
  551. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.d.ts +14 -0
  552. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.d.ts.map +1 -0
  553. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +244 -0
  554. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js.map +1 -0
  555. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.d.ts +6 -0
  556. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.d.ts.map +1 -0
  557. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +449 -0
  558. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js.map +1 -0
  559. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.d.ts +6 -0
  560. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.d.ts.map +1 -0
  561. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +93 -0
  562. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js.map +1 -0
  563. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts +59 -0
  564. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts.map +1 -0
  565. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +302 -0
  566. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js.map +1 -0
  567. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.d.ts +2 -0
  568. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.d.ts.map +1 -0
  569. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +2 -0
  570. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js.map +1 -0
  571. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts +118 -0
  572. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts.map +1 -0
  573. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +1559 -0
  574. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js.map +1 -0
  575. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.d.ts +15 -0
  576. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.d.ts.map +1 -0
  577. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +66 -0
  578. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js.map +1 -0
  579. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts +5 -0
  580. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts.map +1 -0
  581. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +240 -0
  582. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js.map +1 -0
  583. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.d.ts +24 -0
  584. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.d.ts.map +1 -0
  585. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +117 -0
  586. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js.map +1 -0
  587. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.d.ts +21 -0
  588. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.d.ts.map +1 -0
  589. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +72 -0
  590. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js.map +1 -0
  591. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts +105 -0
  592. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts.map +1 -0
  593. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +50 -0
  594. package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js.map +1 -0
  595. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts +53 -0
  596. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts.map +1 -0
  597. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +57 -0
  598. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js.map +1 -0
  599. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts +6 -19
  600. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts.map +1 -1
  601. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +31 -53
  602. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js.map +1 -1
  603. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts +21 -0
  604. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts.map +1 -0
  605. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +55 -0
  606. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js.map +1 -0
  607. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +16 -0
  608. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts.map +1 -0
  609. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +79 -0
  610. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js.map +1 -0
  611. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.d.ts +39 -0
  612. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.d.ts.map +1 -0
  613. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +269 -0
  614. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js.map +1 -0
  615. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts +9 -5
  616. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts.map +1 -1
  617. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js +7 -4
  618. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js.map +1 -1
  619. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts +19 -8
  620. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts.map +1 -1
  621. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +34 -219
  622. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js.map +1 -1
  623. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.d.ts +38 -0
  624. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.d.ts.map +1 -0
  625. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js +266 -0
  626. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js.map +1 -0
  627. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts +4 -0
  628. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts.map +1 -0
  629. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +4 -0
  630. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js.map +1 -0
  631. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.d.ts +14 -0
  632. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.d.ts.map +1 -0
  633. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js +86 -0
  634. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js.map +1 -0
  635. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.d.ts +44 -0
  636. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.d.ts.map +1 -0
  637. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +454 -0
  638. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js.map +1 -0
  639. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts +27 -24
  640. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts.map +1 -1
  641. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +276 -151
  642. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js.map +1 -1
  643. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts +39 -41
  644. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts.map +1 -1
  645. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +175 -196
  646. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js.map +1 -1
  647. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts +23 -22
  648. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts.map +1 -1
  649. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js +2 -1
  650. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js.map +1 -1
  651. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts +44 -40
  652. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts.map +1 -1
  653. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js +333 -115
  654. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js.map +1 -1
  655. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts +8 -0
  656. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts.map +1 -0
  657. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +22 -0
  658. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js.map +1 -0
  659. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +78 -51
  660. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
  661. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +327 -207
  662. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
  663. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.d.ts +12 -0
  664. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.d.ts.map +1 -0
  665. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +24 -0
  666. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js.map +1 -0
  667. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.d.ts +42 -0
  668. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.d.ts.map +1 -0
  669. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +127 -0
  670. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js.map +1 -0
  671. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.d.ts +25 -0
  672. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.d.ts.map +1 -0
  673. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +114 -0
  674. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js.map +1 -0
  675. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.d.ts +23 -0
  676. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.d.ts.map +1 -0
  677. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +809 -0
  678. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js.map +1 -0
  679. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.d.ts +4 -0
  680. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.d.ts.map +1 -0
  681. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +600 -0
  682. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js.map +1 -0
  683. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.d.ts +26 -0
  684. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.d.ts.map +1 -0
  685. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +103 -0
  686. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js.map +1 -0
  687. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.d.ts +9 -2
  688. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.d.ts.map +1 -1
  689. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js +8 -1
  690. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js.map +1 -1
  691. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.d.ts +11 -0
  692. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.d.ts.map +1 -0
  693. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +19 -0
  694. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js.map +1 -0
  695. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.d.ts +20 -0
  696. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.d.ts.map +1 -0
  697. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +40 -0
  698. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js.map +1 -0
  699. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.d.ts +5 -7
  700. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.d.ts.map +1 -1
  701. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.js.map +1 -1
  702. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +425 -265
  703. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts.map +1 -1
  704. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js +7 -7
  705. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js.map +1 -1
  706. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts +95 -0
  707. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts.map +1 -0
  708. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +81 -0
  709. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js.map +1 -0
  710. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +3 -2
  711. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -1
  712. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +29 -26
  713. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -1
  714. package/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts +64 -43
  715. package/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts.map +1 -1
  716. package/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js +45 -26
  717. package/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js.map +1 -1
  718. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts +4 -4
  719. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts.map +1 -1
  720. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +66 -93
  721. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js.map +1 -1
  722. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts.map +1 -1
  723. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +17 -13
  724. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js.map +1 -1
  725. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.d.ts +2 -1
  726. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.d.ts.map +1 -1
  727. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +5 -5
  728. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js.map +1 -1
  729. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.d.ts +3 -2
  730. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.d.ts.map +1 -1
  731. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +5 -5
  732. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js.map +1 -1
  733. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts +2 -1
  734. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts.map +1 -1
  735. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +4 -6
  736. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js.map +1 -1
  737. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts.map +1 -1
  738. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +12 -8
  739. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -1
  740. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +128 -45
  741. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
  742. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
  743. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.d.ts +24 -0
  744. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.d.ts.map +1 -0
  745. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +79 -0
  746. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js.map +1 -0
  747. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts +31 -0
  748. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts.map +1 -0
  749. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +217 -0
  750. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js.map +1 -0
  751. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +19 -5
  752. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -1
  753. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +65 -192
  754. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -1
  755. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +1 -0
  756. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -1
  757. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +1 -1
  758. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -1
  759. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.d.ts +4 -0
  760. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.d.ts.map +1 -0
  761. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +33 -0
  762. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js.map +1 -0
  763. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +4 -1
  764. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  765. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +3 -6
  766. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  767. package/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts +24 -16
  768. package/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts.map +1 -1
  769. package/node_modules/@earendil-works/pi-agent-core/dist/search/index.js +1 -1
  770. package/node_modules/@earendil-works/pi-agent-core/dist/search/index.js.map +1 -1
  771. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +2 -0
  772. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  773. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  774. package/node_modules/@earendil-works/pi-agent-core/package.json +27 -6
  775. package/node_modules/@earendil-works/pi-ai/README.md +39 -4
  776. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  777. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +8 -1
  778. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  779. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.d.ts +77 -0
  780. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.d.ts.map +1 -0
  781. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.js +72 -0
  782. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.js.map +1 -0
  783. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +4 -1
  784. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  785. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  786. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +6 -3
  787. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  788. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  789. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +4 -1
  790. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  791. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  792. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +13 -3
  793. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  794. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
  795. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  796. package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
  797. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  798. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +1 -0
  799. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  800. package/node_modules/@earendil-works/pi-ai/dist/models.js +5 -2
  801. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  802. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts +1 -1
  803. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts.map +1 -1
  804. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.js.map +1 -1
  805. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
  806. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +4 -0
  807. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js.map +1 -1
  808. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  809. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  810. package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  811. package/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -1
  812. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  813. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  814. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  815. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  816. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  817. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -1
  818. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  819. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
  820. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +5 -5
  821. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  822. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.d.ts.map +1 -1
  823. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +4 -3
  824. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js.map +1 -1
  825. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.d.ts +4 -0
  826. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.d.ts.map +1 -0
  827. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.js +22 -0
  828. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.js.map +1 -0
  829. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.d.ts.map +1 -1
  830. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js +5 -4
  831. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js.map +1 -1
  832. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +16 -6
  833. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  834. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  835. package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +77 -0
  836. package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts.map +1 -0
  837. package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +427 -0
  838. package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js.map +1 -0
  839. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
  840. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +25 -5
  841. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
  842. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts +1 -1
  843. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
  844. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +5 -1
  845. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
  846. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts +10 -1
  847. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts.map +1 -1
  848. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.js.map +1 -1
  849. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +13 -2
  850. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  851. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +18 -7
  852. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  853. package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts +2 -2
  854. package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts.map +1 -1
  855. package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js +36 -31
  856. package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js.map +1 -1
  857. package/node_modules/@earendil-works/pi-ai/package.json +6 -6
  858. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  859. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  860. package/node_modules/@earendil-works/pi-tui/README.md +53 -4
  861. package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts +21 -1
  862. package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts.map +1 -1
  863. package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.js +199 -42
  864. package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.js.map +1 -1
  865. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +3 -1
  866. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -1
  867. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +28 -0
  868. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -1
  869. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +6 -1
  870. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
  871. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +98 -18
  872. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  873. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +12 -1
  874. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
  875. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +40 -6
  876. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
  877. package/node_modules/@earendil-works/pi-tui/dist/components/latex.d.ts.map +1 -1
  878. package/node_modules/@earendil-works/pi-tui/dist/components/latex.js +7 -0
  879. package/node_modules/@earendil-works/pi-tui/dist/components/latex.js.map +1 -1
  880. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +3 -0
  881. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -1
  882. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +20 -8
  883. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -1
  884. package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts +12 -0
  885. package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts.map +1 -0
  886. package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.js +19 -0
  887. package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.js.map +1 -0
  888. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +6 -3
  889. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts.map +1 -1
  890. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js +6 -1
  891. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js.map +1 -1
  892. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +4 -1
  893. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -1
  894. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +48 -2
  895. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -1
  896. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +5 -1
  897. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
  898. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +54 -5
  899. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
  900. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +3 -1
  901. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  902. package/node_modules/@earendil-works/pi-tui/dist/index.js +3 -0
  903. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  904. package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts +3 -1
  905. package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts.map +1 -1
  906. package/node_modules/@earendil-works/pi-tui/dist/layout.js +32 -9
  907. package/node_modules/@earendil-works/pi-tui/dist/layout.js.map +1 -1
  908. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +2 -1
  909. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -1
  910. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +3 -44
  911. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -1
  912. package/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts +18 -0
  913. package/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts.map +1 -0
  914. package/node_modules/@earendil-works/pi-tui/dist/native-platform.js +42 -0
  915. package/node_modules/@earendil-works/pi-tui/dist/native-platform.js.map +1 -0
  916. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  917. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +2 -20
  918. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  919. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +31 -1
  920. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  921. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +335 -41
  922. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  923. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +83 -5
  924. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  925. package/node_modules/@earendil-works/pi-tui/dist/tui.js +118 -4
  926. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  927. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +2 -0
  928. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
  929. package/node_modules/@earendil-works/pi-tui/dist/utils.js +9 -0
  930. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
  931. package/node_modules/@earendil-works/pi-tui/native/clipboard.h +170 -0
  932. package/node_modules/@earendil-works/pi-tui/native/darwin/README.md +8 -6
  933. package/node_modules/@earendil-works/pi-tui/native/darwin/build.sh +12 -5
  934. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/{darwin-modifiers.node → darwin-platform.node} +0 -0
  935. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/{darwin-modifiers.node → darwin-platform.node} +0 -0
  936. package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-platform.m +93 -0
  937. package/node_modules/@earendil-works/pi-tui/native/linux/README.md +23 -0
  938. package/node_modules/@earendil-works/pi-tui/native/linux/build.sh +65 -0
  939. package/node_modules/@earendil-works/pi-tui/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  940. package/node_modules/@earendil-works/pi-tui/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  941. package/node_modules/@earendil-works/pi-tui/native/linux/src/clipboard-worker.h +70 -0
  942. package/node_modules/@earendil-works/pi-tui/native/linux/src/linux-platform-x11.c +274 -0
  943. package/node_modules/@earendil-works/pi-tui/native/napi.h +89 -0
  944. package/node_modules/@earendil-works/pi-tui/native/win32/README.md +18 -7
  945. package/node_modules/@earendil-works/pi-tui/native/win32/build.mjs +7 -4
  946. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  947. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  948. package/node_modules/@earendil-works/pi-tui/native/win32/src/win32-platform.c +241 -0
  949. package/node_modules/@earendil-works/pi-tui/package.json +10 -3
  950. package/node_modules/@google/genai/dist/genai.d.ts +1799 -289
  951. package/node_modules/@google/genai/dist/index.cjs +319 -299
  952. package/node_modules/@google/genai/dist/index.mjs +319 -299
  953. package/node_modules/@google/genai/dist/index.mjs.map +1 -1
  954. package/node_modules/@google/genai/dist/node/index.cjs +320 -300
  955. package/node_modules/@google/genai/dist/node/index.mjs +320 -300
  956. package/node_modules/@google/genai/dist/node/index.mjs.map +1 -1
  957. package/node_modules/@google/genai/dist/node/node.d.ts +1799 -289
  958. package/node_modules/@google/genai/dist/tokenizer/node.cjs +49 -2
  959. package/node_modules/@google/genai/dist/tokenizer/node.d.ts +43 -3
  960. package/node_modules/@google/genai/dist/tokenizer/node.mjs +49 -2
  961. package/node_modules/@google/genai/dist/tokenizer/node.mjs.map +1 -1
  962. package/node_modules/@google/genai/dist/vertex_internal/index.cjs +39 -3
  963. package/node_modules/@google/genai/dist/vertex_internal/index.cjs.map +1 -1
  964. package/node_modules/@google/genai/dist/vertex_internal/index.d.ts +51 -9
  965. package/node_modules/@google/genai/dist/vertex_internal/index.js +39 -3
  966. package/node_modules/@google/genai/dist/vertex_internal/index.js.map +1 -1
  967. package/node_modules/@google/genai/dist/web/index.mjs +319 -299
  968. package/node_modules/@google/genai/dist/web/index.mjs.map +1 -1
  969. package/node_modules/@google/genai/dist/web/web.d.ts +1799 -289
  970. package/node_modules/@google/genai/package.json +1 -1
  971. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -4
  972. package/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +1 -0
  973. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +2 -3
  974. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +8 -1
  975. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/LICENSE +201 -0
  976. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/README.md +115 -0
  977. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-cjs/index.js +96 -0
  978. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/abort-handler.js +1 -0
  979. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/abort.js +1 -0
  980. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js +5 -0
  981. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpAuthScheme.js +1 -0
  982. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpAuthSchemeProvider.js +1 -0
  983. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpSigner.js +1 -0
  984. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/IdentityProviderConfig.js +1 -0
  985. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/auth.js +5 -0
  986. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/index.js +2 -0
  987. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/blob/blob-payload-input-types.js +1 -0
  988. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/checksum.js +1 -0
  989. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/client.js +1 -0
  990. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/command.js +1 -0
  991. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/config.js +1 -0
  992. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/index.js +1 -0
  993. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/manager.js +1 -0
  994. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/pool.js +1 -0
  995. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/crypto.js +1 -0
  996. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/downlevel-ts3.4/transform/type-transform.js +1 -0
  997. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/encode.js +1 -0
  998. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoint.js +5 -0
  999. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/EndpointParameterInstructions.js +1 -0
  1000. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/EndpointRuleObject.js +1 -0
  1001. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/ErrorRuleObject.js +1 -0
  1002. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/RuleSetObject.js +1 -0
  1003. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/TreeRuleObject.js +1 -0
  1004. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/index.js +1 -0
  1005. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/shared.js +1 -0
  1006. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/eventStream.js +1 -0
  1007. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/checksum.js +38 -0
  1008. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/defaultClientConfiguration.js +7 -0
  1009. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/defaultExtensionConfiguration.js +1 -0
  1010. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/index.js +2 -0
  1011. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/retry.js +1 -0
  1012. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/externals-check/browser-externals-check.js +1 -0
  1013. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/feature-ids.js +1 -0
  1014. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/http/httpHandlerInitialization.js +1 -0
  1015. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/http.js +5 -0
  1016. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/apiKeyIdentity.js +1 -0
  1017. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/awsCredentialIdentity.js +1 -0
  1018. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/identity.js +1 -0
  1019. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/index.js +1 -0
  1020. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/tokenIdentity.js +1 -0
  1021. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/index.js +7 -0
  1022. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/logger.js +1 -0
  1023. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/metrics.js +1 -0
  1024. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/middleware.js +1 -0
  1025. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/pagination.js +1 -0
  1026. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/profile.js +6 -0
  1027. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/response.js +1 -0
  1028. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/retry.js +1 -0
  1029. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +1 -0
  1030. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/schema.js +1 -0
  1031. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/sentinels.js +1 -0
  1032. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/static-schemas.js +1 -0
  1033. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/traits.js +1 -0
  1034. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/serde.js +1 -0
  1035. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/shapes.js +1 -0
  1036. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/signature.js +1 -0
  1037. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/stream.js +1 -0
  1038. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-common-types.js +1 -0
  1039. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-input-types.js +1 -0
  1040. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-output-types.js +1 -0
  1041. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transfer.js +6 -0
  1042. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/client-method-transforms.js +1 -0
  1043. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/client-payload-blob-type-narrow.js +1 -0
  1044. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/exact.js +1 -0
  1045. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/mutable.js +1 -0
  1046. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/no-undefined.js +1 -0
  1047. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/type-transform.js +1 -0
  1048. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/uri.js +1 -0
  1049. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/util.js +1 -0
  1050. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/waiter.js +1 -0
  1051. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/abort-handler.d.ts +7 -0
  1052. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/abort.d.ts +48 -0
  1053. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpApiKeyAuth.d.ts +7 -0
  1054. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpAuthScheme.d.ts +49 -0
  1055. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpAuthSchemeProvider.d.ts +20 -0
  1056. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpSigner.d.ts +41 -0
  1057. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/IdentityProviderConfig.d.ts +14 -0
  1058. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/auth.d.ts +59 -0
  1059. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/index.d.ts +7 -0
  1060. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +37 -0
  1061. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/checksum.d.ts +61 -0
  1062. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/client.d.ts +57 -0
  1063. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/command.d.ts +28 -0
  1064. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/config.d.ts +15 -0
  1065. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/index.d.ts +3 -0
  1066. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/manager.d.ts +34 -0
  1067. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/pool.d.ts +32 -0
  1068. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/crypto.d.ts +58 -0
  1069. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +24 -0
  1070. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/encode.d.ts +31 -0
  1071. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoint.d.ts +77 -0
  1072. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/EndpointParameterInstructions.d.ts +41 -0
  1073. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/EndpointRuleObject.d.ts +27 -0
  1074. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/ErrorRuleObject.d.ts +10 -0
  1075. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/RuleSetObject.d.ts +28 -0
  1076. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/TreeRuleObject.d.ts +16 -0
  1077. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/index.d.ts +5 -0
  1078. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/shared.d.ts +55 -0
  1079. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/eventStream.d.ts +137 -0
  1080. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/checksum.d.ts +58 -0
  1081. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +32 -0
  1082. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +9 -0
  1083. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/index.d.ts +6 -0
  1084. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/retry.d.ts +18 -0
  1085. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +35 -0
  1086. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/feature-ids.d.ts +16 -0
  1087. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +142 -0
  1088. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/http.d.ts +110 -0
  1089. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/apiKeyIdentity.d.ts +14 -0
  1090. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/awsCredentialIdentity.d.ts +31 -0
  1091. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/identity.d.ts +15 -0
  1092. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/index.d.ts +4 -0
  1093. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/tokenIdentity.d.ts +14 -0
  1094. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/index.d.ts +52 -0
  1095. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/logger.d.ts +13 -0
  1096. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/metrics.d.ts +93 -0
  1097. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/middleware.d.ts +541 -0
  1098. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/pagination.d.ts +33 -0
  1099. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/profile.d.ts +30 -0
  1100. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/response.d.ts +40 -0
  1101. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/retry.d.ts +162 -0
  1102. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +143 -0
  1103. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/schema.d.ts +236 -0
  1104. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +65 -0
  1105. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +99 -0
  1106. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/traits.d.ts +46 -0
  1107. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/serde.d.ts +114 -0
  1108. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/shapes.d.ts +79 -0
  1109. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/signature.d.ts +172 -0
  1110. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/stream.d.ts +22 -0
  1111. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +28 -0
  1112. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +54 -0
  1113. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +41 -0
  1114. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transfer.d.ts +42 -0
  1115. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +26 -0
  1116. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +73 -0
  1117. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/exact.d.ts +6 -0
  1118. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/mutable.d.ts +6 -0
  1119. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +68 -0
  1120. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +39 -0
  1121. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/abort-handler.d.ts +7 -0
  1122. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/abort.d.ts +45 -0
  1123. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpApiKeyAuth.d.ts +7 -0
  1124. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthScheme.d.ts +49 -0
  1125. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthSchemeProvider.d.ts +20 -0
  1126. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpSigner.d.ts +41 -0
  1127. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/IdentityProviderConfig.d.ts +14 -0
  1128. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/auth.d.ts +59 -0
  1129. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/index.d.ts +7 -0
  1130. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/blob/blob-payload-input-types.d.ts +37 -0
  1131. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/checksum.d.ts +61 -0
  1132. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/client.d.ts +57 -0
  1133. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +28 -0
  1134. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/config.d.ts +15 -0
  1135. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/index.d.ts +3 -0
  1136. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/manager.d.ts +34 -0
  1137. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/pool.d.ts +32 -0
  1138. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/crypto.d.ts +58 -0
  1139. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/downlevel-ts3.4/transform/type-transform.d.ts +40 -0
  1140. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/encode.d.ts +31 -0
  1141. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +77 -0
  1142. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointParameterInstructions.d.ts +41 -0
  1143. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointRuleObject.d.ts +27 -0
  1144. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/ErrorRuleObject.d.ts +10 -0
  1145. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/RuleSetObject.d.ts +28 -0
  1146. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/TreeRuleObject.d.ts +16 -0
  1147. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/index.d.ts +5 -0
  1148. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/shared.d.ts +55 -0
  1149. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/eventStream.d.ts +137 -0
  1150. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/checksum.d.ts +58 -0
  1151. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultClientConfiguration.d.ts +32 -0
  1152. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultExtensionConfiguration.d.ts +9 -0
  1153. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/index.d.ts +6 -0
  1154. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/retry.d.ts +18 -0
  1155. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/externals-check/browser-externals-check.d.ts +35 -0
  1156. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +16 -0
  1157. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +142 -0
  1158. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +110 -0
  1159. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/apiKeyIdentity.d.ts +14 -0
  1160. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/awsCredentialIdentity.d.ts +31 -0
  1161. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/identity.d.ts +15 -0
  1162. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/index.d.ts +4 -0
  1163. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/tokenIdentity.d.ts +14 -0
  1164. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +52 -0
  1165. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/logger.d.ts +13 -0
  1166. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/metrics.d.ts +93 -0
  1167. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +541 -0
  1168. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/pagination.d.ts +33 -0
  1169. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/profile.d.ts +30 -0
  1170. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/response.d.ts +40 -0
  1171. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/retry.d.ts +162 -0
  1172. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +149 -0
  1173. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +251 -0
  1174. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/sentinels.d.ts +65 -0
  1175. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +118 -0
  1176. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/traits.d.ts +46 -0
  1177. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +114 -0
  1178. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +79 -0
  1179. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/signature.d.ts +172 -0
  1180. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/stream.d.ts +22 -0
  1181. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-common-types.d.ts +28 -0
  1182. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-input-types.d.ts +54 -0
  1183. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-output-types.d.ts +41 -0
  1184. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transfer.d.ts +42 -0
  1185. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +26 -0
  1186. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +77 -0
  1187. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/exact.d.ts +14 -0
  1188. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/mutable.d.ts +6 -0
  1189. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +88 -0
  1190. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/type-transform.d.ts +40 -0
  1191. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/uri.d.ts +17 -0
  1192. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/util.d.ts +192 -0
  1193. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/waiter.d.ts +35 -0
  1194. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/uri.d.ts +17 -0
  1195. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/util.d.ts +176 -0
  1196. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/waiter.d.ts +35 -0
  1197. package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/package.json +50 -0
  1198. package/node_modules/@smithy/node-http-handler/package.json +2 -2
  1199. package/node_modules/esbuild/LICENSE.md +21 -0
  1200. package/node_modules/esbuild/README.md +3 -0
  1201. package/node_modules/esbuild/bin/esbuild +223 -0
  1202. package/node_modules/esbuild/install.js +300 -0
  1203. package/node_modules/esbuild/lib/main.d.ts +720 -0
  1204. package/node_modules/esbuild/lib/main.js +2536 -0
  1205. package/node_modules/esbuild/package.json +47 -0
  1206. package/node_modules/ignore/README.md +52 -0
  1207. package/node_modules/ignore/index.js +785 -129
  1208. package/node_modules/ignore/legacy.js +660 -98
  1209. package/node_modules/ignore/package.json +10 -4
  1210. package/node_modules/marked/README.md +1 -0
  1211. package/node_modules/marked/lib/marked.d.ts +7 -0
  1212. package/node_modules/marked/lib/marked.esm.js +30 -30
  1213. package/node_modules/marked/lib/marked.esm.js.map +3 -3
  1214. package/node_modules/marked/lib/marked.umd.js +30 -30
  1215. package/node_modules/marked/lib/marked.umd.js.map +3 -3
  1216. package/node_modules/marked/man/marked.1 +1 -1
  1217. package/node_modules/marked/package.json +2 -2
  1218. package/node_modules/typebox/build/compile/validator.d.mts +1 -1
  1219. package/node_modules/typebox/build/compile/validator.mjs +1 -1
  1220. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
  1221. package/node_modules/typebox/build/format/iri.mjs +5 -1
  1222. package/node_modules/typebox/build/guard/emit.mjs +2 -4
  1223. package/node_modules/typebox/build/guard/guard.mjs +6 -18
  1224. package/node_modules/typebox/build/guard/string.mjs +16 -24
  1225. package/node_modules/typebox/build/schema/compile.d.mts +3 -2
  1226. package/node_modules/typebox/build/schema/compile.mjs +8 -8
  1227. package/node_modules/typebox/build/schema/engine/_context.d.mts +1 -6
  1228. package/node_modules/typebox/build/schema/engine/_context.mjs +9 -14
  1229. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
  1230. package/node_modules/typebox/build/schema/engine/_stack.d.mts +6 -2
  1231. package/node_modules/typebox/build/schema/engine/_stack.mjs +135 -32
  1232. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +16 -4
  1233. package/node_modules/typebox/build/schema/engine/allOf.mjs +2 -2
  1234. package/node_modules/typebox/build/schema/engine/anyOf.mjs +2 -2
  1235. package/node_modules/typebox/build/schema/engine/if.mjs +2 -2
  1236. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  1237. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +1 -3
  1238. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  1239. package/node_modules/typebox/build/schema/engine/schema.mjs +6 -0
  1240. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  1241. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  1242. package/node_modules/typebox/build/schema/errors.d.mts +2 -2
  1243. package/node_modules/typebox/build/schema/errors.mjs +7 -13
  1244. package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
  1245. package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
  1246. package/node_modules/typebox/build/schema/intern/intern.d.mts +14 -0
  1247. package/node_modules/typebox/build/schema/intern/intern.mjs +259 -0
  1248. package/node_modules/typebox/build/schema/parse.d.mts +1 -0
  1249. package/node_modules/typebox/build/schema/parse.mjs +10 -5
  1250. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +34 -3
  1251. package/node_modules/typebox/build/schema/resolve/resolve.mjs +198 -73
  1252. package/node_modules/typebox/build/schema/schema.d.mts +1 -0
  1253. package/node_modules/typebox/build/schema/schema.mjs +1 -0
  1254. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
  1255. package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
  1256. package/node_modules/typebox/package.json +1 -1
  1257. package/node_modules/typebox/readme.md +9 -5
  1258. package/node_modules/undici/docs/docs/api/Client.md +4 -0
  1259. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
  1260. package/node_modules/undici/docs/docs/api/EventSource.md +4 -0
  1261. package/node_modules/undici/docs/docs/api/Interceptors.md +7 -3
  1262. package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +7 -1
  1263. package/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
  1264. package/node_modules/undici/lib/core/symbols.js +2 -0
  1265. package/node_modules/undici/lib/dispatcher/agent.js +7 -2
  1266. package/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
  1267. package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
  1268. package/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
  1269. package/node_modules/undici/lib/dispatcher/client.js +3 -2
  1270. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
  1271. package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
  1272. package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
  1273. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +10 -3
  1274. package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -1
  1275. package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
  1276. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
  1277. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +91 -21
  1278. package/node_modules/undici/lib/handler/cache-handler.js +29 -5
  1279. package/node_modules/undici/lib/handler/decorator-handler.js +7 -1
  1280. package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
  1281. package/node_modules/undici/lib/handler/redirect-handler.js +21 -4
  1282. package/node_modules/undici/lib/handler/retry-handler.js +148 -30
  1283. package/node_modules/undici/lib/interceptor/cache.js +65 -12
  1284. package/node_modules/undici/lib/interceptor/decompress.js +115 -13
  1285. package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
  1286. package/node_modules/undici/lib/interceptor/dns.js +7 -0
  1287. package/node_modules/undici/lib/interceptor/dump.js +10 -23
  1288. package/node_modules/undici/lib/mock/mock-agent.js +13 -1
  1289. package/node_modules/undici/lib/mock/mock-utils.js +11 -10
  1290. package/node_modules/undici/lib/util/cache.js +45 -3
  1291. package/node_modules/undici/lib/web/cookies/parse.js +150 -147
  1292. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
  1293. package/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
  1294. package/node_modules/undici/lib/web/fetch/index.js +6 -0
  1295. package/node_modules/undici/lib/web/fetch/request.js +2 -3
  1296. package/node_modules/undici/lib/web/fetch/util.js +6 -1
  1297. package/node_modules/undici/lib/web/webidl/index.js +3 -3
  1298. package/node_modules/undici/lib/web/websocket/connection.js +1 -1
  1299. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
  1300. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
  1301. package/node_modules/undici/package.json +3 -3
  1302. package/node_modules/undici/types/client.d.ts +10 -0
  1303. package/node_modules/undici/types/interceptors.d.ts +2 -0
  1304. package/node_modules/undici/types/mock-agent.d.ts +11 -10
  1305. package/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -0
  1306. package/package.json +70 -49
  1307. package/vendor/pi-client/client.d.ts +20 -15
  1308. package/vendor/pi-client/client.d.ts.map +1 -1
  1309. package/vendor/pi-client/client.js +248 -245
  1310. package/vendor/pi-client/client.js.map +1 -1
  1311. package/vendor/pi-client/connection.d.ts +4 -3
  1312. package/vendor/pi-client/connection.d.ts.map +1 -1
  1313. package/vendor/pi-client/connection.js +13 -9
  1314. package/vendor/pi-client/connection.js.map +1 -1
  1315. package/vendor/pi-client/errors.d.ts +6 -15
  1316. package/vendor/pi-client/errors.d.ts.map +1 -1
  1317. package/vendor/pi-client/errors.js +10 -25
  1318. package/vendor/pi-client/errors.js.map +1 -1
  1319. package/vendor/pi-client/index.d.ts +3 -4
  1320. package/vendor/pi-client/index.d.ts.map +1 -1
  1321. package/vendor/pi-client/index.js +2 -2
  1322. package/vendor/pi-client/index.js.map +1 -1
  1323. package/vendor/pi-client/types.d.ts +14 -8
  1324. package/vendor/pi-client/types.d.ts.map +1 -1
  1325. package/vendor/pi-client/types.js.map +1 -1
  1326. package/vendor/pi-client/unix.d.ts +14 -1
  1327. package/vendor/pi-client/unix.d.ts.map +1 -1
  1328. package/vendor/pi-client/unix.js +138 -8
  1329. package/vendor/pi-client/unix.js.map +1 -1
  1330. package/vendor/pi-protocol/codec.d.ts +2 -4
  1331. package/vendor/pi-protocol/codec.d.ts.map +1 -1
  1332. package/vendor/pi-protocol/codec.js +7 -34
  1333. package/vendor/pi-protocol/codec.js.map +1 -1
  1334. package/vendor/pi-protocol/framing.d.ts +0 -2
  1335. package/vendor/pi-protocol/framing.d.ts.map +1 -1
  1336. package/vendor/pi-protocol/framing.js +0 -15
  1337. package/vendor/pi-protocol/framing.js.map +1 -1
  1338. package/vendor/pi-protocol/index.d.ts +1 -1
  1339. package/vendor/pi-protocol/index.d.ts.map +1 -1
  1340. package/vendor/pi-protocol/index.js +1 -1
  1341. package/vendor/pi-protocol/index.js.map +1 -1
  1342. package/vendor/pi-protocol/protocol.d.ts +167 -0
  1343. package/vendor/pi-protocol/protocol.d.ts.map +1 -0
  1344. package/vendor/pi-protocol/protocol.js +85 -0
  1345. package/vendor/pi-protocol/protocol.js.map +1 -0
  1346. package/dist/bun/register-bedrock.d.ts +0 -2
  1347. package/dist/bun/register-bedrock.d.ts.map +0 -1
  1348. package/dist/bun/register-bedrock.js +0 -4
  1349. package/dist/bun/register-bedrock.js.map +0 -1
  1350. package/dist/cli/experimental/auth.d.ts +0 -16
  1351. package/dist/cli/experimental/auth.d.ts.map +0 -1
  1352. package/dist/cli/experimental/auth.js +0 -13
  1353. package/dist/cli/experimental/auth.js.map +0 -1
  1354. package/dist/cli/experimental/cli.d.ts +0 -6
  1355. package/dist/cli/experimental/cli.d.ts.map +0 -1
  1356. package/dist/cli/experimental/cli.js +0 -5
  1357. package/dist/cli/experimental/cli.js.map +0 -1
  1358. package/dist/cli/experimental/command-options.d.ts +0 -17
  1359. package/dist/cli/experimental/command-options.d.ts.map +0 -1
  1360. package/dist/cli/experimental/command-options.js +0 -35
  1361. package/dist/cli/experimental/command-options.js.map +0 -1
  1362. package/dist/cli/experimental/command.d.ts +0 -63
  1363. package/dist/cli/experimental/command.d.ts.map +0 -1
  1364. package/dist/cli/experimental/command.js +0 -127
  1365. package/dist/cli/experimental/command.js.map +0 -1
  1366. package/dist/cli/experimental/commands/client.d.ts +0 -13
  1367. package/dist/cli/experimental/commands/client.d.ts.map +0 -1
  1368. package/dist/cli/experimental/commands/client.js +0 -25
  1369. package/dist/cli/experimental/commands/client.js.map +0 -1
  1370. package/dist/cli/experimental/commands/pi.d.ts +0 -15
  1371. package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
  1372. package/dist/cli/experimental/commands/pi.js +0 -28
  1373. package/dist/cli/experimental/commands/pi.js.map +0 -1
  1374. package/dist/cli/experimental/commands/server.d.ts +0 -13
  1375. package/dist/cli/experimental/commands/server.d.ts.map +0 -1
  1376. package/dist/cli/experimental/commands/server.js +0 -25
  1377. package/dist/cli/experimental/commands/server.js.map +0 -1
  1378. package/dist/cli/experimental/transport-address.d.ts +0 -10
  1379. package/dist/cli/experimental/transport-address.d.ts.map +0 -1
  1380. package/dist/cli/experimental/transport-address.js +0 -38
  1381. package/dist/cli/experimental/transport-address.js.map +0 -1
  1382. package/dist/client/remote-session.d.ts +0 -53
  1383. package/dist/client/remote-session.d.ts.map +0 -1
  1384. package/dist/client/remote-session.js +0 -340
  1385. package/dist/client/remote-session.js.map +0 -1
  1386. package/dist/client/transcript.d.ts +0 -12
  1387. package/dist/client/transcript.d.ts.map +0 -1
  1388. package/dist/client/transcript.js +0 -98
  1389. package/dist/client/transcript.js.map +0 -1
  1390. package/dist/server/create-harness.d.ts +0 -26
  1391. package/dist/server/create-harness.d.ts.map +0 -1
  1392. package/dist/server/create-harness.js +0 -106
  1393. package/dist/server/create-harness.js.map +0 -1
  1394. package/dist/utils/clipboard-native.d.ts +0 -11
  1395. package/dist/utils/clipboard-native.d.ts.map +0 -1
  1396. package/dist/utils/clipboard-native.js +0 -20
  1397. package/dist/utils/clipboard-native.js.map +0 -1
  1398. package/docs/AGENTS.md +0 -67
  1399. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts +0 -100
  1400. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts.map +0 -1
  1401. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +0 -420
  1402. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js.map +0 -1
  1403. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts +0 -9
  1404. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts.map +0 -1
  1405. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +0 -18
  1406. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js.map +0 -1
  1407. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.d.ts +0 -3
  1408. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.d.ts.map +0 -1
  1409. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +0 -2
  1410. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js.map +0 -1
  1411. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts +0 -65
  1412. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts.map +0 -1
  1413. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +0 -320
  1414. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js.map +0 -1
  1415. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts +0 -4
  1416. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts.map +0 -1
  1417. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +0 -762
  1418. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js.map +0 -1
  1419. package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts +0 -29
  1420. package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts.map +0 -1
  1421. package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +0 -103
  1422. package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js.map +0 -1
  1423. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts +0 -69
  1424. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts.map +0 -1
  1425. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +0 -159
  1426. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js.map +0 -1
  1427. package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-modifiers.c +0 -70
  1428. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  1429. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  1430. package/node_modules/@earendil-works/pi-tui/native/win32/src/win32-console-mode.c +0 -119
  1431. package/node_modules/@mariozechner/clipboard/.yarnrc.yml +0 -1
  1432. package/node_modules/@mariozechner/clipboard/Cargo.toml +0 -45
  1433. package/node_modules/@mariozechner/clipboard/README.md +0 -60
  1434. package/node_modules/@mariozechner/clipboard/build.rs +0 -5
  1435. package/node_modules/@mariozechner/clipboard/exp.ts +0 -12
  1436. package/node_modules/@mariozechner/clipboard/index.d.ts +0 -37
  1437. package/node_modules/@mariozechner/clipboard/index.js +0 -606
  1438. package/node_modules/@mariozechner/clipboard/package.json +0 -45
  1439. package/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +0 -307
  1440. package/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +0 -93
  1441. package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +0 -313
  1442. package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +0 -471
  1443. package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +0 -252
  1444. package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +0 -431
  1445. package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +0 -712
  1446. package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +0 -916
  1447. package/node_modules/@mariozechner/clipboard/src/lib.rs +0 -194
  1448. package/vendor/pi-client/session-handle.d.ts +0 -54
  1449. package/vendor/pi-client/session-handle.d.ts.map +0 -1
  1450. package/vendor/pi-client/session-handle.js +0 -50
  1451. package/vendor/pi-client/session-handle.js.map +0 -1
  1452. package/vendor/pi-client/state.d.ts +0 -22
  1453. package/vendor/pi-client/state.d.ts.map +0 -1
  1454. package/vendor/pi-client/state.js +0 -145
  1455. package/vendor/pi-client/state.js.map +0 -1
  1456. package/vendor/pi-protocol/schemas.d.ts +0 -13739
  1457. package/vendor/pi-protocol/schemas.d.ts.map +0 -1
  1458. package/vendor/pi-protocol/schemas.js +0 -386
  1459. package/vendor/pi-protocol/schemas.js.map +0 -1
@@ -1,15 +1,14 @@
1
- import { spawnSync } from "child_process";
1
+ import { getNativeClipboard } from "@earendil-works/pi-tui";
2
2
  import { randomUUID } from "crypto";
3
3
  import { readFileSync, unlinkSync } from "fs";
4
4
  import { tmpdir } from "os";
5
5
  import { join } from "path";
6
- import { clipboard } from "./clipboard-native.js";
6
+ import { runClipboardCommand } from "./clipboard-command.js";
7
+ import { detectSupportedImageMimeType } from "./mime.js";
7
8
  import { loadPhoton } from "./photon.js";
8
9
  const SUPPORTED_IMAGE_MIME_TYPES = ["image/png", "image/jpeg", "image/webp", "image/gif"];
9
10
  const DEFAULT_LIST_TIMEOUT_MS = 1000;
10
- const DEFAULT_READ_TIMEOUT_MS = 3000;
11
11
  const DEFAULT_POWERSHELL_TIMEOUT_MS = 5000;
12
- const DEFAULT_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
13
12
  export function isWaylandSession(env = process.env) {
14
13
  return Boolean(env.WAYLAND_DISPLAY) || env.XDG_SESSION_TYPE === "wayland";
15
14
  }
@@ -70,31 +69,13 @@ async function convertToPng(bytes) {
70
69
  return null;
71
70
  }
72
71
  }
73
- function runCommand(command, args, options) {
74
- const timeoutMs = options?.timeoutMs ?? DEFAULT_READ_TIMEOUT_MS;
75
- const maxBufferBytes = options?.maxBufferBytes ?? DEFAULT_MAX_BUFFER_BYTES;
76
- const result = spawnSync(command, args, {
77
- timeout: timeoutMs,
78
- maxBuffer: maxBufferBytes,
79
- env: options?.env,
80
- });
81
- if (result.error) {
82
- return { ok: false, stdout: Buffer.alloc(0) };
83
- }
84
- if (result.status !== 0) {
85
- return { ok: false, stdout: Buffer.alloc(0) };
86
- }
87
- const stdout = Buffer.isBuffer(result.stdout)
88
- ? result.stdout
89
- : Buffer.from(result.stdout ?? "", typeof result.stdout === "string" ? "utf-8" : undefined);
90
- return { ok: true, stdout };
91
- }
92
- function readClipboardImageViaWlPaste() {
93
- const list = runCommand("wl-paste", ["--list-types"], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });
94
- if (!list.ok) {
95
- return null;
96
- }
97
- const types = list.stdout
72
+ // Undefined means the backend failed; null means it has no image. An empty
73
+ // Wayland clipboard must not fall through to stale X11 clipboard contents.
74
+ async function readClipboardImageViaWlPaste() {
75
+ const list = await runClipboardCommand("wl-paste", ["--list-types"], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });
76
+ if (list === undefined)
77
+ return undefined;
78
+ const types = list
98
79
  .toString("utf-8")
99
80
  .split(/\r?\n/)
100
81
  .map((t) => t.trim())
@@ -103,11 +84,12 @@ function readClipboardImageViaWlPaste() {
103
84
  if (!selectedType) {
104
85
  return null;
105
86
  }
106
- const data = runCommand("wl-paste", ["--type", selectedType, "--no-newline"]);
107
- if (!data.ok || data.stdout.length === 0) {
87
+ const data = await runClipboardCommand("wl-paste", ["--type", selectedType, "--no-newline"]);
88
+ if (data === undefined)
89
+ return undefined;
90
+ if (data.length === 0)
108
91
  return null;
109
- }
110
- return { bytes: data.stdout, mimeType: baseMimeType(selectedType) };
92
+ return { bytes: data, mimeType: baseMimeType(selectedType) };
111
93
  }
112
94
  function isWSL(env = process.env) {
113
95
  if (env.WSL_DISTRO_NAME || env.WSLENV) {
@@ -126,14 +108,16 @@ function isWSL(env = process.env) {
126
108
  * Windows screenshots (Win+Shift+S). PowerShell can access the Windows clipboard
127
109
  * directly, so we use it as a fallback.
128
110
  */
129
- function readClipboardImageViaPowerShell() {
111
+ async function readClipboardImageViaPowerShell() {
130
112
  const tmpFile = join(tmpdir(), `pi-wsl-clip-${randomUUID()}.png`);
131
113
  try {
132
- const winPathResult = runCommand("wslpath", ["-w", tmpFile], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });
133
- if (!winPathResult.ok) {
114
+ const winPathResult = await runClipboardCommand("wslpath", ["-w", tmpFile], {
115
+ timeoutMs: DEFAULT_LIST_TIMEOUT_MS,
116
+ });
117
+ if (winPathResult === undefined) {
134
118
  return null;
135
119
  }
136
- const winPath = winPathResult.stdout.toString("utf-8").trim();
120
+ const winPath = winPathResult.toString("utf-8").trim();
137
121
  if (!winPath) {
138
122
  return null;
139
123
  }
@@ -145,13 +129,13 @@ function readClipboardImageViaPowerShell() {
145
129
  "$img = [System.Windows.Forms.Clipboard]::GetImage()",
146
130
  "if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }",
147
131
  ].join("; ");
148
- const result = runCommand("powershell.exe", ["-NoProfile", "-Command", psScript], {
132
+ const result = await runClipboardCommand("powershell.exe", ["-NoProfile", "-Command", psScript], {
149
133
  timeoutMs: DEFAULT_POWERSHELL_TIMEOUT_MS,
150
134
  });
151
- if (!result.ok) {
135
+ if (result === undefined) {
152
136
  return null;
153
137
  }
154
- const output = result.stdout.toString("utf-8").trim();
138
+ const output = result.toString("utf-8").trim();
155
139
  if (output !== "ok") {
156
140
  return null;
157
141
  }
@@ -173,38 +157,37 @@ function readClipboardImageViaPowerShell() {
173
157
  }
174
158
  }
175
159
  }
176
- function readClipboardImageViaXclip() {
177
- const targets = runCommand("xclip", ["-selection", "clipboard", "-t", "TARGETS", "-o"], {
160
+ async function readClipboardImageViaXclip() {
161
+ const targets = await runClipboardCommand("xclip", ["-selection", "clipboard", "-t", "TARGETS", "-o"], {
178
162
  timeoutMs: DEFAULT_LIST_TIMEOUT_MS,
179
163
  });
180
164
  let candidateTypes = [];
181
- if (targets.ok) {
182
- candidateTypes = targets.stdout
165
+ if (targets !== undefined) {
166
+ candidateTypes = targets
183
167
  .toString("utf-8")
184
168
  .split(/\r?\n/)
185
169
  .map((t) => t.trim())
186
170
  .filter(Boolean);
187
171
  }
188
- const preferred = candidateTypes.length > 0 ? selectPreferredImageMimeType(candidateTypes) : null;
189
- const tryTypes = preferred ? [preferred, ...SUPPORTED_IMAGE_MIME_TYPES] : [...SUPPORTED_IMAGE_MIME_TYPES];
172
+ const preferred = selectPreferredImageMimeType(candidateTypes);
173
+ if (targets !== undefined && !preferred)
174
+ return null;
175
+ const tryTypes = new Set(preferred ? [preferred, ...SUPPORTED_IMAGE_MIME_TYPES] : SUPPORTED_IMAGE_MIME_TYPES);
190
176
  for (const mimeType of tryTypes) {
191
- const data = runCommand("xclip", ["-selection", "clipboard", "-t", mimeType, "-o"]);
192
- if (data.ok && data.stdout.length > 0) {
193
- return { bytes: data.stdout, mimeType: baseMimeType(mimeType) };
177
+ const data = await runClipboardCommand("xclip", ["-selection", "clipboard", "-t", mimeType, "-o"]);
178
+ if (data !== undefined && data.length > 0) {
179
+ return { bytes: data, mimeType: baseMimeType(mimeType) };
194
180
  }
195
181
  }
196
- return null;
182
+ return undefined;
197
183
  }
198
184
  async function readClipboardImageViaNativeClipboard() {
199
- if (!clipboard?.hasImage()) {
200
- return null;
201
- }
202
- const imageData = await clipboard.getImageBinary();
203
- if (!imageData || imageData.length === 0) {
185
+ const bytes = await getNativeClipboard()?.getImage();
186
+ if (bytes === undefined)
187
+ return undefined;
188
+ if (!bytes?.length)
204
189
  return null;
205
- }
206
- const bytes = imageData instanceof Uint8Array ? imageData : Uint8Array.from(imageData);
207
- return { bytes, mimeType: "image/png" };
190
+ return { bytes, mimeType: detectSupportedImageMimeType(bytes) ?? "application/octet-stream" };
208
191
  }
209
192
  export async function readClipboardImage(options) {
210
193
  const env = options?.env ?? process.env;
@@ -212,19 +195,19 @@ export async function readClipboardImage(options) {
212
195
  if (env.TERMUX_VERSION) {
213
196
  return null;
214
197
  }
215
- let image = null;
198
+ let image;
216
199
  if (platform === "linux") {
217
200
  const wsl = isWSL(env);
218
- const wayland = isWaylandSession(env);
219
- if (wayland || wsl) {
220
- image = readClipboardImageViaWlPaste() ?? readClipboardImageViaXclip();
221
- }
222
- if (!image && wsl) {
223
- image = readClipboardImageViaPowerShell();
224
- }
225
- if (!image && !wayland) {
226
- image = (await readClipboardImageViaNativeClipboard()) ?? readClipboardImageViaXclip();
201
+ if (isWaylandSession(env) || wsl) {
202
+ image = await readClipboardImageViaWlPaste();
227
203
  }
204
+ if (image === undefined)
205
+ image = await readClipboardImageViaXclip();
206
+ // Preserve Linux's empty/unavailable distinction if Windows has no image.
207
+ if (!image && wsl)
208
+ image = (await readClipboardImageViaPowerShell()) ?? image;
209
+ if (image === undefined)
210
+ image = await readClipboardImageViaNativeClipboard();
228
211
  }
229
212
  else {
230
213
  image = await readClipboardImageViaNativeClipboard();
@@ -232,7 +215,7 @@ export async function readClipboardImage(options) {
232
215
  if (!image) {
233
216
  return null;
234
217
  }
235
- // Convert unsupported formats (e.g., BMP from WSLg) to PNG
218
+ // Convert unsupported formats (e.g., Windows DIB data wrapped as BMP) to PNG
236
219
  if (!isSupportedImageMimeType(image.mimeType)) {
237
220
  const pngBytes = await convertToPng(image.bytes);
238
221
  if (!pngBytes) {
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard-image.js","sourceRoot":"","sources":["../../src/utils/clipboard-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOzC,MAAM,0BAA0B,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,CAAU,CAAC;AAEnG,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAC3C,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,MAAM,UAAU,gBAAgB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IACpE,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,GAAG,CAAC,gBAAgB,KAAK,SAAS,CAAC;AAC3E,CAAC;AAED,SAAS,YAAY,CAAC,QAAgB;IACrC,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,C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E,QAAQ,EAAE,WAAW,EAAE,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { spawnSync } from \"child_process\";\nimport { randomUUID } from \"crypto\";\nimport { readFileSync, unlinkSync } from \"fs\";\nimport { tmpdir } from \"os\";\nimport { join } from \"path\";\n\nimport { clipboard } from \"./clipboard-native.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\nexport type ClipboardImage = {\n\tbytes: Uint8Array;\n\tmimeType: string;\n};\n\nconst SUPPORTED_IMAGE_MIME_TYPES = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"] as const;\n\nconst DEFAULT_LIST_TIMEOUT_MS = 1000;\nconst DEFAULT_READ_TIMEOUT_MS = 3000;\nconst DEFAULT_POWERSHELL_TIMEOUT_MS = 5000;\nconst DEFAULT_MAX_BUFFER_BYTES = 50 * 1024 * 1024;\n\nexport function isWaylandSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.WAYLAND_DISPLAY) || env.XDG_SESSION_TYPE === \"wayland\";\n}\n\nfunction baseMimeType(mimeType: string): string {\n\treturn mimeType.split(\";\")[0]?.trim().toLowerCase() ?? mimeType.toLowerCase();\n}\n\nexport function extensionForImageMimeType(mimeType: string): string | null {\n\tswitch (baseMimeType(mimeType)) {\n\t\tcase \"image/png\":\n\t\t\treturn \"png\";\n\t\tcase \"image/jpeg\":\n\t\t\treturn \"jpg\";\n\t\tcase \"image/webp\":\n\t\t\treturn \"webp\";\n\t\tcase \"image/gif\":\n\t\t\treturn \"gif\";\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\nfunction selectPreferredImageMimeType(mimeTypes: string[]): string | null {\n\tconst normalized = mimeTypes\n\t\t.map((t) => t.trim())\n\t\t.filter(Boolean)\n\t\t.map((t) => ({ raw: t, base: baseMimeType(t) }));\n\n\tfor (const preferred of SUPPORTED_IMAGE_MIME_TYPES) {\n\t\tconst match = normalized.find((t) => t.base === preferred);\n\t\tif (match) {\n\t\t\treturn match.raw;\n\t\t}\n\t}\n\n\tconst anyImage = normalized.find((t) => t.base.startsWith(\"image/\"));\n\treturn anyImage?.raw ?? null;\n}\n\nfunction isSupportedImageMimeType(mimeType: string): boolean {\n\tconst base = baseMimeType(mimeType);\n\treturn SUPPORTED_IMAGE_MIME_TYPES.some((t) => t === base);\n}\n\n/**\n * Convert unsupported image formats to PNG using Photon.\n * Returns null if conversion is unavailable or fails.\n */\nasync function convertToPng(bytes: Uint8Array): Promise<Uint8Array | null> {\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst image = photon.PhotonImage.new_from_byteslice(bytes);\n\t\ttry {\n\t\t\treturn image.get_bytes();\n\t\t} finally {\n\t\t\timage.free();\n\t\t}\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction runCommand(\n\tcommand: string,\n\targs: string[],\n\toptions?: { timeoutMs?: number; maxBufferBytes?: number; env?: NodeJS.ProcessEnv },\n): { stdout: Buffer; ok: boolean } {\n\tconst timeoutMs = options?.timeoutMs ?? DEFAULT_READ_TIMEOUT_MS;\n\tconst maxBufferBytes = options?.maxBufferBytes ?? DEFAULT_MAX_BUFFER_BYTES;\n\n\tconst result = spawnSync(command, args, {\n\t\ttimeout: timeoutMs,\n\t\tmaxBuffer: maxBufferBytes,\n\t\tenv: options?.env,\n\t});\n\n\tif (result.error) {\n\t\treturn { ok: false, stdout: Buffer.alloc(0) };\n\t}\n\n\tif (result.status !== 0) {\n\t\treturn { ok: false, stdout: Buffer.alloc(0) };\n\t}\n\n\tconst stdout = Buffer.isBuffer(result.stdout)\n\t\t? result.stdout\n\t\t: Buffer.from(result.stdout ?? \"\", typeof result.stdout === \"string\" ? \"utf-8\" : undefined);\n\n\treturn { ok: true, stdout };\n}\n\nfunction readClipboardImageViaWlPaste(): ClipboardImage | null {\n\tconst list = runCommand(\"wl-paste\", [\"--list-types\"], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });\n\tif (!list.ok) {\n\t\treturn null;\n\t}\n\n\tconst types = list.stdout\n\t\t.toString(\"utf-8\")\n\t\t.split(/\\r?\\n/)\n\t\t.map((t) => t.trim())\n\t\t.filter(Boolean);\n\n\tconst selectedType = selectPreferredImageMimeType(types);\n\tif (!selectedType) {\n\t\treturn null;\n\t}\n\n\tconst data = runCommand(\"wl-paste\", [\"--type\", selectedType, \"--no-newline\"]);\n\tif (!data.ok || data.stdout.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn { bytes: data.stdout, mimeType: baseMimeType(selectedType) };\n}\n\nfunction isWSL(env: NodeJS.ProcessEnv = process.env): boolean {\n\tif (env.WSL_DISTRO_NAME || env.WSLENV) {\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tconst release = readFileSync(\"/proc/version\", \"utf-8\");\n\t\treturn /microsoft|wsl/i.test(release);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * On WSL, the Linux clipboard (Wayland/X11) does not receive image data from\n * Windows screenshots (Win+Shift+S). PowerShell can access the Windows clipboard\n * directly, so we use it as a fallback.\n */\nfunction readClipboardImageViaPowerShell(): ClipboardImage | null {\n\tconst tmpFile = join(tmpdir(), `pi-wsl-clip-${randomUUID()}.png`);\n\n\ttry {\n\t\tconst winPathResult = runCommand(\"wslpath\", [\"-w\", tmpFile], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });\n\t\tif (!winPathResult.ok) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst winPath = winPathResult.stdout.toString(\"utf-8\").trim();\n\t\tif (!winPath) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst psQuotedWinPath = winPath.replaceAll(\"'\", \"''\");\n\t\tconst psScript = [\n\t\t\t\"Add-Type -AssemblyName System.Windows.Forms\",\n\t\t\t\"Add-Type -AssemblyName System.Drawing\",\n\t\t\t`$path = '${psQuotedWinPath}'`,\n\t\t\t\"$img = [System.Windows.Forms.Clipboard]::GetImage()\",\n\t\t\t\"if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }\",\n\t\t].join(\"; \");\n\n\t\tconst result = runCommand(\"powershell.exe\", [\"-NoProfile\", \"-Command\", psScript], {\n\t\t\ttimeoutMs: DEFAULT_POWERSHELL_TIMEOUT_MS,\n\t\t});\n\t\tif (!result.ok) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst output = result.stdout.toString(\"utf-8\").trim();\n\t\tif (output !== \"ok\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst bytes = readFileSync(tmpFile);\n\t\tif (bytes.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { bytes: new Uint8Array(bytes), mimeType: \"image/png\" };\n\t} catch {\n\t\treturn null;\n\t} finally {\n\t\ttry {\n\t\t\tunlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// Ignore cleanup errors.\n\t\t}\n\t}\n}\n\nfunction readClipboardImageViaXclip(): ClipboardImage | null {\n\tconst targets = runCommand(\"xclip\", [\"-selection\", \"clipboard\", \"-t\", \"TARGETS\", \"-o\"], {\n\t\ttimeoutMs: DEFAULT_LIST_TIMEOUT_MS,\n\t});\n\n\tlet candidateTypes: string[] = [];\n\tif (targets.ok) {\n\t\tcandidateTypes = targets.stdout\n\t\t\t.toString(\"utf-8\")\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((t) => t.trim())\n\t\t\t.filter(Boolean);\n\t}\n\n\tconst preferred = candidateTypes.length > 0 ? selectPreferredImageMimeType(candidateTypes) : null;\n\tconst tryTypes = preferred ? [preferred, ...SUPPORTED_IMAGE_MIME_TYPES] : [...SUPPORTED_IMAGE_MIME_TYPES];\n\n\tfor (const mimeType of tryTypes) {\n\t\tconst data = runCommand(\"xclip\", [\"-selection\", \"clipboard\", \"-t\", mimeType, \"-o\"]);\n\t\tif (data.ok && data.stdout.length > 0) {\n\t\t\treturn { bytes: data.stdout, mimeType: baseMimeType(mimeType) };\n\t\t}\n\t}\n\n\treturn null;\n}\n\nasync function readClipboardImageViaNativeClipboard(): Promise<ClipboardImage | null> {\n\tif (!clipboard?.hasImage()) {\n\t\treturn null;\n\t}\n\n\tconst imageData = await clipboard.getImageBinary();\n\tif (!imageData || imageData.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst bytes = imageData instanceof Uint8Array ? imageData : Uint8Array.from(imageData);\n\treturn { bytes, mimeType: \"image/png\" };\n}\n\nexport async function readClipboardImage(options?: {\n\tenv?: NodeJS.ProcessEnv;\n\tplatform?: NodeJS.Platform;\n}): Promise<ClipboardImage | null> {\n\tconst env = options?.env ?? process.env;\n\tconst platform = options?.platform ?? process.platform;\n\n\tif (env.TERMUX_VERSION) {\n\t\treturn null;\n\t}\n\n\tlet image: ClipboardImage | null = null;\n\n\tif (platform === \"linux\") {\n\t\tconst wsl = isWSL(env);\n\t\tconst wayland = isWaylandSession(env);\n\n\t\tif (wayland || wsl) {\n\t\t\timage = readClipboardImageViaWlPaste() ?? readClipboardImageViaXclip();\n\t\t}\n\n\t\tif (!image && wsl) {\n\t\t\timage = readClipboardImageViaPowerShell();\n\t\t}\n\n\t\tif (!image && !wayland) {\n\t\t\timage = (await readClipboardImageViaNativeClipboard()) ?? readClipboardImageViaXclip();\n\t\t}\n\t} else {\n\t\timage = await readClipboardImageViaNativeClipboard();\n\t}\n\n\tif (!image) {\n\t\treturn null;\n\t}\n\n\t// Convert unsupported formats (e.g., BMP from WSLg) to PNG\n\tif (!isSupportedImageMimeType(image.mimeType)) {\n\t\tconst pngBytes = await convertToPng(image.bytes);\n\t\tif (!pngBytes) {\n\t\t\treturn null;\n\t\t}\n\t\treturn { bytes: pngBytes, mimeType: \"image/png\" };\n\t}\n\n\treturn image;\n}\n"]}
1
+ {"version":3,"file":"clipboard-image.js","sourceRoot":"","sources":["../../src/utils/clipboard-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE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C,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;YAClC,KAAK,GAAG,MAAM,4BAA4B,EAAE,CAAC;QAC9C,CAAC;QACD,IAAI,KAAK,KAAK,SAAS;YAAE,KAAK,GAAG,MAAM,0BAA0B,EAAE,CAAC;QACpE,0EAA0E;QAC1E,IAAI,CAAC,KAAK,IAAI,GAAG;YAAE,KAAK,GAAG,CAAC,MAAM,+BAA+B,EAAE,CAAC,IAAI,KAAK,CAAC;QAC9E,IAAI,KAAK,KAAK,SAAS;YAAE,KAAK,GAAG,MAAM,oCAAoC,EAAE,CAAC;IAC/E,CAAC;SAAM,CAAC;QACP,KAAK,GAAG,MAAM,oCAAoC,EAAE,CAAC;IACtD,CAAC;IAED,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACb,CAAC;IAED,6EAA6E;IAC7E,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { getNativeClipboard } from \"@earendil-works/pi-tui\";\nimport { randomUUID } from \"crypto\";\nimport { readFileSync, unlinkSync } from \"fs\";\nimport { tmpdir } from \"os\";\nimport { join } from \"path\";\n\nimport { runClipboardCommand } from \"./clipboard-command.ts\";\nimport { detectSupportedImageMimeType } from \"./mime.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\nexport type ClipboardImage = {\n\tbytes: Uint8Array;\n\tmimeType: string;\n};\n\nconst SUPPORTED_IMAGE_MIME_TYPES = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"] as const;\n\nconst DEFAULT_LIST_TIMEOUT_MS = 1000;\nconst DEFAULT_POWERSHELL_TIMEOUT_MS = 5000;\n\nexport function isWaylandSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.WAYLAND_DISPLAY) || env.XDG_SESSION_TYPE === \"wayland\";\n}\n\nfunction baseMimeType(mimeType: string): string {\n\treturn mimeType.split(\";\")[0]?.trim().toLowerCase() ?? mimeType.toLowerCase();\n}\n\nexport function extensionForImageMimeType(mimeType: string): string | null {\n\tswitch (baseMimeType(mimeType)) {\n\t\tcase \"image/png\":\n\t\t\treturn \"png\";\n\t\tcase \"image/jpeg\":\n\t\t\treturn \"jpg\";\n\t\tcase \"image/webp\":\n\t\t\treturn \"webp\";\n\t\tcase \"image/gif\":\n\t\t\treturn \"gif\";\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\nfunction selectPreferredImageMimeType(mimeTypes: string[]): string | null {\n\tconst normalized = mimeTypes\n\t\t.map((t) => t.trim())\n\t\t.filter(Boolean)\n\t\t.map((t) => ({ raw: t, base: baseMimeType(t) }));\n\n\tfor (const preferred of SUPPORTED_IMAGE_MIME_TYPES) {\n\t\tconst match = normalized.find((t) => t.base === preferred);\n\t\tif (match) {\n\t\t\treturn match.raw;\n\t\t}\n\t}\n\n\tconst anyImage = normalized.find((t) => t.base.startsWith(\"image/\"));\n\treturn anyImage?.raw ?? null;\n}\n\nfunction isSupportedImageMimeType(mimeType: string): boolean {\n\tconst base = baseMimeType(mimeType);\n\treturn SUPPORTED_IMAGE_MIME_TYPES.some((t) => t === base);\n}\n\n/**\n * Convert unsupported image formats to PNG using Photon.\n * Returns null if conversion is unavailable or fails.\n */\nasync function convertToPng(bytes: Uint8Array): Promise<Uint8Array | null> {\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst image = photon.PhotonImage.new_from_byteslice(bytes);\n\t\ttry {\n\t\t\treturn image.get_bytes();\n\t\t} finally {\n\t\t\timage.free();\n\t\t}\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n// Undefined means the backend failed; null means it has no image. An empty\n// Wayland clipboard must not fall through to stale X11 clipboard contents.\nasync function readClipboardImageViaWlPaste(): Promise<ClipboardImage | null | undefined> {\n\tconst list = await runClipboardCommand(\"wl-paste\", [\"--list-types\"], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });\n\tif (list === undefined) return undefined;\n\n\tconst types = list\n\t\t.toString(\"utf-8\")\n\t\t.split(/\\r?\\n/)\n\t\t.map((t) => t.trim())\n\t\t.filter(Boolean);\n\n\tconst selectedType = selectPreferredImageMimeType(types);\n\tif (!selectedType) {\n\t\treturn null;\n\t}\n\n\tconst data = await runClipboardCommand(\"wl-paste\", [\"--type\", selectedType, \"--no-newline\"]);\n\tif (data === undefined) return undefined;\n\tif (data.length === 0) return null;\n\n\treturn { bytes: data, mimeType: baseMimeType(selectedType) };\n}\n\nfunction isWSL(env: NodeJS.ProcessEnv = process.env): boolean {\n\tif (env.WSL_DISTRO_NAME || env.WSLENV) {\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tconst release = readFileSync(\"/proc/version\", \"utf-8\");\n\t\treturn /microsoft|wsl/i.test(release);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * On WSL, the Linux clipboard (Wayland/X11) does not receive image data from\n * Windows screenshots (Win+Shift+S). PowerShell can access the Windows clipboard\n * directly, so we use it as a fallback.\n */\nasync function readClipboardImageViaPowerShell(): Promise<ClipboardImage | null> {\n\tconst tmpFile = join(tmpdir(), `pi-wsl-clip-${randomUUID()}.png`);\n\n\ttry {\n\t\tconst winPathResult = await runClipboardCommand(\"wslpath\", [\"-w\", tmpFile], {\n\t\t\ttimeoutMs: DEFAULT_LIST_TIMEOUT_MS,\n\t\t});\n\t\tif (winPathResult === undefined) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst winPath = winPathResult.toString(\"utf-8\").trim();\n\t\tif (!winPath) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst psQuotedWinPath = winPath.replaceAll(\"'\", \"''\");\n\t\tconst psScript = [\n\t\t\t\"Add-Type -AssemblyName System.Windows.Forms\",\n\t\t\t\"Add-Type -AssemblyName System.Drawing\",\n\t\t\t`$path = '${psQuotedWinPath}'`,\n\t\t\t\"$img = [System.Windows.Forms.Clipboard]::GetImage()\",\n\t\t\t\"if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }\",\n\t\t].join(\"; \");\n\n\t\tconst result = await runClipboardCommand(\"powershell.exe\", [\"-NoProfile\", \"-Command\", psScript], {\n\t\t\ttimeoutMs: DEFAULT_POWERSHELL_TIMEOUT_MS,\n\t\t});\n\t\tif (result === undefined) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst output = result.toString(\"utf-8\").trim();\n\t\tif (output !== \"ok\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst bytes = readFileSync(tmpFile);\n\t\tif (bytes.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { bytes: new Uint8Array(bytes), mimeType: \"image/png\" };\n\t} catch {\n\t\treturn null;\n\t} finally {\n\t\ttry {\n\t\t\tunlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// Ignore cleanup errors.\n\t\t}\n\t}\n}\n\nasync function readClipboardImageViaXclip(): Promise<ClipboardImage | null | undefined> {\n\tconst targets = await runClipboardCommand(\"xclip\", [\"-selection\", \"clipboard\", \"-t\", \"TARGETS\", \"-o\"], {\n\t\ttimeoutMs: DEFAULT_LIST_TIMEOUT_MS,\n\t});\n\n\tlet candidateTypes: string[] = [];\n\tif (targets !== undefined) {\n\t\tcandidateTypes = targets\n\t\t\t.toString(\"utf-8\")\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((t) => t.trim())\n\t\t\t.filter(Boolean);\n\t}\n\n\tconst preferred = selectPreferredImageMimeType(candidateTypes);\n\tif (targets !== undefined && !preferred) return null;\n\tconst tryTypes = new Set(preferred ? [preferred, ...SUPPORTED_IMAGE_MIME_TYPES] : SUPPORTED_IMAGE_MIME_TYPES);\n\n\tfor (const mimeType of tryTypes) {\n\t\tconst data = await runClipboardCommand(\"xclip\", [\"-selection\", \"clipboard\", \"-t\", mimeType, \"-o\"]);\n\t\tif (data !== undefined && data.length > 0) {\n\t\t\treturn { bytes: data, mimeType: baseMimeType(mimeType) };\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nasync function readClipboardImageViaNativeClipboard(): Promise<ClipboardImage | null | undefined> {\n\tconst bytes = await getNativeClipboard()?.getImage();\n\tif (bytes === undefined) return undefined;\n\tif (!bytes?.length) return null;\n\treturn { bytes, mimeType: detectSupportedImageMimeType(bytes) ?? \"application/octet-stream\" };\n}\n\nexport async function readClipboardImage(options?: {\n\tenv?: NodeJS.ProcessEnv;\n\tplatform?: NodeJS.Platform;\n}): Promise<ClipboardImage | null> {\n\tconst env = options?.env ?? process.env;\n\tconst platform = options?.platform ?? process.platform;\n\n\tif (env.TERMUX_VERSION) {\n\t\treturn null;\n\t}\n\n\tlet image: ClipboardImage | null | undefined;\n\n\tif (platform === \"linux\") {\n\t\tconst wsl = isWSL(env);\n\t\tif (isWaylandSession(env) || wsl) {\n\t\t\timage = await readClipboardImageViaWlPaste();\n\t\t}\n\t\tif (image === undefined) image = await readClipboardImageViaXclip();\n\t\t// Preserve Linux's empty/unavailable distinction if Windows has no image.\n\t\tif (!image && wsl) image = (await readClipboardImageViaPowerShell()) ?? image;\n\t\tif (image === undefined) image = await readClipboardImageViaNativeClipboard();\n\t} else {\n\t\timage = await readClipboardImageViaNativeClipboard();\n\t}\n\n\tif (!image) {\n\t\treturn null;\n\t}\n\n\t// Convert unsupported formats (e.g., Windows DIB data wrapped as BMP) to PNG\n\tif (!isSupportedImageMimeType(image.mimeType)) {\n\t\tconst pngBytes = await convertToPng(image.bytes);\n\t\tif (!pngBytes) {\n\t\t\treturn null;\n\t\t}\n\t\treturn { bytes: pngBytes, mimeType: \"image/png\" };\n\t}\n\n\treturn image;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAmDA,iDAAiD;AACjD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBhE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsGjE"}
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAmBA,iDAAiD;AACjD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBhE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCjE"}
@@ -1,15 +1,6 @@
1
- import { execFileSync, execSync, spawn } from "child_process";
2
- import { platform } from "os";
3
- import { isWaylandSession } from "./clipboard-image.js";
4
- import { clipboard } from "./clipboard-native.js";
5
- function copyToX11Clipboard(options) {
6
- try {
7
- execSync("xclip -selection clipboard", options);
8
- }
9
- catch {
10
- execSync("xsel --clipboard --input", options);
11
- }
12
- }
1
+ import { platform } from "node:os";
2
+ import { getNativeClipboard } from "@earendil-works/pi-tui";
3
+ import { runClipboardCommand } from "./clipboard-command.js";
13
4
  const MAX_OSC52_ENCODED_LENGTH = 100_000;
14
5
  function isRemoteSession(env = process.env) {
15
6
  return Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);
@@ -22,140 +13,72 @@ function emitOsc52(text) {
22
13
  process.stdout.write(`\x1b]52;c;${encoded}\x07`);
23
14
  return true;
24
15
  }
25
- const READ_CLIPBOARD_OPTIONS = {
26
- encoding: "utf8",
27
- maxBuffer: 50 * 1024 * 1024,
28
- timeout: 5000,
29
- };
30
- function readWaylandClipboardText() {
31
- try {
32
- const text = execFileSync("wl-paste", ["--no-newline", "--type", "text"], READ_CLIPBOARD_OPTIONS);
33
- return { ok: true, text: text || null };
34
- }
35
- catch {
36
- return { ok: false };
37
- }
38
- }
39
16
  /** Read plain text from the system clipboard. */
40
17
  export async function readClipboardText() {
41
- if (platform() === "linux" && isWaylandSession() && process.env.WAYLAND_DISPLAY) {
42
- const result = readWaylandClipboardText();
43
- if (result.ok) {
44
- return result.text;
18
+ if (platform() === "linux") {
19
+ const commands = [];
20
+ if (process.env.TERMUX_VERSION)
21
+ commands.push(["termux-clipboard-get", []]);
22
+ if (process.env.WAYLAND_DISPLAY)
23
+ commands.push(["wl-paste", ["--no-newline", "--type", "text"]]);
24
+ if (process.env.DISPLAY) {
25
+ commands.push(["xclip", ["-selection", "clipboard", "-out"]], ["xsel", ["--clipboard", "--output"]]);
26
+ }
27
+ for (const [command, args] of commands) {
28
+ const bytes = await runClipboardCommand(command, args, { timeoutMs: 5000 });
29
+ if (bytes !== undefined)
30
+ return bytes.toString("utf8") || null;
45
31
  }
46
- }
47
- if (!clipboard) {
48
- return null;
49
32
  }
50
33
  try {
51
- const text = await clipboard.getText();
52
- return text || null;
34
+ return (await getNativeClipboard()?.getText()) || null;
53
35
  }
54
36
  catch {
55
37
  return null;
56
38
  }
57
39
  }
58
40
  export async function copyToClipboard(text) {
59
- let copied = false;
60
41
  const p = platform();
61
- // Prefer direct clipboard writes. Emitting OSC 52 first can make terminals
62
- // write the same native clipboard concurrently with the addon, and very large
63
- // OSC 52 payloads can desynchronize terminal rendering.
64
- //
65
- // On Linux, skip the native addon. The underlying `clipboard-rs` crate is
66
- // X11-only and does not retain selection ownership after `set_text`
67
- // resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even
68
- // some X11 sessions the call resolves successfully without populating the
69
- // clipboard. The platform tools below (wl-copy, xclip, xsel) properly
70
- // daemonize and keep ownership.
71
- try {
72
- if (clipboard && p !== "linux") {
73
- await clipboard.setText(text);
74
- copied = true;
75
- }
76
- }
77
- catch {
78
- // Fall through to platform-specific clipboard tools.
79
- }
80
- const remote = isRemoteSession();
81
- if (copied && !remote) {
82
- return;
83
- }
84
- const options = { input: text, timeout: 5000, stdio: ["pipe", "ignore", "ignore"] };
85
- if (!copied) {
42
+ let copied = false;
43
+ // Direct writes precede OSC 52 so the terminal cannot race the native writer.
44
+ // Linux tools retain clipboard selection ownership after this call returns.
45
+ if (p !== "linux") {
86
46
  try {
87
- if (p === "darwin") {
88
- execSync("pbcopy", options);
89
- copied = true;
90
- }
91
- else if (p === "win32") {
92
- execSync("clip", options);
47
+ const clipboard = getNativeClipboard();
48
+ if (clipboard?.setText) {
49
+ await clipboard.setText(text);
93
50
  copied = true;
94
51
  }
95
- else {
96
- // Linux. Try Termux, Wayland, or X11 clipboard tools.
97
- if (process.env.TERMUX_VERSION) {
98
- try {
99
- execSync("termux-clipboard-set", options);
100
- copied = true;
101
- }
102
- catch {
103
- // Fall back to Wayland or X11 tools.
104
- }
105
- }
106
- if (!copied) {
107
- const hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);
108
- const hasX11Display = Boolean(process.env.DISPLAY);
109
- const isWayland = isWaylandSession();
110
- if (isWayland && hasWaylandDisplay) {
111
- try {
112
- // Verify wl-copy exists (spawn errors are async and won't be caught)
113
- execSync("which wl-copy", { stdio: "ignore" });
114
- // wl-copy with execSync hangs due to fork behavior; use spawn instead.
115
- // Await the exit code and only claim success on a clean exit, so a
116
- // failed wl-copy falls through to the xclip/OSC 52 fallbacks.
117
- const wlCopyExit = await new Promise((resolve) => {
118
- const proc = spawn("wl-copy", [], { stdio: ["pipe", "ignore", "ignore"] });
119
- proc.on("error", () => resolve(1));
120
- proc.on("close", (code) => resolve(code ?? 1));
121
- proc.stdin.on("error", () => {
122
- // Ignore EPIPE errors if wl-copy exits early
123
- });
124
- proc.stdin.write(text);
125
- proc.stdin.end();
126
- });
127
- if (wlCopyExit === 0) {
128
- copied = true;
129
- }
130
- else if (hasX11Display) {
131
- copyToX11Clipboard(options);
132
- copied = true;
133
- }
134
- }
135
- catch {
136
- if (hasX11Display) {
137
- copyToX11Clipboard(options);
138
- copied = true;
139
- }
140
- }
141
- }
142
- else if (hasX11Display) {
143
- copyToX11Clipboard(options);
144
- copied = true;
145
- }
146
- }
147
- }
148
52
  }
149
53
  catch {
150
- // Fall through to OSC 52 fallback.
54
+ // Try platform commands next.
151
55
  }
152
56
  }
153
- if (remote || !copied) {
154
- const osc52Copied = emitOsc52(text);
155
- copied = copied || osc52Copied;
156
- }
157
57
  if (!copied) {
158
- throw new Error("Failed to copy to clipboard");
58
+ const commands = [];
59
+ if (p === "darwin")
60
+ commands.push(["pbcopy", []]);
61
+ else if (p === "win32")
62
+ commands.push(["clip", []]);
63
+ else {
64
+ if (process.env.TERMUX_VERSION)
65
+ commands.push(["termux-clipboard-set", []]);
66
+ if (process.env.WAYLAND_DISPLAY)
67
+ commands.push(["wl-copy", []]);
68
+ if (process.env.DISPLAY) {
69
+ commands.push(["xclip", ["-selection", "clipboard"]], ["xsel", ["--clipboard", "--input"]]);
70
+ }
71
+ }
72
+ for (const [command, args] of commands) {
73
+ if ((await runClipboardCommand(command, args, { input: text, timeoutMs: 5000 })) !== undefined) {
74
+ copied = true;
75
+ break;
76
+ }
77
+ }
159
78
  }
79
+ if (isRemoteSession() || !copied)
80
+ copied = emitOsc52(text) || copied;
81
+ if (!copied)
82
+ throw new Error("Failed to copy to clipboard");
160
83
  }
161
84
  //# sourceMappingURL=clipboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1G,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQlD,SA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;QACpC,MAAM,GAAG,MAAM,IAAI,WAAW,CAAC;IAChC,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAChD,CAAC;AACF,CAAC","sourcesContent":["import { type ExecFileSyncOptionsWithStringEncoding, execFileSync, execSync, spawn } from \"child_process\";\nimport { platform } from \"os\";\nimport { isWaylandSession } from \"./clipboard-image.ts\";\nimport { clipboard } from \"./clipboard-native.ts\";\n\ntype NativeClipboardExecOptions = {\n\tinput: string;\n\ttimeout: number;\n\tstdio: [\"pipe\", \"ignore\", \"ignore\"];\n};\n\nfunction copyToX11Clipboard(options: NativeClipboardExecOptions): void {\n\ttry {\n\t\texecSync(\"xclip -selection clipboard\", options);\n\t} catch {\n\t\texecSync(\"xsel --clipboard --input\", options);\n\t}\n}\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\ntype ClipboardReadResult = { ok: true; text: string | null } | { ok: false };\n\nconst READ_CLIPBOARD_OPTIONS: ExecFileSyncOptionsWithStringEncoding = {\n\tencoding: \"utf8\",\n\tmaxBuffer: 50 * 1024 * 1024,\n\ttimeout: 5000,\n};\n\nfunction readWaylandClipboardText(): ClipboardReadResult {\n\ttry {\n\t\tconst text = execFileSync(\"wl-paste\", [\"--no-newline\", \"--type\", \"text\"], READ_CLIPBOARD_OPTIONS);\n\t\treturn { ok: true, text: text || null };\n\t} catch {\n\t\treturn { ok: false };\n\t}\n}\n\n/** Read plain text from the system clipboard. */\nexport async function readClipboardText(): Promise<string | null> {\n\tif (platform() === \"linux\" && isWaylandSession() && process.env.WAYLAND_DISPLAY) {\n\t\tconst result = readWaylandClipboardText();\n\t\tif (result.ok) {\n\t\t\treturn result.text;\n\t\t}\n\t}\n\n\tif (!clipboard) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst text = await clipboard.getText();\n\t\treturn text || null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tlet copied = false;\n\n\tconst p = platform();\n\n\t// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals\n\t// write the same native clipboard concurrently with the addon, and very large\n\t// OSC 52 payloads can desynchronize terminal rendering.\n\t//\n\t// On Linux, skip the native addon. The underlying `clipboard-rs` crate is\n\t// X11-only and does not retain selection ownership after `set_text`\n\t// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even\n\t// some X11 sessions the call resolves successfully without populating the\n\t// clipboard. The platform tools below (wl-copy, xclip, xsel) properly\n\t// daemonize and keep ownership.\n\ttry {\n\t\tif (clipboard && p !== \"linux\") {\n\t\t\tawait clipboard.setText(text);\n\t\t\tcopied = true;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\tconst remote = isRemoteSession();\n\tif (copied && !remote) {\n\t\treturn;\n\t}\n\n\tconst options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: [\"pipe\", \"ignore\", \"ignore\"] };\n\n\tif (!copied) {\n\t\ttry {\n\t\t\tif (p === \"darwin\") {\n\t\t\t\texecSync(\"pbcopy\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else if (p === \"win32\") {\n\t\t\t\texecSync(\"clip\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else {\n\t\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!copied) {\n\t\t\t\t\tconst hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);\n\t\t\t\t\tconst hasX11Display = Boolean(process.env.DISPLAY);\n\t\t\t\t\tconst isWayland = isWaylandSession();\n\t\t\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Verify wl-copy exists (spawn errors are async and won't be caught)\n\t\t\t\t\t\t\texecSync(\"which wl-copy\", { stdio: \"ignore\" });\n\t\t\t\t\t\t\t// wl-copy with execSync hangs due to fork behavior; use spawn instead.\n\t\t\t\t\t\t\t// Await the exit code and only claim success on a clean exit, so a\n\t\t\t\t\t\t\t// failed wl-copy falls through to the xclip/OSC 52 fallbacks.\n\t\t\t\t\t\t\tconst wlCopyExit = await new Promise<number>((resolve) => {\n\t\t\t\t\t\t\t\tconst proc = spawn(\"wl-copy\", [], { stdio: [\"pipe\", \"ignore\", \"ignore\"] });\n\t\t\t\t\t\t\t\tproc.on(\"error\", () => resolve(1));\n\t\t\t\t\t\t\t\tproc.on(\"close\", (code) => resolve(code ?? 1));\n\t\t\t\t\t\t\t\tproc.stdin.on(\"error\", () => {\n\t\t\t\t\t\t\t\t\t// Ignore EPIPE errors if wl-copy exits early\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tproc.stdin.write(text);\n\t\t\t\t\t\t\t\tproc.stdin.end();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (wlCopyExit === 0) {\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to OSC 52 fallback.\n\t\t}\n\t}\n\n\tif (remote || !copied) {\n\t\tconst osc52Copied = emitOsc52(text);\n\t\tcopied = copied || osc52Copied;\n\t}\n\n\tif (!copied) {\n\t\tthrow new Error(\"Failed to copy to clipboard\");\n\t}\n}\n"]}
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEzC,SAAS,eAAe,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAC5D,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,OAAO,CAAC,MAAM,GAAG,wBAAwB,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,OAAO,MAAM,CAAC,CAAC;IACjD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,iDAAiD;AACjD,MAAM,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IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;gBAChG,MAAM,GAAG,IAAI,CAAC;gBACd,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,IAAI,eAAe,EAAE,IAAI,CAAC,MAAM;QAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC;IACrE,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { platform } from \"node:os\";\nimport { getNativeClipboard } from \"@earendil-works/pi-tui\";\nimport { runClipboardCommand } from \"./clipboard-command.ts\";\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\n/** Read plain text from the system clipboard. */\nexport async function readClipboardText(): Promise<string | null> {\n\tif (platform() === \"linux\") {\n\t\tconst commands: [string, string[]][] = [];\n\t\tif (process.env.TERMUX_VERSION) commands.push([\"termux-clipboard-get\", []]);\n\t\tif (process.env.WAYLAND_DISPLAY) commands.push([\"wl-paste\", [\"--no-newline\", \"--type\", \"text\"]]);\n\t\tif (process.env.DISPLAY) {\n\t\t\tcommands.push([\"xclip\", [\"-selection\", \"clipboard\", \"-out\"]], [\"xsel\", [\"--clipboard\", \"--output\"]]);\n\t\t}\n\t\tfor (const [command, args] of commands) {\n\t\t\tconst bytes = await runClipboardCommand(command, args, { timeoutMs: 5000 });\n\t\t\tif (bytes !== undefined) return bytes.toString(\"utf8\") || null;\n\t\t}\n\t}\n\ttry {\n\t\treturn (await getNativeClipboard()?.getText()) || null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tconst p = platform();\n\tlet copied = false;\n\t// Direct writes precede OSC 52 so the terminal cannot race the native writer.\n\t// Linux tools retain clipboard selection ownership after this call returns.\n\tif (p !== \"linux\") {\n\t\ttry {\n\t\t\tconst clipboard = getNativeClipboard();\n\t\t\tif (clipboard?.setText) {\n\t\t\t\tawait clipboard.setText(text);\n\t\t\t\tcopied = true;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Try platform commands next.\n\t\t}\n\t}\n\tif (!copied) {\n\t\tconst commands: [string, string[]][] = [];\n\t\tif (p === \"darwin\") commands.push([\"pbcopy\", []]);\n\t\telse if (p === \"win32\") commands.push([\"clip\", []]);\n\t\telse {\n\t\t\tif (process.env.TERMUX_VERSION) commands.push([\"termux-clipboard-set\", []]);\n\t\t\tif (process.env.WAYLAND_DISPLAY) commands.push([\"wl-copy\", []]);\n\t\t\tif (process.env.DISPLAY) {\n\t\t\t\tcommands.push([\"xclip\", [\"-selection\", \"clipboard\"]], [\"xsel\", [\"--clipboard\", \"--input\"]]);\n\t\t\t}\n\t\t}\n\t\tfor (const [command, args] of commands) {\n\t\t\tif ((await runClipboardCommand(command, args, { input: text, timeoutMs: 5000 })) !== undefined) {\n\t\t\t\tcopied = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (isRemoteSession() || !copied) copied = emitOsc52(text) || copied;\n\tif (!copied) throw new Error(\"Failed to copy to clipboard\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"exif-orientation.d.ts","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,MAAM,GAAG,cAAc,4BAA4B,CAAC,CAAC;AAgJ1D,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,UAAU,GACvB,eAAe,CAgCjB"}
1
+ {"version":3,"file":"exif-orientation.d.ts","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,MAAM,GAAG,cAAc,4BAA4B,CAAC,CAAC;AA+I1D,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,UAAU,GACvB,eAAe,CAgCjB"}
@@ -45,9 +45,8 @@ function findJpegTiffOffset(bytes) {
45
45
  const segmentStart = offset + 4;
46
46
  if (segmentStart + 6 > bytes.length)
47
47
  return -1;
48
- if (!hasExifHeader(bytes, segmentStart))
49
- return -1;
50
- return segmentStart + 6;
48
+ if (hasExifHeader(bytes, segmentStart))
49
+ return segmentStart + 6;
51
50
  }
52
51
  if (offset + 4 > bytes.length)
53
52
  return -1;
@@ -1 +1 @@
1
- {"version":3,"file":"exif-orientation.js","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAIA,SAAS,uBAAuB,CAAC,KAAiB,EAAE,SAAiB;IACpE,IAAI,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC;IAE3C,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACjE,MAAM,EAAE,GAAG,SAAS,KAAK,MAAM,CAAC;IAEhC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE;QACtC,IAAI,EAAE;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAA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GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YAC7E,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,KAAK,CAAC;YACL,OAAO,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACrE;YACC,OAAO,KAAK,CAAC;IACf,CAAC;AACF,CAAC","sourcesContent":["import type { PhotonImageType } from \"./photon.ts\";\n\ntype Photon = typeof import(\"@silvia-odwyer/photon-node\");\n\nfunction readOrientationFromTiff(bytes: Uint8Array, tiffStart: number): number {\n\tif (tiffStart + 8 > bytes.length) return 1;\n\n\tconst byteOrder = (bytes[tiffStart] << 8) | bytes[tiffStart + 1];\n\tconst le = byteOrder === 0x4949;\n\n\tconst read16 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8);\n\t\treturn (bytes[pos] << 8) | bytes[pos + 1];\n\t};\n\n\tconst read32 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8) | (bytes[pos + 2] << 16) | (bytes[pos + 3] << 24);\n\t\treturn ((bytes[pos] << 24) | (bytes[pos + 1] << 16) | (bytes[pos + 2] << 8) | bytes[pos + 3]) >>> 0;\n\t};\n\n\tconst ifdOffset = read32(tiffStart + 4);\n\tconst ifdStart = tiffStart + ifdOffset;\n\tif (ifdStart + 2 > bytes.length) return 1;\n\n\tconst entryCount = read16(ifdStart);\n\tfor (let i = 0; i < entryCount; i++) {\n\t\tconst entryPos = ifdStart + 2 + i * 12;\n\t\tif (entryPos + 12 > bytes.length) return 1;\n\n\t\tif (read16(entryPos) === 0x0112) {\n\t\t\tconst value = read16(entryPos + 8);\n\t\t\treturn value >= 1 && value <= 8 ? value : 1;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nfunction findJpegTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 2;\n\twhile (offset < bytes.length - 1) {\n\t\tif (bytes[offset] !== 0xff) return -1;\n\t\tconst marker = bytes[offset + 1];\n\t\tif (marker === 0xff) {\n\t\t\toffset++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (marker === 0xe1) {\n\t\t\tif (offset + 4 >= bytes.length) return -1;\n\t\t\tconst segmentStart = offset + 4;\n\t\t\tif (segmentStart + 6 > bytes.length) return -1;\n\t\t\tif (!hasExifHeader(bytes, segmentStart)) return -1;\n\t\t\treturn segmentStart + 6;\n\t\t}\n\n\t\tif (offset + 4 > bytes.length) return -1;\n\t\tconst length = (bytes[offset + 2] << 8) | bytes[offset + 3];\n\t\toffset += 2 + length;\n\t}\n\n\treturn -1;\n}\n\nfunction findWebpTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 12;\n\twhile (offset + 8 <= bytes.length) {\n\t\tconst chunkId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);\n\t\tconst chunkSize =\n\t\t\tbytes[offset + 4] | (bytes[offset + 5] << 8) | (bytes[offset + 6] << 16) | (bytes[offset + 7] << 24);\n\t\tconst dataStart = offset + 8;\n\n\t\tif (chunkId === \"EXIF\") {\n\t\t\tif (dataStart + chunkSize > bytes.length) return -1;\n\t\t\t// Some WebP files have \"Exif\\0\\0\" prefix before the TIFF header\n\t\t\tconst tiffStart = chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;\n\t\t\treturn tiffStart;\n\t\t}\n\n\t\t// RIFF chunks are padded to even size\n\t\toffset = dataStart + chunkSize + (chunkSize % 2);\n\t}\n\n\treturn -1;\n}\n\nfunction hasExifHeader(bytes: Uint8Array, offset: number): boolean {\n\treturn (\n\t\tbytes[offset] === 0x45 &&\n\t\tbytes[offset + 1] === 0x78 &&\n\t\tbytes[offset + 2] === 0x69 &&\n\t\tbytes[offset + 3] === 0x66 &&\n\t\tbytes[offset + 4] === 0x00 &&\n\t\tbytes[offset + 5] === 0x00\n\t);\n}\n\nfunction getExifOrientation(bytes: Uint8Array): number {\n\tlet tiffOffset = -1;\n\n\t// JPEG: starts with FF D8\n\tif (bytes.length >= 2 && bytes[0] === 0xff && bytes[1] === 0xd8) {\n\t\ttiffOffset = findJpegTiffOffset(bytes);\n\t}\n\t// WebP: starts with RIFF....WEBP\n\telse if (\n\t\tbytes.length >= 12 &&\n\t\tbytes[0] === 0x52 &&\n\t\tbytes[1] === 0x49 &&\n\t\tbytes[2] === 0x46 &&\n\t\tbytes[3] === 0x46 &&\n\t\tbytes[8] === 0x57 &&\n\t\tbytes[9] === 0x45 &&\n\t\tbytes[10] === 0x42 &&\n\t\tbytes[11] === 0x50\n\t) {\n\t\ttiffOffset = findWebpTiffOffset(bytes);\n\t}\n\n\tif (tiffOffset === -1) return 1;\n\treturn readOrientationFromTiff(bytes, tiffOffset);\n}\n\ntype DstIndexFn = (x: number, y: number, w: number, h: number) => number;\n\nfunction rotate90(photon: Photon, image: PhotonImageType, dstIndex: DstIndexFn): PhotonImageType {\n\tconst w = image.get_width();\n\tconst h = image.get_height();\n\tconst src = image.get_raw_pixels();\n\tconst dst = new Uint8Array(src.length);\n\n\tfor (let y = 0; y < h; y++) {\n\t\tfor (let x = 0; x < w; x++) {\n\t\t\tconst srcIdx = (y * w + x) * 4;\n\t\t\tconst dstIdx = dstIndex(x, y, w, h) * 4;\n\t\t\tdst[dstIdx] = src[srcIdx];\n\t\t\tdst[dstIdx + 1] = src[srcIdx + 1];\n\t\t\tdst[dstIdx + 2] = src[srcIdx + 2];\n\t\t\tdst[dstIdx + 3] = src[srcIdx + 3];\n\t\t}\n\t}\n\n\treturn new photon.PhotonImage(dst, h, w);\n}\n\n// Flip orientations mutate in-place. Rotations return a new image (caller must free the old one if different).\nexport function applyExifOrientation(\n\tphoton: Photon,\n\timage: PhotonImageType,\n\toriginalBytes: Uint8Array,\n): PhotonImageType {\n\tconst orientation = getExifOrientation(originalBytes);\n\tif (orientation === 1) return image;\n\n\tswitch (orientation) {\n\t\tcase 2:\n\t\t\tphoton.fliph(image);\n\t\t\treturn image;\n\t\tcase 3:\n\t\t\tphoton.fliph(image);\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 4:\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 5: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 6:\n\t\t\treturn rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\tcase 7: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 8:\n\t\t\treturn rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\tdefault:\n\t\t\treturn image;\n\t}\n}\n"]}
1
+ {"version":3,"file":"exif-orientation.js","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAIA,SAAS,uBAAuB,CAAC,KAAiB,EAAE,SAAiB;IACpE,IAAI,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC;IAE3C,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACjE,MAAM,EAAE,GAAG,SAAS,KAAK,MAAM,CAAC;IAEhC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE;QACtC,IAAI,EAAE;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,OAAO,C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AK,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,KAAK,CAAC;YACL,OAAO,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACrE;YACC,OAAO,KAAK,CAAC;IACf,CAAC;AACF,CAAC","sourcesContent":["import type { PhotonImageType } from \"./photon.ts\";\n\ntype Photon = typeof import(\"@silvia-odwyer/photon-node\");\n\nfunction readOrientationFromTiff(bytes: Uint8Array, tiffStart: number): number {\n\tif (tiffStart + 8 > bytes.length) return 1;\n\n\tconst byteOrder = (bytes[tiffStart] << 8) | bytes[tiffStart + 1];\n\tconst le = byteOrder === 0x4949;\n\n\tconst read16 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8);\n\t\treturn (bytes[pos] << 8) | bytes[pos + 1];\n\t};\n\n\tconst read32 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8) | (bytes[pos + 2] << 16) | (bytes[pos + 3] << 24);\n\t\treturn ((bytes[pos] << 24) | (bytes[pos + 1] << 16) | (bytes[pos + 2] << 8) | bytes[pos + 3]) >>> 0;\n\t};\n\n\tconst ifdOffset = read32(tiffStart + 4);\n\tconst ifdStart = tiffStart + ifdOffset;\n\tif (ifdStart + 2 > bytes.length) return 1;\n\n\tconst entryCount = read16(ifdStart);\n\tfor (let i = 0; i < entryCount; i++) {\n\t\tconst entryPos = ifdStart + 2 + i * 12;\n\t\tif (entryPos + 12 > bytes.length) return 1;\n\n\t\tif (read16(entryPos) === 0x0112) {\n\t\t\tconst value = read16(entryPos + 8);\n\t\t\treturn value >= 1 && value <= 8 ? value : 1;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nfunction findJpegTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 2;\n\twhile (offset < bytes.length - 1) {\n\t\tif (bytes[offset] !== 0xff) return -1;\n\t\tconst marker = bytes[offset + 1];\n\t\tif (marker === 0xff) {\n\t\t\toffset++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (marker === 0xe1) {\n\t\t\tif (offset + 4 >= bytes.length) return -1;\n\t\t\tconst segmentStart = offset + 4;\n\t\t\tif (segmentStart + 6 > bytes.length) return -1;\n\t\t\tif (hasExifHeader(bytes, segmentStart)) return segmentStart + 6;\n\t\t}\n\n\t\tif (offset + 4 > bytes.length) return -1;\n\t\tconst length = (bytes[offset + 2] << 8) | bytes[offset + 3];\n\t\toffset += 2 + length;\n\t}\n\n\treturn -1;\n}\n\nfunction findWebpTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 12;\n\twhile (offset + 8 <= bytes.length) {\n\t\tconst chunkId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);\n\t\tconst chunkSize =\n\t\t\tbytes[offset + 4] | (bytes[offset + 5] << 8) | (bytes[offset + 6] << 16) | (bytes[offset + 7] << 24);\n\t\tconst dataStart = offset + 8;\n\n\t\tif (chunkId === \"EXIF\") {\n\t\t\tif (dataStart + chunkSize > bytes.length) return -1;\n\t\t\t// Some WebP files have \"Exif\\0\\0\" prefix before the TIFF header\n\t\t\tconst tiffStart = chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;\n\t\t\treturn tiffStart;\n\t\t}\n\n\t\t// RIFF chunks are padded to even size\n\t\toffset = dataStart + chunkSize + (chunkSize % 2);\n\t}\n\n\treturn -1;\n}\n\nfunction hasExifHeader(bytes: Uint8Array, offset: number): boolean {\n\treturn (\n\t\tbytes[offset] === 0x45 &&\n\t\tbytes[offset + 1] === 0x78 &&\n\t\tbytes[offset + 2] === 0x69 &&\n\t\tbytes[offset + 3] === 0x66 &&\n\t\tbytes[offset + 4] === 0x00 &&\n\t\tbytes[offset + 5] === 0x00\n\t);\n}\n\nfunction getExifOrientation(bytes: Uint8Array): number {\n\tlet tiffOffset = -1;\n\n\t// JPEG: starts with FF D8\n\tif (bytes.length >= 2 && bytes[0] === 0xff && bytes[1] === 0xd8) {\n\t\ttiffOffset = findJpegTiffOffset(bytes);\n\t}\n\t// WebP: starts with RIFF....WEBP\n\telse if (\n\t\tbytes.length >= 12 &&\n\t\tbytes[0] === 0x52 &&\n\t\tbytes[1] === 0x49 &&\n\t\tbytes[2] === 0x46 &&\n\t\tbytes[3] === 0x46 &&\n\t\tbytes[8] === 0x57 &&\n\t\tbytes[9] === 0x45 &&\n\t\tbytes[10] === 0x42 &&\n\t\tbytes[11] === 0x50\n\t) {\n\t\ttiffOffset = findWebpTiffOffset(bytes);\n\t}\n\n\tif (tiffOffset === -1) return 1;\n\treturn readOrientationFromTiff(bytes, tiffOffset);\n}\n\ntype DstIndexFn = (x: number, y: number, w: number, h: number) => number;\n\nfunction rotate90(photon: Photon, image: PhotonImageType, dstIndex: DstIndexFn): PhotonImageType {\n\tconst w = image.get_width();\n\tconst h = image.get_height();\n\tconst src = image.get_raw_pixels();\n\tconst dst = new Uint8Array(src.length);\n\n\tfor (let y = 0; y < h; y++) {\n\t\tfor (let x = 0; x < w; x++) {\n\t\t\tconst srcIdx = (y * w + x) * 4;\n\t\t\tconst dstIdx = dstIndex(x, y, w, h) * 4;\n\t\t\tdst[dstIdx] = src[srcIdx];\n\t\t\tdst[dstIdx + 1] = src[srcIdx + 1];\n\t\t\tdst[dstIdx + 2] = src[srcIdx + 2];\n\t\t\tdst[dstIdx + 3] = src[srcIdx + 3];\n\t\t}\n\t}\n\n\treturn new photon.PhotonImage(dst, h, w);\n}\n\n// Flip orientations mutate in-place. Rotations return a new image (caller must free the old one if different).\nexport function applyExifOrientation(\n\tphoton: Photon,\n\timage: PhotonImageType,\n\toriginalBytes: Uint8Array,\n): PhotonImageType {\n\tconst orientation = getExifOrientation(originalBytes);\n\tif (orientation === 1) return image;\n\n\tswitch (orientation) {\n\t\tcase 2:\n\t\t\tphoton.fliph(image);\n\t\t\treturn image;\n\t\tcase 3:\n\t\t\tphoton.fliph(image);\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 4:\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 5: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 6:\n\t\t\treturn rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\tcase 7: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 8:\n\t\t\treturn rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\tdefault:\n\t\t\treturn image;\n\t}\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  export declare function getToolPath(tool: "fd" | "rg"): string | null;
2
+ export declare function getLatestVersion(repo: string): Promise<string>;
2
3
  export interface ToolStatus {
3
4
  type: "info" | "warning";
4
5
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"tools-manager.d.ts","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AAsFA,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAmB5D;AA6ND,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,EACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GACrC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoC7B"}
1
+ {"version":3,"file":"tools-manager.d.ts","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AAoFA,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAmB5D;AAQD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BpE;AAyMD,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,EACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GACrC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAgD7B"}