apex-code 0.5.0 → 0.5.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 (509) hide show
  1. package/CHANGELOG.md +257 -5
  2. package/README.md +624 -0
  3. package/dist/bun/cli.d.ts +3 -1
  4. package/dist/bun/cli.d.ts.map +1 -1
  5. package/dist/bun/cli.js +3 -9
  6. package/dist/bun/cli.js.map +1 -1
  7. package/dist/bun/runtime-setup.d.ts +2 -0
  8. package/dist/bun/runtime-setup.d.ts.map +1 -0
  9. package/dist/bun/runtime-setup.js +9 -0
  10. package/dist/bun/runtime-setup.js.map +1 -0
  11. package/dist/bun/sandbox-env-setup.d.ts +2 -0
  12. package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
  13. package/dist/bun/sandbox-env-setup.js +4 -0
  14. package/dist/bun/sandbox-env-setup.js.map +1 -0
  15. package/dist/cli/args.d.ts.map +1 -1
  16. package/dist/cli/args.js +16 -5
  17. package/dist/cli/args.js.map +1 -1
  18. package/dist/cli/config-selector.d.ts.map +1 -1
  19. package/dist/cli/config-selector.js +2 -1
  20. package/dist/cli/config-selector.js.map +1 -1
  21. package/dist/cli/file-processor.d.ts +1 -1
  22. package/dist/cli/file-processor.d.ts.map +1 -1
  23. package/dist/cli/file-processor.js.map +1 -1
  24. package/dist/cli/session-picker.d.ts +1 -1
  25. package/dist/cli/session-picker.d.ts.map +1 -1
  26. package/dist/cli/session-picker.js.map +1 -1
  27. package/dist/cli/setup.d.ts +2 -0
  28. package/dist/cli/setup.d.ts.map +1 -0
  29. package/dist/cli/setup.js +13 -0
  30. package/dist/cli/setup.js.map +1 -0
  31. package/dist/config.d.ts +1 -0
  32. package/dist/config.d.ts.map +1 -1
  33. package/dist/config.js +1 -0
  34. package/dist/config.js.map +1 -1
  35. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  36. package/dist/core/agent-session-runtime.js +16 -8
  37. package/dist/core/agent-session-runtime.js.map +1 -1
  38. package/dist/core/agent-session.d.ts +85 -15
  39. package/dist/core/agent-session.d.ts.map +1 -1
  40. package/dist/core/agent-session.js +685 -266
  41. package/dist/core/agent-session.js.map +1 -1
  42. package/dist/core/auth-storage.d.ts +4 -0
  43. package/dist/core/auth-storage.d.ts.map +1 -1
  44. package/dist/core/auth-storage.js +55 -0
  45. package/dist/core/auth-storage.js.map +1 -1
  46. package/dist/core/bug-report.d.ts +176 -0
  47. package/dist/core/bug-report.d.ts.map +1 -0
  48. package/dist/core/bug-report.js +291 -0
  49. package/dist/core/bug-report.js.map +1 -0
  50. package/dist/core/cache-stats.d.ts.map +1 -1
  51. package/dist/core/cache-stats.js +12 -1
  52. package/dist/core/cache-stats.js.map +1 -1
  53. package/dist/core/cache-warmer.d.ts +103 -0
  54. package/dist/core/cache-warmer.d.ts.map +1 -0
  55. package/dist/core/cache-warmer.js +356 -0
  56. package/dist/core/cache-warmer.js.map +1 -0
  57. package/dist/core/compaction/branch-summarization.d.ts +1 -1
  58. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  59. package/dist/core/compaction/branch-summarization.js +4 -3
  60. package/dist/core/compaction/branch-summarization.js.map +1 -1
  61. package/dist/core/compaction/compaction.d.ts +5 -3
  62. package/dist/core/compaction/compaction.d.ts.map +1 -1
  63. package/dist/core/compaction/compaction.js +163 -66
  64. package/dist/core/compaction/compaction.js.map +1 -1
  65. package/dist/core/context/pipeline.d.ts +8 -8
  66. package/dist/core/context/pipeline.d.ts.map +1 -1
  67. package/dist/core/context/pipeline.js +21 -12
  68. package/dist/core/context/pipeline.js.map +1 -1
  69. package/dist/core/crash-log.d.ts +27 -0
  70. package/dist/core/crash-log.d.ts.map +1 -0
  71. package/dist/core/crash-log.js +139 -0
  72. package/dist/core/crash-log.js.map +1 -0
  73. package/dist/core/export-html/template.js +6 -1
  74. package/dist/core/extensions/index.d.ts +1 -1
  75. package/dist/core/extensions/index.d.ts.map +1 -1
  76. package/dist/core/extensions/index.js.map +1 -1
  77. package/dist/core/extensions/jiti-loader.d.ts +2 -0
  78. package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
  79. package/dist/core/extensions/jiti-loader.js +4 -0
  80. package/dist/core/extensions/jiti-loader.js.map +1 -0
  81. package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
  82. package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
  83. package/dist/core/extensions/jiti-static-loader.js +4 -0
  84. package/dist/core/extensions/jiti-static-loader.js.map +1 -0
  85. package/dist/core/extensions/loader.d.ts.map +1 -1
  86. package/dist/core/extensions/loader.js +40 -59
  87. package/dist/core/extensions/loader.js.map +1 -1
  88. package/dist/core/extensions/runner.d.ts +24 -8
  89. package/dist/core/extensions/runner.d.ts.map +1 -1
  90. package/dist/core/extensions/runner.js +195 -72
  91. package/dist/core/extensions/runner.js.map +1 -1
  92. package/dist/core/extensions/types.d.ts +142 -55
  93. package/dist/core/extensions/types.d.ts.map +1 -1
  94. package/dist/core/extensions/types.js.map +1 -1
  95. package/dist/core/extensions/virtual-modules.d.ts +3 -0
  96. package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
  97. package/dist/core/extensions/virtual-modules.js +41 -0
  98. package/dist/core/extensions/virtual-modules.js.map +1 -0
  99. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  100. package/dist/core/extensions/wrapper.js +1 -20
  101. package/dist/core/extensions/wrapper.js.map +1 -1
  102. package/dist/core/http-dispatcher.d.ts.map +1 -1
  103. package/dist/core/http-dispatcher.js +2 -0
  104. package/dist/core/http-dispatcher.js.map +1 -1
  105. package/dist/core/index.d.ts +2 -1
  106. package/dist/core/index.d.ts.map +1 -1
  107. package/dist/core/index.js.map +1 -1
  108. package/dist/core/keybindings.d.ts +6 -1
  109. package/dist/core/keybindings.d.ts.map +1 -1
  110. package/dist/core/keybindings.js +5 -1
  111. package/dist/core/keybindings.js.map +1 -1
  112. package/dist/core/messages.d.ts +1 -1
  113. package/dist/core/messages.d.ts.map +1 -1
  114. package/dist/core/messages.js +1 -0
  115. package/dist/core/messages.js.map +1 -1
  116. package/dist/core/model-config.d.ts +168 -20
  117. package/dist/core/model-config.d.ts.map +1 -1
  118. package/dist/core/model-config.js +44 -18
  119. package/dist/core/model-config.js.map +1 -1
  120. package/dist/core/model-registry.d.ts +5 -1
  121. package/dist/core/model-registry.d.ts.map +1 -1
  122. package/dist/core/model-registry.js +8 -0
  123. package/dist/core/model-registry.js.map +1 -1
  124. package/dist/core/model-resolver.d.ts.map +1 -1
  125. package/dist/core/model-resolver.js +4 -3
  126. package/dist/core/model-resolver.js.map +1 -1
  127. package/dist/core/model-runtime.d.ts +1 -0
  128. package/dist/core/model-runtime.d.ts.map +1 -1
  129. package/dist/core/model-runtime.js +12 -6
  130. package/dist/core/model-runtime.js.map +1 -1
  131. package/dist/core/permissions/store.d.ts.map +1 -1
  132. package/dist/core/permissions/store.js +11 -8
  133. package/dist/core/permissions/store.js.map +1 -1
  134. package/dist/core/prompt-templates.d.ts +6 -1
  135. package/dist/core/prompt-templates.d.ts.map +1 -1
  136. package/dist/core/prompt-templates.js +61 -35
  137. package/dist/core/prompt-templates.js.map +1 -1
  138. package/dist/core/provider-composer.d.ts +4 -2
  139. package/dist/core/provider-composer.d.ts.map +1 -1
  140. package/dist/core/provider-composer.js +29 -2
  141. package/dist/core/provider-composer.js.map +1 -1
  142. package/dist/core/radius.d.ts +3 -0
  143. package/dist/core/radius.d.ts.map +1 -1
  144. package/dist/core/radius.js +6 -0
  145. package/dist/core/radius.js.map +1 -1
  146. package/dist/core/resource-loader.d.ts.map +1 -1
  147. package/dist/core/resource-loader.js +6 -2
  148. package/dist/core/resource-loader.js.map +1 -1
  149. package/dist/core/sdk.d.ts.map +1 -1
  150. package/dist/core/sdk.js +63 -42
  151. package/dist/core/sdk.js.map +1 -1
  152. package/dist/core/session-export.d.ts +6 -2
  153. package/dist/core/session-export.d.ts.map +1 -1
  154. package/dist/core/session-export.js +14 -13
  155. package/dist/core/session-export.js.map +1 -1
  156. package/dist/core/session-manager.d.ts +66 -15
  157. package/dist/core/session-manager.d.ts.map +1 -1
  158. package/dist/core/session-manager.js +295 -115
  159. package/dist/core/session-manager.js.map +1 -1
  160. package/dist/core/settings-manager.d.ts +27 -4
  161. package/dist/core/settings-manager.d.ts.map +1 -1
  162. package/dist/core/settings-manager.js +55 -7
  163. package/dist/core/settings-manager.js.map +1 -1
  164. package/dist/core/skills.d.ts +1 -1
  165. package/dist/core/skills.d.ts.map +1 -1
  166. package/dist/core/skills.js +5 -4
  167. package/dist/core/skills.js.map +1 -1
  168. package/dist/core/slash-commands.d.ts.map +1 -1
  169. package/dist/core/slash-commands.js +1 -0
  170. package/dist/core/slash-commands.js.map +1 -1
  171. package/dist/core/system-prompt.d.ts +49 -6
  172. package/dist/core/system-prompt.d.ts.map +1 -1
  173. package/dist/core/system-prompt.js +140 -79
  174. package/dist/core/system-prompt.js.map +1 -1
  175. package/dist/core/tools/bash.d.ts +7 -8
  176. package/dist/core/tools/bash.d.ts.map +1 -1
  177. package/dist/core/tools/bash.js +20 -115
  178. package/dist/core/tools/bash.js.map +1 -1
  179. package/dist/core/tools/edit.d.ts +1 -12
  180. package/dist/core/tools/edit.d.ts.map +1 -1
  181. package/dist/core/tools/edit.js +6 -204
  182. package/dist/core/tools/edit.js.map +1 -1
  183. package/dist/core/tools/find.d.ts.map +1 -1
  184. package/dist/core/tools/find.js +4 -55
  185. package/dist/core/tools/find.js.map +1 -1
  186. package/dist/core/tools/grep.d.ts.map +1 -1
  187. package/dist/core/tools/grep.js +4 -60
  188. package/dist/core/tools/grep.js.map +1 -1
  189. package/dist/core/tools/ls.d.ts.map +1 -1
  190. package/dist/core/tools/ls.js +4 -49
  191. package/dist/core/tools/ls.js.map +1 -1
  192. package/dist/core/tools/read.d.ts +4 -1
  193. package/dist/core/tools/read.d.ts.map +1 -1
  194. package/dist/core/tools/read.js +10 -125
  195. package/dist/core/tools/read.js.map +1 -1
  196. package/dist/core/tools/renderers/bash.d.ts +18 -0
  197. package/dist/core/tools/renderers/bash.d.ts.map +1 -0
  198. package/dist/core/tools/renderers/bash.js +126 -0
  199. package/dist/core/tools/renderers/bash.js.map +1 -0
  200. package/dist/core/tools/renderers/edit.d.ts +23 -0
  201. package/dist/core/tools/renderers/edit.d.ts.map +1 -0
  202. package/dist/core/tools/renderers/edit.js +207 -0
  203. package/dist/core/tools/renderers/edit.js.map +1 -0
  204. package/dist/core/tools/renderers/find.d.ts +10 -0
  205. package/dist/core/tools/renderers/find.d.ts.map +1 -0
  206. package/dist/core/tools/renderers/find.js +64 -0
  207. package/dist/core/tools/renderers/find.js.map +1 -0
  208. package/dist/core/tools/renderers/grep.d.ts +10 -0
  209. package/dist/core/tools/renderers/grep.d.ts.map +1 -0
  210. package/dist/core/tools/renderers/grep.js +69 -0
  211. package/dist/core/tools/renderers/grep.js.map +1 -0
  212. package/dist/core/tools/renderers/index.d.ts +34 -0
  213. package/dist/core/tools/renderers/index.d.ts.map +1 -0
  214. package/dist/core/tools/renderers/index.js +47 -0
  215. package/dist/core/tools/renderers/index.js.map +1 -0
  216. package/dist/core/tools/renderers/ls.d.ts +10 -0
  217. package/dist/core/tools/renderers/ls.d.ts.map +1 -0
  218. package/dist/core/tools/renderers/ls.js +58 -0
  219. package/dist/core/tools/renderers/ls.js.map +1 -0
  220. package/dist/core/tools/renderers/read.d.ts +11 -0
  221. package/dist/core/tools/renderers/read.d.ts.map +1 -0
  222. package/dist/core/tools/renderers/read.js +132 -0
  223. package/dist/core/tools/renderers/read.js.map +1 -0
  224. package/dist/core/tools/renderers/write.d.ts +10 -0
  225. package/dist/core/tools/renderers/write.d.ts.map +1 -0
  226. package/dist/core/tools/renderers/write.js +152 -0
  227. package/dist/core/tools/renderers/write.js.map +1 -0
  228. package/dist/core/tools/write.d.ts.map +1 -1
  229. package/dist/core/tools/write.js +6 -146
  230. package/dist/core/tools/write.js.map +1 -1
  231. package/dist/core/usage-totals.d.ts +1 -1
  232. package/dist/core/usage-totals.d.ts.map +1 -1
  233. package/dist/core/usage-totals.js +5 -1
  234. package/dist/core/usage-totals.js.map +1 -1
  235. package/dist/extensions/llama/client.d.ts +2 -0
  236. package/dist/extensions/llama/client.d.ts.map +1 -1
  237. package/dist/extensions/llama/client.js +7 -3
  238. package/dist/extensions/llama/client.js.map +1 -1
  239. package/dist/extensions/llama/provider.d.ts.map +1 -1
  240. package/dist/extensions/llama/provider.js +20 -5
  241. package/dist/extensions/llama/provider.js.map +1 -1
  242. package/dist/index.d.ts +5 -4
  243. package/dist/index.d.ts.map +1 -1
  244. package/dist/index.js +1 -1
  245. package/dist/index.js.map +1 -1
  246. package/dist/main.d.ts.map +1 -1
  247. package/dist/main.js +21 -13
  248. package/dist/main.js.map +1 -1
  249. package/dist/modes/interactive/bug-report.d.ts +16 -0
  250. package/dist/modes/interactive/bug-report.d.ts.map +1 -0
  251. package/dist/modes/interactive/bug-report.js +167 -0
  252. package/dist/modes/interactive/bug-report.js.map +1 -0
  253. package/dist/modes/interactive/chat-viewport.d.ts +20 -0
  254. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
  255. package/dist/modes/interactive/chat-viewport.js +28 -0
  256. package/dist/modes/interactive/chat-viewport.js.map +1 -0
  257. package/dist/modes/interactive/components/assistant-message.d.ts +7 -0
  258. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  259. package/dist/modes/interactive/components/assistant-message.js +63 -17
  260. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  261. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  262. package/dist/modes/interactive/components/branch-summary-message.js +12 -5
  263. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  264. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  265. package/dist/modes/interactive/components/compaction-summary-message.js +12 -5
  266. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  267. package/dist/modes/interactive/components/custom-editor.d.ts +12 -0
  268. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  269. package/dist/modes/interactive/components/custom-editor.js +38 -0
  270. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  271. package/dist/modes/interactive/components/error-summary.d.ts +11 -0
  272. package/dist/modes/interactive/components/error-summary.d.ts.map +1 -0
  273. package/dist/modes/interactive/components/error-summary.js +31 -0
  274. package/dist/modes/interactive/components/error-summary.js.map +1 -0
  275. package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
  276. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  277. package/dist/modes/interactive/components/extension-editor.js +6 -1
  278. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  279. package/dist/modes/interactive/components/extension-input.d.ts +2 -0
  280. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  281. package/dist/modes/interactive/components/extension-input.js +6 -0
  282. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  283. package/dist/modes/interactive/components/extension-selector.d.ts +2 -0
  284. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  285. package/dist/modes/interactive/components/extension-selector.js +4 -0
  286. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  287. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  288. package/dist/modes/interactive/components/footer.js +4 -1
  289. package/dist/modes/interactive/components/footer.js.map +1 -1
  290. package/dist/modes/interactive/components/index.d.ts +1 -1
  291. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  292. package/dist/modes/interactive/components/index.js.map +1 -1
  293. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  294. package/dist/modes/interactive/components/model-selector.js +3 -3
  295. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  296. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  297. package/dist/modes/interactive/components/scoped-models-selector.js +13 -15
  298. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  299. package/dist/modes/interactive/components/session-selector.d.ts +5 -5
  300. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  301. package/dist/modes/interactive/components/session-selector.js +74 -48
  302. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  303. package/dist/modes/interactive/components/settings-selector.d.ts +5 -1
  304. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  305. package/dist/modes/interactive/components/settings-selector.js +35 -10
  306. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  307. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  308. package/dist/modes/interactive/components/skill-invocation-message.js +11 -4
  309. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  310. package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
  311. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  312. package/dist/modes/interactive/components/status-indicator.js +10 -3
  313. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  314. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  315. package/dist/modes/interactive/components/thinking-selector.js +6 -6
  316. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  317. package/dist/modes/interactive/components/tool-execution.d.ts +27 -5
  318. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  319. package/dist/modes/interactive/components/tool-execution.js +64 -42
  320. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  321. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  322. package/dist/modes/interactive/components/tree-selector.js +9 -0
  323. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  324. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
  325. package/dist/modes/interactive/components/trust-selector.js +2 -2
  326. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  327. package/dist/modes/interactive/interactive-mode.d.ts +43 -29
  328. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  329. package/dist/modes/interactive/interactive-mode.js +431 -166
  330. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  331. package/dist/modes/interactive/theme/dark.json +2 -1
  332. package/dist/modes/interactive/theme/light.json +2 -1
  333. package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
  334. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  335. package/dist/modes/interactive/theme/theme-controller.js +5 -0
  336. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  337. package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
  338. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  339. package/dist/modes/interactive/theme/theme-json.js +130 -0
  340. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  341. package/dist/modes/interactive/theme/theme-schema.json +6 -2
  342. package/dist/modes/interactive/theme/theme.d.ts +14 -5
  343. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  344. package/dist/modes/interactive/theme/theme.js +18 -119
  345. package/dist/modes/interactive/theme/theme.js.map +1 -1
  346. package/dist/modes/interactive/tui-renderer.d.ts +21 -0
  347. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
  348. package/dist/modes/interactive/tui-renderer.js +66 -0
  349. package/dist/modes/interactive/tui-renderer.js.map +1 -0
  350. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  351. package/dist/modes/rpc/rpc-mode.js +2 -2
  352. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  353. package/dist/testing/replay/recorded-provider.d.ts +2 -2
  354. package/dist/testing/replay/recorded-provider.d.ts.map +1 -1
  355. package/dist/testing/replay/recorded-provider.js +2 -5
  356. package/dist/testing/replay/recorded-provider.js.map +1 -1
  357. package/dist/testing/replay/runner.d.ts.map +1 -1
  358. package/dist/testing/replay/runner.js +0 -1
  359. package/dist/testing/replay/runner.js.map +1 -1
  360. package/dist/utils/clipboard-command.d.ts +7 -0
  361. package/dist/utils/clipboard-command.d.ts.map +1 -0
  362. package/dist/utils/clipboard-command.js +45 -0
  363. package/dist/utils/clipboard-command.js.map +1 -0
  364. package/dist/utils/clipboard-image.d.ts.map +1 -1
  365. package/dist/utils/clipboard-image.js +53 -81
  366. package/dist/utils/clipboard-image.js.map +1 -1
  367. package/dist/utils/clipboard.d.ts.map +1 -1
  368. package/dist/utils/clipboard.js +111 -121
  369. package/dist/utils/clipboard.js.map +1 -1
  370. package/dist/utils/exif-orientation.d.ts.map +1 -1
  371. package/dist/utils/exif-orientation.js +2 -3
  372. package/dist/utils/exif-orientation.js.map +1 -1
  373. package/dist/utils/mime.d.ts.map +1 -1
  374. package/dist/utils/mime.js +1 -1
  375. package/dist/utils/mime.js.map +1 -1
  376. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  377. package/dist/utils/syntax-highlight.js +21 -21
  378. package/dist/utils/syntax-highlight.js.map +1 -1
  379. package/dist/utils/tool-result-images.d.ts +3 -1
  380. package/dist/utils/tool-result-images.d.ts.map +1 -1
  381. package/dist/utils/tool-result-images.js +4 -1
  382. package/dist/utils/tool-result-images.js.map +1 -1
  383. package/dist/utils/tools-manager.d.ts.map +1 -1
  384. package/dist/utils/tools-manager.js +11 -2
  385. package/dist/utils/tools-manager.js.map +1 -1
  386. package/dist/utils/wsl.d.ts +3 -0
  387. package/dist/utils/wsl.d.ts.map +1 -0
  388. package/dist/utils/wsl.js +15 -0
  389. package/dist/utils/wsl.js.map +1 -0
  390. package/dist/utils/zip.d.ts +7 -0
  391. package/dist/utils/zip.d.ts.map +1 -0
  392. package/dist/utils/zip.js +60 -0
  393. package/dist/utils/zip.js.map +1 -0
  394. package/docs/cli-integration.md +107 -0
  395. package/docs/cli.md +269 -0
  396. package/docs/compaction.md +73 -24
  397. package/docs/configuration.md +45 -0
  398. package/docs/containerization.md +22 -21
  399. package/docs/custom-provider.md +21 -12
  400. package/docs/development.md +19 -0
  401. package/docs/docs.json +139 -95
  402. package/docs/extensions.md +243 -371
  403. package/docs/how-pi-works.md +49 -0
  404. package/docs/images/interactive-mode.png +0 -0
  405. package/docs/index.md +3 -3
  406. package/docs/json.md +7 -3
  407. package/docs/keybindings.md +57 -54
  408. package/docs/llama-cpp.md +2 -2
  409. package/docs/message-types.md +261 -0
  410. package/docs/models.md +103 -49
  411. package/docs/packages.md +49 -47
  412. package/docs/prompt-templates.md +29 -56
  413. package/docs/providers.md +91 -139
  414. package/docs/quickstart.md +42 -14
  415. package/docs/rpc-commands.md +854 -0
  416. package/docs/rpc-extension-ui.md +200 -0
  417. package/docs/rpc.md +121 -223
  418. package/docs/sdk.md +99 -124
  419. package/docs/security.md +7 -7
  420. package/docs/session-format.md +85 -82
  421. package/docs/sessions.md +41 -57
  422. package/docs/settings.md +94 -87
  423. package/docs/shell-aliases.md +68 -3
  424. package/docs/skills.md +62 -49
  425. package/docs/slash-commands.md +60 -0
  426. package/docs/terminal-setup.md +86 -55
  427. package/docs/termux.md +65 -75
  428. package/docs/themes.md +64 -86
  429. package/docs/tmux.md +29 -7
  430. package/docs/tui.md +67 -122
  431. package/docs/usage.md +31 -42
  432. package/docs/windows.md +41 -13
  433. package/examples/README.md +16 -2
  434. package/examples/extensions/README.md +0 -1
  435. package/examples/extensions/custom-provider-anthropic/index.ts +18 -12
  436. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  437. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  438. package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  439. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  440. package/examples/extensions/dynamic-resources/dynamic.json +2 -0
  441. package/examples/extensions/gondolin/package-lock.json +2 -2
  442. package/examples/extensions/gondolin/package.json +1 -1
  443. package/examples/extensions/prompt-customizer.ts +19 -67
  444. package/examples/extensions/sandbox/package-lock.json +2 -2
  445. package/examples/extensions/sandbox/package.json +1 -1
  446. package/examples/extensions/with-deps/package-lock.json +2 -2
  447. package/examples/extensions/with-deps/package.json +1 -1
  448. package/examples/plugins/pi-example-plugin/README.md +38 -0
  449. package/examples/plugins/pi-example-plugin/package.json +10 -0
  450. package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  451. package/examples/plugins/pi-example-plugin/src/session.ts +24 -0
  452. package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  453. package/examples/rpc-client.ts +35 -0
  454. package/examples/rpc-extension-ui.ts +25 -5
  455. package/examples/sdk/README.md +1 -1
  456. package/npm-shrinkwrap.json +861 -513
  457. package/package.json +27 -18
  458. package/dist/bun/register-bedrock.d.ts +0 -2
  459. package/dist/bun/register-bedrock.d.ts.map +0 -1
  460. package/dist/bun/register-bedrock.js +0 -4
  461. package/dist/bun/register-bedrock.js.map +0 -1
  462. package/dist/cli/experimental/auth.d.ts +0 -16
  463. package/dist/cli/experimental/auth.d.ts.map +0 -1
  464. package/dist/cli/experimental/auth.js +0 -13
  465. package/dist/cli/experimental/auth.js.map +0 -1
  466. package/dist/cli/experimental/cli.d.ts +0 -6
  467. package/dist/cli/experimental/cli.d.ts.map +0 -1
  468. package/dist/cli/experimental/cli.js +0 -5
  469. package/dist/cli/experimental/cli.js.map +0 -1
  470. package/dist/cli/experimental/command-options.d.ts +0 -17
  471. package/dist/cli/experimental/command-options.d.ts.map +0 -1
  472. package/dist/cli/experimental/command-options.js +0 -35
  473. package/dist/cli/experimental/command-options.js.map +0 -1
  474. package/dist/cli/experimental/command.d.ts +0 -63
  475. package/dist/cli/experimental/command.d.ts.map +0 -1
  476. package/dist/cli/experimental/command.js +0 -130
  477. package/dist/cli/experimental/command.js.map +0 -1
  478. package/dist/cli/experimental/commands/client.d.ts +0 -13
  479. package/dist/cli/experimental/commands/client.d.ts.map +0 -1
  480. package/dist/cli/experimental/commands/client.js +0 -25
  481. package/dist/cli/experimental/commands/client.js.map +0 -1
  482. package/dist/cli/experimental/commands/pi.d.ts +0 -15
  483. package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
  484. package/dist/cli/experimental/commands/pi.js +0 -28
  485. package/dist/cli/experimental/commands/pi.js.map +0 -1
  486. package/dist/cli/experimental/commands/server.d.ts +0 -13
  487. package/dist/cli/experimental/commands/server.d.ts.map +0 -1
  488. package/dist/cli/experimental/commands/server.js +0 -25
  489. package/dist/cli/experimental/commands/server.js.map +0 -1
  490. package/dist/cli/experimental/transport-address.d.ts +0 -10
  491. package/dist/cli/experimental/transport-address.d.ts.map +0 -1
  492. package/dist/cli/experimental/transport-address.js +0 -38
  493. package/dist/cli/experimental/transport-address.js.map +0 -1
  494. package/dist/client/index.d.ts +0 -3
  495. package/dist/client/index.d.ts.map +0 -1
  496. package/dist/client/index.js +0 -3
  497. package/dist/client/index.js.map +0 -1
  498. package/dist/client/remote-session.d.ts +0 -53
  499. package/dist/client/remote-session.d.ts.map +0 -1
  500. package/dist/client/remote-session.js +0 -340
  501. package/dist/client/remote-session.js.map +0 -1
  502. package/dist/client/transcript.d.ts +0 -12
  503. package/dist/client/transcript.d.ts.map +0 -1
  504. package/dist/client/transcript.js +0 -98
  505. package/dist/client/transcript.js.map +0 -1
  506. package/dist/utils/clipboard-native.d.ts +0 -11
  507. package/dist/utils/clipboard-native.d.ts.map +0 -1
  508. package/dist/utils/clipboard-native.js +0 -20
  509. package/dist/utils/clipboard-native.js.map +0 -1
@@ -1,39 +1,42 @@
1
- # Terminal Setup
1
+ # Configure your terminal
2
2
 
3
3
  Apex Code uses the [Kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) for reliable modifier key detection. Most modern terminals support this protocol, but some require configuration.
4
4
 
5
- ## Capability Overrides
5
+ Pi uses extended-key protocols so terminals can distinguish combinations such as `Shift+Enter` and `Alt+Enter` from plain `Enter`. Terminal proxies, multiplexers, and built-in IDE terminals can change or discard that information.
6
6
 
7
- Pi auto-detects OSC 8 hyperlinks, inline image protocols, and truecolor. If detection fails behind a terminal proxy or multiplexer, use these advanced overrides:
7
+ ## Troubleshooting
8
8
 
9
- | Capability | Environment variable | JSON setting |
10
- |------------|----------------------|--------------|
11
- | OSC 8 hyperlinks | `PI_HYPERLINKS=1\|0\|auto` | `terminal.hyperlinks: true\|false\|"auto"` |
12
- | Inline images | `PI_IMAGE_PROTOCOL=kitty\|iterm2\|none\|auto` | `terminal.images: "kitty"\|"iterm2"\|false\|"auto"` |
13
- | Truecolor | `PI_TRUE_COLOR=1\|0\|auto` | `terminal.trueColor: true\|false\|"auto"` |
9
+ | Symptom | Start here |
10
+ |---|---|
11
+ | `Shift+Enter` submits instead of inserting a line | Your terminal's section below; for tmux, see [Run Pi in tmux](tmux.md) |
12
+ | `Alt+Enter` does not queue a follow-up | [WezTerm](#wezterm), [Alacritty](#alacritty), or [Windows Terminal](#windows-terminal) |
13
+ | Fullscreen scrolling is unusually slow | [iTerm2](#iterm2) |
14
+ | Links work but show no hover preview | [Ghostty](#ghostty) |
15
+ | Inline images or colors are not detected | [Override detected capabilities](#override-detected-capabilities) |
16
+ | An IME candidate window appears in the wrong place | [WezTerm](#wezterm) or [IntelliJ IDEA](#intellij-idea-integrated-terminal) |
17
+ | Modified keys fail only inside tmux | [Run Pi in tmux](tmux.md) |
14
18
 
15
- Settings take precedence over environment variables; unset or `auto` preserves detection. Only force capabilities supported by the complete terminal path, since unsupported escape sequences can corrupt rendering.
19
+ Use `/hotkeys` to inspect Pi's active shortcuts. See [Keybindings](keybindings.md) to change them.
16
20
 
17
21
  ## Kitty
18
22
 
19
- Works out of the box.
23
+ Kitty supports the required keyboard protocol without additional configuration.
20
24
 
21
25
  ## iTerm2
22
26
 
23
- ### Regular TUI mode
27
+ Regular terminal mode works without additional configuration.
24
28
 
25
- Works out of the box.
26
-
27
- ### Fullscreen TUI mode
29
+ ### Fix slow fullscreen scrolling
28
30
 
29
- Pi owns the viewport, so iTerm2 sends mouse-wheel reports instead of scrolling its native scrollback. With iTerm2's default fast-trackpad behavior, those reports can lose most of an accelerated wheel delta, making fullscreen scrolling much slower than regular scrolling.
31
+ In fullscreen mode, Pi owns the viewport, so iTerm2 sends mouse-wheel reports instead of scrolling native terminal history. Fast trackpad gestures can then move only about one line at a time.
30
32
 
31
- If fast mouse-wheel gestures move only about one line at a time in fullscreen mode:
33
+ To change this behavior:
32
34
 
33
- 1. Open **iTerm2 → Settings → Advanced**.
34
- 2. Search for **Trackpad scrolls fast?** and set it to **No**.
35
+ 1. Open **iTerm2 > Settings > Advanced**.
36
+ 2. Search for **Trackpad scrolls fast?**.
37
+ 3. Set it to **No**.
35
38
 
36
- This is an iTerm2-wide workaround and may also change native trackpad scrolling. The underlying behavior is tracked in [iTerm2 issue 9619](https://gitlab.com/gnachman/iterm2/-/work_items/9619).
39
+ This is an iTerm2-wide setting and can also change native trackpad scrolling. The underlying behavior is tracked in [iTerm2 issue 9619](https://gitlab.com/gnachman/iterm2/-/work_items/9619).
37
40
 
38
41
  ## Apple Terminal
39
42
 
@@ -43,21 +46,23 @@ This fallback only works when Apex Code runs on the same Mac as Terminal.app. It
43
46
 
44
47
  ## Ghostty
45
48
 
46
- Add to your Ghostty config (`~/Library/Application Support/com.mitchellh.ghostty/config` on macOS, `~/.config/ghostty/config` on Linux):
49
+ Add this mapping to Ghostty's configuration if `Alt+Backspace` does not work:
47
50
 
48
- ```
51
+ ```text
49
52
  keybind = alt+backspace=text:\x1b\x7f
50
53
  ```
51
54
 
52
- Older Claude Code versions may have added this Ghostty mapping:
55
+ The configuration file is `~/Library/Application Support/com.mitchellh.ghostty/config` on macOS and `~/.config/ghostty/config` on Linux.
53
56
 
54
- ```
57
+ Older Claude Code configurations may contain:
58
+
59
+ ```text
55
60
  keybind = shift+enter=text:\n
56
61
  ```
57
62
 
58
63
  That mapping sends a raw linefeed byte. Inside Apex Code, that is indistinguishable from `Ctrl+J`, so tmux and Apex Code no longer see a real `shift+enter` key event.
59
64
 
60
- If Claude Code 2.x or newer is the only reason you added that mapping, you can remove it, unless you want to use Claude Code in tmux, where it still requires that Ghostty mapping.
65
+ ### Open links in fullscreen mode
61
66
 
62
67
  Apex Code binds `Ctrl+J` as a default newline alias, so `Shift+Enter` keeps working in tmux via that remap without extra apex-code configuration.
63
68
 
@@ -67,7 +72,7 @@ In fullscreen mode, links remain clickable, but Ghostty does not show its hover
67
72
 
68
73
  ## WezTerm
69
74
 
70
- WezTerm usually works out of the box for `Shift+Enter` via xterm modifyOtherKeys. To use the Kitty keyboard protocol explicitly, create `~/.wezterm.lua`:
75
+ WezTerm normally reports `Shift+Enter` through xterm extended keys. To enable the Kitty keyboard protocol explicitly, create `~/.wezterm.lua`:
71
76
 
72
77
  ```lua
73
78
  local wezterm = require 'wezterm'
@@ -91,7 +96,7 @@ config.keys = {
91
96
  return config
92
97
  ```
93
98
 
94
- If you already have a `config.keys` table, add the entry to it.
99
+ ### Position an IME candidate window in WSL
95
100
 
96
101
  On WSL, WezTerm may require a visible hardware cursor for IME candidate window positioning. If CJK IME candidates do not follow the text cursor, set `APEX_CODE_HARDWARE_CURSOR=1` before running Apex Code or set `showHardwareCursor` to `true` in settings. The temporary `PI_HARDWARE_CURSOR` alias also works.
97
102
 
@@ -106,27 +111,41 @@ mods = "Alt"
106
111
  chars = "\u001b[13;3u"
107
112
  ```
108
113
 
109
- Restart Alacritty after changing the config.
114
+ Restart Alacritty after changing the file.
115
+
116
+ ## VS Code integrated terminal
110
117
 
111
- ## VS Code (Integrated Terminal)
118
+ VS Code 1.109.5 and newer enable the Kitty keyboard protocol in the integrated terminal by default.
112
119
 
113
- VS Code 1.109.5 and newer enable Kitty keyboard protocol in the integrated terminal by default, so `Shift+Enter` should work out of the box.
120
+ For an older version, add a `Shift+Enter` terminal binding to `keybindings.json`:
121
+
122
+ ```json
123
+ {
124
+ "key": "shift+enter",
125
+ "command": "workbench.action.terminal.sendSequence",
126
+ "args": { "text": "\u001b[13;2u" },
127
+ "when": "terminalFocus"
128
+ }
129
+ ```
114
130
 
115
- VS Code versions older than 1.109.5 need an explicit terminal keybinding for `Shift+Enter`.
131
+ The user `keybindings.json` file is normally located at:
116
132
 
117
- `keybindings.json` locations:
118
133
  - macOS: `~/Library/Application Support/Code/User/keybindings.json`
119
134
  - Linux: `~/.config/Code/User/keybindings.json`
120
135
  - Windows: `%APPDATA%\\Code\\User\\keybindings.json`
121
136
 
122
- Add to `keybindings.json`:
137
+ ## Zed integrated terminal
138
+
139
+ Add these bindings to Zed's `keymap.json`:
123
140
 
124
141
  ```json
125
142
  {
126
- "key": "shift+enter",
127
- "command": "workbench.action.terminal.sendSequence",
128
- "args": { "text": "\u001b[13;2u" },
129
- "when": "terminalFocus"
143
+ "context": "Terminal",
144
+ "bindings": {
145
+ "shift-enter": ["terminal::SendText", "\u001b[13;2u"],
146
+ "ctrl--": ["terminal::SendText", "\u001b[45;5u"],
147
+ "ctrl-alt-]": ["terminal::SendText", "\u001b[93;7u"]
148
+ }
130
149
  }
131
150
  ```
132
151
 
@@ -140,16 +159,12 @@ Apex Code uses Windows-style keybindings when running natively on Windows or in
140
159
  - `Ctrl+Z` undoes editing on native Windows; WSL uses `Alt+Z` so `Ctrl+Z` can suspend Apex Code.
141
160
  - `Ctrl+Q` queues a follow-up message and `Alt+Q` restores queued messages.
142
161
 
143
- Add to `settings.json` (Ctrl+Shift+, or Settings → Open JSON file) to forward `Shift+Enter` for inserting a new line:
162
+ Open Windows Terminal's `settings.json` with `Ctrl+Shift+,` or **Settings > Open JSON file**. Add this object to its `actions` array:
144
163
 
145
164
  ```json
146
165
  {
147
- "actions": [
148
- {
149
- "command": { "action": "sendInput", "input": "\u001b[13;2u" },
150
- "keys": "shift+enter"
151
- }
152
- ]
166
+ "command": { "action": "sendInput", "input": "\u001b[13;2u" },
167
+ "keys": "shift+enter"
153
168
  }
154
169
  ```
155
170
 
@@ -157,23 +172,39 @@ Add to `settings.json` (Ctrl+Shift+, or Settings → Open JSON file) to forward
157
172
  - Windows Terminal binds `Alt+Enter` to fullscreen by default. That prevents Apex Code from receiving `Alt+Enter` for follow-up queueing.
158
173
  - Remapping `Alt+Enter` to `sendInput` forwards the real key chord to Apex Code instead, or configure Windows Terminal to send the key and bind `app.message.followUp` to `alt+enter` in Apex Code to use it instead of the `Ctrl+Q` default.
159
174
 
160
- If you already have an `actions` array, add the object to it. Fully close and reopen Windows Terminal after changing its settings.
175
+ ### Use Alt+Enter for follow-ups
161
176
 
162
- ## xfce4-terminal, terminator
177
+ Windows Terminal binds `Alt+Enter` to fullscreen by default. Pi therefore uses `Ctrl+Q` for follow-ups on Windows and WSL.
163
178
 
164
- These terminals have limited escape sequence support. Modified Enter keys like `Ctrl+Enter` and `Shift+Enter` cannot be distinguished from plain `Enter`, preventing custom keybindings such as `submit: ["ctrl+enter"]` from working.
179
+ To use `Alt+Enter` instead, configure Windows Terminal to forward the key and bind `app.message.followUp` to `alt+enter` in Pi's `keybindings.json`. See [Keybindings](keybindings.md#assign-keybindings).
165
180
 
166
- For the best experience, use a terminal that supports the Kitty keyboard protocol:
167
- - [Kitty](https://sw.kovidgoyal.net/kitty/)
168
- - [Ghostty](https://ghostty.org/)
169
- - [WezTerm](https://wezfurlong.org/wezterm/)
170
- - [iTerm2](https://iterm2.com/)
171
- - [Alacritty](https://github.com/alacritty/alacritty) (requires compilation with Kitty protocol support)
181
+ ## xfce4-terminal and Terminator
172
182
 
173
- ## IntelliJ IDEA (Integrated Terminal)
183
+ These terminals cannot reliably distinguish modified Enter keys from plain `Enter`. Custom bindings such as `Ctrl+Enter` or `Shift+Enter` therefore may not work.
174
184
 
175
- The built-in terminal has limited escape sequence support. Shift+Enter cannot be distinguished from Enter in IntelliJ's terminal.
185
+ Use a terminal with modern extended-key support when you need those shortcuts, such as Kitty, Ghostty, WezTerm, iTerm2, Windows Terminal, or a compatible Alacritty build.
176
186
 
177
187
  If you want the hardware cursor visible, set `APEX_CODE_HARDWARE_CURSOR=1` before running Apex Code (disabled by default for compatibility; the temporary `PI_HARDWARE_CURSOR` alias also works).
178
188
 
179
- Consider using a dedicated terminal emulator for the best experience.
189
+ IntelliJ IDEA's built-in terminal cannot reliably distinguish `Shift+Enter` from plain `Enter`. Use `Ctrl+J` for a newline or run Pi in a terminal with modern extended-key support.
190
+
191
+ If an IME candidate window does not follow the text cursor, show the hardware cursor:
192
+
193
+ ```bash
194
+ export PI_HARDWARE_CURSOR=1
195
+ pi
196
+ ```
197
+
198
+ ## Override detected capabilities
199
+
200
+ Pi automatically detects OSC 8 hyperlinks, inline image protocols, and truecolor support. A terminal proxy or multiplexer can make that detection inaccurate.
201
+
202
+ | Capability | Environment variable | Setting |
203
+ |---|---|---|
204
+ | Hyperlinks | `PI_HYPERLINKS=1\|0\|auto` | `terminal.hyperlinks: true\|false\|"auto"` |
205
+ | Inline images | `PI_IMAGE_PROTOCOL=kitty\|iterm2\|none\|auto` | `terminal.images: "kitty"\|"iterm2"\|false\|"auto"` |
206
+ | Truecolor | `PI_TRUE_COLOR=1\|0\|auto` | `terminal.trueColor: true\|false\|"auto"` |
207
+
208
+ Settings take precedence over environment variables. An unset value or `auto` preserves automatic detection.
209
+
210
+ Only force a capability supported by the complete terminal path. Unsupported escape sequences can corrupt rendering. See [Environment Variables](environment-variables.md#pi-process-configuration) and [Settings](settings.md) for the canonical value definitions.
package/docs/termux.md CHANGED
@@ -1,20 +1,16 @@
1
- # Termux (Android) Setup
1
+ # Run Pi on Android with Termux
2
2
 
3
3
  Apex Code runs on Android via [Termux](https://termux.dev/), a terminal emulator and Linux environment for Android.
4
4
 
5
- ## Prerequisites
5
+ ## Before you begin
6
6
 
7
- 1. Install [Termux](https://github.com/termux/termux-app#installation) from GitHub or F-Droid (not Google Play, that version is deprecated)
8
- 2. Install [Termux:API](https://github.com/termux/termux-api#installation) from GitHub or F-Droid for clipboard and other device integrations
7
+ Install Termux from [GitHub or F-Droid](https://github.com/termux/termux-app#installation). Do not use the deprecated Google Play build.
9
8
 
10
- ## Installation
9
+ [Termux:API](https://github.com/termux/termux-api#installation) is optional. Install it only when you want Pi to copy or paste Android clipboard text, or when shell commands need Android device APIs.
11
10
 
12
- ```bash
13
- # Update packages
14
- pkg update && pkg upgrade
11
+ ## Install Pi
15
12
 
16
- # Install dependencies
17
- pkg install nodejs termux-api git
13
+ 1. Update Termux packages:
18
14
 
19
15
  # Install Apex Code
20
16
  npm install -g --ignore-scripts apex-code
@@ -26,102 +22,96 @@ mkdir -p ~/.apex-code/agent
26
22
  apex-code
27
23
  ```
28
24
 
29
- ## Clipboard Support
25
+ 3. Install Pi:
30
26
 
31
- Clipboard operations use `termux-clipboard-set` and `termux-clipboard-get` when running in Termux. The Termux:API app must be installed for these to work.
27
+ ```bash
28
+ npm install -g --ignore-scripts @earendil-works/pi-coding-agent
29
+ ```
32
30
 
33
- Image clipboard is not supported on Termux (the `ctrl+v` image paste feature will not work).
31
+ 4. Verify the installation:
34
32
 
35
- ## Example AGENTS.md for Termux
33
+ ```bash
34
+ apex-code --version
35
+ ```
36
36
 
37
37
  Create `~/.apex-code/agent/AGENTS.md` to help the agent understand the Termux environment:
38
38
 
39
- ````markdown
40
- # Agent Environment: Termux on Android
39
+ ```bash
40
+ cd /path/to/working-folder
41
+ pi
42
+ ```
41
43
 
42
- ## Location
43
- - **OS**: Android (Termux terminal emulator)
44
- - **Home**: `/data/data/com.termux/files/home`
45
- - **Prefix**: `/data/data/com.termux/files/usr`
46
- - **Shared storage**: `/storage/emulated/0` (Downloads, Documents, etc.)
44
+ Continue with the main [Quickstart](quickstart.md#3-choose-a-model) to connect a model and run your first task.
47
45
 
48
- ## Opening URLs
49
- ```bash
50
- termux-open-url "https://example.com"
51
- ```
46
+ ## Access Android shared storage
52
47
 
53
- ## Opening Files
54
- ```bash
55
- termux-open file.pdf # Opens with default app
56
- termux-open --chooser image.jpg # Choose app
57
- ```
48
+ Termux cannot access shared Android storage until you grant permission. Run this once:
58
49
 
59
- ## Clipboard
60
50
  ```bash
61
- termux-clipboard-set "text" # Copy
62
- termux-clipboard-get # Paste
51
+ termux-setup-storage
63
52
  ```
64
53
 
65
- ## Notifications
66
- ```bash
67
- termux-notification -t "Title" -c "Content"
68
- ```
54
+ After approval, Android shared storage is available under `/storage/emulated/0` and through the links Termux creates under `~/storage/`.
69
55
 
70
- ## Device Info
71
- ```bash
72
- termux-battery-status # Battery info
73
- termux-wifi-connectioninfo # WiFi info
74
- termux-telephony-deviceinfo # Device info
75
- ```
56
+ Only grant this permission when Pi should be able to access those files. Commands and tools running in Termux use the same storage permissions as the Termux process.
57
+
58
+ ## Use clipboard commands
59
+
60
+ Pi uses `termux-clipboard-set` to copy text and `termux-clipboard-get` for its clipboard-paste shortcut. Shell commands can use both commands directly. Install the Termux:API app and its command-line package:
76
61
 
77
- ## Sharing
78
62
  ```bash
79
- termux-share -a send file.txt # Share file
63
+ pkg install termux-api
80
64
  ```
81
65
 
82
- ## Other Useful Commands
66
+ Verify the integration:
67
+
83
68
  ```bash
84
- termux-toast "message" # Quick toast popup
85
- termux-vibrate # Vibrate device
86
- termux-tts-speak "hello" # Text to speech
87
- termux-camera-photo out.jpg # Take photo
69
+ printf 'Pi clipboard test' | termux-clipboard-set
70
+ termux-clipboard-get
88
71
  ```
89
72
 
90
- ## Notes
91
- - Termux:API app must be installed for `termux-*` commands
92
- - Use `pkg install termux-api` for the command-line tools
93
- - Storage permission needed for `/storage/emulated/0` access
94
- ````
73
+ The second command should print `Pi clipboard test`.
95
74
 
96
- ## Limitations
75
+ The Termux clipboard API supports text only. Pi's clipboard-paste shortcut inserts that text into the editor but cannot attach clipboard images.
97
76
 
98
- - **No image clipboard**: Termux clipboard API only supports text
99
- - **No native binaries**: Some optional native dependencies (like the clipboard module) are unavailable on Android ARM64 and are skipped during installation
100
- - **Storage access**: To access files in `/storage/emulated/0` (Downloads, etc.), run `termux-setup-storage` once to grant permissions
77
+ ## Add Termux-specific instructions
78
+
79
+ Apex Code detects that it is running in Termux, but it cannot infer how you want it to interact with Android. Add only the environment details relevant to your work to `~/.apex-code/agent/AGENTS.md`:
80
+
81
+ ````markdown
82
+ # Termux environment
83
+
84
+ - Pi runs in Termux on Android.
85
+ - Shared Android storage is under `/storage/emulated/0`.
86
+ - Open URLs with `termux-open-url "https://example.com"`.
87
+ - Open files with `termux-open <path>`.
88
+ - Do not access shared storage unless the task requires it.
89
+ ````
90
+
91
+ Run `/reload` after changing the file during an active session.
101
92
 
102
93
  ## Troubleshooting
103
94
 
104
- ### Clipboard not working
95
+ ### Clipboard integration fails
105
96
 
106
- Ensure both apps are installed:
107
- 1. Termux (from GitHub or F-Droid)
108
- 2. Termux:API (from GitHub or F-Droid)
97
+ Confirm that you installed both components:
109
98
 
110
- Then install the CLI tools:
111
- ```bash
112
- pkg install termux-api
113
- ```
99
+ 1. The Termux:API Android app from the same source as Termux
100
+ 2. The `termux-api` command-line package
114
101
 
115
- ### Permission denied for shared storage
102
+ Then run the clipboard verification commands above outside Pi. If they fail there, fix the Termux:API installation before retrying Pi's copy command.
116
103
 
117
- Run once to grant storage permissions:
118
- ```bash
119
- termux-setup-storage
120
- ```
104
+ ### Shared storage reports permission denied
121
105
 
122
- ### Node.js installation issues
106
+ Run `termux-setup-storage`, approve the Android permission request, and retry the path under `~/storage/` or `/storage/emulated/0`.
107
+
108
+ ### Pi is not found after installation
109
+
110
+ Open a new Termux shell and run:
123
111
 
124
- If npm fails, try clearing the cache:
125
112
  ```bash
126
- npm cache clean --force
113
+ npm prefix -g
114
+ command -v pi
127
115
  ```
116
+
117
+ Confirm that the global npm binary directory is on `PATH`, then reinstall Pi if the package is missing.
package/docs/themes.md CHANGED
@@ -1,18 +1,12 @@
1
1
  > Apex Code can create themes. Ask it to build one for your setup.
2
2
 
3
- # Themes
3
+ Themes control the colors Pi uses in interactive mode and HTML exports. Pi includes `dark` and `light` themes. You can select one theme, follow your terminal's light or dark appearance, or create your own palette.
4
4
 
5
- Themes are JSON files that define colors for the TUI.
5
+ <a id="selecting-a-theme"></a>
6
6
 
7
- ## Table of Contents
7
+ ## Choose a theme
8
8
 
9
- - [Locations](#locations)
10
- - [Selecting a Theme](#selecting-a-theme)
11
- - [Creating a Custom Theme](#creating-a-custom-theme)
12
- - [Theme Format](#theme-format)
13
- - [Color Tokens](#color-tokens)
14
- - [Color Values](#color-values)
15
- - [Tips](#tips)
9
+ Open `/settings` and select **Theme**. You can use one theme for every terminal appearance or choose separate themes for light and dark terminals.
16
10
 
17
11
  ## Locations
18
12
 
@@ -33,39 +27,39 @@ Select a theme via `/settings` or in `settings.json`:
33
27
 
34
28
  ```json
35
29
  {
36
- "theme": "my-theme"
30
+ "theme": "dark"
37
31
  }
38
32
  ```
39
33
 
40
34
  On first run, Apex Code detects your terminal background and defaults to `dark` or `light`.
41
35
 
42
- ### Initial Theme
43
-
44
- Start an interactive run with a theme without changing the saved setting:
45
-
46
- ```bash
47
- pi --use-theme light
36
+ ```json
37
+ {
38
+ "theme": "light/dark"
39
+ }
48
40
  ```
49
41
 
50
- To follow terminal appearance, use `lightTheme/darkTheme` syntax:
42
+ When automatic mode is active, Pi changes themes when the terminal reports an appearance change. Theme names cannot contain `/` because Pi reserves it for this setting format.
43
+
44
+ Use `--use-theme` to choose the initial theme for one invocation without changing the saved setting:
51
45
 
52
46
  ```bash
53
- pi --use-theme light/dark
47
+ apex-code --use-theme light
48
+ apex-code --use-theme light/dark
54
49
  ```
55
50
 
56
- The CLI value is the initial theme for that run. Choosing another theme later in `/settings` applies it immediately
57
- and saves it normally.
51
+ See [CLI resources](cli.md#resources) for the command-line option.
58
52
 
59
- ## Creating a Custom Theme
53
+ ## Create a custom theme
60
54
 
61
- 1. Create a theme file:
55
+ Copy one of the [built-in themes](https://github.com/earendil-works/pi/tree/main/packages/coding-agent/src/modes/interactive/theme) or create a new JSON file conforming to the [schema](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json).
62
56
 
63
57
  ```bash
64
58
  mkdir -p ~/.apex-code/agent/themes
65
59
  vim ~/.apex-code/agent/themes/my-theme.json
66
60
  ```
67
61
 
68
- 2. Define the theme with all required colors (see [Color Tokens](#color-tokens)):
62
+ Use the theme name as the filename. Pi hot-reloads the active user theme only from `<agent-dir>/themes/<name>.json`. Run `/reload` after adding or changing a theme from any other source.
69
63
 
70
64
  ```json
71
65
  {
@@ -88,7 +82,8 @@ vim ~/.apex-code/agent/themes/my-theme.json
88
82
  "text": "",
89
83
  "thinkingText": "secondary",
90
84
  "selectedBg": "#2d2d30",
91
- "scrollbarThumb": "#555566",
85
+ "scrollbarTrack": "secondary",
86
+ "scrollbarThumb": "",
92
87
  "searchMatchBg": "#2d2d30",
93
88
  "searchMatchText": "",
94
89
  "userMessageBg": "#2d2d30",
@@ -135,11 +130,22 @@ vim ~/.apex-code/agent/themes/my-theme.json
135
130
  }
136
131
  ```
137
132
 
138
- 3. Select the theme via `/settings`.
133
+ | Property | Required | Responsibility |
134
+ |---|---|---|
135
+ | `$schema` | No | Enables editor validation and completion against Pi's published schema. |
136
+ | `name` | Yes | Identifies the theme in selectors and settings. It must be unique and cannot contain `/`. |
137
+ | `vars` | No | Defines reusable color values. Variables can reference other variables. |
138
+ | `colors` | Yes | Assigns colors to terminal UI roles. The schema identifies required and optional roles. |
139
+ | `export` | No | Overrides page and panel backgrounds in HTML exports. |
139
140
 
140
141
  **Hot reload:** When you edit the currently active custom theme file, Apex Code reloads it automatically for immediate visual feedback.
141
142
 
142
- ## Theme Format
143
+ | Form | Example | Meaning |
144
+ |---|---|---|
145
+ | RGB hexadecimal | `"#00aaff"` | A six-digit RGB color. |
146
+ | 256-color index | `39` | An ANSI palette index from `0` through `255`. |
147
+ | Variable reference | `"primary"` | The value of an entry in `vars`. |
148
+ | Terminal default | `""` | The terminal's default foreground or background color. |
143
149
 
144
150
  ```json
145
151
  {
@@ -158,73 +164,45 @@ vim ~/.apex-code/agent/themes/my-theme.json
158
164
  }
159
165
  ```
160
166
 
161
- - `name` is required, must be unique, and must not contain `/`.
162
- - `vars` is optional. Define reusable colors here, then reference them in `colors`.
163
- - `colors` must define all 51 required tokens. `thinkingMax`, `scrollbarThumb`, and the two search highlight tokens are optional and use the fallbacks listed below.
167
+ Use the [theme JSON schema](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json) for the exact properties, required colors, and accepted value types.
164
168
 
165
- The `$schema` field enables editor auto-completion and validation.
169
+ Pi reports invalid theme files during startup and `/reload`.
166
170
 
167
- ## Color Tokens
171
+ ## Find the color to change
168
172
 
169
- Every theme must define all 51 required color tokens. The optional tokens preserve compatibility with existing themes: `thinkingMax` falls back to `thinkingXhigh`, `scrollbarThumb` and `searchMatchBg` fall back to `selectedBg`, and `searchMatchText` falls back to `text`. Other search matches use `searchMatchText` on `searchMatchBg` with an underline; the current match reverses that foreground/background pair and uses bold text.
173
+ Theme colors describe interface roles rather than individual components. Use these groups to find the relevant part of the schema:
170
174
 
171
- ### Core UI (11 colors)
175
+ | Area | Color names |
176
+ |---|---|
177
+ | General interface | `accent`, `border*`, `text`, `muted`, `dim`, `success`, `error`, `warning` |
178
+ | Selection and fullscreen | `selectedBg`, `searchMatch*`, `scrollbar*` |
179
+ | Messages | `userMessage*`, `customMessage*`, `thinkingText` |
180
+ | Tool execution | `toolPendingBg`, `toolSuccessBg`, `toolErrorBg`, `toolTitle`, `toolOutput` |
181
+ | Markdown | `md*` |
182
+ | Tool diffs | `toolDiff*` |
183
+ | Syntax highlighting | `syntax*` |
184
+ | Editor modes | `thinking*`, `bashMode` |
185
+ | HTML export | `export.pageBg`, `export.cardBg`, `export.infoBg` |
172
186
 
173
- | Token | Purpose |
174
- |-------|---------|
175
- | `accent` | Primary accent (logo, selected items, cursor) |
176
- | `border` | Normal borders |
177
- | `borderAccent` | Highlighted borders |
178
- | `borderMuted` | Subtle borders (editor) |
179
- | `success` | Success states |
180
- | `error` | Error states |
181
- | `warning` | Warning states |
182
- | `muted` | Secondary text |
183
- | `dim` | Tertiary text |
184
- | `text` | Default text (usually `""`) |
185
- | `thinkingText` | Thinking block text |
186
-
187
- ### Backgrounds & Content (11 required, 3 optional)
187
+ The schema is the format reference. The built-in themes provide complete values that you can copy and adjust.
188
188
 
189
- | Token | Purpose |
190
- |-------|---------|
191
- | `selectedBg` | Selected line background |
192
- | `scrollbarThumb` | Fullscreen scrollbar thumb background; optional, falls back to `selectedBg` |
193
- | `searchMatchBg` | Transcript search match background and current-match text; optional, falls back to `selectedBg` |
194
- | `searchMatchText` | Transcript search match text and current-match background; optional, falls back to `text` |
195
- | `userMessageBg` | User message background |
196
- | `userMessageText` | User message text |
197
- | `customMessageBg` | Extension message background |
198
- | `customMessageText` | Extension message text |
199
- | `customMessageLabel` | Extension message label |
200
- | `toolPendingBg` | Tool box (pending) |
201
- | `toolSuccessBg` | Tool box (success) |
202
- | `toolErrorBg` | Tool box (error) |
203
- | `toolTitle` | Tool title |
204
- | `toolOutput` | Tool output text |
205
-
206
- ### Markdown (10 colors)
189
+ Five colors are optional and inherit another color when omitted:
207
190
 
208
- | Token | Purpose |
209
- |-------|---------|
210
- | `mdHeading` | Headings |
211
- | `mdLink` | Link text |
212
- | `mdLinkUrl` | Link URL |
213
- | `mdCode` | Inline code |
214
- | `mdCodeBlock` | Code block content |
215
- | `mdCodeBlockBorder` | Code block fences |
216
- | `mdQuote` | Blockquote text |
217
- | `mdQuoteBorder` | Blockquote border |
218
- | `mdHr` | Horizontal rule |
219
- | `mdListBullet` | List bullets |
220
-
221
- ### Tool Diffs (3 colors)
191
+ | Optional color | Fallback |
192
+ |---|---|
193
+ | `scrollbarTrack` | `muted` |
194
+ | `scrollbarThumb` | `text` |
195
+ | `searchMatchBg` | `selectedBg` |
196
+ | `searchMatchText` | `text` |
197
+ | `thinkingMax` | `thinkingXhigh` |
222
198
 
223
- | Token | Purpose |
224
- |-------|---------|
225
- | `toolDiffAdded` | Added lines |
226
- | `toolDiffRemoved` | Removed lines |
227
- | `toolDiffContext` | Context lines |
199
+ If `export` colors are omitted, Pi derives HTML page and panel backgrounds from `userMessageBg`.
200
+
201
+ ## Load a theme from a project or package
202
+
203
+ Place a project theme in `.apex-code/themes/`. Project themes load only after [project trust](security.md#understand-project-trust) is granted.
204
+
205
+ You can also load theme files and directories through the `themes` setting or distribute them in a Pi package. See [Configuration](configuration.md), [Settings](settings.md#resources), and [Pi Packages](packages.md).
228
206
 
229
207
  ### Syntax Highlighting (9 colors)
230
208