@outputai/cli 0.17.1-next.78fc808.0 → 0.18.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.
- package/dist/assets/docker/docker-compose-dev.yml +1 -1
- package/dist/commands/workflow/dataset/generate.d.ts +8 -6
- package/dist/commands/workflow/dataset/generate.js +46 -80
- package/dist/commands/workflow/dataset/generate.spec.js +154 -83
- package/dist/commands/workflow/debug.d.ts +8 -3
- package/dist/commands/workflow/debug.js +35 -25
- package/dist/commands/workflow/debug.spec.js +76 -22
- package/dist/commands/workflow/test.js +0 -3
- package/dist/commands/workflow/test.spec.js +19 -0
- package/dist/generated/framework_version.json +1 -1
- package/dist/services/datasets.d.ts +1 -3
- package/dist/services/datasets.js +1 -19
- package/dist/services/datasets.test.js +45 -3
- package/dist/services/temporal_client.d.ts +50 -0
- package/dist/services/temporal_client.js +84 -0
- package/dist/services/temporal_client.spec.d.ts +1 -0
- package/dist/services/temporal_client.spec.js +129 -0
- package/dist/services/workflow_debug.d.ts +68 -0
- package/dist/services/workflow_debug.js +273 -0
- package/dist/services/workflow_debug.spec.d.ts +1 -0
- package/dist/services/workflow_debug.spec.js +363 -0
- package/dist/services/workflow_run_data.d.ts +26 -0
- package/dist/services/workflow_run_data.js +67 -0
- package/dist/services/workflow_run_data.spec.d.ts +1 -0
- package/dist/services/workflow_run_data.spec.js +190 -0
- package/dist/types/trace.d.ts +1 -73
- package/dist/types/trace.js +1 -12
- package/dist/utils/payload_truncator.d.ts +23 -0
- package/dist/utils/payload_truncator.js +92 -0
- package/dist/utils/payload_truncator.spec.d.ts +1 -0
- package/dist/utils/payload_truncator.spec.js +51 -0
- package/dist/utils/temporal_flags.d.ts +14 -0
- package/dist/utils/temporal_flags.js +16 -0
- package/oclif.manifest.json +80 -36
- package/package.json +10 -2
- package/dist/utils/trace_extractor.d.ts +0 -27
- package/dist/utils/trace_extractor.js +0 -53
- package/dist/utils/trace_formatter.d.ts +0 -11
- package/dist/utils/trace_formatter.js +0 -401
package/oclif.manifest.json
CHANGED
|
@@ -613,18 +613,49 @@
|
|
|
613
613
|
"required": true
|
|
614
614
|
}
|
|
615
615
|
},
|
|
616
|
-
"description": "
|
|
616
|
+
"description": "Read a workflow run and its child workflows from Temporal as JSON, one entry per workflow, for debugging",
|
|
617
617
|
"examples": [
|
|
618
618
|
"<%= config.bin %> <%= command.id %> wf-12345",
|
|
619
|
-
"<%= config.bin %> <%= command.id %> wf-12345 --
|
|
619
|
+
"<%= config.bin %> <%= command.id %> wf-12345 --run-id 11111111-2222-4333-8444-555555555555",
|
|
620
|
+
"<%= config.bin %> <%= command.id %> wf-12345 --profile prod",
|
|
621
|
+
"<%= config.bin %> <%= command.id %> wf-12345 --address temporal.internal:7233 --namespace staging"
|
|
620
622
|
],
|
|
621
623
|
"flags": {
|
|
624
|
+
"run-id": {
|
|
625
|
+
"char": "r",
|
|
626
|
+
"description": "Run to start from (defaults to the latest run); runs that continue from it are read too",
|
|
627
|
+
"name": "run-id",
|
|
628
|
+
"hasDynamicHelp": false,
|
|
629
|
+
"multiple": false,
|
|
630
|
+
"type": "option"
|
|
631
|
+
},
|
|
622
632
|
"json": {
|
|
623
|
-
"description": "
|
|
624
|
-
"
|
|
633
|
+
"description": "Accepted and ignored: the output is always JSON",
|
|
634
|
+
"hidden": true,
|
|
625
635
|
"name": "json",
|
|
626
636
|
"allowNo": false,
|
|
627
637
|
"type": "boolean"
|
|
638
|
+
},
|
|
639
|
+
"profile": {
|
|
640
|
+
"description": "Temporal profile to read from temporal.toml (defaults to TEMPORAL_PROFILE, then \"default\")",
|
|
641
|
+
"name": "profile",
|
|
642
|
+
"hasDynamicHelp": false,
|
|
643
|
+
"multiple": false,
|
|
644
|
+
"type": "option"
|
|
645
|
+
},
|
|
646
|
+
"address": {
|
|
647
|
+
"description": "Temporal server address, overrides the profile and TEMPORAL_ADDRESS (default: localhost on the dev Temporal port, 7233)",
|
|
648
|
+
"name": "address",
|
|
649
|
+
"hasDynamicHelp": false,
|
|
650
|
+
"multiple": false,
|
|
651
|
+
"type": "option"
|
|
652
|
+
},
|
|
653
|
+
"namespace": {
|
|
654
|
+
"description": "Temporal namespace, overrides the profile and TEMPORAL_NAMESPACE (default: default)",
|
|
655
|
+
"name": "namespace",
|
|
656
|
+
"hasDynamicHelp": false,
|
|
657
|
+
"multiple": false,
|
|
658
|
+
"type": "option"
|
|
628
659
|
}
|
|
629
660
|
},
|
|
630
661
|
"hasDynamicHelp": false,
|
|
@@ -634,7 +665,7 @@
|
|
|
634
665
|
"pluginName": "@outputai/cli",
|
|
635
666
|
"pluginType": "core",
|
|
636
667
|
"strict": true,
|
|
637
|
-
"enableJsonFlag":
|
|
668
|
+
"enableJsonFlag": false,
|
|
638
669
|
"isESM": true,
|
|
639
670
|
"relativePath": [
|
|
640
671
|
"dist",
|
|
@@ -1555,11 +1586,12 @@
|
|
|
1555
1586
|
"required": false
|
|
1556
1587
|
}
|
|
1557
1588
|
},
|
|
1558
|
-
"description": "Generate a dataset for a workflow from a scenario,
|
|
1589
|
+
"description": "Generate a dataset case for a workflow from a scenario, an input, or a completed run read from Temporal",
|
|
1559
1590
|
"examples": [
|
|
1560
1591
|
"<%= config.bin %> <%= command.id %> simple basic_input",
|
|
1561
|
-
"<%= config.bin %> <%= command.id %> simple --
|
|
1562
|
-
"<%= config.bin %> <%= command.id %> simple --
|
|
1592
|
+
"<%= config.bin %> <%= command.id %> simple --input '{\"values\":[1,2,3]}' --name edge_case",
|
|
1593
|
+
"<%= config.bin %> <%= command.id %> simple --workflow-id wf-12345 --name edge_case",
|
|
1594
|
+
"<%= config.bin %> <%= command.id %> simple --workflow-id wf-12345 --run-id 11111111-2222-4333-8444-555555555555 --profile prod"
|
|
1563
1595
|
],
|
|
1564
1596
|
"flags": {
|
|
1565
1597
|
"catalog": {
|
|
@@ -1578,48 +1610,60 @@
|
|
|
1578
1610
|
"multiple": false,
|
|
1579
1611
|
"type": "option"
|
|
1580
1612
|
},
|
|
1581
|
-
"
|
|
1582
|
-
"char": "
|
|
1583
|
-
"description": "
|
|
1584
|
-
"
|
|
1585
|
-
"download"
|
|
1586
|
-
],
|
|
1587
|
-
"name": "trace",
|
|
1613
|
+
"name": {
|
|
1614
|
+
"char": "n",
|
|
1615
|
+
"description": "Dataset name (defaults to the scenario name, or the workflow id with --workflow-id)",
|
|
1616
|
+
"name": "name",
|
|
1588
1617
|
"hasDynamicHelp": false,
|
|
1589
1618
|
"multiple": false,
|
|
1590
1619
|
"type": "option"
|
|
1591
1620
|
},
|
|
1592
|
-
"
|
|
1593
|
-
"char": "
|
|
1594
|
-
"description": "
|
|
1595
|
-
"name": "
|
|
1621
|
+
"input": {
|
|
1622
|
+
"char": "i",
|
|
1623
|
+
"description": "Workflow input as JSON string or file path (overrides scenario)",
|
|
1624
|
+
"name": "input",
|
|
1596
1625
|
"hasDynamicHelp": false,
|
|
1597
1626
|
"multiple": false,
|
|
1598
1627
|
"type": "option"
|
|
1599
1628
|
},
|
|
1600
|
-
"
|
|
1601
|
-
"
|
|
1602
|
-
"description": "Generate datasets from recent workflow runs fetched via the Output API",
|
|
1629
|
+
"workflow-id": {
|
|
1630
|
+
"description": "Workflow id of a completed run to read from Temporal (not the workflow type)",
|
|
1603
1631
|
"exclusive": [
|
|
1604
|
-
"
|
|
1632
|
+
"input"
|
|
1605
1633
|
],
|
|
1606
|
-
"name": "
|
|
1607
|
-
"
|
|
1608
|
-
"
|
|
1634
|
+
"name": "workflow-id",
|
|
1635
|
+
"hasDynamicHelp": false,
|
|
1636
|
+
"multiple": false,
|
|
1637
|
+
"type": "option"
|
|
1609
1638
|
},
|
|
1610
|
-
"
|
|
1611
|
-
"char": "
|
|
1612
|
-
"
|
|
1613
|
-
|
|
1614
|
-
|
|
1639
|
+
"run-id": {
|
|
1640
|
+
"char": "r",
|
|
1641
|
+
"dependsOn": [
|
|
1642
|
+
"workflow-id"
|
|
1643
|
+
],
|
|
1644
|
+
"description": "Run to read (defaults to the latest run of the workflow id)",
|
|
1645
|
+
"name": "run-id",
|
|
1615
1646
|
"hasDynamicHelp": false,
|
|
1616
1647
|
"multiple": false,
|
|
1617
1648
|
"type": "option"
|
|
1618
1649
|
},
|
|
1619
|
-
"
|
|
1620
|
-
"
|
|
1621
|
-
"
|
|
1622
|
-
"
|
|
1650
|
+
"profile": {
|
|
1651
|
+
"description": "Temporal profile to read from temporal.toml (defaults to TEMPORAL_PROFILE, then \"default\")",
|
|
1652
|
+
"name": "profile",
|
|
1653
|
+
"hasDynamicHelp": false,
|
|
1654
|
+
"multiple": false,
|
|
1655
|
+
"type": "option"
|
|
1656
|
+
},
|
|
1657
|
+
"address": {
|
|
1658
|
+
"description": "Temporal server address, overrides the profile and TEMPORAL_ADDRESS (default: localhost on the dev Temporal port, 7233)",
|
|
1659
|
+
"name": "address",
|
|
1660
|
+
"hasDynamicHelp": false,
|
|
1661
|
+
"multiple": false,
|
|
1662
|
+
"type": "option"
|
|
1663
|
+
},
|
|
1664
|
+
"namespace": {
|
|
1665
|
+
"description": "Temporal namespace, overrides the profile and TEMPORAL_NAMESPACE (default: default)",
|
|
1666
|
+
"name": "namespace",
|
|
1623
1667
|
"hasDynamicHelp": false,
|
|
1624
1668
|
"multiple": false,
|
|
1625
1669
|
"type": "option"
|
|
@@ -1772,5 +1816,5 @@
|
|
|
1772
1816
|
]
|
|
1773
1817
|
}
|
|
1774
1818
|
},
|
|
1775
|
-
"version": "0.
|
|
1819
|
+
"version": "0.18.0"
|
|
1776
1820
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outputai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "CLI for Output.ai workflow generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"@inquirer/prompts": "8.7.2",
|
|
24
24
|
"@oclif/core": "4.10.6",
|
|
25
25
|
"@oclif/plugin-help": "6.2.45",
|
|
26
|
+
"@temporalio/client": "1.24.0",
|
|
27
|
+
"@temporalio/common": "1.24.0",
|
|
28
|
+
"@temporalio/envconfig": "1.24.0",
|
|
26
29
|
"change-case": "5.4.4",
|
|
27
30
|
"cli-progress": "3.12.0",
|
|
28
31
|
"cli-table3": "0.6.5",
|
|
@@ -37,7 +40,7 @@
|
|
|
37
40
|
"react": "19.3.0",
|
|
38
41
|
"semver": "7.8.5",
|
|
39
42
|
"undici": "8.12.3",
|
|
40
|
-
"@outputai/core": "0.
|
|
43
|
+
"@outputai/core": "0.18.0"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
46
|
"@types/cli-progress": "3.11.6",
|
|
@@ -49,6 +52,11 @@
|
|
|
49
52
|
"orval": "8.37.0"
|
|
50
53
|
},
|
|
51
54
|
"license": "Apache-2.0",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/growthxai/output",
|
|
58
|
+
"directory": "projects/cli"
|
|
59
|
+
},
|
|
52
60
|
"publishConfig": {
|
|
53
61
|
"access": "public"
|
|
54
62
|
},
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export interface ExtractedDataset {
|
|
2
|
-
input: Record<string, unknown>;
|
|
3
|
-
output: unknown;
|
|
4
|
-
executionTimeMs?: number;
|
|
5
|
-
}
|
|
6
|
-
interface TraceFile {
|
|
7
|
-
input?: unknown;
|
|
8
|
-
output?: unknown;
|
|
9
|
-
startedAt?: number;
|
|
10
|
-
endedAt?: number;
|
|
11
|
-
duration?: number;
|
|
12
|
-
root?: {
|
|
13
|
-
startTime?: number;
|
|
14
|
-
endTime?: number;
|
|
15
|
-
duration?: number;
|
|
16
|
-
};
|
|
17
|
-
events?: Array<{
|
|
18
|
-
phase: string;
|
|
19
|
-
details?: unknown;
|
|
20
|
-
}>;
|
|
21
|
-
children?: Array<{
|
|
22
|
-
input?: unknown;
|
|
23
|
-
output?: unknown;
|
|
24
|
-
}>;
|
|
25
|
-
}
|
|
26
|
-
export declare function extractDatasetFromTrace(traceData: TraceFile): ExtractedDataset;
|
|
27
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
function isRecord(value) {
|
|
2
|
-
return value !== null && value !== undefined && typeof value === 'object';
|
|
3
|
-
}
|
|
4
|
-
function unwrapOutput(output) {
|
|
5
|
-
if (isRecord(output) && 'output' in output && 'trace' in output) {
|
|
6
|
-
return output.output;
|
|
7
|
-
}
|
|
8
|
-
return output;
|
|
9
|
-
}
|
|
10
|
-
function findInput(trace) {
|
|
11
|
-
if (isRecord(trace.input)) {
|
|
12
|
-
return trace.input;
|
|
13
|
-
}
|
|
14
|
-
const startEvent = trace.events?.find(e => e.phase === 'start');
|
|
15
|
-
const eventInput = startEvent?.details?.input;
|
|
16
|
-
if (isRecord(eventInput)) {
|
|
17
|
-
return eventInput;
|
|
18
|
-
}
|
|
19
|
-
const childInput = trace.children?.[0]?.input;
|
|
20
|
-
return isRecord(childInput) ? childInput : undefined;
|
|
21
|
-
}
|
|
22
|
-
function findOutput(trace) {
|
|
23
|
-
if (trace.output !== undefined) {
|
|
24
|
-
return unwrapOutput(trace.output);
|
|
25
|
-
}
|
|
26
|
-
const endEvent = trace.events ?
|
|
27
|
-
[...trace.events].reverse().find(e => e.phase === 'end') :
|
|
28
|
-
undefined;
|
|
29
|
-
const eventOutput = endEvent?.details?.output;
|
|
30
|
-
if (eventOutput !== undefined) {
|
|
31
|
-
return unwrapOutput(eventOutput);
|
|
32
|
-
}
|
|
33
|
-
const childOutput = trace.children?.[0]?.output;
|
|
34
|
-
return childOutput !== undefined ? unwrapOutput(childOutput) : undefined;
|
|
35
|
-
}
|
|
36
|
-
function computeExecutionTime(trace) {
|
|
37
|
-
if (trace.startedAt && trace.endedAt) {
|
|
38
|
-
return trace.endedAt - trace.startedAt;
|
|
39
|
-
}
|
|
40
|
-
if (trace.root?.startTime && trace.root?.endTime) {
|
|
41
|
-
return trace.root.endTime - trace.root.startTime;
|
|
42
|
-
}
|
|
43
|
-
return trace.duration ?? trace.root?.duration ?? undefined;
|
|
44
|
-
}
|
|
45
|
-
export function extractDatasetFromTrace(traceData) {
|
|
46
|
-
const input = findInput(traceData);
|
|
47
|
-
if (!input) {
|
|
48
|
-
throw new Error('Could not extract input from trace data. Trace may be incomplete.');
|
|
49
|
-
}
|
|
50
|
-
const output = findOutput(traceData);
|
|
51
|
-
const executionTimeMs = computeExecutionTime(traceData);
|
|
52
|
-
return { input, output, executionTimeMs };
|
|
53
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { formatDuration } from '#utils/date_formatter.js';
|
|
2
|
-
export { formatDuration };
|
|
3
|
-
export declare function format(traceData: string | object, outputFormat?: 'json' | 'text'): string;
|
|
4
|
-
export declare function getSummary(traceData: string | object): {
|
|
5
|
-
totalDuration: number;
|
|
6
|
-
totalEvents: number;
|
|
7
|
-
totalSteps: number;
|
|
8
|
-
totalActivities: number;
|
|
9
|
-
hasErrors: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare function displayDebugTree(node: unknown): string;
|