@kortix/agent-tunnel 0.1.2 → 0.1.3

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.
@@ -0,0 +1,34 @@
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
+ };
@@ -0,0 +1,183 @@
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 };
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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":[]}