@agentorg/computer 0.0.17 → 0.0.18
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/dist/agentcomputer.js +8 -7
- package/package.json +1 -1
package/dist/agentcomputer.js
CHANGED
|
@@ -67031,6 +67031,7 @@ var BrowserLive = class {
|
|
|
67031
67031
|
} catch {
|
|
67032
67032
|
return;
|
|
67033
67033
|
}
|
|
67034
|
+
if (typeof message !== "object" || message === null) return;
|
|
67034
67035
|
this.#input(ws, viewer, message);
|
|
67035
67036
|
});
|
|
67036
67037
|
this.#begin().then(
|
|
@@ -67958,7 +67959,7 @@ var ProcessRuntime = class {
|
|
|
67958
67959
|
};
|
|
67959
67960
|
|
|
67960
67961
|
// src/handlers.ts
|
|
67961
|
-
var VERSION2 = "0.0.
|
|
67962
|
+
var VERSION2 = "0.0.18";
|
|
67962
67963
|
function createHandlers(computers) {
|
|
67963
67964
|
return {
|
|
67964
67965
|
getInfo: async () => ({
|
|
@@ -68039,9 +68040,9 @@ async function serveInside(options) {
|
|
|
68039
68040
|
server.on("upgrade", (request, socket, head) => {
|
|
68040
68041
|
socket.on("error", () => socket.destroy());
|
|
68041
68042
|
const given = /^Bearer (\S+)$/.exec(request.headers.authorization ?? "")?.[1];
|
|
68042
|
-
const url3 =
|
|
68043
|
-
const surface = /^\/live\/(terminal|files|browser|load)$/.exec(url3
|
|
68044
|
-
const mode = url3
|
|
68043
|
+
const url3 = URL.parse(request.url ?? "/", "http://localhost");
|
|
68044
|
+
const surface = /^\/live\/(terminal|files|browser|load)$/.exec(url3?.pathname ?? "")?.[1];
|
|
68045
|
+
const mode = url3?.searchParams.get("mode");
|
|
68045
68046
|
if (!given || !sameToken(given, digest) || !surface || mode !== "watch" && mode !== "operate")
|
|
68046
68047
|
return void socket.end("HTTP/1.1 401 Unauthorized\r\nConnection: close\r\n\r\n");
|
|
68047
68048
|
running2.then((computer) => computer.openLive(surface, mode, request, socket, head)).catch(() => socket.destroy());
|
|
@@ -85396,7 +85397,7 @@ var OPENAPI = {
|
|
|
85396
85397
|
"openapi": "3.1.0",
|
|
85397
85398
|
"info": {
|
|
85398
85399
|
"title": "AgentComputer",
|
|
85399
|
-
"version": "0.0.
|
|
85400
|
+
"version": "0.0.18",
|
|
85400
85401
|
"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.",
|
|
85401
85402
|
"license": {
|
|
85402
85403
|
"name": "Apache-2.0",
|
|
@@ -88577,13 +88578,13 @@ Connection: close\r
|
|
|
88577
88578
|
${JSON.stringify({ code: status, message })}
|
|
88578
88579
|
`
|
|
88579
88580
|
);
|
|
88580
|
-
const
|
|
88581
|
+
const pathname = URL.parse(request.url ?? "/", "http://localhost")?.pathname ?? "";
|
|
88581
88582
|
const ticket = /^\/v1\/live\/([^/]+)$/.exec(pathname)?.[1];
|
|
88582
88583
|
if (!ticket) return refuse(404, "Not found.");
|
|
88583
88584
|
const origin = request.headers.origin;
|
|
88584
88585
|
if (origin !== void 0 && !allowed.has(origin))
|
|
88585
88586
|
return refuse(403, `A live session isn't opened from ${origin.slice(0, 200)}.`);
|
|
88586
|
-
computers.openLive(
|
|
88587
|
+
computers.openLive(ticket, request, socket, head).catch((error62) => {
|
|
88587
88588
|
if (error62 instanceof ApiError) refuse(error62.status, error62.message);
|
|
88588
88589
|
else socket.destroy();
|
|
88589
88590
|
});
|