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

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,7 @@ 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
13
  /**
14
14
  * Hosting platform type of the repository (github or ado)
15
15
  */
@@ -46,6 +46,16 @@ export type Verbosity =
46
46
  | "medium"
47
47
  /** A more detailed response was requested. */
48
48
  | "high";
49
+ /**
50
+ * The session mode the agent is operating in
51
+ */
52
+ export type SessionMode =
53
+ /** The agent is responding interactively to the user. */
54
+ "interactive"
55
+ /** The agent is preparing a plan before making changes. */
56
+ | "plan"
57
+ /** The agent is working autonomously toward task completion. */
58
+ | "autopilot";
49
59
  /**
50
60
  * 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
61
  */
@@ -102,16 +112,6 @@ export type ModelChangeSource =
102
112
  | "automatic"
103
113
  /** An SDK or RPC caller selected the model. */
104
114
  | "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
115
  /**
116
116
  * Permission mode for the session.
117
117
  */
@@ -181,6 +181,35 @@ export type TaskCompletionOutcome =
181
181
  | "continue"
182
182
  /** Completion cannot proceed without intervention; the active objective is paused when one is identified. */
183
183
  | "blocked";
184
+ /**
185
+ * Kind of turn for which HydraFusion routing is running.
186
+ */
187
+ /** @experimental */
188
+ export type FusionTurnKind =
189
+ /** A user-message turn. */
190
+ "user"
191
+ /** A conversation-compaction turn. */
192
+ | "compaction";
193
+ /**
194
+ * Server-recommended routing behavior for a later HydraFusion turn.
195
+ */
196
+ /** @experimental */
197
+ export type FusionFollowUpAction =
198
+ /** Reuse the durable primary model without routing. */
199
+ "reuse_primary"
200
+ /** Request a new routing decision. */
201
+ | "reroute";
202
+ /**
203
+ * Validated HydraFusion execution pattern.
204
+ */
205
+ /** @experimental */
206
+ export type FusionPattern =
207
+ /** Run one primary solver phase. */
208
+ "single"
209
+ /** Run a primary phase, a judge, and an optional repair. */
210
+ | "cascade"
211
+ /** Run a primary draft, a read-only critique, and a revision. */
212
+ | "critique";
184
213
  /**
185
214
  * The agent mode that was active when this message was sent
186
215
  */
@@ -225,6 +254,45 @@ export type UserMessageDelivery =
225
254
  | "steering"
226
255
  /** Enqueued while the agent was busy; processed as its own run afterward. */
227
256
  | "queued";
257
+ /**
258
+ * Conversation scope in which a HydraFusion phase executes.
259
+ */
260
+ /** @experimental */
261
+ export type FusionConversationScope =
262
+ /** Canonical root conversation history. */
263
+ "root"
264
+ /** Isolated read-only review history that does not enter the root conversation. */
265
+ | "review";
266
+ /**
267
+ * HydraFusion phase kind.
268
+ */
269
+ /** @experimental */
270
+ export type FusionPhaseKind =
271
+ /** Primary solver phase. */
272
+ "primary"
273
+ /** Read-only cascade judge phase. */
274
+ | "judge"
275
+ /** Cascade repair phase. */
276
+ | "repair"
277
+ /** Initial critique-pattern draft phase. */
278
+ | "draft"
279
+ /** Read-only critique phase. */
280
+ | "critic"
281
+ /** Critique-pattern revision phase. */
282
+ | "revision"
283
+ /** Follow-up phase continuing from the resolved model. */
284
+ | "follow_up";
285
+ /**
286
+ * Durable outcome status of a HydraFusion phase.
287
+ */
288
+ /** @experimental */
289
+ export type FusionPhaseStatus =
290
+ /** The phase completed successfully. */
291
+ "succeeded"
292
+ /** The phase failed. */
293
+ | "failed"
294
+ /** The phase was cancelled. */
295
+ | "cancelled";
228
296
  /**
229
297
  * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
230
298
  */
@@ -1170,6 +1238,7 @@ export interface IdleData {
1170
1238
  * True when the preceding agentic loop was cancelled via abort signal
1171
1239
  */
1172
1240
  aborted?: boolean;
1241
+ mode?: SessionMode;
1173
1242
  }
1174
1243
  /**
1175
1244
  * Session event "session.title_changed". Session title change payload containing the new display title
@@ -2482,6 +2551,10 @@ export interface CompactionCompleteEvent {
2482
2551
  * Conversation compaction results including success status, metrics, and optional error details
2483
2552
  */
2484
2553
  export interface CompactionCompleteData {
2554
+ /**
2555
+ * Canonical model identifier used for model-specific behavior when replaying compaction
2556
+ */
2557
+ behaviorModelId?: string;
2485
2558
  /**
2486
2559
  * Checkpoint snapshot number created for recovery
2487
2560
  */
@@ -2660,18 +2733,19 @@ export interface TaskCompleteData {
2660
2733
  summary?: string;
2661
2734
  }
2662
2735
  /**
2663
- * Session event "user.message". Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
2736
+ * Session event "session.fusion_route_started". Experimental transient signal that HydraFusion routing has started for an eligible turn.
2664
2737
  */
2665
- export interface UserMessageEvent {
2738
+ /** @experimental */
2739
+ export interface FusionRouteStartedEvent {
2666
2740
  /**
2667
2741
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2668
2742
  */
2669
2743
  agentId?: string;
2670
- data: UserMessageData;
2744
+ data: FusionRouteStartedData;
2671
2745
  /**
2672
- * When true, the event is transient and not persisted to the session event log on disk
2746
+ * Always true for events that are transient and not persisted to the session event log on disk.
2673
2747
  */
2674
- ephemeral?: boolean;
2748
+ ephemeral: true;
2675
2749
  /**
2676
2750
  * Unique event identifier (UUID v4), generated when the event is emitted
2677
2751
  */
@@ -2685,287 +2759,645 @@ export interface UserMessageEvent {
2685
2759
  */
2686
2760
  timestamp: string;
2687
2761
  /**
2688
- * Type discriminator. Always "user.message".
2762
+ * Type discriminator. Always "session.fusion_route_started".
2689
2763
  */
2690
- type: "user.message";
2764
+ type: "session.fusion_route_started";
2691
2765
  }
2692
2766
  /**
2693
- * Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
2767
+ * Experimental transient signal that HydraFusion routing has started for an eligible turn.
2694
2768
  */
2695
- export interface UserMessageData {
2696
- agentMode?: UserMessageAgentMode;
2697
- /**
2698
- * Files, selections, or GitHub references attached to the message
2699
- */
2700
- attachments?: Attachment[];
2769
+ /** @experimental */
2770
+ export interface FusionRouteStartedData {
2701
2771
  /**
2702
- * The user's message text as displayed in the timeline
2772
+ * Identifier for this routing attempt before a durable Fusion turn exists.
2703
2773
  */
2704
- content: string;
2705
- delivery?: UserMessageDelivery;
2774
+ attemptId: string;
2706
2775
  /**
2707
- * CAPI interaction ID for correlating this user message with its turn
2776
+ * HydraFusion routing policy requested for the turn.
2708
2777
  */
2709
- interactionId?: string;
2778
+ policy?: string;
2710
2779
  /**
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.
2780
+ * Synthetic HydraFusion model selected for the session.
2712
2781
  */
2713
- isAutopilotContinuation?: boolean;
2782
+ syntheticModel?: string;
2783
+ turnKind: FusionTurnKind;
2784
+ }
2785
+ /**
2786
+ * Session event "session.fusion_route_failed". Experimental durable HydraFusion routing failure and the deterministic concrete fallback selected for the turn.
2787
+ */
2788
+ /** @experimental */
2789
+ export interface FusionRouteFailedEvent {
2714
2790
  /**
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
2791
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2716
2792
  */
2717
- nativeDocumentPathFallbackPaths?: string[];
2793
+ agentId?: string;
2794
+ data: FusionRouteFailedData;
2718
2795
  /**
2719
- * Parent agent task ID for background telemetry correlated to this user turn
2796
+ * When true, the event is transient and not persisted to the session event log on disk
2720
2797
  */
2721
- parentAgentTaskId?: string;
2798
+ ephemeral?: boolean;
2722
2799
  /**
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)
2800
+ * Unique event identifier (UUID v4), generated when the event is emitted
2724
2801
  */
2725
- source?: string;
2802
+ id: string;
2726
2803
  /**
2727
- * Normalized document MIME types that were sent natively instead of through tagged_files XML
2804
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2728
2805
  */
2729
- supportedNativeDocumentMimeTypes?: string[];
2806
+ parentId: string | null;
2730
2807
  /**
2731
- * Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
2808
+ * ISO 8601 timestamp when the event was created
2732
2809
  */
2733
- transformedContent?: string;
2810
+ timestamp: string;
2734
2811
  /**
2735
- * The agent-loop turn ID that consumed this message; absent when no agent-loop turn consumed it
2812
+ * Type discriminator. Always "session.fusion_route_failed".
2736
2813
  */
2737
- turnId?: string;
2814
+ type: "session.fusion_route_failed";
2738
2815
  }
2739
2816
  /**
2740
- * File attachment
2817
+ * Experimental durable HydraFusion routing failure and the deterministic concrete fallback selected for the turn.
2741
2818
  */
2742
- export interface AttachmentFile {
2819
+ /** @experimental */
2820
+ export interface FusionRouteFailedData {
2743
2821
  /**
2744
- * Internal: content-addressed id of the session.binary_asset event holding this attachment's model-facing bytes (e.g. "sha256:..."). Absent externally.
2822
+ * Identifier of the routing attempt that failed.
2745
2823
  */
2746
- assetId?: string;
2824
+ attemptId: string;
2747
2825
  /**
2748
- * Internal: decoded byte length of the attachment's model-facing bytes. Absent externally.
2826
+ * Provider or validation error detail, when available.
2749
2827
  */
2750
- byteLength?: number;
2828
+ errorMessage?: string;
2751
2829
  /**
2752
- * User-facing display name for the attachment
2830
+ * Concrete model selected as the deterministic fallback.
2753
2831
  */
2754
- displayName: string;
2755
- lineRange?: AttachmentFileLineRange;
2832
+ fallbackModel: string;
2756
2833
  /**
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.
2834
+ * HydraFusion routing policy requested for the turn.
2758
2835
  */
2759
- mimeType?: string;
2760
- omittedReason?: OmittedBinaryOmittedReason;
2836
+ policy: string;
2761
2837
  /**
2762
- * Absolute file path
2838
+ * Stable machine-readable reason for the routing failure.
2763
2839
  */
2764
- path: string;
2840
+ reason: string;
2765
2841
  /**
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).
2842
+ * Elapsed routing time in milliseconds before the failure.
2767
2843
  */
2768
- taggedFilesEntry?: string;
2844
+ routingLatencyMs?: number;
2769
2845
  /**
2770
- * Attachment type discriminator
2846
+ * Synthetic HydraFusion model selected for the session.
2771
2847
  */
2772
- type: "file";
2848
+ syntheticModel: string;
2773
2849
  }
2774
2850
  /**
2775
- * Optional line range to scope the attachment to a specific section of the file
2851
+ * Session event "session.fusion_resolved". Experimental durable validated HydraFusion route and turn policy.
2776
2852
  */
2777
- export interface AttachmentFileLineRange {
2853
+ /** @experimental */
2854
+ export interface FusionResolvedEvent {
2778
2855
  /**
2779
- * End line number (1-based, inclusive)
2856
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2780
2857
  */
2781
- end: number;
2858
+ agentId?: string;
2859
+ data: FusionResolvedData;
2782
2860
  /**
2783
- * Start line number (1-based)
2861
+ * When true, the event is transient and not persisted to the session event log on disk
2784
2862
  */
2785
- start: number;
2786
- }
2787
- /**
2788
- * Directory attachment
2789
- */
2790
- export interface AttachmentDirectory {
2863
+ ephemeral?: boolean;
2791
2864
  /**
2792
- * User-facing display name for the attachment
2865
+ * Unique event identifier (UUID v4), generated when the event is emitted
2793
2866
  */
2794
- displayName: string;
2867
+ id: string;
2795
2868
  /**
2796
- * Absolute directory path
2869
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2797
2870
  */
2798
- path: string;
2871
+ parentId: string | null;
2799
2872
  /**
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.
2873
+ * ISO 8601 timestamp when the event was created
2801
2874
  */
2802
- taggedFilesEntry?: string;
2875
+ timestamp: string;
2803
2876
  /**
2804
- * Attachment type discriminator
2877
+ * Type discriminator. Always "session.fusion_resolved".
2805
2878
  */
2806
- type: "directory";
2879
+ type: "session.fusion_resolved";
2807
2880
  }
2808
2881
  /**
2809
- * Code selection attachment from an editor
2882
+ * Experimental durable validated HydraFusion route and turn policy.
2810
2883
  */
2811
- export interface AttachmentSelection {
2884
+ /** @experimental */
2885
+ export interface FusionResolvedData {
2812
2886
  /**
2813
- * User-facing display name for the selection
2887
+ * Version of the validated HydraFusion event contract.
2814
2888
  */
2815
- displayName: string;
2889
+ contractVersion: number;
2816
2890
  /**
2817
- * Absolute path to the file containing the selection
2891
+ * Concrete model used when the planned primary model cannot execute.
2818
2892
  */
2819
- filePath: string;
2820
- selection: AttachmentSelectionDetails;
2893
+ fallbackModel: string;
2894
+ followUp?: FusionFollowUpRecommendation;
2821
2895
  /**
2822
- * The selected text content
2896
+ * Concrete model recommended for eligible follow-up turns.
2823
2897
  */
2824
- text: string;
2898
+ followUpModel: string;
2825
2899
  /**
2826
- * Attachment type discriminator
2900
+ * Stable identifier for the resolved HydraFusion turn.
2827
2901
  */
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 {
2902
+ fusionId: string;
2841
2903
  /**
2842
- * End character offset within the line (0-based)
2904
+ * Version of the executable model universe used for selection.
2843
2905
  */
2844
- character: number;
2906
+ modelUniverseVersion?: string;
2907
+ pattern: FusionPattern;
2845
2908
  /**
2846
- * End line number (0-based)
2909
+ * Version of the validated execution-plan format.
2847
2910
  */
2848
- line: number;
2849
- }
2850
- /**
2851
- * Start position of the selection
2852
- */
2853
- export interface AttachmentSelectionDetailsStart {
2911
+ planVersion?: string;
2854
2912
  /**
2855
- * Start character offset within the line (0-based)
2913
+ * HydraFusion routing policy used to resolve the plan.
2856
2914
  */
2857
- character: number;
2915
+ policy: string;
2858
2916
  /**
2859
- * Start line number (0-based)
2917
+ * Version of the local routing policy.
2860
2918
  */
2861
- line: number;
2862
- }
2863
- /**
2864
- * GitHub issue, pull request, or discussion reference
2865
- */
2866
- export interface AttachmentGitHubReference {
2919
+ policyVersion?: string;
2867
2920
  /**
2868
- * Issue, pull request, or discussion number
2921
+ * Concrete model selected for the primary solver phase.
2869
2922
  */
2870
- number: number;
2871
- referenceType: AttachmentGitHubReferenceType;
2923
+ primaryModel: string;
2872
2924
  /**
2873
- * Current state of the referenced item (e.g., open, closed, merged)
2925
+ * Router implementation that supplied the plan.
2874
2926
  */
2875
- state: string;
2927
+ routeSource?: string;
2876
2928
  /**
2877
- * Title of the referenced item
2929
+ * Elapsed time in milliseconds required to resolve and validate the route.
2878
2930
  */
2879
- title: string;
2931
+ routingLatencyMs?: number;
2880
2932
  /**
2881
- * Attachment type discriminator
2933
+ * Identifier of the local policy rule that matched.
2882
2934
  */
2883
- type: "github_reference";
2935
+ ruleId?: string;
2884
2936
  /**
2885
- * URL to the referenced item on GitHub
2937
+ * Zero-based index of the local policy rule that matched.
2886
2938
  */
2887
- url: string;
2888
- }
2889
- /**
2890
- * Pointer to a GitHub commit.
2891
- */
2892
- export interface AttachmentGitHubCommit {
2939
+ ruleIndex?: number;
2893
2940
  /**
2894
- * First line of the commit message
2941
+ * Human-readable name of the local policy rule that matched.
2895
2942
  */
2896
- message: string;
2943
+ ruleName?: string;
2944
+ scores?: FusionScores;
2897
2945
  /**
2898
- * Full commit SHA
2946
+ * Concrete model selected for the review or judge phase, when required.
2899
2947
  */
2900
- oid: string;
2901
- repo: GitHubRepoRef;
2948
+ secondaryModel: string | null;
2902
2949
  /**
2903
- * Attachment type discriminator
2950
+ * Synthetic HydraFusion model selected for the session.
2904
2951
  */
2905
- type: "github_commit";
2952
+ syntheticModel: string;
2906
2953
  /**
2907
- * URL to the commit on GitHub
2954
+ * Identifier of the session turn associated with the route.
2908
2955
  */
2909
- url: string;
2956
+ turnId: string;
2910
2957
  }
2911
2958
  /**
2912
- * Pointer to a GitHub repository.
2959
+ * Durable server recommendation for subsequent HydraFusion turns.
2913
2960
  */
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;
2961
+ /** @experimental */
2962
+ export interface FusionFollowUpRecommendation {
2963
+ compactionTurn: FusionFollowUpAction;
2964
+ userTurn: FusionFollowUpAction;
2927
2965
  }
2928
2966
  /**
2929
- * Pointer to a GitHub release.
2967
+ * Validated HydraFusion routing capability scores.
2930
2968
  */
2931
- export interface AttachmentGitHubRelease {
2969
+ /** @experimental */
2970
+ export interface FusionScores {
2932
2971
  /**
2933
- * Human-readable release name
2972
+ * Code-generation capability score returned by the authenticated router.
2934
2973
  */
2935
- name: string;
2936
- repo: GitHubRepoRef;
2974
+ codeGen: number;
2937
2975
  /**
2938
- * Git tag the release is anchored to
2976
+ * Debugging capability score returned by the authenticated router.
2939
2977
  */
2940
- tagName: string;
2978
+ debugging: number;
2941
2979
  /**
2942
- * Attachment type discriminator
2980
+ * Reasoning capability score returned by the authenticated router.
2943
2981
  */
2944
- type: "github_release";
2982
+ reasoning: number;
2945
2983
  /**
2946
- * URL to the release on GitHub
2984
+ * Tool-use capability score returned by the authenticated router.
2947
2985
  */
2948
- url: string;
2986
+ toolUse: number;
2949
2987
  }
2950
2988
  /**
2951
- * Pointer to a GitHub Actions job.
2989
+ * Session event "session.fusion_completed". Experimental durable aggregate outcome of a HydraFusion turn.
2952
2990
  */
2953
- export interface AttachmentGitHubActionsJob {
2991
+ /** @experimental */
2992
+ export interface FusionCompletedEvent {
2954
2993
  /**
2955
- * Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs.
2994
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2956
2995
  */
2957
- conclusion?: string;
2996
+ agentId?: string;
2997
+ data: FusionCompletedData;
2958
2998
  /**
2959
- * Job id within the workflow run
2999
+ * When true, the event is transient and not persisted to the session event log on disk
2960
3000
  */
2961
- jobId: number;
3001
+ ephemeral?: boolean;
2962
3002
  /**
2963
- * Display name of the job
3003
+ * Unique event identifier (UUID v4), generated when the event is emitted
2964
3004
  */
2965
- jobName: string;
2966
- repo: GitHubRepoRef;
3005
+ id: string;
2967
3006
  /**
2968
- * Attachment type discriminator
3007
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3008
+ */
3009
+ parentId: string | null;
3010
+ /**
3011
+ * ISO 8601 timestamp when the event was created
3012
+ */
3013
+ timestamp: string;
3014
+ /**
3015
+ * Type discriminator. Always "session.fusion_completed".
3016
+ */
3017
+ type: "session.fusion_completed";
3018
+ }
3019
+ /**
3020
+ * Experimental durable aggregate outcome of a HydraFusion turn.
3021
+ */
3022
+ /** @experimental */
3023
+ export interface FusionCompletedData {
3024
+ /**
3025
+ * Total cached input tokens reported across all phases.
3026
+ */
3027
+ cachedTokens: number;
3028
+ /**
3029
+ * Total tokens written to prompt cache across all phases.
3030
+ */
3031
+ cacheWriteTokens?: number;
3032
+ /**
3033
+ * Idempotency identifier for the authoritative final commit.
3034
+ */
3035
+ commitId: string;
3036
+ /**
3037
+ * Reason the turn used a degraded route, when applicable.
3038
+ */
3039
+ degradedReason: string | null;
3040
+ /**
3041
+ * Total elapsed execution time for the HydraFusion turn in milliseconds.
3042
+ */
3043
+ durationMs: number;
3044
+ /**
3045
+ * Concrete model that supplied the authoritative final content.
3046
+ */
3047
+ finalSourceModel: string | null;
3048
+ /**
3049
+ * Phase whose output supplied the authoritative final content.
3050
+ */
3051
+ finalSourcePhaseId: string | null;
3052
+ /**
3053
+ * Concrete model recommended for eligible follow-up turns.
3054
+ */
3055
+ followUpModel: string;
3056
+ /**
3057
+ * Stable identifier for the completed HydraFusion turn.
3058
+ */
3059
+ fusionId: string;
3060
+ /**
3061
+ * Total input tokens consumed across all phases.
3062
+ */
3063
+ inputTokens: number;
3064
+ /**
3065
+ * Stable aggregate outcome of the HydraFusion turn.
3066
+ */
3067
+ outcome: string;
3068
+ /**
3069
+ * Total output tokens produced across all phases.
3070
+ */
3071
+ outputTokens: number;
3072
+ pattern: FusionPattern;
3073
+ /**
3074
+ * Number of concrete phases attempted by the turn.
3075
+ */
3076
+ phaseCount: number;
3077
+ /**
3078
+ * Total concrete model requests made across all phases.
3079
+ */
3080
+ requestCount: number;
3081
+ /**
3082
+ * Synthetic HydraFusion model selected for the session.
3083
+ */
3084
+ syntheticModel: string;
3085
+ /**
3086
+ * Total normalized AI-unit cost reported across all phases, in nano-AIU.
3087
+ */
3088
+ totalNanoAiu: number;
3089
+ /**
3090
+ * Identifier of the session turn associated with the completion.
3091
+ */
3092
+ turnId: string;
3093
+ }
3094
+ /**
3095
+ * Session event "user.message". Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
3096
+ */
3097
+ export interface UserMessageEvent {
3098
+ /**
3099
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3100
+ */
3101
+ agentId?: string;
3102
+ data: UserMessageData;
3103
+ /**
3104
+ * When true, the event is transient and not persisted to the session event log on disk
3105
+ */
3106
+ ephemeral?: boolean;
3107
+ /**
3108
+ * Unique event identifier (UUID v4), generated when the event is emitted
3109
+ */
3110
+ id: string;
3111
+ /**
3112
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3113
+ */
3114
+ parentId: string | null;
3115
+ /**
3116
+ * ISO 8601 timestamp when the event was created
3117
+ */
3118
+ timestamp: string;
3119
+ /**
3120
+ * Type discriminator. Always "user.message".
3121
+ */
3122
+ type: "user.message";
3123
+ }
3124
+ /**
3125
+ * Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
3126
+ */
3127
+ export interface UserMessageData {
3128
+ agentMode?: UserMessageAgentMode;
3129
+ /**
3130
+ * Files, selections, or GitHub references attached to the message
3131
+ */
3132
+ attachments?: Attachment[];
3133
+ /**
3134
+ * The user's message text as displayed in the timeline
3135
+ */
3136
+ content: string;
3137
+ delivery?: UserMessageDelivery;
3138
+ /**
3139
+ * CAPI interaction ID for correlating this user message with its turn
3140
+ */
3141
+ interactionId?: string;
3142
+ /**
3143
+ * 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.
3144
+ */
3145
+ isAutopilotContinuation?: boolean;
3146
+ /**
3147
+ * 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
3148
+ */
3149
+ nativeDocumentPathFallbackPaths?: string[];
3150
+ /**
3151
+ * Parent agent task ID for background telemetry correlated to this user turn
3152
+ */
3153
+ parentAgentTaskId?: string;
3154
+ /**
3155
+ * 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)
3156
+ */
3157
+ source?: string;
3158
+ /**
3159
+ * Normalized document MIME types that were sent natively instead of through tagged_files XML
3160
+ */
3161
+ supportedNativeDocumentMimeTypes?: string[];
3162
+ /**
3163
+ * Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
3164
+ */
3165
+ transformedContent?: string;
3166
+ /**
3167
+ * The agent-loop turn ID that consumed this message; absent when no agent-loop turn consumed it
3168
+ */
3169
+ turnId?: string;
3170
+ }
3171
+ /**
3172
+ * File attachment
3173
+ */
3174
+ export interface AttachmentFile {
3175
+ /**
3176
+ * Internal: content-addressed id of the session.binary_asset event holding this attachment's model-facing bytes (e.g. "sha256:..."). Absent externally.
3177
+ */
3178
+ assetId?: string;
3179
+ /**
3180
+ * Internal: decoded byte length of the attachment's model-facing bytes. Absent externally.
3181
+ */
3182
+ byteLength?: number;
3183
+ /**
3184
+ * User-facing display name for the attachment
3185
+ */
3186
+ displayName: string;
3187
+ lineRange?: AttachmentFileLineRange;
3188
+ /**
3189
+ * 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.
3190
+ */
3191
+ mimeType?: string;
3192
+ omittedReason?: OmittedBinaryOmittedReason;
3193
+ /**
3194
+ * Absolute file path
3195
+ */
3196
+ path: string;
3197
+ /**
3198
+ * 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).
3199
+ */
3200
+ taggedFilesEntry?: string;
3201
+ /**
3202
+ * Attachment type discriminator
3203
+ */
3204
+ type: "file";
3205
+ }
3206
+ /**
3207
+ * Optional line range to scope the attachment to a specific section of the file
3208
+ */
3209
+ export interface AttachmentFileLineRange {
3210
+ /**
3211
+ * End line number (1-based, inclusive)
3212
+ */
3213
+ end: number;
3214
+ /**
3215
+ * Start line number (1-based)
3216
+ */
3217
+ start: number;
3218
+ }
3219
+ /**
3220
+ * Directory attachment
3221
+ */
3222
+ export interface AttachmentDirectory {
3223
+ /**
3224
+ * User-facing display name for the attachment
3225
+ */
3226
+ displayName: string;
3227
+ /**
3228
+ * Absolute directory path
3229
+ */
3230
+ path: string;
3231
+ /**
3232
+ * 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.
3233
+ */
3234
+ taggedFilesEntry?: string;
3235
+ /**
3236
+ * Attachment type discriminator
3237
+ */
3238
+ type: "directory";
3239
+ }
3240
+ /**
3241
+ * Code selection attachment from an editor
3242
+ */
3243
+ export interface AttachmentSelection {
3244
+ /**
3245
+ * User-facing display name for the selection
3246
+ */
3247
+ displayName: string;
3248
+ /**
3249
+ * Absolute path to the file containing the selection
3250
+ */
3251
+ filePath: string;
3252
+ selection: AttachmentSelectionDetails;
3253
+ /**
3254
+ * The selected text content
3255
+ */
3256
+ text: string;
3257
+ /**
3258
+ * Attachment type discriminator
3259
+ */
3260
+ type: "selection";
3261
+ }
3262
+ /**
3263
+ * Position range of the selection within the file
3264
+ */
3265
+ export interface AttachmentSelectionDetails {
3266
+ end: AttachmentSelectionDetailsEnd;
3267
+ start: AttachmentSelectionDetailsStart;
3268
+ }
3269
+ /**
3270
+ * End position of the selection
3271
+ */
3272
+ export interface AttachmentSelectionDetailsEnd {
3273
+ /**
3274
+ * End character offset within the line (0-based)
3275
+ */
3276
+ character: number;
3277
+ /**
3278
+ * End line number (0-based)
3279
+ */
3280
+ line: number;
3281
+ }
3282
+ /**
3283
+ * Start position of the selection
3284
+ */
3285
+ export interface AttachmentSelectionDetailsStart {
3286
+ /**
3287
+ * Start character offset within the line (0-based)
3288
+ */
3289
+ character: number;
3290
+ /**
3291
+ * Start line number (0-based)
3292
+ */
3293
+ line: number;
3294
+ }
3295
+ /**
3296
+ * GitHub issue, pull request, or discussion reference
3297
+ */
3298
+ export interface AttachmentGitHubReference {
3299
+ /**
3300
+ * Issue, pull request, or discussion number
3301
+ */
3302
+ number: number;
3303
+ referenceType: AttachmentGitHubReferenceType;
3304
+ /**
3305
+ * Current state of the referenced item (e.g., open, closed, merged)
3306
+ */
3307
+ state: string;
3308
+ /**
3309
+ * Title of the referenced item
3310
+ */
3311
+ title: string;
3312
+ /**
3313
+ * Attachment type discriminator
3314
+ */
3315
+ type: "github_reference";
3316
+ /**
3317
+ * URL to the referenced item on GitHub
3318
+ */
3319
+ url: string;
3320
+ }
3321
+ /**
3322
+ * Pointer to a GitHub commit.
3323
+ */
3324
+ export interface AttachmentGitHubCommit {
3325
+ /**
3326
+ * First line of the commit message
3327
+ */
3328
+ message: string;
3329
+ /**
3330
+ * Full commit SHA
3331
+ */
3332
+ oid: string;
3333
+ repo: GitHubRepoRef;
3334
+ /**
3335
+ * Attachment type discriminator
3336
+ */
3337
+ type: "github_commit";
3338
+ /**
3339
+ * URL to the commit on GitHub
3340
+ */
3341
+ url: string;
3342
+ }
3343
+ /**
3344
+ * Pointer to a GitHub repository.
3345
+ */
3346
+ export interface GitHubRepoRef {
3347
+ /**
3348
+ * Numeric GitHub repository id
3349
+ */
3350
+ id?: number;
3351
+ /**
3352
+ * Repository name (without owner)
3353
+ */
3354
+ name: string;
3355
+ /**
3356
+ * Repository owner login (user or organization)
3357
+ */
3358
+ owner: string;
3359
+ }
3360
+ /**
3361
+ * Pointer to a GitHub release.
3362
+ */
3363
+ export interface AttachmentGitHubRelease {
3364
+ /**
3365
+ * Human-readable release name
3366
+ */
3367
+ name: string;
3368
+ repo: GitHubRepoRef;
3369
+ /**
3370
+ * Git tag the release is anchored to
3371
+ */
3372
+ tagName: string;
3373
+ /**
3374
+ * Attachment type discriminator
3375
+ */
3376
+ type: "github_release";
3377
+ /**
3378
+ * URL to the release on GitHub
3379
+ */
3380
+ url: string;
3381
+ }
3382
+ /**
3383
+ * Pointer to a GitHub Actions job.
3384
+ */
3385
+ export interface AttachmentGitHubActionsJob {
3386
+ /**
3387
+ * Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs.
3388
+ */
3389
+ conclusion?: string;
3390
+ /**
3391
+ * Job id within the workflow run
3392
+ */
3393
+ jobId: number;
3394
+ /**
3395
+ * Display name of the job
3396
+ */
3397
+ jobName: string;
3398
+ repo: GitHubRepoRef;
3399
+ /**
3400
+ * Attachment type discriminator
2969
3401
  */
2970
3402
  type: "github_actions_job";
2971
3403
  /**
@@ -3126,63 +3558,185 @@ export interface AttachmentBlob {
3126
3558
  /**
3127
3559
  * Base64-encoded content. Present on input and for external consumers; replaced by an internal `assetId` reference in persisted events when interned to a content-addressed asset.
3128
3560
  */
3129
- data?: string;
3561
+ data?: string;
3562
+ /**
3563
+ * User-facing display name for the attachment
3564
+ */
3565
+ displayName?: string;
3566
+ /**
3567
+ * MIME type of the inline data
3568
+ */
3569
+ mimeType: string;
3570
+ omittedReason?: OmittedBinaryOmittedReason;
3571
+ /**
3572
+ * Attachment type discriminator
3573
+ */
3574
+ type: "blob";
3575
+ }
3576
+ /**
3577
+ * 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.
3578
+ */
3579
+ export interface AttachmentExtensionContext {
3580
+ /**
3581
+ * Provider-local canvas identifier when the push was bound to a canvas instance
3582
+ */
3583
+ canvasId?: string;
3584
+ /**
3585
+ * ISO 8601 timestamp captured by the runtime when the push was accepted
3586
+ */
3587
+ capturedAt: string;
3588
+ /**
3589
+ * Owning extension identifier. Runtime-derived from the caller's connection when produced via session.extensions.sendAttachmentsToMessage; preserved verbatim on subsequent transports.
3590
+ */
3591
+ extensionId: string;
3592
+ /**
3593
+ * Open canvas instance identifier when the push was bound to a canvas instance
3594
+ */
3595
+ instanceId?: string;
3596
+ /**
3597
+ * Caller-supplied JSON payload
3598
+ */
3599
+ payload?: JsonValue;
3600
+ /**
3601
+ * Human-readable composer pill label
3602
+ */
3603
+ title: string;
3604
+ /**
3605
+ * Attachment type discriminator
3606
+ */
3607
+ type: "extension_context";
3608
+ }
3609
+ /**
3610
+ * Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
3611
+ */
3612
+ export interface PendingMessagesModifiedEvent {
3613
+ /**
3614
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3615
+ */
3616
+ agentId?: string;
3617
+ data: PendingMessagesModifiedData;
3618
+ /**
3619
+ * Always true for events that are transient and not persisted to the session event log on disk.
3620
+ */
3621
+ ephemeral: true;
3622
+ /**
3623
+ * Unique event identifier (UUID v4), generated when the event is emitted
3624
+ */
3625
+ id: string;
3626
+ /**
3627
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3628
+ */
3629
+ parentId: string | null;
3630
+ /**
3631
+ * ISO 8601 timestamp when the event was created
3632
+ */
3633
+ timestamp: string;
3634
+ /**
3635
+ * Type discriminator. Always "pending_messages.modified".
3636
+ */
3637
+ type: "pending_messages.modified";
3638
+ }
3639
+ /**
3640
+ * Empty payload; the event signals that the pending message queue has changed
3641
+ */
3642
+ export interface PendingMessagesModifiedData {
3643
+ }
3644
+ /**
3645
+ * Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking
3646
+ */
3647
+ export interface AssistantTurnStartEvent {
3648
+ /**
3649
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3650
+ */
3651
+ agentId?: string;
3652
+ data: AssistantTurnStartData;
3653
+ /**
3654
+ * When true, the event is transient and not persisted to the session event log on disk
3655
+ */
3656
+ ephemeral?: boolean;
3657
+ /**
3658
+ * Unique event identifier (UUID v4), generated when the event is emitted
3659
+ */
3660
+ id: string;
3661
+ /**
3662
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3663
+ */
3664
+ parentId: string | null;
3665
+ /**
3666
+ * ISO 8601 timestamp when the event was created
3667
+ */
3668
+ timestamp: string;
3669
+ /**
3670
+ * Type discriminator. Always "assistant.turn_start".
3671
+ */
3672
+ type: "assistant.turn_start";
3673
+ }
3674
+ /**
3675
+ * Turn initialization metadata including identifier and interaction tracking
3676
+ */
3677
+ export interface AssistantTurnStartData {
3130
3678
  /**
3131
- * User-facing display name for the attachment
3679
+ * CAPI interaction ID for correlating this turn with upstream telemetry
3132
3680
  */
3133
- displayName?: string;
3681
+ interactionId?: string;
3134
3682
  /**
3135
- * MIME type of the inline data
3683
+ * Model identifier used for this turn, when known
3136
3684
  */
3137
- mimeType: string;
3138
- omittedReason?: OmittedBinaryOmittedReason;
3685
+ model?: string;
3139
3686
  /**
3140
- * Attachment type discriminator
3687
+ * Identifier for this turn within the agentic loop, typically a stringified turn number
3141
3688
  */
3142
- type: "blob";
3689
+ turnId: string;
3143
3690
  }
3144
3691
  /**
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.
3692
+ * Session event "assistant.intent". Agent intent description for current activity or plan
3146
3693
  */
3147
- export interface AttachmentExtensionContext {
3694
+ export interface AssistantIntentEvent {
3148
3695
  /**
3149
- * Provider-local canvas identifier when the push was bound to a canvas instance
3696
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3150
3697
  */
3151
- canvasId?: string;
3698
+ agentId?: string;
3699
+ data: AssistantIntentData;
3152
3700
  /**
3153
- * ISO 8601 timestamp captured by the runtime when the push was accepted
3701
+ * Always true for events that are transient and not persisted to the session event log on disk.
3154
3702
  */
3155
- capturedAt: string;
3703
+ ephemeral: true;
3156
3704
  /**
3157
- * Owning extension identifier. Runtime-derived from the caller's connection when produced via session.extensions.sendAttachmentsToMessage; preserved verbatim on subsequent transports.
3705
+ * Unique event identifier (UUID v4), generated when the event is emitted
3158
3706
  */
3159
- extensionId: string;
3707
+ id: string;
3160
3708
  /**
3161
- * Open canvas instance identifier when the push was bound to a canvas instance
3709
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3162
3710
  */
3163
- instanceId?: string;
3711
+ parentId: string | null;
3164
3712
  /**
3165
- * Caller-supplied JSON payload
3713
+ * ISO 8601 timestamp when the event was created
3166
3714
  */
3167
- payload?: JsonValue;
3715
+ timestamp: string;
3168
3716
  /**
3169
- * Human-readable composer pill label
3717
+ * Type discriminator. Always "assistant.intent".
3170
3718
  */
3171
- title: string;
3719
+ type: "assistant.intent";
3720
+ }
3721
+ /**
3722
+ * Agent intent description for current activity or plan
3723
+ */
3724
+ export interface AssistantIntentData {
3172
3725
  /**
3173
- * Attachment type discriminator
3726
+ * Short description of what the agent is currently doing or planning to do
3174
3727
  */
3175
- type: "extension_context";
3728
+ intent: string;
3176
3729
  }
3177
3730
  /**
3178
- * Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
3731
+ * Session event "assistant.fusion_phase_started". Experimental transient HydraFusion phase/model/role signal.
3179
3732
  */
3180
- export interface PendingMessagesModifiedEvent {
3733
+ /** @experimental */
3734
+ export interface AssistantFusionPhaseStartedEvent {
3181
3735
  /**
3182
3736
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3183
3737
  */
3184
3738
  agentId?: string;
3185
- data: PendingMessagesModifiedData;
3739
+ data: FusionPhaseStartedData;
3186
3740
  /**
3187
3741
  * Always true for events that are transient and not persisted to the session event log on disk.
3188
3742
  */
@@ -3200,24 +3754,45 @@ export interface PendingMessagesModifiedEvent {
3200
3754
  */
3201
3755
  timestamp: string;
3202
3756
  /**
3203
- * Type discriminator. Always "pending_messages.modified".
3757
+ * Type discriminator. Always "assistant.fusion_phase_started".
3204
3758
  */
3205
- type: "pending_messages.modified";
3759
+ type: "assistant.fusion_phase_started";
3206
3760
  }
3207
3761
  /**
3208
- * Empty payload; the event signals that the pending message queue has changed
3762
+ * Experimental transient HydraFusion phase/model/role signal.
3209
3763
  */
3210
- export interface PendingMessagesModifiedData {
3764
+ /** @experimental */
3765
+ export interface FusionPhaseStartedData {
3766
+ conversationScope: FusionConversationScope;
3767
+ /**
3768
+ * Identifier of the HydraFusion turn containing the phase.
3769
+ */
3770
+ fusionId: string;
3771
+ /**
3772
+ * Concrete model executing the phase.
3773
+ */
3774
+ model: string;
3775
+ pattern: FusionPattern;
3776
+ /**
3777
+ * Stable identifier for the concrete phase.
3778
+ */
3779
+ phaseId: string;
3780
+ phaseKind: FusionPhaseKind;
3781
+ /**
3782
+ * Semantic role assigned to the phase.
3783
+ */
3784
+ role: string;
3211
3785
  }
3212
3786
  /**
3213
- * Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking
3787
+ * Session event "assistant.fusion_phase_completed". Experimental durable HydraFusion phase output and lossless replay checkpoint.
3214
3788
  */
3215
- export interface AssistantTurnStartEvent {
3789
+ /** @experimental */
3790
+ export interface AssistantFusionPhaseCompletedEvent {
3216
3791
  /**
3217
3792
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3218
3793
  */
3219
3794
  agentId?: string;
3220
- data: AssistantTurnStartData;
3795
+ data: FusionPhaseCompletedData;
3221
3796
  /**
3222
3797
  * When true, the event is transient and not persisted to the session event log on disk
3223
3798
  */
@@ -3235,40 +3810,92 @@ export interface AssistantTurnStartEvent {
3235
3810
  */
3236
3811
  timestamp: string;
3237
3812
  /**
3238
- * Type discriminator. Always "assistant.turn_start".
3813
+ * Type discriminator. Always "assistant.fusion_phase_completed".
3239
3814
  */
3240
- type: "assistant.turn_start";
3815
+ type: "assistant.fusion_phase_completed";
3241
3816
  }
3242
3817
  /**
3243
- * Turn initialization metadata including identifier and interaction tracking
3818
+ * Experimental durable HydraFusion phase output and lossless replay checkpoint.
3244
3819
  */
3245
- export interface AssistantTurnStartData {
3820
+ /** @experimental */
3821
+ export interface FusionPhaseCompletedData {
3246
3822
  /**
3247
- * CAPI interaction ID for correlating this turn with upstream telemetry
3823
+ * Provider-normalized textual output produced by the phase.
3248
3824
  */
3249
- interactionId?: string;
3825
+ content: string;
3826
+ conversationScope: FusionConversationScope;
3250
3827
  /**
3251
- * Model identifier used for this turn, when known
3828
+ * Elapsed execution time for the phase in milliseconds.
3252
3829
  */
3253
- model?: string;
3830
+ durationMs: number;
3254
3831
  /**
3255
- * Identifier for this turn within the agentic loop, typically a stringified turn number
3832
+ * Identifier of the HydraFusion turn containing the phase.
3256
3833
  */
3257
- turnId: string;
3834
+ fusionId: string;
3835
+ /**
3836
+ * Concrete model that executed the phase.
3837
+ */
3838
+ model: string;
3839
+ /**
3840
+ * Stable identifier for the completed phase.
3841
+ */
3842
+ phaseId: string;
3843
+ phaseKind: FusionPhaseKind;
3844
+ /**
3845
+ * Semantic role assigned to the completed phase.
3846
+ */
3847
+ role: string;
3848
+ status: FusionPhaseStatus;
3849
+ usage: FusionPhaseUsage;
3850
+ /**
3851
+ * Structured judge or critic verdict, when the phase produces one.
3852
+ */
3853
+ verdict: string | null;
3258
3854
  }
3259
3855
  /**
3260
- * Session event "assistant.intent". Agent intent description for current activity or plan
3856
+ * Aggregate concrete-model usage for one HydraFusion phase.
3261
3857
  */
3262
- export interface AssistantIntentEvent {
3858
+ /** @experimental */
3859
+ export interface FusionPhaseUsage {
3860
+ /**
3861
+ * Total cached input tokens reported for the phase.
3862
+ */
3863
+ cachedTokens: number;
3864
+ /**
3865
+ * Total tokens written to prompt cache during the phase.
3866
+ */
3867
+ cacheWriteTokens?: number;
3868
+ /**
3869
+ * Total input tokens consumed by the phase.
3870
+ */
3871
+ inputTokens: number;
3872
+ /**
3873
+ * Total output tokens produced by the phase.
3874
+ */
3875
+ outputTokens: number;
3876
+ /**
3877
+ * Number of concrete model requests made by the phase.
3878
+ */
3879
+ requestCount: number;
3880
+ /**
3881
+ * Total normalized AI-unit cost reported for the phase, in nano-AIU.
3882
+ */
3883
+ totalNanoAiu: number;
3884
+ }
3885
+ /**
3886
+ * Session event "assistant.fusion_phase_failed". Experimental durable typed HydraFusion phase failure and degradation transition.
3887
+ */
3888
+ /** @experimental */
3889
+ export interface AssistantFusionPhaseFailedEvent {
3263
3890
  /**
3264
3891
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3265
3892
  */
3266
3893
  agentId?: string;
3267
- data: AssistantIntentData;
3894
+ data: FusionPhaseFailedData;
3268
3895
  /**
3269
- * Always true for events that are transient and not persisted to the session event log on disk.
3896
+ * When true, the event is transient and not persisted to the session event log on disk
3270
3897
  */
3271
- ephemeral: true;
3898
+ ephemeral?: boolean;
3272
3899
  /**
3273
3900
  * Unique event identifier (UUID v4), generated when the event is emitted
3274
3901
  */
@@ -3282,18 +3909,51 @@ export interface AssistantIntentEvent {
3282
3909
  */
3283
3910
  timestamp: string;
3284
3911
  /**
3285
- * Type discriminator. Always "assistant.intent".
3912
+ * Type discriminator. Always "assistant.fusion_phase_failed".
3286
3913
  */
3287
- type: "assistant.intent";
3914
+ type: "assistant.fusion_phase_failed";
3288
3915
  }
3289
3916
  /**
3290
- * Agent intent description for current activity or plan
3917
+ * Experimental durable typed HydraFusion phase failure and degradation transition.
3291
3918
  */
3292
- export interface AssistantIntentData {
3919
+ /** @experimental */
3920
+ export interface FusionPhaseFailedData {
3921
+ conversationScope: FusionConversationScope;
3293
3922
  /**
3294
- * Short description of what the agent is currently doing or planning to do
3923
+ * Identifier of the fallback phase used to continue the turn after degradation.
3295
3924
  */
3296
- intent: string;
3925
+ degradedToPhaseId?: string;
3926
+ /**
3927
+ * Elapsed execution time before the phase failed, in milliseconds.
3928
+ */
3929
+ durationMs: number;
3930
+ /**
3931
+ * Provider or execution error detail, when available.
3932
+ */
3933
+ errorMessage?: string;
3934
+ /**
3935
+ * Identifier of the HydraFusion turn containing the phase.
3936
+ */
3937
+ fusionId: string;
3938
+ /**
3939
+ * Concrete model that attempted the phase.
3940
+ */
3941
+ model: string;
3942
+ /**
3943
+ * Stable identifier for the failed phase.
3944
+ */
3945
+ phaseId: string;
3946
+ phaseKind: FusionPhaseKind;
3947
+ /**
3948
+ * Stable machine-readable reason for the phase failure.
3949
+ */
3950
+ reason: string;
3951
+ /**
3952
+ * Semantic role assigned to the failed phase.
3953
+ */
3954
+ role: string;
3955
+ status: FusionPhaseStatus;
3956
+ usage: FusionPhaseUsage;
3297
3957
  }
3298
3958
  /**
3299
3959
  * 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 +4243,12 @@ export interface AssistantMessageData {
3583
4243
  * Encrypted reasoning content from OpenAI models. Session-bound and stripped on resume.
3584
4244
  */
3585
4245
  encryptedContent?: string;
4246
+ /**
4247
+ * Experimental HydraFusion source attribution for this ordinary authoritative assistant message.
4248
+ *
4249
+ * @experimental
4250
+ */
4251
+ fusion?: FusionAttribution;
3586
4252
  /**
3587
4253
  * CAPI interaction ID for correlating this message with upstream telemetry
3588
4254
  */
@@ -3771,6 +4437,56 @@ export interface CitationLocationBlock {
3771
4437
  */
3772
4438
  type: "block";
3773
4439
  }
4440
+ /**
4441
+ * Experimental attribution linking an ordinary event to the HydraFusion turn, phase, and concrete source that produced it.
4442
+ */
4443
+ /** @experimental */
4444
+ export interface FusionAttribution {
4445
+ /**
4446
+ * Idempotency identifier for the authoritative commit, when the event belongs to the selected output.
4447
+ */
4448
+ commitId?: string;
4449
+ /**
4450
+ * Conversation scope in which the concrete phase executed.
4451
+ */
4452
+ conversationScope?: string;
4453
+ /**
4454
+ * Stable identifier for the HydraFusion turn that produced the event.
4455
+ */
4456
+ fusionId: string;
4457
+ /**
4458
+ * HydraFusion orchestration pattern selected for the turn.
4459
+ */
4460
+ pattern: string;
4461
+ /**
4462
+ * Identifier of the concrete phase that produced the event.
4463
+ */
4464
+ phaseId?: string;
4465
+ /**
4466
+ * Kind of concrete phase that produced the event.
4467
+ */
4468
+ phaseKind?: string;
4469
+ /**
4470
+ * HydraFusion routing policy used for the turn.
4471
+ */
4472
+ policy: string;
4473
+ /**
4474
+ * Semantic role assigned to the concrete phase.
4475
+ */
4476
+ role?: string;
4477
+ /**
4478
+ * Concrete model that produced the attributed event.
4479
+ */
4480
+ sourceModel?: string;
4481
+ /**
4482
+ * Phase whose output supplied the authoritative content, when different from the executing phase.
4483
+ */
4484
+ sourcePhaseId?: string;
4485
+ /**
4486
+ * Synthetic HydraFusion model selected for the session.
4487
+ */
4488
+ syntheticModel: string;
4489
+ }
3774
4490
  /**
3775
4491
  * Neutral provider-tagged reasoning content blocks preserved verbatim for round-tripping
3776
4492
  */
@@ -4094,6 +4810,12 @@ export interface AssistantUsageData {
4094
4810
  * 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
4811
  */
4096
4812
  finishReason?: string;
4813
+ /**
4814
+ * Experimental HydraFusion attribution for this concrete model call's usage.
4815
+ *
4816
+ * @experimental
4817
+ */
4818
+ fusion?: FusionAttribution;
4097
4819
  /**
4098
4820
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
4099
4821
  */
@@ -4261,6 +4983,12 @@ export interface ModelCallFailureData {
4261
4983
  */
4262
4984
  errorType?: string;
4263
4985
  failureKind?: ModelCallFailureKind;
4986
+ /**
4987
+ * Experimental HydraFusion attribution for this failed concrete model call.
4988
+ *
4989
+ * @experimental
4990
+ */
4991
+ fusion?: FusionAttribution;
4264
4992
  /**
4265
4993
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
4266
4994
  */
@@ -4527,6 +5255,12 @@ export interface ToolExecutionStartData {
4527
5255
  * When true, the tool output should be displayed expanded (verbatim) in the CLI timeline
4528
5256
  */
4529
5257
  displayVerbatim?: boolean;
5258
+ /**
5259
+ * Experimental HydraFusion attribution for this tool execution.
5260
+ *
5261
+ * @experimental
5262
+ */
5263
+ fusion?: FusionAttribution;
4530
5264
  /**
4531
5265
  * Name of the MCP server hosting this tool, when the tool is an MCP tool
4532
5266
  */
@@ -4736,6 +5470,12 @@ export interface ToolExecutionCompleteEvent {
4736
5470
  */
4737
5471
  export interface ToolExecutionCompleteData {
4738
5472
  error?: ToolExecutionCompleteError;
5473
+ /**
5474
+ * Experimental HydraFusion attribution for this tool completion.
5475
+ *
5476
+ * @experimental
5477
+ */
5478
+ fusion?: FusionAttribution;
4739
5479
  /**
4740
5480
  * CAPI interaction ID for correlating this tool execution with upstream telemetry
4741
5481
  */
@@ -4993,6 +5733,10 @@ export interface ToolExecutionCompleteContentShellExit {
4993
5733
  * Exit code from the completed shell command
4994
5734
  */
4995
5735
  exitCode: number;
5736
+ /**
5737
+ * Path reported in the shell session's filesystem namespace when shell output exceeded the configured large-output threshold.
5738
+ */
5739
+ outputFilePath?: string;
4996
5740
  /**
4997
5741
  * Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output.
4998
5742
  */
@@ -5430,6 +6174,14 @@ export interface SubagentStartedData {
5430
6174
  * Internal name of the sub-agent
5431
6175
  */
5432
6176
  agentName: string;
6177
+ /**
6178
+ * Type of the sub-agent selected at spawn time.
6179
+ */
6180
+ agentType?: string;
6181
+ /**
6182
+ * Whether the sub-agent runs synchronously or in the background.
6183
+ */
6184
+ executionMode?: string;
5433
6185
  /**
5434
6186
  * Root id of the factory run that spawned this sub-agent, when it was spawned by one.
5435
6187
  */
@@ -5438,11 +6190,70 @@ export interface SubagentStartedData {
5438
6190
  * Model the sub-agent will run with, when known at start.
5439
6191
  */
5440
6192
  model?: string;
6193
+ /**
6194
+ * Task-registry ID of the spawning sub-agent. Absent when the root session spawned this child.
6195
+ */
6196
+ parentId?: string;
6197
+ /**
6198
+ * Whether this sub-agent can be resumed. Currently always false.
6199
+ */
6200
+ resumable?: boolean;
5441
6201
  /**
5442
6202
  * Tool call ID of the parent tool invocation that spawned this sub-agent
5443
6203
  */
5444
6204
  toolCallId: string;
5445
6205
  }
6206
+ /**
6207
+ * Session event "subagent.configured". Resolved runtime configuration for a configured sub-agent
6208
+ */
6209
+ export interface SubagentConfiguredEvent {
6210
+ /**
6211
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6212
+ */
6213
+ agentId?: string;
6214
+ data: SubagentConfiguredData;
6215
+ /**
6216
+ * When true, the event is transient and not persisted to the session event log on disk
6217
+ */
6218
+ ephemeral?: boolean;
6219
+ /**
6220
+ * Unique event identifier (UUID v4), generated when the event is emitted
6221
+ */
6222
+ id: string;
6223
+ /**
6224
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6225
+ */
6226
+ parentId: string | null;
6227
+ /**
6228
+ * ISO 8601 timestamp when the event was created
6229
+ */
6230
+ timestamp: string;
6231
+ /**
6232
+ * Type discriminator. Always "subagent.configured".
6233
+ */
6234
+ type: "subagent.configured";
6235
+ }
6236
+ /**
6237
+ * Resolved runtime configuration for a configured sub-agent
6238
+ */
6239
+ export interface SubagentConfiguredData {
6240
+ /**
6241
+ * Resolved context tier, when configured for the model
6242
+ */
6243
+ contextTier?: string;
6244
+ /**
6245
+ * Resolved model the sub-agent will run with
6246
+ */
6247
+ model: string;
6248
+ /**
6249
+ * Whether the sub-agent accepts follow-up turns
6250
+ */
6251
+ multiTurn: boolean;
6252
+ /**
6253
+ * Resolved reasoning effort, when configured for the model
6254
+ */
6255
+ reasoningEffort?: string;
6256
+ }
5446
6257
  /**
5447
6258
  * Session event "subagent.completed". Sub-agent completion details for successful execution
5448
6259
  */
@@ -5745,6 +6556,10 @@ export interface HookStartData {
5745
6556
  * Input data passed to the hook
5746
6557
  */
5747
6558
  input?: JsonValue;
6559
+ /**
6560
+ * Tool call ID of the parent tool invocation when this event originates from a sub-agent
6561
+ */
6562
+ parentToolCallId?: string;
5748
6563
  }
5749
6564
  /**
5750
6565
  * Session event "hook.end". Hook invocation completion details including output, success status, and error information
@@ -5793,6 +6608,10 @@ export interface HookEndData {
5793
6608
  * Output data produced by the hook
5794
6609
  */
5795
6610
  output?: JsonValue;
6611
+ /**
6612
+ * Tool call ID of the parent tool invocation when this event originates from a sub-agent
6613
+ */
6614
+ parentToolCallId?: string;
5796
6615
  /**
5797
6616
  * Whether the hook completed successfully
5798
6617
  */