@mseep/clawdcursor 1.5.5
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/CHANGELOG.md +2264 -0
- package/LICENSE +21 -0
- package/README.md +385 -0
- package/SECURITY.md +44 -0
- package/SKILL.md +503 -0
- package/dist/core/agent-loop/agent.d.ts +42 -0
- package/dist/core/agent-loop/agent.js +1023 -0
- package/dist/core/agent-loop/agent.js.map +1 -0
- package/dist/core/agent-loop/batch-tool.d.ts +25 -0
- package/dist/core/agent-loop/batch-tool.js +218 -0
- package/dist/core/agent-loop/batch-tool.js.map +1 -0
- package/dist/core/agent-loop/coord-scale.d.ts +72 -0
- package/dist/core/agent-loop/coord-scale.js +89 -0
- package/dist/core/agent-loop/coord-scale.js.map +1 -0
- package/dist/core/agent-loop/focus-guard.d.ts +24 -0
- package/dist/core/agent-loop/focus-guard.js +29 -0
- package/dist/core/agent-loop/focus-guard.js.map +1 -0
- package/dist/core/agent-loop/project-mcp.d.ts +97 -0
- package/dist/core/agent-loop/project-mcp.js +253 -0
- package/dist/core/agent-loop/project-mcp.js.map +1 -0
- package/dist/core/agent-loop/prompt.d.ts +45 -0
- package/dist/core/agent-loop/prompt.js +426 -0
- package/dist/core/agent-loop/prompt.js.map +1 -0
- package/dist/core/agent-loop/tool-meta.d.ts +93 -0
- package/dist/core/agent-loop/tool-meta.js +651 -0
- package/dist/core/agent-loop/tool-meta.js.map +1 -0
- package/dist/core/agent-loop/tools.d.ts +38 -0
- package/dist/core/agent-loop/tools.js +2134 -0
- package/dist/core/agent-loop/tools.js.map +1 -0
- package/dist/core/agent-loop/types.d.ts +170 -0
- package/dist/core/agent-loop/types.js +12 -0
- package/dist/core/agent-loop/types.js.map +1 -0
- package/dist/core/agent.d.ts +51 -0
- package/dist/core/agent.js +245 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/app-categories.d.ts +67 -0
- package/dist/core/app-categories.js +108 -0
- package/dist/core/app-categories.js.map +1 -0
- package/dist/core/banner.d.ts +70 -0
- package/dist/core/banner.js +245 -0
- package/dist/core/banner.js.map +1 -0
- package/dist/core/classify/capability.d.ts +45 -0
- package/dist/core/classify/capability.js +78 -0
- package/dist/core/classify/capability.js.map +1 -0
- package/dist/core/decompose/llm-decomposer.d.ts +35 -0
- package/dist/core/decompose/llm-decomposer.js +156 -0
- package/dist/core/decompose/llm-decomposer.js.map +1 -0
- package/dist/core/decompose/parser.d.ts +27 -0
- package/dist/core/decompose/parser.js +101 -0
- package/dist/core/decompose/parser.js.map +1 -0
- package/dist/core/observability/correlation.d.ts +19 -0
- package/dist/core/observability/correlation.js +36 -0
- package/dist/core/observability/correlation.js.map +1 -0
- package/dist/core/observability/cost-meter.d.ts +51 -0
- package/dist/core/observability/cost-meter.js +134 -0
- package/dist/core/observability/cost-meter.js.map +1 -0
- package/dist/core/observability/logger.d.ts +61 -0
- package/dist/core/observability/logger.js +550 -0
- package/dist/core/observability/logger.js.map +1 -0
- package/dist/core/router/aliases.d.ts +50 -0
- package/dist/core/router/aliases.js +104 -0
- package/dist/core/router/aliases.js.map +1 -0
- package/dist/core/router/normalize.d.ts +41 -0
- package/dist/core/router/normalize.js +80 -0
- package/dist/core/router/normalize.js.map +1 -0
- package/dist/core/safety.d.ts +126 -0
- package/dist/core/safety.js +568 -0
- package/dist/core/safety.js.map +1 -0
- package/dist/core/sense/a11y-resolver.d.ts +73 -0
- package/dist/core/sense/a11y-resolver.js +76 -0
- package/dist/core/sense/a11y-resolver.js.map +1 -0
- package/dist/core/sense/fingerprint.d.ts +41 -0
- package/dist/core/sense/fingerprint.js +123 -0
- package/dist/core/sense/fingerprint.js.map +1 -0
- package/dist/core/sense/rank.d.ts +70 -0
- package/dist/core/sense/rank.js +192 -0
- package/dist/core/sense/rank.js.map +1 -0
- package/dist/core/sense/reactive-check.d.ts +40 -0
- package/dist/core/sense/reactive-check.js +48 -0
- package/dist/core/sense/reactive-check.js.map +1 -0
- package/dist/core/sense/snapshot.d.ts +19 -0
- package/dist/core/sense/snapshot.js +100 -0
- package/dist/core/sense/snapshot.js.map +1 -0
- package/dist/core/sense/types.d.ts +66 -0
- package/dist/core/sense/types.js +9 -0
- package/dist/core/sense/types.js.map +1 -0
- package/dist/core/sense/ui-map-anchors.d.ts +7 -0
- package/dist/core/sense/ui-map-anchors.js +24 -0
- package/dist/core/sense/ui-map-anchors.js.map +1 -0
- package/dist/core/sense/ui-map-elements.d.ts +5 -0
- package/dist/core/sense/ui-map-elements.js +33 -0
- package/dist/core/sense/ui-map-elements.js.map +1 -0
- package/dist/core/sense/ui-map-find.d.ts +56 -0
- package/dist/core/sense/ui-map-find.js +153 -0
- package/dist/core/sense/ui-map-find.js.map +1 -0
- package/dist/core/sense/ui-map-fuse.d.ts +4 -0
- package/dist/core/sense/ui-map-fuse.js +44 -0
- package/dist/core/sense/ui-map-fuse.js.map +1 -0
- package/dist/core/sense/ui-map-geom.d.ts +3 -0
- package/dist/core/sense/ui-map-geom.js +16 -0
- package/dist/core/sense/ui-map-geom.js.map +1 -0
- package/dist/core/sense/ui-map-holder.d.ts +58 -0
- package/dist/core/sense/ui-map-holder.js +87 -0
- package/dist/core/sense/ui-map-holder.js.map +1 -0
- package/dist/core/sense/ui-map-normalize.d.ts +19 -0
- package/dist/core/sense/ui-map-normalize.js +65 -0
- package/dist/core/sense/ui-map-normalize.js.map +1 -0
- package/dist/core/sense/ui-map-render.d.ts +4 -0
- package/dist/core/sense/ui-map-render.js +34 -0
- package/dist/core/sense/ui-map-render.js.map +1 -0
- package/dist/core/sense/ui-map-resolve.d.ts +41 -0
- package/dist/core/sense/ui-map-resolve.js +59 -0
- package/dist/core/sense/ui-map-resolve.js.map +1 -0
- package/dist/core/sense/ui-map-types.d.ts +66 -0
- package/dist/core/sense/ui-map-types.js +11 -0
- package/dist/core/sense/ui-map-types.js.map +1 -0
- package/dist/core/sense/ui-map.d.ts +29 -0
- package/dist/core/sense/ui-map.js +113 -0
- package/dist/core/sense/ui-map.js.map +1 -0
- package/dist/core/verify/assertions.d.ts +132 -0
- package/dist/core/verify/assertions.js +284 -0
- package/dist/core/verify/assertions.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/browser-config.d.ts +36 -0
- package/dist/llm/browser-config.js +83 -0
- package/dist/llm/browser-config.js.map +1 -0
- package/dist/llm/client.d.ts +268 -0
- package/dist/llm/client.js +1094 -0
- package/dist/llm/client.js.map +1 -0
- package/dist/llm/config.d.ts +79 -0
- package/dist/llm/config.js +375 -0
- package/dist/llm/config.js.map +1 -0
- package/dist/llm/credentials.d.ts +35 -0
- package/dist/llm/credentials.js +491 -0
- package/dist/llm/credentials.js.map +1 -0
- package/dist/llm/external-creds.d.ts +42 -0
- package/dist/llm/external-creds.js +169 -0
- package/dist/llm/external-creds.js.map +1 -0
- package/dist/llm/providers.d.ts +123 -0
- package/dist/llm/providers.js +717 -0
- package/dist/llm/providers.js.map +1 -0
- package/dist/paths.d.ts +31 -0
- package/dist/paths.js +147 -0
- package/dist/paths.js.map +1 -0
- package/dist/platform/accessibility.d.ts +139 -0
- package/dist/platform/accessibility.js +670 -0
- package/dist/platform/accessibility.js.map +1 -0
- package/dist/platform/cdp-driver.d.ts +318 -0
- package/dist/platform/cdp-driver.js +1179 -0
- package/dist/platform/cdp-driver.js.map +1 -0
- package/dist/platform/index.d.ts +11 -0
- package/dist/platform/index.js +69 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/keys.d.ts +17 -0
- package/dist/platform/keys.js +129 -0
- package/dist/platform/keys.js.map +1 -0
- package/dist/platform/launch-poll.d.ts +101 -0
- package/dist/platform/launch-poll.js +177 -0
- package/dist/platform/launch-poll.js.map +1 -0
- package/dist/platform/linux.d.ts +173 -0
- package/dist/platform/linux.js +1253 -0
- package/dist/platform/linux.js.map +1 -0
- package/dist/platform/macos.d.ts +136 -0
- package/dist/platform/macos.js +976 -0
- package/dist/platform/macos.js.map +1 -0
- package/dist/platform/native-desktop.d.ts +145 -0
- package/dist/platform/native-desktop.js +936 -0
- package/dist/platform/native-desktop.js.map +1 -0
- package/dist/platform/native-helper.d.ts +130 -0
- package/dist/platform/native-helper.js +592 -0
- package/dist/platform/native-helper.js.map +1 -0
- package/dist/platform/ocr-engine.d.ts +78 -0
- package/dist/platform/ocr-engine.js +363 -0
- package/dist/platform/ocr-engine.js.map +1 -0
- package/dist/platform/ps-runner.d.ts +28 -0
- package/dist/platform/ps-runner.js +228 -0
- package/dist/platform/ps-runner.js.map +1 -0
- package/dist/platform/types.d.ts +397 -0
- package/dist/platform/types.js +15 -0
- package/dist/platform/types.js.map +1 -0
- package/dist/platform/uri-handler.d.ts +75 -0
- package/dist/platform/uri-handler.js +273 -0
- package/dist/platform/uri-handler.js.map +1 -0
- package/dist/platform/wayland-backend.d.ts +53 -0
- package/dist/platform/wayland-backend.js +348 -0
- package/dist/platform/wayland-backend.js.map +1 -0
- package/dist/platform/windows.d.ts +232 -0
- package/dist/platform/windows.js +1210 -0
- package/dist/platform/windows.js.map +1 -0
- package/dist/postbuild.d.ts +10 -0
- package/dist/postbuild.js +98 -0
- package/dist/postbuild.js.map +1 -0
- package/dist/schema/snapshot.d.ts +33 -0
- package/dist/schema/snapshot.js +90 -0
- package/dist/schema/snapshot.js.map +1 -0
- package/dist/shortcuts.d.ts +30 -0
- package/dist/shortcuts.js +261 -0
- package/dist/shortcuts.js.map +1 -0
- package/dist/surface/cli.d.ts +7 -0
- package/dist/surface/cli.js +1556 -0
- package/dist/surface/cli.js.map +1 -0
- package/dist/surface/dashboard.d.ts +8 -0
- package/dist/surface/dashboard.js +1193 -0
- package/dist/surface/dashboard.js.map +1 -0
- package/dist/surface/doctor.d.ts +29 -0
- package/dist/surface/doctor.js +1514 -0
- package/dist/surface/doctor.js.map +1 -0
- package/dist/surface/format.d.ts +10 -0
- package/dist/surface/format.js +37 -0
- package/dist/surface/format.js.map +1 -0
- package/dist/surface/http-utility.d.ts +65 -0
- package/dist/surface/http-utility.js +336 -0
- package/dist/surface/http-utility.js.map +1 -0
- package/dist/surface/mcp-server.d.ts +91 -0
- package/dist/surface/mcp-server.js +280 -0
- package/dist/surface/mcp-server.js.map +1 -0
- package/dist/surface/onboarding.d.ts +15 -0
- package/dist/surface/onboarding.js +184 -0
- package/dist/surface/onboarding.js.map +1 -0
- package/dist/surface/pidfile.d.ts +79 -0
- package/dist/surface/pidfile.js +263 -0
- package/dist/surface/pidfile.js.map +1 -0
- package/dist/surface/readiness.d.ts +45 -0
- package/dist/surface/readiness.js +230 -0
- package/dist/surface/readiness.js.map +1 -0
- package/dist/surface/report.d.ts +68 -0
- package/dist/surface/report.js +341 -0
- package/dist/surface/report.js.map +1 -0
- package/dist/surface/skill-register.d.ts +14 -0
- package/dist/surface/skill-register.js +150 -0
- package/dist/surface/skill-register.js.map +1 -0
- package/dist/surface/version.d.ts +6 -0
- package/dist/surface/version.js +27 -0
- package/dist/surface/version.js.map +1 -0
- package/dist/tools/a11y.d.ts +8 -0
- package/dist/tools/a11y.js +545 -0
- package/dist/tools/a11y.js.map +1 -0
- package/dist/tools/a11y_depth.d.ts +19 -0
- package/dist/tools/a11y_depth.js +455 -0
- package/dist/tools/a11y_depth.js.map +1 -0
- package/dist/tools/agent.d.ts +15 -0
- package/dist/tools/agent.js +248 -0
- package/dist/tools/agent.js.map +1 -0
- package/dist/tools/batch.d.ts +46 -0
- package/dist/tools/batch.js +230 -0
- package/dist/tools/batch.js.map +1 -0
- package/dist/tools/cdp.d.ts +8 -0
- package/dist/tools/cdp.js +233 -0
- package/dist/tools/cdp.js.map +1 -0
- package/dist/tools/compact.d.ts +63 -0
- package/dist/tools/compact.js +418 -0
- package/dist/tools/compact.js.map +1 -0
- package/dist/tools/cost-class.d.ts +38 -0
- package/dist/tools/cost-class.js +117 -0
- package/dist/tools/cost-class.js.map +1 -0
- package/dist/tools/desktop.d.ts +9 -0
- package/dist/tools/desktop.js +346 -0
- package/dist/tools/desktop.js.map +1 -0
- package/dist/tools/electron_bridge.d.ts +41 -0
- package/dist/tools/electron_bridge.js +261 -0
- package/dist/tools/electron_bridge.js.map +1 -0
- package/dist/tools/extras.d.ts +22 -0
- package/dist/tools/extras.js +942 -0
- package/dist/tools/extras.js.map +1 -0
- package/dist/tools/favorites.d.ts +13 -0
- package/dist/tools/favorites.js +137 -0
- package/dist/tools/favorites.js.map +1 -0
- package/dist/tools/introspection.d.ts +13 -0
- package/dist/tools/introspection.js +55 -0
- package/dist/tools/introspection.js.map +1 -0
- package/dist/tools/ocr.d.ts +8 -0
- package/dist/tools/ocr.js +66 -0
- package/dist/tools/ocr.js.map +1 -0
- package/dist/tools/orchestration.d.ts +7 -0
- package/dist/tools/orchestration.js +377 -0
- package/dist/tools/orchestration.js.map +1 -0
- package/dist/tools/playbooks/extract-compose.d.ts +22 -0
- package/dist/tools/playbooks/extract-compose.js +85 -0
- package/dist/tools/playbooks/extract-compose.js.map +1 -0
- package/dist/tools/playbooks/find-replace.d.ts +11 -0
- package/dist/tools/playbooks/find-replace.js +56 -0
- package/dist/tools/playbooks/find-replace.js.map +1 -0
- package/dist/tools/playbooks/index.d.ts +63 -0
- package/dist/tools/playbooks/index.js +70 -0
- package/dist/tools/playbooks/index.js.map +1 -0
- package/dist/tools/playbooks/keys-blocklist.d.ts +24 -0
- package/dist/tools/playbooks/keys-blocklist.js +89 -0
- package/dist/tools/playbooks/keys-blocklist.js.map +1 -0
- package/dist/tools/registry.d.ts +40 -0
- package/dist/tools/registry.js +560 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/safety-gate.d.ts +16 -0
- package/dist/tools/safety-gate.js +70 -0
- package/dist/tools/safety-gate.js.map +1 -0
- package/dist/tools/scheduler.d.ts +76 -0
- package/dist/tools/scheduler.js +413 -0
- package/dist/tools/scheduler.js.map +1 -0
- package/dist/tools/shortcuts.d.ts +13 -0
- package/dist/tools/shortcuts.js +205 -0
- package/dist/tools/shortcuts.js.map +1 -0
- package/dist/tools/smart.d.ts +15 -0
- package/dist/tools/smart.js +785 -0
- package/dist/tools/smart.js.map +1 -0
- package/dist/tools/types.d.ts +174 -0
- package/dist/tools/types.js +67 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/window-text.d.ts +15 -0
- package/dist/tools/window-text.js +39 -0
- package/dist/tools/window-text.js.map +1 -0
- package/dist/types.d.ts +122 -0
- package/dist/types.js +41 -0
- package/dist/types.js.map +1 -0
- package/native/Package.swift +38 -0
- package/native/README.md +113 -0
- package/native/Sources/ClawdCursorHelper/main.swift +602 -0
- package/native/Sources/ClawdCursorHost/main.swift +182 -0
- package/native/Sources/PermissionCheck/main.swift +53 -0
- package/native/Sources/ScreenshotHelper/main.swift +219 -0
- package/native/build.sh +139 -0
- package/native/entitlements.plist +12 -0
- package/package.json +115 -0
- package/scripts/banner.ps1 +112 -0
- package/scripts/coord-accuracy.ps1 +140 -0
- package/scripts/coord-uwp.ps1 +80 -0
- package/scripts/edge-glow.ps1 +180 -0
- package/scripts/find-element.ps1 +198 -0
- package/scripts/get-foreground-window.ps1 +71 -0
- package/scripts/get-screen-context.ps1 +183 -0
- package/scripts/get-windows.ps1 +66 -0
- package/scripts/install-panic-hotkey.ps1 +46 -0
- package/scripts/interact-element.ps1 +431 -0
- package/scripts/invoke-element.ps1 +314 -0
- package/scripts/linux/atspi-bridge.py +356 -0
- package/scripts/linux/ocr-recognize.py +154 -0
- package/scripts/mac/_window-picker.jxa +163 -0
- package/scripts/mac/find-element.jxa +0 -0
- package/scripts/mac/find-element.sh +161 -0
- package/scripts/mac/focus-window.jxa +284 -0
- package/scripts/mac/get-focused-element.jxa +102 -0
- package/scripts/mac/get-foreground-window.jxa +173 -0
- package/scripts/mac/get-screen-context.jxa +197 -0
- package/scripts/mac/get-ui-tree.sh +141 -0
- package/scripts/mac/get-windows.jxa +117 -0
- package/scripts/mac/interact-element.sh +235 -0
- package/scripts/mac/invoke-element.jxa +408 -0
- package/scripts/mac/ocr-recognize.swift +124 -0
- package/scripts/ocr-recognize.ps1 +102 -0
- package/scripts/postinstall-native.js +48 -0
- package/scripts/ps-bridge.ps1 +830 -0
- package/scripts/smoke-mcp.ps1 +119 -0
- package/scripts/sync-version.ts +178 -0
- package/scripts/verify-install.js +81 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Browser Configuration — centralised helpers for browser detection and CDP port.
|
|
4
|
+
*
|
|
5
|
+
* All files that need to know which browser processes to match, what CDP port
|
|
6
|
+
* to connect to, or where the browser executable lives should import from here
|
|
7
|
+
* instead of hardcoding values.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AGENT_CDP_PORT = exports.DEFAULT_CDP_PORT = void 0;
|
|
11
|
+
exports.getBrowserExePath = getBrowserExePath;
|
|
12
|
+
exports.getBrowserProcessNames = getBrowserProcessNames;
|
|
13
|
+
exports.getCDPPort = getCDPPort;
|
|
14
|
+
exports.getBrowserProcessRegex = getBrowserProcessRegex;
|
|
15
|
+
exports.getChromePaths = getChromePaths;
|
|
16
|
+
exports.getEdgePaths = getEdgePaths;
|
|
17
|
+
exports.getBrowserPaths = getBrowserPaths;
|
|
18
|
+
exports.DEFAULT_CDP_PORT = 9223;
|
|
19
|
+
/**
|
|
20
|
+
* Port for the AGENT-OWNED dedicated browser instance (the one CDPDriver
|
|
21
|
+
* launches itself with `--user-data-dir=~/.clawdcursor/cdp-profile`).
|
|
22
|
+
*
|
|
23
|
+
* Deliberately DIFFERENT from DEFAULT_CDP_PORT (9223): ownership is encoded in
|
|
24
|
+
* the port. 9223 is reserved for browsers the USER put on the wire (their own
|
|
25
|
+
* launch flags, `relaunch_with_cdp`, the browser relay) — attaching there means
|
|
26
|
+
* "driving the user's session" and gets new-tab discipline. Sharing one port
|
|
27
|
+
* for both meant the driver could not tell its own instance from the user's:
|
|
28
|
+
* whoever squatted 9223 won, and a lingering agent instance the user adopted
|
|
29
|
+
* (music, browsing) got its tabs hijacked (root-cause fix 2026-06-11).
|
|
30
|
+
*/
|
|
31
|
+
exports.AGENT_CDP_PORT = Number(process.env.CLAWD_AGENT_CDP_PORT ?? '') || 9333;
|
|
32
|
+
const DEFAULT_BROWSER_PROCESSES = ['msedge', 'chrome', 'chromium', 'firefox', 'brave', 'opera', 'arc', 'safari'];
|
|
33
|
+
/** Get configured browser executable path, or null for auto-detection */
|
|
34
|
+
function getBrowserExePath(config) {
|
|
35
|
+
return config?.browser?.executablePath || null;
|
|
36
|
+
}
|
|
37
|
+
/** Get list of browser process names to match against */
|
|
38
|
+
function getBrowserProcessNames(config) {
|
|
39
|
+
if (config?.browser?.processName) {
|
|
40
|
+
return [config.browser.processName, ...DEFAULT_BROWSER_PROCESSES];
|
|
41
|
+
}
|
|
42
|
+
return DEFAULT_BROWSER_PROCESSES;
|
|
43
|
+
}
|
|
44
|
+
/** Get CDP debugging port */
|
|
45
|
+
function getCDPPort(config) {
|
|
46
|
+
return config?.browser?.cdpPort || exports.DEFAULT_CDP_PORT;
|
|
47
|
+
}
|
|
48
|
+
/** Build a regex matching browser process names */
|
|
49
|
+
function getBrowserProcessRegex(config) {
|
|
50
|
+
const names = getBrowserProcessNames(config);
|
|
51
|
+
return new RegExp(names.join('|'), 'i');
|
|
52
|
+
}
|
|
53
|
+
const PLATFORM = process.platform;
|
|
54
|
+
/** Get default Chrome executable paths for the current platform */
|
|
55
|
+
function getChromePaths() {
|
|
56
|
+
if (PLATFORM === 'darwin')
|
|
57
|
+
return ['/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'];
|
|
58
|
+
if (PLATFORM === 'linux')
|
|
59
|
+
return ['/usr/bin/google-chrome', '/usr/bin/google-chrome-stable', '/usr/bin/chromium', '/usr/bin/chromium-browser'];
|
|
60
|
+
return [
|
|
61
|
+
'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
|
|
62
|
+
'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
/** Get default Edge executable paths for the current platform */
|
|
66
|
+
function getEdgePaths() {
|
|
67
|
+
if (PLATFORM === 'darwin')
|
|
68
|
+
return ['/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge'];
|
|
69
|
+
if (PLATFORM === 'linux')
|
|
70
|
+
return ['/usr/bin/microsoft-edge'];
|
|
71
|
+
return [
|
|
72
|
+
'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe',
|
|
73
|
+
'C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe',
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
/** Get browser executable paths, respecting config overrides. Tries custom path first, then defaults. */
|
|
77
|
+
function getBrowserPaths(browser, config) {
|
|
78
|
+
const customExe = getBrowserExePath(config);
|
|
79
|
+
if (customExe)
|
|
80
|
+
return [customExe];
|
|
81
|
+
return browser === 'chrome' ? getChromePaths() : getEdgePaths();
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=browser-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-config.js","sourceRoot":"","sources":["../../src/llm/browser-config.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAuBH,8CAEC;AAGD,wDAKC;AAGD,gCAEC;AAGD,wDAGC;AAKD,wCAOC;AAGD,oCAOC;AAGD,0CAIC;AArEY,QAAA,gBAAgB,GAAG,IAAI,CAAC;AAErC;;;;;;;;;;;GAWG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC;AAErF,MAAM,yBAAyB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAEjH,yEAAyE;AACzE,SAAgB,iBAAiB,CAAC,MAAoB;IACpD,OAAO,MAAM,EAAE,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC;AACjD,CAAC;AAED,yDAAyD;AACzD,SAAgB,sBAAsB,CAAC,MAAoB;IACzD,IAAI,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QACjC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,yBAAyB,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,yBAAyB,CAAC;AACnC,CAAC;AAED,6BAA6B;AAC7B,SAAgB,UAAU,CAAC,MAAoB;IAC7C,OAAO,MAAM,EAAE,OAAO,EAAE,OAAO,IAAI,wBAAgB,CAAC;AACtD,CAAC;AAED,mDAAmD;AACnD,SAAgB,sBAAsB,CAAC,MAAoB;IACzD,MAAM,KAAK,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;AAElC,mEAAmE;AACnE,SAAgB,cAAc;IAC5B,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,CAAC,8DAA8D,CAAC,CAAC;IACnG,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,CAAC,wBAAwB,EAAE,+BAA+B,EAAE,mBAAmB,EAAE,2BAA2B,CAAC,CAAC;IAC/I,OAAO;QACL,4DAA4D;QAC5D,kEAAkE;KACnE,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,SAAgB,YAAY;IAC1B,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,CAAC,gEAAgE,CAAC,CAAC;IACrG,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC7D,OAAO;QACL,mEAAmE;QACnE,6DAA6D;KAC9D,CAAC;AACJ,CAAC;AAED,yGAAyG;AACzG,SAAgB,eAAe,CAAC,OAA0B,EAAE,MAAoB;IAC9E,MAAM,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,SAAS;QAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared LLM calling module — text AND vision.
|
|
3
|
+
*
|
|
4
|
+
* Text entry points:
|
|
5
|
+
* callTextLLM() — accepts PipelineConfig (used by pipeline reasoners)
|
|
6
|
+
* callTextLLMDirect() — accepts explicit provider params (used by pipeline preprocessor)
|
|
7
|
+
*
|
|
8
|
+
* Vision entry points:
|
|
9
|
+
* callVisionLLM() — accepts PipelineConfig
|
|
10
|
+
* callVisionLLMDirect() — accepts explicit provider params
|
|
11
|
+
*
|
|
12
|
+
* Image normalization: callers pass images in ANY format (OpenAI or Anthropic),
|
|
13
|
+
* and the client auto-converts to the correct format for the target provider.
|
|
14
|
+
*/
|
|
15
|
+
import { type PipelineConfig } from './providers';
|
|
16
|
+
export declare class LLMError extends Error {
|
|
17
|
+
constructor(msg: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class LLMAuthError extends LLMError {
|
|
20
|
+
constructor(msg: string);
|
|
21
|
+
}
|
|
22
|
+
export declare class LLMBillingError extends LLMError {
|
|
23
|
+
constructor(msg: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class LLMRateLimitError extends LLMError {
|
|
26
|
+
constructor(msg: string);
|
|
27
|
+
}
|
|
28
|
+
export declare class LLMModelNotFoundError extends LLMError {
|
|
29
|
+
constructor(msg: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class LLMServerError extends LLMError {
|
|
32
|
+
constructor(msg: string);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Apply any model-specific quirks to a request body in place.
|
|
36
|
+
*
|
|
37
|
+
* Lookup is by lowercase substring match on the model id. Every matching
|
|
38
|
+
* quirk runs (multiple rules can apply to the same model). Safe to call
|
|
39
|
+
* with any model id; unknown models pass through unchanged.
|
|
40
|
+
*/
|
|
41
|
+
export declare function applyModelQuirks(model: string, body: Record<string, unknown>): void;
|
|
42
|
+
export interface TextLLMOptions {
|
|
43
|
+
/** System prompt (used for single-turn, or ignored when `messages` is set) */
|
|
44
|
+
system?: string;
|
|
45
|
+
/** User message (used for single-turn, or ignored when `messages` is set) */
|
|
46
|
+
user?: string;
|
|
47
|
+
/** Full multi-turn messages array — overrides system/user when provided */
|
|
48
|
+
messages?: Array<{
|
|
49
|
+
role: string;
|
|
50
|
+
content: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** Force JSON response (OpenAI: response_format, Anthropic: prefill '{') */
|
|
53
|
+
forceJson?: boolean;
|
|
54
|
+
/** Max tokens to generate (default 500) */
|
|
55
|
+
maxTokens?: number;
|
|
56
|
+
/** Request timeout in milliseconds (default: none) */
|
|
57
|
+
timeoutMs?: number;
|
|
58
|
+
/** Number of retries with exponential backoff (default 0) */
|
|
59
|
+
retries?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface DirectLLMOptions extends TextLLMOptions {
|
|
62
|
+
baseUrl: string;
|
|
63
|
+
model: string;
|
|
64
|
+
apiKey: string;
|
|
65
|
+
isAnthropic: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Call a text LLM using PipelineConfig (used by reasoners).
|
|
69
|
+
*/
|
|
70
|
+
export declare function callTextLLM(config: PipelineConfig, options: TextLLMOptions): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Call a text LLM using explicit provider params (used by pipeline preprocessor).
|
|
73
|
+
*/
|
|
74
|
+
export declare function callTextLLMDirect(opts: DirectLLMOptions): Promise<string>;
|
|
75
|
+
/** Content block that can contain text or images in either OpenAI or Anthropic format. */
|
|
76
|
+
export type VisionContentBlock = {
|
|
77
|
+
type: 'text';
|
|
78
|
+
text: string;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'image_url';
|
|
81
|
+
image_url: {
|
|
82
|
+
url: string;
|
|
83
|
+
detail?: string;
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
type: 'image';
|
|
87
|
+
source: {
|
|
88
|
+
type: 'base64';
|
|
89
|
+
media_type: string;
|
|
90
|
+
data: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export interface VisionLLMOptions {
|
|
94
|
+
system?: string;
|
|
95
|
+
/** Messages with mixed text/image content blocks */
|
|
96
|
+
messages: Array<{
|
|
97
|
+
role: string;
|
|
98
|
+
content: string | VisionContentBlock[];
|
|
99
|
+
}>;
|
|
100
|
+
/** Force JSON response */
|
|
101
|
+
forceJson?: boolean;
|
|
102
|
+
/** Anthropic JSON prefill (e.g. '{"x":' for coordinate responses) */
|
|
103
|
+
jsonPrefill?: string;
|
|
104
|
+
maxTokens?: number;
|
|
105
|
+
timeoutMs?: number;
|
|
106
|
+
retries?: number;
|
|
107
|
+
/** Use SSE streaming with early JSON return (Anthropic only) */
|
|
108
|
+
stream?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface DirectVisionLLMOptions extends VisionLLMOptions {
|
|
111
|
+
baseUrl: string;
|
|
112
|
+
model: string;
|
|
113
|
+
apiKey: string;
|
|
114
|
+
isAnthropic: boolean;
|
|
115
|
+
providerProfile?: PipelineConfig['provider'];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Normalize an image content block to the target provider format.
|
|
119
|
+
* Callers can pass images in either OpenAI or Anthropic format.
|
|
120
|
+
*/
|
|
121
|
+
export declare function normalizeImageBlock(block: VisionContentBlock, isAnthropic: boolean): any;
|
|
122
|
+
/**
|
|
123
|
+
* Call a vision LLM using PipelineConfig.
|
|
124
|
+
* Uses layer3 config (vision model) with layer2 as fallback.
|
|
125
|
+
*/
|
|
126
|
+
export declare function callVisionLLM(config: PipelineConfig, options: VisionLLMOptions): Promise<string>;
|
|
127
|
+
/**
|
|
128
|
+
* Call a vision LLM with explicit provider params.
|
|
129
|
+
*/
|
|
130
|
+
export declare function callVisionLLMDirect(opts: DirectVisionLLMOptions): Promise<string>;
|
|
131
|
+
/**
|
|
132
|
+
* A tool the model can call. Mirrors Anthropic's `tools` schema and
|
|
133
|
+
* OpenAI's `tools[].function` schema — both accept JSON-Schema input.
|
|
134
|
+
*/
|
|
135
|
+
export interface LLMTool {
|
|
136
|
+
name: string;
|
|
137
|
+
description: string;
|
|
138
|
+
/** JSON Schema for the tool's arguments. */
|
|
139
|
+
inputSchema: {
|
|
140
|
+
type: 'object';
|
|
141
|
+
properties: Record<string, unknown>;
|
|
142
|
+
required?: string[];
|
|
143
|
+
additionalProperties?: boolean;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* One structured tool call extracted from the model response. The agent
|
|
148
|
+
* runs this and feeds the result back on the next turn as a
|
|
149
|
+
* `tool_result` content block.
|
|
150
|
+
*/
|
|
151
|
+
export interface LLMToolCall {
|
|
152
|
+
/** Provider-assigned ID, used to associate the subsequent tool_result block. */
|
|
153
|
+
id: string;
|
|
154
|
+
name: string;
|
|
155
|
+
/** Already-parsed JSON args (never a JSON string). */
|
|
156
|
+
args: Record<string, unknown>;
|
|
157
|
+
}
|
|
158
|
+
/** Content blocks the agent's assistant turn can produce. */
|
|
159
|
+
export type LLMAssistantBlock = {
|
|
160
|
+
type: 'text';
|
|
161
|
+
text: string;
|
|
162
|
+
} | {
|
|
163
|
+
type: 'tool_use';
|
|
164
|
+
id: string;
|
|
165
|
+
name: string;
|
|
166
|
+
input: Record<string, unknown>;
|
|
167
|
+
};
|
|
168
|
+
/** Content blocks a user turn can carry. */
|
|
169
|
+
export type LLMUserBlock = {
|
|
170
|
+
type: 'text';
|
|
171
|
+
text: string;
|
|
172
|
+
} | {
|
|
173
|
+
type: 'image';
|
|
174
|
+
source: {
|
|
175
|
+
type: 'base64';
|
|
176
|
+
media_type: string;
|
|
177
|
+
data: string;
|
|
178
|
+
};
|
|
179
|
+
} | {
|
|
180
|
+
type: 'image_url';
|
|
181
|
+
image_url: {
|
|
182
|
+
url: string;
|
|
183
|
+
detail?: string;
|
|
184
|
+
};
|
|
185
|
+
} | {
|
|
186
|
+
type: 'tool_result';
|
|
187
|
+
tool_use_id: string;
|
|
188
|
+
content: Array<{
|
|
189
|
+
type: 'text';
|
|
190
|
+
text: string;
|
|
191
|
+
} | {
|
|
192
|
+
type: 'image';
|
|
193
|
+
source: {
|
|
194
|
+
type: 'base64';
|
|
195
|
+
media_type: string;
|
|
196
|
+
data: string;
|
|
197
|
+
};
|
|
198
|
+
}>;
|
|
199
|
+
is_error?: boolean;
|
|
200
|
+
};
|
|
201
|
+
/** Conversation turn for the tool-use API. */
|
|
202
|
+
export interface LLMToolTurn {
|
|
203
|
+
role: 'user' | 'assistant';
|
|
204
|
+
content: string | LLMUserBlock[] | LLMAssistantBlock[];
|
|
205
|
+
}
|
|
206
|
+
export interface ToolUseResult {
|
|
207
|
+
/** Free-text prose the model emitted alongside tool calls (if any). */
|
|
208
|
+
text: string;
|
|
209
|
+
/** Zero or more tool calls in the order the model emitted them. */
|
|
210
|
+
toolCalls: LLMToolCall[];
|
|
211
|
+
/** Provider reason the turn ended — `tool_use` / `end_turn` / `stop` / `length`. */
|
|
212
|
+
stopReason: string;
|
|
213
|
+
/** Raw assistant content — forward verbatim on the next turn as `{role:'assistant', content: raw}`. */
|
|
214
|
+
raw: LLMAssistantBlock[];
|
|
215
|
+
}
|
|
216
|
+
export interface DirectToolUseOptions {
|
|
217
|
+
baseUrl: string;
|
|
218
|
+
model: string;
|
|
219
|
+
apiKey: string;
|
|
220
|
+
isAnthropic: boolean;
|
|
221
|
+
system: string;
|
|
222
|
+
tools: LLMTool[];
|
|
223
|
+
messages: LLMToolTurn[];
|
|
224
|
+
/** "auto" (default) | "any" | "none" | specific tool name */
|
|
225
|
+
toolChoice?: 'auto' | 'any' | 'none' | {
|
|
226
|
+
name: string;
|
|
227
|
+
};
|
|
228
|
+
maxTokens?: number;
|
|
229
|
+
timeoutMs?: number;
|
|
230
|
+
/** External abort (user stop) — combined with the per-call timeout. */
|
|
231
|
+
signal?: AbortSignal;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Invoke an LLM with a tool catalog. Prefers native tool_use (Anthropic)
|
|
235
|
+
* or tool_calls (OpenAI) and falls back to JSON-in-prose parsing for
|
|
236
|
+
* providers that lack native support (Ollama text-only models, etc.).
|
|
237
|
+
*
|
|
238
|
+
* The caller supplies the tool catalog + multi-turn messages; the function
|
|
239
|
+
* returns a structured ToolUseResult with parsed tool calls. The agent runs
|
|
240
|
+
* each tool and feeds results back as `tool_result` blocks on the next turn.
|
|
241
|
+
*/
|
|
242
|
+
export declare function callLLMWithTools(opts: DirectToolUseOptions): Promise<ToolUseResult>;
|
|
243
|
+
/**
|
|
244
|
+
* Fallback prose→tool-call parser for providers that don't emit native tool_calls.
|
|
245
|
+
*
|
|
246
|
+
* Recognizes three families:
|
|
247
|
+
*
|
|
248
|
+
* 1. **Prefix-style** (Kimi `moonshot-v1-*`, some DeepSeek / Qwen text models):
|
|
249
|
+
* `functions.<TOOL>:<id>$\n{ "arg": "value" }`
|
|
250
|
+
* The function NAME lives in the prefix; the JSON body is the args.
|
|
251
|
+
*
|
|
252
|
+
* 2. **Llama-style** (some Llama/Mistral fine-tunes):
|
|
253
|
+
* `<function=NAME>{...args JSON...}</function>`
|
|
254
|
+
* Or: `<|tool_call|>NAME\n{...}`
|
|
255
|
+
*
|
|
256
|
+
* 3. **JSON-only** (older Ollama, generic text fallbacks):
|
|
257
|
+
* A bare JSON object with `tool|name|action` + `args|input|parameters` keys.
|
|
258
|
+
*
|
|
259
|
+
* The parser tries each in order and returns the first match. Returns null
|
|
260
|
+
* when nothing parses — the caller treats that as a legitimate text-only reply.
|
|
261
|
+
*
|
|
262
|
+
* Pattern-matched, NOT model-name-matched, so any provider that emits one
|
|
263
|
+
* of these formats works without an explicit allowlist entry.
|
|
264
|
+
*/
|
|
265
|
+
export declare function tryParseProseToolCall(prose: string): {
|
|
266
|
+
name: string;
|
|
267
|
+
args: Record<string, unknown>;
|
|
268
|
+
} | null;
|