@covro/covro 0.0.0-stage → 0.1.0-dev.1
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 +173 -2
- package/README.zh-CN.md +174 -0
- package/bin/covro.mjs +8 -0
- package/dist/cli/control.js +66 -0
- package/dist/cli/control.js.map +7 -0
- package/dist/cli/daemon.js +118 -0
- package/dist/cli/daemon.js.map +7 -0
- package/dist/cli/main.js +152 -0
- package/dist/cli/main.js.map +7 -0
- package/dist/cli/paths.js +60 -0
- package/dist/cli/paths.js.map +7 -0
- package/dist/cli/service.js +87 -0
- package/dist/cli/service.js.map +7 -0
- package/dist/codex/adapter.js +1195 -0
- package/dist/codex/adapter.js.map +7 -0
- package/dist/codex/auto-review.js +102 -0
- package/dist/codex/auto-review.js.map +7 -0
- package/dist/codex/compatibility.js +7 -0
- package/dist/codex/compatibility.js.map +7 -0
- package/dist/codex/mapping.js +210 -0
- package/dist/codex/mapping.js.map +7 -0
- package/dist/codex/permissions.js +51 -0
- package/dist/codex/permissions.js.map +7 -0
- package/dist/codex/thread-title-policy.js +52 -0
- package/dist/codex/thread-title-policy.js.map +7 -0
- package/dist/codex/thread-titles.js +259 -0
- package/dist/codex/thread-titles.js.map +7 -0
- package/dist/codex/transport.js +236 -0
- package/dist/codex/transport.js.map +7 -0
- package/dist/codex/turn-token-usage.js +46 -0
- package/dist/codex/turn-token-usage.js.map +7 -0
- package/dist/codex/types.js +1 -0
- package/dist/codex/types.js.map +7 -0
- package/dist/drizzle/0000_past_wildside.sql +45 -0
- package/dist/drizzle/0001_shocking_ender_wiggin.sql +2 -0
- package/dist/drizzle/0002_allow_parallel_threads.sql +1 -0
- package/dist/drizzle/0003_project_registrations.sql +11 -0
- package/dist/drizzle/0004_turn_usage.sql +6 -0
- package/dist/drizzle/meta/0000_snapshot.json +309 -0
- package/dist/drizzle/meta/0001_snapshot.json +323 -0
- package/dist/drizzle/meta/0002_snapshot.json +315 -0
- package/dist/drizzle/meta/0003_snapshot.json +381 -0
- package/dist/drizzle/meta/0004_snapshot.json +420 -0
- package/dist/drizzle/meta/_journal.json +41 -0
- package/dist/server/auth.js +47 -0
- package/dist/server/auth.js.map +7 -0
- package/dist/server/compaction.js +40 -0
- package/dist/server/compaction.js.map +7 -0
- package/dist/server/config-store.js +147 -0
- package/dist/server/config-store.js.map +7 -0
- package/dist/server/config.js +124 -0
- package/dist/server/config.js.map +7 -0
- package/dist/server/db/index.js +21 -0
- package/dist/server/db/index.js.map +7 -0
- package/dist/server/db/migrate.js +26 -0
- package/dist/server/db/migrate.js.map +7 -0
- package/dist/server/db/operations.js +201 -0
- package/dist/server/db/operations.js.map +7 -0
- package/dist/server/db/schema.js +99 -0
- package/dist/server/db/schema.js.map +7 -0
- package/dist/server/db/turn-usage.js +31 -0
- package/dist/server/db/turn-usage.js.map +7 -0
- package/dist/server/events.js +123 -0
- package/dist/server/events.js.map +7 -0
- package/dist/server/http.js +305 -0
- package/dist/server/http.js.map +7 -0
- package/dist/server/images.js +49 -0
- package/dist/server/images.js.map +7 -0
- package/dist/server/instance-lock.js +25 -0
- package/dist/server/instance-lock.js.map +7 -0
- package/dist/server/local-files.js +100 -0
- package/dist/server/local-files.js.map +7 -0
- package/dist/server/main.js +125 -0
- package/dist/server/main.js.map +7 -0
- package/dist/server/markdown.js +28 -0
- package/dist/server/markdown.js.map +7 -0
- package/dist/server/projection.js +348 -0
- package/dist/server/projection.js.map +7 -0
- package/dist/server/projects.js +230 -0
- package/dist/server/projects.js.map +7 -0
- package/dist/server/service.js +1221 -0
- package/dist/server/service.js.map +7 -0
- package/dist/server/snapshot.js +98 -0
- package/dist/server/snapshot.js.map +7 -0
- package/dist/server/thread-export.js +97 -0
- package/dist/server/thread-export.js.map +7 -0
- package/dist/server/websocket.js +126 -0
- package/dist/server/websocket.js.map +7 -0
- package/dist/shared/async-questions.js +39 -0
- package/dist/shared/async-questions.js.map +7 -0
- package/dist/shared/codex-compatibility.js +56 -0
- package/dist/shared/codex-compatibility.js.map +7 -0
- package/dist/shared/elicitation.js +314 -0
- package/dist/shared/elicitation.js.map +7 -0
- package/dist/shared/errors.js +24 -0
- package/dist/shared/errors.js.map +7 -0
- package/dist/shared/gateway-config.js +1 -0
- package/dist/shared/gateway-config.js.map +7 -0
- package/dist/shared/images.js +21 -0
- package/dist/shared/images.js.map +7 -0
- package/dist/shared/package.js +5 -0
- package/dist/shared/package.js.map +7 -0
- package/dist/shared/permissions.js +63 -0
- package/dist/shared/permissions.js.map +7 -0
- package/dist/shared/thread-name.js +14 -0
- package/dist/shared/thread-name.js.map +7 -0
- package/dist/shared/thread-summary.js +24 -0
- package/dist/shared/thread-summary.js.map +7 -0
- package/dist/shared/types.js +1 -0
- package/dist/shared/types.js.map +7 -0
- package/dist/shared/updates.js +7 -0
- package/dist/shared/updates.js.map +7 -0
- package/dist/shared/validation.js +116 -0
- package/dist/shared/validation.js.map +7 -0
- package/dist/shared/versions.js +36 -0
- package/dist/shared/versions.js.map +7 -0
- package/dist/update-worker.cjs +21968 -0
- package/dist/updates/files.js +54 -0
- package/dist/updates/files.js.map +7 -0
- package/dist/updates/manager.js +315 -0
- package/dist/updates/manager.js.map +7 -0
- package/dist/updates/registry.js +71 -0
- package/dist/updates/registry.js.map +7 -0
- package/dist/updates/transaction.js +96 -0
- package/dist/updates/transaction.js.map +7 -0
- package/dist/updates/worker.js +345 -0
- package/dist/updates/worker.js.map +7 -0
- package/dist/web/assets/index-BW9afH_Y.js +83 -0
- package/dist/web/assets/index-L3S1ZiO0.css +1 -0
- package/dist/web/covro.svg +6 -0
- package/dist/web/index.html +15 -0
- package/package.json +88 -4
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "6",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"id": "51088300-eeac-40ca-99e1-b8f2b1bb4939",
|
|
5
|
+
"prevId": "b04492b0-9745-46ad-9c20-a34e75f4a208",
|
|
6
|
+
"tables": {
|
|
7
|
+
"execution_markers": {
|
|
8
|
+
"name": "execution_markers",
|
|
9
|
+
"columns": {
|
|
10
|
+
"operation_id": {
|
|
11
|
+
"name": "operation_id",
|
|
12
|
+
"type": "text",
|
|
13
|
+
"primaryKey": true,
|
|
14
|
+
"notNull": true,
|
|
15
|
+
"autoincrement": false
|
|
16
|
+
},
|
|
17
|
+
"thread_id": {
|
|
18
|
+
"name": "thread_id",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true,
|
|
22
|
+
"autoincrement": false
|
|
23
|
+
},
|
|
24
|
+
"turn_id": {
|
|
25
|
+
"name": "turn_id",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": false,
|
|
29
|
+
"autoincrement": false
|
|
30
|
+
},
|
|
31
|
+
"workspace_key": {
|
|
32
|
+
"name": "workspace_key",
|
|
33
|
+
"type": "text",
|
|
34
|
+
"primaryKey": false,
|
|
35
|
+
"notNull": true,
|
|
36
|
+
"autoincrement": false
|
|
37
|
+
},
|
|
38
|
+
"codex_epoch": {
|
|
39
|
+
"name": "codex_epoch",
|
|
40
|
+
"type": "text",
|
|
41
|
+
"primaryKey": false,
|
|
42
|
+
"notNull": true,
|
|
43
|
+
"autoincrement": false
|
|
44
|
+
},
|
|
45
|
+
"state": {
|
|
46
|
+
"name": "state",
|
|
47
|
+
"type": "text",
|
|
48
|
+
"primaryKey": false,
|
|
49
|
+
"notNull": true,
|
|
50
|
+
"autoincrement": false
|
|
51
|
+
},
|
|
52
|
+
"created_at": {
|
|
53
|
+
"name": "created_at",
|
|
54
|
+
"type": "integer",
|
|
55
|
+
"primaryKey": false,
|
|
56
|
+
"notNull": true,
|
|
57
|
+
"autoincrement": false
|
|
58
|
+
},
|
|
59
|
+
"ended_at": {
|
|
60
|
+
"name": "ended_at",
|
|
61
|
+
"type": "integer",
|
|
62
|
+
"primaryKey": false,
|
|
63
|
+
"notNull": false,
|
|
64
|
+
"autoincrement": false
|
|
65
|
+
},
|
|
66
|
+
"reconciled_at": {
|
|
67
|
+
"name": "reconciled_at",
|
|
68
|
+
"type": "integer",
|
|
69
|
+
"primaryKey": false,
|
|
70
|
+
"notNull": false,
|
|
71
|
+
"autoincrement": false
|
|
72
|
+
},
|
|
73
|
+
"reconciliation_operation_id": {
|
|
74
|
+
"name": "reconciliation_operation_id",
|
|
75
|
+
"type": "text",
|
|
76
|
+
"primaryKey": false,
|
|
77
|
+
"notNull": false,
|
|
78
|
+
"autoincrement": false
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"indexes": {
|
|
82
|
+
"execution_markers_active_thread": {
|
|
83
|
+
"name": "execution_markers_active_thread",
|
|
84
|
+
"columns": [
|
|
85
|
+
"thread_id"
|
|
86
|
+
],
|
|
87
|
+
"isUnique": true,
|
|
88
|
+
"where": "\"execution_markers\".\"ended_at\" is null"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"foreignKeys": {
|
|
92
|
+
"execution_markers_operation_id_operations_client_operation_id_fk": {
|
|
93
|
+
"name": "execution_markers_operation_id_operations_client_operation_id_fk",
|
|
94
|
+
"tableFrom": "execution_markers",
|
|
95
|
+
"tableTo": "operations",
|
|
96
|
+
"columnsFrom": [
|
|
97
|
+
"operation_id"
|
|
98
|
+
],
|
|
99
|
+
"columnsTo": [
|
|
100
|
+
"client_operation_id"
|
|
101
|
+
],
|
|
102
|
+
"onDelete": "no action",
|
|
103
|
+
"onUpdate": "no action"
|
|
104
|
+
},
|
|
105
|
+
"execution_markers_reconciliation_operation_id_operations_client_operation_id_fk": {
|
|
106
|
+
"name": "execution_markers_reconciliation_operation_id_operations_client_operation_id_fk",
|
|
107
|
+
"tableFrom": "execution_markers",
|
|
108
|
+
"tableTo": "operations",
|
|
109
|
+
"columnsFrom": [
|
|
110
|
+
"reconciliation_operation_id"
|
|
111
|
+
],
|
|
112
|
+
"columnsTo": [
|
|
113
|
+
"client_operation_id"
|
|
114
|
+
],
|
|
115
|
+
"onDelete": "no action",
|
|
116
|
+
"onUpdate": "no action"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"compositePrimaryKeys": {},
|
|
120
|
+
"uniqueConstraints": {},
|
|
121
|
+
"checkConstraints": {
|
|
122
|
+
"execution_markers_state_check": {
|
|
123
|
+
"name": "execution_markers_state_check",
|
|
124
|
+
"value": "\"execution_markers\".\"state\" in ('active', 'unknown', 'terminal', 'reconciled')"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"operations": {
|
|
129
|
+
"name": "operations",
|
|
130
|
+
"columns": {
|
|
131
|
+
"client_operation_id": {
|
|
132
|
+
"name": "client_operation_id",
|
|
133
|
+
"type": "text",
|
|
134
|
+
"primaryKey": true,
|
|
135
|
+
"notNull": true,
|
|
136
|
+
"autoincrement": false
|
|
137
|
+
},
|
|
138
|
+
"kind": {
|
|
139
|
+
"name": "kind",
|
|
140
|
+
"type": "text",
|
|
141
|
+
"primaryKey": false,
|
|
142
|
+
"notNull": true,
|
|
143
|
+
"autoincrement": false
|
|
144
|
+
},
|
|
145
|
+
"target": {
|
|
146
|
+
"name": "target",
|
|
147
|
+
"type": "text",
|
|
148
|
+
"primaryKey": false,
|
|
149
|
+
"notNull": true,
|
|
150
|
+
"autoincrement": false
|
|
151
|
+
},
|
|
152
|
+
"project_id": {
|
|
153
|
+
"name": "project_id",
|
|
154
|
+
"type": "text",
|
|
155
|
+
"primaryKey": false,
|
|
156
|
+
"notNull": false,
|
|
157
|
+
"autoincrement": false
|
|
158
|
+
},
|
|
159
|
+
"request_digest": {
|
|
160
|
+
"name": "request_digest",
|
|
161
|
+
"type": "text",
|
|
162
|
+
"primaryKey": false,
|
|
163
|
+
"notNull": true,
|
|
164
|
+
"autoincrement": false
|
|
165
|
+
},
|
|
166
|
+
"state": {
|
|
167
|
+
"name": "state",
|
|
168
|
+
"type": "text",
|
|
169
|
+
"primaryKey": false,
|
|
170
|
+
"notNull": true,
|
|
171
|
+
"autoincrement": false
|
|
172
|
+
},
|
|
173
|
+
"result": {
|
|
174
|
+
"name": "result",
|
|
175
|
+
"type": "text",
|
|
176
|
+
"primaryKey": false,
|
|
177
|
+
"notNull": false,
|
|
178
|
+
"autoincrement": false
|
|
179
|
+
},
|
|
180
|
+
"error": {
|
|
181
|
+
"name": "error",
|
|
182
|
+
"type": "text",
|
|
183
|
+
"primaryKey": false,
|
|
184
|
+
"notNull": false,
|
|
185
|
+
"autoincrement": false
|
|
186
|
+
},
|
|
187
|
+
"created_at": {
|
|
188
|
+
"name": "created_at",
|
|
189
|
+
"type": "integer",
|
|
190
|
+
"primaryKey": false,
|
|
191
|
+
"notNull": true,
|
|
192
|
+
"autoincrement": false
|
|
193
|
+
},
|
|
194
|
+
"updated_at": {
|
|
195
|
+
"name": "updated_at",
|
|
196
|
+
"type": "integer",
|
|
197
|
+
"primaryKey": false,
|
|
198
|
+
"notNull": true,
|
|
199
|
+
"autoincrement": false
|
|
200
|
+
},
|
|
201
|
+
"reconciled_at": {
|
|
202
|
+
"name": "reconciled_at",
|
|
203
|
+
"type": "integer",
|
|
204
|
+
"primaryKey": false,
|
|
205
|
+
"notNull": false,
|
|
206
|
+
"autoincrement": false
|
|
207
|
+
},
|
|
208
|
+
"reconciliation_decision": {
|
|
209
|
+
"name": "reconciliation_decision",
|
|
210
|
+
"type": "text",
|
|
211
|
+
"primaryKey": false,
|
|
212
|
+
"notNull": false,
|
|
213
|
+
"autoincrement": false
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"indexes": {
|
|
217
|
+
"operations_state_idx": {
|
|
218
|
+
"name": "operations_state_idx",
|
|
219
|
+
"columns": [
|
|
220
|
+
"state"
|
|
221
|
+
],
|
|
222
|
+
"isUnique": false
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"foreignKeys": {},
|
|
226
|
+
"compositePrimaryKeys": {},
|
|
227
|
+
"uniqueConstraints": {},
|
|
228
|
+
"checkConstraints": {
|
|
229
|
+
"operations_state_check": {
|
|
230
|
+
"name": "operations_state_check",
|
|
231
|
+
"value": "\"operations\".\"state\" in ('accepted', 'dispatching', 'acknowledged', 'failed', 'unknown')"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"preferences": {
|
|
236
|
+
"name": "preferences",
|
|
237
|
+
"columns": {
|
|
238
|
+
"key": {
|
|
239
|
+
"name": "key",
|
|
240
|
+
"type": "text",
|
|
241
|
+
"primaryKey": true,
|
|
242
|
+
"notNull": true,
|
|
243
|
+
"autoincrement": false
|
|
244
|
+
},
|
|
245
|
+
"value": {
|
|
246
|
+
"name": "value",
|
|
247
|
+
"type": "text",
|
|
248
|
+
"primaryKey": false,
|
|
249
|
+
"notNull": true,
|
|
250
|
+
"autoincrement": false
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"indexes": {},
|
|
254
|
+
"foreignKeys": {},
|
|
255
|
+
"compositePrimaryKeys": {},
|
|
256
|
+
"uniqueConstraints": {},
|
|
257
|
+
"checkConstraints": {}
|
|
258
|
+
},
|
|
259
|
+
"project_registrations": {
|
|
260
|
+
"name": "project_registrations",
|
|
261
|
+
"columns": {
|
|
262
|
+
"id": {
|
|
263
|
+
"name": "id",
|
|
264
|
+
"type": "text",
|
|
265
|
+
"primaryKey": true,
|
|
266
|
+
"notNull": true,
|
|
267
|
+
"autoincrement": false
|
|
268
|
+
},
|
|
269
|
+
"name": {
|
|
270
|
+
"name": "name",
|
|
271
|
+
"type": "text",
|
|
272
|
+
"primaryKey": false,
|
|
273
|
+
"notNull": true,
|
|
274
|
+
"autoincrement": false
|
|
275
|
+
},
|
|
276
|
+
"path": {
|
|
277
|
+
"name": "path",
|
|
278
|
+
"type": "text",
|
|
279
|
+
"primaryKey": false,
|
|
280
|
+
"notNull": true,
|
|
281
|
+
"autoincrement": false
|
|
282
|
+
},
|
|
283
|
+
"canonical_root": {
|
|
284
|
+
"name": "canonical_root",
|
|
285
|
+
"type": "text",
|
|
286
|
+
"primaryKey": false,
|
|
287
|
+
"notNull": false,
|
|
288
|
+
"autoincrement": false
|
|
289
|
+
},
|
|
290
|
+
"removed_at": {
|
|
291
|
+
"name": "removed_at",
|
|
292
|
+
"type": "integer",
|
|
293
|
+
"primaryKey": false,
|
|
294
|
+
"notNull": false,
|
|
295
|
+
"autoincrement": false
|
|
296
|
+
},
|
|
297
|
+
"created_at": {
|
|
298
|
+
"name": "created_at",
|
|
299
|
+
"type": "integer",
|
|
300
|
+
"primaryKey": false,
|
|
301
|
+
"notNull": true,
|
|
302
|
+
"autoincrement": false
|
|
303
|
+
},
|
|
304
|
+
"updated_at": {
|
|
305
|
+
"name": "updated_at",
|
|
306
|
+
"type": "integer",
|
|
307
|
+
"primaryKey": false,
|
|
308
|
+
"notNull": true,
|
|
309
|
+
"autoincrement": false
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"indexes": {},
|
|
313
|
+
"foreignKeys": {},
|
|
314
|
+
"compositePrimaryKeys": {},
|
|
315
|
+
"uniqueConstraints": {},
|
|
316
|
+
"checkConstraints": {}
|
|
317
|
+
},
|
|
318
|
+
"thread_links": {
|
|
319
|
+
"name": "thread_links",
|
|
320
|
+
"columns": {
|
|
321
|
+
"thread_id": {
|
|
322
|
+
"name": "thread_id",
|
|
323
|
+
"type": "text",
|
|
324
|
+
"primaryKey": true,
|
|
325
|
+
"notNull": true,
|
|
326
|
+
"autoincrement": false
|
|
327
|
+
},
|
|
328
|
+
"project_id": {
|
|
329
|
+
"name": "project_id",
|
|
330
|
+
"type": "text",
|
|
331
|
+
"primaryKey": false,
|
|
332
|
+
"notNull": true,
|
|
333
|
+
"autoincrement": false
|
|
334
|
+
},
|
|
335
|
+
"cwd": {
|
|
336
|
+
"name": "cwd",
|
|
337
|
+
"type": "text",
|
|
338
|
+
"primaryKey": false,
|
|
339
|
+
"notNull": true,
|
|
340
|
+
"autoincrement": false
|
|
341
|
+
},
|
|
342
|
+
"source": {
|
|
343
|
+
"name": "source",
|
|
344
|
+
"type": "text",
|
|
345
|
+
"primaryKey": false,
|
|
346
|
+
"notNull": true,
|
|
347
|
+
"autoincrement": false
|
|
348
|
+
},
|
|
349
|
+
"managed_epoch": {
|
|
350
|
+
"name": "managed_epoch",
|
|
351
|
+
"type": "text",
|
|
352
|
+
"primaryKey": false,
|
|
353
|
+
"notNull": false,
|
|
354
|
+
"autoincrement": false
|
|
355
|
+
},
|
|
356
|
+
"updated_at": {
|
|
357
|
+
"name": "updated_at",
|
|
358
|
+
"type": "integer",
|
|
359
|
+
"primaryKey": false,
|
|
360
|
+
"notNull": true,
|
|
361
|
+
"autoincrement": false
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
"indexes": {},
|
|
365
|
+
"foreignKeys": {},
|
|
366
|
+
"compositePrimaryKeys": {},
|
|
367
|
+
"uniqueConstraints": {},
|
|
368
|
+
"checkConstraints": {}
|
|
369
|
+
},
|
|
370
|
+
"turn_usage": {
|
|
371
|
+
"name": "turn_usage",
|
|
372
|
+
"columns": {
|
|
373
|
+
"thread_id": {
|
|
374
|
+
"name": "thread_id",
|
|
375
|
+
"type": "text",
|
|
376
|
+
"primaryKey": false,
|
|
377
|
+
"notNull": true,
|
|
378
|
+
"autoincrement": false
|
|
379
|
+
},
|
|
380
|
+
"turn_id": {
|
|
381
|
+
"name": "turn_id",
|
|
382
|
+
"type": "text",
|
|
383
|
+
"primaryKey": false,
|
|
384
|
+
"notNull": true,
|
|
385
|
+
"autoincrement": false
|
|
386
|
+
},
|
|
387
|
+
"output_tokens": {
|
|
388
|
+
"name": "output_tokens",
|
|
389
|
+
"type": "integer",
|
|
390
|
+
"primaryKey": false,
|
|
391
|
+
"notNull": true,
|
|
392
|
+
"autoincrement": false
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"indexes": {},
|
|
396
|
+
"foreignKeys": {},
|
|
397
|
+
"compositePrimaryKeys": {
|
|
398
|
+
"turn_usage_thread_id_turn_id_pk": {
|
|
399
|
+
"columns": [
|
|
400
|
+
"thread_id",
|
|
401
|
+
"turn_id"
|
|
402
|
+
],
|
|
403
|
+
"name": "turn_usage_thread_id_turn_id_pk"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"uniqueConstraints": {},
|
|
407
|
+
"checkConstraints": {}
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
"views": {},
|
|
411
|
+
"enums": {},
|
|
412
|
+
"_meta": {
|
|
413
|
+
"schemas": {},
|
|
414
|
+
"tables": {},
|
|
415
|
+
"columns": {}
|
|
416
|
+
},
|
|
417
|
+
"internal": {
|
|
418
|
+
"indexes": {}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "6",
|
|
8
|
+
"when": 1791848623295,
|
|
9
|
+
"tag": "0000_past_wildside",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "6",
|
|
15
|
+
"when": 1791848704048,
|
|
16
|
+
"tag": "0001_shocking_ender_wiggin",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "6",
|
|
22
|
+
"when": 1791981175706,
|
|
23
|
+
"tag": "0002_allow_parallel_threads",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "6",
|
|
29
|
+
"when": 1791983671033,
|
|
30
|
+
"tag": "0003_project_registrations",
|
|
31
|
+
"breakpoints": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idx": 4,
|
|
35
|
+
"version": "6",
|
|
36
|
+
"when": 1792166745097,
|
|
37
|
+
"tag": "0004_turn_usage",
|
|
38
|
+
"breakpoints": true
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
2
|
+
import { AppError } from "../shared/errors.js";
|
|
3
|
+
function createAuthenticator(config, testKey) {
|
|
4
|
+
const access = config.auth.mode === "cloudflare-access" ? config.auth : void 0;
|
|
5
|
+
const key = access ? testKey ?? createRemoteJWKSet(new URL("/cdn-cgi/access/certs", access.issuer)) : void 0;
|
|
6
|
+
const origins = /* @__PURE__ */ new Set([...config.publicOrigin, ...config.developmentOrigins]);
|
|
7
|
+
const hosts = new Set([...origins].map((value) => new URL(value).host));
|
|
8
|
+
return async function authenticate(request, websocket = false) {
|
|
9
|
+
const host = request.headers.get("host") ?? new URL(request.url).host;
|
|
10
|
+
if (!hosts.has(host))
|
|
11
|
+
throw new AppError("INVALID_HOST", "Request Host does not match a configured origin", 403);
|
|
12
|
+
const requestOrigin = request.headers.get("origin");
|
|
13
|
+
const mutating = !["GET", "HEAD", "OPTIONS"].includes(request.method);
|
|
14
|
+
if ((websocket || mutating) && (!requestOrigin || !origins.has(requestOrigin)))
|
|
15
|
+
throw new AppError(
|
|
16
|
+
"INVALID_ORIGIN",
|
|
17
|
+
"Request Origin does not match a configured origin",
|
|
18
|
+
403
|
|
19
|
+
);
|
|
20
|
+
if (requestOrigin && !origins.has(requestOrigin))
|
|
21
|
+
throw new AppError(
|
|
22
|
+
"INVALID_ORIGIN",
|
|
23
|
+
"Request Origin does not match a configured origin",
|
|
24
|
+
403
|
|
25
|
+
);
|
|
26
|
+
if (mutating && request.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase() !== "application/json")
|
|
27
|
+
throw new AppError("INVALID_CONTENT_TYPE", "Expected application/json", 415);
|
|
28
|
+
if (!access || !key) return {};
|
|
29
|
+
const token = request.headers.get("cf-access-jwt-assertion");
|
|
30
|
+
if (!token) throw new AppError("UNAUTHENTICATED", "Cloudflare Access login is required", 401);
|
|
31
|
+
try {
|
|
32
|
+
const { payload } = await jwtVerify(token, key, {
|
|
33
|
+
issuer: access.issuer,
|
|
34
|
+
audience: access.audience,
|
|
35
|
+
algorithms: ["RS256"],
|
|
36
|
+
requiredClaims: ["exp", "iss", "aud", "sub"]
|
|
37
|
+
});
|
|
38
|
+
return { expiresAt: payload.exp * 1e3 };
|
|
39
|
+
} catch {
|
|
40
|
+
throw new AppError("UNAUTHENTICATED", "Cloudflare Access login is invalid or expired", 401);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
createAuthenticator
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/server/auth.ts"],
|
|
4
|
+
"sourcesContent": ["import { createRemoteJWKSet, jwtVerify, type JWTVerifyGetKey } from 'jose';\nimport type { AppConfig } from './config.js';\nimport { AppError } from '../shared/errors.js';\nexport interface Identity {\n expiresAt?: number;\n}\nexport function createAuthenticator(\n config: AppConfig,\n testKey?: JWTVerifyGetKey | CryptoKey | Uint8Array,\n) {\n const access = config.auth.mode === 'cloudflare-access' ? config.auth : undefined;\n const key = access\n ? (testKey ?? createRemoteJWKSet(new URL('/cdn-cgi/access/certs', access.issuer)))\n : undefined;\n const origins = new Set([...config.publicOrigin, ...config.developmentOrigins]);\n const hosts = new Set([...origins].map((value) => new URL(value).host));\n return async function authenticate(request: Request, websocket = false): Promise<Identity> {\n // Host is checked in both modes; forwarded headers never grant identity.\n const host = request.headers.get('host') ?? new URL(request.url).host;\n if (!hosts.has(host))\n throw new AppError('INVALID_HOST', 'Request Host does not match a configured origin', 403);\n const requestOrigin = request.headers.get('origin');\n const mutating = !['GET', 'HEAD', 'OPTIONS'].includes(request.method);\n if ((websocket || mutating) && (!requestOrigin || !origins.has(requestOrigin)))\n throw new AppError(\n 'INVALID_ORIGIN',\n 'Request Origin does not match a configured origin',\n 403,\n );\n if (requestOrigin && !origins.has(requestOrigin))\n throw new AppError(\n 'INVALID_ORIGIN',\n 'Request Origin does not match a configured origin',\n 403,\n );\n if (\n mutating &&\n request.headers.get('content-type')?.split(';')[0]?.trim().toLowerCase() !==\n 'application/json'\n )\n throw new AppError('INVALID_CONTENT_TYPE', 'Expected application/json', 415);\n if (!access || !key) return {};\n const token = request.headers.get('cf-access-jwt-assertion');\n if (!token) throw new AppError('UNAUTHENTICATED', 'Cloudflare Access login is required', 401);\n try {\n const { payload } = await jwtVerify(token, key as JWTVerifyGetKey, {\n issuer: access.issuer,\n audience: access.audience,\n algorithms: ['RS256'],\n requiredClaims: ['exp', 'iss', 'aud', 'sub'],\n });\n return { expiresAt: payload.exp! * 1000 };\n } catch {\n throw new AppError('UNAUTHENTICATED', 'Cloudflare Access login is invalid or expired', 401);\n }\n };\n}\nexport type Authenticator = ReturnType<typeof createAuthenticator>;\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB,iBAAuC;AAEpE,SAAS,gBAAgB;AAIlB,SAAS,oBACd,QACA,SACA;AACA,QAAM,SAAS,OAAO,KAAK,SAAS,sBAAsB,OAAO,OAAO;AACxE,QAAM,MAAM,SACP,WAAW,mBAAmB,IAAI,IAAI,yBAAyB,OAAO,MAAM,CAAC,IAC9E;AACJ,QAAM,UAAU,oBAAI,IAAI,CAAC,GAAG,OAAO,cAAc,GAAG,OAAO,kBAAkB,CAAC;AAC9E,QAAM,QAAQ,IAAI,IAAI,CAAC,GAAG,OAAO,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC;AACtE,SAAO,eAAe,aAAa,SAAkB,YAAY,OAA0B;AAEzF,UAAM,OAAO,QAAQ,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,QAAQ,GAAG,EAAE;AACjE,QAAI,CAAC,MAAM,IAAI,IAAI;AACjB,YAAM,IAAI,SAAS,gBAAgB,mDAAmD,GAAG;AAC3F,UAAM,gBAAgB,QAAQ,QAAQ,IAAI,QAAQ;AAClD,UAAM,WAAW,CAAC,CAAC,OAAO,QAAQ,SAAS,EAAE,SAAS,QAAQ,MAAM;AACpE,SAAK,aAAa,cAAc,CAAC,iBAAiB,CAAC,QAAQ,IAAI,aAAa;AAC1E,YAAM,IAAI;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACF,QAAI,iBAAiB,CAAC,QAAQ,IAAI,aAAa;AAC7C,YAAM,IAAI;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACF,QACE,YACA,QAAQ,QAAQ,IAAI,cAAc,GAAG,MAAM,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,YAAY,MACrE;AAEF,YAAM,IAAI,SAAS,wBAAwB,6BAA6B,GAAG;AAC7E,QAAI,CAAC,UAAU,CAAC,IAAK,QAAO,CAAC;AAC7B,UAAM,QAAQ,QAAQ,QAAQ,IAAI,yBAAyB;AAC3D,QAAI,CAAC,MAAO,OAAM,IAAI,SAAS,mBAAmB,uCAAuC,GAAG;AAC5F,QAAI;AACF,YAAM,EAAE,QAAQ,IAAI,MAAM,UAAU,OAAO,KAAwB;AAAA,QACjE,QAAQ,OAAO;AAAA,QACf,UAAU,OAAO;AAAA,QACjB,YAAY,CAAC,OAAO;AAAA,QACpB,gBAAgB,CAAC,OAAO,OAAO,OAAO,KAAK;AAAA,MAC7C,CAAC;AACD,aAAO,EAAE,WAAW,QAAQ,MAAO,IAAK;AAAA,IAC1C,QAAQ;AACN,YAAM,IAAI,SAAS,mBAAmB,iDAAiD,GAAG;AAAA,IAC5F;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const active = (status) => status === "running" || status === "waitingApproval" || status === "waitingInput";
|
|
2
|
+
function mergeCompaction(item, previous) {
|
|
3
|
+
if (item.type !== "contextCompaction" || !previous) return item;
|
|
4
|
+
if (!item.status || item.status === "inProgress" && previous.status && previous.status !== "inProgress")
|
|
5
|
+
return {
|
|
6
|
+
...item,
|
|
7
|
+
status: previous.status,
|
|
8
|
+
...previous.error ? { error: previous.error } : {}
|
|
9
|
+
};
|
|
10
|
+
if (previous.status === "failed" || previous.status === "interrupted") return previous;
|
|
11
|
+
return item;
|
|
12
|
+
}
|
|
13
|
+
function settleCompactions(turn) {
|
|
14
|
+
for (const item of turn.items) {
|
|
15
|
+
if (item.type !== "contextCompaction") continue;
|
|
16
|
+
if (!item.status) {
|
|
17
|
+
if (turn.status === "completed") item.status = "completed";
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (item.status !== "inProgress" || active(turn.status)) continue;
|
|
21
|
+
item.status = turn.status === "failed" || turn.status === "interrupted" ? turn.status : "unknown";
|
|
22
|
+
if (turn.error) item.error = turn.error.slice(0, 4096);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function endCompactions(turn, status, error) {
|
|
26
|
+
let changed = false;
|
|
27
|
+
for (const item of turn.items) {
|
|
28
|
+
if (item.type !== "contextCompaction" || item.status !== "inProgress") continue;
|
|
29
|
+
item.status = status;
|
|
30
|
+
if (error) item.error = error.slice(0, 4096);
|
|
31
|
+
changed = true;
|
|
32
|
+
}
|
|
33
|
+
return changed;
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
endCompactions,
|
|
37
|
+
mergeCompaction,
|
|
38
|
+
settleCompactions
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=compaction.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/server/compaction.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ItemView, RunStatus, TurnView } from '../shared/types.js';\n\nconst active = (status: RunStatus) =>\n status === 'running' || status === 'waitingApproval' || status === 'waitingInput';\n\n/** History has no item lifecycle field. Never let a history read erase a live observation. */\nexport function mergeCompaction(item: ItemView, previous?: ItemView): ItemView {\n if (item.type !== 'contextCompaction' || !previous) return item;\n if (\n !item.status ||\n (item.status === 'inProgress' && previous.status && previous.status !== 'inProgress')\n )\n return {\n ...item,\n status: previous.status,\n ...(previous.error ? { error: previous.error } : {}),\n };\n // An item/completed envelope cannot reverse a preceding explicit compaction failure.\n if (previous.status === 'failed' || previous.status === 'interrupted') return previous;\n return item;\n}\n\n/** Only live item/started proves ongoing compaction; a terminal turn cannot leave it spinning. */\nexport function settleCompactions(turn: TurnView): void {\n for (const item of turn.items) {\n if (item.type !== 'contextCompaction') continue;\n if (!item.status) {\n // Old successful turns retain completion records, but an active/failed history alone\n // cannot establish whether its compaction succeeded or is still running.\n if (turn.status === 'completed') item.status = 'completed';\n continue;\n }\n if (item.status !== 'inProgress' || active(turn.status)) continue;\n item.status =\n turn.status === 'failed' || turn.status === 'interrupted' ? turn.status : 'unknown';\n if (turn.error) item.error = turn.error.slice(0, 4096);\n }\n}\n\nexport function endCompactions(turn: TurnView, status: string, error?: string): boolean {\n let changed = false;\n for (const item of turn.items) {\n if (item.type !== 'contextCompaction' || item.status !== 'inProgress') continue;\n item.status = status;\n if (error) item.error = error.slice(0, 4096);\n changed = true;\n }\n return changed;\n}\n"],
|
|
5
|
+
"mappings": "AAEA,MAAM,SAAS,CAAC,WACd,WAAW,aAAa,WAAW,qBAAqB,WAAW;AAG9D,SAAS,gBAAgB,MAAgB,UAA+B;AAC7E,MAAI,KAAK,SAAS,uBAAuB,CAAC,SAAU,QAAO;AAC3D,MACE,CAAC,KAAK,UACL,KAAK,WAAW,gBAAgB,SAAS,UAAU,SAAS,WAAW;AAExE,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,SAAS;AAAA,MACjB,GAAI,SAAS,QAAQ,EAAE,OAAO,SAAS,MAAM,IAAI,CAAC;AAAA,IACpD;AAEF,MAAI,SAAS,WAAW,YAAY,SAAS,WAAW,cAAe,QAAO;AAC9E,SAAO;AACT;AAGO,SAAS,kBAAkB,MAAsB;AACtD,aAAW,QAAQ,KAAK,OAAO;AAC7B,QAAI,KAAK,SAAS,oBAAqB;AACvC,QAAI,CAAC,KAAK,QAAQ;AAGhB,UAAI,KAAK,WAAW,YAAa,MAAK,SAAS;AAC/C;AAAA,IACF;AACA,QAAI,KAAK,WAAW,gBAAgB,OAAO,KAAK,MAAM,EAAG;AACzD,SAAK,SACH,KAAK,WAAW,YAAY,KAAK,WAAW,gBAAgB,KAAK,SAAS;AAC5E,QAAI,KAAK,MAAO,MAAK,QAAQ,KAAK,MAAM,MAAM,GAAG,IAAI;AAAA,EACvD;AACF;AAEO,SAAS,eAAe,MAAgB,QAAgB,OAAyB;AACtF,MAAI,UAAU;AACd,aAAW,QAAQ,KAAK,OAAO;AAC7B,QAAI,KAAK,SAAS,uBAAuB,KAAK,WAAW,aAAc;AACvE,SAAK,SAAS;AACd,QAAI,MAAO,MAAK,QAAQ,MAAM,MAAM,GAAG,IAAI;AAC3C,cAAU;AAAA,EACZ;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|