herm-tui 1.0.0-dev.1 → 1.0.0-dev.3

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 (188) hide show
  1. package/db.worker.js +81 -0
  2. package/highlights-eq9cgrbb.scm +604 -0
  3. package/highlights-ghv9g403.scm +205 -0
  4. package/highlights-hk7bwhj4.scm +284 -0
  5. package/highlights-r812a2qc.scm +150 -0
  6. package/highlights-x6tmsnaa.scm +115 -0
  7. package/index.js +10374 -0
  8. package/injections-73j83es3.scm +27 -0
  9. package/package.json +14 -64
  10. package/parser.worker.js +8 -0
  11. package/tree-sitter-3jzf13jk.wasm +0 -0
  12. package/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  13. package/tree-sitter-markdown-411r6y9b.wasm +0 -0
  14. package/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  15. package/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  16. package/tree-sitter-zig-e78zbjpm.wasm +0 -0
  17. package/scripts/postinstall.ts +0 -29
  18. package/src/app/gateway.tsx +0 -83
  19. package/src/app/gatewayEvents.ts +0 -203
  20. package/src/app/launch.ts +0 -41
  21. package/src/app/skin.tsx +0 -31
  22. package/src/app/spawnHistory.ts +0 -75
  23. package/src/app/tabs.ts +0 -23
  24. package/src/app/turnReducer.ts +0 -390
  25. package/src/app/useAppKeys.ts +0 -268
  26. package/src/app/useAtRefPopover.ts +0 -99
  27. package/src/app/useInputHistory.ts +0 -66
  28. package/src/app/useSession.ts +0 -102
  29. package/src/app/useSlashCommands.ts +0 -70
  30. package/src/app/useSlashPopover.ts +0 -48
  31. package/src/app.tsx +0 -917
  32. package/src/commands/slash.ts +0 -151
  33. package/src/components/avatar/AnimatedAvatar.tsx +0 -66
  34. package/src/components/avatar/eikon.ts +0 -144
  35. package/src/components/avatar/states/error.ts +0 -1155
  36. package/src/components/avatar/states/idle.ts +0 -1155
  37. package/src/components/avatar/states/index.ts +0 -30
  38. package/src/components/avatar/states/listening.ts +0 -1155
  39. package/src/components/avatar/states/speaking.ts +0 -1155
  40. package/src/components/avatar/states/thinking.ts +0 -1155
  41. package/src/components/avatar/states/working.ts +0 -1155
  42. package/src/components/chat/AtRefPopover.tsx +0 -54
  43. package/src/components/chat/CodeBlock.tsx +0 -67
  44. package/src/components/chat/Composer.tsx +0 -347
  45. package/src/components/chat/DiffBlock.tsx +0 -116
  46. package/src/components/chat/ErrorBlock.tsx +0 -70
  47. package/src/components/chat/MediaChip.tsx +0 -114
  48. package/src/components/chat/MessageItem.tsx +0 -282
  49. package/src/components/chat/MessageList.tsx +0 -114
  50. package/src/components/chat/PromptCard.tsx +0 -359
  51. package/src/components/chat/SlashPopover.tsx +0 -158
  52. package/src/components/chat/ThoughtCloud.tsx +0 -185
  53. package/src/components/chat/TypingIndicator.tsx +0 -25
  54. package/src/components/chat/tool/Subagent.tsx +0 -75
  55. package/src/components/chat/tool/frame.tsx +0 -69
  56. package/src/components/chat/tool/index.tsx +0 -65
  57. package/src/components/chat/tool/preview.ts +0 -57
  58. package/src/components/sidebar/ContextGauge.tsx +0 -102
  59. package/src/components/sidebar/Sidebar.tsx +0 -143
  60. package/src/components/tabs/TabBar.tsx +0 -50
  61. package/src/components/ui/FileLink.tsx +0 -52
  62. package/src/config/index.ts +0 -156
  63. package/src/config/lane.ts +0 -161
  64. package/src/config/models.ts +0 -95
  65. package/src/config/rules.ts +0 -80
  66. package/src/config/schema.ts +0 -308
  67. package/src/dialogs/alert.tsx +0 -52
  68. package/src/dialogs/chafa.tsx +0 -72
  69. package/src/dialogs/confirm.tsx +0 -58
  70. package/src/dialogs/curator.tsx +0 -153
  71. package/src/dialogs/eikon-picker.tsx +0 -95
  72. package/src/dialogs/help.tsx +0 -80
  73. package/src/dialogs/history.tsx +0 -92
  74. package/src/dialogs/info.tsx +0 -115
  75. package/src/dialogs/keys.tsx +0 -170
  76. package/src/dialogs/logs.tsx +0 -42
  77. package/src/dialogs/message.tsx +0 -38
  78. package/src/dialogs/model-picker.tsx +0 -123
  79. package/src/dialogs/new-profile.tsx +0 -69
  80. package/src/dialogs/new-task.tsx +0 -103
  81. package/src/dialogs/profile.tsx +0 -55
  82. package/src/dialogs/rollback.tsx +0 -190
  83. package/src/dialogs/spawn-history.tsx +0 -80
  84. package/src/dialogs/text-prompt.tsx +0 -68
  85. package/src/dialogs/theme-picker.tsx +0 -50
  86. package/src/home/index.ts +0 -23
  87. package/src/home/store.ts +0 -267
  88. package/src/index.tsx +0 -113
  89. package/src/keys/catalog.ts +0 -115
  90. package/src/keys/chord.ts +0 -125
  91. package/src/keys/conflicts.ts +0 -48
  92. package/src/keys/context.tsx +0 -112
  93. package/src/keys/index.ts +0 -5
  94. package/src/keys/list.ts +0 -94
  95. package/src/keys/oc-compat.ts +0 -87
  96. package/src/tabs/Agents.tsx +0 -607
  97. package/src/tabs/Analytics.tsx +0 -154
  98. package/src/tabs/Chat.tsx +0 -50
  99. package/src/tabs/Config.tsx +0 -605
  100. package/src/tabs/Context.tsx +0 -599
  101. package/src/tabs/Cron.tsx +0 -294
  102. package/src/tabs/Env.tsx +0 -227
  103. package/src/tabs/Kanban.tsx +0 -367
  104. package/src/tabs/Memory.tsx +0 -294
  105. package/src/tabs/Sessions.tsx +0 -786
  106. package/src/tabs/Skills.tsx +0 -507
  107. package/src/tabs/Toolsets.tsx +0 -266
  108. package/src/theme/builtin.ts +0 -78
  109. package/src/theme/context.tsx +0 -106
  110. package/src/theme/index.ts +0 -4
  111. package/src/theme/resolve.ts +0 -134
  112. package/src/theme/syntax.ts +0 -31
  113. package/src/theme/themes/aura.json +0 -69
  114. package/src/theme/themes/ayu.json +0 -80
  115. package/src/theme/themes/carbonfox.json +0 -248
  116. package/src/theme/themes/catppuccin-frappe.json +0 -233
  117. package/src/theme/themes/catppuccin-macchiato.json +0 -233
  118. package/src/theme/themes/catppuccin.json +0 -112
  119. package/src/theme/themes/cobalt2.json +0 -228
  120. package/src/theme/themes/cursor.json +0 -249
  121. package/src/theme/themes/dracula.json +0 -219
  122. package/src/theme/themes/everforest.json +0 -241
  123. package/src/theme/themes/flexoki.json +0 -237
  124. package/src/theme/themes/github.json +0 -233
  125. package/src/theme/themes/gruvbox.json +0 -242
  126. package/src/theme/themes/kanagawa.json +0 -77
  127. package/src/theme/themes/lucent-orng.json +0 -237
  128. package/src/theme/themes/material.json +0 -235
  129. package/src/theme/themes/matrix.json +0 -77
  130. package/src/theme/themes/mercury.json +0 -252
  131. package/src/theme/themes/monokai.json +0 -221
  132. package/src/theme/themes/nightowl.json +0 -221
  133. package/src/theme/themes/nord.json +0 -223
  134. package/src/theme/themes/one-dark.json +0 -84
  135. package/src/theme/themes/opencode.json +0 -245
  136. package/src/theme/themes/orng.json +0 -249
  137. package/src/theme/themes/osaka-jade.json +0 -93
  138. package/src/theme/themes/palenight.json +0 -222
  139. package/src/theme/themes/rosepine.json +0 -234
  140. package/src/theme/themes/solarized.json +0 -223
  141. package/src/theme/themes/synthwave84.json +0 -226
  142. package/src/theme/themes/tokyonight.json +0 -243
  143. package/src/theme/themes/vercel.json +0 -245
  144. package/src/theme/themes/vesper.json +0 -218
  145. package/src/theme/themes/zenburn.json +0 -223
  146. package/src/theme/types.ts +0 -119
  147. package/src/types/message.ts +0 -97
  148. package/src/ui/ChafaImage.tsx +0 -64
  149. package/src/ui/Splash.tsx +0 -118
  150. package/src/ui/borders.ts +0 -28
  151. package/src/ui/command.tsx +0 -104
  152. package/src/ui/dialog-select.tsx +0 -164
  153. package/src/ui/dialog.tsx +0 -102
  154. package/src/ui/fmt.ts +0 -82
  155. package/src/ui/kv.tsx +0 -28
  156. package/src/ui/shell.tsx +0 -45
  157. package/src/ui/spinner.tsx +0 -59
  158. package/src/ui/splash-art.ts +0 -123
  159. package/src/ui/table.tsx +0 -117
  160. package/src/ui/ticker.tsx +0 -90
  161. package/src/ui/toast.tsx +0 -130
  162. package/src/utils/categorical.ts +0 -77
  163. package/src/utils/chafa.ts +0 -173
  164. package/src/utils/clipboard.ts +0 -67
  165. package/src/utils/context-segments.ts +0 -317
  166. package/src/utils/control.ts +0 -495
  167. package/src/utils/drop.ts +0 -25
  168. package/src/utils/editor.ts +0 -33
  169. package/src/utils/fuzzy.ts +0 -45
  170. package/src/utils/gateway-client.ts +0 -253
  171. package/src/utils/gateway-types.ts +0 -282
  172. package/src/utils/git.ts +0 -57
  173. package/src/utils/hermes-analytics.ts +0 -134
  174. package/src/utils/hermes-home.ts +0 -821
  175. package/src/utils/hermes-kanban.ts +0 -154
  176. package/src/utils/hermes-profiles.ts +0 -217
  177. package/src/utils/interpolate.ts +0 -31
  178. package/src/utils/math-unicode.ts +0 -818
  179. package/src/utils/memory-activity.ts +0 -140
  180. package/src/utils/open-file.ts +0 -13
  181. package/src/utils/paths.ts +0 -52
  182. package/src/utils/perf.ts +0 -235
  183. package/src/utils/preferences.ts +0 -150
  184. package/src/utils/sessions-db.ts +0 -396
  185. package/src/utils/subagent-tree.ts +0 -146
  186. package/src/utils/terminal-reset.ts +0 -129
  187. package/src/utils/tips.ts +0 -67
  188. package/src/utils/tokens.ts +0 -87
@@ -1,223 +0,0 @@
1
- {
2
- "$schema": "https://opencode.ai/theme.json",
3
- "defs": {
4
- "bg": "#3f3f3f",
5
- "bgAlt": "#4f4f4f",
6
- "bgPanel": "#5f5f5f",
7
- "fg": "#dcdccc",
8
- "fgMuted": "#9f9f9f",
9
- "red": "#cc9393",
10
- "redBright": "#dca3a3",
11
- "green": "#7f9f7f",
12
- "greenBright": "#8fb28f",
13
- "yellow": "#f0dfaf",
14
- "yellowDim": "#e0cf9f",
15
- "blue": "#8cd0d3",
16
- "blueDim": "#7cb8bb",
17
- "magenta": "#dc8cc3",
18
- "cyan": "#93e0e3",
19
- "orange": "#dfaf8f"
20
- },
21
- "theme": {
22
- "primary": {
23
- "dark": "blue",
24
- "light": "#5f7f8f"
25
- },
26
- "secondary": {
27
- "dark": "magenta",
28
- "light": "#8f5f8f"
29
- },
30
- "accent": {
31
- "dark": "cyan",
32
- "light": "#5f8f8f"
33
- },
34
- "error": {
35
- "dark": "red",
36
- "light": "#8f5f5f"
37
- },
38
- "warning": {
39
- "dark": "yellow",
40
- "light": "#8f8f5f"
41
- },
42
- "success": {
43
- "dark": "green",
44
- "light": "#5f8f5f"
45
- },
46
- "info": {
47
- "dark": "orange",
48
- "light": "#8f7f5f"
49
- },
50
- "text": {
51
- "dark": "fg",
52
- "light": "#3f3f3f"
53
- },
54
- "textMuted": {
55
- "dark": "fgMuted",
56
- "light": "#6f6f6f"
57
- },
58
- "background": {
59
- "dark": "bg",
60
- "light": "#ffffef"
61
- },
62
- "backgroundPanel": {
63
- "dark": "bgAlt",
64
- "light": "#f5f5e5"
65
- },
66
- "backgroundElement": {
67
- "dark": "bgPanel",
68
- "light": "#ebebdb"
69
- },
70
- "border": {
71
- "dark": "#5f5f5f",
72
- "light": "#d0d0c0"
73
- },
74
- "borderActive": {
75
- "dark": "blue",
76
- "light": "#5f7f8f"
77
- },
78
- "borderSubtle": {
79
- "dark": "#4f4f4f",
80
- "light": "#e0e0d0"
81
- },
82
- "diffAdded": {
83
- "dark": "green",
84
- "light": "#5f8f5f"
85
- },
86
- "diffRemoved": {
87
- "dark": "red",
88
- "light": "#8f5f5f"
89
- },
90
- "diffContext": {
91
- "dark": "fgMuted",
92
- "light": "#6f6f6f"
93
- },
94
- "diffHunkHeader": {
95
- "dark": "cyan",
96
- "light": "#5f8f8f"
97
- },
98
- "diffHighlightAdded": {
99
- "dark": "greenBright",
100
- "light": "#5f8f5f"
101
- },
102
- "diffHighlightRemoved": {
103
- "dark": "redBright",
104
- "light": "#8f5f5f"
105
- },
106
- "diffAddedBg": {
107
- "dark": "#4f5f4f",
108
- "light": "#efffef"
109
- },
110
- "diffRemovedBg": {
111
- "dark": "#5f4f4f",
112
- "light": "#ffefef"
113
- },
114
- "diffContextBg": {
115
- "dark": "bgAlt",
116
- "light": "#f5f5e5"
117
- },
118
- "diffLineNumber": {
119
- "dark": "#6f6f6f",
120
- "light": "#b0b0a0"
121
- },
122
- "diffAddedLineNumberBg": {
123
- "dark": "#4f5f4f",
124
- "light": "#efffef"
125
- },
126
- "diffRemovedLineNumberBg": {
127
- "dark": "#5f4f4f",
128
- "light": "#ffefef"
129
- },
130
- "markdownText": {
131
- "dark": "fg",
132
- "light": "#3f3f3f"
133
- },
134
- "markdownHeading": {
135
- "dark": "yellow",
136
- "light": "#8f8f5f"
137
- },
138
- "markdownLink": {
139
- "dark": "blue",
140
- "light": "#5f7f8f"
141
- },
142
- "markdownLinkText": {
143
- "dark": "cyan",
144
- "light": "#5f8f8f"
145
- },
146
- "markdownCode": {
147
- "dark": "green",
148
- "light": "#5f8f5f"
149
- },
150
- "markdownBlockQuote": {
151
- "dark": "fgMuted",
152
- "light": "#6f6f6f"
153
- },
154
- "markdownEmph": {
155
- "dark": "yellowDim",
156
- "light": "#8f8f5f"
157
- },
158
- "markdownStrong": {
159
- "dark": "orange",
160
- "light": "#8f7f5f"
161
- },
162
- "markdownHorizontalRule": {
163
- "dark": "fgMuted",
164
- "light": "#6f6f6f"
165
- },
166
- "markdownListItem": {
167
- "dark": "blue",
168
- "light": "#5f7f8f"
169
- },
170
- "markdownListEnumeration": {
171
- "dark": "cyan",
172
- "light": "#5f8f8f"
173
- },
174
- "markdownImage": {
175
- "dark": "blue",
176
- "light": "#5f7f8f"
177
- },
178
- "markdownImageText": {
179
- "dark": "cyan",
180
- "light": "#5f8f8f"
181
- },
182
- "markdownCodeBlock": {
183
- "dark": "fg",
184
- "light": "#3f3f3f"
185
- },
186
- "syntaxComment": {
187
- "dark": "#7f9f7f",
188
- "light": "#5f7f5f"
189
- },
190
- "syntaxKeyword": {
191
- "dark": "yellow",
192
- "light": "#8f8f5f"
193
- },
194
- "syntaxFunction": {
195
- "dark": "blue",
196
- "light": "#5f7f8f"
197
- },
198
- "syntaxVariable": {
199
- "dark": "fg",
200
- "light": "#3f3f3f"
201
- },
202
- "syntaxString": {
203
- "dark": "red",
204
- "light": "#8f5f5f"
205
- },
206
- "syntaxNumber": {
207
- "dark": "greenBright",
208
- "light": "#5f8f5f"
209
- },
210
- "syntaxType": {
211
- "dark": "cyan",
212
- "light": "#5f8f8f"
213
- },
214
- "syntaxOperator": {
215
- "dark": "yellow",
216
- "light": "#8f8f5f"
217
- },
218
- "syntaxPunctuation": {
219
- "dark": "fg",
220
- "light": "#3f3f3f"
221
- }
222
- }
223
- }
@@ -1,119 +0,0 @@
1
- /**
2
- * Theme type definitions — mirrors OpenCode's token model exactly.
3
- * All 44 RGBA color tokens + 1 numeric token.
4
- */
5
-
6
- import type { RGBA } from "@opentui/core";
7
-
8
- /** All color token names (excludes thinkingOpacity) */
9
- export type ThemeColor = Exclude<keyof ThemeCurrent, "thinkingOpacity">;
10
-
11
- /** Resolved theme — all values are RGBA or number, ready for rendering */
12
- export type ThemeCurrent = {
13
- // Core
14
- readonly primary: RGBA;
15
- readonly secondary: RGBA;
16
- readonly accent: RGBA;
17
- readonly error: RGBA;
18
- readonly warning: RGBA;
19
- readonly success: RGBA;
20
- readonly info: RGBA;
21
-
22
- // Text
23
- readonly text: RGBA;
24
- readonly textMuted: RGBA;
25
- readonly selectedListItemText: RGBA;
26
-
27
- // Backgrounds
28
- readonly background: RGBA;
29
- readonly backgroundPanel: RGBA;
30
- readonly backgroundElement: RGBA;
31
- readonly backgroundMenu: RGBA;
32
-
33
- // Borders
34
- readonly border: RGBA;
35
- readonly borderActive: RGBA;
36
- readonly borderSubtle: RGBA;
37
-
38
- // Diff
39
- readonly diffAdded: RGBA;
40
- readonly diffRemoved: RGBA;
41
- readonly diffContext: RGBA;
42
- readonly diffHunkHeader: RGBA;
43
- readonly diffHighlightAdded: RGBA;
44
- readonly diffHighlightRemoved: RGBA;
45
- readonly diffAddedBg: RGBA;
46
- readonly diffRemovedBg: RGBA;
47
- readonly diffContextBg: RGBA;
48
- readonly diffLineNumber: RGBA;
49
- readonly diffAddedLineNumberBg: RGBA;
50
- readonly diffRemovedLineNumberBg: RGBA;
51
-
52
- // Markdown
53
- readonly markdownText: RGBA;
54
- readonly markdownHeading: RGBA;
55
- readonly markdownLink: RGBA;
56
- readonly markdownLinkText: RGBA;
57
- readonly markdownCode: RGBA;
58
- readonly markdownBlockQuote: RGBA;
59
- readonly markdownEmph: RGBA;
60
- readonly markdownStrong: RGBA;
61
- readonly markdownHorizontalRule: RGBA;
62
- readonly markdownListItem: RGBA;
63
- readonly markdownListEnumeration: RGBA;
64
- readonly markdownImage: RGBA;
65
- readonly markdownImageText: RGBA;
66
- readonly markdownCodeBlock: RGBA;
67
-
68
- // Syntax
69
- readonly syntaxComment: RGBA;
70
- readonly syntaxKeyword: RGBA;
71
- readonly syntaxFunction: RGBA;
72
- readonly syntaxVariable: RGBA;
73
- readonly syntaxString: RGBA;
74
- readonly syntaxNumber: RGBA;
75
- readonly syntaxType: RGBA;
76
- readonly syntaxOperator: RGBA;
77
- readonly syntaxPunctuation: RGBA;
78
-
79
- // Numeric
80
- readonly thinkingOpacity: number;
81
- };
82
-
83
- /** Herm-specific tokens — the sidebar "pillar" identity */
84
- export type HermTokens = {
85
- /** Avatar (bust) color — top of the herm */
86
- readonly hermAvatar: RGBA;
87
- /** Body (pillar) background — bottom of the herm */
88
- readonly hermBody: RGBA;
89
- /** Auto-computed text color for legibility on hermBody */
90
- readonly hermBodyText: RGBA;
91
- /** Dimmed hermBodyText — labels/secondary content on the pillar */
92
- readonly hermBodyTextMuted: RGBA;
93
- };
94
-
95
- /** Internal resolved theme with extra tracking + herm tokens */
96
- export type Theme = ThemeCurrent &
97
- HermTokens & {
98
- _hasSelectedListItemText: boolean;
99
- };
100
-
101
- /** Color value in a theme JSON file */
102
- export type HexColor = `#${string}`;
103
- export type RefName = string;
104
- export type Variant = { dark: HexColor | RefName; light: HexColor | RefName };
105
- export type ColorValue = HexColor | RefName | Variant | RGBA;
106
-
107
- /** Theme JSON file format */
108
- export type ThemeJson = {
109
- $schema?: string;
110
- defs?: Record<string, HexColor | RefName>;
111
- theme: Omit<
112
- Record<ThemeColor, ColorValue>,
113
- "selectedListItemText" | "backgroundMenu"
114
- > & {
115
- selectedListItemText?: ColorValue;
116
- backgroundMenu?: ColorValue;
117
- thinkingOpacity?: number;
118
- };
119
- };
@@ -1,97 +0,0 @@
1
- // Message types for herm chat — parts-based like OpenCode
2
-
3
- export type TextPart = {
4
- type: "text"
5
- key?: string
6
- content: string
7
- streaming: boolean
8
- }
9
-
10
- export type ToolPart = {
11
- type: "tool"
12
- id: string
13
- name: string
14
- args: string
15
- status: "running" | "done" | "error"
16
- startedAt?: number
17
- duration?: number
18
- preview?: string
19
- result?: string
20
- diff?: string
21
- /** Subagent only — child tool calls accumulated from subagent.tool events. */
22
- trail?: Array<{ name: string; preview?: string }>
23
- /** Subagent only — goal text from subagent.start. */
24
- goal?: string
25
- /** Subagent only — spawn depth, 0 = direct child of the main agent. */
26
- depth?: number
27
- }
28
-
29
- export type ThinkingPart = {
30
- type: "thinking"
31
- key?: string
32
- content: string
33
- streaming: boolean
34
- }
35
-
36
- /** Agent-originated interactive prompt. Renders inline in the
37
- * transcript; `answered` is set (in place) once the user responds,
38
- * collapsing the card to a one-line outcome row that persists in
39
- * history. */
40
- export type PromptPart = {
41
- type: "prompt"
42
- id: string
43
- variant: "approval" | "clarify" | "sudo" | "secret"
44
- req: PromptReq
45
- answered?: { label: string; ok: boolean; at: number }
46
- }
47
-
48
- export type PromptReq =
49
- | { variant: "approval"; command: string; description: string }
50
- | { variant: "clarify"; request_id: string; question: string; choices: string[] | null }
51
- | { variant: "sudo"; request_id: string }
52
- | { variant: "secret"; request_id: string; prompt: string; env_var: string }
53
-
54
- export type Part = TextPart | ToolPart | ThinkingPart | PromptPart
55
-
56
- export type Usage = {
57
- input: number
58
- output: number
59
- total: number
60
- // Context-compression fields — populated when the agent has a
61
- // ContextCompressor attached (default). Absent on sessions without
62
- // compression, so consumers must guard with `typeof x === "number"`.
63
- context_used?: number
64
- context_max?: number
65
- context_percent?: number
66
- compressions?: number
67
- }
68
-
69
- export type Message = {
70
- id: string
71
- role: "user" | "assistant" | "system"
72
- parts: Part[]
73
- timestamp: number
74
- model?: string
75
- duration?: number
76
- usage?: Usage
77
- error?: string
78
- }
79
-
80
- // Helper to extract all text content from a message
81
- export function text(msg: Message): string {
82
- return msg.parts
83
- .filter((p): p is TextPart => p.type === "text")
84
- .map(p => p.content)
85
- .join("")
86
- }
87
-
88
- // Create a unique message ID
89
- export function mid(): string {
90
- return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
91
- }
92
-
93
- let pn = 0
94
- /** Stable per-part key so React doesn't remount when parts shift index. */
95
- export function pid(): string {
96
- return `p${++pn}`
97
- }
@@ -1,64 +0,0 @@
1
- // Inline image rendering via chafa + the SGR parser (utils/chafa.ts).
2
- // Shown in-transcript when an assistant response or user attachment contains
3
- // MEDIA:/path/to/image.ext. Click to collapse to a compact chip; click chip
4
- // to re-expand. Any render failure (chafa missing, file gone, timeout)
5
- // silently degrades to the plain MediaChip — no error chrome in the stream.
6
-
7
- import { memo, useMemo, useState } from "react"
8
- import type { MouseEvent } from "@opentui/core"
9
- import { useTheme } from "../theme"
10
- import { openFile } from "../utils/open-file"
11
- import { renderChafa, hex, chafaBin } from "../utils/chafa"
12
- import { MediaChip } from "../components/chat/MediaChip"
13
-
14
- const basename = (p: string) => p.split(/[/\\]/).pop() || p
15
-
16
- type Props = { path: string; width?: number }
17
-
18
- export const ChafaImage = memo(({ path, width }: Props) => {
19
- const theme = useTheme().theme
20
- const [collapsed, setCollapsed] = useState(false)
21
- const w = Math.max(20, Math.min(80, width ?? 60))
22
- const hasChafa = chafaBin() !== null
23
- const result = useMemo(
24
- () => hasChafa ? renderChafa(path, w) : ({ err: "chafa not installed" } as const),
25
- [path, w, hasChafa],
26
- )
27
-
28
- // chafa missing or render failed → stream the MediaChip, no chrome
29
- if (!hasChafa || "err" in result) return <MediaChip path={path} />
30
-
31
- // Collapsed → chip re-expands on click. Override MediaChip's default
32
- // openFile so the click does exactly one thing; stopPropagation keeps
33
- // it from reaching the message's useClick (→ actions menu).
34
- if (collapsed) {
35
- return (
36
- <MediaChip path={path}
37
- onMouseDown={(e: MouseEvent) => { e.stopPropagation(); setCollapsed(false) }} />
38
- )
39
- }
40
-
41
- return (
42
- <box flexDirection="column" marginTop={1}>
43
- <box flexDirection="column"
44
- onMouseDown={(e: MouseEvent) => { e.stopPropagation(); setCollapsed(true) }}>
45
- {result.rows.map((row, i) => (
46
- <text key={i}>
47
- {row.map((c, j) => (
48
- <span key={j} fg={hex(c.fg)} bg={hex(c.bg)}>{c.ch}</span>
49
- ))}
50
- </text>
51
- ))}
52
- </box>
53
- <box height={1}
54
- onMouseDown={(e: MouseEvent) => { e.stopPropagation(); openFile(path) }}>
55
- <text>
56
- <span fg={theme.textMuted}>{" "}</span>
57
- <span fg={theme.accent}>◉ </span>
58
- <span fg={theme.text}>{basename(path)}</span>
59
- <span fg={theme.textMuted}>{" click image to collapse · click name to open"}</span>
60
- </text>
61
- </box>
62
- </box>
63
- )
64
- })
package/src/ui/Splash.tsx DELETED
@@ -1,118 +0,0 @@
1
- // Launch splash — ornate braille frame over an empty transcript, with
2
- // wordmark, version/behind info, and a continue-last-session prompt.
3
- // Presentational only: dismissal + Enter-to-continue live in app.tsx.
4
-
5
- import { useRef, useState, useEffect, useMemo } from "react"
6
- import { useRenderer } from "@opentui/react"
7
- import { measureText, type ASCIIFontName } from "@opentui/core"
8
- import type { BoxRenderable } from "@opentui/core"
9
- import { useTheme } from "../theme"
10
- import { frame } from "./splash-art"
11
- import pkg from "../../package.json" with { type: "json" }
12
-
13
- export type SplashInfo = {
14
- agentVersion?: string
15
- behind?: number | null
16
- model?: string
17
- }
18
-
19
- export type SplashProps = {
20
- /** Gateway-derived facts; undefined until session.info arrives. */
21
- info?: SplashInfo
22
- /** Last real TUI session — shows the continue prompt when present. */
23
- last?: { id: string; title: string | null }
24
- /** True once the user has typed in the composer — hides the prompt. */
25
- composing?: boolean
26
- /** Cron-generated first-bullet from ~/.hermes/herm/changelog.md. */
27
- news?: string
28
- }
29
-
30
- // Wordmark font tiers, widest first. `measureText` is cheap (table lookup).
31
- const TIERS: ASCIIFontName[] = ["block", "slick", "tiny"]
32
- const pickFont = (innerW: number): ASCIIFontName =>
33
- TIERS.find(f => measureText({ text: "HERM", font: f }).width <= innerW) ?? "tiny"
34
-
35
- const clip = (s: string, w: number) =>
36
- [...s].length <= w ? s : [...s].slice(0, Math.max(1, w - 1)).join("") + "…"
37
-
38
- export function Splash(p: SplashProps) {
39
- const theme = useTheme().theme
40
- const ref = useRef<BoxRenderable | null>(null)
41
- const [box, setBox] = useState({ w: 0, h: 0 })
42
-
43
- // Measure after yoga has laid out. frameCallbacks run once per render
44
- // tick (before the next layout pass), so this reads the previous
45
- // frame's computed size — same one-frame latency the old 50ms poll
46
- // had, but synced to the render loop instead of a free-running timer.
47
- const renderer = useRenderer()
48
- useEffect(() => {
49
- const cb = async () => {
50
- const r = ref.current
51
- if (!r) return
52
- setBox(b => (b.w === r.width && b.h === r.height) ? b : { w: r.width, h: r.height })
53
- }
54
- renderer.setFrameCallback(cb)
55
- return () => renderer.removeFrameCallback(cb)
56
- }, [renderer])
57
-
58
- const { lines, inner } = useMemo(() => frame(box.w, box.h), [box.w, box.h])
59
- const font = useMemo(() => pickFont(inner.w), [inner.w])
60
-
61
- const behind = p.info?.behind
62
- const sub = [
63
- `v${pkg.version}`,
64
- p.info ? `hermes ${p.info.agentVersion ?? "?"}` : "…",
65
- behind == null ? null : behind === 0 ? "up to date" : `${behind} behind`,
66
- p.info?.model,
67
- ].filter(Boolean).join(" · ")
68
-
69
- const prompt = p.last && !p.composing
70
- const title = p.last?.title?.trim() || p.last?.id
71
-
72
- return (
73
- <box ref={ref} position="absolute" left={0} top={0} right={0} bottom={0}
74
- zIndex={50} backgroundColor={theme.background}>
75
- {lines.map((l, i) => (
76
- <box key={i} position="absolute" top={i} left={0} height={1}>
77
- <text fg={theme.accent}>{l}</text>
78
- </box>
79
- ))}
80
- {lines.length > 0 && (
81
- <box position="absolute" left={inner.x} top={inner.y}
82
- width={inner.w} height={inner.h}
83
- flexDirection="column" alignItems="center" justifyContent="center">
84
- <box>
85
- <ascii-font text="HERM" font={font}
86
- color={[theme.accent, theme.textMuted]} selectable={false} />
87
- </box>
88
- <box height={1}>
89
- <text fg={theme.textMuted}>{clip(sub, inner.w)}</text>
90
- </box>
91
- {p.news ? (
92
- <box height={1}>
93
- <text fg={theme.textMuted}>{clip(`› ${p.news}`, inner.w)}</text>
94
- </box>
95
- ) : null}
96
- <box height={2} />
97
- {prompt ? (
98
- <>
99
- <text fg={theme.textMuted}>
100
- {"continue "}
101
- <span fg={theme.text}>"{clip(title ?? "", Math.max(8, inner.w - 14))}"</span>
102
- {" ?"}
103
- </text>
104
- <text fg={theme.textMuted}>
105
- <span fg={theme.accent}>[enter]</span>
106
- {" yes · type to start fresh"}
107
- </text>
108
- </>
109
- ) : (
110
- <text fg={theme.textMuted}>
111
- <span fg={theme.accent}>[enter]</span> to send
112
- </text>
113
- )}
114
- </box>
115
- )}
116
- </box>
117
- )
118
- }
package/src/ui/borders.ts DELETED
@@ -1,28 +0,0 @@
1
- // Hoisted BorderCharacters constants. @opentui/react's host
2
- // reconciler compares props by reference (`newProp !== oldProp`), so
3
- // an inline `customBorderChars={{…}}` re-sets the renderable's border
4
- // config and calls `requestRender()` on every parent reconcile even
5
- // when nothing changed. Module-level objects fix the identity.
6
-
7
- import type { BorderCharacters } from "@opentui/core"
8
-
9
- /** Left-edge heavy bar only — panel/card accent. */
10
- export const LEFT_BAR: BorderCharacters = {
11
- topLeft: "", bottomLeft: "", topRight: "", bottomRight: "",
12
- horizontal: "", vertical: "┃",
13
- topT: "", bottomT: "", leftT: "", rightT: "", cross: "",
14
- }
15
-
16
- /** Light single vertical on both sides, no horizontals. */
17
- export const SIDE_PIPE: BorderCharacters = {
18
- topLeft: "│", bottomLeft: "│", vertical: "│",
19
- topRight: "│", bottomRight: "│", horizontal: "",
20
- topT: "", bottomT: "", leftT: "", rightT: "", cross: "",
21
- }
22
-
23
- /** Corners only — the Context heat-grid frame. */
24
- export const CORNERS: BorderCharacters = {
25
- topLeft: "┌", topRight: "┐", bottomLeft: "└", bottomRight: "┘",
26
- horizontal: " ", vertical: " ",
27
- topT: " ", bottomT: " ", leftT: " ", rightT: " ", cross: " ",
28
- }