@github/copilot-sdk 1.0.13-preview.1 → 1.0.13-preview.3

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.
@@ -9,7 +9,17 @@ export type JsonValue = null | boolean | number | string | JsonValue[] | {
9
9
  /**
10
10
  * Union of all session event variants emitted by the Copilot CLI runtime.
11
11
  */
12
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | ContextClearedEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | ModelCallFinishedEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | UIEphemeralQueryEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | ManagedSettingsEnforcedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | FactoryRunUpdatedEvent | FactoryRunStartedEvent | FactoryRunSettledEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
12
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | ContextClearedEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | FusionRouteStartedEvent | FusionRouteFailedEvent | FusionResolvedEvent | FusionCompletedEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantFusionPhaseStartedEvent | AssistantFusionPhaseCompletedEvent | AssistantFusionPhaseFailedEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | ModelCallFinishedEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentConfiguredEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | UIEphemeralQueryEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | ManagedSettingsEnforcedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | FactoryRunUpdatedEvent | FactoryRunStartedEvent | FactoryRunSettledEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
13
+ /**
14
+ * Routing preference used when the session model is `auto`.
15
+ */
16
+ export type AutoTier =
17
+ /** Optimize for efficiency. */
18
+ "efficiency"
19
+ /** Balance efficiency and intelligence. */
20
+ | "balance"
21
+ /** Optimize for intelligence. */
22
+ | "intelligence";
13
23
  /**
14
24
  * Hosting platform type of the repository (github or ado)
15
25
  */
@@ -46,6 +56,16 @@ export type Verbosity =
46
56
  | "medium"
47
57
  /** A more detailed response was requested. */
48
58
  | "high";
59
+ /**
60
+ * The session mode the agent is operating in
61
+ */
62
+ export type SessionMode =
63
+ /** The agent is responding interactively to the user. */
64
+ "interactive"
65
+ /** The agent is preparing a plan before making changes. */
66
+ | "plan"
67
+ /** The agent is working autonomously toward task completion. */
68
+ | "autopilot";
49
69
  /**
50
70
  * Who created the schedule: `user` (an explicit user action such as `/every` or `/after`) or `model` (the agent via the `manage_schedule` tool). Gates whether a scheduled skill that opted out of model invocation may fire: only user-created schedules may.
51
71
  */
@@ -102,16 +122,6 @@ export type ModelChangeSource =
102
122
  | "automatic"
103
123
  /** An SDK or RPC caller selected the model. */
104
124
  | "sdk";
105
- /**
106
- * The session mode the agent is operating in
107
- */
108
- export type SessionMode =
109
- /** The agent is responding interactively to the user. */
110
- "interactive"
111
- /** The agent is preparing a plan before making changes. */
112
- | "plan"
113
- /** The agent is working autonomously toward task completion. */
114
- | "autopilot";
115
125
  /**
116
126
  * Permission mode for the session.
117
127
  */
@@ -181,6 +191,35 @@ export type TaskCompletionOutcome =
181
191
  | "continue"
182
192
  /** Completion cannot proceed without intervention; the active objective is paused when one is identified. */
183
193
  | "blocked";
194
+ /**
195
+ * Kind of turn for which HydraFusion routing is running.
196
+ */
197
+ /** @experimental */
198
+ export type FusionTurnKind =
199
+ /** A user-message turn. */
200
+ "user"
201
+ /** A conversation-compaction turn. */
202
+ | "compaction";
203
+ /**
204
+ * Server-recommended routing behavior for a later HydraFusion turn.
205
+ */
206
+ /** @experimental */
207
+ export type FusionFollowUpAction =
208
+ /** Reuse the durable primary model without routing. */
209
+ "reuse_primary"
210
+ /** Request a new routing decision. */
211
+ | "reroute";
212
+ /**
213
+ * Validated HydraFusion execution pattern.
214
+ */
215
+ /** @experimental */
216
+ export type FusionPattern =
217
+ /** Run one primary solver phase. */
218
+ "single"
219
+ /** Run a primary phase, a judge, and an optional repair. */
220
+ | "cascade"
221
+ /** Run a primary draft, a read-only critique, and a revision. */
222
+ | "critique";
184
223
  /**
185
224
  * The agent mode that was active when this message was sent
186
225
  */
@@ -225,6 +264,45 @@ export type UserMessageDelivery =
225
264
  | "steering"
226
265
  /** Enqueued while the agent was busy; processed as its own run afterward. */
227
266
  | "queued";
267
+ /**
268
+ * Conversation scope in which a HydraFusion phase executes.
269
+ */
270
+ /** @experimental */
271
+ export type FusionConversationScope =
272
+ /** Canonical root conversation history. */
273
+ "root"
274
+ /** Isolated read-only review history that does not enter the root conversation. */
275
+ | "review";
276
+ /**
277
+ * HydraFusion phase kind.
278
+ */
279
+ /** @experimental */
280
+ export type FusionPhaseKind =
281
+ /** Primary solver phase. */
282
+ "primary"
283
+ /** Read-only cascade judge phase. */
284
+ | "judge"
285
+ /** Cascade repair phase. */
286
+ | "repair"
287
+ /** Initial critique-pattern draft phase. */
288
+ | "draft"
289
+ /** Read-only critique phase. */
290
+ | "critic"
291
+ /** Critique-pattern revision phase. */
292
+ | "revision"
293
+ /** Follow-up phase continuing from the resolved model. */
294
+ | "follow_up";
295
+ /**
296
+ * Durable outcome status of a HydraFusion phase.
297
+ */
298
+ /** @experimental */
299
+ export type FusionPhaseStatus =
300
+ /** The phase completed successfully. */
301
+ "succeeded"
302
+ /** The phase failed. */
303
+ | "failed"
304
+ /** The phase was cancelled. */
305
+ | "cancelled";
228
306
  /**
229
307
  * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
230
308
  */
@@ -249,6 +327,10 @@ export type CitationProvider =
249
327
  */
250
328
  /** @experimental */
251
329
  export type CitationLocation = CitationLocationChar | CitationLocationPage | CitationLocationBlock;
330
+ /**
331
+ * Hosted program caller type
332
+ */
333
+ export type AssistantMessageToolRequestCallerType = "program";
252
334
  /**
253
335
  * API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
254
336
  */
@@ -826,6 +908,7 @@ export interface StartData {
826
908
  * Whether the session was already in use by another client at start time
827
909
  */
828
910
  alreadyInUse?: boolean;
911
+ autoTier?: AutoTier;
829
912
  context?: WorkingDirectoryContext;
830
913
  /**
831
914
  * Context tier selected at session creation time for models with tiered context pricing; null when no tier is selected (e.g., non-tiered model)
@@ -978,6 +1061,7 @@ export interface ResumeData {
978
1061
  * Whether the session was already in use by another client at resume time
979
1062
  */
980
1063
  alreadyInUse?: boolean;
1064
+ autoTier?: AutoTier;
981
1065
  context?: WorkingDirectoryContext;
982
1066
  /**
983
1067
  * Context tier currently selected at resume time; null when no tier is active
@@ -1170,6 +1254,7 @@ export interface IdleData {
1170
1254
  * True when the preceding agentic loop was cancelled via abort signal
1171
1255
  */
1172
1256
  aborted?: boolean;
1257
+ mode?: SessionMode;
1173
1258
  }
1174
1259
  /**
1175
1260
  * Session event "session.title_changed". Session title change payload containing the new display title
@@ -2482,6 +2567,10 @@ export interface CompactionCompleteEvent {
2482
2567
  * Conversation compaction results including success status, metrics, and optional error details
2483
2568
  */
2484
2569
  export interface CompactionCompleteData {
2570
+ /**
2571
+ * Canonical model identifier used for model-specific behavior when replaying compaction
2572
+ */
2573
+ behaviorModelId?: string;
2485
2574
  /**
2486
2575
  * Checkpoint snapshot number created for recovery
2487
2576
  */
@@ -2660,18 +2749,19 @@ export interface TaskCompleteData {
2660
2749
  summary?: string;
2661
2750
  }
2662
2751
  /**
2663
- * Session event "user.message". Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
2752
+ * Session event "session.fusion_route_started". Experimental transient signal that HydraFusion routing has started for an eligible turn.
2664
2753
  */
2665
- export interface UserMessageEvent {
2754
+ /** @experimental */
2755
+ export interface FusionRouteStartedEvent {
2666
2756
  /**
2667
2757
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2668
2758
  */
2669
2759
  agentId?: string;
2670
- data: UserMessageData;
2760
+ data: FusionRouteStartedData;
2671
2761
  /**
2672
- * When true, the event is transient and not persisted to the session event log on disk
2762
+ * Always true for events that are transient and not persisted to the session event log on disk.
2673
2763
  */
2674
- ephemeral?: boolean;
2764
+ ephemeral: true;
2675
2765
  /**
2676
2766
  * Unique event identifier (UUID v4), generated when the event is emitted
2677
2767
  */
@@ -2685,284 +2775,642 @@ export interface UserMessageEvent {
2685
2775
  */
2686
2776
  timestamp: string;
2687
2777
  /**
2688
- * Type discriminator. Always "user.message".
2778
+ * Type discriminator. Always "session.fusion_route_started".
2689
2779
  */
2690
- type: "user.message";
2780
+ type: "session.fusion_route_started";
2691
2781
  }
2692
2782
  /**
2693
- * Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
2783
+ * Experimental transient signal that HydraFusion routing has started for an eligible turn.
2694
2784
  */
2695
- export interface UserMessageData {
2696
- agentMode?: UserMessageAgentMode;
2697
- /**
2698
- * Files, selections, or GitHub references attached to the message
2699
- */
2700
- attachments?: Attachment[];
2785
+ /** @experimental */
2786
+ export interface FusionRouteStartedData {
2701
2787
  /**
2702
- * The user's message text as displayed in the timeline
2788
+ * Identifier for this routing attempt before a durable Fusion turn exists.
2703
2789
  */
2704
- content: string;
2705
- delivery?: UserMessageDelivery;
2790
+ attemptId: string;
2706
2791
  /**
2707
- * CAPI interaction ID for correlating this user message with its turn
2792
+ * HydraFusion routing policy requested for the turn.
2708
2793
  */
2709
- interactionId?: string;
2794
+ policy?: string;
2710
2795
  /**
2711
- * True when this user message was auto-injected by autopilot's continuation loop rather than typed by the user; used to distinguish autopilot-driven turns in telemetry.
2796
+ * Synthetic HydraFusion model selected for the session.
2712
2797
  */
2713
- isAutopilotContinuation?: boolean;
2798
+ syntheticModel?: string;
2799
+ turnKind: FusionTurnKind;
2800
+ }
2801
+ /**
2802
+ * Session event "session.fusion_route_failed". Experimental durable HydraFusion routing failure and the deterministic concrete fallback selected for the turn.
2803
+ */
2804
+ /** @experimental */
2805
+ export interface FusionRouteFailedEvent {
2714
2806
  /**
2715
- * Path-backed native document attachments that stayed on the tagged_files path flow because native upload could not read them or would exceed the request size limit
2807
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2716
2808
  */
2717
- nativeDocumentPathFallbackPaths?: string[];
2809
+ agentId?: string;
2810
+ data: FusionRouteFailedData;
2718
2811
  /**
2719
- * Parent agent task ID for background telemetry correlated to this user turn
2812
+ * When true, the event is transient and not persisted to the session event log on disk
2720
2813
  */
2721
- parentAgentTaskId?: string;
2814
+ ephemeral?: boolean;
2722
2815
  /**
2723
- * Origin of this message, used for timeline filtering and attribution (e.g., `skill-pdf` for hidden skill injection or `agent-<agent-id>` for an inter-agent prompt)
2816
+ * Unique event identifier (UUID v4), generated when the event is emitted
2724
2817
  */
2725
- source?: string;
2818
+ id: string;
2726
2819
  /**
2727
- * Normalized document MIME types that were sent natively instead of through tagged_files XML
2820
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2728
2821
  */
2729
- supportedNativeDocumentMimeTypes?: string[];
2822
+ parentId: string | null;
2730
2823
  /**
2731
- * Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
2824
+ * ISO 8601 timestamp when the event was created
2732
2825
  */
2733
- transformedContent?: string;
2826
+ timestamp: string;
2734
2827
  /**
2735
- * The agent-loop turn ID that consumed this message; absent when no agent-loop turn consumed it
2828
+ * Type discriminator. Always "session.fusion_route_failed".
2736
2829
  */
2737
- turnId?: string;
2830
+ type: "session.fusion_route_failed";
2738
2831
  }
2739
2832
  /**
2740
- * File attachment
2833
+ * Experimental durable HydraFusion routing failure and the deterministic concrete fallback selected for the turn.
2741
2834
  */
2742
- export interface AttachmentFile {
2835
+ /** @experimental */
2836
+ export interface FusionRouteFailedData {
2743
2837
  /**
2744
- * Internal: content-addressed id of the session.binary_asset event holding this attachment's model-facing bytes (e.g. "sha256:..."). Absent externally.
2838
+ * Identifier of the routing attempt that failed.
2745
2839
  */
2746
- assetId?: string;
2840
+ attemptId: string;
2747
2841
  /**
2748
- * Internal: decoded byte length of the attachment's model-facing bytes. Absent externally.
2842
+ * Provider or validation error detail, when available.
2749
2843
  */
2750
- byteLength?: number;
2844
+ errorMessage?: string;
2751
2845
  /**
2752
- * User-facing display name for the attachment
2846
+ * Concrete model selected as the deterministic fallback.
2753
2847
  */
2754
- displayName: string;
2755
- lineRange?: AttachmentFileLineRange;
2848
+ fallbackModel: string;
2756
2849
  /**
2757
- * Internal: MIME type of the file's model-facing bytes (post-resize for images). Set when the file's bytes are interned to an asset. Absent externally.
2850
+ * HydraFusion routing policy requested for the turn.
2758
2851
  */
2759
- mimeType?: string;
2760
- omittedReason?: OmittedBinaryOmittedReason;
2852
+ policy: string;
2761
2853
  /**
2762
- * Absolute file path
2854
+ * Stable machine-readable reason for the routing failure.
2763
2855
  */
2764
- path: string;
2856
+ reason: string;
2765
2857
  /**
2766
- * Frozen rendered line this attachment contributed to the <tagged_files> prompt block (e.g. "* /path (123 lines)"). Captured at send time so resumed history reproduces the exact text the model saw, independent of later filesystem changes. Present only for attachments routed to <tagged_files> (mutually exclusive with assetId, which marks bytes sent natively).
2858
+ * Elapsed routing time in milliseconds before the failure.
2767
2859
  */
2768
- taggedFilesEntry?: string;
2860
+ routingLatencyMs?: number;
2769
2861
  /**
2770
- * Attachment type discriminator
2862
+ * Synthetic HydraFusion model selected for the session.
2771
2863
  */
2772
- type: "file";
2864
+ syntheticModel: string;
2773
2865
  }
2774
2866
  /**
2775
- * Optional line range to scope the attachment to a specific section of the file
2867
+ * Session event "session.fusion_resolved". Experimental durable validated HydraFusion route and turn policy.
2776
2868
  */
2777
- export interface AttachmentFileLineRange {
2869
+ /** @experimental */
2870
+ export interface FusionResolvedEvent {
2778
2871
  /**
2779
- * End line number (1-based, inclusive)
2872
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2780
2873
  */
2781
- end: number;
2874
+ agentId?: string;
2875
+ data: FusionResolvedData;
2782
2876
  /**
2783
- * Start line number (1-based)
2877
+ * When true, the event is transient and not persisted to the session event log on disk
2784
2878
  */
2785
- start: number;
2786
- }
2787
- /**
2788
- * Directory attachment
2789
- */
2790
- export interface AttachmentDirectory {
2879
+ ephemeral?: boolean;
2791
2880
  /**
2792
- * User-facing display name for the attachment
2881
+ * Unique event identifier (UUID v4), generated when the event is emitted
2793
2882
  */
2794
- displayName: string;
2883
+ id: string;
2795
2884
  /**
2796
- * Absolute directory path
2885
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2797
2886
  */
2798
- path: string;
2887
+ parentId: string | null;
2799
2888
  /**
2800
- * Frozen rendered line this attachment contributed to the <tagged_files> prompt block (e.g. "* /path (12 items)"). Captured at send time so resumed history reproduces the exact text the model saw, independent of later filesystem changes.
2889
+ * ISO 8601 timestamp when the event was created
2801
2890
  */
2802
- taggedFilesEntry?: string;
2891
+ timestamp: string;
2803
2892
  /**
2804
- * Attachment type discriminator
2893
+ * Type discriminator. Always "session.fusion_resolved".
2805
2894
  */
2806
- type: "directory";
2895
+ type: "session.fusion_resolved";
2807
2896
  }
2808
2897
  /**
2809
- * Code selection attachment from an editor
2898
+ * Experimental durable validated HydraFusion route and turn policy.
2810
2899
  */
2811
- export interface AttachmentSelection {
2900
+ /** @experimental */
2901
+ export interface FusionResolvedData {
2812
2902
  /**
2813
- * User-facing display name for the selection
2903
+ * Version of the validated HydraFusion event contract.
2814
2904
  */
2815
- displayName: string;
2905
+ contractVersion: number;
2816
2906
  /**
2817
- * Absolute path to the file containing the selection
2907
+ * Concrete model used when the planned primary model cannot execute.
2818
2908
  */
2819
- filePath: string;
2820
- selection: AttachmentSelectionDetails;
2909
+ fallbackModel: string;
2910
+ followUp?: FusionFollowUpRecommendation;
2821
2911
  /**
2822
- * The selected text content
2912
+ * Concrete model recommended for eligible follow-up turns.
2823
2913
  */
2824
- text: string;
2914
+ followUpModel: string;
2825
2915
  /**
2826
- * Attachment type discriminator
2916
+ * Stable identifier for the resolved HydraFusion turn.
2827
2917
  */
2828
- type: "selection";
2829
- }
2830
- /**
2831
- * Position range of the selection within the file
2832
- */
2833
- export interface AttachmentSelectionDetails {
2834
- end: AttachmentSelectionDetailsEnd;
2835
- start: AttachmentSelectionDetailsStart;
2836
- }
2837
- /**
2838
- * End position of the selection
2839
- */
2840
- export interface AttachmentSelectionDetailsEnd {
2918
+ fusionId: string;
2841
2919
  /**
2842
- * End character offset within the line (0-based)
2920
+ * Version of the executable model universe used for selection.
2843
2921
  */
2844
- character: number;
2922
+ modelUniverseVersion?: string;
2923
+ pattern: FusionPattern;
2845
2924
  /**
2846
- * End line number (0-based)
2925
+ * Version of the validated execution-plan format.
2847
2926
  */
2848
- line: number;
2849
- }
2850
- /**
2851
- * Start position of the selection
2852
- */
2853
- export interface AttachmentSelectionDetailsStart {
2927
+ planVersion?: string;
2854
2928
  /**
2855
- * Start character offset within the line (0-based)
2929
+ * HydraFusion routing policy used to resolve the plan.
2856
2930
  */
2857
- character: number;
2931
+ policy: string;
2858
2932
  /**
2859
- * Start line number (0-based)
2933
+ * Version of the local routing policy.
2860
2934
  */
2861
- line: number;
2862
- }
2863
- /**
2864
- * GitHub issue, pull request, or discussion reference
2865
- */
2866
- export interface AttachmentGitHubReference {
2935
+ policyVersion?: string;
2867
2936
  /**
2868
- * Issue, pull request, or discussion number
2937
+ * Concrete model selected for the primary solver phase.
2869
2938
  */
2870
- number: number;
2871
- referenceType: AttachmentGitHubReferenceType;
2939
+ primaryModel: string;
2872
2940
  /**
2873
- * Current state of the referenced item (e.g., open, closed, merged)
2941
+ * Router implementation that supplied the plan.
2874
2942
  */
2875
- state: string;
2943
+ routeSource?: string;
2876
2944
  /**
2877
- * Title of the referenced item
2945
+ * Elapsed time in milliseconds required to resolve and validate the route.
2878
2946
  */
2879
- title: string;
2947
+ routingLatencyMs?: number;
2880
2948
  /**
2881
- * Attachment type discriminator
2949
+ * Identifier of the local policy rule that matched.
2882
2950
  */
2883
- type: "github_reference";
2951
+ ruleId?: string;
2884
2952
  /**
2885
- * URL to the referenced item on GitHub
2953
+ * Zero-based index of the local policy rule that matched.
2886
2954
  */
2887
- url: string;
2888
- }
2889
- /**
2890
- * Pointer to a GitHub commit.
2891
- */
2892
- export interface AttachmentGitHubCommit {
2955
+ ruleIndex?: number;
2893
2956
  /**
2894
- * First line of the commit message
2957
+ * Human-readable name of the local policy rule that matched.
2895
2958
  */
2896
- message: string;
2959
+ ruleName?: string;
2960
+ scores?: FusionScores;
2897
2961
  /**
2898
- * Full commit SHA
2962
+ * Concrete model selected for the review or judge phase, when required.
2899
2963
  */
2900
- oid: string;
2901
- repo: GitHubRepoRef;
2964
+ secondaryModel: string | null;
2902
2965
  /**
2903
- * Attachment type discriminator
2966
+ * Synthetic HydraFusion model selected for the session.
2904
2967
  */
2905
- type: "github_commit";
2968
+ syntheticModel: string;
2906
2969
  /**
2907
- * URL to the commit on GitHub
2970
+ * Identifier of the session turn associated with the route.
2908
2971
  */
2909
- url: string;
2972
+ turnId: string;
2910
2973
  }
2911
2974
  /**
2912
- * Pointer to a GitHub repository.
2975
+ * Durable server recommendation for subsequent HydraFusion turns.
2913
2976
  */
2914
- export interface GitHubRepoRef {
2915
- /**
2916
- * Numeric GitHub repository id
2917
- */
2918
- id?: number;
2919
- /**
2920
- * Repository name (without owner)
2921
- */
2922
- name: string;
2923
- /**
2924
- * Repository owner login (user or organization)
2925
- */
2926
- owner: string;
2977
+ /** @experimental */
2978
+ export interface FusionFollowUpRecommendation {
2979
+ compactionTurn: FusionFollowUpAction;
2980
+ userTurn: FusionFollowUpAction;
2927
2981
  }
2928
2982
  /**
2929
- * Pointer to a GitHub release.
2983
+ * Validated HydraFusion routing capability scores.
2930
2984
  */
2931
- export interface AttachmentGitHubRelease {
2985
+ /** @experimental */
2986
+ export interface FusionScores {
2932
2987
  /**
2933
- * Human-readable release name
2988
+ * Code-generation capability score returned by the authenticated router.
2934
2989
  */
2935
- name: string;
2936
- repo: GitHubRepoRef;
2990
+ codeGen: number;
2937
2991
  /**
2938
- * Git tag the release is anchored to
2992
+ * Debugging capability score returned by the authenticated router.
2939
2993
  */
2940
- tagName: string;
2994
+ debugging: number;
2941
2995
  /**
2942
- * Attachment type discriminator
2996
+ * Reasoning capability score returned by the authenticated router.
2943
2997
  */
2944
- type: "github_release";
2998
+ reasoning: number;
2945
2999
  /**
2946
- * URL to the release on GitHub
3000
+ * Tool-use capability score returned by the authenticated router.
2947
3001
  */
2948
- url: string;
3002
+ toolUse: number;
2949
3003
  }
2950
3004
  /**
2951
- * Pointer to a GitHub Actions job.
3005
+ * Session event "session.fusion_completed". Experimental durable aggregate outcome of a HydraFusion turn.
2952
3006
  */
2953
- export interface AttachmentGitHubActionsJob {
3007
+ /** @experimental */
3008
+ export interface FusionCompletedEvent {
2954
3009
  /**
2955
- * Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs.
3010
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2956
3011
  */
2957
- conclusion?: string;
3012
+ agentId?: string;
3013
+ data: FusionCompletedData;
2958
3014
  /**
2959
- * Job id within the workflow run
3015
+ * When true, the event is transient and not persisted to the session event log on disk
2960
3016
  */
2961
- jobId: number;
3017
+ ephemeral?: boolean;
2962
3018
  /**
2963
- * Display name of the job
3019
+ * Unique event identifier (UUID v4), generated when the event is emitted
2964
3020
  */
2965
- jobName: string;
3021
+ id: string;
3022
+ /**
3023
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3024
+ */
3025
+ parentId: string | null;
3026
+ /**
3027
+ * ISO 8601 timestamp when the event was created
3028
+ */
3029
+ timestamp: string;
3030
+ /**
3031
+ * Type discriminator. Always "session.fusion_completed".
3032
+ */
3033
+ type: "session.fusion_completed";
3034
+ }
3035
+ /**
3036
+ * Experimental durable aggregate outcome of a HydraFusion turn.
3037
+ */
3038
+ /** @experimental */
3039
+ export interface FusionCompletedData {
3040
+ /**
3041
+ * Total cached input tokens reported across all phases.
3042
+ */
3043
+ cachedTokens: number;
3044
+ /**
3045
+ * Total tokens written to prompt cache across all phases.
3046
+ */
3047
+ cacheWriteTokens?: number;
3048
+ /**
3049
+ * Idempotency identifier for the authoritative final commit.
3050
+ */
3051
+ commitId: string;
3052
+ /**
3053
+ * Reason the turn used a degraded route, when applicable.
3054
+ */
3055
+ degradedReason: string | null;
3056
+ /**
3057
+ * Total elapsed execution time for the HydraFusion turn in milliseconds.
3058
+ */
3059
+ durationMs: number;
3060
+ /**
3061
+ * Concrete model that supplied the authoritative final content.
3062
+ */
3063
+ finalSourceModel: string | null;
3064
+ /**
3065
+ * Phase whose output supplied the authoritative final content.
3066
+ */
3067
+ finalSourcePhaseId: string | null;
3068
+ /**
3069
+ * Concrete model recommended for eligible follow-up turns.
3070
+ */
3071
+ followUpModel: string;
3072
+ /**
3073
+ * Stable identifier for the completed HydraFusion turn.
3074
+ */
3075
+ fusionId: string;
3076
+ /**
3077
+ * Total input tokens consumed across all phases.
3078
+ */
3079
+ inputTokens: number;
3080
+ /**
3081
+ * Stable aggregate outcome of the HydraFusion turn.
3082
+ */
3083
+ outcome: string;
3084
+ /**
3085
+ * Total output tokens produced across all phases.
3086
+ */
3087
+ outputTokens: number;
3088
+ pattern: FusionPattern;
3089
+ /**
3090
+ * Number of concrete phases attempted by the turn.
3091
+ */
3092
+ phaseCount: number;
3093
+ /**
3094
+ * Total concrete model requests made across all phases.
3095
+ */
3096
+ requestCount: number;
3097
+ /**
3098
+ * Synthetic HydraFusion model selected for the session.
3099
+ */
3100
+ syntheticModel: string;
3101
+ /**
3102
+ * Total normalized AI-unit cost reported across all phases, in nano-AIU.
3103
+ */
3104
+ totalNanoAiu: number;
3105
+ /**
3106
+ * Identifier of the session turn associated with the completion.
3107
+ */
3108
+ turnId: string;
3109
+ }
3110
+ /**
3111
+ * Session event "user.message". Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
3112
+ */
3113
+ export interface UserMessageEvent {
3114
+ /**
3115
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3116
+ */
3117
+ agentId?: string;
3118
+ data: UserMessageData;
3119
+ /**
3120
+ * When true, the event is transient and not persisted to the session event log on disk
3121
+ */
3122
+ ephemeral?: boolean;
3123
+ /**
3124
+ * Unique event identifier (UUID v4), generated when the event is emitted
3125
+ */
3126
+ id: string;
3127
+ /**
3128
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3129
+ */
3130
+ parentId: string | null;
3131
+ /**
3132
+ * ISO 8601 timestamp when the event was created
3133
+ */
3134
+ timestamp: string;
3135
+ /**
3136
+ * Type discriminator. Always "user.message".
3137
+ */
3138
+ type: "user.message";
3139
+ }
3140
+ /**
3141
+ * Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
3142
+ */
3143
+ export interface UserMessageData {
3144
+ agentMode?: UserMessageAgentMode;
3145
+ /**
3146
+ * Files, selections, or GitHub references attached to the message
3147
+ */
3148
+ attachments?: Attachment[];
3149
+ /**
3150
+ * The user's message text as displayed in the timeline
3151
+ */
3152
+ content: string;
3153
+ delivery?: UserMessageDelivery;
3154
+ /**
3155
+ * CAPI interaction ID for correlating this user message with its turn
3156
+ */
3157
+ interactionId?: string;
3158
+ /**
3159
+ * True when this user message was auto-injected by autopilot's continuation loop rather than typed by the user; used to distinguish autopilot-driven turns in telemetry.
3160
+ */
3161
+ isAutopilotContinuation?: boolean;
3162
+ /**
3163
+ * Path-backed native document attachments that stayed on the tagged_files path flow because native upload could not read them or would exceed the request size limit
3164
+ */
3165
+ nativeDocumentPathFallbackPaths?: string[];
3166
+ /**
3167
+ * Parent agent task ID for background telemetry correlated to this user turn
3168
+ */
3169
+ parentAgentTaskId?: string;
3170
+ /**
3171
+ * Origin of this message, used for timeline filtering and attribution (e.g., `skill-pdf` for hidden skill injection or `agent-<agent-id>` for an inter-agent prompt)
3172
+ */
3173
+ source?: string;
3174
+ /**
3175
+ * Normalized document MIME types that were sent natively instead of through tagged_files XML
3176
+ */
3177
+ supportedNativeDocumentMimeTypes?: string[];
3178
+ /**
3179
+ * Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
3180
+ */
3181
+ transformedContent?: string;
3182
+ /**
3183
+ * The agent-loop turn ID that consumed this message; absent when no agent-loop turn consumed it
3184
+ */
3185
+ turnId?: string;
3186
+ }
3187
+ /**
3188
+ * File attachment
3189
+ */
3190
+ export interface AttachmentFile {
3191
+ /**
3192
+ * Internal: content-addressed id of the session.binary_asset event holding this attachment's model-facing bytes (e.g. "sha256:..."). Absent externally.
3193
+ */
3194
+ assetId?: string;
3195
+ /**
3196
+ * Internal: decoded byte length of the attachment's model-facing bytes. Absent externally.
3197
+ */
3198
+ byteLength?: number;
3199
+ /**
3200
+ * User-facing display name for the attachment
3201
+ */
3202
+ displayName: string;
3203
+ lineRange?: AttachmentFileLineRange;
3204
+ /**
3205
+ * Internal: MIME type of the file's model-facing bytes (post-resize for images). Set when the file's bytes are interned to an asset. Absent externally.
3206
+ */
3207
+ mimeType?: string;
3208
+ omittedReason?: OmittedBinaryOmittedReason;
3209
+ /**
3210
+ * Absolute file path
3211
+ */
3212
+ path: string;
3213
+ /**
3214
+ * Frozen rendered line this attachment contributed to the <tagged_files> prompt block (e.g. "* /path (123 lines)"). Captured at send time so resumed history reproduces the exact text the model saw, independent of later filesystem changes. Present only for attachments routed to <tagged_files> (mutually exclusive with assetId, which marks bytes sent natively).
3215
+ */
3216
+ taggedFilesEntry?: string;
3217
+ /**
3218
+ * Attachment type discriminator
3219
+ */
3220
+ type: "file";
3221
+ }
3222
+ /**
3223
+ * Optional line range to scope the attachment to a specific section of the file
3224
+ */
3225
+ export interface AttachmentFileLineRange {
3226
+ /**
3227
+ * End line number (1-based, inclusive)
3228
+ */
3229
+ end: number;
3230
+ /**
3231
+ * Start line number (1-based)
3232
+ */
3233
+ start: number;
3234
+ }
3235
+ /**
3236
+ * Directory attachment
3237
+ */
3238
+ export interface AttachmentDirectory {
3239
+ /**
3240
+ * User-facing display name for the attachment
3241
+ */
3242
+ displayName: string;
3243
+ /**
3244
+ * Absolute directory path
3245
+ */
3246
+ path: string;
3247
+ /**
3248
+ * Frozen rendered line this attachment contributed to the <tagged_files> prompt block (e.g. "* /path (12 items)"). Captured at send time so resumed history reproduces the exact text the model saw, independent of later filesystem changes.
3249
+ */
3250
+ taggedFilesEntry?: string;
3251
+ /**
3252
+ * Attachment type discriminator
3253
+ */
3254
+ type: "directory";
3255
+ }
3256
+ /**
3257
+ * Code selection attachment from an editor
3258
+ */
3259
+ export interface AttachmentSelection {
3260
+ /**
3261
+ * User-facing display name for the selection
3262
+ */
3263
+ displayName: string;
3264
+ /**
3265
+ * Absolute path to the file containing the selection
3266
+ */
3267
+ filePath: string;
3268
+ selection: AttachmentSelectionDetails;
3269
+ /**
3270
+ * The selected text content
3271
+ */
3272
+ text: string;
3273
+ /**
3274
+ * Attachment type discriminator
3275
+ */
3276
+ type: "selection";
3277
+ }
3278
+ /**
3279
+ * Position range of the selection within the file
3280
+ */
3281
+ export interface AttachmentSelectionDetails {
3282
+ end: AttachmentSelectionDetailsEnd;
3283
+ start: AttachmentSelectionDetailsStart;
3284
+ }
3285
+ /**
3286
+ * End position of the selection
3287
+ */
3288
+ export interface AttachmentSelectionDetailsEnd {
3289
+ /**
3290
+ * End character offset within the line (0-based)
3291
+ */
3292
+ character: number;
3293
+ /**
3294
+ * End line number (0-based)
3295
+ */
3296
+ line: number;
3297
+ }
3298
+ /**
3299
+ * Start position of the selection
3300
+ */
3301
+ export interface AttachmentSelectionDetailsStart {
3302
+ /**
3303
+ * Start character offset within the line (0-based)
3304
+ */
3305
+ character: number;
3306
+ /**
3307
+ * Start line number (0-based)
3308
+ */
3309
+ line: number;
3310
+ }
3311
+ /**
3312
+ * GitHub issue, pull request, or discussion reference
3313
+ */
3314
+ export interface AttachmentGitHubReference {
3315
+ /**
3316
+ * Issue, pull request, or discussion number
3317
+ */
3318
+ number: number;
3319
+ referenceType: AttachmentGitHubReferenceType;
3320
+ /**
3321
+ * Current state of the referenced item (e.g., open, closed, merged)
3322
+ */
3323
+ state: string;
3324
+ /**
3325
+ * Title of the referenced item
3326
+ */
3327
+ title: string;
3328
+ /**
3329
+ * Attachment type discriminator
3330
+ */
3331
+ type: "github_reference";
3332
+ /**
3333
+ * URL to the referenced item on GitHub
3334
+ */
3335
+ url: string;
3336
+ }
3337
+ /**
3338
+ * Pointer to a GitHub commit.
3339
+ */
3340
+ export interface AttachmentGitHubCommit {
3341
+ /**
3342
+ * First line of the commit message
3343
+ */
3344
+ message: string;
3345
+ /**
3346
+ * Full commit SHA
3347
+ */
3348
+ oid: string;
3349
+ repo: GitHubRepoRef;
3350
+ /**
3351
+ * Attachment type discriminator
3352
+ */
3353
+ type: "github_commit";
3354
+ /**
3355
+ * URL to the commit on GitHub
3356
+ */
3357
+ url: string;
3358
+ }
3359
+ /**
3360
+ * Pointer to a GitHub repository.
3361
+ */
3362
+ export interface GitHubRepoRef {
3363
+ /**
3364
+ * Numeric GitHub repository id
3365
+ */
3366
+ id?: number;
3367
+ /**
3368
+ * Repository name (without owner)
3369
+ */
3370
+ name: string;
3371
+ /**
3372
+ * Repository owner login (user or organization)
3373
+ */
3374
+ owner: string;
3375
+ }
3376
+ /**
3377
+ * Pointer to a GitHub release.
3378
+ */
3379
+ export interface AttachmentGitHubRelease {
3380
+ /**
3381
+ * Human-readable release name
3382
+ */
3383
+ name: string;
3384
+ repo: GitHubRepoRef;
3385
+ /**
3386
+ * Git tag the release is anchored to
3387
+ */
3388
+ tagName: string;
3389
+ /**
3390
+ * Attachment type discriminator
3391
+ */
3392
+ type: "github_release";
3393
+ /**
3394
+ * URL to the release on GitHub
3395
+ */
3396
+ url: string;
3397
+ }
3398
+ /**
3399
+ * Pointer to a GitHub Actions job.
3400
+ */
3401
+ export interface AttachmentGitHubActionsJob {
3402
+ /**
3403
+ * Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs.
3404
+ */
3405
+ conclusion?: string;
3406
+ /**
3407
+ * Job id within the workflow run
3408
+ */
3409
+ jobId: number;
3410
+ /**
3411
+ * Display name of the job
3412
+ */
3413
+ jobName: string;
2966
3414
  repo: GitHubRepoRef;
2967
3415
  /**
2968
3416
  * Attachment type discriminator
@@ -3128,61 +3576,183 @@ export interface AttachmentBlob {
3128
3576
  */
3129
3577
  data?: string;
3130
3578
  /**
3131
- * User-facing display name for the attachment
3579
+ * User-facing display name for the attachment
3580
+ */
3581
+ displayName?: string;
3582
+ /**
3583
+ * MIME type of the inline data
3584
+ */
3585
+ mimeType: string;
3586
+ omittedReason?: OmittedBinaryOmittedReason;
3587
+ /**
3588
+ * Attachment type discriminator
3589
+ */
3590
+ type: "blob";
3591
+ }
3592
+ /**
3593
+ * Structured context contributed by an extension. Composer pills displayed in the host are forwarded back through session.send.attachments, then rendered into the model prompt as an <extension_context> XML block.
3594
+ */
3595
+ export interface AttachmentExtensionContext {
3596
+ /**
3597
+ * Provider-local canvas identifier when the push was bound to a canvas instance
3598
+ */
3599
+ canvasId?: string;
3600
+ /**
3601
+ * ISO 8601 timestamp captured by the runtime when the push was accepted
3602
+ */
3603
+ capturedAt: string;
3604
+ /**
3605
+ * Owning extension identifier. Runtime-derived from the caller's connection when produced via session.extensions.sendAttachmentsToMessage; preserved verbatim on subsequent transports.
3606
+ */
3607
+ extensionId: string;
3608
+ /**
3609
+ * Open canvas instance identifier when the push was bound to a canvas instance
3610
+ */
3611
+ instanceId?: string;
3612
+ /**
3613
+ * Caller-supplied JSON payload
3614
+ */
3615
+ payload?: JsonValue;
3616
+ /**
3617
+ * Human-readable composer pill label
3618
+ */
3619
+ title: string;
3620
+ /**
3621
+ * Attachment type discriminator
3622
+ */
3623
+ type: "extension_context";
3624
+ }
3625
+ /**
3626
+ * Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
3627
+ */
3628
+ export interface PendingMessagesModifiedEvent {
3629
+ /**
3630
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3631
+ */
3632
+ agentId?: string;
3633
+ data: PendingMessagesModifiedData;
3634
+ /**
3635
+ * Always true for events that are transient and not persisted to the session event log on disk.
3636
+ */
3637
+ ephemeral: true;
3638
+ /**
3639
+ * Unique event identifier (UUID v4), generated when the event is emitted
3640
+ */
3641
+ id: string;
3642
+ /**
3643
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3644
+ */
3645
+ parentId: string | null;
3646
+ /**
3647
+ * ISO 8601 timestamp when the event was created
3648
+ */
3649
+ timestamp: string;
3650
+ /**
3651
+ * Type discriminator. Always "pending_messages.modified".
3652
+ */
3653
+ type: "pending_messages.modified";
3654
+ }
3655
+ /**
3656
+ * Empty payload; the event signals that the pending message queue has changed
3657
+ */
3658
+ export interface PendingMessagesModifiedData {
3659
+ }
3660
+ /**
3661
+ * Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking
3662
+ */
3663
+ export interface AssistantTurnStartEvent {
3664
+ /**
3665
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3666
+ */
3667
+ agentId?: string;
3668
+ data: AssistantTurnStartData;
3669
+ /**
3670
+ * When true, the event is transient and not persisted to the session event log on disk
3671
+ */
3672
+ ephemeral?: boolean;
3673
+ /**
3674
+ * Unique event identifier (UUID v4), generated when the event is emitted
3675
+ */
3676
+ id: string;
3677
+ /**
3678
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3679
+ */
3680
+ parentId: string | null;
3681
+ /**
3682
+ * ISO 8601 timestamp when the event was created
3683
+ */
3684
+ timestamp: string;
3685
+ /**
3686
+ * Type discriminator. Always "assistant.turn_start".
3687
+ */
3688
+ type: "assistant.turn_start";
3689
+ }
3690
+ /**
3691
+ * Turn initialization metadata including identifier and interaction tracking
3692
+ */
3693
+ export interface AssistantTurnStartData {
3694
+ /**
3695
+ * CAPI interaction ID for correlating this turn with upstream telemetry
3132
3696
  */
3133
- displayName?: string;
3697
+ interactionId?: string;
3134
3698
  /**
3135
- * MIME type of the inline data
3699
+ * Model identifier used for this turn, when known
3136
3700
  */
3137
- mimeType: string;
3138
- omittedReason?: OmittedBinaryOmittedReason;
3701
+ model?: string;
3139
3702
  /**
3140
- * Attachment type discriminator
3703
+ * Identifier for this turn within the agentic loop, typically a stringified turn number
3141
3704
  */
3142
- type: "blob";
3705
+ turnId: string;
3143
3706
  }
3144
3707
  /**
3145
- * Structured context contributed by an extension. Composer pills displayed in the host are forwarded back through session.send.attachments, then rendered into the model prompt as an <extension_context> XML block.
3708
+ * Session event "assistant.intent". Agent intent description for current activity or plan
3146
3709
  */
3147
- export interface AttachmentExtensionContext {
3710
+ export interface AssistantIntentEvent {
3148
3711
  /**
3149
- * Provider-local canvas identifier when the push was bound to a canvas instance
3712
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3150
3713
  */
3151
- canvasId?: string;
3714
+ agentId?: string;
3715
+ data: AssistantIntentData;
3152
3716
  /**
3153
- * ISO 8601 timestamp captured by the runtime when the push was accepted
3717
+ * Always true for events that are transient and not persisted to the session event log on disk.
3154
3718
  */
3155
- capturedAt: string;
3719
+ ephemeral: true;
3156
3720
  /**
3157
- * Owning extension identifier. Runtime-derived from the caller's connection when produced via session.extensions.sendAttachmentsToMessage; preserved verbatim on subsequent transports.
3721
+ * Unique event identifier (UUID v4), generated when the event is emitted
3158
3722
  */
3159
- extensionId: string;
3723
+ id: string;
3160
3724
  /**
3161
- * Open canvas instance identifier when the push was bound to a canvas instance
3725
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3162
3726
  */
3163
- instanceId?: string;
3727
+ parentId: string | null;
3164
3728
  /**
3165
- * Caller-supplied JSON payload
3729
+ * ISO 8601 timestamp when the event was created
3166
3730
  */
3167
- payload?: JsonValue;
3731
+ timestamp: string;
3168
3732
  /**
3169
- * Human-readable composer pill label
3733
+ * Type discriminator. Always "assistant.intent".
3170
3734
  */
3171
- title: string;
3735
+ type: "assistant.intent";
3736
+ }
3737
+ /**
3738
+ * Agent intent description for current activity or plan
3739
+ */
3740
+ export interface AssistantIntentData {
3172
3741
  /**
3173
- * Attachment type discriminator
3742
+ * Short description of what the agent is currently doing or planning to do
3174
3743
  */
3175
- type: "extension_context";
3744
+ intent: string;
3176
3745
  }
3177
3746
  /**
3178
- * Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
3747
+ * Session event "assistant.fusion_phase_started". Experimental transient HydraFusion phase/model/role signal.
3179
3748
  */
3180
- export interface PendingMessagesModifiedEvent {
3749
+ /** @experimental */
3750
+ export interface AssistantFusionPhaseStartedEvent {
3181
3751
  /**
3182
3752
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3183
3753
  */
3184
3754
  agentId?: string;
3185
- data: PendingMessagesModifiedData;
3755
+ data: FusionPhaseStartedData;
3186
3756
  /**
3187
3757
  * Always true for events that are transient and not persisted to the session event log on disk.
3188
3758
  */
@@ -3200,24 +3770,45 @@ export interface PendingMessagesModifiedEvent {
3200
3770
  */
3201
3771
  timestamp: string;
3202
3772
  /**
3203
- * Type discriminator. Always "pending_messages.modified".
3773
+ * Type discriminator. Always "assistant.fusion_phase_started".
3204
3774
  */
3205
- type: "pending_messages.modified";
3775
+ type: "assistant.fusion_phase_started";
3206
3776
  }
3207
3777
  /**
3208
- * Empty payload; the event signals that the pending message queue has changed
3778
+ * Experimental transient HydraFusion phase/model/role signal.
3209
3779
  */
3210
- export interface PendingMessagesModifiedData {
3780
+ /** @experimental */
3781
+ export interface FusionPhaseStartedData {
3782
+ conversationScope: FusionConversationScope;
3783
+ /**
3784
+ * Identifier of the HydraFusion turn containing the phase.
3785
+ */
3786
+ fusionId: string;
3787
+ /**
3788
+ * Concrete model executing the phase.
3789
+ */
3790
+ model: string;
3791
+ pattern: FusionPattern;
3792
+ /**
3793
+ * Stable identifier for the concrete phase.
3794
+ */
3795
+ phaseId: string;
3796
+ phaseKind: FusionPhaseKind;
3797
+ /**
3798
+ * Semantic role assigned to the phase.
3799
+ */
3800
+ role: string;
3211
3801
  }
3212
3802
  /**
3213
- * Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking
3803
+ * Session event "assistant.fusion_phase_completed". Experimental durable HydraFusion phase output and lossless replay checkpoint.
3214
3804
  */
3215
- export interface AssistantTurnStartEvent {
3805
+ /** @experimental */
3806
+ export interface AssistantFusionPhaseCompletedEvent {
3216
3807
  /**
3217
3808
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3218
3809
  */
3219
3810
  agentId?: string;
3220
- data: AssistantTurnStartData;
3811
+ data: FusionPhaseCompletedData;
3221
3812
  /**
3222
3813
  * When true, the event is transient and not persisted to the session event log on disk
3223
3814
  */
@@ -3235,40 +3826,92 @@ export interface AssistantTurnStartEvent {
3235
3826
  */
3236
3827
  timestamp: string;
3237
3828
  /**
3238
- * Type discriminator. Always "assistant.turn_start".
3829
+ * Type discriminator. Always "assistant.fusion_phase_completed".
3239
3830
  */
3240
- type: "assistant.turn_start";
3831
+ type: "assistant.fusion_phase_completed";
3241
3832
  }
3242
3833
  /**
3243
- * Turn initialization metadata including identifier and interaction tracking
3834
+ * Experimental durable HydraFusion phase output and lossless replay checkpoint.
3244
3835
  */
3245
- export interface AssistantTurnStartData {
3836
+ /** @experimental */
3837
+ export interface FusionPhaseCompletedData {
3246
3838
  /**
3247
- * CAPI interaction ID for correlating this turn with upstream telemetry
3839
+ * Provider-normalized textual output produced by the phase.
3248
3840
  */
3249
- interactionId?: string;
3841
+ content: string;
3842
+ conversationScope: FusionConversationScope;
3250
3843
  /**
3251
- * Model identifier used for this turn, when known
3844
+ * Elapsed execution time for the phase in milliseconds.
3252
3845
  */
3253
- model?: string;
3846
+ durationMs: number;
3254
3847
  /**
3255
- * Identifier for this turn within the agentic loop, typically a stringified turn number
3848
+ * Identifier of the HydraFusion turn containing the phase.
3256
3849
  */
3257
- turnId: string;
3850
+ fusionId: string;
3851
+ /**
3852
+ * Concrete model that executed the phase.
3853
+ */
3854
+ model: string;
3855
+ /**
3856
+ * Stable identifier for the completed phase.
3857
+ */
3858
+ phaseId: string;
3859
+ phaseKind: FusionPhaseKind;
3860
+ /**
3861
+ * Semantic role assigned to the completed phase.
3862
+ */
3863
+ role: string;
3864
+ status: FusionPhaseStatus;
3865
+ usage: FusionPhaseUsage;
3866
+ /**
3867
+ * Structured judge or critic verdict, when the phase produces one.
3868
+ */
3869
+ verdict: string | null;
3258
3870
  }
3259
3871
  /**
3260
- * Session event "assistant.intent". Agent intent description for current activity or plan
3872
+ * Aggregate concrete-model usage for one HydraFusion phase.
3261
3873
  */
3262
- export interface AssistantIntentEvent {
3874
+ /** @experimental */
3875
+ export interface FusionPhaseUsage {
3876
+ /**
3877
+ * Total cached input tokens reported for the phase.
3878
+ */
3879
+ cachedTokens: number;
3880
+ /**
3881
+ * Total tokens written to prompt cache during the phase.
3882
+ */
3883
+ cacheWriteTokens?: number;
3884
+ /**
3885
+ * Total input tokens consumed by the phase.
3886
+ */
3887
+ inputTokens: number;
3888
+ /**
3889
+ * Total output tokens produced by the phase.
3890
+ */
3891
+ outputTokens: number;
3892
+ /**
3893
+ * Number of concrete model requests made by the phase.
3894
+ */
3895
+ requestCount: number;
3896
+ /**
3897
+ * Total normalized AI-unit cost reported for the phase, in nano-AIU.
3898
+ */
3899
+ totalNanoAiu: number;
3900
+ }
3901
+ /**
3902
+ * Session event "assistant.fusion_phase_failed". Experimental durable typed HydraFusion phase failure and degradation transition.
3903
+ */
3904
+ /** @experimental */
3905
+ export interface AssistantFusionPhaseFailedEvent {
3263
3906
  /**
3264
3907
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3265
3908
  */
3266
3909
  agentId?: string;
3267
- data: AssistantIntentData;
3910
+ data: FusionPhaseFailedData;
3268
3911
  /**
3269
- * Always true for events that are transient and not persisted to the session event log on disk.
3912
+ * When true, the event is transient and not persisted to the session event log on disk
3270
3913
  */
3271
- ephemeral: true;
3914
+ ephemeral?: boolean;
3272
3915
  /**
3273
3916
  * Unique event identifier (UUID v4), generated when the event is emitted
3274
3917
  */
@@ -3282,18 +3925,51 @@ export interface AssistantIntentEvent {
3282
3925
  */
3283
3926
  timestamp: string;
3284
3927
  /**
3285
- * Type discriminator. Always "assistant.intent".
3928
+ * Type discriminator. Always "assistant.fusion_phase_failed".
3286
3929
  */
3287
- type: "assistant.intent";
3930
+ type: "assistant.fusion_phase_failed";
3288
3931
  }
3289
3932
  /**
3290
- * Agent intent description for current activity or plan
3933
+ * Experimental durable typed HydraFusion phase failure and degradation transition.
3291
3934
  */
3292
- export interface AssistantIntentData {
3935
+ /** @experimental */
3936
+ export interface FusionPhaseFailedData {
3937
+ conversationScope: FusionConversationScope;
3293
3938
  /**
3294
- * Short description of what the agent is currently doing or planning to do
3939
+ * Identifier of the fallback phase used to continue the turn after degradation.
3295
3940
  */
3296
- intent: string;
3941
+ degradedToPhaseId?: string;
3942
+ /**
3943
+ * Elapsed execution time before the phase failed, in milliseconds.
3944
+ */
3945
+ durationMs: number;
3946
+ /**
3947
+ * Provider or execution error detail, when available.
3948
+ */
3949
+ errorMessage?: string;
3950
+ /**
3951
+ * Identifier of the HydraFusion turn containing the phase.
3952
+ */
3953
+ fusionId: string;
3954
+ /**
3955
+ * Concrete model that attempted the phase.
3956
+ */
3957
+ model: string;
3958
+ /**
3959
+ * Stable identifier for the failed phase.
3960
+ */
3961
+ phaseId: string;
3962
+ phaseKind: FusionPhaseKind;
3963
+ /**
3964
+ * Stable machine-readable reason for the phase failure.
3965
+ */
3966
+ reason: string;
3967
+ /**
3968
+ * Semantic role assigned to the failed phase.
3969
+ */
3970
+ role: string;
3971
+ status: FusionPhaseStatus;
3972
+ usage: FusionPhaseUsage;
3297
3973
  }
3298
3974
  /**
3299
3975
  * Session event "assistant.server_tool_progress". Live progress signal for a provider-hosted server tool (e.g. hosted web search) while it runs, before the finalized serverTools envelope lands on the terminal assistant.message
@@ -3583,6 +4259,12 @@ export interface AssistantMessageData {
3583
4259
  * Encrypted reasoning content from OpenAI models. Session-bound and stripped on resume.
3584
4260
  */
3585
4261
  encryptedContent?: string;
4262
+ /**
4263
+ * Experimental HydraFusion source attribution for this ordinary authoritative assistant message.
4264
+ *
4265
+ * @experimental
4266
+ */
4267
+ fusion?: FusionAttribution;
3586
4268
  /**
3587
4269
  * CAPI interaction ID for correlating this message with upstream telemetry
3588
4270
  */
@@ -3771,6 +4453,56 @@ export interface CitationLocationBlock {
3771
4453
  */
3772
4454
  type: "block";
3773
4455
  }
4456
+ /**
4457
+ * Experimental attribution linking an ordinary event to the HydraFusion turn, phase, and concrete source that produced it.
4458
+ */
4459
+ /** @experimental */
4460
+ export interface FusionAttribution {
4461
+ /**
4462
+ * Idempotency identifier for the authoritative commit, when the event belongs to the selected output.
4463
+ */
4464
+ commitId?: string;
4465
+ /**
4466
+ * Conversation scope in which the concrete phase executed.
4467
+ */
4468
+ conversationScope?: string;
4469
+ /**
4470
+ * Stable identifier for the HydraFusion turn that produced the event.
4471
+ */
4472
+ fusionId: string;
4473
+ /**
4474
+ * HydraFusion orchestration pattern selected for the turn.
4475
+ */
4476
+ pattern: string;
4477
+ /**
4478
+ * Identifier of the concrete phase that produced the event.
4479
+ */
4480
+ phaseId?: string;
4481
+ /**
4482
+ * Kind of concrete phase that produced the event.
4483
+ */
4484
+ phaseKind?: string;
4485
+ /**
4486
+ * HydraFusion routing policy used for the turn.
4487
+ */
4488
+ policy: string;
4489
+ /**
4490
+ * Semantic role assigned to the concrete phase.
4491
+ */
4492
+ role?: string;
4493
+ /**
4494
+ * Concrete model that produced the attributed event.
4495
+ */
4496
+ sourceModel?: string;
4497
+ /**
4498
+ * Phase whose output supplied the authoritative content, when different from the executing phase.
4499
+ */
4500
+ sourcePhaseId?: string;
4501
+ /**
4502
+ * Synthetic HydraFusion model selected for the session.
4503
+ */
4504
+ syntheticModel: string;
4505
+ }
3774
4506
  /**
3775
4507
  * Neutral provider-tagged reasoning content blocks preserved verbatim for round-tripping
3776
4508
  */
@@ -3821,6 +4553,7 @@ export interface AssistantMessageToolRequest {
3821
4553
  * Arguments to pass to the tool, format depends on the tool
3822
4554
  */
3823
4555
  arguments?: JsonValue;
4556
+ caller?: AssistantMessageToolRequestCaller;
3824
4557
  /**
3825
4558
  * Resolved intention summary describing what this specific call does
3826
4559
  */
@@ -3847,6 +4580,16 @@ export interface AssistantMessageToolRequest {
3847
4580
  toolTitle?: string;
3848
4581
  type?: AssistantMessageToolRequestType;
3849
4582
  }
4583
+ /**
4584
+ * Hosted program that requested this client tool call
4585
+ */
4586
+ export interface AssistantMessageToolRequestCaller {
4587
+ /**
4588
+ * Provider-assigned identifier for the hosted caller.
4589
+ */
4590
+ callerId: string;
4591
+ type: AssistantMessageToolRequestCallerType;
4592
+ }
3850
4593
  /**
3851
4594
  * Session event "assistant.message_start". Streaming assistant message start metadata
3852
4595
  */
@@ -4094,6 +4837,12 @@ export interface AssistantUsageData {
4094
4837
  * Finish reason reported by the model for this API call (e.g. "stop", "length", "tool_calls", "content_filter"). Normalized to OpenAI vocabulary; for Anthropic models a "refusal" stop reason maps to "content_filter".
4095
4838
  */
4096
4839
  finishReason?: string;
4840
+ /**
4841
+ * Experimental HydraFusion attribution for this concrete model call's usage.
4842
+ *
4843
+ * @experimental
4844
+ */
4845
+ fusion?: FusionAttribution;
4097
4846
  /**
4098
4847
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
4099
4848
  */
@@ -4261,6 +5010,12 @@ export interface ModelCallFailureData {
4261
5010
  */
4262
5011
  errorType?: string;
4263
5012
  failureKind?: ModelCallFailureKind;
5013
+ /**
5014
+ * Experimental HydraFusion attribution for this failed concrete model call.
5015
+ *
5016
+ * @experimental
5017
+ */
5018
+ fusion?: FusionAttribution;
4264
5019
  /**
4265
5020
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
4266
5021
  */
@@ -4527,6 +5282,12 @@ export interface ToolExecutionStartData {
4527
5282
  * When true, the tool output should be displayed expanded (verbatim) in the CLI timeline
4528
5283
  */
4529
5284
  displayVerbatim?: boolean;
5285
+ /**
5286
+ * Experimental HydraFusion attribution for this tool execution.
5287
+ *
5288
+ * @experimental
5289
+ */
5290
+ fusion?: FusionAttribution;
4530
5291
  /**
4531
5292
  * Name of the MCP server hosting this tool, when the tool is an MCP tool
4532
5293
  */
@@ -4736,6 +5497,12 @@ export interface ToolExecutionCompleteEvent {
4736
5497
  */
4737
5498
  export interface ToolExecutionCompleteData {
4738
5499
  error?: ToolExecutionCompleteError;
5500
+ /**
5501
+ * Experimental HydraFusion attribution for this tool completion.
5502
+ *
5503
+ * @experimental
5504
+ */
5505
+ fusion?: FusionAttribution;
4739
5506
  /**
4740
5507
  * CAPI interaction ID for correlating this tool execution with upstream telemetry
4741
5508
  */
@@ -4993,6 +5760,10 @@ export interface ToolExecutionCompleteContentShellExit {
4993
5760
  * Exit code from the completed shell command
4994
5761
  */
4995
5762
  exitCode: number;
5763
+ /**
5764
+ * Path reported in the shell session's filesystem namespace when shell output exceeded the configured large-output threshold.
5765
+ */
5766
+ outputFilePath?: string;
4996
5767
  /**
4997
5768
  * Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output.
4998
5769
  */
@@ -5430,6 +6201,14 @@ export interface SubagentStartedData {
5430
6201
  * Internal name of the sub-agent
5431
6202
  */
5432
6203
  agentName: string;
6204
+ /**
6205
+ * Type of the sub-agent selected at spawn time.
6206
+ */
6207
+ agentType?: string;
6208
+ /**
6209
+ * Whether the sub-agent runs synchronously or in the background.
6210
+ */
6211
+ executionMode?: string;
5433
6212
  /**
5434
6213
  * Root id of the factory run that spawned this sub-agent, when it was spawned by one.
5435
6214
  */
@@ -5438,11 +6217,70 @@ export interface SubagentStartedData {
5438
6217
  * Model the sub-agent will run with, when known at start.
5439
6218
  */
5440
6219
  model?: string;
6220
+ /**
6221
+ * Task-registry ID of the spawning sub-agent. Absent when the root session spawned this child.
6222
+ */
6223
+ parentId?: string;
6224
+ /**
6225
+ * Whether this sub-agent can be resumed. Currently always false.
6226
+ */
6227
+ resumable?: boolean;
5441
6228
  /**
5442
6229
  * Tool call ID of the parent tool invocation that spawned this sub-agent
5443
6230
  */
5444
6231
  toolCallId: string;
5445
6232
  }
6233
+ /**
6234
+ * Session event "subagent.configured". Resolved runtime configuration for a configured sub-agent
6235
+ */
6236
+ export interface SubagentConfiguredEvent {
6237
+ /**
6238
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6239
+ */
6240
+ agentId?: string;
6241
+ data: SubagentConfiguredData;
6242
+ /**
6243
+ * When true, the event is transient and not persisted to the session event log on disk
6244
+ */
6245
+ ephemeral?: boolean;
6246
+ /**
6247
+ * Unique event identifier (UUID v4), generated when the event is emitted
6248
+ */
6249
+ id: string;
6250
+ /**
6251
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6252
+ */
6253
+ parentId: string | null;
6254
+ /**
6255
+ * ISO 8601 timestamp when the event was created
6256
+ */
6257
+ timestamp: string;
6258
+ /**
6259
+ * Type discriminator. Always "subagent.configured".
6260
+ */
6261
+ type: "subagent.configured";
6262
+ }
6263
+ /**
6264
+ * Resolved runtime configuration for a configured sub-agent
6265
+ */
6266
+ export interface SubagentConfiguredData {
6267
+ /**
6268
+ * Resolved context tier, when configured for the model
6269
+ */
6270
+ contextTier?: string;
6271
+ /**
6272
+ * Resolved model the sub-agent will run with
6273
+ */
6274
+ model: string;
6275
+ /**
6276
+ * Whether the sub-agent accepts follow-up turns
6277
+ */
6278
+ multiTurn: boolean;
6279
+ /**
6280
+ * Resolved reasoning effort, when configured for the model
6281
+ */
6282
+ reasoningEffort?: string;
6283
+ }
5446
6284
  /**
5447
6285
  * Session event "subagent.completed". Sub-agent completion details for successful execution
5448
6286
  */
@@ -5742,9 +6580,13 @@ export interface HookStartData {
5742
6580
  */
5743
6581
  hookType: string;
5744
6582
  /**
5745
- * Input data passed to the hook
6583
+ * Input data passed to the hook. For postToolUse hooks the retained copy served by session.eventLog.read (and by a resumed session) elides the tool result's inline `contents`/`uiResource` and replaces an over-long `textResultForLlm` with a `[copilot:elided ...]` marker, to keep a multi-megabyte payload out of the durable event log; the live subscription stream still delivers the full value. Read the adjacent tool.execution_complete event for the tool result itself.
5746
6584
  */
5747
6585
  input?: JsonValue;
6586
+ /**
6587
+ * Tool call ID of the parent tool invocation when this event originates from a sub-agent
6588
+ */
6589
+ parentToolCallId?: string;
5748
6590
  }
5749
6591
  /**
5750
6592
  * Session event "hook.end". Hook invocation completion details including output, success status, and error information
@@ -5793,6 +6635,10 @@ export interface HookEndData {
5793
6635
  * Output data produced by the hook
5794
6636
  */
5795
6637
  output?: JsonValue;
6638
+ /**
6639
+ * Tool call ID of the parent tool invocation when this event originates from a sub-agent
6640
+ */
6641
+ parentToolCallId?: string;
5796
6642
  /**
5797
6643
  * Whether the hook completed successfully
5798
6644
  */