Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const PROVIDERS: readonly TelemetryProvider[] = [
'copilot',
'kiro',
'mistral-vibe',
'goose',
];

/** A provider id as telemetry may carry it: one of these, else `none`. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export type RendererTelemetryEvents = {
| 'copilot'
| 'kiro'
| 'mistral-vibe'
| 'goose'
| 'none';
};
/** A message sent to the person's own switch-buddy: the how-manyth, from its chats. */
Expand Down
1 change: 1 addition & 0 deletions console/packages/agent-providers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ does not filter; use `pnpm exec vitest run <file>` for one provider.
| pi | 1.5.0 | 8/10 (2026-11-05) | Run with `mistral/devstral-medium-latest`: set a provider's API key in the shell (the test passes `*_API_KEY` through), `SWITCH_PI_MODEL` to a `provider/model` that `pi --list-models` shows, and `SWITCH_PI_BIN` to run a `pi` other than the one on the PATH. Pi has no tool that asks the user (its `question` tool is an example extension, which errors outside the TUI) and no subagent tool, so `user-input` and `subagent` are skipped. Pi never asks before a tool runs: the Switch extension asks the adapter about every call, and auto mode approves edits and asks before commands, as Pi has no automatic review. A mid-turn message queues as its own turn. Without a credential Pi still starts, on a placeholder model that refuses every prompt, so the adapter reads the model from `get_state` and asks for a sign-in. |
| kiro (ACP) | 3.0.0 | 9/10 (2026-11-04) | Kiro runs Switch's sessions on its V3 engine (it recognises the client); the run with the engine forced to V3 by flag matched. `user-input` is skipped: Kiro offers its `user_input` tool only in its spec workflows, so in the default `vibe` mode (and V2's default agent) it asks in prose and ends the turn. Once, the first session after a controller started was refused `session/set_model` (its `session/new` named no `model` option yet); the host's retry started it, and six more starts with a model did not repeat it. The suite skips itself until `kiro-cli whoami` says signed in; set `KIRO_API_KEY` in the shell to run it with a key, which the test passes through. |
| mistral-vibe (ACP) | vibe-acp 3.1.0 | 10/10 (2026-11-06) | Run on Vibe's default model, Mistral Medium 3.5 (`mistral-vibe-cli-latest`), with the key in `$VIBE_HOME/.env`. A key set as `MISTRAL_API_KEY` in the shell works too; the test passes it, and `VIBE_HOME`, through. |
| goose (ACP) | 1.57.0 | 9/10 (2026-11-04, Amazon Linux 2023) | `user-input` skipped: Goose uses ACP form elicitation, which the generic client does not advertise (`userInput: false`); without the skip the scenario times out at 180s waiting for `user-input.requested`. Real-CLI scenarios run one at a time with 65s spacing; full back-to-back suite can hit Gemini free-tier limits. |
| antigravity (retired `agy` adapter, kept for history) | 1.2.4 | 7/10 | Headless `agy` has no prompt channel at all: a tool that needs permission is auto-denied, so `approval-required` and `approval-declined` are skipped and the mode emits a `runtime.warning` at session start. `ask_question` is skipped by the CLI, so `user-input` is skipped. No steering — a mid-turn message queues as its own turn. No in-process cancel: an interrupt kills the process and the next turn respawns on `--conversation`. File tools run in the CLI's own scratch workspace unless `--add-dir <cwd>` is passed. Attachments are passed as file paths in the prompt text: the stream-json input accepts `text` blocks only and rejects `image`. Outside `full-access` a staged attachment is unreadable until its directory is passed as another `--add-dir`, which only takes effect at launch, so such a turn respawns first. A file the `download_attachment` Switch tool fetches lands under `~/.switch/sessions/<runtime pid>/media`, a directory named after a process the adapter never sees and created mid-turn, so outside `full-access` the session is given `~/.switch/sessions` at spawn and those downloads are readable without a respawn. |

## ACP providers
Expand Down
171 changes: 171 additions & 0 deletions console/packages/agent-providers/src/goose/goose-adapter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
import type * as fs from 'node:fs/promises';

Check warning on line 1 in console/packages/agent-providers/src/goose/goose-adapter.test.ts

View workflow job for this annotation

GitHub Actions / secrets and commit metadata

commit metadata

98e563c35f86: author email souravrajvi0@gmail.com is not a GitHub noreply address
import { beforeEach, expect, it, vi } from 'vitest';
import type { RuntimeMode } from '../adapter';
import { FakeAppServer } from '../codex/fake-app-server';
import type { ProviderRuntimeEvent } from '../events';

vi.mock('node:fs/promises', async (original) => ({
...(await original<typeof fs>()),
realpath: async (path: string) => path,
}));
const servers: FakeAppServer[] = [];
vi.mock('node:child_process', () => ({
spawn: () => {
const server = new FakeAppServer();
server.replyAlways('initialize', () => ({
agentCapabilities: {
loadSession: true,
promptCapabilities: { image: true, audio: false, embeddedContext: true },
mcpCapabilities: { http: true, sse: false },
},
authMethods: [{ id: 'goose-provider', name: 'Configure Provider' }],
}));
server.replyAlways('session/new', () => ({ sessionId: 'native' }));
server.replyAlways('session/set_mode', () => ({}));
servers.push(server);
return server;
},
}));
const { createGooseAdapter, gooseAcp, parseGooseInfo } = await import('./goose-adapter');
beforeEach(() => {
servers.length = 0;
});
async function setup(runtimeMode: RuntimeMode = 'approval-required') {
const adapter = createGooseAdapter();
const events: ProviderRuntimeEvent[] = [];
adapter.subscribe((e) => events.push(e));
await adapter.startSession({
sessionId: 's',
cwd: '/work',
runtimeMode,
env: {},
mcpServers: { switch: { transport: 'stdio', command: 'node', args: ['server.js'] } },
connectorMcpServers: [],
});
const server = servers.at(-1)!;
await adapter.sendTurn({ sessionId: 's', turnId: 't', text: 'go' });
await server.waitFor('session/prompt');
return { adapter, events, server };
}
const flush = () => new Promise((resolve) => setImmediate(resolve));

// What Goose 1.57.0 sends: the tool call names its tool in `_meta`, the
// permission request for it does not, and the options are raw ids.
const toolCall = (toolCallId: string, extensionName: string, toolName: string, title: string) => ({
sessionUpdate: 'tool_call',
toolCallId,
title,
_meta: { goose: { toolCall: { toolName, extensionName } } },
});
const permission = (id: number, toolCallId: string, title: string, rawInput: object) => ({
id,
method: 'session/request_permission',
params: {
sessionId: 'native',
toolCall: { toolCallId, title, kind: 'other', rawInput, _meta: null },
options: ['allow_always', 'allow_once', 'reject_once', 'reject_always'].map((kind) => ({
optionId: kind,
name: kind,
kind,
})),
},
});

it('puts every session in a Goose mode, since Goose defaults to approving everything', async () => {
expect(
(['approval-required', 'auto-accept-edits', 'auto', 'full-access'] as const).map((mode) =>
gooseAcp.sessionMode?.(mode, undefined)
)
).toEqual(['approve', 'approve', 'smart_approve', 'auto']);
const { server } = await setup();
expect(server.received.find((m) => m.method === 'session/set_mode')?.params).toEqual({
sessionId: 'native',
modeId: 'approve',
});
});

it('asks for a shell command as a command, offering only the once options', async () => {
const { adapter, events, server } = await setup();
server.notify('session/update', {
sessionId: 'native',
update: toolCall('call_1', 'developer', 'shell', 'shell · ls'),
});
server.send(permission(91, 'call_1', 'shell · ls', { command: 'ls' }));
await flush();
const request = events.find((e) => e.type === 'request.opened');
if (!request || request.type !== 'request.opened') throw new Error('missing approval');
expect(request.requestType).toBe('command_execution_approval');
expect(request.options).toEqual([
{ decision: 'accept', label: 'Allow once' },
{ decision: 'decline', label: 'Reject' },
{ decision: 'cancel', label: 'Cancel' },
]);
const item = events.find((e) => e.type === 'item.started' || e.type === 'item.updated');
expect(item && 'item' in item ? item.item.type : undefined).toBe('command_execution');
await adapter.respondToRequest('s', request.requestId, 'accept');
await flush();
expect(server.received.find((m) => m.id === 91)?.result).toEqual({
outcome: { outcome: 'selected', optionId: 'allow_once' },
});
});

it('accepts file writes and edits by itself in auto-accept-edits, and still asks for commands', async () => {
const { events, server } = await setup('auto-accept-edits');
server.send(permission(92, 'call_2', 'write · notes.txt', { path: 'notes.txt', content: 'hi' }));
server.send(
permission(93, 'call_3', 'edit · notes.txt', { path: 'notes.txt', before: 'a', after: 'b' })
);
await flush();
for (const id of [92, 93])
expect(server.received.find((m) => m.id === id)?.result).toEqual({
outcome: { outcome: 'selected', optionId: 'allow_once' },
});
server.send(permission(94, 'call_4', 'shell · rm -rf build', { command: 'rm -rf build' }));
await flush();
expect(events.some((e) => e.type === 'request.opened')).toBe(true);
});

it("runs the session's own MCP tools without asking, from the server named on the tool call", async () => {
const { events, server } = await setup();
server.notify('session/update', {
sessionId: 'native',
update: toolCall('call_5', 'switch', 'send_message', 'send_message · hello'),
});
server.send(permission(95, 'call_5', 'send_message · hello', { text: 'hello' }));
await flush();
expect(server.received.find((m) => m.id === 95)?.result).toEqual({
outcome: { outcome: 'selected', optionId: 'allow_once' },
});
expect(events.some((e) => e.type === 'request.opened')).toBe(false);
});

it("does not take Goose's own extensions for MCP servers", () => {
for (const extension of ['developer', 'summon', 'analyze', 'Extension Manager'])
expect(
gooseAcp.mcpServerOf?.(
{
toolCallId: 'c',
_meta: { goose: { toolCall: { toolName: 'x', extensionName: extension } } },
},
new Set()
)
).toBeUndefined();
expect(gooseAcp.mcpServerOf?.({ toolCallId: 'c' }, new Set())).toBeUndefined();
});

it('reads the provider and model from `goose info -v`', () => {
const info = (configuration: string) =>
`goose Version:\n Version: 1.57.0\n\nPaths:\nConfig dir: /home/u/.config/goose\n\ngoose Configuration:\n${configuration} extensions:\n developer:\n enabled: true\n`;
expect(
parseGooseInfo(info(' GOOSE_MODEL: gemini-3.5-flash\n GOOSE_PROVIDER: google\n'))
).toMatchObject({ status: 'authenticated', message: 'Uses google (gemini-3.5-flash).' });
expect(parseGooseInfo(info('')).status).toBe('unauthenticated');
expect(parseGooseInfo(info(' GOOSE_PROVIDER: google\n')).status).toBe('unauthenticated');
expect(
parseGooseInfo('goose: unknown command "info"\nUsage: goose [OPTIONS] DRIVER DBSTRING')
).toMatchObject({
status: 'unknown',
message:
'The `goose` on PATH is not the Goose agent CLI. Install Goose from https://goose-docs.ai.',
});
});
147 changes: 147 additions & 0 deletions console/packages/agent-providers/src/goose/goose-adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import { createAcpAdapter, type AcpAdapter } from '../acp/acp-adapter';
import type { AcpAdapterOptions, AcpProviderHooks } from '../acp/hooks';
import type { AcpPermissionRequest, AcpToolCall } from '../acp/protocol';
import type { RuntimeMode } from '../adapter';
import type { ItemType } from '../events';
import { execProvider } from '../provider-process';
import { commandOutput, readiness, signInWith, type ProviderReadiness } from '../readiness';

const GOOSE_LOGIN = 'goose configure';

// Goose's bundled extensions, as `goose info -v` lists them. A tool call from
// any other extension is from an MCP server the session registered.
const GOOSE_EXTENSIONS = new Set([
'analyze',
'apps',
'chatrecall',
'code_execution',
'developer',
'Extension Manager',
'scheduler',
'skills',
'summarize',
'summon',
'todo',
'tom',
]);

// A new Goose session starts in the machine's GOOSE_MODE, `auto` unless set,
// which approves every tool call; so every session gets a mode. Goose keeps it
// on the session and never writes it to its config.
const GOOSE_MODES: Record<RuntimeMode, string> = {
'approval-required': 'approve',
'auto-accept-edits': 'approve',
auto: 'smart_approve',
'full-access': 'auto',
};

const ITEM_TYPES: Record<string, ItemType> = {
'developer/shell': 'command_execution',
'developer/write': 'file_change',
'developer/edit': 'file_change',
'summon/delegate': 'subagent',
};

function gooseTool(toolCall: AcpToolCall): { extension: string; tool: string } | undefined {
const call = (toolCall._meta?.goose as { toolCall?: unknown } | undefined)?.toolCall as
| { extensionName?: unknown; toolName?: unknown }
| undefined;
return typeof call?.extensionName === 'string' && typeof call.toolName === 'string'
? { extension: call.extensionName, tool: call.toolName }
: undefined;
}

/** Reads the provider and model `goose info -v` resolves, from the environment or Goose's config. */
export function parseGooseInfo(output: string): ProviderReadiness {
// pressly/goose, a database migration tool, installs a binary of the same name.
if (!/^goose Version:/m.test(output))
return readiness(
'unknown',
'The `goose` on PATH is not the Goose agent CLI. Install Goose from https://goose-docs.ai.'
);
const setting = (key: string) =>
output.match(new RegExp(`^[ \\t]+${key}:[ \\t]*(\\S.*)$`, 'm'))?.[1]?.trim();
const provider = setting('GOOSE_PROVIDER');
const model = setting('GOOSE_MODEL');
if (!provider || !model) return readiness('unauthenticated', signInWith(GOOSE_LOGIN));
return readiness('authenticated', `Uses ${provider} (${model}).`);
}

/**
* Goose's permission request carries no `_meta` and always the kind `other`,
* only a title naming the tool (`shell · ls`, `write · notes.txt`), so the
* kind is read from the title and the tool's arguments. It offers
* `allow_always`, which Goose writes to its machine-wide `permission.yaml`,
* outliving the session and covering every Goose session on the machine:
* only the once options are kept, with readable labels.
*/
export function gooseRequest(request: AcpPermissionRequest): void {
const { toolCall } = request;
const tool = toolCall.title?.match(/^(\w+) · /)?.[1];
const input = toolCall.rawInput ?? {};
if (tool === 'shell' && typeof input.command === 'string') toolCall.kind = 'execute';
else if ((tool === 'write' || tool === 'edit') && typeof input.path === 'string')
toolCall.kind = 'edit';
request.options = request.options.flatMap((option) =>
option.kind === 'allow_once'
? [{ ...option, name: 'Allow once' }]
: option.kind === 'reject_once'
? [{ ...option, name: 'Reject' }]
: []
);
}

/** Goose's `goose acp`, with its session modes and its tool and permission metadata. */
export const gooseAcp: AcpProviderHooks = {
provider: 'goose',
label: 'Goose',
defaultBinary: 'goose',
capabilities: {
modelSwitchInSession: true,
steering: false,
resume: true,
approvals: true,
userInput: false,
},
launch: ({ binaryPath, env }) => ({ command: binaryPath, args: ['acp'], env }),
loginCommand: GOOSE_LOGIN,
inheritEnv: ['GOOSE_PROVIDER', 'GOOSE_MODEL', 'GOOSE_DISABLE_KEYRING'],
// Goose has no account: it is ready once a provider and model are
// configured. `initialize` offers the same `goose-provider` method either
// way, so the handshake cannot tell. `goose info -v` resolves both without a
// model call; the provider's key is taken as given, and a bad one fails the
// first turn.
checkSignIn: async ({ binaryPath, cwd, env }) => {
let output: string;
try {
output = (
await execProvider(binaryPath, ['info', '-v'], {
cwd,
env,
timeout: 15000,
maxBuffer: 1024 * 1024,
})
).stdout;
} catch (error) {
output = commandOutput(error);
}
return parseGooseInfo(output);
},
sessionMode: (mode) => GOOSE_MODES[mode],
mcpServerOf: (toolCall) => {
const extension = gooseTool(toolCall)?.extension;
return extension !== undefined && !GOOSE_EXTENSIONS.has(extension) ? extension : undefined;
},
itemType: (toolCall) => {
const call = gooseTool(toolCall);
return call ? ITEM_TYPES[`${call.extension}/${call.tool}`] : undefined;
},
permission: (_context, request) => {
gooseRequest(request);
return undefined;
},
};

export function createGooseAdapter(options: AcpAdapterOptions = {}): AcpAdapter {
return createAcpAdapter(gooseAcp, options);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { spawnSync } from 'node:child_process';
import { describeConformance, echoMcpServerSpec } from '../testing/index';
import { createGooseAdapter } from './goose-adapter';

describeConformance('goose', {
createAdapter: async () => createGooseAdapter(),
skip: {
'user-input':
'Goose 1.57.0 asks through ACP form elicitation; the generic ACP client does not advertise it (hooks set userInput: false). Verified 2026-11-04.',
},
unavailableReason: async () => {
const probe = spawnSync('goose', ['info', '-v'], { encoding: 'utf8' });
if (probe.error || probe.status !== 0) return 'the goose binary is not on PATH';
return /^[ \t]+GOOSE_PROVIDER:/m.test(probe.stdout)
? null
: 'Goose has no provider configured; run `goose configure`';
},
mcpServers: { echo: echoMcpServerSpec() },
// The harness hands the CLI a minimal environment. Goose reads its provider
// and model from its config; a headless machine has no keyring to read the
// provider's key from, so it is read from Goose's secrets file instead.
env: { GOOSE_DISABLE_KEYRING: '1' },
});
1 change: 1 addition & 0 deletions console/packages/agent-providers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export {
createDeepseekHarnessAdapter,
deepseekHarnessAcp,
} from './deepseek-harness/deepseek-harness-acp';
export { gooseAcp, createGooseAdapter } from './goose/goose-adapter';
export { kiroAcp, createKiroAdapter } from './kiro/kiro-acp';
export { ChatProjector } from './session-v1/chat-projector';
export { EventOutbox } from './session-v1/event-outbox';
Expand Down
2 changes: 2 additions & 0 deletions console/packages/agent-providers/src/providers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { checkCodexSignIn, CODEX_LOGIN } from '../codex/sign-in';
import { copilotAcp } from '../copilot/copilot-acp';
import { cursorAcp } from '../cursor/cursor-adapter';
import { deepseekHarnessAcp } from '../deepseek-harness/deepseek-harness-acp';
import { gooseAcp } from '../goose/goose-adapter';
import { kiroAcp } from '../kiro/kiro-acp';
import { mistralVibeAcp } from '../mistral-vibe/mistral-vibe-acp';
import { createOpencodeAdapter } from '../opencode/opencode-adapter';
Expand Down Expand Up @@ -125,6 +126,7 @@ export const PROVIDER_RUNTIMES: readonly ProviderRuntime[] = [
createPiAdapter({ binaryPath, ...(logger ? { logger } : {}) }),
checkSignIn: checkPiSignIn,
},
acpProviderRuntime(gooseAcp),
];

const RUNTIMES = new Map(PROVIDER_RUNTIMES.map((runtime) => [runtime.id, runtime]));
Expand Down
Loading
Loading