From f7f978e4a54a90293c55a7e3b29b079298f84b19 Mon Sep 17 00:00:00 2001 From: Maksim Obukhov Date: Thu, 3 Dec 2026 13:45:50 +0100 Subject: [PATCH] feat(js): tag sandbox starts with the e2b-adk-js integration --- .changeset/adk-js-integration-tag.md | 5 +++++ packages/e2b-adk-js/src/workspace.ts | 9 +++++++++ packages/e2b-adk-js/tests/integration.test.ts | 13 +++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 .changeset/adk-js-integration-tag.md create mode 100644 packages/e2b-adk-js/tests/integration.test.ts diff --git a/.changeset/adk-js-integration-tag.md b/.changeset/adk-js-integration-tag.md new file mode 100644 index 0000000..89f2028 --- /dev/null +++ b/.changeset/adk-js-integration-tag.md @@ -0,0 +1,5 @@ +--- +'@e2b/adk': patch +--- + +`@e2b/adk` now identifies itself to E2B as `e2b-adk-js/` in the SDK's User-Agent, so sandbox starts can be attributed to the JS package. diff --git a/packages/e2b-adk-js/src/workspace.ts b/packages/e2b-adk-js/src/workspace.ts index 1a96278..9c36254 100644 --- a/packages/e2b-adk-js/src/workspace.ts +++ b/packages/e2b-adk-js/src/workspace.ts @@ -1,5 +1,7 @@ +import { createRequire } from 'node:module' import { CommandExitError, + ConnectionConfig, InvalidArgumentError, NotFoundError, Sandbox, @@ -19,6 +21,13 @@ import { WorkspaceExpiredError, } from './results.js' +// Attributes sandbox starts to this package in E2B's User-Agent. The tag is +// process-wide and lives on the class this module creates sandboxes with. +const { version } = createRequire(import.meta.url)('../package.json') as { + version: string +} +ConnectionConfig.setIntegration(`e2b-adk-js/${version}`) + /** Upper bound for cleanup and recovery calls, independent of operation limits. */ const RECOVERY_WAIT_MS = 30_000 /** Lets our own deadline fire before the SDK's, so one path handles both. */ diff --git a/packages/e2b-adk-js/tests/integration.test.ts b/packages/e2b-adk-js/tests/integration.test.ts new file mode 100644 index 0000000..9c8a5e0 --- /dev/null +++ b/packages/e2b-adk-js/tests/integration.test.ts @@ -0,0 +1,13 @@ +import { describe, expect, it } from 'vitest' +import { ConnectionConfig } from '@e2b/code-interpreter' +import packageJson from '../package.json' with { type: 'json' } +import '../src/workspace.js' + +describe('integration attribution', () => { + it('tags the User-Agent with e2b-adk-js/', () => { + const userAgent = new ConnectionConfig().headers?.['User-Agent'] ?? '' + expect(userAgent.split(/\s+/)).toContain( + `e2b-adk-js/${packageJson.version}`, + ) + }) +})