dsh-side-window 0.0.0-stage → 0.5.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/locale/en.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Side window",
4
+ "description": "Summons a window that slides out from the right edge and runs the DSH web UI inside it. It can follow the conversation open in the main DSH window, and a hotkey brings it up whenever you need it, without keeping the main DSH page open in front of you. Windows only for now.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "侧栏窗口",
4
+ "description": "可以召唤一个从右侧滑出的窗口,内置了网页版dsh,可以同步主dsh的对话,可以随时快捷键唤出,无需打开主dsh页面占据视觉中心。目前只做了Windows的适配。",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
- {
1
+ {
2
2
  "name": "dsh-side-window",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.5.8",
4
+ "description": "Turn DeepSeek Harness into an edge-docked side window (self-written Electron shell plus an editable settings page). Windows only.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "index.js",
8
+ "os": ["win32"],
9
+ "homepage": "https://github.com/yehcehn/dsh-side-window#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/yehcehn/dsh-side-window.git"
13
+ },
14
+ "keywords": ["dsh-plugin", "deepseek-harness", "side-window", "electron"],
15
+ "exports": {
16
+ ".": { "default": "./index.js" },
17
+ "./client": { "default": "./client.js" },
18
+ "./package.json": "./package.json",
19
+ "./icon": "./icon.svg",
20
+ "./locale/*.json": "./locale/*.json"
21
+ },
22
+ "files": ["index.js", "client.js", "cordis.patch.yml", "shell", "locale", "docs", "icon.svg"],
23
+ "dependencies": {
24
+ "@electron-internal/extract-zip": "^1.0.5",
25
+ "@electron/get": "^5.1.0"
26
+ },
27
+ "dsh": {
28
+ "bundle": { "patch": "./cordis.patch.yml" },
29
+ "client": {
30
+ "inject": [
31
+ "@deepseek-ai/dsh-client-connection",
32
+ "@deepseek-ai/dsh-client-ui-context-menu",
33
+ "@deepseek-ai/dsh-client-ui-sidebar-right"
34
+ ],
35
+ "platform": "web"
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,139 @@
1
+ # Bring a process's top-level visible window to the system foreground, and answer
2
+ # "who is the foreground window right now".
3
+ #
4
+ # Why this exists: autoHideOnBlur had only one trigger, the `blur` event, and Windows
5
+ # silently refuses SetForegroundWindow from a background process. Electron's win.focus()
6
+ # still reports success and emits `focus`, but the OS foreground never changes, so a later
7
+ # click elsewhere produces no WM_ACTIVATE(FALSE) and the window can never be dismissed.
8
+ # SwitchToThisWindow alone is not enough either: the foreground keeps hopping between
9
+ # other processes. Attaching to the current foreground thread and then calling
10
+ # SetForegroundWindow is the reliable path.
11
+ #
12
+ # Started by main.js and driven over stdin, one line per command:
13
+ # force <pid> -> bring that process's top-level visible window to the foreground
14
+ # fg -> report the current foreground window: "<hwnd> <pid>"
15
+ #
16
+ # NOTE: keep this file ASCII-only. Windows PowerShell 5.1 reads a BOM-less script as ANSI,
17
+ # and a multi-byte character right before a newline can swallow that newline, which breaks
18
+ # the embedded C# source.
19
+ $ErrorActionPreference = 'Stop'
20
+
21
+ $sig = @'
22
+ using System;
23
+ using System.Runtime.InteropServices;
24
+
25
+ public class DshFocus
26
+ {
27
+ private delegate bool EnumProc(IntPtr hWnd, IntPtr lParam);
28
+
29
+ [DllImport("user32.dll")]
30
+ private static extern bool EnumWindows(EnumProc cb, IntPtr lParam);
31
+
32
+ [DllImport("user32.dll")]
33
+ private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint pid);
34
+
35
+ [DllImport("user32.dll")]
36
+ private static extern bool IsWindowVisible(IntPtr hWnd);
37
+
38
+ [DllImport("user32.dll")]
39
+ private static extern void SwitchToThisWindow(IntPtr hWnd, bool altTab);
40
+
41
+ [DllImport("user32.dll")]
42
+ private static extern IntPtr GetForegroundWindow();
43
+
44
+ [DllImport("user32.dll")]
45
+ private static extern bool SetForegroundWindow(IntPtr hWnd);
46
+
47
+ [DllImport("user32.dll")]
48
+ private static extern bool BringWindowToTop(IntPtr hWnd);
49
+
50
+ [DllImport("user32.dll")]
51
+ private static extern IntPtr SetActiveWindow(IntPtr hWnd);
52
+
53
+ [DllImport("user32.dll")]
54
+ private static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach);
55
+
56
+ [DllImport("kernel32.dll")]
57
+ private static extern uint GetCurrentThreadId();
58
+
59
+ private static IntPtr Find(uint target)
60
+ {
61
+ IntPtr found = IntPtr.Zero;
62
+ EnumWindows((h, l) =>
63
+ {
64
+ uint pid;
65
+ GetWindowThreadProcessId(h, out pid);
66
+ if (pid == target && IsWindowVisible(h))
67
+ {
68
+ found = h;
69
+ return false;
70
+ }
71
+ return true;
72
+ }, IntPtr.Zero);
73
+ return found;
74
+ }
75
+
76
+ private static string Outcome(uint target, IntPtr hwnd)
77
+ {
78
+ uint pid;
79
+ GetWindowThreadProcessId(GetForegroundWindow(), out pid);
80
+ return (pid == target ? "ok " : "failed ") + hwnd.ToInt64();
81
+ }
82
+
83
+ public static string Force(uint target)
84
+ {
85
+ IntPtr found = Find(target);
86
+ if (found == IntPtr.Zero) return "no-window";
87
+
88
+ SwitchToThisWindow(found, true);
89
+ uint fgPid;
90
+ uint fgThread = GetWindowThreadProcessId(GetForegroundWindow(), out fgPid);
91
+ if (fgPid == target) return "ok " + found.ToInt64();
92
+
93
+ uint ourThread = GetCurrentThreadId();
94
+ bool attached = false;
95
+ if (fgThread != 0 && fgThread != ourThread)
96
+ {
97
+ attached = AttachThreadInput(fgThread, ourThread, true);
98
+ }
99
+ BringWindowToTop(found);
100
+ SetForegroundWindow(found);
101
+ SetActiveWindow(found);
102
+ if (attached) AttachThreadInput(fgThread, ourThread, false);
103
+
104
+ return Outcome(target, found);
105
+ }
106
+
107
+ public static string Foreground()
108
+ {
109
+ IntPtr h = GetForegroundWindow();
110
+ uint pid;
111
+ GetWindowThreadProcessId(h, out pid);
112
+ return h.ToInt64() + " " + pid;
113
+ }
114
+ }
115
+ '@
116
+
117
+ Add-Type -TypeDefinition $sig
118
+
119
+ while ($true) {
120
+ $line = [Console]::In.ReadLine()
121
+ if ($null -eq $line) { break }
122
+ if ($line -match '^\s*force\s+(\d+)\s*$') {
123
+ try {
124
+ [Console]::Out.WriteLine('force ' + [DshFocus]::Force([uint32]$Matches[1]))
125
+ } catch {
126
+ [Console]::Out.WriteLine('force error ' + $_.Exception.Message)
127
+ }
128
+ [Console]::Out.Flush()
129
+ continue
130
+ }
131
+ if ($line -match '^\s*fg\s*$') {
132
+ try {
133
+ [Console]::Out.WriteLine('fg ' + [DshFocus]::Foreground())
134
+ } catch {
135
+ [Console]::Out.WriteLine('fg error ' + $_.Exception.Message)
136
+ }
137
+ [Console]::Out.Flush()
138
+ }
139
+ }