agent-neckbeard 1.0.6 → 1.0.8

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.

Potentially problematic release.


This version of agent-neckbeard might be problematic. Click here for more details.

package/dist/index.cjs CHANGED
@@ -195,10 +195,6 @@ var Agent = class {
195
195
  const esbuild = await getEsbuild();
196
196
  const { Sandbox } = await getE2b();
197
197
  const collectedExternals = /* @__PURE__ */ new Set();
198
- const mustBeExternal = [
199
- /^@anthropic-ai\/claude-agent-sdk/
200
- // Spawns cli.js as child process
201
- ];
202
198
  const result = await esbuild.build({
203
199
  entryPoints: [this._sourceFile],
204
200
  bundle: true,
@@ -238,20 +234,15 @@ var __dirname = __neckbeard_dirname(__filename);
238
234
  `,
239
235
  loader: "js"
240
236
  }));
241
- build.onResolve({ filter: /.*/ }, (args) => {
242
- if (args.path.startsWith(".") || args.path.startsWith("/") || args.path.startsWith("node:")) {
237
+ build.onResolve({ filter: /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/ }, (args) => {
238
+ if (args.path.startsWith("node:")) {
243
239
  return null;
244
240
  }
245
- for (const pattern of mustBeExternal) {
246
- if (pattern.test(args.path)) {
247
- const match = args.path.match(/^(@[^/]+\/[^/]+|[^/]+)/);
248
- if (match) {
249
- collectedExternals.add(match[1]);
250
- }
251
- return { external: true };
252
- }
241
+ const match = args.path.match(/^(@[^/]+\/[^/]+|[^/]+)/);
242
+ if (match) {
243
+ collectedExternals.add(match[1]);
253
244
  }
254
- return null;
245
+ return { external: true };
255
246
  });
256
247
  }
257
248
  }]
@@ -410,18 +401,52 @@ try {
410
401
  apiKey: e2bApiKey
411
402
  });
412
403
  await sandbox.files.write(SANDBOX_PATHS.taskJson, JSON.stringify({ input: validatedInput, executionId }));
404
+ let capturedStdout = "";
405
+ let capturedStderr = "";
413
406
  const result = await sandbox.commands.run(`node ${SANDBOX_PATHS.runnerModule}`, {
414
407
  timeoutMs: this.maxDuration * 1e3,
415
408
  envs: {
416
409
  ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ?? ""
410
+ },
411
+ onStdout: (data) => {
412
+ capturedStdout += data;
413
+ },
414
+ onStderr: (data) => {
415
+ capturedStderr += data;
417
416
  }
418
417
  });
419
418
  if (result.exitCode !== 0) {
420
- return { ok: false, executionId, error: new ExecutionError(`Agent failed: ${result.stderr}`) };
419
+ let resultError = "";
420
+ try {
421
+ const resultJson = await sandbox.files.read(SANDBOX_PATHS.resultJson);
422
+ const parsed = JSON.parse(resultJson);
423
+ if (!parsed.success && parsed.error) {
424
+ resultError = `
425
+ Result: ${parsed.error.message}`;
426
+ if (parsed.error.stack) resultError += `
427
+ Stack: ${parsed.error.stack}`;
428
+ }
429
+ } catch {
430
+ }
431
+ const errorDetails = [
432
+ `Agent failed with exit code ${result.exitCode}`,
433
+ result.stderr ? `Stderr: ${result.stderr}` : "",
434
+ capturedStderr ? `Captured stderr: ${capturedStderr}` : "",
435
+ capturedStdout ? `Stdout: ${capturedStdout}` : "",
436
+ resultError
437
+ ].filter(Boolean).join("\n");
438
+ return { ok: false, executionId, error: new ExecutionError(errorDetails) };
421
439
  }
422
440
  const output = JSON.parse(await sandbox.files.read(SANDBOX_PATHS.resultJson));
423
441
  if (!output.success) {
424
- const err = new ExecutionError(output.error.message);
442
+ const errorDetails = [
443
+ output.error.message,
444
+ capturedStderr ? `
445
+ Captured stderr: ${capturedStderr}` : "",
446
+ capturedStdout ? `
447
+ Stdout: ${capturedStdout}` : ""
448
+ ].filter(Boolean).join("");
449
+ const err = new ExecutionError(errorDetails);
425
450
  err.stack = output.error.stack;
426
451
  return { ok: false, executionId, error: err };
427
452
  }
package/dist/index.js CHANGED
@@ -155,10 +155,6 @@ var Agent = class {
155
155
  const esbuild = await getEsbuild();
156
156
  const { Sandbox } = await getE2b();
157
157
  const collectedExternals = /* @__PURE__ */ new Set();
158
- const mustBeExternal = [
159
- /^@anthropic-ai\/claude-agent-sdk/
160
- // Spawns cli.js as child process
161
- ];
162
158
  const result = await esbuild.build({
163
159
  entryPoints: [this._sourceFile],
164
160
  bundle: true,
@@ -198,20 +194,15 @@ var __dirname = __neckbeard_dirname(__filename);
198
194
  `,
199
195
  loader: "js"
200
196
  }));
201
- build.onResolve({ filter: /.*/ }, (args) => {
202
- if (args.path.startsWith(".") || args.path.startsWith("/") || args.path.startsWith("node:")) {
197
+ build.onResolve({ filter: /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/ }, (args) => {
198
+ if (args.path.startsWith("node:")) {
203
199
  return null;
204
200
  }
205
- for (const pattern of mustBeExternal) {
206
- if (pattern.test(args.path)) {
207
- const match = args.path.match(/^(@[^/]+\/[^/]+|[^/]+)/);
208
- if (match) {
209
- collectedExternals.add(match[1]);
210
- }
211
- return { external: true };
212
- }
201
+ const match = args.path.match(/^(@[^/]+\/[^/]+|[^/]+)/);
202
+ if (match) {
203
+ collectedExternals.add(match[1]);
213
204
  }
214
- return null;
205
+ return { external: true };
215
206
  });
216
207
  }
217
208
  }]
@@ -370,18 +361,52 @@ try {
370
361
  apiKey: e2bApiKey
371
362
  });
372
363
  await sandbox.files.write(SANDBOX_PATHS.taskJson, JSON.stringify({ input: validatedInput, executionId }));
364
+ let capturedStdout = "";
365
+ let capturedStderr = "";
373
366
  const result = await sandbox.commands.run(`node ${SANDBOX_PATHS.runnerModule}`, {
374
367
  timeoutMs: this.maxDuration * 1e3,
375
368
  envs: {
376
369
  ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ?? ""
370
+ },
371
+ onStdout: (data) => {
372
+ capturedStdout += data;
373
+ },
374
+ onStderr: (data) => {
375
+ capturedStderr += data;
377
376
  }
378
377
  });
379
378
  if (result.exitCode !== 0) {
380
- return { ok: false, executionId, error: new ExecutionError(`Agent failed: ${result.stderr}`) };
379
+ let resultError = "";
380
+ try {
381
+ const resultJson = await sandbox.files.read(SANDBOX_PATHS.resultJson);
382
+ const parsed = JSON.parse(resultJson);
383
+ if (!parsed.success && parsed.error) {
384
+ resultError = `
385
+ Result: ${parsed.error.message}`;
386
+ if (parsed.error.stack) resultError += `
387
+ Stack: ${parsed.error.stack}`;
388
+ }
389
+ } catch {
390
+ }
391
+ const errorDetails = [
392
+ `Agent failed with exit code ${result.exitCode}`,
393
+ result.stderr ? `Stderr: ${result.stderr}` : "",
394
+ capturedStderr ? `Captured stderr: ${capturedStderr}` : "",
395
+ capturedStdout ? `Stdout: ${capturedStdout}` : "",
396
+ resultError
397
+ ].filter(Boolean).join("\n");
398
+ return { ok: false, executionId, error: new ExecutionError(errorDetails) };
381
399
  }
382
400
  const output = JSON.parse(await sandbox.files.read(SANDBOX_PATHS.resultJson));
383
401
  if (!output.success) {
384
- const err = new ExecutionError(output.error.message);
402
+ const errorDetails = [
403
+ output.error.message,
404
+ capturedStderr ? `
405
+ Captured stderr: ${capturedStderr}` : "",
406
+ capturedStdout ? `
407
+ Stdout: ${capturedStdout}` : ""
408
+ ].filter(Boolean).join("");
409
+ const err = new ExecutionError(errorDetails);
385
410
  err.stack = output.error.stack;
386
411
  return { ok: false, executionId, error: err };
387
412
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-neckbeard",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Deploy AI agents to E2B sandboxes",
5
5
  "type": "module",
6
6
  "exports": {