@thinkwell/acp 0.1.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.
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Types for MCP-over-ACP protocol messages
3
+ */
4
+ import type { JsonValue } from "./json.js";
5
+ /**
6
+ * JSON Schema type for tool input/output validation.
7
+ *
8
+ * This is a structural subset of JSON Schema, designed to be compatible
9
+ * with schemas produced by third-party libraries without requiring them
10
+ * as dependencies.
11
+ */
12
+ export interface JsonSchema {
13
+ type?: string;
14
+ properties?: Record<string, JsonSchema>;
15
+ required?: string[];
16
+ items?: JsonSchema;
17
+ description?: string;
18
+ enum?: JsonValue[];
19
+ oneOf?: JsonSchema[];
20
+ anyOf?: JsonSchema[];
21
+ allOf?: JsonSchema[];
22
+ $ref?: string;
23
+ additionalProperties?: boolean | JsonSchema;
24
+ [key: string]: unknown;
25
+ }
26
+ /**
27
+ * Interface for types that can provide a JSON Schema representation.
28
+ *
29
+ * This enables integration with various schema technologies:
30
+ * - Schema-first libraries (Zod, TypeBox)
31
+ * - Build-time type-to-schema generators (TypeSpec, ts-json-schema-transformer)
32
+ * - Hand-written schemas with type associations
33
+ *
34
+ * @typeParam T - The TypeScript type that this schema describes
35
+ */
36
+ export interface SchemaProvider<T> {
37
+ /**
38
+ * Returns the JSON Schema that describes type T.
39
+ */
40
+ toJsonSchema(): JsonSchema;
41
+ }
42
+ /**
43
+ * MCP server configuration for session requests
44
+ */
45
+ export interface McpServerConfig {
46
+ type: "http";
47
+ name: string;
48
+ url: string;
49
+ }
50
+ /**
51
+ * Context provided to tool handlers
52
+ */
53
+ export interface McpContext {
54
+ /** The connection ID for this MCP session */
55
+ connectionId: string;
56
+ /** The session ID for the ACP session */
57
+ sessionId: string;
58
+ }
59
+ /**
60
+ * MCP connect request from conductor
61
+ */
62
+ export interface McpConnectRequest {
63
+ method: "_mcp/connect";
64
+ params: {
65
+ connectionId: string;
66
+ url: string;
67
+ };
68
+ }
69
+ /**
70
+ * MCP connect response
71
+ */
72
+ export interface McpConnectResponse {
73
+ connectionId: string;
74
+ serverInfo: {
75
+ name: string;
76
+ version: string;
77
+ };
78
+ capabilities: {
79
+ tools?: Record<string, unknown>;
80
+ };
81
+ /** Optional tool definitions - the bridge may use these to pre-populate tool info */
82
+ tools?: McpToolDefinition[];
83
+ }
84
+ /**
85
+ * MCP message request (tool call, etc.)
86
+ */
87
+ export interface McpMessageRequest {
88
+ method: "_mcp/message";
89
+ params: {
90
+ connectionId: string;
91
+ method: string;
92
+ id?: string | number;
93
+ params?: unknown;
94
+ };
95
+ }
96
+ /**
97
+ * MCP message response
98
+ */
99
+ export interface McpMessageResponse {
100
+ connectionId: string;
101
+ content?: McpContent[];
102
+ result?: unknown;
103
+ error?: McpError;
104
+ }
105
+ /**
106
+ * MCP content block
107
+ */
108
+ export interface McpContent {
109
+ type: "text" | "image" | "resource";
110
+ text?: string;
111
+ data?: string;
112
+ mimeType?: string;
113
+ }
114
+ /**
115
+ * MCP error
116
+ */
117
+ export interface McpError {
118
+ code: number;
119
+ message: string;
120
+ data?: unknown;
121
+ }
122
+ /**
123
+ * MCP disconnect notification
124
+ */
125
+ export interface McpDisconnectNotification {
126
+ method: "_mcp/disconnect";
127
+ params: {
128
+ connectionId: string;
129
+ };
130
+ }
131
+ /**
132
+ * MCP tools/list response
133
+ */
134
+ export interface McpToolsListResult {
135
+ tools: McpToolDefinition[];
136
+ }
137
+ /**
138
+ * MCP tool definition
139
+ */
140
+ export interface McpToolDefinition {
141
+ name: string;
142
+ description: string;
143
+ inputSchema: JsonSchema;
144
+ }
145
+ /**
146
+ * MCP tools/call request params
147
+ */
148
+ export interface McpToolsCallParams {
149
+ name: string;
150
+ arguments: Record<string, unknown>;
151
+ }
152
+ /**
153
+ * MCP tools/call response
154
+ */
155
+ export interface McpToolsCallResult {
156
+ content: McpContent[];
157
+ isError?: boolean;
158
+ }
159
+ /**
160
+ * Session message types
161
+ */
162
+ export type SessionMessage = {
163
+ type: "text";
164
+ content: string;
165
+ } | {
166
+ type: "tool_use";
167
+ id: string;
168
+ name: string;
169
+ input: unknown;
170
+ } | {
171
+ type: "tool_result";
172
+ tool_use_id: string;
173
+ content: string;
174
+ } | {
175
+ type: "stop";
176
+ reason: StopReason;
177
+ };
178
+ /**
179
+ * Reason for stopping
180
+ */
181
+ export type StopReason = "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
182
+ /**
183
+ * Tool handler function type
184
+ */
185
+ export type ToolHandler<I = unknown, O = unknown> = (input: I, context: McpContext) => Promise<O>;
186
+ /**
187
+ * Registered tool with metadata
188
+ */
189
+ export interface RegisteredTool<I = unknown, O = unknown> {
190
+ name: string;
191
+ description: string;
192
+ inputSchema: JsonSchema;
193
+ outputSchema: JsonSchema;
194
+ handler: ToolHandler<I, O>;
195
+ }
196
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,CAAC,GAAG,EAAE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AAO,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,eAAe,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI,CAClD,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,UAAU,KAChB,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,EAAE,UAAU,CAAC;IACzB,OAAO,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC5B"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Types for MCP-over-ACP protocol messages
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@thinkwell/acp",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript implementation of ACP (Agent Client Protocol) extensions for Thinkwell",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "clean": "rm -rf dist",
20
+ "test": "node --test --import tsx src/**/*.test.ts"
21
+ },
22
+ "keywords": [
23
+ "acp",
24
+ "mcp",
25
+ "thinkwell",
26
+ "agent",
27
+ "llm"
28
+ ],
29
+ "author": "David Herman",
30
+ "license": "MIT",
31
+ "dependencies": {
32
+ "@agentclientprotocol/sdk": "^0.4.0",
33
+ "uuid": "^11.0.3"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^24.10.4",
37
+ "@types/uuid": "^10.0.0",
38
+ "tsx": "^4.19.2",
39
+ "typescript": "^5.7.2"
40
+ }
41
+ }