@lmctl-ai/lmctl 0.2.37 → 0.2.39
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 -0
- package/THIRD_PARTY_NOTICES.md +35 -0
- package/bin/lmbee +2 -0
- package/bin/lmscript +3 -0
- package/build-info.json +1 -0
- package/dist/cli/index.js +569 -494
- package/dist/cli/schema.sql +0 -169
- package/dist/cli/script.js +273 -266
- package/dist/lmbee.js +960 -0
- package/dist/lmscript.js +388 -0
- package/dist/public/app.js +379 -0
- package/dist/public/index.html +78 -0
- package/dist/public/styles.css +160 -0
- package/dist/schema.sql +455 -0
- package/dist/vendor-webui/index.html +18 -0
- package/dist/vendor-webui/local.js +231 -0
- package/dist/vendor-webui/styles.css +1852 -0
- package/package.json +12 -7
- package/dist/cli/batch.d.ts +0 -2
- package/dist/cli/busy-evidence.d.ts +0 -27
- package/dist/cli/chat-cycle.d.ts +0 -59
- package/dist/cli/chat-exec.d.ts +0 -91
- package/dist/cli/chat-policy.d.ts +0 -22
- package/dist/cli/chat.d.ts +0 -14
- package/dist/cli/code-resolver.d.ts +0 -8
- package/dist/cli/common.d.ts +0 -57
- package/dist/cli/context.d.ts +0 -12
- package/dist/cli/cost.d.ts +0 -2
- package/dist/cli/export.d.ts +0 -2
- package/dist/cli/hello.d.ts +0 -10
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/infra.d.ts +0 -78
- package/dist/cli/init.d.ts +0 -21
- package/dist/cli/intent-input.d.ts +0 -16
- package/dist/cli/intent-match.d.ts +0 -30
- package/dist/cli/intent-sessions.d.ts +0 -24
- package/dist/cli/intent-team.d.ts +0 -25
- package/dist/cli/intent.d.ts +0 -22
- package/dist/cli/ls.d.ts +0 -2
- package/dist/cli/mailbox-cli.d.ts +0 -6
- package/dist/cli/managed.d.ts +0 -62
- package/dist/cli/mcp-install.d.ts +0 -23
- package/dist/cli/mcp.d.ts +0 -2
- package/dist/cli/model.d.ts +0 -21
- package/dist/cli/paths.d.ts +0 -50
- package/dist/cli/plan-wizard.d.ts +0 -42
- package/dist/cli/plan.d.ts +0 -20
- package/dist/cli/queue-delivery.d.ts +0 -122
- package/dist/cli/quickrun.d.ts +0 -14
- package/dist/cli/ratelimit.d.ts +0 -2
- package/dist/cli/remote-fetch.d.ts +0 -7
- package/dist/cli/run-queries.d.ts +0 -82
- package/dist/cli/running.d.ts +0 -5
- package/dist/cli/save-script.d.ts +0 -41
- package/dist/cli/script.d.ts +0 -6
- package/dist/cli/seed-flight.d.ts +0 -2
- package/dist/cli/self-identity.d.ts +0 -25
- package/dist/cli/session-idle.d.ts +0 -118
- package/dist/cli/status.d.ts +0 -22
- package/dist/cli/tail.d.ts +0 -18
- package/dist/cli/target-resolver.d.ts +0 -139
- package/dist/cli/team-status.d.ts +0 -91
- package/dist/cli/teamfile-compat.d.ts +0 -116
- package/dist/cli/teamfile-store.d.ts +0 -18
- package/dist/cli/teamfile-template.d.ts +0 -47
- package/dist/cli/template-env.d.ts +0 -25
- package/dist/cli/terminal-lock.d.ts +0 -25
- package/dist/cli/terminal.d.ts +0 -23
- package/dist/cli/time-filter.d.ts +0 -10
- package/dist/cli/update-notifier.d.ts +0 -11
- package/dist/cli/version-util.d.ts +0 -23
- package/dist/config/seed_templates.d.ts +0 -1
- package/dist/db/backfill-event-log.d.ts +0 -26
- package/dist/db/delegation.d.ts +0 -37
- package/dist/db/escalation_vocab.d.ts +0 -45
- package/dist/db/event-log.d.ts +0 -40
- package/dist/db/index.d.ts +0 -1213
- package/dist/db/inflight-acquire.d.ts +0 -70
- package/dist/db/invocation-event-projections.d.ts +0 -65
- package/dist/db/ledger-identity.test.d.ts +0 -1
- package/dist/db/live-event-projections.d.ts +0 -92
- package/dist/db/migrate.d.ts +0 -51
- package/dist/db/open-readonly.d.ts +0 -2
- package/dist/db/process-liveness.d.ts +0 -37
- package/dist/db/sqlite.d.ts +0 -53
- package/dist/db/sqlite.test.d.ts +0 -1
- package/dist/db/terminal-lock.d.ts +0 -14
- package/dist/db/tracked-invocation-reconcile.d.ts +0 -52
- package/dist/db/tracked-invocation.d.ts +0 -116
- package/dist/mcp/dispatch.d.ts +0 -45
- package/dist/mcp/mediation.d.ts +0 -128
- package/dist/mcp/path-warning.d.ts +0 -7
- package/dist/mcp/server.d.ts +0 -63
- package/dist/mcp/tools.d.ts +0 -24
- package/dist/providers/adapter.d.ts +0 -271
- package/dist/providers/adapters/agy-adapter.d.ts +0 -18
- package/dist/providers/adapters/claude-adapter.d.ts +0 -20
- package/dist/providers/adapters/codex-adapter.d.ts +0 -22
- package/dist/providers/adapters/copilot-adapter.d.ts +0 -16
- package/dist/providers/adapters/dsh-adapter.d.ts +0 -89
- package/dist/providers/adapters/gemini-adapter.d.ts +0 -44
- package/dist/providers/adapters/hermes-adapter.d.ts +0 -71
- package/dist/providers/adapters/index.d.ts +0 -35
- package/dist/providers/adapters/kimi-adapter.d.ts +0 -16
- package/dist/providers/adapters/lmplayer-adapter.d.ts +0 -14
- package/dist/providers/adapters/opencode-adapter.d.ts +0 -11
- package/dist/providers/adapters/pi-adapter.d.ts +0 -17
- package/dist/providers/adapters/print-turn.d.ts +0 -29
- package/dist/providers/adapters/qwen-adapter.d.ts +0 -11
- package/dist/providers/agy.d.ts +0 -32
- package/dist/providers/base-adapter.d.ts +0 -110
- package/dist/providers/base.d.ts +0 -12
- package/dist/providers/binary-check.d.ts +0 -102
- package/dist/providers/bundle.d.ts +0 -124
- package/dist/providers/claude-mock.d.ts +0 -90
- package/dist/providers/claude.d.ts +0 -21
- package/dist/providers/codex-config.d.ts +0 -15
- package/dist/providers/codex.d.ts +0 -25
- package/dist/providers/config/init-config.d.ts +0 -43
- package/dist/providers/config/model-selection-lint.d.ts +0 -70
- package/dist/providers/config/team-config.d.ts +0 -184
- package/dist/providers/config/types.d.ts +0 -146
- package/dist/providers/config/user-config.d.ts +0 -88
- package/dist/providers/copilot.d.ts +0 -21
- package/dist/providers/debug.d.ts +0 -128
- package/dist/providers/dsh-sidecar.d.ts +0 -65
- package/dist/providers/dsh-zstd.d.ts +0 -27
- package/dist/providers/dsh.d.ts +0 -37
- package/dist/providers/frontmatter.d.ts +0 -46
- package/dist/providers/gemini-session-reader.d.ts +0 -151
- package/dist/providers/gemini.d.ts +0 -39
- package/dist/providers/hermes.d.ts +0 -90
- package/dist/providers/index.d.ts +0 -423
- package/dist/providers/kimi.d.ts +0 -37
- package/dist/providers/model-catalog.d.ts +0 -145
- package/dist/providers/model-suggestions.d.ts +0 -4
- package/dist/providers/one-shot-timeout.d.ts +0 -1
- package/dist/providers/opencode-config.d.ts +0 -62
- package/dist/providers/opencode.d.ts +0 -40
- package/dist/providers/parsers/acp.d.ts +0 -71
- package/dist/providers/parsers/codex-app-server.d.ts +0 -60
- package/dist/providers/parsers/stream-json.d.ts +0 -57
- package/dist/providers/passive-readers/agy.d.ts +0 -155
- package/dist/providers/passive-readers/copilot.d.ts +0 -173
- package/dist/providers/passive-readers/dsh.d.ts +0 -34
- package/dist/providers/passive-readers/kimi.d.ts +0 -44
- package/dist/providers/passive-readers/opencode.d.ts +0 -89
- package/dist/providers/passive-readers/qwen.d.ts +0 -151
- package/dist/providers/passive-readers/shared.d.ts +0 -138
- package/dist/providers/passive-session-reader.d.ts +0 -188
- package/dist/providers/path-utils.d.ts +0 -1
- package/dist/providers/pi.d.ts +0 -32
- package/dist/providers/pricing.d.ts +0 -107
- package/dist/providers/qwen.d.ts +0 -22
- package/dist/providers/ratelimit/agy.d.ts +0 -22
- package/dist/providers/ratelimit/claude-auth.d.ts +0 -13
- package/dist/providers/ratelimit/claude.d.ts +0 -6
- package/dist/providers/ratelimit/codex.d.ts +0 -7
- package/dist/providers/ratelimit/kimi-auth.d.ts +0 -15
- package/dist/providers/ratelimit/kimi.d.ts +0 -6
- package/dist/providers/ratelimit/schema.d.ts +0 -28
- package/dist/providers/ratelimit-readings.d.ts +0 -19
- package/dist/providers/registry.d.ts +0 -31
- package/dist/providers/resume.d.ts +0 -43
- package/dist/providers/seed-instruction.d.ts +0 -3
- package/dist/providers/self-session-env.d.ts +0 -21
- package/dist/providers/session-limit.d.ts +0 -9
- package/dist/providers/strip-ansi.d.ts +0 -5
- package/dist/providers/transport-errors.d.ts +0 -94
- package/dist/providers/transport-lifecycle.d.ts +0 -63
- package/dist/providers/transport-wrappers.d.ts +0 -110
- package/dist/providers/transports/acp-profiles/config-option-step.d.ts +0 -24
- package/dist/providers/transports/acp-profiles/copilot.d.ts +0 -12
- package/dist/providers/transports/acp-profiles/gemini.d.ts +0 -22
- package/dist/providers/transports/acp-profiles/hermes.d.ts +0 -27
- package/dist/providers/transports/acp-profiles/index.d.ts +0 -19
- package/dist/providers/transports/acp-profiles/kimi.d.ts +0 -24
- package/dist/providers/transports/acp-profiles/opencode.d.ts +0 -26
- package/dist/providers/transports/acp-profiles/types.d.ts +0 -258
- package/dist/providers/transports/acp-rpc.d.ts +0 -18
- package/dist/providers/transports/acp.d.ts +0 -217
- package/dist/providers/transports/codex-app-server.d.ts +0 -190
- package/dist/providers/transports/hold-open.d.ts +0 -120
- package/dist/providers/transports/manager.d.ts +0 -21
- package/dist/providers/transports/stream-json.d.ts +0 -162
- package/dist/providers/transports/types.d.ts +0 -56
- package/dist/providers/types.d.ts +0 -154
- package/dist/providers/yolo-contract.d.ts +0 -131
- package/dist/script/adapter.d.ts +0 -104
- package/dist/script/batch-script.d.ts +0 -7
- package/dist/script/index.d.ts +0 -3
- package/dist/script/lmbee-module.d.ts +0 -2
- package/dist/script/lmscript.d.ts +0 -616
- package/dist/shared/policy.d.ts +0 -74
- package/dist/shared-lib/db.d.ts +0 -25
- package/dist/shared-lib/passive-session-reader.d.ts +0 -2
- package/dist/shared-lib/provider-parse.d.ts +0 -6
- package/dist/templates/basedir.d.ts +0 -52
- package/dist/uri/lmctl_uri.d.ts +0 -38
package/dist/cli/schema.sql
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
-- lmctl-next v1 schema. Forward-only migration; see migrate.ts.
|
|
2
|
-
-- Timestamps are ISO-8601 UTC TEXT values.
|
|
3
1
|
|
|
4
|
-
-- Workflows (declarative, JSON-stored). Versioned.
|
|
5
2
|
CREATE TABLE workflow (
|
|
6
3
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
7
4
|
name TEXT NOT NULL,
|
|
@@ -10,18 +7,11 @@ CREATE TABLE workflow (
|
|
|
10
7
|
definition TEXT NOT NULL,
|
|
11
8
|
active_version_id INTEGER REFERENCES workflow_version(id),
|
|
12
9
|
created_at TEXT NOT NULL,
|
|
13
|
-
-- P2 (distribution-redesign §2): additive, nullable template provenance.
|
|
14
|
-
-- Populated when a workflow is loaded from a known template/path; NULL
|
|
15
|
-
-- everywhere else (zero back-compat break — old rows stay NULL). Mirrors
|
|
16
|
-
-- the v26 migration block byte-for-byte so a fresh schema.sql DB and a
|
|
17
|
-
-- v25→v26 migrated DB converge.
|
|
18
10
|
source_uri TEXT,
|
|
19
11
|
source_sha256 TEXT,
|
|
20
12
|
UNIQUE(name, version)
|
|
21
13
|
);
|
|
22
14
|
|
|
23
|
-
-- V3.1: immutable workflow JSON snapshots. Future editor flows append rows
|
|
24
|
-
-- here and point workflow.active_version_id at the current snapshot.
|
|
25
15
|
CREATE TABLE workflow_version (
|
|
26
16
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
27
17
|
workflow_id INTEGER NOT NULL REFERENCES workflow(id),
|
|
@@ -33,7 +23,6 @@ CREATE TABLE workflow_version (
|
|
|
33
23
|
);
|
|
34
24
|
CREATE INDEX IF NOT EXISTS idx_workflow_version_wf ON workflow_version(workflow_id, version DESC);
|
|
35
25
|
|
|
36
|
-
-- Teams (replaces .lmctl files).
|
|
37
26
|
CREATE TABLE team (
|
|
38
27
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
39
28
|
name TEXT NOT NULL UNIQUE,
|
|
@@ -59,7 +48,6 @@ CREATE TABLE team_member (
|
|
|
59
48
|
UNIQUE(team_id, alias)
|
|
60
49
|
);
|
|
61
50
|
|
|
62
|
-
-- Interpreter members can observe companion agent members.
|
|
63
51
|
CREATE TABLE team_member_companion (
|
|
64
52
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
65
53
|
interpreter_id INTEGER NOT NULL REFERENCES team_member(id),
|
|
@@ -68,10 +56,6 @@ CREATE TABLE team_member_companion (
|
|
|
68
56
|
UNIQUE(interpreter_id, companion_id)
|
|
69
57
|
);
|
|
70
58
|
|
|
71
|
-
-- Projects (target repos/codebases). Workflow name resolves to a version at job->run creation.
|
|
72
|
-
-- v23: the per-project workflow lock columns (active_run_id / active_locked_at /
|
|
73
|
-
-- active_locked_by / active_locked_expires_at) were removed under the V4
|
|
74
|
-
-- master-agent architecture. Serialization is structural now.
|
|
75
59
|
CREATE TABLE project (
|
|
76
60
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
77
61
|
name TEXT NOT NULL,
|
|
@@ -82,22 +66,12 @@ CREATE TABLE project (
|
|
|
82
66
|
default_branch TEXT,
|
|
83
67
|
intake_config TEXT,
|
|
84
68
|
test_argv TEXT,
|
|
85
|
-
-- DG-6 D-6 / v31: per-project test command consumed by the
|
|
86
|
-
-- `lmctl/shell-step` `focused_test` step in the bugfix-* workflows.
|
|
87
|
-
-- When NULL or empty the `{{project.test_command}}` template
|
|
88
|
-
-- substituter falls back to `npm test` for backward-compat (matches
|
|
89
|
-
-- the historical hardcode the column replaces). Set to a project-
|
|
90
|
-
-- specific command (e.g. "go test ./...", "cargo test --quiet") to
|
|
91
|
-
-- target non-Node projects without forking the workflow JSON.
|
|
92
|
-
-- ADDITIVE ONLY — no existing column altered/dropped.
|
|
93
69
|
test_command TEXT,
|
|
94
70
|
durable_memory_mode TEXT NOT NULL DEFAULT 'folder' CHECK(durable_memory_mode IN ('folder','db')),
|
|
95
71
|
created_at TEXT NOT NULL,
|
|
96
72
|
UNIQUE(name)
|
|
97
73
|
);
|
|
98
74
|
|
|
99
|
-
-- App 2 / v17: project-to-workflow dispatcher rows. Each enabled row
|
|
100
|
-
-- can match an intake event and enqueue a job for its workflow.
|
|
101
75
|
CREATE TABLE project_workflow (
|
|
102
76
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
103
77
|
project_id INTEGER NOT NULL REFERENCES project(id),
|
|
@@ -110,8 +84,6 @@ CREATE TABLE project_workflow (
|
|
|
110
84
|
UNIQUE(project_id, workflow_id, condition)
|
|
111
85
|
);
|
|
112
86
|
|
|
113
|
-
-- Post-V3 Step 1 / v18: per-project issue queue. QA producers create
|
|
114
|
-
-- failures; PR-fix consumers atomically claim and close them.
|
|
115
87
|
CREATE TABLE project_issue (
|
|
116
88
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
117
89
|
project_id INTEGER NOT NULL REFERENCES project(id),
|
|
@@ -130,7 +102,6 @@ CREATE TABLE project_issue (
|
|
|
130
102
|
closed_at TEXT
|
|
131
103
|
);
|
|
132
104
|
|
|
133
|
-
-- Jobs: SQLite-backed queue.
|
|
134
105
|
CREATE TABLE job (
|
|
135
106
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
136
107
|
project_id INTEGER NOT NULL REFERENCES project(id),
|
|
@@ -154,7 +125,6 @@ CREATE TABLE job (
|
|
|
154
125
|
UNIQUE(source, dedupe_key)
|
|
155
126
|
);
|
|
156
127
|
|
|
157
|
-
-- Runs: an instance of a workflow execution against a job.
|
|
158
128
|
CREATE TABLE run (
|
|
159
129
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
160
130
|
job_id INTEGER NOT NULL REFERENCES job(id),
|
|
@@ -168,12 +138,9 @@ CREATE TABLE run (
|
|
|
168
138
|
paused_at TEXT,
|
|
169
139
|
blocker TEXT,
|
|
170
140
|
parent_run_id INTEGER REFERENCES run(id),
|
|
171
|
-
-- DEF-1 v27: step.id-keyed JSON map of the operator escalation-resume
|
|
172
|
-
-- decision. Additive nullable; old rows NULL. Mirrors the v27 migration.
|
|
173
141
|
pending_escalation_decision TEXT
|
|
174
142
|
);
|
|
175
143
|
|
|
176
|
-
-- Steps: one row per state transition inside a run.
|
|
177
144
|
CREATE TABLE step (
|
|
178
145
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
179
146
|
run_id INTEGER NOT NULL REFERENCES run(id),
|
|
@@ -185,7 +152,6 @@ CREATE TABLE step (
|
|
|
185
152
|
ended_at TEXT
|
|
186
153
|
);
|
|
187
154
|
|
|
188
|
-
-- V3.2: per-workflow trigger registrations polled by trigger_watcher.
|
|
189
155
|
CREATE TABLE trigger_instance (
|
|
190
156
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
191
157
|
workflow_id INTEGER NOT NULL REFERENCES workflow(id),
|
|
@@ -201,15 +167,6 @@ CREATE TABLE trigger_instance (
|
|
|
201
167
|
UNIQUE(workflow_id, trigger_id)
|
|
202
168
|
);
|
|
203
169
|
|
|
204
|
-
-- Step artifacts (transcripts, file paths, inline content).
|
|
205
|
-
--
|
|
206
|
-
-- `provider_call_mode` (A2.5): when the artifact was produced by a
|
|
207
|
-
-- provider-backed step (engine chat() call), this column records
|
|
208
|
-
-- whether the chat went through the in-process library path or the
|
|
209
|
-
-- legacy `lmctl chat` subprocess. Values: 'library' | 'subprocess'
|
|
210
|
-
-- | NULL (artifact wasn't produced by a chat call). Lets audits
|
|
211
|
-
-- answer "was this turn run in-process?" without grepping
|
|
212
|
-
-- process trees.
|
|
213
170
|
CREATE TABLE step_artifact (
|
|
214
171
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
215
172
|
step_id INTEGER NOT NULL REFERENCES step(id),
|
|
@@ -221,7 +178,6 @@ CREATE TABLE step_artifact (
|
|
|
221
178
|
created_at TEXT NOT NULL
|
|
222
179
|
);
|
|
223
180
|
|
|
224
|
-
-- Generic external object layer: PRs, issues, tickets, deployments, incidents, etc.
|
|
225
181
|
CREATE TABLE external_object (
|
|
226
182
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
227
183
|
type TEXT NOT NULL,
|
|
@@ -237,7 +193,6 @@ CREATE TABLE external_object (
|
|
|
237
193
|
UNIQUE(provider, type, external_id)
|
|
238
194
|
);
|
|
239
195
|
|
|
240
|
-
-- Idempotent signals observed on external objects.
|
|
241
196
|
CREATE TABLE external_signal (
|
|
242
197
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
243
198
|
object_id INTEGER NOT NULL REFERENCES external_object(id),
|
|
@@ -251,9 +206,6 @@ CREATE TABLE external_signal (
|
|
|
251
206
|
UNIQUE(object_id, kind, signal_hash)
|
|
252
207
|
);
|
|
253
208
|
|
|
254
|
-
-- Operator-facing alerts.
|
|
255
|
-
-- requires_user=1 when this attention demands explicit human action (e.g. resume
|
|
256
|
-
-- a Pause). UI flickers + multi-channel notification fires for these. Phase 3 L2.
|
|
257
209
|
CREATE TABLE attention (
|
|
258
210
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
259
211
|
kind TEXT NOT NULL,
|
|
@@ -297,7 +249,6 @@ CREATE INDEX IF NOT EXISTS idx_session_size_member ON session_size(team_name,
|
|
|
297
249
|
CREATE INDEX IF NOT EXISTS idx_session_size_session ON session_size(sessionid, observed_at DESC);
|
|
298
250
|
CREATE INDEX IF NOT EXISTS idx_session_size_observed ON session_size(observed_at DESC);
|
|
299
251
|
|
|
300
|
-
-- Triage candidates (one row per evaluated issue produced by the triage workflow).
|
|
301
252
|
CREATE TABLE candidate_issue (
|
|
302
253
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
303
254
|
triage_run_id INTEGER NOT NULL REFERENCES run(id),
|
|
@@ -320,7 +271,6 @@ CREATE TABLE candidate_issue (
|
|
|
320
271
|
CREATE INDEX IF NOT EXISTS idx_candidate_issue_run ON candidate_issue(triage_run_id);
|
|
321
272
|
CREATE INDEX IF NOT EXISTS idx_candidate_issue_status ON candidate_issue(status);
|
|
322
273
|
|
|
323
|
-
-- Submitted PRs being watched by the PR follow-up workflow.
|
|
324
274
|
CREATE TABLE submitted_pr (
|
|
325
275
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
326
276
|
repo TEXT NOT NULL,
|
|
@@ -342,7 +292,6 @@ CREATE TABLE submitted_pr (
|
|
|
342
292
|
CREATE INDEX IF NOT EXISTS idx_submitted_pr_status ON submitted_pr(status);
|
|
343
293
|
CREATE INDEX IF NOT EXISTS idx_submitted_pr_scanned ON submitted_pr(last_scanned_at);
|
|
344
294
|
|
|
345
|
-
-- One row per delta observed on a submitted PR (comment, check, review, state change).
|
|
346
295
|
CREATE TABLE pr_followup_event (
|
|
347
296
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
348
297
|
submitted_pr_id INTEGER NOT NULL REFERENCES submitted_pr(id),
|
|
@@ -362,8 +311,6 @@ CREATE TABLE pr_followup_event (
|
|
|
362
311
|
CREATE INDEX IF NOT EXISTS idx_pr_followup_event_pr ON pr_followup_event(submitted_pr_id);
|
|
363
312
|
CREATE INDEX IF NOT EXISTS idx_pr_followup_event_kind ON pr_followup_event(event_kind);
|
|
364
313
|
|
|
365
|
-
-- Durable memory entries (C.1). Used by DB-backend projects; folder-backend
|
|
366
|
-
-- projects store entries as .md files on disk under <project_local_path>/durable-memory/.
|
|
367
314
|
CREATE TABLE IF NOT EXISTS durable_memory (
|
|
368
315
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
369
316
|
project_id INTEGER NOT NULL REFERENCES project(id),
|
|
@@ -378,7 +325,6 @@ CREATE TABLE IF NOT EXISTS durable_memory (
|
|
|
378
325
|
CREATE INDEX IF NOT EXISTS idx_durable_memory_project_type ON durable_memory(project_id, type);
|
|
379
326
|
CREATE INDEX IF NOT EXISTS idx_durable_memory_project_name ON durable_memory(project_id, name);
|
|
380
327
|
|
|
381
|
-
-- D.1: fine-grained agent activity events captured during chat turns.
|
|
382
328
|
CREATE TABLE IF NOT EXISTS session_event (
|
|
383
329
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
384
330
|
run_id INTEGER NOT NULL REFERENCES run(id),
|
|
@@ -393,7 +339,6 @@ CREATE INDEX IF NOT EXISTS idx_session_event_run ON session_event(run_id);
|
|
|
393
339
|
CREATE INDEX IF NOT EXISTS idx_session_event_kind_step ON session_event(kind, step_id);
|
|
394
340
|
CREATE INDEX IF NOT EXISTS idx_session_event_timestamp ON session_event(timestamp_ms);
|
|
395
341
|
|
|
396
|
-
-- D.3: per-minute-bucket rolled-up stats; dashboard reads this, never session_event.
|
|
397
342
|
CREATE TABLE IF NOT EXISTS rollup_stats (
|
|
398
343
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
399
344
|
run_id INTEGER NOT NULL REFERENCES run(id),
|
|
@@ -408,7 +353,6 @@ CREATE TABLE IF NOT EXISTS rollup_stats (
|
|
|
408
353
|
CREATE INDEX IF NOT EXISTS idx_rollup_run_metric ON rollup_stats(run_id, metric_kind);
|
|
409
354
|
CREATE INDEX IF NOT EXISTS idx_rollup_bucket ON rollup_stats(bucket_start_ms);
|
|
410
355
|
|
|
411
|
-
-- D.4: detected drift signals flagged by the policy engine.
|
|
412
356
|
CREATE TABLE IF NOT EXISTS drift_signal (
|
|
413
357
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
414
358
|
team_member_id INTEGER NOT NULL REFERENCES team_member(id),
|
|
@@ -424,13 +368,11 @@ CREATE TABLE IF NOT EXISTS drift_signal (
|
|
|
424
368
|
CREATE INDEX IF NOT EXISTS idx_drift_member ON drift_signal(team_member_id);
|
|
425
369
|
CREATE INDEX IF NOT EXISTS idx_drift_unacked ON drift_signal(team_member_id) WHERE acknowledged_at IS NULL;
|
|
426
370
|
|
|
427
|
-
-- D.3: monotonic cursor so the 250ms rollup updater survives daemon restarts.
|
|
428
371
|
CREATE TABLE IF NOT EXISTS rollup_cursor (
|
|
429
372
|
key TEXT PRIMARY KEY,
|
|
430
373
|
value INTEGER NOT NULL DEFAULT 0
|
|
431
374
|
);
|
|
432
375
|
|
|
433
|
-
-- R2.3: interactive_session table for multi-turn Interactive state.
|
|
434
376
|
CREATE TABLE IF NOT EXISTS interactive_session (
|
|
435
377
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
436
378
|
run_id INTEGER NOT NULL REFERENCES run(id),
|
|
@@ -447,8 +389,6 @@ CREATE TABLE IF NOT EXISTS interactive_session (
|
|
|
447
389
|
CREATE INDEX IF NOT EXISTS idx_interactive_status ON interactive_session(status);
|
|
448
390
|
CREATE INDEX IF NOT EXISTS idx_interactive_run_state ON interactive_session(run_id, state_name);
|
|
449
391
|
|
|
450
|
-
-- webui v2 / v19: per-user transition-graph session for the operator webui.
|
|
451
|
-
-- See briefs/webui-transition-graph-v2.md §"Schemas (v19 migration)".
|
|
452
392
|
CREATE TABLE IF NOT EXISTS webui_session (
|
|
453
393
|
session_id TEXT PRIMARY KEY,
|
|
454
394
|
user_id TEXT NOT NULL,
|
|
@@ -463,7 +403,6 @@ CREATE TABLE IF NOT EXISTS webui_session (
|
|
|
463
403
|
);
|
|
464
404
|
CREATE INDEX IF NOT EXISTS webui_session_user_idx ON webui_session(user_id);
|
|
465
405
|
|
|
466
|
-
-- webui v2 / v19: chatbot sidekick conversations and messages.
|
|
467
406
|
CREATE TABLE IF NOT EXISTS chatbot_session (
|
|
468
407
|
chatbot_session_id TEXT PRIMARY KEY,
|
|
469
408
|
user_id TEXT NOT NULL,
|
|
@@ -484,22 +423,12 @@ CREATE TABLE IF NOT EXISTS chatbot_message (
|
|
|
484
423
|
);
|
|
485
424
|
CREATE INDEX IF NOT EXISTS chatbot_message_session_idx ON chatbot_message(chatbot_session_id, id);
|
|
486
425
|
|
|
487
|
-
-- Phase A / v20: SQLite-canonical config table for api.url / api.port /
|
|
488
|
-
-- api.token. Eliminates env-var-propagation hazards when serve is launched
|
|
489
|
-
-- via run_in_background (Claude Code Bash strips env on spawn).
|
|
490
426
|
CREATE TABLE IF NOT EXISTS lmctl_config (
|
|
491
427
|
key TEXT PRIMARY KEY,
|
|
492
428
|
value TEXT NOT NULL,
|
|
493
429
|
updated_at TEXT NOT NULL
|
|
494
430
|
);
|
|
495
431
|
|
|
496
|
-
-- M1 / v25 (#218): composition-DSL source + shareable template
|
|
497
|
-
-- (template↔instance split) for the scripting frontend. ADDITIVE — no
|
|
498
|
-
-- existing table/column changed. The compiled IR still lives in
|
|
499
|
-
-- workflow.definition / workflow_version; compiled_workflow_version_id links
|
|
500
|
-
-- a unit to its compiled snapshot. Mirrors the migrate.ts v25 block so a
|
|
501
|
-
-- fresh DB and a v24→v25 migrated DB converge. See
|
|
502
|
-
-- durable-memory/composition-language-design.md §5.
|
|
503
432
|
CREATE TABLE IF NOT EXISTS composition_unit (
|
|
504
433
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
505
434
|
name TEXT NOT NULL,
|
|
@@ -513,13 +442,6 @@ CREATE TABLE IF NOT EXISTS composition_unit (
|
|
|
513
442
|
);
|
|
514
443
|
CREATE INDEX IF NOT EXISTS idx_composition_unit_name ON composition_unit(name, version DESC);
|
|
515
444
|
|
|
516
|
-
-- L-7 / v28: webui prompt → V4 job dispatch map. `submitPrompt(project_id,
|
|
517
|
-
-- text)` inserts a row + enqueues a `manual` job for the project's bound
|
|
518
|
-
-- workflow; `pollPrompt(id)` joins back to job/run to derive a {pending |
|
|
519
|
-
-- running | done | error} status + the run terminal_state. ADDITIVE — no
|
|
520
|
-
-- existing table/column changed. Mirrors the migrate.ts v28 block so a fresh
|
|
521
|
-
-- DB and a v27→v28 migrated DB converge. See
|
|
522
|
-
-- durable-memory/lmctl-next-migration-design-2026-05-24.md §C.3.
|
|
523
445
|
CREATE TABLE IF NOT EXISTS prompt_dispatch (
|
|
524
446
|
prompt_id TEXT PRIMARY KEY,
|
|
525
447
|
project_id INTEGER NOT NULL REFERENCES project(id),
|
|
@@ -532,14 +454,6 @@ CREATE TABLE IF NOT EXISTS prompt_dispatch (
|
|
|
532
454
|
CREATE INDEX IF NOT EXISTS idx_prompt_dispatch_project ON prompt_dispatch(project_id, created_at DESC);
|
|
533
455
|
CREATE INDEX IF NOT EXISTS idx_prompt_dispatch_job ON prompt_dispatch(job_id);
|
|
534
456
|
|
|
535
|
-
-- L-8 Gap 4 / v29: webui workspace + project tables (K1 + K7 per
|
|
536
|
-
-- durable-memory/lmctl-next-migration-design-2026-05-24.md §C.2 / §K.7).
|
|
537
|
-
-- DELIBERATELY distinct from v27 `project` (which holds standing-team
|
|
538
|
-
-- projects, CLI-managed). `web_project` is what the webui's
|
|
539
|
-
-- createProject / updateProject / deleteProject mutate; soft-delete via
|
|
540
|
-
-- `deleted_at` so prompt history retains a reference but the UI hides the
|
|
541
|
-
-- row. ADDITIVE ONLY — no existing table/column altered or dropped. Mirrors
|
|
542
|
-
-- the migrate.ts v29 block so a fresh DB and a v28→v29 migrated DB converge.
|
|
543
457
|
CREATE TABLE IF NOT EXISTS workspace (
|
|
544
458
|
id TEXT PRIMARY KEY,
|
|
545
459
|
name TEXT NOT NULL,
|
|
@@ -562,34 +476,18 @@ CREATE TABLE IF NOT EXISTS web_project (
|
|
|
562
476
|
CREATE INDEX IF NOT EXISTS idx_web_project_workspace ON web_project(workspace_id, deleted_at);
|
|
563
477
|
CREATE INDEX IF NOT EXISTS idx_web_project_v4_link ON web_project(linked_v4_project_id) WHERE linked_v4_project_id IS NOT NULL;
|
|
564
478
|
|
|
565
|
-
-- Seed the default workspace so `Query.workspace` always returns a row even
|
|
566
|
-
-- before the operator creates any project. The "default" id matches the
|
|
567
|
-
-- pre-L-8 resolver constant (preserves the `workspace.id == "default"`
|
|
568
|
-
-- baseline in tests/graphql/{batch,server}.test.ts).
|
|
569
479
|
INSERT OR IGNORE INTO workspace (id, name, idle_threshold_ms, created_at)
|
|
570
480
|
VALUES ('default', 'Default workspace', 600000, '1970-01-01T00:00:00.000Z');
|
|
571
481
|
|
|
572
|
-
-- MX-9 final fixup / v30 (durable-memory/MX-design-2026-05-25.md §2 lines 162,
|
|
573
|
-
-- 233): persist the agent-side mailbox cursor so restarts don't re-process the
|
|
574
|
-
-- entire backlog. Without this row, on agent restart the
|
|
575
|
-
-- VersionedMailboxClient starts with `cursor = undefined` → walks every
|
|
576
|
-
-- visible version as new → MailboxRpc.handleIncoming re-dispatches every
|
|
577
|
-
-- historical request envelope to the registered handler → duplicate
|
|
578
|
-
-- submitPrompt enqueues + duplicate job dispatch. ADDITIVE ONLY — no existing
|
|
579
|
-
-- table/column altered or dropped. Mirrors the migrate.ts v30 block so a fresh
|
|
580
|
-
-- DB and a v29→v30 migrated DB converge.
|
|
581
482
|
CREATE TABLE IF NOT EXISTS mailbox_cursor (
|
|
582
483
|
user_id TEXT NOT NULL,
|
|
583
484
|
mailbox_key TEXT NOT NULL,
|
|
584
485
|
last_processed_version_id TEXT,
|
|
585
486
|
last_processed_at TEXT NOT NULL,
|
|
586
|
-
-- v35: last column to match `ALTER TABLE ... ADD COLUMN` append order on
|
|
587
|
-
-- migrated DBs (see migrate.ts v35), so fresh and migrated converge.
|
|
588
487
|
last_processed_seq INTEGER,
|
|
589
488
|
PRIMARY KEY(user_id, mailbox_key)
|
|
590
489
|
);
|
|
591
490
|
|
|
592
|
-
-- Path-keyed root-team registry (NOT a reuse of team/team_member)
|
|
593
491
|
CREATE TABLE IF NOT EXISTS root_team (
|
|
594
492
|
teamfile_path TEXT PRIMARY KEY,
|
|
595
493
|
name TEXT,
|
|
@@ -599,7 +497,6 @@ CREATE TABLE IF NOT EXISTS root_team (
|
|
|
599
497
|
last_seeded_at TEXT
|
|
600
498
|
);
|
|
601
499
|
|
|
602
|
-
-- One row per request->response exchange
|
|
603
500
|
CREATE TABLE IF NOT EXISTS team_chat_log (
|
|
604
501
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
605
502
|
root_teamfile TEXT NOT NULL,
|
|
@@ -614,26 +511,17 @@ CREATE TABLE IF NOT EXISTS team_chat_log (
|
|
|
614
511
|
error_detail TEXT,
|
|
615
512
|
truncated INTEGER NOT NULL DEFAULT 0,
|
|
616
513
|
created_at TEXT NOT NULL,
|
|
617
|
-
-- v61: batch-vs-individual framing ('batch' for rows belonging to a batch
|
|
618
|
-
-- run, NULL for individual chats). Distinct from
|
|
619
|
-
-- message_pending.message_type (request/response lane semantics).
|
|
620
|
-
-- Appended LAST so a fresh create and a v60->v61 ALTER-upgrade converge on
|
|
621
|
-
-- the same column order (migrate-v32's table_info parity check).
|
|
622
514
|
message_type TEXT CHECK(message_type IN ('batch'))
|
|
623
515
|
);
|
|
624
516
|
CREATE INDEX IF NOT EXISTS idx_team_chat_log_root_time
|
|
625
517
|
ON team_chat_log(root_teamfile, created_at);
|
|
626
518
|
|
|
627
|
-
-- Per-mailbox durable watermark for daemon team_chat_log pushes. First-ever
|
|
628
|
-
-- start seeds this at current MAX(team_chat_log.id) to skip historic backlog;
|
|
629
|
-
-- subsequent restarts resume from the last successfully published id.
|
|
630
519
|
CREATE TABLE IF NOT EXISTS team_chat_log_cursor (
|
|
631
520
|
cursor_key TEXT PRIMARY KEY,
|
|
632
521
|
last_pushed_id INTEGER NOT NULL,
|
|
633
522
|
updated_at TEXT NOT NULL
|
|
634
523
|
);
|
|
635
524
|
|
|
636
|
-
-- v36: client-side S3 usage metering — per-device monthly op counts for quota.
|
|
637
525
|
CREATE TABLE IF NOT EXISTS usage_meter (
|
|
638
526
|
user_id TEXT NOT NULL,
|
|
639
527
|
device_id TEXT NOT NULL,
|
|
@@ -645,7 +533,6 @@ CREATE TABLE IF NOT EXISTS usage_meter (
|
|
|
645
533
|
PRIMARY KEY(user_id, device_id, period)
|
|
646
534
|
);
|
|
647
535
|
|
|
648
|
-
-- Per-receiver in-flight marker for single-sender serialization (§5)
|
|
649
536
|
CREATE TABLE IF NOT EXISTS agent_inflight (
|
|
650
537
|
receiver_teamfile TEXT NOT NULL,
|
|
651
538
|
receiver_alias TEXT NOT NULL,
|
|
@@ -657,9 +544,6 @@ CREATE TABLE IF NOT EXISTS agent_inflight (
|
|
|
657
544
|
PRIMARY KEY(receiver_teamfile, receiver_alias)
|
|
658
545
|
);
|
|
659
546
|
|
|
660
|
-
-- v40: tracked background delegation substrate. Inert until the later
|
|
661
|
-
-- Legacy/dormant tracked background delegation tables. Kept for existing DB
|
|
662
|
-
-- compatibility; current tracked wakeup uses tracked_invocation.
|
|
663
547
|
CREATE TABLE IF NOT EXISTS delegation_job (
|
|
664
548
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
665
549
|
teamfile TEXT NOT NULL,
|
|
@@ -700,7 +584,6 @@ CREATE TABLE IF NOT EXISTS delegation_event (
|
|
|
700
584
|
CREATE INDEX IF NOT EXISTS idx_delegation_event_job_id
|
|
701
585
|
ON delegation_event(delegation_job_id, id);
|
|
702
586
|
|
|
703
|
-
-- v43: generic runtime checkpoint substrate for meta-lead/toolkit state.
|
|
704
587
|
CREATE TABLE IF NOT EXISTS runtime_state (
|
|
705
588
|
scope TEXT NOT NULL,
|
|
706
589
|
key TEXT NOT NULL,
|
|
@@ -710,7 +593,6 @@ CREATE TABLE IF NOT EXISTS runtime_state (
|
|
|
710
593
|
PRIMARY KEY(scope, key, kind)
|
|
711
594
|
);
|
|
712
595
|
|
|
713
|
-
-- v44: durable start/finish records for lmctl wait wake semantics.
|
|
714
596
|
CREATE TABLE IF NOT EXISTS tracked_invocation (
|
|
715
597
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
716
598
|
kind TEXT NOT NULL CHECK(kind IN ('chat', 'exec')),
|
|
@@ -738,13 +620,7 @@ CREATE TABLE IF NOT EXISTS tracked_invocation (
|
|
|
738
620
|
notified_at TEXT,
|
|
739
621
|
launch_source TEXT,
|
|
740
622
|
request_payload TEXT,
|
|
741
|
-
-- v58: dispatch-lineage edge for `lmctl running --tree` -- the id of the
|
|
742
|
-
-- tracked_invocation whose turn sent the message that triggered this one.
|
|
743
|
-
-- Null = a root (not itself triggered by another tracked turn).
|
|
744
623
|
parent_invocation_id INTEGER,
|
|
745
|
-
-- v60 (task #232): JSON array of human-readable strings when this turn's
|
|
746
|
-
-- provider silently dropped a declared model=/effort=. Null when the
|
|
747
|
-
-- provider honored its declared config (absence IS the signal).
|
|
748
624
|
config_warnings TEXT
|
|
749
625
|
);
|
|
750
626
|
CREATE INDEX IF NOT EXISTS idx_tracked_invocation_status_started
|
|
@@ -756,20 +632,6 @@ CREATE INDEX IF NOT EXISTS idx_tracked_invocation_scope_status_started
|
|
|
756
632
|
CREATE INDEX IF NOT EXISTS idx_tracked_invocation_status_ended
|
|
757
633
|
ON tracked_invocation(status, ended_at);
|
|
758
634
|
|
|
759
|
-
-- v53: event-log message substrate (design:
|
|
760
|
-
-- backlog/DESIGN-event-log-message-substrate-DRAFT.md §2/§4; impl plan:
|
|
761
|
-
-- backlog/IMPL-PLAN-event-log-message-substrate.md Phase A). Additive only —
|
|
762
|
-
-- no existing read/write path changes in this phase.
|
|
763
|
-
--
|
|
764
|
-
-- message_event is the append-only log. `seq` (not `ts`) is the ordering
|
|
765
|
-
-- authority; `ts` is display/audit only. `event_id` is the idempotency key
|
|
766
|
-
-- and MUST be deterministic from intent (hash of stream_id + event_type +
|
|
767
|
-
-- observed projection last_seq — see src/db/event-log.ts), never a random
|
|
768
|
-
-- per-attempt id. The generated sender/receiver columns are load-bearing
|
|
769
|
-
-- (promoted from caveat by the low-level-primitives review): hot selectors
|
|
770
|
-
-- cannot index json_extract() directly; they populate on CREATE/
|
|
771
|
-
-- RESPONSE_CREATE payloads and are NULL for lease/invocation/terminal
|
|
772
|
-
-- streams (json_extract returns NULL on a missing path).
|
|
773
635
|
CREATE TABLE IF NOT EXISTS message_event (
|
|
774
636
|
seq INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
775
637
|
event_id TEXT NOT NULL UNIQUE,
|
|
@@ -787,12 +649,6 @@ CREATE INDEX IF NOT EXISTS idx_message_event_type ON message_event(event_type,
|
|
|
787
649
|
CREATE INDEX IF NOT EXISTS idx_message_event_sender ON message_event(sender_teamfile, sender_alias, seq);
|
|
788
650
|
CREATE INDEX IF NOT EXISTS idx_message_event_receiver ON message_event(receiver_teamfile, receiver_alias, seq);
|
|
789
651
|
|
|
790
|
-
-- Mutex + terminal occupancy projection. Will replace agent_inflight + the
|
|
791
|
-
-- terminal-lock slice of runtime_state at cutover (Phase D). PK is the
|
|
792
|
-
-- actual mutual-exclusion constraint. The terminal_invocation_* slice is
|
|
793
|
-
-- dual-written by terminal-kind INVOCATION_START/HEARTBEAT/FINISH events so
|
|
794
|
-
-- ALL THREE busy-check tiers resolve from this one row (the phantom-tolerant
|
|
795
|
-
-- invocation_state below is never read by the busy check).
|
|
796
652
|
CREATE TABLE IF NOT EXISTS agent_state (
|
|
797
653
|
receiver_teamfile TEXT NOT NULL,
|
|
798
654
|
receiver_alias TEXT NOT NULL,
|
|
@@ -814,9 +670,6 @@ CREATE TABLE IF NOT EXISTS agent_state (
|
|
|
814
670
|
PRIMARY KEY(receiver_teamfile, receiver_alias)
|
|
815
671
|
);
|
|
816
672
|
|
|
817
|
-
-- One row per undelivered/unhandled message. Will replace the
|
|
818
|
-
-- delivered_at/delivering_at slice of agent_mailbox. in_reply_to's UNIQUE
|
|
819
|
-
-- enforces "one response per request" at the schema level.
|
|
820
673
|
CREATE TABLE IF NOT EXISTS message_pending (
|
|
821
674
|
message_id TEXT PRIMARY KEY,
|
|
822
675
|
message_type TEXT NOT NULL CHECK(message_type IN ('request','response')),
|
|
@@ -836,10 +689,6 @@ CREATE INDEX IF NOT EXISTS idx_message_pending_lane
|
|
|
836
689
|
receiver_alias, message_type, created_seq)
|
|
837
690
|
WHERE lifecycle_state = 'queued';
|
|
838
691
|
|
|
839
|
-
-- Diagnostic/observability projection: "what is a process doing right now."
|
|
840
|
-
-- Deliberately separate from agent_state (two correctness regimes): rows here
|
|
841
|
-
-- are EXPECTED to go stale on hard kills (#88 capture gap) and are cleaned by
|
|
842
|
-
-- a reconciliation probe, never consulted by the busy check.
|
|
843
692
|
CREATE TABLE IF NOT EXISTS invocation_state (
|
|
844
693
|
invocation_id TEXT PRIMARY KEY,
|
|
845
694
|
kind TEXT NOT NULL,
|
|
@@ -870,36 +719,18 @@ CREATE INDEX IF NOT EXISTS idx_invocation_state_target_status
|
|
|
870
719
|
CREATE INDEX IF NOT EXISTS idx_invocation_state_from_time
|
|
871
720
|
ON invocation_state(from_identity, started_at DESC);
|
|
872
721
|
|
|
873
|
-
-- v59: source-generation identity. A single-row, non-secret random id assigned
|
|
874
|
-
-- ONCE at migration time. Every lmctl-issued reference (invocation/provider-
|
|
875
|
-
-- session/mail ref) binds to it so a ref minted against one ledger can never
|
|
876
|
-
-- silently resolve against an unrelated or recovered one. The singleton CHECK
|
|
877
|
-
-- makes >1 row structurally impossible; the row itself is inserted by
|
|
878
|
-
-- migrate()'s ensureLedgerIdentity (fresh create AND upgrade paths).
|
|
879
|
-
-- DELIBERATELY EXCLUDED from the db-recovery salvage set (salvageEssentialConfig
|
|
880
|
-
-- copies only root_team + lmctl_config): a salvage-into-fresh-db is a NEW ledger
|
|
881
|
-
-- and must mint a NEW id; only a full-file backup restore retains this row.
|
|
882
722
|
CREATE TABLE IF NOT EXISTS state_ledger_identity (
|
|
883
723
|
singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
|
|
884
724
|
instance_id TEXT NOT NULL,
|
|
885
725
|
created_at TEXT NOT NULL
|
|
886
726
|
);
|
|
887
727
|
|
|
888
|
-
-- v61: schema metadata kv. Holds min_reader_version -- the oldest build
|
|
889
|
-
-- schema version that may safely open this db (batch redesign Landing A,
|
|
890
|
-
-- item 0). migrate()'s skew check refuses a newer db only when
|
|
891
|
-
-- min_reader_version exceeds the binary's CURRENT_USER_VERSION; a db without
|
|
892
|
-
-- the marker defaults to its raw user_version (strict, pre-v61 behavior).
|
|
893
|
-
-- v61 is purely additive, so its floor is 60. Additive migrations keep/lower
|
|
894
|
-
-- the floor (INSERT OR IGNORE); breaking ones raise it to their own version.
|
|
895
728
|
CREATE TABLE IF NOT EXISTS schema_meta (
|
|
896
729
|
key TEXT PRIMARY KEY,
|
|
897
730
|
value TEXT NOT NULL
|
|
898
731
|
);
|
|
899
732
|
INSERT OR IGNORE INTO schema_meta (key, value) VALUES ('min_reader_version', '60');
|
|
900
733
|
|
|
901
|
-
-- v62: lmbee queue and task-linked chat storage. lmbee remains on its own DB;
|
|
902
|
-
-- no lmctl reader or writer uses these tables yet.
|
|
903
734
|
CREATE TABLE IF NOT EXISTS queue(
|
|
904
735
|
id INTEGER PRIMARY KEY,
|
|
905
736
|
from_id TEXT NOT NULL,
|