stitchkit 0.109.4 → 0.110.1
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 +28 -0
- package/dist/agent-runtime/store-conformance-support.d.ts +5 -5
- package/dist/application/process-lifecycle-transitions.d.ts +10 -2
- package/dist/application/process-lifecycle-transitions.d.ts.map +1 -1
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/socket-io-client.d.ts +6 -0
- package/dist/browser/socket-io-client.d.ts.map +1 -0
- package/dist/browser/socket-io-contract.d.ts +183 -0
- package/dist/browser/socket-io-contract.d.ts.map +1 -0
- package/dist/browser/socket-io-default-peer.d.ts +3 -0
- package/dist/browser/socket-io-default-peer.d.ts.map +1 -0
- package/dist/browser/socket-io-explicit-peer.d.ts +12 -0
- package/dist/browser/socket-io-explicit-peer.d.ts.map +1 -0
- package/dist/browser/socket-io-peer.d.ts +2 -11
- package/dist/browser/socket-io-peer.d.ts.map +1 -1
- package/dist/browser/socket-io.d.ts +5 -224
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
- package/dist/entrypoints/agent-runtime/harness.js +6 -6
- package/dist/entrypoints/agent-runtime/realtime.js +4 -4
- package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
- package/dist/entrypoints/agent-runtime.js +6 -6
- package/dist/entrypoints/application/directory-inbox.js +6 -6
- package/dist/entrypoints/application.js +17 -9
- package/dist/entrypoints/cli/publish.js +2 -2
- package/dist/entrypoints/cli.js +9 -9
- package/dist/entrypoints/contract.js +2 -2
- package/dist/entrypoints/files.js +1 -1
- package/dist/entrypoints/http.d.ts +6 -0
- package/dist/entrypoints/http.d.ts.map +1 -0
- package/dist/entrypoints/http.js +32 -0
- package/dist/entrypoints/index.js +21 -412
- package/dist/entrypoints/node.js +3 -3
- package/dist/entrypoints/observability.js +1 -1
- package/dist/entrypoints/process/owner-loss.js +1 -1
- package/dist/entrypoints/process.js +2 -2
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/realtime.d.ts +6 -0
- package/dist/entrypoints/realtime.d.ts.map +1 -0
- package/dist/entrypoints/realtime.js +25 -0
- package/dist/entrypoints/remote.js +2 -2
- package/dist/entrypoints/server.js +8 -8
- package/dist/entrypoints/telegram/screens.js +6 -6
- package/dist/entrypoints/telegram.js +3 -3
- package/dist/entrypoints/testing.js +3 -3
- package/dist/entrypoints/tools/connections.js +3 -3
- package/dist/entrypoints/tools/invoker.js +3 -3
- package/dist/entrypoints/tools/mcp.js +4 -4
- package/dist/entrypoints/tools.js +24 -24
- package/dist/{index-3wm2xp2a.js → index-0d8m0kee.js} +1 -1
- package/dist/{index-5cw390s6.js → index-2tazbwhv.js} +6 -6
- package/dist/{index-hjvje0pf.js → index-506kd458.js} +1 -1
- package/dist/{index-dj1aycxw.js → index-84bf5spd.js} +0 -1
- package/dist/index-86sxnvpr.js +336 -0
- package/dist/{index-68y3n9j3.js → index-8rstkvcf.js} +3 -3
- package/dist/{index-tpk71wqn.js → index-924500c3.js} +1 -1
- package/dist/{index-kvvpw1kq.js → index-dd1z5kxb.js} +2 -2
- package/dist/{index-k3ty2b88.js → index-e1sjcjfy.js} +95 -20
- package/dist/{index-ryv32myz.js → index-ghwntn9n.js} +1 -1
- package/dist/index-hqsbtvta.js +92 -0
- package/dist/{index-e32vy8jw.js → index-jk44mbqb.js} +1 -1
- package/dist/{index-k4v2kq4q.js → index-mha6b4vk.js} +6 -6
- package/dist/{index-00v1qz76.js → index-p6apg0jg.js} +1 -1
- package/dist/{index-x5xs71dw.js → index-s2eybn7b.js} +8 -8
- package/dist/{index-njs9gvrh.js → index-s6d8zsha.js} +6 -6
- package/dist/{index-kc3jqqew.js → index-tjdsyrys.js} +2 -2
- package/dist/process/command-owner.d.ts.map +1 -1
- package/dist/process/group-presence.d.ts +3 -0
- package/dist/process/group-presence.d.ts.map +1 -0
- package/dist/process/group-settlement.d.ts +5 -0
- package/dist/process/group-settlement.d.ts.map +1 -0
- package/dist/process/group.d.ts.map +1 -1
- package/dist/process/output-drain.d.ts +1 -1
- package/dist/process/output-drain.d.ts.map +1 -1
- package/dist/process/owner-loss-control.d.ts.map +1 -1
- package/llms/application.2.txt +8 -5
- package/llms/application.3.txt +3 -0
- package/llms/http.txt +19 -0
- package/llms/realtime.txt +31 -0
- package/llms/stitchkit.txt +5 -3
- package/llms/{upgrading-0.101.0-0.109.0.txt → upgrading-0.101.0-0.110.0.txt} +13 -3
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +57 -8
- package/llms.txt +5 -3
- package/package.json +9 -1
- package/dist/{index-9j2atjte.js → index-2f9r0jgr.js} +3 -3
- package/dist/{index-299sm5tr.js → index-616xh7f2.js} +0 -0
- package/dist/{index-y70v24cw.js → index-8asb62xn.js} +0 -0
- package/dist/{index-k7qdkh3n.js → index-h1spd9kv.js} +3 -3
- package/dist/{index-qd8x73e8.js → index-k8fbzggr.js} +0 -0
- package/dist/{index-85qve8mq.js → index-pzw0fpek.js} +0 -0
- package/dist/{index-y3nemndz.js → index-r6v4mc67.js} +3 -3
- package/dist/{index-ktjmgq9p.js → index-s0xbnpfh.js} +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,34 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.110.1] - 2026-10-14
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `stitchkit/realtime` provides the shared typed Socket.IO client and retained-topic helpers through an explicit-peer graph that Hermes can compile. Pass `peers: { client: () => import('socket.io-client') }`; root Node/Web clients keep optional lazy peer resolution. HTTP uploads are also available from `stitchkit/http`, so native/shared modules can use public leaves throughout their graph (I7, I8).
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Process-group cleanup accepts a fresh kernel absence after SIGKILL instead of relying only on a potentially stale process-table snapshot. Permission refusals and unknown/exiting states still require proof; the same cleanup deadline applies and failures retain their last observed states.
|
|
27
|
+
- A synchronously throwing injected Socket.IO peer loader now reaches `onConnectError`, clears connection intent and allows the next `connect()` to retry, just like an asynchronously rejected loader.
|
|
28
|
+
|
|
29
|
+
## [0.110.0] - 2026-10-14
|
|
30
|
+
|
|
31
|
+
### ⚠️ Breaking changes
|
|
32
|
+
|
|
33
|
+
**Who must act:** applications with exhaustive lifecycle termination/previous-exit switches must handle `interrupted`. Other applications can adopt the HTTP and native cleanup fixes without code changes.
|
|
34
|
+
|
|
35
|
+
- `stitchkit/application` — an abandoned `draining` process now ends as `interrupted`, including a drain before readiness. Before: `previousExit === "abnormal"` (or `"startup-failed"`) mixed unfinished shutdowns with crashes; after: add `case "interrupted"` to exhaustive handlers. Handoff and hot reload stay unchanged. `StartFact.previousDrainUpperBoundMs` measures the recorded drain-to-successor upper bound without claiming a kill signal or exact death time.
|
|
36
|
+
**Affects:** `stitchkit/application` LifecycleTerminationSchema, LifecycleTermination, PreviousExitSchema, PreviousExit, StartFact, transitionProcessStart
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- A fast owner-loss guard exit no longer overtakes a buffered start handshake or discards captured output while the handshake is in flight. The control stream determines whether the handshake was missing, and output readers attach before waiting for it. Native lifetime qualification checks descendant death within its cleanup window before asserting stable output.
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- `stitchkit/http` exposes the existing typed HTTP client factories and `ApiError` without the optional Socket.IO graph, so React Native/Hermes can compile HTTP-only applications. Contracts remain available from `stitchkit/contract`. The shared exports deliberately reuse the same HTTP implementation (I7, I8).
|
|
45
|
+
|
|
18
46
|
## [0.109.4] - 2026-10-13
|
|
19
47
|
|
|
20
48
|
### Fixed
|
|
@@ -8,6 +8,11 @@ export declare function userMessage(conversationId: string, id: string): {
|
|
|
8
8
|
parts: ({
|
|
9
9
|
type: "text";
|
|
10
10
|
text: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: "file";
|
|
13
|
+
mediaType: string;
|
|
14
|
+
reference: string;
|
|
15
|
+
filename?: string | undefined;
|
|
11
16
|
} | {
|
|
12
17
|
type: "reasoning";
|
|
13
18
|
text: string;
|
|
@@ -16,11 +21,6 @@ export declare function userMessage(conversationId: string, id: string): {
|
|
|
16
21
|
provider: string;
|
|
17
22
|
data: Record<string, import("zod").JSONType>;
|
|
18
23
|
} | undefined;
|
|
19
|
-
} | {
|
|
20
|
-
type: "file";
|
|
21
|
-
mediaType: string;
|
|
22
|
-
reference: string;
|
|
23
|
-
filename?: string | undefined;
|
|
24
24
|
} | {
|
|
25
25
|
type: "source";
|
|
26
26
|
sourceId: string;
|
|
@@ -3,11 +3,13 @@ import { z } from 'zod';
|
|
|
3
3
|
* Where a run is. `active` and `draining` are open: the run is alive, and
|
|
4
4
|
* `draining` means it has stopped admitting work — from `unavailableAt` on
|
|
5
5
|
* nobody new is answered. The rest are how it ended. `clean`, `forced` and
|
|
6
|
-
* `startup-failed` are recorded by the run itself; `hot-reload` and `abnormal`
|
|
6
|
+
* `startup-failed` are recorded by the run itself; `hot-reload`, `interrupted` and `abnormal`
|
|
7
7
|
* by its successor, because the run never got to say — the same pid started
|
|
8
8
|
* again, or a different pid found it still open. `abnormal` is a crash
|
|
9
9
|
* observed from outside, not a kill the process acknowledged, so the two stay
|
|
10
|
-
* distinct. `
|
|
10
|
+
* distinct. `interrupted` means a successor found an unfinished drain; the ledger
|
|
11
|
+
* cannot establish the signal that killed it or its exact death time.
|
|
12
|
+
* `startup-failed` is a run that ended before it was ever ready,
|
|
11
13
|
* whether it said so itself or a successor found it open.
|
|
12
14
|
*/
|
|
13
15
|
export declare const LifecycleTerminationSchema: z.ZodEnum<{
|
|
@@ -17,6 +19,7 @@ export declare const LifecycleTerminationSchema: z.ZodEnum<{
|
|
|
17
19
|
draining: "draining";
|
|
18
20
|
forced: "forced";
|
|
19
21
|
"hot-reload": "hot-reload";
|
|
22
|
+
interrupted: "interrupted";
|
|
20
23
|
"startup-failed": "startup-failed";
|
|
21
24
|
}>;
|
|
22
25
|
export type LifecycleTermination = z.infer<typeof LifecycleTerminationSchema>;
|
|
@@ -35,6 +38,7 @@ export declare const LifecycleRunSchema: z.ZodObject<{
|
|
|
35
38
|
draining: "draining";
|
|
36
39
|
forced: "forced";
|
|
37
40
|
"hot-reload": "hot-reload";
|
|
41
|
+
interrupted: "interrupted";
|
|
38
42
|
"startup-failed": "startup-failed";
|
|
39
43
|
}>;
|
|
40
44
|
}, z.core.$strict>;
|
|
@@ -56,6 +60,7 @@ export declare const LifecycleStateSchema: z.ZodObject<{
|
|
|
56
60
|
draining: "draining";
|
|
57
61
|
forced: "forced";
|
|
58
62
|
"hot-reload": "hot-reload";
|
|
63
|
+
interrupted: "interrupted";
|
|
59
64
|
"startup-failed": "startup-failed";
|
|
60
65
|
}>;
|
|
61
66
|
}, z.core.$strict>>;
|
|
@@ -68,6 +73,7 @@ export declare const PreviousExitSchema: z.ZodEnum<{
|
|
|
68
73
|
forced: "forced";
|
|
69
74
|
handoff: "handoff";
|
|
70
75
|
"hot-reload": "hot-reload";
|
|
76
|
+
interrupted: "interrupted";
|
|
71
77
|
"startup-failed": "startup-failed";
|
|
72
78
|
}>;
|
|
73
79
|
export type PreviousExit = z.infer<typeof PreviousExitSchema>;
|
|
@@ -87,6 +93,8 @@ export interface StartFact {
|
|
|
87
93
|
* processes, not the time nobody answered — that is `ReadyFact.downtimeMs`.
|
|
88
94
|
*/
|
|
89
95
|
readonly processGapMs: number | null;
|
|
96
|
+
/** From recorded admission stop to this start: an upper bound, not a measured kill time. */
|
|
97
|
+
readonly previousDrainUpperBoundMs: number | null;
|
|
90
98
|
}
|
|
91
99
|
export interface ReadyFact {
|
|
92
100
|
readonly type: 'ready';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-lifecycle-transitions.d.ts","sourceRoot":"","sources":["../../src/application/process-lifecycle-transitions.ts"],"names":[],"mappings":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AAC,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,CA2K/E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RealtimeContract, RealtimeEventRegistry } from '../realtime/contract.js';
|
|
2
|
+
import type { RealtimeClient, RealtimeClientOptions, SocketEventMap, SocketIOClient, SocketIOClientConfig } from './socket-io-contract.js';
|
|
3
|
+
import { type IoFn } from './socket-io-peer.js';
|
|
4
|
+
export declare function createRealtimeClientWithPeer<const TServerToClient extends RealtimeEventRegistry, const TClientToServer extends RealtimeEventRegistry>(contract: RealtimeContract<TServerToClient, TClientToServer>, { onRejected, logger, onRequestPhase, ...config }: RealtimeClientOptions<TServerToClient>, defaultIo: () => Promise<IoFn>): RealtimeClient<TServerToClient, TClientToServer>;
|
|
5
|
+
export declare function createSocketIOClientWithPeer<TServerEvents extends SocketEventMap, TClientEvents extends SocketEventMap>(config: SocketIOClientConfig<TServerEvents>, defaultIo: () => Promise<IoFn>): SocketIOClient<TServerEvents, TClientEvents>;
|
|
6
|
+
//# sourceMappingURL=socket-io-client.d.ts.map
|
|
@@ -0,0 +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,eAAe,SAAS,qBAAqB,EACnD,KAAK,CAAC,eAAe,SAAS,qBAAqB,EAEnD,QAAQ,EAAE,gBAAgB,CAAC,eAAe,EAAE,eAAe,CAAC,EAC5D,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,EAAE,qBAAqB,CAAC,eAAe,CAAC,EACzF,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC,CAelD;AAED,wBAAgB,4BAA4B,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"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { RealtimeEventRegistry } from '../realtime/contract.js';
|
|
2
|
+
import type { RealtimeRequestOptions, RealtimeRequestPhaseHook } from '../realtime/request.js';
|
|
3
|
+
import type { BindRealtimeClientOptions, BoundRealtimeClient } from './realtime-client.js';
|
|
4
|
+
/**
|
|
5
|
+
* A literal optional Socket.IO peer loader owned by the consuming bundle.
|
|
6
|
+
* Root clients may omit it and use lazy runtime resolution; `stitchkit/realtime`
|
|
7
|
+
* requires it so its graph is compilable by Hermes without a computed import.
|
|
8
|
+
*/
|
|
9
|
+
export interface SocketIOClientPeerLoaders {
|
|
10
|
+
/**
|
|
11
|
+
* `() => import('socket.io-client')`.
|
|
12
|
+
*
|
|
13
|
+
* Typed as `unknown` and shape-checked where it is used — the same reason
|
|
14
|
+
* `SocketIOPeerLoaders.bunEngine` is. The root `stitchkit` entry is the
|
|
15
|
+
* browser-safe one, and its declarations must not name `socket.io-client`:
|
|
16
|
+
* a consumer who imports `createClient` and never opens a socket would then
|
|
17
|
+
* need the package installed just to TYPECHECK, which the consumer-lane peer
|
|
18
|
+
* budget refuses by name. The loader is still written the obvious way; only
|
|
19
|
+
* the type of what it returns is checked at the boundary rather than here,
|
|
20
|
+
* and a loader that returns the wrong module is refused by name at runtime.
|
|
21
|
+
*/
|
|
22
|
+
client?: () => Promise<unknown>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Socket.IO event map — `{ event: (...args) => void }`. Aliases Socket.IO's
|
|
26
|
+
* own event-map constraint, which intentionally maps to `any`: that is what
|
|
27
|
+
* lets a plain `interface ServerToClientEvents { … }` (no index signature) be
|
|
28
|
+
* passed as a type argument. The constraint lives here instead of importing
|
|
29
|
+
* Socket.IO's equivalent: the root HTTP client declarations must remain usable
|
|
30
|
+
* when no optional Socket.IO peer is installed. Per-event typing is fully
|
|
31
|
+
* preserved on the public `on` / `emit` signatures.
|
|
32
|
+
*/
|
|
33
|
+
export interface SocketEventMap {
|
|
34
|
+
[event: string]: any;
|
|
35
|
+
}
|
|
36
|
+
export interface SocketIOClientConfig<TServerEvents extends SocketEventMap = SocketEventMap> {
|
|
37
|
+
/** Server origin, e.g. `https://api.example.com`. */
|
|
38
|
+
url: string;
|
|
39
|
+
/** Socket.IO endpoint path. Default `/socket.io/`. */
|
|
40
|
+
path?: string;
|
|
41
|
+
/** Send cookies on the handshake (cookie-based auth). Default `true`. */
|
|
42
|
+
withCredentials?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Handshake auth payload — token-based auth, the alternative to cookie auth
|
|
45
|
+
* (`withCredentials`). Reaches the server as `socket.handshake.auth`. A
|
|
46
|
+
* **function** is re-read on every (re)connect, so a rotated token is picked
|
|
47
|
+
* up automatically — no need to recreate the client (and lose durable
|
|
48
|
+
* subscriptions). The function may be async.
|
|
49
|
+
*/
|
|
50
|
+
auth?: Record<string, unknown> | (() => Record<string, unknown> | Promise<Record<string, unknown>>);
|
|
51
|
+
/** Extra query params on the handshake URL — reaches `socket.handshake.query`. */
|
|
52
|
+
query?: Record<string, string | number | boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Extra handshake headers. In a browser these apply to the **polling**
|
|
55
|
+
* transport only — a WebSocket upgrade cannot set request headers, so for
|
|
56
|
+
* browser WebSocket auth use `auth` instead. Useful from non-browser clients
|
|
57
|
+
* (Node/Bun server-to-server) where headers are honoured on every transport.
|
|
58
|
+
*/
|
|
59
|
+
extraHeaders?: Record<string, string>;
|
|
60
|
+
/** Transports, in preference order. Default `['websocket', 'polling']`. */
|
|
61
|
+
transports?: Array<'websocket' | 'polling'>;
|
|
62
|
+
/** Reconnection attempts. Default `Infinity`. */
|
|
63
|
+
reconnectionAttempts?: number;
|
|
64
|
+
/** Initial reconnection delay (ms). Default `1000`. */
|
|
65
|
+
reconnectionDelay?: number;
|
|
66
|
+
/** Max reconnection delay (ms). Default `5000`. */
|
|
67
|
+
reconnectionDelayMax?: number;
|
|
68
|
+
/** Connection timeout (ms). Default `20000`. */
|
|
69
|
+
timeout?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Survive a **server-initiated** disconnect. When the server drops the socket
|
|
72
|
+
* (`socket.disconnect()` server-side, reason `io server disconnect`) Socket.IO
|
|
73
|
+
* does **not** auto-reconnect — by design the client is meant to stay down.
|
|
74
|
+
* That silently kills a long-lived client after a backend restart or an
|
|
75
|
+
* auth-gate drop: the WebSocket is gone for good and nothing recovers it.
|
|
76
|
+
*
|
|
77
|
+
* With this set, the client recycles itself instead — after the given delay it
|
|
78
|
+
* reconnects on the same socket, which re-reads the `auth` function (so a
|
|
79
|
+
* rotated token is picked up automatically, exactly like an ordinary
|
|
80
|
+
* reconnect). Other disconnect reasons (`transport close`, `ping timeout`, …)
|
|
81
|
+
* are untouched — Socket.IO's own reconnection already handles those.
|
|
82
|
+
*
|
|
83
|
+
* Set `false` to keep Socket.IO's default (stay disconnected). Default `1000` ms.
|
|
84
|
+
*/
|
|
85
|
+
reconnectOnServerDisconnect?: number | false;
|
|
86
|
+
/**
|
|
87
|
+
* Server → client events to **retain** ("sticky events"). The client keeps the
|
|
88
|
+
* last payload of each listed event and replays it to any handler subscribed
|
|
89
|
+
* afterwards (and on the next subscribe after a re-render), so a late
|
|
90
|
+
* subscriber catches up to the current state at once instead of waiting for the
|
|
91
|
+
* next emission. The retained value survives a `disconnect()` / `connect()`
|
|
92
|
+
* cycle. Only the first emitted argument of an event is retained.
|
|
93
|
+
*/
|
|
94
|
+
retain?: Array<keyof TServerEvents & string>;
|
|
95
|
+
/**
|
|
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
|
+
*/
|
|
107
|
+
onConnectError?: (error: {
|
|
108
|
+
message: string;
|
|
109
|
+
data?: unknown;
|
|
110
|
+
terminal: boolean;
|
|
111
|
+
}) => void;
|
|
112
|
+
/**
|
|
113
|
+
* Observe every emit dropped because the socket was disconnected (the
|
|
114
|
+
* central alternative to guarding each call with `connected`). Receives the
|
|
115
|
+
* **wire** arguments — for a validated `RealtimeClient` that is the
|
|
116
|
+
* Zod-parsed values plus the wrapped ack callback, not the caller's original
|
|
117
|
+
* arguments. The drop itself is also reported by `emit` returning `false`.
|
|
118
|
+
*/
|
|
119
|
+
onDroppedEmit?: (dropped: {
|
|
120
|
+
event: string;
|
|
121
|
+
args: unknown[];
|
|
122
|
+
}) => void;
|
|
123
|
+
/**
|
|
124
|
+
* How to load the optional `socket.io-client` peer. Omit it and the peer is
|
|
125
|
+
* resolved lazily, exactly as before — this exists for a consumer who ships
|
|
126
|
+
* one self-contained artifact and needs the specifier to be a literal their
|
|
127
|
+
* own bundler can follow. → `SocketIOClientPeerLoaders`
|
|
128
|
+
*/
|
|
129
|
+
peers?: SocketIOClientPeerLoaders;
|
|
130
|
+
}
|
|
131
|
+
export interface SocketIOClient<TServerEvents extends SocketEventMap, TClientEvents extends SocketEventMap> {
|
|
132
|
+
/** Create the socket (if absent) and connect. Idempotent. */
|
|
133
|
+
connect(): void;
|
|
134
|
+
/** Disconnect and drop the socket instance. */
|
|
135
|
+
disconnect(): void;
|
|
136
|
+
/** True while the underlying socket is connected. */
|
|
137
|
+
readonly connected: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Subscribe to a server → client event. Returns an unsubscribe. The handler
|
|
140
|
+
* is durable — it is re-attached onto every socket the client builds, so it
|
|
141
|
+
* survives a `disconnect()` / `connect()` cycle.
|
|
142
|
+
*/
|
|
143
|
+
on<E extends keyof TServerEvents & string>(event: E, handler: TServerEvents[E]): () => void;
|
|
144
|
+
/**
|
|
145
|
+
* Emit a client → server event. Returns `true` when the event was handed to
|
|
146
|
+
* the transport (not a delivery guarantee) and `false` when it was dropped
|
|
147
|
+
* because the socket is disconnected — including the window while the lazy
|
|
148
|
+
* peer is still loading right after `connect()`. A drop also fires the
|
|
149
|
+
* `onDroppedEmit` hook. The default stays a drop (no buffering): after a
|
|
150
|
+
* reconnect the durable subscriptions replay state deterministically instead
|
|
151
|
+
* of an unordered backlog of stale emits.
|
|
152
|
+
*/
|
|
153
|
+
emit<E extends keyof TClientEvents & string>(event: E, ...args: Parameters<TClientEvents[E]>): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Low-level native Socket.IO acknowledgement request. Contract-aware callers
|
|
156
|
+
* should use `createRealtimeClient().request()`, which validates both sides.
|
|
157
|
+
*/
|
|
158
|
+
emitWithAck(event: string, args: unknown[], options: RealtimeRequestOptions): Promise<unknown>;
|
|
159
|
+
/**
|
|
160
|
+
* Subscribe to connection up/down changes. Returns an unsubscribe. On a
|
|
161
|
+
* disconnect the listener also receives the Socket.IO **reason** (e.g.
|
|
162
|
+
* `io server disconnect`, `transport close`, `ping timeout`) as a second
|
|
163
|
+
* argument — `undefined` on connect. The extra argument is additive: a
|
|
164
|
+
* `(connected: boolean) => void` listener keeps working unchanged.
|
|
165
|
+
*/
|
|
166
|
+
onConnectionChange(listener: (connected: boolean, reason?: string) => void): () => void;
|
|
167
|
+
}
|
|
168
|
+
/** Minimal Stitchkit client transport required by a validated realtime binding. */
|
|
169
|
+
export interface RealtimeClient<TServerToClient extends RealtimeEventRegistry, TClientToServer extends RealtimeEventRegistry> extends BoundRealtimeClient<TServerToClient, TClientToServer> {
|
|
170
|
+
connect(): void;
|
|
171
|
+
disconnect(): void;
|
|
172
|
+
}
|
|
173
|
+
export interface RealtimeClientOptions<TServerToClient extends RealtimeEventRegistry> extends BindRealtimeClientOptions, SocketIOClientConfig<{
|
|
174
|
+
[TEvent in keyof TServerToClient]: (...args: unknown[]) => void;
|
|
175
|
+
}> {
|
|
176
|
+
/**
|
|
177
|
+
* Observe bounded metadata-only phases of acknowledged requests. Engine.IO
|
|
178
|
+
* phases are local encoder/decoder boundaries, not remote send time or RTT.
|
|
179
|
+
* Observer failures are isolated from request lifecycle.
|
|
180
|
+
*/
|
|
181
|
+
onRequestPhase?: RealtimeRequestPhaseHook;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=socket-io-contract.d.ts.map
|
|
@@ -0,0 +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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,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"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RealtimeContract, RealtimeEventRegistry } from '../realtime/contract.js';
|
|
2
|
+
import type { RealtimeClient, RealtimeClientOptions, SocketEventMap, SocketIOClient, SocketIOClientConfig, SocketIOClientPeerLoaders } from './socket-io-contract.js';
|
|
3
|
+
export type { RealtimeClient, RealtimeClientOptions, SocketEventMap, SocketIOClient, SocketIOClientConfig, SocketIOClientPeerLoaders, } from './socket-io-contract.js';
|
|
4
|
+
/** Create a validated realtime client with durable subscriptions and typed requests. */
|
|
5
|
+
export declare function createRealtimeClient<const TServerToClient extends RealtimeEventRegistry, const TClientToServer extends RealtimeEventRegistry>(contract: RealtimeContract<TServerToClient, TClientToServer>, config: RealtimeClientOptions<TServerToClient> & {
|
|
6
|
+
peers: Required<SocketIOClientPeerLoaders>;
|
|
7
|
+
}): RealtimeClient<TServerToClient, TClientToServer>;
|
|
8
|
+
/** Create the shared Socket.IO transport with durable subscriptions and explicit connection intent. */
|
|
9
|
+
export declare function createSocketIOClient<TServerEvents extends SocketEventMap, TClientEvents extends SocketEventMap>(config: SocketIOClientConfig<TServerEvents> & {
|
|
10
|
+
peers: Required<SocketIOClientPeerLoaders>;
|
|
11
|
+
}): SocketIOClient<TServerEvents, TClientEvents>;
|
|
12
|
+
//# sourceMappingURL=socket-io-explicit-peer.d.ts.map
|
|
@@ -0,0 +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;AAE9B,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GAC1B,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,4 +1,4 @@
|
|
|
1
|
-
import type { SocketIOClientPeerLoaders } from './socket-io.js';
|
|
1
|
+
import type { SocketIOClientPeerLoaders } from './socket-io-contract.js';
|
|
2
2
|
export type IoFn = typeof import('socket.io-client')['io'];
|
|
3
3
|
/**
|
|
4
4
|
* One client's way of getting to `io`, memoised.
|
|
@@ -7,14 +7,5 @@ export type IoFn = typeof import('socket.io-client')['io'];
|
|
|
7
7
|
* process may legitimately be built by different bundles, and one of them
|
|
8
8
|
* winning a shared slot would decide which module the other uses.
|
|
9
9
|
*/
|
|
10
|
-
export declare function createIoResolver(injected: SocketIOClientPeerLoaders['client']): () => Promise<IoFn>;
|
|
11
|
-
/**
|
|
12
|
-
* Adapt our friendly `auth` form to what `io()` expects. socket.io's function
|
|
13
|
-
* form is callback-based (`(cb) => cb(payload)`) and called on every (re)connect;
|
|
14
|
-
* we accept a plain sync/async producer and bridge it to that callback. If the
|
|
15
|
-
* producer fails, send an empty auth object rather than leaving the handshake
|
|
16
|
-
* waiting forever; a normal server-side auth gate will reject it. Object /
|
|
17
|
-
* `undefined` pass straight through. No casts: socket.io types `auth` as
|
|
18
|
-
* `{ [k]: any } | ((cb: (data: object) => void) => void)`.
|
|
19
|
-
*/
|
|
10
|
+
export declare function createIoResolver(injected: SocketIOClientPeerLoaders['client'], defaultIo: () => Promise<IoFn>): () => Promise<IoFn>;
|
|
20
11
|
//# sourceMappingURL=socket-io-peer.d.ts.map
|
|
@@ -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,
|
|
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"}
|