@agentorg/computer 0.0.13 → 0.0.14
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 +1 -1
- package/dist/agentcomputer.js +21 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ That prints the computer's `computerID`, its endpoints and its `accessToken`, on
|
|
|
53
53
|
- **The last three** are a reading of its load taken over half a second when it is asked, in the same way the `load` surface reads. They come together, or not at all where a reading can't be taken.
|
|
54
54
|
- **Not every computer has it.** One with no `computer` endpoint has no `about`. One in a container made by an earlier version keeps the program it was made with: `about` is listed among its tools and isn't there until it is killed and made again.
|
|
55
55
|
|
|
56
|
-
The file tools stay inside the workspace. That's a check, not a boundary. Below `terminal`, the browser's `browser_run_code_unsafe` tool is hidden and refused, because it would otherwise be a terminal. The service enforces all of this, whatever the client does.
|
|
56
|
+
The file tools stay inside the workspace. That's a check, not a boundary. Below `terminal`, the browser's `browser_run_code_unsafe` tool is hidden and refused, because it would otherwise be a terminal. The browser's endpoint takes one JSON-RPC request in each POST, as a JSON object, and refuses anything else with 400, a batch among them: it checks each request before passing it on, and passes on only what it read. The service enforces all of this, whatever the client does.
|
|
57
57
|
|
|
58
58
|
`--browser` drives the Google Chrome installed on the machine, in a profile of the computer's own. `serve --browser-name` and `--browser-path` choose another. The browser has no debug port: a small host process starts it and shares it on a Unix socket in a folder only its user can enter, which the agent's tools and the live view both use. It lives as long as its computer does: a client that ends its session or goes away leaves the browser and its pages as they are, and the agent's `browser_close` is refused. Only an agent with `--access terminal` can stop it, with `browser_run_code_unsafe` or from its terminal.
|
|
59
59
|
|
package/dist/agentcomputer.js
CHANGED
|
@@ -27961,6 +27961,7 @@ var RUNS_CODE = "browser_run_code_unsafe";
|
|
|
27961
27961
|
var MAX_BODY = 8 * 1024 * 1024;
|
|
27962
27962
|
var START_MS = 3e4;
|
|
27963
27963
|
var STOP_MS = 2e3;
|
|
27964
|
+
var ONE_REQUEST = "A body is one JSON-RPC request, as a JSON object: send each request in its own POST.";
|
|
27964
27965
|
var FORWARDED = [
|
|
27965
27966
|
"accept",
|
|
27966
27967
|
"content-type",
|
|
@@ -28098,18 +28099,29 @@ var Browser = class {
|
|
|
28098
28099
|
chunks.push(chunk);
|
|
28099
28100
|
}
|
|
28100
28101
|
const body = Buffer.concat(chunks);
|
|
28101
|
-
let message
|
|
28102
|
+
let message;
|
|
28102
28103
|
try {
|
|
28103
|
-
|
|
28104
|
+
const read = body.length > 0 ? JSON.parse(body.toString("utf8")) : void 0;
|
|
28105
|
+
if (typeof read === "object" && read !== null && !Array.isArray(read)) message = read;
|
|
28104
28106
|
} catch {
|
|
28105
28107
|
}
|
|
28106
|
-
|
|
28108
|
+
if (body.length > 0 && !message) {
|
|
28109
|
+
response.writeHead(400, { "Content-Type": "application/json" });
|
|
28110
|
+
return void response.end(
|
|
28111
|
+
JSON.stringify({
|
|
28112
|
+
jsonrpc: "2.0",
|
|
28113
|
+
id: null,
|
|
28114
|
+
error: { code: -32600, message: ONE_REQUEST }
|
|
28115
|
+
})
|
|
28116
|
+
);
|
|
28117
|
+
}
|
|
28118
|
+
const tool = message?.method === "tools/call" ? String(message.params?.name) : void 0;
|
|
28107
28119
|
if (tool && this.#hidden.has(tool)) {
|
|
28108
28120
|
response.writeHead(200, { "Content-Type": "application/json" });
|
|
28109
28121
|
return void response.end(
|
|
28110
28122
|
JSON.stringify({
|
|
28111
28123
|
jsonrpc: "2.0",
|
|
28112
|
-
id: message
|
|
28124
|
+
id: message?.id ?? null,
|
|
28113
28125
|
error: { code: -32602, message: `Unknown tool: ${tool}` }
|
|
28114
28126
|
})
|
|
28115
28127
|
);
|
|
@@ -28134,12 +28146,13 @@ var Browser = class {
|
|
|
28134
28146
|
}).then((answer) => answer.text()).catch(() => {
|
|
28135
28147
|
});
|
|
28136
28148
|
if (tool === "browser_file_upload") this.gate?.agentAnsweredChooser();
|
|
28149
|
+
if (message) headers["content-type"] = "application/json";
|
|
28137
28150
|
const upstream = await fetch(`${origin}/mcp`, {
|
|
28138
28151
|
method: request.method,
|
|
28139
28152
|
headers,
|
|
28140
|
-
...
|
|
28153
|
+
...message ? { body: JSON.stringify(message) } : {}
|
|
28141
28154
|
});
|
|
28142
|
-
if (message
|
|
28155
|
+
if (message?.method === "tools/list" && this.#hidden.size > 0) {
|
|
28143
28156
|
const text3 = withoutHidden(await upstream.text(), this.#hidden);
|
|
28144
28157
|
return sendAnswer(new Response(text3, upstream), response);
|
|
28145
28158
|
}
|
|
@@ -68132,7 +68145,7 @@ async function forward(url3, authorization, request, response) {
|
|
|
68132
68145
|
}
|
|
68133
68146
|
|
|
68134
68147
|
// src/handlers.ts
|
|
68135
|
-
var VERSION2 = "0.0.
|
|
68148
|
+
var VERSION2 = "0.0.14";
|
|
68136
68149
|
function createHandlers(computers) {
|
|
68137
68150
|
return {
|
|
68138
68151
|
getInfo: async () => ({ version: VERSION2, isolation: computers.isolation }),
|
|
@@ -85097,7 +85110,7 @@ var OPENAPI = {
|
|
|
85097
85110
|
"openapi": "3.1.0",
|
|
85098
85111
|
"info": {
|
|
85099
85112
|
"title": "AgentComputer",
|
|
85100
|
-
"version": "0.0.
|
|
85113
|
+
"version": "0.0.14",
|
|
85101
85114
|
"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.",
|
|
85102
85115
|
"license": {
|
|
85103
85116
|
"name": "Apache-2.0",
|