@adhd/agent-mcp 1.0.0 → 1.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.
Files changed (79) hide show
  1. package/package.json +1 -1
  2. package/src/__tests__/integration/harness.d.ts.map +1 -1
  3. package/src/__tests__/integration/harness.js +10 -5
  4. package/src/__tests__/integration/harness.js.map +1 -1
  5. package/src/clients/http-client.d.ts +1 -1
  6. package/src/clients/http-client.d.ts.map +1 -1
  7. package/src/clients/http-client.js +4 -2
  8. package/src/clients/http-client.js.map +1 -1
  9. package/src/clients/in-process.d.ts +1 -1
  10. package/src/clients/in-process.d.ts.map +1 -1
  11. package/src/clients/in-process.js +6 -1
  12. package/src/clients/in-process.js.map +1 -1
  13. package/src/clients/stdio-client.d.ts +1 -1
  14. package/src/clients/stdio-client.d.ts.map +1 -1
  15. package/src/clients/stdio-client.js +9 -3
  16. package/src/clients/stdio-client.js.map +1 -1
  17. package/src/clients/tool-naming.d.ts +24 -0
  18. package/src/clients/tool-naming.d.ts.map +1 -1
  19. package/src/clients/tool-naming.js +43 -0
  20. package/src/clients/tool-naming.js.map +1 -1
  21. package/src/clients/types.d.ts +5 -1
  22. package/src/clients/types.d.ts.map +1 -1
  23. package/src/engine/orchestrator.d.ts.map +1 -1
  24. package/src/engine/orchestrator.js +35 -2
  25. package/src/engine/orchestrator.js.map +1 -1
  26. package/src/engine/queue.d.ts.map +1 -1
  27. package/src/engine/queue.js +5 -2
  28. package/src/engine/queue.js.map +1 -1
  29. package/src/index.js +18 -0
  30. package/src/index.js.map +1 -1
  31. package/src/plugins/loader.d.ts +52 -0
  32. package/src/plugins/loader.d.ts.map +1 -0
  33. package/src/plugins/loader.js +212 -0
  34. package/src/plugins/loader.js.map +1 -0
  35. package/src/providers/anthropic.d.ts.map +1 -1
  36. package/src/providers/anthropic.js +15 -9
  37. package/src/providers/anthropic.js.map +1 -1
  38. package/src/providers/claudecli.d.ts.map +1 -1
  39. package/src/providers/claudecli.js +13 -18
  40. package/src/providers/claudecli.js.map +1 -1
  41. package/src/providers/openai.d.ts.map +1 -1
  42. package/src/providers/openai.js +14 -6
  43. package/src/providers/openai.js.map +1 -1
  44. package/src/server.d.ts.map +1 -1
  45. package/src/server.js +43 -8
  46. package/src/server.js.map +1 -1
  47. package/src/streaming/sse-server.d.ts +13 -1
  48. package/src/streaming/sse-server.d.ts.map +1 -1
  49. package/src/streaming/sse-server.js +28 -5
  50. package/src/streaming/sse-server.js.map +1 -1
  51. package/src/tools/agent-crud.d.ts +2 -0
  52. package/src/tools/agent-crud.d.ts.map +1 -1
  53. package/src/tools/agent-crud.js +15 -0
  54. package/src/tools/agent-crud.js.map +1 -1
  55. package/src/tools/usage.d.ts +7 -1
  56. package/src/tools/usage.d.ts.map +1 -1
  57. package/src/tools/usage.js +44 -3
  58. package/src/tools/usage.js.map +1 -1
  59. package/src/validation/agent.d.ts +1 -0
  60. package/src/validation/agent.d.ts.map +1 -1
  61. package/src/validation/agent.js +7 -0
  62. package/src/validation/agent.js.map +1 -1
  63. package/src/validation/usage.d.ts +33 -0
  64. package/src/validation/usage.d.ts.map +1 -1
  65. package/src/validation/usage.js +47 -0
  66. package/src/validation/usage.js.map +1 -1
  67. package/drizzle/0000_nifty_sasquatch.sql +0 -55
  68. package/drizzle/0001_task_usage.sql +0 -16
  69. package/drizzle/0002_lumpy_silver_centurion.sql +0 -2
  70. package/drizzle/0003_nifty_shriek.sql +0 -2
  71. package/drizzle/0004_brief_shocker.sql +0 -4
  72. package/drizzle/0005_clear_lenny_balinger.sql +0 -25
  73. package/drizzle/meta/0000_snapshot.json +0 -387
  74. package/drizzle/meta/0001_snapshot.json +0 -495
  75. package/drizzle/meta/0002_snapshot.json +0 -509
  76. package/drizzle/meta/0003_snapshot.json +0 -523
  77. package/drizzle/meta/0004_snapshot.json +0 -551
  78. package/drizzle/meta/0005_snapshot.json +0 -545
  79. package/drizzle/meta/_journal.json +0 -48
@@ -4,6 +4,11 @@ import { z } from "zod";
4
4
  *
5
5
  * Every filter is optional — a bare `{}` returns the most recent rows
6
6
  * (ordered by created_at desc, capped at `limit`). Filters compose with AND.
7
+ *
8
+ * When `group_by` is set, rows are aggregated by the chosen dimension and the
9
+ * response contains a `groups` array instead of raw `rows`. All other filters
10
+ * still apply before grouping. `limit` caps the number of groups returned,
11
+ * ordered by total token spend (input + output) descending.
7
12
  */
8
13
  export const taskUsageInputSchema = z
9
14
  .object({
@@ -23,8 +28,50 @@ export const taskUsageInputSchema = z
23
28
  /** Include `is_complete = 0` rows (in-progress or crashed-before-terminal). */
24
29
  include_incomplete: z.boolean().default(false),
25
30
  limit: z.number().int().positive().max(500).default(50),
31
+ /**
32
+ * Aggregate by a dimension instead of returning raw rows.
33
+ *
34
+ * - `"agent"` — one row per agent, ordered by total token spend desc.
35
+ * - `"model"` — one row per model string (e.g. "claude-opus-4-5").
36
+ * - `"provider"` — one row per provider type ("openai", "anthropic", …).
37
+ *
38
+ * Includes `completedCount`, `failedCount`, `cancelledCount` via a join
39
+ * with the `tasks` table. All other filters compose with AND before
40
+ * grouping. `limit` caps the number of groups.
41
+ */
42
+ group_by: z.enum(["agent", "model", "provider"]).optional(),
26
43
  })
27
44
  .optional();
45
+ /**
46
+ * One row in the `groups` array returned by `usage_query` when `group_by` is
47
+ * set. Aggregates all matching `task_usage` rows along the chosen dimension.
48
+ *
49
+ * `completedCount`, `failedCount`, `cancelledCount` come from a LEFT JOIN with
50
+ * the `tasks` table. Rows where the tasks row is absent (e.g. ephemeral tasks
51
+ * whose row was deleted) are counted as neither completed nor failed.
52
+ */
53
+ export const groupedUsageRowSchema = z.object({
54
+ /** The value of the grouped dimension — agentName, model, or providerType. */
55
+ key: z.string(),
56
+ /** Total number of completed `task_usage` rows in this group. */
57
+ taskCount: z.number().int().nonnegative(),
58
+ /** Tasks that reached `status = 'completed'`. */
59
+ completedCount: z.number().int().nonnegative(),
60
+ /** Tasks that reached `status = 'failed'`. */
61
+ failedCount: z.number().int().nonnegative(),
62
+ /** Tasks that reached `status = 'cancelled'`. */
63
+ cancelledCount: z.number().int().nonnegative(),
64
+ inputTokens: z.number().int().nonnegative(),
65
+ outputTokens: z.number().int().nonnegative(),
66
+ toolCallCount: z.number().int().nonnegative(),
67
+ modelCalls: z.number().int().nonnegative(),
68
+ /** Average per-task wall-clock latency in ms (0-latency rows excluded). */
69
+ avgLatencyMs: z.number().nonnegative(),
70
+ /** Sum of Anthropic prompt-cache read tokens (null for non-caching providers). */
71
+ cacheReadTokens: z.number().int().nonnegative().nullable(),
72
+ /** Sum of Anthropic prompt-cache creation tokens (null for non-caching providers). */
73
+ cacheCreationTokens: z.number().int().nonnegative().nullable(),
74
+ });
28
75
  /**
29
76
  * Aggregated token counts for a single task or a subtree.
30
77
  */
@@ -1 +1 @@
1
- {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../../../../packages/ai/agent-mcp/src/validation/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN;;;OAGG;IACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,6DAA6D;IAC7D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACvC,+EAA+E;IAC/E,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC9C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CA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1,55 +0,0 @@
1
- CREATE TABLE `agents` (
2
- `name` text PRIMARY KEY NOT NULL,
3
- `version` integer DEFAULT 1 NOT NULL,
4
- `data` text NOT NULL,
5
- `created_at` text NOT NULL,
6
- `updated_at` text NOT NULL
7
- );
8
- --> statement-breakpoint
9
- CREATE TABLE `messages` (
10
- `id` text PRIMARY KEY NOT NULL,
11
- `session_id` text NOT NULL,
12
- `role` text NOT NULL,
13
- `content` text,
14
- `tool_calls` text,
15
- `tool_results` text,
16
- `created_at` text NOT NULL,
17
- FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
18
- );
19
- --> statement-breakpoint
20
- CREATE TABLE `sessions` (
21
- `id` text PRIMARY KEY NOT NULL,
22
- `agent_name` text NOT NULL,
23
- `agent_version` integer NOT NULL,
24
- `agent_data` text NOT NULL,
25
- `status` text DEFAULT 'active' NOT NULL,
26
- `created_at` text NOT NULL,
27
- `updated_at` text NOT NULL,
28
- `closed_at` text,
29
- FOREIGN KEY (`agent_name`) REFERENCES `agents`(`name`) ON UPDATE no action ON DELETE cascade
30
- );
31
- --> statement-breakpoint
32
- CREATE TABLE `task_events` (
33
- `id` text PRIMARY KEY NOT NULL,
34
- `task_id` text NOT NULL,
35
- `type` text NOT NULL,
36
- `payload` text,
37
- `created_at` text NOT NULL,
38
- FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade
39
- );
40
- --> statement-breakpoint
41
- CREATE TABLE `tasks` (
42
- `id` text PRIMARY KEY NOT NULL,
43
- `session_id` text NOT NULL,
44
- `parent_task_id` text,
45
- `recursion_depth` integer DEFAULT 0 NOT NULL,
46
- `status` text DEFAULT 'pending' NOT NULL,
47
- `prompt` text NOT NULL,
48
- `result` text,
49
- `error` text,
50
- `created_at` text NOT NULL,
51
- `updated_at` text NOT NULL,
52
- `completed_at` text,
53
- `cancelled_at` text,
54
- FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
55
- );
@@ -1,16 +0,0 @@
1
- CREATE TABLE `task_usage` (
2
- `task_id` text PRIMARY KEY NOT NULL,
3
- `root_task_id` text,
4
- `agent_name` text NOT NULL,
5
- `provider_type` text NOT NULL,
6
- `model` text NOT NULL,
7
- `input_tokens` integer DEFAULT 0 NOT NULL,
8
- `output_tokens` integer DEFAULT 0 NOT NULL,
9
- `tool_call_count` integer DEFAULT 0 NOT NULL,
10
- `model_calls` integer DEFAULT 0 NOT NULL,
11
- `latency_ms` integer DEFAULT 0 NOT NULL,
12
- `is_complete` integer DEFAULT 0 NOT NULL,
13
- `created_at` text NOT NULL
14
- );
15
- --> statement-breakpoint
16
- CREATE INDEX `idx_task_usage_root_task_id` ON `task_usage` (`root_task_id`);
@@ -1,2 +0,0 @@
1
- ALTER TABLE `task_usage` ADD `stop_reason` text;--> statement-breakpoint
2
- ALTER TABLE `task_usage` ADD `max_tokens` integer;
@@ -1,2 +0,0 @@
1
- ALTER TABLE `task_usage` ADD `cache_read_input_tokens` integer;--> statement-breakpoint
2
- ALTER TABLE `task_usage` ADD `cache_creation_input_tokens` integer;
@@ -1,4 +0,0 @@
1
- ALTER TABLE `tasks` ADD `depends_on` text;--> statement-breakpoint
2
- ALTER TABLE `tasks` ADD `on_upstream_failure` text;--> statement-breakpoint
3
- ALTER TABLE `tasks` ADD `inputs` text;--> statement-breakpoint
4
- ALTER TABLE `tasks` ADD `resume_token` text;
@@ -1,25 +0,0 @@
1
- PRAGMA foreign_keys=OFF;--> statement-breakpoint
2
- CREATE TABLE `__new_tasks` (
3
- `id` text PRIMARY KEY NOT NULL,
4
- `session_id` text,
5
- `parent_task_id` text,
6
- `is_ephemeral` integer DEFAULT 0 NOT NULL,
7
- `recursion_depth` integer DEFAULT 0 NOT NULL,
8
- `status` text DEFAULT 'pending' NOT NULL,
9
- `prompt` text NOT NULL,
10
- `result` text,
11
- `error` text,
12
- `created_at` text NOT NULL,
13
- `updated_at` text NOT NULL,
14
- `completed_at` text,
15
- `cancelled_at` text,
16
- `depends_on` text,
17
- `on_upstream_failure` text,
18
- `inputs` text,
19
- `resume_token` text
20
- );
21
- --> statement-breakpoint
22
- INSERT INTO `__new_tasks`("id", "session_id", "parent_task_id", "is_ephemeral", "recursion_depth", "status", "prompt", "result", "error", "created_at", "updated_at", "completed_at", "cancelled_at", "depends_on", "on_upstream_failure", "inputs", "resume_token") SELECT "id", "session_id", "parent_task_id", 0, "recursion_depth", "status", "prompt", "result", "error", "created_at", "updated_at", "completed_at", "cancelled_at", "depends_on", "on_upstream_failure", "inputs", "resume_token" FROM `tasks`;--> statement-breakpoint
23
- DROP TABLE `tasks`;--> statement-breakpoint
24
- ALTER TABLE `__new_tasks` RENAME TO `tasks`;--> statement-breakpoint
25
- PRAGMA foreign_keys=ON;
@@ -1,387 +0,0 @@
1
- {
2
- "version": "6",
3
- "dialect": "sqlite",
4
- "id": "2d4aefae-8746-4f36-9d30-5eac97187370",
5
- "prevId": "00000000-0000-0000-0000-000000000000",
6
- "tables": {
7
- "agents": {
8
- "name": "agents",
9
- "columns": {
10
- "name": {
11
- "name": "name",
12
- "type": "text",
13
- "primaryKey": true,
14
- "notNull": true,
15
- "autoincrement": false
16
- },
17
- "version": {
18
- "name": "version",
19
- "type": "integer",
20
- "primaryKey": false,
21
- "notNull": true,
22
- "autoincrement": false,
23
- "default": 1
24
- },
25
- "data": {
26
- "name": "data",
27
- "type": "text",
28
- "primaryKey": false,
29
- "notNull": true,
30
- "autoincrement": false
31
- },
32
- "created_at": {
33
- "name": "created_at",
34
- "type": "text",
35
- "primaryKey": false,
36
- "notNull": true,
37
- "autoincrement": false
38
- },
39
- "updated_at": {
40
- "name": "updated_at",
41
- "type": "text",
42
- "primaryKey": false,
43
- "notNull": true,
44
- "autoincrement": false
45
- }
46
- },
47
- "indexes": {},
48
- "foreignKeys": {},
49
- "compositePrimaryKeys": {},
50
- "uniqueConstraints": {},
51
- "checkConstraints": {}
52
- },
53
- "messages": {
54
- "name": "messages",
55
- "columns": {
56
- "id": {
57
- "name": "id",
58
- "type": "text",
59
- "primaryKey": true,
60
- "notNull": true,
61
- "autoincrement": false
62
- },
63
- "session_id": {
64
- "name": "session_id",
65
- "type": "text",
66
- "primaryKey": false,
67
- "notNull": true,
68
- "autoincrement": false
69
- },
70
- "role": {
71
- "name": "role",
72
- "type": "text",
73
- "primaryKey": false,
74
- "notNull": true,
75
- "autoincrement": false
76
- },
77
- "content": {
78
- "name": "content",
79
- "type": "text",
80
- "primaryKey": false,
81
- "notNull": false,
82
- "autoincrement": false
83
- },
84
- "tool_calls": {
85
- "name": "tool_calls",
86
- "type": "text",
87
- "primaryKey": false,
88
- "notNull": false,
89
- "autoincrement": false
90
- },
91
- "tool_results": {
92
- "name": "tool_results",
93
- "type": "text",
94
- "primaryKey": false,
95
- "notNull": false,
96
- "autoincrement": false
97
- },
98
- "created_at": {
99
- "name": "created_at",
100
- "type": "text",
101
- "primaryKey": false,
102
- "notNull": true,
103
- "autoincrement": false
104
- }
105
- },
106
- "indexes": {},
107
- "foreignKeys": {
108
- "messages_session_id_sessions_id_fk": {
109
- "name": "messages_session_id_sessions_id_fk",
110
- "tableFrom": "messages",
111
- "tableTo": "sessions",
112
- "columnsFrom": [
113
- "session_id"
114
- ],
115
- "columnsTo": [
116
- "id"
117
- ],
118
- "onDelete": "cascade",
119
- "onUpdate": "no action"
120
- }
121
- },
122
- "compositePrimaryKeys": {},
123
- "uniqueConstraints": {},
124
- "checkConstraints": {}
125
- },
126
- "sessions": {
127
- "name": "sessions",
128
- "columns": {
129
- "id": {
130
- "name": "id",
131
- "type": "text",
132
- "primaryKey": true,
133
- "notNull": true,
134
- "autoincrement": false
135
- },
136
- "agent_name": {
137
- "name": "agent_name",
138
- "type": "text",
139
- "primaryKey": false,
140
- "notNull": true,
141
- "autoincrement": false
142
- },
143
- "agent_version": {
144
- "name": "agent_version",
145
- "type": "integer",
146
- "primaryKey": false,
147
- "notNull": true,
148
- "autoincrement": false
149
- },
150
- "agent_data": {
151
- "name": "agent_data",
152
- "type": "text",
153
- "primaryKey": false,
154
- "notNull": true,
155
- "autoincrement": false
156
- },
157
- "status": {
158
- "name": "status",
159
- "type": "text",
160
- "primaryKey": false,
161
- "notNull": true,
162
- "autoincrement": false,
163
- "default": "'active'"
164
- },
165
- "created_at": {
166
- "name": "created_at",
167
- "type": "text",
168
- "primaryKey": false,
169
- "notNull": true,
170
- "autoincrement": false
171
- },
172
- "updated_at": {
173
- "name": "updated_at",
174
- "type": "text",
175
- "primaryKey": false,
176
- "notNull": true,
177
- "autoincrement": false
178
- },
179
- "closed_at": {
180
- "name": "closed_at",
181
- "type": "text",
182
- "primaryKey": false,
183
- "notNull": false,
184
- "autoincrement": false
185
- }
186
- },
187
- "indexes": {},
188
- "foreignKeys": {
189
- "sessions_agent_name_agents_name_fk": {
190
- "name": "sessions_agent_name_agents_name_fk",
191
- "tableFrom": "sessions",
192
- "tableTo": "agents",
193
- "columnsFrom": [
194
- "agent_name"
195
- ],
196
- "columnsTo": [
197
- "name"
198
- ],
199
- "onDelete": "cascade",
200
- "onUpdate": "no action"
201
- }
202
- },
203
- "compositePrimaryKeys": {},
204
- "uniqueConstraints": {},
205
- "checkConstraints": {}
206
- },
207
- "task_events": {
208
- "name": "task_events",
209
- "columns": {
210
- "id": {
211
- "name": "id",
212
- "type": "text",
213
- "primaryKey": true,
214
- "notNull": true,
215
- "autoincrement": false
216
- },
217
- "task_id": {
218
- "name": "task_id",
219
- "type": "text",
220
- "primaryKey": false,
221
- "notNull": true,
222
- "autoincrement": false
223
- },
224
- "type": {
225
- "name": "type",
226
- "type": "text",
227
- "primaryKey": false,
228
- "notNull": true,
229
- "autoincrement": false
230
- },
231
- "payload": {
232
- "name": "payload",
233
- "type": "text",
234
- "primaryKey": false,
235
- "notNull": false,
236
- "autoincrement": false
237
- },
238
- "created_at": {
239
- "name": "created_at",
240
- "type": "text",
241
- "primaryKey": false,
242
- "notNull": true,
243
- "autoincrement": false
244
- }
245
- },
246
- "indexes": {},
247
- "foreignKeys": {
248
- "task_events_task_id_tasks_id_fk": {
249
- "name": "task_events_task_id_tasks_id_fk",
250
- "tableFrom": "task_events",
251
- "tableTo": "tasks",
252
- "columnsFrom": [
253
- "task_id"
254
- ],
255
- "columnsTo": [
256
- "id"
257
- ],
258
- "onDelete": "cascade",
259
- "onUpdate": "no action"
260
- }
261
- },
262
- "compositePrimaryKeys": {},
263
- "uniqueConstraints": {},
264
- "checkConstraints": {}
265
- },
266
- "tasks": {
267
- "name": "tasks",
268
- "columns": {
269
- "id": {
270
- "name": "id",
271
- "type": "text",
272
- "primaryKey": true,
273
- "notNull": true,
274
- "autoincrement": false
275
- },
276
- "session_id": {
277
- "name": "session_id",
278
- "type": "text",
279
- "primaryKey": false,
280
- "notNull": true,
281
- "autoincrement": false
282
- },
283
- "parent_task_id": {
284
- "name": "parent_task_id",
285
- "type": "text",
286
- "primaryKey": false,
287
- "notNull": false,
288
- "autoincrement": false
289
- },
290
- "recursion_depth": {
291
- "name": "recursion_depth",
292
- "type": "integer",
293
- "primaryKey": false,
294
- "notNull": true,
295
- "autoincrement": false,
296
- "default": 0
297
- },
298
- "status": {
299
- "name": "status",
300
- "type": "text",
301
- "primaryKey": false,
302
- "notNull": true,
303
- "autoincrement": false,
304
- "default": "'pending'"
305
- },
306
- "prompt": {
307
- "name": "prompt",
308
- "type": "text",
309
- "primaryKey": false,
310
- "notNull": true,
311
- "autoincrement": false
312
- },
313
- "result": {
314
- "name": "result",
315
- "type": "text",
316
- "primaryKey": false,
317
- "notNull": false,
318
- "autoincrement": false
319
- },
320
- "error": {
321
- "name": "error",
322
- "type": "text",
323
- "primaryKey": false,
324
- "notNull": false,
325
- "autoincrement": false
326
- },
327
- "created_at": {
328
- "name": "created_at",
329
- "type": "text",
330
- "primaryKey": false,
331
- "notNull": true,
332
- "autoincrement": false
333
- },
334
- "updated_at": {
335
- "name": "updated_at",
336
- "type": "text",
337
- "primaryKey": false,
338
- "notNull": true,
339
- "autoincrement": false
340
- },
341
- "completed_at": {
342
- "name": "completed_at",
343
- "type": "text",
344
- "primaryKey": false,
345
- "notNull": false,
346
- "autoincrement": false
347
- },
348
- "cancelled_at": {
349
- "name": "cancelled_at",
350
- "type": "text",
351
- "primaryKey": false,
352
- "notNull": false,
353
- "autoincrement": false
354
- }
355
- },
356
- "indexes": {},
357
- "foreignKeys": {
358
- "tasks_session_id_sessions_id_fk": {
359
- "name": "tasks_session_id_sessions_id_fk",
360
- "tableFrom": "tasks",
361
- "tableTo": "sessions",
362
- "columnsFrom": [
363
- "session_id"
364
- ],
365
- "columnsTo": [
366
- "id"
367
- ],
368
- "onDelete": "cascade",
369
- "onUpdate": "no action"
370
- }
371
- },
372
- "compositePrimaryKeys": {},
373
- "uniqueConstraints": {},
374
- "checkConstraints": {}
375
- }
376
- },
377
- "views": {},
378
- "enums": {},
379
- "_meta": {
380
- "schemas": {},
381
- "tables": {},
382
- "columns": {}
383
- },
384
- "internal": {
385
- "indexes": {}
386
- }
387
- }