@inkeep/agents-core 0.31.7 → 0.32.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.
Files changed (61) hide show
  1. package/dist/{chunk-RBUBOGX6.js → chunk-FUJJ4OQ2.js} +62 -10
  2. package/dist/chunk-SVXWB2HF.js +592 -0
  3. package/dist/{chunk-T5TTDZ6L.js → chunk-VSQY72K5.js} +133 -133
  4. package/dist/{chunk-PPBBIDK4.js → chunk-X6ZMJ3G6.js} +1 -1
  5. package/dist/client-exports.cjs +283 -224
  6. package/dist/client-exports.d.cts +7 -7
  7. package/dist/client-exports.d.ts +7 -7
  8. package/dist/client-exports.js +15 -7
  9. package/dist/db/schema.cjs +211 -211
  10. package/dist/db/schema.d.cts +3 -3
  11. package/dist/db/schema.d.ts +3 -3
  12. package/dist/db/schema.js +1 -1
  13. package/dist/index.cjs +18511 -12300
  14. package/dist/index.d.cts +409 -352
  15. package/dist/index.d.ts +409 -352
  16. package/dist/index.js +16250 -11076
  17. package/dist/nodefs-X2JO4ZHZ.js +21 -0
  18. package/dist/opfs-ahp-2UFDGV73.js +318 -0
  19. package/dist/{schema-lEFnfOQ-.d.ts → schema-CuEjPQt7.d.ts} +876 -1014
  20. package/dist/{schema-ztSm-Iv6.d.cts → schema-D1P8r3qm.d.cts} +876 -1014
  21. package/dist/types/index.d.cts +3 -3
  22. package/dist/types/index.d.ts +3 -3
  23. package/dist/{utility-qLyZ45lb.d.cts → utility-DF5IUC9K.d.cts} +1230 -1394
  24. package/dist/{utility-qLyZ45lb.d.ts → utility-DF5IUC9K.d.ts} +1230 -1394
  25. package/dist/validation/index.cjs +270 -219
  26. package/dist/validation/index.d.cts +3 -3
  27. package/dist/validation/index.d.ts +3 -3
  28. package/dist/validation/index.js +2 -2
  29. package/drizzle/0000_exotic_mysterio.sql +398 -0
  30. package/drizzle/meta/0000_snapshot.json +1683 -1223
  31. package/drizzle/meta/_journal.json +4 -102
  32. package/package.json +6 -3
  33. package/drizzle/0000_material_menace.sql +0 -326
  34. package/drizzle/0001_eminent_fixer.sql +0 -43
  35. package/drizzle/0002_bumpy_romulus.sql +0 -3
  36. package/drizzle/0003_soft_forgotten_one.sql +0 -39
  37. package/drizzle/0004_melted_omega_flight.sql +0 -3
  38. package/drizzle/0005_wide_shriek.sql +0 -127
  39. package/drizzle/0006_damp_lenny_balinger.sql +0 -52
  40. package/drizzle/0007_mighty_typhoid_mary.sql +0 -227
  41. package/drizzle/0008_mysterious_crusher_hogan.sql +0 -20
  42. package/drizzle/0009_old_black_cat.sql +0 -1
  43. package/drizzle/0010_wet_vampiro.sql +0 -2
  44. package/drizzle/0011_slippery_korg.sql +0 -36
  45. package/drizzle/0012_salty_psynapse.sql +0 -17
  46. package/drizzle/0013_shocking_blur.sql +0 -19
  47. package/drizzle/0014_broad_hellfire_club.sql +0 -29
  48. package/drizzle/meta/0001_snapshot.json +0 -2435
  49. package/drizzle/meta/0002_snapshot.json +0 -2428
  50. package/drizzle/meta/0003_snapshot.json +0 -2559
  51. package/drizzle/meta/0004_snapshot.json +0 -2547
  52. package/drizzle/meta/0005_snapshot.json +0 -2558
  53. package/drizzle/meta/0006_snapshot.json +0 -2751
  54. package/drizzle/meta/0007_snapshot.json +0 -2766
  55. package/drizzle/meta/0008_snapshot.json +0 -2753
  56. package/drizzle/meta/0009_snapshot.json +0 -2744
  57. package/drizzle/meta/0010_snapshot.json +0 -2751
  58. package/drizzle/meta/0011_snapshot.json +0 -2849
  59. package/drizzle/meta/0012_snapshot.json +0 -2985
  60. package/drizzle/meta/0013_snapshot.json +0 -2988
  61. package/drizzle/meta/0014_snapshot.json +0 -2992
@@ -1,110 +1,12 @@
1
1
  {
2
2
  "version": "7",
3
- "dialect": "sqlite",
3
+ "dialect": "postgresql",
4
4
  "entries": [
5
5
  {
6
6
  "idx": 0,
7
- "version": "6",
8
- "when": 1759338566165,
9
- "tag": "0000_material_menace",
10
- "breakpoints": true
11
- },
12
- {
13
- "idx": 1,
14
- "version": "6",
15
- "when": 1759453676635,
16
- "tag": "0001_eminent_fixer",
17
- "breakpoints": true
18
- },
19
- {
20
- "idx": 2,
21
- "version": "6",
22
- "when": 1759804621486,
23
- "tag": "0002_bumpy_romulus",
24
- "breakpoints": true
25
- },
26
- {
27
- "idx": 3,
28
- "version": "6",
29
- "when": 1759970956091,
30
- "tag": "0003_soft_forgotten_one",
31
- "breakpoints": true
32
- },
33
- {
34
- "idx": 4,
35
- "version": "6",
36
- "when": 1759974668186,
37
- "tag": "0004_melted_omega_flight",
38
- "breakpoints": true
39
- },
40
- {
41
- "idx": 5,
42
- "version": "6",
43
- "when": 1760028262290,
44
- "tag": "0005_wide_shriek",
45
- "breakpoints": true
46
- },
47
- {
48
- "idx": 6,
49
- "version": "6",
50
- "when": 1760053343084,
51
- "tag": "0006_damp_lenny_balinger",
52
- "breakpoints": true
53
- },
54
- {
55
- "idx": 7,
56
- "version": "6",
57
- "when": 1760126352847,
58
- "tag": "0007_mighty_typhoid_mary",
59
- "breakpoints": true
60
- },
61
- {
62
- "idx": 8,
63
- "version": "6",
64
- "when": 1760457692776,
65
- "tag": "0008_mysterious_crusher_hogan",
66
- "breakpoints": true
67
- },
68
- {
69
- "idx": 9,
70
- "version": "6",
71
- "when": 1760480808208,
72
- "tag": "0009_old_black_cat",
73
- "breakpoints": true
74
- },
75
- {
76
- "idx": 10,
77
- "version": "6",
78
- "when": 1760564153811,
79
- "tag": "0010_wet_vampiro",
80
- "breakpoints": true
81
- },
82
- {
83
- "idx": 11,
84
- "version": "6",
85
- "when": 1760738344628,
86
- "tag": "0011_slippery_korg",
87
- "breakpoints": true
88
- },
89
- {
90
- "idx": 12,
91
- "version": "6",
92
- "when": 1761082381737,
93
- "tag": "0012_salty_psynapse",
94
- "breakpoints": true
95
- },
96
- {
97
- "idx": 13,
98
- "version": "6",
99
- "when": 1761162910152,
100
- "tag": "0013_shocking_blur",
101
- "breakpoints": true
102
- },
103
- {
104
- "idx": 14,
105
- "version": "6",
106
- "when": 1761227891220,
107
- "tag": "0014_broad_hellfire_club",
7
+ "version": "7",
8
+ "when": 1762892536683,
9
+ "tag": "0000_exotic_mysterio",
108
10
  "breakpoints": true
109
11
  }
110
12
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-core",
3
- "version": "0.31.7",
3
+ "version": "0.32.0",
4
4
  "description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -42,7 +42,6 @@
42
42
  "dependencies": {
43
43
  "@hono/node-server": "^1.14.3",
44
44
  "@hono/zod-openapi": "^1.0.2",
45
- "@libsql/client": "^0.15.7",
46
45
  "@modelcontextprotocol/sdk": "^1.17.2",
47
46
  "@nangohq/node": "^0.69.5",
48
47
  "@nangohq/types": "^0.69.5",
@@ -64,10 +63,11 @@
64
63
  "drizzle-zod": "^0.8.2",
65
64
  "exit-hook": "^4.0.0",
66
65
  "find-up": "^7.0.0",
67
- "hono": "^4.10.3",
66
+ "hono": "^4.10.4",
68
67
  "jmespath": "^0.16.0",
69
68
  "jose": "^6.1.0",
70
69
  "nanoid": "^5.0.9",
70
+ "pg": "^8.16.3",
71
71
  "pino": "^9.11.0",
72
72
  "pino-pretty": "^13.1.1",
73
73
  "ts-pattern": "^5.7.1",
@@ -77,10 +77,13 @@
77
77
  "keytar": "^7.9.0"
78
78
  },
79
79
  "devDependencies": {
80
+ "@electric-sql/pglite": "^0.3.13",
80
81
  "@types/jmespath": "^0.15.2",
81
82
  "@types/node": "^20.11.24",
83
+ "@types/pg": "^8.15.6",
82
84
  "@vitest/coverage-v8": "^3.2.4",
83
85
  "clean-package": "^2.2.0",
86
+ "drizzle-kit": "^0.31.6",
84
87
  "tsx": "^4.19.2",
85
88
  "typescript": "^5.9.2",
86
89
  "vitest": "^3.2.4"
@@ -1,326 +0,0 @@
1
- CREATE TABLE `agent_artifact_components` (
2
- `tenant_id` text NOT NULL,
3
- `id` text NOT NULL,
4
- `project_id` text NOT NULL,
5
- `graph_id` text NOT NULL,
6
- `agent_id` text NOT NULL,
7
- `artifact_component_id` text NOT NULL,
8
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
9
- PRIMARY KEY(`tenant_id`, `project_id`, `graph_id`, `agent_id`, `id`),
10
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`,`agent_id`) REFERENCES `agents`(`tenant_id`,`project_id`,`graph_id`,`id`) ON UPDATE no action ON DELETE cascade,
11
- FOREIGN KEY (`tenant_id`,`project_id`,`artifact_component_id`) REFERENCES `artifact_components`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade
12
- );
13
- --> statement-breakpoint
14
- CREATE TABLE `agent_data_components` (
15
- `tenant_id` text NOT NULL,
16
- `id` text NOT NULL,
17
- `project_id` text NOT NULL,
18
- `graph_id` text NOT NULL,
19
- `agent_id` text NOT NULL,
20
- `data_component_id` text NOT NULL,
21
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
22
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
23
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`,`agent_id`) REFERENCES `agents`(`tenant_id`,`project_id`,`graph_id`,`id`) ON UPDATE no action ON DELETE cascade,
24
- FOREIGN KEY (`tenant_id`,`project_id`,`data_component_id`) REFERENCES `data_components`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade
25
- );
26
- --> statement-breakpoint
27
- CREATE TABLE `agent_graph` (
28
- `tenant_id` text NOT NULL,
29
- `id` text NOT NULL,
30
- `project_id` text NOT NULL,
31
- `name` text NOT NULL,
32
- `description` text,
33
- `default_agent_id` text,
34
- `context_config_id` text,
35
- `models` text,
36
- `status_updates` text,
37
- `graph_prompt` text,
38
- `stop_when` text,
39
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
40
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
41
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
42
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
43
- );
44
- --> statement-breakpoint
45
- CREATE TABLE `agent_relations` (
46
- `tenant_id` text NOT NULL,
47
- `id` text NOT NULL,
48
- `project_id` text NOT NULL,
49
- `graph_id` text NOT NULL,
50
- `source_agent_id` text NOT NULL,
51
- `target_agent_id` text,
52
- `external_agent_id` text,
53
- `relation_type` text,
54
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
55
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
56
- PRIMARY KEY(`tenant_id`, `project_id`, `graph_id`, `id`),
57
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`) REFERENCES `agent_graph`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade
58
- );
59
- --> statement-breakpoint
60
- CREATE TABLE `agent_tool_relations` (
61
- `tenant_id` text NOT NULL,
62
- `id` text NOT NULL,
63
- `project_id` text NOT NULL,
64
- `graph_id` text NOT NULL,
65
- `agent_id` text NOT NULL,
66
- `tool_id` text NOT NULL,
67
- `selected_tools` blob,
68
- `headers` blob,
69
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
70
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
71
- PRIMARY KEY(`tenant_id`, `project_id`, `graph_id`, `id`),
72
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`,`agent_id`) REFERENCES `agents`(`tenant_id`,`project_id`,`graph_id`,`id`) ON UPDATE no action ON DELETE cascade,
73
- FOREIGN KEY (`tenant_id`,`project_id`,`tool_id`) REFERENCES `tools`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade
74
- );
75
- --> statement-breakpoint
76
- CREATE TABLE `agents` (
77
- `tenant_id` text NOT NULL,
78
- `id` text NOT NULL,
79
- `project_id` text NOT NULL,
80
- `graph_id` text NOT NULL,
81
- `name` text NOT NULL,
82
- `description` text NOT NULL,
83
- `prompt` text NOT NULL,
84
- `conversation_history_config` text,
85
- `models` text,
86
- `stop_when` text,
87
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
88
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
89
- PRIMARY KEY(`tenant_id`, `project_id`, `graph_id`, `id`),
90
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`) REFERENCES `agent_graph`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade
91
- );
92
- --> statement-breakpoint
93
- CREATE TABLE `api_keys` (
94
- `tenant_id` text NOT NULL,
95
- `id` text NOT NULL,
96
- `project_id` text NOT NULL,
97
- `graph_id` text NOT NULL,
98
- `public_id` text NOT NULL,
99
- `key_hash` text NOT NULL,
100
- `key_prefix` text NOT NULL,
101
- `name` text,
102
- `last_used_at` text,
103
- `expires_at` text,
104
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
105
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
106
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade,
107
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`) REFERENCES `agent_graph`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade
108
- );
109
- --> statement-breakpoint
110
- CREATE UNIQUE INDEX `api_keys_public_id_unique` ON `api_keys` (`public_id`);--> statement-breakpoint
111
- CREATE INDEX `api_keys_tenant_graph_idx` ON `api_keys` (`tenant_id`,`graph_id`);--> statement-breakpoint
112
- CREATE INDEX `api_keys_prefix_idx` ON `api_keys` (`key_prefix`);--> statement-breakpoint
113
- CREATE INDEX `api_keys_public_id_idx` ON `api_keys` (`public_id`);--> statement-breakpoint
114
- CREATE TABLE `artifact_components` (
115
- `tenant_id` text NOT NULL,
116
- `id` text NOT NULL,
117
- `project_id` text NOT NULL,
118
- `name` text NOT NULL,
119
- `description` text NOT NULL,
120
- `summary_props` blob,
121
- `full_props` blob,
122
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
123
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
124
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
125
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
126
- );
127
- --> statement-breakpoint
128
- CREATE TABLE `context_cache` (
129
- `tenant_id` text NOT NULL,
130
- `id` text NOT NULL,
131
- `project_id` text NOT NULL,
132
- `conversation_id` text NOT NULL,
133
- `context_config_id` text NOT NULL,
134
- `context_variable_key` text NOT NULL,
135
- `value` blob NOT NULL,
136
- `request_hash` text,
137
- `fetched_at` text NOT NULL,
138
- `fetch_source` text,
139
- `fetch_duration_ms` integer,
140
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
141
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
142
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
143
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
144
- );
145
- --> statement-breakpoint
146
- CREATE INDEX `context_cache_lookup_idx` ON `context_cache` (`conversation_id`,`context_config_id`,`context_variable_key`);--> statement-breakpoint
147
- CREATE TABLE `context_configs` (
148
- `tenant_id` text NOT NULL,
149
- `id` text NOT NULL,
150
- `project_id` text NOT NULL,
151
- `name` text NOT NULL,
152
- `description` text NOT NULL,
153
- `request_context_schema` blob,
154
- `context_variables` blob,
155
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
156
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
157
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
158
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
159
- );
160
- --> statement-breakpoint
161
- CREATE TABLE `conversations` (
162
- `tenant_id` text NOT NULL,
163
- `id` text NOT NULL,
164
- `project_id` text NOT NULL,
165
- `user_id` text,
166
- `active_agent_id` text NOT NULL,
167
- `title` text,
168
- `last_context_resolution` text,
169
- `metadata` blob,
170
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
171
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
172
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
173
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
174
- );
175
- --> statement-breakpoint
176
- CREATE TABLE `credential_references` (
177
- `tenant_id` text NOT NULL,
178
- `id` text NOT NULL,
179
- `project_id` text NOT NULL,
180
- `type` text NOT NULL,
181
- `credential_store_id` text NOT NULL,
182
- `retrieval_params` blob,
183
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
184
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
185
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
186
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
187
- );
188
- --> statement-breakpoint
189
- CREATE TABLE `data_components` (
190
- `tenant_id` text NOT NULL,
191
- `id` text NOT NULL,
192
- `project_id` text NOT NULL,
193
- `name` text NOT NULL,
194
- `description` text NOT NULL,
195
- `props` blob,
196
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
197
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
198
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
199
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
200
- );
201
- --> statement-breakpoint
202
- CREATE TABLE `external_agents` (
203
- `tenant_id` text NOT NULL,
204
- `id` text NOT NULL,
205
- `project_id` text NOT NULL,
206
- `graph_id` text NOT NULL,
207
- `name` text NOT NULL,
208
- `description` text NOT NULL,
209
- `base_url` text NOT NULL,
210
- `credential_reference_id` text,
211
- `headers` blob,
212
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
213
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
214
- PRIMARY KEY(`tenant_id`, `project_id`, `graph_id`, `id`),
215
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`) REFERENCES `agent_graph`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade,
216
- FOREIGN KEY (`tenant_id`,`project_id`,`credential_reference_id`) REFERENCES `credential_references`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE set null
217
- );
218
- --> statement-breakpoint
219
- CREATE TABLE `ledger_artifacts` (
220
- `tenant_id` text NOT NULL,
221
- `id` text NOT NULL,
222
- `project_id` text NOT NULL,
223
- `task_id` text NOT NULL,
224
- `tool_call_id` text,
225
- `context_id` text NOT NULL,
226
- `type` text DEFAULT 'source' NOT NULL,
227
- `name` text,
228
- `description` text,
229
- `parts` blob,
230
- `metadata` blob,
231
- `summary` text,
232
- `mime` blob,
233
- `visibility` text DEFAULT 'context',
234
- `allowed_agents` blob,
235
- `derived_from` text,
236
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
237
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
238
- PRIMARY KEY(`tenant_id`, `project_id`, `id`, `task_id`),
239
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
240
- );
241
- --> statement-breakpoint
242
- CREATE INDEX `ledger_artifacts_task_id_idx` ON `ledger_artifacts` (`task_id`);--> statement-breakpoint
243
- CREATE INDEX `ledger_artifacts_tool_call_id_idx` ON `ledger_artifacts` (`tool_call_id`);--> statement-breakpoint
244
- CREATE INDEX `ledger_artifacts_context_id_idx` ON `ledger_artifacts` (`context_id`);--> statement-breakpoint
245
- CREATE UNIQUE INDEX `ledger_artifacts_task_context_name_unique` ON `ledger_artifacts` (`task_id`,`context_id`,`name`);--> statement-breakpoint
246
- CREATE TABLE `messages` (
247
- `tenant_id` text NOT NULL,
248
- `id` text NOT NULL,
249
- `project_id` text NOT NULL,
250
- `conversation_id` text NOT NULL,
251
- `role` text NOT NULL,
252
- `from_agent_id` text,
253
- `to_agent_id` text,
254
- `from_external_agent_id` text,
255
- `to_external_agent_id` text,
256
- `content` blob NOT NULL,
257
- `visibility` text DEFAULT 'user-facing' NOT NULL,
258
- `message_type` text DEFAULT 'chat' NOT NULL,
259
- `agent_id` text,
260
- `task_id` text,
261
- `parent_message_id` text,
262
- `a2a_task_id` text,
263
- `a2a_session_id` text,
264
- `metadata` blob,
265
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
266
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
267
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
268
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
269
- );
270
- --> statement-breakpoint
271
- CREATE TABLE `projects` (
272
- `tenant_id` text NOT NULL,
273
- `id` text NOT NULL,
274
- `name` text NOT NULL,
275
- `description` text NOT NULL,
276
- `models` text,
277
- `stop_when` text,
278
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
279
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
280
- PRIMARY KEY(`tenant_id`, `id`)
281
- );
282
- --> statement-breakpoint
283
- CREATE TABLE `task_relations` (
284
- `tenant_id` text NOT NULL,
285
- `id` text NOT NULL,
286
- `project_id` text NOT NULL,
287
- `parent_task_id` text NOT NULL,
288
- `child_task_id` text NOT NULL,
289
- `relation_type` text DEFAULT 'parent_child',
290
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
291
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
292
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
293
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
294
- );
295
- --> statement-breakpoint
296
- CREATE TABLE `tasks` (
297
- `tenant_id` text NOT NULL,
298
- `id` text NOT NULL,
299
- `project_id` text NOT NULL,
300
- `graph_id` text NOT NULL,
301
- `agent_id` text NOT NULL,
302
- `context_id` text NOT NULL,
303
- `status` text NOT NULL,
304
- `metadata` blob,
305
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
306
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
307
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
308
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`,`agent_id`) REFERENCES `agents`(`tenant_id`,`project_id`,`graph_id`,`id`) ON UPDATE no action ON DELETE cascade
309
- );
310
- --> statement-breakpoint
311
- CREATE TABLE `tools` (
312
- `tenant_id` text NOT NULL,
313
- `id` text NOT NULL,
314
- `project_id` text NOT NULL,
315
- `name` text NOT NULL,
316
- `config` blob NOT NULL,
317
- `credential_reference_id` text,
318
- `headers` blob,
319
- `image_url` text,
320
- `capabilities` blob,
321
- `last_error` text,
322
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
323
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
324
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
325
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
326
- );
@@ -1,43 +0,0 @@
1
- -- Add graph_id column to context_configs (initially nullable)
2
- ALTER TABLE `context_configs` ADD COLUMN `graph_id` text;--> statement-breakpoint
3
-
4
- -- Populate graph_id by looking up from agent_graph
5
- UPDATE `context_configs`
6
- SET `graph_id` = (
7
- SELECT `agent_graph`.`id`
8
- FROM `agent_graph`
9
- WHERE `agent_graph`.`context_config_id` = `context_configs`.`id`
10
- AND `agent_graph`.`tenant_id` = `context_configs`.`tenant_id`
11
- AND `agent_graph`.`project_id` = `context_configs`.`project_id`
12
- LIMIT 1
13
- );--> statement-breakpoint
14
-
15
- -- Note: Any context_configs not referenced by a graph will have NULL graph_id
16
- -- If you want to handle orphaned configs differently, modify before continuing
17
-
18
- -- Now recreate the table with proper constraints
19
- PRAGMA foreign_keys=OFF;--> statement-breakpoint
20
- CREATE TABLE `__new_context_configs` (
21
- `tenant_id` text NOT NULL,
22
- `id` text NOT NULL,
23
- `project_id` text NOT NULL,
24
- `graph_id` text NOT NULL,
25
- `name` text NOT NULL,
26
- `description` text NOT NULL,
27
- `request_context_schema` blob,
28
- `context_variables` blob,
29
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
30
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
31
- PRIMARY KEY(`tenant_id`, `project_id`, `graph_id`, `id`),
32
- FOREIGN KEY (`tenant_id`,`project_id`,`graph_id`) REFERENCES `agent_graph`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade
33
- );--> statement-breakpoint
34
-
35
- -- Copy data, excluding any rows where graph_id is NULL (orphaned configs)
36
- INSERT INTO `__new_context_configs`("tenant_id", "id", "project_id", "graph_id", "name", "description", "request_context_schema", "context_variables", "created_at", "updated_at")
37
- SELECT "tenant_id", "id", "project_id", "graph_id", "name", "description", "request_context_schema", "context_variables", "created_at", "updated_at"
38
- FROM `context_configs`
39
- WHERE `graph_id` IS NOT NULL;--> statement-breakpoint
40
-
41
- DROP TABLE `context_configs`;--> statement-breakpoint
42
- ALTER TABLE `__new_context_configs` RENAME TO `context_configs`;--> statement-breakpoint
43
- PRAGMA foreign_keys=ON;
@@ -1,3 +0,0 @@
1
- ALTER TABLE `artifact_components` ADD `props` blob;--> statement-breakpoint
2
- ALTER TABLE `artifact_components` DROP COLUMN `summary_props`;--> statement-breakpoint
3
- ALTER TABLE `artifact_components` DROP COLUMN `full_props`;
@@ -1,39 +0,0 @@
1
- CREATE TABLE `functions` (
2
- `tenant_id` text NOT NULL,
3
- `id` text NOT NULL,
4
- `project_id` text NOT NULL,
5
- `input_schema` blob,
6
- `execute_code` text NOT NULL,
7
- `dependencies` blob,
8
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
9
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
10
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
11
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade
12
- );
13
- --> statement-breakpoint
14
- ALTER TABLE `projects` ADD `sandbox_config` text;--> statement-breakpoint
15
- PRAGMA foreign_keys=OFF;--> statement-breakpoint
16
- CREATE TABLE `__new_tools` (
17
- `tenant_id` text NOT NULL,
18
- `id` text NOT NULL,
19
- `project_id` text NOT NULL,
20
- `name` text NOT NULL,
21
- `description` text,
22
- `config` blob NOT NULL,
23
- `function_id` text,
24
- `credential_reference_id` text,
25
- `headers` blob,
26
- `image_url` text,
27
- `capabilities` blob,
28
- `last_error` text,
29
- `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
30
- `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
31
- PRIMARY KEY(`tenant_id`, `project_id`, `id`),
32
- FOREIGN KEY (`tenant_id`,`project_id`) REFERENCES `projects`(`tenant_id`,`id`) ON UPDATE no action ON DELETE cascade,
33
- FOREIGN KEY (`tenant_id`,`project_id`,`function_id`) REFERENCES `functions`(`tenant_id`,`project_id`,`id`) ON UPDATE no action ON DELETE cascade
34
- );
35
- --> statement-breakpoint
36
- INSERT INTO `__new_tools`("tenant_id", "id", "project_id", "name", "config", "credential_reference_id", "headers", "image_url", "capabilities", "last_error", "created_at", "updated_at") SELECT "tenant_id", "id", "project_id", "name", "config", "credential_reference_id", "headers", "image_url", "capabilities", "last_error", "created_at", "updated_at" FROM `tools`;--> statement-breakpoint
37
- DROP TABLE `tools`;--> statement-breakpoint
38
- ALTER TABLE `__new_tools` RENAME TO `tools`;--> statement-breakpoint
39
- PRAGMA foreign_keys=ON;
@@ -1,3 +0,0 @@
1
- ALTER TABLE `context_configs` RENAME COLUMN "request_context_schema" TO "headers_schema";--> statement-breakpoint
2
- ALTER TABLE `context_configs` DROP COLUMN `name`;--> statement-breakpoint
3
- ALTER TABLE `context_configs` DROP COLUMN `description`;