@duckmind/dm-darwin-x64 0.35.4 → 0.35.5

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 (43) hide show
  1. package/dm +0 -0
  2. package/extensions/.dm-extensions.json +1 -27
  3. package/package.json +1 -1
  4. package/extensions/dm-alps/LICENSE +0 -21
  5. package/extensions/dm-alps/README.md +0 -22
  6. package/extensions/dm-alps/index.ts +0 -172
  7. package/extensions/dm-alps/package.json +0 -49
  8. package/extensions/dm-alps/src/commands.ts +0 -208
  9. package/extensions/dm-alps/src/features/animations/debug.ts +0 -160
  10. package/extensions/dm-alps/src/features/animations/index.ts +0 -33
  11. package/extensions/dm-alps/src/features/animations/patch.ts +0 -112
  12. package/extensions/dm-alps/src/features/animations/preview.ts +0 -117
  13. package/extensions/dm-alps/src/features/animations/registry.ts +0 -593
  14. package/extensions/dm-alps/src/features/animations/runtime.ts +0 -574
  15. package/extensions/dm-alps/src/features/animations/settings.ts +0 -69
  16. package/extensions/dm-alps/src/features/bottom-input/cluster.ts +0 -2
  17. package/extensions/dm-alps/src/features/bottom-input/compositor.ts +0 -2
  18. package/extensions/dm-alps/src/features/bottom-input/editor.ts +0 -148
  19. package/extensions/dm-alps/src/features/bottom-input/frame.ts +0 -224
  20. package/extensions/dm-alps/src/features/bottom-input/icons.ts +0 -36
  21. package/extensions/dm-alps/src/features/bottom-input/index.ts +0 -8
  22. package/extensions/dm-alps/src/features/bottom-input/runtime.ts +0 -1197
  23. package/extensions/dm-alps/src/features/bottom-input/shortcuts.ts +0 -286
  24. package/extensions/dm-alps/src/features/bottom-input/status.ts +0 -663
  25. package/extensions/dm-alps/src/features/bottom-status/index.ts +0 -2
  26. package/extensions/dm-alps/src/features/chrome-frame/chrome.ts +0 -222
  27. package/extensions/dm-alps/src/features/chrome-frame/debug.ts +0 -212
  28. package/extensions/dm-alps/src/features/chrome-frame/image.ts +0 -11
  29. package/extensions/dm-alps/src/features/chrome-frame/index.ts +0 -4
  30. package/extensions/dm-alps/src/features/chrome-frame/osc.ts +0 -111
  31. package/extensions/dm-alps/src/features/chrome-frame/patch.ts +0 -769
  32. package/extensions/dm-alps/src/features/chrome-frame/preview.ts +0 -67
  33. package/extensions/dm-alps/src/features/chrome-frame/styles.ts +0 -105
  34. package/extensions/dm-alps/src/features/fixed-bottom-editor/cluster.ts +0 -161
  35. package/extensions/dm-alps/src/features/fixed-bottom-editor/compositor.ts +0 -1149
  36. package/extensions/dm-alps/src/features/fixed-bottom-editor/index.ts +0 -3
  37. package/extensions/dm-alps/src/features/fixed-bottom-editor/runtime.ts +0 -3
  38. package/extensions/dm-alps/src/settings-store.ts +0 -194
  39. package/extensions/dm-alps/src/settings-ui.ts +0 -653
  40. package/extensions/dm-alps/src/settings.ts +0 -102
  41. package/extensions/dm-alps/src/terminal-sanitizer.ts +0 -91
  42. package/extensions/dm-alps/themes/LICENSE.synthwave-84 +0 -21
  43. package/extensions/dm-alps/themes/alps.json +0 -93
@@ -1,286 +0,0 @@
1
-
2
- import { isKeyRelease, matchesKey } from "@mariozechner/pi-tui";
3
-
4
- export type BottomInputShortcutKey =
5
- | "stashEditor"
6
- | "copyEditor"
7
- | "cutEditor"
8
- | "scrollChatUp"
9
- | "scrollChatDown"
10
- | "editorStart"
11
- | "editorEnd"
12
- | "jumpPreviousUserMessage"
13
- | "jumpNextUserMessage"
14
- | "jumpPreviousAssistantMessage"
15
- | "jumpNextAssistantMessage"
16
- | "jumpChatBottom";
17
-
18
- export type BottomInputShortcuts = Record<BottomInputShortcutKey, string>;
19
-
20
- export type ShortcutValidationResult =
21
- | { ok: true; shortcut: string }
22
- | { ok: false; reason: string };
23
-
24
- export const DEFAULT_BOTTOM_INPUT_SHORTCUTS: BottomInputShortcuts = {
25
- stashEditor: "alt+s",
26
- copyEditor: "ctrl+alt+c",
27
- cutEditor: "ctrl+alt+x",
28
- scrollChatUp: "super+up",
29
- scrollChatDown: "super+down",
30
- editorStart: "super+shift+up",
31
- editorEnd: "super+shift+down",
32
- jumpPreviousUserMessage: "ctrl+shift+u",
33
- jumpNextUserMessage: "ctrl+shift+i",
34
- jumpPreviousAssistantMessage: "ctrl+alt+,",
35
- jumpNextAssistantMessage: "ctrl+alt+.",
36
- jumpChatBottom: "ctrl+shift+g",
37
- };
38
-
39
- export const SHORTCUT_LABELS: Record<BottomInputShortcutKey, string> = {
40
- stashEditor: "Stash Editor",
41
- copyEditor: "Copy Editor",
42
- cutEditor: "Cut Editor",
43
- scrollChatUp: "Scroll Chat Up",
44
- scrollChatDown: "Scroll Chat Down",
45
- editorStart: "Move Cursor Start",
46
- editorEnd: "Move Cursor End",
47
- jumpPreviousUserMessage: "Previous User Message",
48
- jumpNextUserMessage: "Next User Message",
49
- jumpPreviousAssistantMessage: "Previous Assistant Msg",
50
- jumpNextAssistantMessage: "Next Assistant Msg",
51
- jumpChatBottom: "Chat Bottom",
52
- };
53
-
54
- export const SHORTCUT_KEYS = Object.keys(DEFAULT_BOTTOM_INPUT_SHORTCUTS) as BottomInputShortcutKey[];
55
-
56
- const SUPER_SHORTCUT_PATTERNS = new Map<string, RegExp>([
57
- ["super+up", /^\x1b\[(?:1;9(?::[12])?[AH]|574(?:19|23);9(?::[12])?u|7;9(?::[12])?~|27;9;65~)$/],
58
- ["super+down", /^\x1b\[(?:1;9(?::[12])?[BF]|574(?:20|24);9(?::[12])?u|8;9(?::[12])?~|27;9;66~)$/],
59
- ["super+home", /^\x1b\[(?:1;9(?::[12])?H|57423;9(?::[12])?u|7;9(?::[12])?~)$/],
60
- ["super+end", /^\x1b\[(?:1;9(?::[12])?F|57424;9(?::[12])?u|8;9(?::[12])?~)$/],
61
- ["super+pageup", /^\x1b\[(?:5;9(?::[12])?~|57421;9(?::[12])?u)$/],
62
- ["super+pagedown", /^\x1b\[(?:6;9(?::[12])?~|57422;9(?::[12])?u)$/],
63
- ["super+shift+up", /^\x1b\[(?:1;10(?::[12])?[AH]|574(?:19|23);10(?::[12])?u|7;10(?::[12])?~|27;10;65~)$/],
64
- ["super+shift+down", /^\x1b\[(?:1;10(?::[12])?[BF]|574(?:20|24);10(?::[12])?u|8;10(?::[12])?~|27;10;66~)$/],
65
- ["super+shift+home", /^\x1b\[(?:1;10(?::[12])?H|57423;10(?::[12])?u|7;10(?::[12])?~)$/],
66
- ["super+shift+end", /^\x1b\[(?:1;10(?::[12])?F|57424;10(?::[12])?u|8;10(?::[12])?~)$/],
67
- ]);
68
-
69
- const MODIFIER_ORDER = ["ctrl", "alt", "super", "shift"] as const;
70
- const MODIFIERS = new Set<string>(MODIFIER_ORDER);
71
- const NAMED_KEYS = new Set([
72
- "escape", "esc", "enter", "return", "tab", "space", "backspace", "delete", "insert", "clear",
73
- "home", "end", "pageup", "pagedown", "up", "down", "left", "right",
74
- ]);
75
- const SYMBOL_KEYS = new Set([
76
- "`", "-", "=", "[", "]", "\\", ";", "'", ",", ".", "/",
77
- "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "|", "~", "{", "}", ":", "<", ">", "?",
78
- ]);
79
- const RAW_RESERVED_SHORTCUTS = [
80
- "escape",
81
- "ctrl+c",
82
- "ctrl+d",
83
- "ctrl+z",
84
- "shift+tab",
85
- "ctrl+p",
86
- "shift+ctrl+p",
87
- "ctrl+l",
88
- "ctrl+o",
89
- "shift+ctrl+o",
90
- "ctrl+t",
91
- "ctrl+n",
92
- "ctrl+g",
93
- "alt+enter",
94
- "alt+up",
95
- "alt+down",
96
- "ctrl+v",
97
- "alt+v",
98
- "shift+l",
99
- "shift+t",
100
- "ctrl+s",
101
- "ctrl+r",
102
- "ctrl+backspace",
103
- "ctrl+a",
104
- "ctrl+x",
105
- "ctrl+u",
106
- ];
107
-
108
- export const RESERVED_BOTTOM_INPUT_SHORTCUTS = new Set(
109
- RAW_RESERVED_SHORTCUTS.map((shortcut) => shortcutConflictKey(normalizeShortcut(shortcut))).filter(Boolean),
110
- );
111
-
112
- export function resolveBottomInputShortcuts(value: Partial<BottomInputShortcuts> | undefined): BottomInputShortcuts {
113
- const resolved = { ...DEFAULT_BOTTOM_INPUT_SHORTCUTS };
114
- if (!value) return resolved;
115
- for (const key of SHORTCUT_KEYS) {
116
- const shortcut = typeof value[key] === "string" ? normalizeShortcut(value[key]) : "";
117
- if (shortcut) resolved[key] = shortcut;
118
- }
119
- return resolved;
120
- }
121
-
122
- export function shortcutUsesSuper(shortcut: string): boolean {
123
- const parts = normalizeShortcut(shortcut).split("+");
124
- return parts.slice(0, -1).includes("super");
125
- }
126
-
127
- export function isSupportedSuperShortcut(shortcut: string): boolean {
128
- return SUPER_SHORTCUT_PATTERNS.has(normalizeShortcut(shortcut));
129
- }
130
-
131
- export function shortcutConflictKey(shortcut: string): string {
132
- switch (normalizeShortcut(shortcut)) {
133
- case "super+home":
134
- return "super+up";
135
- case "super+end":
136
- return "super+down";
137
- case "super+shift+home":
138
- return "super+shift+up";
139
- case "super+shift+end":
140
- return "super+shift+down";
141
- default:
142
- return normalizeShortcut(shortcut);
143
- }
144
- }
145
-
146
- export function matchesConfiguredShortcut(data: string, shortcut: string): boolean {
147
- if (isKeyRelease(data)) return false;
148
- const normalizedShortcut = normalizeShortcut(shortcut);
149
- if (!normalizedShortcut) return false;
150
- if (shortcutUsesSuper(normalizedShortcut)) {
151
- return SUPER_SHORTCUT_PATTERNS.get(normalizedShortcut)?.test(data) ?? false;
152
- }
153
- return matchesKey(data, normalizedShortcut);
154
- }
155
-
156
- export function isStashShortcutInput(data: string, shortcut = DEFAULT_BOTTOM_INPUT_SHORTCUTS.stashEditor): boolean {
157
- if (isKeyRelease(data)) return false;
158
- if (normalizeShortcut(shortcut) !== "alt+s") {
159
- return matchesConfiguredShortcut(data, shortcut);
160
- }
161
- return data === "ß"
162
- || data === "\x1bs"
163
- || data === "\x1bS"
164
- || /^\x1b\[(?:83|115)(?::\d*)?(?::\d*)?;3(?::\d+)?u$/.test(data)
165
- || data === "\x1b[27;3;115~"
166
- || data === "\x1b[27;3;83~"
167
- || matchesKey(data, "alt+s");
168
- }
169
-
170
- export function normalizeShortcut(shortcut: string): string {
171
- const parts = shortcut
172
- .trim()
173
- .toLowerCase()
174
- .replace(/\s+/g, "")
175
- .split("+")
176
- .filter(Boolean)
177
- .map((part) => part === "cmd" || part === "command" ? "super" : part);
178
- if (parts.length === 0) return "";
179
-
180
- const key = normalizeKey(parts.at(-1)!);
181
- if (!key) return "";
182
- const modifiers = [...new Set(parts.slice(0, -1))].filter((part) => MODIFIERS.has(part));
183
- if (modifiers.length !== parts.slice(0, -1).length) return "";
184
- modifiers.sort((a, b) => MODIFIER_ORDER.indexOf(a as any) - MODIFIER_ORDER.indexOf(b as any));
185
- return [...modifiers, key].join("+");
186
- }
187
-
188
- export function validateShortcutChange(
189
- shortcuts: BottomInputShortcuts,
190
- key: BottomInputShortcutKey,
191
- candidate: string,
192
- ): ShortcutValidationResult {
193
- const normalized = normalizeShortcut(candidate);
194
- if (!normalized) return { ok: false, reason: "Unrecognized shortcut" };
195
- if (RESERVED_BOTTOM_INPUT_SHORTCUTS.has(shortcutConflictKey(normalized))) {
196
- return { ok: false, reason: "Reserved by DM" };
197
- }
198
- if (shortcutUsesSuper(normalized) && !isSupportedSuperShortcut(normalized)) {
199
- return { ok: false, reason: "Only Super/Command arrow shortcuts are supported" };
200
- }
201
- const conflictKey = shortcutConflictKey(normalized);
202
- for (const otherKey of SHORTCUT_KEYS) {
203
- if (otherKey === key) continue;
204
- if (shortcutConflictKey(shortcuts[otherKey]) === conflictKey) {
205
- return { ok: false, reason: `Conflicts with ${SHORTCUT_LABELS[otherKey]}` };
206
- }
207
- }
208
- return { ok: true, shortcut: normalized };
209
- }
210
-
211
- export function shortcutFromRawInput(data: string): string | null {
212
- if (isKeyRelease(data)) return null;
213
- for (const shortcut of enumerateKnownShortcuts()) {
214
- if (matchesConfiguredShortcut(data, shortcut)) return shortcut;
215
- }
216
- const csiU = parseCsiUShortcut(data);
217
- if (csiU) return csiU;
218
- if (/^\x1b.$/s.test(data)) {
219
- return normalizeShortcut(`alt+${data.slice(1)}`) || null;
220
- }
221
- if (data.length === 1) {
222
- const code = data.charCodeAt(0);
223
- if (code >= 1 && code <= 26) return `ctrl+${String.fromCharCode(code + 96)}`;
224
- if (code >= 32 && code < 127) return normalizeShortcut(data);
225
- }
226
- return null;
227
- }
228
-
229
- function normalizeKey(key: string): string {
230
- if (key === "esc") return "escape";
231
- if (key === "return") return "enter";
232
- if (key === "pgup") return "pageup";
233
- if (key === "pgdn") return "pagedown";
234
- if (/^[a-z0-9]$/.test(key) || NAMED_KEYS.has(key) || SYMBOL_KEYS.has(key)) return key;
235
- return "";
236
- }
237
-
238
- function parseCsiUShortcut(data: string): string | null {
239
- const match = /^\x1b\[(\d+);(\d+)u$/.exec(data);
240
- if (!match) return null;
241
- const code = Number(match[1]);
242
- const modifierValue = Number(match[2]);
243
- if (!Number.isFinite(code) || !Number.isFinite(modifierValue)) return null;
244
- const key = keyFromCodepoint(code);
245
- if (!key) return null;
246
- return normalizeShortcut([...modifiersFromCsiValue(modifierValue), key].join("+")) || null;
247
- }
248
-
249
- function keyFromCodepoint(code: number): string | null {
250
- if (code >= 65 && code <= 90) return String.fromCharCode(code + 32);
251
- if (code >= 97 && code <= 122) return String.fromCharCode(code);
252
- if (code >= 48 && code <= 57) return String.fromCharCode(code);
253
- const named: Record<number, string> = {
254
- 13: "enter",
255
- 27: "escape",
256
- 32: "space",
257
- 127: "backspace",
258
- 57399: "delete",
259
- 57419: "up",
260
- 57420: "down",
261
- 57421: "pageup",
262
- 57422: "pagedown",
263
- 57423: "home",
264
- 57424: "end",
265
- };
266
- return named[code] ?? (SYMBOL_KEYS.has(String.fromCharCode(code)) ? String.fromCharCode(code) : null);
267
- }
268
-
269
- function modifiersFromCsiValue(value: number): string[] {
270
- const mask = value - 1;
271
- const modifiers: string[] = [];
272
- if (mask & 4) modifiers.push("ctrl");
273
- if (mask & 2) modifiers.push("alt");
274
- if (mask & 8) modifiers.push("super");
275
- if (mask & 1) modifiers.push("shift");
276
- return modifiers;
277
- }
278
-
279
- function enumerateKnownShortcuts(): string[] {
280
- const keys = ["s", "c", "x", "u", "i", "g", ",", ".", "up", "down", "home", "end", "pageup", "pagedown"];
281
- const modifiers = ["ctrl", "alt", "super", "shift", "ctrl+alt", "ctrl+shift", "super+shift"];
282
- return [...new Set([
283
- ...Object.values(DEFAULT_BOTTOM_INPUT_SHORTCUTS),
284
- ...modifiers.flatMap((modifier) => keys.map((key) => `${modifier}+${key}`)),
285
- ])].map(normalizeShortcut).filter(Boolean);
286
- }