@code-yeongyu/senpi 2026.8.1 → 2026.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (988) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -0
  3. package/dist/cli/args.d.ts +2 -0
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +27 -0
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/credential-print.d.ts +23 -0
  8. package/dist/cli/credential-print.d.ts.map +1 -0
  9. package/dist/cli/credential-print.js +116 -0
  10. package/dist/cli/credential-print.js.map +1 -0
  11. package/dist/client/index.d.ts +3 -0
  12. package/dist/client/index.d.ts.map +1 -0
  13. package/dist/client/index.js +3 -0
  14. package/dist/client/index.js.map +1 -0
  15. package/dist/client/remote-session.d.ts +53 -0
  16. package/dist/client/remote-session.d.ts.map +1 -0
  17. package/dist/client/remote-session.js +340 -0
  18. package/dist/client/remote-session.js.map +1 -0
  19. package/dist/client/transcript.d.ts +12 -0
  20. package/dist/client/transcript.d.ts.map +1 -0
  21. package/dist/client/transcript.js +98 -0
  22. package/dist/client/transcript.js.map +1 -0
  23. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  24. package/dist/core/agent-session-runtime.js +3 -0
  25. package/dist/core/agent-session-runtime.js.map +1 -1
  26. package/dist/core/agent-session.d.ts +36 -1
  27. package/dist/core/agent-session.d.ts.map +1 -1
  28. package/dist/core/agent-session.js +325 -41
  29. package/dist/core/agent-session.js.map +1 -1
  30. package/dist/core/auth-storage.d.ts +5 -0
  31. package/dist/core/auth-storage.d.ts.map +1 -1
  32. package/dist/core/auth-storage.js +72 -11
  33. package/dist/core/auth-storage.js.map +1 -1
  34. package/dist/core/dynamic-prompt/verification.d.ts +2 -2
  35. package/dist/core/dynamic-prompt/verification.d.ts.map +1 -1
  36. package/dist/core/dynamic-prompt/verification.js +2 -2
  37. package/dist/core/dynamic-prompt/verification.js.map +1 -1
  38. package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.d.ts +17 -0
  39. package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.d.ts.map +1 -0
  40. package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.js +56 -0
  41. package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.js.map +1 -0
  42. package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.d.ts +1 -0
  43. package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.d.ts.map +1 -1
  44. package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.js.map +1 -1
  45. package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts +32 -0
  46. package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts.map +1 -0
  47. package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js +43 -0
  48. package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +1 -0
  49. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts +18 -0
  50. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts.map +1 -0
  51. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js +46 -0
  52. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js.map +1 -0
  53. package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts +81 -0
  54. package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts.map +1 -0
  55. package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js +127 -0
  56. package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js.map +1 -0
  57. package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.d.ts +10 -0
  58. package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.d.ts.map +1 -0
  59. package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.js +34 -0
  60. package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.js.map +1 -0
  61. package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts +56 -0
  62. package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts.map +1 -0
  63. package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js +174 -0
  64. package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js.map +1 -0
  65. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.d.ts +24 -0
  66. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.d.ts.map +1 -0
  67. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.js +34 -0
  68. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.js.map +1 -0
  69. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts +34 -0
  70. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +1 -0
  71. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js +85 -0
  72. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +1 -0
  73. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts +2 -13
  74. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts.map +1 -1
  75. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js +34 -55
  76. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js.map +1 -1
  77. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +1 -1
  78. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js +35 -93
  79. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +1 -1
  80. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +13 -11
  81. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +1 -1
  82. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js +44 -55
  83. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -1
  84. package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts +3 -1
  85. package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts.map +1 -1
  86. package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js +101 -126
  87. package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js.map +1 -1
  88. package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts +2 -31
  89. package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +1 -1
  90. package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js +26 -98
  91. package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +1 -1
  92. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.d.ts +14 -0
  93. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.d.ts.map +1 -0
  94. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.js +42 -0
  95. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.js.map +1 -0
  96. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.d.ts +32 -0
  97. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.d.ts.map +1 -0
  98. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.js +8 -0
  99. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.js.map +1 -0
  100. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.d.ts +16 -0
  101. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.d.ts.map +1 -0
  102. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.js +92 -0
  103. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.js.map +1 -0
  104. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -1
  105. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +48 -88
  106. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -1
  107. package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts +1 -0
  108. package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts.map +1 -1
  109. package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js +1 -0
  110. package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js.map +1 -1
  111. package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts +18 -1
  112. package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts.map +1 -1
  113. package/dist/core/extensions/builtin/compaction/checkpoint-state.js +32 -0
  114. package/dist/core/extensions/builtin/compaction/checkpoint-state.js.map +1 -1
  115. package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +1 -1
  116. package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
  117. package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +4 -0
  118. package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
  119. package/dist/core/extensions/builtin/compaction/idle-retry.d.ts +21 -0
  120. package/dist/core/extensions/builtin/compaction/idle-retry.d.ts.map +1 -0
  121. package/dist/core/extensions/builtin/compaction/idle-retry.js +24 -0
  122. package/dist/core/extensions/builtin/compaction/idle-retry.js.map +1 -0
  123. package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
  124. package/dist/core/extensions/builtin/compaction/index.js +91 -13
  125. package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
  126. package/dist/core/extensions/builtin/compaction/lane-policy.d.ts +71 -0
  127. package/dist/core/extensions/builtin/compaction/lane-policy.d.ts.map +1 -0
  128. package/dist/core/extensions/builtin/compaction/lane-policy.js +94 -0
  129. package/dist/core/extensions/builtin/compaction/lane-policy.js.map +1 -0
  130. package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
  131. package/dist/core/extensions/builtin/compaction/log.js +1 -0
  132. package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
  133. package/dist/core/extensions/builtin/compaction/overflow-retry.d.ts +59 -0
  134. package/dist/core/extensions/builtin/compaction/overflow-retry.d.ts.map +1 -0
  135. package/dist/core/extensions/builtin/compaction/overflow-retry.js +155 -0
  136. package/dist/core/extensions/builtin/compaction/overflow-retry.js.map +1 -0
  137. package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
  138. package/dist/core/extensions/builtin/compaction/speculative.js +17 -98
  139. package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
  140. package/dist/core/extensions/builtin/compaction/transient-failure.d.ts.map +1 -1
  141. package/dist/core/extensions/builtin/compaction/transient-failure.js +3 -0
  142. package/dist/core/extensions/builtin/compaction/transient-failure.js.map +1 -1
  143. package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts +1 -0
  144. package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts.map +1 -1
  145. package/dist/core/extensions/builtin/gpt-apply-patch/apply.js +13 -1
  146. package/dist/core/extensions/builtin/gpt-apply-patch/apply.js.map +1 -1
  147. package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts +1 -1
  148. package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts.map +1 -1
  149. package/dist/core/extensions/builtin/gpt-apply-patch/index.js +1 -1
  150. package/dist/core/extensions/builtin/gpt-apply-patch/index.js.map +1 -1
  151. package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts +1 -0
  152. package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts.map +1 -1
  153. package/dist/core/extensions/builtin/gpt-apply-patch/tool.js +23 -5
  154. package/dist/core/extensions/builtin/gpt-apply-patch/tool.js.map +1 -1
  155. package/dist/core/extensions/builtin/loop-guard/detectors.d.ts.map +1 -1
  156. package/dist/core/extensions/builtin/loop-guard/detectors.js +42 -1
  157. package/dist/core/extensions/builtin/loop-guard/detectors.js.map +1 -1
  158. package/dist/core/extensions/builtin/mcp/health.d.ts.map +1 -1
  159. package/dist/core/extensions/builtin/mcp/health.js +2 -1
  160. package/dist/core/extensions/builtin/mcp/health.js.map +1 -1
  161. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +1 -1
  162. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
  163. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +5 -3
  164. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
  165. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
  166. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +8 -1
  167. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
  168. package/dist/core/extensions/builtin/terminal/tools/context.d.ts +1 -1
  169. package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
  170. package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
  171. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
  172. package/dist/core/extensions/builtin/terminal/tools/monitor.js +1 -0
  173. package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
  174. package/dist/core/extensions/builtin/tool-pair-guard/index.d.ts.map +1 -1
  175. package/dist/core/extensions/builtin/tool-pair-guard/index.js +1 -1
  176. package/dist/core/extensions/builtin/tool-pair-guard/index.js.map +1 -1
  177. package/dist/core/extensions/index.d.ts +1 -1
  178. package/dist/core/extensions/index.d.ts.map +1 -1
  179. package/dist/core/extensions/index.js.map +1 -1
  180. package/dist/core/extensions/loader.d.ts.map +1 -1
  181. package/dist/core/extensions/loader.js +14 -18
  182. package/dist/core/extensions/loader.js.map +1 -1
  183. package/dist/core/extensions/runner.d.ts +4 -1
  184. package/dist/core/extensions/runner.d.ts.map +1 -1
  185. package/dist/core/extensions/runner.js +18 -0
  186. package/dist/core/extensions/runner.js.map +1 -1
  187. package/dist/core/extensions/types.d.ts +16 -1
  188. package/dist/core/extensions/types.d.ts.map +1 -1
  189. package/dist/core/extensions/types.js.map +1 -1
  190. package/dist/core/footer-data-provider.d.ts +10 -0
  191. package/dist/core/footer-data-provider.d.ts.map +1 -1
  192. package/dist/core/footer-data-provider.js +1 -1
  193. package/dist/core/footer-data-provider.js.map +1 -1
  194. package/dist/core/keybindings.d.ts +24 -0
  195. package/dist/core/keybindings.d.ts.map +1 -1
  196. package/dist/core/model-registry.d.ts +2 -1
  197. package/dist/core/model-registry.d.ts.map +1 -1
  198. package/dist/core/model-registry.js +3 -0
  199. package/dist/core/model-registry.js.map +1 -1
  200. package/dist/core/model-runtime.d.ts +2 -0
  201. package/dist/core/model-runtime.d.ts.map +1 -1
  202. package/dist/core/model-runtime.js.map +1 -1
  203. package/dist/core/package-manager.d.ts +0 -1
  204. package/dist/core/package-manager.d.ts.map +1 -1
  205. package/dist/core/package-manager.js +18 -34
  206. package/dist/core/package-manager.js.map +1 -1
  207. package/dist/core/pi-manifest.d.ts +9 -0
  208. package/dist/core/pi-manifest.d.ts.map +1 -0
  209. package/dist/core/pi-manifest.js +25 -0
  210. package/dist/core/pi-manifest.js.map +1 -0
  211. package/dist/core/resource-loader.d.ts +15 -0
  212. package/dist/core/resource-loader.d.ts.map +1 -1
  213. package/dist/core/resource-loader.js +55 -6
  214. package/dist/core/resource-loader.js.map +1 -1
  215. package/dist/core/retry-fallback/hint-policy.d.ts +29 -0
  216. package/dist/core/retry-fallback/hint-policy.d.ts.map +1 -0
  217. package/dist/core/retry-fallback/hint-policy.js +54 -0
  218. package/dist/core/retry-fallback/hint-policy.js.map +1 -0
  219. package/dist/core/retry-fallback/probe-scheduler.d.ts +60 -0
  220. package/dist/core/retry-fallback/probe-scheduler.d.ts.map +1 -0
  221. package/dist/core/retry-fallback/probe-scheduler.js +206 -0
  222. package/dist/core/retry-fallback/probe-scheduler.js.map +1 -0
  223. package/dist/core/retry-fallback/settings.d.ts +9 -0
  224. package/dist/core/retry-fallback/settings.d.ts.map +1 -1
  225. package/dist/core/retry-fallback/settings.js +14 -0
  226. package/dist/core/retry-fallback/settings.js.map +1 -1
  227. package/dist/core/settings-manager.d.ts +10 -1
  228. package/dist/core/settings-manager.d.ts.map +1 -1
  229. package/dist/core/settings-manager.js +21 -1
  230. package/dist/core/settings-manager.js.map +1 -1
  231. package/dist/extensions/llama/provider.js +1 -1
  232. package/dist/extensions/llama/provider.js.map +1 -1
  233. package/dist/index.d.ts +2 -2
  234. package/dist/index.d.ts.map +1 -1
  235. package/dist/index.js.map +1 -1
  236. package/dist/main.d.ts.map +1 -1
  237. package/dist/main.js +44 -0
  238. package/dist/main.js.map +1 -1
  239. package/dist/modes/interactive/components/assistant-message.d.ts +5 -2
  240. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  241. package/dist/modes/interactive/components/assistant-message.js +16 -4
  242. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  243. package/dist/modes/interactive/components/continuity-notice.d.ts +21 -0
  244. package/dist/modes/interactive/components/continuity-notice.d.ts.map +1 -0
  245. package/dist/modes/interactive/components/continuity-notice.js +58 -0
  246. package/dist/modes/interactive/components/continuity-notice.js.map +1 -0
  247. package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
  248. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  249. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  250. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  251. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  252. package/dist/modes/interactive/components/model-selector.js +4 -1
  253. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  254. package/dist/modes/interactive/components/settings-selector.d.ts +6 -2
  255. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  256. package/dist/modes/interactive/components/settings-selector.js +20 -0
  257. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  258. package/dist/modes/interactive/components/user-message.d.ts +3 -1
  259. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  260. package/dist/modes/interactive/components/user-message.js +8 -2
  261. package/dist/modes/interactive/components/user-message.js.map +1 -1
  262. package/dist/modes/interactive/help-content.d.ts.map +1 -1
  263. package/dist/modes/interactive/help-content.js +1 -0
  264. package/dist/modes/interactive/help-content.js.map +1 -1
  265. package/dist/modes/interactive/interactive-mode.d.ts +21 -0
  266. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  267. package/dist/modes/interactive/interactive-mode.js +151 -50
  268. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  269. package/dist/modes/interactive/theme/dark.json +1 -0
  270. package/dist/modes/interactive/theme/grok-day.json +1 -0
  271. package/dist/modes/interactive/theme/grok-night.json +1 -0
  272. package/dist/modes/interactive/theme/light.json +1 -0
  273. package/dist/modes/interactive/theme/theme-schema.json +5 -1
  274. package/dist/modes/interactive/theme/theme.d.ts +2 -2
  275. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  276. package/dist/modes/interactive/theme/theme.js +13 -3
  277. package/dist/modes/interactive/theme/theme.js.map +1 -1
  278. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  279. package/dist/modes/rpc/connection-handler.js +13 -0
  280. package/dist/modes/rpc/connection-handler.js.map +1 -1
  281. package/dist/utils/clipboard.d.ts +1 -1
  282. package/dist/utils/clipboard.d.ts.map +1 -1
  283. package/dist/utils/clipboard.js +22 -2
  284. package/dist/utils/clipboard.js.map +1 -1
  285. package/docs/AGENTS.md +1 -6
  286. package/docs/custom-provider.md +10 -3
  287. package/docs/development.md +1 -2
  288. package/docs/extensions.md +24 -1
  289. package/docs/keybindings.md +13 -0
  290. package/docs/mcp.md +63 -4
  291. package/docs/models.md +1 -0
  292. package/docs/providers.md +20 -0
  293. package/docs/release-guide.md +5 -3
  294. package/docs/session-format.md +2 -0
  295. package/docs/settings.md +2 -0
  296. package/docs/skills.md +29 -0
  297. package/docs/themes.md +5 -3
  298. package/docs/usage.md +5 -0
  299. package/examples/extensions/custom-compaction.ts +1 -2
  300. package/examples/extensions/custom-provider-anthropic/index.ts +8 -2
  301. package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
  302. package/examples/extensions/handoff.ts +2 -3
  303. package/examples/extensions/qna.ts +2 -2
  304. package/examples/rpc-extension-ui.ts +11 -2
  305. package/examples/sdk/02-custom-model.ts +1 -2
  306. package/examples/sdk/12-full-control.ts +2 -0
  307. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
  308. package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
  309. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +14 -3
  310. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  311. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +156 -67
  312. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  313. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.d.ts +3 -0
  314. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.d.ts.map +1 -0
  315. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.js +70 -0
  316. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.js.map +1 -0
  317. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +4 -0
  318. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts.map +1 -0
  319. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +22 -0
  320. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js.map +1 -0
  321. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.d.ts +13 -0
  322. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.d.ts.map +1 -0
  323. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.js +304 -0
  324. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.js.map +1 -0
  325. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.d.ts +17 -0
  326. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.d.ts.map +1 -0
  327. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.js +60 -0
  328. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.js.map +1 -0
  329. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.d.ts +6 -0
  330. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.d.ts.map +1 -0
  331. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.js +107 -0
  332. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.js.map +1 -0
  333. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.d.ts +28 -0
  334. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.d.ts.map +1 -0
  335. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.js +61 -0
  336. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.js.map +1 -0
  337. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.d.ts +8 -0
  338. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.d.ts.map +1 -0
  339. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.js +22 -0
  340. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.js.map +1 -0
  341. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +6 -10
  342. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
  343. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +154 -77
  344. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
  345. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +49 -23
  346. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
  347. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
  348. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +6 -6
  349. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  350. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +6 -6
  351. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  352. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +1 -1
  353. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  354. package/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
  355. package/node_modules/@earendil-works/pi-ai/README.md +2 -1
  356. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  357. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +46 -10
  358. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  359. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.d.ts +3 -0
  360. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.d.ts.map +1 -0
  361. package/{dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js → node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.js} +3 -3
  362. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.js.map +1 -0
  363. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  364. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +5 -1
  365. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  366. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  367. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +64 -4
  368. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  369. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
  370. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +12 -2
  371. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
  372. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -1
  373. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +13 -6
  374. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -1
  375. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
  376. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +12 -2
  377. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
  378. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  379. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +19 -10
  380. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  381. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  382. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +84 -47
  383. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  384. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  385. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +17 -8
  386. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  387. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  388. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +11 -1
  389. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  390. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  391. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +7 -3
  392. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  393. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +3 -2
  394. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js.map +1 -1
  395. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -2
  396. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
  397. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
  398. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -0
  399. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
  400. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts +3 -1
  401. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts.map +1 -1
  402. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +81 -26
  403. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js.map +1 -1
  404. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +2 -0
  405. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
  406. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +16 -8
  407. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
  408. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
  409. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  410. package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
  411. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  412. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  413. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  414. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  415. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  416. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  417. package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  418. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  419. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  420. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  421. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  422. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  423. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  424. package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  425. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  426. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  427. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  428. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  429. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +4 -1
  430. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  431. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +1 -1
  432. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js.map +1 -1
  433. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +13 -1
  434. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  435. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  436. package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.d.ts.map +1 -1
  437. package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +23 -4
  438. package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js.map +1 -1
  439. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
  440. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +10 -1
  441. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
  442. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts +3 -0
  443. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts.map +1 -1
  444. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +13 -12
  445. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js.map +1 -1
  446. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.d.ts +24 -0
  447. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.d.ts.map +1 -0
  448. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.js +233 -0
  449. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.js.map +1 -0
  450. package/node_modules/@earendil-works/pi-ai/package.json +10 -6
  451. package/node_modules/@earendil-works/pi-client/CHANGELOG.md +7 -0
  452. package/node_modules/@earendil-works/pi-client/README.md +64 -0
  453. package/node_modules/@earendil-works/pi-client/dist/client.d.ts +25 -0
  454. package/node_modules/@earendil-works/pi-client/dist/client.d.ts.map +1 -0
  455. package/node_modules/@earendil-works/pi-client/dist/client.js +386 -0
  456. package/node_modules/@earendil-works/pi-client/dist/client.js.map +1 -0
  457. package/node_modules/@earendil-works/pi-client/dist/connection.d.ts +25 -0
  458. package/node_modules/@earendil-works/pi-client/dist/connection.d.ts.map +1 -0
  459. package/node_modules/@earendil-works/pi-client/dist/connection.js +204 -0
  460. package/node_modules/@earendil-works/pi-client/dist/connection.js.map +1 -0
  461. package/node_modules/@earendil-works/pi-client/dist/errors.d.ts +23 -0
  462. package/node_modules/@earendil-works/pi-client/dist/errors.d.ts.map +1 -0
  463. package/node_modules/@earendil-works/pi-client/dist/errors.js +42 -0
  464. package/node_modules/@earendil-works/pi-client/dist/errors.js.map +1 -0
  465. package/node_modules/@earendil-works/pi-client/dist/index.d.ts +6 -0
  466. package/node_modules/@earendil-works/pi-client/dist/index.d.ts.map +1 -0
  467. package/node_modules/@earendil-works/pi-client/dist/index.js +3 -0
  468. package/node_modules/@earendil-works/pi-client/dist/index.js.map +1 -0
  469. package/node_modules/@earendil-works/pi-client/dist/promise.d.ts +8 -0
  470. package/node_modules/@earendil-works/pi-client/dist/promise.d.ts.map +1 -0
  471. package/node_modules/@earendil-works/pi-client/dist/promise.js +11 -0
  472. package/node_modules/@earendil-works/pi-client/dist/promise.js.map +1 -0
  473. package/node_modules/@earendil-works/pi-client/dist/session-handle.d.ts +54 -0
  474. package/node_modules/@earendil-works/pi-client/dist/session-handle.d.ts.map +1 -0
  475. package/node_modules/@earendil-works/pi-client/dist/session-handle.js +50 -0
  476. package/node_modules/@earendil-works/pi-client/dist/session-handle.js.map +1 -0
  477. package/node_modules/@earendil-works/pi-client/dist/state.d.ts +22 -0
  478. package/node_modules/@earendil-works/pi-client/dist/state.d.ts.map +1 -0
  479. package/node_modules/@earendil-works/pi-client/dist/state.js +149 -0
  480. package/node_modules/@earendil-works/pi-client/dist/state.js.map +1 -0
  481. package/node_modules/@earendil-works/pi-client/dist/transport.d.ts +17 -0
  482. package/node_modules/@earendil-works/pi-client/dist/transport.d.ts.map +1 -0
  483. package/node_modules/@earendil-works/pi-client/dist/transport.js +2 -0
  484. package/node_modules/@earendil-works/pi-client/dist/transport.js.map +1 -0
  485. package/node_modules/@earendil-works/pi-client/dist/types.d.ts +23 -0
  486. package/node_modules/@earendil-works/pi-client/dist/types.d.ts.map +1 -0
  487. package/node_modules/@earendil-works/pi-client/dist/types.js +2 -0
  488. package/node_modules/@earendil-works/pi-client/dist/types.js.map +1 -0
  489. package/node_modules/@earendil-works/pi-client/dist/unix.d.ts +8 -0
  490. package/node_modules/@earendil-works/pi-client/dist/unix.d.ts.map +1 -0
  491. package/node_modules/@earendil-works/pi-client/dist/unix.js +151 -0
  492. package/node_modules/@earendil-works/pi-client/dist/unix.js.map +1 -0
  493. package/node_modules/@earendil-works/pi-client/package.json +56 -0
  494. package/node_modules/@earendil-works/pi-protocol/README.md +68 -0
  495. package/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.d.ts +4 -0
  496. package/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.d.ts.map +1 -0
  497. package/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.js +163 -0
  498. package/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.js.map +1 -0
  499. package/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.d.ts +4 -0
  500. package/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.d.ts.map +1 -0
  501. package/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.js +199 -0
  502. package/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.js.map +1 -0
  503. package/node_modules/@earendil-works/pi-protocol/dist/cbor/index.d.ts +4 -0
  504. package/node_modules/@earendil-works/pi-protocol/dist/cbor/index.d.ts.map +1 -0
  505. package/node_modules/@earendil-works/pi-protocol/dist/cbor/index.js +4 -0
  506. package/node_modules/@earendil-works/pi-protocol/dist/cbor/index.js.map +1 -0
  507. package/node_modules/@earendil-works/pi-protocol/dist/cbor/options.d.ts +26 -0
  508. package/node_modules/@earendil-works/pi-protocol/dist/cbor/options.d.ts.map +1 -0
  509. package/node_modules/@earendil-works/pi-protocol/dist/cbor/options.js +29 -0
  510. package/node_modules/@earendil-works/pi-protocol/dist/cbor/options.js.map +1 -0
  511. package/node_modules/@earendil-works/pi-protocol/dist/codec.d.ts +29 -0
  512. package/node_modules/@earendil-works/pi-protocol/dist/codec.d.ts.map +1 -0
  513. package/node_modules/@earendil-works/pi-protocol/dist/codec.js +140 -0
  514. package/node_modules/@earendil-works/pi-protocol/dist/codec.js.map +1 -0
  515. package/node_modules/@earendil-works/pi-protocol/dist/framing.d.ts +29 -0
  516. package/node_modules/@earendil-works/pi-protocol/dist/framing.d.ts.map +1 -0
  517. package/node_modules/@earendil-works/pi-protocol/dist/framing.js +152 -0
  518. package/node_modules/@earendil-works/pi-protocol/dist/framing.js.map +1 -0
  519. package/node_modules/@earendil-works/pi-protocol/dist/index.d.ts +5 -0
  520. package/node_modules/@earendil-works/pi-protocol/dist/index.d.ts.map +1 -0
  521. package/node_modules/@earendil-works/pi-protocol/dist/index.js +5 -0
  522. package/node_modules/@earendil-works/pi-protocol/dist/index.js.map +1 -0
  523. package/node_modules/@earendil-works/pi-protocol/dist/schemas.d.ts +13818 -0
  524. package/node_modules/@earendil-works/pi-protocol/dist/schemas.d.ts.map +1 -0
  525. package/node_modules/@earendil-works/pi-protocol/dist/schemas.js +382 -0
  526. package/node_modules/@earendil-works/pi-protocol/dist/schemas.js.map +1 -0
  527. package/node_modules/@earendil-works/pi-protocol/package.json +48 -0
  528. package/node_modules/@earendil-works/pi-pty/package.json +2 -2
  529. package/node_modules/@earendil-works/pi-tui/README.md +77 -14
  530. package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.d.ts +83 -0
  531. package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.d.ts.map +1 -0
  532. package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.js +687 -0
  533. package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.js.map +1 -0
  534. package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.d.ts +5 -0
  535. package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.d.ts.map +1 -0
  536. package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.js +5 -0
  537. package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.js.map +1 -0
  538. package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.d.ts +13 -0
  539. package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.d.ts.map +1 -0
  540. package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.js +36 -0
  541. package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.js.map +1 -0
  542. package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts +7 -0
  543. package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts.map +1 -0
  544. package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.js +43 -0
  545. package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.js.map +1 -0
  546. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -1
  547. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +4 -4
  548. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -1
  549. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +2 -0
  550. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
  551. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +3 -2
  552. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
  553. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +51 -0
  554. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts.map +1 -0
  555. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js +163 -0
  556. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js.map +1 -0
  557. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
  558. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +3 -6
  559. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
  560. package/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts +32 -0
  561. package/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts.map +1 -0
  562. package/node_modules/@earendil-works/pi-tui/dist/components/stack.js +109 -0
  563. package/node_modules/@earendil-works/pi-tui/dist/components/stack.js.map +1 -0
  564. package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts +8 -0
  565. package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts.map +1 -0
  566. package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.js +21 -0
  567. package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.js.map +1 -0
  568. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +10 -4
  569. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  570. package/node_modules/@earendil-works/pi-tui/dist/index.js +10 -4
  571. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  572. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +30 -0
  573. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  574. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +18 -0
  575. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  576. package/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts +40 -0
  577. package/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts.map +1 -0
  578. package/node_modules/@earendil-works/pi-tui/dist/layout-node.js +6 -0
  579. package/node_modules/@earendil-works/pi-tui/dist/layout-node.js.map +1 -0
  580. package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts +40 -0
  581. package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts.map +1 -0
  582. package/node_modules/@earendil-works/pi-tui/dist/layout.js +315 -0
  583. package/node_modules/@earendil-works/pi-tui/dist/layout.js.map +1 -0
  584. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +10 -0
  585. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  586. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +61 -3
  587. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  588. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.d.ts +1 -0
  589. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.d.ts.map +1 -1
  590. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.js +12 -2
  591. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.js.map +1 -1
  592. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +36 -16
  593. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  594. package/node_modules/@earendil-works/pi-tui/dist/tui.js +72 -18
  595. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  596. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +10 -0
  597. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
  598. package/node_modules/@earendil-works/pi-tui/dist/utils.js +95 -4
  599. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
  600. package/node_modules/@earendil-works/pi-tui/package.json +2 -2
  601. package/node_modules/typebox/build/compile/validator.d.mts +3 -11
  602. package/node_modules/typebox/build/compile/validator.mjs +6 -36
  603. package/node_modules/typebox/build/error/errors.d.mts +1 -7
  604. package/node_modules/typebox/build/format/_idna.mjs +36 -6
  605. package/node_modules/typebox/build/format/_puny.mjs +4 -1
  606. package/node_modules/typebox/build/format/uuid.d.mts +2 -2
  607. package/node_modules/typebox/build/format/uuid.mjs +3 -3
  608. package/node_modules/typebox/build/guard/emit.d.mts +0 -4
  609. package/node_modules/typebox/build/guard/emit.mjs +0 -8
  610. package/node_modules/typebox/build/guard/guard.d.mts +5 -9
  611. package/node_modules/typebox/build/guard/guard.mjs +10 -15
  612. package/node_modules/typebox/build/guard/string.mjs +16 -4
  613. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  614. package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  615. package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  616. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  617. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  618. package/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
  619. package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  620. package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  621. package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  622. package/node_modules/typebox/build/schema/types/index.mjs +0 -1
  623. package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  624. package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  625. package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  626. package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  627. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  628. package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  629. package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  630. package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  631. package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  632. package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  633. package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  634. package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  635. package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  636. package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  637. package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  638. package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  639. package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  640. package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  641. package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  642. package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  643. package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  644. package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  645. package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  646. package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  647. package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  648. package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  649. package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  650. package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  651. package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  652. package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  653. package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  654. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  655. package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  656. package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  657. package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  658. package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  659. package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  660. package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  661. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  662. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  663. package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  664. package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  665. package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  666. package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  667. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  668. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  669. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  670. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  671. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  672. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  673. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  674. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  675. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  676. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  677. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  678. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  679. package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  680. package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  681. package/node_modules/typebox/build/type/action/index.d.mts +7 -4
  682. package/node_modules/typebox/build/type/action/index.mjs +7 -4
  683. package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  684. package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  685. package/node_modules/typebox/build/type/action/module.d.mts +8 -7
  686. package/node_modules/typebox/build/type/action/module.mjs +7 -6
  687. package/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
  688. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  689. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  690. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  691. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  692. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  693. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  694. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  695. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  696. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  697. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  698. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  699. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  700. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  701. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  702. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  703. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  704. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  705. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  706. package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  707. package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  708. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  709. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  710. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  711. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  712. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  713. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  714. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  715. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  716. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  717. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  718. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  719. package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  720. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  721. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  722. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  723. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  724. package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  725. package/node_modules/typebox/build/type/engine/index.mjs +2 -2
  726. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  727. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  728. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  729. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  730. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  731. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  732. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  733. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  734. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  735. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  736. package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  737. package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  738. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  739. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  740. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  741. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  742. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  743. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  744. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  745. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  746. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  747. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  748. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  749. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  750. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  751. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  752. package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  753. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  754. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  755. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  756. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  757. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  758. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  759. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  760. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  761. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  762. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  763. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  764. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  765. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  766. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  767. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  768. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  769. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  770. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  771. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  772. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  773. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  774. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  775. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  776. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  777. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  778. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  779. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  780. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  781. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  782. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  783. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  784. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  785. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  786. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  787. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  788. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  789. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  790. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  791. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  792. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  793. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  794. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  795. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  796. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  797. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  798. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  799. package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  800. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  801. package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  802. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  803. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  804. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  805. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  806. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  807. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  808. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  809. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  810. package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
  811. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  812. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  813. package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  814. package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  815. package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  816. package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  817. package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  818. package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  819. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  820. package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  821. package/node_modules/typebox/build/type/extends/object.mjs +25 -3
  822. package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  823. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  824. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  825. package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  826. package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  827. package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  828. package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  829. package/node_modules/typebox/build/type/extends/union.mjs +2 -2
  830. package/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
  831. package/node_modules/typebox/build/type/script/mapping.mjs +95 -92
  832. package/node_modules/typebox/build/type/script/parser.d.mts +42 -40
  833. package/node_modules/typebox/build/type/script/parser.mjs +23 -22
  834. package/node_modules/typebox/build/type/script/script.d.mts +3 -4
  835. package/node_modules/typebox/build/type/script/script.mjs +3 -2
  836. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  837. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  838. package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  839. package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  840. package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  841. package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  842. package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  843. package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  844. package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  845. package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  846. package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  847. package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  848. package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  849. package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  850. package/node_modules/typebox/build/type/types/call.d.mts +3 -3
  851. package/node_modules/typebox/build/type/types/call.mjs +3 -2
  852. package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  853. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  854. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  855. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  856. package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  857. package/node_modules/typebox/build/type/types/enum.mjs +5 -0
  858. package/node_modules/typebox/build/type/types/index.d.mts +1 -4
  859. package/node_modules/typebox/build/type/types/index.mjs +1 -4
  860. package/node_modules/typebox/build/type/types/number.d.mts +1 -1
  861. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  862. package/node_modules/typebox/build/type/types/record.d.mts +13 -7
  863. package/node_modules/typebox/build/type/types/record.mjs +15 -9
  864. package/node_modules/typebox/build/type/types/static.d.mts +2 -5
  865. package/node_modules/typebox/build/typebox.d.mts +3 -7
  866. package/node_modules/typebox/build/typebox.mjs +3 -7
  867. package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  868. package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  869. package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  870. package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  871. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  872. package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  873. package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  874. package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  875. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  876. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  877. package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  878. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  879. package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  880. package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  881. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  882. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  883. package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  884. package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  885. package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  886. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  887. package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  888. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  889. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  890. package/node_modules/typebox/build/value/index.d.mts +0 -1
  891. package/node_modules/typebox/build/value/index.mjs +0 -1
  892. package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  893. package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  894. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  895. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  896. package/node_modules/typebox/build/value/value.d.mts +0 -1
  897. package/node_modules/typebox/build/value/value.mjs +0 -1
  898. package/node_modules/typebox/package.json +33 -33
  899. package/node_modules/typebox/readme.md +117 -103
  900. package/package.json +20 -10
  901. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts +0 -3
  902. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts.map +0 -1
  903. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js.map +0 -1
  904. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +0 -26
  905. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +0 -1
  906. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -100
  907. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +0 -1
  908. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +0 -42
  909. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +0 -1
  910. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -286
  911. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +0 -1
  912. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +0 -18
  913. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +0 -1
  914. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +0 -44
  915. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +0 -1
  916. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +0 -33
  917. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +0 -1
  918. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -163
  919. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +0 -1
  920. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +0 -11
  921. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +0 -1
  922. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +0 -39
  923. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +0 -1
  924. package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  925. package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  926. package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  927. package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  928. package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  929. package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  930. package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  931. package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  932. package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  933. package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  934. package/node_modules/typebox/build/type/action/options.d.mts +0 -11
  935. package/node_modules/typebox/build/type/action/options.mjs +0 -11
  936. package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  937. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  938. package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  939. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  940. package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  941. package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  942. package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  943. package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  944. package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  945. package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  946. package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  947. package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  948. package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  949. package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  950. package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  951. package/node_modules/typebox/build/type/types/base.d.mts +0 -50
  952. package/node_modules/typebox/build/type/types/base.mjs +0 -84
  953. package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  954. package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  955. package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  956. package/node_modules/typebox/build/type/types/promise.mjs +0 -29
  957. package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  958. package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  959. package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  960. package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  961. package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  962. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  963. package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  964. package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  965. package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  966. package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  967. package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  968. package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  969. package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  970. package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  971. package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  972. package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  973. package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  974. package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  975. package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  976. package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  977. package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  978. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  979. package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  980. package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  981. package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  982. package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  983. package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  984. package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  985. package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  986. package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  987. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  988. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-image.js","sourceRoot":"","sources":["../src/terminal-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,0BAA0B,GAE1B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AA6BpE,IAAI,kBAAkB,GAAgC,IAAI,CAAC;AAE3D,2EAA2E;AAC3E,IAAI,cAAc,GAAmB,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAElE,MAAM,UAAU,iBAAiB;IAChC,OAAO,cAAc,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAoB;IACrD,cAAc,GAAG,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,kBAAkB,CACjC,qBAAqC,EACrC,oBAAiD;IAEjD,IAAI,CAAC,qBAAqB,IAAI,CAAC,oBAAoB;QAAE,OAAO,0BAA0B,EAAE,CAAC;IAEzF,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACtC,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,0BAA0B,CAC1C,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,YAAY,EAAE,EAC1D,OAAO,CAAC,QAAQ,EAChB,GAAG,EAAE,CACJ;QACC,KAAK;QACL,MAAM,CAAC,gBAAgB;QACvB,IAAI;QACJ,GAAG;QACH,GAAG;QACH,GAAG;QACH,MAAM,CAAC,cAAc;QACrB,MAAM,CAAC,WAAW,IAAI,EAAE;QACxB,MAAM,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AS,IAAI,gBAAgB,CAAC;AACpD,CAAC","sourcesContent":["import {\n\ttype DetectedTerminalCapabilities,\n\tdetectTerminalCapabilities,\n\ttype TerminalCapabilities,\n} from \"./terminal-capabilities.ts\";\n\nexport type { ImageProtocol, TerminalCapabilities } from \"./terminal-capabilities.ts\";\nexport { outerKittyGraphicsMode } from \"./terminal-capabilities.ts\";\n\nexport interface TmuxPassthroughState {\n\tallowPassthrough: \"off\" | \"on\" | \"all\";\n\tclientTermname: string;\n\tcellWidthPx?: number;\n\tcellHeightPx?: number;\n}\n\nexport interface CellDimensions {\n\twidthPx: number;\n\theightPx: number;\n}\n\nexport interface ImageDimensions {\n\twidthPx: number;\n\theightPx: number;\n}\n\nexport interface ImageRenderOptions {\n\tmaxWidthCells?: number;\n\tmaxHeightCells?: number;\n\tpreserveAspectRatio?: boolean;\n\t/** Kitty image ID. If provided, reuses/replaces existing image with this ID. */\n\timageId?: number;\n\t/** Whether Kitty should apply its default cursor movement after placement. */\n\tmoveCursor?: boolean;\n}\n\nlet cachedCapabilities: TerminalCapabilities | null = null;\n\n// Default cell dimensions - updated by TUI when terminal responds to query\nlet cellDimensions: CellDimensions = { widthPx: 9, heightPx: 18 };\n\nexport function getCellDimensions(): CellDimensions {\n\treturn cellDimensions;\n}\n\nexport function setCellDimensions(dims: CellDimensions): void {\n\tcellDimensions = dims;\n}\n\nexport function detectCapabilities(\n\ttmuxForwardsHyperlink?: () => boolean,\n\ttmuxPassthroughState?: () => TmuxPassthroughState,\n): DetectedTerminalCapabilities {\n\tif (!tmuxForwardsHyperlink || !tmuxPassthroughState) return detectTerminalCapabilities();\n\n\tconst legacy = tmuxPassthroughState();\n\tconst hyperlinks = tmuxForwardsHyperlink();\n\tconst detected = detectTerminalCapabilities(\n\t\t{ ...process.env, TMUX: process.env.TMUX ?? \"compat,0,0\" },\n\t\tprocess.platform,\n\t\t() =>\n\t\t\t[\n\t\t\t\t\"3.4\",\n\t\t\t\tlegacy.allowPassthrough,\n\t\t\t\t\"on\",\n\t\t\t\t\"1\",\n\t\t\t\t\"1\",\n\t\t\t\t\"1\",\n\t\t\t\tlegacy.clientTermname,\n\t\t\t\tlegacy.cellWidthPx ?? \"\",\n\t\t\t\tlegacy.cellHeightPx ?? \"\",\n\t\t\t\thyperlinks ? \"hyperlinks\" : \"\",\n\t\t\t].join(\"|\"),\n\t);\n\tif (detected.cellDimensions) setCellDimensions(detected.cellDimensions);\n\treturn { ...detected, hyperlinks };\n}\n\nexport function getCapabilities(): TerminalCapabilities {\n\tif (!cachedCapabilities) {\n\t\tconst detected = detectCapabilities();\n\t\tif (detected.cellDimensions) setCellDimensions(detected.cellDimensions);\n\t\tcachedCapabilities = detected;\n\t}\n\treturn cachedCapabilities;\n}\n\nexport function resetCapabilitiesCache(): void {\n\tcachedCapabilities = null;\n}\n\n/** Override the cached capabilities. Useful in tests to exercise both code paths. */\nexport function setCapabilities(caps: TerminalCapabilities): void {\n\tcachedCapabilities = caps;\n}\n\nconst KITTY_PREFIX = \"\\x1b_G\";\nconst ITERM2_PREFIX = \"\\x1b]1337;File=\";\n\n/**\n * Wrap an escape sequence in a tmux DCS passthrough envelope so tmux forwards\n * it verbatim to the outer terminal (requires `allow-passthrough`). Every ESC\n * inside the payload must be doubled per the tmux protocol.\n */\nexport function wrapTmuxPassthrough(sequence: string): string {\n\treturn `\\x1bPtmux;${sequence.replaceAll(\"\\x1b\", \"\\x1b\\x1b\")}\\x1b\\\\`;\n}\n\nexport function isImageLine(line: string): boolean {\n\t// Fast path: sequence at line start (single-row images)\n\tif (line.startsWith(KITTY_PREFIX) || line.startsWith(ITERM2_PREFIX)) {\n\t\treturn true;\n\t}\n\t// Slow path: sequence elsewhere (multi-row images have cursor-up prefix)\n\treturn line.includes(KITTY_PREFIX) || line.includes(ITERM2_PREFIX);\n}\n\n/**\n * Generate a random image ID for Kitty graphics protocol.\n * Uses random IDs to avoid collisions between different module instances\n * (e.g., main app vs extensions).\n */\nexport function allocateImageId(): number {\n\t// Use random ID in range [1, 0xffffffff] to avoid collisions\n\treturn Math.floor(Math.random() * 0xfffffffe) + 1;\n}\n\nexport function encodeKitty(\n\tbase64Data: string,\n\toptions: {\n\t\tcolumns?: number;\n\t\trows?: number;\n\t\timageId?: number;\n\t\t/** Whether Kitty should apply its default cursor movement after placement. Default: true. */\n\t\tmoveCursor?: boolean;\n\t\t/**\n\t\t * Create a virtual placement (`U=1`) for Unicode placeholders instead of\n\t\t * placing the image at the cursor. The image is only shown where\n\t\t * placeholder cells (see {@link buildKittyPlaceholderRow}) are printed.\n\t\t */\n\t\tvirtual?: boolean;\n\t} = {},\n): string {\n\tconst CHUNK_SIZE = 4096;\n\n\tconst params: string[] = [\"a=T\", \"f=100\", \"q=2\"];\n\n\tif (options.virtual) params.push(\"U=1\");\n\telse if (options.moveCursor === false) params.push(\"C=1\");\n\tif (options.columns) params.push(`c=${options.columns}`);\n\tif (options.rows) params.push(`r=${options.rows}`);\n\tif (options.imageId) params.push(`i=${options.imageId}`);\n\n\tconst chunks: string[] = [];\n\n\tif (base64Data.length <= CHUNK_SIZE) {\n\t\tchunks.push(`\\x1b_G${params.join(\",\")};${base64Data}\\x1b\\\\`);\n\t} else {\n\t\tlet offset = 0;\n\t\tlet isFirst = true;\n\n\t\twhile (offset < base64Data.length) {\n\t\t\tconst chunk = base64Data.slice(offset, offset + CHUNK_SIZE);\n\t\t\tconst isLast = offset + CHUNK_SIZE >= base64Data.length;\n\n\t\t\tif (isFirst) {\n\t\t\t\tchunks.push(`\\x1b_G${params.join(\",\")},m=1;${chunk}\\x1b\\\\`);\n\t\t\t\tisFirst = false;\n\t\t\t} else if (isLast) {\n\t\t\t\tchunks.push(`\\x1b_Gm=0;${chunk}\\x1b\\\\`);\n\t\t\t} else {\n\t\t\t\tchunks.push(`\\x1b_Gm=1;${chunk}\\x1b\\\\`);\n\t\t\t}\n\n\t\t\toffset += CHUNK_SIZE;\n\t\t}\n\t}\n\n\t// Under tmux passthrough every APC chunk must be wrapped individually so\n\t// tmux forwards each one as its own DCS envelope.\n\tif (getCapabilities().tmuxPassthrough) {\n\t\treturn chunks.map(wrapTmuxPassthrough).join(\"\");\n\t}\n\n\treturn chunks.join(\"\");\n}\n\n/**\n * Placeholder codepoint for Kitty Unicode placements (U+10EEEE). Each cell of\n * a virtual placement is this character with combining diacritics encoding the\n * row/column and the foreground color encoding the image ID.\n */\nconst KITTY_PLACEHOLDER = String.fromCodePoint(0x10eeee);\n\n/**\n * Row/column index diacritics from the Kitty graphics protocol\n * (rowcolumn-diacritics.txt): diacritic at index N encodes row/column N.\n */\nconst KITTY_PLACEHOLDER_DIACRITICS: readonly number[] = [\n\t0x0305, 0x030d, 0x030e, 0x0310, 0x0312, 0x033d, 0x033e, 0x033f, 0x0346, 0x034a, 0x034b, 0x034c, 0x0350, 0x0351,\n\t0x0352, 0x0357, 0x035b, 0x0363, 0x0364, 0x0365, 0x0366, 0x0367, 0x0368, 0x0369, 0x036a, 0x036b, 0x036c, 0x036d,\n\t0x036e, 0x036f, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0592, 0x0593, 0x0594, 0x0595, 0x0597, 0x0598, 0x0599,\n\t0x059c, 0x059d, 0x059e, 0x059f, 0x05a0, 0x05a1, 0x05a8, 0x05a9, 0x05ab, 0x05ac, 0x05af, 0x05c4, 0x0610, 0x0611,\n\t0x0612, 0x0613, 0x0614, 0x0615, 0x0616, 0x0617, 0x0657, 0x0658, 0x0659, 0x065a, 0x065b, 0x065d, 0x065e, 0x06d6,\n\t0x06d7, 0x06d8, 0x06d9, 0x06da, 0x06db, 0x06dc, 0x06df, 0x06e0, 0x06e1, 0x06e2, 0x06e4, 0x06e7, 0x06e8, 0x06eb,\n\t0x06ec, 0x0730, 0x0732, 0x0733, 0x0735, 0x0736, 0x073a, 0x073d, 0x073f, 0x0740, 0x0741, 0x0743, 0x0745, 0x0747,\n\t0x0749, 0x074a, 0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, 0x07f0, 0x07f1, 0x07f3, 0x0816, 0x0817, 0x0818, 0x0819,\n\t0x081b, 0x081c, 0x081d, 0x081e, 0x081f, 0x0820, 0x0821, 0x0822, 0x0823, 0x0825, 0x0826, 0x0827, 0x0829, 0x082a,\n\t0x082b, 0x082c, 0x082d, 0x0951, 0x0953, 0x0954, 0x0f82, 0x0f83, 0x0f86, 0x0f87, 0x135d, 0x135e, 0x135f, 0x17dd,\n\t0x193a, 0x1a17, 0x1a75, 0x1a76, 0x1a77, 0x1a78, 0x1a79, 0x1a7a, 0x1a7b, 0x1a7c, 0x1b6b, 0x1b6d, 0x1b6e, 0x1b6f,\n\t0x1b70, 0x1b71, 0x1b72, 0x1b73, 0x1cd0, 0x1cd1, 0x1cd2, 0x1cda, 0x1cdb, 0x1ce0, 0x1dc0, 0x1dc1, 0x1dc3, 0x1dc4,\n\t0x1dc5, 0x1dc6, 0x1dc7, 0x1dc8, 0x1dc9, 0x1dcb, 0x1dcc, 0x1dd1, 0x1dd2, 0x1dd3, 0x1dd4, 0x1dd5, 0x1dd6, 0x1dd7,\n\t0x1dd8, 0x1dd9, 0x1dda, 0x1ddb, 0x1ddc, 0x1ddd, 0x1dde, 0x1ddf, 0x1de0, 0x1de1, 0x1de2, 0x1de3, 0x1de4, 0x1de5,\n\t0x1de6, 0x1dfe, 0x20d0, 0x20d1, 0x20d4, 0x20d5, 0x20d6, 0x20d7, 0x20db, 0x20dc, 0x20e1, 0x20e7, 0x20e9, 0x20f0,\n\t0x2cef, 0x2cf0, 0x2cf1, 0x2de0, 0x2de1, 0x2de2, 0x2de3, 0x2de4, 0x2de5, 0x2de6, 0x2de7, 0x2de8, 0x2de9, 0x2dea,\n\t0x2deb, 0x2dec, 0x2ded, 0x2dee, 0x2def, 0x2df0, 0x2df1, 0x2df2, 0x2df3, 0x2df4, 0x2df5, 0x2df6, 0x2df7, 0x2df8,\n\t0x2df9, 0x2dfa, 0x2dfb, 0x2dfc, 0x2dfd, 0x2dfe, 0x2dff, 0xa66f, 0xa67c, 0xa67d, 0xa6f0, 0xa6f1, 0xa8e0, 0xa8e1,\n\t0xa8e2, 0xa8e3, 0xa8e4, 0xa8e5, 0xa8e6, 0xa8e7, 0xa8e8, 0xa8e9, 0xa8ea, 0xa8eb, 0xa8ec, 0xa8ed, 0xa8ee, 0xa8ef,\n\t0xa8f0, 0xa8f1, 0xaab0, 0xaab2, 0xaab3, 0xaab7, 0xaab8, 0xaabe, 0xaabf, 0xaac1, 0xfe20, 0xfe21, 0xfe22, 0xfe23,\n\t0xfe24, 0xfe25, 0xfe26, 0x10a0f, 0x10a38, 0x1d185, 0x1d186, 0x1d187, 0x1d188, 0x1d189, 0x1d1aa, 0x1d1ab, 0x1d1ac,\n\t0x1d1ad, 0x1d242, 0x1d243, 0x1d244,\n];\n\n/** Maximum rows/columns addressable by Kitty Unicode placeholder diacritics. */\nexport const KITTY_PLACEHOLDER_MAX = KITTY_PLACEHOLDER_DIACRITICS.length;\n\n/**\n * Build one row of Kitty Unicode placeholder cells for a virtual placement.\n * The foreground color carries the low 24 bits of the image ID; the third\n * diacritic carries the high byte when present. Placeholder cells are plain\n * text (1 column each), so tmux and the TUI treat them like any other line.\n */\nexport function buildKittyPlaceholderRow(imageId: number, row: number, columns: number): string {\n\tconst rowDiacritic = String.fromCodePoint(KITTY_PLACEHOLDER_DIACRITICS[Math.min(row, KITTY_PLACEHOLDER_MAX - 1)]);\n\tconst idHighByte = (imageId >>> 24) & 0xff;\n\tconst idDiacritic = idHighByte > 0 ? String.fromCodePoint(KITTY_PLACEHOLDER_DIACRITICS[idHighByte]) : \"\";\n\tconst r = (imageId >>> 16) & 0xff;\n\tconst g = (imageId >>> 8) & 0xff;\n\tconst b = imageId & 0xff;\n\n\tlet cells = \"\";\n\tfor (let column = 0; column < columns; column++) {\n\t\tconst columnDiacritic = String.fromCodePoint(\n\t\t\tKITTY_PLACEHOLDER_DIACRITICS[Math.min(column, KITTY_PLACEHOLDER_MAX - 1)],\n\t\t);\n\t\tcells += KITTY_PLACEHOLDER + rowDiacritic + columnDiacritic + idDiacritic;\n\t}\n\treturn `\\x1b[38;2;${r};${g};${b}m${cells}\\x1b[39m`;\n}\n\n/**\n * Delete a Kitty graphics image by ID.\n * Uses uppercase 'I' to also free the image data.\n */\nexport function deleteKittyImage(imageId: number): string {\n\tconst sequence = `\\x1b_Ga=d,d=I,i=${imageId},q=2\\x1b\\\\`;\n\treturn getCapabilities().tmuxPassthrough ? wrapTmuxPassthrough(sequence) : sequence;\n}\n\n/**\n * Delete all visible Kitty graphics images.\n * Uses uppercase 'A' to also free the image data.\n */\nexport function deleteAllKittyImages(): string {\n\tconst sequence = \"\\x1b_Ga=d,d=A,q=2\\x1b\\\\\";\n\treturn getCapabilities().tmuxPassthrough ? wrapTmuxPassthrough(sequence) : sequence;\n}\n\nexport function encodeITerm2(\n\tbase64Data: string,\n\toptions: {\n\t\twidth?: number | string;\n\t\theight?: number | string;\n\t\tname?: string;\n\t\tpreserveAspectRatio?: boolean;\n\t\tinline?: boolean;\n\t} = {},\n): string {\n\tconst params: string[] = [`inline=${options.inline !== false ? 1 : 0}`];\n\n\tif (options.width !== undefined) params.push(`width=${options.width}`);\n\tif (options.height !== undefined) params.push(`height=${options.height}`);\n\tif (options.name) {\n\t\tconst nameBase64 = Buffer.from(options.name).toString(\"base64\");\n\t\tparams.push(`name=${nameBase64}`);\n\t}\n\tif (options.preserveAspectRatio === false) {\n\t\tparams.push(\"preserveAspectRatio=0\");\n\t}\n\n\treturn `\\x1b]1337;File=${params.join(\";\")}:${base64Data}\\x07`;\n}\n\nexport interface ImageCellSize {\n\tcolumns: number;\n\trows: number;\n}\n\nexport function calculateImageCellSize(\n\timageDimensions: ImageDimensions,\n\tmaxWidthCells: number,\n\tmaxHeightCells?: number,\n\tcellDimensions: CellDimensions = { widthPx: 9, heightPx: 18 },\n): ImageCellSize {\n\tconst maxWidth = Math.max(1, Math.floor(maxWidthCells));\n\tconst maxHeight = maxHeightCells === undefined ? undefined : Math.max(1, Math.floor(maxHeightCells));\n\tconst imageWidth = Math.max(1, imageDimensions.widthPx);\n\tconst imageHeight = Math.max(1, imageDimensions.heightPx);\n\n\tconst widthScale = (maxWidth * cellDimensions.widthPx) / imageWidth;\n\tconst heightScale = maxHeight === undefined ? widthScale : (maxHeight * cellDimensions.heightPx) / imageHeight;\n\tconst scale = Math.min(widthScale, heightScale);\n\n\tconst scaledWidthPx = imageWidth * scale;\n\tconst scaledHeightPx = imageHeight * scale;\n\tconst columns = Math.ceil(scaledWidthPx / cellDimensions.widthPx);\n\tconst rows = Math.ceil(scaledHeightPx / cellDimensions.heightPx);\n\n\treturn {\n\t\tcolumns: Math.max(1, Math.min(maxWidth, columns)),\n\t\trows: Math.max(1, maxHeight === undefined ? rows : Math.min(maxHeight, rows)),\n\t};\n}\n\nexport function getPngDimensions(base64Data: string): ImageDimensions | null {\n\ttry {\n\t\tconst buffer = Buffer.from(base64Data, \"base64\");\n\n\t\tif (buffer.length < 24) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (buffer[0] !== 0x89 || buffer[1] !== 0x50 || buffer[2] !== 0x4e || buffer[3] !== 0x47) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst width = buffer.readUInt32BE(16);\n\t\tconst height = buffer.readUInt32BE(20);\n\n\t\treturn { widthPx: width, heightPx: height };\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getJpegDimensions(base64Data: string): ImageDimensions | null {\n\ttry {\n\t\tconst buffer = Buffer.from(base64Data, \"base64\");\n\n\t\tif (buffer.length < 2) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (buffer[0] !== 0xff || buffer[1] !== 0xd8) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet offset = 2;\n\t\twhile (offset < buffer.length - 9) {\n\t\t\tif (buffer[offset] !== 0xff) {\n\t\t\t\toffset++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst marker = buffer[offset + 1];\n\n\t\t\tif (marker >= 0xc0 && marker <= 0xc2) {\n\t\t\t\tconst height = buffer.readUInt16BE(offset + 5);\n\t\t\t\tconst width = buffer.readUInt16BE(offset + 7);\n\t\t\t\treturn { widthPx: width, heightPx: height };\n\t\t\t}\n\n\t\t\tif (offset + 3 >= buffer.length) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst length = buffer.readUInt16BE(offset + 2);\n\t\t\tif (length < 2) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\toffset += 2 + length;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getGifDimensions(base64Data: string): ImageDimensions | null {\n\ttry {\n\t\tconst buffer = Buffer.from(base64Data, \"base64\");\n\n\t\tif (buffer.length < 10) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst sig = buffer.subarray(0, 6).toString(\"ascii\");\n\t\tif (sig !== \"GIF87a\" && sig !== \"GIF89a\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst width = buffer.readUInt16LE(6);\n\t\tconst height = buffer.readUInt16LE(8);\n\n\t\treturn { widthPx: width, heightPx: height };\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getWebpDimensions(base64Data: string): ImageDimensions | null {\n\ttry {\n\t\tconst buffer = Buffer.from(base64Data, \"base64\");\n\n\t\tif (buffer.length < 30) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst riff = buffer.subarray(0, 4).toString(\"ascii\");\n\t\tconst webp = buffer.subarray(8, 12).toString(\"ascii\");\n\t\tif (riff !== \"RIFF\" || webp !== \"WEBP\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst chunk = buffer.subarray(12, 16).toString(\"ascii\");\n\t\tif (chunk === \"VP8 \") {\n\t\t\tif (buffer.length < 30) return null;\n\t\t\tconst width = buffer.readUInt16LE(26) & 0x3fff;\n\t\t\tconst height = buffer.readUInt16LE(28) & 0x3fff;\n\t\t\treturn { widthPx: width, heightPx: height };\n\t\t} else if (chunk === \"VP8L\") {\n\t\t\tif (buffer.length < 25) return null;\n\t\t\tconst bits = buffer.readUInt32LE(21);\n\t\t\tconst width = (bits & 0x3fff) + 1;\n\t\t\tconst height = ((bits >> 14) & 0x3fff) + 1;\n\t\t\treturn { widthPx: width, heightPx: height };\n\t\t} else if (chunk === \"VP8X\") {\n\t\t\tif (buffer.length < 30) return null;\n\t\t\tconst width = (buffer[24] | (buffer[25] << 8) | (buffer[26] << 16)) + 1;\n\t\t\tconst height = (buffer[27] | (buffer[28] << 8) | (buffer[29] << 16)) + 1;\n\t\t\treturn { widthPx: width, heightPx: height };\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getImageDimensions(base64Data: string, mimeType: string): ImageDimensions | null {\n\tif (mimeType === \"image/png\") {\n\t\treturn getPngDimensions(base64Data);\n\t}\n\tif (mimeType === \"image/jpeg\") {\n\t\treturn getJpegDimensions(base64Data);\n\t}\n\tif (mimeType === \"image/gif\") {\n\t\treturn getGifDimensions(base64Data);\n\t}\n\tif (mimeType === \"image/webp\") {\n\t\treturn getWebpDimensions(base64Data);\n\t}\n\treturn null;\n}\n\nexport function renderImage(\n\tbase64Data: string,\n\timageDimensions: ImageDimensions,\n\toptions: ImageRenderOptions = {},\n): { sequence: string; rows: number; imageId?: number; lines?: string[] } | null {\n\tconst caps = getCapabilities();\n\n\tif (!caps.images) {\n\t\treturn null;\n\t}\n\n\tconst maxWidth = options.maxWidthCells ?? 80;\n\tconst size = calculateImageCellSize(imageDimensions, maxWidth, options.maxHeightCells, getCellDimensions());\n\n\tif (caps.images === \"kitty\" && caps.kittyUnicodePlaceholders) {\n\t\t// Virtual placement: transmit once, then show the image with plain-text\n\t\t// placeholder cells. Under tmux the placeholder cells move/clip with the\n\t\t// pane, so split layouts render correctly.\n\t\tconst imageId = options.imageId ?? allocateImageId();\n\t\tconst columns = Math.min(size.columns, KITTY_PLACEHOLDER_MAX);\n\t\tconst rows = Math.min(size.rows, KITTY_PLACEHOLDER_MAX);\n\t\tconst sequence = encodeKitty(base64Data, { columns, rows, imageId, virtual: true });\n\t\tconst lines: string[] = [];\n\t\tfor (let row = 0; row < rows; row++) {\n\t\t\tconst placeholderRow = buildKittyPlaceholderRow(imageId, row, columns);\n\t\t\tlines.push(row === 0 ? sequence + placeholderRow : placeholderRow);\n\t\t}\n\t\treturn { sequence, rows, imageId, lines };\n\t}\n\n\tif (caps.images === \"kitty\") {\n\t\tconst sequence = encodeKitty(base64Data, {\n\t\t\tcolumns: size.columns,\n\t\t\trows: size.rows,\n\t\t\timageId: options.imageId,\n\t\t\tmoveCursor: options.moveCursor,\n\t\t});\n\t\treturn { sequence, rows: size.rows, imageId: options.imageId };\n\t}\n\n\tif (caps.images === \"iterm2\") {\n\t\tconst sequence = encodeITerm2(base64Data, {\n\t\t\twidth: size.columns,\n\t\t\theight: \"auto\",\n\t\t\tpreserveAspectRatio: options.preserveAspectRatio ?? true,\n\t\t});\n\t\treturn { sequence, rows: size.rows };\n\t}\n\n\treturn null;\n}\n\n/**\n * Wrap text in an OSC 8 hyperlink sequence.\n * The text is rendered as a clickable hyperlink in terminals that support OSC 8\n * (Ghostty, Kitty, WezTerm, iTerm2, VSCode, and others).\n * In terminals that do not support OSC 8, the escape sequences are ignored\n * and only the plain text is displayed.\n *\n * @param text - The visible text to display\n * @param url - The URL to link to\n */\nexport function hyperlink(text: string, url: string): string {\n\treturn `\\x1b]8;;${url}\\x1b\\\\${text}\\x1b]8;;\\x1b\\\\`;\n}\n"]}
1
+ {"version":3,"file":"terminal-image.js","sourceRoot":"","sources":["../src/terminal-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAEN,0BAA0B,GAE1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CA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;AACpD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,UAA4B,EAAE,QAAiB;IAC9F,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,QAAQ,EAAE,CAAC;QACd,MAAM,SAAS,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,KAAK,CAAC,IAAI,CACT,eAAe,EAAE,CAAC,UAAU,IAAI,UAAU,CAAC,SAAS,CAAC;YACpD,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;YACnD,CAAC,CAAC,OAAO,CACV,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3E,OAAO,WAAW,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACtC,CAAC","sourcesContent":["import { isAbsolute } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport {\n\ttype DetectedTerminalCapabilities,\n\tdetectTerminalCapabilities,\n\ttype TerminalCapabilities,\n} from \"./terminal-capabilities.ts\";\nimport { sanitizeTerminalLabel, shortenImagePath } from \"./terminal-text.ts\";\n\nexport type { ImageProtocol, TerminalCapabilities } from \"./terminal-capabilities.ts\";\nexport { outerKittyGraphicsMode } from \"./terminal-capabilities.ts\";\n\nexport interface TmuxPassthroughState {\n\tallowPassthrough: \"off\" | \"on\" | \"all\";\n\tclientTermname: string;\n\tcellWidthPx?: number;\n\tcellHeightPx?: number;\n}\n\nexport interface CellDimensions {\n\twidthPx: number;\n\theightPx: number;\n}\n\nexport interface ImageDimensions {\n\twidthPx: number;\n\theightPx: number;\n}\n\nexport interface ImageRenderOptions {\n\tmaxWidthCells?: number;\n\tmaxHeightCells?: number;\n\tpreserveAspectRatio?: boolean;\n\t/** Kitty image ID. If provided, reuses/replaces existing image with this ID. */\n\timageId?: number;\n\t/** Whether Kitty should apply its default cursor movement after placement. */\n\tmoveCursor?: boolean;\n}\n\nlet cachedCapabilities: TerminalCapabilities | null = null;\n\n// Default cell dimensions - updated by TUI when terminal responds to query\nlet cellDimensions: CellDimensions = { widthPx: 9, heightPx: 18 };\n\nexport function getCellDimensions(): CellDimensions {\n\treturn cellDimensions;\n}\n\nexport function setCellDimensions(dims: CellDimensions): void {\n\tcellDimensions = dims;\n}\n\nexport function detectCapabilities(\n\ttmuxForwardsHyperlink?: () => boolean,\n\ttmuxPassthroughState?: () => TmuxPassthroughState,\n): DetectedTerminalCapabilities {\n\tif (!tmuxForwardsHyperlink || !tmuxPassthroughState) return detectTerminalCapabilities();\n\n\tconst legacy = tmuxPassthroughState();\n\tconst hyperlinks = tmuxForwardsHyperlink();\n\tconst detected = detectTerminalCapabilities(\n\t\t{ ...process.env, TMUX: process.env.TMUX ?? \"compat,0,0\" },\n\t\tprocess.platform,\n\t\t() =>\n\t\t\t[\n\t\t\t\t\"3.4\",\n\t\t\t\tlegacy.allowPassthrough,\n\t\t\t\t\"on\",\n\t\t\t\t\"1\",\n\t\t\t\t\"1\",\n\t\t\t\t\"1\",\n\t\t\t\tlegacy.clientTermname,\n\t\t\t\tlegacy.cellWidthPx ?? \"\",\n\t\t\t\tlegacy.cellHeightPx ?? \"\",\n\t\t\t\thyperlinks ? \"hyperlinks\" : \"\",\n\t\t\t].join(\"|\"),\n\t);\n\tif (detected.cellDimensions) setCellDimensions(detected.cellDimensions);\n\treturn { ...detected, hyperlinks };\n}\n\nexport function getCapabilities(): TerminalCapabilities {\n\tif (!cachedCapabilities) {\n\t\tconst detected = detectCapabilities();\n\t\tif (detected.cellDimensions) setCellDimensions(detected.cellDimensions);\n\t\tcachedCapabilities = detected;\n\t}\n\treturn cachedCapabilities;\n}\n\nexport function resetCapabilitiesCache(): void {\n\tcachedCapabilities = null;\n}\n\n/** Override the cached capabilities. Useful in tests to exercise both code paths. */\nexport function setCapabilities(caps: TerminalCapabilities): void {\n\tcachedCapabilities = caps;\n}\n\nconst KITTY_PREFIX = \"\\x1b_G\";\nconst ITERM2_PREFIX = \"\\x1b]1337;File=\";\n\n/**\n * Wrap an escape sequence in a tmux DCS passthrough envelope so tmux forwards\n * it verbatim to the outer terminal (requires `allow-passthrough`). Every ESC\n * inside the payload must be doubled per the tmux protocol.\n */\nexport function wrapTmuxPassthrough(sequence: string): string {\n\treturn `\\x1bPtmux;${sequence.replaceAll(\"\\x1b\", \"\\x1b\\x1b\")}\\x1b\\\\`;\n}\n\nexport function isImageLine(line: string): boolean {\n\t// Fast path: sequence at line start (single-row images)\n\tif (line.startsWith(KITTY_PREFIX) || line.startsWith(ITERM2_PREFIX)) {\n\t\treturn true;\n\t}\n\t// Slow path: sequence elsewhere (multi-row images have cursor-up prefix)\n\treturn line.includes(KITTY_PREFIX) || line.includes(ITERM2_PREFIX);\n}\n\n/**\n * Generate a random image ID for Kitty graphics protocol.\n * Uses random IDs to avoid collisions between different module instances\n * (e.g., main app vs extensions).\n */\nexport function allocateImageId(): number {\n\t// Use random ID in range [1, 0xffffffff] to avoid collisions\n\treturn Math.floor(Math.random() * 0xfffffffe) + 1;\n}\n\nexport function encodeKitty(\n\tbase64Data: string,\n\toptions: {\n\t\tcolumns?: number;\n\t\trows?: number;\n\t\timageId?: number;\n\t\t/** Whether Kitty should apply its default cursor movement after placement. Default: true. */\n\t\tmoveCursor?: boolean;\n\t\t/**\n\t\t * Create a virtual placement (`U=1`) for Unicode placeholders instead of\n\t\t * placing the image at the cursor. The image is only shown where\n\t\t * placeholder cells (see {@link buildKittyPlaceholderRow}) are printed.\n\t\t */\n\t\tvirtual?: boolean;\n\t} = {},\n): string {\n\tconst CHUNK_SIZE = 4096;\n\n\tconst params: string[] = [\"a=T\", \"f=100\", \"q=2\"];\n\n\tif (options.virtual) params.push(\"U=1\");\n\telse if (options.moveCursor === false) params.push(\"C=1\");\n\tif (options.columns) params.push(`c=${options.columns}`);\n\tif (options.rows) params.push(`r=${options.rows}`);\n\tif (options.imageId) params.push(`i=${options.imageId}`);\n\n\tconst chunks: string[] = [];\n\n\tif (base64Data.length <= CHUNK_SIZE) {\n\t\tchunks.push(`\\x1b_G${params.join(\",\")};${base64Data}\\x1b\\\\`);\n\t} else {\n\t\tlet offset = 0;\n\t\tlet isFirst = true;\n\n\t\twhile (offset < base64Data.length) {\n\t\t\tconst chunk = base64Data.slice(offset, offset + CHUNK_SIZE);\n\t\t\tconst isLast = offset + CHUNK_SIZE >= base64Data.length;\n\n\t\t\tif (isFirst) {\n\t\t\t\tchunks.push(`\\x1b_G${params.join(\",\")},m=1;${chunk}\\x1b\\\\`);\n\t\t\t\tisFirst = false;\n\t\t\t} else if (isLast) {\n\t\t\t\tchunks.push(`\\x1b_Gm=0;${chunk}\\x1b\\\\`);\n\t\t\t} else {\n\t\t\t\tchunks.push(`\\x1b_Gm=1;${chunk}\\x1b\\\\`);\n\t\t\t}\n\n\t\t\toffset += CHUNK_SIZE;\n\t\t}\n\t}\n\n\t// Under tmux passthrough every APC chunk must be wrapped individually so\n\t// tmux forwards each one as its own DCS envelope.\n\tif (getCapabilities().tmuxPassthrough) {\n\t\treturn chunks.map(wrapTmuxPassthrough).join(\"\");\n\t}\n\n\treturn chunks.join(\"\");\n}\n\n/**\n * Placeholder codepoint for Kitty Unicode placements (U+10EEEE). Each cell of\n * a virtual placement is this character with combining diacritics encoding the\n * row/column and the foreground color encoding the image ID.\n */\nconst KITTY_PLACEHOLDER = String.fromCodePoint(0x10eeee);\n\n/**\n * Row/column index diacritics from the Kitty graphics protocol\n * (rowcolumn-diacritics.txt): diacritic at index N encodes row/column N.\n */\nconst KITTY_PLACEHOLDER_DIACRITICS: readonly number[] = [\n\t0x0305, 0x030d, 0x030e, 0x0310, 0x0312, 0x033d, 0x033e, 0x033f, 0x0346, 0x034a, 0x034b, 0x034c, 0x0350, 0x0351,\n\t0x0352, 0x0357, 0x035b, 0x0363, 0x0364, 0x0365, 0x0366, 0x0367, 0x0368, 0x0369, 0x036a, 0x036b, 0x036c, 0x036d,\n\t0x036e, 0x036f, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0592, 0x0593, 0x0594, 0x0595, 0x0597, 0x0598, 0x0599,\n\t0x059c, 0x059d, 0x059e, 0x059f, 0x05a0, 0x05a1, 0x05a8, 0x05a9, 0x05ab, 0x05ac, 0x05af, 0x05c4, 0x0610, 0x0611,\n\t0x0612, 0x0613, 0x0614, 0x0615, 0x0616, 0x0617, 0x0657, 0x0658, 0x0659, 0x065a, 0x065b, 0x065d, 0x065e, 0x06d6,\n\t0x06d7, 0x06d8, 0x06d9, 0x06da, 0x06db, 0x06dc, 0x06df, 0x06e0, 0x06e1, 0x06e2, 0x06e4, 0x06e7, 0x06e8, 0x06eb,\n\t0x06ec, 0x0730, 0x0732, 0x0733, 0x0735, 0x0736, 0x073a, 0x073d, 0x073f, 0x0740, 0x0741, 0x0743, 0x0745, 0x0747,\n\t0x0749, 0x074a, 0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, 0x07f0, 0x07f1, 0x07f3, 0x0816, 0x0817, 0x0818, 0x0819,\n\t0x081b, 0x081c, 0x081d, 0x081e, 0x081f, 0x0820, 0x0821, 0x0822, 0x0823, 0x0825, 0x0826, 0x0827, 0x0829, 0x082a,\n\t0x082b, 0x082c, 0x082d, 0x0951, 0x0953, 0x0954, 0x0f82, 0x0f83, 0x0f86, 0x0f87, 0x135d, 0x135e, 0x135f, 0x17dd,\n\t0x193a, 0x1a17, 0x1a75, 0x1a76, 0x1a77, 0x1a78, 0x1a79, 0x1a7a, 0x1a7b, 0x1a7c, 0x1b6b, 0x1b6d, 0x1b6e, 0x1b6f,\n\t0x1b70, 0x1b71, 0x1b72, 0x1b73, 0x1cd0, 0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\n\t0x1d1ad, 0x1d242, 0x1d243, 0x1d244,\n];\n\n/** Maximum rows/columns addressable by Kitty Unicode placeholder diacritics. */\nexport const KITTY_PLACEHOLDER_MAX = KITTY_PLACEHOLDER_DIACRITICS.length;\n\n/**\n * Build one row of Kitty Unicode placeholder cells for a virtual placement.\n * The foreground color carries the low 24 bits of the image ID; the third\n * diacritic carries the high byte when present. Placeholder cells are plain\n * text (1 column each), so tmux and the TUI treat them like any other line.\n */\nexport function buildKittyPlaceholderRow(imageId: number, row: number, columns: number): string {\n\tconst rowDiacritic = String.fromCodePoint(KITTY_PLACEHOLDER_DIACRITICS[Math.min(row, KITTY_PLACEHOLDER_MAX - 1)]);\n\tconst idHighByte = (imageId >>> 24) & 0xff;\n\tconst idDiacritic = idHighByte > 0 ? String.fromCodePoint(KITTY_PLACEHOLDER_DIACRITICS[idHighByte]) : \"\";\n\tconst r = (imageId >>> 16) & 0xff;\n\tconst g = (imageId >>> 8) & 0xff;\n\tconst b = imageId & 0xff;\n\n\tlet cells = \"\";\n\tfor (let column = 0; column < columns; column++) {\n\t\tconst columnDiacritic = String.fromCodePoint(\n\t\t\tKITTY_PLACEHOLDER_DIACRITICS[Math.min(column, KITTY_PLACEHOLDER_MAX - 1)],\n\t\t);\n\t\tcells += KITTY_PLACEHOLDER + rowDiacritic + columnDiacritic + idDiacritic;\n\t}\n\treturn `\\x1b[38;2;${r};${g};${b}m${cells}\\x1b[39m`;\n}\n\n/**\n * Delete a Kitty graphics image by ID.\n * Uses uppercase 'I' to also free the image data.\n */\nexport function deleteKittyImage(imageId: number): string {\n\tconst sequence = `\\x1b_Ga=d,d=I,i=${imageId},q=2\\x1b\\\\`;\n\treturn getCapabilities().tmuxPassthrough ? wrapTmuxPassthrough(sequence) : sequence;\n}\n\n/**\n * Delete all visible Kitty graphics images.\n * Uses uppercase 'A' to also free the image data.\n */\nexport function deleteAllKittyImages(): string {\n\tconst sequence = \"\\x1b_Ga=d,d=A,q=2\\x1b\\\\\";\n\treturn getCapabilities().tmuxPassthrough ? wrapTmuxPassthrough(sequence) : sequence;\n}\n\nexport function encodeITerm2(\n\tbase64Data: string,\n\toptions: {\n\t\twidth?: number | string;\n\t\theight?: number | string;\n\t\tname?: string;\n\t\tpreserveAspectRatio?: boolean;\n\t\tinline?: boolean;\n\t} = {},\n): string {\n\tconst params: string[] = [`inline=${options.inline !== false ? 1 : 0}`];\n\n\tif (options.width !== undefined) params.push(`width=${options.width}`);\n\tif (options.height !== undefined) params.push(`height=${options.height}`);\n\tif (options.name) {\n\t\tconst nameBase64 = Buffer.from(options.name).toString(\"base64\");\n\t\tparams.push(`name=${nameBase64}`);\n\t}\n\tif (options.preserveAspectRatio === false) {\n\t\tparams.push(\"preserveAspectRatio=0\");\n\t}\n\n\treturn `\\x1b]1337;File=${params.join(\";\")}:${base64Data}\\x07`;\n}\n\nexport interface ImageCellSize {\n\tcolumns: number;\n\trows: number;\n}\n\nexport interface KittyImageMetadata extends ImageCellSize {\n\timageId: number;\n\twidthPx: number;\n\theightPx: number;\n}\n\nconst kittyImageMetadata = new Map<number, KittyImageMetadata>();\n\nexport function registerKittyImageMetadata(metadata: KittyImageMetadata): void {\n\tkittyImageMetadata.delete(metadata.imageId);\n\tkittyImageMetadata.set(metadata.imageId, metadata);\n\tif (kittyImageMetadata.size > 1000) {\n\t\tconst oldestImageId = kittyImageMetadata.keys().next().value;\n\t\tif (oldestImageId !== undefined) kittyImageMetadata.delete(oldestImageId);\n\t}\n}\n\nexport function getKittyImageMetadata(line: string): KittyImageMetadata | undefined {\n\tconst controls = /\\x1b_G([^;]*);/.exec(line)?.[1];\n\tif (!controls) return undefined;\n\tconst imageId = /(?:^|,)i=(\\d+)(?:,|$)/.exec(controls)?.[1];\n\treturn imageId === undefined ? undefined : kittyImageMetadata.get(Number.parseInt(imageId, 10));\n}\n\nexport function cropKittyImageLine(line: string, hiddenRows: number, visibleRows: number): string {\n\tconst metadata = getKittyImageMetadata(line);\n\tconst match = /\\x1b_G([^;]*);/.exec(line);\n\tif (!metadata || !match || hiddenRows < 0 || hiddenRows >= metadata.rows || visibleRows <= 0) return line;\n\tconst croppedRows = Math.min(visibleRows, metadata.rows - hiddenRows);\n\tif (hiddenRows === 0 && croppedRows === metadata.rows) return line;\n\tconst sourceY = Math.floor((metadata.heightPx * hiddenRows) / metadata.rows);\n\tconst sourceEnd = Math.ceil((metadata.heightPx * (hiddenRows + croppedRows)) / metadata.rows);\n\tconst sourceHeight = Math.max(1, Math.min(metadata.heightPx, sourceEnd) - sourceY);\n\tconst controls = match[1].split(\",\").filter((control) => !/^[yhr]=/.test(control));\n\tcontrols.push(`y=${sourceY}`, `h=${sourceHeight}`, `r=${croppedRows}`);\n\treturn `${line.slice(0, match.index)}\\x1b_G${controls.join(\",\")};${line.slice(match.index + match[0].length)}`;\n}\n\nexport function calculateImageCellSize(\n\timageDimensions: ImageDimensions,\n\tmaxWidthCells: number,\n\tmaxHeightCells?: number,\n\tcellDimensions: CellDimensions = { widthPx: 9, heightPx: 18 },\n): ImageCellSize {\n\tconst maxWidth = Math.max(1, Math.floor(maxWidthCells));\n\tconst maxHeight = maxHeightCells === undefined ? undefined : Math.max(1, Math.floor(maxHeightCells));\n\tconst imageWidth = Math.max(1, imageDimensions.widthPx);\n\tconst imageHeight = Math.max(1, imageDimensions.heightPx);\n\n\tconst widthScale = (maxWidth * cellDimensions.widthPx) / imageWidth;\n\tconst heightScale = maxHeight === undefined ? widthScale : (maxHeight * cellDimensions.heightPx) / imageHeight;\n\tconst scale = Math.min(widthScale, heightScale);\n\n\tconst scaledWidthPx = imageWidth * scale;\n\tconst scaledHeightPx = imageHeight * scale;\n\tconst columns = Math.ceil(scaledWidthPx / cellDimensions.widthPx);\n\tconst rows = Math.ceil(scaledHeightPx / cellDimensions.heightPx);\n\n\treturn {\n\t\tcolumns: Math.max(1, Math.min(maxWidth, columns)),\n\t\trows: Math.max(1, maxHeight === undefined ? rows : Math.min(maxHeight, rows)),\n\t};\n}\n\nexport function getPngDimensions(base64Data: string): ImageDimensions | null {\n\ttry {\n\t\tconst buffer = Buffer.from(base64Data, \"base64\");\n\n\t\tif (buffer.length < 24) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (buffer[0] !== 0x89 || buffer[1] !== 0x50 || buffer[2] !== 0x4e || buffer[3] !== 0x47) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst width = buffer.readUInt32BE(16);\n\t\tconst height = buffer.readUInt32BE(20);\n\n\t\treturn { widthPx: width, heightPx: height };\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getJpegDimensions(base64Data: string): ImageDimensions | null {\n\ttry {\n\t\tconst buffer = Buffer.from(base64Data, \"base64\");\n\n\t\tif (buffer.length < 2) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (buffer[0] !== 0xff || buffer[1] !== 0xd8) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet offset = 2;\n\t\twhile (offset < buffer.length - 9) {\n\t\t\tif (buffer[offset] !== 0xff) {\n\t\t\t\toffset++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst marker = buffer[offset + 1];\n\n\t\t\tif (marker >= 0xc0 && marker <= 0xc2) {\n\t\t\t\tconst height = buffer.readUInt16BE(offset + 5);\n\t\t\t\tconst width = buffer.readUInt16BE(offset + 7);\n\t\t\t\treturn { widthPx: width, heightPx: height };\n\t\t\t}\n\n\t\t\tif (offset + 3 >= buffer.length) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst length = buffer.readUInt16BE(offset + 2);\n\t\t\tif (length < 2) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\toffset += 2 + length;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getGifDimensions(base64Data: string): ImageDimensions | null {\n\ttry {\n\t\tconst buffer = Buffer.from(base64Data, \"base64\");\n\n\t\tif (buffer.length < 10) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst sig = buffer.subarray(0, 6).toString(\"ascii\");\n\t\tif (sig !== \"GIF87a\" && sig !== \"GIF89a\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst width = buffer.readUInt16LE(6);\n\t\tconst height = buffer.readUInt16LE(8);\n\n\t\treturn { widthPx: width, heightPx: height };\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getWebpDimensions(base64Data: string): ImageDimensions | null {\n\ttry {\n\t\tconst buffer = Buffer.from(base64Data, \"base64\");\n\n\t\tif (buffer.length < 30) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst riff = buffer.subarray(0, 4).toString(\"ascii\");\n\t\tconst webp = buffer.subarray(8, 12).toString(\"ascii\");\n\t\tif (riff !== \"RIFF\" || webp !== \"WEBP\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst chunk = buffer.subarray(12, 16).toString(\"ascii\");\n\t\tif (chunk === \"VP8 \") {\n\t\t\tif (buffer.length < 30) return null;\n\t\t\tconst width = buffer.readUInt16LE(26) & 0x3fff;\n\t\t\tconst height = buffer.readUInt16LE(28) & 0x3fff;\n\t\t\treturn { widthPx: width, heightPx: height };\n\t\t} else if (chunk === \"VP8L\") {\n\t\t\tif (buffer.length < 25) return null;\n\t\t\tconst bits = buffer.readUInt32LE(21);\n\t\t\tconst width = (bits & 0x3fff) + 1;\n\t\t\tconst height = ((bits >> 14) & 0x3fff) + 1;\n\t\t\treturn { widthPx: width, heightPx: height };\n\t\t} else if (chunk === \"VP8X\") {\n\t\t\tif (buffer.length < 30) return null;\n\t\t\tconst width = (buffer[24] | (buffer[25] << 8) | (buffer[26] << 16)) + 1;\n\t\t\tconst height = (buffer[27] | (buffer[28] << 8) | (buffer[29] << 16)) + 1;\n\t\t\treturn { widthPx: width, heightPx: height };\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getImageDimensions(base64Data: string, mimeType: string): ImageDimensions | null {\n\tif (mimeType === \"image/png\") {\n\t\treturn getPngDimensions(base64Data);\n\t}\n\tif (mimeType === \"image/jpeg\") {\n\t\treturn getJpegDimensions(base64Data);\n\t}\n\tif (mimeType === \"image/gif\") {\n\t\treturn getGifDimensions(base64Data);\n\t}\n\tif (mimeType === \"image/webp\") {\n\t\treturn getWebpDimensions(base64Data);\n\t}\n\treturn null;\n}\n\nexport function renderImage(\n\tbase64Data: string,\n\timageDimensions: ImageDimensions,\n\toptions: ImageRenderOptions = {},\n): { sequence: string; columns: number; rows: number; imageId?: number; lines?: string[] } | null {\n\tconst caps = getCapabilities();\n\n\tif (!caps.images) {\n\t\treturn null;\n\t}\n\n\tconst maxWidth = options.maxWidthCells ?? 80;\n\tconst size = calculateImageCellSize(imageDimensions, maxWidth, options.maxHeightCells, getCellDimensions());\n\n\tif (caps.images === \"kitty\" && caps.kittyUnicodePlaceholders) {\n\t\t// Virtual placement: transmit once, then show the image with plain-text\n\t\t// placeholder cells. Under tmux the placeholder cells move/clip with the\n\t\t// pane, so split layouts render correctly.\n\t\tconst imageId = options.imageId ?? allocateImageId();\n\t\tconst columns = Math.min(size.columns, KITTY_PLACEHOLDER_MAX);\n\t\tconst rows = Math.min(size.rows, KITTY_PLACEHOLDER_MAX);\n\t\tconst sequence = encodeKitty(base64Data, { columns, rows, imageId, virtual: true });\n\t\tconst lines: string[] = [];\n\t\tfor (let row = 0; row < rows; row++) {\n\t\t\tconst placeholderRow = buildKittyPlaceholderRow(imageId, row, columns);\n\t\t\tlines.push(row === 0 ? sequence + placeholderRow : placeholderRow);\n\t\t}\n\t\treturn { sequence, columns, rows, imageId, lines };\n\t}\n\n\tif (caps.images === \"kitty\") {\n\t\tif (options.imageId !== undefined) {\n\t\t\tregisterKittyImageMetadata({\n\t\t\t\timageId: options.imageId,\n\t\t\t\tcolumns: size.columns,\n\t\t\t\trows: size.rows,\n\t\t\t\twidthPx: imageDimensions.widthPx,\n\t\t\t\theightPx: imageDimensions.heightPx,\n\t\t\t});\n\t\t}\n\t\tconst sequence = encodeKitty(base64Data, {\n\t\t\tcolumns: size.columns,\n\t\t\trows: size.rows,\n\t\t\timageId: options.imageId,\n\t\t\tmoveCursor: options.moveCursor,\n\t\t});\n\t\treturn { sequence, columns: size.columns, rows: size.rows, imageId: options.imageId };\n\t}\n\n\tif (caps.images === \"iterm2\") {\n\t\tconst sequence = encodeITerm2(base64Data, {\n\t\t\twidth: size.columns,\n\t\t\theight: \"auto\",\n\t\t\tpreserveAspectRatio: options.preserveAspectRatio ?? true,\n\t\t});\n\t\treturn { sequence, columns: size.columns, rows: size.rows };\n\t}\n\n\treturn null;\n}\n\n/**\n * Wrap text in an OSC 8 hyperlink sequence.\n * The text is rendered as a clickable hyperlink in terminals that support OSC 8\n * (Ghostty, Kitty, WezTerm, iTerm2, VSCode, and others).\n * In terminals that do not support OSC 8, the escape sequences are ignored\n * and only the plain text is displayed.\n *\n * @param text - The visible text to display\n * @param url - The URL to link to\n */\nexport function hyperlink(text: string, url: string): string {\n\treturn `\\x1b]8;;${url}\\x1b\\\\${text}\\x1b]8;;\\x1b\\\\`;\n}\n\nexport function imageFallback(mimeType: string, dimensions?: ImageDimensions, filename?: string): string {\n\tconst parts: string[] = [];\n\tif (filename) {\n\t\tconst sanitized = sanitizeTerminalLabel(filename);\n\t\tconst display = shortenImagePath(sanitized);\n\t\tparts.push(\n\t\t\tgetCapabilities().hyperlinks && isAbsolute(sanitized)\n\t\t\t\t? hyperlink(display, pathToFileURL(sanitized).href)\n\t\t\t\t: display,\n\t\t);\n\t}\n\tparts.push(`[${sanitizeTerminalLabel(mimeType)}]`);\n\tif (dimensions) parts.push(`${dimensions.widthPx}x${dimensions.heightPx}`);\n\treturn `[Image: ${parts.join(\" \")}]`;\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { ImageDimensions } from "./terminal-image.ts";
2
2
  export declare function sanitizeTerminalLabel(value: string): string;
3
+ export declare function shortenImagePath(filename: string): string;
3
4
  export declare function imageFallback(mimeType: string, dimensions?: ImageDimensions, filename?: string): string;
4
5
  //# sourceMappingURL=terminal-text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-text.d.ts","sourceRoot":"","sources":["../src/terminal-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAMvG"}
1
+ {"version":3,"file":"terminal-text.d.ts","sourceRoot":"","sources":["../src/terminal-text.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CASvG"}
@@ -1,3 +1,4 @@
1
+ import { homedir } from "node:os";
1
2
  const TERMINAL_ESCAPE_PATTERN = /(?:\u001B\][\s\S]*?(?:\u0007|\u001B\\|\u009C))|[\u001B\u009B][[\]()#;?]*(?:\d{1,4}(?:[;:]\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]/g;
2
3
  export function sanitizeTerminalLabel(value) {
3
4
  return value
@@ -6,10 +7,19 @@ export function sanitizeTerminalLabel(value) {
6
7
  .replace(/\s+/g, " ")
7
8
  .trim();
8
9
  }
10
+ export function shortenImagePath(filename) {
11
+ const home = homedir();
12
+ if (home && (filename === home || filename.startsWith(`${home}/`) || filename.startsWith(`${home}\\`))) {
13
+ return `~${filename.slice(home.length)}`;
14
+ }
15
+ return filename;
16
+ }
9
17
  export function imageFallback(mimeType, dimensions, filename) {
10
18
  const parts = [];
11
- if (filename)
12
- parts.push(sanitizeTerminalLabel(filename));
19
+ if (filename) {
20
+ const sanitized = sanitizeTerminalLabel(filename);
21
+ parts.push(shortenImagePath(sanitized));
22
+ }
13
23
  parts.push(`[${sanitizeTerminalLabel(mimeType)}]`);
14
24
  if (dimensions)
15
25
  parts.push(`${dimensions.widthPx}x${dimensions.heightPx}`);
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-text.js","sourceRoot":"","sources":["../src/terminal-text.ts"],"names":[],"mappings":"AAEA,MAAM,uBAAuB,GAC5B,8HAA8H,CAAC;AAEhI,MAAM,UAAU,qBAAqB,CAAC,KAAa;IAClD,OAAO,KAAK;SACV,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC;SACpC,OAAO,CAAC,gCAAgC,EAAE,GAAG,CAAC;SAC9C,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACV,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,UAA4B,EAAE,QAAiB;IAC9F,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1D,KAAK,CAAC,IAAI,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3E,OAAO,WAAW,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACtC,CAAC","sourcesContent":["import type { ImageDimensions } from \"./terminal-image.ts\";\n\nconst TERMINAL_ESCAPE_PATTERN =\n\t/(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\\\|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]/g;\n\nexport function sanitizeTerminalLabel(value: string): string {\n\treturn value\n\t\t.replace(TERMINAL_ESCAPE_PATTERN, \"\")\n\t\t.replace(/[\\u0000-\\u001f\\u007f-\\u009f]+/g, \" \")\n\t\t.replace(/\\s+/g, \" \")\n\t\t.trim();\n}\n\nexport function imageFallback(mimeType: string, dimensions?: ImageDimensions, filename?: string): string {\n\tconst parts: string[] = [];\n\tif (filename) parts.push(sanitizeTerminalLabel(filename));\n\tparts.push(`[${sanitizeTerminalLabel(mimeType)}]`);\n\tif (dimensions) parts.push(`${dimensions.widthPx}x${dimensions.heightPx}`);\n\treturn `[Image: ${parts.join(\" \")}]`;\n}\n"]}
1
+ {"version":3,"file":"terminal-text.js","sourceRoot":"","sources":["../src/terminal-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,MAAM,uBAAuB,GAC5B,8HAA8H,CAAC;AAEhI,MAAM,UAAU,qBAAqB,CAAC,KAAa;IAClD,OAAO,KAAK;SACV,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC;SACpC,OAAO,CAAC,gCAAgC,EAAE,GAAG,CAAC;SAC9C,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACV,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAChD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC;QACxG,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,UAA4B,EAAE,QAAiB;IAC9F,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,QAAQ,EAAE,CAAC;QACd,MAAM,SAAS,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAClD,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3E,OAAO,WAAW,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACtC,CAAC","sourcesContent":["import { homedir } from \"node:os\";\nimport type { ImageDimensions } from \"./terminal-image.ts\";\n\nconst TERMINAL_ESCAPE_PATTERN =\n\t/(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\\\|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]/g;\n\nexport function sanitizeTerminalLabel(value: string): string {\n\treturn value\n\t\t.replace(TERMINAL_ESCAPE_PATTERN, \"\")\n\t\t.replace(/[\\u0000-\\u001f\\u007f-\\u009f]+/g, \" \")\n\t\t.replace(/\\s+/g, \" \")\n\t\t.trim();\n}\n\nexport function shortenImagePath(filename: string): string {\n\tconst home = homedir();\n\tif (home && (filename === home || filename.startsWith(`${home}/`) || filename.startsWith(`${home}\\\\`))) {\n\t\treturn `~${filename.slice(home.length)}`;\n\t}\n\treturn filename;\n}\n\nexport function imageFallback(mimeType: string, dimensions?: ImageDimensions, filename?: string): string {\n\tconst parts: string[] = [];\n\tif (filename) {\n\t\tconst sanitized = sanitizeTerminalLabel(filename);\n\t\tparts.push(shortenImagePath(sanitized));\n\t}\n\tparts.push(`[${sanitizeTerminalLabel(mimeType)}]`);\n\tif (dimensions) parts.push(`${dimensions.widthPx}x${dimensions.heightPx}`);\n\treturn `[Image: ${parts.join(\" \")}]`;\n}\n"]}
@@ -30,11 +30,11 @@ export interface Component {
30
30
  invalidate(): void;
31
31
  dispose?(): void;
32
32
  }
33
- type InputListenerResult = {
33
+ export type TuiInputListenerResult = {
34
34
  consume?: boolean;
35
35
  data?: string;
36
36
  } | undefined;
37
- type InputListener = (data: string) => InputListenerResult;
37
+ export type TuiInputListener = (data: string) => TuiInputListenerResult;
38
38
  interface ViewportRenderStats {
39
39
  readonly lastNormalizedLines: number;
40
40
  readonly lastKittyImageScannedLines: number;
@@ -159,10 +159,15 @@ export declare class Container implements Component {
159
159
  invalidate(): void;
160
160
  render(width: number): string[];
161
161
  }
162
- /**
163
- * TUI - Main class for managing terminal UI with differential rendering
164
- */
165
- export declare class TUI extends Container {
162
+ /** Composite overlay content into a terminal line at a fixed column. */
163
+ export declare function compositeTuiLine(baseLine: string, overlayLine: string, startCol: number, overlayWidth: number, totalWidth: number): string;
164
+ export declare const VIEWPORT_TUI: unique symbol;
165
+ export interface ViewportTUI extends TUI {
166
+ readonly [VIEWPORT_TUI]: true;
167
+ setLayoutRoot(component: Component | undefined): void;
168
+ }
169
+ export declare function isViewportTUI(tui: TUI): tui is ViewportTUI;
170
+ export declare abstract class TuiBase extends Container {
166
171
  #private;
167
172
  terminal: Terminal;
168
173
  private previousLines;
@@ -185,18 +190,25 @@ export declare class TUI extends Container {
185
190
  private clearOnShrink;
186
191
  private maxLinesRendered;
187
192
  private previousViewportTop;
188
- private fullRedrawCount;
193
+ protected fullRedrawCount: number;
189
194
  private muxViewportRepaintCount;
190
195
  private overWideCrashDumpWritten;
191
- private stopped;
196
+ protected stopped: boolean;
192
197
  private pendingOsc11BackgroundReplies;
193
198
  private pendingOsc11BackgroundQueries;
194
199
  private terminalColorSchemeListeners;
195
200
  private terminalColorSchemeNotificationsEnabled;
201
+ protected readonly logDirectory: string;
196
202
  private focusOrderCounter;
197
203
  private overlayStack;
204
+ protected get hasOverlayEntries(): boolean;
198
205
  private overlayFocusRestore;
199
- constructor(terminal: Terminal, options?: boolean | TuiConstructorOptions);
206
+ constructor(terminal: Terminal, options?: boolean | TuiConstructorOptions, logDirectory?: string);
207
+ protected resetRenderState(): void;
208
+ protected beforeTerminalStart(): void;
209
+ protected afterTerminalStart(): void;
210
+ protected beforeTerminalStop(): void;
211
+ protected afterTerminalStop(): void;
200
212
  get fullRedraws(): number;
201
213
  get muxViewportRepaints(): number;
202
214
  getShowHardwareCursor(): boolean;
@@ -216,6 +228,7 @@ export declare class TUI extends Container {
216
228
  private getVisibleOverlayFocusRestore;
217
229
  private isOverlayFocusAncestor;
218
230
  private retargetOverlayPreFocus;
231
+ protected getMountedRoots(): readonly Component[];
219
232
  private isComponentMounted;
220
233
  private containsComponent;
221
234
  /**
@@ -233,8 +246,8 @@ export declare class TUI extends Container {
233
246
  private getTopmostVisibleOverlay;
234
247
  invalidate(): void;
235
248
  start(): void;
236
- addInputListener(listener: InputListener): () => void;
237
- removeInputListener(listener: InputListener): void;
249
+ addInputListener(listener: TuiInputListener): () => void;
250
+ removeInputListener(listener: TuiInputListener): void;
238
251
  onTerminalColorSchemeChange(listener: (scheme: TerminalColorScheme) => void): () => void;
239
252
  setTerminalColorSchemeNotifications(enabled: boolean): void;
240
253
  private queryCellSize;
@@ -248,7 +261,7 @@ export declare class TUI extends Container {
248
261
  setMaxRenderFps(fps: number): void;
249
262
  private scheduleRender;
250
263
  private commitExpeditedRender;
251
- private handleInput;
264
+ private handleTerminalInput;
252
265
  private consumeOsc11BackgroundResponse;
253
266
  private consumeTerminalColorSchemeReport;
254
267
  private consumeCellSizeResponse;
@@ -260,7 +273,7 @@ export declare class TUI extends Container {
260
273
  private resolveAnchorRow;
261
274
  private resolveAnchorCol;
262
275
  /** Composite all overlays into content lines (sorted by focusOrder, higher = on top). */
263
- private compositeOverlays;
276
+ protected compositeOverlays(lines: string[], termWidth: number, termHeight: number): string[];
264
277
  private static readonly SEGMENT_RESET;
265
278
  /**
266
279
  * Every frame write is bracketed by synchronized output (DECSET 2026) and
@@ -277,7 +290,8 @@ export declare class TUI extends Container {
277
290
  private static readonly FRAME_END;
278
291
  private setPreviousLines;
279
292
  private normalizeLine;
280
- private applyLineResets;
293
+ protected applyLineResets(lines: string[]): string[];
294
+ private applyLineResetResult;
281
295
  private applyViewportLineResets;
282
296
  private collectKittyImageIds;
283
297
  private deleteKittyImages;
@@ -301,8 +315,11 @@ export declare class TUI extends Container {
301
315
  * @param height - Terminal height (visible viewport size)
302
316
  * @returns Cursor position { row, col } or null if no marker found
303
317
  */
304
- private extractCursorPosition;
305
- private doRender;
318
+ protected extractCursorPosition(lines: string[], height: number): {
319
+ row: number;
320
+ col: number;
321
+ } | null;
322
+ protected doRender(): void;
306
323
  /**
307
324
  * Position the hardware cursor for IME candidate window.
308
325
  * @param cursorPos The cursor position extracted from rendered output, or null
@@ -326,4 +343,7 @@ export declare class TUI extends Container {
326
343
  timeoutMs: number;
327
344
  }): Promise<TerminalColorScheme | undefined>;
328
345
  }
346
+ /** Legacy main-screen renderer export. */
347
+ export declare class TUI extends TuiBase {
348
+ }
329
349
  //# sourceMappingURL=tui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAIN,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EAA2E,YAAY,EAAE,MAAM,YAAY,CAAC;AA0CnH;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IA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OAIG;IACH,OAAO,CAAC,sBAAsB;IAkC9B;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAqBhG;IAED;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAoBvG;CACD;AAED,0CAA0C;AAC1C,qBAAa,GAAI,SAAQ,OAAO;CAAG"}
@@ -22,20 +22,17 @@ function parseKittyImageHeader(line) {
22
22
  return undefined;
23
23
  const ids = [];
24
24
  let rows = 1;
25
- const params = line.slice(paramsStart, paramsEnd);
26
- for (const param of params.split(",")) {
25
+ for (const param of line.slice(paramsStart, paramsEnd).split(",")) {
27
26
  const [key, value] = param.split("=", 2);
28
27
  if (value === undefined)
29
28
  continue;
30
29
  const numberValue = Number(value);
31
30
  if (!Number.isInteger(numberValue) || numberValue <= 0 || numberValue > 0xffffffff)
32
31
  continue;
33
- if (key === "i") {
32
+ if (key === "i")
34
33
  ids.push(numberValue);
35
- }
36
- else if (key === "r") {
34
+ else if (key === "r")
37
35
  rows = numberValue;
38
- }
39
36
  }
40
37
  return { ids, rows };
41
38
  }
@@ -45,6 +42,9 @@ function extractKittyImageIds(line) {
45
42
  function extractKittyImageRows(line) {
46
43
  return parseKittyImageHeader(line)?.rows ?? 1;
47
44
  }
45
+ function isTermuxSession() {
46
+ return Boolean(process.env.TERMUX_VERSION);
47
+ }
48
48
  /** Type guard to check if a component implements Focusable */
49
49
  export function isFocusable(component) {
50
50
  return component !== null && "focused" in component;
@@ -186,9 +186,6 @@ function parseSizeValue(value, referenceSize) {
186
186
  }
187
187
  return undefined;
188
188
  }
189
- function isTermuxSession() {
190
- return Boolean(process.env.TERMUX_VERSION);
191
- }
192
189
  /**
193
190
  * Container - a component that contains other components
194
191
  */
@@ -258,12 +255,47 @@ export class Container {
258
255
  /**
259
256
  * TUI - Main class for managing terminal UI with differential rendering
260
257
  */
261
- export class TUI extends Container {
258
+ const SEGMENT_RESET = "\x1b[0m\x1b]8;;\x07";
259
+ /** Composite overlay content into a terminal line at a fixed column. */
260
+ export function compositeTuiLine(baseLine, overlayLine, startCol, overlayWidth, totalWidth) {
261
+ if (isImageLine(baseLine) && visibleWidth(baseLine) === 0)
262
+ return baseLine;
263
+ const placeholderIndex = baseLine.indexOf("\u{10eeee}");
264
+ const protocolEnd = placeholderIndex === -1 ? -1 : baseLine.lastIndexOf("\x1b\\", placeholderIndex);
265
+ const protocolPrefix = protocolEnd === -1 ? "" : baseLine.slice(0, protocolEnd + 2);
266
+ const afterStart = startCol + overlayWidth;
267
+ const base = extractSegments(baseLine, startCol, afterStart, totalWidth - afterStart, true);
268
+ const overlay = sliceWithWidth(overlayLine, 0, overlayWidth, true);
269
+ const beforePad = Math.max(0, startCol - base.beforeWidth);
270
+ const overlayPad = Math.max(0, overlayWidth - overlay.width);
271
+ const actualBeforeWidth = Math.max(startCol, base.beforeWidth);
272
+ const actualOverlayWidth = Math.max(overlayWidth, overlay.width);
273
+ const afterTarget = Math.max(0, totalWidth - actualBeforeWidth - actualOverlayWidth);
274
+ const afterPad = Math.max(0, afterTarget - base.afterWidth);
275
+ const result = base.before +
276
+ " ".repeat(beforePad) +
277
+ SEGMENT_RESET +
278
+ overlay.text +
279
+ " ".repeat(overlayPad) +
280
+ SEGMENT_RESET +
281
+ base.after +
282
+ " ".repeat(afterPad);
283
+ const composited = visibleWidth(result) <= totalWidth ? result : sliceByColumn(result, 0, totalWidth, true);
284
+ return protocolPrefix + composited;
285
+ }
286
+ export const VIEWPORT_TUI = Symbol.for("@earendil-works/pi-tui/viewport");
287
+ export function isViewportTUI(tui) {
288
+ return tui[VIEWPORT_TUI] === true;
289
+ }
290
+ export class TuiBase extends Container {
262
291
  /** Minimum interval between scheduled renders. Default preserves the historic ~60fps cap. */
263
292
  #minRenderIntervalMs;
264
293
  #lastCursorVisibility;
294
+ get hasOverlayEntries() {
295
+ return this.overlayStack.length > 0;
296
+ }
265
297
  #muxDetector;
266
- constructor(terminal, options) {
298
+ constructor(terminal, options, logDirectory) {
267
299
  super();
268
300
  this.previousLines = [];
269
301
  this.previousRawLines = [];
@@ -300,10 +332,16 @@ export class TUI extends Container {
300
332
  // Preserve existing positional boolean callers while allowing explicit render-policy overrides.
301
333
  const normalizedOptions = typeof options === "boolean" ? { showHardwareCursor: options } : (options ?? {});
302
334
  this.#muxDetector = normalizedOptions.muxDetector ?? isMultiplexerSession;
335
+ this.logDirectory = logDirectory ?? path.join(os.homedir(), ".senpi", "agent");
303
336
  if (normalizedOptions.showHardwareCursor !== undefined) {
304
337
  this.showHardwareCursor = normalizedOptions.showHardwareCursor;
305
338
  }
306
339
  }
340
+ resetRenderState() { }
341
+ beforeTerminalStart() { }
342
+ afterTerminalStart() { }
343
+ beforeTerminalStop() { }
344
+ afterTerminalStop() { }
307
345
  get fullRedraws() {
308
346
  return this.fullRedrawCount;
309
347
  }
@@ -433,8 +471,11 @@ export class TUI extends Container {
433
471
  }
434
472
  }
435
473
  }
474
+ getMountedRoots() {
475
+ return this.children;
476
+ }
436
477
  isComponentMounted(component) {
437
- return this.children.some((child) => this.containsComponent(child, component));
478
+ return this.getMountedRoots().some((child) => this.containsComponent(child, component));
438
479
  }
439
480
  containsComponent(root, target) {
440
481
  if (root === target)
@@ -596,7 +637,9 @@ export class TUI extends Container {
596
637
  this.renderRequested = false;
597
638
  this.inputRenderPending = false;
598
639
  this.#lastCursorVisibility = undefined;
599
- this.terminal.start((data) => this.handleInput(data), () => this.requestRender());
640
+ this.beforeTerminalStart();
641
+ this.terminal.start((data) => this.handleTerminalInput(data), () => this.requestRender());
642
+ this.afterTerminalStart();
600
643
  if (process.env.TMUX)
601
644
  this.terminal.write(ENABLE_FOCUS_REPORTING);
602
645
  this.#setCursorVisibility(false);
@@ -650,6 +693,7 @@ export class TUI extends Container {
650
693
  if (this.terminalColorSchemeNotificationsEnabled) {
651
694
  this.terminal.write("\x1b[?2031l");
652
695
  }
696
+ this.beforeTerminalStop();
653
697
  // Move cursor to the end of the content to prevent overwriting/artifacts on exit
654
698
  if (this.previousLines.length > 0) {
655
699
  // Overwrite the inverted cursor with a normal space to clear the artifact
@@ -669,6 +713,8 @@ export class TUI extends Container {
669
713
  if (process.env.TMUX)
670
714
  this.terminal.write(DISABLE_FOCUS_REPORTING);
671
715
  this.terminal.stop();
716
+ this.afterTerminalStop();
717
+ this.resetRenderState();
672
718
  this.#lastCursorVisibility = undefined;
673
719
  this.previousLines = [];
674
720
  this.previousRawLines = [];
@@ -694,6 +740,7 @@ export class TUI extends Container {
694
740
  requestRender(force = false, source = "unknown") {
695
741
  if (force) {
696
742
  this.inputRenderPending = false;
743
+ this.resetRenderState();
697
744
  this.previousLines = [];
698
745
  this.previousRawLines = [];
699
746
  this.previousWidth = -1; // -1 triggers widthChanged, forcing a full clear
@@ -773,7 +820,7 @@ export class TUI extends Container {
773
820
  this.lastRenderAt = performance.now();
774
821
  this.doRender();
775
822
  }
776
- handleInput(data) {
823
+ handleTerminalInput(data) {
777
824
  const focus = consumeTmuxFocusEvent(data);
778
825
  if (focus.event !== null) {
779
826
  resetCapabilitiesCache();
@@ -1107,7 +1154,10 @@ export class TUI extends Container {
1107
1154
  this.normalizeMemo.set(line, normalized);
1108
1155
  return { line: normalized, normalized: true };
1109
1156
  }
1110
- applyLineResets(lines, mode = "full") {
1157
+ applyLineResets(lines) {
1158
+ return this.applyLineResetResult(lines).lines;
1159
+ }
1160
+ applyLineResetResult(lines, mode = "full") {
1111
1161
  const previousMemo = this.normalizeMemo;
1112
1162
  const nextMemo = new Map();
1113
1163
  const normalizedLines = [];
@@ -1141,7 +1191,7 @@ export class TUI extends Container {
1141
1191
  this.previousLines.length === 0 ||
1142
1192
  this.previousLines.length !== rawLines.length ||
1143
1193
  this.previousRawLines.length !== rawLines.length) {
1144
- return this.applyLineResets(rawLines);
1194
+ return this.applyLineResetResult(rawLines);
1145
1195
  }
1146
1196
  const windowStart = Math.max(0, viewportTop - VIEWPORT_RENDER_OVERSCAN);
1147
1197
  const windowEnd = Math.min(rawLines.length, viewportTop + height + VIEWPORT_RENDER_OVERSCAN);
@@ -1154,7 +1204,7 @@ export class TUI extends Container {
1154
1204
  firstRawChanged = i;
1155
1205
  }
1156
1206
  if (i < windowStart || i >= windowEnd) {
1157
- return this.applyLineResets(rawLines, "escaped");
1207
+ return this.applyLineResetResult(rawLines, "escaped");
1158
1208
  }
1159
1209
  }
1160
1210
  const lines = this.previousLines.slice();
@@ -1545,8 +1595,9 @@ export class TUI extends Container {
1545
1595
  const logRedraw = (reason) => {
1546
1596
  if (!debugRedraw)
1547
1597
  return;
1548
- const logPath = path.join(os.homedir(), ".senpi", "agent", "senpi-debug.log");
1598
+ const logPath = path.join(this.logDirectory, "pi-debug.log");
1549
1599
  const msg = `[${new Date().toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
1600
+ fs.mkdirSync(path.dirname(logPath), { recursive: true });
1550
1601
  fs.appendFileSync(logPath, msg, { encoding: "utf8", mode: DIAGNOSTIC_LOG_MODE });
1551
1602
  chmodDiagnosticLogBestEffort(logPath);
1552
1603
  };
@@ -1996,4 +2047,7 @@ export class TUI extends Container {
1996
2047
  });
1997
2048
  }
1998
2049
  }
2050
+ /** Legacy main-screen renderer export. */
2051
+ export class TUI extends TuiBase {
2052
+ }
1999
2053
  //# sourceMappingURL=tui.js.map