@sweny-ai/core 0.1.93 → 0.1.95

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.
@@ -5,6 +5,7 @@ export declare function workflowRunAction(file: string, options: Record<string,
5
5
  json?: boolean;
6
6
  stream?: boolean;
7
7
  mermaid?: boolean;
8
+ verbose?: boolean;
8
9
  }): Promise<void>;
9
10
  export declare function workflowExportAction(name: string): void;
10
11
  export declare function workflowValidateAction(file: string, options: {
package/dist/cli/main.js CHANGED
@@ -25,6 +25,7 @@ import { loadDotenv, loadConfigFile } from "./config-file.js";
25
25
  import { buildCredentialMap } from "./credentials.js";
26
26
  import { runNew } from "./new.js";
27
27
  import { runE2eRun } from "./e2e.js";
28
+ import { createVerboseToolObserver } from "./verbose-observer.js";
28
29
  import { registerTriageCommand, registerImplementCommand, parseCliInputs, validateInputs, validateWarnings, } from "./config.js";
29
30
  import { c, formatBanner, getStepDetails, formatStepLine, formatDagResultHuman, formatDagResultMarkdown, formatResultJson, formatValidationErrors, formatCrashError, formatCheckResults, } from "./output.js";
30
31
  import { checkProviderConnectivity } from "./check.js";
@@ -46,6 +47,8 @@ function createStreamObserver() {
46
47
  process.stdout.write(JSON.stringify(event) + "\n");
47
48
  };
48
49
  }
50
+ // Verbose tool-detail observer lives in ./verbose-observer.ts so tests can
51
+ // import it without triggering main.ts's top-level CLI parser.
49
52
  /** Compose multiple observers into one. */
50
53
  function composeObservers(...observers) {
51
54
  const valid = observers.filter((o) => o != null);
@@ -753,7 +756,7 @@ export async function workflowRunAction(file, options) {
753
756
  if (wfCloudHandle?.dashboardUrl && !isJson) {
754
757
  console.log(c.subtle(` cloud: ${wfCloudHandle.dashboardUrl}`));
755
758
  }
756
- const observer = composeObservers(wfProgressObserver, options.stream ? createStreamObserver() : undefined, createCloudStreamObserver(config, wfCloudHandle));
759
+ const observer = composeObservers(wfProgressObserver, options.verbose ? createVerboseToolObserver() : undefined, options.stream ? createStreamObserver() : undefined, createCloudStreamObserver(config, wfCloudHandle));
757
760
  try {
758
761
  const { results, trace } = await execute(workflow, workflowInput, {
759
762
  skills,
@@ -857,6 +860,7 @@ workflowCmd
857
860
  .option("--list-nodes", "Validate, print nodes/skills, and exit without running. (Replaces the pre-Fix-#6 --dry-run behavior.)")
858
861
  .option("--json", "Output result as JSON on stdout; suppress progress output")
859
862
  .option("--stream", "Stream NDJSON events to stdout (for Studio / automation)")
863
+ .option("--verbose", "Print each tool call's input and output inline (human-readable, truncated). Use --stream for full untruncated NDJSON.")
860
864
  .option("--mermaid", "Output a Mermaid diagram with execution state after run")
861
865
  .option("--input <json>", "JSON string of input data to pass to the workflow")
862
866
  .action(workflowRunAction);
@@ -0,0 +1,19 @@
1
+ import type { Observer } from "../types.js";
2
+ /**
3
+ * Create an observer that prints each tool call's input and output to stderr
4
+ * in a human-readable form. Useful when debugging a node that fails or routes
5
+ * unexpectedly — the default human output only shows step transitions,
6
+ * leaving "why" invisible.
7
+ *
8
+ * Emission strategy: print the full call list on `node:exit` rather than per
9
+ * `tool:call`/`tool:result` event. The reason: the executor's tool:call and
10
+ * tool:result events fire only for skill-registered tools, not for the
11
+ * Claude Code subprocess's built-in tools (Bash, Read, Edit, etc.). Those
12
+ * built-in tools — the ones agents actually use most — land in
13
+ * `result.toolCalls` only after the node completes. Walking result.toolCalls
14
+ * on node:exit covers both kinds and avoids partial visibility.
15
+ *
16
+ * Inputs and outputs are truncated; use `--stream` for full untruncated
17
+ * NDJSON.
18
+ */
19
+ export declare function createVerboseToolObserver(): Observer;
@@ -0,0 +1,61 @@
1
+ import chalk from "chalk";
2
+ const TRUNCATE = 1200;
3
+ function truncate(s) {
4
+ return s.length > TRUNCATE
5
+ ? `${s.slice(0, TRUNCATE)}\n ${chalk.dim(`… [${s.length - TRUNCATE} more chars]`)}`
6
+ : s;
7
+ }
8
+ function fmt(v) {
9
+ if (v === undefined)
10
+ return "undefined";
11
+ if (v === null)
12
+ return "null";
13
+ if (typeof v === "string")
14
+ return v;
15
+ try {
16
+ return JSON.stringify(v, null, 2);
17
+ }
18
+ catch {
19
+ return String(v);
20
+ }
21
+ }
22
+ function indent(s) {
23
+ return s.split("\n").join("\n ");
24
+ }
25
+ function printCall(call) {
26
+ process.stderr.write(` ${chalk.dim("→")} ${chalk.cyan(call.tool)} ${chalk.dim("(input)")}\n`);
27
+ process.stderr.write(` ${chalk.dim(indent(truncate(fmt(call.input))))}\n`);
28
+ const status = call.status === "error" ? chalk.red("(output, error)") : chalk.dim("(output)");
29
+ process.stderr.write(` ${chalk.dim("←")} ${chalk.cyan(call.tool)} ${status}\n`);
30
+ process.stderr.write(` ${chalk.dim(indent(truncate(fmt(call.output))))}\n`);
31
+ }
32
+ /**
33
+ * Create an observer that prints each tool call's input and output to stderr
34
+ * in a human-readable form. Useful when debugging a node that fails or routes
35
+ * unexpectedly — the default human output only shows step transitions,
36
+ * leaving "why" invisible.
37
+ *
38
+ * Emission strategy: print the full call list on `node:exit` rather than per
39
+ * `tool:call`/`tool:result` event. The reason: the executor's tool:call and
40
+ * tool:result events fire only for skill-registered tools, not for the
41
+ * Claude Code subprocess's built-in tools (Bash, Read, Edit, etc.). Those
42
+ * built-in tools — the ones agents actually use most — land in
43
+ * `result.toolCalls` only after the node completes. Walking result.toolCalls
44
+ * on node:exit covers both kinds and avoids partial visibility.
45
+ *
46
+ * Inputs and outputs are truncated; use `--stream` for full untruncated
47
+ * NDJSON.
48
+ */
49
+ export function createVerboseToolObserver() {
50
+ return (event) => {
51
+ if (event.type !== "node:exit")
52
+ return;
53
+ const calls = event.result.toolCalls;
54
+ if (calls.length === 0)
55
+ return;
56
+ process.stderr.write(` ${chalk.bold.dim(`${event.node}: ${calls.length} tool call${calls.length === 1 ? "" : "s"}`)}\n`);
57
+ for (const call of calls) {
58
+ printCall(call);
59
+ }
60
+ };
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sweny-ai/core",
3
- "version": "0.1.93",
3
+ "version": "0.1.95",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "sweny": "./dist/cli/main.js"