fix(agent-browser): restore bounded presentation lifecycle
This commit is contained in:
@@ -23,6 +23,10 @@ import type { EffectivePluginSnapshot } from '../../coding-plugins/effective-res
|
||||
import type { KnownToolDetails, RuntimeContextDetailsV1 } from '../contracts';
|
||||
import { BUNDLED_CODING_SKILL_IDS } from '../../../shared/coding-skills';
|
||||
import { PiAgentBrowserTool } from './extensions/agent-browser';
|
||||
import type {
|
||||
AgentBrowserPresentationRequester,
|
||||
AgentBrowserStatePublisher,
|
||||
} from './extensions/agent-browser';
|
||||
import { reportChangedFiles } from './extensions/changed-file';
|
||||
import { projectTaskState } from './extensions/task-state';
|
||||
import type { ModelToolRegistryPort } from './model-tools/model-tool-registry';
|
||||
@@ -73,6 +77,8 @@ export interface PiProductToolsOptions {
|
||||
capabilityRegistry?: CodingCapabilityRegistry;
|
||||
modelToolRegistry?: ModelToolRegistryPort;
|
||||
devicePackageTools?: DevicePackageTools;
|
||||
requestAgentBrowserPresentation?: AgentBrowserPresentationRequester;
|
||||
publishAgentBrowserState?: AgentBrowserStatePublisher;
|
||||
}
|
||||
|
||||
export class PiProductTools {
|
||||
@@ -82,7 +88,12 @@ export class PiProductTools {
|
||||
|
||||
constructor(private readonly options: PiProductToolsOptions) {
|
||||
this.changeTracker = options.changeTracker ?? new ConversationChangeTracker();
|
||||
this.browser = new PiAgentBrowserTool(options.browser, options.attachments);
|
||||
this.browser = new PiAgentBrowserTool(
|
||||
options.browser,
|
||||
options.attachments,
|
||||
options.requestAgentBrowserPresentation,
|
||||
options.publishAgentBrowserState,
|
||||
);
|
||||
this.capabilityRegistry = options.capabilityRegistry;
|
||||
}
|
||||
|
||||
@@ -94,8 +105,12 @@ export class PiProductTools {
|
||||
return this.changeTracker.beginRun(input);
|
||||
}
|
||||
|
||||
settleRun(conversationId: string, runId: string) {
|
||||
return this.changeTracker.settleRun(conversationId, runId);
|
||||
async settleRun(conversationId: string, runId: string) {
|
||||
try {
|
||||
return await this.changeTracker.settleRun(conversationId, runId);
|
||||
} finally {
|
||||
await this.browser.releaseRun(conversationId, runId);
|
||||
}
|
||||
}
|
||||
|
||||
getChanges(conversationId: string): ConversationChangesSnapshot | null {
|
||||
|
||||
Reference in New Issue
Block a user