orient-cli 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (862) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/integrations/notebooklm/notebooklm-extension.d.ts +1 -1
  7. package/dist/integrations/notebooklm/notebooklm-extension.js +1 -1
  8. package/dist/integrations/notebooklm/notebooklm-extension.js.map +1 -1
  9. package/dist/orient/change-packet.d.ts +2 -1
  10. package/dist/orient/change-packet.js +25 -8
  11. package/dist/orient/change-packet.js.map +1 -1
  12. package/dist/orient/clarify.d.ts +114 -0
  13. package/dist/orient/clarify.js +186 -0
  14. package/dist/orient/clarify.js.map +1 -0
  15. package/dist/orient/clear-command.d.ts +79 -0
  16. package/dist/orient/clear-command.js +117 -0
  17. package/dist/orient/clear-command.js.map +1 -0
  18. package/dist/orient/mode.d.ts +70 -0
  19. package/dist/orient/mode.js +124 -0
  20. package/dist/orient/mode.js.map +1 -0
  21. package/dist/orient/orient-extension.d.ts +1 -1
  22. package/dist/orient/orient-extension.js +306 -17
  23. package/dist/orient/orient-extension.js.map +1 -1
  24. package/dist/orient/plan-execute.d.ts +137 -0
  25. package/dist/orient/plan-execute.js +333 -0
  26. package/dist/orient/plan-execute.js.map +1 -0
  27. package/dist/orient/tiers.d.ts +109 -0
  28. package/dist/orient/tiers.js +162 -0
  29. package/dist/orient/tiers.js.map +1 -0
  30. package/dist/orient/wizard.d.ts +108 -0
  31. package/dist/orient/wizard.js +183 -0
  32. package/dist/orient/wizard.js.map +1 -0
  33. package/docs/open-source-resources.md +1 -1
  34. package/node_modules/@orient-cli/agent-core/README.md +456 -0
  35. package/node_modules/@orient-cli/agent-core/dist/agent-loop.d.ts +24 -0
  36. package/node_modules/@orient-cli/agent-core/dist/agent-loop.d.ts.map +1 -0
  37. package/node_modules/@orient-cli/agent-core/dist/agent-loop.js +404 -0
  38. package/node_modules/@orient-cli/agent-core/dist/agent-loop.js.map +1 -0
  39. package/node_modules/@orient-cli/agent-core/dist/agent.d.ts +115 -0
  40. package/node_modules/@orient-cli/agent-core/dist/agent.d.ts.map +1 -0
  41. package/node_modules/@orient-cli/agent-core/dist/agent.js +395 -0
  42. package/node_modules/@orient-cli/agent-core/dist/agent.js.map +1 -0
  43. package/node_modules/@orient-cli/agent-core/dist/index.d.ts +5 -0
  44. package/node_modules/@orient-cli/agent-core/dist/index.d.ts.map +1 -0
  45. package/node_modules/@orient-cli/agent-core/dist/index.js +9 -0
  46. package/node_modules/@orient-cli/agent-core/dist/index.js.map +1 -0
  47. package/node_modules/@orient-cli/agent-core/dist/proxy.d.ts +85 -0
  48. package/node_modules/@orient-cli/agent-core/dist/proxy.d.ts.map +1 -0
  49. package/node_modules/@orient-cli/agent-core/dist/proxy.js +268 -0
  50. package/node_modules/@orient-cli/agent-core/dist/proxy.js.map +1 -0
  51. package/node_modules/@orient-cli/agent-core/dist/types.d.ts +323 -0
  52. package/node_modules/@orient-cli/agent-core/dist/types.d.ts.map +1 -0
  53. package/node_modules/@orient-cli/agent-core/dist/types.js +2 -0
  54. package/node_modules/@orient-cli/agent-core/dist/types.js.map +1 -0
  55. package/node_modules/@orient-cli/agent-core/package.json +44 -0
  56. package/node_modules/@orient-cli/ai/README.md +1315 -0
  57. package/node_modules/@orient-cli/ai/dist/api-registry.d.ts +20 -0
  58. package/node_modules/@orient-cli/ai/dist/api-registry.d.ts.map +1 -0
  59. package/node_modules/@orient-cli/ai/dist/api-registry.js +44 -0
  60. package/node_modules/@orient-cli/ai/dist/api-registry.js.map +1 -0
  61. package/node_modules/@orient-cli/ai/dist/bedrock-provider.d.ts +5 -0
  62. package/node_modules/@orient-cli/ai/dist/bedrock-provider.d.ts.map +1 -0
  63. package/node_modules/@orient-cli/ai/dist/bedrock-provider.js +6 -0
  64. package/node_modules/@orient-cli/ai/dist/bedrock-provider.js.map +1 -0
  65. package/node_modules/@orient-cli/ai/dist/cli.d.ts +3 -0
  66. package/node_modules/@orient-cli/ai/dist/cli.d.ts.map +1 -0
  67. package/node_modules/@orient-cli/ai/dist/cli.js +116 -0
  68. package/node_modules/@orient-cli/ai/dist/cli.js.map +1 -0
  69. package/node_modules/@orient-cli/ai/dist/env-api-keys.d.ts +9 -0
  70. package/node_modules/@orient-cli/ai/dist/env-api-keys.d.ts.map +1 -0
  71. package/node_modules/@orient-cli/ai/dist/env-api-keys.js +107 -0
  72. package/node_modules/@orient-cli/ai/dist/env-api-keys.js.map +1 -0
  73. package/node_modules/@orient-cli/ai/dist/index.d.ts +26 -0
  74. package/node_modules/@orient-cli/ai/dist/index.d.ts.map +1 -0
  75. package/node_modules/@orient-cli/ai/dist/index.js +14 -0
  76. package/node_modules/@orient-cli/ai/dist/index.js.map +1 -0
  77. package/node_modules/@orient-cli/ai/dist/models.d.ts +24 -0
  78. package/node_modules/@orient-cli/ai/dist/models.d.ts.map +1 -0
  79. package/node_modules/@orient-cli/ai/dist/models.generated.d.ts +14473 -0
  80. package/node_modules/@orient-cli/ai/dist/models.generated.d.ts.map +1 -0
  81. package/node_modules/@orient-cli/ai/dist/models.generated.js +14241 -0
  82. package/node_modules/@orient-cli/ai/dist/models.generated.js.map +1 -0
  83. package/node_modules/@orient-cli/ai/dist/models.js +55 -0
  84. package/node_modules/@orient-cli/ai/dist/models.js.map +1 -0
  85. package/node_modules/@orient-cli/ai/dist/oauth.d.ts +2 -0
  86. package/node_modules/@orient-cli/ai/dist/oauth.d.ts.map +1 -0
  87. package/node_modules/@orient-cli/ai/dist/oauth.js +2 -0
  88. package/node_modules/@orient-cli/ai/dist/oauth.js.map +1 -0
  89. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts +20 -0
  90. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  91. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.js +651 -0
  92. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.js.map +1 -0
  93. package/node_modules/@orient-cli/ai/dist/providers/anthropic.d.ts +40 -0
  94. package/node_modules/@orient-cli/ai/dist/providers/anthropic.d.ts.map +1 -0
  95. package/node_modules/@orient-cli/ai/dist/providers/anthropic.js +749 -0
  96. package/node_modules/@orient-cli/ai/dist/providers/anthropic.js.map +1 -0
  97. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts +15 -0
  98. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  99. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.js +176 -0
  100. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.js.map +1 -0
  101. package/node_modules/@orient-cli/ai/dist/providers/faux.d.ts +56 -0
  102. package/node_modules/@orient-cli/ai/dist/providers/faux.d.ts.map +1 -0
  103. package/node_modules/@orient-cli/ai/dist/providers/faux.js +367 -0
  104. package/node_modules/@orient-cli/ai/dist/providers/faux.js.map +1 -0
  105. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts +8 -0
  106. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  107. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.js +29 -0
  108. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.js.map +1 -0
  109. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts +74 -0
  110. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts.map +1 -0
  111. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.js +776 -0
  112. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.js.map +1 -0
  113. package/node_modules/@orient-cli/ai/dist/providers/google-shared.d.ts +65 -0
  114. package/node_modules/@orient-cli/ai/dist/providers/google-shared.d.ts.map +1 -0
  115. package/node_modules/@orient-cli/ai/dist/providers/google-shared.js +312 -0
  116. package/node_modules/@orient-cli/ai/dist/providers/google-shared.js.map +1 -0
  117. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.d.ts +15 -0
  118. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.d.ts.map +1 -0
  119. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.js +419 -0
  120. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.js.map +1 -0
  121. package/node_modules/@orient-cli/ai/dist/providers/google.d.ts +13 -0
  122. package/node_modules/@orient-cli/ai/dist/providers/google.d.ts.map +1 -0
  123. package/node_modules/@orient-cli/ai/dist/providers/google.js +399 -0
  124. package/node_modules/@orient-cli/ai/dist/providers/google.js.map +1 -0
  125. package/node_modules/@orient-cli/ai/dist/providers/mistral.d.ts +22 -0
  126. package/node_modules/@orient-cli/ai/dist/providers/mistral.d.ts.map +1 -0
  127. package/node_modules/@orient-cli/ai/dist/providers/mistral.js +501 -0
  128. package/node_modules/@orient-cli/ai/dist/providers/mistral.js.map +1 -0
  129. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts +9 -0
  130. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  131. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.js +741 -0
  132. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.js.map +1 -0
  133. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.d.ts +15 -0
  134. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.d.ts.map +1 -0
  135. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.js +753 -0
  136. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.js.map +1 -0
  137. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts +17 -0
  138. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  139. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.js +470 -0
  140. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.js.map +1 -0
  141. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.d.ts +13 -0
  142. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.d.ts.map +1 -0
  143. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.js +190 -0
  144. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.js.map +1 -0
  145. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.d.ts +38 -0
  146. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.d.ts.map +1 -0
  147. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.js +261 -0
  148. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.js.map +1 -0
  149. package/node_modules/@orient-cli/ai/dist/providers/simple-options.d.ts +8 -0
  150. package/node_modules/@orient-cli/ai/dist/providers/simple-options.d.ts.map +1 -0
  151. package/node_modules/@orient-cli/ai/dist/providers/simple-options.js +35 -0
  152. package/node_modules/@orient-cli/ai/dist/providers/simple-options.js.map +1 -0
  153. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.d.ts +8 -0
  154. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.d.ts.map +1 -0
  155. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.js +155 -0
  156. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.js.map +1 -0
  157. package/node_modules/@orient-cli/ai/dist/stream.d.ts +8 -0
  158. package/node_modules/@orient-cli/ai/dist/stream.d.ts.map +1 -0
  159. package/node_modules/@orient-cli/ai/dist/stream.js +27 -0
  160. package/node_modules/@orient-cli/ai/dist/stream.js.map +1 -0
  161. package/node_modules/@orient-cli/ai/dist/types.d.ts +353 -0
  162. package/node_modules/@orient-cli/ai/dist/types.d.ts.map +1 -0
  163. package/node_modules/@orient-cli/ai/dist/types.js +2 -0
  164. package/node_modules/@orient-cli/ai/dist/types.js.map +1 -0
  165. package/node_modules/@orient-cli/ai/dist/utils/event-stream.d.ts +21 -0
  166. package/node_modules/@orient-cli/ai/dist/utils/event-stream.d.ts.map +1 -0
  167. package/node_modules/@orient-cli/ai/dist/utils/event-stream.js +81 -0
  168. package/node_modules/@orient-cli/ai/dist/utils/event-stream.js.map +1 -0
  169. package/node_modules/@orient-cli/ai/dist/utils/hash.d.ts +3 -0
  170. package/node_modules/@orient-cli/ai/dist/utils/hash.d.ts.map +1 -0
  171. package/node_modules/@orient-cli/ai/dist/utils/hash.js +14 -0
  172. package/node_modules/@orient-cli/ai/dist/utils/hash.js.map +1 -0
  173. package/node_modules/@orient-cli/ai/dist/utils/json-parse.d.ts +9 -0
  174. package/node_modules/@orient-cli/ai/dist/utils/json-parse.d.ts.map +1 -0
  175. package/node_modules/@orient-cli/ai/dist/utils/json-parse.js +29 -0
  176. package/node_modules/@orient-cli/ai/dist/utils/json-parse.js.map +1 -0
  177. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts +25 -0
  178. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  179. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.js +335 -0
  180. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.js.map +1 -0
  181. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  182. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  183. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.js +292 -0
  184. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.js.map +1 -0
  185. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts +26 -0
  186. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -0
  187. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.js +376 -0
  188. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.js.map +1 -0
  189. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts +26 -0
  190. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -0
  191. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js +481 -0
  192. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js.map +1 -0
  193. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.d.ts +61 -0
  194. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.d.ts.map +1 -0
  195. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.js +131 -0
  196. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.js.map +1 -0
  197. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  198. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  199. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.js +105 -0
  200. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.js.map +1 -0
  201. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts +34 -0
  202. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  203. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.js +373 -0
  204. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.js.map +1 -0
  205. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.d.ts +13 -0
  206. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  207. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.js +31 -0
  208. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.js.map +1 -0
  209. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.d.ts +47 -0
  210. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.d.ts.map +1 -0
  211. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.js +2 -0
  212. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.js.map +1 -0
  213. package/node_modules/@orient-cli/ai/dist/utils/overflow.d.ts +53 -0
  214. package/node_modules/@orient-cli/ai/dist/utils/overflow.d.ts.map +1 -0
  215. package/node_modules/@orient-cli/ai/dist/utils/overflow.js +132 -0
  216. package/node_modules/@orient-cli/ai/dist/utils/overflow.js.map +1 -0
  217. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts +22 -0
  218. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  219. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.js +26 -0
  220. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.js.map +1 -0
  221. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.d.ts +17 -0
  222. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  223. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.js +21 -0
  224. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.js.map +1 -0
  225. package/node_modules/@orient-cli/ai/dist/utils/validation.d.ts +18 -0
  226. package/node_modules/@orient-cli/ai/dist/utils/validation.d.ts.map +1 -0
  227. package/node_modules/@orient-cli/ai/dist/utils/validation.js +80 -0
  228. package/node_modules/@orient-cli/ai/dist/utils/validation.js.map +1 -0
  229. package/node_modules/@orient-cli/ai/package.json +114 -0
  230. package/node_modules/@orient-cli/coding-agent/README.md +618 -0
  231. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts +3 -0
  232. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts.map +1 -0
  233. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js +7 -0
  234. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js.map +1 -0
  235. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts +2 -0
  236. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts.map +1 -0
  237. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.js +4 -0
  238. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.js.map +1 -0
  239. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts +52 -0
  240. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts.map +1 -0
  241. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js +326 -0
  242. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js.map +1 -0
  243. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts +14 -0
  244. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts.map +1 -0
  245. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js +31 -0
  246. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js.map +1 -0
  247. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts +15 -0
  248. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts.map +1 -0
  249. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js +83 -0
  250. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js.map +1 -0
  251. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts +18 -0
  252. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts.map +1 -0
  253. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js +22 -0
  254. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js.map +1 -0
  255. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts +9 -0
  256. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts.map +1 -0
  257. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js +92 -0
  258. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js.map +1 -0
  259. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts +9 -0
  260. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts.map +1 -0
  261. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js +35 -0
  262. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js.map +1 -0
  263. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts +3 -0
  264. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts.map +1 -0
  265. package/node_modules/@orient-cli/coding-agent/dist/cli.js +15 -0
  266. package/node_modules/@orient-cli/coding-agent/dist/cli.js.map +1 -0
  267. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts +77 -0
  268. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts.map +1 -0
  269. package/node_modules/@orient-cli/coding-agent/dist/config.js +229 -0
  270. package/node_modules/@orient-cli/coding-agent/dist/config.js.map +1 -0
  271. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts +83 -0
  272. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -0
  273. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js +236 -0
  274. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js.map +1 -0
  275. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts +86 -0
  276. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts.map +1 -0
  277. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js +116 -0
  278. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js.map +1 -0
  279. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts +585 -0
  280. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts.map +1 -0
  281. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js +2497 -0
  282. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js.map +1 -0
  283. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts +132 -0
  284. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts.map +1 -0
  285. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js +422 -0
  286. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js.map +1 -0
  287. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts +46 -0
  288. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts.map +1 -0
  289. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js +125 -0
  290. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js.map +1 -0
  291. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts +88 -0
  292. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  293. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js +243 -0
  294. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js.map +1 -0
  295. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts +121 -0
  296. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts.map +1 -0
  297. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js +613 -0
  298. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js.map +1 -0
  299. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts +7 -0
  300. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts.map +1 -0
  301. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.js +7 -0
  302. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.js.map +1 -0
  303. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts +38 -0
  304. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts.map +1 -0
  305. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js +153 -0
  306. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js.map +1 -0
  307. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts +3 -0
  308. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts.map +1 -0
  309. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.js +2 -0
  310. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.js.map +1 -0
  311. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts +15 -0
  312. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts.map +1 -0
  313. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.js +2 -0
  314. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.js.map +1 -0
  315. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts +9 -0
  316. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts.map +1 -0
  317. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js +25 -0
  318. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js.map +1 -0
  319. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts +29 -0
  320. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts.map +1 -0
  321. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js +75 -0
  322. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js.map +1 -0
  323. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts +22 -0
  324. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  325. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js +249 -0
  326. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -0
  327. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts +37 -0
  328. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts.map +1 -0
  329. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js +224 -0
  330. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js.map +1 -0
  331. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.css +1001 -0
  332. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.html +55 -0
  333. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.js +1690 -0
  334. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts +40 -0
  335. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  336. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js +95 -0
  337. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js.map +1 -0
  338. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/highlight.min.js +1213 -0
  339. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/marked.min.js +6 -0
  340. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts +12 -0
  341. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts.map +1 -0
  342. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.js +9 -0
  343. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.js.map +1 -0
  344. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts +25 -0
  345. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts.map +1 -0
  346. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js +438 -0
  347. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js.map +1 -0
  348. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts +148 -0
  349. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts.map +1 -0
  350. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js +701 -0
  351. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js.map +1 -0
  352. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts +1073 -0
  353. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts.map +1 -0
  354. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js +45 -0
  355. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js.map +1 -0
  356. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts +20 -0
  357. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -0
  358. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js +22 -0
  359. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js.map +1 -0
  360. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts +48 -0
  361. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts.map +1 -0
  362. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js +314 -0
  363. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js.map +1 -0
  364. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts +12 -0
  365. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts.map +1 -0
  366. package/node_modules/@orient-cli/coding-agent/dist/core/index.js +12 -0
  367. package/node_modules/@orient-cli/coding-agent/dist/core/index.js.map +1 -0
  368. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts +293 -0
  369. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts.map +1 -0
  370. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js +248 -0
  371. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js.map +1 -0
  372. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts +77 -0
  373. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts.map +1 -0
  374. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js +123 -0
  375. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js.map +1 -0
  376. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts +132 -0
  377. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts.map +1 -0
  378. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js +612 -0
  379. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js.map +1 -0
  380. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts +110 -0
  381. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts.map +1 -0
  382. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js +486 -0
  383. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js.map +1 -0
  384. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts +6 -0
  385. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts.map +1 -0
  386. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js +59 -0
  387. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js.map +1 -0
  388. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts +192 -0
  389. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts.map +1 -0
  390. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js +1829 -0
  391. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js.map +1 -0
  392. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts +51 -0
  393. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts.map +1 -0
  394. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js +249 -0
  395. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js.map +1 -0
  396. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts +23 -0
  397. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts.map +1 -0
  398. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js +126 -0
  399. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js.map +1 -0
  400. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts +185 -0
  401. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts.map +1 -0
  402. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js +720 -0
  403. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js.map +1 -0
  404. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts +93 -0
  405. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts.map +1 -0
  406. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js +236 -0
  407. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js.map +1 -0
  408. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts +19 -0
  409. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts.map +1 -0
  410. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js +38 -0
  411. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js.map +1 -0
  412. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts +333 -0
  413. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts.map +1 -0
  414. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js +1105 -0
  415. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js.map +1 -0
  416. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts +237 -0
  417. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts.map +1 -0
  418. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js +708 -0
  419. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js.map +1 -0
  420. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts +60 -0
  421. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts.map +1 -0
  422. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js +409 -0
  423. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js.map +1 -0
  424. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts +14 -0
  425. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts.map +1 -0
  426. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.js +23 -0
  427. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.js.map +1 -0
  428. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts +18 -0
  429. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts.map +1 -0
  430. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js +19 -0
  431. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js.map +1 -0
  432. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts +28 -0
  433. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts.map +1 -0
  434. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js +116 -0
  435. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js.map +1 -0
  436. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts +8 -0
  437. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts.map +1 -0
  438. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js +31 -0
  439. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js.map +1 -0
  440. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts +73 -0
  441. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts.map +1 -0
  442. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js +352 -0
  443. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js.map +1 -0
  444. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts +85 -0
  445. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -0
  446. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js +337 -0
  447. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js.map +1 -0
  448. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts +53 -0
  449. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts.map +1 -0
  450. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js +196 -0
  451. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js.map +1 -0
  452. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts +6 -0
  453. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  454. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js +37 -0
  455. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js.map +1 -0
  456. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts +46 -0
  457. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts.map +1 -0
  458. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js +258 -0
  459. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js.map +1 -0
  460. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts +56 -0
  461. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts.map +1 -0
  462. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js +293 -0
  463. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js.map +1 -0
  464. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts +115 -0
  465. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts.map +1 -0
  466. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js +86 -0
  467. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js.map +1 -0
  468. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts +46 -0
  469. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts.map +1 -0
  470. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js +172 -0
  471. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js.map +1 -0
  472. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts +8 -0
  473. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts.map +1 -0
  474. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js +81 -0
  475. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js.map +1 -0
  476. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts +46 -0
  477. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts.map +1 -0
  478. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js +225 -0
  479. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js.map +1 -0
  480. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts +21 -0
  481. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts.map +1 -0
  482. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js +49 -0
  483. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js.map +1 -0
  484. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  485. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  486. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js +32 -0
  487. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  488. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts +70 -0
  489. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts.map +1 -0
  490. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js +205 -0
  491. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js.map +1 -0
  492. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts +35 -0
  493. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts.map +1 -0
  494. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js +216 -0
  495. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js.map +1 -0
  496. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts +28 -0
  497. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts.map +1 -0
  498. package/node_modules/@orient-cli/coding-agent/dist/index.js +43 -0
  499. package/node_modules/@orient-cli/coding-agent/dist/index.js.map +1 -0
  500. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts +8 -0
  501. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts.map +1 -0
  502. package/node_modules/@orient-cli/coding-agent/dist/main.js +593 -0
  503. package/node_modules/@orient-cli/coding-agent/dist/main.js.map +1 -0
  504. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts +33 -0
  505. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts.map +1 -0
  506. package/node_modules/@orient-cli/coding-agent/dist/migrations.js +281 -0
  507. package/node_modules/@orient-cli/coding-agent/dist/migrations.js.map +1 -0
  508. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts +9 -0
  509. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts.map +1 -0
  510. package/node_modules/@orient-cli/coding-agent/dist/modes/index.js +8 -0
  511. package/node_modules/@orient-cli/coding-agent/dist/modes/index.js.map +1 -0
  512. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts +18 -0
  513. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  514. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js +107 -0
  515. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -0
  516. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  517. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  518. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js +175 -0
  519. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -0
  520. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  521. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  522. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js +51 -0
  523. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  524. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  525. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  526. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js +44 -0
  527. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  528. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  529. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  530. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js +45 -0
  531. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  532. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts +71 -0
  533. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  534. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js +479 -0
  535. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -0
  536. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  537. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  538. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js +33 -0
  539. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  540. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts +21 -0
  541. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  542. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js +70 -0
  543. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -0
  544. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts +20 -0
  545. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  546. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js +79 -0
  547. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -0
  548. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts +12 -0
  549. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -0
  550. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js +133 -0
  551. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js.map +1 -0
  552. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  553. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  554. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js +21 -0
  555. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  556. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts +20 -0
  557. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  558. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js +111 -0
  559. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -0
  560. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts +23 -0
  561. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  562. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js +61 -0
  563. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -0
  564. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts +24 -0
  565. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  566. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js +78 -0
  567. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -0
  568. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts +27 -0
  569. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -0
  570. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js +201 -0
  571. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js.map +1 -0
  572. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts +31 -0
  573. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -0
  574. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js +34 -0
  575. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js.map +1 -0
  576. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts +8 -0
  577. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  578. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js +22 -0
  579. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  580. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts +42 -0
  581. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  582. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js +145 -0
  583. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -0
  584. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts +47 -0
  585. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  586. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js +275 -0
  587. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -0
  588. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
  589. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  590. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js +97 -0
  591. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  592. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts +53 -0
  593. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts.map +1 -0
  594. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js +204 -0
  595. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js.map +1 -0
  596. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
  597. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  598. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js +275 -0
  599. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  600. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  601. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  602. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js +155 -0
  603. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  604. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts +95 -0
  605. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  606. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js +848 -0
  607. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -0
  608. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts +58 -0
  609. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  610. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js +301 -0
  611. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -0
  612. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  613. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  614. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js +39 -0
  615. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  616. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  617. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  618. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js +47 -0
  619. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  620. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  621. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  622. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js +50 -0
  623. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -0
  624. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  625. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  626. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js +51 -0
  627. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  628. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts +58 -0
  629. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  630. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js +274 -0
  631. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -0
  632. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts +89 -0
  633. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  634. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js +1084 -0
  635. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -0
  636. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  637. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  638. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js +113 -0
  639. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  640. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts +9 -0
  641. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  642. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js +28 -0
  643. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js.map +1 -0
  644. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  645. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  646. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js +33 -0
  647. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  648. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts +345 -0
  649. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  650. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js +4106 -0
  651. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -0
  652. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/dark.json +85 -0
  653. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/light.json +84 -0
  654. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme-schema.json +335 -0
  655. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts +81 -0
  656. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  657. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js +979 -0
  658. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js.map +1 -0
  659. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts +28 -0
  660. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts.map +1 -0
  661. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js +112 -0
  662. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js.map +1 -0
  663. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts +17 -0
  664. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts.map +1 -0
  665. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js +49 -0
  666. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js.map +1 -0
  667. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts +217 -0
  668. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  669. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js +402 -0
  670. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js.map +1 -0
  671. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts +20 -0
  672. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  673. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js +550 -0
  674. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -0
  675. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts +408 -0
  676. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  677. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js +8 -0
  678. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js.map +1 -0
  679. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts +4 -0
  680. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts.map +1 -0
  681. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js +234 -0
  682. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js.map +1 -0
  683. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts +21 -0
  684. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts.map +1 -0
  685. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js +87 -0
  686. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js.map +1 -0
  687. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts +11 -0
  688. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts.map +1 -0
  689. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js +78 -0
  690. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js.map +1 -0
  691. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts +11 -0
  692. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts.map +1 -0
  693. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js +245 -0
  694. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js.map +1 -0
  695. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts +8 -0
  696. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts.map +1 -0
  697. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js +14 -0
  698. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js.map +1 -0
  699. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts +2 -0
  700. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts.map +1 -0
  701. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js +78 -0
  702. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js.map +1 -0
  703. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts +5 -0
  704. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts.map +1 -0
  705. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js +158 -0
  706. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js.map +1 -0
  707. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts +8 -0
  708. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts.map +1 -0
  709. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js +26 -0
  710. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js.map +1 -0
  711. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts +26 -0
  712. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts.map +1 -0
  713. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js +163 -0
  714. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js.map +1 -0
  715. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts +9 -0
  716. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts.map +1 -0
  717. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js +39 -0
  718. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js.map +1 -0
  719. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts +36 -0
  720. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts.map +1 -0
  721. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js +137 -0
  722. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js.map +1 -0
  723. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts +2 -0
  724. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts.map +1 -0
  725. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js +26 -0
  726. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js.map +1 -0
  727. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts +7 -0
  728. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts.map +1 -0
  729. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js +19 -0
  730. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js.map +1 -0
  731. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts +21 -0
  732. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts.map +1 -0
  733. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js +121 -0
  734. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js.map +1 -0
  735. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts +26 -0
  736. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts.map +1 -0
  737. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js +186 -0
  738. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js.map +1 -0
  739. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts +5 -0
  740. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts.map +1 -0
  741. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js +17 -0
  742. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js.map +1 -0
  743. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts +3 -0
  744. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts.map +1 -0
  745. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js +252 -0
  746. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js.map +1 -0
  747. package/node_modules/@orient-cli/coding-agent/package.json +104 -0
  748. package/node_modules/@orient-cli/tui/README.md +767 -0
  749. package/node_modules/@orient-cli/tui/dist/autocomplete.d.ts +52 -0
  750. package/node_modules/@orient-cli/tui/dist/autocomplete.d.ts.map +1 -0
  751. package/node_modules/@orient-cli/tui/dist/autocomplete.js +623 -0
  752. package/node_modules/@orient-cli/tui/dist/autocomplete.js.map +1 -0
  753. package/node_modules/@orient-cli/tui/dist/components/box.d.ts +22 -0
  754. package/node_modules/@orient-cli/tui/dist/components/box.d.ts.map +1 -0
  755. package/node_modules/@orient-cli/tui/dist/components/box.js +104 -0
  756. package/node_modules/@orient-cli/tui/dist/components/box.js.map +1 -0
  757. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.d.ts +22 -0
  758. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.d.ts.map +1 -0
  759. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.js +35 -0
  760. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.js.map +1 -0
  761. package/node_modules/@orient-cli/tui/dist/components/editor.d.ts +244 -0
  762. package/node_modules/@orient-cli/tui/dist/components/editor.d.ts.map +1 -0
  763. package/node_modules/@orient-cli/tui/dist/components/editor.js +1861 -0
  764. package/node_modules/@orient-cli/tui/dist/components/editor.js.map +1 -0
  765. package/node_modules/@orient-cli/tui/dist/components/image.d.ts +28 -0
  766. package/node_modules/@orient-cli/tui/dist/components/image.d.ts.map +1 -0
  767. package/node_modules/@orient-cli/tui/dist/components/image.js +69 -0
  768. package/node_modules/@orient-cli/tui/dist/components/image.js.map +1 -0
  769. package/node_modules/@orient-cli/tui/dist/components/input.d.ts +37 -0
  770. package/node_modules/@orient-cli/tui/dist/components/input.d.ts.map +1 -0
  771. package/node_modules/@orient-cli/tui/dist/components/input.js +426 -0
  772. package/node_modules/@orient-cli/tui/dist/components/input.js.map +1 -0
  773. package/node_modules/@orient-cli/tui/dist/components/loader.d.ts +21 -0
  774. package/node_modules/@orient-cli/tui/dist/components/loader.d.ts.map +1 -0
  775. package/node_modules/@orient-cli/tui/dist/components/loader.js +49 -0
  776. package/node_modules/@orient-cli/tui/dist/components/loader.js.map +1 -0
  777. package/node_modules/@orient-cli/tui/dist/components/markdown.d.ts +95 -0
  778. package/node_modules/@orient-cli/tui/dist/components/markdown.d.ts.map +1 -0
  779. package/node_modules/@orient-cli/tui/dist/components/markdown.js +663 -0
  780. package/node_modules/@orient-cli/tui/dist/components/markdown.js.map +1 -0
  781. package/node_modules/@orient-cli/tui/dist/components/select-list.d.ts +50 -0
  782. package/node_modules/@orient-cli/tui/dist/components/select-list.d.ts.map +1 -0
  783. package/node_modules/@orient-cli/tui/dist/components/select-list.js +159 -0
  784. package/node_modules/@orient-cli/tui/dist/components/select-list.js.map +1 -0
  785. package/node_modules/@orient-cli/tui/dist/components/settings-list.d.ts +50 -0
  786. package/node_modules/@orient-cli/tui/dist/components/settings-list.d.ts.map +1 -0
  787. package/node_modules/@orient-cli/tui/dist/components/settings-list.js +185 -0
  788. package/node_modules/@orient-cli/tui/dist/components/settings-list.js.map +1 -0
  789. package/node_modules/@orient-cli/tui/dist/components/spacer.d.ts +12 -0
  790. package/node_modules/@orient-cli/tui/dist/components/spacer.d.ts.map +1 -0
  791. package/node_modules/@orient-cli/tui/dist/components/spacer.js +23 -0
  792. package/node_modules/@orient-cli/tui/dist/components/spacer.js.map +1 -0
  793. package/node_modules/@orient-cli/tui/dist/components/text.d.ts +19 -0
  794. package/node_modules/@orient-cli/tui/dist/components/text.d.ts.map +1 -0
  795. package/node_modules/@orient-cli/tui/dist/components/text.js +89 -0
  796. package/node_modules/@orient-cli/tui/dist/components/text.js.map +1 -0
  797. package/node_modules/@orient-cli/tui/dist/components/truncated-text.d.ts +13 -0
  798. package/node_modules/@orient-cli/tui/dist/components/truncated-text.d.ts.map +1 -0
  799. package/node_modules/@orient-cli/tui/dist/components/truncated-text.js +51 -0
  800. package/node_modules/@orient-cli/tui/dist/components/truncated-text.js.map +1 -0
  801. package/node_modules/@orient-cli/tui/dist/editor-component.d.ts +39 -0
  802. package/node_modules/@orient-cli/tui/dist/editor-component.d.ts.map +1 -0
  803. package/node_modules/@orient-cli/tui/dist/editor-component.js +2 -0
  804. package/node_modules/@orient-cli/tui/dist/editor-component.js.map +1 -0
  805. package/node_modules/@orient-cli/tui/dist/fuzzy.d.ts +16 -0
  806. package/node_modules/@orient-cli/tui/dist/fuzzy.d.ts.map +1 -0
  807. package/node_modules/@orient-cli/tui/dist/fuzzy.js +107 -0
  808. package/node_modules/@orient-cli/tui/dist/fuzzy.js.map +1 -0
  809. package/node_modules/@orient-cli/tui/dist/index.d.ts +23 -0
  810. package/node_modules/@orient-cli/tui/dist/index.d.ts.map +1 -0
  811. package/node_modules/@orient-cli/tui/dist/index.js +32 -0
  812. package/node_modules/@orient-cli/tui/dist/index.js.map +1 -0
  813. package/node_modules/@orient-cli/tui/dist/keybindings.d.ts +193 -0
  814. package/node_modules/@orient-cli/tui/dist/keybindings.d.ts.map +1 -0
  815. package/node_modules/@orient-cli/tui/dist/keybindings.js +174 -0
  816. package/node_modules/@orient-cli/tui/dist/keybindings.js.map +1 -0
  817. package/node_modules/@orient-cli/tui/dist/keys.d.ts +170 -0
  818. package/node_modules/@orient-cli/tui/dist/keys.d.ts.map +1 -0
  819. package/node_modules/@orient-cli/tui/dist/keys.js +1124 -0
  820. package/node_modules/@orient-cli/tui/dist/keys.js.map +1 -0
  821. package/node_modules/@orient-cli/tui/dist/kill-ring.d.ts +28 -0
  822. package/node_modules/@orient-cli/tui/dist/kill-ring.d.ts.map +1 -0
  823. package/node_modules/@orient-cli/tui/dist/kill-ring.js +44 -0
  824. package/node_modules/@orient-cli/tui/dist/kill-ring.js.map +1 -0
  825. package/node_modules/@orient-cli/tui/dist/stdin-buffer.d.ts +48 -0
  826. package/node_modules/@orient-cli/tui/dist/stdin-buffer.d.ts.map +1 -0
  827. package/node_modules/@orient-cli/tui/dist/stdin-buffer.js +317 -0
  828. package/node_modules/@orient-cli/tui/dist/stdin-buffer.js.map +1 -0
  829. package/node_modules/@orient-cli/tui/dist/terminal-image.d.ts +68 -0
  830. package/node_modules/@orient-cli/tui/dist/terminal-image.d.ts.map +1 -0
  831. package/node_modules/@orient-cli/tui/dist/terminal-image.js +288 -0
  832. package/node_modules/@orient-cli/tui/dist/terminal-image.js.map +1 -0
  833. package/node_modules/@orient-cli/tui/dist/terminal.d.ts +84 -0
  834. package/node_modules/@orient-cli/tui/dist/terminal.d.ts.map +1 -0
  835. package/node_modules/@orient-cli/tui/dist/terminal.js +285 -0
  836. package/node_modules/@orient-cli/tui/dist/terminal.js.map +1 -0
  837. package/node_modules/@orient-cli/tui/dist/tui.d.ts +222 -0
  838. package/node_modules/@orient-cli/tui/dist/tui.d.ts.map +1 -0
  839. package/node_modules/@orient-cli/tui/dist/tui.js +1008 -0
  840. package/node_modules/@orient-cli/tui/dist/tui.js.map +1 -0
  841. package/node_modules/@orient-cli/tui/dist/undo-stack.d.ts +17 -0
  842. package/node_modules/@orient-cli/tui/dist/undo-stack.d.ts.map +1 -0
  843. package/node_modules/@orient-cli/tui/dist/undo-stack.js +25 -0
  844. package/node_modules/@orient-cli/tui/dist/undo-stack.js.map +1 -0
  845. package/node_modules/@orient-cli/tui/dist/utils.d.ts +78 -0
  846. package/node_modules/@orient-cli/tui/dist/utils.d.ts.map +1 -0
  847. package/node_modules/@orient-cli/tui/dist/utils.js +960 -0
  848. package/node_modules/@orient-cli/tui/dist/utils.js.map +1 -0
  849. package/node_modules/@orient-cli/tui/package.json +52 -0
  850. package/package.json +47 -8
  851. package/schemas/orient-standard/templates-tier-1/brief.md +22 -0
  852. package/schemas/orient-standard/templates-tier-1/plan.md +17 -0
  853. package/schemas/orient-standard/templates-tier-1/spec.md +23 -0
  854. package/schemas/orient-standard/templates-tier-1/tasks.md +14 -0
  855. package/schemas/orient-standard/templates-tier-2/brief.md +32 -0
  856. package/schemas/orient-standard/templates-tier-2/plan.md +44 -0
  857. package/schemas/orient-standard/templates-tier-2/spec.md +46 -0
  858. package/schemas/orient-standard/templates-tier-2/tasks.md +34 -0
  859. package/schemas/orient-standard/templates-tier-3/brief.md +54 -0
  860. package/schemas/orient-standard/templates-tier-3/plan.md +67 -0
  861. package/schemas/orient-standard/templates-tier-3/spec.md +65 -0
  862. package/schemas/orient-standard/templates-tier-3/tasks.md +79 -0
@@ -0,0 +1,245 @@
1
+ import { spawnSync } from "child_process";
2
+ import { randomUUID } from "crypto";
3
+ import { readFileSync, unlinkSync } from "fs";
4
+ import { tmpdir } from "os";
5
+ import { join } from "path";
6
+ import { clipboard } from "./clipboard-native.js";
7
+ import { loadPhoton } from "./photon.js";
8
+ const SUPPORTED_IMAGE_MIME_TYPES = ["image/png", "image/jpeg", "image/webp", "image/gif"];
9
+ const DEFAULT_LIST_TIMEOUT_MS = 1000;
10
+ const DEFAULT_READ_TIMEOUT_MS = 3000;
11
+ const DEFAULT_POWERSHELL_TIMEOUT_MS = 5000;
12
+ const DEFAULT_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
13
+ export function isWaylandSession(env = process.env) {
14
+ return Boolean(env.WAYLAND_DISPLAY) || env.XDG_SESSION_TYPE === "wayland";
15
+ }
16
+ function baseMimeType(mimeType) {
17
+ return mimeType.split(";")[0]?.trim().toLowerCase() ?? mimeType.toLowerCase();
18
+ }
19
+ export function extensionForImageMimeType(mimeType) {
20
+ switch (baseMimeType(mimeType)) {
21
+ case "image/png":
22
+ return "png";
23
+ case "image/jpeg":
24
+ return "jpg";
25
+ case "image/webp":
26
+ return "webp";
27
+ case "image/gif":
28
+ return "gif";
29
+ default:
30
+ return null;
31
+ }
32
+ }
33
+ function selectPreferredImageMimeType(mimeTypes) {
34
+ const normalized = mimeTypes
35
+ .map((t) => t.trim())
36
+ .filter(Boolean)
37
+ .map((t) => ({ raw: t, base: baseMimeType(t) }));
38
+ for (const preferred of SUPPORTED_IMAGE_MIME_TYPES) {
39
+ const match = normalized.find((t) => t.base === preferred);
40
+ if (match) {
41
+ return match.raw;
42
+ }
43
+ }
44
+ const anyImage = normalized.find((t) => t.base.startsWith("image/"));
45
+ return anyImage?.raw ?? null;
46
+ }
47
+ function isSupportedImageMimeType(mimeType) {
48
+ const base = baseMimeType(mimeType);
49
+ return SUPPORTED_IMAGE_MIME_TYPES.some((t) => t === base);
50
+ }
51
+ /**
52
+ * Convert unsupported image formats to PNG using Photon.
53
+ * Returns null if conversion is unavailable or fails.
54
+ */
55
+ async function convertToPng(bytes) {
56
+ const photon = await loadPhoton();
57
+ if (!photon) {
58
+ return null;
59
+ }
60
+ try {
61
+ const image = photon.PhotonImage.new_from_byteslice(bytes);
62
+ try {
63
+ return image.get_bytes();
64
+ }
65
+ finally {
66
+ image.free();
67
+ }
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ }
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
98
+ .toString("utf-8")
99
+ .split(/\r?\n/)
100
+ .map((t) => t.trim())
101
+ .filter(Boolean);
102
+ const selectedType = selectPreferredImageMimeType(types);
103
+ if (!selectedType) {
104
+ return null;
105
+ }
106
+ const data = runCommand("wl-paste", ["--type", selectedType, "--no-newline"]);
107
+ if (!data.ok || data.stdout.length === 0) {
108
+ return null;
109
+ }
110
+ return { bytes: data.stdout, mimeType: baseMimeType(selectedType) };
111
+ }
112
+ function isWSL(env = process.env) {
113
+ if (env.WSL_DISTRO_NAME || env.WSLENV) {
114
+ return true;
115
+ }
116
+ try {
117
+ const release = readFileSync("/proc/version", "utf-8");
118
+ return /microsoft|wsl/i.test(release);
119
+ }
120
+ catch {
121
+ return false;
122
+ }
123
+ }
124
+ /**
125
+ * On WSL, the Linux clipboard (Wayland/X11) does not receive image data from
126
+ * Windows screenshots (Win+Shift+S). PowerShell can access the Windows clipboard
127
+ * directly, so we use it as a fallback.
128
+ */
129
+ function readClipboardImageViaPowerShell() {
130
+ const tmpFile = join(tmpdir(), `pi-wsl-clip-${randomUUID()}.png`);
131
+ try {
132
+ const winPathResult = runCommand("wslpath", ["-w", tmpFile], { timeoutMs: DEFAULT_LIST_TIMEOUT_MS });
133
+ if (!winPathResult.ok) {
134
+ return null;
135
+ }
136
+ const winPath = winPathResult.stdout.toString("utf-8").trim();
137
+ if (!winPath) {
138
+ return null;
139
+ }
140
+ const psScript = [
141
+ "Add-Type -AssemblyName System.Windows.Forms",
142
+ "Add-Type -AssemblyName System.Drawing",
143
+ "$path = $env:PI_WSL_CLIPBOARD_IMAGE_PATH",
144
+ "$img = [System.Windows.Forms.Clipboard]::GetImage()",
145
+ "if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }",
146
+ ].join("; ");
147
+ const result = runCommand("powershell.exe", ["-NoProfile", "-Command", psScript], {
148
+ timeoutMs: DEFAULT_POWERSHELL_TIMEOUT_MS,
149
+ env: { ...process.env, PI_WSL_CLIPBOARD_IMAGE_PATH: winPath },
150
+ });
151
+ if (!result.ok) {
152
+ return null;
153
+ }
154
+ const output = result.stdout.toString("utf-8").trim();
155
+ if (output !== "ok") {
156
+ return null;
157
+ }
158
+ const bytes = readFileSync(tmpFile);
159
+ if (bytes.length === 0) {
160
+ return null;
161
+ }
162
+ return { bytes: new Uint8Array(bytes), mimeType: "image/png" };
163
+ }
164
+ catch {
165
+ return null;
166
+ }
167
+ finally {
168
+ try {
169
+ unlinkSync(tmpFile);
170
+ }
171
+ catch {
172
+ // Ignore cleanup errors.
173
+ }
174
+ }
175
+ }
176
+ function readClipboardImageViaXclip() {
177
+ const targets = runCommand("xclip", ["-selection", "clipboard", "-t", "TARGETS", "-o"], {
178
+ timeoutMs: DEFAULT_LIST_TIMEOUT_MS,
179
+ });
180
+ let candidateTypes = [];
181
+ if (targets.ok) {
182
+ candidateTypes = targets.stdout
183
+ .toString("utf-8")
184
+ .split(/\r?\n/)
185
+ .map((t) => t.trim())
186
+ .filter(Boolean);
187
+ }
188
+ const preferred = candidateTypes.length > 0 ? selectPreferredImageMimeType(candidateTypes) : null;
189
+ const tryTypes = preferred ? [preferred, ...SUPPORTED_IMAGE_MIME_TYPES] : [...SUPPORTED_IMAGE_MIME_TYPES];
190
+ 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) };
194
+ }
195
+ }
196
+ return null;
197
+ }
198
+ async function readClipboardImageViaNativeClipboard() {
199
+ if (!clipboard || !clipboard.hasImage()) {
200
+ return null;
201
+ }
202
+ const imageData = await clipboard.getImageBinary();
203
+ if (!imageData || imageData.length === 0) {
204
+ return null;
205
+ }
206
+ const bytes = imageData instanceof Uint8Array ? imageData : Uint8Array.from(imageData);
207
+ return { bytes, mimeType: "image/png" };
208
+ }
209
+ export async function readClipboardImage(options) {
210
+ const env = options?.env ?? process.env;
211
+ const platform = options?.platform ?? process.platform;
212
+ if (env.TERMUX_VERSION) {
213
+ return null;
214
+ }
215
+ let image = null;
216
+ if (platform === "linux") {
217
+ 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();
227
+ }
228
+ }
229
+ else {
230
+ image = await readClipboardImageViaNativeClipboard();
231
+ }
232
+ if (!image) {
233
+ return null;
234
+ }
235
+ // Convert unsupported formats (e.g., BMP from WSLg) to PNG
236
+ if (!isSupportedImageMimeType(image.mimeType)) {
237
+ const pngBytes = await convertToPng(image.bytes);
238
+ if (!pngBytes) {
239
+ return null;
240
+ }
241
+ return { bytes: pngBytes, mimeType: "image/png" };
242
+ }
243
+ return image;
244
+ }
245
+ //# sourceMappingURL=clipboard-image.js.map
@@ -0,0 +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,EAAW;IAC/E,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,GAAG,CAAC,gBAAgB,KAAK,SAAS,CAAC;AAAA,CAC1E;AAED,SAAS,YAAY,CAAC,QAAgB,EAAU;IAC/C,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;AAAA,CAC9E;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAgB,EAAiB;IAC1E,QAAQ,YAAY,CAAC,QAAQ,CAAC,EA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awnSync } 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.js\";\nimport { loadPhoton } from \"./photon.js\";\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 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 = $env:PI_WSL_CLIPBOARD_IMAGE_PATH\",\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\tenv: { ...process.env, PI_WSL_CLIPBOARD_IMAGE_PATH: winPath },\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 || !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();\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"]}
@@ -0,0 +1,8 @@
1
+ export type ClipboardModule = {
2
+ setText: (text: string) => Promise<void>;
3
+ hasImage: () => boolean;
4
+ getImageBinary: () => Promise<Array<number>>;
5
+ };
6
+ declare let clipboard: ClipboardModule | null;
7
+ export { clipboard };
8
+ //# sourceMappingURL=clipboard-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard-native.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard-native.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAC7C,CAAC;AAGF,QAAA,IAAI,SAAS,EAAE,eAAe,GAAG,IAAW,CAAC;AAY7C,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { createRequire } from \"module\";\n\nexport type ClipboardModule = {\n\tsetText: (text: string) => Promise<void>;\n\thasImage: () => boolean;\n\tgetImageBinary: () => Promise<Array<number>>;\n};\n\nconst require = createRequire(import.meta.url);\nlet clipboard: ClipboardModule | null = null;\n\nconst hasDisplay = process.platform !== \"linux\" || Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);\n\nif (!process.env.TERMUX_VERSION && hasDisplay) {\n\ttry {\n\t\tclipboard = require(\"@mariozechner/clipboard\") as ClipboardModule;\n\t} catch {\n\t\tclipboard = null;\n\t}\n}\n\nexport { clipboard };\n"]}
@@ -0,0 +1,14 @@
1
+ import { createRequire } from "module";
2
+ const require = createRequire(import.meta.url);
3
+ let clipboard = null;
4
+ const hasDisplay = process.platform !== "linux" || Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);
5
+ if (!process.env.TERMUX_VERSION && hasDisplay) {
6
+ try {
7
+ clipboard = require("@mariozechner/clipboard");
8
+ }
9
+ catch {
10
+ clipboard = null;
11
+ }
12
+ }
13
+ export { clipboard };
14
+ //# sourceMappingURL=clipboard-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard-native.js","sourceRoot":"","sources":["../../src/utils/clipboard-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAQvC,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,IAAI,SAAS,GAA2B,IAAI,CAAC;AAE7C,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAE/G,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,UAAU,EAAE,CAAC;IAC/C,IAAI,CAAC;QACJ,SAAS,GAAG,OAAO,CAAC,yBAAyB,CAAoB,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACR,SAAS,GAAG,IAAI,CAAC;IAClB,CAAC;AACF,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { createRequire } from \"module\";\n\nexport type ClipboardModule = {\n\tsetText: (text: string) => Promise<void>;\n\thasImage: () => boolean;\n\tgetImageBinary: () => Promise<Array<number>>;\n};\n\nconst require = createRequire(import.meta.url);\nlet clipboard: ClipboardModule | null = null;\n\nconst hasDisplay = process.platform !== \"linux\" || Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);\n\nif (!process.env.TERMUX_VERSION && hasDisplay) {\n\ttry {\n\t\tclipboard = require(\"@mariozechner/clipboard\") as ClipboardModule;\n\t} catch {\n\t\tclipboard = null;\n\t}\n}\n\nexport { clipboard };\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function copyToClipboard(text: string): Promise<void>;
2
+ //# sourceMappingURL=clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAmBA,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6DjE","sourcesContent":["import { execSync, spawn } from \"child_process\";\nimport { platform } from \"os\";\nimport { isWaylandSession } from \"./clipboard-image.js\";\nimport { clipboard } from \"./clipboard-native.js\";\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\nexport async function copyToClipboard(text: string): Promise<void> {\n\t// Always emit OSC 52 - works over SSH/mosh, harmless locally\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\n\ttry {\n\t\tif (clipboard) {\n\t\t\tawait clipboard.setText(text);\n\t\t\treturn;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\t// Also try native tools (best effort for local sessions)\n\tconst p = platform();\n\tconst options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: [\"pipe\", \"ignore\", \"ignore\"] };\n\n\ttry {\n\t\tif (p === \"darwin\") {\n\t\t\texecSync(\"pbcopy\", options);\n\t\t} else if (p === \"win32\") {\n\t\t\texecSync(\"clip\", options);\n\t\t} else {\n\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\ttry {\n\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\treturn;\n\t\t\t\t} catch {\n\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);\n\t\t\tconst hasX11Display = Boolean(process.env.DISPLAY);\n\t\t\tconst isWayland = isWaylandSession();\n\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\ttry {\n\t\t\t\t\t// Verify wl-copy exists (spawn errors are async and won't be caught)\n\t\t\t\t\texecSync(\"which wl-copy\", { stdio: \"ignore\" });\n\t\t\t\t\t// wl-copy with execSync hangs due to fork behavior; use spawn instead\n\t\t\t\t\tconst proc = spawn(\"wl-copy\", [], { stdio: [\"pipe\", \"ignore\", \"ignore\"] });\n\t\t\t\t\tproc.stdin.on(\"error\", () => {\n\t\t\t\t\t\t// Ignore EPIPE errors if wl-copy exits early\n\t\t\t\t\t});\n\t\t\t\t\tproc.stdin.write(text);\n\t\t\t\t\tproc.stdin.end();\n\t\t\t\t\tproc.unref();\n\t\t\t\t} catch {\n\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (hasX11Display) {\n\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore - OSC 52 already emitted as fallback\n\t}\n}\n"]}
@@ -0,0 +1,78 @@
1
+ import { 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
+ }
13
+ export async function copyToClipboard(text) {
14
+ // Always emit OSC 52 - works over SSH/mosh, harmless locally
15
+ const encoded = Buffer.from(text).toString("base64");
16
+ process.stdout.write(`\x1b]52;c;${encoded}\x07`);
17
+ try {
18
+ if (clipboard) {
19
+ await clipboard.setText(text);
20
+ return;
21
+ }
22
+ }
23
+ catch {
24
+ // Fall through to platform-specific clipboard tools.
25
+ }
26
+ // Also try native tools (best effort for local sessions)
27
+ const p = platform();
28
+ const options = { input: text, timeout: 5000, stdio: ["pipe", "ignore", "ignore"] };
29
+ try {
30
+ if (p === "darwin") {
31
+ execSync("pbcopy", options);
32
+ }
33
+ else if (p === "win32") {
34
+ execSync("clip", options);
35
+ }
36
+ else {
37
+ // Linux. Try Termux, Wayland, or X11 clipboard tools.
38
+ if (process.env.TERMUX_VERSION) {
39
+ try {
40
+ execSync("termux-clipboard-set", options);
41
+ return;
42
+ }
43
+ catch {
44
+ // Fall back to Wayland or X11 tools.
45
+ }
46
+ }
47
+ const hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);
48
+ const hasX11Display = Boolean(process.env.DISPLAY);
49
+ const isWayland = isWaylandSession();
50
+ if (isWayland && hasWaylandDisplay) {
51
+ try {
52
+ // Verify wl-copy exists (spawn errors are async and won't be caught)
53
+ execSync("which wl-copy", { stdio: "ignore" });
54
+ // wl-copy with execSync hangs due to fork behavior; use spawn instead
55
+ const proc = spawn("wl-copy", [], { stdio: ["pipe", "ignore", "ignore"] });
56
+ proc.stdin.on("error", () => {
57
+ // Ignore EPIPE errors if wl-copy exits early
58
+ });
59
+ proc.stdin.write(text);
60
+ proc.stdin.end();
61
+ proc.unref();
62
+ }
63
+ catch {
64
+ if (hasX11Display) {
65
+ copyToX11Clipboard(options);
66
+ }
67
+ }
68
+ }
69
+ else if (hasX11Display) {
70
+ copyToX11Clipboard(options);
71
+ }
72
+ }
73
+ }
74
+ catch {
75
+ // Ignore - OSC 52 already emitted as fallback
76
+ }
77
+ }
78
+ //# sourceMappingURL=clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQlD,SAAS,kBAAkB,CAAC,OAAmC,EAAQ;IACtE,IAAI,CAAC;QACJ,QAAQ,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM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AAC,eAAe,CAAC,CAAC;YAC/D,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;YACrC,IAAI,SAAS,IAAI,iBAAiB,EAAE,CAAC;gBACpC,IAAI,CAAC;oBACJ,qEAAqE;oBACrE,QAAQ,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;oBAC/C,sEAAsE;oBACtE,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;oBAC3E,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC;wBAC5B,6CAA6C;oBADhB,CAE7B,CAAC,CAAC;oBACH,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACvB,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;oBACjB,IAAI,CAAC,KAAK,EAAE,CAAC;gBACd,CAAC;gBAAC,MAAM,CAAC;oBACR,IAAI,aAAa,EAAE,CAAC;wBACnB,kBAAkB,CAAC,OAAO,CAAC,CAAC;oBAC7B,CAAC;gBACF,CAAC;YACF,CAAC;iBAAM,IAAI,aAAa,EAAE,CAAC;gBAC1B,kBAAkB,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,8CAA8C;IAC/C,CAAC;AAAA,CACD","sourcesContent":["import { execSync, spawn } from \"child_process\";\nimport { platform } from \"os\";\nimport { isWaylandSession } from \"./clipboard-image.js\";\nimport { clipboard } from \"./clipboard-native.js\";\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\nexport async function copyToClipboard(text: string): Promise<void> {\n\t// Always emit OSC 52 - works over SSH/mosh, harmless locally\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\n\ttry {\n\t\tif (clipboard) {\n\t\t\tawait clipboard.setText(text);\n\t\t\treturn;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\t// Also try native tools (best effort for local sessions)\n\tconst p = platform();\n\tconst options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: [\"pipe\", \"ignore\", \"ignore\"] };\n\n\ttry {\n\t\tif (p === \"darwin\") {\n\t\t\texecSync(\"pbcopy\", options);\n\t\t} else if (p === \"win32\") {\n\t\t\texecSync(\"clip\", options);\n\t\t} else {\n\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\ttry {\n\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\treturn;\n\t\t\t\t} catch {\n\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);\n\t\t\tconst hasX11Display = Boolean(process.env.DISPLAY);\n\t\t\tconst isWayland = isWaylandSession();\n\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\ttry {\n\t\t\t\t\t// Verify wl-copy exists (spawn errors are async and won't be caught)\n\t\t\t\t\texecSync(\"which wl-copy\", { stdio: \"ignore\" });\n\t\t\t\t\t// wl-copy with execSync hangs due to fork behavior; use spawn instead\n\t\t\t\t\tconst proc = spawn(\"wl-copy\", [], { stdio: [\"pipe\", \"ignore\", \"ignore\"] });\n\t\t\t\t\tproc.stdin.on(\"error\", () => {\n\t\t\t\t\t\t// Ignore EPIPE errors if wl-copy exits early\n\t\t\t\t\t});\n\t\t\t\t\tproc.stdin.write(text);\n\t\t\t\t\tproc.stdin.end();\n\t\t\t\t\tproc.unref();\n\t\t\t\t} catch {\n\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (hasX11Display) {\n\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore - OSC 52 already emitted as fallback\n\t}\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { PhotonImageType } from "./photon.js";
2
+ type Photon = typeof import("@silvia-odwyer/photon-node");
3
+ export declare function applyExifOrientation(photon: Photon, image: PhotonImageType, originalBytes: Uint8Array): PhotonImageType;
4
+ export {};
5
+ //# sourceMappingURL=exif-orientation.d.ts.map
@@ -0,0 +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","sourcesContent":["import type { PhotonImageType } from \"./photon.js\";\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"]}
@@ -0,0 +1,158 @@
1
+ function readOrientationFromTiff(bytes, tiffStart) {
2
+ if (tiffStart + 8 > bytes.length)
3
+ return 1;
4
+ const byteOrder = (bytes[tiffStart] << 8) | bytes[tiffStart + 1];
5
+ const le = byteOrder === 0x4949;
6
+ const read16 = (pos) => {
7
+ if (le)
8
+ return bytes[pos] | (bytes[pos + 1] << 8);
9
+ return (bytes[pos] << 8) | bytes[pos + 1];
10
+ };
11
+ const read32 = (pos) => {
12
+ if (le)
13
+ return bytes[pos] | (bytes[pos + 1] << 8) | (bytes[pos + 2] << 16) | (bytes[pos + 3] << 24);
14
+ return ((bytes[pos] << 24) | (bytes[pos + 1] << 16) | (bytes[pos + 2] << 8) | bytes[pos + 3]) >>> 0;
15
+ };
16
+ const ifdOffset = read32(tiffStart + 4);
17
+ const ifdStart = tiffStart + ifdOffset;
18
+ if (ifdStart + 2 > bytes.length)
19
+ return 1;
20
+ const entryCount = read16(ifdStart);
21
+ for (let i = 0; i < entryCount; i++) {
22
+ const entryPos = ifdStart + 2 + i * 12;
23
+ if (entryPos + 12 > bytes.length)
24
+ return 1;
25
+ if (read16(entryPos) === 0x0112) {
26
+ const value = read16(entryPos + 8);
27
+ return value >= 1 && value <= 8 ? value : 1;
28
+ }
29
+ }
30
+ return 1;
31
+ }
32
+ function findJpegTiffOffset(bytes) {
33
+ let offset = 2;
34
+ while (offset < bytes.length - 1) {
35
+ if (bytes[offset] !== 0xff)
36
+ return -1;
37
+ const marker = bytes[offset + 1];
38
+ if (marker === 0xff) {
39
+ offset++;
40
+ continue;
41
+ }
42
+ if (marker === 0xe1) {
43
+ if (offset + 4 >= bytes.length)
44
+ return -1;
45
+ const segmentStart = offset + 4;
46
+ if (segmentStart + 6 > bytes.length)
47
+ return -1;
48
+ if (!hasExifHeader(bytes, segmentStart))
49
+ return -1;
50
+ return segmentStart + 6;
51
+ }
52
+ if (offset + 4 > bytes.length)
53
+ return -1;
54
+ const length = (bytes[offset + 2] << 8) | bytes[offset + 3];
55
+ offset += 2 + length;
56
+ }
57
+ return -1;
58
+ }
59
+ function findWebpTiffOffset(bytes) {
60
+ let offset = 12;
61
+ while (offset + 8 <= bytes.length) {
62
+ const chunkId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);
63
+ const chunkSize = bytes[offset + 4] | (bytes[offset + 5] << 8) | (bytes[offset + 6] << 16) | (bytes[offset + 7] << 24);
64
+ const dataStart = offset + 8;
65
+ if (chunkId === "EXIF") {
66
+ if (dataStart + chunkSize > bytes.length)
67
+ return -1;
68
+ // Some WebP files have "Exif\0\0" prefix before the TIFF header
69
+ const tiffStart = chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;
70
+ return tiffStart;
71
+ }
72
+ // RIFF chunks are padded to even size
73
+ offset = dataStart + chunkSize + (chunkSize % 2);
74
+ }
75
+ return -1;
76
+ }
77
+ function hasExifHeader(bytes, offset) {
78
+ return (bytes[offset] === 0x45 &&
79
+ bytes[offset + 1] === 0x78 &&
80
+ bytes[offset + 2] === 0x69 &&
81
+ bytes[offset + 3] === 0x66 &&
82
+ bytes[offset + 4] === 0x00 &&
83
+ bytes[offset + 5] === 0x00);
84
+ }
85
+ function getExifOrientation(bytes) {
86
+ let tiffOffset = -1;
87
+ // JPEG: starts with FF D8
88
+ if (bytes.length >= 2 && bytes[0] === 0xff && bytes[1] === 0xd8) {
89
+ tiffOffset = findJpegTiffOffset(bytes);
90
+ }
91
+ // WebP: starts with RIFF....WEBP
92
+ else if (bytes.length >= 12 &&
93
+ bytes[0] === 0x52 &&
94
+ bytes[1] === 0x49 &&
95
+ bytes[2] === 0x46 &&
96
+ bytes[3] === 0x46 &&
97
+ bytes[8] === 0x57 &&
98
+ bytes[9] === 0x45 &&
99
+ bytes[10] === 0x42 &&
100
+ bytes[11] === 0x50) {
101
+ tiffOffset = findWebpTiffOffset(bytes);
102
+ }
103
+ if (tiffOffset === -1)
104
+ return 1;
105
+ return readOrientationFromTiff(bytes, tiffOffset);
106
+ }
107
+ function rotate90(photon, image, dstIndex) {
108
+ const w = image.get_width();
109
+ const h = image.get_height();
110
+ const src = image.get_raw_pixels();
111
+ const dst = new Uint8Array(src.length);
112
+ for (let y = 0; y < h; y++) {
113
+ for (let x = 0; x < w; x++) {
114
+ const srcIdx = (y * w + x) * 4;
115
+ const dstIdx = dstIndex(x, y, w, h) * 4;
116
+ dst[dstIdx] = src[srcIdx];
117
+ dst[dstIdx + 1] = src[srcIdx + 1];
118
+ dst[dstIdx + 2] = src[srcIdx + 2];
119
+ dst[dstIdx + 3] = src[srcIdx + 3];
120
+ }
121
+ }
122
+ return new photon.PhotonImage(dst, h, w);
123
+ }
124
+ // Flip orientations mutate in-place. Rotations return a new image (caller must free the old one if different).
125
+ export function applyExifOrientation(photon, image, originalBytes) {
126
+ const orientation = getExifOrientation(originalBytes);
127
+ if (orientation === 1)
128
+ return image;
129
+ switch (orientation) {
130
+ case 2:
131
+ photon.fliph(image);
132
+ return image;
133
+ case 3:
134
+ photon.fliph(image);
135
+ photon.flipv(image);
136
+ return image;
137
+ case 4:
138
+ photon.flipv(image);
139
+ return image;
140
+ case 5: {
141
+ const rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));
142
+ photon.fliph(rotated);
143
+ return rotated;
144
+ }
145
+ case 6:
146
+ return rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));
147
+ case 7: {
148
+ const rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);
149
+ photon.fliph(rotated);
150
+ return rotated;
151
+ }
152
+ case 8:
153
+ return rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);
154
+ default:
155
+ return image;
156
+ }
157
+ }
158
+ //# sourceMappingURL=exif-orientation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exif-orientation.js","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAIA,SAAS,uBAAuB,CAAC,KAAiB,EAAE,SAAiB,EAAU;IAC9E,IAAI,SAA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B,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,KAAK,CAAC;YACL,OAAO,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACtE,KAAK,CAAC,EAAE,CAAC;YACR,MAAM,OAAO,GAAG,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;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;AAAA,CACD","sourcesContent":["import type { PhotonImageType } from \"./photon.js\";\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"]}
@@ -0,0 +1,8 @@
1
+ type ParsedFrontmatter<T extends Record<string, unknown>> = {
2
+ frontmatter: T;
3
+ body: string;
4
+ };
5
+ export declare const parseFrontmatter: <T extends Record<string, unknown> = Record<string, unknown>>(content: string) => ParsedFrontmatter<T>;
6
+ export declare const stripFrontmatter: (content: string) => string;
7
+ export {};
8
+ //# sourceMappingURL=frontmatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/utils/frontmatter.ts"],"names":[],"mappings":"AAEA,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC3D,WAAW,EAAE,CAAC,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAsBF,eAAO,MAAM,gBAAgB,GAAI,CAAC,oGASjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,6BAA8D,CAAC","sourcesContent":["import { parse } from \"yaml\";\n\ntype ParsedFrontmatter<T extends Record<string, unknown>> = {\n\tfrontmatter: T;\n\tbody: string;\n};\n\nconst normalizeNewlines = (value: string): string => value.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\nconst extractFrontmatter = (content: string): { yamlString: string | null; body: string } => {\n\tconst normalized = normalizeNewlines(content);\n\n\tif (!normalized.startsWith(\"---\")) {\n\t\treturn { yamlString: null, body: normalized };\n\t}\n\n\tconst endIndex = normalized.indexOf(\"\\n---\", 3);\n\tif (endIndex === -1) {\n\t\treturn { yamlString: null, body: normalized };\n\t}\n\n\treturn {\n\t\tyamlString: normalized.slice(4, endIndex),\n\t\tbody: normalized.slice(endIndex + 4).trim(),\n\t};\n};\n\nexport const parseFrontmatter = <T extends Record<string, unknown> = Record<string, unknown>>(\n\tcontent: string,\n): ParsedFrontmatter<T> => {\n\tconst { yamlString, body } = extractFrontmatter(content);\n\tif (!yamlString) {\n\t\treturn { frontmatter: {} as T, body };\n\t}\n\tconst parsed = parse(yamlString);\n\treturn { frontmatter: (parsed ?? {}) as T, body };\n};\n\nexport const stripFrontmatter = (content: string): string => parseFrontmatter(content).body;\n"]}