stitchkit 0.136.1 → 0.136.3

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/browser/socket-io-client.d.ts.map +1 -1
  3. package/dist/browser/socket-io-connection.d.ts +18 -15
  4. package/dist/browser/socket-io-connection.d.ts.map +1 -1
  5. package/dist/browser/socket-io-contract.d.ts +26 -13
  6. package/dist/browser/socket-io-contract.d.ts.map +1 -1
  7. package/dist/browser/socket-io-default-peer.d.ts +1 -1
  8. package/dist/browser/socket-io-default-peer.d.ts.map +1 -1
  9. package/dist/browser/socket-io-explicit-peer.d.ts.map +1 -1
  10. package/dist/browser/socket-io-peer.d.ts +10 -0
  11. package/dist/browser/socket-io-peer.d.ts.map +1 -1
  12. package/dist/entrypoints/agent-executor/codex.js +2 -2
  13. package/dist/entrypoints/agent-executor/testing.js +2 -2
  14. package/dist/entrypoints/agent-runtime/harness.js +4 -4
  15. package/dist/entrypoints/agent-runtime/sandbox.js +1 -1
  16. package/dist/entrypoints/agent-runtime.js +4 -4
  17. package/dist/entrypoints/cli.js +3 -3
  18. package/dist/entrypoints/files/packaging.js +72 -36
  19. package/dist/entrypoints/files.js +1 -1
  20. package/dist/entrypoints/handler.js +4 -4
  21. package/dist/entrypoints/http.js +6 -6
  22. package/dist/entrypoints/index.js +6 -5
  23. package/dist/entrypoints/node.js +3 -3
  24. package/dist/entrypoints/react.js +1 -1
  25. package/dist/entrypoints/realtime.js +3 -2
  26. package/dist/entrypoints/remote.js +2 -2
  27. package/dist/entrypoints/server.js +3 -3
  28. package/dist/entrypoints/sync.js +3 -3
  29. package/dist/entrypoints/testing.js +2 -2
  30. package/dist/entrypoints/tools/agent.js +3 -3
  31. package/dist/entrypoints/tools/invoker.js +2 -2
  32. package/dist/entrypoints/tools/mcp.js +3 -3
  33. package/dist/entrypoints/tools/toolkit.js +5 -5
  34. package/dist/entrypoints/tools.js +4 -4
  35. package/dist/files/client-declarations.d.ts +11 -3
  36. package/dist/files/client-declarations.d.ts.map +1 -1
  37. package/dist/files/client-package.d.ts.map +1 -1
  38. package/dist/{index-63ctzjp4.js → index-18qdpbcq.js} +2 -2
  39. package/dist/{index-8cnfgwg8.js → index-2331y2tf.js} +2 -2
  40. package/dist/{index-c7fj4yw9.js → index-2tgmggcm.js} +1 -1
  41. package/dist/{index-bjrcbcn2.js → index-2zrx0nzv.js} +1 -1
  42. package/dist/{index-yjx5jna7.js → index-3shdhzt6.js} +1 -1
  43. package/dist/{index-ta0e2daw.js → index-cmqvf0dz.js} +2 -2
  44. package/dist/{index-252den5a.js → index-ezwsqyad.js} +2 -2
  45. package/dist/{index-f0dzyskg.js → index-nne3yxew.js} +1 -1
  46. package/dist/{index-n2t87ggz.js → index-rr94xcj6.js} +137 -34
  47. package/dist/{index-y6wzzk2e.js → index-rw31t8sj.js} +1 -1
  48. package/dist/{index-k5azb3v3.js → index-vwg0n3e6.js} +2 -2
  49. package/llms/process.2.txt +2 -3
  50. package/llms/server.2.txt +1 -1
  51. package/llms/server.3.txt +18 -55
  52. package/llms/server.4.txt +56 -1
  53. package/llms/server.5.txt +1 -1
  54. package/llms/server.txt +1 -1
  55. package/llms-full.txt +19 -6
  56. package/llms.txt +1 -1
  57. package/package.json +1 -1
  58. package/dist/{index-b9mj31q7.js → index-9118dw8d.js} +0 -0
  59. package/dist/{index-kp1j7cc8.js → index-ca1v40d3.js} +3 -3
  60. /package/dist/{index-cgjtj8zh.js → index-mhgkzwxz.js} +0 -0
  61. /package/dist/{index-h08xqfw9.js → index-qqd979f7.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -15,6 +15,20 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.136.3] - 2026-12-02
19
+
20
+ ### Fixed
21
+
22
+ - `stitchkit`, `stitchkit/realtime` — a transient failure from `peers.client` (such as a dynamic `import()` chunk-load or network error during a dev-server restart or deploy) now reports `terminal: false` to `onConnectError` and retries automatically with exponential backoff bounded by `reconnectionDelay`, `reconnectionDelayMax`, and `reconnectionAttempts` (counting retries after the initial attempt, matching Socket.IO). Previously any `peers.client` failure was reported as `terminal: true`, leaving the client permanently offline until a manual `connect()`. Permanent peer defects (missing `socket.io-client` package, invalid module returned by `peers.client`, missing explicit peer, default bare-specifier failure) and an exhausted `reconnectionAttempts` budget remain `terminal: true` without further retries; `disconnect()` discards any in-flight load and cancels any pending retry timer; and `reconnectionDelay`, `reconnectionDelayMax`, and `reconnectionAttempts` are validated upfront at client creation.
23
+ **Affects:** `stitchkit` createRealtimeClient, createSocketIOClient; `stitchkit/realtime` createRealtimeClient, createSocketIOClient
24
+
25
+ ## [0.136.2] - 2026-12-02
26
+
27
+ ### Fixed
28
+
29
+ - `stitchkit/files/packaging` — `buildClientPackage` writes its temporary declaration tsconfig inside its temporary build directory instead of beside the project's `tsconfig.json`, so no `.client-package-*.tsconfig.json` file flickers as untracked in Git or editor source control during declaration emission or lingers after an abrupt abort. The temporary host nests symlinks (junctions on Windows) mirroring the project's ancestor `node_modules` chain so monorepo `@types/*` shadowing, non-`@types` `types` packages and explicit relative `typeRoots` keep resolving. → ADR 0343
30
+ **Affects:** `stitchkit/files/packaging` buildClientPackage
31
+
18
32
  ## [0.136.1] - 2026-12-01
19
33
 
20
34
  ### Fixed
@@ -1 +1 @@
1
- {"version":3,"file":"socket-io-client.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAcpF,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAoB,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAK/D,wBAAgB,4BAA4B,CAC1C,KAAK,CAAC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4B,CAC1C,aAAa,SAAS,cAAc,EACpC,aAAa,SAAS,cAAc,EAEpC,MAAM,EAAE,oBAAoB,CAAC,aAAa,CAAC,EAC3C,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,cAAc,CAAC,aAAa,EAAE,aAAa,CAAC,CAE9C"}
@@ -17,23 +17,16 @@ export declare function ioOptions<TServerEvents extends SocketEventMap>(config:
17
17
  timeout: number;
18
18
  };
19
19
  /**
20
- * A peer that will not load is a TERMINAL connection failure, and it is
21
- * reported as one.
20
+ * Report a peer-load failure to `onConnectError`.
22
21
  *
23
- * It used to be an unhandled rejection: `connect()` fired the load and
24
- * nothing was listening on the failure path, so a missing `socket.io-client`
25
- * took the process down at the first connect. The message was already the
26
- * right one — the loader has wrapped the cause in an explanatory error for a
27
- * long time — but an unhandled rejection is not something a caller can act
28
- * on, retry, or report: the only outcome available was the process dying.
29
- * For the self-contained-artifact consumer this adapter's `peers` option
30
- * exists for, that is the worst possible moment to have no choices.
31
- *
32
- * With no `onConnectError` the failure is still re-thrown, so a project that
33
- * asked for nothing keeps today's loud behaviour instead of a silent
34
- * never-connecting client.
22
+ * A permanent failure (`terminal: true` — missing peer, wrong module shape, or
23
+ * exhausted retry budget) re-throws when `onConnectError` is omitted so a
24
+ * silently never-connecting client fails loudly instead. A transient failure
25
+ * (`terminal: false` — e.g. a temporary chunk-load or network error while
26
+ * retries remain) returns silently when `onConnectError` is omitted because
27
+ * automatic retry is already scheduled.
35
28
  */
36
- export declare function reportPeerFailure(config: Pick<SocketIOClientConfig, 'onConnectError'>, error: unknown): void;
29
+ export declare function reportPeerFailure(config: Pick<SocketIOClientConfig, 'onConnectError'>, error: unknown, terminal: boolean): void;
37
30
  /**
38
31
  * One acknowledged emit, settled exactly once: by the acknowledgement, by its
39
32
  * timeout, or by the socket dropping — each a distinguishable rejection.
@@ -66,6 +59,16 @@ export declare function createRecycle(delay: number | false): {
66
59
  clear: () => void;
67
60
  schedule(run: () => void): void;
68
61
  };
62
+ /**
63
+ * Bounded exponential backoff for transient peer-load failures, matching the
64
+ * client's `reconnectionAttempts` (retries after initial attempt),
65
+ * `reconnectionDelay`, and `reconnectionDelayMax` options.
66
+ */
67
+ export declare function createPeerRetry(config: Pick<SocketIOClientConfig, 'reconnectionAttempts' | 'reconnectionDelay' | 'reconnectionDelayMax'>): {
68
+ reset(): void;
69
+ nextRetryDelay(): number | null;
70
+ schedule(wait: number, run: () => void): void;
71
+ };
69
72
  /**
70
73
  * A connection error as the application hears it. `active === false` means
71
74
  * socket.io destroyed its own retry path (a namespace middleware rejection is
@@ -1 +1 @@
1
- {"version":3,"file":"socket-io-connection.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-connection.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,KAAK,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AAarC,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,aAAa,SAAS,cAAc,EAC5D,MAAM,EAAE,oBAAoB,CAAC,aAAa,CAAC;;;0CAXV,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI;;;;;;;;;;EA2BjE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,EACpD,KAAK,EAAE,OAAO,GACb,IAAI,CAON;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,OAAO,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3C,UAAU,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IOClientConfig<TServerEvents extends SocketEventMap = Soc
59
59
  extraHeaders?: Record<string, string>;
60
60
  /** Transports, in preference order. Default `['websocket', 'polling']`. */
61
61
  transports?: Array<'websocket' | 'polling'>;
62
- /** Reconnection attempts. Default `Infinity`. */
62
+ /**
63
+ * Reconnection attempts after the initial attempt (also bounds retries for
64
+ * transient `peers.client` load failures). Default `Infinity`.
65
+ */
63
66
  reconnectionAttempts?: number;
64
- /** Initial reconnection delay (ms). Default `1000`. */
67
+ /**
68
+ * Initial reconnection delay in milliseconds (also used as the starting
69
+ * backoff for transient `peers.client` load failures). Default `1000`.
70
+ */
65
71
  reconnectionDelay?: number;
66
- /** Max reconnection delay (ms). Default `5000`. */
72
+ /**
73
+ * Max reconnection delay in milliseconds (also caps the backoff for
74
+ * transient `peers.client` load failures). Default `5000` (or
75
+ * `reconnectionDelay` when greater).
76
+ */
67
77
  reconnectionDelayMax?: number;
68
78
  /** Connection timeout (ms). Default `20000`. */
69
79
  timeout?: number;
@@ -93,16 +103,19 @@ export interface SocketIOClientConfig<TServerEvents extends SocketEventMap = Soc
93
103
  */
94
104
  retain?: Array<keyof TServerEvents & string>;
95
105
  /**
96
- * Observe handshake/connection failures (`connect_error`). `terminal: true`
97
- * means socket.io will NOT retry on its own — that is how a server-side
98
- * handshake gate rejection (`io.use` middleware / the stitchkit `handshake`
99
- * option, `data.code === 'handshake_rejected'`) arrives, unlike a
100
- * transport-level failure which keeps retrying. On a terminal error the
101
- * client resets its connection intent, so a later `connect()` starts a fresh
102
- * attempt and re-reads a function-form `auth` — the recovery path after
103
- * rotating a rejected token. For transport-level failures (server down) the
104
- * hook fires once **per retry attempt** — debounce before wiring it to
105
- * user-facing alerts.
106
+ * Observe handshake/connection failures (`connect_error`) and peer-loader
107
+ * failures. `terminal: true` means the client will NOT retry on its own —
108
+ * that covers server-side handshake gate rejections (`io.use` middleware /
109
+ * the stitchkit `handshake` option, `data.code === 'handshake_rejected'`),
110
+ * permanent peer defects (missing `socket.io-client` package or invalid
111
+ * module returned by `peers.client`), and an exhausted `reconnectionAttempts`
112
+ * budget. Transient `peers.client` load failures (such as a chunk-load or
113
+ * network error on dynamic `import()`) report `terminal: false` and retry
114
+ * with `reconnectionDelay`..`reconnectionDelayMax` backoff, just like
115
+ * transport-level failures. On a terminal error the client resets its
116
+ * connection intent, so a later `connect()` starts a fresh attempt and
117
+ * re-reads a function-form `auth`. For retrying failures the hook fires once
118
+ * **per retry attempt** — debounce before wiring it to user-facing alerts.
106
119
  */
107
120
  onConnectError?: (error: {
108
121
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"socket-io-contract.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,KAAK,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExF;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAI7B,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB,CAAC,aAAa,SAAS,cAAc,GAAG,cAAc;IACzF,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,IAAI,CAAC,EACD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MA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AAC,CAAC,GACpC,OAAO,CAAC;IACX;;;OAGG;IACH,WAAW,CACT,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB;;;;;;OAMG;IACH,kBAAkB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACzF;AAED,mFAAmF;AACnF,MAAM,WAAW,cAAc,CAC7B,eAAe,SAAS,qBAAqB,EAC7C,eAAe,SAAS,qBAAqB,CAC7C,SAAQ,mBAAmB,CAAC,eAAe,EAAE,eAAe,CAAC;IAC7D,OAAO,IAAI,IAAI,CAAC;IAChB,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB,CAAC,eAAe,SAAS,qBAAqB,CAClF,SAAQ,yBAAyB,EAC/B,oBAAoB,CAAC;KAClB,MAAM,IAAI,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI;CAChE,CAAC;IACJ;;;;OAIG;IACH,cAAc,CAAC,EAAE,wBAAwB,CAAC;CAC3C"}
@@ -1,3 +1,3 @@
1
- import type { IoFn } from './socket-io-peer.js';
1
+ import { type IoFn } from './socket-io-peer.js';
2
2
  export declare function loadDefaultIo(): Promise<IoFn>;
3
3
  //# sourceMappingURL=socket-io-default-peer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"socket-io-default-peer.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-default-peer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAa7C,wBAAgB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAiB7C"}
1
+ {"version":3,"file":"socket-io-default-peer.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-default-peer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAyB,MAAM,kBAAkB,CAAC;AAgBpE,wBAAgB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAiB7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"socket-io-explicit-peer.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-explicit-peer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAKpF,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAS9B,wFAAwF;AACxF,wBAAgB,oBAAoB,CAClC,KAAK,CAAC,eAAe,SAAS,qBAAqB,EACnD,KAAK,CAAC,eAAe,SAAS,qBAAqB,EAEnD,QAAQ,EAAE,gBAAgB,CAAC,eAAe,EAAE,eAAe,CAAC,EAC5D,MAAM,EAAE,qBAAqB,CAAC,eAAe,CAAC,GAAG;IAC/C,KAAK,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC;CAC5C,GACA,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC,CAElD;AAED,uGAAuG;AACvG,wBAAgB,oBAAoB,CAClC,aAAa,SAAS,cAAc,EACpC,aAAa,SAAS,cAAc,EAEpC,MAAM,EAAE,oBAAoB,CAAC,aAAa,CAAC,GAAG;IAAE,KAAK,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAA;CAAE,GAC3F,cAAc,CAAC,aAAa,EAAE,aAAa,CAAC,CAE9C"}
1
+ {"version":3,"file":"socket-io-explicit-peer.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-explicit-peer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAKpF,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAU9B,wFAAwF;AACxF,wBAAgB,oBAAoB,CAClC,KAAK,CAAC,eAAe,SAAS,qBAAqB,EACnD,KAAK,CAAC,eAAe,SAAS,qBAAqB,EAEnD,QAAQ,EAAE,gBAAgB,CAAC,eAAe,EAAE,eAAe,CAAC,EAC5D,MAAM,EAAE,qBAAqB,CAAC,eAAe,CAAC,GAAG;IAC/C,KAAK,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC;CAC5C,GACA,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC,CAElD;AAED,uGAAuG;AACvG,wBAAgB,oBAAoB,CAClC,aAAa,SAAS,cAAc,EACpC,aAAa,SAAS,cAAc,EAEpC,MAAM,EAAE,oBAAoB,CAAC,aAAa,CAAC,GAAG;IAAE,KAAK,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAA;CAAE,GAC3F,cAAc,CAAC,aAAa,EAAE,aAAa,CAAC,CAE9C"}
@@ -1,5 +1,15 @@
1
1
  import type { SocketIOClientPeerLoaders } from './socket-io-contract.js';
2
2
  export type IoFn = typeof import('socket.io-client')['io'];
3
+ /**
4
+ * Permanent peer-loading defect (missing package, wrong module shape, or missing
5
+ * required explicit loader) that retrying cannot fix.
6
+ */
7
+ export declare class TerminalPeerLoadError extends Error {
8
+ constructor(message: string, options?: {
9
+ cause?: unknown;
10
+ });
11
+ }
12
+ export declare function isTerminalPeerLoadError(error: unknown): boolean;
3
13
  /**
4
14
  * One client's way of getting to `io`, memoised.
5
15
  *
@@ -1 +1 @@
1
- {"version":3,"file":"socket-io-peer.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-peer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,MAAM,IAAI,GAAG,cAAc,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;AAc3D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,yBAAyB,CAAC,QAAQ,CAAC,EAC7C,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,MAAM,OAAO,CAAC,IAAI,CAAC,CA2CrB"}
1
+ {"version":3,"file":"socket-io-peer.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io-peer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,MAAM,IAAI,GAAG,cAAc,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;AAE3D;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAGzD;CACF;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/D;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,yBAAyB,CAAC,QAAQ,CAAC,EAC7C,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,MAAM,OAAO,CAAC,IAAI,CAAC,CA2CrB"}
@@ -81,7 +81,7 @@ import {
81
81
  maskedWsFrameByteLength,
82
82
  encodeMaskedWsFrame,
83
83
  createWsFrameDecoder
84
- } from "../../index-c7fj4yw9.js";
84
+ } from "../../index-2tgmggcm.js";
85
85
  import {
86
86
  planLimitsReadFailed2
87
87
  } from "../../index-9m1m92rg.js";
@@ -98,7 +98,7 @@ import"../../index-8cek82ar.js";
98
98
  import"../../index-0sxj3y45.js";
99
99
  import {
100
100
  assertExpectedOwnerUid
101
- } from "../../index-kp1j7cc8.js";
101
+ } from "../../index-ca1v40d3.js";
102
102
  import {
103
103
  errnoOf
104
104
  } from "../../index-jj9228tt.js";
@@ -53,7 +53,7 @@ import {
53
53
  validateCodexUnixSocketPath,
54
54
  encodeUnmaskedWsFrame,
55
55
  createWsFrameDecoder
56
- } from "../../index-c7fj4yw9.js";
56
+ } from "../../index-2tgmggcm.js";
57
57
  import {
58
58
  mergeRateLimitEvent2
59
59
  } from "../../index-9m1m92rg.js";
@@ -70,7 +70,7 @@ import {
70
70
  unlinkUnixSocketIfMatching,
71
71
  assertPrivateUnixSocketDirectory,
72
72
  bindUnixSocket2
73
- } from "../../index-kp1j7cc8.js";
73
+ } from "../../index-ca1v40d3.js";
74
74
  import {
75
75
  setOwnMember
76
76
  } from "../../index-3tb82xr7.js";
@@ -9,13 +9,13 @@ import"../../index-kaq9nb7h.js";
9
9
  import {
10
10
  createAgentRuntime2,
11
11
  composeAgentPrompt2
12
- } from "../../index-8cnfgwg8.js";
12
+ } from "../../index-2331y2tf.js";
13
13
  import"../../index-dsa676h8.js";
14
14
  import"../../index-ha1tv70k.js";
15
15
  import"../../index-d1pdv8qc.js";
16
16
  import"../../index-dm50x3by.js";
17
17
  import"../../index-qj0sq69b.js";
18
- import"../../index-b9mj31q7.js";
18
+ import"../../index-9118dw8d.js";
19
19
  import"../../index-werjqesf.js";
20
20
  import"../../index-m38ej7e5.js";
21
21
  import"../../index-yt1gg11x.js";
@@ -41,9 +41,9 @@ import"../../index-knqye3gv.js";
41
41
  import"../../index-fatke81t.js";
42
42
  import"../../index-gq35s3bm.js";
43
43
  import"../../index-4gbybjg6.js";
44
- import"../../index-k5azb3v3.js";
44
+ import"../../index-vwg0n3e6.js";
45
45
  import"../../index-xrgn784x.js";
46
- import"../../index-bjrcbcn2.js";
46
+ import"../../index-2zrx0nzv.js";
47
47
  import {
48
48
  defineRuntimeTool2
49
49
  } from "../../index-7csn6pva.js";
@@ -29,7 +29,7 @@ import {
29
29
  } from "../../index-s8af9jqw.js";
30
30
  import {
31
31
  bindUnixSocket2
32
- } from "../../index-kp1j7cc8.js";
32
+ } from "../../index-ca1v40d3.js";
33
33
  import"../../index-p9cab61p.js";
34
34
  import"../../index-rjs94dny.js";
35
35
  import"../../index-xrgn784x.js";
@@ -132,7 +132,7 @@ import"../index-dm50x3by.js";
132
132
  import"../index-qj0sq69b.js";
133
133
  import {
134
134
  resolveToolAccess
135
- } from "../index-b9mj31q7.js";
135
+ } from "../index-9118dw8d.js";
136
136
  import"../index-yt1gg11x.js";
137
137
  import"../index-edpkm3k7.js";
138
138
  import"../index-werjqesf.js";
@@ -217,7 +217,7 @@ import {
217
217
  AgentTokenCountSchema2,
218
218
  selectAgentHistory2,
219
219
  composeAgentPrompt2
220
- } from "../index-8cnfgwg8.js";
220
+ } from "../index-2331y2tf.js";
221
221
  import"../index-m38ej7e5.js";
222
222
  import"../index-dmrx8xma.js";
223
223
  import {
@@ -300,10 +300,10 @@ import {
300
300
  import {
301
301
  zodToAgentInputJsonSchema,
302
302
  mountAgentTools2
303
- } from "../index-k5azb3v3.js";
303
+ } from "../index-vwg0n3e6.js";
304
304
  import"../index-rjs94dny.js";
305
305
  import"../index-xrgn784x.js";
306
- import"../index-bjrcbcn2.js";
306
+ import"../index-2zrx0nzv.js";
307
307
  import {
308
308
  defineRuntimeTool2,
309
309
  executableAgentRuntimeTools
@@ -23,9 +23,9 @@ import {
23
23
  extractCliGlobalOptions2,
24
24
  pollUntilDone2,
25
25
  createCli2
26
- } from "../index-63ctzjp4.js";
26
+ } from "../index-18qdpbcq.js";
27
27
  import"../index-edpkm3k7.js";
28
- import"../index-b9mj31q7.js";
28
+ import"../index-9118dw8d.js";
29
29
  import"../index-yt1gg11x.js";
30
30
  import"../index-werjqesf.js";
31
31
  import"../index-0x4mnwg5.js";
@@ -63,7 +63,7 @@ import"../index-xrgn784x.js";
63
63
  import {
64
64
  stringifyJsonSafe
65
65
  } from "../index-9vj869rx.js";
66
- import"../index-bjrcbcn2.js";
66
+ import"../index-2zrx0nzv.js";
67
67
  import"../index-7csn6pva.js";
68
68
  import {
69
69
  safeJsonParse
@@ -157,13 +157,12 @@ async function buildClientArtifact(options) {
157
157
  // src/files/client-package.ts
158
158
  import { createHash as createHash3 } from "node:crypto";
159
159
  import { existsSync as existsSync3 } from "node:fs";
160
- import { copyFile as copyFile2, mkdir as mkdir3, mkdtemp as mkdtemp2, readFile as readFile4, realpath as realpath3, rm as rm3, writeFile as writeFile5 } from "node:fs/promises";
160
+ import { copyFile as copyFile2, mkdir as mkdir4, mkdtemp as mkdtemp3, readFile as readFile4, realpath as realpath4, rm as rm3, writeFile as writeFile5 } from "node:fs/promises";
161
161
  import { tmpdir as tmpdir2 } from "node:os";
162
162
  import { dirname as dirname5, extname, isAbsolute, join as join6, normalize, relative as relative3, resolve as resolve4 } from "node:path";
163
163
 
164
164
  // src/files/client-declarations.ts
165
- import { randomUUID } from "node:crypto";
166
- import { rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
165
+ import { mkdir as mkdir2, mkdtemp as mkdtemp2, realpath, rm as rm2, stat, symlink, writeFile as writeFile2 } from "node:fs/promises";
167
166
  import { builtinModules } from "node:module";
168
167
  import { dirname as dirname3, join as join3, relative } from "node:path";
169
168
 
@@ -412,34 +411,70 @@ function rewriteDeclarationTree(directory, rewrite) {
412
411
  }
413
412
 
414
413
  // src/files/client-declarations.ts
414
+ async function ancestorNodeModules(from) {
415
+ const nearestFirst = [];
416
+ const seen = new Set;
417
+ for (let directory = from;; directory = dirname3(directory)) {
418
+ const candidate = join3(directory, "node_modules");
419
+ const info = await stat(candidate).catch(() => {
420
+ return;
421
+ });
422
+ if (info?.isDirectory()) {
423
+ const target = await realpath(candidate).catch(() => {
424
+ return;
425
+ });
426
+ if (target !== undefined && !seen.has(target)) {
427
+ seen.add(target);
428
+ nearestFirst.push(target);
429
+ }
430
+ }
431
+ const parent = dirname3(directory);
432
+ if (parent === directory)
433
+ break;
434
+ }
435
+ return nearestFirst.reverse();
436
+ }
437
+ async function prepareDeclarationConfigHost(hostRoot, root) {
438
+ const targets = await ancestorNodeModules(root);
439
+ const linkType = process.platform === "win32" ? "junction" : "dir";
440
+ let current = hostRoot;
441
+ for (const [index, target] of targets.entries()) {
442
+ current = join3(current, `d${index}`);
443
+ await mkdir2(current);
444
+ await symlink(target, join3(current, "node_modules"), linkType);
445
+ }
446
+ return current;
447
+ }
415
448
  async function emitClientDeclarations(input) {
416
449
  const root = dirname3(input.tsconfig);
417
- const generated = join3(root, `.client-package-${randomUUID()}.tsconfig.json`);
418
- await writeFile2(generated, `${JSON.stringify({
419
- extends: input.tsconfig,
420
- compilerOptions: {
421
- noEmit: false,
422
- declaration: true,
423
- emitDeclarationOnly: true,
424
- declarationMap: false,
425
- composite: false,
426
- incremental: false,
427
- rootDir: root,
428
- outDir: input.outDir,
429
- declarationDir: input.outDir
430
- },
431
- files: input.entries,
432
- include: []
433
- }, null, 2)}
434
- `);
450
+ const hostRoot = await mkdtemp2(join3(input.work, "declarations-"));
435
451
  try {
452
+ const configHost = await prepareDeclarationConfigHost(hostRoot, root);
453
+ const generated = join3(configHost, "tsconfig.json");
454
+ await writeFile2(generated, `${JSON.stringify({
455
+ extends: input.tsconfig,
456
+ compilerOptions: {
457
+ noEmit: false,
458
+ declaration: true,
459
+ emitDeclarationOnly: true,
460
+ declarationMap: false,
461
+ composite: false,
462
+ incremental: false,
463
+ rootDir: root,
464
+ outDir: input.outDir,
465
+ declarationDir: input.outDir
466
+ },
467
+ files: input.entries,
468
+ include: []
469
+ }, null, 2)}
470
+ `);
436
471
  const [compiler, ...leading] = input.tsc;
437
472
  const emitted = await runClientTool(input.step, compiler, [...leading, "-p", generated], root);
438
473
  if (!emitted.ok) {
439
474
  throw new ClientPackageError("declarations", `Client package declarations failed (exit ${emitted.exit}): ${emitted.output}`, { output: emitted.output });
440
475
  }
441
476
  } finally {
442
- await rm2(generated, { force: true });
477
+ await rm2(hostRoot, { recursive: true, force: true });
443
478
  }
444
479
  }
445
480
  function packageOf(specifier) {
@@ -481,7 +516,7 @@ function undeclared(file, specifier, name) {
481
516
 
482
517
  // src/files/client-package-bundle.ts
483
518
  import { realpathSync } from "node:fs";
484
- import { realpath, writeFile as writeFile3 } from "node:fs/promises";
519
+ import { realpath as realpath2, writeFile as writeFile3 } from "node:fs/promises";
485
520
  import { join as join4 } from "node:path";
486
521
  var REPLACEMENT_LOADERS = {
487
522
  ".json": "json",
@@ -562,7 +597,7 @@ async function bundleClientPackage(input) {
562
597
  const graph = await readClientBuildGraph(metafile, input.root);
563
598
  const bundled = new Set;
564
599
  for (const module of graph.modules.keys())
565
- bundled.add(await realpath(module).catch(() => module));
600
+ bundled.add(await realpath2(module).catch(() => module));
566
601
  for (const module of input.replacements.keys()) {
567
602
  if (bundled.has(realpathSync(module)))
568
603
  continue;
@@ -574,7 +609,7 @@ async function bundleClientPackage(input) {
574
609
  // src/files/client-package-proof.ts
575
610
  import { createHash as createHash2 } from "node:crypto";
576
611
  import { existsSync as existsSync2 } from "node:fs";
577
- import { copyFile, mkdir as mkdir2, readdir, readFile as readFile3, realpath as realpath2, writeFile as writeFile4 } from "node:fs/promises";
612
+ import { copyFile, mkdir as mkdir3, readdir, readFile as readFile3, realpath as realpath3, writeFile as writeFile4 } from "node:fs/promises";
578
613
  import { basename as basename2, dirname as dirname4, join as join5, relative as relative2 } from "node:path";
579
614
  import { z as z3 } from "zod";
580
615
  var InstalledManifestSchema = z3.object({ version: z3.string() });
@@ -582,7 +617,7 @@ async function resolveExternalPackage(from, name) {
582
617
  for (let directory = from;; directory = dirname4(directory)) {
583
618
  const candidate = join5(directory, "node_modules", name);
584
619
  if (existsSync2(join5(candidate, "package.json"))) {
585
- const real = await realpath2(candidate);
620
+ const real = await realpath3(candidate);
586
621
  const manifest = InstalledManifestSchema.parse(safeJsonParse(await readFile3(join5(real, "package.json"), "utf8")));
587
622
  return { directory: real, version: manifest.version };
588
623
  }
@@ -765,7 +800,7 @@ async function proveTypes(input) {
765
800
  export { J${index} };
766
801
  `;
767
802
  })).join(""));
768
- await mkdir2(join5(consumer, "typecheck"));
803
+ await mkdir3(join5(consumer, "typecheck"));
769
804
  for (const [index, source] of (options.proof?.typecheck ?? []).entries()) {
770
805
  const copy = `typecheck/${index}-${basename2(source)}`;
771
806
  await copyFile(source, join5(consumer, copy));
@@ -895,7 +930,7 @@ function planReplacements(options) {
895
930
  }
896
931
  async function refuseBundledExternals(graph, externals) {
897
932
  for (const module of graph.modules.keys()) {
898
- const real = await realpath3(module);
933
+ const real = await realpath4(module);
899
934
  for (const [name, external] of externals) {
900
935
  if (!real.startsWith(`${external.directory}/`))
901
936
  continue;
@@ -916,7 +951,7 @@ async function stage(options, planned, graph, staged) {
916
951
  for (const [subpath, path] of planned.exportedFiles)
917
952
  exported[subpath] = path;
918
953
  for (const [target, source] of planned.files) {
919
- await mkdir3(dirname5(join6(staged, target)), { recursive: true });
954
+ await mkdir4(dirname5(join6(staged, target)), { recursive: true });
920
955
  await copyFile2(source, join6(staged, target));
921
956
  }
922
957
  const present = (record) => record !== undefined && Object.keys(record).length > 0 ? record : undefined;
@@ -939,7 +974,7 @@ async function buildClientPackage(options) {
939
974
  signal: options.signal
940
975
  };
941
976
  const bun = options.executables?.bun ?? "bun";
942
- const work = await mkdtemp2(join6(tmpdir2(), "stitchkit-client-package-"));
977
+ const work = await mkdtemp3(join6(tmpdir2(), "stitchkit-client-package-"));
943
978
  await rm3(planned.tarball, { force: true });
944
979
  try {
945
980
  const externals = new Map;
@@ -970,6 +1005,7 @@ async function buildClientPackage(options) {
970
1005
  tsc,
971
1006
  tsconfig: planned.tsconfig,
972
1007
  entries: [...planned.entries.values()],
1008
+ work,
973
1009
  outDir: join6(staged, "dist")
974
1010
  });
975
1011
  normalizeClientDeclarations(join6(staged, "dist"), {
@@ -977,13 +1013,13 @@ async function buildClientPackage(options) {
977
1013
  runtime: options.runtime ?? "node"
978
1014
  });
979
1015
  await stage(options, planned, graph, staged);
980
- await mkdir3(dirname5(planned.tarball), { recursive: true });
1016
+ await mkdir4(dirname5(planned.tarball), { recursive: true });
981
1017
  const packed = await runClientTool(step, bun, ["pm", "pack", "--filename", planned.tarball, "--ignore-scripts", "--quiet"], staged);
982
1018
  if (!packed.ok) {
983
1019
  throw new ClientPackageError("install", `Client package pack failed (exit ${packed.exit}): ${packed.output}`, { output: packed.output });
984
1020
  }
985
1021
  const consumer = join6(work, "consumer");
986
- await mkdir3(consumer);
1022
+ await mkdir4(consumer);
987
1023
  const proven = await proveClientPackage({
988
1024
  options,
989
1025
  step,
@@ -1101,7 +1137,7 @@ import { z as z5 } from "zod";
1101
1137
  // src/files/native-packaging-plugin.ts
1102
1138
  import { existsSync as existsSync4, readFileSync as readFileSync2, realpathSync as realpathSync2 } from "node:fs";
1103
1139
  import { basename as basename3, join as join7 } from "node:path";
1104
- var realpath4 = (path) => {
1140
+ var realpath5 = (path) => {
1105
1141
  try {
1106
1142
  return realpathSync2(path);
1107
1143
  } catch {
@@ -1132,7 +1168,7 @@ function loaderInstallation(path, loaderName) {
1132
1168
  function nativePlugin(owner, specifiers, embedded, companionEntry) {
1133
1169
  const contents = nativeLoaderSource(specifiers, "static");
1134
1170
  const external = new Set(Object.values(specifiers));
1135
- const ownLoader = realpath4(owner.loaderPath);
1171
+ const ownLoader = realpath5(owner.loaderPath);
1136
1172
  const loaderFile = basename3(owner.loaderName);
1137
1173
  return {
1138
1174
  name: "stitchkit-native-packaging",
@@ -1152,7 +1188,7 @@ function nativePlugin(owner, specifiers, embedded, companionEntry) {
1152
1188
  return { contents, loader: "js" };
1153
1189
  if (basename3(args.path) !== loaderFile)
1154
1190
  return;
1155
- if (realpath4(args.path) === ownLoader)
1191
+ if (realpath5(args.path) === ownLoader)
1156
1192
  return { contents, loader: "js" };
1157
1193
  const foreign = loaderInstallation(args.path, owner.loaderName);
1158
1194
  if (!foreign)
@@ -1165,7 +1201,7 @@ function nativePlugin(owner, specifiers, embedded, companionEntry) {
1165
1201
  return bytes ? { contents: bytes, loader: "napi" } : undefined;
1166
1202
  });
1167
1203
  if (companionEntry !== undefined)
1168
- build.onResolve({ filter: /./ }, (args) => (args.importer === owner.loaderPath || realpath4(args.importer) === ownLoader) && external.has(args.path) ? { path: args.path, external: true } : undefined);
1204
+ build.onResolve({ filter: /./ }, (args) => (args.importer === owner.loaderPath || realpath5(args.importer) === ownLoader) && external.has(args.path) ? { path: args.path, external: true } : undefined);
1169
1205
  }
1170
1206
  };
1171
1207
  }
@@ -23,7 +23,7 @@ import {
23
23
  } from "../index-nfm15ej7.js";
24
24
  import {
25
25
  bindUnixSocket2
26
- } from "../index-kp1j7cc8.js";
26
+ } from "../index-ca1v40d3.js";
27
27
  import {
28
28
  ManagedFileError2,
29
29
  createManagedFileBoundary2
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  isTrustProxyHandler,
17
17
  createHandler2
18
- } from "../index-h08xqfw9.js";
18
+ } from "../index-qqd979f7.js";
19
19
  import {
20
20
  secretsEqual
21
21
  } from "../index-apv5xfef.js";
@@ -38,12 +38,12 @@ import {
38
38
  import {
39
39
  utf8ByteLength
40
40
  } from "../index-f16b7rze.js";
41
- import {
42
- assertPositiveSafeInteger
43
- } from "../index-gr0kxymw.js";
44
41
  import {
45
42
  randomHex
46
43
  } from "../index-c9d05kvt.js";
44
+ import {
45
+ assertPositiveSafeInteger
46
+ } from "../index-gr0kxymw.js";
47
47
  import {
48
48
  abortError
49
49
  } from "../index-wz392jyz.js";
@@ -21,7 +21,7 @@ import {
21
21
  createBridgeClosedError,
22
22
  createUnusableReplyError,
23
23
  createHttpClient2
24
- } from "../index-cgjtj8zh.js";
24
+ } from "../index-mhgkzwxz.js";
25
25
  import {
26
26
  contractEndpointMatchers2,
27
27
  createClient2,
@@ -30,7 +30,7 @@ import {
30
30
  createUrlBuilder2,
31
31
  createUrlBuilders2,
32
32
  createScopedUrlBuilders2
33
- } from "../index-f0dzyskg.js";
33
+ } from "../index-nne3yxew.js";
34
34
  import"../index-gvgtmt7a.js";
35
35
  import"../index-yt1gg11x.js";
36
36
  import"../index-werjqesf.js";
@@ -38,7 +38,7 @@ import"../index-dmrx8xma.js";
38
38
  import {
39
39
  uploadInChunks2,
40
40
  readContractIdentity2
41
- } from "../index-y6wzzk2e.js";
41
+ } from "../index-rw31t8sj.js";
42
42
  import {
43
43
  StreamLineLimitError2,
44
44
  StreamTruncatedLineError2
@@ -50,12 +50,12 @@ import {
50
50
  utf8ByteLength,
51
51
  readBoundedBody2
52
52
  } from "../index-f16b7rze.js";
53
- import {
54
- assertPositiveSafeInteger
55
- } from "../index-gr0kxymw.js";
56
53
  import {
57
54
  randomHex
58
55
  } from "../index-c9d05kvt.js";
56
+ import {
57
+ assertPositiveSafeInteger
58
+ } from "../index-gr0kxymw.js";
59
59
  import {
60
60
  abortReason,
61
61
  raceAbort,