@vinihcrosa/lumem-os 0.6.0 → 0.7.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.
- package/README.md +16 -5
- package/bin/lumem.mjs +1110 -181
- package/dist/server/main.mjs +6434 -2764
- package/dist/web/assets/{codemirror-setup-JaVFPDhT.js → codemirror-setup-Dz1snhDw.js} +1 -1
- package/dist/web/assets/index-CS8iEPU6.css +32 -0
- package/dist/web/assets/index-e0RfxsGe.js +107 -0
- package/dist/web/index.html +2 -2
- package/drizzle/0033_agente_sempre_acp.sql +65 -0
- package/drizzle/0034_motivo_do_pendente.sql +1 -0
- package/drizzle/0035_conta_de_agente.sql +84 -0
- package/drizzle/0036_conta_do_encaixe.sql +5 -0
- package/drizzle/0037_continuacao_de_conta.sql +5 -0
- package/drizzle/0038_conta_principal.sql +7 -0
- package/drizzle/0039_espera_da_cota.sql +2 -0
- package/drizzle/0040_configuracao_do_daemon.sql +11 -0
- package/drizzle/meta/0033_snapshot.json +2644 -0
- package/drizzle/meta/0034_snapshot.json +2651 -0
- package/drizzle/meta/0035_snapshot.json +2823 -0
- package/drizzle/meta/0036_snapshot.json +2850 -0
- package/drizzle/meta/0037_snapshot.json +2870 -0
- package/drizzle/meta/0038_snapshot.json +2870 -0
- package/drizzle/meta/0039_snapshot.json +2885 -0
- package/drizzle/meta/0040_snapshot.json +2931 -0
- package/drizzle/meta/_journal.json +56 -0
- package/package.json +2 -2
- package/dist/web/assets/index-BvSMeFFu.css +0 -32
- package/dist/web/assets/index-DML0Esam.js +0 -101
package/dist/web/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Lumem-OS</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-e0RfxsGe.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CS8iEPU6.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_agent_config` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`name` text NOT NULL,
|
|
5
|
+
`command` text NOT NULL,
|
|
6
|
+
`args` text DEFAULT '[]' NOT NULL,
|
|
7
|
+
`env` text DEFAULT '{}' NOT NULL,
|
|
8
|
+
`adapter_version` text,
|
|
9
|
+
`retired_at` integer,
|
|
10
|
+
`created_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
11
|
+
`updated_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
12
|
+
CONSTRAINT "agent_config_adapter_version" CHECK("__new_agent_config"."retired_at" IS NOT NULL OR "__new_agent_config"."adapter_version" IS NOT NULL)
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
INSERT INTO `__new_agent_config`("id", "name", "command", "args", "env", "adapter_version", "retired_at", "created_at", "updated_at") SELECT "id", "name", "command", "args", "env", "adapter_version", CASE WHEN "transport" = 'pty' THEN (unixepoch('subsec') * 1000) END, "created_at", "updated_at" FROM `agent_config`;--> statement-breakpoint
|
|
16
|
+
DROP TABLE `agent_config`;--> statement-breakpoint
|
|
17
|
+
ALTER TABLE `__new_agent_config` RENAME TO `agent_config`;--> statement-breakpoint
|
|
18
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
19
|
+
CREATE UNIQUE INDEX `agent_config_name_unique` ON `agent_config` (`name`);--> statement-breakpoint
|
|
20
|
+
CREATE TABLE `__new_session` (
|
|
21
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
22
|
+
`kind` text NOT NULL,
|
|
23
|
+
`script_name` text,
|
|
24
|
+
`agent_config_id` text,
|
|
25
|
+
`scope_type` text NOT NULL,
|
|
26
|
+
`scope_id` text NOT NULL,
|
|
27
|
+
`cwd` text NOT NULL,
|
|
28
|
+
`command` text NOT NULL,
|
|
29
|
+
`state` text DEFAULT 'running' NOT NULL,
|
|
30
|
+
`exit_code` integer,
|
|
31
|
+
`transport` text DEFAULT 'pty' NOT NULL,
|
|
32
|
+
`acp_session_id` text,
|
|
33
|
+
`mode` text,
|
|
34
|
+
`model` text,
|
|
35
|
+
`lumem_mode` text DEFAULT 'ask' NOT NULL,
|
|
36
|
+
`resumed_from_id` text,
|
|
37
|
+
`task_id` text,
|
|
38
|
+
`task_role` text,
|
|
39
|
+
`pending_prompt` text,
|
|
40
|
+
`pending_reason` text,
|
|
41
|
+
`created_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
42
|
+
`updated_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
43
|
+
FOREIGN KEY (`agent_config_id`) REFERENCES `agent_config`(`id`) ON UPDATE no action ON DELETE restrict,
|
|
44
|
+
FOREIGN KEY (`task_id`) REFERENCES `task`(`id`) ON UPDATE no action ON DELETE set null,
|
|
45
|
+
CONSTRAINT "session_kind" CHECK("__new_session"."kind" IN ('shell', 'agent', 'script')),
|
|
46
|
+
CONSTRAINT "session_scope_type" CHECK("__new_session"."scope_type" IN ('project', 'worktree')),
|
|
47
|
+
CONSTRAINT "session_state" CHECK("__new_session"."state" IN ('running', 'exited')),
|
|
48
|
+
CONSTRAINT "session_agent_config" CHECK(("__new_session"."kind" = 'agent' AND "__new_session"."agent_config_id" IS NOT NULL)
|
|
49
|
+
OR ("__new_session"."kind" <> 'agent' AND "__new_session"."agent_config_id" IS NULL)),
|
|
50
|
+
CONSTRAINT "session_script_name" CHECK(("__new_session"."kind" = 'script' AND "__new_session"."script_name" IS NOT NULL
|
|
51
|
+
AND "__new_session"."script_name" IN ('setup', 'run', 'teardown', 'test'))
|
|
52
|
+
OR ("__new_session"."kind" <> 'script' AND "__new_session"."script_name" IS NULL)),
|
|
53
|
+
CONSTRAINT "session_exit_code" CHECK(("__new_session"."state" = 'running' AND "__new_session"."exit_code" IS NULL)
|
|
54
|
+
OR ("__new_session"."state" = 'exited')),
|
|
55
|
+
CONSTRAINT "session_transport" CHECK("__new_session"."transport" IN ('pty', 'acp')),
|
|
56
|
+
CONSTRAINT "session_shell_transport" CHECK("__new_session"."kind" = 'agent' OR "__new_session"."transport" = 'pty'),
|
|
57
|
+
CONSTRAINT "session_acp_id" CHECK(("__new_session"."transport" = 'acp' AND "__new_session"."acp_session_id" IS NOT NULL)
|
|
58
|
+
OR ("__new_session"."transport" = 'pty' AND "__new_session"."acp_session_id" IS NULL)),
|
|
59
|
+
CONSTRAINT "session_lumem_mode" CHECK("__new_session"."lumem_mode" IN ('ask', 'auto', 'free')),
|
|
60
|
+
CONSTRAINT "session_pending_reason" CHECK("__new_session"."pending_reason" IS NULL OR "__new_session"."pending_reason" IN ('setup_failed'))
|
|
61
|
+
);
|
|
62
|
+
--> statement-breakpoint
|
|
63
|
+
INSERT INTO `__new_session`("id", "kind", "script_name", "agent_config_id", "scope_type", "scope_id", "cwd", "command", "state", "exit_code", "transport", "acp_session_id", "mode", "model", "lumem_mode", "resumed_from_id", "task_id", "task_role", "pending_prompt", "pending_reason", "created_at", "updated_at") SELECT "id", "kind", "script_name", "agent_config_id", "scope_type", "scope_id", "cwd", "command", "state", "exit_code", "transport", "acp_session_id", "mode", "model", "lumem_mode", "resumed_from_id", "task_id", "task_role", NULL, NULL, "created_at", "updated_at" FROM `session`;--> statement-breakpoint
|
|
64
|
+
DROP TABLE `session`;--> statement-breakpoint
|
|
65
|
+
ALTER TABLE `__new_session` RENAME TO `session`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `session` ADD `pending_detail` text;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
CREATE TABLE `agent_account` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`agent_config_id` text NOT NULL,
|
|
4
|
+
`label` text NOT NULL,
|
|
5
|
+
`kind` text DEFAULT 'subscription' NOT NULL,
|
|
6
|
+
`config_dir` text,
|
|
7
|
+
`identity` text,
|
|
8
|
+
`default_model` text,
|
|
9
|
+
`default_effort` text,
|
|
10
|
+
`state` text DEFAULT 'connected' NOT NULL,
|
|
11
|
+
`created_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
12
|
+
`updated_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
13
|
+
FOREIGN KEY (`agent_config_id`) REFERENCES `agent_config`(`id`) ON UPDATE no action ON DELETE restrict,
|
|
14
|
+
CONSTRAINT "agent_account_kind" CHECK("agent_account"."kind" IN ('subscription', 'api_key')),
|
|
15
|
+
CONSTRAINT "agent_account_state" CHECK("agent_account"."state" IN ('connected', 'disconnected'))
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
CREATE UNIQUE INDEX `agent_account_config_dir` ON `agent_account` (`config_dir`);--> statement-breakpoint
|
|
19
|
+
CREATE UNIQUE INDEX `agent_account_one_bare_per_agent` ON `agent_account` (`agent_config_id`) WHERE config_dir IS NULL;--> statement-breakpoint
|
|
20
|
+
CREATE UNIQUE INDEX `agent_account_label_per_agent` ON `agent_account` (`agent_config_id`,`label`);--> statement-breakpoint
|
|
21
|
+
-- Escrito à mão (`034` T4): a conta que já existia. Uma por configuração, com
|
|
22
|
+
-- `config_dir` nulo — a que sobe sem a variável, e por isso ninguém reloga —, o
|
|
23
|
+
-- nome do agente como rótulo, e marcada padrão. Inclusive a aposentada: a sessão
|
|
24
|
+
-- PTY de ontem aponta para ela, e a CHECK estendida exige conta nas duas.
|
|
25
|
+
ALTER TABLE `agent_config` ADD `default_account_id` text;--> statement-breakpoint
|
|
26
|
+
INSERT INTO `agent_account`("id", "agent_config_id", "label") SELECT lower(hex(randomblob(4))) || '-' || lower(hex(randomblob(2))) || '-4' || substr(lower(hex(randomblob(2))), 2) || '-' || substr('89ab', 1 + (abs(random()) % 4), 1) || substr(lower(hex(randomblob(2))), 2) || '-' || lower(hex(randomblob(6))), "id", "name" FROM `agent_config`;--> statement-breakpoint
|
|
27
|
+
UPDATE `agent_config` SET "default_account_id" = (SELECT "id" FROM `agent_account` WHERE `agent_account`."agent_config_id" = `agent_config`."id");--> statement-breakpoint
|
|
28
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
29
|
+
CREATE TABLE `__new_session` (
|
|
30
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
31
|
+
`kind` text NOT NULL,
|
|
32
|
+
`script_name` text,
|
|
33
|
+
`agent_config_id` text,
|
|
34
|
+
`agent_account_id` text,
|
|
35
|
+
`scope_type` text NOT NULL,
|
|
36
|
+
`scope_id` text NOT NULL,
|
|
37
|
+
`cwd` text NOT NULL,
|
|
38
|
+
`command` text NOT NULL,
|
|
39
|
+
`state` text DEFAULT 'running' NOT NULL,
|
|
40
|
+
`exit_code` integer,
|
|
41
|
+
`transport` text DEFAULT 'pty' NOT NULL,
|
|
42
|
+
`acp_session_id` text,
|
|
43
|
+
`mode` text,
|
|
44
|
+
`model` text,
|
|
45
|
+
`lumem_mode` text DEFAULT 'ask' NOT NULL,
|
|
46
|
+
`resumed_from_id` text,
|
|
47
|
+
`task_id` text,
|
|
48
|
+
`task_role` text,
|
|
49
|
+
`pending_prompt` text,
|
|
50
|
+
`pending_reason` text,
|
|
51
|
+
`pending_detail` text,
|
|
52
|
+
`created_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
53
|
+
`updated_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
54
|
+
FOREIGN KEY (`agent_config_id`) REFERENCES `agent_config`(`id`) ON UPDATE no action ON DELETE restrict,
|
|
55
|
+
FOREIGN KEY (`agent_account_id`) REFERENCES `agent_account`(`id`) ON UPDATE no action ON DELETE restrict,
|
|
56
|
+
FOREIGN KEY (`task_id`) REFERENCES `task`(`id`) ON UPDATE no action ON DELETE set null,
|
|
57
|
+
CONSTRAINT "session_kind" CHECK("__new_session"."kind" IN ('shell', 'agent', 'script')),
|
|
58
|
+
CONSTRAINT "session_scope_type" CHECK("__new_session"."scope_type" IN ('project', 'worktree')),
|
|
59
|
+
CONSTRAINT "session_state" CHECK("__new_session"."state" IN ('running', 'exited')),
|
|
60
|
+
CONSTRAINT "session_agent_config" CHECK(("__new_session"."kind" = 'agent' AND "__new_session"."agent_config_id" IS NOT NULL
|
|
61
|
+
AND "__new_session"."agent_account_id" IS NOT NULL)
|
|
62
|
+
OR ("__new_session"."kind" <> 'agent' AND "__new_session"."agent_config_id" IS NULL
|
|
63
|
+
AND "__new_session"."agent_account_id" IS NULL)),
|
|
64
|
+
CONSTRAINT "session_script_name" CHECK(("__new_session"."kind" = 'script' AND "__new_session"."script_name" IS NOT NULL
|
|
65
|
+
AND "__new_session"."script_name" IN ('setup', 'run', 'teardown', 'test'))
|
|
66
|
+
OR ("__new_session"."kind" <> 'script' AND "__new_session"."script_name" IS NULL)),
|
|
67
|
+
CONSTRAINT "session_exit_code" CHECK(("__new_session"."state" = 'running' AND "__new_session"."exit_code" IS NULL)
|
|
68
|
+
OR ("__new_session"."state" = 'exited')),
|
|
69
|
+
CONSTRAINT "session_transport" CHECK("__new_session"."transport" IN ('pty', 'acp')),
|
|
70
|
+
CONSTRAINT "session_shell_transport" CHECK("__new_session"."kind" = 'agent' OR "__new_session"."transport" = 'pty'),
|
|
71
|
+
CONSTRAINT "session_acp_id" CHECK(("__new_session"."transport" = 'acp' AND "__new_session"."acp_session_id" IS NOT NULL)
|
|
72
|
+
OR ("__new_session"."transport" = 'pty' AND "__new_session"."acp_session_id" IS NULL)),
|
|
73
|
+
CONSTRAINT "session_lumem_mode" CHECK("__new_session"."lumem_mode" IN ('ask', 'auto', 'free')),
|
|
74
|
+
CONSTRAINT "session_pending_reason" CHECK("__new_session"."pending_reason" IS NULL OR "__new_session"."pending_reason" IN ('setup_failed'))
|
|
75
|
+
);
|
|
76
|
+
--> statement-breakpoint
|
|
77
|
+
INSERT INTO `__new_session`("id", "kind", "script_name", "agent_config_id", "agent_account_id", "scope_type", "scope_id", "cwd", "command", "state", "exit_code", "transport", "acp_session_id", "mode", "model", "lumem_mode", "resumed_from_id", "task_id", "task_role", "pending_prompt", "pending_reason", "pending_detail", "created_at", "updated_at") SELECT "id", "kind", "script_name", "agent_config_id", (SELECT `agent_account`."id" FROM `agent_account` WHERE `agent_account`."agent_config_id" = `session`."agent_config_id"), "scope_type", "scope_id", "cwd", "command", "state", "exit_code", "transport", "acp_session_id", "mode", "model", "lumem_mode", "resumed_from_id", "task_id", "task_role", "pending_prompt", "pending_reason", "pending_detail", "created_at", "updated_at" FROM `session`;--> statement-breakpoint
|
|
78
|
+
DROP TABLE `session`;--> statement-breakpoint
|
|
79
|
+
ALTER TABLE `__new_session` RENAME TO `session`;--> statement-breakpoint
|
|
80
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
81
|
+
ALTER TABLE `session_usage` ADD `agent_account_id` text;--> statement-breakpoint
|
|
82
|
+
-- Escrito à mão: o consumo antigo vai para a conta da sessão que o gastou, e o
|
|
83
|
+
-- de uma sessão que já foi apagada, para a conta da configuração dele.
|
|
84
|
+
UPDATE `session_usage` SET "agent_account_id" = COALESCE((SELECT `session`."agent_account_id" FROM `session` WHERE `session`."id" = `session_usage`."session_id"), (SELECT `agent_account`."id" FROM `agent_account` WHERE `agent_account`."agent_config_id" = `session_usage`."agent_config_id")) WHERE "agent_config_id" IS NOT NULL;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
-- Escrito à mão (`034` T10): o `drizzle-kit` gerou o `REFERENCES` sem `ON DELETE`
|
|
2
|
+
-- — a armadilha da `0014` —, e `NO ACTION` recusaria apagar de vez uma conta que
|
|
3
|
+
-- um agente nomeado cita. O schema declara `set null`: o encaixe volta a herdar.
|
|
4
|
+
ALTER TABLE `named_agent` ADD `account_id` text REFERENCES agent_account(id) ON DELETE set null;--> statement-breakpoint
|
|
5
|
+
ALTER TABLE `named_agent` ADD `effort` text;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
-- Escrito à mão (`034` T11): o `drizzle-kit` gerou o `REFERENCES` sem `ON DELETE`
|
|
2
|
+
-- — a armadilha da `0014`, de novo —, e `NO ACTION` recusaria apagar de vez a
|
|
3
|
+
-- sessão de origem de uma continuação. O schema declara `set null`: a continuação
|
|
4
|
+
-- sobrevive sem o ponteiro.
|
|
5
|
+
ALTER TABLE `session` ADD `continued_from_id` text REFERENCES session(id) ON DELETE set null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Escrito à mão (`034` T18): só dado, e por isso o `drizzle-kit generate --custom`
|
|
2
|
+
-- não tem o que gerar. A conta que já existia nasceu na `0035` com o nome do
|
|
3
|
+
-- agente, e o cabeçalho lia `claude · claude` — contra a Q2 (*"o nome é seu"*).
|
|
4
|
+
-- Ela passa a se chamar `principal`, e se renomeia na tela. Só a sem diretório e
|
|
5
|
+
-- só com o rótulo que a `0035` deu: rótulo que alguém digitou não se toca, nem o
|
|
6
|
+
-- que bateria no índice único por já haver uma `principal` naquele agente.
|
|
7
|
+
UPDATE `agent_account` SET "label" = 'principal' WHERE "config_dir" IS NULL AND "label" = (SELECT `agent_config`."name" FROM `agent_config` WHERE `agent_config`."id" = `agent_account`."agent_config_id") AND NOT EXISTS (SELECT 1 FROM `agent_account` AS `other` WHERE `other`."agent_config_id" = `agent_account`."agent_config_id" AND `other`."label" = 'principal');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
CREATE TABLE `daemon_settings` (
|
|
2
|
+
`id` integer PRIMARY KEY NOT NULL,
|
|
3
|
+
`update_check` integer DEFAULT 1 NOT NULL,
|
|
4
|
+
`auto_update` text DEFAULT 'off' NOT NULL,
|
|
5
|
+
CONSTRAINT "daemon_settings_single_row" CHECK("daemon_settings"."id" = 1),
|
|
6
|
+
CONSTRAINT "daemon_settings_update_check" CHECK("daemon_settings"."update_check" IN (0, 1)),
|
|
7
|
+
CONSTRAINT "daemon_settings_auto_update" CHECK("daemon_settings"."auto_update" IN ('off', 'idle'))
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
-- A única linha, com os padrões da tabela (`038` C24): quem lê nunca trata a ausência.
|
|
11
|
+
INSERT INTO `daemon_settings` (`id`) VALUES (1);
|