@usenaive-sdk/cli 0.12.5 โ†’ 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +55 -6
  2. package/dist/client.d.ts +48 -0
  3. package/dist/client.js +199 -27
  4. package/dist/client.js.map +1 -1
  5. package/dist/commands/aeo.js +56 -21
  6. package/dist/commands/aeo.js.map +1 -1
  7. package/dist/commands/app-data.js +29 -11
  8. package/dist/commands/app-data.js.map +1 -1
  9. package/dist/commands/apps.d.ts +7 -0
  10. package/dist/commands/apps.js +255 -18
  11. package/dist/commands/apps.js.map +1 -1
  12. package/dist/commands/audio.d.ts +9 -0
  13. package/dist/commands/audio.js +391 -0
  14. package/dist/commands/audio.js.map +1 -0
  15. package/dist/commands/auth.d.ts +1 -0
  16. package/dist/commands/auth.js +20 -17
  17. package/dist/commands/auth.js.map +1 -1
  18. package/dist/commands/billing.js +9 -9
  19. package/dist/commands/billing.js.map +1 -1
  20. package/dist/commands/brain.js +798 -52
  21. package/dist/commands/brain.js.map +1 -1
  22. package/dist/commands/browser.js +8 -8
  23. package/dist/commands/browser.js.map +1 -1
  24. package/dist/commands/business.js +117 -16
  25. package/dist/commands/business.js.map +1 -1
  26. package/dist/commands/clone.js +6 -2
  27. package/dist/commands/clone.js.map +1 -1
  28. package/dist/commands/companies.d.ts +8 -0
  29. package/dist/commands/companies.js +137 -47
  30. package/dist/commands/companies.js.map +1 -1
  31. package/dist/commands/company-data.d.ts +2 -0
  32. package/dist/commands/company-data.js +168 -0
  33. package/dist/commands/company-data.js.map +1 -0
  34. package/dist/commands/compute.js +10 -3
  35. package/dist/commands/compute.js.map +1 -1
  36. package/dist/commands/connections.d.ts +6 -0
  37. package/dist/commands/connections.js +29 -1
  38. package/dist/commands/connections.js.map +1 -1
  39. package/dist/commands/domains.js +1 -1
  40. package/dist/commands/ecommerce.js +19 -9
  41. package/dist/commands/ecommerce.js.map +1 -1
  42. package/dist/commands/email.js +56 -9
  43. package/dist/commands/email.js.map +1 -1
  44. package/dist/commands/formation.js +3 -3
  45. package/dist/commands/identity.js +4 -3
  46. package/dist/commands/identity.js.map +1 -1
  47. package/dist/commands/images.js +85 -11
  48. package/dist/commands/images.js.map +1 -1
  49. package/dist/commands/init.d.ts +3 -0
  50. package/dist/commands/init.js +39 -36
  51. package/dist/commands/init.js.map +1 -1
  52. package/dist/commands/jobs.js +1 -0
  53. package/dist/commands/jobs.js.map +1 -1
  54. package/dist/commands/legacy-auth.d.ts +27 -0
  55. package/dist/commands/legacy-auth.js +64 -0
  56. package/dist/commands/legacy-auth.js.map +1 -0
  57. package/dist/commands/llm.js +13 -0
  58. package/dist/commands/llm.js.map +1 -1
  59. package/dist/commands/login.js +2 -0
  60. package/dist/commands/login.js.map +1 -1
  61. package/dist/commands/media.js +3 -3
  62. package/dist/commands/media.js.map +1 -1
  63. package/dist/commands/mobile.d.ts +2 -0
  64. package/dist/commands/mobile.js +42 -1
  65. package/dist/commands/mobile.js.map +1 -1
  66. package/dist/commands/payments.js +1 -1
  67. package/dist/commands/people.d.ts +2 -0
  68. package/dist/commands/people.js +193 -0
  69. package/dist/commands/people.js.map +1 -0
  70. package/dist/commands/phone.js +3 -78
  71. package/dist/commands/phone.js.map +1 -1
  72. package/dist/commands/projects.d.ts +13 -0
  73. package/dist/commands/projects.js +220 -0
  74. package/dist/commands/projects.js.map +1 -0
  75. package/dist/commands/register.js +13 -5
  76. package/dist/commands/register.js.map +1 -1
  77. package/dist/commands/sandbox.d.ts +2 -0
  78. package/dist/commands/sandbox.js +245 -0
  79. package/dist/commands/sandbox.js.map +1 -0
  80. package/dist/commands/search.js +26 -12
  81. package/dist/commands/search.js.map +1 -1
  82. package/dist/commands/seo.js +16 -8
  83. package/dist/commands/seo.js.map +1 -1
  84. package/dist/commands/sessions.d.ts +6 -0
  85. package/dist/commands/sessions.js +109 -0
  86. package/dist/commands/sessions.js.map +1 -0
  87. package/dist/commands/social-data.d.ts +2 -0
  88. package/dist/commands/social-data.js +244 -0
  89. package/dist/commands/social-data.js.map +1 -0
  90. package/dist/commands/social.js +8 -6
  91. package/dist/commands/social.js.map +1 -1
  92. package/dist/commands/teams.d.ts +69 -0
  93. package/dist/commands/teams.js +503 -0
  94. package/dist/commands/teams.js.map +1 -0
  95. package/dist/commands/up.d.ts +150 -0
  96. package/dist/commands/up.js +415 -15
  97. package/dist/commands/up.js.map +1 -1
  98. package/dist/commands/usage.js +15 -4
  99. package/dist/commands/usage.js.map +1 -1
  100. package/dist/commands/use.d.ts +9 -0
  101. package/dist/commands/use.js +76 -11
  102. package/dist/commands/use.js.map +1 -1
  103. package/dist/commands/users.d.ts +8 -0
  104. package/dist/commands/users.js +28 -9
  105. package/dist/commands/users.js.map +1 -1
  106. package/dist/commands/vault.js +28 -1
  107. package/dist/commands/vault.js.map +1 -1
  108. package/dist/commands/video.js +117 -18
  109. package/dist/commands/video.js.map +1 -1
  110. package/dist/commands/wallet.js +3 -3
  111. package/dist/commands/wallet.js.map +1 -1
  112. package/dist/commands/whoami.js +17 -1
  113. package/dist/commands/whoami.js.map +1 -1
  114. package/dist/config.d.ts +9 -1
  115. package/dist/config.js +1 -1
  116. package/dist/config.js.map +1 -1
  117. package/dist/index.d.ts +2 -1
  118. package/dist/index.js +228 -24
  119. package/dist/index.js.map +1 -1
  120. package/dist/lib/brain-select.d.ts +193 -0
  121. package/dist/lib/brain-select.js +403 -0
  122. package/dist/lib/brain-select.js.map +1 -0
  123. package/dist/lib/cli-validation.d.ts +12 -0
  124. package/dist/lib/cli-validation.js +46 -0
  125. package/dist/lib/cli-validation.js.map +1 -0
  126. package/dist/lib/deprecation.d.ts +158 -0
  127. package/dist/lib/deprecation.js +140 -0
  128. package/dist/lib/deprecation.js.map +1 -0
  129. package/dist/lib/duration.d.ts +8 -0
  130. package/dist/lib/duration.js +11 -0
  131. package/dist/lib/duration.js.map +1 -0
  132. package/dist/lib/http-response.d.ts +11 -0
  133. package/dist/lib/http-response.js +96 -0
  134. package/dist/lib/http-response.js.map +1 -0
  135. package/dist/lib/pricing.d.ts +132 -0
  136. package/dist/lib/pricing.js +148 -0
  137. package/dist/lib/pricing.js.map +1 -0
  138. package/dist/lib/stream-frames.d.ts +114 -0
  139. package/dist/lib/stream-frames.js +169 -0
  140. package/dist/lib/stream-frames.js.map +1 -0
  141. package/dist/lib/teams-catalog.d.ts +141 -0
  142. package/dist/lib/teams-catalog.js +765 -0
  143. package/dist/lib/teams-catalog.js.map +1 -0
  144. package/dist/lib/unknown-command.d.ts +41 -1
  145. package/dist/lib/unknown-command.js +74 -0
  146. package/dist/lib/unknown-command.js.map +1 -1
  147. package/dist/output.d.ts +99 -5
  148. package/dist/output.js +160 -11
  149. package/dist/output.js.map +1 -1
  150. package/package.json +3 -3
  151. package/dist/commands/link.d.ts +0 -3
  152. package/dist/commands/link.js +0 -91
  153. package/dist/commands/link.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { Command } from "commander";
2
+ import { Command, CommanderError } from "commander";
3
3
  import updateNotifier from "update-notifier";
4
4
  import { readVersion } from "./version.js";
5
5
  import { agentError } from "./output.js";
6
- import { buildUnknownCommandError } from "./lib/unknown-command.js";
6
+ import { buildUnknownCommandError, buildUnknownSubcommandError, findUnknownSubcommand } from "./lib/unknown-command.js";
7
7
  import { registerCmd } from "./commands/register.js";
8
8
  import { loginCmd } from "./commands/login.js";
9
9
  import { authCmd } from "./commands/auth.js";
10
- import { linkCmd, verifyCmd } from "./commands/link.js";
11
10
  import { companiesCmd } from "./commands/companies.js";
12
11
  import { whoamiCmd } from "./commands/whoami.js";
13
12
  import { identityCmd } from "./commands/identity.js";
@@ -17,6 +16,7 @@ import { usageCmd } from "./commands/usage.js";
17
16
  import { emailCmd } from "./commands/email.js";
18
17
  import { searchCmd } from "./commands/search.js";
19
18
  import { llmCmd } from "./commands/llm.js";
19
+ import { audioCmd } from "./commands/audio.js";
20
20
  import { imagesCmd } from "./commands/images.js";
21
21
  import { videoCmd } from "./commands/video.js";
22
22
  import { cloneCmd } from "./commands/clone.js";
@@ -29,6 +29,9 @@ import { verificationCmd } from "./commands/verification.js";
29
29
  import { formationCmd } from "./commands/formation.js";
30
30
  import { appDataCmd } from "./commands/app-data.js";
31
31
  import { businessCmd } from "./commands/business.js";
32
+ import { peopleCmd } from "./commands/people.js";
33
+ import { companyDataCmd } from "./commands/company-data.js";
34
+ import { socialDataCmd } from "./commands/social-data.js";
32
35
  import { seoCmd } from "./commands/seo.js";
33
36
  import { aeoCmd } from "./commands/aeo.js";
34
37
  import { ecommerceCmd } from "./commands/ecommerce.js";
@@ -49,7 +52,9 @@ import { appsCmd } from "./commands/apps.js";
49
52
  import { voiceCmd } from "./commands/voice.js";
50
53
  import { computeCmd } from "./commands/compute.js";
51
54
  import { queueCmd } from "./commands/queue.js";
55
+ import { sandboxCmd } from "./commands/sandbox.js";
52
56
  import { mobileCmd } from "./commands/mobile.js";
57
+ import { projectsCmd } from "./commands/projects.js";
53
58
  import { useCmd } from "./commands/use.js";
54
59
  import { usersCmd } from "./commands/users.js";
55
60
  import { accountKitsCmd } from "./commands/account-kits.js";
@@ -57,8 +62,10 @@ import { vaultCmd } from "./commands/vault.js";
57
62
  import { logsCmd } from "./commands/logs.js";
58
63
  import { connectionsCmd } from "./commands/connections.js";
59
64
  import { approvalsCmd } from "./commands/approvals.js";
65
+ import { sessionsCmd } from "./commands/sessions.js";
60
66
  import { configCmd } from "./commands/config.js";
61
67
  import { setOutputFlags } from "./output.js";
68
+ import { setActiveProjectOverride } from "./client.js";
62
69
  import { browserCmd } from "./commands/browser.js";
63
70
  import { agentProfilesCmd, revokeCmd } from "./commands/agent-profiles.js";
64
71
  import { initCmd } from "./commands/init.js";
@@ -66,6 +73,10 @@ import { upCmd, downCmd } from "./commands/up.js";
66
73
  import { moduleCmd } from "./commands/module.js";
67
74
  import { envCmd } from "./commands/env.js";
68
75
  import { reportCmd } from "./commands/report.js";
76
+ import { teamsCmd } from "./commands/teams.js";
77
+ import { verifyCmd } from "./commands/legacy-auth.js";
78
+ import { LEGACY_RUNTIME_ALIASES, markDeprecated } from "./lib/deprecation.js";
79
+ import { cleanCommanderMessage, commandAction, configureStructuredValidation, helpCommand } from "./lib/cli-validation.js";
69
80
  const program = new Command();
70
81
  // Human-facing "update available" banner. update-notifier prints a box to
71
82
  // STDERR only, so it never pollutes the JSON on stdout. Guarded to a no-op for
@@ -102,7 +113,7 @@ Getting Started:
102
113
  AgentProfiles (the governed real-world bundle):
103
114
  init Scaffold a naive.config.ts with an agent profile template
104
115
  up Register infrastructure, runtime pool, and agent profile templates
105
- agent profiles Provision / list / get / revoke per-tenant agent profiles
116
+ agent-profiles Provision / list / get / revoke per-tenant agent profiles
106
117
  revoke Absolute revoke of an agent profile (freeze card, halt sends, tear down)
107
118
  module Add/list modules (capabilities) for your agent profiles
108
119
  env Switch API environment / create per-tenant preview sandboxes
@@ -111,12 +122,13 @@ Authentication:
111
122
  register Create a new account (email + password โ†’ API key)
112
123
  login Log in to existing account (email + password โ†’ API key)
113
124
  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
125
+ auth email Sign in / sign up with a durable email magic link
126
+ verify Retired โ€” six-digit code sign-in no longer exists. Use 'auth email'
116
127
 
117
128
  Account Management:
118
129
  whoami Show current identity
119
- companies List/switch companies
130
+ companies List/switch organizations (alias: naive organization)
131
+ projects List/create/select projects โ€” the layer inside your organization
120
132
  domains Manage email domains (list, connect, verify, purchase, edit DNS records)
121
133
  keys Manage API keys
122
134
  status Full status overview
@@ -124,25 +136,40 @@ Account Management:
124
136
  identity View provisioned resources
125
137
  billing Manage billing โ€” plans, subscriptions, credit top-ups
126
138
 
127
- Orchestration:
128
- ceo CEO agent โ€” run prompts, approve teams, stream output
129
- tasks Kanban task management โ€” create, assign, complete, block
130
- objectives Strategic objectives โ€” high-level goals that decompose into tasks
131
- employees AI workforce โ€” hire, fire, configure agents
132
- cron Scheduled recurring jobs โ€” create, trigger, pause, remove
133
- loops Recurring agent runs โ€” governed cron-source triggers bound to an agent
134
- memory Persistent agent memory โ€” add, list, remove facts and preferences
135
- brain Centralized knowledge base + RAG โ€” ingest docs, ask grounded questions
139
+ The durable runtime:
140
+ teams Declare a team, send it work, watch it, decide what it asks for.
141
+ The addressing tuple is (company, tenant, team) and --tenant is
142
+ required on every subcommand except 'list'.
143
+ $ naive teams submit support "refund the duplicate charge" --tenant tu_8f21
144
+
145
+ Legacy orchestration โ€” DEPRECATED, still working, FROZEN (no new capabilities):
146
+ Every command below keeps answering exactly as before and prints a one-line
147
+ deprecation banner on stderr naming its replacement. Nothing is disabled.
148
+ ceo โ†’ naive teams say / show / runs / watch
149
+ tasks โ†’ naive teams submit / board / task / unblock
150
+ objectives โ†’ naive teams submit --task
151
+ employees โ†’ naive teams roster (the provisioning verbs have no replacement:
152
+ roles are declared in naive.config.ts)
153
+ cron โ†’ naive teams schedule / unschedule (5 of 8 subcommands)
154
+ loops โ†’ naive teams schedule
155
+ memory โ†’ naive brain remember / forget
156
+
157
+ Knowledge:
158
+ brain Company knowledge + the run loop: attach, consolidate, proposals
136
159
  apps Web apps โ€” create, deploy, manage Vercel-backed applications
137
160
 
138
161
  Primitives:
139
162
  email Send/receive email via provisioned inboxes
140
163
  search Web search, URL extraction, deep research
141
164
  llm LLM chat completions via OpenRouter (300+ models)
165
+ audio Speech โ€” transcribe, synthesize, and native audio turns
142
166
  browser Live cloud browser sessions โ€” navigate, act, extract
143
167
  seo SEO tools โ€” keywords, backlinks, competitive intelligence
144
168
  app-data Mobile app data โ€” Google Play, Apple App Store
145
- business Business data โ€” Google, Trustpilot, TripAdvisor, Social
169
+ business Reviews & listings โ€” Google, Trustpilot, TripAdvisor, travel
170
+ company-data Private company firmographics, funding & tech stack
171
+ people B2B people search & contact enrichment (opt-in)
172
+ social-data Read public posts on X, Reddit, Bluesky & Hacker News
146
173
  aeo AEO/GEO โ€” LLM responses, scraper, mentions, AI keywords
147
174
  ecommerce E-commerce โ€” Google Shopping, Amazon products & sellers
148
175
  images AI image generation (fal.ai) + stock photos (Pexels)
@@ -166,6 +193,7 @@ Feedback & Bug Reports:
166
193
 
167
194
  Governance (human-in-the-loop):
168
195
  approvals Review & resolve agent-requested approvals for sensitive actions
196
+ sessions MCP sessions โ€” mint / list / revoke short-lived per-user credentials
169
197
  Sensitive actions (issue/fund a card, purchase a domain, KYC, form a company,
170
198
  connect/sign up for a 3rd-party service) may require human approval depending
171
199
  on the user's Account Kit. When gated, the command returns
@@ -184,25 +212,30 @@ Environment Variables:
184
212
  NAIVE_API_KEY Override API key (for CI/headless use)
185
213
  NAIVE_BASE_URL Override API URL (for local dev, default: https://api.usenaive.ai)
186
214
 
187
- Documentation: https://docs.usenaive.ai
215
+ Documentation: https://usenaive.ai/docs
188
216
  `);
189
217
  // Global output-mode flags. Default is machine JSON (safe for agents/pipes/CI/pty callers);
190
218
  // human mode is OPT-IN only (--human, NAIVE_HUMAN=1, or `naive config output human`). --json forces
191
219
  // machine output even when human mode is configured.
192
220
  program
193
221
  .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", () => {
222
+ .option("--human", "Force human-readable output for this command")
223
+ // One command's project, without changing the persisted selection. Omitted =
224
+ // the active project (`naive projects use`), and with none of those = the
225
+ // organization's default project.
226
+ .option("--project <project_id>", "Act inside this project for this command only");
227
+ function applyOutputFlags() {
196
228
  const o = program.opts();
197
229
  setOutputFlags({ json: !!o.json, human: !!o.human });
198
- });
230
+ setActiveProjectOverride(typeof o.project === "string" ? o.project : undefined);
231
+ }
232
+ program.hook("preAction", applyOutputFlags);
199
233
  program.addCommand(configCmd);
200
234
  program.addCommand(registerCmd);
201
235
  program.addCommand(loginCmd);
202
236
  program.addCommand(authCmd);
203
- program.addCommand(linkCmd);
204
- program.addCommand(verifyCmd);
205
237
  program.addCommand(companiesCmd);
238
+ program.addCommand(projectsCmd);
206
239
  program.addCommand(whoamiCmd);
207
240
  program.addCommand(identityCmd);
208
241
  program.addCommand(keysCmd);
@@ -213,9 +246,13 @@ program.addCommand(billingCmd);
213
246
  program.addCommand(emailCmd);
214
247
  program.addCommand(searchCmd);
215
248
  program.addCommand(llmCmd);
249
+ program.addCommand(audioCmd);
216
250
  program.addCommand(seoCmd);
217
251
  program.addCommand(appDataCmd);
218
252
  program.addCommand(businessCmd);
253
+ program.addCommand(companyDataCmd);
254
+ program.addCommand(peopleCmd);
255
+ program.addCommand(socialDataCmd);
219
256
  program.addCommand(aeoCmd);
220
257
  program.addCommand(ecommerceCmd);
221
258
  program.addCommand(imagesCmd);
@@ -243,6 +280,7 @@ program.addCommand(appsCmd);
243
280
  program.addCommand(voiceCmd);
244
281
  program.addCommand(computeCmd);
245
282
  program.addCommand(queueCmd);
283
+ program.addCommand(sandboxCmd);
246
284
  program.addCommand(mobileCmd);
247
285
  program.addCommand(browserCmd);
248
286
  program.addCommand(reportCmd);
@@ -254,6 +292,97 @@ program.addCommand(agentProfilesCmd);
254
292
  program.addCommand(revokeCmd);
255
293
  program.addCommand(moduleCmd);
256
294
  program.addCommand(envCmd);
295
+ // The durable runtime. 28 subcommands, all built from lib/teams-catalog.ts.
296
+ program.addCommand(teamsCmd);
297
+ // Retired, and it says so instead of pretending a newer CLI has it.
298
+ program.addCommand(verifyCmd);
299
+ /**
300
+ * โ”€โ”€ THE LEGACY ORCHESTRATION SURFACE โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
301
+ *
302
+ * These seven groups KEEP WORKING. `markDeprecated` installs a commander
303
+ * `preAction` hook that writes a banner to stderr and attaches a machine notice
304
+ * to the stdout envelope, and then the action runs, unchanged. Nothing below
305
+ * gates, refuses or short-circuits anything, and no route is removed. Existing
306
+ * users must not break.
307
+ *
308
+ * The hook goes on the GROUP rather than on each handler, so a subcommand added
309
+ * to one of these groups next month is marked without its author doing anything.
310
+ *
311
+ * The subject and the `[dep.โ€ฆ]` id are derived from `cmd.name()` โ€” the one place
312
+ * the name is already written down โ€” so a rename cannot leave a notice pointing
313
+ * at a command that no longer exists.
314
+ */
315
+ const LEGACY_ORCHESTRATION = {
316
+ alsoCalled: LEGACY_RUNTIME_ALIASES,
317
+ why: "the durable runtime enforces policy at the tool boundary, not only at the gateway, " +
318
+ "and it is the only runtime new work is built on",
319
+ since: "2026-08",
320
+ sunset: { kind: "frozen" },
321
+ guide: "https://usenaive.ai/docs/migration-guides/legacy-orchestration-to-durable-teams",
322
+ };
323
+ export const LEGACY_DEPRECATIONS = [
324
+ markDeprecated(ceoCmd, {
325
+ id: "dep.primitive.ceo",
326
+ ...LEGACY_ORCHESTRATION,
327
+ drives: "the legacy orchestration runtime's lead agent, which is FROZEN โ€” it accepts no new capabilities.",
328
+ replacement: { kind: "use", what: "naive teams say <team> --tenant <tu> ยท naive teams show / runs / watch" },
329
+ }),
330
+ markDeprecated(tasksCmd, {
331
+ id: "dep.primitive.tasks",
332
+ ...LEGACY_ORCHESTRATION,
333
+ drives: "the legacy orchestration runtime's board, which is FROZEN โ€” it accepts no new capabilities.",
334
+ replacement: { kind: "use", what: 'naive teams submit <team> "<goal>" --tenant <tu> ยท naive teams board / task / unblock' },
335
+ gaps: [
336
+ {
337
+ sub: "complete",
338
+ because: "the durable runtime completes through the judge plus attestation, not an operator POST",
339
+ },
340
+ { sub: "dispatch", because: "the durable runtime dispatches from the board itself" },
341
+ { sub: "run", because: "work is submitted, not run โ€” `naive teams submit` is the one verb" },
342
+ ],
343
+ }),
344
+ markDeprecated(objectivesCmd, {
345
+ id: "dep.primitive.objectives",
346
+ ...LEGACY_ORCHESTRATION,
347
+ drives: "a second noun for a goal with tasks under it, on the FROZEN legacy orchestration runtime.",
348
+ replacement: { kind: "use", what: "naive teams submit <team> --task <id>" },
349
+ }),
350
+ markDeprecated(employeesCmd, {
351
+ id: "dep.primitive.employees",
352
+ ...LEGACY_ORCHESTRATION,
353
+ drives: "the legacy orchestration runtime's roster and its provisioning verbs, which are FROZEN.",
354
+ replacement: { kind: "use", what: "naive teams roster <team> --tenant <tu>" },
355
+ gaps: [
356
+ {
357
+ sub: "(the provisioning verbs)",
358
+ because: "roles are DECLARED in naive.config.ts and the durable runtime 409s an undeclared role โ€” " +
359
+ "there is no imperative equivalent, by design",
360
+ },
361
+ ],
362
+ }),
363
+ markDeprecated(cronCmd, {
364
+ id: "dep.primitive.cron",
365
+ ...LEGACY_ORCHESTRATION,
366
+ drives: "scheduled work on the FROZEN legacy orchestration runtime.",
367
+ replacement: { kind: "use", what: "naive teams schedule / unschedule" },
368
+ gaps: [
369
+ { sub: "pause", because: "the durable runtime has no pause โ€” stop the team, or unschedule" },
370
+ { sub: "resume", because: "the durable runtime has no pause to resume from" },
371
+ ],
372
+ }),
373
+ markDeprecated(loopsCmd, {
374
+ id: "dep.primitive.loops",
375
+ ...LEGACY_ORCHESTRATION,
376
+ drives: "recurring agent runs on the FROZEN legacy orchestration runtime.",
377
+ replacement: { kind: "use", what: "naive teams schedule" },
378
+ }),
379
+ markDeprecated(memoryCmd, {
380
+ id: "dep.primitive.memory",
381
+ ...LEGACY_ORCHESTRATION,
382
+ drives: "a per-agent fact store that is a retired product noun โ€” the company brain is the one memory.",
383
+ replacement: { kind: "use", what: "naive brain remember ยท naive brain recall ยท naive brain forget" },
384
+ }),
385
+ ];
257
386
  // Multi-tenant v2
258
387
  program.addCommand(useCmd);
259
388
  program.addCommand(usersCmd);
@@ -262,14 +391,89 @@ program.addCommand(vaultCmd);
262
391
  program.addCommand(logsCmd);
263
392
  program.addCommand(connectionsCmd);
264
393
  program.addCommand(approvalsCmd);
394
+ program.addCommand(sessionsCmd);
265
395
  // Unknown-command handler: instead of commander's raw
266
396
  // "error: unknown command 'report' (Did you mean memory?)" stderr line, emit a
267
397
  // structured cli_outdated JSON error โ€” the command may exist in a newer CLI.
268
398
  // Valid commands and --help are unaffected (this only fires on no match).
269
399
  program.on("command:*", (operands) => {
400
+ applyOutputFlags();
270
401
  const unknown = operands[0] ?? program.args[0] ?? "";
271
402
  const built = buildUnknownCommandError(unknown, readVersion());
272
403
  agentError({ action: built.action, error: built.error, recovery_steps: built.recovery_steps });
273
404
  });
274
- program.parse();
405
+ // A TRUE last resort, below Commander. `parseAsync` awaits the action handler, so
406
+ // a command that rejects is caught in the catch block below โ€” that is the primary
407
+ // path. This stays for what parseAsync cannot see: a promise a command `void`s
408
+ // without awaiting. Node would otherwise print a raw stack to stderr and exit 1,
409
+ // and an agent parsing stdout would get nothing it can act on.
410
+ process.on("unhandledRejection", (reason) => {
411
+ const err = {
412
+ code: "internal_error",
413
+ message: reason instanceof Error ? reason.message : String(reason),
414
+ };
415
+ agentError({
416
+ action: program.args[0] ?? "cli",
417
+ error: err,
418
+ recovery_steps: [
419
+ { command: "naive status", description: "Check API connectivity and auth status" },
420
+ {
421
+ command: 'naive report "<what failed>" --command "<the command you ran>" --kind error',
422
+ description: "Report it to the naive team if it persists",
423
+ },
424
+ ],
425
+ });
426
+ });
427
+ // Commander normally prints plain-text validation failures before exiting. The
428
+ // CLI promises a machine-readable envelope, so intercept only those failures;
429
+ // normal --help/--version output keeps its standard zero-exit behavior.
430
+ configureStructuredValidation(program);
431
+ // N10: an unknown SUBcommand of a known group (e.g. `naive trading market-data`)
432
+ // must fail loudly and exit non-zero โ€” even when `--help` is appended. Commander's
433
+ // help option otherwise short-circuits to the parent's help and exits 0, silently
434
+ // hiding the mistake and blocking flag discovery. Detect it up front, before parse,
435
+ // so the behavior is identical with and without `--help`. Real subcommands and a
436
+ // bare `<group> --help` are untouched (findUnknownSubcommand returns null).
437
+ const unknownSub = findUnknownSubcommand(program, process.argv.slice(2));
438
+ if (unknownSub) {
439
+ const built = buildUnknownSubcommandError(unknownSub.group, unknownSub.unknown, unknownSub.validSubs, readVersion());
440
+ agentError({ action: built.action, error: built.error, recovery_steps: built.recovery_steps });
441
+ }
442
+ try {
443
+ await program.parseAsync(process.argv);
444
+ }
445
+ catch (error) {
446
+ if (error instanceof CommanderError) {
447
+ if (error.exitCode === 0)
448
+ process.exit(0);
449
+ // Commander validates required options before preAction hooks run. Apply
450
+ // root output flags here too so validation errors honor --human, and an
451
+ // explicit --json still overrides NAIVE_HUMAN/configured human output.
452
+ applyOutputFlags();
453
+ const args = program.args.length > 0 ? program.args : process.argv.slice(2);
454
+ agentError({
455
+ action: commandAction(args),
456
+ error: {
457
+ code: "invalid_input",
458
+ message: cleanCommanderMessage(error.message),
459
+ commander_code: error.code,
460
+ },
461
+ recovery_steps: [
462
+ { command: helpCommand(args), description: "See required arguments and options" },
463
+ ],
464
+ });
465
+ }
466
+ agentError({
467
+ action: commandAction(program.args),
468
+ error: {
469
+ code: "internal_error",
470
+ message: "The command failed unexpectedly.",
471
+ hint: error instanceof Error ? error.message : String(error),
472
+ },
473
+ recovery_steps: [
474
+ { command: "# retry the command once", description: "Retry transient API or network failures" },
475
+ { command: 'naive report "CLI command failed" --kind error', description: "Report it if the failure persists" },
476
+ ],
477
+ });
478
+ }
275
479
  //# 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,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAA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SAC7D;QACD,cAAc,EAAE;YACd,EAAE,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,yCAAyC,EAAE;YAC/F,EAAE,OAAO,EAAE,gDAAgD,EAAE,WAAW,EAAE,mCAAmC,EAAE;SAChH;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,193 @@
1
+ import { type NextStep } from "../output.js";
2
+ /** The public knowledge-base shape (`formatKnowledgeBaseRow`, contracts/brain.ts:196). */
3
+ export interface BrainRow {
4
+ id: string;
5
+ name: string;
6
+ provider?: string;
7
+ status?: string;
8
+ is_default?: boolean;
9
+ created_at?: string;
10
+ updated_at?: string;
11
+ }
12
+ /**
13
+ * One agent as the roster reports it โ€” the whole `agents` row, so `metadata`
14
+ * rides along. `hermesProfileName` is the slug the runtime knows the agent by;
15
+ * both it and `name` are accepted as a reference.
16
+ */
17
+ export interface AgentRow {
18
+ id: string;
19
+ name: string;
20
+ role?: string | null;
21
+ title?: string | null;
22
+ hermesProfileName?: string | null;
23
+ enabled?: boolean;
24
+ archived?: boolean;
25
+ metadata?: Record<string, unknown> | null;
26
+ }
27
+ /**
28
+ * THE BINDING KEY, and it is deliberately NOT a new word.
29
+ *
30
+ * `brain_knowledge_base_id` is the exact spelling `POST /v1/runs` already
31
+ * accepts to point a run's reflexive-brain attach at a knowledge base
32
+ * (platform/brain/src/contracts/brain-ops.ts:98, packages/api/src/routes/runs.ts:104).
33
+ * Binding an AGENT to a brain records the value that surface already consumes
34
+ * under the name it already uses, rather than minting a second one.
35
+ */
36
+ export declare const BRAIN_BINDING_KEY = "brain_knowledge_base_id";
37
+ /**
38
+ * THE COMPANION KEY, written by the brain surface and by nothing else.
39
+ *
40
+ * `brain_connected_at` is stamped by `connectBrainToAgent`
41
+ * (packages/api/src/routes/brain.ts:1121-1131) in the same atomic jsonb merge as
42
+ * the binding, and removed by `disconnectBrainFromAgent`. It is what
43
+ * `GET /v1/brain/connections` reports as `connected_at`, so a binding written
44
+ * without it reads back as `connected_at: null` โ€” or, worse, carries the
45
+ * timestamp of an EARLIER binding to a DIFFERENT brain, which is what the roster
46
+ * PATCH used to leave behind here.
47
+ */
48
+ export declare const BRAIN_CONNECTED_AT_KEY = "brain_connected_at";
49
+ /**
50
+ * THE BRAIN BINDING SURFACE โ€” the routes that carry the brain gate.
51
+ *
52
+ * ๐Ÿ”ด THESE REPLACED A ROSTER PATCH, AND THAT IS THE WHOLE POINT. This CLI used
53
+ * to write the binding with `PATCH {@link ROSTER_PATH}/:id {metadata:{โ€ฆ}}`, which
54
+ * is mounted on the ROSTER's own primitive gate rather than the brain's.
55
+ * `packages/api/src/routes/brain.ts:17-22`
56
+ * says exactly why that must not exist โ€” "a second mount is how a route reaches
57
+ * the same data without the same gate" โ€” and it was measured live on one tenant,
58
+ * one agent, one field: `POST /v1/users/{tu}/brain/connect` โ†’ 403
59
+ * `subprocessor_consent_required`, while the roster PATCH of
60
+ * `metadata.brain_knowledge_base_id` on the same agent โ†’ 200. The shipped
61
+ * `naive brain connect` was the caller of the ungated door.
62
+ *
63
+ * Three things came back with the move, none of which the roster PATCH did:
64
+ * 1. the `brain` primitive gate, so a company with brain disabled is refused
65
+ * here the way it is refused everywhere else;
66
+ * 2. the `brain.agent.connected` `activity_events` row โ€” the ledger entry that
67
+ * makes a binding auditable;
68
+ * 3. `brain_connected_at`, stamped in the same statement as the binding.
69
+ * And one hazard went away: the roster PATCH read-modify-wrote the whole
70
+ * metadata bag, so two concurrent writers lost each other's keys. `connect` is a
71
+ * single `COALESCE(metadata,'{}') || {โ€ฆ}` merge in Postgres.
72
+ */
73
+ export declare const BRAIN_CONNECT_PATH = "/v1/brain/connect";
74
+ export declare const BRAIN_CONNECTIONS_PATH = "/v1/brain/connections";
75
+ /**
76
+ * THE ROSTER SURFACE, NAMED ONCE โ€” READ-ONLY FROM HERE.
77
+ *
78
+ * This is the only place in the multi-brain code that spells the retired noun,
79
+ * and it is spelled because it is a WIRE NAME: the route and the key of the
80
+ * array it answers with. `ci/vocabulary.test.ts` ยง3.1 retires the word for
81
+ * every other use โ€” one governed worker identity is an AGENT โ€” so everything
82
+ * downstream of these two constants says `agent`, including the errors a user
83
+ * reads. The surface is also DEPRECATED (its router carries a deprecation id).
84
+ *
85
+ * ๐Ÿ”ด IT IS NOW ONLY EVER READ. Nothing in this CLI PATCHes it: the one write
86
+ * that used to go here โ€” the brain binding โ€” moved to
87
+ * {@link BRAIN_CONNECT_PATH}. `__tests__/brain-multi.test.ts` asserts the roster
88
+ * sees no PATCH, so a future edit cannot quietly put the write back.
89
+ *
90
+ * TWO constants, not three. There was a third, `ROSTER_ITEM_KEY`, naming the
91
+ * envelope key of the SINGLE-agent response โ€” and the only thing that ever read
92
+ * it was the PATCH's own reply. With the write gone it had no reader, and a dead
93
+ * constant spelling a retired noun is the shape a future edit reaches for when it
94
+ * wants to write here again. Deleted with the write. The list read below uses
95
+ * {@link ROSTER_LIST_KEY}; nothing in this CLI reads a single roster row.
96
+ */
97
+ export declare const ROSTER_PATH = "/v1/employees";
98
+ export declare const ROSTER_LIST_KEY = "employees";
99
+ /** True when a reference is already the id the API wants โ€” no lookup needed. */
100
+ export declare function looksLikeId(ref: string): boolean;
101
+ /** `GET /v1/brain`. Exits via handleApiError on a non-2xx, like every other command. */
102
+ export declare function listBrains(action: string): Promise<BrainRow[]>;
103
+ /**
104
+ * Name (or id) -> id. THE HELPFUL-ERROR PATH: naming a brain that does not
105
+ * exist lists the ones that do, in the envelope AND in the recovery steps, so
106
+ * an agent recovers from the response instead of guessing a second time.
107
+ */
108
+ export declare function resolveBrainId(action: string, ref: string): Promise<string>;
109
+ /** The three ways a command may name a brain. All optional; all mutually exclusive. */
110
+ export interface BrainSelector {
111
+ /** `--brain <name|id>` โ€” the canonical spelling. */
112
+ brain?: string;
113
+ /** `--kb <id>` โ€” the shipped spelling. Same concept, same resolver, unchanged for ids. */
114
+ kb?: string;
115
+ /** `--agent <id|name>` โ€” use whatever brain that agent is bound to. */
116
+ agent?: string;
117
+ }
118
+ /**
119
+ * Resolve a command's brain selection to a `knowledge_base_id`, or `undefined`
120
+ * to mean "say nothing and let the server use the company default" โ€” which is
121
+ * exactly what every one of these commands did before when no flag was passed.
122
+ *
123
+ * THE DEFAULT PATH IS UNTOUCHED: no selector -> `undefined` -> no
124
+ * `knowledge_base_id` in the body -> `resolveKnowledgeBase(companyId)` ->
125
+ * `ensureDefaultKnowledgeBase`. No extra request is made.
126
+ */
127
+ export declare function selectBrainId(action: string, sel: BrainSelector): Promise<string | undefined>;
128
+ /**
129
+ * The roster, WITHOUT exiting on failure.
130
+ *
131
+ * `naive brain list` reports bindings as an ENRICHMENT of the brain list. The
132
+ * roster lives behind a different primitive, and a deprecated one, so a company
133
+ * that has it switched off must still get its brains
134
+ * listed โ€” with the reason the bindings column is absent, not a silent empty
135
+ * one. An empty list and an unreadable roster are different facts.
136
+ */
137
+ export declare function tryListAgents(): Promise<{
138
+ ok: true;
139
+ agents: AgentRow[];
140
+ } | {
141
+ ok: false;
142
+ because: string;
143
+ }>;
144
+ /** The roster, exiting on failure โ€” for the commands that cannot proceed without it. */
145
+ export declare function listAgents(action: string): Promise<AgentRow[]>;
146
+ /** The brain an agent is connected to, or undefined. */
147
+ export declare function boundBrainId(agent: AgentRow): string | undefined;
148
+ /**
149
+ * Reference (id | display name | hermes profile slug) -> the roster row. Same
150
+ * helpful-error contract as `resolveBrainId`: an unknown agent lists the known
151
+ * ones.
152
+ */
153
+ export declare function resolveAgent(action: string, ref: string): Promise<AgentRow>;
154
+ /** `GET /v1/brain/connections` reports one of these per bound agent. */
155
+ export interface BrainConnection {
156
+ agent_id: string;
157
+ agent_name?: string;
158
+ agent_role?: string;
159
+ knowledge_base_id: string;
160
+ knowledge_base_name?: string | null;
161
+ connected_at?: string | null;
162
+ }
163
+ /** What a binding write reports back: the agent as it now stands, and the connection. */
164
+ export interface BindingResult {
165
+ agent: AgentRow;
166
+ /** The connection the API confirmed. `null` on a disconnect โ€” there is none. */
167
+ connection: BrainConnection | null;
168
+ }
169
+ /**
170
+ * Write (or clear) an agent's brain binding, THROUGH THE BRAIN SURFACE.
171
+ *
172
+ * ๐Ÿ”ด NOT THE ROSTER PATCH. See {@link BRAIN_CONNECT_PATH} for the measurement:
173
+ * `PATCH {@link ROSTER_PATH}/:id` reaches `metadata.brain_knowledge_base_id`
174
+ * behind the ROSTER's primitive gate rather than the `brain` gate, so it wrote a
175
+ * binding on a company whose brain primitive was OFF. It also read-modify-wrote the whole
176
+ * metadata bag (lost-update racy), skipped the `brain.agent.connected` ledger
177
+ * event, and never stamped `brain_connected_at` โ€” which is why
178
+ * `GET /v1/brain/connections` reported a `connected_at` belonging to an earlier
179
+ * binding to a different brain.
180
+ *
181
+ * `POST /v1/brain/connect` and `DELETE /v1/brain/connections/:agentId` do all
182
+ * four correctly and are the routes `naive brain list` already reads back. This
183
+ * function no longer sends `metadata` at all: it sends two ids, and the merge
184
+ * happens in one Postgres statement on the server.
185
+ *
186
+ * The returned `agent` carries the metadata as it now stands โ€” the caller's row
187
+ * with the two brain-owned keys applied โ€” so callers that print `metadata` keep
188
+ * printing something true without a second round trip. The authority is
189
+ * `connection`.
190
+ */
191
+ export declare function setAgentBrain(action: string, agent: AgentRow, knowledgeBaseId: string | null): Promise<BindingResult>;
192
+ /** The `next_steps` every binding command ends with. */
193
+ export declare function bindingNextSteps(brain: BrainRow | undefined, agentId: string): NextStep[];