agent-worker 0.6.0 → 0.7.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.
@@ -1,3 +1,3 @@
1
- import { C as getModelForBackend, S as SDK_MODEL_ALIASES, _ as execWithIdleTimeout, a as createMockBackend, b as CODEX_MODEL_MAP, c as CodexBackend, d as codexAdapter, f as createStreamParser, g as IdleTimeoutError, h as formatEvent, i as MockAIBackend, l as ClaudeCodeBackend, m as extractCodexResult, n as createBackend, o as SdkBackend, p as extractClaudeResult, r as listBackends, s as CursorBackend, t as checkBackends, u as claudeAdapter, v as BACKEND_DEFAULT_MODELS, x as CURSOR_MODEL_MAP, y as CLAUDE_MODEL_MAP } from "./backends-BJyk6zvs.mjs";
1
+ import { C as getModelForBackend, S as SDK_MODEL_ALIASES, _ as execWithIdleTimeout, a as createMockBackend, b as CODEX_MODEL_MAP, c as CodexBackend, d as codexAdapter, f as createStreamParser, g as IdleTimeoutError, h as formatEvent, i as MockAIBackend, l as ClaudeCodeBackend, m as extractCodexResult, n as createBackend, o as SdkBackend, p as extractClaudeResult, r as listBackends, s as CursorBackend, t as checkBackends, u as claudeAdapter, v as BACKEND_DEFAULT_MODELS, x as CURSOR_MODEL_MAP, y as CLAUDE_MODEL_MAP } from "./backends-Hclwb_Zp.mjs";
2
2
 
3
3
  export { listBackends };
@@ -604,7 +604,9 @@ function createStreamParser(debugLog, backendName, adapter) {
604
604
  for (const line of lines) {
605
605
  if (!line.trim()) continue;
606
606
  try {
607
- const event = adapter(JSON.parse(line));
607
+ const raw = JSON.parse(line);
608
+ if (raw.type === "assistant" || raw.type === "system") debugLog(`[DEBUG] ${backendName} event: ${JSON.stringify(raw).substring(0, 200)}`);
609
+ const event = adapter(raw);
608
610
  if (event) {
609
611
  const progress = formatEvent(event, backendName);
610
612
  if (progress) debugLog(progress);
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { T as FRONTIER_MODELS, k as getDefaultModel, n as createBackend } from "../backends-BJyk6zvs.mjs";
3
- import { a as createSkillsTool, c as createFeedbackTool, l as AgentSession, o as SkillsProvider, s as FEEDBACK_PROMPT, t as SkillImporter } from "../skills-CuAfAkHU.mjs";
2
+ import { T as FRONTIER_MODELS, k as getDefaultModel, n as createBackend } from "../backends-Hclwb_Zp.mjs";
3
+ import { a as createSkillsTool, c as createFeedbackTool, l as AgentSession, o as SkillsProvider, s as FEEDBACK_PROMPT, t as SkillImporter } from "../skills-CrCMADND.mjs";
4
4
  import { jsonSchema, tool } from "ai";
5
5
  import { existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
6
6
  import { dirname, isAbsolute, join, relative } from "node:path";
@@ -662,6 +662,7 @@ var ContextProviderImpl = class {
662
662
  };
663
663
  if (options?.to) msg.to = options.to;
664
664
  if (options?.kind) msg.kind = options.kind;
665
+ if (options?.toolCall) msg.toolCall = options.toolCall;
665
666
  const line = JSON.stringify(msg) + "\n";
666
667
  await this.storage.append(KEYS.channel, line);
667
668
  return msg;
@@ -2119,7 +2120,7 @@ Examples:
2119
2120
 
2120
2121
  Note: Workflow name is inferred from YAML 'name' field or filename
2121
2122
  `).action(async (file, options) => {
2122
- const { parseWorkflowFile, runWorkflowWithControllers } = await import("../workflow-C26F4PpH.mjs");
2123
+ const { parseWorkflowFile, runWorkflowWithControllers } = await import("../workflow-CzVHUE9I.mjs");
2123
2124
  const tag = options.tag || DEFAULT_TAG;
2124
2125
  const parsedWorkflow = await parseWorkflowFile(file, { tag });
2125
2126
  const workflowName = parsedWorkflow.name;
@@ -2130,8 +2131,8 @@ Note: Workflow name is inferred from YAML 'name' field or filename
2130
2131
  isCleaningUp = true;
2131
2132
  console.log("\nInterrupted, cleaning up...");
2132
2133
  if (controllers) {
2133
- const { shutdownControllers } = await import("../workflow-C26F4PpH.mjs");
2134
- const { createSilentLogger } = await import("../logger-L9AtbIPS.mjs");
2134
+ const { shutdownControllers } = await import("../workflow-CzVHUE9I.mjs");
2135
+ const { createSilentLogger } = await import("../logger-C3ekEOzi.mjs");
2135
2136
  await shutdownControllers(controllers, createSilentLogger());
2136
2137
  }
2137
2138
  process.exit(130);
@@ -2144,11 +2145,13 @@ Note: Workflow name is inferred from YAML 'name' field or filename
2144
2145
  workflow: parsedWorkflow,
2145
2146
  workflowName,
2146
2147
  tag,
2148
+ workflowPath: file,
2147
2149
  instance: `${workflowName}:${tag}`,
2148
2150
  debug: options.debug,
2149
2151
  log,
2150
2152
  mode: "run",
2151
- feedback: options.feedback
2153
+ feedback: options.feedback,
2154
+ prettyDisplay: !options.debug && !options.json
2152
2155
  });
2153
2156
  controllers = result.controllers;
2154
2157
  process.off("SIGINT", cleanup);
@@ -2165,15 +2168,24 @@ Note: Workflow name is inferred from YAML 'name' field or filename
2165
2168
  document: finalDoc,
2166
2169
  feedback: result.feedback
2167
2170
  }, null, 2));
2168
- else if (finalDoc) {
2169
- console.log("\n--- Document ---");
2170
- console.log(finalDoc);
2171
+ else if (!options.debug) {
2172
+ const { showWorkflowSummary } = await import("../display-pretty-BL9H2ocr.mjs");
2173
+ showWorkflowSummary({
2174
+ duration: result.duration,
2175
+ document: finalDoc,
2176
+ feedback: result.feedback
2177
+ });
2178
+ } else {
2179
+ if (finalDoc) {
2180
+ console.log("\n--- Document ---");
2181
+ console.log(finalDoc);
2182
+ }
2183
+ if (result.feedback && result.feedback.length > 0) {
2184
+ console.log(`\n--- Feedback (${result.feedback.length}) ---`);
2185
+ for (const entry of result.feedback) console.log(` [${entry.type}] ${entry.target}: ${entry.description}`);
2186
+ }
2171
2187
  }
2172
2188
  }
2173
- if (result.feedback && result.feedback.length > 0 && !options.json) {
2174
- console.log(`\n--- Feedback (${result.feedback.length}) ---`);
2175
- for (const entry of result.feedback) console.log(` [${entry.type}] ${entry.target}: ${entry.description}`);
2176
- }
2177
2189
  } catch (error) {
2178
2190
  process.off("SIGINT", cleanup);
2179
2191
  process.off("SIGTERM", cleanup);
@@ -2189,7 +2201,7 @@ Examples:
2189
2201
 
2190
2202
  Note: Workflow name is inferred from YAML 'name' field or filename
2191
2203
  `).action(async (file, options) => {
2192
- const { parseWorkflowFile, runWorkflowWithControllers } = await import("../workflow-C26F4PpH.mjs");
2204
+ const { parseWorkflowFile, runWorkflowWithControllers } = await import("../workflow-CzVHUE9I.mjs");
2193
2205
  const tag = options.tag || DEFAULT_TAG;
2194
2206
  const parsedWorkflow = await parseWorkflowFile(file, { tag });
2195
2207
  const workflowName = parsedWorkflow.name;
@@ -2384,7 +2396,7 @@ function registerInfoCommands(program) {
2384
2396
  console.log(`\nDefault: ${defaultModel} (when no model specified)`);
2385
2397
  });
2386
2398
  program.command("backends").description("Check available backends (SDK, CLI tools)").action(async () => {
2387
- const { listBackends } = await import("../backends-fLwD_6G_.mjs");
2399
+ const { listBackends } = await import("../backends-BN3LvE37.mjs");
2388
2400
  const backends = await listBackends();
2389
2401
  console.log("Backend Status:\n");
2390
2402
  for (const backend of backends) {
@@ -2414,7 +2426,7 @@ Examples:
2414
2426
  $ agent-worker doc read @review:pr-123 # Read specific workflow:tag document
2415
2427
  `).action(async (targetInput) => {
2416
2428
  const dir = await resolveDir(targetInput);
2417
- const { createFileContextProvider } = await import("../context-DW7xrslO.mjs");
2429
+ const { createFileContextProvider } = await import("../context-Bq7pSNVM.mjs");
2418
2430
  const content = await createFileContextProvider(dir, []).readDocument();
2419
2431
  console.log(content || "(empty document)");
2420
2432
  });
@@ -2432,7 +2444,7 @@ Examples:
2432
2444
  process.exit(1);
2433
2445
  }
2434
2446
  const dir = await resolveDir(targetInput);
2435
- const { createFileContextProvider } = await import("../context-DW7xrslO.mjs");
2447
+ const { createFileContextProvider } = await import("../context-Bq7pSNVM.mjs");
2436
2448
  await createFileContextProvider(dir, []).writeDocument(content);
2437
2449
  console.log("Document written");
2438
2450
  });
@@ -2450,7 +2462,7 @@ Examples:
2450
2462
  process.exit(1);
2451
2463
  }
2452
2464
  const dir = await resolveDir(targetInput);
2453
- const { createFileContextProvider } = await import("../context-DW7xrslO.mjs");
2465
+ const { createFileContextProvider } = await import("../context-Bq7pSNVM.mjs");
2454
2466
  await createFileContextProvider(dir, []).appendDocument(content);
2455
2467
  console.log("Content appended");
2456
2468
  });
@@ -2532,7 +2544,7 @@ Note: Requires agent to be created with --feedback flag
2532
2544
 
2533
2545
  //#endregion
2534
2546
  //#region package.json
2535
- var version = "0.6.0";
2547
+ var version = "0.7.0";
2536
2548
 
2537
2549
  //#endregion
2538
2550
  //#region src/cli/index.ts
@@ -1,4 +1,4 @@
1
1
  import { _ as shouldUseResource, a as FileStorage, c as CONTEXT_DEFAULTS, d as RESOURCE_PREFIX, f as RESOURCE_SCHEME, g as generateResourceId, h as extractMentions, i as resolveContextDir, l as MENTION_PATTERN, m as createResourceRef, n as createFileContextProvider, o as MemoryStorage, p as calculatePriority, r as getDefaultContextDir, s as ContextProviderImpl, t as FileContextProvider, u as MESSAGE_LENGTH_THRESHOLD } from "./cli/index.mjs";
2
- import { a as createMemoryContextProvider, i as MemoryContextProvider, n as formatProposal, r as formatProposalList, t as createContextMCPServer } from "./mcp-server-ONSDOpt5.mjs";
2
+ import { a as createMemoryContextProvider, i as MemoryContextProvider, n as formatProposal, r as formatProposalList, t as createContextMCPServer } from "./mcp-server-D5Pnt0lB.mjs";
3
3
 
4
4
  export { createFileContextProvider };
@@ -0,0 +1,169 @@
1
+ import * as p from "@clack/prompts";
2
+ import pc from "picocolors";
3
+
4
+ //#region src/workflow/display-pretty.ts
5
+ /**
6
+ * Pretty display mode using @clack/prompts
7
+ *
8
+ * Clean, step-based CLI output:
9
+ * - Each message/event is a step
10
+ * - Uses clack's native symbols
11
+ * - Minimal decoration, maximum clarity
12
+ */
13
+ const BANNER_LINES = [
14
+ " █████╗ ██████╗ ███████╗███╗ ██╗████████╗ ██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗",
15
+ "██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝ ██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝██╔════╝██╔══██╗",
16
+ "███████║██║ ███╗█████╗ ██╔██╗ ██║ ██║ ██║ █╗ ██║██║ ██║██████╔╝█████╔╝ █████╗ ██████╔╝",
17
+ "██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██║ ██║███╗██║██║ ██║██╔══██╗██╔═██╗ ██╔══╝ ██╔══██╗",
18
+ "██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║ ╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗███████╗██║ ██║",
19
+ "╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝"
20
+ ];
21
+ /**
22
+ * Apply gradient colors to banner lines
23
+ * Creates a smooth cyan gradient effect (bright → dark) using ANSI 256 colors
24
+ * Inspired by vercel-labs/skills gradient approach
25
+ */
26
+ function applyBannerGradient(lines) {
27
+ const CYAN_GRADIENT = [
28
+ "\x1B[38;5;51m",
29
+ "\x1B[38;5;45m",
30
+ "\x1B[38;5;39m",
31
+ "\x1B[38;5;33m",
32
+ "\x1B[38;5;27m",
33
+ "\x1B[38;5;21m"
34
+ ];
35
+ const RESET = "\x1B[0m";
36
+ return lines.map((line, i) => `${CYAN_GRADIENT[i]}${line}${RESET}`).join("\n");
37
+ }
38
+ const AGENT_COLORS = [
39
+ pc.cyan,
40
+ pc.yellow,
41
+ pc.magenta,
42
+ pc.green,
43
+ pc.blue
44
+ ];
45
+ function getAgentColor(name, agentNames) {
46
+ if (name === "system" || name === "user") return pc.dim;
47
+ const idx = agentNames.indexOf(name);
48
+ if (idx < 0) return AGENT_COLORS[name.split("").reduce((acc, c) => acc + c.charCodeAt(0), 0) % AGENT_COLORS.length];
49
+ return AGENT_COLORS[idx % AGENT_COLORS.length];
50
+ }
51
+ /**
52
+ * Process a channel entry for pretty display
53
+ */
54
+ function processEntry(entry, state, agentNames) {
55
+ const { kind, from, content, toolCall } = entry;
56
+ if (kind === "debug") return;
57
+ if (kind === "tool_call" && toolCall) {
58
+ const caller = from.includes(":") ? from.split(":").pop() : from;
59
+ if (caller) {
60
+ const color = getAgentColor(caller, agentNames);
61
+ const tool = pc.bold(pc.cyan(toolCall.name));
62
+ const args = toolCall.args ? pc.dim(`(${toolCall.args})`) : pc.dim("()");
63
+ p.log.message(`${color(caller)} called ${tool}${args}`, { symbol: pc.cyan("▶") });
64
+ } else p.log.message(`called ${pc.cyan(pc.bold(toolCall.name))}${pc.dim(`(${toolCall.args || ""})`)}`, { symbol: pc.cyan("▶") });
65
+ return;
66
+ }
67
+ if (kind === "log") {
68
+ if (content.includes("Running workflow:")) {
69
+ state.phase = "running";
70
+ return;
71
+ }
72
+ if (content.includes("Agents:")) return;
73
+ if (content.includes("Starting agents")) {
74
+ if (state.spinner) {
75
+ const agentList = agentNames.join(", ");
76
+ state.spinner.stop(`Initialized: ${pc.dim(agentList)}`);
77
+ }
78
+ state.spinner = p.spinner();
79
+ state.spinner.start("Starting agents");
80
+ } else if (content.includes("Workflow complete")) {
81
+ if (state.spinner) {
82
+ state.spinner.stop();
83
+ state.spinner = null;
84
+ }
85
+ const match = content.match(/\(([0-9.]+)s\)/);
86
+ if (match) p.log.success(`Completed in ${pc.bold(match[1])}s`);
87
+ else p.log.success("Workflow complete");
88
+ state.phase = "complete";
89
+ } else if (content.startsWith("[ERROR]")) {
90
+ if (state.spinner) {
91
+ state.spinner.stop();
92
+ state.spinner = null;
93
+ }
94
+ p.log.error(content.replace("[ERROR] ", ""));
95
+ state.phase = "error";
96
+ } else if (content.startsWith("[WARN]")) p.log.warn(content.replace("[WARN] ", ""));
97
+ else if (content.match(/Inbox: \d+ message/)) p.log.step(pc.dim(content));
98
+ else if (content.match(/Running \(attempt/)) p.log.step(pc.dim(content));
99
+ else if (content.startsWith("DONE")) {
100
+ const details = content.replace("DONE ", "");
101
+ p.log.info(pc.green("✓") + " " + pc.dim(details));
102
+ }
103
+ return;
104
+ }
105
+ const color = getAgentColor(from, agentNames);
106
+ if (state.spinner && state.phase === "running" && !state.hasShownAgentsStarted) {
107
+ state.spinner.stop();
108
+ state.spinner = null;
109
+ p.log.info("Agents ready and processing");
110
+ state.hasShownAgentsStarted = true;
111
+ }
112
+ p.note(content.trim(), color(from));
113
+ }
114
+ /**
115
+ * Start pretty display watcher
116
+ */
117
+ function startPrettyDisplay(config) {
118
+ const { contextProvider, agentNames, workflowName, tag, workflowPath, pollInterval = 500, initialCursor = 0 } = config;
119
+ const state = {
120
+ spinner: null,
121
+ phase: "init",
122
+ hasShownAgentsStarted: false
123
+ };
124
+ console.log("\n" + applyBannerGradient(BANNER_LINES));
125
+ console.log("");
126
+ const introText = ` ${workflowName}${tag === "main" ? "" : `:${tag}`}${workflowPath ? ` ${pc.dim(`(${workflowPath})`)}` : ""} `;
127
+ p.intro(pc.bgCyan(pc.black(introText)));
128
+ state.spinner = p.spinner();
129
+ const agentCount = agentNames.length;
130
+ const agentWord = agentCount === 1 ? "agent" : "agents";
131
+ state.spinner.start(`Initializing ${agentCount} ${agentWord}`);
132
+ let cursor = initialCursor;
133
+ let running = true;
134
+ const poll = async () => {
135
+ while (running) {
136
+ try {
137
+ const tail = await contextProvider.tailChannel(cursor);
138
+ for (const entry of tail.entries) processEntry(entry, state, agentNames);
139
+ cursor = tail.cursor;
140
+ } catch (error) {
141
+ console.error("Display polling error:", error instanceof Error ? error.message : error);
142
+ }
143
+ await sleep(pollInterval);
144
+ }
145
+ };
146
+ poll();
147
+ return { stop: () => {
148
+ running = false;
149
+ if (state.spinner) state.spinner.stop("Stopped");
150
+ } };
151
+ }
152
+ /**
153
+ * Show workflow completion summary
154
+ */
155
+ function showWorkflowSummary(options) {
156
+ const { document, feedback } = options;
157
+ if (document && document.trim()) p.note(document, "Document");
158
+ if (feedback && feedback.length > 0) {
159
+ const feedbackLines = feedback.map((f) => `[${f.type}] ${f.target}: ${f.description}`);
160
+ p.note(feedbackLines.join("\n"), `Feedback (${feedback.length})`);
161
+ }
162
+ p.outro("Done");
163
+ }
164
+ function sleep(ms) {
165
+ return new Promise((resolve) => setTimeout(resolve, ms));
166
+ }
167
+
168
+ //#endregion
169
+ export { showWorkflowSummary, startPrettyDisplay };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { D as createModel, E as SUPPORTED_PROVIDERS, O as createModelAsync, T as FRONTIER_MODELS, a as createMockBackend, c as CodexBackend, i as MockAIBackend, l as ClaudeCodeBackend, n as createBackend, o as SdkBackend, r as listBackends, s as CursorBackend, t as checkBackends } from "./backends-BJyk6zvs.mjs";
2
- import { a as createSkillsTool, c as createFeedbackTool, i as parseImportSpec, l as AgentSession, n as buildGitUrl, o as SkillsProvider, r as getSpecDisplayName, s as FEEDBACK_PROMPT, t as SkillImporter } from "./skills-CuAfAkHU.mjs";
1
+ import { D as createModel, E as SUPPORTED_PROVIDERS, O as createModelAsync, T as FRONTIER_MODELS, a as createMockBackend, c as CodexBackend, i as MockAIBackend, l as ClaudeCodeBackend, n as createBackend, o as SdkBackend, r as listBackends, s as CursorBackend, t as checkBackends } from "./backends-Hclwb_Zp.mjs";
2
+ import { a as createSkillsTool, c as createFeedbackTool, i as parseImportSpec, l as AgentSession, n as buildGitUrl, o as SkillsProvider, r as getSpecDisplayName, s as FEEDBACK_PROMPT, t as SkillImporter } from "./skills-CrCMADND.mjs";
3
3
  import { jsonSchema, tool } from "ai";
4
4
  import { createBashTool } from "bash-tool";
5
5
 
@@ -159,10 +159,18 @@ function createContextMCPServer(options) {
159
159
  const { provider, validAgents, name = "workflow-context", version = "1.0.0", onMention, proposalManager, feedback: feedbackEnabled, debugLog } = options;
160
160
  const feedbackEntries = [];
161
161
  const logTool = (tool, agent, params) => {
162
- if (debugLog) debugLog(`[mcp:${agent || "anonymous"}] ${tool}(${Object.entries(params).filter(([_, v]) => v !== void 0).map(([k, v]) => {
162
+ if (!agent) return;
163
+ const paramsStr = Object.entries(params).filter(([_, v]) => v !== void 0).map(([k, v]) => {
163
164
  const val = typeof v === "string" && v.length > 50 ? v.slice(0, 50) + "..." : v;
164
165
  return `${k}=${JSON.stringify(val)}`;
165
- }).join(", ")})`);
166
+ }).join(", ");
167
+ provider.appendChannel(agent, `${tool}(${paramsStr})`, {
168
+ kind: "tool_call",
169
+ toolCall: {
170
+ name: tool,
171
+ args: paramsStr
172
+ }
173
+ }).catch(() => {});
166
174
  };
167
175
  const server = new McpServer({
168
176
  name,
@@ -1,4 +1,4 @@
1
- import { O as createModelAsync } from "./backends-BJyk6zvs.mjs";
1
+ import { O as createModelAsync } from "./backends-Hclwb_Zp.mjs";
2
2
  import { ToolLoopAgent, jsonSchema, stepCountIs, tool } from "ai";
3
3
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
4
4
  import { join, normalize } from "node:path";
@@ -1,7 +1,7 @@
1
- import { O as createModelAsync, a as createMockBackend, n as createBackend, w as parseModel } from "./backends-BJyk6zvs.mjs";
1
+ import { O as createModelAsync, a as createMockBackend, n as createBackend, w as parseModel } from "./backends-Hclwb_Zp.mjs";
2
2
  import { c as CONTEXT_DEFAULTS, i as resolveContextDir, n as createFileContextProvider, t as FileContextProvider } from "./cli/index.mjs";
3
- import { a as createMemoryContextProvider, t as createContextMCPServer } from "./mcp-server-ONSDOpt5.mjs";
4
- import { createChannelLogger, createSilentLogger } from "./logger-L9AtbIPS.mjs";
3
+ import { a as createMemoryContextProvider, t as createContextMCPServer } from "./mcp-server-D5Pnt0lB.mjs";
4
+ import { createChannelLogger, createSilentLogger } from "./logger-C3ekEOzi.mjs";
5
5
  import { generateText, jsonSchema, stepCountIs, tool } from "ai";
6
6
  import { existsSync, mkdirSync, readFileSync } from "node:fs";
7
7
  import { basename, dirname, join, resolve } from "node:path";
@@ -15,9 +15,9 @@ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/
15
15
  import { MockLanguageModelV3, mockValues } from "ai/test";
16
16
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
17
17
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
18
+ import stringWidth from "string-width";
18
19
  import chalk from "chalk";
19
20
  import wrapAnsi from "wrap-ansi";
20
- import stringWidth from "string-width";
21
21
 
22
22
  //#region src/workflow/parser.ts
23
23
  /**
@@ -812,7 +812,18 @@ async function runSdkAgent(ctx, debugLog) {
812
812
  stopWhen: stepCountIs(ctx.agent.max_steps ?? 30),
813
813
  onStepFinish: (step) => {
814
814
  _stepNum++;
815
- if (step.toolCalls?.length) for (const tc of step.toolCalls) log(`CALL ${formatToolCall(tc)}`);
815
+ if (step.toolCalls?.length) {
816
+ for (const tc of step.toolCalls) if (tc.toolName === "bash") {
817
+ const args = formatToolCall(tc);
818
+ ctx.provider.appendChannel(ctx.name, args, {
819
+ kind: "tool_call",
820
+ toolCall: {
821
+ name: tc.toolName,
822
+ args
823
+ }
824
+ }).catch(() => {});
825
+ }
826
+ }
816
827
  }
817
828
  });
818
829
  const totalToolCalls = result.steps.reduce((n, s) => n + s.toolCalls.length, 0);
@@ -913,6 +924,7 @@ function createAgentController(config) {
913
924
  workspaceDir,
914
925
  projectDir,
915
926
  retryAttempt: attempt,
927
+ provider: contextProvider,
916
928
  feedback
917
929
  }, log, infoLog);
918
930
  if (lastResult.success) {
@@ -1262,46 +1274,6 @@ function formatStandardLog(entry, includeMillis = false) {
1262
1274
  //#endregion
1263
1275
  //#region src/workflow/display.ts
1264
1276
  /**
1265
- * Channel display formatting
1266
- *
1267
- * All output flows through the channel. This module formats and filters
1268
- * channel entries for terminal display:
1269
- * - kind=undefined (agent messages): always shown, colored
1270
- * - kind="log" (operational logs): always shown, dimmed
1271
- * - kind="debug" (debug details): only shown with --debug flag
1272
- *
1273
- * Two display modes:
1274
- * - TTY (human): colored, aligned columns, smart wrapping
1275
- * - Non-TTY (agent/pipe): plain text, no colors, simple separators
1276
- *
1277
- * Best practices implemented:
1278
- * - Adaptive layout based on terminal width and agent names
1279
- * - Smart text wrapping preserving ANSI colors
1280
- * - Message grouping to reduce visual noise
1281
- * - Background-agnostic color scheme
1282
- */
1283
- /** Whether to use rich terminal formatting */
1284
- const isTTY = !!process.stdout.isTTY && !process.env.NO_COLOR;
1285
- /**
1286
- * Background-agnostic color scheme
1287
- * Uses only bold and standard colors that work on any theme
1288
- */
1289
- const C = {
1290
- dim: isTTY ? chalk.dim : (s) => s,
1291
- bold: isTTY ? chalk.bold : (s) => s,
1292
- yellow: isTTY ? chalk.yellow : (s) => s,
1293
- red: isTTY ? chalk.red : (s) => s,
1294
- agents: isTTY ? [
1295
- chalk.cyan,
1296
- chalk.yellow,
1297
- chalk.magenta,
1298
- chalk.green,
1299
- chalk.blue,
1300
- chalk.redBright
1301
- ] : Array(6).fill((s) => s),
1302
- system: isTTY ? chalk.gray : (s) => s
1303
- };
1304
- /**
1305
1277
  * Create display context for a workflow
1306
1278
  */
1307
1279
  function createDisplayContext(agentNames, options) {
@@ -1570,8 +1542,7 @@ async function runWorkflowWithControllers(config) {
1570
1542
  } else logger.debug(`@mention: ${from} → @${target} (no controller found!)`);
1571
1543
  },
1572
1544
  debugLog: (msg) => {
1573
- if (msg.startsWith("CALL ")) logger.info(msg);
1574
- else logger.debug(msg);
1545
+ logger.debug(msg);
1575
1546
  },
1576
1547
  feedback: feedbackEnabled
1577
1548
  });
@@ -1586,9 +1557,9 @@ async function runWorkflowWithControllers(config) {
1586
1557
  backend: agentDef.backend,
1587
1558
  model: agentDef.model
1588
1559
  });
1560
+ const agentLogger = logger.child(agentName);
1589
1561
  const backendDebugLog = (msg) => {
1590
- if (msg.startsWith("CALL ")) logger.info(msg);
1591
- else logger.debug(msg);
1562
+ agentLogger.debug(msg);
1592
1563
  };
1593
1564
  let backend;
1594
1565
  if (createBackend) backend = createBackend(agentName, agentDef);
@@ -1624,7 +1595,19 @@ async function runWorkflowWithControllers(config) {
1624
1595
  logger.debug("Sending kickoff message...");
1625
1596
  await runtime.sendKickoff();
1626
1597
  logger.debug("Kickoff sent");
1627
- const channelWatcher = startChannelWatcher({
1598
+ let channelWatcher;
1599
+ if (config.prettyDisplay) {
1600
+ const { startPrettyDisplay } = await import("./display-pretty-BL9H2ocr.mjs");
1601
+ channelWatcher = startPrettyDisplay({
1602
+ contextProvider: runtime.contextProvider,
1603
+ agentNames: runtime.agentNames,
1604
+ workflowName,
1605
+ tag,
1606
+ workflowPath: config.workflowPath,
1607
+ initialCursor: channelStart,
1608
+ pollInterval: 250
1609
+ });
1610
+ } else channelWatcher = startChannelWatcher({
1628
1611
  contextProvider: runtime.contextProvider,
1629
1612
  agentNames: runtime.agentNames,
1630
1613
  log,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-worker",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "SDK and CLI for creating and testing agent workers with Vercel AI SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -30,6 +30,7 @@
30
30
  "prepublishOnly": "bun run build"
31
31
  },
32
32
  "dependencies": {
33
+ "@clack/prompts": "^1.0.0",
33
34
  "@modelcontextprotocol/sdk": "^1.26.0",
34
35
  "ai": "^6.0.69",
35
36
  "bash-tool": "^1.3.12",
@@ -38,6 +39,7 @@
38
39
  "execa": "^9.6.1",
39
40
  "just-bash": "^2.8.0",
40
41
  "nanoid": "^5.1.6",
42
+ "picocolors": "^1.1.1",
41
43
  "string-width": "^8.1.1",
42
44
  "wrap-ansi": "^9.0.2",
43
45
  "yaml": "^2.7.0",