lastlight-core 0.25.9 → 0.26.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/config/default.yaml +20 -1
- package/dist/admin/chat-session-reader.d.ts +3 -3
- package/dist/admin/chat-session-reader.js +8 -8
- package/dist/admin/chat-session-reader.js.map +1 -1
- package/dist/admin/routes.js +97 -99
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/sessions.d.ts +7 -7
- package/dist/admin/sessions.js +6 -4
- package/dist/admin/sessions.js.map +1 -1
- package/dist/config/config.d.ts +15 -0
- package/dist/config/config.js +28 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/repo-config.js +6 -7
- package/dist/config/repo-config.js.map +1 -1
- package/dist/connectors/messaging/base.js +2 -2
- package/dist/connectors/messaging/base.js.map +1 -1
- package/dist/connectors/messaging/session-manager.d.ts +29 -31
- package/dist/connectors/messaging/session-manager.js +156 -189
- package/dist/connectors/messaging/session-manager.js.map +1 -1
- package/dist/connectors/messaging/thread-transcript.d.ts +2 -2
- package/dist/connectors/messaging/thread-transcript.js +14 -8
- package/dist/connectors/messaging/thread-transcript.js.map +1 -1
- package/dist/connectors/slack/connector.js +5 -5
- package/dist/connectors/slack/connector.js.map +1 -1
- package/dist/cron/feedback-poll.js +6 -6
- package/dist/cron/feedback-poll.js.map +1 -1
- package/dist/cron/handlers.js +3 -3
- package/dist/cron/handlers.js.map +1 -1
- package/dist/cron/jobs.d.ts +1 -1
- package/dist/cron/jobs.js +2 -2
- package/dist/cron/jobs.js.map +1 -1
- package/dist/cron/repo-digest.js +4 -4
- package/dist/cron/repo-digest.js.map +1 -1
- package/dist/cron/runner.js +2 -2
- package/dist/cron/runner.js.map +1 -1
- package/dist/cron/scheduler.js +1 -1
- package/dist/cron/scheduler.js.map +1 -1
- package/dist/engine/chat/chat-prompt.d.ts +11 -4
- package/dist/engine/chat/chat-prompt.js.map +1 -1
- package/dist/engine/chat/chat-runner.d.ts +3 -2
- package/dist/engine/chat/chat-runner.js +9 -7
- package/dist/engine/chat/chat-runner.js.map +1 -1
- package/dist/engine/dispatcher.js +29 -25
- package/dist/engine/dispatcher.js.map +1 -1
- package/dist/engine/executors/orchestrator.d.ts +28 -0
- package/dist/engine/executors/orchestrator.js +70 -1
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/feedback/ingest.d.ts +4 -4
- package/dist/engine/feedback/ingest.js +13 -13
- package/dist/engine/feedback/ingest.js.map +1 -1
- package/dist/engine/feedback/slack.d.ts +2 -2
- package/dist/engine/feedback/slack.js +6 -6
- package/dist/engine/feedback/slack.js.map +1 -1
- package/dist/engine/fix-harvest.d.ts +1 -1
- package/dist/engine/fix-harvest.js +3 -3
- package/dist/engine/fix-harvest.js.map +1 -1
- package/dist/engine/github/team-visibility.js +7 -7
- package/dist/engine/github/team-visibility.js.map +1 -1
- package/dist/engine/pr-escalation.js +7 -7
- package/dist/engine/pr-escalation.js.map +1 -1
- package/dist/engine/pr-state.d.ts +1 -1
- package/dist/engine/pr-state.js +12 -10
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/engine/review-check.d.ts +1 -1
- package/dist/engine/review-check.js +5 -5
- package/dist/engine/review-check.js.map +1 -1
- package/dist/engine/router.js +3 -3
- package/dist/engine/router.js.map +1 -1
- package/dist/index.js +108 -65
- package/dist/index.js.map +1 -1
- package/dist/sandbox/docker.d.ts +33 -1
- package/dist/sandbox/docker.js +95 -1
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.d.ts +3 -0
- package/dist/sandbox/k8s/kubernetes-sandbox.js +9 -0
- package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
- package/dist/sandbox/k8s/pod.d.ts +11 -0
- package/dist/sandbox/k8s/pod.js +11 -6
- package/dist/sandbox/k8s/pod.js.map +1 -1
- package/dist/sandbox/k8s/service-containers.d.ts +43 -0
- package/dist/sandbox/k8s/service-containers.js +87 -0
- package/dist/sandbox/k8s/service-containers.js.map +1 -0
- package/dist/sandbox/reap.d.ts +9 -0
- package/dist/sandbox/reap.js +36 -0
- package/dist/sandbox/reap.js.map +1 -1
- package/dist/sandbox/sandbox.d.ts +14 -0
- package/dist/sandbox/sandbox.js +9 -0
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/sandbox/service-containers-docker.d.ts +45 -0
- package/dist/sandbox/service-containers-docker.js +78 -0
- package/dist/sandbox/service-containers-docker.js.map +1 -0
- package/dist/state/approval-store.d.ts +23 -14
- package/dist/state/approval-store.js +137 -86
- package/dist/state/approval-store.js.map +1 -1
- package/dist/state/client.d.ts +105 -0
- package/dist/state/client.js +68 -0
- package/dist/state/client.js.map +1 -0
- package/dist/state/cron-run-store.d.ts +32 -12
- package/dist/state/cron-run-store.js +105 -39
- package/dist/state/cron-run-store.js.map +1 -1
- package/dist/state/db.d.ts +61 -23
- package/dist/state/db.js +171 -105
- package/dist/state/db.js.map +1 -1
- package/dist/state/dialect.d.ts +77 -0
- package/dist/state/dialect.js +129 -0
- package/dist/state/dialect.js.map +1 -0
- package/dist/state/execution-store.d.ts +124 -103
- package/dist/state/execution-store.js +569 -374
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/feedback-store.d.ts +20 -20
- package/dist/state/feedback-store.js +241 -187
- package/dist/state/feedback-store.js.map +1 -1
- package/dist/state/legacy-sqlite.d.ts +15 -0
- package/dist/state/legacy-sqlite.js +131 -0
- package/dist/state/legacy-sqlite.js.map +1 -0
- package/dist/state/repo-ref.d.ts +9 -4
- package/dist/state/repo-ref.js +12 -6
- package/dist/state/repo-ref.js.map +1 -1
- package/dist/state/schema/pg.d.ts +2788 -0
- package/dist/state/schema/pg.js +301 -0
- package/dist/state/schema/pg.js.map +1 -0
- package/dist/state/schema/sqlite.d.ts +3063 -0
- package/dist/state/schema/sqlite.js +391 -0
- package/dist/state/schema/sqlite.js.map +1 -0
- package/dist/state/team-store.d.ts +26 -13
- package/dist/state/team-store.js +140 -93
- package/dist/state/team-store.js.map +1 -1
- package/dist/state/user-store.d.ts +31 -13
- package/dist/state/user-store.js +180 -80
- package/dist/state/user-store.js.map +1 -1
- package/dist/state/workflow-run-store.d.ts +95 -56
- package/dist/state/workflow-run-store.js +419 -314
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/workflows/admission.d.ts +4 -3
- package/dist/workflows/admission.js +34 -10
- package/dist/workflows/admission.js.map +1 -1
- package/dist/workflows/handlers/post-review.js +3 -3
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/resume.js +22 -15
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/runner.js +27 -12
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/simple.d.ts +23 -0
- package/dist/workflows/simple.js +40 -16
- package/dist/workflows/simple.js.map +1 -1
- package/drizzle/pg/0000_init.sql +235 -0
- package/drizzle/pg/meta/0000_snapshot.json +1751 -0
- package/drizzle/pg/meta/_journal.json +13 -0
- package/drizzle/sqlite/0000_baseline.sql +257 -0
- package/drizzle/sqlite/0001_backfill_repo_refs.sql +74 -0
- package/drizzle/sqlite/meta/0000_snapshot.json +1593 -0
- package/drizzle/sqlite/meta/0001_snapshot.json +1593 -0
- package/drizzle/sqlite/meta/_journal.json +20 -0
- package/package.json +12 -6
- package/dist/state/migrate.d.ts +0 -15
- package/dist/state/migrate.js +0 -518
- package/dist/state/migrate.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "6",
|
|
8
|
+
"when": 1787037639730,
|
|
9
|
+
"tag": "0000_baseline",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "6",
|
|
15
|
+
"when": 1787040069970,
|
|
16
|
+
"tag": "0001_backfill_repo_refs",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lastlight-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "GitHub repository maintenance agent — Agent SDK harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
+
"drizzle",
|
|
18
19
|
"config",
|
|
19
20
|
"workflows",
|
|
20
21
|
"skills",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"@earendil-works/pi-ai": "^0.84.1",
|
|
45
46
|
"@hono/node-server": "^2.1.1",
|
|
46
47
|
"@kubernetes/client-node": "1.4.0",
|
|
48
|
+
"@libsql/client": "^0.17.4",
|
|
47
49
|
"@octokit/auth-app": "^8.3.0",
|
|
48
50
|
"@opentelemetry/api": "^1.9.1",
|
|
49
51
|
"@opentelemetry/exporter-logs-otlp-http": "^0.221.0",
|
|
@@ -60,8 +62,8 @@
|
|
|
60
62
|
"@slack/bolt": "^5.0.0",
|
|
61
63
|
"@slack/web-api": "^8.0.0",
|
|
62
64
|
"arctic": "^3.7.0",
|
|
63
|
-
"better-sqlite3": "^13.0.3",
|
|
64
65
|
"croner": "^10.0.1",
|
|
66
|
+
"drizzle-orm": "^0.45.2",
|
|
65
67
|
"hono": "^4.13.2",
|
|
66
68
|
"octokit": "^5.0.5",
|
|
67
69
|
"pino": "10.3.1",
|
|
@@ -69,16 +71,17 @@
|
|
|
69
71
|
"yaml": "^2.8.3",
|
|
70
72
|
"zod": "^4.3.6",
|
|
71
73
|
"agentic-pi": "0.4.3",
|
|
72
|
-
"lastlight-
|
|
73
|
-
"lastlight-
|
|
74
|
+
"lastlight-workflow-engine": "0.4.0",
|
|
75
|
+
"lastlight-shared": "0.4.0"
|
|
74
76
|
},
|
|
75
77
|
"devDependencies": {
|
|
78
|
+
"@electric-sql/pglite": "^0.5.5",
|
|
76
79
|
"@opentelemetry/context-async-hooks": "^2.10.0",
|
|
77
80
|
"@opentelemetry/sdk-trace-base": "^2.10.0",
|
|
78
|
-
"@types/better-sqlite3": "^7.6.0",
|
|
79
81
|
"@types/node": "^26.1.1",
|
|
80
82
|
"concurrently": "^10.0.4",
|
|
81
83
|
"dependency-cruiser": "^18.1.0",
|
|
84
|
+
"drizzle-kit": "^0.31.10",
|
|
82
85
|
"tsx": "^4.23.1",
|
|
83
86
|
"typescript": "^5.7.0",
|
|
84
87
|
"vitest": "^4.1.10"
|
|
@@ -95,6 +98,9 @@
|
|
|
95
98
|
"dev:dashboard": "pnpm --filter @lastlight/dashboard dev",
|
|
96
99
|
"test:watch": "vitest",
|
|
97
100
|
"lint:boundaries": "depcruise --config .dependency-cruiser.cjs src",
|
|
98
|
-
"
|
|
101
|
+
"db:generate:sqlite": "drizzle-kit generate --config drizzle-sqlite.config.ts",
|
|
102
|
+
"db:generate:pg": "drizzle-kit generate --config drizzle-pg.config.ts",
|
|
103
|
+
"lint:promises": "node scripts/lint-floating-promises.mjs . ../../packages/workflow-engine ../../packages/shared",
|
|
104
|
+
"typecheck": "tsc --noEmit && pnpm run lint:boundaries && pnpm run lint:promises"
|
|
99
105
|
}
|
|
100
106
|
}
|
package/dist/state/migrate.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type Database from "better-sqlite3";
|
|
2
|
-
/**
|
|
3
|
-
* Apply the full SQLite schema for the harness state DB.
|
|
4
|
-
*
|
|
5
|
-
* Centralized here (rather than on a store) because the three stores
|
|
6
|
-
* (`WorkflowRunStore` / `ApprovalStore` / `ExecutionStore`) all share a
|
|
7
|
-
* single `Database` connection and assume the schema already exists. `StateDb`
|
|
8
|
-
* is the construction root and calls this once at boot; tests that exercise a
|
|
9
|
-
* store directly construct a raw `Database`, call `migrate()`, then build the
|
|
10
|
-
* store on top.
|
|
11
|
-
*
|
|
12
|
-
* Every statement is idempotent (`IF NOT EXISTS` / additive `ALTER` guarded by
|
|
13
|
-
* try/catch) so it is safe to run on an existing DB.
|
|
14
|
-
*/
|
|
15
|
-
export declare function migrate(db: Database.Database): void;
|
package/dist/state/migrate.js
DELETED
|
@@ -1,518 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Apply the full SQLite schema for the harness state DB.
|
|
3
|
-
*
|
|
4
|
-
* Centralized here (rather than on a store) because the three stores
|
|
5
|
-
* (`WorkflowRunStore` / `ApprovalStore` / `ExecutionStore`) all share a
|
|
6
|
-
* single `Database` connection and assume the schema already exists. `StateDb`
|
|
7
|
-
* is the construction root and calls this once at boot; tests that exercise a
|
|
8
|
-
* store directly construct a raw `Database`, call `migrate()`, then build the
|
|
9
|
-
* store on top.
|
|
10
|
-
*
|
|
11
|
-
* Every statement is idempotent (`IF NOT EXISTS` / additive `ALTER` guarded by
|
|
12
|
-
* try/catch) so it is safe to run on an existing DB.
|
|
13
|
-
*/
|
|
14
|
-
export function migrate(db) {
|
|
15
|
-
db.exec(`
|
|
16
|
-
CREATE TABLE IF NOT EXISTS executions (
|
|
17
|
-
id TEXT PRIMARY KEY,
|
|
18
|
-
trigger_type TEXT NOT NULL,
|
|
19
|
-
trigger_id TEXT NOT NULL,
|
|
20
|
-
skill TEXT NOT NULL,
|
|
21
|
-
-- The target repo as (owner, BARE repo) — see state/repo-ref.ts, the one
|
|
22
|
-
-- place that rule is expressed. The owner column arrives by ALTER below
|
|
23
|
-
-- on an upgraded DB; it is here too so a fresh DB reaches the same shape.
|
|
24
|
-
owner TEXT,
|
|
25
|
-
repo TEXT,
|
|
26
|
-
issue_number INTEGER,
|
|
27
|
-
started_at TEXT NOT NULL,
|
|
28
|
-
finished_at TEXT,
|
|
29
|
-
success INTEGER,
|
|
30
|
-
error TEXT,
|
|
31
|
-
turns INTEGER,
|
|
32
|
-
duration_ms INTEGER
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
CREATE INDEX IF NOT EXISTS idx_executions_trigger ON executions(trigger_type, trigger_id);
|
|
36
|
-
CREATE INDEX IF NOT EXISTS idx_executions_skill ON executions(skill, started_at);
|
|
37
|
-
|
|
38
|
-
CREATE TABLE IF NOT EXISTS workflow_runs (
|
|
39
|
-
id TEXT PRIMARY KEY,
|
|
40
|
-
workflow_name TEXT NOT NULL,
|
|
41
|
-
trigger_id TEXT NOT NULL,
|
|
42
|
-
-- Same (owner, BARE repo) pair as the executions ledger above.
|
|
43
|
-
owner TEXT,
|
|
44
|
-
repo TEXT,
|
|
45
|
-
issue_number INTEGER,
|
|
46
|
-
current_phase TEXT NOT NULL,
|
|
47
|
-
phase_history TEXT NOT NULL DEFAULT '[]',
|
|
48
|
-
status TEXT NOT NULL DEFAULT 'running',
|
|
49
|
-
context TEXT,
|
|
50
|
-
started_at TEXT NOT NULL,
|
|
51
|
-
updated_at TEXT NOT NULL,
|
|
52
|
-
finished_at TEXT
|
|
53
|
-
);
|
|
54
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_trigger ON workflow_runs(trigger_id, status);
|
|
55
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_status ON workflow_runs(status);
|
|
56
|
-
-- Dashboard's workflow-runs list query is ORDER BY started_at DESC
|
|
57
|
-
-- LIMIT 20, often with optional workflow_name / status filters and a
|
|
58
|
-
-- companion COUNT(*). It polls every 5s, so it's worth a covering
|
|
59
|
-
-- index — without one this is a full-table sort.
|
|
60
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_started_at ON workflow_runs(started_at DESC);
|
|
61
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_name_started ON workflow_runs(workflow_name, started_at DESC);
|
|
62
|
-
|
|
63
|
-
CREATE TABLE IF NOT EXISTS cron_overrides (
|
|
64
|
-
name TEXT PRIMARY KEY,
|
|
65
|
-
enabled INTEGER NOT NULL DEFAULT 1,
|
|
66
|
-
schedule TEXT,
|
|
67
|
-
updated_at TEXT NOT NULL,
|
|
68
|
-
updated_by TEXT
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
-- One row per cron FIRE — scheduled or manual, workflow or handler.
|
|
72
|
-
-- Distinct from the workflow_runs a fire may (or may not) dispatch: a
|
|
73
|
-
-- zero-discovery fire dispatches nothing, so this is the only record that
|
|
74
|
-
-- a backstop cron ran at all. Keyed on cron_name, never the workflow, so
|
|
75
|
-
-- a run dispatched by /api/run or a comment cannot skew a cron's health.
|
|
76
|
-
CREATE TABLE IF NOT EXISTS cron_runs (
|
|
77
|
-
id TEXT PRIMARY KEY,
|
|
78
|
-
cron_name TEXT NOT NULL,
|
|
79
|
-
workflow TEXT,
|
|
80
|
-
handler TEXT,
|
|
81
|
-
source TEXT NOT NULL,
|
|
82
|
-
actor TEXT,
|
|
83
|
-
started_at TEXT NOT NULL,
|
|
84
|
-
finished_at TEXT,
|
|
85
|
-
status TEXT NOT NULL DEFAULT 'running',
|
|
86
|
-
repos_eligible INTEGER,
|
|
87
|
-
repos_scanned INTEGER,
|
|
88
|
-
discovered INTEGER,
|
|
89
|
-
dispatched INTEGER,
|
|
90
|
-
failures INTEGER,
|
|
91
|
-
error TEXT
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
CREATE INDEX IF NOT EXISTS idx_cron_runs_name_started ON cron_runs(cron_name, started_at DESC);
|
|
95
|
-
|
|
96
|
-
CREATE TABLE IF NOT EXISTS workflow_overrides (
|
|
97
|
-
name TEXT PRIMARY KEY,
|
|
98
|
-
enabled INTEGER NOT NULL DEFAULT 1,
|
|
99
|
-
updated_at TEXT NOT NULL,
|
|
100
|
-
updated_by TEXT
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
CREATE TABLE IF NOT EXISTS workflow_approvals (
|
|
104
|
-
id TEXT PRIMARY KEY,
|
|
105
|
-
workflow_run_id TEXT NOT NULL,
|
|
106
|
-
gate TEXT NOT NULL,
|
|
107
|
-
summary TEXT NOT NULL,
|
|
108
|
-
status TEXT NOT NULL DEFAULT 'pending',
|
|
109
|
-
requested_by TEXT,
|
|
110
|
-
responded_by TEXT,
|
|
111
|
-
response TEXT,
|
|
112
|
-
responded_at TEXT,
|
|
113
|
-
created_at TEXT NOT NULL
|
|
114
|
-
);
|
|
115
|
-
CREATE INDEX IF NOT EXISTS idx_approvals_workflow ON workflow_approvals(workflow_run_id);
|
|
116
|
-
CREATE INDEX IF NOT EXISTS idx_approvals_status ON workflow_approvals(status);
|
|
117
|
-
|
|
118
|
-
-- First-class user identity (issue #205). An ADDITIVE enrichment table:
|
|
119
|
-
-- every actor column elsewhere stays free-text \`login\`, and \`users\` is
|
|
120
|
-
-- LEFT-JOINed on it to resolve a real person (name / email / avatar) for
|
|
121
|
-
-- the dashboard and future email. \`github_id\` / \`slack_user_id\` are the
|
|
122
|
-
-- stable upsert keys; \`login\` is the soft join key. \`email\` is indexed but
|
|
123
|
-
-- deliberately NOT unique (corporate shared mailboxes + many null Slack-only
|
|
124
|
-
-- rows would collide a UNIQUE constraint) — see issue #205 decisions.
|
|
125
|
-
CREATE TABLE IF NOT EXISTS users (
|
|
126
|
-
id TEXT PRIMARY KEY, -- randomUUID
|
|
127
|
-
github_id INTEGER UNIQUE, -- stable numeric id (upsert key); null for Slack-only rows
|
|
128
|
-
login TEXT UNIQUE, -- GitHub login = the soft join key used everywhere
|
|
129
|
-
name TEXT,
|
|
130
|
-
email TEXT, -- captured for future email; indexed, NOT unique
|
|
131
|
-
avatar_url TEXT,
|
|
132
|
-
slack_user_id TEXT UNIQUE, -- U… id, linked lazily on Slack match
|
|
133
|
-
is_blocked INTEGER NOT NULL DEFAULT 0,
|
|
134
|
-
email_is_placeholder INTEGER NOT NULL DEFAULT 0,
|
|
135
|
-
created_at TEXT NOT NULL,
|
|
136
|
-
updated_at TEXT NOT NULL,
|
|
137
|
-
last_login_at TEXT
|
|
138
|
-
);
|
|
139
|
-
CREATE INDEX IF NOT EXISTS idx_users_login ON users(login);
|
|
140
|
-
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
|
|
141
|
-
CREATE INDEX IF NOT EXISTS idx_users_slack ON users(slack_user_id);
|
|
142
|
-
|
|
143
|
-
-- Feedback signals (issue #255) — a 👍/👎 on something the bot wrote, scored
|
|
144
|
-
-- against the run that wrote it. Two tables, because a reaction names a
|
|
145
|
-
-- MESSAGE and we need a run:
|
|
146
|
-
--
|
|
147
|
-
-- feedback_anchors one row per reactable artefact the bot posted, and the
|
|
148
|
-
-- run it came from. Written when we POST (Slack, where
|
|
149
|
-
-- the ts is only ever known at send time) or when a run
|
|
150
|
-
-- finishes (GitHub discovery).
|
|
151
|
-
-- feedback_signals one row per (anchor, reactor, emoji).
|
|
152
|
-
--
|
|
153
|
-
-- Surface-agnostic from the start: \`source\` discriminates slack/github so a
|
|
154
|
-
-- single query averages across both, and the GitHub poller adds rows rather
|
|
155
|
-
-- than columns.
|
|
156
|
-
CREATE TABLE IF NOT EXISTS feedback_anchors (
|
|
157
|
-
id TEXT PRIMARY KEY, -- randomUUID
|
|
158
|
-
source TEXT NOT NULL, -- slack | github
|
|
159
|
-
kind TEXT NOT NULL, -- slack_message | issue_comment | review_comment | issue
|
|
160
|
-
-- Slack message ts, or the GitHub comment/issue id as a string. Kept TEXT
|
|
161
|
-
-- for both: a Slack ts ("1712000000.000100") is not a number, and a
|
|
162
|
-
-- GitHub id read back as a float would lose precision.
|
|
163
|
-
external_id TEXT NOT NULL,
|
|
164
|
-
-- GitHub GraphQL global id. The batched reactions query keys on this, so
|
|
165
|
-
-- the poller never has to re-resolve an id it already saw.
|
|
166
|
-
node_id TEXT,
|
|
167
|
-
-- Slack channel id. GitHub has no channel and stores the empty string
|
|
168
|
-
-- rather than NULL, because **SQLite treats NULLs as DISTINCT in a UNIQUE
|
|
169
|
-
-- constraint** — with NULL here, the UNIQUE below (and the ON CONFLICT
|
|
170
|
-
-- that targets it) is silently inoperative for every GitHub anchor, and
|
|
171
|
-
-- re-discovering the same comment forks a second row. A sentinel keeps
|
|
172
|
-
-- ONE uniqueness rule and ONE upsert path for both surfaces; the store
|
|
173
|
-
-- maps '' back to null at its boundary so callers still see
|
|
174
|
-
-- \`channel: string | null\`.
|
|
175
|
-
channel TEXT NOT NULL DEFAULT '',
|
|
176
|
-
owner TEXT,
|
|
177
|
-
repo TEXT,
|
|
178
|
-
issue_number INTEGER,
|
|
179
|
-
-- The attribution. Null is legal and deliberate: a bot comment we cannot
|
|
180
|
-
-- tie to a run is still worth recording — dropping it would silently lose
|
|
181
|
-
-- the reaction rather than the run.
|
|
182
|
-
workflow_run_id TEXT,
|
|
183
|
-
workflow_name TEXT,
|
|
184
|
-
-- The Slack THREAD's messaging session, for a chat turn — which has no
|
|
185
|
-
-- workflow run. Deliberately not called \`execution_id\`: it is
|
|
186
|
-
-- \`messaging_sessions.id\`, which is what an \`executions\` row for a chat
|
|
187
|
-
-- turn carries as its \`trigger_id\`, NOT an \`executions.id\`.
|
|
188
|
-
messaging_session_id TEXT,
|
|
189
|
-
created_at TEXT NOT NULL, -- when the bot posted it
|
|
190
|
-
last_polled_at TEXT, -- github only; slack arrives live
|
|
191
|
-
UNIQUE(source, channel, external_id)
|
|
192
|
-
);
|
|
193
|
-
-- The reverse lookup a Slack reaction hits: (channel, ts) → anchor.
|
|
194
|
-
CREATE INDEX IF NOT EXISTS idx_feedback_anchors_lookup
|
|
195
|
-
ON feedback_anchors(source, channel, external_id);
|
|
196
|
-
CREATE INDEX IF NOT EXISTS idx_feedback_anchors_run
|
|
197
|
-
ON feedback_anchors(workflow_run_id);
|
|
198
|
-
-- The poller's rotation: least-recently-polled first, within the window.
|
|
199
|
-
CREATE INDEX IF NOT EXISTS idx_feedback_anchors_poll
|
|
200
|
-
ON feedback_anchors(source, created_at, last_polled_at);
|
|
201
|
-
|
|
202
|
-
CREATE TABLE IF NOT EXISTS feedback_signals (
|
|
203
|
-
id TEXT PRIMARY KEY,
|
|
204
|
-
anchor_id TEXT NOT NULL,
|
|
205
|
-
-- Denormalized from the anchor so every analytics query is one table.
|
|
206
|
-
-- These never change for a given anchor, so there is nothing to keep in
|
|
207
|
-
-- sync — the anchor's attribution is fixed the moment it is created.
|
|
208
|
-
source TEXT NOT NULL,
|
|
209
|
-
workflow_run_id TEXT,
|
|
210
|
-
workflow_name TEXT,
|
|
211
|
-
messaging_session_id TEXT,
|
|
212
|
-
owner TEXT,
|
|
213
|
-
repo TEXT,
|
|
214
|
-
issue_number INTEGER,
|
|
215
|
-
emoji TEXT NOT NULL, -- canonical name (see engine/feedback/reactions.ts)
|
|
216
|
-
score INTEGER NOT NULL, -- -2..+2; 0 means "recorded, not scored"
|
|
217
|
-
sentiment TEXT NOT NULL,
|
|
218
|
-
reactor TEXT, -- GitHub login / Slack user id
|
|
219
|
-
reacted_at TEXT, -- when they reacted, when known
|
|
220
|
-
observed_at TEXT NOT NULL, -- when WE saw it
|
|
221
|
-
-- Set when the reaction is taken away. Retracting rather than deleting
|
|
222
|
-
-- keeps "somebody thumbed this and then thought better of it" visible,
|
|
223
|
-
-- which is itself a signal; every score query filters on IS NULL.
|
|
224
|
-
removed_at TEXT,
|
|
225
|
-
-- OTel export watermark. Null means not yet exported, so a restart can't
|
|
226
|
-
-- double-emit and signals recorded while telemetry was off can be
|
|
227
|
-
-- backfilled later.
|
|
228
|
-
exported_at TEXT,
|
|
229
|
-
UNIQUE(anchor_id, reactor, emoji)
|
|
230
|
-
);
|
|
231
|
-
CREATE INDEX IF NOT EXISTS idx_feedback_signals_anchor ON feedback_signals(anchor_id);
|
|
232
|
-
CREATE INDEX IF NOT EXISTS idx_feedback_signals_run ON feedback_signals(workflow_run_id);
|
|
233
|
-
CREATE INDEX IF NOT EXISTS idx_feedback_signals_observed
|
|
234
|
-
ON feedback_signals(observed_at DESC);
|
|
235
|
-
CREATE INDEX IF NOT EXISTS idx_feedback_signals_workflow
|
|
236
|
-
ON feedback_signals(workflow_name, observed_at DESC);
|
|
237
|
-
CREATE INDEX IF NOT EXISTS idx_feedback_signals_export ON feedback_signals(exported_at);
|
|
238
|
-
|
|
239
|
-
-- ── GitHub team-based dashboard visibility (issue #169) ────────────────
|
|
240
|
-
-- These four tables are a CACHE, not a mirror of the org. Nothing here is
|
|
241
|
-
-- enumerated up front: rows appear only for the teams a user who actually
|
|
242
|
-
-- logged in belongs to, resolved on demand (see engine/github/team-visibility.ts).
|
|
243
|
-
-- That is the whole scaling story — an org with thousands of repos and
|
|
244
|
-
-- hundreds of teams costs a handful of requests per logged-in person
|
|
245
|
-
-- instead of a full-org crawl. Safe to delete wholesale; it refills.
|
|
246
|
-
|
|
247
|
-
-- One row per team we have ever resolved repos for.
|
|
248
|
-
CREATE TABLE IF NOT EXISTS github_teams (
|
|
249
|
-
org TEXT NOT NULL,
|
|
250
|
-
slug TEXT NOT NULL,
|
|
251
|
-
name TEXT,
|
|
252
|
-
-- When this team's repo grant was last enumerated.
|
|
253
|
-
repos_synced_at TEXT NOT NULL,
|
|
254
|
-
-- 1 when the enumeration hit the per-team page budget and stopped early,
|
|
255
|
-
-- so github_team_repos is a PREFIX of the real grant. A truncated team
|
|
256
|
-
-- forces its members to fail open — a partial list would hide repos the
|
|
257
|
-
-- person really can see, which is worse than not filtering at all.
|
|
258
|
-
truncated INTEGER NOT NULL DEFAULT 0,
|
|
259
|
-
PRIMARY KEY (org, slug)
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
-- A team's grant, already intersected with the managed-repo set. The repo
|
|
263
|
-
-- column holds the owner/repo full name.
|
|
264
|
-
CREATE TABLE IF NOT EXISTS github_team_repos (
|
|
265
|
-
org TEXT NOT NULL,
|
|
266
|
-
team_slug TEXT NOT NULL,
|
|
267
|
-
repo TEXT NOT NULL,
|
|
268
|
-
PRIMARY KEY (org, team_slug, repo)
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
-- Membership we have LEARNED, not enumerated: one row per (team, login)
|
|
272
|
-
-- discovered while resolving that login. Absence means "unknown", never
|
|
273
|
-
-- "not a member" — which is why every read path fails open.
|
|
274
|
-
CREATE TABLE IF NOT EXISTS github_team_members (
|
|
275
|
-
org TEXT NOT NULL,
|
|
276
|
-
team_slug TEXT NOT NULL,
|
|
277
|
-
login TEXT NOT NULL,
|
|
278
|
-
PRIMARY KEY (org, team_slug, login)
|
|
279
|
-
);
|
|
280
|
-
-- reposForLogin joins membership → team_repos on this column.
|
|
281
|
-
CREATE INDEX IF NOT EXISTS idx_github_team_members_login
|
|
282
|
-
ON github_team_members(login);
|
|
283
|
-
|
|
284
|
-
-- Per-login freshness + outcome, so a resolution that failed or blew its
|
|
285
|
-
-- request budget is remembered for the TTL rather than retried on every
|
|
286
|
-
-- dashboard poll. status is one of: ok | empty | truncated | error | disabled.
|
|
287
|
-
CREATE TABLE IF NOT EXISTS github_visibility_sync (
|
|
288
|
-
login TEXT PRIMARY KEY,
|
|
289
|
-
synced_at TEXT NOT NULL,
|
|
290
|
-
status TEXT NOT NULL,
|
|
291
|
-
-- Free-text detail for the error/truncated cases (admin surface only).
|
|
292
|
-
detail TEXT
|
|
293
|
-
);
|
|
294
|
-
`);
|
|
295
|
-
// Actor logging (issue #205): who triggered a run and how. Additive on both
|
|
296
|
-
// the append-only `executions` ledger and the `workflow_runs` aggregate. The
|
|
297
|
-
// run's `triggered_by` is the ORIGINAL trigger; retry/cancel/approve actors
|
|
298
|
-
// land on the executions ledger, never overwriting the run's origin value.
|
|
299
|
-
// `trigger_actor_type` is one of github | slack | cli | cron | admin | system.
|
|
300
|
-
for (const table of ["executions", "workflow_runs"]) {
|
|
301
|
-
try {
|
|
302
|
-
db.exec(`ALTER TABLE ${table} ADD COLUMN triggered_by TEXT`);
|
|
303
|
-
}
|
|
304
|
-
catch {
|
|
305
|
-
// Column already exists — ignore
|
|
306
|
-
}
|
|
307
|
-
try {
|
|
308
|
-
db.exec(`ALTER TABLE ${table} ADD COLUMN trigger_actor_type TEXT`);
|
|
309
|
-
}
|
|
310
|
-
catch {
|
|
311
|
-
// Column already exists — ignore
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
// Mutable phase-to-phase state for features like the socratic explore
|
|
315
|
-
// loop that accumulate data across reply-gate pauses.
|
|
316
|
-
try {
|
|
317
|
-
db.exec(`ALTER TABLE workflow_runs ADD COLUMN scratch TEXT`);
|
|
318
|
-
}
|
|
319
|
-
catch {
|
|
320
|
-
// Column already exists — ignore
|
|
321
|
-
}
|
|
322
|
-
// Restart attempt counter — bumped each time resumeOrphanedWorkflows
|
|
323
|
-
// re-dispatches a still-'running' row at boot. Acts as a circuit
|
|
324
|
-
// breaker so an OOM-on-restart loop can't churn forever.
|
|
325
|
-
try {
|
|
326
|
-
db.exec(`ALTER TABLE workflow_runs ADD COLUMN restart_count INTEGER NOT NULL DEFAULT 0`);
|
|
327
|
-
}
|
|
328
|
-
catch {
|
|
329
|
-
// Column already exists — ignore
|
|
330
|
-
}
|
|
331
|
-
// Explicit `owner` column. A run targets a GitHub repo identified by
|
|
332
|
-
// (owner, repo); `repo` stays a single path-safe segment (taskIds and
|
|
333
|
-
// workspace/session dirs derive from it), so the owner previously lived
|
|
334
|
-
// ONLY inside the `context` JSON blob. That left the runs list — which
|
|
335
|
-
// omits `context` for payload size — unable to reconstruct `owner/repo`,
|
|
336
|
-
// so the Repos tab showed a bare row + a managed `owner/repo` row for the
|
|
337
|
-
// same repo and the dashboard's GitHub links never resolved. Storing owner
|
|
338
|
-
// as its own column fixes both. Backfill existing rows from context.owner
|
|
339
|
-
// in the same guarded step (runs once, when the column is first added).
|
|
340
|
-
try {
|
|
341
|
-
db.exec(`ALTER TABLE workflow_runs ADD COLUMN owner TEXT`);
|
|
342
|
-
db.exec(`UPDATE workflow_runs
|
|
343
|
-
SET owner = json_extract(context, '$.owner')
|
|
344
|
-
WHERE owner IS NULL AND context IS NOT NULL`);
|
|
345
|
-
}
|
|
346
|
-
catch {
|
|
347
|
-
// Column already exists — ignore
|
|
348
|
-
}
|
|
349
|
-
// ── One repo-identifier rule: (owner, BARE repo) — issue #279 ──────────────
|
|
350
|
-
//
|
|
351
|
-
// The column above fixed the SHAPE for new rows but left two populations
|
|
352
|
-
// behind, so the same column meant two things depending on who wrote it:
|
|
353
|
-
// rows predating it hold the qualified `owner/repo` in `repo` itself, and
|
|
354
|
-
// `executions` never got an `owner` column at all — the dispatcher wrote the
|
|
355
|
-
// qualified string there while the phase executor wrote the bare name, which
|
|
356
|
-
// is every workflow phase row.
|
|
357
|
-
//
|
|
358
|
-
// Six read sites each re-derived "may be bare or qualified" and disagreed
|
|
359
|
-
// about which source wins; #278 shipped a filter built on one reading, and a
|
|
360
|
-
// non-null non-match HIDES rows rather than showing them. So converge the
|
|
361
|
-
// data instead of teaching the seventh consumer the rule.
|
|
362
|
-
//
|
|
363
|
-
// Ordering matters: `workflow_runs` first, because the `executions` owner
|
|
364
|
-
// backfill reads `workflow_runs.owner` back out. Every statement is a no-op
|
|
365
|
-
// on a second run — after it, `instr(repo, '/') = 0` — so this is safe to
|
|
366
|
-
// re-run, which it is, on every boot.
|
|
367
|
-
try {
|
|
368
|
-
db.exec(`UPDATE workflow_runs
|
|
369
|
-
SET owner = CASE WHEN owner IS NULL OR owner = ''
|
|
370
|
-
THEN substr(repo, 1, instr(repo, '/') - 1)
|
|
371
|
-
ELSE owner END,
|
|
372
|
-
repo = substr(repo, instr(repo, '/') + 1)
|
|
373
|
-
WHERE repo IS NOT NULL AND instr(repo, '/') > 0`);
|
|
374
|
-
// A row from before the owner column whose `context.owner` was absent has
|
|
375
|
-
// one more witness: `trigger_id`, which is built as `owner/repo#N` (or
|
|
376
|
-
// `owner/repo::workflow`) from the same pair at dispatch. `resume.ts` and
|
|
377
|
-
// the approval-resume path already PREFER it over the columns, so reading
|
|
378
|
-
// it here is the existing precedence, not a new guess. Slack-originated
|
|
379
|
-
// ids (`slack:…`) carry no repo and are excluded.
|
|
380
|
-
db.exec(`UPDATE workflow_runs
|
|
381
|
-
SET owner = substr(trigger_id, 1, instr(trigger_id, '/') - 1)
|
|
382
|
-
WHERE (owner IS NULL OR owner = '')
|
|
383
|
-
AND repo IS NOT NULL
|
|
384
|
-
AND trigger_id NOT LIKE 'slack:%'
|
|
385
|
-
AND instr(trigger_id, '/') > 0`);
|
|
386
|
-
}
|
|
387
|
-
catch {
|
|
388
|
-
// Best-effort: a run row that won't split is better left alone than
|
|
389
|
-
// failing boot. The read path still tolerates both shapes.
|
|
390
|
-
}
|
|
391
|
-
try {
|
|
392
|
-
db.exec(`ALTER TABLE executions ADD COLUMN owner TEXT`);
|
|
393
|
-
}
|
|
394
|
-
catch {
|
|
395
|
-
// Column already exists — ignore
|
|
396
|
-
}
|
|
397
|
-
try {
|
|
398
|
-
// 1. The account is already in the row, on the dispatcher-written rows that
|
|
399
|
-
// stored the qualified string.
|
|
400
|
-
db.exec(`UPDATE executions
|
|
401
|
-
SET owner = substr(repo, 1, instr(repo, '/') - 1)
|
|
402
|
-
WHERE (owner IS NULL OR owner = '')
|
|
403
|
-
AND repo IS NOT NULL AND instr(repo, '/') > 0`);
|
|
404
|
-
// 2. Otherwise it comes from the run that owns the execution. This is the
|
|
405
|
-
// bulk: every phase row, written bare from `GitSandboxAccess`.
|
|
406
|
-
// `build-cycle` rows are covered by (1) and chat rows carry no repo at
|
|
407
|
-
// all, so there is nothing left needing a `trigger_id` parse.
|
|
408
|
-
db.exec(`UPDATE executions
|
|
409
|
-
SET owner = (SELECT r.owner FROM workflow_runs r WHERE r.id = executions.workflow_run_id)
|
|
410
|
-
WHERE (owner IS NULL OR owner = '') AND workflow_run_id IS NOT NULL`);
|
|
411
|
-
// 3. Now de-qualify, once the account has been rescued off it.
|
|
412
|
-
db.exec(`UPDATE executions
|
|
413
|
-
SET repo = substr(repo, instr(repo, '/') + 1)
|
|
414
|
-
WHERE repo IS NOT NULL AND instr(repo, '/') > 0`);
|
|
415
|
-
}
|
|
416
|
-
catch {
|
|
417
|
-
// Same best-effort rule as above — the ledger is append-only history, and
|
|
418
|
-
// an un-normalized row degrades a dashboard filter, never a run.
|
|
419
|
-
}
|
|
420
|
-
// `feedback_anchors.channel` moved from nullable to a '' sentinel (issue
|
|
421
|
-
// #255) so its UNIQUE actually binds for GitHub — see the CREATE TABLE above.
|
|
422
|
-
// `CREATE TABLE IF NOT EXISTS` can't restate a column, so backfill any rows
|
|
423
|
-
// written by a build that predates the fix. Guarded like every ALTER here: on
|
|
424
|
-
// a table that already accumulated NULL-channel duplicates the UPDATE trips
|
|
425
|
-
// the constraint, and leaving those rows alone is strictly better than
|
|
426
|
-
// failing boot over a cache of reaction anchors.
|
|
427
|
-
try {
|
|
428
|
-
db.exec(`UPDATE feedback_anchors SET channel = '' WHERE channel IS NULL`);
|
|
429
|
-
}
|
|
430
|
-
catch {
|
|
431
|
-
// Pre-existing duplicates — they age out via `retentionDays`.
|
|
432
|
-
}
|
|
433
|
-
// The run's OTel trace/span context (issue #255). A feedback signal can
|
|
434
|
-
// arrive days after the run finished and its span closed, so the only way to
|
|
435
|
-
// put the score on the trace it grades is to remember where that trace was.
|
|
436
|
-
// Captured by the observability adapter in `src/workflows/runner.ts` when the
|
|
437
|
-
// `lastlight.workflow.run` span opens; null whenever telemetry was disabled,
|
|
438
|
-
// in which case the signal exports as its own root span instead.
|
|
439
|
-
for (const col of ["trace_id TEXT", "span_id TEXT"]) {
|
|
440
|
-
try {
|
|
441
|
-
db.exec(`ALTER TABLE workflow_runs ADD COLUMN ${col}`);
|
|
442
|
-
}
|
|
443
|
-
catch {
|
|
444
|
-
// Column already exists — ignore
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
// Gate flavor: 'approve' (explicit approve/reject) vs 'reply' (resolves
|
|
448
|
-
// on any free-form reply in the same thread — used by the socratic
|
|
449
|
-
// explore loop).
|
|
450
|
-
try {
|
|
451
|
-
db.exec(`ALTER TABLE workflow_approvals ADD COLUMN kind TEXT NOT NULL DEFAULT 'approve'`);
|
|
452
|
-
}
|
|
453
|
-
catch {
|
|
454
|
-
// Column already exists — ignore
|
|
455
|
-
}
|
|
456
|
-
// Artifact (handoff doc) filename a gate is asking the reviewer to approve,
|
|
457
|
-
// e.g. 'architect-plan.md'. Lets the focused approval view open the right
|
|
458
|
-
// doc. Nullable — most gates carry no artifact. Additive, safe on existing DBs.
|
|
459
|
-
try {
|
|
460
|
-
db.exec(`ALTER TABLE workflow_approvals ADD COLUMN artifact TEXT`);
|
|
461
|
-
}
|
|
462
|
-
catch {
|
|
463
|
-
// Column already exists — ignore
|
|
464
|
-
}
|
|
465
|
-
// Add session_id column to executions so the dashboard can resolve a
|
|
466
|
-
// phase click to its agent session log. Additive — safe on existing DBs.
|
|
467
|
-
try {
|
|
468
|
-
db.exec(`ALTER TABLE executions ADD COLUMN session_id TEXT`);
|
|
469
|
-
}
|
|
470
|
-
catch {
|
|
471
|
-
// Column already exists — ignore
|
|
472
|
-
}
|
|
473
|
-
// Per-execution runtime usage metrics, captured from the OpenCode
|
|
474
|
-
// step_finish events. Lets the dashboard show cost / tokens per phase
|
|
475
|
-
// and lets us aggregate spend later. All additive, safe on existing DBs.
|
|
476
|
-
for (const col of [
|
|
477
|
-
"cost_usd REAL",
|
|
478
|
-
"input_tokens INTEGER",
|
|
479
|
-
"cache_creation_input_tokens INTEGER",
|
|
480
|
-
"cache_read_input_tokens INTEGER",
|
|
481
|
-
"output_tokens INTEGER",
|
|
482
|
-
"api_duration_ms INTEGER",
|
|
483
|
-
"stop_reason TEXT",
|
|
484
|
-
// Links a phase execution to its owning workflow_run. Dedup and
|
|
485
|
-
// "already running / done" checks scope to this column so a fresh
|
|
486
|
-
// re-trigger of the same workflow on the same issue creates new
|
|
487
|
-
// executions instead of reusing the old run's rows.
|
|
488
|
-
"workflow_run_id TEXT",
|
|
489
|
-
// Final assistant text for a phase execution. Populated only for
|
|
490
|
-
// loop iterations whose output is referenced by `scratch.<key>
|
|
491
|
-
// .lastOutputExecutionId` — keeps the inlined LLM output out of
|
|
492
|
-
// `workflow_runs.scratch` (which is read on every list query)
|
|
493
|
-
// while still being available to the runner's resume path.
|
|
494
|
-
"output_text TEXT",
|
|
495
|
-
// JSON map of agentic-pi extensions active for this execution
|
|
496
|
-
// (file-search / github / web-search → {status, mode?, provider?,
|
|
497
|
-
// toolCount?, reason?}). Surfaced in the dashboard phase-detail panel.
|
|
498
|
-
"extension_status TEXT",
|
|
499
|
-
// JSON object of agentic-pi's skill-loading status for this execution
|
|
500
|
-
// ({status, discovered, skills[], mappedPaths, noSkills}). The skill-
|
|
501
|
-
// loading counterpart to extension_status; surfaced in the same panel.
|
|
502
|
-
"skills_status TEXT",
|
|
503
|
-
]) {
|
|
504
|
-
try {
|
|
505
|
-
db.exec(`ALTER TABLE executions ADD COLUMN ${col}`);
|
|
506
|
-
}
|
|
507
|
-
catch {
|
|
508
|
-
// Column already exists — ignore
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
try {
|
|
512
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_executions_workflow_run ON executions(workflow_run_id, skill)`);
|
|
513
|
-
}
|
|
514
|
-
catch {
|
|
515
|
-
// Index already exists — ignore
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
//# sourceMappingURL=migrate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/state/migrate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,OAAO,CAAC,EAAqB;IAC3C,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuRP,CAAC,CA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