@ai-sdk/harness-acp 1.0.7 → 1.0.9
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 +19 -0
- package/README.md +17 -4
- package/dist/bridge/host-tool-mcp.mjs +1 -1
- package/dist/bridge/index.mjs +4 -3
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.js +349 -105
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/acp-harness.ts +10 -0
- package/src/index.ts +1 -0
- package/src/v1/acp-bootstrap.ts +119 -0
- package/src/v1/acp-v1-harness.ts +163 -118
- package/src/v1/acp-v1-settings.ts +12 -1
- package/src/v1/bridge/acp-v1-bridge-environment.ts +4 -0
- package/src/v1/bridge/index.ts +10 -8
- package/src/v1/implementation.ts +25 -1
- package/src/v1/index.ts +1 -0
package/src/v1/implementation.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type ACPNpmImplementation = {
|
|
|
23
23
|
readonly executable: string;
|
|
24
24
|
readonly args?: ReadonlyArray<string>;
|
|
25
25
|
readonly forwardEnv?: ReadonlyArray<string>;
|
|
26
|
+
readonly credentialEnv?: ReadonlyArray<string>;
|
|
26
27
|
readonly env?: Readonly<Record<string, string>>;
|
|
27
28
|
};
|
|
28
29
|
|
|
@@ -36,6 +37,7 @@ export function createACPV1Implementation({
|
|
|
36
37
|
executable: settings.executable,
|
|
37
38
|
args: settings.args,
|
|
38
39
|
forwardEnv: settings.forwardEnv,
|
|
40
|
+
credentialEnv: settings.credentialEnv,
|
|
39
41
|
env: settings.env,
|
|
40
42
|
};
|
|
41
43
|
}
|
|
@@ -68,14 +70,28 @@ export function validateACPV1Implementation(
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
validateForwardEnvironment({ forwardEnv: implementation.forwardEnv });
|
|
73
|
+
validateForwardEnvironment({ forwardEnv: implementation.credentialEnv });
|
|
71
74
|
validateEnvironment({ env: implementation.env });
|
|
72
75
|
const forwardedKeys = new Set(implementation.forwardEnv ?? []);
|
|
76
|
+
const credentialKeys = new Set(implementation.credentialEnv ?? []);
|
|
77
|
+
for (const key of credentialKeys) {
|
|
78
|
+
if (forwardedKeys.has(key)) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`ACP runtime environment key ${JSON.stringify(key)} cannot be configured in both forwardEnv and credentialEnv.`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
73
84
|
for (const key of Object.keys(implementation.env ?? {})) {
|
|
74
85
|
if (forwardedKeys.has(key)) {
|
|
75
86
|
throw new Error(
|
|
76
87
|
`ACP runtime environment key ${JSON.stringify(key)} cannot be configured in both forwardEnv and env.`,
|
|
77
88
|
);
|
|
78
89
|
}
|
|
90
|
+
if (credentialKeys.has(key)) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`ACP runtime environment key ${JSON.stringify(key)} cannot be configured in both credentialEnv and env.`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
79
95
|
}
|
|
80
96
|
}
|
|
81
97
|
|
|
@@ -165,6 +181,9 @@ export function createImplementationIdentity({
|
|
|
165
181
|
const forwardedEnvironment = [
|
|
166
182
|
...new Set(implementation.forwardEnv ?? []),
|
|
167
183
|
].sort();
|
|
184
|
+
const credentialEnvironment = [
|
|
185
|
+
...new Set(implementation.credentialEnv ?? []),
|
|
186
|
+
].sort();
|
|
168
187
|
const literalEnvironment = Object.fromEntries(
|
|
169
188
|
Object.entries(implementation.env ?? {})
|
|
170
189
|
.sort(([left], [right]) => left.localeCompare(right))
|
|
@@ -179,6 +198,7 @@ export function createImplementationIdentity({
|
|
|
179
198
|
clientApp,
|
|
180
199
|
environment: {
|
|
181
200
|
forwarded: forwardedEnvironment,
|
|
201
|
+
credential: credentialEnvironment,
|
|
182
202
|
literal: literalEnvironment,
|
|
183
203
|
},
|
|
184
204
|
providerAuthentication: providerAuthentication ?? null,
|
|
@@ -213,7 +233,10 @@ export function resolveImplementationEnvironment({
|
|
|
213
233
|
env: Readonly<Record<string, string | undefined>>;
|
|
214
234
|
}): Record<string, string> {
|
|
215
235
|
const forwardedEnvironment: Record<string, string> = {};
|
|
216
|
-
for (const name of
|
|
236
|
+
for (const name of [
|
|
237
|
+
...(implementation.forwardEnv ?? []),
|
|
238
|
+
...(implementation.credentialEnv ?? []),
|
|
239
|
+
]) {
|
|
217
240
|
const value = env[name];
|
|
218
241
|
if (value != null && value.length > 0) {
|
|
219
242
|
forwardedEnvironment[name] = value;
|
|
@@ -284,6 +307,7 @@ function getImplementationEnvironmentKeys({
|
|
|
284
307
|
return [
|
|
285
308
|
...new Set([
|
|
286
309
|
...(implementation.forwardEnv ?? []),
|
|
310
|
+
...(implementation.credentialEnv ?? []),
|
|
287
311
|
...Object.keys(implementation.env ?? {}),
|
|
288
312
|
]),
|
|
289
313
|
].sort();
|