larness 0.6.1 → 0.6.2
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/apps/server/dist/cli.js +4 -4
- package/apps/server/dist/index.js +31 -8
- package/apps/server/dist/{lifecycle-Ck4LRKft.js → lifecycle-CAl_1GBj.js} +17 -7
- package/apps/server/drizzle/0001_auth.sql +109 -109
- package/apps/server/drizzle/0002_projects.sql +12 -12
- package/apps/server/drizzle/0003_workspace.sql +80 -80
- package/apps/server/drizzle/0004_models.sql +30 -30
- package/apps/server/drizzle/0005_resources.sql +54 -54
- package/apps/server/drizzle/0006_commands.sql +23 -23
- package/apps/server/drizzle/0007_terminals.sql +41 -41
- package/apps/server/drizzle/0008_resource_actions.sql +23 -23
- package/apps/server/drizzle/0010_services.sql +31 -31
- package/apps/web/dist/assets/{FileEditor-2VPjs-RQ.js → FileEditor-Do8GmXIr.js} +1 -1
- package/apps/web/dist/assets/{FileViewer-CZcKFZJT.js → FileViewer-B8gY_ZI6.js} +1 -1
- package/apps/web/dist/assets/{cssMode-D-Rled60.js → cssMode-CS6aED9d.js} +1 -1
- package/apps/web/dist/assets/{editor.api-C3oaU0qj.js → editor.api-D6oPGpkQ.js} +1 -1
- package/apps/web/dist/assets/{freemarker2-D50E-mj1.js → freemarker2-W5te7pKn.js} +1 -1
- package/apps/web/dist/assets/{handlebars-_Xg_xwtq.js → handlebars-FfsnqgOd.js} +1 -1
- package/apps/web/dist/assets/{html-BPuGWYaH.js → html-B6aDARpM.js} +1 -1
- package/apps/web/dist/assets/{htmlMode-CwmSqoNt.js → htmlMode-DtVB7XbC.js} +1 -1
- package/apps/web/dist/assets/{index-DPZpqlAG.js → index-CoZNwLtg.js} +2 -2
- package/apps/web/dist/assets/{javascript-iFH4qFsX.js → javascript-DOCYuHY6.js} +1 -1
- package/apps/web/dist/assets/{jsonMode-On0Ct3VU.js → jsonMode-3TlHPyqo.js} +1 -1
- package/apps/web/dist/assets/{liquid-BX3WY7Z7.js → liquid-Bto78Uut.js} +1 -1
- package/apps/web/dist/assets/{lspLanguageFeatures-BXlOyN1U.js → lspLanguageFeatures-DNfY34nV.js} +1 -1
- package/apps/web/dist/assets/{main-GXToakQe.js → main-BQi_aSBl.js} +5 -5
- package/apps/web/dist/assets/main-Dveg9bRJ.css +1 -0
- package/apps/web/dist/assets/{mdx-Bzq19TjL.js → mdx-C7pB8lGC.js} +1 -1
- package/apps/web/dist/assets/{monaco-DCdDhoJ6.js → monaco-C4Y-n5xH.js} +3 -3
- package/apps/web/dist/assets/{python-CaZSKPNI.js → python-BsYUorQU.js} +1 -1
- package/apps/web/dist/assets/{razor-CH1GgILn.js → razor-BD2nf1Tj.js} +1 -1
- package/apps/web/dist/assets/{tsMode-BWGjCNkx.js → tsMode-CajpaWj3.js} +1 -1
- package/apps/web/dist/assets/{typescript-D2FxAaol.js → typescript-CAwp5Hth.js} +1 -1
- package/apps/web/dist/assets/{workers-BUPNyHSF.js → workers-DQDsBekN.js} +1 -1
- package/apps/web/dist/assets/{xml-nOgwOHKV.js → xml-VeRYpQOb.js} +1 -1
- package/apps/web/dist/assets/{yaml-CyK2AZ1G.js → yaml-gvfBPNHx.js} +1 -1
- package/apps/web/dist/favicon.svg +4 -4
- package/apps/web/dist/index.html +1 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/main-Bm74KyWu.css +0 -1
package/apps/server/dist/cli.js
CHANGED
|
@@ -322,19 +322,19 @@ async function runCli(argv, io) {
|
|
|
322
322
|
case "logs": return await runLogs(parsed, io);
|
|
323
323
|
case "doctor": return await runDoctorCommand(io);
|
|
324
324
|
case "start": {
|
|
325
|
-
const { startCommand } = await import("./lifecycle-
|
|
325
|
+
const { startCommand } = await import("./lifecycle-CAl_1GBj.js");
|
|
326
326
|
return await startCommand(io);
|
|
327
327
|
}
|
|
328
328
|
case "stop": {
|
|
329
|
-
const { stopCommand } = await import("./lifecycle-
|
|
329
|
+
const { stopCommand } = await import("./lifecycle-CAl_1GBj.js");
|
|
330
330
|
return await stopCommand(io);
|
|
331
331
|
}
|
|
332
332
|
case "restart": {
|
|
333
|
-
const { restartCommand } = await import("./lifecycle-
|
|
333
|
+
const { restartCommand } = await import("./lifecycle-CAl_1GBj.js");
|
|
334
334
|
return await restartCommand(io);
|
|
335
335
|
}
|
|
336
336
|
case "tui": {
|
|
337
|
-
const { tuiCommand } = await import("./lifecycle-
|
|
337
|
+
const { tuiCommand } = await import("./lifecycle-CAl_1GBj.js");
|
|
338
338
|
return await tuiCommand(io);
|
|
339
339
|
}
|
|
340
340
|
case "unlock": {
|
|
@@ -48,6 +48,25 @@ import websocket from "@fastify/websocket";
|
|
|
48
48
|
import { CronExpressionParser } from "cron-parser";
|
|
49
49
|
import { parse } from "node:querystring";
|
|
50
50
|
import pino from "pino";
|
|
51
|
+
// src/bootstrap/entry.ts
|
|
52
|
+
/**
|
|
53
|
+
* Finishes the entry process after a graceful shutdown. The shutdown promise
|
|
54
|
+
* only resolves after resources, the instance lock and the logger are done, so
|
|
55
|
+
* exiting here does not wait for third-party handles that may keep the event
|
|
56
|
+
* loop alive.
|
|
57
|
+
*/
|
|
58
|
+
async function completeShutdown(options) {
|
|
59
|
+
try {
|
|
60
|
+
await options.shutdown;
|
|
61
|
+
} catch {
|
|
62
|
+
options.onError?.();
|
|
63
|
+
options.disconnect?.();
|
|
64
|
+
options.exit(1);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
options.disconnect?.();
|
|
68
|
+
options.exit(0);
|
|
69
|
+
}
|
|
51
70
|
// ../../packages/agent/src/kernel/profile.ts
|
|
52
71
|
function profileToolNames(catalog, profile) {
|
|
53
72
|
const entry = catalog.profiles[profile];
|
|
@@ -38982,6 +39001,16 @@ async function startServer(options = {}) {
|
|
|
38982
39001
|
}
|
|
38983
39002
|
}
|
|
38984
39003
|
// src/index.ts
|
|
39004
|
+
function finishShutdown(running, reason) {
|
|
39005
|
+
return completeShutdown({
|
|
39006
|
+
shutdown: running.shutdown(reason),
|
|
39007
|
+
disconnect: () => {
|
|
39008
|
+
if (process.connected) process.disconnect();
|
|
39009
|
+
},
|
|
39010
|
+
exit: (code) => process.exit(code),
|
|
39011
|
+
onError: () => console.error("[larness] shutdown failed")
|
|
39012
|
+
});
|
|
39013
|
+
}
|
|
38985
39014
|
async function main() {
|
|
38986
39015
|
const managedDev = process.argv.includes("--managed-dev-web");
|
|
38987
39016
|
let running = null;
|
|
@@ -38990,12 +39019,7 @@ async function main() {
|
|
|
38990
39019
|
const stop = (signal) => {
|
|
38991
39020
|
stopping ??= signal;
|
|
38992
39021
|
abort.abort();
|
|
38993
|
-
if (running) running
|
|
38994
|
-
if (process.connected) process.disconnect();
|
|
38995
|
-
}).catch(() => {
|
|
38996
|
-
console.error("[larness] shutdown failed");
|
|
38997
|
-
process.exitCode = 1;
|
|
38998
|
-
});
|
|
39022
|
+
if (running) finishShutdown(running, signal);
|
|
38999
39023
|
};
|
|
39000
39024
|
process.once("SIGINT", () => stop("SIGINT"));
|
|
39001
39025
|
process.once("SIGTERM", () => stop("SIGTERM"));
|
|
@@ -39009,8 +39033,7 @@ async function main() {
|
|
|
39009
39033
|
abort.signal.throwIfAborted();
|
|
39010
39034
|
running = await startServer(target ? { devWeb: target } : {});
|
|
39011
39035
|
if (stopping) {
|
|
39012
|
-
await running
|
|
39013
|
-
if (process.connected) process.disconnect();
|
|
39036
|
+
await finishShutdown(running, stopping);
|
|
39014
39037
|
return;
|
|
39015
39038
|
}
|
|
39016
39039
|
if (target) process.send?.({
|
|
@@ -179,7 +179,7 @@ async function startCommand(io, options = {}) {
|
|
|
179
179
|
if (barriers !== null && barriers.retained > 0) io.stdout(`[larness] ${barriers.retained} write barrier(s) cannot be proven orphaned; run \`larness unlock\`\n`);
|
|
180
180
|
return 0;
|
|
181
181
|
}
|
|
182
|
-
async function stopCommand(io) {
|
|
182
|
+
async function stopCommand(io, options = {}) {
|
|
183
183
|
const dataDir = resolveDataDir(io.env);
|
|
184
184
|
const lock = await inspectInstanceLock(dataDir);
|
|
185
185
|
if (lock === null) {
|
|
@@ -191,18 +191,28 @@ async function stopCommand(io) {
|
|
|
191
191
|
return 0;
|
|
192
192
|
}
|
|
193
193
|
const pid = lock.record?.pid ?? null;
|
|
194
|
-
if (!await requestShutdown(dataDir)) {
|
|
194
|
+
if (!await (options.requestShutdown ?? requestShutdown)(dataDir)) {
|
|
195
195
|
io.stderr("[larness] the server is running but its IPC endpoint is unreachable.\n");
|
|
196
196
|
io.stderr(`[larness] pid ${pid ?? "unknown"}; data ${dataDir}\n`);
|
|
197
197
|
io.stderr("[larness] no signal was sent and the lock was left untouched.\n");
|
|
198
198
|
return 1;
|
|
199
199
|
}
|
|
200
|
+
const isAlive = options.isAlive ?? isProcessAlive;
|
|
201
|
+
const selfPid = options.selfPid ?? process.pid;
|
|
202
|
+
const timeoutMs = options.stopTimeoutMs ?? STOP_TIMEOUT_MS;
|
|
200
203
|
if (!await waitUntil(async () => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
if ((await inspectInstanceLock(dataDir))?.alive === true) return false;
|
|
205
|
+
if (pid === null || pid === selfPid) return true;
|
|
206
|
+
return !isAlive(pid);
|
|
207
|
+
}, timeoutMs)) {
|
|
208
|
+
if ((await inspectInstanceLock(dataDir))?.alive !== true) {
|
|
209
|
+
io.stderr(`[larness] the server released its lock but pid ${pid ?? "unknown"} is still running.\n`);
|
|
210
|
+
io.stderr("[larness] end that process manually before upgrading or starting another.\n");
|
|
211
|
+
io.stderr("[larness] no signal was sent.\n");
|
|
212
|
+
} else {
|
|
213
|
+
io.stderr(`[larness] the server did not stop within ${timeoutMs / 1e3}s.\n`);
|
|
214
|
+
io.stderr(`[larness] pid ${pid ?? "unknown"}; it may still be running.\n`);
|
|
215
|
+
}
|
|
206
216
|
return 1;
|
|
207
217
|
}
|
|
208
218
|
io.stdout("[larness] management server stopped.\n");
|
|
@@ -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
|
+
);
|