@adhd/agent-mcp 0.0.2 → 0.0.3
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/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../../../../packages/ai/agent-mcp/src/providers/anthropic.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EACR,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EAEvB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../../../../packages/ai/agent-mcp/src/providers/anthropic.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EACR,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EAEvB,MAAM,YAAY,CAAC;AA6MpB,qBAAa,iBAAkB,YAAW,WAAW;IACjD,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiD;gBAE5D,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC;IA4B5D,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAgF1E"}
|
|
@@ -16,6 +16,20 @@ async function readKeychainCreds() {
|
|
|
16
16
|
const parsed = JSON.parse(stdout.trim());
|
|
17
17
|
return parsed.claudeAiOauth;
|
|
18
18
|
}
|
|
19
|
+
async function writeKeychainCreds(creds) {
|
|
20
|
+
// Read the full existing keychain entry so we preserve any other fields
|
|
21
|
+
const { stdout } = await execFileAsync("security", ["find-generic-password", "-s", KEYCHAIN_SERVICE, "-w"], { encoding: "utf8" });
|
|
22
|
+
const existing = JSON.parse(stdout.trim());
|
|
23
|
+
existing["claudeAiOauth"] = creds;
|
|
24
|
+
// -U updates the existing entry in place
|
|
25
|
+
await execFileAsync("security", [
|
|
26
|
+
"add-generic-password",
|
|
27
|
+
"-U",
|
|
28
|
+
"-s", KEYCHAIN_SERVICE,
|
|
29
|
+
"-a", KEYCHAIN_SERVICE,
|
|
30
|
+
"-w", JSON.stringify(existing),
|
|
31
|
+
], { encoding: "utf8" });
|
|
32
|
+
}
|
|
19
33
|
async function refreshOauthToken(refreshToken) {
|
|
20
34
|
// ⚠️ UNVERIFIED PATH — refresh confirmed blocked (HTTP 429) while the access token
|
|
21
35
|
// is still valid; the endpoint appears to enforce "no early refresh" as an OAuth
|
|
@@ -48,15 +62,29 @@ async function refreshOauthToken(refreshToken) {
|
|
|
48
62
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
49
63
|
body: body.toString(),
|
|
50
64
|
});
|
|
51
|
-
const
|
|
65
|
+
const rawBody = await res.text();
|
|
66
|
+
let json = {};
|
|
67
|
+
try {
|
|
68
|
+
json = JSON.parse(rawBody);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
throw new Error(`OAuth refresh failed: response was not JSON\n` +
|
|
72
|
+
` status: ${res.status} ${res.statusText}\n` +
|
|
73
|
+
` body: ${rawBody}`);
|
|
74
|
+
}
|
|
52
75
|
if (!res.ok || !json.access_token) {
|
|
53
|
-
throw new Error(`OAuth refresh failed
|
|
76
|
+
throw new Error(`OAuth refresh failed\n` +
|
|
77
|
+
` status: ${res.status} ${res.statusText}\n` +
|
|
78
|
+
` body: ${rawBody}`);
|
|
54
79
|
}
|
|
55
|
-
|
|
80
|
+
const fresh = {
|
|
56
81
|
accessToken: json.access_token,
|
|
57
82
|
refreshToken: json.refresh_token ?? refreshToken, // some providers rotate it
|
|
58
83
|
expiresAt: Date.now() + (json.expires_in ?? 3600) * 1000,
|
|
59
84
|
};
|
|
85
|
+
// Persist rotated credentials back to the keychain so Claude Code stays in sync
|
|
86
|
+
await writeKeychainCreds(fresh);
|
|
87
|
+
return fresh;
|
|
60
88
|
}
|
|
61
89
|
/**
|
|
62
90
|
* Returns a fresh access token, refreshing via OAuth if the stored one is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../../../../packages/ai/agent-mcp/src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAWhD,iFAAiF;AAEjF,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AACnD,MAAM,eAAe,GAAK,4CAA4C,CAAC;AACvE,MAAM,eAAe,GAAK,sCAAsC,CAAC;AACjE,uEAAuE;AACvE,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,QAAQ;AAQjD,KAAK,UAAU,iBAAiB;IAC5B,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAClC,UAAU,EACV,CAAC,uBAAuB,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,EACvD,EAAE,QAAQ,EAAE,MAAM,EAAE,CACvB,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAwC,CAAC;IAChF,OAAO,MAAM,CAAC,aAAa,CAAC;AAChC,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,YAAoB;IACjD,oFAAoF;IACpF,qFAAqF;IACrF,0EAA0E;IAC1E,mFAAmF;I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,MAAM,CAAC,GAAG,EAAE;gBACf,OAAO,EAAE,WAAW,CAAC,OAAO;gBAC5B,UAAU,EAAE,WAAW,CAAC,UAAU;gBAClC,UAAU,EAAE,WAAW,CAAC,UAAU;gBAClC,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,eAAe,EAAE,KAAK,CAAC,EAAE;oBACrB,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;wBAC1B,MAAM,KAAK,CAAC,CAAC,8BAA8B;oBAC/C,CAAC;gBACL,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;QAED,OAAO,GAAG,EAAE,CAAC;IACjB,CAAC;CACJ"}
|
|
@@ -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,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
|
-
}
|