@chatroomcp/chatroom 0.1.7 → 0.2.0

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 (50) hide show
  1. package/dist/app/application.d.ts +1 -0
  2. package/dist/app/application.js +4 -0
  3. package/dist/app/event-bus.d.ts +4 -0
  4. package/dist/auth/ingress-policy.d.ts +2 -0
  5. package/dist/auth/ingress-policy.js +7 -1
  6. package/dist/infrastructure/database/app-database.js +7 -0
  7. package/dist/infrastructure/http/http-server.js +5 -1
  8. package/dist/mcp/server/plugin-mcp-registrar.d.ts +6 -1
  9. package/dist/mcp/server/plugin-mcp-registrar.js +4 -4
  10. package/dist/mcp/server/request-context.d.ts +3 -0
  11. package/dist/mcp/server/request-context.js +8 -0
  12. package/dist/mcp/server/tool-support.d.ts +1 -1
  13. package/dist/mcp/server/tool-support.js +3 -1
  14. package/dist/native/macos/ChatRoomComputerHelper.app/Contents/Info.plist +14 -0
  15. package/dist/native/macos/ChatRoomComputerHelper.app/Contents/MacOS/chatroom-computer-helper +0 -0
  16. package/dist/native/macos/ChatRoomComputerHelper.app/Contents/_CodeSignature/CodeResources +115 -0
  17. package/dist/native/windows/chatroom-computer-helper.exe +0 -0
  18. package/dist/plugins/computer/audit.d.ts +34 -0
  19. package/dist/plugins/computer/audit.js +42 -0
  20. package/dist/plugins/computer/computer-native-backend.d.ts +11 -0
  21. package/dist/plugins/computer/computer-native-backend.js +58 -0
  22. package/dist/plugins/computer/computer-native-host.d.ts +26 -0
  23. package/dist/plugins/computer/computer-native-host.js +245 -0
  24. package/dist/plugins/computer/computer-protocol.d.ts +21 -0
  25. package/dist/plugins/computer/computer-protocol.js +72 -0
  26. package/dist/plugins/computer/computer-schemas.d.ts +317 -0
  27. package/dist/plugins/computer/computer-schemas.js +152 -0
  28. package/dist/plugins/computer/computer-service.d.ts +27 -0
  29. package/dist/plugins/computer/computer-service.js +108 -0
  30. package/dist/plugins/computer/computer-settings-repository.d.ts +8 -0
  31. package/dist/plugins/computer/computer-settings-repository.js +41 -0
  32. package/dist/plugins/computer/mcp.d.ts +3 -0
  33. package/dist/plugins/computer/mcp.js +126 -0
  34. package/dist/plugins/computer/plugin.d.ts +4 -0
  35. package/dist/plugins/computer/plugin.js +29 -0
  36. package/dist/plugins/computer/types.d.ts +174 -0
  37. package/dist/plugins/computer/types.js +1 -0
  38. package/dist/plugins/web/api-types.d.ts +15 -1
  39. package/dist/plugins/web/http/api-router.js +2 -0
  40. package/dist/plugins/web/http/computer-api-router.d.ts +5 -0
  41. package/dist/plugins/web/http/computer-api-router.js +68 -0
  42. package/dist/plugins/web/plugin.js +3 -1
  43. package/dist/plugins/web/runtime.d.ts +3 -1
  44. package/dist/plugins/web/runtime.js +3 -1
  45. package/dist/web/assets/index-BXlxEk8f.css +1 -0
  46. package/dist/web/assets/index-DUM6zVHS.js +26 -0
  47. package/dist/web/index.html +2 -2
  48. package/package.json +6 -3
  49. package/dist/web/assets/index-B7jL3mhD.css +0 -1
  50. package/dist/web/assets/index-L4-YdZVN.js +0 -26
@@ -0,0 +1,245 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { spawn } from "node:child_process";
3
+ import { chmodSync, existsSync, rmSync } from "node:fs";
4
+ import { createServer } from "node:net";
5
+ import { createInterface } from "node:readline";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { ChatRoomError } from "../../core/errors/chatroom-error.js";
9
+ import { COMPUTER_NATIVE_PROTOCOL_VERSION, nativeError, parseNativeEnvelope, } from "./computer-protocol.js";
10
+ export class ComputerNativeHost {
11
+ child = null;
12
+ socket = null;
13
+ socketServer = null;
14
+ socketPath = null;
15
+ lines = null;
16
+ starting = null;
17
+ pending = new Map();
18
+ sequence = 0;
19
+ get platform() {
20
+ if (process.platform === "darwin")
21
+ return "macos";
22
+ if (process.platform === "win32")
23
+ return "windows";
24
+ return "unsupported";
25
+ }
26
+ get idle() {
27
+ return this.pending.size === 0;
28
+ }
29
+ async request(method, params) {
30
+ await this.ensureStarted();
31
+ const id = `computer_${++this.sequence}`;
32
+ const timeoutMs = requestTimeoutMs(method);
33
+ const promise = new Promise((resolve, reject) => {
34
+ const timer = setTimeout(() => {
35
+ this.pending.delete(id);
36
+ const error = new ChatRoomError("INTERNAL", `Computer helper ${method} request timed out after ${timeoutMs} ms`);
37
+ reject(error);
38
+ this.reset(error);
39
+ }, timeoutMs);
40
+ timer.unref();
41
+ this.pending.set(id, { resolve, reject, timer });
42
+ });
43
+ const line = `${JSON.stringify({
44
+ protocol: COMPUTER_NATIVE_PROTOCOL_VERSION,
45
+ id,
46
+ method,
47
+ params,
48
+ })}\n`;
49
+ if (this.platform === "macos")
50
+ this.socket.write(line);
51
+ else
52
+ this.child.stdin.write(line);
53
+ return promise;
54
+ }
55
+ restart(reason = "Computer helper restarting") {
56
+ this.reset(new Error(reason));
57
+ }
58
+ async dispose() {
59
+ this.reset(new Error("Computer helper stopped"));
60
+ }
61
+ async ensureStarted() {
62
+ if (this.platform === "macos" && this.socket && !this.socket.destroyed)
63
+ return;
64
+ if (this.platform === "windows" && this.child && !this.child.killed)
65
+ return;
66
+ if (this.starting)
67
+ return this.starting;
68
+ this.starting =
69
+ this.platform === "macos"
70
+ ? this.startMacHelper()
71
+ : this.platform === "windows"
72
+ ? this.startWindowsHelper()
73
+ : Promise.reject(new ChatRoomError("UNSUPPORTED", "Computer Use is supported only on macOS and Windows"));
74
+ try {
75
+ await this.starting;
76
+ }
77
+ finally {
78
+ this.starting = null;
79
+ }
80
+ }
81
+ async startMacHelper() {
82
+ const app = macHelperAppPath();
83
+ if (!app)
84
+ throw new ChatRoomError("UNSUPPORTED", "macOS Computer helper is missing");
85
+ this.cleanupSocketPath();
86
+ const socketPath = path.join("/tmp", `chatroom-c-${process.pid}-${randomUUID().slice(0, 8)}.sock`);
87
+ this.socketPath = socketPath;
88
+ await new Promise((resolve, reject) => {
89
+ const server = createServer();
90
+ this.socketServer = server;
91
+ let settled = false;
92
+ const timer = setTimeout(() => fail(new Error("Computer helper connection timed out")), 10_000);
93
+ timer.unref();
94
+ const cleanupServer = () => {
95
+ clearTimeout(timer);
96
+ if (this.socketServer === server)
97
+ this.socketServer = null;
98
+ server.close();
99
+ };
100
+ const fail = (error) => {
101
+ if (settled)
102
+ return;
103
+ settled = true;
104
+ cleanupServer();
105
+ this.cleanupSocketPath();
106
+ reject(error);
107
+ };
108
+ server.once("error", fail);
109
+ server.once("connection", (socket) => {
110
+ if (settled) {
111
+ socket.destroy();
112
+ return;
113
+ }
114
+ settled = true;
115
+ server.removeListener("error", fail);
116
+ cleanupServer();
117
+ this.attachSocket(socket);
118
+ resolve();
119
+ });
120
+ server.listen(socketPath, () => {
121
+ chmodSync(socketPath, 0o600);
122
+ const launcher = spawn("/usr/bin/open", ["-n", "-g", app, "--args", "--connect", socketPath], { stdio: "ignore" });
123
+ launcher.once("error", fail);
124
+ });
125
+ });
126
+ }
127
+ attachSocket(socket) {
128
+ this.socket = socket;
129
+ this.lines = createInterface({ input: socket });
130
+ this.lines.on("line", (line) => this.handleLine(line));
131
+ socket.once("error", (error) => this.failTransport(socket, error));
132
+ socket.once("close", () => this.failTransport(socket, new Error("Computer helper exited")));
133
+ }
134
+ async startWindowsHelper() {
135
+ const executable = windowsHelperPath();
136
+ if (!executable)
137
+ throw new ChatRoomError("UNSUPPORTED", "Windows Computer helper is missing");
138
+ const child = spawn(executable, [], {
139
+ stdio: ["pipe", "pipe", "pipe"],
140
+ windowsHide: true,
141
+ });
142
+ this.child = child;
143
+ this.lines = createInterface({ input: child.stdout });
144
+ this.lines.on("line", (line) => this.handleLine(line));
145
+ child.stderr.on("data", (chunk) => console.error("[computer-helper]", String(chunk).trimEnd()));
146
+ child.once("error", (error) => this.failTransport(child, error));
147
+ child.once("exit", () => this.failTransport(child, new Error("Computer helper exited")));
148
+ }
149
+ failTransport(transport, error) {
150
+ const isCurrentSocket = transport === this.socket;
151
+ const isCurrentChild = transport === this.child;
152
+ if (!isCurrentSocket && !isCurrentChild)
153
+ return;
154
+ if (isCurrentSocket)
155
+ this.socket = null;
156
+ if (isCurrentChild)
157
+ this.child = null;
158
+ this.lines?.close();
159
+ this.lines = null;
160
+ this.cleanupSocketPath();
161
+ this.rejectPending(error);
162
+ }
163
+ reset(error) {
164
+ this.lines?.close();
165
+ this.lines = null;
166
+ this.socket?.destroy();
167
+ this.socket = null;
168
+ this.socketServer?.close();
169
+ this.socketServer = null;
170
+ this.child?.kill();
171
+ this.child = null;
172
+ this.cleanupSocketPath();
173
+ this.rejectPending(error);
174
+ }
175
+ rejectPending(error) {
176
+ for (const item of this.pending.values()) {
177
+ clearTimeout(item.timer);
178
+ item.reject(error);
179
+ }
180
+ this.pending.clear();
181
+ }
182
+ cleanupSocketPath() {
183
+ if (!this.socketPath)
184
+ return;
185
+ rmSync(this.socketPath, { force: true });
186
+ this.socketPath = null;
187
+ }
188
+ handleLine(line) {
189
+ let raw;
190
+ try {
191
+ raw = JSON.parse(line);
192
+ }
193
+ catch {
194
+ return;
195
+ }
196
+ const rawId = raw && typeof raw === "object" && "id" in raw
197
+ ? raw.id
198
+ : undefined;
199
+ if (typeof rawId !== "string")
200
+ return;
201
+ const pending = this.pending.get(rawId);
202
+ if (!pending)
203
+ return;
204
+ let message;
205
+ try {
206
+ message = parseNativeEnvelope(raw);
207
+ }
208
+ catch (error) {
209
+ this.pending.delete(rawId);
210
+ clearTimeout(pending.timer);
211
+ pending.reject(error);
212
+ return;
213
+ }
214
+ this.pending.delete(message.id);
215
+ clearTimeout(pending.timer);
216
+ if (message.error)
217
+ pending.reject(nativeError(message.error));
218
+ else
219
+ pending.resolve(message.result);
220
+ }
221
+ }
222
+ function requestTimeoutMs(method) {
223
+ switch (method) {
224
+ case "status":
225
+ return 5_000;
226
+ case "snapshot":
227
+ return 15_000;
228
+ case "requestPermission":
229
+ return 30_000;
230
+ case "action":
231
+ return 60_000;
232
+ }
233
+ }
234
+ function projectRoot() {
235
+ const current = fileURLToPath(import.meta.url);
236
+ return path.resolve(path.dirname(current), "../../..");
237
+ }
238
+ function macHelperAppPath() {
239
+ const app = path.join(projectRoot(), "dist", "native", "macos", "ChatRoomComputerHelper.app");
240
+ return existsSync(app) ? app : null;
241
+ }
242
+ function windowsHelperPath() {
243
+ const executable = path.join(projectRoot(), "dist", "native", "windows", "chatroom-computer-helper.exe");
244
+ return existsSync(executable) ? executable : null;
245
+ }
@@ -0,0 +1,21 @@
1
+ import { ChatRoomError } from "../../core/errors/chatroom-error.js";
2
+ import type { ComputerActionResult, ComputerSnapshot, ComputerStatus } from "./types.js";
3
+ export declare const COMPUTER_NATIVE_PROTOCOL_VERSION = 1;
4
+ export type ComputerNativeMethod = "status" | "requestPermission" | "snapshot" | "action";
5
+ export interface ComputerNativeResultMap {
6
+ status: Omit<ComputerStatus, "settings">;
7
+ requestPermission: Omit<ComputerStatus, "settings">;
8
+ snapshot: ComputerSnapshot;
9
+ action: ComputerActionResult;
10
+ }
11
+ export interface ComputerNativeError {
12
+ code?: string;
13
+ message: string;
14
+ }
15
+ export declare function parseNativeEnvelope(value: unknown): {
16
+ id: string;
17
+ result?: unknown;
18
+ error?: ComputerNativeError;
19
+ };
20
+ export declare function parseNativeResult<M extends ComputerNativeMethod>(method: M, value: unknown): ComputerNativeResultMap[M];
21
+ export declare function nativeError(error: ComputerNativeError): ChatRoomError;
@@ -0,0 +1,72 @@
1
+ import { z } from "zod";
2
+ import { ChatRoomError, } from "../../core/errors/chatroom-error.js";
3
+ import { computerActionResultSchema, computerNativeStatusSchema, computerSnapshotSchema, } from "./computer-schemas.js";
4
+ export const COMPUTER_NATIVE_PROTOCOL_VERSION = 1;
5
+ const responseEnvelopeSchema = z
6
+ .object({
7
+ protocol: z.literal(COMPUTER_NATIVE_PROTOCOL_VERSION).optional(),
8
+ id: z.string(),
9
+ result: z.unknown().optional(),
10
+ error: z
11
+ .object({
12
+ code: z.string().optional(),
13
+ message: z.string(),
14
+ })
15
+ .optional(),
16
+ })
17
+ .refine((value) => value.result !== undefined || value.error !== undefined, {
18
+ message: "Native response must contain result or error",
19
+ });
20
+ export function parseNativeEnvelope(value) {
21
+ const parsed = responseEnvelopeSchema.safeParse(value);
22
+ if (!parsed.success) {
23
+ throw new ChatRoomError("INTERNAL", "Computer helper returned an invalid protocol response", { issues: parsed.error.issues });
24
+ }
25
+ return {
26
+ id: parsed.data.id,
27
+ ...(parsed.data.result === undefined ? {} : { result: parsed.data.result }),
28
+ ...(parsed.data.error === undefined
29
+ ? {}
30
+ : {
31
+ error: {
32
+ message: parsed.data.error.message,
33
+ ...(parsed.data.error.code === undefined
34
+ ? {}
35
+ : { code: parsed.data.error.code }),
36
+ },
37
+ }),
38
+ };
39
+ }
40
+ export function parseNativeResult(method, value) {
41
+ const schema = method === "status" || method === "requestPermission"
42
+ ? computerNativeStatusSchema
43
+ : method === "snapshot"
44
+ ? computerSnapshotSchema
45
+ : computerActionResultSchema;
46
+ const parsed = schema.safeParse(value);
47
+ if (!parsed.success) {
48
+ throw new ChatRoomError("INTERNAL", `Computer helper returned an invalid ${method} result`, { issues: parsed.error.issues });
49
+ }
50
+ return parsed.data;
51
+ }
52
+ export function nativeError(error) {
53
+ return new ChatRoomError(nativeErrorCode(error.code), error.message, {
54
+ nativeCode: error.code ?? null,
55
+ });
56
+ }
57
+ function nativeErrorCode(code) {
58
+ switch (code) {
59
+ case "invalid_request":
60
+ return "INVALID_INPUT";
61
+ case "not_found":
62
+ return "NOT_FOUND";
63
+ case "permission_required":
64
+ return "FORBIDDEN";
65
+ case "stale_snapshot":
66
+ return "CONFLICT";
67
+ case "unsupported":
68
+ return "UNSUPPORTED";
69
+ default:
70
+ return "INTERNAL";
71
+ }
72
+ }
@@ -0,0 +1,317 @@
1
+ import { z } from "zod";
2
+ export declare const computerPermissionStateSchema: z.ZodEnum<{
3
+ granted: "granted";
4
+ denied: "denied";
5
+ unknown: "unknown";
6
+ "not-required": "not-required";
7
+ }>;
8
+ export declare const computerDisplaySchema: z.ZodObject<{
9
+ id: z.ZodString;
10
+ name: z.ZodString;
11
+ width: z.ZodNumber;
12
+ height: z.ZodNumber;
13
+ scale: z.ZodNumber;
14
+ primary: z.ZodBoolean;
15
+ }, z.core.$strip>;
16
+ export declare const computerElementSchema: z.ZodObject<{
17
+ id: z.ZodNumber;
18
+ role: z.ZodString;
19
+ name: z.ZodNullable<z.ZodString>;
20
+ value: z.ZodNullable<z.ZodString>;
21
+ enabled: z.ZodBoolean;
22
+ focused: z.ZodBoolean;
23
+ selected: z.ZodBoolean;
24
+ sensitive: z.ZodBoolean;
25
+ bounds: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
26
+ actions: z.ZodArray<z.ZodString>;
27
+ }, z.core.$strip>;
28
+ export declare const computerScreenshotSchema: z.ZodObject<{
29
+ mimeType: z.ZodEnum<{
30
+ "image/jpeg": "image/jpeg";
31
+ "image/png": "image/png";
32
+ }>;
33
+ data: z.ZodString;
34
+ }, z.core.$strip>;
35
+ export declare const computerNativeStatusSchema: z.ZodObject<{
36
+ platform: z.ZodEnum<{
37
+ macos: "macos";
38
+ windows: "windows";
39
+ unsupported: "unsupported";
40
+ }>;
41
+ helper: z.ZodEnum<{
42
+ running: "running";
43
+ stopped: "stopped";
44
+ unavailable: "unavailable";
45
+ }>;
46
+ permissions: z.ZodObject<{
47
+ accessibility: z.ZodEnum<{
48
+ granted: "granted";
49
+ denied: "denied";
50
+ unknown: "unknown";
51
+ "not-required": "not-required";
52
+ }>;
53
+ screenRecording: z.ZodEnum<{
54
+ granted: "granted";
55
+ denied: "denied";
56
+ unknown: "unknown";
57
+ "not-required": "not-required";
58
+ }>;
59
+ }, z.core.$strip>;
60
+ displays: z.ZodArray<z.ZodObject<{
61
+ id: z.ZodString;
62
+ name: z.ZodString;
63
+ width: z.ZodNumber;
64
+ height: z.ZodNumber;
65
+ scale: z.ZodNumber;
66
+ primary: z.ZodBoolean;
67
+ }, z.core.$strip>>;
68
+ }, z.core.$strip>;
69
+ export declare const computerSnapshotSchema: z.ZodObject<{
70
+ snapshotId: z.ZodString;
71
+ revision: z.ZodNumber;
72
+ display: z.ZodNullable<z.ZodObject<{
73
+ id: z.ZodString;
74
+ name: z.ZodString;
75
+ width: z.ZodNumber;
76
+ height: z.ZodNumber;
77
+ scale: z.ZodNumber;
78
+ primary: z.ZodBoolean;
79
+ }, z.core.$strip>>;
80
+ activeApp: z.ZodNullable<z.ZodString>;
81
+ activeWindow: z.ZodNullable<z.ZodString>;
82
+ cursor: z.ZodNullable<z.ZodObject<{
83
+ x: z.ZodNumber;
84
+ y: z.ZodNumber;
85
+ }, z.core.$strip>>;
86
+ elements: z.ZodArray<z.ZodObject<{
87
+ id: z.ZodNumber;
88
+ role: z.ZodString;
89
+ name: z.ZodNullable<z.ZodString>;
90
+ value: z.ZodNullable<z.ZodString>;
91
+ enabled: z.ZodBoolean;
92
+ focused: z.ZodBoolean;
93
+ selected: z.ZodBoolean;
94
+ sensitive: z.ZodBoolean;
95
+ bounds: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
96
+ actions: z.ZodArray<z.ZodString>;
97
+ }, z.core.$strip>>;
98
+ screenshot: z.ZodOptional<z.ZodObject<{
99
+ mimeType: z.ZodEnum<{
100
+ "image/jpeg": "image/jpeg";
101
+ "image/png": "image/png";
102
+ }>;
103
+ data: z.ZodString;
104
+ }, z.core.$strip>>;
105
+ }, z.core.$strip>;
106
+ export declare const computerSnapshotMetadataSchema: z.ZodObject<{
107
+ display: z.ZodNullable<z.ZodObject<{
108
+ id: z.ZodString;
109
+ name: z.ZodString;
110
+ width: z.ZodNumber;
111
+ height: z.ZodNumber;
112
+ scale: z.ZodNumber;
113
+ primary: z.ZodBoolean;
114
+ }, z.core.$strip>>;
115
+ snapshotId: z.ZodString;
116
+ revision: z.ZodNumber;
117
+ activeApp: z.ZodNullable<z.ZodString>;
118
+ activeWindow: z.ZodNullable<z.ZodString>;
119
+ cursor: z.ZodNullable<z.ZodObject<{
120
+ x: z.ZodNumber;
121
+ y: z.ZodNumber;
122
+ }, z.core.$strip>>;
123
+ elements: z.ZodArray<z.ZodObject<{
124
+ id: z.ZodNumber;
125
+ role: z.ZodString;
126
+ name: z.ZodNullable<z.ZodString>;
127
+ value: z.ZodNullable<z.ZodString>;
128
+ enabled: z.ZodBoolean;
129
+ focused: z.ZodBoolean;
130
+ selected: z.ZodBoolean;
131
+ sensitive: z.ZodBoolean;
132
+ bounds: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
133
+ actions: z.ZodArray<z.ZodString>;
134
+ }, z.core.$strip>>;
135
+ }, z.core.$strip>;
136
+ export declare const computerActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
137
+ type: z.ZodLiteral<"move">;
138
+ x: z.ZodNumber;
139
+ y: z.ZodNumber;
140
+ }, z.core.$strip>, z.ZodObject<{
141
+ type: z.ZodLiteral<"click">;
142
+ x: z.ZodOptional<z.ZodNumber>;
143
+ y: z.ZodOptional<z.ZodNumber>;
144
+ elementId: z.ZodOptional<z.ZodNumber>;
145
+ }, z.core.$strip>, z.ZodObject<{
146
+ type: z.ZodLiteral<"double_click">;
147
+ x: z.ZodOptional<z.ZodNumber>;
148
+ y: z.ZodOptional<z.ZodNumber>;
149
+ elementId: z.ZodOptional<z.ZodNumber>;
150
+ }, z.core.$strip>, z.ZodObject<{
151
+ type: z.ZodLiteral<"right_click">;
152
+ x: z.ZodOptional<z.ZodNumber>;
153
+ y: z.ZodOptional<z.ZodNumber>;
154
+ elementId: z.ZodOptional<z.ZodNumber>;
155
+ }, z.core.$strip>, z.ZodObject<{
156
+ type: z.ZodLiteral<"drag">;
157
+ from: z.ZodObject<{
158
+ x: z.ZodNumber;
159
+ y: z.ZodNumber;
160
+ }, z.core.$strip>;
161
+ to: z.ZodObject<{
162
+ x: z.ZodNumber;
163
+ y: z.ZodNumber;
164
+ }, z.core.$strip>;
165
+ durationMs: z.ZodOptional<z.ZodNumber>;
166
+ }, z.core.$strip>, z.ZodObject<{
167
+ type: z.ZodLiteral<"scroll">;
168
+ deltaX: z.ZodOptional<z.ZodNumber>;
169
+ deltaY: z.ZodNumber;
170
+ elementId: z.ZodOptional<z.ZodNumber>;
171
+ }, z.core.$strip>, z.ZodObject<{
172
+ type: z.ZodLiteral<"keypress">;
173
+ keys: z.ZodArray<z.ZodString>;
174
+ }, z.core.$strip>, z.ZodObject<{
175
+ type: z.ZodLiteral<"type_text">;
176
+ text: z.ZodString;
177
+ elementId: z.ZodOptional<z.ZodNumber>;
178
+ }, z.core.$strip>, z.ZodObject<{
179
+ type: z.ZodLiteral<"invoke">;
180
+ elementId: z.ZodNumber;
181
+ }, z.core.$strip>, z.ZodObject<{
182
+ type: z.ZodLiteral<"set_value">;
183
+ elementId: z.ZodNumber;
184
+ value: z.ZodString;
185
+ }, z.core.$strip>, z.ZodObject<{
186
+ type: z.ZodLiteral<"select_text">;
187
+ elementId: z.ZodNumber;
188
+ start: z.ZodNumber;
189
+ length: z.ZodNumber;
190
+ }, z.core.$strip>, z.ZodObject<{
191
+ type: z.ZodLiteral<"activate_app">;
192
+ app: z.ZodString;
193
+ }, z.core.$strip>, z.ZodObject<{
194
+ type: z.ZodLiteral<"activate_window">;
195
+ elementId: z.ZodNumber;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ type: z.ZodLiteral<"move_window">;
198
+ elementId: z.ZodNumber;
199
+ x: z.ZodNumber;
200
+ y: z.ZodNumber;
201
+ }, z.core.$strip>, z.ZodObject<{
202
+ type: z.ZodLiteral<"resize_window">;
203
+ elementId: z.ZodNumber;
204
+ width: z.ZodNumber;
205
+ height: z.ZodNumber;
206
+ }, z.core.$strip>, z.ZodObject<{
207
+ type: z.ZodLiteral<"wait">;
208
+ ms: z.ZodNumber;
209
+ }, z.core.$strip>], "type">;
210
+ export declare const computerActionResultSchema: z.ZodObject<{
211
+ success: z.ZodLiteral<true>;
212
+ revision: z.ZodNumber;
213
+ snapshot: z.ZodOptional<z.ZodObject<{
214
+ snapshotId: z.ZodString;
215
+ revision: z.ZodNumber;
216
+ display: z.ZodNullable<z.ZodObject<{
217
+ id: z.ZodString;
218
+ name: z.ZodString;
219
+ width: z.ZodNumber;
220
+ height: z.ZodNumber;
221
+ scale: z.ZodNumber;
222
+ primary: z.ZodBoolean;
223
+ }, z.core.$strip>>;
224
+ activeApp: z.ZodNullable<z.ZodString>;
225
+ activeWindow: z.ZodNullable<z.ZodString>;
226
+ cursor: z.ZodNullable<z.ZodObject<{
227
+ x: z.ZodNumber;
228
+ y: z.ZodNumber;
229
+ }, z.core.$strip>>;
230
+ elements: z.ZodArray<z.ZodObject<{
231
+ id: z.ZodNumber;
232
+ role: z.ZodString;
233
+ name: z.ZodNullable<z.ZodString>;
234
+ value: z.ZodNullable<z.ZodString>;
235
+ enabled: z.ZodBoolean;
236
+ focused: z.ZodBoolean;
237
+ selected: z.ZodBoolean;
238
+ sensitive: z.ZodBoolean;
239
+ bounds: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
240
+ actions: z.ZodArray<z.ZodString>;
241
+ }, z.core.$strip>>;
242
+ screenshot: z.ZodOptional<z.ZodObject<{
243
+ mimeType: z.ZodEnum<{
244
+ "image/jpeg": "image/jpeg";
245
+ "image/png": "image/png";
246
+ }>;
247
+ data: z.ZodString;
248
+ }, z.core.$strip>>;
249
+ }, z.core.$strip>>;
250
+ executionMode: z.ZodEnum<{
251
+ semantic: "semantic";
252
+ background: "background";
253
+ foreground: "foreground";
254
+ mixed: "mixed";
255
+ }>;
256
+ focusChanged: z.ZodBoolean;
257
+ }, z.core.$strip>;
258
+ export declare const computerActionMetadataSchema: z.ZodObject<{
259
+ success: z.ZodLiteral<true>;
260
+ revision: z.ZodNumber;
261
+ executionMode: z.ZodEnum<{
262
+ semantic: "semantic";
263
+ background: "background";
264
+ foreground: "foreground";
265
+ mixed: "mixed";
266
+ }>;
267
+ focusChanged: z.ZodBoolean;
268
+ snapshot: z.ZodOptional<z.ZodObject<{
269
+ display: z.ZodNullable<z.ZodObject<{
270
+ id: z.ZodString;
271
+ name: z.ZodString;
272
+ width: z.ZodNumber;
273
+ height: z.ZodNumber;
274
+ scale: z.ZodNumber;
275
+ primary: z.ZodBoolean;
276
+ }, z.core.$strip>>;
277
+ snapshotId: z.ZodString;
278
+ revision: z.ZodNumber;
279
+ activeApp: z.ZodNullable<z.ZodString>;
280
+ activeWindow: z.ZodNullable<z.ZodString>;
281
+ cursor: z.ZodNullable<z.ZodObject<{
282
+ x: z.ZodNumber;
283
+ y: z.ZodNumber;
284
+ }, z.core.$strip>>;
285
+ elements: z.ZodArray<z.ZodObject<{
286
+ id: z.ZodNumber;
287
+ role: z.ZodString;
288
+ name: z.ZodNullable<z.ZodString>;
289
+ value: z.ZodNullable<z.ZodString>;
290
+ enabled: z.ZodBoolean;
291
+ focused: z.ZodBoolean;
292
+ selected: z.ZodBoolean;
293
+ sensitive: z.ZodBoolean;
294
+ bounds: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
295
+ actions: z.ZodArray<z.ZodString>;
296
+ }, z.core.$strip>>;
297
+ }, z.core.$strip>>;
298
+ }, z.core.$strip>;
299
+ export declare const computerSnapshotTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
300
+ type: z.ZodLiteral<"desktop">;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ type: z.ZodLiteral<"display">;
303
+ displayId: z.ZodOptional<z.ZodString>;
304
+ }, z.core.$strip>, z.ZodObject<{
305
+ type: z.ZodLiteral<"app">;
306
+ app: z.ZodString;
307
+ }, z.core.$strip>, z.ZodObject<{
308
+ type: z.ZodLiteral<"window">;
309
+ elementId: z.ZodNumber;
310
+ }, z.core.$strip>, z.ZodObject<{
311
+ type: z.ZodLiteral<"region">;
312
+ displayId: z.ZodOptional<z.ZodString>;
313
+ x: z.ZodNumber;
314
+ y: z.ZodNumber;
315
+ width: z.ZodNumber;
316
+ height: z.ZodNumber;
317
+ }, z.core.$strip>], "type">;