@linxin666/dsh-client-ui-browser-view 0.4.14 → 0.4.16
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/README.i18n.yaml +2 -2
- package/README.md +3 -3
- package/README.zh.md +3 -3
- package/lib/client.js +2 -2
- package/lib/client.js.map +1 -1
- package/lib/index.js +2616 -5280
- package/lib/types/client/plugin-card-seat.d.ts +1 -1
- package/lib/types/core/cdp.d.ts +29 -5
- package/lib/types/host/service.d.ts +48 -2
- package/package.json +18 -18
|
@@ -56,7 +56,7 @@ export interface PluginCardContext {
|
|
|
56
56
|
/** Service lookup; absent on a context double that only models the slots. */
|
|
57
57
|
get?(name: string): unknown;
|
|
58
58
|
/** Event subscription seat; absent on an event-less test double. */
|
|
59
|
-
on?(event:
|
|
59
|
+
on?(event: never, listener: never): unknown;
|
|
60
60
|
}
|
|
61
61
|
/** Owner share of a family list-seat card (that seat supplies nothing). */
|
|
62
62
|
export interface SettingsPluginItemOwnerProps {
|
package/lib/types/core/cdp.d.ts
CHANGED
|
@@ -43,19 +43,43 @@ export interface CdpTransport {
|
|
|
43
43
|
* @returns the unsubscribe function.
|
|
44
44
|
*/
|
|
45
45
|
on(method: string, handler: CdpEventListener): () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the transport can still carry commands. False once the socket is
|
|
48
|
+
* gone — a peer that closed, a failed write, or {@link close} — because every
|
|
49
|
+
* later command would reject with the same stale reason.
|
|
50
|
+
*/
|
|
51
|
+
readonly closed: boolean;
|
|
46
52
|
/** Drop the socket; every pending round-trip rejects. */
|
|
47
53
|
close(): void;
|
|
48
54
|
}
|
|
49
55
|
/** One protocol event delivery. */
|
|
50
56
|
export type CdpEventListener = (params: Record<string, unknown>, sessionId: string | undefined) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Default deadline for opening the DevTools socket. A freshly launched browser
|
|
59
|
+
* answers at once, so this only bounds a wedged endpoint; an external browser
|
|
60
|
+
* is reached over a network path the caller controls and sets its own.
|
|
61
|
+
*/
|
|
62
|
+
export declare const CDP_HANDSHAKE_TIMEOUT_MS = 30000;
|
|
51
63
|
/** Default per-command deadline; long enough for a navigation, short enough to fail a wedged tab. */
|
|
52
64
|
export declare const CDP_COMMAND_TIMEOUT_MS = 30000;
|
|
65
|
+
/**
|
|
66
|
+
* Deadlines for one connection. They bound different phases and are therefore
|
|
67
|
+
* separate knobs: opening the socket is bounded once, while every command gets
|
|
68
|
+
* the command budget, so a caller may wait seconds for a browser to answer
|
|
69
|
+
* without shortening the time a navigation is allowed to take.
|
|
70
|
+
*/
|
|
71
|
+
export interface CdpConnectOptions {
|
|
72
|
+
/** Deadline for the WebSocket handshake. @default CDP_HANDSHAKE_TIMEOUT_MS */
|
|
73
|
+
handshakeTimeoutMs?: number;
|
|
74
|
+
/** Deadline for each protocol command. @default CDP_COMMAND_TIMEOUT_MS */
|
|
75
|
+
commandTimeoutMs?: number;
|
|
76
|
+
}
|
|
53
77
|
/**
|
|
54
78
|
* A single WebSocket carrying browser-level and flat-session protocol traffic.
|
|
55
79
|
*/
|
|
56
80
|
export declare class CdpClient implements CdpTransport {
|
|
57
81
|
private readonly socket;
|
|
58
|
-
private readonly
|
|
82
|
+
private readonly commandTimeoutMs;
|
|
59
83
|
private readonly pending;
|
|
60
84
|
private readonly listeners;
|
|
61
85
|
private nextId;
|
|
@@ -64,13 +88,13 @@ export declare class CdpClient implements CdpTransport {
|
|
|
64
88
|
/**
|
|
65
89
|
* Open a client against an already-discovered DevTools endpoint.
|
|
66
90
|
* @param url - `webSocketDebuggerUrl` from `/json/version`.
|
|
67
|
-
* @param options - command
|
|
91
|
+
* @param options - handshake and per-command deadlines, independently.
|
|
68
92
|
* @returns a connected client.
|
|
69
93
|
* @throws CdpError when the socket cannot be established in time.
|
|
70
94
|
*/
|
|
71
|
-
static connect(url: string, options?:
|
|
72
|
-
|
|
73
|
-
|
|
95
|
+
static connect(url: string, options?: CdpConnectOptions): Promise<CdpClient>;
|
|
96
|
+
/** Whether the socket is gone and every later command will be refused. */
|
|
97
|
+
get closed(): boolean;
|
|
74
98
|
/**
|
|
75
99
|
* Address one protocol command.
|
|
76
100
|
* @param method - CDP method.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @module @linxin666/dsh-client-ui-browser-view/host/service
|
|
21
21
|
*/
|
|
22
|
-
import type { CdpTransport } from '../core/cdp.ts';
|
|
22
|
+
import type { CdpConnectOptions, CdpTransport } from '../core/cdp.ts';
|
|
23
23
|
import { ChromeProcess } from '../core/chrome.ts';
|
|
24
24
|
import { TabManager, type ScreencastFrame } from '../core/tabs.ts';
|
|
25
25
|
import { type ScreenshotPlan, type ScreenshotRequest } from '../core/screenshot.ts';
|
|
@@ -100,6 +100,24 @@ export interface BrowserViewServiceOptions {
|
|
|
100
100
|
/** Browser factory, replaced by tests. */
|
|
101
101
|
openSession?: (options: OpenSessionOptions) => Promise<BrowserSession>;
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Handshake deadline for an external browser. Its debugger port is already
|
|
105
|
+
* listening, so an endpoint that does not complete the upgrade within this
|
|
106
|
+
* window is wedged; the per-command budget is a separate setting and is left at
|
|
107
|
+
* `CDP_COMMAND_TIMEOUT_MS`, exactly as in the isolated mode.
|
|
108
|
+
*/
|
|
109
|
+
export declare const REAL_BROWSER_HANDSHAKE_TIMEOUT_MS = 5000;
|
|
110
|
+
/**
|
|
111
|
+
* Seams the external session factory resolves when it connects. The defaults
|
|
112
|
+
* are the production transport; a test injects one to observe what a
|
|
113
|
+
* real-browser attach asks for without starting a browser.
|
|
114
|
+
*/
|
|
115
|
+
export interface ExternalSessionSeams {
|
|
116
|
+
/** Open the DevTools transport. @default CdpClient.connect */
|
|
117
|
+
connect?: (url: string, timeouts: CdpConnectOptions) => Promise<CdpTransport>;
|
|
118
|
+
}
|
|
119
|
+
/** Connect to an existing real browser without owning its process or tabs. */
|
|
120
|
+
export declare function openExternalSession(options: OpenSessionOptions, seams?: ExternalSessionSeams): Promise<BrowserSession>;
|
|
103
121
|
/**
|
|
104
122
|
* The plugin's single browser service.
|
|
105
123
|
*/
|
|
@@ -384,8 +402,36 @@ export declare class BrowserViewService implements BrowserViewBackend {
|
|
|
384
402
|
private transport;
|
|
385
403
|
/** Resolve the live session or start one. */
|
|
386
404
|
private requireTabs;
|
|
387
|
-
/**
|
|
405
|
+
/**
|
|
406
|
+
* Forget everything bound to the current session without disposing it: the
|
|
407
|
+
* per-session tab bindings, the watched tab, the pinned selection and the
|
|
408
|
+
* spent auth tickets all describe a browser that is going away.
|
|
409
|
+
* @returns the session that was dropped, if any.
|
|
410
|
+
*/
|
|
411
|
+
private forgetSession;
|
|
412
|
+
/**
|
|
413
|
+
* Resolve the live session, starting the browser on first use.
|
|
414
|
+
*
|
|
415
|
+
* A session whose transport has closed is dead even though its record still
|
|
416
|
+
* exists: the external browser restarted, crashed, or dropped the socket, and
|
|
417
|
+
* every command would reject with that one stale reason for the rest of the
|
|
418
|
+
* host's life. The next call therefore drops it exactly the way a settings
|
|
419
|
+
* change does and opens a replacement, so the caller recovers instead of
|
|
420
|
+
* needing a reconfigure or a restart. The replacement goes through `opening`,
|
|
421
|
+
* so concurrent callers share one session instead of opening two.
|
|
422
|
+
*/
|
|
388
423
|
private requireSession;
|
|
424
|
+
/**
|
|
425
|
+
* Drop a closed session and open its replacement.
|
|
426
|
+
*
|
|
427
|
+
* The cleanup is the settings-change cleanup: an external browser is only
|
|
428
|
+
* detached, never closed, and its tabs stay open. A teardown that throws is
|
|
429
|
+
* swallowed because the dead session has nothing left to deliver — its
|
|
430
|
+
* failure must not be the reason no replacement starts.
|
|
431
|
+
* @param stale - the dead session, or undefined for an ordinary first start.
|
|
432
|
+
* @returns the live session.
|
|
433
|
+
*/
|
|
434
|
+
private replaceSession;
|
|
389
435
|
/** Start the browser once, recording failures for the panel. */
|
|
390
436
|
private startSession;
|
|
391
437
|
/** Start the screencast for the tab the panel watches. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-client-ui-browser-view",
|
|
3
3
|
"description": "Right-docked live browser view for the DSH Web GUI: a CDP-driven Chromium the agent operates, a screencast panel the user watches, and screenshots attached to every tool result.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.16",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dsh": {
|
|
24
24
|
"engines": {
|
|
25
|
-
"dsh": ">=0.2.
|
|
25
|
+
"dsh": ">=0.2.2-rc.1"
|
|
26
26
|
},
|
|
27
27
|
"bundle": {
|
|
28
28
|
"patch": "./cordis.patch.yml"
|
|
@@ -45,26 +45,26 @@
|
|
|
45
45
|
"ws": "^8.18.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@deepseek-ai/dsh": ">=0.2.
|
|
48
|
+
"@deepseek-ai/dsh": ">=0.2.2-rc.1",
|
|
49
49
|
"react": "^18.2.0",
|
|
50
50
|
"react-dom": "^18.2.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@deepseek-ai/cordis": "^4.0
|
|
54
|
-
"@deepseek-ai/dsh-api-remotes": "0.2.
|
|
55
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.
|
|
56
|
-
"@deepseek-ai/dsh-client-store": "0.2.
|
|
57
|
-
"@deepseek-ai/dsh-client-ui-layout": "^0.2.
|
|
58
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.2.
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-sidebar-right": "^0.2.
|
|
63
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.
|
|
64
|
-
"@deepseek-ai/dsh-host-webserver": "^0.2.
|
|
65
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.
|
|
66
|
-
"@deepseek-ai/dsh-tools": "^0.2.
|
|
67
|
-
"@deepseek-ai/schemastery": "^3.
|
|
53
|
+
"@deepseek-ai/cordis": "^4.1.0",
|
|
54
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
|
|
55
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.2-rc.1",
|
|
56
|
+
"@deepseek-ai/dsh-client-store": "0.2.2-rc.1",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.2.2-rc.1",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.2-rc.1",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.2-rc.1",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.1",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.1",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "^0.2.2-rc.1",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.1",
|
|
64
|
+
"@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.1",
|
|
65
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.1",
|
|
66
|
+
"@deepseek-ai/dsh-tools": "^0.2.2-rc.1",
|
|
67
|
+
"@deepseek-ai/schemastery": "^3.19.0",
|
|
68
68
|
"@types/node": "^22.20.0",
|
|
69
69
|
"@types/react": "~18.3.1",
|
|
70
70
|
"@types/react-dom": "^18.3.5",
|