@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,33 +0,0 @@
1
-
2
- import type { AnimationsSettings } from "./settings.ts";
3
- import { enableAnimationsPatch, disableAnimationsPatch } from "./patch.ts";
4
- import { bindAnimationsRuntimeSession, configureAnimationsRuntime, disposeAnimationsRuntime, handleAnimationsAgentEnd, handleAnimationsAgentStart, handleAnimationsMessageEnd, handleAnimationsMessageUpdate, handleAnimationsToolExecutionEnd, handleAnimationsToolExecutionStart, pauseAnimationsRuntime, recordAnimationsLifecycleEvent, resumeAnimationsRuntime } from "./runtime.ts";
5
-
6
- export { ANIMATIONS, getAnimation, getAnimationsForCategory, pickRandomAnimation, renderAnimationFrame, resolveAnimationWidth } from "./registry.ts";
7
- export { AnimationsPreviewComponent } from "./preview.ts";
8
- export type { AnimationCategory, AnimationDefinition, AnimationPhase, AnimationWidth } from "./registry.ts";
9
- export { DEFAULT_ANIMATIONS_SETTINGS, normalizeAnimationsSettings } from "./settings.ts";
10
- export type { AnimationsSettings } from "./settings.ts";
11
- export { AnimatedThinkingComponent, THINKING_DONE_LABEL, getAnimationsRuntimeState, handleAnimationsAgentEnd, handleAnimationsAgentStart, handleAnimationsMessageEnd, handleAnimationsMessageUpdate, handleAnimationsToolExecutionEnd, handleAnimationsToolExecutionStart, pauseAnimationsRuntime, recordAnimationsLifecycleEvent, resumeAnimationsRuntime } from "./runtime.ts";
12
- export { disableAnimationsPatch, enableAnimationsPatch, getAnimationsPatchState } from "./patch.ts";
13
-
14
- export function configureAnimations(settings: AnimationsSettings): void {
15
- configureAnimationsRuntime(settings);
16
- if (settings.enabled) {
17
- enableAnimationsPatch();
18
- } else {
19
- disableAnimationsPatch();
20
- }
21
- }
22
-
23
- export function bindAnimationsSession(ctx: any): void {
24
- bindAnimationsRuntimeSession(ctx);
25
- }
26
-
27
- export function disposeAnimations(): void {
28
- try {
29
- disposeAnimationsRuntime();
30
- } finally {
31
- disableAnimationsPatch();
32
- }
33
- }
@@ -1,112 +0,0 @@
1
-
2
- import { AssistantMessageComponent } from "@mariozechner/pi-coding-agent";
3
- import { Text } from "@mariozechner/pi-tui";
4
- import { AnimatedThinkingComponent, THINKING_DONE_LABEL, getAnimationsRuntimeState } from "./runtime.ts";
5
-
6
- const ANIMATIONS_PATCH_KEY = Symbol.for("alps.dm.animations.patch.v1");
7
-
8
- export type AnimationsPatchState = {
9
- enabled: boolean;
10
- originalUpdateContent?: Function;
11
- wrappedUpdateContent?: Function;
12
- };
13
-
14
- export function getAnimationsPatchState(): AnimationsPatchState {
15
- const existing = (globalThis as any)[ANIMATIONS_PATCH_KEY] as AnimationsPatchState | undefined;
16
- if (existing) return existing;
17
- const state: AnimationsPatchState = { enabled: false };
18
- (globalThis as any)[ANIMATIONS_PATCH_KEY] = state;
19
- return state;
20
- }
21
-
22
- export function enableAnimationsPatch(): AnimationsPatchState {
23
- const state = getAnimationsPatchState();
24
- const proto = AssistantMessageComponent.prototype as any;
25
- if (state.enabled && proto.updateContent === state.wrappedUpdateContent) return state;
26
- if (typeof proto.updateContent !== "function") return state;
27
- const original = state.originalUpdateContent ?? proto.updateContent;
28
- state.originalUpdateContent = original;
29
- state.wrappedUpdateContent = function patchedUpdateContent(this: any, message: any) {
30
- const runtimeState = getAnimationsRuntimeState();
31
- try {
32
- if (runtimeState.settings.enabled && this.__alpsDmAnimatedThinkingApplied) disposeExistingAnimatedThinking(this);
33
- } catch {
34
- }
35
- original.call(this, message);
36
- try {
37
- replaceHiddenThinkingLabels(this, message);
38
- } catch (error) {
39
- console.debug?.("[dm-alps] Animations hidden thinking patch failed:", error);
40
- }
41
- };
42
- proto.updateContent = state.wrappedUpdateContent;
43
- state.enabled = true;
44
- return state;
45
- }
46
-
47
- export function disableAnimationsPatch(): AnimationsPatchState {
48
- const state = getAnimationsPatchState();
49
- const proto = AssistantMessageComponent.prototype as any;
50
- if (state.originalUpdateContent && proto.updateContent === state.wrappedUpdateContent) {
51
- proto.updateContent = state.originalUpdateContent;
52
- }
53
- state.enabled = false;
54
- state.wrappedUpdateContent = undefined;
55
- state.originalUpdateContent = undefined;
56
- return state;
57
- }
58
-
59
- function disposeExistingAnimatedThinking(instance: any): void {
60
- const children = instance?.contentContainer?.children;
61
- if (!Array.isArray(children)) return;
62
- for (const child of children) {
63
- if (child instanceof AnimatedThinkingComponent) child.dispose();
64
- }
65
- instance.__alpsDmAnimatedThinkingApplied = false;
66
- }
67
-
68
- function replaceHiddenThinkingLabels(instance: any, message: any): void {
69
- const runtimeState = getAnimationsRuntimeState();
70
- if (!runtimeState.settings.enabled) return;
71
- if (!instance?.hideThinkingBlock) return;
72
- if (!messageHasThinking(message)) return;
73
- const children = instance.contentContainer?.children;
74
- if (!Array.isArray(children)) return;
75
- const shouldAnimate = shouldAnimateHiddenThinking(runtimeState, message);
76
- for (let index = 0; index < children.length; index += 1) {
77
- const child = children[index];
78
- if (!isHiddenThinkingText(instance, child)) continue;
79
- if (shouldAnimate) {
80
- children[index] = new AnimatedThinkingComponent(runtimeState, undefined, false, readStyledCompletionLabel(child));
81
- instance.__alpsDmAnimatedThinkingApplied = true;
82
- } else if (shouldFreezeHiddenThinking(message)) {
83
- children[index] = createCompletedThinkingText(child);
84
- }
85
- }
86
- }
87
-
88
- function messageHasThinking(message: any): boolean {
89
- return Array.isArray(message?.content) && message.content.some((content: any) => content?.type === "thinking" && typeof content.thinking === "string" && content.thinking.trim());
90
- }
91
-
92
- function shouldFreezeHiddenThinking(message: any): boolean {
93
- return message?.stopReason !== undefined || Array.isArray(message?.content) && message.content.some((content: any) => content?.type === "text" && typeof content.text === "string" && content.text.trim());
94
- }
95
-
96
- function shouldAnimateHiddenThinking(runtimeState: ReturnType<typeof getAnimationsRuntimeState>, message: any): boolean {
97
- return runtimeState.animating && runtimeState.currentAssistantMessage === message && !shouldFreezeHiddenThinking(message);
98
- }
99
-
100
- function createCompletedThinkingText(child: any): Text {
101
- return new Text(readStyledCompletionLabel(child) ?? THINKING_DONE_LABEL, 1, 0);
102
- }
103
-
104
- function readStyledCompletionLabel(child: any): string | undefined {
105
- return typeof child?.text === "string" ? child.text.replace(/Thinking\.\.\./g, THINKING_DONE_LABEL) : undefined;
106
- }
107
-
108
- function isHiddenThinkingText(instance: any, child: any): boolean {
109
- if (!child || typeof child.text !== "string") return false;
110
- const label = typeof instance.hiddenThinkingLabel === "string" ? instance.hiddenThinkingLabel : "Thinking...";
111
- return child.text.includes(label) || child.text.includes("Thinking...") || child.text.includes(THINKING_DONE_LABEL);
112
- }
@@ -1,117 +0,0 @@
1
-
2
- import { Key, matchesKey, truncateToWidth, visibleWidth, type Component } from "@mariozechner/pi-tui";
3
- import { ANIMATIONS, renderAnimationFrame, resolveAnimationWidth, type AnimationDefinition, type AnimationPhase } from "./registry.ts";
4
- import type { AnimationsSettings } from "./settings.ts";
5
- import type { ThemeLike } from "../chrome-frame/styles.ts";
6
-
7
- type PreviewThemeLike = Pick<ThemeLike, "fg">;
8
-
9
- const PHASES: AnimationPhase[] = ["thinking", "working", "tool"];
10
- const PREVIEW_FPS = 12;
11
-
12
- export type AnimationsPreviewOptions = {
13
- settings: AnimationsSettings;
14
- theme: PreviewThemeLike;
15
- onClose: () => void;
16
- requestRender?: () => void;
17
- };
18
-
19
- export class AnimationsPreviewComponent implements Component {
20
- private readonly settings: AnimationsSettings;
21
- private readonly theme: PreviewThemeLike;
22
- private readonly onClose: () => void;
23
- private readonly requestRender?: () => void;
24
- private readonly timer: ReturnType<typeof setInterval>;
25
- private disposed = false;
26
- private frame = 0;
27
- private selectedIndex = 0;
28
- private phaseIndex = 0;
29
-
30
- constructor(options: AnimationsPreviewOptions) {
31
- this.settings = options.settings;
32
- this.theme = options.theme;
33
- this.onClose = options.onClose;
34
- this.requestRender = options.requestRender;
35
- this.timer = setInterval(() => {
36
- if (this.disposed) return;
37
- this.frame += 1;
38
- this.requestRender?.();
39
- }, Math.round(1000 / PREVIEW_FPS));
40
- this.timer.unref?.();
41
- }
42
-
43
- dispose(): void {
44
- if (this.disposed) return;
45
- this.disposed = true;
46
- clearInterval(this.timer);
47
- }
48
-
49
- render(width: number): string[] {
50
- const safeWidth = Math.max(20, Math.floor(width));
51
- const animation = this.currentAnimation();
52
- const phase = PHASES[this.phaseIndex] ?? "thinking";
53
- const animationWidth = Math.max(1, Math.min(resolveAnimationWidth(this.settings.width, safeWidth), safeWidth - 4));
54
- const frameLines = renderAnimationFrame(animation.name, this.frame, animationWidth, phase);
55
- return [
56
- this.fit(this.accent("Animation Preview"), safeWidth),
57
- "",
58
- this.fit(`${this.muted(`[${this.selectedIndex + 1}/${ANIMATIONS.length}]`)} ${this.accent(animation.name)}`, safeWidth),
59
- this.fit(`category: ${animation.category} · lines: ${animation.lines} · phase: ${phase}`, safeWidth),
60
- this.fit(this.muted(animation.description), safeWidth),
61
- "",
62
- ...frameLines.map((line) => this.fit(` ${line}`, safeWidth)),
63
- "",
64
- this.fit(this.muted("↑/↓ switch · Tab phase · Esc/q back"), safeWidth),
65
- ];
66
- }
67
-
68
- invalidate(): void {}
69
-
70
- handleInput(data: string): void {
71
- if (matchesKey(data, Key.escape) || data === "q" || data === "Q") {
72
- this.close();
73
- return;
74
- }
75
- if (matchesKey(data, Key.up)) {
76
- this.selectedIndex = (this.selectedIndex - 1 + ANIMATIONS.length) % ANIMATIONS.length;
77
- return;
78
- }
79
- if (matchesKey(data, Key.down)) {
80
- this.selectedIndex = (this.selectedIndex + 1) % ANIMATIONS.length;
81
- return;
82
- }
83
- if (data === "\t") {
84
- this.phaseIndex = (this.phaseIndex + 1) % PHASES.length;
85
- }
86
- }
87
-
88
- private close(): void {
89
- this.dispose();
90
- this.onClose();
91
- }
92
-
93
- private currentAnimation(): AnimationDefinition {
94
- return ANIMATIONS[this.selectedIndex] ?? ANIMATIONS[0]!;
95
- }
96
-
97
- private fit(text: string, width: number): string {
98
- const clipped = truncateToWidth(text, width, "", false);
99
- return clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
100
- }
101
-
102
- private accent(text: string): string {
103
- return this.safeFg("accent", text);
104
- }
105
-
106
- private muted(text: string): string {
107
- return this.safeFg("dim", text);
108
- }
109
-
110
- private safeFg(token: string, text: string): string {
111
- try {
112
- return this.theme.fg(token, text);
113
- } catch {
114
- return text;
115
- }
116
- }
117
- }