@aexol/spectral 0.9.193 → 0.9.194

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/desktop-screenshot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EAEX,YAAY,EAEZ,MAAM,iCAAiC,CAAC;AA+dzC,wBAA8B,0BAA0B,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoFzF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/desktop-screenshot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EAEX,YAAY,EAEZ,MAAM,iCAAiC,CAAC;AA6ezC,wBAA8B,0BAA0B,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsFzF"}
@@ -18,11 +18,23 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
18
18
  import { tmpdir } from "node:os";
19
19
  import { join } from "node:path";
20
20
  import { randomUUID } from "node:crypto";
21
+ const SCREENSHOTS_DIR = ".screenshots";
21
22
  function tmpDir() {
22
23
  const d = join(tmpdir(), "spectral-screenshots");
23
24
  mkdirSync(d, { recursive: true });
24
25
  return d;
25
26
  }
27
+ function saveScreenshot(buf, format, cwd) {
28
+ const dir = join(cwd, SCREENSHOTS_DIR);
29
+ mkdirSync(dir, { recursive: true });
30
+ const now = new Date();
31
+ const pad = (n) => String(n).padStart(2, "0");
32
+ const timestamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
33
+ const filename = `screenshot-${timestamp}.${format}`;
34
+ const filepath = join(dir, filename);
35
+ writeFileSync(filepath, buf);
36
+ return filepath;
37
+ }
26
38
  // ===========================================================================
27
39
  // macOS (darwin)
28
40
  // ===========================================================================
@@ -449,6 +461,7 @@ export default async function desktopScreenshotExtension(ext) {
449
461
  name: "desktop_screenshot",
450
462
  label: "Desktop Screenshot",
451
463
  description: "Take a screenshot of the entire desktop or a specific application window. " +
464
+ "Saves the capture to .screenshots/ in the project and returns the saved file path. " +
452
465
  "Returns the image for AI vision analysis. " +
453
466
  "Use 'list_windows' first to see window titles, then pass a matching " +
454
467
  "'windowTitle' to capture only that window.",
@@ -460,18 +473,19 @@ export default async function desktopScreenshotExtension(ext) {
460
473
  windowTitle: { type: "string", description: "Capture a specific window by title (case-insensitive substring match from list_windows). Omit to capture the entire desktop." },
461
474
  },
462
475
  },
463
- async execute(_toolCallId, params) {
476
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
464
477
  const p = params;
465
478
  const format = p.format ?? "png";
466
479
  const mimeType = (format === "jpg" || format === "jpeg") ? "image/jpeg" : "image/png";
467
480
  const makeImageResult = (buf, label) => {
468
481
  const base64 = buf.toString("base64");
482
+ const savedPath = saveScreenshot(buf, format, ctx.cwd);
469
483
  return {
470
484
  content: [
471
- { type: "text", text: `✓ ${label} (${format.toUpperCase()}, ${(buf.length / 1024).toFixed(1)} KB).\nThe image is attached and will be analyzed by the vision model.` },
485
+ { type: "text", text: `✓ ${label} (${format.toUpperCase()}, ${(buf.length / 1024).toFixed(1)} KB).\nSaved: ${savedPath}\nThe image is attached and will be analyzed by the vision model.` },
472
486
  { type: "image", data: base64, mimeType },
473
487
  ],
474
- details: { format, sizeBytes: buf.length, platform: process.platform },
488
+ details: { format, sizeBytes: buf.length, platform: process.platform, savedPath },
475
489
  };
476
490
  };
477
491
  const makeError = (msg) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexol/spectral",
3
- "version": "0.9.193",
3
+ "version": "0.9.194",
4
4
  "description": "AI coding agent for Aexol with relay-based browser access.",
5
5
  "type": "module",
6
6
  "private": false,