zilmate 1.1.0 → 1.3.1
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/.env.example +6 -0
- package/README.md +38 -3
- package/dist/agents/manager.d.ts +133 -0
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/manager.js +46 -4
- package/dist/agents/manager.js.map +1 -1
- package/dist/cli/camera.d.ts +6 -0
- package/dist/cli/camera.d.ts.map +1 -0
- package/dist/cli/camera.js +27 -0
- package/dist/cli/camera.js.map +1 -0
- package/dist/cli/interactive.d.ts.map +1 -1
- package/dist/cli/interactive.js +14 -4
- package/dist/cli/interactive.js.map +1 -1
- package/dist/cli/menu.d.ts.map +1 -1
- package/dist/cli/menu.js +14 -0
- package/dist/cli/menu.js.map +1 -1
- package/dist/cli/setup.d.ts +5 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +146 -12
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/voice.d.ts +3 -0
- package/dist/cli/voice.d.ts.map +1 -1
- package/dist/cli/voice.js +135 -4
- package/dist/cli/voice.js.map +1 -1
- package/dist/cli/welcome.d.ts.map +1 -1
- package/dist/cli/welcome.js +1 -0
- package/dist/cli/welcome.js.map +1 -1
- package/dist/config/env.d.ts +2 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +2 -0
- package/dist/config/env.js.map +1 -1
- package/dist/config/models.d.ts +1 -0
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js +1 -0
- package/dist/config/models.js.map +1 -1
- package/dist/index.js +104 -3
- package/dist/index.js.map +1 -1
- package/dist/safety/approvals.d.ts +2 -1
- package/dist/safety/approvals.d.ts.map +1 -1
- package/dist/safety/approvals.js +9 -3
- package/dist/safety/approvals.js.map +1 -1
- package/dist/tools/desktop.tool.d.ts +58 -0
- package/dist/tools/desktop.tool.d.ts.map +1 -0
- package/dist/tools/desktop.tool.js +433 -0
- package/dist/tools/desktop.tool.js.map +1 -0
- package/dist/tools/filesystem.tool.d.ts +93 -0
- package/dist/tools/filesystem.tool.d.ts.map +1 -0
- package/dist/tools/filesystem.tool.js +303 -0
- package/dist/tools/filesystem.tool.js.map +1 -0
- package/dist/voice/cascade.d.ts +15 -0
- package/dist/voice/cascade.d.ts.map +1 -0
- package/dist/voice/cascade.js +306 -0
- package/dist/voice/cascade.js.map +1 -0
- package/dist/voice/deepgram.d.ts +9 -16
- package/dist/voice/deepgram.d.ts.map +1 -1
- package/dist/voice/deepgram.js +66 -16
- package/dist/voice/deepgram.js.map +1 -1
- package/dist/voice/terminal.d.ts +27 -0
- package/dist/voice/terminal.d.ts.map +1 -0
- package/dist/voice/terminal.js +448 -0
- package/dist/voice/terminal.js.map +1 -0
- package/dist/voice/types.d.ts +2 -0
- package/dist/voice/types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { execFile, spawn } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { mkdir, readFile } from 'node:fs/promises';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { generateText, tool } from 'ai';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { models } from '../config/models.js';
|
|
9
|
+
import { requireGatewayAuth } from '../config/env.js';
|
|
10
|
+
import { requestConfirmation } from '../runtime/confirm.js';
|
|
11
|
+
import { emitProgress } from '../runtime/progress.js';
|
|
12
|
+
import { searchWeb } from './web-search.tool.js';
|
|
13
|
+
const execFileAsync = promisify(execFile);
|
|
14
|
+
const screenshotDir = path.resolve('outputs', 'screenshots');
|
|
15
|
+
const cameraDir = path.resolve('outputs', 'camera');
|
|
16
|
+
async function confirmDesktopAction(action, details, access = 'Read-only') {
|
|
17
|
+
return requestConfirmation({
|
|
18
|
+
toolkitSlug: 'ZILMATE',
|
|
19
|
+
toolSlug: 'DESKTOP',
|
|
20
|
+
action,
|
|
21
|
+
access,
|
|
22
|
+
targetTools: ['ZILMATE_DESKTOP'],
|
|
23
|
+
details,
|
|
24
|
+
summary: details.join('; '),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function safeShellText(value) {
|
|
28
|
+
return value.replace(/'/g, "''");
|
|
29
|
+
}
|
|
30
|
+
async function commandExists(command) {
|
|
31
|
+
const probe = process.platform === 'win32' ? 'where.exe' : 'which';
|
|
32
|
+
try {
|
|
33
|
+
await execFileAsync(probe, [command], { windowsHide: true, timeout: 5000 });
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function cameraInstallHint() {
|
|
41
|
+
if (process.platform === 'win32')
|
|
42
|
+
return 'Install ffmpeg: winget install Gyan.FFmpeg';
|
|
43
|
+
if (process.platform === 'darwin')
|
|
44
|
+
return 'Install ffmpeg: brew install ffmpeg';
|
|
45
|
+
return 'Install ffmpeg from your package manager, for example: sudo apt install ffmpeg';
|
|
46
|
+
}
|
|
47
|
+
async function readClipboardText() {
|
|
48
|
+
if (process.platform === 'win32') {
|
|
49
|
+
const { stdout } = await execFileAsync('powershell.exe', ['-NoProfile', '-Command', 'Get-Clipboard -Raw'], { windowsHide: true, timeout: 10_000, maxBuffer: 2_000_000 });
|
|
50
|
+
return stdout;
|
|
51
|
+
}
|
|
52
|
+
if (process.platform === 'darwin') {
|
|
53
|
+
const { stdout } = await execFileAsync('pbpaste', [], { timeout: 10_000, maxBuffer: 2_000_000 });
|
|
54
|
+
return stdout;
|
|
55
|
+
}
|
|
56
|
+
for (const command of ['wl-paste', 'xclip', 'xsel']) {
|
|
57
|
+
if (await commandExists(command)) {
|
|
58
|
+
const args = command === 'xclip'
|
|
59
|
+
? ['-selection', 'clipboard', '-o']
|
|
60
|
+
: command === 'xsel'
|
|
61
|
+
? ['--clipboard', '--output']
|
|
62
|
+
: [];
|
|
63
|
+
const { stdout } = await execFileAsync(command, args, { timeout: 10_000, maxBuffer: 2_000_000 });
|
|
64
|
+
return stdout;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
throw new Error('No supported clipboard reader found. Install wl-clipboard, xclip, or xsel on Linux.');
|
|
68
|
+
}
|
|
69
|
+
async function writeClipboardText(text) {
|
|
70
|
+
if (process.platform === 'win32') {
|
|
71
|
+
const script = `Set-Clipboard -Value '${safeShellText(text)}'`;
|
|
72
|
+
await execFileAsync('powershell.exe', ['-NoProfile', '-Command', script], { windowsHide: true, timeout: 10_000 });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (process.platform === 'darwin') {
|
|
76
|
+
await writeToCommand('pbcopy', [], text);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
for (const command of ['wl-copy', 'xclip', 'xsel']) {
|
|
80
|
+
if (await commandExists(command)) {
|
|
81
|
+
const args = command === 'xclip'
|
|
82
|
+
? ['-selection', 'clipboard']
|
|
83
|
+
: command === 'xsel'
|
|
84
|
+
? ['--clipboard', '--input']
|
|
85
|
+
: [];
|
|
86
|
+
await writeToCommand(command, args, text);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
throw new Error('No supported clipboard writer found. Install wl-clipboard, xclip, or xsel on Linux.');
|
|
91
|
+
}
|
|
92
|
+
function writeToCommand(command, args, input) {
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
const child = spawn(command, args, { windowsHide: true });
|
|
95
|
+
let stderr = '';
|
|
96
|
+
child.stderr.setEncoding('utf8');
|
|
97
|
+
child.stderr.on('data', (chunk) => {
|
|
98
|
+
stderr += chunk;
|
|
99
|
+
});
|
|
100
|
+
child.on('error', reject);
|
|
101
|
+
child.on('close', (code) => {
|
|
102
|
+
if (code === 0)
|
|
103
|
+
resolve();
|
|
104
|
+
else
|
|
105
|
+
reject(new Error(stderr || `${command} exited with code ${code}`));
|
|
106
|
+
});
|
|
107
|
+
child.stdin.end(input);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async function captureScreenshot() {
|
|
111
|
+
await mkdir(screenshotDir, { recursive: true });
|
|
112
|
+
const target = path.join(screenshotDir, `zilmate-screen-${Date.now()}.png`);
|
|
113
|
+
if (process.platform === 'win32') {
|
|
114
|
+
const script = `
|
|
115
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
116
|
+
Add-Type -AssemblyName System.Drawing
|
|
117
|
+
$bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
|
|
118
|
+
$bitmap = New-Object System.Drawing.Bitmap $bounds.Width, $bounds.Height
|
|
119
|
+
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
|
120
|
+
$graphics.CopyFromScreen($bounds.Location, [System.Drawing.Point]::Empty, $bounds.Size)
|
|
121
|
+
$bitmap.Save('${safeShellText(target)}', [System.Drawing.Imaging.ImageFormat]::Png)
|
|
122
|
+
$graphics.Dispose()
|
|
123
|
+
$bitmap.Dispose()
|
|
124
|
+
`;
|
|
125
|
+
await execFileAsync('powershell.exe', ['-NoProfile', '-Command', script], { windowsHide: true, timeout: 20_000 });
|
|
126
|
+
return target;
|
|
127
|
+
}
|
|
128
|
+
if (process.platform === 'darwin') {
|
|
129
|
+
await execFileAsync('screencapture', ['-x', target], { timeout: 20_000 });
|
|
130
|
+
return target;
|
|
131
|
+
}
|
|
132
|
+
for (const command of ['gnome-screenshot', 'grim', 'import']) {
|
|
133
|
+
if (await commandExists(command)) {
|
|
134
|
+
const args = command === 'gnome-screenshot'
|
|
135
|
+
? ['-f', target]
|
|
136
|
+
: command === 'grim'
|
|
137
|
+
? [target]
|
|
138
|
+
: ['-window', 'root', target];
|
|
139
|
+
await execFileAsync(command, args, { timeout: 20_000 });
|
|
140
|
+
return target;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
throw new Error('No supported screenshot tool found. Install gnome-screenshot, grim, or ImageMagick import on Linux.');
|
|
144
|
+
}
|
|
145
|
+
function cameraCandidates(device) {
|
|
146
|
+
if (device)
|
|
147
|
+
return [device];
|
|
148
|
+
if (process.platform === 'win32') {
|
|
149
|
+
return [
|
|
150
|
+
process.env.ZILMATE_CAMERA_DEVICE,
|
|
151
|
+
'video=Integrated Camera',
|
|
152
|
+
'video=USB Camera',
|
|
153
|
+
'video=HD Webcam',
|
|
154
|
+
'video=Integrated Webcam',
|
|
155
|
+
'video=Camera',
|
|
156
|
+
].filter((value) => Boolean(value));
|
|
157
|
+
}
|
|
158
|
+
if (process.platform === 'darwin') {
|
|
159
|
+
return [process.env.ZILMATE_CAMERA_DEVICE, 'default', '0', '1'].filter((value) => Boolean(value));
|
|
160
|
+
}
|
|
161
|
+
return [process.env.ZILMATE_CAMERA_DEVICE, '/dev/video0', '/dev/video1', '/dev/video2'].filter((value) => Boolean(value));
|
|
162
|
+
}
|
|
163
|
+
function ffmpegCameraArgs(inputDevice, target) {
|
|
164
|
+
if (process.platform === 'win32')
|
|
165
|
+
return ['-y', '-f', 'dshow', '-i', inputDevice, '-frames:v', '1', target];
|
|
166
|
+
if (process.platform === 'darwin')
|
|
167
|
+
return ['-y', '-f', 'avfoundation', '-i', inputDevice, '-frames:v', '1', target];
|
|
168
|
+
return ['-y', '-f', 'video4linux2', '-i', inputDevice, '-frames:v', '1', target];
|
|
169
|
+
}
|
|
170
|
+
function friendlyCameraError(error, attempts) {
|
|
171
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
172
|
+
if (/cannot find|could not find|No such file|video device|Could not open|I\/O error/i.test(message)) {
|
|
173
|
+
return `Could not open the camera device. Try \`zilmate camera list\`, then pass the exact device name. Attempts: ${attempts.map((item) => item.device).join(', ')}`;
|
|
174
|
+
}
|
|
175
|
+
if (/busy|in use|resource unavailable/i.test(message)) {
|
|
176
|
+
return 'Camera appears to be busy. Close Camera, Teams, Zoom, browser tabs, or other apps using it, then retry.';
|
|
177
|
+
}
|
|
178
|
+
if (/permission|denied|access/i.test(message)) {
|
|
179
|
+
return 'Camera permission was denied. Allow terminal/desktop apps to access the camera in OS privacy settings, then retry.';
|
|
180
|
+
}
|
|
181
|
+
return `${message}\nTried: ${attempts.map((item) => item.device).join(', ')}`;
|
|
182
|
+
}
|
|
183
|
+
export async function listCameraDevices() {
|
|
184
|
+
if (!(await commandExists('ffmpeg')))
|
|
185
|
+
return [];
|
|
186
|
+
try {
|
|
187
|
+
if (process.platform === 'win32') {
|
|
188
|
+
const result = await execFileAsync('ffmpeg', ['-hide_banner', '-list_devices', 'true', '-f', 'dshow', '-i', 'dummy'], { timeout: 15_000, maxBuffer: 2_000_000 });
|
|
189
|
+
const output = `${result.stdout}\n${result.stderr}`;
|
|
190
|
+
const names = [...output.matchAll(/"([^"]+)"\s+\(video\)/gi)].map((match) => match[1]).filter(Boolean);
|
|
191
|
+
return names.map((name) => ({ name, input: `video=${name}` }));
|
|
192
|
+
}
|
|
193
|
+
if (process.platform === 'darwin') {
|
|
194
|
+
const result = await execFileAsync('ffmpeg', ['-hide_banner', '-f', 'avfoundation', '-list_devices', 'true', '-i', ''], { timeout: 15_000, maxBuffer: 2_000_000 });
|
|
195
|
+
const output = `${result.stdout}\n${result.stderr}`;
|
|
196
|
+
const names = [...output.matchAll(/\[(\d+)\]\s+(.+)/g)].map((match) => ({ name: match[2].trim(), input: match[1] }));
|
|
197
|
+
return names;
|
|
198
|
+
}
|
|
199
|
+
const candidates = cameraCandidates();
|
|
200
|
+
const available = [];
|
|
201
|
+
for (const input of candidates) {
|
|
202
|
+
if (existsSync(input))
|
|
203
|
+
available.push({ name: input, input });
|
|
204
|
+
}
|
|
205
|
+
return available;
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
const output = error && typeof error === 'object' && 'stderr' in error ? String(error.stderr || '') : '';
|
|
209
|
+
if (process.platform === 'win32') {
|
|
210
|
+
const names = [...output.matchAll(/"([^"]+)"\s+\(video\)/gi)].map((match) => match[1]).filter(Boolean);
|
|
211
|
+
return names.map((name) => ({ name, input: `video=${name}` }));
|
|
212
|
+
}
|
|
213
|
+
if (process.platform === 'darwin') {
|
|
214
|
+
return [...output.matchAll(/\[(\d+)\]\s+(.+)/g)].map((match) => ({ name: match[2].trim(), input: match[1] }));
|
|
215
|
+
}
|
|
216
|
+
return [];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
export async function runCameraDoctor() {
|
|
220
|
+
const checks = [
|
|
221
|
+
{ name: 'OS', status: 'pass', detail: `${process.platform} ${process.arch}` },
|
|
222
|
+
];
|
|
223
|
+
const hasFfmpeg = await commandExists('ffmpeg');
|
|
224
|
+
checks.push({
|
|
225
|
+
name: 'ffmpeg',
|
|
226
|
+
status: hasFfmpeg ? 'pass' : 'fail',
|
|
227
|
+
detail: hasFfmpeg ? 'ffmpeg is available' : cameraInstallHint(),
|
|
228
|
+
});
|
|
229
|
+
if (!hasFfmpeg)
|
|
230
|
+
return checks;
|
|
231
|
+
const devices = await listCameraDevices();
|
|
232
|
+
checks.push({
|
|
233
|
+
name: 'Camera devices',
|
|
234
|
+
status: devices.length > 0 ? 'pass' : 'warn',
|
|
235
|
+
detail: devices.length > 0 ? devices.map((device) => device.input).join(', ') : 'No camera devices listed. Try setting ZILMATE_CAMERA_DEVICE manually.',
|
|
236
|
+
});
|
|
237
|
+
checks.push({
|
|
238
|
+
name: 'Default candidates',
|
|
239
|
+
status: 'pass',
|
|
240
|
+
detail: cameraCandidates().join(', '),
|
|
241
|
+
});
|
|
242
|
+
return checks;
|
|
243
|
+
}
|
|
244
|
+
export async function captureCameraPhoto(device) {
|
|
245
|
+
await mkdir(cameraDir, { recursive: true });
|
|
246
|
+
if (!(await commandExists('ffmpeg'))) {
|
|
247
|
+
throw new Error(`Camera capture needs ffmpeg installed and available on PATH. ${cameraInstallHint()}.`);
|
|
248
|
+
}
|
|
249
|
+
const attempts = [];
|
|
250
|
+
const listed = await listCameraDevices();
|
|
251
|
+
const candidates = [...new Set([...cameraCandidates(device), ...listed.map((item) => item.input)])];
|
|
252
|
+
for (const candidate of candidates) {
|
|
253
|
+
const target = path.join(cameraDir, `zilmate-camera-${Date.now()}.jpg`);
|
|
254
|
+
try {
|
|
255
|
+
emitProgress({ type: 'tool:start', label: 'Trying camera', detail: candidate });
|
|
256
|
+
await execFileAsync('ffmpeg', ffmpegCameraArgs(candidate, target), { timeout: 25_000, maxBuffer: 2_000_000 });
|
|
257
|
+
return target;
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
attempts.push({ device: candidate, error: error instanceof Error ? error.message : String(error) });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
throw new Error(friendlyCameraError(attempts.at(-1)?.error || 'Camera capture failed.', attempts));
|
|
264
|
+
}
|
|
265
|
+
async function analyzeImage(imagePath, prompt, label = 'image') {
|
|
266
|
+
requireGatewayAuth();
|
|
267
|
+
const image = await readFile(imagePath);
|
|
268
|
+
emitProgress({ type: 'tool:start', label: `Analyzing ${label}`, detail: models.screenshotVision });
|
|
269
|
+
const result = await generateText({
|
|
270
|
+
model: models.screenshotVision,
|
|
271
|
+
messages: [
|
|
272
|
+
{
|
|
273
|
+
role: 'user',
|
|
274
|
+
content: [
|
|
275
|
+
{
|
|
276
|
+
type: 'text',
|
|
277
|
+
text: prompt,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
type: 'image',
|
|
281
|
+
image,
|
|
282
|
+
mediaType: imagePath.toLowerCase().endsWith('.jpg') || imagePath.toLowerCase().endsWith('.jpeg') ? 'image/jpeg' : 'image/png',
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
providerOptions: {
|
|
288
|
+
gateway: {
|
|
289
|
+
tags: ['zilmate', 'feature:screenshot', 'model:gemini'],
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
emitProgress({ type: 'tool:end', label: `${label[0]?.toUpperCase() || 'I'}${label.slice(1)} analyzed`, detail: models.screenshotVision });
|
|
294
|
+
return result.text;
|
|
295
|
+
}
|
|
296
|
+
const defaultScreenshotPrompt = [
|
|
297
|
+
'Describe this screenshot clearly and usefully.',
|
|
298
|
+
'Include visible apps/pages, important UI elements, visible text, errors, warnings, selected items, and likely user intent.',
|
|
299
|
+
'If this is a coding or app screen, identify the relevant files, terminal output, browser state, or UI issue.',
|
|
300
|
+
'Be precise and avoid claiming hidden information that is not visible.',
|
|
301
|
+
].join(' ');
|
|
302
|
+
const defaultCameraPrompt = [
|
|
303
|
+
'Describe this camera photo clearly and usefully.',
|
|
304
|
+
'Identify visible objects, environment, text, people only in non-sensitive general terms, safety concerns, and anything the user may be asking about.',
|
|
305
|
+
'Do not identify a person by name or infer sensitive traits.',
|
|
306
|
+
'If the image shows a document, product, device, room, object, or issue, explain what is visible and what might be useful to do next.',
|
|
307
|
+
].join(' ');
|
|
308
|
+
export const desktopTools = {
|
|
309
|
+
readClipboard: tool({
|
|
310
|
+
description: 'Read the current system clipboard text after user approval. Use when the user asks ZilMate to inspect copied text, copied errors, URLs, snippets, or prompts.',
|
|
311
|
+
inputSchema: z.object({
|
|
312
|
+
maxCharacters: z.number().int().min(100).max(20_000).optional(),
|
|
313
|
+
}),
|
|
314
|
+
execute: async ({ maxCharacters }) => {
|
|
315
|
+
const approved = await confirmDesktopAction('Read clipboard', ['Read text currently stored in the system clipboard']);
|
|
316
|
+
if (!approved)
|
|
317
|
+
throw new Error('Blocked clipboard read. Ask the user to approve reading the clipboard.');
|
|
318
|
+
const text = await readClipboardText();
|
|
319
|
+
const limit = maxCharacters ?? 8000;
|
|
320
|
+
emitProgress({ type: 'fetch:end', label: 'Clipboard read', detail: `${text.length} character${text.length === 1 ? '' : 's'}` });
|
|
321
|
+
return {
|
|
322
|
+
characters: text.length,
|
|
323
|
+
truncated: text.length > limit,
|
|
324
|
+
text: text.slice(0, limit),
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
}),
|
|
328
|
+
writeClipboard: tool({
|
|
329
|
+
description: 'Write text to the system clipboard after user approval. Use when the user asks ZilMate to copy an answer, command, file path, draft, or summary.',
|
|
330
|
+
inputSchema: z.object({
|
|
331
|
+
text: z.string().min(1).max(100_000),
|
|
332
|
+
}),
|
|
333
|
+
execute: async ({ text }) => {
|
|
334
|
+
const approved = await confirmDesktopAction('Write clipboard', [`Write ${text.length} character${text.length === 1 ? '' : 's'} to clipboard`], 'Write');
|
|
335
|
+
if (!approved)
|
|
336
|
+
throw new Error('Blocked clipboard write. Ask the user to approve writing to the clipboard.');
|
|
337
|
+
await writeClipboardText(text);
|
|
338
|
+
emitProgress({ type: 'tool:end', label: 'Clipboard updated' });
|
|
339
|
+
return { copied: true, characters: text.length };
|
|
340
|
+
},
|
|
341
|
+
}),
|
|
342
|
+
takeScreenshot: tool({
|
|
343
|
+
description: 'Capture the current screen to a local PNG file after user approval. Use when the user asks ZilMate to look at the screen or capture current UI state.',
|
|
344
|
+
inputSchema: z.object({}),
|
|
345
|
+
execute: async () => {
|
|
346
|
+
const approved = await confirmDesktopAction('Take screenshot', ['Capture the current primary screen as an image file']);
|
|
347
|
+
if (!approved)
|
|
348
|
+
throw new Error('Blocked screenshot. Ask the user to approve screen capture.');
|
|
349
|
+
const file = await captureScreenshot();
|
|
350
|
+
emitProgress({ type: 'tool:end', label: 'Screenshot captured', detail: file });
|
|
351
|
+
return { file };
|
|
352
|
+
},
|
|
353
|
+
}),
|
|
354
|
+
analyzeScreenshot: tool({
|
|
355
|
+
description: 'Capture or read a screenshot and analyze it with Gemini 3.1 Flash Lite. Gives a detailed description, visible text, UI/error diagnosis, and optional web search context.',
|
|
356
|
+
inputSchema: z.object({
|
|
357
|
+
path: z.string().min(1).optional().describe('Existing screenshot path. If omitted, ZilMate captures the current screen after approval.'),
|
|
358
|
+
prompt: z.string().min(3).optional(),
|
|
359
|
+
searchWeb: z.boolean().optional().describe('If true, search the web using the screenshot analysis for extra context. Requires Tavily.'),
|
|
360
|
+
maxSearchResults: z.number().int().min(1).max(5).optional(),
|
|
361
|
+
}),
|
|
362
|
+
execute: async ({ path: imagePath, prompt, searchWeb: shouldSearchWeb, maxSearchResults }) => {
|
|
363
|
+
let file = imagePath ? path.resolve(imagePath) : '';
|
|
364
|
+
if (!file) {
|
|
365
|
+
const approved = await confirmDesktopAction('Capture and analyze screenshot', ['Capture current screen and send the image to the configured AI Gateway screenshot model']);
|
|
366
|
+
if (!approved)
|
|
367
|
+
throw new Error('Blocked screenshot analysis. Ask the user to approve screen capture.');
|
|
368
|
+
file = await captureScreenshot();
|
|
369
|
+
}
|
|
370
|
+
const analysis = await analyzeImage(file, prompt || defaultScreenshotPrompt);
|
|
371
|
+
let webResults;
|
|
372
|
+
if (shouldSearchWeb) {
|
|
373
|
+
webResults = await searchWeb(`Help explain or troubleshoot this screen: ${analysis.slice(0, 800)}`, maxSearchResults ?? 3);
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
376
|
+
file,
|
|
377
|
+
model: models.screenshotVision,
|
|
378
|
+
analysis,
|
|
379
|
+
...(webResults ? { webResults } : {}),
|
|
380
|
+
};
|
|
381
|
+
},
|
|
382
|
+
}),
|
|
383
|
+
takeCameraPhoto: tool({
|
|
384
|
+
description: 'Open the laptop camera and capture one photo after user approval. Requires ffmpeg on PATH. Use when the user asks ZilMate to look through the camera or take a picture.',
|
|
385
|
+
inputSchema: z.object({
|
|
386
|
+
device: z.string().min(1).optional().describe('Optional ffmpeg camera device. Windows example: video=Integrated Camera; Linux: /dev/video0; macOS: default or device index.'),
|
|
387
|
+
}),
|
|
388
|
+
execute: async ({ device }) => {
|
|
389
|
+
const approved = await confirmDesktopAction('Take camera photo', [
|
|
390
|
+
'Open the laptop camera',
|
|
391
|
+
'Capture one still image',
|
|
392
|
+
...(device ? [`Device: ${device}`] : []),
|
|
393
|
+
]);
|
|
394
|
+
if (!approved)
|
|
395
|
+
throw new Error('Blocked camera capture. Ask the user to approve using the laptop camera.');
|
|
396
|
+
const file = await captureCameraPhoto(device);
|
|
397
|
+
emitProgress({ type: 'tool:end', label: 'Camera photo captured', detail: file });
|
|
398
|
+
return { file };
|
|
399
|
+
},
|
|
400
|
+
}),
|
|
401
|
+
analyzeCameraPhoto: tool({
|
|
402
|
+
description: 'Open the laptop camera, capture one photo, and analyze it with Gemini 3.1 Flash Lite after user approval. Can optionally search the web based on the analysis.',
|
|
403
|
+
inputSchema: z.object({
|
|
404
|
+
device: z.string().min(1).optional(),
|
|
405
|
+
prompt: z.string().min(3).optional(),
|
|
406
|
+
searchWeb: z.boolean().optional(),
|
|
407
|
+
maxSearchResults: z.number().int().min(1).max(5).optional(),
|
|
408
|
+
}),
|
|
409
|
+
execute: async ({ device, prompt, searchWeb: shouldSearchWeb, maxSearchResults }) => {
|
|
410
|
+
const approved = await confirmDesktopAction('Capture and analyze camera photo', [
|
|
411
|
+
'Open the laptop camera',
|
|
412
|
+
'Capture one still image',
|
|
413
|
+
`Send the image to ${models.screenshotVision} for analysis`,
|
|
414
|
+
...(device ? [`Device: ${device}`] : []),
|
|
415
|
+
]);
|
|
416
|
+
if (!approved)
|
|
417
|
+
throw new Error('Blocked camera analysis. Ask the user to approve using the laptop camera.');
|
|
418
|
+
const file = await captureCameraPhoto(device);
|
|
419
|
+
const analysis = await analyzeImage(file, prompt || defaultCameraPrompt, 'camera photo');
|
|
420
|
+
let webResults;
|
|
421
|
+
if (shouldSearchWeb) {
|
|
422
|
+
webResults = await searchWeb(`Help explain or troubleshoot this camera image: ${analysis.slice(0, 800)}`, maxSearchResults ?? 3);
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
file,
|
|
426
|
+
model: models.screenshotVision,
|
|
427
|
+
analysis,
|
|
428
|
+
...(webResults ? { webResults } : {}),
|
|
429
|
+
};
|
|
430
|
+
},
|
|
431
|
+
}),
|
|
432
|
+
};
|
|
433
|
+
//# sourceMappingURL=desktop.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desktop.tool.js","sourceRoot":"","sources":["../../src/tools/desktop.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ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AClE,IAAI,eAAe,EAAE,CAAC;gBACpB,UAAU,GAAG,MAAM,SAAS,CAAC,mDAAmD,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,gBAAgB,IAAI,CAAC,CAAC,CAAC;YACnI,CAAC;YACD,OAAO;gBACL,IAAI;gBACJ,KAAK,EAAE,MAAM,CAAC,gBAAgB;gBAC9B,QAAQ;gBACR,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACtC,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export declare const fileSystemTools: {
|
|
2
|
+
searchFiles: import("ai").Tool<{
|
|
3
|
+
query: string;
|
|
4
|
+
root?: string | undefined;
|
|
5
|
+
includeContent?: boolean | undefined;
|
|
6
|
+
maxDepth?: number | undefined;
|
|
7
|
+
maxResults?: number | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
match: string;
|
|
10
|
+
excerpt: string;
|
|
11
|
+
path: string;
|
|
12
|
+
absolutePath: string;
|
|
13
|
+
type: "file" | "directory";
|
|
14
|
+
size: number;
|
|
15
|
+
modifiedAt: string;
|
|
16
|
+
}[]>;
|
|
17
|
+
readFile: import("ai").Tool<{
|
|
18
|
+
path: string;
|
|
19
|
+
maxBytes?: number | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
path: string;
|
|
22
|
+
size: number;
|
|
23
|
+
modifiedAt: string;
|
|
24
|
+
truncated: boolean;
|
|
25
|
+
content: string;
|
|
26
|
+
}>;
|
|
27
|
+
writeFile: import("ai").Tool<{
|
|
28
|
+
path: string;
|
|
29
|
+
content: string;
|
|
30
|
+
mode?: "append" | "overwrite" | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
path: string;
|
|
33
|
+
bytes: number;
|
|
34
|
+
mode: "append" | "overwrite";
|
|
35
|
+
}>;
|
|
36
|
+
createFolder: import("ai").Tool<{
|
|
37
|
+
path: string;
|
|
38
|
+
}, {
|
|
39
|
+
path: string;
|
|
40
|
+
created: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
moveCopyRename: import("ai").Tool<{
|
|
43
|
+
operation: "move" | "copy" | "rename";
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
overwrite?: boolean | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
operation: "move" | "copy" | "rename";
|
|
49
|
+
from: string;
|
|
50
|
+
to: string;
|
|
51
|
+
}>;
|
|
52
|
+
summarizeDocument: import("ai").Tool<{
|
|
53
|
+
path: string;
|
|
54
|
+
maxBytes?: number | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
characters: number;
|
|
57
|
+
words: number;
|
|
58
|
+
summary: string;
|
|
59
|
+
path: string;
|
|
60
|
+
truncated: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
watchFolderChanges: import("ai").Tool<{
|
|
63
|
+
path?: string | undefined;
|
|
64
|
+
watchName?: string | undefined;
|
|
65
|
+
reset?: boolean | undefined;
|
|
66
|
+
maxDepth?: number | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
watchName: string;
|
|
69
|
+
baselineSaved: boolean;
|
|
70
|
+
added: string[];
|
|
71
|
+
changed: string[];
|
|
72
|
+
removed: string[];
|
|
73
|
+
}>;
|
|
74
|
+
findDuplicateLargeFiles: import("ai").Tool<{
|
|
75
|
+
root?: string | undefined;
|
|
76
|
+
minSizeBytes?: number | undefined;
|
|
77
|
+
maxDepth?: number | undefined;
|
|
78
|
+
maxResults?: number | undefined;
|
|
79
|
+
}, {
|
|
80
|
+
large: {
|
|
81
|
+
path: string;
|
|
82
|
+
absolutePath: string;
|
|
83
|
+
type: "file" | "directory";
|
|
84
|
+
size: number;
|
|
85
|
+
modifiedAt: string;
|
|
86
|
+
}[];
|
|
87
|
+
duplicateSizeGroups: {
|
|
88
|
+
size: number;
|
|
89
|
+
files: string[];
|
|
90
|
+
}[];
|
|
91
|
+
}>;
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=filesystem.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.tool.d.ts","sourceRoot":"","sources":["../../src/tools/filesystem.tool.ts"],"names":[],"mappings":"AAsHA,eAAO,MAAM,eAAe;;;;;;;;;;cAnDG,MAAM;sBAAgB,MAAM;cAAQ,MAAM,GAAG,WAAW;cAAQ,MAAM;oBAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA1F,MAAM;0BAAgB,MAAM;kBAAQ,MAAM,GAAG,WAAW;kBAAQ,MAAM;wBAAc,MAAM;;;;;;;CAmPxH,CAAC"}
|