feat(coding-agent): add extension project trust decisions
This commit is contained in:
@@ -70,6 +70,7 @@ import type {
|
||||
ExtensionUIContext,
|
||||
ExtensionUIDialogOptions,
|
||||
ExtensionWidgetOptions,
|
||||
ProjectTrustContext,
|
||||
} from "../../core/extensions/index.ts";
|
||||
import { FooterDataProvider, type ReadonlyFooterDataProvider } from "../../core/footer-data-provider.ts";
|
||||
import { configureHttpDispatcher, formatHttpIdleTimeoutMs } from "../../core/http-dispatcher.ts";
|
||||
@@ -1993,6 +1994,21 @@ export class InteractiveMode {
|
||||
/**
|
||||
* Create the ExtensionUIContext for extensions.
|
||||
*/
|
||||
private createProjectTrustContext(cwd: string): ProjectTrustContext {
|
||||
const ui = this.createExtensionUIContext();
|
||||
return {
|
||||
cwd,
|
||||
mode: "tui",
|
||||
hasUI: true,
|
||||
ui: {
|
||||
select: ui.select,
|
||||
confirm: ui.confirm,
|
||||
input: ui.input,
|
||||
notify: ui.notify,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private createExtensionUIContext(): ExtensionUIContext {
|
||||
return {
|
||||
select: (title, options, opts) => this.showExtensionSelector(title, options, opts),
|
||||
@@ -4569,6 +4585,7 @@ export class InteractiveMode {
|
||||
try {
|
||||
const result = await this.runtimeHost.switchSession(sessionPath, {
|
||||
withSession: options?.withSession,
|
||||
projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
|
||||
});
|
||||
if (result.cancelled) {
|
||||
return result;
|
||||
@@ -4586,6 +4603,7 @@ export class InteractiveMode {
|
||||
const result = await this.runtimeHost.switchSession(sessionPath, {
|
||||
cwdOverride: selectedCwd,
|
||||
withSession: options?.withSession,
|
||||
projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
|
||||
});
|
||||
if (result.cancelled) {
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user