@dungle-scrubs/tallow 0.8.27 → 0.8.28

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 (76) hide show
  1. package/README.md +42 -1
  2. package/dist/cli.js +7 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config.d.ts +1 -1
  5. package/dist/config.js +1 -1
  6. package/dist/model-metadata-overrides.d.ts +2 -5
  7. package/dist/model-metadata-overrides.d.ts.map +1 -1
  8. package/dist/model-metadata-overrides.js +23 -12
  9. package/dist/model-metadata-overrides.js.map +1 -1
  10. package/dist/sdk.d.ts.map +1 -1
  11. package/dist/sdk.js +20 -9
  12. package/dist/sdk.js.map +1 -1
  13. package/dist/workspace-transition-interactive.d.ts.map +1 -1
  14. package/dist/workspace-transition-interactive.js +53 -3
  15. package/dist/workspace-transition-interactive.js.map +1 -1
  16. package/dist/workspace-transition.d.ts +2 -1
  17. package/dist/workspace-transition.d.ts.map +1 -1
  18. package/dist/workspace-transition.js +16 -4
  19. package/dist/workspace-transition.js.map +1 -1
  20. package/extensions/__integration__/cd-tool-guidelines.test.ts +46 -0
  21. package/extensions/__integration__/welcome-screen.test.ts +240 -0
  22. package/extensions/_shared/pid-registry.ts +5 -5
  23. package/extensions/background-task-tool/index.ts +1 -1
  24. package/extensions/cd-tool/index.ts +4 -1
  25. package/extensions/edit-tool-enhanced/index.ts +3 -1
  26. package/extensions/health/__tests__/diagnostics.test.ts +25 -0
  27. package/extensions/health/index.ts +61 -0
  28. package/extensions/loop/__tests__/loop.test.ts +365 -1
  29. package/extensions/loop/index.ts +213 -3
  30. package/extensions/prompt-suggestions/__tests__/autocomplete.test.ts +111 -3
  31. package/extensions/prompt-suggestions/autocomplete.ts +23 -5
  32. package/extensions/prompt-suggestions/index.ts +62 -3
  33. package/extensions/read-tool-enhanced/index.ts +5 -1
  34. package/extensions/session-memory/index.ts +1 -1
  35. package/extensions/session-namer/index.ts +1 -1
  36. package/extensions/subagent-tool/__tests__/presentation-rendering.test.ts +4 -4
  37. package/extensions/subagent-tool/index.ts +4 -2
  38. package/extensions/subagent-tool/process.ts +26 -8
  39. package/extensions/teams-tool/sessions/spawn.ts +2 -2
  40. package/extensions/welcome-screen/__tests__/welcome-screen.test.ts +35 -0
  41. package/extensions/welcome-screen/extension.json +20 -0
  42. package/extensions/welcome-screen/index.ts +189 -0
  43. package/node_modules/@mariozechner/pi-tui/dist/index.d.ts +2 -2
  44. package/node_modules/@mariozechner/pi-tui/dist/index.d.ts.map +1 -1
  45. package/node_modules/@mariozechner/pi-tui/dist/index.js +2 -2
  46. package/node_modules/@mariozechner/pi-tui/dist/index.js.map +1 -1
  47. package/node_modules/@mariozechner/pi-tui/dist/keybindings.d.ts +309 -25
  48. package/node_modules/@mariozechner/pi-tui/dist/keybindings.d.ts.map +1 -1
  49. package/node_modules/@mariozechner/pi-tui/dist/keybindings.js +392 -72
  50. package/node_modules/@mariozechner/pi-tui/dist/keybindings.js.map +1 -1
  51. package/node_modules/@mariozechner/pi-tui/dist/keys.d.ts +30 -0
  52. package/node_modules/@mariozechner/pi-tui/dist/keys.d.ts.map +1 -1
  53. package/node_modules/@mariozechner/pi-tui/dist/keys.js +50 -6
  54. package/node_modules/@mariozechner/pi-tui/dist/keys.js.map +1 -1
  55. package/node_modules/@mariozechner/pi-tui/dist/terminal.d.ts +27 -0
  56. package/node_modules/@mariozechner/pi-tui/dist/terminal.d.ts.map +1 -1
  57. package/node_modules/@mariozechner/pi-tui/dist/terminal.js +59 -4
  58. package/node_modules/@mariozechner/pi-tui/dist/terminal.js.map +1 -1
  59. package/node_modules/@mariozechner/pi-tui/dist/tui.d.ts +9 -0
  60. package/node_modules/@mariozechner/pi-tui/dist/tui.d.ts.map +1 -1
  61. package/node_modules/@mariozechner/pi-tui/dist/tui.js +50 -1
  62. package/node_modules/@mariozechner/pi-tui/dist/tui.js.map +1 -1
  63. package/node_modules/@mariozechner/pi-tui/package.json +1 -1
  64. package/node_modules/@mariozechner/pi-tui/src/__tests__/mouse-events.test.ts +134 -0
  65. package/node_modules/@mariozechner/pi-tui/src/__tests__/tmux-compat.test.ts +204 -0
  66. package/node_modules/@mariozechner/pi-tui/src/__tests__/tui-diff-regression.test.ts +49 -0
  67. package/node_modules/@mariozechner/pi-tui/src/__tests__/tui-render-scheduling.test.ts +2 -0
  68. package/node_modules/@mariozechner/pi-tui/src/index.ts +11 -0
  69. package/node_modules/@mariozechner/pi-tui/src/keybindings.ts +478 -140
  70. package/node_modules/@mariozechner/pi-tui/src/keys.ts +84 -6
  71. package/node_modules/@mariozechner/pi-tui/src/terminal.ts +69 -4
  72. package/node_modules/@mariozechner/pi-tui/src/tui.ts +64 -1
  73. package/package.json +9 -9
  74. package/runtime/config.ts +7 -0
  75. package/runtime/model-metadata-overrides.ts +7 -0
  76. package/skills/tallow-expert/SKILL.md +6 -4
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Welcome Screen Extension
3
+ *
4
+ * Replaces the default pi framework startup header with a branded ASCII art
5
+ * welcome screen showing the tallow logo, version, and update availability.
6
+ *
7
+ * The ASCII art is the tallow "T_" mark — a blocky amber T with a cursor,
8
+ * evoking the retro CRT terminal aesthetic of the logo.
9
+ */
10
+
11
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
12
+ import type { TUI } from "@mariozechner/pi-tui";
13
+ import { visibleWidth } from "@mariozechner/pi-tui";
14
+ import { TALLOW_VERSION } from "../../runtime/config.js";
15
+
16
+ /** Timeout for npm registry fetch (ms). */
17
+ const FETCH_TIMEOUT = 4_000;
18
+
19
+ /** Registry URL for the tallow package. */
20
+ const REGISTRY_URL = "https://registry.npmjs.org/@dungle-scrubs/tallow/latest";
21
+
22
+ // ─── ASCII Art ───────────────────────────────────────────────────────────────
23
+
24
+ /**
25
+ * The tallow "T_" mark — a blocky T with a cursor block.
26
+ * Proportions mirror the logo: wide top bar, centered thick stem, cursor lower-right.
27
+ */
28
+ const LOGO_LINES = [" ▐████████████▌ ", " ████ ", " ████ ▐█▌ "];
29
+
30
+ // ─── Version Check ───────────────────────────────────────────────────────────
31
+
32
+ /**
33
+ * Fetch the latest published version from the npm registry.
34
+ *
35
+ * @returns Latest version string, or null on failure
36
+ */
37
+ async function fetchLatestVersion(): Promise<string | null> {
38
+ if (process.env.PI_SKIP_VERSION_CHECK === "1" || process.env.PI_OFFLINE) {
39
+ return null;
40
+ }
41
+ try {
42
+ const res = await fetch(REGISTRY_URL, {
43
+ signal: AbortSignal.timeout(FETCH_TIMEOUT),
44
+ });
45
+ if (!res.ok) return null;
46
+ const data = (await res.json()) as { version?: string };
47
+ return data.version ?? null;
48
+ } catch {
49
+ return null;
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Compare two semver strings. Returns true if `latest` is newer than `current`.
55
+ *
56
+ * @param current - Currently installed version
57
+ * @param latest - Latest available version
58
+ * @returns True if latest is a newer version
59
+ */
60
+ function isNewerVersion(current: string, latest: string): boolean {
61
+ const parse = (v: string): number[] => v.split(".").map(Number);
62
+ const c = parse(current);
63
+ const l = parse(latest);
64
+ for (let i = 0; i < 3; i++) {
65
+ if ((l[i] ?? 0) > (c[i] ?? 0)) return true;
66
+ if ((l[i] ?? 0) < (c[i] ?? 0)) return false;
67
+ }
68
+ return false;
69
+ }
70
+
71
+ // ─── Colors ──────────────────────────────────────────────────────────────────
72
+
73
+ /** Amber/gold (matches the logo glow). */
74
+ const AMBER = "\x1b[38;2;255;191;0m";
75
+ /** Dim amber for version text. */
76
+ const DIM_AMBER = "\x1b[38;2;180;130;30m";
77
+ /** Green for update notification. */
78
+ const GREEN = "\x1b[38;2;100;220;100m";
79
+ /** Reset all styles. */
80
+ const RESET = "\x1b[0m";
81
+
82
+ // ─── Rendering ───────────────────────────────────────────────────────────────
83
+
84
+ /**
85
+ * Center a styled string within a given terminal width.
86
+ *
87
+ * @param line - Styled line (may contain ANSI escapes)
88
+ * @param width - Terminal width
89
+ * @returns Left-padded line
90
+ */
91
+ function centerLine(line: string, width: number): string {
92
+ const lineWidth = visibleWidth(line);
93
+ const left = Math.max(0, Math.floor((width - lineWidth) / 2));
94
+ return " ".repeat(left) + line;
95
+ }
96
+
97
+ /**
98
+ * Build the welcome screen lines.
99
+ *
100
+ * @param width - Terminal width for centering
101
+ * @param updateVersion - Newer version available, or null
102
+ * @returns Array of styled terminal lines
103
+ */
104
+ function buildWelcomeLines(width: number, updateVersion: string | null): string[] {
105
+ const lines: string[] = [];
106
+
107
+ // Logo with amber coloring
108
+ for (const logoLine of LOGO_LINES) {
109
+ lines.push(centerLine(`${AMBER}${logoLine}${RESET}`, width));
110
+ }
111
+
112
+ // Version line — dim amber, centered below logo
113
+ lines.push(centerLine(`${DIM_AMBER}tallow v${TALLOW_VERSION}${RESET}`, width));
114
+
115
+ // Update notification
116
+ if (updateVersion) {
117
+ lines.push(centerLine(`${GREEN}update available: v${updateVersion}${RESET}`, width));
118
+ }
119
+
120
+ return lines;
121
+ }
122
+
123
+ // ─── Extension Entry ─────────────────────────────────────────────────────────
124
+
125
+ /**
126
+ * Welcome screen extension.
127
+ * Replaces the default header with an ASCII art logo on session_start.
128
+ *
129
+ * @param pi - Extension API
130
+ */
131
+ export default function welcomeScreenExtension(pi: ExtensionAPI): void {
132
+ pi.on("session_start", async (_event, ctx) => {
133
+ // Skip for resumed/continued sessions — only show on fresh instances.
134
+ // Filter to message entries only — metadata entries like model_change and
135
+ // thinking_level_change are injected during session setup and exist even
136
+ // on a brand-new session. The role lives on entry.message, not the entry itself.
137
+ const hasConversation = ctx.sessionManager.getEntries().some((e) => {
138
+ const msg = (e as unknown as Record<string, unknown>).message as
139
+ | { role?: string }
140
+ | undefined;
141
+ return msg?.role === "user" || msg?.role === "assistant";
142
+ });
143
+ if (hasConversation) return;
144
+
145
+ let updateVersion: string | null = null;
146
+ let tuiRef: TUI | null = null;
147
+
148
+ // Set the header immediately with current version (no update info yet)
149
+ ctx.ui.setHeader((tui, _theme) => {
150
+ tuiRef = tui;
151
+
152
+ return {
153
+ render(width: number): string[] {
154
+ return buildWelcomeLines(width, updateVersion);
155
+ },
156
+ invalidate(): void {
157
+ // No cached state to clear
158
+ },
159
+ };
160
+ });
161
+
162
+ // Clear the changelog "What's New" children from the header container.
163
+ // setHeader only replaces the builtInHeader text component — the changelog
164
+ // section (DynamicBorder, "What's New" heading, Markdown body) lives as
165
+ // separate children in headerContainer and persists unless removed.
166
+ // headerContainer is the first child of the root TUI component.
167
+ queueMicrotask(() => {
168
+ if (!tuiRef) return;
169
+ const tuiChildren = (tuiRef as unknown as Record<string, unknown>).children as
170
+ | Array<Record<string, unknown>>
171
+ | undefined;
172
+ // headerContainer is the first child of the TUI root
173
+ const headerContainer = tuiChildren?.[0]?.children as { length: number } | undefined;
174
+ if (headerContainer && headerContainer.length > 2) {
175
+ // Keep [0]=Spacer and [1]=custom header, drop the rest (bottom spacer + changelog)
176
+ headerContainer.length = 2;
177
+ tuiRef.requestRender();
178
+ }
179
+ });
180
+
181
+ // Fire-and-forget version check — re-renders header when resolved
182
+ fetchLatestVersion().then((latest) => {
183
+ if (latest && isNewerVersion(TALLOW_VERSION, latest)) {
184
+ updateVersion = latest;
185
+ tuiRef?.requestRender();
186
+ }
187
+ });
188
+ });
189
+ }
@@ -15,8 +15,8 @@ export { Text } from "./components/text.js";
15
15
  export { TruncatedText } from "./components/truncated-text.js";
16
16
  export type { EditorComponent } from "./editor-component.js";
17
17
  export { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from "./fuzzy.js";
18
- export { DEFAULT_EDITOR_KEYBINDINGS, type EditorAction, type EditorKeybindingsConfig, EditorKeybindingsManager, getEditorKeybindings, setEditorKeybindings, } from "./keybindings.js";
19
- export { isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, type KeyEventType, type KeyId, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.js";
18
+ export { DEFAULT_EDITOR_KEYBINDINGS, type EditorAction, type EditorKeybindingsConfig, EditorKeybindingsManager, getEditorKeybindings, getKeybindings, type Keybinding, type KeybindingDefinition, type Keybindings, type KeybindingsConfig, KeybindingsManager, setEditorKeybindings, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.js";
19
+ export { isKeyRelease, isKeyRepeat, isKittyProtocolActive, isMouseEvent, Key, type KeyEventType, type KeyId, type MouseEvent, matchesKey, parseKey, parseMouseEvent, setKittyProtocolActive, } from "./keys.js";
20
20
  export { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from "./stdin-buffer.js";
21
21
  export { ProcessTerminal, type Terminal } from "./terminal.js";
22
22
  export { allocateImageId, type CellDimensions, calculateImageLayout, createImageMetadata, deleteAllKittyImages, deleteKittyImage, detectCapabilities, detectImageFormat, encodeITerm2, encodeKitty, formatImageDimensions, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getWebpDimensions, type ImageDimensions, type ImageFormat, type ImageLayout, type ImageMetadata, type ImageProtocol, type ImageRenderOptions, imageFallback, imageFormatToMime, renderImage, resetCapabilitiesCache, setCellDimensions, type TerminalCapabilities, } from "./terminal-image.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,4BAA4B,EAC5B,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,KAAK,WAAW,EAChB,kBAAkB,EAClB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,qBAAqB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EACN,KAAK,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O,EACN,eAAe,EACf,KAAK,cAAc,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,aAAa,EACb,KAAK,SAAS,EACd,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,GAAG,GACH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,4BAA4B,EAC5B,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,KAAK,WAAW,EAChB,kBAAkB,EAClB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,qBAAqB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,M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,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,UAAU,EACf,UAAU,EACV,QAAQ,EACR,eAAe,EACf,sBAAsB,GACtB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,WAAW,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEnG,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EACN,eAAe,EACf,KAAK,cAAc,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,aAAa,EACb,KAAK,SAAS,EACd,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,GAAG,GACH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -20,9 +20,9 @@ export { TruncatedText } from "./components/truncated-text.js";
20
20
  // Fuzzy matching
21
21
  export { fuzzyFilter, fuzzyMatch } from "./fuzzy.js";
22
22
  // Keybindings
23
- export { DEFAULT_EDITOR_KEYBINDINGS, EditorKeybindingsManager, getEditorKeybindings, setEditorKeybindings, } from "./keybindings.js";
23
+ export { DEFAULT_EDITOR_KEYBINDINGS, EditorKeybindingsManager, getEditorKeybindings, getKeybindings, KeybindingsManager, setEditorKeybindings, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.js";
24
24
  // Keyboard input handling
25
- export { isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.js";
25
+ export { isKeyRelease, isKeyRepeat, isKittyProtocolActive, isMouseEvent, Key, matchesKey, parseKey, parseMouseEvent, setKittyProtocolActive, } from "./keys.js";
26
26
  // Input buffering for batch splitting
27
27
  export { StdinBuffer } from "./stdin-buffer.js";
28
28
  // Terminal interface and implementations
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC,uBAAuB;AACvB,OAAO,EAGN,4BAA4B,GAE5B,MAAM,mBAAmB,CAAC;AAC3B,gBAAgB;AAChB,OAAO,EAEN,kBAAkB,EAClB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,qBAAqB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,aAAa;AACb,OAAO,EAAE,WAAW,EAA2B,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAwC,MAAM,wBAAwB,CAAC;AACtF,OAAO,EACN,KAAK,EAGL,oBAAoB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAoD,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAyB,QAAQ,EAAsB,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAmB,UAAU,EAAwB,MAAM,6BAA6B,CAAC;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qB,EACrB,YAAY,EACZ,GAAG,EAIH,UAAU,EACV,QAAQ,EACR,eAAe,EACf,sBAAsB,GACtB,MAAM,WAAW,CAAC;AACnB,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAqD,MAAM,mBAAmB,CAAC;AACnG,yCAAyC;AACzC,OAAO,EAAE,eAAe,EAAiB,MAAM,eAAe,CAAC;AAC/D,yBAAyB;AACzB,OAAO,EACN,eAAe,EAEf,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAOjB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,iBAAiB,GAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,SAAS,EACT,aAAa,EAEb,WAAW,EAMX,GAAG,GACH,MAAM,UAAU,CAAC;AAClB,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,39 +1,323 @@
1
1
  import { type KeyId } from "./keys.js";
2
- /**
3
- * Editor actions that can be bound to keys.
4
- */
5
- export type EditorAction = "cursorUp" | "cursorDown" | "cursorLeft" | "cursorRight" | "cursorWordLeft" | "cursorWordRight" | "cursorLineStart" | "cursorLineEnd" | "jumpForward" | "jumpBackward" | "pageUp" | "pageDown" | "deleteCharBackward" | "deleteCharForward" | "deleteWordBackward" | "deleteWordForward" | "deleteToLineStart" | "deleteToLineEnd" | "newLine" | "submit" | "tab" | "selectUp" | "selectDown" | "selectPageUp" | "selectPageDown" | "selectConfirm" | "selectCancel" | "copy" | "yank" | "yankPop" | "undo" | "expandTools" | "toggleSessionPath" | "toggleSessionSort" | "renameSession" | "deleteSession" | "deleteSessionNoninvasive";
6
- export type { KeyId };
7
- /**
8
- * Editor keybindings configuration.
9
- */
10
- export type EditorKeybindingsConfig = {
11
- [K in EditorAction]?: KeyId | KeyId[];
2
+ /** Modern TUI keybinding identifiers. */
3
+ export interface Keybindings {
4
+ "tui.editor.cursorDown": true;
5
+ "tui.editor.cursorLeft": true;
6
+ "tui.editor.cursorLineEnd": true;
7
+ "tui.editor.cursorLineStart": true;
8
+ "tui.editor.cursorRight": true;
9
+ "tui.editor.cursorUp": true;
10
+ "tui.editor.cursorWordLeft": true;
11
+ "tui.editor.cursorWordRight": true;
12
+ "tui.editor.deleteCharBackward": true;
13
+ "tui.editor.deleteCharForward": true;
14
+ "tui.editor.deleteToLineEnd": true;
15
+ "tui.editor.deleteToLineStart": true;
16
+ "tui.editor.deleteWordBackward": true;
17
+ "tui.editor.deleteWordForward": true;
18
+ "tui.editor.jumpBackward": true;
19
+ "tui.editor.jumpForward": true;
20
+ "tui.editor.pageDown": true;
21
+ "tui.editor.pageUp": true;
22
+ "tui.editor.undo": true;
23
+ "tui.editor.yank": true;
24
+ "tui.editor.yankPop": true;
25
+ "tui.input.copy": true;
26
+ "tui.input.newLine": true;
27
+ "tui.input.submit": true;
28
+ "tui.input.tab": true;
29
+ "tui.select.cancel": true;
30
+ "tui.select.confirm": true;
31
+ "tui.select.down": true;
32
+ "tui.select.pageDown": true;
33
+ "tui.select.pageUp": true;
34
+ "tui.select.up": true;
35
+ }
36
+ declare const LEGACY_TO_MODERN_KEYBINDINGS: {
37
+ readonly copy: "tui.input.copy";
38
+ readonly cursorDown: "tui.editor.cursorDown";
39
+ readonly cursorLeft: "tui.editor.cursorLeft";
40
+ readonly cursorLineEnd: "tui.editor.cursorLineEnd";
41
+ readonly cursorLineStart: "tui.editor.cursorLineStart";
42
+ readonly cursorRight: "tui.editor.cursorRight";
43
+ readonly cursorUp: "tui.editor.cursorUp";
44
+ readonly cursorWordLeft: "tui.editor.cursorWordLeft";
45
+ readonly cursorWordRight: "tui.editor.cursorWordRight";
46
+ readonly deleteCharBackward: "tui.editor.deleteCharBackward";
47
+ readonly deleteCharForward: "tui.editor.deleteCharForward";
48
+ readonly deleteSession: "app.session.delete";
49
+ readonly deleteSessionNoninvasive: "app.session.deleteNoninvasive";
50
+ readonly deleteToLineEnd: "tui.editor.deleteToLineEnd";
51
+ readonly deleteToLineStart: "tui.editor.deleteToLineStart";
52
+ readonly deleteWordBackward: "tui.editor.deleteWordBackward";
53
+ readonly deleteWordForward: "tui.editor.deleteWordForward";
54
+ readonly expandTools: "app.tools.expand";
55
+ readonly jumpBackward: "tui.editor.jumpBackward";
56
+ readonly jumpForward: "tui.editor.jumpForward";
57
+ readonly newLine: "tui.input.newLine";
58
+ readonly pageDown: "tui.editor.pageDown";
59
+ readonly pageUp: "tui.editor.pageUp";
60
+ readonly renameSession: "app.session.rename";
61
+ readonly selectCancel: "tui.select.cancel";
62
+ readonly selectConfirm: "tui.select.confirm";
63
+ readonly selectDown: "tui.select.down";
64
+ readonly selectPageDown: "tui.select.pageDown";
65
+ readonly selectPageUp: "tui.select.pageUp";
66
+ readonly selectUp: "tui.select.up";
67
+ readonly submit: "tui.input.submit";
68
+ readonly tab: "tui.input.tab";
69
+ readonly toggleSessionPath: "app.session.togglePath";
70
+ readonly toggleSessionSort: "app.session.toggleSort";
71
+ readonly undo: "tui.editor.undo";
72
+ readonly yank: "tui.editor.yank";
73
+ readonly yankPop: "tui.editor.yankPop";
12
74
  };
75
+ /** Backward-compatible legacy editor actions. */
76
+ export type EditorAction = keyof typeof LEGACY_TO_MODERN_KEYBINDINGS;
77
+ /** Modern keybinding identifier. */
78
+ export type Keybinding = keyof Keybindings | EditorAction;
79
+ /** Single keybinding definition with defaults and UI help text. */
80
+ export interface KeybindingDefinition {
81
+ readonly defaultKeys: KeyId | readonly KeyId[];
82
+ readonly description: string;
83
+ }
84
+ /** User-provided keybinding overrides. */
85
+ export type KeybindingsConfig = Partial<Record<Keybinding, KeyId | readonly KeyId[]>>;
86
+ /** Backward-compatible legacy editor config. */
87
+ export type EditorKeybindingsConfig = Partial<Record<EditorAction, KeyId | readonly KeyId[]>>;
88
+ /** Default legacy editor keybindings preserved for compatibility. */
89
+ export declare const DEFAULT_EDITOR_KEYBINDINGS: Required<Record<EditorAction, KeyId | readonly KeyId[]>>;
90
+ /** Modern TUI keybinding definitions consumed by pi-coding-agent 0.61+. */
91
+ export declare const TUI_KEYBINDINGS: {
92
+ readonly "tui.editor.cursorDown": {
93
+ readonly defaultKeys: KeyId | readonly KeyId[];
94
+ readonly description: "Move cursor down";
95
+ };
96
+ readonly "tui.editor.cursorLeft": {
97
+ readonly defaultKeys: KeyId | readonly KeyId[];
98
+ readonly description: "Move cursor left";
99
+ };
100
+ readonly "tui.editor.cursorLineEnd": {
101
+ readonly defaultKeys: KeyId | readonly KeyId[];
102
+ readonly description: "Move to line end";
103
+ };
104
+ readonly "tui.editor.cursorLineStart": {
105
+ readonly defaultKeys: KeyId | readonly KeyId[];
106
+ readonly description: "Move to line start";
107
+ };
108
+ readonly "tui.editor.cursorRight": {
109
+ readonly defaultKeys: KeyId | readonly KeyId[];
110
+ readonly description: "Move cursor right";
111
+ };
112
+ readonly "tui.editor.cursorUp": {
113
+ readonly defaultKeys: KeyId | readonly KeyId[];
114
+ readonly description: "Move cursor up";
115
+ };
116
+ readonly "tui.editor.cursorWordLeft": {
117
+ readonly defaultKeys: KeyId | readonly KeyId[];
118
+ readonly description: "Move cursor word left";
119
+ };
120
+ readonly "tui.editor.cursorWordRight": {
121
+ readonly defaultKeys: KeyId | readonly KeyId[];
122
+ readonly description: "Move cursor word right";
123
+ };
124
+ readonly "tui.editor.deleteCharBackward": {
125
+ readonly defaultKeys: KeyId | readonly KeyId[];
126
+ readonly description: "Delete character backward";
127
+ };
128
+ readonly "tui.editor.deleteCharForward": {
129
+ readonly defaultKeys: KeyId | readonly KeyId[];
130
+ readonly description: "Delete character forward";
131
+ };
132
+ readonly "tui.editor.deleteToLineEnd": {
133
+ readonly defaultKeys: KeyId | readonly KeyId[];
134
+ readonly description: "Delete to line end";
135
+ };
136
+ readonly "tui.editor.deleteToLineStart": {
137
+ readonly defaultKeys: KeyId | readonly KeyId[];
138
+ readonly description: "Delete to line start";
139
+ };
140
+ readonly "tui.editor.deleteWordBackward": {
141
+ readonly defaultKeys: KeyId | readonly KeyId[];
142
+ readonly description: "Delete word backward";
143
+ };
144
+ readonly "tui.editor.deleteWordForward": {
145
+ readonly defaultKeys: KeyId | readonly KeyId[];
146
+ readonly description: "Delete word forward";
147
+ };
148
+ readonly "tui.editor.jumpBackward": {
149
+ readonly defaultKeys: KeyId | readonly KeyId[];
150
+ readonly description: "Jump backward to character";
151
+ };
152
+ readonly "tui.editor.jumpForward": {
153
+ readonly defaultKeys: KeyId | readonly KeyId[];
154
+ readonly description: "Jump forward to character";
155
+ };
156
+ readonly "tui.editor.pageDown": {
157
+ readonly defaultKeys: KeyId | readonly KeyId[];
158
+ readonly description: "Page down";
159
+ };
160
+ readonly "tui.editor.pageUp": {
161
+ readonly defaultKeys: KeyId | readonly KeyId[];
162
+ readonly description: "Page up";
163
+ };
164
+ readonly "tui.editor.undo": {
165
+ readonly defaultKeys: KeyId | readonly KeyId[];
166
+ readonly description: "Undo";
167
+ };
168
+ readonly "tui.editor.yank": {
169
+ readonly defaultKeys: KeyId | readonly KeyId[];
170
+ readonly description: "Yank";
171
+ };
172
+ readonly "tui.editor.yankPop": {
173
+ readonly defaultKeys: KeyId | readonly KeyId[];
174
+ readonly description: "Yank pop";
175
+ };
176
+ readonly "tui.input.copy": {
177
+ readonly defaultKeys: KeyId | readonly KeyId[];
178
+ readonly description: "Copy selection";
179
+ };
180
+ readonly "tui.input.newLine": {
181
+ readonly defaultKeys: KeyId | readonly KeyId[];
182
+ readonly description: "Insert newline";
183
+ };
184
+ readonly "tui.input.submit": {
185
+ readonly defaultKeys: KeyId | readonly KeyId[];
186
+ readonly description: "Submit input";
187
+ };
188
+ readonly "tui.input.tab": {
189
+ readonly defaultKeys: KeyId | readonly KeyId[];
190
+ readonly description: "Tab / autocomplete";
191
+ };
192
+ readonly "tui.select.cancel": {
193
+ readonly defaultKeys: KeyId | readonly KeyId[];
194
+ readonly description: "Cancel selection";
195
+ };
196
+ readonly "tui.select.confirm": {
197
+ readonly defaultKeys: KeyId | readonly KeyId[];
198
+ readonly description: "Confirm selection";
199
+ };
200
+ readonly "tui.select.down": {
201
+ readonly defaultKeys: KeyId | readonly KeyId[];
202
+ readonly description: "Move selection down";
203
+ };
204
+ readonly "tui.select.pageDown": {
205
+ readonly defaultKeys: KeyId | readonly KeyId[];
206
+ readonly description: "Selection page down";
207
+ };
208
+ readonly "tui.select.pageUp": {
209
+ readonly defaultKeys: KeyId | readonly KeyId[];
210
+ readonly description: "Selection page up";
211
+ };
212
+ readonly "tui.select.up": {
213
+ readonly defaultKeys: KeyId | readonly KeyId[];
214
+ readonly description: "Move selection up";
215
+ };
216
+ };
217
+ type ModernKeybinding = keyof Keybindings;
218
+ type NormalizedKeybindingsConfig = Partial<Record<ModernKeybinding, readonly KeyId[]>>;
13
219
  /**
14
- * Default editor keybindings.
15
- */
16
- export declare const DEFAULT_EDITOR_KEYBINDINGS: Required<EditorKeybindingsConfig>;
17
- /**
18
- * Manages keybindings for the editor.
220
+ * Keybinding manager compatible with pi-tui 0.61+ while preserving legacy names.
19
221
  */
20
- export declare class EditorKeybindingsManager {
21
- private actionToKeys;
22
- constructor(config?: EditorKeybindingsConfig);
23
- private buildMaps;
222
+ export declare class KeybindingsManager {
223
+ private readonly definitions;
224
+ private readonly resolvedKeys;
225
+ private userBindings;
226
+ /**
227
+ * Create a keybindings manager.
228
+ *
229
+ * @param {Readonly<Record<ModernKeybinding, KeybindingDefinition>>} definitions - Keybinding definitions.
230
+ * @param {KeybindingsConfig} userBindings - Optional user overrides.
231
+ */
232
+ constructor(definitions?: Readonly<Record<ModernKeybinding, KeybindingDefinition>>, userBindings?: KeybindingsConfig);
233
+ /**
234
+ * Rebuild resolved bindings from defaults plus user overrides.
235
+ *
236
+ * @returns {void} Nothing.
237
+ */
238
+ private rebuild;
239
+ /**
240
+ * Resolve a keybinding name to its lookup key in resolvedKeys.
241
+ * Checks the TUI namespace and legacy names first, then falls back to
242
+ * a direct lookup in definitions/resolvedKeys for consumer-defined
243
+ * keybindings (e.g. app.* keybindings registered by pi-coding-agent).
244
+ *
245
+ * @param {string} keybinding - Keybinding identifier.
246
+ * @returns {ModernKeybinding | null} Resolved key or null when unknown.
247
+ */
248
+ private resolveKeybinding;
24
249
  /**
25
- * Check if input matches a specific action.
250
+ * Check whether input matches a keybinding.
251
+ *
252
+ * @param {string} data - Raw terminal input.
253
+ * @param {Keybinding | string} keybinding - Keybinding identifier.
254
+ * @returns {boolean} True when the input matches.
26
255
  */
27
- matches(data: string, action: EditorAction): boolean;
256
+ matches(data: string, keybinding: Keybinding | string): boolean;
28
257
  /**
29
- * Get keys bound to an action.
258
+ * Get the keys currently bound to a keybinding.
259
+ *
260
+ * @param {Keybinding | string} keybinding - Keybinding identifier.
261
+ * @returns {KeyId[]} Resolved key list.
30
262
  */
31
- getKeys(action: EditorAction): KeyId[];
263
+ getKeys(keybinding: Keybinding | string): KeyId[];
32
264
  /**
33
- * Update configuration.
265
+ * Replace user bindings and rebuild the resolved map.
266
+ *
267
+ * @param {KeybindingsConfig} userBindings - New user bindings.
268
+ * @returns {void} Nothing.
34
269
  */
35
- setConfig(config: EditorKeybindingsConfig): void;
270
+ setUserBindings(userBindings: KeybindingsConfig): void;
271
+ /**
272
+ * Normalize user bindings using both TUI namespace and consumer definitions.
273
+ * This extends the module-level normalizeUserBindings to also accept
274
+ * keybinding names that exist in this.definitions (e.g. app.*).
275
+ *
276
+ * @param {KeybindingsConfig} userBindings - Raw user bindings.
277
+ * @returns {NormalizedKeybindingsConfig} Normalized modern binding map.
278
+ */
279
+ private normalizeUserBindingsWithDefinitions;
280
+ /**
281
+ * Get the fully resolved modern keybinding config.
282
+ *
283
+ * @returns {NormalizedKeybindingsConfig} Resolved keybinding config.
284
+ */
285
+ getResolvedBindings(): NormalizedKeybindingsConfig;
286
+ }
287
+ /** Backward-compatible alias for legacy callers. */
288
+ export declare class EditorKeybindingsManager extends KeybindingsManager {
289
+ /**
290
+ * Create a legacy editor keybindings manager.
291
+ *
292
+ * @param {EditorKeybindingsConfig} config - Legacy editor keybinding overrides.
293
+ */
294
+ constructor(config?: EditorKeybindingsConfig);
36
295
  }
296
+ /**
297
+ * Get the shared keybindings manager.
298
+ *
299
+ * @returns {KeybindingsManager} Shared keybindings manager.
300
+ */
301
+ export declare function getKeybindings(): KeybindingsManager;
302
+ /**
303
+ * Replace the shared keybindings manager.
304
+ *
305
+ * @param {KeybindingsManager} manager - Keybindings manager to install.
306
+ * @returns {void} Nothing.
307
+ */
308
+ export declare function setKeybindings(manager: KeybindingsManager): void;
309
+ /**
310
+ * Get the shared legacy editor keybindings manager.
311
+ *
312
+ * @returns {EditorKeybindingsManager} Shared legacy-compatible manager.
313
+ */
37
314
  export declare function getEditorKeybindings(): EditorKeybindingsManager;
315
+ /**
316
+ * Replace the shared legacy editor keybindings manager.
317
+ *
318
+ * @param {EditorKeybindingsManager} manager - Legacy keybindings manager.
319
+ * @returns {void} Nothing.
320
+ */
38
321
  export declare function setEditorKeybindings(manager: EditorKeybindingsManager): void;
322
+ export {};
39
323
  //# sourceMappingURL=keybindings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keybindings.d.ts","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,WAAW,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,YAAY,GAErB,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,aAAa,GACb,cAAc,GACd,QAAQ,GACR,UAAU,GAEV,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB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