@usenaive-sdk/cli 0.15.0 → 1.0.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 +43 -354
- package/dist/index.js +51775 -502
- package/package.json +22 -18
- package/dist/client.d.ts +0 -108
- package/dist/client.js +0 -458
- package/dist/client.js.map +0 -1
- package/dist/commands/account-kits.d.ts +0 -2
- package/dist/commands/account-kits.js +0 -71
- package/dist/commands/account-kits.js.map +0 -1
- package/dist/commands/aeo.d.ts +0 -2
- package/dist/commands/aeo.js +0 -451
- package/dist/commands/aeo.js.map +0 -1
- package/dist/commands/agent-profiles.d.ts +0 -11
- package/dist/commands/agent-profiles.js +0 -120
- package/dist/commands/agent-profiles.js.map +0 -1
- package/dist/commands/agents.d.ts +0 -2
- package/dist/commands/agents.js +0 -916
- package/dist/commands/agents.js.map +0 -1
- package/dist/commands/app-data.d.ts +0 -2
- package/dist/commands/app-data.js +0 -445
- package/dist/commands/app-data.js.map +0 -1
- package/dist/commands/approvals.d.ts +0 -2
- package/dist/commands/approvals.js +0 -242
- package/dist/commands/approvals.js.map +0 -1
- package/dist/commands/apps.d.ts +0 -9
- package/dist/commands/apps.js +0 -844
- package/dist/commands/apps.js.map +0 -1
- package/dist/commands/audio.d.ts +0 -9
- package/dist/commands/audio.js +0 -391
- package/dist/commands/audio.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -31
- package/dist/commands/auth.js +0 -428
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/billing.d.ts +0 -2
- package/dist/commands/billing.js +0 -245
- package/dist/commands/billing.js.map +0 -1
- package/dist/commands/brain.d.ts +0 -2
- package/dist/commands/brain.js +0 -1300
- package/dist/commands/brain.js.map +0 -1
- package/dist/commands/browser.d.ts +0 -2
- package/dist/commands/browser.js +0 -378
- package/dist/commands/browser.js.map +0 -1
- package/dist/commands/business.d.ts +0 -2
- package/dist/commands/business.js +0 -566
- package/dist/commands/business.js.map +0 -1
- package/dist/commands/cards.d.ts +0 -2
- package/dist/commands/cards.js +0 -419
- package/dist/commands/cards.js.map +0 -1
- package/dist/commands/ceo.d.ts +0 -2
- package/dist/commands/ceo.js +0 -369
- package/dist/commands/ceo.js.map +0 -1
- package/dist/commands/clone.d.ts +0 -2
- package/dist/commands/clone.js +0 -203
- package/dist/commands/clone.js.map +0 -1
- package/dist/commands/companies.d.ts +0 -10
- package/dist/commands/companies.js +0 -283
- package/dist/commands/companies.js.map +0 -1
- package/dist/commands/company-data.d.ts +0 -2
- package/dist/commands/company-data.js +0 -168
- package/dist/commands/company-data.js.map +0 -1
- package/dist/commands/compute.d.ts +0 -2
- package/dist/commands/compute.js +0 -498
- package/dist/commands/compute.js.map +0 -1
- package/dist/commands/config.d.ts +0 -2
- package/dist/commands/config.js +0 -36
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/connections.d.ts +0 -8
- package/dist/commands/connections.js +0 -137
- package/dist/commands/connections.js.map +0 -1
- package/dist/commands/cron-jobs.d.ts +0 -2
- package/dist/commands/cron-jobs.js +0 -245
- package/dist/commands/cron-jobs.js.map +0 -1
- package/dist/commands/domains.d.ts +0 -2
- package/dist/commands/domains.js +0 -474
- package/dist/commands/domains.js.map +0 -1
- package/dist/commands/ecommerce.d.ts +0 -2
- package/dist/commands/ecommerce.js +0 -277
- package/dist/commands/ecommerce.js.map +0 -1
- package/dist/commands/email.d.ts +0 -2
- package/dist/commands/email.js +0 -336
- package/dist/commands/email.js.map +0 -1
- package/dist/commands/employees.d.ts +0 -2
- package/dist/commands/employees.js +0 -190
- package/dist/commands/employees.js.map +0 -1
- package/dist/commands/env.d.ts +0 -7
- package/dist/commands/env.js +0 -112
- package/dist/commands/env.js.map +0 -1
- package/dist/commands/formation.d.ts +0 -2
- package/dist/commands/formation.js +0 -273
- package/dist/commands/formation.js.map +0 -1
- package/dist/commands/identity.d.ts +0 -2
- package/dist/commands/identity.js +0 -110
- package/dist/commands/identity.js.map +0 -1
- package/dist/commands/images.d.ts +0 -2
- package/dist/commands/images.js +0 -371
- package/dist/commands/images.js.map +0 -1
- package/dist/commands/init.d.ts +0 -5
- package/dist/commands/init.js +0 -43
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/jobs.d.ts +0 -2
- package/dist/commands/jobs.js +0 -144
- package/dist/commands/jobs.js.map +0 -1
- package/dist/commands/keys.d.ts +0 -2
- package/dist/commands/keys.js +0 -156
- package/dist/commands/keys.js.map +0 -1
- package/dist/commands/legacy-auth.d.ts +0 -27
- package/dist/commands/legacy-auth.js +0 -64
- package/dist/commands/legacy-auth.js.map +0 -1
- package/dist/commands/llm.d.ts +0 -2
- package/dist/commands/llm.js +0 -106
- package/dist/commands/llm.js.map +0 -1
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.js +0 -65
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -7
- package/dist/commands/logout.js +0 -55
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/logs.d.ts +0 -2
- package/dist/commands/logs.js +0 -42
- package/dist/commands/logs.js.map +0 -1
- package/dist/commands/loops.d.ts +0 -2
- package/dist/commands/loops.js +0 -260
- package/dist/commands/loops.js.map +0 -1
- package/dist/commands/media.d.ts +0 -2
- package/dist/commands/media.js +0 -183
- package/dist/commands/media.js.map +0 -1
- package/dist/commands/memory.d.ts +0 -2
- package/dist/commands/memory.js +0 -151
- package/dist/commands/memory.js.map +0 -1
- package/dist/commands/mobile.d.ts +0 -4
- package/dist/commands/mobile.js +0 -382
- package/dist/commands/mobile.js.map +0 -1
- package/dist/commands/module.d.ts +0 -8
- package/dist/commands/module.js +0 -48
- package/dist/commands/module.js.map +0 -1
- package/dist/commands/objectives.d.ts +0 -2
- package/dist/commands/objectives.js +0 -243
- package/dist/commands/objectives.js.map +0 -1
- package/dist/commands/payments.d.ts +0 -2
- package/dist/commands/payments.js +0 -131
- package/dist/commands/payments.js.map +0 -1
- package/dist/commands/people.d.ts +0 -2
- package/dist/commands/people.js +0 -197
- package/dist/commands/people.js.map +0 -1
- package/dist/commands/phone.d.ts +0 -2
- package/dist/commands/phone.js +0 -289
- package/dist/commands/phone.js.map +0 -1
- package/dist/commands/projects.d.ts +0 -13
- package/dist/commands/projects.js +0 -220
- package/dist/commands/projects.js.map +0 -1
- package/dist/commands/queue.d.ts +0 -2
- package/dist/commands/queue.js +0 -121
- package/dist/commands/queue.js.map +0 -1
- package/dist/commands/register.d.ts +0 -2
- package/dist/commands/register.js +0 -80
- package/dist/commands/register.js.map +0 -1
- package/dist/commands/report.d.ts +0 -17
- package/dist/commands/report.js +0 -109
- package/dist/commands/report.js.map +0 -1
- package/dist/commands/sandbox.d.ts +0 -2
- package/dist/commands/sandbox.js +0 -558
- package/dist/commands/sandbox.js.map +0 -1
- package/dist/commands/search.d.ts +0 -2
- package/dist/commands/search.js +0 -223
- package/dist/commands/search.js.map +0 -1
- package/dist/commands/seo.d.ts +0 -2
- package/dist/commands/seo.js +0 -528
- package/dist/commands/seo.js.map +0 -1
- package/dist/commands/sessions.d.ts +0 -6
- package/dist/commands/sessions.js +0 -109
- package/dist/commands/sessions.js.map +0 -1
- package/dist/commands/social-data.d.ts +0 -2
- package/dist/commands/social-data.js +0 -245
- package/dist/commands/social-data.js.map +0 -1
- package/dist/commands/social.d.ts +0 -2
- package/dist/commands/social.js +0 -407
- package/dist/commands/social.js.map +0 -1
- package/dist/commands/status.d.ts +0 -2
- package/dist/commands/status.js +0 -73
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/support.d.ts +0 -2
- package/dist/commands/support.js +0 -134
- package/dist/commands/support.js.map +0 -1
- package/dist/commands/tasks.d.ts +0 -2
- package/dist/commands/tasks.js +0 -409
- package/dist/commands/tasks.js.map +0 -1
- package/dist/commands/teams.d.ts +0 -69
- package/dist/commands/teams.js +0 -503
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/trading.d.ts +0 -2
- package/dist/commands/trading.js +0 -333
- package/dist/commands/trading.js.map +0 -1
- package/dist/commands/up.d.ts +0 -551
- package/dist/commands/up.js +0 -1149
- package/dist/commands/up.js.map +0 -1
- package/dist/commands/usage.d.ts +0 -2
- package/dist/commands/usage.js +0 -73
- package/dist/commands/usage.js.map +0 -1
- package/dist/commands/use.d.ts +0 -12
- package/dist/commands/use.js +0 -96
- package/dist/commands/use.js.map +0 -1
- package/dist/commands/users.d.ts +0 -10
- package/dist/commands/users.js +0 -82
- package/dist/commands/users.js.map +0 -1
- package/dist/commands/vault.d.ts +0 -2
- package/dist/commands/vault.js +0 -101
- package/dist/commands/vault.js.map +0 -1
- package/dist/commands/verification.d.ts +0 -2
- package/dist/commands/verification.js +0 -152
- package/dist/commands/verification.js.map +0 -1
- package/dist/commands/verify-email.d.ts +0 -19
- package/dist/commands/verify-email.js +0 -112
- package/dist/commands/verify-email.js.map +0 -1
- package/dist/commands/video.d.ts +0 -2
- package/dist/commands/video.js +0 -417
- package/dist/commands/video.js.map +0 -1
- package/dist/commands/voice.d.ts +0 -2
- package/dist/commands/voice.js +0 -516
- package/dist/commands/voice.js.map +0 -1
- package/dist/commands/wallet.d.ts +0 -2
- package/dist/commands/wallet.js +0 -244
- package/dist/commands/wallet.js.map +0 -1
- package/dist/commands/webhooks.d.ts +0 -13
- package/dist/commands/webhooks.js +0 -119
- package/dist/commands/webhooks.js.map +0 -1
- package/dist/commands/whoami.d.ts +0 -2
- package/dist/commands/whoami.js +0 -53
- package/dist/commands/whoami.js.map +0 -1
- package/dist/config.d.ts +0 -42
- package/dist/config.js +0 -83
- package/dist/config.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js.map +0 -1
- package/dist/lib/brain-select.d.ts +0 -193
- package/dist/lib/brain-select.js +0 -403
- package/dist/lib/brain-select.js.map +0 -1
- package/dist/lib/cli-validation.d.ts +0 -12
- package/dist/lib/cli-validation.js +0 -46
- package/dist/lib/cli-validation.js.map +0 -1
- package/dist/lib/config-errors.d.ts +0 -4
- package/dist/lib/config-errors.js +0 -13
- package/dist/lib/config-errors.js.map +0 -1
- package/dist/lib/deprecation.d.ts +0 -158
- package/dist/lib/deprecation.js +0 -140
- package/dist/lib/deprecation.js.map +0 -1
- package/dist/lib/duration.d.ts +0 -8
- package/dist/lib/duration.js +0 -11
- package/dist/lib/duration.js.map +0 -1
- package/dist/lib/http-response.d.ts +0 -11
- package/dist/lib/http-response.js +0 -96
- package/dist/lib/http-response.js.map +0 -1
- package/dist/lib/pricing.d.ts +0 -132
- package/dist/lib/pricing.js +0 -148
- package/dist/lib/pricing.js.map +0 -1
- package/dist/lib/starter-config.d.ts +0 -13
- package/dist/lib/starter-config.js +0 -71
- package/dist/lib/starter-config.js.map +0 -1
- package/dist/lib/stream-frames.d.ts +0 -114
- package/dist/lib/stream-frames.js +0 -169
- package/dist/lib/stream-frames.js.map +0 -1
- package/dist/lib/teams-catalog.d.ts +0 -141
- package/dist/lib/teams-catalog.js +0 -841
- package/dist/lib/teams-catalog.js.map +0 -1
- package/dist/lib/unknown-command.d.ts +0 -71
- package/dist/lib/unknown-command.js +0 -132
- package/dist/lib/unknown-command.js.map +0 -1
- package/dist/lib/version-check.d.ts +0 -26
- package/dist/lib/version-check.js +0 -21
- package/dist/lib/version-check.js.map +0 -1
- package/dist/output.d.ts +0 -174
- package/dist/output.js +0 -435
- package/dist/output.js.map +0 -1
- package/dist/prompt.d.ts +0 -17
- package/dist/prompt.js +0 -70
- package/dist/prompt.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -14
- package/dist/version.js.map +0 -1
package/dist/output.js
DELETED
|
@@ -1,435 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent-native structured output for CLI responses.
|
|
3
|
-
* Every tool call returns JSON with result data + contextual guidance
|
|
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.
|
|
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
|
-
}
|
|
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
|
-
}
|
|
200
|
-
const output = {
|
|
201
|
-
success: true,
|
|
202
|
-
action: opts.action,
|
|
203
|
-
result: opts.result,
|
|
204
|
-
next_steps: opts.next_steps,
|
|
205
|
-
...(opts.hints && { hints: opts.hints }),
|
|
206
|
-
...(opts.related_commands && { related_commands: opts.related_commands }),
|
|
207
|
-
...(opts.help_markdown && { help_markdown: opts.help_markdown }),
|
|
208
|
-
...(update && { update }),
|
|
209
|
-
...(deprecation && { deprecation }),
|
|
210
|
-
};
|
|
211
|
-
console.log(JSON.stringify(output, null, 2));
|
|
212
|
-
maybeDiscoveryHint();
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* THE FAILURE ENVELOPE GOES TO STDOUT, on the same channel as the success one.
|
|
216
|
-
*
|
|
217
|
-
* This used to be `console.error`, and stdout was zero bytes on every failure —
|
|
218
|
-
* so `naive <anything> --json | jq` and any agent reading stdout saw NOTHING when
|
|
219
|
-
* a command failed, including the `recovery_steps` that are its only route out.
|
|
220
|
-
*
|
|
221
|
-
* That contradicted the split the rest of this CLI is built on: stdout is THE
|
|
222
|
-
* machine document, stderr is human noise. update-notifier is stderr-only "so it
|
|
223
|
-
* never pollutes the JSON on stdout" (index.ts); the human-mode tip above is
|
|
224
|
-
* stderr "without polluting stdout (stays parseable JSON)"; a deprecation notice
|
|
225
|
-
* rides "the STDOUT envelope so stdout stays JSON.parse-able and an agent can
|
|
226
|
-
* branch on it without scraping stderr" (DeprecationNotice, above). The
|
|
227
|
-
* `unhandledRejection` net in index.ts exists in so many words because "an agent
|
|
228
|
-
* parsing stdout would get nothing it can act on" — and then emitted here, to
|
|
229
|
-
* stderr, so it did not deliver the thing it was written to deliver.
|
|
230
|
-
*
|
|
231
|
-
* Written ONCE, not to both channels: `2>&1` is the common way an agent harness
|
|
232
|
-
* merges these, and a second copy would put two JSON documents in one stream and
|
|
233
|
-
* break the single-document invariant that makes stdout `JSON.parse`-able.
|
|
234
|
-
*
|
|
235
|
-
* `success: false` is in the envelope and the exit code is still 1, so nothing
|
|
236
|
-
* downstream has to guess whether stdout is data — it must branch on `success`
|
|
237
|
-
* either way, exactly as it already does for the success envelope.
|
|
238
|
-
*
|
|
239
|
-
* HUMAN mode is unchanged: a red ✗ line is a diagnostic for a person, and those
|
|
240
|
-
* belong on stderr.
|
|
241
|
-
*/
|
|
242
|
-
export function agentError(opts) {
|
|
243
|
-
if (humanMode()) {
|
|
244
|
-
renderHumanError(opts);
|
|
245
|
-
process.exit(1);
|
|
246
|
-
}
|
|
247
|
-
const output = {
|
|
248
|
-
success: false,
|
|
249
|
-
action: opts.action,
|
|
250
|
-
error: opts.error,
|
|
251
|
-
recovery_steps: opts.recovery_steps,
|
|
252
|
-
};
|
|
253
|
-
console.log(JSON.stringify(output, null, 2));
|
|
254
|
-
process.exit(1);
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* 06 §1.8 — when a response body carries a governance `verdict`, the DECISION
|
|
258
|
-
* POINT knows the recovery and the CLI's local `switch (code)` does not. The
|
|
259
|
-
* whole point of the denial envelope is that a model recovers instead of
|
|
260
|
-
* looping, and a hand-written table that overwrites the server's steps defeats
|
|
261
|
-
* it. So: a body with a `verdict` and a well-formed `recovery[]` renders the
|
|
262
|
-
* server's steps verbatim, and `getRecoverySteps` is not consulted.
|
|
263
|
-
*
|
|
264
|
-
* Both gates are required. `verdict` alone with no recovery falls back (the
|
|
265
|
-
* server said nothing actionable); `recovery` alone with no verdict is ignored,
|
|
266
|
-
* so this cannot become a way for any endpoint to rewrite the CLI's advice.
|
|
267
|
-
* Each step is validated field by field — an entry that is not
|
|
268
|
-
* `{command:string, description:string}` is dropped rather than printed as
|
|
269
|
-
* `undefined`.
|
|
270
|
-
*/
|
|
271
|
-
export function serverRecoverySteps(data) {
|
|
272
|
-
if (typeof data !== "object" || data === null)
|
|
273
|
-
return undefined;
|
|
274
|
-
const body = data;
|
|
275
|
-
const verdict = body.verdict ?? body.error?.verdict;
|
|
276
|
-
if (typeof verdict !== "string" || verdict.length === 0)
|
|
277
|
-
return undefined;
|
|
278
|
-
const raw = body.recovery ?? body.error?.recovery;
|
|
279
|
-
if (!Array.isArray(raw))
|
|
280
|
-
return undefined;
|
|
281
|
-
const steps = [];
|
|
282
|
-
for (const entry of raw) {
|
|
283
|
-
if (typeof entry !== "object" || entry === null)
|
|
284
|
-
continue;
|
|
285
|
-
const { command, description, when } = entry;
|
|
286
|
-
if (typeof command !== "string" || typeof description !== "string")
|
|
287
|
-
continue;
|
|
288
|
-
steps.push({ command, description, ...(typeof when === "string" && { when }) });
|
|
289
|
-
}
|
|
290
|
-
return steps.length > 0 ? steps : undefined;
|
|
291
|
-
}
|
|
292
|
-
export function formatApiError(action, data) {
|
|
293
|
-
// Accept Naive `{ error: { code, message } }`, proxy shapes where `error` is a
|
|
294
|
-
// string (Supabase Storage), or a bare `{ message }` — never collapse to opaque
|
|
295
|
-
// `unknown` when the upstream already said something useful.
|
|
296
|
-
const payload = data && typeof data === "object" ? data : null;
|
|
297
|
-
const rawError = payload?.error;
|
|
298
|
-
let details;
|
|
299
|
-
if (rawError && typeof rawError === "object" && !Array.isArray(rawError)) {
|
|
300
|
-
details = rawError;
|
|
301
|
-
}
|
|
302
|
-
else if (typeof rawError === "string" && rawError) {
|
|
303
|
-
const message = typeof payload?.message === "string" && payload.message ? payload.message : rawError;
|
|
304
|
-
details = { code: "upstream_error", message };
|
|
305
|
-
}
|
|
306
|
-
else if (typeof payload?.message === "string" && payload.message) {
|
|
307
|
-
details = { code: "upstream_error", message: payload.message };
|
|
308
|
-
}
|
|
309
|
-
if (details) {
|
|
310
|
-
agentError({
|
|
311
|
-
action,
|
|
312
|
-
error: details,
|
|
313
|
-
// A governance denial carries its own recovery — the DECISION POINT knows
|
|
314
|
-
// the way out and this local table does not. Server steps win when both
|
|
315
|
-
// gates in serverRecoverySteps() are satisfied.
|
|
316
|
-
recovery_steps: serverRecoverySteps(data) ?? getRecoverySteps(details.code),
|
|
317
|
-
});
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
agentError({
|
|
321
|
-
action,
|
|
322
|
-
error: {
|
|
323
|
-
code: "unknown",
|
|
324
|
-
message: "Unexpected error response",
|
|
325
|
-
body_snippet: data == null ? undefined : JSON.stringify(data).slice(0, 300),
|
|
326
|
-
},
|
|
327
|
-
recovery_steps: getRecoverySteps("unknown"),
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
function getRecoverySteps(code) {
|
|
331
|
-
switch (code) {
|
|
332
|
-
case "unauthorized":
|
|
333
|
-
return [
|
|
334
|
-
{ command: "naive register --name <name> --email <email> --password <pw>", description: "Create a new account" },
|
|
335
|
-
{ command: "naive login --email <email> --password <pw>", description: "Log in to existing account" },
|
|
336
|
-
];
|
|
337
|
-
case "insufficient_credits":
|
|
338
|
-
// 🔴 NO `upgrade --plan pro` HERE. This table is keyed on the error code and
|
|
339
|
-
// nothing else — it cannot see who is reading it — so the line it used to
|
|
340
|
-
// carry ("Upgrade to Pro (400 credits/mo, $20/mo)") was handed to every
|
|
341
|
-
// subscriber, including the grandfathered $149/2000 and $49/500 ones, for
|
|
342
|
-
// whom it is a DOWNGRADE labelled an upgrade, one click from a real plan
|
|
343
|
-
// switch: `/v1/billing/upgrade` sends an active subscriber straight to the
|
|
344
|
-
// Stripe portal. `isUpgradeFrom()` exists to stop exactly that on the API
|
|
345
|
-
// and dashboard surfaces, and it needs the caller's own allowance, which a
|
|
346
|
-
// static table does not have.
|
|
347
|
-
//
|
|
348
|
-
// An empty wallet is a BALANCE problem anyway, not a subscription one: the
|
|
349
|
-
// remedy is credits. `naive billing plans` is the plan-aware surface — GET
|
|
350
|
-
// /v1/billing/plans answers with the reader's own terms and a hint that
|
|
351
|
-
// knows whether anything on sale is more than they already have.
|
|
352
|
-
return [
|
|
353
|
-
{ command: "naive billing topup --pack medium", description: "Buy 500 credits for $23 (Popular)" },
|
|
354
|
-
{ command: "naive billing topup --pack large", description: "Buy 1000 credits for $44 (Best Value)" },
|
|
355
|
-
{ command: "naive billing packs", description: "See all available credit packs" },
|
|
356
|
-
{ command: "naive billing plans", description: "See your plan's monthly credits and whether anything on sale includes more" },
|
|
357
|
-
];
|
|
358
|
-
case "billing_blocked":
|
|
359
|
-
// ONE plan. The Starter line is gone because Starter is retired: nothing new
|
|
360
|
-
// may buy it, so `--plan starter` here would have handed a blocked customer a
|
|
361
|
-
// recovery step that returns 400. Existing Starter subscriptions are
|
|
362
|
-
// untouched — they recover through `naive billing portal`, which the
|
|
363
|
-
// subscription_past_due path already offers, not by re-subscribing.
|
|
364
|
-
return [
|
|
365
|
-
{ command: "naive billing subscribe --plan pro", description: "Subscribe to Pro ($20/mo, 400 credits)" },
|
|
366
|
-
{ command: "naive billing plans", description: "See the current plan and your own" },
|
|
367
|
-
];
|
|
368
|
-
case "rate_limited":
|
|
369
|
-
return [
|
|
370
|
-
{ command: "# wait 60 seconds then retry", description: "Rate limits reset after 60s" },
|
|
371
|
-
];
|
|
372
|
-
case "resource_not_found":
|
|
373
|
-
return [
|
|
374
|
-
{ command: "naive identity", description: "List available resources" },
|
|
375
|
-
{ command: "naive companies", description: "Check available companies" },
|
|
376
|
-
];
|
|
377
|
-
case "invalid_input":
|
|
378
|
-
return [
|
|
379
|
-
{ command: "naive <command> --help", description: "See required parameters and examples" },
|
|
380
|
-
];
|
|
381
|
-
case "voice_revoked":
|
|
382
|
-
return [
|
|
383
|
-
{ command: "naive voice list", description: "List voices that are still available" },
|
|
384
|
-
{ command: "# this voice's consent was revoked", description: "Pick another voice, or have an admin re-create it in the Studio UI" },
|
|
385
|
-
];
|
|
386
|
-
case "voice_reclone_required":
|
|
387
|
-
return [
|
|
388
|
-
{ command: "naive voice list", description: "Check the voice's tier/status" },
|
|
389
|
-
{ 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" },
|
|
390
|
-
];
|
|
391
|
-
// Transport-level failure: the gateway returned a non-JSON body (502/503/504
|
|
392
|
-
// HTML page). Idempotent GETs were already retried in the client; a failed POST
|
|
393
|
-
// (e.g. llm chat) is NOT auto-retried to avoid a double-charge — the user retries.
|
|
394
|
-
case "upstream_error":
|
|
395
|
-
return [
|
|
396
|
-
{ command: "# retry — gateway timeouts (502/504) are usually transient", description: "Re-run your command in a moment" },
|
|
397
|
-
{ command: "naive status", description: "Check API connectivity" },
|
|
398
|
-
{
|
|
399
|
-
command: 'naive report "<what failed>" --command "<the command you ran>" --kind error',
|
|
400
|
-
description: "Report it to the naive team if it persists",
|
|
401
|
-
},
|
|
402
|
-
];
|
|
403
|
-
// Genuinely-broken-on-our-side codes — these are worth reporting (unlike the
|
|
404
|
-
// self-correctable cases above). Retry first (often transient), then report.
|
|
405
|
-
case "provider_error":
|
|
406
|
-
case "internal_error":
|
|
407
|
-
return [
|
|
408
|
-
{ command: "# retry — provider/internal errors are often transient", description: "Retry once before reporting" },
|
|
409
|
-
{
|
|
410
|
-
command: 'naive report "<what failed>" --command "<the command you ran>" --kind error',
|
|
411
|
-
description: "Report it to the naive team if it persists",
|
|
412
|
-
},
|
|
413
|
-
];
|
|
414
|
-
// Opaque / unexpected failures (non-JSON gateway body already mapped, or API
|
|
415
|
-
// returned an untyped error). Agents only file tickets when recovery_steps
|
|
416
|
-
// tell them to — without this, `unknown` silently becomes "check status".
|
|
417
|
-
case "unknown":
|
|
418
|
-
return [
|
|
419
|
-
{ command: "naive status", description: "Check API connectivity and auth status" },
|
|
420
|
-
{
|
|
421
|
-
command: 'naive report "<what failed — paste the error JSON>" --command "<the command you ran>" --kind error',
|
|
422
|
-
description: "File a tracked report — unexpected errors are product bugs until proven otherwise",
|
|
423
|
-
},
|
|
424
|
-
];
|
|
425
|
-
default:
|
|
426
|
-
return [
|
|
427
|
-
{ command: "naive status", description: "Check API connectivity and auth status" },
|
|
428
|
-
{
|
|
429
|
-
command: 'naive report "<what failed — paste the error JSON>" --command "<the command you ran>" --kind error',
|
|
430
|
-
description: "If this is not a credits/auth/invalid-input issue you can fix yourself, report it",
|
|
431
|
-
},
|
|
432
|
-
];
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
//# sourceMappingURL=output.js.map
|
package/dist/output.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],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AAc,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/dist/prompt.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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
|
-
return choices[n - 1].value;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=prompt.js.map
|
package/dist/prompt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,oGAAoG;AACpG,kGAAkG;AAClG,oGAAoG;AACpG,qGAAqG;AACrG,4BAA4B;AAC5B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAEnD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,KAAK,UAAU,QAAQ,CAAC,CAAS,EAAE,SAAS,GAAG,kBAAkB;IAC/D,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,IAAI,KAAgD,CAAC;IACrD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAC5C,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;gBACnD,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,EAAE,SAAS,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,EAAE,CAAC,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,MAAM,CAAC,KAAK,UAAU,YAAY,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/dist/version.d.ts
DELETED
package/dist/version.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
/** This package's version from package.json. Returns "0.0.0" on failure. */
|
|
5
|
-
export function readVersion() {
|
|
6
|
-
try {
|
|
7
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
return JSON.parse(readFileSync(join(here, "..", "package.json"), "utf8")).version ?? "0.0.0";
|
|
9
|
-
}
|
|
10
|
-
catch {
|
|
11
|
-
return "0.0.0";
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,4EAA4E;AAC5E,MAAM,UAAU,WAAW;IACzB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC;IAC/F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|