@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/commands/jobs.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
-
import { agentOutput } from "../output.js";
|
|
4
|
-
export const jobsCmd = new Command("jobs")
|
|
5
|
-
.description("List and manage async jobs (image generation, video generation, deep research)")
|
|
6
|
-
.option("--status <status>", "Filter by status: queued | processing | completed | failed")
|
|
7
|
-
.option("--limit <n>", "Maximum number of jobs to return (default: 20)", "20")
|
|
8
|
-
.addHelpText("after", `
|
|
9
|
-
Subcommands:
|
|
10
|
-
naive jobs List all jobs (with optional filters)
|
|
11
|
-
naive jobs get <job_id> Get detailed status for a specific job
|
|
12
|
-
naive jobs cancel <job_id> Cancel a queued or running job
|
|
13
|
-
|
|
14
|
-
Examples:
|
|
15
|
-
$ naive jobs
|
|
16
|
-
$ naive jobs --status processing
|
|
17
|
-
$ naive jobs --status completed --limit 5
|
|
18
|
-
$ naive jobs get 550e8400-e29b-41d4-a716-446655440000
|
|
19
|
-
$ naive jobs cancel 550e8400-e29b-41d4-a716-446655440000
|
|
20
|
-
|
|
21
|
-
What are jobs?
|
|
22
|
-
Long-running operations (image generation, video generation, deep research)
|
|
23
|
-
are processed asynchronously. When you submit one, you get a job_id.
|
|
24
|
-
Use this command to monitor progress and retrieve results.
|
|
25
|
-
|
|
26
|
-
Job lifecycle:
|
|
27
|
-
queued → processing → completed (success) or failed (error)
|
|
28
|
-
|
|
29
|
-
Credit behavior:
|
|
30
|
-
- Credits are NOT reserved at submission time
|
|
31
|
-
- Credits are deducted ONLY when a job completes successfully
|
|
32
|
-
- Failed or cancelled jobs do not cost any credits
|
|
33
|
-
`)
|
|
34
|
-
.action(async (opts) => {
|
|
35
|
-
const params = new URLSearchParams({ limit: opts.limit });
|
|
36
|
-
if (opts.status)
|
|
37
|
-
params.set("status", opts.status);
|
|
38
|
-
const resp = await apiRequest("GET", `/v1/jobs?${params}`);
|
|
39
|
-
handleApiError("jobs.list", resp);
|
|
40
|
-
const data = resp.data;
|
|
41
|
-
const count = data.jobs?.length ?? 0;
|
|
42
|
-
const running = data.jobs?.filter((j) => j.status === "processing" || j.status === "queued") ?? [];
|
|
43
|
-
agentOutput({
|
|
44
|
-
action: "jobs.list",
|
|
45
|
-
result: resp.data,
|
|
46
|
-
next_steps: [
|
|
47
|
-
...(running.length > 0
|
|
48
|
-
? [{ command: `naive jobs get ${running[0].id}`, description: `Check progress of ${running[0].type} job` }]
|
|
49
|
-
: []),
|
|
50
|
-
{ command: "naive jobs --status completed --limit 5", description: "See recently completed jobs with results" },
|
|
51
|
-
...(running.length > 0
|
|
52
|
-
? [{ command: `naive jobs cancel ${running[0].id}`, description: "Cancel a running job (no credits charged)" }]
|
|
53
|
-
: []),
|
|
54
|
-
],
|
|
55
|
-
hints: [
|
|
56
|
-
`${count} jobs found${opts.status ? ` (filtered: ${opts.status})` : ""}`,
|
|
57
|
-
`${running.length} active (queued/processing)`,
|
|
58
|
-
"Credits are deducted only when jobs complete successfully",
|
|
59
|
-
],
|
|
60
|
-
related_commands: ["naive jobs get", "naive jobs cancel", "naive images generate", "naive video generate", "naive search research"],
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
jobsCmd
|
|
64
|
-
.command("get <job_id>")
|
|
65
|
-
.description("Get full details and result for a specific job")
|
|
66
|
-
.addHelpText("after", `
|
|
67
|
-
Examples:
|
|
68
|
-
$ naive jobs get 550e8400-e29b-41d4-a716-446655440000
|
|
69
|
-
|
|
70
|
-
What this does:
|
|
71
|
-
Returns comprehensive details for a job:
|
|
72
|
-
- Status (queued, processing, completed, failed)
|
|
73
|
-
- Type (image_generation, video_generation, deep_research)
|
|
74
|
-
- Progress percentage
|
|
75
|
-
- Model used
|
|
76
|
-
- Input parameters
|
|
77
|
-
- Result (when completed — includes URLs for generated media)
|
|
78
|
-
- Error message (when failed)
|
|
79
|
-
- Credits used
|
|
80
|
-
- Timestamps (created, started, completed)
|
|
81
|
-
`)
|
|
82
|
-
.action(async (id) => {
|
|
83
|
-
const resp = await apiRequest("GET", `/v1/jobs/${id}`);
|
|
84
|
-
handleApiError("jobs.get", resp);
|
|
85
|
-
const data = resp.data;
|
|
86
|
-
agentOutput({
|
|
87
|
-
action: "jobs.get",
|
|
88
|
-
result: resp.data,
|
|
89
|
-
next_steps: [
|
|
90
|
-
...(data.status === "queued" || data.status === "processing"
|
|
91
|
-
? [
|
|
92
|
-
{ command: `naive jobs get ${id}`, description: "Check again in a few seconds" },
|
|
93
|
-
{ command: `naive jobs cancel ${id}`, description: "Cancel this job" },
|
|
94
|
-
]
|
|
95
|
-
: []),
|
|
96
|
-
...(data.status === "completed"
|
|
97
|
-
? [{ command: `naive ${data.type === "video_generation" ? "video" : data.type === "image_generation" ? "images" : "search"} generate "new prompt"`, description: `Generate another ${data.type?.replace("_generation", "") ?? "item"}` }]
|
|
98
|
-
: []),
|
|
99
|
-
{ command: "naive jobs", description: "View all jobs" },
|
|
100
|
-
],
|
|
101
|
-
hints: [
|
|
102
|
-
`Job ${id}: ${data.status}`,
|
|
103
|
-
...(data.status === "completed" ? ["Result is included in the output above"] : []),
|
|
104
|
-
...(data.status === "processing" ? ["Job is actively processing — check back soon"] : []),
|
|
105
|
-
...(data.status === "failed" ? [`Failed (no credits deducted). Reason: ${data.error || "unknown"}`] : []),
|
|
106
|
-
],
|
|
107
|
-
related_commands: ["naive jobs", "naive jobs cancel"],
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
jobsCmd
|
|
111
|
-
.command("cancel <job_id>")
|
|
112
|
-
.description("Cancel a queued or processing job (no credits charged for cancelled jobs)")
|
|
113
|
-
.addHelpText("after", `
|
|
114
|
-
Examples:
|
|
115
|
-
$ naive jobs cancel 550e8400-e29b-41d4-a716-446655440000
|
|
116
|
-
|
|
117
|
-
What this does:
|
|
118
|
-
Attempts to cancel the specified job. Cancellation is best-effort:
|
|
119
|
-
- Queued jobs: cancelled immediately
|
|
120
|
-
- Processing jobs: cancellation requested (may still complete)
|
|
121
|
-
- Completed/failed jobs: cannot be cancelled
|
|
122
|
-
|
|
123
|
-
Notes:
|
|
124
|
-
- Cancelled jobs never deduct credits
|
|
125
|
-
- If the job already completed, you'll get an error
|
|
126
|
-
`)
|
|
127
|
-
.action(async (id) => {
|
|
128
|
-
const resp = await apiRequest("DELETE", `/v1/jobs/${id}`);
|
|
129
|
-
handleApiError("jobs.cancel", resp);
|
|
130
|
-
agentOutput({
|
|
131
|
-
action: "jobs.cancel",
|
|
132
|
-
result: { job_id: id, cancelled: true },
|
|
133
|
-
next_steps: [
|
|
134
|
-
{ command: "naive jobs --status processing", description: "Check remaining active jobs" },
|
|
135
|
-
{ command: `naive jobs get ${id}`, description: "Verify cancellation status" },
|
|
136
|
-
],
|
|
137
|
-
hints: [
|
|
138
|
-
"Job cancellation requested — no credits will be charged",
|
|
139
|
-
"Running jobs may still complete if processing already started",
|
|
140
|
-
],
|
|
141
|
-
related_commands: ["naive jobs", "naive jobs get"],
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
//# sourceMappingURL=jobs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../src/commands/jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KACvC,WAAW,CAAC,gFAAgF,CAAC;KAC7F,MAAM,CAAC,mBAAmB,EAAE,4DAA4D,CAAC;KACzF,MAAM,CAAC,aAAa,EAAE,gDAAgD,EAAE,IAAI,CAAC;KAC7E,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;CAyBvB,CAAC;KACC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1D,IAAI,IAAI,CAAC,MAAM;QAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,YAAY,MAAM,EAAE,CAAC,CAAC;IAC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AC/E;QACD,KAAK,EAAE;YACL,yDAAyD;YACzD,+DAA+D;SAChE;QACD,gBAAgB,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;KACnD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/commands/keys.d.ts
DELETED
package/dist/commands/keys.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { apiRequest, sessionRequest, handleApiError } from "../client.js";
|
|
3
|
-
import { agentOutput } from "../output.js";
|
|
4
|
-
export const keysCmd = new Command("keys")
|
|
5
|
-
.description("Manage API keys for the current agent and company")
|
|
6
|
-
.addHelpText("after", `
|
|
7
|
-
Subcommands:
|
|
8
|
-
naive keys list List all API keys
|
|
9
|
-
naive keys create Create a new API key
|
|
10
|
-
naive keys revoke Revoke (deactivate) an API key
|
|
11
|
-
|
|
12
|
-
Examples:
|
|
13
|
-
$ naive keys list
|
|
14
|
-
$ naive keys create --name "CI Pipeline Key"
|
|
15
|
-
$ naive keys revoke abc123-def456
|
|
16
|
-
|
|
17
|
-
Notes:
|
|
18
|
-
- API keys are scoped to a specific agent + company pair
|
|
19
|
-
- Revoking a key is permanent — it cannot be un-revoked
|
|
20
|
-
- Each login/register creates a key; use 'keys list' to audit them
|
|
21
|
-
`);
|
|
22
|
-
keysCmd
|
|
23
|
-
.command("list")
|
|
24
|
-
.description("List all API keys for the current agent/company")
|
|
25
|
-
.addHelpText("after", `
|
|
26
|
-
Examples:
|
|
27
|
-
$ naive keys list
|
|
28
|
-
|
|
29
|
-
Output includes:
|
|
30
|
-
- Key ID (for revocation)
|
|
31
|
-
- Key name/label
|
|
32
|
-
- Last 4 characters (masked)
|
|
33
|
-
- Creation date
|
|
34
|
-
- Last used date
|
|
35
|
-
- Revoked status
|
|
36
|
-
`)
|
|
37
|
-
.action(async () => {
|
|
38
|
-
const resp = await apiRequest("GET", "/v1/auth/keys");
|
|
39
|
-
handleApiError("keys.list", resp);
|
|
40
|
-
const data = resp.data;
|
|
41
|
-
const activeKeys = data.keys?.filter((k) => !k.revoked) ?? [];
|
|
42
|
-
const revokedKeys = data.keys?.filter((k) => k.revoked) ?? [];
|
|
43
|
-
agentOutput({
|
|
44
|
-
action: "keys.list",
|
|
45
|
-
result: resp.data,
|
|
46
|
-
next_steps: [
|
|
47
|
-
{ command: "naive keys create --name <label>", description: "Create a new API key", when: "You need a key for another service or environment" },
|
|
48
|
-
...(activeKeys.length > 1
|
|
49
|
-
? [{ command: `naive keys revoke <key_id>`, description: "Revoke an unused key", when: "You want to deactivate a key you no longer need" }]
|
|
50
|
-
: []),
|
|
51
|
-
],
|
|
52
|
-
hints: [
|
|
53
|
-
`${activeKeys.length} active keys, ${revokedKeys.length} revoked`,
|
|
54
|
-
"Revoked keys are shown for audit purposes but cannot authenticate",
|
|
55
|
-
],
|
|
56
|
-
related_commands: ["naive keys create", "naive keys revoke", "naive whoami"],
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
keysCmd
|
|
60
|
-
.command("create")
|
|
61
|
-
.description("Create a new API key for the current agent/company")
|
|
62
|
-
.option("--name <name>", "Human-readable label for the key (e.g. 'CI Key', 'Production')")
|
|
63
|
-
.option("--scope <scope...>", "Restrict the key to a scope. Repeatable. Requires a signed-in session ('naive auth login'). Available: wallet:admin")
|
|
64
|
-
.addHelpText("after", `
|
|
65
|
-
Examples:
|
|
66
|
-
$ naive keys create --name "Production Server"
|
|
67
|
-
$ naive keys create --name "GitHub Actions"
|
|
68
|
-
$ naive keys create --name "Wallet ops (CI)" --scope wallet:admin
|
|
69
|
-
|
|
70
|
-
What this does:
|
|
71
|
-
Issues a new API key (nv_sk_live_...) for the current agent and company.
|
|
72
|
-
The key is shown ONCE — save it securely.
|
|
73
|
-
|
|
74
|
-
Scopes:
|
|
75
|
-
An unscoped key has full access. --scope narrows a key to one route family.
|
|
76
|
-
Minting a scoped key requires a signed-in SESSION, not an api key — because
|
|
77
|
-
"wallet:admin" GRANTS the wallet operator surface (fund/transfer/policy/sweep)
|
|
78
|
-
rather than restricting it, so a key that could mint it would be a way for an
|
|
79
|
-
agent to grant itself the float it is supposed to be denied.
|
|
80
|
-
|
|
81
|
-
wallet:admin Administer per-agent crypto wallets headlessly (CI). Reaches
|
|
82
|
-
/v1/users/*/wallet ONLY — deliberately NOT /payments, so the
|
|
83
|
-
key can move the float but cannot spend it.
|
|
84
|
-
|
|
85
|
-
Use cases:
|
|
86
|
-
- Provisioning keys for different environments
|
|
87
|
-
- Giving a key to a specific service/integration
|
|
88
|
-
- Rotating keys (create new, revoke old)
|
|
89
|
-
`)
|
|
90
|
-
.action(async (opts) => {
|
|
91
|
-
const scopes = opts.scope?.length ? opts.scope : undefined;
|
|
92
|
-
// Scoped keys are session-only (see above), so they go over sessionRequest —
|
|
93
|
-
// apiRequest would send the agent bearer and be refused by the server.
|
|
94
|
-
const resp = scopes
|
|
95
|
-
? await sessionRequest("POST", "/v1/auth/keys", { body: { name: opts.name, scopes } })
|
|
96
|
-
: await apiRequest("POST", "/v1/auth/keys", { name: opts.name });
|
|
97
|
-
handleApiError("keys.create", resp);
|
|
98
|
-
const data = resp.data;
|
|
99
|
-
agentOutput({
|
|
100
|
-
action: "keys.create",
|
|
101
|
-
result: {
|
|
102
|
-
key_id: data.key_id,
|
|
103
|
-
name: data.name,
|
|
104
|
-
api_key: data.api_key,
|
|
105
|
-
},
|
|
106
|
-
next_steps: [
|
|
107
|
-
{ command: "naive keys list", description: "Verify the new key appears in your key list" },
|
|
108
|
-
],
|
|
109
|
-
hints: [
|
|
110
|
-
"IMPORTANT: Save this key now. It will not be shown again.",
|
|
111
|
-
"Use this key as a Bearer token: Authorization: Bearer <key>",
|
|
112
|
-
"Set as NAIVE_API_KEY environment variable for headless use",
|
|
113
|
-
...(scopes?.length
|
|
114
|
-
? [`This key is restricted to: ${scopes.join(", ")}. It cannot reach any other route family.`]
|
|
115
|
-
: []),
|
|
116
|
-
],
|
|
117
|
-
related_commands: ["naive keys list", "naive keys revoke"],
|
|
118
|
-
// Security: the raw key is echoed ONCE in result.api_key above. Do NOT interpolate it into
|
|
119
|
-
// these example commands — that multiplied it 3× and made it a copy-into-shell-history footgun.
|
|
120
|
-
help_markdown: "### Key Created\n\n**Save the `api_key` above immediately** — it cannot be retrieved later.\n\nTo use:\n```bash\nexport NAIVE_API_KEY=\"<your-key>\"\n# or in requests:\ncurl -H \"Authorization: Bearer <your-key>\" ...\n```",
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
keysCmd
|
|
124
|
-
.command("revoke <key_id>")
|
|
125
|
-
.description("Permanently revoke an API key (cannot be undone)")
|
|
126
|
-
.addHelpText("after", `
|
|
127
|
-
Examples:
|
|
128
|
-
$ naive keys revoke 550e8400-e29b-41d4-a716-446655440000
|
|
129
|
-
|
|
130
|
-
What this does:
|
|
131
|
-
Permanently deactivates the specified key. Any requests using
|
|
132
|
-
this key will receive 401 Unauthorized.
|
|
133
|
-
|
|
134
|
-
WARNING:
|
|
135
|
-
- This action cannot be undone
|
|
136
|
-
- Ensure no active services depend on this key before revoking
|
|
137
|
-
- Use 'naive keys list' to find the key ID
|
|
138
|
-
`)
|
|
139
|
-
.action(async (id) => {
|
|
140
|
-
const resp = await apiRequest("DELETE", `/v1/auth/keys/${id}`);
|
|
141
|
-
handleApiError("keys.revoke", resp);
|
|
142
|
-
agentOutput({
|
|
143
|
-
action: "keys.revoke",
|
|
144
|
-
result: { key_id: id, revoked: true },
|
|
145
|
-
next_steps: [
|
|
146
|
-
{ command: "naive keys list", description: "Verify the key shows as revoked" },
|
|
147
|
-
{ command: "naive keys create --name <label>", description: "Create a replacement key if needed" },
|
|
148
|
-
],
|
|
149
|
-
hints: [
|
|
150
|
-
"This key is now permanently deactivated",
|
|
151
|
-
"Any service using this key will receive 401 errors",
|
|
152
|
-
],
|
|
153
|
-
related_commands: ["naive keys list", "naive keys create"],
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
//# sourceMappingURL=keys.js.map
|
|
@@ -1 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CAAyC;YACzC,oDAAoD;SACrD;QACD,gBAAgB,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;KAC3D,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `naive verify` — a RETIRED command, and the reference implementation of what
|
|
3
|
-
* "retired" means on this CLI (as opposed to "deprecated", which keeps working).
|
|
4
|
-
*
|
|
5
|
-
* ── WHY THIS FILE EXISTS AGAIN ──────────────────────────────────────────────
|
|
6
|
-
*
|
|
7
|
-
* 06 §1.1 cites `commands/link.ts:16-32` as the in-tree precedent for a retired
|
|
8
|
-
* command. MEASURED: that file is not in this branch. Commit `4d8a272d`
|
|
9
|
-
* ("security: remove an unauthenticated endpoint pair that minted API keys for
|
|
10
|
-
* any account") deleted `POST /v1/auth/link` and `POST /v1/auth/verify` — which
|
|
11
|
-
* was right; the code was a 6-digit `Math.random()` credential that sent no email
|
|
12
|
-
* — and removed the CLI's `link`/`verify` commands with them.
|
|
13
|
-
*
|
|
14
|
-
* The removal left `src/index.ts` advertising both in `--help` while neither was
|
|
15
|
-
* registered, so `naive verify` fell through to the `command:*` handler and
|
|
16
|
-
* answered `cli_outdated`: *"this command may exist in a newer version"*. That is
|
|
17
|
-
* false in the one way that matters — it tells an operator to upgrade and try
|
|
18
|
-
* again, when the flow was deliberately destroyed and is never coming back.
|
|
19
|
-
*
|
|
20
|
-
* This restores ONLY the refusal. It makes no request, imports no auth path, and
|
|
21
|
-
* cannot reach the deleted endpoints. `naive link` is NOT restored: it was a soft
|
|
22
|
-
* alias for a live sign-in flow, and re-adding a command a security commit
|
|
23
|
-
* removed is not a thing to do quietly — its stale `--help` line is deleted
|
|
24
|
-
* instead.
|
|
25
|
-
*/
|
|
26
|
-
import { Command } from "commander";
|
|
27
|
-
export declare const verifyCmd: Command;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `naive verify` — a RETIRED command, and the reference implementation of what
|
|
3
|
-
* "retired" means on this CLI (as opposed to "deprecated", which keeps working).
|
|
4
|
-
*
|
|
5
|
-
* ── WHY THIS FILE EXISTS AGAIN ──────────────────────────────────────────────
|
|
6
|
-
*
|
|
7
|
-
* 06 §1.1 cites `commands/link.ts:16-32` as the in-tree precedent for a retired
|
|
8
|
-
* command. MEASURED: that file is not in this branch. Commit `4d8a272d`
|
|
9
|
-
* ("security: remove an unauthenticated endpoint pair that minted API keys for
|
|
10
|
-
* any account") deleted `POST /v1/auth/link` and `POST /v1/auth/verify` — which
|
|
11
|
-
* was right; the code was a 6-digit `Math.random()` credential that sent no email
|
|
12
|
-
* — and removed the CLI's `link`/`verify` commands with them.
|
|
13
|
-
*
|
|
14
|
-
* The removal left `src/index.ts` advertising both in `--help` while neither was
|
|
15
|
-
* registered, so `naive verify` fell through to the `command:*` handler and
|
|
16
|
-
* answered `cli_outdated`: *"this command may exist in a newer version"*. That is
|
|
17
|
-
* false in the one way that matters — it tells an operator to upgrade and try
|
|
18
|
-
* again, when the flow was deliberately destroyed and is never coming back.
|
|
19
|
-
*
|
|
20
|
-
* This restores ONLY the refusal. It makes no request, imports no auth path, and
|
|
21
|
-
* cannot reach the deleted endpoints. `naive link` is NOT restored: it was a soft
|
|
22
|
-
* alias for a live sign-in flow, and re-adding a command a security commit
|
|
23
|
-
* removed is not a thing to do quietly — its stale `--help` line is deleted
|
|
24
|
-
* instead.
|
|
25
|
-
*/
|
|
26
|
-
import { Command } from "commander";
|
|
27
|
-
import { deprecationNotice, deprecationRecord, retiredCommand } from "../lib/deprecation.js";
|
|
28
|
-
export const verifyCmd = new Command("verify")
|
|
29
|
-
.description("Retired: six-digit verification-code sign-in no longer exists")
|
|
30
|
-
.option("--email <email>", "Legacy account email (ignored)")
|
|
31
|
-
.option("--code <code>", "Legacy verification code (ignored)")
|
|
32
|
-
.action(() => {
|
|
33
|
-
const rec = deprecationRecord(verifyCmd, {
|
|
34
|
-
// `dep.cli.*`, not `dep.primitive.*`: this retirement has no REST twin.
|
|
35
|
-
// The endpoints were DELETED (commit 4d8a272d, a security removal), so
|
|
36
|
-
// there is no operation for the register to mark and no header to
|
|
37
|
-
// correlate with. The namespace is what makes that legible instead of
|
|
38
|
-
// looking like a missing row.
|
|
39
|
-
id: "dep.cli.verify",
|
|
40
|
-
drives: "the six-digit verification-code sign-in, which was removed for security and has no successor.",
|
|
41
|
-
alsoCalled: [],
|
|
42
|
-
replacement: { kind: "use", what: "naive auth email <email>" },
|
|
43
|
-
why: "the code was generated with a non-cryptographic RNG, was never emailed, and minted a live API key on match",
|
|
44
|
-
since: "2026-07",
|
|
45
|
-
sunset: { kind: "frozen" },
|
|
46
|
-
// The magic-link flow this record's `recovery_steps` recommend. There is no
|
|
47
|
-
// `cli/auth` page and there never was: this URL 404'd on every run of
|
|
48
|
-
// `naive verify`, which is the one command guaranteed to send a user
|
|
49
|
-
// looking for it. `__tests__/docs-links.test.ts` now resolves every
|
|
50
|
-
// outbound docs URL in this package against naive-docs/ and docs.json.
|
|
51
|
-
guide: "https://usenaive.ai/docs/getting-started/authentication",
|
|
52
|
-
});
|
|
53
|
-
retiredCommand({
|
|
54
|
-
action: "verify",
|
|
55
|
-
message: "Six-digit verification-code sign-in has been retired and will not return. " +
|
|
56
|
-
"Use the durable email magic-link flow.",
|
|
57
|
-
recovery_steps: [
|
|
58
|
-
{ command: "naive auth email <email>", description: "Sign in with an email magic link" },
|
|
59
|
-
{ command: "naive auth google", description: "Sign in with Google in your browser" },
|
|
60
|
-
],
|
|
61
|
-
notice: deprecationNotice(rec, "retired"),
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=legacy-auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-auth.js","sourceRoot":"","sources":["../../src/commands/legacy-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WA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{ Command } from "commander";
|
|
2
|
-
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
-
import { agentOutput } from "../output.js";
|
|
4
|
-
export const llmCmd = new Command("llm")
|
|
5
|
-
.description("Run LLM chat completions through OpenRouter (300+ models) — a full wrapper over OpenRouter")
|
|
6
|
-
.addHelpText("after", `
|
|
7
|
-
Subcommands:
|
|
8
|
-
naive llm chat -m <model> "<prompt>" Run a chat completion
|
|
9
|
-
naive llm models [search] List routable models
|
|
10
|
-
|
|
11
|
-
Examples:
|
|
12
|
-
$ naive llm chat -m anthropic/claude-sonnet-4.6 "Write a haiku about Paris"
|
|
13
|
-
$ naive llm chat -m openai/gpt-5.2 --system "You are terse." "Summarize REST in one line"
|
|
14
|
-
$ naive llm chat -m meta-llama/llama-3.3-70b-instruct "Hi" --fallback openai/gpt-5.2
|
|
15
|
-
$ naive llm models claude
|
|
16
|
-
|
|
17
|
-
Billing:
|
|
18
|
-
Billed in Naive credits based on the model's token cost (OpenRouter usage.cost x markup).
|
|
19
|
-
Listing models is free.
|
|
20
|
-
`);
|
|
21
|
-
llmCmd
|
|
22
|
-
.command("chat [prompt]")
|
|
23
|
-
.description("Run a chat completion (non-streaming)")
|
|
24
|
-
.requiredOption("-m, --model <model>", "OpenRouter model id, e.g. anthropic/claude-sonnet-4.6")
|
|
25
|
-
.option("--system <text>", "Optional system prompt")
|
|
26
|
-
.option("--fallback <models...>", "Fallback model chain (tried in order)")
|
|
27
|
-
.option("--temperature <n>", "Sampling temperature (0-2)")
|
|
28
|
-
.option("--max-tokens <n>", "Max tokens to generate")
|
|
29
|
-
.action(async (prompt, opts) => {
|
|
30
|
-
if (!prompt) {
|
|
31
|
-
console.log(JSON.stringify({
|
|
32
|
-
success: false,
|
|
33
|
-
action: "llm.chat",
|
|
34
|
-
error: { code: "missing_argument", message: "A prompt is required" },
|
|
35
|
-
recovery_steps: [
|
|
36
|
-
{ command: 'naive llm chat -m openai/gpt-5.2 "your prompt"', description: "Provide a prompt" },
|
|
37
|
-
{ command: "naive llm chat --help", description: "See all options" },
|
|
38
|
-
],
|
|
39
|
-
}, null, 2));
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
const messages = [];
|
|
43
|
-
if (opts.system)
|
|
44
|
-
messages.push({ role: "system", content: opts.system });
|
|
45
|
-
messages.push({ role: "user", content: prompt });
|
|
46
|
-
const body = { model: opts.model, messages };
|
|
47
|
-
if (opts.fallback)
|
|
48
|
-
body.models = opts.fallback;
|
|
49
|
-
if (opts.temperature !== undefined)
|
|
50
|
-
body.temperature = parseFloat(opts.temperature);
|
|
51
|
-
if (opts.maxTokens !== undefined)
|
|
52
|
-
body.max_tokens = parseInt(opts.maxTokens);
|
|
53
|
-
const resp = await apiRequest("POST", "/v1/llm/chat/completions", body);
|
|
54
|
-
handleApiError("llm.chat", resp);
|
|
55
|
-
const data = resp.data;
|
|
56
|
-
const content = data.choices?.[0]?.message?.content ?? "";
|
|
57
|
-
// N9: the output was cut off at the model's token cap. The API sets truncated:true
|
|
58
|
-
// (finish_reason === "length"); fall back to reading finish_reason directly so this
|
|
59
|
-
// still fires against an older API. Warn on stderr — a scripted caller reading only
|
|
60
|
-
// stdout JSON still gets truncated:true in the result, but a human sees it too.
|
|
61
|
-
const truncated = data.truncated === true || data.choices?.some((c) => c.finish_reason === "length") === true;
|
|
62
|
-
if (truncated) {
|
|
63
|
-
process.stderr.write(" ⚠ Output was truncated — the model hit its token limit (finish_reason: length). " +
|
|
64
|
-
"The response is incomplete. Re-run with a higher --max-tokens to get the full output.\n");
|
|
65
|
-
}
|
|
66
|
-
agentOutput({
|
|
67
|
-
action: "llm.chat",
|
|
68
|
-
result: resp.data,
|
|
69
|
-
next_steps: [
|
|
70
|
-
...(truncated
|
|
71
|
-
? [{ command: `naive llm chat -m ${opts.model} --max-tokens <higher> "${prompt.slice(0, 40)}…"`, description: "Re-run with a higher token cap to avoid truncation" }]
|
|
72
|
-
: []),
|
|
73
|
-
{ command: "naive llm models", description: "Browse other available models" },
|
|
74
|
-
{ command: "naive usage", description: "See credit usage" },
|
|
75
|
-
],
|
|
76
|
-
hints: [
|
|
77
|
-
content ? `Response: ${content.slice(0, 200)}${content.length > 200 ? "…" : ""}` : "Completed",
|
|
78
|
-
`Model: ${data.model ?? opts.model}`,
|
|
79
|
-
`Credits used: ${data.credits_used ?? 0}`,
|
|
80
|
-
...(truncated ? ["⚠ Output truncated at the token limit (finish_reason: length) — response is incomplete; raise --max-tokens"] : []),
|
|
81
|
-
],
|
|
82
|
-
related_commands: ["naive llm models", "naive usage"],
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
llmCmd
|
|
86
|
-
.command("models [search]")
|
|
87
|
-
.description("List the models OpenRouter can route to (free)")
|
|
88
|
-
.action(async (search) => {
|
|
89
|
-
const q = search ? `?search=${encodeURIComponent(search)}` : "";
|
|
90
|
-
const resp = await apiRequest("GET", `/v1/llm/models${q}`);
|
|
91
|
-
handleApiError("llm.models", resp);
|
|
92
|
-
const data = resp.data;
|
|
93
|
-
agentOutput({
|
|
94
|
-
action: "llm.models",
|
|
95
|
-
result: resp.data,
|
|
96
|
-
next_steps: [
|
|
97
|
-
{ command: 'naive llm chat -m <model> "your prompt"', description: "Run a completion with one of these models" },
|
|
98
|
-
],
|
|
99
|
-
hints: [
|
|
100
|
-
`${data.count ?? data.models?.length ?? 0} models${search ? ` matching "${search}"` : ""}`,
|
|
101
|
-
"Listing models is free",
|
|
102
|
-
],
|
|
103
|
-
related_commands: ["naive llm chat"],
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
//# sourceMappingURL=llm.js.map
|
package/dist/commands/llm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/commands/llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,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3D,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAEnC,MAAM,IAAI,GAAG,IAAI,CAAC,IAA0D,CAAC;IAC7E,WAAW,CAAC;QACV,MAAM,EAAE,YAAY;QACpB,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,yCAAyC,EAAE,WAAW,EAAE,2CAA2C,EAAE;SACjH;QACD,KAAK,EAAE;YACL,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,UAAU,MAAM,CAAC,CAAC,CAAC,cAAc,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1F,wBAAwB;SACzB;QACD,gBAAgB,EAAE,CAAC,gBAAgB,CAAC;KACrC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/commands/login.d.ts
DELETED
package/dist/commands/login.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
-
import { saveConfig } from "../config.js";
|
|
4
|
-
import { agentOutput } from "../output.js";
|
|
5
|
-
export const loginCmd = new Command("login")
|
|
6
|
-
.description("Log in to an existing Naive account with email and password")
|
|
7
|
-
.requiredOption("--email <email>", "Account email address")
|
|
8
|
-
.requiredOption("--password <password>", "Account password")
|
|
9
|
-
.addHelpText("after", `
|
|
10
|
-
Examples:
|
|
11
|
-
$ naive login --email alex@company.com --password mypassword123
|
|
12
|
-
|
|
13
|
-
What this does:
|
|
14
|
-
1. Authenticates with your email and password
|
|
15
|
-
2. Issues a fresh API key for your default company
|
|
16
|
-
3. Saves credentials to ~/.naive/config.json
|
|
17
|
-
|
|
18
|
-
Notes:
|
|
19
|
-
- If you have multiple companies, the first one is selected by default
|
|
20
|
-
- Use 'naive companies' then 'naive companies select <id>' to switch
|
|
21
|
-
- This uses the same credentials as the Naive dashboard (usenaive.ai)
|
|
22
|
-
- Each login creates a new API key (old keys remain valid)
|
|
23
|
-
`)
|
|
24
|
-
.action(async (opts) => {
|
|
25
|
-
const resp = await apiRequest("POST", "/v1/auth/login", {
|
|
26
|
-
email: opts.email,
|
|
27
|
-
password: opts.password,
|
|
28
|
-
}, { noAuth: true });
|
|
29
|
-
handleApiError("login", resp);
|
|
30
|
-
const data = resp.data;
|
|
31
|
-
saveConfig({
|
|
32
|
-
api_key: data.api_key,
|
|
33
|
-
agent_id: data.agent_id,
|
|
34
|
-
company_id: data.company_id,
|
|
35
|
-
company_name: data.company_name,
|
|
36
|
-
// Drop any prior `naive use` subject — it belongs to another workspace.
|
|
37
|
-
active_user_id: undefined,
|
|
38
|
-
});
|
|
39
|
-
const hasMultipleCompanies = data.companies && data.companies.length > 1;
|
|
40
|
-
agentOutput({
|
|
41
|
-
action: "login",
|
|
42
|
-
result: {
|
|
43
|
-
agent_id: data.agent_id,
|
|
44
|
-
company_id: data.company_id,
|
|
45
|
-
company_name: data.company_name,
|
|
46
|
-
credentials_saved: "~/.naive/config.json",
|
|
47
|
-
companies: data.companies,
|
|
48
|
-
},
|
|
49
|
-
next_steps: [
|
|
50
|
-
{ command: "naive status", description: "Check current credits and resources" },
|
|
51
|
-
{ command: "naive identity", description: "View available resources for this company" },
|
|
52
|
-
...(hasMultipleCompanies
|
|
53
|
-
? [{ command: "naive companies select <id>", description: "Switch to a different company", when: "You want to operate under a different company" }]
|
|
54
|
-
: []),
|
|
55
|
-
],
|
|
56
|
-
hints: [
|
|
57
|
-
"Logged in successfully — API key saved for automatic auth",
|
|
58
|
-
...(hasMultipleCompanies
|
|
59
|
-
? [`You have ${data.companies.length} companies. Currently using "${data.company_name}". Use 'naive companies' to see all.`]
|
|
60
|
-
: []),
|
|
61
|
-
],
|
|
62
|
-
related_commands: ["naive whoami", "naive companies", "naive status", "naive keys list"],
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
//# sourceMappingURL=login.js.map
|
|
@@ -1 +0,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ACV,MAAM,EAAE,OAAO;QACf,MAAM,EAAE;YACN,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,iBAAiB,EAAE,sBAAsB;YACzC,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B;QACD,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,qCAAqC,EAAE;YAC/E,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,2CAA2C,EAAE;YACvF,GAAG,CAAC,oBAAoB;gBACtB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,WAAW,EAAE,+BAA+B,EAAE,IAAI,EAAE,+CAA+C,EAAE,CAAC;gBACnJ,CAAC,CAAC,EAAE,CAAC;SACR;QACD,KAAK,EAAE;YACL,2DAA2D;YAC3D,GAAG,CAAC,oBAAoB;gBACtB,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,gCAAgC,IAAI,CAAC,YAAY,sCAAsC,CAAC;gBAC5H,CAAC,CAAC,EAAE,CAAC;SACR;QACD,gBAAgB,EAAE,CAAC,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,CAAC;KACzF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* Top-level agent logout — clears the saved API key from ~/.naive/config.json.
|
|
4
|
-
* Distinct from `naive auth logout`, which ends the human session cookie only.
|
|
5
|
-
* Dogfood auth noted the missing top-level command as friction (3767 / e983).
|
|
6
|
-
*/
|
|
7
|
-
export declare const logoutCmd: Command;
|