@ashx-j/lunr 0.2.11 → 0.2.13

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 (342) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +211 -236
  3. package/dist/builtin-extensions/ashxj-tui.d.ts +3 -0
  4. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  5. package/dist/builtin-extensions/ashxj-tui.js +28 -11
  6. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  7. package/dist/builtin-extensions/index.d.ts.map +1 -1
  8. package/dist/builtin-extensions/index.js +0 -2
  9. package/dist/builtin-extensions/index.js.map +1 -1
  10. package/dist/builtin-extensions/lunr-cron.d.ts +1 -1
  11. package/dist/builtin-extensions/lunr-cron.d.ts.map +1 -1
  12. package/dist/builtin-extensions/lunr-cron.js +1 -1
  13. package/dist/builtin-extensions/lunr-cron.js.map +1 -1
  14. package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.js +3 -3
  16. package/dist/builtin-extensions/pi-subagents/src/extension/chain-validation.js.map +1 -1
  17. package/dist/builtin-extensions/pi-subagents/src/extension/doctor.d.ts +0 -2
  18. package/dist/builtin-extensions/pi-subagents/src/extension/doctor.d.ts.map +1 -1
  19. package/dist/builtin-extensions/pi-subagents/src/extension/doctor.js +1 -23
  20. package/dist/builtin-extensions/pi-subagents/src/extension/doctor.js.map +1 -1
  21. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
  22. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +6 -7
  23. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -1
  24. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
  25. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  26. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +7 -14
  27. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  28. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +12 -9
  29. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  30. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +38 -34
  31. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  32. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +3 -3
  33. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  34. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +32 -47
  35. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  36. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -2
  37. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
  38. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
  39. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +7 -10
  40. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
  41. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +90 -109
  42. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
  43. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +3 -2
  44. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
  45. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +37 -50
  46. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
  47. package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.d.ts.map +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js +1 -1
  49. package/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js.map +1 -1
  50. package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.d.ts +4 -0
  51. package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.d.ts.map +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.js +5 -5
  53. package/dist/builtin-extensions/pi-subagents/src/runs/background/scheduled-runs.js.map +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +31 -13
  56. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
  57. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.d.ts +2 -2
  58. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.d.ts.map +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.js.map +1 -1
  60. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +4 -3
  61. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +48 -20
  63. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts +2 -2
  65. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +90 -64
  67. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +6 -8
  69. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  70. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +262 -161
  71. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  72. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -1
  73. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
  74. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +24 -33
  75. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
  76. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +25 -0
  77. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -0
  78. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +51 -0
  79. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -0
  80. package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.d.ts.map +1 -1
  81. package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.js +20 -3
  82. package/dist/builtin-extensions/pi-subagents/src/runs/shared/dynamic-fanout.js.map +1 -1
  83. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +4 -1
  84. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
  85. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
  86. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +5 -0
  87. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  88. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +9 -3
  89. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  90. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  91. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +2 -2
  92. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  93. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +2 -2
  94. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -1
  95. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +20 -17
  96. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -1
  97. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +70 -0
  98. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -0
  99. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +153 -0
  100. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -0
  101. package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts +13 -8
  102. package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts.map +1 -1
  103. package/dist/builtin-extensions/pi-subagents/src/shared/settings.js +20 -51
  104. package/dist/builtin-extensions/pi-subagents/src/shared/settings.js.map +1 -1
  105. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +80 -20
  106. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  107. package/dist/builtin-extensions/pi-subagents/src/shared/types.js +10 -2
  108. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  109. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +2 -2
  110. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
  111. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +20 -32
  112. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
  113. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +2 -1
  114. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
  115. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +23 -449
  116. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
  117. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +2 -1
  118. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  119. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +13 -11
  120. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  121. package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.d.ts +2 -1
  122. package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.d.ts.map +1 -1
  123. package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.js +18 -17
  124. package/dist/builtin-extensions/pi-subagents/src/watchdog/runtime.js.map +1 -1
  125. package/dist/builtin-extensions/simple-pi-memory.d.ts +2 -2
  126. package/dist/builtin-extensions/simple-pi-memory.d.ts.map +1 -1
  127. package/dist/builtin-extensions/simple-pi-memory.js +41 -17
  128. package/dist/builtin-extensions/simple-pi-memory.js.map +1 -1
  129. package/dist/catalog/models.json +1 -1
  130. package/dist/catalog/providers/amazon-bedrock.json +1 -1
  131. package/dist/catalog/providers/azure-openai-responses.json +1 -1
  132. package/dist/catalog/providers/cloudflare-ai-gateway.json +1 -1
  133. package/dist/catalog/providers/cloudflare-workers-ai.json +1 -1
  134. package/dist/catalog/providers/fireworks.json +1 -1
  135. package/dist/catalog/providers/github-copilot.json +1 -1
  136. package/dist/catalog/providers/huggingface.json +1 -1
  137. package/dist/catalog/providers/minimax-cn.json +1 -1
  138. package/dist/catalog/providers/minimax.json +1 -1
  139. package/dist/catalog/providers/mistral.json +1 -1
  140. package/dist/catalog/providers/nvidia.json +1 -1
  141. package/dist/catalog/providers/openai.json +1 -1
  142. package/dist/catalog/providers/opencode-go.json +1 -1
  143. package/dist/catalog/providers/opencode.json +1 -1
  144. package/dist/catalog/providers/openrouter.json +1 -1
  145. package/dist/catalog/providers/qwen-cloud-cn.json +1 -1
  146. package/dist/catalog/providers/qwen-cloud.json +1 -1
  147. package/dist/catalog/providers/qwen-token-plan-cn.json +1 -1
  148. package/dist/catalog/providers/qwen-token-plan.json +1 -1
  149. package/dist/catalog/providers/together.json +1 -1
  150. package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
  151. package/dist/catalog/providers/zai-coding-cn.json +1 -1
  152. package/dist/catalog/providers/zai.json +1 -1
  153. package/dist/catalog/publication.json +3 -3
  154. package/dist/core/agent-session.d.ts +7 -1
  155. package/dist/core/agent-session.d.ts.map +1 -1
  156. package/dist/core/agent-session.js +34 -4
  157. package/dist/core/agent-session.js.map +1 -1
  158. package/dist/core/context-breakdown.d.ts +3 -1
  159. package/dist/core/context-breakdown.d.ts.map +1 -1
  160. package/dist/core/context-breakdown.js +5 -2
  161. package/dist/core/context-breakdown.js.map +1 -1
  162. package/dist/core/customize.d.ts +2 -0
  163. package/dist/core/customize.d.ts.map +1 -1
  164. package/dist/core/customize.js +6 -0
  165. package/dist/core/customize.js.map +1 -1
  166. package/dist/core/memory-cap.d.ts +4 -8
  167. package/dist/core/memory-cap.d.ts.map +1 -1
  168. package/dist/core/memory-cap.js +8 -8
  169. package/dist/core/memory-cap.js.map +1 -1
  170. package/dist/core/permissions.d.ts +2 -0
  171. package/dist/core/permissions.d.ts.map +1 -1
  172. package/dist/core/permissions.js +30 -14
  173. package/dist/core/permissions.js.map +1 -1
  174. package/dist/core/plan-mode.d.ts.map +1 -1
  175. package/dist/core/plan-mode.js +1 -9
  176. package/dist/core/plan-mode.js.map +1 -1
  177. package/dist/core/rollback.d.ts.map +1 -1
  178. package/dist/core/rollback.js +1 -1
  179. package/dist/core/rollback.js.map +1 -1
  180. package/dist/core/settings-manager.d.ts +16 -5
  181. package/dist/core/settings-manager.d.ts.map +1 -1
  182. package/dist/core/settings-manager.js +37 -10
  183. package/dist/core/settings-manager.js.map +1 -1
  184. package/dist/core/slash-commands.d.ts.map +1 -1
  185. package/dist/core/slash-commands.js +1 -5
  186. package/dist/core/slash-commands.js.map +1 -1
  187. package/dist/core/subagent-permission-inherit.d.ts +34 -22
  188. package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
  189. package/dist/core/subagent-permission-inherit.js +37 -80
  190. package/dist/core/subagent-permission-inherit.js.map +1 -1
  191. package/dist/core/swarm.d.ts.map +1 -1
  192. package/dist/core/swarm.js +13 -7
  193. package/dist/core/swarm.js.map +1 -1
  194. package/dist/core/system-prompt.d.ts +6 -4
  195. package/dist/core/system-prompt.d.ts.map +1 -1
  196. package/dist/core/system-prompt.js +38 -48
  197. package/dist/core/system-prompt.js.map +1 -1
  198. package/dist/core/usage-adapters/openai-codex.d.ts +1 -1
  199. package/dist/core/usage-adapters/openai-codex.d.ts.map +1 -1
  200. package/dist/core/usage-adapters/openai-codex.js +22 -17
  201. package/dist/core/usage-adapters/openai-codex.js.map +1 -1
  202. package/dist/core/usage-service.d.ts +10 -1
  203. package/dist/core/usage-service.d.ts.map +1 -1
  204. package/dist/core/usage-service.js +17 -6
  205. package/dist/core/usage-service.js.map +1 -1
  206. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  207. package/dist/gateway/agent-bridge.js +1 -4
  208. package/dist/gateway/agent-bridge.js.map +1 -1
  209. package/dist/gateway/cron.d.ts.map +1 -1
  210. package/dist/gateway/cron.js +1 -4
  211. package/dist/gateway/cron.js.map +1 -1
  212. package/dist/index.d.ts +1 -1
  213. package/dist/index.d.ts.map +1 -1
  214. package/dist/index.js.map +1 -1
  215. package/dist/main.d.ts.map +1 -1
  216. package/dist/main.js +0 -5
  217. package/dist/main.js.map +1 -1
  218. package/dist/migrations.d.ts +2 -0
  219. package/dist/migrations.d.ts.map +1 -1
  220. package/dist/migrations.js +21 -0
  221. package/dist/migrations.js.map +1 -1
  222. package/dist/modes/interactive/components/settings-selector.d.ts +7 -4
  223. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  224. package/dist/modes/interactive/components/settings-selector.js +122 -162
  225. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  226. package/dist/modes/interactive/components/usage-view.d.ts +1 -1
  227. package/dist/modes/interactive/components/usage-view.d.ts.map +1 -1
  228. package/dist/modes/interactive/components/usage-view.js +7 -4
  229. package/dist/modes/interactive/components/usage-view.js.map +1 -1
  230. package/dist/modes/interactive/interactive-mode.d.ts +1 -2
  231. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  232. package/dist/modes/interactive/interactive-mode.js +55 -96
  233. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  234. package/dist/modes/interactive/skill-tag-autocomplete.d.ts +13 -0
  235. package/dist/modes/interactive/skill-tag-autocomplete.d.ts.map +1 -0
  236. package/dist/modes/interactive/skill-tag-autocomplete.js +72 -0
  237. package/dist/modes/interactive/skill-tag-autocomplete.js.map +1 -0
  238. package/docs/compaction.md +23 -23
  239. package/docs/containerization.md +24 -24
  240. package/docs/custom-provider.md +18 -18
  241. package/docs/development.md +16 -15
  242. package/docs/docs.json +6 -2
  243. package/docs/extensions.md +82 -80
  244. package/docs/features.md +102 -0
  245. package/docs/index.md +25 -19
  246. package/docs/json.md +7 -7
  247. package/docs/keybindings.md +4 -4
  248. package/docs/models.md +2 -2
  249. package/docs/packages.md +38 -42
  250. package/docs/prompt-templates.md +4 -4
  251. package/docs/providers.md +22 -10
  252. package/docs/quickstart.md +81 -46
  253. package/docs/rpc.md +7 -13
  254. package/docs/sdk.md +43 -41
  255. package/docs/security.md +18 -18
  256. package/docs/session-format.md +9 -9
  257. package/docs/sessions.md +13 -12
  258. package/docs/settings.md +63 -24
  259. package/docs/shell-aliases.md +2 -2
  260. package/docs/skills.md +21 -11
  261. package/docs/terminal-setup.md +5 -5
  262. package/docs/termux.md +7 -7
  263. package/docs/themes.md +12 -14
  264. package/docs/tmux.md +4 -4
  265. package/docs/tui.md +23 -23
  266. package/docs/usage.md +112 -87
  267. package/docs/windows.md +10 -2
  268. package/examples/README.md +3 -1
  269. package/examples/extensions/README.md +6 -6
  270. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  271. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  272. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  273. package/examples/extensions/doom-overlay/README.md +2 -2
  274. package/examples/extensions/gondolin/package-lock.json +2 -2
  275. package/examples/extensions/gondolin/package.json +1 -1
  276. package/examples/extensions/plan-mode/README.md +3 -1
  277. package/examples/extensions/sandbox/package-lock.json +2 -2
  278. package/examples/extensions/sandbox/package.json +1 -1
  279. package/examples/extensions/subagent/README.md +13 -11
  280. package/examples/extensions/todo.ts +2 -1
  281. package/examples/extensions/with-deps/package-lock.json +2 -2
  282. package/examples/extensions/with-deps/package.json +1 -1
  283. package/examples/sdk/README.md +9 -5
  284. package/package.json +6 -7
  285. package/dist/builtin-extensions/lunr-behavior.d.ts +0 -44
  286. package/dist/builtin-extensions/lunr-behavior.d.ts.map +0 -1
  287. package/dist/builtin-extensions/lunr-behavior.js +0 -213
  288. package/dist/builtin-extensions/lunr-behavior.js.map +0 -1
  289. package/dist/builtin-extensions/pi-subagents/agents/context-builder.md +0 -46
  290. package/dist/builtin-extensions/pi-subagents/agents/deep-researcher.md +0 -36
  291. package/dist/builtin-extensions/pi-subagents/agents/delegate.md +0 -12
  292. package/dist/builtin-extensions/pi-subagents/agents/oracle.md +0 -73
  293. package/dist/builtin-extensions/pi-subagents/agents/planner.md +0 -55
  294. package/dist/builtin-extensions/pi-subagents/agents/research-writer.md +0 -37
  295. package/dist/builtin-extensions/pi-subagents/agents/researcher.md +0 -52
  296. package/dist/builtin-extensions/pi-subagents/agents/reviewer.md +0 -79
  297. package/dist/builtin-extensions/pi-subagents/agents/scout.md +0 -50
  298. package/dist/builtin-extensions/pi-subagents/agents/worker.md +0 -55
  299. package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts +0 -20
  300. package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts.map +0 -1
  301. package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js +0 -1273
  302. package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js.map +0 -1
  303. package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.d.ts +0 -49
  304. package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.d.ts.map +0 -1
  305. package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.js +0 -252
  306. package/dist/builtin-extensions/pi-subagents/src/agents/agent-memory.js.map +0 -1
  307. package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.d.ts +0 -3
  308. package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.d.ts.map +0 -1
  309. package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.js +0 -6
  310. package/dist/builtin-extensions/pi-subagents/src/agents/agent-scope.js.map +0 -1
  311. package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.d.ts +0 -3
  312. package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.d.ts.map +0 -1
  313. package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.js +0 -23
  314. package/dist/builtin-extensions/pi-subagents/src/agents/agent-selection.js.map +0 -1
  315. package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.d.ts +0 -8
  316. package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.d.ts.map +0 -1
  317. package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.js +0 -143
  318. package/dist/builtin-extensions/pi-subagents/src/agents/agent-serializer.js.map +0 -1
  319. package/dist/builtin-extensions/pi-subagents/src/agents/agents.d.ts +0 -176
  320. package/dist/builtin-extensions/pi-subagents/src/agents/agents.d.ts.map +0 -1
  321. package/dist/builtin-extensions/pi-subagents/src/agents/agents.js +0 -1326
  322. package/dist/builtin-extensions/pi-subagents/src/agents/agents.js.map +0 -1
  323. package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.d.ts +0 -7
  324. package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.d.ts.map +0 -1
  325. package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.js +0 -307
  326. package/dist/builtin-extensions/pi-subagents/src/agents/chain-serializer.js.map +0 -1
  327. package/dist/builtin-extensions/pi-subagents/src/agents/identity.d.ts +0 -8
  328. package/dist/builtin-extensions/pi-subagents/src/agents/identity.d.ts.map +0 -1
  329. package/dist/builtin-extensions/pi-subagents/src/agents/identity.js +0 -30
  330. package/dist/builtin-extensions/pi-subagents/src/agents/identity.js.map +0 -1
  331. package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.d.ts +0 -35
  332. package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.d.ts.map +0 -1
  333. package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.js +0 -151
  334. package/dist/builtin-extensions/pi-subagents/src/agents/proactive-skills.js.map +0 -1
  335. package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.d.ts +0 -131
  336. package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.d.ts.map +0 -1
  337. package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.js +0 -491
  338. package/dist/builtin-extensions/pi-subagents/src/profiles/profiles.js.map +0 -1
  339. package/dist/core/behavior-preset.d.ts +0 -60
  340. package/dist/core/behavior-preset.d.ts.map +0 -1
  341. package/dist/core/behavior-preset.js +0 -257
  342. package/dist/core/behavior-preset.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"usage-view.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/usage-view.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,gCAAgC,CAAC;AAIjF,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC7B,mFAAmF;IACnF,aAAa,EAAE,WAAW,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9F,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,sEAAsE;IACtE,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAID,kFAAgF;AAChF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAIhF;AAWD,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED,2DAA2D;AAC3D,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,CAevF;AAQD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBjG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA2D9E","sourcesContent":["import { truncateToWidth, visibleWidth } from \"@ashx-j/lunr-tui\";\nimport type { ContextBreakdown } from \"../../../core/context-breakdown.ts\";\nimport type { PlanUsage, PlanUsageWindow } from \"../../../core/usage-service.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { formatTokens } from \"./footer.ts\";\n\n/** Simple token totals (rendered by /usage). */\nexport interface UsageTotals {\n\tinput: number;\n\toutput: number;\n\tcacheRead?: number;\n\tcacheWrite?: number;\n\ttotal: number;\n}\n\nexport interface UsageViewData {\n\t/** Session-wide token totals (summed across models); omitted when no usage yet. */\n\tsessionTotals: UsageTotals | undefined;\n\tcontext: { tokens: number | null; contextWindow: number; percent: number | null } | undefined;\n\tplan: PlanUsage | undefined;\n\t/** Live session context split; omitted when the window is unknown. */\n\tbreakdown?: ContextBreakdown;\n}\n\nconst BAR_CELLS = 20;\n\n/** Traffic-light token for a 0–100 usage percent. Matches footer thresholds. */\nexport function usageLevelColor(percent: number): \"success\" | \"warning\" | \"error\" {\n\tif (percent > 90) return \"error\";\n\tif (percent > 70) return \"warning\";\n\treturn \"success\";\n}\n\n/** `cached X (Y%)` where Y = cacheRead / (input + cacheRead + cacheWrite). */\nfunction formatCachedSuffix(input: number, cacheRead: number, cacheWrite: number): string {\n\tif (cacheRead <= 0) return \"\";\n\tconst prompt = input + cacheRead + cacheWrite;\n\tif (prompt <= 0) return \"\";\n\tconst percent = Math.round((cacheRead / prompt) * 100);\n\treturn ` cached ${formatTokens(cacheRead)} (${percent}%)`;\n}\n\n/** 20-cell bar: filled cells green / yellow / red, empty cells dim. */\nexport function usageBar(percent: number): string {\n\tconst clamped = Math.max(0, Math.min(100, percent));\n\tconst filled = Math.round((clamped / 100) * BAR_CELLS);\n\tconst empty = BAR_CELLS - filled;\n\tconst fill = filled > 0 ? theme.fg(usageLevelColor(clamped), \"█\".repeat(filled)) : \"\";\n\tconst rest = empty > 0 ? theme.fg(\"dim\", \"░\".repeat(empty)) : \"\";\n\treturn fill + rest;\n}\n\n/** Compact countdown: `6d 21h`, `2h 51m`, `45m`, `now`. */\nexport function formatResetCountdown(resetsAt: number, now: number = Date.now()): string {\n\tconst diff = resetsAt - now;\n\tif (diff <= 0) return \"now\";\n\tconst minutes = Math.floor(diff / 60000);\n\tif (minutes >= 24 * 60) {\n\t\tconst days = Math.floor(minutes / (24 * 60));\n\t\tconst hours = Math.floor((minutes % (24 * 60)) / 60);\n\t\treturn hours > 0 ? `${days}d ${hours}h` : `${days}d`;\n\t}\n\tif (minutes >= 60) {\n\t\tconst hours = Math.floor(minutes / 60);\n\t\tconst rest = minutes % 60;\n\t\treturn rest > 0 ? `${hours}h ${rest}m` : `${hours}h`;\n\t}\n\treturn `${Math.max(1, minutes)}m`;\n}\n\nfunction planWindowLine(window: PlanUsageWindow, labelWidth: number): string {\n\tconst pct = `${Math.round(window.usedPercent)}% used`;\n\tconst reset = window.resetsAt !== undefined ? ` resets in ${formatResetCountdown(window.resetsAt)}` : \"\";\n\treturn ` ${window.label.padEnd(labelWidth)} ${usageBar(window.usedPercent)} ${pct}${reset}`;\n}\n\n/**\n * Shared bordered box chrome (monochrome, moon theme conventions) used by\n * /usage and /context. `headerText` includes its surrounding spaces (e.g.\n * \" Usage \"). `maxWidth` is the available terminal width; content truncates\n * to fit.\n */\nexport function renderThemedBox(headerText: string, content: string[], maxWidth: number): string[] {\n\t// Box width: widest content + `│ ` / ` │` chrome, capped by the terminal.\n\tconst contentWidth = Math.max(...content.map((line) => visibleWidth(line)));\n\tconst totalWidth = Math.max(24, Math.min(contentWidth + 4, Math.max(24, maxWidth)));\n\tconst innerWidth = totalWidth - 4;\n\n\tconst border = (text: string): string => theme.fg(\"border\", text);\n\tconst top = border(`╭${headerText}${\"─\".repeat(Math.max(0, totalWidth - 2 - headerText.length))}╮`);\n\tconst bottom = border(`╰${\"─\".repeat(totalWidth - 2)}╯`);\n\tconst lines = [top];\n\tfor (const rawLine of content) {\n\t\tconst line = rawLine.length > 0 ? truncateToWidth(rawLine, innerWidth, \"\") : \"\";\n\t\tconst padding = \" \".repeat(Math.max(0, innerWidth - visibleWidth(line)));\n\t\tlines.push(`${border(\"│ \")}${line}${padding}${border(\" │\")}`);\n\t}\n\tlines.push(bottom);\n\treturn lines;\n}\n\n/**\n * Render the /usage bordered box (moon theme conventions).\n * Current session only: token totals, live context split, window bar, plan quota.\n * `maxWidth` is the available terminal width; content truncates to fit.\n */\nexport function renderUsageBox(data: UsageViewData, maxWidth: number): string[] {\n\tconst content: string[] = [];\n\n\tif (data.sessionTotals && data.sessionTotals.total > 0) {\n\t\tcontent.push(\"Session usage\");\n\t\tcontent.push(\n\t\t\t` input ${formatTokens(data.sessionTotals.input)} output ${formatTokens(data.sessionTotals.output)} total ${formatTokens(data.sessionTotals.total)}${formatCachedSuffix(data.sessionTotals.input, data.sessionTotals.cacheRead ?? 0, data.sessionTotals.cacheWrite ?? 0)}`,\n\t\t);\n\t}\n\n\tif (data.breakdown) {\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(\"Context\");\n\t\tcontent.push(theme.fg(\"dim\", \"Estimated (chars/4), current session only — actual token counts may differ.\"));\n\t\tconst rows: { label: string; tokens: number }[] = [\n\t\t\t{ label: \"System prompt\", tokens: data.breakdown.systemPrompt },\n\t\t\t...data.breakdown.contextFiles.map((file) => ({ label: file.label, tokens: file.tokens })),\n\t\t\t{ label: \"Skills\", tokens: data.breakdown.skills },\n\t\t\t{ label: \"Tool definitions\", tokens: data.breakdown.toolDefinitions },\n\t\t\t{ label: \"User messages\", tokens: data.breakdown.user },\n\t\t\t{ label: \"Assistant text\", tokens: data.breakdown.assistantText },\n\t\t\t{ label: \"Thinking\", tokens: data.breakdown.thinking },\n\t\t\t{ label: \"Tool calls\", tokens: data.breakdown.toolCalls },\n\t\t\t{ label: \"Tool results\", tokens: data.breakdown.toolResults },\n\t\t\t{ label: \"Summaries\", tokens: data.breakdown.summaries },\n\t\t\t{ label: \"Free\", tokens: data.breakdown.free },\n\t\t].filter((row) => row.tokens > 0);\n\t\tif (rows.length > 0) {\n\t\t\tconst labelWidth = Math.max(...rows.map((row) => row.label.length));\n\t\t\tfor (const row of rows) {\n\t\t\t\tcontent.push(` ${row.label.padEnd(labelWidth)} ${formatTokens(row.tokens)}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (data.context) {\n\t\tconst pct = data.context.percent;\n\t\tconst tokens = data.context.tokens;\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(\"Context window\");\n\t\tconst pctText = pct == null ? \"?\" : `${Math.round(pct)}%`;\n\t\tconst tokensText = tokens == null ? \"?\" : formatTokens(tokens);\n\t\tcontent.push(\n\t\t\t` ${usageBar(pct ?? 0)} ${pctText} (${tokensText} / ${formatTokens(data.context.contextWindow)})`,\n\t\t);\n\t}\n\n\tif (data.plan && data.plan.windows.length > 0) {\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(data.plan.planLabel ? `Plan usage (${data.plan.planLabel})` : \"Plan usage\");\n\t\tconst labelWidth = Math.max(...data.plan.windows.map((window) => window.label.length));\n\t\tfor (const window of data.plan.windows) {\n\t\t\tcontent.push(planWindowLine(window, labelWidth));\n\t\t}\n\t}\n\n\tif (content.length === 0) content.push(\"No usage data yet.\");\n\n\treturn renderThemedBox(\" Usage \", content, maxWidth);\n}\n"]}
1
+ {"version":3,"file":"usage-view.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/usage-view.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,gCAAgC,CAAC;AAIjF,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC7B,mFAAmF;IACnF,aAAa,EAAE,WAAW,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9F,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,sEAAsE;IACtE,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAID,kFAAgF;AAChF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAIhF;AAWD,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED,2DAA2D;AAC3D,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,CAevF;AAQD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBjG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA6D9E","sourcesContent":["import { truncateToWidth, visibleWidth } from \"@ashx-j/lunr-tui\";\nimport type { ContextBreakdown } from \"../../../core/context-breakdown.ts\";\nimport type { PlanUsage, PlanUsageWindow } from \"../../../core/usage-service.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { formatTokens } from \"./footer.ts\";\n\n/** Simple token totals (rendered by /usage). */\nexport interface UsageTotals {\n\tinput: number;\n\toutput: number;\n\tcacheRead?: number;\n\tcacheWrite?: number;\n\ttotal: number;\n}\n\nexport interface UsageViewData {\n\t/** Session-wide token totals (summed across models); omitted when no usage yet. */\n\tsessionTotals: UsageTotals | undefined;\n\tcontext: { tokens: number | null; contextWindow: number; percent: number | null } | undefined;\n\tplan: PlanUsage[];\n\t/** Live session context split; omitted when the window is unknown. */\n\tbreakdown?: ContextBreakdown;\n}\n\nconst BAR_CELLS = 20;\n\n/** Traffic-light token for a 0–100 usage percent. Matches footer thresholds. */\nexport function usageLevelColor(percent: number): \"success\" | \"warning\" | \"error\" {\n\tif (percent > 90) return \"error\";\n\tif (percent > 70) return \"warning\";\n\treturn \"success\";\n}\n\n/** `cached X (Y%)` where Y = cacheRead / (input + cacheRead + cacheWrite). */\nfunction formatCachedSuffix(input: number, cacheRead: number, cacheWrite: number): string {\n\tif (cacheRead <= 0) return \"\";\n\tconst prompt = input + cacheRead + cacheWrite;\n\tif (prompt <= 0) return \"\";\n\tconst percent = Math.round((cacheRead / prompt) * 100);\n\treturn ` cached ${formatTokens(cacheRead)} (${percent}%)`;\n}\n\n/** 20-cell bar: filled cells green / yellow / red, empty cells dim. */\nexport function usageBar(percent: number): string {\n\tconst clamped = Math.max(0, Math.min(100, percent));\n\tconst filled = Math.round((clamped / 100) * BAR_CELLS);\n\tconst empty = BAR_CELLS - filled;\n\tconst fill = filled > 0 ? theme.fg(usageLevelColor(clamped), \"█\".repeat(filled)) : \"\";\n\tconst rest = empty > 0 ? theme.fg(\"dim\", \"░\".repeat(empty)) : \"\";\n\treturn fill + rest;\n}\n\n/** Compact countdown: `6d 21h`, `2h 51m`, `45m`, `now`. */\nexport function formatResetCountdown(resetsAt: number, now: number = Date.now()): string {\n\tconst diff = resetsAt - now;\n\tif (diff <= 0) return \"now\";\n\tconst minutes = Math.floor(diff / 60000);\n\tif (minutes >= 24 * 60) {\n\t\tconst days = Math.floor(minutes / (24 * 60));\n\t\tconst hours = Math.floor((minutes % (24 * 60)) / 60);\n\t\treturn hours > 0 ? `${days}d ${hours}h` : `${days}d`;\n\t}\n\tif (minutes >= 60) {\n\t\tconst hours = Math.floor(minutes / 60);\n\t\tconst rest = minutes % 60;\n\t\treturn rest > 0 ? `${hours}h ${rest}m` : `${hours}h`;\n\t}\n\treturn `${Math.max(1, minutes)}m`;\n}\n\nfunction planWindowLine(window: PlanUsageWindow, labelWidth: number): string {\n\tconst pct = `${Math.round(window.usedPercent)}% used`;\n\tconst reset = window.resetsAt !== undefined ? ` resets in ${formatResetCountdown(window.resetsAt)}` : \"\";\n\treturn ` ${window.label.padEnd(labelWidth)} ${usageBar(window.usedPercent)} ${pct}${reset}`;\n}\n\n/**\n * Shared bordered box chrome (monochrome, moon theme conventions) used by\n * /usage and /context. `headerText` includes its surrounding spaces (e.g.\n * \" Usage \"). `maxWidth` is the available terminal width; content truncates\n * to fit.\n */\nexport function renderThemedBox(headerText: string, content: string[], maxWidth: number): string[] {\n\t// Box width: widest content + `│ ` / ` │` chrome, capped by the terminal.\n\tconst contentWidth = Math.max(...content.map((line) => visibleWidth(line)));\n\tconst totalWidth = Math.max(24, Math.min(contentWidth + 4, Math.max(24, maxWidth)));\n\tconst innerWidth = totalWidth - 4;\n\n\tconst border = (text: string): string => theme.fg(\"border\", text);\n\tconst top = border(`╭${headerText}${\"─\".repeat(Math.max(0, totalWidth - 2 - headerText.length))}╮`);\n\tconst bottom = border(`╰${\"─\".repeat(totalWidth - 2)}╯`);\n\tconst lines = [top];\n\tfor (const rawLine of content) {\n\t\tconst line = rawLine.length > 0 ? truncateToWidth(rawLine, innerWidth, \"\") : \"\";\n\t\tconst padding = \" \".repeat(Math.max(0, innerWidth - visibleWidth(line)));\n\t\tlines.push(`${border(\"│ \")}${line}${padding}${border(\" │\")}`);\n\t}\n\tlines.push(bottom);\n\treturn lines;\n}\n\n/**\n * Render the /usage bordered box (moon theme conventions).\n * Current session only: token totals, live context split, window bar, plan quota.\n * `maxWidth` is the available terminal width; content truncates to fit.\n */\nexport function renderUsageBox(data: UsageViewData, maxWidth: number): string[] {\n\tconst content: string[] = [];\n\n\tif (data.sessionTotals && data.sessionTotals.total > 0) {\n\t\tcontent.push(\"Session usage\");\n\t\tcontent.push(\n\t\t\t` input ${formatTokens(data.sessionTotals.input)} output ${formatTokens(data.sessionTotals.output)} total ${formatTokens(data.sessionTotals.total)}${formatCachedSuffix(data.sessionTotals.input, data.sessionTotals.cacheRead ?? 0, data.sessionTotals.cacheWrite ?? 0)}`,\n\t\t);\n\t}\n\n\tif (data.breakdown) {\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(\"Context\");\n\t\tcontent.push(theme.fg(\"dim\", \"Estimated (chars/4), current session only — actual token counts may differ.\"));\n\t\tconst rows: { label: string; tokens: number }[] = [\n\t\t\t{ label: \"System prompt\", tokens: data.breakdown.systemPrompt },\n\t\t\t...data.breakdown.contextFiles.map((file) => ({ label: file.label, tokens: file.tokens })),\n\t\t\t{ label: \"Skills\", tokens: data.breakdown.skills },\n\t\t\t{ label: \"Tool definitions\", tokens: data.breakdown.toolDefinitions },\n\t\t\t{ label: \"User messages\", tokens: data.breakdown.user },\n\t\t\t{ label: \"Assistant text\", tokens: data.breakdown.assistantText },\n\t\t\t{ label: \"Thinking\", tokens: data.breakdown.thinking },\n\t\t\t{ label: \"Tool calls\", tokens: data.breakdown.toolCalls },\n\t\t\t{ label: \"Tool results\", tokens: data.breakdown.toolResults },\n\t\t\t{ label: \"Summaries\", tokens: data.breakdown.summaries },\n\t\t\t{ label: \"Free\", tokens: data.breakdown.free },\n\t\t].filter((row) => row.tokens > 0);\n\t\tif (rows.length > 0) {\n\t\t\tconst labelWidth = Math.max(...rows.map((row) => row.label.length));\n\t\t\tfor (const row of rows) {\n\t\t\t\tcontent.push(` ${row.label.padEnd(labelWidth)} ${formatTokens(row.tokens)}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (data.context) {\n\t\tconst pct = data.context.percent;\n\t\tconst tokens = data.context.tokens;\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(\"Context window\");\n\t\tconst pctText = pct == null ? \"?\" : `${Math.round(pct)}%`;\n\t\tconst tokensText = tokens == null ? \"?\" : formatTokens(tokens);\n\t\tcontent.push(\n\t\t\t` ${usageBar(pct ?? 0)} ${pctText} (${tokensText} / ${formatTokens(data.context.contextWindow)})`,\n\t\t);\n\t}\n\n\tfor (const plan of data.plan) {\n\t\tif (plan.windows.length === 0) continue;\n\t\tif (content.length > 0) content.push(\"\");\n\t\tconst planName = plan.planLabel ? `${plan.provider} · ${plan.planLabel}` : plan.provider;\n\t\tcontent.push(`Plan usage (${planName})`);\n\t\tconst labelWidth = Math.max(...plan.windows.map((window) => window.label.length));\n\t\tfor (const window of plan.windows) {\n\t\t\tcontent.push(planWindowLine(window, labelWidth));\n\t\t}\n\t}\n\n\tif (content.length === 0) content.push(\"No usage data yet.\");\n\n\treturn renderThemedBox(\" Usage \", content, maxWidth);\n}\n"]}
@@ -121,12 +121,15 @@ export function renderUsageBox(data, maxWidth) {
121
121
  const tokensText = tokens == null ? "?" : formatTokens(tokens);
122
122
  content.push(` ${usageBar(pct ?? 0)} ${pctText} (${tokensText} / ${formatTokens(data.context.contextWindow)})`);
123
123
  }
124
- if (data.plan && data.plan.windows.length > 0) {
124
+ for (const plan of data.plan) {
125
+ if (plan.windows.length === 0)
126
+ continue;
125
127
  if (content.length > 0)
126
128
  content.push("");
127
- content.push(data.plan.planLabel ? `Plan usage (${data.plan.planLabel})` : "Plan usage");
128
- const labelWidth = Math.max(...data.plan.windows.map((window) => window.label.length));
129
- for (const window of data.plan.windows) {
129
+ const planName = plan.planLabel ? `${plan.provider} · ${plan.planLabel}` : plan.provider;
130
+ content.push(`Plan usage (${planName})`);
131
+ const labelWidth = Math.max(...plan.windows.map((window) => window.label.length));
132
+ for (const window of plan.windows) {
130
133
  content.push(planWindowLine(window, labelWidth));
131
134
  }
132
135
  }
@@ -1 +1 @@
1
- {"version":3,"file":"usage-view.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/usage-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGvE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAoB3C,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,kFAAgF;AAChF,MAAM,UAAU,eAAe,CAAC,OAAe,EAAmC;IACjF,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,OAAO,CAAC;IACjC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,SAAS,CAAC;IACnC,OAAO,SAAS,CAAC;AAAA,CACjB;AAED,8EAA8E;AAC9E,SAAS,kBAAkB,CAAC,KAAa,EAAE,SAAiB,EAAE,UAAkB,EAAU;IACzF,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,M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;QAC/C,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QACzF,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QACvF,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAE7D,OAAO,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAAA,CACrD","sourcesContent":["import { truncateToWidth, visibleWidth } from \"@ashx-j/lunr-tui\";\nimport type { ContextBreakdown } from \"../../../core/context-breakdown.ts\";\nimport type { PlanUsage, PlanUsageWindow } from \"../../../core/usage-service.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { formatTokens } from \"./footer.ts\";\n\n/** Simple token totals (rendered by /usage). */\nexport interface UsageTotals {\n\tinput: number;\n\toutput: number;\n\tcacheRead?: number;\n\tcacheWrite?: number;\n\ttotal: number;\n}\n\nexport interface UsageViewData {\n\t/** Session-wide token totals (summed across models); omitted when no usage yet. */\n\tsessionTotals: UsageTotals | undefined;\n\tcontext: { tokens: number | null; contextWindow: number; percent: number | null } | undefined;\n\tplan: PlanUsage | undefined;\n\t/** Live session context split; omitted when the window is unknown. */\n\tbreakdown?: ContextBreakdown;\n}\n\nconst BAR_CELLS = 20;\n\n/** Traffic-light token for a 0–100 usage percent. Matches footer thresholds. */\nexport function usageLevelColor(percent: number): \"success\" | \"warning\" | \"error\" {\n\tif (percent > 90) return \"error\";\n\tif (percent > 70) return \"warning\";\n\treturn \"success\";\n}\n\n/** `cached X (Y%)` where Y = cacheRead / (input + cacheRead + cacheWrite). */\nfunction formatCachedSuffix(input: number, cacheRead: number, cacheWrite: number): string {\n\tif (cacheRead <= 0) return \"\";\n\tconst prompt = input + cacheRead + cacheWrite;\n\tif (prompt <= 0) return \"\";\n\tconst percent = Math.round((cacheRead / prompt) * 100);\n\treturn ` cached ${formatTokens(cacheRead)} (${percent}%)`;\n}\n\n/** 20-cell bar: filled cells green / yellow / red, empty cells dim. */\nexport function usageBar(percent: number): string {\n\tconst clamped = Math.max(0, Math.min(100, percent));\n\tconst filled = Math.round((clamped / 100) * BAR_CELLS);\n\tconst empty = BAR_CELLS - filled;\n\tconst fill = filled > 0 ? theme.fg(usageLevelColor(clamped), \"█\".repeat(filled)) : \"\";\n\tconst rest = empty > 0 ? theme.fg(\"dim\", \"░\".repeat(empty)) : \"\";\n\treturn fill + rest;\n}\n\n/** Compact countdown: `6d 21h`, `2h 51m`, `45m`, `now`. */\nexport function formatResetCountdown(resetsAt: number, now: number = Date.now()): string {\n\tconst diff = resetsAt - now;\n\tif (diff <= 0) return \"now\";\n\tconst minutes = Math.floor(diff / 60000);\n\tif (minutes >= 24 * 60) {\n\t\tconst days = Math.floor(minutes / (24 * 60));\n\t\tconst hours = Math.floor((minutes % (24 * 60)) / 60);\n\t\treturn hours > 0 ? `${days}d ${hours}h` : `${days}d`;\n\t}\n\tif (minutes >= 60) {\n\t\tconst hours = Math.floor(minutes / 60);\n\t\tconst rest = minutes % 60;\n\t\treturn rest > 0 ? `${hours}h ${rest}m` : `${hours}h`;\n\t}\n\treturn `${Math.max(1, minutes)}m`;\n}\n\nfunction planWindowLine(window: PlanUsageWindow, labelWidth: number): string {\n\tconst pct = `${Math.round(window.usedPercent)}% used`;\n\tconst reset = window.resetsAt !== undefined ? ` resets in ${formatResetCountdown(window.resetsAt)}` : \"\";\n\treturn ` ${window.label.padEnd(labelWidth)} ${usageBar(window.usedPercent)} ${pct}${reset}`;\n}\n\n/**\n * Shared bordered box chrome (monochrome, moon theme conventions) used by\n * /usage and /context. `headerText` includes its surrounding spaces (e.g.\n * \" Usage \"). `maxWidth` is the available terminal width; content truncates\n * to fit.\n */\nexport function renderThemedBox(headerText: string, content: string[], maxWidth: number): string[] {\n\t// Box width: widest content + `│ ` / ` │` chrome, capped by the terminal.\n\tconst contentWidth = Math.max(...content.map((line) => visibleWidth(line)));\n\tconst totalWidth = Math.max(24, Math.min(contentWidth + 4, Math.max(24, maxWidth)));\n\tconst innerWidth = totalWidth - 4;\n\n\tconst border = (text: string): string => theme.fg(\"border\", text);\n\tconst top = border(`╭${headerText}${\"─\".repeat(Math.max(0, totalWidth - 2 - headerText.length))}╮`);\n\tconst bottom = border(`╰${\"─\".repeat(totalWidth - 2)}╯`);\n\tconst lines = [top];\n\tfor (const rawLine of content) {\n\t\tconst line = rawLine.length > 0 ? truncateToWidth(rawLine, innerWidth, \"\") : \"\";\n\t\tconst padding = \" \".repeat(Math.max(0, innerWidth - visibleWidth(line)));\n\t\tlines.push(`${border(\"│ \")}${line}${padding}${border(\" │\")}`);\n\t}\n\tlines.push(bottom);\n\treturn lines;\n}\n\n/**\n * Render the /usage bordered box (moon theme conventions).\n * Current session only: token totals, live context split, window bar, plan quota.\n * `maxWidth` is the available terminal width; content truncates to fit.\n */\nexport function renderUsageBox(data: UsageViewData, maxWidth: number): string[] {\n\tconst content: string[] = [];\n\n\tif (data.sessionTotals && data.sessionTotals.total > 0) {\n\t\tcontent.push(\"Session usage\");\n\t\tcontent.push(\n\t\t\t` input ${formatTokens(data.sessionTotals.input)} output ${formatTokens(data.sessionTotals.output)} total ${formatTokens(data.sessionTotals.total)}${formatCachedSuffix(data.sessionTotals.input, data.sessionTotals.cacheRead ?? 0, data.sessionTotals.cacheWrite ?? 0)}`,\n\t\t);\n\t}\n\n\tif (data.breakdown) {\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(\"Context\");\n\t\tcontent.push(theme.fg(\"dim\", \"Estimated (chars/4), current session only — actual token counts may differ.\"));\n\t\tconst rows: { label: string; tokens: number }[] = [\n\t\t\t{ label: \"System prompt\", tokens: data.breakdown.systemPrompt },\n\t\t\t...data.breakdown.contextFiles.map((file) => ({ label: file.label, tokens: file.tokens })),\n\t\t\t{ label: \"Skills\", tokens: data.breakdown.skills },\n\t\t\t{ label: \"Tool definitions\", tokens: data.breakdown.toolDefinitions },\n\t\t\t{ label: \"User messages\", tokens: data.breakdown.user },\n\t\t\t{ label: \"Assistant text\", tokens: data.breakdown.assistantText },\n\t\t\t{ label: \"Thinking\", tokens: data.breakdown.thinking },\n\t\t\t{ label: \"Tool calls\", tokens: data.breakdown.toolCalls },\n\t\t\t{ label: \"Tool results\", tokens: data.breakdown.toolResults },\n\t\t\t{ label: \"Summaries\", tokens: data.breakdown.summaries },\n\t\t\t{ label: \"Free\", tokens: data.breakdown.free },\n\t\t].filter((row) => row.tokens > 0);\n\t\tif (rows.length > 0) {\n\t\t\tconst labelWidth = Math.max(...rows.map((row) => row.label.length));\n\t\t\tfor (const row of rows) {\n\t\t\t\tcontent.push(` ${row.label.padEnd(labelWidth)} ${formatTokens(row.tokens)}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (data.context) {\n\t\tconst pct = data.context.percent;\n\t\tconst tokens = data.context.tokens;\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(\"Context window\");\n\t\tconst pctText = pct == null ? \"?\" : `${Math.round(pct)}%`;\n\t\tconst tokensText = tokens == null ? \"?\" : formatTokens(tokens);\n\t\tcontent.push(\n\t\t\t` ${usageBar(pct ?? 0)} ${pctText} (${tokensText} / ${formatTokens(data.context.contextWindow)})`,\n\t\t);\n\t}\n\n\tif (data.plan && data.plan.windows.length > 0) {\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(data.plan.planLabel ? `Plan usage (${data.plan.planLabel})` : \"Plan usage\");\n\t\tconst labelWidth = Math.max(...data.plan.windows.map((window) => window.label.length));\n\t\tfor (const window of data.plan.windows) {\n\t\t\tcontent.push(planWindowLine(window, labelWidth));\n\t\t}\n\t}\n\n\tif (content.length === 0) content.push(\"No usage data yet.\");\n\n\treturn renderThemedBox(\" Usage \", content, maxWidth);\n}\n"]}
1
+ {"version":3,"file":"usage-view.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/usage-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGvE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAoB3C,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,kFAAgF;AAChF,MAAM,UAAU,eAAe,CAAC,OAAe,EAAmC;IACjF,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,OAAO,CAAC;IACjC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,SAAS,CAAC;IACnC,OAAO,SAAS,CAAC;AAAA,CACjB;AAED,8EAA8E;AAC9E,SAAS,kBAAkB,CAAC,KAAa,EAAE,SAAiB,EAAE,UAAkB,EAAU;IACzF,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;IAC9C,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IACvD,OAAO,YAAY,YAAY,CAAC,SAAS,CAAC,K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C,IAAI,CAAC,QAAQ,CAAC;QACzF,OAAO,CAAC,IAAI,CAAC,eAAe,QAAQ,GAAG,CAAC,CAAC;QACzC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAClF,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAE7D,OAAO,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAAA,CACrD","sourcesContent":["import { truncateToWidth, visibleWidth } from \"@ashx-j/lunr-tui\";\nimport type { ContextBreakdown } from \"../../../core/context-breakdown.ts\";\nimport type { PlanUsage, PlanUsageWindow } from \"../../../core/usage-service.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { formatTokens } from \"./footer.ts\";\n\n/** Simple token totals (rendered by /usage). */\nexport interface UsageTotals {\n\tinput: number;\n\toutput: number;\n\tcacheRead?: number;\n\tcacheWrite?: number;\n\ttotal: number;\n}\n\nexport interface UsageViewData {\n\t/** Session-wide token totals (summed across models); omitted when no usage yet. */\n\tsessionTotals: UsageTotals | undefined;\n\tcontext: { tokens: number | null; contextWindow: number; percent: number | null } | undefined;\n\tplan: PlanUsage[];\n\t/** Live session context split; omitted when the window is unknown. */\n\tbreakdown?: ContextBreakdown;\n}\n\nconst BAR_CELLS = 20;\n\n/** Traffic-light token for a 0–100 usage percent. Matches footer thresholds. */\nexport function usageLevelColor(percent: number): \"success\" | \"warning\" | \"error\" {\n\tif (percent > 90) return \"error\";\n\tif (percent > 70) return \"warning\";\n\treturn \"success\";\n}\n\n/** `cached X (Y%)` where Y = cacheRead / (input + cacheRead + cacheWrite). */\nfunction formatCachedSuffix(input: number, cacheRead: number, cacheWrite: number): string {\n\tif (cacheRead <= 0) return \"\";\n\tconst prompt = input + cacheRead + cacheWrite;\n\tif (prompt <= 0) return \"\";\n\tconst percent = Math.round((cacheRead / prompt) * 100);\n\treturn ` cached ${formatTokens(cacheRead)} (${percent}%)`;\n}\n\n/** 20-cell bar: filled cells green / yellow / red, empty cells dim. */\nexport function usageBar(percent: number): string {\n\tconst clamped = Math.max(0, Math.min(100, percent));\n\tconst filled = Math.round((clamped / 100) * BAR_CELLS);\n\tconst empty = BAR_CELLS - filled;\n\tconst fill = filled > 0 ? theme.fg(usageLevelColor(clamped), \"█\".repeat(filled)) : \"\";\n\tconst rest = empty > 0 ? theme.fg(\"dim\", \"░\".repeat(empty)) : \"\";\n\treturn fill + rest;\n}\n\n/** Compact countdown: `6d 21h`, `2h 51m`, `45m`, `now`. */\nexport function formatResetCountdown(resetsAt: number, now: number = Date.now()): string {\n\tconst diff = resetsAt - now;\n\tif (diff <= 0) return \"now\";\n\tconst minutes = Math.floor(diff / 60000);\n\tif (minutes >= 24 * 60) {\n\t\tconst days = Math.floor(minutes / (24 * 60));\n\t\tconst hours = Math.floor((minutes % (24 * 60)) / 60);\n\t\treturn hours > 0 ? `${days}d ${hours}h` : `${days}d`;\n\t}\n\tif (minutes >= 60) {\n\t\tconst hours = Math.floor(minutes / 60);\n\t\tconst rest = minutes % 60;\n\t\treturn rest > 0 ? `${hours}h ${rest}m` : `${hours}h`;\n\t}\n\treturn `${Math.max(1, minutes)}m`;\n}\n\nfunction planWindowLine(window: PlanUsageWindow, labelWidth: number): string {\n\tconst pct = `${Math.round(window.usedPercent)}% used`;\n\tconst reset = window.resetsAt !== undefined ? ` resets in ${formatResetCountdown(window.resetsAt)}` : \"\";\n\treturn ` ${window.label.padEnd(labelWidth)} ${usageBar(window.usedPercent)} ${pct}${reset}`;\n}\n\n/**\n * Shared bordered box chrome (monochrome, moon theme conventions) used by\n * /usage and /context. `headerText` includes its surrounding spaces (e.g.\n * \" Usage \"). `maxWidth` is the available terminal width; content truncates\n * to fit.\n */\nexport function renderThemedBox(headerText: string, content: string[], maxWidth: number): string[] {\n\t// Box width: widest content + `│ ` / ` │` chrome, capped by the terminal.\n\tconst contentWidth = Math.max(...content.map((line) => visibleWidth(line)));\n\tconst totalWidth = Math.max(24, Math.min(contentWidth + 4, Math.max(24, maxWidth)));\n\tconst innerWidth = totalWidth - 4;\n\n\tconst border = (text: string): string => theme.fg(\"border\", text);\n\tconst top = border(`╭${headerText}${\"─\".repeat(Math.max(0, totalWidth - 2 - headerText.length))}╮`);\n\tconst bottom = border(`╰${\"─\".repeat(totalWidth - 2)}╯`);\n\tconst lines = [top];\n\tfor (const rawLine of content) {\n\t\tconst line = rawLine.length > 0 ? truncateToWidth(rawLine, innerWidth, \"\") : \"\";\n\t\tconst padding = \" \".repeat(Math.max(0, innerWidth - visibleWidth(line)));\n\t\tlines.push(`${border(\"│ \")}${line}${padding}${border(\" │\")}`);\n\t}\n\tlines.push(bottom);\n\treturn lines;\n}\n\n/**\n * Render the /usage bordered box (moon theme conventions).\n * Current session only: token totals, live context split, window bar, plan quota.\n * `maxWidth` is the available terminal width; content truncates to fit.\n */\nexport function renderUsageBox(data: UsageViewData, maxWidth: number): string[] {\n\tconst content: string[] = [];\n\n\tif (data.sessionTotals && data.sessionTotals.total > 0) {\n\t\tcontent.push(\"Session usage\");\n\t\tcontent.push(\n\t\t\t` input ${formatTokens(data.sessionTotals.input)} output ${formatTokens(data.sessionTotals.output)} total ${formatTokens(data.sessionTotals.total)}${formatCachedSuffix(data.sessionTotals.input, data.sessionTotals.cacheRead ?? 0, data.sessionTotals.cacheWrite ?? 0)}`,\n\t\t);\n\t}\n\n\tif (data.breakdown) {\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(\"Context\");\n\t\tcontent.push(theme.fg(\"dim\", \"Estimated (chars/4), current session only — actual token counts may differ.\"));\n\t\tconst rows: { label: string; tokens: number }[] = [\n\t\t\t{ label: \"System prompt\", tokens: data.breakdown.systemPrompt },\n\t\t\t...data.breakdown.contextFiles.map((file) => ({ label: file.label, tokens: file.tokens })),\n\t\t\t{ label: \"Skills\", tokens: data.breakdown.skills },\n\t\t\t{ label: \"Tool definitions\", tokens: data.breakdown.toolDefinitions },\n\t\t\t{ label: \"User messages\", tokens: data.breakdown.user },\n\t\t\t{ label: \"Assistant text\", tokens: data.breakdown.assistantText },\n\t\t\t{ label: \"Thinking\", tokens: data.breakdown.thinking },\n\t\t\t{ label: \"Tool calls\", tokens: data.breakdown.toolCalls },\n\t\t\t{ label: \"Tool results\", tokens: data.breakdown.toolResults },\n\t\t\t{ label: \"Summaries\", tokens: data.breakdown.summaries },\n\t\t\t{ label: \"Free\", tokens: data.breakdown.free },\n\t\t].filter((row) => row.tokens > 0);\n\t\tif (rows.length > 0) {\n\t\t\tconst labelWidth = Math.max(...rows.map((row) => row.label.length));\n\t\t\tfor (const row of rows) {\n\t\t\t\tcontent.push(` ${row.label.padEnd(labelWidth)} ${formatTokens(row.tokens)}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (data.context) {\n\t\tconst pct = data.context.percent;\n\t\tconst tokens = data.context.tokens;\n\t\tif (content.length > 0) content.push(\"\");\n\t\tcontent.push(\"Context window\");\n\t\tconst pctText = pct == null ? \"?\" : `${Math.round(pct)}%`;\n\t\tconst tokensText = tokens == null ? \"?\" : formatTokens(tokens);\n\t\tcontent.push(\n\t\t\t` ${usageBar(pct ?? 0)} ${pctText} (${tokensText} / ${formatTokens(data.context.contextWindow)})`,\n\t\t);\n\t}\n\n\tfor (const plan of data.plan) {\n\t\tif (plan.windows.length === 0) continue;\n\t\tif (content.length > 0) content.push(\"\");\n\t\tconst planName = plan.planLabel ? `${plan.provider} · ${plan.planLabel}` : plan.provider;\n\t\tcontent.push(`Plan usage (${planName})`);\n\t\tconst labelWidth = Math.max(...plan.windows.map((window) => window.label.length));\n\t\tfor (const window of plan.windows) {\n\t\t\tcontent.push(planWindowLine(window, labelWidth));\n\t\t}\n\t}\n\n\tif (content.length === 0) content.push(\"No usage data yet.\");\n\n\treturn renderThemedBox(\" Usage \", content, maxWidth);\n}\n"]}
@@ -87,7 +87,6 @@ export declare class InteractiveMode {
87
87
  private signalCleanupHandlers;
88
88
  private isBashMode;
89
89
  private swarmMode;
90
- private researchMode;
91
90
  private previousPermissionMode;
92
91
  private preGoalPermissionMode;
93
92
  private redoStack;
@@ -429,7 +428,6 @@ export declare class InteractiveMode {
429
428
  private showLoginDialog;
430
429
  private handleInitCommand;
431
430
  private handleSwarmCommand;
432
- private handleResearchCommand;
433
431
  private rewindLastTurn;
434
432
  private handleUndoCommand;
435
433
  private handleEditCommand;
@@ -452,6 +450,7 @@ export declare class InteractiveMode {
452
450
  private generateSessionTitle;
453
451
  private handleSessionCommand;
454
452
  private collectUsageBreakdown;
453
+ private handleFastCommand;
455
454
  private handleUsageCommand;
456
455
  private handleContextCommand;
457
456
  private handlePlanCommand;