gemi 0.131.0 → 0.133.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/AgentController.d.ts +73 -0
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/AgentProvider.d.ts +25 -0
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/VoiceBridge.d.ts +365 -0
- package/dist/ai/VoiceBridge.d.ts.map +1 -0
- package/dist/ai/index.d.ts +13 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +18 -18
- package/dist/ai/index.js.map +11 -6
- package/dist/ai/providers/endpoints.d.ts +19 -0
- package/dist/ai/providers/endpoints.d.ts.map +1 -1
- package/dist/ai/providers/realtime.d.ts +272 -0
- package/dist/ai/providers/realtime.d.ts.map +1 -0
- package/dist/ai/providers/sideband.d.ts +254 -0
- package/dist/ai/providers/sideband.d.ts.map +1 -0
- package/dist/ai/runtime.d.ts.map +1 -1
- package/dist/ai/types.d.ts +15 -0
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/voice/index.d.ts +23 -0
- package/dist/ai/voice/index.d.ts.map +1 -0
- package/dist/ai/voice/index.js +433 -0
- package/dist/ai/voice/index.js.map +1 -0
- package/dist/ai/voice/state.d.ts +34 -0
- package/dist/ai/voice/state.d.ts.map +1 -0
- package/dist/ai/voice/useVoiceSession.d.ts +82 -0
- package/dist/ai/voice/useVoiceSession.d.ts.map +1 -0
- package/dist/ai/voice/voiceCall.d.ts +57 -0
- package/dist/ai/voice/voiceCall.d.ts.map +1 -0
- package/dist/ai/voice/wire.d.ts +66 -0
- package/dist/ai/voice/wire.d.ts.map +1 -0
- package/dist/ai/voiceConfig.d.ts +70 -0
- package/dist/ai/voiceConfig.d.ts.map +1 -0
- package/dist/ai/voiceMcp.d.ts +89 -0
- package/dist/ai/voiceMcp.d.ts.map +1 -0
- package/dist/ai/voiceStore.d.ts +52 -0
- package/dist/ai/voiceStore.d.ts.map +1 -0
- package/dist/app/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-4gmhx2ba.js → chunk-0eamc2tr.js} +2 -2
- package/dist/{chunk-4gmhx2ba.js.map → chunk-0eamc2tr.js.map} +1 -1
- package/dist/{chunk-2x0n3ze1.js → chunk-0gg4e94v.js} +2 -2
- package/dist/{chunk-2x0n3ze1.js.map → chunk-0gg4e94v.js.map} +1 -1
- package/dist/{chunk-p642ja42.js → chunk-0rhf4g12.js} +3 -3
- package/dist/{chunk-p642ja42.js.map → chunk-0rhf4g12.js.map} +1 -1
- package/dist/{chunk-dxm5gxqk.js → chunk-1awxdnb6.js} +1 -1
- package/dist/{chunk-2senwsdq.js → chunk-2cnawkke.js} +12 -12
- package/dist/{chunk-2senwsdq.js.map → chunk-2cnawkke.js.map} +3 -3
- package/dist/{chunk-fxm8fqh9.js → chunk-33hdxe7v.js} +1 -1
- package/dist/{chunk-63xekerg.js → chunk-3g5q0cj5.js} +2 -2
- package/dist/{chunk-63xekerg.js.map → chunk-3g5q0cj5.js.map} +1 -1
- package/dist/{chunk-xjs72pb0.js → chunk-3h37f124.js} +2 -2
- package/dist/{chunk-xjs72pb0.js.map → chunk-3h37f124.js.map} +1 -1
- package/dist/{chunk-65fq5a9d.js → chunk-4278e429.js} +2 -2
- package/dist/{chunk-65fq5a9d.js.map → chunk-4278e429.js.map} +1 -1
- package/dist/chunk-47e7fbsp.js +5 -0
- package/dist/{chunk-mvka90rq.js.map → chunk-47e7fbsp.js.map} +1 -1
- package/dist/{chunk-p6b0cyf8.js → chunk-4pvv8qs0.js} +2 -2
- package/dist/{chunk-p6b0cyf8.js.map → chunk-4pvv8qs0.js.map} +1 -1
- package/dist/{chunk-rjyw1thg.js → chunk-4t41m5f1.js} +2 -2
- package/dist/{chunk-rjyw1thg.js.map → chunk-4t41m5f1.js.map} +1 -1
- package/dist/{chunk-f21v4n2v.js → chunk-53rr32zm.js} +1 -1
- package/dist/{chunk-xhvknqvn.js → chunk-5pdgh9a1.js} +2 -2
- package/dist/{chunk-xhvknqvn.js.map → chunk-5pdgh9a1.js.map} +1 -1
- package/dist/{chunk-e4ay1vg9.js → chunk-65j32dtn.js} +2 -2
- package/dist/{chunk-e4ay1vg9.js.map → chunk-65j32dtn.js.map} +1 -1
- package/dist/{chunk-jxvec7jc.js → chunk-6fr6j338.js} +2 -2
- package/dist/{chunk-jxvec7jc.js.map → chunk-6fr6j338.js.map} +1 -1
- package/dist/{chunk-jd1afbrs.js → chunk-6hz63ts4.js} +4 -4
- package/dist/{chunk-jd1afbrs.js.map → chunk-6hz63ts4.js.map} +1 -1
- package/dist/{chunk-4z0rt6ws.js → chunk-6qty7at2.js} +2 -2
- package/dist/{chunk-4z0rt6ws.js.map → chunk-6qty7at2.js.map} +1 -1
- package/dist/{chunk-pzb3agv9.js → chunk-7nxnyw7x.js} +2 -2
- package/dist/{chunk-pzb3agv9.js.map → chunk-7nxnyw7x.js.map} +1 -1
- package/dist/{chunk-7n0zn5h4.js → chunk-8ryrjtn0.js} +2 -2
- package/dist/{chunk-7n0zn5h4.js.map → chunk-8ryrjtn0.js.map} +1 -1
- package/dist/{chunk-c1gq2ttb.js → chunk-8sde8337.js} +2 -2
- package/dist/{chunk-c1gq2ttb.js.map → chunk-8sde8337.js.map} +1 -1
- package/dist/{chunk-cggywjzz.js → chunk-99a4e6zf.js} +2 -2
- package/dist/{chunk-cggywjzz.js.map → chunk-99a4e6zf.js.map} +1 -1
- package/dist/chunk-b6yb3svm.js +6 -0
- package/dist/{chunk-539w9yt3.js.map → chunk-b6yb3svm.js.map} +2 -2
- package/dist/{chunk-822p54vc.js → chunk-beb265c9.js} +2 -2
- package/dist/{chunk-822p54vc.js.map → chunk-beb265c9.js.map} +1 -1
- package/dist/{chunk-hdgbh8hn.js → chunk-cxsvzqd4.js} +2 -2
- package/dist/{chunk-hdgbh8hn.js.map → chunk-cxsvzqd4.js.map} +1 -1
- package/dist/{chunk-pahr13xg.js → chunk-dt95z6et.js} +2 -2
- package/dist/{chunk-pahr13xg.js.map → chunk-dt95z6et.js.map} +1 -1
- package/dist/{chunk-hr8annr1.js → chunk-feajsgns.js} +2 -2
- package/dist/{chunk-hr8annr1.js.map → chunk-feajsgns.js.map} +1 -1
- package/dist/{chunk-2tda49mv.js → chunk-ff60bzvf.js} +2 -2
- package/dist/{chunk-2tda49mv.js.map → chunk-ff60bzvf.js.map} +1 -1
- package/dist/{chunk-b00z33zg.js → chunk-gng5e7pd.js} +1 -1
- package/dist/{chunk-mz73066c.js → chunk-gqgpwb88.js} +2 -2
- package/dist/{chunk-mz73066c.js.map → chunk-gqgpwb88.js.map} +1 -1
- package/dist/{chunk-h0xye69a.js → chunk-ha15x5ns.js} +2 -2
- package/dist/{chunk-h0xye69a.js.map → chunk-ha15x5ns.js.map} +1 -1
- package/dist/{chunk-d5g1caxb.js → chunk-hb9hm8za.js} +3 -3
- package/dist/{chunk-d5g1caxb.js.map → chunk-hb9hm8za.js.map} +1 -1
- package/dist/{chunk-8fvt7kys.js → chunk-hf492gg2.js} +1 -1
- package/dist/{chunk-fgtr9cds.js → chunk-hj88dcss.js} +3 -3
- package/dist/{chunk-fgtr9cds.js.map → chunk-hj88dcss.js.map} +1 -1
- package/dist/{chunk-hnf11jhc.js → chunk-j5g7qc5f.js} +2 -2
- package/dist/{chunk-hnf11jhc.js.map → chunk-j5g7qc5f.js.map} +1 -1
- package/dist/{chunk-e1fhy2h5.js → chunk-jgx8ggbz.js} +2 -2
- package/dist/{chunk-e1fhy2h5.js.map → chunk-jgx8ggbz.js.map} +1 -1
- package/dist/{chunk-35zw2s61.js → chunk-jx2mgvvt.js} +3 -3
- package/dist/{chunk-35zw2s61.js.map → chunk-jx2mgvvt.js.map} +1 -1
- package/dist/{chunk-w26cw41m.js → chunk-jx5zx48j.js} +2 -2
- package/dist/{chunk-w26cw41m.js.map → chunk-jx5zx48j.js.map} +1 -1
- package/dist/{chunk-z1gjgr1c.js → chunk-jy9dkgt0.js} +2 -2
- package/dist/{chunk-z1gjgr1c.js.map → chunk-jy9dkgt0.js.map} +1 -1
- package/dist/{chunk-7j48ymk1.js → chunk-k2xeskp6.js} +2 -2
- package/dist/{chunk-7j48ymk1.js.map → chunk-k2xeskp6.js.map} +1 -1
- package/dist/{chunk-jxmc33m9.js → chunk-ka991yx4.js} +2 -2
- package/dist/{chunk-jxmc33m9.js.map → chunk-ka991yx4.js.map} +1 -1
- package/dist/{chunk-65s63bdh.js → chunk-krk880my.js} +2 -2
- package/dist/{chunk-65s63bdh.js.map → chunk-krk880my.js.map} +1 -1
- package/dist/{chunk-x4yq0c9v.js → chunk-m9vwg9j1.js} +3 -3
- package/dist/{chunk-x4yq0c9v.js.map → chunk-m9vwg9j1.js.map} +1 -1
- package/dist/{chunk-x07rp3fc.js → chunk-mpqvmge4.js} +1 -1
- package/dist/{chunk-n7sbwpce.js → chunk-mw7ft5bs.js} +2 -2
- package/dist/{chunk-n7sbwpce.js.map → chunk-mw7ft5bs.js.map} +1 -1
- package/dist/{chunk-v5esvs66.js → chunk-njpnstck.js} +2 -2
- package/dist/{chunk-v5esvs66.js.map → chunk-njpnstck.js.map} +1 -1
- package/dist/{chunk-p320fd3g.js → chunk-p82868xx.js} +2 -2
- package/dist/{chunk-p320fd3g.js.map → chunk-p82868xx.js.map} +1 -1
- package/dist/{chunk-jbd723h1.js → chunk-pm8wjatv.js} +3 -3
- package/dist/{chunk-jbd723h1.js.map → chunk-pm8wjatv.js.map} +1 -1
- package/dist/{chunk-t227jn4b.js → chunk-q15f5g86.js} +2 -2
- package/dist/{chunk-t227jn4b.js.map → chunk-q15f5g86.js.map} +1 -1
- package/dist/{chunk-838cdh6v.js → chunk-qfra7gah.js} +2 -2
- package/dist/{chunk-838cdh6v.js.map → chunk-qfra7gah.js.map} +1 -1
- package/dist/{chunk-aprjvzrz.js → chunk-rnp5k8m3.js} +2 -2
- package/dist/{chunk-aprjvzrz.js.map → chunk-rnp5k8m3.js.map} +1 -1
- package/dist/{chunk-qz89m7ss.js → chunk-rzqft8q8.js} +2 -2
- package/dist/{chunk-qz89m7ss.js.map → chunk-rzqft8q8.js.map} +1 -1
- package/dist/{chunk-zc5962gh.js → chunk-s025aycr.js} +2 -2
- package/dist/{chunk-zc5962gh.js.map → chunk-s025aycr.js.map} +1 -1
- package/dist/{chunk-y14weak4.js → chunk-s21kn0x8.js} +2 -2
- package/dist/{chunk-y14weak4.js.map → chunk-s21kn0x8.js.map} +1 -1
- package/dist/{chunk-3wnczt5w.js → chunk-s55t7rxw.js} +2 -2
- package/dist/{chunk-3wnczt5w.js.map → chunk-s55t7rxw.js.map} +1 -1
- package/dist/{chunk-fzs7g6mc.js → chunk-s782bzeq.js} +2 -2
- package/dist/{chunk-fzs7g6mc.js.map → chunk-s782bzeq.js.map} +1 -1
- package/dist/{chunk-77ymcf7q.js → chunk-sa6cxt3g.js} +2 -2
- package/dist/{chunk-77ymcf7q.js.map → chunk-sa6cxt3g.js.map} +1 -1
- package/dist/{chunk-dz76qhx8.js → chunk-swwkdm75.js} +2 -2
- package/dist/{chunk-dz76qhx8.js.map → chunk-swwkdm75.js.map} +1 -1
- package/dist/{chunk-58mg4rpd.js → chunk-t33yh84d.js} +2 -2
- package/dist/{chunk-58mg4rpd.js.map → chunk-t33yh84d.js.map} +1 -1
- package/dist/{chunk-mym7egdq.js → chunk-vnw91fe1.js} +2 -2
- package/dist/{chunk-mym7egdq.js.map → chunk-vnw91fe1.js.map} +1 -1
- package/dist/{chunk-4wda9teq.js → chunk-w1cksc5z.js} +3 -3
- package/dist/{chunk-4wda9teq.js.map → chunk-w1cksc5z.js.map} +1 -1
- package/dist/chunk-wevj4981.js +122 -0
- package/dist/{chunk-fx7r6pdf.js.map → chunk-wevj4981.js.map} +3 -3
- package/dist/{chunk-ayjfs5mm.js → chunk-wrsf2abe.js} +2 -2
- package/dist/{chunk-ayjfs5mm.js.map → chunk-wrsf2abe.js.map} +1 -1
- package/dist/{chunk-j1wc4afr.js → chunk-x16ckgq1.js} +2 -2
- package/dist/{chunk-j1wc4afr.js.map → chunk-x16ckgq1.js.map} +1 -1
- package/dist/{chunk-gnaxedwh.js → chunk-x51tegk3.js} +2 -2
- package/dist/{chunk-gnaxedwh.js.map → chunk-x51tegk3.js.map} +1 -1
- package/dist/{chunk-qspam5cf.js → chunk-x5hj0mqp.js} +2 -2
- package/dist/{chunk-qspam5cf.js.map → chunk-x5hj0mqp.js.map} +1 -1
- package/dist/{chunk-dp2yz8bj.js → chunk-x9bk5s21.js} +2 -2
- package/dist/{chunk-dp2yz8bj.js.map → chunk-x9bk5s21.js.map} +1 -1
- package/dist/{chunk-p462p2xe.js → chunk-xvvsc58s.js} +2 -2
- package/dist/{chunk-p462p2xe.js.map → chunk-xvvsc58s.js.map} +1 -1
- package/dist/{chunk-0g5f8ymy.js → chunk-xymr3asa.js} +2 -2
- package/dist/{chunk-0g5f8ymy.js.map → chunk-xymr3asa.js.map} +1 -1
- package/dist/{chunk-j4y0sjdc.js → chunk-ysc7ykss.js} +2 -2
- package/dist/{chunk-j4y0sjdc.js.map → chunk-ysc7ykss.js.map} +1 -1
- package/dist/{chunk-3xy41vc0.js → chunk-z61dj480.js} +3 -3
- package/dist/{chunk-3xy41vc0.js.map → chunk-z61dj480.js.map} +1 -1
- package/dist/{chunk-0q68t71d.js → chunk-z9xxthp1.js} +3 -3
- package/dist/{chunk-0q68t71d.js.map → chunk-z9xxthp1.js.map} +1 -1
- package/dist/{chunk-47eav3ex.js → chunk-zv5qyrqg.js} +2 -2
- package/dist/{chunk-47eav3ex.js.map → chunk-zv5qyrqg.js.map} +1 -1
- package/dist/{chunk-asmszzkp.js → chunk-zyhmn3hy.js} +3 -3
- package/dist/{chunk-asmszzkp.js.map → chunk-zyhmn3hy.js.map} +1 -1
- package/dist/{chunk-zzgt759n.js → chunk-zypmy8yq.js} +2 -2
- package/dist/{chunk-zzgt759n.js.map → chunk-zypmy8yq.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 +27 -5
- 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/defaults.d.ts.map +1 -1
- package/dist/orm/index.js +3 -3
- package/dist/orm/index.js.map +3 -3
- 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 +2 -1
- package/dist/chunk-539w9yt3.js +0 -6
- package/dist/chunk-fx7r6pdf.js +0 -122
- package/dist/chunk-mvka90rq.js +0 -5
- /package/dist/{chunk-dxm5gxqk.js.map → chunk-1awxdnb6.js.map} +0 -0
- /package/dist/{chunk-fxm8fqh9.js.map → chunk-33hdxe7v.js.map} +0 -0
- /package/dist/{chunk-f21v4n2v.js.map → chunk-53rr32zm.js.map} +0 -0
- /package/dist/{chunk-b00z33zg.js.map → chunk-gng5e7pd.js.map} +0 -0
- /package/dist/{chunk-8fvt7kys.js.map → chunk-hf492gg2.js.map} +0 -0
- /package/dist/{chunk-x07rp3fc.js.map → chunk-mpqvmge4.js.map} +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"import type { AgentError, AgentErrorCode } from \"./types\";\n\n/**\n * A tool failure whose message is meant to be read: by the model, which can\n * act on it, and by the client, which shows it.\n *\n * Any other exception a tool throws reaches the model and the client as a\n * generic sentence (see `redactError`), because its message is whatever the\n * code underneath happened to say: a database driver's connection string, an\n * internal hostname, a third party's error body. The full error is logged.\n * Throw this instead when the message is written for the person:\n *\n * ```ts\n * if (!order) throw new ToolError(`There is no order ${input.orderId}.`);\n * ```\n */\nexport class ToolError extends Error {\n /** Whether the model may try the call again. Default `true`. */\n readonly retryable: boolean;\n\n constructor(message: string, options: { retryable?: boolean; cause?: unknown } = {}) {\n super(message, options.cause !== undefined ? { cause: options.cause } : undefined);\n this.name = \"ToolError\";\n this.retryable = options.retryable ?? true;\n }\n}\n\n/**\n * Where an error being redacted came from, with the unredacted detail.\n *\n * - `run`: the run's own failure, on its `error` frame. `failure` is what\n * `result().error` returns: the provider's own message, its HTTP status and\n * request id.\n * - `tool`: a tool threw. `cause` is what it threw; the result the model and\n * the client read is the redacted one.\n */\nexport type ErrorRedactionInfo =\n | {\n source: \"run\";\n failure: AgentError & { status?: number; requestId?: string };\n }\n | {\n source: \"tool\";\n toolName: string;\n cause: unknown;\n };\n\n/**\n * Decides what a client (and, for a tool, the model) is told about a failure.\n * Return the error to send. Full detail is never lost: it stays on\n * `result().error`, in the log and in the controller's `onError`.\n */\nexport type ErrorRedactor = (error: AgentError, info: ErrorRedactionInfo) => AgentError;\n\n/**\n * The run failures whose message comes from outside gemi: a provider's error\n * body or an exception's text. Those can carry resource and deployment names,\n * internal URLs, request ids and, in a provider's validation message, pieces of\n * the request itself. The rest (`timeout`, `invalid_output`, `aborted`, ...)\n * are sentences gemi wrote and are kept.\n */\nconst GENERIC_RUN_MESSAGES: Partial<Record<AgentErrorCode, string>> = {\n provider_error: \"The model provider returned an error.\",\n rate_limited: \"The model provider is rate limiting requests. Try again shortly.\",\n context_length_exceeded: \"The conversation is too long for the model.\",\n content_filtered: \"The model provider's content filter blocked this request.\",\n invalid_tool_input: \"The model provider rejected the request.\",\n tool_error: \"A tool failed.\",\n unknown: \"The run failed unexpectedly.\",\n};\n\n/**\n * The default redaction, and what an override of `AgentController.redactError`\n * falls back to.\n *\n * Keeps `code`, `retryable` and `toolCallId`, which are what a client branches\n * on, and replaces a message that did not come from gemi with a fixed sentence\n * for its code. A tool's exception keeps its message only when it is a\n * `ToolError`.\n */\nexport function redactError(error: AgentError, info: ErrorRedactionInfo): AgentError {\n if (info.source === \"tool\") {\n if (info.cause instanceof ToolError) return error;\n return {\n ...error,\n message: `The tool \"${info.toolName}\" failed with an unexpected error.`,\n };\n }\n const generic = GENERIC_RUN_MESSAGES[error.code];\n return generic === undefined ? error : { ...error, message: generic };\n}\n\n/**\n * Runs an app's redactor and keeps only the `AgentError` fields of what it\n * returns, so a redactor that spreads the failure (`{ ...info.failure }`)\n * cannot put its status or request id on the wire by accident. A redactor\n * that throws falls back to the default rather than to the unredacted error.\n */\nexport function applyRedaction(\n redactor: ErrorRedactor | undefined,\n error: AgentError,\n info: ErrorRedactionInfo,\n onFailure: (err: unknown) => void,\n): AgentError {\n let out: AgentError;\n try {\n out = (redactor ?? redactError)(error, info);\n } catch (err) {\n onFailure(err);\n out = redactError(error, info);\n }\n return {\n code: out.code,\n message: out.message,\n ...(out.toolCallId !== undefined ? { toolCallId: out.toolCallId } : {}),\n retryable: out.retryable,\n };\n}\n\n/**\n * The unredacted error behind a redacted one, for the server-side hooks.\n *\n * Keyed by the object put on the frame, which is the object the controller's\n * event hooks are handed in the same process; it never crosses a wire.\n */\nconst unredacted = new WeakMap<AgentError, AgentError>();\n\nexport function rememberUnredacted(redacted: AgentError, original: AgentError): void {\n if (redacted !== original) unredacted.set(redacted, original);\n}\n\n/** The original of `error` when it was redacted in this process, else `error`. */\nexport function unredactedError(error: AgentError): AgentError {\n return unredacted.get(error) ?? error;\n}\n",
|
|
7
7
|
"import { ToolError } from \"../redact\";\nimport type {\n PutFileParams,\n ReadFileParams,\n ReadResult,\n} from \"../../services/file-storage/drivers/types\";\nimport type { Usage } from \"../types\";\n\n/**\n * The bytes of an upload, kept by gemi, and the scope that says whose they are.\n *\n * WHY THIS EXISTS. `AgentController.upload` used to hand the file straight to\n * the model provider and keep nothing, which is the trade `AgentProvider.upload`\n * documents — provider file ids in the history, no storage story. That is a fine\n * trade for vision and it fails the moment a *tool* needs the file: the user\n * uploads an image and asks the agent to create a product, `POST /products`\n * wants multipart bytes, and the server is holding a provider file id and\n * nothing else. The model cannot make up the difference — it *saw* the image, it\n * cannot reproduce it — and the only recovery left is downloading from the\n * vendor, which is a round trip for bytes we held minutes ago, is not declared\n * anywhere (`AgentProvider` has `upload` and no counterpart), and is subject to\n * a retention policy that is not ours.\n *\n * WHY THE SCOPE IS NOT OPTIONAL. Once a tool takes an attachment id as an\n * argument, that id arrives *from the model*, and a model's arguments are as\n * untrusted as a request body: whatever the model wrote is a function of what it\n * read, and it reads the user's text, tool output, and any document it was\n * shown. A store that resolves ids globally therefore lets a prompt-injected\n * model name another tenant's upload and have the server fetch it — the model as\n * confused deputy, spending the server's own credentials.\n *\n * So there is no `find(id)` on this interface, only `find(scope, id)`, and the\n * thing a tool is handed is a `ScopedAttachments` whose methods take no scope at\n * all because it already closed over one. The unscoped read is not discouraged,\n * it is unspellable: the tool has no object to call it on. The scope itself is\n * derived from the server's own knowledge of the request — see\n * `AgentController.attachmentScope` — and never from anything the model can\n * write.\n */\n\n/**\n * The subject an attachment belongs to, as one opaque string.\n *\n * ONE STRING, COMPARED WITH `===`, RATHER THAN A STRUCTURE OF user/thread/org\n * fields. gemi does not have an opinion about tenancy — there is no `Org` in\n * this framework — so a structured scope would have had to be a bag of optional\n * fields, and a bag of optional fields has a worst member: `{}`, which under any\n * partial-match rule matches everything. Every such rule admits `{}` — or\n * `{ userId: undefined }`, which is the same thing arrived at by a typo — so one\n * forgetful line in an app turns the scope check into a no-op that still\n * typechecks. An opaque key has no such member: an app that wants org isolation\n * writes `org:${org.id}` and gets it, and an app that decides a request has no\n * subject returns `null` from `attachmentScope()` and gets no attachment ids at\n * all, rather than a bucket everyone shares.\n *\n * It is an object rather than a bare `string` for one reason, and it is a real\n * one: `find(scope, id)` taking two bare strings is a signature whose arguments\n * can be transposed, and the transposition typechecks, runs, and is a scope\n * check comparing an id against an id. The wrapper makes that a compile error.\n *\n * The key is never shown to the model and never sent to the client. It is a\n * server-side comparison value; it is not a path component and is not parsed.\n */\nexport type AttachmentScope = { readonly key: string };\n\n/**\n * Where an upload's bytes were sent. See `AgentController.attachmentDestination`.\n *\n * `\"provider\"` DESCRIBES A RECORD `upload` NEVER WRITES. A file that goes to the\n * provider alone leaves gemi holding nothing to resolve — `read` and `file`\n * would throw for it — so the route answers `fileId` and mints no attachment id\n * at all, and there is no id for anyone to look up its name with. The value is\n * on this type because a store *can* hold such a row (a custom `AttachmentStore`\n * filing provider uploads for its own bookkeeping is a reasonable thing to\n * write, and `ScopedAttachments` handles it correctly), not because the shipped\n * route produces one.\n */\nexport type AttachmentDestination = \"both\" | \"provider\" | \"storage\";\n\n/**\n * One recorded upload.\n *\n * `fileId` and `objectName` are both optional and at least one is always\n * present, because which of them exists is exactly the destination decision:\n * `provider` has a `fileId` and no bytes of ours, `storage` has bytes and no\n * `fileId`, `both` has both.\n */\nexport type Attachment = {\n /**\n * gemi's id for the upload — the one a tool takes as an argument, and the only\n * id in this module that may be shown to a model.\n *\n * Prefixed `gemi_att_` so that the mistake everyone makes once — a gemi\n * attachment id put into `FilePart.fileId`, which is a *provider* id — is\n * caught by a sentence to read rather than by whatever the vendor says about\n * a file it has never heard of, mid-conversation. `toResponsesInput` checks\n * for the prefix; the vendor's own answer to a bogus `file_id` has not been\n * measured, and the guard does not depend on it.\n */\n id: string;\n /**\n * The scope this was filed under, carried on the record so `ScopedAttachments`\n * can check it a second time. See `ScopedAttachments.get` for why the second\n * check is not redundant.\n */\n scopeKey: string;\n /** The provider file id, when the file was sent to the provider. */\n fileId?: string;\n /** The storage object name, when the bytes were kept. Feed it to `read`. */\n objectName?: string;\n /** The client's filename, kept so a tool can forward the file under it. */\n name: string;\n mimeType: string;\n size: number;\n createdAt: string;\n destination: AttachmentDestination;\n};\n\n/**\n * Where attachment *records* live. The bytes are in `AttachmentStorage`; this\n * holds the row that says which bytes, whose, and under what id.\n *\n * The default is `MemoryAttachmentStore`, which dies with the process, exactly\n * like `MemoryAgentStore`. An app that wants an attachment to outlive a deploy\n * implements this over a table — `id` primary key, `scope_key` column — and\n * assigns it to `AgentController.attachments`.\n *\n * IF YOU IMPLEMENT THIS, THE ONE THING YOU MUST NOT DO is answer `find` from the\n * id alone. `SELECT * FROM attachments WHERE id = ?` is the leak this module\n * exists to prevent, and it passes every test an app writes about its own\n * uploads, because those uploads are always in scope. It is wrong only for an id\n * that came from somewhere else, which is to say only when it matters. The\n * clause is `WHERE id = ? AND scope_key = ?`.\n */\nexport interface AttachmentStore {\n /** Records an attachment under `scope`. The caller has already minted the id. */\n put(scope: AttachmentScope, attachment: Attachment): Promise<void>;\n /**\n * The attachment with this id *within this scope*, or `null`.\n *\n * `null` for an id that does not exist and `null` for an id that exists under\n * another scope, and the caller cannot tell which — deliberately. See\n * `AttachmentNotFoundError`.\n */\n find(scope: AttachmentScope, id: string): Promise<Attachment | null>;\n}\n\n/**\n * The bytes half: whatever the app's file storage is.\n *\n * Structurally satisfied by the `Storage` facade, which is what\n * `AgentController` defaults to. Declared as an interface of two methods rather\n * than as `typeof Storage` so a test — or an app with a second bucket for user\n * uploads — can pass something else without standing up a container.\n */\nexport interface AttachmentStorage {\n put(params: PutFileParams | Blob): Promise<string>;\n read(params: ReadFileParams | string): Promise<ReadResult>;\n}\n\n/**\n * What both a missing id and someone else's id answer.\n *\n * THE MESSAGE MUST NOT SAY WHICH. \"Exists but is not yours\" and \"does not exist\"\n * are two answers to a question the caller is not entitled to ask, and a store\n * that distinguishes them is an oracle: a prompt-injected model that can tell\n * the two apart can walk an id space and report back which ids are live, which\n * is a tenant census delivered through the very tool the injection was aimed at.\n * One error, one wording, one code, for both.\n *\n * A `ToolError` rather than a `RequestBreakerError`: this is thrown inside a\n * tool, where the agent loop turns a throw into a tool result the model reads\n * and can recover from, not inside a route where it would decide a status code.\n * A `ToolError` so the model and the client are shown its message (#446).\n */\nexport class AttachmentNotFoundError extends ToolError {\n readonly code = \"attachment_not_found\";\n constructor(public readonly id: string) {\n super(`No attachment ${id}.`);\n this.name = \"AttachmentNotFoundError\";\n }\n}\n\n/** Raised for a scope no caller could have meant. See `assertScope`. */\nexport class InvalidAttachmentScopeError extends ToolError {\n readonly code = \"invalid_attachment_scope\";\n constructor(message: string) {\n super(message);\n this.name = \"InvalidAttachmentScopeError\";\n }\n}\n\n/**\n * Rejects the empty scope.\n *\n * `{ key: \"\" }` is what an app produces by writing `` `org:${org?.id ?? \"\"}` ``\n * for a request that has no org, and it is the one value that must never reach a\n * store: it compares equal to itself, so every subject-less upload in the\n * process lands in one shared bucket that every subject-less caller can read out\n * of. That is the global store this module exists not to be, arrived at by a\n * template literal. Failing here is loud, happens on the first request, and\n * names the method to fix.\n */\nfunction assertScope(scope: AttachmentScope): AttachmentScope {\n if (!scope || typeof scope.key !== \"string\" || scope.key.length === 0) {\n throw new InvalidAttachmentScopeError(\n \"An attachment scope needs a non-empty key. Return `null` from `attachmentScope()` for a request that has no subject — an empty key is a bucket every caller shares.\",\n );\n }\n return scope;\n}\n\n/** The prefix on every gemi attachment id. See `Attachment.id`. */\nexport const ATTACHMENT_ID_PREFIX = \"gemi_att_\";\n\nexport function newAttachmentId(): string {\n return `${ATTACHMENT_ID_PREFIX}${crypto.randomUUID()}`;\n}\n\n/**\n * The handle a tool is given, and the only attachment API a tool should ever\n * see.\n *\n * IT TAKES NO SCOPE, ON ANY METHOD. That is the whole design, and it is not a\n * convenience: an API where the scope is a parameter is an API where the scope\n * is a parameter someone passes the wrong thing to — and the wrong thing here is\n * whatever the model wrote, because inside a tool body the model's arguments are\n * the variables closest to hand. Handing the tool an object that has already\n * closed over the server's answer leaves nothing to pass. `resolve(id, scope)`\n * was the rejected shape: it is the same code with the mistake still available.\n */\nexport class ScopedAttachments {\n constructor(\n private readonly store: AttachmentStore,\n private readonly storage: AttachmentStorage,\n private readonly scope: AttachmentScope,\n ) {\n assertScope(scope);\n }\n\n /**\n * The scope's key. Read by `ctx.jobs.start` (#461), which records it on the\n * job so a background job gets the same attachments its tool had. Only the\n * key leaves: it is the server's answer, not something a tool can set.\n */\n get scopeKey(): string {\n return this.scope.key;\n }\n\n /**\n * The record for `id`, or `AttachmentNotFoundError`.\n *\n * THE SCOPE IS CHECKED TWICE HERE, and the second check is the one that\n * matters. `store.find` is an app's code — a table lookup somebody wrote, with\n * a `WHERE` clause somebody has to have remembered — and the failure mode of\n * forgetting the scope clause is a query that works perfectly for every upload\n * the app's own tests make. Comparing `record.scopeKey` again is three lines\n * that hold even when that clause is missing, so a careless store finds nothing\n * across scopes instead of leaking.\n *\n * It is not defence against a *malicious* store — an app's store is the app's\n * own code and could return anything. It is defence against the ordinary\n * version of this bug, which is the one that ships.\n */\n async get(id: string): Promise<Attachment> {\n const record = await this.store.find(this.scope, id);\n if (!record || record.scopeKey !== this.scope.key) {\n throw new AttachmentNotFoundError(id);\n }\n return record;\n }\n\n /**\n * The bytes, streaming, with the metadata `createStreamResponse` wants.\n *\n * Throws `AttachmentNotFoundError` for an attachment that exists but whose\n * bytes were never kept — a `provider`-destination upload. The same error as\n * an unknown id, for the reason on that class: \"it is at the vendor and not\n * here\" is information about someone else's upload as readily as about your\n * own.\n */\n async read(id: string): Promise<ReadResult> {\n return await this.readRecord(id, await this.get(id));\n }\n\n /**\n * The bytes for a record already resolved, so `file()` does one lookup rather\n * than two. `store.find` is a `SELECT` in any real store, and the second one\n * was not a second check of anything — same scope, same id, same row.\n *\n * It still takes the id the *caller* asked for, rather than reading\n * `record.id`, so the error stays a function of the caller's own input: an app\n * store that answers with the wrong row must not get to choose which id\n * appears in a message the model may read.\n */\n private async readRecord(id: string, record: Attachment): Promise<ReadResult> {\n if (!record.objectName) {\n throw new AttachmentNotFoundError(id);\n }\n return await this.storage.read({ name: record.objectName });\n }\n\n /**\n * The bytes as a `File`, under the name and type they were uploaded with —\n * which is the shape the motivating case actually needs, because\n * `form.append(\"image\", file)` is what a tool forwarding an upload to a\n * multipart endpoint writes.\n *\n * Buffers, and says so. `read()` is there for anything large enough that\n * buffering it is the wrong call.\n *\n * THIS IS ALSO HOW AN ATTACHMENT OUTLIVES THE RUN, and it is `file()` rather\n * than `read()` that composes for it:\n *\n * const file = await ctx.attachments.file(id);\n * await Storage.put({ name: `pages/${pageId}/hero.png`, body: file });\n *\n * `read()` answers a `ReadResult` whose `body` is `ReadableStream | Blob |\n * null`, and `PutFileParams.body` is `Blob | File | Buffer` — a stream body\n * has nowhere to go without being drained first.\n *\n * Two things that bite on the way out, both silent:\n *\n * - **Do not keep a `gemi_att_` id as an app's durable handle to a file.**\n * The default record store is `MemoryAttachmentStore`, so the id→object\n * mapping dies with the process while the bytes stay in storage. Copy the\n * file under a key of the app's own and keep that.\n * - **Put an extension on that key.** `FileSystemDriver` — the default —\n * ignores `contentType` on write and re-derives the type from the stored\n * path on read, so an extensionless object serves as\n * `application/octet-stream` and an `<img>` pointed at it renders nothing,\n * with no error anywhere. `attachmentObjectName` carries one over for this\n * module's own writes; an app's key is the app's to name.\n */\n async file(id: string): Promise<File> {\n const record = await this.get(id);\n const result = await this.readRecord(id, record);\n const body = result.body;\n const blob =\n body instanceof Blob ? body : body ? await new Response(body).blob() : new Blob([]);\n return new File([blob], record.name, { type: record.mimeType });\n }\n\n /**\n * Stores bytes a tool produced, under this caller's scope, and answers the\n * record.\n *\n * Here rather than on the store because the id, the object name and the scope\n * all have to be decided together, and because an attachment a tool created\n * has to land in the scope the tool is reading from — otherwise a tool writes\n * a file the next tool of the same run cannot see.\n *\n * Nothing is sent to the provider: bytes a tool made are bytes for the app,\n * and a tool that wants the model to look at its output says so by returning\n * something the model can read. Issue #490 builds `ctx.attachments.put(blob)`\n * on exactly this.\n */\n async put(\n blob: Blob,\n params: { name?: string; mimeType?: string; fileId?: string } = {},\n ): Promise<Attachment> {\n const id = newAttachmentId();\n const mimeType = params.mimeType ?? blob.type ?? \"\";\n const name = params.name ?? (blob instanceof File ? blob.name : id);\n const objectName = await this.storage.put({\n name: attachmentObjectName(id, name),\n body: blob,\n contentType: mimeType || undefined,\n });\n const record: Attachment = {\n id,\n scopeKey: this.scope.key,\n objectName,\n name,\n mimeType: mimeType || \"application/octet-stream\",\n size: blob.size,\n createdAt: new Date().toISOString(),\n // `both` when the caller has already sent the same bytes to the provider,\n // which is what `ctx.attachments.put(blob, { showModel: true })` does\n // before it gets here.\n //\n // The parameter exists rather than a second `markShown` call because the\n // alternative is a row that is briefly, and then permanently if the second\n // write fails, a lie: `destination` is the field that says where the bytes\n // went, and a file sitting in the vendor's file list under a record that\n // says `storage` is exactly the discrepancy the field was added to close.\n // Nothing here uploads — the provider is the run's, not this module's —\n // so the id is passed in rather than produced.\n destination: params.fileId ? \"both\" : \"storage\",\n ...(params.fileId ? { fileId: params.fileId } : {}),\n };\n await this.store.put(this.scope, record);\n return record;\n }\n}\n\n/**\n * What a tool asks for when it parks bytes.\n *\n * `showModel` is the whole of issue #490 in one flag: without it a tool's\n * output is an id in a string, which the model can quote back and cannot look\n * at, so \"edit this image\" produces a file nobody but the app ever sees. With\n * it the same bytes also go to the provider and come back into the transcript\n * as an input-role message the next step is built on — generate, look, fix.\n *\n * It is a flag rather than the default because the default costs money on every\n * call. The reasoning is `capabilitiesForModel`'s, run the other way round: a\n * file the model did not need and was shown anyway is an upload plus a set of\n * image tokens on every subsequent request of the run, on an invoice, for a\n * tool whose author never asked to be looked at. A file the model needed and\n * was not shown is a tool that returned an id, which is what tools did before\n * this existed and is visible in the transcript the moment anyone reads it. The\n * expensive mistake is the silent one here, so the expensive thing is opt in.\n */\nexport type PutAttachmentParams = {\n /** The filename to keep, so a later `file()` hands the bytes back under it. */\n name?: string;\n /** Overrides `blob.type`, which a `Blob` built from raw bytes does not have. */\n mimeType?: string;\n /**\n * Also send these bytes to the model provider and put them in front of the\n * model as an input-role message, once this tool call settles.\n *\n * Refused, loudly, by a provider whose `capabilities.fileInput` is false: the\n * request builder drops a file part such a provider cannot read, and an\n * upload paid for, stored, and then dropped on the way to the wire is the\n * silent-forever failure — the tool reports success, the model answers about\n * an image it was never shown, and nothing anywhere says why.\n */\n showModel?: boolean;\n};\n\n/**\n * The attachment API a tool is given, as `ctx.attachments`.\n *\n * Everything a `ScopedAttachments` does, plus `showModel`, plus the memo that\n * makes a re-entered tool call idempotent. It is a separate interface from\n * `ScopedAttachments` because those two additions are not properties of the\n * scope, they are properties of *one tool call*: the run has to know which call\n * a `put` belongs to in order to replay it, and the object handed to a tool is\n * therefore built per call — the same shape `ctx.runAgent` has, for the same\n * reason.\n *\n * The read half (`get`, `read`, `file`) is delegated to the `ScopedAttachments`\n * unchanged, including its two scope checks. A tool reading a file it did not\n * create is reading an id the model wrote, and #489's whole argument applies to\n * it word for word.\n */\nexport interface ToolAttachments {\n /**\n * Parks bytes under this caller's scope and answers the record.\n *\n * ON A REPLAY THIS STORES NOTHING. An escalating tool is re-entered from the\n * top on the next turn, so the body that built this blob has run before and\n * built one already; the record from that first attempt is what comes back,\n * and the bytes handed in now are dropped. That is the same bargain\n * `ctx.runAgent` makes and it is not avoidable: the id from the first attempt\n * is already in the transcript the model read, so minting a second one would\n * leave the model holding an id for bytes nobody kept — and uploading the\n * second copy would pay the vendor twice and put the same image into the\n * context twice. Work *before* a `put` still runs again; if producing the\n * bytes is what costs, branch on `ctx.resumed`.\n */\n put(blob: Blob, params?: PutAttachmentParams): Promise<Attachment>;\n /** The record for `id`, or `AttachmentNotFoundError`. Scoped. */\n get(id: string): Promise<Attachment>;\n /** The bytes, streaming. Scoped. */\n read(id: string): Promise<ReadResult>;\n /** The bytes as a `File`, under their original name and type. Scoped. */\n file(id: string): Promise<File>;\n}\n\n/**\n * One successful `ctx.attachments.put` of one tool call, written down so the\n * next turn can replay it instead of doing it again.\n *\n * Lives on `ToolCallPart.attachments`, indexed by the order the puts happened\n * in — exactly where and how `ToolCallPart.nested` records sub-runs, and for\n * exactly the same reason: the message history is the only state that survives\n * a turn boundary, in a thread and in the browser both, so a memo that is not\n * on the message is a memo a stateless app does not have.\n *\n * `shown` is absent for a plain `put`. When present it carries the provider\n * file id AND the identity of the message injected for it, because both have to\n * come back byte for byte: a replay that minted a fresh message id would put a\n * second copy of the same image in the transcript, and a client that had\n * already applied the first would show it twice.\n */\nexport type ToolAttachmentPut = {\n /** What `put` answered, replayed verbatim. */\n attachment: Attachment;\n /**\n * Set when this slot was filled by `ctx.generateImage` / `ctx.editImage`\n * rather than a plain `put`, carrying what the render reported and the\n * attachment record cannot.\n *\n * WHY THE RENDER IS MEMOIZED AT ALL, and why it is memoized *here*. An\n * escalating tool is re-entered from the top on the next turn, so a render\n * that is not written down is paid for again — and unlike a `put`, the thing\n * being repeated costs money at the vendor and about two minutes of wall\n * clock. The memo cannot hold the image: this record lives in the message\n * history, which goes over the wire and into a store on every turn, and a\n * megabyte of base64 per generated image would go with it. So what is\n * recorded is the attachment id, and the bytes live in storage where they\n * were going anyway.\n *\n * That is the whole reason `ctx.generateImage` answers an `Attachment`\n * instead of a `Blob` while `ImageModel.generate` answers the bytes: outside\n * a run there is nothing to replay and nowhere to park, and inside one there\n * has to be both.\n *\n * `size` is the pixel dimensions the model actually produced — read off the\n * response, which does not always echo the request — and is not derivable\n * from `Attachment.size`, which is a byte count.\n */\n generated?: {\n size: string;\n usage: Usage;\n };\n /** Set when `showModel` was asked for. See above. */\n shown?: {\n /** The provider's file id — what the injected `FilePart` carries. */\n fileId: string;\n /** The injected message's id, so a replay reproduces it rather than a twin. */\n messageId: string;\n /** Its `createdAt`, for the same reason. */\n createdAt: string;\n };\n};\n\n/**\n * A slot in that list, which is one `put` — or one `put` that threw.\n *\n * The failure arm exists because the index is what identifies a `put`, and an\n * index is taken the moment the call is made rather than when it succeeds: a\n * body that runs its puts concurrently must number them by the order it *asked*\n * and not by the order the network answered, or the next turn will not\n * reproduce the numbering. So a `put` that throws and is caught — a provider\n * that cannot read files, a vendor that refuses the type, a storage write that\n * fails — leaves a slot behind, and a later successful `put` in the same call\n * would otherwise leave a hole in front of it. A hole is `null` once it has\n * been through JSON, which is what a consumer walking `part.attachments`\n * crashes on; `{ failed: true }` is the same fact said out loud.\n *\n * It is written lazily, only when a later `put` needs the index above it, so a\n * tool whose puts all threw still adds no `attachments` field at all. And it is\n * not a memo: a replayed slot marked `failed` is re-attempted from scratch,\n * because there is nothing recorded to hand back and the failure may have been\n * the network's rather than the tool's.\n */\nexport type ToolAttachmentRecord = ToolAttachmentPut | { failed: true };\n\n/**\n * The object name an attachment's bytes are stored under.\n *\n * The scope is deliberately NOT in the path. A scope key is app-authored text —\n * `org:${slug}`, with whatever a slug turns out to be — and putting arbitrary\n * app text into an object name is how a `..` or a `/` ends up somewhere nobody\n * meant on the one driver that resolves names literally (`FileSystemDriver`\n * concatenates them onto a folder path). The record is what carries the scope;\n * the object name only has to be unique, and a uuid already is.\n *\n * The extension is carried over from the client's filename when it looks like\n * one, because `FileSystemDriver` reads a stored object's content type back off\n * its path and would otherwise answer `application/octet-stream` for everything.\n * `Attachment.mimeType` is the authority either way — this is for anything that\n * reads the bucket without the record.\n */\nexport function attachmentObjectName(id: string, name: string): string {\n const match = /\\.([A-Za-z0-9]{1,8})$/.exec(name);\n return `attachments/${id}${match ? `.${match[1]!.toLowerCase()}` : \"\"}`;\n}\n\n/**\n * The default: attachment records last as long as the process.\n *\n * Modelled as one flat map keyed by id, holding the scope beside the record and\n * comparing it in `find` — rather than as a map of maps, which would make the\n * scoping structural and unforgettable. That looks like the safer shape and is\n * the wrong reference implementation: an app's store is a table with an `id`\n * primary key and a `scope_key` column, and its `find` is a `WHERE` clause that\n * can be written wrong. The store gemi ships should have the same failure\n * available to it as the store an app writes, so that a test written against\n * this one is a test of the check every real store also has to make.\n */\nexport class MemoryAttachmentStore implements AttachmentStore {\n private readonly rows = new Map<string, Attachment>();\n\n async put(scope: AttachmentScope, attachment: Attachment): Promise<void> {\n assertScope(scope);\n this.rows.set(attachment.id, { ...attachment, scopeKey: scope.key });\n }\n\n async find(scope: AttachmentScope, id: string): Promise<Attachment | null> {\n assertScope(scope);\n const row = this.rows.get(id);\n // The scope clause. An id belonging to another scope answers `null`, which\n // is the answer an id that does not exist gets — see\n // `AttachmentNotFoundError` for why the two must be indistinguishable.\n if (!row || row.scopeKey !== scope.key) {\n return null;\n }\n return row;\n }\n\n /** Test and dev affordance: how many rows are held, across every scope. */\n get size(): number {\n return this.rows.size;\n }\n}\n\n/**\n * The process-wide default, so an app that configures nothing still gets\n * attachment ids that work for the length of a conversation.\n *\n * Module-level for the reason `defaultAgentStore` is: the controller is\n * constructed per request, so a store assigned as `new MemoryAttachmentStore()`\n * in a field initializer is an empty store on every request, and every\n * attachment id is a miss one turn after it was minted.\n */\nexport const defaultAttachmentStore = new MemoryAttachmentStore();\n",
|
|
8
8
|
"import type { AgentError, Usage } from \"../types\";\n\n/**\n * Where a background job stands (#461).\n *\n * `running` until something settles it; `ok` and `error` are final. A job\n * moves out of `running` once, by compare-and-set (`AgentJobStore.transition`),\n * so a queue worker, a provider's webhook, a poller and the deadline sweep can\n * all race to settle the same job and exactly one of them wins.\n */\nexport type AgentJobState = \"running\" | \"ok\" | \"error\";\n\n/**\n * One background job, as the job store keeps it.\n *\n * The record is the job's state, and it is NOT the tool result. The tool\n * result in the thread says `running` and points here by `id`; the controller\n * renders the record's current state over it whenever it loads the thread (see\n * `overlayJobs`). The record is kept apart from the messages because a live\n * run writes whole messages to the store, and a job settling during that run\n * would race those writes and lose.\n */\nexport type AgentJobRecord = {\n /** `ajob_…`. Handed to the app (`JobHandle.id`) to settle a tracked job. */\n id: string;\n threadId: string;\n /** The run whose tool started the job. */\n runId: string;\n /** The tool call whose result this job settles. */\n toolCallId: string;\n toolName: string;\n /** The `runOwner` of the run that started it, or `null` for an anonymous run. */\n owner: string | null;\n /** The `AgentJob` class's queue name, or `null` for a job made with `track`. */\n job: string | null;\n /**\n * What the tool said about the job when it started it: what the model and\n * the UI see while it runs. Server-owned, and kept small by the tool.\n */\n summary?: unknown;\n state: AgentJobState;\n /** The settled output, on `ok`. */\n output?: unknown;\n /** Why it failed, on `error`. Already redacted: this is what the model reads. */\n error?: AgentError;\n /** What the job spent on model and image calls. Counted on the turn that started it. */\n usage?: Usage;\n /**\n * Set when the job's tool result never reached the thread: the run died\n * after the job started and before the result was stored. The job still\n * runs and settles; nothing in the thread shows it.\n */\n orphaned?: true;\n /**\n * The attachment scope key of the run that started the job, so the job's\n * `attachments` are the ones the tool would have had. `null` when the run\n * had none.\n */\n attachmentScope: string | null;\n /** Epoch milliseconds, on the store's clock. */\n createdAt: number;\n updatedAt: number;\n /** When the deadline sweep fails the job if it is still running. */\n deadlineAt: number;\n settledAt?: number;\n};\n\n/** What `create` is given: the record minus what the store stamps. */\nexport type NewAgentJobRecord = Omit<\n AgentJobRecord,\n \"state\" | \"createdAt\" | \"updatedAt\" | \"deadlineAt\" | \"settledAt\"\n> & {\n /** How long from now the job may run, in milliseconds. */\n deadlineMs: number;\n};\n\n/** The fields a transition may write. `id`, the thread and the call never change. */\nexport type AgentJobUpdate = Partial<\n Pick<AgentJobRecord, \"state\" | \"output\" | \"error\" | \"usage\" | \"orphaned\" | \"settledAt\">\n>;\n\n/**\n * Where background jobs live.\n *\n * `MemoryAgentJobStore` is the default and is not durable. `DatabaseAgentJobStore`\n * keeps them in a table. An app that already has a jobs table can implement\n * this over it.\n */\nexport interface AgentJobStore {\n /** Writes a new `running` record and returns it as stored. */\n create(job: NewAgentJobRecord): Promise<AgentJobRecord>;\n get(id: string): Promise<AgentJobRecord | null>;\n /**\n * A thread's jobs, newest first. `states` filters, `limit` bounds. Each\n * record is a copy the caller may keep.\n */\n listForThread(\n threadId: string,\n options?: { states?: AgentJobState[]; limit?: number },\n ): Promise<AgentJobRecord[]>;\n /**\n * Compare-and-set: applies `to` only when the job's state is one of `from`,\n * and answers whether it did. Bumps `updatedAt`, and stamps `settledAt` when\n * `to.state` moves the job out of `running`.\n */\n transition(id: string, from: AgentJobState[], to: AgentJobUpdate): Promise<boolean>;\n /** Running jobs whose `deadlineAt` is at or before `now`, oldest deadline first. */\n overdue(now: number, limit: number): Promise<AgentJobRecord[]>;\n /**\n * The store's clock, in epoch milliseconds. The deadline sweep compares\n * `deadlineAt` against this rather than the process's clock. Optional: a\n * store without one is compared against `Date.now()`.\n */\n now?(): Promise<number>;\n /**\n * Runs `fn` in a transaction, so `ctx.jobs.start` writes the record and\n * queues the job together: both or neither. Optional: without it the record\n * is written first, and a dispatch that fails then fails the record.\n */\n transaction?<T>(fn: () => Promise<T>): Promise<T>;\n}\n\n/** How many settled jobs the memory store keeps per thread before dropping the oldest. */\nconst MEMORY_SETTLED_PER_THREAD = 200;\n\n/**\n * Jobs in a map, for as long as the process lives.\n *\n * NOT DURABLE, like `MemoryAgentStore`: a restart loses every record, and a\n * job that was running is then lost too. The tool result that pointed at it\n * reads as a lost job on the next turn. It is the default so that jobs work in\n * development and tests without a table; use `DatabaseAgentJobStore` in\n * production.\n *\n * It only works when the queue runs the jobs in this same process (the memory\n * queue driver, or a database driver claiming here), since a worker in another\n * process has a map of its own.\n */\nexport class MemoryAgentJobStore implements AgentJobStore {\n private jobs = new Map<string, AgentJobRecord>();\n\n async create(job: NewAgentJobRecord): Promise<AgentJobRecord> {\n if (this.jobs.has(job.id)) {\n throw new Error(`A background job with the id ${job.id} already exists.`);\n }\n const now = Date.now();\n const { deadlineMs, ...fields } = job;\n const record: AgentJobRecord = {\n ...structuredClone(fields),\n state: \"running\",\n createdAt: now,\n updatedAt: now,\n deadlineAt: now + deadlineMs,\n };\n this.jobs.set(record.id, record);\n this.trim(record.threadId);\n return structuredClone(record);\n }\n\n async get(id: string): Promise<AgentJobRecord | null> {\n const record = this.jobs.get(id);\n return record ? structuredClone(record) : null;\n }\n\n async listForThread(\n threadId: string,\n options: { states?: AgentJobState[]; limit?: number } = {},\n ): Promise<AgentJobRecord[]> {\n const out: AgentJobRecord[] = [];\n for (const record of this.jobs.values()) {\n if (record.threadId !== threadId) continue;\n if (options.states && !options.states.includes(record.state)) continue;\n out.push(record);\n }\n out.sort(newestFirst);\n return (options.limit === undefined ? out : out.slice(0, options.limit)).map((record) =>\n structuredClone(record),\n );\n }\n\n async transition(id: string, from: AgentJobState[], to: AgentJobUpdate): Promise<boolean> {\n const record = this.jobs.get(id);\n if (!record || !from.includes(record.state)) return false;\n // Cloned in before anything is assigned, so an output that is not plain\n // data fails the transition rather than half-applying it.\n const update = structuredClone(to);\n const now = Date.now();\n Object.assign(record, update, { updatedAt: now });\n if (update.state && update.state !== \"running\" && record.settledAt === undefined) {\n record.settledAt = update.settledAt ?? now;\n }\n return true;\n }\n\n async overdue(now: number, limit: number): Promise<AgentJobRecord[]> {\n const out: AgentJobRecord[] = [];\n for (const record of this.jobs.values()) {\n if (record.state === \"running\" && record.deadlineAt <= now) out.push(record);\n }\n out.sort((a, b) => a.deadlineAt - b.deadlineAt);\n return out.slice(0, Math.max(0, limit)).map((record) => structuredClone(record));\n }\n\n async now(): Promise<number> {\n return Date.now();\n }\n\n /** Bounds a long-lived thread: running jobs are never dropped, settled ones oldest first. */\n private trim(threadId: string): void {\n const settled = [...this.jobs.values()]\n .filter((record) => record.threadId === threadId && record.state !== \"running\")\n .sort(newestFirst);\n for (const record of settled.slice(MEMORY_SETTLED_PER_THREAD)) this.jobs.delete(record.id);\n }\n}\n\n/** Newest first, with the id as a tie-break so the order is stable. */\nexport function newestFirst(a: AgentJobRecord, b: AgentJobRecord): number {\n return b.createdAt - a.createdAt || (a.id < b.id ? 1 : a.id > b.id ? -1 : 0);\n}\n",
|
|
9
|
-
"import type { ProviderStreamParams } from \"./AgentProvider\";\nimport { supportsStrict, type Schema } from \"./Schema\";\nimport type { AgentError, AgentMessage, Usage } from \"./types\";\n\n/**\n * What one model call needs, whether the agent loop makes it or `generate` does.\n *\n * Moved out of `Agent.ts` rather than copied when `generate` arrived (#594).\n * `generate` is the agent's step without the loop around it — assemble one\n * call, read the stream, parse the answer — so each of these would otherwise\n * exist twice, and the two copies of \"how is a structured answer parsed\" or\n * \"how is usage summed\" are exactly the kind that drift apart unnoticed.\n *\n * Internal. Nothing here is exported from `gemi/ai`.\n */\n\n// --- aborting --------------------------------------------------------------\n\nexport class RunAborted extends Error {\n constructor() {\n super(\"The run was stopped\");\n this.name = \"RunAborted\";\n }\n}\n\nexport function raceAbort<T>(promise: Promise<T>, signal: AbortSignal): Promise<T> {\n if (signal.aborted) {\n return Promise.reject(new RunAborted());\n }\n return new Promise<T>((resolve, reject) => {\n const onAbort = () => reject(new RunAborted());\n signal.addEventListener(\"abort\", onAbort, { once: true });\n promise.then(resolve, reject).finally(() => signal.removeEventListener(\"abort\", onAbort));\n });\n}\n\n// --- usage -----------------------------------------------------------------\n\nexport function emptyUsage(): Usage {\n return { inputTokens: 0, outputTokens: 0, totalTokens: 0 };\n}\n\nexport function addUsage(total: Usage, next: Usage | undefined): Usage {\n if (!next) return total;\n const merged: Usage = {\n inputTokens: total.inputTokens + (next.inputTokens ?? 0),\n outputTokens: total.outputTokens + (next.outputTokens ?? 0),\n totalTokens: total.totalTokens + (next.totalTokens ?? 0),\n };\n if (next.reasoningTokens !== undefined || total.reasoningTokens !== undefined) {\n merged.reasoningTokens = (total.reasoningTokens ?? 0) + (next.reasoningTokens ?? 0);\n }\n if (next.cachedInputTokens !== undefined || total.cachedInputTokens !== undefined) {\n merged.cachedInputTokens = (total.cachedInputTokens ?? 0) + (next.cachedInputTokens ?? 0);\n }\n if (next.imageInputTokens !== undefined || total.imageInputTokens !== undefined) {\n merged.imageInputTokens = (total.imageInputTokens ?? 0) + (next.imageInputTokens ?? 0);\n }\n if (next.imageOutputTokens !== undefined || total.imageOutputTokens !== undefined) {\n merged.imageOutputTokens = (total.imageOutputTokens ?? 0) + (next.imageOutputTokens ?? 0);\n }\n return merged;\n}\n\n// --- structured output -----------------------------------------------------\n\n/**\n * The best parse of a JSON document that is still arriving.\n *\n * Exists so a UI can bind fields before the object closes. It closes whatever\n * brackets are open and drops a trailing key with no value; when even that does\n * not parse it gives up and returns an empty object rather than throwing,\n * because a snapshot is a convenience and a run must not die for one.\n */\nexport function bestEffortParse(text: string): any {\n if (!text.trim()) return {};\n try {\n return JSON.parse(text);\n } catch {\n // fall through to repair\n }\n const closers: string[] = [];\n let inString = false;\n let escaped = false;\n for (const char of text) {\n if (inString) {\n if (escaped) escaped = false;\n else if (char === \"\\\\\") escaped = true;\n else if (char === '\"') inString = false;\n continue;\n }\n if (char === '\"') inString = true;\n else if (char === \"{\") closers.push(\"}\");\n else if (char === \"[\") closers.push(\"]\");\n else if (char === \"}\" || char === \"]\") closers.pop();\n }\n let repaired = text;\n if (inString) repaired += '\"';\n repaired = repaired.replace(/[,:]\\s*$/, \"\");\n const suffix = closers.reverse().join(\"\");\n try {\n return JSON.parse(repaired + suffix);\n } catch {\n // A trailing `\"key\":` leaves a property with no value; drop the key too.\n try {\n return JSON.parse(repaired.replace(/,?\\s*\"[^\"]*\"\\s*$/, \"\") + suffix);\n } catch {\n return {};\n }\n }\n}\n/**\n * The `output` parameter a provider is sent for a schema.\n *\n * `strict` is read off the schema, never chosen: an `s.json()` node anywhere in\n * it has no spelling in strict mode, so a schema containing one is sent\n * non-strict and the provider does not answer 400.\n */\nexport function outputFormat(schema: Schema<any>): NonNullable<ProviderStreamParams[\"output\"]> {\n return { name: \"output\", schema: schema.toJSONSchema(), strict: supportsStrict(schema) };\n}\n\n/**\n * A finished structured answer, checked against its schema.\n *\n * The failure is an `AgentError` with `code: \"invalid_output\"` rather than the\n * schema's own `errors: string[]`, so a caller branches on a code the way it\n * does for `invalid_tool_input`, and the list is joined into the message for a\n * person — or a retry prompt — to read.\n *\n * `bestEffortParse`, not `JSON.parse`, for the reason the agent loop has always\n * used it: the text is the whole answer by now, so the repair has nothing to\n * close, and a document that still does not parse comes back `{}` and fails the\n * schema with a message naming what is missing, instead of a `SyntaxError`\n * position nobody can act on. A cut-off answer never reaches here — see the\n * `length` checks in both callers — because a repaired prefix can pass a loose\n * schema and look finished.\n */\nexport function parseOutput<T>(\n schema: Schema<T>,\n text: string,\n): { ok: true; value: T } | { ok: false; error: AgentError } {\n const parsed = schema.safeParse(bestEffortParse(text));\n if (parsed.ok === true) return { ok: true, value: parsed.value };\n return {\n ok: false,\n error: {\n code: \"invalid_output\",\n message: `The model's structured answer did not match the output schema: ${parsed.errors.join(\", \")}`,\n retryable: true,\n },\n };\n}\n\n// --- building the assistant message ----------------------------------------\n\n/**\n * Resolves a string built by repeated concatenation, in place.\n *\n * `text = text + delta`, run once per streamed token, does not build a string —\n * it builds a rope: a tree of pointers to every fragment, which the engine\n * flattens only when something needs the characters contiguously. A message\n * that nothing reads before it is persisted therefore keeps all of its\n * fragments alive, and the tree costs several times the text.\n *\n * Measured on Bun 1.x, 600 deltas of six characters (a ~450-token answer, 3.5 KB\n * of ASCII): held as a rope, 18.7 KB. Resolved, 3.5 KB — half the UTF-16 size,\n * because a flat ASCII string is stored one byte per character and a rope\n * cannot be. That is 5.3x, and it is paid by every message a store keeps and\n * every run the live registry holds.\n *\n * Indexing is what forces the resolution: `text[0]` cannot be answered without\n * the characters, so the engine collapses the tree and drops the fragments.\n * Nothing is allocated and nothing is copied, which is why this is not\n * `split(\"\").join(\"\")` — that measures the same but allocates one string per\n * character to get there.\n *\n * DO NOT DELETE THIS AS A NO-OP. It reads like one and it is not; the value is\n * the side effect on the receiver. If a future engine does not resolve on\n * index, this silently becomes a real no-op and memory returns to what it is\n * today — a safe failure, which is why it is written as a hint rather than as a\n * round trip through an encoder that would also mangle a lone surrogate.\n */\nexport function resolveRope(text: string): string {\n if (text.length > 0) void text[0];\n return text;\n}\n\nexport function appendText(message: AgentMessage, type: \"text\" | \"reasoning\", delta: string) {\n const last = message.content[message.content.length - 1];\n if (last && last.type === type) {\n (last as { text?: string }).text = ((last as { text?: string }).text ?? \"\") + delta;\n return;\n }\n message.content.push(\n type === \"text\" ? { type: \"text\", text: delta } : { type: \"reasoning\", text: delta },\n );\n}\n\n/**\n * Reasoning is accumulated per ITEM, not per message, and the item's id is kept.\n *\n * This used to go through `appendText`, which merges on the part *type* alone\n * and has nowhere to put an id. Both halves of that were wrong and neither was\n * visible in the transcript:\n *\n * - `request.ts` drops a reasoning item with no id, deliberately — the id is\n * the API's handle on the stored reasoning and a fabricated one would look\n * like continuity that is not there. So an id dropped here meant reasoning\n * was never sent back at all: on a two-step run the model re-derived its\n * own argument from nothing, and the prompt cache (which keys on the\n * literal item) missed every time. Measured against the live Responses API\n * in `live/live.test.ts`: the second call's input carried zero reasoning\n * items.\n * - a step that produces two reasoning items was flattening them into one\n * part, so even with an id there would have been one id for two items'\n * text.\n *\n * A part with no id is still appended rather than dropped: the text is what a\n * UI renders, and a provider that reports no item id (Azure does not always)\n * should still show its thinking. It just cannot be echoed back, which is the\n * bargain `reasoningItem` already documents.\n */\nexport function appendReasoning(message: AgentMessage, id: string | undefined, delta: string) {\n const last = message.content[message.content.length - 1];\n if (last && last.type === \"reasoning\" && last.id === id) {\n last.text = (last.text ?? \"\") + delta;\n return;\n }\n message.content.push(\n id ? { type: \"reasoning\", id, text: delta } : { type: \"reasoning\", text: delta },\n );\n}\n",
|
|
9
|
+
"import type { ProviderStreamParams } from \"./AgentProvider\";\nimport { supportsStrict, type Schema } from \"./Schema\";\nimport type { AgentError, AgentMessage, Usage } from \"./types\";\n\n/**\n * What one model call needs, whether the agent loop makes it or `generate` does.\n *\n * Moved out of `Agent.ts` rather than copied when `generate` arrived (#594).\n * `generate` is the agent's step without the loop around it — assemble one\n * call, read the stream, parse the answer — so each of these would otherwise\n * exist twice, and the two copies of \"how is a structured answer parsed\" or\n * \"how is usage summed\" are exactly the kind that drift apart unnoticed.\n *\n * Internal. Nothing here is exported from `gemi/ai`.\n */\n\n// --- aborting --------------------------------------------------------------\n\nexport class RunAborted extends Error {\n constructor() {\n super(\"The run was stopped\");\n this.name = \"RunAborted\";\n }\n}\n\nexport function raceAbort<T>(promise: Promise<T>, signal: AbortSignal): Promise<T> {\n if (signal.aborted) {\n return Promise.reject(new RunAborted());\n }\n return new Promise<T>((resolve, reject) => {\n const onAbort = () => reject(new RunAborted());\n signal.addEventListener(\"abort\", onAbort, { once: true });\n promise.then(resolve, reject).finally(() => signal.removeEventListener(\"abort\", onAbort));\n });\n}\n\n// --- usage -----------------------------------------------------------------\n\nexport function emptyUsage(): Usage {\n return { inputTokens: 0, outputTokens: 0, totalTokens: 0 };\n}\n\nexport function addUsage(total: Usage, next: Usage | undefined): Usage {\n if (!next) return total;\n const merged: Usage = {\n inputTokens: total.inputTokens + (next.inputTokens ?? 0),\n outputTokens: total.outputTokens + (next.outputTokens ?? 0),\n totalTokens: total.totalTokens + (next.totalTokens ?? 0),\n };\n // A breakdown stays absent until either side reports it, so a text run's\n // usage does not grow fields it never measured.\n for (const key of USAGE_BREAKDOWNS) {\n if (next[key] !== undefined || total[key] !== undefined) {\n merged[key] = (total[key] ?? 0) + (next[key] ?? 0);\n }\n }\n return merged;\n}\n\nconst USAGE_BREAKDOWNS = [\n \"reasoningTokens\",\n \"cachedInputTokens\",\n \"imageInputTokens\",\n \"imageOutputTokens\",\n \"audioInputTokens\",\n \"cachedAudioInputTokens\",\n \"audioOutputTokens\",\n] as const satisfies readonly (keyof Usage)[];\n\n// --- structured output -----------------------------------------------------\n\n/**\n * The best parse of a JSON document that is still arriving.\n *\n * Exists so a UI can bind fields before the object closes. It closes whatever\n * brackets are open and drops a trailing key with no value; when even that does\n * not parse it gives up and returns an empty object rather than throwing,\n * because a snapshot is a convenience and a run must not die for one.\n */\nexport function bestEffortParse(text: string): any {\n if (!text.trim()) return {};\n try {\n return JSON.parse(text);\n } catch {\n // fall through to repair\n }\n const closers: string[] = [];\n let inString = false;\n let escaped = false;\n for (const char of text) {\n if (inString) {\n if (escaped) escaped = false;\n else if (char === \"\\\\\") escaped = true;\n else if (char === '\"') inString = false;\n continue;\n }\n if (char === '\"') inString = true;\n else if (char === \"{\") closers.push(\"}\");\n else if (char === \"[\") closers.push(\"]\");\n else if (char === \"}\" || char === \"]\") closers.pop();\n }\n let repaired = text;\n if (inString) repaired += '\"';\n repaired = repaired.replace(/[,:]\\s*$/, \"\");\n const suffix = closers.reverse().join(\"\");\n try {\n return JSON.parse(repaired + suffix);\n } catch {\n // A trailing `\"key\":` leaves a property with no value; drop the key too.\n try {\n return JSON.parse(repaired.replace(/,?\\s*\"[^\"]*\"\\s*$/, \"\") + suffix);\n } catch {\n return {};\n }\n }\n}\n/**\n * The `output` parameter a provider is sent for a schema.\n *\n * `strict` is read off the schema, never chosen: an `s.json()` node anywhere in\n * it has no spelling in strict mode, so a schema containing one is sent\n * non-strict and the provider does not answer 400.\n */\nexport function outputFormat(schema: Schema<any>): NonNullable<ProviderStreamParams[\"output\"]> {\n return { name: \"output\", schema: schema.toJSONSchema(), strict: supportsStrict(schema) };\n}\n\n/**\n * A finished structured answer, checked against its schema.\n *\n * The failure is an `AgentError` with `code: \"invalid_output\"` rather than the\n * schema's own `errors: string[]`, so a caller branches on a code the way it\n * does for `invalid_tool_input`, and the list is joined into the message for a\n * person — or a retry prompt — to read.\n *\n * `bestEffortParse`, not `JSON.parse`, for the reason the agent loop has always\n * used it: the text is the whole answer by now, so the repair has nothing to\n * close, and a document that still does not parse comes back `{}` and fails the\n * schema with a message naming what is missing, instead of a `SyntaxError`\n * position nobody can act on. A cut-off answer never reaches here — see the\n * `length` checks in both callers — because a repaired prefix can pass a loose\n * schema and look finished.\n */\nexport function parseOutput<T>(\n schema: Schema<T>,\n text: string,\n): { ok: true; value: T } | { ok: false; error: AgentError } {\n const parsed = schema.safeParse(bestEffortParse(text));\n if (parsed.ok === true) return { ok: true, value: parsed.value };\n return {\n ok: false,\n error: {\n code: \"invalid_output\",\n message: `The model's structured answer did not match the output schema: ${parsed.errors.join(\", \")}`,\n retryable: true,\n },\n };\n}\n\n// --- building the assistant message ----------------------------------------\n\n/**\n * Resolves a string built by repeated concatenation, in place.\n *\n * `text = text + delta`, run once per streamed token, does not build a string —\n * it builds a rope: a tree of pointers to every fragment, which the engine\n * flattens only when something needs the characters contiguously. A message\n * that nothing reads before it is persisted therefore keeps all of its\n * fragments alive, and the tree costs several times the text.\n *\n * Measured on Bun 1.x, 600 deltas of six characters (a ~450-token answer, 3.5 KB\n * of ASCII): held as a rope, 18.7 KB. Resolved, 3.5 KB — half the UTF-16 size,\n * because a flat ASCII string is stored one byte per character and a rope\n * cannot be. That is 5.3x, and it is paid by every message a store keeps and\n * every run the live registry holds.\n *\n * Indexing is what forces the resolution: `text[0]` cannot be answered without\n * the characters, so the engine collapses the tree and drops the fragments.\n * Nothing is allocated and nothing is copied, which is why this is not\n * `split(\"\").join(\"\")` — that measures the same but allocates one string per\n * character to get there.\n *\n * DO NOT DELETE THIS AS A NO-OP. It reads like one and it is not; the value is\n * the side effect on the receiver. If a future engine does not resolve on\n * index, this silently becomes a real no-op and memory returns to what it is\n * today — a safe failure, which is why it is written as a hint rather than as a\n * round trip through an encoder that would also mangle a lone surrogate.\n */\nexport function resolveRope(text: string): string {\n if (text.length > 0) void text[0];\n return text;\n}\n\nexport function appendText(message: AgentMessage, type: \"text\" | \"reasoning\", delta: string) {\n const last = message.content[message.content.length - 1];\n if (last && last.type === type) {\n (last as { text?: string }).text = ((last as { text?: string }).text ?? \"\") + delta;\n return;\n }\n message.content.push(\n type === \"text\" ? { type: \"text\", text: delta } : { type: \"reasoning\", text: delta },\n );\n}\n\n/**\n * Reasoning is accumulated per ITEM, not per message, and the item's id is kept.\n *\n * This used to go through `appendText`, which merges on the part *type* alone\n * and has nowhere to put an id. Both halves of that were wrong and neither was\n * visible in the transcript:\n *\n * - `request.ts` drops a reasoning item with no id, deliberately — the id is\n * the API's handle on the stored reasoning and a fabricated one would look\n * like continuity that is not there. So an id dropped here meant reasoning\n * was never sent back at all: on a two-step run the model re-derived its\n * own argument from nothing, and the prompt cache (which keys on the\n * literal item) missed every time. Measured against the live Responses API\n * in `live/live.test.ts`: the second call's input carried zero reasoning\n * items.\n * - a step that produces two reasoning items was flattening them into one\n * part, so even with an id there would have been one id for two items'\n * text.\n *\n * A part with no id is still appended rather than dropped: the text is what a\n * UI renders, and a provider that reports no item id (Azure does not always)\n * should still show its thinking. It just cannot be echoed back, which is the\n * bargain `reasoningItem` already documents.\n */\nexport function appendReasoning(message: AgentMessage, id: string | undefined, delta: string) {\n const last = message.content[message.content.length - 1];\n if (last && last.type === \"reasoning\" && last.id === id) {\n last.text = (last.text ?? \"\") + delta;\n return;\n }\n message.content.push(\n id ? { type: \"reasoning\", id, text: delta } : { type: \"reasoning\", text: delta },\n );\n}\n",
|
|
10
10
|
"import { createHmac, hkdfSync, randomBytes, timingSafeEqual } from \"crypto\";\nimport { defaultNonceStore, type NonceStore } from \"./store/Nonces\";\n\n/**\n * Signing for pending tool calls.\n *\n * A pending call travels through the browser and comes back — in stateless mode\n * the whole history does — so the server cannot trust that what it gets back is\n * what it sent. Without a signature the client asserts not just *that* a call\n * was approved but *what* was approved, and nothing would stop it from\n * returning `approve: true` against an input it rewrote on the way. Signing is\n * what makes the round trip safe, and it is why approvals need no server-side\n * storage at all.\n *\n * What is signed, and what deliberately is not:\n *\n * signed — `runId`, `toolCallId`, the tool `name`, the `kind` of pending call\n * and a canonical serialization of the input, plus a nonce, an\n * expiry, and — for a call a sub-agent asked — the `path` of\n * tool-call ids it is nested under.\n * not — the client's answer. `approve: true` / `approve: false` and a\n * question's output are the *point* of asking; a client that flips\n * its own answer has refused, not forged. What the signature buys is\n * that the answer is bound to the call the server actually made,\n * with the input the server actually saw.\n *\n * A verified token is not yet an answer the server may act on: it says the\n * question was asked, not that it is still open. `consumePendingCall` at the\n * bottom of this file spends the nonce, which is what makes an approval\n * single-use — see the note there for what that guarantee is worth.\n *\n * `kind` is in there for a specific attack: an `approval`-kind call is one the\n * *server* runs, so a client that reused its signature on the \"here is the\n * output\" arm of `ClientToolResult` would be fabricating a server tool's result\n * rather than approving it. Binding the kind makes that a forgery instead of a\n * shape the caller has to remember to check.\n *\n * Keys and principals (#447). Neither token kind is MACed with `SECRET`\n * itself: each is keyed with its own HKDF-derived key (`purposeKey` below), so\n * a MAC minted for one purpose — a pending call, a parked-run record, or\n * anything else in the app keyed off `SECRET` (CSRF, sessions) — is never a\n * MAC for another. And each binds the `subject`, the principal the run was\n * started for (`AgentController.runOwner`), so a token minted while user A was\n * asked cannot be answered by user B, even with A's history in hand.\n */\n\n/** Everything the signature commits to. */\nexport type PendingCallClaims = {\n runId: string;\n toolCallId: string;\n name: string;\n kind: \"approval\" | \"question\" | \"client\";\n input: unknown;\n /**\n * The chain of tool-call ids the call is nested under, outermost first.\n * Absent — or empty, which means the same thing — for a top-level call.\n *\n * A sub-agent's question reaches the user through its parent's pending list,\n * so `toolCallId` stops being an address on its own: two sub-runs under two\n * different tools can each hold a call the outer run never made. Binding the\n * path is what stops a token minted for a call nested under tool call X from\n * being replayed as a top-level call, or as one nested under Y.\n */\n path?: string[];\n /**\n * Who the question was asked of: the run's owner (`AgentController.runOwner`,\n * `user:<id>` by default). `null` or absent is nobody in particular — an\n * anonymous run — and the two are the same claim. A token minted for one\n * subject fails verification for any other, `null` included, so an approval\n * cannot be carried from one user's session to another's.\n */\n subject?: string | null;\n};\n\nexport type SignOptions = {\n /** Overrides `process.env.SECRET`. Exists for tests; apps use the app key. */\n secret?: string;\n /**\n * Default 24 hours. An approval waits on a human, and humans go to lunch —\n * a short expiry turns \"I approved it after standup\" into an unexplained\n * failure. Long enough to survive a working day, short enough that a token\n * lifted from a log is not useful next month.\n */\n ttlMs?: number;\n /** Injected clock, so the expiry path is testable without waiting. */\n now?: number;\n};\n\nexport type VerifyOptions = {\n secret?: string;\n now?: number;\n};\n\n/**\n * A discriminated result rather than a boolean, because the two failures are\n * different events: `expired` is a sentence to show the user, `forged` is worth\n * logging and possibly alerting on. Collapsing them loses the only signal that\n * says someone is probing.\n */\nexport type VerifyResult =\n | { ok: true; runId: string; nonce: string; expiresAt: number }\n | { ok: false; reason: \"malformed\" | \"expired\" | \"forged\" };\n\n/**\n * `agt2` is minted; `agt1` is still verified. A v1 token was MACed with the raw\n * `SECRET` and binds no subject — it is accepted so that a question asked\n * before the upgrade can still be answered after it, and it stops mattering on\n * its own when the last one expires (`DEFAULT_TTL_MS` after the deploy). Drop\n * `LEGACY_VERSION` from the accepted set once that window is long past.\n */\nconst VERSION = \"agt2\";\nconst LEGACY_VERSION = \"agt1\";\nconst PENDING_VERSIONS = [VERSION, LEGACY_VERSION];\nconst DEFAULT_TTL_MS = 24 * 60 * 60 * 1000;\n\n/**\n * The latest expiry a legacy token may claim. Every v1 token this process can\n * legitimately see was minted by an earlier deploy with the default TTL, so it\n * expires no later than one TTL after this module loaded. Bounding it here\n * means a v1 token — MACed with the raw `SECRET`, the key this change exists to\n * stop relying on — cannot be forged with a far-future expiry, and that after\n * one TTL of uptime no v1 token verifies at all.\n */\nconst LEGACY_ACCEPTED_UNTIL = Date.now() + DEFAULT_TTL_MS;\n\nfunction legacyExpiryOk(expiresAt: number): boolean {\n return expiresAt <= LEGACY_ACCEPTED_UNTIL;\n}\n\n/**\n * HKDF `info` labels, one per thing a key signs. Changing a label is a key\n * rotation for that purpose alone.\n */\nconst PENDING_CALL_PURPOSE = \"gemi.ai.pending-call.v1\";\nconst NESTED_RUN_PURPOSE = \"gemi.ai.nested-run.v1\";\nconst EXECUTION_RECEIPT_PURPOSE = \"gemi.ai.execution-receipt.v1\";\nconst HKDF_SALT = \"gemi.ai.signing\";\n\nconst derivedKeys = new Map<string, Buffer>();\n\n/**\n * A key for one purpose, derived from the app secret with HKDF-SHA256.\n *\n * `SECRET` is also what CSRF tokens and sessions are keyed with. Using it as\n * the HMAC key here would make every one of those a potential oracle for the\n * others; HKDF with a purpose label gives each its own independent key, so a\n * weakness or leak in one use cannot be turned against another — including\n * the two token kinds in this file against each other.\n *\n * Memoized per (purpose, secret): verification is on the request path and the\n * derivation is pure. The map is bounded by the number of purposes times the\n * secrets a process ever sees, which is one outside of tests.\n */\nexport function purposeKey(purpose: string, override?: string): Buffer {\n const secret = secretKey(override);\n const cacheKey = `${purpose}\\u0000${secret}`;\n let key = derivedKeys.get(cacheKey);\n if (!key) {\n key = Buffer.from(hkdfSync(\"sha256\", secret, HKDF_SALT, purpose, 32));\n if (derivedKeys.size > 64) derivedKeys.clear();\n derivedKeys.set(cacheKey, key);\n }\n return key;\n}\n\nfunction secretKey(override?: string): string {\n const secret = override ?? process.env.SECRET;\n if (!secret) {\n // Refusing is the only safe answer. A fallback constant would make every\n // approval in every deployment forgeable by anyone who read this file, and\n // it would do it silently — the feature would appear to work.\n throw new Error(\n \"Signing a pending tool call needs an app secret. Set SECRET in the environment.\",\n );\n }\n return secret;\n}\n\n/**\n * Serializes a value so that the same value always produces the same string.\n *\n * `JSON.stringify` is not enough: it preserves insertion order, so an input\n * that made a round trip through a client — parsed and re-serialized, with the\n * keys in whatever order the parser produced — would hash differently and a\n * legitimate approval would come back looking forged. Keys are sorted,\n * `undefined` members are dropped (they do not survive JSON anyway), and arrays\n * keep their order because in an array order *is* the value.\n */\nexport function canonicalize(value: unknown): string {\n if (value === null || typeof value !== \"object\") {\n return JSON.stringify(value) ?? \"null\";\n }\n if (Array.isArray(value)) {\n return `[${value.map(canonicalize).join(\",\")}]`;\n }\n const record = value as Record<string, unknown>;\n const keys = Object.keys(record)\n .filter((key) => record[key] !== undefined)\n .sort();\n return `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalize(record[key])}`).join(\",\")}}`;\n}\n\n/**\n * Length-prefixed rather than delimiter-joined. A separator is a place for two\n * different claim sets to hash the same — `runId: \"a\", toolCallId: \"b|c\"` and\n * `runId: \"a|b\", toolCallId: \"c\"` — and while neither field contains the\n * separator today, that is a property of the id generator, not of this code.\n */\nfunction payload(fields: string[]): string {\n return fields.map((field) => `${field.length}:${field}`).join(\"\");\n}\n\nfunction mac(key: string | Buffer, fields: string[]): Buffer {\n return createHmac(\"sha256\", key).update(payload(fields)).digest();\n}\n\nfunction macMatches(signature: string, expected: Buffer): boolean {\n const presented = Buffer.from(signature.split(\".\")[4], \"base64url\");\n // `timingSafeEqual` throws on a length mismatch, and a wrong length is\n // already a public fact about the token — nothing is leaked by checking it\n // first, and everything is leaked by comparing the bytes with `===`.\n return presented.length === expected.length && timingSafeEqual(presented, expected);\n}\n\n/** The principal as a field: absent and `null` are the same claim. */\nfunction subjectField(subject: string | null | undefined): string {\n return canonicalize(subject ?? null);\n}\n\n/**\n * The v2 claim set. Fixed-length: the path is always present (`[]` at the top\n * level) and so is the subject, so there is no optional field to reason about.\n */\nfunction claimFields(claims: PendingCallClaims, nonce: string, expiresAt: number): string[] {\n return [\n VERSION,\n claims.runId,\n claims.toolCallId,\n claims.name,\n claims.kind,\n nonce,\n String(expiresAt),\n canonicalize(claims.input),\n canonicalize(claims.path ?? []),\n subjectField(claims.subject),\n ];\n}\n\n/**\n * The v1 claim set, kept only to verify tokens minted before #447.\n *\n * The path is appended, and only when there is one.\n *\n * Byte-identical output for a call with no path is the whole requirement here:\n * every approval already in flight was minted from the eight fields below, and\n * a ninth field carrying `\"[]\"` or `\"undefined\"` would invalidate all of them\n * on deploy — the user who clicked Approve before the release would be told\n * their answer was forged. So an absent path adds nothing at all, and an empty\n * array is treated as absent because it says the same thing.\n *\n * `payload` is length-prefixed, so appending a field cannot collide with a\n * longer value in the one before it; that is why this can be an append rather\n * than a new version tag.\n */\nfunction legacyClaimFields(claims: PendingCallClaims, nonce: string, expiresAt: number): string[] {\n const fields = [\n LEGACY_VERSION,\n claims.runId,\n claims.toolCallId,\n claims.name,\n claims.kind,\n nonce,\n String(expiresAt),\n canonicalize(claims.input),\n ];\n if (claims.path && claims.path.length > 0) {\n fields.push(canonicalize(claims.path));\n }\n return fields;\n}\n\nconst encode = (value: string) => Buffer.from(value, \"utf8\").toString(\"base64url\");\nconst decode = (value: string) => Buffer.from(value, \"base64url\").toString(\"utf8\");\n\n/** `agt2.<runId>.<nonce>.<expiry>.<mac>`, all base64url or base36. */\nexport function signPendingCall(claims: PendingCallClaims, options: SignOptions = {}): string {\n const key = purposeKey(PENDING_CALL_PURPOSE, options.secret);\n const now = options.now ?? Date.now();\n const expiresAt = now + (options.ttlMs ?? DEFAULT_TTL_MS);\n const nonce = randomBytes(12).toString(\"base64url\");\n const signature = mac(key, claimFields(claims, nonce, expiresAt)).toString(\"base64url\");\n return [VERSION, encode(claims.runId), nonce, expiresAt.toString(36), signature].join(\".\");\n}\n\n/**\n * The metadata a signature carries in the clear.\n *\n * `Agent` needs the issuing `runId` before it can verify anything: the call was\n * signed under the run that made it, and the turn answering it is a *new* run\n * with a new id. Reading it out of the token is safe because the token's own\n * MAC covers it — a client that edits the runId here fails verification, so\n * this is \"which run does this claim to belong to\", not \"which run does the\n * client say it belongs to\".\n */\nexport function readSignature(\n signature: string,\n): { runId: string; nonce: string; expiresAt: number } | null {\n return readToken(signature, PENDING_VERSIONS);\n}\n\n/**\n * The version tag is checked here and nowhere else, which is what keeps the\n * two token kinds apart: a parked-run record presented where a pending call's\n * signature is expected fails as malformed before its MAC is even looked at,\n * and the other way round. Their claim sets are different lengths and would\n * not collide anyway, but a tag makes that a rule rather than an accident of\n * the field count.\n */\nfunction readToken(\n signature: string,\n versions: readonly string[],\n): { runId: string; nonce: string; expiresAt: number; version: string } | null {\n const parts = signature.split(\".\");\n if (parts.length !== 5 || !versions.includes(parts[0])) {\n return null;\n }\n const expiresAt = Number.parseInt(parts[3], 36);\n if (!Number.isFinite(expiresAt)) {\n return null;\n }\n try {\n return { runId: decode(parts[1]), nonce: parts[2], expiresAt, version: parts[0] };\n } catch {\n return null;\n }\n}\n\nexport function verifyPendingCall(\n signature: string,\n claims: PendingCallClaims,\n options: VerifyOptions = {},\n): VerifyResult {\n const parsed = readToken(signature, PENDING_VERSIONS);\n if (!parsed) {\n return { ok: false, reason: \"malformed\" };\n }\n\n if (parsed.version === LEGACY_VERSION && !legacyExpiryOk(parsed.expiresAt)) {\n return { ok: false, reason: \"forged\" };\n }\n const expected =\n parsed.version === LEGACY_VERSION\n ? // Raw secret, no subject: see `LEGACY_VERSION`.\n mac(secretKey(options.secret), legacyClaimFields(claims, parsed.nonce, parsed.expiresAt))\n : mac(\n purposeKey(PENDING_CALL_PURPOSE, options.secret),\n claimFields(claims, parsed.nonce, parsed.expiresAt),\n );\n if (!macMatches(signature, expected)) {\n return { ok: false, reason: \"forged\" };\n }\n\n // Expiry is checked *after* the MAC on purpose: only a genuine token can be\n // \"expired\". Reporting a forgery as expired would tell the UI to say \"your\n // approval timed out\" to someone who was tampering.\n if ((options.now ?? Date.now()) > parsed.expiresAt) {\n return { ok: false, reason: \"expired\" };\n }\n\n return { ok: true, runId: parsed.runId, nonce: parsed.nonce, expiresAt: parsed.expiresAt };\n}\n\n// --- parked sub-runs -----------------------------------------------------\n\n/**\n * What a parked sub-run's record is signed over.\n *\n * `ToolCallPart.nested` is the parent's own record of where a sub-run stopped,\n * and in stateless mode it makes the same trip through the browser a pending\n * call does. The next turn *runs a tool* on the strength of that record — the\n * tool is re-entered because the record says a sub-run under it is waiting on\n * the question being answered — so an unsigned record lets the client choose\n * which tools run, with what input, before any answer is verified. A MAC over\n * what the server actually recorded is what makes the record safe to carry.\n *\n * Only a parked record is signed, because only a parked record executes\n * anything: a finished sub-run is replayed out of its transcript and spends\n * nothing, and a client that forges one has fed its own tool a made-up answer,\n * which a client-carried history already allows everywhere.\n *\n * Deliberately not signed: the transcript. The sub-run resumes from messages\n * the client carried, exactly as the parent does in stateless mode, and the\n * same argument applies — what the signature pins is that the server parked\n * *here*, on *these* calls, with *this* input, and not what was said on the\n * way.\n */\nexport type NestedRunClaims = {\n /** The root run's id, the one every pending call of the tree is minted under. */\n runId: string;\n /**\n * Tool-call ids from the root down to and including the call the record\n * hangs off. A sub-run's id is not an address on its own for the same reason\n * a nested call's is not: two sub-runs under two different tools can carry\n * the same one.\n */\n path: string[];\n /** The sub-run's own id, so a record cannot be moved between sub-runs. */\n nestedRunId: string;\n /** The tool calls the sub-run is waiting on: every call left open in its transcript. */\n open: string[];\n /**\n * The input the tool that parked was running on, as the transcript carries\n * it. Re-entry runs the tool body with the input the history holds, and the\n * history is the client's — so a record that pinned where the sub-run parked\n * but not what its tool was given would let the client keep the run and\n * rewrite the arguments to anything the schema accepts. The same bargain a\n * pending call makes: the input executed is the input signed.\n */\n input: unknown;\n /** The run's owner, as on `PendingCallClaims.subject`: a record parked for\n * one principal does not re-enter a tool for another. */\n subject?: string | null;\n};\n\n/** `agn2` is minted; `agn1` (raw secret, no subject) is still verified. See\n * `LEGACY_VERSION`. */\nconst NESTED_VERSION = \"agn2\";\nconst LEGACY_NESTED_VERSION = \"agn1\";\nconst NESTED_VERSIONS = [NESTED_VERSION, LEGACY_NESTED_VERSION];\n\nfunction nestedFields(claims: NestedRunClaims, nonce: string, expiresAt: number): string[] {\n return [\n ...legacyNestedFields(claims, nonce, expiresAt, NESTED_VERSION),\n subjectField(claims.subject),\n ];\n}\n\nfunction legacyNestedFields(\n claims: NestedRunClaims,\n nonce: string,\n expiresAt: number,\n version = LEGACY_NESTED_VERSION,\n): string[] {\n return [\n version,\n claims.runId,\n canonicalize(claims.path),\n claims.nestedRunId,\n nonce,\n String(expiresAt),\n // A set, so it is sorted: the ids are read back out of a transcript the\n // client re-serialized, and message order is not part of the claim.\n canonicalize([...claims.open].sort()),\n canonicalize(claims.input),\n ];\n}\n\n/**\n * Same shape as a pending call's token, so the same reader serves both — nonce\n * included, and the nonce is spent, by `consumeNestedRun` below. A verified\n * record is permission to run the tool it hangs off, and the tool body runs\n * before the sub-run gets to look at the answer's own nonce; a record that\n * could be presented twice would run the body twice before anything refused\n * the replay. Every park mints a fresh record, so spending one costs a\n * legitimate re-park nothing.\n */\nexport function signNestedRun(claims: NestedRunClaims, options: SignOptions = {}): string {\n const key = purposeKey(NESTED_RUN_PURPOSE, options.secret);\n const now = options.now ?? Date.now();\n const expiresAt = now + (options.ttlMs ?? DEFAULT_TTL_MS);\n const nonce = randomBytes(12).toString(\"base64url\");\n const signature = mac(key, nestedFields(claims, nonce, expiresAt)).toString(\"base64url\");\n return [NESTED_VERSION, encode(claims.runId), nonce, expiresAt.toString(36), signature].join(\".\");\n}\n\n/**\n * The run that verifies a record is never the run that minted it — the turn\n * answering a question is a new run with a new id — so the minting run's id is\n * read out of the token rather than asked of the caller, which has no other\n * source for it. The MAC covers it, so a client that edits the id in the clear\n * fails here rather than being believed.\n */\nexport function verifyNestedRun(\n signature: string,\n claims: Omit<NestedRunClaims, \"runId\">,\n options: VerifyOptions = {},\n): VerifyResult {\n const parsed = readToken(signature, NESTED_VERSIONS);\n if (!parsed) {\n return { ok: false, reason: \"malformed\" };\n }\n\n if (parsed.version === LEGACY_NESTED_VERSION && !legacyExpiryOk(parsed.expiresAt)) {\n return { ok: false, reason: \"forged\" };\n }\n const full = { ...claims, runId: parsed.runId };\n const expected =\n parsed.version === LEGACY_NESTED_VERSION\n ? mac(secretKey(options.secret), legacyNestedFields(full, parsed.nonce, parsed.expiresAt))\n : mac(\n purposeKey(NESTED_RUN_PURPOSE, options.secret),\n nestedFields(full, parsed.nonce, parsed.expiresAt),\n );\n if (!macMatches(signature, expected)) {\n return { ok: false, reason: \"forged\" };\n }\n\n // A parked record outlives its usefulness with the answers it exists to\n // deliver: those expire on the pending call's TTL, and a record older than\n // that can route nothing that would still verify.\n if ((options.now ?? Date.now()) > parsed.expiresAt) {\n return { ok: false, reason: \"expired\" };\n }\n\n return { ok: true, runId: parsed.runId, nonce: parsed.nonce, expiresAt: parsed.expiresAt };\n}\n\n// --- single use ----------------------------------------------------------\n\n/**\n * Spending a nonce.\n *\n * The MAC makes a token unforgeable; it does not make it single-use. Without\n * this a captured signature approves the same call again every time it is\n * presented, because a token that carries its own `runId` is a token that\n * asserts its own binding — which is no binding at all. Verifying tells you the\n * server once asked this exact question; spending the nonce is what says nobody\n * has answered it yet.\n *\n * Where spent nonces live is a `NonceStore` (`store/Nonces.ts`, #445). The\n * default is the process-wide `MemoryNonceStore`, which is exact for one\n * instance; an app with several instances gives the agent a shared store\n * (`RedisNonceStore`, or a table) so a rewound history cannot be replayed once\n * against each of them. The store's `consume` is insert-if-absent, so two\n * instances answering at once cannot both win.\n *\n * The other guard is the app's own message store: once a call has a result\n * next to it, the call is no longer open and the answer has nothing to attach\n * to. This is what stands in for that in stateless mode, where the history the\n * client returns can be rewound to before the result existed.\n */\n\n/**\n * The id an approved call's execution receipt is kept under (#458).\n *\n * Deterministic in the call the signature covers — the issuing run, the tool\n * call id, the tool, its canonical input, the nesting path and the subject —\n * and in nothing else, so every presentation of one approval, on any instance,\n * names the same receipt. Not in the nonce or expiry: those identify one\n * *token*, and a receipt identifies the *execution* it authorizes.\n *\n * An HMAC under its own HKDF-derived key rather than a plain hash, so an id in\n * a shared store is neither a MAC for anything else nor something a client can\n * compute to probe the store for another user's calls.\n */\nexport function executionReceiptId(\n agent: string,\n claims: PendingCallClaims,\n options: { secret?: string } = {},\n): string {\n const key = purposeKey(EXECUTION_RECEIPT_PURPOSE, options.secret);\n return mac(key, [\n agent,\n claims.runId,\n claims.toolCallId,\n claims.name,\n claims.kind,\n canonicalize(claims.input),\n canonicalize(claims.path ?? []),\n subjectField(claims.subject),\n ]).toString(\"base64url\");\n}\n\n/**\n * Spends a signature's nonce in `store`. `false` means it was already spent —\n * the answer is a replay and must not be acted on — or the token is malformed.\n * A store that throws rejects; the caller refuses the answer.\n *\n * Separate from `verifyPendingCall` rather than folded into it, because verify\n * is a pure question a caller may want to ask twice (logging a forgery, say)\n * and this one is a state change that must happen exactly once per answer.\n */\nexport function spendPendingCall(signature: string, store: NonceStore): Promise<boolean> {\n return spendIn(store, readSignature(signature));\n}\n\n/**\n * Spends a parked-run record's nonce, on the same store and the same terms.\n * `false` means the record has already re-entered its tool once — the turn is\n * a replay of a history from before the answer was delivered, and the body\n * must not run again on it.\n */\nexport function spendNestedRun(signature: string, store: NonceStore): Promise<boolean> {\n return spendIn(store, readToken(signature, NESTED_VERSIONS));\n}\n\nasync function spendIn(\n store: NonceStore,\n parsed: { nonce: string; expiresAt: number } | null,\n): Promise<boolean> {\n if (!parsed) return false;\n return store.consume(parsed.nonce, parsed.expiresAt);\n}\n\n/** `spendPendingCall` on the process-wide default store, synchronously.\n * `now` is injectable for tests. */\nexport function consumePendingCall(signature: string, options: VerifyOptions = {}): boolean {\n const parsed = readSignature(signature);\n return parsed\n ? defaultNonceStore.consumeSync(parsed.nonce, parsed.expiresAt, options.now)\n : false;\n}\n\n/** `spendNestedRun` on the process-wide default store, synchronously. */\nexport function consumeNestedRun(signature: string, options: VerifyOptions = {}): boolean {\n const parsed = readToken(signature, NESTED_VERSIONS);\n return parsed\n ? defaultNonceStore.consumeSync(parsed.nonce, parsed.expiresAt, options.now)\n : false;\n}\n",
|
|
11
11
|
"import type { AgentError } from \"../types\";\n\n/**\n * A non-2xx response, carried as an exception so the retry loop and\n * `normalizeError` can both read it.\n *\n * The body is kept parsed-if-possible and raw-if-not: OpenAI and Azure both\n * answer `{ error: { message, type, code } }` on a good day, and an HTML error\n * page from a proxy on a bad one, and the bad day is exactly when the text\n * matters.\n */\nexport class ProviderHttpError extends Error {\n readonly status: number;\n readonly body: unknown;\n readonly requestId?: string;\n\n constructor(status: number, body: unknown, requestId?: string) {\n super(`Provider request failed with status ${status}: ${describeBody(body)}`);\n this.name = \"ProviderHttpError\";\n this.status = status;\n this.body = body;\n this.requestId = requestId;\n }\n}\n\n/**\n * The request ran out of time. Its own class because it must not read as a\n * user abort: `stop()` means the person is done, and a timeout means the\n * network was, and only one of those is worth trying again.\n */\nexport class ProviderTimeoutError extends Error {\n readonly timeoutMs: number;\n\n constructor(timeoutMs: number) {\n super(`Provider request timed out after ${timeoutMs}ms`);\n this.name = \"ProviderTimeoutError\";\n this.timeoutMs = timeoutMs;\n }\n}\n\nfunction describeBody(body: unknown): string {\n const detail = errorBody(body);\n if (detail?.message) return detail.message;\n if (typeof body === \"string\") return body.slice(0, 500);\n return \"no error body\";\n}\n\ntype OpenAIErrorBody = { message?: string; type?: string; code?: string; param?: string };\n\nfunction errorBody(body: unknown): OpenAIErrorBody | null {\n if (!body || typeof body !== \"object\") return null;\n const wrapper = body as { error?: unknown };\n const inner = wrapper.error && typeof wrapper.error === \"object\" ? wrapper.error : body;\n const e = inner as OpenAIErrorBody & { innererror?: { code?: string } };\n if (typeof e.message !== \"string\" && typeof e.code !== \"string\" && typeof e.type !== \"string\") {\n return null;\n }\n // Azure hides the interesting code one level down when its content filter\n // fires, and the outer code is the useless `content_filter`.\n const code = e.innererror?.code ?? e.code;\n return { message: e.message, type: e.type, code, param: e.param };\n}\n\n/**\n * The HTTP status and request id of a provider failure, read off what was\n * thrown — server-side detail for `AgentRunResult.error`, never for a frame.\n *\n * By shape rather than by `instanceof ProviderHttpError`, so a custom provider\n * whose SDK throws its own error class with a `status` gets the same detail.\n * A `status` outside 100–599 is not an HTTP status and is ignored.\n */\nexport function httpErrorDetail(error: unknown): { status?: number; requestId?: string } {\n if (!error || typeof error !== \"object\") return {};\n const { status, requestId } = error as { status?: unknown; requestId?: unknown };\n return {\n ...(typeof status === \"number\" && status >= 100 && status <= 599 ? { status } : {}),\n ...(typeof requestId === \"string\" && requestId ? { requestId } : {}),\n };\n}\n\n/**\n * Provider failures onto `AgentErrorCode`.\n *\n * The contract an app is buying here is that it can branch on `rate_limited`\n * without knowing whose rate limit it was, and on `retryable` without knowing\n * which of the two APIs answered. So `retryable` is set from what is actually\n * true of the failure — a 429 from a spent quota is not retryable no matter\n * what its status code says, and neither is a request that will be too long\n * again next time.\n */\nexport function normalizeProviderError(error: unknown): AgentError {\n if (error instanceof ProviderTimeoutError) {\n return { code: \"provider_error\", message: error.message, retryable: true };\n }\n\n if (isAbort(error)) {\n return { code: \"aborted\", message: \"The request was aborted.\", retryable: false };\n }\n\n if (error instanceof ProviderHttpError) {\n return fromStatus(error.status, errorBody(error.body), error.message);\n }\n\n // `fetch` rejects with a TypeError for DNS failures, refused connections and\n // dropped sockets. Every one of those is worth another attempt.\n if (error instanceof TypeError) {\n return {\n code: \"provider_error\",\n message: `Could not reach the provider: ${error.message}`,\n retryable: true,\n };\n }\n\n if (error instanceof Error) {\n return { code: \"provider_error\", message: error.message, retryable: false };\n }\n\n return { code: \"unknown\", message: String(error), retryable: false };\n}\n\nfunction fromStatus(\n status: number,\n body: OpenAIErrorBody | null,\n fallbackMessage: string,\n): AgentError {\n const message = body?.message ?? fallbackMessage;\n const code = (body?.code ?? \"\").toLowerCase();\n const type = (body?.type ?? \"\").toLowerCase();\n const haystack = `${code} ${type} ${message}`.toLowerCase();\n\n if (status === 429) {\n // A spent quota answers 429 and will answer 429 for the rest of the month.\n // Retrying it is how a run turns one billing problem into `maxRetries`\n // billing problems and a much later error message.\n const outOfCredit = code === \"insufficient_quota\" || haystack.includes(\"quota\");\n return { code: \"rate_limited\", message, retryable: !outOfCredit };\n }\n\n if (status >= 500 || status === 408 || status === 409) {\n return { code: \"provider_error\", message, retryable: true };\n }\n\n if (isContextLength(haystack)) {\n return { code: \"context_length_exceeded\", message, retryable: false };\n }\n\n if (isContentFilter(haystack)) {\n return { code: \"content_filtered\", message, retryable: false };\n }\n\n // A schema the API refused. It is our request that is wrong, so the run\n // should surface it as a tool problem rather than a generic outage.\n if (body?.param?.startsWith(\"tools\") || haystack.includes(\"invalid schema for function\")) {\n return { code: \"invalid_tool_input\", message, retryable: false };\n }\n\n return { code: \"provider_error\", message, retryable: false };\n}\n\nfunction isContextLength(haystack: string): boolean {\n return (\n haystack.includes(\"context_length_exceeded\") ||\n haystack.includes(\"maximum context length\") ||\n haystack.includes(\"context window\") ||\n haystack.includes(\"reduce the length\")\n );\n}\n\nfunction isContentFilter(haystack: string): boolean {\n return (\n haystack.includes(\"content_filter\") ||\n haystack.includes(\"content_policy_violation\") ||\n haystack.includes(\"responsibleaipolicyviolation\") ||\n haystack.includes(\"content management policy\")\n );\n}\n\nfunction isAbort(error: unknown): boolean {\n if (!error || typeof error !== \"object\") return false;\n const e = error as { name?: string; code?: string };\n return e.name === \"AbortError\" || e.code === \"ABORT_ERR\";\n}\n",
|
|
12
12
|
"/**\n * Bounding what a long thread sends to the model (#473).\n *\n * A threaded conversation grows without end, and before this nothing in gemi\n * bounded what a turn sent: the whole `loadThread` went to the provider until\n * it answered `context_length_exceeded`. These are the pieces an app needs to\n * bound it where the model call is, rather than in its store:\n *\n * - `turnStarts` / `splitTurns`: where the user's turns begin. A cut made at\n * one never separates a tool call from its result, since a result is stored\n * in the message that made the call, and never strands a tool-injected file\n * message (user role, but not a turn) from the call that showed it.\n * - `windowMessages`: a built-in policy over those turns (at most N turns, at\n * most N bytes or approximate tokens), with cut points that move in steps so\n * the provider's prompt cache keeps hitting.\n *\n * `Agent.create({ contextWindow })` applies the policy on every model call, and\n * `prepareStep` is the hook for anything else. Neither changes what is stored:\n * they shape the request, and the run's history, `onMessage` and the store\n * see every message as before.\n */\n\nimport type { ContextCompactOptions } from \"./contextCompaction\";\nimport type { AgentMessage, ToolCallPart, ToolSearchRecord } from \"./types\";\n\n/**\n * The ids of the messages a tool injected to show a file, read from the\n * `ToolCallPart.attachments` records in `messages`.\n *\n * The record is the test, not `attachmentId` on the part: a user's own upload\n * carries an `attachmentId` too. Such a message has the user's role but is not\n * the user's turn, which is why `turnStarts` steps over it.\n */\nexport function injectedMessageIds(messages: readonly AgentMessage[]): Set<string> {\n const injected = new Set<string>();\n for (const message of messages) {\n for (const part of message.content ?? []) {\n if (part.type !== \"tool-call\") continue;\n for (const record of part.attachments ?? []) {\n if (record && \"shown\" in record && record.shown) injected.add(record.shown.messageId);\n }\n }\n }\n return injected;\n}\n\n/**\n * The index of the first message of every turn in `messages`.\n *\n * A turn starts at a user message that no tool injected, and runs until the\n * next one: the assistant's steps, their tool calls with their results (which\n * are stored on the same message as the call), and any file a tool showed.\n * Index 0 always starts a turn, so messages before the first user message (a\n * greeting, a run cut short before its turn was stored) belong to the first\n * turn rather than to none. Empty for an empty list.\n */\nexport function turnStarts(messages: readonly AgentMessage[]): number[] {\n if (messages.length === 0) return [];\n const injected = injectedMessageIds(messages);\n const starts = [0];\n for (let index = 1; index < messages.length; index++) {\n const message = messages[index]!;\n if (message.role === \"user\" && !injected.has(message.id)) starts.push(index);\n }\n return starts;\n}\n\n/** `messages` grouped into turns. See `turnStarts`. */\nexport function splitTurns(messages: readonly AgentMessage[]): AgentMessage[][] {\n const starts = turnStarts(messages);\n return starts.map((start, index) => messages.slice(start, starts[index + 1] ?? messages.length));\n}\n\n/**\n * Roughly how much a message costs to send: the length of its JSON. A file\n * part counts as its reference, not its bytes, which is what the request\n * carries. Good enough to budget with, and the same number for the same\n * message every time, which is what keeps a cut point stable.\n */\nexport function messageSize(message: AgentMessage): number {\n try {\n return JSON.stringify(message).length;\n } catch {\n return 0;\n }\n}\n\n/** Characters per token when a budget is given in `maxTokens`. */\nconst CHARS_PER_TOKEN = 4;\n\n/** `ContextWindowOptions.step`'s default. */\nexport const DEFAULT_CONTEXT_WINDOW_STEP = 10;\n\n/** `ContextWindowOptions.note`'s default. */\nexport const DEFAULT_CONTEXT_WINDOW_NOTE = \"[Earlier turns of this conversation are not shown.]\";\n\nexport type ContextWindowOptions = {\n /** The most turns sent. The latest turn is always sent, whatever the limits. */\n maxTurns?: number;\n /**\n * The most characters of message JSON sent (see `messageSize`). The system\n * prompt and the tools' schemas are not counted.\n */\n maxBytes?: number;\n /**\n * The same budget in approximate tokens (four characters each). When both\n * are given, the smaller one applies.\n */\n maxTokens?: number;\n /**\n * How many turns the start of the window moves at a time. Default 10.\n *\n * A window that slid one turn per turn would send a different first message\n * on every turn, and the provider's prompt cache (a prefix cache) would miss\n * on every turn. With a step, the first kept turn is the 0th, the 10th, the\n * 20th, … of the thread, so consecutive turns send the same prefix until the\n * window has to move again. The cost is that the window holds up to `step`\n * fewer turns than the limits would allow. `1` slides one turn at a time.\n */\n step?: number;\n /**\n * Put at the start of the first kept turn when turns were left out, so the\n * model knows the conversation goes back further. Default\n * `DEFAULT_CONTEXT_WINDOW_NOTE`; `false` for none. A function gets how much\n * was left out and answers the text, or `false`.\n */\n note?: string | false | ((omitted: { turns: number; messages: number }) => string | false);\n /**\n * Summarise the turns left out instead of dropping them (#782). Off unless\n * set; `true` uses the defaults. Applies to a run with a `threadId` (a\n * stored thread), at the top level; anything else, stateless threads\n * included, gets the plain window. `windowMessages` itself ignores it. See\n * `ContextCompactOptions`.\n *\n * Turns are summarised when the window leaves them out and, with\n * `compact.triggerTokens`, once the turns sent would be over that many\n * tokens. The summary is made with one or more provider calls when the\n * window's start moves (every `step` turns), usually in the background\n * after the turn before; kept per thread in a `SummaryStore`; and sent as a\n * user message in front of the kept turns, in place of `note`. Its usage is\n * billed once, to a run that waits on it or uses it. If it fails, the run\n * sends the plain window with `note`.\n */\n compact?: boolean | ContextCompactOptions;\n};\n\nexport type ContextWindowResult = {\n /** What to send. New objects only where something changed (the note, a\n * carried search); every other message is the one passed in. */\n messages: AgentMessage[];\n /** The index in the input of the first kept turn's first message. */\n start: number;\n /** How many turns and messages were left out. Both 0 when nothing was. */\n omittedTurns: number;\n omittedMessages: number;\n};\n\n/**\n * The latest turns of `messages` that fit `options`.\n *\n * - Cuts only at a turn start (`turnStarts`), so a tool call keeps its result\n * and a tool-injected file stays below the call that showed it.\n * - Always keeps the latest turn, even when it alone is over the budget: an\n * empty request is worse than an oversized one, and the provider is the\n * judge of whether it fits.\n * - Moves the cut `step` turns at a time, counted from the thread's first\n * turn, so the prefix sent stays the same from turn to turn (see `step`).\n * When no step-aligned cut fits (one huge turn), it falls back to the\n * earliest turn that does.\n * - Keeps `system` messages from before the cut, at the front: they are\n * instructions, not conversation.\n * - Carries tool searches over the cut (#777). A namespaced or deferred tool\n * is only loaded for the model by a search in its history, so a kept call to\n * one whose search was left out gets that search put back on it (on a copy).\n *\n * Pure: the input is never changed, and the same input gives the same output.\n */\nexport function windowMessages(\n messages: readonly AgentMessage[],\n options: ContextWindowOptions = {},\n): ContextWindowResult {\n const all = [...messages];\n const starts = turnStarts(all);\n const budget = byteBudget(options);\n const maxTurns = positive(options.maxTurns) ?? Infinity;\n const step = Math.max(1, Math.floor(positive(options.step) ?? DEFAULT_CONTEXT_WINDOW_STEP));\n\n if (starts.length <= 1 || (maxTurns >= starts.length && budget === Infinity)) {\n return { messages: all, start: 0, omittedTurns: 0, omittedMessages: 0 };\n }\n\n // Characters from each message to the end: what a cut there would send.\n // System messages kept from before the cut are not counted.\n const sizeFrom: number[] = Array.from({ length: all.length + 1 }, () => 0);\n if (budget !== Infinity) {\n for (let index = all.length - 1; index >= 0; index--) {\n sizeFrom[index] = sizeFrom[index + 1]! + messageSize(all[index]!);\n }\n }\n const fits = (turn: number) =>\n starts.length - turn <= maxTurns && sizeFrom[starts[turn]!]! <= budget;\n\n let first = -1;\n for (let turn = 0; turn < starts.length; turn += step) {\n if (fits(turn)) {\n first = turn;\n break;\n }\n }\n if (first < 0) {\n for (let turn = 0; turn < starts.length; turn++) {\n if (fits(turn)) {\n first = turn;\n break;\n }\n }\n }\n if (first < 0) first = starts.length - 1;\n if (first === 0) return { messages: all, start: 0, omittedTurns: 0, omittedMessages: 0 };\n\n const start = starts[first]!;\n const dropped = all.slice(0, start);\n const pinned = dropped.filter((message) => message.role === \"system\");\n const kept = carrySearches(dropped, all.slice(start));\n\n const omitted = { turns: first, messages: dropped.length - pinned.length };\n const note =\n typeof options.note === \"function\"\n ? options.note(omitted)\n : options.note === undefined\n ? DEFAULT_CONTEXT_WINDOW_NOTE\n : options.note;\n if (note) {\n const head = kept[0]!;\n kept[0] = { ...head, content: [{ type: \"text\", text: note }, ...head.content] };\n }\n\n return {\n messages: [...pinned, ...kept],\n start,\n omittedTurns: omitted.turns,\n omittedMessages: omitted.messages,\n };\n}\n\nfunction positive(value: number | undefined): number | undefined {\n return typeof value === \"number\" && value > 0 ? value : undefined;\n}\n\nfunction byteBudget(options: ContextWindowOptions): number {\n const bytes = positive(options.maxBytes) ?? Infinity;\n const tokens = positive(options.maxTokens);\n return Math.min(bytes, tokens === undefined ? Infinity : tokens * CHARS_PER_TOKEN);\n}\n\n/**\n * What a search has to have loaded for a call to make sense: the call's\n * namespace, or, for a deferred tool outside any namespace, its name.\n */\nfunction covers(search: ToolSearchRecord, call: ToolCallPart): boolean {\n const namespaces = Array.isArray(search?.namespaces) ? search.namespaces : [];\n const loaded = Array.isArray(search?.loaded) ? search.loaded : [];\n return call.namespace ? namespaces.includes(call.namespace) : loaded.includes(String(call.name));\n}\n\nfunction searchesOf(part: ToolCallPart): ToolSearchRecord[] {\n return Array.isArray(part.toolSearches) ? part.toolSearches : [];\n}\n\n/**\n * `kept`, with the searches from `dropped` that a kept call still depends on\n * put back on the first call that needs one.\n *\n * A call needs a dropped search when no search before it in `kept` (its own\n * included) covers it and one in `dropped` does. All such searches go on the\n * first call that needs any, in their original order, so every later call is\n * covered by them too. Deterministic in the cut, which keeps the prefix the\n * same from turn to turn while the cut stays put.\n */\nfunction carrySearches(dropped: AgentMessage[], kept: AgentMessage[]): AgentMessage[] {\n const droppedSearches: ToolSearchRecord[] = [];\n for (const message of dropped) {\n for (const part of message.content ?? []) {\n if (part.type === \"tool-call\") droppedSearches.push(...searchesOf(part));\n }\n }\n if (droppedSearches.length === 0) return kept;\n\n const seen: ToolSearchRecord[] = [];\n const needed = new Set<ToolSearchRecord>();\n let host: { message: number; part: number } | undefined;\n kept.forEach((message, m) => {\n (message.content ?? []).forEach((part, p) => {\n if (part.type !== \"tool-call\" || part.partial) return;\n seen.push(...searchesOf(part));\n if (seen.some((search) => covers(search, part))) return;\n const missing = droppedSearches.filter((search) => covers(search, part));\n if (missing.length === 0) return;\n for (const search of missing) needed.add(search);\n host ??= { message: m, part: p };\n });\n });\n if (!host) return kept;\n\n const carried = droppedSearches.filter((search) => needed.has(search));\n const out = [...kept];\n const message = out[host.message]!;\n out[host.message] = {\n ...message,\n content: message.content.map((part, p) =>\n p === host!.part && part.type === \"tool-call\"\n ? { ...part, toolSearches: [...carried, ...searchesOf(part)] }\n : part,\n ),\n };\n return out;\n}\n",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"import { Log } from \"../facades/Log\";\nimport { AgentRunError, type AgentRunFailure, type ReasoningEffort } from \"./Agent\";\nimport type { AgentProvider } from \"./AgentProvider\";\nimport { httpErrorDetail } from \"./providers/errors\";\nimport {\n addUsage,\n appendReasoning,\n appendText,\n emptyUsage,\n outputFormat,\n parseOutput,\n raceAbort,\n resolveRope,\n RunAborted,\n} from \"./runtime\";\nimport type { Infer, Schema } from \"./Schema\";\nimport type { AgentError, AgentMessage, FinishReason, Usage } from \"./types\";\n\n/**\n * One model call with an output schema: no tools, no loop, no stream to a client.\n *\n * const result = await generate({\n * provider,\n * instructions: \"You are the copywriter of …\",\n * prompt: `The business: ${description}`,\n * output: s.object({ headline: s.string(), cta: s.string() }),\n * });\n * if (result.ok) save(result.output);\n *\n * WHAT IT IS FOR. Before this, the only structured generation gemi offered was\n * an `Agent` with an `output` schema, and an app that wanted one typed answer\n * got a tool loop it did not want and — through `ctx.runAgent` — a nested\n * transcript streamed to the browser for a value the browser never renders\n * (#594, #595). This is the agent's step without the agent: it assembles the\n * same provider call and parses the answer the same way (`runtime.ts` holds\n * both halves, shared), and that is all it does.\n *\n * INSIDE A TOOL, CALL `ctx.generate` INSTEAD. It is this function with the turn\n * bound in, not a second implementation: it aborts when the turn is stopped and\n * adds its usage to the turn's, two things a tool passing `ctx.signal` by hand\n * would forget invisibly. See `ToolContext.generate`.\n *\n * IT DOES NOT THROW FOR A BAD ANSWER. It returns `{ ok: false, error }`, and\n * `messages` and `usage` are on both arms. That is the requesting app's retry\n * pattern, and the reason for the shape: a rejected answer is retried by\n * continuing the conversation — `messages` plus \"your output was rejected:\n * <problems>\" — so the transcript holding the reply that failed is exactly\n * what the retry needs, and a throw would have lost it or buried it on an\n * exception. Usage is on both because the tokens were billed either way, and\n * the failed attempt is the one an app repeats. It is also how the rest of the\n * module already reports: `Schema.safeParse` returns a result, and a failing\n * tool is a result the model reads. Pass `throwOnError: true` to have it\n * reject with an `AgentRunError` instead, as `run.result()` can.\n *\n * A FAILURE IS LOGGED through `Log.error` by default, as a failed agent run is\n * (`logErrors: false` turns it off); a stop is not a failure and is not. On\n * `ok: false`, `error` also carries the provider's HTTP `status` and\n * `requestId` when it answered with an error, as `result().error` does.\n *\n * `error.code` says which failure it was:\n *\n * - `invalid_output` — the answer did not match the schema, was cut off at\n * `maxOutputTokens` (then `finishReason` is `\"length\"`), or never came.\n * - `timeout` — `signal` fired with a `TimeoutError`: an\n * `AbortSignal.timeout`, or the tool's `timeoutMs` under `ctx.generate`.\n * - `aborted` — `signal` fired for any other reason: a stop.\n * - anything else — the provider failed, normalized by the provider's own\n * `normalizeError` exactly as a failed agent step is (`rate_limited`,\n * `content_filtered`, `provider_error`, …).\n *\n * The one thing that does throw is a call that could never work: neither\n * `prompt` nor `messages`. That is a bug in the caller, not an outcome.\n *\n * NOT MEMOIZED, AND NOT RECORDED. It writes nothing to a thread and sends no\n * frame, which is the point of it — and it also means a tool body that is\n * re-entered after an escalation (see `ToolContext.runAgent`) calls the model\n * again. `ctx.runAgent` and `ctx.generateImage` can replay because they record\n * on the tool call; this has nothing to record into by design.\n */\nexport function generate<O extends Schema<any>>(\n params: GenerateParams<O> & { throwOnError: true },\n): Promise<GenerateSuccess<Infer<O>>>;\nexport function generate<O extends Schema<any>>(\n params: GenerateParams<O>,\n): Promise<GenerateResult<Infer<O>>>;\nexport function generate(params: GenerateParams): Promise<GenerateResult<unknown>> {\n return generateWithin(params);\n}\n\n/**\n * Where a `generate` call was made from, for its log line: `ctx.generate`\n * passes the agent, run and tool call it belongs to.\n */\nexport type GenerateOrigin = Record<string, unknown>;\n\n/**\n * `generate`, plus what `ctx.generate` needs to bind it to a turn: the origin\n * for the log line, and `settled`, which sees the result before it is logged\n * or thrown. That is where the turn adds the usage (billed whether or not the\n * answer parsed, and whether or not it is about to throw) and throws when the\n * turn itself was stopped.\n */\nexport async function generateWithin(\n params: GenerateParams,\n hooks: { origin?: GenerateOrigin; settled?: (result: GenerateResult<unknown>) => void } = {},\n): Promise<GenerateResult<unknown>> {\n // An id for the call, so the log line and an `AgentRunError` can be matched\n // up. `gen_` rather than `run_`: there is no run, and nothing is stored.\n const id = `gen_${crypto.randomUUID()}`;\n const result = await callModel(params);\n hooks.settled?.(result);\n if (!result.ok) {\n // A stop is an outcome the caller asked for, not a failure — the same rule\n // an agent run follows (an aborted run carries no `error` and is not\n // logged). A timeout is a failure: it reports `timeout`, as a run's\n // deadline does, and is logged.\n if (params.logErrors !== false && result.error.code !== \"aborted\") {\n logFailure(id, result.error, hooks.origin);\n }\n if (params.throwOnError) {\n throw new AgentRunError({\n runId: id,\n messages: result.messages,\n finishReason: result.finishReason,\n usage: result.usage,\n error: result.error,\n });\n }\n }\n return result;\n}\n\n/**\n * Through the app's logger, as a failed agent run is (`AgentRunImpl.logFailure`):\n * `Log.error`, so it lands in `storage/logs` and `onLogCreated`; outside an\n * application, where there is no logger to resolve, `console.error` instead;\n * and in development the console as well.\n */\nfunction logFailure(id: string, failure: AgentRunFailure, origin?: GenerateOrigin): void {\n const message = `[gemi/ai] generate() failed (${failure.code}${\n failure.status !== undefined ? ` ${failure.status}` : \"\"\n }): ${failure.message}`;\n const metadata = { ...origin, generateId: id, error: failure };\n let logged = false;\n try {\n Log.error(message, metadata);\n logged = true;\n } catch {\n // No application to resolve a logger from. Reported below instead.\n }\n if (!logged || process.env.NODE_ENV === \"development\") {\n console.error(message, metadata);\n }\n}\n\nasync function callModel<O extends Schema<any>>(\n params: GenerateParams<O>,\n): Promise<GenerateResult<Infer<O>>> {\n const prior = params.messages ?? [];\n if (prior.length === 0 && !params.prompt) {\n throw new Error(\n \"generate() was given neither a `prompt` nor `messages`, so there is nothing to send the model.\",\n );\n }\n\n const messages: AgentMessage[] = [...prior];\n if (params.prompt) {\n messages.push({\n id: `msg_${crypto.randomUUID()}`,\n role: \"user\",\n content: [{ type: \"text\", text: params.prompt }],\n createdAt: new Date().toISOString(),\n });\n }\n const reply: AgentMessage = {\n id: `msg_${crypto.randomUUID()}`,\n role: \"assistant\",\n content: [],\n createdAt: new Date().toISOString(),\n };\n\n // `raceAbort` wants a signal to race, and a caller with none gets one that\n // never fires rather than a second code path.\n const signal = params.signal ?? new AbortController().signal;\n let usage = emptyUsage();\n let reason: FinishReason = \"stop\";\n let error: AgentError | undefined;\n // The HTTP status and request id of a failed provider response, as an agent\n // run records them on `result().error` (#656). Server-side only.\n let detail: { status?: number; requestId?: string } = {};\n let outputText = \"\";\n\n try {\n const stream = params.provider.stream({\n // A copy: the provider is handed the array and has no business growing\n // the one this function is about to return.\n messages: [...messages],\n systemPrompt: params.instructions?.trim() ? params.instructions : undefined,\n output: outputFormat(params.output),\n reasoning: params.reasoning,\n maxOutputTokens: params.maxOutputTokens,\n temperature: params.temperature,\n signal: params.signal,\n });\n const iterator = stream[Symbol.asyncIterator]();\n try {\n for (;;) {\n // Raced, as the agent's step is: a provider that ignores its signal\n // must not be able to hold a stopped call open.\n const next = await raceAbort(Promise.resolve(iterator.next()), signal);\n if (next.done) break;\n const event = next.value;\n switch (event.type) {\n case \"output-delta\":\n outputText += event.delta;\n break;\n // Kept on the reply for what they are worth to a retry: reasoning\n // carries its item id so a continuation echoes it back and keeps the\n // prompt cache, and prose is what a model that ignored the format\n // said instead.\n case \"text-delta\":\n appendText(reply, \"text\", event.delta);\n break;\n case \"reasoning-delta\":\n appendReasoning(reply, event.id, event.delta);\n break;\n case \"finish\":\n // Usage is taken whatever happened before it; the reason only if\n // nothing already failed. A content filter reports an error and\n // then closes the call with a finish that still bills — the same\n // rule `AgentRunImpl.runStep` follows.\n usage = addUsage(usage, event.usage);\n if (!error) reason = event.reason;\n break;\n case \"error\":\n reason = \"error\";\n error = event.error;\n detail = httpErrorDetail(event);\n break;\n // `tool-call-delta`, `tool-call` and `tool-search` cannot happen:\n // no tools were sent.\n // `file-rejected` needs nothing here: the provider already sent the\n // call again without that file, and `generate()` keeps no thread\n // to mark the part in. The caller's `messages` are its own.\n }\n }\n } finally {\n // Not awaited. On the abort path the generator may be parked inside a\n // `fetch` that ignores its signal, and waiting on it would give back\n // the hang the race above exists to prevent.\n if (signal.aborted) void Promise.resolve(iterator.return?.()).catch(() => {});\n }\n } catch (thrown) {\n if (thrown instanceof RunAborted || signal.aborted) {\n reason = \"aborted\";\n error = abortError(signal);\n } else {\n reason = \"error\";\n error = params.provider.normalizeError(thrown);\n detail = httpErrorDetail(thrown);\n }\n }\n\n // A flag rather than `output !== undefined`: the schema decides what a\n // valid answer is, and nothing says it cannot be a falsy one.\n let answered = false;\n let output: Infer<O> | undefined;\n if (!error) {\n if (reason === \"length\") {\n // Never parsed. A cut-off answer is a prefix of the JSON the model meant\n // to write, `bestEffortParse` closes its brackets, and against a loose\n // schema — `s.json()` — the repaired half passes looking finished. The\n // agent loop withholds its `output` part for the same reason.\n error = {\n code: \"invalid_output\",\n message:\n \"The model ran out of output tokens before finishing its structured answer, so it was cut off. Raise maxOutputTokens, or ask for a shorter answer.\",\n retryable: true,\n };\n } else if (!outputText.trim()) {\n error = {\n code: \"invalid_output\",\n message: \"The model finished without giving a structured answer.\",\n retryable: true,\n };\n } else {\n const parsed = parseOutput(params.output, outputText);\n if (parsed.ok === true) {\n answered = true;\n output = parsed.value as Infer<O>;\n } else {\n error = parsed.error;\n }\n }\n }\n\n if (answered) {\n reply.content.push({ type: \"output\", value: output });\n } else if (outputText) {\n // The answer that failed, as the model wrote it. A retry continues this\n // transcript, and \"your output did not parse\" means little to a model that\n // cannot see what it wrote. Text rather than an `output` part because it is\n // not a value of the schema — an `output` part promises one.\n appendText(reply, \"text\", outputText);\n }\n for (const part of reply.content) {\n if ((part.type === \"text\" || part.type === \"reasoning\") && typeof part.text === \"string\") {\n part.text = resolveRope(part.text);\n }\n }\n reply.finishReason = reason;\n // One call, one message: the reply's usage is the call's, as an agent step's\n // message carries its own (#467).\n reply.usage = usage;\n messages.push(reply);\n\n if (answered) {\n return { ok: true, output: output as Infer<O>, messages, usage, finishReason: reason };\n }\n return { ok: false, error: { ...error!, ...detail }, messages, usage, finishReason: reason };\n}\n\nfunction abortError(signal: AbortSignal): AgentError {\n // `AbortSignal.timeout()` aborts with a `TimeoutError` (and so does a tool's\n // `timeoutMs`, through `ctx.signal`), and saying so is the difference\n // between \"somebody pressed stop\" and \"try again with more time\".\n const timedOut = (signal.reason as { name?: unknown } | undefined)?.name === \"TimeoutError\";\n // The same code an agent run's deadline and a tool's `timeoutMs` report\n // (#455), so one branch on `\"timeout\"` covers all three.\n return timedOut\n ? { code: \"timeout\", message: \"The generation timed out.\", retryable: true }\n : { code: \"aborted\", message: \"The generation was stopped.\", retryable: false };\n}\n\n/** What `generate` and `ctx.generate` are given. `messages` and `prompt` are\n * alternatives, and together the prompt is appended as the next user turn —\n * the same pair `ctx.runAgent` takes, so a retry reads the same in both. */\nexport interface GenerateParams<O extends Schema<any> = Schema<any>> {\n provider: AgentProvider;\n /**\n * The answer's shape, and the type of `output`. Required: a call without one\n * is a chat completion, which is not what this is.\n *\n * `strict` is read off the schema, as it is for an agent — a schema holding\n * an `s.json()` node is sent non-strict, since strict mode cannot express it.\n */\n output: O;\n /** The system prompt. */\n instructions?: string;\n /** Prior turns. Returned again at the front of `messages`, untouched. */\n messages?: AgentMessage[];\n /** Sugar for one more user turn, appended after `messages`. */\n prompt?: string;\n /** Dropped by a provider whose model cannot reason, as for an agent. */\n reasoning?: ReasoningEffort;\n /**\n * The provider's `max_output_tokens`. An answer that reaches it is cut off,\n * and comes back `ok: false` with `finishReason: \"length\"` — never as a\n * repaired half that happens to pass the schema.\n */\n maxOutputTokens?: number;\n /** Sent whenever set; a reasoning model that rejects it answers 400. See\n * `CreateAgentParams.temperature`. */\n temperature?: number;\n /**\n * Stops the call; it then resolves `ok: false` with `code: \"aborted\"`, or\n * `code: \"timeout\"` when it aborted with a `TimeoutError`.\n * `AbortSignal.timeout(ms)` is how to bound one.\n *\n * On `ctx.generate` this is combined with the turn's signal rather than\n * replacing it, so a timeout of the tool's own cannot unhook a `stop()`.\n */\n signal?: AbortSignal;\n /**\n * Reject with an `AgentRunError` instead of resolving `ok: false`, as\n * `run.result({ throwOnError: true })` does for an agent. Its `result` holds\n * the `messages`, `usage` and `error`, and its `runId` is the call's\n * `gen_` id. Any `ok: false` rejects, a stop included, since there is no\n * output to resolve with; the return type is then the `ok: true` arm.\n * Default `false`.\n */\n throwOnError?: boolean;\n /**\n * Write a failed call to the app's log (`Log.error`), as a failed agent run\n * is. Default `true`. A stop (`code: \"aborted\"`) is not a failure and is not\n * logged. Turn it off when the caller reports `result.error` itself — a\n * retry loop that expects `invalid_output` now and then, say.\n */\n logErrors?: boolean;\n}\n\n/** The parts of a `GenerateResult` both arms have. */\ninterface GenerateOutcome {\n /**\n * The whole transcript: `messages` as given, the `prompt` as a user turn,\n * then the model's reply. On success the reply holds the value as an\n * `output` part; on a bad answer, the raw text the model wrote — so a retry\n * passes this straight back with a new `prompt` saying what was wrong.\n */\n messages: AgentMessage[];\n /** What the call cost, including when it failed — the tokens were billed. */\n usage: Usage;\n /** How the model call ended: `\"stop\"` on success, `\"length\"` for a cut-off\n * answer, `\"error\"` or `\"aborted\"` when it did not finish. */\n finishReason: FinishReason;\n}\n\n/**\n * Discriminated on `ok`. `output` and `error` are each declared on both arms —\n * as `undefined` on the one where they cannot be — so that destructuring\n * `{ ok, output, error }` compiles, and checking `ok` narrows both.\n */\nexport type GenerateResult<O> =\n | GenerateSuccess<O>\n | (GenerateOutcome & {\n ok: false;\n /** The `AgentError`, plus the provider's HTTP `status` and `requestId`\n * when the failure was a response from it — as on an agent run's\n * `result().error`. */\n error: AgentRunFailure;\n output?: undefined;\n });\n\n/** The `ok: true` arm of `GenerateResult`, and what `throwOnError` resolves. */\nexport type GenerateSuccess<O> = GenerateOutcome & { ok: true; output: O; error?: undefined };\n",
|
|
16
16
|
"import { Storage } from \"../../facades/Storage\";\nimport { app } from \"../../foundation/app\";\nimport { Job } from \"../../services/queue/Job\";\nimport { QueueManager } from \"../../services/queue/QueueManager\";\nimport type { GeneratedAttachment, ToolGenerateImageParams, ToolEditImageParams } from \"../Agent\";\nimport { generateWithin, type GenerateParams, type GenerateResult } from \"../generate\";\nimport type { ImageInput, ImageModel } from \"../ImageModel\";\nimport { redactError, ToolError } from \"../redact\";\nimport { addUsage, emptyUsage } from \"../runtime\";\nimport type { Infer, Schema } from \"../Schema\";\nimport {\n type Attachment,\n type AttachmentStorage,\n type AttachmentStore,\n defaultAttachmentStore,\n InvalidAttachmentScopeError,\n ScopedAttachments,\n} from \"../store/Attachments\";\nimport type { AgentError, Usage } from \"../types\";\nimport {\n type AgentJobRecord,\n type AgentJobState,\n type AgentJobStore,\n MemoryAgentJobStore,\n} from \"./AgentJobStore\";\n\n// --- the handle a tool returns -------------------------------------------\n\nconst HANDLE = Symbol.for(\"gemi.ai.JobHandle\");\n\n/**\n * What `ctx.jobs.start` and `ctx.jobs.track` answer, and what a tool returns to\n * say \"this call goes on in the background\" (#461).\n *\n * Returning it is what makes the call's result `running` rather than `ok`: the\n * model reads that the job started and is told not to start it again, the turn\n * goes on and ends as usual, and when the job settles the controller renders\n * its outcome over that result the next time it loads the thread.\n *\n * `Output` is the job's settled output, and it is what the tool's output type\n * becomes, so a client's `ToolShapes` see the job's result as the tool's.\n */\nexport class JobHandle<Output = unknown> {\n /** Phantom: the settled output's type. Never set. */\n declare readonly $output: Output;\n readonly [HANDLE] = true as const;\n\n constructor(\n /** The job's id. Hand it to whatever settles a tracked job. */\n readonly id: string,\n readonly toolCallId: string,\n readonly summary: unknown,\n /** Epoch milliseconds, on the job store's clock. */\n readonly deadlineAt: number,\n ) {}\n}\n\n/** Whether a tool's return value is a `JobHandle`, across copies of the module. */\nexport function isJobHandle(value: unknown): value is JobHandle {\n return typeof value === \"object\" && value !== null && (value as any)[HANDLE] === true;\n}\n\n// --- errors ----------------------------------------------------------------\n\n/**\n * `ctx.jobs.start` or `track` from a run that has nowhere to settle a job\n * into: a stateless turn, a run started without a job store, or a sub-run.\n *\n * A `ToolError`, so the model reads why the tool could not go to the\n * background and can say so, rather than being told the tool broke.\n */\nexport class JobsRequireThreadError extends ToolError {\n readonly code = \"jobs_require_thread\" as const;\n\n constructor(message: string) {\n super(message, { retryable: false });\n this.name = \"JobsRequireThreadError\";\n }\n}\n\n// --- the process-wide registry ----------------------------------------------\n\nlet currentStore: AgentJobStore = new MemoryAgentJobStore();\n\n/** Every state, for a transition that does not change the state. */\nconst ANY_STATE: AgentJobState[] = [\"running\", \"ok\", \"error\"];\n\n/** What a job settles with. */\nexport type AgentJobOutcome =\n | { output: unknown; usage?: Usage }\n | { error: string | Error | (Pick<AgentError, \"message\"> & Partial<AgentError>); usage?: Usage };\n\n/**\n * Background jobs, from anywhere in the app: settle one, fail one, look one up.\n *\n * PROCESS-WIDE, and that is forced. A job is started by a tool inside a run,\n * and settled by a queue worker, a provider's webhook, a poller or the deadline\n * sweep, none of which has a controller to read a store from. So the store is\n * set once, at boot, for every one of them:\n *\n * AgentJobs.use(new DatabaseAgentJobStore(app(DatabaseManager).connection()));\n *\n * Until then it is a `MemoryAgentJobStore`, which works in one process and\n * forgets on restart.\n */\nexport const AgentJobs = {\n /** The store every part of the feature reads and writes. */\n get store(): AgentJobStore {\n return currentStore;\n },\n\n /** Sets the store. Call it once, at boot, in every process that starts or runs jobs. */\n use(store: AgentJobStore): void {\n currentStore = store;\n },\n\n get(id: string): Promise<AgentJobRecord | null> {\n return currentStore.get(id);\n },\n\n /**\n * Settles a running job with its output or its error, and answers whether\n * this call did it.\n *\n * COMPARE-AND-SET FROM `running`. The first settle wins and every later one\n * answers `false` and changes nothing, so a webhook, a poller and the\n * deadline sweep can all race on one job. A job the deadline sweep has\n * already failed stays failed: a late result is refused, so the model never\n * sees a job flip from failed to done.\n *\n * An error given as a `ToolError`, a string or an `AgentError`-like object is\n * shown to the model as it is. Any other `Error` is logged in full and the\n * model is told only that the job failed, as for a tool that throws (#446).\n */\n async settle(id: string, outcome: AgentJobOutcome): Promise<boolean> {\n return settleOn(currentStore, id, outcome);\n },\n\n /** `settle(id, { error })`. */\n async fail(id: string, error: string | Error | AgentError): Promise<boolean> {\n return settleOn(currentStore, id, { error });\n },\n\n /**\n * The deadline sweep: fails every running job whose deadline has passed\n * with code `\"timeout\"`, and answers how many it failed.\n *\n * Compare-and-set like every settle, so it is safe to run on every\n * instance at once, and a result that arrives after it is refused. Run it\n * every minute with `AgentJobDeadlineSweep`; the controller also checks a\n * thread's jobs when it loads the thread, so an app without cron still sees\n * overdue jobs fail, just later. The job's queue worker is not stopped: what\n * it returns afterwards is dropped.\n */\n async sweep(options: { limit?: number } = {}): Promise<number> {\n const store = currentStore;\n const limit = options.limit ?? 100;\n const now = await clockOf(store);\n let failed = 0;\n for (const record of await store.overdue(now, limit)) {\n if (await expire(store, record)) failed++;\n }\n return failed;\n },\n};\n\n/** The store's clock, or this process's for a store without one. */\nexport async function clockOf(store: AgentJobStore): Promise<number> {\n return store.now ? await store.now() : Date.now();\n}\n\n/** Fails a running job for its deadline. Compare-and-set: false when it had settled. */\nexport function expire(store: AgentJobStore, record: AgentJobRecord): Promise<boolean> {\n return store.transition(record.id, [\"running\"], {\n state: \"error\",\n error: {\n code: \"timeout\",\n message: `The background job for \"${record.toolName}\" did not finish before its deadline, so it was given up on. Its result, if it ever arrives, is ignored.`,\n toolCallId: record.toolCallId,\n retryable: true,\n },\n });\n}\n\nasync function settleOn(\n store: AgentJobStore,\n id: string,\n outcome: AgentJobOutcome,\n): Promise<boolean> {\n const record = await store.get(id);\n if (!record || record.state !== \"running\") return false;\n const usage = outcome.usage ? addUsage(record.usage ?? emptyUsage(), outcome.usage) : undefined;\n if (\"error\" in outcome) {\n return store.transition(id, [\"running\"], {\n state: \"error\",\n error: jobError(record, outcome.error),\n ...(usage ? { usage } : {}),\n });\n }\n return store.transition(id, [\"running\"], {\n state: \"ok\",\n output: plainData(outcome.output, record),\n ...(usage ? { usage } : {}),\n });\n}\n\n/** The error the model reads. See `AgentJobs.settle`. */\nfunction jobError(\n record: Pick<AgentJobRecord, \"toolCallId\" | \"toolName\" | \"job\">,\n error: AgentJobOutcome extends infer O ? (O extends { error: infer E } ? E : never) : never,\n): AgentError {\n if (typeof error === \"string\") {\n return { code: \"tool_error\", message: error, toolCallId: record.toolCallId, retryable: true };\n }\n if (error instanceof Error) {\n const raw: AgentError = {\n code: \"tool_error\",\n message: error.message,\n toolCallId: record.toolCallId,\n retryable: error instanceof ToolError ? error.retryable : true,\n };\n if (!(error instanceof ToolError)) {\n console.error(\n `The background job ${record.job ?? \"(tracked)\"} for \"${record.toolName}\" failed.`,\n error,\n );\n }\n return redactError(raw, { source: \"tool\", toolName: record.toolName, cause: error });\n }\n return {\n code: error.code ?? \"tool_error\",\n message: String(error.message),\n toolCallId: record.toolCallId,\n retryable: error.retryable ?? true,\n };\n}\n\n/** A copy of the output that any store can keep, or a throw that says why not. */\nfunction plainData(output: unknown, record: Pick<AgentJobRecord, \"toolName\">): unknown {\n if (output === undefined) return null;\n try {\n return JSON.parse(JSON.stringify(output));\n } catch (error) {\n throw new Error(\n `The output of the background job for \"${record.toolName}\" is not JSON: ${String(error)}`,\n );\n }\n}\n\n// --- the tool side ---------------------------------------------------------\n\n/** Options for `ctx.jobs.start` and `ctx.jobs.track`. */\nexport type StartJobOptions = {\n /**\n * What the model and the UI see while the job runs, in place of a result:\n * which images, which pages. Plain data, and keep it small, since it is in\n * the history on every later turn.\n */\n summary?: unknown;\n /**\n * How long the job may run, in milliseconds. Defaults to the tool's\n * `async.deadlineMs`, else an hour. A job still running then is failed with\n * code `\"timeout\"` by the deadline sweep, and a later result is refused.\n */\n deadlineMs?: number;\n};\n\n/** A tool's `ctx.jobs`. See `ToolContext.jobs`. */\nexport interface ToolJobs {\n /**\n * Records a background job for this tool call and queues `job` to do it.\n * Return the handle from `execute` to make the call's result `running`.\n *\n * At least once, like every queued job: `job.run` may run again after a\n * crash, so make it idempotent. Only on a threaded run (a turn with a\n * `threadId` through `AgentController`), and only from a top-level tool.\n */\n start<A, O>(job: AgentJobClass<A, O>, args: A, options?: StartJobOptions): Promise<JobHandle<O>>;\n /**\n * Records a background job that something else settles: a provider's\n * webhook, a poller. Pass `handle.id` to it, and call\n * `AgentJobs.settle(id, { output })` when the work is done.\n */\n track<O = unknown>(options?: StartJobOptions): Promise<JobHandle<O>>;\n}\n\n/** What a run that may start jobs is given. `AgentController` passes it on a threaded turn. */\nexport type RunJobs = {\n /** The run's owner (`runOwner`), recorded on each job. */\n owner: string | null;\n};\n\n/** The longest a job runs when nothing says otherwise. */\nexport const DEFAULT_JOB_DEADLINE_MS = 60 * 60_000;\n\n/** @internal `ctx.jobs` for one tool call. Built by the run, per call. */\nexport function toolJobs(params: {\n jobs: RunJobs | undefined;\n threadId: string | undefined;\n runId: string;\n toolCallId: string;\n toolName: string;\n depth: number;\n /** The tool's `async` declaration; `undefined` for a tool without one. */\n async: { deadlineMs?: number } | undefined;\n attachments: ScopedAttachments | null;\n}): ToolJobs {\n /** One job per tool call: the handle the first `start`/`track` answered. */\n let started: Promise<JobHandle<any>> | null = null;\n\n const begin = (\n job: (new () => AgentJob<any, any>) | null,\n args: unknown,\n options: StartJobOptions = {},\n ) => {\n if (params.async === undefined) {\n throw new ToolError(\n `\"${params.toolName}\" called ctx.jobs, but the tool does not declare \\`async\\`. Add \\`async: { deadlineMs }\\` to its definition.`,\n { retryable: false },\n );\n }\n if (!params.jobs || !params.threadId) {\n throw new JobsRequireThreadError(\n `\"${params.toolName}\" can only run in the background on a conversation the server keeps (a turn with a threadId), and this one has none.`,\n );\n }\n if (params.depth > 0) {\n throw new JobsRequireThreadError(\n `\"${params.toolName}\" can only run in the background from the top-level agent, not from a sub-agent.`,\n );\n }\n if (started) {\n throw new ToolError(\n `\"${params.toolName}\" started a background job already: a tool call has at most one.`,\n { retryable: false },\n );\n }\n const deadlineMs = options.deadlineMs ?? params.async.deadlineMs ?? DEFAULT_JOB_DEADLINE_MS;\n if (!Number.isFinite(deadlineMs) || deadlineMs <= 0) {\n throw new ToolError(`A job's deadlineMs must be a positive number; got ${deadlineMs}.`);\n }\n const jobs = params.jobs;\n const threadId = params.threadId;\n started = (async () => {\n const store = AgentJobs.store;\n // A tool re-entered after an escalation runs from the top again. The job\n // it started the first time is the one it gets.\n const existing = (await store.listForThread(threadId, { limit: 50 })).find(\n (record) => record.toolCallId === params.toolCallId,\n );\n if (existing) return handleOf(existing);\n\n const write = async () => {\n const record = await store.create({\n id: `ajob_${crypto.randomUUID()}`,\n threadId,\n runId: params.runId,\n toolCallId: params.toolCallId,\n toolName: params.toolName,\n owner: jobs.owner,\n job: job ? job.name : null,\n ...(options.summary !== undefined ? { summary: plainData(options.summary, params) } : {}),\n attachmentScope: params.attachments?.scopeKey ?? null,\n deadlineMs,\n });\n if (job) {\n try {\n await dispatchJob(job, { jobId: record.id, args });\n } catch (error) {\n // In a store transaction the record goes with the rollback.\n if (store.transaction) throw error;\n // Nothing will ever run it, so it is failed now rather than left to\n // reach its deadline, and the tool call reports the failure.\n await store\n .transition(record.id, [\"running\"], {\n state: \"error\",\n error: {\n code: \"tool_error\",\n message: `The background job for \"${params.toolName}\" could not be queued.`,\n toolCallId: params.toolCallId,\n retryable: true,\n },\n })\n .catch(() => {});\n throw error;\n }\n }\n return record;\n };\n // Both or neither when the store can: see `AgentJobStore.transaction`.\n const record = store.transaction ? await store.transaction(write) : await write();\n return handleOf(record);\n })();\n return started;\n };\n\n return {\n start: (job, args, options) => begin(job as new () => AgentJob<any, any>, args, options),\n track: (options) => begin(null, undefined, options),\n };\n}\n\nfunction handleOf(record: AgentJobRecord): JobHandle<any> {\n return new JobHandle(record.id, record.toolCallId, record.summary, record.deadlineAt);\n}\n\n/** What the queue carries for an `AgentJob`: the record's id and the job's own arguments. */\ntype JobEnvelope = { jobId: string; args: unknown };\n\nfunction dispatchJob(job: new () => AgentJob<any, any>, envelope: JobEnvelope): Promise<string> {\n if (job.name === \"unset\" || !job.name) {\n throw new Error(\"Cannot start an AgentJob with no `static name`.\");\n }\n return app(QueueManager).push(job, JSON.stringify([envelope]));\n}\n\n// --- the job side ------------------------------------------------------------\n\n/** An `AgentJob` subclass, as `ctx.jobs.start` takes it. */\nexport type AgentJobClass<A, O> = new () => AgentJob<A, O>;\n\n/** `generateImage`'s params inside a job: as in a tool, without `showModel` (there is no run to show). */\nexport type JobGenerateImageParams = Omit<ToolGenerateImageParams, \"showModel\">;\nexport type JobEditImageParams = Omit<ToolEditImageParams, \"showModel\">;\n\n/** Attachments inside a job: the scope of the run that started it. */\nexport interface JobAttachments {\n put(blob: Blob, params?: { name?: string; mimeType?: string }): Promise<Attachment>;\n get(id: string): Promise<Attachment>;\n read: ScopedAttachments[\"read\"];\n file(id: string): Promise<File>;\n}\n\n/**\n * What `AgentJob.run` is handed beside its arguments: the parts of a tool's\n * `ToolContext` that still mean something with no run around them.\n */\nexport interface AgentJobContext {\n /** The job's id (`ajob_…`). */\n readonly id: string;\n readonly threadId: string;\n readonly toolCallId: string;\n readonly toolName: string;\n /** The `runOwner` of the run that started it. */\n readonly owner: string | null;\n readonly summary: unknown;\n /** Not aborted yet: cancellation comes with a later release (#461, phase 4). */\n readonly signal: AbortSignal;\n /**\n * The attachments of the run that started the job: what the tool's\n * `ctx.attachments` was. Throws when that run had no attachment scope.\n */\n readonly attachments: JobAttachments;\n /** `generate`, with its usage counted on the job. See `ToolContext.generate`. */\n generate<O extends Schema<any>>(params: GenerateParams<O>): Promise<GenerateResult<Infer<O>>>;\n /** Renders an image and stores it under the run's attachments. Usage is counted on the job. */\n generateImage(model: ImageModel, params: JobGenerateImageParams): Promise<GeneratedAttachment>;\n /** Edits images (bytes or attachment ids) and stores the result. Usage is counted on the job. */\n editImage(model: ImageModel, params: JobEditImageParams): Promise<GeneratedAttachment>;\n /** What this attempt has spent so far. */\n readonly usage: Usage;\n}\n\n/**\n * A queued job that settles a tool call (#461).\n *\n * class RenderImagesJob extends AgentJob<{ pageId: number; prompts: string[] }, { made: number }> {\n * static name = \"RenderImagesJob\";\n * async run({ pageId, prompts }, job) {\n * for (const prompt of prompts) await job.generateImage(model, { prompt });\n * return { made: prompts.length };\n * }\n * }\n *\n * A gemi `Job`, so it gets the queue's leases, retries, backoff and dead\n * letters. Register it with the queue like any other job. What `run` returns\n * settles the tool call `ok`; a throw on the last attempt settles it `error`.\n * At least once: make `run` idempotent.\n *\n * Declare `run` as a method, not as an arrow-function field. Override\n * `onDeadletter` only with a call to `super.onDeadletter`, which is what fails\n * the job. `worker = true` is not supported. The queue hands `uniqueId`,\n * `throttle`, `concurrency`, `onFail` and `onDeadletter` the envelope\n * `{ jobId, args }`, not `args`.\n */\nexport abstract class AgentJob<Args = unknown, Output = unknown> extends Job {\n /** Phantom: the arguments' type. Never set. */\n declare readonly $args: Args;\n /** Phantom: the output's type. Never set. */\n declare readonly $output: Output;\n\n /**\n * Where the job's `attachments` records live. Set it to what the\n * controller's `attachments` is, as for the controller itself.\n */\n attachments: AttachmentStore = defaultAttachmentStore;\n /** Where the attachments' bytes live. Defaults to the app's `Storage`. */\n attachmentStorage: AttachmentStorage = Storage;\n\n abstract run(args: Args, job: AgentJobContext): Promise<Output> | Output;\n\n constructor() {\n super();\n // The queue calls `run(...payload)`, and the payload is the envelope. The\n // subclass's `run` is the job's body, so it is wrapped here, on the\n // instance: the queue sees a `run` that loads the record, runs the body\n // and settles the job, and the subclass writes only its work.\n const body = (this as any).run as (args: Args, job: AgentJobContext) => Promise<Output>;\n (this as any).run = (envelope: JobEnvelope) => this.$runEnvelope(envelope, body);\n }\n\n /**\n * Fails the job once the queue has given up on it: its last attempt threw,\n * it called `this.fail(error, { retry: false })`, or its process died on the\n * last attempt.\n */\n onDeadletter(error: Error, ..._args: any[]): void {\n const envelope = _args[0] as JobEnvelope | undefined;\n if (!envelope?.jobId) return;\n void settleOn(AgentJobs.store, envelope.jobId, { error }).catch((err) => {\n console.error(`Could not record the failure of background job ${envelope.jobId}.`, err);\n });\n }\n\n /** @internal The queue-facing `run`: see the constructor. */\n private async $runEnvelope(\n envelope: JobEnvelope,\n body: (args: Args, job: AgentJobContext) => Promise<Output>,\n ): Promise<Output | undefined> {\n const store = AgentJobs.store;\n const record = await store.get(envelope.jobId);\n // Settled already (the deadline passed, or another attempt finished it):\n // nothing it produced would be kept, so the work is not done again.\n if (!record || record.state !== \"running\") return undefined;\n\n const context = new JobContext(record, this);\n let output: Output;\n try {\n output = await body.call(this, envelope.args as Args, context);\n } catch (error) {\n await keepUsage(store, record.id, context.usage);\n throw error;\n }\n if (this.$outcome) {\n // `this.release()` or `this.fail()`: the queue decides what happens next.\n await keepUsage(store, record.id, context.usage);\n return output;\n }\n await settleOn(store, record.id, { output, usage: context.usage });\n return output;\n }\n}\n\n/** Adds an attempt's spend to a job still running, so a retry does not lose it. */\nasync function keepUsage(store: AgentJobStore, id: string, usage: Usage): Promise<void> {\n if (usage.totalTokens === 0 && usage.inputTokens === 0 && usage.outputTokens === 0) return;\n const record = await store.get(id);\n if (!record) return;\n await store\n .transition(id, ANY_STATE, { usage: addUsage(record.usage ?? emptyUsage(), usage) })\n .catch(() => {});\n}\n\nclass JobContext implements AgentJobContext {\n readonly id: string;\n readonly threadId: string;\n readonly toolCallId: string;\n readonly toolName: string;\n readonly owner: string | null;\n readonly summary: unknown;\n readonly signal = new AbortController().signal;\n usage: Usage = emptyUsage();\n readonly attachments: JobAttachments;\n\n constructor(record: AgentJobRecord, job: AgentJob<any, any>) {\n this.id = record.id;\n this.threadId = record.threadId;\n this.toolCallId = record.toolCallId;\n this.toolName = record.toolName;\n this.owner = record.owner;\n this.summary = record.summary;\n const scoped = record.attachmentScope\n ? new ScopedAttachments(job.attachments, job.attachmentStorage, {\n key: record.attachmentScope,\n })\n : null;\n const scope = (): ScopedAttachments => {\n if (!scoped) {\n throw new InvalidAttachmentScopeError(\n \"The run that started this job had no attachment scope, so the job cannot store or read files. See `attachmentScope()` on the controller.\",\n );\n }\n return scoped;\n };\n this.attachments = {\n put: (blob, params = {}) => scope().put(blob, params),\n get: (id) => scope().get(id),\n read: (id) => scope().read(id),\n file: (id) => scope().file(id),\n };\n }\n\n generate(params: GenerateParams<any>): Promise<any> {\n return generateWithin(params, {\n origin: { threadId: this.threadId, toolCallId: this.toolCallId, jobId: this.id },\n settled: (result) => {\n this.usage = addUsage(this.usage, result.usage);\n },\n });\n }\n\n async generateImage(\n model: ImageModel,\n params: JobGenerateImageParams,\n ): Promise<GeneratedAttachment> {\n const { name, ...settings } = params as JobGenerateImageParams & { name?: string };\n const image = await model.generate({ ...settings, signal: this.signal });\n return this.park(model, image, name);\n }\n\n async editImage(model: ImageModel, params: JobEditImageParams): Promise<GeneratedAttachment> {\n const { name, images, mask, ...settings } = params as JobEditImageParams & { name?: string };\n const asInput = async (input: ImageInput | string): Promise<ImageInput> =>\n typeof input === \"string\" ? await this.attachments.file(input) : input;\n const image = await model.edit({\n ...settings,\n images: (await Promise.all(images.map(asInput))) as [ImageInput, ...ImageInput[]],\n ...(mask ? { mask: await asInput(mask) } : {}),\n signal: this.signal,\n });\n return this.park(model, image, name);\n }\n\n private async park(\n model: ImageModel,\n image: { image: Blob; mimeType: string; size: string; usage: Usage },\n name: string | undefined,\n ): Promise<GeneratedAttachment> {\n // Counted before the store write, which may fail: the render was billed.\n this.usage = addUsage(this.usage, image.usage);\n const extension = image.mimeType === \"image/jpeg\" ? \"jpg\" : \"png\";\n const attachment = await this.attachments.put(image.image, {\n name: name ?? `${model.name}.${extension}`,\n mimeType: image.mimeType,\n });\n return { attachment, size: image.size, mimeType: image.mimeType, usage: image.usage };\n }\n}\n"
|
|
17
17
|
],
|
|
18
|
-
"mappings": ";6OA0DO,AAAM,JAAuC,LACjC,MAAQ,IAAI,IAGrB,QAAU,UAEZ,QAAO,CAAC,EAAe,EAAqC,CAChE,OAAO,KAAK,YAAY,EAAO,CAAS,EAO1C,WAAW,CAAC,EAAe,EAAmB,EAAM,KAAK,IAAI,EAAY,CACvE,GAAI,KAAK,MAAM,MAAQ,KAAK,QAAS,KAAK,MAAM,CAAG,EACnD,IAAM,EAAa,KAA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