@outputai/cli 0.1.1 → 0.1.2
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/package.json +7 -7
- package/dist/api/generated/api.d.ts +0 -820
- package/dist/api/generated/api.js +0 -226
- package/dist/api/http_client.d.ts +0 -27
- package/dist/api/http_client.js +0 -71
- package/dist/api/orval_post_process.d.ts +0 -11
- package/dist/api/orval_post_process.js +0 -46
- package/dist/api/parser.d.ts +0 -17
- package/dist/api/parser.js +0 -68
- package/dist/assets/config/costs.yml +0 -309
- package/dist/assets/docker/docker-compose-dev.yml +0 -146
- package/dist/commands/credentials/edit.d.ts +0 -10
- package/dist/commands/credentials/edit.js +0 -67
- package/dist/commands/credentials/edit.spec.d.ts +0 -1
- package/dist/commands/credentials/edit.spec.js +0 -73
- package/dist/commands/credentials/get.d.ts +0 -13
- package/dist/commands/credentials/get.js +0 -46
- package/dist/commands/credentials/get.spec.d.ts +0 -1
- package/dist/commands/credentials/get.spec.js +0 -74
- package/dist/commands/credentials/init.d.ts +0 -11
- package/dist/commands/credentials/init.js +0 -45
- package/dist/commands/credentials/init.spec.d.ts +0 -1
- package/dist/commands/credentials/init.spec.js +0 -68
- package/dist/commands/credentials/show.d.ts +0 -10
- package/dist/commands/credentials/show.js +0 -33
- package/dist/commands/credentials/show.spec.d.ts +0 -1
- package/dist/commands/credentials/show.spec.js +0 -57
- package/dist/commands/dev/eject.d.ts +0 -11
- package/dist/commands/dev/eject.js +0 -58
- package/dist/commands/dev/eject.spec.d.ts +0 -1
- package/dist/commands/dev/eject.spec.js +0 -109
- package/dist/commands/dev/index.d.ts +0 -14
- package/dist/commands/dev/index.js +0 -173
- package/dist/commands/dev/index.spec.d.ts +0 -1
- package/dist/commands/dev/index.spec.js +0 -239
- package/dist/commands/init.d.ts +0 -12
- package/dist/commands/init.js +0 -37
- package/dist/commands/init.spec.d.ts +0 -1
- package/dist/commands/init.spec.js +0 -100
- package/dist/commands/update.d.ts +0 -14
- package/dist/commands/update.js +0 -120
- package/dist/commands/update.spec.d.ts +0 -1
- package/dist/commands/update.spec.js +0 -178
- package/dist/commands/workflow/cost.d.ts +0 -16
- package/dist/commands/workflow/cost.js +0 -71
- package/dist/commands/workflow/cost.spec.d.ts +0 -1
- package/dist/commands/workflow/cost.spec.js +0 -47
- package/dist/commands/workflow/dataset/generate.d.ts +0 -22
- package/dist/commands/workflow/dataset/generate.js +0 -143
- package/dist/commands/workflow/dataset/list.d.ts +0 -12
- package/dist/commands/workflow/dataset/list.js +0 -87
- package/dist/commands/workflow/debug.d.ts +0 -16
- package/dist/commands/workflow/debug.js +0 -60
- package/dist/commands/workflow/debug.spec.d.ts +0 -1
- package/dist/commands/workflow/debug.spec.js +0 -34
- package/dist/commands/workflow/generate.d.ts +0 -17
- package/dist/commands/workflow/generate.js +0 -85
- package/dist/commands/workflow/generate.spec.d.ts +0 -1
- package/dist/commands/workflow/generate.spec.js +0 -115
- package/dist/commands/workflow/list.d.ts +0 -22
- package/dist/commands/workflow/list.js +0 -152
- package/dist/commands/workflow/list.spec.d.ts +0 -1
- package/dist/commands/workflow/list.spec.js +0 -99
- package/dist/commands/workflow/plan.d.ts +0 -12
- package/dist/commands/workflow/plan.js +0 -66
- package/dist/commands/workflow/plan.spec.d.ts +0 -1
- package/dist/commands/workflow/plan.spec.js +0 -341
- package/dist/commands/workflow/reset.d.ts +0 -14
- package/dist/commands/workflow/reset.js +0 -51
- package/dist/commands/workflow/result.d.ts +0 -13
- package/dist/commands/workflow/result.js +0 -46
- package/dist/commands/workflow/result.spec.d.ts +0 -1
- package/dist/commands/workflow/result.spec.js +0 -23
- package/dist/commands/workflow/run.d.ts +0 -16
- package/dist/commands/workflow/run.js +0 -97
- package/dist/commands/workflow/run.spec.d.ts +0 -1
- package/dist/commands/workflow/run.spec.js +0 -110
- package/dist/commands/workflow/runs/list.d.ts +0 -14
- package/dist/commands/workflow/runs/list.js +0 -104
- package/dist/commands/workflow/start.d.ts +0 -15
- package/dist/commands/workflow/start.js +0 -62
- package/dist/commands/workflow/start.spec.d.ts +0 -1
- package/dist/commands/workflow/start.spec.js +0 -28
- package/dist/commands/workflow/status.d.ts +0 -13
- package/dist/commands/workflow/status.js +0 -57
- package/dist/commands/workflow/status.spec.d.ts +0 -1
- package/dist/commands/workflow/status.spec.js +0 -33
- package/dist/commands/workflow/stop.d.ts +0 -10
- package/dist/commands/workflow/stop.js +0 -31
- package/dist/commands/workflow/stop.spec.d.ts +0 -1
- package/dist/commands/workflow/stop.spec.js +0 -17
- package/dist/commands/workflow/terminate.d.ts +0 -13
- package/dist/commands/workflow/terminate.js +0 -39
- package/dist/commands/workflow/test_eval.d.ts +0 -20
- package/dist/commands/workflow/test_eval.js +0 -151
- package/dist/config.d.ts +0 -47
- package/dist/config.js +0 -47
- package/dist/generated/framework_version.json +0 -3
- package/dist/hooks/init.d.ts +0 -3
- package/dist/hooks/init.js +0 -30
- package/dist/hooks/init.spec.d.ts +0 -1
- package/dist/hooks/init.spec.js +0 -54
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.spec.d.ts +0 -1
- package/dist/index.spec.js +0 -6
- package/dist/services/claude_client.d.ts +0 -30
- package/dist/services/claude_client.integration.test.d.ts +0 -1
- package/dist/services/claude_client.integration.test.js +0 -43
- package/dist/services/claude_client.js +0 -215
- package/dist/services/claude_client.spec.d.ts +0 -1
- package/dist/services/claude_client.spec.js +0 -145
- package/dist/services/coding_agents.d.ts +0 -36
- package/dist/services/coding_agents.js +0 -236
- package/dist/services/coding_agents.spec.d.ts +0 -1
- package/dist/services/coding_agents.spec.js +0 -256
- package/dist/services/copy_assets.spec.d.ts +0 -1
- package/dist/services/copy_assets.spec.js +0 -22
- package/dist/services/cost_calculator.d.ts +0 -18
- package/dist/services/cost_calculator.js +0 -359
- package/dist/services/cost_calculator.spec.d.ts +0 -1
- package/dist/services/cost_calculator.spec.js +0 -540
- package/dist/services/credentials_service.d.ts +0 -12
- package/dist/services/credentials_service.integration.test.d.ts +0 -1
- package/dist/services/credentials_service.integration.test.js +0 -66
- package/dist/services/credentials_service.js +0 -64
- package/dist/services/credentials_service.spec.d.ts +0 -1
- package/dist/services/credentials_service.spec.js +0 -106
- package/dist/services/datasets.d.ts +0 -20
- package/dist/services/datasets.js +0 -132
- package/dist/services/docker.d.ts +0 -39
- package/dist/services/docker.js +0 -160
- package/dist/services/docker.spec.d.ts +0 -1
- package/dist/services/docker.spec.js +0 -124
- package/dist/services/env_configurator.d.ts +0 -15
- package/dist/services/env_configurator.js +0 -163
- package/dist/services/env_configurator.spec.d.ts +0 -1
- package/dist/services/env_configurator.spec.js +0 -192
- package/dist/services/generate_plan_name@v1.prompt +0 -24
- package/dist/services/messages.d.ts +0 -9
- package/dist/services/messages.js +0 -338
- package/dist/services/messages.spec.d.ts +0 -1
- package/dist/services/messages.spec.js +0 -55
- package/dist/services/npm_update_service.d.ts +0 -6
- package/dist/services/npm_update_service.js +0 -87
- package/dist/services/npm_update_service.spec.d.ts +0 -1
- package/dist/services/npm_update_service.spec.js +0 -104
- package/dist/services/project_scaffold.d.ts +0 -31
- package/dist/services/project_scaffold.js +0 -212
- package/dist/services/project_scaffold.spec.d.ts +0 -1
- package/dist/services/project_scaffold.spec.js +0 -122
- package/dist/services/s3_trace_downloader.d.ts +0 -12
- package/dist/services/s3_trace_downloader.js +0 -57
- package/dist/services/template_processor.d.ts +0 -14
- package/dist/services/template_processor.js +0 -57
- package/dist/services/trace_reader.d.ts +0 -16
- package/dist/services/trace_reader.js +0 -57
- package/dist/services/trace_reader.spec.d.ts +0 -1
- package/dist/services/trace_reader.spec.js +0 -78
- package/dist/services/version_check.d.ts +0 -6
- package/dist/services/version_check.js +0 -52
- package/dist/services/version_check.spec.d.ts +0 -1
- package/dist/services/version_check.spec.js +0 -106
- package/dist/services/workflow_builder.d.ts +0 -16
- package/dist/services/workflow_builder.js +0 -86
- package/dist/services/workflow_builder.spec.d.ts +0 -1
- package/dist/services/workflow_builder.spec.js +0 -165
- package/dist/services/workflow_generator.d.ts +0 -5
- package/dist/services/workflow_generator.js +0 -40
- package/dist/services/workflow_generator.spec.d.ts +0 -1
- package/dist/services/workflow_generator.spec.js +0 -77
- package/dist/services/workflow_planner.d.ts +0 -15
- package/dist/services/workflow_planner.js +0 -48
- package/dist/services/workflow_planner.spec.d.ts +0 -1
- package/dist/services/workflow_planner.spec.js +0 -122
- package/dist/services/workflow_runs.d.ts +0 -14
- package/dist/services/workflow_runs.js +0 -25
- package/dist/templates/agent_instructions/CLAUDE.md.template +0 -19
- package/dist/templates/agent_instructions/dotclaude/settings.json.template +0 -29
- package/dist/templates/project/.env.example.template +0 -9
- package/dist/templates/project/.gitignore.template +0 -35
- package/dist/templates/project/README.md.template +0 -100
- package/dist/templates/project/config/costs.yml.template +0 -29
- package/dist/templates/project/package.json.template +0 -25
- package/dist/templates/project/src/clients/jina.ts.template +0 -30
- package/dist/templates/project/src/shared/utils/string.ts.template +0 -3
- package/dist/templates/project/src/shared/utils/url.ts.template +0 -15
- package/dist/templates/project/src/workflows/blog_evaluator/evaluators.ts.template +0 -23
- package/dist/templates/project/src/workflows/blog_evaluator/prompts/signal_noise@v1.prompt.template +0 -26
- package/dist/templates/project/src/workflows/blog_evaluator/scenarios/paulgraham_hwh.json.template +0 -3
- package/dist/templates/project/src/workflows/blog_evaluator/steps.ts.template +0 -27
- package/dist/templates/project/src/workflows/blog_evaluator/types.ts.template +0 -30
- package/dist/templates/project/src/workflows/blog_evaluator/utils.ts.template +0 -15
- package/dist/templates/project/src/workflows/blog_evaluator/workflow.ts.template +0 -27
- package/dist/templates/project/tsconfig.json.template +0 -20
- package/dist/templates/workflow/README.md.template +0 -216
- package/dist/templates/workflow/evaluators.ts.template +0 -21
- package/dist/templates/workflow/prompts/example@v1.prompt.template +0 -15
- package/dist/templates/workflow/scenarios/test_input.json.template +0 -3
- package/dist/templates/workflow/steps.ts.template +0 -20
- package/dist/templates/workflow/types.ts.template +0 -13
- package/dist/templates/workflow/workflow.ts.template +0 -23
- package/dist/test_helpers/mocks.d.ts +0 -38
- package/dist/test_helpers/mocks.js +0 -77
- package/dist/types/cost.d.ts +0 -149
- package/dist/types/cost.js +0 -6
- package/dist/types/domain.d.ts +0 -20
- package/dist/types/domain.js +0 -4
- package/dist/types/errors.d.ts +0 -68
- package/dist/types/errors.js +0 -100
- package/dist/types/errors.spec.d.ts +0 -1
- package/dist/types/errors.spec.js +0 -18
- package/dist/types/generator.d.ts +0 -26
- package/dist/types/generator.js +0 -1
- package/dist/types/trace.d.ts +0 -161
- package/dist/types/trace.js +0 -18
- package/dist/utils/claude.d.ts +0 -5
- package/dist/utils/claude.js +0 -19
- package/dist/utils/claude.spec.d.ts +0 -1
- package/dist/utils/claude.spec.js +0 -119
- package/dist/utils/constants.d.ts +0 -5
- package/dist/utils/constants.js +0 -4
- package/dist/utils/cost_formatter.d.ts +0 -5
- package/dist/utils/cost_formatter.js +0 -218
- package/dist/utils/date_formatter.d.ts +0 -23
- package/dist/utils/date_formatter.js +0 -49
- package/dist/utils/env_loader.d.ts +0 -1
- package/dist/utils/env_loader.js +0 -22
- package/dist/utils/env_loader.spec.d.ts +0 -1
- package/dist/utils/env_loader.spec.js +0 -43
- package/dist/utils/error_handler.d.ts +0 -8
- package/dist/utils/error_handler.js +0 -71
- package/dist/utils/error_utils.d.ts +0 -24
- package/dist/utils/error_utils.js +0 -87
- package/dist/utils/file_system.d.ts +0 -3
- package/dist/utils/file_system.js +0 -33
- package/dist/utils/format_workflow_result.d.ts +0 -5
- package/dist/utils/format_workflow_result.js +0 -18
- package/dist/utils/format_workflow_result.spec.d.ts +0 -1
- package/dist/utils/format_workflow_result.spec.js +0 -81
- package/dist/utils/framework_version.d.ts +0 -4
- package/dist/utils/framework_version.js +0 -4
- package/dist/utils/framework_version.spec.d.ts +0 -1
- package/dist/utils/framework_version.spec.js +0 -13
- package/dist/utils/header_utils.d.ts +0 -12
- package/dist/utils/header_utils.js +0 -29
- package/dist/utils/header_utils.spec.d.ts +0 -1
- package/dist/utils/header_utils.spec.js +0 -52
- package/dist/utils/input_parser.d.ts +0 -1
- package/dist/utils/input_parser.js +0 -19
- package/dist/utils/output_formatter.d.ts +0 -2
- package/dist/utils/output_formatter.js +0 -11
- package/dist/utils/paths.d.ts +0 -25
- package/dist/utils/paths.js +0 -36
- package/dist/utils/process.d.ts +0 -4
- package/dist/utils/process.js +0 -50
- package/dist/utils/resolve_input.d.ts +0 -1
- package/dist/utils/resolve_input.js +0 -22
- package/dist/utils/scenario_resolver.d.ts +0 -9
- package/dist/utils/scenario_resolver.js +0 -93
- package/dist/utils/scenario_resolver.spec.d.ts +0 -1
- package/dist/utils/scenario_resolver.spec.js +0 -214
- package/dist/utils/secret_sanitizer.d.ts +0 -1
- package/dist/utils/secret_sanitizer.js +0 -29
- package/dist/utils/sleep.d.ts +0 -5
- package/dist/utils/sleep.js +0 -5
- package/dist/utils/template.d.ts +0 -9
- package/dist/utils/template.js +0 -30
- package/dist/utils/template.spec.d.ts +0 -1
- package/dist/utils/template.spec.js +0 -77
- 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 -402
- package/dist/utils/validation.d.ts +0 -13
- package/dist/utils/validation.js +0 -25
- package/dist/utils/validation.spec.d.ts +0 -1
- package/dist/utils/validation.spec.js +0 -140
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import Table from 'cli-table3';
|
|
2
|
-
function formatNumber(num) {
|
|
3
|
-
return num.toLocaleString('en-US');
|
|
4
|
-
}
|
|
5
|
-
function roundGaussian(n, d = 2) {
|
|
6
|
-
if (!isFinite(n)) {
|
|
7
|
-
return NaN;
|
|
8
|
-
}
|
|
9
|
-
const m = Math.pow(10, d);
|
|
10
|
-
const num = +(n * m).toFixed(8);
|
|
11
|
-
const i = Math.floor(num);
|
|
12
|
-
const f = num - i;
|
|
13
|
-
const e = 1e-8;
|
|
14
|
-
const isHalf = f > 0.5 - e && f < 0.5 + e;
|
|
15
|
-
const evenRound = i % 2 === 0 ? i : i + 1;
|
|
16
|
-
const r = isHalf ? evenRound : Math.round(num);
|
|
17
|
-
return r / m;
|
|
18
|
-
}
|
|
19
|
-
function formatCurrency(amount) {
|
|
20
|
-
if (amount < 0.01) {
|
|
21
|
-
return `$${roundGaussian(amount, 4).toFixed(4)}`;
|
|
22
|
-
}
|
|
23
|
-
return `$${roundGaussian(amount, 2).toFixed(2)}`;
|
|
24
|
-
}
|
|
25
|
-
function pluralize(count, singular) {
|
|
26
|
-
return count === 1 ? `1 ${singular}` : `${count} ${singular}s`;
|
|
27
|
-
}
|
|
28
|
-
export function parseCostData(report) {
|
|
29
|
-
const byModel = {};
|
|
30
|
-
for (const r of report.llmCalls) {
|
|
31
|
-
if (!byModel[r.model]) {
|
|
32
|
-
byModel[r.model] = { count: 0, cost: 0 };
|
|
33
|
-
}
|
|
34
|
-
byModel[r.model].count++;
|
|
35
|
-
byModel[r.model].cost += r.cost;
|
|
36
|
-
}
|
|
37
|
-
const llmModels = Object.entries(byModel)
|
|
38
|
-
.sort((a, b) => b[1].cost - a[1].cost)
|
|
39
|
-
.map(([model, stats]) => ({ model, count: stats.count, cost: stats.cost }));
|
|
40
|
-
const services = [...report.services]
|
|
41
|
-
.sort((a, b) => b.totalCost - a.totalCost)
|
|
42
|
-
.map(s => ({ serviceName: s.serviceName, callCount: s.calls.length, cost: s.totalCost }));
|
|
43
|
-
const serviceTotalCalls = services.reduce((sum, s) => sum + s.callCount, 0);
|
|
44
|
-
return {
|
|
45
|
-
traceFile: report.traceFile,
|
|
46
|
-
workflowName: report.workflowName,
|
|
47
|
-
duration: report.durationMs ? `${(report.durationMs / 1000).toFixed(1)}s` : 'N/A',
|
|
48
|
-
llmModels,
|
|
49
|
-
llmTotalCalls: report.llmCalls.length,
|
|
50
|
-
llmTotalCost: report.llmTotalCost,
|
|
51
|
-
services,
|
|
52
|
-
serviceTotalCalls,
|
|
53
|
-
serviceTotalCost: report.serviceTotalCost,
|
|
54
|
-
verbose: {
|
|
55
|
-
hasReasoning: report.totalReasoningTokens > 0,
|
|
56
|
-
hasCached: report.totalCachedTokens > 0
|
|
57
|
-
},
|
|
58
|
-
llmCalls: report.llmCalls,
|
|
59
|
-
serviceDetails: report.services,
|
|
60
|
-
totalInputTokens: report.totalInputTokens,
|
|
61
|
-
totalOutputTokens: report.totalOutputTokens,
|
|
62
|
-
totalCachedTokens: report.totalCachedTokens,
|
|
63
|
-
totalReasoningTokens: report.totalReasoningTokens,
|
|
64
|
-
totalCost: report.totalCost,
|
|
65
|
-
unknownModels: report.unknownModels,
|
|
66
|
-
isEmpty: report.llmCalls.length === 0 && report.services.length === 0
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function formatSummary(data) {
|
|
70
|
-
const lines = [];
|
|
71
|
-
if (data.llmModels.length > 0) {
|
|
72
|
-
const table = new Table({
|
|
73
|
-
head: ['Model', 'Calls', 'Cost'],
|
|
74
|
-
style: { head: ['cyan'] },
|
|
75
|
-
colAligns: ['left', 'right', 'right']
|
|
76
|
-
});
|
|
77
|
-
for (const m of data.llmModels) {
|
|
78
|
-
table.push([m.model, pluralize(m.count, 'call'), formatCurrency(m.cost)]);
|
|
79
|
-
}
|
|
80
|
-
table.push([
|
|
81
|
-
'Subtotal',
|
|
82
|
-
pluralize(data.llmTotalCalls, 'call'),
|
|
83
|
-
formatCurrency(data.llmTotalCost)
|
|
84
|
-
]);
|
|
85
|
-
lines.push('LLM Costs:');
|
|
86
|
-
lines.push(table.toString());
|
|
87
|
-
lines.push('');
|
|
88
|
-
}
|
|
89
|
-
if (data.services.length > 0) {
|
|
90
|
-
const table = new Table({
|
|
91
|
-
head: ['Service', 'Calls', 'Cost'],
|
|
92
|
-
style: { head: ['cyan'] },
|
|
93
|
-
colAligns: ['left', 'right', 'right']
|
|
94
|
-
});
|
|
95
|
-
for (const s of data.services) {
|
|
96
|
-
table.push([s.serviceName, pluralize(s.callCount, 'call'), formatCurrency(s.cost)]);
|
|
97
|
-
}
|
|
98
|
-
table.push([
|
|
99
|
-
'Subtotal',
|
|
100
|
-
pluralize(data.serviceTotalCalls, 'call'),
|
|
101
|
-
formatCurrency(data.serviceTotalCost)
|
|
102
|
-
]);
|
|
103
|
-
lines.push('API Costs:');
|
|
104
|
-
lines.push(table.toString());
|
|
105
|
-
lines.push('');
|
|
106
|
-
}
|
|
107
|
-
return lines.join('\n');
|
|
108
|
-
}
|
|
109
|
-
function formatVerbose(data) {
|
|
110
|
-
const lines = [];
|
|
111
|
-
if (data.llmCalls.length > 0) {
|
|
112
|
-
const head = ['Step', 'Model', 'Input', 'Output'];
|
|
113
|
-
const colAligns = ['left', 'left', 'right', 'right'];
|
|
114
|
-
if (data.verbose.hasCached) {
|
|
115
|
-
head.push('Cached');
|
|
116
|
-
colAligns.push('right');
|
|
117
|
-
}
|
|
118
|
-
if (data.verbose.hasReasoning) {
|
|
119
|
-
head.push('Reasoning');
|
|
120
|
-
colAligns.push('right');
|
|
121
|
-
}
|
|
122
|
-
head.push('Cost');
|
|
123
|
-
colAligns.push('right');
|
|
124
|
-
const table = new Table({
|
|
125
|
-
head,
|
|
126
|
-
style: { head: ['cyan'] },
|
|
127
|
-
colAligns
|
|
128
|
-
});
|
|
129
|
-
for (const r of data.llmCalls) {
|
|
130
|
-
const row = [
|
|
131
|
-
r.step,
|
|
132
|
-
r.model,
|
|
133
|
-
formatNumber(r.input),
|
|
134
|
-
formatNumber(r.output)
|
|
135
|
-
];
|
|
136
|
-
if (data.verbose.hasCached) {
|
|
137
|
-
row.push(formatNumber(r.cached));
|
|
138
|
-
}
|
|
139
|
-
if (data.verbose.hasReasoning) {
|
|
140
|
-
row.push(formatNumber(r.reasoning));
|
|
141
|
-
}
|
|
142
|
-
row.push(formatCurrency(r.cost) + (r.warning ? ` (${r.warning})` : ''));
|
|
143
|
-
table.push(row);
|
|
144
|
-
}
|
|
145
|
-
const totalRow = [
|
|
146
|
-
'Subtotal',
|
|
147
|
-
'',
|
|
148
|
-
formatNumber(data.totalInputTokens),
|
|
149
|
-
formatNumber(data.totalOutputTokens)
|
|
150
|
-
];
|
|
151
|
-
if (data.verbose.hasCached) {
|
|
152
|
-
totalRow.push(formatNumber(data.totalCachedTokens));
|
|
153
|
-
}
|
|
154
|
-
if (data.verbose.hasReasoning) {
|
|
155
|
-
totalRow.push(formatNumber(data.totalReasoningTokens));
|
|
156
|
-
}
|
|
157
|
-
totalRow.push(formatCurrency(data.llmTotalCost));
|
|
158
|
-
table.push(totalRow);
|
|
159
|
-
lines.push('LLM Calls:');
|
|
160
|
-
lines.push(table.toString());
|
|
161
|
-
lines.push('');
|
|
162
|
-
}
|
|
163
|
-
if (data.serviceDetails.length > 0) {
|
|
164
|
-
const table = new Table({
|
|
165
|
-
head: ['Service', 'Step', 'Usage', 'Cost'],
|
|
166
|
-
style: { head: ['cyan'] },
|
|
167
|
-
colAligns: ['left', 'left', 'right', 'right']
|
|
168
|
-
});
|
|
169
|
-
for (const service of data.serviceDetails) {
|
|
170
|
-
for (const call of service.calls) {
|
|
171
|
-
table.push([
|
|
172
|
-
service.serviceName,
|
|
173
|
-
call.step,
|
|
174
|
-
call.usage,
|
|
175
|
-
formatCurrency(call.cost)
|
|
176
|
-
]);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
table.push(['Subtotal', '', '', formatCurrency(data.serviceTotalCost)]);
|
|
180
|
-
lines.push('API Calls:');
|
|
181
|
-
lines.push(table.toString());
|
|
182
|
-
lines.push('');
|
|
183
|
-
}
|
|
184
|
-
return lines.join('\n');
|
|
185
|
-
}
|
|
186
|
-
export function formatCostReport(report, options = {}) {
|
|
187
|
-
const data = parseCostData(report);
|
|
188
|
-
const lines = [];
|
|
189
|
-
lines.push('');
|
|
190
|
-
lines.push(`Trace: ${data.traceFile}`);
|
|
191
|
-
lines.push(`Workflow: ${data.workflowName}`);
|
|
192
|
-
lines.push(`Duration: ${data.duration}`);
|
|
193
|
-
lines.push('');
|
|
194
|
-
if (options.verbose) {
|
|
195
|
-
lines.push(formatVerbose(data));
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
lines.push(formatSummary(data));
|
|
199
|
-
}
|
|
200
|
-
if (!data.isEmpty) {
|
|
201
|
-
const totalTable = new Table({
|
|
202
|
-
style: { head: [] },
|
|
203
|
-
colAligns: ['left', 'right'],
|
|
204
|
-
colWidths: [36, 12]
|
|
205
|
-
});
|
|
206
|
-
totalTable.push(['TOTAL ESTIMATED COST', formatCurrency(data.totalCost)]);
|
|
207
|
-
lines.push(totalTable.toString());
|
|
208
|
-
}
|
|
209
|
-
if (data.unknownModels.length > 0) {
|
|
210
|
-
lines.push('');
|
|
211
|
-
lines.push(`Warning: Unknown models (add to config/costs.yml): ${data.unknownModels.join(', ')}`);
|
|
212
|
-
}
|
|
213
|
-
if (data.isEmpty) {
|
|
214
|
-
lines.push('No billable calls found in trace.');
|
|
215
|
-
}
|
|
216
|
-
lines.push('');
|
|
217
|
-
return lines.join('\n');
|
|
218
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format a duration in milliseconds to a human-readable string.
|
|
3
|
-
* Uses date-fns for durations >= 1 minute, custom formatting for shorter durations.
|
|
4
|
-
*
|
|
5
|
-
* @param ms - Duration in milliseconds
|
|
6
|
-
* @returns Formatted duration string (e.g., "150ms", "2.50s", "3 minutes 45 seconds")
|
|
7
|
-
*/
|
|
8
|
-
export declare function formatDuration(ms: number): string;
|
|
9
|
-
/**
|
|
10
|
-
* Format an ISO date string to a human-readable format
|
|
11
|
-
*
|
|
12
|
-
* @param isoString - ISO 8601 date string
|
|
13
|
-
* @returns Formatted date string (e.g., "Dec 3, 2025 10:30 AM")
|
|
14
|
-
*/
|
|
15
|
-
export declare function formatDate(isoString: string | null | undefined): string;
|
|
16
|
-
/**
|
|
17
|
-
* Format a duration between two ISO timestamps
|
|
18
|
-
*
|
|
19
|
-
* @param startedAt - ISO 8601 start timestamp
|
|
20
|
-
* @param completedAt - ISO 8601 end timestamp (or null if still running)
|
|
21
|
-
* @returns Human-readable duration string (e.g., "5 seconds", "running")
|
|
22
|
-
*/
|
|
23
|
-
export declare function formatDurationFromTimestamps(startedAt: string, completedAt: string | null | undefined): string;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Date and duration formatting utilities
|
|
3
|
-
*/
|
|
4
|
-
import { format, formatDistanceStrict, formatDuration as formatDurationFns, intervalToDuration, parseISO } from 'date-fns';
|
|
5
|
-
/**
|
|
6
|
-
* Format a duration in milliseconds to a human-readable string.
|
|
7
|
-
* Uses date-fns for durations >= 1 minute, custom formatting for shorter durations.
|
|
8
|
-
*
|
|
9
|
-
* @param ms - Duration in milliseconds
|
|
10
|
-
* @returns Formatted duration string (e.g., "150ms", "2.50s", "3 minutes 45 seconds")
|
|
11
|
-
*/
|
|
12
|
-
export function formatDuration(ms) {
|
|
13
|
-
const duration = intervalToDuration({ start: 0, end: ms });
|
|
14
|
-
if (ms < 1000) {
|
|
15
|
-
return `${ms}ms`;
|
|
16
|
-
}
|
|
17
|
-
if (ms < 60000) {
|
|
18
|
-
const seconds = ms / 1000;
|
|
19
|
-
return `${seconds.toFixed(2)}s`;
|
|
20
|
-
}
|
|
21
|
-
return formatDurationFns(duration, { format: ['minutes', 'seconds'] });
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Format an ISO date string to a human-readable format
|
|
25
|
-
*
|
|
26
|
-
* @param isoString - ISO 8601 date string
|
|
27
|
-
* @returns Formatted date string (e.g., "Dec 3, 2025 10:30 AM")
|
|
28
|
-
*/
|
|
29
|
-
export function formatDate(isoString) {
|
|
30
|
-
if (!isoString) {
|
|
31
|
-
return '-';
|
|
32
|
-
}
|
|
33
|
-
return format(parseISO(isoString), 'MMM d, yyyy h:mm a');
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Format a duration between two ISO timestamps
|
|
37
|
-
*
|
|
38
|
-
* @param startedAt - ISO 8601 start timestamp
|
|
39
|
-
* @param completedAt - ISO 8601 end timestamp (or null if still running)
|
|
40
|
-
* @returns Human-readable duration string (e.g., "5 seconds", "running")
|
|
41
|
-
*/
|
|
42
|
-
export function formatDurationFromTimestamps(startedAt, completedAt) {
|
|
43
|
-
if (!completedAt) {
|
|
44
|
-
return 'running';
|
|
45
|
-
}
|
|
46
|
-
const start = parseISO(startedAt);
|
|
47
|
-
const end = parseISO(completedAt);
|
|
48
|
-
return formatDistanceStrict(start, end, { addSuffix: false });
|
|
49
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function loadEnvironment(): void;
|
package/dist/utils/env_loader.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment loader utility
|
|
3
|
-
* Loads .env file from the current working directory
|
|
4
|
-
* Set OUTPUT_CLI_ENV to specify a custom env file path
|
|
5
|
-
*/
|
|
6
|
-
import { existsSync } from 'node:fs';
|
|
7
|
-
import { resolve } from 'node:path';
|
|
8
|
-
import * as dotenv from 'dotenv';
|
|
9
|
-
import debugFactory from 'debug';
|
|
10
|
-
import { config } from '#config.js';
|
|
11
|
-
const debug = debugFactory('output-cli:env-loader');
|
|
12
|
-
export function loadEnvironment() {
|
|
13
|
-
const cwd = process.cwd();
|
|
14
|
-
const envFile = config.envFile;
|
|
15
|
-
const envPath = resolve(cwd, envFile);
|
|
16
|
-
if (!existsSync(envPath)) {
|
|
17
|
-
debug(`Warning: Env file not found: ${envPath}`);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
debug(`Loading env from: ${envPath}`);
|
|
21
|
-
dotenv.config({ path: envPath, quiet: true });
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for the env loader utility
|
|
3
|
-
*/
|
|
4
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
5
|
-
import { existsSync } from 'node:fs';
|
|
6
|
-
import { resolve } from 'node:path';
|
|
7
|
-
import * as dotenv from 'dotenv';
|
|
8
|
-
vi.mock('node:fs');
|
|
9
|
-
vi.mock('dotenv');
|
|
10
|
-
describe('loadEnvironment', () => {
|
|
11
|
-
const originalEnv = { ...process.env };
|
|
12
|
-
const mockCwd = '/mock/project';
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
vi.resetModules();
|
|
15
|
-
vi.clearAllMocks();
|
|
16
|
-
vi.spyOn(process, 'cwd').mockReturnValue(mockCwd);
|
|
17
|
-
vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
18
|
-
vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
19
|
-
});
|
|
20
|
-
afterEach(() => {
|
|
21
|
-
process.env = { ...originalEnv };
|
|
22
|
-
vi.restoreAllMocks();
|
|
23
|
-
});
|
|
24
|
-
it('should load from OUTPUT_CLI_ENV when set and file exists', async () => {
|
|
25
|
-
process.env.OUTPUT_CLI_ENV = '.env.prod';
|
|
26
|
-
const expectedPath = resolve(mockCwd, '.env.prod');
|
|
27
|
-
vi.mocked(existsSync).mockReturnValue(true);
|
|
28
|
-
vi.mocked(dotenv.config).mockReturnValue({ parsed: { OUTPUT_API_URL: 'https://prod.api.com' } });
|
|
29
|
-
const { loadEnvironment } = await import('./env_loader.js');
|
|
30
|
-
loadEnvironment();
|
|
31
|
-
expect(dotenv.config).toHaveBeenCalledWith({ path: expectedPath, quiet: true });
|
|
32
|
-
});
|
|
33
|
-
it('should load .env by default and log', async () => {
|
|
34
|
-
delete process.env.OUTPUT_CLI_ENV;
|
|
35
|
-
const envPath = resolve(mockCwd, '.env');
|
|
36
|
-
vi.mocked(existsSync).mockImplementation(p => p === envPath);
|
|
37
|
-
vi.mocked(dotenv.config).mockReturnValue({ parsed: {} });
|
|
38
|
-
const { loadEnvironment } = await import('./env_loader.js');
|
|
39
|
-
loadEnvironment();
|
|
40
|
-
expect(dotenv.config).toHaveBeenCalledTimes(1);
|
|
41
|
-
expect(dotenv.config).toHaveBeenCalledWith({ path: envPath, quiet: true });
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type ErrorOverrides = {
|
|
2
|
-
[statusCode: number]: string;
|
|
3
|
-
ECONNREFUSED?: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function handleApiError(error: unknown, errorFn: (...args: [message: string, options: {
|
|
6
|
-
exit: number;
|
|
7
|
-
}]) => never, overrides?: ErrorOverrides): never;
|
|
8
|
-
export {};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { config } from '#config.js';
|
|
2
|
-
const DEFAULT_MESSAGES = {
|
|
3
|
-
ECONNREFUSED: `Connection refused to ${config.apiUrl}. Is the API server running?`,
|
|
4
|
-
401: 'Authentication failed. Check your OUTPUT_API_AUTH_TOKEN.',
|
|
5
|
-
404: 'Resource not found.',
|
|
6
|
-
500: 'Server error.',
|
|
7
|
-
UNKNOWN: 'An unknown error occurred.'
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Extract error type and message from API response data
|
|
11
|
-
*/
|
|
12
|
-
function extractApiErrorDetails(data) {
|
|
13
|
-
const errorData = data;
|
|
14
|
-
if (!errorData?.error && !errorData?.message) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const errorType = errorData.error || 'Error';
|
|
18
|
-
const baseMsg = errorData.message || 'Unknown error';
|
|
19
|
-
const rootCauseLine = errorData.rootCause ?
|
|
20
|
-
`\n${errorData.rootCause.error}: ${errorData.rootCause.message}` :
|
|
21
|
-
'';
|
|
22
|
-
return { errorType, errorMsg: `${baseMsg}.${rootCauseLine}` };
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Extract detailed error information from fetch errors and their causes
|
|
26
|
-
*/
|
|
27
|
-
function getDetailedErrorMessage(error) {
|
|
28
|
-
const apiError = error;
|
|
29
|
-
const parts = [];
|
|
30
|
-
if (apiError.message) {
|
|
31
|
-
parts.push(apiError.message);
|
|
32
|
-
}
|
|
33
|
-
if (apiError.cause) {
|
|
34
|
-
const cause = apiError.cause;
|
|
35
|
-
if (cause.message && cause.message !== apiError.message) {
|
|
36
|
-
parts.push(`Cause: ${cause.message}`);
|
|
37
|
-
}
|
|
38
|
-
if (cause.code) {
|
|
39
|
-
parts.push(`Code: ${cause.code}`);
|
|
40
|
-
}
|
|
41
|
-
if (cause.hostname) {
|
|
42
|
-
parts.push(`Host: ${cause.hostname}${cause.port ? ':' + cause.port : ''}`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (apiError.response?.status) {
|
|
46
|
-
parts.push(`HTTP Status: ${apiError.response.status}`);
|
|
47
|
-
}
|
|
48
|
-
return parts.length > 0 ? parts.join(' | ') : 'Unknown error';
|
|
49
|
-
}
|
|
50
|
-
export function handleApiError(error, errorFn, overrides = {}) {
|
|
51
|
-
const apiError = error;
|
|
52
|
-
const errorMessages = { ...DEFAULT_MESSAGES, ...overrides };
|
|
53
|
-
if (apiError.code === 'ECONNREFUSED' || apiError.cause?.code === 'ECONNREFUSED') {
|
|
54
|
-
errorFn(errorMessages.ECONNREFUSED, { exit: 1 });
|
|
55
|
-
}
|
|
56
|
-
if (apiError.response?.status) {
|
|
57
|
-
const status = apiError.response.status;
|
|
58
|
-
// Extract error details from response body
|
|
59
|
-
const apiErrorDetails = extractApiErrorDetails(apiError.response.data);
|
|
60
|
-
if (apiErrorDetails) {
|
|
61
|
-
const { errorType, errorMsg } = apiErrorDetails;
|
|
62
|
-
errorFn(`${errorType}: ${errorMsg}`, { exit: 1 });
|
|
63
|
-
}
|
|
64
|
-
const message = errorMessages[status];
|
|
65
|
-
if (message) {
|
|
66
|
-
errorFn(message, { exit: 1 });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const detailedMessage = getDetailedErrorMessage(error);
|
|
70
|
-
errorFn(detailedMessage, { exit: 1 });
|
|
71
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type guard to check if an unknown value is an Error object
|
|
3
|
-
*/
|
|
4
|
-
export declare function isError(error: unknown): error is Error;
|
|
5
|
-
/**
|
|
6
|
-
* Type guard to check if an error is a Node.js system error
|
|
7
|
-
*/
|
|
8
|
-
export declare function isNodeError(error: unknown): error is NodeJS.ErrnoException;
|
|
9
|
-
/**
|
|
10
|
-
* Safely extract an error message from an unknown error type
|
|
11
|
-
*/
|
|
12
|
-
export declare function getErrorMessage(error: unknown): string;
|
|
13
|
-
/**
|
|
14
|
-
* Safely extract an error code from a Node.js error
|
|
15
|
-
*/
|
|
16
|
-
export declare function getErrorCode(error: unknown): string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Convert an unknown error to a proper Error object
|
|
19
|
-
*/
|
|
20
|
-
export declare function toError(error: unknown): Error;
|
|
21
|
-
/**
|
|
22
|
-
* Create a formatted error message with optional context
|
|
23
|
-
*/
|
|
24
|
-
export declare function formatError(error: unknown, context?: string): string;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type guard to check if an unknown value is an Error object
|
|
3
|
-
*/
|
|
4
|
-
export function isError(error) {
|
|
5
|
-
return (error instanceof Error ||
|
|
6
|
-
(typeof error === 'object' &&
|
|
7
|
-
error !== null &&
|
|
8
|
-
'message' in error &&
|
|
9
|
-
typeof error.message === 'string'));
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Type guard to check if an error is a Node.js system error
|
|
13
|
-
*/
|
|
14
|
-
export function isNodeError(error) {
|
|
15
|
-
return isError(error) && 'code' in error;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Safely extract an error message from an unknown error type
|
|
19
|
-
*/
|
|
20
|
-
export function getErrorMessage(error) {
|
|
21
|
-
if (isError(error)) {
|
|
22
|
-
return error.message;
|
|
23
|
-
}
|
|
24
|
-
if (typeof error === 'string') {
|
|
25
|
-
return error;
|
|
26
|
-
}
|
|
27
|
-
// Handle objects with a code property (like Node.js errors)
|
|
28
|
-
if (error && typeof error === 'object' && 'code' in error) {
|
|
29
|
-
const errorObj = error;
|
|
30
|
-
if (errorObj.message) {
|
|
31
|
-
return errorObj.message;
|
|
32
|
-
}
|
|
33
|
-
if (errorObj.code) {
|
|
34
|
-
return `Error: ${errorObj.code}`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// Handle objects with a custom toString
|
|
38
|
-
if (error && typeof error === 'object' && 'toString' in error) {
|
|
39
|
-
const str = String(error);
|
|
40
|
-
// Avoid returning '[object Object]'
|
|
41
|
-
if (str !== '[object Object]') {
|
|
42
|
-
return str;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// Try to extract any useful information from the object
|
|
46
|
-
if (error && typeof error === 'object') {
|
|
47
|
-
try {
|
|
48
|
-
const json = JSON.stringify(error);
|
|
49
|
-
if (json && json !== '{}') {
|
|
50
|
-
return `Error: ${json}`;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
// Ignore circular reference errors
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return 'An unknown error occurred';
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Safely extract an error code from a Node.js error
|
|
61
|
-
*/
|
|
62
|
-
export function getErrorCode(error) {
|
|
63
|
-
// Check if it's a proper Node.js error with a code
|
|
64
|
-
if (isNodeError(error)) {
|
|
65
|
-
return error.code;
|
|
66
|
-
}
|
|
67
|
-
// Also handle plain objects with a code property (like mocked errors in tests)
|
|
68
|
-
return error && typeof error === 'object' && 'code' in error ?
|
|
69
|
-
error.code :
|
|
70
|
-
undefined;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Convert an unknown error to a proper Error object
|
|
74
|
-
*/
|
|
75
|
-
export function toError(error) {
|
|
76
|
-
if (isError(error)) {
|
|
77
|
-
return error;
|
|
78
|
-
}
|
|
79
|
-
return new Error(getErrorMessage(error));
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Create a formatted error message with optional context
|
|
83
|
-
*/
|
|
84
|
-
export function formatError(error, context) {
|
|
85
|
-
const message = getErrorMessage(error);
|
|
86
|
-
return context ? `${context}: ${message}` : message;
|
|
87
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { FolderAlreadyExistsError } from '#types/errors.js';
|
|
3
|
-
import { getErrorCode, getErrorMessage } from './error_utils.js';
|
|
4
|
-
export function directoryExists(dirPath) {
|
|
5
|
-
try {
|
|
6
|
-
fs.accessSync(dirPath);
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
catch (error) {
|
|
10
|
-
if (getErrorCode(error) === 'ENOENT') {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
throw error;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export function createDirectory(dirPath) {
|
|
17
|
-
const exists = directoryExists(dirPath);
|
|
18
|
-
if (exists) {
|
|
19
|
-
throw new FolderAlreadyExistsError(dirPath);
|
|
20
|
-
}
|
|
21
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
22
|
-
}
|
|
23
|
-
export function removeDirectory(dirPath, onError) {
|
|
24
|
-
try {
|
|
25
|
-
fs.rmSync(dirPath, { recursive: true, force: true });
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
const message = getErrorMessage(error);
|
|
29
|
-
if (onError) {
|
|
30
|
-
onError(`Failed to cleanup folder: ${message}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { GetWorkflowIdResult200, GetWorkflowIdResult200Status } from '../api/generated/api.js';
|
|
2
|
-
type WorkflowResult = Pick<GetWorkflowIdResult200, 'workflowId' | 'output' | 'status' | 'error'>;
|
|
3
|
-
export declare const ERROR_STATUSES: ReadonlySet<GetWorkflowIdResult200Status | undefined>;
|
|
4
|
-
export declare function formatWorkflowResult(result: WorkflowResult): string;
|
|
5
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const ERROR_STATUSES = new Set(['failed', 'canceled', 'terminated', 'timed_out']);
|
|
2
|
-
export function formatWorkflowResult(result) {
|
|
3
|
-
const lines = [
|
|
4
|
-
`Workflow ID: ${result.workflowId || 'unknown'}`,
|
|
5
|
-
''
|
|
6
|
-
];
|
|
7
|
-
if (result.status === 'completed') {
|
|
8
|
-
lines.push('Output:');
|
|
9
|
-
lines.push(JSON.stringify(result.output, null, 2));
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
lines.push(`Status: ${result.status || 'unknown'}`);
|
|
13
|
-
if (result.error) {
|
|
14
|
-
lines.push(`Error: ${result.error}`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return lines.join('\n');
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|