@agentrq/acp-gateway 0.2.22 → 0.2.23
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 +2 -7
- package/dist/__tests__/index.test.js +68 -0
- package/dist/__tests__/index.test.js.map +1 -1
- package/dist/index.js +50 -8
- package/dist/index.js.map +1 -1
- package/dist/mcpClient.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
# @agentrq/acp-gateway
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
> [!WARNING]
|
|
6
|
-
> **Pre-Alpha**: This project is in early development. APIs, configurations, and behaviors are subject to change without notice.
|
|
7
|
-
>
|
|
8
|
-
> **Note**: `claude/notifications` is an experimental feature of Claude Code. `@agentrq/acp-gateway` extends this same capability to any `--acp` compatible agent (e.g., Gemini CLI).
|
|
3
|
+
Agent Client Protocol Gateway to remotely access your agents in AgentRQ.
|
|
9
4
|
|
|
10
5
|
## Overview
|
|
11
6
|
|
|
@@ -42,7 +37,7 @@ npm install -g @agentrq/acp-gateway
|
|
|
42
37
|
|
|
43
38
|
## Current Version
|
|
44
39
|
|
|
45
|
-
`0.2.
|
|
40
|
+
`0.2.23`
|
|
46
41
|
|
|
47
42
|
## Usage
|
|
48
43
|
|
|
@@ -1968,6 +1968,7 @@ describe("index", () => {
|
|
|
1968
1968
|
permissionTimeoutMs: 30 * 60_000,
|
|
1969
1969
|
command: "run",
|
|
1970
1970
|
allowUnverifiedAgent: false,
|
|
1971
|
+
json: false,
|
|
1971
1972
|
rest: [],
|
|
1972
1973
|
});
|
|
1973
1974
|
});
|
|
@@ -2361,6 +2362,20 @@ describe("index", () => {
|
|
|
2361
2362
|
logSpy.mockRestore();
|
|
2362
2363
|
expect(fetchImpl).toHaveBeenCalledWith("http://localhost/registry.json");
|
|
2363
2364
|
});
|
|
2365
|
+
it("should print a single JSON line and nothing else when asked for JSON", async () => {
|
|
2366
|
+
const logSpy = vi.spyOn(console, "log").mockImplementation(() => { });
|
|
2367
|
+
const fetchImpl = vi.fn().mockResolvedValue({ ok: true, json: async () => registry });
|
|
2368
|
+
await runListAgents(undefined, fetchImpl, true);
|
|
2369
|
+
// Exactly one console.log call: a caller parsing this as JSON must not
|
|
2370
|
+
// have to reassemble it out of several lines, or filter out the table
|
|
2371
|
+
// this mode exists to replace.
|
|
2372
|
+
const calls = logSpy.mock.calls;
|
|
2373
|
+
logSpy.mockRestore();
|
|
2374
|
+
expect(calls).toHaveLength(1);
|
|
2375
|
+
expect(JSON.parse(calls[0][0])).toEqual({
|
|
2376
|
+
agents: [{ id: "gemini", name: "Gemini CLI", runtimes: ["npx"] }],
|
|
2377
|
+
});
|
|
2378
|
+
});
|
|
2364
2379
|
});
|
|
2365
2380
|
describe("resolveAgentCommand", () => {
|
|
2366
2381
|
const options = (overrides = {}) => ({
|
|
@@ -2368,6 +2383,7 @@ describe("index", () => {
|
|
|
2368
2383
|
permissionTimeoutMs: 30 * 60_000,
|
|
2369
2384
|
command: "run",
|
|
2370
2385
|
allowUnverifiedAgent: false,
|
|
2386
|
+
json: false,
|
|
2371
2387
|
rest: [],
|
|
2372
2388
|
...overrides,
|
|
2373
2389
|
});
|
|
@@ -2494,6 +2510,57 @@ describe("index", () => {
|
|
|
2494
2510
|
expect(printed).toContain("Claude 3.7 Sonnet");
|
|
2495
2511
|
expect(spawnedAgents[0].kill).toHaveBeenCalled();
|
|
2496
2512
|
});
|
|
2513
|
+
it("should print models as a single JSON line when asked for JSON", async () => {
|
|
2514
|
+
mockConnection({
|
|
2515
|
+
newSession: vi.fn().mockResolvedValue({
|
|
2516
|
+
sessionId: "m-sess",
|
|
2517
|
+
configOptions: [
|
|
2518
|
+
{
|
|
2519
|
+
id: "model",
|
|
2520
|
+
name: "Model",
|
|
2521
|
+
type: "select",
|
|
2522
|
+
currentValue: "claude-3-7-sonnet",
|
|
2523
|
+
options: [
|
|
2524
|
+
{
|
|
2525
|
+
value: "claude-3-7-sonnet",
|
|
2526
|
+
name: "Claude 3.7 Sonnet",
|
|
2527
|
+
description: "Balanced",
|
|
2528
|
+
},
|
|
2529
|
+
{ value: "claude-3-5-haiku", name: "Claude 3.5 Haiku" },
|
|
2530
|
+
],
|
|
2531
|
+
},
|
|
2532
|
+
],
|
|
2533
|
+
}),
|
|
2534
|
+
});
|
|
2535
|
+
await runAgentCommand("list-models", ["gemini", "--acp"], agentrqConfig, fakeBridge(), undefined, true);
|
|
2536
|
+
// The most recent call, not the only one: logSpy is shared across this
|
|
2537
|
+
// describe's tests (recreated on the same already-mocked console.log,
|
|
2538
|
+
// which vitest hands back rather than a fresh spy each time), so
|
|
2539
|
+
// earlier tests' output is still in its history. Nothing this call logs
|
|
2540
|
+
// after its own JSON line, so the last entry is always this test's.
|
|
2541
|
+
const lastLog = logSpy.mock.calls.at(-1)?.[0];
|
|
2542
|
+
expect(JSON.parse(lastLog)).toEqual({
|
|
2543
|
+
agent: "gemini --acp",
|
|
2544
|
+
models: [
|
|
2545
|
+
{
|
|
2546
|
+
id: "claude-3-7-sonnet",
|
|
2547
|
+
name: "Claude 3.7 Sonnet",
|
|
2548
|
+
description: "Balanced",
|
|
2549
|
+
current: true,
|
|
2550
|
+
},
|
|
2551
|
+
{ id: "claude-3-5-haiku", name: "Claude 3.5 Haiku", description: "", current: false },
|
|
2552
|
+
],
|
|
2553
|
+
});
|
|
2554
|
+
expect(spawnedAgents[0].kill).toHaveBeenCalled();
|
|
2555
|
+
});
|
|
2556
|
+
it("should report an empty JSON model list rather than the free-text fallback", async () => {
|
|
2557
|
+
mockConnection({
|
|
2558
|
+
newSession: vi.fn().mockResolvedValue({ sessionId: "m-sess", configOptions: [] }),
|
|
2559
|
+
});
|
|
2560
|
+
await runAgentCommand("list-models", ["gemini", "--acp"], agentrqConfig, fakeBridge(), undefined, true);
|
|
2561
|
+
const lastLog = logSpy.mock.calls.at(-1)?.[0];
|
|
2562
|
+
expect(JSON.parse(lastLog)).toEqual({ agent: "gemini --acp", models: [] });
|
|
2563
|
+
});
|
|
2497
2564
|
it("should list models from unstable_listProviders fallback", async () => {
|
|
2498
2565
|
mockConnection({
|
|
2499
2566
|
newSession: vi.fn().mockResolvedValue({ sessionId: "m-sess", configOptions: [] }),
|
|
@@ -2584,6 +2651,7 @@ describe("index", () => {
|
|
|
2584
2651
|
"--allow-unverified-agent",
|
|
2585
2652
|
"--registry-url",
|
|
2586
2653
|
"--list-models",
|
|
2654
|
+
"--json",
|
|
2587
2655
|
"--model",
|
|
2588
2656
|
"--list-auth-methods",
|
|
2589
2657
|
"--login",
|