-
Notifications
You must be signed in to change notification settings - Fork 1
feat: advertise authMethods for ACP registry compatibility #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "id": "zcode-acp-server", | ||
| "name": "ZCode", | ||
| "version": "0.1.0", | ||
| "description": "Standalone ACP server bridging the headless ZCode app-server (GLM-5.2) to editors like Zed and JetBrains. Supports streaming, tool calls, session fork/resume, mode switching, and reads GLM credentials locally — no editor-side API key required.", | ||
| "repository": "https://github.com/william0wang/zcode-acp", | ||
| "website": "https://github.com/william0wang/zcode-acp", | ||
| "authors": ["William Wang"], | ||
| "license": "Apache-2.0", | ||
| "icon": "icon.svg", | ||
| "distribution": { | ||
| "npx": { | ||
| "package": "zcode-acp-server@0.1.0" | ||
| } | ||
| } | ||
| } | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /** | ||
| * server.ts tests — verify the `initialize` response shape, with focus on the | ||
| * ACP registry's authentication validation. | ||
| * | ||
| * The registry CI (verify_agents.py --auth-check) spawns the server with an | ||
| * isolated HOME (no credentials) and asserts that `initialize` returns a | ||
| * non-empty `authMethods` array where at least one method has type "agent" or | ||
| * "terminal" (type omitted defaults to "agent"). An empty array is rejected. | ||
| * https://github.com/agentclientprotocol/registry/blob/main/.github/workflows/client.py | ||
| */ | ||
|
|
||
| import type * as acp from "@agentclientprotocol/sdk"; | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { ZcodeAcpServer } from "../src/server.js"; | ||
|
|
||
| /** Minimal initialize params matching the ACP handshake shape. */ | ||
| function initParams(): acp.InitializeRequest { | ||
| return { | ||
| protocolVersion: 1, | ||
| clientInfo: { name: "test-client", version: "0.0.0" }, | ||
| clientCapabilities: {}, | ||
| } as acp.InitializeRequest; | ||
| } | ||
|
|
||
| describe("ZcodeAcpServer.initialize", () => { | ||
| it("returns protocol version 1 and agent info", async () => { | ||
| const server = new ZcodeAcpServer(); | ||
| const resp = await server.initialize(initParams()); | ||
| expect(resp.protocolVersion).toBe(1); | ||
| expect(resp.agentInfo.name).toBe("zcode-acp-server"); | ||
| }); | ||
|
|
||
| it("advertises loadSession + list/resume/fork session capabilities", async () => { | ||
| const server = new ZcodeAcpServer(); | ||
| const resp = await server.initialize(initParams()); | ||
| expect(resp.agentCapabilities?.loadSession).toBe(true); | ||
| expect(resp.agentCapabilities?.sessionCapabilities?.list).toBeDefined(); | ||
| expect(resp.agentCapabilities?.sessionCapabilities?.resume).toBeDefined(); | ||
| expect(resp.agentCapabilities?.sessionCapabilities?.fork).toBeDefined(); | ||
| }); | ||
|
|
||
| // Registry CI gate: rejects `authMethods: []` with "No authMethods in response". | ||
| it("returns a non-empty authMethods array", async () => { | ||
| const server = new ZcodeAcpServer(); | ||
| const resp = await server.initialize(initParams()); | ||
| expect(resp.authMethods).toBeDefined(); | ||
| expect(resp.authMethods!.length).toBeGreaterThan(0); | ||
| }); | ||
|
|
||
| // Registry CI gate: ≥1 method must be recognisable as agent/terminal type. | ||
| // AuthMethodAgent has no `type` field — omitted defaults to "agent". | ||
| it("advertises at least one agent-type auth method (registry requirement)", async () => { | ||
| const server = new ZcodeAcpServer(); | ||
| const resp = await server.initialize(initParams()); | ||
| const methods = resp.authMethods!.map((m) => { | ||
| const obj = m as { type?: string }; | ||
| return obj.type ?? "agent"; // omitted type defaults to "agent" | ||
| }); | ||
| expect(methods).toContain("agent"); | ||
| }); | ||
|
|
||
| it("the auth method has the required id + name fields", async () => { | ||
| const server = new ZcodeAcpServer(); | ||
| const resp = await server.initialize(initParams()); | ||
| for (const m of resp.authMethods!) { | ||
| const method = m as { id?: string; name?: string }; | ||
| expect(method.id).toBeTruthy(); | ||
| expect(method.name).toBeTruthy(); | ||
| } | ||
| }); | ||
|
|
||
| // The registry CI runs initialize with an empty HOME and no config.json — | ||
| // initialize must NOT eagerly spawn the backend or read credentials. | ||
| it("does not spawn the backend during initialize", async () => { | ||
| const server = new ZcodeAcpServer(); | ||
| await server.initialize(initParams()); | ||
| expect(server.backend).toBeNull(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.