Skip to content

Commit 6c89565

Browse files
shrey150claude
andauthored
feat(cli): add browse-cli metadata to Browserbase sessions (#1890)
## Summary - Adds `userMetadata: { "browse-cli": "true" }` to every Browserbase session created through the browse CLI - Enables usage attribution to distinguish CLI-originated sessions from SDK-originated ones ## Test plan - [x] Run `browse open https://example.com` in Browserbase mode and verify the session has `browse-cli: true` in its metadata - [x] Verify local mode is unaffected 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds `userMetadata: { "browse-cli": "true" }` to `browserbaseSessionCreateParams` for sessions started by `@browserbasehq/browse-cli` in Browserbase mode, enabling usage attribution and distinguishing CLI vs SDK sessions. Satisfies STG-1678; local mode is unaffected. <sup>Written for commit 58c10fd. Summary will update on new commits. <a href="https://cubic.dev/pr/browserbase/stagehand/pull/1890">Review in cubic</a></sup> <!-- End of auto-generated description by cubic. --> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a98801a commit 6c89565

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

.changeset/browse-cli-metadata.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/browse-cli": patch
3+
---
4+
5+
Add browse-cli metadata to Browserbase sessions created through the CLI

packages/cli/src/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,16 @@ async function runDaemon(session: string, headless: boolean): Promise<void> {
346346
...(useBrowserbase
347347
? {
348348
disableAPI: true,
349-
...(contextConfig
350-
? {
351-
browserbaseSessionCreateParams: {
349+
browserbaseSessionCreateParams: {
350+
userMetadata: { "browse-cli": "true" },
351+
...(contextConfig
352+
? {
352353
browserSettings: {
353354
context: contextConfig,
354355
},
355-
},
356-
}
357-
: {}),
356+
}
357+
: {}),
358+
},
358359
}
359360
: {
360361
localBrowserLaunchOptions: {

0 commit comments

Comments
 (0)