@rzx/ohs 1.1.16 → 1.1.17

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 (28) hide show
  1. package/dist/frontend/index.js +1968 -1297
  2. package/dist/frontend/index.js.map +45 -19
  3. package/dist/index.js +40420 -33343
  4. package/dist/index.js.map +194 -132
  5. package/dist/migrations/0000_current_schema.sql +436 -0
  6. package/dist/migrations/meta/0000_snapshot.json +3442 -0
  7. package/dist/migrations/meta/_journal.json +3 -136
  8. package/package.json +12 -12
  9. package/dist/migrations/0000_session_runtime.sql +0 -68
  10. package/dist/migrations/0001_event_sequence.sql +0 -8
  11. package/dist/migrations/0002_cron.sql +0 -33
  12. package/dist/migrations/0003_projects.sql +0 -30
  13. package/dist/migrations/0004_project_default_shell.sql +0 -1
  14. package/dist/migrations/0005_scheduled_tasks.sql +0 -57
  15. package/dist/migrations/0006_event_schema_version.sql +0 -1
  16. package/dist/migrations/0007_projection_settlement.sql +0 -19
  17. package/dist/migrations/0008_run_attempt.sql +0 -23
  18. package/dist/migrations/0009_external_channels.sql +0 -45
  19. package/dist/migrations/0010_workflow_and_owner.sql +0 -68
  20. package/dist/migrations/0011_storage_format.sql +0 -6
  21. package/dist/migrations/0012_job_admission.sql +0 -6
  22. package/dist/migrations/0013_attachments.sql +0 -20
  23. package/dist/migrations/0014_session_input_attachments.sql +0 -45
  24. package/dist/migrations/0015_attachment_representations.sql +0 -22
  25. package/dist/migrations/0016_attachment_lifecycle.sql +0 -16
  26. package/dist/migrations/0017_structured_input_items.sql +0 -1
  27. package/dist/migrations/0018_session_goals.sql +0 -17
  28. package/dist/migrations/0019_session_goal_progress.sql +0 -3
@@ -0,0 +1,436 @@
1
+ CREATE TABLE `application_owner` (
2
+ `key` text PRIMARY KEY NOT NULL,
3
+ `owner_id` text NOT NULL,
4
+ `pid` integer NOT NULL,
5
+ `generation` integer NOT NULL,
6
+ `started_at` integer NOT NULL,
7
+ `heartbeat_at` integer NOT NULL
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE TABLE `application_storage_format` (
11
+ `id` integer PRIMARY KEY NOT NULL CHECK (`id` = 1),
12
+ `version` integer NOT NULL
13
+ );
14
+ --> statement-breakpoint
15
+ CREATE TABLE `attachment_asset` (
16
+ `id` text PRIMARY KEY NOT NULL,
17
+ `display_name` text NOT NULL,
18
+ `declared_media_type` text,
19
+ `media_type` text,
20
+ `size_bytes` integer,
21
+ `sha256` text,
22
+ `status` text NOT NULL,
23
+ `staging_name` text,
24
+ `failure_code` text,
25
+ `created_at` integer NOT NULL,
26
+ `updated_at` integer NOT NULL,
27
+ `deleted_at` integer
28
+ );
29
+ --> statement-breakpoint
30
+ CREATE TABLE `attachment_lease` (
31
+ `id` text PRIMARY KEY NOT NULL,
32
+ `asset_id` text NOT NULL,
33
+ `owner_kind` text NOT NULL,
34
+ `owner_id` text NOT NULL,
35
+ `created_at` integer NOT NULL,
36
+ `renewed_at` integer NOT NULL,
37
+ `expires_at` integer NOT NULL,
38
+ FOREIGN KEY (`asset_id`) REFERENCES `attachment_asset`(`id`) ON UPDATE no action ON DELETE cascade
39
+ );
40
+ --> statement-breakpoint
41
+ CREATE TABLE `attachment_representation` (
42
+ `id` text PRIMARY KEY NOT NULL,
43
+ `asset_id` text NOT NULL,
44
+ `kind` text NOT NULL,
45
+ `status` text NOT NULL,
46
+ `processor` text NOT NULL,
47
+ `processor_version` text NOT NULL,
48
+ `cache_key` text NOT NULL,
49
+ `media_type` text NOT NULL,
50
+ `text` text,
51
+ `error` text,
52
+ `metadata_json` text NOT NULL,
53
+ `created_at` integer NOT NULL,
54
+ `updated_at` integer NOT NULL,
55
+ FOREIGN KEY (`asset_id`) REFERENCES `attachment_asset`(`id`) ON UPDATE no action ON DELETE cascade
56
+ );
57
+ --> statement-breakpoint
58
+ CREATE TABLE `channel_delivery` (
59
+ `id` text PRIMARY KEY NOT NULL,
60
+ `conversation_id` text NOT NULL,
61
+ `connector` text NOT NULL,
62
+ `account_id` text NOT NULL,
63
+ `chat_id` text NOT NULL,
64
+ `thread_id` text NOT NULL DEFAULT '',
65
+ `session_id` text NOT NULL,
66
+ `input_id` text NOT NULL,
67
+ `run_id` text NOT NULL,
68
+ `external_message_id` text NOT NULL,
69
+ `content` text NOT NULL,
70
+ `status` text NOT NULL,
71
+ `attempt_count` integer NOT NULL DEFAULT 0,
72
+ `external_delivery_id` text,
73
+ `error` text,
74
+ `created_at` integer NOT NULL,
75
+ `updated_at` integer NOT NULL,
76
+ `sent_at` integer,
77
+ FOREIGN KEY (`conversation_id`) REFERENCES `external_conversation`(`id`) ON UPDATE no action ON DELETE cascade,
78
+ FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON UPDATE no action ON DELETE cascade,
79
+ FOREIGN KEY (`input_id`) REFERENCES `session_input`(`id`) ON UPDATE no action ON DELETE cascade,
80
+ FOREIGN KEY (`run_id`) REFERENCES `session_run`(`id`) ON UPDATE no action ON DELETE cascade
81
+ );
82
+ --> statement-breakpoint
83
+ CREATE TABLE `external_conversation` (
84
+ `id` text PRIMARY KEY NOT NULL,
85
+ `connector` text NOT NULL,
86
+ `account_id` text NOT NULL,
87
+ `workspace_id` text,
88
+ `chat_id` text NOT NULL,
89
+ `thread_id` text NOT NULL DEFAULT '',
90
+ `session_id` text NOT NULL,
91
+ `created_at` integer NOT NULL,
92
+ `updated_at` integer NOT NULL,
93
+ FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON UPDATE no action ON DELETE cascade
94
+ );
95
+ --> statement-breakpoint
96
+ CREATE TABLE permission_request (
97
+ id TEXT PRIMARY KEY, session_id TEXT NOT NULL, run_id TEXT, tool_name TEXT NOT NULL,
98
+ payload_json TEXT NOT NULL, status TEXT NOT NULL, decision TEXT, decided_by_client_id TEXT,
99
+ created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL
100
+ );
101
+ --> statement-breakpoint
102
+ CREATE TABLE `project` (
103
+ `id` text PRIMARY KEY NOT NULL,
104
+ `name` text NOT NULL,
105
+ `pinned_at` integer,
106
+ `last_opened_at` integer NOT NULL,
107
+ `archived_at` integer,
108
+ `created_at` integer NOT NULL,
109
+ `updated_at` integer NOT NULL
110
+ , `default_shell` text);
111
+ --> statement-breakpoint
112
+ CREATE TABLE `project_location` (
113
+ `id` text PRIMARY KEY NOT NULL,
114
+ `project_id` text NOT NULL,
115
+ `path` text NOT NULL,
116
+ `normalized_path` text NOT NULL,
117
+ `status` text NOT NULL,
118
+ `bound_at` integer NOT NULL,
119
+ `last_verified_at` integer,
120
+ FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade
121
+ );
122
+ --> statement-breakpoint
123
+ CREATE TABLE `projection_settlement` (
124
+ `id` text PRIMARY KEY NOT NULL,
125
+ `projector` text NOT NULL,
126
+ `root_session_id` text NOT NULL,
127
+ `event_sequence` integer NOT NULL,
128
+ `action` text NOT NULL,
129
+ `payload_json` text NOT NULL,
130
+ `status` text NOT NULL,
131
+ `attempt_count` integer DEFAULT 0 NOT NULL,
132
+ `last_error` text,
133
+ `next_retry_at` integer,
134
+ `created_at` integer NOT NULL,
135
+ `updated_at` integer NOT NULL,
136
+ `resolved_at` integer
137
+ );
138
+ --> statement-breakpoint
139
+ CREATE TABLE `retention_audit` (
140
+ `id` text PRIMARY KEY NOT NULL,
141
+ `policy` text NOT NULL,
142
+ `result_json` text NOT NULL,
143
+ `created_at` integer NOT NULL
144
+ );
145
+ --> statement-breakpoint
146
+ CREATE TABLE `scheduled_run` (
147
+ `id` text PRIMARY KEY NOT NULL,
148
+ `task_id` text NOT NULL,
149
+ `cause` text NOT NULL,
150
+ `status` text NOT NULL,
151
+ `scheduled_for` integer NOT NULL,
152
+ `session_id` text,
153
+ `run_id` text,
154
+ `summary` text,
155
+ `error` text,
156
+ `unread` integer NOT NULL,
157
+ `attention_reason` text,
158
+ `created_at` integer NOT NULL,
159
+ `started_at` integer,
160
+ `finished_at` integer,
161
+ `updated_at` integer NOT NULL
162
+ );
163
+ --> statement-breakpoint
164
+ CREATE TABLE `scheduled_task` (
165
+ `id` text PRIMARY KEY NOT NULL,
166
+ `name` text NOT NULL,
167
+ `description` text,
168
+ `prompt` text NOT NULL,
169
+ `recurrence` text NOT NULL,
170
+ `recurrence_format` text NOT NULL,
171
+ `timezone` text NOT NULL,
172
+ `status` text NOT NULL,
173
+ `destination` text NOT NULL,
174
+ `session_id` text,
175
+ `project_paths_json` text NOT NULL,
176
+ `execution_mode` text NOT NULL,
177
+ `model` text,
178
+ `effort` text,
179
+ `skill_names_json` text NOT NULL,
180
+ `plugin_names_json` text NOT NULL,
181
+ `permission_profile_json` text NOT NULL,
182
+ `overlap_policy` text NOT NULL,
183
+ `missed_run_policy` text NOT NULL,
184
+ `stop_policy_json` text,
185
+ `created_by` text NOT NULL,
186
+ `created_from_session_id` text,
187
+ `last_run_at` integer,
188
+ `next_run_at` integer,
189
+ `run_count` integer NOT NULL,
190
+ `created_at` integer NOT NULL,
191
+ `updated_at` integer NOT NULL
192
+ );
193
+ --> statement-breakpoint
194
+ CREATE TABLE session (
195
+ id TEXT PRIMARY KEY, parent_id TEXT, cwd TEXT NOT NULL, title TEXT NOT NULL,
196
+ model TEXT NOT NULL, agent TEXT, status TEXT NOT NULL, metadata_json TEXT NOT NULL,
197
+ created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL, archived_at INTEGER
198
+ , `project_id` text REFERENCES project(id), `cwd_relative` text);
199
+ --> statement-breakpoint
200
+ CREATE TABLE session_event (
201
+ id TEXT PRIMARY KEY, seq INTEGER NOT NULL UNIQUE, type TEXT NOT NULL, session_id TEXT,
202
+ payload_json TEXT NOT NULL, created_at INTEGER NOT NULL
203
+ , `schema_version` integer DEFAULT 1 NOT NULL);
204
+ --> statement-breakpoint
205
+ CREATE TABLE session_event_sequence (
206
+ id INTEGER PRIMARY KEY CHECK (id = 1),
207
+ reserved_through INTEGER NOT NULL
208
+ );
209
+ --> statement-breakpoint
210
+ CREATE TABLE `session_goal` (`id` text PRIMARY KEY NOT NULL, `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE cascade, `objective` text NOT NULL, `revision` integer NOT NULL, `status` text NOT NULL, `max_auto_turns` integer NOT NULL, `auto_turns_used` integer NOT NULL, `no_progress_count` integer NOT NULL, `current_run_id` text, `reason` text, `wait_json` text, `evidence_json` text NOT NULL, `created_at` integer NOT NULL, `updated_at` integer NOT NULL, `blocker_key` text, `last_assessment_json` text, `plugin_id` text);
211
+ --> statement-breakpoint
212
+ CREATE TABLE `session_goal_assessment` (`id` text PRIMARY KEY NOT NULL, `goal_id` text NOT NULL REFERENCES `session_goal`(`id`) ON DELETE cascade, `revision` integer NOT NULL, `run_id` text NOT NULL, `assessment_json` text NOT NULL, `created_at` integer NOT NULL);
213
+ --> statement-breakpoint
214
+ CREATE TABLE `session_goal_continuation` (`id` text PRIMARY KEY NOT NULL, `goal_id` text NOT NULL REFERENCES `session_goal`(`id`) ON DELETE cascade, `revision` integer NOT NULL, `previous_run_id` text NOT NULL, `input_id` text, `run_id` text, `status` text NOT NULL, `created_at` integer NOT NULL, `updated_at` integer NOT NULL);
215
+ --> statement-breakpoint
216
+ CREATE TABLE `session_goal_request` (`request_id` text PRIMARY KEY NOT NULL, `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE cascade, `fingerprint` text NOT NULL, `status` text NOT NULL, `goal_id` text, `result_json` text, `error` text, `created_at` integer NOT NULL, `updated_at` integer NOT NULL);
217
+ --> statement-breakpoint
218
+ CREATE TABLE session_input (
219
+ id TEXT PRIMARY KEY, session_id TEXT NOT NULL, seq INTEGER NOT NULL, delivery TEXT NOT NULL,
220
+ content TEXT NOT NULL, metadata_json TEXT NOT NULL, created_at INTEGER NOT NULL, `items_json` text NOT NULL,
221
+ UNIQUE(session_id, seq)
222
+ );
223
+ --> statement-breakpoint
224
+ CREATE TABLE `session_input_attachment` (
225
+ `id` text PRIMARY KEY NOT NULL,
226
+ `session_id` text NOT NULL,
227
+ `input_id` text NOT NULL,
228
+ `asset_id` text NOT NULL,
229
+ `seq` integer NOT NULL,
230
+ `intent` text NOT NULL,
231
+ `display_name` text NOT NULL,
232
+ `media_type` text NOT NULL,
233
+ `size_bytes` integer NOT NULL,
234
+ `metadata_json` text NOT NULL,
235
+ `created_at` integer NOT NULL,
236
+ FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON UPDATE no action ON DELETE cascade,
237
+ FOREIGN KEY (`input_id`) REFERENCES `session_input`(`id`) ON UPDATE no action ON DELETE cascade,
238
+ FOREIGN KEY (`asset_id`) REFERENCES `attachment_asset`(`id`) ON UPDATE no action ON DELETE restrict,
239
+ CONSTRAINT `session_input_attachment_input_seq_unique` UNIQUE(`input_id`, `seq`),
240
+ CONSTRAINT `session_input_attachment_input_asset_unique` UNIQUE(`input_id`, `asset_id`)
241
+ );
242
+ --> statement-breakpoint
243
+ CREATE TABLE session_message (
244
+ id TEXT PRIMARY KEY, session_id TEXT NOT NULL, seq INTEGER NOT NULL, role TEXT NOT NULL,
245
+ run_id TEXT, input_id TEXT, metadata_json TEXT NOT NULL, created_at INTEGER NOT NULL,
246
+ updated_at INTEGER NOT NULL, UNIQUE(session_id, seq)
247
+ );
248
+ --> statement-breakpoint
249
+ CREATE TABLE session_message_part (
250
+ id TEXT PRIMARY KEY, session_id TEXT NOT NULL, message_id TEXT NOT NULL, seq INTEGER NOT NULL,
251
+ type TEXT NOT NULL, status TEXT NOT NULL, text TEXT, tool_use_id TEXT, tool_name TEXT,
252
+ input_json TEXT, output_json TEXT, is_error INTEGER, metadata_json TEXT NOT NULL,
253
+ created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL, `asset_id` text, `attachment_intent` text, `display_name` text, `media_type` text, `size_bytes` integer, `transformation_kind` text, `representation_id` text, `processor` text, `transformation_error` text, UNIQUE(session_id, seq)
254
+ );
255
+ --> statement-breakpoint
256
+ CREATE TABLE session_run (
257
+ id TEXT PRIMARY KEY, session_id TEXT NOT NULL, input_id TEXT, status TEXT NOT NULL,
258
+ started_at INTEGER, finished_at INTEGER, error TEXT, metadata_json TEXT NOT NULL,
259
+ created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL
260
+ );
261
+ --> statement-breakpoint
262
+ CREATE TABLE `session_run_attempt` (
263
+ `id` text PRIMARY KEY NOT NULL,
264
+ `run_id` text NOT NULL,
265
+ `sequence` integer NOT NULL,
266
+ `status` text NOT NULL,
267
+ `provider` text,
268
+ `model` text,
269
+ `retry_reason` text,
270
+ `error_kind` text,
271
+ `error` text,
272
+ `input_tokens` integer,
273
+ `output_tokens` integer,
274
+ `started_at` integer,
275
+ `finished_at` integer,
276
+ `created_at` integer NOT NULL,
277
+ `updated_at` integer NOT NULL
278
+ );
279
+ --> statement-breakpoint
280
+ CREATE TABLE session_task (
281
+ id TEXT PRIMARY KEY, session_id TEXT NOT NULL, child_session_id TEXT, run_id TEXT,
282
+ type TEXT NOT NULL, status TEXT NOT NULL, description TEXT NOT NULL, cwd TEXT NOT NULL,
283
+ output TEXT, error TEXT, metadata_json TEXT NOT NULL, created_at INTEGER NOT NULL,
284
+ started_at INTEGER, finished_at INTEGER, updated_at INTEGER NOT NULL
285
+ , `request_namespace` text, `request_id` text);
286
+ --> statement-breakpoint
287
+ CREATE TABLE `workflow_event` (
288
+ `seq` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
289
+ `workflow_run_id` text NOT NULL,
290
+ `type` text NOT NULL,
291
+ `event_json` text NOT NULL,
292
+ `created_at` integer NOT NULL,
293
+ FOREIGN KEY (`workflow_run_id`) REFERENCES `workflow_run`(`run_id`) ON UPDATE no action ON DELETE cascade
294
+ );
295
+ --> statement-breakpoint
296
+ CREATE TABLE `workflow_execution_claim` (
297
+ `workflow_run_id` text PRIMARY KEY NOT NULL,
298
+ `owner_id` text NOT NULL,
299
+ `generation` integer NOT NULL,
300
+ `claimed_at` integer NOT NULL,
301
+ `heartbeat_at` integer NOT NULL,
302
+ `finished_at` integer,
303
+ `status` text NOT NULL,
304
+ FOREIGN KEY (`workflow_run_id`) REFERENCES `workflow_run`(`run_id`) ON UPDATE no action ON DELETE cascade
305
+ );
306
+ --> statement-breakpoint
307
+ CREATE TABLE `workflow_run` (
308
+ `run_id` text PRIMARY KEY NOT NULL,
309
+ `owner_session_id` text,
310
+ `owner_input_id` text,
311
+ `owner_run_id` text,
312
+ `status` text NOT NULL,
313
+ `termination` text,
314
+ `snapshot_json` text NOT NULL,
315
+ `created_at` integer NOT NULL,
316
+ `updated_at` integer NOT NULL,
317
+ FOREIGN KEY (`owner_session_id`) REFERENCES `session`(`id`) ON UPDATE no action ON DELETE set null,
318
+ FOREIGN KEY (`owner_input_id`) REFERENCES `session_input`(`id`) ON UPDATE no action ON DELETE set null,
319
+ FOREIGN KEY (`owner_run_id`) REFERENCES `session_run`(`id`) ON UPDATE no action ON DELETE set null
320
+ );
321
+ --> statement-breakpoint
322
+ CREATE TABLE `workflow_task_attempt` (
323
+ `workflow_run_id` text NOT NULL,
324
+ `task_id` text NOT NULL,
325
+ `attempt` integer NOT NULL,
326
+ `status` text NOT NULL,
327
+ `payload_json` text NOT NULL,
328
+ `started_at` integer NOT NULL,
329
+ `finished_at` integer,
330
+ PRIMARY KEY (`workflow_run_id`,`task_id`,`attempt`),
331
+ FOREIGN KEY (`workflow_run_id`) REFERENCES `workflow_run`(`run_id`) ON UPDATE no action ON DELETE cascade
332
+ );
333
+ --> statement-breakpoint
334
+ CREATE INDEX `attachment_asset_hash_status_idx`
335
+ ON `attachment_asset` (`sha256`, `status`);
336
+ --> statement-breakpoint
337
+ CREATE INDEX `attachment_asset_status_updated_idx`
338
+ ON `attachment_asset` (`status`, `updated_at`);
339
+ --> statement-breakpoint
340
+ CREATE UNIQUE INDEX `attachment_lease_asset_owner_unique`
341
+ ON `attachment_lease` (`asset_id`, `owner_kind`, `owner_id`);
342
+ --> statement-breakpoint
343
+ CREATE INDEX `attachment_lease_expiry_idx`
344
+ ON `attachment_lease` (`expires_at`, `asset_id`);
345
+ --> statement-breakpoint
346
+ CREATE INDEX `attachment_representation_asset_idx`
347
+ ON `attachment_representation` (`asset_id`, `created_at`);
348
+ --> statement-breakpoint
349
+ CREATE UNIQUE INDEX `attachment_representation_asset_kind_cache_unique`
350
+ ON `attachment_representation` (`asset_id`, `kind`, `cache_key`);
351
+ --> statement-breakpoint
352
+ CREATE UNIQUE INDEX `channel_delivery_input_unique` ON `channel_delivery` (`input_id`);
353
+ --> statement-breakpoint
354
+ CREATE INDEX `channel_delivery_status_idx` ON `channel_delivery` (`status`,`updated_at`);
355
+ --> statement-breakpoint
356
+ CREATE UNIQUE INDEX `external_conversation_identity_unique` ON `external_conversation` (`connector`,`account_id`,`chat_id`,`thread_id`);
357
+ --> statement-breakpoint
358
+ CREATE INDEX `external_conversation_session_idx` ON `external_conversation` (`session_id`);
359
+ --> statement-breakpoint
360
+ CREATE INDEX permission_session_status_idx ON permission_request(session_id, status);
361
+ --> statement-breakpoint
362
+ CREATE UNIQUE INDEX `project_location_active_path` ON `project_location` (`normalized_path`) WHERE `status` = 'active';
363
+ --> statement-breakpoint
364
+ CREATE UNIQUE INDEX `project_location_active_project` ON `project_location` (`project_id`) WHERE `status` = 'active';
365
+ --> statement-breakpoint
366
+ CREATE INDEX `project_location_project_idx` ON `project_location` (`project_id`, `status`);
367
+ --> statement-breakpoint
368
+ CREATE UNIQUE INDEX `projection_settlement_event_idx` ON `projection_settlement` (`projector`,`root_session_id`,`event_sequence`);
369
+ --> statement-breakpoint
370
+ CREATE INDEX `projection_settlement_status_retry_idx` ON `projection_settlement` (`status`,`next_retry_at`);
371
+ --> statement-breakpoint
372
+ CREATE INDEX `scheduled_run_status_idx` ON `scheduled_run` (`status`);
373
+ --> statement-breakpoint
374
+ CREATE INDEX `scheduled_run_task_created_idx` ON `scheduled_run` (`task_id`,`created_at`);
375
+ --> statement-breakpoint
376
+ CREATE INDEX `scheduled_run_unread_idx` ON `scheduled_run` (`unread`,`created_at`);
377
+ --> statement-breakpoint
378
+ CREATE INDEX `scheduled_task_session_idx` ON `scheduled_task` (`session_id`);
379
+ --> statement-breakpoint
380
+ CREATE INDEX `scheduled_task_status_next_idx` ON `scheduled_task` (`status`,`next_run_at`);
381
+ --> statement-breakpoint
382
+ CREATE INDEX session_cwd_updated_idx ON session(cwd, updated_at);
383
+ --> statement-breakpoint
384
+ CREATE INDEX session_event_session_seq_idx ON session_event(session_id, seq);
385
+ --> statement-breakpoint
386
+ CREATE UNIQUE INDEX `session_goal_assessment_run_unique` ON `session_goal_assessment` (`goal_id`,`revision`,`run_id`);
387
+ --> statement-breakpoint
388
+ CREATE UNIQUE INDEX `session_goal_continuation_previous_unique` ON `session_goal_continuation` (`goal_id`,`revision`,`previous_run_id`);
389
+ --> statement-breakpoint
390
+ CREATE INDEX `session_goal_request_session_idx` ON `session_goal_request` (`session_id`,`updated_at`);
391
+ --> statement-breakpoint
392
+ CREATE UNIQUE INDEX `session_goal_session_open_unique` ON `session_goal` (`session_id`) WHERE `status` IN ('active','waiting_user','blocked','paused');
393
+ --> statement-breakpoint
394
+ CREATE INDEX `session_goal_session_updated_idx` ON `session_goal` (`session_id`,`updated_at`);
395
+ --> statement-breakpoint
396
+ CREATE INDEX `session_input_attachment_asset_idx`
397
+ ON `session_input_attachment` (`asset_id`);
398
+ --> statement-breakpoint
399
+ CREATE INDEX `session_input_attachment_input_seq_idx`
400
+ ON `session_input_attachment` (`input_id`, `seq`);
401
+ --> statement-breakpoint
402
+ CREATE INDEX `session_input_attachment_session_idx`
403
+ ON `session_input_attachment` (`session_id`);
404
+ --> statement-breakpoint
405
+ CREATE INDEX session_input_session_idx ON session_input(session_id);
406
+ --> statement-breakpoint
407
+ CREATE INDEX session_message_session_idx ON session_message(session_id);
408
+ --> statement-breakpoint
409
+ CREATE INDEX session_parent_idx ON session(parent_id);
410
+ --> statement-breakpoint
411
+ CREATE INDEX session_part_message_idx ON session_message_part(message_id);
412
+ --> statement-breakpoint
413
+ CREATE INDEX `session_run_attempt_run_idx` ON `session_run_attempt` (`run_id`);
414
+ --> statement-breakpoint
415
+ CREATE UNIQUE INDEX `session_run_attempt_run_sequence_unique` ON `session_run_attempt` (`run_id`,`sequence`);
416
+ --> statement-breakpoint
417
+ CREATE INDEX `session_run_attempt_status_idx` ON `session_run_attempt` (`status`);
418
+ --> statement-breakpoint
419
+ CREATE INDEX session_run_input_idx ON session_run(input_id);
420
+ --> statement-breakpoint
421
+ CREATE INDEX session_run_session_idx ON session_run(session_id, created_at);
422
+ --> statement-breakpoint
423
+ CREATE UNIQUE INDEX `session_task_request_identity_idx`
424
+ ON `session_task` (`session_id`, `request_namespace`, `request_id`);
425
+ --> statement-breakpoint
426
+ CREATE INDEX session_task_session_idx ON session_task(session_id, created_at);
427
+ --> statement-breakpoint
428
+ CREATE INDEX `workflow_event_run_seq_idx` ON `workflow_event` (`workflow_run_id`,`seq`);
429
+ --> statement-breakpoint
430
+ CREATE INDEX `workflow_run_owner_idx` ON `workflow_run` (`owner_session_id`,`updated_at`);
431
+ --> statement-breakpoint
432
+ CREATE INDEX `workflow_run_status_idx` ON `workflow_run` (`status`,`updated_at`);
433
+ --> statement-breakpoint
434
+ INSERT INTO application_storage_format (id, version) VALUES (1, 2);
435
+ --> statement-breakpoint
436
+ INSERT INTO session_event_sequence (id, reserved_through) VALUES (1, 0);