@aexol/spectral 0.7.6 → 0.7.8
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/index.js +16 -140
- package/dist/cli.js +25 -220
- package/dist/extensions/spectral-vision-fallback.js +188 -0
- package/dist/memory/commands/status.js +5 -5
- package/dist/memory/commands/view.js +16 -14
- package/dist/memory/compaction.js +31 -3
- package/dist/memory/prompts.js +5 -5
- package/dist/memory/tools/recall-observation.js +2 -2
- package/dist/pi/coding-agent/config.js +0 -11
- package/dist/pi/coding-agent/core/agent-session.js +3 -17
- package/dist/pi/coding-agent/core/extensions/loader.js +0 -6
- package/dist/pi/coding-agent/core/extensions/runner.js +7 -1
- package/dist/pi/coding-agent/core/keybindings.js +129 -2
- package/dist/pi/coding-agent/core/settings-manager.js +20 -0
- package/dist/pi/coding-agent/core/tools/bash.js +17 -63
- package/dist/pi/coding-agent/core/tools/edit.js +4 -141
- package/dist/pi/coding-agent/core/tools/find.js +0 -11
- package/dist/pi/coding-agent/core/tools/grep.js +0 -11
- package/dist/pi/coding-agent/core/tools/ls.js +0 -11
- package/dist/pi/coding-agent/core/tools/read.js +0 -12
- package/dist/pi/coding-agent/core/tools/render-utils.js +1 -14
- package/dist/pi/coding-agent/core/tools/write.js +2 -97
- package/dist/pi/coding-agent/modes/interactive/components/keybinding-hints.js +1 -1
- package/dist/pi/coding-agent/modes/interactive/components/visual-truncate.js +6 -12
- package/dist/pi/coding-agent/modes/interactive/theme/theme.js +1 -2
- package/dist/relay/models-fetch.js +13 -1
- package/dist/server/pi-bridge.js +57 -4
- package/dist/server/session-stream.js +7 -1
- package/package.json +1 -1
- package/dist/pi/coding-agent/core/export-html/ansi-to-html.js +0 -248
- package/dist/pi/coding-agent/core/export-html/index.js +0 -225
- package/dist/pi/coding-agent/core/export-html/tool-renderer.js +0 -107
- package/dist/pi/tui/autocomplete.js +0 -631
- package/dist/pi/tui/components/box.js +0 -103
- package/dist/pi/tui/components/cancellable-loader.js +0 -34
- package/dist/pi/tui/components/editor.js +0 -1915
- package/dist/pi/tui/components/image.js +0 -88
- package/dist/pi/tui/components/input.js +0 -425
- package/dist/pi/tui/components/loader.js +0 -68
- package/dist/pi/tui/components/markdown.js +0 -633
- package/dist/pi/tui/components/select-list.js +0 -158
- package/dist/pi/tui/components/settings-list.js +0 -184
- package/dist/pi/tui/components/spacer.js +0 -22
- package/dist/pi/tui/components/text.js +0 -88
- package/dist/pi/tui/components/truncated-text.js +0 -50
- package/dist/pi/tui/editor-component.js +0 -1
- package/dist/pi/tui/fuzzy.js +0 -109
- package/dist/pi/tui/index.js +0 -31
- package/dist/pi/tui/keybindings.js +0 -173
- package/dist/pi/tui/keys.js +0 -1172
- package/dist/pi/tui/kill-ring.js +0 -43
- package/dist/pi/tui/stdin-buffer.js +0 -360
- package/dist/pi/tui/terminal-image.js +0 -335
- package/dist/pi/tui/terminal.js +0 -324
- package/dist/pi/tui/tui.js +0 -1076
- package/dist/pi/tui/undo-stack.js +0 -24
- package/dist/pi/tui/utils.js +0 -1016
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { matchesKey } from "./keys.js";
|
|
2
|
-
export const TUI_KEYBINDINGS = {
|
|
3
|
-
"tui.editor.cursorUp": { defaultKeys: "up", description: "Move cursor up" },
|
|
4
|
-
"tui.editor.cursorDown": { defaultKeys: "down", description: "Move cursor down" },
|
|
5
|
-
"tui.editor.cursorLeft": {
|
|
6
|
-
defaultKeys: ["left", "ctrl+b"],
|
|
7
|
-
description: "Move cursor left",
|
|
8
|
-
},
|
|
9
|
-
"tui.editor.cursorRight": {
|
|
10
|
-
defaultKeys: ["right", "ctrl+f"],
|
|
11
|
-
description: "Move cursor right",
|
|
12
|
-
},
|
|
13
|
-
"tui.editor.cursorWordLeft": {
|
|
14
|
-
defaultKeys: ["alt+left", "ctrl+left", "alt+b"],
|
|
15
|
-
description: "Move cursor word left",
|
|
16
|
-
},
|
|
17
|
-
"tui.editor.cursorWordRight": {
|
|
18
|
-
defaultKeys: ["alt+right", "ctrl+right", "alt+f"],
|
|
19
|
-
description: "Move cursor word right",
|
|
20
|
-
},
|
|
21
|
-
"tui.editor.cursorLineStart": {
|
|
22
|
-
defaultKeys: ["home", "ctrl+a"],
|
|
23
|
-
description: "Move to line start",
|
|
24
|
-
},
|
|
25
|
-
"tui.editor.cursorLineEnd": {
|
|
26
|
-
defaultKeys: ["end", "ctrl+e"],
|
|
27
|
-
description: "Move to line end",
|
|
28
|
-
},
|
|
29
|
-
"tui.editor.jumpForward": {
|
|
30
|
-
defaultKeys: "ctrl+]",
|
|
31
|
-
description: "Jump forward to character",
|
|
32
|
-
},
|
|
33
|
-
"tui.editor.jumpBackward": {
|
|
34
|
-
defaultKeys: "ctrl+alt+]",
|
|
35
|
-
description: "Jump backward to character",
|
|
36
|
-
},
|
|
37
|
-
"tui.editor.pageUp": { defaultKeys: "pageUp", description: "Page up" },
|
|
38
|
-
"tui.editor.pageDown": { defaultKeys: "pageDown", description: "Page down" },
|
|
39
|
-
"tui.editor.deleteCharBackward": {
|
|
40
|
-
defaultKeys: "backspace",
|
|
41
|
-
description: "Delete character backward",
|
|
42
|
-
},
|
|
43
|
-
"tui.editor.deleteCharForward": {
|
|
44
|
-
defaultKeys: ["delete", "ctrl+d"],
|
|
45
|
-
description: "Delete character forward",
|
|
46
|
-
},
|
|
47
|
-
"tui.editor.deleteWordBackward": {
|
|
48
|
-
defaultKeys: ["ctrl+w", "alt+backspace"],
|
|
49
|
-
description: "Delete word backward",
|
|
50
|
-
},
|
|
51
|
-
"tui.editor.deleteWordForward": {
|
|
52
|
-
defaultKeys: ["alt+d", "alt+delete"],
|
|
53
|
-
description: "Delete word forward",
|
|
54
|
-
},
|
|
55
|
-
"tui.editor.deleteToLineStart": {
|
|
56
|
-
defaultKeys: "ctrl+u",
|
|
57
|
-
description: "Delete to line start",
|
|
58
|
-
},
|
|
59
|
-
"tui.editor.deleteToLineEnd": {
|
|
60
|
-
defaultKeys: "ctrl+k",
|
|
61
|
-
description: "Delete to line end",
|
|
62
|
-
},
|
|
63
|
-
"tui.editor.yank": { defaultKeys: "ctrl+y", description: "Yank" },
|
|
64
|
-
"tui.editor.yankPop": { defaultKeys: "alt+y", description: "Yank pop" },
|
|
65
|
-
"tui.editor.undo": { defaultKeys: "ctrl+-", description: "Undo" },
|
|
66
|
-
"tui.input.newLine": { defaultKeys: "shift+enter", description: "Insert newline" },
|
|
67
|
-
"tui.input.submit": { defaultKeys: "enter", description: "Submit input" },
|
|
68
|
-
"tui.input.tab": { defaultKeys: "tab", description: "Tab / autocomplete" },
|
|
69
|
-
"tui.input.copy": { defaultKeys: "ctrl+c", description: "Copy selection" },
|
|
70
|
-
"tui.select.up": { defaultKeys: "up", description: "Move selection up" },
|
|
71
|
-
"tui.select.down": { defaultKeys: "down", description: "Move selection down" },
|
|
72
|
-
"tui.select.pageUp": { defaultKeys: "pageUp", description: "Selection page up" },
|
|
73
|
-
"tui.select.pageDown": {
|
|
74
|
-
defaultKeys: "pageDown",
|
|
75
|
-
description: "Selection page down",
|
|
76
|
-
},
|
|
77
|
-
"tui.select.confirm": { defaultKeys: "enter", description: "Confirm selection" },
|
|
78
|
-
"tui.select.cancel": {
|
|
79
|
-
defaultKeys: ["escape", "ctrl+c"],
|
|
80
|
-
description: "Cancel selection",
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
function normalizeKeys(keys) {
|
|
84
|
-
if (keys === undefined)
|
|
85
|
-
return [];
|
|
86
|
-
const keyList = Array.isArray(keys) ? keys : [keys];
|
|
87
|
-
const seen = new Set();
|
|
88
|
-
const result = [];
|
|
89
|
-
for (const key of keyList) {
|
|
90
|
-
if (!seen.has(key)) {
|
|
91
|
-
seen.add(key);
|
|
92
|
-
result.push(key);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
export class KeybindingsManager {
|
|
98
|
-
definitions;
|
|
99
|
-
userBindings;
|
|
100
|
-
keysById = new Map();
|
|
101
|
-
conflicts = [];
|
|
102
|
-
constructor(definitions, userBindings = {}) {
|
|
103
|
-
this.definitions = definitions;
|
|
104
|
-
this.userBindings = userBindings;
|
|
105
|
-
this.rebuild();
|
|
106
|
-
}
|
|
107
|
-
rebuild() {
|
|
108
|
-
this.keysById.clear();
|
|
109
|
-
this.conflicts = [];
|
|
110
|
-
const userClaims = new Map();
|
|
111
|
-
for (const [keybinding, keys] of Object.entries(this.userBindings)) {
|
|
112
|
-
if (!(keybinding in this.definitions))
|
|
113
|
-
continue;
|
|
114
|
-
for (const key of normalizeKeys(keys)) {
|
|
115
|
-
const claimants = userClaims.get(key) ?? new Set();
|
|
116
|
-
claimants.add(keybinding);
|
|
117
|
-
userClaims.set(key, claimants);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
for (const [key, keybindings] of userClaims) {
|
|
121
|
-
if (keybindings.size > 1) {
|
|
122
|
-
this.conflicts.push({ key, keybindings: [...keybindings] });
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
for (const [id, definition] of Object.entries(this.definitions)) {
|
|
126
|
-
const userKeys = this.userBindings[id];
|
|
127
|
-
const keys = userKeys === undefined ? normalizeKeys(definition.defaultKeys) : normalizeKeys(userKeys);
|
|
128
|
-
this.keysById.set(id, keys);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
matches(data, keybinding) {
|
|
132
|
-
const keys = this.keysById.get(keybinding) ?? [];
|
|
133
|
-
for (const key of keys) {
|
|
134
|
-
if (matchesKey(data, key))
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
getKeys(keybinding) {
|
|
140
|
-
return [...(this.keysById.get(keybinding) ?? [])];
|
|
141
|
-
}
|
|
142
|
-
getDefinition(keybinding) {
|
|
143
|
-
return this.definitions[keybinding];
|
|
144
|
-
}
|
|
145
|
-
getConflicts() {
|
|
146
|
-
return this.conflicts.map((conflict) => ({ ...conflict, keybindings: [...conflict.keybindings] }));
|
|
147
|
-
}
|
|
148
|
-
setUserBindings(userBindings) {
|
|
149
|
-
this.userBindings = userBindings;
|
|
150
|
-
this.rebuild();
|
|
151
|
-
}
|
|
152
|
-
getUserBindings() {
|
|
153
|
-
return { ...this.userBindings };
|
|
154
|
-
}
|
|
155
|
-
getResolvedBindings() {
|
|
156
|
-
const resolved = {};
|
|
157
|
-
for (const id of Object.keys(this.definitions)) {
|
|
158
|
-
const keys = this.keysById.get(id) ?? [];
|
|
159
|
-
resolved[id] = keys.length === 1 ? keys[0] : [...keys];
|
|
160
|
-
}
|
|
161
|
-
return resolved;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
let globalKeybindings = null;
|
|
165
|
-
export function setKeybindings(keybindings) {
|
|
166
|
-
globalKeybindings = keybindings;
|
|
167
|
-
}
|
|
168
|
-
export function getKeybindings() {
|
|
169
|
-
if (!globalKeybindings) {
|
|
170
|
-
globalKeybindings = new KeybindingsManager(TUI_KEYBINDINGS);
|
|
171
|
-
}
|
|
172
|
-
return globalKeybindings;
|
|
173
|
-
}
|