@bubblebrain-ai/bubble 0.0.24 → 0.0.25
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/README.md +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.js +22 -6
- package/dist/goal/format.js +34 -4
- package/dist/goal/store.d.ts +3 -0
- package/dist/goal/store.js +14 -1
- package/dist/goal/usage.d.ts +2 -0
- package/dist/goal/usage.js +3 -0
- package/dist/main.js +23 -42
- package/dist/provider.js +20 -5
- package/dist/tui/detect-theme.d.ts +1 -0
- package/dist/tui/detect-theme.js +23 -0
- package/dist/tui/image-display.d.ts +13 -0
- package/dist/tui/image-display.js +49 -0
- package/dist/tui/input-history.d.ts +37 -6
- package/dist/tui/input-history.js +194 -23
- package/dist/tui/model-switch.d.ts +42 -0
- package/dist/tui/model-switch.js +55 -0
- package/dist/tui-ink/app.d.ts +32 -2
- package/dist/tui-ink/app.js +1360 -522
- package/dist/tui-ink/approval/select.js +10 -0
- package/dist/tui-ink/detect-theme.d.ts +1 -2
- package/dist/tui-ink/detect-theme.js +1 -87
- package/dist/tui-ink/display-history.d.ts +1 -0
- package/dist/tui-ink/display-history.js +11 -0
- package/dist/tui-ink/feedback-dialog.js +10 -0
- package/dist/tui-ink/feishu-setup-picker.js +10 -0
- package/dist/tui-ink/footer.d.ts +1 -0
- package/dist/tui-ink/footer.js +8 -2
- package/dist/tui-ink/input-box.d.ts +70 -9
- package/dist/tui-ink/input-box.js +354 -120
- package/dist/tui-ink/input-history.d.ts +1 -16
- package/dist/tui-ink/input-history.js +1 -79
- package/dist/tui-ink/input-queue.d.ts +12 -0
- package/dist/tui-ink/input-queue.js +17 -0
- package/dist/tui-ink/key-events.d.ts +9 -0
- package/dist/tui-ink/key-events.js +8 -0
- package/dist/tui-ink/markdown.js +1 -1
- package/dist/tui-ink/message-list.d.ts +3 -1
- package/dist/tui-ink/message-list.js +42 -24
- package/dist/tui-ink/model-picker.d.ts +24 -2
- package/dist/tui-ink/model-picker.js +224 -20
- package/dist/tui-ink/plan-confirm.js +10 -0
- package/dist/tui-ink/question-dialog.js +10 -0
- package/dist/tui-ink/run.d.ts +10 -1
- package/dist/tui-ink/run.js +21 -28
- package/dist/tui-ink/session-picker.js +3 -0
- package/dist/tui-ink/submit-dedupe.d.ts +5 -0
- package/dist/tui-ink/submit-dedupe.js +25 -0
- package/dist/tui-ink/terminal-mouse.d.ts +13 -1
- package/dist/tui-ink/terminal-mouse.js +63 -21
- package/dist/tui-ink/theme.d.ts +6 -3
- package/dist/tui-ink/theme.js +10 -4
- package/dist/tui-ink/transcript-input.d.ts +8 -0
- package/dist/tui-ink/transcript-input.js +9 -0
- package/dist/tui-ink/transcript-viewport-math.d.ts +1 -2
- package/dist/tui-ink/transcript-viewport-math.js +1 -2
- package/dist/tui-ink/welcome.d.ts +1 -0
- package/dist/tui-ink/welcome.js +25 -28
- package/package.json +1 -5
- package/dist/tui/clipboard.d.ts +0 -1
- package/dist/tui/clipboard.js +0 -53
- package/dist/tui/escape-confirmation.d.ts +0 -15
- package/dist/tui/escape-confirmation.js +0 -30
- package/dist/tui/global-key-router.d.ts +0 -3
- package/dist/tui/global-key-router.js +0 -87
- package/dist/tui/markdown-inline.d.ts +0 -22
- package/dist/tui/markdown-inline.js +0 -68
- package/dist/tui/markdown-theme-rules.d.ts +0 -23
- package/dist/tui/markdown-theme-rules.js +0 -164
- package/dist/tui/markdown-theme.d.ts +0 -5
- package/dist/tui/markdown-theme.js +0 -27
- package/dist/tui/opencode-spinner.d.ts +0 -22
- package/dist/tui/opencode-spinner.js +0 -216
- package/dist/tui/prompt-keybindings.d.ts +0 -42
- package/dist/tui/prompt-keybindings.js +0 -35
- package/dist/tui/render-signature.d.ts +0 -1
- package/dist/tui/render-signature.js +0 -7
- package/dist/tui/run.d.ts +0 -67
- package/dist/tui/run.js +0 -10166
- package/dist/tui/sidebar-mcp.d.ts +0 -31
- package/dist/tui/sidebar-mcp.js +0 -62
- package/dist/tui/sidebar-state.d.ts +0 -12
- package/dist/tui/sidebar-state.js +0 -69
- package/dist/tui/streaming-tool-args.d.ts +0 -15
- package/dist/tui/streaming-tool-args.js +0 -30
- package/dist/tui/tool-renderers/fallback.d.ts +0 -2
- package/dist/tui/tool-renderers/fallback.js +0 -75
- package/dist/tui/tool-renderers/registry.d.ts +0 -3
- package/dist/tui/tool-renderers/registry.js +0 -11
- package/dist/tui/tool-renderers/subagent.d.ts +0 -2
- package/dist/tui/tool-renderers/subagent.js +0 -135
- package/dist/tui/tool-renderers/types.d.ts +0 -36
- package/dist/tui/tool-renderers/types.js +0 -1
- package/dist/tui/tool-renderers/write-preview.d.ts +0 -12
- package/dist/tui/tool-renderers/write-preview.js +0 -32
- package/dist/tui/tool-renderers/write.d.ts +0 -6
- package/dist/tui/tool-renderers/write.js +0 -88
- package/dist/tui-opentui/app.d.ts +0 -54
- package/dist/tui-opentui/app.js +0 -1371
- package/dist/tui-opentui/approval/approval-dialog.d.ts +0 -15
- package/dist/tui-opentui/approval/approval-dialog.js +0 -155
- package/dist/tui-opentui/approval/diff-view.d.ts +0 -9
- package/dist/tui-opentui/approval/diff-view.js +0 -43
- package/dist/tui-opentui/approval/select.d.ts +0 -37
- package/dist/tui-opentui/approval/select.js +0 -91
- package/dist/tui-opentui/detect-theme.d.ts +0 -2
- package/dist/tui-opentui/detect-theme.js +0 -87
- package/dist/tui-opentui/display-history.d.ts +0 -56
- package/dist/tui-opentui/display-history.js +0 -130
- package/dist/tui-opentui/edit-diff.d.ts +0 -11
- package/dist/tui-opentui/edit-diff.js +0 -57
- package/dist/tui-opentui/feedback-dialog.d.ts +0 -21
- package/dist/tui-opentui/feedback-dialog.js +0 -164
- package/dist/tui-opentui/feishu-setup-picker.d.ts +0 -7
- package/dist/tui-opentui/feishu-setup-picker.js +0 -272
- package/dist/tui-opentui/file-mentions.d.ts +0 -29
- package/dist/tui-opentui/file-mentions.js +0 -174
- package/dist/tui-opentui/footer.d.ts +0 -26
- package/dist/tui-opentui/footer.js +0 -40
- package/dist/tui-opentui/image-paste.d.ts +0 -54
- package/dist/tui-opentui/image-paste.js +0 -288
- package/dist/tui-opentui/input-box.d.ts +0 -32
- package/dist/tui-opentui/input-box.js +0 -462
- package/dist/tui-opentui/input-history.d.ts +0 -16
- package/dist/tui-opentui/input-history.js +0 -79
- package/dist/tui-opentui/markdown.d.ts +0 -66
- package/dist/tui-opentui/markdown.js +0 -127
- package/dist/tui-opentui/message-list.d.ts +0 -31
- package/dist/tui-opentui/message-list.js +0 -131
- package/dist/tui-opentui/model-picker.d.ts +0 -63
- package/dist/tui-opentui/model-picker.js +0 -450
- package/dist/tui-opentui/plan-confirm.d.ts +0 -9
- package/dist/tui-opentui/plan-confirm.js +0 -124
- package/dist/tui-opentui/question-dialog.d.ts +0 -10
- package/dist/tui-opentui/question-dialog.js +0 -110
- package/dist/tui-opentui/recent-activity.d.ts +0 -8
- package/dist/tui-opentui/recent-activity.js +0 -71
- package/dist/tui-opentui/run-session-picker.d.ts +0 -10
- package/dist/tui-opentui/run-session-picker.js +0 -28
- package/dist/tui-opentui/run.d.ts +0 -38
- package/dist/tui-opentui/run.js +0 -48
- package/dist/tui-opentui/session-picker.d.ts +0 -12
- package/dist/tui-opentui/session-picker.js +0 -120
- package/dist/tui-opentui/theme.d.ts +0 -89
- package/dist/tui-opentui/theme.js +0 -157
- package/dist/tui-opentui/todos.d.ts +0 -9
- package/dist/tui-opentui/todos.js +0 -45
- package/dist/tui-opentui/trace-groups.d.ts +0 -27
- package/dist/tui-opentui/trace-groups.js +0 -455
- package/dist/tui-opentui/use-terminal-size.d.ts +0 -4
- package/dist/tui-opentui/use-terminal-size.js +0 -5
- package/dist/tui-opentui/welcome.d.ts +0 -25
- package/dist/tui-opentui/welcome.js +0 -77
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
export function buildMarkdownThemeRules(theme) {
|
|
2
|
-
return [
|
|
3
|
-
{
|
|
4
|
-
scope: ["default"],
|
|
5
|
-
style: {
|
|
6
|
-
foreground: theme.text,
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
scope: ["comment", "comment.documentation"],
|
|
11
|
-
style: {
|
|
12
|
-
foreground: theme.textMuted,
|
|
13
|
-
italic: true,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
scope: ["string", "symbol", "character", "character.special", "string.escape"],
|
|
18
|
-
style: {
|
|
19
|
-
foreground: theme.success,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
scope: ["number", "boolean", "constant", "float"],
|
|
24
|
-
style: {
|
|
25
|
-
foreground: theme.warning,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
scope: [
|
|
30
|
-
"keyword",
|
|
31
|
-
"keyword.import",
|
|
32
|
-
"keyword.return",
|
|
33
|
-
"keyword.conditional",
|
|
34
|
-
"keyword.repeat",
|
|
35
|
-
"keyword.coroutine",
|
|
36
|
-
"keyword.directive",
|
|
37
|
-
"keyword.modifier",
|
|
38
|
-
"keyword.exception",
|
|
39
|
-
"string.regexp",
|
|
40
|
-
],
|
|
41
|
-
style: {
|
|
42
|
-
foreground: theme.accent,
|
|
43
|
-
italic: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
scope: ["keyword.type", "type", "class", "module"],
|
|
48
|
-
style: {
|
|
49
|
-
foreground: theme.info,
|
|
50
|
-
bold: true,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
scope: ["function", "function.call", "function.method", "function.method.call", "constructor"],
|
|
55
|
-
style: {
|
|
56
|
-
foreground: theme.secondary,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
scope: ["variable", "variable.parameter", "variable.member", "property", "parameter"],
|
|
61
|
-
style: {
|
|
62
|
-
foreground: theme.text,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
scope: ["operator", "keyword.operator", "punctuation.delimiter", "punctuation.special"],
|
|
67
|
-
style: {
|
|
68
|
-
foreground: theme.info,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
scope: ["punctuation", "punctuation.bracket"],
|
|
73
|
-
style: {
|
|
74
|
-
foreground: theme.text,
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
scope: ["variable.builtin", "type.builtin", "function.builtin", "module.builtin", "constant.builtin", "variable.super"],
|
|
79
|
-
style: {
|
|
80
|
-
foreground: theme.error,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
scope: ["markup.heading", "markup.heading.1", "markup.heading.2", "markup.heading.3", "markup.heading.4", "markup.heading.5", "markup.heading.6"],
|
|
85
|
-
style: {
|
|
86
|
-
foreground: theme.text,
|
|
87
|
-
bold: true,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
scope: ["markup.bold", "markup.strong"],
|
|
92
|
-
style: {
|
|
93
|
-
foreground: theme.text,
|
|
94
|
-
bold: true,
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
scope: ["markup.italic"],
|
|
99
|
-
style: {
|
|
100
|
-
foreground: theme.warning,
|
|
101
|
-
italic: true,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
scope: ["markup.strikethrough"],
|
|
106
|
-
style: {
|
|
107
|
-
foreground: theme.textMuted,
|
|
108
|
-
dim: true,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
scope: ["markup.list"],
|
|
113
|
-
style: {
|
|
114
|
-
foreground: theme.secondary,
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
scope: ["markup.quote"],
|
|
119
|
-
style: {
|
|
120
|
-
foreground: theme.warning,
|
|
121
|
-
italic: true,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
scope: ["markup.raw", "markup.raw.block"],
|
|
126
|
-
style: {
|
|
127
|
-
foreground: theme.success,
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
scope: ["markup.raw.inline"],
|
|
132
|
-
style: {
|
|
133
|
-
foreground: theme.success,
|
|
134
|
-
background: theme.background,
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
scope: ["markup.link", "markup.link.url", "string.special.url"],
|
|
139
|
-
style: {
|
|
140
|
-
foreground: theme.secondary,
|
|
141
|
-
underline: true,
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
scope: ["markup.link.label", "label"],
|
|
146
|
-
style: {
|
|
147
|
-
foreground: theme.info,
|
|
148
|
-
underline: true,
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
scope: ["spell", "nospell"],
|
|
153
|
-
style: {
|
|
154
|
-
foreground: theme.text,
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
scope: ["conceal"],
|
|
159
|
-
style: {
|
|
160
|
-
foreground: theme.textMuted,
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
];
|
|
164
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { SyntaxStyle } from "@opentui/core";
|
|
2
|
-
import { type MarkdownThemePalette } from "./markdown-theme-rules.js";
|
|
3
|
-
export type { MarkdownThemePalette } from "./markdown-theme-rules.js";
|
|
4
|
-
export declare function createMarkdownSyntaxStyle(theme: MarkdownThemePalette): SyntaxStyle;
|
|
5
|
-
export declare function createSubtleMarkdownSyntaxStyle(theme: MarkdownThemePalette, opacity?: number): SyntaxStyle;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { SyntaxStyle } from "@opentui/core";
|
|
2
|
-
import { buildMarkdownThemeRules } from "./markdown-theme-rules.js";
|
|
3
|
-
export function createMarkdownSyntaxStyle(theme) {
|
|
4
|
-
return SyntaxStyle.fromTheme(buildMarkdownThemeRules(theme));
|
|
5
|
-
}
|
|
6
|
-
export function createSubtleMarkdownSyntaxStyle(theme, opacity = 0.6) {
|
|
7
|
-
const alpha = Math.max(0, Math.min(1, opacity));
|
|
8
|
-
return SyntaxStyle.fromTheme(buildMarkdownThemeRules(theme).map((rule) => ({
|
|
9
|
-
...rule,
|
|
10
|
-
style: {
|
|
11
|
-
...rule.style,
|
|
12
|
-
foreground: rule.style.foreground
|
|
13
|
-
? applyAlpha(rule.style.foreground, alpha)
|
|
14
|
-
: rule.style.foreground,
|
|
15
|
-
},
|
|
16
|
-
})));
|
|
17
|
-
}
|
|
18
|
-
function applyAlpha(color, opacity) {
|
|
19
|
-
if (!color.startsWith("#"))
|
|
20
|
-
return color;
|
|
21
|
-
const hex = color.slice(1);
|
|
22
|
-
if (hex.length !== 6 && hex.length !== 8)
|
|
23
|
-
return color;
|
|
24
|
-
const rgb = hex.slice(0, 6);
|
|
25
|
-
const alpha = Math.round(opacity * 255).toString(16).padStart(2, "0");
|
|
26
|
-
return `#${rgb}${alpha}`;
|
|
27
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ColorInput } from "@opentui/core";
|
|
2
|
-
import { RGBA } from "@opentui/core";
|
|
3
|
-
type ColorGenerator = (frameIndex: number, charIndex: number, totalFrames: number, totalChars: number) => ColorInput;
|
|
4
|
-
export declare function deriveTrailColors(brightColor: ColorInput, steps?: number): RGBA[];
|
|
5
|
-
export declare function deriveInactiveColor(brightColor: ColorInput, factor?: number): RGBA;
|
|
6
|
-
export type KnightRiderStyle = "blocks" | "diamonds";
|
|
7
|
-
export interface KnightRiderOptions {
|
|
8
|
-
width?: number;
|
|
9
|
-
style?: KnightRiderStyle;
|
|
10
|
-
holdStart?: number;
|
|
11
|
-
holdEnd?: number;
|
|
12
|
-
colors?: ColorInput[];
|
|
13
|
-
color?: ColorInput;
|
|
14
|
-
trailSteps?: number;
|
|
15
|
-
defaultColor?: ColorInput;
|
|
16
|
-
inactiveFactor?: number;
|
|
17
|
-
enableFading?: boolean;
|
|
18
|
-
minAlpha?: number;
|
|
19
|
-
}
|
|
20
|
-
export declare function createFrames(options?: KnightRiderOptions): string[];
|
|
21
|
-
export declare function createColors(options?: KnightRiderOptions): ColorGenerator;
|
|
22
|
-
export {};
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { RGBA } from "@opentui/core";
|
|
2
|
-
function getScannerState(frameIndex, totalChars, options) {
|
|
3
|
-
const { direction = "forward", holdFrames = {} } = options;
|
|
4
|
-
if (direction === "bidirectional") {
|
|
5
|
-
const forwardFrames = totalChars;
|
|
6
|
-
const holdEndFrames = holdFrames.end ?? 0;
|
|
7
|
-
const backwardFrames = totalChars - 1;
|
|
8
|
-
if (frameIndex < forwardFrames) {
|
|
9
|
-
return {
|
|
10
|
-
activePosition: frameIndex,
|
|
11
|
-
isHolding: false,
|
|
12
|
-
holdProgress: 0,
|
|
13
|
-
holdTotal: 0,
|
|
14
|
-
movementProgress: frameIndex,
|
|
15
|
-
movementTotal: forwardFrames,
|
|
16
|
-
isMovingForward: true,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
if (frameIndex < forwardFrames + holdEndFrames) {
|
|
20
|
-
return {
|
|
21
|
-
activePosition: totalChars - 1,
|
|
22
|
-
isHolding: true,
|
|
23
|
-
holdProgress: frameIndex - forwardFrames,
|
|
24
|
-
holdTotal: holdEndFrames,
|
|
25
|
-
movementProgress: 0,
|
|
26
|
-
movementTotal: 0,
|
|
27
|
-
isMovingForward: true,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
if (frameIndex < forwardFrames + holdEndFrames + backwardFrames) {
|
|
31
|
-
const backwardIndex = frameIndex - forwardFrames - holdEndFrames;
|
|
32
|
-
return {
|
|
33
|
-
activePosition: totalChars - 2 - backwardIndex,
|
|
34
|
-
isHolding: false,
|
|
35
|
-
holdProgress: 0,
|
|
36
|
-
holdTotal: 0,
|
|
37
|
-
movementProgress: backwardIndex,
|
|
38
|
-
movementTotal: backwardFrames,
|
|
39
|
-
isMovingForward: false,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
activePosition: 0,
|
|
44
|
-
isHolding: true,
|
|
45
|
-
holdProgress: frameIndex - forwardFrames - holdEndFrames - backwardFrames,
|
|
46
|
-
holdTotal: holdFrames.start ?? 0,
|
|
47
|
-
movementProgress: 0,
|
|
48
|
-
movementTotal: 0,
|
|
49
|
-
isMovingForward: false,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
if (direction === "backward") {
|
|
53
|
-
return {
|
|
54
|
-
activePosition: totalChars - 1 - (frameIndex % totalChars),
|
|
55
|
-
isHolding: false,
|
|
56
|
-
holdProgress: 0,
|
|
57
|
-
holdTotal: 0,
|
|
58
|
-
movementProgress: frameIndex % totalChars,
|
|
59
|
-
movementTotal: totalChars,
|
|
60
|
-
isMovingForward: false,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
activePosition: frameIndex % totalChars,
|
|
65
|
-
isHolding: false,
|
|
66
|
-
holdProgress: 0,
|
|
67
|
-
holdTotal: 0,
|
|
68
|
-
movementProgress: frameIndex % totalChars,
|
|
69
|
-
movementTotal: totalChars,
|
|
70
|
-
isMovingForward: true,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function calculateColorIndex(frameIndex, charIndex, totalChars, options, state) {
|
|
74
|
-
const { trailLength } = options;
|
|
75
|
-
const { activePosition, isHolding, holdProgress, isMovingForward } = state ?? getScannerState(frameIndex, totalChars, options);
|
|
76
|
-
const directionalDistance = isMovingForward
|
|
77
|
-
? activePosition - charIndex
|
|
78
|
-
: charIndex - activePosition;
|
|
79
|
-
if (isHolding)
|
|
80
|
-
return directionalDistance + holdProgress;
|
|
81
|
-
if (directionalDistance > 0 && directionalDistance < trailLength)
|
|
82
|
-
return directionalDistance;
|
|
83
|
-
if (directionalDistance === 0)
|
|
84
|
-
return 0;
|
|
85
|
-
return -1;
|
|
86
|
-
}
|
|
87
|
-
function createKnightRiderTrail(options) {
|
|
88
|
-
const { colors, defaultColor, enableFading = true, minAlpha = 0 } = options;
|
|
89
|
-
const defaultRgba = defaultColor instanceof RGBA ? defaultColor : RGBA.fromHex(defaultColor || "#000000");
|
|
90
|
-
const baseInactiveAlpha = defaultRgba.a;
|
|
91
|
-
let cachedFrameIndex = -1;
|
|
92
|
-
let cachedState = null;
|
|
93
|
-
return (frameIndex, charIndex, _totalFrames, totalChars) => {
|
|
94
|
-
if (frameIndex !== cachedFrameIndex) {
|
|
95
|
-
cachedFrameIndex = frameIndex;
|
|
96
|
-
cachedState = getScannerState(frameIndex, totalChars, options);
|
|
97
|
-
}
|
|
98
|
-
const state = cachedState;
|
|
99
|
-
const index = calculateColorIndex(frameIndex, charIndex, totalChars, options, state);
|
|
100
|
-
const { isHolding, holdProgress, holdTotal, movementProgress, movementTotal } = state;
|
|
101
|
-
let fadeFactor = 1.0;
|
|
102
|
-
if (enableFading) {
|
|
103
|
-
if (isHolding && holdTotal > 0) {
|
|
104
|
-
const progress = Math.min(holdProgress / holdTotal, 1);
|
|
105
|
-
fadeFactor = Math.max(minAlpha, 1 - progress * (1 - minAlpha));
|
|
106
|
-
}
|
|
107
|
-
else if (!isHolding && movementTotal > 0) {
|
|
108
|
-
const progress = Math.min(movementProgress / Math.max(1, movementTotal - 1), 1);
|
|
109
|
-
fadeFactor = minAlpha + progress * (1 - minAlpha);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
defaultRgba.a = baseInactiveAlpha * fadeFactor;
|
|
113
|
-
if (index === -1)
|
|
114
|
-
return defaultRgba;
|
|
115
|
-
return colors[index] ?? defaultRgba;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
export function deriveTrailColors(brightColor, steps = 6) {
|
|
119
|
-
const baseRgba = brightColor instanceof RGBA ? brightColor : RGBA.fromHex(brightColor);
|
|
120
|
-
const colors = [];
|
|
121
|
-
for (let i = 0; i < steps; i++) {
|
|
122
|
-
let alpha;
|
|
123
|
-
let brightnessFactor;
|
|
124
|
-
if (i === 0) {
|
|
125
|
-
alpha = 1.0;
|
|
126
|
-
brightnessFactor = 1.0;
|
|
127
|
-
}
|
|
128
|
-
else if (i === 1) {
|
|
129
|
-
alpha = 0.9;
|
|
130
|
-
brightnessFactor = 1.15;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
alpha = Math.pow(0.65, i - 1);
|
|
134
|
-
brightnessFactor = 1.0;
|
|
135
|
-
}
|
|
136
|
-
const r = Math.min(1.0, baseRgba.r * brightnessFactor);
|
|
137
|
-
const g = Math.min(1.0, baseRgba.g * brightnessFactor);
|
|
138
|
-
const b = Math.min(1.0, baseRgba.b * brightnessFactor);
|
|
139
|
-
colors.push(RGBA.fromValues(r, g, b, alpha));
|
|
140
|
-
}
|
|
141
|
-
return colors;
|
|
142
|
-
}
|
|
143
|
-
export function deriveInactiveColor(brightColor, factor = 0.2) {
|
|
144
|
-
const baseRgba = brightColor instanceof RGBA ? brightColor : RGBA.fromHex(brightColor);
|
|
145
|
-
return RGBA.fromValues(baseRgba.r, baseRgba.g, baseRgba.b, factor);
|
|
146
|
-
}
|
|
147
|
-
export function createFrames(options = {}) {
|
|
148
|
-
const width = options.width ?? 8;
|
|
149
|
-
const style = options.style ?? "diamonds";
|
|
150
|
-
const holdStart = options.holdStart ?? 30;
|
|
151
|
-
const holdEnd = options.holdEnd ?? 9;
|
|
152
|
-
const colors = options.colors ??
|
|
153
|
-
(options.color
|
|
154
|
-
? deriveTrailColors(options.color, options.trailSteps)
|
|
155
|
-
: [
|
|
156
|
-
RGBA.fromHex("#ff0000"),
|
|
157
|
-
RGBA.fromHex("#ff5555"),
|
|
158
|
-
RGBA.fromHex("#dd0000"),
|
|
159
|
-
RGBA.fromHex("#aa0000"),
|
|
160
|
-
RGBA.fromHex("#770000"),
|
|
161
|
-
RGBA.fromHex("#440000"),
|
|
162
|
-
]);
|
|
163
|
-
const defaultColor = options.defaultColor ??
|
|
164
|
-
(options.color ? deriveInactiveColor(options.color, options.inactiveFactor) : RGBA.fromHex("#330000"));
|
|
165
|
-
const trailOptions = {
|
|
166
|
-
colors,
|
|
167
|
-
trailLength: colors.length,
|
|
168
|
-
defaultColor,
|
|
169
|
-
direction: "bidirectional",
|
|
170
|
-
holdFrames: { start: holdStart, end: holdEnd },
|
|
171
|
-
enableFading: options.enableFading,
|
|
172
|
-
minAlpha: options.minAlpha,
|
|
173
|
-
};
|
|
174
|
-
const totalFrames = width + holdEnd + (width - 1) + holdStart;
|
|
175
|
-
return Array.from({ length: totalFrames }, (_, frameIndex) => {
|
|
176
|
-
return Array.from({ length: width }, (_, charIndex) => {
|
|
177
|
-
const index = calculateColorIndex(frameIndex, charIndex, width, trailOptions);
|
|
178
|
-
if (style === "diamonds") {
|
|
179
|
-
const shapes = ["⬥", "◆", "⬩", "⬪"];
|
|
180
|
-
if (index >= 0 && index < trailOptions.colors.length) {
|
|
181
|
-
return shapes[Math.min(index, shapes.length - 1)];
|
|
182
|
-
}
|
|
183
|
-
return "·";
|
|
184
|
-
}
|
|
185
|
-
const isActive = index >= 0 && index < trailOptions.colors.length;
|
|
186
|
-
return isActive ? "■" : "⬝";
|
|
187
|
-
}).join("");
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
export function createColors(options = {}) {
|
|
191
|
-
const holdStart = options.holdStart ?? 30;
|
|
192
|
-
const holdEnd = options.holdEnd ?? 9;
|
|
193
|
-
const colors = options.colors ??
|
|
194
|
-
(options.color
|
|
195
|
-
? deriveTrailColors(options.color, options.trailSteps)
|
|
196
|
-
: [
|
|
197
|
-
RGBA.fromHex("#ff0000"),
|
|
198
|
-
RGBA.fromHex("#ff5555"),
|
|
199
|
-
RGBA.fromHex("#dd0000"),
|
|
200
|
-
RGBA.fromHex("#aa0000"),
|
|
201
|
-
RGBA.fromHex("#770000"),
|
|
202
|
-
RGBA.fromHex("#440000"),
|
|
203
|
-
]);
|
|
204
|
-
const defaultColor = options.defaultColor ??
|
|
205
|
-
(options.color ? deriveInactiveColor(options.color, options.inactiveFactor) : RGBA.fromHex("#330000"));
|
|
206
|
-
const trailOptions = {
|
|
207
|
-
colors,
|
|
208
|
-
trailLength: colors.length,
|
|
209
|
-
defaultColor,
|
|
210
|
-
direction: "bidirectional",
|
|
211
|
-
holdFrames: { start: holdStart, end: holdEnd },
|
|
212
|
-
enableFading: options.enableFading,
|
|
213
|
-
minAlpha: options.minAlpha,
|
|
214
|
-
};
|
|
215
|
-
return createKnightRiderTrail(trailOptions);
|
|
216
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export declare const PROMPT_TEXTAREA_KEYBINDINGS: ({
|
|
2
|
-
name: string;
|
|
3
|
-
action: "submit";
|
|
4
|
-
shift?: undefined;
|
|
5
|
-
ctrl?: undefined;
|
|
6
|
-
meta?: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
name: string;
|
|
9
|
-
shift: true;
|
|
10
|
-
action: "newline";
|
|
11
|
-
ctrl?: undefined;
|
|
12
|
-
meta?: undefined;
|
|
13
|
-
} | {
|
|
14
|
-
name: string;
|
|
15
|
-
ctrl: true;
|
|
16
|
-
action: "newline";
|
|
17
|
-
shift?: undefined;
|
|
18
|
-
meta?: undefined;
|
|
19
|
-
} | {
|
|
20
|
-
name: string;
|
|
21
|
-
meta: true;
|
|
22
|
-
action: "newline";
|
|
23
|
-
shift?: undefined;
|
|
24
|
-
ctrl?: undefined;
|
|
25
|
-
} | {
|
|
26
|
-
name: string;
|
|
27
|
-
action: "newline";
|
|
28
|
-
shift?: undefined;
|
|
29
|
-
ctrl?: undefined;
|
|
30
|
-
meta?: undefined;
|
|
31
|
-
})[];
|
|
32
|
-
export declare function isModifiedEnterSequence(input: {
|
|
33
|
-
raw?: string;
|
|
34
|
-
sequence?: string;
|
|
35
|
-
}): boolean;
|
|
36
|
-
export declare function isModeCycleSequence(value?: string): boolean;
|
|
37
|
-
export declare function isEscapeSequence(value?: string): boolean;
|
|
38
|
-
export declare function isModeCycleKeyEvent(input: {
|
|
39
|
-
name?: string;
|
|
40
|
-
raw?: string;
|
|
41
|
-
sequence?: string;
|
|
42
|
-
}): boolean;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export const PROMPT_TEXTAREA_KEYBINDINGS = [
|
|
2
|
-
{ name: "return", action: "submit" },
|
|
3
|
-
{ name: "return", shift: true, action: "newline" },
|
|
4
|
-
{ name: "return", ctrl: true, action: "newline" },
|
|
5
|
-
{ name: "return", meta: true, action: "newline" },
|
|
6
|
-
{ name: "j", ctrl: true, action: "newline" },
|
|
7
|
-
{ name: "linefeed", action: "newline" },
|
|
8
|
-
];
|
|
9
|
-
export function isModifiedEnterSequence(input) {
|
|
10
|
-
const value = input.sequence || input.raw || "";
|
|
11
|
-
return /^\x1b\[13;[2-9]\d*[u~]$/.test(value)
|
|
12
|
-
|| /^\x1b\[27;[2-9]\d*;13~$/.test(value);
|
|
13
|
-
}
|
|
14
|
-
export function isModeCycleSequence(value) {
|
|
15
|
-
if (!value)
|
|
16
|
-
return false;
|
|
17
|
-
return value === "\t"
|
|
18
|
-
|| value === "\x1b[Z"
|
|
19
|
-
|| /^\x1b\[(?:9|57346);[12]u$/.test(value)
|
|
20
|
-
|| /^\x1b\[27;2;9~$/.test(value);
|
|
21
|
-
}
|
|
22
|
-
export function isEscapeSequence(value) {
|
|
23
|
-
if (!value)
|
|
24
|
-
return false;
|
|
25
|
-
return value === "\x1b"
|
|
26
|
-
|| /^\x1b\[(?:27|57344)(?:;[1-9]\d*(?::[1-3])?)?u$/.test(value)
|
|
27
|
-
|| /^\x1b\[27;[1-9]\d*(?::[1-3])?;(?:27|57344)~$/.test(value);
|
|
28
|
-
}
|
|
29
|
-
export function isModeCycleKeyEvent(input) {
|
|
30
|
-
const name = String(input.name || "").toLowerCase();
|
|
31
|
-
return name === "tab"
|
|
32
|
-
|| name === "backtab"
|
|
33
|
-
|| name === "shift+tab"
|
|
34
|
-
|| isModeCycleSequence(input.raw || input.sequence);
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function hashString(value: string): string;
|
package/dist/tui/run.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { type Agent } from "../agent.js";
|
|
2
|
-
import type { CliArgs } from "../cli.js";
|
|
3
|
-
import type { ThemeMode } from "../config.js";
|
|
4
|
-
import type { ExternalHookController } from "../hooks/controller.js";
|
|
5
|
-
import { SessionManager } from "../session.js";
|
|
6
|
-
import type { PlanDecision, Provider } from "../types.js";
|
|
7
|
-
import type { ProviderRegistry } from "../provider-registry.js";
|
|
8
|
-
import type { SkillRegistry } from "../skills/registry.js";
|
|
9
|
-
import { type LspService } from "../lsp/index.js";
|
|
10
|
-
import { type BashAllowlist } from "../approval/session-cache.js";
|
|
11
|
-
import type { SettingsManager } from "../permissions/settings.js";
|
|
12
|
-
import type { McpManager } from "../mcp/manager.js";
|
|
13
|
-
import type { GoalStore } from "../goal/store.js";
|
|
14
|
-
import type { ApprovalDecision, ApprovalRequest } from "../approval/types.js";
|
|
15
|
-
import type { QuestionController } from "../question/index.js";
|
|
16
|
-
import type { MemoryScope } from "../memory/index.js";
|
|
17
|
-
import type { ResolvedTheme } from "./detect-theme.js";
|
|
18
|
-
export interface PlanHandlerRef {
|
|
19
|
-
current?: (plan: string) => Promise<PlanDecision>;
|
|
20
|
-
}
|
|
21
|
-
export interface ApprovalHandlerRef {
|
|
22
|
-
current?: (req: ApprovalRequest) => Promise<ApprovalDecision>;
|
|
23
|
-
}
|
|
24
|
-
export interface RunTuiOptions {
|
|
25
|
-
sessionManager?: SessionManager;
|
|
26
|
-
createProvider?: (providerId: string, apiKey: string, baseURL: string) => Provider;
|
|
27
|
-
registry?: ProviderRegistry;
|
|
28
|
-
skillRegistry?: SkillRegistry;
|
|
29
|
-
planHandlerRef?: PlanHandlerRef;
|
|
30
|
-
approvalHandlerRef?: ApprovalHandlerRef;
|
|
31
|
-
questionController?: QuestionController;
|
|
32
|
-
bashAllowlist?: BashAllowlist;
|
|
33
|
-
settingsManager?: SettingsManager;
|
|
34
|
-
hookController?: ExternalHookController;
|
|
35
|
-
lspService?: LspService;
|
|
36
|
-
mcpManager?: McpManager;
|
|
37
|
-
goalStore?: GoalStore;
|
|
38
|
-
themeMode?: ThemeMode;
|
|
39
|
-
themeOverrides?: Record<string, string>;
|
|
40
|
-
detectedTheme?: ResolvedTheme;
|
|
41
|
-
onThemeModeChange?: (mode: ThemeMode) => void;
|
|
42
|
-
/** Legacy dark-palette overrides. Prefer themeOverrides for new callers. */
|
|
43
|
-
theme?: Record<string, string>;
|
|
44
|
-
flushMemory?: () => Promise<void>;
|
|
45
|
-
runMemoryCompaction?: () => Promise<string>;
|
|
46
|
-
runMemorySummary?: (scope?: MemoryScope) => Promise<string>;
|
|
47
|
-
runMemoryRefresh?: (scope?: MemoryScope) => Promise<string>;
|
|
48
|
-
/** One-line "update available" notice shown on the home screen, if any. */
|
|
49
|
-
updateNotice?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Background registry check started before the TUI. Resolves with a late
|
|
52
|
-
* "update available" notice (or null); the TUI surfaces it live — on the
|
|
53
|
-
* home screen when still there, otherwise as a composer notice.
|
|
54
|
-
*/
|
|
55
|
-
updateNoticeRefresh?: Promise<string | null>;
|
|
56
|
-
/**
|
|
57
|
-
* Swap the active session in place (driven by the /session picker).
|
|
58
|
-
* Rebinds persistence to the picked session file and replaces the agent's
|
|
59
|
-
* message history; the TUI rebuilds its transcript from the result.
|
|
60
|
-
*/
|
|
61
|
-
switchSession?: (sessionFile: string) => {
|
|
62
|
-
manager: SessionManager;
|
|
63
|
-
} | {
|
|
64
|
-
error: string;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
export declare function runTui(agent: Agent, args: CliArgs, options?: RunTuiOptions): Promise<void>;
|