@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,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playbook registry.
|
|
3
|
+
*
|
|
4
|
+
* Playbooks are app-AGNOSTIC keyboard choreographies for known capability
|
|
5
|
+
* shapes the vision loop would otherwise re-discover on every run. They
|
|
6
|
+
* are NOT app-specific shortcuts. Each playbook implements ONE capability
|
|
7
|
+
* (e.g. "compose+submit a form with To/Subject/Body fields") and works
|
|
8
|
+
* across every app that follows the same UX convention.
|
|
9
|
+
*
|
|
10
|
+
* Dispatch: matchPlaybook routes by CAPABILITY (the user's intent),
|
|
11
|
+
* never by app name. This is the key rule: if the same user intent
|
|
12
|
+
* routes to two different playbooks because the active app changed,
|
|
13
|
+
* the playbooks should be merged.
|
|
14
|
+
*
|
|
15
|
+
* Dispatched by the pipeline as a first-class Strategy ('playbook') sitting
|
|
16
|
+
* between the router and the LLM ladder; NOT exposed on the public MCP
|
|
17
|
+
* surface. compose-send specifically prefers the OS protocol-handler path
|
|
18
|
+
* (mailto://, tel://, slack://, vscode://, ...) via
|
|
19
|
+
* resolveSchemeHandlerExecutable + launchHandlerAndVerify; the in-app
|
|
20
|
+
* keyboard choreography here is the fallback when no protocol handler is
|
|
21
|
+
* registered or the dispatched window never appears.
|
|
22
|
+
*
|
|
23
|
+
* Each playbook is a pure function over PlatformAdapter + args. No
|
|
24
|
+
* per-playbook state, no retries (that's the verifier's job).
|
|
25
|
+
*/
|
|
26
|
+
import type { PlatformAdapter } from '../../platform/types';
|
|
27
|
+
import { findReplace } from './find-replace';
|
|
28
|
+
export interface PlaybookResult {
|
|
29
|
+
success: boolean;
|
|
30
|
+
/** One-line description for logs + verifier context. */
|
|
31
|
+
text: string;
|
|
32
|
+
/** Trace of executed steps for skill-cache recording. */
|
|
33
|
+
steps: Array<{
|
|
34
|
+
type: 'click' | 'type' | 'key' | 'scroll' | 'wait';
|
|
35
|
+
description: string;
|
|
36
|
+
[k: string]: unknown;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export interface PlaybookArgs {
|
|
40
|
+
adapter: PlatformAdapter;
|
|
41
|
+
/** Free-form args (recipient, subject, body, findText, etc.). */
|
|
42
|
+
input: Record<string, string | undefined>;
|
|
43
|
+
}
|
|
44
|
+
export type Playbook = (args: PlaybookArgs) => Promise<PlaybookResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Capability-keyed playbook registry. Keys describe the INTENT, not the
|
|
47
|
+
* app. New playbooks SHOULD be added if they generalize across apps;
|
|
48
|
+
* playbooks that name an app are an antipattern and should be merged
|
|
49
|
+
* into a capability-keyed sibling.
|
|
50
|
+
*/
|
|
51
|
+
export declare const PLAYBOOKS: Record<string, Playbook>;
|
|
52
|
+
/**
|
|
53
|
+
* Match a task to a playbook name by CAPABILITY ONLY. activeApp is
|
|
54
|
+
* intentionally not consulted \u2014 if the same intent needs two different
|
|
55
|
+
* playbooks for two different apps, merge them. The first-class path
|
|
56
|
+
* for email is open_uri(mailto: ...); we offer compose-send as the
|
|
57
|
+
* in-UI fallback when the user explicitly wants to compose in-app.
|
|
58
|
+
*
|
|
59
|
+
* Returns null when nothing matches \u2014 caller proceeds with the
|
|
60
|
+
* text-agent's normal a11y-driven flow.
|
|
61
|
+
*/
|
|
62
|
+
export declare function matchPlaybook(task: string, _activeApp: string): string | null;
|
|
63
|
+
export { findReplace };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Playbook registry.
|
|
4
|
+
*
|
|
5
|
+
* Playbooks are app-AGNOSTIC keyboard choreographies for known capability
|
|
6
|
+
* shapes the vision loop would otherwise re-discover on every run. They
|
|
7
|
+
* are NOT app-specific shortcuts. Each playbook implements ONE capability
|
|
8
|
+
* (e.g. "compose+submit a form with To/Subject/Body fields") and works
|
|
9
|
+
* across every app that follows the same UX convention.
|
|
10
|
+
*
|
|
11
|
+
* Dispatch: matchPlaybook routes by CAPABILITY (the user's intent),
|
|
12
|
+
* never by app name. This is the key rule: if the same user intent
|
|
13
|
+
* routes to two different playbooks because the active app changed,
|
|
14
|
+
* the playbooks should be merged.
|
|
15
|
+
*
|
|
16
|
+
* Dispatched by the pipeline as a first-class Strategy ('playbook') sitting
|
|
17
|
+
* between the router and the LLM ladder; NOT exposed on the public MCP
|
|
18
|
+
* surface. compose-send specifically prefers the OS protocol-handler path
|
|
19
|
+
* (mailto://, tel://, slack://, vscode://, ...) via
|
|
20
|
+
* resolveSchemeHandlerExecutable + launchHandlerAndVerify; the in-app
|
|
21
|
+
* keyboard choreography here is the fallback when no protocol handler is
|
|
22
|
+
* registered or the dispatched window never appears.
|
|
23
|
+
*
|
|
24
|
+
* Each playbook is a pure function over PlatformAdapter + args. No
|
|
25
|
+
* per-playbook state, no retries (that's the verifier's job).
|
|
26
|
+
*/
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.findReplace = exports.PLAYBOOKS = void 0;
|
|
29
|
+
exports.matchPlaybook = matchPlaybook;
|
|
30
|
+
const find_replace_1 = require("./find-replace");
|
|
31
|
+
Object.defineProperty(exports, "findReplace", { enumerable: true, get: function () { return find_replace_1.findReplace; } });
|
|
32
|
+
/**
|
|
33
|
+
* Capability-keyed playbook registry. Keys describe the INTENT, not the
|
|
34
|
+
* app. New playbooks SHOULD be added if they generalize across apps;
|
|
35
|
+
* playbooks that name an app are an antipattern and should be merged
|
|
36
|
+
* into a capability-keyed sibling.
|
|
37
|
+
*/
|
|
38
|
+
// NOTE: 'compose-send' is intentionally NOT in this registry. matchPlaybook
|
|
39
|
+
// still routes mail intents to the 'compose-send' KEY, but the pipeline
|
|
40
|
+
// special-cases that key to its OS-`mailto:` path (app-agnostic) and, on miss,
|
|
41
|
+
// defers to the perception agent — there is no in-app keyboard choreography to
|
|
42
|
+
// register here. Registry-dispatched playbooks must be genuinely app-agnostic.
|
|
43
|
+
exports.PLAYBOOKS = {
|
|
44
|
+
'find-replace': find_replace_1.findReplace,
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Match a task to a playbook name by CAPABILITY ONLY. activeApp is
|
|
48
|
+
* intentionally not consulted \u2014 if the same intent needs two different
|
|
49
|
+
* playbooks for two different apps, merge them. The first-class path
|
|
50
|
+
* for email is open_uri(mailto: ...); we offer compose-send as the
|
|
51
|
+
* in-UI fallback when the user explicitly wants to compose in-app.
|
|
52
|
+
*
|
|
53
|
+
* Returns null when nothing matches \u2014 caller proceeds with the
|
|
54
|
+
* text-agent's normal a11y-driven flow.
|
|
55
|
+
*/
|
|
56
|
+
function matchPlaybook(task, _activeApp) {
|
|
57
|
+
const t = task.toLowerCase();
|
|
58
|
+
// Compose + submit form (mail, message, or any compose-style flow).
|
|
59
|
+
// Matches any intent that asks to compose AND send/submit AND has a
|
|
60
|
+
// recipient-like noun. Pure regex \u2014 no app names.
|
|
61
|
+
if (/\bsend\b.*\b(email|message|mail|note|invite)\b|\bcompose\b.*\b(email|message|mail)\b|\bsend\s+to\s+\S+@/i.test(t)) {
|
|
62
|
+
return 'compose-send';
|
|
63
|
+
}
|
|
64
|
+
// Find & replace \u2014 universal across text editors, IDEs, browsers, docs.
|
|
65
|
+
if (/\bfind\s+and\s+replace\b|\breplace\s+all\b/i.test(t)) {
|
|
66
|
+
return 'find-replace';
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/playbooks/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;AA8CH,sCAgBC;AA3DD,iDAA6C;AA6DpC,4FA7DA,0BAAW,OA6DA;AA3CpB;;;;;GAKG;AACH,4EAA4E;AAC5E,wEAAwE;AACxE,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAClE,QAAA,SAAS,GAA6B;IACjD,cAAc,EAAE,0BAAW;CAC5B,CAAC;AAEF;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAAC,IAAY,EAAE,UAAkB;IAC5D,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAE7B,oEAAoE;IACpE,oEAAoE;IACpE,uDAAuD;IACvD,IAAI,0GAA0G,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACvH,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,6EAA6E;IAC7E,IAAI,6CAA6C,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Destructive-key blocklist.
|
|
3
|
+
*
|
|
4
|
+
* v0.8.0 shipped a 3-entry list (alt+f4, ctrl+alt+delete, ctrl+alt+del).
|
|
5
|
+
* The audit flagged this as cosmetic. v0.8.1 expands to the full known
|
|
6
|
+
* destructive set with whitespace-normalized matching so "alt +f4" also
|
|
7
|
+
* blocks.
|
|
8
|
+
*
|
|
9
|
+
* Used by the SafetyLayer. Adding a combo here blocks it across EVERY
|
|
10
|
+
* path (text-agent, vision-agent, MCP direct, REST /action, playbooks).
|
|
11
|
+
*/
|
|
12
|
+
/** Normalize a user-supplied combo for comparison — lowercase, trim, collapse whitespace, resolve `mod`. */
|
|
13
|
+
export declare function normalizeCombo(combo: string): string;
|
|
14
|
+
export type KeyBlockTier = 'block' | 'confirm' | null;
|
|
15
|
+
/** Classify a combo: 'block' (hard, no path), 'confirm' (allowConfirm-able), or null (free). */
|
|
16
|
+
export declare function keyBlockTier(combo: string): KeyBlockTier;
|
|
17
|
+
/** Truthful reason for the given tier. */
|
|
18
|
+
export declare function keyBlockReason(combo: string, tier: 'block' | 'confirm'): string;
|
|
19
|
+
/** The read-only normalized HARD-block set. */
|
|
20
|
+
export declare const BLOCKED_KEYS: ReadonlySet<string>;
|
|
21
|
+
/** True only for HARD-blocked combos (no confirm path). */
|
|
22
|
+
export declare function isBlockedKey(combo: string): boolean;
|
|
23
|
+
/** Reason string for a HARD block. */
|
|
24
|
+
export declare function blockReason(combo: string): string;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Destructive-key blocklist.
|
|
4
|
+
*
|
|
5
|
+
* v0.8.0 shipped a 3-entry list (alt+f4, ctrl+alt+delete, ctrl+alt+del).
|
|
6
|
+
* The audit flagged this as cosmetic. v0.8.1 expands to the full known
|
|
7
|
+
* destructive set with whitespace-normalized matching so "alt +f4" also
|
|
8
|
+
* blocks.
|
|
9
|
+
*
|
|
10
|
+
* Used by the SafetyLayer. Adding a combo here blocks it across EVERY
|
|
11
|
+
* path (text-agent, vision-agent, MCP direct, REST /action, playbooks).
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.BLOCKED_KEYS = void 0;
|
|
15
|
+
exports.normalizeCombo = normalizeCombo;
|
|
16
|
+
exports.keyBlockTier = keyBlockTier;
|
|
17
|
+
exports.keyBlockReason = keyBlockReason;
|
|
18
|
+
exports.isBlockedKey = isBlockedKey;
|
|
19
|
+
exports.blockReason = blockReason;
|
|
20
|
+
/**
|
|
21
|
+
* Platform-aware substitution for the `mod` modifier — resolves to `cmd` on
|
|
22
|
+
* macOS and `ctrl` on Windows/Linux. Mirrors the `mod` alias in `src/keys.ts`
|
|
23
|
+
* so `mod+q` on macOS is treated the same as `cmd+q` for blocklist matching.
|
|
24
|
+
*/
|
|
25
|
+
const PLATFORM_MOD_LOWER = process.platform === 'darwin' ? 'cmd' : 'ctrl';
|
|
26
|
+
/** Normalize a user-supplied combo for comparison — lowercase, trim, collapse whitespace, resolve `mod`. */
|
|
27
|
+
function normalizeCombo(combo) {
|
|
28
|
+
const flat = combo.toLowerCase().replace(/\s+/g, '').replace(/[+_-]+/g, '+');
|
|
29
|
+
// Resolve the platform-aware `mod` token in any position so `mod+q` matches
|
|
30
|
+
// `cmd+q` on macOS and `ctrl+q` (etc.) on Win/Linux.
|
|
31
|
+
if (!flat.includes('mod'))
|
|
32
|
+
return flat;
|
|
33
|
+
return flat.split('+').map(p => p === 'mod' ? PLATFORM_MOD_LOWER : p).join('+');
|
|
34
|
+
}
|
|
35
|
+
// Two tiers (v1.6.0): the old single list HARD-blocked everything with NO
|
|
36
|
+
// confirm path — even though `blockReason` promised "consent via Confirm-tier".
|
|
37
|
+
// That dead-ended legitimate agent actions: win+d (show desktop), ctrl+w
|
|
38
|
+
// (close a tab), win+r. Split by reversibility/intent:
|
|
39
|
+
// HARD — locks the machine, force-quits, or fires a secure-attention /
|
|
40
|
+
// shutdown sequence. Never an agent action; no confirm path.
|
|
41
|
+
// CONFIRM — consequential but legitimate (close window/tab, show desktop,
|
|
42
|
+
// open a launcher). Routes through the normal confirm/allowConfirm
|
|
43
|
+
// gate so an authorized caller can proceed.
|
|
44
|
+
/** Hard-blocked: no confirm path. */
|
|
45
|
+
const HARD_BLOCK = [
|
|
46
|
+
'ctrl+alt+delete', 'ctrl+alt+del', // secure attention sequence
|
|
47
|
+
'win+l', 'cmd+ctrl+q', // lock the machine
|
|
48
|
+
'cmd+shift+q', // macOS log out
|
|
49
|
+
'cmd+opt+esc', // macOS force-quit picker
|
|
50
|
+
'ctrl+shift+esc', // task manager / force-quit escalation
|
|
51
|
+
'fn+alt+f4', // shutdown combo some laptops map to
|
|
52
|
+
];
|
|
53
|
+
/** Confirm-tier: consequential but a legitimate agent action with approval. */
|
|
54
|
+
const CONFIRM_BLOCK = [
|
|
55
|
+
'alt+f4', 'cmd+q', // close all windows / quit app (may lose unsaved work)
|
|
56
|
+
'ctrl+w', 'cmd+w', // close tab/window
|
|
57
|
+
'win+r', 'cmd+space', // Run dialog / Spotlight launcher
|
|
58
|
+
'win+d', 'cmd+f3', // show desktop / minimize everything
|
|
59
|
+
'f11', // full-screen — often interferes with UIA
|
|
60
|
+
];
|
|
61
|
+
const HARD_BLOCK_SET = new Set(HARD_BLOCK.map(normalizeCombo));
|
|
62
|
+
const CONFIRM_BLOCK_SET = new Set(CONFIRM_BLOCK.map(normalizeCombo));
|
|
63
|
+
/** Classify a combo: 'block' (hard, no path), 'confirm' (allowConfirm-able), or null (free). */
|
|
64
|
+
function keyBlockTier(combo) {
|
|
65
|
+
const n = normalizeCombo(combo);
|
|
66
|
+
if (HARD_BLOCK_SET.has(n))
|
|
67
|
+
return 'block';
|
|
68
|
+
if (CONFIRM_BLOCK_SET.has(n))
|
|
69
|
+
return 'confirm';
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
/** Truthful reason for the given tier. */
|
|
73
|
+
function keyBlockReason(combo, tier) {
|
|
74
|
+
return tier === 'block'
|
|
75
|
+
? `Key combo "${combo}" is hard-blocked — it locks the machine, force-quits, or fires a system/shutdown sequence an agent must never send.`
|
|
76
|
+
: `Key combo "${combo}" needs confirmation — it closes windows/tabs, shows the desktop, or opens a run/search launcher. If the user authorized it, re-issue inside batch({allowConfirm:true}).`;
|
|
77
|
+
}
|
|
78
|
+
// ── Back-compat: the old names now mean HARD blocks only ──
|
|
79
|
+
/** The read-only normalized HARD-block set. */
|
|
80
|
+
exports.BLOCKED_KEYS = HARD_BLOCK_SET;
|
|
81
|
+
/** True only for HARD-blocked combos (no confirm path). */
|
|
82
|
+
function isBlockedKey(combo) {
|
|
83
|
+
return HARD_BLOCK_SET.has(normalizeCombo(combo));
|
|
84
|
+
}
|
|
85
|
+
/** Reason string for a HARD block. */
|
|
86
|
+
function blockReason(combo) {
|
|
87
|
+
return keyBlockReason(combo, 'block');
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=keys-blocklist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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registry — central registry of all clawdcursor tools.
|
|
3
|
+
*
|
|
4
|
+
* Import this to get all 40 tools in a transport-agnostic format.
|
|
5
|
+
* Adapters (HTTP, MCP) consume this registry.
|
|
6
|
+
*/
|
|
7
|
+
import { getCompactTools } from './compact';
|
|
8
|
+
import type { ToolDefinition, ToolContext, ToolResult, CompactGroup } from './types';
|
|
9
|
+
import { toOpenAiFunctions, toJsonSchema } from './types';
|
|
10
|
+
export type { ToolDefinition, ToolContext, ToolResult };
|
|
11
|
+
export { toOpenAiFunctions, toJsonSchema };
|
|
12
|
+
export { getCompactTools };
|
|
13
|
+
/** Options for the unified getTools() accessor. */
|
|
14
|
+
export interface GetToolsOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Which surface to return.
|
|
17
|
+
* 'granular' — the full set of granular primitives (default)
|
|
18
|
+
* 'compact' — the 6 compound tools (same as getCompactSurface())
|
|
19
|
+
*/
|
|
20
|
+
palette?: 'granular' | 'compact';
|
|
21
|
+
/**
|
|
22
|
+
* Filter granular tools by their compactGroup.
|
|
23
|
+
* Only meaningful when palette === 'granular' (or omitted).
|
|
24
|
+
*/
|
|
25
|
+
compactGroup?: CompactGroup;
|
|
26
|
+
}
|
|
27
|
+
export declare function getTools(options?: GetToolsOptions): ToolDefinition[];
|
|
28
|
+
/** Get all registered GRANULAR tools (the full primitive surface). Back-compat wrapper around getTools(). */
|
|
29
|
+
export declare function getAllTools(): ToolDefinition[];
|
|
30
|
+
/**
|
|
31
|
+
* Get the COMPACT surface — 6 compound tools covering every granular
|
|
32
|
+
* primitive. Equivalent semantics; ~1/12th the catalog tokens. Use via
|
|
33
|
+
* `clawdcursor mcp --compact` or `GET /tools?mode=compact`.
|
|
34
|
+
* Back-compat wrapper around getTools({ palette: 'compact' }).
|
|
35
|
+
*/
|
|
36
|
+
export declare function getCompactSurface(): ToolDefinition[];
|
|
37
|
+
/** Get tools by category */
|
|
38
|
+
export declare function getToolsByCategory(category: string): ToolDefinition[];
|
|
39
|
+
/** Get a tool by name */
|
|
40
|
+
export declare function getTool(name: string): ToolDefinition | undefined;
|