@output.ai/cli 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.
package/README.md
CHANGED
|
@@ -54,6 +54,7 @@ OUTPUT_CLI_ENV=/etc/output/production.env npx output workflow status wf-123
|
|
|
54
54
|
| `output workflow status` | Get workflow execution status |
|
|
55
55
|
| `output workflow result` | Get workflow execution result |
|
|
56
56
|
| `output workflow stop` | Stop a workflow execution |
|
|
57
|
+
| `output workflow terminate` | Terminate a workflow execution (force stop) |
|
|
57
58
|
| `output workflow debug` | Display workflow execution trace |
|
|
58
59
|
|
|
59
60
|
## Development Services
|
|
@@ -198,6 +198,10 @@ export type GetWorkflowIdStatus200 = {
|
|
|
198
198
|
/** An epoch timestamp representing when the workflow ended */
|
|
199
199
|
completedAt?: number;
|
|
200
200
|
};
|
|
201
|
+
export type PostWorkflowIdTerminateBody = {
|
|
202
|
+
/** Optional reason for termination */
|
|
203
|
+
reason?: string;
|
|
204
|
+
};
|
|
201
205
|
export type GetWorkflowIdResult200 = {
|
|
202
206
|
/** The workflow execution id */
|
|
203
207
|
workflowId?: string;
|
|
@@ -316,6 +320,27 @@ export type patchWorkflowIdStopResponseError = (patchWorkflowIdStopResponse404)
|
|
|
316
320
|
export type patchWorkflowIdStopResponse = (patchWorkflowIdStopResponseSuccess | patchWorkflowIdStopResponseError);
|
|
317
321
|
export declare const getPatchWorkflowIdStopUrl: (id: string) => string;
|
|
318
322
|
export declare const patchWorkflowIdStop: (id: string, options?: ApiRequestOptions) => Promise<patchWorkflowIdStopResponse>;
|
|
323
|
+
/**
|
|
324
|
+
* Force terminates a workflow. Unlike stop/cancel, terminate immediately stops the workflow without allowing cleanup.
|
|
325
|
+
* @summary Terminate a workflow execution (force stop)
|
|
326
|
+
*/
|
|
327
|
+
export type postWorkflowIdTerminateResponse200 = {
|
|
328
|
+
data: void;
|
|
329
|
+
status: 200;
|
|
330
|
+
};
|
|
331
|
+
export type postWorkflowIdTerminateResponse404 = {
|
|
332
|
+
data: void;
|
|
333
|
+
status: 404;
|
|
334
|
+
};
|
|
335
|
+
export type postWorkflowIdTerminateResponseSuccess = (postWorkflowIdTerminateResponse200) & {
|
|
336
|
+
headers: Headers;
|
|
337
|
+
};
|
|
338
|
+
export type postWorkflowIdTerminateResponseError = (postWorkflowIdTerminateResponse404) & {
|
|
339
|
+
headers: Headers;
|
|
340
|
+
};
|
|
341
|
+
export type postWorkflowIdTerminateResponse = (postWorkflowIdTerminateResponseSuccess | postWorkflowIdTerminateResponseError);
|
|
342
|
+
export declare const getPostWorkflowIdTerminateUrl: (id: string) => string;
|
|
343
|
+
export declare const postWorkflowIdTerminate: (id: string, postWorkflowIdTerminateBody: PostWorkflowIdTerminateBody, options?: ApiRequestOptions) => Promise<postWorkflowIdTerminateResponse>;
|
|
319
344
|
/**
|
|
320
345
|
* @summary Return the result of a workflow
|
|
321
346
|
*/
|
|
@@ -87,6 +87,17 @@ export const patchWorkflowIdStop = async (id, options) => {
|
|
|
87
87
|
method: 'PATCH'
|
|
88
88
|
});
|
|
89
89
|
};
|
|
90
|
+
export const getPostWorkflowIdTerminateUrl = (id) => {
|
|
91
|
+
return `/workflow/${id}/terminate`;
|
|
92
|
+
};
|
|
93
|
+
export const postWorkflowIdTerminate = async (id, postWorkflowIdTerminateBody, options) => {
|
|
94
|
+
return customFetchInstance(getPostWorkflowIdTerminateUrl(id), {
|
|
95
|
+
...options,
|
|
96
|
+
method: 'POST',
|
|
97
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
98
|
+
body: JSON.stringify(postWorkflowIdTerminateBody)
|
|
99
|
+
});
|
|
100
|
+
};
|
|
90
101
|
export const getGetWorkflowIdResultUrl = (id) => {
|
|
91
102
|
return `/workflow/${id}/result`;
|
|
92
103
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class WorkflowTerminate extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
workflowId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
reason: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
catch(error: Error): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { postWorkflowIdTerminate } from '#api/generated/api.js';
|
|
3
|
+
import { handleApiError } from '#utils/error_handler.js';
|
|
4
|
+
export default class WorkflowTerminate extends Command {
|
|
5
|
+
static description = 'Terminate a workflow execution (force stop)';
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> <%= command.id %> wf-12345',
|
|
8
|
+
'<%= config.bin %> <%= command.id %> wf-12345 --reason "Cleaning up old workflows"'
|
|
9
|
+
];
|
|
10
|
+
static args = {
|
|
11
|
+
workflowId: Args.string({
|
|
12
|
+
description: 'The workflow ID to terminate',
|
|
13
|
+
required: true
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
static flags = {
|
|
17
|
+
reason: Flags.string({
|
|
18
|
+
char: 'r',
|
|
19
|
+
description: 'Reason for termination'
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { args, flags } = await this.parse(WorkflowTerminate);
|
|
24
|
+
this.log(`Terminating workflow: ${args.workflowId}...`);
|
|
25
|
+
await postWorkflowIdTerminate(args.workflowId, { reason: flags.reason });
|
|
26
|
+
const output = [
|
|
27
|
+
'Workflow terminated successfully',
|
|
28
|
+
'',
|
|
29
|
+
`Workflow ID: ${args.workflowId}`,
|
|
30
|
+
flags.reason ? `Reason: ${flags.reason}` : ''
|
|
31
|
+
].filter(Boolean).join('\n');
|
|
32
|
+
this.log(`\n${output}`);
|
|
33
|
+
}
|
|
34
|
+
async catch(error) {
|
|
35
|
+
return handleApiError(error, (...args) => this.error(...args), {
|
|
36
|
+
404: 'Workflow not found. Check the workflow ID.'
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -4,7 +4,10 @@ import fs from 'node:fs/promises';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { AGENT_CONFIG_DIR } from '#config.js';
|
|
6
6
|
export async function generatePlanName(description, date = new Date()) {
|
|
7
|
-
const
|
|
7
|
+
const year = date.getFullYear();
|
|
8
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
9
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
10
|
+
const datePrefix = `${year}_${month}_${day}`;
|
|
8
11
|
const planNameSlug = await generateText({
|
|
9
12
|
prompt: 'generate_plan_name@v1',
|
|
10
13
|
variables: { description }
|