@deepraxis/cli 0.2.0-dev.ed5af3e → 0.2.0-dev.f8aa5de
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/praxis.js +38 -25
- package/package.json +1 -1
package/dist/praxis.js
CHANGED
|
@@ -8405,7 +8405,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
8405
8405
|
resource: "file.files",
|
|
8406
8406
|
method: "create",
|
|
8407
8407
|
summary: "Upload file",
|
|
8408
|
-
description: 'Upload a file to reuse in conversations or attach to a knowledge base. Unlike OpenAI Files, uploads must be nonempty and at most 100000000 bytes, and only user_data
|
|
8408
|
+
description: 'Upload a file to reuse in conversations or attach to a knowledge base. Unlike OpenAI Files, uploads must be nonempty and at most 100000000 bytes, and only user_data and vision purposes are accepted. Send file bytes as a multipart file part, not a filename or file ID; in the SDK use a File or Blob, for example new File(["Return within 23 days."], "policy.txt", { type: "text/plain" }). Content determines the MIME type. Supported uploads include PDF, DOCX/XLSX/PPTX, PNG/JPEG/GIF/WebP, MP3/WAV/FLAC/OGG/M4A, MP4/WebM, and UTF-8 JSON/NDJSON/CSV/Markdown/plain text; empty, unsupported, oversized files and unsupported purposes return 400. Use Uploads for larger files. The purpose vision accepts only PNG, JPEG, GIF and WebP, while conversation images require user_data. The returned ID belongs to your tenant; upload alone does not ingest the file into Knowledge. Knowledge attachment has a lower limit of 100000000 bytes. Optionally set expires_after[anchor]=created_at with expires_after[seconds] (3600–7776000). Without expiry, the file persists until deleted.',
|
|
8409
8409
|
http: "POST",
|
|
8410
8410
|
path: "/file/v1/files",
|
|
8411
8411
|
streaming: "no",
|
|
@@ -8427,23 +8427,16 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
8427
8427
|
type: "string",
|
|
8428
8428
|
enum: [
|
|
8429
8429
|
"user_data",
|
|
8430
|
-
"assistants",
|
|
8431
8430
|
"vision"
|
|
8432
8431
|
],
|
|
8433
8432
|
required: true,
|
|
8434
|
-
description: "Purpose label stored with the file: user_data
|
|
8433
|
+
description: "Purpose label stored with the file: user_data or vision. The vision purpose accepts only PNG, JPEG, GIF and WebP images. Conversation image references require user_data."
|
|
8435
8434
|
},
|
|
8436
8435
|
{
|
|
8437
8436
|
name: "expires_after",
|
|
8438
8437
|
type: "object",
|
|
8439
8438
|
required: false,
|
|
8440
8439
|
description: "Optional expiry relative to created_at. Files without an expiry persist until deleted."
|
|
8441
|
-
},
|
|
8442
|
-
{
|
|
8443
|
-
name: "praxis",
|
|
8444
|
-
type: "object",
|
|
8445
|
-
required: false,
|
|
8446
|
-
description: "Own-face extensions. Use at most one expiry setting."
|
|
8447
8440
|
}
|
|
8448
8441
|
]
|
|
8449
8442
|
}
|
|
@@ -8506,7 +8499,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
8506
8499
|
resource: "file.uploads",
|
|
8507
8500
|
method: "create",
|
|
8508
8501
|
summary: "Create an upload",
|
|
8509
|
-
description: "Start a multipart upload for a file larger than the 100000000-byte direct-upload limit. Supply the exact byte length, filename, MIME type and purpose. Unlike OpenAI, uploads accept at most 2 GiB (2147483648 bytes) and only user_data
|
|
8502
|
+
description: "Start a multipart upload for a file larger than the 100000000-byte direct-upload limit. Supply the exact byte length, filename, MIME type and purpose. Unlike OpenAI, uploads accept at most 2 GiB (2147483648 bytes) and only user_data and vision purposes. Add parts of at most 64000000 bytes and complete within one hour. Optional part_size enables fixed-size, retryable parts. expires_after applies to the resulting file (3600–7776000 seconds on this own face); without it the file persists until deleted.",
|
|
8510
8503
|
http: "POST",
|
|
8511
8504
|
path: "/file/v1/uploads",
|
|
8512
8505
|
streaming: "no",
|
|
@@ -8539,11 +8532,10 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
8539
8532
|
type: "string",
|
|
8540
8533
|
enum: [
|
|
8541
8534
|
"user_data",
|
|
8542
|
-
"assistants",
|
|
8543
8535
|
"vision"
|
|
8544
8536
|
],
|
|
8545
8537
|
required: true,
|
|
8546
|
-
description: "Use user_data for conversation attachments,
|
|
8538
|
+
description: "Use user_data for conversation attachments, or vision for PNG, JPEG, GIF and WebP images."
|
|
8547
8539
|
},
|
|
8548
8540
|
{
|
|
8549
8541
|
name: "expires_after",
|
|
@@ -9723,7 +9715,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
9723
9715
|
name: "overwrite",
|
|
9724
9716
|
type: "boolean",
|
|
9725
9717
|
required: false,
|
|
9726
|
-
description: "Allow replacing an existing public_id, preserving its asset_id and increasing its version. False returns the existing resource without replacing it; defaults to true."
|
|
9718
|
+
description: "Allow replacing an existing public_id, preserving its asset_id and increasing its version. Only the latest version is deliverable; old version URLs return 404. Create a new public_id to retain old deliveries. False returns the existing resource without replacing it; defaults to true."
|
|
9727
9719
|
},
|
|
9728
9720
|
{
|
|
9729
9721
|
name: "tags",
|
|
@@ -9782,7 +9774,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
9782
9774
|
name: "file_id",
|
|
9783
9775
|
type: "string",
|
|
9784
9776
|
required: true,
|
|
9785
|
-
description: "File ID to copy into this library; passed as the upload source instead of file bytes."
|
|
9777
|
+
description: "File ID to copy into this library; passed as the upload source instead of file bytes. This creates an independent public copy readable without authentication. Deleting the source File does not delete this asset; do not import confidential content."
|
|
9786
9778
|
},
|
|
9787
9779
|
{
|
|
9788
9780
|
name: "public_id",
|
|
@@ -9836,7 +9828,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
9836
9828
|
name: "overwrite",
|
|
9837
9829
|
type: "boolean",
|
|
9838
9830
|
required: false,
|
|
9839
|
-
description: "Allow replacing an existing public_id, preserving its asset_id and increasing its version. False returns the existing resource without replacing it; defaults to true."
|
|
9831
|
+
description: "Allow replacing an existing public_id, preserving its asset_id and increasing its version. Only the latest version is deliverable; old version URLs return 404. Create a new public_id to retain old deliveries. False returns the existing resource without replacing it; defaults to true."
|
|
9840
9832
|
},
|
|
9841
9833
|
{
|
|
9842
9834
|
name: "tags",
|
|
@@ -10353,7 +10345,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
10353
10345
|
name: "expression",
|
|
10354
10346
|
type: "string",
|
|
10355
10347
|
required: false,
|
|
10356
|
-
description:
|
|
10348
|
+
description: 'Asset filter expression supporting field comparisons, AND, OR, NOT, parentheses and suffix wildcards. An empty expression matches all assets. For business metadata use context.sku=KETTLE-RED AND context.revision=2; request with_field: ["context"] to include context.'
|
|
10357
10349
|
},
|
|
10358
10350
|
{
|
|
10359
10351
|
name: "sort_by",
|
|
@@ -26686,8 +26678,9 @@ function jwtFetch(fetchImpl, token) {
|
|
|
26686
26678
|
function credentials(config, vars, ports) {
|
|
26687
26679
|
const path = ports.path ?? tokenPath(config.env);
|
|
26688
26680
|
const store = ports.store ?? createTokenStore(config.env, path, ports.secretStore);
|
|
26681
|
+
const source = credentialSource(vars);
|
|
26689
26682
|
const apiKey = vars.PRAXIS_API_KEY;
|
|
26690
|
-
const machineToken =
|
|
26683
|
+
const machineToken = source === "machine-token" ? vars.PRAXIS_API_TOKEN : undefined;
|
|
26691
26684
|
const remember = ports.remember ?? (() => {});
|
|
26692
26685
|
if (apiKey)
|
|
26693
26686
|
remember(apiKey);
|
|
@@ -26749,6 +26742,7 @@ function credentials(config, vars, ports) {
|
|
|
26749
26742
|
}
|
|
26750
26743
|
}
|
|
26751
26744
|
return {
|
|
26745
|
+
source,
|
|
26752
26746
|
get,
|
|
26753
26747
|
requireLogin,
|
|
26754
26748
|
async client(org) {
|
|
@@ -26804,13 +26798,13 @@ function skillDocument(commands) {
|
|
|
26804
26798
|
"## General rules",
|
|
26805
26799
|
"",
|
|
26806
26800
|
"- Select the environment only with `PRAXIS_ENV`; there is no `--env` option. The dev package defaults to develop.",
|
|
26807
|
-
"- Authenticate with `PRAXIS_API_KEY`, `PRAXIS_API_TOKEN` (a machine token, sent in the Authorization header; computers have it set) or `praxis login`, in that order. API keys and machine tokens determine the organization; login sessions can use `--org <organization_id>`. `PRAXIS_API_URL` overrides the API base and must be an https deepraxis.com URL.",
|
|
26801
|
+
"- Authenticate with `PRAXIS_API_KEY`, `PRAXIS_API_TOKEN` (a machine token, sent in the Authorization header; computers have it set) or `praxis login`, in that order. Login saves the session even when an environment credential takes precedence; unset the named variable in its warning to use the saved login. API keys and machine tokens determine the organization; login sessions can use `--org <organization_id>`. `PRAXIS_API_URL` overrides the API base and must be an https deepraxis.com URL.",
|
|
26808
26802
|
"- AI mode is enabled automatically in supported agent environments. Use `--format agent` to select it explicitly.",
|
|
26809
26803
|
"- Use `--json` for the complete JSON response without presentation truncation. Successful JSON output goes to stdout; errors go to stderr.",
|
|
26810
26804
|
"- Supply bodies with `--data JSON`, `--data @file.json`, or `--data -` for stdin. Scalar field options override matching JSON fields. Structured fields require `--data`.",
|
|
26811
26805
|
"- Deletion requires `--yes` in AI mode. Confirm the intended resource before using it.",
|
|
26812
26806
|
"- Use `--limit N` to limit a server page for SDK-paginated commands. Other lists apply it only to displayed rows; `--param-limit` still sends the API parameter when available. `--all` follows supported pagination and cannot be combined with `--limit`.",
|
|
26813
|
-
"- Error JSON has an `error` object: `code` identifies the failure, `message` describes it, `hint` suggests recovery, `env` identifies the environment, `command` identifies the command, `status` is the HTTP status, and `request_id` correlates diagnostics. Unavailable fields are null. Exit codes: 0 success, 1 runtime/API error, 2 usage error.",
|
|
26807
|
+
"- Error JSON has an `error` object: `code` identifies the failure, `message` describes it, `hint` suggests recovery, `env` identifies the environment, `command` identifies the command, `status` is the HTTP status, and `request_id` correlates diagnostics. Authentication failures also include `credential_source` (api-key, machine-token, or login); follow the source-specific hint. Unavailable fields are null. Exit codes: 0 success, 1 runtime/API error, 2 usage error.",
|
|
26814
26808
|
"- Append `--help` to a command for its optional parameters. Required scalar body options below can also be supplied as fields in `--data`.",
|
|
26815
26809
|
"- Two layers: top-level commands (`login`, `org`, `skill`, …) are workflows and session commands; every API operation is under `praxis api <domain> …`. `praxis api <METHOD> <path>` sends a raw request (the method is uppercase).",
|
|
26816
26810
|
"",
|
|
@@ -26941,7 +26935,12 @@ Enter code: ${code.user_code}` });
|
|
|
26941
26935
|
const location = await (ports.store ?? createTokenStore(config.env, path)).save(toStored(flow.tokens, ports.now()));
|
|
26942
26936
|
if (location !== "keychain")
|
|
26943
26937
|
ports.emit({ kind: "message", channel: "stderr", text: "stored in a file (no system keychain available)" });
|
|
26938
|
+
const shadowedBy = ports.source === "api-key" ? "PRAXIS_API_KEY" : ports.source === "machine-token" ? "PRAXIS_API_TOKEN" : undefined;
|
|
26944
26939
|
ports.emit({ kind: "message", text: `Logged in (${config.env}).` });
|
|
26940
|
+
if (shadowedBy)
|
|
26941
|
+
ports.emit({ kind: "message", channel: "stderr", text: `Note: ${shadowedBy} is set and takes precedence over this login. Unset it (unset ${shadowedBy}) to use the login.` });
|
|
26942
|
+
if (ports.json)
|
|
26943
|
+
ports.emit({ kind: "object", data: { env: config.env, ...shadowedBy ? { shadowed_by: shadowedBy } : {} } });
|
|
26945
26944
|
}
|
|
26946
26945
|
async function whoami(auth, env, org) {
|
|
26947
26946
|
const credential = await auth.get(org);
|
|
@@ -27743,7 +27742,7 @@ ${usage ? `usage: ${JSON.stringify(usage)}
|
|
|
27743
27742
|
|
|
27744
27743
|
// src/output/render.ts
|
|
27745
27744
|
function errorJSON(result, ctx) {
|
|
27746
|
-
return JSON.stringify({ error: { code: result.code, message: result.message, hint: result.hint ?? null, env: result.env, command: ctx.command ?? null, status: result.status ?? null, request_id: result.request_id ?? null } }) + `
|
|
27745
|
+
return JSON.stringify({ error: { code: result.code, message: result.message, hint: result.hint ?? null, env: result.env, command: ctx.command ?? null, status: result.status ?? null, request_id: result.request_id ?? null, ...result.credential_source ? { credential_source: result.credential_source } : {} } }) + `
|
|
27747
27746
|
`;
|
|
27748
27747
|
}
|
|
27749
27748
|
function render(result, ctx) {
|
|
@@ -27884,6 +27883,16 @@ var humanize = (code) => {
|
|
|
27884
27883
|
const words = code.toLowerCase().split("_").filter(Boolean).join(" ");
|
|
27885
27884
|
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
27886
27885
|
};
|
|
27886
|
+
function authHint(source) {
|
|
27887
|
+
switch (source) {
|
|
27888
|
+
case "api-key":
|
|
27889
|
+
return "The API key from PRAXIS_API_KEY was rejected; check or replace it, or unset it to use `praxis login`.";
|
|
27890
|
+
case "machine-token":
|
|
27891
|
+
return "The machine token from PRAXIS_API_TOKEN was rejected (it may have expired); unset it to use `praxis login`, or refresh it.";
|
|
27892
|
+
case "login":
|
|
27893
|
+
return "Run `praxis login` or set PRAXIS_API_KEY.";
|
|
27894
|
+
}
|
|
27895
|
+
}
|
|
27887
27896
|
function errorInput(error, ctx) {
|
|
27888
27897
|
const sdk = error instanceof PraxisError ? error : undefined;
|
|
27889
27898
|
const raw = record(sdk?.raw), nested = record(raw.error);
|
|
@@ -27898,11 +27907,13 @@ function errorInput(error, ctx) {
|
|
|
27898
27907
|
if (stripped)
|
|
27899
27908
|
message = `${humanize(code)}${message ? `: ${message}` : ""}`;
|
|
27900
27909
|
const status = sdk?.status, request_id = sdk?.requestId;
|
|
27910
|
+
const authFailure = status === 401 || ["NOT_LOGGED_IN", "UNAUTHENTICATED", "TOKEN_REVOKED", "LOGIN_FAILED"].includes(code);
|
|
27911
|
+
const source = ctx.credentialSource ?? "login";
|
|
27901
27912
|
let hint = genericHint;
|
|
27902
27913
|
if (error instanceof UsageError)
|
|
27903
27914
|
hint = error.hint;
|
|
27904
|
-
else if (
|
|
27905
|
-
hint =
|
|
27915
|
+
else if (authFailure)
|
|
27916
|
+
hint = authHint(source);
|
|
27906
27917
|
else if (status === 404)
|
|
27907
27918
|
hint = ctx.listCommand ? `Check the id; list existing ones with \`${ctx.listCommand}\`` : "Check the id.";
|
|
27908
27919
|
else if (status === 403)
|
|
@@ -27911,7 +27922,7 @@ function errorInput(error, ctx) {
|
|
|
27911
27922
|
hint = "Rate limited; retry later.";
|
|
27912
27923
|
else if (status !== undefined && status >= 500)
|
|
27913
27924
|
hint = `Server error; retry later.${request_id ? ` Request id: ${request_id}.` : ""}`;
|
|
27914
|
-
return { kind: "error", code, message, hint, env: ctx.env, ...status !== undefined ? { status } : {}, ...request_id ? { request_id } : {} };
|
|
27925
|
+
return { kind: "error", code, message, hint, env: ctx.env, ...authFailure ? { credential_source: source } : {}, ...status !== undefined ? { status } : {}, ...request_id ? { request_id } : {} };
|
|
27915
27926
|
}
|
|
27916
27927
|
|
|
27917
27928
|
// src/output/progress.ts
|
|
@@ -27941,7 +27952,7 @@ function startProgress(ctx, write = (text) => writeOutput({ stderr: text })) {
|
|
|
27941
27952
|
}
|
|
27942
27953
|
|
|
27943
27954
|
// src/main.ts
|
|
27944
|
-
var version = "0.2.0-dev.
|
|
27955
|
+
var version = "0.2.0-dev.f8aa5de";
|
|
27945
27956
|
var commands = commandTree(operations);
|
|
27946
27957
|
var manual = [...workflows.map((w) => w.words), [API_WORD]];
|
|
27947
27958
|
function route(argv) {
|
|
@@ -28136,6 +28147,7 @@ Examples:
|
|
|
28136
28147
|
const auth = credentials(config, ports.env, { fetch: wireFetch, now: ports.now, path, store, remember: (s) => {
|
|
28137
28148
|
secrets.push(s);
|
|
28138
28149
|
} });
|
|
28150
|
+
ctx.credentialSource = auth.source;
|
|
28139
28151
|
const org = flags.org;
|
|
28140
28152
|
const confirm = (method) => confirmOperation(method, { yes: Boolean(flags.yes), noInput: Boolean(flags["no-input"]) || ctx.mode === "agent", stdinIsTTY: ports.stdinIsTTY, ask: async () => {
|
|
28141
28153
|
stopProgress();
|
|
@@ -28202,7 +28214,8 @@ Examples:
|
|
|
28202
28214
|
case "login":
|
|
28203
28215
|
if (flags["no-input"] || quiet)
|
|
28204
28216
|
throw new UsageError("login requires displaying a device code", "Remove --no-input / --quiet or set PRAXIS_API_KEY for scripts.");
|
|
28205
|
-
|
|
28217
|
+
ctx.credentialSource = "login";
|
|
28218
|
+
await login(config, path, { ...ports, source: auth.source, json: ctx.mode === "json", store, fetch: wireFetch, emit, remember: (s) => secrets.push(s) });
|
|
28206
28219
|
break;
|
|
28207
28220
|
case "logout":
|
|
28208
28221
|
emit({ kind: "message", text: await store.delete() ? "Logged out." : "Not logged in." });
|