feat(coding-agent): expose project trust to extensions

closes #5523
This commit is contained in:
Mario Zechner
2026-06-09 13:02:58 +02:00
parent 081a0a2bef
commit db3f9953ee
8 changed files with 35 additions and 0 deletions

View File

@@ -76,6 +76,7 @@ describe("ExtensionRunner", () => {
const extensionContextActions: ExtensionContextActions = {
getModel: () => undefined,
isIdle: () => true,
isProjectTrusted: () => true,
getSignal: () => undefined,
abort: () => {},
hasPendingMessages: () => false,
@@ -496,6 +497,18 @@ describe("ExtensionRunner", () => {
expect(ctx.hasUI).toBe(false);
});
it("exposes project trust state on ExtensionContext", async () => {
const result = await discoverAndLoadExtensions([], tempDir, tempDir);
const runner = new ExtensionRunner(result.extensions, result.runtime, tempDir, sessionManager, modelRegistry);
runner.bindCore(extensionActions, {
...extensionContextActions,
isProjectTrusted: () => false,
});
const ctx = runner.createContext();
expect(ctx.isProjectTrusted()).toBe(false);
});
it("exposes rpc mode with hasUI true when an RPC UI context is provided", async () => {
const result = await discoverAndLoadExtensions([], tempDir, tempDir);
const runner = new ExtensionRunner(result.extensions, result.runtime, tempDir, sessionManager, modelRegistry);

View File

@@ -12,6 +12,7 @@ function createContext(tokens: number | null, compact = vi.fn()): ExtensionConte
modelRegistry: {} as ExtensionContext["modelRegistry"],
model: undefined,
isIdle: () => true,
isProjectTrusted: () => true,
signal: undefined,
abort: vi.fn(),
hasPendingMessages: () => false,