@@ -511,6 +511,73 @@ export interface SteerRequest {
511511 content : string ;
512512}
513513
514+ /**
515+ * The images one run takes in steers over its whole life. With a turn's own five they stay
516+ * under the twenty image and document blocks a model request holds.
517+ */
518+ export const MAX_RUN_STEERED_IMAGES = 10 ;
519+
520+ /** The most attachments and mentions one steer carries: Sim's MAX_CHAT_CONTEXTS for a turn. */
521+ export const MAX_STEER_CONTEXTS = 100 ;
522+
523+ /**
524+ * POST /api/streams/steer/v2: steer the live run `messageId` with one immutable input, answered
525+ * with its durable disposition, which a retry of the same body reads back. Only `not_applied`
526+ * (or a 422) lets the caller send the input as a new turn, with the steeringId as its
527+ * messageId; a turn for an input a run applied is refused. Refusals keep nothing:
528+ * - 400: an invalid body, or images outside an organization chat (`steering_scope`).
529+ * - 404 `steering_target_missing`: no such run (or not admitted yet).
530+ * - 409 `steering_conflict`: a different input under this steeringId.
531+ * - 422 `steering_image_limit`: past MAX_RUN_STEERED_IMAGES, applied images included. Final
532+ * for the run: send the input as the next turn once the run ends.
533+ * - 429 `steering_capacity`: the pending queue is full; retryable once the run applies it.
534+ */
535+ export const SteerV2Request = z . strictObject ( {
536+ messageId : z . uuid ( ) ,
537+ steeringId : z . uuid ( ) ,
538+ content : z . string ( ) . min ( 1 ) . max ( 1_048_576 ) ,
539+ /** Attachments and @-mentions, rendered into the steer the way a turn renders its own. */
540+ context : ChatPayloadSchema . shape . context . unwrap ( ) . max ( MAX_STEER_CONTEXTS ) . default ( [ ] ) ,
541+ /** Only an organization chat accepts images, as for a turn (400 otherwise). */
542+ assistantImages : ChatPayloadSchema . shape . assistantImages ,
543+ } ) ;
544+ export type SteerV2Request = z . infer < typeof SteerV2Request > ;
545+
546+ /**
547+ * - `queued`: accepted; the run applies it at its next model step, or ends first and then
548+ * reports `not_applied`.
549+ * - `applied`: logged into the run's model input, which its next model request carries (as
550+ * v1's frame means). `eventSeq` is its steering_input event in the chat
551+ * log and `textOffset` the main answer's length when it applied (UTF-16 code units), the
552+ * same values the `steering_applied` frame carries.
553+ * - `not_applied`: the run ended, or was stopped, before applying it, and never will. A run
554+ * that would apply it only by exceeding its usage limit, or one whose input the request
555+ * supplies (an execution, a structured response), ends instead and reports this.
556+ *
557+ * A steeringId belongs to the run of the chat that first accepted it: a retry naming another
558+ * run of the chat reads that run's disposition.
559+ */
560+ export const SteerV2Response = z . discriminatedUnion ( "status" , [
561+ z . strictObject ( { steeringId : z . string ( ) , status : z . literal ( "queued" ) } ) ,
562+ z . strictObject ( {
563+ steeringId : z . string ( ) ,
564+ status : z . literal ( "applied" ) ,
565+ eventSeq : z . number ( ) . int ( ) . positive ( ) ,
566+ textOffset : z . number ( ) . int ( ) . nonnegative ( ) ,
567+ } ) ,
568+ z . strictObject ( { steeringId : z . string ( ) , status : z . literal ( "not_applied" ) } ) ,
569+ ] ) ;
570+ export type SteerV2Response = z . infer < typeof SteerV2Response > ;
571+
572+ /** The `run`/`steering_applied` frame: a steer reached the run's model input. */
573+ export interface StreamSteeringApplied {
574+ kind : "steering_applied" ;
575+ steeringId : string ;
576+ /** As in SteerV2Response's `applied`; absent only on frames from workers without steer v2. */
577+ eventSeq ?: number | undefined ;
578+ textOffset ?: number | undefined ;
579+ }
580+
514581/** POST /api/chats/fork — copy a selected conversation snapshot, never live execution. */
515582export const ForkChatRequest = z
516583 . strictObject ( {
0 commit comments