@astralyn/pi 0.81.1-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1065) hide show
  1. package/CHANGELOG.md +5113 -0
  2. package/README.md +677 -0
  3. package/dist/bun/cli.d.ts +3 -0
  4. package/dist/bun/cli.d.ts.map +1 -0
  5. package/dist/bun/cli.js +11 -0
  6. package/dist/bun/cli.js.map +1 -0
  7. package/dist/bun/register-bedrock.d.ts +2 -0
  8. package/dist/bun/register-bedrock.d.ts.map +1 -0
  9. package/dist/bun/register-bedrock.js +4 -0
  10. package/dist/bun/register-bedrock.js.map +1 -0
  11. package/dist/bun/restore-sandbox-env.d.ts +17 -0
  12. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  13. package/dist/bun/restore-sandbox-env.js +36 -0
  14. package/dist/bun/restore-sandbox-env.js.map +1 -0
  15. package/dist/cli/args.d.ts +57 -0
  16. package/dist/cli/args.d.ts.map +1 -0
  17. package/dist/cli/args.js +381 -0
  18. package/dist/cli/args.js.map +1 -0
  19. package/dist/cli/config-selector.d.ts +16 -0
  20. package/dist/cli/config-selector.d.ts.map +1 -0
  21. package/dist/cli/config-selector.js +31 -0
  22. package/dist/cli/config-selector.js.map +1 -0
  23. package/dist/cli/file-processor.d.ts +15 -0
  24. package/dist/cli/file-processor.d.ts.map +1 -0
  25. package/dist/cli/file-processor.js +70 -0
  26. package/dist/cli/file-processor.js.map +1 -0
  27. package/dist/cli/initial-message.d.ts +18 -0
  28. package/dist/cli/initial-message.d.ts.map +1 -0
  29. package/dist/cli/initial-message.js +22 -0
  30. package/dist/cli/initial-message.js.map +1 -0
  31. package/dist/cli/list-models.d.ts +9 -0
  32. package/dist/cli/list-models.d.ts.map +1 -0
  33. package/dist/cli/list-models.js +98 -0
  34. package/dist/cli/list-models.js.map +1 -0
  35. package/dist/cli/project-trust.d.ts +10 -0
  36. package/dist/cli/project-trust.d.ts.map +1 -0
  37. package/dist/cli/project-trust.js +48 -0
  38. package/dist/cli/project-trust.js.map +1 -0
  39. package/dist/cli/session-picker.d.ts +10 -0
  40. package/dist/cli/session-picker.d.ts.map +1 -0
  41. package/dist/cli/session-picker.js +36 -0
  42. package/dist/cli/session-picker.js.map +1 -0
  43. package/dist/cli/startup-ui.d.ts +20 -0
  44. package/dist/cli/startup-ui.d.ts.map +1 -0
  45. package/dist/cli/startup-ui.js +184 -0
  46. package/dist/cli/startup-ui.js.map +1 -0
  47. package/dist/cli.d.ts +3 -0
  48. package/dist/cli.d.ts.map +1 -0
  49. package/dist/cli.js +18 -0
  50. package/dist/cli.js.map +1 -0
  51. package/dist/config.d.ts +96 -0
  52. package/dist/config.d.ts.map +1 -0
  53. package/dist/config.js +455 -0
  54. package/dist/config.js.map +1 -0
  55. package/dist/core/agent-session-runtime.d.ts +119 -0
  56. package/dist/core/agent-session-runtime.d.ts.map +1 -0
  57. package/dist/core/agent-session-runtime.js +306 -0
  58. package/dist/core/agent-session-runtime.js.map +1 -0
  59. package/dist/core/agent-session-services.d.ts +85 -0
  60. package/dist/core/agent-session-services.d.ts.map +1 -0
  61. package/dist/core/agent-session-services.js +133 -0
  62. package/dist/core/agent-session-services.js.map +1 -0
  63. package/dist/core/agent-session.d.ts +642 -0
  64. package/dist/core/agent-session.d.ts.map +1 -0
  65. package/dist/core/agent-session.js +2679 -0
  66. package/dist/core/agent-session.js.map +1 -0
  67. package/dist/core/auth-guidance.d.ts +5 -0
  68. package/dist/core/auth-guidance.d.ts.map +1 -0
  69. package/dist/core/auth-guidance.js +21 -0
  70. package/dist/core/auth-guidance.js.map +1 -0
  71. package/dist/core/auth-storage.d.ts +56 -0
  72. package/dist/core/auth-storage.d.ts.map +1 -0
  73. package/dist/core/auth-storage.js +229 -0
  74. package/dist/core/auth-storage.js.map +1 -0
  75. package/dist/core/bash-executor.d.ts +32 -0
  76. package/dist/core/bash-executor.d.ts.map +1 -0
  77. package/dist/core/bash-executor.js +111 -0
  78. package/dist/core/bash-executor.js.map +1 -0
  79. package/dist/core/cache-stats.d.ts +49 -0
  80. package/dist/core/cache-stats.d.ts.map +1 -0
  81. package/dist/core/cache-stats.js +101 -0
  82. package/dist/core/cache-stats.js.map +1 -0
  83. package/dist/core/compaction/branch-summarization.d.ts +98 -0
  84. package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  85. package/dist/core/compaction/branch-summarization.js +246 -0
  86. package/dist/core/compaction/branch-summarization.js.map +1 -0
  87. package/dist/core/compaction/compaction.d.ts +137 -0
  88. package/dist/core/compaction/compaction.d.ts.map +1 -0
  89. package/dist/core/compaction/compaction.js +637 -0
  90. package/dist/core/compaction/compaction.js.map +1 -0
  91. package/dist/core/compaction/index.d.ts +7 -0
  92. package/dist/core/compaction/index.d.ts.map +1 -0
  93. package/dist/core/compaction/index.js +7 -0
  94. package/dist/core/compaction/index.js.map +1 -0
  95. package/dist/core/compaction/utils.d.ts +38 -0
  96. package/dist/core/compaction/utils.d.ts.map +1 -0
  97. package/dist/core/compaction/utils.js +142 -0
  98. package/dist/core/compaction/utils.js.map +1 -0
  99. package/dist/core/defaults.d.ts +3 -0
  100. package/dist/core/defaults.d.ts.map +1 -0
  101. package/dist/core/defaults.js +2 -0
  102. package/dist/core/defaults.js.map +1 -0
  103. package/dist/core/diagnostics.d.ts +15 -0
  104. package/dist/core/diagnostics.d.ts.map +1 -0
  105. package/dist/core/diagnostics.js +2 -0
  106. package/dist/core/diagnostics.js.map +1 -0
  107. package/dist/core/event-bus.d.ts +9 -0
  108. package/dist/core/event-bus.d.ts.map +1 -0
  109. package/dist/core/event-bus.js +25 -0
  110. package/dist/core/event-bus.js.map +1 -0
  111. package/dist/core/exec.d.ts +29 -0
  112. package/dist/core/exec.d.ts.map +1 -0
  113. package/dist/core/exec.js +75 -0
  114. package/dist/core/exec.js.map +1 -0
  115. package/dist/core/experimental.d.ts +2 -0
  116. package/dist/core/experimental.d.ts.map +1 -0
  117. package/dist/core/experimental.js +4 -0
  118. package/dist/core/experimental.js.map +1 -0
  119. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  120. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  121. package/dist/core/export-html/ansi-to-html.js +249 -0
  122. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  123. package/dist/core/export-html/index.d.ts +37 -0
  124. package/dist/core/export-html/index.d.ts.map +1 -0
  125. package/dist/core/export-html/index.js +226 -0
  126. package/dist/core/export-html/index.js.map +1 -0
  127. package/dist/core/export-html/template.css +1066 -0
  128. package/dist/core/export-html/template.html +55 -0
  129. package/dist/core/export-html/template.js +1864 -0
  130. package/dist/core/export-html/tool-renderer.d.ts +34 -0
  131. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  132. package/dist/core/export-html/tool-renderer.js +108 -0
  133. package/dist/core/export-html/tool-renderer.js.map +1 -0
  134. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  135. package/dist/core/export-html/vendor/marked.min.js +78 -0
  136. package/dist/core/extensions/index.d.ts +12 -0
  137. package/dist/core/extensions/index.d.ts.map +1 -0
  138. package/dist/core/extensions/index.js +9 -0
  139. package/dist/core/extensions/index.js.map +1 -0
  140. package/dist/core/extensions/loader.d.ts +23 -0
  141. package/dist/core/extensions/loader.d.ts.map +1 -0
  142. package/dist/core/extensions/loader.js +558 -0
  143. package/dist/core/extensions/loader.js.map +1 -0
  144. package/dist/core/extensions/runner.d.ts +171 -0
  145. package/dist/core/extensions/runner.d.ts.map +1 -0
  146. package/dist/core/extensions/runner.js +953 -0
  147. package/dist/core/extensions/runner.js.map +1 -0
  148. package/dist/core/extensions/types.d.ts +1259 -0
  149. package/dist/core/extensions/types.d.ts.map +1 -0
  150. package/dist/core/extensions/types.js +45 -0
  151. package/dist/core/extensions/types.js.map +1 -0
  152. package/dist/core/extensions/wrapper.d.ts +20 -0
  153. package/dist/core/extensions/wrapper.d.ts.map +1 -0
  154. package/dist/core/extensions/wrapper.js +41 -0
  155. package/dist/core/extensions/wrapper.js.map +1 -0
  156. package/dist/core/footer-data-provider.d.ts +54 -0
  157. package/dist/core/footer-data-provider.d.ts.map +1 -0
  158. package/dist/core/footer-data-provider.js +338 -0
  159. package/dist/core/footer-data-provider.js.map +1 -0
  160. package/dist/core/http-dispatcher.d.ts +22 -0
  161. package/dist/core/http-dispatcher.d.ts.map +1 -0
  162. package/dist/core/http-dispatcher.js +91 -0
  163. package/dist/core/http-dispatcher.js.map +1 -0
  164. package/dist/core/index.d.ts +13 -0
  165. package/dist/core/index.d.ts.map +1 -0
  166. package/dist/core/index.js +13 -0
  167. package/dist/core/index.js.map +1 -0
  168. package/dist/core/keybindings.d.ts +363 -0
  169. package/dist/core/keybindings.d.ts.map +1 -0
  170. package/dist/core/keybindings.js +300 -0
  171. package/dist/core/keybindings.js.map +1 -0
  172. package/dist/core/messages.d.ts +77 -0
  173. package/dist/core/messages.d.ts.map +1 -0
  174. package/dist/core/messages.js +123 -0
  175. package/dist/core/messages.js.map +1 -0
  176. package/dist/core/model-config.d.ts +512 -0
  177. package/dist/core/model-config.d.ts.map +1 -0
  178. package/dist/core/model-config.js +243 -0
  179. package/dist/core/model-config.js.map +1 -0
  180. package/dist/core/model-registry.d.ts +43 -0
  181. package/dist/core/model-registry.d.ts.map +1 -0
  182. package/dist/core/model-registry.js +104 -0
  183. package/dist/core/model-registry.js.map +1 -0
  184. package/dist/core/model-resolver.d.ts +121 -0
  185. package/dist/core/model-resolver.d.ts.map +1 -0
  186. package/dist/core/model-resolver.js +534 -0
  187. package/dist/core/model-resolver.js.map +1 -0
  188. package/dist/core/model-runtime.d.ts +82 -0
  189. package/dist/core/model-runtime.d.ts.map +1 -0
  190. package/dist/core/model-runtime.js +441 -0
  191. package/dist/core/model-runtime.js.map +1 -0
  192. package/dist/core/models-store.d.ts +17 -0
  193. package/dist/core/models-store.d.ts.map +1 -0
  194. package/dist/core/models-store.js +45 -0
  195. package/dist/core/models-store.js.map +1 -0
  196. package/dist/core/output-guard.d.ts +7 -0
  197. package/dist/core/output-guard.d.ts.map +1 -0
  198. package/dist/core/output-guard.js +89 -0
  199. package/dist/core/output-guard.js.map +1 -0
  200. package/dist/core/package-manager.d.ts +210 -0
  201. package/dist/core/package-manager.d.ts.map +1 -0
  202. package/dist/core/package-manager.js +2135 -0
  203. package/dist/core/package-manager.js.map +1 -0
  204. package/dist/core/project-trust.d.ts +15 -0
  205. package/dist/core/project-trust.d.ts.map +1 -0
  206. package/dist/core/project-trust.js +59 -0
  207. package/dist/core/project-trust.js.map +1 -0
  208. package/dist/core/prompt-templates.d.ts +54 -0
  209. package/dist/core/prompt-templates.d.ts.map +1 -0
  210. package/dist/core/prompt-templates.js +236 -0
  211. package/dist/core/prompt-templates.js.map +1 -0
  212. package/dist/core/provider-attribution.d.ts +4 -0
  213. package/dist/core/provider-attribution.d.ts.map +1 -0
  214. package/dist/core/provider-attribution.js +72 -0
  215. package/dist/core/provider-attribution.js.map +1 -0
  216. package/dist/core/provider-composer.d.ts +55 -0
  217. package/dist/core/provider-composer.d.ts.map +1 -0
  218. package/dist/core/provider-composer.js +375 -0
  219. package/dist/core/provider-composer.js.map +1 -0
  220. package/dist/core/radius.d.ts +2 -0
  221. package/dist/core/radius.d.ts.map +1 -0
  222. package/dist/core/radius.js +2 -0
  223. package/dist/core/radius.js.map +1 -0
  224. package/dist/core/remote-catalog-provider.d.ts +5 -0
  225. package/dist/core/remote-catalog-provider.d.ts.map +1 -0
  226. package/dist/core/remote-catalog-provider.js +102 -0
  227. package/dist/core/remote-catalog-provider.js.map +1 -0
  228. package/dist/core/resolve-config-value.d.ts +30 -0
  229. package/dist/core/resolve-config-value.d.ts.map +1 -0
  230. package/dist/core/resolve-config-value.js +247 -0
  231. package/dist/core/resolve-config-value.js.map +1 -0
  232. package/dist/core/resource-loader.d.ts +206 -0
  233. package/dist/core/resource-loader.d.ts.map +1 -0
  234. package/dist/core/resource-loader.js +817 -0
  235. package/dist/core/resource-loader.js.map +1 -0
  236. package/dist/core/runtime-credentials.d.ts +15 -0
  237. package/dist/core/runtime-credentials.d.ts.map +1 -0
  238. package/dist/core/runtime-credentials.js +36 -0
  239. package/dist/core/runtime-credentials.js.map +1 -0
  240. package/dist/core/sdk.d.ts +106 -0
  241. package/dist/core/sdk.d.ts.map +1 -0
  242. package/dist/core/sdk.js +267 -0
  243. package/dist/core/sdk.js.map +1 -0
  244. package/dist/core/session-cwd.d.ts +19 -0
  245. package/dist/core/session-cwd.d.ts.map +1 -0
  246. package/dist/core/session-cwd.js +38 -0
  247. package/dist/core/session-cwd.js.map +1 -0
  248. package/dist/core/session-manager.d.ts +356 -0
  249. package/dist/core/session-manager.d.ts.map +1 -0
  250. package/dist/core/session-manager.js +1338 -0
  251. package/dist/core/session-manager.js.map +1 -0
  252. package/dist/core/settings-manager.d.ts +297 -0
  253. package/dist/core/settings-manager.d.ts.map +1 -0
  254. package/dist/core/settings-manager.js +902 -0
  255. package/dist/core/settings-manager.js.map +1 -0
  256. package/dist/core/skills.d.ts +60 -0
  257. package/dist/core/skills.d.ts.map +1 -0
  258. package/dist/core/skills.js +387 -0
  259. package/dist/core/skills.js.map +1 -0
  260. package/dist/core/slash-commands.d.ts +15 -0
  261. package/dist/core/slash-commands.d.ts.map +1 -0
  262. package/dist/core/slash-commands.js +26 -0
  263. package/dist/core/slash-commands.js.map +1 -0
  264. package/dist/core/source-info.d.ts +18 -0
  265. package/dist/core/source-info.d.ts.map +1 -0
  266. package/dist/core/source-info.js +19 -0
  267. package/dist/core/source-info.js.map +1 -0
  268. package/dist/core/system-prompt.d.ts +28 -0
  269. package/dist/core/system-prompt.d.ts.map +1 -0
  270. package/dist/core/system-prompt.js +110 -0
  271. package/dist/core/system-prompt.js.map +1 -0
  272. package/dist/core/telemetry.d.ts +3 -0
  273. package/dist/core/telemetry.d.ts.map +1 -0
  274. package/dist/core/telemetry.js +9 -0
  275. package/dist/core/telemetry.js.map +1 -0
  276. package/dist/core/timings.d.ts +10 -0
  277. package/dist/core/timings.d.ts.map +1 -0
  278. package/dist/core/timings.js +41 -0
  279. package/dist/core/timings.js.map +1 -0
  280. package/dist/core/tools/bash.d.ts +68 -0
  281. package/dist/core/tools/bash.d.ts.map +1 -0
  282. package/dist/core/tools/bash.js +361 -0
  283. package/dist/core/tools/bash.js.map +1 -0
  284. package/dist/core/tools/edit-diff.d.ts +106 -0
  285. package/dist/core/tools/edit-diff.d.ts.map +1 -0
  286. package/dist/core/tools/edit-diff.js +424 -0
  287. package/dist/core/tools/edit-diff.js.map +1 -0
  288. package/dist/core/tools/edit.d.ts +50 -0
  289. package/dist/core/tools/edit.d.ts.map +1 -0
  290. package/dist/core/tools/edit.js +261 -0
  291. package/dist/core/tools/edit.js.map +1 -0
  292. package/dist/core/tools/file-mutation-queue.d.ts +6 -0
  293. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  294. package/dist/core/tools/file-mutation-queue.js +52 -0
  295. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  296. package/dist/core/tools/find.d.ts +35 -0
  297. package/dist/core/tools/find.d.ts.map +1 -0
  298. package/dist/core/tools/find.js +305 -0
  299. package/dist/core/tools/find.js.map +1 -0
  300. package/dist/core/tools/grep.d.ts +37 -0
  301. package/dist/core/tools/grep.d.ts.map +1 -0
  302. package/dist/core/tools/grep.js +304 -0
  303. package/dist/core/tools/grep.js.map +1 -0
  304. package/dist/core/tools/index.d.ts +40 -0
  305. package/dist/core/tools/index.d.ts.map +1 -0
  306. package/dist/core/tools/index.js +112 -0
  307. package/dist/core/tools/index.js.map +1 -0
  308. package/dist/core/tools/ls.d.ts +37 -0
  309. package/dist/core/tools/ls.d.ts.map +1 -0
  310. package/dist/core/tools/ls.js +167 -0
  311. package/dist/core/tools/ls.js.map +1 -0
  312. package/dist/core/tools/output-accumulator.d.ts +52 -0
  313. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  314. package/dist/core/tools/output-accumulator.js +184 -0
  315. package/dist/core/tools/output-accumulator.js.map +1 -0
  316. package/dist/core/tools/path-utils.d.ts +10 -0
  317. package/dist/core/tools/path-utils.d.ts.map +1 -0
  318. package/dist/core/tools/path-utils.js +99 -0
  319. package/dist/core/tools/path-utils.js.map +1 -0
  320. package/dist/core/tools/read.d.ts +35 -0
  321. package/dist/core/tools/read.d.ts.map +1 -0
  322. package/dist/core/tools/read.js +276 -0
  323. package/dist/core/tools/read.js.map +1 -0
  324. package/dist/core/tools/render-utils.d.ts +24 -0
  325. package/dist/core/tools/render-utils.d.ts.map +1 -0
  326. package/dist/core/tools/render-utils.js +65 -0
  327. package/dist/core/tools/render-utils.js.map +1 -0
  328. package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  329. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  330. package/dist/core/tools/tool-definition-wrapper.js +34 -0
  331. package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  332. package/dist/core/tools/truncate.d.ts +70 -0
  333. package/dist/core/tools/truncate.d.ts.map +1 -0
  334. package/dist/core/tools/truncate.js +215 -0
  335. package/dist/core/tools/truncate.js.map +1 -0
  336. package/dist/core/tools/write.d.ts +26 -0
  337. package/dist/core/tools/write.d.ts.map +1 -0
  338. package/dist/core/tools/write.js +197 -0
  339. package/dist/core/tools/write.js.map +1 -0
  340. package/dist/core/trust-manager.d.ts +36 -0
  341. package/dist/core/trust-manager.d.ts.map +1 -0
  342. package/dist/core/trust-manager.js +202 -0
  343. package/dist/core/trust-manager.js.map +1 -0
  344. package/dist/core/usage-totals.d.ts +19 -0
  345. package/dist/core/usage-totals.d.ts.map +1 -0
  346. package/dist/core/usage-totals.js +52 -0
  347. package/dist/core/usage-totals.js.map +1 -0
  348. package/dist/extensions/deepwiki/client.d.ts +14 -0
  349. package/dist/extensions/deepwiki/client.d.ts.map +1 -0
  350. package/dist/extensions/deepwiki/client.js +196 -0
  351. package/dist/extensions/deepwiki/client.js.map +1 -0
  352. package/dist/extensions/deepwiki/constants.d.ts +13 -0
  353. package/dist/extensions/deepwiki/constants.d.ts.map +1 -0
  354. package/dist/extensions/deepwiki/constants.js +18 -0
  355. package/dist/extensions/deepwiki/constants.js.map +1 -0
  356. package/dist/extensions/deepwiki/contents.d.ts +63 -0
  357. package/dist/extensions/deepwiki/contents.d.ts.map +1 -0
  358. package/dist/extensions/deepwiki/contents.js +174 -0
  359. package/dist/extensions/deepwiki/contents.js.map +1 -0
  360. package/dist/extensions/deepwiki/execute.d.ts +25 -0
  361. package/dist/extensions/deepwiki/execute.d.ts.map +1 -0
  362. package/dist/extensions/deepwiki/execute.js +78 -0
  363. package/dist/extensions/deepwiki/execute.js.map +1 -0
  364. package/dist/extensions/deepwiki/http.d.ts +12 -0
  365. package/dist/extensions/deepwiki/http.d.ts.map +1 -0
  366. package/dist/extensions/deepwiki/http.js +74 -0
  367. package/dist/extensions/deepwiki/http.js.map +1 -0
  368. package/dist/extensions/deepwiki/index.d.ts +9 -0
  369. package/dist/extensions/deepwiki/index.d.ts.map +1 -0
  370. package/dist/extensions/deepwiki/index.js +25 -0
  371. package/dist/extensions/deepwiki/index.js.map +1 -0
  372. package/dist/extensions/deepwiki/render.d.ts +14 -0
  373. package/dist/extensions/deepwiki/render.d.ts.map +1 -0
  374. package/dist/extensions/deepwiki/render.js +166 -0
  375. package/dist/extensions/deepwiki/render.js.map +1 -0
  376. package/dist/extensions/deepwiki/schema.d.ts +13 -0
  377. package/dist/extensions/deepwiki/schema.d.ts.map +1 -0
  378. package/dist/extensions/deepwiki/schema.js +208 -0
  379. package/dist/extensions/deepwiki/schema.js.map +1 -0
  380. package/dist/extensions/index.d.ts +3 -0
  381. package/dist/extensions/index.d.ts.map +1 -0
  382. package/dist/extensions/index.js +17 -0
  383. package/dist/extensions/index.js.map +1 -0
  384. package/dist/extensions/llama/client.d.ts +61 -0
  385. package/dist/extensions/llama/client.d.ts.map +1 -0
  386. package/dist/extensions/llama/client.js +302 -0
  387. package/dist/extensions/llama/client.js.map +1 -0
  388. package/dist/extensions/llama/huggingface.d.ts +23 -0
  389. package/dist/extensions/llama/huggingface.d.ts.map +1 -0
  390. package/dist/extensions/llama/huggingface.js +141 -0
  391. package/dist/extensions/llama/huggingface.js.map +1 -0
  392. package/dist/extensions/llama/index.d.ts +3 -0
  393. package/dist/extensions/llama/index.d.ts.map +1 -0
  394. package/dist/extensions/llama/index.js +208 -0
  395. package/dist/extensions/llama/index.js.map +1 -0
  396. package/dist/extensions/llama/provider.d.ts +10 -0
  397. package/dist/extensions/llama/provider.d.ts.map +1 -0
  398. package/dist/extensions/llama/provider.js +102 -0
  399. package/dist/extensions/llama/provider.js.map +1 -0
  400. package/dist/extensions/llama/ui.d.ts +42 -0
  401. package/dist/extensions/llama/ui.d.ts.map +1 -0
  402. package/dist/extensions/llama/ui.js +416 -0
  403. package/dist/extensions/llama/ui.js.map +1 -0
  404. package/dist/extensions/question/constants.d.ts +13 -0
  405. package/dist/extensions/question/constants.d.ts.map +1 -0
  406. package/dist/extensions/question/constants.js +17 -0
  407. package/dist/extensions/question/constants.js.map +1 -0
  408. package/dist/extensions/question/dialog-primitives.d.ts +6 -0
  409. package/dist/extensions/question/dialog-primitives.d.ts.map +1 -0
  410. package/dist/extensions/question/dialog-primitives.js +20 -0
  411. package/dist/extensions/question/dialog-primitives.js.map +1 -0
  412. package/dist/extensions/question/dialog.d.ts +10 -0
  413. package/dist/extensions/question/dialog.d.ts.map +1 -0
  414. package/dist/extensions/question/dialog.js +519 -0
  415. package/dist/extensions/question/dialog.js.map +1 -0
  416. package/dist/extensions/question/index.d.ts +9 -0
  417. package/dist/extensions/question/index.d.ts.map +1 -0
  418. package/dist/extensions/question/index.js +32 -0
  419. package/dist/extensions/question/index.js.map +1 -0
  420. package/dist/extensions/question/limits.d.ts +11 -0
  421. package/dist/extensions/question/limits.d.ts.map +1 -0
  422. package/dist/extensions/question/limits.js +11 -0
  423. package/dist/extensions/question/limits.js.map +1 -0
  424. package/dist/extensions/question/render-cache.d.ts +9 -0
  425. package/dist/extensions/question/render-cache.d.ts.map +1 -0
  426. package/dist/extensions/question/render-cache.js +18 -0
  427. package/dist/extensions/question/render-cache.js.map +1 -0
  428. package/dist/extensions/question/render.d.ts +17 -0
  429. package/dist/extensions/question/render.d.ts.map +1 -0
  430. package/dist/extensions/question/render.js +47 -0
  431. package/dist/extensions/question/render.js.map +1 -0
  432. package/dist/extensions/question/results.d.ts +8 -0
  433. package/dist/extensions/question/results.d.ts.map +1 -0
  434. package/dist/extensions/question/results.js +68 -0
  435. package/dist/extensions/question/results.js.map +1 -0
  436. package/dist/extensions/question/schema.d.ts +22 -0
  437. package/dist/extensions/question/schema.d.ts.map +1 -0
  438. package/dist/extensions/question/schema.js +98 -0
  439. package/dist/extensions/question/schema.js.map +1 -0
  440. package/dist/extensions/question/state.d.ts +9 -0
  441. package/dist/extensions/question/state.d.ts.map +1 -0
  442. package/dist/extensions/question/state.js +76 -0
  443. package/dist/extensions/question/state.js.map +1 -0
  444. package/dist/extensions/question/types.d.ts +60 -0
  445. package/dist/extensions/question/types.d.ts.map +1 -0
  446. package/dist/extensions/question/types.js +2 -0
  447. package/dist/extensions/question/types.js.map +1 -0
  448. package/dist/extensions/rewind/config.d.ts +16 -0
  449. package/dist/extensions/rewind/config.d.ts.map +1 -0
  450. package/dist/extensions/rewind/config.js +69 -0
  451. package/dist/extensions/rewind/config.js.map +1 -0
  452. package/dist/extensions/rewind/engine.d.ts +97 -0
  453. package/dist/extensions/rewind/engine.d.ts.map +1 -0
  454. package/dist/extensions/rewind/engine.js +747 -0
  455. package/dist/extensions/rewind/engine.js.map +1 -0
  456. package/dist/extensions/rewind/gc.d.ts +35 -0
  457. package/dist/extensions/rewind/gc.d.ts.map +1 -0
  458. package/dist/extensions/rewind/gc.js +169 -0
  459. package/dist/extensions/rewind/gc.js.map +1 -0
  460. package/dist/extensions/rewind/index.d.ts +3 -0
  461. package/dist/extensions/rewind/index.d.ts.map +1 -0
  462. package/dist/extensions/rewind/index.js +253 -0
  463. package/dist/extensions/rewind/index.js.map +1 -0
  464. package/dist/extensions/rewind/menu.d.ts +13 -0
  465. package/dist/extensions/rewind/menu.d.ts.map +1 -0
  466. package/dist/extensions/rewind/menu.js +118 -0
  467. package/dist/extensions/rewind/menu.js.map +1 -0
  468. package/dist/extensions/rewind/paths.d.ts +4 -0
  469. package/dist/extensions/rewind/paths.d.ts.map +1 -0
  470. package/dist/extensions/rewind/paths.js +15 -0
  471. package/dist/extensions/rewind/paths.js.map +1 -0
  472. package/dist/extensions/rewind/restore.d.ts +37 -0
  473. package/dist/extensions/rewind/restore.d.ts.map +1 -0
  474. package/dist/extensions/rewind/restore.js +52 -0
  475. package/dist/extensions/rewind/restore.js.map +1 -0
  476. package/dist/extensions/rewind/snapshot.d.ts +45 -0
  477. package/dist/extensions/rewind/snapshot.d.ts.map +1 -0
  478. package/dist/extensions/rewind/snapshot.js +21 -0
  479. package/dist/extensions/rewind/snapshot.js.map +1 -0
  480. package/dist/extensions/rewind/storage.d.ts +12 -0
  481. package/dist/extensions/rewind/storage.d.ts.map +1 -0
  482. package/dist/extensions/rewind/storage.js +33 -0
  483. package/dist/extensions/rewind/storage.js.map +1 -0
  484. package/dist/extensions/rewind/text.d.ts +7 -0
  485. package/dist/extensions/rewind/text.d.ts.map +1 -0
  486. package/dist/extensions/rewind/text.js +19 -0
  487. package/dist/extensions/rewind/text.js.map +1 -0
  488. package/dist/extensions/rewind/tool-path.d.ts +3 -0
  489. package/dist/extensions/rewind/tool-path.d.ts.map +1 -0
  490. package/dist/extensions/rewind/tool-path.js +9 -0
  491. package/dist/extensions/rewind/tool-path.js.map +1 -0
  492. package/dist/extensions/router/constants.d.ts +20 -0
  493. package/dist/extensions/router/constants.d.ts.map +1 -0
  494. package/dist/extensions/router/constants.js +27 -0
  495. package/dist/extensions/router/constants.js.map +1 -0
  496. package/dist/extensions/router/dialog.d.ts +38 -0
  497. package/dist/extensions/router/dialog.d.ts.map +1 -0
  498. package/dist/extensions/router/dialog.js +407 -0
  499. package/dist/extensions/router/dialog.js.map +1 -0
  500. package/dist/extensions/router/index.d.ts +15 -0
  501. package/dist/extensions/router/index.d.ts.map +1 -0
  502. package/dist/extensions/router/index.js +61 -0
  503. package/dist/extensions/router/index.js.map +1 -0
  504. package/dist/extensions/router/presets.d.ts +48 -0
  505. package/dist/extensions/router/presets.d.ts.map +1 -0
  506. package/dist/extensions/router/presets.js +109 -0
  507. package/dist/extensions/router/presets.js.map +1 -0
  508. package/dist/extensions/router/probe.d.ts +20 -0
  509. package/dist/extensions/router/probe.d.ts.map +1 -0
  510. package/dist/extensions/router/probe.js +125 -0
  511. package/dist/extensions/router/probe.js.map +1 -0
  512. package/dist/extensions/router/register.d.ts +34 -0
  513. package/dist/extensions/router/register.d.ts.map +1 -0
  514. package/dist/extensions/router/register.js +81 -0
  515. package/dist/extensions/router/register.js.map +1 -0
  516. package/dist/extensions/router/store.d.ts +12 -0
  517. package/dist/extensions/router/store.d.ts.map +1 -0
  518. package/dist/extensions/router/store.js +164 -0
  519. package/dist/extensions/router/store.js.map +1 -0
  520. package/dist/extensions/router/stream.d.ts +16 -0
  521. package/dist/extensions/router/stream.d.ts.map +1 -0
  522. package/dist/extensions/router/stream.js +198 -0
  523. package/dist/extensions/router/stream.js.map +1 -0
  524. package/dist/extensions/router/types.d.ts +23 -0
  525. package/dist/extensions/router/types.d.ts.map +1 -0
  526. package/dist/extensions/router/types.js +2 -0
  527. package/dist/extensions/router/types.js.map +1 -0
  528. package/dist/extensions/router/ui.d.ts +9 -0
  529. package/dist/extensions/router/ui.d.ts.map +1 -0
  530. package/dist/extensions/router/ui.js +538 -0
  531. package/dist/extensions/router/ui.js.map +1 -0
  532. package/dist/extensions/statusline/index.d.ts +3 -0
  533. package/dist/extensions/statusline/index.d.ts.map +1 -0
  534. package/dist/extensions/statusline/index.js +367 -0
  535. package/dist/extensions/statusline/index.js.map +1 -0
  536. package/dist/extensions/todo/constants.d.ts +16 -0
  537. package/dist/extensions/todo/constants.d.ts.map +1 -0
  538. package/dist/extensions/todo/constants.js +20 -0
  539. package/dist/extensions/todo/constants.js.map +1 -0
  540. package/dist/extensions/todo/index.d.ts +17 -0
  541. package/dist/extensions/todo/index.d.ts.map +1 -0
  542. package/dist/extensions/todo/index.js +83 -0
  543. package/dist/extensions/todo/index.js.map +1 -0
  544. package/dist/extensions/todo/overlay.d.ts +24 -0
  545. package/dist/extensions/todo/overlay.d.ts.map +1 -0
  546. package/dist/extensions/todo/overlay.js +139 -0
  547. package/dist/extensions/todo/overlay.js.map +1 -0
  548. package/dist/extensions/todo/schema.d.ts +41 -0
  549. package/dist/extensions/todo/schema.d.ts.map +1 -0
  550. package/dist/extensions/todo/schema.js +36 -0
  551. package/dist/extensions/todo/schema.js.map +1 -0
  552. package/dist/extensions/todo/state.d.ts +57 -0
  553. package/dist/extensions/todo/state.d.ts.map +1 -0
  554. package/dist/extensions/todo/state.js +452 -0
  555. package/dist/extensions/todo/state.js.map +1 -0
  556. package/dist/extensions/todo/view.d.ts +8 -0
  557. package/dist/extensions/todo/view.d.ts.map +1 -0
  558. package/dist/extensions/todo/view.js +119 -0
  559. package/dist/extensions/todo/view.js.map +1 -0
  560. package/dist/index.d.ts +35 -0
  561. package/dist/index.d.ts.map +1 -0
  562. package/dist/index.js +47 -0
  563. package/dist/index.js.map +1 -0
  564. package/dist/main.d.ts +12 -0
  565. package/dist/main.d.ts.map +1 -0
  566. package/dist/main.js +704 -0
  567. package/dist/main.js.map +1 -0
  568. package/dist/migrations.d.ts +33 -0
  569. package/dist/migrations.d.ts.map +1 -0
  570. package/dist/migrations.js +281 -0
  571. package/dist/migrations.js.map +1 -0
  572. package/dist/modes/index.d.ts +9 -0
  573. package/dist/modes/index.d.ts.map +1 -0
  574. package/dist/modes/index.js +8 -0
  575. package/dist/modes/index.js.map +1 -0
  576. package/dist/modes/interactive/assets/clankolas.png +0 -0
  577. package/dist/modes/interactive/components/armin.d.ts +34 -0
  578. package/dist/modes/interactive/components/armin.d.ts.map +1 -0
  579. package/dist/modes/interactive/components/armin.js +333 -0
  580. package/dist/modes/interactive/components/armin.js.map +1 -0
  581. package/dist/modes/interactive/components/assistant-message.d.ts +22 -0
  582. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  583. package/dist/modes/interactive/components/assistant-message.js +141 -0
  584. package/dist/modes/interactive/components/assistant-message.js.map +1 -0
  585. package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  586. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  587. package/dist/modes/interactive/components/bash-execution.js +175 -0
  588. package/dist/modes/interactive/components/bash-execution.js.map +1 -0
  589. package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  590. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  591. package/dist/modes/interactive/components/bordered-loader.js +54 -0
  592. package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  593. package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  594. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  595. package/dist/modes/interactive/components/branch-summary-message.js +44 -0
  596. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  597. package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  598. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  599. package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
  600. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  601. package/dist/modes/interactive/components/config-selector.d.ts +102 -0
  602. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  603. package/dist/modes/interactive/components/config-selector.js +761 -0
  604. package/dist/modes/interactive/components/config-selector.js.map +1 -0
  605. package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  606. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  607. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  608. package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  609. package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
  610. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  611. package/dist/modes/interactive/components/custom-editor.js +70 -0
  612. package/dist/modes/interactive/components/custom-editor.js.map +1 -0
  613. package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
  614. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
  615. package/dist/modes/interactive/components/custom-entry.js +52 -0
  616. package/dist/modes/interactive/components/custom-entry.js.map +1 -0
  617. package/dist/modes/interactive/components/custom-message.d.ts +20 -0
  618. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  619. package/dist/modes/interactive/components/custom-message.js +79 -0
  620. package/dist/modes/interactive/components/custom-message.js.map +1 -0
  621. package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
  622. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
  623. package/dist/modes/interactive/components/daxnuts.js +140 -0
  624. package/dist/modes/interactive/components/daxnuts.js.map +1 -0
  625. package/dist/modes/interactive/components/diff.d.ts +12 -0
  626. package/dist/modes/interactive/components/diff.d.ts.map +1 -0
  627. package/dist/modes/interactive/components/diff.js +133 -0
  628. package/dist/modes/interactive/components/diff.js.map +1 -0
  629. package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  630. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  631. package/dist/modes/interactive/components/dynamic-border.js +21 -0
  632. package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  633. package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
  634. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
  635. package/dist/modes/interactive/components/earendil-announcement.js +40 -0
  636. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
  637. package/dist/modes/interactive/components/extension-editor.d.ts +22 -0
  638. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  639. package/dist/modes/interactive/components/extension-editor.js +128 -0
  640. package/dist/modes/interactive/components/extension-editor.js.map +1 -0
  641. package/dist/modes/interactive/components/extension-input.d.ts +23 -0
  642. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  643. package/dist/modes/interactive/components/extension-input.js +61 -0
  644. package/dist/modes/interactive/components/extension-input.js.map +1 -0
  645. package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
  646. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  647. package/dist/modes/interactive/components/extension-selector.js +83 -0
  648. package/dist/modes/interactive/components/extension-selector.js.map +1 -0
  649. package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  650. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
  651. package/dist/modes/interactive/components/first-time-setup.js +103 -0
  652. package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
  653. package/dist/modes/interactive/components/footer.d.ts +32 -0
  654. package/dist/modes/interactive/components/footer.d.ts.map +1 -0
  655. package/dist/modes/interactive/components/footer.js +222 -0
  656. package/dist/modes/interactive/components/footer.js.map +1 -0
  657. package/dist/modes/interactive/components/index.d.ts +34 -0
  658. package/dist/modes/interactive/components/index.d.ts.map +1 -0
  659. package/dist/modes/interactive/components/index.js +35 -0
  660. package/dist/modes/interactive/components/index.js.map +1 -0
  661. package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
  662. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  663. package/dist/modes/interactive/components/keybinding-hints.js +36 -0
  664. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  665. package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
  666. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  667. package/dist/modes/interactive/components/login-dialog.js +188 -0
  668. package/dist/modes/interactive/components/login-dialog.js.map +1 -0
  669. package/dist/modes/interactive/components/model-selector.d.ts +54 -0
  670. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  671. package/dist/modes/interactive/components/model-selector.js +310 -0
  672. package/dist/modes/interactive/components/model-selector.js.map +1 -0
  673. package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
  674. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  675. package/dist/modes/interactive/components/oauth-selector.js +163 -0
  676. package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  677. package/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
  678. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  679. package/dist/modes/interactive/components/scoped-models-selector.js +293 -0
  680. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  681. package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  682. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  683. package/dist/modes/interactive/components/session-selector-search.js +155 -0
  684. package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  685. package/dist/modes/interactive/components/session-selector.d.ts +95 -0
  686. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  687. package/dist/modes/interactive/components/session-selector.js +867 -0
  688. package/dist/modes/interactive/components/session-selector.js.map +1 -0
  689. package/dist/modes/interactive/components/settings-selector.d.ts +77 -0
  690. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  691. package/dist/modes/interactive/components/settings-selector.js +593 -0
  692. package/dist/modes/interactive/components/settings-selector.js.map +1 -0
  693. package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  694. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  695. package/dist/modes/interactive/components/show-images-selector.js +39 -0
  696. package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  697. package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  698. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  699. package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
  700. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  701. package/dist/modes/interactive/components/status-indicator.d.ts +28 -0
  702. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
  703. package/dist/modes/interactive/components/status-indicator.js +60 -0
  704. package/dist/modes/interactive/components/status-indicator.js.map +1 -0
  705. package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  706. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  707. package/dist/modes/interactive/components/theme-selector.js +50 -0
  708. package/dist/modes/interactive/components/theme-selector.js.map +1 -0
  709. package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  710. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  711. package/dist/modes/interactive/components/thinking-selector.js +52 -0
  712. package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  713. package/dist/modes/interactive/components/tool-execution.d.ts +62 -0
  714. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  715. package/dist/modes/interactive/components/tool-execution.js +361 -0
  716. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  717. package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
  718. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  719. package/dist/modes/interactive/components/tree-selector.js +1245 -0
  720. package/dist/modes/interactive/components/tree-selector.js.map +1 -0
  721. package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  722. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  723. package/dist/modes/interactive/components/trust-selector.js +91 -0
  724. package/dist/modes/interactive/components/trust-selector.js.map +1 -0
  725. package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  726. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  727. package/dist/modes/interactive/components/user-message-selector.js +114 -0
  728. package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  729. package/dist/modes/interactive/components/user-message.d.ts +14 -0
  730. package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  731. package/dist/modes/interactive/components/user-message.js +42 -0
  732. package/dist/modes/interactive/components/user-message.js.map +1 -0
  733. package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  734. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  735. package/dist/modes/interactive/components/visual-truncate.js +33 -0
  736. package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  737. package/dist/modes/interactive/interactive-mode.d.ts +394 -0
  738. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  739. package/dist/modes/interactive/interactive-mode.js +5039 -0
  740. package/dist/modes/interactive/interactive-mode.js.map +1 -0
  741. package/dist/modes/interactive/model-search.d.ts +12 -0
  742. package/dist/modes/interactive/model-search.d.ts.map +1 -0
  743. package/dist/modes/interactive/model-search.js +15 -0
  744. package/dist/modes/interactive/model-search.js.map +1 -0
  745. package/dist/modes/interactive/theme/dark.json +87 -0
  746. package/dist/modes/interactive/theme/ice-cream-dark.json +101 -0
  747. package/dist/modes/interactive/theme/ice-cream-light.json +101 -0
  748. package/dist/modes/interactive/theme/light.json +86 -0
  749. package/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
  750. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  751. package/dist/modes/interactive/theme/theme-controller.js +102 -0
  752. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  753. package/dist/modes/interactive/theme/theme-schema.json +340 -0
  754. package/dist/modes/interactive/theme/theme.d.ts +120 -0
  755. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  756. package/dist/modes/interactive/theme/theme.js +1063 -0
  757. package/dist/modes/interactive/theme/theme.js.map +1 -0
  758. package/dist/modes/print-mode.d.ts +28 -0
  759. package/dist/modes/print-mode.d.ts.map +1 -0
  760. package/dist/modes/print-mode.js +132 -0
  761. package/dist/modes/print-mode.js.map +1 -0
  762. package/dist/modes/rpc/jsonl.d.ts +17 -0
  763. package/dist/modes/rpc/jsonl.d.ts.map +1 -0
  764. package/dist/modes/rpc/jsonl.js +49 -0
  765. package/dist/modes/rpc/jsonl.js.map +1 -0
  766. package/dist/modes/rpc/rpc-client.d.ts +246 -0
  767. package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  768. package/dist/modes/rpc/rpc-client.js +488 -0
  769. package/dist/modes/rpc/rpc-client.js.map +1 -0
  770. package/dist/modes/rpc/rpc-mode.d.ts +20 -0
  771. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  772. package/dist/modes/rpc/rpc-mode.js +639 -0
  773. package/dist/modes/rpc/rpc-mode.js.map +1 -0
  774. package/dist/modes/rpc/rpc-types.d.ts +457 -0
  775. package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  776. package/dist/modes/rpc/rpc-types.js +8 -0
  777. package/dist/modes/rpc/rpc-types.js.map +1 -0
  778. package/dist/package-manager-cli.d.ts +8 -0
  779. package/dist/package-manager-cli.d.ts.map +1 -0
  780. package/dist/package-manager-cli.js +775 -0
  781. package/dist/package-manager-cli.js.map +1 -0
  782. package/dist/rpc-entry.d.ts +3 -0
  783. package/dist/rpc-entry.d.ts.map +1 -0
  784. package/dist/rpc-entry.js +10 -0
  785. package/dist/rpc-entry.js.map +1 -0
  786. package/dist/utils/ansi.d.ts +2 -0
  787. package/dist/utils/ansi.d.ts.map +1 -0
  788. package/dist/utils/ansi.js +52 -0
  789. package/dist/utils/ansi.js.map +1 -0
  790. package/dist/utils/changelog.d.ts +22 -0
  791. package/dist/utils/changelog.d.ts.map +1 -0
  792. package/dist/utils/changelog.js +165 -0
  793. package/dist/utils/changelog.js.map +1 -0
  794. package/dist/utils/child-process.d.ts +18 -0
  795. package/dist/utils/child-process.d.ts.map +1 -0
  796. package/dist/utils/child-process.js +106 -0
  797. package/dist/utils/child-process.js.map +1 -0
  798. package/dist/utils/clipboard-image.d.ts +11 -0
  799. package/dist/utils/clipboard-image.d.ts.map +1 -0
  800. package/dist/utils/clipboard-image.js +245 -0
  801. package/dist/utils/clipboard-image.js.map +1 -0
  802. package/dist/utils/clipboard-native.d.ts +11 -0
  803. package/dist/utils/clipboard-native.d.ts.map +1 -0
  804. package/dist/utils/clipboard-native.js +20 -0
  805. package/dist/utils/clipboard-native.js.map +1 -0
  806. package/dist/utils/clipboard.d.ts +4 -0
  807. package/dist/utils/clipboard.d.ts.map +1 -0
  808. package/dist/utils/clipboard.js +130 -0
  809. package/dist/utils/clipboard.js.map +1 -0
  810. package/dist/utils/deprecation.d.ts +4 -0
  811. package/dist/utils/deprecation.d.ts.map +1 -0
  812. package/dist/utils/deprecation.js +13 -0
  813. package/dist/utils/deprecation.js.map +1 -0
  814. package/dist/utils/exif-orientation.d.ts +5 -0
  815. package/dist/utils/exif-orientation.d.ts.map +1 -0
  816. package/dist/utils/exif-orientation.js +158 -0
  817. package/dist/utils/exif-orientation.js.map +1 -0
  818. package/dist/utils/frontmatter.d.ts +8 -0
  819. package/dist/utils/frontmatter.d.ts.map +1 -0
  820. package/dist/utils/frontmatter.js +26 -0
  821. package/dist/utils/frontmatter.js.map +1 -0
  822. package/dist/utils/fs-watch.d.ts +5 -0
  823. package/dist/utils/fs-watch.d.ts.map +1 -0
  824. package/dist/utils/fs-watch.js +25 -0
  825. package/dist/utils/fs-watch.js.map +1 -0
  826. package/dist/utils/git.d.ts +26 -0
  827. package/dist/utils/git.d.ts.map +1 -0
  828. package/dist/utils/git.js +195 -0
  829. package/dist/utils/git.js.map +1 -0
  830. package/dist/utils/html.d.ts +7 -0
  831. package/dist/utils/html.d.ts.map +1 -0
  832. package/dist/utils/html.js +40 -0
  833. package/dist/utils/html.js.map +1 -0
  834. package/dist/utils/image-convert.d.ts +10 -0
  835. package/dist/utils/image-convert.d.ts.map +1 -0
  836. package/dist/utils/image-convert.js +45 -0
  837. package/dist/utils/image-convert.js.map +1 -0
  838. package/dist/utils/image-process.d.ts +18 -0
  839. package/dist/utils/image-process.d.ts.map +1 -0
  840. package/dist/utils/image-process.js +83 -0
  841. package/dist/utils/image-process.js.map +1 -0
  842. package/dist/utils/image-resize-core.d.ts +30 -0
  843. package/dist/utils/image-resize-core.d.ts.map +1 -0
  844. package/dist/utils/image-resize-core.js +124 -0
  845. package/dist/utils/image-resize-core.js.map +1 -0
  846. package/dist/utils/image-resize-worker.d.ts +2 -0
  847. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  848. package/dist/utils/image-resize-worker.js +31 -0
  849. package/dist/utils/image-resize-worker.js.map +1 -0
  850. package/dist/utils/image-resize.d.ts +16 -0
  851. package/dist/utils/image-resize.d.ts.map +1 -0
  852. package/dist/utils/image-resize.js +97 -0
  853. package/dist/utils/image-resize.js.map +1 -0
  854. package/dist/utils/json.d.ts +3 -0
  855. package/dist/utils/json.d.ts.map +1 -0
  856. package/dist/utils/json.js +7 -0
  857. package/dist/utils/json.js.map +1 -0
  858. package/dist/utils/mime.d.ts +3 -0
  859. package/dist/utils/mime.d.ts.map +1 -0
  860. package/dist/utils/mime.js +110 -0
  861. package/dist/utils/mime.js.map +1 -0
  862. package/dist/utils/open-browser.d.ts +9 -0
  863. package/dist/utils/open-browser.d.ts.map +1 -0
  864. package/dist/utils/open-browser.js +22 -0
  865. package/dist/utils/open-browser.js.map +1 -0
  866. package/dist/utils/paths.d.ts +31 -0
  867. package/dist/utils/paths.d.ts.map +1 -0
  868. package/dist/utils/paths.js +92 -0
  869. package/dist/utils/paths.js.map +1 -0
  870. package/dist/utils/photon.d.ts +21 -0
  871. package/dist/utils/photon.d.ts.map +1 -0
  872. package/dist/utils/photon.js +121 -0
  873. package/dist/utils/photon.js.map +1 -0
  874. package/dist/utils/pi-user-agent.d.ts +2 -0
  875. package/dist/utils/pi-user-agent.d.ts.map +1 -0
  876. package/dist/utils/pi-user-agent.js +5 -0
  877. package/dist/utils/pi-user-agent.js.map +1 -0
  878. package/dist/utils/shell.d.ts +31 -0
  879. package/dist/utils/shell.d.ts.map +1 -0
  880. package/dist/utils/shell.js +202 -0
  881. package/dist/utils/shell.js.map +1 -0
  882. package/dist/utils/sleep.d.ts +5 -0
  883. package/dist/utils/sleep.d.ts.map +1 -0
  884. package/dist/utils/sleep.js +17 -0
  885. package/dist/utils/sleep.js.map +1 -0
  886. package/dist/utils/syntax-highlight.d.ts +12 -0
  887. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  888. package/dist/utils/syntax-highlight.js +118 -0
  889. package/dist/utils/syntax-highlight.js.map +1 -0
  890. package/dist/utils/tools-manager.d.ts +3 -0
  891. package/dist/utils/tools-manager.d.ts.map +1 -0
  892. package/dist/utils/tools-manager.js +328 -0
  893. package/dist/utils/tools-manager.js.map +1 -0
  894. package/dist/utils/version-check.d.ts +15 -0
  895. package/dist/utils/version-check.d.ts.map +1 -0
  896. package/dist/utils/version-check.js +54 -0
  897. package/dist/utils/version-check.js.map +1 -0
  898. package/dist/utils/windows-self-update.d.ts +3 -0
  899. package/dist/utils/windows-self-update.d.ts.map +1 -0
  900. package/dist/utils/windows-self-update.js +77 -0
  901. package/dist/utils/windows-self-update.js.map +1 -0
  902. package/docs/compaction.md +401 -0
  903. package/docs/containerization.md +111 -0
  904. package/docs/custom-provider.md +763 -0
  905. package/docs/development.md +71 -0
  906. package/docs/docs.json +156 -0
  907. package/docs/extensions.md +2953 -0
  908. package/docs/images/doom-extension.png +0 -0
  909. package/docs/images/exy.png +0 -0
  910. package/docs/images/interactive-mode.png +0 -0
  911. package/docs/images/tree-view.png +0 -0
  912. package/docs/index.md +77 -0
  913. package/docs/json.md +86 -0
  914. package/docs/keybindings.md +198 -0
  915. package/docs/llama-cpp.md +99 -0
  916. package/docs/models.md +540 -0
  917. package/docs/packages.md +228 -0
  918. package/docs/prompt-templates.md +96 -0
  919. package/docs/providers.md +301 -0
  920. package/docs/quickstart.md +165 -0
  921. package/docs/rpc.md +1559 -0
  922. package/docs/sdk.md +1186 -0
  923. package/docs/security.md +59 -0
  924. package/docs/session-format.md +436 -0
  925. package/docs/sessions.md +145 -0
  926. package/docs/settings.md +319 -0
  927. package/docs/shell-aliases.md +13 -0
  928. package/docs/skills.md +231 -0
  929. package/docs/terminal-setup.md +142 -0
  930. package/docs/termux.md +127 -0
  931. package/docs/themes.md +301 -0
  932. package/docs/tmux.md +63 -0
  933. package/docs/tui.md +942 -0
  934. package/docs/usage.md +311 -0
  935. package/docs/windows.md +17 -0
  936. package/examples/README.md +25 -0
  937. package/examples/extensions/README.md +213 -0
  938. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  939. package/examples/extensions/bash-spawn-hook.ts +30 -0
  940. package/examples/extensions/bookmark.ts +50 -0
  941. package/examples/extensions/border-status-editor.ts +145 -0
  942. package/examples/extensions/built-in-tool-renderer.ts +249 -0
  943. package/examples/extensions/claude-rules.ts +86 -0
  944. package/examples/extensions/commands.ts +72 -0
  945. package/examples/extensions/confirm-destructive.ts +59 -0
  946. package/examples/extensions/custom-compaction.ts +129 -0
  947. package/examples/extensions/custom-footer.ts +64 -0
  948. package/examples/extensions/custom-header.ts +73 -0
  949. package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
  950. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  951. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  952. package/examples/extensions/custom-provider-gitlab-duo/index.ts +404 -0
  953. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  954. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  955. package/examples/extensions/dirty-repo-guard.ts +56 -0
  956. package/examples/extensions/doom-overlay/README.md +46 -0
  957. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  958. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  959. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  960. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  961. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  962. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  963. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  964. package/examples/extensions/doom-overlay/index.ts +74 -0
  965. package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
  966. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  967. package/examples/extensions/dynamic-resources/dynamic.json +79 -0
  968. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  969. package/examples/extensions/dynamic-resources/index.ts +15 -0
  970. package/examples/extensions/dynamic-tools.ts +74 -0
  971. package/examples/extensions/entry-renderer.ts +41 -0
  972. package/examples/extensions/event-bus.ts +43 -0
  973. package/examples/extensions/file-trigger.ts +41 -0
  974. package/examples/extensions/git-checkpoint.ts +53 -0
  975. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  976. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  977. package/examples/extensions/gondolin/index.ts +531 -0
  978. package/examples/extensions/gondolin/package-lock.json +185 -0
  979. package/examples/extensions/gondolin/package.json +19 -0
  980. package/examples/extensions/handoff.ts +191 -0
  981. package/examples/extensions/hello.ts +26 -0
  982. package/examples/extensions/hidden-thinking-label.ts +53 -0
  983. package/examples/extensions/inline-bash.ts +94 -0
  984. package/examples/extensions/input-transform-streaming.ts +39 -0
  985. package/examples/extensions/input-transform.ts +43 -0
  986. package/examples/extensions/interactive-shell.ts +196 -0
  987. package/examples/extensions/kimi-deferred-tools.ts +61 -0
  988. package/examples/extensions/mac-system-theme.ts +47 -0
  989. package/examples/extensions/message-renderer.ts +59 -0
  990. package/examples/extensions/minimal-mode.ts +426 -0
  991. package/examples/extensions/modal-editor.ts +85 -0
  992. package/examples/extensions/model-status.ts +31 -0
  993. package/examples/extensions/notify.ts +55 -0
  994. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  995. package/examples/extensions/overlay-test.ts +153 -0
  996. package/examples/extensions/permission-gate.ts +34 -0
  997. package/examples/extensions/pirate.ts +47 -0
  998. package/examples/extensions/plan-mode/README.md +66 -0
  999. package/examples/extensions/plan-mode/index.ts +390 -0
  1000. package/examples/extensions/plan-mode/utils.ts +168 -0
  1001. package/examples/extensions/preset.ts +436 -0
  1002. package/examples/extensions/project-trust.ts +64 -0
  1003. package/examples/extensions/prompt-customizer.ts +97 -0
  1004. package/examples/extensions/protected-paths.ts +30 -0
  1005. package/examples/extensions/provider-payload.ts +18 -0
  1006. package/examples/extensions/qna.ts +122 -0
  1007. package/examples/extensions/question.ts +286 -0
  1008. package/examples/extensions/questionnaire.ts +448 -0
  1009. package/examples/extensions/rainbow-editor.ts +88 -0
  1010. package/examples/extensions/reload-runtime.ts +37 -0
  1011. package/examples/extensions/rpc-demo.ts +118 -0
  1012. package/examples/extensions/sandbox/index.ts +321 -0
  1013. package/examples/extensions/sandbox/package-lock.json +92 -0
  1014. package/examples/extensions/sandbox/package.json +19 -0
  1015. package/examples/extensions/send-user-message.ts +97 -0
  1016. package/examples/extensions/session-name.ts +27 -0
  1017. package/examples/extensions/shutdown-command.ts +63 -0
  1018. package/examples/extensions/snake.ts +343 -0
  1019. package/examples/extensions/space-invaders.ts +560 -0
  1020. package/examples/extensions/ssh.ts +220 -0
  1021. package/examples/extensions/status-line.ts +32 -0
  1022. package/examples/extensions/structured-output.ts +65 -0
  1023. package/examples/extensions/subagent/README.md +175 -0
  1024. package/examples/extensions/subagent/agents/planner.md +37 -0
  1025. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  1026. package/examples/extensions/subagent/agents/scout.md +50 -0
  1027. package/examples/extensions/subagent/agents/worker.md +24 -0
  1028. package/examples/extensions/subagent/agents.ts +126 -0
  1029. package/examples/extensions/subagent/index.ts +1009 -0
  1030. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  1031. package/examples/extensions/subagent/prompts/implement.md +10 -0
  1032. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  1033. package/examples/extensions/summarize.ts +207 -0
  1034. package/examples/extensions/system-prompt-header.ts +17 -0
  1035. package/examples/extensions/tic-tac-toe.ts +1008 -0
  1036. package/examples/extensions/timed-confirm.ts +70 -0
  1037. package/examples/extensions/titlebar-spinner.ts +58 -0
  1038. package/examples/extensions/todo.ts +297 -0
  1039. package/examples/extensions/tool-override.ts +144 -0
  1040. package/examples/extensions/tools.ts +146 -0
  1041. package/examples/extensions/trigger-compact.ts +50 -0
  1042. package/examples/extensions/truncated-tool.ts +195 -0
  1043. package/examples/extensions/widget-placement.ts +9 -0
  1044. package/examples/extensions/with-deps/index.ts +32 -0
  1045. package/examples/extensions/with-deps/package-lock.json +31 -0
  1046. package/examples/extensions/with-deps/package.json +22 -0
  1047. package/examples/extensions/working-indicator.ts +123 -0
  1048. package/examples/extensions/working-message-test.ts +25 -0
  1049. package/examples/rpc-extension-ui.ts +632 -0
  1050. package/examples/sdk/01-minimal.ts +26 -0
  1051. package/examples/sdk/02-custom-model.ts +50 -0
  1052. package/examples/sdk/03-custom-prompt.ts +70 -0
  1053. package/examples/sdk/04-skills.ts +55 -0
  1054. package/examples/sdk/05-tools.ts +48 -0
  1055. package/examples/sdk/06-extensions.ts +94 -0
  1056. package/examples/sdk/07-context-files.ts +42 -0
  1057. package/examples/sdk/08-prompt-templates.ts +51 -0
  1058. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  1059. package/examples/sdk/10-settings.ts +53 -0
  1060. package/examples/sdk/11-sessions.ts +52 -0
  1061. package/examples/sdk/12-full-control.ts +72 -0
  1062. package/examples/sdk/13-session-runtime.ts +67 -0
  1063. package/examples/sdk/README.md +140 -0
  1064. package/npm-shrinkwrap.json +1824 -0
  1065. package/package.json +99 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/statusline/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,gCAAgC,CAAC;AAqXrF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA0FzD","sourcesContent":["/**\n * statusline — fixed two-line footer for Pi.\n *\n * Balanced left/right layout:\n * Line 1: Model (provider) · effort ~cwd · branch\n * Line 2: CTX used/window ↑in ↓out R W CH $cost\n *\n * Extension statuses sit in the middle of line 2 when space permits.\n * Pi does not expose auto-compaction state to custom footer factories, so the\n * native `(auto)` marker cannot be reproduced without depending on private APIs.\n */\nimport type { AssistantMessage } from \"@earendil-works/pi-ai\";\nimport { truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { ExtensionAPI, ExtensionContext } from \"../../core/extensions/types.ts\";\nimport type { SessionEntry } from \"../../core/session-manager.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\n\nconst CONTEXT_WARNING_PERCENT = 70;\nconst CONTEXT_ERROR_PERCENT = 90;\nconst MIN_GAP = 1;\n\ntype ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\ninterface UsageSummary {\n\tinputTokens: number;\n\toutputTokens: number;\n\tcacheReadTokens: number;\n\tcacheWriteTokens: number;\n\tlatestCacheHitPercent?: number;\n\ttotalCost: number;\n}\n\ninterface UsageFormatOptions {\n\tincludeCacheRead: boolean;\n\tincludeCacheWrite: boolean;\n}\n\nfunction isTui(ctx: ExtensionContext): boolean {\n\treturn ctx.mode === \"tui\";\n}\n\n/** Shorten a path to `~` relative to the user's home directory. */\nfunction formatWorkingDirectory(cwd: string): string {\n\tconst rawHomeDirectory = process.env.USERPROFILE || process.env.HOME || \"\";\n\tconst homeDirectory = rawHomeDirectory.replace(/[\\\\/]+$/, \"\");\n\tif (!homeDirectory) return cwd;\n\n\tconst normalizePath = (filePath: string) => filePath.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\").toLowerCase();\n\tconst normalizedHomeDirectory = normalizePath(homeDirectory);\n\tconst normalizedCwd = normalizePath(cwd);\n\tif (normalizedCwd === normalizedHomeDirectory) return \"~\";\n\tif (normalizedCwd.startsWith(`${normalizedHomeDirectory}/`)) {\n\t\treturn `~${cwd.slice(homeDirectory.length).replace(/\\\\/g, \"/\")}`;\n\t}\n\treturn cwd;\n}\n\n/** Collapse a display path to `~/basename` or bare basename when tight. */\nfunction pathBasename(displayPath: string): string {\n\tconst normalized = displayPath.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n\tif (!normalized || normalized === \"~\") return normalized || displayPath;\n\tconst slash = normalized.lastIndexOf(\"/\");\n\tif (slash < 0) return normalized;\n\tconst base = normalized.slice(slash + 1);\n\tif (normalized.startsWith(\"~/\")) return `~/${base}`;\n\treturn base;\n}\n\n/** Format token counts like Pi's native footer: 999, 1.2k, 34k, 1.0M. */\nfunction formatTokenCount(tokenCount: number): string {\n\tif (tokenCount < 1000) return `${tokenCount}`;\n\tif (tokenCount < 10_000) return `${(tokenCount / 1000).toFixed(1)}k`;\n\tif (tokenCount < 1_000_000) return `${Math.round(tokenCount / 1000)}k`;\n\tif (tokenCount < 10_000_000) return `${(tokenCount / 1_000_000).toFixed(1)}M`;\n\treturn `${Math.round(tokenCount / 1_000_000)}M`;\n}\n\n/** Flatten extension status text to a single printable line. */\nfunction sanitizeStatus(text: string): string {\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\nfunction joinSegments(segments: string[], separator: string): string {\n\treturn segments.filter((segment) => segment.length > 0).join(separator);\n}\n\ninterface BranchStats {\n\tthinkingLevel: ThinkingLevel;\n\tusage: UsageSummary;\n}\n\n/**\n * One pass over the branch: latest thinking level + cumulative usage.\n * Cached across footer paints while leaf identity + usage fingerprint hold.\n */\nfunction computeBranchStats(branchEntries: SessionEntry[]): BranchStats {\n\tlet thinkingLevel: ThinkingLevel = \"off\";\n\tconst usage: UsageSummary = {\n\t\tinputTokens: 0,\n\t\toutputTokens: 0,\n\t\tcacheReadTokens: 0,\n\t\tcacheWriteTokens: 0,\n\t\ttotalCost: 0,\n\t};\n\n\tfor (const entry of branchEntries) {\n\t\tif (entry.type === \"thinking_level_change\") {\n\t\t\tthinkingLevel = entry.thinkingLevel as ThinkingLevel;\n\t\t\tcontinue;\n\t\t}\n\t\tif (entry.type !== \"message\" || entry.message.role !== \"assistant\") continue;\n\t\tconst assistantMessage = entry.message as AssistantMessage;\n\t\tconst inputTokens = assistantMessage.usage?.input ?? 0;\n\t\tconst outputTokens = assistantMessage.usage?.output ?? 0;\n\t\tconst cacheReadTokens = assistantMessage.usage?.cacheRead ?? 0;\n\t\tconst cacheWriteTokens = assistantMessage.usage?.cacheWrite ?? 0;\n\n\t\tusage.inputTokens += inputTokens;\n\t\tusage.outputTokens += outputTokens;\n\t\tusage.cacheReadTokens += cacheReadTokens;\n\t\tusage.cacheWriteTokens += cacheWriteTokens;\n\t\tusage.totalCost += assistantMessage.usage?.cost?.total ?? 0;\n\n\t\tconst latestPromptTokens = inputTokens + cacheReadTokens + cacheWriteTokens;\n\t\tconst latestRequestUsedCache = cacheReadTokens > 0 || cacheWriteTokens > 0;\n\t\tusage.latestCacheHitPercent =\n\t\t\tlatestRequestUsedCache && latestPromptTokens > 0 ? (cacheReadTokens / latestPromptTokens) * 100 : undefined;\n\t}\n\n\treturn { thinkingLevel, usage };\n}\n\n/**\n * Fingerprint the leaf so streaming usage updates invalidate even when the\n * SessionEntry object identity is reused in place.\n */\nfunction leafUsageFingerprint(entry: SessionEntry | undefined): string {\n\tif (!entry || entry.type !== \"message\" || entry.message.role !== \"assistant\") return \"\";\n\tconst assistantMessage = entry.message as AssistantMessage;\n\tconst usage = assistantMessage.usage;\n\tif (!usage) return \"\";\n\treturn [\n\t\tusage.input ?? 0,\n\t\tusage.output ?? 0,\n\t\tusage.cacheRead ?? 0,\n\t\tusage.cacheWrite ?? 0,\n\t\tusage.cost?.total ?? 0,\n\t].join(\":\");\n}\n\n/** Cache keyed by branch length + leaf identity + usage fingerprint. */\ninterface BranchStatsCache {\n\tlength: number;\n\tlastEntry: SessionEntry | undefined;\n\tleafUsage: string;\n\tstats: BranchStats;\n}\n\nfunction getBranchStats(branchEntries: SessionEntry[], cache: { current: BranchStatsCache | null }): BranchStats {\n\tconst lastEntry = branchEntries.length > 0 ? branchEntries[branchEntries.length - 1] : undefined;\n\tconst leafUsage = leafUsageFingerprint(lastEntry);\n\tconst cached = cache.current;\n\tif (\n\t\tcached &&\n\t\tcached.length === branchEntries.length &&\n\t\tcached.lastEntry === lastEntry &&\n\t\tcached.leafUsage === leafUsage\n\t) {\n\t\treturn cached.stats;\n\t}\n\n\tconst stats = computeBranchStats(branchEntries);\n\tcache.current = { length: branchEntries.length, lastEntry, leafUsage, stats };\n\treturn stats;\n}\n\n/** Avoid rebuilding the branch path (leaf→root walk) on every footer paint. */\ninterface BranchPathCache {\n\tleafId: string | null;\n\tentries: SessionEntry[];\n}\n\nfunction getBranchEntries(\n\tgetLeafId: () => string | null,\n\tgetBranch: () => SessionEntry[],\n\tcache: { current: BranchPathCache | null },\n): SessionEntry[] {\n\tconst leafId = getLeafId();\n\tconst cached = cache.current;\n\tif (cached && cached.leafId === leafId) return cached.entries;\n\tconst entries = getBranch();\n\tcache.current = { leafId, entries };\n\treturn entries;\n}\n\nfunction formatContextUsage(ctx: ExtensionContext, theme: Theme): string {\n\tconst contextUsage = ctx.getContextUsage();\n\tconst contextWindow = contextUsage?.contextWindow ?? ctx.model?.contextWindow;\n\tconst contextWindowSuffix = contextWindow ? `/${formatTokenCount(contextWindow)}` : \"\";\n\tif (contextUsage?.percent == null) {\n\t\treturn theme.fg(\"accent\", `CTX ?%${contextWindowSuffix}`);\n\t}\n\n\tconst label = `CTX ${contextUsage.percent.toFixed(1)}%${contextWindowSuffix}`;\n\tif (contextUsage.percent > CONTEXT_ERROR_PERCENT) return theme.fg(\"error\", label);\n\tif (contextUsage.percent > CONTEXT_WARNING_PERCENT) return theme.fg(\"warning\", label);\n\treturn theme.fg(\"accent\", label);\n}\n\nfunction formatUsageSummary(\n\tsummary: UsageSummary,\n\tusesSubscription: boolean,\n\ttheme: Theme,\n\toptions: UsageFormatOptions = { includeCacheRead: true, includeCacheWrite: true },\n): string {\n\tconst usageParts: string[] = [];\n\tif (summary.inputTokens > 0) usageParts.push(`↑${formatTokenCount(summary.inputTokens)}`);\n\tif (summary.outputTokens > 0) usageParts.push(`↓${formatTokenCount(summary.outputTokens)}`);\n\tif (options.includeCacheRead && summary.cacheReadTokens > 0) {\n\t\tusageParts.push(`R${formatTokenCount(summary.cacheReadTokens)}`);\n\t}\n\tif (options.includeCacheWrite && summary.cacheWriteTokens > 0) {\n\t\tusageParts.push(`W${formatTokenCount(summary.cacheWriteTokens)}`);\n\t}\n\tif (summary.latestCacheHitPercent !== undefined) {\n\t\tusageParts.push(`CH${summary.latestCacheHitPercent.toFixed(1)}%`);\n\t}\n\tif (summary.totalCost > 0) {\n\t\tusageParts.push(`$${summary.totalCost.toFixed(3)}${usesSubscription ? \" (sub)\" : \"\"}`);\n\t}\n\tif (usageParts.length === 0) return \"\";\n\treturn theme.fg(\"dim\", usageParts.join(\" \"));\n}\n\n/** True when the string already carries SGR color codes from an extension. */\nfunction hasAnsiColor(text: string): boolean {\n\treturn text.includes(\"\\x1b[\");\n}\n\nfunction formatExtensionStatuses(statuses: ReadonlyMap<string, string>, theme: Theme): string {\n\tconst parts = Array.from(statuses.entries())\n\t\t.sort(([firstKey], [secondKey]) => firstKey.localeCompare(secondKey))\n\t\t.map(([, text]) => sanitizeStatus(text))\n\t\t.filter(Boolean)\n\t\t// Extensions may pre-color status text. Don't re-wrap those.\n\t\t.map((text) => (hasAnsiColor(text) ? text : theme.fg(\"muted\", text)));\n\treturn parts.join(\" \");\n}\n\n/** Left-align `left`, right-align `right`, filling the gap with spaces. */\nfunction layoutLeftRight(left: string, right: string, width: number, theme: Theme): string {\n\tconst ellipsis = theme.fg(\"dim\", \"...\");\n\tif (width <= 0) return \"\";\n\tif (!right) return truncateToWidth(left, width, ellipsis);\n\tif (!left) {\n\t\tconst rightWidth = visibleWidth(right);\n\t\tif (rightWidth >= width) return truncateToWidth(right, width, ellipsis);\n\t\treturn `${\" \".repeat(width - rightWidth)}${right}`;\n\t}\n\n\tlet leftText = left;\n\tlet rightText = right;\n\tlet leftWidth = visibleWidth(leftText);\n\tlet rightWidth = visibleWidth(rightText);\n\n\tif (leftWidth + rightWidth + MIN_GAP > width) {\n\t\t// Prefer keeping the right side readable; give it up to ~45% when both compete.\n\t\tconst maxRightWidth = Math.min(rightWidth, Math.max(8, Math.floor(width * 0.45)));\n\t\tif (rightWidth > maxRightWidth) {\n\t\t\trightText = truncateToWidth(rightText, maxRightWidth, ellipsis);\n\t\t\trightWidth = visibleWidth(rightText);\n\t\t}\n\t\tconst maxLeftWidth = width - rightWidth - MIN_GAP;\n\t\tif (maxLeftWidth < 1) return truncateToWidth(rightText, width, ellipsis);\n\t\tleftText = truncateToWidth(leftText, maxLeftWidth, ellipsis);\n\t\tleftWidth = visibleWidth(leftText);\n\t}\n\n\tconst gap = Math.max(MIN_GAP, width - leftWidth - rightWidth);\n\treturn `${leftText}${\" \".repeat(gap)}${rightText}`;\n}\n\n/**\n * Line 2 zones: CTX left, optional extension status in the middle gap, usage right.\n * Drops middle first when space is tight; caller should pass progressively smaller rights.\n */\nfunction layoutSecondaryLine(\n\tcontextText: string,\n\tstatusText: string,\n\tusageText: string,\n\twidth: number,\n\ttheme: Theme,\n): string {\n\tconst ellipsis = theme.fg(\"dim\", \"...\");\n\tif (!usageText && !statusText) return truncateToWidth(contextText, width, ellipsis);\n\n\tconst rightText = usageText || statusText;\n\tconst middleText = usageText && statusText ? statusText : \"\";\n\n\tif (!middleText) return layoutLeftRight(contextText, rightText, width, theme);\n\n\tconst contextWidth = visibleWidth(contextText);\n\tconst usageWidth = visibleWidth(usageText);\n\tconst statusWidth = visibleWidth(statusText);\n\tconst needed = contextWidth + usageWidth + statusWidth + MIN_GAP * 2;\n\n\tif (needed <= width) {\n\t\tconst free = width - contextWidth - usageWidth - statusWidth;\n\t\tconst leftPad = Math.floor(free / 2);\n\t\tconst rightPad = free - leftPad;\n\t\treturn `${contextText}${\" \".repeat(leftPad)}${statusText}${\" \".repeat(rightPad)}${usageText}`;\n\t}\n\n\t// Not enough room for a full middle status — keep CTX · usage, drop status.\n\treturn layoutLeftRight(contextText, usageText, width, theme);\n}\n\nfunction fitsLeftRight(left: string, right: string, width: number): boolean {\n\tif (!right) return visibleWidth(left) <= width;\n\tif (!left) return visibleWidth(right) <= width;\n\treturn visibleWidth(left) + visibleWidth(right) + MIN_GAP <= width;\n}\n\n/** Progressive drop: branch → short path → drop provider → truncate. */\nfunction fitPrimaryLine(options: {\n\tmodelWithProvider: string;\n\tmodelName: string;\n\teffortPart: string;\n\tcwdFull: string;\n\tcwdShort: string;\n\tbranchPart: string;\n\tseparator: string;\n\twidth: number;\n\ttheme: Theme;\n}): string {\n\tconst { modelWithProvider, modelName, effortPart, cwdFull, cwdShort, branchPart, separator, width, theme } = options;\n\n\tconst leftRich = joinSegments([modelWithProvider, effortPart], separator);\n\tconst leftPlain = joinSegments([modelName, effortPart], separator);\n\n\tconst candidates: Array<{ left: string; right: string }> = [\n\t\t{ left: leftRich, right: joinSegments([cwdFull, branchPart], separator) },\n\t\t{ left: leftRich, right: cwdFull },\n\t\t{ left: leftRich, right: joinSegments([cwdShort, branchPart], separator) },\n\t\t{ left: leftRich, right: cwdShort },\n\t\t{ left: leftPlain, right: joinSegments([cwdShort, branchPart], separator) },\n\t\t{ left: leftPlain, right: cwdShort },\n\t\t{ left: leftPlain, right: \"\" },\n\t];\n\n\tfor (const candidate of candidates) {\n\t\tif (fitsLeftRight(candidate.left, candidate.right, width)) {\n\t\t\treturn layoutLeftRight(candidate.left, candidate.right, width, theme);\n\t\t}\n\t}\n\n\treturn layoutLeftRight(leftPlain, cwdShort, width, theme);\n}\n\n/** Progressive drop on the usage side: full → drop W → drop R; status fills middle when space allows. */\nfunction fitSecondaryLine(options: {\n\tcontextText: string;\n\tstatusText: string;\n\tusageCandidates: string[];\n\twidth: number;\n\ttheme: Theme;\n}): string {\n\tconst { contextText, statusText, usageCandidates, width, theme } = options;\n\n\tif (usageCandidates.length === 0) {\n\t\treturn layoutLeftRight(contextText, statusText, width, theme);\n\t}\n\n\tfor (const usageText of usageCandidates) {\n\t\tif (fitsLeftRight(contextText, usageText, width)) {\n\t\t\treturn layoutSecondaryLine(contextText, statusText, usageText, width, theme);\n\t\t}\n\t}\n\n\tconst fallbackUsage = usageCandidates[0] ?? \"\";\n\treturn layoutLeftRight(contextText, fallbackUsage, width, theme);\n}\n\nexport default function statusline(pi: ExtensionAPI): void {\n\tpi.on(\"session_start\", (_event, ctx) => {\n\t\tif (!isTui(ctx)) return;\n\n\t\t// Per-footer instance: branch path + stats cached across paints until the\n\t\t// leaf moves (or streaming usage on the leaf changes).\n\t\tconst branchPathCache: { current: BranchPathCache | null } = { current: null };\n\t\tconst branchStatsCache: { current: BranchStatsCache | null } = { current: null };\n\n\t\tctx.ui.setFooter((tui, theme, footerData) => {\n\t\t\tconst unsubscribeFromBranchChanges = footerData.onBranchChange(() => tui.requestRender());\n\t\t\treturn {\n\t\t\t\tdispose: unsubscribeFromBranchChanges,\n\t\t\t\tinvalidate() {\n\t\t\t\t\tbranchPathCache.current = null;\n\t\t\t\t\tbranchStatsCache.current = null;\n\t\t\t\t},\n\t\t\t\trender(width: number): string[] {\n\t\t\t\t\tconst branchEntries = getBranchEntries(\n\t\t\t\t\t\t() => ctx.sessionManager.getLeafId(),\n\t\t\t\t\t\t() => ctx.sessionManager.getBranch(),\n\t\t\t\t\t\tbranchPathCache,\n\t\t\t\t\t);\n\t\t\t\t\tconst { thinkingLevel, usage: usageSummary } = getBranchStats(branchEntries, branchStatsCache);\n\t\t\t\t\tconst model = ctx.model;\n\t\t\t\t\tconst modelName = theme.fg(\"toolTitle\", theme.bold(model?.name ?? model?.id ?? \"no-model\"));\n\t\t\t\t\tconst providerPart = model?.provider ? theme.fg(\"muted\", `(${model.provider})`) : \"\";\n\t\t\t\t\tconst modelWithProvider = providerPart ? `${modelName} ${providerPart}` : modelName;\n\n\t\t\t\t\tlet effortPart = \"\";\n\t\t\t\t\tif (model?.reasoning && thinkingLevel !== \"off\") {\n\t\t\t\t\t\teffortPart = theme.getThinkingBorderColor(thinkingLevel)(thinkingLevel);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst separator = theme.fg(\"dim\", \" · \");\n\t\t\t\t\tconst cwdDisplay = formatWorkingDirectory(ctx.cwd);\n\t\t\t\t\tconst cwdFull = theme.fg(\"success\", cwdDisplay);\n\t\t\t\t\tconst cwdShort = theme.fg(\"success\", pathBasename(cwdDisplay));\n\t\t\t\t\tconst gitBranch = footerData.getGitBranch();\n\t\t\t\t\tconst branchPart = gitBranch ? theme.fg(\"accent\", gitBranch) : \"\";\n\n\t\t\t\t\tconst primaryLine = fitPrimaryLine({\n\t\t\t\t\t\tmodelWithProvider,\n\t\t\t\t\t\tmodelName,\n\t\t\t\t\t\teffortPart,\n\t\t\t\t\t\tcwdFull,\n\t\t\t\t\t\tcwdShort,\n\t\t\t\t\t\tbranchPart,\n\t\t\t\t\t\tseparator,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\ttheme,\n\t\t\t\t\t});\n\n\t\t\t\t\tconst contextText = formatContextUsage(ctx, theme);\n\t\t\t\t\tconst usesSubscription = model ? ctx.modelRegistry.isUsingOAuth(model) : false;\n\t\t\t\t\tconst usageCandidates = [\n\t\t\t\t\t\tformatUsageSummary(usageSummary, usesSubscription, theme, {\n\t\t\t\t\t\t\tincludeCacheRead: true,\n\t\t\t\t\t\t\tincludeCacheWrite: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tformatUsageSummary(usageSummary, usesSubscription, theme, {\n\t\t\t\t\t\t\tincludeCacheRead: true,\n\t\t\t\t\t\t\tincludeCacheWrite: false,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tformatUsageSummary(usageSummary, usesSubscription, theme, {\n\t\t\t\t\t\t\tincludeCacheRead: false,\n\t\t\t\t\t\t\tincludeCacheWrite: false,\n\t\t\t\t\t\t}),\n\t\t\t\t\t];\n\t\t\t\t\t// Deduplicate identical progressive candidates (e.g. when W/R are zero).\n\t\t\t\t\tconst uniqueUsageCandidates = [...new Set(usageCandidates.filter(Boolean))];\n\t\t\t\t\tconst statusText = formatExtensionStatuses(footerData.getExtensionStatuses(), theme);\n\n\t\t\t\t\tconst secondaryLine = fitSecondaryLine({\n\t\t\t\t\t\tcontextText,\n\t\t\t\t\t\tstatusText,\n\t\t\t\t\t\tusageCandidates: uniqueUsageCandidates,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\ttheme,\n\t\t\t\t\t});\n\n\t\t\t\t\treturn [primaryLine, secondaryLine];\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\t});\n\n\tpi.on(\"session_shutdown\", (_event, ctx) => {\n\t\tif (isTui(ctx)) ctx.ui.setFooter(undefined);\n\t});\n}\n"]}
@@ -0,0 +1,367 @@
1
+ import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
2
+ const CONTEXT_WARNING_PERCENT = 70;
3
+ const CONTEXT_ERROR_PERCENT = 90;
4
+ const MIN_GAP = 1;
5
+ function isTui(ctx) {
6
+ return ctx.mode === "tui";
7
+ }
8
+ /** Shorten a path to `~` relative to the user's home directory. */
9
+ function formatWorkingDirectory(cwd) {
10
+ const rawHomeDirectory = process.env.USERPROFILE || process.env.HOME || "";
11
+ const homeDirectory = rawHomeDirectory.replace(/[\\/]+$/, "");
12
+ if (!homeDirectory)
13
+ return cwd;
14
+ const normalizePath = (filePath) => filePath.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
15
+ const normalizedHomeDirectory = normalizePath(homeDirectory);
16
+ const normalizedCwd = normalizePath(cwd);
17
+ if (normalizedCwd === normalizedHomeDirectory)
18
+ return "~";
19
+ if (normalizedCwd.startsWith(`${normalizedHomeDirectory}/`)) {
20
+ return `~${cwd.slice(homeDirectory.length).replace(/\\/g, "/")}`;
21
+ }
22
+ return cwd;
23
+ }
24
+ /** Collapse a display path to `~/basename` or bare basename when tight. */
25
+ function pathBasename(displayPath) {
26
+ const normalized = displayPath.replace(/\\/g, "/").replace(/\/+$/, "");
27
+ if (!normalized || normalized === "~")
28
+ return normalized || displayPath;
29
+ const slash = normalized.lastIndexOf("/");
30
+ if (slash < 0)
31
+ return normalized;
32
+ const base = normalized.slice(slash + 1);
33
+ if (normalized.startsWith("~/"))
34
+ return `~/${base}`;
35
+ return base;
36
+ }
37
+ /** Format token counts like Pi's native footer: 999, 1.2k, 34k, 1.0M. */
38
+ function formatTokenCount(tokenCount) {
39
+ if (tokenCount < 1000)
40
+ return `${tokenCount}`;
41
+ if (tokenCount < 10_000)
42
+ return `${(tokenCount / 1000).toFixed(1)}k`;
43
+ if (tokenCount < 1_000_000)
44
+ return `${Math.round(tokenCount / 1000)}k`;
45
+ if (tokenCount < 10_000_000)
46
+ return `${(tokenCount / 1_000_000).toFixed(1)}M`;
47
+ return `${Math.round(tokenCount / 1_000_000)}M`;
48
+ }
49
+ /** Flatten extension status text to a single printable line. */
50
+ function sanitizeStatus(text) {
51
+ return text
52
+ .replace(/[\r\n\t]/g, " ")
53
+ .replace(/ +/g, " ")
54
+ .trim();
55
+ }
56
+ function joinSegments(segments, separator) {
57
+ return segments.filter((segment) => segment.length > 0).join(separator);
58
+ }
59
+ /**
60
+ * One pass over the branch: latest thinking level + cumulative usage.
61
+ * Cached across footer paints while leaf identity + usage fingerprint hold.
62
+ */
63
+ function computeBranchStats(branchEntries) {
64
+ let thinkingLevel = "off";
65
+ const usage = {
66
+ inputTokens: 0,
67
+ outputTokens: 0,
68
+ cacheReadTokens: 0,
69
+ cacheWriteTokens: 0,
70
+ totalCost: 0,
71
+ };
72
+ for (const entry of branchEntries) {
73
+ if (entry.type === "thinking_level_change") {
74
+ thinkingLevel = entry.thinkingLevel;
75
+ continue;
76
+ }
77
+ if (entry.type !== "message" || entry.message.role !== "assistant")
78
+ continue;
79
+ const assistantMessage = entry.message;
80
+ const inputTokens = assistantMessage.usage?.input ?? 0;
81
+ const outputTokens = assistantMessage.usage?.output ?? 0;
82
+ const cacheReadTokens = assistantMessage.usage?.cacheRead ?? 0;
83
+ const cacheWriteTokens = assistantMessage.usage?.cacheWrite ?? 0;
84
+ usage.inputTokens += inputTokens;
85
+ usage.outputTokens += outputTokens;
86
+ usage.cacheReadTokens += cacheReadTokens;
87
+ usage.cacheWriteTokens += cacheWriteTokens;
88
+ usage.totalCost += assistantMessage.usage?.cost?.total ?? 0;
89
+ const latestPromptTokens = inputTokens + cacheReadTokens + cacheWriteTokens;
90
+ const latestRequestUsedCache = cacheReadTokens > 0 || cacheWriteTokens > 0;
91
+ usage.latestCacheHitPercent =
92
+ latestRequestUsedCache && latestPromptTokens > 0 ? (cacheReadTokens / latestPromptTokens) * 100 : undefined;
93
+ }
94
+ return { thinkingLevel, usage };
95
+ }
96
+ /**
97
+ * Fingerprint the leaf so streaming usage updates invalidate even when the
98
+ * SessionEntry object identity is reused in place.
99
+ */
100
+ function leafUsageFingerprint(entry) {
101
+ if (!entry || entry.type !== "message" || entry.message.role !== "assistant")
102
+ return "";
103
+ const assistantMessage = entry.message;
104
+ const usage = assistantMessage.usage;
105
+ if (!usage)
106
+ return "";
107
+ return [
108
+ usage.input ?? 0,
109
+ usage.output ?? 0,
110
+ usage.cacheRead ?? 0,
111
+ usage.cacheWrite ?? 0,
112
+ usage.cost?.total ?? 0,
113
+ ].join(":");
114
+ }
115
+ function getBranchStats(branchEntries, cache) {
116
+ const lastEntry = branchEntries.length > 0 ? branchEntries[branchEntries.length - 1] : undefined;
117
+ const leafUsage = leafUsageFingerprint(lastEntry);
118
+ const cached = cache.current;
119
+ if (cached &&
120
+ cached.length === branchEntries.length &&
121
+ cached.lastEntry === lastEntry &&
122
+ cached.leafUsage === leafUsage) {
123
+ return cached.stats;
124
+ }
125
+ const stats = computeBranchStats(branchEntries);
126
+ cache.current = { length: branchEntries.length, lastEntry, leafUsage, stats };
127
+ return stats;
128
+ }
129
+ function getBranchEntries(getLeafId, getBranch, cache) {
130
+ const leafId = getLeafId();
131
+ const cached = cache.current;
132
+ if (cached && cached.leafId === leafId)
133
+ return cached.entries;
134
+ const entries = getBranch();
135
+ cache.current = { leafId, entries };
136
+ return entries;
137
+ }
138
+ function formatContextUsage(ctx, theme) {
139
+ const contextUsage = ctx.getContextUsage();
140
+ const contextWindow = contextUsage?.contextWindow ?? ctx.model?.contextWindow;
141
+ const contextWindowSuffix = contextWindow ? `/${formatTokenCount(contextWindow)}` : "";
142
+ if (contextUsage?.percent == null) {
143
+ return theme.fg("accent", `CTX ?%${contextWindowSuffix}`);
144
+ }
145
+ const label = `CTX ${contextUsage.percent.toFixed(1)}%${contextWindowSuffix}`;
146
+ if (contextUsage.percent > CONTEXT_ERROR_PERCENT)
147
+ return theme.fg("error", label);
148
+ if (contextUsage.percent > CONTEXT_WARNING_PERCENT)
149
+ return theme.fg("warning", label);
150
+ return theme.fg("accent", label);
151
+ }
152
+ function formatUsageSummary(summary, usesSubscription, theme, options = { includeCacheRead: true, includeCacheWrite: true }) {
153
+ const usageParts = [];
154
+ if (summary.inputTokens > 0)
155
+ usageParts.push(`↑${formatTokenCount(summary.inputTokens)}`);
156
+ if (summary.outputTokens > 0)
157
+ usageParts.push(`↓${formatTokenCount(summary.outputTokens)}`);
158
+ if (options.includeCacheRead && summary.cacheReadTokens > 0) {
159
+ usageParts.push(`R${formatTokenCount(summary.cacheReadTokens)}`);
160
+ }
161
+ if (options.includeCacheWrite && summary.cacheWriteTokens > 0) {
162
+ usageParts.push(`W${formatTokenCount(summary.cacheWriteTokens)}`);
163
+ }
164
+ if (summary.latestCacheHitPercent !== undefined) {
165
+ usageParts.push(`CH${summary.latestCacheHitPercent.toFixed(1)}%`);
166
+ }
167
+ if (summary.totalCost > 0) {
168
+ usageParts.push(`$${summary.totalCost.toFixed(3)}${usesSubscription ? " (sub)" : ""}`);
169
+ }
170
+ if (usageParts.length === 0)
171
+ return "";
172
+ return theme.fg("dim", usageParts.join(" "));
173
+ }
174
+ /** True when the string already carries SGR color codes from an extension. */
175
+ function hasAnsiColor(text) {
176
+ return text.includes("\x1b[");
177
+ }
178
+ function formatExtensionStatuses(statuses, theme) {
179
+ const parts = Array.from(statuses.entries())
180
+ .sort(([firstKey], [secondKey]) => firstKey.localeCompare(secondKey))
181
+ .map(([, text]) => sanitizeStatus(text))
182
+ .filter(Boolean)
183
+ // Extensions may pre-color status text. Don't re-wrap those.
184
+ .map((text) => (hasAnsiColor(text) ? text : theme.fg("muted", text)));
185
+ return parts.join(" ");
186
+ }
187
+ /** Left-align `left`, right-align `right`, filling the gap with spaces. */
188
+ function layoutLeftRight(left, right, width, theme) {
189
+ const ellipsis = theme.fg("dim", "...");
190
+ if (width <= 0)
191
+ return "";
192
+ if (!right)
193
+ return truncateToWidth(left, width, ellipsis);
194
+ if (!left) {
195
+ const rightWidth = visibleWidth(right);
196
+ if (rightWidth >= width)
197
+ return truncateToWidth(right, width, ellipsis);
198
+ return `${" ".repeat(width - rightWidth)}${right}`;
199
+ }
200
+ let leftText = left;
201
+ let rightText = right;
202
+ let leftWidth = visibleWidth(leftText);
203
+ let rightWidth = visibleWidth(rightText);
204
+ if (leftWidth + rightWidth + MIN_GAP > width) {
205
+ // Prefer keeping the right side readable; give it up to ~45% when both compete.
206
+ const maxRightWidth = Math.min(rightWidth, Math.max(8, Math.floor(width * 0.45)));
207
+ if (rightWidth > maxRightWidth) {
208
+ rightText = truncateToWidth(rightText, maxRightWidth, ellipsis);
209
+ rightWidth = visibleWidth(rightText);
210
+ }
211
+ const maxLeftWidth = width - rightWidth - MIN_GAP;
212
+ if (maxLeftWidth < 1)
213
+ return truncateToWidth(rightText, width, ellipsis);
214
+ leftText = truncateToWidth(leftText, maxLeftWidth, ellipsis);
215
+ leftWidth = visibleWidth(leftText);
216
+ }
217
+ const gap = Math.max(MIN_GAP, width - leftWidth - rightWidth);
218
+ return `${leftText}${" ".repeat(gap)}${rightText}`;
219
+ }
220
+ /**
221
+ * Line 2 zones: CTX left, optional extension status in the middle gap, usage right.
222
+ * Drops middle first when space is tight; caller should pass progressively smaller rights.
223
+ */
224
+ function layoutSecondaryLine(contextText, statusText, usageText, width, theme) {
225
+ const ellipsis = theme.fg("dim", "...");
226
+ if (!usageText && !statusText)
227
+ return truncateToWidth(contextText, width, ellipsis);
228
+ const rightText = usageText || statusText;
229
+ const middleText = usageText && statusText ? statusText : "";
230
+ if (!middleText)
231
+ return layoutLeftRight(contextText, rightText, width, theme);
232
+ const contextWidth = visibleWidth(contextText);
233
+ const usageWidth = visibleWidth(usageText);
234
+ const statusWidth = visibleWidth(statusText);
235
+ const needed = contextWidth + usageWidth + statusWidth + MIN_GAP * 2;
236
+ if (needed <= width) {
237
+ const free = width - contextWidth - usageWidth - statusWidth;
238
+ const leftPad = Math.floor(free / 2);
239
+ const rightPad = free - leftPad;
240
+ return `${contextText}${" ".repeat(leftPad)}${statusText}${" ".repeat(rightPad)}${usageText}`;
241
+ }
242
+ // Not enough room for a full middle status — keep CTX · usage, drop status.
243
+ return layoutLeftRight(contextText, usageText, width, theme);
244
+ }
245
+ function fitsLeftRight(left, right, width) {
246
+ if (!right)
247
+ return visibleWidth(left) <= width;
248
+ if (!left)
249
+ return visibleWidth(right) <= width;
250
+ return visibleWidth(left) + visibleWidth(right) + MIN_GAP <= width;
251
+ }
252
+ /** Progressive drop: branch → short path → drop provider → truncate. */
253
+ function fitPrimaryLine(options) {
254
+ const { modelWithProvider, modelName, effortPart, cwdFull, cwdShort, branchPart, separator, width, theme } = options;
255
+ const leftRich = joinSegments([modelWithProvider, effortPart], separator);
256
+ const leftPlain = joinSegments([modelName, effortPart], separator);
257
+ const candidates = [
258
+ { left: leftRich, right: joinSegments([cwdFull, branchPart], separator) },
259
+ { left: leftRich, right: cwdFull },
260
+ { left: leftRich, right: joinSegments([cwdShort, branchPart], separator) },
261
+ { left: leftRich, right: cwdShort },
262
+ { left: leftPlain, right: joinSegments([cwdShort, branchPart], separator) },
263
+ { left: leftPlain, right: cwdShort },
264
+ { left: leftPlain, right: "" },
265
+ ];
266
+ for (const candidate of candidates) {
267
+ if (fitsLeftRight(candidate.left, candidate.right, width)) {
268
+ return layoutLeftRight(candidate.left, candidate.right, width, theme);
269
+ }
270
+ }
271
+ return layoutLeftRight(leftPlain, cwdShort, width, theme);
272
+ }
273
+ /** Progressive drop on the usage side: full → drop W → drop R; status fills middle when space allows. */
274
+ function fitSecondaryLine(options) {
275
+ const { contextText, statusText, usageCandidates, width, theme } = options;
276
+ if (usageCandidates.length === 0) {
277
+ return layoutLeftRight(contextText, statusText, width, theme);
278
+ }
279
+ for (const usageText of usageCandidates) {
280
+ if (fitsLeftRight(contextText, usageText, width)) {
281
+ return layoutSecondaryLine(contextText, statusText, usageText, width, theme);
282
+ }
283
+ }
284
+ const fallbackUsage = usageCandidates[0] ?? "";
285
+ return layoutLeftRight(contextText, fallbackUsage, width, theme);
286
+ }
287
+ export default function statusline(pi) {
288
+ pi.on("session_start", (_event, ctx) => {
289
+ if (!isTui(ctx))
290
+ return;
291
+ // Per-footer instance: branch path + stats cached across paints until the
292
+ // leaf moves (or streaming usage on the leaf changes).
293
+ const branchPathCache = { current: null };
294
+ const branchStatsCache = { current: null };
295
+ ctx.ui.setFooter((tui, theme, footerData) => {
296
+ const unsubscribeFromBranchChanges = footerData.onBranchChange(() => tui.requestRender());
297
+ return {
298
+ dispose: unsubscribeFromBranchChanges,
299
+ invalidate() {
300
+ branchPathCache.current = null;
301
+ branchStatsCache.current = null;
302
+ },
303
+ render(width) {
304
+ const branchEntries = getBranchEntries(() => ctx.sessionManager.getLeafId(), () => ctx.sessionManager.getBranch(), branchPathCache);
305
+ const { thinkingLevel, usage: usageSummary } = getBranchStats(branchEntries, branchStatsCache);
306
+ const model = ctx.model;
307
+ const modelName = theme.fg("toolTitle", theme.bold(model?.name ?? model?.id ?? "no-model"));
308
+ const providerPart = model?.provider ? theme.fg("muted", `(${model.provider})`) : "";
309
+ const modelWithProvider = providerPart ? `${modelName} ${providerPart}` : modelName;
310
+ let effortPart = "";
311
+ if (model?.reasoning && thinkingLevel !== "off") {
312
+ effortPart = theme.getThinkingBorderColor(thinkingLevel)(thinkingLevel);
313
+ }
314
+ const separator = theme.fg("dim", " · ");
315
+ const cwdDisplay = formatWorkingDirectory(ctx.cwd);
316
+ const cwdFull = theme.fg("success", cwdDisplay);
317
+ const cwdShort = theme.fg("success", pathBasename(cwdDisplay));
318
+ const gitBranch = footerData.getGitBranch();
319
+ const branchPart = gitBranch ? theme.fg("accent", gitBranch) : "";
320
+ const primaryLine = fitPrimaryLine({
321
+ modelWithProvider,
322
+ modelName,
323
+ effortPart,
324
+ cwdFull,
325
+ cwdShort,
326
+ branchPart,
327
+ separator,
328
+ width,
329
+ theme,
330
+ });
331
+ const contextText = formatContextUsage(ctx, theme);
332
+ const usesSubscription = model ? ctx.modelRegistry.isUsingOAuth(model) : false;
333
+ const usageCandidates = [
334
+ formatUsageSummary(usageSummary, usesSubscription, theme, {
335
+ includeCacheRead: true,
336
+ includeCacheWrite: true,
337
+ }),
338
+ formatUsageSummary(usageSummary, usesSubscription, theme, {
339
+ includeCacheRead: true,
340
+ includeCacheWrite: false,
341
+ }),
342
+ formatUsageSummary(usageSummary, usesSubscription, theme, {
343
+ includeCacheRead: false,
344
+ includeCacheWrite: false,
345
+ }),
346
+ ];
347
+ // Deduplicate identical progressive candidates (e.g. when W/R are zero).
348
+ const uniqueUsageCandidates = [...new Set(usageCandidates.filter(Boolean))];
349
+ const statusText = formatExtensionStatuses(footerData.getExtensionStatuses(), theme);
350
+ const secondaryLine = fitSecondaryLine({
351
+ contextText,
352
+ statusText,
353
+ usageCandidates: uniqueUsageCandidates,
354
+ width,
355
+ theme,
356
+ });
357
+ return [primaryLine, secondaryLine];
358
+ },
359
+ };
360
+ });
361
+ });
362
+ pi.on("session_shutdown", (_event, ctx) => {
363
+ if (isTui(ctx))
364
+ ctx.ui.setFooter(undefined);
365
+ });
366
+ }
367
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/statusline/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKvE,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,OAAO,GAAG,CAAC,CAAC;AAkBlB,SAAS,KAAK,CAAC,GAAqB,EAAW;IAC9C,OAAO,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC;AAAA,CAC1B;AAED,mEAAmE;AACnE,SAAS,sBAAsB,CAAC,GAAW,EAAU;IACpD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CA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gB,CAAC;wBACtC,WAAW;wBACX,UAAU;wBACV,eAAe,EAAE,qBAAqB;wBACtC,KAAK;wBACL,KAAK;qBACL,CAAC,CAAC;oBAEH,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;gBAAA,CACpC;aACD,CAAC;QAAA,CACF,CAAC,CAAC;IAAA,CACH,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,GAAG,CAAC;YAAE,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAAA,CAC5C,CAAC,CAAC;AAAA,CACH","sourcesContent":["/**\n * statusline — fixed two-line footer for Pi.\n *\n * Balanced left/right layout:\n * Line 1: Model (provider) · effort ~cwd · branch\n * Line 2: CTX used/window ↑in ↓out R W CH $cost\n *\n * Extension statuses sit in the middle of line 2 when space permits.\n * Pi does not expose auto-compaction state to custom footer factories, so the\n * native `(auto)` marker cannot be reproduced without depending on private APIs.\n */\nimport type { AssistantMessage } from \"@earendil-works/pi-ai\";\nimport { truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { ExtensionAPI, ExtensionContext } from \"../../core/extensions/types.ts\";\nimport type { SessionEntry } from \"../../core/session-manager.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\n\nconst CONTEXT_WARNING_PERCENT = 70;\nconst CONTEXT_ERROR_PERCENT = 90;\nconst MIN_GAP = 1;\n\ntype ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\ninterface UsageSummary {\n\tinputTokens: number;\n\toutputTokens: number;\n\tcacheReadTokens: number;\n\tcacheWriteTokens: number;\n\tlatestCacheHitPercent?: number;\n\ttotalCost: number;\n}\n\ninterface UsageFormatOptions {\n\tincludeCacheRead: boolean;\n\tincludeCacheWrite: boolean;\n}\n\nfunction isTui(ctx: ExtensionContext): boolean {\n\treturn ctx.mode === \"tui\";\n}\n\n/** Shorten a path to `~` relative to the user's home directory. */\nfunction formatWorkingDirectory(cwd: string): string {\n\tconst rawHomeDirectory = process.env.USERPROFILE || process.env.HOME || \"\";\n\tconst homeDirectory = rawHomeDirectory.replace(/[\\\\/]+$/, \"\");\n\tif (!homeDirectory) return cwd;\n\n\tconst normalizePath = (filePath: string) => filePath.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\").toLowerCase();\n\tconst normalizedHomeDirectory = normalizePath(homeDirectory);\n\tconst normalizedCwd = normalizePath(cwd);\n\tif (normalizedCwd === normalizedHomeDirectory) return \"~\";\n\tif (normalizedCwd.startsWith(`${normalizedHomeDirectory}/`)) {\n\t\treturn `~${cwd.slice(homeDirectory.length).replace(/\\\\/g, \"/\")}`;\n\t}\n\treturn cwd;\n}\n\n/** Collapse a display path to `~/basename` or bare basename when tight. */\nfunction pathBasename(displayPath: string): string {\n\tconst normalized = displayPath.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n\tif (!normalized || normalized === \"~\") return normalized || displayPath;\n\tconst slash = normalized.lastIndexOf(\"/\");\n\tif (slash < 0) return normalized;\n\tconst base = normalized.slice(slash + 1);\n\tif (normalized.startsWith(\"~/\")) return `~/${base}`;\n\treturn base;\n}\n\n/** Format token counts like Pi's native footer: 999, 1.2k, 34k, 1.0M. */\nfunction formatTokenCount(tokenCount: number): string {\n\tif (tokenCount < 1000) return `${tokenCount}`;\n\tif (tokenCount < 10_000) return `${(tokenCount / 1000).toFixed(1)}k`;\n\tif (tokenCount < 1_000_000) return `${Math.round(tokenCount / 1000)}k`;\n\tif (tokenCount < 10_000_000) return `${(tokenCount / 1_000_000).toFixed(1)}M`;\n\treturn `${Math.round(tokenCount / 1_000_000)}M`;\n}\n\n/** Flatten extension status text to a single printable line. */\nfunction sanitizeStatus(text: string): string {\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\nfunction joinSegments(segments: string[], separator: string): string {\n\treturn segments.filter((segment) => segment.length > 0).join(separator);\n}\n\ninterface BranchStats {\n\tthinkingLevel: ThinkingLevel;\n\tusage: UsageSummary;\n}\n\n/**\n * One pass over the branch: latest thinking level + cumulative usage.\n * Cached across footer paints while leaf identity + usage fingerprint hold.\n */\nfunction computeBranchStats(branchEntries: SessionEntry[]): BranchStats {\n\tlet thinkingLevel: ThinkingLevel = \"off\";\n\tconst usage: UsageSummary = {\n\t\tinputTokens: 0,\n\t\toutputTokens: 0,\n\t\tcacheReadTokens: 0,\n\t\tcacheWriteTokens: 0,\n\t\ttotalCost: 0,\n\t};\n\n\tfor (const entry of branchEntries) {\n\t\tif (entry.type === \"thinking_level_change\") {\n\t\t\tthinkingLevel = entry.thinkingLevel as ThinkingLevel;\n\t\t\tcontinue;\n\t\t}\n\t\tif (entry.type !== \"message\" || entry.message.role !== \"assistant\") continue;\n\t\tconst assistantMessage = entry.message as AssistantMessage;\n\t\tconst inputTokens = assistantMessage.usage?.input ?? 0;\n\t\tconst outputTokens = assistantMessage.usage?.output ?? 0;\n\t\tconst cacheReadTokens = assistantMessage.usage?.cacheRead ?? 0;\n\t\tconst cacheWriteTokens = assistantMessage.usage?.cacheWrite ?? 0;\n\n\t\tusage.inputTokens += inputTokens;\n\t\tusage.outputTokens += outputTokens;\n\t\tusage.cacheReadTokens += cacheReadTokens;\n\t\tusage.cacheWriteTokens += cacheWriteTokens;\n\t\tusage.totalCost += assistantMessage.usage?.cost?.total ?? 0;\n\n\t\tconst latestPromptTokens = inputTokens + cacheReadTokens + cacheWriteTokens;\n\t\tconst latestRequestUsedCache = cacheReadTokens > 0 || cacheWriteTokens > 0;\n\t\tusage.latestCacheHitPercent =\n\t\t\tlatestRequestUsedCache && latestPromptTokens > 0 ? (cacheReadTokens / latestPromptTokens) * 100 : undefined;\n\t}\n\n\treturn { thinkingLevel, usage };\n}\n\n/**\n * Fingerprint the leaf so streaming usage updates invalidate even when the\n * SessionEntry object identity is reused in place.\n */\nfunction leafUsageFingerprint(entry: SessionEntry | undefined): string {\n\tif (!entry || entry.type !== \"message\" || entry.message.role !== \"assistant\") return \"\";\n\tconst assistantMessage = entry.message as AssistantMessage;\n\tconst usage = assistantMessage.usage;\n\tif (!usage) return \"\";\n\treturn [\n\t\tusage.input ?? 0,\n\t\tusage.output ?? 0,\n\t\tusage.cacheRead ?? 0,\n\t\tusage.cacheWrite ?? 0,\n\t\tusage.cost?.total ?? 0,\n\t].join(\":\");\n}\n\n/** Cache keyed by branch length + leaf identity + usage fingerprint. */\ninterface BranchStatsCache {\n\tlength: number;\n\tlastEntry: SessionEntry | undefined;\n\tleafUsage: string;\n\tstats: BranchStats;\n}\n\nfunction getBranchStats(branchEntries: SessionEntry[], cache: { current: BranchStatsCache | null }): BranchStats {\n\tconst lastEntry = branchEntries.length > 0 ? branchEntries[branchEntries.length - 1] : undefined;\n\tconst leafUsage = leafUsageFingerprint(lastEntry);\n\tconst cached = cache.current;\n\tif (\n\t\tcached &&\n\t\tcached.length === branchEntries.length &&\n\t\tcached.lastEntry === lastEntry &&\n\t\tcached.leafUsage === leafUsage\n\t) {\n\t\treturn cached.stats;\n\t}\n\n\tconst stats = computeBranchStats(branchEntries);\n\tcache.current = { length: branchEntries.length, lastEntry, leafUsage, stats };\n\treturn stats;\n}\n\n/** Avoid rebuilding the branch path (leaf→root walk) on every footer paint. */\ninterface BranchPathCache {\n\tleafId: string | null;\n\tentries: SessionEntry[];\n}\n\nfunction getBranchEntries(\n\tgetLeafId: () => string | null,\n\tgetBranch: () => SessionEntry[],\n\tcache: { current: BranchPathCache | null },\n): SessionEntry[] {\n\tconst leafId = getLeafId();\n\tconst cached = cache.current;\n\tif (cached && cached.leafId === leafId) return cached.entries;\n\tconst entries = getBranch();\n\tcache.current = { leafId, entries };\n\treturn entries;\n}\n\nfunction formatContextUsage(ctx: ExtensionContext, theme: Theme): string {\n\tconst contextUsage = ctx.getContextUsage();\n\tconst contextWindow = contextUsage?.contextWindow ?? ctx.model?.contextWindow;\n\tconst contextWindowSuffix = contextWindow ? `/${formatTokenCount(contextWindow)}` : \"\";\n\tif (contextUsage?.percent == null) {\n\t\treturn theme.fg(\"accent\", `CTX ?%${contextWindowSuffix}`);\n\t}\n\n\tconst label = `CTX ${contextUsage.percent.toFixed(1)}%${contextWindowSuffix}`;\n\tif (contextUsage.percent > CONTEXT_ERROR_PERCENT) return theme.fg(\"error\", label);\n\tif (contextUsage.percent > CONTEXT_WARNING_PERCENT) return theme.fg(\"warning\", label);\n\treturn theme.fg(\"accent\", label);\n}\n\nfunction formatUsageSummary(\n\tsummary: UsageSummary,\n\tusesSubscription: boolean,\n\ttheme: Theme,\n\toptions: UsageFormatOptions = { includeCacheRead: true, includeCacheWrite: true },\n): string {\n\tconst usageParts: string[] = [];\n\tif (summary.inputTokens > 0) usageParts.push(`↑${formatTokenCount(summary.inputTokens)}`);\n\tif (summary.outputTokens > 0) usageParts.push(`↓${formatTokenCount(summary.outputTokens)}`);\n\tif (options.includeCacheRead && summary.cacheReadTokens > 0) {\n\t\tusageParts.push(`R${formatTokenCount(summary.cacheReadTokens)}`);\n\t}\n\tif (options.includeCacheWrite && summary.cacheWriteTokens > 0) {\n\t\tusageParts.push(`W${formatTokenCount(summary.cacheWriteTokens)}`);\n\t}\n\tif (summary.latestCacheHitPercent !== undefined) {\n\t\tusageParts.push(`CH${summary.latestCacheHitPercent.toFixed(1)}%`);\n\t}\n\tif (summary.totalCost > 0) {\n\t\tusageParts.push(`$${summary.totalCost.toFixed(3)}${usesSubscription ? \" (sub)\" : \"\"}`);\n\t}\n\tif (usageParts.length === 0) return \"\";\n\treturn theme.fg(\"dim\", usageParts.join(\" \"));\n}\n\n/** True when the string already carries SGR color codes from an extension. */\nfunction hasAnsiColor(text: string): boolean {\n\treturn text.includes(\"\\x1b[\");\n}\n\nfunction formatExtensionStatuses(statuses: ReadonlyMap<string, string>, theme: Theme): string {\n\tconst parts = Array.from(statuses.entries())\n\t\t.sort(([firstKey], [secondKey]) => firstKey.localeCompare(secondKey))\n\t\t.map(([, text]) => sanitizeStatus(text))\n\t\t.filter(Boolean)\n\t\t// Extensions may pre-color status text. Don't re-wrap those.\n\t\t.map((text) => (hasAnsiColor(text) ? text : theme.fg(\"muted\", text)));\n\treturn parts.join(\" \");\n}\n\n/** Left-align `left`, right-align `right`, filling the gap with spaces. */\nfunction layoutLeftRight(left: string, right: string, width: number, theme: Theme): string {\n\tconst ellipsis = theme.fg(\"dim\", \"...\");\n\tif (width <= 0) return \"\";\n\tif (!right) return truncateToWidth(left, width, ellipsis);\n\tif (!left) {\n\t\tconst rightWidth = visibleWidth(right);\n\t\tif (rightWidth >= width) return truncateToWidth(right, width, ellipsis);\n\t\treturn `${\" \".repeat(width - rightWidth)}${right}`;\n\t}\n\n\tlet leftText = left;\n\tlet rightText = right;\n\tlet leftWidth = visibleWidth(leftText);\n\tlet rightWidth = visibleWidth(rightText);\n\n\tif (leftWidth + rightWidth + MIN_GAP > width) {\n\t\t// Prefer keeping the right side readable; give it up to ~45% when both compete.\n\t\tconst maxRightWidth = Math.min(rightWidth, Math.max(8, Math.floor(width * 0.45)));\n\t\tif (rightWidth > maxRightWidth) {\n\t\t\trightText = truncateToWidth(rightText, maxRightWidth, ellipsis);\n\t\t\trightWidth = visibleWidth(rightText);\n\t\t}\n\t\tconst maxLeftWidth = width - rightWidth - MIN_GAP;\n\t\tif (maxLeftWidth < 1) return truncateToWidth(rightText, width, ellipsis);\n\t\tleftText = truncateToWidth(leftText, maxLeftWidth, ellipsis);\n\t\tleftWidth = visibleWidth(leftText);\n\t}\n\n\tconst gap = Math.max(MIN_GAP, width - leftWidth - rightWidth);\n\treturn `${leftText}${\" \".repeat(gap)}${rightText}`;\n}\n\n/**\n * Line 2 zones: CTX left, optional extension status in the middle gap, usage right.\n * Drops middle first when space is tight; caller should pass progressively smaller rights.\n */\nfunction layoutSecondaryLine(\n\tcontextText: string,\n\tstatusText: string,\n\tusageText: string,\n\twidth: number,\n\ttheme: Theme,\n): string {\n\tconst ellipsis = theme.fg(\"dim\", \"...\");\n\tif (!usageText && !statusText) return truncateToWidth(contextText, width, ellipsis);\n\n\tconst rightText = usageText || statusText;\n\tconst middleText = usageText && statusText ? statusText : \"\";\n\n\tif (!middleText) return layoutLeftRight(contextText, rightText, width, theme);\n\n\tconst contextWidth = visibleWidth(contextText);\n\tconst usageWidth = visibleWidth(usageText);\n\tconst statusWidth = visibleWidth(statusText);\n\tconst needed = contextWidth + usageWidth + statusWidth + MIN_GAP * 2;\n\n\tif (needed <= width) {\n\t\tconst free = width - contextWidth - usageWidth - statusWidth;\n\t\tconst leftPad = Math.floor(free / 2);\n\t\tconst rightPad = free - leftPad;\n\t\treturn `${contextText}${\" \".repeat(leftPad)}${statusText}${\" \".repeat(rightPad)}${usageText}`;\n\t}\n\n\t// Not enough room for a full middle status — keep CTX · usage, drop status.\n\treturn layoutLeftRight(contextText, usageText, width, theme);\n}\n\nfunction fitsLeftRight(left: string, right: string, width: number): boolean {\n\tif (!right) return visibleWidth(left) <= width;\n\tif (!left) return visibleWidth(right) <= width;\n\treturn visibleWidth(left) + visibleWidth(right) + MIN_GAP <= width;\n}\n\n/** Progressive drop: branch → short path → drop provider → truncate. */\nfunction fitPrimaryLine(options: {\n\tmodelWithProvider: string;\n\tmodelName: string;\n\teffortPart: string;\n\tcwdFull: string;\n\tcwdShort: string;\n\tbranchPart: string;\n\tseparator: string;\n\twidth: number;\n\ttheme: Theme;\n}): string {\n\tconst { modelWithProvider, modelName, effortPart, cwdFull, cwdShort, branchPart, separator, width, theme } = options;\n\n\tconst leftRich = joinSegments([modelWithProvider, effortPart], separator);\n\tconst leftPlain = joinSegments([modelName, effortPart], separator);\n\n\tconst candidates: Array<{ left: string; right: string }> = [\n\t\t{ left: leftRich, right: joinSegments([cwdFull, branchPart], separator) },\n\t\t{ left: leftRich, right: cwdFull },\n\t\t{ left: leftRich, right: joinSegments([cwdShort, branchPart], separator) },\n\t\t{ left: leftRich, right: cwdShort },\n\t\t{ left: leftPlain, right: joinSegments([cwdShort, branchPart], separator) },\n\t\t{ left: leftPlain, right: cwdShort },\n\t\t{ left: leftPlain, right: \"\" },\n\t];\n\n\tfor (const candidate of candidates) {\n\t\tif (fitsLeftRight(candidate.left, candidate.right, width)) {\n\t\t\treturn layoutLeftRight(candidate.left, candidate.right, width, theme);\n\t\t}\n\t}\n\n\treturn layoutLeftRight(leftPlain, cwdShort, width, theme);\n}\n\n/** Progressive drop on the usage side: full → drop W → drop R; status fills middle when space allows. */\nfunction fitSecondaryLine(options: {\n\tcontextText: string;\n\tstatusText: string;\n\tusageCandidates: string[];\n\twidth: number;\n\ttheme: Theme;\n}): string {\n\tconst { contextText, statusText, usageCandidates, width, theme } = options;\n\n\tif (usageCandidates.length === 0) {\n\t\treturn layoutLeftRight(contextText, statusText, width, theme);\n\t}\n\n\tfor (const usageText of usageCandidates) {\n\t\tif (fitsLeftRight(contextText, usageText, width)) {\n\t\t\treturn layoutSecondaryLine(contextText, statusText, usageText, width, theme);\n\t\t}\n\t}\n\n\tconst fallbackUsage = usageCandidates[0] ?? \"\";\n\treturn layoutLeftRight(contextText, fallbackUsage, width, theme);\n}\n\nexport default function statusline(pi: ExtensionAPI): void {\n\tpi.on(\"session_start\", (_event, ctx) => {\n\t\tif (!isTui(ctx)) return;\n\n\t\t// Per-footer instance: branch path + stats cached across paints until the\n\t\t// leaf moves (or streaming usage on the leaf changes).\n\t\tconst branchPathCache: { current: BranchPathCache | null } = { current: null };\n\t\tconst branchStatsCache: { current: BranchStatsCache | null } = { current: null };\n\n\t\tctx.ui.setFooter((tui, theme, footerData) => {\n\t\t\tconst unsubscribeFromBranchChanges = footerData.onBranchChange(() => tui.requestRender());\n\t\t\treturn {\n\t\t\t\tdispose: unsubscribeFromBranchChanges,\n\t\t\t\tinvalidate() {\n\t\t\t\t\tbranchPathCache.current = null;\n\t\t\t\t\tbranchStatsCache.current = null;\n\t\t\t\t},\n\t\t\t\trender(width: number): string[] {\n\t\t\t\t\tconst branchEntries = getBranchEntries(\n\t\t\t\t\t\t() => ctx.sessionManager.getLeafId(),\n\t\t\t\t\t\t() => ctx.sessionManager.getBranch(),\n\t\t\t\t\t\tbranchPathCache,\n\t\t\t\t\t);\n\t\t\t\t\tconst { thinkingLevel, usage: usageSummary } = getBranchStats(branchEntries, branchStatsCache);\n\t\t\t\t\tconst model = ctx.model;\n\t\t\t\t\tconst modelName = theme.fg(\"toolTitle\", theme.bold(model?.name ?? model?.id ?? \"no-model\"));\n\t\t\t\t\tconst providerPart = model?.provider ? theme.fg(\"muted\", `(${model.provider})`) : \"\";\n\t\t\t\t\tconst modelWithProvider = providerPart ? `${modelName} ${providerPart}` : modelName;\n\n\t\t\t\t\tlet effortPart = \"\";\n\t\t\t\t\tif (model?.reasoning && thinkingLevel !== \"off\") {\n\t\t\t\t\t\teffortPart = theme.getThinkingBorderColor(thinkingLevel)(thinkingLevel);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst separator = theme.fg(\"dim\", \" · \");\n\t\t\t\t\tconst cwdDisplay = formatWorkingDirectory(ctx.cwd);\n\t\t\t\t\tconst cwdFull = theme.fg(\"success\", cwdDisplay);\n\t\t\t\t\tconst cwdShort = theme.fg(\"success\", pathBasename(cwdDisplay));\n\t\t\t\t\tconst gitBranch = footerData.getGitBranch();\n\t\t\t\t\tconst branchPart = gitBranch ? theme.fg(\"accent\", gitBranch) : \"\";\n\n\t\t\t\t\tconst primaryLine = fitPrimaryLine({\n\t\t\t\t\t\tmodelWithProvider,\n\t\t\t\t\t\tmodelName,\n\t\t\t\t\t\teffortPart,\n\t\t\t\t\t\tcwdFull,\n\t\t\t\t\t\tcwdShort,\n\t\t\t\t\t\tbranchPart,\n\t\t\t\t\t\tseparator,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\ttheme,\n\t\t\t\t\t});\n\n\t\t\t\t\tconst contextText = formatContextUsage(ctx, theme);\n\t\t\t\t\tconst usesSubscription = model ? ctx.modelRegistry.isUsingOAuth(model) : false;\n\t\t\t\t\tconst usageCandidates = [\n\t\t\t\t\t\tformatUsageSummary(usageSummary, usesSubscription, theme, {\n\t\t\t\t\t\t\tincludeCacheRead: true,\n\t\t\t\t\t\t\tincludeCacheWrite: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tformatUsageSummary(usageSummary, usesSubscription, theme, {\n\t\t\t\t\t\t\tincludeCacheRead: true,\n\t\t\t\t\t\t\tincludeCacheWrite: false,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tformatUsageSummary(usageSummary, usesSubscription, theme, {\n\t\t\t\t\t\t\tincludeCacheRead: false,\n\t\t\t\t\t\t\tincludeCacheWrite: false,\n\t\t\t\t\t\t}),\n\t\t\t\t\t];\n\t\t\t\t\t// Deduplicate identical progressive candidates (e.g. when W/R are zero).\n\t\t\t\t\tconst uniqueUsageCandidates = [...new Set(usageCandidates.filter(Boolean))];\n\t\t\t\t\tconst statusText = formatExtensionStatuses(footerData.getExtensionStatuses(), theme);\n\n\t\t\t\t\tconst secondaryLine = fitSecondaryLine({\n\t\t\t\t\t\tcontextText,\n\t\t\t\t\t\tstatusText,\n\t\t\t\t\t\tusageCandidates: uniqueUsageCandidates,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\ttheme,\n\t\t\t\t\t});\n\n\t\t\t\t\treturn [primaryLine, secondaryLine];\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\t});\n\n\tpi.on(\"session_shutdown\", (_event, ctx) => {\n\t\tif (isTui(ctx)) ctx.ui.setFooter(undefined);\n\t});\n}\n"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * todo/constants.ts — tool identity, command name, and prompt copy.
3
+ *
4
+ * Name/label/command live here so `index.ts` only assembles the tool, matching
5
+ * the question/deepwiki constants.ts pattern. Prompt copy is the model-facing
6
+ * contract; keep it stable.
7
+ */
8
+ export declare const TODO_TOOL_NAME = "todo";
9
+ export declare const TODO_TOOL_LABEL = "Todo";
10
+ export declare const TODOS_COMMAND_NAME = "todos";
11
+ /** Max tasks shown in a single `list` tool result body (model-facing). */
12
+ export declare const LIST_DISPLAY_MAX_ITEMS = 50;
13
+ export declare const TODO_TOOL_DESCRIPTION = "Manage the conversation's task list for multi-step coding work. Actions: create, update, list, get, delete, clear. Tasks are created pending and are short, outcome-oriented units (imperative subjects, reviewable scope) with pending/in_progress/completed status and optional blockedBy dependencies (validated, cycle-checked); deleting a task releases its dependents and leaves an immutable tombstone available to get/list. Keep exactly one task in_progress: mark it before starting work, and mark it completed only when implementation and verification are genuinely done \u2014 never with failing tests or partial work; reopen a task instead of duplicating it. Use for work with three or more meaningful steps or user-provided task lists; skip it for trivial single-step tasks and simple Q&A.";
14
+ export declare const TODO_PROMPT_SNIPPET = "Track multi-step coding work with a small outcome-oriented task list";
15
+ export declare const TODO_PROMPT_GUIDELINES: string[];
16
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/extensions/todo/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,eAAe,SAAS,CAAC;AACtC,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,qBAAqB,4xBACmvB,CAAC;AAEtxB,eAAO,MAAM,mBAAmB,yEAAyE,CAAC;AAE1G,eAAO,MAAM,sBAAsB,UAIlC,CAAC","sourcesContent":["/**\n * todo/constants.ts — tool identity, command name, and prompt copy.\n *\n * Name/label/command live here so `index.ts` only assembles the tool, matching\n * the question/deepwiki constants.ts pattern. Prompt copy is the model-facing\n * contract; keep it stable.\n */\n\nexport const TODO_TOOL_NAME = \"todo\";\nexport const TODO_TOOL_LABEL = \"Todo\";\nexport const TODOS_COMMAND_NAME = \"todos\";\n\n/** Max tasks shown in a single `list` tool result body (model-facing). */\nexport const LIST_DISPLAY_MAX_ITEMS = 50;\n\nexport const TODO_TOOL_DESCRIPTION =\n\t\"Manage the conversation's task list for multi-step coding work. Actions: create, update, list, get, delete, clear. Tasks are created pending and are short, outcome-oriented units (imperative subjects, reviewable scope) with pending/in_progress/completed status and optional blockedBy dependencies (validated, cycle-checked); deleting a task releases its dependents and leaves an immutable tombstone available to get/list. Keep exactly one task in_progress: mark it before starting work, and mark it completed only when implementation and verification are genuinely done — never with failing tests or partial work; reopen a task instead of duplicating it. Use for work with three or more meaningful steps or user-provided task lists; skip it for trivial single-step tasks and simple Q&A.\";\n\nexport const TODO_PROMPT_SNIPPET = \"Track multi-step coding work with a small outcome-oriented task list\";\n\nexport const TODO_PROMPT_GUIDELINES = [\n\t\"Use `todo` for work with three or more meaningful steps, user-provided task lists, or long sessions where progress can drift; mark the active task in_progress before working on it and completed immediately after verification.\",\n\t\"Keep exactly one `todo` item in_progress at a time (the tool demotes any other active item to pending); never mark completed while tests fail, verification has not run, or work is partial — reopen instead of duplicating.\",\n\t\"Keep the `todo` list short and outcome-oriented; use blockedBy only for real prerequisites, and delete obsolete items promptly so their dependents are released.\",\n];\n"]}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * todo/constants.ts — tool identity, command name, and prompt copy.
3
+ *
4
+ * Name/label/command live here so `index.ts` only assembles the tool, matching
5
+ * the question/deepwiki constants.ts pattern. Prompt copy is the model-facing
6
+ * contract; keep it stable.
7
+ */
8
+ export const TODO_TOOL_NAME = "todo";
9
+ export const TODO_TOOL_LABEL = "Todo";
10
+ export const TODOS_COMMAND_NAME = "todos";
11
+ /** Max tasks shown in a single `list` tool result body (model-facing). */
12
+ export const LIST_DISPLAY_MAX_ITEMS = 50;
13
+ export const TODO_TOOL_DESCRIPTION = "Manage the conversation's task list for multi-step coding work. Actions: create, update, list, get, delete, clear. Tasks are created pending and are short, outcome-oriented units (imperative subjects, reviewable scope) with pending/in_progress/completed status and optional blockedBy dependencies (validated, cycle-checked); deleting a task releases its dependents and leaves an immutable tombstone available to get/list. Keep exactly one task in_progress: mark it before starting work, and mark it completed only when implementation and verification are genuinely done — never with failing tests or partial work; reopen a task instead of duplicating it. Use for work with three or more meaningful steps or user-provided task lists; skip it for trivial single-step tasks and simple Q&A.";
14
+ export const TODO_PROMPT_SNIPPET = "Track multi-step coding work with a small outcome-oriented task list";
15
+ export const TODO_PROMPT_GUIDELINES = [
16
+ "Use `todo` for work with three or more meaningful steps, user-provided task lists, or long sessions where progress can drift; mark the active task in_progress before working on it and completed immediately after verification.",
17
+ "Keep exactly one `todo` item in_progress at a time (the tool demotes any other active item to pending); never mark completed while tests fail, verification has not run, or work is partial — reopen instead of duplicating.",
18
+ "Keep the `todo` list short and outcome-oriented; use blockedBy only for real prerequisites, and delete obsolete items promptly so their dependents are released.",
19
+ ];
20
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/extensions/todo/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAE1C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,MAAM,CAAC,MAAM,qBAAqB,GACjC,sxBAAoxB,CAAC;AAEtxB,MAAM,CAAC,MAAM,mBAAmB,GAAG,sEAAsE,CAAC;AAE1G,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,mOAAmO;IACnO,gOAA8N;IAC9N,kKAAkK;CAClK,CAAC","sourcesContent":["/**\n * todo/constants.ts — tool identity, command name, and prompt copy.\n *\n * Name/label/command live here so `index.ts` only assembles the tool, matching\n * the question/deepwiki constants.ts pattern. Prompt copy is the model-facing\n * contract; keep it stable.\n */\n\nexport const TODO_TOOL_NAME = \"todo\";\nexport const TODO_TOOL_LABEL = \"Todo\";\nexport const TODOS_COMMAND_NAME = \"todos\";\n\n/** Max tasks shown in a single `list` tool result body (model-facing). */\nexport const LIST_DISPLAY_MAX_ITEMS = 50;\n\nexport const TODO_TOOL_DESCRIPTION =\n\t\"Manage the conversation's task list for multi-step coding work. Actions: create, update, list, get, delete, clear. Tasks are created pending and are short, outcome-oriented units (imperative subjects, reviewable scope) with pending/in_progress/completed status and optional blockedBy dependencies (validated, cycle-checked); deleting a task releases its dependents and leaves an immutable tombstone available to get/list. Keep exactly one task in_progress: mark it before starting work, and mark it completed only when implementation and verification are genuinely done — never with failing tests or partial work; reopen a task instead of duplicating it. Use for work with three or more meaningful steps or user-provided task lists; skip it for trivial single-step tasks and simple Q&A.\";\n\nexport const TODO_PROMPT_SNIPPET = \"Track multi-step coding work with a small outcome-oriented task list\";\n\nexport const TODO_PROMPT_GUIDELINES = [\n\t\"Use `todo` for work with three or more meaningful steps, user-provided task lists, or long sessions where progress can drift; mark the active task in_progress before working on it and completed immediately after verification.\",\n\t\"Keep exactly one `todo` item in_progress at a time (the tool demotes any other active item to pending); never mark completed while tests fail, verification has not run, or work is partial — reopen instead of duplicating.\",\n\t\"Keep the `todo` list short and outcome-oriented; use blockedBy only for real prerequisites, and delete obsolete items promptly so their dependents are released.\",\n];\n"]}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * todo — Pi-native task tracking for multi-step work.
3
+ *
4
+ * The state is intentionally conversation-backed: every tool result carries a
5
+ * full snapshot in `details`, and lifecycle handlers replay the current branch.
6
+ * This keeps /reload, compaction, and session-tree navigation aligned with the
7
+ * conversation without adding a separate disk database. (Compaction-safe by
8
+ * design: sessionManager.getBranch() returns the FULL branch history including
9
+ * pre-compaction toolResult entries — only buildSessionContext summarizes.)
10
+ *
11
+ * State is keyed per session id (see state.ts): resume and /tree switches can
12
+ * change the session within one process, and execute + lifecycle handlers
13
+ * re-point the active bucket before touching state.
14
+ */
15
+ import type { ExtensionAPI } from "../../core/extensions/types.ts";
16
+ export default function todo(pi: ExtensionAPI): void;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/todo/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAmB,YAAY,EAAqB,MAAM,gCAAgC,CAAC;AAqCvG,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAyEnD","sourcesContent":["/**\n * todo — Pi-native task tracking for multi-step work.\n *\n * The state is intentionally conversation-backed: every tool result carries a\n * full snapshot in `details`, and lifecycle handlers replay the current branch.\n * This keeps /reload, compaction, and session-tree navigation aligned with the\n * conversation without adding a separate disk database. (Compaction-safe by\n * design: sessionManager.getBranch() returns the FULL branch history including\n * pre-compaction toolResult entries — only buildSessionContext summarizes.)\n *\n * State is keyed per session id (see state.ts): resume and /tree switches can\n * change the session within one process, and execute + lifecycle handlers\n * re-point the active bucket before touching state.\n */\nimport type { AgentToolResult, ExtensionAPI, ToolExecutionMode } from \"../../core/extensions/types.ts\";\nimport {\n\tTODO_PROMPT_GUIDELINES,\n\tTODO_PROMPT_SNIPPET,\n\tTODO_TOOL_DESCRIPTION,\n\tTODO_TOOL_LABEL,\n\tTODO_TOOL_NAME,\n\tTODOS_COMMAND_NAME,\n} from \"./constants.ts\";\nimport { TodoOverlay } from \"./overlay.ts\";\nimport { type TodoDetails, TodoParamsSchema } from \"./schema.ts\";\nimport {\n\tapplyTodoMutation,\n\tbuildTodoDetails,\n\tcommitTodoState,\n\tdisposeTodoSession,\n\tformatTodoContent,\n\tgetTodoState,\n\treplaceTodoState,\n\treplayTodosFromBranch,\n\tsetActiveTodoSession,\n} from \"./state.ts\";\nimport { formatCommandList } from \"./view.ts\";\n\ninterface TodoSessionCtx {\n\tsessionManager: { getBranch(): Iterable<unknown>; getSessionId(): string };\n}\n\nfunction safeReplay(ctx: TodoSessionCtx): void {\n\tsetActiveTodoSession(ctx.sessionManager.getSessionId());\n\ttry {\n\t\treplaceTodoState(replayTodosFromBranch(ctx));\n\t} catch (error) {\n\t\tif (!/stale after session replacement/.test(String(error))) throw error;\n\t}\n}\n\nexport default function todo(pi: ExtensionAPI): void {\n\tlet overlay: TodoOverlay | undefined;\n\n\tpi.registerTool({\n\t\tname: TODO_TOOL_NAME,\n\t\tlabel: TODO_TOOL_LABEL,\n\t\tdescription: TODO_TOOL_DESCRIPTION,\n\t\tpromptSnippet: TODO_PROMPT_SNIPPET,\n\t\tpromptGuidelines: TODO_PROMPT_GUIDELINES,\n\t\tparameters: TodoParamsSchema,\n\t\texecutionMode: \"sequential\" as ToolExecutionMode,\n\n\t\tasync execute(_toolCallId, params, _signal, _onUpdate, ctx): Promise<AgentToolResult<TodoDetails>> {\n\t\t\t// Re-point the active bucket: resume//tree can switch sessions between\n\t\t\t// lifecycle events and this call.\n\t\t\tsetActiveTodoSession(ctx.sessionManager.getSessionId());\n\t\t\tconst result = applyTodoMutation(getTodoState(), params);\n\t\t\tif (result.operation.kind === \"error\") {\n\t\t\t\tthrow new Error(result.operation.message);\n\t\t\t}\n\t\t\tcommitTodoState(result.state);\n\t\t\tconst text = formatTodoContent(result.operation, result.state);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text }],\n\t\t\t\tdetails: buildTodoDetails(params, result.state, result.operation),\n\t\t\t};\n\t\t},\n\t});\n\n\tpi.registerCommand(TODOS_COMMAND_NAME, {\n\t\tdescription: \"Show todos for the current conversation branch\",\n\t\thandler: async (_args, ctx) => {\n\t\t\tif (!ctx.hasUI) {\n\t\t\t\tctx.ui.notify(\"/todos requires an interactive UI.\", \"warning\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetActiveTodoSession(ctx.sessionManager.getSessionId());\n\t\t\tctx.ui.notify(formatCommandList(getTodoState()), \"info\");\n\t\t},\n\t});\n\n\tpi.on(\"session_start\", async (_event, ctx) => {\n\t\tsafeReplay(ctx);\n\t\tif (ctx.hasUI) {\n\t\t\toverlay ??= new TodoOverlay();\n\t\t\toverlay.setUI(ctx.ui);\n\t\t\toverlay.resetVisibility();\n\t\t\toverlay.update();\n\t\t}\n\t});\n\n\tpi.on(\"session_compact\", async (_event, ctx) => {\n\t\tsafeReplay(ctx);\n\t\toverlay?.resetVisibility();\n\t\toverlay?.update();\n\t});\n\n\tpi.on(\"session_tree\", async (_event, ctx) => {\n\t\tsafeReplay(ctx);\n\t\toverlay?.resetVisibility();\n\t\toverlay?.update();\n\t});\n\n\tpi.on(\"session_shutdown\", async (_event, ctx) => {\n\t\tdisposeTodoSession(ctx.sessionManager.getSessionId());\n\t\toverlay?.dispose();\n\t\toverlay = undefined;\n\t});\n\n\tpi.on(\"tool_execution_end\", async (event) => {\n\t\tif (event.toolName !== TODO_TOOL_NAME || event.isError) return;\n\t\toverlay?.update();\n\t});\n}\n"]}