dsh-browser-view 0.4.0 → 0.7.0
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.md +14 -10
- package/lib/client.js +1 -1
- package/lib/index.js +7787 -5190
- package/lib/types/browser/adapters/antd.d.ts +14 -0
- package/lib/types/browser/adapters/archetypes.d.ts +93 -0
- package/lib/types/browser/adapters/dom.d.ts +6 -0
- package/lib/types/browser/adapters/element.d.ts +5 -0
- package/lib/types/browser/adapters/engine.d.ts +51 -0
- package/lib/types/browser/adapters/generic.d.ts +5 -0
- package/lib/types/browser/adapters/index.d.ts +10 -0
- package/lib/types/browser/adapters/modules/drag.d.ts +3 -0
- package/lib/types/browser/adapters/modules/editor.d.ts +3 -0
- package/lib/types/browser/adapters/modules/hierarchy.d.ts +3 -0
- package/lib/types/browser/adapters/modules/temporal.d.ts +3 -0
- package/lib/types/browser/adapters/modules/transfer.d.ts +3 -0
- package/lib/types/browser/adapters/modules/virtual.d.ts +4 -0
- package/lib/types/browser/adapters/quiescence.d.ts +3 -0
- package/lib/types/browser/adapters/registry.d.ts +64 -0
- package/lib/types/browser/adapters/select.d.ts +15 -0
- package/lib/types/browser/adapters/types.d.ts +134 -0
- package/lib/types/browser/codegen/playwright.d.ts +10 -0
- package/lib/types/browser/definitions/collaboration.d.ts +4 -0
- package/lib/types/browser/definitions/doctor.d.ts +4 -0
- package/lib/types/browser/definitions/extract.d.ts +4 -0
- package/lib/types/browser/definitions/inspection.d.ts +4 -0
- package/lib/types/browser/definitions/interaction.d.ts +4 -0
- package/lib/types/browser/definitions/navigation.d.ts +4 -0
- package/lib/types/browser/definitions/recorder.d.ts +4 -0
- package/lib/types/browser/definitions/testing.d.ts +4 -0
- package/lib/types/browser/policy/engine.d.ts +26 -0
- package/lib/types/browser/policy/types.d.ts +36 -0
- package/lib/types/browser/primitives/dialog.d.ts +12 -0
- package/lib/types/browser/primitives/dom.d.ts +43 -0
- package/lib/types/browser/primitives/drag.d.ts +3 -0
- package/lib/types/browser/primitives/editor.d.ts +3 -0
- package/lib/types/browser/primitives/form.d.ts +7 -0
- package/lib/types/browser/primitives/hierarchy.d.ts +3 -0
- package/lib/types/browser/primitives/index.d.ts +12 -0
- package/lib/types/browser/primitives/select.d.ts +7 -0
- package/lib/types/browser/primitives/temporal.d.ts +3 -0
- package/lib/types/browser/primitives/transfer.d.ts +3 -0
- package/lib/types/browser/primitives/types.d.ts +48 -0
- package/lib/types/browser/primitives/virtual.d.ts +4 -0
- package/lib/types/browser/reports.d.ts +0 -2
- package/lib/types/browser/session/cache.d.ts +103 -0
- package/lib/types/browser/session/collaboration.d.ts +53 -0
- package/lib/types/browser/session/recorder.d.ts +62 -0
- package/lib/types/browser/session/screencast.d.ts +37 -0
- package/lib/types/browser/session/screenshot.d.ts +17 -0
- package/lib/types/browser/session/semantic.d.ts +94 -0
- package/lib/types/browser/session/target.d.ts +16 -0
- package/lib/types/browser/session/tracer.d.ts +56 -0
- package/lib/types/browser/session.d.ts +7 -140
- package/lib/types/browser/stealth/keyboard.d.ts +13 -0
- package/lib/types/browser/stealth/mouse.d.ts +28 -0
- package/lib/types/browser/tools/collaboration.d.ts +73 -0
- package/lib/types/browser/tools/common.d.ts +67 -0
- package/lib/types/browser/tools/doctor.d.ts +31 -0
- package/lib/types/browser/tools/extract.d.ts +92 -0
- package/lib/types/browser/tools/inspection.d.ts +93 -0
- package/lib/types/browser/tools/interaction.d.ts +148 -0
- package/lib/types/browser/tools/navigation.d.ts +126 -0
- package/lib/types/browser/tools/recorder.d.ts +236 -0
- package/lib/types/browser/tools/testing.d.ts +94 -0
- package/lib/types/browser/tools.d.ts +9 -861
- package/lib/types/browser/types.d.ts +70 -1
- package/lib/types/browser/walker.d.ts +3 -0
- package/lib/types/client/api.d.ts +24 -0
- package/lib/types/client/components/ConfirmCard.d.ts +20 -0
- package/lib/types/client/components/FloatingOverlay.d.ts +10 -0
- package/lib/types/client/components/FloatingPanel.d.ts +40 -0
- package/lib/types/client/components/InspectionModal.d.ts +51 -0
- package/lib/types/client/components/SettingsSection.d.ts +5 -0
- package/lib/types/client/components/styles.d.ts +18 -0
- package/lib/types/client/hooks/useBrowserStatus.d.ts +11 -0
- package/lib/types/client/hooks/useConfirmPolling.d.ts +6 -0
- package/lib/types/client/hooks/usePickPolling.d.ts +5 -0
- package/lib/types/client/hooks/useRecordings.d.ts +9 -0
- package/lib/types/client/index.d.ts +7 -10
- package/lib/types/client/theme.d.ts +7 -0
- package/lib/types/client/types.d.ts +74 -0
- package/lib/types/lib/config.d.ts +0 -2
- package/lib/types/lib/http.d.ts +0 -2
- package/lib/types/lib/types.d.ts +1 -0
- package/package.json +13 -3
- package/lib/types/embed.d.ts +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Browser, BrowserContext, Page } from "playwright-core";
|
|
1
|
+
import type { Browser, BrowserContext, Frame, Locator, Page } from "playwright-core";
|
|
2
2
|
export interface BrowserConfig {
|
|
3
3
|
enabled?: boolean;
|
|
4
4
|
channel?: string;
|
|
@@ -55,11 +55,28 @@ export interface BrowserConfig {
|
|
|
55
55
|
* 需要拦输入类动作时显式加入)。
|
|
56
56
|
*/
|
|
57
57
|
sensitiveTools?: string[];
|
|
58
|
+
/** 多维环境与路径自适应策略规则链 (v0.6 Policy Engine) */
|
|
59
|
+
confirmPolicies?: import("./policy/types.js").PolicyRule[];
|
|
60
|
+
/** 拟人化操作引擎: auto(遇风控/登录页自动激活) | true(全局开启) | false(默认关闭) */
|
|
61
|
+
humanize?: boolean | "auto";
|
|
62
|
+
/** 拟人化操作速率: slow | normal (默认) | fast */
|
|
63
|
+
humanizeSpeed?: "slow" | "normal" | "fast";
|
|
58
64
|
/**
|
|
59
65
|
* replay/batch 是否同样走 auto 审批闸(默认 true)。设为 false 表示回放
|
|
60
66
|
* 不再弹审批 —— 数据驱动/定时回归的逃生口,风险自担(见 README)。
|
|
61
67
|
*/
|
|
62
68
|
confirmInReplay?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* what 语义定位零命中时是否自动附 SoM 标徽截图(默认 true):多模态模型
|
|
71
|
+
* 可看图后 browser_click { mark: N } 一次往返完成定位。仅失败路径触发。
|
|
72
|
+
*/
|
|
73
|
+
somFallback?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* SPA ref 软失效重锚定(默认 true):主 frame 导航不清空 ref 表,推进
|
|
76
|
+
* navSeq 代际;定位失败时全量重扫按 role+name 指纹重映射(路由切换场景
|
|
77
|
+
* DOM 大部分未变,免整轮快照往返)。false 回退「导航即清空」旧行为。
|
|
78
|
+
*/
|
|
79
|
+
refReanchor?: boolean;
|
|
63
80
|
/**
|
|
64
81
|
* 工具集:all(默认,全部工具)| core(只注册高频核心集,低频的
|
|
65
82
|
* 录制/回放/报告/抽取/profile 等不注册,降 systemPrompt 常驻 token)。
|
|
@@ -104,6 +121,58 @@ export interface RefEntry {
|
|
|
104
121
|
name: string;
|
|
105
122
|
/** 生成快照时计算的稳定 CSS 路径(优先 #id / [data-testid] / nth-of-type 链)。 */
|
|
106
123
|
selector: string;
|
|
124
|
+
/** 元素所在 Frame 的全局索引(0 为主 Frame, >=1 为子 Frame)。 */
|
|
125
|
+
frameIndex?: number;
|
|
126
|
+
/** 元素所在 Frame 的当前 URL(用于导航防漂移二次校验)。 */
|
|
127
|
+
frameUrl?: string;
|
|
128
|
+
/** 快照时的视口内包围盒(仅视口内元素记录);ref 路径与 role 降级全部失灵时的坐标兜底。 */
|
|
129
|
+
rect?: {
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
w: number;
|
|
133
|
+
h: number;
|
|
134
|
+
};
|
|
135
|
+
/** 快照时的滚动偏移;坐标兜底按当前 scroll 修正视口位置。 */
|
|
136
|
+
scroll?: {
|
|
137
|
+
x: number;
|
|
138
|
+
y: number;
|
|
139
|
+
};
|
|
140
|
+
/** 注册时的导航代际;落后于 pageNavSeq = 疑似过期(SPA 路由),定位失败时按指纹重锚定。 */
|
|
141
|
+
navSeq?: number;
|
|
142
|
+
}
|
|
143
|
+
/** SoM 标徽(browser_screenshot { som: true })的注册项(id → 定位信息)。 */
|
|
144
|
+
export interface MarkEntry {
|
|
145
|
+
role: string;
|
|
146
|
+
name: string;
|
|
147
|
+
selector: string;
|
|
148
|
+
/** 标徽快照时的视口内包围盒与滚动偏移(坐标兜底语义同 RefEntry)。 */
|
|
149
|
+
rect?: {
|
|
150
|
+
x: number;
|
|
151
|
+
y: number;
|
|
152
|
+
w: number;
|
|
153
|
+
h: number;
|
|
154
|
+
};
|
|
155
|
+
scroll?: {
|
|
156
|
+
x: number;
|
|
157
|
+
y: number;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/** 统一目标定位解析结果(无论在主 Frame 还是子 Frame 均可统一操作)。 */
|
|
161
|
+
export interface TargetResolution {
|
|
162
|
+
/** 绑定的 Playwright Locator 实例。 */
|
|
163
|
+
locator: Locator;
|
|
164
|
+
/** 执行上下文容器(主页面 Page 或子 Frame)。 */
|
|
165
|
+
container: Page | Frame;
|
|
166
|
+
/** 原始 RefEntry 元数据(仅 ref 定位时有效)。 */
|
|
167
|
+
entry?: RefEntry;
|
|
168
|
+
/** 是否位于子 Frame 中。 */
|
|
169
|
+
isIFrame: boolean;
|
|
170
|
+
/** 匹配到的总元素数量 (用于排障诊断) */
|
|
171
|
+
matchedCount?: number;
|
|
172
|
+
/** 匹配到的可见元素数量 */
|
|
173
|
+
visibleCount?: number;
|
|
174
|
+
/** 语义定位的备选目标(按打分次序,最多 2 个);点击效果验证无变化时自动换选。 */
|
|
175
|
+
alternates?: Locator[];
|
|
107
176
|
}
|
|
108
177
|
/** 录制时采集的选择器指纹(回放自愈的降级候选来源)。 */
|
|
109
178
|
export interface SelectorHint {
|
|
@@ -7,6 +7,7 @@ declare function __walkerCore(): {
|
|
|
7
7
|
nameOf: (el: Element, role: string) => string;
|
|
8
8
|
cssPath: (el: Element) => string;
|
|
9
9
|
isVisible: (el: Element) => boolean;
|
|
10
|
+
isElementInViewport: (el: Element, padding?: number) => boolean;
|
|
10
11
|
describeElement: (el: Element) => {
|
|
11
12
|
role: string;
|
|
12
13
|
name: string;
|
|
@@ -17,6 +18,8 @@ declare function __walkerCore(): {
|
|
|
17
18
|
text: string;
|
|
18
19
|
visible: boolean;
|
|
19
20
|
};
|
|
21
|
+
composedParent: (el: Element) => Element | null;
|
|
22
|
+
deepChildren: (el: Element) => Element[];
|
|
20
23
|
};
|
|
21
24
|
/** walker 核心注入后暴露给 entry 的 API(类型层)。 */
|
|
22
25
|
export type WalkerApi = ReturnType<typeof __walkerCore>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BrowserOp, BrowserStatus, LatestRun, NavHistoryItem, PendingConfirm, PendingPick, RecordingDetail, RecordingRow } from "./types.js";
|
|
2
|
+
/** 获取插件后端 API 基路径 (默认为 /browser) */
|
|
3
|
+
export declare function getBasePath(): Promise<string>;
|
|
4
|
+
export declare function fetchStatus(base: string): Promise<BrowserStatus | null>;
|
|
5
|
+
export declare function fetchHistory(base: string): Promise<NavHistoryItem[]>;
|
|
6
|
+
export declare function fetchOperations(base: string): Promise<BrowserOp[]>;
|
|
7
|
+
export declare function fetchLatestRun(base: string): Promise<{
|
|
8
|
+
run: LatestRun | null;
|
|
9
|
+
busy: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function fetchPendingConfirm(base: string): Promise<PendingConfirm | null>;
|
|
12
|
+
export declare function submitConfirmDecision(base: string, id: string, decision: "allowed" | "denied"): Promise<boolean>;
|
|
13
|
+
export declare function fetchPendingPick(base: string): Promise<PendingPick | null>;
|
|
14
|
+
/** 提交点选坐标(x/y 为截图位图像素坐标,imgW/imgH 为截图尺寸;服务端换算成视口 CSS 坐标)。 */
|
|
15
|
+
export declare function submitPick(base: string, id: string, x: number, y: number, imgW: number, imgH: number): Promise<boolean>;
|
|
16
|
+
export declare function triggerRerun(base: string, source: string, retryOf?: string): Promise<{
|
|
17
|
+
ok: boolean;
|
|
18
|
+
status?: number;
|
|
19
|
+
error?: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function fetchRecordings(base: string): Promise<RecordingRow[]>;
|
|
22
|
+
export declare function fetchRecordingDetail(base: string, name: string): Promise<RecordingDetail | null>;
|
|
23
|
+
export declare function deleteRecordingApi(base: string, name: string): Promise<boolean>;
|
|
24
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PendingConfirm } from "../types.js";
|
|
2
|
+
interface ConfirmCardProps {
|
|
3
|
+
confirm: PendingConfirm;
|
|
4
|
+
dark: boolean;
|
|
5
|
+
onDecision: (decision: "allowed" | "denied") => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function ConfirmCard({ confirm, dark, onDecision }: ConfirmCardProps): import("react").DetailedReactHTMLElement<{
|
|
8
|
+
style: {
|
|
9
|
+
padding: string;
|
|
10
|
+
borderRadius: string;
|
|
11
|
+
border: string;
|
|
12
|
+
background: string;
|
|
13
|
+
color: "#fca5a5" | "#b91c1c";
|
|
14
|
+
fontSize: string;
|
|
15
|
+
lineHeight: string;
|
|
16
|
+
};
|
|
17
|
+
title: string;
|
|
18
|
+
}, HTMLElement>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=ConfirmCard.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function BrowserFloatingOverlay(): import("react").DetailedReactHTMLElement<{
|
|
2
|
+
id: string;
|
|
3
|
+
style: {
|
|
4
|
+
position: "fixed";
|
|
5
|
+
inset: number;
|
|
6
|
+
pointerEvents: "none";
|
|
7
|
+
zIndex: number;
|
|
8
|
+
};
|
|
9
|
+
}, HTMLElement>;
|
|
10
|
+
//# sourceMappingURL=FloatingOverlay.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BrowserOp, BrowserStatus, LatestRun, Palette, PendingConfirm, PendingPick } from "../types.js";
|
|
2
|
+
interface FloatingPanelProps {
|
|
3
|
+
status: BrowserStatus | null;
|
|
4
|
+
ops: BrowserOp[];
|
|
5
|
+
lastRun: LatestRun | null;
|
|
6
|
+
agentBusy: boolean;
|
|
7
|
+
rerunMsg: string;
|
|
8
|
+
pendingConfirm: PendingConfirm | null;
|
|
9
|
+
pendingPick?: PendingPick | null;
|
|
10
|
+
shotSrc: string;
|
|
11
|
+
streamSrc?: string;
|
|
12
|
+
dark: boolean;
|
|
13
|
+
palette: Palette;
|
|
14
|
+
onOpenModal: () => void;
|
|
15
|
+
onOpenReport: () => void;
|
|
16
|
+
onConfirmDecision: (decision: "allowed" | "denied") => void;
|
|
17
|
+
onRerunLast: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function FloatingPanel({ status, ops, lastRun, agentBusy, rerunMsg, pendingConfirm, pendingPick, shotSrc, streamSrc, dark, palette: p, onOpenModal, onOpenReport, onConfirmDecision, onRerunLast, }: FloatingPanelProps): import("react").DetailedReactHTMLElement<{
|
|
20
|
+
style: {
|
|
21
|
+
position: "fixed";
|
|
22
|
+
right: string;
|
|
23
|
+
bottom: string;
|
|
24
|
+
width: string;
|
|
25
|
+
maxHeight: string;
|
|
26
|
+
overflowY: "auto";
|
|
27
|
+
overflowX: "hidden";
|
|
28
|
+
display: "flex";
|
|
29
|
+
flexDirection: "column";
|
|
30
|
+
gap: string;
|
|
31
|
+
border: string;
|
|
32
|
+
borderRadius: string;
|
|
33
|
+
background: string;
|
|
34
|
+
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.3)";
|
|
35
|
+
padding: string;
|
|
36
|
+
pointerEvents: "auto";
|
|
37
|
+
};
|
|
38
|
+
}, HTMLElement>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=FloatingPanel.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type MouseEvent } from "react";
|
|
2
|
+
import type { NavHistoryItem, Palette, BrowserStatus, PendingPick } from "../types.js";
|
|
3
|
+
interface InspectionModalProps {
|
|
4
|
+
status: BrowserStatus | null;
|
|
5
|
+
history: NavHistoryItem[];
|
|
6
|
+
shotSrc: string;
|
|
7
|
+
streamSrc?: string;
|
|
8
|
+
dark: boolean;
|
|
9
|
+
palette: Palette;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
/** 面板点选教学:等待中非空,大图切换为十字光标点选模式。 */
|
|
12
|
+
pendingPick?: PendingPick | null;
|
|
13
|
+
/** 用户点选回调(x/y 为截图位图像素坐标,imgW/imgH 为截图尺寸)。 */
|
|
14
|
+
onPick?: (x: number, y: number, imgW: number, imgH: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function InspectionModal({ status, history, shotSrc, streamSrc, dark, palette: p, onClose, pendingPick, onPick, }: InspectionModalProps): import("react").DetailedReactHTMLElement<{
|
|
17
|
+
onClick: (e: MouseEvent) => void;
|
|
18
|
+
style: {
|
|
19
|
+
position: "fixed";
|
|
20
|
+
inset: number;
|
|
21
|
+
zIndex: number;
|
|
22
|
+
display: "flex";
|
|
23
|
+
alignItems: "center";
|
|
24
|
+
justifyContent: "center";
|
|
25
|
+
padding: string;
|
|
26
|
+
background: string;
|
|
27
|
+
pointerEvents: "auto";
|
|
28
|
+
};
|
|
29
|
+
}, HTMLElement>;
|
|
30
|
+
interface ReportModalProps {
|
|
31
|
+
base: string;
|
|
32
|
+
dark: boolean;
|
|
33
|
+
palette: Palette;
|
|
34
|
+
onClose: () => void;
|
|
35
|
+
}
|
|
36
|
+
export declare function ReportModal({ base, dark, palette: p, onClose }: ReportModalProps): import("react").DetailedReactHTMLElement<{
|
|
37
|
+
onClick: (e: MouseEvent) => void;
|
|
38
|
+
style: {
|
|
39
|
+
position: "fixed";
|
|
40
|
+
inset: number;
|
|
41
|
+
zIndex: number;
|
|
42
|
+
display: "flex";
|
|
43
|
+
alignItems: "center";
|
|
44
|
+
justifyContent: "center";
|
|
45
|
+
padding: string;
|
|
46
|
+
background: string;
|
|
47
|
+
pointerEvents: "auto";
|
|
48
|
+
};
|
|
49
|
+
}, HTMLElement>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=InspectionModal.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SettingsSectionOwnerProps } from "@deepseek-ai/dsh-client-ui-settings/client";
|
|
2
|
+
export declare function BrowserSettingsSection(_props: SettingsSectionOwnerProps): import("react").DetailedReactHTMLElement<{
|
|
3
|
+
style: import("react").CSSProperties;
|
|
4
|
+
}, HTMLElement>;
|
|
5
|
+
//# sourceMappingURL=SettingsSection.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { Palette } from "../types.js";
|
|
3
|
+
export declare function styleFor(p: Palette): {
|
|
4
|
+
row: React.CSSProperties;
|
|
5
|
+
label: React.CSSProperties;
|
|
6
|
+
meta: React.CSSProperties;
|
|
7
|
+
btn: React.CSSProperties;
|
|
8
|
+
delBtn: React.CSSProperties;
|
|
9
|
+
itemBox: React.CSSProperties;
|
|
10
|
+
stepsBox: React.CSSProperties;
|
|
11
|
+
stepLine: React.CSSProperties;
|
|
12
|
+
toolName: React.CSSProperties;
|
|
13
|
+
stepArgs: React.CSSProperties;
|
|
14
|
+
empty: React.CSSProperties;
|
|
15
|
+
root: React.CSSProperties;
|
|
16
|
+
heading: React.CSSProperties;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BrowserOp, BrowserStatus, LatestRun } from "../types.js";
|
|
2
|
+
export declare function useBrowserStatus(base: string): {
|
|
3
|
+
status: BrowserStatus | null;
|
|
4
|
+
ops: BrowserOp[];
|
|
5
|
+
shotVersion: number;
|
|
6
|
+
lastRun: LatestRun | null;
|
|
7
|
+
agentBusy: boolean;
|
|
8
|
+
rerunMsg: string;
|
|
9
|
+
rerunLast: () => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useBrowserStatus.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PendingConfirm } from "../types.js";
|
|
2
|
+
export declare function useConfirmPolling(base: string): {
|
|
3
|
+
pendingConfirm: PendingConfirm | null;
|
|
4
|
+
resolveConfirm: (id: string, decision: "allowed" | "denied") => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=useConfirmPolling.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RecordingDetail, RecordingRow } from "../types.js";
|
|
2
|
+
export declare function useRecordings(base: string): {
|
|
3
|
+
list: RecordingRow[] | null;
|
|
4
|
+
error: string;
|
|
5
|
+
expanded: Record<string, "failed" | RecordingDetail | "loading" | undefined>;
|
|
6
|
+
toggleDetail: (name: string) => void;
|
|
7
|
+
remove: (name: string) => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useRecordings.d.ts.map
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-browser-view client half:
|
|
3
|
-
* 1. "settings.section" -> A "🌐 浏览器" page in
|
|
4
|
-
*
|
|
5
|
-
* 2. "shell.overlay" -> Universal floating widget (FAB + live screenshot
|
|
6
|
-
* thumbnail panel + full-size inspection modal) rendered natively in both
|
|
7
|
-
* Electron desktop and web client.
|
|
3
|
+
* 1. "settings.section" -> A "🌐 浏览器" page in official dsh settings dialog.
|
|
4
|
+
* 2. "shell.overlay" -> Universal floating widget (FAB + live screenshot + modal).
|
|
8
5
|
*/
|
|
9
|
-
import type { ClientContext } from
|
|
10
|
-
declare module
|
|
6
|
+
import type { ClientContext } from "@deepseek-ai/dsh-client-runtime/client";
|
|
7
|
+
declare module "@deepseek-ai/dsh-client-ui-slots" {
|
|
11
8
|
interface SlotMap {
|
|
12
|
-
|
|
13
|
-
kind:
|
|
14
|
-
scope:
|
|
9
|
+
"shell.overlay": {
|
|
10
|
+
kind: "list";
|
|
11
|
+
scope: "root";
|
|
15
12
|
};
|
|
16
13
|
}
|
|
17
14
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Palette } from "./types.js";
|
|
2
|
+
export declare const LIGHT: Palette;
|
|
3
|
+
export declare const DARK: Palette;
|
|
4
|
+
/** 跟随宿主主题 (body[data-ds-dark-theme]) */
|
|
5
|
+
export declare function useDarkTheme(): boolean;
|
|
6
|
+
export declare function fmtTime(ts: number): string;
|
|
7
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export interface Palette {
|
|
2
|
+
primary: string;
|
|
3
|
+
secondary: string;
|
|
4
|
+
tertiary: string;
|
|
5
|
+
border: string;
|
|
6
|
+
hoverBg: string;
|
|
7
|
+
danger: string;
|
|
8
|
+
}
|
|
9
|
+
export interface RecordingRow {
|
|
10
|
+
name: string;
|
|
11
|
+
steps: number;
|
|
12
|
+
savedAt: number;
|
|
13
|
+
preview: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RecordingDetail {
|
|
16
|
+
name: string;
|
|
17
|
+
steps: Array<{
|
|
18
|
+
tool: string;
|
|
19
|
+
args: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface BrowserStatus {
|
|
23
|
+
open: boolean;
|
|
24
|
+
tabs?: number;
|
|
25
|
+
url?: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
channel?: string;
|
|
28
|
+
pause?: {
|
|
29
|
+
instruction: string;
|
|
30
|
+
startedAt: number;
|
|
31
|
+
} | null;
|
|
32
|
+
}
|
|
33
|
+
export interface BrowserOp {
|
|
34
|
+
tool: string;
|
|
35
|
+
ok: boolean;
|
|
36
|
+
ms: number;
|
|
37
|
+
ts: number;
|
|
38
|
+
error?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface NavHistoryItem {
|
|
41
|
+
url: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
ts: number;
|
|
44
|
+
}
|
|
45
|
+
export interface PendingConfirm {
|
|
46
|
+
id: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
tool?: string;
|
|
49
|
+
args?: Record<string, unknown>;
|
|
50
|
+
startedAt: number;
|
|
51
|
+
decision?: "allowed" | "denied";
|
|
52
|
+
}
|
|
53
|
+
/** 面板点选教学请求(browser_pick_element 等待期间轮询到)。 */
|
|
54
|
+
export interface PendingPick {
|
|
55
|
+
id: string;
|
|
56
|
+
instruction: string;
|
|
57
|
+
startedAt: number;
|
|
58
|
+
}
|
|
59
|
+
export interface LatestRun {
|
|
60
|
+
runId: string;
|
|
61
|
+
ts: number;
|
|
62
|
+
source: string;
|
|
63
|
+
passed: number;
|
|
64
|
+
total: number;
|
|
65
|
+
failed: number;
|
|
66
|
+
healedCount: number;
|
|
67
|
+
row?: number;
|
|
68
|
+
retries?: {
|
|
69
|
+
attempted: number;
|
|
70
|
+
recovered: number;
|
|
71
|
+
};
|
|
72
|
+
retryOf?: string;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -8,10 +8,8 @@ export interface FieldSchema {
|
|
|
8
8
|
min?: number;
|
|
9
9
|
}
|
|
10
10
|
export type ConfigSchema = Record<string, FieldSchema>;
|
|
11
|
-
declare const TYPES: string[];
|
|
12
11
|
/** 校验配置;返回错误列表(空 = 通过)。 */
|
|
13
12
|
export declare function validateConfig(schema: ConfigSchema, config: Record<string, any>): string[];
|
|
14
13
|
/** 合并默认值 + 校验;抛错时带模块名前缀。 */
|
|
15
14
|
export declare function resolveConfig(moduleName: string, schema: ConfigSchema, defaults: Record<string, any>, raw: Record<string, any> | undefined): Record<string, any>;
|
|
16
|
-
export { TYPES };
|
|
17
15
|
//# sourceMappingURL=config.d.ts.map
|
package/lib/types/lib/http.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
/** Parse the request URL pathname (query strings are ignored). */
|
|
3
3
|
export declare function urlPath(req: IncomingMessage): string;
|
|
4
|
-
/** Read the request body as a UTF-8 string (bounded). */
|
|
5
|
-
export declare function readRawBody(req: IncomingMessage, limitBytes?: number): Promise<string>;
|
|
6
4
|
/** Read and parse a JSON request body; `undefined` when the body is empty. */
|
|
7
5
|
export declare function readJsonBody(req: IncomingMessage, limitBytes?: number): Promise<unknown>;
|
|
8
6
|
/** Send a JSON response. */
|
package/lib/types/lib/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface ReefContext {
|
|
|
3
3
|
get<T = any>(name: string): T | undefined;
|
|
4
4
|
effect(fn: () => (() => void) | void, label?: string): void;
|
|
5
5
|
on?(event: string, listener: (...args: unknown[]) => unknown): (() => void) | void;
|
|
6
|
+
inject?(names: string[], callback: (ctx: ReefContext) => void): unknown;
|
|
6
7
|
logger?: {
|
|
7
8
|
info?: (message: string) => void;
|
|
8
9
|
warn?: (message: string) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-view",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DSH 插件:共享 Playwright 浏览器自动化(
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "DSH 插件:共享 Playwright 浏览器自动化(38 个 browser_* 工具,含 what 意图语义定位(一次调用替代快照→查找→点击)、SoM 标徽看图点击与零命中截图兜底、SPA ref 软失效重锚定、open Shadow DOM 组合树穿透、跨 Frame/IFrame 定位、视口感知动态快照、批量表单智能填充、点击效果验证与定位失败遥测、Playwright 规范代码导出、批处理、视觉回归、选择器自愈、增量快照)+ 人机协作(面板点选教学 browser_pick_element、人工接管等待、敏感操作审批硬拦截、人机混合录制、面板一键重跑)+ CDP 流式推流、拟人化轨迹与高斯击键、全景时光机、企业富控件矩阵。仅依赖 playwright-core。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/types/index.d.ts",
|
|
@@ -27,8 +27,16 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsc -p tsconfig.json && tsdown",
|
|
29
29
|
"typecheck": "tsc -p tsconfig.json --noEmit --pretty false && tsc -p tsconfig.test.json --noEmit --pretty false",
|
|
30
|
+
"lint": "biome check src test",
|
|
31
|
+
"format": "biome format --write src test",
|
|
30
32
|
"test": "vitest run",
|
|
31
|
-
"
|
|
33
|
+
"test:algo": "tsx scripts/test-dev-server-algo-config.ts",
|
|
34
|
+
"test:enterprise": "tsx scripts/test-dev-server-enterprise.ts",
|
|
35
|
+
"test:energy": "tsx scripts/test-dev-server-energy.ts",
|
|
36
|
+
"test:shadow": "tsx scripts/test-dev-server-shadow.ts",
|
|
37
|
+
"test:pick": "tsx scripts/test-panel-pick.ts",
|
|
38
|
+
"dev:server": "tsx scripts/dev-server.ts",
|
|
39
|
+
"verify": "npm run typecheck && npm run lint && npm run test && npm run build",
|
|
32
40
|
"prepublishOnly": "npm run verify"
|
|
33
41
|
},
|
|
34
42
|
"repository": {
|
|
@@ -56,9 +64,11 @@
|
|
|
56
64
|
"playwright-core": "^1.49.0"
|
|
57
65
|
},
|
|
58
66
|
"devDependencies": {
|
|
67
|
+
"@biomejs/biome": "^2.5.15",
|
|
59
68
|
"@types/node": "^22.0.0",
|
|
60
69
|
"@types/react": "^18.2.0",
|
|
61
70
|
"tsdown": "^0.22.0",
|
|
71
|
+
"tsx": "^4.23.15",
|
|
62
72
|
"typescript": "^5.9.2",
|
|
63
73
|
"vitest": "^3.0.0"
|
|
64
74
|
},
|
package/lib/types/embed.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ReefContext, WebRoute } from "./lib/types.js";
|
|
2
|
-
export declare function applyEmbed(ctx: ReefContext, webServer: {
|
|
3
|
-
register(route: WebRoute): () => void;
|
|
4
|
-
tapIndex(transform: (html: string) => string): () => void;
|
|
5
|
-
port?: number;
|
|
6
|
-
}, base: string): () => void;
|
|
7
|
-
//# sourceMappingURL=embed.d.ts.map
|