@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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @ai-sdk/harness-acp
2
2
 
3
+ ## 1.0.57
4
+
5
+ ### Patch Changes
6
+
7
+ - 2adbb77: feat(harness): update underlying harness SDKs to their latest versions
8
+ - Updated dependencies [125f493]
9
+ - @ai-sdk/harness@1.0.119
10
+
11
+ ## 1.0.56
12
+
13
+ ### Patch Changes
14
+
15
+ - d975097: feat(harness): add `AbortSignal` to `SandboxChannel.connect`, plus a `sleep()` helper function
16
+ - c0e5d1d: feat(harness): allow consumers of bridge backed harnesses to configure `reconnect` timeout
17
+ - Updated dependencies [d975097]
18
+ - Updated dependencies [b2baeba]
19
+ - @ai-sdk/harness@1.0.118
20
+
3
21
  ## 1.0.55
4
22
 
5
23
  ### 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.55" : "0.0.0-test";
15
+ var VERSION = true ? "1.0.57" : "0.0.0-test";
16
16
  function createHostToolMCPServer({
17
17
  tools: tools2,
18
18
  revision = 1,
@@ -2416,7 +2416,7 @@ import {
2416
2416
  ListToolsRequestSchema,
2417
2417
  McpError
2418
2418
  } from "@modelcontextprotocol/sdk/types.js";
2419
- var VERSION = true ? "1.0.55" : "0.0.0-test";
2419
+ var VERSION = true ? "1.0.57" : "0.0.0-test";
2420
2420
  function createHostToolMCPServer({
2421
2421
  tools,
2422
2422
  revision = 1,
@@ -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.6.2:
158
- resolution: {integrity: sha512-YH4ru+eOJxQABscKFfRCy9R7x9QFGdezclVMwwgFFndzS2Xnm0uo6B0ABZsLhcpeptGv2qvuJVWlQr9gQZoC3A==}
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.6:
171
- resolution: {integrity: sha512-7Ical1vFEMr0onbVzEDIreM22I4khW+fzyQPwvAFWBp1iwdshSZRsL4jjRvPG9JP1uiqMHRto+YU6R2/CzDz5Q==}
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.4:
209
- resolution: {integrity: sha512-AGEwKIyRMHRv1t8Wjwa3LHxQ61X5CqrdFT+4BRNTpqS5aJNnpl5WLjADb7vFlJzI/8uK7T5QLVApCMQKNa3LgQ==}
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.5.0:
224
- resolution: {integrity: sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==}
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.10:
238
- resolution: {integrity: sha512-iiW7J9qRFlGxvCOIBDBDxFePQSn7ZMAnrYGhrrOo6siO/MIqwfyilLR27pkfDgUk+raLuzADS8A3S/KLBisc0g==}
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.7:
304
- resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
303
+ proxy-addr@2.0.8:
304
+ resolution: {integrity: sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==}
305
305
  engines: {node: '>= 0.10'}
306
306
 
307
- qs@6.15.3:
308
- resolution: {integrity: sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==}
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.4)':
419
+ '@hono/node-server@2.1.1(hono@4.13.8)':
420
420
  dependencies:
421
- hono: 4.13.4
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.4)
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.6.2(express@5.2.1)
435
- hono: 4.13.4
436
- jose: 6.2.10
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.6
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.15.3
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.6.2(express@5.2.1):
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.5.0
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.7
572
- qs: 6.15.3
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.6: {}
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.4: {}
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.5.0: {}
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.10: {}
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.7:
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.15.3:
703
+ qs@6.16.0:
704
704
  dependencies:
705
705
  es-define-property: 1.0.1
706
706
  side-channel: 1.1.1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { HarnessV1StreamPart, HarnessV1Authentication, HarnessV1RequestTransformation, HarnessV1CredentialForwarding, HarnessV1PermissionMode, HarnessV1MintBridgeTokenCallback, HarnessV1PortEndpoint, HarnessV1, HARNESS_V1_BUILTIN_TOOLS } from '@ai-sdk/harness';
2
+ import { SandboxChannelReconnectOptions } from '@ai-sdk/harness/utils';
2
3
  import { ToolResultPart, ToolSet } from '@ai-sdk/provider-utils';
3
4
 
4
5
  type ACPMetadata = Record<string, unknown>;
@@ -323,6 +324,13 @@ type ACPHarnessSettings<TBuiltinTools extends ToolSet = {}, TAskUserQuestions ex
323
324
  */
324
325
  readonly portEndpoint?: HarnessV1PortEndpoint;
325
326
  readonly startupTimeoutMs?: number;
327
+ /**
328
+ * Configures reconnection attempts after an established bridge connection
329
+ * drops. The reconnect window includes connection establishment and
330
+ * backoff delays. Defaults to 30 seconds with exponential backoff from 50
331
+ * milliseconds up to 2 seconds.
332
+ */
333
+ readonly reconnect?: SandboxChannelReconnectOptions;
326
334
  readonly clientApp?: ACPClientApp;
327
335
  readonly version?: ACPV1Settings['version'];
328
336
  readonly harnessId: ACPV1Settings['harnessId'];
package/dist/index.js CHANGED
@@ -1192,6 +1192,7 @@ function createACPV1({
1192
1192
  port: portOverride,
1193
1193
  portEndpoint: portEndpointOverride,
1194
1194
  startupTimeoutMs,
1195
+ reconnect,
1195
1196
  clientApp,
1196
1197
  lifecycleStateSchema
1197
1198
  }) {
@@ -1438,11 +1439,12 @@ function createACPV1({
1438
1439
  token: coords.token
1439
1440
  });
1440
1441
  const attachChannel = new SandboxChannel({
1441
- connect: () => openWebSocket(attachEndpoint),
1442
+ connect: ({ abortSignal }) => openWebSocket({ ...attachEndpoint, abortSignal }),
1442
1443
  outboundSchema: outboundMessageSchema,
1443
1444
  initialLastSeenEventId: coords.lastSeenEventId,
1444
1445
  onDiagnostic,
1445
- onBridgeError
1446
+ onBridgeError,
1447
+ reconnect
1446
1448
  });
1447
1449
  await attachChannel.open(isContinue ? { resume: true } : void 0);
1448
1450
  return createSession({
@@ -1669,11 +1671,12 @@ function createACPV1({
1669
1671
  });
1670
1672
  const bridgeEndpoint = withBridgeToken({ endpoint, token });
1671
1673
  const channel = new SandboxChannel({
1672
- connect: () => openWebSocket(bridgeEndpoint),
1674
+ connect: ({ abortSignal }) => openWebSocket({ ...bridgeEndpoint, abortSignal }),
1673
1675
  outboundSchema: outboundMessageSchema,
1674
1676
  ...respawnStrategy?.mode === "disk-replay" ? { initialLastSeenEventId: respawnStrategy.afterSeq } : {},
1675
1677
  onDiagnostic,
1676
- onBridgeError
1678
+ onBridgeError,
1679
+ reconnect
1677
1680
  });
1678
1681
  await channel.open(
1679
1682
  respawnStrategy?.mode === "disk-replay" ? { resume: true } : void 0
@@ -1900,22 +1903,54 @@ async function resolveBridgeEndpoint({
1900
1903
  }
1901
1904
  function openWebSocket({
1902
1905
  url,
1903
- headers
1906
+ headers,
1907
+ abortSignal
1904
1908
  }) {
1905
1909
  return new Promise((resolve, reject) => {
1910
+ if (abortSignal.aborted) {
1911
+ reject(abortSignal.reason ?? new Error("WebSocket connection aborted"));
1912
+ return;
1913
+ }
1906
1914
  const ws = new WebSocket(url, {
1907
1915
  headers: headers == null ? void 0 : { ...headers }
1908
1916
  });
1909
- const onOpen = () => {
1917
+ let settled = false;
1918
+ const cleanup = () => {
1919
+ abortSignal.removeEventListener("abort", onAbort);
1920
+ ws.off("open", onOpen);
1910
1921
  ws.off("error", onError);
1922
+ };
1923
+ const rejectWithCleanup = (error) => {
1924
+ if (settled) return;
1925
+ settled = true;
1926
+ cleanup();
1927
+ ws.once("error", () => {
1928
+ });
1929
+ try {
1930
+ ws.terminate();
1931
+ } catch {
1932
+ try {
1933
+ ws.close();
1934
+ } catch {
1935
+ }
1936
+ }
1937
+ reject(error);
1938
+ };
1939
+ const onOpen = () => {
1940
+ if (settled) return;
1941
+ settled = true;
1942
+ cleanup();
1911
1943
  resolve(ws);
1912
1944
  };
1913
1945
  const onError = (error) => {
1914
- ws.off("open", onOpen);
1915
- reject(error);
1946
+ rejectWithCleanup(error);
1916
1947
  };
1948
+ const onAbort = () => rejectWithCleanup(
1949
+ abortSignal.reason ?? new Error("WebSocket connection aborted")
1950
+ );
1917
1951
  ws.once("open", onOpen);
1918
1952
  ws.once("error", onError);
1953
+ abortSignal.addEventListener("abort", onAbort, { once: true });
1919
1954
  });
1920
1955
  }
1921
1956
  function restoreColdACPSession({
@@ -2882,7 +2917,7 @@ function deserializeBridgeError({
2882
2917
  }
2883
2918
 
2884
2919
  // src/version.ts
2885
- var VERSION = true ? "1.0.55" : "0.0.0-test";
2920
+ var VERSION = true ? "1.0.57" : "0.0.0-test";
2886
2921
 
2887
2922
  // src/acp-harness.ts
2888
2923
  var ACP_CLIENT_APP = {
@@ -2952,6 +2987,7 @@ function createACP(settings) {
2952
2987
  port: settings.port,
2953
2988
  portEndpoint: settings.portEndpoint,
2954
2989
  startupTimeoutMs: settings.startupTimeoutMs,
2990
+ reconnect: settings.reconnect,
2955
2991
  clientApp,
2956
2992
  lifecycleStateSchema: acpResumeStateSchema
2957
2993
  });