@github/copilot 0.0.337-5 → 0.0.337-6
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.
- package/package.json +2 -2
- package/sdk/index.d.ts +1026 -1331
- package/sdk/index.js +354 -357
- package/sdk/index.js.map +3 -3
package/sdk/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
|
|
1
|
+
import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import * as z from 'zod';
|
|
4
4
|
|
|
@@ -79,29 +79,12 @@ export declare abstract class BaseLogger implements RunnerLogger {
|
|
|
79
79
|
abstract endGroup(level?: LogLevel): void;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
export declare abstract class BaseSession implements Session {
|
|
83
|
-
readonly id: string;
|
|
84
|
-
readonly startTime: Date;
|
|
85
|
-
readonly selectedModel?: string;
|
|
86
|
-
protected logger: RunnerLogger;
|
|
87
|
-
constructor({ id, startTime, selectedModel }?: Partial<SessionMetadata>, logger?: RunnerLogger);
|
|
88
|
-
abstract getChatMessages(): Promise<ChatCompletionMessageParam[]>;
|
|
89
|
-
abstract addChatMessage(message: ChatCompletionMessageParam): Promise<void>;
|
|
90
|
-
abstract onAbort(): Promise<void>;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
82
|
declare type BinaryResult = {
|
|
94
83
|
data: string;
|
|
95
84
|
mimeType: string;
|
|
96
85
|
type: string;
|
|
97
86
|
};
|
|
98
87
|
|
|
99
|
-
declare interface CodeChangeMetrics {
|
|
100
|
-
linesAdded: number;
|
|
101
|
-
linesRemoved: number;
|
|
102
|
-
filesModified: Set<string>;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
88
|
declare type Command = {
|
|
106
89
|
readonly identifier: string;
|
|
107
90
|
readonly readOnly: boolean;
|
|
@@ -139,35 +122,6 @@ declare enum ContentFilterMode {
|
|
|
139
122
|
HiddenCharacters = "hidden_characters"
|
|
140
123
|
}
|
|
141
124
|
|
|
142
|
-
/**
|
|
143
|
-
* Adapter that wraps the CLI SessionManager to implement the SDK Session interface
|
|
144
|
-
*/
|
|
145
|
-
export declare class CopilotCLISession extends BaseSession {
|
|
146
|
-
private cliSessionManager;
|
|
147
|
-
constructor(cliSessionManager: SessionManager_2, logger?: RunnerLogger);
|
|
148
|
-
getChatMessages(): Promise<ChatCompletionMessageParam[]>;
|
|
149
|
-
addChatMessage(message: ChatCompletionMessageParam): Promise<void>;
|
|
150
|
-
onAbort(): Promise<void>;
|
|
151
|
-
/**
|
|
152
|
-
* Save this session immediately
|
|
153
|
-
*/
|
|
154
|
-
save(): Promise<void>;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Adapter that wraps the CLI SessionManager to implement the SDK SessionManager interface
|
|
159
|
-
*/
|
|
160
|
-
export declare class CopilotCLISessionManager implements SessionManager {
|
|
161
|
-
private logger;
|
|
162
|
-
constructor(options?: SessionManagerOptions);
|
|
163
|
-
createSession(): Promise<CopilotCLISession>;
|
|
164
|
-
getLastSession(): Promise<CopilotCLISession>;
|
|
165
|
-
getSession(id: string): Promise<CopilotCLISession>;
|
|
166
|
-
listSessions(): Promise<SessionMetadata[]>;
|
|
167
|
-
saveSession(session: CopilotCLISession): Promise<void>;
|
|
168
|
-
deleteSession(_session: CopilotCLISession): Promise<void>;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
125
|
export declare type ErrorOccurredHook = (input: ErrorOccurredHookInput) => Promise<ErrorOccurredHookOutput | void>;
|
|
172
126
|
|
|
173
127
|
/**
|
|
@@ -206,38 +160,6 @@ export declare class FileLogger extends BaseLogger implements RunnerLogger {
|
|
|
206
160
|
private performWrite;
|
|
207
161
|
}
|
|
208
162
|
|
|
209
|
-
/**
|
|
210
|
-
* Simple in-memory session implementation
|
|
211
|
-
*/
|
|
212
|
-
export declare class InMemorySession extends BaseSession {
|
|
213
|
-
private messages;
|
|
214
|
-
constructor({ chatMessages, ...baseProps }?: Partial<Exclude<Session, "messageCount">> & {
|
|
215
|
-
chatMessages?: ChatCompletionMessageParam[];
|
|
216
|
-
}, logger?: RunnerLogger);
|
|
217
|
-
getChatMessages(): Promise<ChatCompletionMessageParam[]>;
|
|
218
|
-
addChatMessage(message: ChatCompletionMessageParam): Promise<void>;
|
|
219
|
-
onAbort(): Promise<void>;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export declare class InMemorySessionManager implements SessionManager<InMemorySession> {
|
|
223
|
-
private sessions;
|
|
224
|
-
private logger;
|
|
225
|
-
constructor(options?: {
|
|
226
|
-
logger?: RunnerLogger;
|
|
227
|
-
});
|
|
228
|
-
createSession(): Promise<InMemorySession>;
|
|
229
|
-
getLastSession(): Promise<InMemorySession>;
|
|
230
|
-
getSession(id: string): Promise<InMemorySession>;
|
|
231
|
-
listSessions(): Promise<{
|
|
232
|
-
id: string;
|
|
233
|
-
startTime: Date;
|
|
234
|
-
selectedModel?: string;
|
|
235
|
-
}[]>;
|
|
236
|
-
saveSession(session: InMemorySession): Promise<void>;
|
|
237
|
-
enableAutoSave(): void;
|
|
238
|
-
deleteSession(session: InMemorySession): Promise<void>;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
163
|
/**
|
|
242
164
|
* Returns true if the DEBUG or COPILOT_AGENT_DEBUG environment variable is set to 1 or true (case-insensitive).
|
|
243
165
|
* If additionalVariables are provided, they are also checked.
|
|
@@ -335,19 +257,6 @@ declare interface MCPServerConfigBase {
|
|
|
335
257
|
filterMapping?: Record<string, ContentFilterMode> | ContentFilterMode;
|
|
336
258
|
}
|
|
337
259
|
|
|
338
|
-
declare interface ModelMetrics {
|
|
339
|
-
requests: {
|
|
340
|
-
count: number;
|
|
341
|
-
cost: number;
|
|
342
|
-
};
|
|
343
|
-
usage: {
|
|
344
|
-
inputTokens: number;
|
|
345
|
-
outputTokens: number;
|
|
346
|
-
cacheReadTokens: number;
|
|
347
|
-
cacheWriteTokens: number;
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
|
|
351
260
|
export declare interface ModelProvider {
|
|
352
261
|
type: "openai" | "anthropic" | "copilot";
|
|
353
262
|
model: string;
|
|
@@ -365,8 +274,6 @@ export declare class NoopLogger extends BaseLogger implements RunnerLogger {
|
|
|
365
274
|
endGroup(_level?: LogLevel): void;
|
|
366
275
|
}
|
|
367
276
|
|
|
368
|
-
declare type OnTimelineEntriesChange = (entries: TimelineEntry[]) => void;
|
|
369
|
-
|
|
370
277
|
/**
|
|
371
278
|
* A permission request which will be used to check tool or path usage against config and/or request user approval.
|
|
372
279
|
*/
|
|
@@ -564,1348 +471,1145 @@ export declare type SDKToolUseEvent = {
|
|
|
564
471
|
};
|
|
565
472
|
|
|
566
473
|
/**
|
|
567
|
-
* Session
|
|
568
|
-
*/
|
|
569
|
-
export declare interface Session extends SessionMetadata {
|
|
570
|
-
/**
|
|
571
|
-
* Get all chat messages in the session (for model context)
|
|
572
|
-
*/
|
|
573
|
-
getChatMessages(): Promise<ChatCompletionMessageParam[]>;
|
|
574
|
-
/**
|
|
575
|
-
* Add a chat message to the session
|
|
576
|
-
*/
|
|
577
|
-
addChatMessage(message: ChatCompletionMessageParam): Promise<void>;
|
|
578
|
-
/**
|
|
579
|
-
* Handle abortion/interruption of operations (e.g., complete orphaned tool calls)
|
|
580
|
-
*/
|
|
581
|
-
onAbort(): Promise<void>;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
export declare type SessionEndHook = (input: SessionEndHookInput) => Promise<SessionEndHookOutput | void>;
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* Session end hook types
|
|
588
|
-
*/
|
|
589
|
-
export declare interface SessionEndHookInput extends BaseHookInput {
|
|
590
|
-
reason: "complete" | "error" | "abort" | "timeout" | "user_exit";
|
|
591
|
-
finalMessage?: string;
|
|
592
|
-
error?: Error;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
export declare interface SessionEndHookOutput {
|
|
596
|
-
suppressOutput?: boolean;
|
|
597
|
-
cleanupActions?: string[];
|
|
598
|
-
sessionSummary?: string;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
declare type SessionInitMode = {
|
|
602
|
-
kind: "new";
|
|
603
|
-
} | {
|
|
604
|
-
kind: "resume-last";
|
|
605
|
-
} | {
|
|
606
|
-
kind: "resume";
|
|
607
|
-
sessionId: string;
|
|
608
|
-
} | {
|
|
609
|
-
kind: "resume-with-picker";
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* SessionManager interface for managing multiple sessions
|
|
474
|
+
* Session class with event sourcing
|
|
614
475
|
*/
|
|
615
|
-
export declare
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* List all available sessions
|
|
630
|
-
*/
|
|
631
|
-
listSessions(): Promise<SessionMetadata[]>;
|
|
632
|
-
/**
|
|
633
|
-
* Save session state immediately
|
|
634
|
-
*/
|
|
635
|
-
saveSession(session: TSession): Promise<void>;
|
|
636
|
-
/**
|
|
637
|
-
* Delete a session
|
|
638
|
-
* @param options Options including session to delete
|
|
639
|
-
*/
|
|
640
|
-
deleteSession(session: TSession): Promise<void>;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
declare class SessionManager_2 {
|
|
644
|
-
private currentSession;
|
|
645
|
-
private onTimelineEntriesChangeCallback;
|
|
646
|
-
private debounceSave;
|
|
647
|
-
private logger;
|
|
648
|
-
private autoSaveEnabled;
|
|
649
|
-
private usageMetrics;
|
|
650
|
-
static create(initMode: SessionInitMode): Promise<SessionManager_2>;
|
|
651
|
-
/**
|
|
652
|
-
* Check if there are multiple sessions available for resuming.
|
|
653
|
-
* @returns true if there are multiple sessions, false otherwise
|
|
654
|
-
*/
|
|
655
|
-
static hasMultipleSessions(): Promise<boolean>;
|
|
656
|
-
constructor();
|
|
657
|
-
/**
|
|
658
|
-
* Set the logger for the session manager.
|
|
659
|
-
* @param logger The logger to use for logging.
|
|
660
|
-
*/
|
|
661
|
-
setLogger(logger: RunnerLogger): void;
|
|
662
|
-
/**
|
|
663
|
-
* Get the current logger for the session manager.
|
|
664
|
-
* @returns The current logger.
|
|
665
|
-
*/
|
|
666
|
-
getLogger(): RunnerLogger;
|
|
667
|
-
/**
|
|
668
|
-
* Set a callback to be notified when the timeline entries change
|
|
669
|
-
* @param callback The callback to be called with the new timeline entries
|
|
670
|
-
*/
|
|
671
|
-
setOnTimelineEntriesChangeCallback(callback: OnTimelineEntriesChange | null): void;
|
|
672
|
-
/**
|
|
673
|
-
* Notify listeners of changes to the timeline entries. It passes a copy
|
|
674
|
-
* of the timeline entries array.
|
|
675
|
-
*/
|
|
676
|
-
private notifyTimelineEntriesChange;
|
|
677
|
-
/**
|
|
678
|
-
* Enable auto-saving of the session after a new timeline entry or chat
|
|
679
|
-
* message is added to it.
|
|
680
|
-
*/
|
|
681
|
-
enableAutoSave(): void;
|
|
682
|
-
/**
|
|
683
|
-
* Force save the current session immediately, bypassing any debouncing or auto-save logic.
|
|
684
|
-
*/
|
|
685
|
-
forceSave(): Promise<void>;
|
|
686
|
-
/** Schedule a save of the current session. Debounced. */
|
|
687
|
-
private scheduleSave;
|
|
688
|
-
/**
|
|
689
|
-
* Get the timeline entries for the current session
|
|
690
|
-
* @returns An array of timeline entries
|
|
691
|
-
*/
|
|
692
|
-
getTimelineEntries(): (({
|
|
693
|
-
type: "copilot";
|
|
694
|
-
text: string;
|
|
695
|
-
} | {
|
|
696
|
-
type: "error";
|
|
697
|
-
text: string;
|
|
698
|
-
} | {
|
|
699
|
-
type: "info";
|
|
700
|
-
text: string;
|
|
701
|
-
} | {
|
|
702
|
-
type: "user";
|
|
703
|
-
text: string;
|
|
704
|
-
expandedText?: string | undefined;
|
|
705
|
-
mentions?: {
|
|
706
|
-
type: "file" | "directory" | "image" | "unresolved";
|
|
707
|
-
displayText: string;
|
|
708
|
-
fullPath: string;
|
|
709
|
-
startIndex: number;
|
|
710
|
-
}[] | undefined;
|
|
711
|
-
imageAttachments?: {
|
|
712
|
-
type: "image_url";
|
|
713
|
-
image_url: {
|
|
714
|
-
url: string;
|
|
715
|
-
};
|
|
716
|
-
}[] | undefined;
|
|
717
|
-
} | {
|
|
718
|
-
name: string;
|
|
719
|
-
type: "tool_call_requested";
|
|
720
|
-
callId: string;
|
|
721
|
-
intentionSummary: string | null;
|
|
722
|
-
toolTitle?: string | undefined;
|
|
723
|
-
arguments?: unknown;
|
|
724
|
-
partialOutput?: string | undefined;
|
|
725
|
-
isHidden?: boolean | undefined;
|
|
726
|
-
isAlwaysExpanded?: boolean | undefined;
|
|
727
|
-
showNoContent?: boolean | undefined;
|
|
728
|
-
} | {
|
|
729
|
-
result: {
|
|
730
|
-
log: string;
|
|
731
|
-
type: "success";
|
|
732
|
-
markdown?: boolean | undefined;
|
|
733
|
-
} | {
|
|
734
|
-
log: string;
|
|
735
|
-
type: "failure";
|
|
736
|
-
markdown?: boolean | undefined;
|
|
737
|
-
} | {
|
|
738
|
-
type: "rejected";
|
|
739
|
-
markdown?: boolean | undefined;
|
|
740
|
-
} | {
|
|
741
|
-
log: string;
|
|
742
|
-
type: "denied";
|
|
743
|
-
markdown?: boolean | undefined;
|
|
744
|
-
};
|
|
745
|
-
name: string;
|
|
746
|
-
type: "tool_call_completed";
|
|
747
|
-
callId: string;
|
|
748
|
-
intentionSummary: string | null;
|
|
749
|
-
toolTitle?: string | undefined;
|
|
750
|
-
arguments?: unknown;
|
|
751
|
-
isHidden?: boolean | undefined;
|
|
752
|
-
isAlwaysExpanded?: boolean | undefined;
|
|
753
|
-
showNoContent?: boolean | undefined;
|
|
754
|
-
}) & {
|
|
755
|
-
id: string;
|
|
756
|
-
timestamp: Date;
|
|
757
|
-
})[];
|
|
758
|
-
/**
|
|
759
|
-
* Load a history session from disk.
|
|
760
|
-
* @param filename The name of the file to load
|
|
761
|
-
*/
|
|
762
|
-
private loadHistorySession;
|
|
763
|
-
/**
|
|
764
|
-
* Save the current session to disk
|
|
765
|
-
* @param session The session to save
|
|
766
|
-
*/
|
|
767
|
-
private saveHistorySession;
|
|
768
|
-
/**
|
|
769
|
-
* Get the ID of the current session.
|
|
770
|
-
* @returns The ID of the current session.
|
|
771
|
-
*/
|
|
772
|
-
getCurrentSessionId(): string;
|
|
476
|
+
export declare class Session implements SessionMetadata {
|
|
477
|
+
readonly sessionId: string;
|
|
478
|
+
readonly startTime: Date;
|
|
479
|
+
private events;
|
|
480
|
+
private _chatMessages;
|
|
481
|
+
private _selectedModel;
|
|
482
|
+
protected logger: RunnerLogger;
|
|
483
|
+
private eventCallbacks;
|
|
484
|
+
constructor({ sessionId, startTime, logger, }?: {
|
|
485
|
+
sessionId?: string;
|
|
486
|
+
startTime?: Date;
|
|
487
|
+
logger?: RunnerLogger;
|
|
488
|
+
});
|
|
773
489
|
/**
|
|
774
|
-
*
|
|
775
|
-
*
|
|
490
|
+
* Create a session from existing events (for loading from file)
|
|
491
|
+
* Does NOT trigger event callbacks during reconstruction
|
|
776
492
|
*/
|
|
777
|
-
|
|
493
|
+
static fromEvents<T extends Session>(this: new (options: {
|
|
494
|
+
sessionId: string;
|
|
495
|
+
startTime: Date;
|
|
496
|
+
logger: RunnerLogger;
|
|
497
|
+
}) => T, { events, logger }: {
|
|
498
|
+
events: SessionEvent[];
|
|
499
|
+
logger?: RunnerLogger;
|
|
500
|
+
}): T;
|
|
778
501
|
/**
|
|
779
|
-
*
|
|
780
|
-
*
|
|
502
|
+
* Add an event to the session
|
|
503
|
+
* Auto-generates id, timestamp, and parentId
|
|
781
504
|
*/
|
|
782
|
-
|
|
505
|
+
addEvent(eventData: Partial<Pick<SessionEvent, "id" | "timestamp" | "parentId">> & Omit<SessionEvent, "id" | "timestamp" | "parentId">): void;
|
|
783
506
|
/**
|
|
784
|
-
* Get
|
|
785
|
-
* @param executionModel Optional model from the execution engine
|
|
786
|
-
* @returns The current model name, never undefined
|
|
507
|
+
* Get all events in the session
|
|
787
508
|
*/
|
|
788
|
-
|
|
509
|
+
getEvents(): readonly SessionEvent[];
|
|
789
510
|
/**
|
|
790
|
-
*
|
|
791
|
-
*
|
|
511
|
+
* Register an event callback
|
|
512
|
+
* Returns unsubscribe function
|
|
792
513
|
*/
|
|
793
|
-
|
|
514
|
+
onEvent(callback: (event: SessionEvent) => void): () => void;
|
|
794
515
|
/**
|
|
795
|
-
*
|
|
796
|
-
* @param entry The timeline entry to add.
|
|
516
|
+
* Get all chat messages (reconstructed state)
|
|
797
517
|
*/
|
|
798
|
-
|
|
518
|
+
get chatMessages(): readonly ChatCompletionMessageParam[];
|
|
799
519
|
/**
|
|
800
|
-
*
|
|
801
|
-
* This removes all chat messages and timeline entries, effectively starting fresh
|
|
802
|
-
* while keeping the same session ID.
|
|
520
|
+
* Get selected model
|
|
803
521
|
*/
|
|
804
|
-
|
|
522
|
+
get selectedModel(): string | undefined;
|
|
805
523
|
/**
|
|
806
|
-
*
|
|
807
|
-
* @param message The chat message to add.
|
|
524
|
+
* Set selected model and emit model change event
|
|
808
525
|
*/
|
|
809
|
-
|
|
526
|
+
setSelectedModel(model: string): void;
|
|
810
527
|
/**
|
|
811
|
-
* Get
|
|
812
|
-
* to feed the LLM with relevant context before the user's prompt.
|
|
813
|
-
* Excludes system messages but includes all other message types (user, assistant, tool, function, developer).
|
|
814
|
-
* @param maxEntries The maximum number of entries to return.
|
|
815
|
-
* @returns An array of chat context messages.
|
|
528
|
+
* Get chat context messages (excludes system messages)
|
|
816
529
|
*/
|
|
817
530
|
getChatContextMessages(): ChatCompletionMessageParam[];
|
|
818
531
|
/**
|
|
819
|
-
* Get
|
|
820
|
-
* @returns An array of system messages only.
|
|
532
|
+
* Get system context messages (only system messages)
|
|
821
533
|
*/
|
|
822
534
|
getSystemContextMessages(): ChatCompletionMessageParam[];
|
|
823
535
|
/**
|
|
824
|
-
*
|
|
825
|
-
* This provides consistent behavior whether interrupted by kill vs Esc/Ctrl+C.
|
|
826
|
-
*/
|
|
827
|
-
handleAbortedOperation(): void;
|
|
828
|
-
/**
|
|
829
|
-
* Handles orphaned tool calls by adding cancelled tool result messages.
|
|
830
|
-
* This prevents LLM errors when tool calls are interrupted and left incomplete.
|
|
831
|
-
* Since interruptions happen during tool execution, we only need to check the end of the conversation.
|
|
832
|
-
* Looks backwards through consecutive assistant messages with tool calls to handle multiple orphaned requests.
|
|
833
|
-
* @param messages The messages to process
|
|
834
|
-
* @returns Messages with cancelled tool results added for any orphaned tool calls
|
|
835
|
-
*/
|
|
836
|
-
private completeOrphanedToolCalls;
|
|
837
|
-
/**
|
|
838
|
-
* Update the timeline entry for a tool call. This is used to update an existing
|
|
839
|
-
* tool call entry with the result of that tool call.
|
|
840
|
-
* @param result The result of the tool call.
|
|
841
|
-
*/
|
|
842
|
-
updateToolCallTimelineEntryResult(result: ToolCallResult): void;
|
|
843
|
-
/**
|
|
844
|
-
* Update the timeline entry for a tool call. This is used to update an existing
|
|
845
|
-
* tool call entry with the partial output of that tool call.
|
|
846
|
-
* @param callId The ID of the tool call.
|
|
847
|
-
* @param output The partial output of the tool call.
|
|
848
|
-
*/
|
|
849
|
-
updateToolCallTimelineEntryPartialOutput(callId: string, output: string): void;
|
|
850
|
-
/**
|
|
851
|
-
* Resume a specific session by session ID or filename, otherwise errors.
|
|
852
|
-
* This is a public method that can be called to resume a session after picker selection.
|
|
853
|
-
* @param sessionId The session ID (UUID) or filename part to resume. Supports partial matching.
|
|
854
|
-
*/
|
|
855
|
-
resumeSpecificSession(sessionId: string): Promise<void>;
|
|
856
|
-
/**
|
|
857
|
-
* Resume the last session, if one exists. Otherwise errors.
|
|
858
|
-
* This picks the most recently modified session file.
|
|
859
|
-
*/
|
|
860
|
-
private resumeLastSession;
|
|
861
|
-
/** Generates a new history session with a random ID. */
|
|
862
|
-
private generateSession;
|
|
863
|
-
/** Generates a new session ID. */
|
|
864
|
-
private generateSessionId;
|
|
865
|
-
/**
|
|
866
|
-
* Get the current usage metrics.
|
|
867
|
-
* @returns The current usage metrics.
|
|
868
|
-
*/
|
|
869
|
-
getUsageMetrics(): UsageMetrics;
|
|
870
|
-
/**
|
|
871
|
-
* Reset usage metrics for a new session.
|
|
872
|
-
*/
|
|
873
|
-
resetUsageMetrics(): void;
|
|
874
|
-
/**
|
|
875
|
-
* Get the model request multiplier for a specific model.
|
|
876
|
-
* @param modelName The name of the model.
|
|
877
|
-
* @returns The multiplier for the model (default 1.0).
|
|
878
|
-
*/
|
|
879
|
-
private getModelRequestMultiplier;
|
|
880
|
-
/**
|
|
881
|
-
* Track a user message submission.
|
|
882
|
-
* @param modelName The name of the model being used (can be empty/undefined).
|
|
883
|
-
*/
|
|
884
|
-
trackUserMessage(modelName: string): void;
|
|
885
|
-
/**
|
|
886
|
-
* Update usage metrics from a model API response.
|
|
887
|
-
* @param modelName The name of the model (can be empty/undefined).
|
|
888
|
-
* @param apiDurationMs The duration of the API call in milliseconds.
|
|
889
|
-
* @param usage Token usage information from the API response.
|
|
890
|
-
*/
|
|
891
|
-
updateModelUsageMetrics(modelName: string, apiDurationMs: number, usage?: {
|
|
892
|
-
prompt_tokens?: number;
|
|
893
|
-
completion_tokens?: number;
|
|
894
|
-
prompt_tokens_details?: {
|
|
895
|
-
cached_tokens?: number;
|
|
896
|
-
};
|
|
897
|
-
}): void;
|
|
898
|
-
/**
|
|
899
|
-
* Update code change metrics from a tool execution.
|
|
900
|
-
* @param gitDiff The git diff output from the tool.
|
|
901
|
-
* @param filePath The path of the file that was modified.
|
|
902
|
-
*/
|
|
903
|
-
updateCodeChangeMetrics(gitDiff: string, filePath?: string): void;
|
|
904
|
-
/**
|
|
905
|
-
* Format token count for display.
|
|
906
|
-
* @param count The token count.
|
|
907
|
-
* @returns Formatted string (e.g., "1.2k", "3.5m").
|
|
536
|
+
* Get the ID of the last event (for parentId chaining)
|
|
908
537
|
*/
|
|
909
|
-
private
|
|
538
|
+
private getLastEventId;
|
|
910
539
|
/**
|
|
911
|
-
*
|
|
912
|
-
* @param ms Duration in milliseconds.
|
|
913
|
-
* @returns Formatted string (e.g., "4m 13.8s", "1h 2m 16.2s").
|
|
540
|
+
* Process event to update internal state (_chatMessages, _selectedModel, etc.)
|
|
914
541
|
*/
|
|
915
|
-
private
|
|
542
|
+
private processEventForState;
|
|
916
543
|
/**
|
|
917
|
-
*
|
|
918
|
-
* @returns Formatted string with usage metrics.
|
|
544
|
+
* Notify all registered event callbacks
|
|
919
545
|
*/
|
|
920
|
-
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
export declare interface SessionManagerOptions {
|
|
924
|
-
/**
|
|
925
|
-
* Logger instance for the session manager
|
|
926
|
-
*/
|
|
927
|
-
logger?: RunnerLogger;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
export declare interface SessionMetadata {
|
|
931
|
-
readonly id: string;
|
|
932
|
-
readonly startTime: Date;
|
|
933
|
-
readonly selectedModel?: string;
|
|
546
|
+
private notifyEventCallbacks;
|
|
934
547
|
}
|
|
935
548
|
|
|
936
|
-
export declare type
|
|
549
|
+
export declare type SessionEndHook = (input: SessionEndHookInput) => Promise<SessionEndHookOutput | void>;
|
|
937
550
|
|
|
938
551
|
/**
|
|
939
|
-
* Session
|
|
552
|
+
* Session end hook types
|
|
940
553
|
*/
|
|
941
|
-
export declare interface
|
|
942
|
-
|
|
943
|
-
|
|
554
|
+
export declare interface SessionEndHookInput extends BaseHookInput {
|
|
555
|
+
reason: "complete" | "error" | "abort" | "timeout" | "user_exit";
|
|
556
|
+
finalMessage?: string;
|
|
557
|
+
error?: Error;
|
|
944
558
|
}
|
|
945
559
|
|
|
946
|
-
export declare interface
|
|
947
|
-
|
|
948
|
-
|
|
560
|
+
export declare interface SessionEndHookOutput {
|
|
561
|
+
suppressOutput?: boolean;
|
|
562
|
+
cleanupActions?: string[];
|
|
563
|
+
sessionSummary?: string;
|
|
949
564
|
}
|
|
950
565
|
|
|
951
566
|
/**
|
|
952
|
-
*
|
|
567
|
+
* Union of all session event types
|
|
953
568
|
*/
|
|
954
|
-
declare type
|
|
955
|
-
readonly kind: "shell";
|
|
956
|
-
/** The full command that the user is being asked to approve, e.g. `echo foo && find -exec ... && git push` */
|
|
957
|
-
readonly fullCommandText: string;
|
|
958
|
-
/** A concise summary of the user's intention, e.g. "Echo foo and find a file and then run git push" */
|
|
959
|
-
readonly intention: string;
|
|
960
|
-
/**
|
|
961
|
-
* The commands that are being invoked in the shell invocation.
|
|
962
|
-
*
|
|
963
|
-
* As a special case, which might be better represented in the type system, if there were no parsed commands
|
|
964
|
-
* e.g. `export VAR=value`, then this will have a single entry with identifier equal to the fullCommandText.
|
|
965
|
-
*/
|
|
966
|
-
readonly commands: ReadonlyArray<Command>;
|
|
967
|
-
/**
|
|
968
|
-
* Possible file paths that the command might access.
|
|
969
|
-
*
|
|
970
|
-
* This is entirely heuristic, so it's pretty untrustworthy.
|
|
971
|
-
*/
|
|
972
|
-
readonly possiblePaths: ReadonlyArray<PossiblePath>;
|
|
973
|
-
/**
|
|
974
|
-
* Indicates whether any command in the script has redirection to write to a file.
|
|
975
|
-
*/
|
|
976
|
-
readonly hasWriteFileRedirection: boolean;
|
|
977
|
-
/**
|
|
978
|
-
* If there are complicated constructs, then persistent approval is not supported.
|
|
979
|
-
* e.g. `cat $(echo "foo")` should not be persistently approvable because it's hard
|
|
980
|
-
* for the user to understand the implications.
|
|
981
|
-
*/
|
|
982
|
-
readonly canOfferSessionApproval: boolean;
|
|
983
|
-
};
|
|
984
|
-
|
|
985
|
-
/** List of supported models in order of precedence to be used as the default */
|
|
986
|
-
declare const SUPPORTED_MODELS: readonly ["claude-sonnet-4.5", "claude-sonnet-4", "gpt-5"];
|
|
987
|
-
|
|
988
|
-
declare type SupportedModel = (typeof SUPPORTED_MODELS)[number];
|
|
569
|
+
declare type SessionEvent = z.infer<typeof SessionEventSchema>;
|
|
989
570
|
|
|
990
571
|
/**
|
|
991
|
-
*
|
|
992
|
-
* of information. There are also restricted properties that must be used to store sensitive information.
|
|
572
|
+
* Discriminated union of all event schemas
|
|
993
573
|
*/
|
|
994
|
-
declare
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
574
|
+
declare const SessionEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
575
|
+
id: z.ZodString;
|
|
576
|
+
timestamp: z.ZodString;
|
|
577
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
578
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
579
|
+
} & {
|
|
580
|
+
type: z.ZodLiteral<"session.start">;
|
|
581
|
+
data: z.ZodObject<{
|
|
582
|
+
sessionId: z.ZodString;
|
|
583
|
+
version: z.ZodNumber;
|
|
584
|
+
producer: z.ZodString;
|
|
585
|
+
copilotVersion: z.ZodString;
|
|
586
|
+
startTime: z.ZodString;
|
|
587
|
+
selectedModel: z.ZodOptional<z.ZodString>;
|
|
588
|
+
}, "strip", z.ZodTypeAny, {
|
|
589
|
+
sessionId: string;
|
|
590
|
+
version: number;
|
|
591
|
+
producer: string;
|
|
592
|
+
copilotVersion: string;
|
|
593
|
+
startTime: string;
|
|
594
|
+
selectedModel?: string | undefined;
|
|
595
|
+
}, {
|
|
596
|
+
sessionId: string;
|
|
597
|
+
version: number;
|
|
598
|
+
producer: string;
|
|
599
|
+
copilotVersion: string;
|
|
600
|
+
startTime: string;
|
|
601
|
+
selectedModel?: string | undefined;
|
|
602
|
+
}>;
|
|
1016
603
|
}, "strip", z.ZodTypeAny, {
|
|
1017
|
-
|
|
1018
|
-
|
|
604
|
+
data: {
|
|
605
|
+
sessionId: string;
|
|
606
|
+
version: number;
|
|
607
|
+
producer: string;
|
|
608
|
+
copilotVersion: string;
|
|
609
|
+
startTime: string;
|
|
610
|
+
selectedModel?: string | undefined;
|
|
611
|
+
};
|
|
612
|
+
id: string;
|
|
613
|
+
type: "session.start";
|
|
614
|
+
timestamp: string;
|
|
615
|
+
parentId: string | null;
|
|
616
|
+
ephemeral?: boolean | undefined;
|
|
1019
617
|
}, {
|
|
1020
|
-
|
|
1021
|
-
|
|
618
|
+
data: {
|
|
619
|
+
sessionId: string;
|
|
620
|
+
version: number;
|
|
621
|
+
producer: string;
|
|
622
|
+
copilotVersion: string;
|
|
623
|
+
startTime: string;
|
|
624
|
+
selectedModel?: string | undefined;
|
|
625
|
+
};
|
|
626
|
+
id: string;
|
|
627
|
+
type: "session.start";
|
|
628
|
+
timestamp: string;
|
|
629
|
+
parentId: string | null;
|
|
630
|
+
ephemeral?: boolean | undefined;
|
|
1022
631
|
}>, z.ZodObject<{
|
|
1023
|
-
|
|
1024
|
-
|
|
632
|
+
id: z.ZodString;
|
|
633
|
+
timestamp: z.ZodString;
|
|
634
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
635
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
636
|
+
} & {
|
|
637
|
+
type: z.ZodLiteral<"session.resume">;
|
|
638
|
+
data: z.ZodObject<{
|
|
639
|
+
resumeTime: z.ZodString;
|
|
640
|
+
eventCount: z.ZodNumber;
|
|
641
|
+
}, "strip", z.ZodTypeAny, {
|
|
642
|
+
resumeTime: string;
|
|
643
|
+
eventCount: number;
|
|
644
|
+
}, {
|
|
645
|
+
resumeTime: string;
|
|
646
|
+
eventCount: number;
|
|
647
|
+
}>;
|
|
1025
648
|
}, "strip", z.ZodTypeAny, {
|
|
1026
|
-
|
|
1027
|
-
|
|
649
|
+
data: {
|
|
650
|
+
resumeTime: string;
|
|
651
|
+
eventCount: number;
|
|
652
|
+
};
|
|
653
|
+
id: string;
|
|
654
|
+
type: "session.resume";
|
|
655
|
+
timestamp: string;
|
|
656
|
+
parentId: string | null;
|
|
657
|
+
ephemeral?: boolean | undefined;
|
|
1028
658
|
}, {
|
|
1029
|
-
|
|
1030
|
-
|
|
659
|
+
data: {
|
|
660
|
+
resumeTime: string;
|
|
661
|
+
eventCount: number;
|
|
662
|
+
};
|
|
663
|
+
id: string;
|
|
664
|
+
type: "session.resume";
|
|
665
|
+
timestamp: string;
|
|
666
|
+
parentId: string | null;
|
|
667
|
+
ephemeral?: boolean | undefined;
|
|
1031
668
|
}>, z.ZodObject<{
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
669
|
+
id: z.ZodString;
|
|
670
|
+
timestamp: z.ZodString;
|
|
671
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
672
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
673
|
+
} & {
|
|
674
|
+
type: z.ZodLiteral<"session.error">;
|
|
675
|
+
data: z.ZodObject<{
|
|
676
|
+
errorType: z.ZodString;
|
|
677
|
+
message: z.ZodString;
|
|
678
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
679
|
+
}, "strip", z.ZodTypeAny, {
|
|
680
|
+
message: string;
|
|
681
|
+
errorType: string;
|
|
682
|
+
stack?: string | undefined;
|
|
683
|
+
}, {
|
|
684
|
+
message: string;
|
|
685
|
+
errorType: string;
|
|
686
|
+
stack?: string | undefined;
|
|
687
|
+
}>;
|
|
688
|
+
}, "strip", z.ZodTypeAny, {
|
|
689
|
+
data: {
|
|
690
|
+
message: string;
|
|
691
|
+
errorType: string;
|
|
692
|
+
stack?: string | undefined;
|
|
693
|
+
};
|
|
694
|
+
id: string;
|
|
695
|
+
type: "session.error";
|
|
696
|
+
timestamp: string;
|
|
697
|
+
parentId: string | null;
|
|
698
|
+
ephemeral?: boolean | undefined;
|
|
699
|
+
}, {
|
|
700
|
+
data: {
|
|
701
|
+
message: string;
|
|
702
|
+
errorType: string;
|
|
703
|
+
stack?: string | undefined;
|
|
704
|
+
};
|
|
705
|
+
id: string;
|
|
706
|
+
type: "session.error";
|
|
707
|
+
timestamp: string;
|
|
708
|
+
parentId: string | null;
|
|
709
|
+
ephemeral?: boolean | undefined;
|
|
710
|
+
}>, z.ZodObject<{
|
|
711
|
+
id: z.ZodString;
|
|
712
|
+
timestamp: z.ZodString;
|
|
713
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
714
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
715
|
+
} & {
|
|
716
|
+
type: z.ZodLiteral<"session.info">;
|
|
717
|
+
data: z.ZodObject<{
|
|
718
|
+
infoType: z.ZodString;
|
|
719
|
+
message: z.ZodString;
|
|
720
|
+
}, "strip", z.ZodTypeAny, {
|
|
721
|
+
message: string;
|
|
722
|
+
infoType: string;
|
|
723
|
+
}, {
|
|
724
|
+
message: string;
|
|
725
|
+
infoType: string;
|
|
726
|
+
}>;
|
|
727
|
+
}, "strip", z.ZodTypeAny, {
|
|
728
|
+
data: {
|
|
729
|
+
message: string;
|
|
730
|
+
infoType: string;
|
|
731
|
+
};
|
|
732
|
+
id: string;
|
|
733
|
+
type: "session.info";
|
|
734
|
+
timestamp: string;
|
|
735
|
+
parentId: string | null;
|
|
736
|
+
ephemeral?: boolean | undefined;
|
|
1037
737
|
}, {
|
|
1038
|
-
|
|
1039
|
-
|
|
738
|
+
data: {
|
|
739
|
+
message: string;
|
|
740
|
+
infoType: string;
|
|
741
|
+
};
|
|
742
|
+
id: string;
|
|
743
|
+
type: "session.info";
|
|
744
|
+
timestamp: string;
|
|
745
|
+
parentId: string | null;
|
|
746
|
+
ephemeral?: boolean | undefined;
|
|
1040
747
|
}>, z.ZodObject<{
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
748
|
+
id: z.ZodString;
|
|
749
|
+
timestamp: z.ZodString;
|
|
750
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
751
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
752
|
+
} & {
|
|
753
|
+
type: z.ZodLiteral<"session.model_change">;
|
|
754
|
+
data: z.ZodObject<{
|
|
755
|
+
previousModel: z.ZodOptional<z.ZodString>;
|
|
756
|
+
newModel: z.ZodString;
|
|
1049
757
|
}, "strip", z.ZodTypeAny, {
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
fullPath: string;
|
|
1053
|
-
startIndex: number;
|
|
758
|
+
newModel: string;
|
|
759
|
+
previousModel?: string | undefined;
|
|
1054
760
|
}, {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
761
|
+
newModel: string;
|
|
762
|
+
previousModel?: string | undefined;
|
|
763
|
+
}>;
|
|
764
|
+
}, "strip", z.ZodTypeAny, {
|
|
765
|
+
data: {
|
|
766
|
+
newModel: string;
|
|
767
|
+
previousModel?: string | undefined;
|
|
768
|
+
};
|
|
769
|
+
id: string;
|
|
770
|
+
type: "session.model_change";
|
|
771
|
+
timestamp: string;
|
|
772
|
+
parentId: string | null;
|
|
773
|
+
ephemeral?: boolean | undefined;
|
|
774
|
+
}, {
|
|
775
|
+
data: {
|
|
776
|
+
newModel: string;
|
|
777
|
+
previousModel?: string | undefined;
|
|
778
|
+
};
|
|
779
|
+
id: string;
|
|
780
|
+
type: "session.model_change";
|
|
781
|
+
timestamp: string;
|
|
782
|
+
parentId: string | null;
|
|
783
|
+
ephemeral?: boolean | undefined;
|
|
784
|
+
}>, z.ZodObject<{
|
|
785
|
+
id: z.ZodString;
|
|
786
|
+
timestamp: z.ZodString;
|
|
787
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
788
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
789
|
+
} & {
|
|
790
|
+
type: z.ZodLiteral<"session.import_legacy">;
|
|
791
|
+
data: z.ZodObject<{
|
|
792
|
+
legacySession: z.ZodObject<{
|
|
793
|
+
sessionId: z.ZodString;
|
|
794
|
+
startTime: z.ZodString;
|
|
795
|
+
chatMessages: z.ZodArray<z.ZodAny, "many">;
|
|
796
|
+
timeline: z.ZodArray<z.ZodAny, "many">;
|
|
797
|
+
selectedModel: z.ZodOptional<z.ZodString>;
|
|
1064
798
|
}, "strip", z.ZodTypeAny, {
|
|
1065
|
-
|
|
799
|
+
sessionId: string;
|
|
800
|
+
startTime: string;
|
|
801
|
+
chatMessages: any[];
|
|
802
|
+
timeline: any[];
|
|
803
|
+
selectedModel?: string | undefined;
|
|
1066
804
|
}, {
|
|
1067
|
-
|
|
805
|
+
sessionId: string;
|
|
806
|
+
startTime: string;
|
|
807
|
+
chatMessages: any[];
|
|
808
|
+
timeline: any[];
|
|
809
|
+
selectedModel?: string | undefined;
|
|
1068
810
|
}>;
|
|
811
|
+
importTime: z.ZodString;
|
|
812
|
+
sourceFile: z.ZodString;
|
|
1069
813
|
}, "strip", z.ZodTypeAny, {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
814
|
+
legacySession: {
|
|
815
|
+
sessionId: string;
|
|
816
|
+
startTime: string;
|
|
817
|
+
chatMessages: any[];
|
|
818
|
+
timeline: any[];
|
|
819
|
+
selectedModel?: string | undefined;
|
|
1073
820
|
};
|
|
821
|
+
importTime: string;
|
|
822
|
+
sourceFile: string;
|
|
1074
823
|
}, {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
824
|
+
legacySession: {
|
|
825
|
+
sessionId: string;
|
|
826
|
+
startTime: string;
|
|
827
|
+
chatMessages: any[];
|
|
828
|
+
timeline: any[];
|
|
829
|
+
selectedModel?: string | undefined;
|
|
1078
830
|
};
|
|
1079
|
-
|
|
831
|
+
importTime: string;
|
|
832
|
+
sourceFile: string;
|
|
833
|
+
}>;
|
|
1080
834
|
}, "strip", z.ZodTypeAny, {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
startIndex: number;
|
|
1089
|
-
}[] | undefined;
|
|
1090
|
-
imageAttachments?: {
|
|
1091
|
-
type: "image_url";
|
|
1092
|
-
image_url: {
|
|
1093
|
-
url: string;
|
|
835
|
+
data: {
|
|
836
|
+
legacySession: {
|
|
837
|
+
sessionId: string;
|
|
838
|
+
startTime: string;
|
|
839
|
+
chatMessages: any[];
|
|
840
|
+
timeline: any[];
|
|
841
|
+
selectedModel?: string | undefined;
|
|
1094
842
|
};
|
|
1095
|
-
|
|
843
|
+
importTime: string;
|
|
844
|
+
sourceFile: string;
|
|
845
|
+
};
|
|
846
|
+
id: string;
|
|
847
|
+
type: "session.import_legacy";
|
|
848
|
+
timestamp: string;
|
|
849
|
+
parentId: string | null;
|
|
850
|
+
ephemeral?: boolean | undefined;
|
|
1096
851
|
}, {
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
startIndex: number;
|
|
1105
|
-
}[] | undefined;
|
|
1106
|
-
imageAttachments?: {
|
|
1107
|
-
type: "image_url";
|
|
1108
|
-
image_url: {
|
|
1109
|
-
url: string;
|
|
852
|
+
data: {
|
|
853
|
+
legacySession: {
|
|
854
|
+
sessionId: string;
|
|
855
|
+
startTime: string;
|
|
856
|
+
chatMessages: any[];
|
|
857
|
+
timeline: any[];
|
|
858
|
+
selectedModel?: string | undefined;
|
|
1110
859
|
};
|
|
1111
|
-
|
|
860
|
+
importTime: string;
|
|
861
|
+
sourceFile: string;
|
|
862
|
+
};
|
|
863
|
+
id: string;
|
|
864
|
+
type: "session.import_legacy";
|
|
865
|
+
timestamp: string;
|
|
866
|
+
parentId: string | null;
|
|
867
|
+
ephemeral?: boolean | undefined;
|
|
1112
868
|
}>, z.ZodObject<{
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
timeout?: number | undefined;
|
|
1135
|
-
async?: boolean | undefined;
|
|
1136
|
-
}>, z.ZodObject<{
|
|
1137
|
-
sessionId: z.ZodString;
|
|
1138
|
-
input: z.ZodString;
|
|
1139
|
-
delay: z.ZodOptional<z.ZodNumber>;
|
|
1140
|
-
}, "strip", z.ZodTypeAny, {
|
|
1141
|
-
input: string;
|
|
1142
|
-
sessionId: string;
|
|
1143
|
-
delay?: number | undefined;
|
|
1144
|
-
}, {
|
|
1145
|
-
input: string;
|
|
1146
|
-
sessionId: string;
|
|
1147
|
-
delay?: number | undefined;
|
|
1148
|
-
}>, z.ZodObject<{
|
|
1149
|
-
sessionId: z.ZodString;
|
|
1150
|
-
delay: z.ZodNumber;
|
|
1151
|
-
}, "strip", z.ZodTypeAny, {
|
|
1152
|
-
sessionId: string;
|
|
1153
|
-
delay: number;
|
|
1154
|
-
}, {
|
|
1155
|
-
sessionId: string;
|
|
1156
|
-
delay: number;
|
|
1157
|
-
}>, z.ZodObject<{
|
|
1158
|
-
sessionId: z.ZodString;
|
|
1159
|
-
}, "strip", z.ZodTypeAny, {
|
|
1160
|
-
sessionId: string;
|
|
1161
|
-
}, {
|
|
1162
|
-
sessionId: string;
|
|
1163
|
-
}>]>, z.ZodDiscriminatedUnion<"command", [z.ZodObject<{
|
|
1164
|
-
command: z.ZodLiteral<"view">;
|
|
1165
|
-
path: z.ZodString;
|
|
1166
|
-
view_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
1167
|
-
}, "strip", z.ZodTypeAny, {
|
|
1168
|
-
path: string;
|
|
1169
|
-
command: "view";
|
|
1170
|
-
view_range?: [number, number] | undefined;
|
|
1171
|
-
}, {
|
|
1172
|
-
path: string;
|
|
1173
|
-
command: "view";
|
|
1174
|
-
view_range?: [number, number] | undefined;
|
|
1175
|
-
}>, z.ZodObject<{
|
|
1176
|
-
command: z.ZodLiteral<"create">;
|
|
1177
|
-
path: z.ZodString;
|
|
1178
|
-
file_text: z.ZodString;
|
|
1179
|
-
}, "strip", z.ZodTypeAny, {
|
|
1180
|
-
path: string;
|
|
1181
|
-
command: "create";
|
|
1182
|
-
file_text: string;
|
|
1183
|
-
}, {
|
|
1184
|
-
path: string;
|
|
1185
|
-
command: "create";
|
|
1186
|
-
file_text: string;
|
|
1187
|
-
}>, z.ZodObject<{
|
|
1188
|
-
command: z.ZodLiteral<"str_replace">;
|
|
1189
|
-
path: z.ZodString;
|
|
1190
|
-
new_str: z.ZodOptional<z.ZodString>;
|
|
1191
|
-
old_str: z.ZodString;
|
|
1192
|
-
}, "strip", z.ZodTypeAny, {
|
|
1193
|
-
path: string;
|
|
1194
|
-
command: "str_replace";
|
|
1195
|
-
old_str: string;
|
|
1196
|
-
new_str?: string | undefined;
|
|
1197
|
-
}, {
|
|
1198
|
-
path: string;
|
|
1199
|
-
command: "str_replace";
|
|
1200
|
-
old_str: string;
|
|
1201
|
-
new_str?: string | undefined;
|
|
1202
|
-
}>, z.ZodObject<{
|
|
1203
|
-
command: z.ZodLiteral<"insert">;
|
|
1204
|
-
path: z.ZodString;
|
|
1205
|
-
insert_line: z.ZodNumber;
|
|
1206
|
-
new_str: z.ZodString;
|
|
869
|
+
id: z.ZodString;
|
|
870
|
+
timestamp: z.ZodString;
|
|
871
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
872
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
873
|
+
} & {
|
|
874
|
+
type: z.ZodLiteral<"user.message">;
|
|
875
|
+
data: z.ZodObject<{
|
|
876
|
+
content: z.ZodString;
|
|
877
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
878
|
+
type: z.ZodEnum<["file", "directory"]>;
|
|
879
|
+
path: z.ZodString;
|
|
880
|
+
displayName: z.ZodString;
|
|
881
|
+
}, "strip", z.ZodTypeAny, {
|
|
882
|
+
path: string;
|
|
883
|
+
type: "file" | "directory";
|
|
884
|
+
displayName: string;
|
|
885
|
+
}, {
|
|
886
|
+
path: string;
|
|
887
|
+
type: "file" | "directory";
|
|
888
|
+
displayName: string;
|
|
889
|
+
}>, "many">>;
|
|
1207
890
|
}, "strip", z.ZodTypeAny, {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
891
|
+
content: string;
|
|
892
|
+
attachments?: {
|
|
893
|
+
path: string;
|
|
894
|
+
type: "file" | "directory";
|
|
895
|
+
displayName: string;
|
|
896
|
+
}[] | undefined;
|
|
1212
897
|
}, {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
isAlwaysExpanded: z.ZodOptional<z.ZodBoolean>;
|
|
1221
|
-
showNoContent: z.ZodOptional<z.ZodBoolean>;
|
|
898
|
+
content: string;
|
|
899
|
+
attachments?: {
|
|
900
|
+
path: string;
|
|
901
|
+
type: "file" | "directory";
|
|
902
|
+
displayName: string;
|
|
903
|
+
}[] | undefined;
|
|
904
|
+
}>;
|
|
1222
905
|
}, "strip", z.ZodTypeAny, {
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
906
|
+
data: {
|
|
907
|
+
content: string;
|
|
908
|
+
attachments?: {
|
|
909
|
+
path: string;
|
|
910
|
+
type: "file" | "directory";
|
|
911
|
+
displayName: string;
|
|
912
|
+
}[] | undefined;
|
|
913
|
+
};
|
|
914
|
+
id: string;
|
|
915
|
+
type: "user.message";
|
|
916
|
+
timestamp: string;
|
|
917
|
+
parentId: string | null;
|
|
918
|
+
ephemeral?: boolean | undefined;
|
|
1233
919
|
}, {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
920
|
+
data: {
|
|
921
|
+
content: string;
|
|
922
|
+
attachments?: {
|
|
923
|
+
path: string;
|
|
924
|
+
type: "file" | "directory";
|
|
925
|
+
displayName: string;
|
|
926
|
+
}[] | undefined;
|
|
927
|
+
};
|
|
928
|
+
id: string;
|
|
929
|
+
type: "user.message";
|
|
930
|
+
timestamp: string;
|
|
931
|
+
parentId: string | null;
|
|
932
|
+
ephemeral?: boolean | undefined;
|
|
1244
933
|
}>, z.ZodObject<{
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
markdown: z.ZodOptional<z.ZodBoolean>;
|
|
1254
|
-
}, "strip", z.ZodTypeAny, {
|
|
1255
|
-
log: string;
|
|
1256
|
-
type: "success";
|
|
1257
|
-
markdown?: boolean | undefined;
|
|
1258
|
-
}, {
|
|
1259
|
-
log: string;
|
|
1260
|
-
type: "success";
|
|
1261
|
-
markdown?: boolean | undefined;
|
|
1262
|
-
}>, z.ZodObject<{
|
|
1263
|
-
type: z.ZodLiteral<"failure">;
|
|
1264
|
-
log: z.ZodString;
|
|
1265
|
-
markdown: z.ZodOptional<z.ZodBoolean>;
|
|
1266
|
-
}, "strip", z.ZodTypeAny, {
|
|
1267
|
-
log: string;
|
|
1268
|
-
type: "failure";
|
|
1269
|
-
markdown?: boolean | undefined;
|
|
1270
|
-
}, {
|
|
1271
|
-
log: string;
|
|
1272
|
-
type: "failure";
|
|
1273
|
-
markdown?: boolean | undefined;
|
|
1274
|
-
}>, z.ZodObject<{
|
|
1275
|
-
type: z.ZodLiteral<"rejected">;
|
|
1276
|
-
markdown: z.ZodOptional<z.ZodBoolean>;
|
|
1277
|
-
}, "strip", z.ZodTypeAny, {
|
|
1278
|
-
type: "rejected";
|
|
1279
|
-
markdown?: boolean | undefined;
|
|
1280
|
-
}, {
|
|
1281
|
-
type: "rejected";
|
|
1282
|
-
markdown?: boolean | undefined;
|
|
1283
|
-
}>, z.ZodObject<{
|
|
1284
|
-
type: z.ZodLiteral<"denied">;
|
|
1285
|
-
log: z.ZodString;
|
|
1286
|
-
markdown: z.ZodOptional<z.ZodBoolean>;
|
|
1287
|
-
}, "strip", z.ZodTypeAny, {
|
|
1288
|
-
log: string;
|
|
1289
|
-
type: "denied";
|
|
1290
|
-
markdown?: boolean | undefined;
|
|
1291
|
-
}, {
|
|
1292
|
-
log: string;
|
|
1293
|
-
type: "denied";
|
|
1294
|
-
markdown?: boolean | undefined;
|
|
1295
|
-
}>]>;
|
|
1296
|
-
arguments: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
1297
|
-
command: z.ZodString;
|
|
1298
|
-
description: z.ZodString;
|
|
1299
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
1300
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
1301
|
-
async: z.ZodOptional<z.ZodBoolean>;
|
|
1302
|
-
}, "strip", z.ZodTypeAny, {
|
|
1303
|
-
command: string;
|
|
1304
|
-
description: string;
|
|
1305
|
-
sessionId?: string | undefined;
|
|
1306
|
-
timeout?: number | undefined;
|
|
1307
|
-
async?: boolean | undefined;
|
|
1308
|
-
}, {
|
|
1309
|
-
command: string;
|
|
1310
|
-
description: string;
|
|
1311
|
-
sessionId?: string | undefined;
|
|
1312
|
-
timeout?: number | undefined;
|
|
1313
|
-
async?: boolean | undefined;
|
|
1314
|
-
}>, z.ZodObject<{
|
|
1315
|
-
sessionId: z.ZodString;
|
|
1316
|
-
input: z.ZodString;
|
|
1317
|
-
delay: z.ZodOptional<z.ZodNumber>;
|
|
1318
|
-
}, "strip", z.ZodTypeAny, {
|
|
1319
|
-
input: string;
|
|
1320
|
-
sessionId: string;
|
|
1321
|
-
delay?: number | undefined;
|
|
1322
|
-
}, {
|
|
1323
|
-
input: string;
|
|
1324
|
-
sessionId: string;
|
|
1325
|
-
delay?: number | undefined;
|
|
1326
|
-
}>, z.ZodObject<{
|
|
1327
|
-
sessionId: z.ZodString;
|
|
1328
|
-
delay: z.ZodNumber;
|
|
1329
|
-
}, "strip", z.ZodTypeAny, {
|
|
1330
|
-
sessionId: string;
|
|
1331
|
-
delay: number;
|
|
1332
|
-
}, {
|
|
1333
|
-
sessionId: string;
|
|
1334
|
-
delay: number;
|
|
1335
|
-
}>, z.ZodObject<{
|
|
1336
|
-
sessionId: z.ZodString;
|
|
1337
|
-
}, "strip", z.ZodTypeAny, {
|
|
1338
|
-
sessionId: string;
|
|
1339
|
-
}, {
|
|
1340
|
-
sessionId: string;
|
|
1341
|
-
}>]>, z.ZodDiscriminatedUnion<"command", [z.ZodObject<{
|
|
1342
|
-
command: z.ZodLiteral<"view">;
|
|
1343
|
-
path: z.ZodString;
|
|
1344
|
-
view_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
1345
|
-
}, "strip", z.ZodTypeAny, {
|
|
1346
|
-
path: string;
|
|
1347
|
-
command: "view";
|
|
1348
|
-
view_range?: [number, number] | undefined;
|
|
1349
|
-
}, {
|
|
1350
|
-
path: string;
|
|
1351
|
-
command: "view";
|
|
1352
|
-
view_range?: [number, number] | undefined;
|
|
1353
|
-
}>, z.ZodObject<{
|
|
1354
|
-
command: z.ZodLiteral<"create">;
|
|
1355
|
-
path: z.ZodString;
|
|
1356
|
-
file_text: z.ZodString;
|
|
1357
|
-
}, "strip", z.ZodTypeAny, {
|
|
1358
|
-
path: string;
|
|
1359
|
-
command: "create";
|
|
1360
|
-
file_text: string;
|
|
1361
|
-
}, {
|
|
1362
|
-
path: string;
|
|
1363
|
-
command: "create";
|
|
1364
|
-
file_text: string;
|
|
1365
|
-
}>, z.ZodObject<{
|
|
1366
|
-
command: z.ZodLiteral<"str_replace">;
|
|
1367
|
-
path: z.ZodString;
|
|
1368
|
-
new_str: z.ZodOptional<z.ZodString>;
|
|
1369
|
-
old_str: z.ZodString;
|
|
934
|
+
id: z.ZodString;
|
|
935
|
+
timestamp: z.ZodString;
|
|
936
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
937
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
938
|
+
} & {
|
|
939
|
+
type: z.ZodLiteral<"assistant.turn_start">;
|
|
940
|
+
data: z.ZodObject<{
|
|
941
|
+
turnId: z.ZodString;
|
|
1370
942
|
}, "strip", z.ZodTypeAny, {
|
|
1371
|
-
|
|
1372
|
-
command: "str_replace";
|
|
1373
|
-
old_str: string;
|
|
1374
|
-
new_str?: string | undefined;
|
|
943
|
+
turnId: string;
|
|
1375
944
|
}, {
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
945
|
+
turnId: string;
|
|
946
|
+
}>;
|
|
947
|
+
}, "strip", z.ZodTypeAny, {
|
|
948
|
+
data: {
|
|
949
|
+
turnId: string;
|
|
950
|
+
};
|
|
951
|
+
id: string;
|
|
952
|
+
type: "assistant.turn_start";
|
|
953
|
+
timestamp: string;
|
|
954
|
+
parentId: string | null;
|
|
955
|
+
ephemeral?: boolean | undefined;
|
|
956
|
+
}, {
|
|
957
|
+
data: {
|
|
958
|
+
turnId: string;
|
|
959
|
+
};
|
|
960
|
+
id: string;
|
|
961
|
+
type: "assistant.turn_start";
|
|
962
|
+
timestamp: string;
|
|
963
|
+
parentId: string | null;
|
|
964
|
+
ephemeral?: boolean | undefined;
|
|
965
|
+
}>, z.ZodObject<{
|
|
966
|
+
id: z.ZodString;
|
|
967
|
+
timestamp: z.ZodString;
|
|
968
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
969
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
970
|
+
} & {
|
|
971
|
+
type: z.ZodLiteral<"assistant.message">;
|
|
972
|
+
data: z.ZodObject<{
|
|
973
|
+
messageId: z.ZodString;
|
|
974
|
+
content: z.ZodString;
|
|
975
|
+
toolRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
976
|
+
toolCallId: z.ZodString;
|
|
977
|
+
name: z.ZodString;
|
|
978
|
+
arguments: z.ZodUnknown;
|
|
979
|
+
}, "strip", z.ZodTypeAny, {
|
|
980
|
+
name: string;
|
|
981
|
+
toolCallId: string;
|
|
982
|
+
arguments?: unknown;
|
|
983
|
+
}, {
|
|
984
|
+
name: string;
|
|
985
|
+
toolCallId: string;
|
|
986
|
+
arguments?: unknown;
|
|
987
|
+
}>, "many">>;
|
|
1385
988
|
}, "strip", z.ZodTypeAny, {
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
989
|
+
content: string;
|
|
990
|
+
messageId: string;
|
|
991
|
+
toolRequests?: {
|
|
992
|
+
name: string;
|
|
993
|
+
toolCallId: string;
|
|
994
|
+
arguments?: unknown;
|
|
995
|
+
}[] | undefined;
|
|
1390
996
|
}, {
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
997
|
+
content: string;
|
|
998
|
+
messageId: string;
|
|
999
|
+
toolRequests?: {
|
|
1000
|
+
name: string;
|
|
1001
|
+
toolCallId: string;
|
|
1002
|
+
arguments?: unknown;
|
|
1003
|
+
}[] | undefined;
|
|
1004
|
+
}>;
|
|
1399
1005
|
}, "strip", z.ZodTypeAny, {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
} | {
|
|
1409
|
-
type: "rejected";
|
|
1410
|
-
markdown?: boolean | undefined;
|
|
1411
|
-
} | {
|
|
1412
|
-
log: string;
|
|
1413
|
-
type: "denied";
|
|
1414
|
-
markdown?: boolean | undefined;
|
|
1006
|
+
data: {
|
|
1007
|
+
content: string;
|
|
1008
|
+
messageId: string;
|
|
1009
|
+
toolRequests?: {
|
|
1010
|
+
name: string;
|
|
1011
|
+
toolCallId: string;
|
|
1012
|
+
arguments?: unknown;
|
|
1013
|
+
}[] | undefined;
|
|
1415
1014
|
};
|
|
1416
|
-
|
|
1417
|
-
type: "
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
arguments?: unknown;
|
|
1422
|
-
isHidden?: boolean | undefined;
|
|
1423
|
-
isAlwaysExpanded?: boolean | undefined;
|
|
1424
|
-
showNoContent?: boolean | undefined;
|
|
1015
|
+
id: string;
|
|
1016
|
+
type: "assistant.message";
|
|
1017
|
+
timestamp: string;
|
|
1018
|
+
parentId: string | null;
|
|
1019
|
+
ephemeral?: boolean | undefined;
|
|
1425
1020
|
}, {
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
} | {
|
|
1435
|
-
type: "rejected";
|
|
1436
|
-
markdown?: boolean | undefined;
|
|
1437
|
-
} | {
|
|
1438
|
-
log: string;
|
|
1439
|
-
type: "denied";
|
|
1440
|
-
markdown?: boolean | undefined;
|
|
1021
|
+
data: {
|
|
1022
|
+
content: string;
|
|
1023
|
+
messageId: string;
|
|
1024
|
+
toolRequests?: {
|
|
1025
|
+
name: string;
|
|
1026
|
+
toolCallId: string;
|
|
1027
|
+
arguments?: unknown;
|
|
1028
|
+
}[] | undefined;
|
|
1441
1029
|
};
|
|
1442
|
-
|
|
1443
|
-
type: "
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
isHidden?: boolean | undefined;
|
|
1449
|
-
isAlwaysExpanded?: boolean | undefined;
|
|
1450
|
-
showNoContent?: boolean | undefined;
|
|
1451
|
-
}>]>, z.ZodObject<{
|
|
1030
|
+
id: string;
|
|
1031
|
+
type: "assistant.message";
|
|
1032
|
+
timestamp: string;
|
|
1033
|
+
parentId: string | null;
|
|
1034
|
+
ephemeral?: boolean | undefined;
|
|
1035
|
+
}>, z.ZodObject<{
|
|
1452
1036
|
id: z.ZodString;
|
|
1453
|
-
timestamp: z.
|
|
1037
|
+
timestamp: z.ZodString;
|
|
1038
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1039
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
1040
|
+
} & {
|
|
1041
|
+
type: z.ZodLiteral<"assistant.turn_end">;
|
|
1042
|
+
data: z.ZodObject<{
|
|
1043
|
+
turnId: z.ZodString;
|
|
1044
|
+
}, "strip", z.ZodTypeAny, {
|
|
1045
|
+
turnId: string;
|
|
1046
|
+
}, {
|
|
1047
|
+
turnId: string;
|
|
1048
|
+
}>;
|
|
1454
1049
|
}, "strip", z.ZodTypeAny, {
|
|
1050
|
+
data: {
|
|
1051
|
+
turnId: string;
|
|
1052
|
+
};
|
|
1455
1053
|
id: string;
|
|
1456
|
-
|
|
1054
|
+
type: "assistant.turn_end";
|
|
1055
|
+
timestamp: string;
|
|
1056
|
+
parentId: string | null;
|
|
1057
|
+
ephemeral?: boolean | undefined;
|
|
1457
1058
|
}, {
|
|
1059
|
+
data: {
|
|
1060
|
+
turnId: string;
|
|
1061
|
+
};
|
|
1458
1062
|
id: string;
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1063
|
+
type: "assistant.turn_end";
|
|
1064
|
+
timestamp: string;
|
|
1065
|
+
parentId: string | null;
|
|
1066
|
+
ephemeral?: boolean | undefined;
|
|
1067
|
+
}>, z.ZodObject<{
|
|
1068
|
+
id: z.ZodString;
|
|
1069
|
+
timestamp: z.ZodString;
|
|
1070
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1071
|
+
} & {
|
|
1072
|
+
type: z.ZodLiteral<"assistant.usage">;
|
|
1073
|
+
ephemeral: z.ZodLiteral<true>;
|
|
1074
|
+
data: z.ZodObject<{
|
|
1075
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1076
|
+
tokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
1077
|
+
cost: z.ZodOptional<z.ZodNumber>;
|
|
1078
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
1079
|
+
}, "strip", z.ZodTypeAny, {
|
|
1080
|
+
model?: string | undefined;
|
|
1081
|
+
tokensUsed?: number | undefined;
|
|
1082
|
+
cost?: number | undefined;
|
|
1083
|
+
duration?: number | undefined;
|
|
1084
|
+
}, {
|
|
1085
|
+
model?: string | undefined;
|
|
1086
|
+
tokensUsed?: number | undefined;
|
|
1087
|
+
cost?: number | undefined;
|
|
1088
|
+
duration?: number | undefined;
|
|
1089
|
+
}>;
|
|
1467
1090
|
}, "strip", z.ZodTypeAny, {
|
|
1468
|
-
|
|
1469
|
-
|
|
1091
|
+
data: {
|
|
1092
|
+
model?: string | undefined;
|
|
1093
|
+
tokensUsed?: number | undefined;
|
|
1094
|
+
cost?: number | undefined;
|
|
1095
|
+
duration?: number | undefined;
|
|
1096
|
+
};
|
|
1097
|
+
id: string;
|
|
1098
|
+
type: "assistant.usage";
|
|
1099
|
+
ephemeral: true;
|
|
1100
|
+
timestamp: string;
|
|
1101
|
+
parentId: string | null;
|
|
1470
1102
|
}, {
|
|
1471
|
-
|
|
1472
|
-
|
|
1103
|
+
data: {
|
|
1104
|
+
model?: string | undefined;
|
|
1105
|
+
tokensUsed?: number | undefined;
|
|
1106
|
+
cost?: number | undefined;
|
|
1107
|
+
duration?: number | undefined;
|
|
1108
|
+
};
|
|
1109
|
+
id: string;
|
|
1110
|
+
type: "assistant.usage";
|
|
1111
|
+
ephemeral: true;
|
|
1112
|
+
timestamp: string;
|
|
1113
|
+
parentId: string | null;
|
|
1473
1114
|
}>, z.ZodObject<{
|
|
1474
|
-
|
|
1475
|
-
|
|
1115
|
+
id: z.ZodString;
|
|
1116
|
+
timestamp: z.ZodString;
|
|
1117
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1118
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
1119
|
+
} & {
|
|
1120
|
+
type: z.ZodLiteral<"abort">;
|
|
1121
|
+
data: z.ZodObject<{
|
|
1122
|
+
reason: z.ZodString;
|
|
1123
|
+
}, "strip", z.ZodTypeAny, {
|
|
1124
|
+
reason: string;
|
|
1125
|
+
}, {
|
|
1126
|
+
reason: string;
|
|
1127
|
+
}>;
|
|
1476
1128
|
}, "strip", z.ZodTypeAny, {
|
|
1477
|
-
|
|
1478
|
-
|
|
1129
|
+
data: {
|
|
1130
|
+
reason: string;
|
|
1131
|
+
};
|
|
1132
|
+
id: string;
|
|
1133
|
+
type: "abort";
|
|
1134
|
+
timestamp: string;
|
|
1135
|
+
parentId: string | null;
|
|
1136
|
+
ephemeral?: boolean | undefined;
|
|
1479
1137
|
}, {
|
|
1480
|
-
|
|
1481
|
-
|
|
1138
|
+
data: {
|
|
1139
|
+
reason: string;
|
|
1140
|
+
};
|
|
1141
|
+
id: string;
|
|
1142
|
+
type: "abort";
|
|
1143
|
+
timestamp: string;
|
|
1144
|
+
parentId: string | null;
|
|
1145
|
+
ephemeral?: boolean | undefined;
|
|
1482
1146
|
}>, z.ZodObject<{
|
|
1483
|
-
|
|
1484
|
-
|
|
1147
|
+
id: z.ZodString;
|
|
1148
|
+
timestamp: z.ZodString;
|
|
1149
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1150
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
1151
|
+
} & {
|
|
1152
|
+
type: z.ZodLiteral<"tool.execution_start">;
|
|
1153
|
+
data: z.ZodObject<{
|
|
1154
|
+
toolCallId: z.ZodString;
|
|
1155
|
+
toolName: z.ZodString;
|
|
1156
|
+
arguments: z.ZodUnknown;
|
|
1157
|
+
}, "strip", z.ZodTypeAny, {
|
|
1158
|
+
toolCallId: string;
|
|
1159
|
+
toolName: string;
|
|
1160
|
+
arguments?: unknown;
|
|
1161
|
+
}, {
|
|
1162
|
+
toolCallId: string;
|
|
1163
|
+
toolName: string;
|
|
1164
|
+
arguments?: unknown;
|
|
1165
|
+
}>;
|
|
1485
1166
|
}, "strip", z.ZodTypeAny, {
|
|
1486
|
-
|
|
1487
|
-
|
|
1167
|
+
data: {
|
|
1168
|
+
toolCallId: string;
|
|
1169
|
+
toolName: string;
|
|
1170
|
+
arguments?: unknown;
|
|
1171
|
+
};
|
|
1172
|
+
id: string;
|
|
1173
|
+
type: "tool.execution_start";
|
|
1174
|
+
timestamp: string;
|
|
1175
|
+
parentId: string | null;
|
|
1176
|
+
ephemeral?: boolean | undefined;
|
|
1488
1177
|
}, {
|
|
1489
|
-
|
|
1490
|
-
|
|
1178
|
+
data: {
|
|
1179
|
+
toolCallId: string;
|
|
1180
|
+
toolName: string;
|
|
1181
|
+
arguments?: unknown;
|
|
1182
|
+
};
|
|
1183
|
+
id: string;
|
|
1184
|
+
type: "tool.execution_start";
|
|
1185
|
+
timestamp: string;
|
|
1186
|
+
parentId: string | null;
|
|
1187
|
+
ephemeral?: boolean | undefined;
|
|
1491
1188
|
}>, z.ZodObject<{
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1189
|
+
id: z.ZodString;
|
|
1190
|
+
timestamp: z.ZodString;
|
|
1191
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1192
|
+
} & {
|
|
1193
|
+
type: z.ZodLiteral<"tool.execution_partial_result">;
|
|
1194
|
+
ephemeral: z.ZodLiteral<true>;
|
|
1195
|
+
data: z.ZodObject<{
|
|
1196
|
+
toolCallId: z.ZodString;
|
|
1197
|
+
toolName: z.ZodString;
|
|
1198
|
+
partialOutput: z.ZodString;
|
|
1500
1199
|
}, "strip", z.ZodTypeAny, {
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
startIndex: number;
|
|
1200
|
+
toolCallId: string;
|
|
1201
|
+
toolName: string;
|
|
1202
|
+
partialOutput: string;
|
|
1505
1203
|
}, {
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1204
|
+
toolCallId: string;
|
|
1205
|
+
toolName: string;
|
|
1206
|
+
partialOutput: string;
|
|
1207
|
+
}>;
|
|
1208
|
+
}, "strip", z.ZodTypeAny, {
|
|
1209
|
+
data: {
|
|
1210
|
+
toolCallId: string;
|
|
1211
|
+
toolName: string;
|
|
1212
|
+
partialOutput: string;
|
|
1213
|
+
};
|
|
1214
|
+
id: string;
|
|
1215
|
+
type: "tool.execution_partial_result";
|
|
1216
|
+
ephemeral: true;
|
|
1217
|
+
timestamp: string;
|
|
1218
|
+
parentId: string | null;
|
|
1219
|
+
}, {
|
|
1220
|
+
data: {
|
|
1221
|
+
toolCallId: string;
|
|
1222
|
+
toolName: string;
|
|
1223
|
+
partialOutput: string;
|
|
1224
|
+
};
|
|
1225
|
+
id: string;
|
|
1226
|
+
type: "tool.execution_partial_result";
|
|
1227
|
+
ephemeral: true;
|
|
1228
|
+
timestamp: string;
|
|
1229
|
+
parentId: string | null;
|
|
1230
|
+
}>, z.ZodObject<{
|
|
1231
|
+
id: z.ZodString;
|
|
1232
|
+
timestamp: z.ZodString;
|
|
1233
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1234
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
1235
|
+
} & {
|
|
1236
|
+
type: z.ZodLiteral<"tool.execution_complete">;
|
|
1237
|
+
data: z.ZodObject<{
|
|
1238
|
+
toolCallId: z.ZodString;
|
|
1239
|
+
toolName: z.ZodString;
|
|
1240
|
+
success: z.ZodBoolean;
|
|
1241
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
1242
|
+
content: z.ZodString;
|
|
1515
1243
|
}, "strip", z.ZodTypeAny, {
|
|
1516
|
-
|
|
1244
|
+
content: string;
|
|
1517
1245
|
}, {
|
|
1518
|
-
|
|
1519
|
-
}
|
|
1246
|
+
content: string;
|
|
1247
|
+
}>>;
|
|
1248
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
1249
|
+
message: z.ZodString;
|
|
1250
|
+
code: z.ZodOptional<z.ZodString>;
|
|
1251
|
+
}, "strip", z.ZodTypeAny, {
|
|
1252
|
+
message: string;
|
|
1253
|
+
code?: string | undefined;
|
|
1254
|
+
}, {
|
|
1255
|
+
message: string;
|
|
1256
|
+
code?: string | undefined;
|
|
1257
|
+
}>>;
|
|
1520
1258
|
}, "strip", z.ZodTypeAny, {
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1259
|
+
success: boolean;
|
|
1260
|
+
toolCallId: string;
|
|
1261
|
+
toolName: string;
|
|
1262
|
+
result?: {
|
|
1263
|
+
content: string;
|
|
1264
|
+
} | undefined;
|
|
1265
|
+
error?: {
|
|
1266
|
+
message: string;
|
|
1267
|
+
code?: string | undefined;
|
|
1268
|
+
} | undefined;
|
|
1525
1269
|
}, {
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1270
|
+
success: boolean;
|
|
1271
|
+
toolCallId: string;
|
|
1272
|
+
toolName: string;
|
|
1273
|
+
result?: {
|
|
1274
|
+
content: string;
|
|
1275
|
+
} | undefined;
|
|
1276
|
+
error?: {
|
|
1277
|
+
message: string;
|
|
1278
|
+
code?: string | undefined;
|
|
1279
|
+
} | undefined;
|
|
1280
|
+
}>;
|
|
1531
1281
|
}, "strip", z.ZodTypeAny, {
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1282
|
+
data: {
|
|
1283
|
+
success: boolean;
|
|
1284
|
+
toolCallId: string;
|
|
1285
|
+
toolName: string;
|
|
1286
|
+
result?: {
|
|
1287
|
+
content: string;
|
|
1288
|
+
} | undefined;
|
|
1289
|
+
error?: {
|
|
1290
|
+
message: string;
|
|
1291
|
+
code?: string | undefined;
|
|
1292
|
+
} | undefined;
|
|
1293
|
+
};
|
|
1294
|
+
id: string;
|
|
1295
|
+
type: "tool.execution_complete";
|
|
1296
|
+
timestamp: string;
|
|
1297
|
+
parentId: string | null;
|
|
1298
|
+
ephemeral?: boolean | undefined;
|
|
1547
1299
|
}, {
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1300
|
+
data: {
|
|
1301
|
+
success: boolean;
|
|
1302
|
+
toolCallId: string;
|
|
1303
|
+
toolName: string;
|
|
1304
|
+
result?: {
|
|
1305
|
+
content: string;
|
|
1306
|
+
} | undefined;
|
|
1307
|
+
error?: {
|
|
1308
|
+
message: string;
|
|
1309
|
+
code?: string | undefined;
|
|
1310
|
+
} | undefined;
|
|
1311
|
+
};
|
|
1312
|
+
id: string;
|
|
1313
|
+
type: "tool.execution_complete";
|
|
1314
|
+
timestamp: string;
|
|
1315
|
+
parentId: string | null;
|
|
1316
|
+
ephemeral?: boolean | undefined;
|
|
1563
1317
|
}>, z.ZodObject<{
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
async: z.ZodOptional<z.ZodBoolean>;
|
|
1575
|
-
}, "strip", z.ZodTypeAny, {
|
|
1576
|
-
command: string;
|
|
1577
|
-
description: string;
|
|
1578
|
-
sessionId?: string | undefined;
|
|
1579
|
-
timeout?: number | undefined;
|
|
1580
|
-
async?: boolean | undefined;
|
|
1581
|
-
}, {
|
|
1582
|
-
command: string;
|
|
1583
|
-
description: string;
|
|
1584
|
-
sessionId?: string | undefined;
|
|
1585
|
-
timeout?: number | undefined;
|
|
1586
|
-
async?: boolean | undefined;
|
|
1587
|
-
}>, z.ZodObject<{
|
|
1588
|
-
sessionId: z.ZodString;
|
|
1589
|
-
input: z.ZodString;
|
|
1590
|
-
delay: z.ZodOptional<z.ZodNumber>;
|
|
1591
|
-
}, "strip", z.ZodTypeAny, {
|
|
1592
|
-
input: string;
|
|
1593
|
-
sessionId: string;
|
|
1594
|
-
delay?: number | undefined;
|
|
1595
|
-
}, {
|
|
1596
|
-
input: string;
|
|
1597
|
-
sessionId: string;
|
|
1598
|
-
delay?: number | undefined;
|
|
1599
|
-
}>, z.ZodObject<{
|
|
1600
|
-
sessionId: z.ZodString;
|
|
1601
|
-
delay: z.ZodNumber;
|
|
1602
|
-
}, "strip", z.ZodTypeAny, {
|
|
1603
|
-
sessionId: string;
|
|
1604
|
-
delay: number;
|
|
1605
|
-
}, {
|
|
1606
|
-
sessionId: string;
|
|
1607
|
-
delay: number;
|
|
1608
|
-
}>, z.ZodObject<{
|
|
1609
|
-
sessionId: z.ZodString;
|
|
1610
|
-
}, "strip", z.ZodTypeAny, {
|
|
1611
|
-
sessionId: string;
|
|
1612
|
-
}, {
|
|
1613
|
-
sessionId: string;
|
|
1614
|
-
}>]>, z.ZodDiscriminatedUnion<"command", [z.ZodObject<{
|
|
1615
|
-
command: z.ZodLiteral<"view">;
|
|
1616
|
-
path: z.ZodString;
|
|
1617
|
-
view_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
1618
|
-
}, "strip", z.ZodTypeAny, {
|
|
1619
|
-
path: string;
|
|
1620
|
-
command: "view";
|
|
1621
|
-
view_range?: [number, number] | undefined;
|
|
1622
|
-
}, {
|
|
1623
|
-
path: string;
|
|
1624
|
-
command: "view";
|
|
1625
|
-
view_range?: [number, number] | undefined;
|
|
1626
|
-
}>, z.ZodObject<{
|
|
1627
|
-
command: z.ZodLiteral<"create">;
|
|
1628
|
-
path: z.ZodString;
|
|
1629
|
-
file_text: z.ZodString;
|
|
1630
|
-
}, "strip", z.ZodTypeAny, {
|
|
1631
|
-
path: string;
|
|
1632
|
-
command: "create";
|
|
1633
|
-
file_text: string;
|
|
1634
|
-
}, {
|
|
1635
|
-
path: string;
|
|
1636
|
-
command: "create";
|
|
1637
|
-
file_text: string;
|
|
1638
|
-
}>, z.ZodObject<{
|
|
1639
|
-
command: z.ZodLiteral<"str_replace">;
|
|
1640
|
-
path: z.ZodString;
|
|
1641
|
-
new_str: z.ZodOptional<z.ZodString>;
|
|
1642
|
-
old_str: z.ZodString;
|
|
1643
|
-
}, "strip", z.ZodTypeAny, {
|
|
1644
|
-
path: string;
|
|
1645
|
-
command: "str_replace";
|
|
1646
|
-
old_str: string;
|
|
1647
|
-
new_str?: string | undefined;
|
|
1648
|
-
}, {
|
|
1649
|
-
path: string;
|
|
1650
|
-
command: "str_replace";
|
|
1651
|
-
old_str: string;
|
|
1652
|
-
new_str?: string | undefined;
|
|
1653
|
-
}>, z.ZodObject<{
|
|
1654
|
-
command: z.ZodLiteral<"insert">;
|
|
1655
|
-
path: z.ZodString;
|
|
1656
|
-
insert_line: z.ZodNumber;
|
|
1657
|
-
new_str: z.ZodString;
|
|
1318
|
+
id: z.ZodString;
|
|
1319
|
+
timestamp: z.ZodString;
|
|
1320
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1321
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
1322
|
+
} & {
|
|
1323
|
+
type: z.ZodLiteral<"hook.start">;
|
|
1324
|
+
data: z.ZodObject<{
|
|
1325
|
+
hookInvocationId: z.ZodString;
|
|
1326
|
+
hookType: z.ZodString;
|
|
1327
|
+
input: z.ZodUnknown;
|
|
1658
1328
|
}, "strip", z.ZodTypeAny, {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
insert_line: number;
|
|
1329
|
+
hookInvocationId: string;
|
|
1330
|
+
hookType: string;
|
|
1331
|
+
input?: unknown;
|
|
1663
1332
|
}, {
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}>]>, z.ZodUnknown]>;
|
|
1669
|
-
partialOutput: z.ZodOptional<z.ZodString>;
|
|
1670
|
-
isHidden: z.ZodOptional<z.ZodBoolean>;
|
|
1671
|
-
isAlwaysExpanded: z.ZodOptional<z.ZodBoolean>;
|
|
1672
|
-
showNoContent: z.ZodOptional<z.ZodBoolean>;
|
|
1333
|
+
hookInvocationId: string;
|
|
1334
|
+
hookType: string;
|
|
1335
|
+
input?: unknown;
|
|
1336
|
+
}>;
|
|
1673
1337
|
}, "strip", z.ZodTypeAny, {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1338
|
+
data: {
|
|
1339
|
+
hookInvocationId: string;
|
|
1340
|
+
hookType: string;
|
|
1341
|
+
input?: unknown;
|
|
1342
|
+
};
|
|
1343
|
+
id: string;
|
|
1344
|
+
type: "hook.start";
|
|
1345
|
+
timestamp: string;
|
|
1346
|
+
parentId: string | null;
|
|
1347
|
+
ephemeral?: boolean | undefined;
|
|
1684
1348
|
}, {
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1349
|
+
data: {
|
|
1350
|
+
hookInvocationId: string;
|
|
1351
|
+
hookType: string;
|
|
1352
|
+
input?: unknown;
|
|
1353
|
+
};
|
|
1354
|
+
id: string;
|
|
1355
|
+
type: "hook.start";
|
|
1356
|
+
timestamp: string;
|
|
1357
|
+
parentId: string | null;
|
|
1358
|
+
ephemeral?: boolean | undefined;
|
|
1695
1359
|
}>, z.ZodObject<{
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
}, "strip", z.ZodTypeAny, {
|
|
1718
|
-
log: string;
|
|
1719
|
-
type: "failure";
|
|
1720
|
-
markdown?: boolean | undefined;
|
|
1721
|
-
}, {
|
|
1722
|
-
log: string;
|
|
1723
|
-
type: "failure";
|
|
1724
|
-
markdown?: boolean | undefined;
|
|
1725
|
-
}>, z.ZodObject<{
|
|
1726
|
-
type: z.ZodLiteral<"rejected">;
|
|
1727
|
-
markdown: z.ZodOptional<z.ZodBoolean>;
|
|
1728
|
-
}, "strip", z.ZodTypeAny, {
|
|
1729
|
-
type: "rejected";
|
|
1730
|
-
markdown?: boolean | undefined;
|
|
1731
|
-
}, {
|
|
1732
|
-
type: "rejected";
|
|
1733
|
-
markdown?: boolean | undefined;
|
|
1734
|
-
}>, z.ZodObject<{
|
|
1735
|
-
type: z.ZodLiteral<"denied">;
|
|
1736
|
-
log: z.ZodString;
|
|
1737
|
-
markdown: z.ZodOptional<z.ZodBoolean>;
|
|
1738
|
-
}, "strip", z.ZodTypeAny, {
|
|
1739
|
-
log: string;
|
|
1740
|
-
type: "denied";
|
|
1741
|
-
markdown?: boolean | undefined;
|
|
1742
|
-
}, {
|
|
1743
|
-
log: string;
|
|
1744
|
-
type: "denied";
|
|
1745
|
-
markdown?: boolean | undefined;
|
|
1746
|
-
}>]>;
|
|
1747
|
-
arguments: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
1748
|
-
command: z.ZodString;
|
|
1749
|
-
description: z.ZodString;
|
|
1750
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
1751
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
1752
|
-
async: z.ZodOptional<z.ZodBoolean>;
|
|
1753
|
-
}, "strip", z.ZodTypeAny, {
|
|
1754
|
-
command: string;
|
|
1755
|
-
description: string;
|
|
1756
|
-
sessionId?: string | undefined;
|
|
1757
|
-
timeout?: number | undefined;
|
|
1758
|
-
async?: boolean | undefined;
|
|
1759
|
-
}, {
|
|
1760
|
-
command: string;
|
|
1761
|
-
description: string;
|
|
1762
|
-
sessionId?: string | undefined;
|
|
1763
|
-
timeout?: number | undefined;
|
|
1764
|
-
async?: boolean | undefined;
|
|
1765
|
-
}>, z.ZodObject<{
|
|
1766
|
-
sessionId: z.ZodString;
|
|
1767
|
-
input: z.ZodString;
|
|
1768
|
-
delay: z.ZodOptional<z.ZodNumber>;
|
|
1769
|
-
}, "strip", z.ZodTypeAny, {
|
|
1770
|
-
input: string;
|
|
1771
|
-
sessionId: string;
|
|
1772
|
-
delay?: number | undefined;
|
|
1773
|
-
}, {
|
|
1774
|
-
input: string;
|
|
1775
|
-
sessionId: string;
|
|
1776
|
-
delay?: number | undefined;
|
|
1777
|
-
}>, z.ZodObject<{
|
|
1778
|
-
sessionId: z.ZodString;
|
|
1779
|
-
delay: z.ZodNumber;
|
|
1780
|
-
}, "strip", z.ZodTypeAny, {
|
|
1781
|
-
sessionId: string;
|
|
1782
|
-
delay: number;
|
|
1783
|
-
}, {
|
|
1784
|
-
sessionId: string;
|
|
1785
|
-
delay: number;
|
|
1786
|
-
}>, z.ZodObject<{
|
|
1787
|
-
sessionId: z.ZodString;
|
|
1788
|
-
}, "strip", z.ZodTypeAny, {
|
|
1789
|
-
sessionId: string;
|
|
1790
|
-
}, {
|
|
1791
|
-
sessionId: string;
|
|
1792
|
-
}>]>, z.ZodDiscriminatedUnion<"command", [z.ZodObject<{
|
|
1793
|
-
command: z.ZodLiteral<"view">;
|
|
1794
|
-
path: z.ZodString;
|
|
1795
|
-
view_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
1796
|
-
}, "strip", z.ZodTypeAny, {
|
|
1797
|
-
path: string;
|
|
1798
|
-
command: "view";
|
|
1799
|
-
view_range?: [number, number] | undefined;
|
|
1800
|
-
}, {
|
|
1801
|
-
path: string;
|
|
1802
|
-
command: "view";
|
|
1803
|
-
view_range?: [number, number] | undefined;
|
|
1804
|
-
}>, z.ZodObject<{
|
|
1805
|
-
command: z.ZodLiteral<"create">;
|
|
1806
|
-
path: z.ZodString;
|
|
1807
|
-
file_text: z.ZodString;
|
|
1808
|
-
}, "strip", z.ZodTypeAny, {
|
|
1809
|
-
path: string;
|
|
1810
|
-
command: "create";
|
|
1811
|
-
file_text: string;
|
|
1812
|
-
}, {
|
|
1813
|
-
path: string;
|
|
1814
|
-
command: "create";
|
|
1815
|
-
file_text: string;
|
|
1816
|
-
}>, z.ZodObject<{
|
|
1817
|
-
command: z.ZodLiteral<"str_replace">;
|
|
1818
|
-
path: z.ZodString;
|
|
1819
|
-
new_str: z.ZodOptional<z.ZodString>;
|
|
1820
|
-
old_str: z.ZodString;
|
|
1360
|
+
id: z.ZodString;
|
|
1361
|
+
timestamp: z.ZodString;
|
|
1362
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1363
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
1364
|
+
} & {
|
|
1365
|
+
type: z.ZodLiteral<"hook.end">;
|
|
1366
|
+
data: z.ZodObject<{
|
|
1367
|
+
hookInvocationId: z.ZodString;
|
|
1368
|
+
hookType: z.ZodString;
|
|
1369
|
+
output: z.ZodUnknown;
|
|
1370
|
+
success: z.ZodBoolean;
|
|
1371
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
1372
|
+
message: z.ZodString;
|
|
1373
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
1374
|
+
}, "strip", z.ZodTypeAny, {
|
|
1375
|
+
message: string;
|
|
1376
|
+
stack?: string | undefined;
|
|
1377
|
+
}, {
|
|
1378
|
+
message: string;
|
|
1379
|
+
stack?: string | undefined;
|
|
1380
|
+
}>>;
|
|
1821
1381
|
}, "strip", z.ZodTypeAny, {
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1382
|
+
success: boolean;
|
|
1383
|
+
hookInvocationId: string;
|
|
1384
|
+
hookType: string;
|
|
1385
|
+
error?: {
|
|
1386
|
+
message: string;
|
|
1387
|
+
stack?: string | undefined;
|
|
1388
|
+
} | undefined;
|
|
1389
|
+
output?: unknown;
|
|
1826
1390
|
}, {
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1391
|
+
success: boolean;
|
|
1392
|
+
hookInvocationId: string;
|
|
1393
|
+
hookType: string;
|
|
1394
|
+
error?: {
|
|
1395
|
+
message: string;
|
|
1396
|
+
stack?: string | undefined;
|
|
1397
|
+
} | undefined;
|
|
1398
|
+
output?: unknown;
|
|
1399
|
+
}>;
|
|
1400
|
+
}, "strip", z.ZodTypeAny, {
|
|
1401
|
+
data: {
|
|
1402
|
+
success: boolean;
|
|
1403
|
+
hookInvocationId: string;
|
|
1404
|
+
hookType: string;
|
|
1405
|
+
error?: {
|
|
1406
|
+
message: string;
|
|
1407
|
+
stack?: string | undefined;
|
|
1408
|
+
} | undefined;
|
|
1409
|
+
output?: unknown;
|
|
1410
|
+
};
|
|
1411
|
+
id: string;
|
|
1412
|
+
type: "hook.end";
|
|
1413
|
+
timestamp: string;
|
|
1414
|
+
parentId: string | null;
|
|
1415
|
+
ephemeral?: boolean | undefined;
|
|
1416
|
+
}, {
|
|
1417
|
+
data: {
|
|
1418
|
+
success: boolean;
|
|
1419
|
+
hookInvocationId: string;
|
|
1420
|
+
hookType: string;
|
|
1421
|
+
error?: {
|
|
1422
|
+
message: string;
|
|
1423
|
+
stack?: string | undefined;
|
|
1424
|
+
} | undefined;
|
|
1425
|
+
output?: unknown;
|
|
1426
|
+
};
|
|
1427
|
+
id: string;
|
|
1428
|
+
type: "hook.end";
|
|
1429
|
+
timestamp: string;
|
|
1430
|
+
parentId: string | null;
|
|
1431
|
+
ephemeral?: boolean | undefined;
|
|
1432
|
+
}>, z.ZodObject<{
|
|
1433
|
+
id: z.ZodString;
|
|
1434
|
+
timestamp: z.ZodString;
|
|
1435
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
1436
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
1437
|
+
} & {
|
|
1438
|
+
type: z.ZodLiteral<"system.message">;
|
|
1439
|
+
data: z.ZodObject<{
|
|
1440
|
+
content: z.ZodString;
|
|
1441
|
+
role: z.ZodEnum<["system", "developer"]>;
|
|
1442
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1443
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
1444
|
+
promptVersion: z.ZodOptional<z.ZodString>;
|
|
1445
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1446
|
+
}, "strip", z.ZodTypeAny, {
|
|
1447
|
+
promptVersion?: string | undefined;
|
|
1448
|
+
variables?: Record<string, unknown> | undefined;
|
|
1449
|
+
}, {
|
|
1450
|
+
promptVersion?: string | undefined;
|
|
1451
|
+
variables?: Record<string, unknown> | undefined;
|
|
1452
|
+
}>>;
|
|
1836
1453
|
}, "strip", z.ZodTypeAny, {
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1454
|
+
role: "developer" | "system";
|
|
1455
|
+
content: string;
|
|
1456
|
+
name?: string | undefined;
|
|
1457
|
+
metadata?: {
|
|
1458
|
+
promptVersion?: string | undefined;
|
|
1459
|
+
variables?: Record<string, unknown> | undefined;
|
|
1460
|
+
} | undefined;
|
|
1841
1461
|
}, {
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1462
|
+
role: "developer" | "system";
|
|
1463
|
+
content: string;
|
|
1464
|
+
name?: string | undefined;
|
|
1465
|
+
metadata?: {
|
|
1466
|
+
promptVersion?: string | undefined;
|
|
1467
|
+
variables?: Record<string, unknown> | undefined;
|
|
1468
|
+
} | undefined;
|
|
1469
|
+
}>;
|
|
1850
1470
|
}, "strip", z.ZodTypeAny, {
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
} | {
|
|
1860
|
-
type: "rejected";
|
|
1861
|
-
markdown?: boolean | undefined;
|
|
1862
|
-
} | {
|
|
1863
|
-
log: string;
|
|
1864
|
-
type: "denied";
|
|
1865
|
-
markdown?: boolean | undefined;
|
|
1471
|
+
data: {
|
|
1472
|
+
role: "developer" | "system";
|
|
1473
|
+
content: string;
|
|
1474
|
+
name?: string | undefined;
|
|
1475
|
+
metadata?: {
|
|
1476
|
+
promptVersion?: string | undefined;
|
|
1477
|
+
variables?: Record<string, unknown> | undefined;
|
|
1478
|
+
} | undefined;
|
|
1866
1479
|
};
|
|
1867
|
-
|
|
1868
|
-
type: "
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
arguments?: unknown;
|
|
1873
|
-
isHidden?: boolean | undefined;
|
|
1874
|
-
isAlwaysExpanded?: boolean | undefined;
|
|
1875
|
-
showNoContent?: boolean | undefined;
|
|
1480
|
+
id: string;
|
|
1481
|
+
type: "system.message";
|
|
1482
|
+
timestamp: string;
|
|
1483
|
+
parentId: string | null;
|
|
1484
|
+
ephemeral?: boolean | undefined;
|
|
1876
1485
|
}, {
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
} | {
|
|
1886
|
-
type: "rejected";
|
|
1887
|
-
markdown?: boolean | undefined;
|
|
1888
|
-
} | {
|
|
1889
|
-
log: string;
|
|
1890
|
-
type: "denied";
|
|
1891
|
-
markdown?: boolean | undefined;
|
|
1486
|
+
data: {
|
|
1487
|
+
role: "developer" | "system";
|
|
1488
|
+
content: string;
|
|
1489
|
+
name?: string | undefined;
|
|
1490
|
+
metadata?: {
|
|
1491
|
+
promptVersion?: string | undefined;
|
|
1492
|
+
variables?: Record<string, unknown> | undefined;
|
|
1493
|
+
} | undefined;
|
|
1892
1494
|
};
|
|
1893
|
-
|
|
1894
|
-
type: "
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
arguments?: unknown;
|
|
1899
|
-
isHidden?: boolean | undefined;
|
|
1900
|
-
isAlwaysExpanded?: boolean | undefined;
|
|
1901
|
-
showNoContent?: boolean | undefined;
|
|
1495
|
+
id: string;
|
|
1496
|
+
type: "system.message";
|
|
1497
|
+
timestamp: string;
|
|
1498
|
+
parentId: string | null;
|
|
1499
|
+
ephemeral?: boolean | undefined;
|
|
1902
1500
|
}>]>;
|
|
1903
1501
|
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1502
|
+
/**
|
|
1503
|
+
* SessionManager interface for managing multiple sessions
|
|
1504
|
+
*/
|
|
1505
|
+
export declare interface SessionManager<TSession extends Session = Session> {
|
|
1506
|
+
/**
|
|
1507
|
+
* Create a new session
|
|
1508
|
+
*/
|
|
1509
|
+
createSession(): Promise<TSession>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Get the last (most recent) session
|
|
1512
|
+
*/
|
|
1513
|
+
getLastSession(): Promise<TSession>;
|
|
1514
|
+
/**
|
|
1515
|
+
* Get a specific session by ID
|
|
1516
|
+
*/
|
|
1517
|
+
getSession(id: string): Promise<TSession>;
|
|
1518
|
+
/**
|
|
1519
|
+
* List all available sessions
|
|
1520
|
+
*/
|
|
1521
|
+
listSessions(): Promise<SessionMetadata[]>;
|
|
1522
|
+
/**
|
|
1523
|
+
* Save session state immediately
|
|
1524
|
+
*/
|
|
1525
|
+
saveSession(session: TSession): Promise<void>;
|
|
1526
|
+
/**
|
|
1527
|
+
* Delete a session
|
|
1528
|
+
* @param options Options including session to delete
|
|
1529
|
+
*/
|
|
1530
|
+
deleteSession(session: TSession): Promise<void>;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
export declare interface SessionManagerOptions {
|
|
1534
|
+
/**
|
|
1535
|
+
* Logger instance for the session manager
|
|
1536
|
+
*/
|
|
1537
|
+
logger?: RunnerLogger;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
export declare interface SessionMetadata {
|
|
1541
|
+
readonly sessionId: string;
|
|
1542
|
+
readonly startTime: Date;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
export declare type SessionStartHook = (input: SessionStartHookInput) => Promise<SessionStartHookOutput | void>;
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* Session start hook types
|
|
1549
|
+
*/
|
|
1550
|
+
export declare interface SessionStartHookInput extends BaseHookInput {
|
|
1551
|
+
source: "startup" | "resume" | "new";
|
|
1552
|
+
initialPrompt?: string;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
export declare interface SessionStartHookOutput {
|
|
1556
|
+
additionalContext?: string;
|
|
1557
|
+
modifiedConfig?: Record<string, unknown>;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* A permission request for executing shell commands.
|
|
1562
|
+
*/
|
|
1563
|
+
declare type ShellPermissionRequest = {
|
|
1564
|
+
readonly kind: "shell";
|
|
1565
|
+
/** The full command that the user is being asked to approve, e.g. `echo foo && find -exec ... && git push` */
|
|
1566
|
+
readonly fullCommandText: string;
|
|
1567
|
+
/** A concise summary of the user's intention, e.g. "Echo foo and find a file and then run git push" */
|
|
1568
|
+
readonly intention: string;
|
|
1569
|
+
/**
|
|
1570
|
+
* The commands that are being invoked in the shell invocation.
|
|
1571
|
+
*
|
|
1572
|
+
* As a special case, which might be better represented in the type system, if there were no parsed commands
|
|
1573
|
+
* e.g. `export VAR=value`, then this will have a single entry with identifier equal to the fullCommandText.
|
|
1574
|
+
*/
|
|
1575
|
+
readonly commands: ReadonlyArray<Command>;
|
|
1576
|
+
/**
|
|
1577
|
+
* Possible file paths that the command might access.
|
|
1578
|
+
*
|
|
1579
|
+
* This is entirely heuristic, so it's pretty untrustworthy.
|
|
1580
|
+
*/
|
|
1581
|
+
readonly possiblePaths: ReadonlyArray<PossiblePath>;
|
|
1582
|
+
/**
|
|
1583
|
+
* Indicates whether any command in the script has redirection to write to a file.
|
|
1584
|
+
*/
|
|
1585
|
+
readonly hasWriteFileRedirection: boolean;
|
|
1586
|
+
/**
|
|
1587
|
+
* If there are complicated constructs, then persistent approval is not supported.
|
|
1588
|
+
* e.g. `cat $(echo "foo")` should not be persistently approvable because it's hard
|
|
1589
|
+
* for the user to understand the implications.
|
|
1590
|
+
*/
|
|
1591
|
+
readonly canOfferSessionApproval: boolean;
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* Telemetry emitted by the runtime contains properties and metrics. These are non-sensitive pieces
|
|
1596
|
+
* of information. There are also restricted properties that must be used to store sensitive information.
|
|
1597
|
+
*/
|
|
1598
|
+
declare type Telemetry = {
|
|
1599
|
+
/**
|
|
1600
|
+
* Telemetry properties can be used to store string props.
|
|
1601
|
+
* WARNING: Do not put sensitive data here. Use restrictedProperties for that.
|
|
1602
|
+
*/
|
|
1603
|
+
properties: Record<string, string | undefined>;
|
|
1604
|
+
/**
|
|
1605
|
+
* Restricted telemetry properties must be used to store sensitive string props. These props will only be available on the restricted kusto topics.
|
|
1606
|
+
* Nonnullable so it is harder to overlook.
|
|
1607
|
+
*/
|
|
1608
|
+
restrictedProperties: Record<string, string | undefined>;
|
|
1609
|
+
/**
|
|
1610
|
+
* The name of the telemetry event associated with the emitted runtime event.
|
|
1611
|
+
*/
|
|
1612
|
+
metrics: Record<string, number | undefined>;
|
|
1909
1613
|
};
|
|
1910
1614
|
|
|
1911
1615
|
declare type ToolResultExpanded<TelemetryT extends Telemetry = Telemetry> = {
|
|
@@ -1948,15 +1652,6 @@ declare type ToolResultExpanded<TelemetryT extends Telemetry = Telemetry> = {
|
|
|
1948
1652
|
sessionLog?: string;
|
|
1949
1653
|
};
|
|
1950
1654
|
|
|
1951
|
-
declare interface UsageMetrics {
|
|
1952
|
-
totalPremiumRequests: number;
|
|
1953
|
-
totalApiDurationMs: number;
|
|
1954
|
-
sessionStartTime: number;
|
|
1955
|
-
codeChanges: CodeChangeMetrics;
|
|
1956
|
-
modelMetrics: Map<string, ModelMetrics>;
|
|
1957
|
-
currentModel?: string;
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
1655
|
export declare type UserPromptSubmittedHook = (input: UserPromptSubmittedHookInput) => Promise<UserPromptSubmittedHookOutput | void>;
|
|
1961
1656
|
|
|
1962
1657
|
/**
|