feat(sdk): export StagehandLog from public entrypoints - #2695
Open
HaoChiBao wants to merge 2 commits into
Open
Conversation
Make the StagehandLog type importable from the TypeScript and Python SDKs, and update logging docs accordingly.
🦋 Changeset detectedLatest commit: 8c55dff The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Architecture diagram
sequenceDiagram
participant App as External Application
participant SDK as Stagehand SDK
participant TypeDefs as Type Definitions
participant PkgExports as Public Exports
participant Logger as Logging Callback
Note over App,Logger: TypeScript SDK Public API Export Flow
App->>App: Source file imports StagehandLog<br>from package root
alt TypeScript
App->>PkgExports: import type { StagehandLog }<br>from "@browserbasehq/stagehand"
PkgExports->>TypeDefs: Resolve to sdk-ts/src/index.ts
TypeDefs-->>PkgExports: Export StagehandLog type
PkgExports-->>App: Type available at runtime compile time
else Python
App->>PkgExports: from stagehand import StagehandLog
PkgExports->>PkgExports: Check __init__.py exports
PkgExports-->>App: StagehandLog in __all__
end
App->>Logger: Register logging callback
Logger->>SDK: Initialize Stagehand client
SDK->>Logger: Execute Stagehand operations
Logger->>Logger: Accept log parameter typed as StagehandLog
Logger-->>App: Structured log output
Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.
Re-trigger cubic
Export StagehandLogLevel and StagehandLogData beside StagehandLog so the logging docs sketch matches log.level.value / log.data usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StagehandLogfrom the public TypeScript and Python SDK entrypoints.Test plan
import type { StagehandLog } from @browserbasehq/stagehandresolvesfrom stagehand import StagehandLogresolves and is listed in__all__Summary by cubic
Export
StagehandLogfrom the public TypeScript and Python SDK entry points, and exportStagehandLogLevelandStagehandLogDatain Python so apps can import from the package root. Previously these types were not re-exported; there are no runtime changes.Migration
import type { StagehandLog } from '@browserbasehq/stagehand'.from stagehand import StagehandLog, StagehandLogLevel, StagehandLogData.Written for commit 8c55dff. Summary will update on new commits.