@amaster.ai/dsh-storage 0.1.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/LICENSE +21 -0
- package/README.md +66 -0
- package/cordis.patch.yml +3 -0
- package/lib/backends/database.js +198 -0
- package/lib/generated/mysql/browser.js +17 -0
- package/lib/generated/mysql/client.js +34 -0
- package/lib/generated/mysql/commonInputTypes.js +10 -0
- package/lib/generated/mysql/enums.js +10 -0
- package/lib/generated/mysql/internal/class.js +49 -0
- package/lib/generated/mysql/internal/prismaNamespace.js +146 -0
- package/lib/generated/mysql/internal/prismaNamespaceBrowser.js +117 -0
- package/lib/generated/mysql/models/AiChatHistory.js +1 -0
- package/lib/generated/mysql/models/AiMessage.js +1 -0
- package/lib/generated/mysql/models.js +1 -0
- package/lib/generated/postgresql/browser.js +17 -0
- package/lib/generated/postgresql/client.js +34 -0
- package/lib/generated/postgresql/commonInputTypes.js +10 -0
- package/lib/generated/postgresql/enums.js +10 -0
- package/lib/generated/postgresql/internal/class.js +49 -0
- package/lib/generated/postgresql/internal/prismaNamespace.js +131 -0
- package/lib/generated/postgresql/internal/prismaNamespaceBrowser.js +102 -0
- package/lib/generated/postgresql/models/AiChatHistory.js +1 -0
- package/lib/generated/postgresql/models/AiMessage.js +1 -0
- package/lib/generated/postgresql/models.js +1 -0
- package/lib/generated/sqlite/browser.js +17 -0
- package/lib/generated/sqlite/client.js +34 -0
- package/lib/generated/sqlite/commonInputTypes.js +10 -0
- package/lib/generated/sqlite/enums.js +10 -0
- package/lib/generated/sqlite/internal/class.js +49 -0
- package/lib/generated/sqlite/internal/prismaNamespace.js +128 -0
- package/lib/generated/sqlite/internal/prismaNamespaceBrowser.js +99 -0
- package/lib/generated/sqlite/models/AiChatHistory.js +1 -0
- package/lib/generated/sqlite/models/AiMessage.js +1 -0
- package/lib/generated/sqlite/models.js +1 -0
- package/lib/generated/sqlserver/browser.js +17 -0
- package/lib/generated/sqlserver/client.js +34 -0
- package/lib/generated/sqlserver/commonInputTypes.js +10 -0
- package/lib/generated/sqlserver/enums.js +10 -0
- package/lib/generated/sqlserver/internal/class.js +49 -0
- package/lib/generated/sqlserver/internal/prismaNamespace.js +119 -0
- package/lib/generated/sqlserver/internal/prismaNamespaceBrowser.js +90 -0
- package/lib/generated/sqlserver/models/AiChatHistory.js +1 -0
- package/lib/generated/sqlserver/models/AiMessage.js +1 -0
- package/lib/generated/sqlserver/models.js +1 -0
- package/lib/index.js +224 -0
- package/lib/projector.js +153 -0
- package/lib/types/backends/database.d.ts +37 -0
- package/lib/types/generated/mysql/browser.d.ts +15 -0
- package/lib/types/generated/mysql/client.d.ts +34 -0
- package/lib/types/generated/mysql/commonInputTypes.d.ts +396 -0
- package/lib/types/generated/mysql/enums.d.ts +1 -0
- package/lib/types/generated/mysql/internal/class.d.ts +143 -0
- package/lib/types/generated/mysql/internal/prismaNamespace.d.ts +709 -0
- package/lib/types/generated/mysql/internal/prismaNamespaceBrowser.d.ts +112 -0
- package/lib/types/generated/mysql/models/AiChatHistory.d.ts +1258 -0
- package/lib/types/generated/mysql/models/AiMessage.d.ts +1360 -0
- package/lib/types/generated/mysql/models.d.ts +3 -0
- package/lib/types/generated/postgresql/browser.d.ts +15 -0
- package/lib/types/generated/postgresql/client.d.ts +34 -0
- package/lib/types/generated/postgresql/commonInputTypes.d.ts +392 -0
- package/lib/types/generated/postgresql/enums.d.ts +1 -0
- package/lib/types/generated/postgresql/internal/class.d.ts +143 -0
- package/lib/types/generated/postgresql/internal/prismaNamespace.d.ts +728 -0
- package/lib/types/generated/postgresql/internal/prismaNamespaceBrowser.d.ts +95 -0
- package/lib/types/generated/postgresql/models/AiChatHistory.d.ts +1373 -0
- package/lib/types/generated/postgresql/models/AiMessage.d.ts +1497 -0
- package/lib/types/generated/postgresql/models.d.ts +3 -0
- package/lib/types/generated/sqlite/browser.d.ts +15 -0
- package/lib/types/generated/sqlite/client.d.ts +34 -0
- package/lib/types/generated/sqlite/commonInputTypes.d.ts +373 -0
- package/lib/types/generated/sqlite/enums.d.ts +1 -0
- package/lib/types/generated/sqlite/internal/class.d.ts +143 -0
- package/lib/types/generated/sqlite/internal/prismaNamespace.d.ts +705 -0
- package/lib/types/generated/sqlite/internal/prismaNamespaceBrowser.d.ts +92 -0
- package/lib/types/generated/sqlite/models/AiChatHistory.d.ts +1371 -0
- package/lib/types/generated/sqlite/models/AiMessage.d.ts +1494 -0
- package/lib/types/generated/sqlite/models.d.ts +3 -0
- package/lib/types/generated/sqlserver/browser.d.ts +15 -0
- package/lib/types/generated/sqlserver/client.d.ts +34 -0
- package/lib/types/generated/sqlserver/commonInputTypes.d.ts +333 -0
- package/lib/types/generated/sqlserver/enums.d.ts +1 -0
- package/lib/types/generated/sqlserver/internal/class.d.ts +143 -0
- package/lib/types/generated/sqlserver/internal/prismaNamespace.d.ts +669 -0
- package/lib/types/generated/sqlserver/internal/prismaNamespaceBrowser.d.ts +80 -0
- package/lib/types/generated/sqlserver/models/AiChatHistory.d.ts +1257 -0
- package/lib/types/generated/sqlserver/models/AiMessage.d.ts +1376 -0
- package/lib/types/generated/sqlserver/models.d.ts +3 -0
- package/lib/types/index.d.ts +56 -0
- package/lib/types/projector.d.ts +48 -0
- package/lib/types/types.d.ts +49 -0
- package/lib/types.js +8 -0
- package/package.json +85 -0
- package/preview.png +0 -0
- package/prisma/schema.mysql.prisma +75 -0
- package/prisma/schema.postgresql.prisma +67 -0
- package/prisma/schema.sqlite.prisma +67 -0
- package/prisma/schema.sqlserver.prisma +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-plugins contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @amaster.ai/dsh-storage
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Session storage mirror for [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness): projects the `session/event` stream into MySQL/PostgreSQL/SQLite/SQL Server (`ai_messages` / `ai_chat_histories`, same tables as the source project) without replacing dsh's local persistence — local files stay authoritative, this is a mirror.
|
|
6
|
+
|
|
7
|
+
Use it when a dsh profile needs durable, queryable session data in an existing relational database while preserving the runtime's local session store as the source of truth.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
dsh plugin --profile my-agent add @amaster.ai/dsh-storage
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Runtime peers: `@prisma/client` (**Prisma 7**) plus the driver adapter for your database:
|
|
16
|
+
|
|
17
|
+
| Provider | Adapter peer |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `mysql` | `@prisma/adapter-mariadb` |
|
|
20
|
+
| `postgresql` | `@prisma/adapter-pg` |
|
|
21
|
+
| `sqlite` | `@prisma/adapter-libsql` |
|
|
22
|
+
| `sqlserver` | `@prisma/adapter-mssql` |
|
|
23
|
+
|
|
24
|
+
The PrismaClient is pre-generated per provider and shipped in the package — **no `prisma generate` step** for consumers.
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
Disabled by default. Configure via the profile's `cordis.patch.yml`:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
- insert:
|
|
32
|
+
- id: storage-mirror
|
|
33
|
+
name: '@amaster.ai/dsh-storage'
|
|
34
|
+
config:
|
|
35
|
+
enabled: true
|
|
36
|
+
database:
|
|
37
|
+
enabled: true
|
|
38
|
+
provider: mysql # mysql | postgresql | sqlite | sqlserver
|
|
39
|
+
url: mysql://user:pass@host:3306/agent
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Create or upgrade the tables with the shipped schema variant:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npx prisma db push --schema node_modules/@amaster.ai/dsh-storage/prisma/schema.mysql.prisma --url "mysql://user:pass@host:3306/agent"
|
|
46
|
+
# schema.postgresql.prisma / schema.sqlite.prisma / schema.sqlserver.prisma work the same way
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Data model
|
|
50
|
+
|
|
51
|
+
- **`ai_messages`** — one row per projected session event (user / model / tool), with `thoughts`, `tokens`, `tool_calls`, `agent_id`, `metadata` JSON columns and soft-delete.
|
|
52
|
+
- **`ai_chat_histories`** — per-session rollup (message count, total tokens, first/last message timestamps).
|
|
53
|
+
|
|
54
|
+
The logical message id rides in `metadata.id`; message rows use a deterministic hash of `(session_id, message id)` as their primary key, so re-projected events upsert in place rather than duplicate — on every connector. Session rows are matched by `session_id` and keep their cuid primary keys. One deviation from the source project: no `user_id` column — tenancy rides on `session_id`.
|
|
55
|
+
|
|
56
|
+
SQL Server note: Prisma's sqlserver connector has no `Json` type, so its variant maps the JSON columns to text — the backend serializes them on write automatically (SQL Server's `ISJSON` / `JSON_VALUE` still query the text as JSON).
|
|
57
|
+
|
|
58
|
+
Mirroring is a no-throw seam: backend errors are logged with a `[dsh-storage]` prefix and never escape into the agent loop.
|
|
59
|
+
|
|
60
|
+
## Compatibility
|
|
61
|
+
|
|
62
|
+
Pinned dsh/cordis versions live in the [root compat matrix](../../README.md#compatibility). Event payloads ride pre-release dsh APIs — check the `TODO(verify)` markers in `src/` before upgrading dsh.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MySQL/PostgreSQL/SQLite/SQL Server backend via Prisma 7. The clients are
|
|
3
|
+
* pre-generated at package build time (`pnpm generate`, see
|
|
4
|
+
* scripts/prisma-generate.mjs) from the schema variants in prisma/ and
|
|
5
|
+
* shipped compiled in lib/generated — consumers never run `prisma generate`.
|
|
6
|
+
*
|
|
7
|
+
* Prisma 7 requires a driver adapter per database; `@prisma/client` and the
|
|
8
|
+
* adapter for your provider are optional peer dependencies (sqlite uses
|
|
9
|
+
* `@prisma/adapter-libsql` — no native build scripts, unlike
|
|
10
|
+
* `@prisma/adapter-better-sqlite3`). Table creation
|
|
11
|
+
* (`prisma db push` / migrations) uses the shipped schema variant with the
|
|
12
|
+
* connection URL in the user's prisma.config.ts.
|
|
13
|
+
*/
|
|
14
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
+
import { createHash } from 'node:crypto';
|
|
16
|
+
/**
|
|
17
|
+
* Deterministic primary key for a row: one logical id maps to one row, so
|
|
18
|
+
* redelivery (plugin reload, resume edge cases) updates in place instead of
|
|
19
|
+
* duplicating. A PK upsert works on every Prisma connector — the source
|
|
20
|
+
* project's `metadata.id` JSON-path lookup does not (advanced JSON filtering
|
|
21
|
+
* is PostgreSQL/MySQL only). `metadata.id` is still written for
|
|
22
|
+
* source-compatible read paths.
|
|
23
|
+
*/
|
|
24
|
+
function pk(value) {
|
|
25
|
+
return createHash('sha256').update(value).digest('hex').slice(0, 36);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse the prisma-style sqlserver URL
|
|
29
|
+
* (sqlserver://host:1433;database=d;user=u;password=p;encrypt=true;trustServerCertificate=true)
|
|
30
|
+
* into a node-mssql config object. Values are URL-decoded — credentials with
|
|
31
|
+
* special characters arrive percent-encoded.
|
|
32
|
+
*/
|
|
33
|
+
function mssqlConfig(url) {
|
|
34
|
+
const decode = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
return decodeURIComponent(value);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return value; // plain value with a raw '%' — pass through unchanged
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const [authority, ...pairs] = url.replace(/^sqlserver:\/\//, '').split(';');
|
|
43
|
+
const [server, port] = authority.split(':');
|
|
44
|
+
const params = Object.fromEntries(pairs
|
|
45
|
+
.filter((pair) => pair.includes('='))
|
|
46
|
+
.map((pair) => [pair.slice(0, pair.indexOf('=')), decode(pair.slice(pair.indexOf('=') + 1))]));
|
|
47
|
+
for (const key of ['database', 'user', 'password']) {
|
|
48
|
+
// Redact everything from 'password=' on: this error surfaces in logs via
|
|
49
|
+
// the no-throw seam, and a malformed URL must not leak any fragment.
|
|
50
|
+
if (params[key] == null)
|
|
51
|
+
throw new Error(`sqlserver url is missing '${key}': ${url.replace(/(password=).*$/i, '$1***')}`);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
server,
|
|
55
|
+
...(port ? { port: Number(port) } : {}),
|
|
56
|
+
database: params.database,
|
|
57
|
+
user: params.user,
|
|
58
|
+
password: params.password,
|
|
59
|
+
options: {
|
|
60
|
+
encrypt: params.encrypt === 'true',
|
|
61
|
+
trustServerCertificate: params.trustServerCertificate === 'true',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export async function createAdapter(config) {
|
|
66
|
+
switch (config.provider) {
|
|
67
|
+
case 'mysql': {
|
|
68
|
+
// The mariadb driver accepts mariadb:// URIs; mysql:// is the same wire.
|
|
69
|
+
const { PrismaMariaDb } = await import('@prisma/adapter-mariadb');
|
|
70
|
+
return new PrismaMariaDb(config.url.replace(/^mysql:\/\//, 'mariadb://'));
|
|
71
|
+
}
|
|
72
|
+
case 'postgresql': {
|
|
73
|
+
const { PrismaPg } = await import('@prisma/adapter-pg');
|
|
74
|
+
return new PrismaPg({ connectionString: config.url });
|
|
75
|
+
}
|
|
76
|
+
case 'sqlite': {
|
|
77
|
+
// adapter-libsql (not adapter-better-sqlite3): its native binding ships
|
|
78
|
+
// as platform optionalDependencies with no install scripts, so it works
|
|
79
|
+
// under pnpm's default build-script block (dsh profiles install that way).
|
|
80
|
+
const { PrismaLibSql } = await import('@prisma/adapter-libsql');
|
|
81
|
+
return new PrismaLibSql({ url: config.url });
|
|
82
|
+
}
|
|
83
|
+
case 'sqlserver': {
|
|
84
|
+
const { PrismaMssql } = await import('@prisma/adapter-mssql');
|
|
85
|
+
return new PrismaMssql(mssqlConfig(config.url));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export class DatabaseBackend {
|
|
90
|
+
config;
|
|
91
|
+
name = 'database';
|
|
92
|
+
prisma = null;
|
|
93
|
+
constructor(config) {
|
|
94
|
+
this.config = config;
|
|
95
|
+
}
|
|
96
|
+
/** Load the pre-generated client for the configured provider (seam for tests). */
|
|
97
|
+
async loadClient() {
|
|
98
|
+
const mod = await import(new URL(`../generated/${this.config.provider}/client.js`, import.meta.url).href);
|
|
99
|
+
return mod.PrismaClient;
|
|
100
|
+
}
|
|
101
|
+
async init() {
|
|
102
|
+
const [PrismaClient, adapter] = await Promise.all([
|
|
103
|
+
this.loadClient(),
|
|
104
|
+
createAdapter(this.config),
|
|
105
|
+
]);
|
|
106
|
+
this.prisma = new PrismaClient({ adapter });
|
|
107
|
+
await this.prisma.$connect();
|
|
108
|
+
}
|
|
109
|
+
/** JSON column value, text-serialized on SQL Server (no Prisma Json type). */
|
|
110
|
+
jsonField(value) {
|
|
111
|
+
return value == null
|
|
112
|
+
? undefined
|
|
113
|
+
: this.config.provider === 'sqlserver'
|
|
114
|
+
? JSON.stringify(value)
|
|
115
|
+
: value;
|
|
116
|
+
}
|
|
117
|
+
toDbData(row) {
|
|
118
|
+
// SQL Server has no Prisma Json type: its variant uses text columns, so
|
|
119
|
+
// JSON fields are serialized on write (derived from the provider — the
|
|
120
|
+
// only valid combination, not a user knob).
|
|
121
|
+
return {
|
|
122
|
+
type: row.type,
|
|
123
|
+
content: row.content,
|
|
124
|
+
thoughts: this.jsonField(row.thoughts),
|
|
125
|
+
model: row.model ?? undefined,
|
|
126
|
+
tokens: this.jsonField(row.tokens),
|
|
127
|
+
toolCalls: this.jsonField(row.toolCalls),
|
|
128
|
+
agentId: row.agentId ?? undefined,
|
|
129
|
+
metadata: this.jsonField({ id: row.id, ...(row.metadata ?? {}) }),
|
|
130
|
+
createdAt: row.createdAt,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
async upsertMessage(row) {
|
|
134
|
+
if (!this.prisma)
|
|
135
|
+
return;
|
|
136
|
+
// NUL-separated: a space-joined pair would be ambiguous ('a b','c' ≡ 'a','b c').
|
|
137
|
+
const id = pk(`message ${row.sessionId}\0${row.id}`);
|
|
138
|
+
const data = this.toDbData(row);
|
|
139
|
+
await this.prisma.aiMessage.upsert({
|
|
140
|
+
where: { id },
|
|
141
|
+
create: { id, sessionId: row.sessionId, historyId: row.historyId, ...data },
|
|
142
|
+
update: data,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async readSession(sessionId) {
|
|
146
|
+
if (!this.prisma)
|
|
147
|
+
return null;
|
|
148
|
+
const row = await this.prisma.aiChatHistory.findFirst({
|
|
149
|
+
where: { sessionId, deletedAt: null },
|
|
150
|
+
});
|
|
151
|
+
if (!row)
|
|
152
|
+
return null;
|
|
153
|
+
return {
|
|
154
|
+
sessionId: row.sessionId,
|
|
155
|
+
title: row.title,
|
|
156
|
+
messageCount: row.messageCount,
|
|
157
|
+
totalTokens: Number(row.totalTokens),
|
|
158
|
+
firstMessageAt: row.firstMessageAt,
|
|
159
|
+
lastMessageAt: row.lastMessageAt,
|
|
160
|
+
// SQL Server stores JSON columns as text — parse them back on read.
|
|
161
|
+
metadata: row.metadata == null
|
|
162
|
+
? undefined
|
|
163
|
+
: typeof row.metadata === 'string'
|
|
164
|
+
? JSON.parse(row.metadata)
|
|
165
|
+
: row.metadata,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
async upsertSession(row) {
|
|
169
|
+
if (!this.prisma)
|
|
170
|
+
return;
|
|
171
|
+
// Find-then-write is race-free because the plugin serializes event
|
|
172
|
+
// processing per session (see the per-session chain in index.ts). The
|
|
173
|
+
// cuid primary key matches the source project and early-scaffold rows,
|
|
174
|
+
// so existing data is continued, never duplicated.
|
|
175
|
+
const existing = await this.prisma.aiChatHistory.findFirst({
|
|
176
|
+
where: { sessionId: row.sessionId, deletedAt: null },
|
|
177
|
+
select: { id: true },
|
|
178
|
+
});
|
|
179
|
+
const data = {
|
|
180
|
+
sessionId: row.sessionId,
|
|
181
|
+
title: row.title ?? undefined,
|
|
182
|
+
messageCount: row.messageCount,
|
|
183
|
+
totalTokens: BigInt(row.totalTokens),
|
|
184
|
+
firstMessageAt: row.firstMessageAt ?? undefined,
|
|
185
|
+
lastMessageAt: row.lastMessageAt ?? undefined,
|
|
186
|
+
metadata: this.jsonField(row.metadata),
|
|
187
|
+
};
|
|
188
|
+
if (existing) {
|
|
189
|
+
await this.prisma.aiChatHistory.update({ where: { id: existing.id }, data });
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
await this.prisma.aiChatHistory.create({ data });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async close() {
|
|
196
|
+
await this.prisma?.$disconnect?.();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// biome-ignore-all lint: generated file
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* This file should be your main import to use Prisma-related types and utilities in a browser.
|
|
7
|
+
* Use it to get access to models, enums, and input types.
|
|
8
|
+
*
|
|
9
|
+
* This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
|
|
10
|
+
* See `client.ts` for the standard, server-side entry point.
|
|
11
|
+
*
|
|
12
|
+
* 🟢 You can import this file directly.
|
|
13
|
+
*/
|
|
14
|
+
import * as Prisma from './internal/prismaNamespaceBrowser.js';
|
|
15
|
+
export { Prisma };
|
|
16
|
+
export * as $Enums from './enums.js';
|
|
17
|
+
export * from './enums.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// biome-ignore-all lint: generated file
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
|
|
7
|
+
* If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
|
|
8
|
+
*
|
|
9
|
+
* 🟢 You can import this file directly.
|
|
10
|
+
*/
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
import * as $Class from "./internal/class.js";
|
|
15
|
+
import * as Prisma from "./internal/prismaNamespace.js";
|
|
16
|
+
export * as $Enums from './enums.js';
|
|
17
|
+
export * from "./enums.js";
|
|
18
|
+
/**
|
|
19
|
+
* ## Prisma Client
|
|
20
|
+
*
|
|
21
|
+
* Type-safe database client for TypeScript
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* const prisma = new PrismaClient({
|
|
25
|
+
* adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL })
|
|
26
|
+
* })
|
|
27
|
+
* // Fetch zero or more AiMessages
|
|
28
|
+
* const aiMessages = await prisma.aiMessage.findMany()
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Read more in our [docs](https://pris.ly/d/client).
|
|
32
|
+
*/
|
|
33
|
+
export const PrismaClient = $Class.getPrismaClientClass();
|
|
34
|
+
export { Prisma };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// biome-ignore-all lint: generated file
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* This file exports various common sort, input & filter types that are not directly linked to a particular model.
|
|
7
|
+
*
|
|
8
|
+
* 🟢 You can import this file directly.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// biome-ignore-all lint: generated file
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* This file exports all enum related types from the schema.
|
|
7
|
+
*
|
|
8
|
+
* 🟢 You can import this file directly.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// biome-ignore-all lint: generated file
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* WARNING: This is an internal file that is subject to change!
|
|
7
|
+
*
|
|
8
|
+
* 🛑 Under no circumstances should you import this file directly! 🛑
|
|
9
|
+
*
|
|
10
|
+
* Please import the `PrismaClient` class from the `client.ts` file instead.
|
|
11
|
+
*/
|
|
12
|
+
import * as runtime from "@prisma/client/runtime/client";
|
|
13
|
+
const config = {
|
|
14
|
+
"previewFeatures": [],
|
|
15
|
+
"clientVersion": "7.9.1",
|
|
16
|
+
"engineVersion": "e922089b7d7502aff4249d5da3420f6fa55fc6ad",
|
|
17
|
+
"activeProvider": "mysql",
|
|
18
|
+
"inlineSchema": "// Prisma schema for the dsh-storage database backend — MySQL variant (Prisma 7).\n//\n// Table layout matches the source project's ai_messages / ai_chat_histories\n// (packages/core/prisma/schema.prisma) so existing data stays compatible:\n// - `type` values come from the dsh session event map\n// ('user' | 'model' | 'tool' | ...) instead of gemini-cli message roles.\n// - `agent_id` distinguishes the main agent from subagent writers.\n// - no user_id: tenancy is carried by session_id, not a column.\n//\n// The client is pre-generated at package build time (`pnpm generate`, output\n// src/generated/mysql, compiled into lib/generated) — consumers do NOT run\n// `prisma generate`. To create/upgrade tables, run `prisma db push` /\n// migrations against this file; the connection URL lives in prisma.config.ts\n// (Prisma 7 dropped datasource.url from the schema).\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../src/generated/mysql\"\n importFileExtension = \"js\"\n}\n\ndatasource db {\n provider = \"mysql\"\n}\n\n/// One row per projected session event (user message, assistant message,\n/// tool call/result, compression snapshot, ...).\nmodel AiMessage {\n id String @id @default(cuid()) @db.Char(36)\n sessionId String @map(\"session_id\") @db.VarChar(100)\n historyId String? @map(\"history_id\") @db.Char(36)\n type String @db.VarChar(50)\n content String @db.LongText\n thoughts Json?\n model String? @db.VarChar(100)\n tokens Json?\n toolCalls Json? @map(\"tool_calls\")\n agentId String? @map(\"agent_id\") @db.VarChar(100)\n metadata Json?\n createdAt DateTime @default(now()) @map(\"created_at\") @db.Timestamp(0)\n updatedAt DateTime @default(now()) @updatedAt @map(\"updated_at\") @db.Timestamp(0)\n deletedAt DateTime? @map(\"deleted_at\") @db.Timestamp(0)\n\n // Relations\n history AiChatHistory? @relation(fields: [historyId], references: [id], onDelete: NoAction)\n\n @@index([sessionId], map: \"idx_session\")\n @@index([historyId], map: \"idx_history\")\n @@index([createdAt], map: \"idx_created\")\n @@index([deletedAt], map: \"idx_deleted\")\n @@index([agentId], map: \"idx_agent\")\n @@index([sessionId, agentId, type, createdAt], map: \"idx_session_agent_type_created\")\n @@map(\"ai_messages\")\n}\n\n/// Per-session rollup, maintained incrementally by the projector.\nmodel AiChatHistory {\n id String @id @default(cuid()) @db.Char(36)\n sessionId String @map(\"session_id\") @db.VarChar(100)\n title String? @db.VarChar(255)\n summary String? @db.Text\n messageCount Int @default(0) @map(\"message_count\")\n totalTokens BigInt @default(0) @map(\"total_tokens\")\n firstMessageAt DateTime? @map(\"first_message_at\") @db.DateTime(6)\n lastMessageAt DateTime? @map(\"last_message_at\") @db.DateTime(6)\n metadata Json?\n deletedAt DateTime? @map(\"deleted_at\") @db.DateTime(6)\n\n // Relations\n messages AiMessage[]\n\n @@index([sessionId], map: \"idx_chat_history_session\")\n @@index([deletedAt], map: \"idx_chat_history_deleted\")\n @@map(\"ai_chat_histories\")\n}\n",
|
|
19
|
+
"runtimeDataModel": {
|
|
20
|
+
"models": {},
|
|
21
|
+
"enums": {},
|
|
22
|
+
"types": {}
|
|
23
|
+
},
|
|
24
|
+
"parameterizationSchema": {
|
|
25
|
+
"strings": [],
|
|
26
|
+
"graph": ""
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
config.runtimeDataModel = JSON.parse("{\"models\":{\"AiMessage\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sessionId\",\"kind\":\"scalar\",\"type\":\"String\",\"dbName\":\"session_id\"},{\"name\":\"historyId\",\"kind\":\"scalar\",\"type\":\"String\",\"dbName\":\"history_id\"},{\"name\":\"type\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"content\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"thoughts\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"model\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"tokens\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"toolCalls\",\"kind\":\"scalar\",\"type\":\"Json\",\"dbName\":\"tool_calls\"},{\"name\":\"agentId\",\"kind\":\"scalar\",\"type\":\"String\",\"dbName\":\"agent_id\"},{\"name\":\"metadata\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\",\"dbName\":\"created_at\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\",\"dbName\":\"updated_at\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\",\"dbName\":\"deleted_at\"},{\"name\":\"history\",\"kind\":\"object\",\"type\":\"AiChatHistory\",\"relationName\":\"AiChatHistoryToAiMessage\"}],\"dbName\":\"ai_messages\"},\"AiChatHistory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sessionId\",\"kind\":\"scalar\",\"type\":\"String\",\"dbName\":\"session_id\"},{\"name\":\"title\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"summary\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"messageCount\",\"kind\":\"scalar\",\"type\":\"Int\",\"dbName\":\"message_count\"},{\"name\":\"totalTokens\",\"kind\":\"scalar\",\"type\":\"BigInt\",\"dbName\":\"total_tokens\"},{\"name\":\"firstMessageAt\",\"kind\":\"scalar\",\"type\":\"DateTime\",\"dbName\":\"first_message_at\"},{\"name\":\"lastMessageAt\",\"kind\":\"scalar\",\"type\":\"DateTime\",\"dbName\":\"last_message_at\"},{\"name\":\"metadata\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\",\"dbName\":\"deleted_at\"},{\"name\":\"messages\",\"kind\":\"object\",\"type\":\"AiMessage\",\"relationName\":\"AiChatHistoryToAiMessage\"}],\"dbName\":\"ai_chat_histories\"}},\"enums\":{},\"types\":{}}");
|
|
30
|
+
config.parameterizationSchema = {
|
|
31
|
+
strings: JSON.parse("[\"where\",\"orderBy\",\"cursor\",\"messages\",\"_count\",\"history\",\"AiMessage.findUnique\",\"AiMessage.findUniqueOrThrow\",\"AiMessage.findFirst\",\"AiMessage.findFirstOrThrow\",\"AiMessage.findMany\",\"data\",\"AiMessage.createOne\",\"AiMessage.createMany\",\"AiMessage.updateOne\",\"AiMessage.updateMany\",\"create\",\"update\",\"AiMessage.upsertOne\",\"AiMessage.deleteOne\",\"AiMessage.deleteMany\",\"having\",\"_min\",\"_max\",\"AiMessage.groupBy\",\"AiMessage.aggregate\",\"AiChatHistory.findUnique\",\"AiChatHistory.findUniqueOrThrow\",\"AiChatHistory.findFirst\",\"AiChatHistory.findFirstOrThrow\",\"AiChatHistory.findMany\",\"AiChatHistory.createOne\",\"AiChatHistory.createMany\",\"AiChatHistory.updateOne\",\"AiChatHistory.updateMany\",\"AiChatHistory.upsertOne\",\"AiChatHistory.deleteOne\",\"AiChatHistory.deleteMany\",\"_avg\",\"_sum\",\"AiChatHistory.groupBy\",\"AiChatHistory.aggregate\",\"AND\",\"OR\",\"NOT\",\"id\",\"sessionId\",\"title\",\"summary\",\"messageCount\",\"totalTokens\",\"firstMessageAt\",\"lastMessageAt\",\"metadata\",\"deletedAt\",\"equals\",\"string_contains\",\"string_starts_with\",\"string_ends_with\",\"array_starts_with\",\"array_ends_with\",\"array_contains\",\"lt\",\"lte\",\"gt\",\"gte\",\"not\",\"in\",\"notIn\",\"contains\",\"startsWith\",\"endsWith\",\"search\",\"every\",\"some\",\"none\",\"historyId\",\"type\",\"content\",\"thoughts\",\"model\",\"tokens\",\"toolCalls\",\"agentId\",\"createdAt\",\"updatedAt\",\"is\",\"isNot\",\"connectOrCreate\",\"upsert\",\"createMany\",\"set\",\"disconnect\",\"delete\",\"connect\",\"updateMany\",\"deleteMany\",\"_relevance\",\"increment\",\"decrement\",\"multiply\",\"divide\"]"),
|
|
32
|
+
graph: "fRAcEgUAAFQAICoAAFIAMCsAAAUAECwAAFIAMC0BAAAAAS4BAEcAITUAAEwAIDZAAEsAIUwBAEgAIU0BAEcAIU4BAEcAIU8AAEwAIFABAEgAIVEAAEwAIFIAAEwAIFMBAEgAIVRAAFMAIVVAAFMAIQEAAAABACAOAwAATQAgKgAARgAwKwAAAwAQLAAARgAwLQEARwAhLgEARwAhLwEASAAhMAEASAAhMQIASQAhMgQASgAhM0AASwAhNEAASwAhNQAATAAgNkAASwAhAQAAAAMAIBIFAABUACAqAABSADArAAAFABAsAABSADAtAQBHACEuAQBHACE1AABMACA2QABLACFMAQBIACFNAQBHACFOAQBHACFPAABMACBQAQBIACFRAABMACBSAABMACBTAQBIACFUQABTACFVQABTACEKBQAAdgAgNQAAVQAgNgAAVQAgTAAAVQAgTwAAVQAgUAAAVQAgUQAAVQAgUgAAVQAgUwAAVQAgYQAAdwAgAwAAAAUAIAEAAAYAMAIAAAEAIAEAAAAFACABAAAAAQAgAwAAAAUAIAEAAAYAMAIAAAEAIAMAAAAFACABAAAGADACAAABACADAAAABQAgAQAABgAwAgAAAQAgDwUAAHUAIC0BAAAAAS4BAAAAATWAAAAAATZAAAAAAUwBAAAAAU0BAAAAAU4BAAAAAU-AAAAAAVABAAAAAVGAAAAAAVKAAAAAAVMBAAAAAVRAAAAAAVVAAAAAAQELAAANACAOLQEAAAABLgEAAAABNYAAAAABNkAAAAABTAEAAAABTQEAAAABTgEAAAABT4AAAAABUAEAAAABUYAAAAABUoAAAAABUwEAAAABVEAAAAABVUAAAAABAQsAAA8AMA8FAAB0ACAtAQBbACEuAQBbACE1gAAAAAE2QABfACFMAQBcACFNAQBbACFOAQBbACFPgAAAAAFQAQBcACFRgAAAAAFSgAAAAAFTAQBcACFUQABrACFVQABrACECAAAAAQAgCwAAEQAgDi0BAFsAIS4BAFsAITWAAAAAATZAAF8AIUwBAFwAIU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EgAIU0BAEcAIU4BAEcAIU8AAEwAIFABAEgAIVEAAEwAIFIAAEwAIFMBAEgAIVRAAFMAIVVAAFMAIQg3QAAAAAE-QAAAAAE_QAAAAAFAQAAAAAFBQAAAAAFCQABRACFDQAAAAAREQAAAAAQQAwAATQAgKgAARgAwKwAAAwAQLAAARgAwLQEARwAhLgEARwAhLwEASAAhMAEASAAhMQIASQAhMgQASgAhM0AASwAhNEAASwAhNQAATAAgNkAASwAhVgAAAwAgVwAAAwAgAAAAAAAAAVsBAAAAAQFbAQAAAAEFWwIAAAABYgIAAAABYwIAAAABZAIAAAABZQIAAAABBVsEAAAAAWIEAAAAAWMEAAAAAWQEAAAAAWUEAAAAAQFbQAAAAAELEAAAYQAwEQAAZgAwWAAAYgAwWQAAYwAwWgAAZAAgWwAAZQAwXAAAZQAwXQAAZQAwXgAAZQAwXwAAZwAwYAAAaAAwDS0BAAAAAS4BAAAAATWAAAAAATZAAAAAAU0BAAAAAU4BAAAAAU-AAAAAAVABAAAAAVGAAAAAAVKAAAAAAVMBAAAAAVRAAAAAAVVAAAAAAQIAAAABACAQAABtACADAAAAAQAgEAAAbQAgEQAAbAAgAQsAAH0AMBIFAABUACAqAABSADArAAAFABAsAABSADAtAQAAAAEuAQBHACE1AABMACA2QABLACFMAQBIACFNAQBHACFOAQBHACFPAABMACBQAQBIACFRAABMACBSAABMACBTAQBIACFUQABTACFVQABTACECAAAAAQAgCwAAbAAgAgAAAGkAIAsAAGoAIBEqAABoADArAABpABAsAABoADAtAQBHACEuAQBHACE1AABMACA2QABLACFMAQBIACFNAQBHACFOAQBHACFPAABMACBQAQBIACFRAABMACBSAABMACBTAQBIACFUQABTACFVQABTACERKgAAaAAwKwAAaQAQLAAAaAAwLQEARwAhLgEARwAhNQAATAAgNkAASwAhTAEASAAhTQEARwAhTgEARwAhTwAATAAgUAEASAAhUQAATAAgUgAATAAgUwEASAAhVEAAUwAhVUAAUwAhDS0BAFsAIS4BAFsAITWAAAAAATZAAF8AIU0B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ICYEISgCIioEIysCJCwCJS0EKDAKKTEQ"
|
|
33
|
+
};
|
|
34
|
+
async function decodeBase64AsWasm(wasmBase64) {
|
|
35
|
+
const { Buffer } = await import('node:buffer');
|
|
36
|
+
const wasmArray = Buffer.from(wasmBase64, 'base64');
|
|
37
|
+
return new WebAssembly.Module(wasmArray);
|
|
38
|
+
}
|
|
39
|
+
config.compilerWasm = {
|
|
40
|
+
getRuntime: async () => await import("@prisma/client/runtime/query_compiler_fast_bg.mysql.mjs"),
|
|
41
|
+
getQueryCompilerWasmModule: async () => {
|
|
42
|
+
const { wasm } = await import("@prisma/client/runtime/query_compiler_fast_bg.mysql.wasm-base64.mjs");
|
|
43
|
+
return await decodeBase64AsWasm(wasm);
|
|
44
|
+
},
|
|
45
|
+
importName: "./query_compiler_fast_bg.js"
|
|
46
|
+
};
|
|
47
|
+
export function getPrismaClientClass() {
|
|
48
|
+
return runtime.getPrismaClient(config);
|
|
49
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// biome-ignore-all lint: generated file
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* WARNING: This is an internal file that is subject to change!
|
|
7
|
+
*
|
|
8
|
+
* 🛑 Under no circumstances should you import this file directly! 🛑
|
|
9
|
+
*
|
|
10
|
+
* All exports from this file are wrapped under a `Prisma` namespace object in the client.ts file.
|
|
11
|
+
* While this enables partial backward compatibility, it is not part of the stable public API.
|
|
12
|
+
*
|
|
13
|
+
* If you are looking for your Models, Enums, and Input Types, please import them from the respective
|
|
14
|
+
* model files in the `model` directory!
|
|
15
|
+
*/
|
|
16
|
+
import * as runtime from "@prisma/client/runtime/client";
|
|
17
|
+
/**
|
|
18
|
+
* Prisma Errors
|
|
19
|
+
*/
|
|
20
|
+
export const PrismaClientKnownRequestError = runtime.PrismaClientKnownRequestError;
|
|
21
|
+
export const PrismaClientUnknownRequestError = runtime.PrismaClientUnknownRequestError;
|
|
22
|
+
export const PrismaClientRustPanicError = runtime.PrismaClientRustPanicError;
|
|
23
|
+
export const PrismaClientInitializationError = runtime.PrismaClientInitializationError;
|
|
24
|
+
export const PrismaClientValidationError = runtime.PrismaClientValidationError;
|
|
25
|
+
/**
|
|
26
|
+
* Re-export of sql-template-tag
|
|
27
|
+
*/
|
|
28
|
+
export const sql = runtime.sqltag;
|
|
29
|
+
export const empty = runtime.empty;
|
|
30
|
+
export const join = runtime.join;
|
|
31
|
+
export const raw = runtime.raw;
|
|
32
|
+
export const Sql = runtime.Sql;
|
|
33
|
+
/**
|
|
34
|
+
* Decimal.js
|
|
35
|
+
*/
|
|
36
|
+
export const Decimal = runtime.Decimal;
|
|
37
|
+
export const getExtensionContext = runtime.Extensions.getExtensionContext;
|
|
38
|
+
/**
|
|
39
|
+
* Prisma Client JS version: 7.9.1
|
|
40
|
+
* Query Engine version: e922089b7d7502aff4249d5da3420f6fa55fc6ad
|
|
41
|
+
*/
|
|
42
|
+
export const prismaVersion = {
|
|
43
|
+
client: "7.9.1",
|
|
44
|
+
engine: "e922089b7d7502aff4249d5da3420f6fa55fc6ad"
|
|
45
|
+
};
|
|
46
|
+
export const NullTypes = {
|
|
47
|
+
DbNull: runtime.NullTypes.DbNull,
|
|
48
|
+
JsonNull: runtime.NullTypes.JsonNull,
|
|
49
|
+
AnyNull: runtime.NullTypes.AnyNull,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Helper for filtering JSON entries that have `null` on the database (empty on the db)
|
|
53
|
+
*
|
|
54
|
+
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
55
|
+
*/
|
|
56
|
+
export const DbNull = runtime.DbNull;
|
|
57
|
+
/**
|
|
58
|
+
* Helper for filtering JSON entries that have JSON `null` values (not empty on the db)
|
|
59
|
+
*
|
|
60
|
+
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
61
|
+
*/
|
|
62
|
+
export const JsonNull = runtime.JsonNull;
|
|
63
|
+
/**
|
|
64
|
+
* Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`
|
|
65
|
+
*
|
|
66
|
+
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
67
|
+
*/
|
|
68
|
+
export const AnyNull = runtime.AnyNull;
|
|
69
|
+
export const ModelName = {
|
|
70
|
+
AiMessage: 'AiMessage',
|
|
71
|
+
AiChatHistory: 'AiChatHistory'
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Enums
|
|
75
|
+
*/
|
|
76
|
+
export const TransactionIsolationLevel = runtime.makeStrictEnum({
|
|
77
|
+
ReadUncommitted: 'ReadUncommitted',
|
|
78
|
+
ReadCommitted: 'ReadCommitted',
|
|
79
|
+
RepeatableRead: 'RepeatableRead',
|
|
80
|
+
Serializable: 'Serializable'
|
|
81
|
+
});
|
|
82
|
+
export const AiMessageScalarFieldEnum = {
|
|
83
|
+
id: 'id',
|
|
84
|
+
sessionId: 'sessionId',
|
|
85
|
+
historyId: 'historyId',
|
|
86
|
+
type: 'type',
|
|
87
|
+
content: 'content',
|
|
88
|
+
thoughts: 'thoughts',
|
|
89
|
+
model: 'model',
|
|
90
|
+
tokens: 'tokens',
|
|
91
|
+
toolCalls: 'toolCalls',
|
|
92
|
+
agentId: 'agentId',
|
|
93
|
+
metadata: 'metadata',
|
|
94
|
+
createdAt: 'createdAt',
|
|
95
|
+
updatedAt: 'updatedAt',
|
|
96
|
+
deletedAt: 'deletedAt'
|
|
97
|
+
};
|
|
98
|
+
export const AiChatHistoryScalarFieldEnum = {
|
|
99
|
+
id: 'id',
|
|
100
|
+
sessionId: 'sessionId',
|
|
101
|
+
title: 'title',
|
|
102
|
+
summary: 'summary',
|
|
103
|
+
messageCount: 'messageCount',
|
|
104
|
+
totalTokens: 'totalTokens',
|
|
105
|
+
firstMessageAt: 'firstMessageAt',
|
|
106
|
+
lastMessageAt: 'lastMessageAt',
|
|
107
|
+
metadata: 'metadata',
|
|
108
|
+
deletedAt: 'deletedAt'
|
|
109
|
+
};
|
|
110
|
+
export const SortOrder = {
|
|
111
|
+
asc: 'asc',
|
|
112
|
+
desc: 'desc'
|
|
113
|
+
};
|
|
114
|
+
export const NullableJsonNullValueInput = {
|
|
115
|
+
DbNull: DbNull,
|
|
116
|
+
JsonNull: JsonNull
|
|
117
|
+
};
|
|
118
|
+
export const JsonNullValueFilter = {
|
|
119
|
+
DbNull: DbNull,
|
|
120
|
+
JsonNull: JsonNull,
|
|
121
|
+
AnyNull: AnyNull
|
|
122
|
+
};
|
|
123
|
+
export const QueryMode = {
|
|
124
|
+
default: 'default',
|
|
125
|
+
insensitive: 'insensitive'
|
|
126
|
+
};
|
|
127
|
+
export const NullsOrder = {
|
|
128
|
+
first: 'first',
|
|
129
|
+
last: 'last'
|
|
130
|
+
};
|
|
131
|
+
export const AiMessageOrderByRelevanceFieldEnum = {
|
|
132
|
+
id: 'id',
|
|
133
|
+
sessionId: 'sessionId',
|
|
134
|
+
historyId: 'historyId',
|
|
135
|
+
type: 'type',
|
|
136
|
+
content: 'content',
|
|
137
|
+
model: 'model',
|
|
138
|
+
agentId: 'agentId'
|
|
139
|
+
};
|
|
140
|
+
export const AiChatHistoryOrderByRelevanceFieldEnum = {
|
|
141
|
+
id: 'id',
|
|
142
|
+
sessionId: 'sessionId',
|
|
143
|
+
title: 'title',
|
|
144
|
+
summary: 'summary'
|
|
145
|
+
};
|
|
146
|
+
export const defineExtension = runtime.Extensions.defineExtension;
|