agentbox-sdk 0.1.1 → 0.1.301

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,7 +1,7 @@
1
1
  // src/enums.ts
2
2
  var AgentProvider = {
3
3
  ClaudeCode: "claude-code",
4
- OpenCode: "opencode",
4
+ OpenCode: "open-code",
5
5
  Codex: "codex"
6
6
  };
7
7
  var SandboxProvider = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentProvider
3
- } from "./chunk-2NKMDGYH.js";
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,