gemi 0.65.0 → 0.67.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.
Files changed (51) hide show
  1. package/dist/ai/Agent.d.ts +55 -1
  2. package/dist/ai/Agent.d.ts.map +1 -1
  3. package/dist/ai/AgentProvider.d.ts +8 -44
  4. package/dist/ai/AgentProvider.d.ts.map +1 -1
  5. package/dist/ai/ImageModel.d.ts +127 -0
  6. package/dist/ai/ImageModel.d.ts.map +1 -0
  7. package/dist/ai/ImageProvider.d.ts +94 -0
  8. package/dist/ai/ImageProvider.d.ts.map +1 -0
  9. package/dist/ai/index.d.ts +5 -0
  10. package/dist/ai/index.d.ts.map +1 -1
  11. package/dist/ai/index.js +12 -12
  12. package/dist/ai/index.js.map +12 -8
  13. package/dist/ai/providers/call.d.ts +12 -0
  14. package/dist/ai/providers/call.d.ts.map +1 -1
  15. package/dist/ai/providers/endpoints.d.ts +153 -0
  16. package/dist/ai/providers/endpoints.d.ts.map +1 -0
  17. package/dist/ai/providers/fakeProvider.d.ts +54 -0
  18. package/dist/ai/providers/fakeProvider.d.ts.map +1 -1
  19. package/dist/ai/providers/http.d.ts +28 -0
  20. package/dist/ai/providers/http.d.ts.map +1 -1
  21. package/dist/ai/providers/images.d.ts +126 -0
  22. package/dist/ai/providers/images.d.ts.map +1 -0
  23. package/dist/ai/store/Attachments.d.ts +52 -0
  24. package/dist/ai/store/Attachments.d.ts.map +1 -1
  25. package/dist/ai/types.d.ts +26 -0
  26. package/dist/ai/types.d.ts.map +1 -1
  27. package/dist/{chunk-se5ekvgb.js → chunk-43asnfa8.js} +1 -1
  28. package/dist/{chunk-nxg51m0q.js → chunk-j3p8c0xp.js} +1 -1
  29. package/dist/{chunk-fk127cwf.js → chunk-ka2qqsys.js} +2 -2
  30. package/dist/{chunk-fk127cwf.js.map → chunk-ka2qqsys.js.map} +1 -1
  31. package/dist/{chunk-x917yccy.js → chunk-rnztqasa.js} +1 -1
  32. package/dist/{chunk-j3b3qerv.js → chunk-sksks0tz.js} +1 -1
  33. package/dist/chunk-z7vmrf00.js +5 -0
  34. package/dist/{chunk-a85fn4zf.js.map → chunk-z7vmrf00.js.map} +4 -4
  35. package/dist/client/ProgressManager.d.ts +1 -1
  36. package/dist/facades/index.js +1 -1
  37. package/dist/http/HttpRequest.d.ts +18 -3
  38. package/dist/http/HttpRequest.d.ts.map +1 -1
  39. package/dist/http/index.js +1 -1
  40. package/dist/i18n/index.js +1 -1
  41. package/dist/kernel/index.js +1 -1
  42. package/dist/server/index.js +1 -1
  43. package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +23 -1
  44. package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
  45. package/dist/services/index.js +1 -1
  46. package/package.json +1 -1
  47. package/dist/chunk-a85fn4zf.js +0 -5
  48. /package/dist/{chunk-se5ekvgb.js.map → chunk-43asnfa8.js.map} +0 -0
  49. /package/dist/{chunk-nxg51m0q.js.map → chunk-j3p8c0xp.js.map} +0 -0
  50. /package/dist/{chunk-x917yccy.js.map → chunk-rnztqasa.js.map} +0 -0
  51. /package/dist/{chunk-j3b3qerv.js.map → chunk-sksks0tz.js.map} +0 -0
@@ -1,4 +1,5 @@
1
1
  import type { ProviderEvent } from "../AgentProvider";
2
+ import type { ProviderTarget } from "./endpoints";
2
3
  import { type FetchLike } from "./http";
3
4
  import type { ResponsesRequest } from "./request";
4
5
  /**
@@ -20,6 +21,17 @@ export type ResponsesEndpoint = {
20
21
  maxRetries: number;
21
22
  fetchImpl?: FetchLike;
22
23
  };
24
+ /**
25
+ * The Responses paths for a resolved vendor.
26
+ *
27
+ * The two URLs are all that distinguishes this from any other call to the same
28
+ * host, which is why the host, the credential and the api-version are worked out
29
+ * by `providers/endpoints.ts` and appended to here rather than resolved twice.
30
+ * Files are resource-scoped rather than deployment-scoped on Azure — an upload
31
+ * is not addressed to a model — and the deployment goes in the body's `model`,
32
+ * which `buildResponsesRequest` already does.
33
+ */
34
+ export declare function responsesEndpoint(target: ProviderTarget): ResponsesEndpoint;
23
35
  /**
24
36
  * Errors reach the consumer as events, not exceptions.
25
37
  *
@@ -1 +1 @@
1
- {"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../../ai/providers/call.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlD;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB;2DACuD;IACvD,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAuB,eAAe,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,GAC1D,cAAc,CAAC,aAAa,CAAC,CA4C/B;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBzF"}
1
+ {"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../../ai/providers/call.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlD;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB;2DACuD;IACvD,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAQ3E;AAED;;;;;;GAMG;AACH,wBAAuB,eAAe,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,GAC1D,cAAc,CAAC,aAAa,CAAC,CA4C/B;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBzF"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Where a vendor lives, and who we are to it — resolved once, for every kind of
3
+ * call.
4
+ *
5
+ * WHY THIS IS ITS OWN MODULE. The Responses path and the images path differ only
6
+ * in the last segment of the URL. Everything before it — which host, whether the
7
+ * configured endpoint already carried `/openai`, whether the api-version is
8
+ * dated and therefore routes to the older path, whether to send `authorization:
9
+ * Bearer` or `api-key`, whether an Entra token has to be minted again because
10
+ * the last one expired mid-conversation — is identical, and every line of it was
11
+ * worked out by measuring a real resource rather than reading documentation (the
12
+ * transcripts are on `azureBase` below).
13
+ *
14
+ * That is exactly the kind of knowledge that must not be copied. A second copy
15
+ * in an image provider would be correct on the day it was written and would
16
+ * drift on the first fix that only one of them got, and the symptom of the drift
17
+ * is a 404 on every request for whichever apps configured the provider the
18
+ * documented way — which is the bug `azureBase` exists because of.
19
+ *
20
+ * So a provider resolves a `ProviderTarget` and appends its own path. Nothing
21
+ * here knows about Responses, files or images.
22
+ */
23
+ export type ProviderConfig = {
24
+ apiKey?: string;
25
+ baseURL?: string;
26
+ timeoutMs?: number;
27
+ maxRetries?: number;
28
+ headers?: Record<string, string>;
29
+ };
30
+ export type AzureConfig = ProviderConfig & {
31
+ /**
32
+ * The resource host, with or without a trailing `/openai`. Both spellings
33
+ * work — `https://<resource>.cognitiveservices.azure.com` and
34
+ * `https://<resource>.openai.azure.com` — and neither is rewritten, because
35
+ * only one of them exists for a resource that was not created as
36
+ * kind=OpenAI. See `azureBase` for what is done to it.
37
+ */
38
+ endpoint?: string;
39
+ /**
40
+ * Just the resource name, when there is no endpoint to hand. `<name>` is
41
+ * expanded to `https://<name>.cognitiveservices.azure.com/openai`.
42
+ */
43
+ resourceName?: string;
44
+ apiVersion?: string;
45
+ /**
46
+ * The deployment to call, when it is not named after the model. Azure lets
47
+ * whoever ran the template call it anything, and plenty of them are called
48
+ * `prod` — this is the override the class comment promises.
49
+ */
50
+ deployment?: string;
51
+ /**
52
+ * For Entra ID instead of a key. A function, not a token, because these
53
+ * expire mid-conversation.
54
+ */
55
+ getToken?: () => Promise<string>;
56
+ };
57
+ /**
58
+ * A resolved vendor, ready for a path to be appended.
59
+ *
60
+ * `base` and `query` are separate because Azure's api-version is a query
61
+ * parameter and a caller appending `/images/generations` must not have to know
62
+ * that it goes *before* the `?`. Every URL is `${base}${path}${query}`.
63
+ */
64
+ export type ProviderTarget = {
65
+ /** e.g. `https://api.openai.com/v1`, or `https://<host>/openai/v1`. */
66
+ base: string;
67
+ /** e.g. `` or `?api-version=preview`. Already encoded. */
68
+ query: string;
69
+ /** Called per request. See the Azure branch for why that is not an accident. */
70
+ headers: () => Promise<Record<string, string>>;
71
+ timeoutMs: number;
72
+ maxRetries: number;
73
+ };
74
+ /** Long enough for a reasoning model to think before it says anything, short
75
+ * enough that a hung connection is not mistaken for a slow one. For a streamed
76
+ * call it only covers getting a response; the stream that follows has no
77
+ * deadline. For a one-shot call it is the whole deadline — which is why the
78
+ * images path sets its own, and why `retryTimeouts` exists. */
79
+ export declare const DEFAULT_TIMEOUT_MS = 120000;
80
+ export declare const DEFAULT_MAX_RETRIES = 2;
81
+ export declare function env(name: string): string | undefined;
82
+ /**
83
+ * `preview` selects Azure's `/openai/v1` surface, which is the OpenAI-shaped
84
+ * one — same request body, same SSE frames, same `model` field naming the
85
+ * deployment — and it is the only surface the Responses API has that gemi's
86
+ * request builder can talk to unchanged. It takes no dated version: sending
87
+ * `api-version=2025-04-01-preview` to `/openai/v1/responses` answers
88
+ * `400 {"code":"BadRequest","message":"API version not supported"}`.
89
+ *
90
+ * A dated version is still honoured, and routes to the older
91
+ * `/openai/responses` path instead — see `azurePath`. So an app that pinned
92
+ * one keeps working, which is the promise the old comment here made and could
93
+ * not keep once the paths diverged.
94
+ */
95
+ export declare const AZURE_API_VERSION = "preview";
96
+ /**
97
+ * Where an Azure call goes, worked out live rather than from docs.
98
+ *
99
+ * THE PROBLEM THIS SOLVES. `AZURE_OPENAI_ENDPOINT` is conventionally written
100
+ * with `/openai` already on the end, and the old code appended `/openai` again
101
+ * and then a deployment path, producing
102
+ * `…/openai/openai/deployments/<dep>/responses` — a 404 on every request, for
103
+ * every app that configured the provider the documented way. Two separate
104
+ * mistakes were stacked there, and only measuring told them apart.
105
+ *
106
+ * WHAT WAS MEASURED, against a real resource, POSTing a Responses body:
107
+ *
108
+ * 404 {endpoint}/openai/deployments/gpt-5.4/responses?api-version=2025-04-01-preview
109
+ * 404 {host}/openai/deployments/gpt-5.4/responses?api-version=2025-04-01-preview
110
+ * 404 {host}/openai/deployments/gpt-5.4/responses?api-version=preview
111
+ * 400 {host}/openai/v1/responses?api-version=2025-04-01-preview ("API version not supported")
112
+ * 200 {host}/openai/v1/responses?api-version=preview
113
+ * 200 {host}/openai/v1/responses (no api-version at all)
114
+ * 200 {host}/openai/responses?api-version=2025-04-01-preview
115
+ *
116
+ * for {host} in BOTH `https://<resource>.cognitiveservices.azure.com` and
117
+ * `https://<resource>.openai.azure.com` — both spellings answered identically,
118
+ * so the host was never the variable. The deployment-in-the-URL path is the
119
+ * Chat Completions shape and the Responses API does not serve it at all; the
120
+ * deployment goes in the body's `model`, which is what `buildResponsesRequest`
121
+ * already puts there.
122
+ *
123
+ * `/openai/v1/files?api-version=preview` and
124
+ * `/openai/files?api-version=2025-04-01-preview` were both checked too (200,
125
+ * empty list), so uploads follow the same fork.
126
+ *
127
+ * And so do images, measured the same way against a `gpt-image-2` deployment:
128
+ *
129
+ * 200 {host}/openai/v1/images/generations?api-version=preview
130
+ * 200 {host}/openai/v1/images/edits?api-version=preview
131
+ *
132
+ * which is the whole reason this function is shared rather than reimplemented.
133
+ */
134
+ export declare function azureBase(raw: string): string;
135
+ /** Dated versions belong to the older path; `preview` (and anything that is not
136
+ * a date) belongs to `/v1`. Both were verified above. */
137
+ export declare function azurePath(apiVersion: string): string;
138
+ /** Overrides for a call whose deadline is not a streaming handshake's. */
139
+ export type TargetDefaults = {
140
+ timeoutMs?: number;
141
+ };
142
+ export declare function openAITarget(config: ProviderConfig, defaults?: TargetDefaults): ProviderTarget;
143
+ /**
144
+ * The resource base, `<host>/openai`, from whichever of the three ways it was
145
+ * configured. A bare resource name expands to the `cognitiveservices` host
146
+ * rather than the `openai.azure.com` one: both answer for a resource created
147
+ * as kind=OpenAI, only `cognitiveservices` answers for an AI Foundry or
148
+ * multi-service resource, so it is the spelling that is right more often. An
149
+ * app on the other one sets `endpoint` and nothing rewrites it.
150
+ */
151
+ export declare function azureResourceBase(config: AzureConfig): string;
152
+ export declare function azureTarget(config: AzureConfig, defaults?: TargetDefaults): ProviderTarget;
153
+ //# sourceMappingURL=endpoints.d.ts.map
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iB,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAS7C;AAED;0DAC0D;AAC1D,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,cAAc,EACtB,QAAQ,GAAE,cAAmB,GAC5B,cAAc,CAmBhB;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAM7D;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAE,cAAmB,GAAG,cAAc,CAoB9F"}
@@ -41,4 +41,58 @@ export declare class FakeProvider {
41
41
  };
42
42
  }
43
43
  export declare function fakeProvider(...scripts: ProviderEvent[][]): AgentProvider & FakeProvider;
44
+ /**
45
+ * An image provider that renders nothing and counts how often it was asked to.
46
+ *
47
+ * THE COUNT IS THE POINT. The expensive property of `ctx.generateImage` is that
48
+ * a replayed tool call does not render again — two minutes and an invoice line
49
+ * per repeat — and the only way to assert it is to ask the provider how many
50
+ * times it was called. A fake that merely returned bytes would let a memo that
51
+ * does nothing pass every test about what comes back.
52
+ */
53
+ export declare class FakeImageProvider {
54
+ private readonly bytes;
55
+ readonly model = "fake-image";
56
+ readonly generated: {
57
+ prompt: string;
58
+ size?: string;
59
+ }[];
60
+ readonly edited: {
61
+ prompt: string;
62
+ images: number;
63
+ mask: boolean;
64
+ }[];
65
+ constructor(bytes?: string);
66
+ private answer;
67
+ generate(params: any): Promise<{
68
+ bytes: Uint8Array<ArrayBuffer>;
69
+ mimeType: string;
70
+ size: string;
71
+ usage: {
72
+ inputTokens: number;
73
+ outputTokens: number;
74
+ totalTokens: number;
75
+ imageInputTokens: number;
76
+ imageOutputTokens: number;
77
+ };
78
+ }>;
79
+ edit(params: any): Promise<{
80
+ bytes: Uint8Array<ArrayBuffer>;
81
+ mimeType: string;
82
+ size: string;
83
+ usage: {
84
+ inputTokens: number;
85
+ outputTokens: number;
86
+ totalTokens: number;
87
+ imageInputTokens: number;
88
+ imageOutputTokens: number;
89
+ };
90
+ }>;
91
+ normalizeError(error: unknown): {
92
+ code: "provider_error";
93
+ message: string;
94
+ retryable: boolean;
95
+ };
96
+ }
97
+ export declare function fakeImageProvider(bytes?: string): any;
44
98
  //# sourceMappingURL=fakeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fakeProvider.d.ts","sourceRoot":"","sources":["../../../ai/providers/fakeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE3F;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IAWX,OAAO,CAAC,OAAO;IAV3B,QAAQ,CAAC,KAAK,UAAU;IACxB,QAAQ,CAAC,YAAY;;;;;;MAMnB;IACF,QAAQ,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAM;gBAExB,OAAO,EAAE,aAAa,EAAE,EAAE;IAE9C,MAAM,CAAC,MAAM,EAAE,oBAAoB;IAcnC;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,CAAM;IAExB,MAAM,CAAC,IAAI,EAAE,IAAI;IAKvB,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;CAO9B;AAED,wBAAgB,YAAY,CAAC,GAAG,OAAO,EAAE,aAAa,EAAE,EAAE,GACT,aAAa,GAAG,YAAY,CAC5E"}
1
+ {"version":3,"file":"fakeProvider.d.ts","sourceRoot":"","sources":["../../../ai/providers/fakeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,oBA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signal?: AbortSignal) => Promise<void>;
15
15
  random?: () => number;
16
16
  now?: () => number;
17
+ /**
18
+ * Whether a timeout is worth another attempt. Defaults to `true`.
19
+ *
20
+ * THE ANSWER DEPENDS ON WHAT THE TIMER BOUNDS, which is why this is a
21
+ * parameter and not a policy. For a streamed call the timer covers getting a
22
+ * response and is cleared once the headers land (see `requestWithRetry`), so a
23
+ * timeout means the provider never started answering: nothing was generated,
24
+ * nothing was billed, and retrying is both cheap and likely to work.
25
+ *
26
+ * For a call that returns its whole result in one body, the same timer bounds
27
+ * the *work*. A timeout there means the work probably happened and we hung up
28
+ * before hearing about it — so a retry pays for it a second time, at the same
29
+ * latency, and most likely times out again.
30
+ *
31
+ * MEASURED, because the margin is what makes this urgent rather than
32
+ * theoretical. One `gpt-image-2` render at `quality: "high"`, `1536x1024`,
33
+ * against a real Azure deployment: **117.8 seconds**, against a
34
+ * `DEFAULT_TIMEOUT_MS` of 120_000. Two seconds of headroom, about 2%. Any
35
+ * variance crosses it, and with retries on, one such request becomes three
36
+ * two-minute renders, six minutes of waiting, three images billed, and a
37
+ * `ProviderTimeoutError` returned to the caller. (For scale: the same model at
38
+ * `low`/1024² answers in 15s, and an edit in 14–20s.)
39
+ *
40
+ * So the image path passes `false` and the streaming path leaves it alone. A
41
+ * 429 or a 5xx is still retried in both cases: those say the request did not
42
+ * run, which is the opposite of what a timeout says here.
43
+ */
44
+ retryTimeouts?: boolean;
17
45
  };
18
46
  export declare const MAX_DELAY_MS = 20000;
19
47
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../ai/providers/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEhF,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,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AAI,CAAC,CAAC;IAC5D,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAMF,eAAO,MAAM,YAAY,QAAS,CAAC;AAEnC;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOjG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,GAAG,MAAM,CAG5E;AA6CD;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,QAAQ,CAAC,CAyGnB"}
@@ -0,0 +1,126 @@
1
+ import type { AgentError, Usage } from "../types";
2
+ import type { ProviderTarget } from "./endpoints";
3
+ import { type FetchLike } from "./http";
4
+ /**
5
+ * One image call, retried where retrying is free and not where it costs a render.
6
+ *
7
+ * MEASURED against a `gpt-image-2` deployment, api-version `preview`, and every
8
+ * decision in this file comes from one of these rather than from documentation —
9
+ * which disagreed with the endpoint on three separate points:
10
+ *
11
+ * 200 {base}/images/generations low, 1024x1024, png 15.0s
12
+ * 200 {base}/images/generations low, 1024x1024, png, transparent 14.6s
13
+ * 400 {base}/images/generations high, 1536x1024, webp
14
+ * → "Invalid value: 'webp'. Supported values are: 'png' and 'jpeg'."
15
+ * 200 {base}/images/generations high, 1536x1024, png 117.8s
16
+ * 200 {base}/images/edits low, one image[], no mask, no size 13.7s
17
+ * → answered size "1254x1254", which is neither what was asked for
18
+ * nor a multiple of 16
19
+ * 200 {base}/images/edits low, one image[], mask, 1024x1024 14.0s
20
+ * 200 {base}/images/edits low, two image[], 1024x1024 20.2s
21
+ *
22
+ * The documentation was wrong that `webp` is accepted, wrong that this model
23
+ * cannot do transparency, and wrong about the `usage` field names. The response
24
+ * shape, verbatim:
25
+ *
26
+ * { "created": 1790519365, "background": "opaque", "output_format": "png",
27
+ * "quality": "low", "size": "1024x1024",
28
+ * "data": [{ "b64_json": "…" }],
29
+ * "usage": { "input_tokens": 15,
30
+ * "input_tokens_details": { "image_tokens": 0, "text_tokens": 15 },
31
+ * "output_tokens": 196,
32
+ * "output_tokens_details": { "image_tokens": 196, "text_tokens": 0 },
33
+ * "total_tokens": 211 } }
34
+ *
35
+ * There is no `revised_prompt` in any of the five successful responses. See
36
+ * `ImageModel` for why the field is not on the public result type.
37
+ */
38
+ export type ImagesEndpoint = {
39
+ generationsUrl: string;
40
+ editsUrl: string;
41
+ /** Async for the same reason the Responses endpoint's is: Entra tokens expire
42
+ * mid-conversation, so the credential is read per request. */
43
+ headers: () => Promise<Record<string, string>>;
44
+ timeoutMs: number;
45
+ maxRetries: number;
46
+ fetchImpl?: FetchLike;
47
+ };
48
+ /**
49
+ * Longer than the Responses default, because here the timer bounds the work.
50
+ *
51
+ * A `high` / 1536x1024 render measured 117.8 seconds against a 120_000 default —
52
+ * two seconds of headroom. That is not a timeout, it is a coin flip, and losing
53
+ * it used to mean three renders billed (see `RequestOptions.retryTimeouts`). 300
54
+ * seconds is chosen to clear the measured worst case with room for a busier
55
+ * resource and a larger size, and an app that knows its own ceiling sets
56
+ * `timeoutMs` in config.
57
+ */
58
+ export declare const DEFAULT_IMAGE_TIMEOUT_MS = 300000;
59
+ export declare function imagesEndpoint(target: ProviderTarget): ImagesEndpoint;
60
+ /**
61
+ * What an image call failed with, as a normalized code rather than a vendor body.
62
+ *
63
+ * A one-shot call throws where the streaming path emits an `error` event — a
64
+ * promise has nowhere else to put it, and a caller awaiting bytes should not have
65
+ * to check a union. The normalized `AgentError` is carried so an app can branch
66
+ * on `rate_limited` exactly as it would for a text call.
67
+ *
68
+ * The vendor's own body is on `cause` and deliberately NOT in `message`. Inside a
69
+ * tool a throw becomes a tool result the model reads (#446), and a provider error
70
+ * body is not something to hand a model verbatim when a sentence will do.
71
+ */
72
+ export declare class ImageRequestError extends Error {
73
+ readonly code: AgentError["code"];
74
+ readonly retryable: boolean;
75
+ constructor(error: AgentError, options?: {
76
+ cause?: unknown;
77
+ });
78
+ }
79
+ /** The JSON body of a generation. Vendor field names, built by `ImageModel`. */
80
+ export type ImageGenerationRequest = {
81
+ model: string;
82
+ prompt: string;
83
+ size?: string;
84
+ quality?: string;
85
+ background?: string;
86
+ output_format?: string;
87
+ output_compression?: number;
88
+ };
89
+ /** What every image call answers, before `ImageModel` gives it a public shape. */
90
+ export type ImageResponse = {
91
+ /** Decoded from `b64_json`. */
92
+ bytes: Uint8Array;
93
+ mimeType: string;
94
+ /** Read off the response, never assumed — an edit with no `size` answered
95
+ * `1254x1254`. */
96
+ size: string;
97
+ background?: string;
98
+ usage: Usage;
99
+ };
100
+ /**
101
+ * The vendor's `usage` onto gemi's.
102
+ *
103
+ * Separate from `toUsage` in `stream.ts` rather than shared with it. The three
104
+ * totals have the same names, so sharing looked right; the details objects do
105
+ * not. `toUsage` reads `output_tokens_details.reasoning_tokens` and
106
+ * `input_tokens_details.cached_tokens`, and this endpoint sends `image_tokens`
107
+ * and `text_tokens` in both — so reusing it silently discards the only part of
108
+ * this payload that is specific to images, which is the part `imageInputTokens`
109
+ * exists for.
110
+ */
111
+ export declare function toImageUsage(raw: any): Usage;
112
+ type CallOptions = {
113
+ signal?: AbortSignal;
114
+ };
115
+ export declare function generateImage(endpoint: ImagesEndpoint, body: ImageGenerationRequest, options?: CallOptions): Promise<ImageResponse>;
116
+ /**
117
+ * An edit, as multipart.
118
+ *
119
+ * `image[]` repeated once per input, measured — two parts reported 2048 input
120
+ * image tokens against 1024 for one. No `content-type` header, for the reason
121
+ * `uploadFile` gives: the boundary is generated with the body, and setting the
122
+ * header by hand fails with a parser error that names nothing useful.
123
+ */
124
+ export declare function editImage(endpoint: ImagesEndpoint, form: FormData, options?: CallOptions): Promise<ImageResponse>;
125
+ export {};
126
+ //# sourceMappingURL=images.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../../ai/providers/images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB;mEAC+D;IAC/D,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,SAAU,CAAC;AAEhD,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAQrE;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;gBAEhB,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO;CAMjE;AAED,gFAAgF;AAChF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG;IAC1B,+BAA+B;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB;uBACmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAOF;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAa5C;AAiCD,KAAK,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AA6B5C,wBAAsB,aAAa,CACjC,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,sBAAsB,EAC5B,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CAWxB;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,QAAQ,EACd,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CAOxB"}
@@ -1,4 +1,5 @@
1
1
  import type { PutFileParams, ReadFileParams, ReadResult } from "../../services/file-storage/drivers/types";
2
+ import type { Usage } from "../types";
2
3
  /**
3
4
  * The bytes of an upload, kept by gemi, and the scope that says whose they are.
4
5
  *
@@ -236,6 +237,29 @@ export declare class ScopedAttachments {
236
237
  *
237
238
  * Buffers, and says so. `read()` is there for anything large enough that
238
239
  * buffering it is the wrong call.
240
+ *
241
+ * THIS IS ALSO HOW AN ATTACHMENT OUTLIVES THE RUN, and it is `file()` rather
242
+ * than `read()` that composes for it:
243
+ *
244
+ * const file = await ctx.attachments.file(id);
245
+ * await Storage.put({ name: `pages/${pageId}/hero.png`, body: file });
246
+ *
247
+ * `read()` answers a `ReadResult` whose `body` is `ReadableStream | Blob |
248
+ * null`, and `PutFileParams.body` is `Blob | File | Buffer` — a stream body
249
+ * has nowhere to go without being drained first.
250
+ *
251
+ * Two things that bite on the way out, both silent:
252
+ *
253
+ * - **Do not keep a `gemi_att_` id as an app's durable handle to a file.**
254
+ * The default record store is `MemoryAttachmentStore`, so the id→object
255
+ * mapping dies with the process while the bytes stay in storage. Copy the
256
+ * file under a key of the app's own and keep that.
257
+ * - **Put an extension on that key.** `FileSystemDriver` — the default —
258
+ * ignores `contentType` on write and re-derives the type from the stored
259
+ * path on read, so an extensionless object serves as
260
+ * `application/octet-stream` and an `<img>` pointed at it renders nothing,
261
+ * with no error anywhere. `attachmentObjectName` carries one over for this
262
+ * module's own writes; an app's key is the app's to name.
239
263
  */
240
264
  file(id: string): Promise<File>;
241
265
  /**
@@ -351,6 +375,34 @@ export interface ToolAttachments {
351
375
  export type ToolAttachmentPut = {
352
376
  /** What `put` answered, replayed verbatim. */
353
377
  attachment: Attachment;
378
+ /**
379
+ * Set when this slot was filled by `ctx.generateImage` / `ctx.editImage`
380
+ * rather than a plain `put`, carrying what the render reported and the
381
+ * attachment record cannot.
382
+ *
383
+ * WHY THE RENDER IS MEMOIZED AT ALL, and why it is memoized *here*. An
384
+ * escalating tool is re-entered from the top on the next turn, so a render
385
+ * that is not written down is paid for again — and unlike a `put`, the thing
386
+ * being repeated costs money at the vendor and about two minutes of wall
387
+ * clock. The memo cannot hold the image: this record lives in the message
388
+ * history, which goes over the wire and into a store on every turn, and a
389
+ * megabyte of base64 per generated image would go with it. So what is
390
+ * recorded is the attachment id, and the bytes live in storage where they
391
+ * were going anyway.
392
+ *
393
+ * That is the whole reason `ctx.generateImage` answers an `Attachment`
394
+ * instead of a `Blob` while `ImageModel.generate` answers the bytes: outside
395
+ * a run there is nothing to replay and nowhere to park, and inside one there
396
+ * has to be both.
397
+ *
398
+ * `size` is the pixel dimensions the model actually produced — read off the
399
+ * response, which does not always echo the request — and is not derivable
400
+ * from `Attachment.size`, which is a byte count.
401
+ */
402
+ generated?: {
403
+ size: string;
404
+ usage: Usage;
405
+ };
354
406
  /** Set when `showModel` was asked for. See above. */
355
407
  shown?: {
356
408
  /** The provider's file id — what the injected `FilePart` carries. */
@@ -1 +1 @@
1
- {"version":3,"file":"Attachments.d.ts","sourceRoot":"","sources":["../../../ai/store/Attachments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,2CAA2C,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;;;;;;;;;OAUG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,qBAAqB,CAAC;CACpC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,eAAe;IAC9B,iFAAiF;IACjF,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO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,MAAM,CAEjB;CACF;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,uBAA8B,CAAC"}
@@ -36,6 +36,32 @@ export type Usage = {
36
36
  /** Billed separately by OpenAI and worth surfacing on its own. */
37
37
  reasoningTokens?: number;
38
38
  cachedInputTokens?: number;
39
+ /**
40
+ * How much of `inputTokens` / `outputTokens` was image rather than text, on a
41
+ * generation or an edit.
42
+ *
43
+ * A BREAKDOWN, NOT A SEPARATE BUCKET — the same relationship `reasoningTokens`
44
+ * has to `outputTokens` and `cachedInputTokens` has to `inputTokens`. This was
45
+ * worth getting right rather than assuming: the design note for this field
46
+ * argued they should be kept *out* of the totals so nothing could price image
47
+ * tokens at a text rate, and the measurement says the vendor does not work
48
+ * that way. An edit reports `input_tokens: 1038` with
49
+ * `input_tokens_details: { image_tokens: 1024, text_tokens: 14 }` — 1038 is
50
+ * the sum, not the text half. Subtracting here to invent a separate bucket
51
+ * would produce a `totalTokens` that disagrees with the provider's own.
52
+ *
53
+ * So the totals stay the provider's, and these say what they are made of. A
54
+ * caller pricing a run can subtract; a caller that does not care is unaffected.
55
+ *
56
+ * MEASURED, `gpt-image-2` on Azure: a generation reports `image_tokens: 0` on
57
+ * the input side and all of `outputTokens` as image — 196 at `low`/1024², 5488
58
+ * at `high`/1536x1024. An edit reports 1024 input image tokens per 1024x1024
59
+ * input image, and 2048 for two.
60
+ *
61
+ * Absent on usage from a text call, exactly like `reasoningTokens`.
62
+ */
63
+ imageInputTokens?: number;
64
+ imageOutputTokens?: number;
39
65
  totalTokens: number;
40
66
  };
41
67
  export type FinishReason = "stop" | "length"
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../ai/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE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