Skip to content

Commit f6fbde9

Browse files
authored
Merge pull request #83 from nikomatsakis/main
feat(vscode): local distribution + approval routing fix
2 parents 8ceac45 + 97ad8c3 commit f6fbde9

File tree

4 files changed

+43
-16
lines changed

4 files changed

+43
-16
lines changed

vscode-extension/src/acpAgentActor.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,21 @@ export class AcpAgentActor {
244244
spawnArgs.push("--log", agentLogLevel);
245245
}
246246

247+
const traceDir = vsConfig.get<string>("traceDir", "");
248+
if (traceDir) {
249+
spawnArgs.push("--trace-dir", traceDir);
250+
}
251+
247252
if (resolved.isSymposiumBuiltin) {
248-
// Symposium builtin (e.g., eliza) - run conductor with subcommand directly
249-
spawnArgs.push(resolved.command, ...resolved.args);
253+
// Symposium builtin (e.g., eliza) - wrap with conductor using the same binary
254+
spawnArgs.push(
255+
"--",
256+
conductorCommand,
257+
resolved.command,
258+
...resolved.args,
259+
);
250260
} else {
251261
// External agent - wrap with conductor
252-
const traceDir = vsConfig.get<string>("traceDir", "");
253-
if (traceDir) {
254-
spawnArgs.push("--trace-dir", traceDir);
255-
}
256-
257262
spawnArgs.push("--", resolved.command, ...resolved.args);
258263
}
259264

vscode-extension/src/agentRegistry.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ export interface SymposiumDistribution {
3636
args?: string[];
3737
}
3838

39+
export interface LocalDistribution {
40+
command: string;
41+
args?: string[];
42+
env?: Record<string, string>;
43+
}
44+
3945
export interface Distribution {
46+
local?: LocalDistribution; // explicit local binary path
4047
npx?: NpxDistribution;
4148
pipx?: PipxDistribution;
4249
binary?: Record<string, BinaryDistribution>; // keyed by platform, e.g., "darwin-aarch64"
@@ -206,7 +213,16 @@ export async function resolveDistribution(
206213
): Promise<ResolvedCommand> {
207214
const dist = agent.distribution;
208215

209-
// Try symposium builtin first (e.g., eliza subcommand)
216+
// Try local first (explicit path takes priority)
217+
if (dist.local) {
218+
return {
219+
command: dist.local.command,
220+
args: dist.local.args ?? [],
221+
env: dist.local.env,
222+
};
223+
}
224+
225+
// Try symposium builtin (e.g., eliza subcommand)
210226
if (dist.symposium) {
211227
return {
212228
command: dist.symposium.subcommand,

vscode-extension/src/chatViewProvider.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -868,11 +868,17 @@ export class ChatViewProvider implements vscode.WebviewViewProvider {
868868
// Generate unique approval ID
869869
const approvalId = uuidv4();
870870

871-
// Find the tab for this session (we don't have sessionId in params, so we'll send to all tabs)
872-
// For now, we'll use the first tab - TODO: improve this to target the right tab
873-
const tabIds = Array.from(this.#tabToAgentSession.keys());
874-
if (tabIds.length === 0) {
875-
logger.error("approval", "No tabs available for approval request");
871+
// Find the tab for this agent by looking up which tab has a config with matching agentId
872+
let tabId: string | undefined;
873+
for (const [tid, config] of this.#tabToConfig.entries()) {
874+
if (config.agentId === agentId) {
875+
tabId = tid;
876+
break;
877+
}
878+
}
879+
880+
if (!tabId) {
881+
logger.error("approval", "No tab found for agent", { agentId });
876882
// Fallback: deny
877883
const rejectOption = params.options.find(
878884
(opt) => opt.kind === "reject_once",
@@ -885,8 +891,6 @@ export class ChatViewProvider implements vscode.WebviewViewProvider {
885891
return { outcome: { outcome: "cancelled" } };
886892
}
887893

888-
const tabId = tabIds[0]; // Use first tab for now
889-
890894
logger.debug("approval", "Requesting user approval", {
891895
approvalId,
892896
tabId,

vscode-extension/src/test/conversation.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ suite("Conversation Tests", () => {
8080
response.toLowerCase().includes("hello") ||
8181
response.toLowerCase().includes("hi") ||
8282
response.toLowerCase().includes("how") ||
83-
response.toLowerCase().includes("what"),
83+
response.toLowerCase().includes("what") ||
84+
response.toLowerCase().includes("you") ||
85+
response.toLowerCase().includes("thank"),
8486
"Response should be relevant to the prompt",
8587
);
8688

0 commit comments

Comments
 (0)