@ai-sdk/harness-acp 1.0.38 → 1.0.40
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/CHANGELOG.md +24 -0
- package/README.md +4 -3
- package/dist/bridge/host-tool-mcp.mjs +1 -1
- package/dist/bridge/index.mjs +556 -43
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/index.d.ts +56 -6
- package/dist/index.js +280 -72
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/acp-harness.ts +51 -9
- package/src/index.ts +2 -0
- package/src/v1/acp-v1-bridge-protocol.ts +19 -0
- package/src/v1/acp-v1-harness.ts +307 -19
- package/src/v1/acp-v1-settings.ts +42 -0
- package/src/v1/acp-v1-skills.ts +4 -65
- package/src/v1/bridge/acp-v1-bridge-environment.ts +16 -0
- package/src/v1/bridge/create-emit-stream-event.ts +6 -0
- package/src/v1/bridge/host-tool-correlation.ts +34 -0
- package/src/v1/bridge/host-tool-mcp-definition.ts +69 -0
- package/src/v1/bridge/host-tool-mcp-http.ts +182 -0
- package/src/v1/bridge/host-tool-relay.ts +87 -7
- package/src/v1/bridge/index.ts +111 -24
- package/src/v1/bridge/instruction-mapping.ts +12 -0
- package/src/v1/bridge/stream-translator.ts +41 -2
- package/src/v1/index.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HarnessV1Authentication, HarnessV1RequestTransformation, HarnessV1CredentialForwarding, HarnessV1PermissionMode, HarnessV1PortEndpoint, HarnessV1 } from '@ai-sdk/harness';
|
|
2
|
-
import { ToolSet } from '@ai-sdk/provider-utils';
|
|
1
|
+
import { HarnessV1StreamPart, HarnessV1Authentication, HarnessV1RequestTransformation, HarnessV1CredentialForwarding, HarnessV1PermissionMode, HarnessV1PortEndpoint, HarnessV1, HARNESS_V1_BUILTIN_TOOLS } from '@ai-sdk/harness';
|
|
2
|
+
import { ToolResultPart, ToolSet } from '@ai-sdk/provider-utils';
|
|
3
3
|
|
|
4
4
|
type ACPMetadata = Record<string, unknown>;
|
|
5
5
|
type ACPRole = 'assistant' | 'user';
|
|
@@ -152,9 +152,10 @@ type ACPModelMapping = {
|
|
|
152
152
|
readonly type: 'session-model';
|
|
153
153
|
readonly path: string;
|
|
154
154
|
};
|
|
155
|
-
type ACPCredentialBrokering = ({ env, sandboxEnv, }: {
|
|
155
|
+
type ACPCredentialBrokering = ({ env, sandboxEnv, headers, }: {
|
|
156
156
|
env: Readonly<Record<string, string>>;
|
|
157
157
|
sandboxEnv?: Readonly<Record<string, string>>;
|
|
158
|
+
headers?: Readonly<Record<string, string>>;
|
|
158
159
|
}) => ReadonlyArray<HarnessV1RequestTransformation>;
|
|
159
160
|
type ACPPermissionModeTarget = {
|
|
160
161
|
readonly type: 'session-mode';
|
|
@@ -177,11 +178,39 @@ type ACPInstructionMapping = {
|
|
|
177
178
|
readonly type: 'launch-env-json';
|
|
178
179
|
readonly variable: string;
|
|
179
180
|
readonly path: ReadonlyArray<string>;
|
|
181
|
+
} | {
|
|
182
|
+
readonly type: 'filesystem';
|
|
183
|
+
readonly path: string;
|
|
180
184
|
};
|
|
181
185
|
type ACPOutputSchemaMapping = {
|
|
182
186
|
readonly type: 'session-prompt-meta';
|
|
183
187
|
readonly path: ReadonlyArray<string>;
|
|
184
188
|
};
|
|
189
|
+
/**
|
|
190
|
+
* Transport used for the harness-owned MCP server that exposes host tools to
|
|
191
|
+
* an ACP implementation.
|
|
192
|
+
*/
|
|
193
|
+
type ACPHostToolMCPTransport = 'stdio' | 'http';
|
|
194
|
+
type ACPAskUserQuestionsSettings = {
|
|
195
|
+
readonly requestMethod: string;
|
|
196
|
+
readonly isNativeToolCall?: (options: {
|
|
197
|
+
nativeToolCall: ACPToolCall;
|
|
198
|
+
}) => boolean;
|
|
199
|
+
readonly fromNativeRequest: (options: {
|
|
200
|
+
nativeRequest: unknown;
|
|
201
|
+
nativeToolCall?: ACPToolCall;
|
|
202
|
+
}) => Extract<HarnessV1StreamPart, {
|
|
203
|
+
type: 'tool-call';
|
|
204
|
+
}> | null;
|
|
205
|
+
readonly toNativeResponse: (options: {
|
|
206
|
+
nativeRequest: unknown;
|
|
207
|
+
toolResult: ToolResultPart;
|
|
208
|
+
}) => unknown;
|
|
209
|
+
readonly matchesNativeRequest?: (options: {
|
|
210
|
+
previousNativeRequest: unknown;
|
|
211
|
+
nativeRequest: unknown;
|
|
212
|
+
}) => boolean;
|
|
213
|
+
};
|
|
185
214
|
type ACPV1Settings = {
|
|
186
215
|
readonly version?: 'v1';
|
|
187
216
|
readonly harnessId: string;
|
|
@@ -232,6 +261,15 @@ type ACPV1Settings = {
|
|
|
232
261
|
* below the ACP session prompt's `_meta` field.
|
|
233
262
|
*/
|
|
234
263
|
readonly outputSchemaMapping?: ACPOutputSchemaMapping;
|
|
264
|
+
/**
|
|
265
|
+
* Transport used for the harness-owned MCP server that exposes host tools to
|
|
266
|
+
* the ACP implementation. Defaults to `stdio`. Set this to `http` for
|
|
267
|
+
* implementations that only accept HTTP or SSE MCP servers from the client,
|
|
268
|
+
* which requires the implementation to advertise
|
|
269
|
+
* `agentCapabilities.mcpCapabilities.http`.
|
|
270
|
+
*/
|
|
271
|
+
readonly hostToolMcpTransport?: ACPHostToolMCPTransport;
|
|
272
|
+
readonly askUserQuestions?: ACPAskUserQuestionsSettings;
|
|
235
273
|
readonly permissionModeMapping?: ACPPermissionModeMapping;
|
|
236
274
|
readonly session?: {
|
|
237
275
|
readonly meta?: Readonly<Record<string, ACPSerializableValue>>;
|
|
@@ -249,7 +287,7 @@ type ACPClientApp = {
|
|
|
249
287
|
readonly version: string;
|
|
250
288
|
};
|
|
251
289
|
|
|
252
|
-
type ACPHarnessSettings<TBuiltinTools extends ToolSet = {}> = {
|
|
290
|
+
type ACPHarnessSettings<TBuiltinTools extends ToolSet = {}, TAskUserQuestions extends ACPAskUserQuestionsSettings | undefined = ACPAskUserQuestionsSettings | undefined> = {
|
|
253
291
|
readonly builtinTools?: TBuiltinTools;
|
|
254
292
|
/**
|
|
255
293
|
* MCP server definitions keyed by server name. Each definition uses the
|
|
@@ -295,12 +333,24 @@ type ACPHarnessSettings<TBuiltinTools extends ToolSet = {}> = {
|
|
|
295
333
|
readonly skillsDirectory?: ACPV1Settings['skillsDirectory'];
|
|
296
334
|
readonly instructionMapping?: ACPV1Settings['instructionMapping'];
|
|
297
335
|
readonly outputSchemaMapping?: ACPV1Settings['outputSchemaMapping'];
|
|
336
|
+
/**
|
|
337
|
+
* Transport used for the harness-owned MCP server that exposes host tools to
|
|
338
|
+
* the ACP implementation. Defaults to `stdio`. Set this to `http` for
|
|
339
|
+
* implementations that only accept HTTP or SSE MCP servers from the client,
|
|
340
|
+
* which requires the implementation to advertise
|
|
341
|
+
* `agentCapabilities.mcpCapabilities.http`.
|
|
342
|
+
*/
|
|
343
|
+
readonly hostToolMcpTransport?: ACPV1Settings['hostToolMcpTransport'];
|
|
344
|
+
readonly askUserQuestions?: TAskUserQuestions;
|
|
298
345
|
readonly permissionModeMapping?: ACPV1Settings['permissionModeMapping'];
|
|
299
346
|
readonly session?: ACPV1Settings['session'];
|
|
300
347
|
readonly mintBridgeToken?: ACPV1Settings['mintBridgeToken'];
|
|
301
348
|
};
|
|
302
|
-
|
|
349
|
+
type ACPHarnessTools<TBuiltinTools extends ToolSet, TAskUserQuestions> = TBuiltinTools & ([TAskUserQuestions] extends [undefined] ? {} : {
|
|
350
|
+
askUserQuestions: typeof HARNESS_V1_BUILTIN_TOOLS.askUserQuestions;
|
|
351
|
+
});
|
|
352
|
+
declare function createACP<TBuiltinTools extends ToolSet = {}, TAskUserQuestions extends ACPAskUserQuestionsSettings | undefined = undefined>(settings: ACPHarnessSettings<TBuiltinTools, TAskUserQuestions>): HarnessV1<ACPHarnessTools<TBuiltinTools, TAskUserQuestions>>;
|
|
303
353
|
|
|
304
354
|
declare const VERSION: string;
|
|
305
355
|
|
|
306
|
-
export { type ACPAnnotations, type ACPAudioContent, type ACPAuthentication, type ACPAuthenticationMode, type ACPBlobResourceContents, type ACPClientApp, type ACPContentBlock, type ACPCredentialBrokering, type ACPEmbeddedResource, type ACPHarnessSettings, type ACPImageContent, type ACPInstallCommandSource, type ACPInstructionMapping, type ACPMetadata, type ACPModelMapping, type ACPNpmLockedSource, type ACPNpmSimpleSource, type ACPOutputSchemaMapping, type ACPPermissionModeMapping, type ACPPermissionModeTarget, type ACPProfileValue, type ACPProviderAuthentication, type ACPResourceLink, type ACPRole, type ACPSerializablePrimitive, type ACPSerializableValue, type ACPSource, type ACPTextContent, type ACPTextResourceContents, type ACPToolCall, type ACPToolCallContent, type ACPToolCallLocation, type ACPToolCallStatus, type ACPToolKind, type ACPV1Settings, type ACPValueSource, VERSION, createACP };
|
|
356
|
+
export { type ACPAnnotations, type ACPAskUserQuestionsSettings, type ACPAudioContent, type ACPAuthentication, type ACPAuthenticationMode, type ACPBlobResourceContents, type ACPClientApp, type ACPContentBlock, type ACPCredentialBrokering, type ACPEmbeddedResource, type ACPHarnessSettings, type ACPHostToolMCPTransport, type ACPImageContent, type ACPInstallCommandSource, type ACPInstructionMapping, type ACPMetadata, type ACPModelMapping, type ACPNpmLockedSource, type ACPNpmSimpleSource, type ACPOutputSchemaMapping, type ACPPermissionModeMapping, type ACPPermissionModeTarget, type ACPProfileValue, type ACPProviderAuthentication, type ACPResourceLink, type ACPRole, type ACPSerializablePrimitive, type ACPSerializableValue, type ACPSource, type ACPTextContent, type ACPTextResourceContents, type ACPToolCall, type ACPToolCallContent, type ACPToolCallLocation, type ACPToolCallStatus, type ACPToolKind, type ACPV1Settings, type ACPValueSource, VERSION, createACP };
|