larness 0.4.2 → 0.5.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 (62) hide show
  1. package/README.md +6 -5
  2. package/app.js +22 -105
  3. package/apps/server/dist/{address-BDs0FfMq.js → address-D0ZG5qR4.js} +5 -2
  4. package/apps/server/dist/args-CrKTPT06.js +92 -0
  5. package/apps/server/dist/cli.js +340 -0
  6. package/apps/server/dist/{client-D88ULjn9.js → client-D_Ni3Zpx.js} +21 -1
  7. package/apps/server/dist/code-B2JBoV4x.js +24 -0
  8. package/apps/server/dist/{doctor-dwTQiTef.js → doctor-CE6cONuz.js} +3 -2
  9. package/apps/server/dist/doctor-sPRlI92N.js +1 -0
  10. package/apps/server/dist/doctor.js +1 -1
  11. package/apps/server/dist/index.js +704 -118
  12. package/apps/server/dist/{paths-DUfwiH2X.js → inspect-XgAc84F9.js} +106 -87
  13. package/apps/server/dist/lifecycle-C3KV3-Ax.js +263 -0
  14. package/apps/server/dist/log-files-CFOaEy6O.js +26 -0
  15. package/apps/server/dist/{managed-Br7VqQiP.js → managed-Cw3MVilO.js} +221 -71
  16. package/apps/server/dist/paths-BhVn34MT.js +77 -0
  17. package/apps/server/dist/{status-D2oSIMoj.js → status-CV_zWfs6.js} +16 -3
  18. package/apps/server/dist/status.js +37 -9
  19. package/apps/server/dist/supervisor-IYDKL4iU.js +297 -0
  20. package/apps/server/dist/tui.js +167 -333
  21. package/apps/server/dist/version-ui_X8H2k.js +13 -0
  22. package/apps/server/drizzle/0001_auth.sql +109 -109
  23. package/apps/server/drizzle/0002_projects.sql +12 -12
  24. package/apps/server/drizzle/0003_workspace.sql +80 -80
  25. package/apps/server/drizzle/0004_models.sql +30 -30
  26. package/apps/server/drizzle/0005_resources.sql +54 -54
  27. package/apps/server/drizzle/0006_commands.sql +23 -23
  28. package/apps/server/drizzle/0007_terminals.sql +41 -41
  29. package/apps/server/drizzle/0008_resource_actions.sql +23 -23
  30. package/apps/server/drizzle/0010_services.sql +31 -31
  31. package/apps/web/dist/assets/{FileEditor-JaazRNUl.js → FileEditor-DnQa6Owc.js} +1 -1
  32. package/apps/web/dist/assets/{FileViewer-DzJpg82J.js → FileViewer-DKlF-CWF.js} +1 -1
  33. package/apps/web/dist/assets/{cssMode-B8mOf4OC.js → cssMode-C9KmpsHc.js} +1 -1
  34. package/apps/web/dist/assets/{editor.api-BQ-DCb9F.js → editor.api-BwfHyHQ6.js} +1 -1
  35. package/apps/web/dist/assets/{freemarker2-C1ckA1My.js → freemarker2-D41RlIQ5.js} +1 -1
  36. package/apps/web/dist/assets/{handlebars-suElsFdc.js → handlebars-D-7R6ic0.js} +1 -1
  37. package/apps/web/dist/assets/{html-CvWl95vU.js → html-CUME4rt-.js} +1 -1
  38. package/apps/web/dist/assets/{htmlMode-CrdRQhj8.js → htmlMode-8w7WLhnL.js} +1 -1
  39. package/apps/web/dist/assets/{index-C6uOTgh6.js → index-BOS3UrP1.js} +2 -2
  40. package/apps/web/dist/assets/{javascript-DmE3KPeg.js → javascript-_3pdDG34.js} +1 -1
  41. package/apps/web/dist/assets/{jsonMode-TuNjADgG.js → jsonMode-DiqocFCf.js} +1 -1
  42. package/apps/web/dist/assets/{liquid-C_Ceyr5s.js → liquid-j0FoiTXN.js} +1 -1
  43. package/apps/web/dist/assets/{lspLanguageFeatures-DZfo74cL.js → lspLanguageFeatures-Zj7K2sG4.js} +1 -1
  44. package/apps/web/dist/assets/main-DZIruO5x.js +157 -0
  45. package/apps/web/dist/assets/main-gq3n_vn8.css +1 -0
  46. package/apps/web/dist/assets/{mdx-D8eqTMYQ.js → mdx-CGQ8Cw6J.js} +1 -1
  47. package/apps/web/dist/assets/{monaco-BGhTlUO7.js → monaco-CyMA3azg.js} +3 -3
  48. package/apps/web/dist/assets/{python-Cx6dqJ-u.js → python-BtY34Z9A.js} +1 -1
  49. package/apps/web/dist/assets/{razor-u7rb64U6.js → razor-CzYHpLv5.js} +1 -1
  50. package/apps/web/dist/assets/{tsMode-Cu3GDz4d.js → tsMode-GZx3VEv9.js} +1 -1
  51. package/apps/web/dist/assets/{typescript-H0OSh9BN.js → typescript-CAfvuTDQ.js} +1 -1
  52. package/apps/web/dist/assets/{workers-DJ7JInlW.js → workers-C5BOxOmH.js} +1 -1
  53. package/apps/web/dist/assets/{xml-C_rrJhqX.js → xml-BGX4mtH7.js} +1 -1
  54. package/apps/web/dist/assets/{yaml-Cub5doLg.js → yaml-B2AgBtJB.js} +1 -1
  55. package/apps/web/dist/favicon.svg +4 -4
  56. package/apps/web/dist/index.html +1 -1
  57. package/docs/README.md +8 -1
  58. package/docs/guides/install.md +23 -7
  59. package/package.json +3 -1
  60. package/apps/server/dist/lock-DyEoZgG_.js +0 -101
  61. package/apps/web/dist/assets/main-C3xYrJa1.js +0 -157
  62. package/apps/web/dist/assets/main-ptChOROf.css +0 -1
@@ -0,0 +1,13 @@
1
+ import { readFileSync } from "node:fs";
2
+ // src/version.ts
3
+ function readPackageMetadata() {
4
+ try {
5
+ return JSON.parse(readFileSync(new URL("../../../package.json", import.meta.url), "utf8")) ?? {};
6
+ } catch {
7
+ return {};
8
+ }
9
+ }
10
+ const metadata = readPackageMetadata();
11
+ const SERVER_VERSION = typeof metadata.version === "string" ? metadata.version : "0.0.0";
12
+ const SUPPORTED_NODE_RANGE = typeof metadata.engines?.node === "string" ? metadata.engines.node : "^22.22.0 || >=24";
13
+ export { SUPPORTED_NODE_RANGE as n, SERVER_VERSION as t };
@@ -1,110 +1,110 @@
1
- CREATE TABLE `app_meta` (
2
- `key` text PRIMARY KEY NOT NULL,
3
- `value` text NOT NULL,
4
- `updated_at` integer NOT NULL
5
- );
6
- --> statement-breakpoint
7
- CREATE TABLE `audit_logs` (
8
- `id` text PRIMARY KEY NOT NULL,
9
- `client_session_id` text,
10
- `session_id` text,
11
- `action` text NOT NULL,
12
- `resource_type` text,
13
- `resource_id` text,
14
- `decision` text,
15
- `details_json` text DEFAULT '{}' NOT NULL,
16
- `created_at` integer NOT NULL
17
- );
18
- --> statement-breakpoint
19
- CREATE INDEX `idx_audit_created` ON `audit_logs` (`created_at`);--> statement-breakpoint
20
- CREATE INDEX `idx_audit_action` ON `audit_logs` (`action`,`created_at`);--> statement-breakpoint
21
- CREATE TABLE `auth_settings` (
22
- `id` integer PRIMARY KEY NOT NULL,
23
- `admin_hash` text NOT NULL,
24
- `admin_updated_at` integer NOT NULL,
25
- `initialized_at` integer NOT NULL,
26
- CONSTRAINT "auth_settings_single_row" CHECK("auth_settings"."id" = 1)
27
- );
28
- --> statement-breakpoint
29
- CREATE TABLE `browser_sessions` (
30
- `id` text PRIMARY KEY NOT NULL,
31
- `device_id` text,
32
- `token_hash` text NOT NULL,
33
- `kind` text NOT NULL,
34
- `ip` text,
35
- `user_agent` text,
36
- `created_at` integer NOT NULL,
37
- `last_seen_at` integer NOT NULL,
38
- `expires_at` integer NOT NULL,
39
- `revoked_at` integer,
40
- FOREIGN KEY (`device_id`) REFERENCES `trusted_devices`(`id`) ON UPDATE no action ON DELETE no action
41
- );
42
- --> statement-breakpoint
43
- CREATE UNIQUE INDEX `browser_sessions_token_hash_unique` ON `browser_sessions` (`token_hash`);--> statement-breakpoint
44
- CREATE INDEX `idx_browser_sessions_device` ON `browser_sessions` (`device_id`);--> statement-breakpoint
45
- CREATE TABLE `device_requests` (
46
- `id` text PRIMARY KEY NOT NULL,
47
- `short_code` text NOT NULL,
48
- `status` text NOT NULL,
49
- `decision` text,
50
- `client_label` text,
51
- `user_agent` text,
52
- `ip` text,
53
- `client_origin` text,
54
- `poll_token_hash` text NOT NULL,
55
- `code_hash` text,
56
- `code_expires_at` integer,
57
- `attempts` integer DEFAULT 0 NOT NULL,
58
- `enrollment_token_hash` text,
59
- `enrollment_expires_at` integer,
60
- `created_at` integer NOT NULL,
61
- `expires_at` integer NOT NULL,
62
- `decided_at` integer,
63
- `redeemed_at` integer
64
- );
65
- --> statement-breakpoint
66
- CREATE UNIQUE INDEX `device_requests_short_code_unique` ON `device_requests` (`short_code`);--> statement-breakpoint
67
- CREATE INDEX `idx_device_requests_status` ON `device_requests` (`status`,`expires_at`);--> statement-breakpoint
68
- CREATE TABLE `trusted_devices` (
69
- `id` text PRIMARY KEY NOT NULL,
70
- `label` text NOT NULL,
71
- `created_by_request_id` text,
72
- `user_agent` text,
73
- `created_at` integer NOT NULL,
74
- `last_seen_at` integer,
75
- `revoked_at` integer,
76
- FOREIGN KEY (`created_by_request_id`) REFERENCES `device_requests`(`id`) ON UPDATE no action ON DELETE no action
77
- );
78
- --> statement-breakpoint
79
- CREATE TABLE `webauthn_challenges` (
80
- `id` text PRIMARY KEY NOT NULL,
81
- `type` text NOT NULL,
82
- `challenge` text NOT NULL,
83
- `request_id` text,
84
- `device_id` text,
85
- `created_at` integer NOT NULL,
86
- `expires_at` integer NOT NULL,
87
- `consumed_at` integer,
88
- FOREIGN KEY (`request_id`) REFERENCES `device_requests`(`id`) ON UPDATE no action ON DELETE no action,
89
- FOREIGN KEY (`device_id`) REFERENCES `trusted_devices`(`id`) ON UPDATE no action ON DELETE no action
90
- );
91
- --> statement-breakpoint
92
- CREATE INDEX `idx_webauthn_challenges_expiry` ON `webauthn_challenges` (`expires_at`);--> statement-breakpoint
93
- CREATE TABLE `webauthn_credentials` (
94
- `id` text PRIMARY KEY NOT NULL,
95
- `device_id` text NOT NULL,
96
- `credential_id` text NOT NULL,
97
- `public_key` text NOT NULL,
98
- `counter` integer DEFAULT 0 NOT NULL,
99
- `transports_json` text DEFAULT '[]' NOT NULL,
100
- `aaguid` text,
101
- `backup_eligible` integer DEFAULT false NOT NULL,
102
- `backup_state` integer DEFAULT false NOT NULL,
103
- `created_at` integer NOT NULL,
104
- `last_used_at` integer,
105
- `revoked_at` integer,
106
- FOREIGN KEY (`device_id`) REFERENCES `trusted_devices`(`id`) ON UPDATE no action ON DELETE no action
107
- );
108
- --> statement-breakpoint
109
- CREATE UNIQUE INDEX `webauthn_credentials_credential_id_unique` ON `webauthn_credentials` (`credential_id`);--> statement-breakpoint
1
+ CREATE TABLE `app_meta` (
2
+ `key` text PRIMARY KEY NOT NULL,
3
+ `value` text NOT NULL,
4
+ `updated_at` integer NOT NULL
5
+ );
6
+ --> statement-breakpoint
7
+ CREATE TABLE `audit_logs` (
8
+ `id` text PRIMARY KEY NOT NULL,
9
+ `client_session_id` text,
10
+ `session_id` text,
11
+ `action` text NOT NULL,
12
+ `resource_type` text,
13
+ `resource_id` text,
14
+ `decision` text,
15
+ `details_json` text DEFAULT '{}' NOT NULL,
16
+ `created_at` integer NOT NULL
17
+ );
18
+ --> statement-breakpoint
19
+ CREATE INDEX `idx_audit_created` ON `audit_logs` (`created_at`);--> statement-breakpoint
20
+ CREATE INDEX `idx_audit_action` ON `audit_logs` (`action`,`created_at`);--> statement-breakpoint
21
+ CREATE TABLE `auth_settings` (
22
+ `id` integer PRIMARY KEY NOT NULL,
23
+ `admin_hash` text NOT NULL,
24
+ `admin_updated_at` integer NOT NULL,
25
+ `initialized_at` integer NOT NULL,
26
+ CONSTRAINT "auth_settings_single_row" CHECK("auth_settings"."id" = 1)
27
+ );
28
+ --> statement-breakpoint
29
+ CREATE TABLE `browser_sessions` (
30
+ `id` text PRIMARY KEY NOT NULL,
31
+ `device_id` text,
32
+ `token_hash` text NOT NULL,
33
+ `kind` text NOT NULL,
34
+ `ip` text,
35
+ `user_agent` text,
36
+ `created_at` integer NOT NULL,
37
+ `last_seen_at` integer NOT NULL,
38
+ `expires_at` integer NOT NULL,
39
+ `revoked_at` integer,
40
+ FOREIGN KEY (`device_id`) REFERENCES `trusted_devices`(`id`) ON UPDATE no action ON DELETE no action
41
+ );
42
+ --> statement-breakpoint
43
+ CREATE UNIQUE INDEX `browser_sessions_token_hash_unique` ON `browser_sessions` (`token_hash`);--> statement-breakpoint
44
+ CREATE INDEX `idx_browser_sessions_device` ON `browser_sessions` (`device_id`);--> statement-breakpoint
45
+ CREATE TABLE `device_requests` (
46
+ `id` text PRIMARY KEY NOT NULL,
47
+ `short_code` text NOT NULL,
48
+ `status` text NOT NULL,
49
+ `decision` text,
50
+ `client_label` text,
51
+ `user_agent` text,
52
+ `ip` text,
53
+ `client_origin` text,
54
+ `poll_token_hash` text NOT NULL,
55
+ `code_hash` text,
56
+ `code_expires_at` integer,
57
+ `attempts` integer DEFAULT 0 NOT NULL,
58
+ `enrollment_token_hash` text,
59
+ `enrollment_expires_at` integer,
60
+ `created_at` integer NOT NULL,
61
+ `expires_at` integer NOT NULL,
62
+ `decided_at` integer,
63
+ `redeemed_at` integer
64
+ );
65
+ --> statement-breakpoint
66
+ CREATE UNIQUE INDEX `device_requests_short_code_unique` ON `device_requests` (`short_code`);--> statement-breakpoint
67
+ CREATE INDEX `idx_device_requests_status` ON `device_requests` (`status`,`expires_at`);--> statement-breakpoint
68
+ CREATE TABLE `trusted_devices` (
69
+ `id` text PRIMARY KEY NOT NULL,
70
+ `label` text NOT NULL,
71
+ `created_by_request_id` text,
72
+ `user_agent` text,
73
+ `created_at` integer NOT NULL,
74
+ `last_seen_at` integer,
75
+ `revoked_at` integer,
76
+ FOREIGN KEY (`created_by_request_id`) REFERENCES `device_requests`(`id`) ON UPDATE no action ON DELETE no action
77
+ );
78
+ --> statement-breakpoint
79
+ CREATE TABLE `webauthn_challenges` (
80
+ `id` text PRIMARY KEY NOT NULL,
81
+ `type` text NOT NULL,
82
+ `challenge` text NOT NULL,
83
+ `request_id` text,
84
+ `device_id` text,
85
+ `created_at` integer NOT NULL,
86
+ `expires_at` integer NOT NULL,
87
+ `consumed_at` integer,
88
+ FOREIGN KEY (`request_id`) REFERENCES `device_requests`(`id`) ON UPDATE no action ON DELETE no action,
89
+ FOREIGN KEY (`device_id`) REFERENCES `trusted_devices`(`id`) ON UPDATE no action ON DELETE no action
90
+ );
91
+ --> statement-breakpoint
92
+ CREATE INDEX `idx_webauthn_challenges_expiry` ON `webauthn_challenges` (`expires_at`);--> statement-breakpoint
93
+ CREATE TABLE `webauthn_credentials` (
94
+ `id` text PRIMARY KEY NOT NULL,
95
+ `device_id` text NOT NULL,
96
+ `credential_id` text NOT NULL,
97
+ `public_key` text NOT NULL,
98
+ `counter` integer DEFAULT 0 NOT NULL,
99
+ `transports_json` text DEFAULT '[]' NOT NULL,
100
+ `aaguid` text,
101
+ `backup_eligible` integer DEFAULT false NOT NULL,
102
+ `backup_state` integer DEFAULT false NOT NULL,
103
+ `created_at` integer NOT NULL,
104
+ `last_used_at` integer,
105
+ `revoked_at` integer,
106
+ FOREIGN KEY (`device_id`) REFERENCES `trusted_devices`(`id`) ON UPDATE no action ON DELETE no action
107
+ );
108
+ --> statement-breakpoint
109
+ CREATE UNIQUE INDEX `webauthn_credentials_credential_id_unique` ON `webauthn_credentials` (`credential_id`);--> statement-breakpoint
110
110
  CREATE INDEX `idx_webauthn_credentials_device` ON `webauthn_credentials` (`device_id`);
@@ -1,13 +1,13 @@
1
- CREATE TABLE `projects` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `name` text NOT NULL,
4
- `root_path` text NOT NULL,
5
- `real_path` text NOT NULL,
6
- `settings_json` text DEFAULT '{}' NOT NULL,
7
- `git_detected` integer DEFAULT false NOT NULL,
8
- `created_at` integer NOT NULL,
9
- `updated_at` integer NOT NULL
10
- );
11
- --> statement-breakpoint
12
- CREATE UNIQUE INDEX `projects_real_path_unique` ON `projects` (`real_path`);--> statement-breakpoint
1
+ CREATE TABLE `projects` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `name` text NOT NULL,
4
+ `root_path` text NOT NULL,
5
+ `real_path` text NOT NULL,
6
+ `settings_json` text DEFAULT '{}' NOT NULL,
7
+ `git_detected` integer DEFAULT false NOT NULL,
8
+ `created_at` integer NOT NULL,
9
+ `updated_at` integer NOT NULL
10
+ );
11
+ --> statement-breakpoint
12
+ CREATE UNIQUE INDEX `projects_real_path_unique` ON `projects` (`real_path`);--> statement-breakpoint
13
13
  CREATE INDEX `idx_projects_updated` ON `projects` (`updated_at`);
@@ -1,81 +1,81 @@
1
- CREATE TABLE `agent_events` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `session_id` text NOT NULL,
4
- `turn_id` text,
5
- `seq` integer NOT NULL,
6
- `type` text NOT NULL,
7
- `payload_json` text DEFAULT '{}' NOT NULL,
8
- `created_at` integer NOT NULL,
9
- FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade,
10
- FOREIGN KEY (`turn_id`) REFERENCES `turns`(`id`) ON UPDATE no action ON DELETE cascade
11
- );
12
- --> statement-breakpoint
13
- CREATE UNIQUE INDEX `agent_events_session_seq_unique` ON `agent_events` (`session_id`,`seq`);--> statement-breakpoint
14
- CREATE TABLE `approvals` (
15
- `id` text PRIMARY KEY NOT NULL,
16
- `turn_id` text NOT NULL,
17
- `tool_call_id` text NOT NULL,
18
- `tool_name` text NOT NULL,
19
- `risk` text NOT NULL,
20
- `status` text DEFAULT 'pending' NOT NULL,
21
- `scope_json` text DEFAULT '{}' NOT NULL,
22
- `params_hash` text NOT NULL,
23
- `expires_at` integer NOT NULL,
24
- `decided_at` integer,
25
- `decided_by` text,
26
- `created_at` integer NOT NULL,
27
- FOREIGN KEY (`turn_id`) REFERENCES `turns`(`id`) ON UPDATE no action ON DELETE cascade
28
- );
29
- --> statement-breakpoint
30
- CREATE INDEX `idx_approvals_turn_status` ON `approvals` (`turn_id`,`status`);--> statement-breakpoint
31
- CREATE INDEX `idx_approvals_expiry` ON `approvals` (`expires_at`);--> statement-breakpoint
32
- CREATE TABLE `resource_locks` (
33
- `id` text PRIMARY KEY NOT NULL,
34
- `resource_type` text NOT NULL,
35
- `resource_id` text NOT NULL,
36
- `owner` text NOT NULL,
37
- `execution_id` text NOT NULL,
38
- `fencing_token` integer NOT NULL,
39
- `expires_at` integer NOT NULL,
40
- `heartbeat_at` integer NOT NULL,
41
- `created_at` integer NOT NULL
42
- );
43
- --> statement-breakpoint
44
- CREATE UNIQUE INDEX `resource_locks_resource_unique` ON `resource_locks` (`resource_type`,`resource_id`);--> statement-breakpoint
45
- CREATE INDEX `idx_resource_locks_expiry` ON `resource_locks` (`expires_at`);--> statement-breakpoint
46
- CREATE TABLE `sessions` (
47
- `id` text PRIMARY KEY NOT NULL,
48
- `project_id` text,
49
- `workspace_path` text NOT NULL,
50
- `title` text NOT NULL,
51
- `status` text DEFAULT 'active' NOT NULL,
52
- `model_profile_id` text,
53
- `approval_policy_id` text DEFAULT 'standard' NOT NULL,
54
- `created_at` integer NOT NULL,
55
- `updated_at` integer NOT NULL,
56
- `last_activity_at` integer NOT NULL,
57
- FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE set null
58
- );
59
- --> statement-breakpoint
60
- CREATE INDEX `idx_sessions_project_updated` ON `sessions` (`project_id`,`updated_at`);--> statement-breakpoint
61
- CREATE INDEX `idx_sessions_updated` ON `sessions` (`updated_at`);--> statement-breakpoint
62
- CREATE TABLE `turns` (
63
- `id` text PRIMARY KEY NOT NULL,
64
- `session_id` text NOT NULL,
65
- `model_profile_id` text,
66
- `provider` text,
67
- `model` text,
68
- `status` text NOT NULL,
69
- `input_json` text NOT NULL,
70
- `usage_json` text,
71
- `error_json` text,
72
- `idempotency_key` text,
73
- `created_at` integer NOT NULL,
74
- `started_at` integer,
75
- `ended_at` integer,
76
- FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
77
- );
78
- --> statement-breakpoint
79
- CREATE UNIQUE INDEX `turns_session_idempotency_unique` ON `turns` (`session_id`,`idempotency_key`);--> statement-breakpoint
80
- CREATE INDEX `idx_turns_session_created` ON `turns` (`session_id`,`created_at`);--> statement-breakpoint
1
+ CREATE TABLE `agent_events` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `session_id` text NOT NULL,
4
+ `turn_id` text,
5
+ `seq` integer NOT NULL,
6
+ `type` text NOT NULL,
7
+ `payload_json` text DEFAULT '{}' NOT NULL,
8
+ `created_at` integer NOT NULL,
9
+ FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade,
10
+ FOREIGN KEY (`turn_id`) REFERENCES `turns`(`id`) ON UPDATE no action ON DELETE cascade
11
+ );
12
+ --> statement-breakpoint
13
+ CREATE UNIQUE INDEX `agent_events_session_seq_unique` ON `agent_events` (`session_id`,`seq`);--> statement-breakpoint
14
+ CREATE TABLE `approvals` (
15
+ `id` text PRIMARY KEY NOT NULL,
16
+ `turn_id` text NOT NULL,
17
+ `tool_call_id` text NOT NULL,
18
+ `tool_name` text NOT NULL,
19
+ `risk` text NOT NULL,
20
+ `status` text DEFAULT 'pending' NOT NULL,
21
+ `scope_json` text DEFAULT '{}' NOT NULL,
22
+ `params_hash` text NOT NULL,
23
+ `expires_at` integer NOT NULL,
24
+ `decided_at` integer,
25
+ `decided_by` text,
26
+ `created_at` integer NOT NULL,
27
+ FOREIGN KEY (`turn_id`) REFERENCES `turns`(`id`) ON UPDATE no action ON DELETE cascade
28
+ );
29
+ --> statement-breakpoint
30
+ CREATE INDEX `idx_approvals_turn_status` ON `approvals` (`turn_id`,`status`);--> statement-breakpoint
31
+ CREATE INDEX `idx_approvals_expiry` ON `approvals` (`expires_at`);--> statement-breakpoint
32
+ CREATE TABLE `resource_locks` (
33
+ `id` text PRIMARY KEY NOT NULL,
34
+ `resource_type` text NOT NULL,
35
+ `resource_id` text NOT NULL,
36
+ `owner` text NOT NULL,
37
+ `execution_id` text NOT NULL,
38
+ `fencing_token` integer NOT NULL,
39
+ `expires_at` integer NOT NULL,
40
+ `heartbeat_at` integer NOT NULL,
41
+ `created_at` integer NOT NULL
42
+ );
43
+ --> statement-breakpoint
44
+ CREATE UNIQUE INDEX `resource_locks_resource_unique` ON `resource_locks` (`resource_type`,`resource_id`);--> statement-breakpoint
45
+ CREATE INDEX `idx_resource_locks_expiry` ON `resource_locks` (`expires_at`);--> statement-breakpoint
46
+ CREATE TABLE `sessions` (
47
+ `id` text PRIMARY KEY NOT NULL,
48
+ `project_id` text,
49
+ `workspace_path` text NOT NULL,
50
+ `title` text NOT NULL,
51
+ `status` text DEFAULT 'active' NOT NULL,
52
+ `model_profile_id` text,
53
+ `approval_policy_id` text DEFAULT 'standard' NOT NULL,
54
+ `created_at` integer NOT NULL,
55
+ `updated_at` integer NOT NULL,
56
+ `last_activity_at` integer NOT NULL,
57
+ FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE set null
58
+ );
59
+ --> statement-breakpoint
60
+ CREATE INDEX `idx_sessions_project_updated` ON `sessions` (`project_id`,`updated_at`);--> statement-breakpoint
61
+ CREATE INDEX `idx_sessions_updated` ON `sessions` (`updated_at`);--> statement-breakpoint
62
+ CREATE TABLE `turns` (
63
+ `id` text PRIMARY KEY NOT NULL,
64
+ `session_id` text NOT NULL,
65
+ `model_profile_id` text,
66
+ `provider` text,
67
+ `model` text,
68
+ `status` text NOT NULL,
69
+ `input_json` text NOT NULL,
70
+ `usage_json` text,
71
+ `error_json` text,
72
+ `idempotency_key` text,
73
+ `created_at` integer NOT NULL,
74
+ `started_at` integer,
75
+ `ended_at` integer,
76
+ FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
77
+ );
78
+ --> statement-breakpoint
79
+ CREATE UNIQUE INDEX `turns_session_idempotency_unique` ON `turns` (`session_id`,`idempotency_key`);--> statement-breakpoint
80
+ CREATE INDEX `idx_turns_session_created` ON `turns` (`session_id`,`created_at`);--> statement-breakpoint
81
81
  CREATE INDEX `idx_turns_session_status` ON `turns` (`session_id`,`status`);
@@ -1,30 +1,30 @@
1
- CREATE TABLE `credential_profiles` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `provider` text NOT NULL,
4
- `label` text NOT NULL,
5
- `secret_ref` text NOT NULL,
6
- `created_at` integer NOT NULL,
7
- FOREIGN KEY (`secret_ref`) REFERENCES `secrets`(`id`) ON UPDATE no action ON DELETE cascade
8
- );
9
- --> statement-breakpoint
10
- CREATE INDEX `idx_credential_profiles_provider` ON `credential_profiles` (`provider`);--> statement-breakpoint
11
- CREATE TABLE `model_profiles` (
12
- `id` text PRIMARY KEY NOT NULL,
13
- `label` text NOT NULL,
14
- `provider` text NOT NULL,
15
- `model` text NOT NULL,
16
- `credential_profile_id` text,
17
- `endpoint` text,
18
- `capabilities_json` text DEFAULT '{}' NOT NULL,
19
- `created_at` integer NOT NULL,
20
- FOREIGN KEY (`credential_profile_id`) REFERENCES `credential_profiles`(`id`) ON UPDATE no action ON DELETE set null
21
- );
22
- --> statement-breakpoint
23
- CREATE INDEX `idx_model_profiles_provider` ON `model_profiles` (`provider`);--> statement-breakpoint
24
- CREATE TABLE `secrets` (
25
- `id` text PRIMARY KEY NOT NULL,
26
- `ciphertext` text NOT NULL,
27
- `nonce` text NOT NULL,
28
- `tag` text NOT NULL,
29
- `created_at` integer NOT NULL
30
- );
1
+ CREATE TABLE `credential_profiles` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `provider` text NOT NULL,
4
+ `label` text NOT NULL,
5
+ `secret_ref` text NOT NULL,
6
+ `created_at` integer NOT NULL,
7
+ FOREIGN KEY (`secret_ref`) REFERENCES `secrets`(`id`) ON UPDATE no action ON DELETE cascade
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE INDEX `idx_credential_profiles_provider` ON `credential_profiles` (`provider`);--> statement-breakpoint
11
+ CREATE TABLE `model_profiles` (
12
+ `id` text PRIMARY KEY NOT NULL,
13
+ `label` text NOT NULL,
14
+ `provider` text NOT NULL,
15
+ `model` text NOT NULL,
16
+ `credential_profile_id` text,
17
+ `endpoint` text,
18
+ `capabilities_json` text DEFAULT '{}' NOT NULL,
19
+ `created_at` integer NOT NULL,
20
+ FOREIGN KEY (`credential_profile_id`) REFERENCES `credential_profiles`(`id`) ON UPDATE no action ON DELETE set null
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE INDEX `idx_model_profiles_provider` ON `model_profiles` (`provider`);--> statement-breakpoint
24
+ CREATE TABLE `secrets` (
25
+ `id` text PRIMARY KEY NOT NULL,
26
+ `ciphertext` text NOT NULL,
27
+ `nonce` text NOT NULL,
28
+ `tag` text NOT NULL,
29
+ `created_at` integer NOT NULL
30
+ );
@@ -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`);