@agentrq/acp-gateway 0.2.33 → 0.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,7 @@ npm install -g @agentrq/acp-gateway
37
37
 
38
38
  ## Current Version
39
39
 
40
- `0.2.33`
40
+ `0.2.34`
41
41
 
42
42
  ## Usage
43
43
 
@@ -140,6 +140,13 @@ describe("AgentRQACPClient", () => {
140
140
  "mcp__agentrq-workspace__loadMemory",
141
141
  "mcp.agentrq-workspace.deleteMemory",
142
142
  "reply (agentrq-workspace MCP Server)",
143
+ "mcp__agentrq-workspace__task",
144
+ "mcp__agentrq-workspace__memory",
145
+ "mcp__agentrq-workspace__skills",
146
+ "mcp__agentrq-workspace__workspace",
147
+ "mcp__agentrq-workspace__siteTools",
148
+ "mcp__agentrq-workspace__pano",
149
+ "mcp__agentrq-workspace__help",
143
150
  ])("auto-allows %s", async (title) => {
144
151
  const { bridge, client: c } = clientFor("agentrq-workspace");
145
152
  const response = await c.requestPermission(ask(title));
@@ -2207,5 +2214,133 @@ describe("AgentRQACPClient", () => {
2207
2214
  }));
2208
2215
  });
2209
2216
  });
2217
+ describe("the single task tool", () => {
2218
+ const TASK_SERVER = new Set(["task", "pano", "getWorkspace"]);
2219
+ beforeEach(() => {
2220
+ mcpBridge.getAdvertisedTools = vi.fn().mockReturnValue(TASK_SERVER);
2221
+ });
2222
+ function okResult(text = "ok") {
2223
+ return { isError: false, content: [{ type: "text", text }] };
2224
+ }
2225
+ it("forwards the agent's reply through task", async () => {
2226
+ mcpBridge.callTool.mockResolvedValue(okResult());
2227
+ const c = new AgentRQACPClient(mcpBridge, () => "task-123");
2228
+ vi.spyOn(process.stdout, "write").mockImplementation(() => true);
2229
+ await c.sessionUpdate({ sessionId: "sess-1", update: { sessionUpdate: "agent_message_chunk", content: { type: "text", text: "Hello" } } });
2230
+ await c.flushReply("sess-1");
2231
+ expect(mcpBridge.callTool).toHaveBeenCalledWith("task", {
2232
+ action: "reply",
2233
+ payload: { taskId: "task-123", text: "Hello" },
2234
+ });
2235
+ });
2236
+ it("reports a stop reason through task", async () => {
2237
+ mcpBridge.callTool.mockResolvedValue(okResult());
2238
+ const c = new AgentRQACPClient(mcpBridge, () => "task-1");
2239
+ await c.reportStopReason("sess-1", "refusal");
2240
+ expect(mcpBridge.callTool).toHaveBeenCalledWith("task", {
2241
+ action: "reply",
2242
+ payload: { taskId: "task-1", text: expect.any(String) },
2243
+ });
2244
+ });
2245
+ it("creates, starts and asks through task when an elicitation has no task", async () => {
2246
+ mcpBridge.callTool.mockImplementation(async (_name, args) => {
2247
+ if (args.action === "create")
2248
+ return okResult("task created with id=T-new");
2249
+ if (args.action === "elicit")
2250
+ return okResult(JSON.stringify({ action: "decline" }));
2251
+ return okResult();
2252
+ });
2253
+ const params = {
2254
+ mode: "form",
2255
+ message: "Name?",
2256
+ requestedSchema: { type: "object", properties: { name: { type: "string" } } },
2257
+ };
2258
+ const response = await client.createElicitation(params);
2259
+ expect(mcpBridge.callTool.mock.calls).toEqual([
2260
+ ["task", { action: "create", payload: { title: "Name?", body: "Name?", assignee: "human" } }],
2261
+ ["task", { action: "updateStatus", payload: { taskId: "T-new", status: "ongoing" } }],
2262
+ ["task", {
2263
+ action: "elicit",
2264
+ payload: { taskId: "T-new", message: "Name?", mode: "form", requestedSchema: params.requestedSchema },
2265
+ }],
2266
+ ]);
2267
+ expect(response).toEqual({ action: "decline" });
2268
+ });
2269
+ it.each([
2270
+ ["task (agentrq-0an2BXTfpGj MCP Server)", { action: "reply", payload: { taskId: "task-123", text: "Hello world" } }],
2271
+ ["mcp__agentrq-workspace__task", { action: "reply", payload: { taskId: "task-123", text: "Hello world" } }],
2272
+ ["task (agentrq-0an2BXTfpGj MCP Server)", { action: "reply", taskId: "task-123", text: "Hello world" }],
2273
+ ["mcp__agentrq-workspace__reply", { chatId: "task-123", text: "Hello world" }],
2274
+ ["agentrq-workspace_task", { action: "reply", payload: { taskId: "task-123", text: "Hello world" } }],
2275
+ ])("does not repeat a reply the agent already sent as %s %j", async (title, rawInput) => {
2276
+ mcpBridge.callTool.mockResolvedValue(okResult());
2277
+ const c = new AgentRQACPClient(mcpBridge, () => "task-123");
2278
+ mcpBridge.getAdvertisedTools.mockReturnValue(new Set([...TASK_SERVER, "reply"]));
2279
+ vi.spyOn(process.stdout, "write").mockImplementation(() => true);
2280
+ await c.sessionUpdate({ sessionId: "sess-1", update: { sessionUpdate: "agent_message_chunk", content: { type: "text", text: "Hello world" } } });
2281
+ await c.sessionUpdate({
2282
+ sessionId: "sess-1",
2283
+ update: { sessionUpdate: "tool_call", title, status: "completed", toolCallId: "tc-1", rawInput },
2284
+ });
2285
+ await c.flushReply("sess-1");
2286
+ expect(mcpBridge.callTool).not.toHaveBeenCalled();
2287
+ });
2288
+ it.each([
2289
+ ["another action", { action: "get", payload: { taskId: "task-123" } }],
2290
+ ["no task id", { action: "reply", payload: { text: "Hello world" } }],
2291
+ ["a payload that is not an object", { action: "reply", payload: "Hello world" }],
2292
+ ["no input", undefined],
2293
+ ])("still replies when the agent's task call has %s", async (_case, rawInput) => {
2294
+ mcpBridge.callTool.mockResolvedValue(okResult());
2295
+ const c = new AgentRQACPClient(mcpBridge, () => "task-123");
2296
+ vi.spyOn(process.stdout, "write").mockImplementation(() => true);
2297
+ await c.sessionUpdate({ sessionId: "sess-1", update: { sessionUpdate: "agent_message_chunk", content: { type: "text", text: "Hello world" } } });
2298
+ await c.sessionUpdate({
2299
+ sessionId: "sess-1",
2300
+ update: { sessionUpdate: "tool_call", title: "mcp__agentrq-workspace__task", status: "completed", toolCallId: "tc-1", rawInput },
2301
+ });
2302
+ await c.flushReply("sess-1");
2303
+ expect(mcpBridge.callTool).toHaveBeenCalledWith("task", {
2304
+ action: "reply",
2305
+ payload: { taskId: "task-123", text: "Hello world" },
2306
+ });
2307
+ });
2308
+ it.each([
2309
+ ["mcp__agentrq-workspace__task", { action: "reply", payload: { taskId: "task-123" } }],
2310
+ ["mcp__agentrq-workspace__reply", { chatId: "task-123" }],
2311
+ ])("treats a %s reply with no text as empty, not as the agent's text", async (title, rawInput) => {
2312
+ mcpBridge.getAdvertisedTools.mockReturnValue(new Set([...TASK_SERVER, "reply"]));
2313
+ mcpBridge.callTool.mockResolvedValue(okResult());
2314
+ const c = new AgentRQACPClient(mcpBridge, () => "task-123");
2315
+ vi.spyOn(process.stdout, "write").mockImplementation(() => true);
2316
+ await c.sessionUpdate({ sessionId: "sess-1", update: { sessionUpdate: "agent_message_chunk", content: { type: "text", text: "Hello world" } } });
2317
+ await c.sessionUpdate({
2318
+ sessionId: "sess-1",
2319
+ update: { sessionUpdate: "tool_call", title, status: "completed", toolCallId: "tc-1", rawInput },
2320
+ });
2321
+ await c.flushReply("sess-1");
2322
+ expect(mcpBridge.callTool).toHaveBeenCalledTimes(1);
2323
+ });
2324
+ it("recognises task as the workspace's own when tools/list failed", async () => {
2325
+ mcpBridge.getAdvertisedTools.mockReturnValue(undefined);
2326
+ mcpBridge.callTool.mockResolvedValue(okResult());
2327
+ const c = new AgentRQACPClient(mcpBridge, () => "task-123");
2328
+ vi.spyOn(process.stdout, "write").mockImplementation(() => true);
2329
+ await c.sessionUpdate({ sessionId: "sess-1", update: { sessionUpdate: "agent_message_chunk", content: { type: "text", text: "Hi" } } });
2330
+ await c.sessionUpdate({
2331
+ sessionId: "sess-1",
2332
+ update: {
2333
+ sessionUpdate: "tool_call",
2334
+ title: "mcp__agentrq-workspace__task",
2335
+ status: "completed",
2336
+ toolCallId: "tc-1",
2337
+ rawInput: { action: "reply", payload: { taskId: "task-123", text: "Hi" } },
2338
+ },
2339
+ });
2340
+ await c.flushReply("sess-1");
2341
+ // Were task not on the known list, the call would go unrecognised and the reply repeat.
2342
+ expect(mcpBridge.callTool).not.toHaveBeenCalled();
2343
+ });
2344
+ });
2210
2345
  });
2211
2346
  //# sourceMappingURL=acpClient.test.js.map