dhalsim 1.5.0 → 1.6.1
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 +17 -8
- package/dist/index.js +15 -8
- package/dist/session/manager.d.ts +2 -0
- package/dist/subagents/dhalsim.d.ts +4 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -34,11 +34,12 @@ Configure BrowseWeb subagent in `~/.llmist/cli.toml`:
|
|
|
34
34
|
|
|
35
35
|
```toml
|
|
36
36
|
[subagents.BrowseWeb]
|
|
37
|
-
model = "sonnet"
|
|
38
|
-
maxIterations = 20
|
|
39
|
-
headless = true
|
|
40
|
-
timeoutMs = 600000
|
|
41
|
-
disableCache = false
|
|
37
|
+
model = "sonnet" # LLM model for the subagent (default: sonnet)
|
|
38
|
+
maxIterations = 20 # Max agent loop iterations (default: 15)
|
|
39
|
+
headless = true # Run browser in headless mode (default: true)
|
|
40
|
+
timeoutMs = 600000 # Overall timeout in ms (default: 300000 = 5 min, 0 = disabled)
|
|
41
|
+
disableCache = false # Disable browser cache for lower memory usage (default: false)
|
|
42
|
+
navigationTimeoutMs = 60000 # Navigation timeout in ms (default: 60000)
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
#### Per-profile configuration
|
|
@@ -58,15 +59,23 @@ maxIterations = 30 # More iterations for deep research
|
|
|
58
59
|
model = "inherit" # Use parent agent's model
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
####
|
|
62
|
+
#### Production Deployment
|
|
62
63
|
|
|
63
|
-
For
|
|
64
|
+
For production environments, consider the following settings:
|
|
64
65
|
|
|
65
66
|
```toml
|
|
66
67
|
[production.subagents.BrowseWeb]
|
|
67
|
-
|
|
68
|
+
headless = true # Always run headless in production
|
|
69
|
+
disableCache = true # Reduces memory per browser instance (~100-200MB savings)
|
|
70
|
+
navigationTimeoutMs = 90000 # 90s for slow networks or heavy sites
|
|
71
|
+
maxIterations = 20 # More iterations for reliability
|
|
68
72
|
```
|
|
69
73
|
|
|
74
|
+
**Resource requirements:**
|
|
75
|
+
- Each browser instance uses ~300-500MB RAM
|
|
76
|
+
- Running multiple concurrent `BrowseWeb` calls multiplies memory usage
|
|
77
|
+
- Use `disableCache = true` for environments with <1GB RAM per browser
|
|
78
|
+
|
|
70
79
|
### Custom Commands in cli.toml
|
|
71
80
|
|
|
72
81
|
```toml
|
package/dist/index.js
CHANGED
|
@@ -53,7 +53,7 @@ class BrowserSessionManager {
|
|
|
53
53
|
}
|
|
54
54
|
async startBrowser(options = {}) {
|
|
55
55
|
this.logger.debug(`[BrowserSessionManager] startBrowser headless=${options.headless ?? true} url=${options.url ?? "none"}`);
|
|
56
|
-
const { headless = true, url, proxy, geoip = false, disableCache = false } = options;
|
|
56
|
+
const { headless = true, url, proxy, geoip = false, disableCache = false, navigationTimeoutMs = 60000 } = options;
|
|
57
57
|
const BROWSER_LAUNCH_TIMEOUT = 30000;
|
|
58
58
|
const MAX_RETRIES = 2;
|
|
59
59
|
const RETRY_DELAY = 1000;
|
|
@@ -97,7 +97,7 @@ class BrowserSessionManager {
|
|
|
97
97
|
this.pages.set(pageId, { page, browserId });
|
|
98
98
|
this.logger.debug(`[BrowserSessionManager] Browser started browserId=${browserId} pageId=${pageId}`);
|
|
99
99
|
if (url) {
|
|
100
|
-
await page.goto(url);
|
|
100
|
+
await page.goto(url, { timeout: navigationTimeoutMs, waitUntil: "domcontentloaded" });
|
|
101
101
|
}
|
|
102
102
|
return {
|
|
103
103
|
browserId,
|
|
@@ -151,7 +151,7 @@ class BrowserSessionManager {
|
|
|
151
151
|
this.pages.set(pageId, { page, browserId });
|
|
152
152
|
this.logger.debug(`[BrowserSessionManager] Page created pageId=${pageId}`);
|
|
153
153
|
if (url) {
|
|
154
|
-
await page.goto(url);
|
|
154
|
+
await page.goto(url, { timeout: 60000, waitUntil: "domcontentloaded" });
|
|
155
155
|
}
|
|
156
156
|
return {
|
|
157
157
|
pageId,
|
|
@@ -15029,7 +15029,7 @@ class Navigate extends Gadget8({
|
|
|
15029
15029
|
alreadyOnPage: true
|
|
15030
15030
|
});
|
|
15031
15031
|
}
|
|
15032
|
-
await page.goto(params.url);
|
|
15032
|
+
await page.goto(params.url, { timeout: 60000, waitUntil: "domcontentloaded" });
|
|
15033
15033
|
return JSON.stringify({
|
|
15034
15034
|
url: page.url(),
|
|
15035
15035
|
title: await page.title()
|
|
@@ -15172,7 +15172,7 @@ class Reload extends Gadget8({
|
|
|
15172
15172
|
logger9.debug(`[Reload] pageId=${params.pageId}`);
|
|
15173
15173
|
try {
|
|
15174
15174
|
const page = this.manager.requirePage(params.pageId);
|
|
15175
|
-
await page.reload();
|
|
15175
|
+
await page.reload({ timeout: 60000, waitUntil: "domcontentloaded" });
|
|
15176
15176
|
return JSON.stringify({
|
|
15177
15177
|
success: true,
|
|
15178
15178
|
url: page.url(),
|
|
@@ -16182,7 +16182,8 @@ Use this for web research, data extraction, form filling, or any web-based task.
|
|
|
16182
16182
|
model: z14.string().optional().describe("Model to use for the browser agent (default: inherit from parent agent, configurable via CLI)"),
|
|
16183
16183
|
headless: z14.boolean().optional().describe("Run browser in headless mode (default: true, configurable via CLI)"),
|
|
16184
16184
|
timeoutMs: z14.number().optional().describe("Overall timeout in ms (default: 300000 = 5 min, 0 = disabled, configurable via CLI)"),
|
|
16185
|
-
disableCache: z14.boolean().optional().describe("Disable browser cache for lower memory usage (default: false, configurable via CLI)")
|
|
16185
|
+
disableCache: z14.boolean().optional().describe("Disable browser cache for lower memory usage (default: false, configurable via CLI)"),
|
|
16186
|
+
navigationTimeoutMs: z14.number().optional().describe("Navigation timeout in ms (default: 60000, configurable via CLI)")
|
|
16186
16187
|
}),
|
|
16187
16188
|
timeoutMs: 300000
|
|
16188
16189
|
}) {
|
|
@@ -16216,17 +16217,23 @@ Use this for web research, data extraction, form filling, or any web-based task.
|
|
|
16216
16217
|
subagentKey: "disableCache",
|
|
16217
16218
|
defaultValue: false
|
|
16218
16219
|
});
|
|
16220
|
+
const navigationTimeoutMs = resolveValue(ctx, "BrowseWeb", {
|
|
16221
|
+
runtime: params.navigationTimeoutMs,
|
|
16222
|
+
subagentKey: "navigationTimeoutMs",
|
|
16223
|
+
defaultValue: 60000
|
|
16224
|
+
});
|
|
16219
16225
|
const collectedMedia = [];
|
|
16220
16226
|
const manager = this.customSessionManager ?? new BrowserSessionManager(logger13);
|
|
16221
16227
|
const isOwnedManager = !this.customSessionManager;
|
|
16222
16228
|
try {
|
|
16223
16229
|
let pageId;
|
|
16224
16230
|
if (isOwnedManager) {
|
|
16225
|
-
logger13?.debug(`[BrowseWeb] Starting browser headless=${headless} disableCache=${disableCache}...`);
|
|
16231
|
+
logger13?.debug(`[BrowseWeb] Starting browser headless=${headless} disableCache=${disableCache} navigationTimeoutMs=${navigationTimeoutMs}...`);
|
|
16226
16232
|
const result = await manager.startBrowser({
|
|
16227
16233
|
headless,
|
|
16228
16234
|
url: url2,
|
|
16229
|
-
disableCache
|
|
16235
|
+
disableCache,
|
|
16236
|
+
navigationTimeoutMs
|
|
16230
16237
|
});
|
|
16231
16238
|
pageId = result.pageId;
|
|
16232
16239
|
logger13?.debug(`[BrowseWeb] Browser started pageId=${pageId}`);
|
|
@@ -17,6 +17,8 @@ export interface StartBrowserOptions {
|
|
|
17
17
|
geoip?: boolean;
|
|
18
18
|
/** Disable browser cache to reduce memory usage */
|
|
19
19
|
disableCache?: boolean;
|
|
20
|
+
/** Navigation timeout in milliseconds (default: 60000) */
|
|
21
|
+
navigationTimeoutMs?: number;
|
|
20
22
|
}
|
|
21
23
|
export interface StartBrowserResult {
|
|
22
24
|
browserId: string;
|
|
@@ -30,6 +30,7 @@ declare const Dhalsim_base: new () => {
|
|
|
30
30
|
headless: z.ZodOptional<z.ZodBoolean>;
|
|
31
31
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
32
32
|
disableCache: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
navigationTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
33
34
|
}, z.core.$strip>;
|
|
34
35
|
name: string | undefined;
|
|
35
36
|
timeoutMs: number | undefined;
|
|
@@ -41,6 +42,7 @@ declare const Dhalsim_base: new () => {
|
|
|
41
42
|
headless?: boolean | undefined;
|
|
42
43
|
timeoutMs?: number | undefined;
|
|
43
44
|
disableCache?: boolean | undefined;
|
|
45
|
+
navigationTimeoutMs?: number | undefined;
|
|
44
46
|
}>[] | undefined;
|
|
45
47
|
readonly params: {
|
|
46
48
|
task: string;
|
|
@@ -50,6 +52,7 @@ declare const Dhalsim_base: new () => {
|
|
|
50
52
|
headless?: boolean | undefined;
|
|
51
53
|
timeoutMs?: number | undefined;
|
|
52
54
|
disableCache?: boolean | undefined;
|
|
55
|
+
navigationTimeoutMs?: number | undefined;
|
|
53
56
|
};
|
|
54
57
|
execute(params: Record<string, unknown>, ctx?: ExecutionContext): import("llmist").GadgetExecuteReturn | Promise<import("llmist").GadgetExecuteReturn>;
|
|
55
58
|
throwIfAborted(ctx?: ExecutionContext): void;
|
|
@@ -70,6 +73,7 @@ declare const Dhalsim_base: new () => {
|
|
|
70
73
|
headless?: boolean | undefined;
|
|
71
74
|
timeoutMs?: number | undefined;
|
|
72
75
|
disableCache?: boolean | undefined;
|
|
76
|
+
navigationTimeoutMs?: number | undefined;
|
|
73
77
|
};
|
|
74
78
|
};
|
|
75
79
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dhalsim",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Browser automation for llmist agents using Camoufox anti-detect browser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@biomejs/biome": "^2.3.2",
|
|
92
|
-
"@llmist/testing": "
|
|
92
|
+
"@llmist/testing": "^11.1.0",
|
|
93
93
|
"@semantic-release/changelog": "^6.0.3",
|
|
94
94
|
"@semantic-release/git": "^10.0.1",
|
|
95
95
|
"@semantic-release/github": "^12.0.2",
|
|
@@ -98,12 +98,12 @@
|
|
|
98
98
|
"bun-types": "^1.3.2",
|
|
99
99
|
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
100
100
|
"lefthook": "^1.6.0",
|
|
101
|
-
"llmist": "^
|
|
101
|
+
"llmist": "^11.1.0",
|
|
102
102
|
"semantic-release": "^25.0.2",
|
|
103
103
|
"typescript": "^5.4.5",
|
|
104
104
|
"vitest": "^4.0.15"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"llmist": ">=
|
|
107
|
+
"llmist": ">=11.1.0"
|
|
108
108
|
}
|
|
109
109
|
}
|