feat: add Pi subagent scheduler and child runtime
This commit is contained in:
@@ -75,6 +75,7 @@ import {
|
||||
projectPiSessionSnapshot,
|
||||
} from './session-projector';
|
||||
import { PiManagedExtensionHost } from './extension-host';
|
||||
import type { PiSubagentScheduler } from './subagent';
|
||||
import {
|
||||
PiInteractionStore,
|
||||
type PiInteractionResponse,
|
||||
@@ -98,6 +99,7 @@ export interface PiConversationRuntimeOptions {
|
||||
isAuthenticationError?(error: unknown): boolean;
|
||||
refreshCredential?(accountId: string): Promise<void>;
|
||||
extensionHost?: PiManagedExtensionHost;
|
||||
subagentScheduler?: PiSubagentScheduler;
|
||||
getDraftRevision?(conversationId: string): number;
|
||||
knownExtensionWidgetKeys?: readonly string[];
|
||||
onExtensionUiProjection?(projection: PiExtensionUiProjection): void;
|
||||
@@ -480,6 +482,15 @@ export class PiConversationRuntime implements CodingConversationRuntime {
|
||||
this.isAuthenticationError = options.isAuthenticationError;
|
||||
this.refreshCredential = options.refreshCredential;
|
||||
this.extensionHost = options.extensionHost;
|
||||
if (options.subagentScheduler && !this.extensionHost) {
|
||||
throw new Error('Subagent scheduler requires the managed extension host');
|
||||
}
|
||||
if (options.subagentScheduler) {
|
||||
this.extensionHost?.configureSubagents({
|
||||
scheduler: options.subagentScheduler,
|
||||
trackGenerationResource: (input) => this.pool.trackGenerationResource(input),
|
||||
});
|
||||
}
|
||||
this.interactions = new PiInteractionStore(this.pool, (interaction) => {
|
||||
this.emit(interaction.conversationId, { op: 'interaction.upsert', interaction }, interaction.runId);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user