@ai-sdk/harness-acp 1.0.29 → 1.0.30
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 +8 -0
- package/dist/bridge/host-tool-mcp.mjs +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +43 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/acp-auth.ts +38 -13
- package/src/index.ts +1 -2
- package/src/v1/acp-v1-harness.ts +6 -0
- package/src/v1/acp-v1-settings.ts +3 -2
- package/src/v1/implementation.ts +9 -4
- package/src/v1/index.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @ai-sdk/harness-acp
|
|
2
2
|
|
|
3
|
+
## 1.0.30
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e0d7cfb: feat(harness): allow harness sessions to optionally authenticate from an isolated environment supplied through the `auth` option, and remove support for the formerly deprecated legacy auth options types
|
|
8
|
+
- Updated dependencies [e0d7cfb]
|
|
9
|
+
- @ai-sdk/harness@1.0.92
|
|
10
|
+
|
|
3
11
|
## 1.0.29
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ListToolsRequestSchema,
|
|
13
13
|
McpError
|
|
14
14
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
15
|
-
var VERSION = true ? "1.0.
|
|
15
|
+
var VERSION = true ? "1.0.30" : "0.0.0-test";
|
|
16
16
|
function createHostToolMCPServer({
|
|
17
17
|
tools: tools2,
|
|
18
18
|
revision = 1,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HarnessV1RequestTransformation, HarnessV1CredentialForwarding, HarnessV1PermissionMode, HarnessV1PortEndpoint, HarnessV1 } from '@ai-sdk/harness';
|
|
1
|
+
import { HarnessV1Authentication, HarnessV1RequestTransformation, HarnessV1CredentialForwarding, HarnessV1PermissionMode, HarnessV1PortEndpoint, HarnessV1 } from '@ai-sdk/harness';
|
|
2
2
|
import { ToolSet } from '@ai-sdk/provider-utils';
|
|
3
3
|
|
|
4
4
|
type ACPMetadata = Record<string, unknown>;
|
|
@@ -139,7 +139,7 @@ type ACPAuthentication = {
|
|
|
139
139
|
readonly meta?: Readonly<Record<string, ACPSerializableValue>>;
|
|
140
140
|
readonly clientCapabilities?: Readonly<Record<string, ACPSerializableValue>>;
|
|
141
141
|
};
|
|
142
|
-
type
|
|
142
|
+
type ACPAuthenticationMode$1 = HarnessV1Authentication;
|
|
143
143
|
type ACPProviderAuthentication = {
|
|
144
144
|
readonly gateway: {
|
|
145
145
|
readonly env: Readonly<Record<string, ACPProfileValue>>;
|
|
@@ -180,7 +180,7 @@ type ACPV1Settings = {
|
|
|
180
180
|
readonly harnessId: string;
|
|
181
181
|
readonly mcpServers?: Record<string, unknown>;
|
|
182
182
|
readonly isMcpToolCall?: (toolCall: ACPToolCall) => boolean;
|
|
183
|
-
readonly auth?:
|
|
183
|
+
readonly auth?: ACPAuthenticationMode$1;
|
|
184
184
|
readonly source: ACPSource;
|
|
185
185
|
readonly executable: string;
|
|
186
186
|
readonly args?: ReadonlyArray<string>;
|
|
@@ -227,7 +227,7 @@ type ACPV1Settings = {
|
|
|
227
227
|
readonly mintBridgeToken?: (sandboxId: string) => string;
|
|
228
228
|
};
|
|
229
229
|
|
|
230
|
-
type
|
|
230
|
+
type ACPAuthenticationMode = ACPAuthenticationMode$1;
|
|
231
231
|
type ACPClientApp = {
|
|
232
232
|
readonly name: string;
|
|
233
233
|
readonly version: string;
|
|
@@ -279,4 +279,4 @@ declare function createACP<TBuiltinTools extends ToolSet = {}>(settings: ACPHarn
|
|
|
279
279
|
|
|
280
280
|
declare const VERSION: string;
|
|
281
281
|
|
|
282
|
-
export { type ACPAnnotations, type ACPAudioContent, type
|
|
282
|
+
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 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 };
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,10 @@ import { WebSocket } from "ws";
|
|
|
33
33
|
|
|
34
34
|
// src/acp-auth.ts
|
|
35
35
|
import { createHash } from "crypto";
|
|
36
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
getAiGatewayAuthFromEnv,
|
|
38
|
+
isHarnessAuthenticationEnvironment
|
|
39
|
+
} from "@ai-sdk/harness/utils";
|
|
37
40
|
var DEFAULT_AI_GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh";
|
|
38
41
|
function createACPAuthenticationProfileIdentity({
|
|
39
42
|
authentication,
|
|
@@ -67,6 +70,10 @@ function resolveACPProviderAuthentication({
|
|
|
67
70
|
AI_SDK_ACP_CLIENT_APP_NAME: auth.clientApp.name,
|
|
68
71
|
AI_SDK_ACP_CLIENT_APP_VERSION: auth.clientApp.version
|
|
69
72
|
};
|
|
73
|
+
const resolvedEnv = resolveACPAuthenticationEnvironment({
|
|
74
|
+
auth: auth.mode,
|
|
75
|
+
env
|
|
76
|
+
});
|
|
70
77
|
const providerAuthentication = auth.providerAuthentication;
|
|
71
78
|
if (providerAuthentication == null) {
|
|
72
79
|
return { providerAuthentication: void 0, env: clientAppEnv };
|
|
@@ -77,7 +84,7 @@ function resolveACPProviderAuthentication({
|
|
|
77
84
|
env: clientAppEnv
|
|
78
85
|
};
|
|
79
86
|
}
|
|
80
|
-
const mode = auth.mode
|
|
87
|
+
const mode = resolveACPProviderAuthenticationMode(auth.mode);
|
|
81
88
|
if (mode === "direct") {
|
|
82
89
|
return {
|
|
83
90
|
providerAuthentication: { type: "direct" },
|
|
@@ -86,11 +93,11 @@ function resolveACPProviderAuthentication({
|
|
|
86
93
|
}
|
|
87
94
|
const gateway = compatibility?.type === "ai-gateway" ? {
|
|
88
95
|
apiKey: resolveGatewayCredential({
|
|
89
|
-
env,
|
|
96
|
+
env: resolvedEnv,
|
|
90
97
|
credentialSource: compatibility.credentialSource
|
|
91
98
|
}),
|
|
92
99
|
baseUrl: compatibility.baseUrl
|
|
93
|
-
} : getAiGatewayAuthFromEnv({ env });
|
|
100
|
+
} : getAiGatewayAuthFromEnv({ env: resolvedEnv });
|
|
94
101
|
const apiKey = gateway.apiKey;
|
|
95
102
|
if (compatibility == null && mode === "auto" && apiKey == null) {
|
|
96
103
|
return {
|
|
@@ -120,14 +127,16 @@ function resolveACPProviderAuthenticationCompatibility({
|
|
|
120
127
|
providerAuthentication,
|
|
121
128
|
env
|
|
122
129
|
}) {
|
|
130
|
+
const resolvedEnv = resolveACPAuthenticationEnvironment({
|
|
131
|
+
auth,
|
|
132
|
+
env
|
|
133
|
+
});
|
|
123
134
|
if (providerAuthentication == null) return void 0;
|
|
124
|
-
const mode = auth;
|
|
135
|
+
const mode = resolveACPProviderAuthenticationMode(auth);
|
|
125
136
|
if (mode === "direct") {
|
|
126
137
|
return { type: "direct", mode };
|
|
127
138
|
}
|
|
128
|
-
const credentialSource = resolveGatewayCredentialSource({
|
|
129
|
-
env
|
|
130
|
-
});
|
|
139
|
+
const credentialSource = resolveGatewayCredentialSource({ env: resolvedEnv });
|
|
131
140
|
if (mode === "auto" && credentialSource == null) {
|
|
132
141
|
return { type: "direct", mode };
|
|
133
142
|
}
|
|
@@ -136,9 +145,18 @@ function resolveACPProviderAuthenticationCompatibility({
|
|
|
136
145
|
mode,
|
|
137
146
|
env: providerAuthentication.gateway.env,
|
|
138
147
|
credentialSource,
|
|
139
|
-
baseUrl:
|
|
148
|
+
baseUrl: resolvedEnv.AI_GATEWAY_BASE_URL ?? DEFAULT_AI_GATEWAY_BASE_URL
|
|
140
149
|
};
|
|
141
150
|
}
|
|
151
|
+
function resolveACPProviderAuthenticationMode(auth) {
|
|
152
|
+
return typeof auth === "string" || auth == null ? auth ?? "auto" : "auto";
|
|
153
|
+
}
|
|
154
|
+
function resolveACPAuthenticationEnvironment({
|
|
155
|
+
auth,
|
|
156
|
+
env
|
|
157
|
+
}) {
|
|
158
|
+
return isHarnessAuthenticationEnvironment(auth) ? auth : env;
|
|
159
|
+
}
|
|
142
160
|
function resolveGatewayCredentialSource({
|
|
143
161
|
env
|
|
144
162
|
}) {
|
|
@@ -366,18 +384,22 @@ ${implementation.source.command}
|
|
|
366
384
|
}
|
|
367
385
|
function resolveImplementationEnvironment({
|
|
368
386
|
implementation,
|
|
369
|
-
env
|
|
387
|
+
env,
|
|
388
|
+
credentialEnv = env
|
|
370
389
|
}) {
|
|
371
390
|
const forwardedEnvironment = {};
|
|
372
|
-
for (const name of [
|
|
373
|
-
...implementation.forwardEnv ?? [],
|
|
374
|
-
...implementation.credentialEnv ?? []
|
|
375
|
-
]) {
|
|
391
|
+
for (const name of implementation.forwardEnv ?? []) {
|
|
376
392
|
const value = env[name];
|
|
377
393
|
if (value != null && value.length > 0) {
|
|
378
394
|
forwardedEnvironment[name] = value;
|
|
379
395
|
}
|
|
380
396
|
}
|
|
397
|
+
for (const name of implementation.credentialEnv ?? []) {
|
|
398
|
+
const value = credentialEnv[name];
|
|
399
|
+
if (value != null && value.length > 0) {
|
|
400
|
+
forwardedEnvironment[name] = value;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
381
403
|
return {
|
|
382
404
|
...forwardedEnvironment,
|
|
383
405
|
...implementation.env
|
|
@@ -1260,6 +1282,10 @@ function createACPV1({
|
|
|
1260
1282
|
}
|
|
1261
1283
|
const permissionMode = startOptions.permissionMode ?? "allow-all";
|
|
1262
1284
|
const env = { ...process.env };
|
|
1285
|
+
const authenticationEnvironment = resolveACPAuthenticationEnvironment({
|
|
1286
|
+
auth: settings.auth,
|
|
1287
|
+
env
|
|
1288
|
+
});
|
|
1263
1289
|
const providerAuthenticationCompatibility = resolveACPProviderAuthenticationCompatibility({
|
|
1264
1290
|
auth: settings.auth,
|
|
1265
1291
|
providerAuthentication: settings.providerAuthentication,
|
|
@@ -1322,7 +1348,8 @@ function createACPV1({
|
|
|
1322
1348
|
}
|
|
1323
1349
|
const implementationEnvironment = resolveImplementationEnvironment({
|
|
1324
1350
|
implementation,
|
|
1325
|
-
env
|
|
1351
|
+
env,
|
|
1352
|
+
credentialEnv: authenticationEnvironment
|
|
1326
1353
|
});
|
|
1327
1354
|
let sandboxImplementationEnvironment = implementationEnvironment;
|
|
1328
1355
|
let sandboxProviderAuthenticationEnvironment = resolvedProviderAuthentication.env;
|
|
@@ -2601,7 +2628,7 @@ function deserializeBridgeError({
|
|
|
2601
2628
|
}
|
|
2602
2629
|
|
|
2603
2630
|
// src/version.ts
|
|
2604
|
-
var VERSION = true ? "1.0.
|
|
2631
|
+
var VERSION = true ? "1.0.30" : "0.0.0-test";
|
|
2605
2632
|
|
|
2606
2633
|
// src/acp-harness.ts
|
|
2607
2634
|
var ACP_CLIENT_APP = {
|