Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/adk-js-integration-tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@e2b/adk': patch
---

`@e2b/adk` now identifies itself to E2B as `e2b-adk-js/<version>` in the SDK's User-Agent, so sandbox starts can be attributed to the JS package.
9 changes: 9 additions & 0 deletions packages/e2b-adk-js/src/workspace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { createRequire } from 'node:module'
import {
CommandExitError,
ConnectionConfig,
InvalidArgumentError,
NotFoundError,
Sandbox,
Expand All @@ -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. */
Expand Down
13 changes: 13 additions & 0 deletions packages/e2b-adk-js/tests/integration.test.ts
Original file line number Diff line number Diff line change
@@ -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/<version>', () => {
const userAgent = new ConnectionConfig().headers?.['User-Agent'] ?? ''
expect(userAgent.split(/\s+/)).toContain(
`e2b-adk-js/${packageJson.version}`,
)
})
})
Loading