@vornrun/mcp 0.6.0-beta.1 → 0.6.0-beta.3

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 +78 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1673,6 +1673,26 @@ function listWorkflowRunsByTask(taskId, limit = 20) {
1673
1673
  )
1674
1674
  );
1675
1675
  }
1676
+ function listAllWorkflowRuns(workspaceId, limit = 50) {
1677
+ const d = getDb();
1678
+ const cappedLimit = Math.max(1, Math.min(limit, 500));
1679
+ const where = workspaceId ? `WHERE w.id IS NOT NULL AND COALESCE(w.workspace_id, 'personal') = ?` : "";
1680
+ const sql = `SELECT wr.*, w.name as workflow_name
1681
+ FROM workflow_runs wr
1682
+ LEFT JOIN workflows w ON w.id = wr.workflow_id
1683
+ ${where}
1684
+ ORDER BY wr.started_at DESC
1685
+ LIMIT ?`;
1686
+ const params = workspaceId ? [workspaceId, cappedLimit] : [cappedLimit];
1687
+ const rows = d.prepare(sql).all(...params);
1688
+ return mapRunRows(
1689
+ rows,
1690
+ fetchNodesByRunIds(
1691
+ d,
1692
+ rows.map((r) => r.id)
1693
+ )
1694
+ );
1695
+ }
1676
1696
 
1677
1697
  // ../server/src/config-manager.ts
1678
1698
  var DB_DIR = path3.join(os2.homedir(), ".vorn");
@@ -2959,7 +2979,11 @@ var nodeSchema = z5.object({
2959
2979
  // node whose output a later node consumes.
2960
2980
  slug: V.shortText.optional(),
2961
2981
  config: z5.record(z5.string(), z5.unknown()),
2962
- position: z5.object({ x: z5.number(), y: z5.number() })
2982
+ position: z5.object({ x: z5.number(), y: z5.number() }),
2983
+ // Omitted means stop. Declared here because the object strips what it does
2984
+ // not name: without it a workflow authored over MCP could never say a step
2985
+ // is survivable, and the field would be dropped without complaint.
2986
+ onError: z5.enum(["stop", "continue"]).optional()
2963
2987
  }).superRefine((node, ctx) => {
2964
2988
  if (node.type !== "loop") return;
2965
2989
  const config = node.config;
@@ -3279,6 +3303,58 @@ function registerWorkflowTools(server) {
3279
3303
  };
3280
3304
  }
3281
3305
  );
3306
+ server.tool(
3307
+ "stop_workflow_run",
3308
+ "Stop a workflow run that is still going, including one parked on an approval gate. Kills the agents it started, marks its unfinished nodes, and closes the run as cancelled. Requires the Vorn app to be running. A workflow will not start a new run while an old one sits waiting for approval, so this is how you clear that.",
3309
+ {
3310
+ run_id: V.id.describe("Run ID (from list_workflow_runs)")
3311
+ },
3312
+ async (args) => {
3313
+ const run = listAllWorkflowRuns(void 0, 500).find((r) => r.runId === args.run_id);
3314
+ if (!run) {
3315
+ return {
3316
+ content: [
3317
+ {
3318
+ type: "text",
3319
+ text: `Error: no run "${args.run_id}" in the last 500. Check list_workflow_runs.`
3320
+ }
3321
+ ],
3322
+ isError: true
3323
+ };
3324
+ }
3325
+ if (run.status !== "running") {
3326
+ return {
3327
+ content: [
3328
+ {
3329
+ type: "text",
3330
+ text: `Run ${args.run_id} already finished (${run.status}) \u2014 nothing to stop.`
3331
+ }
3332
+ ]
3333
+ };
3334
+ }
3335
+ try {
3336
+ await rpcCall("workflow:stopRun", { runId: args.run_id });
3337
+ } catch (err) {
3338
+ return {
3339
+ content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : err}` }],
3340
+ isError: true
3341
+ };
3342
+ }
3343
+ const live = run.nodeStates.filter(
3344
+ (n) => n.status === "running" || n.status === "waiting"
3345
+ ).length;
3346
+ return {
3347
+ content: [
3348
+ {
3349
+ type: "text",
3350
+ text: `Asked to stop run ${args.run_id}${run.workflowName ? ` of "${run.workflowName}"` : ""} \u2014 ${live} node(s) were still live.
3351
+
3352
+ The run is stopped by the instance holding it, so confirm with list_workflow_runs.`
3353
+ }
3354
+ ]
3355
+ };
3356
+ }
3357
+ );
3282
3358
  server.tool(
3283
3359
  "get_workflow_schedule",
3284
3360
  "Get scheduler info for a workflow: execution log or next scheduled run. Requires the Vorn app to be running.",
@@ -4341,7 +4417,7 @@ console.warn = (...args) => _origError("[mcp:warn]", ...args);
4341
4417
  console.error = (...args) => _origError("[mcp:error]", ...args);
4342
4418
  async function main() {
4343
4419
  configManager.init();
4344
- const version = true ? "0.6.0-beta.1" : createRequire(import.meta.url)("../package.json").version;
4420
+ const version = true ? "0.6.0-beta.3" : createRequire(import.meta.url)("../package.json").version;
4345
4421
  const server = createMcpServer(version);
4346
4422
  const transport = new StdioServerTransport();
4347
4423
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vornrun/mcp",
3
- "version": "0.6.0-beta.1",
3
+ "version": "0.6.0-beta.3",
4
4
  "description": "Vorn MCP server — task management, git, and workflow tools for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,8 +38,8 @@
38
38
  "zod": "^4.4.3"
39
39
  },
40
40
  "devDependencies": {
41
- "@vornrun/server": "0.6.0-beta.1",
42
- "@vornrun/shared": "0.6.0-beta.1",
41
+ "@vornrun/server": "0.6.0-beta.3",
42
+ "@vornrun/shared": "0.6.0-beta.3",
43
43
  "tsup": "^8.5.1",
44
44
  "tsx": "^4.23.1",
45
45
  "typescript": "^6.0.3"