gemi 0.84.1 → 0.85.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 +41 -3
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/AgentController.d.ts +238 -0
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/AgentProvider.d.ts +15 -0
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/client/index.d.ts +2 -2
- package/dist/ai/client/index.d.ts.map +1 -1
- package/dist/ai/client/index.js +138 -35
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/client/reducer.d.ts +7 -1
- package/dist/ai/client/reducer.d.ts.map +1 -1
- package/dist/ai/generate.d.ts.map +1 -1
- package/dist/ai/index.d.ts +4 -2
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +12 -12
- package/dist/ai/index.js.map +19 -16
- package/dist/ai/providers/call.d.ts +4 -0
- package/dist/ai/providers/call.d.ts.map +1 -1
- package/dist/ai/providers/fileRejection.d.ts +84 -0
- package/dist/ai/providers/fileRejection.d.ts.map +1 -0
- package/dist/ai/providers/request.d.ts.map +1 -1
- package/dist/ai/redact.d.ts +70 -0
- package/dist/ai/redact.d.ts.map +1 -0
- package/dist/ai/signing.d.ts +33 -4
- package/dist/ai/signing.d.ts.map +1 -1
- package/dist/ai/store/Attachments.d.ts +5 -3
- package/dist/ai/store/Attachments.d.ts.map +1 -1
- package/dist/ai/store/FileOwners.d.ts +59 -0
- package/dist/ai/store/FileOwners.d.ts.map +1 -0
- package/dist/ai/store/LiveRuns.d.ts +25 -0
- package/dist/ai/store/LiveRuns.d.ts.map +1 -1
- package/dist/ai/store/MemoryAgentStore.d.ts +1 -0
- package/dist/ai/store/MemoryAgentStore.d.ts.map +1 -1
- package/dist/ai/store/Nonces.d.ts +109 -0
- package/dist/ai/store/Nonces.d.ts.map +1 -0
- package/dist/ai/store/index.d.ts +2 -0
- package/dist/ai/store/index.d.ts.map +1 -1
- package/dist/ai/types.d.ts +30 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/useChat.d.ts +62 -3
- package/dist/ai/useChat.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-82nn71zs.js → chunk-09sr33ff.js} +2 -2
- package/dist/{chunk-82nn71zs.js.map → chunk-09sr33ff.js.map} +1 -1
- package/dist/chunk-174jkg6d.js +7 -0
- package/dist/{chunk-302mkqeq.js.map → chunk-174jkg6d.js.map} +9 -8
- package/dist/{chunk-87x692j7.js → chunk-1b5s4w5f.js} +2 -2
- package/dist/{chunk-87x692j7.js.map → chunk-1b5s4w5f.js.map} +1 -1
- package/dist/{chunk-rmv1jp9p.js → chunk-1jcp8m8h.js} +2 -2
- package/dist/{chunk-rmv1jp9p.js.map → chunk-1jcp8m8h.js.map} +1 -1
- package/dist/{chunk-g6qe6wyb.js → chunk-1w5a11cd.js} +2 -2
- package/dist/{chunk-g6qe6wyb.js.map → chunk-1w5a11cd.js.map} +1 -1
- package/dist/chunk-1wby1sr2.js +5 -0
- package/dist/{chunk-e43drft2.js.map → chunk-1wby1sr2.js.map} +3 -3
- package/dist/{chunk-vmpzg4z5.js → chunk-1yq1e6sb.js} +3 -3
- package/dist/{chunk-vmpzg4z5.js.map → chunk-1yq1e6sb.js.map} +1 -1
- package/dist/chunk-1yzdxv2a.js +5 -0
- package/dist/{chunk-tmwsvf02.js.map → chunk-1yzdxv2a.js.map} +1 -1
- package/dist/{chunk-ah9ajys0.js → chunk-2gdhcswa.js} +1 -1
- package/dist/chunk-2k5kyk0h.js +24 -0
- package/dist/chunk-2k5kyk0h.js.map +17 -0
- package/dist/{chunk-1evk2pma.js → chunk-2yw23zhn.js} +4 -4
- package/dist/{chunk-1evk2pma.js.map → chunk-2yw23zhn.js.map} +1 -1
- package/dist/{chunk-3z6wkvwj.js → chunk-4ysar3ev.js} +2 -2
- package/dist/{chunk-3z6wkvwj.js.map → chunk-4ysar3ev.js.map} +1 -1
- package/dist/{chunk-z409rk5j.js → chunk-4zj05vry.js} +2 -2
- package/dist/{chunk-z409rk5j.js.map → chunk-4zj05vry.js.map} +1 -1
- package/dist/{chunk-1cebv3h8.js → chunk-55x9kkdt.js} +2 -2
- package/dist/{chunk-1cebv3h8.js.map → chunk-55x9kkdt.js.map} +1 -1
- package/dist/{chunk-0agfx93f.js → chunk-5ktfpty1.js} +2 -2
- package/dist/{chunk-0agfx93f.js.map → chunk-5ktfpty1.js.map} +1 -1
- package/dist/chunk-6k2czkkh.js +55 -0
- package/dist/{chunk-rp5j1mgk.js.map → chunk-6k2czkkh.js.map} +3 -3
- package/dist/{chunk-3zb2ycxj.js → chunk-7c33ngqs.js} +2 -2
- package/dist/{chunk-3zb2ycxj.js.map → chunk-7c33ngqs.js.map} +1 -1
- package/dist/{chunk-en3mtnsg.js → chunk-7n5775qx.js} +2 -2
- package/dist/{chunk-en3mtnsg.js.map → chunk-7n5775qx.js.map} +1 -1
- package/dist/{chunk-bn9pzgww.js → chunk-7nj2t2gm.js} +2 -2
- package/dist/{chunk-bn9pzgww.js.map → chunk-7nj2t2gm.js.map} +1 -1
- package/dist/{chunk-kfavcgv2.js → chunk-81k26w39.js} +2 -2
- package/dist/{chunk-kfavcgv2.js.map → chunk-81k26w39.js.map} +1 -1
- package/dist/{chunk-cg4k40zy.js → chunk-81v4c4b1.js} +2 -2
- package/dist/{chunk-cg4k40zy.js.map → chunk-81v4c4b1.js.map} +1 -1
- package/dist/{chunk-wh728wd6.js → chunk-8gexb1gt.js} +2 -2
- package/dist/{chunk-wh728wd6.js.map → chunk-8gexb1gt.js.map} +1 -1
- package/dist/{chunk-zfch4da5.js → chunk-9tsw1bmt.js} +2 -2
- package/dist/{chunk-8mmfpqgs.js.map → chunk-9tsw1bmt.js.map} +1 -1
- package/dist/{chunk-m0zba09s.js → chunk-9tv5j3b2.js} +3 -3
- package/dist/{chunk-m0zba09s.js.map → chunk-9tv5j3b2.js.map} +1 -1
- package/dist/{chunk-jg9eqd3r.js → chunk-c3gzpjba.js} +1 -1
- package/dist/{chunk-r5e4vpa1.js → chunk-cbycz5z3.js} +2 -2
- package/dist/{chunk-r5e4vpa1.js.map → chunk-cbycz5z3.js.map} +1 -1
- package/dist/{chunk-cfvq30n4.js → chunk-cfykfnqx.js} +2 -2
- package/dist/{chunk-cfvq30n4.js.map → chunk-cfykfnqx.js.map} +1 -1
- package/dist/{chunk-eysexnqb.js → chunk-ct7wxm98.js} +2 -2
- package/dist/{chunk-eysexnqb.js.map → chunk-ct7wxm98.js.map} +1 -1
- package/dist/{chunk-v27a4se1.js → chunk-d3jkypc7.js} +3 -3
- package/dist/{chunk-v27a4se1.js.map → chunk-d3jkypc7.js.map} +1 -1
- package/dist/{chunk-vfrrzr10.js → chunk-dadygfkf.js} +2 -2
- package/dist/{chunk-vfrrzr10.js.map → chunk-dadygfkf.js.map} +1 -1
- package/dist/{chunk-m4xw99vm.js → chunk-dwqh79e5.js} +2 -2
- package/dist/{chunk-m4xw99vm.js.map → chunk-dwqh79e5.js.map} +1 -1
- package/dist/{chunk-ng8pp9k2.js → chunk-fbwe0agk.js} +2 -2
- package/dist/{chunk-ng8pp9k2.js.map → chunk-fbwe0agk.js.map} +1 -1
- package/dist/{chunk-495qwteq.js → chunk-fc2je244.js} +3 -3
- package/dist/{chunk-495qwteq.js.map → chunk-fc2je244.js.map} +1 -1
- package/dist/{chunk-gr61ymse.js → chunk-gx0x772p.js} +2 -2
- package/dist/{chunk-gr61ymse.js.map → chunk-gx0x772p.js.map} +1 -1
- package/dist/{chunk-tdnfhe7x.js → chunk-ha705bcz.js} +3 -3
- package/dist/{chunk-tdnfhe7x.js.map → chunk-ha705bcz.js.map} +1 -1
- package/dist/chunk-jhe0t7yj.js +5 -0
- package/dist/chunk-jhe0t7yj.js.map +11 -0
- package/dist/{chunk-d0qwdeza.js → chunk-k5j65f2c.js} +2 -2
- package/dist/{chunk-d0qwdeza.js.map → chunk-k5j65f2c.js.map} +1 -1
- package/dist/{chunk-pt59xjfc.js → chunk-kmsrzbx1.js} +2 -2
- package/dist/{chunk-pt59xjfc.js.map → chunk-kmsrzbx1.js.map} +1 -1
- package/dist/{chunk-v1nm4tcq.js → chunk-m7y8d3k7.js} +2 -2
- package/dist/{chunk-v1nm4tcq.js.map → chunk-m7y8d3k7.js.map} +1 -1
- package/dist/{chunk-k2qh3hvd.js → chunk-mk8m3ffx.js} +2 -2
- package/dist/{chunk-k2qh3hvd.js.map → chunk-mk8m3ffx.js.map} +1 -1
- package/dist/{chunk-z7442w3q.js → chunk-mszy6cfw.js} +2 -2
- package/dist/{chunk-z7442w3q.js.map → chunk-mszy6cfw.js.map} +1 -1
- package/dist/{chunk-kb3xk9r8.js → chunk-ndat0nf0.js} +2 -2
- package/dist/{chunk-kb3xk9r8.js.map → chunk-ndat0nf0.js.map} +1 -1
- package/dist/{chunk-j9wqzemf.js → chunk-p0m3qgs5.js} +2 -2
- package/dist/{chunk-j9wqzemf.js.map → chunk-p0m3qgs5.js.map} +1 -1
- package/dist/{chunk-8mmfpqgs.js → chunk-p7r3ecpk.js} +2 -2
- package/dist/{chunk-zfch4da5.js.map → chunk-p7r3ecpk.js.map} +1 -1
- package/dist/{chunk-zp971jp2.js → chunk-pmmrhak1.js} +3 -3
- package/dist/{chunk-zp971jp2.js.map → chunk-pmmrhak1.js.map} +1 -1
- package/dist/{chunk-nvj1z2rs.js → chunk-pzwyg474.js} +2 -2
- package/dist/{chunk-nvj1z2rs.js.map → chunk-pzwyg474.js.map} +1 -1
- package/dist/{chunk-73dk6k4p.js → chunk-qje4kdff.js} +3 -3
- package/dist/{chunk-73dk6k4p.js.map → chunk-qje4kdff.js.map} +1 -1
- package/dist/{chunk-yk8s5egf.js → chunk-rdnm6rem.js} +2 -2
- package/dist/{chunk-yk8s5egf.js.map → chunk-rdnm6rem.js.map} +1 -1
- package/dist/{chunk-enf9mdac.js → chunk-s046a984.js} +2 -2
- package/dist/{chunk-enf9mdac.js.map → chunk-s046a984.js.map} +1 -1
- package/dist/{chunk-1s914cdj.js → chunk-saqfc6vp.js} +3 -3
- package/dist/{chunk-1s914cdj.js.map → chunk-saqfc6vp.js.map} +1 -1
- package/dist/{chunk-pgpqsgzx.js → chunk-sejnmn1q.js} +1 -1
- package/dist/{chunk-xhha1gb3.js → chunk-sjckrbr2.js} +2 -2
- package/dist/{chunk-xhha1gb3.js.map → chunk-sjckrbr2.js.map} +1 -1
- package/dist/{chunk-r8nhndzb.js → chunk-swhyp0yw.js} +2 -2
- package/dist/{chunk-r8nhndzb.js.map → chunk-swhyp0yw.js.map} +1 -1
- package/dist/{chunk-wkdzz0rx.js → chunk-trdwxm5x.js} +3 -3
- package/dist/{chunk-wkdzz0rx.js.map → chunk-trdwxm5x.js.map} +1 -1
- package/dist/{chunk-aztkrzvf.js → chunk-v2hvnxsf.js} +2 -2
- package/dist/{chunk-aztkrzvf.js.map → chunk-v2hvnxsf.js.map} +1 -1
- package/dist/{chunk-57ryyhh3.js → chunk-v4ngf77f.js} +2 -2
- package/dist/{chunk-57ryyhh3.js.map → chunk-v4ngf77f.js.map} +1 -1
- package/dist/{chunk-159hyeng.js → chunk-v8nf45gt.js} +2 -2
- package/dist/{chunk-159hyeng.js.map → chunk-v8nf45gt.js.map} +1 -1
- package/dist/{chunk-ys4fejmx.js → chunk-vwp1g8wh.js} +2 -2
- package/dist/{chunk-ys4fejmx.js.map → chunk-vwp1g8wh.js.map} +1 -1
- package/dist/chunk-w312e9nx.js +5 -0
- package/dist/{chunk-ash9e6fn.js.map → chunk-w312e9nx.js.map} +4 -3
- package/dist/{chunk-wwdaswxh.js → chunk-wwzg4dmy.js} +3 -3
- package/dist/{chunk-wwdaswxh.js.map → chunk-wwzg4dmy.js.map} +1 -1
- package/dist/{chunk-wsx3j5ws.js → chunk-xckeyg3v.js} +2 -2
- package/dist/{chunk-wsx3j5ws.js.map → chunk-xckeyg3v.js.map} +1 -1
- package/dist/chunk-xx2zg6sk.js +17 -0
- package/dist/{chunk-49akdtfe.js.map → chunk-xx2zg6sk.js.map} +11 -12
- package/dist/{chunk-rqh2wdhb.js → chunk-y7qnx8vm.js} +2 -2
- package/dist/{chunk-rqh2wdhb.js.map → chunk-y7qnx8vm.js.map} +1 -1
- package/dist/{chunk-rv7da58g.js → chunk-z4k18gnp.js} +2 -2
- package/dist/{chunk-rv7da58g.js.map → chunk-z4k18gnp.js.map} +1 -1
- package/dist/{chunk-w099t7zj.js → chunk-zf4r4kat.js} +2 -2
- package/dist/{chunk-w099t7zj.js.map → chunk-zf4r4kat.js.map} +1 -1
- package/dist/{chunk-dvpxkzms.js → chunk-zs90w6ke.js} +2 -2
- package/dist/{chunk-dvpxkzms.js.map → chunk-zs90w6ke.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-Dn3UREDn.js → ThemeProvider-D1kDfCwY.js} +59 -2
- package/dist/chunks/ThemeProvider-D1kDfCwY.js.map +1 -0
- package/dist/client/Link.d.ts.map +1 -1
- package/dist/client/MutationError.d.ts +60 -50
- package/dist/client/MutationError.d.ts.map +1 -1
- package/dist/client/ProgressManager.d.ts +1 -1
- package/dist/client/QueryResource.d.ts +20 -0
- package/dist/client/QueryResource.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +109 -35
- package/dist/client/index.js.map +1 -1
- package/dist/client/useMutation.d.ts.map +1 -1
- package/dist/client/useQuery.d.ts.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/Email.d.ts.map +1 -1
- package/dist/email/debugEmail.d.ts +40 -0
- package/dist/email/debugEmail.d.ts.map +1 -0
- package/dist/email/index.js +4 -3
- package/dist/email/index.js.map +6 -5
- 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 +12 -0
- package/dist/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/CSRFMiddleware.d.ts +1 -1
- package/dist/http/CSRFMiddleware.d.ts.map +1 -1
- package/dist/http/Error.d.ts +50 -0
- package/dist/http/Error.d.ts.map +1 -1
- package/dist/http/HttpRequest.d.ts +26 -0
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/RateLimitMiddleware.d.ts +6 -3
- package/dist/http/RateLimitMiddleware.d.ts.map +1 -1
- package/dist/http/Router.d.ts.map +1 -1
- package/dist/http/errors.d.ts.map +1 -1
- package/dist/http/index.d.ts +2 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/http/mediaType.d.ts +16 -0
- package/dist/http/mediaType.d.ts.map +1 -0
- package/dist/http/refusal.d.ts +52 -0
- package/dist/http/refusal.d.ts.map +1 -0
- 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 +2 -2
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/server/devFetch.d.ts.map +1 -1
- package/dist/server/forwardedFor.d.ts +42 -0
- package/dist/server/forwardedFor.d.ts.map +1 -0
- package/dist/server/httpProd.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/staticFile.d.ts +33 -0
- package/dist/server/staticFile.d.ts.map +1 -0
- package/dist/server/unhandledError.d.ts.map +1 -1
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +2 -2
- package/dist/services/mcp/McpRegistry.d.ts +2 -1
- package/dist/services/mcp/McpRegistry.d.ts.map +1 -1
- package/dist/services/mcp/toAgentTools.d.ts +1 -1
- package/dist/services/mcp/toAgentTools.d.ts.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/notFound.d.ts.map +1 -1
- package/dist/services/router/policyDenied.d.ts.map +1 -1
- package/dist/services/router/serverQueryFetcher.d.ts.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/skills/gemi-react-best-practices/rules/controller-throw-framework-errors.md +5 -0
- package/dist/chunk-302mkqeq.js +0 -7
- package/dist/chunk-49akdtfe.js +0 -17
- package/dist/chunk-ash9e6fn.js +0 -5
- package/dist/chunk-e43drft2.js +0 -5
- package/dist/chunk-j5xcfeqx.js +0 -24
- package/dist/chunk-j5xcfeqx.js.map +0 -16
- package/dist/chunk-rp5j1mgk.js +0 -55
- package/dist/chunk-tmwsvf02.js +0 -5
- package/dist/chunks/ThemeProvider-Dn3UREDn.js.map +0 -1
- /package/dist/{chunk-ah9ajys0.js.map → chunk-2gdhcswa.js.map} +0 -0
- /package/dist/{chunk-jg9eqd3r.js.map → chunk-c3gzpjba.js.map} +0 -0
- /package/dist/{chunk-pgpqsgzx.js.map → chunk-sejnmn1q.js.map} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ProviderEvent } from "../AgentProvider";
|
|
2
2
|
import type { ProviderTarget } from "./endpoints";
|
|
3
|
+
import { type SentFile } from "./fileRejection";
|
|
3
4
|
import { type FetchLike } from "./http";
|
|
4
5
|
import type { ResponsesRequest } from "./request";
|
|
5
6
|
/**
|
|
@@ -42,6 +43,9 @@ export declare function responsesEndpoint(target: ProviderTarget): ResponsesEndp
|
|
|
42
43
|
export declare function streamResponses(endpoint: ResponsesEndpoint, body: ResponsesRequest, params: {
|
|
43
44
|
signal?: AbortSignal;
|
|
44
45
|
structuredOutput: boolean;
|
|
46
|
+
/** The file ids `body` sends, with their names — for the note that
|
|
47
|
+
* replaces a file the provider refuses. See `providers/fileRejection.ts`. */
|
|
48
|
+
files?: Map<string, SentFile>;
|
|
45
49
|
}): AsyncGenerator<ProviderEvent>;
|
|
46
50
|
/**
|
|
47
51
|
* What a file is uploaded *for*, which decides where its id is accepted.
|
|
@@ -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;AAElD,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlD;;;;;;;;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,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAQ3E;AAED;;;;;;GAMG;AACH,wBAAuB,eAAe,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE;
|
|
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;A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**
|
|
4
|
+
* A stored file the provider will not read, and what to do about it (#684).
|
|
5
|
+
*
|
|
6
|
+
* THE FAILURE. A `FilePart` lives in the thread's history and goes back up on
|
|
7
|
+
* every request. If the provider refuses its `file_id` — an id from the wrong
|
|
8
|
+
* upload purpose, a file that was deleted or expired, a resource that no longer
|
|
9
|
+
* owns it — the turn that added it fails with a 400, and so does every turn
|
|
10
|
+
* after it, because the history that holds the part is the history every turn
|
|
11
|
+
* sends. The user's only way out was a new thread.
|
|
12
|
+
*
|
|
13
|
+
* THE FIX. When a 400 names a file block of the request, that block is swapped
|
|
14
|
+
* for a line of text saying the attachment could not be read, and the request
|
|
15
|
+
* is sent again. The model is told, so it can tell the user rather than answer
|
|
16
|
+
* as though it had read the file. `Agent` is told too (a `file-rejected`
|
|
17
|
+
* provider event), and marks the stored part `providerRejected` so later turns
|
|
18
|
+
* send the note instead of the id and do not pay for a failed request first.
|
|
19
|
+
*
|
|
20
|
+
* WHAT A REFUSAL LOOKS LIKE, MEASURED against a live Azure resource (gpt-6-sol,
|
|
21
|
+
* `/openai/v1`, `api-version=preview`, 2026-10-01). Each body is recorded in
|
|
22
|
+
* `__fixtures__` and the tests read those files:
|
|
23
|
+
*
|
|
24
|
+
* A `user_data` id (`azure-error-file-id-prefix.json`): `param` points at the
|
|
25
|
+
* block, `input[2].content[1].file_id`, and the message says `Expected an
|
|
26
|
+
* ID that begins with 'assistant'`. With TWO such ids in one request only
|
|
27
|
+
* the first is named, which is why more than one retry is allowed below.
|
|
28
|
+
* An id that does not exist, or a file that was deleted
|
|
29
|
+
* (`azure-error-files-not-found.json`, `azure-error-file-deleted.json`):
|
|
30
|
+
* `param: null`, and the message lists every missing id at once —
|
|
31
|
+
* `Files [assistant-…, assistant-…] were not found due to ownership
|
|
32
|
+
* verification failure.` So the ids are read out of the message, by
|
|
33
|
+
* matching the ids the request actually sent rather than by parsing the
|
|
34
|
+
* sentence, which also covers OpenAI's wording without having measured it.
|
|
35
|
+
* The right id in the wrong block (`azure-error-file-type.json`): `param:
|
|
36
|
+
* "input"` and `… but got .png.`, naming neither the block nor the id. The
|
|
37
|
+
* block is found by the extension and the block type the message names,
|
|
38
|
+
* and only when that settles on exactly one file: guessing between two
|
|
39
|
+
* would hide a file that was fine.
|
|
40
|
+
*
|
|
41
|
+
* Anything else is left alone and fails the turn as it did before. In
|
|
42
|
+
* particular a refusal that names no file in this request is not retried: a
|
|
43
|
+
* retry is only worth sending when something about the request has changed.
|
|
44
|
+
*/
|
|
45
|
+
/** What the request builder knew about each file id it sent, for the note. */
|
|
46
|
+
export type SentFile = {
|
|
47
|
+
name?: string;
|
|
48
|
+
mimeType?: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* How many times one call may be re-sent for a rejected file. Each retry has to
|
|
52
|
+
* take out a file the previous ones did not, so this bounds requests, not
|
|
53
|
+
* files: Azure names one bad block per 400 (`param` holds a single path), and
|
|
54
|
+
* a thread that picked up several `user_data` ids before #682 would otherwise
|
|
55
|
+
* clear one per turn and fail every turn until it ran out.
|
|
56
|
+
*/
|
|
57
|
+
export declare const MAX_FILE_REJECTION_RETRIES = 3;
|
|
58
|
+
/** The file ids in a history, with the name each was attached under. */
|
|
59
|
+
export declare function sentFiles(messages: AgentMessage[]): Map<string, SentFile>;
|
|
60
|
+
/**
|
|
61
|
+
* The file ids a provider error blames, among the ones `body` sent.
|
|
62
|
+
*
|
|
63
|
+
* Empty when the error is not a 400/404 from the API, or names nothing in this
|
|
64
|
+
* request — which is the signal not to retry.
|
|
65
|
+
*/
|
|
66
|
+
export declare function rejectedFileIds(body: ResponsesRequest, error: unknown, files?: Map<string, SentFile>): string[];
|
|
67
|
+
/**
|
|
68
|
+
* `body` with every block holding one of `fileIds` replaced by a note.
|
|
69
|
+
*
|
|
70
|
+
* A copy: the caller's body is what was sent, and the next attempt is a
|
|
71
|
+
* different request.
|
|
72
|
+
*/
|
|
73
|
+
export declare function withoutFiles(body: ResponsesRequest, fileIds: Set<string>, files?: Map<string, SentFile>): ResponsesRequest;
|
|
74
|
+
/**
|
|
75
|
+
* What the model reads where the file would have been.
|
|
76
|
+
*
|
|
77
|
+
* It says the file was not read, so the model does not describe a document it
|
|
78
|
+
* never saw, and it says the provider refused it, so "please re-upload it" is
|
|
79
|
+
* the obvious next step rather than something the model has to guess at. The
|
|
80
|
+
* name is JSON-quoted for the reason `attachmentLine` gives: it is the user's,
|
|
81
|
+
* and can hold anything.
|
|
82
|
+
*/
|
|
83
|
+
export declare function unreadableNote(name: string | undefined): string;
|
|
84
|
+
//# sourceMappingURL=fileRejection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileRejection.d.ts","sourceRoot":"","sources":["../../../ai/providers/fileRejection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CASzE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAa,GACvC,MAAM,EAAE,CA4CV;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,KAAK,GAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAa,GACvC,gBAAgB,CAgBlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAG/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../ai/providers/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../ai/providers/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,YAAY,EAAY,cAAc,EAAE,MAAM,UAAU,CAAC;AAEvE;;;;;;;GAOG;AAKH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,MAAM,EAAE,IAAI,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC3C,SAAS,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,oBAAoB,EAC5B,GAAG,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,oBAAoB,CAAA;CAAE,GACzD,gBAAgB,CAuDlB;AAID;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EAAE,EACxB,YAAY,EAAE,oBAAoB,GACjC,kBAAkB,EAAE,CA4HtB;AA4QD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAuB7D;AAUD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,CAAC,gBAAgB,GAAG,qBAAqB,CAAC,EAAE,GAAG,SAAS,EAC/D,YAAY,EAAE,oBAAoB,GACjC,aAAa,EAAE,CA2CjB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { AgentError } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A tool failure whose message is meant to be read: by the model, which can
|
|
4
|
+
* act on it, and by the client, which shows it.
|
|
5
|
+
*
|
|
6
|
+
* Any other exception a tool throws reaches the model and the client as a
|
|
7
|
+
* generic sentence (see `redactError`), because its message is whatever the
|
|
8
|
+
* code underneath happened to say: a database driver's connection string, an
|
|
9
|
+
* internal hostname, a third party's error body. The full error is logged.
|
|
10
|
+
* Throw this instead when the message is written for the person:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* if (!order) throw new ToolError(`There is no order ${input.orderId}.`);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class ToolError extends Error {
|
|
17
|
+
/** Whether the model may try the call again. Default `true`. */
|
|
18
|
+
readonly retryable: boolean;
|
|
19
|
+
constructor(message: string, options?: {
|
|
20
|
+
retryable?: boolean;
|
|
21
|
+
cause?: unknown;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Where an error being redacted came from, with the unredacted detail.
|
|
26
|
+
*
|
|
27
|
+
* - `run`: the run's own failure, on its `error` frame. `failure` is what
|
|
28
|
+
* `result().error` returns: the provider's own message, its HTTP status and
|
|
29
|
+
* request id.
|
|
30
|
+
* - `tool`: a tool threw. `cause` is what it threw; the result the model and
|
|
31
|
+
* the client read is the redacted one.
|
|
32
|
+
*/
|
|
33
|
+
export type ErrorRedactionInfo = {
|
|
34
|
+
source: "run";
|
|
35
|
+
failure: AgentError & {
|
|
36
|
+
status?: number;
|
|
37
|
+
requestId?: string;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
source: "tool";
|
|
41
|
+
toolName: string;
|
|
42
|
+
cause: unknown;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Decides what a client (and, for a tool, the model) is told about a failure.
|
|
46
|
+
* Return the error to send. Full detail is never lost: it stays on
|
|
47
|
+
* `result().error`, in the log and in the controller's `onError`.
|
|
48
|
+
*/
|
|
49
|
+
export type ErrorRedactor = (error: AgentError, info: ErrorRedactionInfo) => AgentError;
|
|
50
|
+
/**
|
|
51
|
+
* The default redaction, and what an override of `AgentController.redactError`
|
|
52
|
+
* falls back to.
|
|
53
|
+
*
|
|
54
|
+
* Keeps `code`, `retryable` and `toolCallId`, which are what a client branches
|
|
55
|
+
* on, and replaces a message that did not come from gemi with a fixed sentence
|
|
56
|
+
* for its code. A tool's exception keeps its message only when it is a
|
|
57
|
+
* `ToolError`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function redactError(error: AgentError, info: ErrorRedactionInfo): AgentError;
|
|
60
|
+
/**
|
|
61
|
+
* Runs an app's redactor and keeps only the `AgentError` fields of what it
|
|
62
|
+
* returns, so a redactor that spreads the failure (`{ ...info.failure }`)
|
|
63
|
+
* cannot put its status or request id on the wire by accident. A redactor
|
|
64
|
+
* that throws falls back to the default rather than to the unredacted error.
|
|
65
|
+
*/
|
|
66
|
+
export declare function applyRedaction(redactor: ErrorRedactor | undefined, error: AgentError, info: ErrorRedactionInfo, onFailure: (err: unknown) => void): AgentError;
|
|
67
|
+
export declare function rememberUnredacted(redacted: AgentError, original: AgentError): void;
|
|
68
|
+
/** The original of `error` when it was redacted in this process, else `error`. */
|
|
69
|
+
export declare function unredactedError(error: AgentError): AgentError;
|
|
70
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../ai/redact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;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;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACE,MAAM,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,UAAU,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/D,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"}
|
package/dist/ai/signing.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type NonceStore } from "./store/Nonces";
|
|
1
2
|
/**
|
|
2
3
|
* Signing for pending tool calls.
|
|
3
4
|
*
|
|
@@ -177,19 +178,47 @@ export declare function signNestedRun(claims: NestedRunClaims, options?: SignOpt
|
|
|
177
178
|
*/
|
|
178
179
|
export declare function verifyNestedRun(signature: string, claims: Omit<NestedRunClaims, "runId">, options?: VerifyOptions): VerifyResult;
|
|
179
180
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
181
|
+
* Spending a nonce.
|
|
182
|
+
*
|
|
183
|
+
* The MAC makes a token unforgeable; it does not make it single-use. Without
|
|
184
|
+
* this a captured signature approves the same call again every time it is
|
|
185
|
+
* presented, because a token that carries its own `runId` is a token that
|
|
186
|
+
* asserts its own binding — which is no binding at all. Verifying tells you the
|
|
187
|
+
* server once asked this exact question; spending the nonce is what says nobody
|
|
188
|
+
* has answered it yet.
|
|
189
|
+
*
|
|
190
|
+
* Where spent nonces live is a `NonceStore` (`store/Nonces.ts`, #445). The
|
|
191
|
+
* default is the process-wide `MemoryNonceStore`, which is exact for one
|
|
192
|
+
* instance; an app with several instances gives the agent a shared store
|
|
193
|
+
* (`RedisNonceStore`, or a table) so a rewound history cannot be replayed once
|
|
194
|
+
* against each of them. The store's `consume` is insert-if-absent, so two
|
|
195
|
+
* instances answering at once cannot both win.
|
|
196
|
+
*
|
|
197
|
+
* The other guard is the app's own message store: once a call has a result
|
|
198
|
+
* next to it, the call is no longer open and the answer has nothing to attach
|
|
199
|
+
* to. This is what stands in for that in stateless mode, where the history the
|
|
200
|
+
* client returns can be rewound to before the result existed.
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* Spends a signature's nonce in `store`. `false` means it was already spent —
|
|
204
|
+
* the answer is a replay and must not be acted on — or the token is malformed.
|
|
205
|
+
* A store that throws rejects; the caller refuses the answer.
|
|
182
206
|
*
|
|
183
207
|
* Separate from `verifyPendingCall` rather than folded into it, because verify
|
|
184
208
|
* is a pure question a caller may want to ask twice (logging a forgery, say)
|
|
185
209
|
* and this one is a state change that must happen exactly once per answer.
|
|
186
210
|
*/
|
|
187
|
-
export declare function
|
|
211
|
+
export declare function spendPendingCall(signature: string, store: NonceStore): Promise<boolean>;
|
|
188
212
|
/**
|
|
189
|
-
* Spends a parked-run record's nonce, on the same
|
|
213
|
+
* Spends a parked-run record's nonce, on the same store and the same terms.
|
|
190
214
|
* `false` means the record has already re-entered its tool once — the turn is
|
|
191
215
|
* a replay of a history from before the answer was delivered, and the body
|
|
192
216
|
* must not run again on it.
|
|
193
217
|
*/
|
|
218
|
+
export declare function spendNestedRun(signature: string, store: NonceStore): Promise<boolean>;
|
|
219
|
+
/** `spendPendingCall` on the process-wide default store, synchronously.
|
|
220
|
+
* `now` is injectable for tests. */
|
|
221
|
+
export declare function consumePendingCall(signature: string, options?: VerifyOptions): boolean;
|
|
222
|
+
/** `spendNestedRun` on the process-wide default store, synchronously. */
|
|
194
223
|
export declare function consumeNestedRun(signature: string, options?: VerifyOptions): boolean;
|
|
195
224
|
//# sourceMappingURL=signing.d.ts.map
|
package/dist/ai/signing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../ai/signing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../ai/signing.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IACzC,KAAK,EAAE,OAAO,CAAC;IACf;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAA;CAAE,CAAC;AAkB9D;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAYnD;AAkDD,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,MAAM,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F;AAUD;qCACqC;AACrC,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAG1F;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAGxF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ToolError } from "../redact";
|
|
1
2
|
import type { PutFileParams, ReadFileParams, ReadResult } from "../../services/file-storage/drivers/types";
|
|
2
3
|
import type { Usage } from "../types";
|
|
3
4
|
/**
|
|
@@ -158,17 +159,18 @@ export interface AttachmentStorage {
|
|
|
158
159
|
* is a tenant census delivered through the very tool the injection was aimed at.
|
|
159
160
|
* One error, one wording, one code, for both.
|
|
160
161
|
*
|
|
161
|
-
* A
|
|
162
|
+
* A `ToolError` rather than a `RequestBreakerError`: this is thrown inside a
|
|
162
163
|
* tool, where the agent loop turns a throw into a tool result the model reads
|
|
163
164
|
* and can recover from, not inside a route where it would decide a status code.
|
|
165
|
+
* A `ToolError` so the model and the client are shown its message (#446).
|
|
164
166
|
*/
|
|
165
|
-
export declare class AttachmentNotFoundError extends
|
|
167
|
+
export declare class AttachmentNotFoundError extends ToolError {
|
|
166
168
|
readonly id: string;
|
|
167
169
|
readonly code = "attachment_not_found";
|
|
168
170
|
constructor(id: string);
|
|
169
171
|
}
|
|
170
172
|
/** Raised for a scope no caller could have meant. See `assertScope`. */
|
|
171
|
-
export declare class InvalidAttachmentScopeError extends
|
|
173
|
+
export declare class InvalidAttachmentScopeError extends ToolError {
|
|
172
174
|
readonly code = "invalid_attachment_scope";
|
|
173
175
|
constructor(message: string);
|
|
174
176
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Attachments.d.ts","sourceRoot":"","sources":["../../../ai/store/Attachments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,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AE,MAAM,CAAC;QAClB,4CAA4C;QAC5C,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrE;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IAC3D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiC;IAEhD,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlE,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAY1E,2EAA2E;IAC3E,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,uBAA8B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHO UPLOADED A PROVIDER FILE (#443).
|
|
3
|
+
*
|
|
4
|
+
* A provider's file id (`file-…`) is scoped to the OpenAI/Azure org, not to
|
|
5
|
+
* any user of the app: the vendor will hand the document to whichever request
|
|
6
|
+
* names it. So an id is a bearer token for the file, and ids leak — a shared
|
|
7
|
+
* transcript, a log line, a browser history entry. Before this, a user who
|
|
8
|
+
* learned another user's id could put it in their own `turn.files` and have
|
|
9
|
+
* the model read the other user's document.
|
|
10
|
+
*
|
|
11
|
+
* `AgentController.upload` now records the id with the uploader's owner key
|
|
12
|
+
* (the same `runOwner(req)` that owns a run, #442), and `stream` refuses a
|
|
13
|
+
* turn naming an id recorded for anyone else with a 403.
|
|
14
|
+
*
|
|
15
|
+
* A record is `{ owner, name, mimeType, size, createdAt }`, keyed by the
|
|
16
|
+
* provider's id. `owner: null` is an anonymous upload and is unowned: it
|
|
17
|
+
* answers whoever holds the id, exactly as every id did before this existed.
|
|
18
|
+
*/
|
|
19
|
+
export type FileOwnerRecord = {
|
|
20
|
+
/** `runOwner(req)` at upload: `user:<id>` by default, `null` for anonymous. */
|
|
21
|
+
owner: string | null;
|
|
22
|
+
name?: string;
|
|
23
|
+
mimeType?: string;
|
|
24
|
+
size?: number;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Where the records live. Two methods so an app can put them in its own table:
|
|
29
|
+
*
|
|
30
|
+
* class DbFileOwners implements FileOwners {
|
|
31
|
+
* async record(fileId, record) { await db.agentFile.create({ data: { fileId, ...record } }) }
|
|
32
|
+
* async get(fileId) { return db.agentFile.findUnique({ where: { fileId } }) }
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* `get` answers `null` for an id it has no record of. What the controller does
|
|
36
|
+
* with that is `AgentController.requireKnownFiles`.
|
|
37
|
+
*/
|
|
38
|
+
export interface FileOwners {
|
|
39
|
+
record(fileId: string, record: FileOwnerRecord): Promise<void>;
|
|
40
|
+
get(fileId: string): Promise<FileOwnerRecord | null>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The default: records last as long as the process, like `MemoryAgentStore`
|
|
44
|
+
* and `MemoryAttachmentStore`. Bounded, oldest first, so an upload loop cannot
|
|
45
|
+
* grow it without end; an evicted id reads as unknown.
|
|
46
|
+
*
|
|
47
|
+
* A record is never overwritten: the first owner of an id keeps it, so a
|
|
48
|
+
* second `record` for the same id (which a provider never mints, but a buggy
|
|
49
|
+
* or hostile override could forward) cannot move a file to another user.
|
|
50
|
+
*/
|
|
51
|
+
export declare class MemoryFileOwners implements FileOwners {
|
|
52
|
+
private readonly maxEntries;
|
|
53
|
+
private readonly records;
|
|
54
|
+
constructor(maxEntries?: number);
|
|
55
|
+
record(fileId: string, record: FileOwnerRecord): Promise<void>;
|
|
56
|
+
get(fileId: string): Promise<FileOwnerRecord | null>;
|
|
57
|
+
}
|
|
58
|
+
export declare const defaultFileOwners: MemoryFileOwners;
|
|
59
|
+
//# sourceMappingURL=FileOwners.d.ts.map
|
|
@@ -0,0 +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;CACnB,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;CACtD;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;CAI3D;AAED,eAAO,MAAM,iBAAiB,kBAAyB,CAAC"}
|
|
@@ -33,6 +33,18 @@ export declare class LiveRunNotFoundError extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
export type RegisterParams = {
|
|
35
35
|
threadId?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Who started the run, as an opaque key (`AgentController.runOwner` makes it
|
|
38
|
+
* `user:<id>`), or `null`/absent for a run nobody in particular owns: an
|
|
39
|
+
* anonymous turn, or one the server started itself (#442).
|
|
40
|
+
*
|
|
41
|
+
* Recorded so `attach` and `stop` can tell the caller from the owner without a
|
|
42
|
+
* store round trip: a `threadId`, a `runId` and a client-minted `clientRunId`
|
|
43
|
+
* are all handles a third party can come to hold, and none of them says whose
|
|
44
|
+
* run it is. An owned run answers only the same key; an unowned one answers
|
|
45
|
+
* whoever holds a handle, which is what every run did before this existed.
|
|
46
|
+
*/
|
|
47
|
+
owner?: string | null;
|
|
36
48
|
/**
|
|
37
49
|
* The client's own name for this run, minted before the run had one.
|
|
38
50
|
*
|
|
@@ -141,6 +153,19 @@ export declare class MemoryLiveRuns implements LiveRuns {
|
|
|
141
153
|
seq: number;
|
|
142
154
|
} | null>;
|
|
143
155
|
get(runId: string): AgentRun | null;
|
|
156
|
+
/** Who started the run (see `RegisterParams.owner`); `null` for an unowned
|
|
157
|
+
* run and for one this process does not hold. */
|
|
158
|
+
ownerOf(runId: string): string | null;
|
|
159
|
+
/**
|
|
160
|
+
* Whether `caller` may read or stop the run: an unowned run (and one this
|
|
161
|
+
* process does not hold) answers anyone, an owned one only its owner. A
|
|
162
|
+
* caller with no key (`null`, an anonymous request) is not the owner of
|
|
163
|
+
* anything.
|
|
164
|
+
*/
|
|
165
|
+
mayAccess(runId: string, caller: string | null): boolean;
|
|
166
|
+
/** Whether the run is still going, as opposed to ended and kept for `ttlMs`,
|
|
167
|
+
* or not here at all. */
|
|
168
|
+
isRunning(runId: string): boolean;
|
|
144
169
|
/**
|
|
145
170
|
* The buffered frames from `from` onwards, followed by live ones until the
|
|
146
171
|
* run ends.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveRuns.d.ts","s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IAAI;IAOZ,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,gBAAgB;IA+BxB;;;;OAIG;IACH,OAAO,CAAC,cAAc;CAqBvB;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,gBAAuB,CAAC"}
|
|
@@ -41,6 +41,7 @@ export declare class MemoryAgentStore implements AgentStore {
|
|
|
41
41
|
}>;
|
|
42
42
|
loadThread(threadId: string): Promise<AgentMessage[] | null>;
|
|
43
43
|
appendMessages(threadId: string, messages: AgentMessage[]): Promise<void>;
|
|
44
|
+
removeMessages(threadId: string, messageIds: string[]): Promise<void>;
|
|
44
45
|
/** Test seam, and a way for an app to drop a conversation on request. */
|
|
45
46
|
delete(threadId: string): void;
|
|
46
47
|
get size(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryAgentStore.d.ts","sourceRoot":"","sources":["../../../ai/store/MemoryAgentStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAgB7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,gBAAiB,YAAW,UAAU;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;gFAC4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEjC,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,SAAS,CAAK;gBAEV,MAAM,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAO;IAK/D,YAAY,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAWjF,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,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GAAG,SAAa,GAAG,IAAI;CAW9B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,kBAAyB,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPENT NONCES: what makes a signed answer single-use (#445).
|
|
3
|
+
*
|
|
4
|
+
* A pending call's signature (and a parked sub-run's record) carries a nonce
|
|
5
|
+
* and an expiry. Verifying the MAC says the server once asked this exact
|
|
6
|
+
* question; spending the nonce says nobody has answered it yet. Without that a
|
|
7
|
+
* stateless client rewinds its history to before the result and replays the
|
|
8
|
+
* same signed approval, and the human who approved once has approved forever.
|
|
9
|
+
*
|
|
10
|
+
* Spending has to be shared by every process that can receive the answer, and
|
|
11
|
+
* it has to be atomic: insert-if-absent, so two instances handed the same
|
|
12
|
+
* answer at the same moment cannot both be told "first". A check followed by a
|
|
13
|
+
* write is not enough, since both reads can happen before either write.
|
|
14
|
+
*
|
|
15
|
+
* Implementations:
|
|
16
|
+
*
|
|
17
|
+
* MemoryNonceStore — the default. One process, lost on restart. Correct for
|
|
18
|
+
* a single instance; with several, each instance accepts
|
|
19
|
+
* the same answer once.
|
|
20
|
+
* RedisNonceStore — `SET key 1 PX <ttl> NX` on the app's Redis. Shared,
|
|
21
|
+
* atomic, and Redis drops each key at the token's expiry.
|
|
22
|
+
* your own — e.g. a table with the nonce as its primary key:
|
|
23
|
+
*
|
|
24
|
+
* class DbNonceStore implements NonceStore {
|
|
25
|
+
* async consume(nonce, expiresAt) {
|
|
26
|
+
* // INSERT ... ON CONFLICT (nonce) DO NOTHING, then look at the row count.
|
|
27
|
+
* const inserted = await db.$executeRaw`
|
|
28
|
+
* INSERT INTO agent_nonces (nonce, expires_at)
|
|
29
|
+
* VALUES (${nonce}, ${new Date(expiresAt)})
|
|
30
|
+
* ON CONFLICT (nonce) DO NOTHING`;
|
|
31
|
+
* return inserted === 1;
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* // and, from a cron: DELETE FROM agent_nonces WHERE expires_at < now()
|
|
35
|
+
*
|
|
36
|
+
* Expired tokens fail verification on their own, so a store only has to
|
|
37
|
+
* remember a nonce until `expiresAt`; anything older may be dropped.
|
|
38
|
+
*/
|
|
39
|
+
export interface NonceStore {
|
|
40
|
+
/**
|
|
41
|
+
* Records `nonce` as spent until `expiresAt` (epoch milliseconds). Resolves
|
|
42
|
+
* `true` when this call is the one that spent it, `false` when it was
|
|
43
|
+
* already spent. Must be atomic across every process sharing the store.
|
|
44
|
+
*
|
|
45
|
+
* A rejection is treated as "could not be spent": the answer is refused,
|
|
46
|
+
* and the user is asked again. A replay guard that silently lets an answer
|
|
47
|
+
* through when its backing store is down is not a guard.
|
|
48
|
+
*/
|
|
49
|
+
consume(nonce: string, expiresAt: number): Promise<boolean>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The in-process store. Bounded by the tokens issued in one TTL window: an
|
|
53
|
+
* entry is dropped once its token expires, swept amortized O(1) per insert.
|
|
54
|
+
*/
|
|
55
|
+
export declare class MemoryNonceStore implements NonceStore {
|
|
56
|
+
private readonly spent;
|
|
57
|
+
/** Sweep when the map has grown past this, so sweeping costs O(1) per insert
|
|
58
|
+
* amortized instead of walking every entry on every answer. */
|
|
59
|
+
private sweepAt;
|
|
60
|
+
consume(nonce: string, expiresAt: number): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* The same decision without the promise. JavaScript runs it to completion,
|
|
63
|
+
* so within one process it is atomic. `now` is injectable for tests.
|
|
64
|
+
*/
|
|
65
|
+
consumeSync(nonce: string, expiresAt: number, now?: number): boolean;
|
|
66
|
+
get size(): number;
|
|
67
|
+
private sweep;
|
|
68
|
+
}
|
|
69
|
+
/** The slice of Bun's `RedisClient` this store needs: `send(command, args)`. */
|
|
70
|
+
export interface NonceRedisClient {
|
|
71
|
+
send(command: string, args: string[]): Promise<any>;
|
|
72
|
+
}
|
|
73
|
+
export interface RedisNonceStoreOptions {
|
|
74
|
+
/**
|
|
75
|
+
* Client to run against. Defaults to the app's shared client from
|
|
76
|
+
* `RedisServiceProvider`, resolved on first use so constructing the store
|
|
77
|
+
* never needs a kernel or a connection.
|
|
78
|
+
*/
|
|
79
|
+
client?: NonceRedisClient;
|
|
80
|
+
/** Key namespace. Defaults to `gemi:ai:nonce`. */
|
|
81
|
+
prefix?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Spent nonces in Redis, shared by every instance of the app. `SET ... NX` is
|
|
85
|
+
* a single command, so the insert-if-absent is atomic in Redis; `PX` hands the
|
|
86
|
+
* cleanup to Redis at the token's own expiry.
|
|
87
|
+
*
|
|
88
|
+
* ```ts
|
|
89
|
+
* const nonces = new RedisNonceStore();
|
|
90
|
+
*
|
|
91
|
+
* class ChatController extends AgentController<typeof chat> {
|
|
92
|
+
* agent = chat;
|
|
93
|
+
* nonces = nonces;
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* A Redis failure rejects, and the answer it was checking is refused (see
|
|
98
|
+
* `NonceStore.consume`).
|
|
99
|
+
*/
|
|
100
|
+
export declare class RedisNonceStore implements NonceStore {
|
|
101
|
+
private readonly injectedClient?;
|
|
102
|
+
private readonly prefix;
|
|
103
|
+
constructor(options?: RedisNonceStoreOptions);
|
|
104
|
+
consume(nonce: string, expiresAt: number): Promise<boolean>;
|
|
105
|
+
private get client();
|
|
106
|
+
}
|
|
107
|
+
/** The process-wide default, shared by every agent that is not given a store. */
|
|
108
|
+
export declare const defaultNonceStore: MemoryNonceStore;
|
|
109
|
+
//# sourceMappingURL=Nonces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Nonces.d.ts","sourceRoot":"","sources":["../../../ai/store/Nonces.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK,E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mentDestination, attachmentObjectName, AttachmentNotFoundError, type AttachmentScope, type AttachmentStorage, type AttachmentStore, defaultAttachmentStore, InvalidAttachmentScopeError, MemoryAttachmentStore, newAttachmentId, type PutAttachmentParams, ScopedAttachments, type ToolAttachmentPut, type ToolAttachmentRecord, type ToolAttachments, } from "./Attachments";
|
|
2
|
+
export { defaultFileOwners, type FileOwnerRecord, type FileOwners, MemoryFileOwners, } from "./FileOwners";
|
|
2
3
|
export { defaultAgentStore, MemoryAgentStore } from "./MemoryAgentStore";
|
|
4
|
+
export { defaultNonceStore, MemoryNonceStore, type NonceRedisClient, type NonceStore, RedisNonceStore, type RedisNonceStoreOptions, } from "./Nonces";
|
|
3
5
|
export { FrameCursorEvictedError, LiveRunNotFoundError, liveRuns, MemoryLiveRuns, type RegisterParams, } from "./LiveRuns";
|
|
4
6
|
export { encodeFrame, sseHeaders, sseResponse } from "./sse";
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,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,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,gBAAgB,EACrB,KAAK,UAAU,EACf,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,UAAU,CAAC;AAClB,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"}
|
package/dist/ai/types.d.ts
CHANGED
|
@@ -160,6 +160,15 @@ export type FilePart = {
|
|
|
160
160
|
* `Agent.ts`.
|
|
161
161
|
*/
|
|
162
162
|
attachmentId?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Set by the run when the provider refused `fileId` (a deleted or expired
|
|
165
|
+
* file, an id from the wrong upload purpose, #684). From then on the request
|
|
166
|
+
* carries a line saying the attachment could not be read instead of the id,
|
|
167
|
+
* so one bad file costs one turn a retry rather than failing every turn of
|
|
168
|
+
* the thread. `fileId` is kept, as the record of what was refused; a UI can
|
|
169
|
+
* use the flag to show the file as unreadable.
|
|
170
|
+
*/
|
|
171
|
+
providerRejected?: true;
|
|
163
172
|
};
|
|
164
173
|
/**
|
|
165
174
|
* A sub-agent's run, recorded on the tool call that drove it.
|
|
@@ -348,6 +357,14 @@ export type AgentMessage<T extends ToolShapes = ToolShapes, O = unknown> = {
|
|
|
348
357
|
* calling a tool closes its message `awaiting-input` or `max-steps`.
|
|
349
358
|
*/
|
|
350
359
|
outputTruncated?: true;
|
|
360
|
+
/**
|
|
361
|
+
* What the model call that wrote this assistant message cost — that step
|
|
362
|
+
* alone, not the turn (#467). A run of three steps has three messages, each
|
|
363
|
+
* with its own. Tools' spending (sub-runs, `generate()`, images) is in the
|
|
364
|
+
* run total — `result().usage` and the `usage` frame — and a sub-run's own
|
|
365
|
+
* total is on its `NestedRun`. Absent on user messages and on a message whose
|
|
366
|
+
* call never reported usage (aborted mid-stream).
|
|
367
|
+
*/
|
|
351
368
|
usage?: Usage;
|
|
352
369
|
/**
|
|
353
370
|
* The run writing this message, on a copy the controller stored while the
|
|
@@ -616,7 +633,19 @@ export type AgentStreamEvent<T extends ToolShapes = ToolShapes, O = unknown> = {
|
|
|
616
633
|
messageId: string;
|
|
617
634
|
finishReason: FinishReason;
|
|
618
635
|
outputTruncated?: true;
|
|
619
|
-
|
|
636
|
+
/**
|
|
637
|
+
* What the model call that wrote this message cost, and only it (#467).
|
|
638
|
+
* The same value as `AgentMessage.usage`. Absent when the provider never
|
|
639
|
+
* reported usage for the call (it was aborted mid-stream).
|
|
640
|
+
*/
|
|
641
|
+
usage?: Usage;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* The whole turn's usage so far: every step's model call plus what tools
|
|
645
|
+
* spent through sub-runs, `generate()` and image calls. Not any one message's
|
|
646
|
+
* — that is on `message-end` and `AgentMessage.usage`.
|
|
647
|
+
*/
|
|
648
|
+
| {
|
|
620
649
|
type: "usage";
|
|
621
650
|
usage: Usage;
|
|
622
651
|
}
|