agentbox-sdk 0.1.1 → 0.1.3
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 +43 -4
- package/dist/{Sandbox-BQX-sWzs.d.ts → Sandbox-CByFJI8X.d.ts} +56 -3
- package/dist/agents/index.d.ts +54 -5
- package/dist/agents/index.js +4 -4
- package/dist/{chunk-G27423WX.js → chunk-4MBB6QHD.js} +2118 -1825
- package/dist/{chunk-2NKMDGYH.js → chunk-GOFJNFAD.js} +1 -1
- package/dist/{chunk-O7HCJXKW.js → chunk-INMA52FV.js} +56 -23
- package/dist/{chunk-X7AWPYDK.js → chunk-LPKKT6YT.js} +351 -47
- package/dist/chunk-ZOWBRUQR.js +476 -0
- package/dist/cli.js +1 -1
- package/dist/enums.d.ts +1 -1
- package/dist/enums.js +1 -1
- package/dist/events/index.d.ts +85 -3
- package/dist/events/index.js +4 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -5
- package/dist/sandboxes/index.d.ts +48 -4
- package/dist/sandboxes/index.js +3 -3
- package/dist/{types-Et22oPap.d.ts → types-B3N-Qo2q.d.ts} +145 -5
- package/images/browser-agent.mjs +3 -3
- package/package.json +5 -2
- package/dist/chunk-7FLLQJ6J.js +0 -185
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentProvider
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GOFJNFAD.js";
|
|
4
4
|
|
|
5
5
|
// src/agents/ports.ts
|
|
6
6
|
var AGENT_RESERVED_PORTS = {
|
|
@@ -104,33 +104,58 @@ var AsyncQueue = class {
|
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
// src/shared/debug.ts
|
|
108
|
+
import createDebug from "debug";
|
|
109
|
+
var ROOT = "agentbox";
|
|
110
|
+
var namespaces = {};
|
|
111
|
+
function debug(namespace) {
|
|
112
|
+
let d = namespaces[namespace];
|
|
113
|
+
if (!d) {
|
|
114
|
+
d = createDebug(`${ROOT}:${namespace}`);
|
|
115
|
+
namespaces[namespace] = d;
|
|
116
|
+
}
|
|
117
|
+
return d;
|
|
118
|
+
}
|
|
119
|
+
var debugAgent = debug("agent");
|
|
120
|
+
var debugClaude = debug("claude");
|
|
121
|
+
var debugCodex = debug("codex");
|
|
122
|
+
var debugOpencode = debug("opencode");
|
|
123
|
+
var debugSetup = debug("setup");
|
|
124
|
+
var debugRuntime = debug("runtime");
|
|
125
|
+
var debugSandbox = debug("sandbox");
|
|
126
|
+
var debugRelay = debug("relay");
|
|
127
|
+
async function time(log, label, fn, extra) {
|
|
128
|
+
if (!log.enabled) {
|
|
129
|
+
return fn();
|
|
130
|
+
}
|
|
131
|
+
const start = Date.now();
|
|
132
|
+
log("\u2192 %s", label);
|
|
133
|
+
try {
|
|
134
|
+
const result = await fn();
|
|
135
|
+
const meta = extra?.(result);
|
|
136
|
+
if (meta) {
|
|
137
|
+
log("\u2190 %s (%dms) %o", label, Date.now() - start, meta);
|
|
138
|
+
} else {
|
|
139
|
+
log("\u2190 %s (%dms)", label, Date.now() - start);
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
} catch (error) {
|
|
143
|
+
log(
|
|
144
|
+
"\u2717 %s (%dms): %s",
|
|
145
|
+
label,
|
|
146
|
+
Date.now() - start,
|
|
147
|
+
error instanceof Error ? error.message : String(error)
|
|
148
|
+
);
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
107
153
|
// src/shared/network.ts
|
|
108
154
|
import net from "net";
|
|
109
155
|
import { setTimeout as sleepTimeout } from "timers/promises";
|
|
110
156
|
async function sleep(ms) {
|
|
111
157
|
await sleepTimeout(ms);
|
|
112
158
|
}
|
|
113
|
-
async function getAvailablePort(host = "127.0.0.1") {
|
|
114
|
-
return new Promise((resolve, reject) => {
|
|
115
|
-
const server = net.createServer();
|
|
116
|
-
server.once("error", reject);
|
|
117
|
-
server.listen(0, host, () => {
|
|
118
|
-
const address = server.address();
|
|
119
|
-
if (!address || typeof address === "string") {
|
|
120
|
-
reject(new Error("Could not determine an available port."));
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const { port } = address;
|
|
124
|
-
server.close((error) => {
|
|
125
|
-
if (error) {
|
|
126
|
-
reject(error);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
resolve(port);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
159
|
async function waitFor(predicate, options) {
|
|
135
160
|
const timeoutMs = options?.timeoutMs ?? 15e3;
|
|
136
161
|
const intervalMs = options?.intervalMs ?? 250;
|
|
@@ -219,8 +244,16 @@ export {
|
|
|
219
244
|
asError,
|
|
220
245
|
suppressUnhandledRejection,
|
|
221
246
|
AsyncQueue,
|
|
247
|
+
debugAgent,
|
|
248
|
+
debugClaude,
|
|
249
|
+
debugCodex,
|
|
250
|
+
debugOpencode,
|
|
251
|
+
debugSetup,
|
|
252
|
+
debugRuntime,
|
|
253
|
+
debugSandbox,
|
|
254
|
+
debugRelay,
|
|
255
|
+
time,
|
|
222
256
|
sleep,
|
|
223
|
-
getAvailablePort,
|
|
224
257
|
waitFor,
|
|
225
258
|
readStreamAsText,
|
|
226
259
|
pipeReadableStream,
|