gemi 0.204.1 → 0.205.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/ai/AgentProvider.d.ts +80 -3
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/client/index.js +12 -10
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +4 -4
- package/dist/ai/index.js.map +3 -3
- package/dist/ai/providers/anthropicRequest.d.ts +142 -0
- package/dist/ai/providers/anthropicRequest.d.ts.map +1 -0
- package/dist/ai/providers/anthropicStream.d.ts +54 -0
- package/dist/ai/providers/anthropicStream.d.ts.map +1 -0
- package/dist/ai/providers/call.d.ts +14 -3
- package/dist/ai/providers/call.d.ts.map +1 -1
- package/dist/ai/providers/capabilities.d.ts +31 -0
- package/dist/ai/providers/capabilities.d.ts.map +1 -1
- package/dist/ai/providers/endpoints.d.ts +40 -0
- package/dist/ai/providers/endpoints.d.ts.map +1 -1
- package/dist/ai/providers/http.d.ts.map +1 -1
- package/dist/ai/providers/request.d.ts +43 -1
- package/dist/ai/providers/request.d.ts.map +1 -1
- package/dist/ai/runtime.d.ts +5 -1
- package/dist/ai/runtime.d.ts.map +1 -1
- package/dist/ai/testing/RecordingProvider.d.ts +5 -2
- package/dist/ai/testing/RecordingProvider.d.ts.map +1 -1
- package/dist/ai/testing/index.js +3 -3
- package/dist/ai/testing/index.js.map +3 -3
- package/dist/ai/types.d.ts +34 -0
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/usageMeter.d.ts +4 -1
- package/dist/ai/usageMeter.d.ts.map +1 -1
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/bun/plugin.js +2 -2
- package/dist/bun/plugin.js.map +1 -1
- package/dist/bun/preload.js +2 -2
- package/dist/bun/preload.js.map +1 -1
- package/dist/{chunk-2t1eyzvq.js → chunk-06w8hhnk.js} +2 -2
- package/dist/{chunk-2t1eyzvq.js.map → chunk-06w8hhnk.js.map} +1 -1
- package/dist/{chunk-0t1d9s34.js → chunk-09hzyf9g.js} +3 -3
- package/dist/{chunk-0t1d9s34.js.map → chunk-09hzyf9g.js.map} +1 -1
- package/dist/{chunk-bq4pgzcd.js → chunk-0cckwd91.js} +2 -2
- package/dist/{chunk-bq4pgzcd.js.map → chunk-0cckwd91.js.map} +1 -1
- package/dist/{chunk-9hqnecjt.js → chunk-0eq7am78.js} +2 -2
- package/dist/{chunk-9hqnecjt.js.map → chunk-0eq7am78.js.map} +1 -1
- package/dist/{chunk-jma5d7zd.js → chunk-1em8t2x1.js} +3 -3
- package/dist/{chunk-jma5d7zd.js.map → chunk-1em8t2x1.js.map} +1 -1
- package/dist/{chunk-ek0dvbck.js → chunk-1tc6j8bn.js} +3 -3
- package/dist/{chunk-ek0dvbck.js.map → chunk-1tc6j8bn.js.map} +1 -1
- package/dist/{chunk-dk1xxtgk.js → chunk-24tj4dzx.js} +2 -2
- package/dist/{chunk-dk1xxtgk.js.map → chunk-24tj4dzx.js.map} +1 -1
- package/dist/{chunk-418n4s1m.js → chunk-2qcmcbsk.js} +2 -2
- package/dist/{chunk-418n4s1m.js.map → chunk-2qcmcbsk.js.map} +1 -1
- package/dist/{chunk-s5hdrpam.js → chunk-34vvev4a.js} +3 -3
- package/dist/{chunk-s5hdrpam.js.map → chunk-34vvev4a.js.map} +1 -1
- package/dist/{chunk-f52maa9b.js → chunk-3830ee5d.js} +2 -2
- package/dist/{chunk-f52maa9b.js.map → chunk-3830ee5d.js.map} +1 -1
- package/dist/{chunk-yykrvrpt.js → chunk-39dz1abf.js} +1 -1
- package/dist/{chunk-vsd5h2d9.js → chunk-3z8d8v8q.js} +3 -3
- package/dist/{chunk-vsd5h2d9.js.map → chunk-3z8d8v8q.js.map} +1 -1
- package/dist/{chunk-f9c8bnzx.js → chunk-460c8k50.js} +3 -3
- package/dist/{chunk-f9c8bnzx.js.map → chunk-460c8k50.js.map} +1 -1
- package/dist/{chunk-wxyxnbh6.js → chunk-4ksnhx8x.js} +4 -4
- package/dist/{chunk-wxyxnbh6.js.map → chunk-4ksnhx8x.js.map} +1 -1
- package/dist/chunk-4q59y78y.js +5 -0
- package/dist/{chunk-cf7xc02m.js.map → chunk-4q59y78y.js.map} +1 -1
- package/dist/{chunk-4m8t67px.js → chunk-65btke6p.js} +2 -2
- package/dist/{chunk-4m8t67px.js.map → chunk-65btke6p.js.map} +1 -1
- package/dist/{chunk-efnerp0c.js → chunk-6cx6kh04.js} +2 -2
- package/dist/{chunk-efnerp0c.js.map → chunk-6cx6kh04.js.map} +1 -1
- package/dist/{chunk-jmsfkzav.js → chunk-6ge27ygx.js} +2 -2
- package/dist/{chunk-jmsfkzav.js.map → chunk-6ge27ygx.js.map} +1 -1
- package/dist/{chunk-x26jb60f.js → chunk-6x2zbh1q.js} +2 -2
- package/dist/{chunk-x26jb60f.js.map → chunk-6x2zbh1q.js.map} +1 -1
- package/dist/{chunk-0hfzzb3k.js → chunk-6zpf257t.js} +3 -3
- package/dist/{chunk-0hfzzb3k.js.map → chunk-6zpf257t.js.map} +1 -1
- package/dist/{chunk-cq7hk8v9.js → chunk-72e857nw.js} +2 -2
- package/dist/{chunk-cq7hk8v9.js.map → chunk-72e857nw.js.map} +1 -1
- package/dist/{chunk-4v5c4mes.js → chunk-77dt2tap.js} +2 -2
- package/dist/{chunk-4v5c4mes.js.map → chunk-77dt2tap.js.map} +1 -1
- package/dist/{chunk-ptpzh61m.js → chunk-78g1cngk.js} +2 -2
- package/dist/{chunk-ptpzh61m.js.map → chunk-78g1cngk.js.map} +1 -1
- package/dist/{chunk-d7kknkmq.js → chunk-7wzhdq1x.js} +3 -3
- package/dist/{chunk-d7kknkmq.js.map → chunk-7wzhdq1x.js.map} +1 -1
- package/dist/{chunk-6g1xac70.js → chunk-8ar7180x.js} +2 -2
- package/dist/{chunk-6g1xac70.js.map → chunk-8ar7180x.js.map} +1 -1
- package/dist/{chunk-d3k38gk1.js → chunk-8d2g78vc.js} +2 -2
- package/dist/{chunk-d3k38gk1.js.map → chunk-8d2g78vc.js.map} +1 -1
- package/dist/{chunk-yrbvfda9.js → chunk-8ncqxja2.js} +1 -1
- package/dist/{chunk-6w6q9mxe.js → chunk-8q5kxzxn.js} +3 -3
- package/dist/{chunk-6w6q9mxe.js.map → chunk-8q5kxzxn.js.map} +1 -1
- package/dist/{chunk-y45whafz.js → chunk-9m6mkaqb.js} +2 -2
- package/dist/{chunk-y45whafz.js.map → chunk-9m6mkaqb.js.map} +1 -1
- package/dist/{chunk-zk1vwwv6.js → chunk-9qyet3nb.js} +2 -2
- package/dist/{chunk-zk1vwwv6.js.map → chunk-9qyet3nb.js.map} +1 -1
- package/dist/{chunk-p2nqksdq.js → chunk-a7rgrcs0.js} +3 -3
- package/dist/{chunk-p2nqksdq.js.map → chunk-a7rgrcs0.js.map} +1 -1
- package/dist/{chunk-x244kqcc.js → chunk-a7zqp5m7.js} +2 -2
- package/dist/{chunk-x244kqcc.js.map → chunk-a7zqp5m7.js.map} +1 -1
- package/dist/{chunk-y5kfqq4f.js → chunk-aed0vv5g.js} +2 -2
- package/dist/{chunk-y5kfqq4f.js.map → chunk-aed0vv5g.js.map} +1 -1
- package/dist/chunk-at49en07.js +11 -0
- package/dist/chunk-at49en07.js.map +21 -0
- package/dist/{chunk-13vtn7h9.js → chunk-b1fcttsr.js} +2 -2
- package/dist/{chunk-13vtn7h9.js.map → chunk-b1fcttsr.js.map} +1 -1
- package/dist/{chunk-9m7c4mws.js → chunk-ba1h9pm6.js} +2 -2
- package/dist/{chunk-9m7c4mws.js.map → chunk-ba1h9pm6.js.map} +1 -1
- package/dist/{chunk-7gxmf9rg.js → chunk-bpqkzpkt.js} +2 -2
- package/dist/{chunk-7gxmf9rg.js.map → chunk-bpqkzpkt.js.map} +1 -1
- package/dist/{chunk-qcrj4t72.js → chunk-bxznwntw.js} +2 -2
- package/dist/{chunk-qcrj4t72.js.map → chunk-bxznwntw.js.map} +1 -1
- package/dist/{chunk-4c0rb2ng.js → chunk-c8bvpkr2.js} +2 -2
- package/dist/{chunk-4c0rb2ng.js.map → chunk-c8bvpkr2.js.map} +1 -1
- package/dist/{chunk-jeq8wvj6.js → chunk-cffx7wqp.js} +2 -2
- package/dist/{chunk-jeq8wvj6.js.map → chunk-cffx7wqp.js.map} +1 -1
- package/dist/{chunk-8jfnn7v6.js → chunk-djnn8vvp.js} +2 -2
- package/dist/{chunk-8jfnn7v6.js.map → chunk-djnn8vvp.js.map} +1 -1
- package/dist/{chunk-s6bq91cm.js → chunk-dwya9z8p.js} +2 -2
- package/dist/{chunk-s6bq91cm.js.map → chunk-dwya9z8p.js.map} +1 -1
- package/dist/chunk-e0scxs81.js +5 -0
- package/dist/{chunk-xwqdh388.js.map → chunk-e0scxs81.js.map} +4 -4
- package/dist/{chunk-0shq2d31.js → chunk-eeq9ty68.js} +2 -2
- package/dist/{chunk-0shq2d31.js.map → chunk-eeq9ty68.js.map} +1 -1
- package/dist/{chunk-77x9vxht.js → chunk-emt36pxm.js} +2 -2
- package/dist/{chunk-77x9vxht.js.map → chunk-emt36pxm.js.map} +1 -1
- package/dist/{chunk-k62338g2.js → chunk-etcds9w3.js} +2 -2
- package/dist/{chunk-k62338g2.js.map → chunk-etcds9w3.js.map} +1 -1
- package/dist/{chunk-ks6dczvn.js → chunk-ff63e1wx.js} +2 -2
- package/dist/{chunk-ks6dczvn.js.map → chunk-ff63e1wx.js.map} +1 -1
- package/dist/{chunk-d5d3a8bm.js → chunk-fhn92are.js} +2 -2
- package/dist/{chunk-d5d3a8bm.js.map → chunk-fhn92are.js.map} +1 -1
- package/dist/{chunk-crqbzfd5.js → chunk-g6tqje74.js} +2 -2
- package/dist/{chunk-crqbzfd5.js.map → chunk-g6tqje74.js.map} +1 -1
- package/dist/{chunk-p9pwskv6.js → chunk-hke4hzfm.js} +2 -2
- package/dist/{chunk-p9pwskv6.js.map → chunk-hke4hzfm.js.map} +1 -1
- package/dist/{chunk-3gkxnfef.js → chunk-hqg4dfca.js} +2 -2
- package/dist/{chunk-3gkxnfef.js.map → chunk-hqg4dfca.js.map} +1 -1
- package/dist/{chunk-39hed4yr.js → chunk-hthyn5pj.js} +3 -3
- package/dist/{chunk-39hed4yr.js.map → chunk-hthyn5pj.js.map} +1 -1
- package/dist/{chunk-w3mc696j.js → chunk-jn1h76sa.js} +2 -2
- package/dist/{chunk-w3mc696j.js.map → chunk-jn1h76sa.js.map} +1 -1
- package/dist/{chunk-ezvtkbp9.js → chunk-jy26hy7z.js} +2 -2
- package/dist/{chunk-ezvtkbp9.js.map → chunk-jy26hy7z.js.map} +1 -1
- package/dist/{chunk-5km0np8s.js → chunk-jy61580r.js} +2 -2
- package/dist/{chunk-5km0np8s.js.map → chunk-jy61580r.js.map} +1 -1
- package/dist/{chunk-phvvxv1a.js → chunk-k8peybx0.js} +3 -3
- package/dist/{chunk-phvvxv1a.js.map → chunk-k8peybx0.js.map} +1 -1
- package/dist/{chunk-3xzhbkya.js → chunk-m3v661b3.js} +3 -3
- package/dist/{chunk-3xzhbkya.js.map → chunk-m3v661b3.js.map} +1 -1
- package/dist/{chunk-js9rm7g0.js → chunk-ndcqbwsj.js} +2 -2
- package/dist/{chunk-js9rm7g0.js.map → chunk-ndcqbwsj.js.map} +1 -1
- package/dist/{chunk-cdgnwzwf.js → chunk-ne51fxg2.js} +2 -2
- package/dist/{chunk-cdgnwzwf.js.map → chunk-ne51fxg2.js.map} +1 -1
- package/dist/{chunk-b1mdan5a.js → chunk-nfher0gz.js} +2 -2
- package/dist/{chunk-b1mdan5a.js.map → chunk-nfher0gz.js.map} +1 -1
- package/dist/{chunk-e5mqjren.js → chunk-njnng5ew.js} +4 -4
- package/dist/{chunk-e5mqjren.js.map → chunk-njnng5ew.js.map} +1 -1
- package/dist/{chunk-e3ehv27z.js → chunk-p9c5rc1z.js} +3 -3
- package/dist/{chunk-e3ehv27z.js.map → chunk-p9c5rc1z.js.map} +1 -1
- package/dist/{chunk-rr8bzm6k.js → chunk-q1t9gvm1.js} +2 -2
- package/dist/{chunk-rr8bzm6k.js.map → chunk-q1t9gvm1.js.map} +1 -1
- package/dist/{chunk-xvk6aqd7.js → chunk-q751b0jx.js} +3 -3
- package/dist/{chunk-xvk6aqd7.js.map → chunk-q751b0jx.js.map} +1 -1
- package/dist/{chunk-1kehwa3s.js → chunk-qc0e278w.js} +1 -1
- package/dist/{chunk-re9ac4tc.js → chunk-rbkvkv2m.js} +4 -4
- package/dist/{chunk-re9ac4tc.js.map → chunk-rbkvkv2m.js.map} +1 -1
- package/dist/{chunk-k1gt7fgy.js → chunk-rjtge67x.js} +3 -3
- package/dist/{chunk-k1gt7fgy.js.map → chunk-rjtge67x.js.map} +1 -1
- package/dist/{chunk-ybcdxrqx.js → chunk-s1fa5f8b.js} +2 -2
- package/dist/{chunk-ybcdxrqx.js.map → chunk-s1fa5f8b.js.map} +1 -1
- package/dist/{chunk-8pw4zjnx.js → chunk-scw0vknj.js} +1 -1
- package/dist/{chunk-gc9g7c4p.js → chunk-sjve1yvv.js} +3 -3
- package/dist/{chunk-gc9g7c4p.js.map → chunk-sjve1yvv.js.map} +1 -1
- package/dist/{chunk-wn4j741t.js → chunk-te4vz0rw.js} +2 -2
- package/dist/{chunk-wn4j741t.js.map → chunk-te4vz0rw.js.map} +1 -1
- package/dist/{chunk-2ngdhbz7.js → chunk-tx5zrdmb.js} +2 -2
- package/dist/{chunk-2ngdhbz7.js.map → chunk-tx5zrdmb.js.map} +1 -1
- package/dist/{chunk-pq15dt8j.js → chunk-v1d7xya8.js} +15 -15
- package/dist/{chunk-pq15dt8j.js.map → chunk-v1d7xya8.js.map} +5 -5
- package/dist/{chunk-fq5b1k4n.js → chunk-v2fd69at.js} +2 -2
- package/dist/{chunk-fq5b1k4n.js.map → chunk-v2fd69at.js.map} +1 -1
- package/dist/{chunk-n5k42dh7.js → chunk-vebstesm.js} +3 -3
- package/dist/{chunk-n5k42dh7.js.map → chunk-vebstesm.js.map} +1 -1
- package/dist/{chunk-n3kg99yw.js → chunk-vyaedzr8.js} +3 -3
- package/dist/{chunk-n3kg99yw.js.map → chunk-vyaedzr8.js.map} +1 -1
- package/dist/{chunk-9bjggtdt.js → chunk-wdrmzjtq.js} +2 -2
- package/dist/{chunk-9bjggtdt.js.map → chunk-wdrmzjtq.js.map} +1 -1
- package/dist/{chunk-5gvc03cv.js → chunk-wfees83q.js} +3 -3
- package/dist/{chunk-5gvc03cv.js.map → chunk-wfees83q.js.map} +1 -1
- package/dist/{chunk-n26atakz.js → chunk-wpfempaj.js} +3 -3
- package/dist/{chunk-n26atakz.js.map → chunk-wpfempaj.js.map} +1 -1
- package/dist/{chunk-0pgk811s.js → chunk-wrfz0jsw.js} +2 -2
- package/dist/{chunk-0pgk811s.js.map → chunk-wrfz0jsw.js.map} +1 -1
- package/dist/{chunk-c7nbzryd.js → chunk-xgc5tj8k.js} +3 -3
- package/dist/{chunk-c7nbzryd.js.map → chunk-xgc5tj8k.js.map} +1 -1
- package/dist/{chunk-1e82gfk9.js → chunk-yj1h4rzn.js} +3 -3
- package/dist/{chunk-1e82gfk9.js.map → chunk-yj1h4rzn.js.map} +1 -1
- package/dist/{chunk-k9882kqg.js → chunk-zf1eqgzt.js} +2 -2
- package/dist/{chunk-k9882kqg.js.map → chunk-zf1eqgzt.js.map} +1 -1
- package/dist/{chunk-4ex4s616.js → chunk-znw55n6g.js} +2 -2
- package/dist/{chunk-4ex4s616.js.map → chunk-znw55n6g.js.map} +1 -1
- package/dist/{chunk-6bfj0mbp.js → chunk-zvk6dydb.js} +3 -3
- package/dist/{chunk-6bfj0mbp.js.map → chunk-zvk6dydb.js.map} +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/probe/index.js +2 -2
- package/dist/probe/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/vitest/index.js +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-1x60thpm.js +0 -8
- package/dist/chunk-1x60thpm.js.map +0 -19
- package/dist/chunk-cf7xc02m.js +0 -5
- package/dist/chunk-xwqdh388.js +0 -5
- /package/dist/{chunk-yykrvrpt.js.map → chunk-39dz1abf.js.map} +0 -0
- /package/dist/{chunk-yrbvfda9.js.map → chunk-8ncqxja2.js.map} +0 -0
- /package/dist/{chunk-1kehwa3s.js.map → chunk-qc0e278w.js.map} +0 -0
- /package/dist/{chunk-8pw4zjnx.js.map → chunk-scw0vknj.js.map} +0 -0
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../ai/testing/RecordingProvider.ts", "../ai/testing/Fingerprints.ts", "../ai/testing/pinClock.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { createHash } from \"node:crypto\";\n\nimport {\n AgentProvider,\n type ProviderCapabilities,\n type ProviderEvent,\n type ProviderStreamParams,\n type ProviderToolSpec,\n} from \"../AgentProvider\";\nimport { s } from \"../Schema\";\nimport { type FingerprintOptions, Fingerprints, type RecordingFingerprints } from \"./Fingerprints\";\n\n/**\n * One model call, as a recording keeps it: what was sent (normalised, see\n * `RecordingProvider`) and what the model streamed back.\n */\nexport type RecordedCall = {\n request: RecordedRequest;\n events: ProviderEvent[];\n /** When it started among all the calls of the recording, its sub-runs' too (`ordered`). */\n at?: number;\n /** The app's position (`position`) the call's prompt was pinned to (`pin`). */\n read?: number;\n /** The app's position once the call's answer had streamed in full, before its tools ran. */\n ended?: number;\n};\n\n/**\n * A request as recorded. `messages` are the messages new since the call\n * before it (`after` says how many of that call's it resent), each without\n * the parts minted per run; `tools` is a hash of the tool list, and\n * `toolNames` the names it offered.\n */\nexport type RecordedRequest = {\n messages: { role: string; content: unknown }[];\n after?: number;\n tools?: string;\n toolNames?: string[];\n [field: string]: unknown;\n};\n\n/** What a `RecordingProvider` records, and replays from. Plain JSON: write it where you like. */\nexport type Recording = {\n version: 1;\n model: string;\n capabilities: ProviderCapabilities;\n /** When the recording started (ISO). A replay can run at that time: see `pinClock`. */\n recordedAt: string;\n calls: RecordedCall[];\n /** Sub-runs' calls (`nested(key)`), each in its own order. */\n nested?: Record<string, RecordedCall[]>;\n /** What it was made with, when recorded with `fingerprints`. See `Fingerprints`. */\n fingerprints?: RecordingFingerprints;\n};\n\n/** How `replay` matches a request against the recorded one. See `RecordingProviderOptions.match`. */\nexport type RecordingMatch = \"exact\" | \"wording\" | \"shape\";\n\nexport type RecordingProviderOptions = {\n /**\n * What a replayed request may differ in from the recorded one and still\n * replay, counted as `stale` with the reason:\n *\n * - `\"wording\"` (the default): the wording of the prompt files changed since\n * the recording, and nothing else. The static text of those files is cut\n * out of both requests (see `Fingerprints.cutters`), so the messages, the\n * tool calls and results and every value filled into the prompts must\n * still be the same. Needs a recording made with `fingerprints`, and\n * `fingerprints` on the replay to find the files.\n * - `\"shape\"`: anything but the shape of the conversation (its roles, tool\n * calls with their inputs, tool results with their status): instructions,\n * settings and message text. For an app whose prompts are not files.\n * - `\"exact\"`: nothing.\n *\n * In `\"wording\"` and `\"shape\"`, the tools offered may differ too, as long as\n * every tool call the recorded answer makes is to a tool still offered and\n * fits its schema today.\n */\n match?: RecordingMatch;\n /**\n * Fingerprint what the recording is made with (the prompt files its\n * requests carried, its tools' definitions, `inputs`), and, replaying, tell\n * a reworded prompt by them. See `Fingerprints`.\n */\n fingerprints?: FingerprintOptions;\n /**\n * Ids minted per run (a record's id, say), which a replay mints anew. Each\n * recorded id matches the id at its place in the request, the same one\n * wherever it shows, and the recorded answer is given the replay's ids.\n * Default: UUIDs.\n */\n ids?: RegExp;\n /**\n * Replays the calls, the sub-runs' too, in the order they started when\n * recorded (`at`), for runs that go side by side and whose order shows.\n * Off, each run and sub-run replays in its own order, in any interleaving.\n */\n ordered?: boolean;\n /**\n * A position in the app's own state that moves as tools run (an edit log's\n * head, say). Recording, each call keeps where it was; replaying, a call's\n * answer waits until the app gets there again, so tool calls running side by\n * side write in the recorded order. See also `pin`.\n */\n position?: () => number | Promise<number>;\n /** How long a replay waits for `ordered` or `position` before it gives up. Default 60 s. */\n waitMs?: number;\n};\n\n/** A replayed request that is not the recorded one, beyond what `match` tolerates. */\nexport class RecordingMismatchError extends Error {\n constructor(message: string) {\n super(`${message} Record again.`);\n this.name = \"RecordingMismatchError\";\n }\n}\n\nconst UUIDS = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;\n\n/** `value` with each of its strings passed through `change`. */\nfunction mapStrings(value: unknown, change: (text: string) => string): unknown {\n if (typeof value === \"string\") return change(value);\n if (Array.isArray(value)) return value.map((item) => mapStrings(item, change));\n if (value && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value).map(([key, inner]) => [key, mapStrings(inner, change)]),\n );\n }\n return value;\n}\n\n/**\n * A message's content without what a run mints and the model is not sent: a\n * tool call's sub-run transcript (`nested`, recorded on its own), and the full\n * output of a tool whose model reads a projection (`modelOutput`).\n */\nfunction withoutTranscripts<T>(value: T): T {\n return JSON.parse(\n JSON.stringify(value, function (this: Record<string, unknown>, key, inner) {\n if (key === \"nested\") return undefined;\n if (key === \"output\" && this.type === \"tool-result\" && \"modelOutput\" in this) {\n return undefined;\n }\n return inner;\n }),\n );\n}\n\nfunction resolvers(): { promise: Promise<void>; resolve: () => void } {\n let resolve!: () => void;\n const promise = new Promise<void>((done) => (resolve = done));\n return { promise, resolve };\n}\n\nconst sha256 = (text: string) => createHash(\"sha256\").update(text).digest(\"hex\");\n\nconst flatTools = (tools: NonNullable<ProviderStreamParams[\"tools\"]>): ProviderToolSpec[] =>\n tools.flatMap((tool) => (\"tools\" in tool ? tool.tools : [tool]));\n\n/**\n * The shape of a conversation, which `match: \"shape\"` keeps: each message's\n * role, its tool calls with their inputs and its tool results with their\n * status, but not its text.\n */\nfunction shapeOf(messages: { role: string; content: unknown }[]): unknown {\n return messages.map(({ role, content }) => ({\n role,\n parts: (Array.isArray(content) ? content : []).flatMap((part: any): unknown[] => {\n if (part?.type === \"tool-call\") return [{ call: part.name, input: part.input ?? part.args }];\n if (part?.type === \"tool-result\") return [{ result: part.name, status: part.status }];\n if (part?.type === \"file\") return [{ file: true }];\n return [];\n }),\n }));\n}\n\ntype Shared = {\n ids: Map<string, string>;\n stale: Set<string>;\n staleCalls: number;\n started: number;\n pending?: number[];\n moved: { promise: Promise<void>; resolve: () => void };\n};\n\n/**\n * A provider that records a live provider's calls, and replays them later\n * without one: model-backed tests and evals that run in CI, offline and for\n * free, and stay the same from run to run.\n *\n * // Recording: every call goes to `live`, and is kept.\n * const recorder = RecordingProvider.record(live);\n * await runTheCase(recorder);\n * await Bun.write(file, JSON.stringify(recorder.recording()));\n *\n * // Replaying: each call is answered with what was recorded for it.\n * const replay = RecordingProvider.replay(await Bun.file(file).json());\n * await runTheCase(replay);\n * replay.stale; // why the recording should be made again, if it should\n *\n * WHAT IS MATCHED. The n-th call replays the n-th recorded call (per run and\n * per sub-run, see `nested`), and it has to be the same request:\n *\n * - Messages are compared without ids and times, which differ per run: only\n * `role` and `content` are kept, without sub-run transcripts. A call resends\n * the messages of the one before it, so only the new ones are recorded\n * (`after`), and a recording grows with the run, not with its square.\n * - Ids minted per run (`ids`, UUIDs by default) are matched by place, and the\n * recorded answer is given the replay's ids.\n * - The tool list is compared by its hash.\n *\n * A request that differs is stale rather than a mismatch only as far as\n * `match` allows. With `\"wording\"` (the default) that is the rewording of\n * prompt files changed since the recording: their static text is cut out of\n * both requests and the rest must be the same (see `Fingerprints`). The tools\n * offered may differ too, as long as each tool call the recorded answer makes\n * still exists and fits its schema today: replaying a call that doesn't\n * would test nothing. A stale call replays and is counted in `stale` with the\n * reason. Anything else throws a `RecordingMismatchError` that shows where\n * the two differ.\n *\n * UPLOADS are answered `upload_<n>`, by order, so a file need not be the same\n * bytes on another machine for its call to replay. Recording, the file goes to\n * the live provider, and the calls show the model the provider's id.\n *\n * TIME. `recordedAt` is when the recording started. `pinClock(recordedAt)`\n * runs a replay at that time, so dates relative to today come out as recorded.\n */\nexport class RecordingProvider extends AgentProvider {\n readonly model: string;\n readonly capabilities: ProviderCapabilities;\n /** When the recording started. */\n readonly recordedAt: Date;\n private readonly calls: RecordedCall[];\n /** Replaying: the recorded calls of the sub-runs, by key. */\n private readonly recordedNested: Record<string, RecordedCall[]>;\n private readonly children = new Map<string, RecordingProvider>();\n private parent?: RecordingProvider;\n private readonly key?: string;\n /** The messages of the previous call, which the next call's are recorded after. */\n private sent: unknown[] = [];\n /** Recording: the live provider's file id of each upload, by the id answered here. */\n private readonly uploads: Map<string, string>;\n private uploadCount = 0;\n /** Recording: the position the next call's prompt was pinned to. */\n private read?: number;\n private readonly shared: Shared;\n private readonly options: Required<Pick<RecordingProviderOptions, \"match\" | \"ids\" | \"waitMs\">> &\n RecordingProviderOptions;\n /** What the calls sent, for the fingerprints: every string, and each tool's definition hashes. */\n private readonly texts = new Set<string>();\n private readonly toolHashes = new Map<string, Set<string>>();\n private readonly toolLists = new Set<string>();\n /** Replaying: the recording's fingerprints, and how a differing request is cut by them. */\n private recorded?: Fingerprints;\n private cuts?: ReturnType<Fingerprints[\"cutters\"]>;\n\n private constructor(\n private readonly live: AgentProvider | undefined,\n recording: Recording | undefined,\n options: RecordingProviderOptions,\n child?: { parent: RecordingProvider; key: string; calls: RecordedCall[] },\n ) {\n super();\n this.options = {\n ...options,\n match: options.match ?? \"wording\",\n ids: new RegExp(options.ids ?? UUIDS, \"g\"),\n waitMs: options.waitMs ?? 60_000,\n };\n if (child) {\n const { parent } = child;\n this.parent = parent;\n this.key = child.key;\n this.model = parent.model;\n this.capabilities = parent.capabilities;\n this.recordedAt = parent.recordedAt;\n this.calls = child.calls;\n this.recordedNested = {};\n this.uploads = parent.uploads;\n this.shared = parent.shared;\n return;\n }\n this.shared = {\n ids: new Map(),\n stale: new Set(),\n staleCalls: 0,\n started: 0,\n moved: resolvers(),\n };\n this.uploads = new Map();\n if (live) {\n this.model = live.model;\n this.capabilities = live.capabilities;\n this.recordedAt = new Date();\n this.calls = [];\n this.recordedNested = {};\n return;\n }\n if (!recording || recording.version !== 1 || !Array.isArray(recording.calls)) {\n throw new Error(\"RecordingProvider.replay needs a recording made by RecordingProvider.\");\n }\n this.model = recording.model;\n this.capabilities = recording.capabilities;\n this.recordedAt = new Date(recording.recordedAt);\n this.calls = structuredClone(recording.calls);\n this.recordedNested = structuredClone(recording.nested ?? {});\n if (recording.fingerprints) {\n this.recorded = new Fingerprints(recording.fingerprints, options.fingerprints);\n }\n }\n\n /** Records every call made through it to `live`, which answers it. */\n static record(live: AgentProvider, options: RecordingProviderOptions = {}): RecordingProvider {\n return new RecordingProvider(live, undefined, options);\n }\n\n /** Answers each call with the recorded one. See the class for how calls are matched. */\n static replay(recording: Recording, options: RecordingProviderOptions = {}): RecordingProvider {\n return new RecordingProvider(undefined, recording, options);\n }\n\n /** Whether it records (true) or replays. */\n get isRecording(): boolean {\n return this.live !== undefined;\n }\n\n /**\n * Why the replay should be recorded again: the parts of the requests that\n * differed and were tolerated (`match`). Empty for a replay\n * that matched exactly, and for a recording.\n */\n get stale(): ReadonlySet<string> {\n return this.shared.stale;\n }\n\n /** How many calls replayed stale, the sub-runs' included. */\n get staleCalls(): number {\n return this.shared.staleCalls;\n }\n\n /**\n * The provider of sub-run `key` (a sub-agent's, say), recorded and replayed\n * apart from this one's calls and the other sub-runs', so sub-runs running\n * side by side can replay in any interleaving. The same key answers the same\n * provider, so a sub-run continued later goes on after its calls. Replaying\n * a key the recording does not have throws.\n */\n nested(key: string): RecordingProvider {\n if (this.parent) return this.parent.nested(key);\n let child = this.children.get(key);\n if (!child) {\n const calls = this.recordedNested[key];\n if (!this.live && !calls) {\n throw new RecordingMismatchError(`The recording has no sub-run \"${key}\".`);\n }\n child = new RecordingProvider(this.live, undefined, this.options, {\n parent: this,\n key,\n calls: calls ?? [],\n });\n this.children.set(key, child);\n }\n return child;\n }\n\n /**\n * The recording so far: every call made through this provider and its\n * sub-runs. Write it as JSON. Only for a provider made with `record`.\n */\n recording(): Recording {\n if (this.parent) return this.parent.recording();\n if (!this.live)\n throw new Error(\"Only a recording provider (`record`) has a recording to save.\");\n return {\n version: 1,\n model: this.model,\n capabilities: this.capabilities,\n recordedAt: this.recordedAt.toISOString(),\n calls: structuredClone(this.calls),\n ...(this.options.fingerprints ? { fingerprints: this.fingerprints().data } : {}),\n ...(this.children.size > 0\n ? {\n nested: Object.fromEntries(\n [...this.children].map(([key, child]) => [key, structuredClone(child.calls)]),\n ),\n }\n : {}),\n };\n }\n\n /**\n * The fingerprints of what the calls sent so far, the sub-runs' included:\n * of this recording, or of this replay (compare it with the recording's to\n * tell whether a new recording would differ). Uses the `fingerprints`\n * options for where prompts live.\n */\n fingerprints(): Fingerprints {\n const root = this.parent ?? this;\n return Fingerprints.of(root.texts, root.toolHashes, this.options.fingerprints);\n }\n\n /**\n * What changed since `recording` was made, without replaying it: the prompt\n * files and inputs its fingerprints name that differ today. Empty for a\n * recording without fingerprints. For listing the recordings to make again.\n */\n static changedSince(recording: Recording, options: FingerprintOptions = {}): string[] {\n return recording.fingerprints\n ? new Fingerprints(recording.fingerprints, options).changed()\n : [];\n }\n\n /**\n * Replaying: whether every recorded call was made, the sub-runs' too. A run\n * that took another path and stopped early made fewer.\n */\n replayedInFull(): boolean {\n const root = this.parent ?? this;\n return (\n root.calls.length === 0 &&\n Object.entries(root.recordedNested).every(\n ([key, calls]) => (root.children.get(key)?.calls ?? calls).length === 0,\n )\n );\n }\n\n /**\n * The position (`position`) the next call's prompt should show the app at,\n * given `now`, where it is. Recording, that is `now`, kept with the call.\n * Replaying, it is the recorded position, once the app has got there, so a\n * prompt rendered from the app's state is the one that was recorded,\n * however the other runs were timed.\n */\n async pin(now: number): Promise<number> {\n if (this.live) {\n this.read = now;\n return now;\n }\n const read = this.calls[0]?.read;\n if (read === undefined) return now;\n await (this.parent ?? this).reach(read, this.where());\n return read;\n }\n\n async upload(file: File): Promise<string> {\n const root = this.parent ?? this;\n const id = `upload_${++root.uploadCount}`;\n if (this.live) this.uploads.set(id, await this.live.upload(file));\n return id;\n }\n\n normalizeError(error: unknown) {\n return this.live ? this.live.normalizeError(error) : super.normalizeError(error);\n }\n\n async *stream(params: ProviderStreamParams): AsyncGenerator<ProviderEvent> {\n const request = this.requestOf(params);\n if (this.live) {\n yield* this.recordCall(params, request);\n return;\n }\n yield* this.replayCall(params, request);\n }\n\n // --- recording ---------------------------------------------------------------\n\n private async *recordCall(\n params: ProviderStreamParams,\n request: RecordedRequest,\n ): AsyncGenerator<ProviderEvent> {\n const root = this.parent ?? this;\n const at = root.shared.started++;\n const read = this.read;\n this.read = undefined;\n const events: ProviderEvent[] = [];\n // The live call shows the model the files it uploaded, by the provider's ids.\n const messages = params.messages.map((message) => ({\n ...message,\n content: message.content.map((part) =>\n part.type === \"file\" && part.fileId && this.uploads.has(part.fileId)\n ? { ...part, fileId: this.uploads.get(part.fileId) }\n : part,\n ),\n }));\n for await (const event of this.live!.stream({ ...params, messages })) {\n const last = events.at(-1);\n if (event.type === \"tool-call-discard\") {\n // The provider asked again: the discarded calls' deltas are void.\n const discarded = new Set(event.toolCallIds);\n const kept = events.filter(\n (e) => e.type !== \"tool-call-delta\" || !discarded.has(e.toolCallId),\n );\n events.splice(0, events.length, ...kept);\n } else if (event.type === \"retry\") {\n // How the live call went, not what it answered.\n } else if (\n last &&\n (event.type === \"text-delta\" || event.type === \"output-delta\") &&\n last.type === event.type\n ) {\n // Consecutive deltas are kept as one, which replays the same text.\n last.delta += event.delta;\n } else if (\n last?.type === \"tool-call-delta\" &&\n event.type === \"tool-call-delta\" &&\n last.toolCallId === event.toolCallId\n ) {\n last.argsDelta += event.argsDelta;\n } else {\n events.push({ ...event });\n }\n yield event;\n }\n const ended = this.options.position ? await this.options.position() : undefined;\n this.calls.push({\n request,\n events,\n at,\n ...(read !== undefined ? { read } : {}),\n ...(ended !== undefined ? { ended } : {}),\n });\n }\n\n // --- replaying ---------------------------------------------------------------\n\n private async *replayCall(\n params: ProviderStreamParams,\n request: RecordedRequest,\n ): AsyncGenerator<ProviderEvent> {\n const root = this.parent ?? this;\n const where = this.where();\n const next = this.calls[0];\n if (this.options.ordered && next?.at !== undefined) await root.turn(next.at, where);\n const call = this.calls.shift();\n if (!call) {\n throw new RecordingMismatchError(\n `${where}: call ${this.sentCalls} was not recorded (the recording has no more calls).`,\n );\n }\n // A recording made with 0.204.0 kept the request's `promptCacheKey`: it is\n // not compared (see `requestOf`).\n const { promptCacheKey: _cacheKey, ...recorded } = call.request;\n if (!root.matches(JSON.stringify(recorded), request)) {\n root.tolerate(\n where,\n { ...call, request: recorded as RecordedRequest },\n request,\n params.tools ?? [],\n );\n }\n if (call.ended !== undefined) await root.reach(call.ended, where);\n const ids = root.shared.ids;\n for (const event of call.events) {\n yield JSON.parse(\n JSON.stringify(event).replace(this.options.ids, (id) => ids.get(id) ?? id),\n ) as ProviderEvent;\n }\n }\n\n private where(): string {\n return this.key === undefined ? \"the recording\" : `sub-run \"${this.key}\"`;\n }\n\n /** How many calls were made through this provider (not its sub-runs). */\n private sentCalls = 0;\n\n /**\n * The request as it is recorded and matched: see the class. Also moves\n * `sent` on, so the next call is recorded after this one.\n */\n private requestOf(params: ProviderStreamParams): RecordedRequest {\n this.sentCalls++;\n // `promptCacheKey` is derived from the prompt and the tools (#1228): it\n // changes whenever they are reworded, and recordings made before it have\n // none. It says nothing the request doesn't already say, so it is neither\n // matched nor fingerprinted (#1231).\n const { signal: _signal, promptCacheKey: _cacheKey, messages, tools, ...rest } = params;\n const sent = messages.map(({ role, content }) => ({\n role,\n content: withoutTranscripts(content),\n }));\n const after =\n this.sent.length > 0 &&\n this.sent.length <= sent.length &&\n JSON.stringify(sent.slice(0, this.sent.length)) === JSON.stringify(this.sent)\n ? this.sent.length\n : 0;\n this.sent = sent;\n const listed = tools && tools.length > 0 ? JSON.stringify(tools) : undefined;\n const root = this.parent ?? this;\n const keep = (text: string) => {\n root.texts.add(text);\n return text;\n };\n mapStrings([rest, sent.slice(after)], keep);\n if (listed && !root.toolLists.has(listed)) {\n root.toolLists.add(listed);\n for (const tool of flatTools(tools!)) {\n mapStrings(tool, keep);\n const hashes = root.toolHashes.get(tool.name) ?? new Set<string>();\n hashes.add(Fingerprints.tool(tool));\n root.toolHashes.set(tool.name, hashes);\n }\n }\n return {\n ...(withoutTranscripts(rest) as Record<string, unknown>),\n ...(listed\n ? {\n tools: `sha256:${sha256(listed)}`,\n toolNames: flatTools(tools!)\n .map((tool) => tool.name)\n .sort(),\n }\n : {}),\n ...(after > 0 ? { after } : {}),\n messages: sent.slice(after),\n };\n }\n\n /**\n * Whether `request` is the recorded one (`recorded`, as JSON), with each\n * recorded id matched to the id at its place in the request, the same one\n * every time it shows (`ids`, shared by the runs and sub-runs).\n */\n private matches(recorded: string, request: unknown): boolean {\n const pattern = this.options.ids;\n const sent = JSON.stringify(request);\n const theirs = recorded.match(pattern) ?? [];\n const ours = sent.match(pattern) ?? [];\n if (theirs.length !== ours.length) return false;\n const ids = new Map(this.shared.ids);\n for (const [index, id] of theirs.entries()) {\n const mapped = ids.get(id) ?? ours[index]!;\n if (mapped !== ours[index]) return false;\n ids.set(id, mapped);\n }\n if (recorded.replace(pattern, (id) => ids.get(id)!) !== sent) return false;\n for (const [id, mapped] of ids) this.shared.ids.set(id, mapped);\n return true;\n }\n\n /**\n * A request that is not the recorded one. It replays, stale, when what\n * differs is what `match` allows (see `RecordingProviderOptions.match`), and\n * every tool call of the recorded answer fits today's tools if those differ.\n * Throws otherwise, showing where the two first differ.\n */\n private tolerate(\n where: string,\n call: RecordedCall,\n request: RecordedRequest,\n tools: NonNullable<ProviderStreamParams[\"tools\"]>,\n ): void {\n const pattern = this.options.ids;\n const match = this.options.match;\n const recorded = call.request;\n const differs = (theirs: unknown, ours: unknown, why: string): never => {\n // Where they first differ, ids aside (they are matched by place).\n const a = JSON.stringify(theirs).replace(pattern, \"<id>\");\n const b = JSON.stringify(ours).replace(pattern, \"<id>\");\n let at = 0;\n while (at < a.length && a[at] === b[at]) at++;\n throw new RecordingMismatchError(\n `${where}: the request differs from the recorded one${why}. Recorded: …${a.slice(Math.max(0, at - 80), at + 120)}… Sent: …${b.slice(Math.max(0, at - 80), at + 120)}…`,\n );\n };\n if (match === \"exact\") differs(recorded, request, \"\");\n\n const { tools: recordedTools, toolNames: recordedNames, ...recordedRest } = recorded;\n const { tools: sentTools, toolNames: sentNames, ...sentRest } = request;\n const reasons: string[] = [];\n\n if (!this.matches(JSON.stringify(recordedRest), sentRest)) {\n if (match === \"wording\") {\n if (!this.recorded) {\n differs(\n recordedRest,\n sentRest,\n \", and the recording has no fingerprints to tell a reworded prompt by\",\n );\n }\n try {\n this.cuts ??= this.recorded!.cutters();\n } catch (error) {\n throw new RecordingMismatchError(`${where}: ${(error as Error).message}.`);\n }\n const theirs = mapStrings(recordedRest, this.cuts.recorded);\n const ours = mapStrings(sentRest, this.cuts.sent);\n if (this.cuts.changed.length === 0 || !this.matches(JSON.stringify(theirs), ours)) {\n differs(\n theirs,\n ours,\n this.cuts.changed.length > 0 ? \", beyond the wording of the prompts changed since\" : \"\",\n );\n }\n reasons.push(...this.cuts.changed.map((path) => `${path} changed`));\n } else {\n // The conversation's shape, ids matched by place as for an exact match.\n const sameShape =\n (recorded.after ?? 0) === (request.after ?? 0) &&\n this.matches(JSON.stringify(shapeOf(recorded.messages)), shapeOf(request.messages));\n if (!sameShape) differs(recordedRest, sentRest, \" in the conversation itself\");\n const { messages: recordedMessages, ...recordedSettings } = recordedRest;\n const { messages: sentMessages, ...sentSettings } = sentRest;\n if (!this.matches(JSON.stringify(recordedMessages), sentMessages)) {\n reasons.push(\"message text changed\");\n }\n const fields = new Set([...Object.keys(recordedSettings), ...Object.keys(sentSettings)]);\n for (const field of [...fields].sort()) {\n const theirs = JSON.stringify(recordedSettings[field] ?? null);\n if (!this.matches(theirs, sentSettings[field] ?? null)) reasons.push(`${field} changed`);\n }\n }\n }\n\n if (recordedTools !== sentTools) {\n const specs = flatTools(tools);\n for (const event of call.events) {\n if (event.type !== \"tool-call\") continue;\n const spec = specs.find((tool) => tool.name === event.name);\n if (!spec) {\n throw new RecordingMismatchError(\n `${where}: the recorded answer calls ${event.name}, which is not offered any more.`,\n );\n }\n // Formats are hints here: the tool checks them itself when the call runs.\n const formats = Object.fromEntries(\n [...JSON.stringify(spec.parameters).matchAll(/\"format\":\"([^\"]+)\"/g)].map(([, f]) => [\n f!,\n true as const,\n ]),\n );\n let input: unknown;\n try {\n input = JSON.parse(event.args || \"{}\");\n } catch {\n input = undefined;\n }\n const checked = s\n .fromJSONSchema(spec.parameters as never, { unknownKeys: \"error\", formats })\n .safeParse(input);\n if (checked.ok === false) {\n throw new RecordingMismatchError(\n `${where}: the recorded call of ${event.name} does not fit its schema any more (${checked.errors.join(\"; \")}).`,\n );\n }\n }\n if (this.recorded) {\n const changed = specs\n .filter(\n (tool) => !this.recorded!.data.tools[tool.name]?.includes(Fingerprints.tool(tool)),\n )\n .map((tool) => tool.name)\n .sort();\n reasons.push(\n changed.length > 0 ? `tools changed: ${changed.join(\", \")}` : \"the tools offered changed\",\n );\n } else {\n const before = new Set(recordedNames ?? []);\n const now = new Set(sentNames ?? []);\n const added = [...now].filter((name) => !before.has(name));\n const removed = [...before].filter((name) => !now.has(name));\n reasons.push(\n added.length > 0 || removed.length > 0\n ? `tools offered changed (${[\n ...added.map((name) => `+${name}`),\n ...removed.map((name) => `-${name}`),\n ].join(\", \")})`\n : \"the tools offered changed\",\n );\n }\n }\n this.shared.staleCalls++;\n for (const reason of reasons) this.shared.stale.add(reason);\n }\n\n /** Waits until every recorded call that started before `at` has started (`ordered`). */\n private async turn(at: number, where: string): Promise<void> {\n const shared = this.shared;\n shared.pending ??= [...this.calls, ...Object.values(this.recordedNested).flat()]\n .map((call) => call.at)\n .filter((started): started is number => started !== undefined)\n .sort((a, b) => a - b);\n while (shared.pending[0] !== undefined && shared.pending[0] < at) {\n const moved = shared.moved.promise;\n const waited = await Promise.race([\n moved.then(() => true),\n new Promise<boolean>((resolve) => setTimeout(() => resolve(false), this.options.waitMs)),\n ]);\n if (!waited) {\n throw new RecordingMismatchError(\n `${where}: call ${at} waits for call ${shared.pending[0]}, which the replay does not make.`,\n );\n }\n }\n shared.pending = shared.pending.filter((started) => started !== at);\n shared.moved.resolve();\n shared.moved = resolvers();\n }\n\n /** Waits until the app's `position` is at `target` or past it. */\n private async reach(target: number, where: string): Promise<void> {\n const position = this.options.position;\n if (!position) return;\n let last = await position();\n let still = 0;\n while (last < target) {\n await new Promise((resolve) => setTimeout(resolve, 25));\n const now = await position();\n still = now === last ? still + 25 : 0;\n last = now;\n if (still >= this.options.waitMs) {\n throw new RecordingMismatchError(\n `${where}: a call waits for the app to reach ${target}; it stays at ${last}.`,\n );\n }\n }\n }\n}\n",
|
|
5
|
+
"import { createHash } from \"node:crypto\";\n\nimport {\n AgentProvider,\n type ProviderCapabilities,\n type ProviderEvent,\n type ProviderStreamParams,\n type ProviderToolSpec,\n} from \"../AgentProvider\";\nimport { JSONSchemaError, s } from \"../Schema\";\nimport { type FingerprintOptions, Fingerprints, type RecordingFingerprints } from \"./Fingerprints\";\n\n/**\n * One model call, as a recording keeps it: what was sent (normalised, see\n * `RecordingProvider`) and what the model streamed back.\n */\nexport type RecordedCall = {\n request: RecordedRequest;\n events: ProviderEvent[];\n /** When it started among all the calls of the recording, its sub-runs' too (`ordered`). */\n at?: number;\n /** The app's position (`position`) the call's prompt was pinned to (`pin`). */\n read?: number;\n /** The app's position once the call's answer had streamed in full, before its tools ran. */\n ended?: number;\n};\n\n/**\n * A request as recorded. `messages` are the messages new since the call\n * before it (`after` says how many of that call's it resent), each without\n * the parts minted per run; `tools` is a hash of the tool list, and\n * `toolNames` the names it offered.\n */\nexport type RecordedRequest = {\n messages: { role: string; content: unknown }[];\n after?: number;\n tools?: string;\n toolNames?: string[];\n [field: string]: unknown;\n};\n\n/** What a `RecordingProvider` records, and replays from. Plain JSON: write it where you like. */\nexport type Recording = {\n version: 1;\n model: string;\n capabilities: ProviderCapabilities;\n /** When the recording started (ISO). A replay can run at that time: see `pinClock`. */\n recordedAt: string;\n calls: RecordedCall[];\n /** Sub-runs' calls (`nested(key)`), each in its own order. */\n nested?: Record<string, RecordedCall[]>;\n /** What it was made with, when recorded with `fingerprints`. See `Fingerprints`. */\n fingerprints?: RecordingFingerprints;\n};\n\n/** How `replay` matches a request against the recorded one. See `RecordingProviderOptions.match`. */\nexport type RecordingMatch = \"exact\" | \"wording\" | \"shape\";\n\nexport type RecordingProviderOptions = {\n /**\n * What a replayed request may differ in from the recorded one and still\n * replay, counted as `stale` with the reason:\n *\n * - `\"wording\"` (the default): the wording of the prompt files changed since\n * the recording, and nothing else. The static text of those files is cut\n * out of both requests (see `Fingerprints.cutters`), so the messages, the\n * tool calls and results and every value filled into the prompts must\n * still be the same. Needs a recording made with `fingerprints`, and\n * `fingerprints` on the replay to find the files.\n * - `\"shape\"`: anything but the shape of the conversation (its roles, tool\n * calls with their inputs, tool results with their status): instructions,\n * settings and message text. For an app whose prompts are not files.\n * - `\"exact\"`: nothing.\n *\n * In `\"wording\"` and `\"shape\"`, the tools offered may differ too, as long as\n * every tool call the recorded answer makes is to a tool still offered and\n * fits its schema today.\n */\n match?: RecordingMatch;\n /**\n * Fingerprint what the recording is made with (the prompt files its\n * requests carried, its tools' definitions, `inputs`), and, replaying, tell\n * a reworded prompt by them. See `Fingerprints`.\n */\n fingerprints?: FingerprintOptions;\n /**\n * Ids minted per run (a record's id, say), which a replay mints anew. Each\n * recorded id matches the id at its place in the request, the same one\n * wherever it shows, and the recorded answer is given the replay's ids.\n * Default: UUIDs.\n */\n ids?: RegExp;\n /**\n * Replays the calls, the sub-runs' too, in the order they started when\n * recorded (`at`), for runs that go side by side and whose order shows.\n * Off, each run and sub-run replays in its own order, in any interleaving.\n */\n ordered?: boolean;\n /**\n * A position in the app's own state that moves as tools run (an edit log's\n * head, say). Recording, each call keeps where it was; replaying, a call's\n * answer waits until the app gets there again, so tool calls running side by\n * side write in the recorded order. See also `pin`.\n */\n position?: () => number | Promise<number>;\n /** How long a replay waits for `ordered` or `position` before it gives up. Default 60 s. */\n waitMs?: number;\n};\n\n/** A replayed request that is not the recorded one, beyond what `match` tolerates. */\nexport class RecordingMismatchError extends Error {\n constructor(message: string) {\n super(`${message} Record again.`);\n this.name = \"RecordingMismatchError\";\n }\n}\n\nconst UUIDS = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;\n\n/** `value` with each of its strings passed through `change`. */\nfunction mapStrings(value: unknown, change: (text: string) => string): unknown {\n if (typeof value === \"string\") return change(value);\n if (Array.isArray(value)) return value.map((item) => mapStrings(item, change));\n if (value && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value).map(([key, inner]) => [key, mapStrings(inner, change)]),\n );\n }\n return value;\n}\n\n/**\n * A message's content without what a run mints and the model is not sent: a\n * tool call's sub-run transcript (`nested`, recorded on its own), and the full\n * output of a tool whose model reads a projection (`modelOutput`).\n */\nfunction withoutTranscripts<T>(value: T): T {\n return JSON.parse(\n JSON.stringify(value, function (this: Record<string, unknown>, key, inner) {\n if (key === \"nested\") return undefined;\n if (key === \"output\" && this.type === \"tool-result\" && \"modelOutput\" in this) {\n return undefined;\n }\n return inner;\n }),\n );\n}\n\nfunction resolvers(): { promise: Promise<void>; resolve: () => void } {\n let resolve!: () => void;\n const promise = new Promise<void>((done) => (resolve = done));\n return { promise, resolve };\n}\n\nconst sha256 = (text: string) => createHash(\"sha256\").update(text).digest(\"hex\");\n\nconst flatTools = (tools: NonNullable<ProviderStreamParams[\"tools\"]>): ProviderToolSpec[] =>\n tools.flatMap((tool) => (\"tools\" in tool ? tool.tools : [tool]));\n\n/**\n * The shape of a conversation, which `match: \"shape\"` keeps: each message's\n * role, its tool calls with their inputs and its tool results with their\n * status, but not its text.\n */\nfunction shapeOf(messages: { role: string; content: unknown }[]): unknown {\n return messages.map(({ role, content }) => ({\n role,\n parts: (Array.isArray(content) ? content : []).flatMap((part: any): unknown[] => {\n if (part?.type === \"tool-call\") return [{ call: part.name, input: part.input ?? part.args }];\n if (part?.type === \"tool-result\") return [{ result: part.name, status: part.status }];\n if (part?.type === \"file\") return [{ file: true }];\n return [];\n }),\n }));\n}\n\ntype Shared = {\n ids: Map<string, string>;\n stale: Set<string>;\n staleCalls: number;\n started: number;\n pending?: number[];\n moved: { promise: Promise<void>; resolve: () => void };\n};\n\n/**\n * A provider that records a live provider's calls, and replays them later\n * without one: model-backed tests and evals that run in CI, offline and for\n * free, and stay the same from run to run.\n *\n * // Recording: every call goes to `live`, and is kept.\n * const recorder = RecordingProvider.record(live);\n * await runTheCase(recorder);\n * await Bun.write(file, JSON.stringify(recorder.recording()));\n *\n * // Replaying: each call is answered with what was recorded for it.\n * const replay = RecordingProvider.replay(await Bun.file(file).json());\n * await runTheCase(replay);\n * replay.stale; // why the recording should be made again, if it should\n *\n * WHAT IS MATCHED. The n-th call replays the n-th recorded call (per run and\n * per sub-run, see `nested`), and it has to be the same request:\n *\n * - Messages are compared without ids and times, which differ per run: only\n * `role` and `content` are kept, without sub-run transcripts. A call resends\n * the messages of the one before it, so only the new ones are recorded\n * (`after`), and a recording grows with the run, not with its square.\n * - Ids minted per run (`ids`, UUIDs by default) are matched by place, and the\n * recorded answer is given the replay's ids.\n * - The tool list is compared by its hash.\n *\n * A request that differs is stale rather than a mismatch only as far as\n * `match` allows. With `\"wording\"` (the default) that is the rewording of\n * prompt files changed since the recording: their static text is cut out of\n * both requests and the rest must be the same (see `Fingerprints`). The tools\n * offered may differ too, as long as each tool call the recorded answer makes\n * still exists and fits its schema today: replaying a call that doesn't\n * would test nothing. A stale call replays and is counted in `stale` with the\n * reason. Anything else throws a `RecordingMismatchError` that shows where\n * the two differ.\n *\n * UPLOADS are answered `upload_<n>`, by order, so a file need not be the same\n * bytes on another machine for its call to replay. A sub-run counts its own,\n * `upload_<key>_<n>`, so the ids stay the same however sub-runs interleave.\n * Recording, the file goes to the live provider, and the calls show the model\n * the provider's id.\n *\n * TIME. `recordedAt` is when the recording started. `pinClock(recordedAt)`\n * runs a replay at that time, so dates relative to today come out as recorded.\n */\nexport class RecordingProvider extends AgentProvider {\n readonly model: string;\n readonly capabilities: ProviderCapabilities;\n /** When the recording started. */\n readonly recordedAt: Date;\n private readonly calls: RecordedCall[];\n /** Replaying: the recorded calls of the sub-runs, by key. */\n private readonly recordedNested: Record<string, RecordedCall[]>;\n private readonly children = new Map<string, RecordingProvider>();\n private parent?: RecordingProvider;\n private readonly key?: string;\n /** The messages of the previous call, which the next call's are recorded after. */\n private sent: unknown[] = [];\n /** Recording: the live provider's file id of each upload, by the id answered here. */\n private readonly uploads: Map<string, string>;\n /** Uploads answered so far, counted per run and per sub-run. */\n private uploadCount = 0;\n /** Recording: the position the next call's prompt was pinned to. */\n private read?: number;\n private readonly shared: Shared;\n private readonly options: Required<Pick<RecordingProviderOptions, \"match\" | \"ids\" | \"waitMs\">> &\n RecordingProviderOptions;\n /** What the calls sent, for the fingerprints: every string, and each tool's definition hashes. */\n private readonly texts = new Set<string>();\n private readonly toolHashes = new Map<string, Set<string>>();\n private readonly toolLists = new Set<string>();\n /** Replaying: the recording's fingerprints, and how a differing request is cut by them. */\n private recorded?: Fingerprints;\n private cuts?: ReturnType<Fingerprints[\"cutters\"]>;\n\n private constructor(\n private readonly live: AgentProvider | undefined,\n recording: Recording | undefined,\n options: RecordingProviderOptions,\n child?: { parent: RecordingProvider; key: string; calls: RecordedCall[] },\n ) {\n super();\n this.options = {\n ...options,\n match: options.match ?? \"wording\",\n ids: new RegExp(options.ids ?? UUIDS, \"g\"),\n waitMs: options.waitMs ?? 60_000,\n };\n if (child) {\n const { parent } = child;\n this.parent = parent;\n this.key = child.key;\n this.model = parent.model;\n this.capabilities = parent.capabilities;\n this.recordedAt = parent.recordedAt;\n this.calls = child.calls;\n this.recordedNested = {};\n this.uploads = parent.uploads;\n this.shared = parent.shared;\n return;\n }\n this.shared = {\n ids: new Map(),\n stale: new Set(),\n staleCalls: 0,\n started: 0,\n moved: resolvers(),\n };\n this.uploads = new Map();\n if (live) {\n this.model = live.model;\n this.capabilities = live.capabilities;\n this.recordedAt = new Date();\n this.calls = [];\n this.recordedNested = {};\n return;\n }\n if (!recording || recording.version !== 1 || !Array.isArray(recording.calls)) {\n throw new Error(\"RecordingProvider.replay needs a recording made by RecordingProvider.\");\n }\n this.model = recording.model;\n this.capabilities = recording.capabilities;\n this.recordedAt = new Date(recording.recordedAt);\n this.calls = structuredClone(recording.calls);\n this.recordedNested = structuredClone(recording.nested ?? {});\n if (recording.fingerprints) {\n this.recorded = new Fingerprints(recording.fingerprints, options.fingerprints);\n }\n }\n\n /** Records every call made through it to `live`, which answers it. */\n static record(live: AgentProvider, options: RecordingProviderOptions = {}): RecordingProvider {\n return new RecordingProvider(live, undefined, options);\n }\n\n /** Answers each call with the recorded one. See the class for how calls are matched. */\n static replay(recording: Recording, options: RecordingProviderOptions = {}): RecordingProvider {\n return new RecordingProvider(undefined, recording, options);\n }\n\n /** Whether it records (true) or replays. */\n get isRecording(): boolean {\n return this.live !== undefined;\n }\n\n /**\n * Why the replay should be recorded again: the parts of the requests that\n * differed and were tolerated (`match`). Empty for a replay\n * that matched exactly, and for a recording.\n */\n get stale(): ReadonlySet<string> {\n return this.shared.stale;\n }\n\n /** How many calls replayed stale, the sub-runs' included. */\n get staleCalls(): number {\n return this.shared.staleCalls;\n }\n\n /**\n * The provider of sub-run `key` (a sub-agent's, say), recorded and replayed\n * apart from this one's calls and the other sub-runs', so sub-runs running\n * side by side can replay in any interleaving. The same key answers the same\n * provider, so a sub-run continued later goes on after its calls. Replaying\n * a key the recording does not have throws.\n */\n nested(key: string): RecordingProvider {\n if (this.parent) return this.parent.nested(key);\n let child = this.children.get(key);\n if (!child) {\n const calls = this.recordedNested[key];\n if (!this.live && !calls) {\n throw new RecordingMismatchError(`The recording has no sub-run \"${key}\".`);\n }\n child = new RecordingProvider(this.live, undefined, this.options, {\n parent: this,\n key,\n calls: calls ?? [],\n });\n this.children.set(key, child);\n }\n return child;\n }\n\n /**\n * The recording so far: every call made through this provider and its\n * sub-runs. Write it as JSON. Only for a provider made with `record`.\n */\n recording(): Recording {\n if (this.parent) return this.parent.recording();\n if (!this.live)\n throw new Error(\"Only a recording provider (`record`) has a recording to save.\");\n return {\n version: 1,\n model: this.model,\n capabilities: this.capabilities,\n recordedAt: this.recordedAt.toISOString(),\n calls: structuredClone(this.calls),\n ...(this.options.fingerprints ? { fingerprints: this.fingerprints().data } : {}),\n ...(this.children.size > 0\n ? {\n nested: Object.fromEntries(\n [...this.children].map(([key, child]) => [key, structuredClone(child.calls)]),\n ),\n }\n : {}),\n };\n }\n\n /**\n * The fingerprints of what the calls sent so far, the sub-runs' included:\n * of this recording, or of this replay (compare it with the recording's to\n * tell whether a new recording would differ). Uses the `fingerprints`\n * options for where prompts live.\n */\n fingerprints(): Fingerprints {\n const root = this.parent ?? this;\n return Fingerprints.of(root.texts, root.toolHashes, this.options.fingerprints);\n }\n\n /**\n * What changed since `recording` was made, without replaying it: the prompt\n * files and inputs its fingerprints name that differ today. Empty for a\n * recording without fingerprints. For listing the recordings to make again.\n */\n static changedSince(recording: Recording, options: FingerprintOptions = {}): string[] {\n return recording.fingerprints\n ? new Fingerprints(recording.fingerprints, options).changed()\n : [];\n }\n\n /**\n * Replaying: whether every recorded call was made, the sub-runs' too. A run\n * that took another path and stopped early made fewer.\n */\n replayedInFull(): boolean {\n const root = this.parent ?? this;\n return (\n root.calls.length === 0 &&\n Object.entries(root.recordedNested).every(\n ([key, calls]) => (root.children.get(key)?.calls ?? calls).length === 0,\n )\n );\n }\n\n /**\n * The position (`position`) the next call's prompt should show the app at,\n * given `now`, where it is. Recording, that is `now`, kept with the call.\n * Replaying, it is the recorded position, once the app has got there, so a\n * prompt rendered from the app's state is the one that was recorded,\n * however the other runs were timed.\n */\n async pin(now: number): Promise<number> {\n if (this.live) {\n this.read = now;\n return now;\n }\n const read = this.calls[0]?.read;\n if (read === undefined) return now;\n await (this.parent ?? this).reach(read, this.where());\n return read;\n }\n\n async upload(file: File): Promise<string> {\n const n = ++this.uploadCount;\n const id = this.key === undefined ? `upload_${n}` : `upload_${this.key}_${n}`;\n if (this.live) this.uploads.set(id, await this.live.upload(file));\n return id;\n }\n\n normalizeError(error: unknown) {\n return this.live ? this.live.normalizeError(error) : super.normalizeError(error);\n }\n\n async *stream(params: ProviderStreamParams): AsyncGenerator<ProviderEvent> {\n const request = this.requestOf(params);\n if (this.live) {\n yield* this.recordCall(params, request);\n return;\n }\n yield* this.replayCall(params, request);\n }\n\n // --- recording ---------------------------------------------------------------\n\n private async *recordCall(\n params: ProviderStreamParams,\n request: RecordedRequest,\n ): AsyncGenerator<ProviderEvent> {\n const root = this.parent ?? this;\n const at = root.shared.started++;\n const read = this.read;\n this.read = undefined;\n const events: ProviderEvent[] = [];\n // The live call shows the model the files it uploaded, by the provider's ids.\n const messages = params.messages.map((message) => ({\n ...message,\n content: message.content.map((part) =>\n part.type === \"file\" && part.fileId && this.uploads.has(part.fileId)\n ? { ...part, fileId: this.uploads.get(part.fileId) }\n : part,\n ),\n }));\n for await (const event of this.live!.stream({ ...params, messages })) {\n const last = events.at(-1);\n if (event.type === \"tool-call-discard\") {\n // The provider asked again: the discarded calls' deltas are void.\n const discarded = new Set(event.toolCallIds);\n const kept = events.filter(\n (e) => e.type !== \"tool-call-delta\" || !discarded.has(e.toolCallId),\n );\n events.splice(0, events.length, ...kept);\n } else if (event.type === \"retry\") {\n // How the live call went, not what it answered.\n } else if (\n last &&\n (event.type === \"text-delta\" || event.type === \"output-delta\") &&\n last.type === event.type\n ) {\n // Consecutive deltas are kept as one, which replays the same text.\n last.delta += event.delta;\n } else if (\n last?.type === \"tool-call-delta\" &&\n event.type === \"tool-call-delta\" &&\n last.toolCallId === event.toolCallId\n ) {\n last.argsDelta += event.argsDelta;\n } else {\n events.push({ ...event });\n }\n yield event;\n }\n const ended = this.options.position ? await this.options.position() : undefined;\n this.calls.push({\n request,\n events,\n at,\n ...(read !== undefined ? { read } : {}),\n ...(ended !== undefined ? { ended } : {}),\n });\n }\n\n // --- replaying ---------------------------------------------------------------\n\n private async *replayCall(\n params: ProviderStreamParams,\n request: RecordedRequest,\n ): AsyncGenerator<ProviderEvent> {\n const root = this.parent ?? this;\n const where = this.where();\n const next = this.calls[0];\n if (this.options.ordered && next?.at !== undefined) await root.turn(next.at, where);\n const call = this.calls.shift();\n if (!call) {\n throw new RecordingMismatchError(\n `${where}: call ${this.sentCalls} was not recorded (the recording has no more calls).`,\n );\n }\n // A recording made with 0.204.0 kept the request's `promptCacheKey`: it is\n // not compared (see `requestOf`).\n const { promptCacheKey: _cacheKey, ...recorded } = call.request;\n if (!root.matches(JSON.stringify(recorded), request)) {\n root.tolerate(\n where,\n { ...call, request: recorded as RecordedRequest },\n request,\n params.tools ?? [],\n );\n }\n if (call.ended !== undefined) await root.reach(call.ended, where);\n const ids = root.shared.ids;\n for (const event of call.events) {\n yield JSON.parse(\n JSON.stringify(event).replace(this.options.ids, (id) => ids.get(id) ?? id),\n ) as ProviderEvent;\n }\n }\n\n private where(): string {\n return this.key === undefined ? \"the recording\" : `sub-run \"${this.key}\"`;\n }\n\n /** How many calls were made through this provider (not its sub-runs). */\n private sentCalls = 0;\n\n /**\n * The request as it is recorded and matched: see the class. Also moves\n * `sent` on, so the next call is recorded after this one.\n */\n private requestOf(params: ProviderStreamParams): RecordedRequest {\n this.sentCalls++;\n // `promptCacheKey` is derived from the prompt and the tools (#1228): it\n // changes whenever they are reworded, and recordings made before it have\n // none. It says nothing the request doesn't already say, so it is neither\n // matched nor fingerprinted (#1231).\n const { signal: _signal, promptCacheKey: _cacheKey, messages, tools, ...rest } = params;\n const sent = messages.map(({ role, content }) => ({\n role,\n content: withoutTranscripts(content),\n }));\n const after =\n this.sent.length > 0 &&\n this.sent.length <= sent.length &&\n JSON.stringify(sent.slice(0, this.sent.length)) === JSON.stringify(this.sent)\n ? this.sent.length\n : 0;\n this.sent = sent;\n const listed = tools && tools.length > 0 ? JSON.stringify(tools) : undefined;\n const root = this.parent ?? this;\n const keep = (text: string) => {\n root.texts.add(text);\n return text;\n };\n mapStrings([rest, sent.slice(after)], keep);\n if (listed && !root.toolLists.has(listed)) {\n root.toolLists.add(listed);\n for (const tool of flatTools(tools!)) {\n mapStrings(tool, keep);\n const hashes = root.toolHashes.get(tool.name) ?? new Set<string>();\n hashes.add(Fingerprints.tool(tool));\n root.toolHashes.set(tool.name, hashes);\n }\n }\n return {\n ...(withoutTranscripts(rest) as Record<string, unknown>),\n ...(listed\n ? {\n tools: `sha256:${sha256(listed)}`,\n toolNames: flatTools(tools!)\n .map((tool) => tool.name)\n .sort(),\n }\n : {}),\n ...(after > 0 ? { after } : {}),\n messages: sent.slice(after),\n };\n }\n\n /**\n * Whether `request` is the recorded one (`recorded`, as JSON), with each\n * recorded id matched to the id at its place in the request, the same one\n * every time it shows (`ids`, shared by the runs and sub-runs).\n */\n private matches(recorded: string, request: unknown): boolean {\n const pattern = this.options.ids;\n const sent = JSON.stringify(request);\n const theirs = recorded.match(pattern) ?? [];\n const ours = sent.match(pattern) ?? [];\n if (theirs.length !== ours.length) return false;\n const ids = new Map(this.shared.ids);\n for (const [index, id] of theirs.entries()) {\n const mapped = ids.get(id) ?? ours[index]!;\n if (mapped !== ours[index]) return false;\n ids.set(id, mapped);\n }\n if (recorded.replace(pattern, (id) => ids.get(id)!) !== sent) return false;\n for (const [id, mapped] of ids) this.shared.ids.set(id, mapped);\n return true;\n }\n\n /**\n * A request that is not the recorded one. It replays, stale, when what\n * differs is what `match` allows (see `RecordingProviderOptions.match`), and\n * every tool call of the recorded answer fits today's tools if those differ.\n * Throws otherwise, showing where the two first differ.\n */\n private tolerate(\n where: string,\n call: RecordedCall,\n request: RecordedRequest,\n tools: NonNullable<ProviderStreamParams[\"tools\"]>,\n ): void {\n const pattern = this.options.ids;\n const match = this.options.match;\n const recorded = call.request;\n const differs = (theirs: unknown, ours: unknown, why: string): never => {\n // Where they first differ, ids aside (they are matched by place).\n const a = JSON.stringify(theirs).replace(pattern, \"<id>\");\n const b = JSON.stringify(ours).replace(pattern, \"<id>\");\n let at = 0;\n while (at < a.length && a[at] === b[at]) at++;\n throw new RecordingMismatchError(\n `${where}: the request differs from the recorded one${why}. Recorded: …${a.slice(Math.max(0, at - 80), at + 120)}… Sent: …${b.slice(Math.max(0, at - 80), at + 120)}…`,\n );\n };\n if (match === \"exact\") differs(recorded, request, \"\");\n\n const { tools: recordedTools, toolNames: recordedNames, ...recordedRest } = recorded;\n const { tools: sentTools, toolNames: sentNames, ...sentRest } = request;\n const reasons: string[] = [];\n\n if (!this.matches(JSON.stringify(recordedRest), sentRest)) {\n if (match === \"wording\") {\n if (!this.recorded) {\n differs(\n recordedRest,\n sentRest,\n \", and the recording has no fingerprints to tell a reworded prompt by\",\n );\n }\n try {\n this.cuts ??= this.recorded!.cutters();\n } catch (error) {\n throw new RecordingMismatchError(`${where}: ${(error as Error).message}.`);\n }\n const theirs = mapStrings(recordedRest, this.cuts.recorded);\n const ours = mapStrings(sentRest, this.cuts.sent);\n if (this.cuts.changed.length === 0 || !this.matches(JSON.stringify(theirs), ours)) {\n differs(\n theirs,\n ours,\n this.cuts.changed.length > 0 ? \", beyond the wording of the prompts changed since\" : \"\",\n );\n }\n reasons.push(...this.cuts.changed.map((path) => `${path} changed`));\n } else {\n // The conversation's shape, ids matched by place as for an exact match.\n const sameShape =\n (recorded.after ?? 0) === (request.after ?? 0) &&\n this.matches(JSON.stringify(shapeOf(recorded.messages)), shapeOf(request.messages));\n if (!sameShape) differs(recordedRest, sentRest, \" in the conversation itself\");\n const { messages: recordedMessages, ...recordedSettings } = recordedRest;\n const { messages: sentMessages, ...sentSettings } = sentRest;\n if (!this.matches(JSON.stringify(recordedMessages), sentMessages)) {\n reasons.push(\"message text changed\");\n }\n const fields = new Set([...Object.keys(recordedSettings), ...Object.keys(sentSettings)]);\n for (const field of [...fields].sort()) {\n const theirs = JSON.stringify(recordedSettings[field] ?? null);\n if (!this.matches(theirs, sentSettings[field] ?? null)) reasons.push(`${field} changed`);\n }\n }\n }\n\n if (recordedTools !== sentTools) {\n const specs = flatTools(tools);\n for (const event of call.events) {\n if (event.type !== \"tool-call\") continue;\n const spec = specs.find((tool) => tool.name === event.name);\n if (!spec) {\n throw new RecordingMismatchError(\n `${where}: the recorded answer calls ${event.name}, which is not offered any more.`,\n );\n }\n // Formats are hints here: the tool checks them itself when the call runs.\n const formats = Object.fromEntries(\n [...JSON.stringify(spec.parameters).matchAll(/\"format\":\"([^\"]+)\"/g)].map(([, f]) => [\n f!,\n true as const,\n ]),\n );\n let input: unknown;\n try {\n input = JSON.parse(event.args || \"{}\");\n } catch {\n input = undefined;\n }\n // A schema `fromJSONSchema` can't model (a free-form part, such as an\n // object value with no type) isn't checked here (#1234): the tool still\n // validates its input when the call runs, as for formats.\n let schema: ReturnType<typeof s.fromJSONSchema> | undefined;\n try {\n schema = s.fromJSONSchema(spec.parameters as never, { unknownKeys: \"error\", formats });\n } catch (error) {\n if (!(error instanceof JSONSchemaError)) throw error;\n }\n const checked = schema?.safeParse(input);\n if (checked && checked.ok === false) {\n throw new RecordingMismatchError(\n `${where}: the recorded call of ${event.name} does not fit its schema any more (${checked.errors.join(\"; \")}).`,\n );\n }\n }\n if (this.recorded) {\n const changed = specs\n .filter(\n (tool) => !this.recorded!.data.tools[tool.name]?.includes(Fingerprints.tool(tool)),\n )\n .map((tool) => tool.name)\n .sort();\n reasons.push(\n changed.length > 0 ? `tools changed: ${changed.join(\", \")}` : \"the tools offered changed\",\n );\n } else {\n const before = new Set(recordedNames ?? []);\n const now = new Set(sentNames ?? []);\n const added = [...now].filter((name) => !before.has(name));\n const removed = [...before].filter((name) => !now.has(name));\n reasons.push(\n added.length > 0 || removed.length > 0\n ? `tools offered changed (${[\n ...added.map((name) => `+${name}`),\n ...removed.map((name) => `-${name}`),\n ].join(\", \")})`\n : \"the tools offered changed\",\n );\n }\n }\n this.shared.staleCalls++;\n for (const reason of reasons) this.shared.stale.add(reason);\n }\n\n /** Waits until every recorded call that started before `at` has started (`ordered`). */\n private async turn(at: number, where: string): Promise<void> {\n const shared = this.shared;\n shared.pending ??= [...this.calls, ...Object.values(this.recordedNested).flat()]\n .map((call) => call.at)\n .filter((started): started is number => started !== undefined)\n .sort((a, b) => a - b);\n while (shared.pending[0] !== undefined && shared.pending[0] < at) {\n const moved = shared.moved.promise;\n const waited = await Promise.race([\n moved.then(() => true),\n new Promise<boolean>((resolve) => setTimeout(() => resolve(false), this.options.waitMs)),\n ]);\n if (!waited) {\n throw new RecordingMismatchError(\n `${where}: call ${at} waits for call ${shared.pending[0]}, which the replay does not make.`,\n );\n }\n }\n shared.pending = shared.pending.filter((started) => started !== at);\n shared.moved.resolve();\n shared.moved = resolvers();\n }\n\n /** Waits until the app's `position` is at `target` or past it. */\n private async reach(target: number, where: string): Promise<void> {\n const position = this.options.position;\n if (!position) return;\n let last = await position();\n let still = 0;\n while (last < target) {\n await new Promise((resolve) => setTimeout(resolve, 25));\n const now = await position();\n still = now === last ? still + 25 : 0;\n last = now;\n if (still >= this.options.waitMs) {\n throw new RecordingMismatchError(\n `${where}: a call waits for the app to reach ${target}; it stays at ${last}.`,\n );\n }\n }\n }\n}\n",
|
|
6
6
|
"import { createHash } from \"node:crypto\";\nimport { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join, relative, sep } from \"node:path\";\n\n/**\n * What a recording was made with, kept on it (`Recording.fingerprints`):\n *\n * - `prompts`: each prompt file whose text the requests carried, by its path\n * from `root`, as its git blob id, so the version it was recorded with can\n * be read back from git;\n * - `tools`: each tool the requests offered, by name, as the hashes of its\n * definitions (description and parameters);\n * - `inputs`: anything else the app says the recording depends on\n * (`FingerprintOptions.inputs`), such as the schemas behind generated\n * tools, hashed by name.\n */\nexport type RecordingFingerprints = {\n prompts: Record<string, string>;\n tools: Record<string, string[]>;\n inputs?: Record<string, string>;\n};\n\n/** Where a recording's prompt files are, and how to read their recorded versions back. */\nexport type FingerprintOptions = {\n /** The repository root that paths are relative to, and git runs in. Default the working directory. */\n root?: string;\n /** The folders, relative to `root`, that prompt files (`*.md`) live in. Default `[\"app/agents\"]`, gemi's. */\n dirs?: string[];\n /** The folder under a prompt folder that a bare partial name (`{{> tone}}`) resolves in. Default `prompts`, as `Prompt.render`. */\n shared?: string;\n /**\n * A prompt file's text by its git blob id, for the version a recording was\n * made with. Default `git cat-file blob <id>` in `root`. `undefined` when it\n * can't be found.\n */\n readBlob?: (blob: string) => string | undefined;\n /**\n * Other inputs the recording depends on, hashed by name, given the names of\n * the tools its requests offered: the component schemas behind generated\n * `add_` tools, say. Called when recording, and again to tell what changed.\n */\n inputs?: (tools: ReadonlySet<string>) => Record<string, string>;\n};\n\n/** What a piece of a prompt's static text is replaced with when it is cut out of a request. */\nconst CUT = \"␟\";\n/** Prompt text shorter than this is cut only next to a cut: it could be part of a value as well. */\nconst SHORTEST = 6;\nconst PARTIAL = /\\{\\{>\\s*([^}\\s]+)\\s*\\}\\}/g;\n\nconst escape = (text: string) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/**\n * Cuts `pieces` of prompt text out of a text, leaving a mark (and no\n * whitespace) where each was. A short piece (a full stop between a\n * placeholder and a partial) is cut only where it touches a cut.\n */\nfunction cutOut(pieces: string[]): (text: string) => string {\n const long = pieces.filter((piece) => piece.length >= SHORTEST);\n const short = pieces.filter((piece) => piece.length < SHORTEST);\n return (text) => {\n let left = text;\n for (const piece of long) if (left.includes(piece)) left = left.split(piece).join(CUT);\n for (const piece of short) {\n left = left\n .replace(new RegExp(`${escape(piece)}\\\\s*${CUT}`, \"g\"), CUT)\n .replace(new RegExp(`${CUT}\\\\s*${escape(piece)}`, \"g\"), CUT);\n }\n return left.replace(new RegExp(`\\\\s*${CUT}[\\\\s${CUT}]*`, \"g\"), CUT);\n };\n}\n\nfunction scan(dir: string, out: string[] = []): string[] {\n for (const entry of readdirSync(dir)) {\n if (entry === \"node_modules\") continue;\n const path = join(dir, entry);\n if (statSync(path).isDirectory()) scan(path, out);\n else if (entry.endsWith(\".md\")) out.push(path);\n }\n return out;\n}\n\n/**\n * A recording's fingerprints, and what they tell about it today: which of the\n * prompts, tools and inputs it was made with have changed (`changed`), and how\n * to compare a request across a prompt's rewording (`cutters`).\n *\n * A replayed call whose request differs only in the wording of the prompt\n * files changed since the recording is stale, not a mismatch: the static text\n * of those files is cut out of both sides (the recorded version, read back from\n * git, out of the recorded request; today's out of the replay's), so the\n * messages, the tool calls and results and every value filled into the\n * prompts must still be the same.\n */\nexport class Fingerprints {\n readonly root: string;\n private readonly options: FingerprintOptions;\n\n constructor(\n readonly data: RecordingFingerprints,\n options: FingerprintOptions = {},\n ) {\n this.options = options;\n this.root = options.root ?? process.cwd();\n }\n\n /** A text's git blob id (`git hash-object`). */\n static blob(text: string): string {\n return createHash(\"sha1\")\n .update(`blob ${Buffer.byteLength(text)}\\0`)\n .update(text)\n .digest(\"hex\");\n }\n\n /** A prompt's static text: the pieces between its placeholders and partials. */\n static pieces(text: string): string[] {\n return text\n .split(/\\{\\{[^}]*\\}\\}/)\n .map((piece) => piece.trim())\n .filter((piece) => piece.length > 0);\n }\n\n /** A tool definition's hash, as `tools` keeps it. */\n static tool(tool: { description?: string; parameters?: unknown }): string {\n return createHash(\"sha256\")\n .update(JSON.stringify({ description: tool.description, parameters: tool.parameters }))\n .digest(\"hex\");\n }\n\n /** The prompt files under the configured folders today, by path from `root`. */\n static prompts(options: FingerprintOptions = {}): Map<string, string> {\n const root = options.root ?? process.cwd();\n const prompts = new Map<string, string>();\n for (const dir of options.dirs ?? [\"app/agents\"]) {\n if (!existsSync(join(root, dir))) continue;\n for (const path of scan(join(root, dir)).sort()) {\n prompts.set(relative(root, path).split(sep).join(\"/\"), readFileSync(path, \"utf8\"));\n }\n }\n return prompts;\n }\n\n /**\n * The fingerprints of what requests sent: `texts`, every string they\n * carried, and `tools`, each tool's definition hashes by name. A prompt file\n * counts as sent when one of its three longest pieces of static text (of 12\n * characters or more) is in `texts`.\n */\n static of(\n texts: Iterable<string>,\n tools: ReadonlyMap<string, ReadonlySet<string>>,\n options: FingerprintOptions = {},\n ): Fingerprints {\n const sent = [...texts].join(\"\\n\\0\\n\");\n const prompts: Record<string, string> = {};\n for (const [path, text] of Fingerprints.prompts(options)) {\n const longest = Fingerprints.pieces(text)\n .filter((piece) => piece.length >= 12)\n .sort((a, b) => b.length - a.length)\n .slice(0, 3);\n if (longest.some((piece) => sent.includes(piece))) prompts[path] = Fingerprints.blob(text);\n }\n const names = [...tools.keys()].sort();\n const inputs = options.inputs?.(new Set(names));\n return new Fingerprints(\n {\n prompts,\n tools: Object.fromEntries(names.map((name) => [name, [...tools.get(name)!].sort()])),\n ...(inputs && Object.keys(inputs).length > 0 ? { inputs: sortKeys(inputs) } : {}),\n },\n options,\n );\n }\n\n /** Whether `other` says the same. */\n same(other: Fingerprints | RecordingFingerprints): boolean {\n const data = other instanceof Fingerprints ? other.data : other;\n return JSON.stringify(this.data) === JSON.stringify(data);\n }\n\n /**\n * What differs today from what the recording was made with, without running\n * anything: each prompt file changed or gone (its path) and each input\n * changed or gone (`input <name>`). Tools defined in code are compared by a\n * replay, which offers them.\n */\n changed(): string[] {\n const today = this.options.inputs?.(new Set(Object.keys(this.data.tools))) ?? {};\n return [\n ...this.changedPrompts().map(([path]) => path),\n ...Object.entries(this.data.inputs ?? {})\n .filter(([name, hash]) => today[name] !== hash)\n .map(([name]) => `input ${name}`),\n ];\n }\n\n /**\n * How each side of a differing request is cut before the two are compared:\n * the static text of every prompt file changed since the recording (and of\n * the partials each version of it includes) is cut out, the recorded\n * version's from the recorded request and today's from the replay's.\n * `changed` names those files. Throws when a changed prompt's recorded\n * version can't be read back.\n */\n cutters(): {\n changed: string[];\n recorded: (text: string) => string;\n sent: (text: string) => string;\n } {\n const today = Fingerprints.prompts(this.options);\n const changed = this.changedPrompts();\n const recorded = new Map<string, string>();\n const sent = new Map<string, string>();\n for (const [path, blob] of changed) {\n const text = this.readBlob(blob);\n if (text === undefined) {\n throw new Error(\n `${path} changed since the recording, and the version it was recorded with (${blob}) can't be read back from git`,\n );\n }\n recorded.set(path, text);\n if (today.has(path)) sent.set(path, today.get(path)!);\n }\n return {\n changed: changed.map(([path]) => path),\n recorded: cutOut(\n this.piecesWithPartials(recorded, (path) => {\n const blob = this.data.prompts[path];\n return (blob && this.readBlob(blob)) || today.get(path);\n }),\n ),\n sent: cutOut(this.piecesWithPartials(sent, (path) => today.get(path))),\n };\n }\n\n /** The prompt files that changed or are gone since the recording, with their recorded blob ids. */\n private changedPrompts(): [string, string][] {\n const today = Fingerprints.prompts(this.options);\n return Object.entries(this.data.prompts).filter(([path, blob]) => {\n const text = today.get(path);\n return text === undefined || Fingerprints.blob(text) !== blob;\n });\n }\n\n private readBlob(blob: string): string | undefined {\n if (this.options.readBlob) return this.options.readBlob(blob);\n const git = Bun.spawnSync([\"git\", \"cat-file\", \"blob\", blob], { cwd: this.root });\n return git.exitCode === 0 ? git.stdout.toString() : undefined;\n }\n\n /**\n * The static text of `texts` and of the partials each includes, longest\n * first: moving text into a partial is a change of wording too. Partials\n * resolve as `Prompt.render` resolves them.\n */\n private piecesWithPartials(\n texts: Map<string, string>,\n version: (path: string) => string | undefined,\n ): string[] {\n const dirs = this.options.dirs ?? [\"app/agents\"];\n const shared = this.options.shared ?? \"prompts\";\n const pending = [...texts];\n while (pending.length > 0) {\n const [path, text] = pending.pop()!;\n const dir = dirs.find((d) => path.startsWith(`${d}/`));\n if (dir === undefined) continue;\n for (const [, name] of text.matchAll(PARTIAL)) {\n const partial = `${dir}/${name!.includes(\"/\") ? name : `${shared}/${name}`}.md`;\n const body = texts.has(partial) ? undefined : version(partial);\n if (body === undefined) continue;\n texts.set(partial, body);\n pending.push([partial, body]);\n }\n }\n return [...texts.values()]\n .flatMap((text) => Fingerprints.pieces(text))\n .sort((a, b) => b.length - a.length);\n }\n}\n\nfunction sortKeys(record: Record<string, string>): Record<string, string> {\n return Object.fromEntries(Object.entries(record).sort(([a], [b]) => a.localeCompare(b)));\n}\n",
|
|
7
7
|
"/**\n * Runs the process's clock from `at`: `Date.now()` and `new Date()` answer\n * `at` plus the time since the call, until the returned function puts the real\n * clock back. For replaying a recording (`RecordingProvider.recordedAt`), so\n * dates relative to today (\"in three days\", \"this week\") come out as they were\n * recorded. Timers are not touched: time still passes at its real rate.\n *\n * const restore = pinClock(replay.recordedAt);\n * try {\n * await runTheCase(replay);\n * } finally {\n * restore();\n * }\n *\n * Process-wide, like the clock it replaces: don't run two pinned replays side\n * by side. Inside vitest, `vi.setSystemTime` does the same job.\n */\nexport function pinClock(at: Date | string | number): () => void {\n const RealDate = globalThis.Date;\n const offset = new RealDate(at).getTime() - RealDate.now();\n if (!Number.isFinite(offset)) throw new Error(`pinClock: ${String(at)} is not a date.`);\n\n class PinnedDate extends RealDate {\n constructor(...args: unknown[]) {\n if (args.length === 0) super(RealDate.now() + offset);\n else super(...(args as [string | number | Date]));\n }\n\n static now(): number {\n return RealDate.now() + offset;\n }\n }\n globalThis.Date = PinnedDate as DateConstructor;\n return () => {\n if (globalThis.Date === (PinnedDate as DateConstructor)) globalThis.Date = RealDate;\n };\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";gKAAA,mBAAS,aCAT,mBAAS,eACT,qBAAS,iBAAY,kBAAa,cAAc,WAChD,eAAS,cAAM,SAAU,aA2CzB,IAAM,EAAM,SAEN,EAAW,EACX,EAAU,4BAEV,EAAS,CAAC,IAAiB,EAAK,QAAQ,sBAAuB,MAAM,EAO3E,SAAS,CAAM,CAAC,EAA4C,CAC1D,IAAM,EAAO,EAAO,OAAO,CAAC,IAAU,EAAM,QAAU,CAAQ,EACxD,EAAQ,EAAO,OAAO,CAAC,IAAU,EAAM,OAAS,CAAQ,EAC9D,MAAO,CAAC,IAAS,CACf,IAAI,EAAO,EACX,QAAW,KAAS,EAAM,GAAI,EAAK,SAAS,CAAK,EAAG,EAAO,EAAK,MAAM,CAAK,EAAE,KAAK,CAAG,EACrF,QAAW,KAAS,EAClB,EAAO,EACJ,QAAQ,IAAI,OAAO,GAAG,EAAO,CAAK,QAAQ,IAAO,GAAG,EAAG,CAAG,EAC1D,QAAQ,IAAI,OAAO,GAAG,QAAU,EAAO,CAAK,IAAK,GAAG,EAAG,CAAG,EAE/D,OAAO,EAAK,QAAQ,IAAI,OAAO,OAAO,QAAU,MAAS,GAAG,EAAG,CAAG,GAItE,SAAS,CAAI,CAAC,EAAa,EAAgB,CAAC,EAAa,CACvD,QAAW,KAAS,EAAY,CAAG,EAAG,CACpC,GAAI,IAAU,eAAgB,SAC9B,IAAM,EAAO,EAAK,EAAK,CAAK,EAC5B,GAAI,EAAS,CAAI,EAAE,YAAY,EAAG,EAAK,EAAM,CAAG,EAC3C,QAAI,EAAM,SAAS,KAAK,EAAG,EAAI,KAAK,CAAI,EAE/C,OAAO,EAeF,MAAM,CAAa,CAKb,KAJF,KACQ,QAEjB,WAAW,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.d.ts
CHANGED
|
@@ -59,7 +59,17 @@ export type Usage = {
|
|
|
59
59
|
outputTokens: number;
|
|
60
60
|
/** Billed separately by OpenAI and worth surfacing on its own. */
|
|
61
61
|
reasoningTokens?: number;
|
|
62
|
+
/** The part of `inputTokens` read from the provider's prompt cache. */
|
|
62
63
|
cachedInputTokens?: number;
|
|
64
|
+
/**
|
|
65
|
+
* The part of `inputTokens` written to the prompt cache on this call, which
|
|
66
|
+
* Anthropic bills above the normal input price (1.25x for the 5-minute
|
|
67
|
+
* cache). A breakdown like `cachedInputTokens`, not a separate bucket: the
|
|
68
|
+
* provider reports the three apart, and `inputTokens` is their sum. Absent on
|
|
69
|
+
* a provider that does not report writes (OpenAI caches without charging
|
|
70
|
+
* for it).
|
|
71
|
+
*/
|
|
72
|
+
cacheWriteInputTokens?: number;
|
|
63
73
|
/**
|
|
64
74
|
* How much of `inputTokens` / `outputTokens` was image rather than text, on a
|
|
65
75
|
* generation or an edit.
|
|
@@ -167,11 +177,23 @@ export type TextPart = {
|
|
|
167
177
|
* Reasoning is kept as its own part rather than folded into text: it must be
|
|
168
178
|
* renderable separately (or not at all), and on the next turn it has to be sent
|
|
169
179
|
* back to the provider in its original form for cache hits to survive.
|
|
180
|
+
*
|
|
181
|
+
* `id` is the Responses API's handle on a reasoning item. `providerMetadata`
|
|
182
|
+
* is everything else a provider needs to send the part back (#477): written by
|
|
183
|
+
* the provider that produced the part, under its own key (`{ anthropic: {
|
|
184
|
+
* signature } }`), and passed back untouched. Opaque to everything else, and
|
|
185
|
+
* ignored by a provider that finds no key of its own in it, so a part from one
|
|
186
|
+
* provider's turn is never sent to another as if it were its own.
|
|
187
|
+
*
|
|
188
|
+
* A part that has `providerMetadata` is complete: the provider sends it once a
|
|
189
|
+
* block has ended (a thinking block's signature arrives after its text), so a
|
|
190
|
+
* later reasoning delta starts a new part rather than joining this one.
|
|
170
191
|
*/
|
|
171
192
|
export type ReasoningPart = {
|
|
172
193
|
type: "reasoning";
|
|
173
194
|
id?: string;
|
|
174
195
|
text?: string;
|
|
196
|
+
providerMetadata?: Record<string, unknown>;
|
|
175
197
|
};
|
|
176
198
|
/**
|
|
177
199
|
* An uploaded file: the provider's copy, gemi's copy, or both.
|
|
@@ -489,6 +511,13 @@ export type ToolResultPart<T extends ToolShapes = ToolShapes> = {
|
|
|
489
511
|
export type OutputPart<O = unknown> = {
|
|
490
512
|
type: "output";
|
|
491
513
|
value: O;
|
|
514
|
+
/**
|
|
515
|
+
* The answer exactly as the model wrote it, which `value` was parsed from.
|
|
516
|
+
* Sent back in place of a re-serialized `value`, so a provider that checks
|
|
517
|
+
* its own history (Anthropic's preserved thinking) sees what it produced.
|
|
518
|
+
* Set by the server; absent on parts a client built.
|
|
519
|
+
*/
|
|
520
|
+
text?: string;
|
|
492
521
|
/** True while the object is still being assembled from the token stream. */
|
|
493
522
|
partial?: boolean;
|
|
494
523
|
};
|
|
@@ -773,12 +802,17 @@ export type AgentStreamEvent<T extends ToolShapes = ToolShapes, O = unknown> = {
|
|
|
773
802
|
* cache, which keys on the literal item. Optional because a provider need
|
|
774
803
|
* not supply one (Azure does not always); such a part still renders, it just
|
|
775
804
|
* cannot be echoed back.
|
|
805
|
+
*
|
|
806
|
+
* `providerMetadata` is the part's `ReasoningPart.providerMetadata` (#477),
|
|
807
|
+
* for the same reason: a stateless client has to post it back. It arrives on
|
|
808
|
+
* the part's last delta (often with an empty `delta`), and closes the part.
|
|
776
809
|
*/
|
|
777
810
|
| {
|
|
778
811
|
type: "reasoning-delta";
|
|
779
812
|
messageId: string;
|
|
780
813
|
delta: string;
|
|
781
814
|
id?: string;
|
|
815
|
+
providerMetadata?: Record<string, unknown>;
|
|
782
816
|
}
|
|
783
817
|
/** Emitted only for an agent with an `output` schema: `delta` is raw JSON
|
|
784
818
|
* text, `snapshot` the best-effort parse so far, so a UI can bind fields
|
package/dist/ai/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot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E,MAAM,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAE,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,IAAI;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC/B,CAAC"}
|
package/dist/ai/usageMeter.d.ts
CHANGED
|
@@ -16,11 +16,14 @@ import type { Usage as UsageType } from "./types";
|
|
|
16
16
|
* worked out from `result.usage` afterwards: that sum mixes models, and each
|
|
17
17
|
* call is priced here, when it is recorded, at its own model's prices.
|
|
18
18
|
*/
|
|
19
|
-
/** USD per million tokens. `cachedInput`
|
|
19
|
+
/** USD per million tokens. `cachedInput` and `cacheWriteInput` default to `input`. */
|
|
20
20
|
export type ModelPrice = {
|
|
21
21
|
input: number;
|
|
22
22
|
output: number;
|
|
23
23
|
cachedInput?: number;
|
|
24
|
+
/** For `Usage.cacheWriteInputTokens` (Anthropic: 1.25x `input` for the
|
|
25
|
+
* 5-minute cache). */
|
|
26
|
+
cacheWriteInput?: number;
|
|
24
27
|
/** For image tokens (`Usage.imageInputTokens` / `imageOutputTokens`);
|
|
25
28
|
* they're priced as text when these are absent. */
|
|
26
29
|
imageInput?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usageMeter.d.ts","sourceRoot":"","sources":["../../ai/usageMeter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;;;;;;;;;;;;GAgBG;AAEH,
|
|
1
|
+
{"version":3,"file":"usageMeter.d.ts","sourceRoot":"","sources":["../../ai/usageMeter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;;;;;;;;;;;;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,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CASzF;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC;AAE9B,eAAO,MAAM,KAAK;IAChB;;;;OAIG;uBACgB;QAAE,OAAO,CAAC,EAAE,YAAY,CAAA;KAAE,GAAG,IAAI;IAGpD;;;;;;;OAOG;;IAEH;;;OAGG;eACQ,MAAM,QAAQ,MAAM,GAAG,IAAI;IAGtC;;;;OAIG;kBACW,MAAM,SAAS,SAAS,GAAG,IAAI;IAG7C,6EAA6E;eAClE,UAAU,GAAG,SAAS;CAGlC,CAAC"}
|
package/dist/app/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Sa as a}from"../chunk-jy61580r.js";import"../chunk-ne51fxg2.js";import"../chunk-zf1eqgzt.js";export{a as App};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=668BCB797828983E64756E2164756E21
|
package/dist/app/index.js.map
CHANGED
package/dist/bun/plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ta as a}from"../chunk-sjve1yvv.js";import"../chunk-4ksnhx8x.js";import"../chunk-m3v661b3.js";import"../chunk-zvk6dydb.js";import"../chunk-zf1eqgzt.js";export{a as gemiPlugin};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=BD578B5AA7215BBC64756E2164756E21
|
package/dist/bun/plugin.js.map
CHANGED
package/dist/bun/preload.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ta as k}from"../chunk-sjve1yvv.js";import"../chunk-4ksnhx8x.js";import"../chunk-m3v661b3.js";import"../chunk-zvk6dydb.js";import{Na as j}from"../chunk-0cckwd91.js";import"../chunk-zf1eqgzt.js";var{plugin:q}=globalThis.Bun;q(k());var y=await j(process.cwd());for(let x of y.bun?.plugins??[])q(x);
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=CF0741C315167B7764756E2164756E21
|
package/dist/bun/preload.js.map
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { plugin } from \"bun\";\nimport { gemiPlugin } from \"./plugin\";\nimport { loadGemiConfig } from \"../config/load\";\n\n// Registers gemi's custom-request transform plus any Bun plugins the app\n// declares in `gemi.config.ts` as Bun *runtime* plugins. Loaded via\n// `bun --hot|--preload gemi/bun/preload app/server.ts` (see the `dev`/`start`\n// commands in `bin/gemi.ts`) so controllers/routes are transformed on import —\n// the runtime counterpart to the same plugins passed to `Bun.build` in the\n// server build. Top-level `await` here completes before app code loads.\nplugin(gemiPlugin());\n\nconst config = await loadGemiConfig(process.cwd());\nfor (const p of config.bun?.plugins ?? []) {\n plugin(p);\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";iOAAA,wBAUA,HAAO,HAAW,JAAC,HAEnB,IAAM,EAAS,MAAM,EAAe,QAAQ,IAAI,CAAC,EACjD,QAAW,KAAK,EAAO,KAAK,SAAW,CAAC,EACtC,EAAO,CAAC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "CF0741C315167B7764756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
class K extends Error{lock;token;constructor(x,z,C="its lease ran out or another holder took it"){super(`Lost the lock "${x}" (token ${z}): ${C}.`);this.lock=x;this.token=z;this.name="LockLostError"}}var X=60000,Y=100,Z=(x)=>new Promise((z)=>setTimeout(z,x));class V{store;name;owner;token;ttl;lost;controller=new AbortController;deadline;expiryTimer;renewTimer;done=!1;constructor(x,z,C,B,G,J){this.store=x;this.name=z;this.owner=C;this.token=B;this.ttl=G;this.lost=this.controller.signal,this.deadline=J+G,this.armExpiry()}get expired(){return this.lost.aborted||performance.now()>=this.deadline}async extend(x=this.ttl){if(this.lost.aborted)return!1;let z=performance.now();if(!await this.store.extend(this.name,this.owner,this.token,x))return this.markLost(),!1;if(this.done)return!0;return this.deadline=Math.max(this.deadline,z+x),this.armExpiry(),!0}async isHeld(){if(this.lost.aborted)return!1;let x=await this.store.held(this.name,this.owner,this.token);if(!x)this.markLost();return x}async fence(x){if(this.lost.aborted)throw new K(this.name,this.token);try{return await this.store.fence(this.name,this.owner,this.token,x)}catch(z){if(z instanceof K)this.markLost();throw z}}async release(){if(this.stop(),this.lost.aborted)return!1;return this.store.release(this.name,this.owner,this.token)}startRenewing(){if(this.renewTimer||this.done)return;this.renewTimer=setInterval(()=>{this.extend().catch((x)=>{console.error(`[gemi] Could not renew the lock "${this.name}".`,x)})},Math.max(1,Math.floor(this.ttl/3))),this.renewTimer.unref?.()}markLost(x){if(this.stop(),!this.lost.aborted)this.controller.abort(new K(this.name,this.token,x))}stop(){this.done=!0,clearInterval(this.renewTimer),clearTimeout(this.expiryTimer),this.renewTimer=void 0,this.expiryTimer=void 0}armExpiry(){clearTimeout(this.expiryTimer),this.expiryTimer=setTimeout(()=>this.markLost("its lease ran out before it was renewed"),Math.max(0,this.deadline-performance.now())),this.expiryTimer.unref?.()}}class ${store;static token="locks";constructor(x){this.store=x}async acquire(x,z={}){let C=z.ttl??X;if(!(C>0))throw Error(`A lock's ttl must be a positive number of milliseconds; got ${C}.`);let B=Bun.randomUUIDv7(),G=performance.now()+Math.max(0,z.wait??0);for(;;){let J=performance.now(),M=await this.store.acquire(x,B,C);if(M!==null){let Q=new V(this.store,x,B,M,C,J);if(z.renew)Q.startRenewing();return Q}let O=G-performance.now();if(O<=0)return null;await Z(Math.min(Y,O))}}async run(x,z,C){let B=await this.acquire(x,{...z,renew:z.renew??!0});if(!B)return{acquired:!1};let G;try{G=await C(B)}catch(J){throw await B.release().catch(()=>{}),J}if(B.expired)throw B.markLost(),B.lost.reason;return await B.release(),{acquired:!0,value:G}}}var j={ms:1,s:1000,m:60000,h:3600000,d:86400000,w:604800000};function P(x){if(typeof x==="number"){if(!Number.isFinite(x)||x<0)throw TypeError(`A duration is 0 or more milliseconds; got ${x}.`);return Math.round(x)}let z=/^\s*(\d+(?:\.\d+)?)\s*(ms|s|m|h|d|w)\s*$/.exec(String(x));if(!z)throw TypeError(`"${String(x)}" is not a duration. Use milliseconds, or a number and one of ms, s, m, h, d, w ("30s", "7d").`);return Math.round(Number(z[1])*j[z[2]])}
|
|
3
|
-
export{P as
|
|
3
|
+
export{P as Tk,K as Uk,V as Vk,$ as Wk};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=03BA0C470E15CA3964756E2164756E21
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"/**\n * A length of time: milliseconds as a number, or a number and a unit, such as\n * `\"500ms\"`, `\"30s\"`, `\"5m\"`, `\"2h\"`, `\"7d\"` or `\"1w\"`.\n */\nexport type Duration = number | `${number}${\"ms\" | \"s\" | \"m\" | \"h\" | \"d\" | \"w\"}`;\n\nconst UNITS: Record<string, number> = {\n ms: 1,\n s: 1000,\n m: 60_000,\n h: 60 * 60_000,\n d: 24 * 60 * 60_000,\n w: 7 * 24 * 60 * 60_000,\n};\n\n/** A `Duration` in milliseconds. Throws for anything else, on the caller's stack. */\nexport function toMilliseconds(duration: Duration): number {\n if (typeof duration === \"number\") {\n if (!Number.isFinite(duration) || duration < 0) {\n throw new TypeError(`A duration is 0 or more milliseconds; got ${duration}.`);\n }\n return Math.round(duration);\n }\n const match = /^\\s*(\\d+(?:\\.\\d+)?)\\s*(ms|s|m|h|d|w)\\s*$/.exec(String(duration));\n if (!match) {\n throw new TypeError(\n `\"${String(duration)}\" is not a duration. Use milliseconds, or a number and ` +\n `one of ms, s, m, h, d, w (\"30s\", \"7d\").`,\n );\n }\n return Math.round(Number(match[1]) * UNITS[match[2]!]!);\n}\n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,UACR,IAAI,OAAO,CAAQ,iGAErB,EAEF,OAAO,KAAK,MAAM,OAAO,EAAM,EAAE,EAAI,EAAM,EAAM,GAAK",
|
|
10
|
-
"debugId": "
|
|
10
|
+
"debugId": "03BA0C470E15CA3964756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{B as
|
|
2
|
+
import{Yl as x}from"./chunk-65btke6p.js";function B(j){return j}function C(){return{supportedLocales:[],defaultLocale:"en-US",prefetch:{},components:{},detectLocale:()=>null,onLocaleChange:(j)=>{console.log(`Locale changed to ${j}`)},timeZone:x,detectTimeZone:()=>null}}
|
|
3
|
+
export{B as Je,C as Ke};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=56136C8D505E5ACC64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { DEFAULT_TIME_ZONE } from \"./formatter\";\nimport type { Dictionary } from \"./Dictionary\";\nimport type { HttpRequest } from \"../http/HttpRequest\";\n\n// Config key: `translation`. Derived from `I18nServiceProvider`.\nexport interface TranslationConfig {\n supportedLocales?: string[];\n defaultLocale?: string;\n /**\n * @deprecated Only for `Dictionary.create` dictionaries. A `defineDictionary`\n * dictionary needs no entry here — the component that reads it pulls it in,\n * and the bundler ships only the active locale.\n */\n prefetch?: Record<string, Array<Dictionary<any>>>;\n /** @deprecated Only for `Dictionary.create` dictionaries. See `prefetch`. */\n components?: Record<string, Dictionary<any>>;\n\n // Returning `null` falls back to gemi's own locale detection.\n detectLocale?: (req: HttpRequest) => string | null;\n onLocaleChange?: (locale: string) => Promise<void> | void;\n\n /**\n * The IANA time zone dates are formatted in by `useFormatter`,\n * `useDictionary(...).format` and `Lang.formatter()`. Defaults to `UTC`.\n *\n * One zone for server and browser alike, so a server-rendered date and its\n * hydrated copy print the same text. Override per call with\n * `format.date(value, { timeZone })`.\n */\n timeZone?: string;\n /**\n * Resolve the zone for one request, e.g. from a cookie or the signed-in\n * user's profile. Returning `null` (or a zone `Intl` does not know) falls back\n * to `timeZone`. Runs on the server; the result ships with the page.\n */\n detectTimeZone?: (req: HttpRequest) => string | null;\n}\n\nexport function defineTranslationConfig(\n config: TranslationConfig,\n): TranslationConfig {\n return config;\n}\n\nexport function translationConfigDefaults(): Required<TranslationConfig> {\n return {\n supportedLocales: [],\n defaultLocale: \"en-US\",\n prefetch: {},\n components: {},\n detectLocale: () => null,\n onLocaleChange: (locale) => {\n console.log(`Locale changed to ${locale}`);\n },\n timeZone: DEFAULT_TIME_ZONE,\n detectTimeZone: () => null,\n };\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";yCAsCO,SAAS,CAAuB,CACrC,EACmB,CACnB,OAAO,EAGF,SAAS,CAAyB,EAAgC,CACvE,MAAO,CACL,iBAAkB,CAAC,EACnB,cAAe,QACf,SAAU,CAAC,EACX,WAAY,CAAC,EACb,aAAc,IAAM,KACpB,eAAgB,CAAC,IAAW,CAC1B,QAAQ,IAAI,qBAAqB,GAAQ,GAE3C,SAAU,EACV,eAAgB,IAAM,IACxB",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "56136C8D505E5ACC64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{existsSync as v}from"fs";import{join as z}from"path";var A=["gemi.config.ts","gemi.config.js","gemi.config.mjs"];async function J(q=process.cwd()){for(let u of A){let b=z(q,u);if(v(b)){let k=await import(b);return k.default??k}}return{}}
|
|
3
|
-
export{J as
|
|
3
|
+
export{J as Na};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=67D53856AE5F0ECA64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GemiConfig } from \"./index\";\n\nconst CONFIG_FILES = [\"gemi.config.ts\", \"gemi.config.js\", \"gemi.config.mjs\"];\n\n// Load the app's `gemi.config.*` from `rootDir`. Runs under Bun in every\n// context that needs it — the CLI, the `--preload` runtime, and the gemi Vite\n// plugin (the build runs Vite via `bun --bun`, dev via `bun --hot`) — so a\n// TypeScript config imports directly with no extra transpilation step. Returns\n// an empty config when no file is present, so config is entirely optional.\nexport async function loadGemiConfig(\n rootDir: string = process.cwd(),\n): Promise<GemiConfig> {\n for (const name of CONFIG_FILES) {\n const path = join(rootDir, name);\n if (existsSync(path)) {\n const mod = await import(path);\n return (mod.default ?? mod) as GemiConfig;\n }\n }\n return {};\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAAA,qBAAS,WACT,eAAS,aAGT,IAAM,EAAe,CAAC,iBAAkB,iBAAkB,iBAAiB,EAO3E,eAAsB,CAAc,CAClC,EAAkB,QAAQ,IAAI,EACT,CACrB,QAAW,KAAQ,EAAc,CAC/B,IAAM,EAAO,EAAK,EAAS,CAAI,EAC/B,GAAI,EAAW,CAAI,EAAG,CACpB,IAAM,EAAM,MAAa,UACzB,OAAQ,EAAI,SAAW,GAG3B,MAAO,CAAC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "67D53856AE5F0ECA64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{constants as M}from"os";var R=Symbol.for("gemi.server.shutdown");function K(){let j=globalThis,z=j[R]??={};return z.shuttingDown??=!1,z.drained??=!1,z.held??=new Set,z.controller??=new AbortController,z}function C(){return K().shuttingDown}function q(){let j=K();if(j.shuttingDown=!0,!j.controller.signal.aborted)j.controller.abort()}function L(){return K().controller.signal}function w(j){let z=K().held,B=j.then(()=>z.delete(B),()=>z.delete(B));return z.add(B),j}function Y(){return K().held.size}async function _(){let j=K().held;while(j.size>0)await Promise.allSettled(j)}function b(){K().drained=!0}function A(j=process.env){let z={timeoutMs:$(j.GEMI_SHUTDOWN_TIMEOUT,20),delayMs:$(j.GEMI_SHUTDOWN_DELAY,0),providerTimeoutMs:$(j.GEMI_SHUTDOWN_PROVIDER_TIMEOUT,5)};if(z.delayMs>0&&z.delayMs>=z.timeoutMs)console.warn(`[gemi] GEMI_SHUTDOWN_DELAY (${z.delayMs/1000}s) leaves no time to drain within GEMI_SHUTDOWN_TIMEOUT (${z.timeoutMs/1000}s); in-flight requests will be abandoned on every shutdown. Raise the timeout.`);return z}function $(j,z){let B=j===void 0||j.trim()===""?NaN:Number(j);if(Number.isFinite(B)&&B>=0)return B*1000;if(j!==void 0)console.warn(`[gemi] Ignoring shutdown setting "${j}": expected a number of seconds.`);return z*1000}async function D(j){let{server:z,settings:B}=j,J=Date.now()+B.timeoutMs;q(),console.log(`[gemi] Shutting down: draining in-flight requests (up to ${B.timeoutMs/1000}s).`);let H=!0,V=_();if(z){if(B.delayMs>0)await E(Math.min(B.delayMs,J-Date.now()));let X=z.stop(),F=Promise.resolve();try{F=Promise.resolve(j.closeSockets?.()).catch(()=>{})}catch(Z){console.error("[gemi] Closing the broadcast sockets failed:",Z)}let O=J-Date.now(),x=j.closeSockets?Promise.race([X,Promise.all([F,y(z)])]):X,G=Promise.all([x,V]);if(H=O>0?await P(G,O):z.pendingRequests===0&&Y()===0,!H){let Z=[z.pendingRequests>0?`${z.pendingRequests} request(s)`:void 0,Y()>0?`${Y()} held background task(s)`:void 0].filter(Boolean);console.error(`[gemi] Shutdown grace period elapsed with ${Z.join(" and ")||"work"} still in flight; abandoning them.`),z.stop(!0).catch(()=>{})}}else if(Y()>0){let X=J-Date.now();if(H=X>0&&await P(V,X),!H)console.error(`[gemi] Shutdown grace period elapsed with ${Y()} held background task(s) still running; abandoning them.`)}b();let Q=await j.shutdownProviders({timeoutMs:B.providerTimeoutMs}),U=H&&Q.failed.length===0&&Q.timedOut.length===0;return console.log(`[gemi] Shutdown ${U?"complete":"finished with errors"}.`),U?0:1}function y(j){return new Promise((z)=>{let B=()=>{if(j.pendingRequests===0){z();return}setTimeout(B,50).unref?.()};B()})}async function P(j,z){if(z<=0)return!1;let B,J=await Promise.race([j.then(()=>!0,()=>!0),new Promise((H)=>{B=setTimeout(()=>H(!1),z)})]);return clearTimeout(B),J}function E(j){return new Promise((z)=>setTimeout(z,Math.max(0,j)))}function N(j){if(!C())return j;try{return j.headers.set("Connection","close"),j}catch{let z=new Response(j.body,j);return z.headers.set("Connection","close"),z}}function W(j){return async(z,B)=>{if(K().drained)return new Response("Service Unavailable",{status:503,headers:{Connection:"close"}});return N(await j(z,B))}}var f=Symbol.for("gemi.server.signalsInstalled"),T=1000;function S(j,z={}){let B=globalThis;if(B[f])return;B[f]=!0;let J=z.repeatWindowMs??T,H,V=(Q)=>{if(H!==void 0){if(Date.now()-H<J)return;console.error(`[gemi] ${Q} received again; exiting without waiting for the drain.`),process.exit(128+M.signals[Q])}H=Date.now(),console.log(`[gemi] ${Q} received.`),j().then((U)=>process.exit(U),(U)=>{console.error("[gemi] Shutdown failed:",U),process.exit(1)})};process.on("SIGTERM",V),process.on("SIGINT",V)}
|
|
3
|
-
export{C as
|
|
3
|
+
export{C as mm,q as nm,L as om,w as pm,Y as qm,_ as rm,A as sm,D as tm,N as um,W as vm,S as wm};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=5E1F2735588E28E864756E2164756E21
|