@usenaive-sdk/cli 0.12.5 โ†’ 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/README.md +69 -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 +58 -23
  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/approvals.js +142 -9
  10. package/dist/commands/approvals.js.map +1 -1
  11. package/dist/commands/apps.d.ts +7 -0
  12. package/dist/commands/apps.js +255 -18
  13. package/dist/commands/apps.js.map +1 -1
  14. package/dist/commands/audio.d.ts +9 -0
  15. package/dist/commands/audio.js +391 -0
  16. package/dist/commands/audio.js.map +1 -0
  17. package/dist/commands/auth.d.ts +1 -0
  18. package/dist/commands/auth.js +47 -19
  19. package/dist/commands/auth.js.map +1 -1
  20. package/dist/commands/billing.js +9 -9
  21. package/dist/commands/billing.js.map +1 -1
  22. package/dist/commands/brain.js +813 -54
  23. package/dist/commands/brain.js.map +1 -1
  24. package/dist/commands/browser.js +8 -8
  25. package/dist/commands/browser.js.map +1 -1
  26. package/dist/commands/business.js +117 -16
  27. package/dist/commands/business.js.map +1 -1
  28. package/dist/commands/clone.js +8 -4
  29. package/dist/commands/clone.js.map +1 -1
  30. package/dist/commands/companies.d.ts +8 -0
  31. package/dist/commands/companies.js +137 -47
  32. package/dist/commands/companies.js.map +1 -1
  33. package/dist/commands/company-data.d.ts +2 -0
  34. package/dist/commands/company-data.js +168 -0
  35. package/dist/commands/company-data.js.map +1 -0
  36. package/dist/commands/compute.js +295 -18
  37. package/dist/commands/compute.js.map +1 -1
  38. package/dist/commands/connections.d.ts +6 -0
  39. package/dist/commands/connections.js +42 -2
  40. package/dist/commands/connections.js.map +1 -1
  41. package/dist/commands/domains.js +63 -19
  42. package/dist/commands/domains.js.map +1 -1
  43. package/dist/commands/ecommerce.js +19 -9
  44. package/dist/commands/ecommerce.js.map +1 -1
  45. package/dist/commands/email.js +56 -9
  46. package/dist/commands/email.js.map +1 -1
  47. package/dist/commands/formation.js +5 -5
  48. package/dist/commands/formation.js.map +1 -1
  49. package/dist/commands/identity.js +4 -3
  50. package/dist/commands/identity.js.map +1 -1
  51. package/dist/commands/images.js +86 -12
  52. package/dist/commands/images.js.map +1 -1
  53. package/dist/commands/init.d.ts +3 -0
  54. package/dist/commands/init.js +44 -36
  55. package/dist/commands/init.js.map +1 -1
  56. package/dist/commands/jobs.js +1 -0
  57. package/dist/commands/jobs.js.map +1 -1
  58. package/dist/commands/legacy-auth.d.ts +27 -0
  59. package/dist/commands/legacy-auth.js +64 -0
  60. package/dist/commands/legacy-auth.js.map +1 -0
  61. package/dist/commands/llm.js +14 -1
  62. package/dist/commands/llm.js.map +1 -1
  63. package/dist/commands/login.js +2 -0
  64. package/dist/commands/login.js.map +1 -1
  65. package/dist/commands/logout.d.ts +7 -0
  66. package/dist/commands/logout.js +55 -0
  67. package/dist/commands/logout.js.map +1 -0
  68. package/dist/commands/media.js +3 -3
  69. package/dist/commands/media.js.map +1 -1
  70. package/dist/commands/mobile.d.ts +2 -0
  71. package/dist/commands/mobile.js +42 -1
  72. package/dist/commands/mobile.js.map +1 -1
  73. package/dist/commands/payments.js +1 -1
  74. package/dist/commands/people.d.ts +2 -0
  75. package/dist/commands/people.js +197 -0
  76. package/dist/commands/people.js.map +1 -0
  77. package/dist/commands/phone.js +40 -83
  78. package/dist/commands/phone.js.map +1 -1
  79. package/dist/commands/projects.d.ts +13 -0
  80. package/dist/commands/projects.js +220 -0
  81. package/dist/commands/projects.js.map +1 -0
  82. package/dist/commands/register.js +13 -5
  83. package/dist/commands/register.js.map +1 -1
  84. package/dist/commands/sandbox.d.ts +2 -0
  85. package/dist/commands/sandbox.js +558 -0
  86. package/dist/commands/sandbox.js.map +1 -0
  87. package/dist/commands/search.js +27 -13
  88. package/dist/commands/search.js.map +1 -1
  89. package/dist/commands/seo.js +16 -8
  90. package/dist/commands/seo.js.map +1 -1
  91. package/dist/commands/sessions.d.ts +6 -0
  92. package/dist/commands/sessions.js +109 -0
  93. package/dist/commands/sessions.js.map +1 -0
  94. package/dist/commands/social-data.d.ts +2 -0
  95. package/dist/commands/social-data.js +245 -0
  96. package/dist/commands/social-data.js.map +1 -0
  97. package/dist/commands/social.js +9 -7
  98. package/dist/commands/social.js.map +1 -1
  99. package/dist/commands/tasks.js +9 -0
  100. package/dist/commands/tasks.js.map +1 -1
  101. package/dist/commands/teams.d.ts +69 -0
  102. package/dist/commands/teams.js +503 -0
  103. package/dist/commands/teams.js.map +1 -0
  104. package/dist/commands/up.d.ts +150 -0
  105. package/dist/commands/up.js +465 -15
  106. package/dist/commands/up.js.map +1 -1
  107. package/dist/commands/usage.js +15 -4
  108. package/dist/commands/usage.js.map +1 -1
  109. package/dist/commands/use.d.ts +9 -0
  110. package/dist/commands/use.js +76 -11
  111. package/dist/commands/use.js.map +1 -1
  112. package/dist/commands/users.d.ts +8 -0
  113. package/dist/commands/users.js +28 -9
  114. package/dist/commands/users.js.map +1 -1
  115. package/dist/commands/vault.js +31 -1
  116. package/dist/commands/vault.js.map +1 -1
  117. package/dist/commands/verification.js +1 -1
  118. package/dist/commands/verification.js.map +1 -1
  119. package/dist/commands/video.js +118 -19
  120. package/dist/commands/video.js.map +1 -1
  121. package/dist/commands/wallet.js +3 -3
  122. package/dist/commands/wallet.js.map +1 -1
  123. package/dist/commands/whoami.js +17 -1
  124. package/dist/commands/whoami.js.map +1 -1
  125. package/dist/config.d.ts +16 -1
  126. package/dist/config.js +15 -1
  127. package/dist/config.js.map +1 -1
  128. package/dist/index.d.ts +2 -1
  129. package/dist/index.js +250 -24
  130. package/dist/index.js.map +1 -1
  131. package/dist/lib/brain-select.d.ts +193 -0
  132. package/dist/lib/brain-select.js +403 -0
  133. package/dist/lib/brain-select.js.map +1 -0
  134. package/dist/lib/cli-validation.d.ts +12 -0
  135. package/dist/lib/cli-validation.js +46 -0
  136. package/dist/lib/cli-validation.js.map +1 -0
  137. package/dist/lib/deprecation.d.ts +158 -0
  138. package/dist/lib/deprecation.js +140 -0
  139. package/dist/lib/deprecation.js.map +1 -0
  140. package/dist/lib/duration.d.ts +8 -0
  141. package/dist/lib/duration.js +11 -0
  142. package/dist/lib/duration.js.map +1 -0
  143. package/dist/lib/http-response.d.ts +11 -0
  144. package/dist/lib/http-response.js +96 -0
  145. package/dist/lib/http-response.js.map +1 -0
  146. package/dist/lib/pricing.d.ts +132 -0
  147. package/dist/lib/pricing.js +148 -0
  148. package/dist/lib/pricing.js.map +1 -0
  149. package/dist/lib/stream-frames.d.ts +114 -0
  150. package/dist/lib/stream-frames.js +169 -0
  151. package/dist/lib/stream-frames.js.map +1 -0
  152. package/dist/lib/teams-catalog.d.ts +141 -0
  153. package/dist/lib/teams-catalog.js +765 -0
  154. package/dist/lib/teams-catalog.js.map +1 -0
  155. package/dist/lib/unknown-command.d.ts +55 -1
  156. package/dist/lib/unknown-command.js +113 -0
  157. package/dist/lib/unknown-command.js.map +1 -1
  158. package/dist/output.d.ts +127 -5
  159. package/dist/output.js +189 -12
  160. package/dist/output.js.map +1 -1
  161. package/package.json +3 -3
  162. package/dist/commands/link.d.ts +0 -3
  163. package/dist/commands/link.js +0 -91
  164. package/dist/commands/link.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
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
+ import { logoutCmd } from "./commands/logout.js";
9
10
  import { authCmd } from "./commands/auth.js";
10
- import { linkCmd, verifyCmd } from "./commands/link.js";
11
11
  import { companiesCmd } from "./commands/companies.js";
12
12
  import { whoamiCmd } from "./commands/whoami.js";
13
13
  import { identityCmd } from "./commands/identity.js";
@@ -17,6 +17,7 @@ import { usageCmd } from "./commands/usage.js";
17
17
  import { emailCmd } from "./commands/email.js";
18
18
  import { searchCmd } from "./commands/search.js";
19
19
  import { llmCmd } from "./commands/llm.js";
20
+ import { audioCmd } from "./commands/audio.js";
20
21
  import { imagesCmd } from "./commands/images.js";
21
22
  import { videoCmd } from "./commands/video.js";
22
23
  import { cloneCmd } from "./commands/clone.js";
@@ -29,6 +30,9 @@ import { verificationCmd } from "./commands/verification.js";
29
30
  import { formationCmd } from "./commands/formation.js";
30
31
  import { appDataCmd } from "./commands/app-data.js";
31
32
  import { businessCmd } from "./commands/business.js";
33
+ import { peopleCmd } from "./commands/people.js";
34
+ import { companyDataCmd } from "./commands/company-data.js";
35
+ import { socialDataCmd } from "./commands/social-data.js";
32
36
  import { seoCmd } from "./commands/seo.js";
33
37
  import { aeoCmd } from "./commands/aeo.js";
34
38
  import { ecommerceCmd } from "./commands/ecommerce.js";
@@ -49,7 +53,9 @@ import { appsCmd } from "./commands/apps.js";
49
53
  import { voiceCmd } from "./commands/voice.js";
50
54
  import { computeCmd } from "./commands/compute.js";
51
55
  import { queueCmd } from "./commands/queue.js";
56
+ import { sandboxCmd } from "./commands/sandbox.js";
52
57
  import { mobileCmd } from "./commands/mobile.js";
58
+ import { projectsCmd } from "./commands/projects.js";
53
59
  import { useCmd } from "./commands/use.js";
54
60
  import { usersCmd } from "./commands/users.js";
55
61
  import { accountKitsCmd } from "./commands/account-kits.js";
@@ -57,8 +63,10 @@ import { vaultCmd } from "./commands/vault.js";
57
63
  import { logsCmd } from "./commands/logs.js";
58
64
  import { connectionsCmd } from "./commands/connections.js";
59
65
  import { approvalsCmd } from "./commands/approvals.js";
66
+ import { sessionsCmd } from "./commands/sessions.js";
60
67
  import { configCmd } from "./commands/config.js";
61
68
  import { setOutputFlags } from "./output.js";
69
+ import { setActiveProjectOverride } from "./client.js";
62
70
  import { browserCmd } from "./commands/browser.js";
63
71
  import { agentProfilesCmd, revokeCmd } from "./commands/agent-profiles.js";
64
72
  import { initCmd } from "./commands/init.js";
@@ -66,6 +74,10 @@ import { upCmd, downCmd } from "./commands/up.js";
66
74
  import { moduleCmd } from "./commands/module.js";
67
75
  import { envCmd } from "./commands/env.js";
68
76
  import { reportCmd } from "./commands/report.js";
77
+ import { teamsCmd } from "./commands/teams.js";
78
+ import { verifyCmd } from "./commands/legacy-auth.js";
79
+ import { LEGACY_RUNTIME_ALIASES, markDeprecated } from "./lib/deprecation.js";
80
+ import { cleanCommanderMessage, commandAction, configureStructuredValidation, helpCommand } from "./lib/cli-validation.js";
69
81
  const program = new Command();
70
82
  // Human-facing "update available" banner. update-notifier prints a box to
71
83
  // STDERR only, so it never pollutes the JSON on stdout. Guarded to a no-op for
@@ -102,7 +114,7 @@ Getting Started:
102
114
  AgentProfiles (the governed real-world bundle):
103
115
  init Scaffold a naive.config.ts with an agent profile template
104
116
  up Register infrastructure, runtime pool, and agent profile templates
105
- agent profiles Provision / list / get / revoke per-tenant agent profiles
117
+ agent-profiles Provision / list / get / revoke per-tenant agent profiles
106
118
  revoke Absolute revoke of an agent profile (freeze card, halt sends, tear down)
107
119
  module Add/list modules (capabilities) for your agent profiles
108
120
  env Switch API environment / create per-tenant preview sandboxes
@@ -110,13 +122,16 @@ AgentProfiles (the governed real-world bundle):
110
122
  Authentication:
111
123
  register Create a new account (email + password โ†’ API key)
112
124
  login Log in to existing account (email + password โ†’ API key)
125
+ logout Clear the saved agent API key from ~/.naive/config.json
113
126
  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
127
+ auth email Sign in / sign up with a durable email magic link
128
+ auth logout End the human session cookie (voice clone / session-login)
129
+ verify Retired โ€” six-digit code sign-in no longer exists. Use 'auth email'
116
130
 
117
131
  Account Management:
118
132
  whoami Show current identity
119
- companies List/switch companies
133
+ companies List/switch organizations (alias: naive organization)
134
+ projects List/create/select projects โ€” the layer inside your organization
120
135
  domains Manage email domains (list, connect, verify, purchase, edit DNS records)
121
136
  keys Manage API keys
122
137
  status Full status overview
@@ -124,25 +139,40 @@ Account Management:
124
139
  identity View provisioned resources
125
140
  billing Manage billing โ€” plans, subscriptions, credit top-ups
126
141
 
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
142
+ The durable runtime:
143
+ teams Declare a team, send it work, watch it, decide what it asks for.
144
+ The addressing tuple is (company, tenant, team) and --tenant is
145
+ required on every subcommand except 'list'.
146
+ $ naive teams submit support "refund the duplicate charge" --tenant tu_8f21
147
+
148
+ Legacy orchestration โ€” DEPRECATED, still working, FROZEN (no new capabilities):
149
+ Every command below keeps answering exactly as before and prints a one-line
150
+ deprecation banner on stderr naming its replacement. Nothing is disabled.
151
+ ceo โ†’ naive teams say / show / runs / watch
152
+ tasks โ†’ naive teams submit / board / task / unblock
153
+ objectives โ†’ naive teams submit --task
154
+ employees โ†’ naive teams roster (the provisioning verbs have no replacement:
155
+ roles are declared in naive.config.ts)
156
+ cron โ†’ naive teams schedule / unschedule (5 of 8 subcommands)
157
+ loops โ†’ naive teams schedule
158
+ memory โ†’ naive brain remember / forget
159
+
160
+ Knowledge:
161
+ brain Company knowledge + the run loop: attach, consolidate, proposals
136
162
  apps Web apps โ€” create, deploy, manage Vercel-backed applications
137
163
 
138
164
  Primitives:
139
165
  email Send/receive email via provisioned inboxes
140
166
  search Web search, URL extraction, deep research
141
167
  llm LLM chat completions via OpenRouter (300+ models)
168
+ audio Speech โ€” transcribe, synthesize, and native audio turns
142
169
  browser Live cloud browser sessions โ€” navigate, act, extract
143
170
  seo SEO tools โ€” keywords, backlinks, competitive intelligence
144
171
  app-data Mobile app data โ€” Google Play, Apple App Store
145
- business Business data โ€” Google, Trustpilot, TripAdvisor, Social
172
+ business Reviews & listings โ€” Google, Trustpilot, TripAdvisor, travel
173
+ company-data Private company firmographics, funding & tech stack
174
+ people B2B people search & contact enrichment (opt-in)
175
+ social-data Read public posts on X, Reddit, Bluesky & Hacker News
146
176
  aeo AEO/GEO โ€” LLM responses, scraper, mentions, AI keywords
147
177
  ecommerce E-commerce โ€” Google Shopping, Amazon products & sellers
148
178
  images AI image generation (fal.ai) + stock photos (Pexels)
@@ -166,6 +196,7 @@ Feedback & Bug Reports:
166
196
 
167
197
  Governance (human-in-the-loop):
168
198
  approvals Review & resolve agent-requested approvals for sensitive actions
199
+ sessions MCP sessions โ€” mint / list / revoke short-lived per-user credentials
169
200
  Sensitive actions (issue/fund a card, purchase a domain, KYC, form a company,
170
201
  connect/sign up for a 3rd-party service) may require human approval depending
171
202
  on the user's Account Kit. When gated, the command returns
@@ -184,25 +215,31 @@ Environment Variables:
184
215
  NAIVE_API_KEY Override API key (for CI/headless use)
185
216
  NAIVE_BASE_URL Override API URL (for local dev, default: https://api.usenaive.ai)
186
217
 
187
- Documentation: https://docs.usenaive.ai
218
+ Documentation: https://usenaive.ai/docs
188
219
  `);
189
220
  // Global output-mode flags. Default is machine JSON (safe for agents/pipes/CI/pty callers);
190
221
  // human mode is OPT-IN only (--human, NAIVE_HUMAN=1, or `naive config output human`). --json forces
191
222
  // machine output even when human mode is configured.
192
223
  program
193
224
  .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", () => {
225
+ .option("--human", "Force human-readable output for this command")
226
+ // One command's project, without changing the persisted selection. Omitted =
227
+ // the active project (`naive projects use`), and with none of those = the
228
+ // organization's default project.
229
+ .option("--project <project_id>", "Act inside this project for this command only");
230
+ function applyOutputFlags() {
196
231
  const o = program.opts();
197
232
  setOutputFlags({ json: !!o.json, human: !!o.human });
198
- });
233
+ setActiveProjectOverride(typeof o.project === "string" ? o.project : undefined);
234
+ }
235
+ program.hook("preAction", applyOutputFlags);
199
236
  program.addCommand(configCmd);
200
237
  program.addCommand(registerCmd);
201
238
  program.addCommand(loginCmd);
239
+ program.addCommand(logoutCmd);
202
240
  program.addCommand(authCmd);
203
- program.addCommand(linkCmd);
204
- program.addCommand(verifyCmd);
205
241
  program.addCommand(companiesCmd);
242
+ program.addCommand(projectsCmd);
206
243
  program.addCommand(whoamiCmd);
207
244
  program.addCommand(identityCmd);
208
245
  program.addCommand(keysCmd);
@@ -213,9 +250,13 @@ program.addCommand(billingCmd);
213
250
  program.addCommand(emailCmd);
214
251
  program.addCommand(searchCmd);
215
252
  program.addCommand(llmCmd);
253
+ program.addCommand(audioCmd);
216
254
  program.addCommand(seoCmd);
217
255
  program.addCommand(appDataCmd);
218
256
  program.addCommand(businessCmd);
257
+ program.addCommand(companyDataCmd);
258
+ program.addCommand(peopleCmd);
259
+ program.addCommand(socialDataCmd);
219
260
  program.addCommand(aeoCmd);
220
261
  program.addCommand(ecommerceCmd);
221
262
  program.addCommand(imagesCmd);
@@ -243,6 +284,7 @@ program.addCommand(appsCmd);
243
284
  program.addCommand(voiceCmd);
244
285
  program.addCommand(computeCmd);
245
286
  program.addCommand(queueCmd);
287
+ program.addCommand(sandboxCmd);
246
288
  program.addCommand(mobileCmd);
247
289
  program.addCommand(browserCmd);
248
290
  program.addCommand(reportCmd);
@@ -254,6 +296,97 @@ program.addCommand(agentProfilesCmd);
254
296
  program.addCommand(revokeCmd);
255
297
  program.addCommand(moduleCmd);
256
298
  program.addCommand(envCmd);
299
+ // The durable runtime. 28 subcommands, all built from lib/teams-catalog.ts.
300
+ program.addCommand(teamsCmd);
301
+ // Retired, and it says so instead of pretending a newer CLI has it.
302
+ program.addCommand(verifyCmd);
303
+ /**
304
+ * โ”€โ”€ THE LEGACY ORCHESTRATION SURFACE โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
305
+ *
306
+ * These seven groups KEEP WORKING. `markDeprecated` installs a commander
307
+ * `preAction` hook that writes a banner to stderr and attaches a machine notice
308
+ * to the stdout envelope, and then the action runs, unchanged. Nothing below
309
+ * gates, refuses or short-circuits anything, and no route is removed. Existing
310
+ * users must not break.
311
+ *
312
+ * The hook goes on the GROUP rather than on each handler, so a subcommand added
313
+ * to one of these groups next month is marked without its author doing anything.
314
+ *
315
+ * The subject and the `[dep.โ€ฆ]` id are derived from `cmd.name()` โ€” the one place
316
+ * the name is already written down โ€” so a rename cannot leave a notice pointing
317
+ * at a command that no longer exists.
318
+ */
319
+ const LEGACY_ORCHESTRATION = {
320
+ alsoCalled: LEGACY_RUNTIME_ALIASES,
321
+ why: "the durable runtime enforces policy at the tool boundary, not only at the gateway, " +
322
+ "and it is the only runtime new work is built on",
323
+ since: "2026-08",
324
+ sunset: { kind: "frozen" },
325
+ guide: "https://usenaive.ai/docs/migration-guides/legacy-orchestration-to-durable-teams",
326
+ };
327
+ export const LEGACY_DEPRECATIONS = [
328
+ markDeprecated(ceoCmd, {
329
+ id: "dep.primitive.ceo",
330
+ ...LEGACY_ORCHESTRATION,
331
+ drives: "the legacy orchestration runtime's lead agent, which is FROZEN โ€” it accepts no new capabilities.",
332
+ replacement: { kind: "use", what: "naive teams say <team> --tenant <tu> ยท naive teams show / runs / watch" },
333
+ }),
334
+ markDeprecated(tasksCmd, {
335
+ id: "dep.primitive.tasks",
336
+ ...LEGACY_ORCHESTRATION,
337
+ drives: "the legacy orchestration runtime's board, which is FROZEN โ€” it accepts no new capabilities.",
338
+ replacement: { kind: "use", what: 'naive teams submit <team> "<goal>" --tenant <tu> ยท naive teams board / task / unblock' },
339
+ gaps: [
340
+ {
341
+ sub: "complete",
342
+ because: "the durable runtime completes through the judge plus attestation, not an operator POST",
343
+ },
344
+ { sub: "dispatch", because: "the durable runtime dispatches from the board itself" },
345
+ { sub: "run", because: "work is submitted, not run โ€” `naive teams submit` is the one verb" },
346
+ ],
347
+ }),
348
+ markDeprecated(objectivesCmd, {
349
+ id: "dep.primitive.objectives",
350
+ ...LEGACY_ORCHESTRATION,
351
+ drives: "a second noun for a goal with tasks under it, on the FROZEN legacy orchestration runtime.",
352
+ replacement: { kind: "use", what: "naive teams submit <team> --task <id>" },
353
+ }),
354
+ markDeprecated(employeesCmd, {
355
+ id: "dep.primitive.employees",
356
+ ...LEGACY_ORCHESTRATION,
357
+ drives: "the legacy orchestration runtime's roster and its provisioning verbs, which are FROZEN.",
358
+ replacement: { kind: "use", what: "naive teams roster <team> --tenant <tu>" },
359
+ gaps: [
360
+ {
361
+ sub: "(the provisioning verbs)",
362
+ because: "roles are DECLARED in naive.config.ts and the durable runtime 409s an undeclared role โ€” " +
363
+ "there is no imperative equivalent, by design",
364
+ },
365
+ ],
366
+ }),
367
+ markDeprecated(cronCmd, {
368
+ id: "dep.primitive.cron",
369
+ ...LEGACY_ORCHESTRATION,
370
+ drives: "scheduled work on the FROZEN legacy orchestration runtime.",
371
+ replacement: { kind: "use", what: "naive teams schedule / unschedule" },
372
+ gaps: [
373
+ { sub: "pause", because: "the durable runtime has no pause โ€” stop the team, or unschedule" },
374
+ { sub: "resume", because: "the durable runtime has no pause to resume from" },
375
+ ],
376
+ }),
377
+ markDeprecated(loopsCmd, {
378
+ id: "dep.primitive.loops",
379
+ ...LEGACY_ORCHESTRATION,
380
+ drives: "recurring agent runs on the FROZEN legacy orchestration runtime.",
381
+ replacement: { kind: "use", what: "naive teams schedule" },
382
+ }),
383
+ markDeprecated(memoryCmd, {
384
+ id: "dep.primitive.memory",
385
+ ...LEGACY_ORCHESTRATION,
386
+ drives: "a per-agent fact store that is a retired product noun โ€” the company brain is the one memory.",
387
+ replacement: { kind: "use", what: "naive brain remember ยท naive brain recall ยท naive brain forget" },
388
+ }),
389
+ ];
257
390
  // Multi-tenant v2
258
391
  program.addCommand(useCmd);
259
392
  program.addCommand(usersCmd);
@@ -262,14 +395,107 @@ program.addCommand(vaultCmd);
262
395
  program.addCommand(logsCmd);
263
396
  program.addCommand(connectionsCmd);
264
397
  program.addCommand(approvalsCmd);
398
+ program.addCommand(sessionsCmd);
265
399
  // Unknown-command handler: instead of commander's raw
266
400
  // "error: unknown command 'report' (Did you mean memory?)" stderr line, emit a
267
401
  // structured cli_outdated JSON error โ€” the command may exist in a newer CLI.
268
402
  // Valid commands and --help are unaffected (this only fires on no match).
269
403
  program.on("command:*", (operands) => {
404
+ applyOutputFlags();
270
405
  const unknown = operands[0] ?? program.args[0] ?? "";
271
406
  const built = buildUnknownCommandError(unknown, readVersion());
272
407
  agentError({ action: built.action, error: built.error, recovery_steps: built.recovery_steps });
273
408
  });
274
- program.parse();
409
+ // A TRUE last resort, below Commander. `parseAsync` awaits the action handler, so
410
+ // a command that rejects is caught in the catch block below โ€” that is the primary
411
+ // path. This stays for what parseAsync cannot see: a promise a command `void`s
412
+ // without awaiting. Node would otherwise print a raw stack to stderr and exit 1,
413
+ // and an agent parsing stdout would get nothing it can act on.
414
+ process.on("unhandledRejection", (reason) => {
415
+ const err = {
416
+ code: "internal_error",
417
+ message: reason instanceof Error ? reason.message : String(reason),
418
+ };
419
+ agentError({
420
+ action: program.args[0] ?? "cli",
421
+ error: err,
422
+ recovery_steps: [
423
+ { command: "naive status", description: "Check API connectivity and auth status" },
424
+ {
425
+ command: 'naive report "<what failed>" --command "<the command you ran>" --kind error',
426
+ description: "Report it to the naive team if it persists",
427
+ },
428
+ ],
429
+ });
430
+ });
431
+ // Commander normally prints plain-text validation failures before exiting. The
432
+ // CLI promises a machine-readable envelope, so intercept only those failures;
433
+ // normal --help/--version output keeps its standard zero-exit behavior.
434
+ configureStructuredValidation(program);
435
+ // N10: an unknown SUBcommand of a known group (e.g. `naive trading market-data`)
436
+ // must fail loudly and exit non-zero โ€” even when `--help` is appended. Commander's
437
+ // help option otherwise short-circuits to the parent's help and exits 0, silently
438
+ // hiding the mistake and blocking flag discovery. Detect it up front, before parse,
439
+ // so the behavior is identical with and without `--help`. Real subcommands and a
440
+ // bare `<group> --help` are untouched (findUnknownSubcommand returns null).
441
+ const unknownSub = findUnknownSubcommand(program, process.argv.slice(2));
442
+ if (unknownSub) {
443
+ const built = buildUnknownSubcommandError(unknownSub.group, unknownSub.unknown, unknownSub.validSubs, readVersion());
444
+ agentError({ action: built.action, error: built.error, recovery_steps: built.recovery_steps });
445
+ }
446
+ try {
447
+ await program.parseAsync(process.argv);
448
+ }
449
+ catch (error) {
450
+ if (error instanceof CommanderError) {
451
+ if (error.exitCode === 0)
452
+ process.exit(0);
453
+ // A bare GROUP (`naive approvals`) is a request for orientation, not a
454
+ // validation failure: commander answers it with `commander.help`, whose
455
+ // text configureStructuredValidation suppressed. Print the group's own
456
+ // help โ€” subcommands and all โ€” instead of an `invalid_input: (outputHelp)`
457
+ // envelope that names no next step.
458
+ if (error.code === "commander.help") {
459
+ let cmd = program;
460
+ for (const arg of process.argv.slice(2)) {
461
+ if (arg.startsWith("-"))
462
+ continue;
463
+ const next = cmd.commands.find((c) => c.name() === arg || c.aliases().includes(arg));
464
+ if (!next)
465
+ break;
466
+ cmd = next;
467
+ }
468
+ process.stdout.write(cmd.helpInformation());
469
+ process.exit(0);
470
+ }
471
+ // Commander validates required options before preAction hooks run. Apply
472
+ // root output flags here too so validation errors honor --human, and an
473
+ // explicit --json still overrides NAIVE_HUMAN/configured human output.
474
+ applyOutputFlags();
475
+ const args = program.args.length > 0 ? program.args : process.argv.slice(2);
476
+ agentError({
477
+ action: commandAction(args),
478
+ error: {
479
+ code: "invalid_input",
480
+ message: cleanCommanderMessage(error.message),
481
+ commander_code: error.code,
482
+ },
483
+ recovery_steps: [
484
+ { command: helpCommand(args), description: "See required arguments and options" },
485
+ ],
486
+ });
487
+ }
488
+ agentError({
489
+ action: commandAction(program.args),
490
+ error: {
491
+ code: "internal_error",
492
+ message: "The command failed unexpectedly.",
493
+ hint: error instanceof Error ? error.message : String(error),
494
+ },
495
+ recovery_steps: [
496
+ { command: "# retry the command once", description: "Retry transient API or network failures" },
497
+ { command: 'naive report "CLI command failed" --kind error', description: "Report it if the failure persists" },
498
+ ],
499
+ });
500
+ }
275
501
  //# 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,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM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AC,KAAK,CAAC,OAAO,CAAC;gBAC7C,cAAc,EAAE,KAAK,CAAC,IAAI;aAC3B;YACD,cAAc,EAAE;gBACd,EAAE,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,oCAAoC,EAAE;aAClF;SACF,CAAC,CAAC;IACL,CAAC;IAED,UAAU,CAAC;QACT,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC;QACnC,KAAK,EAAE;YACL,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,kCAAkC;YAC3C,IAAI,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;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[];