stitchkit 0.115.0 → 0.117.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/CHANGELOG.md +67 -0
- package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
- package/dist/agent-runtime/run-acquisition.d.ts +9 -2
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts +3 -0
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-failure.d.ts +4 -1
- package/dist/agent-runtime/run-failure.d.ts.map +1 -1
- package/dist/agent-runtime/run-store-retry.d.ts +8 -0
- package/dist/agent-runtime/run-store-retry.d.ts.map +1 -0
- package/dist/agent-runtime/run-terminal.d.ts.map +1 -1
- package/dist/agent-runtime/run-unacquired.d.ts +19 -0
- package/dist/agent-runtime/run-unacquired.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance.d.ts +8 -0
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver-contract.d.ts +5 -0
- package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-commit.d.ts +34 -4
- package/dist/agent-runtime/terminal-commit.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
- package/dist/entrypoints/agent-runtime/harness.js +4 -4
- package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +7 -7
- package/dist/entrypoints/agent-runtime/sqlite/node.js +7 -7
- package/dist/entrypoints/agent-runtime/testing.js +26 -8
- package/dist/entrypoints/agent-runtime.d.ts +1 -1
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +17 -15
- package/dist/entrypoints/application/diagnostic-journal.js +1 -1
- package/dist/entrypoints/application/directory-inbox.js +3 -3
- package/dist/entrypoints/cli/publish.js +2 -2
- package/dist/entrypoints/cli.js +3 -3
- package/dist/entrypoints/files.js +2 -2
- package/dist/entrypoints/primitives.js +51 -154
- package/dist/entrypoints/server.js +6 -6
- package/dist/entrypoints/telegram/grammy.js +2 -2
- package/dist/entrypoints/telegram.d.ts +1 -1
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +203 -70
- package/dist/entrypoints/tools.js +3 -3
- package/dist/entrypoints/tracking/contract.d.ts +11 -0
- package/dist/entrypoints/tracking/contract.d.ts.map +1 -0
- package/dist/entrypoints/tracking/contract.js +162 -0
- package/dist/entrypoints/tracking/performance.d.ts +8 -0
- package/dist/entrypoints/tracking/performance.d.ts.map +1 -0
- package/dist/entrypoints/tracking/performance.js +181 -0
- package/dist/entrypoints/tracking/server.d.ts +1 -0
- package/dist/entrypoints/tracking/server.d.ts.map +1 -1
- package/dist/entrypoints/tracking/server.js +40 -12
- package/dist/entrypoints/tracking.d.ts +4 -3
- package/dist/entrypoints/tracking.d.ts.map +1 -1
- package/dist/entrypoints/tracking.js +43 -143
- package/dist/entrypoints/xlsx.d.ts +4 -0
- package/dist/entrypoints/xlsx.d.ts.map +1 -0
- package/dist/entrypoints/xlsx.js +406 -0
- package/dist/{index-crmswbrt.js → index-073nw9qr.js} +8 -8
- package/dist/index-1f40z584.js +7 -0
- package/dist/{index-nregbbsc.js → index-6f49krb5.js} +1 -1
- package/dist/{index-fdk4r4r6.js → index-75ns2ybj.js} +1 -1
- package/dist/{index-x0ddbj85.js → index-arjmb6de.js} +36 -1
- package/dist/{index-944x38nv.js → index-cycp3r3e.js} +125 -182
- package/dist/{index-dx5cm9pc.js → index-ghtpfz4z.js} +9 -9
- package/dist/{index-n3v695sb.js → index-hdjmdwsj.js} +277 -96
- package/dist/{index-7yx8j6ay.js → index-n5sv4z0w.js} +12 -3
- package/dist/{index-zqkz4af9.js → index-nqxrm176.js} +1 -1
- package/dist/{index-j8kf56wx.js → index-q968hy6y.js} +1 -1
- package/dist/index-qezhmp51.js +242 -0
- package/dist/index-vv1sch8a.js +94 -0
- package/dist/{index-3qqdqwxe.js → index-w7jq3fz9.js} +25 -5
- package/dist/{index-fggxgbrk.js → index-xx1j310k.js} +165 -102
- package/dist/internal/contained-files.d.ts +10 -0
- package/dist/internal/contained-files.d.ts.map +1 -1
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/primitives/decimal.d.ts +10 -0
- package/dist/primitives/decimal.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +3 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/money.d.ts +20 -0
- package/dist/primitives/money.d.ts.map +1 -1
- package/dist/primitives/quantity.d.ts.map +1 -1
- package/dist/primitives/rounding.d.ts +40 -0
- package/dist/primitives/rounding.d.ts.map +1 -0
- package/dist/telegram/budget-transformer.d.ts +6 -3
- package/dist/telegram/budget-transformer.d.ts.map +1 -1
- package/dist/telegram/not-dispatched.d.ts +2 -2
- package/dist/telegram/not-dispatched.d.ts.map +1 -1
- package/dist/telegram/outbound-budget.d.ts +72 -20
- package/dist/telegram/outbound-budget.d.ts.map +1 -1
- package/dist/telegram/outbound-cost.d.ts +5 -0
- package/dist/telegram/outbound-cost.d.ts.map +1 -0
- package/dist/telegram/outbound-pauses.d.ts +17 -0
- package/dist/telegram/outbound-pauses.d.ts.map +1 -0
- package/dist/telegram/outbound-queue.d.ts +17 -0
- package/dist/telegram/outbound-queue.d.ts.map +1 -0
- package/dist/tools/cli/view.d.ts +7 -1
- package/dist/tools/cli/view.d.ts.map +1 -1
- package/dist/tracking/attribution.d.ts +1 -1
- package/dist/tracking/attribution.d.ts.map +1 -1
- package/dist/tracking/client-visit.d.ts +3 -1
- package/dist/tracking/client-visit.d.ts.map +1 -1
- package/dist/tracking/client.d.ts.map +1 -1
- package/dist/tracking/performance/collector.d.ts +61 -0
- package/dist/tracking/performance/collector.d.ts.map +1 -0
- package/dist/tracking/performance/schema.d.ts +45 -0
- package/dist/tracking/performance/schema.d.ts.map +1 -0
- package/dist/tracking/performance/summary.d.ts +12 -0
- package/dist/tracking/performance/summary.d.ts.map +1 -0
- package/dist/tracking/privacy.d.ts +5 -0
- package/dist/tracking/privacy.d.ts.map +1 -0
- package/dist/tracking/server/telemetry-health.d.ts +31 -0
- package/dist/tracking/server/telemetry-health.d.ts.map +1 -0
- package/dist/xlsx/cells.d.ts +17 -0
- package/dist/xlsx/cells.d.ts.map +1 -0
- package/dist/xlsx/render.d.ts +11 -0
- package/dist/xlsx/render.d.ts.map +1 -0
- package/dist/xlsx/schema.d.ts +119 -0
- package/dist/xlsx/schema.d.ts.map +1 -0
- package/dist/xlsx/zip.d.ts +13 -0
- package/dist/xlsx/zip.d.ts.map +1 -0
- package/llms/agent-runtime.2.txt +40 -16
- package/llms/agent-runtime.3.txt +17 -0
- package/llms/agent-runtime.txt +6 -3
- package/llms/cli.txt +3 -1
- package/llms/primitives.txt +21 -0
- package/llms/stitchkit.txt +9 -6
- package/llms/telegram.txt +39 -12
- package/llms/tracking-contract.txt +32 -0
- package/llms/tracking-performance.txt +21 -0
- package/llms/tracking-server.txt +1 -0
- package/llms/tracking.txt +75 -12
- package/llms/{upgrading-0.104.0-0.115.0.txt → upgrading-0.105.0-0.117.0.txt} +73 -124
- package/llms/{upgrading-0.44.0-0.61.0.txt → upgrading-0.44.0-0.62.0.txt} +120 -3
- package/llms/{upgrading-0.62.0-0.78.0.txt → upgrading-0.63.0-0.83.0.txt} +181 -120
- package/llms/{upgrading-0.79.0-0.103.13.txt → upgrading-0.84.0-0.104.0.txt} +124 -181
- package/llms/upgrading.txt +4 -4
- package/llms/xlsx.txt +107 -0
- package/llms-full.txt +390 -34
- package/llms.txt +15 -11
- package/package.json +27 -9
- package/dist/{index-z3d6smer.js → index-tdpmfks8.js} +5 -5
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const XlsxColumnSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
key: z.ZodString;
|
|
4
|
+
header: z.ZodString;
|
|
5
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
type: z.ZodLiteral<"text">;
|
|
7
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
8
|
+
key: z.ZodString;
|
|
9
|
+
header: z.ZodString;
|
|
10
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
type: z.ZodLiteral<"number">;
|
|
12
|
+
format: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
14
|
+
key: z.ZodString;
|
|
15
|
+
header: z.ZodString;
|
|
16
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
type: z.ZodLiteral<"date">;
|
|
18
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
+
key: z.ZodString;
|
|
20
|
+
header: z.ZodString;
|
|
21
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
type: z.ZodLiteral<"datetime">;
|
|
23
|
+
timeZone: z.ZodString;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
key: z.ZodString;
|
|
26
|
+
header: z.ZodString;
|
|
27
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
type: z.ZodLiteral<"money">;
|
|
29
|
+
currency: z.ZodString;
|
|
30
|
+
scale: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
+
key: z.ZodString;
|
|
33
|
+
header: z.ZodString;
|
|
34
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
type: z.ZodLiteral<"boolean">;
|
|
36
|
+
}, z.core.$strip>], "type">;
|
|
37
|
+
export type XlsxColumn = z.infer<typeof XlsxColumnSchema>;
|
|
38
|
+
export declare const XlsxSheetSchema: z.ZodObject<{
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
columns: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
41
|
+
key: z.ZodString;
|
|
42
|
+
header: z.ZodString;
|
|
43
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
type: z.ZodLiteral<"text">;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
key: z.ZodString;
|
|
47
|
+
header: z.ZodString;
|
|
48
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
type: z.ZodLiteral<"number">;
|
|
50
|
+
format: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
key: z.ZodString;
|
|
53
|
+
header: z.ZodString;
|
|
54
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
type: z.ZodLiteral<"date">;
|
|
56
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
+
key: z.ZodString;
|
|
58
|
+
header: z.ZodString;
|
|
59
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
type: z.ZodLiteral<"datetime">;
|
|
61
|
+
timeZone: z.ZodString;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
key: z.ZodString;
|
|
64
|
+
header: z.ZodString;
|
|
65
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
type: z.ZodLiteral<"money">;
|
|
67
|
+
currency: z.ZodString;
|
|
68
|
+
scale: z.ZodNumber;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
key: z.ZodString;
|
|
71
|
+
header: z.ZodString;
|
|
72
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
type: z.ZodLiteral<"boolean">;
|
|
74
|
+
}, z.core.$strip>], "type">>>;
|
|
75
|
+
rows: z.ZodReadonly<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export declare const XlsxWorkbookSchema: z.ZodObject<{
|
|
78
|
+
sheets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
columns: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
81
|
+
key: z.ZodString;
|
|
82
|
+
header: z.ZodString;
|
|
83
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
type: z.ZodLiteral<"text">;
|
|
85
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
+
key: z.ZodString;
|
|
87
|
+
header: z.ZodString;
|
|
88
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
type: z.ZodLiteral<"number">;
|
|
90
|
+
format: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
92
|
+
key: z.ZodString;
|
|
93
|
+
header: z.ZodString;
|
|
94
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
type: z.ZodLiteral<"date">;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
key: z.ZodString;
|
|
98
|
+
header: z.ZodString;
|
|
99
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
type: z.ZodLiteral<"datetime">;
|
|
101
|
+
timeZone: z.ZodString;
|
|
102
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
103
|
+
key: z.ZodString;
|
|
104
|
+
header: z.ZodString;
|
|
105
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
type: z.ZodLiteral<"money">;
|
|
107
|
+
currency: z.ZodString;
|
|
108
|
+
scale: z.ZodNumber;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
key: z.ZodString;
|
|
111
|
+
header: z.ZodString;
|
|
112
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
type: z.ZodLiteral<"boolean">;
|
|
114
|
+
}, z.core.$strip>], "type">>>;
|
|
115
|
+
rows: z.ZodReadonly<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
116
|
+
}, z.core.$strip>>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
export type XlsxWorkbook = z.input<typeof XlsxWorkbookSchema>;
|
|
119
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/xlsx/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAqB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAK1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ZIP container an XLSX is: deflated entries, no directories, no extras.
|
|
3
|
+
*
|
|
4
|
+
* Written here rather than taken from a library because the package has one
|
|
5
|
+
* runtime dependency and this format needs about a hundred lines. Compression
|
|
6
|
+
* goes through the platform's `CompressionStream`. Entry times are the format's
|
|
7
|
+
* epoch, so the same workbook always produces the same bytes.
|
|
8
|
+
*/
|
|
9
|
+
export declare function zip(entries: readonly {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly content: string;
|
|
12
|
+
}[]): Promise<Uint8Array>;
|
|
13
|
+
//# sourceMappingURL=zip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/xlsx/zip.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuDH,wBAAsB,GAAG,CACvB,OAAO,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,GACtE,OAAO,CAAC,UAAU,CAAC,CA8DrB"}
|
package/llms/agent-runtime.2.txt
CHANGED
|
@@ -237,6 +237,46 @@ canonical run and failed assistant atomically, removes the run from recovery
|
|
|
237
237
|
indexes, and publishes the resulting `run-state`. A run that moved since it was
|
|
238
238
|
read returns a conflict; `staleOwner: true` is mandatory evidence, not a default.
|
|
239
239
|
|
|
240
|
+
The same evidence holds inside one process when a store failure outlives the
|
|
241
|
+
run's own handling. A store call around execution that throws is retried for
|
|
242
|
+
about half a second, then decided by where the run stood. Retries bound a call
|
|
243
|
+
that fails, not one that hangs, so give the store its own timeouts:
|
|
244
|
+
|
|
245
|
+
| Failure | Outcome of `result` |
|
|
246
|
+
|---|---|
|
|
247
|
+
| reading or acquiring the run, retries spent, or a lost reply to the acquisition | resolves with reason `abandoned`, the cause on the operator's `run-terminal` |
|
|
248
|
+
| the first assistant draft | resolves with reason `runtime_failure`, like a checkpoint later in the turn |
|
|
249
|
+
| a conflict on a run another executor holds | rejects with the conflict; the record stays that executor's |
|
|
250
|
+
| a conflict on a run still queued, behind another run | rejects with `AgentRunUnsettledError`; `recover()` or `resume` picks it up |
|
|
251
|
+
| the terminal commit, or closing the run, retries spent | rejects with `AgentRunUnsettledError` |
|
|
252
|
+
|
|
253
|
+
`AgentRunUnsettledError.run` is the record as last read, and the store may be ahead
|
|
254
|
+
of it. Nothing in this process executes that run, and later turns of its
|
|
255
|
+
conversation wait behind it. `recover()` skips a `running` run with a live owner, so
|
|
256
|
+
a long-running process closes it itself once the store answers. Read the record
|
|
257
|
+
first: with no owner or with `error.ownerId` it is this runtime's, and any other
|
|
258
|
+
owner is executing it.
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
const settled = await ticket.result.catch(async (error) => {
|
|
262
|
+
if (!(error instanceof AgentRunUnsettledError)) throw error
|
|
263
|
+
const { conversationId, id: runId } = error.run
|
|
264
|
+
const current = await store.loadRun({ conversationId, runId })
|
|
265
|
+
if (current && [undefined, error.ownerId].includes(current.run.ownerId)) {
|
|
266
|
+
await runtime.abandon({
|
|
267
|
+
conversationId,
|
|
268
|
+
runId,
|
|
269
|
+
expectedRevision: current.run.revision,
|
|
270
|
+
staleOwner: true,
|
|
271
|
+
})
|
|
272
|
+
}
|
|
273
|
+
throw error
|
|
274
|
+
})
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
A `queued` run lost to a run ahead of it, and `runtime.resume()` can run it instead
|
|
278
|
+
once that one ends.
|
|
279
|
+
|
|
240
280
|
## Store operations
|
|
241
281
|
|
|
242
282
|
`AgentRuntimeStore` remains the runtime-facing aggregate. Application adapters
|
|
@@ -837,19 +877,3 @@ reconcile.
|
|
|
837
877
|
|
|
838
878
|
The sink deduplicates stable event IDs by default. Cross-crash exactly-once still requires a durable
|
|
839
879
|
outbox.
|
|
840
|
-
|
|
841
|
-
## Deterministic race and adapter proof
|
|
842
|
-
|
|
843
|
-
`stitchkit/agent-runtime/testing` exports `createAgentRaceBarrier`, `createAgentRaceDriver`,
|
|
844
|
-
`createAgentRaceTrace` and `runAgentStoreConformance` — agent testing tools live beside the agent
|
|
845
|
-
runtime, and `stitchkit/testing` imports none of it. Barriers have bounded teardown, traces assert exact partial order, and the
|
|
846
|
-
helpers are exercised from packed Bun and Node consumers. `runAgentStoreConformance` runs duplicate,
|
|
847
|
-
coalescing, collision, stale checkpoint, replay safety, terminal race, absorption, bounded reads,
|
|
848
|
-
causal queued-history order, durable interrupt priority, compaction and recovery invariants against
|
|
849
|
-
any fresh durable adapter.
|
|
850
|
-
|
|
851
|
-
It picks its conversation identities itself and passes them to `createStore(context)` **before the
|
|
852
|
-
first mutation**, so an adapter whose runtime rows reference an application-owned conversation row
|
|
853
|
-
can provision those parents; the optional `cleanup(context)` removes them again, and runs once
|
|
854
|
-
whether the scenario passed or failed. A factory that owns no fixture state ignores the argument and
|
|
855
|
-
keeps working unchanged.
|
package/llms/agent-runtime.3.txt
CHANGED
|
@@ -12,6 +12,22 @@ Parts of this slice:
|
|
|
12
12
|
# Guide: Agent application runtime (docs/guide/agent-runtime.md) (continued)
|
|
13
13
|
==============================================================================
|
|
14
14
|
|
|
15
|
+
## Deterministic race and adapter proof
|
|
16
|
+
|
|
17
|
+
`stitchkit/agent-runtime/testing` exports `createAgentRaceBarrier`, `createAgentRaceDriver`,
|
|
18
|
+
`createAgentRaceTrace` and `runAgentStoreConformance` — agent testing tools live beside the agent
|
|
19
|
+
runtime, and `stitchkit/testing` imports none of it. Barriers have bounded teardown, traces assert exact partial order, and the
|
|
20
|
+
helpers are exercised from packed Bun and Node consumers. `runAgentStoreConformance` runs duplicate,
|
|
21
|
+
coalescing, collision, stale checkpoint, replay safety, terminal race, absorption, bounded reads,
|
|
22
|
+
causal queued-history order, durable interrupt priority, compaction and recovery invariants against
|
|
23
|
+
any fresh durable adapter.
|
|
24
|
+
|
|
25
|
+
It picks its conversation identities itself and passes them to `createStore(context)` **before the
|
|
26
|
+
first mutation**, so an adapter whose runtime rows reference an application-owned conversation row
|
|
27
|
+
can provision those parents; the optional `cleanup(context)` removes them again, and runs once
|
|
28
|
+
whether the scenario passed or failed. A factory that owns no fixture state ignores the argument and
|
|
29
|
+
keeps working unchanged.
|
|
30
|
+
|
|
15
31
|
## Plain completions and shared invocation receipts
|
|
16
32
|
|
|
17
33
|
Use `createModelInvocationLedger` from `stitchkit/agent-runtime` when a direct text
|
|
@@ -191,6 +207,7 @@ Server-only optional application runtime. See the
|
|
|
191
207
|
| `AgentRuntimeRecoverOptions` | _type_ | bounded paged startup recovery with causal per-conversation scheduling, context resolver and explicit evidence policy |
|
|
192
208
|
| `AgentRuntimeAbandonInput` | _type_ | one known orphan identity, expected revision and mandatory stale-owner evidence for `runtime.abandon()` |
|
|
193
209
|
| `AgentRuntimeConflictError` | class | thrown when a store mutation loses to a concurrent writer — catchable by type from `stitchkit/agent-runtime` |
|
|
210
|
+
| `AgentRunUnsettledError` | class | rejects `result` when the store never answered: `.run` is still active with no executor, close it with `runtime.abandon()` |
|
|
194
211
|
| `AgentSessionCloseOptions` | _type_ | `gracePeriodMs` for natural settlement, then abort, then `forceTimeoutMs` for bounded settlement after it |
|
|
195
212
|
| `AgentSessionCloseResult` | _type_ | what `close()` achieved: `settled`, or `timedOut` with `remaining` runs still in flight. Only omitting `forceTimeoutMs` guarantees nothing is in flight on return |
|
|
196
213
|
| `AgentHistoryProjectionOptions` | _type_ | storage-neutral file resolver, explicit unresolved-file behavior, and how an interrupted turn reaches the model (`interruptedAssistant`) |
|
package/llms/agent-runtime.txt
CHANGED
|
@@ -314,8 +314,8 @@ stay pinned through authorization; `write_file` plans before it and opens the pa
|
|
|
314
314
|
the parent it creates does not exist yet. Reads revalidate the pinned file identity;
|
|
315
315
|
writes and patches revalidate the pinned parent identity; search and resource discovery descend
|
|
316
316
|
only through opened directories. A path that changed during authorization refuses with `CONFLICT`.
|
|
317
|
-
|
|
318
|
-
rule on `credentials`
|
|
317
|
+
A path spelled differently from the name stored on disk refuses before any policy reads it, so on a
|
|
318
|
+
case-insensitive volume a rule on `credentials` cannot be passed by asking for `CREDENTIALS`.
|
|
319
319
|
NUL bytes are refused before either host policy sees a path.
|
|
320
320
|
Reads and edits open file candidates without blocking on special files, then require a regular
|
|
321
321
|
file. A writerless FIFO therefore refuses instead of occupying a filesystem worker. `write_file`
|
|
@@ -420,7 +420,10 @@ remains the signal-only compatibility surface and additionally waits for admissi
|
|
|
420
420
|
|
|
421
421
|
The in-memory store is a reference adapter and has process-local durability
|
|
422
422
|
only. Production applications normally call `createAgentRuntimeStore()` and
|
|
423
|
-
provide one database transaction driver
|
|
423
|
+
provide one database transaction driver. Its `transaction` owns the retry of a
|
|
424
|
+
serialization conflict, wherever the database reports it: on a statement or on
|
|
425
|
+
`COMMIT`, which some clients surface in a different shape. Pass
|
|
426
|
+
`armCommitConflict` to `runAgentStoreConformance` to prove it:
|
|
424
427
|
|
|
425
428
|
```ts
|
|
426
429
|
const store = createAgentRuntimeStore({
|
package/llms/cli.txt
CHANGED
|
@@ -670,7 +670,9 @@ myapp item_list --sort messages --top 5 --json # the same five, a
|
|
|
670
670
|
myapp item_list --sort name --ascending # ordered the other way
|
|
671
671
|
```
|
|
672
672
|
|
|
673
|
-
Groups come back largest first for the same reason
|
|
673
|
+
Groups come back largest first for the same reason, in the printed bytes even when a key looks
|
|
674
|
+
like a number; a reader that parses them into a JavaScript object reorders such keys itself.
|
|
675
|
+
A string equal to `null` or `(absent)` is quoted, so it stays apart from the missing value. A record that carries no
|
|
674
676
|
value for the sort field sorts **last in both directions**: it is not the
|
|
675
677
|
smallest, it is not on the scale at all, and letting it lead an ascending list
|
|
676
678
|
would answer a question nobody asked.
|
package/llms/primitives.txt
CHANGED
|
@@ -60,6 +60,23 @@ migration.
|
|
|
60
60
|
literal in the type; division and rational shares return an explicit remainder. It does not own
|
|
61
61
|
exchange rates.
|
|
62
62
|
|
|
63
|
+
`moneyFromDecimal('RUB', '5041.82', 2)` and `moneyToDecimal(value, 2)` cross between major units and
|
|
64
|
+
minor ones with the currency's scale as a parameter, and a value finer than that scale is refused
|
|
65
|
+
rather than cut. `multiplyMoneyByDecimal(price, '2.5', policy)` computes the exact product and rounds it
|
|
66
|
+
once. `roundMoney(value, policy)` brings an amount to a table's steps:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
const shelfPrice = defineRoundingPolicy({
|
|
70
|
+
mode: 'half-up', // or 'half-even', 'up', 'down'
|
|
71
|
+
tiers: [{ below: '100000', step: '100' }, { step: '1000' }], // minor units
|
|
72
|
+
})
|
|
73
|
+
roundMoney(moneyFromDecimal('RUB', '5041.82', 2), shelfPrice) // { minor: '504000', currency: 'RUB' }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
A policy is data, so it can be stored with the prices it produced. `roundDecimal(value, policy)` is
|
|
77
|
+
the same table over a plain decimal. `DecimalStringSchema` accepts one canonical spelling and refuses a
|
|
78
|
+
JSON number; `DecimalInputSchema` takes a spelling such as a database's `10.50` to the canonical one.
|
|
79
|
+
|
|
63
80
|
`defineUnitSystem` stores exact canonical decimal strings. Every conversion is an application
|
|
64
81
|
rational with an id. A converted `QuantityProjection` is `derived` and carries both its source and
|
|
65
82
|
conversion id; a form/database value can be marked `recorded`. Whether a derived projection is
|
|
@@ -172,6 +189,10 @@ schedules, transports and file generation remain application-owned.
|
|
|
172
189
|
| `PermissionGrantMatrix` / `PermissionCheckResult` | _types_ | compile-time complete matrix and unknown/allowed/denied runtime result |
|
|
173
190
|
| `defineMoney` / `createMoneySchema` | functions | fixed-currency JSON-safe minor-unit value and Zod schema |
|
|
174
191
|
| `addMoney` / `subtractMoney` / `multiplyMoney` / `shareMoney` / `splitMoney` | functions | exact same-currency arithmetic with explicit indivisible remainder |
|
|
192
|
+
| `moneyFromDecimal` / `moneyToDecimal` | functions | major units to minor ones and back, with the currency's scale as a parameter |
|
|
193
|
+
| `multiplyMoneyByDecimal` / `roundMoney` | functions | an exact product rounded once, and an amount brought to a policy's steps |
|
|
194
|
+
| `defineRoundingPolicy` / `roundDecimal` / `RoundingPolicySchema` / `RoundingPolicy` / `RoundingModeSchema` / `RoundingMode` | functions, schemas, _types_ | a rounding table as data, by magnitude, and its modes |
|
|
195
|
+
| `DecimalStringSchema` / `DecimalInputSchema` | schemas | one canonical decimal spelling, and the input form that reaches it; a number is refused |
|
|
175
196
|
| `Money` / `MoneyShare` / `MoneySplit` | _types_ | currency-literal value and remainder-bearing operation results |
|
|
176
197
|
| `defineUnitSystem` / `createQuantitySchema` / `addQuantity` | functions | exact decimal quantities and caller-declared finite conversions |
|
|
177
198
|
| `Quantity` / `UnitConversion` / `QuantityProjection` | _types_ | unit-literal value, rational conversion and recorded/derived provenance |
|
package/llms/stitchkit.txt
CHANGED
|
@@ -60,7 +60,7 @@ own, recorded as an ADR.
|
|
|
60
60
|
| `stitchkit/realtime` | browser, React Native/Hermes **and** server | evolving | typed realtime clients and retained topics with a required explicit Socket.IO peer loader |
|
|
61
61
|
| `stitchkit/contract` | browser **and** server | stable | the contract layer alone — `defineContract`, errors, pagination |
|
|
62
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 |
|
|
63
|
-
| `stitchkit/primitives` | browser **and** server | evolving | generic values and declarations for lifecycle, access, audit, delivery and exports |
|
|
63
|
+
| `stitchkit/primitives` | browser **and** server | evolving | generic values and declarations for lifecycle, access, audit, delivery and exports, exact money and rounding tables |
|
|
64
64
|
| `stitchkit/server` | server (Bun) | stable | `createServer`, `implement`, hooks, auth, Socket.IO server, server primitives |
|
|
65
65
|
| `stitchkit/node` | server (Node ≥ 22) | stable | `serveNode` + the runtime-agnostic core — the Node mirror of `/server` |
|
|
66
66
|
| `stitchkit/tools` | server | stable | `createMcpHandler`, `mountMcp`, `mountAgent`, the OAuth provider, native tools |
|
|
@@ -75,24 +75,27 @@ own, recorded as an ADR.
|
|
|
75
75
|
| `stitchkit/process/owner-loss` | bundled server entry (Bun, POSIX) | evolving | narrow bootstrap that keeps the process runner lazy while carrying its owner-loss guard in a single-file bundle |
|
|
76
76
|
| `stitchkit/files/packaging` | build time (Bun or Node) | evolving | installed native asset graph, integrity, Bun packaging plugin and the artifact loader check; no runtime install policy |
|
|
77
77
|
| `stitchkit/files` | server (Bun or Node) | stable | peer-free managed local-file boundary |
|
|
78
|
-
| `stitchkit/telegram` | server (Bun or Node) | evolving | peer-free Telegram platform primitives — Mini App `initData` verification, send-failure classification, one outbound budget per bot token with weighted albums and
|
|
79
|
-
| `stitchkit/telegram/grammy` | server (Bun or Node) | evolving | the token's outbound budget as one grammY client transformer — a 429 that comes back as a response pauses
|
|
78
|
+
| `stitchkit/telegram` | server (Bun or Node) | evolving | peer-free Telegram platform primitives — Mini App `initData` verification, send-failure classification, one outbound budget per bot token with weighted albums and per-chat 429 pauses, resumable broadcasts, the operator channel with dedupe, a Bot API transport that separates a request that never left from an unknown outcome, local Bot API files, webhook ownership and durable webhook update intake |
|
|
79
|
+
| `stitchkit/telegram/grammy` | server (Bun or Node) | evolving | the token's outbound budget as one grammY client transformer — a 429 that comes back as a response pauses its chat, and a cancelled wait is a request that never left |
|
|
80
80
|
| `stitchkit/telegram/html` | browser and server | evolving | Telegram's HTML as a tree — clean any markup to what Telegram accepts, cut long text into valid parts by what the reader sees, check markup before it is sent |
|
|
81
81
|
| `stitchkit/telegram/screens` | server (Bun or Node) | evolving | a bot's menus as declared screens over grammY — typed paths, actions and input, message reconciliation, state in any `StorageAdapter`, a test chat |
|
|
82
82
|
| `stitchkit/tracking` | browser **and** server | evolving | visitor-tracking mechanics — `createTrackingClient`, the tab-shared outbox, the page-leave beacon, attribution, the contract factory; no event vocabulary, no React |
|
|
83
|
+
| `stitchkit/tracking/contract` | browser **and** server | evolving | the wire shapes — the contract factory, event and visit schemas, the performance sample and its trust threshold; brings `zod` |
|
|
84
|
+
| `stitchkit/tracking/performance` | browser **and** server | evolving | Web Vitals from real visitors, collected after load through the optional peer `web-vitals`; no `zod` |
|
|
83
85
|
| `stitchkit/tracking/server` | server (Bun or Node) | evolving | the decisions a tracking backend makes — dispositions, visit lease over an application-owned store, active intervals, presence; no database |
|
|
84
86
|
| `stitchkit/release` | browser **and** server | evolving | a page follows the release it was built for — `createReleaseMarker` on the server, `createReleaseWatcher` in the browser, the `X-Build-Id` header and a socket event between them |
|
|
85
87
|
| `stitchkit/voice` | browser **and** server | evolving | the mechanics of a live voice reply — `SentenceCutter`, `speakableText`, a `SpeechQueue` that synthesises ahead and stops on interruption, the conversation phases |
|
|
86
88
|
| `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
|
|
89
|
+
| `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
|
|
87
90
|
| `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
|
|
88
91
|
| `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
|
|
89
|
-
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the
|
|
92
|
+
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the 62 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
|
|
90
93
|
| `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, the managed-resource conformance kit and manual time for schedules and retries |
|
|
91
94
|
| `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
|
|
92
95
|
| `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
|
|
93
96
|
| `stitchkit/react/keyboard` | browser | evolving | which part of a screen gets a key — ordered layers, one Escape per level, list zones with real focus; see [keyboard guide](keyboard.md) |
|
|
94
97
|
| `stitchkit/react/keyboard/testing` | server (Bun or Node) | evolving | the keyboard layers and zones without a DOM — fakes for the window, elements and key events beside the two engines, to test the order of layers, `scope`/`inert` and the edges of a zone in milliseconds |
|
|
95
|
-
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 25 of the
|
|
98
|
+
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 25 of the 62 minors since 0.56.2, most recently 0.115.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
|
|
96
99
|
| `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
|
|
97
100
|
| `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
|
|
98
101
|
| `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
|
|
@@ -104,7 +107,7 @@ own, recorded as an ADR.
|
|
|
104
107
|
| `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
|
|
105
108
|
| `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
|
|
106
109
|
| `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
|
|
107
|
-
| `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the
|
|
110
|
+
| `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 62 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
|
|
108
111
|
| `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
|
|
109
112
|
| `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
|
|
110
113
|
| `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
|
package/llms/telegram.txt
CHANGED
|
@@ -122,19 +122,46 @@ cast, and a send cancelled in the queue then waits for its slot and fails as
|
|
|
122
122
|
a follow-up call to action after an album costs one more. Reads and edits
|
|
123
123
|
(`getMe`, `getFile`, `editMessage*`, `deleteMessage`, `sendChatAction`) do not
|
|
124
124
|
spend the budget.
|
|
125
|
+
- **Two lanes share one rate.** A call is `interactive` by default; a campaign passes
|
|
126
|
+
`{ lane: 'bulk' }` to `run` or `acquire`, or installs
|
|
127
|
+
`telegramBudgetTransformer(budget, { lane: 'bulk' })` on its own `Api`. A waiting
|
|
128
|
+
interactive call is granted first, so a reply never queues behind recipients;
|
|
129
|
+
the wait it can still see is the interval of the grant before it, up to one
|
|
130
|
+
album. Bulk runs at whatever rate replies leave, and the sum never exceeds
|
|
131
|
+
`messagesPerSecond`.
|
|
125
132
|
- **The first send after idle is immediate; the rest are spaced.** This is a
|
|
126
133
|
strict budget, not a bucket that saves a burst: at 24/s the next send is due
|
|
127
|
-
one interval later.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
one interval later. When a pause ends, one send is released at the deadline and
|
|
135
|
+
the queue continues one interval at a time, never as a stampede.
|
|
136
|
+
- **A 429 holds the chat that got it.** Telegram words a group's limit, a chat's
|
|
137
|
+
pace and the bot's own limit alike, and only the addressee differs, so `run`
|
|
138
|
+
pauses the `chat_id` of the refused send and every other chat of the token goes
|
|
139
|
+
on at the shared rate. A person's reply does not wait behind a notification
|
|
140
|
+
group on its limit, and neither does a campaign. Refusals from
|
|
141
|
+
`tokenPauseChats` different chats (default 3) inside `tokenPauseWindowMs`
|
|
142
|
+
(default 5000) are read as the bot's own limit and pause the whole token, and so
|
|
143
|
+
does a 429 with no chat in the payload. `stats().pausedChats` counts the chats
|
|
144
|
+
on a pause; `stats().pausedForMs` is the token's.
|
|
145
|
+
- **A chat known to hit its limit can keep a 429 to itself.** A notification group
|
|
146
|
+
runs into its per-minute limit as a matter of course. `{ refusal: 'call' }` on `run`,
|
|
147
|
+
or `telegramBudgetTransformer(budget, { refusal: 'call' })` on that group's own `Api`,
|
|
148
|
+
makes the refusal concern that send alone: nothing pauses and nothing counts towards
|
|
149
|
+
`tokenPauseChats`. The call still spends the budget and waits out other pauses, and
|
|
150
|
+
what to do with the refused message stays the caller's decision.
|
|
151
|
+
- **A wait can be bounded.** A burst to one chat on pause otherwise queues without
|
|
152
|
+
limit. `{ maxWaitMs }` on `run` or `acquire`, or on
|
|
153
|
+
`telegramBudgetTransformer(budget, { maxWaitMs })`, ends a call that waited that
|
|
154
|
+
long with `TelegramNotDispatchedError`, stage `queue`: nothing was sent and no
|
|
155
|
+
message was spent, so repeating it is safe.
|
|
156
|
+
- **It paces; it does not retry.** `run` calls the send once. A 429 pauses for
|
|
157
|
+
Telegram's `retry_after` (or `retryAfterFallbackMs` when Telegram gave none) and
|
|
158
|
+
rethrows; the caller's retry policy decides what happens next.
|
|
133
159
|
The refusal may be thrown or returned: a client transformer sits below the
|
|
134
160
|
place where grammY turns Telegram's `{ ok: false, error_code: 429, … }` body into
|
|
135
161
|
a `GrammyError`, so `run` reads that body too and hands it back unchanged.
|
|
136
|
-
A 429 from an edit or a read
|
|
137
|
-
|
|
162
|
+
A 429 from an edit or a read concerns that call and pauses nothing;
|
|
163
|
+
`budget.pauseAfter(error, { chatId })` remains for a caller who decides otherwise, and pauses
|
|
164
|
+
the token when it names no chat. A network failure is rethrown unchanged and stays `unknown`; a 5xx
|
|
138
165
|
is rethrown unchanged and stays `server-error`. Neither is retried by the
|
|
139
166
|
budget or pauses the token — repeating a send whose outcome is unknown is a
|
|
140
167
|
decision, not a primitive's silent guess.
|
|
@@ -146,9 +173,9 @@ cast, and a send cancelled in the queue then waits for its slot and fails as
|
|
|
146
173
|
the client's own error — not evidence that Telegram did not accept it — so
|
|
147
174
|
keep the outcome unknown rather than retrying it as a definite failure.
|
|
148
175
|
- **Non-send retries wait without spending.** An edit or delete retry that got
|
|
149
|
-
a 429
|
|
150
|
-
|
|
151
|
-
the token's
|
|
176
|
+
a 429 records the pause with `budget.pauseAfter(error, { chatId })`, then uses
|
|
177
|
+
`await budget.waitUntilResumed(signal, { chatId })`; it shares that chat's pause
|
|
178
|
+
and the token's, and takes no message slot. Without `chatId` it pauses the token.
|
|
152
179
|
|
|
153
180
|
`telegramBroadcastSender` and `telegramOperatorSender` still send through
|
|
154
181
|
`callTelegramBotApi`; they are not a second budget. Their returned function does
|
|
@@ -608,7 +635,7 @@ injected grammY bot. → ADR 0143, ADR 0201, ADR 0274 — [guide](../guide/teleg
|
|
|
608
635
|
| `TelegramFetch` / `TelegramBotTransportOpen` / `TelegramBotTransportResolve` / `TelegramBotTransportSocket` | _types_ | the `(url, init) => Promise<Response>` the senders take; the transport's socket factory, resolver and the structural socket it needs (a Node `net.Socket` or `tls.TLSSocket` fits) |
|
|
609
636
|
| `TelegramNotDispatchedError` / `TelegramNotDispatchedStage` | class / _type_ | a request that provably never left (`lookup`, `connect` or `request`), so repeating it cannot duplicate a message |
|
|
610
637
|
| `TelegramSendFailureReason` / `TELEGRAM_SEND_FAILURE_REASONS` | _type_ / constant | `blocked-by-user` / `user-deactivated` / `chat-not-found` / `not-started` / `bot-to-bot-disabled` / `rate-limited` / `message-invalid` / `server-error` / `not-dispatched` / `unknown`, and the same as a list; a `Record<TelegramSendFailureReason, …>` over them fails to compile when a reason is added |
|
|
611
|
-
| `telegramOutboundBudget` / `TelegramOutboundBudget` / `TelegramOutboundBudgetConfig` / `TelegramOutboundBudgetStats` | function / _type_ | one token-wide outbound budget: one object per token in the process, strict 24 messages/s by default, weighted albums and multi-message copies, `run(method, payload, signal, send)` as the transformer adapter (a 429 pauses
|
|
638
|
+
| `telegramOutboundBudget` / `TelegramOutboundBudget` / `TelegramOutboundBudgetConfig` / `TelegramOutboundBudgetStats` / `TelegramOutboundCallOptions` / `TelegramOutboundChatOptions` / `TelegramOutboundLane` | function / _type_ | one token-wide outbound budget: one object per token in the process, strict 24 messages/s by default, weighted albums and multi-message copies, an `interactive` lane granted before `bulk`, `run(method, payload, signal, send, { lane, maxWaitMs })` as the transformer adapter (a 429 on a send pauses its `chat_id` whether `send` throws it or resolves with the Bot API's `{ ok: false, … }` body, and refusals from `tokenPauseChats` chats pause the token), `pause`/`pauseAfter` for 429, `waitUntilResumed` for non-send retries and `stats`; it paces and never retries, and no public value carries the token |
|
|
612
639
|
| `runTelegramBroadcast` | function | a resumable broadcast by `name` under a state `directory`: audience and journal durably recorded, pacing at `ratePerSecond` (25), exact retry delays within the finite declared budget, injected classifier, uncertain send outcomes never replayed, `dryRun`, one fenced runner per name |
|
|
613
640
|
| `TelegramBroadcastConfig` / `TelegramBroadcastSend` / `TelegramBroadcastReport` / `TelegramBroadcastRunOutcome` / `TelegramBroadcastOutcome` / `TelegramBroadcastRecipient` | _type_ | `name`, `directory`, `recipients()`, `send({ recipient, attempt })`, `maxAttempts`, `signal`, `onProgress`; counts `delivered` / `unreachable` / `failed` / `uncertain` / `pending` and `finished` / `stopped` / `halted` / `dry-run` |
|
|
614
641
|
| `TelegramBroadcastFailureSchema` / `TelegramBroadcastFailure` | schema / _type_ | injected `classify` answers retry-after/transient/permanent/ambiguous; exact provider delay is bounded by `maxRetryDelayMs` without shortening, unknown outcome remains uncertain and is never replayed |
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# stitchkit/tracking/contract — 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/tracking/contract` (docs/api/reference.md)
|
|
7
|
+
|
|
8
|
+
Also read:
|
|
9
|
+
- see `llms/tracking.txt` for the Visitor tracking guide
|
|
10
|
+
|
|
11
|
+
==============================================================================
|
|
12
|
+
# API reference: `stitchkit/tracking/contract` (docs/api/reference.md)
|
|
13
|
+
==============================================================================
|
|
14
|
+
|
|
15
|
+
## `stitchkit/tracking/contract`
|
|
16
|
+
|
|
17
|
+
The wire shapes of tracking, for a server and a shared contract. It brings `zod`, so
|
|
18
|
+
browser code that only sends events does not import it. → ADR 0280
|
|
19
|
+
|
|
20
|
+
| Export | Kind | Summary |
|
|
21
|
+
|--------|------|---------|
|
|
22
|
+
| `createTrackingContract` / `TrackingContractConfig` / `TrackingContractEndpoints` | function / _type_ | `bootstrap` (`POST /visit`) and `track` (`POST /events`, `safelistedBody`) from the application's event types, scope and optional extras |
|
|
23
|
+
| `createTrackingSchemas` / `TrackingSchemas` / `TrackingSchemasConfig` | function / _type_ | every schema of one surface — `event`, `request`, `response`, `disposition`, `entry`, `bootstrap` — from `eventTypes`, optional `eventExtras`, `buildIdPattern`, `maxEventsPerBatch` |
|
|
24
|
+
| `TrackingEventEnvelope` / `TrackingEventShape` | _type_ | `eventId`, `visitId`, `browserStreamId`, `browserSequence`, `type`, `page`, `metadata`, `clientTimestamp` |
|
|
25
|
+
| `TrackEventsRequest` / `TrackEventsResponse` / `TrackEventsResponseSchema` | _type_ / schema | a batch (`buildId`, `events`, `utm`) and its answer (`accepted`, `dispositions`) |
|
|
26
|
+
| `TrackingDisposition` / `TrackingDispositionSchema` / `TrackingDispositionStatus` / `TrackingDispositionStatusSchema` | _type_ / schema | `accepted` / `duplicate` / `identity-invalid` / `excluded-bot` — every one terminal |
|
|
27
|
+
| `VisitEntryContext` / `VisitEntryContextShape` / `VisitBootstrapResponse` / `VisitBootstrapResponseSchema` | _type_ / schema | what a browser reports to open a visit (lineage, landing, referrer, UTM, display, screen, `buildId`, outbox health) and the lease it gets back |
|
|
28
|
+
| `TrackingOutboxState` / `TrackingOutboxStateSchema` | _type_ / schema | `available` / `unavailable` |
|
|
29
|
+
| `UtmData` / `UtmDataSchema` / `AttributionData` / `AttributionDataSchema` | _type_ / schema | campaign tags and a touch (UTM, referrer, landing page) |
|
|
30
|
+
| `DEFAULT_BUILD_ID_PATTERN` | const | `dev` or a git SHA |
|
|
31
|
+
| `PerformanceSampleSchema` / `PerformanceSample` / `PerformanceVitalsSchema` / `PerformanceVitals` | schemas / _types_ | one page load's wire shape; a metric that did not arrive is `null` |
|
|
32
|
+
| `summarizePerformanceMetric` / `PerformanceMetricSummary` | function / _type_ | sample count, p75, and a p95 only from 100 samples |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# stitchkit/tracking/performance — 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/tracking/performance` (docs/api/reference.md)
|
|
7
|
+
|
|
8
|
+
Also read:
|
|
9
|
+
- see `llms/tracking.txt` for the Visitor tracking guide
|
|
10
|
+
|
|
11
|
+
==============================================================================
|
|
12
|
+
# API reference: `stitchkit/tracking/performance` (docs/api/reference.md)
|
|
13
|
+
==============================================================================
|
|
14
|
+
|
|
15
|
+
## `stitchkit/tracking/performance`
|
|
16
|
+
|
|
17
|
+
| Export | Kind | Summary |
|
|
18
|
+
|--------|------|---------|
|
|
19
|
+
| `createPerformanceCollector` / `PerformanceCollector` / `PerformanceCollectorConfig` | function / _types_ | Web Vitals of this page after load: an `early` sample and a `final` beacon to `url`, undelivered ones kept for the next page; inert for a lab agent |
|
|
20
|
+
| `PerformanceHost` / `VitalsLibrary` / `VitalsMetric` / `VitalsObserver` | _types_ | the seams of the collector: the page, and the part of `web-vitals` it uses |
|
|
21
|
+
| `isLabUserAgent` | function | whether an agent admits to being a lab run or a crawler |
|
package/llms/tracking-server.txt
CHANGED
|
@@ -27,6 +27,7 @@ algorithm over a store the application implements. → ADR 0166
|
|
|
27
27
|
| `activeIntervalOf` / `ActiveTimeInterval` / `ActiveIntervalOptions` | function / _type_ | the visible-time interval an event carries, dated by the server clock; `null` for an unshaped or implausible one |
|
|
28
28
|
| `hashTrackingEvent` | function | `sha256(JSON.stringify(parsedEvent))` — the stored payload hash, unsorted on purpose so it matches what applications already hold |
|
|
29
29
|
| `isBotUserAgent` / `DEFAULT_BOT_USER_AGENT_PATTERN` | function / const | crawlers, monitors and `headlesschrome` are not visitors |
|
|
30
|
+
| `trackingTelemetryHealth` / `TrackingOutboxReport` / `TrackingTelemetryHealth` | function / _types_ | `ok`, `degraded` or `unknown` from outbox reports; a lifetime `dropped` counts only by what it grew over `baselines` |
|
|
30
31
|
| `createPresenceRegistry` / `PresenceRegistry` / `PresenceEntry` | function / _type_ | who is here now, in this process: `touch` / `snapshot(filter)` / `presentVisitOf` with a 45 s TTL |
|
|
31
32
|
|
|
32
33
|
---
|