@2kw/ai 8.1.0-dev.2 → 8.1.0-dev.6
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.
|
@@ -41,7 +41,7 @@ export function makeDatasetsCommand() {
|
|
|
41
41
|
.description("Create a new dataset")
|
|
42
42
|
.requiredOption("-n, --name <name>", "Dataset name")
|
|
43
43
|
.option("-d, --description <text>", "Dataset description")
|
|
44
|
-
.option("-t, --type <type>", "Dataset type")
|
|
44
|
+
.option("-t, --type <type>", "Dataset type (default: text)")
|
|
45
45
|
.option("--input-schema <json>", "Input JSON Schema")
|
|
46
46
|
.option("--expected-output-schema <json>", "Expected output JSON Schema")
|
|
47
47
|
.option("--metadata <json>", "Metadata (JSON)")
|
package/dist/lib/output.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare function formatList(items: AnyRecord[] | undefined, command: Comm
|
|
|
22
22
|
* Display a success message.
|
|
23
23
|
*/
|
|
24
24
|
export declare function formatSuccess(message: string, command: Command): void;
|
|
25
|
+
/** Stops the running spinner, if any, which shows the cursor again. Call it before `process.exit`. */
|
|
26
|
+
export declare function stopSpinner(): void;
|
|
25
27
|
/**
|
|
26
28
|
* Run an async action with a spinner.
|
|
27
29
|
*/
|
package/dist/lib/output.js
CHANGED
|
@@ -82,11 +82,18 @@ export function formatSuccess(message, command) {
|
|
|
82
82
|
console.log(chalk.green(message));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
/** The spinner `withSpinner` runs now, so an exit on Ctrl+C can stop it: ora hides the cursor while it spins (#1733). */
|
|
86
|
+
let running;
|
|
87
|
+
/** Stops the running spinner, if any, which shows the cursor again. Call it before `process.exit`. */
|
|
88
|
+
export function stopSpinner() {
|
|
89
|
+
running?.stop();
|
|
90
|
+
}
|
|
85
91
|
/**
|
|
86
92
|
* Run an async action with a spinner.
|
|
87
93
|
*/
|
|
88
94
|
export async function withSpinner(text, action) {
|
|
89
95
|
const spinner = ora(text).start();
|
|
96
|
+
running = spinner;
|
|
90
97
|
try {
|
|
91
98
|
const result = await action(spinner);
|
|
92
99
|
spinner.succeed();
|
|
@@ -96,6 +103,10 @@ export async function withSpinner(text, action) {
|
|
|
96
103
|
spinner.fail();
|
|
97
104
|
throw err;
|
|
98
105
|
}
|
|
106
|
+
finally {
|
|
107
|
+
if (running === spinner)
|
|
108
|
+
running = undefined;
|
|
109
|
+
}
|
|
99
110
|
}
|
|
100
111
|
function formatValue(value) {
|
|
101
112
|
if (value === null || value === undefined)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BackboneApiError } from "./errors.js";
|
|
2
|
+
import { stopSpinner } from "./output.js";
|
|
2
3
|
/**
|
|
3
4
|
* POSTs an agent turn to `/v1/responses` and returns its terminal response, as `stream: false` would (#1729).
|
|
4
5
|
* The turn is streamed: a proxy in front of the API cuts a request that answers nothing for 100 s (HTTP 524),
|
|
@@ -47,6 +48,7 @@ async function readResponseStream(body, onStart) {
|
|
|
47
48
|
timestamp: new Date().toISOString(),
|
|
48
49
|
});
|
|
49
50
|
const onInterrupt = () => {
|
|
51
|
+
stopSpinner(); // a spinning ora hides the cursor, and process.exit would leave it hidden (#1733)
|
|
50
52
|
console.error(`Interrupted.${readHint(started)}`);
|
|
51
53
|
process.exit(130);
|
|
52
54
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2kw/ai",
|
|
3
|
-
"version": "8.1.0-dev.
|
|
3
|
+
"version": "8.1.0-dev.6",
|
|
4
4
|
"description": "CLI for 2kw.ai — schema-driven document extraction, an OpenAI-compatible EU LLM gateway, transcription, prompts, datasets, and experiments from your terminal or agentic workflows. Ships as 2kw, backbone, and bb.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|