Skip to content

feat(sdk): optional token, relative baseUrl, display_name, execution fields#1513

Merged
markturansky merged 12 commits intomainfrom
jsell/feat/sdk-consolidated
May 7, 2026
Merged

feat(sdk): optional token, relative baseUrl, display_name, execution fields#1513
markturansky merged 12 commits intomainfrom
jsell/feat/sdk-consolidated

Conversation

@jsell-rh
Copy link
Copy Markdown
Contributor

@jsell-rh jsell-rh commented May 5, 2026

Summary

Consolidates #1508 and #1509 into a single PR with full SDK regeneration.

  • TS SDK templates: Make token and project optional in AmbientClientConfig (browser support)
  • TS SDK templates: Accept relative baseUrl (e.g. /api/proxy), reject protocol-relative URLs (//)
  • TS SDK templates: Sub-resource APIs throw clear error when project is needed but absent
  • Go SDK: Alphabetize ScheduledSessionPatch fields, add AgentID validation in builder
  • All SDKs: Full regeneration needed to pick up display_name on Project and latest spec changes

Supersedes #1508 and #1509.

Test plan

  • TS SDK tests updated (browser mode, relative URL, protocol-relative rejection)
  • make build-generator && make generate-sdk completes
  • make verify-sdk passes (no drift)
  • Go SDK compiles with CLI
  • TS SDK tests pass (45 tests)

Post-merge

After regeneration, watch for Go extension file conflicts (agent_extensions.go, session_messages.go) that depend on client methods.

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added project-scoped agent management APIs
    • Added scheduled session management and lifecycle control (create, update, delete, suspend, resume, trigger)
    • Added credential management functionality
    • Added project display name support
  • Improvements

    • Enhanced agent and project resource models with new configuration options
    • Improved SDK client validation for configuration parameters
    • Extended support for optional authentication in browser and mobile environments

Consolidates PRs #1508 and #1509:
- Make token and project optional in TS SDK templates (browser support)
- Accept relative baseUrl, reject protocol-relative URLs
- Go SDK: add AgentID validation and alphabetize ScheduledSessionPatch fields
- Full SDK regeneration needed (run make generate-sdk)

Supersedes: #1508, #1509

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e69588a0-bf36-413f-ba30-4f3d95f5becc

📥 Commits

Reviewing files that changed from the base of the PR and between 523a060 and c9b63ab.

⛔ Files ignored due to path filters (1)
  • components/ambient-api-server/pkg/api/openapi/.openapi-generator/FILES is excluded by !**/pkg/api/openapi/**
📒 Files selected for processing (93)
  • components/ambient-cli/cmd/acpctl/agent/cmd.go
  • components/ambient-cli/cmd/acpctl/ambient/tui/client.go
  • components/ambient-cli/cmd/acpctl/ambient/tui/views/scheduledsessions.go
  • components/ambient-cli/cmd/acpctl/scheduledsession/cmd.go
  • components/ambient-cli/cmd/acpctl/start/cmd.go
  • components/ambient-sdk/generator/templates/go/http_client.go.tmpl
  • components/ambient-sdk/generator/templates/ts/ambient_client.ts.tmpl
  • components/ambient-sdk/generator/templates/ts/base.ts.tmpl
  • components/ambient-sdk/generator/templates/ts/client.ts.tmpl
  • components/ambient-sdk/go-sdk/client/agent_api.go
  • components/ambient-sdk/go-sdk/client/agent_extensions.go
  • components/ambient-sdk/go-sdk/client/client.go
  • components/ambient-sdk/go-sdk/client/credential_api.go
  • components/ambient-sdk/go-sdk/client/credential_extensions.go
  • components/ambient-sdk/go-sdk/client/extensions_test.go
  • components/ambient-sdk/go-sdk/client/inbox_message_api.go
  • components/ambient-sdk/go-sdk/client/iterator.go
  • components/ambient-sdk/go-sdk/client/project_api.go
  • components/ambient-sdk/go-sdk/client/project_settings_api.go
  • components/ambient-sdk/go-sdk/client/role_api.go
  • components/ambient-sdk/go-sdk/client/role_binding_api.go
  • components/ambient-sdk/go-sdk/client/scheduled_session_api.go
  • components/ambient-sdk/go-sdk/client/scheduled_session_extensions.go
  • components/ambient-sdk/go-sdk/client/session_api.go
  • components/ambient-sdk/go-sdk/client/session_message_api.go
  • components/ambient-sdk/go-sdk/client/user_api.go
  • components/ambient-sdk/go-sdk/types/agent.go
  • components/ambient-sdk/go-sdk/types/base.go
  • components/ambient-sdk/go-sdk/types/credential.go
  • components/ambient-sdk/go-sdk/types/credential_extensions.go
  • components/ambient-sdk/go-sdk/types/inbox_message.go
  • components/ambient-sdk/go-sdk/types/list_options.go
  • components/ambient-sdk/go-sdk/types/project.go
  • components/ambient-sdk/go-sdk/types/project_settings.go
  • components/ambient-sdk/go-sdk/types/role.go
  • components/ambient-sdk/go-sdk/types/role_binding.go
  • components/ambient-sdk/go-sdk/types/scheduled_session.go
  • components/ambient-sdk/go-sdk/types/scheduled_session_extensions.go
  • components/ambient-sdk/go-sdk/types/session.go
  • components/ambient-sdk/go-sdk/types/session_message.go
  • components/ambient-sdk/go-sdk/types/user.go
  • components/ambient-sdk/python-sdk/ambient_platform/__init__.py
  • components/ambient-sdk/python-sdk/ambient_platform/_agent_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_base.py
  • components/ambient-sdk/python-sdk/ambient_platform/_credential_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_inbox_message_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_iterator.py
  • components/ambient-sdk/python-sdk/ambient_platform/_project_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_project_settings_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_role_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_role_binding_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_session_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_session_message_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/_user_api.py
  • components/ambient-sdk/python-sdk/ambient_platform/agent.py
  • components/ambient-sdk/python-sdk/ambient_platform/client.py
  • components/ambient-sdk/python-sdk/ambient_platform/credential.py
  • components/ambient-sdk/python-sdk/ambient_platform/inbox_message.py
  • components/ambient-sdk/python-sdk/ambient_platform/project.py
  • components/ambient-sdk/python-sdk/ambient_platform/project_settings.py
  • components/ambient-sdk/python-sdk/ambient_platform/role.py
  • components/ambient-sdk/python-sdk/ambient_platform/role_binding.py
  • components/ambient-sdk/python-sdk/ambient_platform/scheduled_session.py
  • components/ambient-sdk/python-sdk/ambient_platform/session.py
  • components/ambient-sdk/python-sdk/ambient_platform/session_message.py
  • components/ambient-sdk/python-sdk/ambient_platform/user.py
  • components/ambient-sdk/ts-sdk/src/agent.ts
  • components/ambient-sdk/ts-sdk/src/agent_api.ts
  • components/ambient-sdk/ts-sdk/src/base.ts
  • components/ambient-sdk/ts-sdk/src/client.ts
  • components/ambient-sdk/ts-sdk/src/credential.ts
  • components/ambient-sdk/ts-sdk/src/credential_api.ts
  • components/ambient-sdk/ts-sdk/src/inbox_message.ts
  • components/ambient-sdk/ts-sdk/src/inbox_message_api.ts
  • components/ambient-sdk/ts-sdk/src/index.ts
  • components/ambient-sdk/ts-sdk/src/project.ts
  • components/ambient-sdk/ts-sdk/src/project_api.ts
  • components/ambient-sdk/ts-sdk/src/project_settings.ts
  • components/ambient-sdk/ts-sdk/src/project_settings_api.ts
  • components/ambient-sdk/ts-sdk/src/role.ts
  • components/ambient-sdk/ts-sdk/src/role_api.ts
  • components/ambient-sdk/ts-sdk/src/role_binding.ts
  • components/ambient-sdk/ts-sdk/src/role_binding_api.ts
  • components/ambient-sdk/ts-sdk/src/scheduled_session.ts
  • components/ambient-sdk/ts-sdk/src/scheduled_session_api.ts
  • components/ambient-sdk/ts-sdk/src/session.ts
  • components/ambient-sdk/ts-sdk/src/session_api.ts
  • components/ambient-sdk/ts-sdk/src/session_message.ts
  • components/ambient-sdk/ts-sdk/src/session_message_api.ts
  • components/ambient-sdk/ts-sdk/src/user.ts
  • components/ambient-sdk/ts-sdk/src/user_api.ts
  • components/ambient-sdk/ts-sdk/tests/client.test.ts

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


📝 Walkthrough

Walkthrough

This PR refactors the Ambient SDK and CLI to make project context implicit in client configuration rather than explicit in method parameters. SDK client templates, generated API methods, type definitions, and CLI commands are updated to use project-scoped base paths and new *InProject/*ByProject method variants that derive project context from the client.

Changes

Project-Scoped SDK Refactoring

Layer / File(s) Summary
SDK Configuration & Types
components/ambient-sdk/generator/templates/ts/base.ts.tmpl, components/ambient-sdk/generator/templates/ts/ambient_client.ts.tmpl, components/ambient-sdk/generator/templates/go/http_client.go.tmpl, components/ambient-sdk/go-sdk/types/scheduled_session.go, components/ambient-sdk/go-sdk/types/scheduled_session_extensions.go, components/ambient-sdk/python-sdk/ambient_platform/scheduled_session.py, components/ambient-sdk/ts-sdk/src/scheduled_session.ts
AmbientClientConfig makes token and project optional. HTTP client template adds streaming client support and Project() accessor. doMultiStatus() helper accepts multiple status codes. ScheduledSession fields converted to non-pointer types; ScheduledSessionPatch moved to extensions for optional patch fields.
Client Initialization & Validation
components/ambient-sdk/generator/templates/ts/client.ts.tmpl, components/ambient-sdk/ts-sdk/src/client.ts, components/ambient-sdk/ts-sdk/src/base.ts
Constructor validation updated: token checks conditional on presence; baseUrl rejects protocol-relative URLs; project validation added to sub-resource basePath() methods. Optional AMBIENT_PROJECT env var handling added.
Go SDK Generated API Clients
components/ambient-sdk/go-sdk/client/scheduled_session_api.go, components/ambient-sdk/go-sdk/client/scheduled_session_extensions.go, components/ambient-sdk/go-sdk/client/agent_api.go, components/ambient-sdk/go-sdk/client/agent_extensions.go, components/ambient-sdk/go-sdk/client/credential_api.go, components/ambient-sdk/go-sdk/client/credential_extensions.go, components/ambient-sdk/go-sdk/client/session_api.go, components/ambient-sdk/go-sdk/client/project_api.go, components/ambient-sdk/go-sdk/client/user_api.go, components/ambient-sdk/go-sdk/client/role_api.go, components/ambient-sdk/go-sdk/client/role_binding_api.go
Scheduled sessions refactored: basePath() uses client project; CRUD methods (Create, Get, List, Update, Delete) remove projectID parameter. Agent methods renamed (StartStartInProject). Credentials gain GetToken in extensions. Session/User/Project/Role methods add Update. All API client metadata (spec SHA256, timestamps) refreshed.
TypeScript SDK Generated API Clients
components/ambient-sdk/ts-sdk/src/scheduled_session_api.ts, components/ambient-sdk/ts-sdk/src/agent_api.ts, components/ambient-sdk/ts-sdk/src/credential_api.ts, components/ambient-sdk/ts-sdk/src/inbox_message_api.ts, components/ambient-sdk/ts-sdk/src/session_message_api.ts, components/ambient-sdk/ts-sdk/src/role_api.ts, components/ambient-sdk/ts-sdk/src/role_binding_api.ts, components/ambient-sdk/ts-sdk/src/project_api.ts
New ScheduledSessionAPI class with project-scoped basePath() and CRUD methods. AgentAPI endpoints now use project-scoped paths; prior *ByProject/*InProject methods removed in favor of config-driven routing. InboxMessageAPI and SessionMessageAPI endpoints scoped to projects via basePath(). Role/RoleBinding gain delete methods. Metadata refreshed across all files.
Python SDK Generated API Clients
components/ambient-sdk/python-sdk/ambient_platform/_scheduled_session_api.py, components/ambient-sdk/python-sdk/ambient_platform/_agent_api.py, components/ambient-sdk/python-sdk/ambient_platform/_credential_api.py, components/ambient-sdk/python-sdk/ambient_platform/_inbox_message_api.py, components/ambient-sdk/python-sdk/ambient_platform/_session_message_api.py, components/ambient-sdk/python-sdk/ambient_platform/_role_api.py, components/ambient-sdk/python-sdk/ambient_platform/_role_binding_api.py
New ScheduledSessionAPI and CredentialAPI classes with project-scoped base paths. AgentAPI, InboxMessageAPI, and SessionMessageAPI updated to compute endpoints via project-aware _base_path(). Role/RoleBinding gain delete methods. Client wiring updated in client.py to lazy-initialize API caches including new scheduled_sessions property.
Type Definitions & Model Updates
components/ambient-sdk/python-sdk/ambient_platform/agent.py, components/ambient-sdk/python-sdk/ambient_platform/credential.py, components/ambient-sdk/python-sdk/ambient_platform/project.py, components/ambient-sdk/ts-sdk/src/agent.ts, components/ambient-sdk/ts-sdk/src/credential.ts, components/ambient-sdk/ts-sdk/src/project.ts, components/ambient-sdk/go-sdk/types/*
Agent models expanded with LLM, parent/repo/resource fields; required fields shift from owner_user_id to project_id. Credential model introduced (Python/TS). Project adds display_name. Builder validation in Go/TS/Python updated to reflect new required fields. All generated type metadata refreshed.
CLI Integration
components/ambient-cli/cmd/acpctl/agent/cmd.go, components/ambient-cli/cmd/acpctl/start/cmd.go, components/ambient-cli/cmd/acpctl/ambient/tui/client.go, components/ambient-cli/cmd/acpctl/ambient/tui/views/scheduledsessions.go, components/ambient-cli/cmd/acpctl/scheduledsession/cmd.go
Agent start operations updated to call StartInProject instead of Start. Scheduled session commands refactored to use ListByProject, GetByProject, CreateInProject, UpdateInProject, DeleteInProject methods. Scheduled session detail formatting simplified to unconditionally display timeout fields.
Tests & Validation
components/ambient-sdk/go-sdk/client/extensions_test.go, components/ambient-sdk/ts-sdk/tests/client.test.ts
Go tests added for project-scoped CRUD operations (scheduled sessions, agent start, credential token). Tests validate doMultiStatus accepts multiple HTTP status codes and rejects unexpected ones. Tests confirm streaming client initialization and TLS configuration. ScheduledSessionPatch JSON round-trip and omit-empty behavior validated. TypeScript tests expanded for optional token/project and baseUrl validation (relative paths allowed, protocol-relative rejected).
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jsell/feat/sdk-consolidated
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch jsell/feat/sdk-consolidated

@netlify
Copy link
Copy Markdown

netlify Bot commented May 5, 2026

Deploy Preview for cheerful-kitten-f556a0 canceled.

Name Link
🔨 Latest commit c9b63ab
🔍 Latest deploy log https://app.netlify.com/projects/cheerful-kitten-f556a0/deploys/69fc996b67db2a0008fd0dd3

@jsell-rh jsell-rh requested a review from markturansky May 5, 2026 16:12
jsell-rh and others added 9 commits May 5, 2026 17:44
…extensions

Full SDK regeneration removed streamingClient, doMultiStatus, and
changed API signatures that hand-written Go extension files and the CLI
depend on. Revert Go and Python SDKs to main, keeping only TS SDK
regeneration and source changes (templates, Go types, tests).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Syncs the Go SDK generator template with the streaming client, multi-status
response handling, and Project() accessor that were added in 55e85ca but
not back-ported to the template. This ensures `make generate-sdk` produces
output compatible with hand-written extension files (session_messages.go,
agent_extensions.go).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ation

The SDK regeneration overwrote hand-written methods in generated files.
This adds extension files (not overwritten by the generator) for:
- ScheduledSession: project-scoped CRUD, Suspend, Resume, Trigger, Runs, GetByName
- Credential: GetToken
- Agent: rename Start→StartInProject to avoid conflict with generated Start

Updates all CLI callers to use the new InProject method names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…patterns

- Rename List/GetInProject → ListByProject/GetByProject to match
  agent_extensions.go convention
- UpdateInProject takes map[string]any (not any) matching agent pattern
- ScheduledSessionPatch includes all 11 fields from the PatchBuilder
- TUI client passes map directly instead of round-tripping through struct

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers ScheduledSession project-scoped CRUD, Suspend, Resume, Trigger,
GetByName, Agent StartInProject, Credential GetToken, doMultiStatus
variadic status check, and Project() accessor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds tests for gaps found by coverage audit:
- ScheduledSessionAPI.Runs (project-scoped, verifies path and response)
- streamingClient initialization (DisableCompression=true)
- WithInsecureSkipVerify applies to both httpClient and streamingClient
- ScheduledSessionPatch JSON round-trip (all 11 fields, omitempty semantics)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jsell-rh jsell-rh marked this pull request as ready for review May 7, 2026 13:52
Copy link
Copy Markdown
Contributor

@markturansky markturansky left a comment

Choose a reason for hiding this comment

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

LGTM

@markturansky markturansky enabled auto-merge (squash) May 7, 2026 13:53
@mergify mergify Bot added the queued label May 7, 2026
@markturansky markturansky merged commit 3cdb4b6 into main May 7, 2026
0 of 2 checks passed
@markturansky markturansky deleted the jsell/feat/sdk-consolidated branch May 7, 2026 13:53
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set chat.allow_non_org_members: true in your configuration.

@mergify mergify Bot removed the queued label May 7, 2026
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