@ai-sdk/harness-acp 1.0.55 → 1.0.57
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 +18 -0
- package/dist/bridge/host-tool-mcp.mjs +1 -1
- package/dist/bridge/index.mjs +1 -1
- package/dist/bridge/pnpm-lock.yaml +32 -32
- package/dist/index.d.ts +8 -0
- package/dist/index.js +45 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/acp-harness.ts +9 -0
- package/src/v1/acp-v1-harness.ts +49 -6
- package/src/v1/bridge/pnpm-lock.yaml +32 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/harness-acp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ai-sdk/harness": "1.0.
|
|
29
|
+
"@ai-sdk/harness": "1.0.119",
|
|
30
30
|
"@ai-sdk/provider-utils": "5.0.45",
|
|
31
31
|
"ws": "^8.21.0"
|
|
32
32
|
},
|
package/src/acp-harness.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type HarnessV1MintBridgeTokenCallback,
|
|
6
6
|
type HarnessV1PortEndpoint,
|
|
7
7
|
} from '@ai-sdk/harness';
|
|
8
|
+
import type { SandboxChannelReconnectOptions } from '@ai-sdk/harness/utils';
|
|
8
9
|
import type { ToolSet } from '@ai-sdk/provider-utils';
|
|
9
10
|
import { z } from 'zod/v4';
|
|
10
11
|
import type { ACPAuthenticationMode, ACPClientApp } from './acp-auth';
|
|
@@ -45,6 +46,13 @@ export type ACPHarnessSettings<
|
|
|
45
46
|
*/
|
|
46
47
|
readonly portEndpoint?: HarnessV1PortEndpoint;
|
|
47
48
|
readonly startupTimeoutMs?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Configures reconnection attempts after an established bridge connection
|
|
51
|
+
* drops. The reconnect window includes connection establishment and
|
|
52
|
+
* backoff delays. Defaults to 30 seconds with exponential backoff from 50
|
|
53
|
+
* milliseconds up to 2 seconds.
|
|
54
|
+
*/
|
|
55
|
+
readonly reconnect?: SandboxChannelReconnectOptions;
|
|
48
56
|
readonly clientApp?: ACPClientApp;
|
|
49
57
|
readonly version?: ACPV1Settings['version'];
|
|
50
58
|
readonly harnessId: ACPV1Settings['harnessId'];
|
|
@@ -192,6 +200,7 @@ export function createACP<
|
|
|
192
200
|
port: settings.port,
|
|
193
201
|
portEndpoint: settings.portEndpoint,
|
|
194
202
|
startupTimeoutMs: settings.startupTimeoutMs,
|
|
203
|
+
reconnect: settings.reconnect,
|
|
195
204
|
clientApp,
|
|
196
205
|
lifecycleStateSchema: acpResumeStateSchema satisfies z.ZodType<{
|
|
197
206
|
bridge?: ACPBridgeCoords;
|
package/src/v1/acp-v1-harness.ts
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
withBridgeToken,
|
|
35
35
|
writeInstructions,
|
|
36
36
|
writeSkills,
|
|
37
|
+
type SandboxChannelReconnectOptions,
|
|
37
38
|
} from '@ai-sdk/harness/utils';
|
|
38
39
|
import {
|
|
39
40
|
asSchema,
|
|
@@ -130,6 +131,7 @@ export function createACPV1<TBuiltinTools extends ToolSet = {}>({
|
|
|
130
131
|
port: portOverride,
|
|
131
132
|
portEndpoint: portEndpointOverride,
|
|
132
133
|
startupTimeoutMs,
|
|
134
|
+
reconnect,
|
|
133
135
|
clientApp,
|
|
134
136
|
lifecycleStateSchema,
|
|
135
137
|
}: {
|
|
@@ -138,6 +140,7 @@ export function createACPV1<TBuiltinTools extends ToolSet = {}>({
|
|
|
138
140
|
port?: number;
|
|
139
141
|
portEndpoint?: HarnessV1PortEndpoint;
|
|
140
142
|
startupTimeoutMs?: number;
|
|
143
|
+
reconnect?: SandboxChannelReconnectOptions;
|
|
141
144
|
clientApp: ACPClientApp;
|
|
142
145
|
lifecycleStateSchema: NonNullable<
|
|
143
146
|
HarnessV1<TBuiltinTools>['lifecycleStateSchema']
|
|
@@ -441,11 +444,13 @@ export function createACPV1<TBuiltinTools extends ToolSet = {}>({
|
|
|
441
444
|
token: coords.token,
|
|
442
445
|
});
|
|
443
446
|
const attachChannel: ACPChannel = new SandboxChannel({
|
|
444
|
-
connect: () =>
|
|
447
|
+
connect: ({ abortSignal }) =>
|
|
448
|
+
openWebSocket({ ...attachEndpoint, abortSignal }),
|
|
445
449
|
outboundSchema: outboundMessageSchema,
|
|
446
450
|
initialLastSeenEventId: coords.lastSeenEventId,
|
|
447
451
|
onDiagnostic,
|
|
448
452
|
onBridgeError,
|
|
453
|
+
reconnect,
|
|
449
454
|
});
|
|
450
455
|
await attachChannel.open(isContinue ? { resume: true } : undefined);
|
|
451
456
|
return createSession({
|
|
@@ -700,13 +705,15 @@ export function createACPV1<TBuiltinTools extends ToolSet = {}>({
|
|
|
700
705
|
});
|
|
701
706
|
const bridgeEndpoint = withBridgeToken({ endpoint, token });
|
|
702
707
|
const channel: ACPChannel = new SandboxChannel({
|
|
703
|
-
connect: () =>
|
|
708
|
+
connect: ({ abortSignal }) =>
|
|
709
|
+
openWebSocket({ ...bridgeEndpoint, abortSignal }),
|
|
704
710
|
outboundSchema: outboundMessageSchema,
|
|
705
711
|
...(respawnStrategy?.mode === 'disk-replay'
|
|
706
712
|
? { initialLastSeenEventId: respawnStrategy.afterSeq }
|
|
707
713
|
: {}),
|
|
708
714
|
onDiagnostic,
|
|
709
715
|
onBridgeError,
|
|
716
|
+
reconnect,
|
|
710
717
|
});
|
|
711
718
|
await channel.open(
|
|
712
719
|
respawnStrategy?.mode === 'disk-replay' ? { resume: true } : undefined,
|
|
@@ -1009,21 +1016,57 @@ async function resolveBridgeEndpoint({
|
|
|
1009
1016
|
function openWebSocket({
|
|
1010
1017
|
url,
|
|
1011
1018
|
headers,
|
|
1012
|
-
|
|
1019
|
+
abortSignal,
|
|
1020
|
+
}: HarnessV1PortEndpoint & { abortSignal: AbortSignal }): Promise<WebSocket> {
|
|
1013
1021
|
return new Promise((resolve, reject) => {
|
|
1022
|
+
if (abortSignal.aborted) {
|
|
1023
|
+
reject(abortSignal.reason ?? new Error('WebSocket connection aborted'));
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1014
1027
|
const ws = new WebSocket(url, {
|
|
1015
1028
|
headers: headers == null ? undefined : { ...headers },
|
|
1016
1029
|
});
|
|
1017
|
-
|
|
1030
|
+
|
|
1031
|
+
let settled = false;
|
|
1032
|
+
const cleanup = () => {
|
|
1033
|
+
abortSignal.removeEventListener('abort', onAbort);
|
|
1034
|
+
ws.off('open', onOpen);
|
|
1018
1035
|
ws.off('error', onError);
|
|
1036
|
+
};
|
|
1037
|
+
const rejectWithCleanup = (error: unknown) => {
|
|
1038
|
+
if (settled) return;
|
|
1039
|
+
settled = true;
|
|
1040
|
+
cleanup();
|
|
1041
|
+
ws.once('error', () => {});
|
|
1042
|
+
try {
|
|
1043
|
+
ws.terminate();
|
|
1044
|
+
} catch {
|
|
1045
|
+
try {
|
|
1046
|
+
ws.close();
|
|
1047
|
+
} catch {
|
|
1048
|
+
// best-effort
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
reject(error);
|
|
1052
|
+
};
|
|
1053
|
+
const onOpen = () => {
|
|
1054
|
+
if (settled) return;
|
|
1055
|
+
settled = true;
|
|
1056
|
+
cleanup();
|
|
1019
1057
|
resolve(ws);
|
|
1020
1058
|
};
|
|
1021
1059
|
const onError = (error: Error) => {
|
|
1022
|
-
|
|
1023
|
-
reject(error);
|
|
1060
|
+
rejectWithCleanup(error);
|
|
1024
1061
|
};
|
|
1062
|
+
const onAbort = () =>
|
|
1063
|
+
rejectWithCleanup(
|
|
1064
|
+
abortSignal.reason ?? new Error('WebSocket connection aborted'),
|
|
1065
|
+
);
|
|
1066
|
+
|
|
1025
1067
|
ws.once('open', onOpen);
|
|
1026
1068
|
ws.once('error', onError);
|
|
1069
|
+
abortSignal.addEventListener('abort', onAbort, { once: true });
|
|
1027
1070
|
});
|
|
1028
1071
|
}
|
|
1029
1072
|
|
|
@@ -154,8 +154,8 @@ packages:
|
|
|
154
154
|
resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}
|
|
155
155
|
engines: {node: '>=18.0.0'}
|
|
156
156
|
|
|
157
|
-
express-rate-limit@8.
|
|
158
|
-
resolution: {integrity: sha512-
|
|
157
|
+
express-rate-limit@8.7.0:
|
|
158
|
+
resolution: {integrity: sha512-hOwV7WOxXfjRpAM1DSJWZDXx3GhplwD8IfwuwvogD8i1Qnkgosw/H45s4ZnFAUHDAhPjlY9hLBvJhKmGMyY26g==}
|
|
159
159
|
engines: {node: '>= 16'}
|
|
160
160
|
peerDependencies:
|
|
161
161
|
express: '>= 4.11'
|
|
@@ -167,8 +167,8 @@ packages:
|
|
|
167
167
|
fast-deep-equal@3.1.3:
|
|
168
168
|
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
|
169
169
|
|
|
170
|
-
fast-uri@3.1.
|
|
171
|
-
resolution: {integrity: sha512-
|
|
170
|
+
fast-uri@3.1.8:
|
|
171
|
+
resolution: {integrity: sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==}
|
|
172
172
|
|
|
173
173
|
finalhandler@2.1.1:
|
|
174
174
|
resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==}
|
|
@@ -205,8 +205,8 @@ packages:
|
|
|
205
205
|
resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==}
|
|
206
206
|
engines: {node: '>= 0.4'}
|
|
207
207
|
|
|
208
|
-
hono@4.13.
|
|
209
|
-
resolution: {integrity: sha512
|
|
208
|
+
hono@4.13.8:
|
|
209
|
+
resolution: {integrity: sha512-/Gng7NfoykZl2pjukW5Z6+8Yxm3BPRf86GTbQnt0SbySkvax4fyL4H3HhY1cCpBGmiW9XDRFzRV+CXK2W8QudQ==}
|
|
210
210
|
engines: {node: '>=16.9.0'}
|
|
211
211
|
|
|
212
212
|
http-errors@2.0.1:
|
|
@@ -220,8 +220,8 @@ packages:
|
|
|
220
220
|
inherits@2.0.4:
|
|
221
221
|
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
|
222
222
|
|
|
223
|
-
ip-address@10.
|
|
224
|
-
resolution: {integrity: sha512-
|
|
223
|
+
ip-address@10.7.2:
|
|
224
|
+
resolution: {integrity: sha512-7H/2gFSIitxc0hG3nOI1glS8QLo/EHBFFLk8vEUjXY/xu0AdL8jZ9U1IzO2PUm0d2D/ofQcAifb0g6OBkt8U7w==}
|
|
225
225
|
engines: {node: '>= 12'}
|
|
226
226
|
|
|
227
227
|
ipaddr.js@1.9.1:
|
|
@@ -234,8 +234,8 @@ packages:
|
|
|
234
234
|
isexe@2.0.0:
|
|
235
235
|
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
|
236
236
|
|
|
237
|
-
jose@6.2.
|
|
238
|
-
resolution: {integrity: sha512-
|
|
237
|
+
jose@6.2.12:
|
|
238
|
+
resolution: {integrity: sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==}
|
|
239
239
|
|
|
240
240
|
json-schema-traverse@1.0.0:
|
|
241
241
|
resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
|
|
@@ -300,12 +300,12 @@ packages:
|
|
|
300
300
|
resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==}
|
|
301
301
|
engines: {node: '>=16.20.0'}
|
|
302
302
|
|
|
303
|
-
proxy-addr@2.0.
|
|
304
|
-
resolution: {integrity: sha512-
|
|
303
|
+
proxy-addr@2.0.8:
|
|
304
|
+
resolution: {integrity: sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==}
|
|
305
305
|
engines: {node: '>= 0.10'}
|
|
306
306
|
|
|
307
|
-
qs@6.
|
|
308
|
-
resolution: {integrity: sha512-
|
|
307
|
+
qs@6.16.0:
|
|
308
|
+
resolution: {integrity: sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==}
|
|
309
309
|
engines: {node: '>=0.6'}
|
|
310
310
|
|
|
311
311
|
range-parser@1.3.0:
|
|
@@ -416,13 +416,13 @@ snapshots:
|
|
|
416
416
|
dependencies:
|
|
417
417
|
zod: 4.4.3
|
|
418
418
|
|
|
419
|
-
'@hono/node-server@2.1.1(hono@4.13.
|
|
419
|
+
'@hono/node-server@2.1.1(hono@4.13.8)':
|
|
420
420
|
dependencies:
|
|
421
|
-
hono: 4.13.
|
|
421
|
+
hono: 4.13.8
|
|
422
422
|
|
|
423
423
|
'@modelcontextprotocol/sdk@1.30.0(zod@4.4.3)':
|
|
424
424
|
dependencies:
|
|
425
|
-
'@hono/node-server': 2.1.1(hono@4.13.
|
|
425
|
+
'@hono/node-server': 2.1.1(hono@4.13.8)
|
|
426
426
|
ajv: 8.20.0
|
|
427
427
|
ajv-formats: 3.0.1(ajv@8.20.0)
|
|
428
428
|
content-type: 1.0.5
|
|
@@ -431,9 +431,9 @@ snapshots:
|
|
|
431
431
|
eventsource: 3.0.7
|
|
432
432
|
eventsource-parser: 3.1.1
|
|
433
433
|
express: 5.2.1
|
|
434
|
-
express-rate-limit: 8.
|
|
435
|
-
hono: 4.13.
|
|
436
|
-
jose: 6.2.
|
|
434
|
+
express-rate-limit: 8.7.0(express@5.2.1)
|
|
435
|
+
hono: 4.13.8
|
|
436
|
+
jose: 6.2.12
|
|
437
437
|
json-schema-typed: 8.0.2
|
|
438
438
|
pkce-challenge: 5.0.1
|
|
439
439
|
raw-body: 3.0.2
|
|
@@ -454,7 +454,7 @@ snapshots:
|
|
|
454
454
|
ajv@8.20.0:
|
|
455
455
|
dependencies:
|
|
456
456
|
fast-deep-equal: 3.1.3
|
|
457
|
-
fast-uri: 3.1.
|
|
457
|
+
fast-uri: 3.1.8
|
|
458
458
|
json-schema-traverse: 1.0.0
|
|
459
459
|
require-from-string: 2.0.2
|
|
460
460
|
|
|
@@ -466,7 +466,7 @@ snapshots:
|
|
|
466
466
|
http-errors: 2.0.1
|
|
467
467
|
iconv-lite: 0.7.3
|
|
468
468
|
on-finished: 2.4.1
|
|
469
|
-
qs: 6.
|
|
469
|
+
qs: 6.16.0
|
|
470
470
|
raw-body: 3.0.2
|
|
471
471
|
type-is: 2.1.0
|
|
472
472
|
transitivePeerDependencies:
|
|
@@ -539,11 +539,11 @@ snapshots:
|
|
|
539
539
|
dependencies:
|
|
540
540
|
eventsource-parser: 3.1.1
|
|
541
541
|
|
|
542
|
-
express-rate-limit@8.
|
|
542
|
+
express-rate-limit@8.7.0(express@5.2.1):
|
|
543
543
|
dependencies:
|
|
544
544
|
debug: 4.4.3
|
|
545
545
|
express: 5.2.1
|
|
546
|
-
ip-address: 10.
|
|
546
|
+
ip-address: 10.7.2
|
|
547
547
|
transitivePeerDependencies:
|
|
548
548
|
- supports-color
|
|
549
549
|
|
|
@@ -568,8 +568,8 @@ snapshots:
|
|
|
568
568
|
on-finished: 2.4.1
|
|
569
569
|
once: 1.4.0
|
|
570
570
|
parseurl: 1.3.3
|
|
571
|
-
proxy-addr: 2.0.
|
|
572
|
-
qs: 6.
|
|
571
|
+
proxy-addr: 2.0.8
|
|
572
|
+
qs: 6.16.0
|
|
573
573
|
range-parser: 1.3.0
|
|
574
574
|
router: 2.2.0
|
|
575
575
|
send: 1.2.1
|
|
@@ -582,7 +582,7 @@ snapshots:
|
|
|
582
582
|
|
|
583
583
|
fast-deep-equal@3.1.3: {}
|
|
584
584
|
|
|
585
|
-
fast-uri@3.1.
|
|
585
|
+
fast-uri@3.1.8: {}
|
|
586
586
|
|
|
587
587
|
finalhandler@2.1.1:
|
|
588
588
|
dependencies:
|
|
@@ -627,7 +627,7 @@ snapshots:
|
|
|
627
627
|
dependencies:
|
|
628
628
|
function-bind: 1.1.2
|
|
629
629
|
|
|
630
|
-
hono@4.13.
|
|
630
|
+
hono@4.13.8: {}
|
|
631
631
|
|
|
632
632
|
http-errors@2.0.1:
|
|
633
633
|
dependencies:
|
|
@@ -643,7 +643,7 @@ snapshots:
|
|
|
643
643
|
|
|
644
644
|
inherits@2.0.4: {}
|
|
645
645
|
|
|
646
|
-
ip-address@10.
|
|
646
|
+
ip-address@10.7.2: {}
|
|
647
647
|
|
|
648
648
|
ipaddr.js@1.9.1: {}
|
|
649
649
|
|
|
@@ -651,7 +651,7 @@ snapshots:
|
|
|
651
651
|
|
|
652
652
|
isexe@2.0.0: {}
|
|
653
653
|
|
|
654
|
-
jose@6.2.
|
|
654
|
+
jose@6.2.12: {}
|
|
655
655
|
|
|
656
656
|
json-schema-traverse@1.0.0: {}
|
|
657
657
|
|
|
@@ -695,12 +695,12 @@ snapshots:
|
|
|
695
695
|
|
|
696
696
|
pkce-challenge@5.0.1: {}
|
|
697
697
|
|
|
698
|
-
proxy-addr@2.0.
|
|
698
|
+
proxy-addr@2.0.8:
|
|
699
699
|
dependencies:
|
|
700
700
|
forwarded: 0.2.0
|
|
701
701
|
ipaddr.js: 1.9.1
|
|
702
702
|
|
|
703
|
-
qs@6.
|
|
703
|
+
qs@6.16.0:
|
|
704
704
|
dependencies:
|
|
705
705
|
es-define-property: 1.0.1
|
|
706
706
|
side-channel: 1.1.1
|