stitchkit 0.110.0 → 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 +11 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
- package/dist/agent-runtime/store-conformance-support.d.ts +5 -5
- 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 +2 -2
- package/dist/entrypoints/agent-runtime/harness.js +2 -2
- package/dist/entrypoints/agent-runtime/realtime.js +3 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +2 -2
- package/dist/entrypoints/agent-runtime.js +5 -5
- package/dist/entrypoints/application/directory-inbox.js +6 -6
- package/dist/entrypoints/application.js +1 -1
- package/dist/entrypoints/cli/publish.js +2 -2
- package/dist/entrypoints/cli.js +8 -8
- package/dist/entrypoints/contract.js +1 -1
- package/dist/entrypoints/files.js +1 -1
- package/dist/entrypoints/http.d.ts +1 -0
- package/dist/entrypoints/http.d.ts.map +1 -1
- package/dist/entrypoints/http.js +6 -2
- package/dist/entrypoints/index.js +20 -411
- package/dist/entrypoints/node.js +3 -3
- package/dist/entrypoints/observability.js +1 -1
- package/dist/entrypoints/process.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 +1 -1
- package/dist/entrypoints/server.js +11 -11
- package/dist/entrypoints/telegram/screens.js +9 -9
- package/dist/entrypoints/telegram.js +3 -3
- package/dist/entrypoints/testing.js +2 -2
- 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 +22 -22
- package/dist/{index-61m15a18.js → index-0d8m0kee.js} +1 -1
- package/dist/{index-dmfr2cg5.js → index-2tazbwhv.js} +6 -6
- package/dist/index-86sxnvpr.js +336 -0
- package/dist/{index-2pevnh0x.js → index-8rstkvcf.js} +3 -3
- package/dist/{index-064zxbwj.js → index-924500c3.js} +1 -1
- package/dist/{index-mnhtbqrb.js → index-dd1z5kxb.js} +2 -2
- package/dist/{index-7a1xhhdx.js → index-e1sjcjfy.js} +31 -11
- package/dist/{index-p6mvqcbq.js → index-ghwntn9n.js} +1 -1
- package/dist/index-hqsbtvta.js +92 -0
- package/dist/{index-73cz22ds.js → index-mha6b4vk.js} +6 -6
- package/dist/{index-fnra8n1j.js → index-s2eybn7b.js} +9 -9
- package/dist/{index-njs9gvrh.js → index-s6d8zsha.js} +6 -6
- package/dist/{index-jyw90rps.js → index-tjdsyrys.js} +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.map +1 -1
- package/dist/process/group.d.ts.map +1 -1
- package/llms/realtime.txt +31 -0
- package/llms/stitchkit.txt +1 -0
- package/llms-full.txt +22 -0
- package/llms.txt +2 -1
- package/package.json +5 -1
- package/dist/{index-9j2atjte.js → index-2f9r0jgr.js} +3 -3
- package/dist/{index-y70v24cw.js → index-8asb62xn.js} +0 -0
- package/dist/{index-k7qdkh3n.js → index-h1spd9kv.js} +3 -3
- package/dist/{index-zgwkwr1g.js → index-jk44mbqb.js} +0 -0
- 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
|
@@ -23,6 +23,22 @@ import {
|
|
|
23
23
|
assertPositiveSafeInteger
|
|
24
24
|
} from "./index-0s4xebbg.js";
|
|
25
25
|
|
|
26
|
+
// src/process/group-presence.ts
|
|
27
|
+
function processGroupExists(pid) {
|
|
28
|
+
try {
|
|
29
|
+
process.kill(-pid, 0);
|
|
30
|
+
return true;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error instanceof Error && "code" in error) {
|
|
33
|
+
if (error.code === "ESRCH")
|
|
34
|
+
return false;
|
|
35
|
+
if (process.platform === "darwin" && error.code === "EPERM")
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
// src/process/group-settlement.ts
|
|
27
43
|
import { execFile } from "node:child_process";
|
|
28
44
|
function hasLiveGroupMember(table, group) {
|
|
@@ -50,13 +66,26 @@ function processGroups(timeoutMs) {
|
|
|
50
66
|
async function waitForProcessGroupExit(pid, deadline) {
|
|
51
67
|
if (pid === undefined)
|
|
52
68
|
return;
|
|
69
|
+
let observations = 0;
|
|
70
|
+
let lastStates = [];
|
|
53
71
|
for (;; ) {
|
|
54
72
|
const remaining = Math.ceil(deadline - performance.now());
|
|
55
73
|
if (remaining <= 0)
|
|
56
|
-
throw new Error("Command process group
|
|
74
|
+
throw new Error("Command process group settlement was not confirmed after SIGKILL", {
|
|
75
|
+
cause: { groupId: pid, observations, lastStates }
|
|
76
|
+
});
|
|
77
|
+
if (!processGroupExists(pid))
|
|
78
|
+
return;
|
|
57
79
|
const table = await processGroups(remaining);
|
|
80
|
+
observations++;
|
|
58
81
|
if (!hasLiveGroupMember(table, pid))
|
|
59
82
|
return;
|
|
83
|
+
lastStates = table.split(/\r?\n/).flatMap((row) => {
|
|
84
|
+
const fields = /^\s*(\d+)\s+(\S+)\s*$/.exec(row);
|
|
85
|
+
return Number(fields?.[1]) === pid ? [fields?.[2] ?? "unknown"] : [];
|
|
86
|
+
}).slice(0, 16);
|
|
87
|
+
if (!processGroupExists(pid))
|
|
88
|
+
return;
|
|
60
89
|
await sleep(Math.min(5, Math.max(0, deadline - performance.now())));
|
|
61
90
|
}
|
|
62
91
|
}
|
|
@@ -104,16 +133,7 @@ function signalGroup(pid, signal) {
|
|
|
104
133
|
function exists(pid) {
|
|
105
134
|
if (pid === undefined)
|
|
106
135
|
return false;
|
|
107
|
-
|
|
108
|
-
process.kill(-pid, 0);
|
|
109
|
-
return true;
|
|
110
|
-
} catch (error) {
|
|
111
|
-
if (isErrno(error, "ESRCH"))
|
|
112
|
-
return false;
|
|
113
|
-
if (deniedOnDarwin(error))
|
|
114
|
-
return true;
|
|
115
|
-
throw error;
|
|
116
|
-
}
|
|
136
|
+
return processGroupExists(pid);
|
|
117
137
|
}
|
|
118
138
|
async function signalUntilSettled(pid, signal, deadline) {
|
|
119
139
|
for (;; ) {
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ApiError2
|
|
3
|
+
} from "./index-kfjkb396.js";
|
|
4
|
+
import {
|
|
5
|
+
sleep
|
|
6
|
+
} from "./index-eemvahkc.js";
|
|
7
|
+
|
|
8
|
+
// src/browser/chunked-upload.ts
|
|
9
|
+
function isRetryableUploadFailure(error) {
|
|
10
|
+
if (ApiError2.is(error)) {
|
|
11
|
+
if (error.status === 0)
|
|
12
|
+
return error.code === "UNKNOWN_ERROR" || error.code === "REQUEST_TIMEOUT";
|
|
13
|
+
return error.status === 429 || error.status >= 500;
|
|
14
|
+
}
|
|
15
|
+
return error instanceof TypeError;
|
|
16
|
+
}
|
|
17
|
+
async function uploadInChunks2(config) {
|
|
18
|
+
const { file, chunkBytes, signal } = config;
|
|
19
|
+
if (!Number.isSafeInteger(chunkBytes) || chunkBytes <= 0) {
|
|
20
|
+
throw new TypeError("uploadInChunks: chunkBytes must be a positive integer");
|
|
21
|
+
}
|
|
22
|
+
if (!Number.isSafeInteger(file.size) || file.size < 0) {
|
|
23
|
+
throw new TypeError("uploadInChunks: the file size must be a whole number of bytes");
|
|
24
|
+
}
|
|
25
|
+
if (file.size === 0)
|
|
26
|
+
throw new TypeError("uploadInChunks: the file is empty");
|
|
27
|
+
const totalBytes = file.size;
|
|
28
|
+
const chunkCount = Math.ceil(totalBytes / chunkBytes);
|
|
29
|
+
const uploadId = config.uploadId ?? crypto.randomUUID();
|
|
30
|
+
const retries = config.retries ?? 3;
|
|
31
|
+
const retryDelayMs = config.retryDelayMs ?? 1000;
|
|
32
|
+
const report = (sentBytes, index, attempt) => {
|
|
33
|
+
if (!config.onProgress)
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
config.onProgress({ sentBytes, totalBytes, index, chunkCount, attempt });
|
|
37
|
+
} catch {}
|
|
38
|
+
};
|
|
39
|
+
throwIfAborted(signal);
|
|
40
|
+
const opened = await repeating(() => config.init({ uploadId, totalBytes, chunkBytes, chunkCount }, { signal }), { retries, retryDelayMs, signal });
|
|
41
|
+
if (opened) {
|
|
42
|
+
report(totalBytes, chunkCount, 1);
|
|
43
|
+
return opened.finished;
|
|
44
|
+
}
|
|
45
|
+
report(0, 0, 1);
|
|
46
|
+
for (let index = 0;index < chunkCount; index += 1) {
|
|
47
|
+
throwIfAborted(signal);
|
|
48
|
+
const start = index * chunkBytes;
|
|
49
|
+
const end = Math.min(totalBytes, start + chunkBytes);
|
|
50
|
+
const partBytes = end - start;
|
|
51
|
+
const bytes = file.slice(start, end);
|
|
52
|
+
await repeating((attempt) => config.chunk({ uploadId, index, bytes }, {
|
|
53
|
+
...signal && { signal },
|
|
54
|
+
onUploadProgress: (progress) => report(start + fileShare(progress, partBytes), index, attempt)
|
|
55
|
+
}), { retries, retryDelayMs, signal });
|
|
56
|
+
report(end, index + 1, 1);
|
|
57
|
+
}
|
|
58
|
+
throwIfAborted(signal);
|
|
59
|
+
return config.finalize({ uploadId }, { signal });
|
|
60
|
+
}
|
|
61
|
+
function fileShare(progress, partBytes) {
|
|
62
|
+
if (progress.totalBytes === 0)
|
|
63
|
+
return 0;
|
|
64
|
+
return Math.floor(partBytes * progress.sentBytes / progress.totalBytes);
|
|
65
|
+
}
|
|
66
|
+
async function repeating(call, {
|
|
67
|
+
retries,
|
|
68
|
+
retryDelayMs,
|
|
69
|
+
signal
|
|
70
|
+
}) {
|
|
71
|
+
for (let attempt = 1;; attempt += 1) {
|
|
72
|
+
try {
|
|
73
|
+
return await call(attempt);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (signal?.aborted || attempt > retries || !isRetryableUploadFailure(error))
|
|
76
|
+
throw error;
|
|
77
|
+
try {
|
|
78
|
+
await sleep(retryDelayMs * 2 ** (attempt - 1), signal);
|
|
79
|
+
} catch (aborted) {
|
|
80
|
+
throwIfAborted(signal);
|
|
81
|
+
throw aborted;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function throwIfAborted(signal) {
|
|
87
|
+
if (signal?.aborted) {
|
|
88
|
+
throw new ApiError2("REQUEST_ABORTED", { status: 0, message: "Request was aborted" });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { uploadInChunks2 };
|
|
@@ -10,13 +10,16 @@ import {
|
|
|
10
10
|
projectToolView,
|
|
11
11
|
objectShapeKeys
|
|
12
12
|
} from "./index-q6crhe1n.js";
|
|
13
|
+
import {
|
|
14
|
+
runWithRequestContext2,
|
|
15
|
+
getRequestContext2
|
|
16
|
+
} from "./index-r6v4mc67.js";
|
|
13
17
|
import {
|
|
14
18
|
projectedToolError
|
|
15
19
|
} from "./index-556g5hsh.js";
|
|
16
20
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./index-y3nemndz.js";
|
|
21
|
+
isUnsafeKey
|
|
22
|
+
} from "./index-zsarb5xp.js";
|
|
20
23
|
import {
|
|
21
24
|
formatZodError2
|
|
22
25
|
} from "./index-1eeqpadm.js";
|
|
@@ -26,9 +29,6 @@ import {
|
|
|
26
29
|
isRetryableStatus2,
|
|
27
30
|
isStitchErrorCode2
|
|
28
31
|
} from "./index-j9gxbztg.js";
|
|
29
|
-
import {
|
|
30
|
-
isUnsafeKey
|
|
31
|
-
} from "./index-zsarb5xp.js";
|
|
32
32
|
import {
|
|
33
33
|
isRecord
|
|
34
34
|
} from "./index-9jfdm5tg.js";
|
|
@@ -13,18 +13,12 @@ import {
|
|
|
13
13
|
parseToolCallArguments,
|
|
14
14
|
toolResultFromError,
|
|
15
15
|
observed
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-mha6b4vk.js";
|
|
17
17
|
import {
|
|
18
18
|
collectTools2,
|
|
19
19
|
createToolRunner,
|
|
20
20
|
formatToolError
|
|
21
|
-
} from "./index-
|
|
22
|
-
import {
|
|
23
|
-
redact2
|
|
24
|
-
} from "./index-e6c2spsd.js";
|
|
25
|
-
import {
|
|
26
|
-
collectToolSurface
|
|
27
|
-
} from "./index-61m15a18.js";
|
|
21
|
+
} from "./index-ghwntn9n.js";
|
|
28
22
|
import {
|
|
29
23
|
DEFAULT_CORS_ALLOW_HEADERS2,
|
|
30
24
|
DEFAULT_PROCESS_SIGNALS,
|
|
@@ -32,10 +26,16 @@ import {
|
|
|
32
26
|
reportSignalError,
|
|
33
27
|
guardSignalCallback
|
|
34
28
|
} from "./index-yk4g8805.js";
|
|
29
|
+
import {
|
|
30
|
+
redact2
|
|
31
|
+
} from "./index-e6c2spsd.js";
|
|
32
|
+
import {
|
|
33
|
+
collectToolSurface
|
|
34
|
+
} from "./index-0d8m0kee.js";
|
|
35
35
|
import {
|
|
36
36
|
runWithRequestContext2,
|
|
37
37
|
getRequestContext2
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-r6v4mc67.js";
|
|
39
39
|
import {
|
|
40
40
|
AppError2
|
|
41
41
|
} from "./index-j9gxbztg.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import {
|
|
27
27
|
bindContract,
|
|
28
28
|
mediaTypeEssence
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-pzw0fpek.js";
|
|
30
30
|
import {
|
|
31
31
|
assertPositiveSafeInteger
|
|
32
32
|
} from "./index-0s4xebbg.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
getRequestContext2,
|
|
47
47
|
setRequestEndpoint2,
|
|
48
48
|
setRequestError2
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-r6v4mc67.js";
|
|
50
50
|
import {
|
|
51
51
|
resolveTraceId2,
|
|
52
52
|
resolveSocketIp2,
|
|
@@ -54,6 +54,10 @@ import {
|
|
|
54
54
|
getClientInfo2,
|
|
55
55
|
parseQueryParams
|
|
56
56
|
} from "./index-kw1ws0cs.js";
|
|
57
|
+
import {
|
|
58
|
+
isUnsafeKey,
|
|
59
|
+
safeJsonParse
|
|
60
|
+
} from "./index-zsarb5xp.js";
|
|
57
61
|
import {
|
|
58
62
|
AppError2,
|
|
59
63
|
badRequest2,
|
|
@@ -62,10 +66,6 @@ import {
|
|
|
62
66
|
import {
|
|
63
67
|
resolveTraceContext2
|
|
64
68
|
} from "./index-yex7eg1v.js";
|
|
65
|
-
import {
|
|
66
|
-
isUnsafeKey,
|
|
67
|
-
safeJsonParse
|
|
68
|
-
} from "./index-zsarb5xp.js";
|
|
69
69
|
import {
|
|
70
70
|
isRecord,
|
|
71
71
|
transportResult
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-presence.d.ts","sourceRoot":"","sources":["../../src/process/group-presence.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAWvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-settlement.d.ts","sourceRoot":"","sources":["../../src/process/group-settlement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"group-settlement.d.ts","sourceRoot":"","sources":["../../src/process/group-settlement.ts"],"names":[],"mappings":"AAIA,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAQxE;AAmBD,mGAAmG;AACnG,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/process/group.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,KAAK,6BAA6B,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/process/group.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,KAAK,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAIpF,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAYpE,MAAM;IACN,MAAM;EAIT;AAeD,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CASpF;AAsCD,sGAAsG;AACtG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAC;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmB/E;AAED,gGAAgG;AAChG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,gBAAgB,GAAG;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,GAC/E,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,6BAA6B,CAAC;IACtC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CAyBnB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAItE;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAMxF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# stitchkit/realtime — stitchkit docs slice
|
|
2
|
+
|
|
3
|
+
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
|
+
> `llms.txt` in this package.
|
|
5
|
+
|
|
6
|
+
Contains: API reference: `stitchkit/realtime` (docs/api/reference.md)
|
|
7
|
+
|
|
8
|
+
==============================================================================
|
|
9
|
+
# API reference: `stitchkit/realtime` (docs/api/reference.md)
|
|
10
|
+
==============================================================================
|
|
11
|
+
|
|
12
|
+
## `stitchkit/realtime`
|
|
13
|
+
|
|
14
|
+
Hermes-safe realtime clients reuse the root transport and contract implementation. Both
|
|
15
|
+
`createRealtimeClient` and `createSocketIOClient` require `peers.client` here; no default
|
|
16
|
+
computed import enters this graph. Root clients retain their optional lazy runtime loader.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createRealtimeClient, defineRealtimeContract } from 'stitchkit/realtime';
|
|
20
|
+
const client = createRealtimeClient(contract, {
|
|
21
|
+
url,
|
|
22
|
+
peers: { client: () => import('socket.io-client') },
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Native consumers import HTTP factories, `ApiError`, `createUrlBuilder`,
|
|
27
|
+
`contractEndpointMatchers` and `uploadInChunks` from `stitchkit/http`; schema factories,
|
|
28
|
+
`ContractDef` and `paginatedSchema` from `stitchkit/contract`; realtime factories,
|
|
29
|
+
`RealtimeClient`, `defineRealtimeContract`, `InferRealtimeEventMap`, `createRetainedTopics`
|
|
30
|
+
and `RetainedTopics` from `stitchkit/realtime`. `createQueryClientFactory` remains in
|
|
31
|
+
`stitchkit/react`. Shared modules must use the same public leaves throughout their graph.
|
package/llms/stitchkit.txt
CHANGED
|
@@ -57,6 +57,7 @@ own, recorded as an ADR.
|
|
|
57
57
|
|--------|--------|----------|-------|
|
|
58
58
|
| `stitchkit` | browser **and** server | stable | `defineContract`, `createClient`, `createHttpClient`, `createSocketIOClient`, `parseSSE`, the error model |
|
|
59
59
|
| `stitchkit/http` | browser, React Native/Hermes **and** server | evolving | typed HTTP client factories and `ApiError`, without optional realtime peers |
|
|
60
|
+
| `stitchkit/realtime` | browser, React Native/Hermes **and** server | evolving | typed realtime clients and retained topics with a required explicit Socket.IO peer loader |
|
|
60
61
|
| `stitchkit/contract` | browser **and** server | stable | the contract layer alone — `defineContract`, errors, pagination |
|
|
61
62
|
| `stitchkit/live` | browser **and** server | evolving | `defineEvents` — topic declarations beside the operation contract — and watched reads: `createWatchClient`, the value/difference frame and its reassembly |
|
|
62
63
|
| `stitchkit/primitives` | browser **and** server | evolving | generic values and declarations for lifecycle, access, audit, delivery and exports |
|
package/llms-full.txt
CHANGED
|
@@ -49,6 +49,7 @@ own, recorded as an ADR.
|
|
|
49
49
|
|--------|--------|----------|-------|
|
|
50
50
|
| `stitchkit` | browser **and** server | stable | `defineContract`, `createClient`, `createHttpClient`, `createSocketIOClient`, `parseSSE`, the error model |
|
|
51
51
|
| `stitchkit/http` | browser, React Native/Hermes **and** server | evolving | typed HTTP client factories and `ApiError`, without optional realtime peers |
|
|
52
|
+
| `stitchkit/realtime` | browser, React Native/Hermes **and** server | evolving | typed realtime clients and retained topics with a required explicit Socket.IO peer loader |
|
|
52
53
|
| `stitchkit/contract` | browser **and** server | stable | the contract layer alone — `defineContract`, errors, pagination |
|
|
53
54
|
| `stitchkit/live` | browser **and** server | evolving | `defineEvents` — topic declarations beside the operation contract — and watched reads: `createWatchClient`, the value/difference frame and its reassembly |
|
|
54
55
|
| `stitchkit/primitives` | browser **and** server | evolving | generic values and declarations for lifecycle, access, audit, delivery and exports |
|
|
@@ -23338,3 +23339,24 @@ An HTTP-only entrypoint for browsers, React Native/Hermes and servers. It export
|
|
|
23338
23339
|
import { createClients, createHttpClient } from 'stitchkit/http';
|
|
23339
23340
|
import { defineContract } from 'stitchkit/contract';
|
|
23340
23341
|
```
|
|
23342
|
+
|
|
23343
|
+
## `stitchkit/realtime`
|
|
23344
|
+
|
|
23345
|
+
Hermes-safe realtime clients reuse the root transport and contract implementation. Both
|
|
23346
|
+
`createRealtimeClient` and `createSocketIOClient` require `peers.client` here; no default
|
|
23347
|
+
computed import enters this graph. Root clients retain their optional lazy runtime loader.
|
|
23348
|
+
|
|
23349
|
+
```ts
|
|
23350
|
+
import { createRealtimeClient, defineRealtimeContract } from 'stitchkit/realtime';
|
|
23351
|
+
const client = createRealtimeClient(contract, {
|
|
23352
|
+
url,
|
|
23353
|
+
peers: { client: () => import('socket.io-client') },
|
|
23354
|
+
});
|
|
23355
|
+
```
|
|
23356
|
+
|
|
23357
|
+
Native consumers import HTTP factories, `ApiError`, `createUrlBuilder`,
|
|
23358
|
+
`contractEndpointMatchers` and `uploadInChunks` from `stitchkit/http`; schema factories,
|
|
23359
|
+
`ContractDef` and `paginatedSchema` from `stitchkit/contract`; realtime factories,
|
|
23360
|
+
`RealtimeClient`, `defineRealtimeContract`, `InferRealtimeEventMap`, `createRetainedTopics`
|
|
23361
|
+
and `RetainedTopics` from `stitchkit/realtime`. `createQueryClientFactory` remains in
|
|
23362
|
+
`stitchkit/react`. Shared modules must use the same public leaves throughout their graph.
|
package/llms.txt
CHANGED
|
@@ -9,7 +9,7 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
|
|
|
9
9
|
Load the slice for each entrypoint your code imports — `import … from 'stitchkit/server'` → `llms/server.txt`; the root `stitchkit` import → `llms/stitchkit.txt`. A slice holds that entrypoint's API reference section and the guide pages whose home it is; every guide lives in exactly one slice, and a slice that needs another's guide names it under "Also read". Each file is at most 50.0 KB; a longer one continues in numbered parts, each naming the next at its top. Moving across versions: load `llms/upgrading.txt` and the range slices it lists between your version and the target. `llms-full.txt` inlines everything; it is far larger than a context window, so do not read it whole.
|
|
10
10
|
|
|
11
11
|
## Entrypoint slices
|
|
12
|
-
- **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 47.
|
|
12
|
+
- **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 47.5 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 36.5 KB
|
|
13
13
|
- **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.2 KB
|
|
14
14
|
- **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.6 KB
|
|
15
15
|
- **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 9.2 KB
|
|
@@ -60,6 +60,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
60
60
|
- **stitchkit/process/owner-loss**: [llms/process-owner-loss.txt](llms/process-owner-loss.txt) 0.9 KB
|
|
61
61
|
- **stitchkit/files/packaging**: [llms/files-packaging.txt](llms/files-packaging.txt) 3.5 KB
|
|
62
62
|
- **stitchkit/http**: [llms/http.txt](llms/http.txt) 0.9 KB
|
|
63
|
+
- **stitchkit/realtime**: [llms/realtime.txt](llms/realtime.txt) 1.4 KB
|
|
63
64
|
|
|
64
65
|
## Upgrading slices
|
|
65
66
|
- **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 12.2 KB
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stitchkit",
|
|
3
|
-
"version": "0.110.
|
|
3
|
+
"version": "0.110.1",
|
|
4
4
|
"description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -260,6 +260,10 @@
|
|
|
260
260
|
"./http": {
|
|
261
261
|
"types": "./dist/entrypoints/http.d.ts",
|
|
262
262
|
"import": "./dist/entrypoints/http.js"
|
|
263
|
+
},
|
|
264
|
+
"./realtime": {
|
|
265
|
+
"types": "./dist/entrypoints/realtime.d.ts",
|
|
266
|
+
"import": "./dist/entrypoints/realtime.js"
|
|
263
267
|
}
|
|
264
268
|
},
|
|
265
269
|
"publishConfig": {
|
|
@@ -2,9 +2,6 @@ import {
|
|
|
2
2
|
ManagedFilePathSchema2,
|
|
3
3
|
ManagedFileRefSchema2
|
|
4
4
|
} from "./index-xqhede6x.js";
|
|
5
|
-
import {
|
|
6
|
-
raceAbort
|
|
7
|
-
} from "./index-b0kddvzw.js";
|
|
8
5
|
import {
|
|
9
6
|
BoundedFileReadError,
|
|
10
7
|
readBoundedFile
|
|
@@ -19,6 +16,9 @@ import {
|
|
|
19
16
|
import {
|
|
20
17
|
AtomicFilePublicationError2
|
|
21
18
|
} from "./index-b56nnscm.js";
|
|
19
|
+
import {
|
|
20
|
+
raceAbort
|
|
21
|
+
} from "./index-b0kddvzw.js";
|
|
22
22
|
import {
|
|
23
23
|
assertPositiveSafeInteger
|
|
24
24
|
} from "./index-0s4xebbg.js";
|
|
File without changes
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
bytesToBase64Url,
|
|
6
6
|
base64UrlToBytes
|
|
7
7
|
} from "./index-dwfv9a85.js";
|
|
8
|
-
import {
|
|
9
|
-
unauthorized2
|
|
10
|
-
} from "./index-j9gxbztg.js";
|
|
11
8
|
import {
|
|
12
9
|
safeJsonParse
|
|
13
10
|
} from "./index-zsarb5xp.js";
|
|
11
|
+
import {
|
|
12
|
+
unauthorized2
|
|
13
|
+
} from "./index-j9gxbztg.js";
|
|
14
14
|
import {
|
|
15
15
|
isRecord
|
|
16
16
|
} from "./index-9jfdm5tg.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
resolveSocketIp2,
|
|
3
3
|
getClientInfo2
|
|
4
4
|
} from "./index-kw1ws0cs.js";
|
|
5
|
-
import {
|
|
6
|
-
resolveTraceContext2
|
|
7
|
-
} from "./index-yex7eg1v.js";
|
|
8
5
|
import {
|
|
9
6
|
isUnsafeKey
|
|
10
7
|
} from "./index-zsarb5xp.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveTraceContext2
|
|
10
|
+
} from "./index-yex7eg1v.js";
|
|
11
11
|
|
|
12
12
|
// src/observability/context.ts
|
|
13
13
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
PrivateAddressRefusal,
|
|
7
7
|
readCapped
|
|
8
8
|
} from "./index-3h0ztg0z.js";
|
|
9
|
-
import {
|
|
10
|
-
raceAbort
|
|
11
|
-
} from "./index-b0kddvzw.js";
|
|
12
9
|
import {
|
|
13
10
|
writeFileAtomicSync2
|
|
14
11
|
} from "./index-07dcf2yn.js";
|
|
12
|
+
import {
|
|
13
|
+
raceAbort
|
|
14
|
+
} from "./index-b0kddvzw.js";
|
|
15
15
|
import {
|
|
16
16
|
assertPositiveSafeInteger
|
|
17
17
|
} from "./index-0s4xebbg.js";
|