stitchkit 0.77.0 → 0.78.0
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/dist/agent-runtime-coding-tools.js +1 -1
- package/dist/agent-runtime-harness.js +6 -6
- package/dist/agent-runtime.js +11 -11
- package/dist/application/decisions.d.ts +28 -25
- package/dist/application/decisions.d.ts.map +1 -1
- package/dist/application/kernel.d.ts +2 -0
- package/dist/application/kernel.d.ts.map +1 -1
- package/dist/application/keyspace.d.ts +11 -1
- package/dist/application/keyspace.d.ts.map +1 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/server-resource.d.ts.map +1 -1
- package/dist/application-diagnostic-journal.d.ts +21 -0
- package/dist/application-diagnostic-journal.d.ts.map +1 -0
- package/dist/application-diagnostic-journal.js +714 -0
- package/dist/application-opentelemetry.js +92 -5
- package/dist/application-schemas.js +13 -98
- package/dist/application.d.ts +1 -2
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +1775 -858
- package/dist/cli.js +7 -7
- package/dist/contract/index.js +9 -7
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files.js +1 -1
- package/dist/{index-3z73fh2c.js → index-1ckavx4h.js} +49 -1
- package/dist/{index-s2rchahr.js → index-31k1ns1s.js} +4 -4
- package/dist/{index-m668wzyc.js → index-4ntp63ps.js} +4 -4
- package/dist/{index-1rxswfbv.js → index-56fm73re.js} +1 -1
- package/dist/{index-ezmn6ac6.js → index-5r0ak8fr.js} +3 -3
- package/dist/{index-f6n5n7nz.js → index-7z69kyrh.js} +10 -87
- package/dist/{index-k2zczx1g.js → index-93xp5tgg.js} +1 -1
- package/dist/{index-bfcpjw20.js → index-actkayzn.js} +7 -3
- package/dist/index-anyqnqcv.js +79 -0
- package/dist/{index-7qy2ex0m.js → index-cwp38wxn.js} +1 -1
- package/dist/{index-35z5h2ty.js → index-dmfn9m4x.js} +125 -4
- package/dist/index-h4pj6fta.js +87 -0
- package/dist/{index-jqtsc9mj.js → index-j6mfaw26.js} +2 -2
- package/dist/{index-58jzmnn4.js → index-k45qqrdh.js} +513 -39
- package/dist/{index-8eywc9zv.js → index-kw12fsbc.js} +0 -1
- package/dist/index-n1g2xm6a.js +203 -0
- package/dist/{index-t8qyvrvg.js → index-n7apa6sy.js} +12 -12
- package/dist/{index-s4c8wy8m.js → index-qaajjfp6.js} +8 -8
- package/dist/{index-nemjkxjp.js → index-s5tn4kdv.js} +14 -10
- package/dist/index-wfq8zerm.js +92 -0
- package/dist/index.js +53 -1215
- package/dist/internal/deadline.d.ts +17 -0
- package/dist/internal/deadline.d.ts.map +1 -0
- package/dist/live.js +12 -89
- package/dist/node.js +5 -6
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/index.js +3 -3
- package/dist/primitives.js +2 -1
- package/dist/remote.js +3 -6
- package/dist/server/event-bus.d.ts.map +1 -1
- package/dist/server/index.js +31 -30
- package/dist/testing.js +1562 -87
- package/dist/tool-invoker.js +6 -6
- package/dist/tools.js +66 -23
- package/llms-full.txt +110 -13
- package/package.json +8 -4
- package/dist/index-3cwck0rm.js +0 -897
- package/dist/index-7b188kmz.js +0 -49
- package/dist/index-a916km3r.js +0 -45
- package/dist/index-vc1b0b1b.js +0 -825
- package/dist/{index-da1aqnhb.js → index-aewy3x5j.js} +3 -3
- package/dist/{index-nt1mp8km.js → index-efm026pw.js} +3 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/browser/resumable.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var PositiveSafeIntegerSchema = z.number().int().positive().safe();
|
|
4
|
+
var BackoffPolicySchema = z.object({
|
|
5
|
+
minDelayMs: PositiveSafeIntegerSchema,
|
|
6
|
+
maxDelayMs: PositiveSafeIntegerSchema,
|
|
7
|
+
jitter: z.number().min(0).max(1)
|
|
8
|
+
}).strict().readonly().refine((policy) => policy.maxDelayMs >= policy.minDelayMs, {
|
|
9
|
+
message: "maxDelayMs must be at least minDelayMs"
|
|
10
|
+
});
|
|
11
|
+
function createBackoff(policy, random = Math.random) {
|
|
12
|
+
const { minDelayMs, maxDelayMs, jitter } = BackoffPolicySchema.parse(policy);
|
|
13
|
+
let attempt = 0;
|
|
14
|
+
return {
|
|
15
|
+
next() {
|
|
16
|
+
const exponential = Math.min(maxDelayMs, minDelayMs * 2 ** attempt);
|
|
17
|
+
attempt += 1;
|
|
18
|
+
const spread = exponential * jitter * random();
|
|
19
|
+
return Math.max(1, Math.round(exponential - spread));
|
|
20
|
+
},
|
|
21
|
+
reset() {
|
|
22
|
+
attempt = 0;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var DEFAULT_RETRY = { minDelayMs: 100, maxDelayMs: 30000, jitter: 0.5 };
|
|
27
|
+
|
|
28
|
+
class ResumableAbortError extends Error {
|
|
29
|
+
constructor() {
|
|
30
|
+
super("Resumable iterator was aborted");
|
|
31
|
+
this.name = "ResumableAbortError";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function sleep(ms, signal) {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const timer = setTimeout(() => {
|
|
37
|
+
signal?.removeEventListener("abort", onAbort);
|
|
38
|
+
resolve();
|
|
39
|
+
}, ms);
|
|
40
|
+
function onAbort() {
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
reject(new ResumableAbortError);
|
|
43
|
+
}
|
|
44
|
+
if (signal?.aborted) {
|
|
45
|
+
clearTimeout(timer);
|
|
46
|
+
reject(new ResumableAbortError);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async function* resumableIterator(config) {
|
|
53
|
+
const backoff = createBackoff(config.retry ?? DEFAULT_RETRY, config.random);
|
|
54
|
+
let cursor;
|
|
55
|
+
let attempt = 0;
|
|
56
|
+
for (;; ) {
|
|
57
|
+
if (config.signal?.aborted)
|
|
58
|
+
return;
|
|
59
|
+
try {
|
|
60
|
+
const source = await config.open(cursor);
|
|
61
|
+
for await (const item of source) {
|
|
62
|
+
if (config.signal?.aborted)
|
|
63
|
+
return;
|
|
64
|
+
attempt = 0;
|
|
65
|
+
backoff.reset();
|
|
66
|
+
cursor = config.advance(item, cursor);
|
|
67
|
+
yield item;
|
|
68
|
+
if (config.isTerminal?.(item))
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
throw new Error("Resumable source ended without a terminal item");
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (config.signal?.aborted || error instanceof ResumableAbortError)
|
|
74
|
+
return;
|
|
75
|
+
attempt += 1;
|
|
76
|
+
const delayMs = backoff.next();
|
|
77
|
+
config.onAttempt?.({ number: attempt, delayMs, error });
|
|
78
|
+
try {
|
|
79
|
+
await sleep(delayMs, config.signal);
|
|
80
|
+
} catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { BackoffPolicySchema, createBackoff, resumableIterator };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collectTools,
|
|
3
3
|
createToolRunner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-cwp38wxn.js";
|
|
5
5
|
import {
|
|
6
6
|
toolErrorFromResult
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-qaajjfp6.js";
|
|
8
8
|
import {
|
|
9
9
|
assertUniqueToolName
|
|
10
10
|
} from "./index-22by16v6.js";
|