@agentorg/computer 0.0.12 → 0.0.13

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/README.md CHANGED
@@ -35,6 +35,8 @@ That prints the computer's `computerID`, its endpoints and its `accessToken`, on
35
35
  | `terminal` | Those, and `exec_command`, `write_stdin`, `list_sessions` |
36
36
  | `none` | No `computer` endpoint; needs `--browser` |
37
37
 
38
+ `read` answers a text file as numbered lines, and a PNG, JPEG, GIF or WebP of up to 3 MiB as the picture itself: an image an MCP client can pass on to a model. The browser's `browser_take_screenshot` answers an image too, of whatever size it comes to: a `fullPage` one of a long page can be many megabytes. A container made by an earlier version keeps the program it was made with, and refuses a picture as a binary file until it is killed and made again.
39
+
38
40
  `about` tells the agent what a person looking at the computer reads. It takes nothing and answers JSON text, `{"rows": [...]}`, each row a `label` and a `value`, with `"path": true` on a value that is a path and `"caution": true` on one to be read as a caution; a row that is neither has neither. The rows come in this order:
39
41
 
40
42
  | `label` | `value` |
@@ -1,4 +1,4 @@
1
- @agentorg/exec 0.0.6 (Apache-2.0)
1
+ @agentorg/exec 0.0.7 (Apache-2.0)
2
2
 
3
3
  Apache License
4
4
  Version 2.0, January 2004
@@ -3268,7 +3268,7 @@ var require_stream = __commonJS({
3268
3268
  };
3269
3269
  duplex._final = function(callback) {
3270
3270
  if (ws.readyState === ws.CONNECTING) {
3271
- ws.once("open", function open4() {
3271
+ ws.once("open", function open5() {
3272
3272
  duplex._final(callback);
3273
3273
  });
3274
3274
  return;
@@ -3289,7 +3289,7 @@ var require_stream = __commonJS({
3289
3289
  };
3290
3290
  duplex._write = function(chunk, encoding, callback) {
3291
3291
  if (ws.readyState === ws.CONNECTING) {
3292
- ws.once("open", function open4() {
3292
+ ws.once("open", function open5() {
3293
3293
  duplex._write(chunk, encoding, callback);
3294
3294
  });
3295
3295
  return;
@@ -28169,12 +28169,13 @@ import { STATUS_CODES, ServerResponse, createServer } from "node:http";
28169
28169
  import { Http2ServerRequest, constants } from "node:http2";
28170
28170
  import { Readable as Readable2 } from "node:stream";
28171
28171
  import { randomBytes as randomBytes3 } from "node:crypto";
28172
- import { lstat as lstat2, open as open2, readdir as readdir2, rename as rename2, rm as rm2, stat as stat2 } from "node:fs/promises";
28172
+ import { lstat as lstat2, open as open3, readdir as readdir2, rename as rename2, rm as rm2, stat as stat2 } from "node:fs/promises";
28173
28173
  import { dirname as dirname2, join as join3 } from "node:path";
28174
28174
  import { randomBytes as randomBytes2 } from "node:crypto";
28175
28175
  import {
28176
28176
  chmod,
28177
28177
  lstat,
28178
+ open as open2,
28178
28179
  readdir,
28179
28180
  readFile,
28180
28181
  realpath,
@@ -34318,7 +34319,7 @@ function bucketFor2(state, inst) {
34318
34319
  return bucket;
34319
34320
  }
34320
34321
  var handoff2;
34321
- var open3 = [];
34322
+ var open4 = [];
34322
34323
  var memo3 = {
34323
34324
  alloc(_inst, payload, empty) {
34324
34325
  const bucket = handoff2;
@@ -34327,7 +34328,7 @@ var memo3 = {
34327
34328
  handoff2 = void 0;
34328
34329
  const entry = { value: empty, issues: null };
34329
34330
  bucket.set(payload.value, entry);
34330
- open3.push(entry);
34331
+ open4.push(entry);
34331
34332
  return empty;
34332
34333
  },
34333
34334
  guard(inst) {
@@ -34398,10 +34399,10 @@ var memo3 = {
34398
34399
  return payload;
34399
34400
  }
34400
34401
  handoff2 = bucket;
34401
- const depth = open3.length;
34402
+ const depth = open4.length;
34402
34403
  const result = base(payload, ctx);
34403
34404
  handoff2 = void 0;
34404
- const entry = open3.length > depth ? open3.pop() : void 0;
34405
+ const entry = open4.length > depth ? open4.pop() : void 0;
34405
34406
  if (result instanceof Promise) {
34406
34407
  return result.then((r) => {
34407
34408
  if (entry)
@@ -66158,6 +66159,21 @@ var MAX_READ_CHARS = 28e3;
66158
66159
  var MAX_LINE_CHARS = 2e3;
66159
66160
  var MAX_ENTRIES = 1e3;
66160
66161
  var MAX_EDIT_BYTES = 8 * 1024 * 1024;
66162
+ var MAX_PICTURE_BYTES = 3 * 1024 * 1024;
66163
+ async function pictureKind(path) {
66164
+ const file2 = await open2(path);
66165
+ try {
66166
+ const { buffer, bytesRead } = await file2.read(Buffer.alloc(12), 0, 12, 0);
66167
+ const start = buffer.toString("latin1", 0, bytesRead);
66168
+ if (start.startsWith("\x89PNG\r\n\n")) return "image/png";
66169
+ if (start.startsWith("\xFF\xD8\xFF")) return "image/jpeg";
66170
+ if (start.startsWith("GIF87a") || start.startsWith("GIF89a")) return "image/gif";
66171
+ if (start.startsWith("RIFF") && start.slice(8) === "WEBP") return "image/webp";
66172
+ return void 0;
66173
+ } finally {
66174
+ await file2.close();
66175
+ }
66176
+ }
66161
66177
  var reason = (error62) => {
66162
66178
  const { code, path } = error62;
66163
66179
  if (code === "ENOENT") return `No such file or folder: ${path}`;
@@ -66213,9 +66229,19 @@ function createFiles(root) {
66213
66229
  return bytes.toString("utf8");
66214
66230
  };
66215
66231
  return {
66216
- /** Numbered lines of a file. */
66232
+ /** Numbered lines of a file, or the file itself where it is a picture. */
66217
66233
  read: (input2) => refusing(async () => {
66218
- const lines = (await text22(await at(input2.path), input2.path)).split("\n");
66234
+ const path = await at(input2.path);
66235
+ const { size } = await aFile(path, input2.path);
66236
+ const mimeType = await pictureKind(path);
66237
+ if (mimeType) {
66238
+ if (size > MAX_PICTURE_BYTES)
66239
+ throw new ExecRefused(
66240
+ `${input2.path} is too large to read as a picture: ${size.toLocaleString("en-US")} bytes, and the most is ${MAX_PICTURE_BYTES.toLocaleString("en-US")}.`
66241
+ );
66242
+ return { mimeType, bytes: await readFile(path) };
66243
+ }
66244
+ const lines = (await text22(path, input2.path)).split("\n");
66219
66245
  const first2 = Math.max(input2.offset ?? 1, 1);
66220
66246
  const shown = lines.slice(first2 - 1, first2 - 1 + (input2.limit ?? DEFAULT_LINES)).map((line, i) => `${first2 + i} ${cut(line, MAX_LINE_CHARS)}`);
66221
66247
  const last = first2 + shown.length - 1;
@@ -66425,7 +66451,7 @@ function createHostFiles(root, level) {
66425
66451
  throw new ExecRefused("A read starts at 0 or later and takes 1 to 1,048,576 bytes.");
66426
66452
  const real = await inside(root, path);
66427
66453
  const found = await aFile(real, path);
66428
- const file2 = await open2(real, "r");
66454
+ const file2 = await open3(real, "r");
66429
66455
  try {
66430
66456
  const bytes = Buffer.alloc(Math.max(0, Math.min(length, found.size - offset)));
66431
66457
  const { bytesRead } = await file2.read(bytes, 0, bytes.length, offset);
@@ -66454,7 +66480,7 @@ function createHostFiles(root, level) {
66454
66480
  if (before?.isDirectory()) throw new ExecRefused(`${path} is a folder.`);
66455
66481
  await stat2(dirname2(target));
66456
66482
  const temporary = join3(dirname2(target), `.agentexec-${randomBytes3(6).toString("hex")}`);
66457
- const file2 = await open2(temporary, "wx");
66483
+ const file2 = await open3(temporary, "wx");
66458
66484
  const discard = async () => {
66459
66485
  await file2.close().catch(() => {
66460
66486
  });
@@ -66527,6 +66553,12 @@ var answering = async (work) => {
66527
66553
  return refused(error62);
66528
66554
  }
66529
66555
  };
66556
+ var pictured = (path, { mimeType, bytes }) => ({
66557
+ content: [
66558
+ { type: "text", text: `${path}: ${mimeType}` },
66559
+ { type: "image", mimeType, data: bytes.toString("base64") }
66560
+ ]
66561
+ });
66530
66562
  var saying = async (work) => {
66531
66563
  try {
66532
66564
  return text(await work());
@@ -66626,7 +66658,7 @@ function createServer2(root, sessions, version22, level, extraTools = []) {
66626
66658
  server.registerTool(
66627
66659
  "read",
66628
66660
  {
66629
- description: "Reads a text file as numbered lines.",
66661
+ description: "Reads a text file as numbered lines, or shows a PNG, JPEG, GIF or WebP of up to 3 MiB as an image; offset and limit are for text.",
66630
66662
  inputSchema: {
66631
66663
  path: external_exports.string().min(1).describe("Inside the workspace; relative to it, or absolute."),
66632
66664
  offset: external_exports.number().int().positive().optional().describe("The first line, from 1."),
@@ -66634,7 +66666,14 @@ function createServer2(root, sessions, version22, level, extraTools = []) {
66634
66666
  },
66635
66667
  annotations: READ_ONLY
66636
66668
  },
66637
- (input2) => saying(() => files.read(input2))
66669
+ async (input2) => {
66670
+ try {
66671
+ const read = await files.read(input2);
66672
+ return typeof read === "string" ? text(read) : pictured(input2.path, read);
66673
+ } catch (error62) {
66674
+ return refused(error62);
66675
+ }
66676
+ }
66638
66677
  );
66639
66678
  server.registerTool(
66640
66679
  "list",
@@ -66677,7 +66716,7 @@ function createServer2(root, sessions, version22, level, extraTools = []) {
66677
66716
  );
66678
66717
  return server;
66679
66718
  }
66680
- var VERSION = "0.0.6";
66719
+ var VERSION = "0.0.7";
66681
66720
  function createAgentExec(options) {
66682
66721
  const root = realpathSync(resolve3(options.workspace));
66683
66722
  const level = options.level ?? "read";
@@ -68093,7 +68132,7 @@ async function forward(url3, authorization, request, response) {
68093
68132
  }
68094
68133
 
68095
68134
  // src/handlers.ts
68096
- var VERSION2 = "0.0.12";
68135
+ var VERSION2 = "0.0.13";
68097
68136
  function createHandlers(computers) {
68098
68137
  return {
68099
68138
  getInfo: async () => ({ version: VERSION2, isolation: computers.isolation }),
@@ -68677,8 +68716,8 @@ async function openLive(session, onMessage) {
68677
68716
  }
68678
68717
  var Terminals = class {
68679
68718
  #open;
68680
- constructor(open4) {
68681
- this.#open = open4;
68719
+ constructor(open5) {
68720
+ this.#open = open5;
68682
68721
  }
68683
68722
  /**
68684
68723
  * Each terminal as it starts, writes and exits: those already there first, each with the end of
@@ -85058,7 +85097,7 @@ var OPENAPI = {
85058
85097
  "openapi": "3.1.0",
85059
85098
  "info": {
85060
85099
  "title": "AgentComputer",
85061
- "version": "0.0.12",
85100
+ "version": "0.0.13",
85062
85101
  "description": "Computers for agents. This file is the source of truth: the HTTP API, the MCP control tools and the SDK are all generated from it. An operation with `x-mcp-tool` is also an MCP tool of that name.",
85063
85102
  "license": {
85064
85103
  "name": "Apache-2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentorg/computer",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Computers for agents, as a service: a terminal, files and a browser over MCP",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "playwright-core": "1.65.0-alpha-2026-10-30"
32
32
  },
33
33
  "devDependencies": {
34
- "@agentorg/exec": "0.0.6",
34
+ "@agentorg/exec": "0.0.7",
35
35
  "@biomejs/biome": "2.6.5",
36
36
  "@modelcontextprotocol/client": "2.4.0",
37
37
  "@modelcontextprotocol/node": "2.1.2",