@armadra/agent 0.3.0 → 0.4.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.
- package/CHANGELOG.md +84 -0
- package/README.md +93 -44
- package/dist/agent/retry.d.ts +1 -1
- package/dist/agent/retry.js +2 -1
- package/dist/agent/session-cache.js +1 -1
- package/dist/agent/session-classifier.d.ts +18 -0
- package/dist/agent/session-classifier.js +103 -0
- package/dist/agent/session-core.d.ts +13 -0
- package/dist/agent/session-tools.js +24 -3
- package/dist/agent/session.d.ts +3 -0
- package/dist/agent/session.js +12 -3
- package/dist/agent/tool-runner.js +15 -2
- package/dist/agent/types.d.ts +9 -1
- package/dist/ai/apis/anthropic-messages.js +3 -2
- package/dist/ai/apis/google-generative-ai.js +3 -2
- package/dist/ai/apis/openai-completions.js +3 -2
- package/dist/ai/apis/openai-responses.js +3 -2
- package/dist/ai/http.d.ts +28 -6
- package/dist/ai/http.js +41 -8
- package/dist/ai/providers/registry.d.ts +8 -1
- package/dist/ai/providers/registry.js +30 -22
- package/dist/ai/providers/suggest.d.ts +18 -0
- package/dist/ai/providers/suggest.js +72 -0
- package/dist/ai/sse.d.ts +6 -2
- package/dist/ai/sse.js +22 -2
- package/dist/ai/types.d.ts +9 -2
- package/dist/bundle/ama.cjs +15279 -10151
- package/dist/cli/args.d.ts +19 -4
- package/dist/cli/args.js +83 -10
- package/dist/cli/bootstrap.js +27 -3
- package/dist/cli/codemode-notice.d.ts +20 -0
- package/dist/cli/codemode-notice.js +55 -0
- package/dist/cli/compose-session.d.ts +5 -0
- package/dist/cli/compose-session.js +32 -1
- package/dist/cli/compose-store.d.ts +1 -1
- package/dist/cli/compose-store.js +3 -1
- package/dist/cli/compose.d.ts +14 -4
- package/dist/cli/compose.js +29 -10
- package/dist/cli/default-model.d.ts +38 -1
- package/dist/cli/default-model.js +96 -9
- package/dist/cli/deps.d.ts +36 -0
- package/dist/cli/exit-codes.d.ts +2 -0
- package/dist/cli/exit-codes.js +3 -0
- package/dist/cli/fake-visibility.d.ts +13 -0
- package/dist/cli/fake-visibility.js +26 -0
- package/dist/cli/from-prompt.d.ts +18 -0
- package/dist/cli/from-prompt.js +49 -0
- package/dist/cli/main.d.ts +9 -2
- package/dist/cli/main.js +77 -3
- package/dist/cli/proxy.d.ts +51 -0
- package/dist/cli/proxy.js +135 -0
- package/dist/cli/startup-screen.d.ts +29 -0
- package/dist/cli/startup-screen.js +47 -0
- package/dist/cli/startup-steps.d.ts +1 -1
- package/dist/cli/startup-steps.js +14 -12
- package/dist/cli/subcommands/config.d.ts +19 -3
- package/dist/cli/subcommands/config.js +108 -21
- package/dist/cli/subcommands/context.js +4 -1
- package/dist/cli/subcommands/doctor.js +12 -1
- package/dist/cli/subcommands/init.js +2 -1
- package/dist/cli/subcommands/models-discover.d.ts +15 -9
- package/dist/cli/subcommands/models-discover.js +53 -46
- package/dist/cli/subcommands/probe-runner.d.ts +96 -0
- package/dist/cli/subcommands/probe-runner.js +264 -0
- package/dist/cli/subcommands/providers-probe.d.ts +34 -0
- package/dist/cli/subcommands/providers-probe.js +87 -0
- package/dist/cli/subcommands/providers.d.ts +3 -2
- package/dist/cli/subcommands/providers.js +48 -45
- package/dist/cli/subcommands/sessions-export.d.ts +10 -0
- package/dist/cli/subcommands/sessions-export.js +59 -0
- package/dist/cli/subcommands/sessions-search.d.ts +13 -0
- package/dist/cli/subcommands/sessions-search.js +103 -0
- package/dist/cli/subcommands/sessions.d.ts +3 -2
- package/dist/cli/subcommands/sessions.js +22 -1
- package/dist/cli/subcommands/stats.d.ts +17 -0
- package/dist/cli/subcommands/stats.js +198 -0
- package/dist/cli/system-prompt-arg.d.ts +11 -0
- package/dist/cli/system-prompt-arg.js +34 -0
- package/dist/codemode/modes.d.ts +4 -11
- package/dist/codemode/modes.js +5 -27
- package/dist/codemode/tool.d.ts +18 -14
- package/dist/codemode/tool.js +71 -28
- package/dist/config/init.d.ts +6 -2
- package/dist/config/init.js +12 -5
- package/dist/config/json-schema.d.ts +1 -0
- package/dist/config/json-schema.js +36 -3
- package/dist/config/key-docs.d.ts +22 -0
- package/dist/config/key-docs.js +105 -0
- package/dist/config/merge.d.ts +9 -8
- package/dist/config/merge.js +22 -7
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.js +24 -5
- package/dist/config/types.d.ts +34 -6
- package/dist/config/types.js +17 -1
- package/dist/modes/commands-core.js +6 -5
- package/dist/modes/interactive/approval-dialog.d.ts +21 -5
- package/dist/modes/interactive/approval-dialog.js +106 -27
- package/dist/modes/interactive/commands.d.ts +11 -2
- package/dist/modes/interactive/commands.js +56 -16
- package/dist/modes/interactive/interactive-mode.d.ts +2 -1
- package/dist/modes/interactive/interactive-mode.js +65 -81
- package/dist/modes/interactive/key-dispatch.d.ts +3 -1
- package/dist/modes/interactive/key-dispatch.js +5 -6
- package/dist/modes/interactive/line/line-mode.d.ts +1 -0
- package/dist/modes/interactive/line/line-mode.js +6 -4
- package/dist/modes/interactive/line/line-render.d.ts +4 -0
- package/dist/modes/interactive/line/line-render.js +28 -6
- package/dist/modes/interactive/message-view.d.ts +48 -9
- package/dist/modes/interactive/message-view.js +238 -44
- package/dist/modes/interactive/panels.d.ts +18 -0
- package/dist/modes/interactive/panels.js +143 -0
- package/dist/modes/interactive/pickers.d.ts +23 -2
- package/dist/modes/interactive/pickers.js +48 -15
- package/dist/modes/interactive/run-indicator.d.ts +51 -0
- package/dist/modes/interactive/run-indicator.js +189 -0
- package/dist/modes/interactive/startup-header.d.ts +40 -0
- package/dist/modes/interactive/startup-header.js +169 -0
- package/dist/modes/interactive/status-bar.d.ts +18 -15
- package/dist/modes/interactive/status-bar.js +98 -56
- package/dist/modes/interactive/tool-summary.d.ts +46 -0
- package/dist/modes/interactive/tool-summary.js +218 -0
- package/dist/modes/interactive/tool-view.d.ts +48 -15
- package/dist/modes/interactive/tool-view.js +203 -145
- package/dist/modes/print/print-mode.d.ts +31 -4
- package/dist/modes/print/print-mode.js +116 -7
- package/dist/modes/rpc/commands.js +5 -0
- package/dist/permissions/auto-safe.d.ts +60 -0
- package/dist/permissions/auto-safe.js +529 -0
- package/dist/permissions/classifier.d.ts +64 -0
- package/dist/permissions/classifier.js +184 -0
- package/dist/permissions/dangerous.d.ts +5 -0
- package/dist/permissions/dangerous.js +1 -1
- package/dist/permissions/modes.d.ts +30 -0
- package/dist/permissions/modes.js +78 -0
- package/dist/permissions/pipeline.d.ts +31 -4
- package/dist/permissions/pipeline.js +196 -6
- package/dist/permissions/protected.d.ts +19 -0
- package/dist/permissions/protected.js +74 -0
- package/dist/permissions/rules.js +3 -0
- package/dist/permissions/types.d.ts +50 -3
- package/dist/permissions/types.js +3 -0
- package/dist/sdk.d.ts +9 -3
- package/dist/sdk.js +10 -2
- package/dist/session/export.d.ts +32 -0
- package/dist/session/export.js +187 -0
- package/dist/session/redact.d.ts +15 -0
- package/dist/session/redact.js +55 -0
- package/dist/session/reuse.d.ts +33 -0
- package/dist/session/reuse.js +86 -0
- package/dist/session/scan.d.ts +34 -0
- package/dist/session/scan.js +140 -0
- package/dist/session/search.d.ts +52 -0
- package/dist/session/search.js +211 -0
- package/dist/session/stats-aggregate.d.ts +63 -0
- package/dist/session/stats-aggregate.js +163 -0
- package/dist/session/stats-index.d.ts +26 -0
- package/dist/session/stats-index.js +91 -0
- package/dist/session/stats-scan.d.ts +54 -0
- package/dist/session/stats-scan.js +236 -0
- package/dist/tools/presets.d.ts +35 -8
- package/dist/tools/presets.js +56 -17
- package/dist/tui/component.d.ts +8 -2
- package/dist/tui/component.js +3 -1
- package/dist/tui/components/box.d.ts +6 -1
- package/dist/tui/components/box.js +16 -6
- package/dist/tui/components/card.d.ts +23 -0
- package/dist/tui/components/card.js +37 -0
- package/dist/tui/components/editor-history.d.ts +6 -0
- package/dist/tui/components/editor-history.js +45 -0
- package/dist/tui/components/editor-paste.d.ts +1 -1
- package/dist/tui/components/editor-paste.js +4 -4
- package/dist/tui/components/editor.d.ts +11 -5
- package/dist/tui/components/editor.js +52 -58
- package/dist/tui/components/key-value.d.ts +3 -0
- package/dist/tui/components/key-value.js +16 -6
- package/dist/tui/components/loader.d.ts +37 -7
- package/dist/tui/components/loader.js +84 -21
- package/dist/tui/components/markdown.d.ts +5 -1
- package/dist/tui/components/markdown.js +45 -21
- package/dist/tui/components/meter.d.ts +3 -3
- package/dist/tui/components/meter.js +13 -11
- package/dist/tui/components/select-list.d.ts +23 -1
- package/dist/tui/components/select-list.js +76 -13
- package/dist/tui/glyphs.d.ts +68 -0
- package/dist/tui/glyphs.js +114 -0
- package/dist/tui/theme.d.ts +30 -6
- package/dist/tui/theme.js +103 -17
- package/dist/tui.d.ts +4 -2
- package/dist/tui.js +3 -1
- package/docs/codemode.md +23 -9
- package/docs/hooks.md +10 -10
- package/docs/permissions.md +148 -0
- package/docs/providers.md +33 -10
- package/docs/rpc.md +36 -36
- package/docs/session-format.md +2 -1
- package/docs/sessions.md +134 -0
- package/docs/tui.md +139 -62
- package/package.json +3 -1
|
@@ -4,8 +4,16 @@
|
|
|
4
4
|
* 键位走 `tui.select.*`:上下移动(循环)、翻页、确认(Enter / Tab)、取消(Esc / Ctrl+C)。
|
|
5
5
|
* `filterable` 时可打印字符追加到过滤词、退格删除;过滤为大小写不敏感的分词子串匹配
|
|
6
6
|
* (每个词都要出现在 label / value / group / description 之一中)。
|
|
7
|
+
*
|
|
8
|
+
* `badge` 靠右显示(如 `Default`、`Recommended`);`numberKeys` 时右侧标 1–9,按数字直接选中并确认;
|
|
9
|
+
* `stacked` 时说明换到标签下一行(缩进、暗色),适合「名字 + 一行说明」的短列表。
|
|
10
|
+
*
|
|
11
|
+
* 终端界面视觉设计 v1:选中行 `›` + `selection` 底色(< 256 色退化为 accent 粗体,stacked 时两行都上);
|
|
12
|
+
* `currentValue` 的项标 `✓`;`footer` 是列表下的一行按键提示(dim),`showCount` 时前面带 `(i/n)`
|
|
13
|
+
* (缺省只在超出一屏时带);过滤框提示符 `›`。字形取 `theme.glyphs`。
|
|
7
14
|
*/
|
|
8
15
|
import { padToWidth, truncateToWidth, visibleWidth } from "../ansi.js";
|
|
16
|
+
import { UNICODE_GLYPHS } from "../glyphs.js";
|
|
9
17
|
import { defaultKeybindings } from "../keybindings.js";
|
|
10
18
|
import { isPrintableText, matchesKey } from "../keys.js";
|
|
11
19
|
export function filterItems(items, filter) {
|
|
@@ -83,6 +91,14 @@ export class SelectList {
|
|
|
83
91
|
}
|
|
84
92
|
handleInput(data) {
|
|
85
93
|
const k = this.keys;
|
|
94
|
+
if (this.options.numberKeys === true && /^[1-9]$/.test(data)) {
|
|
95
|
+
const index = Number(data) - 1;
|
|
96
|
+
if (index < this.filtered.length) {
|
|
97
|
+
this.setSelectedIndex(index);
|
|
98
|
+
this.options.onSelect?.(this.filtered[index]);
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
86
102
|
if (k.matches(data, "tui.select.up"))
|
|
87
103
|
this.moveSelection(-1);
|
|
88
104
|
else if (k.matches(data, "tui.select.down"))
|
|
@@ -108,16 +124,23 @@ export class SelectList {
|
|
|
108
124
|
}
|
|
109
125
|
}
|
|
110
126
|
}
|
|
127
|
+
get glyphs() {
|
|
128
|
+
return this.options.theme?.glyphs ?? UNICODE_GLYPHS;
|
|
129
|
+
}
|
|
111
130
|
render(width) {
|
|
112
131
|
const theme = this.options.theme;
|
|
113
132
|
const dim = (s) => (theme ? theme.fg("dim", s) : s);
|
|
114
133
|
const lines = [];
|
|
115
134
|
if (this.options.filterable) {
|
|
116
|
-
const
|
|
135
|
+
const mark = `${this.glyphs.prompt} `;
|
|
136
|
+
const prompt = theme ? theme.fg("accent", mark) : mark;
|
|
117
137
|
lines.push(truncateToWidth(prompt + this.filter + (this.focused ? "▏" : ""), width));
|
|
118
138
|
}
|
|
119
139
|
if (this.filtered.length === 0) {
|
|
120
140
|
lines.push(truncateToWidth(dim(` ${this.options.emptyText ?? "(no matches)"}`), width));
|
|
141
|
+
if (this.options.footer !== undefined) {
|
|
142
|
+
lines.push(truncateToWidth(dim(this.options.footer), width));
|
|
143
|
+
}
|
|
121
144
|
return lines;
|
|
122
145
|
}
|
|
123
146
|
const end = Math.min(this.filtered.length, this.scrollTop + this.maxVisible);
|
|
@@ -129,27 +152,67 @@ export class SelectList {
|
|
|
129
152
|
lines.push(truncateToWidth(dim(item.group), width));
|
|
130
153
|
}
|
|
131
154
|
lastGroup = item.group;
|
|
132
|
-
lines.push(this.renderItem(item, i
|
|
155
|
+
lines.push(...this.renderItem(item, i, labelWidth, width));
|
|
133
156
|
}
|
|
134
|
-
|
|
135
|
-
|
|
157
|
+
const overflow = this.filtered.length > this.maxVisible;
|
|
158
|
+
const count = `(${this.selected + 1}/${this.filtered.length})`;
|
|
159
|
+
const footer = this.options.footer;
|
|
160
|
+
if (footer !== undefined) {
|
|
161
|
+
const withCount = this.options.showCount ?? overflow;
|
|
162
|
+
lines.push(truncateToWidth(dim(`${withCount ? `${count} ` : ""}${footer}`), width));
|
|
163
|
+
}
|
|
164
|
+
else if (overflow) {
|
|
165
|
+
lines.push(truncateToWidth(dim(` ${count}`), width));
|
|
136
166
|
}
|
|
137
167
|
return lines;
|
|
138
168
|
}
|
|
139
169
|
invalidate() { }
|
|
140
|
-
renderItem(item,
|
|
170
|
+
renderItem(item, index, labelWidth, width) {
|
|
141
171
|
const theme = this.options.theme;
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
|
|
172
|
+
const selected = index === this.selected;
|
|
173
|
+
const dim = (s) => (theme ? theme.fg("dim", s) : s);
|
|
174
|
+
const rightParts = [];
|
|
175
|
+
if (item.badge !== undefined && item.badge !== "") {
|
|
176
|
+
rightParts.push(theme ? theme.fg(item.badgeColor ?? "accent", item.badge) : item.badge);
|
|
177
|
+
}
|
|
178
|
+
if (this.options.numberKeys === true && index < 9)
|
|
179
|
+
rightParts.push(dim(String(index + 1)));
|
|
180
|
+
let right = rightParts.join(" ");
|
|
181
|
+
if (visibleWidth(right) > Math.max(0, width - 8))
|
|
182
|
+
right = "";
|
|
183
|
+
const rightWidth = right === "" ? 0 : visibleWidth(right) + 1;
|
|
184
|
+
const g = this.glyphs;
|
|
185
|
+
const current = this.options.currentValue;
|
|
186
|
+
const check = current === undefined
|
|
187
|
+
? ""
|
|
188
|
+
: item.value === current
|
|
189
|
+
? (theme ? theme.fg(selected ? "accent" : "success", g.check) : g.check) + " "
|
|
190
|
+
: " ";
|
|
191
|
+
const prefix = (selected ? `${g.prompt} ` : " ") + check;
|
|
192
|
+
const prefixWidth = visibleWidth(prefix);
|
|
193
|
+
const labelRoom = Math.max(1, width - prefixWidth - rightWidth);
|
|
194
|
+
const label = truncateToWidth(item.label, labelRoom);
|
|
195
|
+
let line = padToWidth(label, Math.min(labelWidth, labelRoom));
|
|
145
196
|
if (selected && theme)
|
|
146
197
|
line = theme.fg("accent", theme.bold(line));
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
198
|
+
line = (selected && theme ? theme.fg("accent", theme.bold(prefix)) : prefix) + line;
|
|
199
|
+
const stacked = this.options.stacked === true;
|
|
200
|
+
if (!stacked) {
|
|
201
|
+
const room = width - visibleWidth(line) - 2 - rightWidth;
|
|
202
|
+
if (item.description && room > 4) {
|
|
203
|
+
line += " " + dim(truncateToWidth(item.description, room));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (right !== "") {
|
|
207
|
+
line =
|
|
208
|
+
padToWidth(truncateToWidth(line, width - rightWidth), width - rightWidth) + " " + right;
|
|
209
|
+
}
|
|
210
|
+
const out = [truncateToWidth(line, width)];
|
|
211
|
+
if (stacked && item.description) {
|
|
212
|
+
const indent = " ".repeat(prefixWidth + 2);
|
|
213
|
+
out.push(truncateToWidth(`${indent}${dim(truncateToWidth(item.description, Math.max(1, width - indent.length)))}`, width));
|
|
151
214
|
}
|
|
152
|
-
return
|
|
215
|
+
return selected && theme ? out.map((l) => theme.bg("selection", l)) : out;
|
|
153
216
|
}
|
|
154
217
|
labelColumnWidth(end) {
|
|
155
218
|
let max = 0;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 字形表与 ASCII 回退(终端界面视觉设计 v1 §2.2)。
|
|
3
|
+
*
|
|
4
|
+
* 所有组件通过 `theme.glyphs` 取字形,不另加参数;`UNICODE_GLYPHS` 里每个字形都是 1 列宽
|
|
5
|
+
* (`codePointWidth` 判定,与 wcwidth 一致;个别字体把 `⏺` 画成两格时用 `AMA_ASCII=1`)。
|
|
6
|
+
*
|
|
7
|
+
* ASCII 触发:`ui.ascii: true` / `AMA_ASCII=1`,或自动检测——区域设置(`LC_ALL` > `LC_CTYPE` > `LANG`)
|
|
8
|
+
* 已设置但不含 UTF-8、`TERM=linux`、Windows 上 `WT_SESSION` 与 `TERM_PROGRAM` 都为空(旧 conhost)。
|
|
9
|
+
* `AMA_ASCII=0` 强制 Unicode。区域变量都没设时按 Unicode 处理(容器与 CI 里常见)。
|
|
10
|
+
*/
|
|
11
|
+
export interface BoxGlyphs {
|
|
12
|
+
readonly topLeft: string;
|
|
13
|
+
readonly topRight: string;
|
|
14
|
+
readonly bottomLeft: string;
|
|
15
|
+
readonly bottomRight: string;
|
|
16
|
+
readonly vertical: string;
|
|
17
|
+
readonly horizontal: string;
|
|
18
|
+
}
|
|
19
|
+
export interface Glyphs {
|
|
20
|
+
/** 是否 ASCII 回退表。 */
|
|
21
|
+
readonly ascii: boolean;
|
|
22
|
+
/** 用户消息、输入框提示符。 */
|
|
23
|
+
readonly prompt: string;
|
|
24
|
+
/** 工具调用标题。 */
|
|
25
|
+
readonly tool: string;
|
|
26
|
+
/** 结果连接符。 */
|
|
27
|
+
readonly result: string;
|
|
28
|
+
readonly ok: string;
|
|
29
|
+
readonly fail: string;
|
|
30
|
+
readonly warn: string;
|
|
31
|
+
/** 思考块、启动头标识。 */
|
|
32
|
+
readonly thinking: string;
|
|
33
|
+
/** 排队消息。 */
|
|
34
|
+
readonly queued: string;
|
|
35
|
+
/** 重试提示。 */
|
|
36
|
+
readonly retry: string;
|
|
37
|
+
/** Hook 阻止提示。 */
|
|
38
|
+
readonly blocked: string;
|
|
39
|
+
/** 左侧竖条卡片。 */
|
|
40
|
+
readonly card: string;
|
|
41
|
+
readonly expand: string;
|
|
42
|
+
readonly collapse: string;
|
|
43
|
+
/** 缓存保温。 */
|
|
44
|
+
readonly warm: string;
|
|
45
|
+
/** 当前项(选择器里打勾)。 */
|
|
46
|
+
readonly check: string;
|
|
47
|
+
/** 列表圆点(按嵌套深度循环)。 */
|
|
48
|
+
readonly bullets: readonly string[];
|
|
49
|
+
readonly meterFull: string;
|
|
50
|
+
readonly meterEmpty: string;
|
|
51
|
+
readonly box: BoxGlyphs;
|
|
52
|
+
/** 规则线(输入框上下、分隔线)。 */
|
|
53
|
+
readonly rule: string;
|
|
54
|
+
/** Loader 帧。 */
|
|
55
|
+
readonly spinner: readonly string[];
|
|
56
|
+
/** 静态 spinner(`ui.animation: false`)。 */
|
|
57
|
+
readonly spinnerStatic: string;
|
|
58
|
+
readonly ellipsis: string;
|
|
59
|
+
readonly arrowUp: string;
|
|
60
|
+
readonly arrowDown: string;
|
|
61
|
+
}
|
|
62
|
+
export declare const UNICODE_GLYPHS: Glyphs;
|
|
63
|
+
export declare const ASCII_GLYPHS: Glyphs;
|
|
64
|
+
/** 由环境判断是否用 ASCII 字形(`AMA_ASCII` 优先)。 */
|
|
65
|
+
export declare function detectAscii(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
|
|
66
|
+
/** 配置与环境合并:`AMA_ASCII` 显式值 > `ui.ascii` > 自动检测。 */
|
|
67
|
+
export declare function resolveAscii(configured: boolean | undefined, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
|
|
68
|
+
export declare function glyphsFor(ascii: boolean): Glyphs;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 字形表与 ASCII 回退(终端界面视觉设计 v1 §2.2)。
|
|
3
|
+
*
|
|
4
|
+
* 所有组件通过 `theme.glyphs` 取字形,不另加参数;`UNICODE_GLYPHS` 里每个字形都是 1 列宽
|
|
5
|
+
* (`codePointWidth` 判定,与 wcwidth 一致;个别字体把 `⏺` 画成两格时用 `AMA_ASCII=1`)。
|
|
6
|
+
*
|
|
7
|
+
* ASCII 触发:`ui.ascii: true` / `AMA_ASCII=1`,或自动检测——区域设置(`LC_ALL` > `LC_CTYPE` > `LANG`)
|
|
8
|
+
* 已设置但不含 UTF-8、`TERM=linux`、Windows 上 `WT_SESSION` 与 `TERM_PROGRAM` 都为空(旧 conhost)。
|
|
9
|
+
* `AMA_ASCII=0` 强制 Unicode。区域变量都没设时按 Unicode 处理(容器与 CI 里常见)。
|
|
10
|
+
*/
|
|
11
|
+
export const UNICODE_GLYPHS = {
|
|
12
|
+
ascii: false,
|
|
13
|
+
prompt: "›",
|
|
14
|
+
tool: "⏺",
|
|
15
|
+
result: "⎿",
|
|
16
|
+
ok: "✓",
|
|
17
|
+
fail: "✗",
|
|
18
|
+
warn: "!",
|
|
19
|
+
thinking: "✻",
|
|
20
|
+
queued: "↳",
|
|
21
|
+
retry: "↻",
|
|
22
|
+
blocked: "⛔",
|
|
23
|
+
card: "▎",
|
|
24
|
+
expand: "▸",
|
|
25
|
+
collapse: "▾",
|
|
26
|
+
warm: "♨",
|
|
27
|
+
check: "✓",
|
|
28
|
+
bullets: ["•", "◦", "▪"],
|
|
29
|
+
meterFull: "▮",
|
|
30
|
+
meterEmpty: "▯",
|
|
31
|
+
box: {
|
|
32
|
+
topLeft: "╭",
|
|
33
|
+
topRight: "╮",
|
|
34
|
+
bottomLeft: "╰",
|
|
35
|
+
bottomRight: "╯",
|
|
36
|
+
vertical: "│",
|
|
37
|
+
horizontal: "─",
|
|
38
|
+
},
|
|
39
|
+
rule: "─",
|
|
40
|
+
spinner: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
|
|
41
|
+
spinnerStatic: "·",
|
|
42
|
+
ellipsis: "…",
|
|
43
|
+
arrowUp: "↑",
|
|
44
|
+
arrowDown: "↓",
|
|
45
|
+
};
|
|
46
|
+
export const ASCII_GLYPHS = {
|
|
47
|
+
ascii: true,
|
|
48
|
+
prompt: ">",
|
|
49
|
+
tool: "*",
|
|
50
|
+
result: "L",
|
|
51
|
+
ok: "v",
|
|
52
|
+
fail: "x",
|
|
53
|
+
warn: "!",
|
|
54
|
+
thinking: "~",
|
|
55
|
+
queued: "->",
|
|
56
|
+
retry: "@",
|
|
57
|
+
blocked: "X",
|
|
58
|
+
card: "|",
|
|
59
|
+
expand: ">",
|
|
60
|
+
collapse: "v",
|
|
61
|
+
warm: "~",
|
|
62
|
+
check: "v",
|
|
63
|
+
bullets: ["-", "*", "+"],
|
|
64
|
+
meterFull: "#",
|
|
65
|
+
meterEmpty: ".",
|
|
66
|
+
box: {
|
|
67
|
+
topLeft: "+",
|
|
68
|
+
topRight: "+",
|
|
69
|
+
bottomLeft: "+",
|
|
70
|
+
bottomRight: "+",
|
|
71
|
+
vertical: "|",
|
|
72
|
+
horizontal: "-",
|
|
73
|
+
},
|
|
74
|
+
rule: "-",
|
|
75
|
+
spinner: ["-", "\\", "|", "/"],
|
|
76
|
+
spinnerStatic: ".",
|
|
77
|
+
ellipsis: "...",
|
|
78
|
+
arrowUp: "^",
|
|
79
|
+
arrowDown: "v",
|
|
80
|
+
};
|
|
81
|
+
function truthy(value) {
|
|
82
|
+
if (value === undefined || value === "")
|
|
83
|
+
return undefined;
|
|
84
|
+
const v = value.toLowerCase();
|
|
85
|
+
if (v === "1" || v === "true" || v === "yes" || v === "on")
|
|
86
|
+
return true;
|
|
87
|
+
if (v === "0" || v === "false" || v === "no" || v === "off")
|
|
88
|
+
return false;
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
/** 由环境判断是否用 ASCII 字形(`AMA_ASCII` 优先)。 */
|
|
92
|
+
export function detectAscii(env = process.env, platform = process.platform) {
|
|
93
|
+
const forced = truthy(env["AMA_ASCII"]);
|
|
94
|
+
if (forced !== undefined)
|
|
95
|
+
return forced;
|
|
96
|
+
const locale = env["LC_ALL"] || env["LC_CTYPE"] || env["LANG"] || "";
|
|
97
|
+
if (locale !== "" && !/utf-?8/i.test(locale))
|
|
98
|
+
return true;
|
|
99
|
+
if ((env["TERM"] ?? "") === "linux")
|
|
100
|
+
return true;
|
|
101
|
+
if (platform === "win32" && !env["WT_SESSION"] && !env["TERM_PROGRAM"])
|
|
102
|
+
return true;
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
/** 配置与环境合并:`AMA_ASCII` 显式值 > `ui.ascii` > 自动检测。 */
|
|
106
|
+
export function resolveAscii(configured, env = process.env, platform = process.platform) {
|
|
107
|
+
const forced = truthy(env["AMA_ASCII"]);
|
|
108
|
+
if (forced !== undefined)
|
|
109
|
+
return forced;
|
|
110
|
+
return configured ?? detectAscii(env, platform);
|
|
111
|
+
}
|
|
112
|
+
export function glyphsFor(ascii) {
|
|
113
|
+
return ascii ? ASCII_GLYPHS : UNICODE_GLYPHS;
|
|
114
|
+
}
|
package/dist/tui/theme.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 主题与颜色能力(设计 §12.7)。[B4]
|
|
3
3
|
*
|
|
4
|
-
* - `dark` / `light`
|
|
5
|
-
*
|
|
4
|
+
* - `dark` / `light` 两套语义色(14 个名字,终端界面视觉设计 v1 §2.1),以 24 位 RGB 定义;取值都落在
|
|
5
|
+
* xterm 256 色立方 / 灰阶上,所以 256 色回退无损。
|
|
6
|
+
* - 能力降级:truecolor → 256 色(6×6×6 立方 + 灰阶取近)→ 16 色(内置色板按 `THEME_ANSI16` 查表,
|
|
7
|
+
* 覆盖色按 xterm 缺省调色板取近)→ 无色。
|
|
8
|
+
* - `bg("selection")` 在 < 256 色时退化为 `accent` 粗体前景(16 色下底色太跳,且常留「尾巴」)。
|
|
6
9
|
* - `NO_COLOR`(非空)或 `TERM=dumb` → 无色;不探测终端背景(不发查询序列)。
|
|
7
10
|
* - 样式用各自的关闭码(39 / 49 / 22 / 23 / 24)而不是全重置,可以嵌套。
|
|
8
11
|
*/
|
|
@@ -10,6 +13,21 @@ import type { ColorDepth, SemanticColor, Theme, ThemeCapabilities } from "./comp
|
|
|
10
13
|
export type ThemeName = "dark" | "light";
|
|
11
14
|
type Rgb = readonly [number, number, number];
|
|
12
15
|
export declare const THEME_PALETTES: Record<ThemeName, Record<SemanticColor, string>>;
|
|
16
|
+
/**
|
|
17
|
+
* 16 色下的索引(xterm 0–15)。距离取近对饱和色不可靠(`#ff5f5f` 会落到灰 8),所以内置色板查表;
|
|
18
|
+
* `selection` 在 16 色下不作 bg,表里给前景兜底值。
|
|
19
|
+
*/
|
|
20
|
+
export declare const THEME_ANSI16: Record<ThemeName, Record<SemanticColor, number>>;
|
|
21
|
+
/** 阈值档位:≥ dangerAt error,≥ warnAt warning,否则 success(状态栏 ctx、Meter、/session 共用)。 */
|
|
22
|
+
export declare function levelColor(ratio: number, thresholds?: {
|
|
23
|
+
warnAt?: number;
|
|
24
|
+
dangerAt?: number;
|
|
25
|
+
}): SemanticColor;
|
|
26
|
+
/**
|
|
27
|
+
* `auto` → dark / light:不发查询序列,只看环境。`COLORFGBG` 的最后一段是背景色号(0–6、8 暗,
|
|
28
|
+
* 7、9–15 亮);没有时 Apple Terminal 按 dark;其余缺省 dark。只是猜,文档建议显式配置。
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveThemeName(name: ThemeName | "auto" | undefined, env?: NodeJS.ProcessEnv): ThemeName;
|
|
13
31
|
/** 由环境推断颜色深度。 */
|
|
14
32
|
export declare function detectColorDepth(env?: NodeJS.ProcessEnv, isTTY?: boolean): ColorDepth;
|
|
15
33
|
export declare function detectCapabilities(env?: NodeJS.ProcessEnv, isTTY?: boolean): ThemeCapabilities;
|
|
@@ -18,14 +36,20 @@ export declare function parseHex(hex: string): Rgb;
|
|
|
18
36
|
export declare function rgbTo256(rgb: Rgb): number;
|
|
19
37
|
/** RGB → 16 色索引(0–15)。 */
|
|
20
38
|
export declare function rgbTo16(rgb: Rgb): number;
|
|
21
|
-
/**
|
|
22
|
-
|
|
39
|
+
/**
|
|
40
|
+
* 生成前景 / 背景开启序列;depth 0 返回空串。`ansi16` 给定时 16 色下直接用它(内置色板查表)。
|
|
41
|
+
*/
|
|
42
|
+
export declare function colorCode(hex: string, depth: ColorDepth, background: boolean, ansi16?: number): string;
|
|
23
43
|
export interface CreateThemeOptions {
|
|
24
44
|
caps?: ThemeCapabilities;
|
|
25
45
|
/** 覆盖部分语义色(`#rrggbb`)。 */
|
|
26
46
|
overrides?: Partial<Record<SemanticColor, string>>;
|
|
47
|
+
/** ASCII 字形;缺省按环境检测(`detectAscii`)。 */
|
|
48
|
+
ascii?: boolean;
|
|
27
49
|
}
|
|
28
50
|
export declare function createTheme(name?: ThemeName, options?: CreateThemeOptions): Theme;
|
|
29
|
-
/** 无色主题(测试、line 模式、NO_COLOR
|
|
30
|
-
export declare function plainTheme(
|
|
51
|
+
/** 无色主题(测试、line 模式、NO_COLOR):所有方法原样返回文本;字形缺省 Unicode。 */
|
|
52
|
+
export declare function plainTheme(options?: {
|
|
53
|
+
ascii?: boolean;
|
|
54
|
+
}): Theme;
|
|
31
55
|
export {};
|
package/dist/tui/theme.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 主题与颜色能力(设计 §12.7)。[B4]
|
|
3
3
|
*
|
|
4
|
-
* - `dark` / `light`
|
|
5
|
-
*
|
|
4
|
+
* - `dark` / `light` 两套语义色(14 个名字,终端界面视觉设计 v1 §2.1),以 24 位 RGB 定义;取值都落在
|
|
5
|
+
* xterm 256 色立方 / 灰阶上,所以 256 色回退无损。
|
|
6
|
+
* - 能力降级:truecolor → 256 色(6×6×6 立方 + 灰阶取近)→ 16 色(内置色板按 `THEME_ANSI16` 查表,
|
|
7
|
+
* 覆盖色按 xterm 缺省调色板取近)→ 无色。
|
|
8
|
+
* - `bg("selection")` 在 < 256 色时退化为 `accent` 粗体前景(16 色下底色太跳,且常留「尾巴」)。
|
|
6
9
|
* - `NO_COLOR`(非空)或 `TERM=dumb` → 无色;不探测终端背景(不发查询序列)。
|
|
7
10
|
* - 样式用各自的关闭码(39 / 49 / 22 / 23 / 24)而不是全重置,可以嵌套。
|
|
8
11
|
*/
|
|
12
|
+
import { detectAscii, glyphsFor } from "./glyphs.js";
|
|
9
13
|
export const THEME_PALETTES = {
|
|
10
14
|
dark: {
|
|
11
15
|
text: "#e4e4e4",
|
|
12
|
-
|
|
16
|
+
muted: "#a8a8a8",
|
|
17
|
+
dim: "#6c6c6c",
|
|
13
18
|
accent: "#5fafff",
|
|
14
19
|
success: "#5fd787",
|
|
15
20
|
warning: "#ffd75f",
|
|
@@ -17,12 +22,15 @@ export const THEME_PALETTES = {
|
|
|
17
22
|
user: "#87afff",
|
|
18
23
|
assistant: "#e4e4e4",
|
|
19
24
|
tool: "#af87ff",
|
|
20
|
-
border: "#
|
|
25
|
+
border: "#585858",
|
|
21
26
|
code: "#ffaf5f",
|
|
27
|
+
link: "#87d7ff",
|
|
28
|
+
selection: "#303030",
|
|
22
29
|
},
|
|
23
30
|
light: {
|
|
24
31
|
text: "#1c1c1c",
|
|
25
|
-
|
|
32
|
+
muted: "#585858",
|
|
33
|
+
dim: "#8a8a8a",
|
|
26
34
|
accent: "#005fd7",
|
|
27
35
|
success: "#008700",
|
|
28
36
|
warning: "#af5f00",
|
|
@@ -30,10 +38,73 @@ export const THEME_PALETTES = {
|
|
|
30
38
|
user: "#005faf",
|
|
31
39
|
assistant: "#1c1c1c",
|
|
32
40
|
tool: "#8700af",
|
|
33
|
-
border: "#
|
|
41
|
+
border: "#bcbcbc",
|
|
34
42
|
code: "#875f00",
|
|
43
|
+
link: "#0087af",
|
|
44
|
+
selection: "#e4e4e4",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* 16 色下的索引(xterm 0–15)。距离取近对饱和色不可靠(`#ff5f5f` 会落到灰 8),所以内置色板查表;
|
|
49
|
+
* `selection` 在 16 色下不作 bg,表里给前景兜底值。
|
|
50
|
+
*/
|
|
51
|
+
export const THEME_ANSI16 = {
|
|
52
|
+
dark: {
|
|
53
|
+
text: 7,
|
|
54
|
+
muted: 7,
|
|
55
|
+
dim: 8,
|
|
56
|
+
accent: 12,
|
|
57
|
+
success: 10,
|
|
58
|
+
warning: 11,
|
|
59
|
+
error: 9,
|
|
60
|
+
user: 12,
|
|
61
|
+
assistant: 7,
|
|
62
|
+
tool: 13,
|
|
63
|
+
border: 8,
|
|
64
|
+
code: 11,
|
|
65
|
+
link: 14,
|
|
66
|
+
selection: 8,
|
|
67
|
+
},
|
|
68
|
+
light: {
|
|
69
|
+
text: 0,
|
|
70
|
+
muted: 8,
|
|
71
|
+
dim: 8,
|
|
72
|
+
accent: 4,
|
|
73
|
+
success: 2,
|
|
74
|
+
warning: 3,
|
|
75
|
+
error: 1,
|
|
76
|
+
user: 4,
|
|
77
|
+
assistant: 0,
|
|
78
|
+
tool: 5,
|
|
79
|
+
border: 7,
|
|
80
|
+
code: 3,
|
|
81
|
+
link: 6,
|
|
82
|
+
selection: 7,
|
|
35
83
|
},
|
|
36
84
|
};
|
|
85
|
+
/** 阈值档位:≥ dangerAt error,≥ warnAt warning,否则 success(状态栏 ctx、Meter、/session 共用)。 */
|
|
86
|
+
export function levelColor(ratio, thresholds = {}) {
|
|
87
|
+
if (ratio >= (thresholds.dangerAt ?? 0.9))
|
|
88
|
+
return "error";
|
|
89
|
+
if (ratio >= (thresholds.warnAt ?? 0.7))
|
|
90
|
+
return "warning";
|
|
91
|
+
return "success";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* `auto` → dark / light:不发查询序列,只看环境。`COLORFGBG` 的最后一段是背景色号(0–6、8 暗,
|
|
95
|
+
* 7、9–15 亮);没有时 Apple Terminal 按 dark;其余缺省 dark。只是猜,文档建议显式配置。
|
|
96
|
+
*/
|
|
97
|
+
export function resolveThemeName(name, env = process.env) {
|
|
98
|
+
if (name === "dark" || name === "light")
|
|
99
|
+
return name;
|
|
100
|
+
const colorfgbg = env["COLORFGBG"];
|
|
101
|
+
if (colorfgbg !== undefined && colorfgbg !== "") {
|
|
102
|
+
const bg = Number(colorfgbg.split(";").at(-1));
|
|
103
|
+
if (Number.isInteger(bg) && bg >= 0 && bg <= 15)
|
|
104
|
+
return bg === 7 || bg >= 9 ? "light" : "dark";
|
|
105
|
+
}
|
|
106
|
+
return "dark";
|
|
107
|
+
}
|
|
37
108
|
/** 由环境推断颜色深度。 */
|
|
38
109
|
export function detectColorDepth(env = process.env, isTTY = process.stdout.isTTY === true) {
|
|
39
110
|
if (env["NO_COLOR"] !== undefined && env["NO_COLOR"] !== "")
|
|
@@ -116,8 +187,10 @@ export function rgbTo16(rgb) {
|
|
|
116
187
|
}
|
|
117
188
|
return best;
|
|
118
189
|
}
|
|
119
|
-
/**
|
|
120
|
-
|
|
190
|
+
/**
|
|
191
|
+
* 生成前景 / 背景开启序列;depth 0 返回空串。`ansi16` 给定时 16 色下直接用它(内置色板查表)。
|
|
192
|
+
*/
|
|
193
|
+
export function colorCode(hex, depth, background, ansi16) {
|
|
121
194
|
if (depth === 0)
|
|
122
195
|
return "";
|
|
123
196
|
const rgb = parseHex(hex);
|
|
@@ -125,23 +198,25 @@ export function colorCode(hex, depth, background) {
|
|
|
125
198
|
return `\x1b[${background ? 48 : 38};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
126
199
|
if (depth === 256)
|
|
127
200
|
return `\x1b[${background ? 48 : 38};5;${rgbTo256(rgb)}m`;
|
|
128
|
-
const idx = rgbTo16(rgb);
|
|
201
|
+
const idx = ansi16 ?? rgbTo16(rgb);
|
|
129
202
|
const base = idx < 8 ? (background ? 40 : 30) + idx : (background ? 100 : 90) + idx - 8;
|
|
130
203
|
return `\x1b[${base}m`;
|
|
131
204
|
}
|
|
132
205
|
class PaletteTheme {
|
|
133
206
|
name;
|
|
134
207
|
caps;
|
|
208
|
+
glyphs;
|
|
135
209
|
fgCodes;
|
|
136
210
|
bgCodes;
|
|
137
|
-
constructor(name, palette, caps) {
|
|
211
|
+
constructor(name, palette, caps, glyphs, ansi16 = {}) {
|
|
138
212
|
this.name = name;
|
|
139
213
|
this.caps = caps;
|
|
214
|
+
this.glyphs = glyphs;
|
|
140
215
|
const fg = {};
|
|
141
216
|
const bg = {};
|
|
142
217
|
for (const key of Object.keys(palette)) {
|
|
143
|
-
fg[key] = colorCode(palette[key], caps.colors, false);
|
|
144
|
-
bg[key] = colorCode(palette[key], caps.colors, true);
|
|
218
|
+
fg[key] = colorCode(palette[key], caps.colors, false, ansi16[key]);
|
|
219
|
+
bg[key] = colorCode(palette[key], caps.colors, true, ansi16[key]);
|
|
145
220
|
}
|
|
146
221
|
this.fgCodes = fg;
|
|
147
222
|
this.bgCodes = bg;
|
|
@@ -151,6 +226,8 @@ class PaletteTheme {
|
|
|
151
226
|
return code === "" ? text : `${code}${text}\x1b[39m`;
|
|
152
227
|
}
|
|
153
228
|
bg(color, text) {
|
|
229
|
+
if (color === "selection" && this.caps.colors < 256)
|
|
230
|
+
return this.bold(this.fg("accent", text));
|
|
154
231
|
const code = this.bgCodes[color];
|
|
155
232
|
return code === "" ? text : `${code}${text}\x1b[49m`;
|
|
156
233
|
}
|
|
@@ -168,16 +245,25 @@ class PaletteTheme {
|
|
|
168
245
|
}
|
|
169
246
|
}
|
|
170
247
|
export function createTheme(name = "dark", options = {}) {
|
|
171
|
-
const
|
|
172
|
-
|
|
248
|
+
const overrides = options.overrides ?? {};
|
|
249
|
+
const palette = { ...THEME_PALETTES[name], ...overrides };
|
|
250
|
+
const ansi16 = { ...THEME_ANSI16[name] };
|
|
251
|
+
for (const key of Object.keys(overrides))
|
|
252
|
+
delete ansi16[key];
|
|
253
|
+
const glyphs = glyphsFor(options.ascii ?? detectAscii());
|
|
254
|
+
return new PaletteTheme(name, palette, options.caps ?? detectCapabilities(), glyphs, ansi16);
|
|
173
255
|
}
|
|
174
|
-
/** 无色主题(测试、line 模式、NO_COLOR
|
|
175
|
-
export function plainTheme() {
|
|
176
|
-
return new PlainTheme();
|
|
256
|
+
/** 无色主题(测试、line 模式、NO_COLOR):所有方法原样返回文本;字形缺省 Unicode。 */
|
|
257
|
+
export function plainTheme(options = {}) {
|
|
258
|
+
return new PlainTheme(glyphsFor(options.ascii === true));
|
|
177
259
|
}
|
|
178
260
|
class PlainTheme {
|
|
261
|
+
glyphs;
|
|
179
262
|
name = "plain";
|
|
180
263
|
caps = { colors: 0 };
|
|
264
|
+
constructor(glyphs) {
|
|
265
|
+
this.glyphs = glyphs;
|
|
266
|
+
}
|
|
181
267
|
fg(_color, text) {
|
|
182
268
|
return text;
|
|
183
269
|
}
|
package/dist/tui.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export { VirtualScreen, type ScreenModes } from "./tui/vt-screen.js";
|
|
|
13
13
|
export { StdinBuffer, defaultEscTimeout, type StdinBufferOptions } from "./tui/stdin-buffer.js";
|
|
14
14
|
export { parseKey, matchesKey, normalizeKeyId, isPasteData, unwrapPaste, isPrintableText, PASTE_START, PASTE_END, type KeyEvent, } from "./tui/keys.js";
|
|
15
15
|
export { visibleWidth, truncateToWidth, sliceByColumn, wrapTextWithAnsi, padToWidth, stripAnsi, codePointWidth, graphemeWidth, SGR_RESET, } from "./tui/ansi.js";
|
|
16
|
-
export { createTheme, plainTheme, detectCapabilities, detectColorDepth, colorCode, rgbTo256, rgbTo16, THEME_PALETTES, type ThemeName, type CreateThemeOptions, } from "./tui/theme.js";
|
|
16
|
+
export { createTheme, plainTheme, detectCapabilities, detectColorDepth, colorCode, rgbTo256, rgbTo16, THEME_PALETTES, THEME_ANSI16, resolveThemeName, levelColor, type ThemeName, type CreateThemeOptions, } from "./tui/theme.js";
|
|
17
|
+
export { UNICODE_GLYPHS, ASCII_GLYPHS, detectAscii, resolveAscii, glyphsFor, } from "./tui/glyphs.js";
|
|
17
18
|
export { Keybindings, defaultKeybindings, DEFAULT_KEYBINDINGS, parseKeybindings, loadKeybindingsFile, isActionId, type ActionId, type KeybindingOverrides, type ParsedKeybindings, } from "./tui/keybindings.js";
|
|
18
19
|
export { Container } from "./tui/components/container.js";
|
|
19
20
|
export { Text, TruncatedText, type TextOptions } from "./tui/components/text.js";
|
|
@@ -23,8 +24,9 @@ export { Editor, loadHistoryFile, type EditorOptions, type AutocompleteProvider,
|
|
|
23
24
|
export { PasteStore, shouldCollapse, formatMarker, PASTE_LINE_THRESHOLD, PASTE_CHAR_THRESHOLD, } from "./tui/components/editor-paste.js";
|
|
24
25
|
export { SelectList, filterItems, type SelectItem, type SelectListOptions, } from "./tui/components/select-list.js";
|
|
25
26
|
export { Box, type BoxOptions } from "./tui/components/box.js";
|
|
27
|
+
export { Card, type CardOptions } from "./tui/components/card.js";
|
|
26
28
|
export { Spacer } from "./tui/components/spacer.js";
|
|
27
|
-
export { Loader, LOADER_FRAMES, formatElapsed, type LoaderOptions, } from "./tui/components/loader.js";
|
|
29
|
+
export { Loader, LOADER_FRAMES, formatElapsed, type LoaderOptions, type LoaderVerbOptions, } from "./tui/components/loader.js";
|
|
28
30
|
export { compositeOverlays, type OverlayAnchor, type OverlayOptions, type OverlayLayer, } from "./tui/components/overlay.js";
|
|
29
31
|
export { KeyValue, type KeyValueRow, type KeyValueOptions } from "./tui/components/key-value.js";
|
|
30
32
|
export { Meter, METER_FULL, METER_EMPTY, type MeterOptions } from "./tui/components/meter.js";
|
package/dist/tui.js
CHANGED
|
@@ -13,7 +13,8 @@ export { VirtualScreen } from "./tui/vt-screen.js";
|
|
|
13
13
|
export { StdinBuffer, defaultEscTimeout } from "./tui/stdin-buffer.js";
|
|
14
14
|
export { parseKey, matchesKey, normalizeKeyId, isPasteData, unwrapPaste, isPrintableText, PASTE_START, PASTE_END, } from "./tui/keys.js";
|
|
15
15
|
export { visibleWidth, truncateToWidth, sliceByColumn, wrapTextWithAnsi, padToWidth, stripAnsi, codePointWidth, graphemeWidth, SGR_RESET, } from "./tui/ansi.js";
|
|
16
|
-
export { createTheme, plainTheme, detectCapabilities, detectColorDepth, colorCode, rgbTo256, rgbTo16, THEME_PALETTES, } from "./tui/theme.js";
|
|
16
|
+
export { createTheme, plainTheme, detectCapabilities, detectColorDepth, colorCode, rgbTo256, rgbTo16, THEME_PALETTES, THEME_ANSI16, resolveThemeName, levelColor, } from "./tui/theme.js";
|
|
17
|
+
export { UNICODE_GLYPHS, ASCII_GLYPHS, detectAscii, resolveAscii, glyphsFor, } from "./tui/glyphs.js";
|
|
17
18
|
export { Keybindings, defaultKeybindings, DEFAULT_KEYBINDINGS, parseKeybindings, loadKeybindingsFile, isActionId, } from "./tui/keybindings.js";
|
|
18
19
|
export { Container } from "./tui/components/container.js";
|
|
19
20
|
export { Text, TruncatedText } from "./tui/components/text.js";
|
|
@@ -23,6 +24,7 @@ export { Editor, loadHistoryFile, } from "./tui/components/editor.js";
|
|
|
23
24
|
export { PasteStore, shouldCollapse, formatMarker, PASTE_LINE_THRESHOLD, PASTE_CHAR_THRESHOLD, } from "./tui/components/editor-paste.js";
|
|
24
25
|
export { SelectList, filterItems, } from "./tui/components/select-list.js";
|
|
25
26
|
export { Box } from "./tui/components/box.js";
|
|
27
|
+
export { Card } from "./tui/components/card.js";
|
|
26
28
|
export { Spacer } from "./tui/components/spacer.js";
|
|
27
29
|
export { Loader, LOADER_FRAMES, formatElapsed, } from "./tui/components/loader.js";
|
|
28
30
|
export { compositeOverlays, } from "./tui/components/overlay.js";
|