mu-agent 0.1.0

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 (280) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +62 -0
  4. package/dist/bundle/chunks/anthropic-messages-MYU5ZMRF.js +6 -0
  5. package/dist/bundle/chunks/anthropic.js +75 -0
  6. package/dist/bundle/chunks/azure-openai-responses-HUSQ3GP2.js +2 -0
  7. package/dist/bundle/chunks/bedrock-converse-stream.js +83 -0
  8. package/dist/bundle/chunks/chunk-4L3WN2XY.js +2 -0
  9. package/dist/bundle/chunks/chunk-6CYCI3EJ.js +12 -0
  10. package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
  11. package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  12. package/dist/bundle/chunks/chunk-A3JYRWB6.js +2 -0
  13. package/dist/bundle/chunks/chunk-DRQDKNXA.js +2 -0
  14. package/dist/bundle/chunks/chunk-DTD7JQ7Y.js +42 -0
  15. package/dist/bundle/chunks/chunk-FUXEF6JQ.js +44 -0
  16. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  17. package/dist/bundle/chunks/chunk-NUHFSC37.js +25 -0
  18. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  19. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  20. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  21. package/dist/bundle/chunks/chunk-QB4HYZZE.js +1561 -0
  22. package/dist/bundle/chunks/chunk-RCZIEVGO.js +11 -0
  23. package/dist/bundle/chunks/chunk-S7SZN6Z3.js +2 -0
  24. package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
  25. package/dist/bundle/chunks/chunk-TRDNDS6A.js +4 -0
  26. package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
  27. package/dist/bundle/chunks/chunk-WIUZI2CJ.js +11 -0
  28. package/dist/bundle/chunks/chunk-XDUWOHPL.js +6 -0
  29. package/dist/bundle/chunks/chunk-XNGRGP62.js +2 -0
  30. package/dist/bundle/chunks/chunk-Z2DUOAN4.js +2 -0
  31. package/dist/bundle/chunks/github-copilot.js +2 -0
  32. package/dist/bundle/chunks/google-generative-ai-IMS5EK2Y.js +2 -0
  33. package/dist/bundle/chunks/google-vertex-O4YJEQUW.js +2 -0
  34. package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +13 -0
  35. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  36. package/dist/bundle/chunks/jiti-loader-C3NU2SDH.js +21 -0
  37. package/dist/bundle/chunks/jiti-static-loader-E6ANQD5T.js +2 -0
  38. package/dist/bundle/chunks/kimi-coding.js +2 -0
  39. package/dist/bundle/chunks/lib-HGQMNYVT.js +9 -0
  40. package/dist/bundle/chunks/mistral-conversations-NOSQHBEY.js +5 -0
  41. package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +3 -0
  42. package/dist/bundle/chunks/node-O3RIBJRH.js +16 -0
  43. package/dist/bundle/chunks/node-TWVVAGPO.js +2 -0
  44. package/dist/bundle/chunks/openai-codex-responses-QDSOTBBO.js +10 -0
  45. package/dist/bundle/chunks/openai-codex.js +75 -0
  46. package/dist/bundle/chunks/openai-completions-KQPOPEVM.js +7 -0
  47. package/dist/bundle/chunks/openai-responses-HWEUZ6WZ.js +2 -0
  48. package/dist/bundle/chunks/openrouter-images-N4XVVFSD.js +2 -0
  49. package/dist/bundle/chunks/openrouter.js +75 -0
  50. package/dist/bundle/chunks/pi-messages-GFKBWJHZ.js +8 -0
  51. package/dist/bundle/chunks/radius.js +75 -0
  52. package/dist/bundle/chunks/src-UK77SYZE.js +4 -0
  53. package/dist/bundle/chunks/virtual-modules-ROULVYS3.js +2 -0
  54. package/dist/bundle/chunks/xai.js +2 -0
  55. package/dist/bundle/cli.js +3 -0
  56. package/dist/bundle/index.js +2 -0
  57. package/dist/bundle/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  58. package/dist/bundle/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  59. package/dist/bundle/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  60. package/dist/bundle/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  61. package/dist/bundle/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  62. package/dist/bundle/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  63. package/dist/bundle/rpc-entry.js +3 -0
  64. package/dist/core/export-html/template.css +1066 -0
  65. package/dist/core/export-html/template.html +55 -0
  66. package/dist/core/export-html/template.js +1864 -0
  67. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  68. package/dist/core/export-html/vendor/marked.min.js +78 -0
  69. package/dist/modes/interactive/assets/clankolas.png +0 -0
  70. package/dist/modes/interactive/theme/dark.json +91 -0
  71. package/dist/modes/interactive/theme/light.json +90 -0
  72. package/dist/modes/interactive/theme/theme-controller.d.ts +41 -0
  73. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  74. package/dist/modes/interactive/theme/theme-controller.js +130 -0
  75. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  76. package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
  77. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  78. package/dist/modes/interactive/theme/theme-json.js +130 -0
  79. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  80. package/dist/modes/interactive/theme/theme-schema.json +356 -0
  81. package/dist/modes/interactive/theme/theme.d.ts +131 -0
  82. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  83. package/dist/modes/interactive/theme/theme.js +991 -0
  84. package/dist/modes/interactive/theme/theme.js.map +1 -0
  85. package/dist/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  86. package/dist/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  87. package/dist/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  88. package/dist/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  89. package/dist/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  90. package/dist/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  91. package/docs/compaction.md +444 -0
  92. package/docs/containerization.md +156 -0
  93. package/docs/custom-provider.md +786 -0
  94. package/docs/development.md +90 -0
  95. package/docs/docs.json +160 -0
  96. package/docs/environment-variables.md +100 -0
  97. package/docs/extensions.md +3037 -0
  98. package/docs/images/doom-extension.png +0 -0
  99. package/docs/images/exy.png +0 -0
  100. package/docs/images/interactive-mode.png +0 -0
  101. package/docs/images/tree-view.png +0 -0
  102. package/docs/index.md +84 -0
  103. package/docs/json.md +98 -0
  104. package/docs/keybindings.md +239 -0
  105. package/docs/llama-cpp.md +101 -0
  106. package/docs/models.md +605 -0
  107. package/docs/packages.md +228 -0
  108. package/docs/prompt-templates.md +96 -0
  109. package/docs/providers.md +317 -0
  110. package/docs/quickstart.md +167 -0
  111. package/docs/rpc.md +1618 -0
  112. package/docs/sdk.md +1226 -0
  113. package/docs/security.md +59 -0
  114. package/docs/session-format.md +480 -0
  115. package/docs/sessions.md +172 -0
  116. package/docs/settings.md +428 -0
  117. package/docs/shell-aliases.md +13 -0
  118. package/docs/skills.md +232 -0
  119. package/docs/terminal-setup.md +192 -0
  120. package/docs/termux.md +126 -0
  121. package/docs/themes.md +322 -0
  122. package/docs/tmux.md +63 -0
  123. package/docs/tui.md +961 -0
  124. package/docs/usage.md +312 -0
  125. package/docs/windows.md +39 -0
  126. package/examples/README.md +28 -0
  127. package/examples/extensions/README.md +212 -0
  128. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  129. package/examples/extensions/bash-spawn-hook.ts +30 -0
  130. package/examples/extensions/bookmark.ts +50 -0
  131. package/examples/extensions/border-status-editor.ts +150 -0
  132. package/examples/extensions/built-in-tool-renderer.ts +249 -0
  133. package/examples/extensions/claude-rules.ts +86 -0
  134. package/examples/extensions/commands.ts +72 -0
  135. package/examples/extensions/confirm-destructive.ts +59 -0
  136. package/examples/extensions/custom-compaction.ts +117 -0
  137. package/examples/extensions/custom-footer.ts +64 -0
  138. package/examples/extensions/custom-header.ts +73 -0
  139. package/examples/extensions/custom-provider-anthropic/index.ts +617 -0
  140. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  141. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  142. package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  143. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  144. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  145. package/examples/extensions/dirty-repo-guard.ts +56 -0
  146. package/examples/extensions/doom-overlay/README.md +46 -0
  147. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  148. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  149. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  150. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  151. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  152. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  153. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  154. package/examples/extensions/doom-overlay/index.ts +74 -0
  155. package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  156. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  157. package/examples/extensions/dynamic-resources/dynamic.json +81 -0
  158. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  159. package/examples/extensions/dynamic-resources/index.ts +15 -0
  160. package/examples/extensions/dynamic-tools.ts +74 -0
  161. package/examples/extensions/entry-renderer.ts +41 -0
  162. package/examples/extensions/event-bus.ts +43 -0
  163. package/examples/extensions/file-trigger.ts +41 -0
  164. package/examples/extensions/git-checkpoint.ts +53 -0
  165. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  166. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  167. package/examples/extensions/gondolin/index.ts +531 -0
  168. package/examples/extensions/gondolin/package-lock.json +185 -0
  169. package/examples/extensions/gondolin/package.json +19 -0
  170. package/examples/extensions/handoff.ts +190 -0
  171. package/examples/extensions/hello.ts +26 -0
  172. package/examples/extensions/hidden-thinking-label.ts +53 -0
  173. package/examples/extensions/inline-bash.ts +94 -0
  174. package/examples/extensions/input-transform-streaming.ts +39 -0
  175. package/examples/extensions/input-transform.ts +43 -0
  176. package/examples/extensions/interactive-shell.ts +196 -0
  177. package/examples/extensions/mac-system-theme.ts +47 -0
  178. package/examples/extensions/message-renderer.ts +59 -0
  179. package/examples/extensions/minimal-mode.ts +426 -0
  180. package/examples/extensions/modal-editor.ts +85 -0
  181. package/examples/extensions/model-status.ts +31 -0
  182. package/examples/extensions/notify.ts +57 -0
  183. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  184. package/examples/extensions/overlay-test.ts +153 -0
  185. package/examples/extensions/permission-gate.ts +34 -0
  186. package/examples/extensions/pirate.ts +47 -0
  187. package/examples/extensions/plan-mode/README.md +66 -0
  188. package/examples/extensions/plan-mode/index.ts +390 -0
  189. package/examples/extensions/plan-mode/utils.ts +168 -0
  190. package/examples/extensions/preset.ts +436 -0
  191. package/examples/extensions/project-trust.ts +64 -0
  192. package/examples/extensions/prompt-customizer.ts +49 -0
  193. package/examples/extensions/protected-paths.ts +30 -0
  194. package/examples/extensions/provider-payload.ts +18 -0
  195. package/examples/extensions/qna.ts +118 -0
  196. package/examples/extensions/question.ts +286 -0
  197. package/examples/extensions/questionnaire.ts +448 -0
  198. package/examples/extensions/rainbow-editor.ts +88 -0
  199. package/examples/extensions/reload-runtime.ts +37 -0
  200. package/examples/extensions/rpc-demo.ts +118 -0
  201. package/examples/extensions/sandbox/index.ts +321 -0
  202. package/examples/extensions/sandbox/package-lock.json +92 -0
  203. package/examples/extensions/sandbox/package.json +19 -0
  204. package/examples/extensions/send-user-message.ts +97 -0
  205. package/examples/extensions/session-name.ts +27 -0
  206. package/examples/extensions/shutdown-command.ts +63 -0
  207. package/examples/extensions/snake.ts +343 -0
  208. package/examples/extensions/space-invaders.ts +560 -0
  209. package/examples/extensions/ssh.ts +220 -0
  210. package/examples/extensions/status-line.ts +32 -0
  211. package/examples/extensions/structured-output.ts +65 -0
  212. package/examples/extensions/subagent/README.md +177 -0
  213. package/examples/extensions/subagent/agents/planner.md +37 -0
  214. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  215. package/examples/extensions/subagent/agents/scout.md +50 -0
  216. package/examples/extensions/subagent/agents/worker.md +24 -0
  217. package/examples/extensions/subagent/agents.ts +157 -0
  218. package/examples/extensions/subagent/index.ts +1038 -0
  219. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  220. package/examples/extensions/subagent/prompts/implement.md +10 -0
  221. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  222. package/examples/extensions/summarize.ts +199 -0
  223. package/examples/extensions/system-prompt-header.ts +17 -0
  224. package/examples/extensions/tic-tac-toe.ts +1008 -0
  225. package/examples/extensions/timed-confirm.ts +70 -0
  226. package/examples/extensions/titlebar-spinner.ts +58 -0
  227. package/examples/extensions/todo.ts +297 -0
  228. package/examples/extensions/tool-override.ts +144 -0
  229. package/examples/extensions/tools.ts +146 -0
  230. package/examples/extensions/trigger-compact.ts +50 -0
  231. package/examples/extensions/truncated-tool.ts +195 -0
  232. package/examples/extensions/widget-placement.ts +9 -0
  233. package/examples/extensions/with-deps/index.ts +32 -0
  234. package/examples/extensions/with-deps/package-lock.json +31 -0
  235. package/examples/extensions/with-deps/package.json +22 -0
  236. package/examples/extensions/working-indicator.ts +123 -0
  237. package/examples/extensions/working-message-test.ts +25 -0
  238. package/examples/plugins/pi-example-plugin/README.md +38 -0
  239. package/examples/plugins/pi-example-plugin/package.json +10 -0
  240. package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  241. package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
  242. package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  243. package/examples/rpc-extension-ui.ts +641 -0
  244. package/examples/sdk/01-minimal.ts +26 -0
  245. package/examples/sdk/02-custom-model.ts +49 -0
  246. package/examples/sdk/03-custom-prompt.ts +75 -0
  247. package/examples/sdk/04-skills.ts +55 -0
  248. package/examples/sdk/05-tools.ts +48 -0
  249. package/examples/sdk/06-extensions.ts +99 -0
  250. package/examples/sdk/07-context-files.ts +47 -0
  251. package/examples/sdk/08-prompt-templates.ts +51 -0
  252. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  253. package/examples/sdk/10-settings.ts +53 -0
  254. package/examples/sdk/11-sessions.ts +52 -0
  255. package/examples/sdk/12-full-control.ts +74 -0
  256. package/examples/sdk/13-session-runtime.ts +67 -0
  257. package/examples/sdk/README.md +140 -0
  258. package/judge/THIRD_PARTY_NOTICES.md +35 -0
  259. package/judge/agents/browser.md +17 -0
  260. package/judge/agents/investigator.md +16 -0
  261. package/judge/agents/planner.md +15 -0
  262. package/judge/agents/reviewer.md +17 -0
  263. package/judge/agents/scout.md +19 -0
  264. package/judge/agents/worker.md +15 -0
  265. package/judge/dist/chrome.js +326 -0
  266. package/judge/dist/kyrn-judge.js +52542 -0
  267. package/judge/package.json +6 -0
  268. package/judge/prompts/implement-and-review.md +14 -0
  269. package/judge/prompts/implement.md +15 -0
  270. package/judge/prompts/init.md +18 -0
  271. package/judge/prompts/scout-and-plan.md +12 -0
  272. package/judge/skills/mu-browser/SKILL.md +30 -0
  273. package/judge/skills/mu-github/SKILL.md +90 -0
  274. package/kyrn/bin/kyrn-doctor +202 -0
  275. package/kyrn/bin/kyrn-judge-local +131 -0
  276. package/kyrn/bin/kyrn-ledger +90 -0
  277. package/kyrn/bin/mu.mjs +1120 -0
  278. package/kyrn/local-judge/requirements.lock.txt +26 -0
  279. package/kyrn/local-judge/server.py +332 -0
  280. package/package.json +45 -0
package/docs/themes.md ADDED
@@ -0,0 +1,322 @@
1
+ > pi can create themes. Ask it to build one for your setup.
2
+
3
+ # Themes
4
+
5
+ Themes are JSON files that define colors for the TUI.
6
+
7
+ ## Table of Contents
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)
16
+
17
+ ## Locations
18
+
19
+ Pi loads themes from:
20
+
21
+ - Built-in: `dark`, `light`
22
+ - Global: `~/.pi/agent/themes/*.json`
23
+ - Project: `.pi/themes/*.json` (only after the project is trusted)
24
+ - Packages: `themes/` directories or `pi.themes` entries in `package.json`
25
+ - Settings: `themes` array with files or directories
26
+ - CLI: `--theme <path>` (repeatable)
27
+
28
+ Disable discovery with `--no-themes`.
29
+
30
+ ## Selecting a Theme
31
+
32
+ Select a theme via `/settings` or in `settings.json`:
33
+
34
+ ```json
35
+ {
36
+ "theme": "my-theme"
37
+ }
38
+ ```
39
+
40
+ On first run, pi detects your terminal background and defaults to `dark` or `light`.
41
+
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
48
+ ```
49
+
50
+ To follow terminal appearance, use `lightTheme/darkTheme` syntax:
51
+
52
+ ```bash
53
+ pi --use-theme light/dark
54
+ ```
55
+
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.
58
+
59
+ ## Creating a Custom Theme
60
+
61
+ 1. Create a theme file:
62
+
63
+ ```bash
64
+ mkdir -p ~/.pi/agent/themes
65
+ vim ~/.pi/agent/themes/my-theme.json
66
+ ```
67
+
68
+ 2. Define the theme with all required colors (see [Color Tokens](#color-tokens)):
69
+
70
+ ```json
71
+ {
72
+ "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
73
+ "name": "my-theme",
74
+ "vars": {
75
+ "primary": "#00aaff",
76
+ "secondary": 242
77
+ },
78
+ "colors": {
79
+ "accent": "primary",
80
+ "border": "primary",
81
+ "borderAccent": "#00ffff",
82
+ "borderMuted": "secondary",
83
+ "success": "#00ff00",
84
+ "error": "#ff0000",
85
+ "warning": "#ffff00",
86
+ "muted": "secondary",
87
+ "dim": 240,
88
+ "text": "",
89
+ "thinkingText": "secondary",
90
+ "selectedBg": "#2d2d30",
91
+ "scrollbarTrack": "secondary",
92
+ "scrollbarThumb": "",
93
+ "searchMatchBg": "#2d2d30",
94
+ "searchMatchText": "",
95
+ "userMessageBg": "#2d2d30",
96
+ "userMessageText": "",
97
+ "customMessageBg": "#2d2d30",
98
+ "customMessageText": "",
99
+ "customMessageLabel": "primary",
100
+ "toolPendingBg": "#1e1e2e",
101
+ "toolSuccessBg": "#1e2e1e",
102
+ "toolErrorBg": "#2e1e1e",
103
+ "toolTitle": "primary",
104
+ "toolOutput": "",
105
+ "mdHeading": "#ffaa00",
106
+ "mdLink": "primary",
107
+ "mdLinkUrl": "secondary",
108
+ "mdCode": "#00ffff",
109
+ "mdCodeBlock": "",
110
+ "mdCodeBlockBorder": "secondary",
111
+ "mdQuote": "secondary",
112
+ "mdQuoteBorder": "secondary",
113
+ "mdHr": "secondary",
114
+ "mdListBullet": "#00ffff",
115
+ "toolDiffAdded": "#00ff00",
116
+ "toolDiffRemoved": "#ff0000",
117
+ "toolDiffContext": "secondary",
118
+ "syntaxComment": "secondary",
119
+ "syntaxKeyword": "primary",
120
+ "syntaxFunction": "#00aaff",
121
+ "syntaxVariable": "#ffaa00",
122
+ "syntaxString": "#00ff00",
123
+ "syntaxNumber": "#ff00ff",
124
+ "syntaxType": "#00aaff",
125
+ "syntaxOperator": "primary",
126
+ "syntaxPunctuation": "secondary",
127
+ "thinkingOff": "secondary",
128
+ "thinkingMinimal": "primary",
129
+ "thinkingLow": "#00aaff",
130
+ "thinkingMedium": "#00ffff",
131
+ "thinkingHigh": "#ff00ff",
132
+ "thinkingXhigh": "#ff0000",
133
+ "thinkingMax": "#ff0088",
134
+ "bashMode": "#ffaa00"
135
+ }
136
+ }
137
+ ```
138
+
139
+ 3. Select the theme via `/settings`.
140
+
141
+ **Hot reload:** When you edit the currently active custom theme file, pi reloads it automatically for immediate visual feedback.
142
+
143
+ ## Theme Format
144
+
145
+ ```json
146
+ {
147
+ "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
148
+ "name": "my-theme",
149
+ "vars": {
150
+ "blue": "#0066cc",
151
+ "gray": 242
152
+ },
153
+ "colors": {
154
+ "accent": "blue",
155
+ "muted": "gray",
156
+ "text": "",
157
+ ...
158
+ }
159
+ }
160
+ ```
161
+
162
+ - `name` is required, must be unique, and must not contain `/`.
163
+ - `vars` is optional. Define reusable colors here, then reference them in `colors`.
164
+ - `colors` must define all 53 required tokens. `thinkingMax` and the two search highlight tokens are optional and use the fallbacks listed below.
165
+
166
+ The `$schema` field enables editor auto-completion and validation.
167
+
168
+ ## Color Tokens
169
+
170
+ Every theme must define all 53 required color tokens. The optional tokens preserve compatibility with existing themes: `thinkingMax` falls back to `thinkingXhigh`, `searchMatchBg` falls 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.
171
+
172
+ ### Core UI (13 colors)
173
+
174
+ | Token | Purpose |
175
+ |-------|---------|
176
+ | `accent` | Primary accent (logo, selected items, cursor) |
177
+ | `border` | Normal borders |
178
+ | `borderAccent` | Highlighted borders |
179
+ | `borderMuted` | Subtle borders (editor) |
180
+ | `success` | Success states |
181
+ | `error` | Error states |
182
+ | `warning` | Warning states |
183
+ | `muted` | Secondary text |
184
+ | `dim` | Tertiary text |
185
+ | `text` | Default text (usually `""`) |
186
+ | `thinkingText` | Thinking block text |
187
+ | `scrollbarTrack` | Fullscreen scrollbar track foreground |
188
+ | `scrollbarThumb` | Fullscreen scrollbar thumb foreground, shared by normal and expanded states |
189
+
190
+ ### Backgrounds & Content (11 required, 2 optional)
191
+
192
+ | Token | Purpose |
193
+ |-------|---------|
194
+ | `selectedBg` | Selected line background |
195
+ | `searchMatchBg` | Transcript search match background and current-match text; optional, falls back to `selectedBg` |
196
+ | `searchMatchText` | Transcript search match text and current-match background; optional, falls back to `text` |
197
+ | `userMessageBg` | User message background |
198
+ | `userMessageText` | User message text |
199
+ | `customMessageBg` | Extension message background |
200
+ | `customMessageText` | Extension message text |
201
+ | `customMessageLabel` | Extension message label |
202
+ | `toolPendingBg` | Tool box (pending) |
203
+ | `toolSuccessBg` | Tool box (success) |
204
+ | `toolErrorBg` | Tool box (error) |
205
+ | `toolTitle` | Tool title |
206
+ | `toolOutput` | Tool output text |
207
+
208
+ ### Markdown (10 colors)
209
+
210
+ | Token | Purpose |
211
+ |-------|---------|
212
+ | `mdHeading` | Headings |
213
+ | `mdLink` | Link text |
214
+ | `mdLinkUrl` | Link URL |
215
+ | `mdCode` | Inline code |
216
+ | `mdCodeBlock` | Code block content |
217
+ | `mdCodeBlockBorder` | Code block fences |
218
+ | `mdQuote` | Blockquote text |
219
+ | `mdQuoteBorder` | Blockquote border |
220
+ | `mdHr` | Horizontal rule |
221
+ | `mdListBullet` | List bullets |
222
+
223
+ ### Tool Diffs (3 colors)
224
+
225
+ | Token | Purpose |
226
+ |-------|---------|
227
+ | `toolDiffAdded` | Added lines |
228
+ | `toolDiffRemoved` | Removed lines |
229
+ | `toolDiffContext` | Context lines |
230
+
231
+ ### Syntax Highlighting (9 colors)
232
+
233
+ | Token | Purpose |
234
+ |-------|---------|
235
+ | `syntaxComment` | Comments |
236
+ | `syntaxKeyword` | Keywords |
237
+ | `syntaxFunction` | Function names |
238
+ | `syntaxVariable` | Variables |
239
+ | `syntaxString` | Strings |
240
+ | `syntaxNumber` | Numbers |
241
+ | `syntaxType` | Types |
242
+ | `syntaxOperator` | Operators |
243
+ | `syntaxPunctuation` | Punctuation |
244
+
245
+ ### Thinking Level Borders (6 required, 1 optional)
246
+
247
+ Editor border colors indicating thinking level (visual hierarchy from subtle to prominent):
248
+
249
+ | Token | Purpose |
250
+ |-------|---------|
251
+ | `thinkingOff` | Thinking off |
252
+ | `thinkingMinimal` | Minimal thinking |
253
+ | `thinkingLow` | Low thinking |
254
+ | `thinkingMedium` | Medium thinking |
255
+ | `thinkingHigh` | High thinking |
256
+ | `thinkingXhigh` | Extra high thinking |
257
+ | `thinkingMax` | Maximum thinking; optional, falls back to `thinkingXhigh` |
258
+
259
+ ### Bash Mode (1 color)
260
+
261
+ | Token | Purpose |
262
+ |-------|---------|
263
+ | `bashMode` | Editor border in bash mode (`!` prefix) |
264
+
265
+ ### HTML Export (optional)
266
+
267
+ The `export` section controls colors for `/export` HTML output. If omitted, colors are derived from `userMessageBg`.
268
+
269
+ ```json
270
+ {
271
+ "export": {
272
+ "pageBg": "#18181e",
273
+ "cardBg": "#1e1e24",
274
+ "infoBg": "#3c3728"
275
+ }
276
+ }
277
+ ```
278
+
279
+ ## Color Values
280
+
281
+ Four formats are supported:
282
+
283
+ | Format | Example | Description |
284
+ |--------|---------|-------------|
285
+ | Hex | `"#ff0000"` | 6-digit hex RGB |
286
+ | 256-color | `39` | xterm 256-color palette index (0-255) |
287
+ | Variable | `"primary"` | Reference to a `vars` entry |
288
+ | Default | `""` | Terminal's default color |
289
+
290
+ ### 256-Color Palette
291
+
292
+ - `0-15`: Basic ANSI colors (terminal-dependent)
293
+ - `16-231`: 6×6×6 RGB cube (`16 + 36×R + 6×G + B` where R,G,B are 0-5)
294
+ - `232-255`: Grayscale ramp
295
+
296
+ ### Terminal Compatibility
297
+
298
+ Pi uses 24-bit RGB colors. Most modern terminals support this (iTerm2, Kitty, WezTerm, Windows Terminal, VS Code). For older terminals with only 256-color support, pi falls back to the nearest approximation.
299
+
300
+ Check truecolor support:
301
+
302
+ ```bash
303
+ echo $COLORTERM # Should output "truecolor" or "24bit"
304
+ ```
305
+
306
+ ## Tips
307
+
308
+ **Dark terminals:** Use bright, saturated colors with higher contrast.
309
+
310
+ **Light terminals:** Use darker, muted colors with lower contrast.
311
+
312
+ **Color harmony:** Start with a base palette (Nord, Gruvbox, Tokyo Night), define it in `vars`, and reference consistently.
313
+
314
+ **Testing:** Check your theme with different message types, tool states, markdown content, and long wrapped text.
315
+
316
+ **VS Code:** Set `terminal.integrated.minimumContrastRatio` to `1` for accurate colors.
317
+
318
+ ## Examples
319
+
320
+ See the built-in themes:
321
+ - [dark.json](../src/modes/interactive/theme/dark.json)
322
+ - [light.json](../src/modes/interactive/theme/light.json)
package/docs/tmux.md ADDED
@@ -0,0 +1,63 @@
1
+ # tmux Setup
2
+
3
+ Pi works inside tmux, but tmux strips modifier information from certain keys by default. Without configuration, `Shift+Enter` and `Ctrl+Enter` are usually indistinguishable from plain `Enter`.
4
+
5
+ ## Recommended Configuration
6
+
7
+ Add to `~/.tmux.conf`:
8
+
9
+ ```tmux
10
+ set -g extended-keys on
11
+ set -g extended-keys-format csi-u
12
+ ```
13
+
14
+ Then restart tmux fully:
15
+
16
+ ```bash
17
+ tmux kill-server
18
+ tmux
19
+ ```
20
+
21
+ Pi requests extended key reporting automatically when Kitty keyboard protocol is not available. With `extended-keys-format csi-u`, tmux forwards modified keys in CSI-u format, which is the most reliable configuration. The `extended-keys-format` option requires tmux 3.5 or later.
22
+
23
+ ## Why `csi-u` Is Recommended
24
+
25
+ With only:
26
+
27
+ ```tmux
28
+ set -g extended-keys on
29
+ ```
30
+
31
+ tmux defaults to `extended-keys-format xterm`. When an application requests extended key reporting, modified keys are forwarded in xterm `modifyOtherKeys` format such as:
32
+
33
+ - `Ctrl+C` → `\x1b[27;5;99~`
34
+ - `Ctrl+D` → `\x1b[27;5;100~`
35
+ - `Ctrl+Enter` → `\x1b[27;5;13~`
36
+
37
+ With `extended-keys-format csi-u`, the same keys are forwarded as:
38
+
39
+ - `Ctrl+C` → `\x1b[99;5u`
40
+ - `Ctrl+D` → `\x1b[100;5u`
41
+ - `Ctrl+Enter` → `\x1b[13;5u`
42
+
43
+ Pi supports both formats, but `csi-u` is the recommended tmux setup.
44
+
45
+ ## What This Fixes
46
+
47
+ Without tmux extended keys, modified Enter keys collapse to legacy sequences:
48
+
49
+ | Key | Without extkeys | With `csi-u` |
50
+ |-----|-----------------|--------------|
51
+ | Enter | `\r` | `\r` |
52
+ | Shift+Enter | `\r` | `\x1b[13;2u` |
53
+ | Ctrl+Enter | `\r` | `\x1b[13;5u` |
54
+ | Alt/Option+Enter | `\x1b\r` | `\x1b[13;3u` |
55
+
56
+ This affects the default keybindings (`Enter` to submit, `Shift+Enter` for newline) and any custom keybindings using modified Enter.
57
+
58
+ ## Requirements
59
+
60
+ - tmux 3.5 or later for `extended-keys-format csi-u` (run `tmux -V` to check)
61
+ - A terminal emulator that supports extended keys (Ghostty, Kitty, iTerm2, WezTerm, Windows Terminal)
62
+
63
+ With tmux 3.2 through 3.4, omit `extended-keys-format csi-u`; Pi still supports tmux's default xterm `modifyOtherKeys` format.