@kernel.chat/kbot 2.22.2 → 2.23.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.
@@ -0,0 +1,619 @@
1
+ // K:BOT Workflow Graph System — Composable multi-step agent pipelines
2
+ //
3
+ // Builds on top of the existing planner and agent loop to provide:
4
+ // 1. Declarative DAG-based workflows (nodes + edges)
5
+ // 2. Parallel, conditional, and human-in-the-loop execution
6
+ // 3. Persistent workflow storage (~/.kbot/workflows/)
7
+ // 4. Plan-to-workflow bridge for converting planner output
8
+ // 5. Mermaid diagram export for visualization
9
+ // 6. Tool integration for agent-driven workflow management
10
+ import { runAgent } from './agent.js';
11
+ import { registerTool } from './tools/index.js';
12
+ import { createSpinner, printInfo, printSuccess, printError, printWarn } from './ui.js';
13
+ import { homedir } from 'node:os';
14
+ import { join } from 'node:path';
15
+ import { readFile, writeFile, mkdir, readdir } from 'node:fs/promises';
16
+ import { existsSync } from 'node:fs';
17
+ import { createInterface } from 'node:readline';
18
+ import { randomUUID } from 'node:crypto';
19
+ // ── Storage ──
20
+ const KBOT_DIR = join(homedir(), '.kbot');
21
+ const WORKFLOWS_DIR = join(KBOT_DIR, 'workflows');
22
+ async function ensureWorkflowsDir() {
23
+ if (!existsSync(WORKFLOWS_DIR)) {
24
+ await mkdir(WORKFLOWS_DIR, { recursive: true });
25
+ }
26
+ }
27
+ // ── Core Functions ──
28
+ /**
29
+ * Create an empty workflow with the given name and description.
30
+ */
31
+ export function createWorkflow(name, description) {
32
+ const now = new Date().toISOString();
33
+ return {
34
+ id: randomUUID(),
35
+ name,
36
+ description,
37
+ version: '1.0.0',
38
+ author: 'kbot',
39
+ nodes: [],
40
+ edges: [],
41
+ variables: {},
42
+ createdAt: now,
43
+ updatedAt: now,
44
+ };
45
+ }
46
+ /**
47
+ * Add a node to a workflow. Returns the mutated workflow.
48
+ */
49
+ export function addNode(workflow, node) {
50
+ // Prevent duplicate IDs
51
+ if (workflow.nodes.some(n => n.id === node.id)) {
52
+ throw new Error(`Node "${node.id}" already exists in workflow "${workflow.name}"`);
53
+ }
54
+ workflow.nodes.push(node);
55
+ workflow.updatedAt = new Date().toISOString();
56
+ return workflow;
57
+ }
58
+ /**
59
+ * Connect two nodes with a directed edge. Returns the mutated workflow.
60
+ */
61
+ export function addEdge(workflow, from, to, label) {
62
+ // Validate that both nodes exist
63
+ if (!workflow.nodes.some(n => n.id === from)) {
64
+ throw new Error(`Source node "${from}" not found in workflow`);
65
+ }
66
+ if (!workflow.nodes.some(n => n.id === to)) {
67
+ throw new Error(`Target node "${to}" not found in workflow`);
68
+ }
69
+ // Prevent duplicate edges
70
+ if (workflow.edges.some(e => e.from === from && e.to === to)) {
71
+ throw new Error(`Edge from "${from}" to "${to}" already exists`);
72
+ }
73
+ workflow.edges.push({ from, to, label });
74
+ workflow.updatedAt = new Date().toISOString();
75
+ return workflow;
76
+ }
77
+ /**
78
+ * Save a workflow to ~/.kbot/workflows/<id>.json
79
+ */
80
+ export async function saveWorkflow(workflow) {
81
+ await ensureWorkflowsDir();
82
+ const filePath = join(WORKFLOWS_DIR, `${workflow.id}.json`);
83
+ await writeFile(filePath, JSON.stringify(workflow, null, 2), 'utf-8');
84
+ return filePath;
85
+ }
86
+ /**
87
+ * Load a workflow from disk by ID.
88
+ */
89
+ export async function loadWorkflow(id) {
90
+ const filePath = join(WORKFLOWS_DIR, `${id}.json`);
91
+ if (!existsSync(filePath)) {
92
+ throw new Error(`Workflow "${id}" not found at ${filePath}`);
93
+ }
94
+ const raw = await readFile(filePath, 'utf-8');
95
+ return JSON.parse(raw);
96
+ }
97
+ /**
98
+ * List all saved workflows.
99
+ */
100
+ export async function listWorkflows() {
101
+ await ensureWorkflowsDir();
102
+ const files = await readdir(WORKFLOWS_DIR);
103
+ const workflows = [];
104
+ for (const file of files) {
105
+ if (!file.endsWith('.json'))
106
+ continue;
107
+ try {
108
+ const raw = await readFile(join(WORKFLOWS_DIR, file), 'utf-8');
109
+ const wf = JSON.parse(raw);
110
+ workflows.push({
111
+ id: wf.id,
112
+ name: wf.name,
113
+ description: wf.description,
114
+ updatedAt: wf.updatedAt,
115
+ });
116
+ }
117
+ catch {
118
+ // Skip malformed files
119
+ }
120
+ }
121
+ return workflows.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
122
+ }
123
+ /**
124
+ * Export a workflow as shareable JSON string.
125
+ */
126
+ export function exportWorkflow(workflow) {
127
+ return JSON.stringify(workflow, null, 2);
128
+ }
129
+ // ── Topological Sort ──
130
+ /**
131
+ * Topological sort of workflow nodes based on edges.
132
+ * Returns node IDs in execution order. Throws on cycles.
133
+ */
134
+ function topologicalSort(workflow) {
135
+ const inDegree = new Map();
136
+ const adjacency = new Map();
137
+ // Initialize
138
+ for (const node of workflow.nodes) {
139
+ inDegree.set(node.id, 0);
140
+ adjacency.set(node.id, []);
141
+ }
142
+ // Build adjacency and in-degree from edges
143
+ for (const edge of workflow.edges) {
144
+ adjacency.get(edge.from)?.push(edge.to);
145
+ inDegree.set(edge.to, (inDegree.get(edge.to) ?? 0) + 1);
146
+ }
147
+ // Kahn's algorithm
148
+ const queue = [];
149
+ for (const entry of Array.from(inDegree.entries())) {
150
+ if (entry[1] === 0)
151
+ queue.push(entry[0]);
152
+ }
153
+ const sorted = [];
154
+ while (queue.length > 0) {
155
+ const current = queue.shift();
156
+ sorted.push(current);
157
+ for (const neighbor of adjacency.get(current) ?? []) {
158
+ const newDegree = (inDegree.get(neighbor) ?? 1) - 1;
159
+ inDegree.set(neighbor, newDegree);
160
+ if (newDegree === 0)
161
+ queue.push(neighbor);
162
+ }
163
+ }
164
+ if (sorted.length !== workflow.nodes.length) {
165
+ throw new Error('Workflow contains a cycle — cannot determine execution order');
166
+ }
167
+ return sorted;
168
+ }
169
+ // ── Workflow Execution Engine ──
170
+ /**
171
+ * Prompt the user for input in the terminal. Used by `human` nodes.
172
+ */
173
+ function promptUser(message) {
174
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
175
+ return new Promise((resolve) => {
176
+ rl.question(` [human input] ${message}: `, (answer) => {
177
+ resolve(answer.trim());
178
+ rl.close();
179
+ });
180
+ });
181
+ }
182
+ /**
183
+ * Interpolate template variables into a string.
184
+ * Replaces {{varName}} with the value from the variables map.
185
+ */
186
+ function interpolate(template, variables) {
187
+ return template.replace(/\{\{(\w+)\}\}/g, (_match, key) => {
188
+ return variables[key] ?? `{{${key}}}`;
189
+ });
190
+ }
191
+ /**
192
+ * Build context string from previous node results for injection into agent prompts.
193
+ */
194
+ function buildNodeContext(results, workflow, nodeId) {
195
+ // Find all predecessor nodes (nodes with edges pointing to this node)
196
+ const predecessors = workflow.edges
197
+ .filter(e => e.to === nodeId)
198
+ .map(e => e.from);
199
+ if (predecessors.length === 0)
200
+ return '';
201
+ const contextParts = ['Previous step results:'];
202
+ for (const predId of predecessors) {
203
+ const predNode = workflow.nodes.find(n => n.id === predId);
204
+ const result = results[predId];
205
+ if (predNode && result) {
206
+ const label = predNode.prompt?.slice(0, 60) ?? predNode.id;
207
+ contextParts.push(`- [${predId}] ${label}: ${result.slice(0, 500)}`);
208
+ }
209
+ }
210
+ return contextParts.join('\n');
211
+ }
212
+ /**
213
+ * Evaluate a condition expression against the current run state.
214
+ * Supports simple comparisons on results and variables.
215
+ */
216
+ function evaluateCondition(expression, results, variables) {
217
+ // Provide a safe evaluation context with results and variables
218
+ // We use a simple pattern matcher rather than eval() for security
219
+ //
220
+ // Supported patterns:
221
+ // results.nodeId contains "text"
222
+ // results.nodeId === "text"
223
+ // variables.key === "value"
224
+ // results.nodeId.length > N
225
+ const containsMatch = expression.match(/^results\.(\w+)\s+contains\s+"([^"]*)"$/);
226
+ if (containsMatch) {
227
+ const [, nodeId, text] = containsMatch;
228
+ return (results[nodeId] ?? '').includes(text);
229
+ }
230
+ const equalsResultMatch = expression.match(/^results\.(\w+)\s*===\s*"([^"]*)"$/);
231
+ if (equalsResultMatch) {
232
+ const [, nodeId, text] = equalsResultMatch;
233
+ return (results[nodeId] ?? '') === text;
234
+ }
235
+ const equalsVarMatch = expression.match(/^variables\.(\w+)\s*===\s*"([^"]*)"$/);
236
+ if (equalsVarMatch) {
237
+ const [, key, value] = equalsVarMatch;
238
+ return (variables[key] ?? '') === value;
239
+ }
240
+ const lengthMatch = expression.match(/^results\.(\w+)\.length\s*(>|<|>=|<=|===)\s*(\d+)$/);
241
+ if (lengthMatch) {
242
+ const [, nodeId, op, numStr] = lengthMatch;
243
+ const len = (results[nodeId] ?? '').length;
244
+ const num = parseInt(numStr, 10);
245
+ switch (op) {
246
+ case '>': return len > num;
247
+ case '<': return len < num;
248
+ case '>=': return len >= num;
249
+ case '<=': return len <= num;
250
+ case '===': return len === num;
251
+ default: return false;
252
+ }
253
+ }
254
+ // Default: non-empty result from a node is truthy
255
+ const simpleNodeMatch = expression.match(/^results\.(\w+)$/);
256
+ if (simpleNodeMatch) {
257
+ const [, nodeId] = simpleNodeMatch;
258
+ return (results[nodeId] ?? '').length > 0;
259
+ }
260
+ printWarn(`Unknown condition expression: "${expression}" — defaulting to true`);
261
+ return true;
262
+ }
263
+ /**
264
+ * Execute a single workflow node. Returns the result string.
265
+ */
266
+ async function executeNode(node, workflow, run, agentOpts) {
267
+ const allVars = { ...workflow.variables, ...run.results };
268
+ const context = buildNodeContext(run.results, workflow, node.id);
269
+ switch (node.type) {
270
+ case 'agent': {
271
+ const prompt = node.prompt ? interpolate(node.prompt, allVars) : `Execute node: ${node.id}`;
272
+ const fullPrompt = context
273
+ ? `${context}\n\nYour task: ${prompt}`
274
+ : prompt;
275
+ const response = await runAgent(fullPrompt, {
276
+ ...agentOpts,
277
+ agent: node.agent ?? agentOpts.agent,
278
+ skipPlanner: true,
279
+ });
280
+ return response.content;
281
+ }
282
+ case 'tool': {
283
+ if (!node.tool)
284
+ throw new Error(`Tool node "${node.id}" has no tool specified`);
285
+ const prompt = node.prompt ? interpolate(node.prompt, allVars) : `Use the ${node.tool} tool for: ${node.id}`;
286
+ const fullPrompt = context
287
+ ? `${context}\n\nYour task: ${prompt}\n\nYou MUST use the "${node.tool}" tool to accomplish this.`
288
+ : `${prompt}\n\nYou MUST use the "${node.tool}" tool to accomplish this.`;
289
+ const response = await runAgent(fullPrompt, {
290
+ ...agentOpts,
291
+ skipPlanner: true,
292
+ });
293
+ return response.content;
294
+ }
295
+ case 'condition': {
296
+ if (!node.condition)
297
+ throw new Error(`Condition node "${node.id}" has no condition specified`);
298
+ const interpolatedCondition = interpolate(node.condition, allVars);
299
+ const result = evaluateCondition(interpolatedCondition, run.results, workflow.variables);
300
+ return result ? 'true' : 'false';
301
+ }
302
+ case 'parallel': {
303
+ if (!node.children || node.children.length === 0) {
304
+ throw new Error(`Parallel node "${node.id}" has no children`);
305
+ }
306
+ const childNodes = node.children
307
+ .map(childId => workflow.nodes.find(n => n.id === childId))
308
+ .filter((n) => n !== undefined);
309
+ if (childNodes.length === 0) {
310
+ throw new Error(`Parallel node "${node.id}": none of the child IDs matched existing nodes`);
311
+ }
312
+ printInfo(`Running ${childNodes.length} nodes in parallel...`);
313
+ const childResults = await Promise.all(childNodes.map(async (child) => {
314
+ const childResult = await executeNode(child, workflow, run, agentOpts);
315
+ run.results[child.id] = childResult;
316
+ return { id: child.id, result: childResult };
317
+ }));
318
+ return childResults.map(r => `[${r.id}]: ${r.result.slice(0, 200)}`).join('\n');
319
+ }
320
+ case 'human': {
321
+ const message = node.prompt
322
+ ? interpolate(node.prompt, allVars)
323
+ : `Input needed for step "${node.id}"`;
324
+ return await promptUser(message);
325
+ }
326
+ default:
327
+ throw new Error(`Unknown node type: ${node.type}`);
328
+ }
329
+ }
330
+ /**
331
+ * Execute a complete workflow through kbot's agent system.
332
+ *
333
+ * Walks the topologically-sorted node list. Parallel nodes execute their
334
+ * children concurrently. Condition nodes branch based on expression evaluation.
335
+ * Human nodes pause for user input.
336
+ */
337
+ export async function executeWorkflow(workflow, agentOpts, variables) {
338
+ // Merge runtime variables into workflow variables
339
+ const mergedWorkflow = {
340
+ ...workflow,
341
+ variables: { ...workflow.variables, ...variables },
342
+ };
343
+ const run = {
344
+ workflowId: workflow.id,
345
+ status: 'running',
346
+ currentNode: '',
347
+ results: {},
348
+ startedAt: new Date().toISOString(),
349
+ };
350
+ // Topological sort determines execution order
351
+ const sortedIds = topologicalSort(mergedWorkflow);
352
+ // Track which nodes have been executed (parallel children get executed early)
353
+ const executed = new Set();
354
+ // Condition node results determine which branches to skip
355
+ const skippedNodes = new Set();
356
+ printInfo(`Executing workflow: ${mergedWorkflow.name} (${sortedIds.length} nodes)`);
357
+ for (const nodeId of sortedIds) {
358
+ if (executed.has(nodeId) || skippedNodes.has(nodeId))
359
+ continue;
360
+ const node = mergedWorkflow.nodes.find(n => n.id === nodeId);
361
+ if (!node)
362
+ continue;
363
+ run.currentNode = nodeId;
364
+ const spinner = createSpinner(`[${node.type}] ${node.id}: ${node.prompt?.slice(0, 50) ?? '...'}`);
365
+ spinner.start();
366
+ let attempt = 0;
367
+ const maxAttempts = node.retryOnFail ? (node.maxRetries ?? 3) : 1;
368
+ let lastError;
369
+ while (attempt < maxAttempts) {
370
+ attempt++;
371
+ try {
372
+ const result = await executeNode(node, mergedWorkflow, run, agentOpts);
373
+ run.results[nodeId] = result;
374
+ executed.add(nodeId);
375
+ spinner.stop();
376
+ printSuccess(`[${node.type}] ${nodeId}: done`);
377
+ // Handle condition branching
378
+ if (node.type === 'condition') {
379
+ const conditionResult = result === 'true';
380
+ // Edges from condition nodes use labels "true"/"false" to select branches
381
+ const outEdges = mergedWorkflow.edges.filter(e => e.from === nodeId);
382
+ for (const edge of outEdges) {
383
+ const edgeIsTrue = edge.label === 'true' || edge.label === 'yes';
384
+ const edgeIsFalse = edge.label === 'false' || edge.label === 'no';
385
+ if ((conditionResult && edgeIsFalse) || (!conditionResult && edgeIsTrue)) {
386
+ // Mark the skipped branch — find all downstream nodes reachable only via this edge
387
+ markDownstream(mergedWorkflow, edge.to, nodeId, skippedNodes);
388
+ }
389
+ }
390
+ }
391
+ // If this is a parallel node, its children are already executed
392
+ if (node.type === 'parallel' && node.children) {
393
+ for (const childId of node.children) {
394
+ executed.add(childId);
395
+ }
396
+ }
397
+ lastError = undefined;
398
+ break;
399
+ }
400
+ catch (err) {
401
+ lastError = err instanceof Error ? err.message : String(err);
402
+ spinner.stop();
403
+ if (attempt < maxAttempts) {
404
+ printWarn(`Node "${nodeId}" failed (attempt ${attempt}/${maxAttempts}): ${lastError}`);
405
+ printInfo('Retrying...');
406
+ }
407
+ }
408
+ }
409
+ if (lastError) {
410
+ spinner.stop();
411
+ printError(`Node "${nodeId}" failed after ${maxAttempts} attempt(s): ${lastError}`);
412
+ run.results[nodeId] = `ERROR: ${lastError}`;
413
+ run.status = 'failed';
414
+ run.completedAt = new Date().toISOString();
415
+ return run;
416
+ }
417
+ }
418
+ run.status = 'completed';
419
+ run.currentNode = '';
420
+ run.completedAt = new Date().toISOString();
421
+ const totalNodes = workflow.nodes.length;
422
+ const executedCount = executed.size;
423
+ const skippedCount = skippedNodes.size;
424
+ printSuccess(`Workflow "${workflow.name}" completed: ${executedCount} executed, ${skippedCount} skipped (${totalNodes} total)`);
425
+ return run;
426
+ }
427
+ /**
428
+ * Mark all nodes downstream of a given node as skipped, unless they are also
429
+ * reachable from another non-skipped branch.
430
+ */
431
+ function markDownstream(workflow, startId, conditionNodeId, skippedNodes) {
432
+ // Simple BFS — mark reachable nodes as skipped.
433
+ // A node is safe to skip only if ALL its incoming edges come from skipped nodes
434
+ // or from the condition branch being pruned.
435
+ const queue = [startId];
436
+ const visited = new Set();
437
+ while (queue.length > 0) {
438
+ const current = queue.shift();
439
+ if (visited.has(current))
440
+ continue;
441
+ visited.add(current);
442
+ // Check if this node has any incoming edges from non-skipped, non-condition sources
443
+ const incomingEdges = workflow.edges.filter(e => e.to === current);
444
+ const allIncomingFromSkipped = incomingEdges.every(e => e.from === conditionNodeId || skippedNodes.has(e.from) || visited.has(e.from));
445
+ if (!allIncomingFromSkipped)
446
+ continue; // Node is reachable from another live branch
447
+ skippedNodes.add(current);
448
+ // Continue downstream
449
+ const outEdges = workflow.edges.filter(e => e.from === current);
450
+ for (const edge of outEdges) {
451
+ queue.push(edge.to);
452
+ }
453
+ }
454
+ }
455
+ // ── Plan-to-Workflow Conversion ──
456
+ /**
457
+ * Convert kbot planner output (array of step descriptions) into a workflow graph.
458
+ * Creates a linear chain of agent nodes with edges between sequential steps.
459
+ */
460
+ export function planToWorkflow(planSteps, name) {
461
+ const workflow = createWorkflow(name ?? 'Plan Workflow', `Auto-generated from ${planSteps.length} plan steps`);
462
+ let previousId;
463
+ for (let i = 0; i < planSteps.length; i++) {
464
+ const nodeId = `step_${i + 1}`;
465
+ const step = planSteps[i];
466
+ addNode(workflow, {
467
+ id: nodeId,
468
+ type: 'agent',
469
+ agent: 'coder',
470
+ prompt: step,
471
+ });
472
+ if (previousId) {
473
+ addEdge(workflow, previousId, nodeId);
474
+ }
475
+ previousId = nodeId;
476
+ }
477
+ return workflow;
478
+ }
479
+ // ── Mermaid Export ──
480
+ /**
481
+ * Export a workflow as a Mermaid diagram syntax for visualization.
482
+ */
483
+ export function toMermaid(workflow) {
484
+ const lines = ['graph TD'];
485
+ // Node shape by type
486
+ const nodeShapes = {
487
+ agent: ['[', ']'],
488
+ tool: ['[[', ']]'],
489
+ condition: ['{', '}'],
490
+ parallel: ['{{', '}}'],
491
+ human: ['(', ')'],
492
+ };
493
+ // Render nodes
494
+ for (const node of workflow.nodes) {
495
+ const [open, close] = nodeShapes[node.type] ?? ['[', ']'];
496
+ const label = node.prompt?.slice(0, 40) ?? node.tool ?? node.agent ?? node.id;
497
+ const sanitized = label.replace(/"/g, "'").replace(/\n/g, ' ');
498
+ lines.push(` ${node.id}${open}"${node.type}: ${sanitized}"${close}`);
499
+ }
500
+ // Render edges
501
+ for (const edge of workflow.edges) {
502
+ if (edge.label) {
503
+ lines.push(` ${edge.from} -->|${edge.label}| ${edge.to}`);
504
+ }
505
+ else {
506
+ lines.push(` ${edge.from} --> ${edge.to}`);
507
+ }
508
+ }
509
+ return lines.join('\n');
510
+ }
511
+ // ── Tool Integration ──
512
+ /**
513
+ * Register workflow management tools for agent access.
514
+ */
515
+ export function registerWorkflowTools() {
516
+ registerTool({
517
+ name: 'workflow_create',
518
+ description: 'Create a new workflow with nodes and edges. Returns the workflow ID.',
519
+ parameters: {
520
+ name: { type: 'string', description: 'Workflow name', required: true },
521
+ description: { type: 'string', description: 'Workflow description', required: true },
522
+ nodes: {
523
+ type: 'array',
524
+ description: 'Array of workflow nodes. Each node: { id, type (agent|tool|condition|parallel|human), agent?, tool?, prompt?, condition?, children?, retryOnFail?, maxRetries? }',
525
+ required: true,
526
+ items: { type: 'object' },
527
+ },
528
+ edges: {
529
+ type: 'array',
530
+ description: 'Array of edges. Each edge: { from, to, label? }',
531
+ items: { type: 'object' },
532
+ },
533
+ variables: {
534
+ type: 'object',
535
+ description: 'Template variables as key-value pairs',
536
+ },
537
+ },
538
+ tier: 'pro',
539
+ async execute(args) {
540
+ const workflow = createWorkflow(String(args.name), String(args.description));
541
+ // Add nodes
542
+ if (Array.isArray(args.nodes)) {
543
+ for (const rawNode of args.nodes) {
544
+ const n = rawNode;
545
+ addNode(workflow, {
546
+ id: String(n.id),
547
+ type: String(n.type),
548
+ agent: n.agent ? String(n.agent) : undefined,
549
+ tool: n.tool ? String(n.tool) : undefined,
550
+ prompt: n.prompt ? String(n.prompt) : undefined,
551
+ condition: n.condition ? String(n.condition) : undefined,
552
+ children: Array.isArray(n.children) ? n.children.map(String) : undefined,
553
+ retryOnFail: n.retryOnFail === true,
554
+ maxRetries: typeof n.maxRetries === 'number' ? n.maxRetries : undefined,
555
+ });
556
+ }
557
+ }
558
+ // Add edges
559
+ if (Array.isArray(args.edges)) {
560
+ for (const rawEdge of args.edges) {
561
+ const e = rawEdge;
562
+ addEdge(workflow, String(e.from), String(e.to), e.label ? String(e.label) : undefined);
563
+ }
564
+ }
565
+ // Merge variables
566
+ if (args.variables && typeof args.variables === 'object') {
567
+ for (const [k, v] of Object.entries(args.variables)) {
568
+ workflow.variables[k] = String(v);
569
+ }
570
+ }
571
+ const filePath = await saveWorkflow(workflow);
572
+ return `Workflow "${workflow.name}" created (${workflow.nodes.length} nodes, ${workflow.edges.length} edges). ID: ${workflow.id}\nSaved to: ${filePath}`;
573
+ },
574
+ });
575
+ registerTool({
576
+ name: 'workflow_run',
577
+ description: 'Execute a saved workflow by ID. Runs all nodes in topological order.',
578
+ parameters: {
579
+ id: { type: 'string', description: 'Workflow ID to execute', required: true },
580
+ variables: {
581
+ type: 'object',
582
+ description: 'Runtime variables to override workflow defaults',
583
+ },
584
+ },
585
+ tier: 'pro',
586
+ async execute(args) {
587
+ const workflow = await loadWorkflow(String(args.id));
588
+ const variables = args.variables
589
+ ? Object.fromEntries(Object.entries(args.variables).map(([k, v]) => [k, String(v)]))
590
+ : undefined;
591
+ const run = await executeWorkflow(workflow, { skipPlanner: true }, variables);
592
+ const resultLines = [
593
+ `Workflow: ${workflow.name}`,
594
+ `Status: ${run.status}`,
595
+ `Duration: ${run.completedAt ? `${(new Date(run.completedAt).getTime() - new Date(run.startedAt).getTime()) / 1000}s` : 'unknown'}`,
596
+ '',
597
+ 'Node results:',
598
+ ];
599
+ for (const [nodeId, result] of Object.entries(run.results)) {
600
+ resultLines.push(` [${nodeId}]: ${result.slice(0, 200)}`);
601
+ }
602
+ return resultLines.join('\n');
603
+ },
604
+ });
605
+ registerTool({
606
+ name: 'workflow_list',
607
+ description: 'List all saved workflows with their names, descriptions, and last updated timestamps.',
608
+ parameters: {},
609
+ tier: 'pro',
610
+ async execute() {
611
+ const workflows = await listWorkflows();
612
+ if (workflows.length === 0)
613
+ return 'No workflows saved.';
614
+ const lines = workflows.map(wf => `- ${wf.name} (${wf.id})\n ${wf.description}\n Updated: ${wf.updatedAt}`);
615
+ return `${workflows.length} workflow(s):\n\n${lines.join('\n\n')}`;
616
+ },
617
+ });
618
+ }
619
+ //# sourceMappingURL=workflows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows.js","sourceR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M,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3D,WAAW,CAAC,IAAI,CAAC,MAAM,MAAM,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;YAC5D,CAAC;YAED,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/B,CAAC;KACF,CAAC,CAAA;IAEF,YAAY,CAAC;QACX,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,uFAAuF;QACpG,UAAU,EAAE,EAAE;QACd,IAAI,EAAE,KAAK;QACX,KAAK,CAAC,OAAO;YACX,MAAM,SAAS,GAAG,MAAM,aAAa,EAAE,CAAA;YACvC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,qBAAqB,CAAA;YAExD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAC/B,KAAK,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,WAAW,gBAAgB,EAAE,CAAC,SAAS,EAAE,CAC3E,CAAA;YACD,OAAO,GAAG,SAAS,CAAC,MAAM,oBAAoB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;QACpE,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernel.chat/kbot",
3
- "version": "2.22.2",
3
+ "version": "2.23.0",
4
4
  "description": "Universal AI agent for your terminal. 22 specialist agents, 223 tools, 20 providers. Embedded llama.cpp engine — runs GGUF models directly, no Ollama needed. Audit any repo, share conversations, contribute to open source. CSV/data tools, VFX, research, containers. Self-evolving, learns your patterns.",
5
5
  "type": "module",
6
6
  "repository": {