@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.
Files changed (57) hide show
  1. package/dist/agent/index.js +16 -140
  2. package/dist/cli.js +25 -220
  3. package/dist/extensions/spectral-vision-fallback.js +188 -0
  4. package/dist/memory/commands/status.js +5 -5
  5. package/dist/memory/commands/view.js +16 -14
  6. package/dist/memory/compaction.js +31 -3
  7. package/dist/memory/prompts.js +5 -5
  8. package/dist/memory/tools/recall-observation.js +2 -2
  9. package/dist/pi/coding-agent/config.js +0 -11
  10. package/dist/pi/coding-agent/core/agent-session.js +3 -17
  11. package/dist/pi/coding-agent/core/extensions/loader.js +0 -6
  12. package/dist/pi/coding-agent/core/extensions/runner.js +7 -1
  13. package/dist/pi/coding-agent/core/keybindings.js +129 -2
  14. package/dist/pi/coding-agent/core/settings-manager.js +20 -0
  15. package/dist/pi/coding-agent/core/tools/bash.js +17 -63
  16. package/dist/pi/coding-agent/core/tools/edit.js +4 -141
  17. package/dist/pi/coding-agent/core/tools/find.js +0 -11
  18. package/dist/pi/coding-agent/core/tools/grep.js +0 -11
  19. package/dist/pi/coding-agent/core/tools/ls.js +0 -11
  20. package/dist/pi/coding-agent/core/tools/read.js +0 -12
  21. package/dist/pi/coding-agent/core/tools/render-utils.js +1 -14
  22. package/dist/pi/coding-agent/core/tools/write.js +2 -97
  23. package/dist/pi/coding-agent/modes/interactive/components/keybinding-hints.js +1 -1
  24. package/dist/pi/coding-agent/modes/interactive/components/visual-truncate.js +6 -12
  25. package/dist/pi/coding-agent/modes/interactive/theme/theme.js +1 -2
  26. package/dist/relay/models-fetch.js +13 -1
  27. package/dist/server/pi-bridge.js +57 -4
  28. package/dist/server/session-stream.js +7 -1
  29. package/package.json +1 -1
  30. package/dist/pi/coding-agent/core/export-html/ansi-to-html.js +0 -248
  31. package/dist/pi/coding-agent/core/export-html/index.js +0 -225
  32. package/dist/pi/coding-agent/core/export-html/tool-renderer.js +0 -107
  33. package/dist/pi/tui/autocomplete.js +0 -631
  34. package/dist/pi/tui/components/box.js +0 -103
  35. package/dist/pi/tui/components/cancellable-loader.js +0 -34
  36. package/dist/pi/tui/components/editor.js +0 -1915
  37. package/dist/pi/tui/components/image.js +0 -88
  38. package/dist/pi/tui/components/input.js +0 -425
  39. package/dist/pi/tui/components/loader.js +0 -68
  40. package/dist/pi/tui/components/markdown.js +0 -633
  41. package/dist/pi/tui/components/select-list.js +0 -158
  42. package/dist/pi/tui/components/settings-list.js +0 -184
  43. package/dist/pi/tui/components/spacer.js +0 -22
  44. package/dist/pi/tui/components/text.js +0 -88
  45. package/dist/pi/tui/components/truncated-text.js +0 -50
  46. package/dist/pi/tui/editor-component.js +0 -1
  47. package/dist/pi/tui/fuzzy.js +0 -109
  48. package/dist/pi/tui/index.js +0 -31
  49. package/dist/pi/tui/keybindings.js +0 -173
  50. package/dist/pi/tui/keys.js +0 -1172
  51. package/dist/pi/tui/kill-ring.js +0 -43
  52. package/dist/pi/tui/stdin-buffer.js +0 -360
  53. package/dist/pi/tui/terminal-image.js +0 -335
  54. package/dist/pi/tui/terminal.js +0 -324
  55. package/dist/pi/tui/tui.js +0 -1076
  56. package/dist/pi/tui/undo-stack.js +0 -24
  57. package/dist/pi/tui/utils.js +0 -1016
@@ -1,103 +0,0 @@
1
- import { applyBackgroundToLine, visibleWidth } from "../utils.js";
2
- /**
3
- * Box component - a container that applies padding and background to all children
4
- */
5
- export class Box {
6
- children = [];
7
- paddingX;
8
- paddingY;
9
- bgFn;
10
- // Cache for rendered output
11
- cache;
12
- constructor(paddingX = 1, paddingY = 1, bgFn) {
13
- this.paddingX = paddingX;
14
- this.paddingY = paddingY;
15
- this.bgFn = bgFn;
16
- }
17
- addChild(component) {
18
- this.children.push(component);
19
- this.invalidateCache();
20
- }
21
- removeChild(component) {
22
- const index = this.children.indexOf(component);
23
- if (index !== -1) {
24
- this.children.splice(index, 1);
25
- this.invalidateCache();
26
- }
27
- }
28
- clear() {
29
- this.children = [];
30
- this.invalidateCache();
31
- }
32
- setBgFn(bgFn) {
33
- this.bgFn = bgFn;
34
- // Don't invalidate here - we'll detect bgFn changes by sampling output
35
- }
36
- invalidateCache() {
37
- this.cache = undefined;
38
- }
39
- matchCache(width, childLines, bgSample) {
40
- const cache = this.cache;
41
- return (!!cache &&
42
- cache.width === width &&
43
- cache.bgSample === bgSample &&
44
- cache.childLines.length === childLines.length &&
45
- cache.childLines.every((line, i) => line === childLines[i]));
46
- }
47
- invalidate() {
48
- this.invalidateCache();
49
- for (const child of this.children) {
50
- child.invalidate?.();
51
- }
52
- }
53
- render(width) {
54
- if (this.children.length === 0) {
55
- return [];
56
- }
57
- const contentWidth = Math.max(1, width - this.paddingX * 2);
58
- const leftPad = " ".repeat(this.paddingX);
59
- // Render all children
60
- const childLines = [];
61
- for (const child of this.children) {
62
- const lines = child.render(contentWidth);
63
- for (const line of lines) {
64
- childLines.push(leftPad + line);
65
- }
66
- }
67
- if (childLines.length === 0) {
68
- return [];
69
- }
70
- // Check if bgFn output changed by sampling
71
- const bgSample = this.bgFn ? this.bgFn("test") : undefined;
72
- // Check cache validity
73
- if (this.matchCache(width, childLines, bgSample)) {
74
- return this.cache.lines;
75
- }
76
- // Apply background and padding
77
- const result = [];
78
- // Top padding
79
- for (let i = 0; i < this.paddingY; i++) {
80
- result.push(this.applyBg("", width));
81
- }
82
- // Content
83
- for (const line of childLines) {
84
- result.push(this.applyBg(line, width));
85
- }
86
- // Bottom padding
87
- for (let i = 0; i < this.paddingY; i++) {
88
- result.push(this.applyBg("", width));
89
- }
90
- // Update cache
91
- this.cache = { childLines, width, bgSample, lines: result };
92
- return result;
93
- }
94
- applyBg(line, width) {
95
- const visLen = visibleWidth(line);
96
- const padNeeded = Math.max(0, width - visLen);
97
- const padded = line + " ".repeat(padNeeded);
98
- if (this.bgFn) {
99
- return applyBackgroundToLine(padded, width, this.bgFn);
100
- }
101
- return padded;
102
- }
103
- }
@@ -1,34 +0,0 @@
1
- import { getKeybindings } from "../keybindings.js";
2
- import { Loader } from "./loader.js";
3
- /**
4
- * Loader that can be cancelled with Escape.
5
- * Extends Loader with an AbortSignal for cancelling async operations.
6
- *
7
- * @example
8
- * const loader = new CancellableLoader(tui, cyan, dim, "Working...");
9
- * loader.onAbort = () => done(null);
10
- * doWork(loader.signal).then(done);
11
- */
12
- export class CancellableLoader extends Loader {
13
- abortController = new AbortController();
14
- /** Called when user presses Escape */
15
- onAbort;
16
- /** AbortSignal that is aborted when user presses Escape */
17
- get signal() {
18
- return this.abortController.signal;
19
- }
20
- /** Whether the loader was aborted */
21
- get aborted() {
22
- return this.abortController.signal.aborted;
23
- }
24
- handleInput(data) {
25
- const kb = getKeybindings();
26
- if (kb.matches(data, "tui.select.cancel")) {
27
- this.abortController.abort();
28
- this.onAbort?.();
29
- }
30
- }
31
- dispose() {
32
- this.stop();
33
- }
34
- }