feat(sdk): make token optional and accept relative baseUrl in TS SDK#1509
Closed
feat(sdk): make token optional and accept relative baseUrl in TS SDK#1509
Conversation
Enable browser-side usage of the TS SDK by making token and project optional in AmbientClientConfig, conditionally sending Authorization and X-Ambient-Project headers only when values are present, and accepting relative baseUrl paths (e.g. "/api/proxy") that skip URL parsing. Sub-resource APIs throw a clear error when project is needed but absent. Templates are updated to fix drift with generated output. Includes full SDK regeneration (Go, Python, TS) from latest spec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The full SDK regeneration introduced conflicts with hand-written Go extension files (agent_extensions.go, session_messages.go) that depend on client methods not present in the generator templates. Reverting Go and Python SDKs to main state; this PR focuses on TS SDK changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Timeout, InactivityTimeout, StopOnRunFinished, and RunnerType fields to ScheduledSession, ScheduledSessionPatch, and their builders. These fields exist in the OpenAPI spec but were missing from the Go SDK, causing compilation failures in the CLI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for cheerful-kitten-f556a0 canceled.
|
…col-relative URLs Templates are the source of truth for SDK generation. The prior commit updated generated output but not templates, which would be reverted on next regeneration. Also rejects // URLs to prevent protocol-relative URL exploitation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 tasks
Contributor
Author
|
Superseded by #1513 (consolidated SDK PR with full regeneration) |
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
tokenandprojectoptional inAmbientClientConfigto enable browser-side SDK usage (where auth is handled by cookies/proxy)baseUrlpaths (e.g./api/proxy) by skippingnew URL()validation for paths starting with/AuthorizationandX-Ambient-Projectheaders only when values are presentprojectis needed but absentprojectfromEnv()still requiresAMBIENT_TOKEN(server-side use case) but makesAMBIENT_PROJECToptionalTimeout,InactivityTimeout,StopOnRunFinished,RunnerTypefields toScheduledSessiontypesTest plan
npm testints-sdk/)tsc --noEmit)go vet ./...)go vet ./...inambient-cli/)fromEnv()withoutAMBIENT_PROJECT🤖 Generated with Claude Code