@agentproto/acp 0.1.0-alpha.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 agentproto contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+ import { createDoctype } from '@agentproto/define-doctype';
3
+
4
+ /**
5
+ * @agentproto/acp v0.1.0-alpha
6
+ * AIP-44 ACP.md `defineAcp` reference implementation.
7
+ */
8
+
9
+ var ID_PATTERN = /^[a-z0-9][a-z0-9-]{1,63}$/;
10
+ var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/;
11
+ var TAG_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
12
+ var ACP_REV_PATTERN = /^[a-f0-9]{7,40}$/;
13
+ var transportSchema = z.enum(["stdio", "websocket"]);
14
+ var capabilitiesSchema = z.object({
15
+ client: z.object({
16
+ fs: z.object({
17
+ readTextFile: z.boolean().optional(),
18
+ writeTextFile: z.boolean().optional()
19
+ }).strict().optional(),
20
+ terminal: z.boolean().optional()
21
+ }).strict().optional(),
22
+ agent: z.object({
23
+ loadSession: z.boolean().optional(),
24
+ promptCapabilities: z.object({
25
+ image: z.boolean().optional(),
26
+ audio: z.boolean().optional(),
27
+ embeddedContext: z.boolean().optional()
28
+ }).strict().optional(),
29
+ mcpCapabilities: z.object({
30
+ http: z.boolean().optional(),
31
+ sse: z.boolean().optional()
32
+ }).strict().optional()
33
+ }).strict().optional()
34
+ }).strict().describe(
35
+ "Mirror of upstream ACP `initialize` capabilities. Omitted keys MUST be treated as unsupported."
36
+ );
37
+ var aip44ExtensionsSchema = z.object({
38
+ acp_rev: z.string().regex(ACP_REV_PATTERN).describe(
39
+ "Commit SHA of agentclientprotocol/agent-client-protocol this manifest validates against."
40
+ ),
41
+ tier: z.enum(["basic", "governance-aware", "sandboxed"]).describe(
42
+ "Capability tier shorthand. basic = session/{new,prompt,update}; governance-aware = + loadSession + tool-call streaming; sandboxed = + mcpCapabilities + sandbox profile."
43
+ ),
44
+ capabilities: capabilitiesSchema.optional(),
45
+ operator: z.string().min(1).optional().describe(
46
+ "Workspace-relative ref to AIP-9 OPERATOR.md. REQUIRED when kind=server (cross-field rule in define-acp)."
47
+ ),
48
+ governance: z.string().min(1).optional(),
49
+ sandbox: z.string().min(1).optional().describe("Ref to AIP-36 SANDBOX.md. REQUIRED when tier=sandboxed."),
50
+ audit: z.object({
51
+ ref: z.string().optional(),
52
+ kind: z.enum(["governance", "external", "off"]).optional()
53
+ }).strict().optional(),
54
+ mcp_servers: z.array(
55
+ z.object({
56
+ name: z.string().min(1),
57
+ transport: z.enum(["stdio", "http", "sse"]),
58
+ ref: z.string().optional()
59
+ }).strict()
60
+ ).optional()
61
+ }).loose();
62
+ var acpFrontmatterSchema = z.object({
63
+ name: z.string().min(1).max(80).describe("Kebab id; MUST equal the parent directory name."),
64
+ id: z.string().regex(ID_PATTERN),
65
+ description: z.string().min(1).max(2e3),
66
+ version: z.string().regex(SEMVER_PATTERN),
67
+ kind: z.enum(["client", "server", "bridge"]),
68
+ transport: z.union([
69
+ transportSchema,
70
+ z.array(transportSchema).min(1)
71
+ ]),
72
+ metadata: z.object({ aip44: aip44ExtensionsSchema }).loose().describe(
73
+ "Free-form metadata. metadata.aip44.* hosts AIP-44 extensions; upstream ACP runtimes preserve unknown keys verbatim."
74
+ ),
75
+ tags: z.array(z.string().regex(TAG_PATTERN)).optional()
76
+ }).loose().describe(
77
+ "Validates the YAML frontmatter portion of an AIP-44 ACP.md manifest."
78
+ );
79
+ var defineAcp = createDoctype({
80
+ aip: 44,
81
+ name: "acp",
82
+ readIdentity: (def) => def.id,
83
+ validate(def) {
84
+ const result = acpFrontmatterSchema.safeParse(def);
85
+ if (!result.success) {
86
+ throw new Error(
87
+ `defineAcp (AIP-44): ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
88
+ );
89
+ }
90
+ const aip44 = result.data.metadata.aip44;
91
+ if (result.data.kind === "server" && !aip44.operator) {
92
+ throw new Error(
93
+ "defineAcp (AIP-44): metadata.aip44.operator is required when kind=server"
94
+ );
95
+ }
96
+ if (aip44.tier === "sandboxed" && !aip44.sandbox) {
97
+ throw new Error(
98
+ "defineAcp (AIP-44): metadata.aip44.sandbox is required when metadata.aip44.tier=sandboxed"
99
+ );
100
+ }
101
+ },
102
+ build(def) {
103
+ return { ...def };
104
+ }
105
+ });
106
+
107
+ export { acpFrontmatterSchema, defineAcp };
108
+ //# sourceMappingURL=chunk-5KZCEMZW.mjs.map
109
+ //# sourceMappingURL=chunk-5KZCEMZW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schema.ts","../src/define-acp.ts"],"names":[],"mappings":";;;;;;;;AAsBA,IAAM,UAAA,GAAa,2BAAA;AACnB,IA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,GAAS,oBAAA,CAAqB,SAAA,CAAU,GAAG,CAAA;AACjD,IAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,oBAAA,EAAuB,OAAO,KAAA,CAAM,MAAA,CACjC,IAAI,CAAC,CAAA,KAAM,GAAG,CAAA,CAAE,IAAA,CAAK,KAAK,GAAG,CAAC,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CAC9C,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,OACf;AAAA,IACF;AAEA,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,IAAA,CAAK,QAAA,CAAS,KAAA;AAEnC,IAAA,IAAI,OAAO,IAAA,CAAK,IAAA,KAAS,QAAA,IAAY,CAAC,MAAM,QAAA,EAAU;AACpD,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AAEA,IAAA,IAAI,KAAA,CAAM,IAAA,KAAS,WAAA,IAAe,CAAC,MAAM,OAAA,EAAS;AAChD,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AAAA,EACF,CAAA;AAAA,EACA,MAAM,GAAA,EAAK;AACT,IAAA,OAAO,EAAE,GAAG,GAAA,EAAI;AAAA,EAClB;AACF,CAAC","file":"chunk-5KZCEMZW.mjs","sourcesContent":["/**\n * AIP-44 ACP.md frontmatter zod schema.\n *\n * Mirrors `resources/aip-44/draft/ACP.schema.json` field-for-field.\n * AIP-44 is an agentproto profile of the upstream Agent Client\n * Protocol (agentclientprotocol.com) — the manifest declares an\n * agent or client's role/transport/conformance level, and AIP-44-\n * specific bindings live under `metadata.aip44.*` so plain ACP\n * runtimes preserve them verbatim.\n *\n * Both authoring paths (`define-acp.ts` for TS-authored manifests\n * and `manifest/index.ts` for ACP.md parsing) validate against this\n * schema, so every field-level constraint runs in both paths from a\n * single source of truth.\n *\n * Cross-field rules (tier=sandboxed ⇒ sandbox required) live in\n * `define-acp.ts`'s `validate(def)` body — they're harder to encode\n * in a flat zod schema and want a single error path.\n */\n\nimport { z } from \"zod\"\n\nconst ID_PATTERN = /^[a-z0-9][a-z0-9-]{1,63}$/\nconst SEMVER_PATTERN = /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/\nconst TAG_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/\nconst ACP_REV_PATTERN = /^[a-f0-9]{7,40}$/\n\nconst transportSchema = z.enum([\"stdio\", \"websocket\"])\n\nconst capabilitiesSchema = z\n .object({\n client: z\n .object({\n fs: z\n .object({\n readTextFile: z.boolean().optional(),\n writeTextFile: z.boolean().optional(),\n })\n .strict()\n .optional(),\n terminal: z.boolean().optional(),\n })\n .strict()\n .optional(),\n agent: z\n .object({\n loadSession: z.boolean().optional(),\n promptCapabilities: z\n .object({\n image: z.boolean().optional(),\n audio: z.boolean().optional(),\n embeddedContext: z.boolean().optional(),\n })\n .strict()\n .optional(),\n mcpCapabilities: z\n .object({\n http: z.boolean().optional(),\n sse: z.boolean().optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .describe(\n \"Mirror of upstream ACP `initialize` capabilities. Omitted keys MUST be treated as unsupported.\",\n )\n\nconst aip44ExtensionsSchema = z\n .object({\n acp_rev: z\n .string()\n .regex(ACP_REV_PATTERN)\n .describe(\n \"Commit SHA of agentclientprotocol/agent-client-protocol this manifest validates against.\",\n ),\n tier: z\n .enum([\"basic\", \"governance-aware\", \"sandboxed\"])\n .describe(\n \"Capability tier shorthand. basic = session/{new,prompt,update}; governance-aware = + loadSession + tool-call streaming; sandboxed = + mcpCapabilities + sandbox profile.\",\n ),\n capabilities: capabilitiesSchema.optional(),\n operator: z\n .string()\n .min(1)\n .optional()\n .describe(\n \"Workspace-relative ref to AIP-9 OPERATOR.md. REQUIRED when kind=server (cross-field rule in define-acp).\",\n ),\n governance: z.string().min(1).optional(),\n sandbox: z\n .string()\n .min(1)\n .optional()\n .describe(\"Ref to AIP-36 SANDBOX.md. REQUIRED when tier=sandboxed.\"),\n audit: z\n .object({\n ref: z.string().optional(),\n kind: z.enum([\"governance\", \"external\", \"off\"]).optional(),\n })\n .strict()\n .optional(),\n mcp_servers: z\n .array(\n z\n .object({\n name: z.string().min(1),\n transport: z.enum([\"stdio\", \"http\", \"sse\"]),\n ref: z.string().optional(),\n })\n .strict(),\n )\n .optional(),\n })\n .loose()\n\nexport const acpFrontmatterSchema = z\n .object({\n name: z\n .string()\n .min(1)\n .max(80)\n .describe(\"Kebab id; MUST equal the parent directory name.\"),\n id: z.string().regex(ID_PATTERN),\n description: z.string().min(1).max(2000),\n version: z.string().regex(SEMVER_PATTERN),\n kind: z.enum([\"client\", \"server\", \"bridge\"]),\n transport: z.union([\n transportSchema,\n z.array(transportSchema).min(1),\n ]),\n metadata: z\n .object({ aip44: aip44ExtensionsSchema })\n .loose()\n .describe(\n \"Free-form metadata. metadata.aip44.* hosts AIP-44 extensions; upstream ACP runtimes preserve unknown keys verbatim.\",\n ),\n tags: z.array(z.string().regex(TAG_PATTERN)).optional(),\n })\n .loose()\n .describe(\n \"Validates the YAML frontmatter portion of an AIP-44 ACP.md manifest.\",\n )\n\nexport type AcpFrontmatter = z.infer<typeof acpFrontmatterSchema>\nexport type Aip44Extensions = z.infer<typeof aip44ExtensionsSchema>\nexport type AcpCapabilities = z.infer<typeof capabilitiesSchema>\nexport type AcpRole = AcpFrontmatter[\"kind\"]\nexport type AcpTransport = z.infer<typeof transportSchema>\n","import { createDoctype } from \"@agentproto/define-doctype\"\nimport { acpFrontmatterSchema } from \"./schema.js\"\nimport type { AcpDefinition, AcpHandle } from \"./types.js\"\n\n/**\n * AIP-44 reference implementation of `defineAcp`.\n *\n * Built on `createDoctype` so the cross-AIP invariants (id pattern,\n * description length, top-level freeze, \"defineAcp (AIP-44): …\"\n * error prefix) run uniformly with every other AIP defineX.\n *\n * Field-level validation runs the schema-derived zod from\n * `./schema.ts`. Same source of truth as the .md path uses\n * (`parseAcpManifest`), so a malformed TS-authored definition fails\n * with the same diagnostic as a malformed manifest.\n *\n * Cross-field rules (kind=server requires `metadata.aip44.operator`;\n * tier=sandboxed requires `metadata.aip44.sandbox`) run after the\n * zod check so callers see one consistent error path.\n */\nexport const defineAcp = createDoctype<AcpDefinition, AcpHandle>({\n aip: 44,\n name: \"acp\",\n readIdentity: (def) => def.id,\n validate(def) {\n const result = acpFrontmatterSchema.safeParse(def)\n if (!result.success) {\n throw new Error(\n `defineAcp (AIP-44): ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n\n const aip44 = result.data.metadata.aip44\n\n if (result.data.kind === \"server\" && !aip44.operator) {\n throw new Error(\n \"defineAcp (AIP-44): metadata.aip44.operator is required when kind=server\",\n )\n }\n\n if (aip44.tier === \"sandboxed\" && !aip44.sandbox) {\n throw new Error(\n \"defineAcp (AIP-44): metadata.aip44.sandbox is required when metadata.aip44.tier=sandboxed\",\n )\n }\n },\n build(def) {\n return { ...def } as AcpHandle\n },\n})\n"]}
@@ -0,0 +1,76 @@
1
+ import { ClientSideConnection, Client } from '@agentclientprotocol/sdk';
2
+ import { S as StreamEvent } from '../types-BPyht7LH.js';
3
+
4
+ /**
5
+ * AIP-44 ACP client — drives a subprocess agent via stdio JSON-RPC.
6
+ *
7
+ * Wraps `@agentclientprotocol/sdk`'s `ClientSideConnection`. Owns the
8
+ * connection lifecycle, runs `initialize` on construction, and exposes
9
+ * a session API where each `prompt()` call returns an
10
+ * `AsyncIterable<StreamEvent>` fed by the SDK's `session/update`
11
+ * notification handler.
12
+ */
13
+
14
+ interface AcpClientOptions {
15
+ /** Output bytes go here (subprocess stdin). */
16
+ output: WritableStream<Uint8Array>;
17
+ /** Input bytes come from here (subprocess stdout). */
18
+ input: ReadableStream<Uint8Array>;
19
+ /** Client identity advertised during `initialize`. */
20
+ clientInfo?: {
21
+ name: string;
22
+ title?: string;
23
+ version?: string;
24
+ };
25
+ /** Client capabilities advertised during `initialize`. */
26
+ capabilities?: {
27
+ fs?: {
28
+ readTextFile?: boolean;
29
+ writeTextFile?: boolean;
30
+ };
31
+ terminal?: boolean;
32
+ };
33
+ /** Optional handlers for agent-initiated requests beyond fs / terminal. */
34
+ handlers?: Partial<Client>;
35
+ /** Protocol version to negotiate. Defaults to the SDK's current. */
36
+ protocolVersion?: number;
37
+ }
38
+ interface AcpClient {
39
+ readonly connection: ClientSideConnection;
40
+ /** Negotiated agent capabilities returned from `initialize`. */
41
+ readonly agentCapabilities: Record<string, unknown> | undefined;
42
+ newSession(params: {
43
+ cwd: string;
44
+ mcpServers?: unknown[];
45
+ }): Promise<AcpClientSession>;
46
+ /**
47
+ * Reattach to an existing session by id. Available only when the
48
+ * agent advertised `loadSession: true` in its capabilities (callers
49
+ * should check `agentCapabilities` first; we forward the SDK error
50
+ * verbatim if they don't).
51
+ *
52
+ * Drives the AIP-45 native-resume continuation strategy: the host
53
+ * persists the `sessionId` returned by `newSession`, then on a
54
+ * cold start (process restart, fresh sandbox, different machine)
55
+ * spawns a new subprocess and calls `loadSession` to pick up
56
+ * the conversation from the stored history.
57
+ */
58
+ loadSession(params: {
59
+ sessionId: string;
60
+ cwd: string;
61
+ mcpServers?: unknown[];
62
+ }): Promise<AcpClientSession>;
63
+ close(): Promise<void>;
64
+ }
65
+ interface AcpClientSession {
66
+ readonly sessionId: string;
67
+ prompt(input: {
68
+ messages: unknown[];
69
+ signal?: AbortSignal;
70
+ }): AsyncIterable<StreamEvent>;
71
+ cancel(): Promise<void>;
72
+ close(): Promise<void>;
73
+ }
74
+ declare function createAcpClient(options: AcpClientOptions): Promise<AcpClient>;
75
+
76
+ export { type AcpClient, type AcpClientOptions, type AcpClientSession, createAcpClient };
@@ -0,0 +1,248 @@
1
+ import { ndJsonStream, ClientSideConnection } from '@agentclientprotocol/sdk';
2
+
3
+ /**
4
+ * @agentproto/acp v0.1.0-alpha
5
+ * AIP-44 ACP.md `defineAcp` reference implementation.
6
+ */
7
+
8
+ var PROTOCOL_VERSION_DEFAULT = 1;
9
+ async function createAcpClient(options) {
10
+ const sessions = /* @__PURE__ */ new Map();
11
+ const stream = ndJsonStream(options.output, options.input);
12
+ const connection = new ClientSideConnection(
13
+ () => buildClientHandlers(options.handlers ?? {}, sessions),
14
+ stream
15
+ );
16
+ const initResponse = await connection.initialize({
17
+ protocolVersion: options.protocolVersion ?? PROTOCOL_VERSION_DEFAULT,
18
+ clientCapabilities: clientCapabilitiesFromOptions(options),
19
+ clientInfo: options.clientInfo ? {
20
+ name: options.clientInfo.name,
21
+ title: options.clientInfo.title ?? options.clientInfo.name,
22
+ version: options.clientInfo.version ?? "0.0.0"
23
+ } : void 0
24
+ });
25
+ return {
26
+ connection,
27
+ agentCapabilities: initResponse.agentCapabilities,
28
+ async newSession(params) {
29
+ const response = await connection.newSession({
30
+ cwd: params.cwd,
31
+ mcpServers: params.mcpServers ?? []
32
+ });
33
+ const sessionId = response.sessionId;
34
+ const state = {
35
+ events: [],
36
+ resolveNext: null,
37
+ done: false,
38
+ active: false
39
+ };
40
+ sessions.set(sessionId, state);
41
+ return buildSession(connection, sessionId, state, sessions);
42
+ },
43
+ async loadSession(params) {
44
+ await connection.loadSession({
45
+ sessionId: params.sessionId,
46
+ cwd: params.cwd,
47
+ mcpServers: params.mcpServers ?? []
48
+ });
49
+ const state = {
50
+ events: [],
51
+ resolveNext: null,
52
+ done: false,
53
+ active: false
54
+ };
55
+ sessions.set(params.sessionId, state);
56
+ return buildSession(connection, params.sessionId, state, sessions);
57
+ },
58
+ async close() {
59
+ sessions.clear();
60
+ }
61
+ };
62
+ }
63
+ function clientCapabilitiesFromOptions(options) {
64
+ const caps = options.capabilities ?? {};
65
+ return {
66
+ fs: {
67
+ readTextFile: caps.fs?.readTextFile ?? false,
68
+ writeTextFile: caps.fs?.writeTextFile ?? false
69
+ },
70
+ terminal: caps.terminal ?? false
71
+ };
72
+ }
73
+ function buildSession(connection, sessionId, state, sessions) {
74
+ return {
75
+ sessionId,
76
+ prompt(input) {
77
+ if (state.active) {
78
+ throw new Error(
79
+ `AcpClientSession.prompt: session ${sessionId} already has an in-flight prompt`
80
+ );
81
+ }
82
+ state.active = true;
83
+ state.done = false;
84
+ state.events.length = 0;
85
+ const iter = makeIterator(state);
86
+ connection.prompt({
87
+ sessionId,
88
+ prompt: input.messages
89
+ }).then((response) => {
90
+ enqueue(state, {
91
+ kind: "turn-end",
92
+ sessionId,
93
+ reason: response.stopReason === "cancelled" && "cancelled" || response.stopReason === "max_turns" && "max_turns" || "completed"
94
+ });
95
+ }).catch((err) => {
96
+ const message = err instanceof Error ? err.message : String(err);
97
+ enqueue(state, {
98
+ kind: "error",
99
+ sessionId,
100
+ error: { message }
101
+ });
102
+ }).finally(() => {
103
+ state.active = false;
104
+ state.done = true;
105
+ flush(state);
106
+ });
107
+ if (input.signal) {
108
+ input.signal.addEventListener(
109
+ "abort",
110
+ () => {
111
+ void connection.cancel({ sessionId });
112
+ },
113
+ { once: true }
114
+ );
115
+ }
116
+ return iter;
117
+ },
118
+ async cancel() {
119
+ if (!state.active) return;
120
+ await connection.cancel({ sessionId });
121
+ },
122
+ async close() {
123
+ sessions.delete(sessionId);
124
+ }
125
+ };
126
+ }
127
+ function makeIterator(state) {
128
+ return {
129
+ [Symbol.asyncIterator]() {
130
+ return {
131
+ async next() {
132
+ if (state.events.length > 0) {
133
+ const value2 = state.events.shift();
134
+ return { value: value2, done: false };
135
+ }
136
+ if (state.done) return { value: void 0, done: true };
137
+ const value = await new Promise(
138
+ (resolve) => {
139
+ state.resolveNext = resolve;
140
+ }
141
+ );
142
+ if (value === void 0) return { value: void 0, done: true };
143
+ return { value, done: false };
144
+ }
145
+ };
146
+ }
147
+ };
148
+ }
149
+ function enqueue(state, event) {
150
+ if (state.resolveNext) {
151
+ const r = state.resolveNext;
152
+ state.resolveNext = null;
153
+ r(event);
154
+ return;
155
+ }
156
+ state.events.push(event);
157
+ }
158
+ function flush(state) {
159
+ if (state.resolveNext) {
160
+ const r = state.resolveNext;
161
+ state.resolveNext = null;
162
+ r(void 0);
163
+ }
164
+ }
165
+ function buildClientHandlers(partial, sessions) {
166
+ return {
167
+ async sessionUpdate(params) {
168
+ const sid = params.sessionId;
169
+ if (!sid) return;
170
+ const state = sessions.get(sid);
171
+ if (!state) return;
172
+ const update = params.update;
173
+ if (!update) return;
174
+ const event = translateSessionUpdate(sid, update);
175
+ if (event) enqueue(state, event);
176
+ if (partial.sessionUpdate) await partial.sessionUpdate(params);
177
+ },
178
+ async requestPermission(params) {
179
+ if (partial.requestPermission) return partial.requestPermission(params);
180
+ throw new Error("AcpClient.requestPermission: no handler configured");
181
+ },
182
+ async readTextFile(params) {
183
+ if (partial.readTextFile) return partial.readTextFile(params);
184
+ throw new Error("AcpClient.readTextFile: capability not advertised");
185
+ },
186
+ async writeTextFile(params) {
187
+ if (partial.writeTextFile) return partial.writeTextFile(params);
188
+ throw new Error("AcpClient.writeTextFile: capability not advertised");
189
+ },
190
+ ...partial
191
+ };
192
+ }
193
+ function translateSessionUpdate(sessionId, update) {
194
+ switch (update.sessionUpdate) {
195
+ case "agent_message_chunk":
196
+ return {
197
+ kind: "text-delta",
198
+ sessionId,
199
+ text: extractText(update.content)
200
+ };
201
+ case "agent_thought_chunk":
202
+ return {
203
+ kind: "thought",
204
+ sessionId,
205
+ text: extractText(update.content)
206
+ };
207
+ case "tool_call": {
208
+ const toolCallId = update.toolCallId ?? "";
209
+ return {
210
+ kind: "tool-call",
211
+ sessionId,
212
+ toolCallId,
213
+ toolName: update.kind ?? update.title ?? "tool",
214
+ arguments: update.rawInput ?? update.content ?? {}
215
+ };
216
+ }
217
+ case "tool_call_update": {
218
+ const status = update.status;
219
+ if (status === "completed" || status === "failed") {
220
+ return {
221
+ kind: "tool-result",
222
+ sessionId,
223
+ toolCallId: update.toolCallId ?? "",
224
+ result: update.rawOutput ?? update.content ?? null,
225
+ isError: status === "failed"
226
+ };
227
+ }
228
+ return null;
229
+ }
230
+ case "user_message_chunk":
231
+ return null;
232
+ default:
233
+ return null;
234
+ }
235
+ }
236
+ function extractText(content) {
237
+ if (!content) return "";
238
+ if (typeof content === "string") return content;
239
+ if (typeof content === "object" && content !== null) {
240
+ const c = content;
241
+ if (c.type === "text" && typeof c.text === "string") return c.text;
242
+ }
243
+ return "";
244
+ }
245
+
246
+ export { createAcpClient };
247
+ //# sourceMappingURL=index.mjs.map
248
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/index.ts"],"names":["value"],"mappings":";;;;;;;AAkBA,IAAM,wBAAA,GAA2B,CAAA;AAqEjC,eAAsB,gBACpB,OAAA,EACoB;AACpB,EAAA,MAAM,QAAA,uBAAe,GAAA,EAA0B;AAE/C,EAAA,MAAM,MAAA,GAAiB,YAAA,CAAa,OAAA,CAAQ,MAAA,EAAQ,QAAQ,KAAK,CAAA;AAEjE,EAAA,MAAM,aAAmC,IAAI,oBAAA;AAAA,IAC3C,MAAM,mBAAA,CAAoB,OAAA,CAAQ,QAAA,IAAY,IAAI,QAAQ,CAAA;AAAA,IAC1D;AAAA,GACF;AAEA,EAAA,MAAM,YAAA,GAAe,MAAM,UAAA,CAAW,UAAA,CAAW;AAAA,IAC/C,eAAA,EAAiB,QAAQ,eAAA,IAAmB,wBAAA;AAAA,IAC5C,kBAAA,EAAoB,8BAA8B,OAAO,CAAA;AAAA,IACzD,UAAA,EAAY,QAAQ,UAAA,GAChB;AAAA,MACE,IAAA,EAAM,QAAQ,UAAA,CAAW,IAAA;AAAA,MACzB,KAAA,EAAO,OAAA,CAAQ,UAAA,CAAW,KAAA,IAAS,QAAQ,UAAA,CAAW,IAAA;AAAA,MACtD,OAAA,EAAS,OAAA,CAAQ,UAAA,CAAW,OAAA,IAAW;AAAA,KACzC,GACA;AAAA,GACI,CAAA;AAEV,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,mBAAoB,YAAA,CACjB,iBAAA;AAAA,IACH,MAAM,WAAW,MAAA,EAAQ;AAC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JSON-RPC.\n *\n * Wraps `@agentclientprotocol/sdk`'s `ClientSideConnection`. Owns the\n * connection lifecycle, runs `initialize` on construction, and exposes\n * a session API where each `prompt()` call returns an\n * `AsyncIterable<StreamEvent>` fed by the SDK's `session/update`\n * notification handler.\n */\n\nimport {\n ClientSideConnection,\n ndJsonStream,\n type Client as AcpClientHandlers,\n type Stream,\n} from \"@agentclientprotocol/sdk\"\nimport type { StreamEvent } from \"../types.js\"\n\nconst PROTOCOL_VERSION_DEFAULT = 1\n\nexport interface AcpClientOptions {\n /** Output bytes go here (subprocess stdin). */\n output: WritableStream<Uint8Array>\n /** Input bytes come from here (subprocess stdout). */\n input: ReadableStream<Uint8Array>\n /** Client identity advertised during `initialize`. */\n clientInfo?: {\n name: string\n title?: string\n version?: string\n }\n /** Client capabilities advertised during `initialize`. */\n capabilities?: {\n fs?: { readTextFile?: boolean; writeTextFile?: boolean }\n terminal?: boolean\n }\n /** Optional handlers for agent-initiated requests beyond fs / terminal. */\n handlers?: Partial<AcpClientHandlers>\n /** Protocol version to negotiate. Defaults to the SDK's current. */\n protocolVersion?: number\n}\n\nexport interface AcpClient {\n readonly connection: ClientSideConnection\n /** Negotiated agent capabilities returned from `initialize`. */\n readonly agentCapabilities: Record<string, unknown> | undefined\n newSession(params: {\n cwd: string\n mcpServers?: unknown[]\n }): Promise<AcpClientSession>\n /**\n * Reattach to an existing session by id. Available only when the\n * agent advertised `loadSession: true` in its capabilities (callers\n * should check `agentCapabilities` first; we forward the SDK error\n * verbatim if they don't).\n *\n * Drives the AIP-45 native-resume continuation strategy: the host\n * persists the `sessionId` returned by `newSession`, then on a\n * cold start (process restart, fresh sandbox, different machine)\n * spawns a new subprocess and calls `loadSession` to pick up\n * the conversation from the stored history.\n */\n loadSession(params: {\n sessionId: string\n cwd: string\n mcpServers?: unknown[]\n }): Promise<AcpClientSession>\n close(): Promise<void>\n}\n\nexport interface AcpClientSession {\n readonly sessionId: string\n prompt(input: {\n messages: unknown[]\n signal?: AbortSignal\n }): AsyncIterable<StreamEvent>\n cancel(): Promise<void>\n close(): Promise<void>\n}\n\ninterface SessionState {\n events: StreamEvent[]\n resolveNext: ((evt: StreamEvent | undefined) => void) | null\n done: boolean\n active: boolean\n}\n\nexport async function createAcpClient(\n options: AcpClientOptions,\n): Promise<AcpClient> {\n const sessions = new Map<string, SessionState>()\n\n const stream: Stream = ndJsonStream(options.output, options.input)\n\n const connection: ClientSideConnection = new ClientSideConnection(\n () => buildClientHandlers(options.handlers ?? {}, sessions),\n stream,\n )\n\n const initResponse = await connection.initialize({\n protocolVersion: options.protocolVersion ?? PROTOCOL_VERSION_DEFAULT,\n clientCapabilities: clientCapabilitiesFromOptions(options),\n clientInfo: options.clientInfo\n ? {\n name: options.clientInfo.name,\n title: options.clientInfo.title ?? options.clientInfo.name,\n version: options.clientInfo.version ?? \"0.0.0\",\n }\n : undefined,\n } as never)\n\n return {\n connection,\n agentCapabilities: (initResponse as { agentCapabilities?: Record<string, unknown> })\n .agentCapabilities,\n async newSession(params) {\n const response = await connection.newSession({\n cwd: params.cwd,\n mcpServers: (params.mcpServers ?? []) as never,\n } as never)\n const sessionId = (response as { sessionId: string }).sessionId\n const state: SessionState = {\n events: [],\n resolveNext: null,\n done: false,\n active: false,\n }\n sessions.set(sessionId, state)\n return buildSession(connection, sessionId, state, sessions)\n },\n async loadSession(params) {\n // SDK returns `LoadSessionResponse` (no body fields we need); the\n // sessionId is what the caller already provided. We register a\n // fresh `SessionState` so subsequent `prompt` calls have a slot\n // to flush events into — same lifecycle shape as a brand-new\n // session.\n await connection.loadSession({\n sessionId: params.sessionId,\n cwd: params.cwd,\n mcpServers: (params.mcpServers ?? []) as never,\n } as never)\n const state: SessionState = {\n events: [],\n resolveNext: null,\n done: false,\n active: false,\n }\n sessions.set(params.sessionId, state)\n return buildSession(connection, params.sessionId, state, sessions)\n },\n async close() {\n sessions.clear()\n },\n }\n}\n\nfunction clientCapabilitiesFromOptions(\n options: AcpClientOptions,\n): Record<string, unknown> {\n const caps = options.capabilities ?? {}\n return {\n fs: {\n readTextFile: caps.fs?.readTextFile ?? false,\n writeTextFile: caps.fs?.writeTextFile ?? false,\n },\n terminal: caps.terminal ?? false,\n }\n}\n\nfunction buildSession(\n connection: ClientSideConnection,\n sessionId: string,\n state: SessionState,\n sessions: Map<string, SessionState>,\n): AcpClientSession {\n return {\n sessionId,\n prompt(input) {\n if (state.active) {\n throw new Error(\n `AcpClientSession.prompt: session ${sessionId} already has an in-flight prompt`,\n )\n }\n state.active = true\n state.done = false\n state.events.length = 0\n\n const iter = makeIterator(state)\n\n const promise = connection\n .prompt({\n sessionId,\n prompt: input.messages as never,\n } as never)\n .then((response) => {\n enqueue(state, {\n kind: \"turn-end\",\n sessionId,\n reason:\n ((response as { stopReason?: string }).stopReason ===\n \"cancelled\" && \"cancelled\") ||\n ((response as { stopReason?: string }).stopReason ===\n \"max_turns\" && \"max_turns\") ||\n \"completed\",\n })\n })\n .catch((err: unknown) => {\n const message =\n err instanceof Error ? err.message : String(err)\n enqueue(state, {\n kind: \"error\",\n sessionId,\n error: { message },\n })\n })\n .finally(() => {\n state.active = false\n state.done = true\n flush(state)\n })\n\n if (input.signal) {\n input.signal.addEventListener(\n \"abort\",\n () => {\n void connection.cancel({ sessionId } as never)\n },\n { once: true },\n )\n }\n\n void promise\n return iter\n },\n async cancel() {\n if (!state.active) return\n await connection.cancel({ sessionId } as never)\n },\n async close() {\n sessions.delete(sessionId)\n },\n }\n}\n\nfunction makeIterator(state: SessionState): AsyncIterable<StreamEvent> {\n return {\n [Symbol.asyncIterator]() {\n return {\n async next() {\n if (state.events.length > 0) {\n const value = state.events.shift() as StreamEvent\n return { value, done: false }\n }\n if (state.done) return { value: undefined, done: true }\n const value = await new Promise<StreamEvent | undefined>(\n (resolve) => {\n state.resolveNext = resolve\n },\n )\n if (value === undefined) return { value: undefined, done: true }\n return { value, done: false }\n },\n }\n },\n }\n}\n\nfunction enqueue(state: SessionState, event: StreamEvent) {\n if (state.resolveNext) {\n const r = state.resolveNext\n state.resolveNext = null\n r(event)\n return\n }\n state.events.push(event)\n}\n\nfunction flush(state: SessionState) {\n if (state.resolveNext) {\n const r = state.resolveNext\n state.resolveNext = null\n r(undefined)\n }\n}\n\nfunction buildClientHandlers(\n partial: Partial<AcpClientHandlers>,\n sessions: Map<string, SessionState>,\n): AcpClientHandlers {\n return {\n async sessionUpdate(params) {\n const sid = (params as { sessionId?: string }).sessionId\n if (!sid) return\n const state = sessions.get(sid)\n if (!state) return\n\n const update = (params as { update?: Record<string, unknown> }).update\n if (!update) return\n const event = translateSessionUpdate(sid, update)\n if (event) enqueue(state, event)\n\n if (partial.sessionUpdate) await partial.sessionUpdate(params)\n },\n async requestPermission(params) {\n if (partial.requestPermission) return partial.requestPermission(params)\n throw new Error(\"AcpClient.requestPermission: no handler configured\")\n },\n async readTextFile(params) {\n if (partial.readTextFile) return partial.readTextFile(params)\n throw new Error(\"AcpClient.readTextFile: capability not advertised\")\n },\n async writeTextFile(params) {\n if (partial.writeTextFile) return partial.writeTextFile(params)\n throw new Error(\"AcpClient.writeTextFile: capability not advertised\")\n },\n ...(partial as object),\n } as AcpClientHandlers\n}\n\nfunction translateSessionUpdate(\n sessionId: string,\n update: Record<string, unknown>,\n): StreamEvent | null {\n switch (update.sessionUpdate) {\n case \"agent_message_chunk\":\n return {\n kind: \"text-delta\",\n sessionId,\n text: extractText(update.content),\n }\n case \"agent_thought_chunk\":\n return {\n kind: \"thought\",\n sessionId,\n text: extractText(update.content),\n }\n case \"tool_call\": {\n const toolCallId = (update.toolCallId as string) ?? \"\"\n return {\n kind: \"tool-call\",\n sessionId,\n toolCallId,\n toolName: (update.kind as string) ?? (update.title as string) ?? \"tool\",\n arguments: update.rawInput ?? update.content ?? {},\n }\n }\n case \"tool_call_update\": {\n const status = update.status as string | undefined\n if (status === \"completed\" || status === \"failed\") {\n return {\n kind: \"tool-result\",\n sessionId,\n toolCallId: (update.toolCallId as string) ?? \"\",\n result: update.rawOutput ?? update.content ?? null,\n isError: status === \"failed\",\n }\n }\n return null\n }\n case \"user_message_chunk\":\n return null\n default:\n return null\n }\n}\n\nfunction extractText(content: unknown): string {\n if (!content) return \"\"\n if (typeof content === \"string\") return content\n if (typeof content === \"object\" && content !== null) {\n const c = content as { type?: string; text?: string }\n if (c.type === \"text\" && typeof c.text === \"string\") return c.text\n }\n return \"\"\n}\n"]}
@@ -0,0 +1,42 @@
1
+ import { A as AcpDefinition } from './types-BPyht7LH.js';
2
+ export { a as AcpAuditConfig, b as AcpCapabilities, c as AcpHandle, d as AcpMcpServer, e as AcpRole, f as AcpTier, g as AcpTransport, h as Aip44Extensions, S as StreamEvent } from './types-BPyht7LH.js';
3
+ export { A as AcpFrontmatter, a as Aip44ExtensionsSchema, b as acpFrontmatterSchema } from './schema-CxWMGVy0.js';
4
+ import 'zod';
5
+
6
+ /**
7
+ * AIP-44 reference implementation of `defineAcp`.
8
+ *
9
+ * Built on `createDoctype` so the cross-AIP invariants (id pattern,
10
+ * description length, top-level freeze, "defineAcp (AIP-44): …"
11
+ * error prefix) run uniformly with every other AIP defineX.
12
+ *
13
+ * Field-level validation runs the schema-derived zod from
14
+ * `./schema.ts`. Same source of truth as the .md path uses
15
+ * (`parseAcpManifest`), so a malformed TS-authored definition fails
16
+ * with the same diagnostic as a malformed manifest.
17
+ *
18
+ * Cross-field rules (kind=server requires `metadata.aip44.operator`;
19
+ * tier=sandboxed requires `metadata.aip44.sandbox`) run after the
20
+ * zod check so callers see one consistent error path.
21
+ */
22
+ declare const defineAcp: (def: AcpDefinition) => Readonly<AcpDefinition>;
23
+
24
+ /**
25
+ * @agentproto/acp — AIP-44 ACP.md `defineAcp` reference impl + thin
26
+ * wrappers around the upstream Agent Client Protocol SDK.
27
+ *
28
+ * Spec: https://agentproto.sh/docs/aip-44
29
+ * Upstream protocol: https://agentclientprotocol.com/
30
+ *
31
+ * Authoring paths:
32
+ * - TS: `defineAcp({...})` → `AcpHandle`
33
+ * - MD: `parseAcpManifest(src) → acpFromManifest({...})` → `AcpHandle`
34
+ *
35
+ * Runtime paths:
36
+ * - Drive a subprocess agent: `createAcpClient({ output, input, ... })`
37
+ * - Expose an operator as a server: `createAcpServer({ handle, ... })`
38
+ */
39
+ declare const SPEC_NAME: "agentacp/v1";
40
+ declare const SPEC_VERSION: "0.1.0-alpha";
41
+
42
+ export { AcpDefinition, SPEC_NAME, SPEC_VERSION, defineAcp };
package/dist/index.mjs ADDED
@@ -0,0 +1,14 @@
1
+ export { acpFrontmatterSchema, defineAcp } from './chunk-5KZCEMZW.mjs';
2
+
3
+ /**
4
+ * @agentproto/acp v0.1.0-alpha
5
+ * AIP-44 ACP.md `defineAcp` reference implementation.
6
+ */
7
+
8
+ // src/index.ts
9
+ var SPEC_NAME = "agentacp/v1";
10
+ var SPEC_VERSION = "0.1.0-alpha";
11
+
12
+ export { SPEC_NAME, SPEC_VERSION };
13
+ //# sourceMappingURL=index.mjs.map
14
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAgBO,IAAM,SAAA,GAAY;AAClB,IAAM,YAAA,GAAe","file":"index.mjs","sourcesContent":["/**\n * @agentproto/acp — AIP-44 ACP.md `defineAcp` reference impl + thin\n * wrappers around the upstream Agent Client Protocol SDK.\n *\n * Spec: https://agentproto.sh/docs/aip-44\n * Upstream protocol: https://agentclientprotocol.com/\n *\n * Authoring paths:\n * - TS: `defineAcp({...})` → `AcpHandle`\n * - MD: `parseAcpManifest(src) → acpFromManifest({...})` → `AcpHandle`\n *\n * Runtime paths:\n * - Drive a subprocess agent: `createAcpClient({ output, input, ... })`\n * - Expose an operator as a server: `createAcpServer({ handle, ... })`\n */\n\nexport const SPEC_NAME = \"agentacp/v1\" as const\nexport const SPEC_VERSION = \"0.1.0-alpha\" as const\n\nexport { defineAcp } from \"./define-acp.js\"\nexport {\n acpFrontmatterSchema,\n type AcpFrontmatter,\n type Aip44Extensions as Aip44ExtensionsSchema,\n} from \"./schema.js\"\nexport type {\n AcpDefinition,\n AcpHandle,\n AcpRole,\n AcpTransport,\n AcpTier,\n AcpCapabilities,\n AcpAuditConfig,\n AcpMcpServer,\n Aip44Extensions,\n StreamEvent,\n} from \"./types.js\"\n"]}
@@ -0,0 +1,22 @@
1
+ import { A as AcpFrontmatter } from '../schema-CxWMGVy0.js';
2
+ export { b as acpFrontmatterSchema } from '../schema-CxWMGVy0.js';
3
+ import { c as AcpHandle } from '../types-BPyht7LH.js';
4
+ import 'zod';
5
+
6
+ /**
7
+ * AIP-44 ACP.md sidecar parser + manifest-to-handle constructor.
8
+ *
9
+ * Mirror of `@agentproto/skill/manifest`: the .md provides metadata;
10
+ * the TS module supplies any runtime bits the manifest can't carry.
11
+ * Both inputs end up in `defineAcp` so the cross-AIP invariants run
12
+ * uniformly.
13
+ */
14
+
15
+ interface AcpManifest {
16
+ frontmatter: AcpFrontmatter;
17
+ body: string;
18
+ }
19
+ declare function parseAcpManifest(source: string): AcpManifest;
20
+ declare function acpFromManifest(manifest: AcpManifest): AcpHandle;
21
+
22
+ export { AcpFrontmatter, type AcpManifest, acpFromManifest, parseAcpManifest };
@@ -0,0 +1,28 @@
1
+ import { acpFrontmatterSchema, defineAcp } from '../chunk-5KZCEMZW.mjs';
2
+ export { acpFrontmatterSchema } from '../chunk-5KZCEMZW.mjs';
3
+ import matter from 'gray-matter';
4
+
5
+ /**
6
+ * @agentproto/acp v0.1.0-alpha
7
+ * AIP-44 ACP.md `defineAcp` reference implementation.
8
+ */
9
+ function parseAcpManifest(source) {
10
+ const parsed = matter(source);
11
+ if (Object.keys(parsed.data).length === 0) {
12
+ throw new Error("parseAcpManifest: missing or empty frontmatter");
13
+ }
14
+ const result = acpFrontmatterSchema.safeParse(parsed.data);
15
+ if (!result.success) {
16
+ throw new Error(
17
+ `parseAcpManifest: invalid frontmatter \u2014 ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
18
+ );
19
+ }
20
+ return { frontmatter: result.data, body: parsed.content };
21
+ }
22
+ function acpFromManifest(manifest) {
23
+ return defineAcp(manifest.frontmatter);
24
+ }
25
+
26
+ export { acpFromManifest, parseAcpManifest };
27
+ //# sourceMappingURL=index.mjs.map
28
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/manifest/index.ts"],"names":[],"mappings":";;;;;;;;AAqBO,SAAS,iBAAiB,MAAA,EAA6B;AAC5D,EAAA,MAAM,MAAA,GAAS,OAAO,MAAM,CAAA;AAC5B,EAAA,IAAI,OAAO,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA,CAAE,WAAW,CAAA,EAAG;AACzC,IAAA,MAAM,IAAI,MAAM,gDAAgD,CAAA;AAAA,EAClE;AACA,EAAA,MAAM,MAAA,GAAS,oBAAA,CAAqB,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA;AACzD,EAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,6CAAA,EAA2C,OAAO,KAAA,CAAM,MAAA,CACrD,IAAI,CAAC,CAAA,KAAM,GAAG,CAAA,CAAE,IAAA,CAAK,KAAK,GAAG,CAAC,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CAC9C,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,KACf;AAAA,EACF;AACA,EAAA,OAAO,EAAE,WAAA,EAAa,MAAA,CAAO,IAAA,EAAM,IAAA,EAAM,OAAO,OAAA,EAAQ;AAC1D;AAEO,SAAS,gBAAgB,QAAA,EAAkC;AAChE,EAAA,OAAO,SAAA,CAAU,SAAS,WAAuC,CAAA;AACnE","file":"index.mjs","sourcesContent":["/**\n * AIP-44 ACP.md sidecar parser + manifest-to-handle constructor.\n *\n * Mirror of `@agentproto/skill/manifest`: the .md provides metadata;\n * the TS module supplies any runtime bits the manifest can't carry.\n * Both inputs end up in `defineAcp` so the cross-AIP invariants run\n * uniformly.\n */\n\nimport matter from \"gray-matter\"\nimport { acpFrontmatterSchema, type AcpFrontmatter } from \"../schema.js\"\nimport { defineAcp } from \"../define-acp.js\"\nimport type { AcpDefinition, AcpHandle } from \"../types.js\"\n\nexport { acpFrontmatterSchema, type AcpFrontmatter }\n\nexport interface AcpManifest {\n frontmatter: AcpFrontmatter\n body: string\n}\n\nexport function parseAcpManifest(source: string): AcpManifest {\n const parsed = matter(source)\n if (Object.keys(parsed.data).length === 0) {\n throw new Error(\"parseAcpManifest: missing or empty frontmatter\")\n }\n const result = acpFrontmatterSchema.safeParse(parsed.data)\n if (!result.success) {\n throw new Error(\n `parseAcpManifest: invalid frontmatter — ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n return { frontmatter: result.data, body: parsed.content }\n}\n\nexport function acpFromManifest(manifest: AcpManifest): AcpHandle {\n return defineAcp(manifest.frontmatter as unknown as AcpDefinition)\n}\n"]}
@@ -0,0 +1,145 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * AIP-44 ACP.md frontmatter zod schema.
5
+ *
6
+ * Mirrors `resources/aip-44/draft/ACP.schema.json` field-for-field.
7
+ * AIP-44 is an agentproto profile of the upstream Agent Client
8
+ * Protocol (agentclientprotocol.com) — the manifest declares an
9
+ * agent or client's role/transport/conformance level, and AIP-44-
10
+ * specific bindings live under `metadata.aip44.*` so plain ACP
11
+ * runtimes preserve them verbatim.
12
+ *
13
+ * Both authoring paths (`define-acp.ts` for TS-authored manifests
14
+ * and `manifest/index.ts` for ACP.md parsing) validate against this
15
+ * schema, so every field-level constraint runs in both paths from a
16
+ * single source of truth.
17
+ *
18
+ * Cross-field rules (tier=sandboxed ⇒ sandbox required) live in
19
+ * `define-acp.ts`'s `validate(def)` body — they're harder to encode
20
+ * in a flat zod schema and want a single error path.
21
+ */
22
+
23
+ declare const aip44ExtensionsSchema: z.ZodObject<{
24
+ acp_rev: z.ZodString;
25
+ tier: z.ZodEnum<{
26
+ basic: "basic";
27
+ "governance-aware": "governance-aware";
28
+ sandboxed: "sandboxed";
29
+ }>;
30
+ capabilities: z.ZodOptional<z.ZodObject<{
31
+ client: z.ZodOptional<z.ZodObject<{
32
+ fs: z.ZodOptional<z.ZodObject<{
33
+ readTextFile: z.ZodOptional<z.ZodBoolean>;
34
+ writeTextFile: z.ZodOptional<z.ZodBoolean>;
35
+ }, z.core.$strict>>;
36
+ terminal: z.ZodOptional<z.ZodBoolean>;
37
+ }, z.core.$strict>>;
38
+ agent: z.ZodOptional<z.ZodObject<{
39
+ loadSession: z.ZodOptional<z.ZodBoolean>;
40
+ promptCapabilities: z.ZodOptional<z.ZodObject<{
41
+ image: z.ZodOptional<z.ZodBoolean>;
42
+ audio: z.ZodOptional<z.ZodBoolean>;
43
+ embeddedContext: z.ZodOptional<z.ZodBoolean>;
44
+ }, z.core.$strict>>;
45
+ mcpCapabilities: z.ZodOptional<z.ZodObject<{
46
+ http: z.ZodOptional<z.ZodBoolean>;
47
+ sse: z.ZodOptional<z.ZodBoolean>;
48
+ }, z.core.$strict>>;
49
+ }, z.core.$strict>>;
50
+ }, z.core.$strict>>;
51
+ operator: z.ZodOptional<z.ZodString>;
52
+ governance: z.ZodOptional<z.ZodString>;
53
+ sandbox: z.ZodOptional<z.ZodString>;
54
+ audit: z.ZodOptional<z.ZodObject<{
55
+ ref: z.ZodOptional<z.ZodString>;
56
+ kind: z.ZodOptional<z.ZodEnum<{
57
+ governance: "governance";
58
+ external: "external";
59
+ off: "off";
60
+ }>>;
61
+ }, z.core.$strict>>;
62
+ mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
+ name: z.ZodString;
64
+ transport: z.ZodEnum<{
65
+ stdio: "stdio";
66
+ http: "http";
67
+ sse: "sse";
68
+ }>;
69
+ ref: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strict>>>;
71
+ }, z.core.$loose>;
72
+ declare const acpFrontmatterSchema: z.ZodObject<{
73
+ name: z.ZodString;
74
+ id: z.ZodString;
75
+ description: z.ZodString;
76
+ version: z.ZodString;
77
+ kind: z.ZodEnum<{
78
+ client: "client";
79
+ server: "server";
80
+ bridge: "bridge";
81
+ }>;
82
+ transport: z.ZodUnion<readonly [z.ZodEnum<{
83
+ stdio: "stdio";
84
+ websocket: "websocket";
85
+ }>, z.ZodArray<z.ZodEnum<{
86
+ stdio: "stdio";
87
+ websocket: "websocket";
88
+ }>>]>;
89
+ metadata: z.ZodObject<{
90
+ aip44: z.ZodObject<{
91
+ acp_rev: z.ZodString;
92
+ tier: z.ZodEnum<{
93
+ basic: "basic";
94
+ "governance-aware": "governance-aware";
95
+ sandboxed: "sandboxed";
96
+ }>;
97
+ capabilities: z.ZodOptional<z.ZodObject<{
98
+ client: z.ZodOptional<z.ZodObject<{
99
+ fs: z.ZodOptional<z.ZodObject<{
100
+ readTextFile: z.ZodOptional<z.ZodBoolean>;
101
+ writeTextFile: z.ZodOptional<z.ZodBoolean>;
102
+ }, z.core.$strict>>;
103
+ terminal: z.ZodOptional<z.ZodBoolean>;
104
+ }, z.core.$strict>>;
105
+ agent: z.ZodOptional<z.ZodObject<{
106
+ loadSession: z.ZodOptional<z.ZodBoolean>;
107
+ promptCapabilities: z.ZodOptional<z.ZodObject<{
108
+ image: z.ZodOptional<z.ZodBoolean>;
109
+ audio: z.ZodOptional<z.ZodBoolean>;
110
+ embeddedContext: z.ZodOptional<z.ZodBoolean>;
111
+ }, z.core.$strict>>;
112
+ mcpCapabilities: z.ZodOptional<z.ZodObject<{
113
+ http: z.ZodOptional<z.ZodBoolean>;
114
+ sse: z.ZodOptional<z.ZodBoolean>;
115
+ }, z.core.$strict>>;
116
+ }, z.core.$strict>>;
117
+ }, z.core.$strict>>;
118
+ operator: z.ZodOptional<z.ZodString>;
119
+ governance: z.ZodOptional<z.ZodString>;
120
+ sandbox: z.ZodOptional<z.ZodString>;
121
+ audit: z.ZodOptional<z.ZodObject<{
122
+ ref: z.ZodOptional<z.ZodString>;
123
+ kind: z.ZodOptional<z.ZodEnum<{
124
+ governance: "governance";
125
+ external: "external";
126
+ off: "off";
127
+ }>>;
128
+ }, z.core.$strict>>;
129
+ mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
130
+ name: z.ZodString;
131
+ transport: z.ZodEnum<{
132
+ stdio: "stdio";
133
+ http: "http";
134
+ sse: "sse";
135
+ }>;
136
+ ref: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strict>>>;
138
+ }, z.core.$loose>;
139
+ }, z.core.$loose>;
140
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ }, z.core.$loose>;
142
+ type AcpFrontmatter = z.infer<typeof acpFrontmatterSchema>;
143
+ type Aip44Extensions = z.infer<typeof aip44ExtensionsSchema>;
144
+
145
+ export { type AcpFrontmatter as A, type Aip44Extensions as a, acpFrontmatterSchema as b };
@@ -0,0 +1,38 @@
1
+ import { AgentSideConnection } from '@agentclientprotocol/sdk';
2
+ import { c as AcpHandle } from '../types-BPyht7LH.js';
3
+
4
+ /**
5
+ * AIP-44 ACP server — exposes an AIP-9 operator to ACP-speaking clients.
6
+ *
7
+ * Thin wrapper around `@agentclientprotocol/sdk`'s `AgentSideConnection`.
8
+ * Hosts the connection, maps incoming `session/prompt` requests onto an
9
+ * `onPrompt` handler, and bridges `session/update` notifications to the
10
+ * caller's audit emitter via the per-session context.
11
+ */
12
+
13
+ interface AcpServerOptions {
14
+ /** AIP-44 manifest describing the server's role + capabilities. */
15
+ handle: AcpHandle;
16
+ /** Output bytes go here (client stdin / WS write side). */
17
+ output: WritableStream<Uint8Array>;
18
+ /** Input bytes come from here (client stdout / WS read side). */
19
+ input: ReadableStream<Uint8Array>;
20
+ /** Hook invoked when a client calls `session/prompt`. */
21
+ onPrompt?: (params: unknown, ctx: AcpServerSessionContext) => Promise<unknown>;
22
+ /** Hook invoked on `session/cancel`. */
23
+ onCancel?: (sessionId: string) => Promise<void>;
24
+ }
25
+ interface AcpServerSessionContext {
26
+ readonly sessionId: string;
27
+ /** Push a `session/update` notification to the connected client. */
28
+ sendUpdate(update: unknown): Promise<void>;
29
+ /** Aborts when the client sends `session/cancel`. */
30
+ readonly signal: AbortSignal;
31
+ }
32
+ interface AcpServer {
33
+ readonly connection: AgentSideConnection;
34
+ close(): Promise<void>;
35
+ }
36
+ declare function createAcpServer(options: AcpServerOptions): AcpServer;
37
+
38
+ export { type AcpServer, type AcpServerOptions, type AcpServerSessionContext, createAcpServer };
@@ -0,0 +1,66 @@
1
+ import { ndJsonStream, AgentSideConnection } from '@agentclientprotocol/sdk';
2
+
3
+ /**
4
+ * @agentproto/acp v0.1.0-alpha
5
+ * AIP-44 ACP.md `defineAcp` reference implementation.
6
+ */
7
+
8
+ function createAcpServer(options) {
9
+ const stream = ndJsonStream(options.output, options.input);
10
+ const connection = new AgentSideConnection(
11
+ (conn) => buildAgentHandlers(conn, options),
12
+ stream
13
+ );
14
+ return {
15
+ connection,
16
+ async close() {
17
+ }
18
+ };
19
+ }
20
+ function buildAgentHandlers(conn, options) {
21
+ void options.handle;
22
+ return {
23
+ async initialize(params) {
24
+ throw new Error("AcpServer.initialize: not yet implemented");
25
+ },
26
+ async authenticate(params) {
27
+ throw new Error("AcpServer.authenticate: not yet implemented");
28
+ },
29
+ async newSession(params) {
30
+ throw new Error("AcpServer.newSession: not yet implemented");
31
+ },
32
+ async loadSession(params) {
33
+ throw new Error("AcpServer.loadSession: not yet implemented");
34
+ },
35
+ async cancel(params) {
36
+ if (options.onCancel) {
37
+ await options.onCancel(params.sessionId);
38
+ return;
39
+ }
40
+ },
41
+ async prompt(params) {
42
+ if (!options.onPrompt) {
43
+ throw new Error("AcpServer.prompt: no onPrompt handler configured");
44
+ }
45
+ const sessionId = params.sessionId ?? "unknown";
46
+ const controller = new AbortController();
47
+ const ctx = {
48
+ sessionId,
49
+ signal: controller.signal,
50
+ sendUpdate: async (update) => {
51
+ await conn.sessionUpdate(update);
52
+ }
53
+ };
54
+ try {
55
+ return await options.onPrompt(params, ctx);
56
+ } catch (err) {
57
+ controller.abort();
58
+ throw err;
59
+ }
60
+ }
61
+ };
62
+ }
63
+
64
+ export { createAcpServer };
65
+ //# sourceMappingURL=index.mjs.map
66
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/server/index.ts"],"names":[],"mappings":";;;;;;;AA2CO,SAAS,gBAAgB,OAAA,EAAsC;AACpE,EAAA,MAAM,MAAA,GAAiB,YAAA,CAAa,OAAA,CAAQ,MAAA,EAAQ,QAAQ,KAAK,CAAA;AAEjE,EAAA,MAAM,aAAa,IAAI,mBAAA;AAAA,IACrB,CAAC,IAAA,KAAS,kBAAA,CAAmB,IAAA,EAAM,OAAO,CAAA;AAAA,IAC1C;AAAA,GACF;AAEA,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,MAAM,KAAA,GAAQ;AAAA,IAAC;AAAA,GACjB;AACF;AAEA,SAAS,kBAAA,CACP,MACA,OAAA,EACkB;AAClB,EAAA,KAAK,OAAA,CAAQ,MAAA;AAEb,EAAA,OAAO;AAAA,IACL,MAAM,WAAW,MAAA,EAAQ;AAEvB,MAAA,MAAM,IAAI,MAAM,2CAA2C,CAAA;AAAA,IAC7D,CAAA;AAAA,IACA,MAAM,aAAa,MAAA,EAAQ;AAEzB,MAAA,MAAM,IAAI,MAAM,6CAA6C,CAAA;AAAA,IAC/D,CAAA;AAAA,IACA,MAAM,WAAW,MAAA,EAAQ;AAEvB,MAAA,MAAM,IAAI,MAAM,2CAA2C,CAAA;AAAA,IAC7D,CAAA;AAAA,IACA,MAAM,YAAY,MAAA,EAAQ;AAExB,MAAA,MAAM,IAAI,MAAM,4CAA4C,CAAA;AAAA,IAC9D,CAAA;AAAA,IACA,MAAM,OAAO,MAAA,EAAQ;AACnB,MAAA,IAAI,QAAQ,QAAA,EAAU;AACpB,QAAA,MAAM,OAAA,CAAQ,QAAA,CAAS,MAAA,CAAO,SAAS,CAAA;AACvC,QAAA;AAAA,MACF;AAAA,IACF,CAAA;AAAA,IACA,MAAM,OAAO,MAAA,EAAQ;AACnB,MAAA,IAAI,CAAC,QAAQ,QAAA,EAAU;AACrB,QAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,MACpE;AACA,MAAA,MAAM,SAAA,GAAa,OAAkC,SAAA,IAAa,SAAA;AAClE,MAAA,MAAM,UAAA,GAAa,IAAI,eAAA,EAAgB;AACvC,MAAA,MAAM,GAAA,GAA+B;AAAA,QACnC,SAAA;AAAA,QACA,QAAQ,UAAA,CAAW,MAAA;AAAA,QACnB,UAAA,EAAY,OAAO,MAAA,KAAW;AAC5B,UAAA,MAAM,IAAA,CAAK,cAAc,MAAe,CAAA;AAAA,QAC1C;AAAA,OACF;AACA,MAAA,IAAI;AACF,QAAA,OAAQ,MAAM,OAAA,CAAQ,QAAA,CAAS,MAAA,EAAQ,GAAG,CAAA;AAAA,MAC5C,SAAS,GAAA,EAAK;AACZ,QAAA,UAAA,CAAW,KAAA,EAAM;AACjB,QAAA,MAAM,GAAA;AAAA,MACR;AAAA,IACF;AAAA,GACF;AACF","file":"index.mjs","sourcesContent":["/**\n * AIP-44 ACP server — exposes an AIP-9 operator to ACP-speaking clients.\n *\n * Thin wrapper around `@agentclientprotocol/sdk`'s `AgentSideConnection`.\n * Hosts the connection, maps incoming `session/prompt` requests onto an\n * `onPrompt` handler, and bridges `session/update` notifications to the\n * caller's audit emitter via the per-session context.\n */\n\nimport {\n AgentSideConnection,\n ndJsonStream,\n type Agent as AcpAgentHandlers,\n type Stream,\n} from \"@agentclientprotocol/sdk\"\nimport type { AcpHandle } from \"../types.js\"\n\nexport interface AcpServerOptions {\n /** AIP-44 manifest describing the server's role + capabilities. */\n handle: AcpHandle\n /** Output bytes go here (client stdin / WS write side). */\n output: WritableStream<Uint8Array>\n /** Input bytes come from here (client stdout / WS read side). */\n input: ReadableStream<Uint8Array>\n /** Hook invoked when a client calls `session/prompt`. */\n onPrompt?: (params: unknown, ctx: AcpServerSessionContext) => Promise<unknown>\n /** Hook invoked on `session/cancel`. */\n onCancel?: (sessionId: string) => Promise<void>\n}\n\nexport interface AcpServerSessionContext {\n readonly sessionId: string\n /** Push a `session/update` notification to the connected client. */\n sendUpdate(update: unknown): Promise<void>\n /** Aborts when the client sends `session/cancel`. */\n readonly signal: AbortSignal\n}\n\nexport interface AcpServer {\n readonly connection: AgentSideConnection\n close(): Promise<void>\n}\n\nexport function createAcpServer(options: AcpServerOptions): AcpServer {\n const stream: Stream = ndJsonStream(options.output, options.input)\n\n const connection = new AgentSideConnection(\n (conn) => buildAgentHandlers(conn, options),\n stream,\n )\n\n return {\n connection,\n async close() {},\n }\n}\n\nfunction buildAgentHandlers(\n conn: AgentSideConnection,\n options: AcpServerOptions,\n): AcpAgentHandlers {\n void options.handle\n\n return {\n async initialize(params) {\n void params\n throw new Error(\"AcpServer.initialize: not yet implemented\")\n },\n async authenticate(params) {\n void params\n throw new Error(\"AcpServer.authenticate: not yet implemented\")\n },\n async newSession(params) {\n void params\n throw new Error(\"AcpServer.newSession: not yet implemented\")\n },\n async loadSession(params) {\n void params\n throw new Error(\"AcpServer.loadSession: not yet implemented\")\n },\n async cancel(params) {\n if (options.onCancel) {\n await options.onCancel(params.sessionId)\n return\n }\n },\n async prompt(params) {\n if (!options.onPrompt) {\n throw new Error(\"AcpServer.prompt: no onPrompt handler configured\")\n }\n const sessionId = (params as { sessionId?: string }).sessionId ?? \"unknown\"\n const controller = new AbortController()\n const ctx: AcpServerSessionContext = {\n sessionId,\n signal: controller.signal,\n sendUpdate: async (update) => {\n await conn.sessionUpdate(update as never)\n },\n }\n try {\n return (await options.onPrompt(params, ctx)) as never\n } catch (err) {\n controller.abort()\n throw err\n }\n },\n } as AcpAgentHandlers\n}\n"]}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * AIP-44 AcpDefinition + AcpHandle.
3
+ *
4
+ * Mirrors `resources/aip-44/draft/ACP.schema.json`. AIP-44 is an
5
+ * agentproto profile of the Agent Client Protocol — top-level fields
6
+ * declare role/transport/version, and AIP-44 extensions live under
7
+ * `metadata.aip44.*`.
8
+ *
9
+ * `AcpHandle` is the readonly view of the same shape; tighten it by
10
+ * hand for fields that get defaults applied in build().
11
+ */
12
+ type AcpRole = "client" | "server" | "bridge";
13
+ type AcpTransport = "stdio" | "websocket";
14
+ type AcpTier = "basic" | "governance-aware" | "sandboxed";
15
+ /** Mirror of upstream ACP `initialize` capabilities. */
16
+ interface AcpCapabilities {
17
+ client?: {
18
+ fs?: {
19
+ readTextFile?: boolean;
20
+ writeTextFile?: boolean;
21
+ };
22
+ terminal?: boolean;
23
+ };
24
+ agent?: {
25
+ loadSession?: boolean;
26
+ promptCapabilities?: {
27
+ image?: boolean;
28
+ audio?: boolean;
29
+ embeddedContext?: boolean;
30
+ };
31
+ mcpCapabilities?: {
32
+ http?: boolean;
33
+ sse?: boolean;
34
+ };
35
+ };
36
+ }
37
+ interface AcpAuditConfig {
38
+ ref?: string;
39
+ kind?: "governance" | "external" | "off";
40
+ }
41
+ interface AcpMcpServer {
42
+ name: string;
43
+ transport: "stdio" | "http" | "sse";
44
+ ref?: string;
45
+ }
46
+ /** AIP-44 extensions on the agentskills.io baseline. Lives under `metadata.aip44`. */
47
+ interface Aip44Extensions {
48
+ /** Commit SHA of upstream ACP repository this manifest validates against. */
49
+ acp_rev: string;
50
+ /** Capability tier shorthand. */
51
+ tier: AcpTier;
52
+ /** Optional explicit capability map; overrides tier defaults when present. */
53
+ capabilities?: AcpCapabilities;
54
+ /** AIP-9 OPERATOR.md ref. REQUIRED when kind=server. */
55
+ operator?: string;
56
+ /** AIP-7 GOVERNANCE.md ref. */
57
+ governance?: string;
58
+ /** AIP-36 SANDBOX.md ref. REQUIRED when tier=sandboxed. */
59
+ sandbox?: string;
60
+ /** Audit log target override. */
61
+ audit?: AcpAuditConfig;
62
+ /** MCP servers to mount via session/new.mcpServers. */
63
+ mcp_servers?: AcpMcpServer[];
64
+ /** AIP-44 extensions stay open; vendors MAY add namespaced sub-keys. */
65
+ [extension: string]: unknown;
66
+ }
67
+ /**
68
+ * AIP-44 ACP.md frontmatter. Top-level fields are stable across upstream
69
+ * ACP rev bumps; the AIP-44-specific binding layer lives in
70
+ * `metadata.aip44`.
71
+ */
72
+ interface AcpDefinition {
73
+ /** Kebab id; MUST equal the parent directory name. */
74
+ name: string;
75
+ /** Stable runtime id. */
76
+ id: string;
77
+ /** One-paragraph purpose. */
78
+ description: string;
79
+ /** Semver of this manifest. */
80
+ version: string;
81
+ /** client = drives a subprocess; server = exposes an operator; bridge = both. */
82
+ kind: AcpRole;
83
+ /** Transport(s) supported. stdio is REQUIRED; websocket is OPTIONAL. */
84
+ transport: AcpTransport | AcpTransport[];
85
+ /** Free-form metadata. AIP-44 extensions live under `metadata.aip44`. */
86
+ metadata: {
87
+ aip44: Aip44Extensions;
88
+ [vendor: string]: unknown;
89
+ };
90
+ /** Optional tags for catalog ergonomics. */
91
+ tags?: string[];
92
+ /** Top-level extension surface preserved for forward compatibility. */
93
+ [extension: string]: unknown;
94
+ }
95
+ type AcpHandle = Readonly<AcpDefinition>;
96
+ /**
97
+ * Canonical stream-event taxonomy emitted from `createAcpClient`. The
98
+ * client maps upstream ACP `session/update` notifications and
99
+ * `requestPermission` callbacks into this closed set so consumers
100
+ * never see protocol-specific shapes.
101
+ */
102
+ type StreamEvent = {
103
+ kind: "text-delta";
104
+ sessionId: string;
105
+ text: string;
106
+ } | {
107
+ kind: "tool-call";
108
+ sessionId: string;
109
+ toolCallId: string;
110
+ toolName: string;
111
+ arguments: unknown;
112
+ } | {
113
+ kind: "tool-result";
114
+ sessionId: string;
115
+ toolCallId: string;
116
+ result: unknown;
117
+ isError?: boolean;
118
+ } | {
119
+ kind: "thought";
120
+ sessionId: string;
121
+ text: string;
122
+ } | {
123
+ kind: "agent-prompt";
124
+ sessionId: string;
125
+ toolCallId: string;
126
+ options: unknown;
127
+ } | {
128
+ kind: "turn-end";
129
+ sessionId: string;
130
+ reason: "completed" | "cancelled" | "max_turns" | "error";
131
+ } | {
132
+ kind: "error";
133
+ sessionId?: string;
134
+ error: {
135
+ code?: number;
136
+ message: string;
137
+ data?: unknown;
138
+ };
139
+ };
140
+
141
+ export type { AcpDefinition as A, StreamEvent as S, AcpAuditConfig as a, AcpCapabilities as b, AcpHandle as c, AcpMcpServer as d, AcpRole as e, AcpTier as f, AcpTransport as g, Aip44Extensions as h };
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@agentproto/acp",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "@agentproto/acp — AIP-44 ACP.md reference implementation. An agentproto profile of the Agent Client Protocol (agentclientprotocol.com). Wraps @agentclientprotocol/sdk with createAcpClient (drives subprocess agents) and createAcpServer (exposes AIP-9 operators to ACP-speaking IDEs).",
5
+ "keywords": [
6
+ "agentproto",
7
+ "aip-44",
8
+ "acp",
9
+ "agent-client-protocol",
10
+ "defineAcp",
11
+ "open-standard",
12
+ "agentic"
13
+ ],
14
+ "homepage": "https://agentproto.sh/docs/aip-44",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/agentproto/ts",
18
+ "directory": "packages/acp"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/agentproto/ts/issues"
22
+ },
23
+ "license": "MIT",
24
+ "type": "module",
25
+ "main": "dist/index.mjs",
26
+ "module": "dist/index.mjs",
27
+ "types": "dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.mjs",
32
+ "default": "./dist/index.mjs"
33
+ },
34
+ "./manifest": {
35
+ "types": "./dist/manifest/index.d.ts",
36
+ "import": "./dist/manifest/index.mjs",
37
+ "default": "./dist/manifest/index.mjs"
38
+ },
39
+ "./client": {
40
+ "types": "./dist/client/index.d.ts",
41
+ "import": "./dist/client/index.mjs",
42
+ "default": "./dist/client/index.mjs"
43
+ },
44
+ "./server": {
45
+ "types": "./dist/server/index.d.ts",
46
+ "import": "./dist/server/index.mjs",
47
+ "default": "./dist/server/index.mjs"
48
+ },
49
+ "./package.json": "./package.json"
50
+ },
51
+ "files": [
52
+ "dist",
53
+ "README.md",
54
+ "LICENSE"
55
+ ],
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "dependencies": {
60
+ "@agentclientprotocol/sdk": "^0.21.0",
61
+ "gray-matter": "^4.0.3",
62
+ "zod": "^4.3.6",
63
+ "@agentproto/define-doctype": "0.1.0-alpha.0"
64
+ },
65
+ "devDependencies": {
66
+ "@types/node": "^25.1.0",
67
+ "tsup": "^8.5.1",
68
+ "typescript": "^5.9.3",
69
+ "vitest": "^3.2.4",
70
+ "@agentproto/tooling": "0.1.0-alpha.0"
71
+ },
72
+ "scripts": {
73
+ "dev": "tsup --watch",
74
+ "build": "tsup",
75
+ "clean": "rm -rf dist",
76
+ "check-types": "tsc --noEmit",
77
+ "test": "vitest run --passWithNoTests",
78
+ "test:watch": "vitest"
79
+ }
80
+ }