Quickstart
Quickstart
ACP v1 projection for an authorized Shiitake Session
Just want Fungi in Zed or another ACP editor? Run fungi acp — see
Use Fungi in your editor.
Graft is for people embedding ACP in their own host.
This self-contained example initializes an ACP connection without granting access to any Session. Replace the refusing directory with your host’s authorized Session directory before accepting create or load requests.
import * as acp from "@agentclientprotocol/sdk";import { createHttpStream } from "@agentclientprotocol/sdk/experimental/http-client";import { agentAcpMethods, type AuthorizedShiitakeSessionDirectory,} from "@fungi.computer/graft";import { createShiitakeAcpServer } from "@fungi.computer/graft/server";
const directory: AuthorizedShiitakeSessionDirectory = { create() { return Promise.reject(new Error("Session access is not granted")); }, load() { return Promise.reject(new Error("Session access is not granted")); },};const server = createShiitakeAcpServer(directory);const stream = createHttpStream("https://agent.test/acp", { fetch: (input, init) => server.handleRequest(new Request(input, init)),});try { await acp .client({ name: "graft-example" }) .connectWith(stream, async (ctx) => { const initialized = await ctx.request(agentAcpMethods.initialize, { protocolVersion: acp.PROTOCOL_VERSION, }); console.log(initialized.protocolVersion); });} finally { await stream.writable.close(); await server.close();}The fetch adapter calls the server in-process; it makes no network request and
needs no model or credentials. The packed runtime proof in
test/stranger/runtime.mjs exercises this flow on
Node. test/index.test.ts additionally proves Session
creation, prompting and cleanup through the maintained ACP client.