@code-yeongyu/senpi 2026.6.4 → 2026.6.10

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 (1142) hide show
  1. package/CHANGELOG.md +64 -1
  2. package/README.md +127 -110
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/cli.js.map +1 -1
  5. package/dist/bun/register-bedrock.d.ts.map +1 -1
  6. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  7. package/dist/bun/restore-sandbox-env.js.map +1 -1
  8. package/dist/cli/args.d.ts +1 -0
  9. package/dist/cli/args.d.ts.map +1 -1
  10. package/dist/cli/args.js +13 -4
  11. package/dist/cli/args.js.map +1 -1
  12. package/dist/cli/config-selector.d.ts.map +1 -1
  13. package/dist/cli/config-selector.js.map +1 -1
  14. package/dist/cli/file-processor.d.ts.map +1 -1
  15. package/dist/cli/file-processor.js.map +1 -1
  16. package/dist/cli/initial-message.d.ts +1 -1
  17. package/dist/cli/initial-message.d.ts.map +1 -1
  18. package/dist/cli/initial-message.js.map +1 -1
  19. package/dist/cli/list-models.d.ts.map +1 -1
  20. package/dist/cli/list-models.js.map +1 -1
  21. package/dist/cli/project-trust.d.ts +10 -0
  22. package/dist/cli/project-trust.d.ts.map +1 -0
  23. package/dist/cli/project-trust.js +48 -0
  24. package/dist/cli/project-trust.js.map +1 -0
  25. package/dist/cli/session-picker.d.ts.map +1 -1
  26. package/dist/cli/session-picker.js.map +1 -1
  27. package/dist/cli/startup-ui.d.ts +7 -0
  28. package/dist/cli/startup-ui.d.ts.map +1 -0
  29. package/dist/cli/startup-ui.js +59 -0
  30. package/dist/cli/startup-ui.js.map +1 -0
  31. package/dist/cli-main.d.ts.map +1 -1
  32. package/dist/cli-main.js.map +1 -1
  33. package/dist/cli.d.ts.map +1 -1
  34. package/dist/cli.js +10 -1
  35. package/dist/cli.js.map +1 -1
  36. package/dist/config.d.ts.map +1 -1
  37. package/dist/config.js.map +1 -1
  38. package/dist/core/agent-session-runtime.d.ts +3 -1
  39. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  40. package/dist/core/agent-session-runtime.js +4 -9
  41. package/dist/core/agent-session-runtime.js.map +1 -1
  42. package/dist/core/agent-session-services.d.ts +2 -1
  43. package/dist/core/agent-session-services.d.ts.map +1 -1
  44. package/dist/core/agent-session-services.js +2 -2
  45. package/dist/core/agent-session-services.js.map +1 -1
  46. package/dist/core/agent-session.d.ts +33 -0
  47. package/dist/core/agent-session.d.ts.map +1 -1
  48. package/dist/core/agent-session.js +57 -79
  49. package/dist/core/agent-session.js.map +1 -1
  50. package/dist/core/auth-guidance.d.ts.map +1 -1
  51. package/dist/core/auth-guidance.js.map +1 -1
  52. package/dist/core/auth-storage.d.ts +4 -0
  53. package/dist/core/auth-storage.d.ts.map +1 -1
  54. package/dist/core/auth-storage.js +4 -8
  55. package/dist/core/auth-storage.js.map +1 -1
  56. package/dist/core/bash-executor.d.ts.map +1 -1
  57. package/dist/core/bash-executor.js.map +1 -1
  58. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  59. package/dist/core/compaction/branch-summarization.js.map +1 -1
  60. package/dist/core/compaction/compaction.d.ts.map +1 -1
  61. package/dist/core/compaction/compaction.js.map +1 -1
  62. package/dist/core/compaction/index.d.ts.map +1 -1
  63. package/dist/core/compaction/utils.d.ts +1 -1
  64. package/dist/core/compaction/utils.d.ts.map +1 -1
  65. package/dist/core/compaction/utils.js +1 -1
  66. package/dist/core/compaction/utils.js.map +1 -1
  67. package/dist/core/defaults.d.ts.map +1 -1
  68. package/dist/core/diagnostics.d.ts.map +1 -1
  69. package/dist/core/dynamic-prompt/build.d.ts.map +1 -1
  70. package/dist/core/dynamic-prompt/build.js.map +1 -1
  71. package/dist/core/dynamic-prompt/exploration.d.ts.map +1 -1
  72. package/dist/core/dynamic-prompt/exploration.js.map +1 -1
  73. package/dist/core/dynamic-prompt/identity.d.ts.map +1 -1
  74. package/dist/core/dynamic-prompt/identity.js.map +1 -1
  75. package/dist/core/dynamic-prompt/index.d.ts.map +1 -1
  76. package/dist/core/dynamic-prompt/intent-gate.d.ts.map +1 -1
  77. package/dist/core/dynamic-prompt/intent-gate.js.map +1 -1
  78. package/dist/core/dynamic-prompt/parallel-tools.d.ts.map +1 -1
  79. package/dist/core/dynamic-prompt/parallel-tools.js.map +1 -1
  80. package/dist/core/dynamic-prompt/policies.d.ts.map +1 -1
  81. package/dist/core/dynamic-prompt/policies.js.map +1 -1
  82. package/dist/core/dynamic-prompt/style.d.ts.map +1 -1
  83. package/dist/core/dynamic-prompt/style.js.map +1 -1
  84. package/dist/core/dynamic-prompt/tool-categorization.d.ts.map +1 -1
  85. package/dist/core/dynamic-prompt/tool-categorization.js.map +1 -1
  86. package/dist/core/dynamic-prompt/tool-section.d.ts.map +1 -1
  87. package/dist/core/dynamic-prompt/tool-section.js.map +1 -1
  88. package/dist/core/dynamic-prompt/types.d.ts.map +1 -1
  89. package/dist/core/dynamic-prompt/verification.d.ts.map +1 -1
  90. package/dist/core/dynamic-prompt/verification.js.map +1 -1
  91. package/dist/core/event-bus.d.ts.map +1 -1
  92. package/dist/core/event-bus.js.map +1 -1
  93. package/dist/core/exec.d.ts.map +1 -1
  94. package/dist/core/exec.js.map +1 -1
  95. package/dist/core/experimental.d.ts +2 -0
  96. package/dist/core/experimental.d.ts.map +1 -0
  97. package/dist/core/experimental.js +4 -0
  98. package/dist/core/experimental.js.map +1 -0
  99. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  100. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  101. package/dist/core/export-html/index.d.ts.map +1 -1
  102. package/dist/core/export-html/index.js.map +1 -1
  103. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  104. package/dist/core/export-html/tool-renderer.js.map +1 -1
  105. package/dist/core/extensions/builtin/anthropic-bash/index.d.ts.map +1 -1
  106. package/dist/core/extensions/builtin/anthropic-bash/index.js.map +1 -1
  107. package/dist/core/extensions/builtin/anthropic-web-search/index.d.ts.map +1 -1
  108. package/dist/core/extensions/builtin/anthropic-web-search/index.js.map +1 -1
  109. package/dist/core/extensions/builtin/bash-timeout/index.d.ts.map +1 -1
  110. package/dist/core/extensions/builtin/bash-timeout/index.js.map +1 -1
  111. package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -1
  112. package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
  113. package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts.map +1 -1
  114. package/dist/core/extensions/builtin/compaction/checkpoint-state.js.map +1 -1
  115. package/dist/core/extensions/builtin/compaction/circuit-breaker.d.ts.map +1 -1
  116. package/dist/core/extensions/builtin/compaction/circuit-breaker.js.map +1 -1
  117. package/dist/core/extensions/builtin/compaction/context-reduction.d.ts.map +1 -1
  118. package/dist/core/extensions/builtin/compaction/context-reduction.js +1 -1
  119. package/dist/core/extensions/builtin/compaction/context-reduction.js.map +1 -1
  120. package/dist/core/extensions/builtin/compaction/degradation-monitor.d.ts.map +1 -1
  121. package/dist/core/extensions/builtin/compaction/degradation-monitor.js.map +1 -1
  122. package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
  123. package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
  124. package/dist/core/extensions/builtin/compaction/openai-remote.d.ts.map +1 -1
  125. package/dist/core/extensions/builtin/compaction/openai-remote.js.map +1 -1
  126. package/dist/core/extensions/builtin/compaction/overflow-detection.d.ts.map +1 -1
  127. package/dist/core/extensions/builtin/compaction/overflow-detection.js.map +1 -1
  128. package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts.map +1 -1
  129. package/dist/core/extensions/builtin/compaction/per-turn-cap.js.map +1 -1
  130. package/dist/core/extensions/builtin/compaction/policy.d.ts.map +1 -1
  131. package/dist/core/extensions/builtin/compaction/policy.js.map +1 -1
  132. package/dist/core/extensions/builtin/compaction/prompts.d.ts.map +1 -1
  133. package/dist/core/extensions/builtin/compaction/prompts.js.map +1 -1
  134. package/dist/core/extensions/builtin/compaction/repair-tool-pairs.d.ts.map +1 -1
  135. package/dist/core/extensions/builtin/compaction/repair-tool-pairs.js.map +1 -1
  136. package/dist/core/extensions/builtin/compaction/restoration-tracker.d.ts.map +1 -1
  137. package/dist/core/extensions/builtin/compaction/restoration-tracker.js.map +1 -1
  138. package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
  139. package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
  140. package/dist/core/extensions/builtin/compaction/state.d.ts.map +1 -1
  141. package/dist/core/extensions/builtin/compaction/state.js.map +1 -1
  142. package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts.map +1 -1
  143. package/dist/core/extensions/builtin/compaction/todo-bridge.js.map +1 -1
  144. package/dist/core/extensions/builtin/compaction/tool-truncation.d.ts.map +1 -1
  145. package/dist/core/extensions/builtin/compaction/tool-truncation.js.map +1 -1
  146. package/dist/core/extensions/builtin/diff.d.ts.map +1 -1
  147. package/dist/core/extensions/builtin/diff.js.map +1 -1
  148. package/dist/core/extensions/builtin/files.d.ts.map +1 -1
  149. package/dist/core/extensions/builtin/files.js.map +1 -1
  150. package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts.map +1 -1
  151. package/dist/core/extensions/builtin/gpt-apply-patch/apply.js.map +1 -1
  152. package/dist/core/extensions/builtin/gpt-apply-patch/constants.d.ts.map +1 -1
  153. package/dist/core/extensions/builtin/gpt-apply-patch/constants.js.map +1 -1
  154. package/dist/core/extensions/builtin/gpt-apply-patch/errors.d.ts.map +1 -1
  155. package/dist/core/extensions/builtin/gpt-apply-patch/errors.js +0 -2
  156. package/dist/core/extensions/builtin/gpt-apply-patch/errors.js.map +1 -1
  157. package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts.map +1 -1
  158. package/dist/core/extensions/builtin/gpt-apply-patch/extension.js.map +1 -1
  159. package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts.map +1 -1
  160. package/dist/core/extensions/builtin/gpt-apply-patch/params.d.ts.map +1 -1
  161. package/dist/core/extensions/builtin/gpt-apply-patch/params.js.map +1 -1
  162. package/dist/core/extensions/builtin/gpt-apply-patch/parser.d.ts.map +1 -1
  163. package/dist/core/extensions/builtin/gpt-apply-patch/parser.js.map +1 -1
  164. package/dist/core/extensions/builtin/gpt-apply-patch/patch-diff.d.ts.map +1 -1
  165. package/dist/core/extensions/builtin/gpt-apply-patch/patch-diff.js.map +1 -1
  166. package/dist/core/extensions/builtin/gpt-apply-patch/patch-replace.d.ts.map +1 -1
  167. package/dist/core/extensions/builtin/gpt-apply-patch/patch-replace.js.map +1 -1
  168. package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.d.ts.map +1 -1
  169. package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.js.map +1 -1
  170. package/dist/core/extensions/builtin/gpt-apply-patch/preview.d.ts.map +1 -1
  171. package/dist/core/extensions/builtin/gpt-apply-patch/preview.js.map +1 -1
  172. package/dist/core/extensions/builtin/gpt-apply-patch/seek-sequence.d.ts.map +1 -1
  173. package/dist/core/extensions/builtin/gpt-apply-patch/seek-sequence.js.map +1 -1
  174. package/dist/core/extensions/builtin/gpt-apply-patch/streaming-parser.d.ts.map +1 -1
  175. package/dist/core/extensions/builtin/gpt-apply-patch/streaming-parser.js +7 -5
  176. package/dist/core/extensions/builtin/gpt-apply-patch/streaming-parser.js.map +1 -1
  177. package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.d.ts.map +1 -1
  178. package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.js.map +1 -1
  179. package/dist/core/extensions/builtin/gpt-apply-patch/text.d.ts.map +1 -1
  180. package/dist/core/extensions/builtin/gpt-apply-patch/text.js.map +1 -1
  181. package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts.map +1 -1
  182. package/dist/core/extensions/builtin/gpt-apply-patch/tool.js.map +1 -1
  183. package/dist/core/extensions/builtin/gpt-apply-patch/types.d.ts.map +1 -1
  184. package/dist/core/extensions/builtin/gpt-apply-patch/workspace.d.ts.map +1 -1
  185. package/dist/core/extensions/builtin/gpt-apply-patch/workspace.js.map +1 -1
  186. package/dist/core/extensions/builtin/history-search/filter.d.ts.map +1 -1
  187. package/dist/core/extensions/builtin/history-search/filter.js.map +1 -1
  188. package/dist/core/extensions/builtin/history-search/index.d.ts.map +1 -1
  189. package/dist/core/extensions/builtin/history-search/index.js.map +1 -1
  190. package/dist/core/extensions/builtin/history-search/indexer.d.ts.map +1 -1
  191. package/dist/core/extensions/builtin/history-search/indexer.js.map +1 -1
  192. package/dist/core/extensions/builtin/history-search/overlay.d.ts.map +1 -1
  193. package/dist/core/extensions/builtin/history-search/overlay.js +3 -6
  194. package/dist/core/extensions/builtin/history-search/overlay.js.map +1 -1
  195. package/dist/core/extensions/builtin/history-search/types.d.ts.map +1 -1
  196. package/dist/core/extensions/builtin/index.d.ts.map +1 -1
  197. package/dist/core/extensions/builtin/kimi-web-search/index.d.ts.map +1 -1
  198. package/dist/core/extensions/builtin/kimi-web-search/index.js.map +1 -1
  199. package/dist/core/extensions/builtin/openai-web-search/index.d.ts.map +1 -1
  200. package/dist/core/extensions/builtin/openai-web-search/index.js.map +1 -1
  201. package/dist/core/extensions/builtin/permission-system/arity.d.ts.map +1 -1
  202. package/dist/core/extensions/builtin/permission-system/arity.js.map +1 -1
  203. package/dist/core/extensions/builtin/permission-system/cli.d.ts.map +1 -1
  204. package/dist/core/extensions/builtin/permission-system/cli.js.map +1 -1
  205. package/dist/core/extensions/builtin/permission-system/config.d.ts.map +1 -1
  206. package/dist/core/extensions/builtin/permission-system/config.js.map +1 -1
  207. package/dist/core/extensions/builtin/permission-system/evaluate.d.ts.map +1 -1
  208. package/dist/core/extensions/builtin/permission-system/evaluate.js.map +1 -1
  209. package/dist/core/extensions/builtin/permission-system/events.d.ts.map +1 -1
  210. package/dist/core/extensions/builtin/permission-system/events.js.map +1 -1
  211. package/dist/core/extensions/builtin/permission-system/external-dir.d.ts.map +1 -1
  212. package/dist/core/extensions/builtin/permission-system/external-dir.js.map +1 -1
  213. package/dist/core/extensions/builtin/permission-system/index.d.ts.map +1 -1
  214. package/dist/core/extensions/builtin/permission-system/index.js.map +1 -1
  215. package/dist/core/extensions/builtin/permission-system/non-interactive.d.ts.map +1 -1
  216. package/dist/core/extensions/builtin/permission-system/non-interactive.js.map +1 -1
  217. package/dist/core/extensions/builtin/permission-system/parsers.d.ts.map +1 -1
  218. package/dist/core/extensions/builtin/permission-system/parsers.js +3 -1
  219. package/dist/core/extensions/builtin/permission-system/parsers.js.map +1 -1
  220. package/dist/core/extensions/builtin/permission-system/prompt.d.ts.map +1 -1
  221. package/dist/core/extensions/builtin/permission-system/prompt.js.map +1 -1
  222. package/dist/core/extensions/builtin/permission-system/service.d.ts.map +1 -1
  223. package/dist/core/extensions/builtin/permission-system/service.js +2 -5
  224. package/dist/core/extensions/builtin/permission-system/service.js.map +1 -1
  225. package/dist/core/extensions/builtin/permission-system/settings.d.ts.map +1 -1
  226. package/dist/core/extensions/builtin/permission-system/settings.js.map +1 -1
  227. package/dist/core/extensions/builtin/permission-system/storage.d.ts.map +1 -1
  228. package/dist/core/extensions/builtin/permission-system/storage.js.map +1 -1
  229. package/dist/core/extensions/builtin/permission-system/types.d.ts.map +1 -1
  230. package/dist/core/extensions/builtin/permission-system/types.js +3 -5
  231. package/dist/core/extensions/builtin/permission-system/types.js.map +1 -1
  232. package/dist/core/extensions/builtin/permission-system/wildcard.d.ts.map +1 -1
  233. package/dist/core/extensions/builtin/permission-system/wildcard.js.map +1 -1
  234. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.d.ts.map +1 -1
  235. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js.map +1 -1
  236. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts.map +1 -1
  237. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js.map +1 -1
  238. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.d.ts.map +1 -1
  239. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js.map +1 -1
  240. package/dist/core/extensions/builtin/prompt-preset/file-operations.d.ts.map +1 -1
  241. package/dist/core/extensions/builtin/prompt-preset/file-operations.js.map +1 -1
  242. package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.d.ts.map +1 -1
  243. package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js.map +1 -1
  244. package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.d.ts.map +1 -1
  245. package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js.map +1 -1
  246. package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.d.ts.map +1 -1
  247. package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js.map +1 -1
  248. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.d.ts.map +1 -1
  249. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js.map +1 -1
  250. package/dist/core/extensions/builtin/prompt-preset/gpt-5.d.ts.map +1 -1
  251. package/dist/core/extensions/builtin/prompt-preset/gpt-5.js.map +1 -1
  252. package/dist/core/extensions/builtin/prompt-preset/index.d.ts.map +1 -1
  253. package/dist/core/extensions/builtin/prompt-preset/index.js.map +1 -1
  254. package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.d.ts.map +1 -1
  255. package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js.map +1 -1
  256. package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
  257. package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
  258. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
  259. package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
  260. package/dist/core/extensions/builtin/prompt-url-widget.d.ts.map +1 -1
  261. package/dist/core/extensions/builtin/prompt-url-widget.js.map +1 -1
  262. package/dist/core/extensions/builtin/redraws.d.ts.map +1 -1
  263. package/dist/core/extensions/builtin/redraws.js.map +1 -1
  264. package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
  265. package/dist/core/extensions/builtin/service-tier.js.map +1 -1
  266. package/dist/core/extensions/builtin/session-observer/index.d.ts.map +1 -1
  267. package/dist/core/extensions/builtin/session-observer/index.js.map +1 -1
  268. package/dist/core/extensions/builtin/session-observer/loader.d.ts.map +1 -1
  269. package/dist/core/extensions/builtin/session-observer/loader.js.map +1 -1
  270. package/dist/core/extensions/builtin/session-observer/overlay-format.d.ts.map +1 -1
  271. package/dist/core/extensions/builtin/session-observer/overlay-format.js.map +1 -1
  272. package/dist/core/extensions/builtin/session-observer/overlay.d.ts.map +1 -1
  273. package/dist/core/extensions/builtin/session-observer/overlay.js +13 -18
  274. package/dist/core/extensions/builtin/session-observer/overlay.js.map +1 -1
  275. package/dist/core/extensions/builtin/session-observer/scanner.d.ts.map +1 -1
  276. package/dist/core/extensions/builtin/session-observer/scanner.js.map +1 -1
  277. package/dist/core/extensions/builtin/session-observer/text.d.ts.map +1 -1
  278. package/dist/core/extensions/builtin/session-observer/text.js.map +1 -1
  279. package/dist/core/extensions/builtin/session-observer/transcript-entries.d.ts.map +1 -1
  280. package/dist/core/extensions/builtin/session-observer/transcript-entries.js.map +1 -1
  281. package/dist/core/extensions/builtin/session-observer/transcript-format.d.ts.map +1 -1
  282. package/dist/core/extensions/builtin/session-observer/transcript-format.js.map +1 -1
  283. package/dist/core/extensions/builtin/session-observer/transcript.d.ts.map +1 -1
  284. package/dist/core/extensions/builtin/session-observer/transcript.js.map +1 -1
  285. package/dist/core/extensions/builtin/session-observer/types.d.ts.map +1 -1
  286. package/dist/core/extensions/builtin/system-messages.d.ts.map +1 -1
  287. package/dist/core/extensions/builtin/system-messages.js.map +1 -1
  288. package/dist/core/extensions/builtin/todotools/index.d.ts.map +1 -1
  289. package/dist/core/extensions/builtin/todotools/index.js +0 -2
  290. package/dist/core/extensions/builtin/todotools/index.js.map +1 -1
  291. package/dist/core/extensions/builtin/todotools/prompt.d.ts +1 -1
  292. package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
  293. package/dist/core/extensions/builtin/todotools/prompt.js +0 -2
  294. package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -1
  295. package/dist/core/extensions/builtin/todotools/state.d.ts.map +1 -1
  296. package/dist/core/extensions/builtin/todotools/state.js.map +1 -1
  297. package/dist/core/extensions/builtin/todotools/tools/todoread.d.ts.map +1 -1
  298. package/dist/core/extensions/builtin/todotools/tools/todoread.js.map +1 -1
  299. package/dist/core/extensions/builtin/todotools/tools/todowrite.d.ts.map +1 -1
  300. package/dist/core/extensions/builtin/todotools/tools/todowrite.js.map +1 -1
  301. package/dist/core/extensions/builtin/tool-pair-guard/index.d.ts.map +1 -1
  302. package/dist/core/extensions/builtin/tool-pair-guard/index.js.map +1 -1
  303. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts.map +1 -1
  304. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js.map +1 -1
  305. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-chat-completions-payload.d.ts.map +1 -1
  306. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-chat-completions-payload.js.map +1 -1
  307. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-responses-payload.d.ts.map +1 -1
  308. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-responses-payload.js.map +1 -1
  309. package/dist/core/extensions/builtin/tps.d.ts.map +1 -1
  310. package/dist/core/extensions/builtin/tps.js.map +1 -1
  311. package/dist/core/extensions/index.d.ts +1 -1
  312. package/dist/core/extensions/index.d.ts.map +1 -1
  313. package/dist/core/extensions/index.js.map +1 -1
  314. package/dist/core/extensions/loader.d.ts +1 -1
  315. package/dist/core/extensions/loader.d.ts.map +1 -1
  316. package/dist/core/extensions/loader.js +4 -4
  317. package/dist/core/extensions/loader.js.map +1 -1
  318. package/dist/core/extensions/runner.d.ts +7 -2
  319. package/dist/core/extensions/runner.d.ts.map +1 -1
  320. package/dist/core/extensions/runner.js +69 -43
  321. package/dist/core/extensions/runner.js.map +1 -1
  322. package/dist/core/extensions/types.d.ts +22 -2
  323. package/dist/core/extensions/types.d.ts.map +1 -1
  324. package/dist/core/extensions/types.js.map +1 -1
  325. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  326. package/dist/core/extensions/wrapper.js.map +1 -1
  327. package/dist/core/footer-data-provider.d.ts.map +1 -1
  328. package/dist/core/footer-data-provider.js +17 -18
  329. package/dist/core/footer-data-provider.js.map +1 -1
  330. package/dist/core/http-dispatcher.d.ts.map +1 -1
  331. package/dist/core/http-dispatcher.js.map +1 -1
  332. package/dist/core/index.d.ts +1 -0
  333. package/dist/core/index.d.ts.map +1 -1
  334. package/dist/core/index.js +1 -0
  335. package/dist/core/index.js.map +1 -1
  336. package/dist/core/keybindings.d.ts +1 -1
  337. package/dist/core/keybindings.d.ts.map +1 -1
  338. package/dist/core/keybindings.js +0 -1
  339. package/dist/core/keybindings.js.map +1 -1
  340. package/dist/core/messages.d.ts.map +1 -1
  341. package/dist/core/messages.js.map +1 -1
  342. package/dist/core/model-registry.d.ts +3 -1
  343. package/dist/core/model-registry.d.ts.map +1 -1
  344. package/dist/core/model-registry.js +30 -13
  345. package/dist/core/model-registry.js.map +1 -1
  346. package/dist/core/model-resolver.d.ts.map +1 -1
  347. package/dist/core/model-resolver.js.map +1 -1
  348. package/dist/core/output-guard.d.ts.map +1 -1
  349. package/dist/core/output-guard.js.map +1 -1
  350. package/dist/core/package-manager.d.ts +1 -0
  351. package/dist/core/package-manager.d.ts.map +1 -1
  352. package/dist/core/package-manager.js +25 -13
  353. package/dist/core/package-manager.js.map +1 -1
  354. package/dist/core/project-trust.d.ts +15 -0
  355. package/dist/core/project-trust.d.ts.map +1 -0
  356. package/dist/core/project-trust.js +58 -0
  357. package/dist/core/project-trust.js.map +1 -0
  358. package/dist/core/prompt-templates.d.ts +2 -1
  359. package/dist/core/prompt-templates.d.ts.map +1 -1
  360. package/dist/core/prompt-templates.js +24 -26
  361. package/dist/core/prompt-templates.js.map +1 -1
  362. package/dist/core/provider-attribution.d.ts.map +1 -1
  363. package/dist/core/provider-attribution.js.map +1 -1
  364. package/dist/core/provider-display-names.d.ts.map +1 -1
  365. package/dist/core/resolve-config-value.d.ts.map +1 -1
  366. package/dist/core/resolve-config-value.js.map +1 -1
  367. package/dist/core/resource-loader.d.ts +14 -2
  368. package/dist/core/resource-loader.d.ts.map +1 -1
  369. package/dist/core/resource-loader.js +117 -74
  370. package/dist/core/resource-loader.js.map +1 -1
  371. package/dist/core/sdk.d.ts.map +1 -1
  372. package/dist/core/sdk.js.map +1 -1
  373. package/dist/core/session-cwd.d.ts.map +1 -1
  374. package/dist/core/session-cwd.js +0 -1
  375. package/dist/core/session-cwd.js.map +1 -1
  376. package/dist/core/session-manager.d.ts +3 -0
  377. package/dist/core/session-manager.d.ts.map +1 -1
  378. package/dist/core/session-manager.js +41 -28
  379. package/dist/core/session-manager.js.map +1 -1
  380. package/dist/core/session-resident-store.d.ts +16 -0
  381. package/dist/core/session-resident-store.d.ts.map +1 -0
  382. package/dist/core/session-resident-store.js +48 -0
  383. package/dist/core/session-resident-store.js.map +1 -0
  384. package/dist/core/session-work-barrier.d.ts.map +1 -1
  385. package/dist/core/session-work-barrier.js +5 -3
  386. package/dist/core/session-work-barrier.js.map +1 -1
  387. package/dist/core/settings-manager.d.ts +14 -2
  388. package/dist/core/settings-manager.d.ts.map +1 -1
  389. package/dist/core/settings-manager.js +86 -46
  390. package/dist/core/settings-manager.js.map +1 -1
  391. package/dist/core/skills.d.ts.map +1 -1
  392. package/dist/core/skills.js.map +1 -1
  393. package/dist/core/slash-commands.d.ts.map +1 -1
  394. package/dist/core/slash-commands.js +1 -0
  395. package/dist/core/slash-commands.js.map +1 -1
  396. package/dist/core/source-info.d.ts.map +1 -1
  397. package/dist/core/source-info.js.map +1 -1
  398. package/dist/core/system-prompt.d.ts.map +1 -1
  399. package/dist/core/system-prompt.js.map +1 -1
  400. package/dist/core/telemetry.d.ts.map +1 -1
  401. package/dist/core/telemetry.js.map +1 -1
  402. package/dist/core/thinking-levels.d.ts.map +1 -1
  403. package/dist/core/thinking-levels.js.map +1 -1
  404. package/dist/core/timings.d.ts.map +1 -1
  405. package/dist/core/timings.js.map +1 -1
  406. package/dist/core/tools/bash.d.ts.map +1 -1
  407. package/dist/core/tools/bash.js +9 -6
  408. package/dist/core/tools/bash.js.map +1 -1
  409. package/dist/core/tools/diff-render.d.ts.map +1 -1
  410. package/dist/core/tools/diff-render.js.map +1 -1
  411. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  412. package/dist/core/tools/edit-diff.js.map +1 -1
  413. package/dist/core/tools/edit.d.ts.map +1 -1
  414. package/dist/core/tools/edit.js.map +1 -1
  415. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  416. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  417. package/dist/core/tools/find.d.ts.map +1 -1
  418. package/dist/core/tools/find.js +1 -1
  419. package/dist/core/tools/find.js.map +1 -1
  420. package/dist/core/tools/grep.d.ts.map +1 -1
  421. package/dist/core/tools/grep.js +1 -1
  422. package/dist/core/tools/grep.js.map +1 -1
  423. package/dist/core/tools/index.d.ts.map +1 -1
  424. package/dist/core/tools/index.js.map +1 -1
  425. package/dist/core/tools/ls.d.ts.map +1 -1
  426. package/dist/core/tools/ls.js +1 -1
  427. package/dist/core/tools/ls.js.map +1 -1
  428. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  429. package/dist/core/tools/output-accumulator.js +12 -18
  430. package/dist/core/tools/output-accumulator.js.map +1 -1
  431. package/dist/core/tools/path-utils.d.ts.map +1 -1
  432. package/dist/core/tools/path-utils.js.map +1 -1
  433. package/dist/core/tools/read.d.ts.map +1 -1
  434. package/dist/core/tools/read.js +1 -1
  435. package/dist/core/tools/read.js.map +1 -1
  436. package/dist/core/tools/render-utils.d.ts.map +1 -1
  437. package/dist/core/tools/render-utils.js.map +1 -1
  438. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  439. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  440. package/dist/core/tools/truncate.d.ts.map +1 -1
  441. package/dist/core/tools/truncate.js.map +1 -1
  442. package/dist/core/tools/write.d.ts.map +1 -1
  443. package/dist/core/tools/write.js +1 -2
  444. package/dist/core/tools/write.js.map +1 -1
  445. package/dist/core/trust-manager.d.ts +31 -0
  446. package/dist/core/trust-manager.d.ts.map +1 -0
  447. package/dist/core/trust-manager.js +186 -0
  448. package/dist/core/trust-manager.js.map +1 -0
  449. package/dist/index.d.ts +5 -4
  450. package/dist/index.d.ts.map +1 -1
  451. package/dist/index.js +2 -1
  452. package/dist/index.js.map +1 -1
  453. package/dist/main.d.ts.map +1 -1
  454. package/dist/main.js +101 -86
  455. package/dist/main.js.map +1 -1
  456. package/dist/migrations.d.ts.map +1 -1
  457. package/dist/migrations.js +39 -34
  458. package/dist/migrations.js.map +1 -1
  459. package/dist/modes/index.d.ts +1 -1
  460. package/dist/modes/index.d.ts.map +1 -1
  461. package/dist/modes/index.js.map +1 -1
  462. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  463. package/dist/modes/interactive/components/armin.js +6 -10
  464. package/dist/modes/interactive/components/armin.js.map +1 -1
  465. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  466. package/dist/modes/interactive/components/assistant-message.js +2 -11
  467. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  468. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  469. package/dist/modes/interactive/components/bash-execution.js +6 -11
  470. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  471. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  472. package/dist/modes/interactive/components/bordered-loader.js +0 -3
  473. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  474. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  475. package/dist/modes/interactive/components/branch-summary-message.js +1 -3
  476. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  477. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  478. package/dist/modes/interactive/components/compaction-summary-message.js +1 -3
  479. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  480. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  481. package/dist/modes/interactive/components/config-selector.js +5 -15
  482. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  483. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  484. package/dist/modes/interactive/components/countdown-timer.js +0 -5
  485. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  486. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  487. package/dist/modes/interactive/components/custom-editor.js +1 -8
  488. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  489. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  490. package/dist/modes/interactive/components/custom-message.js +1 -6
  491. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  492. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  493. package/dist/modes/interactive/components/daxnuts.js +6 -8
  494. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  495. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  496. package/dist/modes/interactive/components/diff.js +2 -2
  497. package/dist/modes/interactive/components/diff.js.map +1 -1
  498. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  499. package/dist/modes/interactive/components/dynamic-border.js +0 -1
  500. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  501. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  502. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  503. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  504. package/dist/modes/interactive/components/extension-editor.js +1 -6
  505. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  506. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  507. package/dist/modes/interactive/components/extension-input.js +2 -8
  508. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  509. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  510. package/dist/modes/interactive/components/extension-selector.js +1 -9
  511. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  512. package/dist/modes/interactive/components/favorite-models-selector.d.ts.map +1 -1
  513. package/dist/modes/interactive/components/favorite-models-selector.js +9 -15
  514. package/dist/modes/interactive/components/favorite-models-selector.js.map +1 -1
  515. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  516. package/dist/modes/interactive/components/footer.js +10 -3
  517. package/dist/modes/interactive/components/footer.js.map +1 -1
  518. package/dist/modes/interactive/components/index.d.ts +1 -0
  519. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  520. package/dist/modes/interactive/components/index.js +1 -0
  521. package/dist/modes/interactive/components/index.js.map +1 -1
  522. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  523. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  524. package/dist/modes/interactive/components/login-dialog.d.ts +1 -0
  525. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  526. package/dist/modes/interactive/components/login-dialog.js +10 -10
  527. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  528. package/dist/modes/interactive/components/model-favorites.d.ts.map +1 -1
  529. package/dist/modes/interactive/components/model-favorites.js.map +1 -1
  530. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  531. package/dist/modes/interactive/components/model-selector.js +9 -22
  532. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  533. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  534. package/dist/modes/interactive/components/oauth-selector.js +3 -12
  535. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  536. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  537. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  538. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  539. package/dist/modes/interactive/components/session-selector.js +33 -58
  540. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  541. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  542. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  543. package/dist/modes/interactive/components/settings-selector.js +20 -4
  544. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  545. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  546. package/dist/modes/interactive/components/show-images-selector.js +0 -1
  547. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  548. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  549. package/dist/modes/interactive/components/skill-invocation-message.js +1 -3
  550. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  551. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  552. package/dist/modes/interactive/components/theme-selector.js +0 -2
  553. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  554. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  555. package/dist/modes/interactive/components/thinking-selector.js +0 -1
  556. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  557. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  558. package/dist/modes/interactive/components/tool-execution.js +35 -32
  559. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  560. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  561. package/dist/modes/interactive/components/tree-selector.js +18 -32
  562. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  563. package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  564. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  565. package/dist/modes/interactive/components/trust-selector.js +85 -0
  566. package/dist/modes/interactive/components/trust-selector.js.map +1 -0
  567. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  568. package/dist/modes/interactive/components/user-message-selector.js +3 -6
  569. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  570. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  571. package/dist/modes/interactive/components/user-message.js +0 -1
  572. package/dist/modes/interactive/components/user-message.js.map +1 -1
  573. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  574. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  575. package/dist/modes/interactive/interactive-mode.d.ts +39 -0
  576. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  577. package/dist/modes/interactive/interactive-mode.js +264 -114
  578. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  579. package/dist/modes/interactive/session-info-format.d.ts.map +1 -1
  580. package/dist/modes/interactive/session-info-format.js.map +1 -1
  581. package/dist/modes/interactive/startup-tools.d.ts.map +1 -1
  582. package/dist/modes/interactive/startup-tools.js.map +1 -1
  583. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  584. package/dist/modes/interactive/theme/theme.js +0 -6
  585. package/dist/modes/interactive/theme/theme.js.map +1 -1
  586. package/dist/modes/interactive/working-status.d.ts +2 -0
  587. package/dist/modes/interactive/working-status.d.ts.map +1 -1
  588. package/dist/modes/interactive/working-status.js +34 -0
  589. package/dist/modes/interactive/working-status.js.map +1 -1
  590. package/dist/modes/print-mode.d.ts.map +1 -1
  591. package/dist/modes/print-mode.js.map +1 -1
  592. package/dist/modes/provider-native-rendering.d.ts.map +1 -1
  593. package/dist/modes/provider-native-rendering.js.map +1 -1
  594. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  595. package/dist/modes/rpc/jsonl.js.map +1 -1
  596. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  597. package/dist/modes/rpc/rpc-client.js +7 -8
  598. package/dist/modes/rpc/rpc-client.js.map +1 -1
  599. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  600. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  601. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  602. package/dist/package-manager-cli.d.ts +6 -2
  603. package/dist/package-manager-cli.d.ts.map +1 -1
  604. package/dist/package-manager-cli.js +105 -11
  605. package/dist/package-manager-cli.js.map +1 -1
  606. package/dist/self-update-bootstrap.d.ts.map +1 -1
  607. package/dist/self-update-bootstrap.js.map +1 -1
  608. package/dist/senpi +10 -1
  609. package/dist/utils/ansi.d.ts.map +1 -1
  610. package/dist/utils/ansi.js.map +1 -1
  611. package/dist/utils/changelog.d.ts +1 -0
  612. package/dist/utils/changelog.d.ts.map +1 -1
  613. package/dist/utils/changelog.js +78 -0
  614. package/dist/utils/changelog.js.map +1 -1
  615. package/dist/utils/child-process.d.ts.map +1 -1
  616. package/dist/utils/child-process.js.map +1 -1
  617. package/dist/utils/clipboard-image.d.ts.map +1 -1
  618. package/dist/utils/clipboard-image.js.map +1 -1
  619. package/dist/utils/clipboard-native.d.ts.map +1 -1
  620. package/dist/utils/clipboard-native.js.map +1 -1
  621. package/dist/utils/clipboard.d.ts.map +1 -1
  622. package/dist/utils/clipboard.js.map +1 -1
  623. package/dist/utils/deprecation.d.ts.map +1 -1
  624. package/dist/utils/deprecation.js.map +1 -1
  625. package/dist/utils/exif-orientation.d.ts.map +1 -1
  626. package/dist/utils/exif-orientation.js.map +1 -1
  627. package/dist/utils/frontmatter.d.ts.map +1 -1
  628. package/dist/utils/frontmatter.js.map +1 -1
  629. package/dist/utils/fs-watch.d.ts.map +1 -1
  630. package/dist/utils/fs-watch.js.map +1 -1
  631. package/dist/utils/git.d.ts.map +1 -1
  632. package/dist/utils/git.js.map +1 -1
  633. package/dist/utils/html.d.ts.map +1 -1
  634. package/dist/utils/html.js.map +1 -1
  635. package/dist/utils/image-convert.d.ts.map +1 -1
  636. package/dist/utils/image-convert.js.map +1 -1
  637. package/dist/utils/image-resize-core.d.ts.map +1 -1
  638. package/dist/utils/image-resize-core.js.map +1 -1
  639. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  640. package/dist/utils/image-resize-worker.js.map +1 -1
  641. package/dist/utils/image-resize.d.ts.map +1 -1
  642. package/dist/utils/image-resize.js.map +1 -1
  643. package/dist/utils/json.d.ts.map +1 -1
  644. package/dist/utils/json.js.map +1 -1
  645. package/dist/utils/mime.d.ts.map +1 -1
  646. package/dist/utils/mime.js.map +1 -1
  647. package/dist/utils/open-browser.d.ts.map +1 -1
  648. package/dist/utils/open-browser.js.map +1 -1
  649. package/dist/utils/paths.d.ts.map +1 -1
  650. package/dist/utils/paths.js.map +1 -1
  651. package/dist/utils/photon.d.ts.map +1 -1
  652. package/dist/utils/photon.js.map +1 -1
  653. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  654. package/dist/utils/pi-user-agent.js.map +1 -1
  655. package/dist/utils/shell.d.ts.map +1 -1
  656. package/dist/utils/shell.js.map +1 -1
  657. package/dist/utils/sleep.d.ts.map +1 -1
  658. package/dist/utils/sleep.js.map +1 -1
  659. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  660. package/dist/utils/syntax-highlight.js.map +1 -1
  661. package/dist/utils/tools-manager.d.ts.map +1 -1
  662. package/dist/utils/tools-manager.js.map +1 -1
  663. package/dist/utils/version-check.d.ts.map +1 -1
  664. package/dist/utils/version-check.js.map +1 -1
  665. package/dist/utils/windows-self-update.d.ts.map +1 -1
  666. package/dist/utils/windows-self-update.js.map +1 -1
  667. package/docs/docs.json +4 -0
  668. package/docs/extensions.md +31 -2
  669. package/docs/index.md +1 -0
  670. package/docs/models.md +6 -39
  671. package/docs/packages.md +1 -1
  672. package/docs/prompt-templates.md +9 -2
  673. package/docs/sdk.md +5 -0
  674. package/docs/security.md +55 -0
  675. package/docs/settings.md +13 -0
  676. package/docs/skills.md +3 -3
  677. package/docs/terminal-setup.md +36 -2
  678. package/docs/themes.md +1 -1
  679. package/docs/tmux.md +4 -2
  680. package/docs/usage.md +18 -1
  681. package/examples/extensions/README.md +1 -0
  682. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  683. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  684. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  685. package/examples/extensions/gondolin/package-lock.json +2 -2
  686. package/examples/extensions/gondolin/package.json +1 -1
  687. package/examples/extensions/minimal-mode.ts +6 -6
  688. package/examples/extensions/project-trust.ts +64 -0
  689. package/examples/extensions/sandbox/package-lock.json +2 -2
  690. package/examples/extensions/sandbox/package.json +1 -1
  691. package/examples/extensions/with-deps/package-lock.json +2 -2
  692. package/examples/extensions/with-deps/package.json +1 -1
  693. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  694. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +125 -77
  695. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  696. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +7 -0
  697. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  698. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +2 -27
  699. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  700. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  701. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +7 -20
  702. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  703. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  704. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
  705. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +1 -1
  706. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
  707. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +1 -1
  708. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
  709. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -1
  710. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -1
  711. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
  712. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +0 -3
  713. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
  714. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
  715. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
  716. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -1
  717. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -1
  718. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -1
  719. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -3
  720. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +1 -1
  721. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -1
  722. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -7
  723. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -1
  724. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -1
  725. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +3 -1
  726. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +1 -1
  727. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -1
  728. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -5
  729. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -1
  730. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -1
  731. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -1
  732. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
  733. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +0 -1
  734. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
  735. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts.map +1 -1
  736. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js.map +1 -1
  737. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -1
  738. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -1
  739. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts.map +1 -1
  740. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js.map +1 -1
  741. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
  742. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +0 -16
  743. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
  744. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -1
  745. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -1
  746. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -1
  747. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -1
  748. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  749. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts.map +1 -1
  750. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
  751. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  752. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +6 -3
  753. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  754. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  755. package/node_modules/@earendil-works/pi-agent-core/package.json +6 -6
  756. package/node_modules/@earendil-works/pi-ai/README.md +2 -1
  757. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -1
  758. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -1
  759. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -1
  760. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts.map +1 -1
  761. package/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -1
  762. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
  763. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  764. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts.map +1 -1
  765. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +30 -0
  766. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  767. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +30 -0
  768. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  769. package/node_modules/@earendil-works/pi-ai/dist/image-models.js.map +1 -1
  770. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -1
  771. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -1
  772. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -1
  773. package/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -1
  774. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  775. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  776. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +533 -131
  777. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  778. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +530 -255
  779. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  780. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  781. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -1
  782. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  783. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +15 -7
  784. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  785. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +1 -1
  786. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  787. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +17 -7
  788. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
  789. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
  790. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -0
  791. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
  792. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts.map +1 -1
  793. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js.map +1 -1
  794. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  795. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  796. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
  797. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
  798. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
  799. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -1
  800. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -1
  801. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -1
  802. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -1
  803. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -1
  804. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -1
  805. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -1
  806. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -1
  807. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -1
  808. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -1
  809. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +3 -3
  810. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -1
  811. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
  812. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +0 -7
  813. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
  814. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
  815. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +5 -4
  816. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
  817. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -1
  818. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js.map +1 -1
  819. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -1
  820. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +2 -1
  821. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
  822. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
  823. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +3 -2
  824. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
  825. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
  826. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js.map +1 -1
  827. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +1 -1
  828. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
  829. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +2 -2
  830. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -1
  831. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts.map +1 -1
  832. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js.map +1 -1
  833. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts.map +1 -1
  834. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js.map +1 -1
  835. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -1
  836. package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -1
  837. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts.map +1 -1
  838. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map +1 -1
  839. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts.map +1 -1
  840. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js.map +1 -1
  841. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts.map +1 -1
  842. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js +10 -8
  843. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js.map +1 -1
  844. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts.map +1 -1
  845. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js.map +1 -1
  846. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts.map +1 -1
  847. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js.map +1 -1
  848. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts.map +1 -1
  849. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js.map +1 -1
  850. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts.map +1 -1
  851. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js.map +1 -1
  852. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts.map +1 -1
  853. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js.map +1 -1
  854. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts.map +1 -1
  855. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js.map +1 -1
  856. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts.map +1 -1
  857. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +6 -2
  858. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  859. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  860. package/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.d.ts.map +1 -1
  861. package/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js.map +1 -1
  862. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts.map +1 -1
  863. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js.map +1 -1
  864. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
  865. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +3 -7
  866. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
  867. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts.map +1 -1
  868. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js.map +1 -1
  869. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts.map +1 -1
  870. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js.map +1 -1
  871. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts.map +1 -1
  872. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js.map +1 -1
  873. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -1
  874. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -1
  875. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -1
  876. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +1 -1
  877. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.d.ts.map +1 -1
  878. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js.map +1 -1
  879. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  880. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  881. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +1 -1
  882. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +1 -1
  883. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -1
  884. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js.map +1 -1
  885. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
  886. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
  887. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts.map +1 -1
  888. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js.map +1 -1
  889. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts.map +1 -1
  890. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  891. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
  892. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -1
  893. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js.map +1 -1
  894. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts.map +1 -1
  895. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js.map +1 -1
  896. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -1
  897. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js.map +1 -1
  898. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -1
  899. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -1
  900. package/node_modules/@earendil-works/pi-ai/package.json +5 -5
  901. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +3 -1
  902. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
  903. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +0 -3
  904. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
  905. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -1
  906. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +1 -6
  907. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -1
  908. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -1
  909. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +4 -3
  910. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +1 -1
  911. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +6 -1
  912. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
  913. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +132 -93
  914. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  915. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -1
  916. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +0 -8
  917. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -1
  918. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
  919. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +14 -14
  920. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
  921. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +5 -0
  922. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -1
  923. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +29 -17
  924. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -1
  925. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
  926. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +0 -11
  927. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
  928. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -1
  929. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +4 -9
  930. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -1
  931. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
  932. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +4 -12
  933. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
  934. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +1 -1
  935. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +0 -1
  936. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +1 -1
  937. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -1
  938. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +0 -8
  939. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -1
  940. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +1 -1
  941. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +0 -3
  942. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +1 -1
  943. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +1 -1
  944. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -1
  945. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +131 -61
  946. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -1
  947. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  948. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  949. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +2 -4
  950. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  951. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -1
  952. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -1
  953. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +1 -1
  954. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +3 -1
  955. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +1 -1
  956. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -1
  957. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -1
  958. package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.d.ts.map +1 -1
  959. package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.js.map +1 -1
  960. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
  961. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +4 -6
  962. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -1
  963. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  964. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  965. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +4 -7
  966. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  967. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +60 -103
  968. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  969. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  970. package/node_modules/@earendil-works/pi-tui/dist/tui.js +39 -31
  971. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  972. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +1 -1
  973. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +3 -1
  974. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +1 -1
  975. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
  976. package/node_modules/@earendil-works/pi-tui/dist/utils.js +57 -27
  977. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
  978. package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts.map +1 -1
  979. package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js.map +1 -1
  980. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  981. package/node_modules/@types/node/README.md +3 -3
  982. package/node_modules/@types/node/assert/strict.d.ts +3 -55
  983. package/node_modules/@types/node/assert.d.ts +49 -177
  984. package/node_modules/@types/node/async_hooks.d.ts +151 -43
  985. package/node_modules/@types/node/buffer.buffer.d.ts +2 -8
  986. package/node_modules/@types/node/buffer.d.ts +43 -212
  987. package/node_modules/@types/node/child_process.d.ts +23 -133
  988. package/node_modules/@types/node/cluster.d.ts +238 -384
  989. package/node_modules/@types/node/compatibility/iterators.d.ts +1 -0
  990. package/node_modules/@types/node/console.d.ts +45 -404
  991. package/node_modules/@types/node/constants.d.ts +3 -10
  992. package/node_modules/@types/node/crypto.d.ts +640 -1127
  993. package/node_modules/@types/node/dgram.d.ts +14 -77
  994. package/node_modules/@types/node/diagnostics_channel.d.ts +3 -29
  995. package/node_modules/@types/node/dns/promises.d.ts +4 -10
  996. package/node_modules/@types/node/dns.d.ts +130 -177
  997. package/node_modules/@types/node/domain.d.ts +12 -32
  998. package/node_modules/@types/node/events.d.ts +872 -840
  999. package/node_modules/@types/node/fs/promises.d.ts +193 -20
  1000. package/node_modules/@types/node/fs.d.ts +754 -435
  1001. package/node_modules/@types/node/globals.d.ts +8 -30
  1002. package/node_modules/@types/node/globals.typedarray.d.ts +63 -0
  1003. package/node_modules/@types/node/http.d.ts +363 -305
  1004. package/node_modules/@types/node/http2.d.ts +545 -781
  1005. package/node_modules/@types/node/https.d.ts +64 -243
  1006. package/node_modules/@types/node/index.d.ts +26 -6
  1007. package/node_modules/@types/node/inspector/promises.d.ts +35 -0
  1008. package/node_modules/@types/node/inspector.d.ts +68 -57
  1009. package/node_modules/@types/node/inspector.generated.d.ts +764 -410
  1010. package/node_modules/@types/node/module.d.ts +53 -189
  1011. package/node_modules/@types/node/net.d.ts +101 -207
  1012. package/node_modules/@types/node/os.d.ts +11 -19
  1013. package/node_modules/@types/node/package.json +13 -3
  1014. package/node_modules/@types/node/path/posix.d.ts +8 -0
  1015. package/node_modules/@types/node/path/win32.d.ts +8 -0
  1016. package/node_modules/@types/node/path.d.ts +119 -141
  1017. package/node_modules/@types/node/perf_hooks.d.ts +317 -673
  1018. package/node_modules/@types/node/process.d.ts +277 -157
  1019. package/node_modules/@types/node/punycode.d.ts +3 -31
  1020. package/node_modules/@types/node/querystring.d.ts +3 -16
  1021. package/node_modules/@types/node/quic.d.ts +897 -0
  1022. package/node_modules/@types/node/readline/promises.d.ts +3 -6
  1023. package/node_modules/@types/node/readline.d.ts +65 -152
  1024. package/node_modules/@types/node/repl.d.ts +101 -109
  1025. package/node_modules/@types/node/sea.d.ts +9 -115
  1026. package/node_modules/@types/node/sqlite.d.ts +415 -68
  1027. package/node_modules/@types/node/stream/consumers.d.ts +91 -15
  1028. package/node_modules/@types/node/stream/iter.d.ts +301 -0
  1029. package/node_modules/@types/node/stream/promises.d.ts +136 -15
  1030. package/node_modules/@types/node/stream/web.d.ts +179 -501
  1031. package/node_modules/@types/node/stream.d.ts +577 -490
  1032. package/node_modules/@types/node/string_decoder.d.ts +3 -43
  1033. package/node_modules/@types/node/test/reporters.d.ts +59 -0
  1034. package/node_modules/@types/node/test.d.ts +402 -286
  1035. package/node_modules/@types/node/timers/promises.d.ts +3 -18
  1036. package/node_modules/@types/node/timers.d.ts +3 -141
  1037. package/node_modules/@types/node/tls.d.ts +115 -241
  1038. package/node_modules/@types/node/trace_events.d.ts +3 -97
  1039. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +2 -8
  1040. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  1041. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +2 -0
  1042. package/node_modules/@types/node/ts5.6/index.d.ts +28 -6
  1043. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  1044. package/node_modules/@types/node/ts5.7/index.d.ts +119 -0
  1045. package/node_modules/@types/node/tty.d.ts +57 -40
  1046. package/node_modules/@types/node/url.d.ts +156 -584
  1047. package/node_modules/@types/node/util/types.d.ts +558 -0
  1048. package/node_modules/@types/node/util.d.ts +167 -1096
  1049. package/node_modules/@types/node/v8.d.ts +75 -15
  1050. package/node_modules/@types/node/vm.d.ts +334 -198
  1051. package/node_modules/@types/node/wasi.d.ts +24 -74
  1052. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  1053. package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  1054. package/node_modules/@types/node/web-globals/console.d.ts +9 -0
  1055. package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  1056. package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  1057. package/node_modules/@types/node/web-globals/events.d.ts +9 -0
  1058. package/node_modules/@types/node/web-globals/fetch.d.ts +14 -0
  1059. package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  1060. package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  1061. package/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
  1062. package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  1063. package/node_modules/@types/node/web-globals/streams.d.ts +115 -0
  1064. package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  1065. package/node_modules/@types/node/web-globals/url.d.ts +24 -0
  1066. package/node_modules/@types/node/worker_threads.d.ts +280 -393
  1067. package/node_modules/@types/node/zlib/iter.d.ts +131 -0
  1068. package/node_modules/@types/node/zlib.d.ts +7 -165
  1069. package/node_modules/undici-types/agent.d.ts +13 -12
  1070. package/node_modules/undici-types/api.d.ts +26 -26
  1071. package/node_modules/undici-types/balanced-pool.d.ts +13 -12
  1072. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  1073. package/node_modules/undici-types/client-stats.d.ts +15 -0
  1074. package/node_modules/undici-types/client.d.ts +34 -19
  1075. package/node_modules/undici-types/connector.d.ts +4 -2
  1076. package/node_modules/undici-types/cookies.d.ts +2 -0
  1077. package/node_modules/undici-types/diagnostics-channel.d.ts +18 -10
  1078. package/node_modules/undici-types/dispatcher.d.ts +127 -104
  1079. package/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
  1080. package/node_modules/undici-types/errors.d.ts +82 -54
  1081. package/node_modules/undici-types/eventsource.d.ts +9 -4
  1082. package/node_modules/undici-types/fetch.d.ts +22 -20
  1083. package/node_modules/undici-types/formdata.d.ts +7 -7
  1084. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  1085. package/node_modules/undici-types/global-origin.d.ts +5 -5
  1086. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  1087. package/node_modules/undici-types/handlers.d.ts +8 -8
  1088. package/node_modules/undici-types/header.d.ts +157 -1
  1089. package/node_modules/undici-types/index.d.ts +67 -47
  1090. package/node_modules/undici-types/interceptors.d.ts +71 -8
  1091. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  1092. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  1093. package/node_modules/undici-types/mock-client.d.ts +6 -4
  1094. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  1095. package/node_modules/undici-types/mock-interceptor.d.ts +21 -20
  1096. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  1097. package/node_modules/undici-types/package.json +1 -1
  1098. package/node_modules/undici-types/patch.d.ts +0 -4
  1099. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  1100. package/node_modules/undici-types/pool.d.ts +15 -13
  1101. package/node_modules/undici-types/proxy-agent.d.ts +5 -4
  1102. package/node_modules/undici-types/readable.d.ts +19 -16
  1103. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  1104. package/node_modules/undici-types/retry-handler.d.ts +19 -10
  1105. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  1106. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  1107. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  1108. package/node_modules/undici-types/util.d.ts +3 -3
  1109. package/node_modules/undici-types/utility.d.ts +7 -0
  1110. package/node_modules/undici-types/webidl.d.ts +148 -29
  1111. package/node_modules/undici-types/websocket.d.ts +48 -10
  1112. package/npm-shrinkwrap.json +21 -21
  1113. package/package.json +13 -12
  1114. package/dist/core/extensions/builtin/todotools/continuation/config.d.ts +0 -10
  1115. package/dist/core/extensions/builtin/todotools/continuation/config.d.ts.map +0 -1
  1116. package/dist/core/extensions/builtin/todotools/continuation/config.js +0 -33
  1117. package/dist/core/extensions/builtin/todotools/continuation/config.js.map +0 -1
  1118. package/dist/core/extensions/builtin/todotools/continuation/index.d.ts +0 -2
  1119. package/dist/core/extensions/builtin/todotools/continuation/index.d.ts.map +0 -1
  1120. package/dist/core/extensions/builtin/todotools/continuation/index.js +0 -2
  1121. package/dist/core/extensions/builtin/todotools/continuation/index.js.map +0 -1
  1122. package/dist/core/extensions/builtin/todotools/continuation/prompt.d.ts +0 -5
  1123. package/dist/core/extensions/builtin/todotools/continuation/prompt.d.ts.map +0 -1
  1124. package/dist/core/extensions/builtin/todotools/continuation/prompt.js +0 -34
  1125. package/dist/core/extensions/builtin/todotools/continuation/prompt.js.map +0 -1
  1126. package/dist/core/extensions/builtin/todotools/continuation/runtime.d.ts +0 -11
  1127. package/dist/core/extensions/builtin/todotools/continuation/runtime.d.ts.map +0 -1
  1128. package/dist/core/extensions/builtin/todotools/continuation/runtime.js +0 -201
  1129. package/dist/core/extensions/builtin/todotools/continuation/runtime.js.map +0 -1
  1130. package/dist/core/extensions/builtin/todotools/settings.d.ts +0 -6
  1131. package/dist/core/extensions/builtin/todotools/settings.d.ts.map +0 -1
  1132. package/dist/core/extensions/builtin/todotools/settings.js +0 -58
  1133. package/dist/core/extensions/builtin/todotools/settings.js.map +0 -1
  1134. package/dist/core/extensions/builtin/todotools/system-messages.d.ts +0 -34
  1135. package/dist/core/extensions/builtin/todotools/system-messages.d.ts.map +0 -1
  1136. package/dist/core/extensions/builtin/todotools/system-messages.js +0 -82
  1137. package/dist/core/extensions/builtin/todotools/system-messages.js.map +0 -1
  1138. package/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
  1139. package/node_modules/@types/node/compatibility/index.d.ts +0 -9
  1140. package/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  1141. package/node_modules/undici-types/file.d.ts +0 -39
  1142. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/components/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,MAAM,OAAO,IAAI;IACR,IAAI,CAAS;IACb,QAAQ,CAAS,CAAC,qBAAqB;IACvC,QAAQ,CAAS,CAAC,qBAAqB;IACvC,UAAU,CAA4B;IAE9C,4BAA4B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,UAAU,CAAC,CAAC;gBACtD,YAAY,CAAC,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;YAChE,CAAC;QACF,CAAC;QAED,uCAAuC;QACvC,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACpG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,YAAY,EAAE,GAAG,UAAU,CAAC,CAAC;QAE/D,eAAe;QACf,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAE1B,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAAA,CACzC;CACD","sourcesContent":["import type { Component } from \"../tui.ts\";\nimport { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from \"../utils.ts\";\n\n/**\n * Text component - displays multi-line text with word wrapping\n */\nexport class Text implements Component {\n\tprivate text: string;\n\tprivate paddingX: number; // Left/right padding\n\tprivate paddingY: number; // Top/bottom padding\n\tprivate customBgFn?: (text: string) => string;\n\n\t// Cache for rendered output\n\tprivate cachedText?: string;\n\tprivate cachedWidth?: number;\n\tprivate cachedLines?: string[];\n\n\tconstructor(text: string = \"\", paddingX: number = 1, paddingY: number = 1, customBgFn?: (text: string) => string) {\n\t\tthis.text = text;\n\t\tthis.paddingX = paddingX;\n\t\tthis.paddingY = paddingY;\n\t\tthis.customBgFn = customBgFn;\n\t}\n\n\tsetText(text: string): void {\n\t\tthis.text = text;\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\tsetCustomBgFn(customBgFn?: (text: string) => string): void {\n\t\tthis.customBgFn = customBgFn;\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\trender(width: number): string[] {\n\t\t// Check cache\n\t\tif (this.cachedLines && this.cachedText === this.text && this.cachedWidth === width) {\n\t\t\treturn this.cachedLines;\n\t\t}\n\n\t\t// Don't render anything if there's no actual text\n\t\tif (!this.text || this.text.trim() === \"\") {\n\t\t\tconst result: string[] = [];\n\t\t\tthis.cachedText = this.text;\n\t\t\tthis.cachedWidth = width;\n\t\t\tthis.cachedLines = result;\n\t\t\treturn result;\n\t\t}\n\n\t\t// Replace tabs with 3 spaces\n\t\tconst normalizedText = this.text.replace(/\\t/g, \" \");\n\n\t\t// Calculate content width (subtract left/right margins)\n\t\tconst contentWidth = Math.max(1, width - this.paddingX * 2);\n\n\t\t// Wrap text (this preserves ANSI codes but does NOT pad)\n\t\tconst wrappedLines = wrapTextWithAnsi(normalizedText, contentWidth);\n\n\t\t// Add margins and background to each line\n\t\tconst leftMargin = \" \".repeat(this.paddingX);\n\t\tconst rightMargin = \" \".repeat(this.paddingX);\n\t\tconst contentLines: string[] = [];\n\n\t\tfor (const line of wrappedLines) {\n\t\t\t// Add margins\n\t\t\tconst lineWithMargins = leftMargin + line + rightMargin;\n\n\t\t\t// Apply background if specified (this also pads to full width)\n\t\t\tif (this.customBgFn) {\n\t\t\t\tcontentLines.push(applyBackgroundToLine(lineWithMargins, width, this.customBgFn));\n\t\t\t} else {\n\t\t\t\t// No background - just pad to width with spaces\n\t\t\t\tconst visibleLen = visibleWidth(lineWithMargins);\n\t\t\t\tconst paddingNeeded = Math.max(0, width - visibleLen);\n\t\t\t\tcontentLines.push(lineWithMargins + \" \".repeat(paddingNeeded));\n\t\t\t}\n\t\t}\n\n\t\t// Add top/bottom padding (empty lines)\n\t\tconst emptyLine = \" \".repeat(width);\n\t\tconst emptyLines: string[] = [];\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tconst line = this.customBgFn ? applyBackgroundToLine(emptyLine, width, this.customBgFn) : emptyLine;\n\t\t\temptyLines.push(line);\n\t\t}\n\n\t\tconst result = [...emptyLines, ...contentLines, ...emptyLines];\n\n\t\t// Update cache\n\t\tthis.cachedText = this.text;\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = result;\n\n\t\treturn result.length > 0 ? result : [\"\"];\n\t}\n}\n"]}
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/components/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,MAAM,OAAO,IAAI;IAWhB,YAAY,IAAI,GAAW,EAAE,EAAE,QAAQ,GAAW,CAAC,EAAE,QAAQ,GAAW,CAAC,EAAE,UAAqC;QAC/G,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,IAAY;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B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CAAC,SAAS,CAAC;YACpG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,YAAY,EAAE,GAAG,UAAU,CAAC,CAAC;QAE/D,eAAe;QACf,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAE1B,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;CACD","sourcesContent":["import type { Component } from \"../tui.ts\";\nimport { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from \"../utils.ts\";\n\n/**\n * Text component - displays multi-line text with word wrapping\n */\nexport class Text implements Component {\n\tprivate text: string;\n\tprivate paddingX: number; // Left/right padding\n\tprivate paddingY: number; // Top/bottom padding\n\tprivate customBgFn?: (text: string) => string;\n\n\t// Cache for rendered output\n\tprivate cachedText?: string;\n\tprivate cachedWidth?: number;\n\tprivate cachedLines?: string[];\n\n\tconstructor(text: string = \"\", paddingX: number = 1, paddingY: number = 1, customBgFn?: (text: string) => string) {\n\t\tthis.text = text;\n\t\tthis.paddingX = paddingX;\n\t\tthis.paddingY = paddingY;\n\t\tthis.customBgFn = customBgFn;\n\t}\n\n\tsetText(text: string): void {\n\t\tthis.text = text;\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\tsetCustomBgFn(customBgFn?: (text: string) => string): void {\n\t\tthis.customBgFn = customBgFn;\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\trender(width: number): string[] {\n\t\t// Check cache\n\t\tif (this.cachedLines && this.cachedText === this.text && this.cachedWidth === width) {\n\t\t\treturn this.cachedLines;\n\t\t}\n\n\t\t// Don't render anything if there's no actual text\n\t\tif (!this.text || this.text.trim() === \"\") {\n\t\t\tconst result: string[] = [];\n\t\t\tthis.cachedText = this.text;\n\t\t\tthis.cachedWidth = width;\n\t\t\tthis.cachedLines = result;\n\t\t\treturn result;\n\t\t}\n\n\t\t// Replace tabs with 3 spaces\n\t\tconst normalizedText = this.text.replace(/\\t/g, \" \");\n\n\t\t// Calculate content width (subtract left/right margins)\n\t\tconst contentWidth = Math.max(1, width - this.paddingX * 2);\n\n\t\t// Wrap text (this preserves ANSI codes but does NOT pad)\n\t\tconst wrappedLines = wrapTextWithAnsi(normalizedText, contentWidth);\n\n\t\t// Add margins and background to each line\n\t\tconst leftMargin = \" \".repeat(this.paddingX);\n\t\tconst rightMargin = \" \".repeat(this.paddingX);\n\t\tconst contentLines: string[] = [];\n\n\t\tfor (const line of wrappedLines) {\n\t\t\t// Add margins\n\t\t\tconst lineWithMargins = leftMargin + line + rightMargin;\n\n\t\t\t// Apply background if specified (this also pads to full width)\n\t\t\tif (this.customBgFn) {\n\t\t\t\tcontentLines.push(applyBackgroundToLine(lineWithMargins, width, this.customBgFn));\n\t\t\t} else {\n\t\t\t\t// No background - just pad to width with spaces\n\t\t\t\tconst visibleLen = visibleWidth(lineWithMargins);\n\t\t\t\tconst paddingNeeded = Math.max(0, width - visibleLen);\n\t\t\t\tcontentLines.push(lineWithMargins + \" \".repeat(paddingNeeded));\n\t\t\t}\n\t\t}\n\n\t\t// Add top/bottom padding (empty lines)\n\t\tconst emptyLine = \" \".repeat(width);\n\t\tconst emptyLines: string[] = [];\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tconst line = this.customBgFn ? applyBackgroundToLine(emptyLine, width, this.customBgFn) : emptyLine;\n\t\t\temptyLines.push(line);\n\t\t}\n\n\t\tconst result = [...emptyLines, ...contentLines, ...emptyLines];\n\n\t\t// Update cache\n\t\tthis.cachedText = this.text;\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = result;\n\n\t\treturn result.length > 0 ? result : [\"\"];\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"truncated-text.d.ts","sourceRoot":"","sources":["../../src/components/truncated-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;GAEG;AACH,qBAAa,aAAc,YAAW,SAAS;IAC9C,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IAEzB,YAAY,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,EAAE,QAAQ,GAAE,MAAU,EAInE;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA0C9B;CACD","sourcesContent":["import type { Component } from \"../tui.ts\";\nimport { truncateToWidth, visibleWidth } from \"../utils.ts\";\n\n/**\n * Text component that truncates to fit viewport width\n */\nexport class TruncatedText implements Component {\n\tprivate text: string;\n\tprivate paddingX: number;\n\tprivate paddingY: number;\n\n\tconstructor(text: string, paddingX: number = 0, paddingY: number = 0) {\n\t\tthis.text = text;\n\t\tthis.paddingX = paddingX;\n\t\tthis.paddingY = paddingY;\n\t}\n\n\tinvalidate(): void {\n\t\t// No cached state to invalidate currently\n\t}\n\n\trender(width: number): string[] {\n\t\tconst result: string[] = [];\n\n\t\t// Empty line padded to width\n\t\tconst emptyLine = \" \".repeat(width);\n\n\t\t// Add vertical padding above\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tresult.push(emptyLine);\n\t\t}\n\n\t\t// Calculate available width after horizontal padding\n\t\tconst availableWidth = Math.max(1, width - this.paddingX * 2);\n\n\t\t// Take only the first line (stop at newline)\n\t\tlet singleLineText = this.text;\n\t\tconst newlineIndex = this.text.indexOf(\"\\n\");\n\t\tif (newlineIndex !== -1) {\n\t\t\tsingleLineText = this.text.substring(0, newlineIndex);\n\t\t}\n\n\t\t// Truncate text if needed (accounting for ANSI codes)\n\t\tconst displayText = truncateToWidth(singleLineText, availableWidth);\n\n\t\t// Add horizontal padding\n\t\tconst leftPadding = \" \".repeat(this.paddingX);\n\t\tconst rightPadding = \" \".repeat(this.paddingX);\n\t\tconst lineWithPadding = leftPadding + displayText + rightPadding;\n\n\t\t// Pad line to exactly width characters\n\t\tconst lineVisibleWidth = visibleWidth(lineWithPadding);\n\t\tconst paddingNeeded = Math.max(0, width - lineVisibleWidth);\n\t\tconst finalLine = lineWithPadding + \" \".repeat(paddingNeeded);\n\n\t\tresult.push(finalLine);\n\n\t\t// Add vertical padding below\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tresult.push(emptyLine);\n\t\t}\n\n\t\treturn result;\n\t}\n}\n"]}
1
+ {"version":3,"file":"truncated-text.d.ts","sourceRoot":"","sources":["../../src/components/truncated-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;GAEG;AACH,qBAAa,aAAc,YAAW,SAAS;IAC9C,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IAEzB,YAAY,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,EAAE,QAAQ,GAAE,MAAU,EAInE;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA0C9B;CACD"}
@@ -3,9 +3,6 @@ import { truncateToWidth, visibleWidth } from "../utils.js";
3
3
  * Text component that truncates to fit viewport width
4
4
  */
5
5
  export class TruncatedText {
6
- text;
7
- paddingX;
8
- paddingY;
9
6
  constructor(text, paddingX = 0, paddingY = 0) {
10
7
  this.text = text;
11
8
  this.paddingX = paddingX;
@@ -1 +1 @@
1
- {"version":3,"file":"truncated-text.js","sourceRoot":"","sources":["../../src/components/truncated-text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,aAAa;IACjB,IAAI,CAAS;IACb,QAAQ,CAAS;IACjB,QAAQ,CAAS;IAEzB,YAAY,IAAY,EAAE,QAAQ,GAAW,CAAC,EAAE,QAAQ,GAAW,CAAC,EAAE;QACrE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAAA,CACzB;IAED,UAAU,GAAS;QAClB,0CAA0C;IADvB,CAEnB;IAED,MAAM,CAAC,KAAa,EAAY;QAC/B,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,6BAA6B;QAC7B,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEpC,6BAA6B;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,CAAC;QAED,qDAAqD;QACrD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QAE9D,6CAA6C;QAC7C,IAAI,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC;QAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QACvD,CAAC;QAED,sDAAsD;QACtD,MAAM,WAAW,GAAG,eAAe,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAEpE,yBAAyB;QACzB,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,eAAe,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,CAAC;QAEjE,uCAAuC;QACvC,MAAM,gBAAgB,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;QACvD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,gBAAgB,CAAC,CAAC;QAC5D,MAAM,SAAS,GAAG,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAE9D,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEvB,6BAA6B;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,MAAM,CAAC;IAAA,CACd;CACD","sourcesContent":["import type { Component } from \"../tui.ts\";\nimport { truncateToWidth, visibleWidth } from \"../utils.ts\";\n\n/**\n * Text component that truncates to fit viewport width\n */\nexport class TruncatedText implements Component {\n\tprivate text: string;\n\tprivate paddingX: number;\n\tprivate paddingY: number;\n\n\tconstructor(text: string, paddingX: number = 0, paddingY: number = 0) {\n\t\tthis.text = text;\n\t\tthis.paddingX = paddingX;\n\t\tthis.paddingY = paddingY;\n\t}\n\n\tinvalidate(): void {\n\t\t// No cached state to invalidate currently\n\t}\n\n\trender(width: number): string[] {\n\t\tconst result: string[] = [];\n\n\t\t// Empty line padded to width\n\t\tconst emptyLine = \" \".repeat(width);\n\n\t\t// Add vertical padding above\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tresult.push(emptyLine);\n\t\t}\n\n\t\t// Calculate available width after horizontal padding\n\t\tconst availableWidth = Math.max(1, width - this.paddingX * 2);\n\n\t\t// Take only the first line (stop at newline)\n\t\tlet singleLineText = this.text;\n\t\tconst newlineIndex = this.text.indexOf(\"\\n\");\n\t\tif (newlineIndex !== -1) {\n\t\t\tsingleLineText = this.text.substring(0, newlineIndex);\n\t\t}\n\n\t\t// Truncate text if needed (accounting for ANSI codes)\n\t\tconst displayText = truncateToWidth(singleLineText, availableWidth);\n\n\t\t// Add horizontal padding\n\t\tconst leftPadding = \" \".repeat(this.paddingX);\n\t\tconst rightPadding = \" \".repeat(this.paddingX);\n\t\tconst lineWithPadding = leftPadding + displayText + rightPadding;\n\n\t\t// Pad line to exactly width characters\n\t\tconst lineVisibleWidth = visibleWidth(lineWithPadding);\n\t\tconst paddingNeeded = Math.max(0, width - lineVisibleWidth);\n\t\tconst finalLine = lineWithPadding + \" \".repeat(paddingNeeded);\n\n\t\tresult.push(finalLine);\n\n\t\t// Add vertical padding below\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tresult.push(emptyLine);\n\t\t}\n\n\t\treturn result;\n\t}\n}\n"]}
1
+ {"version":3,"file":"truncated-text.js","sourceRoot":"","sources":["../../src/components/truncated-text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,aAAa;IAKzB,YAAY,IAAY,EAAE,QAAQ,GAAW,CAAC,EAAE,QAAQ,GAAW,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,C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,CAAC,EAAE,KAAK,GAAG,gBAAgB,CAAC,CAAC;QAC5D,MAAM,SAAS,GAAG,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAE9D,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEvB,6BAA6B;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;CACD","sourcesContent":["import type { Component } from \"../tui.ts\";\nimport { truncateToWidth, visibleWidth } from \"../utils.ts\";\n\n/**\n * Text component that truncates to fit viewport width\n */\nexport class TruncatedText implements Component {\n\tprivate text: string;\n\tprivate paddingX: number;\n\tprivate paddingY: number;\n\n\tconstructor(text: string, paddingX: number = 0, paddingY: number = 0) {\n\t\tthis.text = text;\n\t\tthis.paddingX = paddingX;\n\t\tthis.paddingY = paddingY;\n\t}\n\n\tinvalidate(): void {\n\t\t// No cached state to invalidate currently\n\t}\n\n\trender(width: number): string[] {\n\t\tconst result: string[] = [];\n\n\t\t// Empty line padded to width\n\t\tconst emptyLine = \" \".repeat(width);\n\n\t\t// Add vertical padding above\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tresult.push(emptyLine);\n\t\t}\n\n\t\t// Calculate available width after horizontal padding\n\t\tconst availableWidth = Math.max(1, width - this.paddingX * 2);\n\n\t\t// Take only the first line (stop at newline)\n\t\tlet singleLineText = this.text;\n\t\tconst newlineIndex = this.text.indexOf(\"\\n\");\n\t\tif (newlineIndex !== -1) {\n\t\t\tsingleLineText = this.text.substring(0, newlineIndex);\n\t\t}\n\n\t\t// Truncate text if needed (accounting for ANSI codes)\n\t\tconst displayText = truncateToWidth(singleLineText, availableWidth);\n\n\t\t// Add horizontal padding\n\t\tconst leftPadding = \" \".repeat(this.paddingX);\n\t\tconst rightPadding = \" \".repeat(this.paddingX);\n\t\tconst lineWithPadding = leftPadding + displayText + rightPadding;\n\n\t\t// Pad line to exactly width characters\n\t\tconst lineVisibleWidth = visibleWidth(lineWithPadding);\n\t\tconst paddingNeeded = Math.max(0, width - lineVisibleWidth);\n\t\tconst finalLine = lineWithPadding + \" \".repeat(paddingNeeded);\n\n\t\tresult.push(finalLine);\n\n\t\t// Add vertical padding below\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tresult.push(emptyLine);\n\t\t}\n\n\t\treturn result;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"editor-component.d.ts","sourceRoot":"","sources":["../src/editor-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAKjD,mCAAmC;IACnC,OAAO,IAAI,MAAM,CAAC;IAElB,2BAA2B;IAC3B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,qEAAqE;IACrE,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAMhC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAMlC,iDAAiD;IACjD,YAAY,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAMlC,6CAA6C;IAC7C,kBAAkB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC;;;OAGG;IACH,eAAe,CAAC,IAAI,MAAM,CAAC;IAM3B,oCAAoC;IACpC,uBAAuB,CAAC,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAM/D,4BAA4B;IAC5B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtC,6BAA6B;IAC7B,WAAW,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,qDAAqD;IACrD,yBAAyB,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACrD","sourcesContent":["import type { AutocompleteProvider } from \"./autocomplete.ts\";\nimport type { Component } from \"./tui.ts\";\n\n/**\n * Interface for custom editor components.\n *\n * This allows extensions to provide their own editor implementation\n * (e.g., vim mode, emacs mode, custom keybindings) while maintaining\n * compatibility with the core application.\n */\nexport interface EditorComponent extends Component {\n\t// =========================================================================\n\t// Core text access (required)\n\t// =========================================================================\n\n\t/** Get the current text content */\n\tgetText(): string;\n\n\t/** Set the text content */\n\tsetText(text: string): void;\n\n\t/** Handle raw terminal input (key presses, paste sequences, etc.) */\n\thandleInput(data: string): void;\n\n\t// =========================================================================\n\t// Callbacks (required)\n\t// =========================================================================\n\n\t/** Called when user submits (e.g., Enter key) */\n\tonSubmit?: (text: string) => void;\n\n\t/** Called when text changes */\n\tonChange?: (text: string) => void;\n\n\t// =========================================================================\n\t// History support (optional)\n\t// =========================================================================\n\n\t/** Add text to history for up/down navigation */\n\taddToHistory?(text: string): void;\n\n\t// =========================================================================\n\t// Advanced text manipulation (optional)\n\t// =========================================================================\n\n\t/** Insert text at current cursor position */\n\tinsertTextAtCursor?(text: string): void;\n\n\t/**\n\t * Get text with any markers expanded (e.g., paste markers).\n\t * Falls back to getText() if not implemented.\n\t */\n\tgetExpandedText?(): string;\n\n\t// =========================================================================\n\t// Autocomplete support (optional)\n\t// =========================================================================\n\n\t/** Set the autocomplete provider */\n\tsetAutocompleteProvider?(provider: AutocompleteProvider): void;\n\n\t// =========================================================================\n\t// Appearance (optional)\n\t// =========================================================================\n\n\t/** Border color function */\n\tborderColor?: (str: string) => string;\n\n\t/** Set horizontal padding */\n\tsetPaddingX?(padding: number): void;\n\n\t/** Set max visible items in autocomplete dropdown */\n\tsetAutocompleteMaxVisible?(maxVisible: number): void;\n}\n"]}
1
+ {"version":3,"file":"editor-component.d.ts","sourceRoot":"","sources":["../src/editor-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAKjD,mCAAmC;IACnC,OAAO,IAAI,MAAM,CAAC;IAElB,2BAA2B;IAC3B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,qEAAqE;IACrE,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAMhC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAMlC,iDAAiD;IACjD,YAAY,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAMlC,6CAA6C;IAC7C,kBAAkB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC;;;OAGG;IACH,eAAe,CAAC,IAAI,MAAM,CAAC;IAM3B,oCAAoC;IACpC,uBAAuB,CAAC,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAM/D,4BAA4B;IAC5B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtC,6BAA6B;IAC7B,WAAW,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,qDAAqD;IACrD,yBAAyB,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"fuzzy.d.ts","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAiFlE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,CAAC,EAAE,CAsC3F","sourcesContent":["/**\n * Fuzzy matching utilities.\n * Matches if all query characters appear in order (not necessarily consecutive).\n * Lower score = better match.\n */\n\nexport interface FuzzyMatch {\n\tmatches: boolean;\n\tscore: number;\n}\n\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch {\n\tconst queryLower = query.toLowerCase();\n\tconst textLower = text.toLowerCase();\n\n\tconst matchQuery = (normalizedQuery: string): FuzzyMatch => {\n\t\tif (normalizedQuery.length === 0) {\n\t\t\treturn { matches: true, score: 0 };\n\t\t}\n\n\t\tif (normalizedQuery.length > textLower.length) {\n\t\t\treturn { matches: false, score: 0 };\n\t\t}\n\n\t\tlet queryIndex = 0;\n\t\tlet score = 0;\n\t\tlet lastMatchIndex = -1;\n\t\tlet consecutiveMatches = 0;\n\n\t\tfor (let i = 0; i < textLower.length && queryIndex < normalizedQuery.length; i++) {\n\t\t\tif (textLower[i] === normalizedQuery[queryIndex]) {\n\t\t\t\tconst isWordBoundary = i === 0 || /[\\s\\-_./:]/.test(textLower[i - 1]!);\n\n\t\t\t\t// Reward consecutive matches\n\t\t\t\tif (lastMatchIndex === i - 1) {\n\t\t\t\t\tconsecutiveMatches++;\n\t\t\t\t\tscore -= consecutiveMatches * 5;\n\t\t\t\t} else {\n\t\t\t\t\tconsecutiveMatches = 0;\n\t\t\t\t\t// Penalize gaps\n\t\t\t\t\tif (lastMatchIndex >= 0) {\n\t\t\t\t\t\tscore += (i - lastMatchIndex - 1) * 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Reward word boundary matches\n\t\t\t\tif (isWordBoundary) {\n\t\t\t\t\tscore -= 10;\n\t\t\t\t}\n\n\t\t\t\t// Slight penalty for later matches\n\t\t\t\tscore += i * 0.1;\n\n\t\t\t\tlastMatchIndex = i;\n\t\t\t\tqueryIndex++;\n\t\t\t}\n\t\t}\n\n\t\tif (queryIndex < normalizedQuery.length) {\n\t\t\treturn { matches: false, score: 0 };\n\t\t}\n\n\t\tif (normalizedQuery === textLower) {\n\t\t\tscore -= 100;\n\t\t}\n\n\t\treturn { matches: true, score };\n\t};\n\n\tconst primaryMatch = matchQuery(queryLower);\n\tif (primaryMatch.matches) {\n\t\treturn primaryMatch;\n\t}\n\n\tconst alphaNumericMatch = queryLower.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/);\n\tconst numericAlphaMatch = queryLower.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/);\n\tconst swappedQuery = alphaNumericMatch\n\t\t? `${alphaNumericMatch.groups?.digits ?? \"\"}${alphaNumericMatch.groups?.letters ?? \"\"}`\n\t\t: numericAlphaMatch\n\t\t\t? `${numericAlphaMatch.groups?.letters ?? \"\"}${numericAlphaMatch.groups?.digits ?? \"\"}`\n\t\t\t: \"\";\n\n\tif (!swappedQuery) {\n\t\treturn primaryMatch;\n\t}\n\n\tconst swappedMatch = matchQuery(swappedQuery);\n\tif (!swappedMatch.matches) {\n\t\treturn primaryMatch;\n\t}\n\n\treturn { matches: true, score: swappedMatch.score + 5 };\n}\n\n/**\n * Filter and sort items by fuzzy match quality (best matches first).\n * Supports space-separated tokens: all tokens must match.\n */\nexport function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[] {\n\tif (!query.trim()) {\n\t\treturn items;\n\t}\n\n\tconst tokens = query\n\t\t.trim()\n\t\t.split(/\\s+/)\n\t\t.filter((t) => t.length > 0);\n\n\tif (tokens.length === 0) {\n\t\treturn items;\n\t}\n\n\tconst results: { item: T; totalScore: number }[] = [];\n\n\tfor (const item of items) {\n\t\tconst text = getText(item);\n\t\tlet totalScore = 0;\n\t\tlet allMatch = true;\n\n\t\tfor (const token of tokens) {\n\t\t\tconst match = fuzzyMatch(token, text);\n\t\t\tif (match.matches) {\n\t\t\t\ttotalScore += match.score;\n\t\t\t} else {\n\t\t\t\tallMatch = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (allMatch) {\n\t\t\tresults.push({ item, totalScore });\n\t\t}\n\t}\n\n\tresults.sort((a, b) => a.totalScore - b.totalScore);\n\treturn results.map((r) => r.item);\n}\n"]}
1
+ {"version":3,"file":"fuzzy.d.ts","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACd;AA2ID,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAsBlE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,CAAC,EAAE,CAsC3F"}
@@ -3,72 +3,142 @@
3
3
  * Matches if all query characters appear in order (not necessarily consecutive).
4
4
  * Lower score = better match.
5
5
  */
6
- export function fuzzyMatch(query, text) {
7
- const queryLower = query.toLowerCase();
8
- const textLower = text.toLowerCase();
9
- const matchQuery = (normalizedQuery) => {
10
- if (normalizedQuery.length === 0) {
11
- return { matches: true, score: 0 };
12
- }
13
- if (normalizedQuery.length > textLower.length) {
14
- return { matches: false, score: 0 };
15
- }
16
- let queryIndex = 0;
17
- let score = 0;
18
- let lastMatchIndex = -1;
19
- let consecutiveMatches = 0;
20
- for (let i = 0; i < textLower.length && queryIndex < normalizedQuery.length; i++) {
21
- if (textLower[i] === normalizedQuery[queryIndex]) {
22
- const isWordBoundary = i === 0 || /[\s\-_./:]/.test(textLower[i - 1]);
23
- // Reward consecutive matches
24
- if (lastMatchIndex === i - 1) {
25
- consecutiveMatches++;
26
- score -= consecutiveMatches * 5;
27
- }
28
- else {
29
- consecutiveMatches = 0;
30
- // Penalize gaps
31
- if (lastMatchIndex >= 0) {
32
- score += (i - lastMatchIndex - 1) * 2;
33
- }
34
- }
35
- // Reward word boundary matches
36
- if (isWordBoundary) {
37
- score -= 10;
6
+ const ALPHANUMERIC_SWAP_PENALTY = 5;
7
+ function isAsciiLetter(char) {
8
+ if (!char) {
9
+ return false;
10
+ }
11
+ const code = char.charCodeAt(0);
12
+ return code >= 97 && code <= 122;
13
+ }
14
+ function isAsciiDigit(char) {
15
+ if (!char) {
16
+ return false;
17
+ }
18
+ const code = char.charCodeAt(0);
19
+ return code >= 48 && code <= 57;
20
+ }
21
+ function isWordBoundaryPrefix(char) {
22
+ switch (char) {
23
+ case " ":
24
+ case "\t":
25
+ case "\n":
26
+ case "\r":
27
+ case "-":
28
+ case "_":
29
+ case ".":
30
+ case "/":
31
+ case ":":
32
+ return true;
33
+ default:
34
+ return false;
35
+ }
36
+ }
37
+ function scoreMatch(queryLower, textLower) {
38
+ if (queryLower.length === 0) {
39
+ return { matches: true, score: 0 };
40
+ }
41
+ if (queryLower.length > textLower.length) {
42
+ return { matches: false, score: 0 };
43
+ }
44
+ let queryIndex = 0;
45
+ let score = 0;
46
+ let lastMatchIndex = -1;
47
+ let consecutiveMatches = 0;
48
+ for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) {
49
+ if (textLower[i] === queryLower[queryIndex]) {
50
+ const isWordBoundary = i === 0 || isWordBoundaryPrefix(textLower[i - 1]);
51
+ // Reward consecutive matches
52
+ if (lastMatchIndex === i - 1) {
53
+ consecutiveMatches++;
54
+ score -= consecutiveMatches * 5;
55
+ }
56
+ else {
57
+ consecutiveMatches = 0;
58
+ // Penalize gaps
59
+ if (lastMatchIndex >= 0) {
60
+ score += (i - lastMatchIndex - 1) * 2;
38
61
  }
39
- // Slight penalty for later matches
40
- score += i * 0.1;
41
- lastMatchIndex = i;
42
- queryIndex++;
43
62
  }
63
+ // Reward word boundary matches
64
+ if (isWordBoundary) {
65
+ score -= 10;
66
+ }
67
+ // Slight penalty for later matches
68
+ score += i * 0.1;
69
+ lastMatchIndex = i;
70
+ queryIndex++;
44
71
  }
45
- if (queryIndex < normalizedQuery.length) {
46
- return { matches: false, score: 0 };
72
+ }
73
+ if (queryIndex < queryLower.length) {
74
+ return { matches: false, score: 0 };
75
+ }
76
+ if (queryLower === textLower) {
77
+ score -= 100;
78
+ }
79
+ return { matches: true, score };
80
+ }
81
+ function addWholeTokenSwap(variants, queryLower) {
82
+ let splitIndex = 0;
83
+ while (splitIndex < queryLower.length && isAsciiLetter(queryLower[splitIndex])) {
84
+ splitIndex++;
85
+ }
86
+ if (splitIndex > 0 && splitIndex < queryLower.length) {
87
+ let digitEnd = splitIndex;
88
+ while (digitEnd < queryLower.length && isAsciiDigit(queryLower[digitEnd])) {
89
+ digitEnd++;
90
+ }
91
+ if (digitEnd === queryLower.length) {
92
+ variants.add(queryLower.slice(splitIndex) + queryLower.slice(0, splitIndex));
93
+ }
94
+ }
95
+ splitIndex = 0;
96
+ while (splitIndex < queryLower.length && isAsciiDigit(queryLower[splitIndex])) {
97
+ splitIndex++;
98
+ }
99
+ if (splitIndex > 0 && splitIndex < queryLower.length) {
100
+ let letterEnd = splitIndex;
101
+ while (letterEnd < queryLower.length && isAsciiLetter(queryLower[letterEnd])) {
102
+ letterEnd++;
103
+ }
104
+ if (letterEnd === queryLower.length) {
105
+ variants.add(queryLower.slice(splitIndex) + queryLower.slice(0, splitIndex));
47
106
  }
48
- if (normalizedQuery === textLower) {
49
- score -= 100;
107
+ }
108
+ }
109
+ function buildAlphanumericSwapQueries(queryLower) {
110
+ const variants = new Set();
111
+ addWholeTokenSwap(variants, queryLower);
112
+ for (let i = 0; i < queryLower.length - 1; i++) {
113
+ const current = queryLower[i];
114
+ const next = queryLower[i + 1];
115
+ const isAlphaNumSwap = (isAsciiLetter(current) && isAsciiDigit(next)) || (isAsciiDigit(current) && isAsciiLetter(next));
116
+ if (!isAlphaNumSwap) {
117
+ continue;
50
118
  }
51
- return { matches: true, score };
52
- };
53
- const primaryMatch = matchQuery(queryLower);
54
- if (primaryMatch.matches) {
55
- return primaryMatch;
56
- }
57
- const alphaNumericMatch = queryLower.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/);
58
- const numericAlphaMatch = queryLower.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/);
59
- const swappedQuery = alphaNumericMatch
60
- ? `${alphaNumericMatch.groups?.digits ?? ""}${alphaNumericMatch.groups?.letters ?? ""}`
61
- : numericAlphaMatch
62
- ? `${numericAlphaMatch.groups?.letters ?? ""}${numericAlphaMatch.groups?.digits ?? ""}`
63
- : "";
64
- if (!swappedQuery) {
65
- return primaryMatch;
66
- }
67
- const swappedMatch = matchQuery(swappedQuery);
68
- if (!swappedMatch.matches) {
69
- return primaryMatch;
70
- }
71
- return { matches: true, score: swappedMatch.score + 5 };
119
+ variants.add(queryLower.slice(0, i) + next + current + queryLower.slice(i + 2));
120
+ }
121
+ return [...variants];
122
+ }
123
+ export function fuzzyMatch(query, text) {
124
+ const queryLower = query.toLowerCase();
125
+ const textLower = text.toLowerCase();
126
+ const direct = scoreMatch(queryLower, textLower);
127
+ if (direct.matches) {
128
+ return direct;
129
+ }
130
+ let bestSwap = null;
131
+ for (const variant of buildAlphanumericSwapQueries(queryLower)) {
132
+ const match = scoreMatch(variant, textLower);
133
+ if (!match.matches) {
134
+ continue;
135
+ }
136
+ const score = match.score + ALPHANUMERIC_SWAP_PENALTY;
137
+ if (!bestSwap || score < bestSwap.score) {
138
+ bestSwap = { matches: true, score };
139
+ }
140
+ }
141
+ return bestSwap ?? direct;
72
142
  }
73
143
  /**
74
144
  * Filter and sort items by fuzzy match quality (best matches first).
@@ -1 +1 @@
1
- {"version":3,"file":"fuzzy.js","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,IAAY,EAAc;IACnE,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAErC,MAAM,UAAU,GAAG,CAAC,eAAuB,EAAc,EAAE,CAAC;QAC3D,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACpC,CAAC;QAED,IAAI,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;YAC/C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACrC,CAAC;QAED,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,cAAc,GAAG,CAAC,CAAC,CAAC;QACxB,IAAI,kBAAkB,GAAG,CAAC,CAAC;QAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,IAAI,UAAU,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClF,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;gBAClD,MAAM,cAAc,GAAG,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,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AI,QAAQ,GAAG,IAAI,CAAC;QAEpB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACtC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBACnB,UAAU,IAAI,KAAK,CAAC,KAAK,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACP,QAAQ,GAAG,KAAK,CAAC;gBACjB,MAAM;YACP,CAAC;QACF,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACpC,CAAC;IACF,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAAA,CAClC","sourcesContent":["/**\n * Fuzzy matching utilities.\n * Matches if all query characters appear in order (not necessarily consecutive).\n * Lower score = better match.\n */\n\nexport interface FuzzyMatch {\n\tmatches: boolean;\n\tscore: number;\n}\n\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch {\n\tconst queryLower = query.toLowerCase();\n\tconst textLower = text.toLowerCase();\n\n\tconst matchQuery = (normalizedQuery: string): FuzzyMatch => {\n\t\tif (normalizedQuery.length === 0) {\n\t\t\treturn { matches: true, score: 0 };\n\t\t}\n\n\t\tif (normalizedQuery.length > textLower.length) {\n\t\t\treturn { matches: false, score: 0 };\n\t\t}\n\n\t\tlet queryIndex = 0;\n\t\tlet score = 0;\n\t\tlet lastMatchIndex = -1;\n\t\tlet consecutiveMatches = 0;\n\n\t\tfor (let i = 0; i < textLower.length && queryIndex < normalizedQuery.length; i++) {\n\t\t\tif (textLower[i] === normalizedQuery[queryIndex]) {\n\t\t\t\tconst isWordBoundary = i === 0 || /[\\s\\-_./:]/.test(textLower[i - 1]!);\n\n\t\t\t\t// Reward consecutive matches\n\t\t\t\tif (lastMatchIndex === i - 1) {\n\t\t\t\t\tconsecutiveMatches++;\n\t\t\t\t\tscore -= consecutiveMatches * 5;\n\t\t\t\t} else {\n\t\t\t\t\tconsecutiveMatches = 0;\n\t\t\t\t\t// Penalize gaps\n\t\t\t\t\tif (lastMatchIndex >= 0) {\n\t\t\t\t\t\tscore += (i - lastMatchIndex - 1) * 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Reward word boundary matches\n\t\t\t\tif (isWordBoundary) {\n\t\t\t\t\tscore -= 10;\n\t\t\t\t}\n\n\t\t\t\t// Slight penalty for later matches\n\t\t\t\tscore += i * 0.1;\n\n\t\t\t\tlastMatchIndex = i;\n\t\t\t\tqueryIndex++;\n\t\t\t}\n\t\t}\n\n\t\tif (queryIndex < normalizedQuery.length) {\n\t\t\treturn { matches: false, score: 0 };\n\t\t}\n\n\t\tif (normalizedQuery === textLower) {\n\t\t\tscore -= 100;\n\t\t}\n\n\t\treturn { matches: true, score };\n\t};\n\n\tconst primaryMatch = matchQuery(queryLower);\n\tif (primaryMatch.matches) {\n\t\treturn primaryMatch;\n\t}\n\n\tconst alphaNumericMatch = queryLower.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/);\n\tconst numericAlphaMatch = queryLower.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/);\n\tconst swappedQuery = alphaNumericMatch\n\t\t? `${alphaNumericMatch.groups?.digits ?? \"\"}${alphaNumericMatch.groups?.letters ?? \"\"}`\n\t\t: numericAlphaMatch\n\t\t\t? `${numericAlphaMatch.groups?.letters ?? \"\"}${numericAlphaMatch.groups?.digits ?? \"\"}`\n\t\t\t: \"\";\n\n\tif (!swappedQuery) {\n\t\treturn primaryMatch;\n\t}\n\n\tconst swappedMatch = matchQuery(swappedQuery);\n\tif (!swappedMatch.matches) {\n\t\treturn primaryMatch;\n\t}\n\n\treturn { matches: true, score: swappedMatch.score + 5 };\n}\n\n/**\n * Filter and sort items by fuzzy match quality (best matches first).\n * Supports space-separated tokens: all tokens must match.\n */\nexport function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[] {\n\tif (!query.trim()) {\n\t\treturn items;\n\t}\n\n\tconst tokens = query\n\t\t.trim()\n\t\t.split(/\\s+/)\n\t\t.filter((t) => t.length > 0);\n\n\tif (tokens.length === 0) {\n\t\treturn items;\n\t}\n\n\tconst results: { item: T; totalScore: number }[] = [];\n\n\tfor (const item of items) {\n\t\tconst text = getText(item);\n\t\tlet totalScore = 0;\n\t\tlet allMatch = true;\n\n\t\tfor (const token of tokens) {\n\t\t\tconst match = fuzzyMatch(token, text);\n\t\t\tif (match.matches) {\n\t\t\t\ttotalScore += match.score;\n\t\t\t} else {\n\t\t\t\tallMatch = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (allMatch) {\n\t\t\tresults.push({ item, totalScore });\n\t\t}\n\t}\n\n\tresults.sort((a, b) => a.totalScore - b.totalScore);\n\treturn results.map((r) => r.item);\n}\n"]}
1
+ {"version":3,"file":"fuzzy.js","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC,SAAS,aAAa,CAAC,IAAwB;IAC9C,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,GAAG,CAAC;AAClC,CAAC;AAED,SAAS,YAAY,CAAC,IAAwB;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,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CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC","sourcesContent":["/**\n * Fuzzy matching utilities.\n * Matches if all query characters appear in order (not necessarily consecutive).\n * Lower score = better match.\n */\n\nexport interface FuzzyMatch {\n\tmatches: boolean;\n\tscore: number;\n}\n\nconst ALPHANUMERIC_SWAP_PENALTY = 5;\n\nfunction isAsciiLetter(char: string | undefined): boolean {\n\tif (!char) {\n\t\treturn false;\n\t}\n\tconst code = char.charCodeAt(0);\n\treturn code >= 97 && code <= 122;\n}\n\nfunction isAsciiDigit(char: string | undefined): boolean {\n\tif (!char) {\n\t\treturn false;\n\t}\n\tconst code = char.charCodeAt(0);\n\treturn code >= 48 && code <= 57;\n}\n\nfunction isWordBoundaryPrefix(char: string): boolean {\n\tswitch (char) {\n\t\tcase \" \":\n\t\tcase \"\\t\":\n\t\tcase \"\\n\":\n\t\tcase \"\\r\":\n\t\tcase \"-\":\n\t\tcase \"_\":\n\t\tcase \".\":\n\t\tcase \"/\":\n\t\tcase \":\":\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nfunction scoreMatch(queryLower: string, textLower: string): FuzzyMatch {\n\tif (queryLower.length === 0) {\n\t\treturn { matches: true, score: 0 };\n\t}\n\n\tif (queryLower.length > textLower.length) {\n\t\treturn { matches: false, score: 0 };\n\t}\n\n\tlet queryIndex = 0;\n\tlet score = 0;\n\tlet lastMatchIndex = -1;\n\tlet consecutiveMatches = 0;\n\n\tfor (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) {\n\t\tif (textLower[i] === queryLower[queryIndex]) {\n\t\t\tconst isWordBoundary = i === 0 || isWordBoundaryPrefix(textLower[i - 1]!);\n\n\t\t\t// Reward consecutive matches\n\t\t\tif (lastMatchIndex === i - 1) {\n\t\t\t\tconsecutiveMatches++;\n\t\t\t\tscore -= consecutiveMatches * 5;\n\t\t\t} else {\n\t\t\t\tconsecutiveMatches = 0;\n\t\t\t\t// Penalize gaps\n\t\t\t\tif (lastMatchIndex >= 0) {\n\t\t\t\t\tscore += (i - lastMatchIndex - 1) * 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Reward word boundary matches\n\t\t\tif (isWordBoundary) {\n\t\t\t\tscore -= 10;\n\t\t\t}\n\n\t\t\t// Slight penalty for later matches\n\t\t\tscore += i * 0.1;\n\n\t\t\tlastMatchIndex = i;\n\t\t\tqueryIndex++;\n\t\t}\n\t}\n\n\tif (queryIndex < queryLower.length) {\n\t\treturn { matches: false, score: 0 };\n\t}\n\n\tif (queryLower === textLower) {\n\t\tscore -= 100;\n\t}\n\n\treturn { matches: true, score };\n}\n\nfunction addWholeTokenSwap(variants: Set<string>, queryLower: string): void {\n\tlet splitIndex = 0;\n\twhile (splitIndex < queryLower.length && isAsciiLetter(queryLower[splitIndex])) {\n\t\tsplitIndex++;\n\t}\n\tif (splitIndex > 0 && splitIndex < queryLower.length) {\n\t\tlet digitEnd = splitIndex;\n\t\twhile (digitEnd < queryLower.length && isAsciiDigit(queryLower[digitEnd])) {\n\t\t\tdigitEnd++;\n\t\t}\n\t\tif (digitEnd === queryLower.length) {\n\t\t\tvariants.add(queryLower.slice(splitIndex) + queryLower.slice(0, splitIndex));\n\t\t}\n\t}\n\n\tsplitIndex = 0;\n\twhile (splitIndex < queryLower.length && isAsciiDigit(queryLower[splitIndex])) {\n\t\tsplitIndex++;\n\t}\n\tif (splitIndex > 0 && splitIndex < queryLower.length) {\n\t\tlet letterEnd = splitIndex;\n\t\twhile (letterEnd < queryLower.length && isAsciiLetter(queryLower[letterEnd])) {\n\t\t\tletterEnd++;\n\t\t}\n\t\tif (letterEnd === queryLower.length) {\n\t\t\tvariants.add(queryLower.slice(splitIndex) + queryLower.slice(0, splitIndex));\n\t\t}\n\t}\n}\n\nfunction buildAlphanumericSwapQueries(queryLower: string): string[] {\n\tconst variants = new Set<string>();\n\taddWholeTokenSwap(variants, queryLower);\n\n\tfor (let i = 0; i < queryLower.length - 1; i++) {\n\t\tconst current = queryLower[i];\n\t\tconst next = queryLower[i + 1];\n\t\tconst isAlphaNumSwap =\n\t\t\t(isAsciiLetter(current) && isAsciiDigit(next)) || (isAsciiDigit(current) && isAsciiLetter(next));\n\t\tif (!isAlphaNumSwap) {\n\t\t\tcontinue;\n\t\t}\n\t\tvariants.add(queryLower.slice(0, i) + next + current + queryLower.slice(i + 2));\n\t}\n\n\treturn [...variants];\n}\n\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch {\n\tconst queryLower = query.toLowerCase();\n\tconst textLower = text.toLowerCase();\n\n\tconst direct = scoreMatch(queryLower, textLower);\n\tif (direct.matches) {\n\t\treturn direct;\n\t}\n\n\tlet bestSwap: FuzzyMatch | null = null;\n\tfor (const variant of buildAlphanumericSwapQueries(queryLower)) {\n\t\tconst match = scoreMatch(variant, textLower);\n\t\tif (!match.matches) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst score = match.score + ALPHANUMERIC_SWAP_PENALTY;\n\t\tif (!bestSwap || score < bestSwap.score) {\n\t\t\tbestSwap = { matches: true, score };\n\t\t}\n\t}\n\n\treturn bestSwap ?? direct;\n}\n\n/**\n * Filter and sort items by fuzzy match quality (best matches first).\n * Supports space-separated tokens: all tokens must match.\n */\nexport function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[] {\n\tif (!query.trim()) {\n\t\treturn items;\n\t}\n\n\tconst tokens = query\n\t\t.trim()\n\t\t.split(/\\s+/)\n\t\t.filter((t) => t.length > 0);\n\n\tif (tokens.length === 0) {\n\t\treturn items;\n\t}\n\n\tconst results: { item: T; totalScore: number }[] = [];\n\n\tfor (const item of items) {\n\t\tconst text = getText(item);\n\t\tlet totalScore = 0;\n\t\tlet allMatch = true;\n\n\t\tfor (const token of tokens) {\n\t\t\tconst match = fuzzyMatch(token, text);\n\t\t\tif (match.matches) {\n\t\t\t\ttotalScore += match.score;\n\t\t\t} else {\n\t\t\t\tallMatch = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (allMatch) {\n\t\t\tresults.push({ item, totalScore });\n\t\t}\n\t}\n\n\tresults.sort((a, b) => a.totalScore - b.totalScore);\n\treturn results.map((r) => r.item);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,4BAA4B,EAC5B,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrH,OAAO,EACN,KAAK,UAAU,EACf,UAAU,EACV,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,gCAAgC,GACrC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,+B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,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,aAAa,EACb,KAAK,SAAS,EACd,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,GAAG,GACH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.ts\";\n// Components\nexport { Box } from \"./components/box.ts\";\nexport { CancellableLoader } from \"./components/cancellable-loader.ts\";\nexport { Editor, type EditorOptions, type EditorTheme } from \"./components/editor.ts\";\nexport { Image, type ImageOptions, type ImageTheme } from \"./components/image.ts\";\nexport { Input } from \"./components/input.ts\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.ts\";\nexport { type DefaultTextStyle, Markdown, type MarkdownOptions, type MarkdownTheme } from \"./components/markdown.ts\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.ts\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.ts\";\nexport { Spacer } from \"./components/spacer.ts\";\nexport { Text } from \"./components/text.ts\";\nexport { TruncatedText } from \"./components/truncated-text.ts\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.ts\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from \"./fuzzy.ts\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\ttype Keybinding,\n\ttype KeybindingConflict,\n\ttype KeybindingDefinition,\n\ttype KeybindingDefinitions,\n\ttype Keybindings,\n\ttype KeybindingsConfig,\n\tKeybindingsManager,\n\tsetKeybindings,\n\tTUI_KEYBINDINGS,\n} from \"./keybindings.ts\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.ts\";\n// Input buffering for batch splitting\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.ts\";\n// Terminal interface and implementations\nexport { ProcessTerminal, type Terminal } from \"./terminal.ts\";\n// Terminal image support\nexport {\n\tallocateImageId,\n\ttype CellDimensions,\n\tcalculateImageRows,\n\tdeleteAllKittyImages,\n\tdeleteKittyImage,\n\tdetectCapabilities,\n\tencodeITerm2,\n\tencodeKitty,\n\tgetCapabilities,\n\tgetCellDimensions,\n\tgetGifDimensions,\n\tgetImageDimensions,\n\tgetJpegDimensions,\n\tgetPngDimensions,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n} from \"./terminal-image.ts\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\ttype Focusable,\n\tisFocusable,\n\ttype OverlayAnchor,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype OverlayUnfocusOptions,\n\ttype SizeValue,\n\tTUI,\n} from \"./tui.ts\";\n// Utilities\nexport { truncateToWidth, visibleWidth, wrapTextWithAnsi } from \"./utils.ts\";\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,K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BAAkB,EAClB,cAAc,EACd,eAAe,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,GAAG,EACH,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,UAAU,EACV,QAAQ,EACR,sBAAsB,GACtB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,WAAW,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEnG,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EACN,eAAe,EACf,KAAK,cAAc,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,aAAa,EACb,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,aAAa,EACb,KAAK,SAAS,EACd,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,GAAG,GACH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"keybindings.d.ts","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,WAAW,CAAC;AAEnD;;;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* Downstream packages can add keybindings via declaration merging.\n */\nexport interface Keybindings {\n\t// Editor navigation and editing\n\t\"tui.editor.cursorUp\": true;\n\t\"tui.editor.cursorDown\": true;\n\t\"tui.editor.cursorLeft\": true;\n\t\"tui.editor.cursorRight\": true;\n\t\"tui.editor.cursorWordLeft\": true;\n\t\"tui.editor.cursorWordRight\": true;\n\t\"tui.editor.cursorLineStart\": true;\n\t\"tui.editor.cursorLineEnd\": true;\n\t\"tui.editor.jumpForward\": true;\n\t\"tui.editor.jumpBackward\": true;\n\t\"tui.editor.pageUp\": true;\n\t\"tui.editor.pageDown\": true;\n\t\"tui.editor.deleteCharBackward\": true;\n\t\"tui.editor.deleteCharForward\": true;\n\t\"tui.editor.deleteWordBackward\": true;\n\t\"tui.editor.deleteWordForward\": true;\n\t\"tui.editor.deleteToLineStart\": true;\n\t\"tui.editor.deleteToLineEnd\": true;\n\t\"tui.editor.yank\": true;\n\t\"tui.editor.yankPop\": true;\n\t\"tui.editor.undo\": true;\n\t// Generic input actions\n\t\"tui.input.newLine\": true;\n\t\"tui.input.submit\": true;\n\t\"tui.input.tab\": true;\n\t\"tui.input.copy\": true;\n\t// Generic selection actions\n\t\"tui.select.up\": true;\n\t\"tui.select.down\": true;\n\t\"tui.select.pageUp\": true;\n\t\"tui.select.pageDown\": true;\n\t\"tui.select.confirm\": true;\n\t\"tui.select.cancel\": true;\n}\n\nexport type Keybinding = keyof Keybindings;\n\nexport interface KeybindingDefinition {\n\tdefaultKeys: KeyId | KeyId[];\n\tdescription?: string;\n}\n\nexport type KeybindingDefinitions = Record<string, KeybindingDefinition>;\nexport type KeybindingsConfig = Record<string, KeyId | KeyId[] | undefined>;\n\nexport const TUI_KEYBINDINGS = {\n\t\"tui.editor.cursorUp\": { defaultKeys: \"up\", description: \"Move cursor up\" },\n\t\"tui.editor.cursorDown\": { defaultKeys: \"down\", description: \"Move cursor down\" },\n\t\"tui.editor.cursorLeft\": {\n\t\tdefaultKeys: [\"left\", \"ctrl+b\"],\n\t\tdescription: \"Move cursor left\",\n\t},\n\t\"tui.editor.cursorRight\": {\n\t\tdefaultKeys: [\"right\", \"ctrl+f\"],\n\t\tdescription: \"Move cursor right\",\n\t},\n\t\"tui.editor.cursorWordLeft\": {\n\t\tdefaultKeys: [\"alt+left\", \"ctrl+left\", \"alt+b\"],\n\t\tdescription: \"Move cursor word left\",\n\t},\n\t\"tui.editor.cursorWordRight\": {\n\t\tdefaultKeys: [\"alt+right\", \"ctrl+right\", \"alt+f\"],\n\t\tdescription: \"Move cursor word right\",\n\t},\n\t\"tui.editor.cursorLineStart\": {\n\t\tdefaultKeys: [\"home\", \"ctrl+a\"],\n\t\tdescription: \"Move to line start\",\n\t},\n\t\"tui.editor.cursorLineEnd\": {\n\t\tdefaultKeys: [\"end\", \"ctrl+e\"],\n\t\tdescription: \"Move to line end\",\n\t},\n\t\"tui.editor.jumpForward\": {\n\t\tdefaultKeys: \"ctrl+]\",\n\t\tdescription: \"Jump forward to character\",\n\t},\n\t\"tui.editor.jumpBackward\": {\n\t\tdefaultKeys: \"ctrl+alt+]\",\n\t\tdescription: \"Jump backward to character\",\n\t},\n\t\"tui.editor.pageUp\": { defaultKeys: \"pageUp\", description: \"Page up\" },\n\t\"tui.editor.pageDown\": { defaultKeys: \"pageDown\", description: \"Page down\" },\n\t\"tui.editor.deleteCharBackward\": {\n\t\tdefaultKeys: \"backspace\",\n\t\tdescription: \"Delete character backward\",\n\t},\n\t\"tui.editor.deleteCharForward\": {\n\t\tdefaultKeys: [\"delete\", \"ctrl+d\"],\n\t\tdescription: \"Delete character forward\",\n\t},\n\t\"tui.editor.deleteWordBackward\": {\n\t\tdefaultKeys: [\"ctrl+w\", \"alt+backspace\"],\n\t\tdescription: \"Delete word backward\",\n\t},\n\t\"tui.editor.deleteWordForward\": {\n\t\tdefaultKeys: [\"alt+d\", \"alt+delete\"],\n\t\tdescription: \"Delete word forward\",\n\t},\n\t\"tui.editor.deleteToLineStart\": {\n\t\tdefaultKeys: \"ctrl+u\",\n\t\tdescription: \"Delete to line start\",\n\t},\n\t\"tui.editor.deleteToLineEnd\": {\n\t\tdefaultKeys: \"ctrl+k\",\n\t\tdescription: \"Delete to line end\",\n\t},\n\t\"tui.editor.yank\": { defaultKeys: \"ctrl+y\", description: \"Yank\" },\n\t\"tui.editor.yankPop\": { defaultKeys: \"alt+y\", description: \"Yank pop\" },\n\t\"tui.editor.undo\": { defaultKeys: \"ctrl+-\", description: \"Undo\" },\n\t\"tui.input.newLine\": { defaultKeys: \"shift+enter\", description: \"Insert newline\" },\n\t\"tui.input.submit\": { defaultKeys: \"enter\", description: \"Submit input\" },\n\t\"tui.input.tab\": { defaultKeys: \"tab\", description: \"Tab / autocomplete\" },\n\t\"tui.input.copy\": { defaultKeys: \"ctrl+c\", description: \"Copy selection\" },\n\t\"tui.select.up\": { defaultKeys: \"up\", description: \"Move selection up\" },\n\t\"tui.select.down\": { defaultKeys: \"down\", description: \"Move selection down\" },\n\t\"tui.select.pageUp\": { defaultKeys: \"pageUp\", description: \"Selection page up\" },\n\t\"tui.select.pageDown\": {\n\t\tdefaultKeys: \"pageDown\",\n\t\tdescription: \"Selection page down\",\n\t},\n\t\"tui.select.confirm\": { defaultKeys: \"enter\", description: \"Confirm selection\" },\n\t\"tui.select.cancel\": {\n\t\tdefaultKeys: [\"escape\", \"ctrl+c\"],\n\t\tdescription: \"Cancel selection\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nexport interface KeybindingConflict {\n\tkey: KeyId;\n\tkeybindings: string[];\n}\n\nfunction normalizeKeys(keys: KeyId | KeyId[] | undefined): KeyId[] {\n\tif (keys === undefined) return [];\n\tconst keyList = Array.isArray(keys) ? keys : [keys];\n\tconst seen = new Set<KeyId>();\n\tconst result: KeyId[] = [];\n\tfor (const key of keyList) {\n\t\tif (!seen.has(key)) {\n\t\t\tseen.add(key);\n\t\t\tresult.push(key);\n\t\t}\n\t}\n\treturn result;\n}\n\nexport class KeybindingsManager {\n\tprivate definitions: KeybindingDefinitions;\n\tprivate userBindings: KeybindingsConfig;\n\tprivate keysById = new Map<Keybinding, KeyId[]>();\n\tprivate conflicts: KeybindingConflict[] = [];\n\n\tconstructor(definitions: KeybindingDefinitions, userBindings: KeybindingsConfig = {}) {\n\t\tthis.definitions = definitions;\n\t\tthis.userBindings = userBindings;\n\t\tthis.rebuild();\n\t}\n\n\tprivate rebuild(): void {\n\t\tthis.keysById.clear();\n\t\tthis.conflicts = [];\n\n\t\tconst userClaims = new Map<KeyId, Set<Keybinding>>();\n\t\tfor (const [keybinding, keys] of Object.entries(this.userBindings)) {\n\t\t\tif (!(keybinding in this.definitions)) continue;\n\t\t\tfor (const key of normalizeKeys(keys)) {\n\t\t\t\tconst claimants = userClaims.get(key) ?? new Set<Keybinding>();\n\t\t\t\tclaimants.add(keybinding as Keybinding);\n\t\t\t\tuserClaims.set(key, claimants);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, keybindings] of userClaims) {\n\t\t\tif (keybindings.size > 1) {\n\t\t\t\tthis.conflicts.push({ key, keybindings: [...keybindings] });\n\t\t\t}\n\t\t}\n\n\t\tfor (const [id, definition] of Object.entries(this.definitions)) {\n\t\t\tconst userKeys = this.userBindings[id];\n\t\t\tconst keys = userKeys === undefined ? normalizeKeys(definition.defaultKeys) : normalizeKeys(userKeys);\n\t\t\tthis.keysById.set(id as Keybinding, keys);\n\t\t}\n\t}\n\n\tmatches(data: string, keybinding: Keybinding): boolean {\n\t\tconst keys = this.keysById.get(keybinding) ?? [];\n\t\tfor (const key of keys) {\n\t\t\tif (matchesKey(data, key)) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetKeys(keybinding: Keybinding): KeyId[] {\n\t\treturn [...(this.keysById.get(keybinding) ?? [])];\n\t}\n\n\tgetDefinition(keybinding: Keybinding): KeybindingDefinition {\n\t\treturn this.definitions[keybinding];\n\t}\n\n\tgetConflicts(): KeybindingConflict[] {\n\t\treturn this.conflicts.map((conflict) => ({ ...conflict, keybindings: [...conflict.keybindings] }));\n\t}\n\n\tsetUserBindings(userBindings: KeybindingsConfig): void {\n\t\tthis.userBindings = userBindings;\n\t\tthis.rebuild();\n\t}\n\n\tgetUserBindings(): KeybindingsConfig {\n\t\treturn { ...this.userBindings };\n\t}\n\n\tgetResolvedBindings(): KeybindingsConfig {\n\t\tconst resolved: KeybindingsConfig = {};\n\t\tfor (const id of Object.keys(this.definitions)) {\n\t\t\tconst keys = this.keysById.get(id as Keybinding) ?? [];\n\t\t\tresolved[id] = keys.length === 1 ? keys[0]! : [...keys];\n\t\t}\n\t\treturn resolved;\n\t}\n}\n\nlet globalKeybindings: KeybindingsManager | null = null;\n\nexport function setKeybindings(keybindings: KeybindingsManager): void {\n\tglobalKeybindings = keybindings;\n}\n\nexport function getKeybindings(): KeybindingsManager {\n\tif (!globalKeybindings) {\n\t\tglobalKeybindings = new KeybindingsManager(TUI_KEYBINDINGS);\n\t}\n\treturn globalKeybindings;\n}\n"]}
1
+ {"version":3,"file":"keybindings.d.ts","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,WAAW,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAE3B,qBAAqB,EAAE,IAAI,CAAC;IAC5B,uBAAuB,EAAE,IAAI,CAAC;IAC9B,uBAAuB,EAAE,IAAI,CAAC;IAC9B,wBAAwB,EAAE,IAAI,CAAC;IAC/B,2BAA2B,EAAE,IAAI,CAAC;IAClC,4BAA4B,EAAE,IAAI,CAAC;IACnC,4BAA4B,EAAE,IAAI,CAAC;IACnC,0BAA0B,EAAE,IAAI,CAAC;IACjC,wBAAwB,EAAE,IAAI,CAAC;IAC/B,yBAAyB,EAAE,IAAI,CAAC;IAChC,mBAAmB,EAAE,IAAI,CAAC;IAC1B,qBAAqB,EAAE,IAAI,CAAC;IAC5B,+BAA+B,EAAE,IAAI,CAAC;IACtC,8BAA8B,EAAE,IAAI,CAAC;IACrC,+BAA+B,EAAE,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AAmB;;;iBAE7E,WAAW;iBACX,WAAW,EAAE,kBAAkB;;CAES,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IAClC,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,EAAE,CAAC;CACtB;AAgBD,qBAAa,kBAAkB;IAC9B,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,SAAS,CAA4B;IAE7C,YAAY,WAAW,EAAE,qBAAqB,EAAE,YAAY,GAAE,iBAAsB,EAInF;IAED,OAAO,CAAC,OAAO;IA2Bf,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAMrD;IAED,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,EAAE,CAEvC;IAED,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,oBAAoB,CAE1D;IAED,YAAY,IAAI,kBAAkB,EAAE,CAEnC;IAED,eAAe,CAAC,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAGrD;IAED,eAAe,IAAI,iBAAiB,CAEnC;IAED,mBAAmB,IAAI,iBAAiB,CAOvC;CACD;AAID,wBAAgB,cAAc,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAEpE;AAED,wBAAgB,cAAc,IAAI,kBAAkB,CAKnD"}
@@ -95,11 +95,9 @@ function normalizeKeys(keys) {
95
95
  return result;
96
96
  }
97
97
  export class KeybindingsManager {
98
- definitions;
99
- userBindings;
100
- keysById = new Map();
101
- conflicts = [];
102
98
  constructor(definitions, userBindings = {}) {
99
+ this.keysById = new Map();
100
+ this.conflicts = [];
103
101
  this.definitions = definitions;
104
102
  this.userBindings = userBindings;
105
103
  this.rebuild();
@@ -1 +1 @@
1
- {"version":3,"file":"keybindings.js","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MA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AAE,CAAC;YACvD,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,QAAQ,CAAC;IAAA,CAChB;CACD;AAED,IAAI,iBAAiB,GAA8B,IAAI,CAAC;AAExD,MAAM,UAAU,cAAc,CAAC,WAA+B,EAAQ;IACrE,iBAAiB,GAAG,WAAW,CAAC;AAAA,CAChC;AAED,MAAM,UAAU,cAAc,GAAuB;IACpD,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,iBAAiB,GAAG,IAAI,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,iBAAiB,CAAC;AAAA,CACzB","sourcesContent":["import { type KeyId, matchesKey } from \"./keys.ts\";\n\n/**\n * Global keybinding registry.\n * Downstream packages can add keybindings via declaration merging.\n */\nexport interface Keybindings {\n\t// Editor navigation and editing\n\t\"tui.editor.cursorUp\": true;\n\t\"tui.editor.cursorDown\": true;\n\t\"tui.editor.cursorLeft\": true;\n\t\"tui.editor.cursorRight\": true;\n\t\"tui.editor.cursorWordLeft\": true;\n\t\"tui.editor.cursorWordRight\": true;\n\t\"tui.editor.cursorLineStart\": true;\n\t\"tui.editor.cursorLineEnd\": true;\n\t\"tui.editor.jumpForward\": true;\n\t\"tui.editor.jumpBackward\": true;\n\t\"tui.editor.pageUp\": true;\n\t\"tui.editor.pageDown\": true;\n\t\"tui.editor.deleteCharBackward\": true;\n\t\"tui.editor.deleteCharForward\": true;\n\t\"tui.editor.deleteWordBackward\": true;\n\t\"tui.editor.deleteWordForward\": true;\n\t\"tui.editor.deleteToLineStart\": true;\n\t\"tui.editor.deleteToLineEnd\": true;\n\t\"tui.editor.yank\": true;\n\t\"tui.editor.yankPop\": true;\n\t\"tui.editor.undo\": true;\n\t// Generic input actions\n\t\"tui.input.newLine\": true;\n\t\"tui.input.submit\": true;\n\t\"tui.input.tab\": true;\n\t\"tui.input.copy\": true;\n\t// Generic selection actions\n\t\"tui.select.up\": true;\n\t\"tui.select.down\": true;\n\t\"tui.select.pageUp\": true;\n\t\"tui.select.pageDown\": true;\n\t\"tui.select.confirm\": true;\n\t\"tui.select.cancel\": true;\n}\n\nexport type Keybinding = keyof Keybindings;\n\nexport interface KeybindingDefinition {\n\tdefaultKeys: KeyId | KeyId[];\n\tdescription?: string;\n}\n\nexport type KeybindingDefinitions = Record<string, KeybindingDefinition>;\nexport type KeybindingsConfig = Record<string, KeyId | KeyId[] | undefined>;\n\nexport const TUI_KEYBINDINGS = {\n\t\"tui.editor.cursorUp\": { defaultKeys: \"up\", description: \"Move cursor up\" },\n\t\"tui.editor.cursorDown\": { defaultKeys: \"down\", description: \"Move cursor down\" },\n\t\"tui.editor.cursorLeft\": {\n\t\tdefaultKeys: [\"left\", \"ctrl+b\"],\n\t\tdescription: \"Move cursor left\",\n\t},\n\t\"tui.editor.cursorRight\": {\n\t\tdefaultKeys: [\"right\", \"ctrl+f\"],\n\t\tdescription: \"Move cursor right\",\n\t},\n\t\"tui.editor.cursorWordLeft\": {\n\t\tdefaultKeys: [\"alt+left\", \"ctrl+left\", \"alt+b\"],\n\t\tdescription: \"Move cursor word left\",\n\t},\n\t\"tui.editor.cursorWordRight\": {\n\t\tdefaultKeys: [\"alt+right\", \"ctrl+right\", \"alt+f\"],\n\t\tdescription: \"Move cursor word right\",\n\t},\n\t\"tui.editor.cursorLineStart\": {\n\t\tdefaultKeys: [\"home\", \"ctrl+a\"],\n\t\tdescription: \"Move to line start\",\n\t},\n\t\"tui.editor.cursorLineEnd\": {\n\t\tdefaultKeys: [\"end\", \"ctrl+e\"],\n\t\tdescription: \"Move to line end\",\n\t},\n\t\"tui.editor.jumpForward\": {\n\t\tdefaultKeys: \"ctrl+]\",\n\t\tdescription: \"Jump forward to character\",\n\t},\n\t\"tui.editor.jumpBackward\": {\n\t\tdefaultKeys: \"ctrl+alt+]\",\n\t\tdescription: \"Jump backward to character\",\n\t},\n\t\"tui.editor.pageUp\": { defaultKeys: \"pageUp\", description: \"Page up\" },\n\t\"tui.editor.pageDown\": { defaultKeys: \"pageDown\", description: \"Page down\" },\n\t\"tui.editor.deleteCharBackward\": {\n\t\tdefaultKeys: \"backspace\",\n\t\tdescription: \"Delete character backward\",\n\t},\n\t\"tui.editor.deleteCharForward\": {\n\t\tdefaultKeys: [\"delete\", \"ctrl+d\"],\n\t\tdescription: \"Delete character forward\",\n\t},\n\t\"tui.editor.deleteWordBackward\": {\n\t\tdefaultKeys: [\"ctrl+w\", \"alt+backspace\"],\n\t\tdescription: \"Delete word backward\",\n\t},\n\t\"tui.editor.deleteWordForward\": {\n\t\tdefaultKeys: [\"alt+d\", \"alt+delete\"],\n\t\tdescription: \"Delete word forward\",\n\t},\n\t\"tui.editor.deleteToLineStart\": {\n\t\tdefaultKeys: \"ctrl+u\",\n\t\tdescription: \"Delete to line start\",\n\t},\n\t\"tui.editor.deleteToLineEnd\": {\n\t\tdefaultKeys: \"ctrl+k\",\n\t\tdescription: \"Delete to line end\",\n\t},\n\t\"tui.editor.yank\": { defaultKeys: \"ctrl+y\", description: \"Yank\" },\n\t\"tui.editor.yankPop\": { defaultKeys: \"alt+y\", description: \"Yank pop\" },\n\t\"tui.editor.undo\": { defaultKeys: \"ctrl+-\", description: \"Undo\" },\n\t\"tui.input.newLine\": { defaultKeys: \"shift+enter\", description: \"Insert newline\" },\n\t\"tui.input.submit\": { defaultKeys: \"enter\", description: \"Submit input\" },\n\t\"tui.input.tab\": { defaultKeys: \"tab\", description: \"Tab / autocomplete\" },\n\t\"tui.input.copy\": { defaultKeys: \"ctrl+c\", description: \"Copy selection\" },\n\t\"tui.select.up\": { defaultKeys: \"up\", description: \"Move selection up\" },\n\t\"tui.select.down\": { defaultKeys: \"down\", description: \"Move selection down\" },\n\t\"tui.select.pageUp\": { defaultKeys: \"pageUp\", description: \"Selection page up\" },\n\t\"tui.select.pageDown\": {\n\t\tdefaultKeys: \"pageDown\",\n\t\tdescription: \"Selection page down\",\n\t},\n\t\"tui.select.confirm\": { defaultKeys: \"enter\", description: \"Confirm selection\" },\n\t\"tui.select.cancel\": {\n\t\tdefaultKeys: [\"escape\", \"ctrl+c\"],\n\t\tdescription: \"Cancel selection\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nexport interface KeybindingConflict {\n\tkey: KeyId;\n\tkeybindings: string[];\n}\n\nfunction normalizeKeys(keys: KeyId | KeyId[] | undefined): KeyId[] {\n\tif (keys === undefined) return [];\n\tconst keyList = Array.isArray(keys) ? keys : [keys];\n\tconst seen = new Set<KeyId>();\n\tconst result: KeyId[] = [];\n\tfor (const key of keyList) {\n\t\tif (!seen.has(key)) {\n\t\t\tseen.add(key);\n\t\t\tresult.push(key);\n\t\t}\n\t}\n\treturn result;\n}\n\nexport class KeybindingsManager {\n\tprivate definitions: KeybindingDefinitions;\n\tprivate userBindings: KeybindingsConfig;\n\tprivate keysById = new Map<Keybinding, KeyId[]>();\n\tprivate conflicts: KeybindingConflict[] = [];\n\n\tconstructor(definitions: KeybindingDefinitions, userBindings: KeybindingsConfig = {}) {\n\t\tthis.definitions = definitions;\n\t\tthis.userBindings = userBindings;\n\t\tthis.rebuild();\n\t}\n\n\tprivate rebuild(): void {\n\t\tthis.keysById.clear();\n\t\tthis.conflicts = [];\n\n\t\tconst userClaims = new Map<KeyId, Set<Keybinding>>();\n\t\tfor (const [keybinding, keys] of Object.entries(this.userBindings)) {\n\t\t\tif (!(keybinding in this.definitions)) continue;\n\t\t\tfor (const key of normalizeKeys(keys)) {\n\t\t\t\tconst claimants = userClaims.get(key) ?? new Set<Keybinding>();\n\t\t\t\tclaimants.add(keybinding as Keybinding);\n\t\t\t\tuserClaims.set(key, claimants);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, keybindings] of userClaims) {\n\t\t\tif (keybindings.size > 1) {\n\t\t\t\tthis.conflicts.push({ key, keybindings: [...keybindings] });\n\t\t\t}\n\t\t}\n\n\t\tfor (const [id, definition] of Object.entries(this.definitions)) {\n\t\t\tconst userKeys = this.userBindings[id];\n\t\t\tconst keys = userKeys === undefined ? normalizeKeys(definition.defaultKeys) : normalizeKeys(userKeys);\n\t\t\tthis.keysById.set(id as Keybinding, keys);\n\t\t}\n\t}\n\n\tmatches(data: string, keybinding: Keybinding): boolean {\n\t\tconst keys = this.keysById.get(keybinding) ?? [];\n\t\tfor (const key of keys) {\n\t\t\tif (matchesKey(data, key)) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetKeys(keybinding: Keybinding): KeyId[] {\n\t\treturn [...(this.keysById.get(keybinding) ?? [])];\n\t}\n\n\tgetDefinition(keybinding: Keybinding): KeybindingDefinition {\n\t\treturn this.definitions[keybinding];\n\t}\n\n\tgetConflicts(): KeybindingConflict[] {\n\t\treturn this.conflicts.map((conflict) => ({ ...conflict, keybindings: [...conflict.keybindings] }));\n\t}\n\n\tsetUserBindings(userBindings: KeybindingsConfig): void {\n\t\tthis.userBindings = userBindings;\n\t\tthis.rebuild();\n\t}\n\n\tgetUserBindings(): KeybindingsConfig {\n\t\treturn { ...this.userBindings };\n\t}\n\n\tgetResolvedBindings(): KeybindingsConfig {\n\t\tconst resolved: KeybindingsConfig = {};\n\t\tfor (const id of Object.keys(this.definitions)) {\n\t\t\tconst keys = this.keysById.get(id as Keybinding) ?? [];\n\t\t\tresolved[id] = keys.length === 1 ? keys[0]! : [...keys];\n\t\t}\n\t\treturn resolved;\n\t}\n}\n\nlet globalKeybindings: KeybindingsManager | null = null;\n\nexport function setKeybindings(keybindings: KeybindingsManager): void {\n\tglobalKeybindings = keybindings;\n}\n\nexport function getKeybindings(): KeybindingsManager {\n\tif (!globalKeybindings) {\n\t\tglobalKeybindings = new KeybindingsManager(TUI_KEYBINDINGS);\n\t}\n\treturn globalKeybindings;\n}\n"]}
1
+ {"version":3,"file":"keybindings.js","sourceRoot":"","sources":["../src/keybindings.ts"],"names":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,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AAED,IAAI,iBAAiB,GAA8B,IAAI,CAAC;AAExD,MAAM,UAAU,cAAc,CAAC,WAA+B;IAC7D,iBAAiB,GAAG,WAAW,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,cAAc;IAC7B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,iBAAiB,GAAG,IAAI,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC1B,CAAC","sourcesContent":["import { type KeyId, matchesKey } from \"./keys.ts\";\n\n/**\n * Global keybinding registry.\n * Downstream packages can add keybindings via declaration merging.\n */\nexport interface Keybindings {\n\t// Editor navigation and editing\n\t\"tui.editor.cursorUp\": true;\n\t\"tui.editor.cursorDown\": true;\n\t\"tui.editor.cursorLeft\": true;\n\t\"tui.editor.cursorRight\": true;\n\t\"tui.editor.cursorWordLeft\": true;\n\t\"tui.editor.cursorWordRight\": true;\n\t\"tui.editor.cursorLineStart\": true;\n\t\"tui.editor.cursorLineEnd\": true;\n\t\"tui.editor.jumpForward\": true;\n\t\"tui.editor.jumpBackward\": true;\n\t\"tui.editor.pageUp\": true;\n\t\"tui.editor.pageDown\": true;\n\t\"tui.editor.deleteCharBackward\": true;\n\t\"tui.editor.deleteCharForward\": true;\n\t\"tui.editor.deleteWordBackward\": true;\n\t\"tui.editor.deleteWordForward\": true;\n\t\"tui.editor.deleteToLineStart\": true;\n\t\"tui.editor.deleteToLineEnd\": true;\n\t\"tui.editor.yank\": true;\n\t\"tui.editor.yankPop\": true;\n\t\"tui.editor.undo\": true;\n\t// Generic input actions\n\t\"tui.input.newLine\": true;\n\t\"tui.input.submit\": true;\n\t\"tui.input.tab\": true;\n\t\"tui.input.copy\": true;\n\t// Generic selection actions\n\t\"tui.select.up\": true;\n\t\"tui.select.down\": true;\n\t\"tui.select.pageUp\": true;\n\t\"tui.select.pageDown\": true;\n\t\"tui.select.confirm\": true;\n\t\"tui.select.cancel\": true;\n}\n\nexport type Keybinding = keyof Keybindings;\n\nexport interface KeybindingDefinition {\n\tdefaultKeys: KeyId | KeyId[];\n\tdescription?: string;\n}\n\nexport type KeybindingDefinitions = Record<string, KeybindingDefinition>;\nexport type KeybindingsConfig = Record<string, KeyId | KeyId[] | undefined>;\n\nexport const TUI_KEYBINDINGS = {\n\t\"tui.editor.cursorUp\": { defaultKeys: \"up\", description: \"Move cursor up\" },\n\t\"tui.editor.cursorDown\": { defaultKeys: \"down\", description: \"Move cursor down\" },\n\t\"tui.editor.cursorLeft\": {\n\t\tdefaultKeys: [\"left\", \"ctrl+b\"],\n\t\tdescription: \"Move cursor left\",\n\t},\n\t\"tui.editor.cursorRight\": {\n\t\tdefaultKeys: [\"right\", \"ctrl+f\"],\n\t\tdescription: \"Move cursor right\",\n\t},\n\t\"tui.editor.cursorWordLeft\": {\n\t\tdefaultKeys: [\"alt+left\", \"ctrl+left\", \"alt+b\"],\n\t\tdescription: \"Move cursor word left\",\n\t},\n\t\"tui.editor.cursorWordRight\": {\n\t\tdefaultKeys: [\"alt+right\", \"ctrl+right\", \"alt+f\"],\n\t\tdescription: \"Move cursor word right\",\n\t},\n\t\"tui.editor.cursorLineStart\": {\n\t\tdefaultKeys: [\"home\", \"ctrl+a\"],\n\t\tdescription: \"Move to line start\",\n\t},\n\t\"tui.editor.cursorLineEnd\": {\n\t\tdefaultKeys: [\"end\", \"ctrl+e\"],\n\t\tdescription: \"Move to line end\",\n\t},\n\t\"tui.editor.jumpForward\": {\n\t\tdefaultKeys: \"ctrl+]\",\n\t\tdescription: \"Jump forward to character\",\n\t},\n\t\"tui.editor.jumpBackward\": {\n\t\tdefaultKeys: \"ctrl+alt+]\",\n\t\tdescription: \"Jump backward to character\",\n\t},\n\t\"tui.editor.pageUp\": { defaultKeys: \"pageUp\", description: \"Page up\" },\n\t\"tui.editor.pageDown\": { defaultKeys: \"pageDown\", description: \"Page down\" },\n\t\"tui.editor.deleteCharBackward\": {\n\t\tdefaultKeys: \"backspace\",\n\t\tdescription: \"Delete character backward\",\n\t},\n\t\"tui.editor.deleteCharForward\": {\n\t\tdefaultKeys: [\"delete\", \"ctrl+d\"],\n\t\tdescription: \"Delete character forward\",\n\t},\n\t\"tui.editor.deleteWordBackward\": {\n\t\tdefaultKeys: [\"ctrl+w\", \"alt+backspace\"],\n\t\tdescription: \"Delete word backward\",\n\t},\n\t\"tui.editor.deleteWordForward\": {\n\t\tdefaultKeys: [\"alt+d\", \"alt+delete\"],\n\t\tdescription: \"Delete word forward\",\n\t},\n\t\"tui.editor.deleteToLineStart\": {\n\t\tdefaultKeys: \"ctrl+u\",\n\t\tdescription: \"Delete to line start\",\n\t},\n\t\"tui.editor.deleteToLineEnd\": {\n\t\tdefaultKeys: \"ctrl+k\",\n\t\tdescription: \"Delete to line end\",\n\t},\n\t\"tui.editor.yank\": { defaultKeys: \"ctrl+y\", description: \"Yank\" },\n\t\"tui.editor.yankPop\": { defaultKeys: \"alt+y\", description: \"Yank pop\" },\n\t\"tui.editor.undo\": { defaultKeys: \"ctrl+-\", description: \"Undo\" },\n\t\"tui.input.newLine\": { defaultKeys: \"shift+enter\", description: \"Insert newline\" },\n\t\"tui.input.submit\": { defaultKeys: \"enter\", description: \"Submit input\" },\n\t\"tui.input.tab\": { defaultKeys: \"tab\", description: \"Tab / autocomplete\" },\n\t\"tui.input.copy\": { defaultKeys: \"ctrl+c\", description: \"Copy selection\" },\n\t\"tui.select.up\": { defaultKeys: \"up\", description: \"Move selection up\" },\n\t\"tui.select.down\": { defaultKeys: \"down\", description: \"Move selection down\" },\n\t\"tui.select.pageUp\": { defaultKeys: \"pageUp\", description: \"Selection page up\" },\n\t\"tui.select.pageDown\": {\n\t\tdefaultKeys: \"pageDown\",\n\t\tdescription: \"Selection page down\",\n\t},\n\t\"tui.select.confirm\": { defaultKeys: \"enter\", description: \"Confirm selection\" },\n\t\"tui.select.cancel\": {\n\t\tdefaultKeys: [\"escape\", \"ctrl+c\"],\n\t\tdescription: \"Cancel selection\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nexport interface KeybindingConflict {\n\tkey: KeyId;\n\tkeybindings: string[];\n}\n\nfunction normalizeKeys(keys: KeyId | KeyId[] | undefined): KeyId[] {\n\tif (keys === undefined) return [];\n\tconst keyList = Array.isArray(keys) ? keys : [keys];\n\tconst seen = new Set<KeyId>();\n\tconst result: KeyId[] = [];\n\tfor (const key of keyList) {\n\t\tif (!seen.has(key)) {\n\t\t\tseen.add(key);\n\t\t\tresult.push(key);\n\t\t}\n\t}\n\treturn result;\n}\n\nexport class KeybindingsManager {\n\tprivate definitions: KeybindingDefinitions;\n\tprivate userBindings: KeybindingsConfig;\n\tprivate keysById = new Map<Keybinding, KeyId[]>();\n\tprivate conflicts: KeybindingConflict[] = [];\n\n\tconstructor(definitions: KeybindingDefinitions, userBindings: KeybindingsConfig = {}) {\n\t\tthis.definitions = definitions;\n\t\tthis.userBindings = userBindings;\n\t\tthis.rebuild();\n\t}\n\n\tprivate rebuild(): void {\n\t\tthis.keysById.clear();\n\t\tthis.conflicts = [];\n\n\t\tconst userClaims = new Map<KeyId, Set<Keybinding>>();\n\t\tfor (const [keybinding, keys] of Object.entries(this.userBindings)) {\n\t\t\tif (!(keybinding in this.definitions)) continue;\n\t\t\tfor (const key of normalizeKeys(keys)) {\n\t\t\t\tconst claimants = userClaims.get(key) ?? new Set<Keybinding>();\n\t\t\t\tclaimants.add(keybinding as Keybinding);\n\t\t\t\tuserClaims.set(key, claimants);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, keybindings] of userClaims) {\n\t\t\tif (keybindings.size > 1) {\n\t\t\t\tthis.conflicts.push({ key, keybindings: [...keybindings] });\n\t\t\t}\n\t\t}\n\n\t\tfor (const [id, definition] of Object.entries(this.definitions)) {\n\t\t\tconst userKeys = this.userBindings[id];\n\t\t\tconst keys = userKeys === undefined ? normalizeKeys(definition.defaultKeys) : normalizeKeys(userKeys);\n\t\t\tthis.keysById.set(id as Keybinding, keys);\n\t\t}\n\t}\n\n\tmatches(data: string, keybinding: Keybinding): boolean {\n\t\tconst keys = this.keysById.get(keybinding) ?? [];\n\t\tfor (const key of keys) {\n\t\t\tif (matchesKey(data, key)) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetKeys(keybinding: Keybinding): KeyId[] {\n\t\treturn [...(this.keysById.get(keybinding) ?? [])];\n\t}\n\n\tgetDefinition(keybinding: Keybinding): KeybindingDefinition {\n\t\treturn this.definitions[keybinding];\n\t}\n\n\tgetConflicts(): KeybindingConflict[] {\n\t\treturn this.conflicts.map((conflict) => ({ ...conflict, keybindings: [...conflict.keybindings] }));\n\t}\n\n\tsetUserBindings(userBindings: KeybindingsConfig): void {\n\t\tthis.userBindings = userBindings;\n\t\tthis.rebuild();\n\t}\n\n\tgetUserBindings(): KeybindingsConfig {\n\t\treturn { ...this.userBindings };\n\t}\n\n\tgetResolvedBindings(): KeybindingsConfig {\n\t\tconst resolved: KeybindingsConfig = {};\n\t\tfor (const id of Object.keys(this.definitions)) {\n\t\t\tconst keys = this.keysById.get(id as Keybinding) ?? [];\n\t\t\tresolved[id] = keys.length === 1 ? keys[0]! : [...keys];\n\t\t}\n\t\treturn resolved;\n\t}\n}\n\nlet globalKeybindings: KeybindingsManager | null = null;\n\nexport function setKeybindings(keybindings: KeybindingsManager): void {\n\tglobalKeybindings = keybindings;\n}\n\nexport function getKeybindings(): KeybindingsManager {\n\tif (!globalKeybindings) {\n\t\tglobalKeybindings = new KeybindingsManager(TUI_KEYBINDINGS);\n\t}\n\treturn globalKeybindings;\n}\n"]}