Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(computer): expose type_text delivery mode

nothingyuancandofc46be9c9d9a
diff --git a/packages/lizi-mcps/src/computer/computerMcpServer.test.ts b/packages/lizi-mcps/src/computer/computerMcpServer.test.ts
index 59fb657226..d7220d0ae4 100644
--- a/packages/lizi-mcps/src/computer/computerMcpServer.test.ts
+++ b/packages/lizi-mcps/src/computer/computerMcpServer.test.ts
@@ -79,6 +79,7 @@ describe('createComputerMcpServer', () => {
expect(payload.tools.map((tool) => tool.name)).toContain('replay_trajectory');
expect(payload.tools.map((tool) => tool.name)).toContain('type_text');
const listWindows = payload.tools.find((tool) => tool.name === 'list_windows');
+ const typeText = payload.tools.find((tool) => tool.name === 'type_text');
expect(listWindows?.inputSchema?.properties).toHaveProperty('query');
expect(listWindows?.inputSchema?.properties).toHaveProperty('workspace_root');
expect(listWindows?.inputSchema?.properties).toHaveProperty('process_name');
@@ -95,6 +96,7 @@ describe('createComputerMcpServer', () => {
.not.toHaveProperty('use_external_simulator');
expect(payload.tools.find((tool) => tool.name === 'hotkey')?.inputSchema?.properties)
.not.toHaveProperty('use_external_ios_workflow');
+ expect(typeText?.inputSchema?.properties).toHaveProperty('delivery_mode');
expect(payload.workflow).toContain('always for coordinates');
expect(payload.workflow).toContain('{"capture_mode":"vision"}');
await h.cleanup();
@@ -409,6 +411,30 @@ describe('createComputerMcpServer', () => {
await h.cleanup();
});
+ it('forwards an explicit type_text delivery mode to cua-driver', async () => {
+ const deps: ComputerMcpDeps = {
+ getStatus: vi.fn(),
+ callTool: vi.fn(async () => ({ ok: true })),
+ };
+ const h = await makeHarness(deps);
+
+ const result = await h.client.callTool({
+ name: 'call_tool',
+ arguments: {
+ name: 'type_text',
+ args: { pid: 123, text: 'hello', delivery_mode: 'foreground' },
+ },
+ });
+
+ expect(textPayload(result)).toMatchObject({ ok: true });
+ expect(deps.callTool).toHaveBeenCalledWith('type_text', {
+ pid: 123,
+ text: 'hello',
+ delivery_mode: 'foreground',
+ });
+ await h.cleanup();
+ });
+
it('dispatches zoom with cua-driver 0.5 region bounds', async () => {
const deps: ComputerMcpDeps = {
getStatus: vi.fn(),
diff --git a/packages/lizi-mcps/src/computer/tools.ts b/packages/lizi-mcps/src/computer/tools.ts
index 677856cce9..cc2bc4de28 100644
--- a/packages/lizi-mcps/src/computer/tools.ts
+++ b/packages/lizi-mcps/src/computer/tools.ts
@@ -165,6 +165,7 @@ export const COMPUTER_TOOLS: readonly ComputerToolDef[] = [
inputShape: {
pid: z.number().int().positive(),
text: z.string(),
+ delivery_mode: z.enum(['background', 'foreground']).optional(),
element_index: z.number().int().nonnegative().optional(),
window_id: z.number().int().nonnegative().optional(),
delay_ms: z.number().int().min(0).max(200).optional(),