Skip to content

SDK: expose run-ID-addressed controls for reattached runs #1630

Closed

Description

@samuv

Parent story: #1466

Problem

A client can observe an existing run through durable attachment or session activity, but the ergonomic controls live only on the Run object returned to the client that started that run. After a browser reload, process restart, or handoff to another client, consumers must construct raw HTTP controls to resolve a permission ask, cancel, steer, or retract pending steering.

A control must be bound to the intended run. Acting only on the session risks applying a delayed action to a newer run.

Goal

Expose typed controls addressed by both session ID and run ID, likely through session.controls(runId), without requiring ownership of the original event stream.

Scope

  • Resolve a pending permission ask with the full typed verdict.
  • Cancel the addressed run.
  • Steer with text or ordered media prompt parts and an optional client-minted message ID.
  • Return typed steering acknowledgements for accepted, appended, and too-late outcomes, including promoted follow-up run information.
  • Retract a pending steer and return retracted or none-pending.
  • Send expected_run_id for every operation so stale controls fail as stale_run_control.
  • Preserve request headers, cancellation, deadlines, feature detection, and typed SDK errors.

Boundaries

  • Server authorization and lifecycle state remain authoritative.
  • The controls do not require or create an event stream.
  • Transport availability must be explicit; do not emulate unsupported controls client-side.
  • This is SDK functionality, not React or Studio-specific state.

Acceptance criteria

  • A client that loads a session and knows an active run ID can use all supported controls through documented high-level APIs.
  • A control cannot affect a later run after its addressed run has ended.
  • Steering acknowledgements preserve message correlation and server outcomes.
  • Tests cover success, stale-run refusal, feature gating, malformed acknowledgements, request options, cancellation, and media prompts.
  • Public API reports, documentation, examples, and the SDK changelog are updated.

Metadata

Metadata

Assignees

Labels

enhancementsdk

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions