@sweny-ai/core 0.1.93 → 0.1.94
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.
package/dist/cli/main.d.ts
CHANGED
|
@@ -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,9 @@
|
|
|
1
|
+
import type { Observer } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create an observer that prints each tool call's input and output to stderr
|
|
4
|
+
* inline, in a human-readable format. Useful when debugging a node that's
|
|
5
|
+
* failing — the default human output only shows step transitions, leaving
|
|
6
|
+
* "why" invisible. Inputs and outputs are truncated to keep the log readable;
|
|
7
|
+
* use `--stream` for the full untruncated NDJSON.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createVerboseToolObserver(): Observer;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
/**
|
|
26
|
+
* Create an observer that prints each tool call's input and output to stderr
|
|
27
|
+
* inline, in a human-readable format. Useful when debugging a node that's
|
|
28
|
+
* failing — the default human output only shows step transitions, leaving
|
|
29
|
+
* "why" invisible. Inputs and outputs are truncated to keep the log readable;
|
|
30
|
+
* use `--stream` for the full untruncated NDJSON.
|
|
31
|
+
*/
|
|
32
|
+
export function createVerboseToolObserver() {
|
|
33
|
+
return (event) => {
|
|
34
|
+
switch (event.type) {
|
|
35
|
+
case "tool:call":
|
|
36
|
+
process.stderr.write(` ${chalk.dim("→")} ${chalk.cyan(event.tool)} ${chalk.dim("(input)")}\n`);
|
|
37
|
+
process.stderr.write(` ${chalk.dim(indent(truncate(fmt(event.input))))}\n`);
|
|
38
|
+
break;
|
|
39
|
+
case "tool:result":
|
|
40
|
+
process.stderr.write(` ${chalk.dim("←")} ${chalk.cyan(event.tool)} ${chalk.dim("(output)")}\n`);
|
|
41
|
+
process.stderr.write(` ${chalk.dim(indent(truncate(fmt(event.output))))}\n`);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|