gemi 0.77.0 → 0.78.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 +81 -6
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/client/index.js +2 -1
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +9 -9
- package/dist/ai/index.js.map +3 -3
- package/dist/ai/useChat.d.ts +4 -1
- package/dist/ai/useChat.d.ts.map +1 -1
- package/dist/{chunk-f2hkhw76.js → chunk-971a8v3v.js} +1 -1
- package/dist/{chunk-waax3j1k.js → chunk-sw0kvtpt.js} +1 -1
- package/dist/{chunk-vr84mhmq.js → chunk-tnx6jt4r.js} +2 -2
- package/dist/{chunk-vr84mhmq.js.map → chunk-tnx6jt4r.js.map} +1 -1
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-f2hkhw76.js.map → chunk-971a8v3v.js.map} +0 -0
- /package/dist/{chunk-waax3j1k.js.map → chunk-sw0kvtpt.js.map} +0 -0
|
@@ -175,6 +175,25 @@ declare const ControllerBase: new () => Controller;
|
|
|
175
175
|
* real property would be one an app could see, serialise or depend on.
|
|
176
176
|
*/
|
|
177
177
|
declare const BODY: unique symbol;
|
|
178
|
+
/**
|
|
179
|
+
* What `authorizeRequest` is told about the request, per route.
|
|
180
|
+
*
|
|
181
|
+
* A union on `route` because `body` exists on only two of them: `stream` and
|
|
182
|
+
* `upload` carry the client's `body` option, `attach` and `stop` carry none.
|
|
183
|
+
* Typing it optional everywhere would make every reader of `body.pageId` on
|
|
184
|
+
* `stream` write a check for a case that cannot happen there; narrowing on
|
|
185
|
+
* `route` says which case it is. An override written against the older
|
|
186
|
+
* `{ route; threadId? }` shape still accepts every member.
|
|
187
|
+
*/
|
|
188
|
+
export type AuthorizeRequestParams<Body extends object = Record<string, unknown>> = {
|
|
189
|
+
route: "stream" | "upload";
|
|
190
|
+
threadId?: string;
|
|
191
|
+
body: Body;
|
|
192
|
+
} | {
|
|
193
|
+
route: "attach" | "stop";
|
|
194
|
+
threadId?: string;
|
|
195
|
+
body?: undefined;
|
|
196
|
+
};
|
|
178
197
|
export declare abstract class AgentController<A extends AnyAgent = AnyAgent,
|
|
179
198
|
/**
|
|
180
199
|
* The extra fields `useChat`'s `body` option sends with every turn, as they
|
|
@@ -335,11 +354,16 @@ Body extends object = Record<string, unknown>> extends ControllerBase {
|
|
|
335
354
|
* keeps a thread's live answer, its stop button and its attachments to its
|
|
336
355
|
* owner. It is `undefined` when the request names no thread: a stateless
|
|
337
356
|
* turn, an upload without one, a stop by `runId` or `clientRunId`.
|
|
357
|
+
*
|
|
358
|
+
* `body` is the client's `body` option — the same object `instructions()`,
|
|
359
|
+
* `context()` and `attachmentScope()` get — on the two routes that carry it,
|
|
360
|
+
* `stream` and `upload` (#603). A chat with no thread and no user names its
|
|
361
|
+
* subject there (a page id, say), and this is where to check that the caller
|
|
362
|
+
* may touch it. `attach` and `stop` carry no body, so it is absent on them;
|
|
363
|
+
* narrow on `route` to read it. Like `threadId` it is the client's claim,
|
|
364
|
+
* unchecked.
|
|
338
365
|
*/
|
|
339
|
-
protected authorizeRequest(req: HttpRequest<any, any>, params:
|
|
340
|
-
route: "stream" | "attach" | "stop" | "upload";
|
|
341
|
-
threadId?: string;
|
|
342
|
-
}): void | Promise<void>;
|
|
366
|
+
protected authorizeRequest(req: HttpRequest<any, any>, params: AuthorizeRequestParams<Body>): void | Promise<void>;
|
|
343
367
|
/**
|
|
344
368
|
* `POST /<path>` — one route for every client turn. A first message, an
|
|
345
369
|
* approval, an answer to a question and a client tool's result are all just
|
|
@@ -472,10 +496,59 @@ Body extends object = Record<string, unknown>> extends ControllerBase {
|
|
|
472
496
|
* exist here — not even behind a `console.warn`. So the answer is the
|
|
473
497
|
* documentation you are reading and the identical error, not a probe.
|
|
474
498
|
*
|
|
499
|
+
* THE BODY, AND THE ONE RULE FOR READING IT (#603). The third argument is the
|
|
500
|
+
* client's `body` option — what `instructions()` gets — on both routes that
|
|
501
|
+
* resolve a scope: `stream`, and `upload`, where `useChat.uploadFile` sends
|
|
502
|
+
* the same option beside the file. It exists for the chat that has neither a
|
|
503
|
+
* user nor a thread, a stateless page builder say, whose subject is only in
|
|
504
|
+
* the body:
|
|
505
|
+
*
|
|
506
|
+
* protected async attachmentScope(req, threadId, { body }) {
|
|
507
|
+
* const scope = await super.attachmentScope(req, threadId);
|
|
508
|
+
* if (scope) return scope;
|
|
509
|
+
* if (typeof body.pageId !== "string") return null;
|
|
510
|
+
* const page = await Page.findFirst({ where: { publicId: body.pageId } });
|
|
511
|
+
* return page ? { key: `page:${page.publicId}` } : null;
|
|
512
|
+
* }
|
|
513
|
+
*
|
|
514
|
+
* The `typeof` line is not tidiness. `Body` types the shape, not the contents,
|
|
515
|
+
* and to an ORM `{ publicId: undefined }` is no filter at all: a request that
|
|
516
|
+
* leaves `pageId` out would find the first page in the table and be filed
|
|
517
|
+
* under it, along with every other request that leaves it out.
|
|
518
|
+
*
|
|
519
|
+
* A body field is a value the caller chose, which is exactly what the
|
|
520
|
+
* `sessionId()` paragraph above refuses. What separates the keys this may be
|
|
521
|
+
* built from is not whether the client sent them — `threadId` is sent by the
|
|
522
|
+
* client too — but WHETHER THE VALUE IS AN UNGUESSABLE CAPABILITY WHOSE
|
|
523
|
+
* EXISTENCE THE SERVER CHECKS. A page `publicId` that is looked up, as above,
|
|
524
|
+
* is one, on the same footing as a `threadId` that `loadThread` finds: holding
|
|
525
|
+
* it is what entitles the caller to the page, and an id nobody minted resolves
|
|
526
|
+
* to nothing. `body.orgId` in an app with users is NOT one, and passing the
|
|
527
|
+
* body is precisely what makes `` { key: `org:${body.orgId}` } `` spellable: an
|
|
528
|
+
* org id is enumerable and the caller may not belong to that org, so that is
|
|
529
|
+
* every tenant's files handed to whoever types another tenant's id. A tenant
|
|
530
|
+
* comes from `req.ctx().user`, never from here. And a value interpolated
|
|
531
|
+
* without being looked up is the `sessionId()` mistake again, however
|
|
532
|
+
* unguessable it looks — an anonymous caller then mints a fresh scope per
|
|
533
|
+
* request. Look it up, and key on what the lookup returned.
|
|
534
|
+
*
|
|
535
|
+
* The same skew rule as above applies to the body, and more quietly: the key
|
|
536
|
+
* must come out the same on `upload` and on `stream`. `useChat` sends the one
|
|
537
|
+
* `body` option to both, so a key derived from a field that stays put for the
|
|
538
|
+
* whole conversation — the page, not the selected element — agrees by
|
|
539
|
+
* construction. One derived from a field that changes between the upload and
|
|
540
|
+
* the turn does not, and fails as that same `AttachmentNotFoundError`.
|
|
541
|
+
*
|
|
542
|
+
* The third argument is new, and the method keeps its first two, so an
|
|
543
|
+
* override written as `attachmentScope(req, threadId)` works unchanged; one
|
|
544
|
+
* that calls `super.attachmentScope(req, threadId)` may leave it off too.
|
|
545
|
+
*
|
|
475
546
|
* The key is opaque and compared with `===`. It is never sent to the client
|
|
476
547
|
* and never shown to the model.
|
|
477
548
|
*/
|
|
478
|
-
protected attachmentScope(req: HttpRequest<any, any>, threadId?: string
|
|
549
|
+
protected attachmentScope(req: HttpRequest<any, any>, threadId?: string, extra?: {
|
|
550
|
+
body: Body;
|
|
551
|
+
}): AttachmentScope | null | Promise<AttachmentScope | null>;
|
|
479
552
|
/**
|
|
480
553
|
* WHERE ONE FILE'S BYTES SHOULD GO. Called once per upload, with the file in
|
|
481
554
|
* hand.
|
|
@@ -520,7 +593,9 @@ Body extends object = Record<string, unknown>> extends ControllerBase {
|
|
|
520
593
|
*
|
|
521
594
|
* Issue #490 hangs `ctx.attachments` off this.
|
|
522
595
|
*/
|
|
523
|
-
protected attachmentsFor(req: HttpRequest<any, any>, threadId?: string
|
|
596
|
+
protected attachmentsFor(req: HttpRequest<any, any>, threadId?: string, extra?: {
|
|
597
|
+
body: Body;
|
|
598
|
+
}): Promise<ScopedAttachments | null>;
|
|
524
599
|
/**
|
|
525
600
|
* `POST /<path>/files` — takes an attachment and answers the handles for it.
|
|
526
601
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentController.d.ts","sourceRoot":"","sources":["../../ai/AgentController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentController.d.ts","sourceRoot":"","sources":["../../ai/AgentController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9F,OAAO,EAGL,KAAK,qBAAqB,EAE1B,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAGpB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,uBAAuB,EACvB,QAAQ,IAAI,eAAe,EAC3B,oBAAoB,EACpB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG/E,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EAGZ,eAAe,EACf,UAAU,EACX,MAAM,SAAS,CAAC;AAIjB;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;OAQG;IACH,YAAY,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClF;;;;;;;;;;OAUG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,IAAI,C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M,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC;AAEvF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI;IACtE,gBAAgB,EAAE,YAAY,CAAC;IAC/B,UAAU,EAAE,CAAC,CAAC;IACd,UAAU,CAAC,MAAM,EAAE,qBAAqB,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF;6EAC6E;AAC7E,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,UAAU,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI;IACzE,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,QAAQ,GAC5C,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAC/C,UAAU,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB;;;;;;;;;OASG;IACH,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,SAAS;QAAE,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClF,CAAC"}
|
package/dist/ai/client/index.js
CHANGED
|
@@ -1031,9 +1031,10 @@ function useChat(path, params = {}) {
|
|
|
1031
1031
|
});
|
|
1032
1032
|
}, [commit]);
|
|
1033
1033
|
const uploadFile = useCallback(async (file) => {
|
|
1034
|
-
const { base: url, headers: extraHeaders } = requestRef.current;
|
|
1034
|
+
const { base: url, headers: extraHeaders, extraBody: body } = requestRef.current;
|
|
1035
1035
|
const form = new FormData();
|
|
1036
1036
|
form.append("file", file);
|
|
1037
|
+
if (body !== void 0) form.append("body", JSON.stringify(body));
|
|
1037
1038
|
const response = await fetch(`${url}/files`, {
|
|
1038
1039
|
method: "POST",
|
|
1039
1040
|
headers: { ...extraHeaders },
|