10 Commits

Author SHA1 Message Date
Alex Qiu
335cf4730e
[STG-1607] Yield finished SSE event instead of silently dropping it (#1846)
# why

Monarch Money reported a bug in the Python SDK (stagehand-python
v3.6.0).

In src/stagehand/_streaming.py, both the sync Stream.__stream__() (line
62-63) and async AsyncStream.__stream__() (line 147-148) have:

```
python
if sse.data.startswith('{"data":{"status":"finished"'):
    break  # ← drops the event without yielding it
```

When the server sends the finished SSE event (which contains success,
message, actions, usage, and messages), the SDK immediately breaks out
of the loop without yielding the event to the caller. This means the
final result payload is silently dropped.

# what changed

The streaming on_event config had `handle: done` for the
`{"data":{"status":"finished"...}}` event. Stainless generates this as a
bare break, which exits the SSE loop without yielding the event –
silently dropping the final result payload (success status, message,
actions, usage, and messages) from every streaming response.

Fix – Changed to `handle: yield` so the finished event is delivered to
callers before the stream terminates. This is safe because the server
explicitly calls `reply.raw.end()` immediately after sending the
finished event (packages/server-v3/src/lib/stream.ts), so the SSE
connection closes right after the yield and the loop exits naturally on
EOF – no hang risk.

# test plan

Regenerate SDKs and confirm fix
2026-03-18 14:26:03 -04:00
Nick Sweeting
e36ddd6f29
[STG-1536] Split packages/stagehand/server into separate server-v3 and server-v4 dirs (#1796)
# Follow-up Tasks

- [ ] Update stainless SDK custom code for all languages to pull new
`stagehand-server-v3-darwin-x64` binary names (`-v3-` added)

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Split the Stagehand API into `packages/server-v3` and
`packages/server-v4`, each with its own builds, tests, SEA binaries, and
release workflows. Delivers STG-1536 and lets us keep v3 stable while
iterating on v4; CI/test discovery and OpenAPI artifacts are versioned.

- **Refactors**
- Renamed the original server to `packages/server-v3`
(`@browserbasehq/stagehand-server-v3`); updated docs and runtime path
helpers (now synced across core/docs/evals and both servers), ESLint
globs/ignores, scripts/Turbo filters, tests, and Stainless to read
`packages/server-v3/openapi.v3.yaml`; v3 SEA binaries use
`stagehand-server-v3-*`.
- Added `packages/server-v4` (`@browserbasehq/stagehand-server-v4`) with
`/v4/**` routes, SSE streaming via `x-stream-response`, LRU/TTL
in-memory session store, health/readiness, logging/metrics,
`openapi.v4.yaml` + generator, SEA tooling, and v4 integration tests.
- CI: path filters, test discovery, and artifacts cover both versions;
added `stagehand-server-v4-release.yml` and
`stagehand-server-v4-sea-build.yml`; renamed v3 workflows; artifacts
include `packages/server-v3/**` and `packages/server-v4/**` dists and
OAS.

- **Migration**
- Replace `packages/server/**` refs with `packages/server-v3/**` or
`packages/server-v4/**`.
- Use new package filters and binary names:
`@browserbasehq/stagehand-server-v3` /
`@browserbasehq/stagehand-server-v4`; `stagehand-server-v3-*` /
`stagehand-server-v4-*`.
- Update OpenAPI consumers to `packages/server-v3/openapi.v3.yaml` or
`packages/server-v4/openapi.v4.yaml`.

<sup>Written for commit 2b9114ca8097d28ac1567fc67062b24f789a5c2e.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1796">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->
2026-03-09 17:32:57 -07:00
Sam F
4633f009db
STG-1307: set Sonatype portal for Java/Kotlin (#1757)
# why
Allows java / kotlin publishing
# what changed
minimal stainless config change as per stainless docs
# test plan
none

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Configured Stainless to publish Java and Kotlin packages to Maven
Central via Sonatype Portal. Moves STG-1307 forward by enabling
publishing for these two languages.

- **New Features**
- Set maven.sonatype_platform: portal for Java and Kotlin in
stainless.yml.

<sup>Written for commit a2f1a108ec472433b2674b7f5dd3587922a4730f.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1757">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: ci-test <ci-test@example.com>
2026-02-25 13:07:06 -07:00
Sam F
961bb5d2ce
Removed MCP from readme for now (#1639)
# why
We don't want the MCP server showing up in readme files for the
generated sdks
# what changed
Removed it from the stainless yaml for now - this means no MCP commits.
# test plan


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Disabled the MCP server in stainless.yml to keep it out of generated SDK
READMEs. This prevents MCP-related content and commits for now.

<sup>Written for commit 090a47edcd62b8b5c8e58843cf913dc7e5c12825.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1639">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: ci-test <ci-test@example.com>
2026-01-30 17:27:35 -07:00
Nick Sweeting
2a1b088dee
Fix issues in stainless.yml (#1638)
# why

# what changed

# test plan

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Enables publishing for Java/Kotlin (Maven), PHP (Packagist), and C#
(NuGet), and fixes event-stream “finished” detection. Also aligns
project naming and updates the Python repo target in Stainless.

- **Refactors**
  - Set project_name to “stagehand” and removed the alpha name.
- Updated Python production_repo to browserbase/stagehand-python
(removed branch suffix).
- Turned on publishing: Maven (Java/Kotlin), Packagist (PHP), NuGet
(C#).
  - Updated commented local env URL to http://stagehand-api.localhost.

- **Bug Fixes**
- Adjusted streaming on_event to detect finished using the JSON prefix:
'{"data":{"status":"finished"'.

<sup>Written for commit 8cd5e7a754a3f544cff42f9ca98cfa2460da2ed9.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1638">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->
2026-01-29 11:13:07 -08:00
Nick Sweeting
fd744adbb7
add auto-bedrock support based on bedrock/provider.model-name (#1617)
# why

Fixes: https://github.com/browserbase/stagehand-go/issues/43

Adds automatic bedrock AI SDK client support when `modelName ~=
'bedrock/...'`

# what changed

# test plan

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds automatic Amazon Bedrock support by routing models named
bedrock/{provider}.{model} to the Bedrock client. This enables
zero-API-key setup using your AWS credentials.

- **New Features**
  - Route bedrock/... model names to @ai-sdk/amazon-bedrock.
- Treat Bedrock as no-API-key provider (uses AWS IAM/default
credentials).
  - Example usage: bedrock/anthropic.claude-3.

- **Dependencies**
  - Added @ai-sdk/amazon-bedrock as an optional dependency.

<sup>Written for commit e1d7c4c14e14b57120b10735cd8b4f898a987342.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1617">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->
2026-01-27 09:40:41 -08:00
Nick Sweeting
80c62181ef
Include replay endpoint in stainless spec so SDK clients can get run metrics (#1590)
# why

# what changed

# test plan


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Expose the session replay metrics endpoint in the public API and
Stainless spec so SDKs can fetch run metrics. This lets clients retrieve
replay data for a session and optionally stream results.

- **New Features**
  - Added GET /v1/sessions/{id}/replay to OpenAPI with ReplayResponse.
  - Enabled SDK generation by adding replay to stainless.yml.
  - Removed hide flag so the route appears in API docs.
  - Supports optional SSE via x-stream-response header ("true"/"false").

<sup>Written for commit b7a44b9ae11632ecdf093ca3b3f6ba95d63a4c16.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-21 17:11:55 -08:00
Nick Sweeting
922f7ef42f
add v3 integration tests matching cloud exactly (#1583) 2026-01-20 19:03:12 -08:00
Sam F
e0a241ec21
move Stainless compatibility transforms from gen-openapi.ts into stainless.yml (#1563)
# why
Better to have in stainless yaml than gen-openapi script + some minor
cleanup.

# what changed
- Removed old v2 ModelConfigStringSchema from union
- moved all manual transforms out of gen-openapi.yml into stainless
transforms yaml config
- Confirmed no other v2 union types
- Added openapi.code_samples to stainless yaml as per mintlify/stainless
integration docs here:
https://www.mintlify.com/docs/integrations/sdks/stainless
# test plan



<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Moved Stainless compatibility transforms from gen-openapi.ts into
stainless.yml and removed the v2 string model config. This keeps
openapi.v3.yaml faithful to the Fastify/Zod output and applies
compatibility at SDK generation, improving CI stability and supporting
STG-1149.

- **Refactors**
  - Removed string-based post-processing from gen-openapi.ts.
  - Added openapi.transforms in stainless.yml to:
    - Remove propertyNames.
    - Set targeted additionalProperties to true.
    - Add ProxyConfigList title for the proxies array.
    - Mark StreamEventSystemData result fields as x-stainless-any.
- Marked NavigateResult result as x-stainless-any via schema overrides.
- Dropped ModelConfigString; ModelConfig is now object-only. Updated the
API client to convert agentConfig.model to the wire ModelConfig.
- Added openapi.code_samples: mintlify. Updated openapi.v3.yaml to the
raw schema (propertyNames present, additionalProperties {}, no injected
titles).

<sup>Written for commit 0c82c6c99462388777c02c7971a94b8c5b9d6d49.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-20 12:14:41 -07:00
Sam F
723a7fda91
/end endpoint returns empty object (#1500)
# why
Right now our server `/end` endpoint doesn’t match the production
Stagehand API contract: prod expects a non-empty JSON body when
`Content-Type: application/json` is set, so a call to `/end` that sends
an empty body fails. This change makes our server + OpenAPI spec match
prod so downstream generated SDKs send an empty object.

# what changed
Defined a strict empty-object request schema for `/end`
(`SessionEndRequest`) and made it a required request body in the route +
emitted OpenAPI. Updated the /end handler response to match prod `({
"success": true })` and added a server test covering the body
requirement.

- Also added a `stainless.yaml`
# test plan
Regenerate the Python SDK and verify sessions.end() succeeds against
production
2026-01-05 20:45:33 -07:00