dsh-open-in-dsh 0.3.2 → 0.3.4
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/lib/index.js +6 -0
- package/lib/types/index.d.ts +12 -1
- package/package.json +2 -2
- package/scripts/macos/open-in-dsh +13 -3
package/lib/index.js
CHANGED
|
@@ -279,31 +279,37 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
279
279
|
host.effect(() => host.webServer.register({
|
|
280
280
|
kind: 'exact',
|
|
281
281
|
path: ROUTE_OPEN,
|
|
282
|
+
auth: 'anonymous',
|
|
282
283
|
handler: createOpenHandler(ctx, hub, allowNonLoopback),
|
|
283
284
|
}), 'dsh-open-in-dsh: open route');
|
|
284
285
|
host.effect(() => host.webServer.register({
|
|
285
286
|
kind: 'exact',
|
|
286
287
|
path: ROUTE_EVENTS,
|
|
288
|
+
auth: 'anonymous',
|
|
287
289
|
handler: createEventsHandler(ctx, hub, allowNonLoopback),
|
|
288
290
|
}), 'dsh-open-in-dsh: events route');
|
|
289
291
|
host.effect(() => host.webServer.register({
|
|
290
292
|
kind: 'exact',
|
|
291
293
|
path: ROUTE_STATUS,
|
|
294
|
+
auth: 'anonymous',
|
|
292
295
|
handler: createStatusHandler(hub, allowNonLoopback),
|
|
293
296
|
}), 'dsh-open-in-dsh: status route');
|
|
294
297
|
host.effect(() => host.webServer.register({
|
|
295
298
|
kind: 'exact',
|
|
296
299
|
path: ROUTE_APPS,
|
|
300
|
+
auth: 'anonymous',
|
|
297
301
|
handler: createAppsHandler(allowNonLoopback),
|
|
298
302
|
}), 'dsh-open-in-dsh: apps route');
|
|
299
303
|
host.effect(() => host.webServer.register({
|
|
300
304
|
kind: 'exact',
|
|
301
305
|
path: ROUTE_OPEN_WITH,
|
|
306
|
+
auth: 'anonymous',
|
|
302
307
|
handler: createOpenWithHandler(ctx, allowNonLoopback),
|
|
303
308
|
}), 'dsh-open-in-dsh: open-with route');
|
|
304
309
|
host.effect(() => host.webServer.register({
|
|
305
310
|
kind: 'exact',
|
|
306
311
|
path: ROUTE_OPEN_SESSION,
|
|
312
|
+
auth: 'anonymous',
|
|
307
313
|
handler: createOpenSessionHandler(ctx, allowNonLoopback, {
|
|
308
314
|
resolveCwd: (sessionId) => resolveSessionCwd(sessionId, { live: createLiveCwdReader(ctx) }),
|
|
309
315
|
}),
|
package/lib/types/index.d.ts
CHANGED
|
@@ -34,11 +34,22 @@ export interface EventStream {
|
|
|
34
34
|
}
|
|
35
35
|
/** One incoming HTTP request handler, as `webServer.register` takes it. */
|
|
36
36
|
export type RouteHandler = (request: IncomingMessage, response: ServerResponse) => void | Promise<void>;
|
|
37
|
-
/** The
|
|
37
|
+
/** The `auth` policy a WebServer route accepts since DSH 0.2.2-rc.2. */
|
|
38
|
+
export type WebAuthPolicy = 'anonymous' | 'required' | 'deny';
|
|
39
|
+
/**
|
|
40
|
+
* The exact-route row this plugin registers.
|
|
41
|
+
*
|
|
42
|
+
* Every route here is a loopback-fenced callback for this machine's own
|
|
43
|
+
* launcher scripts (Finder/Explorer, macOS `open` helper) rather than a page
|
|
44
|
+
* fetch, so each one declares `auth: 'anonymous'`: DSH 0.2.2-rc.2 made
|
|
45
|
+
* `required` the default and the TCP launchers have no cookie to present
|
|
46
|
+
* (`401`). The handlers keep their own loopback + same-origin fences.
|
|
47
|
+
*/
|
|
38
48
|
export interface ExactRoute {
|
|
39
49
|
kind: 'exact';
|
|
40
50
|
path: string;
|
|
41
51
|
handler: RouteHandler;
|
|
52
|
+
auth?: WebAuthPolicy;
|
|
42
53
|
}
|
|
43
54
|
/** The `webServer` service slice the plugin uses. */
|
|
44
55
|
export interface WebServerService {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-open-in-dsh",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=24",
|
|
43
|
-
"dsh": "^0.2.1-rc.2 || ^0.2.2-alpha.2"
|
|
43
|
+
"dsh": "^0.2.1-rc.2 || ^0.2.2-alpha.2 || ^0.2.3-alpha.1"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
@@ -122,11 +122,21 @@ bundle_executable() {
|
|
|
122
122
|
# Desktop Beta 2.0.18-beta.1, pgrep -f sees every helper and crash-reporting
|
|
123
123
|
# process of the app but *not* the packaged main process, so a running app read
|
|
124
124
|
# as "closed" and every click would take the cold-start path. `ps -ww` prints
|
|
125
|
-
# the untruncated command line
|
|
126
|
-
#
|
|
125
|
+
# the untruncated command line.
|
|
126
|
+
#
|
|
127
|
+
# The match is a prefix match, not an exact one. The packaged main process now
|
|
128
|
+
# carries arguments: an auto-update relaunches it as `<exe> --updated` (DSH
|
|
129
|
+
# Desktop Beta 2.0.23-beta.1, measured 2026-11-14), and the host it spawns is
|
|
130
|
+
# `<exe> --expose-internals … host.js …`. An exact match read a just-updated
|
|
131
|
+
# app as closed, so *every* click took the cold-start path — which is why the
|
|
132
|
+
# cold-start-only `socket_ready` bug surfaced right after each update. Helper
|
|
133
|
+
# processes live under `Contents/Frameworks/… Helper.app/`, a different prefix,
|
|
134
|
+
# so they still never match.
|
|
127
135
|
is_running() {
|
|
128
136
|
[ -n "$1" ] || return 1
|
|
129
|
-
ps -ww -Ao command= 2>/dev/null |
|
|
137
|
+
ps -ww -Ao command= 2>/dev/null | awk -v exe="$1" '
|
|
138
|
+
index($0, exe) == 1 && (length($0) == length(exe) || substr($0, length(exe) + 1, 1) == " ") { found = 1 }
|
|
139
|
+
END { exit found ? 0 : 1 }'
|
|
130
140
|
}
|
|
131
141
|
|
|
132
142
|
# A running instance always wins: the click is meant for the DSH the user is
|