@anweat/dsh-browser 0.1.7 → 0.1.9
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 +356 -245
- package/cordis.patch.yml +26 -16
- package/lib/approval-policy.js +34 -0
- package/lib/approval-policy.js.map +1 -1
- package/lib/auth-profiles.js +10 -1
- package/lib/auth-profiles.js.map +1 -1
- package/lib/automation-assets-rpc.d.ts +5 -0
- package/lib/automation-assets-rpc.js +63 -0
- package/lib/automation-assets-rpc.js.map +1 -0
- package/lib/automation-assets.d.ts +139 -0
- package/lib/automation-assets.js +372 -0
- package/lib/automation-assets.js.map +1 -0
- package/lib/automation-development.d.ts +13 -0
- package/lib/automation-development.js +37 -0
- package/lib/automation-development.js.map +1 -0
- package/lib/automation-execution.d.ts +14 -0
- package/lib/automation-execution.js +55 -0
- package/lib/automation-execution.js.map +1 -0
- package/lib/browser-service.d.ts +73 -25
- package/lib/browser-service.js +286 -74
- package/lib/browser-service.js.map +1 -1
- package/lib/client/SettingsCard.d.ts +2 -0
- package/lib/client/SettingsCard.js +69 -0
- package/lib/client/SettingsCard.js.map +1 -0
- package/lib/client/automation-assets-client.d.ts +38 -0
- package/lib/client/automation-assets-client.js +83 -0
- package/lib/client/automation-assets-client.js.map +1 -0
- package/lib/client/context-types.d.ts +8 -0
- package/lib/client/context-types.js +2 -0
- package/lib/client/context-types.js.map +1 -0
- package/lib/client/form.d.ts +62 -0
- package/lib/client/form.js +224 -0
- package/lib/client/form.js.map +1 -0
- package/lib/client/index.d.ts +27 -0
- package/lib/client/index.js +28 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client/locales.d.ts +86 -0
- package/lib/client/locales.js +65 -0
- package/lib/client/locales.js.map +1 -0
- package/lib/client/settings-namespace.d.ts +2 -0
- package/lib/client/settings-namespace.js +3 -0
- package/lib/client/settings-namespace.js.map +1 -0
- package/lib/client/styles.d.ts +48 -0
- package/lib/client/styles.js +28 -0
- package/lib/client/styles.js.map +1 -0
- package/lib/client.js +1282 -0
- package/lib/client.js.map +1 -0
- package/lib/config.d.ts +14 -0
- package/lib/config.js +43 -0
- package/lib/config.js.map +1 -1
- package/lib/deps.d.ts +7 -1
- package/lib/deps.js +22 -6
- package/lib/deps.js.map +1 -1
- package/lib/freedom.d.ts +4 -1
- package/lib/freedom.js +14 -0
- package/lib/freedom.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +20 -3
- package/lib/index.js.map +1 -1
- package/lib/opencli-catalog.d.ts +21 -0
- package/lib/opencli-catalog.js +49 -0
- package/lib/opencli-catalog.js.map +1 -0
- package/lib/scripts.d.ts +1 -1
- package/lib/scripts.js +30 -29
- package/lib/scripts.js.map +1 -1
- package/lib/tools.d.ts +2 -1
- package/lib/tools.js +222 -11
- package/lib/tools.js.map +1 -1
- package/lib/usage-policy.d.ts +49 -0
- package/lib/usage-policy.js +171 -0
- package/lib/usage-policy.js.map +1 -0
- package/package.json +133 -78
- package/scripts/check-client-bundle.mjs +15 -0
- package/scripts/clean-lib.mjs +3 -0
package/lib/browser-service.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ import type { ResolvedConfig } from './config.ts';
|
|
|
23
23
|
import { type BrowserRecipeStep, type RecipeStepResult } from './automation.ts';
|
|
24
24
|
import { type UserscriptValidation } from './scripts.ts';
|
|
25
25
|
import { type AutomationMode } from './freedom.ts';
|
|
26
|
+
import { type OpencliCatalogFilter, type OpencliCatalogItem } from './opencli-catalog.ts';
|
|
27
|
+
import { UsageGovernor } from './usage-policy.ts';
|
|
26
28
|
export interface RenderRule {
|
|
27
29
|
hostname: string;
|
|
28
30
|
contentSelectors: string[];
|
|
@@ -37,7 +39,7 @@ export interface RenderResult {
|
|
|
37
39
|
export interface SnapshotResult {
|
|
38
40
|
title: string;
|
|
39
41
|
text: string;
|
|
40
|
-
screenshotPath
|
|
42
|
+
screenshotPath?: string;
|
|
41
43
|
htmlPath: string;
|
|
42
44
|
usedRule?: string;
|
|
43
45
|
}
|
|
@@ -70,6 +72,61 @@ export interface ScriptRunResult {
|
|
|
70
72
|
resultJson: string;
|
|
71
73
|
truncated: boolean;
|
|
72
74
|
}
|
|
75
|
+
export interface CrawlPage {
|
|
76
|
+
url: string;
|
|
77
|
+
title: string;
|
|
78
|
+
text: string;
|
|
79
|
+
depth: number;
|
|
80
|
+
status: number;
|
|
81
|
+
}
|
|
82
|
+
export interface CrawlResult {
|
|
83
|
+
pages: CrawlPage[];
|
|
84
|
+
errors: {
|
|
85
|
+
url: string;
|
|
86
|
+
depth: number;
|
|
87
|
+
error: string;
|
|
88
|
+
status?: number;
|
|
89
|
+
}[];
|
|
90
|
+
stats: {
|
|
91
|
+
pagesVisited: number;
|
|
92
|
+
queued: number;
|
|
93
|
+
elapsedMs: number;
|
|
94
|
+
waitMs: number;
|
|
95
|
+
backoffEvents: number;
|
|
96
|
+
};
|
|
97
|
+
warnings: string[];
|
|
98
|
+
}
|
|
99
|
+
export interface BrowserStatus {
|
|
100
|
+
enabled: boolean;
|
|
101
|
+
channel: string;
|
|
102
|
+
browserRuntime: 'playwright' | 'patchright';
|
|
103
|
+
runtimeWarnings: string[];
|
|
104
|
+
headless: boolean;
|
|
105
|
+
opencliEnabled: boolean;
|
|
106
|
+
opencliInstalled: boolean;
|
|
107
|
+
opencliEntryPath?: string;
|
|
108
|
+
automationMode: AutomationMode;
|
|
109
|
+
exposedTools: string[];
|
|
110
|
+
directInteractionPolicy: 'deny' | 'ask' | 'allow';
|
|
111
|
+
mutatingRecipePolicy: 'deny' | 'ask' | 'allow';
|
|
112
|
+
externalUserscriptPolicy: 'deny' | 'ask' | 'allow';
|
|
113
|
+
opencliRunPolicy: 'deny' | 'ask' | 'allow';
|
|
114
|
+
chromiumInstalled: boolean;
|
|
115
|
+
chromiumExecutablePath?: string;
|
|
116
|
+
usagePolicy: ResolvedConfig['usagePolicy'];
|
|
117
|
+
usageGovernor: ReturnType<UsageGovernor['snapshot']>;
|
|
118
|
+
authProfiles: {
|
|
119
|
+
id: string;
|
|
120
|
+
allowedDomains: string[];
|
|
121
|
+
persistState: boolean;
|
|
122
|
+
}[];
|
|
123
|
+
rulePacks: string[];
|
|
124
|
+
builtinScripts: string[];
|
|
125
|
+
externalUserscriptsRequireApproval: boolean;
|
|
126
|
+
mutatingRecipesRequireApproval: boolean;
|
|
127
|
+
activeUrl?: string;
|
|
128
|
+
activeAuthProfile?: string;
|
|
129
|
+
}
|
|
73
130
|
export declare class BrowserService {
|
|
74
131
|
private readonly config;
|
|
75
132
|
private browser;
|
|
@@ -79,11 +136,15 @@ export declare class BrowserService {
|
|
|
79
136
|
private activeProfile?;
|
|
80
137
|
private activeRulePack?;
|
|
81
138
|
private readonly authProfiles;
|
|
139
|
+
private readonly usageGovernor;
|
|
140
|
+
private opencliCatalogCache?;
|
|
82
141
|
constructor(config: ResolvedConfig);
|
|
83
142
|
available(): boolean;
|
|
143
|
+
private assertEnabled;
|
|
84
144
|
private ensure;
|
|
85
145
|
/** Run `playwright install chromium` from the bundled playwright CLI. */
|
|
86
146
|
installChromium(): Promise<CliResult>;
|
|
147
|
+
private navigate;
|
|
87
148
|
private transientContext;
|
|
88
149
|
private persistAndClose;
|
|
89
150
|
render(url: string, rules: readonly RenderRule[], opts?: {
|
|
@@ -99,6 +160,7 @@ export declare class BrowserService {
|
|
|
99
160
|
maxChars?: number;
|
|
100
161
|
authProfile?: string;
|
|
101
162
|
rulePack?: string;
|
|
163
|
+
screenshot?: boolean;
|
|
102
164
|
}): Promise<SnapshotResult>;
|
|
103
165
|
searchResults(url: string, spec: PlatformSpec, opts?: {
|
|
104
166
|
signal?: AbortSignal;
|
|
@@ -119,6 +181,14 @@ export declare class BrowserService {
|
|
|
119
181
|
signal?: AbortSignal;
|
|
120
182
|
}): Promise<CliResult>;
|
|
121
183
|
opencliDoctor(signal?: AbortSignal): Promise<CliResult>;
|
|
184
|
+
opencliCatalog(filter?: OpencliCatalogFilter, signal?: AbortSignal): Promise<OpencliCatalogItem[]>;
|
|
185
|
+
crawl(startUrls: readonly string[], opts?: {
|
|
186
|
+
maxPages?: number;
|
|
187
|
+
maxDepth?: number;
|
|
188
|
+
sameOrigin?: boolean;
|
|
189
|
+
maxCharsPerPage?: number;
|
|
190
|
+
signal?: AbortSignal;
|
|
191
|
+
}): Promise<CrawlResult>;
|
|
122
192
|
scriptCatalog(): {
|
|
123
193
|
id: string;
|
|
124
194
|
name: string;
|
|
@@ -138,6 +208,7 @@ export declare class BrowserService {
|
|
|
138
208
|
timeoutMs?: number;
|
|
139
209
|
authProfile?: string;
|
|
140
210
|
rulePack?: string;
|
|
211
|
+
inputs?: Record<string, string>;
|
|
141
212
|
}): Promise<ScriptRunResult>;
|
|
142
213
|
private ensureActivePage;
|
|
143
214
|
private captureScreenshot;
|
|
@@ -169,29 +240,6 @@ export declare class BrowserService {
|
|
|
169
240
|
signal?: AbortSignal;
|
|
170
241
|
}): Promise<RecipeRunResult>;
|
|
171
242
|
closePage(): Promise<void>;
|
|
172
|
-
status(): Promise<
|
|
173
|
-
enabled: boolean;
|
|
174
|
-
channel: string;
|
|
175
|
-
headless: boolean;
|
|
176
|
-
opencliEnabled: boolean;
|
|
177
|
-
automationMode: AutomationMode;
|
|
178
|
-
exposedTools: string[];
|
|
179
|
-
directInteractionPolicy: 'deny' | 'ask' | 'allow';
|
|
180
|
-
mutatingRecipePolicy: 'deny' | 'ask' | 'allow';
|
|
181
|
-
externalUserscriptPolicy: 'deny' | 'ask' | 'allow';
|
|
182
|
-
opencliRunPolicy: 'deny' | 'ask' | 'allow';
|
|
183
|
-
chromiumInstalled: boolean;
|
|
184
|
-
authProfiles: {
|
|
185
|
-
id: string;
|
|
186
|
-
allowedDomains: string[];
|
|
187
|
-
persistState: boolean;
|
|
188
|
-
}[];
|
|
189
|
-
rulePacks: string[];
|
|
190
|
-
builtinScripts: string[];
|
|
191
|
-
externalUserscriptsRequireApproval: boolean;
|
|
192
|
-
mutatingRecipesRequireApproval: boolean;
|
|
193
|
-
activeUrl?: string;
|
|
194
|
-
activeAuthProfile?: string;
|
|
195
|
-
}>;
|
|
243
|
+
status(): Promise<BrowserStatus>;
|
|
196
244
|
close(): Promise<void>;
|
|
197
245
|
}
|