@linxin666/dsh-client-ui-browser-view 0.4.16 → 0.4.18
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 +7 -3
- package/README.zh.md +7 -3
- package/lib/client.js +126 -31
- package/lib/client.js.map +1 -1
- package/lib/index.js +239 -45
- package/lib/types/client/BrowserViewSettingsCard.d.ts +2 -0
- package/lib/types/client/locales.d.ts +4 -0
- package/lib/types/client/settings-entry-form.d.ts +1 -1
- package/lib/types/core/tabs.d.ts +24 -0
- package/lib/types/host/config.d.ts +3 -0
- package/lib/types/host/service.d.ts +38 -0
- package/package.json +16 -16
|
@@ -97,6 +97,13 @@ export interface BrowserViewServiceOptions {
|
|
|
97
97
|
authenticatedUrl?: (url: string) => string | undefined;
|
|
98
98
|
/** Live browser source; called for state and every new connection. */
|
|
99
99
|
resolveConfig?: () => BrowserConnectionConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Idle window in days for the tab sweep, read per sweep so a settings edit
|
|
102
|
+
* applies on the next one. Zero or less disables the sweep. @default () => 0
|
|
103
|
+
*/
|
|
104
|
+
idleCloseDays?: () => number;
|
|
105
|
+
/** How often the idle sweep runs; zero disables it. @default IDLE_SWEEP_INTERVAL_MS */
|
|
106
|
+
sweepIntervalMs?: number;
|
|
100
107
|
/** Browser factory, replaced by tests. */
|
|
101
108
|
openSession?: (options: OpenSessionOptions) => Promise<BrowserSession>;
|
|
102
109
|
}
|
|
@@ -107,6 +114,14 @@ export interface BrowserViewServiceOptions {
|
|
|
107
114
|
* `CDP_COMMAND_TIMEOUT_MS`, exactly as in the isolated mode.
|
|
108
115
|
*/
|
|
109
116
|
export declare const REAL_BROWSER_HANDSHAKE_TIMEOUT_MS = 5000;
|
|
117
|
+
/**
|
|
118
|
+
* How often the service looks for tabs that went idle.
|
|
119
|
+
*
|
|
120
|
+
* Ten minutes is a compromise between two costs that both land on the host:
|
|
121
|
+
* a shorter period wakes the process for nothing on a window measured in days,
|
|
122
|
+
* and a longer one leaves a page running well past its window.
|
|
123
|
+
*/
|
|
124
|
+
export declare const IDLE_SWEEP_INTERVAL_MS: number;
|
|
110
125
|
/**
|
|
111
126
|
* Seams the external session factory resolves when it connects. The defaults
|
|
112
127
|
* are the production transport; a test injects one to observe what a
|
|
@@ -128,6 +143,9 @@ export declare class BrowserViewService implements BrowserViewBackend {
|
|
|
128
143
|
private readonly openSession;
|
|
129
144
|
private readonly resolveConfig;
|
|
130
145
|
private readonly authenticatedUrl;
|
|
146
|
+
private readonly idleCloseDays;
|
|
147
|
+
private readonly sweepIntervalMs;
|
|
148
|
+
private idleTimer;
|
|
131
149
|
private readonly sinks;
|
|
132
150
|
private readonly bindings;
|
|
133
151
|
/**
|
|
@@ -201,6 +219,18 @@ export declare class BrowserViewService implements BrowserViewBackend {
|
|
|
201
219
|
* @returns ids of the tabs actually closed, in close order.
|
|
202
220
|
*/
|
|
203
221
|
closeOwnTabs(sessionId: string | undefined, tabId?: string): Promise<string[]>;
|
|
222
|
+
/**
|
|
223
|
+
* Close the tabs no browser tool has touched for the configured idle window.
|
|
224
|
+
*
|
|
225
|
+
* Scope is what the real-browser contract allows: only tabs DSH created are
|
|
226
|
+
* candidates, and a page adopted from the person's own browser is never closed
|
|
227
|
+
* by a timer — that contract keeps adopted pages closable only through an
|
|
228
|
+
* explicit `tab_id`. The window is read per sweep, so a settings edit applies
|
|
229
|
+
* to the next one, and a host with no browser running closes nothing and
|
|
230
|
+
* starts none: cleanup must never cost a process.
|
|
231
|
+
* @returns ids of the tabs actually closed, in close order.
|
|
232
|
+
*/
|
|
233
|
+
sweepIdle(): Promise<string[]>;
|
|
204
234
|
/**
|
|
205
235
|
* Resolve the tab a tool call from `sessionId` should act on.
|
|
206
236
|
*
|
|
@@ -222,6 +252,14 @@ export declare class BrowserViewService implements BrowserViewBackend {
|
|
|
222
252
|
* @returns the tab view.
|
|
223
253
|
*/
|
|
224
254
|
tabFor(sessionId: string | undefined, tabId?: string): Promise<BrowserTabView>;
|
|
255
|
+
/**
|
|
256
|
+
* Apply {@link tabFor}'s resolution order against an already open manager.
|
|
257
|
+
* @param tabs - the live tab manager.
|
|
258
|
+
* @param sessionId - calling agent session, when the host provides one.
|
|
259
|
+
* @param tabId - explicit tab from the tool arguments.
|
|
260
|
+
* @returns the tab the call should act on.
|
|
261
|
+
*/
|
|
262
|
+
private resolveTabFor;
|
|
225
263
|
/**
|
|
226
264
|
* Whether a tab is bound to some other session.
|
|
227
265
|
* @param tabId - the tab being considered.
|
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.18",
|
|
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.2-rc.
|
|
25
|
+
"dsh": ">=0.2.2-rc.2"
|
|
26
26
|
},
|
|
27
27
|
"bundle": {
|
|
28
28
|
"patch": "./cordis.patch.yml"
|
|
@@ -45,25 +45,25 @@
|
|
|
45
45
|
"ws": "^8.18.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@deepseek-ai/dsh": ">=0.2.2-rc.
|
|
48
|
+
"@deepseek-ai/dsh": ">=0.2.2-rc.2",
|
|
49
49
|
"react": "^18.2.0",
|
|
50
50
|
"react-dom": "^18.2.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@deepseek-ai/cordis": "^4.1.0",
|
|
54
|
-
"@deepseek-ai/dsh-api-remotes": "0.2.2-rc.
|
|
55
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.2-rc.
|
|
56
|
-
"@deepseek-ai/dsh-client-store": "0.2.2-rc.
|
|
57
|
-
"@deepseek-ai/dsh-client-ui-layout": "^0.2.2-rc.
|
|
58
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.2-rc.
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.2-rc.
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-sidebar-right": "^0.2.2-rc.
|
|
63
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.
|
|
64
|
-
"@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.
|
|
65
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.
|
|
66
|
-
"@deepseek-ai/dsh-tools": "^0.2.2-rc.
|
|
54
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.2-rc.2",
|
|
55
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.2-rc.2",
|
|
56
|
+
"@deepseek-ai/dsh-client-store": "0.2.2-rc.2",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.2.2-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.2-rc.2",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.2-rc.2",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.2",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.2",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "^0.2.2-rc.2",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.2",
|
|
64
|
+
"@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.2",
|
|
65
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.2",
|
|
66
|
+
"@deepseek-ai/dsh-tools": "^0.2.2-rc.2",
|
|
67
67
|
"@deepseek-ai/schemastery": "^3.19.0",
|
|
68
68
|
"@types/node": "^22.20.0",
|
|
69
69
|
"@types/react": "~18.3.1",
|