@archboard/codex-realtime-voice 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +32 -41
  2. package/dist/browser.d.mts +1 -3
  3. package/dist/browser.mjs +67 -66
  4. package/dist/{contract-CDS04znV.d.mts → contract-B2ILifH5.d.mts} +3 -3
  5. package/dist/{contract-qg6q9-vH.d.mts → contract-CkitFygd.d.mts} +97 -3054
  6. package/dist/{contract-DkiXnfc8.d.mts → contract-D9_WuSxD.d.mts} +3 -3
  7. package/dist/contract.d.mts +1 -1
  8. package/dist/controllers.d.mts +221 -6
  9. package/dist/controllers.mjs +3 -3
  10. package/dist/{gateway-envelope-DRBUhFx9.d.mts → gateway-envelope-O67wCRD7.d.mts} +3 -2
  11. package/dist/{realtime-state-CTBmCjt1.mjs → gateway-envelope-jUP82Pq1.mjs} +71 -3
  12. package/dist/identity-capabilities-3Q_2tJiT.d.mts +147 -0
  13. package/dist/instructions-B-6HVmoD.mjs +1024 -0
  14. package/dist/{contract-JI3xv17m.d.mts → instructions-C6TkBWcp.d.mts} +14 -998
  15. package/dist/{model-DnitkA24.mjs → model-MSyAviwx.mjs} +1652 -85
  16. package/dist/react.d.mts +1 -1
  17. package/dist/{realtime-contract-wHmSyUIe.d.mts → realtime-contract-C-1bMn-F.d.mts} +1 -22
  18. package/dist/realtime.d.mts +2 -3
  19. package/dist/realtime.mjs +1 -3
  20. package/dist/runtime.d.mts +3 -18
  21. package/dist/runtime.mjs +2 -2
  22. package/dist/schemas.d.mts +3 -13
  23. package/dist/schemas.mjs +1 -1
  24. package/dist/server.d.mts +977 -217
  25. package/dist/server.mjs +17771 -10076
  26. package/dist/{snapshot-BCrCORmt.d.mts → snapshot-DCl2vsJl.d.mts} +9 -154
  27. package/dist/{transport-Bqb8KE5T.mjs → transport-DVUz3EK0.mjs} +17 -13
  28. package/package.json +1 -1
  29. package/dist/app-server-contract-D4E5bibD.mjs +0 -177
  30. package/dist/gateway-envelope-DXTRMB3q.mjs +0 -45
  31. package/dist/instructions-8ACs49yJ.mjs +0 -8980
  32. package/dist/media-state-CNkFo93s.d.mts +0 -215
  33. package/dist/realtime-contract-DwkCluo2.mjs +0 -1167
  34. package/dist/realtime-state-DT4uvrIV.d.mts +0 -16
@@ -1,6 +1,5 @@
1
- import { B as ChildId, F as WireRequestCorrelation, G as OperationId, H as ItemId, J as ThreadId, K as QueuedSubmissionId, L as ApprovalId, N as IdentityAuthority, P as LogicalToolCallCorrelation, U as JsonRpcRequestId, V as DynamicToolCallId, W as LoginId, Y as TurnId, b as VoiceNarrative, q as RealtimeSessionId, z as ChildEpoch } from "./snapshot-BCrCORmt.mjs";
2
- import { a as CodexServerResponseByMethod, n as CodexLoginAccountParams, o as CodexThreadStatusType } from "./contract-qg6q9-vH.mjs";
3
- import { a as RealtimeCorrelationId, c as RealtimeSemanticEvent, f as RealtimeTranscriptRecord, i as RealtimeCorrelation, l as RealtimeServer, o as RealtimeItemId, r as CreateOfferSdp, t as AnswerSdp, u as RealtimeSessionId$1 } from "./realtime-contract-wHmSyUIe.mjs";
1
+ import { _ as RealtimeSessionId, a as WireRequestCorrelation, d as DynamicToolCallId, f as ItemId, g as QueuedSubmissionId, i as LogicalToolCallCorrelation, l as ChildEpoch, m as LoginId, n as IdentityAuthority, p as JsonRpcRequestId, s as ApprovalId, u as ChildId, v as ThreadId, y as TurnId } from "./identity-capabilities-3Q_2tJiT.mjs";
2
+ import { n as CodexLoginAccountParams, r as CodexServerResponseByMethod } from "./contract-CkitFygd.mjs";
4
3
  import { z } from "zod";
5
4
  declare const SessionSourceSchema: z.ZodUnion<readonly [z.ZodEnum<{
6
5
  appServer: "appServer";
@@ -18120,6 +18119,11 @@ type BedrockSetupParams = z.infer<typeof BedrockSetupParamsSchema>;
18120
18119
  * still proved by the current child epoch and committed operation, not this label.
18121
18120
  */
18122
18121
  declare const CODEX_SESSION_THREAD_SOURCE = "vscode";
18122
+ /**
18123
+ * The source that Codex reports on every thread this session starts.
18124
+ * @returns The thread source, `vscode`.
18125
+ */
18126
+ declare function codexSessionThreadSource(): typeof CODEX_SESSION_THREAD_SOURCE;
18123
18127
  /** Branded parameters for one generated Codex request owned by this session. */
18124
18128
  type SessionParams<Method extends ClientRequestMethod = ClientRequestMethod> = CodexSessionRequestParams<Method>;
18125
18129
  type SessionLoginParams = LoginAccountParams | BedrockSetupParams;
@@ -18367,8 +18371,13 @@ declare const ADDITIONAL_CONTEXT_POLICY: {
18367
18371
  };
18368
18372
  };
18369
18373
  type AdditionalContextPolicy = typeof ADDITIONAL_CONTEXT_POLICY;
18370
- type ThreadLinkReason$1 = AdditionalContextPolicy["threadLink"]["reasonPrecedence"][number]["reason"];
18374
+ type ThreadLinkReason = AdditionalContextPolicy["threadLink"]["reasonPrecedence"][number]["reason"];
18371
18375
  type OperationOutcome = Exclude<AdditionalContextPolicy["operation"]["tupleStates"][number]["outcome"], "null">;
18376
+ /**
18377
+ * The reviewed policy of the additional context a host sends with an operation.
18378
+ * @returns The frozen policy.
18379
+ */
18380
+ declare function additionalContextPolicy(): AdditionalContextPolicy;
18372
18381
  type ApprovalFamily = "command_execution" | "file_change" | "user_input" | "elicitation" | "permissions" | "apply_patch" | "exec_command";
18373
18382
  type ApprovalState = "staged" | "pending" | "settled" | "expired" | "cancelled" | "stale" | "outcome_unknown";
18374
18383
  type ApprovalOutcome = "delivered" | "not_delivered" | "outcome_unknown";
@@ -18555,144 +18564,6 @@ interface CodexApprovalBroker {
18555
18564
  }) => Promise<readonly ApprovalSettlement[]>;
18556
18565
  readonly dispose: () => void;
18557
18566
  }
18558
- /** Domain snapshots arrive as complete replacements. The host owns their wording and meaning. */
18559
- interface WorkbenchContextSource {
18560
- readonly read: () => string;
18561
- readonly subscribe: (onChange: () => void, onError: (error: Error) => void) => () => void;
18562
- }
18563
- /** Speakable input is distinct from quiet application context. Neither grants execution authority. */
18564
- interface WorkbenchVoiceInput {
18565
- readonly text: string;
18566
- readonly channel: "speech" | "context";
18567
- }
18568
- /** How voice starts for a narrative, or for an ordinary session with null. */
18569
- interface WorkbenchVoicePolicy<Narrative = unknown> {
18570
- readonly start: (narrative: Narrative | null) => {
18571
- readonly prompt: string;
18572
- readonly suppressCoordinatorSpeech: boolean;
18573
- readonly delegationAckFiller: boolean;
18574
- };
18575
- readonly subscribe?: (narrative: Narrative | null, listener: (input: WorkbenchVoiceInput) => void) => () => void;
18576
- }
18577
- interface CodexRealtimeBinding {
18578
- readonly child: ChildId;
18579
- readonly epoch: ChildEpoch;
18580
- readonly linkedThreadId: ThreadId;
18581
- readonly coordinatorThreadId: ThreadId;
18582
- }
18583
- interface CodexRealtimeGeneration extends CodexRealtimeBinding {
18584
- readonly browserSessionId: RealtimeSessionId$1;
18585
- readonly browserCorrelationId: RealtimeCorrelationId;
18586
- readonly wireSessionId: RealtimeSessionId;
18587
- /** What the coordinator context read at this realtime start, byte for byte. */
18588
- readonly startBrief: string;
18589
- }
18590
- interface CodexRealtimeAdapterOptions {
18591
- readonly session: Pick<CodexSession, "realtimeStart" | "realtimeAppendText" | "realtimeAppendSpeech" | "realtimeStop" | "timelineListPage" | "threadInjectItems">;
18592
- readonly identity: IdentityAuthority;
18593
- /** What the coordinator is told about the host page; read once at a start as its brief. */
18594
- readonly coordinatorContext: WorkbenchContextSource;
18595
- readonly voice: WorkbenchVoicePolicy;
18596
- readonly currentBinding: () => CodexRealtimeBinding | null;
18597
- /**
18598
- * Hears what a start sent and how Codex answered it, for whoever keeps a trace of voice
18599
- * starts. Sizes, identities and messages only; never the SDP, a prompt or any host content.
18600
- */
18601
- readonly trace?: (stage: string, detail: Readonly<Record<string, string | number | boolean | null>>) => void;
18602
- }
18603
- /** Server-owned protocol half; remote MediaStream attachment remains browser-local. */
18604
- interface CodexRealtimeAdapter extends Omit<RealtimeServer, "attachRemoteMedia" | "createOffer"> {
18605
- /**
18606
- * Accept the browser's offer and start the session, as an ordinary voice session or, given a
18607
- * narrative, one started to present it.
18608
- */
18609
- readonly createOffer: (offer: CreateOfferSdp, narrative?: VoiceNarrative | null) => Promise<AnswerSdp>;
18610
- readonly onNotification: SessionNotificationHandler;
18611
- readonly transcript: () => readonly RealtimeTranscriptRecord[];
18612
- readonly generation: () => CodexRealtimeGeneration | null;
18613
- /** The narrative the live session presents, or null with none or an ordinary one. */
18614
- readonly narrative: () => VoiceNarrative | null;
18615
- readonly dispose: () => void;
18616
- }
18617
- /** The execution facts a thread reads; any other key is the host's own data, which these never are. */
18618
- declare const WorkbenchExecutionContextSchema: z.ZodObject<{
18619
- threadLink: z.ZodObject<{
18620
- state: z.ZodEnum<{
18621
- executable: "executable";
18622
- inspect_only: "inspect_only";
18623
- unbound: "unbound";
18624
- }>;
18625
- reason: z.ZodNullable<z.ZodEnum<{
18626
- direct_input_false: "direct_input_false";
18627
- direct_input_unknown: "direct_input_unknown";
18628
- prior_epoch: "prior_epoch";
18629
- stale_child: "stale_child";
18630
- thread_list_ambiguous: "thread_list_ambiguous";
18631
- thread_list_missing: "thread_list_missing";
18632
- thread_loaded_list_ambiguous: "thread_loaded_list_ambiguous";
18633
- thread_loaded_list_missing: "thread_loaded_list_missing";
18634
- thread_source_custom: "thread_source_custom";
18635
- thread_source_subagent: "thread_source_subagent";
18636
- thread_source_unknown: "thread_source_unknown";
18637
- thread_start_outcome_unknown: "thread_start_outcome_unknown";
18638
- thread_status_not_loaded: "thread_status_not_loaded";
18639
- thread_status_system_error: "thread_status_system_error";
18640
- unknown_provenance: "unknown_provenance";
18641
- }>>;
18642
- }, z.core.$strict>;
18643
- child: z.ZodObject<{
18644
- id: z.ZodString;
18645
- epoch: z.ZodString;
18646
- }, z.core.$strict>;
18647
- workhorse: z.ZodObject<{
18648
- threadId: z.ZodNullable<z.ZodString>;
18649
- turnId: z.ZodNullable<z.ZodString>;
18650
- }, z.core.$strict>;
18651
- coordinator: z.ZodObject<{
18652
- threadId: z.ZodNullable<z.ZodString>;
18653
- realtimeSessionId: z.ZodNullable<z.ZodString>;
18654
- }, z.core.$strict>;
18655
- brief: z.ZodObject<{
18656
- text: z.ZodString;
18657
- capturedAtMs: z.ZodNumber;
18658
- freshUntilMs: z.ZodNumber;
18659
- }, z.core.$strict>;
18660
- operation: z.ZodUnion<readonly [z.ZodObject<{
18661
- id: z.ZodNull;
18662
- kind: z.ZodNull;
18663
- rpc: z.ZodNull;
18664
- outcome: z.ZodNull;
18665
- }, z.core.$strict>, z.ZodObject<{
18666
- id: z.ZodString;
18667
- kind: z.ZodEnum<{
18668
- composer_message: "composer_message";
18669
- create_thread_initial_turn: "create_thread_initial_turn";
18670
- delegate_to_workhorse: "delegate_to_workhorse";
18671
- fork_thread_initial_turn: "fork_thread_initial_turn";
18672
- send_message_to_thread: "send_message_to_thread";
18673
- spoken_approval_classifier: "spoken_approval_classifier";
18674
- steer_workhorse: "steer_workhorse";
18675
- workhorse_outcome_report: "workhorse_outcome_report";
18676
- }>;
18677
- rpc: z.ZodEnum<{
18678
- "turn/start": "turn/start";
18679
- "turn/steer": "turn/steer";
18680
- }>;
18681
- outcome: z.ZodNullable<z.ZodEnum<{
18682
- delivered: "delivered";
18683
- not_delivered: "not_delivered";
18684
- outcome_unknown: "outcome_unknown";
18685
- }>>;
18686
- }, z.core.$strict>]>;
18687
- }, z.core.$strip>;
18688
- type WorkbenchExecutionContext = z.infer<typeof WorkbenchExecutionContextSchema>;
18689
- type WorkbenchOperation = WorkbenchExecutionContext["operation"];
18690
- /** The host owns wire conversion. Its payload never changes execution facts. */
18691
- interface WorkbenchContextCodec {
18692
- readonly key: string;
18693
- readonly turnTrigger: string;
18694
- readonly encode: (context: WorkbenchExecutionContext) => string;
18695
- }
18696
18567
  /**
18697
18568
  * How a host names itself: to Codex on every thread and tool, and to the user in what the agents
18698
18569
  * are told. Codex records the service name and thread source on every thread the voice agent
@@ -18743,859 +18614,4 @@ interface WorkbenchInstructions {
18743
18614
  readonly coordinator: WorkbenchThreadProfile;
18744
18615
  readonly workhorse: WorkbenchThreadProfile;
18745
18616
  }
18746
- declare const CODEX_EPOCH_MANIFEST_SCHEMA: 1;
18747
- declare const EPOCH_OPERATION_STATUSES: readonly ["staged", "committed", "rolled_back", "inspect_only"];
18748
- declare const EPOCH_OPERATION_OUTCOMES: readonly ["pending", "delivered", "not_delivered", "outcome_unknown"];
18749
- type EpochOperationStatus = (typeof EPOCH_OPERATION_STATUSES)[number];
18750
- type EpochOperationOutcome = (typeof EPOCH_OPERATION_OUTCOMES)[number];
18751
- interface EpochOperationCorrelation {
18752
- readonly childId: ChildId;
18753
- readonly epoch: ChildEpoch;
18754
- readonly operationId: string;
18755
- }
18756
- interface EpochOperationDescriptor {
18757
- readonly id: string;
18758
- readonly kind: string;
18759
- readonly rpc: string | null;
18760
- }
18761
- interface EpochProvenance {
18762
- readonly childId: ChildId;
18763
- readonly epoch: ChildEpoch;
18764
- readonly threadId: ThreadId | null;
18765
- readonly turnId: TurnId | null;
18766
- readonly threadSource: string | null;
18767
- readonly workspaceRoot: string;
18768
- readonly instructionHash: string;
18769
- readonly manifestHash: string;
18770
- readonly confirmedAtMs: number | null;
18771
- }
18772
- interface EpochOperationRecord {
18773
- readonly correlation: EpochOperationCorrelation;
18774
- readonly operation: EpochOperationDescriptor;
18775
- readonly status: EpochOperationStatus;
18776
- readonly outcome: EpochOperationOutcome;
18777
- readonly provenance: EpochProvenance;
18778
- readonly reason: string | null;
18779
- readonly createdAtMs: number;
18780
- readonly updatedAtMs: number;
18781
- }
18782
- interface ActiveEpoch {
18783
- readonly childId: ChildId;
18784
- readonly epoch: ChildEpoch;
18785
- readonly operationId: string;
18786
- }
18787
- interface EpochManifestPayload {
18788
- readonly schema: typeof CODEX_EPOCH_MANIFEST_SCHEMA;
18789
- readonly revision: number;
18790
- readonly activeEpoch: ActiveEpoch | null;
18791
- readonly records: readonly EpochOperationRecord[];
18792
- }
18793
- interface EpochManifest extends EpochManifestPayload {
18794
- readonly integrity: {
18795
- readonly algorithm: "sha256";
18796
- readonly digest: string;
18797
- };
18798
- }
18799
- interface EpochCasToken {
18800
- readonly revision: number;
18801
- readonly bytesHash: string | null;
18802
- }
18803
- interface EpochSnapshot {
18804
- readonly manifest: EpochManifest;
18805
- readonly cas: EpochCasToken;
18806
- readonly manifestPath: string;
18807
- }
18808
- interface EpochStageInput {
18809
- readonly childId: ChildId;
18810
- readonly epoch: ChildEpoch;
18811
- readonly operationId: string;
18812
- readonly kind: string;
18813
- readonly rpc?: string | null;
18814
- readonly workspaceRoot: string;
18815
- readonly instructionHash: string;
18816
- readonly manifestHash: string;
18817
- readonly expected?: EpochCasToken;
18818
- }
18819
- interface EpochConfirmation {
18820
- readonly threadId?: ThreadId | null;
18821
- readonly turnId?: TurnId | null;
18822
- readonly threadSource?: string | null;
18823
- readonly confirmedAtMs?: number;
18824
- }
18825
- interface EpochTransaction {
18826
- readonly record: EpochOperationRecord;
18827
- readonly cas: EpochCasToken;
18828
- }
18829
- interface EpochExecutionRequest {
18830
- readonly childId: ChildId;
18831
- readonly epoch: ChildEpoch;
18832
- readonly operationId: string;
18833
- readonly threadId?: ThreadId | null;
18834
- }
18835
- interface EpochExecutionProof {
18836
- readonly record: EpochOperationRecord;
18837
- readonly manifestRevision: number;
18838
- }
18839
- interface CodexEpochStore {
18840
- readonly rootDirectory: string;
18841
- readonly manifestPath: string;
18842
- readonly snapshot: () => EpochSnapshot;
18843
- readonly stageEpoch: (input: EpochStageInput) => EpochTransaction;
18844
- readonly startEpoch: (input: EpochStageInput) => EpochOperationRecord;
18845
- readonly commitEpoch: (transaction: EpochTransaction, confirmation?: EpochConfirmation) => EpochOperationRecord;
18846
- readonly stageOperation: (input: EpochStageInput) => EpochTransaction;
18847
- readonly commitOperation: (transaction: EpochTransaction, confirmation?: EpochConfirmation) => EpochOperationRecord;
18848
- readonly rollbackOperation: (transaction: EpochTransaction, reason: string) => EpochOperationRecord;
18849
- readonly markOutcomeUnknown: (transaction: EpochTransaction, reason: string, confirmation?: EpochConfirmation) => EpochOperationRecord;
18850
- readonly confirmOutcome: (transaction: EpochTransaction, confirmation: EpochConfirmation) => EpochOperationRecord;
18851
- readonly assertCurrent: (request: EpochExecutionRequest) => EpochExecutionProof;
18852
- readonly canExecute: (request: EpochExecutionRequest) => boolean;
18853
- readonly close: () => void;
18854
- }
18855
- declare const DYNAMIC_TOOL_REFUSAL_REASONS: readonly ["invalid_call", "not_ready", "not_loaded", "not_controllable", "system_error", "stale_child", "prior_epoch", "unknown_provenance", "approval_declined", "cycle", "busy", "expired", "unsupported"];
18856
- type DynamicToolRefusalReason = (typeof DYNAMIC_TOOL_REFUSAL_REASONS)[number];
18857
- /** Responses for calls that passed the coordinator's identity/manifest checks. */
18858
- declare const ValidDynamicToolResponseSchema: z.ZodObject<{
18859
- contentItems: z.ZodTuple<[z.ZodObject<{
18860
- type: z.ZodLiteral<"inputText">;
18861
- text: z.ZodString;
18862
- }, z.core.$strict>], null>;
18863
- success: z.ZodLiteral<true>;
18864
- }, z.core.$strict>;
18865
- /** Responses for calls rejected before a tool call could be established. */
18866
- declare const UnknownDynamicToolResponseSchema: z.ZodObject<{
18867
- contentItems: z.ZodTuple<[z.ZodObject<{
18868
- type: z.ZodLiteral<"inputText">;
18869
- text: z.ZodString;
18870
- }, z.core.$strict>], null>;
18871
- success: z.ZodLiteral<false>;
18872
- }, z.core.$strict>;
18873
- /**
18874
- * The reviewed settings that a coordinator turn must carry. How the host names itself to Codex
18875
- * (service name and thread source) is not here: it is the host's own, on its thread profile.
18876
- */
18877
- declare const COORDINATOR_IDENTITY: {
18878
- readonly role: "coordinator";
18879
- readonly model: "gpt-6-sol";
18880
- readonly effort: "low";
18881
- readonly allowProviderModelFallback: false;
18882
- readonly config: {
18883
- readonly features: {
18884
- readonly realtime_conversation: true;
18885
- };
18886
- readonly project_doc_max_bytes: 0;
18887
- };
18888
- readonly ephemeral: false;
18889
- readonly historyMode: "paginated";
18890
- readonly sessionStartSource: "startup";
18891
- readonly dynamicTools: readonly ["workhorse", "voice"];
18892
- readonly experimentalRawEvents: false;
18893
- };
18894
- type ThreadLinkReason = ThreadLinkReason$1;
18895
- type ThreadLinkReasonCode = ThreadLinkReason;
18896
- type ThreadLinkStatus = SessionThread["status"]["type"];
18897
- type ThreadLinkSource = SessionThreadSource;
18898
- type ThreadLinkAllowedSource = Extract<ThreadLinkSource, "cli" | "vscode" | "exec" | "appServer">;
18899
- type ThreadLinkExecutableStatus = Exclude<ThreadLinkStatus, "notLoaded" | "systemError">;
18900
- type ThreadLinkCurrentEpoch = Pick<ActiveEpoch, "childId" | "epoch">;
18901
- /** A committed epoch record or a proof returned by `assertCurrent`. */
18902
- type ThreadLinkEpochProof = EpochOperationRecord | EpochExecutionProof;
18903
- /** The identity and durable ownership evidence captured by a thread link. */
18904
- interface ThreadLinkTarget {
18905
- readonly threadId: ThreadId;
18906
- readonly childId: ChildId | null;
18907
- readonly epoch: ChildEpoch | null;
18908
- readonly operationId?: string;
18909
- readonly provenance?: ThreadLinkEpochProof | null;
18910
- }
18911
- interface ThreadLinkObservation {
18912
- readonly persisted: boolean;
18913
- readonly persistedRows: number;
18914
- readonly loaded: boolean;
18915
- readonly loadedOccurrences: number;
18916
- readonly source: ThreadLinkSource;
18917
- readonly status: ThreadLinkStatus;
18918
- readonly canAcceptDirectInput: boolean | null;
18919
- }
18920
- interface ExecutableThreadLink {
18921
- readonly kind: "thread_link";
18922
- readonly state: "executable";
18923
- readonly childId: ChildId;
18924
- readonly epoch: ChildEpoch;
18925
- readonly threadId: ThreadId;
18926
- readonly source: ThreadLinkAllowedSource;
18927
- readonly status: ThreadLinkExecutableStatus;
18928
- readonly loaded: true;
18929
- readonly canAcceptDirectInput: true;
18930
- readonly reason: null;
18931
- }
18932
- interface InspectOnlyThreadLink {
18933
- readonly kind: "thread_link";
18934
- readonly state: "inspect_only";
18935
- readonly childId: null;
18936
- readonly epoch: null;
18937
- readonly threadId: ThreadId;
18938
- readonly source: ThreadLinkSource;
18939
- readonly status: ThreadLinkStatus;
18940
- readonly loaded: boolean;
18941
- /** False for every inspect-only link, including an observed null capability. */
18942
- readonly canAcceptDirectInput: false;
18943
- readonly reason: ThreadLinkReason;
18944
- }
18945
- type ThreadLink = ExecutableThreadLink | InspectOnlyThreadLink;
18946
- interface UnboundThreadLink {
18947
- readonly kind: "thread_link";
18948
- readonly state: "unbound";
18949
- readonly childId: null;
18950
- readonly epoch: null;
18951
- readonly threadId: null;
18952
- readonly source: null;
18953
- readonly status: "notLoaded";
18954
- readonly loaded: false;
18955
- readonly canAcceptDirectInput: false;
18956
- readonly reason: null;
18957
- }
18958
- type ThreadLinkSnapshot = ThreadLink | UnboundThreadLink;
18959
- interface ThreadLinkClassification {
18960
- readonly link: ThreadLink;
18961
- readonly thread: SessionThread | null;
18962
- readonly observation: ThreadLinkObservation;
18963
- readonly currentEpoch: ThreadLinkCurrentEpoch | null;
18964
- /** The matching proof read from the live durable epoch authority, if any. */
18965
- readonly proof: EpochExecutionProof | null;
18966
- }
18967
- interface ThreadLinkCasToken {
18968
- readonly revision: number;
18969
- readonly linkKey: string;
18970
- readonly childId: ChildId | null;
18971
- readonly epoch: ChildEpoch | null;
18972
- readonly threadId: ThreadId | null;
18973
- }
18974
- interface ThreadLinkBindingSnapshot {
18975
- readonly linkKey: string;
18976
- readonly revision: number;
18977
- readonly link: ThreadLinkSnapshot;
18978
- readonly cas: ThreadLinkCasToken;
18979
- }
18980
- /** Public CAS accepts only unbound or explicitly inspect-only links. */
18981
- type ThreadLinkNonExecutableSnapshot = InspectOnlyThreadLink | UnboundThreadLink;
18982
- interface ThreadLinkCompareAndSwapInput {
18983
- readonly linkKey: string;
18984
- readonly expected: ThreadLinkCasToken | null;
18985
- readonly next: ThreadLinkNonExecutableSnapshot;
18986
- }
18987
- interface ThreadLinkBindingStore {
18988
- readonly snapshot: (linkKey: string) => ThreadLinkBindingSnapshot;
18989
- readonly read: (linkKey: string) => ThreadLinkBindingSnapshot;
18990
- readonly compareAndSwap: (input: ThreadLinkCompareAndSwapInput) => ThreadLinkBindingSnapshot;
18991
- readonly clear: (linkKey: string, expected: ThreadLinkCasToken | null) => ThreadLinkBindingSnapshot;
18992
- }
18993
- interface CodexThreadLinkClassifier {
18994
- readonly classify: (target: ThreadLinkTarget) => Promise<ThreadLinkClassification>;
18995
- }
18996
- interface CodexThreadLinkPort extends CodexThreadLinkClassifier, ThreadLinkBindingStore {
18997
- /** Classify twice through the live authorities, then adopt the fresh result by CAS. */
18998
- readonly classifyAndBind: (linkKey: string, expected: ThreadLinkCasToken | null, target: ThreadLinkTarget) => Promise<ThreadLinkBindingSnapshot>;
18999
- }
19000
- /**
19001
- * What became of a thread given up: Codex's answer to its unsubscribe, or why the thread could not
19002
- * be read or unsubscribed. The thread keeps its rollout either way.
19003
- */
19004
- type ThreadUnload = {
19005
- readonly threadId: ThreadId;
19006
- readonly outcome: SessionResponse<"thread/unsubscribe">["status"];
19007
- } | {
19008
- readonly threadId: ThreadId;
19009
- readonly outcome: "failed";
19010
- readonly message: string;
19011
- };
19012
- type CoordinatorStartResponse = SessionResponse<"thread/start">;
19013
- type CoordinatorApprovalPolicy = CoordinatorStartResponse["approvalPolicy"];
19014
- type CoordinatorApprovalsReviewer = CoordinatorStartResponse["approvalsReviewer"];
19015
- type CoordinatorSandboxPolicy = CoordinatorStartResponse["sandbox"];
19016
- type CoordinatorPermissionProfile = CoordinatorStartResponse["activePermissionProfile"];
19017
- interface CoordinatorConfiguredSettings {
19018
- readonly model: typeof COORDINATOR_IDENTITY.model;
19019
- readonly effort: typeof COORDINATOR_IDENTITY.effort;
19020
- readonly serviceTier: "priority" | null;
19021
- }
19022
- interface CoordinatorEffectiveSettings {
19023
- readonly model: string;
19024
- readonly effort: CoordinatorStartResponse["reasoningEffort"];
19025
- readonly serviceTier: string | null;
19026
- }
19027
- /** Settings are server facts, not a second mutable settings authority. */
19028
- interface CoordinatorSettings {
19029
- readonly configured: CoordinatorConfiguredSettings;
19030
- readonly effective: CoordinatorEffectiveSettings;
19031
- readonly approvalPolicy: CoordinatorApprovalPolicy;
19032
- readonly approvalsReviewer: CoordinatorApprovalsReviewer;
19033
- readonly sandboxPolicy: CoordinatorSandboxPolicy;
19034
- readonly activePermissionProfile: CoordinatorPermissionProfile;
19035
- }
19036
- interface CoordinatorReviewHashes {
19037
- readonly instructionHash: string;
19038
- /** A stable digest over both reviewed dynamic-tool manifest digests. */
19039
- readonly catalogueHash: string;
19040
- readonly workhorseCatalogueHash: string;
19041
- readonly voiceCatalogueHash: string;
19042
- readonly settingsHash: string;
19043
- }
19044
- /** The serializable evidence the composition root may retain across reload. */
19045
- interface CoordinatorPersistedState {
19046
- readonly childId: ChildId;
19047
- readonly epoch: ChildEpoch;
19048
- readonly threadId: ThreadId;
19049
- readonly operationId: string;
19050
- readonly review: CoordinatorReviewHashes;
19051
- readonly settings: CoordinatorSettings;
19052
- }
19053
- type CoordinatorLifecycleState = "unbound" | "starting" | "ready" | "inspect_only" | "failed";
19054
- interface CoordinatorCapabilityPolicy {
19055
- readonly web: true;
19056
- readonly shell: true;
19057
- readonly repository: true;
19058
- readonly approvals: true;
19059
- readonly sustainedWork: "instruction_policy";
19060
- }
19061
- interface CoordinatorSnapshot {
19062
- readonly state: CoordinatorLifecycleState;
19063
- readonly threadId: ThreadId | null;
19064
- readonly childId: ChildId | null;
19065
- readonly epoch: ChildEpoch | null;
19066
- readonly operationId: string | null;
19067
- readonly configured: CoordinatorConfiguredSettings | null;
19068
- readonly effective: CoordinatorEffectiveSettings | null;
19069
- readonly approvalPolicy: CoordinatorApprovalPolicy | null;
19070
- readonly approvalsReviewer: CoordinatorApprovalsReviewer | null;
19071
- readonly sandboxPolicy: CoordinatorSandboxPolicy | null;
19072
- readonly activePermissionProfile: CoordinatorPermissionProfile | null;
19073
- readonly review: CoordinatorReviewHashes | null;
19074
- readonly capabilities: CoordinatorCapabilityPolicy;
19075
- readonly persistence: CoordinatorPersistedState | null;
19076
- readonly reason: string | null;
19077
- }
19078
- interface CoordinatorEnsureInput {
19079
- /** A fresh server-issued operation id is required for a new or replacement start. */
19080
- readonly operationId?: string;
19081
- /** Undefined uses the coordinator's current retained evidence; null clears it. */
19082
- readonly persisted?: CoordinatorPersistedState | null;
19083
- }
19084
- /** What became of the thread a replacement retired, once it was unsubscribed or could not be. */
19085
- type CoordinatorRetirement = ThreadUnload;
19086
- interface CoordinatorReplaceInput {
19087
- /** The fresh server-issued operation id the replacement start runs under. */
19088
- readonly operationId: string;
19089
- /**
19090
- * Told once what became of the retired thread, after its voice session closed and no turn runs
19091
- * on it. Never told when the replacement failed, because nothing was retired.
19092
- */
19093
- readonly onRetired: (retirement: CoordinatorRetirement) => void;
19094
- }
19095
- interface CodexCoordinator {
19096
- readonly ensure: (input?: CoordinatorEnsureInput) => Promise<CoordinatorSnapshot>;
19097
- /** Start a fresh coordinator in place of the current one, which stays until it is ready. */
19098
- readonly replace: (input: CoordinatorReplaceInput) => Promise<CoordinatorSnapshot>;
19099
- readonly snapshot: () => CoordinatorSnapshot;
19100
- readonly persisted: () => CoordinatorPersistedState | null;
19101
- readonly onNotification: (event: TransportServerNotification) => void;
19102
- }
19103
- /** The only queue operations exposed to workbench callers. */
19104
- declare const WORKHORSE_QUEUE_OPERATIONS: readonly ["list", "add", "update", "delete", "reorder", "start"];
19105
- type WorkhorseQueueOperation = (typeof WORKHORSE_QUEUE_OPERATIONS)[number];
19106
- type WorkhorseQueueMutation = Exclude<WorkhorseQueueOperation, "list">;
19107
- interface QueueListResult {
19108
- readonly operation: "list";
19109
- readonly queue: QueueSnapshot;
19110
- }
19111
- interface QueueEffectContext {
19112
- readonly operation: WorkhorseQueueMutation;
19113
- readonly target: SessionQueuedSubmission | null;
19114
- }
19115
- type QueueBeforeEffect = (context: QueueEffectContext) => void | Promise<void>;
19116
- interface QueueAddRequest<OperationIdValue extends string> {
19117
- readonly operationId: OperationIdValue;
19118
- readonly prompt: string;
19119
- readonly beforeEffect?: QueueBeforeEffect;
19120
- }
19121
- interface QueueUpdateRequest<OperationIdValue extends string> {
19122
- readonly operationId: OperationIdValue;
19123
- readonly submissionId: QueuedSubmissionId;
19124
- readonly prompt: string;
19125
- readonly beforeEffect?: QueueBeforeEffect;
19126
- }
19127
- interface QueueDeleteRequest<OperationIdValue extends string> {
19128
- readonly operationId: OperationIdValue;
19129
- readonly submissionId: QueuedSubmissionId;
19130
- readonly beforeEffect?: QueueBeforeEffect;
19131
- }
19132
- interface QueueReorderRequest<OperationIdValue extends string> {
19133
- readonly operationId: OperationIdValue;
19134
- readonly orderedSubmissionIds: readonly QueuedSubmissionId[];
19135
- readonly beforeEffect?: QueueBeforeEffect;
19136
- }
19137
- interface QueueStartRequest<OperationIdValue extends string> {
19138
- readonly operationId: OperationIdValue;
19139
- readonly submissionId: QueuedSubmissionId;
19140
- readonly beforeEffect?: QueueBeforeEffect;
19141
- }
19142
- type QueueSnapshot = readonly SessionQueuedSubmission[];
19143
- type QueueMutationOutcome = "delivered" | "not_delivered" | "outcome_unknown";
19144
- interface QueueMutationResult<Operation extends WorkhorseQueueMutation, OperationIdValue extends string> {
19145
- readonly operation: Operation;
19146
- readonly operationId: OperationIdValue;
19147
- readonly outcome: QueueMutationOutcome;
19148
- readonly queue: QueueSnapshot;
19149
- }
19150
- type QueueAddResult<OperationIdValue extends string> = QueueMutationResult<"add", OperationIdValue>;
19151
- type QueueUpdateResult<OperationIdValue extends string> = QueueMutationResult<"update", OperationIdValue>;
19152
- type QueueDeleteResult<OperationIdValue extends string> = QueueMutationResult<"delete", OperationIdValue>;
19153
- type QueueReorderResult<OperationIdValue extends string> = QueueMutationResult<"reorder", OperationIdValue>;
19154
- type QueueStartResult<OperationIdValue extends string> = QueueMutationResult<"start", OperationIdValue> & {
19155
- readonly clientUserMessageId: string;
19156
- readonly turnId: TurnId | null;
19157
- };
19158
- interface CodexWorkhorseQueue<OperationIdValue extends string> {
19159
- readonly list: () => Promise<QueueListResult>;
19160
- readonly add: (request: QueueAddRequest<OperationIdValue>) => Promise<QueueAddResult<OperationIdValue>>;
19161
- readonly update: (request: QueueUpdateRequest<OperationIdValue>) => Promise<QueueUpdateResult<OperationIdValue>>;
19162
- readonly delete: (request: QueueDeleteRequest<OperationIdValue>) => Promise<QueueDeleteResult<OperationIdValue>>;
19163
- readonly reorder: (request: QueueReorderRequest<OperationIdValue>) => Promise<QueueReorderResult<OperationIdValue>>;
19164
- readonly start: (request: QueueStartRequest<OperationIdValue>) => Promise<QueueStartResult<OperationIdValue>>;
19165
- /** Close admission and wait for every operation accepted before this call. */
19166
- readonly shutdown: () => Promise<void>;
19167
- }
19168
- /** The only four operations the coordinator may dispatch to its workhorse. */
19169
- declare const WORKHORSE_OPERATION_NAMES: readonly ["inspect_workhorse", "delegate_to_workhorse", "manage_workhorse_queue", "steer_workhorse"];
19170
- type WorkhorseOperationName = (typeof WORKHORSE_OPERATION_NAMES)[number];
19171
- type WorkhorseOperationRpc = "turn/start" | "turn/steer" | `thread/queue/${WorkhorseQueueMutation}`;
19172
- type WorkhorseOperationDelivery = "pending" | "delivered" | "not_delivered" | "outcome_unknown";
19173
- /** The coordinator call remains an exact, server-validated logical correlation. */
19174
- type WorkhorseCoordinatorCall = LogicalToolCallCorrelation;
19175
- interface InspectWorkhorseRequest {
19176
- readonly call: WorkhorseCoordinatorCall;
19177
- }
19178
- interface DelegateToWorkhorseRequest {
19179
- readonly call: WorkhorseCoordinatorCall;
19180
- /** Reuse this server-issued identity when the dispatcher already owns the effect. */
19181
- readonly operationId?: OperationId;
19182
- readonly input: string;
19183
- readonly transcriptDelta: string;
19184
- }
19185
- type ManageWorkhorseQueueMutationRequest = {
19186
- readonly operation: "add";
19187
- readonly prompt: string;
19188
- } | {
19189
- readonly operation: "update";
19190
- readonly submissionId: QueuedSubmissionId;
19191
- readonly prompt: string;
19192
- } | {
19193
- readonly operation: "delete";
19194
- readonly submissionId: QueuedSubmissionId;
19195
- } | {
19196
- readonly operation: "reorder";
19197
- readonly orderedSubmissionIds: readonly QueuedSubmissionId[];
19198
- } | {
19199
- readonly operation: "start";
19200
- readonly submissionId: QueuedSubmissionId;
19201
- };
19202
- type ManageWorkhorseQueueRequest = {
19203
- readonly call: WorkhorseCoordinatorCall;
19204
- readonly operation: "list";
19205
- } | (ManageWorkhorseQueueMutationRequest & {
19206
- readonly call: WorkhorseCoordinatorCall;
19207
- /** Reuse this server-issued identity when the dispatcher already owns the effect. */
19208
- readonly operationId?: OperationId;
19209
- });
19210
- interface SteerWorkhorseRequest {
19211
- readonly call: WorkhorseCoordinatorCall;
19212
- /** Reuse this server-issued identity when the dispatcher already owns the effect. */
19213
- readonly operationId?: OperationId;
19214
- readonly input: string;
19215
- }
19216
- /** What inspection read about a workhorse. An empty field means Codex reported nothing there. */
19217
- interface InspectWorkhorseResult {
19218
- readonly threadId: ThreadId;
19219
- readonly status: CodexThreadStatusType;
19220
- /** The turn that runs now, as thread/turns/list names it, or null when none runs. */
19221
- readonly activeTurnId: TurnId | null;
19222
- /** The request that started the newest turn, or null when it carried no text. */
19223
- readonly request: string | null;
19224
- /** What the newest turn did last, oldest first. */
19225
- readonly recentProgress: readonly string[];
19226
- /** Every sub-agent the workhorse spawned, at any depth, with its status. */
19227
- readonly subAgents: readonly {
19228
- readonly threadId: ThreadId;
19229
- readonly status: CodexThreadStatusType;
19230
- }[];
19231
- readonly queuedSubmissionIds: readonly QueuedSubmissionId[];
19232
- /**
19233
- * Each read that failed, or that ownership did not allow, so its field above is empty for that
19234
- * reason and not because Codex reported nothing.
19235
- */
19236
- readonly unavailable: readonly ("turns" | "subAgents" | "queue")[];
19237
- }
19238
- interface DelegateToWorkhorseResult {
19239
- readonly mode: "started" | "queued";
19240
- readonly clientUserMessageId: string;
19241
- readonly queuedSubmissionId: QueuedSubmissionId | null;
19242
- readonly turnId: TurnId | null;
19243
- }
19244
- interface ManageWorkhorseQueueResult {
19245
- readonly operation: WorkhorseQueueOperation;
19246
- readonly queuedSubmissionIds: readonly QueuedSubmissionId[];
19247
- }
19248
- interface SteerWorkhorseResult {
19249
- readonly turnId: TurnId;
19250
- readonly delivery: Exclude<WorkhorseOperationDelivery, "pending">;
19251
- }
19252
- interface WorkhorseOperationCorrelation {
19253
- readonly operationId: OperationId;
19254
- readonly childId: ChildId;
19255
- readonly epoch: ChildEpoch;
19256
- readonly coordinatorThreadId: ThreadId;
19257
- readonly coordinatorTurnId: TurnId;
19258
- readonly workhorseThreadId: ThreadId;
19259
- readonly coordinatorCall: WorkhorseCoordinatorCall;
19260
- readonly clientUserMessageId: string | null;
19261
- readonly queuedSubmissionId: QueuedSubmissionId | null;
19262
- readonly turnId: TurnId | null;
19263
- }
19264
- interface WorkhorseOperationEventBase {
19265
- readonly operation: Exclude<WorkhorseOperationName, "inspect_workhorse">;
19266
- readonly queueOperation: WorkhorseQueueMutation | null;
19267
- readonly rpc: WorkhorseOperationRpc;
19268
- readonly correlation: WorkhorseOperationCorrelation;
19269
- readonly queuedSubmissionIds: readonly QueuedSubmissionId[];
19270
- readonly detail: string | null;
19271
- }
19272
- type WorkhorseOperationEvent = (WorkhorseOperationEventBase & {
19273
- readonly type: "accepted";
19274
- readonly outcome: "pending";
19275
- }) | (WorkhorseOperationEventBase & {
19276
- readonly type: "queued";
19277
- readonly outcome: "delivered";
19278
- }) | (WorkhorseOperationEventBase & {
19279
- readonly type: "started";
19280
- readonly outcome: "delivered";
19281
- }) | (WorkhorseOperationEventBase & {
19282
- readonly type: "progress";
19283
- readonly outcome: "delivered";
19284
- }) | (WorkhorseOperationEventBase & {
19285
- readonly type: "attention";
19286
- readonly outcome: "delivered";
19287
- }) | (WorkhorseOperationEventBase & {
19288
- readonly type: "completed";
19289
- readonly outcome: "delivered";
19290
- }) | (WorkhorseOperationEventBase & {
19291
- readonly type: "failed";
19292
- readonly outcome: "delivered" | "not_delivered";
19293
- }) | (WorkhorseOperationEventBase & {
19294
- readonly type: "outcome_unknown";
19295
- readonly outcome: "outcome_unknown";
19296
- });
19297
- type WorkhorseOperationEventListener = (event: WorkhorseOperationEvent) => void;
19298
- interface CodexWorkhorseOperations {
19299
- readonly inspect: (request: InspectWorkhorseRequest) => Promise<InspectWorkhorseResult>;
19300
- readonly delegate: (request: DelegateToWorkhorseRequest) => Promise<DelegateToWorkhorseResult>;
19301
- readonly manageQueue: (request: ManageWorkhorseQueueRequest) => Promise<ManageWorkhorseQueueResult>;
19302
- readonly steer: (request: SteerWorkhorseRequest) => Promise<SteerWorkhorseResult>;
19303
- /** Raw notifications are an input boundary only; no raw event leaves this port. */
19304
- readonly onNotification: (event: TransportServerNotification) => void;
19305
- readonly subscribe: (listener: WorkhorseOperationEventListener) => () => void;
19306
- }
19307
- /**
19308
- * One announced change for the coordinator or the voice of one tab session, under the execution
19309
- * identities the agent read when it was announced. The callbacks capture their own correlation;
19310
- * these identities only scope the change.
19311
- */
19312
- interface ContextAnnouncementSource {
19313
- readonly kind: "context";
19314
- readonly audience: "coordinator" | "voice";
19315
- readonly child: {
19316
- readonly id: ChildId | null;
19317
- readonly epoch: ChildEpoch | null;
19318
- };
19319
- readonly coordinator: {
19320
- readonly threadId: ThreadId | null;
19321
- readonly realtimeSessionId: RealtimeSessionId | null;
19322
- };
19323
- readonly workhorse: {
19324
- readonly threadId: ThreadId | null;
19325
- readonly turnId: TurnId | null;
19326
- };
19327
- readonly threadLink: {
19328
- readonly state: "executable" | "inspect_only" | "unbound";
19329
- readonly reason: string | null;
19330
- };
19331
- readonly context: AnnouncedContext;
19332
- /**
19333
- * The thread that made the change, or null. A change this session's own workhorse or
19334
- * coordinator made is refused as `own_change` before delivery.
19335
- */
19336
- readonly author: string | null;
19337
- }
19338
- /**
19339
- * One event of the linked workhorse thread itself, whoever started the turn: a turn
19340
- * that ended, one that began waiting on the user, or a message the workhorse sent the coordinator.
19341
- */
19342
- interface WorkhorseNewsSource {
19343
- readonly kind: "workhorse_news";
19344
- readonly type: "completed" | "failed" | "stopped" | "waiting" | "message";
19345
- /** Counts news from one observer, so two waits in one turn are two pieces of news. */
19346
- readonly sequence: number;
19347
- readonly childId: ChildId;
19348
- readonly epoch: ChildEpoch;
19349
- readonly coordinatorThreadId: ThreadId;
19350
- readonly workhorseThreadId: ThreadId;
19351
- readonly turnId: TurnId | null;
19352
- /** What a failed turn's error said, or what the workhorse's message said; null otherwise. */
19353
- readonly detail: string | null;
19354
- }
19355
- type CoordinatorCallbackSource = WorkhorseOperationEvent | ContextAnnouncementSource | WorkhorseNewsSource;
19356
- interface CoordinatorCallbackLinkCorrelation {
19357
- readonly binding: ThreadLinkBindingSnapshot;
19358
- readonly target: ThreadLinkTarget;
19359
- /** The checkout the workhorse works in, which news of it names. */
19360
- readonly checkout: string;
19361
- }
19362
- interface CoordinatorCallbackCorrelation {
19363
- readonly operationId: OperationId | null;
19364
- readonly childId: ChildId | null;
19365
- readonly epoch: ChildEpoch | null;
19366
- readonly coordinatorThreadId: ThreadId | null;
19367
- readonly coordinatorTurnId: TurnId | null;
19368
- readonly workhorseThreadId: ThreadId | null;
19369
- readonly turnId: TurnId | null;
19370
- readonly queuedSubmissionId: QueuedSubmissionId | null;
19371
- readonly clientUserMessageId: string | null;
19372
- readonly realtimeSessionId: RealtimeSessionId | null;
19373
- readonly coordinatorCall: LogicalToolCallCorrelation | null;
19374
- readonly workhorseLink: CoordinatorCallbackLinkCorrelation;
19375
- readonly realtimeGeneration: CoordinatorCallbackRealtimeGeneration | null;
19376
- }
19377
- interface CoordinatorOperationCallbackBase {
19378
- readonly kind: "operation";
19379
- readonly operation: Exclude<WorkhorseOperationEvent["operation"], "inspect_workhorse">;
19380
- readonly queueOperation: WorkhorseOperationEvent["queueOperation"];
19381
- readonly rpc: WorkhorseOperationEvent["rpc"];
19382
- readonly correlation: CoordinatorCallbackCorrelation;
19383
- readonly queuedSubmissionIds: readonly QueuedSubmissionId[];
19384
- readonly detail: string | null;
19385
- }
19386
- type CoordinatorOperationCallback = (CoordinatorOperationCallbackBase & {
19387
- readonly type: "accepted";
19388
- readonly outcome: "pending";
19389
- }) | (CoordinatorOperationCallbackBase & {
19390
- readonly type: "queued";
19391
- readonly outcome: "delivered";
19392
- }) | (CoordinatorOperationCallbackBase & {
19393
- readonly type: "started";
19394
- readonly outcome: "delivered";
19395
- }) | (CoordinatorOperationCallbackBase & {
19396
- readonly type: "progress";
19397
- readonly outcome: "delivered";
19398
- }) | (CoordinatorOperationCallbackBase & {
19399
- readonly type: "attention";
19400
- readonly outcome: "delivered";
19401
- }) | (CoordinatorOperationCallbackBase & {
19402
- readonly type: "completed";
19403
- readonly outcome: "delivered";
19404
- }) | (CoordinatorOperationCallbackBase & {
19405
- readonly type: "failed";
19406
- readonly outcome: "delivered" | "not_delivered";
19407
- }) | (CoordinatorOperationCallbackBase & {
19408
- readonly type: "outcome_unknown";
19409
- readonly outcome: "outcome_unknown";
19410
- });
19411
- /**
19412
- * What a callback carries of one announced change: its identity, its freshness and the host's
19413
- * words. A change is identified by its feed and sequence; two with the same identity share one
19414
- * delivery.
19415
- */
19416
- interface AnnouncedContext {
19417
- /** The host feed the change belongs to. Changes of two feeds never coalesce. */
19418
- readonly feedId: string;
19419
- readonly sequence: number;
19420
- /** When the host captured the change; the delivery record's freshness starts here. */
19421
- readonly capturedAtMs: number;
19422
- /** Until when the change is fresh; the delivery record's freshness ends here. */
19423
- readonly freshUntilMs: number;
19424
- /** What the change is about: a later one of the same feed and topic replaces it while it waits. */
19425
- readonly topic: string | null;
19426
- /** The words to tell, or null when the host withheld them. */
19427
- readonly text: string | null;
19428
- /** Why the host told nothing, or null. */
19429
- readonly withheld: string | null;
19430
- /** Whether the voice answers the words now, rather than keeping them as quiet context. */
19431
- readonly speech: boolean;
19432
- }
19433
- /** One normalized announced change, delivered to the coordinator or to the voice. */
19434
- interface CoordinatorContextCallback {
19435
- readonly kind: "context";
19436
- readonly audience: ContextAnnouncementSource["audience"];
19437
- readonly correlation: CoordinatorCallbackCorrelation;
19438
- readonly threadLinkState: "executable" | "inspect_only" | "unbound";
19439
- readonly threadLinkReason: string | null;
19440
- readonly context: AnnouncedContext;
19441
- }
19442
- /** Workhorse news about the linked workhorse thread, as the coordinator is given it. */
19443
- interface CoordinatorWorkhorseNewsCallback {
19444
- readonly kind: "workhorse_news";
19445
- readonly type: WorkhorseNewsSource["type"];
19446
- readonly sequence: number;
19447
- readonly correlation: CoordinatorCallbackCorrelation;
19448
- readonly detail: string | null;
19449
- }
19450
- type CoordinatorCallback = CoordinatorOperationCallback | CoordinatorContextCallback | CoordinatorWorkhorseNewsCallback;
19451
- interface CoordinatorCallbackRealtimeGeneration {
19452
- readonly childId: ChildId;
19453
- readonly epoch: ChildEpoch;
19454
- readonly coordinatorThreadId: ThreadId;
19455
- readonly wireSessionId: RealtimeSessionId;
19456
- readonly browserSessionId: RealtimeSessionId$1;
19457
- readonly browserCorrelationId: RealtimeCorrelationId;
19458
- }
19459
- /**
19460
- * One append to the live voice session: quiet context the voice model may use, or speech it
19461
- * answers now. In a full-duplex session appended text is quiet whatever role it carries; only
19462
- * speakable text is something the voice model says.
19463
- */
19464
- type CoordinatorCallbackRealtimeRequest = {
19465
- readonly generation: CoordinatorCallbackRealtimeGeneration;
19466
- readonly channel: "context";
19467
- readonly params: SessionParams<"thread/realtime/appendText">;
19468
- } | {
19469
- readonly generation: CoordinatorCallbackRealtimeGeneration;
19470
- readonly channel: "speech";
19471
- readonly params: SessionParams<"thread/realtime/appendSpeech">;
19472
- };
19473
- type CoordinatorCallbackDeliveryOutcome = "delivered" | "not_delivered" | "outcome_unknown";
19474
- type CoordinatorCallbackDeliveryPath = "none" | "silent" | "realtime_appendText" |
19475
- /** Speech the voice model answers now, on the host's choice. */
19476
- "realtime_appendSpeech" |
19477
- /** A developer message in the coordinator's thread, which starts no turn. */
19478
- "coordinator_context" |
19479
- /** The coordinator's running turn or a new one, for a workhorse outcome while voice is live. */
19480
- "coordinator_turn";
19481
- type CallbackBufferOverflowReason = "buffer_overflow" | "coalesced";
19482
- type CoordinatorCallbackDeliveryReason = CallbackBufferOverflowReason | "child_exit" | "disposed" | "invalid_callback" | "not_ready" | "own_change" | "prior_epoch" | "stale_child" | "stale_coordinator" | "stale_link" | "stale_session" | "voice_inactive" |
19483
- /** The host told this audience nothing of the change. */
19484
- "withheld" | "recorded_only" | "session_rejected" | "response_lost" | "transport_failure";
19485
- interface CoordinatorCallbackDeliveryBase {
19486
- readonly kind: "coordinator_callback_delivery";
19487
- readonly callback: CoordinatorCallback | null;
19488
- /** Monotonic first-seen order assigned by this callback owner. */
19489
- readonly sourceOrder: number;
19490
- readonly freshness: {
19491
- readonly capturedAtMs: number;
19492
- readonly freshUntilMs: number;
19493
- };
19494
- readonly path: CoordinatorCallbackDeliveryPath;
19495
- readonly reason: CoordinatorCallbackDeliveryReason | null;
19496
- readonly text: string | null;
19497
- readonly realtimeRequest: CoordinatorCallbackRealtimeRequest | null;
19498
- }
19499
- type CoordinatorCallbackDelivery = CoordinatorCallbackDeliveryBase & ({
19500
- readonly attempted: false;
19501
- readonly attemptedAtMs: null;
19502
- readonly outcome: "not_delivered";
19503
- } | {
19504
- readonly attempted: true;
19505
- readonly attemptedAtMs: number;
19506
- readonly outcome: CoordinatorCallbackDeliveryOutcome;
19507
- });
19508
- interface CoordinatorCallbackHistory {
19509
- readonly deliveries: readonly CoordinatorCallbackDelivery[];
19510
- /** Records evicted before the retained suffix for this exact realtime generation. */
19511
- readonly omittedPrefixCount: number;
19512
- }
19513
- interface CoordinatorCallbacks {
19514
- readonly enqueue: (event: CoordinatorCallbackSource) => Promise<CoordinatorCallbackDelivery>;
19515
- /** Takes every Codex notification, and queues the workhorse news among them. */
19516
- readonly onNotification: (event: TransportServerNotification) => void;
19517
- /** Answers the workhorse's tell_coordinator call, queueing its message as workhorse news. */
19518
- readonly onServerRequest: (request: DynamicServerRequest) => void;
19519
- readonly flush: () => Promise<void>;
19520
- readonly inspect: () => readonly CoordinatorCallbackDelivery[];
19521
- readonly inspectHistory: (generation: CoordinatorCallbackRealtimeGeneration) => CoordinatorCallbackHistory;
19522
- readonly get: (event: CoordinatorCallbackSource) => CoordinatorCallbackDelivery | undefined;
19523
- readonly pendingCount: () => number;
19524
- readonly dispose: () => void;
19525
- }
19526
- declare const ResolveSpokenApprovalInputSchema: z.ZodObject<{
19527
- verdict: z.ZodEnum<{
19528
- accept: "accept";
19529
- decline: "decline";
19530
- }>;
19531
- }, z.core.$strict>;
19532
- type ResolveSpokenApprovalInput = z.infer<typeof ResolveSpokenApprovalInputSchema>;
19533
- type SpokenApprovalGateState = "idle" | "awaiting_user" | "classifying" | "awaiting_resolver" | "resolving" | "settled" | "visual_fallback";
19534
- type SpokenApprovalFallbackReason = "approval_unavailable" | "not_eligible" | "coordinator_unavailable" | "realtime_unavailable" | "invalid_context" | "invalid_effect_prompt" | "user_already_spoke" | "missing_user_final" | "assistant_only" | "ambiguous" | "changed_effect" | "stale_realtime_session" | "stale_state" | "timeout" | "classifier_lost" | "resolver_lost" | "child_exit" | "disposed";
19535
- interface SpokenApprovalEffectPrompt {
19536
- readonly itemId: RealtimeItemId;
19537
- readonly sequence: number;
19538
- }
19539
- interface SpokenApprovalClassifierInput {
19540
- /** A server-issued operation identity; this module never mints one. */
19541
- readonly operationId: string;
19542
- /** A server-issued client message identity for the ordinary turn. */
19543
- readonly clientUserMessageId: string;
19544
- readonly context: WorkbenchExecutionContext;
19545
- readonly contextCodec: WorkbenchContextCodec;
19546
- }
19547
- interface SpokenApprovalArmInput {
19548
- readonly requestId: JsonRpcRequestId;
19549
- /** Must equal the broker-derived presentation for this request. */
19550
- readonly effectSummary: string;
19551
- readonly realtime: RealtimeCorrelation;
19552
- readonly effectPrompt: SpokenApprovalEffectPrompt;
19553
- readonly classifier: SpokenApprovalClassifierInput;
19554
- }
19555
- interface SpokenApprovalSnapshot {
19556
- readonly state: SpokenApprovalGateState;
19557
- readonly requestId: JsonRpcRequestId | null;
19558
- readonly approvalId: ApprovalId | null;
19559
- readonly child: ChildId | null;
19560
- readonly epoch: ChildEpoch | null;
19561
- readonly coordinatorThreadId: ThreadId | null;
19562
- readonly realtimeSessionId: RealtimeCorrelation["sessionId"] | null;
19563
- readonly realtimeCorrelationId: RealtimeCorrelation["correlationId"] | null;
19564
- readonly effectSummary: string | null;
19565
- readonly effectFingerprint: string | null;
19566
- readonly effectPromptItemId: RealtimeItemId | null;
19567
- readonly effectPromptSequence: number | null;
19568
- readonly finalUserItemId: RealtimeItemId | null;
19569
- readonly finalUserSequence: number | null;
19570
- readonly finalUserText: string | null;
19571
- readonly operationId: string | null;
19572
- readonly classifierTurnId: TurnId | null;
19573
- readonly resolverCallId: DynamicToolCallId | null;
19574
- readonly expiresAtMs: number | null;
19575
- readonly settlement: ApprovalSettlement | null;
19576
- readonly reason: SpokenApprovalFallbackReason | null;
19577
- }
19578
- type SpokenApprovalToolResult = {
19579
- readonly tag: "ok";
19580
- readonly value: {
19581
- readonly verdict: ResolveSpokenApprovalInput["verdict"];
19582
- readonly settlement: ApprovalSettlement["outcome"];
19583
- };
19584
- } | {
19585
- readonly tag: "refused";
19586
- readonly reason: DynamicToolRefusalReason;
19587
- readonly message: string;
19588
- };
19589
- interface CodexSpokenApprovalGate {
19590
- readonly arm: (input: SpokenApprovalArmInput) => SpokenApprovalSnapshot;
19591
- readonly snapshot: () => SpokenApprovalSnapshot;
19592
- readonly onSemanticEvent: (event: RealtimeSemanticEvent) => void;
19593
- readonly onNotification: (event: TransportServerNotification) => void;
19594
- readonly resolve: (request: DynamicServerRequest) => Promise<SpokenApprovalToolResult>;
19595
- readonly onChildExit: (exit: {
19596
- readonly child: ChildId;
19597
- readonly epoch: ChildEpoch;
19598
- }) => void;
19599
- readonly dispose: () => void;
19600
- }
19601
- export { ApprovalOwnerView as A, DynamicServerRequest as B, WorkbenchExecutionContext as C, CodexRealtimeBinding as D, CodexRealtimeAdapterOptions as E, ADDITIONAL_CONTEXT_POLICY as F, SessionResponsePayloads as G, TransportServerRequest as H, OperationOutcome as I, SessionUserInput as J, SessionThreadItem as K, CODEX_SESSION_THREAD_SOURCE as L, CodexApprovalBroker as M, DeepReadonly as N, WorkbenchContextSource as O, ItemApprovalIdentity as P, CodexSession as R, WorkbenchContextCodec as S, CodexRealtimeAdapter as T, SessionQueuedSubmission as U, TransportServerNotification as V, SessionResponse as W, EpochManifest as _, CodexWorkhorseOperations as a, WorkbenchRoleInstructions as b, CodexThreadLinkPort as c, ThreadLinkReasonCode as d, ThreadLinkSnapshot as f, CodexEpochStore as g, ValidDynamicToolResponseSchema as h, CoordinatorCallbacks as i, ApprovalState as j, WorkbenchVoicePolicy as k, ThreadLinkBindingSnapshot as l, UnknownDynamicToolResponseSchema as m, SpokenApprovalSnapshot as n, CodexWorkhorseQueue as o, ThreadLinkTarget as p, SessionTurn as q, CoordinatorCallbackDeliveryReason as r, CodexCoordinator as s, CodexSpokenApprovalGate as t, ThreadLinkCasToken as u, WorkbenchDynamicTools as v, WorkbenchOperation as w, VoiceAgentIdentity as x, WorkbenchInstructions as y, CodexTransport as z };
18617
+ export { SessionUserInput as C, SessionThreadSource as S, TransportServerNotification as _, ApprovalSettlement as a, SessionResponse as b, OperationOutcome as c, CodexSession as d, SessionNotificationHandler as f, DynamicServerRequest as g, CodexTransport as h, VoiceAgentIdentity as i, ThreadLinkReason as l, codexSessionThreadSource as m, WorkbenchInstructions as n, CodexApprovalBroker as o, SessionParams as p, WorkbenchRoleInstructions as r, DeepReadonly as s, WorkbenchDynamicTools as t, additionalContextPolicy as u, TransportServerRequest as v, SessionThread as x, SessionQueuedSubmission as y };