stitchkit 0.110.0 → 0.110.2
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 +17 -0
- package/dist/agent-runtime/archive-spill.d.ts +61 -0
- package/dist/agent-runtime/archive-spill.d.ts.map +1 -0
- package/dist/agent-runtime/branch-contract.d.ts +102 -0
- package/dist/agent-runtime/branch-contract.d.ts.map +1 -0
- package/dist/agent-runtime/branch-events.d.ts +18 -0
- package/dist/agent-runtime/branch-events.d.ts.map +1 -0
- package/dist/agent-runtime/branch-identities.d.ts +20 -0
- package/dist/agent-runtime/branch-identities.d.ts.map +1 -0
- package/dist/agent-runtime/branch-messages.d.ts +32 -0
- package/dist/agent-runtime/branch-messages.d.ts.map +1 -0
- package/dist/agent-runtime/branch-observations.d.ts +104 -0
- package/dist/agent-runtime/branch-observations.d.ts.map +1 -0
- package/dist/agent-runtime/branch-provider.d.ts +130 -0
- package/dist/agent-runtime/branch-provider.d.ts.map +1 -0
- package/dist/agent-runtime/branch-replay.d.ts +426 -0
- package/dist/agent-runtime/branch-replay.d.ts.map +1 -0
- package/dist/agent-runtime/branch-source.d.ts +16 -0
- package/dist/agent-runtime/branch-source.d.ts.map +1 -0
- package/dist/agent-runtime/branch-transitions.d.ts +6 -0
- package/dist/agent-runtime/branch-transitions.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-history.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
- package/dist/agent-runtime/store-archive.d.ts +1 -0
- package/dist/agent-runtime/store-archive.d.ts.map +1 -1
- package/dist/agent-runtime/store-branch.d.ts +5 -0
- package/dist/agent-runtime/store-branch.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-branch.d.ts +4 -0
- package/dist/agent-runtime/store-conformance-branch.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
- package/dist/agent-runtime/store-create.d.ts +1 -1
- package/dist/agent-runtime/store-create.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver-contract.d.ts +6 -0
- package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -1
- package/dist/agent-runtime/store-events.d.ts +90 -0
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/store-memory-archive.d.ts +8 -0
- package/dist/agent-runtime/store-memory-archive.d.ts.map +1 -0
- package/dist/agent-runtime/store-memory-events.d.ts +7 -0
- package/dist/agent-runtime/store-memory-events.d.ts.map +1 -0
- package/dist/agent-runtime/store-memory.d.ts +1 -1
- package/dist/agent-runtime/store-memory.d.ts.map +1 -1
- package/dist/agent-runtime/store-purge.d.ts +2 -0
- package/dist/agent-runtime/store-purge.d.ts.map +1 -1
- package/dist/agent-runtime/store-reduce-run.d.ts +2 -2
- package/dist/agent-runtime/store-reduce-run.d.ts.map +1 -1
- package/dist/agent-runtime/store-reduce-shared.d.ts +1 -0
- package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -1
- package/dist/agent-runtime/store-reducer.d.ts +2 -2
- package/dist/agent-runtime/store-reducer.d.ts.map +1 -1
- package/dist/agent-runtime/store.d.ts +3 -0
- package/dist/agent-runtime/store.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/durability/events.d.ts +4 -0
- package/dist/durability/events.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +2 -3
- package/dist/entrypoints/agent-runtime/harness.js +5 -4
- package/dist/entrypoints/agent-runtime/realtime.js +3 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +4 -6
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +13 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +13 -3
- package/dist/entrypoints/agent-runtime/testing.js +89 -5
- package/dist/entrypoints/agent-runtime.d.ts +1 -0
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +28 -18
- 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 +26 -24
- package/dist/{index-61m15a18.js → index-0d8m0kee.js} +1 -1
- package/dist/{index-dmfr2cg5.js → index-2tazbwhv.js} +6 -6
- package/dist/{index-c17xcx4k.js → index-56yx8dxp.js} +19 -96
- package/dist/{index-0gs4ymfj.js → index-6qeqdz0z.js} +7 -1
- package/dist/{index-064zxbwj.js → index-79zxnh52.js} +3 -3
- package/dist/{index-2pevnh0x.js → index-7c046kxr.js} +4 -4
- package/dist/index-86sxnvpr.js +336 -0
- package/dist/{index-jyw90rps.js → index-bm180f2d.js} +204 -84
- package/dist/{index-mnhtbqrb.js → index-dd1z5kxb.js} +2 -2
- package/dist/{index-7a1xhhdx.js → index-e1sjcjfy.js} +31 -11
- package/dist/{index-5p55xreg.js → index-e9rbhw1s.js} +67 -29
- 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-s2bgwsyr.js +2280 -0
- package/dist/{index-fnra8n1j.js → index-s2eybn7b.js} +9 -9
- package/dist/{index-njs9gvrh.js → index-s6d8zsha.js} +6 -6
- package/dist/index-snef22zr.js +94 -0
- package/dist/{index-c0hffcmj.js → index-zbssway3.js} +19 -2
- 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/agent-runtime.3.txt +3 -0
- package/llms/agent-runtime.txt +60 -0
- package/llms/realtime.txt +31 -0
- package/llms/stitchkit.txt +1 -0
- package/llms-full.txt +85 -0
- package/llms.txt +3 -2
- package/package.json +5 -1
- package/dist/index-8ks9b85e.js +0 -129
- package/dist/index-d2h99n7d.js +0 -1071
- 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
|
@@ -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";
|