@vornrun/mcp 0.2.0-beta.4 → 0.2.0-beta.6

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.
Files changed (2) hide show
  1. package/dist/index.js +63 -58
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1252,71 +1252,76 @@ function rowToWorkspace(r) {
1252
1252
  order: r.order
1253
1253
  };
1254
1254
  }
1255
+ function mapNodeRow(n) {
1256
+ return {
1257
+ nodeId: n.node_id,
1258
+ status: n.status,
1259
+ ...n.started_at != null && { startedAt: n.started_at },
1260
+ ...n.completed_at != null && { completedAt: n.completed_at },
1261
+ ...n.session_id != null && { sessionId: n.session_id },
1262
+ ...n.error != null && { error: n.error },
1263
+ ...n.logs != null && { logs: n.logs },
1264
+ ...n.task_id != null && { taskId: n.task_id },
1265
+ ...n.agent_session_id != null && { agentSessionId: n.agent_session_id },
1266
+ ...n.agent_type != null && { agentType: n.agent_type },
1267
+ ...n.project_name != null && { projectName: n.project_name },
1268
+ ...n.project_path != null && { projectPath: n.project_path },
1269
+ ...n.approved_at != null && { approvedAt: n.approved_at }
1270
+ };
1271
+ }
1272
+ function fetchNodesByRunIds(d, runIds) {
1273
+ if (runIds.length === 0) return /* @__PURE__ */ new Map();
1274
+ const placeholders = runIds.map(() => "?").join(",");
1275
+ const rows = d.prepare(`SELECT * FROM workflow_run_nodes WHERE run_id IN (${placeholders})`).all(...runIds);
1276
+ const out = /* @__PURE__ */ new Map();
1277
+ for (const r of rows) {
1278
+ const bucket = out.get(r.run_id);
1279
+ const node = mapNodeRow(r);
1280
+ if (bucket) bucket.push(node);
1281
+ else out.set(r.run_id, [node]);
1282
+ }
1283
+ return out;
1284
+ }
1255
1285
  function listWorkflowRuns(workflowId, limit = 20) {
1256
1286
  const d = getDb();
1257
1287
  const rows = d.prepare("SELECT * FROM workflow_runs WHERE workflow_id = ? ORDER BY started_at DESC LIMIT ?").all(workflowId, limit);
1258
- return rows.map((r) => {
1259
- const nodeRows = d.prepare("SELECT * FROM workflow_run_nodes WHERE run_id = ?").all(r.id);
1260
- return {
1261
- workflowId: r.workflow_id,
1262
- startedAt: r.started_at,
1263
- ...r.completed_at != null && { completedAt: r.completed_at },
1264
- status: r.status,
1265
- ...r.trigger_task_id != null && { triggerTaskId: r.trigger_task_id },
1266
- nodeStates: nodeRows.map((n) => ({
1267
- nodeId: n.node_id,
1268
- status: n.status,
1269
- ...n.started_at != null && { startedAt: n.started_at },
1270
- ...n.completed_at != null && { completedAt: n.completed_at },
1271
- ...n.session_id != null && { sessionId: n.session_id },
1272
- ...n.error != null && { error: n.error },
1273
- ...n.logs != null && { logs: n.logs },
1274
- ...n.task_id != null && { taskId: n.task_id },
1275
- ...n.agent_session_id != null && { agentSessionId: n.agent_session_id },
1276
- ...n.agent_type != null && { agentType: n.agent_type },
1277
- ...n.project_name != null && { projectName: n.project_name },
1278
- ...n.project_path != null && { projectPath: n.project_path },
1279
- ...n.approved_at != null && { approvedAt: n.approved_at }
1280
- }))
1281
- };
1282
- });
1288
+ const nodesByRun = fetchNodesByRunIds(
1289
+ d,
1290
+ rows.map((r) => r.id)
1291
+ );
1292
+ return rows.map((r) => ({
1293
+ workflowId: r.workflow_id,
1294
+ startedAt: r.started_at,
1295
+ ...r.completed_at != null && { completedAt: r.completed_at },
1296
+ status: r.status,
1297
+ ...r.trigger_task_id != null && { triggerTaskId: r.trigger_task_id },
1298
+ nodeStates: nodesByRun.get(r.id) ?? []
1299
+ }));
1283
1300
  }
1284
1301
  function listWorkflowRunsByTask(taskId, limit = 20) {
1285
1302
  const d = getDb();
1286
1303
  const rows = d.prepare(
1287
- `
1288
- SELECT DISTINCT wr.*, w.name as workflow_name
1289
- FROM workflow_runs wr
1290
- LEFT JOIN workflows w ON w.id = wr.workflow_id
1291
- WHERE wr.trigger_task_id = ?
1292
- OR wr.id IN (SELECT run_id FROM workflow_run_nodes WHERE task_id = ?)
1293
- ORDER BY wr.started_at DESC
1294
- LIMIT ?
1295
- `
1304
+ `SELECT DISTINCT wr.*, w.name as workflow_name
1305
+ FROM workflow_runs wr
1306
+ LEFT JOIN workflows w ON w.id = wr.workflow_id
1307
+ WHERE wr.trigger_task_id = ?
1308
+ OR wr.id IN (SELECT run_id FROM workflow_run_nodes WHERE task_id = ?)
1309
+ ORDER BY wr.started_at DESC
1310
+ LIMIT ?`
1296
1311
  ).all(taskId, taskId, limit);
1297
- return rows.map((r) => {
1298
- const nodeRows = d.prepare("SELECT * FROM workflow_run_nodes WHERE run_id = ?").all(r.id);
1299
- return {
1300
- workflowId: r.workflow_id,
1301
- startedAt: r.started_at,
1302
- ...r.completed_at != null && { completedAt: r.completed_at },
1303
- status: r.status,
1304
- ...r.trigger_task_id != null && { triggerTaskId: r.trigger_task_id },
1305
- ...r.workflow_name != null && { workflowName: r.workflow_name },
1306
- nodeStates: nodeRows.map((n) => ({
1307
- nodeId: n.node_id,
1308
- status: n.status,
1309
- ...n.started_at != null && { startedAt: n.started_at },
1310
- ...n.completed_at != null && { completedAt: n.completed_at },
1311
- ...n.session_id != null && { sessionId: n.session_id },
1312
- ...n.error != null && { error: n.error },
1313
- ...n.logs != null && { logs: n.logs },
1314
- ...n.task_id != null && { taskId: n.task_id },
1315
- ...n.agent_session_id != null && { agentSessionId: n.agent_session_id },
1316
- ...n.approved_at != null && { approvedAt: n.approved_at }
1317
- }))
1318
- };
1319
- });
1312
+ const nodesByRun = fetchNodesByRunIds(
1313
+ d,
1314
+ rows.map((r) => r.id)
1315
+ );
1316
+ return rows.map((r) => ({
1317
+ workflowId: r.workflow_id,
1318
+ startedAt: r.started_at,
1319
+ ...r.completed_at != null && { completedAt: r.completed_at },
1320
+ status: r.status,
1321
+ ...r.trigger_task_id != null && { triggerTaskId: r.trigger_task_id },
1322
+ ...r.workflow_name != null && { workflowName: r.workflow_name },
1323
+ nodeStates: nodesByRun.get(r.id) ?? []
1324
+ }));
1320
1325
  }
1321
1326
 
1322
1327
  // ../server/src/config-manager.ts
@@ -2699,7 +2704,7 @@ console.warn = (...args) => _origError("[mcp:warn]", ...args);
2699
2704
  console.error = (...args) => _origError("[mcp:error]", ...args);
2700
2705
  async function main() {
2701
2706
  configManager.init();
2702
- const version = true ? "0.2.0-beta.4" : createRequire(import.meta.url)("../package.json").version;
2707
+ const version = true ? "0.2.0-beta.6" : createRequire(import.meta.url)("../package.json").version;
2703
2708
  const server = createMcpServer(version);
2704
2709
  const transport = new StdioServerTransport();
2705
2710
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vornrun/mcp",
3
- "version": "0.2.0-beta.4",
3
+ "version": "0.2.0-beta.6",
4
4
  "description": "Vorn MCP server — task management, git, and workflow tools for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",