@mcoda/db 0.1.8 → 0.1.10
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/CHANGELOG.md +3 -0
- package/dist/migrations/global/GlobalMigrations.d.ts.map +1 -1
- package/dist/migrations/global/GlobalMigrations.js +151 -0
- package/dist/migrations/workspace/WorkspaceMigrations.d.ts +2 -1
- package/dist/migrations/workspace/WorkspaceMigrations.d.ts.map +1 -1
- package/dist/migrations/workspace/WorkspaceMigrations.js +60 -1
- package/dist/repositories/global/GlobalRepository.d.ts +35 -0
- package/dist/repositories/global/GlobalRepository.d.ts.map +1 -1
- package/dist/repositories/global/GlobalRepository.js +131 -8
- package/dist/repositories/workspace/WorkspaceRepository.d.ts +47 -1
- package/dist/repositories/workspace/WorkspaceRepository.d.ts.map +1 -1
- package/dist/repositories/workspace/WorkspaceRepository.js +273 -43
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalMigrations.d.ts","sourceRoot":"","sources":["../../../src/migrations/global/GlobalMigrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;;GAGG;AACH,qBAAa,gBAAgB;WACd,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"GlobalMigrations.d.ts","sourceRoot":"","sources":["../../../src/migrations/global/GlobalMigrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;;GAGG;AACH,qBAAa,gBAAgB;WACd,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAoe9C"}
|
|
@@ -11,10 +11,20 @@ export class GlobalMigrations {
|
|
|
11
11
|
slug TEXT UNIQUE NOT NULL,
|
|
12
12
|
adapter TEXT NOT NULL,
|
|
13
13
|
default_model TEXT,
|
|
14
|
+
openai_compatible INTEGER,
|
|
15
|
+
context_window INTEGER,
|
|
16
|
+
max_output_tokens INTEGER,
|
|
17
|
+
supports_tools INTEGER,
|
|
14
18
|
rating INTEGER,
|
|
15
19
|
reasoning_rating INTEGER,
|
|
16
20
|
best_usage TEXT,
|
|
17
21
|
cost_per_million REAL,
|
|
22
|
+
max_complexity INTEGER,
|
|
23
|
+
rating_samples INTEGER,
|
|
24
|
+
rating_last_score REAL,
|
|
25
|
+
rating_updated_at TEXT,
|
|
26
|
+
complexity_samples INTEGER,
|
|
27
|
+
complexity_updated_at TEXT,
|
|
18
28
|
config_json TEXT,
|
|
19
29
|
created_at TEXT NOT NULL,
|
|
20
30
|
updated_at TEXT NOT NULL
|
|
@@ -88,16 +98,48 @@ export class GlobalMigrations {
|
|
|
88
98
|
agent_id TEXT REFERENCES agents(id) ON DELETE SET NULL,
|
|
89
99
|
command_run_id TEXT REFERENCES command_runs(id) ON DELETE SET NULL,
|
|
90
100
|
model_name TEXT,
|
|
101
|
+
command_name TEXT,
|
|
102
|
+
action TEXT,
|
|
103
|
+
invocation_kind TEXT,
|
|
104
|
+
provider TEXT,
|
|
105
|
+
currency TEXT,
|
|
91
106
|
tokens_prompt INTEGER,
|
|
92
107
|
tokens_completion INTEGER,
|
|
93
108
|
tokens_total INTEGER,
|
|
109
|
+
tokens_cached INTEGER,
|
|
110
|
+
tokens_cache_read INTEGER,
|
|
111
|
+
tokens_cache_write INTEGER,
|
|
94
112
|
cost_estimate REAL,
|
|
95
113
|
duration_seconds REAL,
|
|
114
|
+
duration_ms REAL,
|
|
115
|
+
started_at TEXT,
|
|
116
|
+
finished_at TEXT,
|
|
96
117
|
timestamp TEXT NOT NULL,
|
|
97
118
|
metadata_json TEXT
|
|
98
119
|
);
|
|
99
120
|
|
|
100
121
|
CREATE INDEX IF NOT EXISTS idx_token_usage_command_run_id ON token_usage(command_run_id);
|
|
122
|
+
|
|
123
|
+
CREATE TABLE IF NOT EXISTS agent_run_ratings (
|
|
124
|
+
id TEXT PRIMARY KEY,
|
|
125
|
+
agent_id TEXT NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
|
126
|
+
job_id TEXT,
|
|
127
|
+
command_run_id TEXT,
|
|
128
|
+
task_id TEXT,
|
|
129
|
+
task_key TEXT,
|
|
130
|
+
command_name TEXT,
|
|
131
|
+
discipline TEXT,
|
|
132
|
+
complexity INTEGER,
|
|
133
|
+
quality_score REAL,
|
|
134
|
+
tokens_total INTEGER,
|
|
135
|
+
duration_seconds REAL,
|
|
136
|
+
iterations INTEGER,
|
|
137
|
+
total_cost REAL,
|
|
138
|
+
run_score REAL,
|
|
139
|
+
rating_version TEXT,
|
|
140
|
+
raw_review_json TEXT,
|
|
141
|
+
created_at TEXT NOT NULL
|
|
142
|
+
);
|
|
101
143
|
`);
|
|
102
144
|
};
|
|
103
145
|
await createSchema();
|
|
@@ -128,6 +170,16 @@ export class GlobalMigrations {
|
|
|
128
170
|
const hasAgentReasoningRating = agentsInfo.some((col) => col.name === "reasoning_rating");
|
|
129
171
|
const hasAgentBestUsage = agentsInfo.some((col) => col.name === "best_usage");
|
|
130
172
|
const hasAgentCost = agentsInfo.some((col) => col.name === "cost_per_million");
|
|
173
|
+
const hasAgentMaxComplexity = agentsInfo.some((col) => col.name === "max_complexity");
|
|
174
|
+
const hasAgentOpenaiCompatible = agentsInfo.some((col) => col.name === "openai_compatible");
|
|
175
|
+
const hasAgentContextWindow = agentsInfo.some((col) => col.name === "context_window");
|
|
176
|
+
const hasAgentMaxOutputTokens = agentsInfo.some((col) => col.name === "max_output_tokens");
|
|
177
|
+
const hasAgentSupportsTools = agentsInfo.some((col) => col.name === "supports_tools");
|
|
178
|
+
const hasAgentRatingSamples = agentsInfo.some((col) => col.name === "rating_samples");
|
|
179
|
+
const hasAgentRatingLastScore = agentsInfo.some((col) => col.name === "rating_last_score");
|
|
180
|
+
const hasAgentRatingUpdatedAt = agentsInfo.some((col) => col.name === "rating_updated_at");
|
|
181
|
+
const hasAgentComplexitySamples = agentsInfo.some((col) => col.name === "complexity_samples");
|
|
182
|
+
const hasAgentComplexityUpdatedAt = agentsInfo.some((col) => col.name === "complexity_updated_at");
|
|
131
183
|
if (!hasAgentRating) {
|
|
132
184
|
await db.exec("ALTER TABLE agents ADD COLUMN rating INTEGER");
|
|
133
185
|
}
|
|
@@ -140,6 +192,80 @@ export class GlobalMigrations {
|
|
|
140
192
|
if (!hasAgentCost) {
|
|
141
193
|
await db.exec("ALTER TABLE agents ADD COLUMN cost_per_million REAL");
|
|
142
194
|
}
|
|
195
|
+
if (!hasAgentMaxComplexity) {
|
|
196
|
+
await db.exec("ALTER TABLE agents ADD COLUMN max_complexity INTEGER");
|
|
197
|
+
}
|
|
198
|
+
if (!hasAgentOpenaiCompatible) {
|
|
199
|
+
await db.exec("ALTER TABLE agents ADD COLUMN openai_compatible INTEGER");
|
|
200
|
+
}
|
|
201
|
+
if (!hasAgentContextWindow) {
|
|
202
|
+
await db.exec("ALTER TABLE agents ADD COLUMN context_window INTEGER");
|
|
203
|
+
}
|
|
204
|
+
if (!hasAgentMaxOutputTokens) {
|
|
205
|
+
await db.exec("ALTER TABLE agents ADD COLUMN max_output_tokens INTEGER");
|
|
206
|
+
}
|
|
207
|
+
if (!hasAgentSupportsTools) {
|
|
208
|
+
await db.exec("ALTER TABLE agents ADD COLUMN supports_tools INTEGER");
|
|
209
|
+
}
|
|
210
|
+
if (!hasAgentRatingSamples) {
|
|
211
|
+
await db.exec("ALTER TABLE agents ADD COLUMN rating_samples INTEGER");
|
|
212
|
+
}
|
|
213
|
+
if (!hasAgentRatingLastScore) {
|
|
214
|
+
await db.exec("ALTER TABLE agents ADD COLUMN rating_last_score REAL");
|
|
215
|
+
}
|
|
216
|
+
if (!hasAgentRatingUpdatedAt) {
|
|
217
|
+
await db.exec("ALTER TABLE agents ADD COLUMN rating_updated_at TEXT");
|
|
218
|
+
}
|
|
219
|
+
if (!hasAgentComplexitySamples) {
|
|
220
|
+
await db.exec("ALTER TABLE agents ADD COLUMN complexity_samples INTEGER");
|
|
221
|
+
}
|
|
222
|
+
if (!hasAgentComplexityUpdatedAt) {
|
|
223
|
+
await db.exec("ALTER TABLE agents ADD COLUMN complexity_updated_at TEXT");
|
|
224
|
+
}
|
|
225
|
+
await db.exec(`
|
|
226
|
+
UPDATE agents
|
|
227
|
+
SET openai_compatible = CASE
|
|
228
|
+
WHEN adapter IN ('openai-api') THEN 1
|
|
229
|
+
ELSE 0
|
|
230
|
+
END
|
|
231
|
+
WHERE openai_compatible IS NULL
|
|
232
|
+
`);
|
|
233
|
+
await db.exec(`
|
|
234
|
+
UPDATE agents
|
|
235
|
+
SET supports_tools = CASE
|
|
236
|
+
WHEN adapter IN ('openai-api','openai-cli','codex-cli') THEN 1
|
|
237
|
+
ELSE 0
|
|
238
|
+
END
|
|
239
|
+
WHERE supports_tools IS NULL
|
|
240
|
+
`);
|
|
241
|
+
await db.exec(`
|
|
242
|
+
UPDATE agents
|
|
243
|
+
SET context_window = COALESCE(context_window, 8192)
|
|
244
|
+
WHERE context_window IS NULL
|
|
245
|
+
`);
|
|
246
|
+
await db.exec(`
|
|
247
|
+
UPDATE agents
|
|
248
|
+
SET max_output_tokens = COALESCE(max_output_tokens, 2048)
|
|
249
|
+
WHERE max_output_tokens IS NULL
|
|
250
|
+
`);
|
|
251
|
+
const tokenUsageInfo = await db.all("PRAGMA table_info(token_usage)");
|
|
252
|
+
const tokenUsageColumns = new Set(tokenUsageInfo.map((col) => col.name));
|
|
253
|
+
const ensureTokenUsageColumn = async (columnDef, name) => {
|
|
254
|
+
if (tokenUsageColumns.has(name))
|
|
255
|
+
return;
|
|
256
|
+
await db.exec(`ALTER TABLE token_usage ADD COLUMN ${columnDef}`);
|
|
257
|
+
};
|
|
258
|
+
await ensureTokenUsageColumn("command_name TEXT", "command_name");
|
|
259
|
+
await ensureTokenUsageColumn("action TEXT", "action");
|
|
260
|
+
await ensureTokenUsageColumn("invocation_kind TEXT", "invocation_kind");
|
|
261
|
+
await ensureTokenUsageColumn("provider TEXT", "provider");
|
|
262
|
+
await ensureTokenUsageColumn("currency TEXT", "currency");
|
|
263
|
+
await ensureTokenUsageColumn("tokens_cached INTEGER", "tokens_cached");
|
|
264
|
+
await ensureTokenUsageColumn("tokens_cache_read INTEGER", "tokens_cache_read");
|
|
265
|
+
await ensureTokenUsageColumn("tokens_cache_write INTEGER", "tokens_cache_write");
|
|
266
|
+
await ensureTokenUsageColumn("duration_ms REAL", "duration_ms");
|
|
267
|
+
await ensureTokenUsageColumn("started_at TEXT", "started_at");
|
|
268
|
+
await ensureTokenUsageColumn("finished_at TEXT", "finished_at");
|
|
143
269
|
await db.exec(`
|
|
144
270
|
UPDATE agents
|
|
145
271
|
SET
|
|
@@ -263,6 +389,22 @@ export class GlobalMigrations {
|
|
|
263
389
|
END
|
|
264
390
|
)
|
|
265
391
|
WHERE rating IS NULL OR reasoning_rating IS NULL OR best_usage IS NULL OR cost_per_million IS NULL;
|
|
392
|
+
`);
|
|
393
|
+
await db.exec(`
|
|
394
|
+
UPDATE agents
|
|
395
|
+
SET
|
|
396
|
+
max_complexity = COALESCE(max_complexity, 5),
|
|
397
|
+
rating_samples = COALESCE(rating_samples, 0),
|
|
398
|
+
rating_last_score = COALESCE(rating_last_score, rating),
|
|
399
|
+
rating_updated_at = COALESCE(rating_updated_at, updated_at),
|
|
400
|
+
complexity_samples = COALESCE(complexity_samples, 0),
|
|
401
|
+
complexity_updated_at = COALESCE(complexity_updated_at, updated_at)
|
|
402
|
+
WHERE max_complexity IS NULL
|
|
403
|
+
OR rating_samples IS NULL
|
|
404
|
+
OR rating_last_score IS NULL
|
|
405
|
+
OR rating_updated_at IS NULL
|
|
406
|
+
OR complexity_samples IS NULL
|
|
407
|
+
OR complexity_updated_at IS NULL;
|
|
266
408
|
`);
|
|
267
409
|
const workspaceDefaultsInfo = await db.all("PRAGMA table_info(workspace_defaults)");
|
|
268
410
|
const hasWorkspaceId = workspaceDefaultsInfo.some((col) => col.name === "workspace_id");
|
|
@@ -315,5 +457,14 @@ export class GlobalMigrations {
|
|
|
315
457
|
await db.exec("ALTER TABLE workspace_defaults ADD COLUMN docdex_scope TEXT");
|
|
316
458
|
}
|
|
317
459
|
}
|
|
460
|
+
const ensureCapabilities = async (slug, capabilities) => {
|
|
461
|
+
const row = (await db.get("SELECT id FROM agents WHERE lower(slug) = ?", slug.toLowerCase()));
|
|
462
|
+
if (!row?.id)
|
|
463
|
+
return;
|
|
464
|
+
for (const capability of capabilities) {
|
|
465
|
+
await db.run("INSERT OR IGNORE INTO agent_capabilities (agent_id, capability) VALUES (?, ?)", row.id, capability);
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
await ensureCapabilities("gateway-router", ["plan", "docdex_query"]);
|
|
318
469
|
}
|
|
319
470
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Database } from "sqlite";
|
|
2
2
|
/**
|
|
3
|
-
* Workspace database migrations for
|
|
3
|
+
* Workspace database migrations for `~/.mcoda/workspaces/<fingerprint>/mcoda.db`.
|
|
4
4
|
* The schema matches the planning/task model defined in the SDS.
|
|
5
5
|
*/
|
|
6
6
|
export declare class WorkspaceMigrations {
|
|
7
7
|
static run(db: Database): Promise<void>;
|
|
8
|
+
private static ensureColumn;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=WorkspaceMigrations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceMigrations.d.ts","sourceRoot":"","sources":["../../../src/migrations/workspace/WorkspaceMigrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;;GAGG;AACH,qBAAa,mBAAmB;WACjB,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"WorkspaceMigrations.d.ts","sourceRoot":"","sources":["../../../src/migrations/workspace/WorkspaceMigrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;;GAGG;AACH,qBAAa,mBAAmB;WACjB,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;mBAmSxB,YAAY;CASlC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Workspace database migrations for
|
|
2
|
+
* Workspace database migrations for `~/.mcoda/workspaces/<fingerprint>/mcoda.db`.
|
|
3
3
|
* The schema matches the planning/task model defined in the SDS.
|
|
4
4
|
*/
|
|
5
5
|
export class WorkspaceMigrations {
|
|
@@ -88,6 +88,8 @@ export class WorkspaceMigrations {
|
|
|
88
88
|
type TEXT NOT NULL,
|
|
89
89
|
state TEXT NOT NULL,
|
|
90
90
|
command_name TEXT,
|
|
91
|
+
agent_id TEXT,
|
|
92
|
+
agent_ids_json TEXT,
|
|
91
93
|
payload_json TEXT,
|
|
92
94
|
total_items INTEGER,
|
|
93
95
|
processed_items INTEGER,
|
|
@@ -103,6 +105,7 @@ export class WorkspaceMigrations {
|
|
|
103
105
|
workspace_id TEXT NOT NULL,
|
|
104
106
|
command_name TEXT NOT NULL,
|
|
105
107
|
job_id TEXT REFERENCES jobs(id) ON DELETE SET NULL,
|
|
108
|
+
agent_id TEXT,
|
|
106
109
|
task_ids_json TEXT,
|
|
107
110
|
git_branch TEXT,
|
|
108
111
|
git_base_branch TEXT,
|
|
@@ -132,6 +135,19 @@ export class WorkspaceMigrations {
|
|
|
132
135
|
run_context_json TEXT
|
|
133
136
|
);
|
|
134
137
|
|
|
138
|
+
CREATE TABLE IF NOT EXISTS task_status_events (
|
|
139
|
+
id TEXT PRIMARY KEY,
|
|
140
|
+
task_id TEXT NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
|
141
|
+
from_status TEXT,
|
|
142
|
+
to_status TEXT NOT NULL,
|
|
143
|
+
timestamp TEXT NOT NULL,
|
|
144
|
+
command_name TEXT,
|
|
145
|
+
job_id TEXT REFERENCES jobs(id) ON DELETE SET NULL,
|
|
146
|
+
task_run_id TEXT REFERENCES task_runs(id) ON DELETE SET NULL,
|
|
147
|
+
agent_id TEXT,
|
|
148
|
+
metadata_json TEXT
|
|
149
|
+
);
|
|
150
|
+
|
|
135
151
|
CREATE TABLE IF NOT EXISTS task_locks (
|
|
136
152
|
task_id TEXT PRIMARY KEY REFERENCES tasks(id) ON DELETE CASCADE,
|
|
137
153
|
task_run_id TEXT NOT NULL REFERENCES task_runs(id) ON DELETE CASCADE,
|
|
@@ -141,6 +157,7 @@ export class WorkspaceMigrations {
|
|
|
141
157
|
);
|
|
142
158
|
|
|
143
159
|
CREATE INDEX IF NOT EXISTS idx_task_locks_expires_at ON task_locks(expires_at);
|
|
160
|
+
CREATE INDEX IF NOT EXISTS idx_task_status_events_task_id_timestamp ON task_status_events(task_id, timestamp);
|
|
144
161
|
|
|
145
162
|
CREATE TABLE IF NOT EXISTS task_qa_runs (
|
|
146
163
|
id TEXT PRIMARY KEY,
|
|
@@ -196,6 +213,8 @@ export class WorkspaceMigrations {
|
|
|
196
213
|
author_type TEXT NOT NULL,
|
|
197
214
|
author_agent_id TEXT,
|
|
198
215
|
category TEXT,
|
|
216
|
+
slug TEXT,
|
|
217
|
+
status TEXT DEFAULT 'open',
|
|
199
218
|
file TEXT,
|
|
200
219
|
line INTEGER,
|
|
201
220
|
path_hint TEXT,
|
|
@@ -233,14 +252,54 @@ export class WorkspaceMigrations {
|
|
|
233
252
|
project_id TEXT REFERENCES projects(id) ON DELETE SET NULL,
|
|
234
253
|
epic_id TEXT REFERENCES epics(id) ON DELETE SET NULL,
|
|
235
254
|
user_story_id TEXT REFERENCES user_stories(id) ON DELETE SET NULL,
|
|
255
|
+
command_name TEXT,
|
|
256
|
+
action TEXT,
|
|
257
|
+
invocation_kind TEXT,
|
|
258
|
+
provider TEXT,
|
|
259
|
+
currency TEXT,
|
|
236
260
|
tokens_prompt INTEGER,
|
|
237
261
|
tokens_completion INTEGER,
|
|
238
262
|
tokens_total INTEGER,
|
|
263
|
+
tokens_cached INTEGER,
|
|
264
|
+
tokens_cache_read INTEGER,
|
|
265
|
+
tokens_cache_write INTEGER,
|
|
239
266
|
cost_estimate REAL,
|
|
240
267
|
duration_seconds REAL,
|
|
268
|
+
duration_ms REAL,
|
|
269
|
+
started_at TEXT,
|
|
270
|
+
finished_at TEXT,
|
|
241
271
|
timestamp TEXT NOT NULL,
|
|
242
272
|
metadata_json TEXT
|
|
243
273
|
);
|
|
244
274
|
`);
|
|
275
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "command_name TEXT");
|
|
276
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "action TEXT");
|
|
277
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "invocation_kind TEXT");
|
|
278
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "provider TEXT");
|
|
279
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "currency TEXT");
|
|
280
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "tokens_cached INTEGER");
|
|
281
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "tokens_cache_read INTEGER");
|
|
282
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "tokens_cache_write INTEGER");
|
|
283
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "duration_ms REAL");
|
|
284
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "started_at TEXT");
|
|
285
|
+
await WorkspaceMigrations.ensureColumn(db, "token_usage", "finished_at TEXT");
|
|
286
|
+
await WorkspaceMigrations.ensureColumn(db, "jobs", "agent_id TEXT");
|
|
287
|
+
await WorkspaceMigrations.ensureColumn(db, "jobs", "agent_ids_json TEXT");
|
|
288
|
+
await WorkspaceMigrations.ensureColumn(db, "command_runs", "agent_id TEXT");
|
|
289
|
+
await WorkspaceMigrations.ensureColumn(db, "task_comments", "slug TEXT");
|
|
290
|
+
await WorkspaceMigrations.ensureColumn(db, "task_comments", "status TEXT");
|
|
291
|
+
await db.exec(`CREATE INDEX IF NOT EXISTS idx_task_comments_slug ON task_comments(task_id, slug);`);
|
|
292
|
+
await db.exec(`UPDATE task_comments SET status = 'open' WHERE status IS NULL;`);
|
|
293
|
+
}
|
|
294
|
+
static async ensureColumn(db, table, columnDef) {
|
|
295
|
+
try {
|
|
296
|
+
await db.exec(`ALTER TABLE ${table} ADD COLUMN ${columnDef};`);
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
const message = String(error?.message ?? error);
|
|
300
|
+
if (/duplicate column name/i.test(message))
|
|
301
|
+
return;
|
|
302
|
+
throw error;
|
|
303
|
+
}
|
|
245
304
|
}
|
|
246
305
|
}
|
|
@@ -19,14 +19,47 @@ export interface GlobalTokenUsageInsert {
|
|
|
19
19
|
agentId?: string | null;
|
|
20
20
|
commandRunId?: string | null;
|
|
21
21
|
modelName?: string | null;
|
|
22
|
+
commandName?: string | null;
|
|
23
|
+
action?: string | null;
|
|
24
|
+
invocationKind?: string | null;
|
|
25
|
+
provider?: string | null;
|
|
26
|
+
currency?: string | null;
|
|
22
27
|
tokensPrompt?: number | null;
|
|
23
28
|
tokensCompletion?: number | null;
|
|
24
29
|
tokensTotal?: number | null;
|
|
30
|
+
tokensCached?: number | null;
|
|
31
|
+
tokensCacheRead?: number | null;
|
|
32
|
+
tokensCacheWrite?: number | null;
|
|
25
33
|
costEstimate?: number | null;
|
|
26
34
|
durationSeconds?: number | null;
|
|
35
|
+
durationMs?: number | null;
|
|
36
|
+
startedAt?: string | null;
|
|
37
|
+
finishedAt?: string | null;
|
|
27
38
|
timestamp: string;
|
|
28
39
|
metadata?: Record<string, unknown>;
|
|
29
40
|
}
|
|
41
|
+
export interface AgentRunRatingInsert {
|
|
42
|
+
agentId: string;
|
|
43
|
+
jobId?: string | null;
|
|
44
|
+
commandRunId?: string | null;
|
|
45
|
+
taskId?: string | null;
|
|
46
|
+
taskKey?: string | null;
|
|
47
|
+
commandName?: string | null;
|
|
48
|
+
discipline?: string | null;
|
|
49
|
+
complexity?: number | null;
|
|
50
|
+
qualityScore?: number | null;
|
|
51
|
+
tokensTotal?: number | null;
|
|
52
|
+
durationSeconds?: number | null;
|
|
53
|
+
iterations?: number | null;
|
|
54
|
+
totalCost?: number | null;
|
|
55
|
+
runScore?: number | null;
|
|
56
|
+
ratingVersion?: string | null;
|
|
57
|
+
rawReview?: Record<string, unknown> | null;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
}
|
|
60
|
+
export interface AgentRunRatingRow extends AgentRunRatingInsert {
|
|
61
|
+
id: string;
|
|
62
|
+
}
|
|
30
63
|
export declare class GlobalRepository {
|
|
31
64
|
private db;
|
|
32
65
|
private connection?;
|
|
@@ -67,5 +100,7 @@ export declare class GlobalRepository {
|
|
|
67
100
|
result?: Record<string, unknown>;
|
|
68
101
|
}): Promise<void>;
|
|
69
102
|
recordTokenUsage(entry: GlobalTokenUsageInsert): Promise<void>;
|
|
103
|
+
insertAgentRunRating(entry: AgentRunRatingInsert): Promise<AgentRunRatingRow>;
|
|
104
|
+
listAgentRunRatings(agentId: string, limit?: number): Promise<AgentRunRatingRow[]>;
|
|
70
105
|
}
|
|
71
106
|
//# sourceMappingURL=GlobalRepository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/global/GlobalRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"GlobalRepository.d.ts","sourceRoot":"","sources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,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAiBrE,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAoB3E,kBAAkB,CACtB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE;QACN,MAAM,EAAE,mBAAmB,CAAC;QAC5B,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClC,GACA,OAAO,CAAC,IAAI,CAAC;IAcV,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoD9D,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6C7E,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAgCrF"}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { Connection } from "../../sqlite/connection.js";
|
|
3
3
|
import { GlobalMigrations } from "../../migrations/global/GlobalMigrations.js";
|
|
4
|
+
const toBool = (value) => value === null || value === undefined ? undefined : Boolean(value);
|
|
4
5
|
const mapAgentRow = (row) => ({
|
|
5
6
|
id: row.id,
|
|
6
7
|
slug: row.slug,
|
|
7
8
|
adapter: row.adapter,
|
|
8
9
|
defaultModel: row.default_model ?? undefined,
|
|
10
|
+
openaiCompatible: toBool(row.openai_compatible),
|
|
11
|
+
contextWindow: row.context_window ?? undefined,
|
|
12
|
+
maxOutputTokens: row.max_output_tokens ?? undefined,
|
|
13
|
+
supportsTools: toBool(row.supports_tools),
|
|
9
14
|
rating: row.rating ?? undefined,
|
|
10
15
|
reasoningRating: row.reasoning_rating ?? undefined,
|
|
11
16
|
bestUsage: row.best_usage ?? undefined,
|
|
12
17
|
costPerMillion: row.cost_per_million ?? undefined,
|
|
18
|
+
maxComplexity: row.max_complexity ?? undefined,
|
|
19
|
+
ratingSamples: row.rating_samples ?? undefined,
|
|
20
|
+
ratingLastScore: row.rating_last_score ?? undefined,
|
|
21
|
+
ratingUpdatedAt: row.rating_updated_at ?? undefined,
|
|
22
|
+
complexitySamples: row.complexity_samples ?? undefined,
|
|
23
|
+
complexityUpdatedAt: row.complexity_updated_at ?? undefined,
|
|
13
24
|
config: row.config_json ? JSON.parse(row.config_json) : undefined,
|
|
14
25
|
createdAt: row.created_at,
|
|
15
26
|
updatedAt: row.updated_at,
|
|
@@ -30,22 +41,22 @@ export class GlobalRepository {
|
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
async listAgents() {
|
|
33
|
-
const rows = await this.db.all("SELECT id, slug, adapter, default_model, rating, reasoning_rating, best_usage, cost_per_million, config_json, created_at, updated_at FROM agents ORDER BY slug ASC");
|
|
44
|
+
const rows = await this.db.all("SELECT id, slug, adapter, default_model, openai_compatible, context_window, max_output_tokens, supports_tools, rating, reasoning_rating, best_usage, cost_per_million, max_complexity, rating_samples, rating_last_score, rating_updated_at, complexity_samples, complexity_updated_at, config_json, created_at, updated_at FROM agents ORDER BY slug ASC");
|
|
34
45
|
return rows.map(mapAgentRow);
|
|
35
46
|
}
|
|
36
47
|
async getAgentById(id) {
|
|
37
|
-
const row = await this.db.get("SELECT id, slug, adapter, default_model, rating, reasoning_rating, best_usage, cost_per_million, config_json, created_at, updated_at FROM agents WHERE id = ?", id);
|
|
48
|
+
const row = await this.db.get("SELECT id, slug, adapter, default_model, openai_compatible, context_window, max_output_tokens, supports_tools, rating, reasoning_rating, best_usage, cost_per_million, max_complexity, rating_samples, rating_last_score, rating_updated_at, complexity_samples, complexity_updated_at, config_json, created_at, updated_at FROM agents WHERE id = ?", id);
|
|
38
49
|
return row ? mapAgentRow(row) : undefined;
|
|
39
50
|
}
|
|
40
51
|
async getAgentBySlug(slug) {
|
|
41
|
-
const row = await this.db.get("SELECT id, slug, adapter, default_model, rating, reasoning_rating, best_usage, cost_per_million, config_json, created_at, updated_at FROM agents WHERE slug = ?", slug);
|
|
52
|
+
const row = await this.db.get("SELECT id, slug, adapter, default_model, openai_compatible, context_window, max_output_tokens, supports_tools, rating, reasoning_rating, best_usage, cost_per_million, max_complexity, rating_samples, rating_last_score, rating_updated_at, complexity_samples, complexity_updated_at, config_json, created_at, updated_at FROM agents WHERE slug = ?", slug);
|
|
42
53
|
return row ? mapAgentRow(row) : undefined;
|
|
43
54
|
}
|
|
44
55
|
async createAgent(input) {
|
|
45
56
|
const now = new Date().toISOString();
|
|
46
57
|
const id = randomUUID();
|
|
47
|
-
await this.db.run(`INSERT INTO agents (id, slug, adapter, default_model, rating, reasoning_rating, best_usage, cost_per_million, config_json, created_at, updated_at)
|
|
48
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, input.slug, input.adapter, input.defaultModel ?? null, input.rating ?? null, input.reasoningRating ?? null, input.bestUsage ?? null, input.costPerMillion ?? null, input.config ? JSON.stringify(input.config) : null, now, now);
|
|
58
|
+
await this.db.run(`INSERT INTO agents (id, slug, adapter, default_model, openai_compatible, context_window, max_output_tokens, supports_tools, rating, reasoning_rating, best_usage, cost_per_million, max_complexity, rating_samples, rating_last_score, rating_updated_at, complexity_samples, complexity_updated_at, config_json, created_at, updated_at)
|
|
59
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, input.slug, input.adapter, input.defaultModel ?? null, input.openaiCompatible === undefined ? null : input.openaiCompatible ? 1 : 0, input.contextWindow ?? null, input.maxOutputTokens ?? null, input.supportsTools === undefined ? null : input.supportsTools ? 1 : 0, input.rating ?? null, input.reasoningRating ?? null, input.bestUsage ?? null, input.costPerMillion ?? null, input.maxComplexity ?? null, input.ratingSamples ?? null, input.ratingLastScore ?? null, input.ratingUpdatedAt ?? null, input.complexitySamples ?? null, input.complexityUpdatedAt ?? null, input.config ? JSON.stringify(input.config) : null, now, now);
|
|
49
60
|
if (input.capabilities) {
|
|
50
61
|
await this.setAgentCapabilities(id, input.capabilities);
|
|
51
62
|
}
|
|
@@ -68,6 +79,22 @@ export class GlobalRepository {
|
|
|
68
79
|
updates.push("default_model = ?");
|
|
69
80
|
params.push(patch.defaultModel);
|
|
70
81
|
}
|
|
82
|
+
if (patch.openaiCompatible !== undefined) {
|
|
83
|
+
updates.push("openai_compatible = ?");
|
|
84
|
+
params.push(patch.openaiCompatible ? 1 : 0);
|
|
85
|
+
}
|
|
86
|
+
if (patch.contextWindow !== undefined) {
|
|
87
|
+
updates.push("context_window = ?");
|
|
88
|
+
params.push(patch.contextWindow);
|
|
89
|
+
}
|
|
90
|
+
if (patch.maxOutputTokens !== undefined) {
|
|
91
|
+
updates.push("max_output_tokens = ?");
|
|
92
|
+
params.push(patch.maxOutputTokens);
|
|
93
|
+
}
|
|
94
|
+
if (patch.supportsTools !== undefined) {
|
|
95
|
+
updates.push("supports_tools = ?");
|
|
96
|
+
params.push(patch.supportsTools ? 1 : 0);
|
|
97
|
+
}
|
|
71
98
|
if (patch.rating !== undefined) {
|
|
72
99
|
updates.push("rating = ?");
|
|
73
100
|
params.push(patch.rating);
|
|
@@ -84,6 +111,30 @@ export class GlobalRepository {
|
|
|
84
111
|
updates.push("cost_per_million = ?");
|
|
85
112
|
params.push(patch.costPerMillion);
|
|
86
113
|
}
|
|
114
|
+
if (patch.maxComplexity !== undefined) {
|
|
115
|
+
updates.push("max_complexity = ?");
|
|
116
|
+
params.push(patch.maxComplexity);
|
|
117
|
+
}
|
|
118
|
+
if (patch.ratingSamples !== undefined) {
|
|
119
|
+
updates.push("rating_samples = ?");
|
|
120
|
+
params.push(patch.ratingSamples);
|
|
121
|
+
}
|
|
122
|
+
if (patch.ratingLastScore !== undefined) {
|
|
123
|
+
updates.push("rating_last_score = ?");
|
|
124
|
+
params.push(patch.ratingLastScore);
|
|
125
|
+
}
|
|
126
|
+
if (patch.ratingUpdatedAt !== undefined) {
|
|
127
|
+
updates.push("rating_updated_at = ?");
|
|
128
|
+
params.push(patch.ratingUpdatedAt);
|
|
129
|
+
}
|
|
130
|
+
if (patch.complexitySamples !== undefined) {
|
|
131
|
+
updates.push("complexity_samples = ?");
|
|
132
|
+
params.push(patch.complexitySamples);
|
|
133
|
+
}
|
|
134
|
+
if (patch.complexityUpdatedAt !== undefined) {
|
|
135
|
+
updates.push("complexity_updated_at = ?");
|
|
136
|
+
params.push(patch.complexityUpdatedAt);
|
|
137
|
+
}
|
|
87
138
|
if (patch.config !== undefined) {
|
|
88
139
|
updates.push("config_json = ?");
|
|
89
140
|
params.push(patch.config ? JSON.stringify(patch.config) : null);
|
|
@@ -274,8 +325,80 @@ export class GlobalRepository {
|
|
|
274
325
|
async recordTokenUsage(entry) {
|
|
275
326
|
const id = randomUUID();
|
|
276
327
|
await this.db.run(`INSERT INTO token_usage (
|
|
277
|
-
id,
|
|
278
|
-
|
|
279
|
-
|
|
328
|
+
id,
|
|
329
|
+
agent_id,
|
|
330
|
+
command_run_id,
|
|
331
|
+
model_name,
|
|
332
|
+
command_name,
|
|
333
|
+
action,
|
|
334
|
+
invocation_kind,
|
|
335
|
+
provider,
|
|
336
|
+
currency,
|
|
337
|
+
tokens_prompt,
|
|
338
|
+
tokens_completion,
|
|
339
|
+
tokens_total,
|
|
340
|
+
tokens_cached,
|
|
341
|
+
tokens_cache_read,
|
|
342
|
+
tokens_cache_write,
|
|
343
|
+
cost_estimate,
|
|
344
|
+
duration_seconds,
|
|
345
|
+
duration_ms,
|
|
346
|
+
started_at,
|
|
347
|
+
finished_at,
|
|
348
|
+
timestamp,
|
|
349
|
+
metadata_json
|
|
350
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, entry.agentId ?? null, entry.commandRunId ?? null, entry.modelName ?? null, entry.commandName ?? null, entry.action ?? null, entry.invocationKind ?? null, entry.provider ?? null, entry.currency ?? null, entry.tokensPrompt ?? null, entry.tokensCompletion ?? null, entry.tokensTotal ?? null, entry.tokensCached ?? null, entry.tokensCacheRead ?? null, entry.tokensCacheWrite ?? null, entry.costEstimate ?? null, entry.durationSeconds ?? null, entry.durationMs ?? null, entry.startedAt ?? null, entry.finishedAt ?? null, entry.timestamp, entry.metadata ? JSON.stringify(entry.metadata) : null);
|
|
351
|
+
}
|
|
352
|
+
async insertAgentRunRating(entry) {
|
|
353
|
+
const id = randomUUID();
|
|
354
|
+
await this.db.run(`INSERT INTO agent_run_ratings (
|
|
355
|
+
id,
|
|
356
|
+
agent_id,
|
|
357
|
+
job_id,
|
|
358
|
+
command_run_id,
|
|
359
|
+
task_id,
|
|
360
|
+
task_key,
|
|
361
|
+
command_name,
|
|
362
|
+
discipline,
|
|
363
|
+
complexity,
|
|
364
|
+
quality_score,
|
|
365
|
+
tokens_total,
|
|
366
|
+
duration_seconds,
|
|
367
|
+
iterations,
|
|
368
|
+
total_cost,
|
|
369
|
+
run_score,
|
|
370
|
+
rating_version,
|
|
371
|
+
raw_review_json,
|
|
372
|
+
created_at
|
|
373
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, entry.agentId, entry.jobId ?? null, entry.commandRunId ?? null, entry.taskId ?? null, entry.taskKey ?? null, entry.commandName ?? null, entry.discipline ?? null, entry.complexity ?? null, entry.qualityScore ?? null, entry.tokensTotal ?? null, entry.durationSeconds ?? null, entry.iterations ?? null, entry.totalCost ?? null, entry.runScore ?? null, entry.ratingVersion ?? null, entry.rawReview ? JSON.stringify(entry.rawReview) : null, entry.createdAt);
|
|
374
|
+
return { ...entry, id };
|
|
375
|
+
}
|
|
376
|
+
async listAgentRunRatings(agentId, limit = 50) {
|
|
377
|
+
const rows = await this.db.all(`SELECT id, agent_id, job_id, command_run_id, task_id, task_key, command_name, discipline, complexity, quality_score,
|
|
378
|
+
tokens_total, duration_seconds, iterations, total_cost, run_score, rating_version, raw_review_json, created_at
|
|
379
|
+
FROM agent_run_ratings
|
|
380
|
+
WHERE agent_id = ?
|
|
381
|
+
ORDER BY datetime(created_at) DESC
|
|
382
|
+
LIMIT ?`, agentId, limit);
|
|
383
|
+
return rows.map((row) => ({
|
|
384
|
+
id: row.id,
|
|
385
|
+
agentId: row.agent_id,
|
|
386
|
+
jobId: row.job_id ?? null,
|
|
387
|
+
commandRunId: row.command_run_id ?? null,
|
|
388
|
+
taskId: row.task_id ?? null,
|
|
389
|
+
taskKey: row.task_key ?? null,
|
|
390
|
+
commandName: row.command_name ?? null,
|
|
391
|
+
discipline: row.discipline ?? null,
|
|
392
|
+
complexity: row.complexity ?? null,
|
|
393
|
+
qualityScore: row.quality_score ?? null,
|
|
394
|
+
tokensTotal: row.tokens_total ?? null,
|
|
395
|
+
durationSeconds: row.duration_seconds ?? null,
|
|
396
|
+
iterations: row.iterations ?? null,
|
|
397
|
+
totalCost: row.total_cost ?? null,
|
|
398
|
+
runScore: row.run_score ?? null,
|
|
399
|
+
ratingVersion: row.rating_version ?? null,
|
|
400
|
+
rawReview: row.raw_review_json ? JSON.parse(row.raw_review_json) : null,
|
|
401
|
+
createdAt: row.created_at,
|
|
402
|
+
}));
|
|
280
403
|
}
|
|
281
404
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Database } from "sqlite";
|
|
2
2
|
import { Connection } from "../../sqlite/connection.js";
|
|
3
3
|
export type JobStatus = "queued" | "running" | "paused" | "completed" | "failed" | "cancelled" | "partial";
|
|
4
|
-
export type CommandStatus = "running" | "succeeded" | "failed";
|
|
4
|
+
export type CommandStatus = "running" | "succeeded" | "failed" | "cancelled";
|
|
5
5
|
export type TaskRunStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
6
6
|
export interface ProjectRow {
|
|
7
7
|
id: string;
|
|
@@ -85,6 +85,8 @@ export interface JobInsert {
|
|
|
85
85
|
totalItems?: number | null;
|
|
86
86
|
processedItems?: number | null;
|
|
87
87
|
lastCheckpoint?: string | null;
|
|
88
|
+
agentId?: string | null;
|
|
89
|
+
agentIds?: string[] | null;
|
|
88
90
|
}
|
|
89
91
|
export interface JobRow extends JobInsert {
|
|
90
92
|
id: string;
|
|
@@ -97,6 +99,7 @@ export interface CommandRunInsert {
|
|
|
97
99
|
workspaceId: string;
|
|
98
100
|
commandName: string;
|
|
99
101
|
jobId?: string | null;
|
|
102
|
+
agentId?: string | null;
|
|
100
103
|
taskIds?: string[];
|
|
101
104
|
gitBranch?: string | null;
|
|
102
105
|
gitBaseBranch?: string | null;
|
|
@@ -129,6 +132,17 @@ export interface TaskRunInsert {
|
|
|
129
132
|
export interface TaskRunRow extends TaskRunInsert {
|
|
130
133
|
id: string;
|
|
131
134
|
}
|
|
135
|
+
export interface TaskStatusEventInsert {
|
|
136
|
+
taskId: string;
|
|
137
|
+
fromStatus?: string | null;
|
|
138
|
+
toStatus: string;
|
|
139
|
+
timestamp: string;
|
|
140
|
+
commandName?: string | null;
|
|
141
|
+
jobId?: string | null;
|
|
142
|
+
taskRunId?: string | null;
|
|
143
|
+
agentId?: string | null;
|
|
144
|
+
metadata?: Record<string, unknown> | null;
|
|
145
|
+
}
|
|
132
146
|
export interface TaskLockRow {
|
|
133
147
|
taskId: string;
|
|
134
148
|
taskRunId: string;
|
|
@@ -171,11 +185,22 @@ export interface TokenUsageInsert {
|
|
|
171
185
|
projectId?: string | null;
|
|
172
186
|
epicId?: string | null;
|
|
173
187
|
userStoryId?: string | null;
|
|
188
|
+
commandName?: string | null;
|
|
189
|
+
action?: string | null;
|
|
190
|
+
invocationKind?: string | null;
|
|
191
|
+
provider?: string | null;
|
|
192
|
+
currency?: string | null;
|
|
174
193
|
tokensPrompt?: number | null;
|
|
175
194
|
tokensCompletion?: number | null;
|
|
176
195
|
tokensTotal?: number | null;
|
|
196
|
+
tokensCached?: number | null;
|
|
197
|
+
tokensCacheRead?: number | null;
|
|
198
|
+
tokensCacheWrite?: number | null;
|
|
177
199
|
costEstimate?: number | null;
|
|
178
200
|
durationSeconds?: number | null;
|
|
201
|
+
durationMs?: number | null;
|
|
202
|
+
startedAt?: string | null;
|
|
203
|
+
finishedAt?: string | null;
|
|
179
204
|
timestamp: string;
|
|
180
205
|
metadata?: Record<string, unknown>;
|
|
181
206
|
}
|
|
@@ -195,6 +220,8 @@ export interface TaskCommentInsert {
|
|
|
195
220
|
authorType: "agent" | "human";
|
|
196
221
|
authorAgentId?: string | null;
|
|
197
222
|
category?: string | null;
|
|
223
|
+
slug?: string | null;
|
|
224
|
+
status?: string | null;
|
|
198
225
|
file?: string | null;
|
|
199
226
|
line?: number | null;
|
|
200
227
|
pathHint?: string | null;
|
|
@@ -235,6 +262,7 @@ export declare class WorkspaceRepository {
|
|
|
235
262
|
private serialize;
|
|
236
263
|
withTransaction<T>(fn: () => Promise<T>): Promise<T>;
|
|
237
264
|
getProjectByKey(key: string): Promise<ProjectRow | undefined>;
|
|
265
|
+
getProjectById(id: string): Promise<ProjectRow | undefined>;
|
|
238
266
|
createProjectIfMissing(input: {
|
|
239
267
|
key: string;
|
|
240
268
|
name?: string;
|
|
@@ -262,8 +290,10 @@ export declare class WorkspaceRepository {
|
|
|
262
290
|
vcsBaseBranch?: string | null;
|
|
263
291
|
vcsLastCommitSha?: string | null;
|
|
264
292
|
}): Promise<void>;
|
|
293
|
+
recordTaskStatusEvent(entry: TaskStatusEventInsert): Promise<void>;
|
|
265
294
|
getTaskById(taskId: string): Promise<TaskRow | undefined>;
|
|
266
295
|
getTaskByKey(taskKey: string): Promise<TaskRow | undefined>;
|
|
296
|
+
listTasksByMetadataValue(projectId: string, metadataKey: string, metadataValue: string): Promise<TaskRow[]>;
|
|
267
297
|
getTasksByIds(taskIds: string[]): Promise<TaskRow[]>;
|
|
268
298
|
listEpicKeys(projectId: string): Promise<string[]>;
|
|
269
299
|
listStoryKeys(epicId: string): Promise<string[]>;
|
|
@@ -278,6 +308,8 @@ export declare class WorkspaceRepository {
|
|
|
278
308
|
}): Promise<void>;
|
|
279
309
|
createCommandRun(record: CommandRunInsert): Promise<CommandRunRow>;
|
|
280
310
|
setCommandRunJobId(id: string, jobId: string): Promise<void>;
|
|
311
|
+
setCommandRunAgentId(id: string, agentId: string): Promise<void>;
|
|
312
|
+
setJobAgentIds(id: string, agentId: string): Promise<void>;
|
|
281
313
|
completeCommandRun(id: string, update: {
|
|
282
314
|
status: CommandStatus;
|
|
283
315
|
completedAt: string;
|
|
@@ -296,6 +328,8 @@ export declare class WorkspaceRepository {
|
|
|
296
328
|
}>>;
|
|
297
329
|
createTaskRun(record: TaskRunInsert): Promise<TaskRunRow>;
|
|
298
330
|
getTaskLock(taskId: string): Promise<TaskLockRow | undefined>;
|
|
331
|
+
cleanupExpiredTaskLocks(nowIso?: string): Promise<string[]>;
|
|
332
|
+
releaseTaskLocksByJob(jobId: string): Promise<string[]>;
|
|
299
333
|
tryAcquireTaskLock(taskId: string, taskRunId: string, jobId?: string | null, ttlSeconds?: number): Promise<{
|
|
300
334
|
acquired: boolean;
|
|
301
335
|
lock?: TaskLockRow;
|
|
@@ -329,7 +363,19 @@ export declare class WorkspaceRepository {
|
|
|
329
363
|
listTaskComments(taskId: string, options?: {
|
|
330
364
|
sourceCommands?: string[];
|
|
331
365
|
limit?: number;
|
|
366
|
+
slug?: string | string[];
|
|
367
|
+
resolved?: boolean;
|
|
332
368
|
}): Promise<TaskCommentRow[]>;
|
|
369
|
+
resolveTaskComment(params: {
|
|
370
|
+
taskId: string;
|
|
371
|
+
slug: string;
|
|
372
|
+
resolvedAt: string;
|
|
373
|
+
resolvedBy?: string | null;
|
|
374
|
+
}): Promise<void>;
|
|
375
|
+
reopenTaskComment(params: {
|
|
376
|
+
taskId: string;
|
|
377
|
+
slug: string;
|
|
378
|
+
}): Promise<void>;
|
|
333
379
|
createTaskReview(record: TaskReviewInsert): Promise<TaskReviewRow>;
|
|
334
380
|
getLatestTaskReview(taskId: string): Promise<TaskReviewRow | undefined>;
|
|
335
381
|
recordTokenUsage(entry: TokenUsageInsert): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/workspace/WorkspaceRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAC3G,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAExF,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAA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QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAO,GACxG,OAAO,CAAC,cAAc,EAAE,CAAC;IAmDtB,kBAAkB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAa3H,iBAAiB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1E,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAqBlE,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IA0BvE,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkExD,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAe7D,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAqB1E,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAuBzE,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;CAuB7F"}
|
|
@@ -2,6 +2,67 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { setTimeout as delay } from "node:timers/promises";
|
|
3
3
|
import { Connection } from "../../sqlite/connection.js";
|
|
4
4
|
import { WorkspaceMigrations } from "../../migrations/workspace/WorkspaceMigrations.js";
|
|
5
|
+
const DOD_HEADER = /(definition of done|dod)\b/i;
|
|
6
|
+
const SECTION_HEADER = /^(?:\*+\s*)?(?:\*\*)?\s*(objective|context|inputs|implementation plan|testing|dependencies|risks|references|related documentation|acceptance criteria)\b/i;
|
|
7
|
+
const extractTaskDodCriteria = (description) => {
|
|
8
|
+
if (!description)
|
|
9
|
+
return [];
|
|
10
|
+
const lines = description.split(/\r?\n/);
|
|
11
|
+
let startIndex = -1;
|
|
12
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
13
|
+
const line = lines[i].trim();
|
|
14
|
+
if (!line)
|
|
15
|
+
continue;
|
|
16
|
+
if (DOD_HEADER.test(line)) {
|
|
17
|
+
startIndex = i;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (startIndex === -1)
|
|
22
|
+
return [];
|
|
23
|
+
const results = [];
|
|
24
|
+
const addInline = (line) => {
|
|
25
|
+
const parts = line.split(":");
|
|
26
|
+
if (parts.length < 2)
|
|
27
|
+
return;
|
|
28
|
+
const tail = parts.slice(1).join(":").trim();
|
|
29
|
+
if (!tail)
|
|
30
|
+
return;
|
|
31
|
+
tail
|
|
32
|
+
.split(/\s*;\s*/)
|
|
33
|
+
.map((item) => item.trim())
|
|
34
|
+
.filter(Boolean)
|
|
35
|
+
.forEach((item) => results.push(item));
|
|
36
|
+
};
|
|
37
|
+
const isBullet = (line) => /^[-*]\s+/.test(line);
|
|
38
|
+
const isHeading = (line) => SECTION_HEADER.test(line) ||
|
|
39
|
+
(/^\*+\s*\*\*.+\*\*\s*:?\s*$/.test(line) && !DOD_HEADER.test(line)) ||
|
|
40
|
+
(/^[A-Z][A-Za-z0-9 &/]{2,}:\s*$/.test(line) && !DOD_HEADER.test(line));
|
|
41
|
+
const headerLine = lines[startIndex].trim();
|
|
42
|
+
addInline(headerLine);
|
|
43
|
+
for (let i = startIndex + 1; i < lines.length; i += 1) {
|
|
44
|
+
const rawLine = lines[i];
|
|
45
|
+
const line = rawLine.trim();
|
|
46
|
+
if (!line) {
|
|
47
|
+
if (results.length)
|
|
48
|
+
break;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (!isBullet(line) && isHeading(line))
|
|
52
|
+
break;
|
|
53
|
+
if (isBullet(line)) {
|
|
54
|
+
results.push(line.replace(/^[-*]\s+/, "").trim());
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (results.length) {
|
|
58
|
+
results[results.length - 1] = `${results[results.length - 1]} ${line}`.trim();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
results.push(line);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return Array.from(new Set(results.filter(Boolean)));
|
|
65
|
+
};
|
|
5
66
|
export class WorkspaceRepository {
|
|
6
67
|
constructor(db, connection) {
|
|
7
68
|
this.db = db;
|
|
@@ -91,6 +152,20 @@ export class WorkspaceRepository {
|
|
|
91
152
|
updatedAt: row.updated_at,
|
|
92
153
|
};
|
|
93
154
|
}
|
|
155
|
+
async getProjectById(id) {
|
|
156
|
+
const row = await this.db.get(`SELECT id, key, name, description, metadata_json, created_at, updated_at FROM projects WHERE id = ?`, id);
|
|
157
|
+
if (!row)
|
|
158
|
+
return undefined;
|
|
159
|
+
return {
|
|
160
|
+
id: row.id,
|
|
161
|
+
key: row.key,
|
|
162
|
+
name: row.name ?? undefined,
|
|
163
|
+
description: row.description ?? undefined,
|
|
164
|
+
metadata: row.metadata_json ? JSON.parse(row.metadata_json) : undefined,
|
|
165
|
+
createdAt: row.created_at,
|
|
166
|
+
updatedAt: row.updated_at,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
94
169
|
async createProjectIfMissing(input) {
|
|
95
170
|
const existing = await this.getProjectByKey(input.key);
|
|
96
171
|
if (existing)
|
|
@@ -272,6 +347,11 @@ export class WorkspaceRepository {
|
|
|
272
347
|
params.push(taskId);
|
|
273
348
|
await this.db.run(`UPDATE tasks SET ${fields.join(", ")} WHERE id = ?`, ...params);
|
|
274
349
|
}
|
|
350
|
+
async recordTaskStatusEvent(entry) {
|
|
351
|
+
const id = randomUUID();
|
|
352
|
+
await this.db.run(`INSERT INTO task_status_events (id, task_id, from_status, to_status, timestamp, command_name, job_id, task_run_id, agent_id, metadata_json)
|
|
353
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, entry.taskId, entry.fromStatus ?? null, entry.toStatus, entry.timestamp, entry.commandName ?? null, entry.jobId ?? null, entry.taskRunId ?? null, entry.agentId ?? null, entry.metadata ? JSON.stringify(entry.metadata) : null);
|
|
354
|
+
}
|
|
275
355
|
async getTaskById(taskId) {
|
|
276
356
|
const row = await this.db.get(`SELECT id, project_id, epic_id, user_story_id, key, title, description, type, status, story_points, priority, assigned_agent_id, assignee_human, vcs_branch, vcs_base_branch, vcs_last_commit_sha, metadata_json, openapi_version_at_creation, created_at, updated_at
|
|
277
357
|
FROM tasks WHERE id = ?`, taskId);
|
|
@@ -328,6 +408,34 @@ export class WorkspaceRepository {
|
|
|
328
408
|
updatedAt: row.updated_at,
|
|
329
409
|
};
|
|
330
410
|
}
|
|
411
|
+
async listTasksByMetadataValue(projectId, metadataKey, metadataValue) {
|
|
412
|
+
const rows = await this.db.all(`SELECT id, project_id, epic_id, user_story_id, key, title, description, type, status, story_points, priority, assigned_agent_id, assignee_human, vcs_branch, vcs_base_branch, vcs_last_commit_sha, metadata_json, openapi_version_at_creation, created_at, updated_at
|
|
413
|
+
FROM tasks WHERE project_id = ?`, projectId);
|
|
414
|
+
return rows
|
|
415
|
+
.map((row) => ({
|
|
416
|
+
id: row.id,
|
|
417
|
+
projectId: row.project_id,
|
|
418
|
+
epicId: row.epic_id,
|
|
419
|
+
userStoryId: row.user_story_id,
|
|
420
|
+
key: row.key,
|
|
421
|
+
title: row.title,
|
|
422
|
+
description: row.description ?? undefined,
|
|
423
|
+
type: row.type ?? undefined,
|
|
424
|
+
status: row.status,
|
|
425
|
+
storyPoints: row.story_points ?? undefined,
|
|
426
|
+
priority: row.priority ?? undefined,
|
|
427
|
+
assignedAgentId: row.assigned_agent_id ?? undefined,
|
|
428
|
+
assigneeHuman: row.assignee_human ?? undefined,
|
|
429
|
+
vcsBranch: row.vcs_branch ?? undefined,
|
|
430
|
+
vcsBaseBranch: row.vcs_base_branch ?? undefined,
|
|
431
|
+
vcsLastCommitSha: row.vcs_last_commit_sha ?? undefined,
|
|
432
|
+
metadata: row.metadata_json ? JSON.parse(row.metadata_json) : undefined,
|
|
433
|
+
openapiVersionAtCreation: row.openapi_version_at_creation ?? undefined,
|
|
434
|
+
createdAt: row.created_at,
|
|
435
|
+
updatedAt: row.updated_at,
|
|
436
|
+
}))
|
|
437
|
+
.filter((task) => task.metadata?.[metadataKey] === metadataValue);
|
|
438
|
+
}
|
|
331
439
|
async getTasksByIds(taskIds) {
|
|
332
440
|
if (!taskIds.length)
|
|
333
441
|
return [];
|
|
@@ -372,8 +480,8 @@ export class WorkspaceRepository {
|
|
|
372
480
|
async createJob(record) {
|
|
373
481
|
const now = new Date().toISOString();
|
|
374
482
|
const id = randomUUID();
|
|
375
|
-
await this.db.run(`INSERT INTO jobs (id, workspace_id, type, state, command_name, payload_json, total_items, processed_items, last_checkpoint, created_at, updated_at)
|
|
376
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, record.workspaceId, record.type, record.state, record.commandName ?? null, record.payload ? JSON.stringify(record.payload) : null, record.totalItems ?? null, record.processedItems ?? null, record.lastCheckpoint ?? null, now, now);
|
|
483
|
+
await this.db.run(`INSERT INTO jobs (id, workspace_id, type, state, command_name, payload_json, total_items, processed_items, last_checkpoint, agent_id, agent_ids_json, created_at, updated_at)
|
|
484
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, record.workspaceId, record.type, record.state, record.commandName ?? null, record.payload ? JSON.stringify(record.payload) : null, record.totalItems ?? null, record.processedItems ?? null, record.lastCheckpoint ?? null, record.agentId ?? null, record.agentIds ? JSON.stringify(record.agentIds) : null, now, now);
|
|
377
485
|
return {
|
|
378
486
|
id,
|
|
379
487
|
...record,
|
|
@@ -384,7 +492,7 @@ export class WorkspaceRepository {
|
|
|
384
492
|
};
|
|
385
493
|
}
|
|
386
494
|
async listJobs() {
|
|
387
|
-
const rows = await this.db.all(`SELECT id, workspace_id, type, state, command_name, payload_json, total_items, processed_items, last_checkpoint, created_at, updated_at, completed_at, error_summary
|
|
495
|
+
const rows = await this.db.all(`SELECT id, workspace_id, type, state, command_name, payload_json, total_items, processed_items, last_checkpoint, agent_id, agent_ids_json, created_at, updated_at, completed_at, error_summary
|
|
388
496
|
FROM jobs ORDER BY updated_at DESC`);
|
|
389
497
|
return rows.map((row) => ({
|
|
390
498
|
id: row.id,
|
|
@@ -396,6 +504,8 @@ export class WorkspaceRepository {
|
|
|
396
504
|
totalItems: row.total_items ?? undefined,
|
|
397
505
|
processedItems: row.processed_items ?? undefined,
|
|
398
506
|
lastCheckpoint: row.last_checkpoint ?? undefined,
|
|
507
|
+
agentId: row.agent_id ?? undefined,
|
|
508
|
+
agentIds: row.agent_ids_json ? JSON.parse(row.agent_ids_json) : undefined,
|
|
399
509
|
createdAt: row.created_at,
|
|
400
510
|
updatedAt: row.updated_at,
|
|
401
511
|
completedAt: row.completed_at ?? undefined,
|
|
@@ -403,7 +513,7 @@ export class WorkspaceRepository {
|
|
|
403
513
|
}));
|
|
404
514
|
}
|
|
405
515
|
async getJob(id) {
|
|
406
|
-
const row = await this.db.get(`SELECT id, workspace_id, type, state, command_name, payload_json, total_items, processed_items, last_checkpoint, created_at, updated_at, completed_at, error_summary
|
|
516
|
+
const row = await this.db.get(`SELECT id, workspace_id, type, state, command_name, payload_json, total_items, processed_items, last_checkpoint, agent_id, agent_ids_json, created_at, updated_at, completed_at, error_summary
|
|
407
517
|
FROM jobs WHERE id = ?`, id);
|
|
408
518
|
if (!row)
|
|
409
519
|
return undefined;
|
|
@@ -417,6 +527,8 @@ export class WorkspaceRepository {
|
|
|
417
527
|
totalItems: row.total_items ?? undefined,
|
|
418
528
|
processedItems: row.processed_items ?? undefined,
|
|
419
529
|
lastCheckpoint: row.last_checkpoint ?? undefined,
|
|
530
|
+
agentId: row.agent_id ?? undefined,
|
|
531
|
+
agentIds: row.agent_ids_json ? JSON.parse(row.agent_ids_json) : undefined,
|
|
420
532
|
createdAt: row.created_at,
|
|
421
533
|
updatedAt: row.updated_at,
|
|
422
534
|
completedAt: row.completed_at ?? undefined,
|
|
@@ -449,6 +561,14 @@ export class WorkspaceRepository {
|
|
|
449
561
|
fields.push("last_checkpoint = ?");
|
|
450
562
|
params.push(update.lastCheckpoint ?? null);
|
|
451
563
|
}
|
|
564
|
+
if (update.agentId !== undefined) {
|
|
565
|
+
fields.push("agent_id = ?");
|
|
566
|
+
params.push(update.agentId ?? null);
|
|
567
|
+
}
|
|
568
|
+
if (update.agentIds !== undefined) {
|
|
569
|
+
fields.push("agent_ids_json = ?");
|
|
570
|
+
params.push(update.agentIds ? JSON.stringify(update.agentIds) : null);
|
|
571
|
+
}
|
|
452
572
|
if (update.errorSummary !== undefined) {
|
|
453
573
|
fields.push("error_summary = ?");
|
|
454
574
|
params.push(update.errorSummary ?? null);
|
|
@@ -468,13 +588,35 @@ export class WorkspaceRepository {
|
|
|
468
588
|
}
|
|
469
589
|
async createCommandRun(record) {
|
|
470
590
|
const id = randomUUID();
|
|
471
|
-
await this.db.run(`INSERT INTO command_runs (id, workspace_id, command_name, job_id, task_ids_json, git_branch, git_base_branch, started_at, status, sp_processed)
|
|
472
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, record.workspaceId, record.commandName, record.jobId ?? null, record.taskIds ? JSON.stringify(record.taskIds) : null, record.gitBranch ?? null, record.gitBaseBranch ?? null, record.startedAt, record.status, record.spProcessed ?? null);
|
|
591
|
+
await this.db.run(`INSERT INTO command_runs (id, workspace_id, command_name, job_id, agent_id, task_ids_json, git_branch, git_base_branch, started_at, status, sp_processed)
|
|
592
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, record.workspaceId, record.commandName, record.jobId ?? null, record.agentId ?? null, record.taskIds ? JSON.stringify(record.taskIds) : null, record.gitBranch ?? null, record.gitBaseBranch ?? null, record.startedAt, record.status, record.spProcessed ?? null);
|
|
473
593
|
return { id, ...record, completedAt: null, errorSummary: null, durationSeconds: null };
|
|
474
594
|
}
|
|
475
595
|
async setCommandRunJobId(id, jobId) {
|
|
476
596
|
await this.db.run(`UPDATE command_runs SET job_id = ? WHERE id = ?`, jobId, id);
|
|
477
597
|
}
|
|
598
|
+
async setCommandRunAgentId(id, agentId) {
|
|
599
|
+
await this.db.run(`UPDATE command_runs SET agent_id = COALESCE(agent_id, ?) WHERE id = ?`, agentId, id);
|
|
600
|
+
}
|
|
601
|
+
async setJobAgentIds(id, agentId) {
|
|
602
|
+
const row = await this.db.get(`SELECT agent_id, agent_ids_json FROM jobs WHERE id = ?`, id);
|
|
603
|
+
if (!row)
|
|
604
|
+
return;
|
|
605
|
+
let existing = [];
|
|
606
|
+
if (row.agent_ids_json) {
|
|
607
|
+
try {
|
|
608
|
+
const parsed = JSON.parse(row.agent_ids_json);
|
|
609
|
+
if (Array.isArray(parsed))
|
|
610
|
+
existing = parsed;
|
|
611
|
+
}
|
|
612
|
+
catch {
|
|
613
|
+
existing = [];
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
const merged = Array.from(new Set([...existing, agentId]));
|
|
617
|
+
const primary = row.agent_id ?? merged[0] ?? agentId;
|
|
618
|
+
await this.db.run(`UPDATE jobs SET agent_id = ?, agent_ids_json = ? WHERE id = ?`, primary, JSON.stringify(merged), id);
|
|
619
|
+
}
|
|
478
620
|
async completeCommandRun(id, update) {
|
|
479
621
|
await this.db.run(`UPDATE command_runs
|
|
480
622
|
SET status = ?, completed_at = ?, error_summary = ?, duration_seconds = ?, sp_processed = ?
|
|
@@ -517,40 +659,44 @@ export class WorkspaceRepository {
|
|
|
517
659
|
JOIN user_stories us ON us.id = t.user_story_id
|
|
518
660
|
WHERE t.id IN (${placeholders})
|
|
519
661
|
`, ...taskIds);
|
|
520
|
-
return rows.map((row) =>
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
epicId: row.epic_id,
|
|
524
|
-
userStoryId: row.story_id,
|
|
525
|
-
key: row.task_key,
|
|
526
|
-
title: row.task_title,
|
|
527
|
-
description: row.task_description ?? "",
|
|
528
|
-
type: row.task_type ?? undefined,
|
|
529
|
-
status: row.task_status,
|
|
530
|
-
storyPoints: row.task_story_points ?? undefined,
|
|
531
|
-
priority: row.task_priority ?? undefined,
|
|
532
|
-
assignedAgentId: row.task_assigned_agent_id ?? undefined,
|
|
533
|
-
assigneeHuman: row.task_assignee_human ?? undefined,
|
|
534
|
-
vcsBranch: row.task_vcs_branch ?? undefined,
|
|
535
|
-
vcsBaseBranch: row.task_vcs_base_branch ?? undefined,
|
|
536
|
-
vcsLastCommitSha: row.task_vcs_last_commit_sha ?? undefined,
|
|
537
|
-
metadata: row.task_metadata ? JSON.parse(row.task_metadata) : undefined,
|
|
538
|
-
openapiVersionAtCreation: undefined,
|
|
539
|
-
createdAt: row.task_created_at,
|
|
540
|
-
updatedAt: row.task_updated_at,
|
|
541
|
-
epicKey: row.epic_key,
|
|
542
|
-
storyKey: row.story_key,
|
|
543
|
-
epicTitle: row.epic_title ?? undefined,
|
|
544
|
-
epicDescription: row.epic_description ?? undefined,
|
|
545
|
-
storyTitle: row.story_title ?? undefined,
|
|
546
|
-
storyDescription: row.story_description ?? undefined,
|
|
547
|
-
acceptanceCriteria: row.story_acceptance
|
|
662
|
+
return rows.map((row) => {
|
|
663
|
+
const taskDod = extractTaskDodCriteria(row.task_description ?? "");
|
|
664
|
+
const storyAcceptance = row.story_acceptance
|
|
548
665
|
? row.story_acceptance
|
|
549
666
|
.split(/\r?\n/)
|
|
550
667
|
.map((s) => s.trim())
|
|
551
668
|
.filter(Boolean)
|
|
552
|
-
: undefined
|
|
553
|
-
|
|
669
|
+
: undefined;
|
|
670
|
+
return {
|
|
671
|
+
id: row.task_id,
|
|
672
|
+
projectId: row.project_id,
|
|
673
|
+
epicId: row.epic_id,
|
|
674
|
+
userStoryId: row.story_id,
|
|
675
|
+
key: row.task_key,
|
|
676
|
+
title: row.task_title,
|
|
677
|
+
description: row.task_description ?? "",
|
|
678
|
+
type: row.task_type ?? undefined,
|
|
679
|
+
status: row.task_status,
|
|
680
|
+
storyPoints: row.task_story_points ?? undefined,
|
|
681
|
+
priority: row.task_priority ?? undefined,
|
|
682
|
+
assignedAgentId: row.task_assigned_agent_id ?? undefined,
|
|
683
|
+
assigneeHuman: row.task_assignee_human ?? undefined,
|
|
684
|
+
vcsBranch: row.task_vcs_branch ?? undefined,
|
|
685
|
+
vcsBaseBranch: row.task_vcs_base_branch ?? undefined,
|
|
686
|
+
vcsLastCommitSha: row.task_vcs_last_commit_sha ?? undefined,
|
|
687
|
+
metadata: row.task_metadata ? JSON.parse(row.task_metadata) : undefined,
|
|
688
|
+
openapiVersionAtCreation: undefined,
|
|
689
|
+
createdAt: row.task_created_at,
|
|
690
|
+
updatedAt: row.task_updated_at,
|
|
691
|
+
epicKey: row.epic_key,
|
|
692
|
+
storyKey: row.story_key,
|
|
693
|
+
epicTitle: row.epic_title ?? undefined,
|
|
694
|
+
epicDescription: row.epic_description ?? undefined,
|
|
695
|
+
storyTitle: row.story_title ?? undefined,
|
|
696
|
+
storyDescription: row.story_description ?? undefined,
|
|
697
|
+
acceptanceCriteria: taskDod.length ? taskDod : storyAcceptance,
|
|
698
|
+
};
|
|
699
|
+
});
|
|
554
700
|
}
|
|
555
701
|
async createTaskRun(record) {
|
|
556
702
|
const id = randomUUID();
|
|
@@ -570,6 +716,30 @@ export class WorkspaceRepository {
|
|
|
570
716
|
expiresAt: row.expires_at,
|
|
571
717
|
};
|
|
572
718
|
}
|
|
719
|
+
async cleanupExpiredTaskLocks(nowIso = new Date().toISOString()) {
|
|
720
|
+
return this.withTransaction(async () => {
|
|
721
|
+
const rows = await this.db.all(`SELECT t.key as task_key, l.task_id as task_id
|
|
722
|
+
FROM task_locks l
|
|
723
|
+
LEFT JOIN tasks t ON t.id = l.task_id
|
|
724
|
+
WHERE l.expires_at < ?`, nowIso);
|
|
725
|
+
if (!rows.length)
|
|
726
|
+
return [];
|
|
727
|
+
await this.db.run(`DELETE FROM task_locks WHERE expires_at < ?`, nowIso);
|
|
728
|
+
return rows.map((row) => row.task_key ?? row.task_id);
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
async releaseTaskLocksByJob(jobId) {
|
|
732
|
+
return this.withTransaction(async () => {
|
|
733
|
+
const rows = await this.db.all(`SELECT t.key as task_key, l.task_id as task_id
|
|
734
|
+
FROM task_locks l
|
|
735
|
+
LEFT JOIN tasks t ON t.id = l.task_id
|
|
736
|
+
WHERE l.job_id = ?`, jobId);
|
|
737
|
+
if (!rows.length)
|
|
738
|
+
return [];
|
|
739
|
+
await this.db.run(`DELETE FROM task_locks WHERE job_id = ?`, jobId);
|
|
740
|
+
return rows.map((row) => row.task_key ?? row.task_id);
|
|
741
|
+
});
|
|
742
|
+
}
|
|
573
743
|
async tryAcquireTaskLock(taskId, taskRunId, jobId, ttlSeconds = 3600) {
|
|
574
744
|
const nowIso = new Date().toISOString();
|
|
575
745
|
const expiresAt = new Date(Date.now() + ttlSeconds * 1000).toISOString();
|
|
@@ -581,7 +751,13 @@ export class WorkspaceRepository {
|
|
|
581
751
|
job_id = excluded.job_id,
|
|
582
752
|
acquired_at = excluded.acquired_at,
|
|
583
753
|
expires_at = excluded.expires_at
|
|
584
|
-
WHERE task_locks.expires_at <
|
|
754
|
+
WHERE task_locks.expires_at < ?
|
|
755
|
+
OR NOT EXISTS (
|
|
756
|
+
SELECT 1
|
|
757
|
+
FROM task_runs
|
|
758
|
+
WHERE task_runs.id = task_locks.task_run_id
|
|
759
|
+
AND task_runs.status = 'running'
|
|
760
|
+
)`, taskId, taskRunId, jobId ?? null, nowIso, expiresAt, nowIso);
|
|
585
761
|
if (result?.changes && result.changes > 0) {
|
|
586
762
|
return {
|
|
587
763
|
acquired: true,
|
|
@@ -736,9 +912,9 @@ export class WorkspaceRepository {
|
|
|
736
912
|
}
|
|
737
913
|
async createTaskComment(record) {
|
|
738
914
|
const id = randomUUID();
|
|
739
|
-
await this.db.run(`INSERT INTO task_comments (id, task_id, task_run_id, job_id, source_command, author_type, author_agent_id, category, file, line, path_hint, body, metadata_json, created_at, resolved_at, resolved_by)
|
|
740
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, record.taskId, record.taskRunId ?? null, record.jobId ?? null, record.sourceCommand, record.authorType, record.authorAgentId ?? null, record.category ?? null, record.file ?? null, record.line ?? null, record.pathHint ?? null, record.body, record.metadata ? JSON.stringify(record.metadata) : null, record.createdAt, record.resolvedAt ?? null, record.resolvedBy ?? null);
|
|
741
|
-
return { ...record, id };
|
|
915
|
+
await this.db.run(`INSERT INTO task_comments (id, task_id, task_run_id, job_id, source_command, author_type, author_agent_id, category, slug, status, file, line, path_hint, body, metadata_json, created_at, resolved_at, resolved_by)
|
|
916
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, record.taskId, record.taskRunId ?? null, record.jobId ?? null, record.sourceCommand, record.authorType, record.authorAgentId ?? null, record.category ?? null, record.slug ?? null, record.status ?? "open", record.file ?? null, record.line ?? null, record.pathHint ?? null, record.body, record.metadata ? JSON.stringify(record.metadata) : null, record.createdAt, record.resolvedAt ?? null, record.resolvedBy ?? null);
|
|
917
|
+
return { ...record, id, status: record.status ?? "open" };
|
|
742
918
|
}
|
|
743
919
|
async listTaskComments(taskId, options = {}) {
|
|
744
920
|
const clauses = ["task_id = ?"];
|
|
@@ -747,9 +923,22 @@ export class WorkspaceRepository {
|
|
|
747
923
|
clauses.push(`source_command IN (${options.sourceCommands.map(() => "?").join(", ")})`);
|
|
748
924
|
params.push(...options.sourceCommands);
|
|
749
925
|
}
|
|
926
|
+
if (options.slug) {
|
|
927
|
+
const slugs = Array.isArray(options.slug) ? options.slug : [options.slug];
|
|
928
|
+
if (slugs.length) {
|
|
929
|
+
clauses.push(`slug IN (${slugs.map(() => "?").join(", ")})`);
|
|
930
|
+
params.push(...slugs);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
if (options.resolved === true) {
|
|
934
|
+
clauses.push("resolved_at IS NOT NULL");
|
|
935
|
+
}
|
|
936
|
+
else if (options.resolved === false) {
|
|
937
|
+
clauses.push("resolved_at IS NULL");
|
|
938
|
+
}
|
|
750
939
|
const where = clauses.length ? `WHERE ${clauses.join(" AND ")}` : "";
|
|
751
940
|
const limitClause = options.limit ? `LIMIT ${options.limit}` : "";
|
|
752
|
-
const rows = await this.db.all(`SELECT id, task_id, task_run_id, job_id, source_command, author_type, author_agent_id, category, file, line, path_hint, body, metadata_json, created_at, resolved_at, resolved_by
|
|
941
|
+
const rows = await this.db.all(`SELECT id, task_id, task_run_id, job_id, source_command, author_type, author_agent_id, category, slug, status, file, line, path_hint, body, metadata_json, created_at, resolved_at, resolved_by
|
|
753
942
|
FROM task_comments
|
|
754
943
|
${where}
|
|
755
944
|
ORDER BY datetime(created_at) DESC
|
|
@@ -763,6 +952,8 @@ export class WorkspaceRepository {
|
|
|
763
952
|
authorType: row.author_type,
|
|
764
953
|
authorAgentId: row.author_agent_id ?? undefined,
|
|
765
954
|
category: row.category ?? undefined,
|
|
955
|
+
slug: row.slug ?? undefined,
|
|
956
|
+
status: row.status ?? undefined,
|
|
766
957
|
file: row.file ?? undefined,
|
|
767
958
|
line: row.line ?? undefined,
|
|
768
959
|
pathHint: row.path_hint ?? undefined,
|
|
@@ -773,6 +964,16 @@ export class WorkspaceRepository {
|
|
|
773
964
|
resolvedBy: row.resolved_by ?? undefined,
|
|
774
965
|
}));
|
|
775
966
|
}
|
|
967
|
+
async resolveTaskComment(params) {
|
|
968
|
+
await this.db.run(`UPDATE task_comments
|
|
969
|
+
SET resolved_at = ?, resolved_by = ?, status = ?
|
|
970
|
+
WHERE task_id = ? AND slug = ?`, params.resolvedAt, params.resolvedBy ?? null, "resolved", params.taskId, params.slug);
|
|
971
|
+
}
|
|
972
|
+
async reopenTaskComment(params) {
|
|
973
|
+
await this.db.run(`UPDATE task_comments
|
|
974
|
+
SET resolved_at = NULL, resolved_by = NULL, status = ?
|
|
975
|
+
WHERE task_id = ? AND slug = ?`, "open", params.taskId, params.slug);
|
|
976
|
+
}
|
|
776
977
|
async createTaskReview(record) {
|
|
777
978
|
const id = randomUUID();
|
|
778
979
|
await this.db.run(`INSERT INTO task_reviews (id, task_id, job_id, agent_id, model_name, decision, summary, findings_json, test_recommendations_json, metadata_json, created_at, created_by)
|
|
@@ -804,8 +1005,37 @@ export class WorkspaceRepository {
|
|
|
804
1005
|
}
|
|
805
1006
|
async recordTokenUsage(entry) {
|
|
806
1007
|
const id = randomUUID();
|
|
807
|
-
await this.db.run(`INSERT INTO token_usage (
|
|
808
|
-
|
|
1008
|
+
await this.db.run(`INSERT INTO token_usage (
|
|
1009
|
+
id,
|
|
1010
|
+
workspace_id,
|
|
1011
|
+
agent_id,
|
|
1012
|
+
model_name,
|
|
1013
|
+
job_id,
|
|
1014
|
+
command_run_id,
|
|
1015
|
+
task_run_id,
|
|
1016
|
+
task_id,
|
|
1017
|
+
project_id,
|
|
1018
|
+
epic_id,
|
|
1019
|
+
user_story_id,
|
|
1020
|
+
command_name,
|
|
1021
|
+
action,
|
|
1022
|
+
invocation_kind,
|
|
1023
|
+
provider,
|
|
1024
|
+
currency,
|
|
1025
|
+
tokens_prompt,
|
|
1026
|
+
tokens_completion,
|
|
1027
|
+
tokens_total,
|
|
1028
|
+
tokens_cached,
|
|
1029
|
+
tokens_cache_read,
|
|
1030
|
+
tokens_cache_write,
|
|
1031
|
+
cost_estimate,
|
|
1032
|
+
duration_seconds,
|
|
1033
|
+
duration_ms,
|
|
1034
|
+
started_at,
|
|
1035
|
+
finished_at,
|
|
1036
|
+
timestamp,
|
|
1037
|
+
metadata_json
|
|
1038
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, id, entry.workspaceId, entry.agentId ?? null, entry.modelName ?? null, entry.jobId ?? null, entry.commandRunId ?? null, entry.taskRunId ?? null, entry.taskId ?? null, entry.projectId ?? null, entry.epicId ?? null, entry.userStoryId ?? null, entry.commandName ?? null, entry.action ?? null, entry.invocationKind ?? null, entry.provider ?? null, entry.currency ?? null, entry.tokensPrompt ?? null, entry.tokensCompletion ?? null, entry.tokensTotal ?? null, entry.tokensCached ?? null, entry.tokensCacheRead ?? null, entry.tokensCacheWrite ?? null, entry.costEstimate ?? null, entry.durationSeconds ?? null, entry.durationMs ?? null, entry.startedAt ?? null, entry.finishedAt ?? null, entry.timestamp, entry.metadata ? JSON.stringify(entry.metadata) : null);
|
|
809
1039
|
}
|
|
810
1040
|
async insertTaskRevision(record) {
|
|
811
1041
|
const id = randomUUID();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcoda/db",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "SQLite-backed storage layer for mcoda.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"sqlite": "^5.1.1",
|
|
34
34
|
"sqlite3": "^5.1.7",
|
|
35
|
-
"@mcoda/shared": "0.1.
|
|
35
|
+
"@mcoda/shared": "0.1.10"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -p tsconfig.json",
|