feat(scheduler): support multi-scheduler tool aggregation and nested call IDs (#17429)

This commit is contained in:
Abhi
2026-01-26 13:38:11 -05:00
committed by GitHub
parent 3e1a377d78
commit d745d86af1
9 changed files with 241 additions and 23 deletions
+13 -1
View File
@@ -17,6 +17,7 @@ import type {
ExecutingToolCall,
ToolCallResponseInfo,
} from './types.js';
import { ROOT_SCHEDULER_ID } from './types.js';
import type {
ToolConfirmationOutcome,
ToolResultDisplay,
@@ -39,7 +40,10 @@ export class SchedulerStateManager {
private readonly queue: ToolCall[] = [];
private _completedBatch: CompletedToolCall[] = [];
constructor(private readonly messageBus: MessageBus) {}
constructor(
private readonly messageBus: MessageBus,
private readonly schedulerId: string = ROOT_SCHEDULER_ID,
) {}
addToolCalls(calls: ToolCall[]): void {
this.enqueue(calls);
@@ -201,6 +205,7 @@ export class SchedulerStateManager {
void this.messageBus.publish({
type: MessageBusType.TOOL_CALLS_UPDATE,
toolCalls: snapshot,
schedulerId: this.schedulerId,
});
}
@@ -321,6 +326,7 @@ export class SchedulerStateManager {
response,
durationMs: startTime ? Date.now() - startTime : undefined,
outcome: call.outcome,
schedulerId: call.schedulerId,
};
}
@@ -336,6 +342,7 @@ export class SchedulerStateManager {
response,
durationMs: startTime ? Date.now() - startTime : undefined,
outcome: call.outcome,
schedulerId: call.schedulerId,
};
}
@@ -364,6 +371,7 @@ export class SchedulerStateManager {
startTime: 'startTime' in call ? call.startTime : undefined,
outcome: call.outcome,
invocation: call.invocation,
schedulerId: call.schedulerId,
};
}
@@ -388,6 +396,7 @@ export class SchedulerStateManager {
startTime: 'startTime' in call ? call.startTime : undefined,
outcome: call.outcome,
invocation: call.invocation,
schedulerId: call.schedulerId,
};
}
@@ -442,6 +451,7 @@ export class SchedulerStateManager {
},
durationMs: startTime ? Date.now() - startTime : undefined,
outcome: call.outcome,
schedulerId: call.schedulerId,
};
}
@@ -462,6 +472,7 @@ export class SchedulerStateManager {
startTime: 'startTime' in call ? call.startTime : undefined,
outcome: call.outcome,
invocation: call.invocation,
schedulerId: call.schedulerId,
};
}
@@ -482,6 +493,7 @@ export class SchedulerStateManager {
invocation: call.invocation,
liveOutput,
pid,
schedulerId: call.schedulerId,
};
}
}