gemi 0.220.0 → 0.221.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 +23 -5
- package/dist/ai/AgentController.d.ts.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 +81 -55
- package/dist/ai/index.js.map +5 -5
- package/dist/ai/store/DatabaseAgentStore.d.ts +72 -4
- package/dist/ai/store/DatabaseAgentStore.d.ts.map +1 -1
- package/dist/ai/store/MemoryAgentStore.d.ts +28 -6
- package/dist/ai/store/MemoryAgentStore.d.ts.map +1 -1
- package/dist/app/App.d.ts +4 -2
- package/dist/app/App.d.ts.map +1 -1
- package/dist/bin/gemi.js.map +2 -2
- package/dist/{chunk-6d67a1d4.js → chunk-00d37bhc.js} +1 -1
- package/dist/chunk-5neyjn6f.js +24 -0
- package/dist/{chunk-8nctfg18.js.map → chunk-5neyjn6f.js.map} +3 -3
- package/dist/chunk-8a3fqcf0.js.map +2 -2
- package/dist/chunk-8rbr4z14.js +58 -0
- package/dist/{chunk-vcy1y0ta.js.map → chunk-8rbr4z14.js.map} +3 -3
- package/dist/chunk-bs4p7dys.js +88 -0
- package/dist/{chunk-7sjzgme6.js.map → chunk-bs4p7dys.js.map} +11 -10
- package/dist/{chunk-x3pbssy4.js → chunk-n8m9vycp.js} +2 -2
- package/dist/{chunk-x3pbssy4.js.map → chunk-n8m9vycp.js.map} +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/http/ApiRouter.d.ts +31 -0
- package/dist/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/CorsMiddleware.d.ts +8 -0
- package/dist/http/CorsMiddleware.d.ts.map +1 -1
- package/dist/http/corsPolicy.d.ts +89 -0
- package/dist/http/corsPolicy.d.ts.map +1 -0
- package/dist/http/index.d.ts +1 -0
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/devFetch.d.ts.map +1 -1
- package/dist/server/httpProd.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/router/ApiRouteDispatcher.d.ts +1 -0
- package/dist/services/router/ApiRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/DomainRouter.d.ts +4 -1
- package/dist/services/router/DomainRouter.d.ts.map +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts +2 -0
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/config.d.ts +20 -0
- package/dist/services/router/config.d.ts.map +1 -1
- package/dist/services/router/createFlatApiRoutes.d.ts +4 -1
- package/dist/services/router/createFlatApiRoutes.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7sjzgme6.js +0 -88
- package/dist/chunk-8nctfg18.js +0 -24
- package/dist/chunk-vcy1y0ta.js +0 -58
- /package/dist/{chunk-6d67a1d4.js.map → chunk-00d37bhc.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SQL } from "bun";
|
|
2
2
|
import type { DatabaseConnection } from "../../database/Connection";
|
|
3
3
|
import type { Dialect } from "../../database/dialect";
|
|
4
|
-
import type { AgentStore } from "../AgentController";
|
|
4
|
+
import type { AgentStore, CreateThreadParams, ThreadSweepResult } from "../AgentController";
|
|
5
5
|
import { type ThreadSummary } from "../contextCompaction";
|
|
6
6
|
import type { AgentMessage } from "../types";
|
|
7
7
|
export type DatabaseAgentStoreOptions = {
|
|
@@ -34,6 +34,29 @@ export type DatabaseAgentStoreOptions = {
|
|
|
34
34
|
* the app's, and the app's own setting applies; the hook is not called.
|
|
35
35
|
*/
|
|
36
36
|
beginScope?: (tx: SQL, scope: string) => unknown;
|
|
37
|
+
/**
|
|
38
|
+
* Threads expire this long after they are created (#1312), or after their
|
|
39
|
+
* last append with `slidingTtl`. An expired thread is one the store does not
|
|
40
|
+
* have: `loadThread` and `getThread` answer `null` (so the controller
|
|
41
|
+
* answers 404 and runs no turn), `listThreads` leaves it out, and
|
|
42
|
+
* `appendMessages` refuses it. `sweepExpired()` deletes it with its messages
|
|
43
|
+
* and summaries. `createThread({ ttlMs })` sets one thread's, and `null`
|
|
44
|
+
* there keeps that thread.
|
|
45
|
+
*
|
|
46
|
+
* Setting it turns expiry on for this store: its statements read the
|
|
47
|
+
* `expires_at` and `ttl_ms` columns, which `createTable()` and
|
|
48
|
+
* `addExpiryColumns()` add (see the upgrade notes for the Prisma fields).
|
|
49
|
+
* Unset, the store never names them and nothing expires. Threads created
|
|
50
|
+
* before it was set have no expiry.
|
|
51
|
+
*/
|
|
52
|
+
ttlMs?: number;
|
|
53
|
+
/**
|
|
54
|
+
* With `ttlMs`, each append moves a thread's expiry to `ttlMs` from then, so
|
|
55
|
+
* a conversation lasts as long as someone keeps writing to it. Default
|
|
56
|
+
* `false`: the expiry is fixed when the thread is created, which suits a
|
|
57
|
+
* thread that lives as long as the token that grants it.
|
|
58
|
+
*/
|
|
59
|
+
slidingTtl?: boolean;
|
|
37
60
|
};
|
|
38
61
|
/** One thread, as `listThreads` and `getThread` answer it. */
|
|
39
62
|
export type AgentThreadRecord = {
|
|
@@ -46,6 +69,11 @@ export type AgentThreadRecord = {
|
|
|
46
69
|
createdAt: number;
|
|
47
70
|
/** Epoch milliseconds of the last write. */
|
|
48
71
|
updatedAt: number;
|
|
72
|
+
/**
|
|
73
|
+
* Epoch milliseconds the thread expires at (#1312), or `null` for one that
|
|
74
|
+
* does not. Only on a store with `ttlMs`; absent otherwise.
|
|
75
|
+
*/
|
|
76
|
+
expiresAt?: number | null;
|
|
49
77
|
};
|
|
50
78
|
/**
|
|
51
79
|
* Conversations (#1063) in two tables of the app's own database, so a thread
|
|
@@ -92,6 +120,8 @@ export declare class DatabaseAgentStore implements AgentStore {
|
|
|
92
120
|
private readonly connection;
|
|
93
121
|
private readonly options;
|
|
94
122
|
constructor(connection: Pick<DatabaseConnection, "sql" | "dialect"> & Partial<Pick<DatabaseConnection, "name">>, options?: DatabaseAgentStoreOptions);
|
|
123
|
+
/** Whether threads expire here: the store has a `ttlMs` (#1312). */
|
|
124
|
+
get expires(): boolean;
|
|
95
125
|
/**
|
|
96
126
|
* This store bound to one scope, a tenant key (#1177): every thread and
|
|
97
127
|
* message it writes carries the scope, and every read and write is filtered
|
|
@@ -105,6 +135,13 @@ export declare class DatabaseAgentStore implements AgentStore {
|
|
|
105
135
|
* not manage its schema with Prisma.
|
|
106
136
|
*/
|
|
107
137
|
createTable(): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Adds the `expires_at` and `ttl_ms` columns and the `expires_at` index
|
|
140
|
+
* (#1312) to a threads table created before them, and does nothing to one
|
|
141
|
+
* that has them. `createTable()` calls it; an app that manages its schema
|
|
142
|
+
* with Prisma adds the fields to its model instead.
|
|
143
|
+
*/
|
|
144
|
+
addExpiryColumns(): Promise<void>;
|
|
108
145
|
/**
|
|
109
146
|
* Adds the `scope` columns and index (#1177) to tables created before them,
|
|
110
147
|
* and does nothing to tables that have them. `createTable()` calls it; an app
|
|
@@ -113,9 +150,7 @@ export declare class DatabaseAgentStore implements AgentStore {
|
|
|
113
150
|
*/
|
|
114
151
|
addScopeColumns(): Promise<void>;
|
|
115
152
|
private hasColumn;
|
|
116
|
-
createThread(params: {
|
|
117
|
-
userId?: string | number;
|
|
118
|
-
}): Promise<{
|
|
153
|
+
createThread(params?: CreateThreadParams): Promise<{
|
|
119
154
|
threadId: string;
|
|
120
155
|
}>;
|
|
121
156
|
loadThread(threadId: string): Promise<AgentMessage[] | null>;
|
|
@@ -148,6 +183,21 @@ export declare class DatabaseAgentStore implements AgentStore {
|
|
|
148
183
|
* see `AgentMemories.deleteScope`.
|
|
149
184
|
*/
|
|
150
185
|
deleteThread(threadId: string): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Deletes up to `limit` (default 500) expired threads with their messages
|
|
188
|
+
* and summaries (#1312), oldest expiry first. For a `CronJob` every few
|
|
189
|
+
* minutes, next to `AgentController.sweepAttachments()`.
|
|
190
|
+
*
|
|
191
|
+
* A scoped view sweeps its scope only. `now` (epoch milliseconds) stands in
|
|
192
|
+
* for the database's clock, for tests. A store without `ttlMs` has nothing
|
|
193
|
+
* that expires, and answers `{ deleted: 0 }` without touching the table.
|
|
194
|
+
* An expired thread is already unreadable before the sweep runs; the sweep
|
|
195
|
+
* only reclaims its rows.
|
|
196
|
+
*/
|
|
197
|
+
sweepExpired(options?: {
|
|
198
|
+
now?: number;
|
|
199
|
+
limit?: number;
|
|
200
|
+
}): Promise<ThreadSweepResult>;
|
|
151
201
|
/**
|
|
152
202
|
* Runs `fn` in a transaction: a savepoint in the open ORM transaction when it
|
|
153
203
|
* is on this store's connection, a transaction of its own otherwise.
|
|
@@ -166,6 +216,18 @@ export declare class DatabaseAgentStore implements AgentStore {
|
|
|
166
216
|
private guard;
|
|
167
217
|
/** The scope condition: `1 = 1` on the unscoped store, which reads every row. */
|
|
168
218
|
private inScope;
|
|
219
|
+
/**
|
|
220
|
+
* Not expired (#1312), by the database's clock. `1 = 1` on a store without
|
|
221
|
+
* `ttlMs`, which never names the expiry columns.
|
|
222
|
+
*/
|
|
223
|
+
private live;
|
|
224
|
+
/** The columns of an `AgentThreadRecord`. */
|
|
225
|
+
private recordColumns;
|
|
226
|
+
/**
|
|
227
|
+
* A new thread's expiry, or `null` on a store without `ttlMs`, which
|
|
228
|
+
* refuses a thread's own.
|
|
229
|
+
*/
|
|
230
|
+
private expiryOf;
|
|
169
231
|
private quote;
|
|
170
232
|
private threads;
|
|
171
233
|
private messages;
|
|
@@ -184,4 +246,10 @@ export declare function createAgentStoreTableStatements(dialect: Dialect, thread
|
|
|
184
246
|
* that does not have the column yet.
|
|
185
247
|
*/
|
|
186
248
|
export declare function addScopeColumnStatements(dialect: Dialect, threadsTable: string, messagesTable: string): [table: string, statements: string[]][];
|
|
249
|
+
/**
|
|
250
|
+
* What brings a threads table created before expiry (#1312) up to date: the
|
|
251
|
+
* `expires_at` and `ttl_ms` columns and the `expires_at` index. Run only for a
|
|
252
|
+
* table that does not have `expires_at` yet.
|
|
253
|
+
*/
|
|
254
|
+
export declare function addExpiryColumnStatements(dialect: Dialect, threadsTable: string): string[];
|
|
187
255
|
//# sourceMappingURL=DatabaseAgentStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseAgentStore.d.ts","sourceRoot":"","sources":["../../../ai/store/DatabaseAgentStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"DatabaseAgentStore.d.ts","sourceRoot":"","sources":["../../../ai/store/DatabaseAgentStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;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|
|
1
|
-
import type { AgentStore } from "../AgentController";
|
|
1
|
+
import type { AgentStore, CreateThreadParams, ThreadSweepResult } from "../AgentController";
|
|
2
2
|
import { type ThreadSummary } from "../contextCompaction";
|
|
3
3
|
import type { AgentMessage } from "../types";
|
|
4
4
|
/**
|
|
@@ -25,7 +25,10 @@ import type { AgentMessage } from "../types";
|
|
|
25
25
|
* setup where an unknown id is not a lost thread, because the client minted it.
|
|
26
26
|
*/
|
|
27
27
|
export declare class MemoryAgentStore implements AgentStore {
|
|
28
|
+
/** How long a thread lasts: after its last read or write, or after it was created when `slidingTtl` is `false`. */
|
|
28
29
|
readonly ttlMs: number;
|
|
30
|
+
/** Each read and write restarts a thread's `ttlMs` (the default), or not (`false`). */
|
|
31
|
+
readonly slidingTtl: boolean;
|
|
29
32
|
/** The ids come from the client, not from `createThread`, so an id this
|
|
30
33
|
* store has never seen is a conversation starting rather than one lost. */
|
|
31
34
|
readonly clientOwnedIds: boolean;
|
|
@@ -35,6 +38,7 @@ export declare class MemoryAgentStore implements AgentStore {
|
|
|
35
38
|
private lastSweep;
|
|
36
39
|
constructor(params?: {
|
|
37
40
|
ttlMs?: number;
|
|
41
|
+
slidingTtl?: boolean;
|
|
38
42
|
clientOwnedIds?: boolean;
|
|
39
43
|
});
|
|
40
44
|
/**
|
|
@@ -43,13 +47,21 @@ export declare class MemoryAgentStore implements AgentStore {
|
|
|
43
47
|
* sees no thread of another. The store itself sees every thread.
|
|
44
48
|
*/
|
|
45
49
|
forScope(scope: string): MemoryAgentStore;
|
|
46
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The thread, if this store or view may see it. One that has expired is
|
|
52
|
+
* dropped here (#1312), not only by the next sweep, so it is never read or
|
|
53
|
+
* written after its time.
|
|
54
|
+
*/
|
|
47
55
|
private visible;
|
|
48
|
-
/** A fresh thread, in this view's scope. */
|
|
56
|
+
/** A fresh thread, in this view's scope, with `params`' expiry or the store's. */
|
|
49
57
|
private fresh;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
/** A read or write: a sliding thread's expiry starts again. */
|
|
59
|
+
private touch;
|
|
60
|
+
/**
|
|
61
|
+
* `ttlMs` (or `null`, never) and `expiresAt` set this thread's expiry in
|
|
62
|
+
* place of the store's `ttlMs`, as `DatabaseAgentStore` takes them.
|
|
63
|
+
*/
|
|
64
|
+
createThread(params?: CreateThreadParams): Promise<{
|
|
53
65
|
threadId: string;
|
|
54
66
|
}>;
|
|
55
67
|
loadThread(threadId: string): Promise<AgentMessage[] | null>;
|
|
@@ -60,7 +72,17 @@ export declare class MemoryAgentStore implements AgentStore {
|
|
|
60
72
|
/** Test seam, and a way for an app to drop a conversation on request. */
|
|
61
73
|
delete(threadId: string): void;
|
|
62
74
|
get size(): number;
|
|
75
|
+
/** Drops expired threads, at most once a minute; every read and write calls it. */
|
|
63
76
|
sweep(now?: number): void;
|
|
77
|
+
/**
|
|
78
|
+
* Deletes up to `limit` (default 500) expired threads now, as
|
|
79
|
+
* `DatabaseAgentStore.sweepExpired` does (#1312). A view sweeps its scope
|
|
80
|
+
* only. An expired thread is already unreadable before this runs.
|
|
81
|
+
*/
|
|
82
|
+
sweepExpired(options?: {
|
|
83
|
+
now?: number;
|
|
84
|
+
limit?: number;
|
|
85
|
+
}): Promise<ThreadSweepResult>;
|
|
64
86
|
}
|
|
65
87
|
/**
|
|
66
88
|
* The process-wide default every `AgentController` uses unless it is given
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryAgentStore.d.ts","sourceRoot":"","sources":["../../../ai/store/MemoryAgentStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"MemoryAgentStore.d.ts","sourceRoot":"","sources":["../../../ai/store/MemoryAgentStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,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,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAKzD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1E,yEAAyE;IACzE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAI9B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,mFAAmF;IACnF,KAAK,CAAC,GAAG,SAAa,GAAG,IAAI;IAY7B;;;;OAIG;IACG,YAAY,CAAC,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAe/F;AAMD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,kBAAyB,CAAC"}
|
package/dist/app/App.d.ts
CHANGED
|
@@ -46,12 +46,14 @@ export declare class App {
|
|
|
46
46
|
/**
|
|
47
47
|
* How the servers serve static files to `req`'s host (#1015): whether the
|
|
48
48
|
* files copied out of `public/` are served, and whether a miss under
|
|
49
|
-
* `/assets` reaches the routes
|
|
50
|
-
* `
|
|
49
|
+
* `/assets` reaches the routes, and whether `/assets` files are sent with
|
|
50
|
+
* `Access-Control-Allow-Origin: *` (#1311). Resolves the host only when a
|
|
51
|
+
* `route.domains` group sets one of them differently from the root.
|
|
51
52
|
*/
|
|
52
53
|
staticFiles(req: Request): Promise<{
|
|
53
54
|
publicFiles: boolean;
|
|
54
55
|
assetRoutes: boolean;
|
|
56
|
+
assetCors?: boolean;
|
|
55
57
|
}>;
|
|
56
58
|
getRouteManifest(): Record<string, string[]>;
|
|
57
59
|
private globallyGated;
|
package/dist/app/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../app/App.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MA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