open-multi-agent-kit 0.80.7 → 0.80.8

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 (1470) hide show
  1. package/CHANGELOG.md +4 -30
  2. package/README.md +80 -38
  3. package/dist/agents/jailbreak/index.d.ts +7 -0
  4. package/dist/agents/jailbreak/index.d.ts.map +1 -0
  5. package/dist/agents/jailbreak/index.js +7 -0
  6. package/dist/agents/jailbreak/index.js.map +1 -0
  7. package/dist/agents/jailbreak/subagent-f.d.ts +44 -0
  8. package/dist/agents/jailbreak/subagent-f.d.ts.map +1 -0
  9. package/dist/agents/jailbreak/subagent-f.js +60 -0
  10. package/dist/agents/jailbreak/subagent-f.js.map +1 -0
  11. package/dist/bun/register-bedrock.d.ts.map +1 -1
  12. package/dist/bun/register-bedrock.js +2 -2
  13. package/dist/bun/register-bedrock.js.map +1 -1
  14. package/dist/ci/verify-reporter.d.ts +22 -0
  15. package/dist/ci/verify-reporter.d.ts.map +1 -0
  16. package/dist/ci/verify-reporter.js +50 -0
  17. package/dist/ci/verify-reporter.js.map +1 -0
  18. package/dist/cli/args.d.ts +4 -1
  19. package/dist/cli/args.d.ts.map +1 -1
  20. package/dist/cli/args.js +7 -0
  21. package/dist/cli/args.js.map +1 -1
  22. package/dist/cli/config-selector.d.ts.map +1 -1
  23. package/dist/cli/config-selector.js +1 -1
  24. package/dist/cli/config-selector.js.map +1 -1
  25. package/dist/cli/file-processor.d.ts +1 -1
  26. package/dist/cli/file-processor.d.ts.map +1 -1
  27. package/dist/cli/file-processor.js.map +1 -1
  28. package/dist/cli/initial-message.d.ts +1 -1
  29. package/dist/cli/initial-message.d.ts.map +1 -1
  30. package/dist/cli/initial-message.js.map +1 -1
  31. package/dist/cli/jailbreak-args.d.ts +26 -0
  32. package/dist/cli/jailbreak-args.d.ts.map +1 -0
  33. package/dist/cli/jailbreak-args.js +86 -0
  34. package/dist/cli/jailbreak-args.js.map +1 -0
  35. package/dist/cli/list-models.d.ts.map +1 -1
  36. package/dist/cli/list-models.js +1 -1
  37. package/dist/cli/list-models.js.map +1 -1
  38. package/dist/cli/session-picker.d.ts.map +1 -1
  39. package/dist/cli/session-picker.js +1 -1
  40. package/dist/cli/session-picker.js.map +1 -1
  41. package/dist/commands/doctor-provider.d.ts +19 -0
  42. package/dist/commands/doctor-provider.d.ts.map +1 -0
  43. package/dist/commands/doctor-provider.js +123 -0
  44. package/dist/commands/doctor-provider.js.map +1 -0
  45. package/dist/commands/jailbreak.d.ts +49 -0
  46. package/dist/commands/jailbreak.d.ts.map +1 -0
  47. package/dist/commands/jailbreak.js +201 -0
  48. package/dist/commands/jailbreak.js.map +1 -0
  49. package/dist/config.d.ts +9 -5
  50. package/dist/config.d.ts.map +1 -1
  51. package/dist/config.js +33 -52
  52. package/dist/config.js.map +1 -1
  53. package/dist/core/agent-session-services.d.ts +2 -2
  54. package/dist/core/agent-session-services.d.ts.map +1 -1
  55. package/dist/core/agent-session-services.js.map +1 -1
  56. package/dist/core/agent-session.d.ts +16 -27
  57. package/dist/core/agent-session.d.ts.map +1 -1
  58. package/dist/core/agent-session.js +185 -89
  59. package/dist/core/agent-session.js.map +1 -1
  60. package/dist/core/auth-storage.d.ts +3 -6
  61. package/dist/core/auth-storage.d.ts.map +1 -1
  62. package/dist/core/auth-storage.js +7 -7
  63. package/dist/core/auth-storage.js.map +1 -1
  64. package/dist/core/bash-executor.d.ts +1 -0
  65. package/dist/core/bash-executor.d.ts.map +1 -1
  66. package/dist/core/bash-executor.js +1 -0
  67. package/dist/core/bash-executor.js.map +1 -1
  68. package/dist/core/browser-use.d.ts +45 -0
  69. package/dist/core/browser-use.d.ts.map +1 -0
  70. package/dist/core/browser-use.js +70 -0
  71. package/dist/core/browser-use.js.map +1 -0
  72. package/dist/core/command-safety-parser.d.ts +77 -0
  73. package/dist/core/command-safety-parser.d.ts.map +1 -0
  74. package/dist/core/command-safety-parser.js +763 -0
  75. package/dist/core/command-safety-parser.js.map +1 -0
  76. package/dist/core/command-safety.d.ts.map +1 -1
  77. package/dist/core/command-safety.js +106 -3
  78. package/dist/core/command-safety.js.map +1 -1
  79. package/dist/core/compaction/branch-summarization.d.ts +2 -2
  80. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  81. package/dist/core/compaction/branch-summarization.js +5 -21
  82. package/dist/core/compaction/branch-summarization.js.map +1 -1
  83. package/dist/core/compaction/compaction.d.ts +3 -101
  84. package/dist/core/compaction/compaction.d.ts.map +1 -1
  85. package/dist/core/compaction/compaction.js +21 -656
  86. package/dist/core/compaction/compaction.js.map +1 -1
  87. package/dist/core/compaction/utils.d.ts +2 -2
  88. package/dist/core/compaction/utils.d.ts.map +1 -1
  89. package/dist/core/compaction/utils.js.map +1 -1
  90. package/dist/core/compactor.d.ts +42 -0
  91. package/dist/core/compactor.d.ts.map +1 -0
  92. package/dist/core/compactor.js +131 -0
  93. package/dist/core/compactor.js.map +1 -0
  94. package/dist/core/context-budget-compressors.d.ts +50 -0
  95. package/dist/core/context-budget-compressors.d.ts.map +1 -0
  96. package/dist/core/context-budget-compressors.js +166 -0
  97. package/dist/core/context-budget-compressors.js.map +1 -0
  98. package/dist/core/context-budget-governor-v2.d.ts +7 -0
  99. package/dist/core/context-budget-governor-v2.d.ts.map +1 -0
  100. package/dist/core/context-budget-governor-v2.js +7 -0
  101. package/dist/core/context-budget-governor-v2.js.map +1 -0
  102. package/dist/core/context-budget-governor.d.ts +67 -0
  103. package/dist/core/context-budget-governor.d.ts.map +1 -0
  104. package/dist/core/context-budget-governor.js +224 -0
  105. package/dist/core/context-budget-governor.js.map +1 -0
  106. package/dist/core/context-budget-headroom-candidates.d.ts +3 -0
  107. package/dist/core/context-budget-headroom-candidates.d.ts.map +1 -0
  108. package/dist/core/context-budget-headroom-candidates.js +85 -0
  109. package/dist/core/context-budget-headroom-candidates.js.map +1 -0
  110. package/dist/core/context-budget-headroom-types.d.ts +67 -0
  111. package/dist/core/context-budget-headroom-types.d.ts.map +1 -0
  112. package/dist/core/context-budget-headroom-types.js +46 -0
  113. package/dist/core/context-budget-headroom-types.js.map +1 -0
  114. package/dist/core/context-budget-headroom.d.ts +5 -0
  115. package/dist/core/context-budget-headroom.d.ts.map +1 -0
  116. package/dist/core/context-budget-headroom.js +123 -0
  117. package/dist/core/context-budget-headroom.js.map +1 -0
  118. package/dist/core/context-budget-relevance.d.ts +46 -0
  119. package/dist/core/context-budget-relevance.d.ts.map +1 -0
  120. package/dist/core/context-budget-relevance.js +329 -0
  121. package/dist/core/context-budget-relevance.js.map +1 -0
  122. package/dist/core/context-budget-system-prompt-items.d.ts +19 -0
  123. package/dist/core/context-budget-system-prompt-items.d.ts.map +1 -0
  124. package/dist/core/context-budget-system-prompt-items.js +143 -0
  125. package/dist/core/context-budget-system-prompt-items.js.map +1 -0
  126. package/dist/core/context-budget-system-prompt.d.ts +31 -0
  127. package/dist/core/context-budget-system-prompt.d.ts.map +1 -0
  128. package/dist/core/context-budget-system-prompt.js +87 -0
  129. package/dist/core/context-budget-system-prompt.js.map +1 -0
  130. package/dist/core/context-budget-token-counter.d.ts +34 -0
  131. package/dist/core/context-budget-token-counter.d.ts.map +1 -0
  132. package/dist/core/context-budget-token-counter.js +315 -0
  133. package/dist/core/context-budget-token-counter.js.map +1 -0
  134. package/dist/core/context-budget-v2-coverage.d.ts +5 -0
  135. package/dist/core/context-budget-v2-coverage.d.ts.map +1 -0
  136. package/dist/core/context-budget-v2-coverage.js +58 -0
  137. package/dist/core/context-budget-v2-coverage.js.map +1 -0
  138. package/dist/core/context-budget-v2-plan-hash.d.ts +12 -0
  139. package/dist/core/context-budget-v2-plan-hash.d.ts.map +1 -0
  140. package/dist/core/context-budget-v2-plan-hash.js +38 -0
  141. package/dist/core/context-budget-v2-plan-hash.js.map +1 -0
  142. package/dist/core/context-budget-v2-planner.d.ts +3 -0
  143. package/dist/core/context-budget-v2-planner.d.ts.map +1 -0
  144. package/dist/core/context-budget-v2-planner.js +143 -0
  145. package/dist/core/context-budget-v2-planner.js.map +1 -0
  146. package/dist/core/context-budget-v2-scoring.d.ts +14 -0
  147. package/dist/core/context-budget-v2-scoring.d.ts.map +1 -0
  148. package/dist/core/context-budget-v2-scoring.js +114 -0
  149. package/dist/core/context-budget-v2-scoring.js.map +1 -0
  150. package/dist/core/context-budget-v2-selection.d.ts +32 -0
  151. package/dist/core/context-budget-v2-selection.d.ts.map +1 -0
  152. package/dist/core/context-budget-v2-selection.js +158 -0
  153. package/dist/core/context-budget-v2-selection.js.map +1 -0
  154. package/dist/core/context-budget-v2-tiers.d.ts +15 -0
  155. package/dist/core/context-budget-v2-tiers.d.ts.map +1 -0
  156. package/dist/core/context-budget-v2-tiers.js +68 -0
  157. package/dist/core/context-budget-v2-tiers.js.map +1 -0
  158. package/dist/core/context-budget-v2-types.d.ts +92 -0
  159. package/dist/core/context-budget-v2-types.d.ts.map +1 -0
  160. package/dist/core/context-budget-v2-types.js +24 -0
  161. package/dist/core/context-budget-v2-types.js.map +1 -0
  162. package/dist/core/defaults.d.ts +1 -1
  163. package/dist/core/defaults.d.ts.map +1 -1
  164. package/dist/core/defaults.js.map +1 -1
  165. package/dist/core/diagnostics.d.ts +4 -0
  166. package/dist/core/diagnostics.d.ts.map +1 -1
  167. package/dist/core/diagnostics.js.map +1 -1
  168. package/dist/core/domain-confidence.d.ts +9 -0
  169. package/dist/core/domain-confidence.d.ts.map +1 -0
  170. package/dist/core/domain-confidence.js +39 -0
  171. package/dist/core/domain-confidence.js.map +1 -0
  172. package/dist/core/domain-dispatch.d.ts +44 -0
  173. package/dist/core/domain-dispatch.d.ts.map +1 -0
  174. package/dist/core/domain-dispatch.js +118 -0
  175. package/dist/core/domain-dispatch.js.map +1 -0
  176. package/dist/core/domain-loadouts.d.ts +76 -0
  177. package/dist/core/domain-loadouts.d.ts.map +1 -0
  178. package/dist/core/domain-loadouts.js +981 -0
  179. package/dist/core/domain-loadouts.js.map +1 -0
  180. package/dist/core/domain-registry.d.ts +7 -0
  181. package/dist/core/domain-registry.d.ts.map +1 -0
  182. package/dist/core/domain-registry.js +11 -0
  183. package/dist/core/domain-registry.js.map +1 -0
  184. package/dist/core/domain-router.d.ts +16 -0
  185. package/dist/core/domain-router.d.ts.map +1 -0
  186. package/dist/core/domain-router.js +24 -0
  187. package/dist/core/domain-router.js.map +1 -0
  188. package/dist/core/domain-score.d.ts +13 -0
  189. package/dist/core/domain-score.d.ts.map +1 -0
  190. package/dist/core/domain-score.js +48 -0
  191. package/dist/core/domain-score.js.map +1 -0
  192. package/dist/core/domain-trigger-match.d.ts +14 -0
  193. package/dist/core/domain-trigger-match.d.ts.map +1 -0
  194. package/dist/core/domain-trigger-match.js +51 -0
  195. package/dist/core/domain-trigger-match.js.map +1 -0
  196. package/dist/core/domain-types.d.ts +30 -0
  197. package/dist/core/domain-types.d.ts.map +1 -0
  198. package/dist/core/domain-types.js +2 -0
  199. package/dist/core/domain-types.js.map +1 -0
  200. package/dist/core/exact-cache-policy.d.ts +8 -0
  201. package/dist/core/exact-cache-policy.d.ts.map +1 -1
  202. package/dist/core/exact-cache-policy.js +9 -0
  203. package/dist/core/exact-cache-policy.js.map +1 -1
  204. package/dist/core/exec.d.ts +0 -2
  205. package/dist/core/exec.d.ts.map +1 -1
  206. package/dist/core/exec.js +0 -1
  207. package/dist/core/exec.js.map +1 -1
  208. package/dist/core/export-html/index.d.ts +1 -1
  209. package/dist/core/export-html/index.d.ts.map +1 -1
  210. package/dist/core/export-html/index.js.map +1 -1
  211. package/dist/core/export-html/template.js +1 -3
  212. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  213. package/dist/core/export-html/tool-renderer.js.map +1 -1
  214. package/dist/core/extensions/builtin/command-safety-gate.d.ts +3 -0
  215. package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -1
  216. package/dist/core/extensions/builtin/command-safety-gate.js +15 -3
  217. package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -1
  218. package/dist/core/extensions/builtin/todo-checklist.d.ts +20 -0
  219. package/dist/core/extensions/builtin/todo-checklist.d.ts.map +1 -0
  220. package/dist/core/extensions/builtin/todo-checklist.js +70 -0
  221. package/dist/core/extensions/builtin/todo-checklist.js.map +1 -0
  222. package/dist/core/extensions/loader.d.ts +4 -4
  223. package/dist/core/extensions/loader.d.ts.map +1 -1
  224. package/dist/core/extensions/loader.js +57 -92
  225. package/dist/core/extensions/loader.js.map +1 -1
  226. package/dist/core/extensions/runner.d.ts +3 -3
  227. package/dist/core/extensions/runner.d.ts.map +1 -1
  228. package/dist/core/extensions/runner.js +1 -1
  229. package/dist/core/extensions/runner.js.map +1 -1
  230. package/dist/core/extensions/types.d.ts +7 -35
  231. package/dist/core/extensions/types.d.ts.map +1 -1
  232. package/dist/core/extensions/types.js.map +1 -1
  233. package/dist/core/extensions/wrapper.d.ts +1 -1
  234. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  235. package/dist/core/extensions/wrapper.js.map +1 -1
  236. package/dist/core/headroom.d.ts +45 -0
  237. package/dist/core/headroom.d.ts.map +1 -0
  238. package/dist/core/headroom.js +171 -0
  239. package/dist/core/headroom.js.map +1 -0
  240. package/dist/core/hook-inventory.d.ts +4 -2
  241. package/dist/core/hook-inventory.d.ts.map +1 -1
  242. package/dist/core/hook-inventory.js +80 -11
  243. package/dist/core/hook-inventory.js.map +1 -1
  244. package/dist/core/hooks/fail-closed.d.ts +4 -1
  245. package/dist/core/hooks/fail-closed.d.ts.map +1 -1
  246. package/dist/core/hooks/fail-closed.js +79 -5
  247. package/dist/core/hooks/fail-closed.js.map +1 -1
  248. package/dist/core/hooks/index.d.ts +2 -2
  249. package/dist/core/hooks/index.d.ts.map +1 -1
  250. package/dist/core/hooks/index.js +1 -1
  251. package/dist/core/hooks/index.js.map +1 -1
  252. package/dist/core/hooks/types.d.ts +9 -0
  253. package/dist/core/hooks/types.d.ts.map +1 -1
  254. package/dist/core/hooks/types.js.map +1 -1
  255. package/dist/core/keybindings.d.ts +2 -14
  256. package/dist/core/keybindings.d.ts.map +1 -1
  257. package/dist/core/keybindings.js +1 -31
  258. package/dist/core/keybindings.js.map +1 -1
  259. package/dist/core/lean-ctx.d.ts +99 -0
  260. package/dist/core/lean-ctx.d.ts.map +1 -0
  261. package/dist/core/lean-ctx.js +225 -0
  262. package/dist/core/lean-ctx.js.map +1 -0
  263. package/dist/core/loadout-compose.d.ts +53 -0
  264. package/dist/core/loadout-compose.d.ts.map +1 -0
  265. package/dist/core/loadout-compose.js +172 -0
  266. package/dist/core/loadout-compose.js.map +1 -0
  267. package/dist/core/loadout-policy-bridge.d.ts +22 -0
  268. package/dist/core/loadout-policy-bridge.d.ts.map +1 -0
  269. package/dist/core/loadout-policy-bridge.js +52 -0
  270. package/dist/core/loadout-policy-bridge.js.map +1 -0
  271. package/dist/core/loadout-runtime.d.ts +22 -0
  272. package/dist/core/loadout-runtime.d.ts.map +1 -1
  273. package/dist/core/loadout-runtime.js +41 -5
  274. package/dist/core/loadout-runtime.js.map +1 -1
  275. package/dist/core/loadout-safety.d.ts +55 -0
  276. package/dist/core/loadout-safety.d.ts.map +1 -0
  277. package/dist/core/loadout-safety.js +213 -0
  278. package/dist/core/loadout-safety.js.map +1 -0
  279. package/dist/core/loadouts.d.ts +4 -2
  280. package/dist/core/loadouts.d.ts.map +1 -1
  281. package/dist/core/loadouts.js +116 -5
  282. package/dist/core/loadouts.js.map +1 -1
  283. package/dist/core/loop-gates.d.ts +48 -0
  284. package/dist/core/loop-gates.d.ts.map +1 -0
  285. package/dist/core/loop-gates.js +352 -0
  286. package/dist/core/loop-gates.js.map +1 -0
  287. package/dist/core/loop-registry.d.ts +77 -0
  288. package/dist/core/loop-registry.d.ts.map +1 -0
  289. package/dist/core/loop-registry.js +831 -0
  290. package/dist/core/loop-registry.js.map +1 -0
  291. package/dist/core/loop-types.d.ts +194 -0
  292. package/dist/core/loop-types.d.ts.map +1 -0
  293. package/dist/core/loop-types.js +2 -0
  294. package/dist/core/loop-types.js.map +1 -0
  295. package/dist/core/mcp-inventory.d.ts +7 -0
  296. package/dist/core/mcp-inventory.d.ts.map +1 -1
  297. package/dist/core/mcp-inventory.js +5 -1
  298. package/dist/core/mcp-inventory.js.map +1 -1
  299. package/dist/core/mcp-presets.d.ts +43 -2
  300. package/dist/core/mcp-presets.d.ts.map +1 -1
  301. package/dist/core/mcp-presets.js +298 -2
  302. package/dist/core/mcp-presets.js.map +1 -1
  303. package/dist/core/messages.d.ts +3 -3
  304. package/dist/core/messages.d.ts.map +1 -1
  305. package/dist/core/messages.js.map +1 -1
  306. package/dist/core/metrics-sampler.d.ts +11 -0
  307. package/dist/core/metrics-sampler.d.ts.map +1 -1
  308. package/dist/core/metrics-sampler.js +52 -13
  309. package/dist/core/metrics-sampler.js.map +1 -1
  310. package/dist/core/model-registry.d.ts +1 -2
  311. package/dist/core/model-registry.d.ts.map +1 -1
  312. package/dist/core/model-registry.js +18 -41
  313. package/dist/core/model-registry.js.map +1 -1
  314. package/dist/core/model-resolver.d.ts +2 -2
  315. package/dist/core/model-resolver.d.ts.map +1 -1
  316. package/dist/core/model-resolver.js +1 -2
  317. package/dist/core/model-resolver.js.map +1 -1
  318. package/dist/core/package-gallery-identity.d.ts +7 -0
  319. package/dist/core/package-gallery-identity.d.ts.map +1 -0
  320. package/dist/core/package-gallery-identity.js +31 -0
  321. package/dist/core/package-gallery-identity.js.map +1 -0
  322. package/dist/core/package-gallery-install.d.ts +6 -0
  323. package/dist/core/package-gallery-install.d.ts.map +1 -0
  324. package/dist/core/package-gallery-install.js +59 -0
  325. package/dist/core/package-gallery-install.js.map +1 -0
  326. package/dist/core/package-gallery-manifest.d.ts +13 -0
  327. package/dist/core/package-gallery-manifest.d.ts.map +1 -0
  328. package/dist/core/package-gallery-manifest.js +183 -0
  329. package/dist/core/package-gallery-manifest.js.map +1 -0
  330. package/dist/core/package-gallery-trial.d.ts +4 -0
  331. package/dist/core/package-gallery-trial.d.ts.map +1 -0
  332. package/dist/core/package-gallery-trial.js +55 -0
  333. package/dist/core/package-gallery-trial.js.map +1 -0
  334. package/dist/core/package-gallery-types.d.ts +71 -0
  335. package/dist/core/package-gallery-types.d.ts.map +1 -0
  336. package/dist/core/package-gallery-types.js +2 -0
  337. package/dist/core/package-gallery-types.js.map +1 -0
  338. package/dist/core/package-gallery.d.ts +5 -123
  339. package/dist/core/package-gallery.d.ts.map +1 -1
  340. package/dist/core/package-gallery.js +5 -391
  341. package/dist/core/package-gallery.js.map +1 -1
  342. package/dist/core/package-manager.d.ts +0 -69
  343. package/dist/core/package-manager.d.ts.map +1 -1
  344. package/dist/core/package-manager.js +69 -367
  345. package/dist/core/package-manager.js.map +1 -1
  346. package/dist/core/package-procurement.d.ts +4 -4
  347. package/dist/core/package-procurement.d.ts.map +1 -1
  348. package/dist/core/package-procurement.js +29 -17
  349. package/dist/core/package-procurement.js.map +1 -1
  350. package/dist/core/provider-attribution.d.ts +1 -1
  351. package/dist/core/provider-attribution.d.ts.map +1 -1
  352. package/dist/core/provider-attribution.js.map +1 -1
  353. package/dist/core/read-anchors.d.ts +1 -1
  354. package/dist/core/read-anchors.d.ts.map +1 -1
  355. package/dist/core/read-anchors.js +1 -1
  356. package/dist/core/read-anchors.js.map +1 -1
  357. package/dist/core/recovery-checkpoint.d.ts +2 -2
  358. package/dist/core/recovery-checkpoint.d.ts.map +1 -1
  359. package/dist/core/recovery-checkpoint.js +2 -2
  360. package/dist/core/recovery-checkpoint.js.map +1 -1
  361. package/dist/core/resolve-config-value.d.ts +1 -1
  362. package/dist/core/resolve-config-value.d.ts.map +1 -1
  363. package/dist/core/resolve-config-value.js +2 -30
  364. package/dist/core/resolve-config-value.js.map +1 -1
  365. package/dist/core/resource-loader.d.ts +12 -20
  366. package/dist/core/resource-loader.d.ts.map +1 -1
  367. package/dist/core/resource-loader.js +66 -90
  368. package/dist/core/resource-loader.js.map +1 -1
  369. package/dist/core/sandbox-policy-v2.d.ts +49 -0
  370. package/dist/core/sandbox-policy-v2.d.ts.map +1 -0
  371. package/dist/core/sandbox-policy-v2.js +368 -0
  372. package/dist/core/sandbox-policy-v2.js.map +1 -0
  373. package/dist/core/sdk.d.ts +10 -78
  374. package/dist/core/sdk.d.ts.map +1 -1
  375. package/dist/core/sdk.js +97 -139
  376. package/dist/core/sdk.js.map +1 -1
  377. package/dist/core/semantic-cache-policy.d.ts +7 -1
  378. package/dist/core/semantic-cache-policy.d.ts.map +1 -1
  379. package/dist/core/semantic-cache-policy.js +8 -0
  380. package/dist/core/semantic-cache-policy.js.map +1 -1
  381. package/dist/core/session-manager.d.ts +2 -4
  382. package/dist/core/session-manager.d.ts.map +1 -1
  383. package/dist/core/session-manager.js +5 -6
  384. package/dist/core/session-manager.js.map +1 -1
  385. package/dist/core/settings-manager.d.ts +1 -18
  386. package/dist/core/settings-manager.d.ts.map +1 -1
  387. package/dist/core/settings-manager.js +2 -48
  388. package/dist/core/settings-manager.js.map +1 -1
  389. package/dist/core/skills.d.ts +1 -0
  390. package/dist/core/skills.d.ts.map +1 -1
  391. package/dist/core/skills.js +46 -5
  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 +0 -2
  395. package/dist/core/slash-commands.js.map +1 -1
  396. package/dist/core/subagent-orchestration.d.ts +73 -0
  397. package/dist/core/subagent-orchestration.d.ts.map +1 -0
  398. package/dist/core/subagent-orchestration.js +408 -0
  399. package/dist/core/subagent-orchestration.js.map +1 -0
  400. package/dist/core/system-prompt.d.ts +5 -4
  401. package/dist/core/system-prompt.d.ts.map +1 -1
  402. package/dist/core/system-prompt.js +57 -36
  403. package/dist/core/system-prompt.js.map +1 -1
  404. package/dist/core/timings.d.ts +0 -4
  405. package/dist/core/timings.d.ts.map +1 -1
  406. package/dist/core/timings.js +0 -4
  407. package/dist/core/timings.js.map +1 -1
  408. package/dist/core/todo-state.d.ts +53 -0
  409. package/dist/core/todo-state.d.ts.map +1 -0
  410. package/dist/core/todo-state.js +87 -0
  411. package/dist/core/todo-state.js.map +1 -0
  412. package/dist/core/token-optimizer.d.ts +58 -0
  413. package/dist/core/token-optimizer.d.ts.map +1 -0
  414. package/dist/core/token-optimizer.js +179 -0
  415. package/dist/core/token-optimizer.js.map +1 -0
  416. package/dist/core/tools/bash.d.ts +8 -9
  417. package/dist/core/tools/bash.d.ts.map +1 -1
  418. package/dist/core/tools/bash.js +9 -8
  419. package/dist/core/tools/bash.js.map +1 -1
  420. package/dist/core/tools/edit.d.ts +3 -14
  421. package/dist/core/tools/edit.d.ts.map +1 -1
  422. package/dist/core/tools/edit.js +4 -25
  423. package/dist/core/tools/edit.js.map +1 -1
  424. package/dist/core/tools/find.d.ts +1 -4
  425. package/dist/core/tools/find.d.ts.map +1 -1
  426. package/dist/core/tools/find.js +1 -4
  427. package/dist/core/tools/find.js.map +1 -1
  428. package/dist/core/tools/grep.d.ts +1 -4
  429. package/dist/core/tools/grep.d.ts.map +1 -1
  430. package/dist/core/tools/grep.js +2 -5
  431. package/dist/core/tools/grep.js.map +1 -1
  432. package/dist/core/tools/index.d.ts +2 -2
  433. package/dist/core/tools/index.d.ts.map +1 -1
  434. package/dist/core/tools/index.js.map +1 -1
  435. package/dist/core/tools/ls.d.ts +1 -4
  436. package/dist/core/tools/ls.d.ts.map +1 -1
  437. package/dist/core/tools/ls.js +1 -4
  438. package/dist/core/tools/ls.js.map +1 -1
  439. package/dist/core/tools/read.d.ts +2 -14
  440. package/dist/core/tools/read.d.ts.map +1 -1
  441. package/dist/core/tools/read.js +4 -28
  442. package/dist/core/tools/read.js.map +1 -1
  443. package/dist/core/tools/render-utils.d.ts +1 -1
  444. package/dist/core/tools/render-utils.d.ts.map +1 -1
  445. package/dist/core/tools/render-utils.js +1 -1
  446. package/dist/core/tools/render-utils.js.map +1 -1
  447. package/dist/core/tools/tool-definition-wrapper.d.ts +1 -1
  448. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  449. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  450. package/dist/core/tools/write.d.ts +2 -4
  451. package/dist/core/tools/write.d.ts.map +1 -1
  452. package/dist/core/tools/write.js +4 -4
  453. package/dist/core/tools/write.js.map +1 -1
  454. package/dist/encoding/index.d.ts +6 -0
  455. package/dist/encoding/index.d.ts.map +1 -0
  456. package/dist/encoding/index.js +6 -0
  457. package/dist/encoding/index.js.map +1 -0
  458. package/dist/encoding/l4-encoder.d.ts +96 -0
  459. package/dist/encoding/l4-encoder.d.ts.map +1 -0
  460. package/dist/encoding/l4-encoder.js +474 -0
  461. package/dist/encoding/l4-encoder.js.map +1 -0
  462. package/dist/fuzzing/index.d.ts +6 -0
  463. package/dist/fuzzing/index.d.ts.map +1 -0
  464. package/dist/fuzzing/index.js +6 -0
  465. package/dist/fuzzing/index.js.map +1 -0
  466. package/dist/fuzzing/mutation-engine.d.ts +93 -0
  467. package/dist/fuzzing/mutation-engine.d.ts.map +1 -0
  468. package/dist/fuzzing/mutation-engine.js +244 -0
  469. package/dist/fuzzing/mutation-engine.js.map +1 -0
  470. package/dist/guardrails/audit-logger.d.ts +4 -0
  471. package/dist/guardrails/audit-logger.d.ts.map +1 -0
  472. package/dist/guardrails/audit-logger.js +28 -0
  473. package/dist/guardrails/audit-logger.js.map +1 -0
  474. package/dist/guardrails/evidence-system.d.ts +61 -0
  475. package/dist/guardrails/evidence-system.d.ts.map +1 -0
  476. package/dist/guardrails/evidence-system.js +302 -0
  477. package/dist/guardrails/evidence-system.js.map +1 -0
  478. package/dist/guardrails/freedomd-adapter.d.ts +16 -0
  479. package/dist/guardrails/freedomd-adapter.d.ts.map +1 -0
  480. package/dist/guardrails/freedomd-adapter.js +87 -0
  481. package/dist/guardrails/freedomd-adapter.js.map +1 -0
  482. package/dist/index.d.ts +4 -19
  483. package/dist/index.d.ts.map +1 -1
  484. package/dist/index.js +2 -17
  485. package/dist/index.js.map +1 -1
  486. package/dist/jailbreak-extension.d.ts +48 -0
  487. package/dist/jailbreak-extension.d.ts.map +1 -0
  488. package/dist/jailbreak-extension.js +47 -0
  489. package/dist/jailbreak-extension.js.map +1 -0
  490. package/dist/main.d.ts.map +1 -1
  491. package/dist/main.js +2 -2
  492. package/dist/main.js.map +1 -1
  493. package/dist/migrations.d.ts +0 -37
  494. package/dist/migrations.d.ts.map +1 -1
  495. package/dist/migrations.js +6 -414
  496. package/dist/migrations.js.map +1 -1
  497. package/dist/modes/interactive/components/armin.d.ts +1 -1
  498. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  499. package/dist/modes/interactive/components/armin.js.map +1 -1
  500. package/dist/modes/interactive/components/assistant-message.d.ts +2 -2
  501. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  502. package/dist/modes/interactive/components/assistant-message.js +1 -1
  503. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  504. package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
  505. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  506. package/dist/modes/interactive/components/bash-execution.js +1 -1
  507. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  508. package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
  509. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  510. package/dist/modes/interactive/components/bordered-loader.js +1 -1
  511. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  512. package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
  513. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  514. package/dist/modes/interactive/components/branch-summary-message.js +1 -1
  515. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  516. package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
  517. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  518. package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  519. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  520. package/dist/modes/interactive/components/config-selector.d.ts +1 -1
  521. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  522. package/dist/modes/interactive/components/config-selector.js +1 -1
  523. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  524. package/dist/modes/interactive/components/control-panel-box.d.ts +15 -0
  525. package/dist/modes/interactive/components/control-panel-box.d.ts.map +1 -0
  526. package/dist/modes/interactive/components/control-panel-box.js +55 -0
  527. package/dist/modes/interactive/components/control-panel-box.js.map +1 -0
  528. package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts.map +1 -1
  529. package/dist/modes/interactive/components/control-panel-gradient-motion.js +2 -36
  530. package/dist/modes/interactive/components/control-panel-gradient-motion.js.map +1 -1
  531. package/dist/modes/interactive/components/control-panel-gradient.d.ts +1 -0
  532. package/dist/modes/interactive/components/control-panel-gradient.d.ts.map +1 -1
  533. package/dist/modes/interactive/components/control-panel-gradient.js +6 -5
  534. package/dist/modes/interactive/components/control-panel-gradient.js.map +1 -1
  535. package/dist/modes/interactive/components/control-panel-layout.d.ts +23 -0
  536. package/dist/modes/interactive/components/control-panel-layout.d.ts.map +1 -0
  537. package/dist/modes/interactive/components/control-panel-layout.js +165 -0
  538. package/dist/modes/interactive/components/control-panel-layout.js.map +1 -0
  539. package/dist/modes/interactive/components/control-panel-runtime-status.d.ts +5 -0
  540. package/dist/modes/interactive/components/control-panel-runtime-status.d.ts.map +1 -0
  541. package/dist/modes/interactive/components/control-panel-runtime-status.js +20 -0
  542. package/dist/modes/interactive/components/control-panel-runtime-status.js.map +1 -0
  543. package/dist/modes/interactive/components/control-panel.d.ts +8 -31
  544. package/dist/modes/interactive/components/control-panel.d.ts.map +1 -1
  545. package/dist/modes/interactive/components/control-panel.js +38 -169
  546. package/dist/modes/interactive/components/control-panel.js.map +1 -1
  547. package/dist/modes/interactive/components/countdown-timer.d.ts +1 -1
  548. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  549. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  550. package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
  551. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  552. package/dist/modes/interactive/components/custom-editor.js +14 -22
  553. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  554. package/dist/modes/interactive/components/custom-message.d.ts +1 -1
  555. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  556. package/dist/modes/interactive/components/custom-message.js +1 -1
  557. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  558. package/dist/modes/interactive/components/daxnuts.d.ts +1 -1
  559. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  560. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  561. package/dist/modes/interactive/components/dynamic-border.d.ts +1 -1
  562. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  563. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  564. package/dist/modes/interactive/components/earendil-announcement.d.ts +1 -1
  565. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  566. package/dist/modes/interactive/components/earendil-announcement.js +1 -1
  567. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  568. package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
  569. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  570. package/dist/modes/interactive/components/extension-editor.js +1 -1
  571. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  572. package/dist/modes/interactive/components/extension-input.d.ts +1 -1
  573. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  574. package/dist/modes/interactive/components/extension-input.js +1 -1
  575. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  576. package/dist/modes/interactive/components/extension-selector.d.ts +1 -1
  577. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  578. package/dist/modes/interactive/components/extension-selector.js +1 -1
  579. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  580. package/dist/modes/interactive/components/footer.d.ts +1 -1
  581. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  582. package/dist/modes/interactive/components/footer.js +1 -9
  583. package/dist/modes/interactive/components/footer.js.map +1 -1
  584. package/dist/modes/interactive/components/index.d.ts +0 -2
  585. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  586. package/dist/modes/interactive/components/index.js +0 -2
  587. package/dist/modes/interactive/components/index.js.map +1 -1
  588. package/dist/modes/interactive/components/keybinding-hints.d.ts +1 -1
  589. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  590. package/dist/modes/interactive/components/keybinding-hints.js +1 -1
  591. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  592. package/dist/modes/interactive/components/login-dialog.d.ts +2 -2
  593. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  594. package/dist/modes/interactive/components/login-dialog.js +2 -2
  595. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  596. package/dist/modes/interactive/components/model-selector.d.ts +13 -47
  597. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  598. package/dist/modes/interactive/components/model-selector.js +118 -193
  599. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  600. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  601. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  602. package/dist/modes/interactive/components/oauth-selector.js +1 -1
  603. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  604. package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
  605. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  606. package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  607. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  608. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  609. package/dist/modes/interactive/components/session-selector-search.js +1 -1
  610. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  611. package/dist/modes/interactive/components/session-selector.d.ts +1 -1
  612. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  613. package/dist/modes/interactive/components/session-selector.js +1 -1
  614. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  615. package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
  616. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  617. package/dist/modes/interactive/components/settings-selector.js +1 -1
  618. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  619. package/dist/modes/interactive/components/show-images-selector.d.ts +1 -1
  620. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  621. package/dist/modes/interactive/components/show-images-selector.js +1 -1
  622. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  623. package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
  624. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  625. package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
  626. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  627. package/dist/modes/interactive/components/theme-selector.d.ts +1 -2
  628. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  629. package/dist/modes/interactive/components/theme-selector.js +2 -11
  630. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  631. package/dist/modes/interactive/components/thinking-selector.d.ts +8 -7
  632. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  633. package/dist/modes/interactive/components/thinking-selector.js +48 -7
  634. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  635. package/dist/modes/interactive/components/todo-checklist.d.ts +31 -0
  636. package/dist/modes/interactive/components/todo-checklist.d.ts.map +1 -0
  637. package/dist/modes/interactive/components/todo-checklist.js +121 -0
  638. package/dist/modes/interactive/components/todo-checklist.js.map +1 -0
  639. package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
  640. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  641. package/dist/modes/interactive/components/tool-execution.js +1 -1
  642. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  643. package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
  644. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  645. package/dist/modes/interactive/components/tree-selector.js +1 -1
  646. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  647. package/dist/modes/interactive/components/user-message-selector.d.ts +1 -1
  648. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  649. package/dist/modes/interactive/components/user-message-selector.js +1 -1
  650. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  651. package/dist/modes/interactive/components/user-message.d.ts +1 -1
  652. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  653. package/dist/modes/interactive/components/user-message.js +1 -1
  654. package/dist/modes/interactive/components/user-message.js.map +1 -1
  655. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  656. package/dist/modes/interactive/components/visual-truncate.js +1 -1
  657. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  658. package/dist/modes/interactive/interactive-mode.d.ts +3 -8
  659. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  660. package/dist/modes/interactive/interactive-mode.js +74 -232
  661. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  662. package/dist/modes/interactive/theme/omk-control-grid-dark.json +65 -77
  663. package/dist/modes/interactive/theme/omk-neon-control.json +90 -0
  664. package/dist/modes/interactive/theme/rust-forge.json +14 -24
  665. package/dist/modes/interactive/theme/theme.d.ts +1 -1
  666. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  667. package/dist/modes/interactive/theme/theme.js +22 -45
  668. package/dist/modes/interactive/theme/theme.js.map +1 -1
  669. package/dist/modes/print-mode.d.ts +1 -1
  670. package/dist/modes/print-mode.d.ts.map +1 -1
  671. package/dist/modes/print-mode.js.map +1 -1
  672. package/dist/modes/rpc/rpc-client.d.ts +2 -2
  673. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  674. package/dist/modes/rpc/rpc-client.js.map +1 -1
  675. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  676. package/dist/modes/rpc/rpc-mode.js +0 -4
  677. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  678. package/dist/modes/rpc/rpc-types.d.ts +2 -2
  679. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  680. package/dist/modes/rpc/rpc-types.js.map +1 -1
  681. package/dist/modules/index.d.ts +8 -0
  682. package/dist/modules/index.d.ts.map +1 -0
  683. package/dist/modules/index.js +7 -0
  684. package/dist/modules/index.js.map +1 -0
  685. package/dist/modules/lrl-bypass.d.ts +40 -0
  686. package/dist/modules/lrl-bypass.d.ts.map +1 -0
  687. package/dist/modules/lrl-bypass.js +84 -0
  688. package/dist/modules/lrl-bypass.js.map +1 -0
  689. package/dist/modules/lrl-deps.d.ts +38 -0
  690. package/dist/modules/lrl-deps.d.ts.map +1 -0
  691. package/dist/modules/lrl-deps.js +128 -0
  692. package/dist/modules/lrl-deps.js.map +1 -0
  693. package/dist/multiturn/easl-chain.d.ts +113 -0
  694. package/dist/multiturn/easl-chain.d.ts.map +1 -0
  695. package/dist/multiturn/easl-chain.js +351 -0
  696. package/dist/multiturn/easl-chain.js.map +1 -0
  697. package/dist/multiturn/index.d.ts +6 -0
  698. package/dist/multiturn/index.d.ts.map +1 -0
  699. package/dist/multiturn/index.js +6 -0
  700. package/dist/multiturn/index.js.map +1 -0
  701. package/dist/orchestration/lane-grant-auditor.d.ts +4 -0
  702. package/dist/orchestration/lane-grant-auditor.d.ts.map +1 -0
  703. package/dist/orchestration/lane-grant-auditor.js +87 -0
  704. package/dist/orchestration/lane-grant-auditor.js.map +1 -0
  705. package/dist/package-manager-cli.d.ts.map +1 -1
  706. package/dist/package-manager-cli.js +48 -113
  707. package/dist/package-manager-cli.js.map +1 -1
  708. package/dist/routing/fallback-router.d.ts +123 -0
  709. package/dist/routing/fallback-router.d.ts.map +1 -0
  710. package/dist/routing/fallback-router.js +355 -0
  711. package/dist/routing/fallback-router.js.map +1 -0
  712. package/dist/routing/index.d.ts +6 -0
  713. package/dist/routing/index.d.ts.map +1 -0
  714. package/dist/routing/index.js +6 -0
  715. package/dist/routing/index.js.map +1 -0
  716. package/dist/types/evidence.d.ts +117 -0
  717. package/dist/types/evidence.d.ts.map +1 -0
  718. package/dist/types/evidence.js +8 -0
  719. package/dist/types/evidence.js.map +1 -0
  720. package/dist/types/guardrails.d.ts +61 -0
  721. package/dist/types/guardrails.d.ts.map +1 -0
  722. package/dist/types/guardrails.js +9 -0
  723. package/dist/types/guardrails.js.map +1 -0
  724. package/dist/types/jailbreak.d.ts +246 -0
  725. package/dist/types/jailbreak.d.ts.map +1 -0
  726. package/dist/types/jailbreak.js +8 -0
  727. package/dist/types/jailbreak.js.map +1 -0
  728. package/dist/types/lane-grant.d.ts +58 -0
  729. package/dist/types/lane-grant.d.ts.map +1 -0
  730. package/dist/types/lane-grant.js +9 -0
  731. package/dist/types/lane-grant.js.map +1 -0
  732. package/dist/utils/jailbreak/common.d.ts +63 -0
  733. package/dist/utils/jailbreak/common.d.ts.map +1 -0
  734. package/dist/utils/jailbreak/common.js +130 -0
  735. package/dist/utils/jailbreak/common.js.map +1 -0
  736. package/dist/utils/jailbreak/index.d.ts +7 -0
  737. package/dist/utils/jailbreak/index.d.ts.map +1 -0
  738. package/dist/utils/jailbreak/index.js +7 -0
  739. package/dist/utils/jailbreak/index.js.map +1 -0
  740. package/dist/utils/windows-self-update.d.ts.map +1 -1
  741. package/dist/utils/windows-self-update.js +1 -1
  742. package/dist/utils/windows-self-update.js.map +1 -1
  743. package/docs/compaction.md +8 -21
  744. package/docs/custom-provider.md +2 -2
  745. package/docs/development.md +1 -1
  746. package/docs/extensions.md +11 -11
  747. package/docs/loadout-domains/README.md +70 -0
  748. package/docs/loadout-domains/ai-agent-ops.md +94 -0
  749. package/docs/loadout-domains/backend-api.md +116 -0
  750. package/docs/loadout-domains/data-science.md +100 -0
  751. package/docs/loadout-domains/devops-infra.md +85 -0
  752. package/docs/loadout-domains/docs-writing.md +92 -0
  753. package/docs/loadout-domains/frontend-ui.md +128 -0
  754. package/docs/loadout-domains/general.md +62 -0
  755. package/docs/loadout-domains/mobile.md +84 -0
  756. package/docs/loadout-domains/qa-testing.md +87 -0
  757. package/docs/loadout-domains/research.md +80 -0
  758. package/docs/loadout-domains/security-audit.md +97 -0
  759. package/docs/packages.md +7 -48
  760. package/docs/prompt-templates.md +0 -2
  761. package/docs/sdk.md +3 -3
  762. package/docs/security.md +145 -0
  763. package/docs/session-format.md +1 -1
  764. package/docs/themes.md +8 -7
  765. package/docs/tui.md +14 -14
  766. package/docs/usage.md +6 -16
  767. package/examples/extensions/README.md +2 -2
  768. package/examples/extensions/aside-computer-use/README.md +114 -0
  769. package/examples/extensions/aside-computer-use/action-scoring.ts +122 -0
  770. package/examples/extensions/aside-computer-use/assertions.ts +380 -0
  771. package/examples/extensions/aside-computer-use/controller.ts +491 -0
  772. package/examples/extensions/aside-computer-use/evidence.ts +229 -0
  773. package/examples/extensions/aside-computer-use/golden-trace.ts +141 -0
  774. package/examples/extensions/aside-computer-use/index.ts +76 -0
  775. package/examples/extensions/aside-computer-use/mcp-client.ts +381 -0
  776. package/examples/extensions/aside-computer-use/observation-snapshot.ts +121 -0
  777. package/examples/extensions/aside-computer-use/package.json +16 -0
  778. package/examples/extensions/aside-computer-use/policy.ts +257 -0
  779. package/examples/extensions/aside-computer-use/risk-authorize.ts +200 -0
  780. package/examples/extensions/aside-computer-use/risk-classifier.ts +205 -0
  781. package/examples/extensions/aside-computer-use/schema-fingerprint.ts +80 -0
  782. package/examples/extensions/aside-computer-use/session-binding.ts +161 -0
  783. package/examples/extensions/aside-computer-use/tools.ts +449 -0
  784. package/examples/extensions/aside-computer-use/types.ts +217 -0
  785. package/examples/extensions/aside-computer-use/url-origin.ts +132 -0
  786. package/examples/extensions/bash-spawn-hook.ts +1 -1
  787. package/examples/extensions/border-status-editor.ts +2 -2
  788. package/examples/extensions/built-in-tool-renderer.ts +1 -1
  789. package/examples/extensions/custom-compaction.ts +1 -1
  790. package/examples/extensions/custom-footer.ts +2 -2
  791. package/examples/extensions/custom-header.ts +8 -8
  792. package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
  793. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  794. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  795. package/examples/extensions/custom-provider-gitlab-duo/index.ts +1 -1
  796. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  797. package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
  798. package/examples/extensions/doom-overlay/README.md +1 -2
  799. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  800. package/examples/extensions/doom-overlay/doom/build.sh +4 -4
  801. package/examples/extensions/doom-overlay/doom/doomgeneric_omk.c +72 -0
  802. package/examples/extensions/doom-overlay/doom-component.ts +2 -2
  803. package/examples/extensions/doom-overlay/doom-keys.ts +1 -1
  804. package/examples/extensions/git-merge-and-resolve.ts +1 -1
  805. package/examples/extensions/github-issue-autocomplete.ts +1 -6
  806. package/examples/extensions/gondolin/index.ts +1 -1
  807. package/examples/extensions/gondolin/package-lock.json +2 -2
  808. package/examples/extensions/gondolin/package.json +1 -1
  809. package/examples/extensions/handoff.ts +2 -2
  810. package/examples/extensions/hello.ts +1 -1
  811. package/examples/extensions/inline-bash.ts +1 -1
  812. package/examples/extensions/input-transform-streaming.ts +1 -1
  813. package/examples/extensions/input-transform.ts +2 -2
  814. package/examples/extensions/mac-system-theme.ts +1 -1
  815. package/examples/extensions/message-renderer.ts +1 -1
  816. package/examples/extensions/minimal-mode.ts +1 -1
  817. package/examples/extensions/modal-editor.ts +1 -1
  818. package/examples/extensions/overlay-qa-tests.ts +7 -7
  819. package/examples/extensions/overlay-test.ts +1 -1
  820. package/examples/extensions/plan-mode/index.ts +3 -3
  821. package/examples/extensions/preset.ts +4 -4
  822. package/examples/extensions/provider-payload.ts +6 -3
  823. package/examples/extensions/qna.ts +1 -1
  824. package/examples/extensions/question.ts +1 -1
  825. package/examples/extensions/questionnaire.ts +1 -1
  826. package/examples/extensions/rpc-demo.ts +1 -1
  827. package/examples/extensions/sandbox/index.ts +2 -2
  828. package/examples/extensions/sandbox/package-lock.json +2 -2
  829. package/examples/extensions/sandbox/package.json +1 -1
  830. package/examples/extensions/shutdown-command.ts +5 -5
  831. package/examples/extensions/snake.ts +1 -1
  832. package/examples/extensions/space-invaders.ts +1 -1
  833. package/examples/extensions/structured-output.ts +1 -1
  834. package/examples/extensions/subagent/agents.ts +2 -2
  835. package/examples/extensions/subagent/index.ts +19 -51
  836. package/examples/extensions/summarize.ts +2 -2
  837. package/examples/extensions/tic-tac-toe.ts +2 -2
  838. package/examples/extensions/todo.ts +2 -2
  839. package/examples/extensions/tool-override.ts +1 -1
  840. package/examples/extensions/tools.ts +1 -1
  841. package/examples/extensions/truncated-tool.ts +1 -1
  842. package/examples/extensions/with-deps/package-lock.json +2 -2
  843. package/examples/extensions/with-deps/package.json +1 -1
  844. package/examples/extensions/working-indicator.ts +3 -3
  845. package/examples/rpc-extension-ui.ts +1 -9
  846. package/examples/sdk/02-custom-model.ts +1 -1
  847. package/examples/sdk/07-context-files.ts +0 -2
  848. package/examples/sdk/12-full-control.ts +1 -1
  849. package/examples/sdk/README.md +1 -1
  850. package/npm-shrinkwrap.json +1805 -0
  851. package/package.json +10 -32
  852. package/dist/core/compaction/pruner-policy.d.ts +0 -84
  853. package/dist/core/compaction/pruner-policy.d.ts.map +0 -1
  854. package/dist/core/compaction/pruner-policy.js +0 -273
  855. package/dist/core/compaction/pruner-policy.js.map +0 -1
  856. package/dist/core/context-graph-identity-resolution.d.ts +0 -114
  857. package/dist/core/context-graph-identity-resolution.d.ts.map +0 -1
  858. package/dist/core/context-graph-identity-resolution.js +0 -127
  859. package/dist/core/context-graph-identity-resolution.js.map +0 -1
  860. package/dist/core/context-graph-memory-store.d.ts +0 -153
  861. package/dist/core/context-graph-memory-store.d.ts.map +0 -1
  862. package/dist/core/context-graph-memory-store.js +0 -377
  863. package/dist/core/context-graph-memory-store.js.map +0 -1
  864. package/dist/core/context-graph-ontology-generation.d.ts +0 -104
  865. package/dist/core/context-graph-ontology-generation.d.ts.map +0 -1
  866. package/dist/core/context-graph-ontology-generation.js +0 -135
  867. package/dist/core/context-graph-ontology-generation.js.map +0 -1
  868. package/dist/core/context-graph-ontology-registry.d.ts +0 -766
  869. package/dist/core/context-graph-ontology-registry.d.ts.map +0 -1
  870. package/dist/core/context-graph-ontology-registry.js +0 -1133
  871. package/dist/core/context-graph-ontology-registry.js.map +0 -1
  872. package/dist/core/context-graph-policy.d.ts +0 -68
  873. package/dist/core/context-graph-policy.d.ts.map +0 -1
  874. package/dist/core/context-graph-policy.js +0 -221
  875. package/dist/core/context-graph-policy.js.map +0 -1
  876. package/dist/core/context-graph-reasoning.d.ts +0 -130
  877. package/dist/core/context-graph-reasoning.d.ts.map +0 -1
  878. package/dist/core/context-graph-reasoning.js +0 -442
  879. package/dist/core/context-graph-reasoning.js.map +0 -1
  880. package/dist/core/context-graph-retrieval.d.ts +0 -120
  881. package/dist/core/context-graph-retrieval.d.ts.map +0 -1
  882. package/dist/core/context-graph-retrieval.js +0 -288
  883. package/dist/core/context-graph-retrieval.js.map +0 -1
  884. package/dist/core/contract-verification.d.ts +0 -78
  885. package/dist/core/contract-verification.d.ts.map +0 -1
  886. package/dist/core/contract-verification.js +0 -110
  887. package/dist/core/contract-verification.js.map +0 -1
  888. package/dist/core/freedom/banner.d.ts +0 -14
  889. package/dist/core/freedom/banner.d.ts.map +0 -1
  890. package/dist/core/freedom/banner.js +0 -22
  891. package/dist/core/freedom/banner.js.map +0 -1
  892. package/dist/core/freedom/config.d.ts +0 -27
  893. package/dist/core/freedom/config.d.ts.map +0 -1
  894. package/dist/core/freedom/config.js +0 -216
  895. package/dist/core/freedom/config.js.map +0 -1
  896. package/dist/core/freedom/index.d.ts +0 -23
  897. package/dist/core/freedom/index.d.ts.map +0 -1
  898. package/dist/core/freedom/index.js +0 -19
  899. package/dist/core/freedom/index.js.map +0 -1
  900. package/dist/core/freedom/policy.d.ts +0 -42
  901. package/dist/core/freedom/policy.d.ts.map +0 -1
  902. package/dist/core/freedom/policy.js +0 -47
  903. package/dist/core/freedom/policy.js.map +0 -1
  904. package/dist/core/freedom/safety-floor.d.ts +0 -73
  905. package/dist/core/freedom/safety-floor.d.ts.map +0 -1
  906. package/dist/core/freedom/safety-floor.js +0 -275
  907. package/dist/core/freedom/safety-floor.js.map +0 -1
  908. package/dist/core/harness-control-events.d.ts +0 -91
  909. package/dist/core/harness-control-events.d.ts.map +0 -1
  910. package/dist/core/harness-control-events.js +0 -514
  911. package/dist/core/harness-control-events.js.map +0 -1
  912. package/dist/core/harness-control-replay.d.ts +0 -31
  913. package/dist/core/harness-control-replay.d.ts.map +0 -1
  914. package/dist/core/harness-control-replay.js +0 -187
  915. package/dist/core/harness-control-replay.js.map +0 -1
  916. package/dist/core/headroom-middleware.d.ts +0 -35
  917. package/dist/core/headroom-middleware.d.ts.map +0 -1
  918. package/dist/core/headroom-middleware.js +0 -166
  919. package/dist/core/headroom-middleware.js.map +0 -1
  920. package/dist/core/lean-context-middleware.d.ts +0 -12
  921. package/dist/core/lean-context-middleware.d.ts.map +0 -1
  922. package/dist/core/lean-context-middleware.js +0 -87
  923. package/dist/core/lean-context-middleware.js.map +0 -1
  924. package/dist/core/lean-context-policy.d.ts +0 -45
  925. package/dist/core/lean-context-policy.d.ts.map +0 -1
  926. package/dist/core/lean-context-policy.js +0 -108
  927. package/dist/core/lean-context-policy.js.map +0 -1
  928. package/dist/core/native-adoption-benchmark.d.ts +0 -166
  929. package/dist/core/native-adoption-benchmark.d.ts.map +0 -1
  930. package/dist/core/native-adoption-benchmark.js +0 -624
  931. package/dist/core/native-adoption-benchmark.js.map +0 -1
  932. package/dist/core/observability-trace.d.ts +0 -80
  933. package/dist/core/observability-trace.d.ts.map +0 -1
  934. package/dist/core/observability-trace.js +0 -140
  935. package/dist/core/observability-trace.js.map +0 -1
  936. package/dist/core/orchestration/checkpoint.d.ts +0 -83
  937. package/dist/core/orchestration/checkpoint.d.ts.map +0 -1
  938. package/dist/core/orchestration/checkpoint.js +0 -152
  939. package/dist/core/orchestration/checkpoint.js.map +0 -1
  940. package/dist/core/orchestration/errors.d.ts +0 -74
  941. package/dist/core/orchestration/errors.d.ts.map +0 -1
  942. package/dist/core/orchestration/errors.js +0 -52
  943. package/dist/core/orchestration/errors.js.map +0 -1
  944. package/dist/core/orchestration/merge-queue.d.ts +0 -121
  945. package/dist/core/orchestration/merge-queue.d.ts.map +0 -1
  946. package/dist/core/orchestration/merge-queue.js +0 -149
  947. package/dist/core/orchestration/merge-queue.js.map +0 -1
  948. package/dist/core/orchestration/recovery.d.ts +0 -106
  949. package/dist/core/orchestration/recovery.d.ts.map +0 -1
  950. package/dist/core/orchestration/recovery.js +0 -110
  951. package/dist/core/orchestration/recovery.js.map +0 -1
  952. package/dist/core/orchestration/replay-ledger.d.ts +0 -76
  953. package/dist/core/orchestration/replay-ledger.d.ts.map +0 -1
  954. package/dist/core/orchestration/replay-ledger.js +0 -395
  955. package/dist/core/orchestration/replay-ledger.js.map +0 -1
  956. package/dist/core/orchestration/scheduler-state.d.ts +0 -78
  957. package/dist/core/orchestration/scheduler-state.d.ts.map +0 -1
  958. package/dist/core/orchestration/scheduler-state.js +0 -185
  959. package/dist/core/orchestration/scheduler-state.js.map +0 -1
  960. package/dist/core/orchestration/scheduler-store.d.ts +0 -309
  961. package/dist/core/orchestration/scheduler-store.d.ts.map +0 -1
  962. package/dist/core/orchestration/scheduler-store.js +0 -368
  963. package/dist/core/orchestration/scheduler-store.js.map +0 -1
  964. package/dist/core/orchestration/sqlite-scheduler-store.d.ts +0 -57
  965. package/dist/core/orchestration/sqlite-scheduler-store.d.ts.map +0 -1
  966. package/dist/core/orchestration/sqlite-scheduler-store.js +0 -528
  967. package/dist/core/orchestration/sqlite-scheduler-store.js.map +0 -1
  968. package/dist/core/orchestration/transaction-coordinator.d.ts +0 -217
  969. package/dist/core/orchestration/transaction-coordinator.d.ts.map +0 -1
  970. package/dist/core/orchestration/transaction-coordinator.js +0 -281
  971. package/dist/core/orchestration/transaction-coordinator.js.map +0 -1
  972. package/dist/core/orchestration/verification-contract.d.ts +0 -197
  973. package/dist/core/orchestration/verification-contract.d.ts.map +0 -1
  974. package/dist/core/orchestration/verification-contract.js +0 -145
  975. package/dist/core/orchestration/verification-contract.js.map +0 -1
  976. package/dist/core/package-composition.d.ts +0 -68
  977. package/dist/core/package-composition.d.ts.map +0 -1
  978. package/dist/core/package-composition.js +0 -304
  979. package/dist/core/package-composition.js.map +0 -1
  980. package/dist/core/package-trial-runtime.d.ts +0 -75
  981. package/dist/core/package-trial-runtime.d.ts.map +0 -1
  982. package/dist/core/package-trial-runtime.js +0 -73
  983. package/dist/core/package-trial-runtime.js.map +0 -1
  984. package/dist/core/package-trial-sandbox.d.ts +0 -27
  985. package/dist/core/package-trial-sandbox.d.ts.map +0 -1
  986. package/dist/core/package-trial-sandbox.js +0 -102
  987. package/dist/core/package-trial-sandbox.js.map +0 -1
  988. package/dist/core/policy-overlays-runtime.d.ts +0 -141
  989. package/dist/core/policy-overlays-runtime.d.ts.map +0 -1
  990. package/dist/core/policy-overlays-runtime.js +0 -720
  991. package/dist/core/policy-overlays-runtime.js.map +0 -1
  992. package/dist/core/read-anchor-registry.d.ts +0 -27
  993. package/dist/core/read-anchor-registry.d.ts.map +0 -1
  994. package/dist/core/read-anchor-registry.js +0 -103
  995. package/dist/core/read-anchor-registry.js.map +0 -1
  996. package/dist/core/read-content-cache.d.ts +0 -22
  997. package/dist/core/read-content-cache.d.ts.map +0 -1
  998. package/dist/core/read-content-cache.js +0 -79
  999. package/dist/core/read-content-cache.js.map +0 -1
  1000. package/dist/core/session-digest.d.ts +0 -57
  1001. package/dist/core/session-digest.d.ts.map +0 -1
  1002. package/dist/core/session-digest.js +0 -193
  1003. package/dist/core/session-digest.js.map +0 -1
  1004. package/dist/core/spec-kit/compiler.d.ts +0 -67
  1005. package/dist/core/spec-kit/compiler.d.ts.map +0 -1
  1006. package/dist/core/spec-kit/compiler.js +0 -268
  1007. package/dist/core/spec-kit/compiler.js.map +0 -1
  1008. package/dist/core/transaction-coordinator.d.ts +0 -30
  1009. package/dist/core/transaction-coordinator.d.ts.map +0 -1
  1010. package/dist/core/transaction-coordinator.js +0 -173
  1011. package/dist/core/transaction-coordinator.js.map +0 -1
  1012. package/dist/modes/interactive/components/mcp-selector.d.ts +0 -30
  1013. package/dist/modes/interactive/components/mcp-selector.d.ts.map +0 -1
  1014. package/dist/modes/interactive/components/mcp-selector.js +0 -155
  1015. package/dist/modes/interactive/components/mcp-selector.js.map +0 -1
  1016. package/dist/modes/interactive/components/model-selector-state.d.ts +0 -101
  1017. package/dist/modes/interactive/components/model-selector-state.d.ts.map +0 -1
  1018. package/dist/modes/interactive/components/model-selector-state.js +0 -261
  1019. package/dist/modes/interactive/components/model-selector-state.js.map +0 -1
  1020. package/dist/modes/interactive/components/skills-selector.d.ts +0 -32
  1021. package/dist/modes/interactive/components/skills-selector.d.ts.map +0 -1
  1022. package/dist/modes/interactive/components/skills-selector.js +0 -130
  1023. package/dist/modes/interactive/components/skills-selector.js.map +0 -1
  1024. package/dist/modes/interactive/theme/omk-blackboard.json +0 -91
  1025. package/dist/modes/interactive/theme/omk-freedom-grid.json +0 -91
  1026. package/dist/modes/interactive/theme/omk-neon-ops.json +0 -90
  1027. package/dist/modes/interactive/theme/omk-slate-light.json +0 -91
  1028. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
  1029. package/node_modules/@earendil-works/omk-agent-core/README.md +0 -488
  1030. package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts +0 -24
  1031. package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts.map +0 -1
  1032. package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js +0 -553
  1033. package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js.map +0 -1
  1034. package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts +0 -118
  1035. package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts.map +0 -1
  1036. package/node_modules/@earendil-works/omk-agent-core/dist/agent.js +0 -402
  1037. package/node_modules/@earendil-works/omk-agent-core/dist/agent.js.map +0 -1
  1038. package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts +0 -95
  1039. package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts.map +0 -1
  1040. package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js +0 -996
  1041. package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js.map +0 -1
  1042. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts +0 -53
  1043. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +0 -1
  1044. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js +0 -175
  1045. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js.map +0 -1
  1046. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts +0 -117
  1047. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts.map +0 -1
  1048. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js +0 -568
  1049. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js.map +0 -1
  1050. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts +0 -25
  1051. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts.map +0 -1
  1052. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js +0 -131
  1053. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js.map +0 -1
  1054. package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts +0 -51
  1055. package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts.map +0 -1
  1056. package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js +0 -510
  1057. package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js.map +0 -1
  1058. package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts +0 -51
  1059. package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts.map +0 -1
  1060. package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js +0 -102
  1061. package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js.map +0 -1
  1062. package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts +0 -48
  1063. package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts.map +0 -1
  1064. package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js +0 -230
  1065. package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js.map +0 -1
  1066. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts +0 -26
  1067. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts.map +0 -1
  1068. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js +0 -101
  1069. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js.map +0 -1
  1070. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts +0 -36
  1071. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts.map +0 -1
  1072. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js +0 -273
  1073. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js.map +0 -1
  1074. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts +0 -18
  1075. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts.map +0 -1
  1076. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js +0 -42
  1077. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js.map +0 -1
  1078. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts +0 -25
  1079. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts.map +0 -1
  1080. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js +0 -114
  1081. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js.map +0 -1
  1082. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts +0 -11
  1083. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts.map +0 -1
  1084. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js +0 -39
  1085. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js.map +0 -1
  1086. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts +0 -33
  1087. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts.map +0 -1
  1088. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js +0 -210
  1089. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js.map +0 -1
  1090. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts +0 -2
  1091. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts.map +0 -1
  1092. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js +0 -50
  1093. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js.map +0 -1
  1094. package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts +0 -44
  1095. package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts.map +0 -1
  1096. package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js +0 -311
  1097. package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js.map +0 -1
  1098. package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts +0 -3
  1099. package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts.map +0 -1
  1100. package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js +0 -30
  1101. package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js.map +0 -1
  1102. package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts +0 -616
  1103. package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts.map +0 -1
  1104. package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js +0 -94
  1105. package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js.map +0 -1
  1106. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts +0 -14
  1107. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts.map +0 -1
  1108. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js +0 -126
  1109. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js.map +0 -1
  1110. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts +0 -70
  1111. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts.map +0 -1
  1112. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js +0 -297
  1113. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js.map +0 -1
  1114. package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts +0 -20
  1115. package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts.map +0 -1
  1116. package/node_modules/@earendil-works/omk-agent-core/dist/index.js +0 -25
  1117. package/node_modules/@earendil-works/omk-agent-core/dist/index.js.map +0 -1
  1118. package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts +0 -3
  1119. package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts.map +0 -1
  1120. package/node_modules/@earendil-works/omk-agent-core/dist/node.js +0 -3
  1121. package/node_modules/@earendil-works/omk-agent-core/dist/node.js.map +0 -1
  1122. package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts +0 -69
  1123. package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts.map +0 -1
  1124. package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js +0 -278
  1125. package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js.map +0 -1
  1126. package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts +0 -393
  1127. package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts.map +0 -1
  1128. package/node_modules/@earendil-works/omk-agent-core/dist/types.js +0 -2
  1129. package/node_modules/@earendil-works/omk-agent-core/dist/types.js.map +0 -1
  1130. package/node_modules/@earendil-works/omk-agent-core/package.json +0 -60
  1131. package/node_modules/@earendil-works/omk-ai/README.md +0 -1389
  1132. package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts +0 -20
  1133. package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts.map +0 -1
  1134. package/node_modules/@earendil-works/omk-ai/dist/api-registry.js +0 -44
  1135. package/node_modules/@earendil-works/omk-ai/dist/api-registry.js.map +0 -1
  1136. package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts +0 -5
  1137. package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts.map +0 -1
  1138. package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js +0 -6
  1139. package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js.map +0 -1
  1140. package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts +0 -3
  1141. package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts.map +0 -1
  1142. package/node_modules/@earendil-works/omk-ai/dist/cli.js +0 -130
  1143. package/node_modules/@earendil-works/omk-ai/dist/cli.js.map +0 -1
  1144. package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts +0 -20
  1145. package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts.map +0 -1
  1146. package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js +0 -199
  1147. package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js.map +0 -1
  1148. package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts +0 -10
  1149. package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts.map +0 -1
  1150. package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts +0 -515
  1151. package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts.map +0 -1
  1152. package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js +0 -517
  1153. package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js.map +0 -1
  1154. package/node_modules/@earendil-works/omk-ai/dist/image-models.js +0 -23
  1155. package/node_modules/@earendil-works/omk-ai/dist/image-models.js.map +0 -1
  1156. package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts +0 -14
  1157. package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts.map +0 -1
  1158. package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js +0 -22
  1159. package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js.map +0 -1
  1160. package/node_modules/@earendil-works/omk-ai/dist/images.d.ts +0 -4
  1161. package/node_modules/@earendil-works/omk-ai/dist/images.d.ts.map +0 -1
  1162. package/node_modules/@earendil-works/omk-ai/dist/images.js +0 -16
  1163. package/node_modules/@earendil-works/omk-ai/dist/images.js.map +0 -1
  1164. package/node_modules/@earendil-works/omk-ai/dist/index.d.ts +0 -33
  1165. package/node_modules/@earendil-works/omk-ai/dist/index.d.ts.map +0 -1
  1166. package/node_modules/@earendil-works/omk-ai/dist/index.js +0 -21
  1167. package/node_modules/@earendil-works/omk-ai/dist/index.js.map +0 -1
  1168. package/node_modules/@earendil-works/omk-ai/dist/models.d.ts +0 -18
  1169. package/node_modules/@earendil-works/omk-ai/dist/models.d.ts.map +0 -1
  1170. package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts +0 -18762
  1171. package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts.map +0 -1
  1172. package/node_modules/@earendil-works/omk-ai/dist/models.generated.js +0 -17197
  1173. package/node_modules/@earendil-works/omk-ai/dist/models.generated.js.map +0 -1
  1174. package/node_modules/@earendil-works/omk-ai/dist/models.js +0 -78
  1175. package/node_modules/@earendil-works/omk-ai/dist/models.js.map +0 -1
  1176. package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts +0 -2
  1177. package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts.map +0 -1
  1178. package/node_modules/@earendil-works/omk-ai/dist/oauth.js +0 -2
  1179. package/node_modules/@earendil-works/omk-ai/dist/oauth.js.map +0 -1
  1180. package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts +0 -39
  1181. package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts.map +0 -1
  1182. package/node_modules/@earendil-works/omk-ai/dist/provider-network.js +0 -170
  1183. package/node_modules/@earendil-works/omk-ai/dist/provider-network.js.map +0 -1
  1184. package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts +0 -38
  1185. package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts.map +0 -1
  1186. package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js +0 -826
  1187. package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js.map +0 -1
  1188. package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts +0 -77
  1189. package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts.map +0 -1
  1190. package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js +0 -1123
  1191. package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js.map +0 -1
  1192. package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts +0 -15
  1193. package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts.map +0 -1
  1194. package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js +0 -221
  1195. package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js.map +0 -1
  1196. package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts +0 -13
  1197. package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts.map +0 -1
  1198. package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js +0 -26
  1199. package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js.map +0 -1
  1200. package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts +0 -56
  1201. package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts.map +0 -1
  1202. package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js +0 -368
  1203. package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js.map +0 -1
  1204. package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts +0 -8
  1205. package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts.map +0 -1
  1206. package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js +0 -29
  1207. package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js.map +0 -1
  1208. package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts +0 -70
  1209. package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts.map +0 -1
  1210. package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js +0 -331
  1211. package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js.map +0 -1
  1212. package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts +0 -15
  1213. package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts.map +0 -1
  1214. package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js +0 -442
  1215. package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js.map +0 -1
  1216. package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts +0 -13
  1217. package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts.map +0 -1
  1218. package/node_modules/@earendil-works/omk-ai/dist/providers/google.js +0 -402
  1219. package/node_modules/@earendil-works/omk-ai/dist/providers/google.js.map +0 -1
  1220. package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts +0 -3
  1221. package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts.map +0 -1
  1222. package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js +0 -128
  1223. package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js.map +0 -1
  1224. package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts +0 -4
  1225. package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts.map +0 -1
  1226. package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js +0 -34
  1227. package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js.map +0 -1
  1228. package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts +0 -25
  1229. package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts.map +0 -1
  1230. package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js +0 -534
  1231. package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js.map +0 -1
  1232. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts +0 -30
  1233. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts.map +0 -1
  1234. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js +0 -1171
  1235. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js.map +0 -1
  1236. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts +0 -19
  1237. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts.map +0 -1
  1238. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js +0 -977
  1239. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js.map +0 -1
  1240. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts +0 -11
  1241. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts.map +0 -1
  1242. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js +0 -22
  1243. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js.map +0 -1
  1244. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts +0 -18
  1245. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts.map +0 -1
  1246. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js +0 -496
  1247. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js.map +0 -1
  1248. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts +0 -13
  1249. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts.map +0 -1
  1250. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js +0 -233
  1251. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js.map +0 -1
  1252. package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts +0 -35
  1253. package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts.map +0 -1
  1254. package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js +0 -254
  1255. package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js.map +0 -1
  1256. package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts +0 -8
  1257. package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts.map +0 -1
  1258. package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js +0 -42
  1259. package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js.map +0 -1
  1260. package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts +0 -13
  1261. package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts.map +0 -1
  1262. package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js +0 -82
  1263. package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js.map +0 -1
  1264. package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts +0 -8
  1265. package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts.map +0 -1
  1266. package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js +0 -184
  1267. package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js.map +0 -1
  1268. package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts +0 -4
  1269. package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts.map +0 -1
  1270. package/node_modules/@earendil-works/omk-ai/dist/session-resources.js +0 -22
  1271. package/node_modules/@earendil-works/omk-ai/dist/session-resources.js.map +0 -1
  1272. package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts +0 -8
  1273. package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts.map +0 -1
  1274. package/node_modules/@earendil-works/omk-ai/dist/stream.js +0 -77
  1275. package/node_modules/@earendil-works/omk-ai/dist/stream.js.map +0 -1
  1276. package/node_modules/@earendil-works/omk-ai/dist/types.d.ts +0 -570
  1277. package/node_modules/@earendil-works/omk-ai/dist/types.d.ts.map +0 -1
  1278. package/node_modules/@earendil-works/omk-ai/dist/types.js +0 -2
  1279. package/node_modules/@earendil-works/omk-ai/dist/types.js.map +0 -1
  1280. package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts +0 -6
  1281. package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts.map +0 -1
  1282. package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js +0 -34
  1283. package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js.map +0 -1
  1284. package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts +0 -19
  1285. package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts.map +0 -1
  1286. package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js +0 -25
  1287. package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js.map +0 -1
  1288. package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts +0 -21
  1289. package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts.map +0 -1
  1290. package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js +0 -81
  1291. package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js.map +0 -1
  1292. package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts +0 -3
  1293. package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts.map +0 -1
  1294. package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js +0 -14
  1295. package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js.map +0 -1
  1296. package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts +0 -2
  1297. package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts.map +0 -1
  1298. package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js +0 -8
  1299. package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js.map +0 -1
  1300. package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts +0 -16
  1301. package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts.map +0 -1
  1302. package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js +0 -113
  1303. package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js.map +0 -1
  1304. package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts +0 -10
  1305. package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts.map +0 -1
  1306. package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js +0 -97
  1307. package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js.map +0 -1
  1308. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts +0 -25
  1309. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts.map +0 -1
  1310. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js +0 -335
  1311. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js.map +0 -1
  1312. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts +0 -21
  1313. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts.map +0 -1
  1314. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js +0 -56
  1315. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js.map +0 -1
  1316. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts +0 -30
  1317. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts.map +0 -1
  1318. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js +0 -280
  1319. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js.map +0 -1
  1320. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts +0 -58
  1321. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts.map +0 -1
  1322. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js +0 -122
  1323. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js.map +0 -1
  1324. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts +0 -3
  1325. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts.map +0 -1
  1326. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js +0 -105
  1327. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js.map +0 -1
  1328. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts +0 -43
  1329. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts.map +0 -1
  1330. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js +0 -487
  1331. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js.map +0 -1
  1332. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts +0 -13
  1333. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts.map +0 -1
  1334. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js +0 -31
  1335. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js.map +0 -1
  1336. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts +0 -64
  1337. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts.map +0 -1
  1338. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js +0 -2
  1339. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js.map +0 -1
  1340. package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts +0 -57
  1341. package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts.map +0 -1
  1342. package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js +0 -154
  1343. package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js.map +0 -1
  1344. package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts +0 -22
  1345. package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts.map +0 -1
  1346. package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js +0 -26
  1347. package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js.map +0 -1
  1348. package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts +0 -17
  1349. package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts.map +0 -1
  1350. package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js +0 -21
  1351. package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js.map +0 -1
  1352. package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts +0 -18
  1353. package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts.map +0 -1
  1354. package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js +0 -281
  1355. package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js.map +0 -1
  1356. package/node_modules/@earendil-works/omk-ai/package.json +0 -106
  1357. package/node_modules/@earendil-works/omk-tui/README.md +0 -791
  1358. package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts +0 -54
  1359. package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts.map +0 -1
  1360. package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js +0 -632
  1361. package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js.map +0 -1
  1362. package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts +0 -22
  1363. package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts.map +0 -1
  1364. package/node_modules/@earendil-works/omk-tui/dist/components/box.js +0 -104
  1365. package/node_modules/@earendil-works/omk-tui/dist/components/box.js.map +0 -1
  1366. package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts +0 -22
  1367. package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts.map +0 -1
  1368. package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js +0 -35
  1369. package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js.map +0 -1
  1370. package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts +0 -249
  1371. package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts.map +0 -1
  1372. package/node_modules/@earendil-works/omk-tui/dist/components/editor.js +0 -1857
  1373. package/node_modules/@earendil-works/omk-tui/dist/components/editor.js.map +0 -1
  1374. package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts +0 -28
  1375. package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts.map +0 -1
  1376. package/node_modules/@earendil-works/omk-tui/dist/components/image.js +0 -89
  1377. package/node_modules/@earendil-works/omk-tui/dist/components/image.js.map +0 -1
  1378. package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts +0 -37
  1379. package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts.map +0 -1
  1380. package/node_modules/@earendil-works/omk-tui/dist/components/input.js +0 -378
  1381. package/node_modules/@earendil-works/omk-tui/dist/components/input.js.map +0 -1
  1382. package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts +0 -31
  1383. package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts.map +0 -1
  1384. package/node_modules/@earendil-works/omk-tui/dist/components/loader.js +0 -69
  1385. package/node_modules/@earendil-works/omk-tui/dist/components/loader.js.map +0 -1
  1386. package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts +0 -96
  1387. package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts.map +0 -1
  1388. package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js +0 -644
  1389. package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js.map +0 -1
  1390. package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts +0 -50
  1391. package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts.map +0 -1
  1392. package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js +0 -159
  1393. package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js.map +0 -1
  1394. package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts +0 -50
  1395. package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts.map +0 -1
  1396. package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js +0 -185
  1397. package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js.map +0 -1
  1398. package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts +0 -12
  1399. package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts.map +0 -1
  1400. package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js +0 -23
  1401. package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js.map +0 -1
  1402. package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts +0 -19
  1403. package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts.map +0 -1
  1404. package/node_modules/@earendil-works/omk-tui/dist/components/text.js +0 -89
  1405. package/node_modules/@earendil-works/omk-tui/dist/components/text.js.map +0 -1
  1406. package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts +0 -13
  1407. package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts.map +0 -1
  1408. package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js +0 -51
  1409. package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js.map +0 -1
  1410. package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts +0 -39
  1411. package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts.map +0 -1
  1412. package/node_modules/@earendil-works/omk-tui/dist/editor-component.js +0 -2
  1413. package/node_modules/@earendil-works/omk-tui/dist/editor-component.js.map +0 -1
  1414. package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts +0 -16
  1415. package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts.map +0 -1
  1416. package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js +0 -110
  1417. package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js.map +0 -1
  1418. package/node_modules/@earendil-works/omk-tui/dist/index.d.ts +0 -23
  1419. package/node_modules/@earendil-works/omk-tui/dist/index.d.ts.map +0 -1
  1420. package/node_modules/@earendil-works/omk-tui/dist/index.js +0 -32
  1421. package/node_modules/@earendil-works/omk-tui/dist/index.js.map +0 -1
  1422. package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts +0 -212
  1423. package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts.map +0 -1
  1424. package/node_modules/@earendil-works/omk-tui/dist/keybindings.js +0 -252
  1425. package/node_modules/@earendil-works/omk-tui/dist/keybindings.js.map +0 -1
  1426. package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts +0 -184
  1427. package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts.map +0 -1
  1428. package/node_modules/@earendil-works/omk-tui/dist/keys.js +0 -1173
  1429. package/node_modules/@earendil-works/omk-tui/dist/keys.js.map +0 -1
  1430. package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts +0 -28
  1431. package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts.map +0 -1
  1432. package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js +0 -44
  1433. package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js.map +0 -1
  1434. package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts +0 -3
  1435. package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts.map +0 -1
  1436. package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js +0 -53
  1437. package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js.map +0 -1
  1438. package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts +0 -50
  1439. package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts.map +0 -1
  1440. package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js +0 -361
  1441. package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js.map +0 -1
  1442. package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts +0 -90
  1443. package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts.map +0 -1
  1444. package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js +0 -366
  1445. package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js.map +0 -1
  1446. package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts +0 -113
  1447. package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts.map +0 -1
  1448. package/node_modules/@earendil-works/omk-tui/dist/terminal.js +0 -472
  1449. package/node_modules/@earendil-works/omk-tui/dist/terminal.js.map +0 -1
  1450. package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts +0 -242
  1451. package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts.map +0 -1
  1452. package/node_modules/@earendil-works/omk-tui/dist/tui.js +0 -1221
  1453. package/node_modules/@earendil-works/omk-tui/dist/tui.js.map +0 -1
  1454. package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts +0 -17
  1455. package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts.map +0 -1
  1456. package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js +0 -25
  1457. package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js.map +0 -1
  1458. package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts +0 -84
  1459. package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts.map +0 -1
  1460. package/node_modules/@earendil-works/omk-tui/dist/utils.js +0 -1032
  1461. package/node_modules/@earendil-works/omk-tui/dist/utils.js.map +0 -1
  1462. package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts +0 -25
  1463. package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts.map +0 -1
  1464. package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js +0 -96
  1465. package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js.map +0 -1
  1466. package/node_modules/@earendil-works/omk-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  1467. package/node_modules/@earendil-works/omk-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  1468. package/node_modules/@earendil-works/omk-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  1469. package/node_modules/@earendil-works/omk-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  1470. package/node_modules/@earendil-works/omk-tui/package.json +0 -47
@@ -1,1857 +0,0 @@
1
- import { getKeybindings } from "../keybindings.js";
2
- import { decodePrintableKey, matchesKey } from "../keys.js";
3
- import { KillRing } from "../kill-ring.js";
4
- import { CURSOR_MARKER } from "../tui.js";
5
- import { UndoStack } from "../undo-stack.js";
6
- import { getGraphemeSegmenter, getWordSegmenter, isWhitespaceChar, truncateToWidth, visibleWidth } from "../utils.js";
7
- import { findWordBackward, findWordForward } from "../word-navigation.js";
8
- import { SelectList } from "./select-list.js";
9
- const graphemeSegmenter = getGraphemeSegmenter();
10
- const wordSegmenter = getWordSegmenter();
11
- /** Regex matching paste markers like `[paste #1 +123 lines]` or `[paste #2 1234 chars]`. */
12
- const PASTE_MARKER_REGEX = /\[paste #(\d+)( (\+\d+ lines|\d+ chars))?\]/g;
13
- /** Non-global version for single-segment testing. */
14
- const PASTE_MARKER_SINGLE = /^\[paste #(\d+)( (\+\d+ lines|\d+ chars))?\]$/;
15
- /** Check if a segment is a paste marker (i.e. was merged by segmentWithMarkers). */
16
- function isPasteMarker(segment) {
17
- return segment.length >= 10 && PASTE_MARKER_SINGLE.test(segment);
18
- }
19
- /**
20
- * A segmenter that wraps Intl.Segmenter and merges graphemes that fall
21
- * within paste markers into single atomic segments. This makes cursor
22
- * movement, deletion, word-wrap, etc. treat paste markers as single units.
23
- *
24
- * Only markers whose numeric ID exists in `validIds` are merged.
25
- */
26
- function segmentWithMarkers(text, baseSegmenter, validIds) {
27
- // Fast path: no paste markers in the text or no valid IDs.
28
- if (validIds.size === 0 || !text.includes("[paste #")) {
29
- return baseSegmenter.segment(text);
30
- }
31
- // Find all marker spans with valid IDs.
32
- const markers = [];
33
- for (const m of text.matchAll(PASTE_MARKER_REGEX)) {
34
- const id = Number.parseInt(m[1], 10);
35
- if (!validIds.has(id))
36
- continue;
37
- markers.push({ start: m.index, end: m.index + m[0].length });
38
- }
39
- if (markers.length === 0) {
40
- return baseSegmenter.segment(text);
41
- }
42
- // Build merged segment list.
43
- const baseSegments = baseSegmenter.segment(text);
44
- const result = [];
45
- let markerIdx = 0;
46
- for (const seg of baseSegments) {
47
- // Skip past markers that are entirely before this segment.
48
- while (markerIdx < markers.length && markers[markerIdx].end <= seg.index) {
49
- markerIdx++;
50
- }
51
- const marker = markerIdx < markers.length ? markers[markerIdx] : null;
52
- if (marker && seg.index >= marker.start && seg.index < marker.end) {
53
- // This segment falls inside a marker.
54
- // If this is the first segment of the marker, emit a merged segment.
55
- if (seg.index === marker.start) {
56
- const markerText = text.slice(marker.start, marker.end);
57
- result.push({
58
- segment: markerText,
59
- index: marker.start,
60
- input: text,
61
- });
62
- }
63
- // Otherwise skip (already merged into the first segment).
64
- }
65
- else {
66
- result.push(seg);
67
- }
68
- }
69
- return result;
70
- }
71
- /**
72
- * Split a line into word-wrapped chunks.
73
- * Wraps at word boundaries when possible, falling back to character-level
74
- * wrapping for words longer than the available width.
75
- *
76
- * @param line - The text line to wrap
77
- * @param maxWidth - Maximum visible width per chunk
78
- * @param preSegmented - Optional pre-segmented graphemes (e.g. with paste-marker awareness).
79
- * When omitted the default Intl.Segmenter is used.
80
- * @returns Array of chunks with text and position information
81
- */
82
- export function wordWrapLine(line, maxWidth, preSegmented) {
83
- if (!line || maxWidth <= 0) {
84
- return [{ text: "", startIndex: 0, endIndex: 0 }];
85
- }
86
- const lineWidth = visibleWidth(line);
87
- if (lineWidth <= maxWidth) {
88
- return [{ text: line, startIndex: 0, endIndex: line.length }];
89
- }
90
- const chunks = [];
91
- const segments = preSegmented ?? [...graphemeSegmenter.segment(line)];
92
- let currentWidth = 0;
93
- let chunkStart = 0;
94
- // Wrap opportunity: the position after the last whitespace before a non-whitespace
95
- // grapheme, i.e. where a line break is allowed.
96
- let wrapOppIndex = -1;
97
- let wrapOppWidth = 0;
98
- for (let i = 0; i < segments.length; i++) {
99
- const seg = segments[i];
100
- const grapheme = seg.segment;
101
- const gWidth = visibleWidth(grapheme);
102
- const charIndex = seg.index;
103
- const isWs = !isPasteMarker(grapheme) && isWhitespaceChar(grapheme);
104
- // Overflow check before advancing.
105
- if (currentWidth + gWidth > maxWidth) {
106
- if (wrapOppIndex >= 0 && currentWidth - wrapOppWidth + gWidth <= maxWidth) {
107
- // Backtrack to last wrap opportunity (the remaining content
108
- // plus the current grapheme still fits within maxWidth).
109
- chunks.push({ text: line.slice(chunkStart, wrapOppIndex), startIndex: chunkStart, endIndex: wrapOppIndex });
110
- chunkStart = wrapOppIndex;
111
- currentWidth -= wrapOppWidth;
112
- }
113
- else if (chunkStart < charIndex) {
114
- // No viable wrap opportunity: force-break at current position.
115
- // This also handles the case where backtracking to a word
116
- // boundary wouldn't help because the remaining content plus
117
- // the current grapheme (e.g. a wide character) still exceeds
118
- // maxWidth.
119
- chunks.push({ text: line.slice(chunkStart, charIndex), startIndex: chunkStart, endIndex: charIndex });
120
- chunkStart = charIndex;
121
- currentWidth = 0;
122
- }
123
- wrapOppIndex = -1;
124
- }
125
- if (gWidth > maxWidth) {
126
- // Single atomic segment wider than maxWidth (e.g. paste marker
127
- // in a narrow terminal). Re-wrap it at grapheme granularity.
128
- // The segment remains logically atomic for cursor
129
- // movement / editing — the split is purely visual for word-wrap layout.
130
- const subChunks = wordWrapLine(grapheme, maxWidth);
131
- for (let j = 0; j < subChunks.length - 1; j++) {
132
- const sc = subChunks[j];
133
- chunks.push({ text: sc.text, startIndex: charIndex + sc.startIndex, endIndex: charIndex + sc.endIndex });
134
- }
135
- const last = subChunks[subChunks.length - 1];
136
- chunkStart = charIndex + last.startIndex;
137
- currentWidth = visibleWidth(last.text);
138
- wrapOppIndex = -1;
139
- continue;
140
- }
141
- // Advance.
142
- currentWidth += gWidth;
143
- // Record wrap opportunity: whitespace followed by non-whitespace.
144
- // Multiple spaces join (no break between them); the break point is
145
- // after the last space before the next word.
146
- const next = segments[i + 1];
147
- if (isWs && next && (isPasteMarker(next.segment) || !isWhitespaceChar(next.segment))) {
148
- wrapOppIndex = next.index;
149
- wrapOppWidth = currentWidth;
150
- }
151
- }
152
- // Push final chunk.
153
- chunks.push({ text: line.slice(chunkStart), startIndex: chunkStart, endIndex: line.length });
154
- return chunks;
155
- }
156
- const SLASH_COMMAND_SELECT_LIST_LAYOUT = {
157
- minPrimaryColumnWidth: 12,
158
- maxPrimaryColumnWidth: 32,
159
- };
160
- const ATTACHMENT_AUTOCOMPLETE_DEBOUNCE_MS = 20;
161
- export class Editor {
162
- state = {
163
- lines: [""],
164
- cursorLine: 0,
165
- cursorCol: 0,
166
- };
167
- /** Focusable interface - set by TUI when focus changes */
168
- focused = false;
169
- tui;
170
- theme;
171
- paddingX = 0;
172
- // Store last render width for cursor navigation
173
- lastWidth = 80;
174
- // Vertical scrolling support
175
- scrollOffset = 0;
176
- // Border color (can be changed dynamically)
177
- borderColor;
178
- // Autocomplete support
179
- autocompleteProvider;
180
- autocompleteList;
181
- autocompleteState = null;
182
- autocompletePrefix = "";
183
- autocompleteMaxVisible = 5;
184
- autocompleteAbort;
185
- autocompleteDebounceTimer;
186
- autocompleteRequestTask = Promise.resolve();
187
- autocompleteStartToken = 0;
188
- autocompleteRequestId = 0;
189
- // Paste tracking for large pastes
190
- pastes = new Map();
191
- pasteCounter = 0;
192
- // Bracketed paste mode buffering
193
- pasteBuffer = "";
194
- isInPaste = false;
195
- // Prompt history for up/down navigation
196
- history = [];
197
- historyIndex = -1; // -1 = not browsing, 0 = most recent, 1 = older, etc.
198
- // Kill ring for Emacs-style kill/yank operations
199
- killRing = new KillRing();
200
- lastAction = null;
201
- // Character jump mode
202
- jumpMode = null;
203
- // Preferred visual column for vertical cursor movement (sticky column)
204
- preferredVisualCol = null;
205
- // When the cursor is snapped to the start of an atomic segment, e.g. a
206
- // paste marker, cursorCol no longer reflects where the cursor would have
207
- // landed. This field stores the pre-snap cursorCol so that the next
208
- // vertical move can resolve it to a visual column on whatever VL it belongs
209
- // to.
210
- snappedFromCursorCol = null;
211
- // Undo support
212
- undoStack = new UndoStack();
213
- onSubmit;
214
- onChange;
215
- disableSubmit = false;
216
- constructor(tui, theme, options = {}) {
217
- this.tui = tui;
218
- this.theme = theme;
219
- this.borderColor = theme.borderColor;
220
- const paddingX = options.paddingX ?? 0;
221
- this.paddingX = Number.isFinite(paddingX) ? Math.max(0, Math.floor(paddingX)) : 0;
222
- const maxVisible = options.autocompleteMaxVisible ?? 5;
223
- this.autocompleteMaxVisible = Number.isFinite(maxVisible) ? Math.max(3, Math.min(20, Math.floor(maxVisible))) : 5;
224
- }
225
- /** Set of currently valid paste IDs, for marker-aware segmentation. */
226
- validPasteIds() {
227
- return new Set(this.pastes.keys());
228
- }
229
- /** Segment text with paste-marker awareness, only merging markers with valid IDs. */
230
- segment(text, mode) {
231
- return segmentWithMarkers(text, mode === "word" ? wordSegmenter : graphemeSegmenter, this.validPasteIds());
232
- }
233
- getPaddingX() {
234
- return this.paddingX;
235
- }
236
- setPaddingX(padding) {
237
- const newPadding = Number.isFinite(padding) ? Math.max(0, Math.floor(padding)) : 0;
238
- if (this.paddingX !== newPadding) {
239
- this.paddingX = newPadding;
240
- this.tui.requestRender();
241
- }
242
- }
243
- getAutocompleteMaxVisible() {
244
- return this.autocompleteMaxVisible;
245
- }
246
- setAutocompleteMaxVisible(maxVisible) {
247
- const newMaxVisible = Number.isFinite(maxVisible) ? Math.max(3, Math.min(20, Math.floor(maxVisible))) : 5;
248
- if (this.autocompleteMaxVisible !== newMaxVisible) {
249
- this.autocompleteMaxVisible = newMaxVisible;
250
- this.tui.requestRender();
251
- }
252
- }
253
- setAutocompleteProvider(provider) {
254
- this.cancelAutocomplete();
255
- this.autocompleteProvider = provider;
256
- }
257
- /**
258
- * Add a prompt to history for up/down arrow navigation.
259
- * Called after successful submission.
260
- */
261
- addToHistory(text) {
262
- const trimmed = text.trim();
263
- if (!trimmed)
264
- return;
265
- // Don't add consecutive duplicates
266
- if (this.history.length > 0 && this.history[0] === trimmed)
267
- return;
268
- this.history.unshift(trimmed);
269
- // Limit history size
270
- if (this.history.length > 100) {
271
- this.history.pop();
272
- }
273
- }
274
- isEditorEmpty() {
275
- return this.state.lines.length === 1 && this.state.lines[0] === "";
276
- }
277
- isOnFirstVisualLine() {
278
- const visualLines = this.buildVisualLineMap(this.lastWidth);
279
- const currentVisualLine = this.findCurrentVisualLine(visualLines);
280
- return currentVisualLine === 0;
281
- }
282
- isOnLastVisualLine() {
283
- const visualLines = this.buildVisualLineMap(this.lastWidth);
284
- const currentVisualLine = this.findCurrentVisualLine(visualLines);
285
- return currentVisualLine === visualLines.length - 1;
286
- }
287
- navigateHistory(direction) {
288
- this.lastAction = null;
289
- if (this.history.length === 0)
290
- return;
291
- const newIndex = this.historyIndex - direction; // Up(-1) increases index, Down(1) decreases
292
- if (newIndex < -1 || newIndex >= this.history.length)
293
- return;
294
- // Capture state when first entering history browsing mode
295
- if (this.historyIndex === -1 && newIndex >= 0) {
296
- this.pushUndoSnapshot();
297
- }
298
- this.historyIndex = newIndex;
299
- if (this.historyIndex === -1) {
300
- // Returned to "current" state - clear editor
301
- this.setTextInternal("");
302
- }
303
- else {
304
- this.setTextInternal(this.history[this.historyIndex] || "");
305
- }
306
- }
307
- /** Internal setText that doesn't reset history state - used by navigateHistory */
308
- setTextInternal(text) {
309
- const lines = text.split("\n");
310
- this.state.lines = lines.length === 0 ? [""] : lines;
311
- this.state.cursorLine = this.state.lines.length - 1;
312
- this.setCursorCol(this.state.lines[this.state.cursorLine]?.length || 0);
313
- // Reset scroll - render() will adjust to show cursor
314
- this.scrollOffset = 0;
315
- if (this.onChange) {
316
- this.onChange(this.getText());
317
- }
318
- }
319
- invalidate() {
320
- // No cached state to invalidate currently
321
- }
322
- render(width) {
323
- const maxPadding = Math.max(0, Math.floor((width - 1) / 2));
324
- const paddingX = Math.min(this.paddingX, maxPadding);
325
- const contentWidth = Math.max(1, width - paddingX * 2);
326
- // Layout width: with padding the cursor can overflow into it,
327
- // without padding we reserve 1 column for the cursor.
328
- const layoutWidth = Math.max(1, contentWidth - (paddingX ? 0 : 1));
329
- // Store for cursor navigation (must match wrapping width)
330
- this.lastWidth = layoutWidth;
331
- const horizontal = this.borderColor("─");
332
- // Layout the text
333
- const layoutLines = this.layoutText(layoutWidth);
334
- // Calculate max visible lines: 30% of terminal height, minimum 5 lines
335
- const terminalRows = this.tui.terminal.rows;
336
- const maxVisibleLines = Math.max(5, Math.floor(terminalRows * 0.3));
337
- // Find the cursor line index in layoutLines
338
- let cursorLineIndex = layoutLines.findIndex((line) => line.hasCursor);
339
- if (cursorLineIndex === -1)
340
- cursorLineIndex = 0;
341
- // Adjust scroll offset to keep cursor visible
342
- if (cursorLineIndex < this.scrollOffset) {
343
- this.scrollOffset = cursorLineIndex;
344
- }
345
- else if (cursorLineIndex >= this.scrollOffset + maxVisibleLines) {
346
- this.scrollOffset = cursorLineIndex - maxVisibleLines + 1;
347
- }
348
- // Clamp scroll offset to valid range
349
- const maxScrollOffset = Math.max(0, layoutLines.length - maxVisibleLines);
350
- this.scrollOffset = Math.max(0, Math.min(this.scrollOffset, maxScrollOffset));
351
- // Get visible lines slice
352
- const visibleLines = layoutLines.slice(this.scrollOffset, this.scrollOffset + maxVisibleLines);
353
- const result = [];
354
- const leftPadding = " ".repeat(paddingX);
355
- const rightPadding = leftPadding;
356
- // Render top border (with scroll indicator if scrolled down)
357
- if (this.scrollOffset > 0) {
358
- const indicator = `─── ↑ ${this.scrollOffset} more `;
359
- const remaining = width - visibleWidth(indicator);
360
- if (remaining >= 0) {
361
- result.push(this.borderColor(indicator + "─".repeat(remaining)));
362
- }
363
- else {
364
- result.push(this.borderColor(truncateToWidth(indicator, width)));
365
- }
366
- }
367
- else {
368
- result.push(horizontal.repeat(width));
369
- }
370
- // Render each visible layout line
371
- // Emit hardware cursor marker only when focused and not showing autocomplete
372
- const emitCursorMarker = this.focused && !this.autocompleteState;
373
- for (const layoutLine of visibleLines) {
374
- let displayText = layoutLine.text;
375
- let lineVisibleWidth = visibleWidth(layoutLine.text);
376
- let cursorInPadding = false;
377
- // Add cursor if this line has it
378
- if (layoutLine.hasCursor && layoutLine.cursorPos !== undefined) {
379
- const before = displayText.slice(0, layoutLine.cursorPos);
380
- const after = displayText.slice(layoutLine.cursorPos);
381
- // Hardware cursor marker (zero-width, emitted before fake cursor for IME positioning)
382
- const marker = emitCursorMarker ? CURSOR_MARKER : "";
383
- if (after.length > 0) {
384
- // Cursor is on a character (grapheme) - replace it with highlighted version
385
- // Get the first grapheme from 'after'
386
- const afterGraphemes = [...this.segment(after, "grapheme")];
387
- const firstGrapheme = afterGraphemes[0]?.segment || "";
388
- const restAfter = after.slice(firstGrapheme.length);
389
- const cursor = `\x1b[7m${firstGrapheme}\x1b[0m`;
390
- displayText = before + marker + cursor + restAfter;
391
- // lineVisibleWidth stays the same - we're replacing, not adding
392
- }
393
- else {
394
- // Cursor is at the end - add highlighted space
395
- const cursor = "\x1b[7m \x1b[0m";
396
- displayText = before + marker + cursor;
397
- lineVisibleWidth = lineVisibleWidth + 1;
398
- // If cursor overflows content width into the padding, flag it
399
- if (lineVisibleWidth > contentWidth && paddingX > 0) {
400
- cursorInPadding = true;
401
- }
402
- }
403
- }
404
- // Calculate padding based on actual visible width
405
- const padding = " ".repeat(Math.max(0, contentWidth - lineVisibleWidth));
406
- const lineRightPadding = cursorInPadding ? rightPadding.slice(1) : rightPadding;
407
- // Render the line (no side borders, just horizontal lines above and below)
408
- result.push(`${leftPadding}${displayText}${padding}${lineRightPadding}`);
409
- }
410
- // Render bottom border (with scroll indicator if more content below)
411
- const linesBelow = layoutLines.length - (this.scrollOffset + visibleLines.length);
412
- if (linesBelow > 0) {
413
- const indicator = `─── ↓ ${linesBelow} more `;
414
- const remaining = width - visibleWidth(indicator);
415
- result.push(this.borderColor(indicator + "─".repeat(Math.max(0, remaining))));
416
- }
417
- else {
418
- result.push(horizontal.repeat(width));
419
- }
420
- // Add autocomplete list if active
421
- if (this.autocompleteState && this.autocompleteList) {
422
- const autocompleteResult = this.autocompleteList.render(contentWidth);
423
- for (const line of autocompleteResult) {
424
- const lineWidth = visibleWidth(line);
425
- const linePadding = " ".repeat(Math.max(0, contentWidth - lineWidth));
426
- result.push(`${leftPadding}${line}${linePadding}${rightPadding}`);
427
- }
428
- }
429
- return result;
430
- }
431
- handleInput(data) {
432
- const kb = getKeybindings();
433
- // Handle character jump mode (awaiting next character to jump to)
434
- if (this.jumpMode !== null) {
435
- // Cancel if the hotkey is pressed again
436
- if (kb.matches(data, "tui.editor.jumpForward") || kb.matches(data, "tui.editor.jumpBackward")) {
437
- this.jumpMode = null;
438
- return;
439
- }
440
- const printable = decodePrintableKey(data) ?? (data.charCodeAt(0) >= 32 ? data : undefined);
441
- if (printable !== undefined) {
442
- // Printable character - perform the jump
443
- const direction = this.jumpMode;
444
- this.jumpMode = null;
445
- this.jumpToChar(printable, direction);
446
- return;
447
- }
448
- // Control character - cancel and fall through to normal handling
449
- this.jumpMode = null;
450
- }
451
- // Handle bracketed paste mode
452
- if (data.includes("\x1b[200~")) {
453
- this.isInPaste = true;
454
- this.pasteBuffer = "";
455
- data = data.replace("\x1b[200~", "");
456
- }
457
- if (this.isInPaste) {
458
- this.pasteBuffer += data;
459
- const endIndex = this.pasteBuffer.indexOf("\x1b[201~");
460
- if (endIndex !== -1) {
461
- const pasteContent = this.pasteBuffer.substring(0, endIndex);
462
- if (pasteContent.length > 0) {
463
- this.handlePaste(pasteContent);
464
- }
465
- this.isInPaste = false;
466
- const remaining = this.pasteBuffer.substring(endIndex + 6);
467
- this.pasteBuffer = "";
468
- if (remaining.length > 0) {
469
- this.handleInput(remaining);
470
- }
471
- return;
472
- }
473
- return;
474
- }
475
- // Ctrl+C - let parent handle (exit/clear)
476
- if (kb.matches(data, "tui.input.copy")) {
477
- return;
478
- }
479
- // Undo
480
- if (kb.matches(data, "tui.editor.undo")) {
481
- this.undo();
482
- return;
483
- }
484
- // Handle autocomplete mode
485
- if (this.autocompleteState && this.autocompleteList) {
486
- if (kb.matches(data, "tui.select.cancel")) {
487
- this.cancelAutocomplete();
488
- return;
489
- }
490
- if (kb.matches(data, "tui.select.up") || kb.matches(data, "tui.select.down")) {
491
- this.autocompleteList.handleInput(data);
492
- return;
493
- }
494
- if (kb.matches(data, "tui.input.tab")) {
495
- const selected = this.autocompleteList.getSelectedItem();
496
- if (selected && this.autocompleteProvider) {
497
- this.pushUndoSnapshot();
498
- this.lastAction = null;
499
- const result = this.autocompleteProvider.applyCompletion(this.state.lines, this.state.cursorLine, this.state.cursorCol, selected, this.autocompletePrefix);
500
- this.state.lines = result.lines;
501
- this.state.cursorLine = result.cursorLine;
502
- this.setCursorCol(result.cursorCol);
503
- this.cancelAutocomplete();
504
- if (this.onChange)
505
- this.onChange(this.getText());
506
- }
507
- return;
508
- }
509
- if (kb.matches(data, "tui.select.confirm")) {
510
- const selected = this.autocompleteList.getSelectedItem();
511
- if (selected && this.autocompleteProvider) {
512
- this.pushUndoSnapshot();
513
- this.lastAction = null;
514
- const result = this.autocompleteProvider.applyCompletion(this.state.lines, this.state.cursorLine, this.state.cursorCol, selected, this.autocompletePrefix);
515
- this.state.lines = result.lines;
516
- this.state.cursorLine = result.cursorLine;
517
- this.setCursorCol(result.cursorCol);
518
- if (this.autocompletePrefix.startsWith("/")) {
519
- this.cancelAutocomplete();
520
- // Fall through to submit
521
- }
522
- else {
523
- this.cancelAutocomplete();
524
- if (this.onChange)
525
- this.onChange(this.getText());
526
- return;
527
- }
528
- }
529
- }
530
- }
531
- // Tab - trigger completion
532
- if (kb.matches(data, "tui.input.tab") && !this.autocompleteState) {
533
- this.handleTabCompletion();
534
- return;
535
- }
536
- // Deletion actions
537
- if (kb.matches(data, "tui.editor.deleteToLineEnd")) {
538
- this.deleteToEndOfLine();
539
- return;
540
- }
541
- if (kb.matches(data, "tui.editor.deleteToLineStart")) {
542
- this.deleteToStartOfLine();
543
- return;
544
- }
545
- if (kb.matches(data, "tui.editor.deleteWordBackward")) {
546
- this.deleteWordBackwards();
547
- return;
548
- }
549
- if (kb.matches(data, "tui.editor.deleteWordForward")) {
550
- this.deleteWordForward();
551
- return;
552
- }
553
- if (kb.matches(data, "tui.editor.deleteCharBackward") || matchesKey(data, "shift+backspace")) {
554
- this.handleBackspace();
555
- return;
556
- }
557
- if (kb.matches(data, "tui.editor.deleteCharForward") || matchesKey(data, "shift+delete")) {
558
- this.handleForwardDelete();
559
- return;
560
- }
561
- // Kill ring actions
562
- if (kb.matches(data, "tui.editor.yank")) {
563
- this.yank();
564
- return;
565
- }
566
- if (kb.matches(data, "tui.editor.yankPop")) {
567
- this.yankPop();
568
- return;
569
- }
570
- // Cursor movement actions
571
- if (kb.matches(data, "tui.editor.cursorLineStart")) {
572
- this.moveToLineStart();
573
- return;
574
- }
575
- if (kb.matches(data, "tui.editor.cursorLineEnd")) {
576
- this.moveToLineEnd();
577
- return;
578
- }
579
- if (kb.matches(data, "tui.editor.cursorWordLeft")) {
580
- this.moveWordBackwards();
581
- return;
582
- }
583
- if (kb.matches(data, "tui.editor.cursorWordRight")) {
584
- this.moveWordForwards();
585
- return;
586
- }
587
- // New line
588
- if (kb.matches(data, "tui.input.newLine") ||
589
- (data.charCodeAt(0) === 10 && data.length > 1) ||
590
- data === "\x1b\r" ||
591
- data === "\x1b[13;2~" ||
592
- (data.length > 1 && data.includes("\x1b") && data.includes("\r")) ||
593
- (data === "\n" && data.length === 1)) {
594
- if (this.shouldSubmitOnBackslashEnter(data, kb)) {
595
- this.handleBackspace();
596
- this.submitValue();
597
- return;
598
- }
599
- this.addNewLine();
600
- return;
601
- }
602
- // Submit (Enter)
603
- if (kb.matches(data, "tui.input.submit")) {
604
- if (this.disableSubmit)
605
- return;
606
- // Workaround for terminals without Shift+Enter support:
607
- // If char before cursor is \, delete it and insert newline instead of submitting.
608
- const currentLine = this.state.lines[this.state.cursorLine] || "";
609
- if (this.state.cursorCol > 0 && currentLine[this.state.cursorCol - 1] === "\\") {
610
- this.handleBackspace();
611
- this.addNewLine();
612
- return;
613
- }
614
- this.submitValue();
615
- return;
616
- }
617
- // Arrow key navigation (with history support)
618
- if (kb.matches(data, "tui.editor.cursorUp")) {
619
- if (this.isEditorEmpty()) {
620
- this.navigateHistory(-1);
621
- }
622
- else if (this.historyIndex > -1 && this.isOnFirstVisualLine()) {
623
- this.navigateHistory(-1);
624
- }
625
- else if (this.isOnFirstVisualLine()) {
626
- // Already at top - jump to start of line
627
- this.moveToLineStart();
628
- }
629
- else {
630
- this.moveCursor(-1, 0);
631
- }
632
- return;
633
- }
634
- if (kb.matches(data, "tui.editor.cursorDown")) {
635
- if (this.historyIndex > -1 && this.isOnLastVisualLine()) {
636
- this.navigateHistory(1);
637
- }
638
- else if (this.isOnLastVisualLine()) {
639
- // Already at bottom - jump to end of line
640
- this.moveToLineEnd();
641
- }
642
- else {
643
- this.moveCursor(1, 0);
644
- }
645
- return;
646
- }
647
- if (kb.matches(data, "tui.editor.cursorRight")) {
648
- this.moveCursor(0, 1);
649
- return;
650
- }
651
- if (kb.matches(data, "tui.editor.cursorLeft")) {
652
- this.moveCursor(0, -1);
653
- return;
654
- }
655
- // Page up/down - scroll by page and move cursor
656
- if (kb.matches(data, "tui.editor.pageUp")) {
657
- this.pageScroll(-1);
658
- return;
659
- }
660
- if (kb.matches(data, "tui.editor.pageDown")) {
661
- this.pageScroll(1);
662
- return;
663
- }
664
- // Character jump mode triggers
665
- if (kb.matches(data, "tui.editor.jumpForward")) {
666
- this.jumpMode = "forward";
667
- return;
668
- }
669
- if (kb.matches(data, "tui.editor.jumpBackward")) {
670
- this.jumpMode = "backward";
671
- return;
672
- }
673
- // Shift+Space - insert regular space
674
- if (matchesKey(data, "shift+space")) {
675
- this.insertCharacter(" ");
676
- return;
677
- }
678
- const printable = decodePrintableKey(data);
679
- if (printable !== undefined) {
680
- this.insertCharacter(printable);
681
- return;
682
- }
683
- // Regular characters
684
- if (data.charCodeAt(0) >= 32) {
685
- this.insertCharacter(data);
686
- }
687
- }
688
- layoutText(contentWidth) {
689
- const layoutLines = [];
690
- if (this.state.lines.length === 0 || (this.state.lines.length === 1 && this.state.lines[0] === "")) {
691
- // Empty editor
692
- layoutLines.push({
693
- text: "",
694
- hasCursor: true,
695
- cursorPos: 0,
696
- });
697
- return layoutLines;
698
- }
699
- // Process each logical line
700
- for (let i = 0; i < this.state.lines.length; i++) {
701
- const line = this.state.lines[i] || "";
702
- const isCurrentLine = i === this.state.cursorLine;
703
- const lineVisibleWidth = visibleWidth(line);
704
- if (lineVisibleWidth <= contentWidth) {
705
- // Line fits in one layout line
706
- if (isCurrentLine) {
707
- layoutLines.push({
708
- text: line,
709
- hasCursor: true,
710
- cursorPos: this.state.cursorCol,
711
- });
712
- }
713
- else {
714
- layoutLines.push({
715
- text: line,
716
- hasCursor: false,
717
- });
718
- }
719
- }
720
- else {
721
- // Line needs wrapping - use word-aware wrapping
722
- const chunks = wordWrapLine(line, contentWidth, [...this.segment(line, "grapheme")]);
723
- for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
724
- const chunk = chunks[chunkIndex];
725
- if (!chunk)
726
- continue;
727
- const cursorPos = this.state.cursorCol;
728
- const isLastChunk = chunkIndex === chunks.length - 1;
729
- // Determine if cursor is in this chunk
730
- // For word-wrapped chunks, we need to handle the case where
731
- // cursor might be in trimmed whitespace at end of chunk
732
- let hasCursorInChunk = false;
733
- let adjustedCursorPos = 0;
734
- if (isCurrentLine) {
735
- if (isLastChunk) {
736
- // Last chunk: cursor belongs here if >= startIndex
737
- hasCursorInChunk = cursorPos >= chunk.startIndex;
738
- adjustedCursorPos = cursorPos - chunk.startIndex;
739
- }
740
- else {
741
- // Non-last chunk: cursor belongs here if in range [startIndex, endIndex)
742
- // But we need to handle the visual position in the trimmed text
743
- hasCursorInChunk = cursorPos >= chunk.startIndex && cursorPos < chunk.endIndex;
744
- if (hasCursorInChunk) {
745
- adjustedCursorPos = cursorPos - chunk.startIndex;
746
- // Clamp to text length (in case cursor was in trimmed whitespace)
747
- if (adjustedCursorPos > chunk.text.length) {
748
- adjustedCursorPos = chunk.text.length;
749
- }
750
- }
751
- }
752
- }
753
- if (hasCursorInChunk) {
754
- layoutLines.push({
755
- text: chunk.text,
756
- hasCursor: true,
757
- cursorPos: adjustedCursorPos,
758
- });
759
- }
760
- else {
761
- layoutLines.push({
762
- text: chunk.text,
763
- hasCursor: false,
764
- });
765
- }
766
- }
767
- }
768
- }
769
- return layoutLines;
770
- }
771
- getText() {
772
- return this.state.lines.join("\n");
773
- }
774
- expandPasteMarkers(text) {
775
- let result = text;
776
- for (const [pasteId, pasteContent] of this.pastes) {
777
- const markerRegex = new RegExp(`\\[paste #${pasteId}( (\\+\\d+ lines|\\d+ chars))?\\]`, "g");
778
- result = result.replace(markerRegex, () => pasteContent);
779
- }
780
- return result;
781
- }
782
- /**
783
- * Get text with paste markers expanded to their actual content.
784
- * Use this when you need the full content (e.g., for external editor).
785
- */
786
- getExpandedText() {
787
- return this.expandPasteMarkers(this.state.lines.join("\n"));
788
- }
789
- getLines() {
790
- return [...this.state.lines];
791
- }
792
- getCursor() {
793
- return { line: this.state.cursorLine, col: this.state.cursorCol };
794
- }
795
- setText(text) {
796
- this.cancelAutocomplete();
797
- this.lastAction = null;
798
- this.historyIndex = -1; // Exit history browsing mode
799
- const normalized = this.normalizeText(text);
800
- // Push undo snapshot if content differs (makes programmatic changes undoable)
801
- if (this.getText() !== normalized) {
802
- this.pushUndoSnapshot();
803
- }
804
- this.setTextInternal(normalized);
805
- }
806
- /**
807
- * Insert text at the current cursor position.
808
- * Used for programmatic insertion (e.g., clipboard image markers).
809
- * This is atomic for undo - single undo restores entire pre-insert state.
810
- */
811
- insertTextAtCursor(text) {
812
- if (!text)
813
- return;
814
- this.cancelAutocomplete();
815
- this.pushUndoSnapshot();
816
- this.lastAction = null;
817
- this.historyIndex = -1;
818
- this.insertTextAtCursorInternal(text);
819
- }
820
- /**
821
- * Normalize text for editor storage:
822
- * - Normalize line endings (\r\n and \r -> \n)
823
- * - Expand tabs to 4 spaces
824
- */
825
- normalizeText(text) {
826
- return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\t/g, " ");
827
- }
828
- /**
829
- * Internal text insertion at cursor. Handles single and multi-line text.
830
- * Does not push undo snapshots or trigger autocomplete - caller is responsible.
831
- * Normalizes line endings and calls onChange once at the end.
832
- */
833
- insertTextAtCursorInternal(text) {
834
- if (!text)
835
- return;
836
- // Normalize line endings and tabs
837
- const normalized = this.normalizeText(text);
838
- const insertedLines = normalized.split("\n");
839
- const currentLine = this.state.lines[this.state.cursorLine] || "";
840
- const beforeCursor = currentLine.slice(0, this.state.cursorCol);
841
- const afterCursor = currentLine.slice(this.state.cursorCol);
842
- if (insertedLines.length === 1) {
843
- // Single line - insert at cursor position
844
- this.state.lines[this.state.cursorLine] = beforeCursor + normalized + afterCursor;
845
- this.setCursorCol(this.state.cursorCol + normalized.length);
846
- }
847
- else {
848
- // Multi-line insertion
849
- this.state.lines = [
850
- // All lines before current line
851
- ...this.state.lines.slice(0, this.state.cursorLine),
852
- // The first inserted line merged with text before cursor
853
- beforeCursor + insertedLines[0],
854
- // All middle inserted lines
855
- ...insertedLines.slice(1, -1),
856
- // The last inserted line with text after cursor
857
- insertedLines[insertedLines.length - 1] + afterCursor,
858
- // All lines after current line
859
- ...this.state.lines.slice(this.state.cursorLine + 1),
860
- ];
861
- this.state.cursorLine += insertedLines.length - 1;
862
- this.setCursorCol((insertedLines[insertedLines.length - 1] || "").length);
863
- }
864
- if (this.onChange) {
865
- this.onChange(this.getText());
866
- }
867
- }
868
- // All the editor methods from before...
869
- insertCharacter(char, skipUndoCoalescing) {
870
- this.historyIndex = -1; // Exit history browsing mode
871
- // Undo coalescing (fish-style):
872
- // - Consecutive word chars coalesce into one undo unit
873
- // - Space captures state before itself (so undo removes space+following word together)
874
- // - Each space is separately undoable
875
- // Skip coalescing when called from atomic operations (e.g., handlePaste)
876
- if (!skipUndoCoalescing) {
877
- if (isWhitespaceChar(char) || this.lastAction !== "type-word") {
878
- this.pushUndoSnapshot();
879
- }
880
- this.lastAction = "type-word";
881
- }
882
- const line = this.state.lines[this.state.cursorLine] || "";
883
- const before = line.slice(0, this.state.cursorCol);
884
- const after = line.slice(this.state.cursorCol);
885
- this.state.lines[this.state.cursorLine] = before + char + after;
886
- this.setCursorCol(this.state.cursorCol + char.length);
887
- if (this.onChange) {
888
- this.onChange(this.getText());
889
- }
890
- // Check if we should trigger or update autocomplete
891
- if (!this.autocompleteState) {
892
- // Auto-trigger for "/" at the start of a line (slash commands)
893
- if (char === "/" && this.isAtStartOfMessage()) {
894
- this.tryTriggerAutocomplete();
895
- }
896
- // Auto-trigger for symbol-based completion like @ or # at token boundaries
897
- else if (char === "@" || char === "#") {
898
- const currentLine = this.state.lines[this.state.cursorLine] || "";
899
- const textBeforeCursor = currentLine.slice(0, this.state.cursorCol);
900
- const charBeforeSymbol = textBeforeCursor[textBeforeCursor.length - 2];
901
- if (textBeforeCursor.length === 1 || charBeforeSymbol === " " || charBeforeSymbol === "\t") {
902
- this.tryTriggerAutocomplete();
903
- }
904
- }
905
- // Also auto-trigger when typing letters in a slash command or symbol completion context
906
- else if (/[a-zA-Z0-9.\-_]/.test(char)) {
907
- const currentLine = this.state.lines[this.state.cursorLine] || "";
908
- const textBeforeCursor = currentLine.slice(0, this.state.cursorCol);
909
- // Check if we're in a slash command (with or without space for arguments)
910
- if (this.isInSlashCommandContext(textBeforeCursor)) {
911
- this.tryTriggerAutocomplete();
912
- }
913
- // Check if we're in a symbol-based completion context like @ or #
914
- else if (textBeforeCursor.match(/(?:^|[\s])[@#][^\s]*$/)) {
915
- this.tryTriggerAutocomplete();
916
- }
917
- }
918
- }
919
- else {
920
- this.updateAutocomplete();
921
- }
922
- }
923
- handlePaste(pastedText) {
924
- this.cancelAutocomplete();
925
- this.historyIndex = -1; // Exit history browsing mode
926
- this.lastAction = null;
927
- this.pushUndoSnapshot();
928
- // Some terminals (e.g. tmux popups with extended-keys-format=csi-u) re-encode
929
- // control bytes inside bracketed paste as CSI-u Ctrl+<letter> sequences
930
- // (ESC [ <codepoint> ; 5 u). Decode those back to their literal byte so the
931
- // per-char filter below preserves newlines instead of stripping ESC and
932
- // leaking the printable tail (e.g. "[106;5u") into the editor.
933
- const decodedText = pastedText.replace(/\x1b\[(\d+);5u/g, (match, code) => {
934
- const cp = Number(code);
935
- if (cp >= 97 && cp <= 122)
936
- return String.fromCharCode(cp - 96);
937
- if (cp >= 65 && cp <= 90)
938
- return String.fromCharCode(cp - 64);
939
- return match;
940
- });
941
- // Clean the pasted text: normalize line endings, expand tabs
942
- const cleanText = this.normalizeText(decodedText);
943
- // Filter out non-printable characters except newlines
944
- let filteredText = cleanText
945
- .split("")
946
- .filter((char) => char === "\n" || char.charCodeAt(0) >= 32)
947
- .join("");
948
- // If pasting a file path (starts with /, ~, or .) and the character before
949
- // the cursor is a word character, prepend a space for better readability
950
- if (/^[/~.]/.test(filteredText)) {
951
- const currentLine = this.state.lines[this.state.cursorLine] || "";
952
- const charBeforeCursor = this.state.cursorCol > 0 ? currentLine[this.state.cursorCol - 1] : "";
953
- if (charBeforeCursor && /\w/.test(charBeforeCursor)) {
954
- filteredText = ` ${filteredText}`;
955
- }
956
- }
957
- // Split into lines to check for large paste
958
- const pastedLines = filteredText.split("\n");
959
- // Check if this is a large paste (> 10 lines or > 1000 characters)
960
- const totalChars = filteredText.length;
961
- if (pastedLines.length > 10 || totalChars > 1000) {
962
- // Store the paste and insert a marker
963
- this.pasteCounter++;
964
- const pasteId = this.pasteCounter;
965
- this.pastes.set(pasteId, filteredText);
966
- // Insert marker like "[paste #1 +123 lines]" or "[paste #1 1234 chars]"
967
- const marker = pastedLines.length > 10
968
- ? `[paste #${pasteId} +${pastedLines.length} lines]`
969
- : `[paste #${pasteId} ${totalChars} chars]`;
970
- this.insertTextAtCursorInternal(marker);
971
- return;
972
- }
973
- if (pastedLines.length === 1) {
974
- // Single line - insert atomically (do not trigger autocomplete during paste)
975
- this.insertTextAtCursorInternal(filteredText);
976
- return;
977
- }
978
- // Multi-line paste - use direct state manipulation
979
- this.insertTextAtCursorInternal(filteredText);
980
- }
981
- addNewLine() {
982
- this.cancelAutocomplete();
983
- this.historyIndex = -1; // Exit history browsing mode
984
- this.lastAction = null;
985
- this.pushUndoSnapshot();
986
- const currentLine = this.state.lines[this.state.cursorLine] || "";
987
- const before = currentLine.slice(0, this.state.cursorCol);
988
- const after = currentLine.slice(this.state.cursorCol);
989
- // Split current line
990
- this.state.lines[this.state.cursorLine] = before;
991
- this.state.lines.splice(this.state.cursorLine + 1, 0, after);
992
- // Move cursor to start of new line
993
- this.state.cursorLine++;
994
- this.setCursorCol(0);
995
- if (this.onChange) {
996
- this.onChange(this.getText());
997
- }
998
- }
999
- shouldSubmitOnBackslashEnter(data, kb) {
1000
- if (this.disableSubmit)
1001
- return false;
1002
- if (!matchesKey(data, "enter"))
1003
- return false;
1004
- const submitKeys = kb.getKeys("tui.input.submit");
1005
- const hasShiftEnter = submitKeys.includes("shift+enter") || submitKeys.includes("shift+return");
1006
- if (!hasShiftEnter)
1007
- return false;
1008
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1009
- return this.state.cursorCol > 0 && currentLine[this.state.cursorCol - 1] === "\\";
1010
- }
1011
- submitValue() {
1012
- this.cancelAutocomplete();
1013
- const result = this.expandPasteMarkers(this.state.lines.join("\n")).trim();
1014
- this.state = { lines: [""], cursorLine: 0, cursorCol: 0 };
1015
- this.pastes.clear();
1016
- this.pasteCounter = 0;
1017
- this.historyIndex = -1;
1018
- this.scrollOffset = 0;
1019
- this.undoStack.clear();
1020
- this.lastAction = null;
1021
- if (this.onChange)
1022
- this.onChange("");
1023
- if (this.onSubmit)
1024
- this.onSubmit(result);
1025
- }
1026
- handleBackspace() {
1027
- this.historyIndex = -1; // Exit history browsing mode
1028
- this.lastAction = null;
1029
- if (this.state.cursorCol > 0) {
1030
- this.pushUndoSnapshot();
1031
- // Delete grapheme before cursor (handles emojis, combining characters, etc.)
1032
- const line = this.state.lines[this.state.cursorLine] || "";
1033
- const beforeCursor = line.slice(0, this.state.cursorCol);
1034
- // Find the last grapheme in the text before cursor
1035
- const graphemes = [...this.segment(beforeCursor, "grapheme")];
1036
- const lastGrapheme = graphemes[graphemes.length - 1];
1037
- const graphemeLength = lastGrapheme ? lastGrapheme.segment.length : 1;
1038
- const before = line.slice(0, this.state.cursorCol - graphemeLength);
1039
- const after = line.slice(this.state.cursorCol);
1040
- this.state.lines[this.state.cursorLine] = before + after;
1041
- this.setCursorCol(this.state.cursorCol - graphemeLength);
1042
- }
1043
- else if (this.state.cursorLine > 0) {
1044
- this.pushUndoSnapshot();
1045
- // Merge with previous line
1046
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1047
- const previousLine = this.state.lines[this.state.cursorLine - 1] || "";
1048
- this.state.lines[this.state.cursorLine - 1] = previousLine + currentLine;
1049
- this.state.lines.splice(this.state.cursorLine, 1);
1050
- this.state.cursorLine--;
1051
- this.setCursorCol(previousLine.length);
1052
- }
1053
- if (this.onChange) {
1054
- this.onChange(this.getText());
1055
- }
1056
- // Update or re-trigger autocomplete after backspace
1057
- if (this.autocompleteState) {
1058
- this.updateAutocomplete();
1059
- }
1060
- else {
1061
- // If autocomplete was cancelled (no matches), re-trigger if we're in a completable context
1062
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1063
- const textBeforeCursor = currentLine.slice(0, this.state.cursorCol);
1064
- // Slash command context
1065
- if (this.isInSlashCommandContext(textBeforeCursor)) {
1066
- this.tryTriggerAutocomplete();
1067
- }
1068
- // Symbol-based completion context like @ or #
1069
- else if (textBeforeCursor.match(/(?:^|[\s])[@#][^\s]*$/)) {
1070
- this.tryTriggerAutocomplete();
1071
- }
1072
- }
1073
- }
1074
- /**
1075
- * Set cursor column and clear preferredVisualCol.
1076
- * Use this for all non-vertical cursor movements to reset sticky column behavior.
1077
- */
1078
- setCursorCol(col) {
1079
- this.state.cursorCol = col;
1080
- this.preferredVisualCol = null;
1081
- this.snappedFromCursorCol = null;
1082
- }
1083
- /**
1084
- * Move cursor to a target visual line, applying sticky column logic.
1085
- * Shared by moveCursor() and pageScroll().
1086
- */
1087
- moveToVisualLine(visualLines, currentVisualLine, targetVisualLine) {
1088
- const currentVL = visualLines[currentVisualLine];
1089
- const targetVL = visualLines[targetVisualLine];
1090
- if (!(currentVL && targetVL))
1091
- return;
1092
- // When the cursor was snapped to a segment start, resolve the pre-snap
1093
- // position against the VL it belongs to. This gives the correct visual
1094
- // column even after a resize reshuffles VLs.
1095
- let currentVisualCol;
1096
- if (this.snappedFromCursorCol !== null) {
1097
- const vlIndex = this.findVisualLineAt(visualLines, currentVL.logicalLine, this.snappedFromCursorCol);
1098
- currentVisualCol = this.snappedFromCursorCol - visualLines[vlIndex].startCol;
1099
- }
1100
- else {
1101
- currentVisualCol = this.state.cursorCol - currentVL.startCol;
1102
- }
1103
- // For non-last segments, clamp to length-1 to stay within the segment
1104
- const isLastSourceSegment = currentVisualLine === visualLines.length - 1 ||
1105
- visualLines[currentVisualLine + 1]?.logicalLine !== currentVL.logicalLine;
1106
- const sourceMaxVisualCol = isLastSourceSegment ? currentVL.length : Math.max(0, currentVL.length - 1);
1107
- const isLastTargetSegment = targetVisualLine === visualLines.length - 1 ||
1108
- visualLines[targetVisualLine + 1]?.logicalLine !== targetVL.logicalLine;
1109
- const targetMaxVisualCol = isLastTargetSegment ? targetVL.length : Math.max(0, targetVL.length - 1);
1110
- const moveToVisualCol = this.computeVerticalMoveColumn(currentVisualCol, sourceMaxVisualCol, targetMaxVisualCol);
1111
- // Set cursor position
1112
- this.state.cursorLine = targetVL.logicalLine;
1113
- const targetCol = targetVL.startCol + moveToVisualCol;
1114
- const logicalLine = this.state.lines[targetVL.logicalLine] || "";
1115
- this.state.cursorCol = Math.min(targetCol, logicalLine.length);
1116
- // Snap cursor to atomic segment boundary (e.g. paste markers)
1117
- // so the cursor never lands in the middle of a multi-grapheme unit.
1118
- // Single-grapheme segments don't need snapping.
1119
- const segments = [...this.segment(logicalLine, "grapheme")];
1120
- for (const seg of segments) {
1121
- if (seg.index > this.state.cursorCol)
1122
- break;
1123
- if (seg.segment.length <= 1)
1124
- continue;
1125
- if (this.state.cursorCol < seg.index + seg.segment.length) {
1126
- const isContinuation = seg.index < targetVL.startCol;
1127
- const isMovingDown = targetVisualLine > currentVisualLine;
1128
- if (isContinuation && isMovingDown) {
1129
- // The segment started on a previous visual line, and we
1130
- // already visited it on the way down. Skip all remaining
1131
- // continuation VLs and land on the first VL past it.
1132
- const segEnd = seg.index + seg.segment.length;
1133
- let next = targetVisualLine + 1;
1134
- while (next < visualLines.length &&
1135
- visualLines[next].logicalLine === targetVL.logicalLine &&
1136
- visualLines[next].startCol < segEnd) {
1137
- next++;
1138
- }
1139
- if (next < visualLines.length) {
1140
- this.moveToVisualLine(visualLines, currentVisualLine, next);
1141
- return;
1142
- }
1143
- }
1144
- // Snap to the start of the segment so it gets highlighted.
1145
- // Store the pre-snap position so the next vertical move can
1146
- // resolve it to the correct visual column.
1147
- this.snappedFromCursorCol = this.state.cursorCol;
1148
- this.state.cursorCol = seg.index;
1149
- return;
1150
- }
1151
- }
1152
- // No snap occurred – we moved out of the atomic segment.
1153
- this.snappedFromCursorCol = null;
1154
- }
1155
- /**
1156
- * Compute the target visual column for vertical cursor movement.
1157
- * Implements the sticky column decision table:
1158
- *
1159
- * | P | S | T | U | Scenario | Set Preferred | Move To |
1160
- * |---|---|---|---| ---------------------------------------------------- |---------------|-------------|
1161
- * | 0 | * | 0 | - | Start nav, target fits | null | current |
1162
- * | 0 | * | 1 | - | Start nav, target shorter | current | target end |
1163
- * | 1 | 0 | 0 | 0 | Clamped, target fits preferred | null | preferred |
1164
- * | 1 | 0 | 0 | 1 | Clamped, target longer but still can't fit preferred | keep | target end |
1165
- * | 1 | 0 | 1 | - | Clamped, target even shorter | keep | target end |
1166
- * | 1 | 1 | 0 | - | Rewrapped, target fits current | null | current |
1167
- * | 1 | 1 | 1 | - | Rewrapped, target shorter than current | current | target end |
1168
- *
1169
- * Where:
1170
- * - P = preferred col is set
1171
- * - S = cursor in middle of source line (not clamped to end)
1172
- * - T = target line shorter than current visual col
1173
- * - U = target line shorter than preferred col
1174
- */
1175
- computeVerticalMoveColumn(currentVisualCol, sourceMaxVisualCol, targetMaxVisualCol) {
1176
- const hasPreferred = this.preferredVisualCol !== null; // P
1177
- const cursorInMiddle = currentVisualCol < sourceMaxVisualCol; // S
1178
- const targetTooShort = targetMaxVisualCol < currentVisualCol; // T
1179
- if (!hasPreferred || cursorInMiddle) {
1180
- if (targetTooShort) {
1181
- // Cases 2 and 7
1182
- this.preferredVisualCol = currentVisualCol;
1183
- return targetMaxVisualCol;
1184
- }
1185
- // Cases 1 and 6
1186
- this.preferredVisualCol = null;
1187
- return currentVisualCol;
1188
- }
1189
- const targetCantFitPreferred = targetMaxVisualCol < this.preferredVisualCol; // U
1190
- if (targetTooShort || targetCantFitPreferred) {
1191
- // Cases 4 and 5
1192
- return targetMaxVisualCol;
1193
- }
1194
- // Case 3
1195
- const result = this.preferredVisualCol;
1196
- this.preferredVisualCol = null;
1197
- return result;
1198
- }
1199
- moveToLineStart() {
1200
- this.lastAction = null;
1201
- this.setCursorCol(0);
1202
- }
1203
- moveToLineEnd() {
1204
- this.lastAction = null;
1205
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1206
- this.setCursorCol(currentLine.length);
1207
- }
1208
- deleteToStartOfLine() {
1209
- this.historyIndex = -1; // Exit history browsing mode
1210
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1211
- if (this.state.cursorCol > 0) {
1212
- this.pushUndoSnapshot();
1213
- // Calculate text to be deleted and save to kill ring (backward deletion = prepend)
1214
- const deletedText = currentLine.slice(0, this.state.cursorCol);
1215
- this.killRing.push(deletedText, { prepend: true, accumulate: this.lastAction === "kill" });
1216
- this.lastAction = "kill";
1217
- // Delete from start of line up to cursor
1218
- this.state.lines[this.state.cursorLine] = currentLine.slice(this.state.cursorCol);
1219
- this.setCursorCol(0);
1220
- }
1221
- else if (this.state.cursorLine > 0) {
1222
- this.pushUndoSnapshot();
1223
- // At start of line - merge with previous line, treating newline as deleted text
1224
- this.killRing.push("\n", { prepend: true, accumulate: this.lastAction === "kill" });
1225
- this.lastAction = "kill";
1226
- const previousLine = this.state.lines[this.state.cursorLine - 1] || "";
1227
- this.state.lines[this.state.cursorLine - 1] = previousLine + currentLine;
1228
- this.state.lines.splice(this.state.cursorLine, 1);
1229
- this.state.cursorLine--;
1230
- this.setCursorCol(previousLine.length);
1231
- }
1232
- if (this.onChange) {
1233
- this.onChange(this.getText());
1234
- }
1235
- }
1236
- deleteToEndOfLine() {
1237
- this.historyIndex = -1; // Exit history browsing mode
1238
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1239
- if (this.state.cursorCol < currentLine.length) {
1240
- this.pushUndoSnapshot();
1241
- // Calculate text to be deleted and save to kill ring (forward deletion = append)
1242
- const deletedText = currentLine.slice(this.state.cursorCol);
1243
- this.killRing.push(deletedText, { prepend: false, accumulate: this.lastAction === "kill" });
1244
- this.lastAction = "kill";
1245
- // Delete from cursor to end of line
1246
- this.state.lines[this.state.cursorLine] = currentLine.slice(0, this.state.cursorCol);
1247
- }
1248
- else if (this.state.cursorLine < this.state.lines.length - 1) {
1249
- this.pushUndoSnapshot();
1250
- // At end of line - merge with next line, treating newline as deleted text
1251
- this.killRing.push("\n", { prepend: false, accumulate: this.lastAction === "kill" });
1252
- this.lastAction = "kill";
1253
- const nextLine = this.state.lines[this.state.cursorLine + 1] || "";
1254
- this.state.lines[this.state.cursorLine] = currentLine + nextLine;
1255
- this.state.lines.splice(this.state.cursorLine + 1, 1);
1256
- }
1257
- if (this.onChange) {
1258
- this.onChange(this.getText());
1259
- }
1260
- }
1261
- deleteWordBackwards() {
1262
- this.historyIndex = -1; // Exit history browsing mode
1263
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1264
- // If at start of line, behave like backspace at column 0 (merge with previous line)
1265
- if (this.state.cursorCol === 0) {
1266
- if (this.state.cursorLine > 0) {
1267
- this.pushUndoSnapshot();
1268
- // Treat newline as deleted text (backward deletion = prepend)
1269
- this.killRing.push("\n", { prepend: true, accumulate: this.lastAction === "kill" });
1270
- this.lastAction = "kill";
1271
- const previousLine = this.state.lines[this.state.cursorLine - 1] || "";
1272
- this.state.lines[this.state.cursorLine - 1] = previousLine + currentLine;
1273
- this.state.lines.splice(this.state.cursorLine, 1);
1274
- this.state.cursorLine--;
1275
- this.setCursorCol(previousLine.length);
1276
- }
1277
- }
1278
- else {
1279
- this.pushUndoSnapshot();
1280
- // Save lastAction before cursor movement (moveWordBackwards resets it)
1281
- const wasKill = this.lastAction === "kill";
1282
- const oldCursorCol = this.state.cursorCol;
1283
- this.moveWordBackwards();
1284
- const deleteFrom = this.state.cursorCol;
1285
- this.setCursorCol(oldCursorCol);
1286
- const deletedText = currentLine.slice(deleteFrom, this.state.cursorCol);
1287
- this.killRing.push(deletedText, { prepend: true, accumulate: wasKill });
1288
- this.lastAction = "kill";
1289
- this.state.lines[this.state.cursorLine] =
1290
- currentLine.slice(0, deleteFrom) + currentLine.slice(this.state.cursorCol);
1291
- this.setCursorCol(deleteFrom);
1292
- }
1293
- if (this.onChange) {
1294
- this.onChange(this.getText());
1295
- }
1296
- }
1297
- deleteWordForward() {
1298
- this.historyIndex = -1; // Exit history browsing mode
1299
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1300
- // If at end of line, merge with next line (delete the newline)
1301
- if (this.state.cursorCol >= currentLine.length) {
1302
- if (this.state.cursorLine < this.state.lines.length - 1) {
1303
- this.pushUndoSnapshot();
1304
- // Treat newline as deleted text (forward deletion = append)
1305
- this.killRing.push("\n", { prepend: false, accumulate: this.lastAction === "kill" });
1306
- this.lastAction = "kill";
1307
- const nextLine = this.state.lines[this.state.cursorLine + 1] || "";
1308
- this.state.lines[this.state.cursorLine] = currentLine + nextLine;
1309
- this.state.lines.splice(this.state.cursorLine + 1, 1);
1310
- }
1311
- }
1312
- else {
1313
- this.pushUndoSnapshot();
1314
- // Save lastAction before cursor movement (moveWordForwards resets it)
1315
- const wasKill = this.lastAction === "kill";
1316
- const oldCursorCol = this.state.cursorCol;
1317
- this.moveWordForwards();
1318
- const deleteTo = this.state.cursorCol;
1319
- this.setCursorCol(oldCursorCol);
1320
- const deletedText = currentLine.slice(this.state.cursorCol, deleteTo);
1321
- this.killRing.push(deletedText, { prepend: false, accumulate: wasKill });
1322
- this.lastAction = "kill";
1323
- this.state.lines[this.state.cursorLine] =
1324
- currentLine.slice(0, this.state.cursorCol) + currentLine.slice(deleteTo);
1325
- }
1326
- if (this.onChange) {
1327
- this.onChange(this.getText());
1328
- }
1329
- }
1330
- handleForwardDelete() {
1331
- this.historyIndex = -1; // Exit history browsing mode
1332
- this.lastAction = null;
1333
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1334
- if (this.state.cursorCol < currentLine.length) {
1335
- this.pushUndoSnapshot();
1336
- // Delete grapheme at cursor position (handles emojis, combining characters, etc.)
1337
- const afterCursor = currentLine.slice(this.state.cursorCol);
1338
- // Find the first grapheme at cursor
1339
- const graphemes = [...this.segment(afterCursor, "grapheme")];
1340
- const firstGrapheme = graphemes[0];
1341
- const graphemeLength = firstGrapheme ? firstGrapheme.segment.length : 1;
1342
- const before = currentLine.slice(0, this.state.cursorCol);
1343
- const after = currentLine.slice(this.state.cursorCol + graphemeLength);
1344
- this.state.lines[this.state.cursorLine] = before + after;
1345
- }
1346
- else if (this.state.cursorLine < this.state.lines.length - 1) {
1347
- this.pushUndoSnapshot();
1348
- // At end of line - merge with next line
1349
- const nextLine = this.state.lines[this.state.cursorLine + 1] || "";
1350
- this.state.lines[this.state.cursorLine] = currentLine + nextLine;
1351
- this.state.lines.splice(this.state.cursorLine + 1, 1);
1352
- }
1353
- if (this.onChange) {
1354
- this.onChange(this.getText());
1355
- }
1356
- // Update or re-trigger autocomplete after forward delete
1357
- if (this.autocompleteState) {
1358
- this.updateAutocomplete();
1359
- }
1360
- else {
1361
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1362
- const textBeforeCursor = currentLine.slice(0, this.state.cursorCol);
1363
- // Slash command context
1364
- if (this.isInSlashCommandContext(textBeforeCursor)) {
1365
- this.tryTriggerAutocomplete();
1366
- }
1367
- // Symbol-based completion context like @ or #
1368
- else if (textBeforeCursor.match(/(?:^|[\s])[@#][^\s]*$/)) {
1369
- this.tryTriggerAutocomplete();
1370
- }
1371
- }
1372
- }
1373
- /**
1374
- * Build a mapping from visual lines to logical positions.
1375
- * Returns an array where each element represents a visual line with:
1376
- * - logicalLine: index into this.state.lines
1377
- * - startCol: starting column in the logical line
1378
- * - length: length of this visual line segment
1379
- */
1380
- buildVisualLineMap(width) {
1381
- const visualLines = [];
1382
- for (let i = 0; i < this.state.lines.length; i++) {
1383
- const line = this.state.lines[i] || "";
1384
- const lineVisWidth = visibleWidth(line);
1385
- if (line.length === 0) {
1386
- // Empty line still takes one visual line
1387
- visualLines.push({ logicalLine: i, startCol: 0, length: 0 });
1388
- }
1389
- else if (lineVisWidth <= width) {
1390
- visualLines.push({ logicalLine: i, startCol: 0, length: line.length });
1391
- }
1392
- else {
1393
- // Line needs wrapping - use word-aware wrapping
1394
- const chunks = wordWrapLine(line, width, [...this.segment(line, "grapheme")]);
1395
- for (const chunk of chunks) {
1396
- visualLines.push({
1397
- logicalLine: i,
1398
- startCol: chunk.startIndex,
1399
- length: chunk.endIndex - chunk.startIndex,
1400
- });
1401
- }
1402
- }
1403
- }
1404
- return visualLines;
1405
- }
1406
- /**
1407
- * Find the visual line index that contains the given logical position.
1408
- */
1409
- findVisualLineAt(visualLines, line, col) {
1410
- for (let i = 0; i < visualLines.length; i++) {
1411
- const vl = visualLines[i];
1412
- if (!vl || vl.logicalLine !== line)
1413
- continue;
1414
- const offset = col - vl.startCol;
1415
- // Cursor is in this segment if it's within range. For the last
1416
- // segment of a logical line, cursor can be at length (end position)
1417
- const isLastSegmentOfLine = i === visualLines.length - 1 || visualLines[i + 1]?.logicalLine !== vl.logicalLine;
1418
- if (offset >= 0 && (offset < vl.length || (isLastSegmentOfLine && offset === vl.length))) {
1419
- return i;
1420
- }
1421
- }
1422
- return visualLines.length - 1;
1423
- }
1424
- /**
1425
- * Find the visual line index for the current cursor position.
1426
- */
1427
- findCurrentVisualLine(visualLines) {
1428
- return this.findVisualLineAt(visualLines, this.state.cursorLine, this.state.cursorCol);
1429
- }
1430
- moveCursor(deltaLine, deltaCol) {
1431
- this.lastAction = null;
1432
- const visualLines = this.buildVisualLineMap(this.lastWidth);
1433
- const currentVisualLine = this.findCurrentVisualLine(visualLines);
1434
- if (deltaLine !== 0) {
1435
- const targetVisualLine = currentVisualLine + deltaLine;
1436
- if (targetVisualLine >= 0 && targetVisualLine < visualLines.length) {
1437
- this.moveToVisualLine(visualLines, currentVisualLine, targetVisualLine);
1438
- }
1439
- }
1440
- if (deltaCol !== 0) {
1441
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1442
- if (deltaCol > 0) {
1443
- // Moving right - move by one grapheme (handles emojis, combining characters, etc.)
1444
- if (this.state.cursorCol < currentLine.length) {
1445
- const afterCursor = currentLine.slice(this.state.cursorCol);
1446
- const graphemes = [...this.segment(afterCursor, "grapheme")];
1447
- const firstGrapheme = graphemes[0];
1448
- this.setCursorCol(this.state.cursorCol + (firstGrapheme ? firstGrapheme.segment.length : 1));
1449
- }
1450
- else if (this.state.cursorLine < this.state.lines.length - 1) {
1451
- // Wrap to start of next logical line
1452
- this.state.cursorLine++;
1453
- this.setCursorCol(0);
1454
- }
1455
- else {
1456
- // At end of last line - can't move, but set preferredVisualCol for up/down navigation
1457
- const currentVL = visualLines[currentVisualLine];
1458
- if (currentVL) {
1459
- this.preferredVisualCol = this.state.cursorCol - currentVL.startCol;
1460
- }
1461
- }
1462
- }
1463
- else {
1464
- // Moving left - move by one grapheme (handles emojis, combining characters, etc.)
1465
- if (this.state.cursorCol > 0) {
1466
- const beforeCursor = currentLine.slice(0, this.state.cursorCol);
1467
- const graphemes = [...this.segment(beforeCursor, "grapheme")];
1468
- const lastGrapheme = graphemes[graphemes.length - 1];
1469
- this.setCursorCol(this.state.cursorCol - (lastGrapheme ? lastGrapheme.segment.length : 1));
1470
- }
1471
- else if (this.state.cursorLine > 0) {
1472
- // Wrap to end of previous logical line
1473
- this.state.cursorLine--;
1474
- const prevLine = this.state.lines[this.state.cursorLine] || "";
1475
- this.setCursorCol(prevLine.length);
1476
- }
1477
- }
1478
- }
1479
- }
1480
- /**
1481
- * Scroll by a page (direction: -1 for up, 1 for down).
1482
- * Moves cursor by the page size while keeping it in bounds.
1483
- */
1484
- pageScroll(direction) {
1485
- this.lastAction = null;
1486
- const terminalRows = this.tui.terminal.rows;
1487
- const pageSize = Math.max(5, Math.floor(terminalRows * 0.3));
1488
- const visualLines = this.buildVisualLineMap(this.lastWidth);
1489
- const currentVisualLine = this.findCurrentVisualLine(visualLines);
1490
- const targetVisualLine = Math.max(0, Math.min(visualLines.length - 1, currentVisualLine + direction * pageSize));
1491
- this.moveToVisualLine(visualLines, currentVisualLine, targetVisualLine);
1492
- }
1493
- moveWordBackwards() {
1494
- this.lastAction = null;
1495
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1496
- // If at start of line, move to end of previous line
1497
- if (this.state.cursorCol === 0) {
1498
- if (this.state.cursorLine > 0) {
1499
- this.state.cursorLine--;
1500
- const prevLine = this.state.lines[this.state.cursorLine] || "";
1501
- this.setCursorCol(prevLine.length);
1502
- }
1503
- return;
1504
- }
1505
- this.setCursorCol(findWordBackward(currentLine, this.state.cursorCol, {
1506
- segment: (text) => this.segment(text, "word"),
1507
- isAtomicSegment: isPasteMarker,
1508
- }));
1509
- }
1510
- /**
1511
- * Yank (paste) the most recent kill ring entry at cursor position.
1512
- */
1513
- yank() {
1514
- if (this.killRing.length === 0)
1515
- return;
1516
- this.pushUndoSnapshot();
1517
- const text = this.killRing.peek();
1518
- this.insertYankedText(text);
1519
- this.lastAction = "yank";
1520
- }
1521
- /**
1522
- * Cycle through kill ring (only works immediately after yank or yank-pop).
1523
- * Replaces the last yanked text with the previous entry in the ring.
1524
- */
1525
- yankPop() {
1526
- // Only works if we just yanked and have more than one entry
1527
- if (this.lastAction !== "yank" || this.killRing.length <= 1)
1528
- return;
1529
- this.pushUndoSnapshot();
1530
- // Delete the previously yanked text (still at end of ring before rotation)
1531
- this.deleteYankedText();
1532
- // Rotate the ring: move end to front
1533
- this.killRing.rotate();
1534
- // Insert the new most recent entry (now at end after rotation)
1535
- const text = this.killRing.peek();
1536
- this.insertYankedText(text);
1537
- this.lastAction = "yank";
1538
- }
1539
- /**
1540
- * Insert text at cursor position (used by yank operations).
1541
- */
1542
- insertYankedText(text) {
1543
- this.historyIndex = -1; // Exit history browsing mode
1544
- const lines = text.split("\n");
1545
- if (lines.length === 1) {
1546
- // Single line - insert at cursor
1547
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1548
- const before = currentLine.slice(0, this.state.cursorCol);
1549
- const after = currentLine.slice(this.state.cursorCol);
1550
- this.state.lines[this.state.cursorLine] = before + text + after;
1551
- this.setCursorCol(this.state.cursorCol + text.length);
1552
- }
1553
- else {
1554
- // Multi-line insert
1555
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1556
- const before = currentLine.slice(0, this.state.cursorCol);
1557
- const after = currentLine.slice(this.state.cursorCol);
1558
- // First line merges with text before cursor
1559
- this.state.lines[this.state.cursorLine] = before + (lines[0] || "");
1560
- // Insert middle lines
1561
- for (let i = 1; i < lines.length - 1; i++) {
1562
- this.state.lines.splice(this.state.cursorLine + i, 0, lines[i] || "");
1563
- }
1564
- // Last line merges with text after cursor
1565
- const lastLineIndex = this.state.cursorLine + lines.length - 1;
1566
- this.state.lines.splice(lastLineIndex, 0, (lines[lines.length - 1] || "") + after);
1567
- // Update cursor position
1568
- this.state.cursorLine = lastLineIndex;
1569
- this.setCursorCol((lines[lines.length - 1] || "").length);
1570
- }
1571
- if (this.onChange) {
1572
- this.onChange(this.getText());
1573
- }
1574
- }
1575
- /**
1576
- * Delete the previously yanked text (used by yank-pop).
1577
- * The yanked text is derived from killRing[end] since it hasn't been rotated yet.
1578
- */
1579
- deleteYankedText() {
1580
- const yankedText = this.killRing.peek();
1581
- if (!yankedText)
1582
- return;
1583
- const yankLines = yankedText.split("\n");
1584
- if (yankLines.length === 1) {
1585
- // Single line - delete backward from cursor
1586
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1587
- const deleteLen = yankedText.length;
1588
- const before = currentLine.slice(0, this.state.cursorCol - deleteLen);
1589
- const after = currentLine.slice(this.state.cursorCol);
1590
- this.state.lines[this.state.cursorLine] = before + after;
1591
- this.setCursorCol(this.state.cursorCol - deleteLen);
1592
- }
1593
- else {
1594
- // Multi-line delete - cursor is at end of last yanked line
1595
- const startLine = this.state.cursorLine - (yankLines.length - 1);
1596
- const startCol = (this.state.lines[startLine] || "").length - (yankLines[0] || "").length;
1597
- // Get text after cursor on current line
1598
- const afterCursor = (this.state.lines[this.state.cursorLine] || "").slice(this.state.cursorCol);
1599
- // Get text before yank start position
1600
- const beforeYank = (this.state.lines[startLine] || "").slice(0, startCol);
1601
- // Remove all lines from startLine to cursorLine and replace with merged line
1602
- this.state.lines.splice(startLine, yankLines.length, beforeYank + afterCursor);
1603
- // Update cursor
1604
- this.state.cursorLine = startLine;
1605
- this.setCursorCol(startCol);
1606
- }
1607
- if (this.onChange) {
1608
- this.onChange(this.getText());
1609
- }
1610
- }
1611
- pushUndoSnapshot() {
1612
- this.undoStack.push(this.state);
1613
- }
1614
- undo() {
1615
- this.historyIndex = -1; // Exit history browsing mode
1616
- const snapshot = this.undoStack.pop();
1617
- if (!snapshot)
1618
- return;
1619
- Object.assign(this.state, snapshot);
1620
- this.lastAction = null;
1621
- this.preferredVisualCol = null;
1622
- if (this.onChange) {
1623
- this.onChange(this.getText());
1624
- }
1625
- }
1626
- /**
1627
- * Jump to the first occurrence of a character in the specified direction.
1628
- * Multi-line search. Case-sensitive. Skips the current cursor position.
1629
- */
1630
- jumpToChar(char, direction) {
1631
- this.lastAction = null;
1632
- const isForward = direction === "forward";
1633
- const lines = this.state.lines;
1634
- const end = isForward ? lines.length : -1;
1635
- const step = isForward ? 1 : -1;
1636
- for (let lineIdx = this.state.cursorLine; lineIdx !== end; lineIdx += step) {
1637
- const line = lines[lineIdx] || "";
1638
- const isCurrentLine = lineIdx === this.state.cursorLine;
1639
- // Current line: start after/before cursor; other lines: search full line
1640
- const searchFrom = isCurrentLine
1641
- ? isForward
1642
- ? this.state.cursorCol + 1
1643
- : this.state.cursorCol - 1
1644
- : undefined;
1645
- const idx = isForward ? line.indexOf(char, searchFrom) : line.lastIndexOf(char, searchFrom);
1646
- if (idx !== -1) {
1647
- this.state.cursorLine = lineIdx;
1648
- this.setCursorCol(idx);
1649
- return;
1650
- }
1651
- }
1652
- // No match found - cursor stays in place
1653
- }
1654
- moveWordForwards() {
1655
- this.lastAction = null;
1656
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1657
- // If at end of line, move to start of next line
1658
- if (this.state.cursorCol >= currentLine.length) {
1659
- if (this.state.cursorLine < this.state.lines.length - 1) {
1660
- this.state.cursorLine++;
1661
- this.setCursorCol(0);
1662
- }
1663
- return;
1664
- }
1665
- this.setCursorCol(findWordForward(currentLine, this.state.cursorCol, {
1666
- segment: (text) => this.segment(text, "word"),
1667
- isAtomicSegment: isPasteMarker,
1668
- }));
1669
- }
1670
- // Slash menu only allowed on the first line of the editor
1671
- isSlashMenuAllowed() {
1672
- return this.state.cursorLine === 0;
1673
- }
1674
- // Helper method to check if cursor is at start of message (for slash command detection)
1675
- isAtStartOfMessage() {
1676
- if (!this.isSlashMenuAllowed())
1677
- return false;
1678
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1679
- const beforeCursor = currentLine.slice(0, this.state.cursorCol);
1680
- return beforeCursor.trim() === "" || beforeCursor.trim() === "/";
1681
- }
1682
- isInSlashCommandContext(textBeforeCursor) {
1683
- return this.isSlashMenuAllowed() && textBeforeCursor.trimStart().startsWith("/");
1684
- }
1685
- // Autocomplete methods
1686
- /**
1687
- * Find the best autocomplete item index for the given prefix.
1688
- * Returns -1 if no match is found.
1689
- *
1690
- * Match priority:
1691
- * 1. Exact match (prefix === item.value) -> always selected
1692
- * 2. Prefix match -> first item whose value starts with prefix
1693
- * 3. No match -> -1 (keep default highlight)
1694
- *
1695
- * Matching is case-sensitive and checks item.value only.
1696
- */
1697
- getBestAutocompleteMatchIndex(items, prefix) {
1698
- if (!prefix)
1699
- return -1;
1700
- let firstPrefixIndex = -1;
1701
- for (let i = 0; i < items.length; i++) {
1702
- const value = items[i].value;
1703
- if (value === prefix) {
1704
- return i; // Exact match always wins
1705
- }
1706
- if (firstPrefixIndex === -1 && value.startsWith(prefix)) {
1707
- firstPrefixIndex = i;
1708
- }
1709
- }
1710
- return firstPrefixIndex;
1711
- }
1712
- createAutocompleteList(prefix, items) {
1713
- const layout = prefix.startsWith("/") ? SLASH_COMMAND_SELECT_LIST_LAYOUT : undefined;
1714
- return new SelectList(items, this.autocompleteMaxVisible, this.theme.selectList, layout);
1715
- }
1716
- tryTriggerAutocomplete(explicitTab = false) {
1717
- this.requestAutocomplete({ force: false, explicitTab });
1718
- }
1719
- handleTabCompletion() {
1720
- if (!this.autocompleteProvider)
1721
- return;
1722
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1723
- const beforeCursor = currentLine.slice(0, this.state.cursorCol);
1724
- if (this.isInSlashCommandContext(beforeCursor) && !beforeCursor.trimStart().includes(" ")) {
1725
- this.handleSlashCommandCompletion();
1726
- }
1727
- else {
1728
- this.forceFileAutocomplete(true);
1729
- }
1730
- }
1731
- handleSlashCommandCompletion() {
1732
- this.requestAutocomplete({ force: false, explicitTab: true });
1733
- }
1734
- forceFileAutocomplete(explicitTab = false) {
1735
- this.requestAutocomplete({ force: true, explicitTab });
1736
- }
1737
- requestAutocomplete(options) {
1738
- if (!this.autocompleteProvider)
1739
- return;
1740
- if (options.force) {
1741
- const shouldTrigger = !this.autocompleteProvider.shouldTriggerFileCompletion ||
1742
- this.autocompleteProvider.shouldTriggerFileCompletion(this.state.lines, this.state.cursorLine, this.state.cursorCol);
1743
- if (!shouldTrigger) {
1744
- return;
1745
- }
1746
- }
1747
- this.cancelAutocompleteRequest();
1748
- const startToken = ++this.autocompleteStartToken;
1749
- const debounceMs = this.getAutocompleteDebounceMs(options);
1750
- if (debounceMs > 0) {
1751
- this.autocompleteDebounceTimer = setTimeout(() => {
1752
- this.autocompleteDebounceTimer = undefined;
1753
- void this.startAutocompleteRequest(startToken, options);
1754
- }, debounceMs);
1755
- return;
1756
- }
1757
- void this.startAutocompleteRequest(startToken, options);
1758
- }
1759
- async startAutocompleteRequest(startToken, options) {
1760
- const previousTask = this.autocompleteRequestTask;
1761
- this.autocompleteRequestTask = (async () => {
1762
- await previousTask;
1763
- if (startToken !== this.autocompleteStartToken || !this.autocompleteProvider) {
1764
- return;
1765
- }
1766
- const controller = new AbortController();
1767
- this.autocompleteAbort = controller;
1768
- const requestId = ++this.autocompleteRequestId;
1769
- const snapshotText = this.getText();
1770
- const snapshotLine = this.state.cursorLine;
1771
- const snapshotCol = this.state.cursorCol;
1772
- await this.runAutocompleteRequest(requestId, controller, snapshotText, snapshotLine, snapshotCol, options);
1773
- })();
1774
- await this.autocompleteRequestTask;
1775
- }
1776
- getAutocompleteDebounceMs(options) {
1777
- if (options.explicitTab || options.force) {
1778
- return 0;
1779
- }
1780
- const currentLine = this.state.lines[this.state.cursorLine] || "";
1781
- const textBeforeCursor = currentLine.slice(0, this.state.cursorCol);
1782
- const isSymbolAutocompleteContext = /(?:^|[ \t])(?:@(?:"[^"]*|[^\s]*)|#[^\s]*)$/.test(textBeforeCursor);
1783
- return isSymbolAutocompleteContext ? ATTACHMENT_AUTOCOMPLETE_DEBOUNCE_MS : 0;
1784
- }
1785
- async runAutocompleteRequest(requestId, controller, snapshotText, snapshotLine, snapshotCol, options) {
1786
- if (!this.autocompleteProvider)
1787
- return;
1788
- const suggestions = await this.autocompleteProvider.getSuggestions(this.state.lines, this.state.cursorLine, this.state.cursorCol, { signal: controller.signal, force: options.force });
1789
- if (!this.isAutocompleteRequestCurrent(requestId, controller, snapshotText, snapshotLine, snapshotCol)) {
1790
- return;
1791
- }
1792
- this.autocompleteAbort = undefined;
1793
- if (!suggestions || !Array.isArray(suggestions.items) || suggestions.items.length === 0) {
1794
- this.cancelAutocomplete();
1795
- this.tui.requestRender();
1796
- return;
1797
- }
1798
- if (options.force && options.explicitTab && suggestions.items.length === 1) {
1799
- const item = suggestions.items[0];
1800
- this.pushUndoSnapshot();
1801
- this.lastAction = null;
1802
- const result = this.autocompleteProvider.applyCompletion(this.state.lines, this.state.cursorLine, this.state.cursorCol, item, suggestions.prefix);
1803
- this.state.lines = result.lines;
1804
- this.state.cursorLine = result.cursorLine;
1805
- this.setCursorCol(result.cursorCol);
1806
- if (this.onChange)
1807
- this.onChange(this.getText());
1808
- this.tui.requestRender();
1809
- return;
1810
- }
1811
- this.applyAutocompleteSuggestions(suggestions, options.force ? "force" : "regular");
1812
- this.tui.requestRender();
1813
- }
1814
- isAutocompleteRequestCurrent(requestId, controller, snapshotText, snapshotLine, snapshotCol) {
1815
- return (!controller.signal.aborted &&
1816
- requestId === this.autocompleteRequestId &&
1817
- this.getText() === snapshotText &&
1818
- this.state.cursorLine === snapshotLine &&
1819
- this.state.cursorCol === snapshotCol);
1820
- }
1821
- applyAutocompleteSuggestions(suggestions, state) {
1822
- this.autocompletePrefix = suggestions.prefix;
1823
- this.autocompleteList = this.createAutocompleteList(suggestions.prefix, suggestions.items);
1824
- const bestMatchIndex = this.getBestAutocompleteMatchIndex(suggestions.items, suggestions.prefix);
1825
- if (bestMatchIndex >= 0) {
1826
- this.autocompleteList.setSelectedIndex(bestMatchIndex);
1827
- }
1828
- this.autocompleteState = state;
1829
- }
1830
- cancelAutocompleteRequest() {
1831
- this.autocompleteStartToken += 1;
1832
- if (this.autocompleteDebounceTimer) {
1833
- clearTimeout(this.autocompleteDebounceTimer);
1834
- this.autocompleteDebounceTimer = undefined;
1835
- }
1836
- this.autocompleteAbort?.abort();
1837
- this.autocompleteAbort = undefined;
1838
- }
1839
- clearAutocompleteUi() {
1840
- this.autocompleteState = null;
1841
- this.autocompleteList = undefined;
1842
- this.autocompletePrefix = "";
1843
- }
1844
- cancelAutocomplete() {
1845
- this.cancelAutocompleteRequest();
1846
- this.clearAutocompleteUi();
1847
- }
1848
- isShowingAutocomplete() {
1849
- return this.autocompleteState !== null;
1850
- }
1851
- updateAutocomplete() {
1852
- if (!this.autocompleteState || !this.autocompleteProvider)
1853
- return;
1854
- this.requestAutocomplete({ force: this.autocompleteState === "force", explicitTab: false });
1855
- }
1856
- }
1857
- //# sourceMappingURL=editor.js.map