@checkstack/ai-backend 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/CHANGELOG.md +97 -0
- package/drizzle/0000_productive_jackpot.sql +26 -0
- package/drizzle/0001_puzzling_purple_man.sql +26 -0
- package/drizzle/0002_sparkling_paper_doll.sql +15 -0
- package/drizzle/0003_married_senator_kelly.sql +1 -0
- package/drizzle/0004_crazy_miek.sql +2 -0
- package/drizzle/0005_tearful_randall_flagg.sql +1 -0
- package/drizzle/meta/0000_snapshot.json +232 -0
- package/drizzle/meta/0001_snapshot.json +434 -0
- package/drizzle/meta/0002_snapshot.json +551 -0
- package/drizzle/meta/0003_snapshot.json +557 -0
- package/drizzle/meta/0004_snapshot.json +573 -0
- package/drizzle/meta/0005_snapshot.json +574 -0
- package/drizzle/meta/_journal.json +48 -0
- package/drizzle.config.ts +7 -0
- package/package.json +42 -0
- package/src/agent-runner.test.ts +262 -0
- package/src/agent-runner.ts +262 -0
- package/src/chat/agent-loop.test.ts +119 -0
- package/src/chat/agent-loop.ts +73 -0
- package/src/chat/auto-apply.test.ts +237 -0
- package/src/chat/chat-handler.ts +111 -0
- package/src/chat/chat-service.streamturn.test.ts +417 -0
- package/src/chat/chat-service.test.ts +250 -0
- package/src/chat/chat-service.ts +923 -0
- package/src/chat/classifier-service.ts +64 -0
- package/src/chat/classifier.logic.test.ts +92 -0
- package/src/chat/classifier.logic.ts +71 -0
- package/src/chat/conversation-store.it.test.ts +203 -0
- package/src/chat/conversation-store.test.ts +248 -0
- package/src/chat/conversation-store.ts +237 -0
- package/src/chat/decision.logic.test.ts +45 -0
- package/src/chat/decision.logic.ts +54 -0
- package/src/chat/llm-provider.test.ts +63 -0
- package/src/chat/llm-provider.ts +67 -0
- package/src/chat/model-error.logic.test.ts +60 -0
- package/src/chat/model-error.logic.ts +65 -0
- package/src/chat/normalize-messages.logic.test.ts +101 -0
- package/src/chat/normalize-messages.logic.ts +65 -0
- package/src/chat/permission-mode.logic.test.ts +70 -0
- package/src/chat/permission-mode.logic.ts +45 -0
- package/src/chat/read-invoker.ts +72 -0
- package/src/chat/replay.test.ts +174 -0
- package/src/chat/scrub-content.test.ts +183 -0
- package/src/chat/scrub-content.ts +154 -0
- package/src/chat/sdk-tools.test.ts +168 -0
- package/src/chat/sdk-tools.ts +181 -0
- package/src/chat/title-service.test.ts +146 -0
- package/src/chat/title-service.ts +111 -0
- package/src/chat/title.logic.test.ts +98 -0
- package/src/chat/title.logic.ts +102 -0
- package/src/extension-points.ts +41 -0
- package/src/generated/docs-index.ts +3020 -0
- package/src/hardening/handler-authz.test.ts +282 -0
- package/src/hardening/no-secret-leak.test.ts +303 -0
- package/src/hooks.ts +33 -0
- package/src/index.ts +542 -0
- package/src/mcp/connection-registry.test.ts +25 -0
- package/src/mcp/connection-registry.ts +54 -0
- package/src/mcp/mcp-conformance.it.test.ts +128 -0
- package/src/mcp/server.test.ts +285 -0
- package/src/mcp/server.ts +300 -0
- package/src/mcp/tool-invoker.ts +65 -0
- package/src/openai-provider.test.ts +64 -0
- package/src/openai-provider.ts +146 -0
- package/src/projection.test.ts +97 -0
- package/src/projection.ts +132 -0
- package/src/propose-apply/args-hash.test.ts +26 -0
- package/src/propose-apply/args-hash.ts +30 -0
- package/src/propose-apply/service.test.ts +423 -0
- package/src/propose-apply/service.ts +419 -0
- package/src/propose-apply/store.test.ts +136 -0
- package/src/propose-apply/store.ts +224 -0
- package/src/propose-apply/token.test.ts +52 -0
- package/src/propose-apply/token.ts +71 -0
- package/src/rate-limit/spend-ledger.it.test.ts +224 -0
- package/src/rate-limit/spend-ledger.test.ts +176 -0
- package/src/rate-limit/spend-ledger.ts +162 -0
- package/src/rate-limit/tool-budget.it.test.ts +173 -0
- package/src/rate-limit/tool-budget.test.ts +58 -0
- package/src/rate-limit/tool-budget.ts +107 -0
- package/src/registry-wiring.test.ts +131 -0
- package/src/registry-wiring.ts +68 -0
- package/src/resolver.test.ts +156 -0
- package/src/resolver.ts +78 -0
- package/src/router.test.ts +78 -0
- package/src/router.ts +345 -0
- package/src/schema.ts +284 -0
- package/src/serializer.test.ts +88 -0
- package/src/serializer.ts +42 -0
- package/src/tool-registry.ts +58 -0
- package/src/tools/composite-tools.ts +24 -0
- package/src/tools/docs-tools.test.ts +150 -0
- package/src/tools/docs-tools.ts +115 -0
- package/src/tools/probe-url.test.ts +51 -0
- package/src/tools/probe-url.ts +146 -0
- package/src/tools/rank-docs.test.ts +153 -0
- package/src/tools/rank-docs.ts +209 -0
- package/src/tools/script-context-extract.test.ts +93 -0
- package/src/tools/script-context-extract.ts +283 -0
- package/src/tools/ssrf-guard.test.ts +69 -0
- package/src/tools/ssrf-guard.ts +108 -0
- package/src/tools/tool-set.e2e.test.ts +64 -0
- package/src/user-rpc-client.test.ts +45 -0
- package/src/user-rpc-client.ts +60 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "6e2df9db-edc1-4ddd-adb6-e983ef33b0d9",
|
|
3
|
+
"prevId": "23dfed87-129e-48cc-b01a-43d2a3ab34b8",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.ai_conversations": {
|
|
8
|
+
"name": "ai_conversations",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "text",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true
|
|
16
|
+
},
|
|
17
|
+
"user_id": {
|
|
18
|
+
"name": "user_id",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true
|
|
22
|
+
},
|
|
23
|
+
"title": {
|
|
24
|
+
"name": "title",
|
|
25
|
+
"type": "text",
|
|
26
|
+
"primaryKey": false,
|
|
27
|
+
"notNull": false
|
|
28
|
+
},
|
|
29
|
+
"integration_id": {
|
|
30
|
+
"name": "integration_id",
|
|
31
|
+
"type": "text",
|
|
32
|
+
"primaryKey": false,
|
|
33
|
+
"notNull": false
|
|
34
|
+
},
|
|
35
|
+
"model": {
|
|
36
|
+
"name": "model",
|
|
37
|
+
"type": "text",
|
|
38
|
+
"primaryKey": false,
|
|
39
|
+
"notNull": false
|
|
40
|
+
},
|
|
41
|
+
"permission_mode": {
|
|
42
|
+
"name": "permission_mode",
|
|
43
|
+
"type": "ai_permission_mode",
|
|
44
|
+
"typeSchema": "public",
|
|
45
|
+
"primaryKey": false,
|
|
46
|
+
"notNull": true,
|
|
47
|
+
"default": "'approve'"
|
|
48
|
+
},
|
|
49
|
+
"created_at": {
|
|
50
|
+
"name": "created_at",
|
|
51
|
+
"type": "timestamp",
|
|
52
|
+
"primaryKey": false,
|
|
53
|
+
"notNull": true,
|
|
54
|
+
"default": "now()"
|
|
55
|
+
},
|
|
56
|
+
"updated_at": {
|
|
57
|
+
"name": "updated_at",
|
|
58
|
+
"type": "timestamp",
|
|
59
|
+
"primaryKey": false,
|
|
60
|
+
"notNull": true,
|
|
61
|
+
"default": "now()"
|
|
62
|
+
},
|
|
63
|
+
"archived_at": {
|
|
64
|
+
"name": "archived_at",
|
|
65
|
+
"type": "timestamp",
|
|
66
|
+
"primaryKey": false,
|
|
67
|
+
"notNull": false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"indexes": {
|
|
71
|
+
"ai_conversations_user_idx": {
|
|
72
|
+
"name": "ai_conversations_user_idx",
|
|
73
|
+
"columns": [
|
|
74
|
+
{
|
|
75
|
+
"expression": "user_id",
|
|
76
|
+
"isExpression": false,
|
|
77
|
+
"asc": true,
|
|
78
|
+
"nulls": "last"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"expression": "updated_at",
|
|
82
|
+
"isExpression": false,
|
|
83
|
+
"asc": true,
|
|
84
|
+
"nulls": "last"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"isUnique": false,
|
|
88
|
+
"concurrently": false,
|
|
89
|
+
"method": "btree",
|
|
90
|
+
"with": {}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"foreignKeys": {},
|
|
94
|
+
"compositePrimaryKeys": {},
|
|
95
|
+
"uniqueConstraints": {},
|
|
96
|
+
"policies": {},
|
|
97
|
+
"checkConstraints": {},
|
|
98
|
+
"isRLSEnabled": false
|
|
99
|
+
},
|
|
100
|
+
"public.ai_messages": {
|
|
101
|
+
"name": "ai_messages",
|
|
102
|
+
"schema": "",
|
|
103
|
+
"columns": {
|
|
104
|
+
"id": {
|
|
105
|
+
"name": "id",
|
|
106
|
+
"type": "text",
|
|
107
|
+
"primaryKey": true,
|
|
108
|
+
"notNull": true
|
|
109
|
+
},
|
|
110
|
+
"conversation_id": {
|
|
111
|
+
"name": "conversation_id",
|
|
112
|
+
"type": "text",
|
|
113
|
+
"primaryKey": false,
|
|
114
|
+
"notNull": true
|
|
115
|
+
},
|
|
116
|
+
"role": {
|
|
117
|
+
"name": "role",
|
|
118
|
+
"type": "ai_message_role",
|
|
119
|
+
"typeSchema": "public",
|
|
120
|
+
"primaryKey": false,
|
|
121
|
+
"notNull": true
|
|
122
|
+
},
|
|
123
|
+
"content": {
|
|
124
|
+
"name": "content",
|
|
125
|
+
"type": "jsonb",
|
|
126
|
+
"primaryKey": false,
|
|
127
|
+
"notNull": true
|
|
128
|
+
},
|
|
129
|
+
"tool_calls": {
|
|
130
|
+
"name": "tool_calls",
|
|
131
|
+
"type": "jsonb",
|
|
132
|
+
"primaryKey": false,
|
|
133
|
+
"notNull": false
|
|
134
|
+
},
|
|
135
|
+
"model_messages": {
|
|
136
|
+
"name": "model_messages",
|
|
137
|
+
"type": "jsonb",
|
|
138
|
+
"primaryKey": false,
|
|
139
|
+
"notNull": false
|
|
140
|
+
},
|
|
141
|
+
"created_at": {
|
|
142
|
+
"name": "created_at",
|
|
143
|
+
"type": "timestamp",
|
|
144
|
+
"primaryKey": false,
|
|
145
|
+
"notNull": true,
|
|
146
|
+
"default": "now()"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"indexes": {
|
|
150
|
+
"ai_messages_conversation_idx": {
|
|
151
|
+
"name": "ai_messages_conversation_idx",
|
|
152
|
+
"columns": [
|
|
153
|
+
{
|
|
154
|
+
"expression": "conversation_id",
|
|
155
|
+
"isExpression": false,
|
|
156
|
+
"asc": true,
|
|
157
|
+
"nulls": "last"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"expression": "created_at",
|
|
161
|
+
"isExpression": false,
|
|
162
|
+
"asc": true,
|
|
163
|
+
"nulls": "last"
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"isUnique": false,
|
|
167
|
+
"concurrently": false,
|
|
168
|
+
"method": "btree",
|
|
169
|
+
"with": {}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"foreignKeys": {
|
|
173
|
+
"ai_messages_conversation_id_ai_conversations_id_fk": {
|
|
174
|
+
"name": "ai_messages_conversation_id_ai_conversations_id_fk",
|
|
175
|
+
"tableFrom": "ai_messages",
|
|
176
|
+
"tableTo": "ai_conversations",
|
|
177
|
+
"columnsFrom": [
|
|
178
|
+
"conversation_id"
|
|
179
|
+
],
|
|
180
|
+
"columnsTo": [
|
|
181
|
+
"id"
|
|
182
|
+
],
|
|
183
|
+
"onDelete": "cascade",
|
|
184
|
+
"onUpdate": "no action"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"compositePrimaryKeys": {},
|
|
188
|
+
"uniqueConstraints": {},
|
|
189
|
+
"policies": {},
|
|
190
|
+
"checkConstraints": {},
|
|
191
|
+
"isRLSEnabled": false
|
|
192
|
+
},
|
|
193
|
+
"public.ai_spend": {
|
|
194
|
+
"name": "ai_spend",
|
|
195
|
+
"schema": "",
|
|
196
|
+
"columns": {
|
|
197
|
+
"id": {
|
|
198
|
+
"name": "id",
|
|
199
|
+
"type": "text",
|
|
200
|
+
"primaryKey": true,
|
|
201
|
+
"notNull": true
|
|
202
|
+
},
|
|
203
|
+
"integration_id": {
|
|
204
|
+
"name": "integration_id",
|
|
205
|
+
"type": "text",
|
|
206
|
+
"primaryKey": false,
|
|
207
|
+
"notNull": true
|
|
208
|
+
},
|
|
209
|
+
"principal_kind": {
|
|
210
|
+
"name": "principal_kind",
|
|
211
|
+
"type": "text",
|
|
212
|
+
"primaryKey": false,
|
|
213
|
+
"notNull": true
|
|
214
|
+
},
|
|
215
|
+
"principal_id": {
|
|
216
|
+
"name": "principal_id",
|
|
217
|
+
"type": "text",
|
|
218
|
+
"primaryKey": false,
|
|
219
|
+
"notNull": true
|
|
220
|
+
},
|
|
221
|
+
"conversation_id": {
|
|
222
|
+
"name": "conversation_id",
|
|
223
|
+
"type": "text",
|
|
224
|
+
"primaryKey": false,
|
|
225
|
+
"notNull": false
|
|
226
|
+
},
|
|
227
|
+
"model": {
|
|
228
|
+
"name": "model",
|
|
229
|
+
"type": "text",
|
|
230
|
+
"primaryKey": false,
|
|
231
|
+
"notNull": false
|
|
232
|
+
},
|
|
233
|
+
"input_tokens": {
|
|
234
|
+
"name": "input_tokens",
|
|
235
|
+
"type": "integer",
|
|
236
|
+
"primaryKey": false,
|
|
237
|
+
"notNull": true,
|
|
238
|
+
"default": 0
|
|
239
|
+
},
|
|
240
|
+
"output_tokens": {
|
|
241
|
+
"name": "output_tokens",
|
|
242
|
+
"type": "integer",
|
|
243
|
+
"primaryKey": false,
|
|
244
|
+
"notNull": true,
|
|
245
|
+
"default": 0
|
|
246
|
+
},
|
|
247
|
+
"total_tokens": {
|
|
248
|
+
"name": "total_tokens",
|
|
249
|
+
"type": "integer",
|
|
250
|
+
"primaryKey": false,
|
|
251
|
+
"notNull": true,
|
|
252
|
+
"default": 0
|
|
253
|
+
},
|
|
254
|
+
"created_at": {
|
|
255
|
+
"name": "created_at",
|
|
256
|
+
"type": "timestamp",
|
|
257
|
+
"primaryKey": false,
|
|
258
|
+
"notNull": true,
|
|
259
|
+
"default": "now()"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"indexes": {
|
|
263
|
+
"ai_spend_integration_principal_created_idx": {
|
|
264
|
+
"name": "ai_spend_integration_principal_created_idx",
|
|
265
|
+
"columns": [
|
|
266
|
+
{
|
|
267
|
+
"expression": "integration_id",
|
|
268
|
+
"isExpression": false,
|
|
269
|
+
"asc": true,
|
|
270
|
+
"nulls": "last"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"expression": "principal_kind",
|
|
274
|
+
"isExpression": false,
|
|
275
|
+
"asc": true,
|
|
276
|
+
"nulls": "last"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"expression": "principal_id",
|
|
280
|
+
"isExpression": false,
|
|
281
|
+
"asc": true,
|
|
282
|
+
"nulls": "last"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"expression": "created_at",
|
|
286
|
+
"isExpression": false,
|
|
287
|
+
"asc": true,
|
|
288
|
+
"nulls": "last"
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
"isUnique": false,
|
|
292
|
+
"concurrently": false,
|
|
293
|
+
"method": "btree",
|
|
294
|
+
"with": {}
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"foreignKeys": {},
|
|
298
|
+
"compositePrimaryKeys": {},
|
|
299
|
+
"uniqueConstraints": {},
|
|
300
|
+
"policies": {},
|
|
301
|
+
"checkConstraints": {},
|
|
302
|
+
"isRLSEnabled": false
|
|
303
|
+
},
|
|
304
|
+
"public.ai_tool_calls": {
|
|
305
|
+
"name": "ai_tool_calls",
|
|
306
|
+
"schema": "",
|
|
307
|
+
"columns": {
|
|
308
|
+
"id": {
|
|
309
|
+
"name": "id",
|
|
310
|
+
"type": "text",
|
|
311
|
+
"primaryKey": true,
|
|
312
|
+
"notNull": true
|
|
313
|
+
},
|
|
314
|
+
"principal_kind": {
|
|
315
|
+
"name": "principal_kind",
|
|
316
|
+
"type": "text",
|
|
317
|
+
"primaryKey": false,
|
|
318
|
+
"notNull": true
|
|
319
|
+
},
|
|
320
|
+
"principal_id": {
|
|
321
|
+
"name": "principal_id",
|
|
322
|
+
"type": "text",
|
|
323
|
+
"primaryKey": false,
|
|
324
|
+
"notNull": true
|
|
325
|
+
},
|
|
326
|
+
"transport": {
|
|
327
|
+
"name": "transport",
|
|
328
|
+
"type": "ai_transport",
|
|
329
|
+
"typeSchema": "public",
|
|
330
|
+
"primaryKey": false,
|
|
331
|
+
"notNull": true
|
|
332
|
+
},
|
|
333
|
+
"conversation_id": {
|
|
334
|
+
"name": "conversation_id",
|
|
335
|
+
"type": "text",
|
|
336
|
+
"primaryKey": false,
|
|
337
|
+
"notNull": false
|
|
338
|
+
},
|
|
339
|
+
"tool_name": {
|
|
340
|
+
"name": "tool_name",
|
|
341
|
+
"type": "text",
|
|
342
|
+
"primaryKey": false,
|
|
343
|
+
"notNull": true
|
|
344
|
+
},
|
|
345
|
+
"effect": {
|
|
346
|
+
"name": "effect",
|
|
347
|
+
"type": "ai_tool_effect",
|
|
348
|
+
"typeSchema": "public",
|
|
349
|
+
"primaryKey": false,
|
|
350
|
+
"notNull": true
|
|
351
|
+
},
|
|
352
|
+
"args_hash": {
|
|
353
|
+
"name": "args_hash",
|
|
354
|
+
"type": "text",
|
|
355
|
+
"primaryKey": false,
|
|
356
|
+
"notNull": true
|
|
357
|
+
},
|
|
358
|
+
"status": {
|
|
359
|
+
"name": "status",
|
|
360
|
+
"type": "ai_tool_call_status",
|
|
361
|
+
"typeSchema": "public",
|
|
362
|
+
"primaryKey": false,
|
|
363
|
+
"notNull": true
|
|
364
|
+
},
|
|
365
|
+
"proposal_nonce": {
|
|
366
|
+
"name": "proposal_nonce",
|
|
367
|
+
"type": "text",
|
|
368
|
+
"primaryKey": false,
|
|
369
|
+
"notNull": false
|
|
370
|
+
},
|
|
371
|
+
"proposal_expires_at": {
|
|
372
|
+
"name": "proposal_expires_at",
|
|
373
|
+
"type": "timestamp",
|
|
374
|
+
"primaryKey": false,
|
|
375
|
+
"notNull": false
|
|
376
|
+
},
|
|
377
|
+
"applied_by_kind": {
|
|
378
|
+
"name": "applied_by_kind",
|
|
379
|
+
"type": "text",
|
|
380
|
+
"primaryKey": false,
|
|
381
|
+
"notNull": false
|
|
382
|
+
},
|
|
383
|
+
"applied_by_id": {
|
|
384
|
+
"name": "applied_by_id",
|
|
385
|
+
"type": "text",
|
|
386
|
+
"primaryKey": false,
|
|
387
|
+
"notNull": false
|
|
388
|
+
},
|
|
389
|
+
"result_snapshot": {
|
|
390
|
+
"name": "result_snapshot",
|
|
391
|
+
"type": "jsonb",
|
|
392
|
+
"primaryKey": false,
|
|
393
|
+
"notNull": false
|
|
394
|
+
},
|
|
395
|
+
"proposed_payload": {
|
|
396
|
+
"name": "proposed_payload",
|
|
397
|
+
"type": "jsonb",
|
|
398
|
+
"primaryKey": false,
|
|
399
|
+
"notNull": false
|
|
400
|
+
},
|
|
401
|
+
"error": {
|
|
402
|
+
"name": "error",
|
|
403
|
+
"type": "text",
|
|
404
|
+
"primaryKey": false,
|
|
405
|
+
"notNull": false
|
|
406
|
+
},
|
|
407
|
+
"proposed_at": {
|
|
408
|
+
"name": "proposed_at",
|
|
409
|
+
"type": "timestamp",
|
|
410
|
+
"primaryKey": false,
|
|
411
|
+
"notNull": false
|
|
412
|
+
},
|
|
413
|
+
"applied_at": {
|
|
414
|
+
"name": "applied_at",
|
|
415
|
+
"type": "timestamp",
|
|
416
|
+
"primaryKey": false,
|
|
417
|
+
"notNull": false
|
|
418
|
+
},
|
|
419
|
+
"created_at": {
|
|
420
|
+
"name": "created_at",
|
|
421
|
+
"type": "timestamp",
|
|
422
|
+
"primaryKey": false,
|
|
423
|
+
"notNull": true,
|
|
424
|
+
"default": "now()"
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
"indexes": {
|
|
428
|
+
"ai_tool_calls_principal_created_idx": {
|
|
429
|
+
"name": "ai_tool_calls_principal_created_idx",
|
|
430
|
+
"columns": [
|
|
431
|
+
{
|
|
432
|
+
"expression": "principal_kind",
|
|
433
|
+
"isExpression": false,
|
|
434
|
+
"asc": true,
|
|
435
|
+
"nulls": "last"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"expression": "principal_id",
|
|
439
|
+
"isExpression": false,
|
|
440
|
+
"asc": true,
|
|
441
|
+
"nulls": "last"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"expression": "created_at",
|
|
445
|
+
"isExpression": false,
|
|
446
|
+
"asc": true,
|
|
447
|
+
"nulls": "last"
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
"isUnique": false,
|
|
451
|
+
"concurrently": false,
|
|
452
|
+
"method": "btree",
|
|
453
|
+
"with": {}
|
|
454
|
+
},
|
|
455
|
+
"ai_tool_calls_status_expires_idx": {
|
|
456
|
+
"name": "ai_tool_calls_status_expires_idx",
|
|
457
|
+
"columns": [
|
|
458
|
+
{
|
|
459
|
+
"expression": "status",
|
|
460
|
+
"isExpression": false,
|
|
461
|
+
"asc": true,
|
|
462
|
+
"nulls": "last"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"expression": "proposal_expires_at",
|
|
466
|
+
"isExpression": false,
|
|
467
|
+
"asc": true,
|
|
468
|
+
"nulls": "last"
|
|
469
|
+
}
|
|
470
|
+
],
|
|
471
|
+
"isUnique": false,
|
|
472
|
+
"concurrently": false,
|
|
473
|
+
"method": "btree",
|
|
474
|
+
"with": {}
|
|
475
|
+
},
|
|
476
|
+
"ai_tool_calls_conversation_idx": {
|
|
477
|
+
"name": "ai_tool_calls_conversation_idx",
|
|
478
|
+
"columns": [
|
|
479
|
+
{
|
|
480
|
+
"expression": "conversation_id",
|
|
481
|
+
"isExpression": false,
|
|
482
|
+
"asc": true,
|
|
483
|
+
"nulls": "last"
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
"isUnique": false,
|
|
487
|
+
"concurrently": false,
|
|
488
|
+
"method": "btree",
|
|
489
|
+
"with": {}
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
"foreignKeys": {
|
|
493
|
+
"ai_tool_calls_conversation_id_ai_conversations_id_fk": {
|
|
494
|
+
"name": "ai_tool_calls_conversation_id_ai_conversations_id_fk",
|
|
495
|
+
"tableFrom": "ai_tool_calls",
|
|
496
|
+
"tableTo": "ai_conversations",
|
|
497
|
+
"columnsFrom": [
|
|
498
|
+
"conversation_id"
|
|
499
|
+
],
|
|
500
|
+
"columnsTo": [
|
|
501
|
+
"id"
|
|
502
|
+
],
|
|
503
|
+
"onDelete": "set null",
|
|
504
|
+
"onUpdate": "no action"
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
"compositePrimaryKeys": {},
|
|
508
|
+
"uniqueConstraints": {},
|
|
509
|
+
"policies": {},
|
|
510
|
+
"checkConstraints": {},
|
|
511
|
+
"isRLSEnabled": false
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
"enums": {
|
|
515
|
+
"public.ai_message_role": {
|
|
516
|
+
"name": "ai_message_role",
|
|
517
|
+
"schema": "public",
|
|
518
|
+
"values": [
|
|
519
|
+
"system",
|
|
520
|
+
"user",
|
|
521
|
+
"assistant",
|
|
522
|
+
"tool"
|
|
523
|
+
]
|
|
524
|
+
},
|
|
525
|
+
"public.ai_permission_mode": {
|
|
526
|
+
"name": "ai_permission_mode",
|
|
527
|
+
"schema": "public",
|
|
528
|
+
"values": [
|
|
529
|
+
"approve",
|
|
530
|
+
"auto"
|
|
531
|
+
]
|
|
532
|
+
},
|
|
533
|
+
"public.ai_tool_call_status": {
|
|
534
|
+
"name": "ai_tool_call_status",
|
|
535
|
+
"schema": "public",
|
|
536
|
+
"values": [
|
|
537
|
+
"proposed",
|
|
538
|
+
"applied",
|
|
539
|
+
"executed",
|
|
540
|
+
"failed",
|
|
541
|
+
"expired",
|
|
542
|
+
"rejected"
|
|
543
|
+
]
|
|
544
|
+
},
|
|
545
|
+
"public.ai_tool_effect": {
|
|
546
|
+
"name": "ai_tool_effect",
|
|
547
|
+
"schema": "public",
|
|
548
|
+
"values": [
|
|
549
|
+
"read",
|
|
550
|
+
"mutate",
|
|
551
|
+
"destructive"
|
|
552
|
+
]
|
|
553
|
+
},
|
|
554
|
+
"public.ai_transport": {
|
|
555
|
+
"name": "ai_transport",
|
|
556
|
+
"schema": "public",
|
|
557
|
+
"values": [
|
|
558
|
+
"chat",
|
|
559
|
+
"mcp",
|
|
560
|
+
"automation"
|
|
561
|
+
]
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
"schemas": {},
|
|
565
|
+
"sequences": {},
|
|
566
|
+
"roles": {},
|
|
567
|
+
"policies": {},
|
|
568
|
+
"views": {},
|
|
569
|
+
"_meta": {
|
|
570
|
+
"columns": {},
|
|
571
|
+
"schemas": {},
|
|
572
|
+
"tables": {}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "postgresql",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "7",
|
|
8
|
+
"when": 1780360652347,
|
|
9
|
+
"tag": "0000_productive_jackpot",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "7",
|
|
15
|
+
"when": 1780362961426,
|
|
16
|
+
"tag": "0001_puzzling_purple_man",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "7",
|
|
22
|
+
"when": 1780385129829,
|
|
23
|
+
"tag": "0002_sparkling_paper_doll",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "7",
|
|
29
|
+
"when": 1780437133189,
|
|
30
|
+
"tag": "0003_married_senator_kelly",
|
|
31
|
+
"breakpoints": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idx": 4,
|
|
35
|
+
"version": "7",
|
|
36
|
+
"when": 1780441806189,
|
|
37
|
+
"tag": "0004_crazy_miek",
|
|
38
|
+
"breakpoints": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"idx": 5,
|
|
42
|
+
"version": "7",
|
|
43
|
+
"when": 1780555741644,
|
|
44
|
+
"tag": "0005_tearful_randall_flagg",
|
|
45
|
+
"breakpoints": true
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@checkstack/ai-backend",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Elastic-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"checkstack": {
|
|
8
|
+
"type": "backend"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"typecheck": "tsgo -b",
|
|
12
|
+
"generate": "drizzle-kit generate",
|
|
13
|
+
"lint": "bun run lint:code",
|
|
14
|
+
"lint:code": "eslint . --max-warnings 0",
|
|
15
|
+
"test": "bun test"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@ai-sdk/openai-compatible": "^2.0.48",
|
|
19
|
+
"@checkstack/ai-common": "0.0.0",
|
|
20
|
+
"@checkstack/backend-api": "0.20.0",
|
|
21
|
+
"@checkstack/common": "0.12.0",
|
|
22
|
+
"@checkstack/drizzle-helper": "0.0.5",
|
|
23
|
+
"@checkstack/integration-backend": "0.3.1",
|
|
24
|
+
"@checkstack/sdk": "0.93.0",
|
|
25
|
+
"@orpc/client": "^1.14.4",
|
|
26
|
+
"@orpc/contract": "^1.14.4",
|
|
27
|
+
"@orpc/server": "^1.14.4",
|
|
28
|
+
"ai": "^6.0.194",
|
|
29
|
+
"drizzle-orm": "^0.45.0",
|
|
30
|
+
"yaml": "^2.6.1",
|
|
31
|
+
"zod": "^4.2.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@checkstack/scripts": "0.3.4",
|
|
35
|
+
"@checkstack/tsconfig": "0.0.7",
|
|
36
|
+
"@types/node": "^20.0.0",
|
|
37
|
+
"@types/pg": "^8.20.0",
|
|
38
|
+
"drizzle-kit": "^0.31.10",
|
|
39
|
+
"pg": "^8.21.0",
|
|
40
|
+
"typescript": "^5.0.0"
|
|
41
|
+
}
|
|
42
|
+
}
|