@usenaive-sdk/cli 0.12.2 → 0.13.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 +76 -5
- package/dist/client.d.ts +74 -1
- package/dist/client.js +351 -17
- package/dist/client.js.map +1 -1
- package/dist/commands/aeo.js +69 -27
- package/dist/commands/aeo.js.map +1 -1
- package/dist/commands/app-data.js +29 -11
- package/dist/commands/app-data.js.map +1 -1
- package/dist/commands/apps.d.ts +7 -0
- package/dist/commands/apps.js +255 -18
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/audio.d.ts +9 -0
- package/dist/commands/audio.js +391 -0
- package/dist/commands/audio.js.map +1 -0
- package/dist/commands/auth.d.ts +31 -0
- package/dist/commands/auth.js +403 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/billing.js +12 -12
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/brain.d.ts +2 -0
- package/dist/commands/brain.js +1255 -0
- package/dist/commands/brain.js.map +1 -0
- package/dist/commands/browser.js +35 -8
- package/dist/commands/browser.js.map +1 -1
- package/dist/commands/business.js +117 -16
- package/dist/commands/business.js.map +1 -1
- package/dist/commands/clone.d.ts +2 -0
- package/dist/commands/clone.js +203 -0
- package/dist/commands/clone.js.map +1 -0
- package/dist/commands/companies.d.ts +8 -0
- package/dist/commands/companies.js +137 -47
- package/dist/commands/companies.js.map +1 -1
- package/dist/commands/company-data.d.ts +2 -0
- package/dist/commands/company-data.js +168 -0
- package/dist/commands/company-data.js.map +1 -0
- package/dist/commands/compute.js +10 -3
- package/dist/commands/compute.js.map +1 -1
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +36 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/connections.d.ts +6 -0
- package/dist/commands/connections.js +29 -1
- package/dist/commands/connections.js.map +1 -1
- package/dist/commands/domains.js +1 -1
- package/dist/commands/ecommerce.js +19 -9
- package/dist/commands/ecommerce.js.map +1 -1
- package/dist/commands/email.js +56 -9
- package/dist/commands/email.js.map +1 -1
- package/dist/commands/env.d.ts +3 -3
- package/dist/commands/env.js +68 -4
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/formation.js +3 -3
- package/dist/commands/identity.js +4 -3
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/images.js +87 -13
- package/dist/commands/images.js.map +1 -1
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.js +39 -36
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/jobs.js +1 -0
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/keys.js +26 -3
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/legacy-auth.d.ts +27 -0
- package/dist/commands/legacy-auth.js +64 -0
- package/dist/commands/legacy-auth.js.map +1 -0
- package/dist/commands/llm.js +13 -0
- package/dist/commands/llm.js.map +1 -1
- package/dist/commands/login.js +2 -0
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/loops.d.ts +2 -0
- package/dist/commands/loops.js +260 -0
- package/dist/commands/loops.js.map +1 -0
- package/dist/commands/media.js +3 -3
- package/dist/commands/media.js.map +1 -1
- package/dist/commands/mobile.d.ts +4 -0
- package/dist/commands/mobile.js +382 -0
- package/dist/commands/mobile.js.map +1 -0
- package/dist/commands/payments.d.ts +2 -0
- package/dist/commands/payments.js +131 -0
- package/dist/commands/payments.js.map +1 -0
- package/dist/commands/people.d.ts +2 -0
- package/dist/commands/people.js +193 -0
- package/dist/commands/people.js.map +1 -0
- package/dist/commands/phone.js +3 -3
- package/dist/commands/phone.js.map +1 -1
- package/dist/commands/projects.d.ts +13 -0
- package/dist/commands/projects.js +220 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/register.js +16 -8
- package/dist/commands/register.js.map +1 -1
- package/dist/commands/sandbox.d.ts +2 -0
- package/dist/commands/sandbox.js +245 -0
- package/dist/commands/sandbox.js.map +1 -0
- package/dist/commands/search.js +26 -12
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/seo.js +16 -8
- package/dist/commands/seo.js.map +1 -1
- package/dist/commands/sessions.d.ts +6 -0
- package/dist/commands/sessions.js +109 -0
- package/dist/commands/sessions.js.map +1 -0
- package/dist/commands/social-data.d.ts +2 -0
- package/dist/commands/social-data.js +244 -0
- package/dist/commands/social-data.js.map +1 -0
- package/dist/commands/social.js +8 -6
- package/dist/commands/social.js.map +1 -1
- package/dist/commands/teams.d.ts +69 -0
- package/dist/commands/teams.js +503 -0
- package/dist/commands/teams.js.map +1 -0
- package/dist/commands/up.d.ts +150 -0
- package/dist/commands/up.js +415 -15
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/usage.js +15 -4
- package/dist/commands/usage.js.map +1 -1
- package/dist/commands/use.d.ts +9 -0
- package/dist/commands/use.js +76 -11
- package/dist/commands/use.js.map +1 -1
- package/dist/commands/users.d.ts +8 -0
- package/dist/commands/users.js +28 -9
- package/dist/commands/users.js.map +1 -1
- package/dist/commands/vault.js +28 -1
- package/dist/commands/vault.js.map +1 -1
- package/dist/commands/video.js +190 -270
- package/dist/commands/video.js.map +1 -1
- package/dist/commands/voice.d.ts +2 -0
- package/dist/commands/voice.js +516 -0
- package/dist/commands/voice.js.map +1 -0
- package/dist/commands/wallet.d.ts +2 -0
- package/dist/commands/wallet.js +244 -0
- package/dist/commands/wallet.js.map +1 -0
- package/dist/commands/whoami.js +17 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/config.d.ts +24 -1
- package/dist/config.js +36 -7
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +290 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/brain-select.d.ts +193 -0
- package/dist/lib/brain-select.js +403 -0
- package/dist/lib/brain-select.js.map +1 -0
- package/dist/lib/cli-validation.d.ts +12 -0
- package/dist/lib/cli-validation.js +46 -0
- package/dist/lib/cli-validation.js.map +1 -0
- package/dist/lib/deprecation.d.ts +158 -0
- package/dist/lib/deprecation.js +140 -0
- package/dist/lib/deprecation.js.map +1 -0
- package/dist/lib/duration.d.ts +8 -0
- package/dist/lib/duration.js +11 -0
- package/dist/lib/duration.js.map +1 -0
- package/dist/lib/http-response.d.ts +11 -0
- package/dist/lib/http-response.js +96 -0
- package/dist/lib/http-response.js.map +1 -0
- package/dist/lib/pricing.d.ts +132 -0
- package/dist/lib/pricing.js +148 -0
- package/dist/lib/pricing.js.map +1 -0
- package/dist/lib/stream-frames.d.ts +114 -0
- package/dist/lib/stream-frames.js +169 -0
- package/dist/lib/stream-frames.js.map +1 -0
- package/dist/lib/teams-catalog.d.ts +141 -0
- package/dist/lib/teams-catalog.js +765 -0
- package/dist/lib/teams-catalog.js.map +1 -0
- package/dist/lib/unknown-command.d.ts +57 -0
- package/dist/lib/unknown-command.js +93 -0
- package/dist/lib/unknown-command.js.map +1 -0
- package/dist/lib/version-check.d.ts +26 -0
- package/dist/lib/version-check.js +21 -0
- package/dist/lib/version-check.js.map +1 -0
- package/dist/output.d.ts +119 -10
- package/dist/output.js +309 -15
- package/dist/output.js.map +1 -1
- package/dist/prompt.d.ts +17 -0
- package/dist/prompt.js +70 -0
- package/dist/prompt.js.map +1 -0
- package/package.json +11 -6
- package/dist/commands/billing-client.d.ts +0 -2
- package/dist/commands/billing-client.js +0 -271
- package/dist/commands/billing-client.js.map +0 -1
- package/dist/commands/crm-app.d.ts +0 -2
- package/dist/commands/crm-app.js +0 -306
- package/dist/commands/crm-app.js.map +0 -1
- package/dist/commands/crm.d.ts +0 -2
- package/dist/commands/crm.js +0 -319
- package/dist/commands/crm.js.map +0 -1
- package/dist/commands/integrations.d.ts +0 -2
- package/dist/commands/integrations.js +0 -199
- package/dist/commands/integrations.js.map +0 -1
- package/dist/commands/link.d.ts +0 -3
- package/dist/commands/link.js +0 -91
- package/dist/commands/link.js.map +0 -1
- package/dist/commands/operators.d.ts +0 -11
- package/dist/commands/operators.js +0 -120
- package/dist/commands/operators.js.map +0 -1
package/dist/output.js
CHANGED
|
@@ -2,8 +2,201 @@
|
|
|
2
2
|
* Agent-native structured output for CLI responses.
|
|
3
3
|
* Every tool call returns JSON with result data + contextual guidance
|
|
4
4
|
* following the Meow/Lindy pattern for agentic CLI usage.
|
|
5
|
+
*
|
|
6
|
+
* Output mode is OPT-IN human (default machine JSON). Human mode is NEVER inferred from isTTY —
|
|
7
|
+
* a pty-wrapped caller (Claude Code's Bash tool, script(1), tmux, ssh -t, CI runners) reports
|
|
8
|
+
* isTTY===true with no human present, so auto-detect would hang agents in prompts and break their
|
|
9
|
+
* JSON.parse. Machine overrides (--json / NAIVE_JSON / CI) always win.
|
|
5
10
|
*/
|
|
11
|
+
import chalk from "chalk";
|
|
12
|
+
import { loadConfig, saveConfig } from "./config.js";
|
|
13
|
+
let _flagJson = false;
|
|
14
|
+
let _flagHuman = false;
|
|
15
|
+
/** Set by the global --json / --human options in index.ts, parsed before any action runs. */
|
|
16
|
+
export function setOutputFlags(opts) {
|
|
17
|
+
if (opts.json)
|
|
18
|
+
_flagJson = true;
|
|
19
|
+
if (opts.human)
|
|
20
|
+
_flagHuman = true;
|
|
21
|
+
}
|
|
22
|
+
function machineForced() {
|
|
23
|
+
return _flagJson || !!process.env.NAIVE_JSON || !!process.env.CI;
|
|
24
|
+
}
|
|
25
|
+
/** TRUE only on an explicit opt-in; default false. Controls OUTPUT FORMAT. */
|
|
26
|
+
export function humanMode() {
|
|
27
|
+
if (machineForced())
|
|
28
|
+
return false;
|
|
29
|
+
if (_flagHuman || process.env.NAIVE_HUMAN === "1")
|
|
30
|
+
return true;
|
|
31
|
+
try {
|
|
32
|
+
return loadConfig().output === "human";
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Prompts (wizard, destructive confirm) require human mode AND a real interactive stdin — a
|
|
39
|
+
* separate predicate from output format, so a human piping stdout to `tee` still gets the confirm. */
|
|
40
|
+
export function isInteractive() {
|
|
41
|
+
return humanMode() && !!process.stdin.isTTY;
|
|
42
|
+
}
|
|
43
|
+
// One-time stderr nudge so a founder discovers human mode without polluting stdout (stays parseable JSON).
|
|
44
|
+
function maybeDiscoveryHint() {
|
|
45
|
+
if (!process.stdout.isTTY)
|
|
46
|
+
return;
|
|
47
|
+
if (_flagJson || _flagHuman || process.env.NAIVE_JSON || process.env.NAIVE_HUMAN || process.env.CI)
|
|
48
|
+
return;
|
|
49
|
+
let cfg;
|
|
50
|
+
try {
|
|
51
|
+
cfg = loadConfig();
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (cfg.output !== undefined || cfg.human_hint_shown)
|
|
57
|
+
return;
|
|
58
|
+
process.stderr.write(chalk.dim("\n💡 tip: run `naive config output human` for friendly, readable output.\n"));
|
|
59
|
+
try {
|
|
60
|
+
saveConfig({ human_hint_shown: true });
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
/* best-effort */
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Secret guard (security HIGH-2): a key must be shown ONCE, clearly labeled, and NEVER rendered as a
|
|
67
|
+
// runnable/highlighted command (the copy-into-shell-history footgun).
|
|
68
|
+
const SECRET_TOKEN_RE = /nv_sk_[A-Za-z0-9_]+/;
|
|
69
|
+
function isSecretField(key) {
|
|
70
|
+
return key === "api_key" || key === "session_token" || key === "token";
|
|
71
|
+
}
|
|
72
|
+
function fmtVal(v) {
|
|
73
|
+
if (v === null || v === undefined)
|
|
74
|
+
return chalk.dim("—");
|
|
75
|
+
if (typeof v === "object")
|
|
76
|
+
return chalk.dim(JSON.stringify(v));
|
|
77
|
+
return String(v);
|
|
78
|
+
}
|
|
79
|
+
function renderHuman(o) {
|
|
80
|
+
const w = (s) => process.stdout.write(s);
|
|
81
|
+
w(chalk.green.bold(`✓ ${o.action}\n`));
|
|
82
|
+
if (o.result && typeof o.result === "object") {
|
|
83
|
+
for (const [k, v] of Object.entries(o.result)) {
|
|
84
|
+
if (isSecretField(k) && typeof v === "string") {
|
|
85
|
+
w("\n" + chalk.yellow.bold(` ⚠ ${k} — save this now, it won't be shown again:`) + "\n");
|
|
86
|
+
w(" " + chalk.cyan(v) + "\n\n");
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
w(" " + chalk.dim(`${k}:`) + " " + fmtVal(v) + "\n");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (o.result !== null && o.result !== undefined) {
|
|
94
|
+
w(" " + String(o.result) + "\n");
|
|
95
|
+
}
|
|
96
|
+
if (o.hints?.length) {
|
|
97
|
+
w("\n");
|
|
98
|
+
for (const h of o.hints)
|
|
99
|
+
w(chalk.dim(` • ${h}`) + "\n");
|
|
100
|
+
}
|
|
101
|
+
// next_steps as suggested commands — but NEVER one carrying a raw key (secret guard).
|
|
102
|
+
const safe = (o.next_steps ?? []).filter((s) => !SECRET_TOKEN_RE.test(s.command));
|
|
103
|
+
if (safe.length) {
|
|
104
|
+
w("\n" + chalk.dim(" Next:") + "\n");
|
|
105
|
+
for (const s of safe)
|
|
106
|
+
w(" " + chalk.cyan(s.command) + chalk.dim(` — ${s.description}`) + "\n");
|
|
107
|
+
}
|
|
108
|
+
// help_markdown is intentionally NOT rendered in human mode: it's verbose and (in keys create) the
|
|
109
|
+
// place a raw secret would live. The JSON path keeps it for agents.
|
|
110
|
+
}
|
|
111
|
+
function renderHumanError(o) {
|
|
112
|
+
const w = (s) => process.stderr.write(s);
|
|
113
|
+
w(chalk.red.bold(`✗ ${o.action} failed`) + "\n");
|
|
114
|
+
if (o.error.message)
|
|
115
|
+
w(" " + o.error.message + "\n");
|
|
116
|
+
if (o.error.hint)
|
|
117
|
+
w(chalk.dim(" hint: " + o.error.hint) + "\n");
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The SINGLE derivation point for the human-readable "Cost:" hint (N7). Reads
|
|
121
|
+
* the authoritative `credits_used` off a response/result object — the exact
|
|
122
|
+
* number the API billed and dropped from the balance — and formats it so the
|
|
123
|
+
* hint can NEVER drift from what was actually charged. Previously commands
|
|
124
|
+
* hardcoded strings like "Cost: 1 credit" while the API charged 10; deriving
|
|
125
|
+
* from the response is the only way to keep them in lockstep.
|
|
126
|
+
*
|
|
127
|
+
* Returns undefined when there is nothing (yet) to charge — the field is
|
|
128
|
+
* absent, or a job is still queued/processing/failed (credits_used is null) —
|
|
129
|
+
* so callers can spread it into a hints array and no line appears.
|
|
130
|
+
*/
|
|
131
|
+
export function creditCostHint(result) {
|
|
132
|
+
const raw = result?.credits_used;
|
|
133
|
+
if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0)
|
|
134
|
+
return undefined;
|
|
135
|
+
// Trim binary float noise (e.g. 0.30000000000000004) without inventing precision.
|
|
136
|
+
const credits = Math.round(raw * 10000) / 10000;
|
|
137
|
+
return `Cost: ${credits} ${credits === 1 ? "credit" : "credits"}`;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The submit-time counterpart of creditCostHint (N6). Reads a job-submission
|
|
141
|
+
* response's `estimated_credits` — the API's pre-flight quote, derived from the
|
|
142
|
+
* SAME getFalPrice() + usdToCredits() source that settles the final charge — so
|
|
143
|
+
* a customer sees the spend before and at submit, and the echoed number tracks
|
|
144
|
+
* what will actually be billed. Returns undefined when no estimate is present.
|
|
145
|
+
*/
|
|
146
|
+
export function creditEstimateHint(result) {
|
|
147
|
+
const raw = result?.estimated_credits;
|
|
148
|
+
if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0)
|
|
149
|
+
return undefined;
|
|
150
|
+
const credits = Math.round(raw * 10000) / 10000;
|
|
151
|
+
return `Estimated cost: ${credits} ${credits === 1 ? "credit" : "credits"} (charged only on successful completion)`;
|
|
152
|
+
}
|
|
153
|
+
// A pending, non-fatal update notice discovered by the client layer (from the
|
|
154
|
+
// server version handshake). It rides along on the next successful agentOutput
|
|
155
|
+
// and is cleared once emitted, so it surfaces exactly once per command.
|
|
156
|
+
let _pendingUpdate;
|
|
157
|
+
/** Stash a pending update notice for the next agentOutput call (client layer → output). */
|
|
158
|
+
export function setPendingUpdate(info) {
|
|
159
|
+
_pendingUpdate = info;
|
|
160
|
+
}
|
|
161
|
+
// The same one-shot mechanism for a deprecation notice, set by lib/deprecation.ts
|
|
162
|
+
// from a commander preAction hook. It rides the next successful envelope and is
|
|
163
|
+
// cleared once emitted, so it appears exactly once per command.
|
|
164
|
+
let _pendingDeprecation;
|
|
165
|
+
/** Stash a pending deprecation notice for the next agentOutput call. */
|
|
166
|
+
export function setPendingDeprecation(notice) {
|
|
167
|
+
_pendingDeprecation = notice;
|
|
168
|
+
}
|
|
169
|
+
/** Test seam: read the pending notice without emitting it. */
|
|
170
|
+
export function peekPendingDeprecation() {
|
|
171
|
+
return _pendingDeprecation;
|
|
172
|
+
}
|
|
6
173
|
export function agentOutput(opts) {
|
|
174
|
+
agentOutputExit(opts);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* `agentOutput` plus an explicit process exit code — the mechanism behind the
|
|
178
|
+
* exit-code ladder of 06 §1.3. Exit 2 is "success, and a diff exists"
|
|
179
|
+
* (terraform's `-detailed-exitcode`); exit 3 is "success, and the terminal state
|
|
180
|
+
* is not success" — a CI script reading 0 as "the work is done" would otherwise
|
|
181
|
+
* count an `unverified` task as a pass.
|
|
182
|
+
*
|
|
183
|
+
* It sets `process.exitCode` rather than calling `process.exit()`: the payload it
|
|
184
|
+
* just wrote may still be buffered when stdout is a pipe, and `process.exit()`
|
|
185
|
+
* truncates it. Setting the code lets Node drain and then exit with it.
|
|
186
|
+
*/
|
|
187
|
+
export function agentOutputExit(opts) {
|
|
188
|
+
// Consume any pending notices first (so they're cleared even in human mode),
|
|
189
|
+
// then take the human-mode early return.
|
|
190
|
+
const update = _pendingUpdate;
|
|
191
|
+
_pendingUpdate = undefined;
|
|
192
|
+
const deprecation = _pendingDeprecation;
|
|
193
|
+
_pendingDeprecation = undefined;
|
|
194
|
+
if (opts.exitCode)
|
|
195
|
+
process.exitCode = opts.exitCode;
|
|
196
|
+
if (humanMode()) {
|
|
197
|
+
renderHuman(opts);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
7
200
|
const output = {
|
|
8
201
|
success: true,
|
|
9
202
|
action: opts.action,
|
|
@@ -12,10 +205,17 @@ export function agentOutput(opts) {
|
|
|
12
205
|
...(opts.hints && { hints: opts.hints }),
|
|
13
206
|
...(opts.related_commands && { related_commands: opts.related_commands }),
|
|
14
207
|
...(opts.help_markdown && { help_markdown: opts.help_markdown }),
|
|
208
|
+
...(update && { update }),
|
|
209
|
+
...(deprecation && { deprecation }),
|
|
15
210
|
};
|
|
16
211
|
console.log(JSON.stringify(output, null, 2));
|
|
212
|
+
maybeDiscoveryHint();
|
|
17
213
|
}
|
|
18
214
|
export function agentError(opts) {
|
|
215
|
+
if (humanMode()) {
|
|
216
|
+
renderHumanError(opts);
|
|
217
|
+
process.exit(1);
|
|
218
|
+
}
|
|
19
219
|
const output = {
|
|
20
220
|
success: false,
|
|
21
221
|
action: opts.action,
|
|
@@ -25,22 +225,79 @@ export function agentError(opts) {
|
|
|
25
225
|
console.error(JSON.stringify(output, null, 2));
|
|
26
226
|
process.exit(1);
|
|
27
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* 06 §1.8 — when a response body carries a governance `verdict`, the DECISION
|
|
230
|
+
* POINT knows the recovery and the CLI's local `switch (code)` does not. The
|
|
231
|
+
* whole point of the denial envelope is that a model recovers instead of
|
|
232
|
+
* looping, and a hand-written table that overwrites the server's steps defeats
|
|
233
|
+
* it. So: a body with a `verdict` and a well-formed `recovery[]` renders the
|
|
234
|
+
* server's steps verbatim, and `getRecoverySteps` is not consulted.
|
|
235
|
+
*
|
|
236
|
+
* Both gates are required. `verdict` alone with no recovery falls back (the
|
|
237
|
+
* server said nothing actionable); `recovery` alone with no verdict is ignored,
|
|
238
|
+
* so this cannot become a way for any endpoint to rewrite the CLI's advice.
|
|
239
|
+
* Each step is validated field by field — an entry that is not
|
|
240
|
+
* `{command:string, description:string}` is dropped rather than printed as
|
|
241
|
+
* `undefined`.
|
|
242
|
+
*/
|
|
243
|
+
export function serverRecoverySteps(data) {
|
|
244
|
+
if (typeof data !== "object" || data === null)
|
|
245
|
+
return undefined;
|
|
246
|
+
const body = data;
|
|
247
|
+
const verdict = body.verdict ?? body.error?.verdict;
|
|
248
|
+
if (typeof verdict !== "string" || verdict.length === 0)
|
|
249
|
+
return undefined;
|
|
250
|
+
const raw = body.recovery ?? body.error?.recovery;
|
|
251
|
+
if (!Array.isArray(raw))
|
|
252
|
+
return undefined;
|
|
253
|
+
const steps = [];
|
|
254
|
+
for (const entry of raw) {
|
|
255
|
+
if (typeof entry !== "object" || entry === null)
|
|
256
|
+
continue;
|
|
257
|
+
const { command, description, when } = entry;
|
|
258
|
+
if (typeof command !== "string" || typeof description !== "string")
|
|
259
|
+
continue;
|
|
260
|
+
steps.push({ command, description, ...(typeof when === "string" && { when }) });
|
|
261
|
+
}
|
|
262
|
+
return steps.length > 0 ? steps : undefined;
|
|
263
|
+
}
|
|
28
264
|
export function formatApiError(action, data) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
265
|
+
// Accept Naive `{ error: { code, message } }`, proxy shapes where `error` is a
|
|
266
|
+
// string (Supabase Storage), or a bare `{ message }` — never collapse to opaque
|
|
267
|
+
// `unknown` when the upstream already said something useful.
|
|
268
|
+
const payload = data && typeof data === "object" ? data : null;
|
|
269
|
+
const rawError = payload?.error;
|
|
270
|
+
let details;
|
|
271
|
+
if (rawError && typeof rawError === "object" && !Array.isArray(rawError)) {
|
|
272
|
+
details = rawError;
|
|
273
|
+
}
|
|
274
|
+
else if (typeof rawError === "string" && rawError) {
|
|
275
|
+
const message = typeof payload?.message === "string" && payload.message ? payload.message : rawError;
|
|
276
|
+
details = { code: "upstream_error", message };
|
|
277
|
+
}
|
|
278
|
+
else if (typeof payload?.message === "string" && payload.message) {
|
|
279
|
+
details = { code: "upstream_error", message: payload.message };
|
|
36
280
|
}
|
|
37
|
-
|
|
281
|
+
if (details) {
|
|
38
282
|
agentError({
|
|
39
283
|
action,
|
|
40
|
-
error:
|
|
41
|
-
|
|
284
|
+
error: details,
|
|
285
|
+
// A governance denial carries its own recovery — the DECISION POINT knows
|
|
286
|
+
// the way out and this local table does not. Server steps win when both
|
|
287
|
+
// gates in serverRecoverySteps() are satisfied.
|
|
288
|
+
recovery_steps: serverRecoverySteps(data) ?? getRecoverySteps(details.code),
|
|
42
289
|
});
|
|
290
|
+
return;
|
|
43
291
|
}
|
|
292
|
+
agentError({
|
|
293
|
+
action,
|
|
294
|
+
error: {
|
|
295
|
+
code: "unknown",
|
|
296
|
+
message: "Unexpected error response",
|
|
297
|
+
body_snippet: data == null ? undefined : JSON.stringify(data).slice(0, 300),
|
|
298
|
+
},
|
|
299
|
+
recovery_steps: getRecoverySteps("unknown"),
|
|
300
|
+
});
|
|
44
301
|
}
|
|
45
302
|
function getRecoverySteps(code) {
|
|
46
303
|
switch (code) {
|
|
@@ -51,15 +308,15 @@ function getRecoverySteps(code) {
|
|
|
51
308
|
];
|
|
52
309
|
case "insufficient_credits":
|
|
53
310
|
return [
|
|
54
|
-
{ command: "naive billing topup --pack medium", description: "Buy
|
|
55
|
-
{ command: "naive billing topup --pack large", description: "Buy
|
|
56
|
-
{ command: "naive billing upgrade --plan pro", description: "Upgrade to Pro (
|
|
311
|
+
{ command: "naive billing topup --pack medium", description: "Buy 500 credits for $23 (Popular)" },
|
|
312
|
+
{ command: "naive billing topup --pack large", description: "Buy 1000 credits for $44 (Best Value)" },
|
|
313
|
+
{ command: "naive billing upgrade --plan pro", description: "Upgrade to Pro (2000 credits/mo, $149/mo)" },
|
|
57
314
|
{ command: "naive billing packs", description: "See all available credit packs" },
|
|
58
315
|
];
|
|
59
316
|
case "billing_blocked":
|
|
60
317
|
return [
|
|
61
|
-
{ command: "naive billing subscribe --plan starter", description: "Subscribe to Starter ($49/mo,
|
|
62
|
-
{ command: "naive billing subscribe --plan pro", description: "Subscribe to Pro ($149/mo,
|
|
318
|
+
{ command: "naive billing subscribe --plan starter", description: "Subscribe to Starter ($49/mo, 500 credits)" },
|
|
319
|
+
{ command: "naive billing subscribe --plan pro", description: "Subscribe to Pro ($149/mo, 2000 credits)" },
|
|
63
320
|
{ command: "naive billing plans", description: "Compare all plans" },
|
|
64
321
|
];
|
|
65
322
|
case "rate_limited":
|
|
@@ -75,6 +332,28 @@ function getRecoverySteps(code) {
|
|
|
75
332
|
return [
|
|
76
333
|
{ command: "naive <command> --help", description: "See required parameters and examples" },
|
|
77
334
|
];
|
|
335
|
+
case "voice_revoked":
|
|
336
|
+
return [
|
|
337
|
+
{ command: "naive voice list", description: "List voices that are still available" },
|
|
338
|
+
{ command: "# this voice's consent was revoked", description: "Pick another voice, or have an admin re-create it in the Studio UI" },
|
|
339
|
+
];
|
|
340
|
+
case "voice_reclone_required":
|
|
341
|
+
return [
|
|
342
|
+
{ command: "naive voice list", description: "Check the voice's tier/status" },
|
|
343
|
+
{ command: "# the requested tier has no clone", description: "Use the voice's native tier, or have an admin re-clone for that tier in Studio" },
|
|
344
|
+
];
|
|
345
|
+
// Transport-level failure: the gateway returned a non-JSON body (502/503/504
|
|
346
|
+
// HTML page). Idempotent GETs were already retried in the client; a failed POST
|
|
347
|
+
// (e.g. llm chat) is NOT auto-retried to avoid a double-charge — the user retries.
|
|
348
|
+
case "upstream_error":
|
|
349
|
+
return [
|
|
350
|
+
{ command: "# retry — gateway timeouts (502/504) are usually transient", description: "Re-run your command in a moment" },
|
|
351
|
+
{ command: "naive status", description: "Check API connectivity" },
|
|
352
|
+
{
|
|
353
|
+
command: 'naive report "<what failed>" --command "<the command you ran>" --kind error',
|
|
354
|
+
description: "Report it to the naive team if it persists",
|
|
355
|
+
},
|
|
356
|
+
];
|
|
78
357
|
// Genuinely-broken-on-our-side codes — these are worth reporting (unlike the
|
|
79
358
|
// self-correctable cases above). Retry first (often transient), then report.
|
|
80
359
|
case "provider_error":
|
|
@@ -86,9 +365,24 @@ function getRecoverySteps(code) {
|
|
|
86
365
|
description: "Report it to the naive team if it persists",
|
|
87
366
|
},
|
|
88
367
|
];
|
|
368
|
+
// Opaque / unexpected failures (non-JSON gateway body already mapped, or API
|
|
369
|
+
// returned an untyped error). Agents only file tickets when recovery_steps
|
|
370
|
+
// tell them to — without this, `unknown` silently becomes "check status".
|
|
371
|
+
case "unknown":
|
|
372
|
+
return [
|
|
373
|
+
{ command: "naive status", description: "Check API connectivity and auth status" },
|
|
374
|
+
{
|
|
375
|
+
command: 'naive report "<what failed — paste the error JSON>" --command "<the command you ran>" --kind error',
|
|
376
|
+
description: "File a tracked report — unexpected errors are product bugs until proven otherwise",
|
|
377
|
+
},
|
|
378
|
+
];
|
|
89
379
|
default:
|
|
90
380
|
return [
|
|
91
381
|
{ command: "naive status", description: "Check API connectivity and auth status" },
|
|
382
|
+
{
|
|
383
|
+
command: 'naive report "<what failed — paste the error JSON>" --command "<the command you ran>" --kind error',
|
|
384
|
+
description: "If this is not a credits/auth/invalid-input issue you can fix yourself, report it",
|
|
385
|
+
},
|
|
92
386
|
];
|
|
93
387
|
}
|
|
94
388
|
}
|
package/dist/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,MAAM,UAAU,WAAW,CAAC,IAO3B;IACC,MAAM,MAAM,GAAgB;QAC1B,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACxC,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,EAAE,gBAAgB,EAAE,IAAI,C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,WAAW,EAAE,wBAAwB,EAAE;gBAClE;oBACE,OAAO,EAAE,6EAA6E;oBACtF,WAAW,EAAE,4CAA4C;iBAC1D;aACF,CAAC;QACJ,6EAA6E;QAC7E,6EAA6E;QAC7E,KAAK,gBAAgB,CAAC;QACtB,KAAK,gBAAgB;YACnB,OAAO;gBACL,EAAE,OAAO,EAAE,wDAAwD,EAAE,WAAW,EAAE,6BAA6B,EAAE;gBACjH;oBACE,OAAO,EAAE,6EAA6E;oBACtF,WAAW,EAAE,4CAA4C;iBAC1D;aACF,CAAC;QACJ,6EAA6E;QAC7E,2EAA2E;QAC3E,0EAA0E;QAC1E,KAAK,SAAS;YACZ,OAAO;gBACL,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,wCAAwC,EAAE;gBAClF;oBACE,OAAO,EAAE,oGAAoG;oBAC7G,WAAW,EAAE,mFAAmF;iBACjG;aACF,CAAC;QACJ;YACE,OAAO;gBACL,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,wCAAwC,EAAE;gBAClF;oBACE,OAAO,EAAE,oGAAoG;oBAC7G,WAAW,EAAE,mFAAmF;iBACjG;aACF,CAAC;IACN,CAAC;AACH,CAAC"}
|
package/dist/prompt.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Free-text answer. Returns null on timeout/abort. */
|
|
2
|
+
export declare function ask(label: string, opts?: {
|
|
3
|
+
default?: string;
|
|
4
|
+
}): Promise<string | null>;
|
|
5
|
+
/** Yes/No. Default NO (returns false on timeout, empty, or anything not starting with y). */
|
|
6
|
+
export declare function confirm(label: string): Promise<boolean>;
|
|
7
|
+
/** Affirmation: Enter (empty) OR 'y' = affirm; 'n'/anything else/timeout = cancel. For consent
|
|
8
|
+
* disclosures where the user has read the terms and presses Enter to take responsibility. */
|
|
9
|
+
export declare function affirm(label: string): Promise<boolean>;
|
|
10
|
+
/** Type-to-confirm for irreversible actions (GitHub-delete pattern). True only if the typed text
|
|
11
|
+
* matches `expected` exactly. Default-deny on timeout/mismatch. */
|
|
12
|
+
export declare function confirmExact(label: string, expected: string): Promise<boolean>;
|
|
13
|
+
/** Numbered single-select. Returns the chosen value, or null on timeout/invalid. */
|
|
14
|
+
export declare function select(label: string, choices: {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}[]): Promise<string | null>;
|
package/dist/prompt.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Minimal interactive prompts built on Node's built-in readline/promises — NO new dependency
|
|
2
|
+
// (deliberate: this is a credential-handling CLI; a prompt lib would run in the same process as the
|
|
3
|
+
// session token + api_key). Every prompt has a hard timeout that resolves to a SAFE default, so a
|
|
4
|
+
// pty-wrapped caller that somehow reaches a prompt times out into abort instead of hanging forever.
|
|
5
|
+
// Callers MUST gate these on isInteractive() (human mode + interactive stdin) — these helpers do not
|
|
6
|
+
// re-check that themselves.
|
|
7
|
+
import * as readline from "node:readline/promises";
|
|
8
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
9
|
+
async function question(q, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
10
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
11
|
+
let timer;
|
|
12
|
+
try {
|
|
13
|
+
const timeout = new Promise((resolve) => {
|
|
14
|
+
timer = setTimeout(() => {
|
|
15
|
+
process.stdout.write("\n(timed out — aborting)\n");
|
|
16
|
+
resolve(null);
|
|
17
|
+
}, timeoutMs);
|
|
18
|
+
});
|
|
19
|
+
const answer = rl.question(q).then((a) => a);
|
|
20
|
+
const result = await Promise.race([answer, timeout]);
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
if (timer)
|
|
25
|
+
clearTimeout(timer);
|
|
26
|
+
rl.close();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Free-text answer. Returns null on timeout/abort. */
|
|
30
|
+
export async function ask(label, opts = {}) {
|
|
31
|
+
const suffix = opts.default ? ` [${opts.default}]` : "";
|
|
32
|
+
const a = await question(`${label}${suffix}: `);
|
|
33
|
+
if (a === null)
|
|
34
|
+
return null;
|
|
35
|
+
const trimmed = a.trim();
|
|
36
|
+
return trimmed === "" && opts.default !== undefined ? opts.default : trimmed;
|
|
37
|
+
}
|
|
38
|
+
/** Yes/No. Default NO (returns false on timeout, empty, or anything not starting with y). */
|
|
39
|
+
export async function confirm(label) {
|
|
40
|
+
const a = await question(`${label} (y/N): `);
|
|
41
|
+
return a !== null && a.trim().toLowerCase().startsWith("y");
|
|
42
|
+
}
|
|
43
|
+
/** Affirmation: Enter (empty) OR 'y' = affirm; 'n'/anything else/timeout = cancel. For consent
|
|
44
|
+
* disclosures where the user has read the terms and presses Enter to take responsibility. */
|
|
45
|
+
export async function affirm(label) {
|
|
46
|
+
const a = await question(`${label} [Enter to affirm, 'n' to cancel]: `);
|
|
47
|
+
if (a === null)
|
|
48
|
+
return false; // timeout = cancel (safe)
|
|
49
|
+
const t = a.trim().toLowerCase();
|
|
50
|
+
return t === "" || t.startsWith("y");
|
|
51
|
+
}
|
|
52
|
+
/** Type-to-confirm for irreversible actions (GitHub-delete pattern). True only if the typed text
|
|
53
|
+
* matches `expected` exactly. Default-deny on timeout/mismatch. */
|
|
54
|
+
export async function confirmExact(label, expected) {
|
|
55
|
+
const a = await question(`${label}: `);
|
|
56
|
+
return a !== null && a.trim() === expected;
|
|
57
|
+
}
|
|
58
|
+
/** Numbered single-select. Returns the chosen value, or null on timeout/invalid. */
|
|
59
|
+
export async function select(label, choices) {
|
|
60
|
+
process.stdout.write(`${label}\n`);
|
|
61
|
+
choices.forEach((c, i) => process.stdout.write(` ${i + 1}) ${c.label}\n`));
|
|
62
|
+
const a = await question(`Choose 1-${choices.length}: `);
|
|
63
|
+
if (a === null)
|
|
64
|
+
return null;
|
|
65
|
+
const n = parseInt(a.trim(), 10);
|
|
66
|
+
if (Number.isNaN(n) || n < 1 || n > choices.length)
|
|
67
|
+
return null;
|
|
68
|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CAAC,KAAa,EAAE,QAAgB;IAChE,MAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;IACvC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,QAAQ,CAAC;AAC7C,CAAC;AAED,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,KAAa,EAAE,OAA2C;IACrF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;IACnC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAC5E,MAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,YAAY,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACjC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAChE,OAAO,OAAO,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC,KAAK,CAAC;AAC/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usenaive-sdk/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Naïve CLI — provision and govern a real-world agent profile per agent (identity, card, comms, runtime). Formerly @usenaive/cli.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,18 +14,23 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"commander": "^13.1.0",
|
|
18
17
|
"chalk": "^5.4.1",
|
|
19
|
-
"
|
|
18
|
+
"commander": "^13.1.0",
|
|
19
|
+
"jiti": "^2.4.2",
|
|
20
|
+
"semver": "^7.6.3",
|
|
21
|
+
"update-notifier": "^7.3.1"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
|
-
"@types/node": "^22.
|
|
24
|
+
"@types/node": "^22.19.17",
|
|
25
|
+
"@types/semver": "^7.5.8",
|
|
23
26
|
"tsx": "^4.19.4",
|
|
24
|
-
"typescript": "^5.7.3"
|
|
27
|
+
"typescript": "^5.7.3",
|
|
28
|
+
"vitest": "^2.1.9"
|
|
25
29
|
},
|
|
26
30
|
"scripts": {
|
|
27
31
|
"dev": "tsx src/index.ts",
|
|
28
32
|
"build": "tsc",
|
|
29
|
-
"typecheck": "tsc --noEmit"
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"test": "vitest run"
|
|
30
35
|
}
|
|
31
36
|
}
|