larness 0.5.1 → 0.6.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 (63) hide show
  1. package/apps/server/dist/{managed-Cw3MVilO.js → address-DpgJ0siq.js} +317 -183
  2. package/apps/server/dist/{args-CrKTPT06.js → args-BdJc1CBU.js} +29 -22
  3. package/apps/server/dist/cli.js +28 -7
  4. package/apps/server/dist/client-CBpatu1B.js +28 -0
  5. package/apps/server/dist/{client-D_Ni3Zpx.js → client-CoxHAiNW.js} +1 -1
  6. package/apps/server/dist/doctor-CGNZt_v3.js +1 -0
  7. package/apps/server/dist/{doctor-CE6cONuz.js → doctor-rpwPrkoS.js} +4 -3
  8. package/apps/server/dist/doctor.js +1 -1
  9. package/apps/server/dist/index.js +1402 -497
  10. package/apps/server/dist/{inspect-XgAc84F9.js → inspect-DUe_-Yma.js} +89 -1
  11. package/apps/server/dist/{lifecycle-C3KV3-Ax.js → lifecycle-Ck4LRKft.js} +7 -4
  12. package/apps/server/dist/managed-CpNf_iJZ.js +191 -0
  13. package/apps/server/dist/status-B6kiOT0f.js +94 -0
  14. package/apps/server/dist/status-C0hriYPD.js +681 -0
  15. package/apps/server/dist/status.js +1 -58
  16. package/apps/server/dist/{supervisor-IYDKL4iU.js → supervisor-BvHyiN7Z.js} +3 -2
  17. package/apps/server/dist/tui.js +5 -5
  18. package/apps/server/dist/unlock-hrRXYx4L.js +87 -0
  19. package/apps/server/drizzle/0001_auth.sql +109 -109
  20. package/apps/server/drizzle/0002_projects.sql +12 -12
  21. package/apps/server/drizzle/0003_workspace.sql +80 -80
  22. package/apps/server/drizzle/0004_models.sql +30 -30
  23. package/apps/server/drizzle/0005_resources.sql +54 -54
  24. package/apps/server/drizzle/0006_commands.sql +23 -23
  25. package/apps/server/drizzle/0007_terminals.sql +41 -41
  26. package/apps/server/drizzle/0008_resource_actions.sql +23 -23
  27. package/apps/server/drizzle/0010_services.sql +31 -31
  28. package/apps/server/drizzle/0039_user_input_requests.sql +20 -0
  29. package/apps/server/drizzle/meta/0039_snapshot.json +5907 -0
  30. package/apps/server/drizzle/meta/_journal.json +7 -0
  31. package/apps/web/dist/assets/{FileEditor-DnQa6Owc.js → FileEditor-Cm9Wkyig.js} +1 -1
  32. package/apps/web/dist/assets/{FileViewer-DKlF-CWF.js → FileViewer-CZH6oX37.js} +1 -1
  33. package/apps/web/dist/assets/{cssMode-C9KmpsHc.js → cssMode-CAew8VW7.js} +1 -1
  34. package/apps/web/dist/assets/{editor.api-BwfHyHQ6.js → editor.api-CzAuy9rK.js} +1 -1
  35. package/apps/web/dist/assets/{freemarker2-D41RlIQ5.js → freemarker2-BucrIW4m.js} +1 -1
  36. package/apps/web/dist/assets/{handlebars-D-7R6ic0.js → handlebars-PSDIVzvE.js} +1 -1
  37. package/apps/web/dist/assets/{html-CUME4rt-.js → html-BAsmazci.js} +1 -1
  38. package/apps/web/dist/assets/{htmlMode-8w7WLhnL.js → htmlMode-Dc7T3d51.js} +1 -1
  39. package/apps/web/dist/assets/{index-BOS3UrP1.js → index-BzvuZhoD.js} +2 -2
  40. package/apps/web/dist/assets/{javascript-_3pdDG34.js → javascript-BOV99GQZ.js} +1 -1
  41. package/apps/web/dist/assets/{jsonMode-DiqocFCf.js → jsonMode-NusHHC7o.js} +1 -1
  42. package/apps/web/dist/assets/{liquid-j0FoiTXN.js → liquid-CNm5kTmC.js} +1 -1
  43. package/apps/web/dist/assets/{lspLanguageFeatures-Zj7K2sG4.js → lspLanguageFeatures-Cqpje4pY.js} +1 -1
  44. package/apps/web/dist/assets/main-ACTS2h7h.js +157 -0
  45. package/apps/web/dist/assets/main-DLLJi8c-.css +1 -0
  46. package/apps/web/dist/assets/{mdx-CGQ8Cw6J.js → mdx-CiTFZ2Bw.js} +1 -1
  47. package/apps/web/dist/assets/{monaco-CyMA3azg.js → monaco-A0m6b37p.js} +3 -3
  48. package/apps/web/dist/assets/{python-BtY34Z9A.js → python-CB1KNVKd.js} +1 -1
  49. package/apps/web/dist/assets/{razor-CzYHpLv5.js → razor-CWXh8JSQ.js} +1 -1
  50. package/apps/web/dist/assets/{tsMode-GZx3VEv9.js → tsMode-DML0dqzP.js} +1 -1
  51. package/apps/web/dist/assets/{typescript-CAfvuTDQ.js → typescript-BVEQXq27.js} +1 -1
  52. package/apps/web/dist/assets/{workers-C5BOxOmH.js → workers-DOOC_w8B.js} +1 -1
  53. package/apps/web/dist/assets/{xml-BGX4mtH7.js → xml-kLrSHWW0.js} +1 -1
  54. package/apps/web/dist/assets/{yaml-B2AgBtJB.js → yaml-CclA2znJ.js} +1 -1
  55. package/apps/web/dist/favicon.svg +4 -4
  56. package/apps/web/dist/index.html +1 -1
  57. package/docs/guides/install.md +3 -0
  58. package/package.json +1 -1
  59. package/apps/server/dist/address-D0ZG5qR4.js +0 -97
  60. package/apps/server/dist/doctor-sPRlI92N.js +0 -1
  61. package/apps/server/dist/status-CV_zWfs6.js +0 -62
  62. package/apps/web/dist/assets/main-DZIruO5x.js +0 -157
  63. package/apps/web/dist/assets/main-gq3n_vn8.css +0 -1
@@ -1,54 +1,54 @@
1
- CREATE TABLE `file_versions` (
2
- `scope_key` text NOT NULL,
3
- `path` text NOT NULL,
4
- `real_path` text NOT NULL,
5
- `version_hash` text NOT NULL,
6
- `size` integer NOT NULL,
7
- `mtime` integer NOT NULL,
8
- `updated_at` integer NOT NULL
9
- );
10
- --> statement-breakpoint
11
- CREATE UNIQUE INDEX `file_versions_scope_path` ON `file_versions` (`scope_key`,`path`);--> statement-breakpoint
12
- CREATE TABLE `resource_events` (
13
- `id` text PRIMARY KEY NOT NULL,
14
- `stream_id` text NOT NULL,
15
- `seq` integer NOT NULL,
16
- `type` text NOT NULL,
17
- `payload_json` text NOT NULL,
18
- `created_at` integer NOT NULL,
19
- FOREIGN KEY (`stream_id`) REFERENCES `resource_streams`(`stream_id`) ON UPDATE no action ON DELETE no action
20
- );
21
- --> statement-breakpoint
22
- CREATE UNIQUE INDEX `resource_events_stream_seq` ON `resource_events` (`stream_id`,`seq`);--> statement-breakpoint
23
- CREATE TABLE `resource_operations` (
24
- `id` text PRIMARY KEY NOT NULL,
25
- `scope_key` text NOT NULL,
26
- `root_real_path` text NOT NULL,
27
- `kind` text NOT NULL,
28
- `status` text NOT NULL,
29
- `params_hash` text NOT NULL,
30
- `idempotency_key` text NOT NULL,
31
- `client_session_id` text NOT NULL,
32
- `path` text NOT NULL,
33
- `expected_version` text NOT NULL,
34
- `target_version` text NOT NULL,
35
- `lock_id` text NOT NULL,
36
- `fencing_token` integer NOT NULL,
37
- `result_json` text,
38
- `error_code` text,
39
- `created_at` integer NOT NULL,
40
- `updated_at` integer NOT NULL
41
- );
42
- --> statement-breakpoint
43
- CREATE UNIQUE INDEX `resource_operations_client_kind_key` ON `resource_operations` (`client_session_id`,`kind`,`idempotency_key`);--> statement-breakpoint
44
- CREATE INDEX `resource_operations_status` ON `resource_operations` (`status`);--> statement-breakpoint
45
- CREATE TABLE `resource_streams` (
46
- `stream_id` text PRIMARY KEY NOT NULL,
47
- `last_seq` integer DEFAULT 0 NOT NULL
48
- );
49
- --> statement-breakpoint
50
- ALTER TABLE `resource_locks` ADD `root_real_path` text;
51
- --> statement-breakpoint
52
- UPDATE `resource_locks` SET `root_real_path` = (
53
- SELECT `real_path` FROM `projects` WHERE `projects`.`id` = `resource_locks`.`resource_id`
54
- ) WHERE `resource_type` = 'project';
1
+ CREATE TABLE `file_versions` (
2
+ `scope_key` text NOT NULL,
3
+ `path` text NOT NULL,
4
+ `real_path` text NOT NULL,
5
+ `version_hash` text NOT NULL,
6
+ `size` integer NOT NULL,
7
+ `mtime` integer NOT NULL,
8
+ `updated_at` integer NOT NULL
9
+ );
10
+ --> statement-breakpoint
11
+ CREATE UNIQUE INDEX `file_versions_scope_path` ON `file_versions` (`scope_key`,`path`);--> statement-breakpoint
12
+ CREATE TABLE `resource_events` (
13
+ `id` text PRIMARY KEY NOT NULL,
14
+ `stream_id` text NOT NULL,
15
+ `seq` integer NOT NULL,
16
+ `type` text NOT NULL,
17
+ `payload_json` text NOT NULL,
18
+ `created_at` integer NOT NULL,
19
+ FOREIGN KEY (`stream_id`) REFERENCES `resource_streams`(`stream_id`) ON UPDATE no action ON DELETE no action
20
+ );
21
+ --> statement-breakpoint
22
+ CREATE UNIQUE INDEX `resource_events_stream_seq` ON `resource_events` (`stream_id`,`seq`);--> statement-breakpoint
23
+ CREATE TABLE `resource_operations` (
24
+ `id` text PRIMARY KEY NOT NULL,
25
+ `scope_key` text NOT NULL,
26
+ `root_real_path` text NOT NULL,
27
+ `kind` text NOT NULL,
28
+ `status` text NOT NULL,
29
+ `params_hash` text NOT NULL,
30
+ `idempotency_key` text NOT NULL,
31
+ `client_session_id` text NOT NULL,
32
+ `path` text NOT NULL,
33
+ `expected_version` text NOT NULL,
34
+ `target_version` text NOT NULL,
35
+ `lock_id` text NOT NULL,
36
+ `fencing_token` integer NOT NULL,
37
+ `result_json` text,
38
+ `error_code` text,
39
+ `created_at` integer NOT NULL,
40
+ `updated_at` integer NOT NULL
41
+ );
42
+ --> statement-breakpoint
43
+ CREATE UNIQUE INDEX `resource_operations_client_kind_key` ON `resource_operations` (`client_session_id`,`kind`,`idempotency_key`);--> statement-breakpoint
44
+ CREATE INDEX `resource_operations_status` ON `resource_operations` (`status`);--> statement-breakpoint
45
+ CREATE TABLE `resource_streams` (
46
+ `stream_id` text PRIMARY KEY NOT NULL,
47
+ `last_seq` integer DEFAULT 0 NOT NULL
48
+ );
49
+ --> statement-breakpoint
50
+ ALTER TABLE `resource_locks` ADD `root_real_path` text;
51
+ --> statement-breakpoint
52
+ UPDATE `resource_locks` SET `root_real_path` = (
53
+ SELECT `real_path` FROM `projects` WHERE `projects`.`id` = `resource_locks`.`resource_id`
54
+ ) WHERE `resource_type` = 'project';
@@ -1,24 +1,24 @@
1
- CREATE TABLE `command_executions` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `operation_id` text NOT NULL,
4
- `project_id` text,
5
- `workspace_session_id` text,
6
- `session_id` text NOT NULL,
7
- `turn_id` text NOT NULL,
8
- `tool_call_id` text NOT NULL,
9
- `policy_snapshot_id` text NOT NULL,
10
- `params_hash` text NOT NULL,
11
- `status` text NOT NULL,
12
- `exit_code` integer,
13
- `reason_code` text,
14
- `truncated` integer DEFAULT false NOT NULL,
15
- `process_identity_json` text,
16
- `output_cursor` integer DEFAULT 0 NOT NULL,
17
- `created_at` integer NOT NULL,
18
- `started_at` integer,
19
- `ended_at` integer,
20
- FOREIGN KEY (`operation_id`) REFERENCES `resource_operations`(`id`) ON UPDATE no action ON DELETE no action
21
- );
22
- --> statement-breakpoint
23
- CREATE UNIQUE INDEX `command_executions_operation` ON `command_executions` (`operation_id`);--> statement-breakpoint
1
+ CREATE TABLE `command_executions` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `operation_id` text NOT NULL,
4
+ `project_id` text,
5
+ `workspace_session_id` text,
6
+ `session_id` text NOT NULL,
7
+ `turn_id` text NOT NULL,
8
+ `tool_call_id` text NOT NULL,
9
+ `policy_snapshot_id` text NOT NULL,
10
+ `params_hash` text NOT NULL,
11
+ `status` text NOT NULL,
12
+ `exit_code` integer,
13
+ `reason_code` text,
14
+ `truncated` integer DEFAULT false NOT NULL,
15
+ `process_identity_json` text,
16
+ `output_cursor` integer DEFAULT 0 NOT NULL,
17
+ `created_at` integer NOT NULL,
18
+ `started_at` integer,
19
+ `ended_at` integer,
20
+ FOREIGN KEY (`operation_id`) REFERENCES `resource_operations`(`id`) ON UPDATE no action ON DELETE no action
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE UNIQUE INDEX `command_executions_operation` ON `command_executions` (`operation_id`);--> statement-breakpoint
24
24
  CREATE INDEX `command_executions_status` ON `command_executions` (`status`);
@@ -1,42 +1,42 @@
1
- CREATE TABLE `terminal_leases` (
2
- `terminal_id` text PRIMARY KEY NOT NULL,
3
- `generation` integer DEFAULT 0 NOT NULL,
4
- `owner_type` text,
5
- `owner_client_session_id` text,
6
- `owner_connection_id` text,
7
- `owner_session_id` text,
8
- `owner_turn_id` text,
9
- `owner_execution_id` text,
10
- `expires_at` integer DEFAULT 0 NOT NULL,
11
- `heartbeat_at` integer DEFAULT 0 NOT NULL,
12
- `input_sequence` integer DEFAULT 0 NOT NULL,
13
- FOREIGN KEY (`terminal_id`) REFERENCES `terminals`(`id`) ON UPDATE no action ON DELETE no action
14
- );
15
- --> statement-breakpoint
16
- CREATE TABLE `terminals` (
17
- `id` text PRIMARY KEY NOT NULL,
18
- `operation_id` text NOT NULL,
19
- `project_id` text,
20
- `workspace_session_id` text,
21
- `source_session_id` text,
22
- `cwd` text NOT NULL,
23
- `shell` text NOT NULL,
24
- `mode` text NOT NULL,
25
- `role` text,
26
- `launch_params_json` text,
27
- `launch_params_hash` text,
28
- `created_by_turn_id` text,
29
- `status` text NOT NULL,
30
- `process_identity_json` text,
31
- `reason_code` text,
32
- `output_cursor` integer DEFAULT 0 NOT NULL,
33
- `created_at` integer NOT NULL,
34
- `started_at` integer,
35
- `ended_at` integer,
36
- `exit_code` integer,
37
- FOREIGN KEY (`operation_id`) REFERENCES `resource_operations`(`id`) ON UPDATE no action ON DELETE no action
38
- );
39
- --> statement-breakpoint
40
- CREATE UNIQUE INDEX `terminals_operation` ON `terminals` (`operation_id`);--> statement-breakpoint
41
- CREATE INDEX `terminals_status` ON `terminals` (`status`);--> statement-breakpoint
1
+ CREATE TABLE `terminal_leases` (
2
+ `terminal_id` text PRIMARY KEY NOT NULL,
3
+ `generation` integer DEFAULT 0 NOT NULL,
4
+ `owner_type` text,
5
+ `owner_client_session_id` text,
6
+ `owner_connection_id` text,
7
+ `owner_session_id` text,
8
+ `owner_turn_id` text,
9
+ `owner_execution_id` text,
10
+ `expires_at` integer DEFAULT 0 NOT NULL,
11
+ `heartbeat_at` integer DEFAULT 0 NOT NULL,
12
+ `input_sequence` integer DEFAULT 0 NOT NULL,
13
+ FOREIGN KEY (`terminal_id`) REFERENCES `terminals`(`id`) ON UPDATE no action ON DELETE no action
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE TABLE `terminals` (
17
+ `id` text PRIMARY KEY NOT NULL,
18
+ `operation_id` text NOT NULL,
19
+ `project_id` text,
20
+ `workspace_session_id` text,
21
+ `source_session_id` text,
22
+ `cwd` text NOT NULL,
23
+ `shell` text NOT NULL,
24
+ `mode` text NOT NULL,
25
+ `role` text,
26
+ `launch_params_json` text,
27
+ `launch_params_hash` text,
28
+ `created_by_turn_id` text,
29
+ `status` text NOT NULL,
30
+ `process_identity_json` text,
31
+ `reason_code` text,
32
+ `output_cursor` integer DEFAULT 0 NOT NULL,
33
+ `created_at` integer NOT NULL,
34
+ `started_at` integer,
35
+ `ended_at` integer,
36
+ `exit_code` integer,
37
+ FOREIGN KEY (`operation_id`) REFERENCES `resource_operations`(`id`) ON UPDATE no action ON DELETE no action
38
+ );
39
+ --> statement-breakpoint
40
+ CREATE UNIQUE INDEX `terminals_operation` ON `terminals` (`operation_id`);--> statement-breakpoint
41
+ CREATE INDEX `terminals_status` ON `terminals` (`status`);--> statement-breakpoint
42
42
  CREATE UNIQUE INDEX `terminals_active_role` ON `terminals` (`project_id`,`role`) WHERE "terminals"."mode" = 'dev' AND "terminals"."status" IN ('CREATED', 'RUNNING', 'STOPPING');
@@ -1,24 +1,24 @@
1
- CREATE TABLE `resource_actions` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `operation_id` text NOT NULL,
4
- `project_id` text NOT NULL,
5
- `kind` text NOT NULL,
6
- `risk` text NOT NULL,
7
- `status` text NOT NULL,
8
- `params_json` text NOT NULL,
9
- `params_hash` text NOT NULL,
10
- `snapshot_hash` text NOT NULL,
11
- `requested_by` text NOT NULL,
12
- `decided_by` text,
13
- `expires_at` integer NOT NULL,
14
- `decided_at` integer,
15
- `started_at` integer,
16
- `ended_at` integer,
17
- `result_json` text,
18
- `created_at` integer NOT NULL,
19
- FOREIGN KEY (`operation_id`) REFERENCES `resource_operations`(`id`) ON UPDATE no action ON DELETE no action,
20
- FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action
21
- );
22
- --> statement-breakpoint
23
- CREATE UNIQUE INDEX `resource_actions_operation` ON `resource_actions` (`operation_id`);--> statement-breakpoint
1
+ CREATE TABLE `resource_actions` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `operation_id` text NOT NULL,
4
+ `project_id` text NOT NULL,
5
+ `kind` text NOT NULL,
6
+ `risk` text NOT NULL,
7
+ `status` text NOT NULL,
8
+ `params_json` text NOT NULL,
9
+ `params_hash` text NOT NULL,
10
+ `snapshot_hash` text NOT NULL,
11
+ `requested_by` text NOT NULL,
12
+ `decided_by` text,
13
+ `expires_at` integer NOT NULL,
14
+ `decided_at` integer,
15
+ `started_at` integer,
16
+ `ended_at` integer,
17
+ `result_json` text,
18
+ `created_at` integer NOT NULL,
19
+ FOREIGN KEY (`operation_id`) REFERENCES `resource_operations`(`id`) ON UPDATE no action ON DELETE no action,
20
+ FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE UNIQUE INDEX `resource_actions_operation` ON `resource_actions` (`operation_id`);--> statement-breakpoint
24
24
  CREATE INDEX `resource_actions_project_status` ON `resource_actions` (`project_id`,`status`);
@@ -1,32 +1,32 @@
1
- CREATE TABLE `services` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `operation_id` text NOT NULL,
4
- `project_id` text NOT NULL,
5
- `source_session_id` text,
6
- `terminal_id` text NOT NULL,
7
- `name` text NOT NULL,
8
- `kind` text NOT NULL,
9
- `status` text NOT NULL,
10
- `terminal_execution_id` text NOT NULL,
11
- `endpoint_generation` integer NOT NULL,
12
- `endpoint_host` text NOT NULL,
13
- `endpoint_port` integer NOT NULL,
14
- `endpoint_protocol` text NOT NULL,
15
- `identity_json` text NOT NULL,
16
- `reason_code` text,
17
- `created_at` integer NOT NULL,
18
- `updated_at` integer NOT NULL,
19
- `ended_at` integer,
20
- FOREIGN KEY (`operation_id`) REFERENCES `resource_operations`(`id`) ON UPDATE no action ON DELETE no action,
21
- FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action,
22
- FOREIGN KEY (`terminal_id`) REFERENCES `terminals`(`id`) ON UPDATE no action ON DELETE no action,
23
- CONSTRAINT "services_status" CHECK("services"."status" IN ('REGISTERING', 'STARTING', 'RUNNING', 'UNKNOWN', 'UNREGISTERED')),
24
- CONSTRAINT "services_host" CHECK("services"."endpoint_host" IN ('127.0.0.1', '::1')),
25
- CONSTRAINT "services_port" CHECK("services"."endpoint_port" BETWEEN 1 AND 65535),
26
- CONSTRAINT "services_protocol" CHECK("services"."endpoint_protocol" = 'http')
27
- );
28
- --> statement-breakpoint
29
- CREATE UNIQUE INDEX `services_operation` ON `services` (`operation_id`);--> statement-breakpoint
30
- CREATE INDEX `services_project_status` ON `services` (`project_id`,`status`);--> statement-breakpoint
31
- CREATE INDEX `services_terminal` ON `services` (`terminal_id`);--> statement-breakpoint
1
+ CREATE TABLE `services` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `operation_id` text NOT NULL,
4
+ `project_id` text NOT NULL,
5
+ `source_session_id` text,
6
+ `terminal_id` text NOT NULL,
7
+ `name` text NOT NULL,
8
+ `kind` text NOT NULL,
9
+ `status` text NOT NULL,
10
+ `terminal_execution_id` text NOT NULL,
11
+ `endpoint_generation` integer NOT NULL,
12
+ `endpoint_host` text NOT NULL,
13
+ `endpoint_port` integer NOT NULL,
14
+ `endpoint_protocol` text NOT NULL,
15
+ `identity_json` text NOT NULL,
16
+ `reason_code` text,
17
+ `created_at` integer NOT NULL,
18
+ `updated_at` integer NOT NULL,
19
+ `ended_at` integer,
20
+ FOREIGN KEY (`operation_id`) REFERENCES `resource_operations`(`id`) ON UPDATE no action ON DELETE no action,
21
+ FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action,
22
+ FOREIGN KEY (`terminal_id`) REFERENCES `terminals`(`id`) ON UPDATE no action ON DELETE no action,
23
+ CONSTRAINT "services_status" CHECK("services"."status" IN ('REGISTERING', 'STARTING', 'RUNNING', 'UNKNOWN', 'UNREGISTERED')),
24
+ CONSTRAINT "services_host" CHECK("services"."endpoint_host" IN ('127.0.0.1', '::1')),
25
+ CONSTRAINT "services_port" CHECK("services"."endpoint_port" BETWEEN 1 AND 65535),
26
+ CONSTRAINT "services_protocol" CHECK("services"."endpoint_protocol" = 'http')
27
+ );
28
+ --> statement-breakpoint
29
+ CREATE UNIQUE INDEX `services_operation` ON `services` (`operation_id`);--> statement-breakpoint
30
+ CREATE INDEX `services_project_status` ON `services` (`project_id`,`status`);--> statement-breakpoint
31
+ CREATE INDEX `services_terminal` ON `services` (`terminal_id`);--> statement-breakpoint
32
32
  CREATE UNIQUE INDEX `services_active_endpoint` ON `services` (`terminal_id`,`endpoint_host`,`endpoint_port`) WHERE "services"."status" IN ('REGISTERING', 'STARTING', 'RUNNING');
@@ -0,0 +1,20 @@
1
+ CREATE TABLE `input_requests` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `turn_id` text NOT NULL,
4
+ `session_id` text NOT NULL,
5
+ `tool_call_id` text NOT NULL,
6
+ `kind` text DEFAULT 'question' NOT NULL,
7
+ `status` text DEFAULT 'pending' NOT NULL,
8
+ `questions_json` text NOT NULL,
9
+ `answers_json` text,
10
+ `expires_at` integer NOT NULL,
11
+ `resolved_at` integer,
12
+ `resolved_by` text,
13
+ `created_at` integer NOT NULL,
14
+ FOREIGN KEY (`turn_id`) REFERENCES `turns`(`id`) ON UPDATE no action ON DELETE cascade,
15
+ FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
16
+ );
17
+ --> statement-breakpoint
18
+ CREATE INDEX `idx_input_requests_turn_status` ON `input_requests` (`turn_id`,`status`);--> statement-breakpoint
19
+ CREATE INDEX `idx_input_requests_session_status` ON `input_requests` (`session_id`,`status`);--> statement-breakpoint
20
+ CREATE INDEX `idx_input_requests_expiry` ON `input_requests` (`expires_at`);