Skip to content
5 changes: 3 additions & 2 deletions docs/windows-test-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Locations intentionally omit line numbers so unrelated edits do not invalidate t
|---|---:|
| windows-backend-gap | 27 |
| portable-candidate | 31 |
| platform-contract | 31 |
| platform-contract | 32 |

Total Windows-excluded declarations: **89**
Total Windows-excluded declarations: **90**

## Inventory

Expand All @@ -34,6 +34,7 @@ Total Windows-excluded declarations: **89**
| platform-contract | `apps/desktop/src/main/__tests__/shell-env.test.ts` keeps the inherited PATH and does not log shell stderr when capture fails | `process.platform === 'win32'` |
| platform-contract | `apps/desktop/src/main/__tests__/shell-env.test.ts` kills login-shell descendants when capture times out | `process.platform === 'win32'` |
| platform-contract | `apps/desktop/src/main/__tests__/shell-env.test.ts` bounds shell output instead of buffering until the global timeout | `process.platform === 'win32'` |
| platform-contract | `packages/cli/src/__tests__/acp-prompt-content.test.ts` rejects a FIFO without blocking the process | `process.platform === 'win32'` |
| portable-candidate | `packages/cli/src/__tests__/pi-transcript.test.ts` shortens POSIX paths under the home directory | `process.platform === 'win32'` |
| portable-candidate | `packages/cli/src/__tests__/pi-transcript.test.ts` keeps POSIX paths outside the home directory absolute | `process.platform === 'win32'` |
| portable-candidate | `packages/cli/src/__tests__/runtime-host-local-managed-activation.test.ts` local CLI cold-starts through the installed ${legacy ? 'legacy' : 'Node'} operator | `process.platform === 'win32'` |
Expand Down
81 changes: 67 additions & 14 deletions packages/cli/src/__tests__/acp-agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import { client, methods, RequestError } from '@agentclientprotocol/sdk';
import { createMakaAcpAgent } from '../acp/maka-acp-agent.js';

describe('Maka ACP agent', () => {
test('returns the Maka identity and advertises only Session listing', async () => {
test('returns the Maka identity and advertises Session listing and close', async () => {
await client({ name: 'test-client' }).connectWith(
createMakaAcpAgent({ version: '0.2.0', sessionRegistry: fakeSessionRegistry() }),
async (agent) => {
assert.deepEqual(await agent.request(methods.agent.initialize, { protocolVersion: 1 }), {
protocolVersion: 1,
agentCapabilities: { sessionCapabilities: { list: {} } },
agentCapabilities: { sessionCapabilities: { list: {}, close: {} } },
authMethods: [],
agentInfo: { name: 'maka', title: 'Maka', version: '0.2.0' },
});
Expand Down Expand Up @@ -107,21 +107,50 @@ describe('Maka ACP agent', () => {
]);
});

test('does not implement or advertise session/close', async () => {
await client({ name: 'test-client' }).connectWith(
createMakaAcpAgent({ version: '0.2.0', sessionRegistry: fakeSessionRegistry() }),
test('routes prompt, cancel, and close through the Session registry', async () => {
const prompts: unknown[] = [];
const cancellations: unknown[] = [];
const closes: unknown[] = [];
const updates: unknown[] = [];
const testClient = client({ name: 'test-client' }).onNotification(
methods.client.session.update,
({ params }) => void updates.push(params),
);
await testClient.connectWith(
createMakaAcpAgent({
version: '0.2.0',
sessionRegistry: fakeSessionRegistry({ prompts, cancellations, closes }),
}),
async (agent) => {
await assert.rejects(
agent.request(methods.agent.session.close, { sessionId: 'session-1' }),
(error: unknown) => {
assert.ok(error instanceof RequestError);
assert.equal(error.code, -32601);
assert.deepEqual(error.data, { method: 'session/close' });
return true;
},
assert.deepEqual(
await agent.request(methods.agent.session.prompt, {
sessionId: 'session-1',
prompt: [{ type: 'text', text: 'hello' }],
}),
{ stopReason: 'end_turn' },
);
await agent.notify(methods.agent.session.cancel, { sessionId: 'session-1' });
assert.deepEqual(
await agent.request(methods.agent.session.close, { sessionId: 'session-1' }),
{},
);
},
);
assert.deepEqual(prompts, [
{ sessionId: 'session-1', prompt: [{ type: 'text', text: 'hello' }] },
]);
assert.deepEqual(cancellations, [{ sessionId: 'session-1' }]);
assert.deepEqual(closes, [{ sessionId: 'session-1' }]);
assert.deepEqual(updates, [
{
sessionId: 'session-1',
update: {
sessionUpdate: 'agent_message_chunk',
content: { type: 'text', text: 'hello' },
messageId: 'message-1',
},
},
]);
});

test('does not implement session/set_mode', async () => {
Expand Down Expand Up @@ -158,7 +187,14 @@ describe('Maka ACP agent', () => {
});

function fakeSessionRegistry(
observations: { creates?: unknown[]; lists?: unknown[]; configurationRequests?: unknown[] } = {},
observations: {
creates?: unknown[];
lists?: unknown[];
configurationRequests?: unknown[];
prompts?: unknown[];
cancellations?: unknown[];
closes?: unknown[];
} = {},
) {
return {
create: async (params: unknown) => {
Expand Down Expand Up @@ -196,5 +232,22 @@ function fakeSessionRegistry(
],
};
},
prompt: async (params: unknown, context: { notify(notification: unknown): Promise<void> }) => {
observations.prompts?.push(params);
await context.notify({
sessionId: 'session-1',
update: {
sessionUpdate: 'agent_message_chunk',
content: { type: 'text', text: 'hello' },
messageId: 'message-1',
},
});
return { stopReason: 'end_turn' as const };
},
cancel: async (params: unknown) => void observations.cancellations?.push(params),
close: async (params: unknown) => {
observations.closes?.push(params);
return {};
},
};
}
3 changes: 2 additions & 1 deletion packages/cli/src/__tests__/acp-child-process-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface AcpChildProcessHarnessOptions {
readonly model?: {
readonly id: string;
readonly thinkingLevels: readonly ThinkingLevel[];
readonly baseUrl?: string;
};
}

Expand Down Expand Up @@ -364,7 +365,7 @@ async function seedModelConnection(
slug: 'acp-fixture-model',
name: 'ACP fixture model',
providerType: 'openai-compatible',
baseUrl: 'https://acp-model.invalid/v1',
baseUrl: model.baseUrl ?? 'https://acp-model.invalid/v1',
enabled: true,
enabledModelIds: [model.id],
...(model.thinkingLevels.length === 0
Expand Down
Loading
Loading