@usenaive-sdk/cli 0.14.0 → 0.15.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.
@@ -0,0 +1,231 @@
1
+ /**
2
+ * THE LLM ROUTER REFUSES TRIAL CREDIT — how the CLI says so.
3
+ *
4
+ * ── WHAT CHANGED UPSTREAM ───────────────────────────────────────────────────
5
+ *
6
+ * The signup grant (20 credits, $1.00) is spendable on every primitive this
7
+ * platform has except one: raw model routing. A company earns the router by
8
+ * having paid for something — a subscription, or a credit pack — and never by
9
+ * having been given credit. The API answers an unentitled router call with 402
10
+ * `llm_routing_requires_payment`, the same string again in
11
+ * `details.block_reason`.
12
+ *
13
+ * That is a NEW KIND of refusal for this CLI and it must not be rendered like
14
+ * the old ones:
15
+ *
16
+ * - It is not `insufficient_credits`. The balance may be 20, or 20,000 of
17
+ * comped credit; buying nothing and waiting changes nothing. Telling the
18
+ * caller "you are low on credits" would be false and would send them to
19
+ * `naive usage` to look at a number that is fine.
20
+ * - It is not transient. Every existing 1-exit invites a retry, and an agent
21
+ * with a retry budget will spend all of it here.
22
+ * - It is not the CLI's to resolve. There are exactly two ways out, both of
23
+ * them spend the operator's money, and they differ (recurring vs one-off).
24
+ *
25
+ * ── SO IT IS A DECISION, NOT AN ERROR ───────────────────────────────────────
26
+ *
27
+ * This module turns the 402 into a {@link DecisionRequired}: the question in the
28
+ * human's words, the reason the CLI will not answer it, and the ways out as
29
+ * stable ids plus the exact command that takes each. It exits
30
+ * {@link EXIT_DECISION_REQUIRED} (4), not 1, so a harness can route the run to
31
+ * its operator on the exit code alone.
32
+ *
33
+ * At a real interactive terminal it asks. Everywhere else — which is every
34
+ * agent, because this CLI's output mode is opt-in human and machine mode is the
35
+ * default (see the header of output.ts) — it prints the choice and stops. It
36
+ * never picks. An agent that guesses here buys a subscription nobody asked for.
37
+ *
38
+ * ── WHY THE COMMANDS ARE ONLY PRINTED, NEVER RUN ────────────────────────────
39
+ *
40
+ * A chosen option is echoed, not executed, even after a human picked it at the
41
+ * prompt. `naive billing subscribe` and `naive billing topup` open a Stripe
42
+ * checkout; a "y" typed into a prompt that appeared unbidden in the middle of an
43
+ * unrelated `naive llm chat` is not consent to start a payment flow. The human
44
+ * chooses the ROUTE here and takes it themselves, on purpose, in one more
45
+ * keystroke.
46
+ */
47
+ import { select } from "../prompt.js";
48
+ import { agentDecisionRequired, isInteractive, serverRecoverySteps, } from "../output.js";
49
+ /**
50
+ * The wire token for this refusal. It is BOTH `error.code` and
51
+ * `error.details.block_reason` — the API emits the same string in both places
52
+ * on purpose (platform/billing/src/llm-access.ts), so a consumer that switches
53
+ * on the reason needs no mapping from the code.
54
+ *
55
+ * Matching on either and never on the MESSAGE: prose is the thing most likely
56
+ * to be reworded, and a CLI that string-matches it goes silently generic the
57
+ * first time someone improves the sentence.
58
+ *
59
+ * The code is dedicated rather than a `billing_blocked` variant, and that
60
+ * distinction is the whole point: `billing_blocked` and `insufficient_credits`
61
+ * both mean "get more credit", which here is the one action that provably
62
+ * cannot work. Sharing a code would have made the two indistinguishable to
63
+ * exactly the population that has to distinguish them.
64
+ */
65
+ export const LLM_ROUTING_ERROR_CODE = "llm_routing_requires_payment";
66
+ /** Alias kept because the same string is also the `details.block_reason` value. */
67
+ export const LLM_ROUTING_BLOCK_REASON = LLM_ROUTING_ERROR_CODE;
68
+ /**
69
+ * Is this response the router's paid-account refusal? Returns the parts worth
70
+ * rendering, or null for every other body.
71
+ *
72
+ * `code` OR `block_reason` satisfies it, and `block_reason` is read from BOTH
73
+ * positions, because `NaiveError.toJSON()` emits `details` nested AND spread
74
+ * (platform/kernel/src/errors.ts) — a reader that picks one position is betting
75
+ * on which half gets retired first, and a reader that requires both is broken
76
+ * by whichever goes.
77
+ */
78
+ export function llmRoutingRefusal(data) {
79
+ if (typeof data !== "object" || data === null)
80
+ return null;
81
+ const err = data.error;
82
+ if (typeof err !== "object" || err === null)
83
+ return null;
84
+ const e = err;
85
+ const details = (typeof e.details === "object" && e.details !== null ? e.details : {});
86
+ const matches = e.code === LLM_ROUTING_ERROR_CODE ||
87
+ e.block_reason === LLM_ROUTING_BLOCK_REASON ||
88
+ details.block_reason === LLM_ROUTING_BLOCK_REASON;
89
+ if (!matches)
90
+ return null;
91
+ const str = (k) => {
92
+ const v = e[k] ?? details[k];
93
+ return typeof v === "string" && v ? v : undefined;
94
+ };
95
+ const rawBalance = typeof e.balance === "number" ? e.balance : details.balance;
96
+ return {
97
+ ...(str("code") && { code: str("code") }),
98
+ ...(str("message") && { message: str("message") }),
99
+ ...(str("hint") && { hint: str("hint") }),
100
+ ...(str("docs") && { docs: str("docs") }),
101
+ ...(str("balance_note") && { balance_note: str("balance_note") }),
102
+ ...(str("credit_kind") && { credit_kind: str("credit_kind") }),
103
+ ...(typeof rawBalance === "number" && Number.isFinite(rawBalance) && { balance: rawBalance }),
104
+ };
105
+ }
106
+ /**
107
+ * The fallback sentence, used when the server sent no message of its own.
108
+ *
109
+ * It names what trial credit DOES buy. A refusal that only says "no" reads as a
110
+ * paywall on the product; this one is a control on one primitive, and a new
111
+ * account that has just been handed 20 credits deserves to hear that the other
112
+ * twenty-odd primitives still take them.
113
+ */
114
+ export const LLM_PAYWALL_MESSAGE = "The LLM router requires paid credit. Free signup credits spend on every other primitive — " +
115
+ "email, search, images, brain, runtime — but not on raw model routing.";
116
+ export const LLM_PAYWALL_QUESTION = "The LLM router needs paid credit on this account. Add a subscription, buy credits, or stop here?";
117
+ const LLM_PAYWALL_BECAUSE = "Both ways out spend real money, and they are not the same deal — one is recurring, one is not. " +
118
+ "The CLI will not choose that for you.";
119
+ /** The ways out, in the order a first-time caller should weigh them. */
120
+ export function llmPaywallOptions() {
121
+ return [
122
+ {
123
+ id: "topup",
124
+ label: "Buy credits once — 500 credits for $23",
125
+ command: "naive billing topup --pack medium",
126
+ description: "One-time purchase, no subscription. Unlocks the router permanently.",
127
+ },
128
+ {
129
+ id: "subscribe",
130
+ label: "Subscribe to Pro — $20/mo, 400 credits every month",
131
+ command: "naive billing subscribe --plan pro",
132
+ description: "Recurring. Unlocks the router and refills the balance monthly.",
133
+ },
134
+ {
135
+ id: "not_now",
136
+ label: "Neither — do not route this call",
137
+ command: "# nothing to run; the model call did not happen and nothing was charged",
138
+ description: "Every other primitive still works on the credits already on the account.",
139
+ },
140
+ ];
141
+ }
142
+ /**
143
+ * The `recovery_steps` array. It stays a LIST OF READS, not of purchases: the
144
+ * purchases live in `decision_required.options`, where the envelope is explicit
145
+ * that a human has to choose one. Putting `topup` in both places would let an
146
+ * agent that only reads `recovery_steps` — the habit every other error on this
147
+ * surface teaches — treat "buy something" as a step it is cleared to take.
148
+ */
149
+ export function llmPaywallRecoverySteps() {
150
+ return [
151
+ {
152
+ command: "# ask the operator: subscribe, buy credits, or drop the LLM call?",
153
+ description: "This refusal needs a human decision — see decision_required.options",
154
+ },
155
+ { command: "naive billing packs", description: "Show the credit packs and their prices" },
156
+ { command: "naive billing plans", description: "Show the subscription plans and the current one" },
157
+ { command: "naive billing status", description: "Show the balance and the plan currently on this account" },
158
+ ];
159
+ }
160
+ function decision(chosen) {
161
+ return {
162
+ question: LLM_PAYWALL_QUESTION,
163
+ because: LLM_PAYWALL_BECAUSE,
164
+ options: llmPaywallOptions(),
165
+ chosen,
166
+ };
167
+ }
168
+ /**
169
+ * The `error` half of the envelope. The server's own code, sentence, hint and
170
+ * docs are ECHOED, not replaced — it is the decision point, and a CLI that
171
+ * substitutes its own copy makes the terminal and the API disagree about why a
172
+ * call was refused. The fallbacks below only fire against an API build that
173
+ * sent nothing.
174
+ */
175
+ function errorDetails(refusal) {
176
+ return {
177
+ code: refusal.code ?? LLM_ROUTING_ERROR_CODE,
178
+ // Kept alongside the code even though they carry the same string: consumers
179
+ // that switch on the reason (and older ones that only know `billing_blocked`)
180
+ // read this field, and dropping it would break them for no gain.
181
+ block_reason: LLM_ROUTING_BLOCK_REASON,
182
+ message: refusal.message ?? LLM_PAYWALL_MESSAGE,
183
+ ...(refusal.hint && { hint: refusal.hint }),
184
+ ...(refusal.docs && { docs: refusal.docs }),
185
+ ...(refusal.credit_kind && { credit_kind: refusal.credit_kind }),
186
+ ...(refusal.balance !== undefined && {
187
+ balance: refusal.balance,
188
+ // Said explicitly because the number alone reads as a contradiction: the
189
+ // account has credit and the call was still refused. The API sends this
190
+ // sentence itself; the fallback is for a build that does not.
191
+ balance_note: refusal.balance_note ??
192
+ `The balance of ${refusal.balance} credit${refusal.balance === 1 ? "" : "s"} is not the problem — ` +
193
+ "free and comped credit cannot pay for model routing, however much of it there is.",
194
+ }),
195
+ // 🔴 The field that stops the loop. Every other failure this CLI emits is
196
+ // worth one more attempt; this one is worth none, ever, until a human buys
197
+ // something.
198
+ retryable: false,
199
+ };
200
+ }
201
+ /**
202
+ * Intercept the router's paid-account refusal. Returns true when it handled the
203
+ * response, in which case the caller MUST return without calling
204
+ * `handleApiError` — that would emit a second envelope and exit 1 over the top
205
+ * of this one.
206
+ *
207
+ * Returns false for every other response, including a healthy one, so a call
208
+ * site reads as one line ahead of its normal error handling.
209
+ */
210
+ export async function handleLlmRoutingRefusal(action, resp) {
211
+ const refusal = llmRoutingRefusal(resp.data);
212
+ if (!refusal)
213
+ return false;
214
+ // A real person, at a real terminal: ask. `isInteractive()` is human mode AND
215
+ // a TTY stdin — a pty-wrapped agent harness reports isTTY true, which is
216
+ // exactly why output mode is opt-in and why this predicate and not
217
+ // `process.stdin.isTTY` is the gate.
218
+ const chosen = isInteractive()
219
+ ? await select(`\n${LLM_PAYWALL_QUESTION}\n`, llmPaywallOptions().map((o) => ({ value: o.id, label: `${o.label}\n ${o.command}` })))
220
+ : null;
221
+ agentDecisionRequired({
222
+ action,
223
+ error: errorDetails(refusal),
224
+ // The server is the decision point and may know a recovery this table does
225
+ // not (06 §1.8); its steps win when it supplied them under a verdict.
226
+ decision: decision(chosen),
227
+ recovery_steps: serverRecoverySteps(resp.data) ?? llmPaywallRecoverySteps(),
228
+ });
229
+ return true;
230
+ }
231
+ //# sourceMappingURL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AC,IAAI,CAAC;IAET,qBAAqB,CAAC;QACpB,MAAM;QACN,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC;QAC5B,2EAA2E;QAC3E,sEAAsE;QACtE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC;QAC1B,cAAc,EAAE,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,uBAAuB,EAAE;KAC5E,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/output.d.ts CHANGED
@@ -80,6 +80,49 @@ export interface AgentOutput {
80
80
  update?: UpdateInfo;
81
81
  deprecation?: DeprecationNotice;
82
82
  }
83
+ /**
84
+ * EXIT 4 — "a human has to decide this, and nothing was done."
85
+ *
86
+ * The ladder so far is 0 success · 1 error · 2 success-with-a-diff · 3
87
+ * success-where-the-terminal-state-is-not-success (README, `naive teams`). All
88
+ * four answer the question "did the work happen". None of them answers "the
89
+ * work is BLOCKED on a choice only a person can make", and collapsing that into
90
+ * 1 is what makes an agent retry: a generic failure looks transient, so it runs
91
+ * the same command again, gets the same 402, and loops.
92
+ *
93
+ * 4 says the opposite — re-running changes nothing, and the next move belongs
94
+ * to a human. A harness can branch on the code alone, without parsing the body,
95
+ * and route the run to its operator instead of to its retry budget.
96
+ */
97
+ export declare const EXIT_DECISION_REQUIRED = 4;
98
+ /** One way out of a {@link DecisionRequired}, as the exact command that takes it. */
99
+ export interface DecisionOption {
100
+ /** Stable machine id — an agent reports this back to its human, not the prose label. */
101
+ id: string;
102
+ /** The choice in the human's terms ("Subscribe to Pro — $20/mo"). */
103
+ label: string;
104
+ /** The exact command that takes this option. `#`-prefixed when it is a no-op. */
105
+ command: string;
106
+ description: string;
107
+ }
108
+ /**
109
+ * A refusal that is NOT the CLI's to resolve: the way forward is known, there is
110
+ * more than one of them, and each spends the operator's money or changes their
111
+ * plan. Emitting the options and refusing to pick is the whole point — an agent
112
+ * that guesses here buys a subscription nobody asked for.
113
+ *
114
+ * `chosen` is `null` on every non-interactive emission and stays null in the
115
+ * JSON envelope: it is the field an agent reads to know that nothing was
116
+ * decided. It is set only when a real human picked at a real prompt.
117
+ */
118
+ export interface DecisionRequired {
119
+ /** Asked of the HUMAN, verbatim — an agent can relay this string unchanged. */
120
+ question: string;
121
+ /** Why the CLI will not answer it itself. */
122
+ because: string;
123
+ options: DecisionOption[];
124
+ chosen: string | null;
125
+ }
83
126
  export interface AgentErrorDetails {
84
127
  code?: string;
85
128
  message?: string;
@@ -155,6 +198,32 @@ export declare function agentError(opts: {
155
198
  error: AgentErrorDetails;
156
199
  recovery_steps: NextStep[];
157
200
  }): void;
201
+ /**
202
+ * THE REFUSAL THAT NEEDS A PERSON — `success:false`, exit {@link EXIT_DECISION_REQUIRED}.
203
+ *
204
+ * Shaped like `agentError` (same stdout channel, same `error` + `recovery_steps`
205
+ * keys, so nothing downstream needs a new parser) with two deliberate
206
+ * differences:
207
+ *
208
+ * 1. It carries `decision_required`, which names the question in the human's
209
+ * own words and lists the ways out as ids + exact commands. An agent
210
+ * relays that object to its operator; it does not pick from it.
211
+ * 2. It sets `process.exitCode` instead of calling `process.exit()`. The same
212
+ * reason as `agentOutputExit`: the payload may still be buffered when
213
+ * stdout is a pipe, and a hard exit truncates the very JSON the caller
214
+ * needs. Callers `return` after this; they must not keep working.
215
+ *
216
+ * HUMAN mode gets the same content as a readable block on stderr, including the
217
+ * numbered options — a person who is not at an interactive terminal (output
218
+ * piped to `tee`, a `--human` run in CI) still needs to see the choice rather
219
+ * than a bare red line.
220
+ */
221
+ export declare function agentDecisionRequired(opts: {
222
+ action: string;
223
+ error: AgentErrorDetails;
224
+ decision: DecisionRequired;
225
+ recovery_steps: NextStep[];
226
+ }): void;
158
227
  /**
159
228
  * 06 §1.8 — when a response body carries a governance `verdict`, the DECISION
160
229
  * POINT knows the recovery and the CLI's local `switch (code)` does not. The
@@ -172,3 +241,6 @@ export declare function agentError(opts: {
172
241
  */
173
242
  export declare function serverRecoverySteps(data: unknown): NextStep[] | undefined;
174
243
  export declare function formatApiError(action: string, data: unknown): void;
244
+ /** Exported for the parity test that holds the `llm_routing_requires_payment`
245
+ * case equal to `llmPaywallRecoverySteps()` in lib/llm-paywall.ts. */
246
+ export declare function getRecoverySteps(code?: string): NextStep[];
package/dist/output.js CHANGED
@@ -150,6 +150,21 @@ export function creditEstimateHint(result) {
150
150
  const credits = Math.round(raw * 10000) / 10000;
151
151
  return `Estimated cost: ${credits} ${credits === 1 ? "credit" : "credits"} (charged only on successful completion)`;
152
152
  }
153
+ /**
154
+ * EXIT 4 — "a human has to decide this, and nothing was done."
155
+ *
156
+ * The ladder so far is 0 success · 1 error · 2 success-with-a-diff · 3
157
+ * success-where-the-terminal-state-is-not-success (README, `naive teams`). All
158
+ * four answer the question "did the work happen". None of them answers "the
159
+ * work is BLOCKED on a choice only a person can make", and collapsing that into
160
+ * 1 is what makes an agent retry: a generic failure looks transient, so it runs
161
+ * the same command again, gets the same 402, and loops.
162
+ *
163
+ * 4 says the opposite — re-running changes nothing, and the next move belongs
164
+ * to a human. A harness can branch on the code alone, without parsing the body,
165
+ * and route the run to its operator instead of to its retry budget.
166
+ */
167
+ export const EXIT_DECISION_REQUIRED = 4;
153
168
  // A pending, non-fatal update notice discovered by the client layer (from the
154
169
  // server version handshake). It rides along on the next successful agentOutput
155
170
  // and is cleared once emitted, so it surfaces exactly once per command.
@@ -253,6 +268,61 @@ export function agentError(opts) {
253
268
  console.log(JSON.stringify(output, null, 2));
254
269
  process.exit(1);
255
270
  }
271
+ /**
272
+ * THE REFUSAL THAT NEEDS A PERSON — `success:false`, exit {@link EXIT_DECISION_REQUIRED}.
273
+ *
274
+ * Shaped like `agentError` (same stdout channel, same `error` + `recovery_steps`
275
+ * keys, so nothing downstream needs a new parser) with two deliberate
276
+ * differences:
277
+ *
278
+ * 1. It carries `decision_required`, which names the question in the human's
279
+ * own words and lists the ways out as ids + exact commands. An agent
280
+ * relays that object to its operator; it does not pick from it.
281
+ * 2. It sets `process.exitCode` instead of calling `process.exit()`. The same
282
+ * reason as `agentOutputExit`: the payload may still be buffered when
283
+ * stdout is a pipe, and a hard exit truncates the very JSON the caller
284
+ * needs. Callers `return` after this; they must not keep working.
285
+ *
286
+ * HUMAN mode gets the same content as a readable block on stderr, including the
287
+ * numbered options — a person who is not at an interactive terminal (output
288
+ * piped to `tee`, a `--human` run in CI) still needs to see the choice rather
289
+ * than a bare red line.
290
+ */
291
+ export function agentDecisionRequired(opts) {
292
+ process.exitCode = EXIT_DECISION_REQUIRED;
293
+ if (humanMode()) {
294
+ const w = (s) => process.stderr.write(s);
295
+ w(chalk.yellow.bold(`✗ ${opts.action} — a decision is needed`) + "\n");
296
+ if (opts.error.message)
297
+ w(" " + opts.error.message + "\n");
298
+ if (opts.error.hint)
299
+ w(chalk.dim(" hint: " + opts.error.hint) + "\n");
300
+ // Already chosen at a prompt: the person has just read the menu, so echo the
301
+ // one route they picked instead of reprinting the list under it.
302
+ const picked = opts.decision.options.find((o) => o.id === opts.decision.chosen);
303
+ if (picked) {
304
+ w("\n " + chalk.bold(picked.label) + "\n");
305
+ w(picked.command.startsWith("#")
306
+ ? chalk.dim(` ${picked.description}`) + "\n"
307
+ : " Run: " + chalk.cyan(picked.command) + "\n");
308
+ return;
309
+ }
310
+ w("\n " + chalk.bold(opts.decision.question) + "\n");
311
+ w(chalk.dim(" " + opts.decision.because) + "\n\n");
312
+ opts.decision.options.forEach((o, i) => {
313
+ w(` ${i + 1}) ${o.label}\n`);
314
+ w(" " + chalk.cyan(o.command) + chalk.dim(` — ${o.description}`) + "\n");
315
+ });
316
+ return;
317
+ }
318
+ console.log(JSON.stringify({
319
+ success: false,
320
+ action: opts.action,
321
+ error: opts.error,
322
+ decision_required: opts.decision,
323
+ recovery_steps: opts.recovery_steps,
324
+ }, null, 2));
325
+ }
256
326
  /**
257
327
  * 06 §1.8 — when a response body carries a governance `verdict`, the DECISION
258
328
  * POINT knows the recovery and the CLI's local `switch (code)` does not. The
@@ -327,7 +397,9 @@ export function formatApiError(action, data) {
327
397
  recovery_steps: getRecoverySteps("unknown"),
328
398
  });
329
399
  }
330
- function getRecoverySteps(code) {
400
+ /** Exported for the parity test that holds the `llm_routing_requires_payment`
401
+ * case equal to `llmPaywallRecoverySteps()` in lib/llm-paywall.ts. */
402
+ export function getRecoverySteps(code) {
331
403
  switch (code) {
332
404
  case "unauthorized":
333
405
  return [
@@ -335,17 +407,67 @@ function getRecoverySteps(code) {
335
407
  { command: "naive login --email <email> --password <pw>", description: "Log in to existing account" },
336
408
  ];
337
409
  case "insufficient_credits":
410
+ // 🔴 NO `upgrade --plan pro` HERE. This table is keyed on the error code and
411
+ // nothing else — it cannot see who is reading it — so the line it used to
412
+ // carry ("Upgrade to Pro (400 credits/mo, $20/mo)") was handed to every
413
+ // subscriber, including the grandfathered $149/2000 and $49/500 ones, for
414
+ // whom it is a DOWNGRADE labelled an upgrade, one click from a real plan
415
+ // switch: `/v1/billing/upgrade` sends an active subscriber straight to the
416
+ // Stripe portal. `isUpgradeFrom()` exists to stop exactly that on the API
417
+ // and dashboard surfaces, and it needs the caller's own allowance, which a
418
+ // static table does not have.
419
+ //
420
+ // An empty wallet is a BALANCE problem anyway, not a subscription one: the
421
+ // remedy is credits. `naive billing plans` is the plan-aware surface — GET
422
+ // /v1/billing/plans answers with the reader's own terms and a hint that
423
+ // knows whether anything on sale is more than they already have.
338
424
  return [
339
425
  { command: "naive billing topup --pack medium", description: "Buy 500 credits for $23 (Popular)" },
340
426
  { command: "naive billing topup --pack large", description: "Buy 1000 credits for $44 (Best Value)" },
341
- { command: "naive billing upgrade --plan pro", description: "Upgrade to Pro (2000 credits/mo, $149/mo)" },
342
427
  { command: "naive billing packs", description: "See all available credit packs" },
428
+ { command: "naive billing plans", description: "See your plan's monthly credits and whether anything on sale includes more" },
343
429
  ];
344
430
  case "billing_blocked":
431
+ // ONE plan. The Starter line is gone because Starter is retired: nothing new
432
+ // may buy it, so `--plan starter` here would have handed a blocked customer a
433
+ // recovery step that returns 400. Existing Starter subscriptions are
434
+ // untouched — they recover through `naive billing portal`, which the
435
+ // subscription_past_due path already offers, not by re-subscribing.
436
+ //
437
+ // TOPUP IS FIRST. `billing_blocked` used to mean only "your subscription is
438
+ // in a bad state", for which subscribing is the whole answer. It now also
439
+ // carries the LLM-router refusal (block_reason
440
+ // `llm_routing_requires_payment`), whose cheapest door is a one-time credit
441
+ // pack — a caller told only to subscribe would be pushed onto a $20/mo
442
+ // recurring plan to make a $1 call. Both doors are listed for both cases
443
+ // because this table is keyed on the code and cannot see which one it is;
444
+ // the router refusal takes the `decision_required` path in
445
+ // lib/llm-paywall.ts, which does know, and does not consult this table.
446
+ return [
447
+ { command: "naive billing topup --pack medium", description: "Buy 500 credits for $23 — one-time, no subscription" },
448
+ { command: "naive billing subscribe --plan pro", description: "Subscribe to Pro ($20/mo, 400 credits)" },
449
+ { command: "naive billing plans", description: "See the current plan and your own" },
450
+ ];
451
+ // The LLM router refusing free/comped credit. `naive llm chat` never reaches
452
+ // this table — it intercepts the response first and emits the far richer
453
+ // `decision_required` envelope with exit 4 (lib/llm-paywall.ts). This case
454
+ // is the net for anything else that ever reaches the router, and the two
455
+ // lists are held identical by llm-paywall.test.ts.
456
+ //
457
+ // 🔴 NO PURCHASE COMMAND HERE, deliberately, and unlike every other case in
458
+ // this switch. `recovery_steps` is the array an agent is taught to just run;
459
+ // `naive billing subscribe` sitting in it is an instruction to start a
460
+ // payment nobody authorised. The purchases live in decision_required.options,
461
+ // where the envelope is explicit that a human picks one.
462
+ case "llm_routing_requires_payment":
345
463
  return [
346
- { command: "naive billing subscribe --plan starter", description: "Subscribe to Starter ($49/mo, 500 credits)" },
347
- { command: "naive billing subscribe --plan pro", description: "Subscribe to Pro ($149/mo, 2000 credits)" },
348
- { command: "naive billing plans", description: "Compare all plans" },
464
+ {
465
+ command: "# ask the operator: subscribe, buy credits, or drop the LLM call?",
466
+ description: "This refusal needs a human decision — see decision_required.options",
467
+ },
468
+ { command: "naive billing packs", description: "Show the credit packs and their prices" },
469
+ { command: "naive billing plans", description: "Show the subscription plans and the current one" },
470
+ { command: "naive billing status", description: "Show the balance and the plan currently on this account" },
349
471
  ];
350
472
  case "rate_limited":
351
473
  return [
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,IAAI,UAAU,GAAG,KAAK,CAAC;AACvB,6FAA6F;AAC7F,MAAM,UAAU,cAAc,CAAC,IAAyC;IACtE,IAAI,IAAI,CAAC,IAAI;QAAE,SAAS,GAAG,IAAI,CAAC;IAChC,IAAI,IAAI,CAAC,KAAK;QAAE,UAAU,GAAG,IAAI,CAAC;AACpC,CAAC;AACD,SAAS,aAAa;IACpB,OAAO,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AACnE,CAAC;AACD,8EAA8E;AAC9E,MAAM,UAAU,SAAS;IACvB,IAAI,aAAa,EAAE;QAAE,OAAO,KAAK,CAAC;IAClC,IAAI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAC/D,IAAI,CAAC;QACH,OAAO,UAAU,EAAE,CAAC,MAAM,KAAK,OAAO,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AACD;uGACuG;AACvG,MAAM,UAAU,aAAa;IAC3B,OAAO,SAAS,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AAC9C,CAAC;AAED,2GAA2G;AAC3G,SAAS,kBAAkB;IACzB,IAAI,CAAC,OAAO,CAAC,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iC,EAAE;gBACzH,EAAE,OAAO,EAAE,cAAc,EAAE,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usenaive-sdk/cli",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
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",