@code-yeongyu/senpi 2026.5.20-4 → 2026.5.21

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 (794) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +4 -10
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +10 -4
  7. package/dist/config.js.map +1 -1
  8. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  9. package/dist/core/agent-session-runtime.js +2 -3
  10. package/dist/core/agent-session-runtime.js.map +1 -1
  11. package/dist/core/http-dispatcher.d.ts +21 -0
  12. package/dist/core/http-dispatcher.d.ts.map +1 -0
  13. package/dist/core/http-dispatcher.js +48 -0
  14. package/dist/core/http-dispatcher.js.map +1 -0
  15. package/dist/core/package-manager.d.ts.map +1 -1
  16. package/dist/core/package-manager.js +2 -1
  17. package/dist/core/package-manager.js.map +1 -1
  18. package/dist/core/settings-manager.d.ts +3 -0
  19. package/dist/core/settings-manager.d.ts.map +1 -1
  20. package/dist/core/settings-manager.js +20 -0
  21. package/dist/core/settings-manager.js.map +1 -1
  22. package/dist/main.d.ts.map +1 -1
  23. package/dist/main.js +2 -0
  24. package/dist/main.js.map +1 -1
  25. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  26. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  27. package/dist/modes/interactive/components/settings-selector.js +15 -0
  28. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  29. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  30. package/dist/modes/interactive/interactive-mode.js +10 -1
  31. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  32. package/dist/senpi +4 -10
  33. package/dist/utils/paths.d.ts +1 -0
  34. package/dist/utils/paths.d.ts.map +1 -1
  35. package/dist/utils/paths.js +16 -0
  36. package/dist/utils/paths.js.map +1 -1
  37. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  38. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  39. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  40. package/examples/extensions/sandbox/package-lock.json +2 -2
  41. package/examples/extensions/sandbox/package.json +2 -2
  42. package/examples/extensions/with-deps/package-lock.json +2 -2
  43. package/examples/extensions/with-deps/package.json +3 -3
  44. package/node_modules/@earendil-works/pi-agent-core/README.md +488 -0
  45. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +24 -0
  46. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -0
  47. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +610 -0
  48. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -0
  49. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +120 -0
  50. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -0
  51. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +405 -0
  52. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -0
  53. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +92 -0
  54. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
  55. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +904 -0
  56. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -0
  57. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +53 -0
  58. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
  59. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +174 -0
  60. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
  61. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +95 -0
  62. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
  63. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +533 -0
  64. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -0
  65. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +25 -0
  66. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
  67. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +131 -0
  68. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -0
  69. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +51 -0
  70. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
  71. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +486 -0
  72. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -0
  73. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +52 -0
  74. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -0
  75. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
  76. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -0
  77. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +48 -0
  78. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
  79. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +230 -0
  80. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -0
  81. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
  82. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
  83. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +101 -0
  84. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
  85. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +33 -0
  86. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
  87. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +231 -0
  88. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
  89. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
  90. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
  91. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +42 -0
  92. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +1 -0
  93. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +25 -0
  94. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
  95. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +114 -0
  96. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -0
  97. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
  98. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
  99. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +39 -0
  100. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -0
  101. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +32 -0
  102. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -0
  103. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +197 -0
  104. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -0
  105. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts +2 -0
  106. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts.map +1 -0
  107. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js +50 -0
  108. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js.map +1 -0
  109. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +44 -0
  110. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -0
  111. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +311 -0
  112. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -0
  113. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +3 -0
  114. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
  115. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
  116. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js.map +1 -0
  117. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +604 -0
  118. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -0
  119. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +103 -0
  120. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -0
  121. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +14 -0
  122. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
  123. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +126 -0
  124. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -0
  125. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +70 -0
  126. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
  127. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +290 -0
  128. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -0
  129. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +20 -0
  130. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -0
  131. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +25 -0
  132. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -0
  133. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts +3 -0
  134. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts.map +1 -0
  135. package/node_modules/@earendil-works/pi-agent-core/dist/node.js +3 -0
  136. package/node_modules/@earendil-works/pi-agent-core/dist/node.js.map +1 -0
  137. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +69 -0
  138. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -0
  139. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +278 -0
  140. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -0
  141. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +394 -0
  142. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -0
  143. package/node_modules/@earendil-works/pi-agent-core/dist/types.js +2 -0
  144. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -0
  145. package/node_modules/@earendil-works/pi-agent-core/package.json +61 -0
  146. package/node_modules/@earendil-works/pi-ai/README.md +1386 -0
  147. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +20 -0
  148. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -0
  149. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +44 -0
  150. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -0
  151. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts +5 -0
  152. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -0
  153. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js +6 -0
  154. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js.map +1 -0
  155. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts +3 -0
  156. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts.map +1 -0
  157. package/node_modules/@earendil-works/pi-ai/dist/cli.js +116 -0
  158. package/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -0
  159. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +18 -0
  160. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -0
  161. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +178 -0
  162. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -0
  163. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +10 -0
  164. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts.map +1 -0
  165. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +440 -0
  166. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -0
  167. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +442 -0
  168. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -0
  169. package/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
  170. package/node_modules/@earendil-works/pi-ai/dist/image-models.js.map +1 -0
  171. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +14 -0
  172. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -0
  173. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
  174. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -0
  175. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts +4 -0
  176. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -0
  177. package/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
  178. package/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -0
  179. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +33 -0
  180. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -0
  181. package/node_modules/@earendil-works/pi-ai/dist/index.js +21 -0
  182. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -0
  183. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +37 -0
  184. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -0
  185. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +17658 -0
  186. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -0
  187. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +16510 -0
  188. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -0
  189. package/node_modules/@earendil-works/pi-ai/dist/models.js +114 -0
  190. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -0
  191. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts +2 -0
  192. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -0
  193. package/node_modules/@earendil-works/pi-ai/dist/oauth.js +2 -0
  194. package/node_modules/@earendil-works/pi-ai/dist/oauth.js.map +1 -0
  195. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +38 -0
  196. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  197. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +787 -0
  198. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -0
  199. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +52 -0
  200. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -0
  201. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +1127 -0
  202. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -0
  203. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +15 -0
  204. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  205. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +229 -0
  206. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -0
  207. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts +13 -0
  208. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts.map +1 -0
  209. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js +26 -0
  210. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js.map +1 -0
  211. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +66 -0
  212. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -0
  213. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +401 -0
  214. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -0
  215. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts +8 -0
  216. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  217. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js +29 -0
  218. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js.map +1 -0
  219. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts +73 -0
  220. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -0
  221. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js +359 -0
  222. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -0
  223. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts +15 -0
  224. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -0
  225. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +465 -0
  226. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -0
  227. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts +13 -0
  228. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -0
  229. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js +431 -0
  230. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -0
  231. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts +3 -0
  232. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -0
  233. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +129 -0
  234. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -0
  235. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +4 -0
  236. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
  237. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  238. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -0
  239. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts +25 -0
  240. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -0
  241. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +542 -0
  242. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -0
  243. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts +30 -0
  244. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  245. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +1112 -0
  246. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -0
  247. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts +22 -0
  248. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -0
  249. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +977 -0
  250. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -0
  251. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts +3 -0
  252. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
  253. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js +10 -0
  254. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js.map +1 -0
  255. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts +19 -0
  256. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  257. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +579 -0
  258. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -0
  259. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts +13 -0
  260. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -0
  261. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +651 -0
  262. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -0
  263. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts +35 -0
  264. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts.map +1 -0
  265. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +254 -0
  266. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js.map +1 -0
  267. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +38 -0
  268. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -0
  269. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +174 -0
  270. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -0
  271. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts +16 -0
  272. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts.map +1 -0
  273. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js +186 -0
  274. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js.map +1 -0
  275. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +4 -0
  276. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts.map +1 -0
  277. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js +22 -0
  278. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js.map +1 -0
  279. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts +8 -0
  280. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -0
  281. package/node_modules/@earendil-works/pi-ai/dist/stream.js +42 -0
  282. package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -0
  283. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts +22 -0
  284. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts.map +1 -0
  285. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js +161 -0
  286. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map +1 -0
  287. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts +13 -0
  288. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts.map +1 -0
  289. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js +23 -0
  290. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js.map +1 -0
  291. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts +21 -0
  292. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts.map +1 -0
  293. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js +559 -0
  294. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js.map +1 -0
  295. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts +21 -0
  296. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts.map +1 -0
  297. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js +69 -0
  298. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js.map +1 -0
  299. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts +12 -0
  300. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts.map +1 -0
  301. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js +570 -0
  302. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js.map +1 -0
  303. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts +15 -0
  304. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts.map +1 -0
  305. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js +935 -0
  306. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js.map +1 -0
  307. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts +14 -0
  308. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts.map +1 -0
  309. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js +54 -0
  310. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js.map +1 -0
  311. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts +8 -0
  312. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts.map +1 -0
  313. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js +295 -0
  314. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js.map +1 -0
  315. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts +4 -0
  316. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts.map +1 -0
  317. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js +336 -0
  318. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js.map +1 -0
  319. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts +103 -0
  320. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts.map +1 -0
  321. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js +2 -0
  322. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js.map +1 -0
  323. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +543 -0
  324. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -0
  325. package/node_modules/@earendil-works/pi-ai/dist/types.js +2 -0
  326. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -0
  327. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
  328. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts.map +1 -0
  329. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js +25 -0
  330. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js.map +1 -0
  331. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +21 -0
  332. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -0
  333. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +81 -0
  334. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -0
  335. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts +3 -0
  336. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts.map +1 -0
  337. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js +14 -0
  338. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js.map +1 -0
  339. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts +2 -0
  340. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts.map +1 -0
  341. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +8 -0
  342. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js.map +1 -0
  343. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +16 -0
  344. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts.map +1 -0
  345. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js +113 -0
  346. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js.map +1 -0
  347. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts +10 -0
  348. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
  349. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +97 -0
  350. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -0
  351. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts +25 -0
  352. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  353. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js +335 -0
  354. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +1 -0
  355. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  356. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  357. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +292 -0
  358. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -0
  359. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts +57 -0
  360. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +1 -0
  361. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +121 -0
  362. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +1 -0
  363. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  364. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  365. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js +105 -0
  366. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js.map +1 -0
  367. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +34 -0
  368. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  369. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +385 -0
  370. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -0
  371. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts +13 -0
  372. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  373. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js +31 -0
  374. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js.map +1 -0
  375. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts +57 -0
  376. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts.map +1 -0
  377. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js +2 -0
  378. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js.map +1 -0
  379. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +56 -0
  380. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -0
  381. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +151 -0
  382. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -0
  383. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts +22 -0
  384. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  385. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js +26 -0
  386. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js.map +1 -0
  387. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts +5 -0
  388. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts.map +1 -0
  389. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js +49 -0
  390. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js.map +1 -0
  391. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +17 -0
  392. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  393. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js +21 -0
  394. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js.map +1 -0
  395. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +18 -0
  396. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -0
  397. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +281 -0
  398. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -0
  399. package/node_modules/@earendil-works/pi-ai/package.json +113 -0
  400. package/node_modules/@earendil-works/pi-tui/README.md +779 -0
  401. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +54 -0
  402. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -0
  403. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +632 -0
  404. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -0
  405. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +22 -0
  406. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -0
  407. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +104 -0
  408. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -0
  409. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
  410. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
  411. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +35 -0
  412. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +1 -0
  413. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +249 -0
  414. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -0
  415. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +1916 -0
  416. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -0
  417. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +28 -0
  418. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -0
  419. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +89 -0
  420. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -0
  421. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +37 -0
  422. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -0
  423. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +426 -0
  424. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -0
  425. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +40 -0
  426. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -0
  427. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +95 -0
  428. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -0
  429. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +90 -0
  430. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -0
  431. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +634 -0
  432. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -0
  433. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +50 -0
  434. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -0
  435. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +159 -0
  436. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -0
  437. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +50 -0
  438. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -0
  439. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +185 -0
  440. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -0
  441. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +12 -0
  442. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +1 -0
  443. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +23 -0
  444. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +1 -0
  445. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +19 -0
  446. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -0
  447. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +89 -0
  448. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -0
  449. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +13 -0
  450. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
  451. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +51 -0
  452. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +1 -0
  453. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +39 -0
  454. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +1 -0
  455. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +2 -0
  456. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +1 -0
  457. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +16 -0
  458. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -0
  459. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +110 -0
  460. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -0
  461. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +23 -0
  462. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -0
  463. package/node_modules/@earendil-works/pi-tui/dist/index.js +32 -0
  464. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -0
  465. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +193 -0
  466. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -0
  467. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +174 -0
  468. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -0
  469. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +184 -0
  470. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -0
  471. package/node_modules/@earendil-works/pi-tui/dist/keys.js +1173 -0
  472. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -0
  473. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +28 -0
  474. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +1 -0
  475. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +44 -0
  476. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +1 -0
  477. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +50 -0
  478. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
  479. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +361 -0
  480. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -0
  481. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +90 -0
  482. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -0
  483. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +336 -0
  484. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -0
  485. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +88 -0
  486. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -0
  487. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +329 -0
  488. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -0
  489. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +231 -0
  490. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -0
  491. package/node_modules/@earendil-works/pi-tui/dist/tui.js +1230 -0
  492. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -0
  493. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +17 -0
  494. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +1 -0
  495. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +25 -0
  496. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +1 -0
  497. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +79 -0
  498. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -0
  499. package/node_modules/@earendil-works/pi-tui/dist/utils.js +1031 -0
  500. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -0
  501. package/node_modules/@earendil-works/pi-tui/package.json +48 -0
  502. package/node_modules/@smithy/node-http-handler/LICENSE +201 -0
  503. package/node_modules/@smithy/node-http-handler/README.md +9 -0
  504. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +724 -0
  505. package/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
  506. package/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
  507. package/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
  508. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +216 -0
  509. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +87 -0
  510. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -0
  511. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +170 -0
  512. package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +21 -0
  513. package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +88 -0
  514. package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
  515. package/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  516. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
  517. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
  518. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +8 -0
  519. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +41 -0
  520. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +21 -0
  521. package/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
  522. package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +56 -0
  523. package/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
  524. package/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
  525. package/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
  526. package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +46 -0
  527. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +24 -0
  528. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +12 -0
  529. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +63 -0
  530. package/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +13 -0
  531. package/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +12 -0
  532. package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
  533. package/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
  534. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
  535. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
  536. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +5 -0
  537. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +6 -0
  538. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +13 -0
  539. package/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +8 -0
  540. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
  541. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
  542. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
  543. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +46 -0
  544. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +24 -0
  545. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +12 -0
  546. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +63 -0
  547. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +13 -0
  548. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +12 -0
  549. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
  550. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
  551. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
  552. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
  553. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +5 -0
  554. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +6 -0
  555. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +13 -0
  556. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +8 -0
  557. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +11 -0
  558. package/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +11 -0
  559. package/node_modules/@smithy/node-http-handler/package.json +68 -0
  560. package/node_modules/@smithy/types/LICENSE +201 -0
  561. package/node_modules/@smithy/types/README.md +115 -0
  562. package/node_modules/@smithy/types/dist-cjs/index.js +91 -0
  563. package/node_modules/@smithy/types/dist-es/abort-handler.js +1 -0
  564. package/node_modules/@smithy/types/dist-es/abort.js +1 -0
  565. package/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js +5 -0
  566. package/node_modules/@smithy/types/dist-es/auth/HttpAuthScheme.js +1 -0
  567. package/node_modules/@smithy/types/dist-es/auth/HttpAuthSchemeProvider.js +1 -0
  568. package/node_modules/@smithy/types/dist-es/auth/HttpSigner.js +1 -0
  569. package/node_modules/@smithy/types/dist-es/auth/IdentityProviderConfig.js +1 -0
  570. package/node_modules/@smithy/types/dist-es/auth/auth.js +5 -0
  571. package/node_modules/@smithy/types/dist-es/auth/index.js +6 -0
  572. package/node_modules/@smithy/types/dist-es/blob/blob-payload-input-types.js +1 -0
  573. package/node_modules/@smithy/types/dist-es/checksum.js +1 -0
  574. package/node_modules/@smithy/types/dist-es/client.js +1 -0
  575. package/node_modules/@smithy/types/dist-es/command.js +1 -0
  576. package/node_modules/@smithy/types/dist-es/connection/config.js +1 -0
  577. package/node_modules/@smithy/types/dist-es/connection/index.js +3 -0
  578. package/node_modules/@smithy/types/dist-es/connection/manager.js +1 -0
  579. package/node_modules/@smithy/types/dist-es/connection/pool.js +1 -0
  580. package/node_modules/@smithy/types/dist-es/crypto.js +1 -0
  581. package/node_modules/@smithy/types/dist-es/downlevel-ts3.4/transform/type-transform.js +1 -0
  582. package/node_modules/@smithy/types/dist-es/encode.js +1 -0
  583. package/node_modules/@smithy/types/dist-es/endpoint.js +5 -0
  584. package/node_modules/@smithy/types/dist-es/endpoints/EndpointRuleObject.js +1 -0
  585. package/node_modules/@smithy/types/dist-es/endpoints/ErrorRuleObject.js +1 -0
  586. package/node_modules/@smithy/types/dist-es/endpoints/RuleSetObject.js +1 -0
  587. package/node_modules/@smithy/types/dist-es/endpoints/TreeRuleObject.js +1 -0
  588. package/node_modules/@smithy/types/dist-es/endpoints/index.js +5 -0
  589. package/node_modules/@smithy/types/dist-es/endpoints/shared.js +1 -0
  590. package/node_modules/@smithy/types/dist-es/eventStream.js +1 -0
  591. package/node_modules/@smithy/types/dist-es/extensions/checksum.js +38 -0
  592. package/node_modules/@smithy/types/dist-es/extensions/defaultClientConfiguration.js +7 -0
  593. package/node_modules/@smithy/types/dist-es/extensions/defaultExtensionConfiguration.js +1 -0
  594. package/node_modules/@smithy/types/dist-es/extensions/index.js +3 -0
  595. package/node_modules/@smithy/types/dist-es/extensions/retry.js +1 -0
  596. package/node_modules/@smithy/types/dist-es/externals-check/browser-externals-check.js +1 -0
  597. package/node_modules/@smithy/types/dist-es/feature-ids.js +1 -0
  598. package/node_modules/@smithy/types/dist-es/http/httpHandlerInitialization.js +1 -0
  599. package/node_modules/@smithy/types/dist-es/http.js +5 -0
  600. package/node_modules/@smithy/types/dist-es/identity/apiKeyIdentity.js +1 -0
  601. package/node_modules/@smithy/types/dist-es/identity/awsCredentialIdentity.js +1 -0
  602. package/node_modules/@smithy/types/dist-es/identity/identity.js +1 -0
  603. package/node_modules/@smithy/types/dist-es/identity/index.js +4 -0
  604. package/node_modules/@smithy/types/dist-es/identity/tokenIdentity.js +1 -0
  605. package/node_modules/@smithy/types/dist-es/index.js +42 -0
  606. package/node_modules/@smithy/types/dist-es/logger.js +1 -0
  607. package/node_modules/@smithy/types/dist-es/middleware.js +1 -0
  608. package/node_modules/@smithy/types/dist-es/pagination.js +1 -0
  609. package/node_modules/@smithy/types/dist-es/profile.js +6 -0
  610. package/node_modules/@smithy/types/dist-es/response.js +1 -0
  611. package/node_modules/@smithy/types/dist-es/retry.js +1 -0
  612. package/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +1 -0
  613. package/node_modules/@smithy/types/dist-es/schema/schema.js +1 -0
  614. package/node_modules/@smithy/types/dist-es/schema/sentinels.js +1 -0
  615. package/node_modules/@smithy/types/dist-es/schema/static-schemas.js +1 -0
  616. package/node_modules/@smithy/types/dist-es/schema/traits.js +1 -0
  617. package/node_modules/@smithy/types/dist-es/serde.js +1 -0
  618. package/node_modules/@smithy/types/dist-es/shapes.js +1 -0
  619. package/node_modules/@smithy/types/dist-es/signature.js +1 -0
  620. package/node_modules/@smithy/types/dist-es/stream.js +1 -0
  621. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-common-types.js +1 -0
  622. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-input-types.js +1 -0
  623. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-output-types.js +1 -0
  624. package/node_modules/@smithy/types/dist-es/transfer.js +6 -0
  625. package/node_modules/@smithy/types/dist-es/transform/client-method-transforms.js +1 -0
  626. package/node_modules/@smithy/types/dist-es/transform/client-payload-blob-type-narrow.js +1 -0
  627. package/node_modules/@smithy/types/dist-es/transform/exact.js +1 -0
  628. package/node_modules/@smithy/types/dist-es/transform/mutable.js +1 -0
  629. package/node_modules/@smithy/types/dist-es/transform/no-undefined.js +1 -0
  630. package/node_modules/@smithy/types/dist-es/transform/type-transform.js +1 -0
  631. package/node_modules/@smithy/types/dist-es/uri.js +1 -0
  632. package/node_modules/@smithy/types/dist-es/util.js +1 -0
  633. package/node_modules/@smithy/types/dist-es/waiter.js +1 -0
  634. package/node_modules/@smithy/types/dist-types/abort-handler.d.ts +7 -0
  635. package/node_modules/@smithy/types/dist-types/abort.d.ts +50 -0
  636. package/node_modules/@smithy/types/dist-types/auth/HttpApiKeyAuth.d.ts +7 -0
  637. package/node_modules/@smithy/types/dist-types/auth/HttpAuthScheme.d.ts +49 -0
  638. package/node_modules/@smithy/types/dist-types/auth/HttpAuthSchemeProvider.d.ts +20 -0
  639. package/node_modules/@smithy/types/dist-types/auth/HttpSigner.d.ts +41 -0
  640. package/node_modules/@smithy/types/dist-types/auth/IdentityProviderConfig.d.ts +14 -0
  641. package/node_modules/@smithy/types/dist-types/auth/auth.d.ts +57 -0
  642. package/node_modules/@smithy/types/dist-types/auth/index.d.ts +6 -0
  643. package/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +40 -0
  644. package/node_modules/@smithy/types/dist-types/checksum.d.ts +63 -0
  645. package/node_modules/@smithy/types/dist-types/client.d.ts +57 -0
  646. package/node_modules/@smithy/types/dist-types/command.d.ts +28 -0
  647. package/node_modules/@smithy/types/dist-types/connection/config.d.ts +10 -0
  648. package/node_modules/@smithy/types/dist-types/connection/index.d.ts +3 -0
  649. package/node_modules/@smithy/types/dist-types/connection/manager.d.ts +34 -0
  650. package/node_modules/@smithy/types/dist-types/connection/pool.d.ts +32 -0
  651. package/node_modules/@smithy/types/dist-types/crypto.d.ts +60 -0
  652. package/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +25 -0
  653. package/node_modules/@smithy/types/dist-types/encode.d.ts +31 -0
  654. package/node_modules/@smithy/types/dist-types/endpoint.d.ts +77 -0
  655. package/node_modules/@smithy/types/dist-types/endpoints/EndpointRuleObject.d.ts +27 -0
  656. package/node_modules/@smithy/types/dist-types/endpoints/ErrorRuleObject.d.ts +10 -0
  657. package/node_modules/@smithy/types/dist-types/endpoints/RuleSetObject.d.ts +28 -0
  658. package/node_modules/@smithy/types/dist-types/endpoints/TreeRuleObject.d.ts +16 -0
  659. package/node_modules/@smithy/types/dist-types/endpoints/index.d.ts +5 -0
  660. package/node_modules/@smithy/types/dist-types/endpoints/shared.d.ts +55 -0
  661. package/node_modules/@smithy/types/dist-types/eventStream.d.ts +137 -0
  662. package/node_modules/@smithy/types/dist-types/extensions/checksum.d.ts +58 -0
  663. package/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +33 -0
  664. package/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +9 -0
  665. package/node_modules/@smithy/types/dist-types/extensions/index.d.ts +4 -0
  666. package/node_modules/@smithy/types/dist-types/extensions/retry.d.ts +18 -0
  667. package/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +35 -0
  668. package/node_modules/@smithy/types/dist-types/feature-ids.d.ts +16 -0
  669. package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +128 -0
  670. package/node_modules/@smithy/types/dist-types/http.d.ts +112 -0
  671. package/node_modules/@smithy/types/dist-types/identity/apiKeyIdentity.d.ts +14 -0
  672. package/node_modules/@smithy/types/dist-types/identity/awsCredentialIdentity.d.ts +31 -0
  673. package/node_modules/@smithy/types/dist-types/identity/identity.d.ts +15 -0
  674. package/node_modules/@smithy/types/dist-types/identity/index.d.ts +4 -0
  675. package/node_modules/@smithy/types/dist-types/identity/tokenIdentity.d.ts +14 -0
  676. package/node_modules/@smithy/types/dist-types/index.d.ts +42 -0
  677. package/node_modules/@smithy/types/dist-types/logger.d.ts +13 -0
  678. package/node_modules/@smithy/types/dist-types/middleware.d.ts +534 -0
  679. package/node_modules/@smithy/types/dist-types/pagination.d.ts +33 -0
  680. package/node_modules/@smithy/types/dist-types/profile.d.ts +30 -0
  681. package/node_modules/@smithy/types/dist-types/response.d.ts +40 -0
  682. package/node_modules/@smithy/types/dist-types/retry.d.ts +133 -0
  683. package/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +136 -0
  684. package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +230 -0
  685. package/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +65 -0
  686. package/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +82 -0
  687. package/node_modules/@smithy/types/dist-types/schema/traits.d.ts +46 -0
  688. package/node_modules/@smithy/types/dist-types/serde.d.ts +114 -0
  689. package/node_modules/@smithy/types/dist-types/shapes.d.ts +82 -0
  690. package/node_modules/@smithy/types/dist-types/signature.d.ts +155 -0
  691. package/node_modules/@smithy/types/dist-types/stream.d.ts +22 -0
  692. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +32 -0
  693. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
  694. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
  695. package/node_modules/@smithy/types/dist-types/transfer.d.ts +41 -0
  696. package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +26 -0
  697. package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +77 -0
  698. package/node_modules/@smithy/types/dist-types/transform/exact.d.ts +6 -0
  699. package/node_modules/@smithy/types/dist-types/transform/mutable.d.ts +6 -0
  700. package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +68 -0
  701. package/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +34 -0
  702. package/node_modules/@smithy/types/dist-types/ts3.4/abort-handler.d.ts +7 -0
  703. package/node_modules/@smithy/types/dist-types/ts3.4/abort.d.ts +50 -0
  704. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpApiKeyAuth.d.ts +7 -0
  705. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthScheme.d.ts +49 -0
  706. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthSchemeProvider.d.ts +20 -0
  707. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpSigner.d.ts +41 -0
  708. package/node_modules/@smithy/types/dist-types/ts3.4/auth/IdentityProviderConfig.d.ts +14 -0
  709. package/node_modules/@smithy/types/dist-types/ts3.4/auth/auth.d.ts +57 -0
  710. package/node_modules/@smithy/types/dist-types/ts3.4/auth/index.d.ts +6 -0
  711. package/node_modules/@smithy/types/dist-types/ts3.4/blob/blob-payload-input-types.d.ts +40 -0
  712. package/node_modules/@smithy/types/dist-types/ts3.4/checksum.d.ts +63 -0
  713. package/node_modules/@smithy/types/dist-types/ts3.4/client.d.ts +57 -0
  714. package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +28 -0
  715. package/node_modules/@smithy/types/dist-types/ts3.4/connection/config.d.ts +10 -0
  716. package/node_modules/@smithy/types/dist-types/ts3.4/connection/index.d.ts +3 -0
  717. package/node_modules/@smithy/types/dist-types/ts3.4/connection/manager.d.ts +34 -0
  718. package/node_modules/@smithy/types/dist-types/ts3.4/connection/pool.d.ts +32 -0
  719. package/node_modules/@smithy/types/dist-types/ts3.4/crypto.d.ts +60 -0
  720. package/node_modules/@smithy/types/dist-types/ts3.4/downlevel-ts3.4/transform/type-transform.d.ts +41 -0
  721. package/node_modules/@smithy/types/dist-types/ts3.4/encode.d.ts +31 -0
  722. package/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +77 -0
  723. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointRuleObject.d.ts +27 -0
  724. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/ErrorRuleObject.d.ts +10 -0
  725. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/RuleSetObject.d.ts +28 -0
  726. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/TreeRuleObject.d.ts +16 -0
  727. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/index.d.ts +5 -0
  728. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/shared.d.ts +55 -0
  729. package/node_modules/@smithy/types/dist-types/ts3.4/eventStream.d.ts +137 -0
  730. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/checksum.d.ts +58 -0
  731. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultClientConfiguration.d.ts +33 -0
  732. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultExtensionConfiguration.d.ts +9 -0
  733. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/index.d.ts +4 -0
  734. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/retry.d.ts +18 -0
  735. package/node_modules/@smithy/types/dist-types/ts3.4/externals-check/browser-externals-check.d.ts +35 -0
  736. package/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +16 -0
  737. package/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +128 -0
  738. package/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +112 -0
  739. package/node_modules/@smithy/types/dist-types/ts3.4/identity/apiKeyIdentity.d.ts +14 -0
  740. package/node_modules/@smithy/types/dist-types/ts3.4/identity/awsCredentialIdentity.d.ts +31 -0
  741. package/node_modules/@smithy/types/dist-types/ts3.4/identity/identity.d.ts +15 -0
  742. package/node_modules/@smithy/types/dist-types/ts3.4/identity/index.d.ts +4 -0
  743. package/node_modules/@smithy/types/dist-types/ts3.4/identity/tokenIdentity.d.ts +14 -0
  744. package/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +42 -0
  745. package/node_modules/@smithy/types/dist-types/ts3.4/logger.d.ts +13 -0
  746. package/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +534 -0
  747. package/node_modules/@smithy/types/dist-types/ts3.4/pagination.d.ts +33 -0
  748. package/node_modules/@smithy/types/dist-types/ts3.4/profile.d.ts +30 -0
  749. package/node_modules/@smithy/types/dist-types/ts3.4/response.d.ts +40 -0
  750. package/node_modules/@smithy/types/dist-types/ts3.4/retry.d.ts +133 -0
  751. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +142 -0
  752. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +245 -0
  753. package/node_modules/@smithy/types/dist-types/ts3.4/schema/sentinels.d.ts +65 -0
  754. package/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +101 -0
  755. package/node_modules/@smithy/types/dist-types/ts3.4/schema/traits.d.ts +46 -0
  756. package/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +114 -0
  757. package/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +82 -0
  758. package/node_modules/@smithy/types/dist-types/ts3.4/signature.d.ts +155 -0
  759. package/node_modules/@smithy/types/dist-types/ts3.4/stream.d.ts +22 -0
  760. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-common-types.d.ts +32 -0
  761. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
  762. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
  763. package/node_modules/@smithy/types/dist-types/ts3.4/transfer.d.ts +41 -0
  764. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +26 -0
  765. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +81 -0
  766. package/node_modules/@smithy/types/dist-types/ts3.4/transform/exact.d.ts +14 -0
  767. package/node_modules/@smithy/types/dist-types/ts3.4/transform/mutable.d.ts +6 -0
  768. package/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +88 -0
  769. package/node_modules/@smithy/types/dist-types/ts3.4/transform/type-transform.d.ts +41 -0
  770. package/node_modules/@smithy/types/dist-types/ts3.4/uri.d.ts +17 -0
  771. package/node_modules/@smithy/types/dist-types/ts3.4/util.d.ts +192 -0
  772. package/node_modules/@smithy/types/dist-types/ts3.4/waiter.d.ts +35 -0
  773. package/node_modules/@smithy/types/dist-types/uri.d.ts +17 -0
  774. package/node_modules/@smithy/types/dist-types/util.d.ts +176 -0
  775. package/node_modules/@smithy/types/dist-types/waiter.d.ts +35 -0
  776. package/node_modules/@smithy/types/package.json +61 -0
  777. package/node_modules/marked/LICENSE.md +44 -0
  778. package/node_modules/marked/README.md +106 -0
  779. package/node_modules/marked/bin/main.js +282 -0
  780. package/node_modules/marked/bin/marked.js +15 -0
  781. package/node_modules/marked/lib/marked.cjs +2211 -0
  782. package/node_modules/marked/lib/marked.cjs.map +7 -0
  783. package/node_modules/marked/lib/marked.d.cts +728 -0
  784. package/node_modules/marked/lib/marked.d.ts +728 -0
  785. package/node_modules/marked/lib/marked.esm.js +2189 -0
  786. package/node_modules/marked/lib/marked.esm.js.map +7 -0
  787. package/node_modules/marked/lib/marked.umd.js +2213 -0
  788. package/node_modules/marked/lib/marked.umd.js.map +7 -0
  789. package/node_modules/marked/man/marked.1 +111 -0
  790. package/node_modules/marked/man/marked.1.md +92 -0
  791. package/node_modules/marked/marked.min.js +69 -0
  792. package/node_modules/marked/package.json +111 -0
  793. package/npm-shrinkwrap.json +1841 -0
  794. package/package.json +49 -31
@@ -0,0 +1,1230 @@
1
+ /**
2
+ * Minimal TUI implementation with differential rendering
3
+ */
4
+ import * as fs from "node:fs";
5
+ import * as os from "node:os";
6
+ import * as path from "node:path";
7
+ import { performance } from "node:perf_hooks";
8
+ import { isKeyRelease, matchesKey } from "./keys.js";
9
+ import { deleteKittyImage, getCapabilities, isImageLine, setCellDimensions } from "./terminal-image.js";
10
+ import { extractSegments, normalizeTerminalOutput, sliceByColumn, sliceWithWidth, visibleWidth } from "./utils.js";
11
+ const KITTY_SEQUENCE_PREFIX = "\x1b_G";
12
+ function extractKittyImageIds(line) {
13
+ const sequenceStart = line.indexOf(KITTY_SEQUENCE_PREFIX);
14
+ if (sequenceStart === -1)
15
+ return [];
16
+ const paramsStart = sequenceStart + KITTY_SEQUENCE_PREFIX.length;
17
+ const paramsEnd = line.indexOf(";", paramsStart);
18
+ if (paramsEnd === -1)
19
+ return [];
20
+ const params = line.slice(paramsStart, paramsEnd);
21
+ for (const param of params.split(",")) {
22
+ const [key, value] = param.split("=", 2);
23
+ if (key !== "i" || value === undefined)
24
+ continue;
25
+ const id = Number(value);
26
+ if (Number.isInteger(id) && id > 0 && id <= 0xffffffff) {
27
+ return [id];
28
+ }
29
+ }
30
+ return [];
31
+ }
32
+ /** Type guard to check if a component implements Focusable */
33
+ export function isFocusable(component) {
34
+ return component !== null && "focused" in component;
35
+ }
36
+ /**
37
+ * Cursor position marker - APC (Application Program Command) sequence.
38
+ * This is a zero-width escape sequence that terminals ignore.
39
+ * Components emit this at the cursor position when focused.
40
+ * TUI finds and strips this marker, then positions the hardware cursor there.
41
+ */
42
+ export const CURSOR_MARKER = "\x1b_pi:c\x07";
43
+ export { visibleWidth };
44
+ /** Parse a SizeValue into absolute value given a reference size */
45
+ function parseSizeValue(value, referenceSize) {
46
+ if (value === undefined)
47
+ return undefined;
48
+ if (typeof value === "number")
49
+ return value;
50
+ // Parse percentage string like "50%"
51
+ const match = value.match(/^(\d+(?:\.\d+)?)%$/);
52
+ if (match) {
53
+ return Math.floor((referenceSize * parseFloat(match[1])) / 100);
54
+ }
55
+ return undefined;
56
+ }
57
+ function isTermuxSession() {
58
+ return Boolean(process.env.TERMUX_VERSION);
59
+ }
60
+ /**
61
+ * Container - a component that contains other components
62
+ */
63
+ export class Container {
64
+ children = [];
65
+ addChild(component) {
66
+ this.children.push(component);
67
+ }
68
+ removeChild(component) {
69
+ const index = this.children.indexOf(component);
70
+ if (index !== -1) {
71
+ this.children.splice(index, 1);
72
+ }
73
+ }
74
+ clear() {
75
+ this.children = [];
76
+ }
77
+ invalidate() {
78
+ for (const child of this.children) {
79
+ child.invalidate?.();
80
+ }
81
+ }
82
+ render(width) {
83
+ const lines = [];
84
+ for (const child of this.children) {
85
+ const childLines = child.render(width);
86
+ for (const line of childLines) {
87
+ lines.push(line);
88
+ }
89
+ }
90
+ return lines;
91
+ }
92
+ }
93
+ /**
94
+ * TUI - Main class for managing terminal UI with differential rendering
95
+ */
96
+ export class TUI extends Container {
97
+ terminal;
98
+ previousLines = [];
99
+ previousKittyImageIds = new Set();
100
+ previousWidth = 0;
101
+ previousHeight = 0;
102
+ focusedComponent = null;
103
+ inputListeners = new Set();
104
+ /** Global callback for debug key (Shift+Ctrl+D). Called before input is forwarded to focused component. */
105
+ onDebug;
106
+ renderRequested = false;
107
+ renderTimer;
108
+ lastRenderAt = 0;
109
+ static MIN_RENDER_INTERVAL_MS = 16;
110
+ cursorRow = 0; // Logical cursor row (end of rendered content)
111
+ hardwareCursorRow = 0; // Actual terminal cursor row (may differ due to IME positioning)
112
+ showHardwareCursor = process.env.PI_HARDWARE_CURSOR === "1";
113
+ clearOnShrink = process.env.PI_CLEAR_ON_SHRINK === "1"; // Clear empty rows when content shrinks (default: off)
114
+ maxLinesRendered = 0; // Track terminal's working area (max lines ever rendered)
115
+ previousViewportTop = 0; // Track previous viewport top for resize-aware cursor moves
116
+ fullRedrawCount = 0;
117
+ stopped = false;
118
+ // Overlay stack for modal components rendered on top of base content
119
+ focusOrderCounter = 0;
120
+ overlayStack = [];
121
+ constructor(terminal, showHardwareCursor) {
122
+ super();
123
+ this.terminal = terminal;
124
+ if (showHardwareCursor !== undefined) {
125
+ this.showHardwareCursor = showHardwareCursor;
126
+ }
127
+ }
128
+ get fullRedraws() {
129
+ return this.fullRedrawCount;
130
+ }
131
+ getShowHardwareCursor() {
132
+ return this.showHardwareCursor;
133
+ }
134
+ setShowHardwareCursor(enabled) {
135
+ if (this.showHardwareCursor === enabled)
136
+ return;
137
+ this.showHardwareCursor = enabled;
138
+ if (!enabled) {
139
+ this.terminal.hideCursor();
140
+ }
141
+ this.requestRender();
142
+ }
143
+ getClearOnShrink() {
144
+ return this.clearOnShrink;
145
+ }
146
+ /**
147
+ * Set whether to trigger full re-render when content shrinks.
148
+ * When true (default), empty rows are cleared when content shrinks.
149
+ * When false, empty rows remain (reduces redraws on slower terminals).
150
+ */
151
+ setClearOnShrink(enabled) {
152
+ this.clearOnShrink = enabled;
153
+ }
154
+ setFocus(component) {
155
+ // Clear focused flag on old component
156
+ if (isFocusable(this.focusedComponent)) {
157
+ this.focusedComponent.focused = false;
158
+ }
159
+ this.focusedComponent = component;
160
+ // Set focused flag on new component
161
+ if (isFocusable(component)) {
162
+ component.focused = true;
163
+ }
164
+ }
165
+ /**
166
+ * Show an overlay component with configurable positioning and sizing.
167
+ * Returns a handle to control the overlay's visibility.
168
+ */
169
+ showOverlay(component, options) {
170
+ const entry = {
171
+ component,
172
+ options,
173
+ preFocus: this.focusedComponent,
174
+ hidden: false,
175
+ focusOrder: ++this.focusOrderCounter,
176
+ };
177
+ this.overlayStack.push(entry);
178
+ // Only focus if overlay is actually visible
179
+ if (!options?.nonCapturing && this.isOverlayVisible(entry)) {
180
+ this.setFocus(component);
181
+ }
182
+ this.terminal.hideCursor();
183
+ this.requestRender();
184
+ // Return handle for controlling this overlay
185
+ return {
186
+ hide: () => {
187
+ const index = this.overlayStack.indexOf(entry);
188
+ if (index !== -1) {
189
+ this.overlayStack.splice(index, 1);
190
+ // Restore focus if this overlay had focus
191
+ if (this.focusedComponent === component) {
192
+ const topVisible = this.getTopmostVisibleOverlay();
193
+ this.setFocus(topVisible?.component ?? entry.preFocus);
194
+ }
195
+ if (this.overlayStack.length === 0)
196
+ this.terminal.hideCursor();
197
+ this.requestRender();
198
+ }
199
+ },
200
+ setHidden: (hidden) => {
201
+ if (entry.hidden === hidden)
202
+ return;
203
+ entry.hidden = hidden;
204
+ // Update focus when hiding/showing
205
+ if (hidden) {
206
+ // If this overlay had focus, move focus to next visible or preFocus
207
+ if (this.focusedComponent === component) {
208
+ const topVisible = this.getTopmostVisibleOverlay();
209
+ this.setFocus(topVisible?.component ?? entry.preFocus);
210
+ }
211
+ }
212
+ else {
213
+ // Restore focus to this overlay when showing (if it's actually visible)
214
+ if (!options?.nonCapturing && this.isOverlayVisible(entry)) {
215
+ entry.focusOrder = ++this.focusOrderCounter;
216
+ this.setFocus(component);
217
+ }
218
+ }
219
+ this.requestRender();
220
+ },
221
+ isHidden: () => entry.hidden,
222
+ focus: () => {
223
+ if (!this.overlayStack.includes(entry) || !this.isOverlayVisible(entry))
224
+ return;
225
+ if (this.focusedComponent !== component) {
226
+ this.setFocus(component);
227
+ }
228
+ entry.focusOrder = ++this.focusOrderCounter;
229
+ this.requestRender();
230
+ },
231
+ unfocus: () => {
232
+ if (this.focusedComponent !== component)
233
+ return;
234
+ const topVisible = this.getTopmostVisibleOverlay();
235
+ this.setFocus(topVisible && topVisible !== entry ? topVisible.component : entry.preFocus);
236
+ this.requestRender();
237
+ },
238
+ isFocused: () => this.focusedComponent === component,
239
+ };
240
+ }
241
+ /** Hide the topmost overlay and restore previous focus. */
242
+ hideOverlay() {
243
+ const overlay = this.overlayStack.pop();
244
+ if (!overlay)
245
+ return;
246
+ if (this.focusedComponent === overlay.component) {
247
+ // Find topmost visible overlay, or fall back to preFocus
248
+ const topVisible = this.getTopmostVisibleOverlay();
249
+ this.setFocus(topVisible?.component ?? overlay.preFocus);
250
+ }
251
+ if (this.overlayStack.length === 0)
252
+ this.terminal.hideCursor();
253
+ this.requestRender();
254
+ }
255
+ /** Check if there are any visible overlays */
256
+ hasOverlay() {
257
+ return this.overlayStack.some((o) => this.isOverlayVisible(o));
258
+ }
259
+ /** Check if an overlay entry is currently visible */
260
+ isOverlayVisible(entry) {
261
+ if (entry.hidden)
262
+ return false;
263
+ if (entry.options?.visible) {
264
+ return entry.options.visible(this.terminal.columns, this.terminal.rows);
265
+ }
266
+ return true;
267
+ }
268
+ /** Find the topmost visible capturing overlay, if any */
269
+ getTopmostVisibleOverlay() {
270
+ for (let i = this.overlayStack.length - 1; i >= 0; i--) {
271
+ if (this.overlayStack[i].options?.nonCapturing)
272
+ continue;
273
+ if (this.isOverlayVisible(this.overlayStack[i])) {
274
+ return this.overlayStack[i];
275
+ }
276
+ }
277
+ return undefined;
278
+ }
279
+ invalidate() {
280
+ super.invalidate();
281
+ for (const overlay of this.overlayStack)
282
+ overlay.component.invalidate?.();
283
+ }
284
+ start() {
285
+ this.stopped = false;
286
+ this.terminal.start((data) => this.handleInput(data), () => this.requestRender());
287
+ this.terminal.hideCursor();
288
+ this.queryCellSize();
289
+ this.requestRender();
290
+ }
291
+ addInputListener(listener) {
292
+ this.inputListeners.add(listener);
293
+ return () => {
294
+ this.inputListeners.delete(listener);
295
+ };
296
+ }
297
+ removeInputListener(listener) {
298
+ this.inputListeners.delete(listener);
299
+ }
300
+ queryCellSize() {
301
+ // Only query if terminal supports images (cell size is only used for image rendering)
302
+ if (!getCapabilities().images) {
303
+ return;
304
+ }
305
+ // Query terminal for cell size in pixels: CSI 16 t
306
+ // Response format: CSI 6 ; height ; width t
307
+ this.terminal.write("\x1b[16t");
308
+ }
309
+ stop() {
310
+ this.stopped = true;
311
+ if (this.renderTimer) {
312
+ clearTimeout(this.renderTimer);
313
+ this.renderTimer = undefined;
314
+ }
315
+ // Move cursor to the end of the content to prevent overwriting/artifacts on exit
316
+ if (this.previousLines.length > 0) {
317
+ const targetRow = this.previousLines.length; // Line after the last content
318
+ const lineDiff = targetRow - this.hardwareCursorRow;
319
+ if (lineDiff > 0) {
320
+ this.terminal.write(`\x1b[${lineDiff}B`);
321
+ }
322
+ else if (lineDiff < 0) {
323
+ this.terminal.write(`\x1b[${-lineDiff}A`);
324
+ }
325
+ this.terminal.write("\r\n");
326
+ }
327
+ this.terminal.showCursor();
328
+ this.terminal.stop();
329
+ }
330
+ requestRender(force = false) {
331
+ if (force) {
332
+ this.previousLines = [];
333
+ this.previousWidth = -1; // -1 triggers widthChanged, forcing a full clear
334
+ this.previousHeight = -1; // -1 triggers heightChanged, forcing a full clear
335
+ this.cursorRow = 0;
336
+ this.hardwareCursorRow = 0;
337
+ this.maxLinesRendered = 0;
338
+ this.previousViewportTop = 0;
339
+ if (this.renderTimer) {
340
+ clearTimeout(this.renderTimer);
341
+ this.renderTimer = undefined;
342
+ }
343
+ this.renderRequested = true;
344
+ process.nextTick(() => {
345
+ if (this.stopped || !this.renderRequested) {
346
+ return;
347
+ }
348
+ this.renderRequested = false;
349
+ this.lastRenderAt = performance.now();
350
+ this.doRender();
351
+ });
352
+ return;
353
+ }
354
+ if (this.renderRequested)
355
+ return;
356
+ this.renderRequested = true;
357
+ process.nextTick(() => this.scheduleRender());
358
+ }
359
+ scheduleRender() {
360
+ if (this.stopped || this.renderTimer || !this.renderRequested) {
361
+ return;
362
+ }
363
+ const elapsed = performance.now() - this.lastRenderAt;
364
+ const delay = Math.max(0, TUI.MIN_RENDER_INTERVAL_MS - elapsed);
365
+ this.renderTimer = setTimeout(() => {
366
+ this.renderTimer = undefined;
367
+ if (this.stopped || !this.renderRequested) {
368
+ return;
369
+ }
370
+ this.renderRequested = false;
371
+ this.lastRenderAt = performance.now();
372
+ this.doRender();
373
+ if (this.renderRequested) {
374
+ this.scheduleRender();
375
+ }
376
+ }, delay);
377
+ }
378
+ handleInput(data) {
379
+ if (this.inputListeners.size > 0) {
380
+ let current = data;
381
+ for (const listener of this.inputListeners) {
382
+ const result = listener(current);
383
+ if (result?.consume) {
384
+ return;
385
+ }
386
+ if (result?.data !== undefined) {
387
+ current = result.data;
388
+ }
389
+ }
390
+ if (current.length === 0) {
391
+ return;
392
+ }
393
+ data = current;
394
+ }
395
+ // Consume terminal cell size responses without blocking unrelated input.
396
+ if (this.consumeCellSizeResponse(data)) {
397
+ return;
398
+ }
399
+ // Global debug key handler (Shift+Ctrl+D)
400
+ if (matchesKey(data, "shift+ctrl+d") && this.onDebug) {
401
+ this.onDebug();
402
+ return;
403
+ }
404
+ // If focused component is an overlay, verify it's still visible
405
+ // (visibility can change due to terminal resize or visible() callback)
406
+ const focusedOverlay = this.overlayStack.find((o) => o.component === this.focusedComponent);
407
+ if (focusedOverlay && !this.isOverlayVisible(focusedOverlay)) {
408
+ // Focused overlay is no longer visible, redirect to topmost visible overlay
409
+ const topVisible = this.getTopmostVisibleOverlay();
410
+ if (topVisible) {
411
+ this.setFocus(topVisible.component);
412
+ }
413
+ else {
414
+ // No visible overlays, restore to preFocus
415
+ this.setFocus(focusedOverlay.preFocus);
416
+ }
417
+ }
418
+ // Pass input to focused component (including Ctrl+C)
419
+ // The focused component can decide how to handle Ctrl+C
420
+ if (this.focusedComponent?.handleInput) {
421
+ // Filter out key release events unless component opts in
422
+ if (isKeyRelease(data) && !this.focusedComponent.wantsKeyRelease) {
423
+ return;
424
+ }
425
+ this.focusedComponent.handleInput(data);
426
+ this.requestRender();
427
+ }
428
+ }
429
+ consumeCellSizeResponse(data) {
430
+ // Response format: ESC [ 6 ; height ; width t
431
+ const match = data.match(/^\x1b\[6;(\d+);(\d+)t$/);
432
+ if (!match) {
433
+ return false;
434
+ }
435
+ const heightPx = parseInt(match[1], 10);
436
+ const widthPx = parseInt(match[2], 10);
437
+ if (heightPx <= 0 || widthPx <= 0) {
438
+ return true;
439
+ }
440
+ setCellDimensions({ widthPx, heightPx });
441
+ // Invalidate all components so images re-render with correct dimensions.
442
+ this.invalidate();
443
+ this.requestRender();
444
+ return true;
445
+ }
446
+ /**
447
+ * Resolve overlay layout from options.
448
+ * Returns { width, row, col, maxHeight } for rendering.
449
+ */
450
+ resolveOverlayLayout(options, overlayHeight, termWidth, termHeight) {
451
+ const opt = options ?? {};
452
+ // Parse margin (clamp to non-negative)
453
+ const margin = typeof opt.margin === "number"
454
+ ? { top: opt.margin, right: opt.margin, bottom: opt.margin, left: opt.margin }
455
+ : (opt.margin ?? {});
456
+ const marginTop = Math.max(0, margin.top ?? 0);
457
+ const marginRight = Math.max(0, margin.right ?? 0);
458
+ const marginBottom = Math.max(0, margin.bottom ?? 0);
459
+ const marginLeft = Math.max(0, margin.left ?? 0);
460
+ // Available space after margins
461
+ const availWidth = Math.max(1, termWidth - marginLeft - marginRight);
462
+ const availHeight = Math.max(1, termHeight - marginTop - marginBottom);
463
+ // === Resolve width ===
464
+ let width = parseSizeValue(opt.width, termWidth) ?? Math.min(80, availWidth);
465
+ // Apply minWidth
466
+ if (opt.minWidth !== undefined) {
467
+ width = Math.max(width, opt.minWidth);
468
+ }
469
+ // Clamp to available space
470
+ width = Math.max(1, Math.min(width, availWidth));
471
+ // === Resolve maxHeight ===
472
+ let maxHeight = parseSizeValue(opt.maxHeight, termHeight);
473
+ // Clamp to available space
474
+ if (maxHeight !== undefined) {
475
+ maxHeight = Math.max(1, Math.min(maxHeight, availHeight));
476
+ }
477
+ // Effective overlay height (may be clamped by maxHeight)
478
+ const effectiveHeight = maxHeight !== undefined ? Math.min(overlayHeight, maxHeight) : overlayHeight;
479
+ // === Resolve position ===
480
+ let row;
481
+ let col;
482
+ if (opt.row !== undefined) {
483
+ if (typeof opt.row === "string") {
484
+ // Percentage: 0% = top, 100% = bottom (overlay stays within bounds)
485
+ const match = opt.row.match(/^(\d+(?:\.\d+)?)%$/);
486
+ if (match) {
487
+ const maxRow = Math.max(0, availHeight - effectiveHeight);
488
+ const percent = parseFloat(match[1]) / 100;
489
+ row = marginTop + Math.floor(maxRow * percent);
490
+ }
491
+ else {
492
+ // Invalid format, fall back to center
493
+ row = this.resolveAnchorRow("center", effectiveHeight, availHeight, marginTop);
494
+ }
495
+ }
496
+ else {
497
+ // Absolute row position
498
+ row = opt.row;
499
+ }
500
+ }
501
+ else {
502
+ // Anchor-based (default: center)
503
+ const anchor = opt.anchor ?? "center";
504
+ row = this.resolveAnchorRow(anchor, effectiveHeight, availHeight, marginTop);
505
+ }
506
+ if (opt.col !== undefined) {
507
+ if (typeof opt.col === "string") {
508
+ // Percentage: 0% = left, 100% = right (overlay stays within bounds)
509
+ const match = opt.col.match(/^(\d+(?:\.\d+)?)%$/);
510
+ if (match) {
511
+ const maxCol = Math.max(0, availWidth - width);
512
+ const percent = parseFloat(match[1]) / 100;
513
+ col = marginLeft + Math.floor(maxCol * percent);
514
+ }
515
+ else {
516
+ // Invalid format, fall back to center
517
+ col = this.resolveAnchorCol("center", width, availWidth, marginLeft);
518
+ }
519
+ }
520
+ else {
521
+ // Absolute column position
522
+ col = opt.col;
523
+ }
524
+ }
525
+ else {
526
+ // Anchor-based (default: center)
527
+ const anchor = opt.anchor ?? "center";
528
+ col = this.resolveAnchorCol(anchor, width, availWidth, marginLeft);
529
+ }
530
+ // Apply offsets
531
+ if (opt.offsetY !== undefined)
532
+ row += opt.offsetY;
533
+ if (opt.offsetX !== undefined)
534
+ col += opt.offsetX;
535
+ // Clamp to terminal bounds (respecting margins)
536
+ row = Math.max(marginTop, Math.min(row, termHeight - marginBottom - effectiveHeight));
537
+ col = Math.max(marginLeft, Math.min(col, termWidth - marginRight - width));
538
+ return { width, row, col, maxHeight };
539
+ }
540
+ resolveAnchorRow(anchor, height, availHeight, marginTop) {
541
+ switch (anchor) {
542
+ case "top-left":
543
+ case "top-center":
544
+ case "top-right":
545
+ return marginTop;
546
+ case "bottom-left":
547
+ case "bottom-center":
548
+ case "bottom-right":
549
+ return marginTop + availHeight - height;
550
+ case "left-center":
551
+ case "center":
552
+ case "right-center":
553
+ return marginTop + Math.floor((availHeight - height) / 2);
554
+ }
555
+ }
556
+ resolveAnchorCol(anchor, width, availWidth, marginLeft) {
557
+ switch (anchor) {
558
+ case "top-left":
559
+ case "left-center":
560
+ case "bottom-left":
561
+ return marginLeft;
562
+ case "top-right":
563
+ case "right-center":
564
+ case "bottom-right":
565
+ return marginLeft + availWidth - width;
566
+ case "top-center":
567
+ case "center":
568
+ case "bottom-center":
569
+ return marginLeft + Math.floor((availWidth - width) / 2);
570
+ }
571
+ }
572
+ /** Composite all overlays into content lines (sorted by focusOrder, higher = on top). */
573
+ compositeOverlays(lines, termWidth, termHeight) {
574
+ if (this.overlayStack.length === 0)
575
+ return lines;
576
+ const result = [...lines];
577
+ // Pre-render all visible overlays and calculate positions
578
+ const rendered = [];
579
+ let minLinesNeeded = result.length;
580
+ const visibleEntries = this.overlayStack.filter((e) => this.isOverlayVisible(e));
581
+ visibleEntries.sort((a, b) => a.focusOrder - b.focusOrder);
582
+ for (const entry of visibleEntries) {
583
+ const { component, options } = entry;
584
+ // Get layout with height=0 first to determine width and maxHeight
585
+ // (width and maxHeight don't depend on overlay height)
586
+ const { width, maxHeight } = this.resolveOverlayLayout(options, 0, termWidth, termHeight);
587
+ // Render component at calculated width
588
+ let overlayLines = component.render(width);
589
+ // Apply maxHeight if specified
590
+ if (maxHeight !== undefined && overlayLines.length > maxHeight) {
591
+ overlayLines = overlayLines.slice(0, maxHeight);
592
+ }
593
+ // Get final row/col with actual overlay height
594
+ const { row, col } = this.resolveOverlayLayout(options, overlayLines.length, termWidth, termHeight);
595
+ rendered.push({ overlayLines, row, col, w: width });
596
+ minLinesNeeded = Math.max(minLinesNeeded, row + overlayLines.length);
597
+ }
598
+ // Pad to at least terminal height so overlays have screen-relative positions.
599
+ // Excludes maxLinesRendered: the historical high-water mark caused self-reinforcing
600
+ // inflation that pushed content into scrollback on terminal widen.
601
+ const workingHeight = Math.max(result.length, termHeight, minLinesNeeded);
602
+ // Extend result with empty lines if content is too short for overlay placement or working area
603
+ while (result.length < workingHeight) {
604
+ result.push("");
605
+ }
606
+ const viewportStart = Math.max(0, workingHeight - termHeight);
607
+ // Composite each overlay
608
+ for (const { overlayLines, row, col, w } of rendered) {
609
+ for (let i = 0; i < overlayLines.length; i++) {
610
+ const idx = viewportStart + row + i;
611
+ if (idx >= 0 && idx < result.length) {
612
+ // Defensive: truncate overlay line to declared width before compositing
613
+ // (components should already respect width, but this ensures it)
614
+ const truncatedOverlayLine = visibleWidth(overlayLines[i]) > w ? sliceByColumn(overlayLines[i], 0, w, true) : overlayLines[i];
615
+ result[idx] = this.compositeLineAt(result[idx], truncatedOverlayLine, col, w, termWidth);
616
+ }
617
+ }
618
+ }
619
+ return result;
620
+ }
621
+ static SEGMENT_RESET = "\x1b[0m\x1b]8;;\x07";
622
+ applyLineResets(lines) {
623
+ const reset = TUI.SEGMENT_RESET;
624
+ for (let i = 0; i < lines.length; i++) {
625
+ const line = lines[i];
626
+ if (!isImageLine(line)) {
627
+ lines[i] = normalizeTerminalOutput(line) + reset;
628
+ }
629
+ }
630
+ return lines;
631
+ }
632
+ collectKittyImageIds(lines) {
633
+ const ids = new Set();
634
+ for (const line of lines) {
635
+ for (const id of extractKittyImageIds(line)) {
636
+ ids.add(id);
637
+ }
638
+ }
639
+ return ids;
640
+ }
641
+ deleteKittyImages(ids) {
642
+ let buffer = "";
643
+ for (const id of ids) {
644
+ buffer += deleteKittyImage(id);
645
+ }
646
+ return buffer;
647
+ }
648
+ expandLastChangedForKittyImages(firstChanged, lastChanged) {
649
+ let expandedLastChanged = lastChanged;
650
+ for (let i = firstChanged; i < this.previousLines.length; i++) {
651
+ if (extractKittyImageIds(this.previousLines[i]).length > 0) {
652
+ expandedLastChanged = Math.max(expandedLastChanged, i);
653
+ }
654
+ }
655
+ return expandedLastChanged;
656
+ }
657
+ deleteChangedKittyImages(firstChanged, lastChanged) {
658
+ if (firstChanged < 0 || lastChanged < firstChanged)
659
+ return "";
660
+ const ids = new Set();
661
+ const maxLine = Math.min(lastChanged, this.previousLines.length - 1);
662
+ for (let i = firstChanged; i <= maxLine; i++) {
663
+ for (const id of extractKittyImageIds(this.previousLines[i] ?? "")) {
664
+ ids.add(id);
665
+ }
666
+ }
667
+ return this.deleteKittyImages(ids);
668
+ }
669
+ getViewportRows(lines, viewportTop, height) {
670
+ return Array.from({ length: height }, (_, row) => lines[viewportTop + row] ?? "");
671
+ }
672
+ createViewportInsertScrollPlan(newLines, prevViewportTop, height, lineCountDelta) {
673
+ if (lineCountDelta <= 0 || lineCountDelta >= height || this.overlayStack.length > 0) {
674
+ return undefined;
675
+ }
676
+ const maxViewportTop = Math.max(0, newLines.length - height);
677
+ const viewportTop = Math.min(maxViewportTop, prevViewportTop + lineCountDelta);
678
+ if (viewportTop <= prevViewportTop) {
679
+ return undefined;
680
+ }
681
+ const previousVisible = this.getViewportRows(this.previousLines, prevViewportTop, height);
682
+ const nextVisible = this.getViewportRows(newLines, viewportTop, height);
683
+ if (previousVisible.some(isImageLine) || nextVisible.some(isImageLine)) {
684
+ return undefined;
685
+ }
686
+ let stableSuffixRows = 0;
687
+ while (stableSuffixRows < height &&
688
+ previousVisible[height - stableSuffixRows - 1] === nextVisible[height - stableSuffixRows - 1]) {
689
+ stableSuffixRows += 1;
690
+ }
691
+ const regionHeight = height - stableSuffixRows;
692
+ if (regionHeight <= 0 || regionHeight < lineCountDelta) {
693
+ return undefined;
694
+ }
695
+ for (let row = 0; row < regionHeight - lineCountDelta; row++) {
696
+ if (previousVisible[row + lineCountDelta] !== nextVisible[row]) {
697
+ return undefined;
698
+ }
699
+ }
700
+ return {
701
+ viewportTop,
702
+ regionBottom: regionHeight - 1,
703
+ insertedRows: nextVisible.slice(regionHeight - lineCountDelta, regionHeight),
704
+ };
705
+ }
706
+ renderViewportInsertScroll(plan, newLines, cursorPos, width, height) {
707
+ let buffer = "\x1b[?2026h";
708
+ const regionTop = 0;
709
+ const regionBottom = plan.regionBottom;
710
+ buffer += `\x1b[${regionTop + 1};${regionBottom + 1}r`;
711
+ buffer += `\x1b[${regionBottom + 1};1H`;
712
+ buffer += "\n".repeat(plan.insertedRows.length);
713
+ buffer += "\x1b[r";
714
+ const firstInsertedScreenRow = regionBottom - plan.insertedRows.length + 1;
715
+ for (let index = 0; index < plan.insertedRows.length; index++) {
716
+ const screenRow = firstInsertedScreenRow + index;
717
+ buffer += `\x1b[${screenRow + 1};1H\x1b[2K`;
718
+ buffer += plan.insertedRows[index] ?? "";
719
+ }
720
+ buffer += "\x1b[?2026l";
721
+ this.terminal.write(buffer);
722
+ this.cursorRow = Math.max(0, newLines.length - 1);
723
+ this.hardwareCursorRow = plan.viewportTop + firstInsertedScreenRow + plan.insertedRows.length - 1;
724
+ this.maxLinesRendered = Math.max(this.maxLinesRendered, newLines.length);
725
+ this.previousViewportTop = plan.viewportTop;
726
+ this.positionHardwareCursor(cursorPos, newLines.length);
727
+ this.previousLines = newLines;
728
+ this.previousKittyImageIds = this.collectKittyImageIds(newLines);
729
+ this.previousWidth = width;
730
+ this.previousHeight = height;
731
+ }
732
+ renderScrollbackReplay(newLines, cursorPos, width, height, prevViewportTop, hardwareCursorRow) {
733
+ let buffer = "\x1b[?2026h";
734
+ buffer += this.deleteKittyImages(this.previousKittyImageIds);
735
+ buffer += "\x1b[3J";
736
+ const currentScreenRow = Math.max(0, Math.min(height - 1, hardwareCursorRow - prevViewportTop));
737
+ if (currentScreenRow > 0) {
738
+ buffer += `\x1b[${currentScreenRow}A`;
739
+ }
740
+ const bufferLength = Math.max(height, newLines.length);
741
+ for (let row = 0; row < bufferLength; row++) {
742
+ if (row > 0)
743
+ buffer += "\r\n";
744
+ buffer += "\r\x1b[2K";
745
+ buffer += newLines[row] ?? "";
746
+ }
747
+ buffer += "\x1b[?2026l";
748
+ this.terminal.write(buffer);
749
+ this.cursorRow = Math.max(0, newLines.length - 1);
750
+ this.hardwareCursorRow = bufferLength - 1;
751
+ this.maxLinesRendered = newLines.length;
752
+ this.previousViewportTop = Math.max(0, bufferLength - height);
753
+ this.positionHardwareCursor(cursorPos, newLines.length);
754
+ this.previousLines = newLines;
755
+ this.previousKittyImageIds = this.collectKittyImageIds(newLines);
756
+ this.previousWidth = width;
757
+ this.previousHeight = height;
758
+ }
759
+ /** Splice overlay content into a base line at a specific column. Single-pass optimized. */
760
+ compositeLineAt(baseLine, overlayLine, startCol, overlayWidth, totalWidth) {
761
+ if (isImageLine(baseLine))
762
+ return baseLine;
763
+ // Single pass through baseLine extracts both before and after segments
764
+ const afterStart = startCol + overlayWidth;
765
+ const base = extractSegments(baseLine, startCol, afterStart, totalWidth - afterStart, true);
766
+ // Extract overlay with width tracking (strict=true to exclude wide chars at boundary)
767
+ const overlay = sliceWithWidth(overlayLine, 0, overlayWidth, true);
768
+ // Pad segments to target widths
769
+ const beforePad = Math.max(0, startCol - base.beforeWidth);
770
+ const overlayPad = Math.max(0, overlayWidth - overlay.width);
771
+ const actualBeforeWidth = Math.max(startCol, base.beforeWidth);
772
+ const actualOverlayWidth = Math.max(overlayWidth, overlay.width);
773
+ const afterTarget = Math.max(0, totalWidth - actualBeforeWidth - actualOverlayWidth);
774
+ const afterPad = Math.max(0, afterTarget - base.afterWidth);
775
+ // Compose result
776
+ const r = TUI.SEGMENT_RESET;
777
+ const result = base.before +
778
+ " ".repeat(beforePad) +
779
+ r +
780
+ overlay.text +
781
+ " ".repeat(overlayPad) +
782
+ r +
783
+ base.after +
784
+ " ".repeat(afterPad);
785
+ // CRITICAL: Always verify and truncate to terminal width.
786
+ // This is the final safeguard against width overflow which would crash the TUI.
787
+ // Width tracking can drift from actual visible width due to:
788
+ // - Complex ANSI/OSC sequences (hyperlinks, colors)
789
+ // - Wide characters at segment boundaries
790
+ // - Edge cases in segment extraction
791
+ const resultWidth = visibleWidth(result);
792
+ if (resultWidth <= totalWidth) {
793
+ return result;
794
+ }
795
+ // Truncate with strict=true to ensure we don't exceed totalWidth
796
+ return sliceByColumn(result, 0, totalWidth, true);
797
+ }
798
+ /**
799
+ * Find and extract cursor position from rendered lines.
800
+ * Searches for CURSOR_MARKER, calculates its position, and strips it from the output.
801
+ * Only scans the bottom terminal height lines (visible viewport).
802
+ * @param lines - Rendered lines to search
803
+ * @param height - Terminal height (visible viewport size)
804
+ * @returns Cursor position { row, col } or null if no marker found
805
+ */
806
+ extractCursorPosition(lines, height) {
807
+ // Only scan the bottom `height` lines (visible viewport)
808
+ const viewportTop = Math.max(0, lines.length - height);
809
+ for (let row = lines.length - 1; row >= viewportTop; row--) {
810
+ const line = lines[row];
811
+ const markerIndex = line.indexOf(CURSOR_MARKER);
812
+ if (markerIndex !== -1) {
813
+ // Calculate visual column (width of text before marker)
814
+ const beforeMarker = line.slice(0, markerIndex);
815
+ const col = visibleWidth(beforeMarker);
816
+ // Strip marker from the line
817
+ lines[row] = line.slice(0, markerIndex) + line.slice(markerIndex + CURSOR_MARKER.length);
818
+ return { row, col };
819
+ }
820
+ }
821
+ return null;
822
+ }
823
+ doRender() {
824
+ if (this.stopped)
825
+ return;
826
+ const width = this.terminal.columns;
827
+ const height = this.terminal.rows;
828
+ const widthChanged = this.previousWidth !== 0 && this.previousWidth !== width;
829
+ const heightChanged = this.previousHeight !== 0 && this.previousHeight !== height;
830
+ const previousBufferLength = this.previousHeight > 0 ? this.previousViewportTop + this.previousHeight : height;
831
+ let prevViewportTop = heightChanged ? Math.max(0, previousBufferLength - height) : this.previousViewportTop;
832
+ let viewportTop = prevViewportTop;
833
+ let hardwareCursorRow = this.hardwareCursorRow;
834
+ const computeLineDiff = (targetRow) => {
835
+ const currentScreenRow = hardwareCursorRow - prevViewportTop;
836
+ const targetScreenRow = targetRow - viewportTop;
837
+ return targetScreenRow - currentScreenRow;
838
+ };
839
+ // Render all components to get new lines
840
+ let newLines = this.render(width);
841
+ // Composite overlays into the rendered lines (before differential compare)
842
+ if (this.overlayStack.length > 0) {
843
+ newLines = this.compositeOverlays(newLines, width, height);
844
+ }
845
+ // Extract cursor position before applying line resets (marker must be found first)
846
+ const cursorPos = this.extractCursorPosition(newLines, height);
847
+ newLines = this.applyLineResets(newLines);
848
+ // Helper to clear scrollback and viewport and render all new lines
849
+ const fullRender = (clear) => {
850
+ this.fullRedrawCount += 1;
851
+ let buffer = "\x1b[?2026h"; // Begin synchronized output
852
+ if (clear) {
853
+ buffer += this.deleteKittyImages(this.previousKittyImageIds);
854
+ buffer += "\x1b[2J\x1b[H\x1b[3J"; // Clear screen, home, then clear scrollback
855
+ }
856
+ for (let i = 0; i < newLines.length; i++) {
857
+ if (i > 0)
858
+ buffer += "\r\n";
859
+ buffer += newLines[i];
860
+ }
861
+ buffer += "\x1b[?2026l"; // End synchronized output
862
+ this.terminal.write(buffer);
863
+ this.cursorRow = Math.max(0, newLines.length - 1);
864
+ this.hardwareCursorRow = this.cursorRow;
865
+ // Reset max lines when clearing, otherwise track growth
866
+ if (clear) {
867
+ this.maxLinesRendered = newLines.length;
868
+ }
869
+ else {
870
+ this.maxLinesRendered = Math.max(this.maxLinesRendered, newLines.length);
871
+ }
872
+ const bufferLength = Math.max(height, newLines.length);
873
+ this.previousViewportTop = Math.max(0, bufferLength - height);
874
+ this.positionHardwareCursor(cursorPos, newLines.length);
875
+ this.previousLines = newLines;
876
+ this.previousKittyImageIds = this.collectKittyImageIds(newLines);
877
+ this.previousWidth = width;
878
+ this.previousHeight = height;
879
+ };
880
+ const debugRedraw = process.env.PI_DEBUG_REDRAW === "1";
881
+ const logRedraw = (reason) => {
882
+ if (!debugRedraw)
883
+ return;
884
+ const logPath = path.join(os.homedir(), ".senpi", "agent", "senpi-debug.log");
885
+ const msg = `[${new Date().toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
886
+ fs.appendFileSync(logPath, msg);
887
+ };
888
+ // First render - just output everything without clearing (assumes clean screen)
889
+ if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
890
+ logRedraw("first render");
891
+ fullRender(false);
892
+ return;
893
+ }
894
+ // Width changes always need a full re-render because wrapping changes.
895
+ if (widthChanged) {
896
+ logRedraw(`terminal width changed (${this.previousWidth} -> ${width})`);
897
+ fullRender(true);
898
+ return;
899
+ }
900
+ // Height changes normally need a full re-render to keep the visible viewport aligned,
901
+ // but Termux changes height when the software keyboard shows or hides.
902
+ // In that environment, a full redraw causes the entire history to replay on every toggle.
903
+ if (heightChanged && !isTermuxSession()) {
904
+ logRedraw(`terminal height changed (${this.previousHeight} -> ${height})`);
905
+ fullRender(true);
906
+ return;
907
+ }
908
+ // Content shrunk below the working area and no overlays - re-render to clear empty rows
909
+ // (overlays need the padding, so only do this when no overlays are active)
910
+ // Configurable via setClearOnShrink() or PI_CLEAR_ON_SHRINK=0 env var
911
+ if (this.clearOnShrink && newLines.length < this.maxLinesRendered && this.overlayStack.length === 0) {
912
+ logRedraw(`clearOnShrink (maxLinesRendered=${this.maxLinesRendered})`);
913
+ fullRender(true);
914
+ return;
915
+ }
916
+ // Find first and last changed lines
917
+ let firstChanged = -1;
918
+ let lastChanged = -1;
919
+ const maxLines = Math.max(newLines.length, this.previousLines.length);
920
+ for (let i = 0; i < maxLines; i++) {
921
+ const oldLine = i < this.previousLines.length ? this.previousLines[i] : "";
922
+ const newLine = i < newLines.length ? newLines[i] : "";
923
+ if (oldLine !== newLine) {
924
+ if (firstChanged === -1) {
925
+ firstChanged = i;
926
+ }
927
+ lastChanged = i;
928
+ }
929
+ }
930
+ const appendedLines = newLines.length > this.previousLines.length;
931
+ const lineCountDelta = newLines.length - this.previousLines.length;
932
+ if (appendedLines) {
933
+ if (firstChanged === -1) {
934
+ firstChanged = this.previousLines.length;
935
+ }
936
+ lastChanged = newLines.length - 1;
937
+ }
938
+ if (firstChanged !== -1) {
939
+ lastChanged = this.expandLastChangedForKittyImages(firstChanged, lastChanged);
940
+ }
941
+ const appendStart = appendedLines && firstChanged === this.previousLines.length && firstChanged > 0;
942
+ const insertScrollPlan = this.createViewportInsertScrollPlan(newLines, prevViewportTop, height, lineCountDelta);
943
+ // No changes - but still need to update hardware cursor position if it moved
944
+ if (firstChanged === -1) {
945
+ this.positionHardwareCursor(cursorPos, newLines.length);
946
+ this.previousViewportTop = prevViewportTop;
947
+ this.previousHeight = height;
948
+ return;
949
+ }
950
+ if (insertScrollPlan) {
951
+ this.renderViewportInsertScroll(insertScrollPlan, newLines, cursorPos, width, height);
952
+ return;
953
+ }
954
+ // All changes are in deleted lines (nothing to render, just clear)
955
+ if (firstChanged >= newLines.length) {
956
+ if (this.previousLines.length > newLines.length) {
957
+ let buffer = "\x1b[?2026h";
958
+ buffer += this.deleteChangedKittyImages(firstChanged, lastChanged);
959
+ // Move to end of new content (clamp to 0 for empty content)
960
+ const targetRow = Math.max(0, newLines.length - 1);
961
+ if (targetRow < prevViewportTop) {
962
+ logRedraw(`deleted lines moved viewport up (${targetRow} < ${prevViewportTop})`);
963
+ fullRender(true);
964
+ return;
965
+ }
966
+ const lineDiff = computeLineDiff(targetRow);
967
+ if (lineDiff > 0)
968
+ buffer += `\x1b[${lineDiff}B`;
969
+ else if (lineDiff < 0)
970
+ buffer += `\x1b[${-lineDiff}A`;
971
+ buffer += "\r";
972
+ // Clear extra lines without scrolling
973
+ const extraLines = this.previousLines.length - newLines.length;
974
+ if (extraLines > height) {
975
+ logRedraw(`extraLines > height (${extraLines} > ${height})`);
976
+ fullRender(true);
977
+ return;
978
+ }
979
+ if (extraLines > 0) {
980
+ buffer += "\x1b[1B";
981
+ }
982
+ for (let i = 0; i < extraLines; i++) {
983
+ buffer += "\r\x1b[2K";
984
+ if (i < extraLines - 1)
985
+ buffer += "\x1b[1B";
986
+ }
987
+ if (extraLines > 0) {
988
+ buffer += `\x1b[${extraLines}A`;
989
+ }
990
+ buffer += "\x1b[?2026l";
991
+ this.terminal.write(buffer);
992
+ this.cursorRow = targetRow;
993
+ this.hardwareCursorRow = targetRow;
994
+ }
995
+ this.positionHardwareCursor(cursorPos, newLines.length);
996
+ this.previousLines = newLines;
997
+ this.previousKittyImageIds = this.collectKittyImageIds(newLines);
998
+ this.previousWidth = width;
999
+ this.previousHeight = height;
1000
+ this.previousViewportTop = prevViewportTop;
1001
+ return;
1002
+ }
1003
+ // Differential rendering can only touch what was actually visible.
1004
+ if (firstChanged < prevViewportTop) {
1005
+ if (newLines.length < this.previousLines.length) {
1006
+ viewportTop = Math.max(0, newLines.length - height);
1007
+ }
1008
+ if (newLines.length > this.previousLines.length) {
1009
+ const maxViewportTop = Math.max(0, newLines.length - height);
1010
+ viewportTop = Math.min(maxViewportTop, prevViewportTop + lineCountDelta);
1011
+ }
1012
+ let firstVisibleChanged = -1;
1013
+ let lastVisibleChanged = -1;
1014
+ for (let row = 0; row < height; row++) {
1015
+ const previousLine = this.previousLines[prevViewportTop + row] ?? "";
1016
+ const nextLine = newLines[viewportTop + row] ?? "";
1017
+ if (previousLine !== nextLine) {
1018
+ if (firstVisibleChanged === -1) {
1019
+ firstVisibleChanged = row;
1020
+ }
1021
+ lastVisibleChanged = row;
1022
+ }
1023
+ }
1024
+ if (firstVisibleChanged === -1) {
1025
+ if (lineCountDelta !== 0) {
1026
+ this.renderScrollbackReplay(newLines, cursorPos, width, height, prevViewportTop, hardwareCursorRow);
1027
+ return;
1028
+ }
1029
+ this.cursorRow = Math.max(0, newLines.length - 1);
1030
+ this.maxLinesRendered = Math.max(this.maxLinesRendered, newLines.length);
1031
+ this.previousLines = newLines;
1032
+ this.previousWidth = width;
1033
+ this.previousHeight = height;
1034
+ this.previousViewportTop = viewportTop;
1035
+ return;
1036
+ }
1037
+ if (viewportTop !== prevViewportTop) {
1038
+ const previousViewportBottom = Math.min(this.previousLines.length - 1, prevViewportTop + height - 1);
1039
+ let buffer = "\x1b[?2026h";
1040
+ buffer += this.deleteChangedKittyImages(prevViewportTop, previousViewportBottom);
1041
+ const currentScreenRow = Math.max(0, Math.min(height - 1, hardwareCursorRow - prevViewportTop));
1042
+ if (currentScreenRow > 0) {
1043
+ buffer += `\x1b[${currentScreenRow}A`;
1044
+ }
1045
+ for (let row = 0; row < height; row++) {
1046
+ if (row > 0)
1047
+ buffer += "\r\n";
1048
+ buffer += "\r\x1b[2K";
1049
+ buffer += newLines[viewportTop + row] ?? "";
1050
+ }
1051
+ buffer += "\x1b[?2026l";
1052
+ this.terminal.write(buffer);
1053
+ this.cursorRow = Math.max(0, newLines.length - 1);
1054
+ this.hardwareCursorRow = viewportTop + Math.max(0, height - 1);
1055
+ this.maxLinesRendered = Math.max(this.maxLinesRendered, newLines.length);
1056
+ this.previousViewportTop = viewportTop;
1057
+ this.positionHardwareCursor(cursorPos, newLines.length);
1058
+ this.previousLines = newLines;
1059
+ this.previousKittyImageIds = this.collectKittyImageIds(newLines);
1060
+ this.previousWidth = width;
1061
+ this.previousHeight = height;
1062
+ return;
1063
+ }
1064
+ firstChanged = viewportTop + firstVisibleChanged;
1065
+ lastChanged = Math.min(newLines.length - 1, viewportTop + lastVisibleChanged);
1066
+ }
1067
+ // Render from first changed line to end
1068
+ // Build buffer with all updates wrapped in synchronized output
1069
+ let buffer = "\x1b[?2026h"; // Begin synchronized output
1070
+ buffer += this.deleteChangedKittyImages(firstChanged, lastChanged);
1071
+ const prevViewportBottom = prevViewportTop + height - 1;
1072
+ const moveTargetRow = appendStart ? firstChanged - 1 : firstChanged;
1073
+ if (moveTargetRow > prevViewportBottom) {
1074
+ const currentScreenRow = Math.max(0, Math.min(height - 1, hardwareCursorRow - prevViewportTop));
1075
+ const moveToBottom = height - 1 - currentScreenRow;
1076
+ if (moveToBottom > 0) {
1077
+ buffer += `\x1b[${moveToBottom}B`;
1078
+ }
1079
+ const scroll = moveTargetRow - prevViewportBottom;
1080
+ buffer += "\r\n".repeat(scroll);
1081
+ prevViewportTop += scroll;
1082
+ viewportTop += scroll;
1083
+ hardwareCursorRow = moveTargetRow;
1084
+ }
1085
+ // Move cursor to first changed line (use hardwareCursorRow for actual position)
1086
+ const lineDiff = computeLineDiff(moveTargetRow);
1087
+ if (lineDiff > 0) {
1088
+ buffer += `\x1b[${lineDiff}B`; // Move down
1089
+ }
1090
+ else if (lineDiff < 0) {
1091
+ buffer += `\x1b[${-lineDiff}A`; // Move up
1092
+ }
1093
+ buffer += appendStart ? "\r\n" : "\r"; // Move to column 0
1094
+ // Only render changed lines (firstChanged to lastChanged), not all lines to end
1095
+ // This reduces flicker when only a single line changes (e.g., spinner animation)
1096
+ const renderEnd = Math.min(lastChanged, newLines.length - 1);
1097
+ for (let i = firstChanged; i <= renderEnd; i++) {
1098
+ if (i > firstChanged)
1099
+ buffer += "\r\n";
1100
+ buffer += "\x1b[2K"; // Clear current line
1101
+ const line = newLines[i];
1102
+ const isImage = isImageLine(line);
1103
+ if (!isImage && visibleWidth(line) > width) {
1104
+ // Log all lines to crash file for debugging
1105
+ const crashLogPath = path.join(os.homedir(), ".senpi", "agent", "senpi-crash.log");
1106
+ const crashData = [
1107
+ `Crash at ${new Date().toISOString()}`,
1108
+ `Terminal width: ${width}`,
1109
+ `Line ${i} visible width: ${visibleWidth(line)}`,
1110
+ "",
1111
+ "=== All rendered lines ===",
1112
+ ...newLines.map((l, idx) => `[${idx}] (w=${visibleWidth(l)}) ${l}`),
1113
+ "",
1114
+ ].join("\n");
1115
+ fs.mkdirSync(path.dirname(crashLogPath), { recursive: true });
1116
+ fs.writeFileSync(crashLogPath, crashData);
1117
+ // Clean up terminal state before throwing
1118
+ this.stop();
1119
+ const errorMsg = [
1120
+ `Rendered line ${i} exceeds terminal width (${visibleWidth(line)} > ${width}).`,
1121
+ "",
1122
+ "This is likely caused by a custom TUI component not truncating its output.",
1123
+ "Use visibleWidth() to measure and truncateToWidth() to truncate lines.",
1124
+ "",
1125
+ `Debug log written to: ${crashLogPath}`,
1126
+ ].join("\n");
1127
+ throw new Error(errorMsg);
1128
+ }
1129
+ buffer += line;
1130
+ }
1131
+ // Track where cursor ended up after rendering
1132
+ let finalCursorRow = renderEnd;
1133
+ // If we had more lines before, clear them and move cursor back
1134
+ if (this.previousLines.length > newLines.length) {
1135
+ // Move to end of new content first if we stopped before it
1136
+ if (renderEnd < newLines.length - 1) {
1137
+ const moveDown = newLines.length - 1 - renderEnd;
1138
+ buffer += `\x1b[${moveDown}B`;
1139
+ finalCursorRow = newLines.length - 1;
1140
+ }
1141
+ const extraLines = this.previousLines.length - newLines.length;
1142
+ for (let i = newLines.length; i < this.previousLines.length; i++) {
1143
+ buffer += "\r\n\x1b[2K";
1144
+ }
1145
+ // Move cursor back to end of new content
1146
+ buffer += `\x1b[${extraLines}A`;
1147
+ }
1148
+ buffer += "\x1b[?2026l"; // End synchronized output
1149
+ if (process.env.PI_TUI_DEBUG === "1") {
1150
+ const debugDir = "/tmp/tui";
1151
+ fs.mkdirSync(debugDir, { recursive: true });
1152
+ const debugPath = path.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
1153
+ const debugData = [
1154
+ `firstChanged: ${firstChanged}`,
1155
+ `viewportTop: ${viewportTop}`,
1156
+ `cursorRow: ${this.cursorRow}`,
1157
+ `height: ${height}`,
1158
+ `lineDiff: ${lineDiff}`,
1159
+ `hardwareCursorRow: ${hardwareCursorRow}`,
1160
+ `renderEnd: ${renderEnd}`,
1161
+ `finalCursorRow: ${finalCursorRow}`,
1162
+ `cursorPos: ${JSON.stringify(cursorPos)}`,
1163
+ `newLines.length: ${newLines.length}`,
1164
+ `previousLines.length: ${this.previousLines.length}`,
1165
+ "",
1166
+ "=== newLines ===",
1167
+ JSON.stringify(newLines, null, 2),
1168
+ "",
1169
+ "=== previousLines ===",
1170
+ JSON.stringify(this.previousLines, null, 2),
1171
+ "",
1172
+ "=== buffer ===",
1173
+ JSON.stringify(buffer),
1174
+ ].join("\n");
1175
+ fs.writeFileSync(debugPath, debugData);
1176
+ }
1177
+ // Write entire buffer at once
1178
+ this.terminal.write(buffer);
1179
+ // Track cursor position for next render
1180
+ // cursorRow tracks end of content (for viewport calculation)
1181
+ // hardwareCursorRow tracks actual terminal cursor position (for movement)
1182
+ this.cursorRow = Math.max(0, newLines.length - 1);
1183
+ this.hardwareCursorRow = finalCursorRow;
1184
+ // Track terminal's working area (grows but doesn't shrink unless cleared)
1185
+ this.maxLinesRendered = Math.max(this.maxLinesRendered, newLines.length);
1186
+ this.previousViewportTop = Math.max(prevViewportTop, finalCursorRow - height + 1);
1187
+ // Position hardware cursor for IME
1188
+ this.positionHardwareCursor(cursorPos, newLines.length);
1189
+ this.previousLines = newLines;
1190
+ this.previousKittyImageIds = this.collectKittyImageIds(newLines);
1191
+ this.previousWidth = width;
1192
+ this.previousHeight = height;
1193
+ }
1194
+ /**
1195
+ * Position the hardware cursor for IME candidate window.
1196
+ * @param cursorPos The cursor position extracted from rendered output, or null
1197
+ * @param totalLines Total number of rendered lines
1198
+ */
1199
+ positionHardwareCursor(cursorPos, totalLines) {
1200
+ if (!cursorPos || totalLines <= 0) {
1201
+ this.terminal.hideCursor();
1202
+ return;
1203
+ }
1204
+ // Clamp cursor position to valid range
1205
+ const targetRow = Math.max(0, Math.min(cursorPos.row, totalLines - 1));
1206
+ const targetCol = Math.max(0, cursorPos.col);
1207
+ // Move cursor from current position to target
1208
+ const rowDelta = targetRow - this.hardwareCursorRow;
1209
+ let buffer = "";
1210
+ if (rowDelta > 0) {
1211
+ buffer += `\x1b[${rowDelta}B`; // Move down
1212
+ }
1213
+ else if (rowDelta < 0) {
1214
+ buffer += `\x1b[${-rowDelta}A`; // Move up
1215
+ }
1216
+ // Move to absolute column (1-indexed)
1217
+ buffer += `\x1b[${targetCol + 1}G`;
1218
+ if (buffer) {
1219
+ this.terminal.write(buffer);
1220
+ }
1221
+ this.hardwareCursorRow = targetRow;
1222
+ if (this.showHardwareCursor) {
1223
+ this.terminal.showCursor();
1224
+ }
1225
+ else {
1226
+ this.terminal.hideCursor();
1227
+ }
1228
+ }
1229
+ }
1230
+ //# sourceMappingURL=tui.js.map