@kortix/agent-tunnel 0.1.3 → 0.12.7

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.
Files changed (67) hide show
  1. package/README.md +65 -0
  2. package/dist/agent-cli.js +4676 -3174
  3. package/dist/client-cli.js +203 -494
  4. package/package.json +24 -29
  5. package/src/agent/agent.ts +67 -17
  6. package/src/agent/capabilities/desktop/cua-driver.ts +284 -0
  7. package/src/agent/capabilities/desktop.ts +100 -167
  8. package/src/agent/capabilities/enabled-registry.ts +24 -0
  9. package/src/agent/capabilities/filesystem.ts +136 -32
  10. package/src/agent/capabilities/index.ts +1 -1
  11. package/src/agent/capabilities/security.test.ts +204 -0
  12. package/src/agent/capabilities/shell.ts +37 -3
  13. package/src/agent/cli-device-auth.test.ts +179 -0
  14. package/src/agent/cli-help.test.ts +25 -0
  15. package/src/agent/cli.ts +475 -38
  16. package/src/agent/config.test.ts +53 -0
  17. package/src/agent/config.ts +169 -7
  18. package/src/agent/index.ts +1 -0
  19. package/src/agent/security/command-validator.ts +4 -2
  20. package/src/agent/security/path-validator.ts +73 -18
  21. package/src/agent/security/permission-guard.test.ts +52 -0
  22. package/src/agent/security/permission-guard.ts +35 -8
  23. package/src/agent/service.test.ts +63 -0
  24. package/src/agent/service.ts +410 -0
  25. package/src/client/cli.test.ts +150 -547
  26. package/src/client/cli.ts +116 -537
  27. package/src/client/index.ts +1 -1
  28. package/src/client/tools.ts +95 -356
  29. package/src/client/tunnel-client.ts +50 -80
  30. package/src/index.ts +7 -1
  31. package/src/node-ws-polyfill.test.ts +18 -0
  32. package/src/node-ws-polyfill.ts +5 -3
  33. package/src/server/heartbeat.ts +13 -6
  34. package/src/server/relay.test.ts +72 -0
  35. package/src/server/relay.ts +50 -9
  36. package/src/server/server.test.ts +33 -0
  37. package/src/server/server.ts +26 -6
  38. package/src/server/ws-handler.test.ts +158 -0
  39. package/src/server/ws-handler.ts +94 -36
  40. package/src/shared/crypto.ts +2 -3
  41. package/src/shared/index.ts +8 -0
  42. package/src/shared/permissions.ts +292 -0
  43. package/src/shared/types.ts +70 -41
  44. package/dist/agent/index.d.ts +0 -140
  45. package/dist/agent/index.js +0 -21
  46. package/dist/agent/index.js.map +0 -1
  47. package/dist/chunk-7N7GSU6K.js +0 -34
  48. package/dist/client/index.d.ts +0 -183
  49. package/dist/client/index.js +0 -8
  50. package/dist/client/index.js.map +0 -1
  51. package/dist/index.d.ts +0 -7
  52. package/dist/index.js +0 -55
  53. package/dist/index.js.map +0 -1
  54. package/dist/server/index.d.ts +0 -89
  55. package/dist/server/index.js +0 -14
  56. package/dist/server/index.js.map +0 -1
  57. package/dist/shared/index.d.ts +0 -10
  58. package/dist/shared/index.js +0 -20
  59. package/dist/shared/index.js.map +0 -1
  60. package/dist/types-Dpwrd8Ai.d.ts +0 -194
  61. package/src/agent/capabilities/desktop/atspi-helper.ts +0 -345
  62. package/src/agent/capabilities/desktop/csharp-helper.ts +0 -914
  63. package/src/agent/capabilities/desktop/linux-driver.ts +0 -368
  64. package/src/agent/capabilities/desktop/macos-driver.ts +0 -601
  65. package/src/agent/capabilities/desktop/swift-helper.ts +0 -736
  66. package/src/agent/capabilities/desktop/types.ts +0 -201
  67. package/src/agent/capabilities/desktop/windows-driver.ts +0 -220
@@ -46,14 +46,7 @@ export const TunnelErrorCode = {
46
46
 
47
47
  export type TunnelErrorCodeValue = (typeof TunnelErrorCode)[keyof typeof TunnelErrorCode];
48
48
 
49
- export type TunnelCapability =
50
- | 'filesystem'
51
- | 'shell'
52
- | 'network'
53
- | 'apps'
54
- | 'hardware'
55
- | 'desktop'
56
- | 'gpu';
49
+ export type TunnelCapability = 'filesystem' | 'shell' | 'desktop';
57
50
 
58
51
  export const TunnelMethods = {
59
52
  'fs.read': 'filesystem',
@@ -62,34 +55,49 @@ export const TunnelMethods = {
62
55
  'fs.stat': 'filesystem',
63
56
  'fs.delete': 'filesystem',
64
57
  'shell.exec': 'shell',
65
- 'desktop.screenshot': 'desktop',
66
- 'desktop.mouse.click': 'desktop',
67
- 'desktop.mouse.move': 'desktop',
68
- 'desktop.mouse.drag': 'desktop',
69
- 'desktop.mouse.scroll': 'desktop',
70
- 'desktop.mouse.position': 'desktop',
71
- 'desktop.keyboard.type': 'desktop',
72
- 'desktop.keyboard.key': 'desktop',
73
- 'desktop.window.list': 'desktop',
74
- 'desktop.window.focus': 'desktop',
75
- 'desktop.window.resize': 'desktop',
76
- 'desktop.window.close': 'desktop',
77
- 'desktop.window.minimize': 'desktop',
78
- 'desktop.app.launch': 'desktop',
79
- 'desktop.app.quit': 'desktop',
80
- 'desktop.app.list': 'desktop',
81
- 'desktop.clipboard.read': 'desktop',
82
- 'desktop.clipboard.write': 'desktop',
83
- 'desktop.screen.info': 'desktop',
84
- 'desktop.cursor.image': 'desktop',
85
- 'desktop.ax.tree': 'desktop',
86
- 'desktop.ax.action': 'desktop',
87
- 'desktop.ax.set_value': 'desktop',
88
- 'desktop.ax.focus': 'desktop',
89
- 'desktop.ax.search': 'desktop',
90
- 'net.request': 'network',
91
- 'net.port_forward.start': 'network',
92
- 'net.port_forward.stop': 'network',
58
+ 'desktop.cua.ensure': 'desktop',
59
+ 'desktop.cua.start_daemon': 'desktop',
60
+ 'desktop.cua.status': 'desktop',
61
+ 'desktop.cua.version': 'desktop',
62
+ 'desktop.cua.list_tools': 'desktop',
63
+ 'desktop.cua.describe': 'desktop',
64
+ 'desktop.cua.call': 'desktop',
65
+ 'desktop.cua.bring_to_front': 'desktop',
66
+ 'desktop.cua.check_for_update': 'desktop',
67
+ 'desktop.cua.check_permissions': 'desktop',
68
+ 'desktop.cua.click': 'desktop',
69
+ 'desktop.cua.double_click': 'desktop',
70
+ 'desktop.cua.drag': 'desktop',
71
+ 'desktop.cua.end_session': 'desktop',
72
+ 'desktop.cua.get_accessibility_tree': 'desktop',
73
+ 'desktop.cua.get_agent_cursor_state': 'desktop',
74
+ 'desktop.cua.get_config': 'desktop',
75
+ 'desktop.cua.get_cursor_position': 'desktop',
76
+ 'desktop.cua.get_recording_state': 'desktop',
77
+ 'desktop.cua.get_screen_size': 'desktop',
78
+ 'desktop.cua.get_window_state': 'desktop',
79
+ 'desktop.cua.hotkey': 'desktop',
80
+ 'desktop.cua.kill_app': 'desktop',
81
+ 'desktop.cua.launch_app': 'desktop',
82
+ 'desktop.cua.list_apps': 'desktop',
83
+ 'desktop.cua.list_windows': 'desktop',
84
+ 'desktop.cua.move_cursor': 'desktop',
85
+ 'desktop.cua.page': 'desktop',
86
+ 'desktop.cua.press_key': 'desktop',
87
+ 'desktop.cua.replay_trajectory': 'desktop',
88
+ 'desktop.cua.right_click': 'desktop',
89
+ 'desktop.cua.scroll': 'desktop',
90
+ 'desktop.cua.set_agent_cursor_enabled': 'desktop',
91
+ 'desktop.cua.set_agent_cursor_motion': 'desktop',
92
+ 'desktop.cua.set_agent_cursor_style': 'desktop',
93
+ 'desktop.cua.set_config': 'desktop',
94
+ 'desktop.cua.set_value': 'desktop',
95
+ 'desktop.cua.start_recording': 'desktop',
96
+ 'desktop.cua.install_ffmpeg': 'desktop',
97
+ 'desktop.cua.start_session': 'desktop',
98
+ 'desktop.cua.stop_recording': 'desktop',
99
+ 'desktop.cua.type_text': 'desktop',
100
+ 'desktop.cua.zoom': 'desktop',
93
101
  'tunnel.ping': null,
94
102
  'tunnel.pong': null,
95
103
  'tunnel.permission.revoked': null,
@@ -138,11 +146,21 @@ export interface AgentInfo {
138
146
 
139
147
  export interface TunnelRelayEvents {
140
148
  'agent:connect': { tunnelId: string; metadata?: Record<string, unknown> };
141
- 'agent:disconnect': { tunnelId: string };
149
+ 'agent:disconnect': { tunnelId: string; metadata?: Record<string, unknown> };
142
150
  'agent:timeout': { tunnelId: string };
143
151
  'rpc:request': { tunnelId: string; method: string; requestId: string };
144
- 'rpc:response': { tunnelId: string; method: string; requestId: string; durationMs: number };
145
- 'rpc:error': { tunnelId: string; method: string; requestId: string; error: Error };
152
+ 'rpc:response': {
153
+ tunnelId: string;
154
+ method: string;
155
+ requestId: string;
156
+ durationMs: number;
157
+ };
158
+ 'rpc:error': {
159
+ tunnelId: string;
160
+ method: string;
161
+ requestId: string;
162
+ error: Error;
163
+ };
146
164
  'connection:replaced': { tunnelId: string };
147
165
  'message:pong': { tunnelId: string; params?: Record<string, unknown> };
148
166
  'message:raw': { tunnelId: string; message: unknown };
@@ -162,6 +180,9 @@ export interface HeartbeatConfig {
162
180
  export interface TunnelAuthMessage {
163
181
  type: 'auth';
164
182
  token: string;
183
+ /** RPC capability handlers registered in this exact agent process. */
184
+ capabilities?: TunnelCapability[];
185
+ agentVersion?: string;
165
186
  }
166
187
 
167
188
  /** Result returned by onAuthenticate hook on success. */
@@ -179,12 +200,20 @@ export interface TunnelServerConfig {
179
200
  * Return { signingKey, metadata } to accept, or null to reject.
180
201
  * If not provided, all connections are rejected.
181
202
  */
182
- onAuthenticate?: (tunnelId: string, token: string) => Promise<AuthResult | null>;
203
+ onAuthenticate?: (
204
+ tunnelId: string,
205
+ token: string,
206
+ auth: TunnelAuthMessage,
207
+ ) => Promise<AuthResult | null>;
183
208
  /**
184
209
  * Called before relaying an RPC to the agent.
185
210
  * Return false to deny. If not provided, all RPCs are allowed.
186
211
  */
187
- onAuthorizeRPC?: (tunnelId: string, method: string, params: Record<string, unknown>) => Promise<boolean>;
212
+ onAuthorizeRPC?: (
213
+ tunnelId: string,
214
+ method: string,
215
+ params: Record<string, unknown>,
216
+ ) => Promise<boolean>;
188
217
  /**
189
218
  * Called before handling HTTP requests to relay routes (/connections, /rpc).
190
219
  * Return false to deny. If not provided, routes are open.
@@ -1,140 +0,0 @@
1
- interface TunnelConfig {
2
- token: string;
3
- tunnelId: string;
4
- apiUrl: string;
5
- wsPath: string;
6
- maxFileSize: number;
7
- allowedPaths: string[];
8
- allowedCommands: string[];
9
- blockedCommands: string[];
10
- blockedPaths: string[];
11
- workingDir: string;
12
- shellTimeout: number;
13
- shellMaxTimeout: number;
14
- shellMaxOutputSize: number;
15
- shellEnvPassthrough: string[];
16
- }
17
- declare function loadConfig(overrides?: Partial<TunnelConfig>): TunnelConfig;
18
-
19
- /**
20
- * Capability Registry — extensible registry for tunnel capabilities.
21
- *
22
- * Each capability (filesystem, shell, network, etc.) registers its
23
- * RPC method handlers here. The TunnelAgent dispatches incoming
24
- * JSON-RPC requests to the matching handler.
25
- */
26
- type RpcHandler = (params: Record<string, unknown>) => Promise<unknown>;
27
- interface Capability {
28
- name: string;
29
- methods: Map<string, RpcHandler>;
30
- }
31
- declare class CapabilityRegistry {
32
- private capabilities;
33
- register(capability: Capability): void;
34
- unregister(name: string): void;
35
- getHandler(method: string): RpcHandler | null;
36
- getCapabilityNames(): string[];
37
- has(name: string): boolean;
38
- }
39
-
40
- declare class TunnelAgent {
41
- private ws;
42
- private registry;
43
- private permissionGuard;
44
- private config;
45
- private reconnectAttempts;
46
- private maxReconnectDelay;
47
- private baseReconnectDelay;
48
- private reconnectTimer;
49
- private isShuttingDown;
50
- private uptime;
51
- private uptimeInterval;
52
- private signingKey;
53
- private lastNonce;
54
- private responseNonce;
55
- constructor(config: TunnelConfig, registry: CapabilityRegistry);
56
- connect(): void;
57
- disconnect(): void;
58
- isConnected(): boolean;
59
- private setupWsHandlers;
60
- private handleMessage;
61
- /**
62
- * Verify HMAC signature on incoming messages (excluding pings).
63
- */
64
- private verifyIncomingSignature;
65
- private handleRpcRequest;
66
- /** Send HMAC-signed RPC result. */
67
- private sendSignedResult;
68
- /** Send HMAC-signed RPC error. */
69
- private sendSignedError;
70
- private sendSigned;
71
- private send;
72
- private sendPong;
73
- private scheduleReconnect;
74
- private buildWsUrl;
75
- }
76
-
77
- /**
78
- * Filesystem Capability — handles fs.read, fs.write, fs.list, fs.stat, fs.delete.
79
- *
80
- * All operations go through local-side path validation (defense in depth)
81
- * even though the server already validates permissions.
82
- */
83
-
84
- declare function createFilesystemCapability(config: TunnelConfig): Capability;
85
-
86
- /**
87
- * Shell Capability — handles shell.exec for running commands on the local machine.
88
- *
89
- * Security:
90
- * - Commands are executed as array args (no shell interpolation)
91
- * - First arg (executable) is validated against allowedCommands / blockedCommands
92
- * - Working directory is validated against allowedPaths / blockedPaths
93
- * - Timeout enforcement
94
- */
95
-
96
- declare function createShellCapability(config: TunnelConfig): Capability;
97
-
98
- declare function createDesktopCapability(): Capability;
99
-
100
- /**
101
- * Permission Guard — local-side permission enforcement (defense in depth).
102
- *
103
- * Even though the server validates permissions before relaying RPCs,
104
- * the local agent also checks permissions as a second layer of defense.
105
- * This prevents a compromised server from bypassing permission controls.
106
- *
107
- * After the initial permission sync, unknown permissionIds are denied.
108
- * Before sync, unknown IDs are also denied (fail-closed).
109
- */
110
- interface LocalPermission {
111
- permissionId: string;
112
- capability: string;
113
- scope: Record<string, unknown>;
114
- expiresAt?: string;
115
- }
116
- declare class PermissionGuard {
117
- private permissions;
118
- private hasSynced;
119
- /** Bulk-load permissions from server sync notification. */
120
- syncPermissions(permissions: LocalPermission[]): void;
121
- addPermission(permission: LocalPermission): void;
122
- revokePermission(permissionId: string): void;
123
- checkPermission(permissionId: string | undefined): boolean;
124
- clear(): void;
125
- }
126
-
127
- declare function validateCommand(command: string, allowedCommands: string[], blockedCommands: string[]): void;
128
-
129
- /**
130
- * Path Validator — defense-in-depth path traversal prevention.
131
- *
132
- * Validates that requested paths:
133
- * 1. Are absolute
134
- * 2. Resolve to an absolute path (follows symlinks)
135
- * 3. Fall within allowed directories
136
- * 4. Don't hit blocked paths (configurable)
137
- */
138
- declare function validatePath(path: string, allowedPaths: string[], blockedPaths?: string[]): void;
139
-
140
- export { type Capability, CapabilityRegistry, type LocalPermission, PermissionGuard, type RpcHandler, TunnelAgent, type TunnelConfig, createDesktopCapability, createFilesystemCapability, createShellCapability, loadConfig, validateCommand, validatePath };
@@ -1,21 +0,0 @@
1
- import { TunnelAgent } from "./agent";
2
- import { loadConfig } from "./config";
3
- import { CapabilityRegistry } from "./capabilities/index";
4
- import { createFilesystemCapability } from "./capabilities/filesystem";
5
- import { createShellCapability } from "./capabilities/shell";
6
- import { createDesktopCapability } from "./capabilities/desktop";
7
- import { PermissionGuard } from "./security/permission-guard";
8
- import { validateCommand } from "./security/command-validator";
9
- import { validatePath } from "./security/path-validator";
10
- export {
11
- CapabilityRegistry,
12
- PermissionGuard,
13
- TunnelAgent,
14
- createDesktopCapability,
15
- createFilesystemCapability,
16
- createShellCapability,
17
- loadConfig,
18
- validateCommand,
19
- validatePath
20
- };
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/agent/index.ts"],"sourcesContent":["export { TunnelAgent } from './agent';\nexport { loadConfig, type TunnelConfig } from './config';\nexport { CapabilityRegistry } from './capabilities/index';\nexport type { Capability, RpcHandler } from './capabilities/index';\nexport { createFilesystemCapability } from './capabilities/filesystem';\nexport { createShellCapability } from './capabilities/shell';\nexport { createDesktopCapability } from './capabilities/desktop';\nexport { PermissionGuard } from './security/permission-guard';\nexport type { LocalPermission } from './security/permission-guard';\nexport { validateCommand } from './security/command-validator';\nexport { validatePath } from './security/path-validator';\n"],"mappings":"AAAA,SAAS,mBAAmB;AAC5B,SAAS,kBAAqC;AAC9C,SAAS,0BAA0B;AAEnC,SAAS,kCAAkC;AAC3C,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAEhC,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;","names":[]}
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
7
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
8
- }) : x)(function(x) {
9
- if (typeof require !== "undefined") return require.apply(this, arguments);
10
- throw Error('Dynamic require of "' + x + '" is not supported');
11
- });
12
- var __esm = (fn, res) => function __init() {
13
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
14
- };
15
- var __export = (target, all) => {
16
- for (var name in all)
17
- __defProp(target, name, { get: all[name], enumerable: true });
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- export {
30
- __require,
31
- __esm,
32
- __export,
33
- __toCommonJS
34
- };
@@ -1,183 +0,0 @@
1
- interface TunnelClientConfig {
2
- apiUrl: string;
3
- token: string;
4
- tunnelId?: string;
5
- cacheTtlMs?: number;
6
- }
7
- declare class TunnelClientError extends Error {
8
- readonly code: number;
9
- readonly requestId?: string | undefined;
10
- readonly isPermissionRequest: boolean;
11
- constructor(code: number, message: string, requestId?: string | undefined, isPermissionRequest?: boolean);
12
- }
13
- declare class TunnelClient {
14
- private apiUrl;
15
- private token;
16
- private explicitTunnelId;
17
- private cachedTunnelId;
18
- private cacheTimestamp;
19
- private cacheTtlMs;
20
- readonly fs: FsNamespace;
21
- readonly shell: ShellNamespace;
22
- readonly desktop: DesktopNamespace;
23
- constructor(config: TunnelClientConfig);
24
- rpc(method: string, params?: Record<string, unknown>): Promise<unknown>;
25
- rpcWithPermissionFlow(method: string, params?: Record<string, unknown>): Promise<unknown>;
26
- getConnections(): Promise<Array<Record<string, unknown>>>;
27
- resolveTunnelId(): Promise<string>;
28
- }
29
- declare class FsNamespace {
30
- private client;
31
- constructor(client: TunnelClient);
32
- read(path: string, encoding?: string): Promise<{
33
- content: string;
34
- size: number;
35
- path: string;
36
- }>;
37
- write(path: string, content: string, encoding?: string): Promise<{
38
- path: string;
39
- size: number;
40
- }>;
41
- list(path: string, recursive?: boolean): Promise<{
42
- entries: Array<{
43
- name: string;
44
- path: string;
45
- isDirectory: boolean;
46
- isFile: boolean;
47
- }>;
48
- count: number;
49
- }>;
50
- stat(path: string): Promise<Record<string, unknown>>;
51
- delete(path: string): Promise<Record<string, unknown>>;
52
- }
53
- declare class ShellNamespace {
54
- private client;
55
- constructor(client: TunnelClient);
56
- exec(command: string, args?: string[], options?: {
57
- cwd?: string;
58
- timeout?: number;
59
- }): Promise<{
60
- exitCode: number | null;
61
- signal: string | null;
62
- stdout: string;
63
- stderr: string;
64
- stdoutTruncated: boolean;
65
- stderrTruncated: boolean;
66
- }>;
67
- }
68
- declare class DesktopNamespace {
69
- private client;
70
- constructor(client: TunnelClient);
71
- screenshot(params?: {
72
- region?: {
73
- x: number;
74
- y: number;
75
- width: number;
76
- height: number;
77
- };
78
- windowId?: number;
79
- }): Promise<{
80
- image: string;
81
- width: number;
82
- height: number;
83
- format?: string;
84
- }>;
85
- click(params: {
86
- x: number;
87
- y: number;
88
- button?: string;
89
- clicks?: number;
90
- modifiers?: string[];
91
- }): Promise<unknown>;
92
- type(text: string, delay?: number): Promise<unknown>;
93
- key(keys: string[]): Promise<unknown>;
94
- mouseMove(x: number, y: number): Promise<unknown>;
95
- mouseDrag(fromX: number, fromY: number, toX: number, toY: number, button?: string): Promise<unknown>;
96
- mouseScroll(x: number, y: number, deltaX?: number, deltaY?: number): Promise<unknown>;
97
- windowList(): Promise<{
98
- windows: Array<{
99
- id: number;
100
- app: string;
101
- title: string;
102
- bounds: {
103
- x: number;
104
- y: number;
105
- width: number;
106
- height: number;
107
- };
108
- minimized: boolean;
109
- }>;
110
- }>;
111
- windowFocus(windowId: number): Promise<unknown>;
112
- appLaunch(app: string): Promise<unknown>;
113
- appQuit(app: string): Promise<unknown>;
114
- clipboardRead(): Promise<{
115
- text: string;
116
- }>;
117
- clipboardWrite(text: string): Promise<unknown>;
118
- screenInfo(): Promise<{
119
- width: number;
120
- height: number;
121
- scaleFactor: number;
122
- }>;
123
- cursorImage(radius?: number): Promise<{
124
- image: string;
125
- width: number;
126
- height: number;
127
- format?: string;
128
- }>;
129
- axTree(params?: {
130
- pid?: number;
131
- maxDepth?: number;
132
- roles?: string[];
133
- }): Promise<{
134
- root: AXElement;
135
- elementCount: number;
136
- }>;
137
- axAction(elementId: string, action: string, pid?: number): Promise<Record<string, unknown>>;
138
- axSetValue(elementId: string, value: string, pid?: number): Promise<Record<string, unknown>>;
139
- axFocus(elementId: string, pid?: number): Promise<Record<string, unknown>>;
140
- axSearch(query: string, params?: {
141
- role?: string;
142
- pid?: number;
143
- maxResults?: number;
144
- }): Promise<{
145
- elements: AXElement[];
146
- }>;
147
- }
148
- interface AXElement {
149
- id: string;
150
- role: string;
151
- title: string;
152
- value: string;
153
- description: string;
154
- bounds: {
155
- x: number;
156
- y: number;
157
- width: number;
158
- height: number;
159
- };
160
- children: AXElement[];
161
- actions: string[];
162
- enabled: boolean;
163
- focused: boolean;
164
- }
165
-
166
- interface TunnelToolParameter {
167
- type: string;
168
- description: string;
169
- required?: boolean;
170
- items?: {
171
- type: string;
172
- };
173
- enum?: string[];
174
- }
175
- interface TunnelToolDefinition {
176
- name: string;
177
- description: string;
178
- parameters: Record<string, TunnelToolParameter>;
179
- execute: (args: Record<string, unknown>) => Promise<string>;
180
- }
181
- declare function createTunnelTools(client: TunnelClient): TunnelToolDefinition[];
182
-
183
- export { type AXElement, TunnelClient, type TunnelClientConfig, TunnelClientError, type TunnelToolDefinition, type TunnelToolParameter, createTunnelTools };
@@ -1,8 +0,0 @@
1
- import { TunnelClient, TunnelClientError } from "./tunnel-client";
2
- import { createTunnelTools } from "./tools";
3
- export {
4
- TunnelClient,
5
- TunnelClientError,
6
- createTunnelTools
7
- };
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/client/index.ts"],"sourcesContent":["export { TunnelClient, TunnelClientError } from './tunnel-client';\nexport type { TunnelClientConfig, AXElement } from './tunnel-client';\nexport { createTunnelTools } from './tools';\nexport type { TunnelToolDefinition, TunnelToolParameter } from './tools';\n// CLI entrypoint: src/client/cli.ts (run via `bun run cli.ts <command> [json]`)\n"],"mappings":"AAAA,SAAS,cAAc,yBAAyB;AAEhD,SAAS,yBAAyB;","names":[]}
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export { deriveSigningKey, generateToken, hashToken, signMessage, timingSafeStringEqual, verifyMessageSignature } from './shared/index.js';
2
- export { A as AgentInfo, a as AuthResult, H as HeartbeatConfig, J as JsonRpcError, b as JsonRpcErrorResponse, c as JsonRpcMessage, d as JsonRpcNotification, e as JsonRpcRequest, f as JsonRpcResponse, g as JsonRpcSuccessResponse, P as PendingRPC, R as RelayRpcOptions, S as SignedJsonRpcNotification, h as SignedJsonRpcRequest, T as TunnelAuthMessage, i as TunnelCapability, j as TunnelErrorCode, k as TunnelErrorCodeValue, l as TunnelMethod, m as TunnelMethods, n as TunnelRelayConfig, o as TunnelRelayEvents, p as TunnelRpcParams, q as TunnelServerConfig } from './types-Dpwrd8Ai.js';
3
- export { HeartbeatManager, TunnelRelay, TunnelRelayError, TunnelServer, WsHandlerOptions, WsHandlers, createTunnelRouter, createWsHandlers, startTunnelServer } from './server/index.js';
4
- export { AXElement, TunnelClient, TunnelClientConfig, TunnelClientError, TunnelToolDefinition, TunnelToolParameter, createTunnelTools } from './client/index.js';
5
- export { Capability, CapabilityRegistry, LocalPermission, PermissionGuard, RpcHandler, TunnelAgent, TunnelConfig, createDesktopCapability, createFilesystemCapability, createShellCapability, loadConfig, validateCommand, validatePath } from './agent/index.js';
6
- import 'events';
7
- import 'hono';
package/dist/index.js DELETED
@@ -1,55 +0,0 @@
1
- import {
2
- deriveSigningKey,
3
- signMessage,
4
- verifyMessageSignature,
5
- generateToken,
6
- hashToken,
7
- timingSafeStringEqual,
8
- TunnelErrorCode,
9
- TunnelMethods
10
- } from "./shared";
11
- import { TunnelRelay, TunnelRelayError } from "./server";
12
- import { HeartbeatManager } from "./server";
13
- import { createWsHandlers } from "./server";
14
- import { createTunnelRouter } from "./server";
15
- import { startTunnelServer } from "./server";
16
- import { TunnelClient, TunnelClientError } from "./client";
17
- import { createTunnelTools } from "./client";
18
- import { TunnelAgent } from "./agent";
19
- import { loadConfig } from "./agent";
20
- import { CapabilityRegistry } from "./agent";
21
- import { createFilesystemCapability } from "./agent";
22
- import { createShellCapability } from "./agent";
23
- import { createDesktopCapability } from "./agent";
24
- import { PermissionGuard } from "./agent";
25
- import { validateCommand } from "./agent";
26
- import { validatePath } from "./agent";
27
- export {
28
- CapabilityRegistry,
29
- HeartbeatManager,
30
- PermissionGuard,
31
- TunnelAgent,
32
- TunnelClient,
33
- TunnelClientError,
34
- TunnelErrorCode,
35
- TunnelMethods,
36
- TunnelRelay,
37
- TunnelRelayError,
38
- createDesktopCapability,
39
- createFilesystemCapability,
40
- createShellCapability,
41
- createTunnelRouter,
42
- createTunnelTools,
43
- createWsHandlers,
44
- deriveSigningKey,
45
- generateToken,
46
- hashToken,
47
- loadConfig,
48
- signMessage,
49
- startTunnelServer,
50
- timingSafeStringEqual,
51
- validateCommand,
52
- validatePath,
53
- verifyMessageSignature
54
- };
55
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ─── Shared: Types + Crypto ─────────────────────────────────────────────────\nexport {\n deriveSigningKey,\n signMessage,\n verifyMessageSignature,\n generateToken,\n hashToken,\n timingSafeStringEqual,\n TunnelErrorCode,\n TunnelMethods,\n} from './shared';\n\nexport type {\n JsonRpcRequest,\n JsonRpcSuccessResponse,\n JsonRpcErrorResponse,\n JsonRpcError,\n JsonRpcResponse,\n JsonRpcNotification,\n JsonRpcMessage,\n SignedJsonRpcRequest,\n SignedJsonRpcNotification,\n PendingRPC,\n TunnelRpcParams,\n RelayRpcOptions,\n AgentInfo,\n TunnelRelayEvents,\n TunnelRelayConfig,\n HeartbeatConfig,\n TunnelServerConfig,\n TunnelAuthMessage,\n AuthResult,\n TunnelCapability,\n TunnelMethod,\n TunnelErrorCodeValue,\n} from './shared';\n\n// ─── Server: Relay ──────────────────────────────────────────────────────────\nexport { TunnelRelay, TunnelRelayError } from './server';\nexport { HeartbeatManager } from './server';\nexport { createWsHandlers } from './server';\nexport type { WsHandlers, WsHandlerOptions } from './server';\nexport { createTunnelRouter } from './server';\nexport { startTunnelServer } from './server';\nexport type { TunnelServer } from './server';\n\n// ─── Client: SDK ────────────────────────────────────────────────────────────\nexport { TunnelClient, TunnelClientError } from './client';\nexport type { TunnelClientConfig, AXElement } from './client';\nexport { createTunnelTools } from './client';\nexport type { TunnelToolDefinition, TunnelToolParameter } from './client';\n\n// ─── Agent: Local Machine ───────────────────────────────────────────────────\nexport { TunnelAgent } from './agent';\nexport { loadConfig, type TunnelConfig } from './agent';\nexport { CapabilityRegistry } from './agent';\nexport type { Capability, RpcHandler } from './agent';\nexport { createFilesystemCapability } from './agent';\nexport { createShellCapability } from './agent';\nexport { createDesktopCapability } from './agent';\nexport { PermissionGuard } from './agent';\nexport type { LocalPermission } from './agent';\nexport { validateCommand } from './agent';\nexport { validatePath } from './agent';\n"],"mappings":"AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA4BP,SAAS,aAAa,wBAAwB;AAC9C,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAEjC,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAIlC,SAAS,cAAc,yBAAyB;AAEhD,SAAS,yBAAyB;AAIlC,SAAS,mBAAmB;AAC5B,SAAS,kBAAqC;AAC9C,SAAS,0BAA0B;AAEnC,SAAS,kCAAkC;AAC3C,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAEhC,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;","names":[]}