mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 05:04:44 +00:00
refactor(coding-agent): narrow ExtensionRunner emit event type
This commit is contained in:
parent
a40bf5fbd5
commit
703ee26625
1 changed files with 10 additions and 1 deletions
|
|
@ -92,6 +92,15 @@ interface BeforeAgentStartCombinedResult {
|
||||||
systemPrompt?: string;
|
systemPrompt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Events handled by the generic emit() method.
|
||||||
|
* Events with dedicated emitXxx() methods are excluded for stronger type safety.
|
||||||
|
*/
|
||||||
|
type RunnerEmitEvent = Exclude<
|
||||||
|
ExtensionEvent,
|
||||||
|
ToolCallEvent | UserBashEvent | ContextEvent | BeforeAgentStartEvent | ResourcesDiscoverEvent | InputEvent
|
||||||
|
>;
|
||||||
|
|
||||||
export type ExtensionErrorListener = (error: ExtensionError) => void;
|
export type ExtensionErrorListener = (error: ExtensionError) => void;
|
||||||
|
|
||||||
export type NewSessionHandler = (options?: {
|
export type NewSessionHandler = (options?: {
|
||||||
|
|
@ -476,7 +485,7 @@ export class ExtensionRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
async emit(
|
async emit(
|
||||||
event: ExtensionEvent,
|
event: RunnerEmitEvent,
|
||||||
): Promise<SessionBeforeCompactResult | SessionBeforeTreeResult | ToolResultEventResult | undefined> {
|
): Promise<SessionBeforeCompactResult | SessionBeforeTreeResult | ToolResultEventResult | undefined> {
|
||||||
const ctx = this.createContext();
|
const ctx = this.createContext();
|
||||||
let result: SessionBeforeCompactResult | SessionBeforeTreeResult | ToolResultEventResult | undefined;
|
let result: SessionBeforeCompactResult | SessionBeforeTreeResult | ToolResultEventResult | undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue