Skip to content

STG-1746 Add SEA --version flag - #2167

Merged
monadoid merged 1 commit into
mainfrom
STG-1746
May 28, 2026
Merged

STG-1746 Add SEA --version flag#2167
monadoid merged 1 commit into
mainfrom
STG-1746

Conversation

@monadoid

@monadoid monadoid commented May 26, 2026

Copy link
Copy Markdown
Contributor

why

The SEA binary needs a lightweight way to report the commit and timestamp it was built from.

what changed

Added a --version path that prints build metadata baked into the SEA binary during build.

@changeset-bot

changeset-bot Bot commented May 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 692903e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@browserbasehq/stagehand-server-v3 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@monadoid
monadoid marked this pull request as ready for review May 26, 2026 17:27

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant User
    participant SEA as SEA Binary Entry
    participant Core as Stagehand Core
    participant Server as Stagehand Server

    Note over SEA: Build-time: Commit metadata injected via esbuild 'define'

    User->>SEA: Run binary (e.g., ./stagehand --version)
    
    SEA->>SEA: NEW: Normalize process.argv

    alt NEW: Includes --version
        SEA-->>User: NEW: Output baked-in commit SHA & timestamp
        Note right of SEA: Process exits (0)
    else Standard Execution
        SEA->>Core: CHANGED: Lazy/Dynamic import package
        
        alt Supervisor Mode (--supervisor)
            SEA->>Core: Run shutdown supervisor
        else Server Mode
            SEA->>SEA: Set BROWSERBASE_FLOW_LOGS=1
            SEA->>Server: CHANGED: Lazy/Dynamic import server.js
            Server->>Server: Initialize and start server
        end
    end

    Note over SEA,Server: NEW: Turbo cache disabled for builds to ensure fresh metadata injection
Loading

Re-trigger cubic

Comment thread turbo.json Outdated
@monadoid
monadoid marked this pull request as draft May 26, 2026 17:55
@monadoid
monadoid marked this pull request as ready for review May 26, 2026 17:57

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant Build as Build Script
    participant Git as Git
    participant CI as CI Environment
    participant Bundle as Bundle Generator
    participant SEA as SEA Binary

    Note over Build,SEA: SEA Binary Build & Version Flag Flow

    Build->>Git: execFileSync(["rev-parse", "HEAD"])
    Git-->>Build: commit hash

    Build->>Git: execFileSync(["show", "-s", "--format=%cI", commit])
    Git-->>Build: ISO 8601 timestamp

    alt CI build (GITHUB_SHA set)
        Build->>CI: read GITHUB_SHA env var
        CI-->>Build: commit SHA
    else Local build (no GITHUB_SHA)
        Build->>Git: fallback to git rev-parse
    end

    Build->>Build: construct seaVersion string<br/>(commit + timestamp)
    Build->>Build: define __STAGEHAND_SERVER_VERSION__

    Build->>Bundle: esbuild build with define: seaBuildDefine
    Bundle->>Bundle: inject versionOutput into SEA template
    Bundle-->>Build: bundled CJS file

    Build->>Build: read bundle, create single-executable-app blob
    Build->>Build: inject versionOutput variable

    Note over Build: SEA binary contains versionOutput

    User->>SEA: ./binary --version
    SEA->>SEA: parse process.argv
    alt --version flag present
        SEA->>SEA: log versionOutput
        SEA-->>User: commit + timestamp
        SEA->>SEA: process.exit(0)
    else --supervisor flag
        SEA->>SEA: dynamic import stagehand
        SEA->>SEA: run supervisor
    else no flags
        SEA->>SEA: dynamic import stagehand
        SEA->>SEA: dynamic import server.js
        SEA->>SEA: start Stagehand server
    end
Loading

Re-trigger cubic

@monadoid
monadoid marked this pull request as draft May 26, 2026 18:03
@monadoid
monadoid marked this pull request as ready for review May 27, 2026 08:42

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant Builder as Build Script<br/>(build-sea.ts)
    participant Git as Git Repo
    participant ESBuild as ESBuild Bundler
    participant SEA as SEA Binary<br/>(stagehand-server)
    participant Node as Node.js Runtime

    Note over Builder,Node: SEA Build Pipeline (build-sea.ts)

    Builder->>Git: execFileSync(["rev-parse", "HEAD"])
    Git-->>Builder: buildCommit (SHA)
    Builder->>Git: execFileSync(["show", "-s", "--format=%cI", buildCommit])
    Git-->>Builder: timestamp (ISO 8601)
    Builder->>Builder: Construct seaVersion string: "commit: {SHA}\ntimestamp: {ISO}"
    Builder->>Builder: Define esbuild define: __STAGEHAND_SERVER_VERSION__ = seaVersion

    alt CJS Bundle Build
        Builder->>ESBuild: build({ define: { __STAGEHAND_SERVER_VERSION__ } })
        ESBuild-->>Builder: CJS bundle with replaced constant
    else ESM Bundle Build
        Builder->>ESBuild: build({ define: { __STAGEHAND_SERVER_VERSION__ } })
        ESBuild-->>Builder: ESM bundle with replaced constant
    end

    Builder->>Builder: Create SEA injection script
    Note over Builder: Injects versionOutput = seaVersion as string literal

    Note over Builder,SEA: Runtime — SEA Binary Execution

    User->>SEA: stagehand-server --version
    SEA->>Node: process.argv parsing
    SEA->>SEA: Check if --version in argv
    alt --version flag present
        SEA->>Node: console.log(__STAGEHAND_SERVER_VERSION__)
        Note over SEA: Outputs previously baked-in build metadata
        SEA->>Node: process.exit(0)
    else --version flag absent
        SEA->>Node: import("@browserbasehq/stagehand")
        Node-->>SEA: Stagehand module
        SEA->>Node: __internalMaybeRunShutdownSupervisorFromArgv(argv)
        alt Supervisor mode
            SEA->>Node: Return early (supervisor started elsewhere)
        else Normal server start
            SEA->>Node: process.env.BROWSERBASE_FLOW_LOGS = "1"
            SEA->>Node: import("./server.js")
            Node-->>SEA: Stagehand server started
        end
    end
Loading

Re-trigger cubic

@monadoid
monadoid merged commit ce21468 into main May 28, 2026
47 checks passed
seanmcguire12 pushed a commit that referenced this pull request Jun 3, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @browserbasehq/stagehand@3.5.0

### Minor Changes

- [#2149](#2149)
[`6e75725`](6e75725)
Thanks [@miguelg719](https://github.com/miguelg719)! - Added a
`screenshot` option to `extract()` that sends the current viewport
screenshot with the a11y tree for extraction.

- [#2127](#2127)
[`78bcde8`](78bcde8)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Add
`ignoreDefaultArgs` option to selectively remove chrome-launcher's
built-in default flags (e.g. `--disable-extensions`) when running
locally

- [#2160](#2160)
[`49575d6`](49575d6)
Thanks [@monadoid](https://github.com/monadoid)! - Forward constructor
and request model configuration when initializing API-backed sessions.

- [#2171](#2171)
[`dc1445d`](dc1445d)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add native
clipboard API

### Patch Changes

- [#2146](#2146)
[`3a53ed4`](3a53ed4)
Thanks [@shriyatheunicorn](https://github.com/shriyatheunicorn)! - Pass
local browser launch options through when attaching over CDP so explicit
viewport settings are respected.

- [#2107](#2107)
[`8fc16d2`](8fc16d2)
Thanks [@miguelg719](https://github.com/miguelg719)! - Fix Anthropic CUA
`triple_click` action mapping.

- [#2118](#2118)
[`3e95a87`](3e95a87)
Thanks [@monadoid](https://github.com/monadoid)! - Add Vertex auth
parameters to the core and server API schemas.

- [#2126](#2126)
[`ebbdcd3`](ebbdcd3)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix(core):
import ToolSet from ai public export

- [#2120](#2120)
[`12703a6`](12703a6)
Thanks [@miguelg719](https://github.com/miguelg719)! - Fix
structuredOutputMode for newer Anthropic models

- [#2170](#2170)
[`1db5f1c`](1db5f1c)
Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - Add Claude Opus
4.8 to the supported CUA model whitelist.

- [#2116](#2116)
[`cb586a1`](cb586a1)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - include
"[selected]" or "[checked]" state in snapshot

- [#2129](#2129)
[`765861c`](765861c)
Thanks [@miguelg719](https://github.com/miguelg719)! - Add a
backend-selectable v3 evaluator facade while preserving the legacy
evaluator path.

- [#2157](#2157)
[`2cd60a3`](2cd60a3)
Thanks [@miguelg719](https://github.com/miguelg719)! - Add verifier
trajectory, rubric, and evaluation-result types with normalized public
naming.

- [#2131](#2131)
[`e102a89`](e102a89)
Thanks [@miguelg719](https://github.com/miguelg719)! - Capture verifier
trajectory evidence from agent evidence callbacks for offline scoring.

## @browserbasehq/browse-cli@0.6.1

### Patch Changes

- Updated dependencies
\[[`3a53ed4`](3a53ed4),
[`6e75725`](6e75725),
[`8fc16d2`](8fc16d2),
[`78bcde8`](78bcde8),
[`3e95a87`](3e95a87),
[`ebbdcd3`](ebbdcd3),
[`12703a6`](12703a6),
[`1db5f1c`](1db5f1c),
[`cb586a1`](cb586a1),
[`765861c`](765861c),
[`2cd60a3`](2cd60a3),
[`e102a89`](e102a89),
[`49575d6`](49575d6),
[`dc1445d`](dc1445d)]:
    -   @browserbasehq/stagehand@3.5.0

## @browserbasehq/stagehand-server-v3@3.7.0

### Minor Changes

- [#2160](#2160)
[`49575d6`](49575d6)
Thanks [@monadoid](https://github.com/monadoid)! - Forward constructor
and request model configuration when initializing API-backed sessions.

### Patch Changes

- [#2118](#2118)
[`3e95a87`](3e95a87)
Thanks [@monadoid](https://github.com/monadoid)! - Add Vertex auth
parameters to the core and server API schemas.

- [#2167](#2167)
[`ce21468`](ce21468)
Thanks [@monadoid](https://github.com/monadoid)! - Add SEA binary
--version build metadata output.

- Updated dependencies
\[[`3a53ed4`](3a53ed4),
[`6e75725`](6e75725),
[`8fc16d2`](8fc16d2),
[`78bcde8`](78bcde8),
[`3e95a87`](3e95a87),
[`ebbdcd3`](ebbdcd3),
[`12703a6`](12703a6),
[`1db5f1c`](1db5f1c),
[`cb586a1`](cb586a1),
[`765861c`](765861c),
[`2cd60a3`](2cd60a3),
[`e102a89`](e102a89),
[`49575d6`](49575d6),
[`dc1445d`](dc1445d)]:
    -   @browserbasehq/stagehand@3.5.0

## @browserbasehq/stagehand-evals@2.0.2

### Patch Changes

- Updated dependencies
\[[`3a53ed4`](3a53ed4),
[`6e75725`](6e75725),
[`8fc16d2`](8fc16d2),
[`78bcde8`](78bcde8),
[`3e95a87`](3e95a87),
[`ebbdcd3`](ebbdcd3),
[`12703a6`](12703a6),
[`1db5f1c`](1db5f1c),
[`cb586a1`](cb586a1),
[`765861c`](765861c),
[`2cd60a3`](2cd60a3),
[`e102a89`](e102a89),
[`49575d6`](49575d6),
[`dc1445d`](dc1445d)]:
    -   @browserbasehq/stagehand@3.5.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
felipeofdev-ai pushed a commit to felipeofdev-ai/stagehand that referenced this pull request Aug 4, 2026
# why

The SEA binary needs a lightweight way to report the commit and
timestamp it was built from.

# what changed

Added a `--version` path that prints build metadata baked into the SEA
binary during build.
felipeofdev-ai pushed a commit to felipeofdev-ai/stagehand that referenced this pull request Aug 4, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @browserbasehq/stagehand@3.5.0

### Minor Changes

- [browserbase#2149](browserbase#2149)
[`6e75725`](browserbase@6e75725)
Thanks [@miguelg719](https://github.com/miguelg719)! - Added a
`screenshot` option to `extract()` that sends the current viewport
screenshot with the a11y tree for extraction.

- [browserbase#2127](browserbase#2127)
[`78bcde8`](browserbase@78bcde8)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Add
`ignoreDefaultArgs` option to selectively remove chrome-launcher's
built-in default flags (e.g. `--disable-extensions`) when running
locally

- [browserbase#2160](browserbase#2160)
[`49575d6`](browserbase@49575d6)
Thanks [@monadoid](https://github.com/monadoid)! - Forward constructor
and request model configuration when initializing API-backed sessions.

- [browserbase#2171](browserbase#2171)
[`dc1445d`](browserbase@dc1445d)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add native
clipboard API

### Patch Changes

- [browserbase#2146](browserbase#2146)
[`3a53ed4`](browserbase@3a53ed4)
Thanks [@shriyatheunicorn](https://github.com/shriyatheunicorn)! - Pass
local browser launch options through when attaching over CDP so explicit
viewport settings are respected.

- [browserbase#2107](browserbase#2107)
[`8fc16d2`](browserbase@8fc16d2)
Thanks [@miguelg719](https://github.com/miguelg719)! - Fix Anthropic CUA
`triple_click` action mapping.

- [browserbase#2118](browserbase#2118)
[`3e95a87`](browserbase@3e95a87)
Thanks [@monadoid](https://github.com/monadoid)! - Add Vertex auth
parameters to the core and server API schemas.

- [browserbase#2126](browserbase#2126)
[`ebbdcd3`](browserbase@ebbdcd3)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix(core):
import ToolSet from ai public export

- [browserbase#2120](browserbase#2120)
[`12703a6`](browserbase@12703a6)
Thanks [@miguelg719](https://github.com/miguelg719)! - Fix
structuredOutputMode for newer Anthropic models

- [browserbase#2170](browserbase#2170)
[`1db5f1c`](browserbase@1db5f1c)
Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - Add Claude Opus
4.8 to the supported CUA model whitelist.

- [browserbase#2116](browserbase#2116)
[`cb586a1`](browserbase@cb586a1)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - include
"[selected]" or "[checked]" state in snapshot

- [browserbase#2129](browserbase#2129)
[`765861c`](browserbase@765861c)
Thanks [@miguelg719](https://github.com/miguelg719)! - Add a
backend-selectable v3 evaluator facade while preserving the legacy
evaluator path.

- [browserbase#2157](browserbase#2157)
[`2cd60a3`](browserbase@2cd60a3)
Thanks [@miguelg719](https://github.com/miguelg719)! - Add verifier
trajectory, rubric, and evaluation-result types with normalized public
naming.

- [browserbase#2131](browserbase#2131)
[`e102a89`](browserbase@e102a89)
Thanks [@miguelg719](https://github.com/miguelg719)! - Capture verifier
trajectory evidence from agent evidence callbacks for offline scoring.

## @browserbasehq/browse-cli@0.6.1

### Patch Changes

- Updated dependencies
\[[`3a53ed4`](browserbase@3a53ed4),
[`6e75725`](browserbase@6e75725),
[`8fc16d2`](browserbase@8fc16d2),
[`78bcde8`](browserbase@78bcde8),
[`3e95a87`](browserbase@3e95a87),
[`ebbdcd3`](browserbase@ebbdcd3),
[`12703a6`](browserbase@12703a6),
[`1db5f1c`](browserbase@1db5f1c),
[`cb586a1`](browserbase@cb586a1),
[`765861c`](browserbase@765861c),
[`2cd60a3`](browserbase@2cd60a3),
[`e102a89`](browserbase@e102a89),
[`49575d6`](browserbase@49575d6),
[`dc1445d`](browserbase@dc1445d)]:
    -   @browserbasehq/stagehand@3.5.0

## @browserbasehq/stagehand-server-v3@3.7.0

### Minor Changes

- [browserbase#2160](browserbase#2160)
[`49575d6`](browserbase@49575d6)
Thanks [@monadoid](https://github.com/monadoid)! - Forward constructor
and request model configuration when initializing API-backed sessions.

### Patch Changes

- [browserbase#2118](browserbase#2118)
[`3e95a87`](browserbase@3e95a87)
Thanks [@monadoid](https://github.com/monadoid)! - Add Vertex auth
parameters to the core and server API schemas.

- [browserbase#2167](browserbase#2167)
[`ce21468`](browserbase@ce21468)
Thanks [@monadoid](https://github.com/monadoid)! - Add SEA binary
--version build metadata output.

- Updated dependencies
\[[`3a53ed4`](browserbase@3a53ed4),
[`6e75725`](browserbase@6e75725),
[`8fc16d2`](browserbase@8fc16d2),
[`78bcde8`](browserbase@78bcde8),
[`3e95a87`](browserbase@3e95a87),
[`ebbdcd3`](browserbase@ebbdcd3),
[`12703a6`](browserbase@12703a6),
[`1db5f1c`](browserbase@1db5f1c),
[`cb586a1`](browserbase@cb586a1),
[`765861c`](browserbase@765861c),
[`2cd60a3`](browserbase@2cd60a3),
[`e102a89`](browserbase@e102a89),
[`49575d6`](browserbase@49575d6),
[`dc1445d`](browserbase@dc1445d)]:
    -   @browserbasehq/stagehand@3.5.0

## @browserbasehq/stagehand-evals@2.0.2

### Patch Changes

- Updated dependencies
\[[`3a53ed4`](browserbase@3a53ed4),
[`6e75725`](browserbase@6e75725),
[`8fc16d2`](browserbase@8fc16d2),
[`78bcde8`](browserbase@78bcde8),
[`3e95a87`](browserbase@3e95a87),
[`ebbdcd3`](browserbase@ebbdcd3),
[`12703a6`](browserbase@12703a6),
[`1db5f1c`](browserbase@1db5f1c),
[`cb586a1`](browserbase@cb586a1),
[`765861c`](browserbase@765861c),
[`2cd60a3`](browserbase@2cd60a3),
[`e102a89`](browserbase@e102a89),
[`49575d6`](browserbase@49575d6),
[`dc1445d`](browserbase@dc1445d)]:
    -   @browserbasehq/stagehand@3.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants