@thenewblack/cli 0.1.0 → 0.1.1
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/lib/api.js +7 -0
- package/package.json +1 -1
package/lib/api.js
CHANGED
|
@@ -43,6 +43,13 @@ export async function call(method, path, { body, form, query, headers: extra, au
|
|
|
43
43
|
if (!res.ok) {
|
|
44
44
|
const err = data && typeof data === "object" && data.error;
|
|
45
45
|
if (err && typeof err === "object") throw new ApiError(err.code ?? `http_${res.status}`, err.message ?? `HTTP ${res.status}`, res.status, err.details);
|
|
46
|
+
/* A refusal that is a STATE, not an error — the agents' door answers
|
|
47
|
+
409 { status: "working", message, task_id, since, on } while the
|
|
48
|
+
agent is busy: the code is the state, the rest travels as details. */
|
|
49
|
+
if (data && typeof data === "object" && typeof data.status === "string") {
|
|
50
|
+
const { status, message, ...rest } = data;
|
|
51
|
+
throw new ApiError(status, typeof message === "string" ? message : `HTTP ${res.status} from ${path}`, res.status, Object.keys(rest).length ? rest : undefined);
|
|
52
|
+
}
|
|
46
53
|
throw new ApiError(`http_${res.status}`, typeof err === "string" ? err : `HTTP ${res.status} from ${path}`, res.status);
|
|
47
54
|
}
|
|
48
55
|
return data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thenewblack/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The New Black AI from the command line: every fashion workflow of the studio, your creations, tech packs, publishing and AI agents — one command each, JSON out. Made for AI coding agents and scripts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|