gemi 0.215.0 → 0.217.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/Agent.d.ts +9 -7
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/AgentController.d.ts +91 -7
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/AgentProvider.d.ts +32 -15
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/FallbackProvider.d.ts +8 -6
- package/dist/ai/FallbackProvider.d.ts.map +1 -1
- package/dist/ai/generate.d.ts.map +1 -1
- package/dist/ai/index.d.ts +3 -2
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +42 -42
- package/dist/ai/index.js.map +5 -5
- package/dist/ai/live/harness.d.ts +1 -0
- package/dist/ai/live/harness.d.ts.map +1 -1
- package/dist/ai/providers/anthropicStream.d.ts.map +1 -1
- package/dist/ai/providers/call.d.ts +10 -0
- package/dist/ai/providers/call.d.ts.map +1 -1
- package/dist/ai/providers/errors.d.ts +15 -7
- package/dist/ai/providers/errors.d.ts.map +1 -1
- package/dist/ai/providers/fakeProvider.d.ts +3 -0
- package/dist/ai/providers/fakeProvider.d.ts.map +1 -1
- package/dist/ai/providers/stream.d.ts.map +1 -1
- package/dist/ai/redact.d.ts +4 -6
- package/dist/ai/redact.d.ts.map +1 -1
- package/dist/ai/store/Attachments.d.ts +98 -2
- package/dist/ai/store/Attachments.d.ts.map +1 -1
- package/dist/ai/store/FileOwners.d.ts +18 -0
- package/dist/ai/store/FileOwners.d.ts.map +1 -1
- package/dist/ai/store/index.d.ts +1 -1
- package/dist/ai/store/index.d.ts.map +1 -1
- package/dist/ai/testing/RecordingProvider.d.ts +2 -0
- 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 +23 -0
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bin/ai-client/extract.d.ts +6 -4
- package/dist/bin/ai-client/extract.d.ts.map +1 -1
- package/dist/bin/ai-client/kotlin.d.ts +13 -1
- package/dist/bin/ai-client/kotlin.d.ts.map +1 -1
- package/dist/bin/ai-client/model.d.ts +4 -3
- package/dist/bin/ai-client/model.d.ts.map +1 -1
- package/dist/bin/ai-client/swift.d.ts +10 -1
- package/dist/bin/ai-client/swift.d.ts.map +1 -1
- package/dist/bin/gemi.js +51 -29
- package/dist/bin/gemi.js.map +6 -6
- package/dist/bin/http-client/extract.d.ts.map +1 -1
- package/dist/bin/http-client/model.d.ts +1 -1
- package/dist/bin/http-client/model.d.ts.map +1 -1
- package/dist/bin/http-client/render.d.ts +5 -0
- package/dist/bin/http-client/render.d.ts.map +1 -0
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-y0b22kf8.js → chunk-17agj0r3.js} +2 -2
- package/dist/{chunk-y0b22kf8.js.map → chunk-17agj0r3.js.map} +1 -1
- package/dist/{chunk-k6532519.js → chunk-1nw9jhpt.js} +2 -2
- package/dist/{chunk-k6532519.js.map → chunk-1nw9jhpt.js.map} +1 -1
- package/dist/{chunk-153m8mfe.js → chunk-3r7z4kc0.js} +2 -2
- package/dist/{chunk-153m8mfe.js.map → chunk-3r7z4kc0.js.map} +1 -1
- package/dist/{chunk-2e278yhf.js → chunk-4k3r37be.js} +2 -2
- package/dist/{chunk-2e278yhf.js.map → chunk-4k3r37be.js.map} +1 -1
- package/dist/{chunk-gk2k76tn.js → chunk-4s72m6zx.js} +3 -3
- package/dist/{chunk-gk2k76tn.js.map → chunk-4s72m6zx.js.map} +1 -1
- package/dist/{chunk-m4nn6ne9.js → chunk-5gp49wph.js} +2 -2
- package/dist/{chunk-c80xrwep.js.map → chunk-5gp49wph.js.map} +1 -1
- package/dist/{chunk-qt80d3fw.js → chunk-5vdkqv17.js} +2 -2
- package/dist/{chunk-qt80d3fw.js.map → chunk-5vdkqv17.js.map} +1 -1
- package/dist/{chunk-2ek8wpe8.js → chunk-5wh3cw2x.js} +3 -3
- package/dist/{chunk-2ek8wpe8.js.map → chunk-5wh3cw2x.js.map} +1 -1
- package/dist/{chunk-wsp30cr6.js → chunk-6b7z5h54.js} +2 -2
- package/dist/{chunk-wsp30cr6.js.map → chunk-6b7z5h54.js.map} +1 -1
- package/dist/{chunk-78gy3agg.js → chunk-6ncn8rdn.js} +2 -2
- package/dist/{chunk-78gy3agg.js.map → chunk-6ncn8rdn.js.map} +1 -1
- package/dist/chunk-7081awrd.js +11 -0
- package/dist/{chunk-3ejv7fs4.js.map → chunk-7081awrd.js.map} +6 -6
- package/dist/{chunk-ktxf56dm.js → chunk-7t13vyzg.js} +3 -3
- package/dist/{chunk-ktxf56dm.js.map → chunk-7t13vyzg.js.map} +1 -1
- package/dist/{chunk-hcysexst.js → chunk-7xe5vd4w.js} +2 -2
- package/dist/{chunk-hcysexst.js.map → chunk-7xe5vd4w.js.map} +1 -1
- package/dist/{chunk-61sevt6g.js → chunk-8524ejgk.js} +2 -2
- package/dist/{chunk-61sevt6g.js.map → chunk-8524ejgk.js.map} +1 -1
- package/dist/{chunk-10safpz9.js → chunk-94fdjkzf.js} +2 -2
- package/dist/{chunk-10safpz9.js.map → chunk-94fdjkzf.js.map} +1 -1
- package/dist/{chunk-sw8012bt.js → chunk-9c8e4nkz.js} +2 -2
- package/dist/{chunk-sw8012bt.js.map → chunk-9c8e4nkz.js.map} +1 -1
- package/dist/{chunk-s7p6w1p2.js → chunk-9pvxexh1.js} +2 -2
- package/dist/{chunk-s7p6w1p2.js.map → chunk-9pvxexh1.js.map} +1 -1
- package/dist/{chunk-mj857ksa.js → chunk-aes0ecnp.js} +3 -3
- package/dist/{chunk-mj857ksa.js.map → chunk-aes0ecnp.js.map} +1 -1
- package/dist/{chunk-nc5p41g9.js → chunk-at6zjajz.js} +2 -2
- package/dist/{chunk-nc5p41g9.js.map → chunk-at6zjajz.js.map} +1 -1
- package/dist/{chunk-2w8j265x.js → chunk-b1btq22a.js} +3 -3
- package/dist/{chunk-2w8j265x.js.map → chunk-b1btq22a.js.map} +1 -1
- package/dist/{chunk-sqzm1k9q.js → chunk-b1pps9bj.js} +2 -2
- package/dist/{chunk-sqzm1k9q.js.map → chunk-b1pps9bj.js.map} +1 -1
- package/dist/{chunk-c8sq880v.js → chunk-b8tmmpcf.js} +2 -2
- package/dist/{chunk-c8sq880v.js.map → chunk-b8tmmpcf.js.map} +1 -1
- package/dist/chunk-bcfwa370.js +5 -0
- package/dist/chunk-bcfwa370.js.map +13 -0
- package/dist/{chunk-1bsr7vzn.js → chunk-c71g46aw.js} +2 -2
- package/dist/{chunk-1bsr7vzn.js.map → chunk-c71g46aw.js.map} +1 -1
- package/dist/{chunk-nx86gzt1.js → chunk-cwm5x7rf.js} +2 -2
- package/dist/{chunk-nx86gzt1.js.map → chunk-cwm5x7rf.js.map} +1 -1
- package/dist/{chunk-ha3d6zhv.js → chunk-d6056zme.js} +2 -2
- package/dist/{chunk-ha3d6zhv.js.map → chunk-d6056zme.js.map} +1 -1
- package/dist/chunk-d6bgh2nr.js +5 -0
- package/dist/{chunk-g4esp7z5.js.map → chunk-d6bgh2nr.js.map} +1 -1
- package/dist/{chunk-tejgrqh7.js → chunk-dgna0e7g.js} +2 -2
- package/dist/{chunk-tejgrqh7.js.map → chunk-dgna0e7g.js.map} +1 -1
- package/dist/{chunk-ge201pk4.js → chunk-ee7xb9qr.js} +1 -1
- package/dist/{chunk-d8nxkc90.js → chunk-eh3ktv8k.js} +2 -2
- package/dist/{chunk-d8nxkc90.js.map → chunk-eh3ktv8k.js.map} +1 -1
- package/dist/{chunk-chy85f3v.js → chunk-fhb00fjx.js} +2 -2
- package/dist/{chunk-chy85f3v.js.map → chunk-fhb00fjx.js.map} +1 -1
- package/dist/{chunk-dghymwgp.js → chunk-fq7wkefg.js} +2 -2
- package/dist/{chunk-dghymwgp.js.map → chunk-fq7wkefg.js.map} +1 -1
- package/dist/{chunk-rdzdbd52.js → chunk-g178aect.js} +4 -4
- package/dist/{chunk-rdzdbd52.js.map → chunk-g178aect.js.map} +1 -1
- package/dist/{chunk-hka2sgqz.js → chunk-gt6eq1p2.js} +3 -3
- package/dist/{chunk-hka2sgqz.js.map → chunk-gt6eq1p2.js.map} +1 -1
- package/dist/{chunk-3xrmx5c7.js → chunk-gxd1388t.js} +2 -2
- package/dist/{chunk-3xrmx5c7.js.map → chunk-gxd1388t.js.map} +1 -1
- package/dist/{chunk-3fraz0p0.js → chunk-gxfyd8wr.js} +3 -3
- package/dist/{chunk-3fraz0p0.js.map → chunk-gxfyd8wr.js.map} +1 -1
- package/dist/{chunk-3vnb6xhz.js → chunk-h6knw9f0.js} +1 -1
- package/dist/{chunk-5yfdrbwv.js → chunk-hmtn7996.js} +2 -2
- package/dist/{chunk-5yfdrbwv.js.map → chunk-hmtn7996.js.map} +1 -1
- package/dist/{chunk-3egn4pfk.js → chunk-jzqywxpj.js} +2 -2
- package/dist/{chunk-3egn4pfk.js.map → chunk-jzqywxpj.js.map} +1 -1
- package/dist/{chunk-9a3wbbr6.js → chunk-k8nsefzb.js} +2 -2
- package/dist/{chunk-9a3wbbr6.js.map → chunk-k8nsefzb.js.map} +1 -1
- package/dist/{chunk-wee3yrdn.js → chunk-kggwk7hz.js} +1 -1
- package/dist/{chunk-y54kz6h6.js → chunk-m0pfdc1n.js} +3 -3
- package/dist/{chunk-y54kz6h6.js.map → chunk-m0pfdc1n.js.map} +1 -1
- package/dist/{chunk-ntwmz16f.js → chunk-m68cxnbv.js} +2 -2
- package/dist/{chunk-ntwmz16f.js.map → chunk-m68cxnbv.js.map} +1 -1
- package/dist/{chunk-768yza4f.js → chunk-ncw3zjxm.js} +2 -2
- package/dist/{chunk-768yza4f.js.map → chunk-ncw3zjxm.js.map} +1 -1
- package/dist/{chunk-fw7sxgse.js → chunk-nhebjh6n.js} +1 -1
- package/dist/{chunk-rqab9hcz.js → chunk-p18nfs9t.js} +2 -2
- package/dist/{chunk-rqab9hcz.js.map → chunk-p18nfs9t.js.map} +1 -1
- package/dist/{chunk-1a0ehbkm.js → chunk-ppdfwnqw.js} +1 -1
- package/dist/{chunk-tvd39jya.js → chunk-prc4bcgp.js} +2 -2
- package/dist/{chunk-tvd39jya.js.map → chunk-prc4bcgp.js.map} +1 -1
- package/dist/{chunk-zzrmsvqc.js → chunk-q0d45r2j.js} +2 -2
- package/dist/{chunk-zzrmsvqc.js.map → chunk-q0d45r2j.js.map} +1 -1
- package/dist/{chunk-xh2ejnar.js → chunk-q30f4r5x.js} +2 -2
- package/dist/{chunk-xh2ejnar.js.map → chunk-q30f4r5x.js.map} +1 -1
- package/dist/{chunk-bvm2w6ha.js → chunk-qa528feb.js} +2 -2
- package/dist/{chunk-bvm2w6ha.js.map → chunk-qa528feb.js.map} +1 -1
- package/dist/{chunk-5w0kzk4m.js → chunk-qstjm3cb.js} +2 -2
- package/dist/{chunk-5w0kzk4m.js.map → chunk-qstjm3cb.js.map} +1 -1
- package/dist/{chunk-c46y8hs0.js → chunk-r90djdx6.js} +2 -2
- package/dist/{chunk-c46y8hs0.js.map → chunk-r90djdx6.js.map} +1 -1
- package/dist/{chunk-jgb3je66.js → chunk-rp2f9mq1.js} +2 -2
- package/dist/{chunk-jgb3je66.js.map → chunk-rp2f9mq1.js.map} +1 -1
- package/dist/{chunk-t8ghxzva.js → chunk-s7jwsbfd.js} +3 -3
- package/dist/{chunk-t8ghxzva.js.map → chunk-s7jwsbfd.js.map} +1 -1
- package/dist/{chunk-gg97wgy0.js → chunk-sba3s380.js} +2 -2
- package/dist/{chunk-gg97wgy0.js.map → chunk-sba3s380.js.map} +1 -1
- package/dist/{chunk-m4wagwhr.js → chunk-snt0523y.js} +2 -2
- package/dist/{chunk-m4wagwhr.js.map → chunk-snt0523y.js.map} +1 -1
- package/dist/{chunk-5399t8zm.js → chunk-sqqh78tf.js} +2 -2
- package/dist/{chunk-5399t8zm.js.map → chunk-sqqh78tf.js.map} +1 -1
- package/dist/{chunk-sej6n20p.js → chunk-sxxkkx75.js} +4 -4
- package/dist/{chunk-sej6n20p.js.map → chunk-sxxkkx75.js.map} +2 -2
- package/dist/{chunk-at5ce580.js → chunk-tsjg2k2h.js} +3 -3
- package/dist/chunk-tsjg2k2h.js.map +27 -0
- package/dist/{chunk-vz2dt9f3.js → chunk-v0sgcy87.js} +1 -1
- package/dist/{chunk-zsk4wvrs.js → chunk-vawqmdh4.js} +2 -2
- package/dist/{chunk-zsk4wvrs.js.map → chunk-vawqmdh4.js.map} +1 -1
- package/dist/{chunk-7czjphwg.js → chunk-vck02shp.js} +2 -2
- package/dist/{chunk-7czjphwg.js.map → chunk-vck02shp.js.map} +1 -1
- package/dist/{chunk-4q0pxgv6.js → chunk-vewxnk3g.js} +2 -2
- package/dist/{chunk-4q0pxgv6.js.map → chunk-vewxnk3g.js.map} +1 -1
- package/dist/{chunk-9xa5kzaq.js → chunk-w3ks9nz7.js} +2 -2
- package/dist/{chunk-9xa5kzaq.js.map → chunk-w3ks9nz7.js.map} +1 -1
- package/dist/{chunk-11wy7gm1.js → chunk-w85wrer7.js} +2 -2
- package/dist/{chunk-11wy7gm1.js.map → chunk-w85wrer7.js.map} +1 -1
- package/dist/{chunk-xbxdhmh4.js → chunk-w9sw2kn7.js} +3 -3
- package/dist/{chunk-xbxdhmh4.js.map → chunk-w9sw2kn7.js.map} +1 -1
- package/dist/{chunk-9yh4sfac.js → chunk-wkmd81k4.js} +3 -3
- package/dist/{chunk-9yh4sfac.js.map → chunk-wkmd81k4.js.map} +1 -1
- package/dist/{chunk-xdrnzs3t.js → chunk-ww62b10k.js} +2 -2
- package/dist/{chunk-xdrnzs3t.js.map → chunk-ww62b10k.js.map} +1 -1
- package/dist/{chunk-mcqzgyvf.js → chunk-xb0evp2m.js} +2 -2
- package/dist/{chunk-mcqzgyvf.js.map → chunk-xb0evp2m.js.map} +1 -1
- package/dist/{chunk-2hcwvkfx.js → chunk-xese0rng.js} +3 -3
- package/dist/{chunk-2hcwvkfx.js.map → chunk-xese0rng.js.map} +1 -1
- package/dist/{chunk-bjh3ms04.js → chunk-xf3wke41.js} +2 -2
- package/dist/{chunk-bjh3ms04.js.map → chunk-xf3wke41.js.map} +1 -1
- package/dist/{chunk-0njs5zqz.js → chunk-xn7azkgd.js} +3 -3
- package/dist/{chunk-0njs5zqz.js.map → chunk-xn7azkgd.js.map} +1 -1
- package/dist/{chunk-2x4x2qnk.js → chunk-xp5mmgfp.js} +2 -2
- package/dist/{chunk-2x4x2qnk.js.map → chunk-xp5mmgfp.js.map} +1 -1
- package/dist/{chunk-er6rhs42.js → chunk-xyv3y476.js} +3 -3
- package/dist/{chunk-er6rhs42.js.map → chunk-xyv3y476.js.map} +1 -1
- package/dist/{chunk-c80xrwep.js → chunk-yedb5vvg.js} +2 -2
- package/dist/{chunk-m4nn6ne9.js.map → chunk-yedb5vvg.js.map} +1 -1
- package/dist/{chunk-2v7stsgt.js → chunk-ykshxc5k.js} +2 -2
- package/dist/{chunk-2v7stsgt.js.map → chunk-ykshxc5k.js.map} +1 -1
- package/dist/{chunk-cgjdxxwy.js → chunk-yxtfg4wy.js} +2 -2
- package/dist/{chunk-cgjdxxwy.js.map → chunk-yxtfg4wy.js.map} +1 -1
- package/dist/{chunk-18aw52vs.js → chunk-zy6hj5cc.js} +2 -2
- package/dist/{chunk-18aw52vs.js.map → chunk-zy6hj5cc.js.map} +1 -1
- package/dist/{chunk-fdbh87nv.js → chunk-zyvmbqcx.js} +3 -3
- package/dist/{chunk-fdbh87nv.js.map → chunk-zyvmbqcx.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/ApiRouter.d.ts +1 -1
- package/dist/http/ApiRouter.d.ts.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 +1 -1
- package/package.json +1 -1
- package/dist/chunk-3ejv7fs4.js +0 -11
- package/dist/chunk-at5ce580.js.map +0 -27
- package/dist/chunk-g4esp7z5.js +0 -5
- package/dist/chunk-y10tys3s.js +0 -5
- package/dist/chunk-y10tys3s.js.map +0 -13
- /package/dist/{chunk-ge201pk4.js.map → chunk-ee7xb9qr.js.map} +0 -0
- /package/dist/{chunk-3vnb6xhz.js.map → chunk-h6knw9f0.js.map} +0 -0
- /package/dist/{chunk-wee3yrdn.js.map → chunk-kggwk7hz.js.map} +0 -0
- /package/dist/{chunk-fw7sxgse.js.map → chunk-nhebjh6n.js.map} +0 -0
- /package/dist/{chunk-1a0ehbkm.js.map → chunk-ppdfwnqw.js.map} +0 -0
- /package/dist/{chunk-vz2dt9f3.js.map → chunk-v0sgcy87.js.map} +0 -0
|
@@ -74,6 +74,7 @@ export declare class RecordingProvider implements AgentProvider {
|
|
|
74
74
|
spent(): Usage;
|
|
75
75
|
stream(params: ProviderStreamParams): ProviderStream;
|
|
76
76
|
upload(file: File): Promise<string>;
|
|
77
|
+
deleteFile(fileId: string): Promise<void>;
|
|
77
78
|
normalizeError(error: unknown): import("../types").AgentError;
|
|
78
79
|
}
|
|
79
80
|
export type LiveTarget = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../../ai/live/harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtE;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,QAAyC,CAAC;AACjE,eAAO,MAAM,qBAAqB,QAC8C,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,yFAItB,CAAC;AAEX,eAAO,MAAM,gBAAgB,SAAsC,CAAC;AACpE,eAAO,MAAM,eAAe,SAEoC,CAAC;AAEjE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IAWnD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAXlC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IACrD,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAM;IAC/C;;yEAEqE;IACrE,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,CAAM;gBAGnB,KAAK,EAAE,aAAa,EACpB,eAAe,EAAE,MAAM;IAM1C,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;;;;;;OASG;IACH,KAAK,IAAI,KAAK;IAkBd,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG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EF,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,CAAC,OAAO,CAAC,YACC,CAAC;AAI1D,eAAO,MAAM,MAAM,GAAI,SAAS,YAAY,GAAG,SAAS,KAAG,MAI9C,CAAC;AAEd,eAAO,MAAM,OAAO,GAAI,UAAU,YAAY,EAAE,EAAE,MAAM,MAAM,KAAG,GAAG,EAC0B,CAAC;AAE/F,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,OAAO,CAAC,EAAE,KAAG,CAA4B,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,cAAc,GAAI,UAAU,YAAY,EAAE,WAAoC,CAAC;AAE5F;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,WACG,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE;IAAE,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAA;CAAE;;;;EAU5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropicStream.d.ts","sourceRoot":"","sources":["../../../ai/providers/anthropicStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAgB,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropicStream.d.ts","sourceRoot":"","sources":["../../../ai/providers/anthropicStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAgB,KAAK,EAAE,MAAM,UAAU,CAAC;AAIhE;;;;;;;;;;;;;;;;;GAiBG;AAEH,KAAK,YAAY,GAAG;IAClB,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAIF,wBAAuB,mBAAmB,CACxC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EAChD,OAAO,GAAE,YAAiB,GACzB,cAAc,CAAC,aAAa,CAAC,CA0K/B;AAyCD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAqBzD;AAED,KAAK,QAAQ,GAAG;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAmBF;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,GAAG,KAAK,CAWjE"}
|
|
@@ -137,4 +137,14 @@ export type UploadPurpose = "user_data" | "assistants";
|
|
|
137
137
|
export declare function uploadFile(endpoint: ResponsesEndpoint, file: File,
|
|
138
138
|
/** `null` for Anthropic's Files API, which takes no purpose. */
|
|
139
139
|
purpose?: UploadPurpose | null): Promise<string>;
|
|
140
|
+
/**
|
|
141
|
+
* Deletes a file `uploadFile` sent (#1165): `DELETE {base}/files/{id}{query}`,
|
|
142
|
+
* with the same resolved host, headers and api-version as the upload, so the
|
|
143
|
+
* URL is built from `filesUrl` rather than worked out again.
|
|
144
|
+
*
|
|
145
|
+
* A 404 resolves: the file is already gone (deleted earlier, expired at the
|
|
146
|
+
* vendor, or a retried delete whose first answer was lost), which is the state
|
|
147
|
+
* the caller asked for.
|
|
148
|
+
*/
|
|
149
|
+
export declare function deleteFile(endpoint: ResponsesEndpoint, fileId: string): Promise<void>;
|
|
140
150
|
//# sourceMappingURL=call.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../../ai/providers/call.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../../ai/providers/call.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAUlD,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,cAAc,EAGnB,KAAK,mBAAmB,EACzB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAIlD;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB;2DACuD;IACvD,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;wDACoD;IACpD,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAY3E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAuB,eAAe,CAAC,IAAI,SAAS,MAAM,GAAG,gBAAgB,EAC3E,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE;IACN,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4DAA4D;IAC5D,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;2EAEuE;IACvE,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,CACN,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAC7B,OAAO,EAAE;QAAE,gBAAgB,EAAE,OAAO,CAAA;KAAE,KACnC,aAAa,CAAC,aAAa,CAAC,CAAC;CACnC,GACA,cAAc,CAAC,aAAa,CAAC,CA8P/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC;AAEvD;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,IAAI;AACV,gEAAgE;AAChE,OAAO,GAAE,aAAa,GAAG,IAAkB,GAC1C,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB3F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentError, ToolArgumentsTooLong } from "../types";
|
|
1
|
+
import type { AgentError, ProviderErrorDetail, ToolArgumentsTooLong } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* A non-2xx response, carried as an exception so the retry loop and
|
|
4
4
|
* `normalizeError` can both read it.
|
|
@@ -56,17 +56,25 @@ export declare class ProviderToolArgumentsTooLongError extends Error {
|
|
|
56
56
|
constructor(limit: number, toolName: string, toolCallId?: string, chars?: number);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* The HTTP status
|
|
60
|
-
* thrown — server-side detail for
|
|
59
|
+
* The HTTP status, request id and error body detail of a provider failure,
|
|
60
|
+
* read off what was thrown or off an `error` event — server-side detail for
|
|
61
|
+
* `AgentRunResult.error`, never for a frame.
|
|
61
62
|
*
|
|
62
63
|
* By shape rather than by `instanceof ProviderHttpError`, so a custom provider
|
|
63
64
|
* whose SDK throws its own error class with a `status` gets the same detail.
|
|
64
65
|
* A `status` outside 100–599 is not an HTTP status and is ignored.
|
|
66
|
+
*
|
|
67
|
+
* `providerType`, `providerCode` and `providerParam` (#1302) are taken as set
|
|
68
|
+
* on the object (an `error` event carries them that way), and otherwise read
|
|
69
|
+
* from a `body` in the provider's error shape, as `ProviderHttpError` has.
|
|
70
|
+
*/
|
|
71
|
+
export declare function httpErrorDetail(error: unknown): ProviderErrorDetail;
|
|
72
|
+
/**
|
|
73
|
+
* The `type`, `code` and `param` of a provider's error object: a response
|
|
74
|
+
* body, or one it streamed (Anthropic's `error` frame, the Responses API's
|
|
75
|
+
* `response.failed`), for the `error` event that reports it.
|
|
65
76
|
*/
|
|
66
|
-
export declare function
|
|
67
|
-
status?: number;
|
|
68
|
-
requestId?: string;
|
|
69
|
-
};
|
|
77
|
+
export declare function streamErrorDetail(raw: unknown): ProviderErrorDetail;
|
|
70
78
|
/**
|
|
71
79
|
* Provider failures onto `AgentErrorCode`.
|
|
72
80
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../ai/providers/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,o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gB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,CAUnE;AAMD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CA4BjE;AA0DD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKzE"}
|
|
@@ -34,6 +34,9 @@ export declare class FakeProvider {
|
|
|
34
34
|
*/
|
|
35
35
|
readonly uploads: File[];
|
|
36
36
|
upload(file: File): Promise<string>;
|
|
37
|
+
/** Every `deleteFile`, in order. */
|
|
38
|
+
readonly deletedFiles: string[];
|
|
39
|
+
deleteFile(fileId: string): Promise<void>;
|
|
37
40
|
normalizeError(error: unknown): {
|
|
38
41
|
code: "provider_error";
|
|
39
42
|
message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fakeProvider.d.ts","sourceRoot":"","sources":["../../../ai/providers/fakeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE3F;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IAWX,OAAO,CAAC,OAAO;IAV3B,QAAQ,CAAC,KAAK,UAAU;IACxB,QAAQ,CAAC,YAAY;;;;;;MAMnB;IACF,QAAQ,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAM;gBAExB,OAAO,EAAE,aAAa,EAAE,EAAE;IAE9C,MAAM,CAAC,MAAM,EAAE,oBAAoB;IAcnC;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,CAAM;IAExB,MAAM,CAAC,IAAI,EAAE,IAAI;IAKvB,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;CAO9B;AAED,wBAAgB,YAAY,CAAC,GAAG,OAAO,EAAE,aAAa,EAAE,EAAE,GACT,aAAa,GAAG,YAAY,CAC5E;AAED;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AAE,CAAM;IAE/B,UAAU,CAAC,MAAM,EAAE,MAAM;IAI/B,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;CAO9B;AAED,wBAAgB,YAAY,CAAC,GAAG,OAAO,EAAE,aAAa,EAAE,EAAE,GACT,aAAa,GAAG,YAAY,CAC5E;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAKhB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJlC,QAAQ,CAAC,KAAK,gBAAgB;IAC9B,QAAQ,CAAC,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAM;IAC7D,QAAQ,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,EAAE,CAAM;gBAE7C,KAAK,SAAkB;IAEpD,OAAO,CAAC,MAAM;IAeR,QAAQ,CAAC,MAAM,EAAE,GAAG;;;;;;;;;;;;IAKpB,IAAI,CAAC,MAAM,EAAE,GAAG;;;;;;;;;;;;IAStB,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;CAO9B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,GACI,GAAG,CACtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../ai/providers/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAgB,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../ai/providers/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAgB,KAAK,EAAE,MAAM,UAAU,CAAC;AAGpD;;;;;;;GAOG;AAEH,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE;;;;;;;;;GASG;AACH,wBAAuB,WAAW,CAChC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,GAC/C,cAAc,CAAC,UAAU,CAAC,CAwD5B;AAED,KAAK,YAAY,GAAG;IAClB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAIF,wBAAuB,oBAAoB,CACzC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EAChD,OAAO,GAAE,YAAiB,GACzB,cAAc,CAAC,aAAa,CAAC,CAqR/B;AA+HD,wBAAgB,UAAU,IAAI,KAAK,CAElC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAcvC;AAED;6DAC6D;AAC7D,wBAAuB,YAAY,CACjC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,GACtC,cAAc,CAAC,MAAM,CAAC,CAiBxB"}
|
package/dist/ai/redact.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentError } from "./types";
|
|
1
|
+
import type { AgentError, ProviderErrorDetail } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* A tool failure whose message is meant to be read: by the model, which can
|
|
4
4
|
* act on it, and by the client, which shows it.
|
|
@@ -26,16 +26,14 @@ export declare class ToolError extends Error {
|
|
|
26
26
|
*
|
|
27
27
|
* - `run`: the run's own failure, on its `error` frame. `failure` is what
|
|
28
28
|
* `result().error` returns: the provider's own message, its HTTP status and
|
|
29
|
-
* request id
|
|
29
|
+
* request id, and its error `providerType` / `providerCode` /
|
|
30
|
+
* `providerParam` (#1302).
|
|
30
31
|
* - `tool`: a tool threw. `cause` is what it threw; the result the model and
|
|
31
32
|
* the client read is the redacted one.
|
|
32
33
|
*/
|
|
33
34
|
export type ErrorRedactionInfo = {
|
|
34
35
|
source: "run";
|
|
35
|
-
failure: AgentError &
|
|
36
|
-
status?: number;
|
|
37
|
-
requestId?: string;
|
|
38
|
-
};
|
|
36
|
+
failure: AgentError & ProviderErrorDetail;
|
|
39
37
|
} | {
|
|
40
38
|
source: "tool";
|
|
41
39
|
toolName: string;
|
package/dist/ai/redact.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../ai/redact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../ai/redact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE/E;;;;;;;;;;;;;GAaG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;gBAEhB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO;CAKpF;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACE,MAAM,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,UAAU,GAAG,mBAAmB,CAAC;CAC3C,GACD;IACE,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEN;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,kBAAkB,KAAK,UAAU,CAAC;AAmBxF;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,kBAAkB,GAAG,UAAU,CAUnF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,GAAG,SAAS,EACnC,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,GAChC,UAAU,CAcZ;AAUD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI,CAEnF;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAE7D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolError } from "../redact";
|
|
2
|
-
import type { PutFileParams, ReadFileParams, ReadResult } from "../../services/file-storage/drivers/types";
|
|
2
|
+
import type { DeleteFileParams, PutFileParams, ReadFileParams, ReadResult } from "../../services/file-storage/drivers/types";
|
|
3
3
|
import type { Usage } from "../types";
|
|
4
4
|
/**
|
|
5
5
|
* The bytes of an upload, kept by gemi, and the scope that says whose they are.
|
|
@@ -108,6 +108,37 @@ export type Attachment = {
|
|
|
108
108
|
size: number;
|
|
109
109
|
createdAt: string;
|
|
110
110
|
destination: AttachmentDestination;
|
|
111
|
+
/**
|
|
112
|
+
* When this attachment stops resolving and `AgentController.sweepAttachments`
|
|
113
|
+
* may delete it (#1307). Absent for an attachment that is kept, which is
|
|
114
|
+
* every attachment unless `attachmentRetention` answers otherwise.
|
|
115
|
+
*/
|
|
116
|
+
expiresAt?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Deleted, with its provider copy, once the turn that names it (or, for a
|
|
119
|
+
* tool's output, the turn that made it) has completed. Set by
|
|
120
|
+
* `attachmentRetention` answering `"turn"`; `expiresAt` is then the
|
|
121
|
+
* fallback for a turn that never comes.
|
|
122
|
+
*/
|
|
123
|
+
deleteAfterTurn?: boolean;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* How long a turn's uploads and tool-made attachments live (#1307). What
|
|
127
|
+
* `AgentController.attachmentRetention` answers; `null` keeps them.
|
|
128
|
+
*
|
|
129
|
+
* - `"turn"`: deleted from storage and from the provider once the turn has
|
|
130
|
+
* completed (after `onStreamComplete`). An upload no turn names is deleted by
|
|
131
|
+
* the sweep after `AgentController.turnAttachmentMaxAgeMs`.
|
|
132
|
+
* - `{ ttlMs }`: kept for that long, then no longer resolves and is deleted by
|
|
133
|
+
* `AgentController.sweepAttachments()`.
|
|
134
|
+
*/
|
|
135
|
+
export type AttachmentRetention = "turn" | {
|
|
136
|
+
ttlMs: number;
|
|
137
|
+
};
|
|
138
|
+
/** The fields a short-lived attachment carries. See `Attachment.expiresAt`. */
|
|
139
|
+
export type AttachmentLifetime = {
|
|
140
|
+
expiresAt: string;
|
|
141
|
+
deleteAfterTurn?: boolean;
|
|
111
142
|
};
|
|
112
143
|
/**
|
|
113
144
|
* Where attachment *records* live. The bytes are in `AttachmentStorage`; this
|
|
@@ -136,6 +167,20 @@ export interface AttachmentStore {
|
|
|
136
167
|
* `AttachmentNotFoundError`.
|
|
137
168
|
*/
|
|
138
169
|
find(scope: AttachmentScope, id: string): Promise<Attachment | null>;
|
|
170
|
+
/**
|
|
171
|
+
* Removes the record (#1307). Optional, so a store written before this keeps
|
|
172
|
+
* compiling; short-lived attachments (`attachmentRetention`) need it, and
|
|
173
|
+
* without it their records outlive their bytes. Scoped like `find`: the
|
|
174
|
+
* clause is `WHERE id = ? AND scope_key = ?`.
|
|
175
|
+
*/
|
|
176
|
+
delete?(scope: AttachmentScope, id: string): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Up to `limit` records whose `expiresAt` is at or before `now`, across every
|
|
179
|
+
* scope (#1307). Only `AgentController.sweepAttachments` calls it, with no
|
|
180
|
+
* model or request anywhere near it; it is the one unscoped read, and it
|
|
181
|
+
* exists to delete. Index `expires_at`.
|
|
182
|
+
*/
|
|
183
|
+
expired?(now: Date, limit: number): Promise<Attachment[]>;
|
|
139
184
|
}
|
|
140
185
|
/**
|
|
141
186
|
* The bytes half: whatever the app's file storage is.
|
|
@@ -148,6 +193,8 @@ export interface AttachmentStore {
|
|
|
148
193
|
export interface AttachmentStorage {
|
|
149
194
|
put(params: PutFileParams | Blob): Promise<string>;
|
|
150
195
|
read(params: ReadFileParams | string): Promise<ReadResult>;
|
|
196
|
+
/** Needed for short-lived attachments (#1307). The `Storage` facade has it. */
|
|
197
|
+
delete?(params: DeleteFileParams | string): Promise<void>;
|
|
151
198
|
}
|
|
152
199
|
/**
|
|
153
200
|
* What both a missing id and someone else's id answer.
|
|
@@ -193,7 +240,15 @@ export declare class ScopedAttachments {
|
|
|
193
240
|
private readonly store;
|
|
194
241
|
private readonly storage;
|
|
195
242
|
private readonly scope;
|
|
196
|
-
|
|
243
|
+
private readonly lifetime;
|
|
244
|
+
constructor(store: AttachmentStore, storage: AttachmentStorage, scope: AttachmentScope, lifetime?: ScopedLifetime | null);
|
|
245
|
+
/**
|
|
246
|
+
* The same scope, with every `put` made short-lived (#1307): each record
|
|
247
|
+
* gets `lifetime.next()`'s fields and is handed to `lifetime.onPut`, which is
|
|
248
|
+
* how a turn collects what its tools made so it can delete them. Reads are
|
|
249
|
+
* unchanged.
|
|
250
|
+
*/
|
|
251
|
+
withLifetime(lifetime: ScopedLifetime): ScopedAttachments;
|
|
197
252
|
/**
|
|
198
253
|
* The scope's key. Read by `ctx.jobs.start` (#461), which records it on the
|
|
199
254
|
* job so a background job gets the same attachments its tool had. Only the
|
|
@@ -290,6 +345,45 @@ export declare class ScopedAttachments {
|
|
|
290
345
|
fileId?: string;
|
|
291
346
|
}): Promise<Attachment>;
|
|
292
347
|
}
|
|
348
|
+
/** What `ScopedAttachments.withLifetime` takes. */
|
|
349
|
+
export type ScopedLifetime = {
|
|
350
|
+
/** The lifetime fields for a record stored now. */
|
|
351
|
+
next(): AttachmentLifetime;
|
|
352
|
+
/** Told about each record stored. */
|
|
353
|
+
onPut?(attachment: Attachment): void;
|
|
354
|
+
};
|
|
355
|
+
/** Whether `attachment` has passed its `expiresAt`. */
|
|
356
|
+
export declare function isExpired(attachment: {
|
|
357
|
+
expiresAt?: string;
|
|
358
|
+
}, now: number): boolean;
|
|
359
|
+
/**
|
|
360
|
+
* The lifetime fields for something stored now under `retention`, or `null`
|
|
361
|
+
* for one that is kept. `turnMaxAgeMs` is how long a `"turn"` attachment may
|
|
362
|
+
* wait for a turn to delete it before the sweep does.
|
|
363
|
+
*/
|
|
364
|
+
export declare function attachmentLifetime(retention: AttachmentRetention | null | undefined, turnMaxAgeMs: number, now?: number): AttachmentLifetime | null;
|
|
365
|
+
/** What `deleteAttachment` deletes from. */
|
|
366
|
+
export type AttachmentDeletionTargets = {
|
|
367
|
+
store: AttachmentStore;
|
|
368
|
+
storage: AttachmentStorage;
|
|
369
|
+
/** The provider the file was uploaded to, for `fileId`. */
|
|
370
|
+
provider?: {
|
|
371
|
+
deleteFile?(fileId: string): Promise<void>;
|
|
372
|
+
};
|
|
373
|
+
/** Forgets the provider file's owner record once it is deleted. */
|
|
374
|
+
fileOwners?: {
|
|
375
|
+
delete?(fileId: string): Promise<void>;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Deletes every copy of one attachment (#1307): the stored bytes, then the
|
|
380
|
+
* provider's file, then the record. In that order so a failure leaves the
|
|
381
|
+
* record behind, and the sweep (or the next attempt) finds it and tries again.
|
|
382
|
+
* Throws on the first copy it cannot delete, including when `storage` or the
|
|
383
|
+
* provider has no way to delete at all: a privacy deletion that skips a copy
|
|
384
|
+
* must not look like one that succeeded.
|
|
385
|
+
*/
|
|
386
|
+
export declare function deleteAttachment(attachment: Attachment, targets: AttachmentDeletionTargets): Promise<void>;
|
|
293
387
|
/**
|
|
294
388
|
* What a tool asks for when it parks bytes.
|
|
295
389
|
*
|
|
@@ -477,6 +571,8 @@ export declare class MemoryAttachmentStore implements AttachmentStore {
|
|
|
477
571
|
private readonly rows;
|
|
478
572
|
put(scope: AttachmentScope, attachment: Attachment): Promise<void>;
|
|
479
573
|
find(scope: AttachmentScope, id: string): Promise<Attachment | null>;
|
|
574
|
+
delete(scope: AttachmentScope, id: string): Promise<void>;
|
|
575
|
+
expired(now: Date, limit: number): Promise<Attachment[]>;
|
|
480
576
|
/** Test and dev affordance: how many rows are held, across every scope. */
|
|
481
577
|
get size(): number;
|
|
482
578
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Attachments.d.ts","sourceRoot":"","sources":["../../../ai/store/Attachments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;;;;;;;;;OAUG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EA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,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAYpE,MAAM,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzD,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAS9D,2EAA2E;IAC3E,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,uBAA8B,CAAC"}
|
|
@@ -23,6 +23,14 @@ export type FileOwnerRecord = {
|
|
|
23
23
|
mimeType?: string;
|
|
24
24
|
size?: number;
|
|
25
25
|
createdAt: string;
|
|
26
|
+
/**
|
|
27
|
+
* For a short-lived upload that went to the provider alone (#1307): when
|
|
28
|
+
* `AgentController.sweepAttachments` deletes the provider's file. An upload
|
|
29
|
+
* gemi also stored carries this on its attachment record instead.
|
|
30
|
+
*/
|
|
31
|
+
expiresAt?: string;
|
|
32
|
+
/** Deleted once the turn that names it has completed. See `Attachment.deleteAfterTurn`. */
|
|
33
|
+
deleteAfterTurn?: boolean;
|
|
26
34
|
};
|
|
27
35
|
/**
|
|
28
36
|
* Where the records live. Two methods so an app can put them in its own table:
|
|
@@ -38,6 +46,14 @@ export type FileOwnerRecord = {
|
|
|
38
46
|
export interface FileOwners {
|
|
39
47
|
record(fileId: string, record: FileOwnerRecord): Promise<void>;
|
|
40
48
|
get(fileId: string): Promise<FileOwnerRecord | null>;
|
|
49
|
+
/** Forgets an id whose file was deleted (#1307). Optional. */
|
|
50
|
+
delete?(fileId: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Up to `limit` ids whose record's `expiresAt` is at or before `now` (#1307).
|
|
53
|
+
* Optional; without it `sweepAttachments` cannot find short-lived
|
|
54
|
+
* provider-only uploads that no turn deleted.
|
|
55
|
+
*/
|
|
56
|
+
expired?(now: Date, limit: number): Promise<string[]>;
|
|
41
57
|
}
|
|
42
58
|
/**
|
|
43
59
|
* The default: records last as long as the process, like `MemoryAgentStore`
|
|
@@ -54,6 +70,8 @@ export declare class MemoryFileOwners implements FileOwners {
|
|
|
54
70
|
constructor(maxEntries?: number);
|
|
55
71
|
record(fileId: string, record: FileOwnerRecord): Promise<void>;
|
|
56
72
|
get(fileId: string): Promise<FileOwnerRecord | null>;
|
|
73
|
+
delete(fileId: string): Promise<void>;
|
|
74
|
+
expired(now: Date, limit: number): Promise<string[]>;
|
|
57
75
|
}
|
|
58
76
|
export declare const defaultFileOwners: MemoryFileOwners;
|
|
59
77
|
//# sourceMappingURL=FileOwners.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileOwners.d.ts","sourceRoot":"","sources":["../../../ai/store/FileOwners.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,+EAA+E;IAC/E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"FileOwners.d.ts","sourceRoot":"","sources":["../../../ai/store/FileOwners.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,+EAA+E;IAC/E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACrD,8DAA8D;IAC9D,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC;;;;OAIG;IACH,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACvD;AAED;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,YAAW,UAAU;IAGrC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;gBAEjC,UAAU,SAAU;IAE3C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9D,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAKpD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrC,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAQ3D;AAED,eAAO,MAAM,iBAAiB,kBAAyB,CAAC"}
|
package/dist/ai/store/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type Attachment, ATTACHMENT_ID_PREFIX, type AttachmentDestination, attachmentObjectName, AttachmentNotFoundError, type AttachmentScope, type AttachmentStorage, type AttachmentStore, defaultAttachmentStore, InvalidAttachmentScopeError, MemoryAttachmentStore, newAttachmentId, type PutAttachmentParams, ScopedAttachments, type ToolAttachmentPut, type ToolAttachmentRecord, type ToolAttachments, } from "./Attachments";
|
|
1
|
+
export { type Attachment, ATTACHMENT_ID_PREFIX, type AttachmentDestination, attachmentObjectName, type AttachmentRetention, AttachmentNotFoundError, type AttachmentScope, type AttachmentStorage, type AttachmentStore, defaultAttachmentStore, InvalidAttachmentScopeError, MemoryAttachmentStore, newAttachmentId, type PutAttachmentParams, ScopedAttachments, type ToolAttachmentPut, type ToolAttachmentRecord, type ToolAttachments, } from "./Attachments";
|
|
2
2
|
export { defaultFileOwners, type FileOwnerRecord, type FileOwners, MemoryFileOwners, } from "./FileOwners";
|
|
3
3
|
export { defaultAgentStore, MemoryAgentStore } from "./MemoryAgentStore";
|
|
4
4
|
export { defaultNonceStore, MemoryNonceStore, type NonceModel, type NonceRedisClient, type NonceStore, PrismaNonceStore, type PrismaNonceStoreOptions, RedisNonceStore, type RedisNonceStoreOptions, } from "./Nonces";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ai/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,eAAe,EACf,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ai/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,eAAe,EACf,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -228,6 +228,8 @@ export declare class RecordingProvider extends AgentProvider {
|
|
|
228
228
|
*/
|
|
229
229
|
pin(now: number): Promise<number>;
|
|
230
230
|
upload(file: File): Promise<string>;
|
|
231
|
+
/** Deletes the live copy of a recorded upload; a replay has nothing to delete. */
|
|
232
|
+
deleteFile(fileId: string): Promise<void>;
|
|
231
233
|
normalizeError(error: unknown): import("..").AgentError;
|
|
232
234
|
stream(params: ProviderStreamParams): AsyncGenerator<ProviderEvent>;
|
|
233
235
|
private recordCall;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordingProvider.d.ts","sourceRoot":"","sources":["../../../ai/testing/RecordingProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAE1B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,kBAAkB,EAAE,YAAY,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEnG;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,2FAA2F;IAC3F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,KAAK,CA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,IAAI,CAAC;IAWxD,cAAc,CAAC,KAAK,EAAE,OAAO;IAItB,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAAC,aAAa,CAAC;YAW3D,UAAU;YA2DV,UAAU;IAkCzB,OAAO,CAAC,KAAK;IAIb,yEAAyE;IACzE,OAAO,CAAC,SAAS,CAAK;IAEtB;;;OAGG;IACH,OAAO,CAAC,SAAS;IAiDjB;;;;OAIG;IACH,OAAO,CAAC,OAAO;IAiBf;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAwIhB,wFAAwF;YAC1E,IAAI;IAuBlB,kEAAkE;YACpD,KAAK;CAiBpB"}
|
package/dist/ai/testing/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{la as g}from"../../chunk-
|
|
2
|
+
import{la as g}from"../../chunk-7081awrd.js";import"../../chunk-bcfwa370.js";import{Zj as v,_j as m}from"../../chunk-ww62b10k.js";import"../../chunk-yedb5vvg.js";import{createHash as s}from"crypto";import{createHash as S}from"crypto";import{existsSync as h,readdirSync as c,readFileSync as l,statSync as p}from"fs";import{join as q,relative as d,sep as i}from"path";var P="\u241F",F=6,n=/\{\{>\s*([^}\s]+)\s*\}\}/g,b=(D)=>D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function R(D){let $=D.filter((B)=>B.length>=F),z=D.filter((B)=>B.length<F);return(B)=>{let C=B;for(let G of $)if(C.includes(G))C=C.split(G).join(P);for(let G of z)C=C.replace(new RegExp(`${b(G)}\\s*${P}`,"g"),P).replace(new RegExp(`${P}\\s*${b(G)}`,"g"),P);return C.replace(new RegExp(`\\s*${P}[\\s${P}]*`,"g"),P)}}function y(D,$=[]){for(let z of c(D)){if(z==="node_modules")continue;let B=q(D,z);if(p(B).isDirectory())y(B,$);else if(z.endsWith(".md"))$.push(B)}return $}class W{data;root;options;constructor(D,$={}){this.data=D;this.options=$,this.root=$.root??process.cwd()}static blob(D){return S("sha1").update(`blob ${Buffer.byteLength(D)}\x00`).update(D).digest("hex")}static pieces(D){return D.split(/\{\{[^}]*\}\}/).map(($)=>$.trim()).filter(($)=>$.length>0)}static tool(D){return S("sha256").update(JSON.stringify({description:D.description,parameters:D.parameters})).digest("hex")}static prompts(D={}){let $=D.root??process.cwd(),z=new Map;for(let B of D.dirs??["app/agents"]){if(!h(q($,B)))continue;for(let C of y(q($,B)).sort())z.set(d($,C).split(i).join("/"),l(C,"utf8"))}return z}static of(D,$,z={}){let B=[...D].join(`
|
|
3
3
|
\x00
|
|
4
|
-
`),C={};for(let[Y,Q]of L.prompts(z))if(L.pieces(Q).filter((Z)=>Z.length>=12).sort((Z,K)=>K.length-Z.length).slice(0,3).some((Z)=>B.includes(Z)))C[Y]=L.blob(Q);let G=[...$.keys()].sort(),X=z.inputs?.(new Set(G));return new L({prompts:C,tools:Object.fromEntries(G.map((Y)=>[Y,[...$.get(Y)].sort()])),...X&&Object.keys(X).length>0?{inputs:a(X)}:{}},z)}same(D){let $=D instanceof L?D.data:D;return JSON.stringify(this.data)===JSON.stringify($)}changed(){let D=this.options.inputs?.(new Set(Object.keys(this.data.tools)))??{};return[...this.changedPrompts().map(([$])=>$),...Object.entries(this.data.inputs??{}).filter(([$,z])=>D[$]!==z).map(([$])=>`input ${$}`)]}cutters(){let D=L.prompts(this.options),$=this.changedPrompts(),z=new Map,B=new Map;for(let[C,G]of $){let X=this.readBlob(G);if(X===void 0)throw Error(`${C} changed since the recording, and the version it was recorded with (${G}) can't be read back from git`);if(z.set(C,X),D.has(C))B.set(C,D.get(C))}return{changed:$.map(([C])=>C),recorded:R(this.piecesWithPartials(z,(C)=>{let G=this.data.prompts[C];return G&&this.readBlob(G)||D.get(C)})),sent:R(this.piecesWithPartials(B,(C)=>D.get(C)))}}changedPrompts(){let D=L.prompts(this.options);return Object.entries(this.data.prompts).filter(([$,z])=>{let B=D.get($);return B===void 0||L.blob(B)!==z})}readBlob(D){if(this.options.readBlob)return this.options.readBlob(D);let $=Bun.spawnSync(["git","cat-file","blob",D],{cwd:this.root});return $.exitCode===0?$.stdout.toString():void 0}piecesWithPartials(D,$){let z=this.options.dirs??["app/agents"],B=this.options.shared??"prompts",C=[...D];while(C.length>0){let[G,X]=C.pop(),Y=z.find((Q)=>G.startsWith(`${Q}/`));if(Y===void 0)continue;for(let[,Q]of X.matchAll(n)){let V=`${Y}/${Q.includes("/")?Q:`${B}/${Q}`}.md`,Z=D.has(V)?void 0:$(V);if(Z===void 0)continue;D.set(V,Z),C.push([V,Z])}}return[...D.values()].flatMap((G)=>L.pieces(G)).sort((G,X)=>X.length-G.length)}}function a(D){return Object.fromEntries(Object.entries(D).sort(([$],[z])=>$.localeCompare(z)))}class N extends Error{constructor(D){super(`${D} Record again.`);this.name="RecordingMismatchError"}}var o=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;function T(D,$){if(typeof D==="string")return $(D);if(Array.isArray(D))return D.map((z)=>T(z,$));if(D&&typeof D==="object")return Object.fromEntries(Object.entries(D).map(([z,B])=>[z,T(B,$)]));return D}function f(D){return JSON.parse(JSON.stringify(D,function($,z){if($==="nested")return;if($==="output"&&this.type==="tool-result"&&"modelOutput"in this)return;return z}))}function u(){let D;return{promise:new Promise((z)=>D=z),resolve:D}}var r=(D)=>s("sha256").update(D).digest("hex"),E=(D)=>D.flatMap(($)=>("tools"in $)?$.tools:[$]);function x(D){return D.map(({role:$,content:z})=>({role:$,parts:(Array.isArray(z)?z:[]).flatMap((B)=>{if(B?.type==="tool-call")return[{call:B.name,input:B.input??B.args}];if(B?.type==="tool-result")return[{result:B.name,status:B.status}];if(B?.type==="file")return[{file:!0}];return[]})}))}class M extends g{live;model;capabilities;recordedAt;calls;recordedNested;children=new Map;parent;key;sent=[];uploads;uploadCount=0;read;shared;options;texts=new Set;toolHashes=new Map;toolLists=new Set;recorded;cuts;constructor(D,$,z,B){super();this.live=D;if(this.options={...z,match:z.match??"wording",ids:new RegExp(z.ids??o,"g"),waitMs:z.waitMs??60000},B){let{parent:C}=B;this.parent=C,this.key=B.key,this.model=C.model,this.capabilities=C.capabilities,this.recordedAt=C.recordedAt,this.calls=B.calls,this.recordedNested={},this.uploads=C.uploads,this.shared=C.shared;return}if(this.shared={ids:new Map,stale:new Set,staleCalls:0,started:0,moved:u()},this.uploads=new Map,D){this.model=D.model,this.capabilities=D.capabilities,this.recordedAt=new Date,this.calls=[],this.recordedNested={};return}if(!$||$.version!==1||!Array.isArray($.calls))throw Error("RecordingProvider.replay needs a recording made by RecordingProvider.");if(this.model=$.model,this.capabilities=$.capabilities,this.recordedAt=new Date($.recordedAt),this.calls=structuredClone($.calls),this.recordedNested=structuredClone($.nested??{}),$.fingerprints)this.recorded=new L($.fingerprints,z.fingerprints)}static record(D,$={}){return new M(D,void 0,$)}static replay(D,$={}){return new M(void 0,D,$)}get isRecording(){return this.live!==void 0}get stale(){return this.shared.stale}get staleCalls(){return this.shared.staleCalls}nested(D){if(this.parent)return this.parent.nested(D);let $=this.children.get(D);if(!$){let z=this.recordedNested[D];if(!this.live&&!z)throw new N(`The recording has no sub-run "${D}".`);$=new M(this.live,void 0,this.options,{parent:this,key:D,calls:z??[]}),this.children.set(D,$)}return $}recording(){if(this.parent)return this.parent.recording();if(!this.live)throw Error("Only a recording provider (`record`) has a recording to save.");return{version:1,model:this.model,capabilities:this.capabilities,recordedAt:this.recordedAt.toISOString(),calls:structuredClone(this.calls),...this.options.fingerprints?{fingerprints:this.fingerprints().data}:{},...this.children.size>0?{nested:Object.fromEntries([...this.children].map(([D,$])=>[D,structuredClone($.calls)]))}:{}}}fingerprints(){let D=this.parent??this;return L.of(D.texts,D.toolHashes,this.options.fingerprints)}static changedSince(D,$={}){return D.fingerprints?new L(D.fingerprints,$).changed():[]}replayedInFull(){let D=this.parent??this;return D.calls.length===0&&Object.entries(D.recordedNested).every(([$,z])=>(D.children.get($)?.calls??z).length===0)}async pin(D){if(this.live)return this.read=D,D;let $=this.calls[0]?.read;if($===void 0)return D;return await(this.parent??this).reach($,this.where()),$}async upload(D){let $=++this.uploadCount,z=this.key===void 0?`upload_${$}`:`upload_${this.key}_${$}`;if(this.live)this.uploads.set(z,await this.live.upload(D));return z}normalizeError(D){return this.live?this.live.normalizeError(D):super.normalizeError(D)}async*stream(D){let $=this.requestOf(D);if(this.live){yield*this.recordCall(D,$);return}yield*this.replayCall(D,$)}async*recordCall(D,$){let z=this.parent??this,B=z.shared.started++,C=this.read;this.read=void 0;let G=[],X=D.messages.map((Q)=>({...Q,content:Q.content.map((V)=>V.type==="file"&&V.fileId&&this.uploads.has(V.fileId)?{...V,fileId:this.uploads.get(V.fileId)}:V)}));for await(let Q of this.live.stream({...D,messages:X})){let V=G.at(-1);if(Q.type==="tool-call-discard"){let Z=new Set(Q.toolCallIds),K=G.filter((H)=>H.type!=="tool-call-delta"||!Z.has(H.toolCallId));G.splice(0,G.length,...K)}else if(Q.type==="retry");else if(V&&(Q.type==="text-delta"||Q.type==="output-delta")&&V.type===Q.type)V.delta+=Q.delta;else if(V?.type==="tool-call-delta"&&Q.type==="tool-call-delta"&&V.toolCallId===Q.toolCallId)V.argsDelta+=Q.argsDelta;else G.push({...Q});yield Q}let Y=this.options.position?await this.options.position():void 0;this.calls.push({request:$,events:G,at:B,...C!==void 0?{read:C}:{},...Y!==void 0?{ended:Y}:{}})}async*replayCall(D,$){let z=this.parent??this,B=this.where(),C=this.calls[0];if(this.options.ordered&&C?.at!==void 0)await z.turn(C.at,B);let G=this.calls.shift();if(!G)throw new N(`${B}: call ${this.sentCalls} was not recorded (the recording has no more calls).`);let{promptCacheKey:X,...Y}=G.request;if(!z.matches(JSON.stringify(Y),$))z.tolerate(B,{...G,request:Y},$,D.tools??[]);if(G.ended!==void 0)await z.reach(G.ended,B);let Q=z.shared.ids;for(let V of G.events)yield JSON.parse(JSON.stringify(V).replace(this.options.ids,(Z)=>Q.get(Z)??Z))}where(){return this.key===void 0?"the recording":`sub-run "${this.key}"`}sentCalls=0;requestOf(D){this.sentCalls++;let{signal:$,promptCacheKey:z,messages:B,tools:C,...G}=D,X=B.map(({role:K,content:H})=>({role:K,content:f(H)})),Y=this.sent.length>0&&this.sent.length<=X.length&&JSON.stringify(X.slice(0,this.sent.length))===JSON.stringify(this.sent)?this.sent.length:0;this.sent=X;let Q=C&&C.length>0?JSON.stringify(C):void 0,V=this.parent??this,Z=(K)=>{return V.texts.add(K),K};if(T([G,X.slice(Y)],Z),Q&&!V.toolLists.has(Q)){V.toolLists.add(Q);for(let K of E(C)){T(K,Z);let H=V.toolHashes.get(K.name)??new Set;H.add(L.tool(K)),V.toolHashes.set(K.name,H)}}return{...f(G),...Q?{tools:`sha256:${r(Q)}`,toolNames:E(C).map((K)=>K.name).sort()}:{},...Y>0?{after:Y}:{},messages:X.slice(Y)}}matches(D,$){let z=this.options.ids,B=JSON.stringify($),C=D.match(z)??[],G=B.match(z)??[];if(C.length!==G.length)return!1;let X=new Map(this.shared.ids);for(let[Y,Q]of C.entries()){let V=X.get(Q)??G[Y];if(V!==G[Y])return!1;X.set(Q,V)}if(D.replace(z,(Y)=>X.get(Y))!==B)return!1;for(let[Y,Q]of X)this.shared.ids.set(Y,Q);return!0}tolerate(D,$,z,B){let C=this.options.ids,G=this.options.match,X=$.request,Y=(j,J,I)=>{let A=JSON.stringify(j).replace(C,"<id>"),W=JSON.stringify(J).replace(C,"<id>"),_=0;while(_<A.length&&A[_]===W[_])_++;throw new N(`${D}: the request differs from the recorded one${I}. Recorded: \u2026${A.slice(Math.max(0,_-80),_+120)}\u2026 Sent: \u2026${W.slice(Math.max(0,_-80),_+120)}\u2026`)};if(G==="exact")Y(X,z,"");let{tools:Q,toolNames:V,...Z}=X,{tools:K,toolNames:H,...k}=z,w=[];if(!this.matches(JSON.stringify(Z),k))if(G==="wording"){if(!this.recorded)Y(Z,k,", and the recording has no fingerprints to tell a reworded prompt by");try{this.cuts??=this.recorded.cutters()}catch(I){throw new N(`${D}: ${I.message}.`)}let j=T(Z,this.cuts.recorded),J=T(k,this.cuts.sent);if(this.cuts.changed.length===0||!this.matches(JSON.stringify(j),J))Y(j,J,this.cuts.changed.length>0?", beyond the wording of the prompts changed since":"");w.push(...this.cuts.changed.map((I)=>`${I} changed`))}else{if(!((X.after??0)===(z.after??0)&&this.matches(JSON.stringify(x(X.messages)),x(z.messages))))Y(Z,k," in the conversation itself");let{messages:J,...I}=Z,{messages:A,...W}=k;if(!this.matches(JSON.stringify(J),A))w.push("message text changed");let _=new Set([...Object.keys(I),...Object.keys(W)]);for(let U of[..._].sort()){let O=JSON.stringify(I[U]??null);if(!this.matches(O,W[U]??null))w.push(`${U} changed`)}}if(Q!==K){let j=E(B);for(let J of $.events){if(J.type!=="tool-call")continue;let I=j.find((O)=>O.name===J.name);if(!I)throw new N(`${D}: the recorded answer calls ${J.name}, which is not offered any more.`);let A=Object.fromEntries([...JSON.stringify(I.parameters).matchAll(/"format":"([^"]+)"/g)].map(([,O])=>[O,!0])),W;try{W=JSON.parse(J.args||"{}")}catch{W=void 0}let _;try{_=m.fromJSONSchema(I.parameters,{unknownKeys:"error",formats:A})}catch(O){if(!(O instanceof v))throw O}let U=_?.safeParse(W);if(U&&U.ok===!1)throw new N(`${D}: the recorded call of ${J.name} does not fit its schema any more (${U.errors.join("; ")}).`)}if(this.recorded){let J=j.filter((I)=>!this.recorded.data.tools[I.name]?.includes(L.tool(I))).map((I)=>I.name).sort();w.push(J.length>0?`tools changed: ${J.join(", ")}`:"the tools offered changed")}else{let J=new Set(V??[]),I=new Set(H??[]),A=[...I].filter((_)=>!J.has(_)),W=[...J].filter((_)=>!I.has(_));w.push(A.length>0||W.length>0?`tools offered changed (${[...A.map((_)=>`+${_}`),...W.map((_)=>`-${_}`)].join(", ")})`:"the tools offered changed")}}this.shared.staleCalls++;for(let j of w)this.shared.stale.add(j)}async turn(D,$){let z=this.shared;z.pending??=[...this.calls,...Object.values(this.recordedNested).flat()].map((B)=>B.at).filter((B)=>B!==void 0).sort((B,C)=>B-C);while(z.pending[0]!==void 0&&z.pending[0]<D){let B=z.moved.promise;if(!await Promise.race([B.then(()=>!0),new Promise((G)=>setTimeout(()=>G(!1),this.options.waitMs))]))throw new N(`${$}: call ${D} waits for call ${z.pending[0]}, which the replay does not make.`)}z.pending=z.pending.filter((B)=>B!==D),z.moved.resolve(),z.moved=u()}async reach(D,$){let z=this.options.position;if(!z)return;let B=await z(),C=0;while(B<D){await new Promise((X)=>setTimeout(X,25));let G=await z();if(C=G===B?C+25:0,B=G,C>=this.options.waitMs)throw new N(`${$}: a call waits for the app to reach ${D}; it stays at ${B}.`)}}}function t(D){let $=globalThis.Date,z=new $(D).getTime()-$.now();if(!Number.isFinite(z))throw Error(`pinClock: ${String(D)} is not a date.`);class B extends ${constructor(...C){if(C.length===0)super($.now()+z);else super(...C)}static now(){return $.now()+z}}return globalThis.Date=B,()=>{if(globalThis.Date===B)globalThis.Date=$}}export{t as pinClock,M as RecordingProvider,N as RecordingMismatchError,L as Fingerprints};
|
|
4
|
+
`),C={};for(let[Y,Q]of W.prompts(z))if(W.pieces(Q).filter((Z)=>Z.length>=12).sort((Z,L)=>L.length-Z.length).slice(0,3).some((Z)=>B.includes(Z)))C[Y]=W.blob(Q);let G=[...$.keys()].sort(),X=z.inputs?.(new Set(G));return new W({prompts:C,tools:Object.fromEntries(G.map((Y)=>[Y,[...$.get(Y)].sort()])),...X&&Object.keys(X).length>0?{inputs:a(X)}:{}},z)}same(D){let $=D instanceof W?D.data:D;return JSON.stringify(this.data)===JSON.stringify($)}changed(){let D=this.options.inputs?.(new Set(Object.keys(this.data.tools)))??{};return[...this.changedPrompts().map(([$])=>$),...Object.entries(this.data.inputs??{}).filter(([$,z])=>D[$]!==z).map(([$])=>`input ${$}`)]}cutters(){let D=W.prompts(this.options),$=this.changedPrompts(),z=new Map,B=new Map;for(let[C,G]of $){let X=this.readBlob(G);if(X===void 0)throw Error(`${C} changed since the recording, and the version it was recorded with (${G}) can't be read back from git`);if(z.set(C,X),D.has(C))B.set(C,D.get(C))}return{changed:$.map(([C])=>C),recorded:R(this.piecesWithPartials(z,(C)=>{let G=this.data.prompts[C];return G&&this.readBlob(G)||D.get(C)})),sent:R(this.piecesWithPartials(B,(C)=>D.get(C)))}}changedPrompts(){let D=W.prompts(this.options);return Object.entries(this.data.prompts).filter(([$,z])=>{let B=D.get($);return B===void 0||W.blob(B)!==z})}readBlob(D){if(this.options.readBlob)return this.options.readBlob(D);let $=Bun.spawnSync(["git","cat-file","blob",D],{cwd:this.root});return $.exitCode===0?$.stdout.toString():void 0}piecesWithPartials(D,$){let z=this.options.dirs??["app/agents"],B=this.options.shared??"prompts",C=[...D];while(C.length>0){let[G,X]=C.pop(),Y=z.find((Q)=>G.startsWith(`${Q}/`));if(Y===void 0)continue;for(let[,Q]of X.matchAll(n)){let V=`${Y}/${Q.includes("/")?Q:`${B}/${Q}`}.md`,Z=D.has(V)?void 0:$(V);if(Z===void 0)continue;D.set(V,Z),C.push([V,Z])}}return[...D.values()].flatMap((G)=>W.pieces(G)).sort((G,X)=>X.length-G.length)}}function a(D){return Object.fromEntries(Object.entries(D).sort(([$],[z])=>$.localeCompare(z)))}class H extends Error{constructor(D){super(`${D} Record again.`);this.name="RecordingMismatchError"}}var o=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;function T(D,$){if(typeof D==="string")return $(D);if(Array.isArray(D))return D.map((z)=>T(z,$));if(D&&typeof D==="object")return Object.fromEntries(Object.entries(D).map(([z,B])=>[z,T(B,$)]));return D}function f(D){return JSON.parse(JSON.stringify(D,function($,z){if($==="nested")return;if($==="output"&&this.type==="tool-result"&&"modelOutput"in this)return;return z}))}function u(){let D;return{promise:new Promise((z)=>D=z),resolve:D}}var r=(D)=>s("sha256").update(D).digest("hex"),E=(D)=>D.flatMap(($)=>("tools"in $)?$.tools:[$]);function x(D){return D.map(({role:$,content:z})=>({role:$,parts:(Array.isArray(z)?z:[]).flatMap((B)=>{if(B?.type==="tool-call")return[{call:B.name,input:B.input??B.args}];if(B?.type==="tool-result")return[{result:B.name,status:B.status}];if(B?.type==="file")return[{file:!0}];return[]})}))}class M extends g{live;model;capabilities;recordedAt;calls;recordedNested;children=new Map;parent;key;sent=[];uploads;uploadCount=0;read;shared;options;texts=new Set;toolHashes=new Map;toolLists=new Set;recorded;cuts;constructor(D,$,z,B){super();this.live=D;if(this.options={...z,match:z.match??"wording",ids:new RegExp(z.ids??o,"g"),waitMs:z.waitMs??60000},B){let{parent:C}=B;this.parent=C,this.key=B.key,this.model=C.model,this.capabilities=C.capabilities,this.recordedAt=C.recordedAt,this.calls=B.calls,this.recordedNested={},this.uploads=C.uploads,this.shared=C.shared;return}if(this.shared={ids:new Map,stale:new Set,staleCalls:0,started:0,moved:u()},this.uploads=new Map,D){this.model=D.model,this.capabilities=D.capabilities,this.recordedAt=new Date,this.calls=[],this.recordedNested={};return}if(!$||$.version!==1||!Array.isArray($.calls))throw Error("RecordingProvider.replay needs a recording made by RecordingProvider.");if(this.model=$.model,this.capabilities=$.capabilities,this.recordedAt=new Date($.recordedAt),this.calls=structuredClone($.calls),this.recordedNested=structuredClone($.nested??{}),$.fingerprints)this.recorded=new W($.fingerprints,z.fingerprints)}static record(D,$={}){return new M(D,void 0,$)}static replay(D,$={}){return new M(void 0,D,$)}get isRecording(){return this.live!==void 0}get stale(){return this.shared.stale}get staleCalls(){return this.shared.staleCalls}nested(D){if(this.parent)return this.parent.nested(D);let $=this.children.get(D);if(!$){let z=this.recordedNested[D];if(!this.live&&!z)throw new H(`The recording has no sub-run "${D}".`);$=new M(this.live,void 0,this.options,{parent:this,key:D,calls:z??[]}),this.children.set(D,$)}return $}recording(){if(this.parent)return this.parent.recording();if(!this.live)throw Error("Only a recording provider (`record`) has a recording to save.");return{version:1,model:this.model,capabilities:this.capabilities,recordedAt:this.recordedAt.toISOString(),calls:structuredClone(this.calls),...this.options.fingerprints?{fingerprints:this.fingerprints().data}:{},...this.children.size>0?{nested:Object.fromEntries([...this.children].map(([D,$])=>[D,structuredClone($.calls)]))}:{}}}fingerprints(){let D=this.parent??this;return W.of(D.texts,D.toolHashes,this.options.fingerprints)}static changedSince(D,$={}){return D.fingerprints?new W(D.fingerprints,$).changed():[]}replayedInFull(){let D=this.parent??this;return D.calls.length===0&&Object.entries(D.recordedNested).every(([$,z])=>(D.children.get($)?.calls??z).length===0)}async pin(D){if(this.live)return this.read=D,D;let $=this.calls[0]?.read;if($===void 0)return D;return await(this.parent??this).reach($,this.where()),$}async upload(D){let $=++this.uploadCount,z=this.key===void 0?`upload_${$}`:`upload_${this.key}_${$}`;if(this.live)this.uploads.set(z,await this.live.upload(D));return z}async deleteFile(D){let $=this.uploads.get(D);if(this.live&&$!==void 0){if(!this.live.deleteFile)throw Error(`${this.live.constructor.name} cannot delete provider files: it does not implement deleteFile().`);await this.live.deleteFile($),this.uploads.delete(D)}}normalizeError(D){return this.live?this.live.normalizeError(D):super.normalizeError(D)}async*stream(D){let $=this.requestOf(D);if(this.live){yield*this.recordCall(D,$);return}yield*this.replayCall(D,$)}async*recordCall(D,$){let z=this.parent??this,B=z.shared.started++,C=this.read;this.read=void 0;let G=[],X=D.messages.map((Q)=>({...Q,content:Q.content.map((V)=>V.type==="file"&&V.fileId&&this.uploads.has(V.fileId)?{...V,fileId:this.uploads.get(V.fileId)}:V)}));for await(let Q of this.live.stream({...D,messages:X})){let V=G.at(-1);if(Q.type==="tool-call-discard"){let Z=new Set(Q.toolCallIds),L=G.filter((I)=>I.type!=="tool-call-delta"||!Z.has(I.toolCallId));G.splice(0,G.length,...L)}else if(Q.type==="retry");else if(V&&(Q.type==="text-delta"||Q.type==="output-delta")&&V.type===Q.type)V.delta+=Q.delta;else if(V?.type==="tool-call-delta"&&Q.type==="tool-call-delta"&&V.toolCallId===Q.toolCallId)V.argsDelta+=Q.argsDelta;else G.push({...Q});yield Q}let Y=this.options.position?await this.options.position():void 0;this.calls.push({request:$,events:G,at:B,...C!==void 0?{read:C}:{},...Y!==void 0?{ended:Y}:{}})}async*replayCall(D,$){let z=this.parent??this,B=this.where(),C=this.calls[0];if(this.options.ordered&&C?.at!==void 0)await z.turn(C.at,B);let G=this.calls.shift();if(!G)throw new H(`${B}: call ${this.sentCalls} was not recorded (the recording has no more calls).`);let{promptCacheKey:X,...Y}=G.request;if(!z.matches(JSON.stringify(Y),$))z.tolerate(B,{...G,request:Y},$,D.tools??[]);if(G.ended!==void 0)await z.reach(G.ended,B);let Q=z.shared.ids;for(let V of G.events)yield JSON.parse(JSON.stringify(V).replace(this.options.ids,(Z)=>Q.get(Z)??Z))}where(){return this.key===void 0?"the recording":`sub-run "${this.key}"`}sentCalls=0;requestOf(D){this.sentCalls++;let{signal:$,promptCacheKey:z,messages:B,tools:C,...G}=D,X=B.map(({role:L,content:I})=>({role:L,content:f(I)})),Y=this.sent.length>0&&this.sent.length<=X.length&&JSON.stringify(X.slice(0,this.sent.length))===JSON.stringify(this.sent)?this.sent.length:0;this.sent=X;let Q=C&&C.length>0?JSON.stringify(C):void 0,V=this.parent??this,Z=(L)=>{return V.texts.add(L),L};if(T([G,X.slice(Y)],Z),Q&&!V.toolLists.has(Q)){V.toolLists.add(Q);for(let L of E(C)){T(L,Z);let I=V.toolHashes.get(L.name)??new Set;I.add(W.tool(L)),V.toolHashes.set(L.name,I)}}return{...f(G),...Q?{tools:`sha256:${r(Q)}`,toolNames:E(C).map((L)=>L.name).sort()}:{},...Y>0?{after:Y}:{},messages:X.slice(Y)}}matches(D,$){let z=this.options.ids,B=JSON.stringify($),C=D.match(z)??[],G=B.match(z)??[];if(C.length!==G.length)return!1;let X=new Map(this.shared.ids);for(let[Y,Q]of C.entries()){let V=X.get(Q)??G[Y];if(V!==G[Y])return!1;X.set(Q,V)}if(D.replace(z,(Y)=>X.get(Y))!==B)return!1;for(let[Y,Q]of X)this.shared.ids.set(Y,Q);return!0}tolerate(D,$,z,B){let C=this.options.ids,G=this.options.match,X=$.request,Y=(A,K,J)=>{let N=JSON.stringify(A).replace(C,"<id>"),j=JSON.stringify(K).replace(C,"<id>"),_=0;while(_<N.length&&N[_]===j[_])_++;throw new H(`${D}: the request differs from the recorded one${J}. Recorded: \u2026${N.slice(Math.max(0,_-80),_+120)}\u2026 Sent: \u2026${j.slice(Math.max(0,_-80),_+120)}\u2026`)};if(G==="exact")Y(X,z,"");let{tools:Q,toolNames:V,...Z}=X,{tools:L,toolNames:I,...k}=z,w=[];if(!this.matches(JSON.stringify(Z),k))if(G==="wording"){if(!this.recorded)Y(Z,k,", and the recording has no fingerprints to tell a reworded prompt by");try{this.cuts??=this.recorded.cutters()}catch(J){throw new H(`${D}: ${J.message}.`)}let A=T(Z,this.cuts.recorded),K=T(k,this.cuts.sent);if(this.cuts.changed.length===0||!this.matches(JSON.stringify(A),K))Y(A,K,this.cuts.changed.length>0?", beyond the wording of the prompts changed since":"");w.push(...this.cuts.changed.map((J)=>`${J} changed`))}else{if(!((X.after??0)===(z.after??0)&&this.matches(JSON.stringify(x(X.messages)),x(z.messages))))Y(Z,k," in the conversation itself");let{messages:K,...J}=Z,{messages:N,...j}=k;if(!this.matches(JSON.stringify(K),N))w.push("message text changed");let _=new Set([...Object.keys(J),...Object.keys(j)]);for(let U of[..._].sort()){let O=JSON.stringify(J[U]??null);if(!this.matches(O,j[U]??null))w.push(`${U} changed`)}}if(Q!==L){let A=E(B);for(let K of $.events){if(K.type!=="tool-call")continue;let J=A.find((O)=>O.name===K.name);if(!J)throw new H(`${D}: the recorded answer calls ${K.name}, which is not offered any more.`);let N=Object.fromEntries([...JSON.stringify(J.parameters).matchAll(/"format":"([^"]+)"/g)].map(([,O])=>[O,!0])),j;try{j=JSON.parse(K.args||"{}")}catch{j=void 0}let _;try{_=m.fromJSONSchema(J.parameters,{unknownKeys:"error",formats:N})}catch(O){if(!(O instanceof v))throw O}let U=_?.safeParse(j);if(U&&U.ok===!1)throw new H(`${D}: the recorded call of ${K.name} does not fit its schema any more (${U.errors.join("; ")}).`)}if(this.recorded){let K=A.filter((J)=>!this.recorded.data.tools[J.name]?.includes(W.tool(J))).map((J)=>J.name).sort();w.push(K.length>0?`tools changed: ${K.join(", ")}`:"the tools offered changed")}else{let K=new Set(V??[]),J=new Set(I??[]),N=[...J].filter((_)=>!K.has(_)),j=[...K].filter((_)=>!J.has(_));w.push(N.length>0||j.length>0?`tools offered changed (${[...N.map((_)=>`+${_}`),...j.map((_)=>`-${_}`)].join(", ")})`:"the tools offered changed")}}this.shared.staleCalls++;for(let A of w)this.shared.stale.add(A)}async turn(D,$){let z=this.shared;z.pending??=[...this.calls,...Object.values(this.recordedNested).flat()].map((B)=>B.at).filter((B)=>B!==void 0).sort((B,C)=>B-C);while(z.pending[0]!==void 0&&z.pending[0]<D){let B=z.moved.promise;if(!await Promise.race([B.then(()=>!0),new Promise((G)=>setTimeout(()=>G(!1),this.options.waitMs))]))throw new H(`${$}: call ${D} waits for call ${z.pending[0]}, which the replay does not make.`)}z.pending=z.pending.filter((B)=>B!==D),z.moved.resolve(),z.moved=u()}async reach(D,$){let z=this.options.position;if(!z)return;let B=await z(),C=0;while(B<D){await new Promise((X)=>setTimeout(X,25));let G=await z();if(C=G===B?C+25:0,B=G,C>=this.options.waitMs)throw new H(`${$}: a call waits for the app to reach ${D}; it stays at ${B}.`)}}}function t(D){let $=globalThis.Date,z=new $(D).getTime()-$.now();if(!Number.isFinite(z))throw Error(`pinClock: ${String(D)} is not a date.`);class B extends ${constructor(...C){if(C.length===0)super($.now()+z);else super(...C)}static now(){return $.now()+z}}return globalThis.Date=B,()=>{if(globalThis.Date===B)globalThis.Date=$}}export{t as pinClock,M as RecordingProvider,H as RecordingMismatchError,W as Fingerprints};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=BEC7B241B241AB0164756E2164756E21
|