gemi 0.64.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/Agent.d.ts +128 -1
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/AgentController.d.ts +75 -6
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/AgentProvider.d.ts +13 -45
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/ImageModel.d.ts +127 -0
- package/dist/ai/ImageModel.d.ts.map +1 -0
- package/dist/ai/ImageProvider.d.ts +94 -0
- package/dist/ai/ImageProvider.d.ts.map +1 -0
- package/dist/ai/Schema.d.ts +62 -0
- package/dist/ai/Schema.d.ts.map +1 -1
- package/dist/ai/client/index.js +10 -4
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/client/reducer.d.ts.map +1 -1
- package/dist/ai/index.d.ts +7 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +11 -11
- package/dist/ai/index.js.map +14 -10
- package/dist/ai/live/harness.d.ts +5 -3
- package/dist/ai/live/harness.d.ts.map +1 -1
- package/dist/ai/providers/call.d.ts +12 -0
- package/dist/ai/providers/call.d.ts.map +1 -1
- package/dist/ai/providers/endpoints.d.ts +153 -0
- package/dist/ai/providers/endpoints.d.ts.map +1 -0
- package/dist/ai/providers/fakeProvider.d.ts +54 -0
- package/dist/ai/providers/fakeProvider.d.ts.map +1 -1
- package/dist/ai/providers/http.d.ts +28 -0
- package/dist/ai/providers/http.d.ts.map +1 -1
- package/dist/ai/providers/images.d.ts +126 -0
- package/dist/ai/providers/images.d.ts.map +1 -0
- package/dist/ai/store/Attachments.d.ts +52 -0
- package/dist/ai/store/Attachments.d.ts.map +1 -1
- package/dist/ai/types.d.ts +55 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/useChat.d.ts +60 -4
- package/dist/ai/useChat.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bin/gemi.js +9 -1
- package/dist/bin/gemi.js.map +3 -3
- package/dist/broadcasting/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-jv9k1qfr.js → chunk-2bb3rdqq.js} +3 -3
- package/dist/{chunk-jv9k1qfr.js.map → chunk-2bb3rdqq.js.map} +1 -1
- package/dist/{chunk-e785380d.js → chunk-2dvjj3ad.js} +2 -2
- package/dist/{chunk-e785380d.js.map → chunk-2dvjj3ad.js.map} +1 -1
- package/dist/{chunk-rj3fnc4h.js → chunk-2ghpxrw1.js} +1 -1
- package/dist/{chunk-dqbm9vd0.js → chunk-3mp9p38x.js} +2 -2
- package/dist/{chunk-dqbm9vd0.js.map → chunk-3mp9p38x.js.map} +1 -1
- package/dist/{chunk-cdpeh7tt.js → chunk-3pwn2r6s.js} +2 -2
- package/dist/{chunk-cdpeh7tt.js.map → chunk-3pwn2r6s.js.map} +1 -1
- package/dist/{chunk-7qfzrkab.js → chunk-45g3hd0e.js} +2 -2
- package/dist/{chunk-7qfzrkab.js.map → chunk-45g3hd0e.js.map} +1 -1
- package/dist/{chunk-wqmzad46.js → chunk-5g1j29p2.js} +2 -2
- package/dist/{chunk-wqmzad46.js.map → chunk-5g1j29p2.js.map} +1 -1
- package/dist/{chunk-bxtx4y4w.js → chunk-5pm9zvtp.js} +2 -2
- package/dist/{chunk-bxtx4y4w.js.map → chunk-5pm9zvtp.js.map} +1 -1
- package/dist/{chunk-pbx9p6g0.js → chunk-6waph5k8.js} +1 -1
- package/dist/{chunk-nnc40mf3.js → chunk-70y8wajy.js} +2 -2
- package/dist/{chunk-nnc40mf3.js.map → chunk-70y8wajy.js.map} +1 -1
- package/dist/{chunk-71yhw8aw.js → chunk-731etrh2.js} +2 -2
- package/dist/{chunk-71yhw8aw.js.map → chunk-731etrh2.js.map} +1 -1
- package/dist/{chunk-1s1cd1e8.js → chunk-7438nrkm.js} +3 -3
- package/dist/{chunk-1s1cd1e8.js.map → chunk-7438nrkm.js.map} +1 -1
- package/dist/{chunk-ssg20z9s.js → chunk-7wgk7q33.js} +3 -3
- package/dist/{chunk-ssg20z9s.js.map → chunk-7wgk7q33.js.map} +1 -1
- package/dist/chunk-7xc64j6p.js +5 -0
- package/dist/chunk-7xc64j6p.js.map +14 -0
- package/dist/{chunk-jmse5hec.js → chunk-7zg1mt1g.js} +2 -2
- package/dist/{chunk-jmse5hec.js.map → chunk-7zg1mt1g.js.map} +1 -1
- package/dist/{chunk-0qchadp1.js → chunk-87c0cy5v.js} +2 -2
- package/dist/{chunk-0qchadp1.js.map → chunk-87c0cy5v.js.map} +1 -1
- package/dist/{chunk-773qa4av.js → chunk-8bjxk57p.js} +2 -2
- package/dist/{chunk-773qa4av.js.map → chunk-8bjxk57p.js.map} +1 -1
- package/dist/{chunk-81yzec62.js → chunk-8jpvj3cj.js} +2 -2
- package/dist/{chunk-81yzec62.js.map → chunk-8jpvj3cj.js.map} +1 -1
- package/dist/{chunk-9e5c5e15.js → chunk-9ch1q7nd.js} +2 -2
- package/dist/{chunk-9e5c5e15.js.map → chunk-9ch1q7nd.js.map} +1 -1
- package/dist/{chunk-9e5v1t73.js → chunk-9x5eefh0.js} +2 -2
- package/dist/{chunk-9e5v1t73.js.map → chunk-9x5eefh0.js.map} +1 -1
- package/dist/{chunk-62xjrz5e.js → chunk-9zmcz7yq.js} +2 -2
- package/dist/{chunk-62xjrz5e.js.map → chunk-9zmcz7yq.js.map} +1 -1
- package/dist/{chunk-0amv13g6.js → chunk-a85fn4zf.js} +3 -3
- package/dist/{chunk-0amv13g6.js.map → chunk-a85fn4zf.js.map} +1 -1
- package/dist/chunk-adj6dnvj.js +5 -0
- package/dist/{chunk-dq2hgzje.js.map → chunk-adj6dnvj.js.map} +1 -1
- package/dist/{chunk-exwbtfe9.js → chunk-aq09ta7k.js} +2 -2
- package/dist/{chunk-exwbtfe9.js.map → chunk-aq09ta7k.js.map} +1 -1
- package/dist/{chunk-43xw9n4f.js → chunk-dmr7yzyr.js} +2 -2
- package/dist/{chunk-43xw9n4f.js.map → chunk-dmr7yzyr.js.map} +1 -1
- package/dist/{chunk-q4wdg0y3.js → chunk-e0v4byjp.js} +2 -2
- package/dist/{chunk-ptjexzn1.js.map → chunk-e0v4byjp.js.map} +1 -1
- package/dist/{chunk-8wpccvbt.js → chunk-e1fkxt82.js} +2 -2
- package/dist/{chunk-8wpccvbt.js.map → chunk-e1fkxt82.js.map} +1 -1
- package/dist/{chunk-xadk41cs.js → chunk-ex9ns7pf.js} +4 -4
- package/dist/{chunk-xadk41cs.js.map → chunk-ex9ns7pf.js.map} +1 -1
- package/dist/{chunk-95d8jj11.js → chunk-fd7wfcft.js} +2 -2
- package/dist/{chunk-95d8jj11.js.map → chunk-fd7wfcft.js.map} +1 -1
- package/dist/{chunk-kx7vgcjp.js → chunk-fmcq21hg.js} +3 -3
- package/dist/{chunk-kx7vgcjp.js.map → chunk-fmcq21hg.js.map} +1 -1
- package/dist/{chunk-k1wkvrj0.js → chunk-ftaxfq7p.js} +3 -3
- package/dist/{chunk-k1wkvrj0.js.map → chunk-ftaxfq7p.js.map} +1 -1
- package/dist/{chunk-zdj2wmbj.js → chunk-fxkh2rfd.js} +2 -2
- package/dist/{chunk-zdj2wmbj.js.map → chunk-fxkh2rfd.js.map} +1 -1
- package/dist/{chunk-9k5daets.js → chunk-g2ywq30n.js} +2 -2
- package/dist/{chunk-9k5daets.js.map → chunk-g2ywq30n.js.map} +1 -1
- package/dist/{chunk-fwnf3jc6.js → chunk-gyc91g26.js} +2 -2
- package/dist/{chunk-fwnf3jc6.js.map → chunk-gyc91g26.js.map} +1 -1
- package/dist/chunk-hq496pa4.js +5 -0
- package/dist/chunk-hq496pa4.js.map +10 -0
- package/dist/{chunk-4sv5zpb4.js → chunk-hrtkjv41.js} +2 -2
- package/dist/{chunk-4sv5zpb4.js.map → chunk-hrtkjv41.js.map} +1 -1
- package/dist/{chunk-dhe1hsyz.js → chunk-jkjt3e06.js} +2 -2
- package/dist/{chunk-dhe1hsyz.js.map → chunk-jkjt3e06.js.map} +1 -1
- package/dist/{chunk-5wzyx4ts.js → chunk-ks94h71z.js} +2 -2
- package/dist/{chunk-5wzyx4ts.js.map → chunk-ks94h71z.js.map} +1 -1
- package/dist/{chunk-rhr8qavq.js → chunk-m44ar4he.js} +2 -2
- package/dist/{chunk-rhr8qavq.js.map → chunk-m44ar4he.js.map} +1 -1
- package/dist/{chunk-mzpczes2.js → chunk-nxg51m0q.js} +2 -2
- package/dist/{chunk-mzpczes2.js.map → chunk-nxg51m0q.js.map} +1 -1
- package/dist/{chunk-qrfp7pg2.js → chunk-nxh5a3eb.js} +3 -3
- package/dist/{chunk-qrfp7pg2.js.map → chunk-nxh5a3eb.js.map} +1 -1
- package/dist/{chunk-qcbtr7hm.js → chunk-p0m3qgs5.js} +2 -2
- package/dist/{chunk-qcbtr7hm.js.map → chunk-p0m3qgs5.js.map} +1 -1
- package/dist/{chunk-jk8mn861.js → chunk-p5m0da00.js} +2 -2
- package/dist/{chunk-jk8mn861.js.map → chunk-p5m0da00.js.map} +1 -1
- package/dist/{chunk-fv223805.js → chunk-pb0m0ryf.js} +3 -3
- package/dist/{chunk-fv223805.js.map → chunk-pb0m0ryf.js.map} +1 -1
- package/dist/{chunk-7hbhbht2.js → chunk-pcxxnnad.js} +3 -3
- package/dist/{chunk-7hbhbht2.js.map → chunk-pcxxnnad.js.map} +1 -1
- package/dist/{chunk-2d92pev2.js → chunk-pxc51549.js} +2 -2
- package/dist/{chunk-2d92pev2.js.map → chunk-pxc51549.js.map} +1 -1
- package/dist/{chunk-454c7vn3.js → chunk-q1nq7n6y.js} +2 -2
- package/dist/{chunk-454c7vn3.js.map → chunk-q1nq7n6y.js.map} +1 -1
- package/dist/{chunk-48qybp63.js → chunk-qqchc40s.js} +2 -2
- package/dist/{chunk-48qybp63.js.map → chunk-qqchc40s.js.map} +1 -1
- package/dist/{chunk-3tmw1gy2.js → chunk-qttk7k60.js} +2 -2
- package/dist/{chunk-3tmw1gy2.js.map → chunk-qttk7k60.js.map} +1 -1
- package/dist/{chunk-feyr4851.js → chunk-r069158p.js} +2 -2
- package/dist/{chunk-feyr4851.js.map → chunk-r069158p.js.map} +1 -1
- package/dist/{chunk-ptjexzn1.js → chunk-r6v21jn6.js} +2 -2
- package/dist/{chunk-q4wdg0y3.js.map → chunk-r6v21jn6.js.map} +1 -1
- package/dist/{chunk-6j129573.js → chunk-r77f1482.js} +2 -2
- package/dist/{chunk-6j129573.js.map → chunk-r77f1482.js.map} +1 -1
- package/dist/{chunk-jmbdr550.js → chunk-rnjbja88.js} +2 -2
- package/dist/{chunk-jmbdr550.js.map → chunk-rnjbja88.js.map} +1 -1
- package/dist/{chunk-q8msf1gf.js → chunk-rq2k9frr.js} +2 -2
- package/dist/{chunk-q8msf1gf.js.map → chunk-rq2k9frr.js.map} +1 -1
- package/dist/{chunk-2nqxhy1f.js → chunk-se5ekvgb.js} +4 -4
- package/dist/{chunk-2nqxhy1f.js.map → chunk-se5ekvgb.js.map} +3 -3
- package/dist/{chunk-v6v03hy7.js → chunk-sqc6fkqt.js} +2 -2
- package/dist/{chunk-v6v03hy7.js.map → chunk-sqc6fkqt.js.map} +1 -1
- package/dist/{chunk-78cvy4je.js → chunk-tn71d46d.js} +2 -2
- package/dist/{chunk-78cvy4je.js.map → chunk-tn71d46d.js.map} +1 -1
- package/dist/{chunk-hkhxkeeb.js → chunk-v6q4990x.js} +3 -3
- package/dist/{chunk-hkhxkeeb.js.map → chunk-v6q4990x.js.map} +1 -1
- package/dist/{chunk-e41vdprh.js → chunk-w34j3cd3.js} +3 -3
- package/dist/{chunk-e41vdprh.js.map → chunk-w34j3cd3.js.map} +1 -1
- package/dist/{chunk-w8ncmp2z.js → chunk-w6fnt1xv.js} +2 -2
- package/dist/{chunk-w8ncmp2z.js.map → chunk-w6fnt1xv.js.map} +2 -2
- package/dist/{chunk-35fbxgjh.js → chunk-wzqxtrpt.js} +2 -2
- package/dist/{chunk-35fbxgjh.js.map → chunk-wzqxtrpt.js.map} +1 -1
- package/dist/{chunk-z2fnf49p.js → chunk-xzexftx1.js} +1 -1
- package/dist/{chunk-dfv5eqma.js → chunk-z4k18gnp.js} +2 -2
- package/dist/{chunk-dfv5eqma.js.map → chunk-z4k18gnp.js.map} +1 -1
- package/dist/{chunk-b6948dnh.js → chunk-z6gzasra.js} +2 -2
- package/dist/{chunk-b6948dnh.js.map → chunk-z6gzasra.js.map} +1 -1
- package/dist/{chunk-p57x55qd.js → chunk-zqpskwk9.js} +2 -2
- package/dist/{chunk-p57x55qd.js.map → chunk-zqpskwk9.js.map} +1 -1
- package/dist/chunks/ThemeProvider-Bz-y1g2i.js.map +1 -1
- package/dist/client/ClientRouter.d.ts.map +1 -1
- package/dist/client/ProgressManager.d.ts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +72 -2
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/useNavigate.d.ts +29 -6
- package/dist/client/useNavigate.d.ts.map +1 -1
- package/dist/client/usePrefetch.d.ts +13 -3
- package/dist/client/usePrefetch.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/Connection.d.ts.map +1 -1
- package/dist/database/index.d.ts +1 -0
- package/dist/database/index.d.ts.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/database/sqlitePath.d.ts +46 -0
- package/dist/database/sqlitePath.d.ts.map +1 -0
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/ApiRouter.d.ts +1 -1
- package/dist/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/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/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/ai/Agent.test-d.d.ts +0 -2
- package/dist/ai/Agent.test-d.d.ts.map +0 -1
- package/dist/ai/Schema.test-d.d.ts +0 -2
- package/dist/ai/Schema.test-d.d.ts.map +0 -1
- package/dist/ai/client/reducer.test-d.d.ts +0 -2
- package/dist/ai/client/reducer.test-d.d.ts.map +0 -1
- package/dist/ai/example.d.ts +0 -129
- package/dist/ai/example.d.ts.map +0 -1
- package/dist/chunk-4728yrmt.js +0 -5
- package/dist/chunk-4728yrmt.js.map +0 -10
- package/dist/chunk-dq2hgzje.js +0 -5
- package/dist/chunk-f9ccncar.js +0 -5
- package/dist/chunk-f9ccncar.js.map +0 -13
- package/dist/client/useDictionary.test-d.d.ts +0 -2
- package/dist/client/useDictionary.test-d.d.ts.map +0 -1
- package/dist/console/builder.test-d.d.ts +0 -2
- package/dist/console/builder.test-d.d.ts.map +0 -1
- package/dist/http/ApiRouter.test-d.d.ts +0 -2
- package/dist/http/ApiRouter.test-d.d.ts.map +0 -1
- package/dist/http/McpRouter.test-d.d.ts +0 -2
- package/dist/http/McpRouter.test-d.d.ts.map +0 -1
- package/dist/services/events/FakeEventManager.test-d.d.ts +0 -2
- package/dist/services/events/FakeEventManager.test-d.d.ts.map +0 -1
- package/dist/services/events/Listener.test-d.d.ts +0 -2
- package/dist/services/events/Listener.test-d.d.ts.map +0 -1
- /package/dist/{chunk-rj3fnc4h.js.map → chunk-2ghpxrw1.js.map} +0 -0
- /package/dist/{chunk-pbx9p6g0.js.map → chunk-6waph5k8.js.map} +0 -0
- /package/dist/{chunk-z2fnf49p.js.map → chunk-xzexftx1.js.map} +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type AzureConfig, type ProviderConfig } from "./providers/endpoints";
|
|
2
|
+
import { type ImageGenerationRequest, type ImageResponse, type ImagesEndpoint } from "./providers/images";
|
|
3
|
+
import type { AgentError } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* A provider that makes images, separate from the one that makes text.
|
|
6
|
+
*
|
|
7
|
+
* WHY NOT A METHOD ON `AgentProvider`. `provider.generateImage(...)` was the
|
|
8
|
+
* requested shape and it does not survive two facts about this codebase.
|
|
9
|
+
*
|
|
10
|
+
* First, `AgentProvider` is abstract with `stream` and `upload`, and a third
|
|
11
|
+
* abstract member breaks every implementor — including gemi's own `FakeProvider`
|
|
12
|
+
* (duck-typed) and `RecordingProvider` (hand-implements all five members). A
|
|
13
|
+
* capability that only one vendor surface has should not be a hole punched in the
|
|
14
|
+
* interface every other surface has to fill.
|
|
15
|
+
*
|
|
16
|
+
* Second, and this is the real one: an image deployment would have to lie about
|
|
17
|
+
* itself. `capabilities` is computed in the constructor from the model id, and
|
|
18
|
+
* `capabilitiesForModel` deliberately grants an unrecognised id *every*
|
|
19
|
+
* capability — so `AzureOpenAIProvider.model("gpt-image-2")` claims structured
|
|
20
|
+
* output, reasoning and tool search, and exposes a `stream()` that is callable
|
|
21
|
+
* and broken. Splitting the hierarchy makes the wrong call unspellable instead
|
|
22
|
+
* of merely wrong, which is the same reasoning `ScopedAttachments` is built on.
|
|
23
|
+
*
|
|
24
|
+
* What the two hierarchies *do* share is the part worth sharing: which host,
|
|
25
|
+
* which credential, and Azure's api-version fork. That is `providers/endpoints.ts`
|
|
26
|
+
* and neither class reimplements it.
|
|
27
|
+
*/
|
|
28
|
+
export declare abstract class ImageProvider {
|
|
29
|
+
/** The model, or on Azure the model the deployment serves. */
|
|
30
|
+
abstract readonly model: string;
|
|
31
|
+
/** For autocomplete only; any string is accepted, because a model released
|
|
32
|
+
* next Tuesday must not need a gemi release to use. */
|
|
33
|
+
static models(): readonly string[];
|
|
34
|
+
protected abstract endpoint(): ImagesEndpoint;
|
|
35
|
+
/** What goes in the body's `model`. The deployment, on Azure. */
|
|
36
|
+
protected modelName(): string;
|
|
37
|
+
generate(params: ImageProviderParams): Promise<ImageResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* An edit. `images` is required and non-empty — see `ImageModel.edit` for why
|
|
40
|
+
* that is a separate method rather than an optional field on `generate`.
|
|
41
|
+
*/
|
|
42
|
+
edit(params: ImageProviderEditParams): Promise<ImageResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Maps gemi's params onto the vendor's field names.
|
|
45
|
+
*
|
|
46
|
+
* On the base class rather than in each subclass: OpenAI and Azure take the
|
|
47
|
+
* same body, and the only difference is that Azure's `model` names a
|
|
48
|
+
* deployment — which `modelName()` answers.
|
|
49
|
+
*/
|
|
50
|
+
protected body(params: ImageProviderParams): ImageGenerationRequest;
|
|
51
|
+
/** As `AgentProvider.normalizeError`, so an app branches on `rate_limited`
|
|
52
|
+
* without caring which surface produced it. */
|
|
53
|
+
normalizeError(error: unknown): AgentError;
|
|
54
|
+
}
|
|
55
|
+
export type ImageProviderParams = {
|
|
56
|
+
prompt: string;
|
|
57
|
+
size?: string;
|
|
58
|
+
quality?: string;
|
|
59
|
+
background?: string;
|
|
60
|
+
format?: string;
|
|
61
|
+
compression?: number;
|
|
62
|
+
signal?: AbortSignal;
|
|
63
|
+
};
|
|
64
|
+
export type ImageProviderEditParams = ImageProviderParams & {
|
|
65
|
+
images: File[];
|
|
66
|
+
mask?: File;
|
|
67
|
+
};
|
|
68
|
+
export declare class OpenAIImageProvider extends ImageProvider {
|
|
69
|
+
readonly model: string;
|
|
70
|
+
protected readonly config: ProviderConfig;
|
|
71
|
+
constructor(model: string, config?: ProviderConfig);
|
|
72
|
+
static model(model: string, config?: ProviderConfig): OpenAIImageProvider;
|
|
73
|
+
static models(): readonly string[];
|
|
74
|
+
protected endpoint(): ImagesEndpoint;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Azure's image surface, which is the same resource and credential as its chat
|
|
78
|
+
* surface — an app that already configured `AZURE_OPENAI_*` for an agent writes
|
|
79
|
+
* only the deployment name here.
|
|
80
|
+
*
|
|
81
|
+
* `.model()`, not `.deployment()`, for the symmetry `AzureOpenAIProvider` keeps:
|
|
82
|
+
* apps name a model and `AzureConfig.deployment` is the override for a resource
|
|
83
|
+
* whose deployment is called something else.
|
|
84
|
+
*/
|
|
85
|
+
export declare class AzureOpenAIImageProvider extends ImageProvider {
|
|
86
|
+
readonly model: string;
|
|
87
|
+
protected readonly config: AzureConfig;
|
|
88
|
+
constructor(model: string, config?: AzureConfig);
|
|
89
|
+
static model(model: string, config?: AzureConfig): AzureOpenAIImageProvider;
|
|
90
|
+
static models(): readonly string[];
|
|
91
|
+
protected modelName(): string;
|
|
92
|
+
protected endpoint(): ImagesEndpoint;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=ImageProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageProvider.d.ts","sourceRoot":"","sources":["../../ai/ImageProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAKL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,8BAAsB,aAAa;IACjC,8DAA8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E,MAAM,CAAC,MAAM,IAAI,SAAS,MAAM,EAAE;IAIlC,SAAS,CAAC,QAAQ,IAAI,cAAc;CAGrC;AAED;;;;;;;;GAQG;AACH,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;gBAE3B,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,WAAgB;IAMnD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,wBAAwB;IAI3E,MAAM,CAAC,MAAM,IAAI,SAAS,MAAM,EAAE;IAIlC,SAAS,CAAC,SAAS,IAAI,MAAM;IAI7B,SAAS,CAAC,QAAQ,IAAI,cAAc;CAGrC"}
|
package/dist/ai/Schema.d.ts
CHANGED
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
* `required`, `additionalProperties: false` on every object, no patterns, no
|
|
15
15
|
* `oneOf` at the root — and a builder that cannot express the rejected parts is
|
|
16
16
|
* better than one that lets you write a schema the API refuses at runtime.
|
|
17
|
+
*
|
|
18
|
+
* `json()` is the one deliberate hole in that, for the formats strict mode
|
|
19
|
+
* cannot describe at all: a record with arbitrary keys, a mixed-type tuple, a
|
|
20
|
+
* recursive document. It does not widen the subset — it turns strict mode off
|
|
21
|
+
* for the schema containing it, which `supportsStrict` reads back off the tree
|
|
22
|
+
* so that no caller has to remember to.
|
|
17
23
|
*/
|
|
18
24
|
export type JSONSchema = {
|
|
19
25
|
type?: string | string[];
|
|
@@ -26,6 +32,13 @@ export type JSONSchema = {
|
|
|
26
32
|
items?: JSONSchema;
|
|
27
33
|
anyOf?: readonly JSONSchema[];
|
|
28
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Any value JSON can carry. The default output type of `json()`, and the
|
|
37
|
+
* annotation an app reaches for when it hands one of those values on.
|
|
38
|
+
*/
|
|
39
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
40
|
+
[key: string]: JsonValue;
|
|
41
|
+
};
|
|
29
42
|
declare const OUTPUT: unique symbol;
|
|
30
43
|
declare const OPTIONAL: unique symbol;
|
|
31
44
|
/**
|
|
@@ -120,6 +133,55 @@ export declare const s: {
|
|
|
120
133
|
* that as one object with everything optional is worse for the model.
|
|
121
134
|
*/
|
|
122
135
|
union<const S extends readonly [AnySchema, AnySchema, ...AnySchema[]]>(members: S): SchemaBuilder<Infer<S[number]>>;
|
|
136
|
+
/**
|
|
137
|
+
* Any JSON value, constrained by nothing — for a format the rest of this
|
|
138
|
+
* builder cannot describe: a record with arbitrary keys, a mixed-type tuple,
|
|
139
|
+
* a document that nests into itself.
|
|
140
|
+
*
|
|
141
|
+
* A schema containing one cannot be sent under strict mode, so a tool whose
|
|
142
|
+
* input uses it is sent with `strict: false` automatically. That is not an
|
|
143
|
+
* option to pass anywhere; it is read back off the schema by
|
|
144
|
+
* `supportsStrict`. The rest of the tool is unaffected, and so is streaming:
|
|
145
|
+
* partial arguments are parsed from the raw text, never through a schema.
|
|
146
|
+
*
|
|
147
|
+
* `T` is an assertion, not a guarantee. The emitted schema constrains
|
|
148
|
+
* nothing, so nothing checks the model's output against `T` — only that it is
|
|
149
|
+
* JSON. Validate it in `execute` and hand the model back an error it can fix,
|
|
150
|
+
* the way it would any other bad argument. `describe()` is where you tell it
|
|
151
|
+
* the format; with no constraints to read, that prose is all it gets.
|
|
152
|
+
*
|
|
153
|
+
* TWO CALL SIGNATURES, NOT A DEFAULT TYPE PARAMETER, and that is load-bearing.
|
|
154
|
+
* Written `json<T = JsonValue>()`, the default lost to the surrounding
|
|
155
|
+
* contextual type in the position this is actually used: `s.object`'s shape is
|
|
156
|
+
* constrained to `Record<string, AnySchema>` — `Schema<any>` — which supplies
|
|
157
|
+
* `any` as an inference candidate, and a candidate beats a default. So
|
|
158
|
+
* `s.object({ definition: s.json() })` inferred `{ definition: any }`, which is
|
|
159
|
+
* type checking switched off around exactly the field this exists for, and the
|
|
160
|
+
* opposite of what the default was written to prevent. An overload with no type
|
|
161
|
+
* parameter has nothing to infer, so `s.json()` is `JsonValue` wherever it is
|
|
162
|
+
* written.
|
|
163
|
+
*
|
|
164
|
+
* `ai:generate-client` maps it to the native `JSONValue` and says nothing about
|
|
165
|
+
* it. `JsonValue` is a union of every JSON shape, so it used to reach the
|
|
166
|
+
* generator's "a union that is not told apart by one string member" warning —
|
|
167
|
+
* true, and a misdescription of a field that is free-form on purpose. The
|
|
168
|
+
* extractor recognises it now.
|
|
169
|
+
*/
|
|
170
|
+
json(): SchemaBuilder<JsonValue>;
|
|
171
|
+
json<T>(): SchemaBuilder<T>;
|
|
123
172
|
};
|
|
173
|
+
/**
|
|
174
|
+
* Whether a schema can be sent under a provider's strict mode.
|
|
175
|
+
*
|
|
176
|
+
* False exactly when a `json()` node is somewhere inside it. Strict mode's
|
|
177
|
+
* bargain is that every node constrains its value; an unconstrained one has no
|
|
178
|
+
* spelling there, and sending it anyway is a 400 naming a path.
|
|
179
|
+
*
|
|
180
|
+
* Derived from the tree rather than declared alongside it, because the two
|
|
181
|
+
* would drift: a field added to a tool's input a year from now would need
|
|
182
|
+
* whoever adds it to know that a flag somewhere else describes it. Adding the
|
|
183
|
+
* field is the whole of turning strict off.
|
|
184
|
+
*/
|
|
185
|
+
export declare function supportsStrict(schema: AnySchema): boolean;
|
|
124
186
|
export {};
|
|
125
187
|
//# sourceMappingURL=Schema.d.ts.map
|
package/dist/ai/Schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../ai/Schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../ai/Schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,GAA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AM,EAAE,SAAS,GAAG,OAAO,CAkBzD"}
|
package/dist/ai/client/index.js
CHANGED
|
@@ -142,7 +142,8 @@ function reduce(state, event, now) {
|
|
|
142
142
|
case "message-end": return withMessage(state, event.messageId, now, (message) => ({
|
|
143
143
|
...message,
|
|
144
144
|
finishReason: event.finishReason,
|
|
145
|
-
|
|
145
|
+
...event.outputTruncated ? { outputTruncated: true } : {},
|
|
146
|
+
content: event.outputTruncated || event.finishReason === "length" ? message.content.filter((part) => !(part.type === "output" && part.partial)) : message.content.map((part) => part.type === "output" && part.partial ? {
|
|
146
147
|
...part,
|
|
147
148
|
partial: false
|
|
148
149
|
} : part)
|
|
@@ -658,7 +659,7 @@ function forWire(messages) {
|
|
|
658
659
|
* first boundary.
|
|
659
660
|
*/
|
|
660
661
|
function useChat(path, params = {}) {
|
|
661
|
-
const { threadId: initialThreadId, initialMessages, cursor: initialCursor, attach: attachOnMount = true, body: extraBody, headers, onFinish, onError, onAwaitingInput, onAttachMiss } = params;
|
|
662
|
+
const { threadId: initialThreadId, initialMessages, cursor: initialCursor, attach: attachOnMount = true, body: extraBody, headers, onFinish, onToolResult, onError, onAwaitingInput, onAttachMiss } = params;
|
|
662
663
|
const routeParams = useParams();
|
|
663
664
|
const base = useMemo(() => `/api${applyRouteParams(String(path).replace(/^[A-Z]+:/, ""), routeParams)}`, [path, routeParams]);
|
|
664
665
|
/**
|
|
@@ -684,12 +685,14 @@ function useChat(path, params = {}) {
|
|
|
684
685
|
const abortRef = useRef(null);
|
|
685
686
|
const handlers = useRef({
|
|
686
687
|
onFinish,
|
|
688
|
+
onToolResult,
|
|
687
689
|
onError,
|
|
688
690
|
onAwaitingInput,
|
|
689
691
|
onAttachMiss
|
|
690
692
|
});
|
|
691
693
|
handlers.current = {
|
|
692
694
|
onFinish,
|
|
695
|
+
onToolResult,
|
|
693
696
|
onError,
|
|
694
697
|
onAwaitingInput,
|
|
695
698
|
onAttachMiss
|
|
@@ -787,6 +790,8 @@ function useChat(path, params = {}) {
|
|
|
787
790
|
const before = previous.messages.find((m) => m.id === event.messageId);
|
|
788
791
|
const message = next.messages.find((m) => m.id === event.messageId);
|
|
789
792
|
if (message && before?.finishReason === void 0) handlers.current.onFinish?.(message);
|
|
793
|
+
} else if (event.type === "tool-result") {
|
|
794
|
+
if (!previous.messages.some((message) => message.content.some((part) => part.type === "tool-result" && part.toolCallId === event.part.toolCallId))) handlers.current.onToolResult?.(event.part);
|
|
790
795
|
} else if (event.type === "awaiting-input") handlers.current.onAwaitingInput?.(event.pending);
|
|
791
796
|
else if (event.type === "error") handlers.current.onError?.(event.error);
|
|
792
797
|
}
|
|
@@ -832,10 +837,11 @@ function useChat(path, params = {}) {
|
|
|
832
837
|
setPhaseSafe("submitted");
|
|
833
838
|
try {
|
|
834
839
|
const payload = {
|
|
840
|
+
...body,
|
|
835
841
|
turn,
|
|
836
842
|
clientRunId,
|
|
837
|
-
|
|
838
|
-
|
|
843
|
+
threadId: stateRef.current.threadId,
|
|
844
|
+
messages: stateRef.current.threadId ? void 0 : forWire(history)
|
|
839
845
|
};
|
|
840
846
|
const response = await post(url, payload, controller.signal);
|
|
841
847
|
if (!response.ok) {
|