Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude/skills/sdk/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ An agent folder error names its line (AI-2009, no spec change): Go (`sdks/go/age

A cancelled socket send ends the session in .NET (AI-2411): `ClientWebSocket` aborts the whole socket when a send is cancelled part way, so a tool cancelled by `tool_cancel` while its `UpdateAsync` was writing ended the session. `Socket.WriteAsync` (`sdks/dotnet`) now writes with no token and uses the caller's token only to wait for its turn. Go is not affected (gorilla's `WriteMessage` takes no context). Python, JavaScript, Ruby, Rust, PHP, Dart, Kotlin and Swift are unchecked: any SDK that passes a per-call cancellation token to a socket send should check whether cancelling it aborts the transport.

Spend limits, teams and usage categories in Python (AI-2442, no spec change): `plugins/stream` has `api.spend_limits` (list, create, update, delete, grant, grants, revoke_grant, usage, usage_many and reset over `/v1/spend/limits*`), `api.teams` (list, set_limit, which creates or updates, remove_limit, usage and grant), `api.account` (get, and credits by page) and `api.usage.spend`. A user's team is `team=` on `for_user` and `create_user_token`, and `Client(team=, usage_categories=)` counts the client's own work. Both are claims on every token the client signs (`team`, `usage_categories`), and `X-Stream-Usage-Categories` (`team:<name>` among them) without the proxy; a token handed in carries its own, so neither is taken beside one. Amounts are dollars as `Decimal`, `int` or `str` turned into micros exactly, never a float. The level is left to the router, and a team or category with `app_id` is sent as `app_team` or `app_category`. Go, JavaScript and the other server SDKs have no such wrappers yet: one that adds them should check a team and categories before signing, as the proxy does (a `team:` category refused in any case), and find an existing limit by listing rather than parsing `limit_exists`'s message.
Spend limits, teams and usage categories in Python (AI-2442, no spec change): `plugins/stream` has `api.spend_limits` (list, create, update, delete, grant, grants, revoke_grant, usage, usage_many and reset over `/v1/spend/limits*`), `api.teams` (list, set_limit, which creates or updates, remove_limit, usage and grant), `api.account` (get, and credits by page) and `api.usage.spend`. A device's user carries its team in `create_user_token(..., team=)`; a backend counts a user's work with `user_id=` on `Client.agent` or `Client.router` of a client built with `Client(team=, usage_categories=)` (`for_user` is deprecated, #2103), and that client's own work is counted against the same team and categories. Both are claims on every token the client signs (`team`, `usage_categories`), and `X-Stream-Usage-Categories` (`team:<name>` among them) without the proxy; a token handed in carries its own, so neither is taken beside one. Amounts are dollars as `Decimal`, `int` or `str` turned into micros exactly, never a float. The level is left to the router, and a team or category with `app_id` is sent as `app_team` or `app_category`. Go, JavaScript and the other server SDKs have no such wrappers yet: one that adds them should check a team and categories before signing, as the proxy does (a `team:` category refused in any case), and find an existing limit by listing rather than parsing `limit_exists`'s message.

A knowledge url or simulation error names its line too (AI-2417, no spec change): Go (`sdks/go/agents/folder.go`) prefixes `line N:` on a `knowledge/urls.yaml` page that is not an http or https url (the `url` key's line, or the page's), and on a `simulations/*.yaml` entry without a name, scenario or assertion, with a mode other than text or audio, or with a name already declared (the key's line, or the entry's when the key is missing). Python, JavaScript, .NET, Ruby, Rust and PHP: any SDK that reads an agent folder by hand should name these lines the same way.
Agent configs have `calls` (end_call, press, transfer with destinations). Go has it; JS, Python, Swift, Kotlin, Dart, .NET, Ruby, Rust and PHP still need it.
Expand Down Expand Up @@ -933,7 +933,7 @@ Go `Agent.Sync` stores the config first and then its skills with `config_id` set
An agent's UI instructions are kept apart from its instructions, so a session can turn UI off: `AgentConfig`, `AgentConfigRequest`, `AgentConfigPatch` and `SyncAgentRequest` have `ui_instructions` (an additive migration), and `CreateSessionRequest` has `ui`, a boolean a device may send. The router tells the model `ui_instructions` after the instructions (a backend's own session instructions included) unless the session was opened with `ui: false`, which reopening or forking it keeps (`agent_sessions.no_ui`). A sync sends the directory whole, so a sync without `ui_instructions` removes them; a PUT that leaves them out keeps them, so a client that does not know the field does not take the UI away. Go's `Load` compiles agent.yaml's `ui:` into `Folder.UIInstructions` and `syncFolder` sends it as `ui_instructions`; the folder's hash takes it in only when there is UI, so a directory without `ui:` is not synced again, and one with it is synced once more, which moves the UI out of the stored instructions. A router older than the field takes the sync and drops it, so `syncFolder` does not trust a stamp covering UI that the stored config lacks, and syncs again, and the router writes a sync of the same hash that declares UI the config lacks rather than finding it unchanged. Deploy the router before releasing an SDK that sends the field. A folder synced by both SDKs flips back: a JavaScript sync writes the UI into `instructions` and removes `ui_instructions`, so a session with `ui: false` is told the UI again; sync a folder with one SDK until JavaScript sends `ui_instructions`. The shared fixtures are unchanged: they are what the model is told, the instructions and the UI joined by a blank line, as the router joins them. Every generated client is regenerated (Go, JavaScript types, Python `plugins/stream`, Swift). Other SDKs need to update: JavaScript (`sdks/js/src/folder.ts`) should send the compiled `ui:` as `ui_instructions` rather than append it to `instructions`, its hash taking it in the same way; Python, .NET, Ruby, Rust and PHP, when they read `ui:`, the same; Swift has `SessionOptions.ui`, which `swift_assistant`'s Settings switch sets, and JavaScript's `sessions.create` passes `ui` through with the regenerated types; Python, Kotlin, Dart and the other server SDKs should offer `ui` on their create-session options, so an app that shows no UI can say so.
Connections (AI-3376): Go has `client.Connections()` for the accounts the app and its users hold at connectors, over `createConnection`, `createAuthorization`, `getConnection`, `listConnections` and `deleteConnection`, with no router change. The shape the other SDKs copy is one flat `connections` resource on the client with the user as a parameter of each call, always the `UserID` of the call's options struct (other SDKs use an optional named parameter `userId`/`user_id`), as Chat's server SDKs pass `user_id` (no per-user client): `Create(ctx, ConnectionRequest{Connector, Label, UserID})`, `Authorize(ctx, id, AuthorizeOptions{ReturnURL, UserID})` returning the generated `Authorization` (launch URL, handoff token, expiry), `Get(ctx, id, ConnectionOptions{UserID})`, `List(ctx, ConnectionFilter{UserID, Connector})` reading every page newest first, and `Delete(ctx, id, ConnectionOptions{UserID})`. A user given is sent as `owner.user_id` (create only) and as `X-Stream-User-Id` on every request, reads included, overriding whoever the client otherwise acts for; an empty user is the app's connection (`owner.type: app`, no header, List asks `owner_type=app`). An app connection is reached (Get, Authorize, Delete) by every backend call, one naming a user included; only List with a user is that user's alone. Refusals are the SDK's router error; an empty connection id is refused before sending. Other SDKs need to update: JavaScript, Python (plugins/stream), .NET, Ruby, Rust, PHP (AI-3378..AI-3383).
Connections in Rust (AI-3383): `Client::connections()` (`sdks/rust/src/connections.rs`) follows Go's shape with the user as `user_id` of each call: `create(&NewConnection{connector, label, user_id})`, `authorize(id, &AuthorizeOptions{return_url, user_id})`, `get(id, user_id: Option<&str>)`, `list(&ConnectionFilter{connector, user_id})`, `delete(id, user_id: Option<&str>)`; options structs rather than adjacent `Option<&str>` so a label cannot be swapped for a user. A user given goes through `pub(crate) Client::acting_for`, so the header matches the call and replaces a `ClientOptions::user_id` the client was built with; no user (or an empty one) leaves the client as built, as Go's `UserID` does (92148e5fe). Rust had no public acting-for helper to deprecate for AI-3387: `Backend` and its `acting_for` field are crate-private (`sdks/rust/src/backend.rs`, not re-exported from `lib.rs`), and `Client::acting_for` is `pub(crate)`. No other SDK needs to change for this.
Connections in JavaScript (AI-3378, AI-3387): `api.connections` has `create(connectorId, { label, userId })`, `authorize(id, { returnUrl, userId })`, `get(id, { userId })`, `list({ connectorId, userId })` (every page, 200 a page, newest first) and `delete(id, { userId })`. The user is an optional parameter of each call, never a client of its own: given, it is sent as `owner.user_id` (create) and `X-Stream-User-Id` on every call, reads included, with the app's server credential (an internal `Backend.speakingFor`, which Dispatch's `answer` also uses); left out or empty, the call is the app's (`owner.type: app`, `owner_type=app`, no header added). Optional parts are one options object, never adjacent positional strings. `Backend.actingFor` stays public and working, marked `@deprecated` (Chat's "deprecate, never break"), and a test pins its requests to the base commit's. A client built with `BackendOptions.userId` still sends that user on a call without `userId`, as on every other call; one built on the deprecated `actingFor` does not (the call is the app's). A `userId` on a client that is not server side (a device, or a page on a customer-id router) is a `ConfigurationError` before any request. Other SDKs need to update: Python, .NET, Ruby, Rust and PHP (AI-3379..AI-3383).
Connections in JavaScript (AI-3378, AI-3387): `api.connections` has `create(connectorId, { label, userId })`, `authorize(id, { returnUrl, userId })`, `get(id, { userId })`, `list({ connectorId, userId })` (every page, 200 a page, newest first) and `delete(id, { userId })`. The user is an optional parameter of each call, never a client of its own: given, it is sent as `owner.user_id` (create) and `X-Stream-User-Id` on every call, reads included, with the app's server credential (an internal `speakingFor(backend, userId)` in `backend.ts`, kept off `Backend`'s type, which Dispatch's `answer` also uses); left out or empty, the call is the app's (`owner.type: app`, `owner_type=app`, no header added). Optional parts are one options object, never adjacent positional strings. `Backend.actingFor` stays public and working, marked `@deprecated` (Chat's "deprecate, never break"), and a test pins its requests to the base commit's. A client built with `BackendOptions.userId` still sends that user on a call without `userId`, as on every other call; one built on the deprecated `actingFor` does not (the call is the app's). A `userId` on a client that is not server side (a device, or a page on a customer-id router) is a `ConfigurationError` before any request. Other SDKs need to update: Python, .NET, Ruby, Rust and PHP (AI-3379..AI-3383).
Connections in Python (AI-3379, no spec change): `plugins/stream` has `api.connections` with the Go shape: `create(connector_id, *, label=None, user_id=None)`, `authorize(id, *, return_url=None, user_id=None)` returning `Authorization`, `get(id, *, user_id=None)`, `list(*, connector_id=None, user_id=None)` reading every page, `delete(id, *, user_id=None)`; every option is keyword-only, so a user id cannot land in the label's or connector's slot. A user given is `owner.user_id` (create) and `X-Stream-User-Id` on every call, replacing whoever the client acts for and the user its backend was built for (which behind the proxy would sign that user's own token); none is the app's connection, sent as the client is otherwise (a client built for a user still names that user). AI-3387 in Python: `Client.for_user` is deprecated (`DeprecationWarning`, still working) in favour of a keyword-only `user_id=None`, last, on `Client.agent` and `Client.router`, on a client built with `team=`/`usage_categories=`; a device naming a user is refused before any request. Dispatch and `Accelerated` keep `Backend.acting_for` internally.
The session socket sends `reasoning_delta` (`turn_id`, `text`): the next piece of the model's thinking on a written reply, which a kept conversation also streams into the reply's Chat message and an incognito one has nowhere else to show. JavaScript folds it, with `tool_started`, `tool_updated` (not `verbatim`) and `tool_ran`, into each agent turn's `steps` in `sdks/js/src/conversation.ts`: a round of thinking `r1`, `r2`... opens on a delta after anything else and completes when the turn writes text or UI, calls a tool, answers or is cut off; a call runs until `tool_ran`, failed when it carries an `error`, its summary the last non-verbatim update. A turn is `done` on `responded` with no `pending_work`, or `interrupted`. `AgentChat` shows a session with no `conversationId` from these turns (`sdks/js/src/turn-messages.ts`): the agent's turns between two of the person's messages are one reply, shaped as the channel's messages (top level in stream-chat 9, under `custom` in 10) with `ai_reasoning` and `ai_tool_call` steps, rounds numbered across the reply, its whole thinking given to `reasoning`, and a call waiting in `approvals` shown `awaiting_approval` with its question and the session's `user_id` as `target_user_id`. The clients that carry the socket's description (JavaScript types, Python `plugins/stream`) are regenerated. Swift does the same: `Conversation` folds the frames into `Turn.steps` and `Turn.isDone`, and `TurnMessage.messages(of:approvals:userID:isConnected:)` (`session.turnMessages`) builds the replies, each step an attachment type and JSON payload for `AIMessagePart.parts(from:)`, the session's user now `Session.userID`; `swift_assistant`'s `AgentChat` shows an incognito session from them. Kotlin does the same: `Conversation` folds the frames into `Turn.steps` (`TurnStep.Reasoning`, `TurnStep.ToolCall`) and `Turn.isDone`, and `TurnMessage.messages(conversation, approvals, userId, isConnected)` (`AgentSession.turnMessages`, a `Flow`) builds the replies, each step an attachment type and plain-Kotlin fields for `AIMessagePart.parts`; its `target_user_id` is the user `setUser` named (`backend.user`), not the session's `user_id`, which is the name the agent joined the call as; `android_assistant`'s `AgentTransport` shows an incognito session from them. Other SDKs need to update: Dart, whose AI components read the same steps, should fold the same frames into their `Conversation` turns and show a session with no channel through their transports; the server SDKs need nothing.
An agent's UI instructions are kept apart from its instructions, so a session can turn UI off: `AgentConfig`, `AgentConfigRequest`, `AgentConfigPatch` and `SyncAgentRequest` have `ui_instructions` (an additive migration), and `CreateSessionRequest` has `ui`, a boolean a device may send. The router tells the model `ui_instructions` after the instructions (a backend's own session instructions included) unless the session was opened with `ui: false`, which reopening or forking it keeps (`agent_sessions.no_ui`). A sync sends the directory whole, so a sync without `ui_instructions` removes them; a PUT that leaves them out keeps them, so a client that does not know the field does not take the UI away. Go's `Load` compiles agent.yaml's `ui:` into `Folder.UIInstructions` and `syncFolder` sends it as `ui_instructions`; the folder's hash takes it in only when there is UI, so a directory without `ui:` is not synced again, and one with it is synced once more, which moves the UI out of the stored instructions. A router older than the field takes the sync and drops it, so `syncFolder` does not trust a stamp covering UI that the stored config lacks, and syncs again, and the router writes a sync of the same hash that declares UI the config lacks rather than finding it unchanged. Deploy the router before releasing an SDK that sends the field. JavaScript does the same: `loadFolder` puts the compiled `ui:` in `Folder.uiInstructions`, `Agent.sync` sends it as `ui_instructions` (left out without `ui:`, so such a directory keeps its fingerprint), and a stamp covering UI the stored config lacks is synced again. When a sync's answer has no `ui_instructions` though it sent them (a router older than the field), JavaScript syncs once more with the UI joined onto `instructions`, as before, under that body's own fingerprint and without writing the stamp, so the agent keeps its UI and the next sync moves it apart once the router knows the field. That fallback cannot honour `ui: false`: the UI is in `instructions` then, which every session is told, so the Interactive UI switch needs a router that knows the field and a sync it stored apart. Go only syncs again there, so an older router leaves a Go-synced agent with no UI, and Go should fall back the same way. `Agent`'s `instructions` option replaces instructions.md only: the folder's `ui:` is still sent as `ui_instructions`, as in Go. `react_assistant`'s settings have the same Interactive UI switch as `swift_assistant`'s, which opens new conversations with `ui: false`. The shared fixtures are unchanged: they are what the model is told, the instructions and the UI joined by a blank line, as the router joins them. Every generated client is regenerated (Go, JavaScript types, Python `plugins/stream`, Swift, Rust's `types.rs`); Rust compiling and sending `ui:` is still to do, below. Other SDKs need to update: Python, .NET, Ruby, Rust and PHP, when they read `ui:`, should send it as `ui_instructions` the same way; Swift has `SessionOptions.ui`, which `swift_assistant`'s Settings switch sets, and JavaScript's `sessions.create` passes `ui` through with the regenerated types, and Kotlin has `SessionOptions.ui`, which `Sessions.create` sends as it is (null left out); Python, Dart and the other server SDKs should offer `ui` on their create-session options, so an app that shows no UI can say so.
Expand Down
Loading
Loading