@bubblebrain-ai/bubble 0.0.1 → 0.0.2
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/dist/agent.d.ts +8 -1
- package/dist/agent.js +45 -6
- package/dist/approval/controller.d.ts +3 -3
- package/dist/approval/controller.js +5 -5
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +2 -3
- package/dist/main.js +1 -3
- package/dist/permission/mode.d.ts +3 -7
- package/dist/permission/mode.js +7 -11
- package/dist/permissions/settings.js +3 -4
- package/dist/prompt/reminders.d.ts +1 -0
- package/dist/prompt/reminders.js +10 -16
- package/dist/provider-openai-codex.js +2 -0
- package/dist/provider.js +6 -2
- package/dist/slash-commands/commands.js +2 -23
- package/dist/slash-commands/types.d.ts +1 -1
- package/dist/tools/bash.js +30 -3
- package/dist/tui/clipboard.d.ts +1 -0
- package/dist/tui/clipboard.js +53 -0
- package/dist/tui/global-key-router.d.ts +3 -0
- package/dist/tui/global-key-router.js +87 -0
- package/dist/tui/prompt-keybindings.d.ts +1 -0
- package/dist/tui/prompt-keybindings.js +7 -0
- package/dist/tui/run.d.ts +1 -2
- package/dist/tui/run.js +679 -194
- package/dist/types.d.ts +5 -5
- package/package.json +2 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { isEscapeSequence } from "./prompt-keybindings.js";
|
|
2
|
+
export function normalizeKeyName(name) {
|
|
3
|
+
const rawName = String(name || "").toLowerCase();
|
|
4
|
+
if (["arrowleft", "left_arrow", "leftarrow", "cursorleft", "left"].includes(rawName))
|
|
5
|
+
return "left";
|
|
6
|
+
if (["arrowright", "right_arrow", "rightarrow", "cursorright", "right"].includes(rawName))
|
|
7
|
+
return "right";
|
|
8
|
+
if (["arrowup", "up_arrow", "uparrow", "cursorup", "up"].includes(rawName))
|
|
9
|
+
return "up";
|
|
10
|
+
if (["arrowdown", "down_arrow", "downarrow", "cursordown", "down"].includes(rawName))
|
|
11
|
+
return "down";
|
|
12
|
+
if (rawName === "return" || rawName === "enter")
|
|
13
|
+
return "enter";
|
|
14
|
+
if (rawName === "esc" || rawName === "escape")
|
|
15
|
+
return "escape";
|
|
16
|
+
if (rawName === "tab")
|
|
17
|
+
return "tab";
|
|
18
|
+
return rawName;
|
|
19
|
+
}
|
|
20
|
+
export function keyNameFromSequence(sequence) {
|
|
21
|
+
if (!sequence)
|
|
22
|
+
return "";
|
|
23
|
+
const kittyName = keyNameFromKittySequence(sequence);
|
|
24
|
+
if (kittyName)
|
|
25
|
+
return kittyName;
|
|
26
|
+
if (sequence === "\x1b[D" || /^\x1b\[[0-9;]*D$/.test(sequence))
|
|
27
|
+
return "left";
|
|
28
|
+
if (sequence === "\x1b[C" || /^\x1b\[[0-9;]*C$/.test(sequence))
|
|
29
|
+
return "right";
|
|
30
|
+
if (sequence === "\x1b[A" || /^\x1b\[[0-9;]*A$/.test(sequence))
|
|
31
|
+
return "up";
|
|
32
|
+
if (sequence === "\x1b[B" || /^\x1b\[[0-9;]*B$/.test(sequence))
|
|
33
|
+
return "down";
|
|
34
|
+
if (sequence === "\x1bOD")
|
|
35
|
+
return "left";
|
|
36
|
+
if (sequence === "\x1bOC")
|
|
37
|
+
return "right";
|
|
38
|
+
if (sequence === "\x1bOA")
|
|
39
|
+
return "up";
|
|
40
|
+
if (sequence === "\x1bOB")
|
|
41
|
+
return "down";
|
|
42
|
+
if (sequence === "\t")
|
|
43
|
+
return "tab";
|
|
44
|
+
if (sequence === "\r" || sequence === "\n")
|
|
45
|
+
return "enter";
|
|
46
|
+
if (isEscapeSequence(sequence))
|
|
47
|
+
return "escape";
|
|
48
|
+
return "";
|
|
49
|
+
}
|
|
50
|
+
function keyNameFromKittySequence(sequence) {
|
|
51
|
+
const kittyMatch = /^\x1b\[(\d+)(?:;[1-9]\d*(?::[1-3])?)?u$/.exec(sequence);
|
|
52
|
+
const kittyCode = kittyMatch?.[1] ? Number(kittyMatch[1]) : NaN;
|
|
53
|
+
if (!Number.isNaN(kittyCode))
|
|
54
|
+
return keyNameFromKittyCode(kittyCode);
|
|
55
|
+
const modifyOtherKeysMatch = /^\x1b\[27;[1-9]\d*(?::[1-3])?;(\d+)~$/.exec(sequence);
|
|
56
|
+
const modifyOtherKeysCode = modifyOtherKeysMatch?.[1] ? Number(modifyOtherKeysMatch[1]) : NaN;
|
|
57
|
+
if (!Number.isNaN(modifyOtherKeysCode))
|
|
58
|
+
return keyNameFromKittyCode(modifyOtherKeysCode);
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
function keyNameFromKittyCode(code) {
|
|
62
|
+
switch (code) {
|
|
63
|
+
case 27:
|
|
64
|
+
case 57344:
|
|
65
|
+
return "escape";
|
|
66
|
+
case 9:
|
|
67
|
+
case 57346:
|
|
68
|
+
return "tab";
|
|
69
|
+
case 13:
|
|
70
|
+
case 57345:
|
|
71
|
+
return "enter";
|
|
72
|
+
case 57350:
|
|
73
|
+
return "left";
|
|
74
|
+
case 57351:
|
|
75
|
+
return "right";
|
|
76
|
+
case 57352:
|
|
77
|
+
return "up";
|
|
78
|
+
case 57353:
|
|
79
|
+
return "down";
|
|
80
|
+
default:
|
|
81
|
+
return "";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export function keyNameFromEvent(event) {
|
|
85
|
+
const rawName = normalizeKeyName(event?.name || event?.key || event?.input);
|
|
86
|
+
return rawName || keyNameFromSequence(event?.raw || event?.sequence);
|
|
87
|
+
}
|
|
@@ -34,6 +34,7 @@ export declare function isModifiedEnterSequence(input: {
|
|
|
34
34
|
sequence?: string;
|
|
35
35
|
}): boolean;
|
|
36
36
|
export declare function isModeCycleSequence(value?: string): boolean;
|
|
37
|
+
export declare function isEscapeSequence(value?: string): boolean;
|
|
37
38
|
export declare function isModeCycleKeyEvent(input: {
|
|
38
39
|
name?: string;
|
|
39
40
|
raw?: string;
|
|
@@ -19,6 +19,13 @@ export function isModeCycleSequence(value) {
|
|
|
19
19
|
|| /^\x1b\[(?:9|57346);[12]u$/.test(value)
|
|
20
20
|
|| /^\x1b\[27;2;9~$/.test(value);
|
|
21
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
|
+
}
|
|
22
29
|
export function isModeCycleKeyEvent(input) {
|
|
23
30
|
const name = String(input.name || "").toLowerCase();
|
|
24
31
|
return name === "tab"
|
package/dist/tui/run.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Agent } from "../agent.js";
|
|
2
2
|
import type { CliArgs } from "../cli.js";
|
|
3
3
|
import type { SessionManager } from "../session.js";
|
|
4
4
|
import type { PlanDecision, Provider } from "../types.js";
|
|
@@ -29,7 +29,6 @@ export interface RunTuiOptions {
|
|
|
29
29
|
settingsManager?: SettingsManager;
|
|
30
30
|
lspService?: LspService;
|
|
31
31
|
mcpManager?: McpManager;
|
|
32
|
-
bypassEnabled?: boolean;
|
|
33
32
|
theme?: Record<string, string>;
|
|
34
33
|
flushMemory?: () => Promise<void>;
|
|
35
34
|
runMemoryCompaction?: () => Promise<string>;
|