@usenaive-sdk/cli 0.12.2 → 0.12.5
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 +22 -0
- package/dist/client.d.ts +26 -1
- package/dist/client.js +167 -5
- package/dist/client.js.map +1 -1
- package/dist/commands/aeo.js +13 -6
- package/dist/commands/aeo.js.map +1 -1
- package/dist/commands/auth.d.ts +30 -0
- package/dist/commands/auth.js +400 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/billing.js +9 -9
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/brain.d.ts +2 -0
- package/dist/commands/brain.js +509 -0
- package/dist/commands/brain.js.map +1 -0
- package/dist/commands/browser.js +28 -1
- package/dist/commands/browser.js.map +1 -1
- package/dist/commands/clone.d.ts +2 -0
- package/dist/commands/clone.js +199 -0
- package/dist/commands/clone.js.map +1 -0
- 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/env.d.ts +3 -3
- package/dist/commands/env.js +68 -4
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/images.js +2 -2
- package/dist/commands/keys.js +26 -3
- package/dist/commands/keys.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/mobile.d.ts +2 -0
- package/dist/commands/mobile.js +341 -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/phone.js +77 -2
- package/dist/commands/phone.js.map +1 -1
- package/dist/commands/register.js +4 -4
- package/dist/commands/register.js.map +1 -1
- package/dist/commands/usage.js +4 -4
- package/dist/commands/video.js +94 -273
- 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/config.d.ts +15 -0
- package/dist/config.js +35 -6
- package/dist/config.js.map +1 -1
- package/dist/index.js +70 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/unknown-command.d.ts +17 -0
- package/dist/lib/unknown-command.js +19 -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 +20 -5
- package/dist/output.js +150 -5
- 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 +9 -4
- 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/operators.d.ts +0 -11
- package/dist/commands/operators.js +0 -120
- package/dist/commands/operators.js.map +0 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, sessionRequest, handleApiError, activeUserId } from "../client.js";
|
|
3
|
+
import { agentOutput, agentError } from "../output.js";
|
|
4
|
+
export const walletCmd = new Command("wallet")
|
|
5
|
+
.description("Wallet — the agent's crypto wallet, its balance, and its spend policy")
|
|
6
|
+
.addHelpText("after", `
|
|
7
|
+
Subcommands:
|
|
8
|
+
naive wallet show Show the agent's wallet (address, network, custody)
|
|
9
|
+
naive wallet balance Read USDC balances
|
|
10
|
+
|
|
11
|
+
Operator subcommands (human-only — see Governance):
|
|
12
|
+
naive wallet create Provision the wallet
|
|
13
|
+
naive wallet fund Credit it from the treasury or a testnet faucet
|
|
14
|
+
naive wallet transfer Send USDC to an address or another agent
|
|
15
|
+
naive wallet policy Set the spend policy (per-tx max / daily budget)
|
|
16
|
+
naive wallet sweep Drain it back to the treasury (decommission)
|
|
17
|
+
|
|
18
|
+
How it works:
|
|
19
|
+
Each agent gets its own crypto wallet. The agent SPENDS from it via
|
|
20
|
+
'naive payments pay' (x402), but cannot administer it — funding, transferring,
|
|
21
|
+
re-policying and sweeping are the operator surface (spec §3.7).
|
|
22
|
+
|
|
23
|
+
Spend control (spec §2.2):
|
|
24
|
+
There is NO approval queue here, and that is deliberate — unlike cards and
|
|
25
|
+
trading, the cap is enforced inside the custody plane at signing time:
|
|
26
|
+
1. Balance is the primary budget — an agent can never spend what isn't there.
|
|
27
|
+
2. perTxMax is enforced TWICE: at runtime, AND as a static account policy in
|
|
28
|
+
the custody plane. The second check survives a fully compromised runtime,
|
|
29
|
+
which an approval queue would not.
|
|
30
|
+
3. dailyBudget (optional) is a rolling runtime counter.
|
|
31
|
+
Fund the wallet with what you can afford to lose, and set perTxMax.
|
|
32
|
+
|
|
33
|
+
Governance:
|
|
34
|
+
create/fund/transfer/policy/sweep require an OPERATOR credential — a signed-in
|
|
35
|
+
session ('naive auth login'), or an api key minted with the "wallet:admin"
|
|
36
|
+
scope for CI. An agent's key is refused. Reads (show/balance) are agent-safe.
|
|
37
|
+
|
|
38
|
+
Examples:
|
|
39
|
+
$ naive use alice
|
|
40
|
+
$ naive wallet create
|
|
41
|
+
$ naive wallet policy --per-tx-max 1.00 --daily-budget 10.00
|
|
42
|
+
$ naive wallet fund --amount 5.00 --source faucet
|
|
43
|
+
$ naive wallet balance
|
|
44
|
+
$ naive wallet transfer --to 0xabc... --amount 1.50 --purpose "settle invoice"
|
|
45
|
+
$ naive wallet sweep
|
|
46
|
+
`);
|
|
47
|
+
/**
|
|
48
|
+
* The user-scoped wallet base. `wallet` has no company-level mount, so a
|
|
49
|
+
* subject is required. Operator verbs go through sessionRequest (which does no
|
|
50
|
+
* path rewriting), so they need the resolved path up front.
|
|
51
|
+
*/
|
|
52
|
+
function walletBase(action) {
|
|
53
|
+
const userId = activeUserId();
|
|
54
|
+
if (!userId) {
|
|
55
|
+
agentError({
|
|
56
|
+
action,
|
|
57
|
+
error: {
|
|
58
|
+
code: "no_active_user",
|
|
59
|
+
message: "The wallet is per-agent, so this command needs an active user.",
|
|
60
|
+
hint: "Select one with 'naive use <user>'. Unlike cards, the wallet has no company-level fallback — it exists only per-agent.",
|
|
61
|
+
},
|
|
62
|
+
recovery_steps: [
|
|
63
|
+
{ command: "naive users list", description: "List the tenant users" },
|
|
64
|
+
{ command: "naive use <user>", description: "Set the active user" },
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
return `/v1/users/${userId}/wallet`;
|
|
70
|
+
}
|
|
71
|
+
walletCmd
|
|
72
|
+
.command("show")
|
|
73
|
+
.description("Show the agent's crypto wallet")
|
|
74
|
+
.action(async () => {
|
|
75
|
+
const resp = await apiRequest("GET", "/v1/wallet");
|
|
76
|
+
if (resp.status === 404) {
|
|
77
|
+
agentError({
|
|
78
|
+
action: "wallet.show",
|
|
79
|
+
error: {
|
|
80
|
+
code: "no_wallet",
|
|
81
|
+
message: "This agent has no wallet yet.",
|
|
82
|
+
hint: "Provision one with 'naive wallet create', or declare has.crypto on the agent in naive.config.ts.",
|
|
83
|
+
},
|
|
84
|
+
recovery_steps: [{ command: "naive wallet create", description: "Provision the wallet" }],
|
|
85
|
+
});
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
handleApiError("wallet.show", resp);
|
|
89
|
+
agentOutput({
|
|
90
|
+
action: "wallet.show",
|
|
91
|
+
result: resp.data,
|
|
92
|
+
next_steps: [
|
|
93
|
+
{ command: "naive wallet balance", description: "Read the USDC balance" },
|
|
94
|
+
{ command: "naive payments receipts", description: "See what it has paid for" },
|
|
95
|
+
],
|
|
96
|
+
related_commands: ["naive wallet balance", "naive payments pay"],
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
walletCmd
|
|
100
|
+
.command("balance")
|
|
101
|
+
.description("Read the wallet's USDC balances")
|
|
102
|
+
.option("--network <network>", "Filter to one network (CAIP-2, e.g. eip155:8453)")
|
|
103
|
+
.action(async (opts) => {
|
|
104
|
+
const query = opts.network ? `?network=${encodeURIComponent(opts.network)}` : "";
|
|
105
|
+
const resp = await apiRequest("GET", `/v1/wallet/balances${query}`);
|
|
106
|
+
handleApiError("wallet.balance", resp);
|
|
107
|
+
// getBalances returns a bare WalletBalance[] (not { balances: [...] }).
|
|
108
|
+
const balances = Array.isArray(resp.data) ? resp.data : [];
|
|
109
|
+
const usdc = balances.find((b) => b.asset === "USDC");
|
|
110
|
+
agentOutput({
|
|
111
|
+
action: "wallet.balance",
|
|
112
|
+
result: resp.data,
|
|
113
|
+
next_steps: [{ command: "naive payments pay --url <url>", description: "Pay for an x402 resource" }],
|
|
114
|
+
hints: [
|
|
115
|
+
usdc
|
|
116
|
+
? `USDC balance: ${usdc.amount}. The balance IS the budget — an agent cannot spend past it.`
|
|
117
|
+
: "No USDC balance. Fund the wallet with 'naive wallet fund' before paying.",
|
|
118
|
+
],
|
|
119
|
+
related_commands: ["naive wallet fund", "naive wallet show"],
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
walletCmd
|
|
123
|
+
.command("create")
|
|
124
|
+
.description("Provision the agent's wallet (OPERATOR)")
|
|
125
|
+
.option("--custody <custody>", "Custody backend: cdp | local | fake (default: the configured provider)")
|
|
126
|
+
.option("--network <network>", "Network to provision on (CAIP-2, e.g. eip155:8453)")
|
|
127
|
+
.option("--per-tx-max <amount>", "Max value of a single payment, decimal USDC (e.g. 1.00)")
|
|
128
|
+
.option("--daily-budget <amount>", "Optional rolling daily cap, decimal USDC")
|
|
129
|
+
.option("--smart-account", "Provision as a smart account")
|
|
130
|
+
.action(async (opts) => {
|
|
131
|
+
const policy = opts.perTxMax || opts.dailyBudget
|
|
132
|
+
? { perTxMax: opts.perTxMax, dailyBudget: opts.dailyBudget }
|
|
133
|
+
: undefined;
|
|
134
|
+
const resp = await sessionRequest("POST", walletBase("wallet.create"), {
|
|
135
|
+
body: {
|
|
136
|
+
...(opts.custody && { custody: opts.custody }),
|
|
137
|
+
...(opts.network && { networks: [opts.network] }),
|
|
138
|
+
...(policy && { policy }),
|
|
139
|
+
...(opts.smartAccount && { smartAccount: true }),
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
handleApiError("wallet.create", resp);
|
|
143
|
+
agentOutput({
|
|
144
|
+
action: "wallet.create",
|
|
145
|
+
result: resp.data,
|
|
146
|
+
next_steps: [
|
|
147
|
+
{ command: "naive wallet policy --per-tx-max 1.00", description: "Set the spend cap" },
|
|
148
|
+
{ command: "naive wallet fund --amount 5.00 --source faucet", description: "Fund it" },
|
|
149
|
+
],
|
|
150
|
+
hints: [
|
|
151
|
+
"Provisioning is idempotent — re-running returns the existing wallet.",
|
|
152
|
+
"perTxMax is written into the custody plane as a static account policy, so it holds even if the agent runtime is compromised.",
|
|
153
|
+
],
|
|
154
|
+
related_commands: ["naive wallet fund", "naive wallet policy"],
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
walletCmd
|
|
158
|
+
.command("fund")
|
|
159
|
+
.description("Credit the wallet from the treasury or a testnet faucet (OPERATOR)")
|
|
160
|
+
.requiredOption("--amount <amount>", "Decimal USDC amount (e.g. 5.00)")
|
|
161
|
+
.requiredOption("--source <source>", "treasury | faucet (faucet is testnet only)")
|
|
162
|
+
.option("--asset <asset>", "Asset to credit (default: USDC)")
|
|
163
|
+
.action(async (opts) => {
|
|
164
|
+
const resp = await sessionRequest("POST", `${walletBase("wallet.fund")}/fund`, {
|
|
165
|
+
body: { amount: opts.amount, source: opts.source, ...(opts.asset && { asset: opts.asset }) },
|
|
166
|
+
});
|
|
167
|
+
handleApiError("wallet.fund", resp);
|
|
168
|
+
agentOutput({
|
|
169
|
+
action: "wallet.fund",
|
|
170
|
+
result: resp.data,
|
|
171
|
+
next_steps: [{ command: "naive wallet balance", description: "Confirm the credit landed" }],
|
|
172
|
+
hints: ["The balance is the agent's real budget — fund only what you can afford to lose."],
|
|
173
|
+
related_commands: ["naive wallet balance", "naive wallet policy"],
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
walletCmd
|
|
177
|
+
.command("transfer")
|
|
178
|
+
.description("Send USDC from the wallet to an address or another agent (OPERATOR)")
|
|
179
|
+
.requiredOption("--to <to>", "Destination address, or an agent id to target that agent's wallet")
|
|
180
|
+
.requiredOption("--amount <amount>", "Decimal USDC amount")
|
|
181
|
+
.requiredOption("--purpose <purpose>", "Why — recorded on the transfer for audit")
|
|
182
|
+
.option("--asset <asset>", "Asset (default: USDC)")
|
|
183
|
+
.option("--network <network>", "Network (CAIP-2)")
|
|
184
|
+
.action(async (opts) => {
|
|
185
|
+
const resp = await sessionRequest("POST", `${walletBase("wallet.transfer")}/transfer`, {
|
|
186
|
+
body: {
|
|
187
|
+
to: opts.to,
|
|
188
|
+
amount: opts.amount,
|
|
189
|
+
purpose: opts.purpose,
|
|
190
|
+
...(opts.asset && { asset: opts.asset }),
|
|
191
|
+
...(opts.network && { network: opts.network }),
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
handleApiError("wallet.transfer", resp);
|
|
195
|
+
agentOutput({
|
|
196
|
+
action: "wallet.transfer",
|
|
197
|
+
result: resp.data,
|
|
198
|
+
next_steps: [{ command: "naive wallet balance", description: "Confirm the new balance" }],
|
|
199
|
+
hints: ["Transfers are bounded by the wallet's perTxMax, the same cap that bounds agent payments."],
|
|
200
|
+
related_commands: ["naive wallet balance", "naive wallet policy"],
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
walletCmd
|
|
204
|
+
.command("policy")
|
|
205
|
+
.description("Set the wallet's spend policy (OPERATOR)")
|
|
206
|
+
.requiredOption("--per-tx-max <amount>", "Max value of a single payment, decimal USDC (required)")
|
|
207
|
+
.option("--daily-budget <amount>", "Optional rolling daily cap, decimal USDC")
|
|
208
|
+
.action(async (opts) => {
|
|
209
|
+
const resp = await sessionRequest("POST", `${walletBase("wallet.policy")}/policy`, {
|
|
210
|
+
body: {
|
|
211
|
+
policy: { perTxMax: opts.perTxMax, ...(opts.dailyBudget && { dailyBudget: opts.dailyBudget }) },
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
handleApiError("wallet.policy", resp);
|
|
215
|
+
agentOutput({
|
|
216
|
+
action: "wallet.policy",
|
|
217
|
+
result: resp.data,
|
|
218
|
+
next_steps: [{ command: "naive wallet show", description: "Read back the wallet" }],
|
|
219
|
+
hints: [
|
|
220
|
+
"perTxMax is now enforced twice — at runtime AND re-issued into the custody plane, so it holds at signing time even if the agent runtime is compromised.",
|
|
221
|
+
"If the custody plane can't be reached the change fails and nothing is saved, rather than storing a cap that isn't really enforced.",
|
|
222
|
+
"The spend policy is the control that replaces an approval queue for payments (spec §2.2).",
|
|
223
|
+
],
|
|
224
|
+
related_commands: ["naive wallet show", "naive payments receipts"],
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
walletCmd
|
|
228
|
+
.command("sweep")
|
|
229
|
+
.description("Drain the wallet back to the treasury — decommission (OPERATOR)")
|
|
230
|
+
.option("--to <address>", "Destination address (default: the treasury)")
|
|
231
|
+
.action(async (opts) => {
|
|
232
|
+
const resp = await sessionRequest("POST", `${walletBase("wallet.sweep")}/sweep`, {
|
|
233
|
+
body: { ...(opts.to && { to: opts.to }) },
|
|
234
|
+
});
|
|
235
|
+
handleApiError("wallet.sweep", resp);
|
|
236
|
+
agentOutput({
|
|
237
|
+
action: "wallet.sweep",
|
|
238
|
+
result: resp.data,
|
|
239
|
+
next_steps: [{ command: "naive wallet balance", description: "Confirm the wallet is drained" }],
|
|
240
|
+
hints: ["Sweeping moves the funds out but does not delete the wallet — the agent simply has nothing to spend."],
|
|
241
|
+
related_commands: ["naive wallet balance", "naive wallet show"],
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
//# sourceMappingURL=wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src/commands/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC3C,WAAW,CAAC,uEAAuE,CAAC;KACpF,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCvB,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,UAAU,CAAC,MAAc;IAChC,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,UAAU,CAAC;YACT,MAAM;YACN,KAAK,EAAE;gBACL,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,gEAAgE;gBACzE,IAAI,EAAE,wHAAwH;aAC/H;YACD,cAAc,EAAE;gBACd,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,uBAAuB,EAAE;gBACrE,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,qBAAqB,EAAE;aACpE;SACF,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,aAAa,MAAM,SAAS,CAAC;AACtC,CAAC;AAED,SAAS;KACN,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,gCAAgC,CAAC;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IAAoI;YACpI,2FAA2F;SAC5F;QACD,gBAAgB,EAAE,CAAC,mBAAmB,EAAE,yBAAyB,CAAC;KACnE,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,SAAS;KACN,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,iEAAiE,CAAC;KAC9E,MAAM,CAAC,gBAAgB,EAAE,6CAA6C,CAAC;KACvE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE;QAC/E,IAAI,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;KAC1C,CAAC,CAAC;IACH,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACrC,WAAW,CAAC;QACV,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;QAC/F,KAAK,EAAE,CAAC,sGAAsG,CAAC;QAC/G,gBAAgB,EAAE,CAAC,sBAAsB,EAAE,mBAAmB,CAAC;KAChE,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -4,9 +4,24 @@ export interface NaiveConfig {
|
|
|
4
4
|
agent_id?: string;
|
|
5
5
|
company_id?: string;
|
|
6
6
|
company_name?: string;
|
|
7
|
+
session_token?: string;
|
|
8
|
+
user_email?: string;
|
|
9
|
+
session_company_id?: string;
|
|
10
|
+
session_company_name?: string;
|
|
7
11
|
/** Active subject tenant_user — the user CLI commands act on by default. */
|
|
8
12
|
active_user_id?: string;
|
|
13
|
+
/** Output format preference. Default (unset) = machine JSON — safe for agents/pipes/CI/pty
|
|
14
|
+
* callers. "human" opts into chalk-rendered output + interactive wizards/confirms. Set via
|
|
15
|
+
* `naive config output human`. Never inferred from isTTY (a pty-wrapped agent looks like a TTY). */
|
|
16
|
+
output?: "human" | "json";
|
|
17
|
+
/** One-time flag: the "run 'naive config output human'" discovery hint has been shown. */
|
|
18
|
+
human_hint_shown?: boolean;
|
|
9
19
|
}
|
|
10
20
|
export declare function loadConfig(): NaiveConfig;
|
|
11
21
|
export declare function saveConfig(config: Partial<NaiveConfig>): void;
|
|
12
22
|
export declare function getApiKey(): string;
|
|
23
|
+
/** Human session token for human-only operations (voice clone/revoke). NEVER falls back
|
|
24
|
+
* to the agent api_key — the two auth modes are deliberately separate. */
|
|
25
|
+
export declare function getSessionToken(): string;
|
|
26
|
+
/** Clear only the session fields (used by `naive auth logout`). */
|
|
27
|
+
export declare function clearSession(): void;
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
const CONFIG_DIR = join(homedir(), ".naive");
|
|
@@ -19,12 +19,19 @@ export function loadConfig() {
|
|
|
19
19
|
config.base_url = process.env.NAIVE_BASE_URL;
|
|
20
20
|
return config;
|
|
21
21
|
}
|
|
22
|
+
// Atomic, owner-only write. The file holds an api_key AND a 30-day session token, so it
|
|
23
|
+
// must never be world-readable. Write to a fresh temp path (mode 0600, never world-
|
|
24
|
+
// readable since umask only clears bits), rename into place, then chmod the final file
|
|
25
|
+
// (the writeFileSync `mode` is ignored when the destination already exists).
|
|
26
|
+
function writeConfigFile(config) {
|
|
27
|
+
mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
28
|
+
const tmp = `${CONFIG_FILE}.${process.pid}.tmp`;
|
|
29
|
+
writeFileSync(tmp, JSON.stringify(config, null, 2), { mode: 0o600 });
|
|
30
|
+
renameSync(tmp, CONFIG_FILE);
|
|
31
|
+
chmodSync(CONFIG_FILE, 0o600);
|
|
32
|
+
}
|
|
22
33
|
export function saveConfig(config) {
|
|
23
|
-
|
|
24
|
-
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
25
|
-
const current = loadConfig();
|
|
26
|
-
const updated = { ...current, ...config };
|
|
27
|
-
writeFileSync(CONFIG_FILE, JSON.stringify(updated, null, 2));
|
|
34
|
+
writeConfigFile({ ...loadConfig(), ...config });
|
|
28
35
|
}
|
|
29
36
|
export function getApiKey() {
|
|
30
37
|
const envKey = process.env.NAIVE_API_KEY;
|
|
@@ -37,4 +44,26 @@ export function getApiKey() {
|
|
|
37
44
|
}
|
|
38
45
|
return config.api_key;
|
|
39
46
|
}
|
|
47
|
+
/** Human session token for human-only operations (voice clone/revoke). NEVER falls back
|
|
48
|
+
* to the agent api_key — the two auth modes are deliberately separate. */
|
|
49
|
+
export function getSessionToken() {
|
|
50
|
+
const envToken = process.env.NAIVE_SESSION_TOKEN;
|
|
51
|
+
if (envToken)
|
|
52
|
+
return envToken;
|
|
53
|
+
const config = loadConfig();
|
|
54
|
+
if (!config.session_token) {
|
|
55
|
+
console.error("No human session found. Run `naive auth session-login --email <e> --password <p>` first.");
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
return config.session_token;
|
|
59
|
+
}
|
|
60
|
+
/** Clear only the session fields (used by `naive auth logout`). */
|
|
61
|
+
export function clearSession() {
|
|
62
|
+
const current = loadConfig();
|
|
63
|
+
delete current.session_token;
|
|
64
|
+
delete current.user_email;
|
|
65
|
+
delete current.session_company_id;
|
|
66
|
+
delete current.session_company_name;
|
|
67
|
+
writeConfigFile(current);
|
|
68
|
+
}
|
|
40
69
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../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ACD,OAAO,MAAM,CAAC,aAAa,CAAC;AAC9B,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,aAAa,CAAC;IAC7B,OAAO,OAAO,CAAC,UAAU,CAAC;IAC1B,OAAO,OAAO,CAAC,kBAAkB,CAAC;IAClC,OAAO,OAAO,CAAC,oBAAoB,CAAC;IACpC,eAAe,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
+
import updateNotifier from "update-notifier";
|
|
3
4
|
import { readVersion } from "./version.js";
|
|
5
|
+
import { agentError } from "./output.js";
|
|
6
|
+
import { buildUnknownCommandError } from "./lib/unknown-command.js";
|
|
4
7
|
import { registerCmd } from "./commands/register.js";
|
|
5
8
|
import { loginCmd } from "./commands/login.js";
|
|
9
|
+
import { authCmd } from "./commands/auth.js";
|
|
6
10
|
import { linkCmd, verifyCmd } from "./commands/link.js";
|
|
7
11
|
import { companiesCmd } from "./commands/companies.js";
|
|
8
12
|
import { whoamiCmd } from "./commands/whoami.js";
|
|
@@ -15,6 +19,7 @@ import { searchCmd } from "./commands/search.js";
|
|
|
15
19
|
import { llmCmd } from "./commands/llm.js";
|
|
16
20
|
import { imagesCmd } from "./commands/images.js";
|
|
17
21
|
import { videoCmd } from "./commands/video.js";
|
|
22
|
+
import { cloneCmd } from "./commands/clone.js";
|
|
18
23
|
import { jobsCmd } from "./commands/jobs.js";
|
|
19
24
|
import { domainsCmd } from "./commands/domains.js";
|
|
20
25
|
import { billingCmd } from "./commands/billing.js";
|
|
@@ -30,15 +35,21 @@ import { ecommerceCmd } from "./commands/ecommerce.js";
|
|
|
30
35
|
import { cardsCmd } from "./commands/cards.js";
|
|
31
36
|
import { phoneCmd } from "./commands/phone.js";
|
|
32
37
|
import { tradingCmd } from "./commands/trading.js";
|
|
38
|
+
import { paymentsCmd } from "./commands/payments.js";
|
|
39
|
+
import { walletCmd } from "./commands/wallet.js";
|
|
33
40
|
import { ceoCmd } from "./commands/ceo.js";
|
|
34
41
|
import { tasksCmd } from "./commands/tasks.js";
|
|
35
42
|
import { objectivesCmd } from "./commands/objectives.js";
|
|
36
43
|
import { employeesCmd } from "./commands/employees.js";
|
|
37
44
|
import { cronCmd } from "./commands/cron-jobs.js";
|
|
45
|
+
import { loopsCmd } from "./commands/loops.js";
|
|
38
46
|
import { memoryCmd } from "./commands/memory.js";
|
|
47
|
+
import { brainCmd } from "./commands/brain.js";
|
|
39
48
|
import { appsCmd } from "./commands/apps.js";
|
|
49
|
+
import { voiceCmd } from "./commands/voice.js";
|
|
40
50
|
import { computeCmd } from "./commands/compute.js";
|
|
41
51
|
import { queueCmd } from "./commands/queue.js";
|
|
52
|
+
import { mobileCmd } from "./commands/mobile.js";
|
|
42
53
|
import { useCmd } from "./commands/use.js";
|
|
43
54
|
import { usersCmd } from "./commands/users.js";
|
|
44
55
|
import { accountKitsCmd } from "./commands/account-kits.js";
|
|
@@ -46,6 +57,8 @@ import { vaultCmd } from "./commands/vault.js";
|
|
|
46
57
|
import { logsCmd } from "./commands/logs.js";
|
|
47
58
|
import { connectionsCmd } from "./commands/connections.js";
|
|
48
59
|
import { approvalsCmd } from "./commands/approvals.js";
|
|
60
|
+
import { configCmd } from "./commands/config.js";
|
|
61
|
+
import { setOutputFlags } from "./output.js";
|
|
49
62
|
import { browserCmd } from "./commands/browser.js";
|
|
50
63
|
import { agentProfilesCmd, revokeCmd } from "./commands/agent-profiles.js";
|
|
51
64
|
import { initCmd } from "./commands/init.js";
|
|
@@ -54,6 +67,18 @@ import { moduleCmd } from "./commands/module.js";
|
|
|
54
67
|
import { envCmd } from "./commands/env.js";
|
|
55
68
|
import { reportCmd } from "./commands/report.js";
|
|
56
69
|
const program = new Command();
|
|
70
|
+
// Human-facing "update available" banner. update-notifier prints a box to
|
|
71
|
+
// STDERR only, so it never pollutes the JSON on stdout. Guarded to a no-op for
|
|
72
|
+
// agents/CI: skipped when stdout isn't a TTY, or when NAIVE_NO_UPDATE_NOTIFIER /
|
|
73
|
+
// NO_UPDATE_NOTIFIER is set. ~24h check interval; deferred so it prints on exit.
|
|
74
|
+
if (process.stdout.isTTY &&
|
|
75
|
+
!process.env.NAIVE_NO_UPDATE_NOTIFIER &&
|
|
76
|
+
!process.env.NO_UPDATE_NOTIFIER) {
|
|
77
|
+
updateNotifier({
|
|
78
|
+
pkg: { name: "@usenaive-sdk/cli", version: readVersion() },
|
|
79
|
+
updateCheckInterval: 1000 * 60 * 60 * 24,
|
|
80
|
+
}).notify({ defer: true, isGlobal: true });
|
|
81
|
+
}
|
|
57
82
|
program
|
|
58
83
|
.name("naive")
|
|
59
84
|
.description(`Naïve CLI — give every AI agent its own governed real-world agentProfile.
|
|
@@ -83,10 +108,11 @@ AgentProfiles (the governed real-world bundle):
|
|
|
83
108
|
env Switch API environment / create per-tenant preview sandboxes
|
|
84
109
|
|
|
85
110
|
Authentication:
|
|
86
|
-
register
|
|
87
|
-
login
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
register Create a new account (email + password → API key)
|
|
112
|
+
login Log in to existing account (email + password → API key)
|
|
113
|
+
auth google Sign in / sign up with Google in your browser (no password)
|
|
114
|
+
link Passwordless account linking via email verification
|
|
115
|
+
verify Complete the link flow with verification code
|
|
90
116
|
|
|
91
117
|
Account Management:
|
|
92
118
|
whoami Show current identity
|
|
@@ -104,7 +130,9 @@ Orchestration:
|
|
|
104
130
|
objectives Strategic objectives — high-level goals that decompose into tasks
|
|
105
131
|
employees AI workforce — hire, fire, configure agents
|
|
106
132
|
cron Scheduled recurring jobs — create, trigger, pause, remove
|
|
133
|
+
loops Recurring agent runs — governed cron-source triggers bound to an agent
|
|
107
134
|
memory Persistent agent memory — add, list, remove facts and preferences
|
|
135
|
+
brain Centralized knowledge base + RAG — ingest docs, ask grounded questions
|
|
108
136
|
apps Web apps — create, deploy, manage Vercel-backed applications
|
|
109
137
|
|
|
110
138
|
Primitives:
|
|
@@ -119,9 +147,12 @@ Primitives:
|
|
|
119
147
|
ecommerce E-commerce — Google Shopping, Amazon products & sellers
|
|
120
148
|
images AI image generation (fal.ai) + stock photos (Pexels)
|
|
121
149
|
video AI video generation (fal.ai)
|
|
150
|
+
clone Digital-twin talking video (image + cloned voice + script)
|
|
122
151
|
social Social media — connect accounts, post, analytics
|
|
123
152
|
cards Virtual cards — Stripe Issuing + Reloadly prepaid
|
|
124
153
|
trading Trading — link a brokerage account (OAuth) & trade stocks, options & crypto
|
|
154
|
+
payments x402 stablecoin payments — quote & pay for paywalled resources
|
|
155
|
+
wallet The agent's crypto wallet — balance, spend policy, funding
|
|
125
156
|
verification Identity verification (KYC) via Footprint
|
|
126
157
|
formation Company formation (LLC incorporation) via Doola
|
|
127
158
|
jobs Monitor async generation/research jobs
|
|
@@ -142,14 +173,33 @@ Governance (human-in-the-loop):
|
|
|
142
173
|
'naive approvals approve <id>'. Configure which actions are gated in the
|
|
143
174
|
Account Kit (dashboard) or leave the secure defaults on.
|
|
144
175
|
|
|
176
|
+
Payments are the exception, by design: 'naive payments pay' spends real USDC
|
|
177
|
+
but is NOT approval-gated. Its cap is enforced inside the custody plane at
|
|
178
|
+
signing time, so it holds even against a compromised agent runtime — a
|
|
179
|
+
guarantee an approval prompt cannot make. Bound it with 'naive wallet policy'
|
|
180
|
+
(perTxMax / dailyBudget) and by how much you fund. Administering the wallet
|
|
181
|
+
(fund/transfer/policy/sweep) is human-only and refuses an agent key outright.
|
|
182
|
+
|
|
145
183
|
Environment Variables:
|
|
146
184
|
NAIVE_API_KEY Override API key (for CI/headless use)
|
|
147
185
|
NAIVE_BASE_URL Override API URL (for local dev, default: https://api.usenaive.ai)
|
|
148
186
|
|
|
149
187
|
Documentation: https://docs.usenaive.ai
|
|
150
188
|
`);
|
|
189
|
+
// Global output-mode flags. Default is machine JSON (safe for agents/pipes/CI/pty callers);
|
|
190
|
+
// human mode is OPT-IN only (--human, NAIVE_HUMAN=1, or `naive config output human`). --json forces
|
|
191
|
+
// machine output even when human mode is configured.
|
|
192
|
+
program
|
|
193
|
+
.option("--json", "Force machine JSON output (default for non-interactive use)")
|
|
194
|
+
.option("--human", "Force human-readable output for this command");
|
|
195
|
+
program.hook("preAction", () => {
|
|
196
|
+
const o = program.opts();
|
|
197
|
+
setOutputFlags({ json: !!o.json, human: !!o.human });
|
|
198
|
+
});
|
|
199
|
+
program.addCommand(configCmd);
|
|
151
200
|
program.addCommand(registerCmd);
|
|
152
201
|
program.addCommand(loginCmd);
|
|
202
|
+
program.addCommand(authCmd);
|
|
153
203
|
program.addCommand(linkCmd);
|
|
154
204
|
program.addCommand(verifyCmd);
|
|
155
205
|
program.addCommand(companiesCmd);
|
|
@@ -170,11 +220,14 @@ program.addCommand(aeoCmd);
|
|
|
170
220
|
program.addCommand(ecommerceCmd);
|
|
171
221
|
program.addCommand(imagesCmd);
|
|
172
222
|
program.addCommand(videoCmd);
|
|
223
|
+
program.addCommand(cloneCmd);
|
|
173
224
|
program.addCommand(socialCmd);
|
|
174
225
|
program.addCommand(mediaCmd);
|
|
175
226
|
program.addCommand(cardsCmd);
|
|
176
227
|
program.addCommand(phoneCmd);
|
|
177
228
|
program.addCommand(tradingCmd);
|
|
229
|
+
program.addCommand(paymentsCmd);
|
|
230
|
+
program.addCommand(walletCmd);
|
|
178
231
|
program.addCommand(verificationCmd);
|
|
179
232
|
program.addCommand(formationCmd);
|
|
180
233
|
program.addCommand(jobsCmd);
|
|
@@ -183,10 +236,14 @@ program.addCommand(tasksCmd);
|
|
|
183
236
|
program.addCommand(objectivesCmd);
|
|
184
237
|
program.addCommand(employeesCmd);
|
|
185
238
|
program.addCommand(cronCmd);
|
|
239
|
+
program.addCommand(loopsCmd);
|
|
186
240
|
program.addCommand(memoryCmd);
|
|
241
|
+
program.addCommand(brainCmd);
|
|
187
242
|
program.addCommand(appsCmd);
|
|
243
|
+
program.addCommand(voiceCmd);
|
|
188
244
|
program.addCommand(computeCmd);
|
|
189
245
|
program.addCommand(queueCmd);
|
|
246
|
+
program.addCommand(mobileCmd);
|
|
190
247
|
program.addCommand(browserCmd);
|
|
191
248
|
program.addCommand(reportCmd);
|
|
192
249
|
// AgentProfiles (governed real-world bundle) + IaC
|
|
@@ -205,5 +262,14 @@ program.addCommand(vaultCmd);
|
|
|
205
262
|
program.addCommand(logsCmd);
|
|
206
263
|
program.addCommand(connectionsCmd);
|
|
207
264
|
program.addCommand(approvalsCmd);
|
|
265
|
+
// Unknown-command handler: instead of commander's raw
|
|
266
|
+
// "error: unknown command 'report' (Did you mean memory?)" stderr line, emit a
|
|
267
|
+
// structured cli_outdated JSON error — the command may exist in a newer CLI.
|
|
268
|
+
// Valid commands and --help are unaffected (this only fires on no match).
|
|
269
|
+
program.on("command:*", (operands) => {
|
|
270
|
+
const unknown = operands[0] ?? program.args[0] ?? "";
|
|
271
|
+
const built = buildUnknownCommandError(unknown, readVersion());
|
|
272
|
+
agentError({ action: built.action, error: built.error, recovery_steps: built.recovery_steps });
|
|
273
|
+
});
|
|
208
274
|
program.parse();
|
|
209
275
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAA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O,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NextStep } from "../output.js";
|
|
2
|
+
/** Structured error emitted when commander sees a command it doesn't recognize. */
|
|
3
|
+
export interface UnknownCommandError {
|
|
4
|
+
success: false;
|
|
5
|
+
action: "unknown_command";
|
|
6
|
+
error: {
|
|
7
|
+
code: "cli_outdated";
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
recovery_steps: NextStep[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build the agent-native error for an unknown command. Pure/testable: an old
|
|
14
|
+
* CLI hitting a command that only exists in a newer release (e.g. `report` on
|
|
15
|
+
* 0.11.0) gets a `cli_outdated` JSON object instead of commander's raw stderr.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildUnknownCommandError(command: string, currentVersion: string): UnknownCommandError;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the agent-native error for an unknown command. Pure/testable: an old
|
|
3
|
+
* CLI hitting a command that only exists in a newer release (e.g. `report` on
|
|
4
|
+
* 0.11.0) gets a `cli_outdated` JSON object instead of commander's raw stderr.
|
|
5
|
+
*/
|
|
6
|
+
export function buildUnknownCommandError(command, currentVersion) {
|
|
7
|
+
return {
|
|
8
|
+
success: false,
|
|
9
|
+
action: "unknown_command",
|
|
10
|
+
error: {
|
|
11
|
+
code: "cli_outdated",
|
|
12
|
+
message: `Unknown command '${command}'. Your naive CLI is v${currentVersion}; this command may exist in a newer version.`,
|
|
13
|
+
},
|
|
14
|
+
recovery_steps: [
|
|
15
|
+
{ command: "npm i -g @usenaive-sdk/cli@latest", description: "Update to the latest naive CLI" },
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=unknown-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown-command.js","sourceRoot":"","sources":["../../src/lib/unknown-command.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAe,EACf,cAAsB;IAEtB,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,iBAAiB;QACzB,KAAK,EAAE;YACL,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,oBAAoB,OAAO,yBAAyB,cAAc,8CAA8C;SAC1H;QACD,cAAc,EAAE;YACd,EAAE,OAAO,EAAE,mCAAmC,EAAE,WAAW,EAAE,gCAAgC,EAAE;SAChG;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outcome of comparing the running CLI version against the server-advertised
|
|
3
|
+
* minimum and latest versions.
|
|
4
|
+
* - `block` → CLI is below the minimum supported version; the command must stop.
|
|
5
|
+
* - `notice` → CLI works but a newer version exists; surface a non-fatal nudge.
|
|
6
|
+
* - `ok` → CLI is current (or versions were missing/unparseable — never block on ambiguity).
|
|
7
|
+
*/
|
|
8
|
+
export type CliVersionDecision = {
|
|
9
|
+
kind: "block";
|
|
10
|
+
current: string;
|
|
11
|
+
min: string;
|
|
12
|
+
latest?: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "notice";
|
|
15
|
+
current: string;
|
|
16
|
+
latest: string;
|
|
17
|
+
min?: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "ok";
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Pure decision function so the staleness policy is unit-testable without a
|
|
23
|
+
* live API. Any missing/invalid version is treated as "ok" — we never block or
|
|
24
|
+
* nag on data we can't trust.
|
|
25
|
+
*/
|
|
26
|
+
export declare function evaluateCliVersion(current: string, min?: string, latest?: string): CliVersionDecision;
|