@usenaive-sdk/cli 0.15.1 → 1.0.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 (281) hide show
  1. package/README.md +43 -402
  2. package/dist/index.js +51796 -502
  3. package/package.json +22 -18
  4. package/dist/client.d.ts +0 -108
  5. package/dist/client.js +0 -458
  6. package/dist/client.js.map +0 -1
  7. package/dist/commands/account-kits.d.ts +0 -2
  8. package/dist/commands/account-kits.js +0 -71
  9. package/dist/commands/account-kits.js.map +0 -1
  10. package/dist/commands/aeo.d.ts +0 -2
  11. package/dist/commands/aeo.js +0 -451
  12. package/dist/commands/aeo.js.map +0 -1
  13. package/dist/commands/agent-profiles.d.ts +0 -11
  14. package/dist/commands/agent-profiles.js +0 -120
  15. package/dist/commands/agent-profiles.js.map +0 -1
  16. package/dist/commands/agents.d.ts +0 -2
  17. package/dist/commands/agents.js +0 -916
  18. package/dist/commands/agents.js.map +0 -1
  19. package/dist/commands/app-data.d.ts +0 -2
  20. package/dist/commands/app-data.js +0 -445
  21. package/dist/commands/app-data.js.map +0 -1
  22. package/dist/commands/approvals.d.ts +0 -2
  23. package/dist/commands/approvals.js +0 -242
  24. package/dist/commands/approvals.js.map +0 -1
  25. package/dist/commands/apps.d.ts +0 -9
  26. package/dist/commands/apps.js +0 -844
  27. package/dist/commands/apps.js.map +0 -1
  28. package/dist/commands/audio.d.ts +0 -9
  29. package/dist/commands/audio.js +0 -391
  30. package/dist/commands/audio.js.map +0 -1
  31. package/dist/commands/auth.d.ts +0 -31
  32. package/dist/commands/auth.js +0 -428
  33. package/dist/commands/auth.js.map +0 -1
  34. package/dist/commands/billing.d.ts +0 -2
  35. package/dist/commands/billing.js +0 -250
  36. package/dist/commands/billing.js.map +0 -1
  37. package/dist/commands/brain.d.ts +0 -2
  38. package/dist/commands/brain.js +0 -1300
  39. package/dist/commands/brain.js.map +0 -1
  40. package/dist/commands/browser.d.ts +0 -2
  41. package/dist/commands/browser.js +0 -378
  42. package/dist/commands/browser.js.map +0 -1
  43. package/dist/commands/business.d.ts +0 -2
  44. package/dist/commands/business.js +0 -566
  45. package/dist/commands/business.js.map +0 -1
  46. package/dist/commands/cards.d.ts +0 -2
  47. package/dist/commands/cards.js +0 -419
  48. package/dist/commands/cards.js.map +0 -1
  49. package/dist/commands/ceo.d.ts +0 -2
  50. package/dist/commands/ceo.js +0 -369
  51. package/dist/commands/ceo.js.map +0 -1
  52. package/dist/commands/clone.d.ts +0 -2
  53. package/dist/commands/clone.js +0 -203
  54. package/dist/commands/clone.js.map +0 -1
  55. package/dist/commands/companies.d.ts +0 -10
  56. package/dist/commands/companies.js +0 -283
  57. package/dist/commands/companies.js.map +0 -1
  58. package/dist/commands/company-data.d.ts +0 -2
  59. package/dist/commands/company-data.js +0 -168
  60. package/dist/commands/company-data.js.map +0 -1
  61. package/dist/commands/compute.d.ts +0 -2
  62. package/dist/commands/compute.js +0 -498
  63. package/dist/commands/compute.js.map +0 -1
  64. package/dist/commands/config.d.ts +0 -2
  65. package/dist/commands/config.js +0 -36
  66. package/dist/commands/config.js.map +0 -1
  67. package/dist/commands/connections.d.ts +0 -8
  68. package/dist/commands/connections.js +0 -137
  69. package/dist/commands/connections.js.map +0 -1
  70. package/dist/commands/cron-jobs.d.ts +0 -2
  71. package/dist/commands/cron-jobs.js +0 -245
  72. package/dist/commands/cron-jobs.js.map +0 -1
  73. package/dist/commands/domains.d.ts +0 -2
  74. package/dist/commands/domains.js +0 -474
  75. package/dist/commands/domains.js.map +0 -1
  76. package/dist/commands/ecommerce.d.ts +0 -2
  77. package/dist/commands/ecommerce.js +0 -277
  78. package/dist/commands/ecommerce.js.map +0 -1
  79. package/dist/commands/email.d.ts +0 -2
  80. package/dist/commands/email.js +0 -336
  81. package/dist/commands/email.js.map +0 -1
  82. package/dist/commands/employees.d.ts +0 -2
  83. package/dist/commands/employees.js +0 -190
  84. package/dist/commands/employees.js.map +0 -1
  85. package/dist/commands/env.d.ts +0 -7
  86. package/dist/commands/env.js +0 -112
  87. package/dist/commands/env.js.map +0 -1
  88. package/dist/commands/formation.d.ts +0 -2
  89. package/dist/commands/formation.js +0 -273
  90. package/dist/commands/formation.js.map +0 -1
  91. package/dist/commands/identity.d.ts +0 -2
  92. package/dist/commands/identity.js +0 -110
  93. package/dist/commands/identity.js.map +0 -1
  94. package/dist/commands/images.d.ts +0 -2
  95. package/dist/commands/images.js +0 -371
  96. package/dist/commands/images.js.map +0 -1
  97. package/dist/commands/init.d.ts +0 -5
  98. package/dist/commands/init.js +0 -43
  99. package/dist/commands/init.js.map +0 -1
  100. package/dist/commands/jobs.d.ts +0 -2
  101. package/dist/commands/jobs.js +0 -144
  102. package/dist/commands/jobs.js.map +0 -1
  103. package/dist/commands/keys.d.ts +0 -2
  104. package/dist/commands/keys.js +0 -156
  105. package/dist/commands/keys.js.map +0 -1
  106. package/dist/commands/legacy-auth.d.ts +0 -27
  107. package/dist/commands/legacy-auth.js +0 -64
  108. package/dist/commands/legacy-auth.js.map +0 -1
  109. package/dist/commands/llm.d.ts +0 -2
  110. package/dist/commands/llm.js +0 -125
  111. package/dist/commands/llm.js.map +0 -1
  112. package/dist/commands/login.d.ts +0 -2
  113. package/dist/commands/login.js +0 -65
  114. package/dist/commands/login.js.map +0 -1
  115. package/dist/commands/logout.d.ts +0 -7
  116. package/dist/commands/logout.js +0 -55
  117. package/dist/commands/logout.js.map +0 -1
  118. package/dist/commands/logs.d.ts +0 -2
  119. package/dist/commands/logs.js +0 -42
  120. package/dist/commands/logs.js.map +0 -1
  121. package/dist/commands/loops.d.ts +0 -2
  122. package/dist/commands/loops.js +0 -260
  123. package/dist/commands/loops.js.map +0 -1
  124. package/dist/commands/media.d.ts +0 -2
  125. package/dist/commands/media.js +0 -183
  126. package/dist/commands/media.js.map +0 -1
  127. package/dist/commands/memory.d.ts +0 -2
  128. package/dist/commands/memory.js +0 -151
  129. package/dist/commands/memory.js.map +0 -1
  130. package/dist/commands/mobile.d.ts +0 -4
  131. package/dist/commands/mobile.js +0 -382
  132. package/dist/commands/mobile.js.map +0 -1
  133. package/dist/commands/module.d.ts +0 -8
  134. package/dist/commands/module.js +0 -48
  135. package/dist/commands/module.js.map +0 -1
  136. package/dist/commands/objectives.d.ts +0 -2
  137. package/dist/commands/objectives.js +0 -243
  138. package/dist/commands/objectives.js.map +0 -1
  139. package/dist/commands/payments.d.ts +0 -2
  140. package/dist/commands/payments.js +0 -131
  141. package/dist/commands/payments.js.map +0 -1
  142. package/dist/commands/people.d.ts +0 -2
  143. package/dist/commands/people.js +0 -197
  144. package/dist/commands/people.js.map +0 -1
  145. package/dist/commands/phone.d.ts +0 -2
  146. package/dist/commands/phone.js +0 -289
  147. package/dist/commands/phone.js.map +0 -1
  148. package/dist/commands/projects.d.ts +0 -13
  149. package/dist/commands/projects.js +0 -220
  150. package/dist/commands/projects.js.map +0 -1
  151. package/dist/commands/queue.d.ts +0 -2
  152. package/dist/commands/queue.js +0 -121
  153. package/dist/commands/queue.js.map +0 -1
  154. package/dist/commands/register.d.ts +0 -2
  155. package/dist/commands/register.js +0 -88
  156. package/dist/commands/register.js.map +0 -1
  157. package/dist/commands/report.d.ts +0 -17
  158. package/dist/commands/report.js +0 -109
  159. package/dist/commands/report.js.map +0 -1
  160. package/dist/commands/sandbox.d.ts +0 -2
  161. package/dist/commands/sandbox.js +0 -558
  162. package/dist/commands/sandbox.js.map +0 -1
  163. package/dist/commands/search.d.ts +0 -2
  164. package/dist/commands/search.js +0 -223
  165. package/dist/commands/search.js.map +0 -1
  166. package/dist/commands/seo.d.ts +0 -2
  167. package/dist/commands/seo.js +0 -528
  168. package/dist/commands/seo.js.map +0 -1
  169. package/dist/commands/sessions.d.ts +0 -6
  170. package/dist/commands/sessions.js +0 -109
  171. package/dist/commands/sessions.js.map +0 -1
  172. package/dist/commands/social-data.d.ts +0 -2
  173. package/dist/commands/social-data.js +0 -245
  174. package/dist/commands/social-data.js.map +0 -1
  175. package/dist/commands/social.d.ts +0 -2
  176. package/dist/commands/social.js +0 -407
  177. package/dist/commands/social.js.map +0 -1
  178. package/dist/commands/status.d.ts +0 -2
  179. package/dist/commands/status.js +0 -79
  180. package/dist/commands/status.js.map +0 -1
  181. package/dist/commands/support.d.ts +0 -2
  182. package/dist/commands/support.js +0 -134
  183. package/dist/commands/support.js.map +0 -1
  184. package/dist/commands/tasks.d.ts +0 -2
  185. package/dist/commands/tasks.js +0 -409
  186. package/dist/commands/tasks.js.map +0 -1
  187. package/dist/commands/teams.d.ts +0 -69
  188. package/dist/commands/teams.js +0 -503
  189. package/dist/commands/teams.js.map +0 -1
  190. package/dist/commands/trading.d.ts +0 -2
  191. package/dist/commands/trading.js +0 -333
  192. package/dist/commands/trading.js.map +0 -1
  193. package/dist/commands/up.d.ts +0 -551
  194. package/dist/commands/up.js +0 -1149
  195. package/dist/commands/up.js.map +0 -1
  196. package/dist/commands/usage.d.ts +0 -2
  197. package/dist/commands/usage.js +0 -73
  198. package/dist/commands/usage.js.map +0 -1
  199. package/dist/commands/use.d.ts +0 -12
  200. package/dist/commands/use.js +0 -96
  201. package/dist/commands/use.js.map +0 -1
  202. package/dist/commands/users.d.ts +0 -10
  203. package/dist/commands/users.js +0 -82
  204. package/dist/commands/users.js.map +0 -1
  205. package/dist/commands/vault.d.ts +0 -2
  206. package/dist/commands/vault.js +0 -101
  207. package/dist/commands/vault.js.map +0 -1
  208. package/dist/commands/verification.d.ts +0 -2
  209. package/dist/commands/verification.js +0 -152
  210. package/dist/commands/verification.js.map +0 -1
  211. package/dist/commands/verify-email.d.ts +0 -19
  212. package/dist/commands/verify-email.js +0 -130
  213. package/dist/commands/verify-email.js.map +0 -1
  214. package/dist/commands/video.d.ts +0 -2
  215. package/dist/commands/video.js +0 -417
  216. package/dist/commands/video.js.map +0 -1
  217. package/dist/commands/voice.d.ts +0 -2
  218. package/dist/commands/voice.js +0 -516
  219. package/dist/commands/voice.js.map +0 -1
  220. package/dist/commands/wallet.d.ts +0 -2
  221. package/dist/commands/wallet.js +0 -244
  222. package/dist/commands/wallet.js.map +0 -1
  223. package/dist/commands/webhooks.d.ts +0 -13
  224. package/dist/commands/webhooks.js +0 -119
  225. package/dist/commands/webhooks.js.map +0 -1
  226. package/dist/commands/whoami.d.ts +0 -2
  227. package/dist/commands/whoami.js +0 -53
  228. package/dist/commands/whoami.js.map +0 -1
  229. package/dist/config.d.ts +0 -42
  230. package/dist/config.js +0 -83
  231. package/dist/config.js.map +0 -1
  232. package/dist/index.d.ts +0 -3
  233. package/dist/index.js.map +0 -1
  234. package/dist/lib/brain-select.d.ts +0 -193
  235. package/dist/lib/brain-select.js +0 -403
  236. package/dist/lib/brain-select.js.map +0 -1
  237. package/dist/lib/cli-validation.d.ts +0 -12
  238. package/dist/lib/cli-validation.js +0 -46
  239. package/dist/lib/cli-validation.js.map +0 -1
  240. package/dist/lib/config-errors.d.ts +0 -4
  241. package/dist/lib/config-errors.js +0 -13
  242. package/dist/lib/config-errors.js.map +0 -1
  243. package/dist/lib/deprecation.d.ts +0 -158
  244. package/dist/lib/deprecation.js +0 -140
  245. package/dist/lib/deprecation.js.map +0 -1
  246. package/dist/lib/duration.d.ts +0 -8
  247. package/dist/lib/duration.js +0 -11
  248. package/dist/lib/duration.js.map +0 -1
  249. package/dist/lib/http-response.d.ts +0 -11
  250. package/dist/lib/http-response.js +0 -96
  251. package/dist/lib/http-response.js.map +0 -1
  252. package/dist/lib/llm-paywall.d.ts +0 -82
  253. package/dist/lib/llm-paywall.js +0 -231
  254. package/dist/lib/llm-paywall.js.map +0 -1
  255. package/dist/lib/pricing.d.ts +0 -132
  256. package/dist/lib/pricing.js +0 -148
  257. package/dist/lib/pricing.js.map +0 -1
  258. package/dist/lib/starter-config.d.ts +0 -13
  259. package/dist/lib/starter-config.js +0 -71
  260. package/dist/lib/starter-config.js.map +0 -1
  261. package/dist/lib/stream-frames.d.ts +0 -114
  262. package/dist/lib/stream-frames.js +0 -169
  263. package/dist/lib/stream-frames.js.map +0 -1
  264. package/dist/lib/teams-catalog.d.ts +0 -141
  265. package/dist/lib/teams-catalog.js +0 -841
  266. package/dist/lib/teams-catalog.js.map +0 -1
  267. package/dist/lib/unknown-command.d.ts +0 -71
  268. package/dist/lib/unknown-command.js +0 -132
  269. package/dist/lib/unknown-command.js.map +0 -1
  270. package/dist/lib/version-check.d.ts +0 -26
  271. package/dist/lib/version-check.js +0 -21
  272. package/dist/lib/version-check.js.map +0 -1
  273. package/dist/output.d.ts +0 -246
  274. package/dist/output.js +0 -539
  275. package/dist/output.js.map +0 -1
  276. package/dist/prompt.d.ts +0 -17
  277. package/dist/prompt.js +0 -70
  278. package/dist/prompt.js.map +0 -1
  279. package/dist/version.d.ts +0 -2
  280. package/dist/version.js +0 -14
  281. package/dist/version.js.map +0 -1
@@ -1,551 +0,0 @@
1
- import { Command } from "commander";
2
- import { type NextStep } from "../output.js";
3
- /** What the API reports back per declared `runtime.durable` team. */
4
- export interface DurableTeamResult {
5
- team: string;
6
- /**
7
- * The tenant this team routes as, `(companyId, tenantUserId)`.
8
- *
9
- * PRINTED, because the two-step flow is unusable without it. A durable team is
10
- * refused until the runtime already holds it, and registering it there needs
11
- * the tenant_user_id — which nothing else on this side shows. The refusal used
12
- * to say "supply the credential the runtime issued for this tenant" without
13
- * ever naming the tenant.
14
- */
15
- subject?: {
16
- company_id: string;
17
- tenant_user_id: string;
18
- };
19
- agents?: Array<{
20
- role: string;
21
- provision_status: string;
22
- loop?: AppliedLoop;
23
- }>;
24
- archived?: string[];
25
- /**
26
- * Job ids this apply CANCELLED on the runtime because the config stopped
27
- * declaring them. Printed, because a timer that was stopped is real work the
28
- * apply did and the alternative — silence — is what makes "I deleted the loop
29
- * and it kept firing" indistinguishable from "I deleted the loop and it
30
- * stopped".
31
- */
32
- loops_unscheduled?: string[];
33
- placement?: {
34
- status: string;
35
- code?: string;
36
- message?: string;
37
- details?: Record<string, unknown>;
38
- };
39
- /**
40
- * WHAT MANIFEST DELIVERY DID, which is a DIFFERENT fact from `placement`.
41
- *
42
- * `placement` answers "does this tenant route to the durable runtime". This
43
- * answers "does the runtime enforce what the config declared". A placed team
44
- * whose manifest was refused is exactly the state that must not read as
45
- * success: it routes, it accepts requests, and it dispatches nothing —
46
- * `deliverTeamManifest` (packages/api/src/services/system-staffing.ts) PUTs
47
- * the record and then applies the digest, and a team whose bind was refused
48
- * ticks with no bound manifest.
49
- *
50
- * This field was ALREADY on the wire and this interface was the entire loss.
51
- * Traced end to end: `deliverTeamManifest` returns `ManifestDelivery`, the
52
- * materializer carries it on `DurableTeamApply.manifest`, `applyDeployment`
53
- * returns that object whole, and the route `res.json(result)`s it (sync) or
54
- * stores it as the job result (async) — which this command reads back
55
- * verbatim as `job.result`. Nothing in between dropped it; only this
56
- * interface failed to name it, so the CLI decoded a refusal into nothing.
57
- *
58
- * `status` is typed `string`, not the API's union
59
- * (`applied | noop | delivered_not_applied | refused | unreachable |
60
- * skipped`), matching how `placement.status` is already typed one line up:
61
- * the CLI decodes untrusted wire JSON and the API owns the union. A server
62
- * that grows a seventh status must not make this decoder throw.
63
- */
64
- manifest?: {
65
- status: string;
66
- digest?: string;
67
- code?: string;
68
- error?: string;
69
- };
70
- /**
71
- * What apply did with each `team({ on })` trigger — ONE ENTRY PER KEY.
72
- *
73
- * Never a count, for the reason the per-loop lines exist: a registered timer
74
- * and a refused one are different facts, and a summary is exactly where they
75
- * get confused. `registerTeamTriggers`
76
- * (packages/api/src/services/system-staffing.ts) reports per trigger and this
77
- * interface is the only thing between that report and the operator.
78
- */
79
- triggers?: AppliedTrigger[];
80
- /** Trigger job ids this apply CANCELLED because the config stopped declaring them. */
81
- triggers_unscheduled?: string[];
82
- /**
83
- * Standing runtime schedules this config did NOT author. Named, never
84
- * cancelled — see `registerTeamTriggers` for why the marker is a job-id
85
- * namespace rather than the `config_source` stamp apply uses everywhere else.
86
- *
87
- * PRINTED, because the decision is made correctly in the service and is
88
- * invisible without this: apply deliberately leaves somebody else's timer
89
- * standing, and an operator who is never told cannot act on it. Same shape as
90
- * the brains `retained` sentence, deliberately — one vocabulary for "this
91
- * exists, this config did not declare it, remove it yourself".
92
- */
93
- schedules_retained?: string[];
94
- /**
95
- * Capabilities the CONTROL PLANE added to this team's manifest that the config
96
- * did not declare — `"<role>: <capability>"`. See `DurableTeamApply
97
- * .manifest_grants` on the API for what it is and why it had to be named.
98
- *
99
- * PRINTED for the same reason `schedules_retained` is: the decision is made
100
- * correctly on the other side and is invisible without this. `naive up`, the
101
- * `/plan` report and `/roster` all show the DECLARED `can:`, and the digest an
102
- * operator reviews and binds contained one more capability than any of them
103
- * listed.
104
- */
105
- manifest_grants?: string[];
106
- }
107
- /**
108
- * What apply did with one declared trigger — see `AppliedTrigger` on the API.
109
- *
110
- * `status` carries a FOURTH state the loop lane does not have. A loop against an
111
- * unbound manifest is reported `queued`, which is honest for a loop: the next
112
- * `naive up` registers it. A trigger says `blocked_unbound` because the operator
113
- * ACTION is different and a shared word hides it — `queued` reads as "the
114
- * runtime was busy, wait", and the real state is "the runtime refuses to
115
- * schedule against a manifest it has not bound, and `naive teams apply` is the
116
- * repair", which is a thing a human must go and do.
117
- */
118
- interface AppliedTrigger {
119
- key: string;
120
- cron: string;
121
- name: string;
122
- status: "registered" | "queued" | "unschedulable" | "blocked_unbound";
123
- /** WHY, in the words of whatever decided it — a runtime sentence, verbatim. */
124
- reason?: string;
125
- }
126
- /** What the API reports about the brains `company.brains` declared. */
127
- interface BrainsResult {
128
- declared_in?: string | null;
129
- created?: Array<{
130
- name: string;
131
- }>;
132
- converged?: Array<{
133
- name: string;
134
- }>;
135
- default?: {
136
- name?: string | null;
137
- changed?: boolean;
138
- };
139
- retained_undeclared?: string[];
140
- /**
141
- * Declared brain policy with no column to land in, per brain.
142
- * `brain_knowledge_bases` has columns for name, is_default, scope, status and
143
- * provider ids and nothing else, so `retention`, `partitions`, `writes`,
144
- * `recall`, `lanes`, `visibility` and `bounds` are accepted and not stored.
145
- */
146
- unpersisted?: Record<string, string[]>;
147
- /** The server's own prose for the same, plus the retained-undeclared note. */
148
- notes?: string[];
149
- }
150
- /**
151
- * The brain half of the report, or undefined when the config declared none.
152
- *
153
- * Exported for the same reason it exists: `naive up` printed `applied: true` and
154
- * said NOTHING about brains, so a config that declared two of them looked
155
- * identical to a config that declared none. `--plan` showed them (it prints the
156
- * whole plan); apply did not. A provisioned thing that is not reported is the
157
- * same silence as an unprovisioned one, one level up.
158
- *
159
- * 🔴 AND `unpersisted` IS PART OF THE REPORT, NOT AN EXTRA. The apply path
160
- * computed the accept-and-drop list and this projection threw it away, so
161
- * `naive up --plan` told the user which declared brain keys have no column and
162
- * plain `naive up` — the command people actually run — did not. That is the same
163
- * defect one level down: `packages/api/src/services/deployment-brains.ts`'s own
164
- * header calls accept-and-drop "the exact defect this file exists to remove", and
165
- * a report only the dry run prints is a report most operators never see.
166
- */
167
- export declare function brainReport(brains: BrainsResult | undefined): {
168
- declared_in: string | null;
169
- created: string[];
170
- converged: string[];
171
- default: string | null;
172
- retained: string[];
173
- unpersisted?: Record<string, string[]>;
174
- notes?: string[];
175
- } | undefined;
176
- /** What the frozen runtime reports per hermes team. */
177
- interface HermesTeamResult {
178
- system: string;
179
- agents?: Array<{
180
- role: string;
181
- provision_status: string;
182
- loop?: AppliedLoop;
183
- }>;
184
- archived?: string[];
185
- }
186
- /** What apply did with one agent's declared `loop` — see AppliedLoop on the API. */
187
- interface AppliedLoop {
188
- name: string;
189
- /** The calendar arm. Absent on an interval loop — see {@link loopCadence}. */
190
- cron?: string;
191
- /** The interval arm, in seconds. Durable lane only; absent on a cron loop. */
192
- everySeconds?: number;
193
- status: "registered" | "queued" | "unschedulable";
194
- /**
195
- * WHY, in the words of whatever decided it. Set on the durable lane only — a
196
- * runtime refusal quoted verbatim, or "already registered; unchanged" for a
197
- * re-apply that converged. Optional because the hermes lane's `queued` has one
198
- * meaning and repeating it every line would be noise.
199
- */
200
- reason?: string;
201
- }
202
- /** One printed loop line: the role that declared it, plus what apply did with it. */
203
- export type PrintedLoop = AppliedLoop & {
204
- role: string;
205
- };
206
- /**
207
- * How a loop's cadence PRINTS — the one place that decides, so the four lines
208
- * below cannot disagree about it.
209
- *
210
- * An interval is spelled `every 3600s` rather than as a bare number: `(3600)`
211
- * next to a name reads as an id, and the whole point of this line is that an
212
- * operator can tell at a glance what is about to spend on a timer.
213
- *
214
- * The empty fallback is reachable only for an {@link AppliedLoop} carrying
215
- * neither arm, which the fold refuses (`loop_cadence_invalid`) — so it exists to
216
- * keep the report printable rather than to describe anything real.
217
- */
218
- export declare function loopCadence(l: {
219
- cron?: string;
220
- everySeconds?: number;
221
- }): string;
222
- /**
223
- * Every loop this apply touched on a team, BOTH LANES FOLDED.
224
- *
225
- * A registered loop is real, recurring work the apply just scheduled, and
226
- * reporting nothing about it made a firing schedule invisible — the reason this
227
- * projection exists at all. It read `hermes?.agents` only, which was correct
228
- * exactly as long as the durable lane registered nothing: a durable role's
229
- * `loop` came back in `unconsumed` and there was no timer to print. Now that
230
- * `registerDurableTeamLoops` (packages/api/src/services/system-staffing.ts)
231
- * registers it against the runtime's own alarm, reading one lane would make a
232
- * schedule the apply had just created invisible on the OTHER runtime — the same
233
- * silence, moved.
234
- *
235
- * Folded rather than `durable ?? hermes` for the reason `agents` is: a MIXED
236
- * team is reported by both materializers and preferring one drops the other's
237
- * half.
238
- */
239
- export declare function projectLoops(hermes: HermesTeamResult | undefined, durable: DurableTeamResult | undefined): PrintedLoop[];
240
- /** The shape `loopHints` reads — a printed team, narrowed to what it needs. */
241
- export interface LoopBearingTeam {
242
- name: string;
243
- runtime: string;
244
- role_runtimes?: Record<string, string>;
245
- loops?: PrintedLoop[];
246
- loops_unscheduled?: string[];
247
- }
248
- /**
249
- * One hint line per loop, plus one per loop this apply cancelled.
250
- *
251
- * 🔴 THE LIST COMMAND IS LANE-DEPENDENT AND NAMING THE WRONG ONE IS WORSE THAN
252
- * NAMING NONE. `naive cron list` reads `cron_jobs`, which has no row for a
253
- * durable tenant — an operator who followed it after a durable loop registered
254
- * would find nothing and conclude the line above it had lied. A mixed team has
255
- * both lanes at once, so the lookup is per ROLE and falls back to the team's.
256
- */
257
- export declare function loopHints(t: LoopBearingTeam): string[];
258
- /** The shape {@link grantHints} reads — a printed team, narrowed to what it needs. */
259
- export interface GrantBearingTeam {
260
- name: string;
261
- manifest_grants?: string[];
262
- manifest?: {
263
- status: string;
264
- digest?: string;
265
- };
266
- }
267
- /**
268
- * 🔴 WHAT THE CONTROL PLANE PUT IN THE DIGEST THAT THE CONFIG DID NOT.
269
- *
270
- * `projectTeamRecord` grants a durable team's LEAD the built-in `delegate` when
271
- * the lane has more than one member. The grant is narrow and argued for at
272
- * length where it is made, and it was reported NOWHERE: `naive up` prints the
273
- * declared `can:`, and so do `/plan` and `/roster`, so the authority surface an
274
- * operator reviews before running `naive teams apply … --expected-digest …`
275
- * contained one capability more than anything on naive listed. A digest that
276
- * moves for a reason no surface names is the same silence the manifest report
277
- * itself exists to end, one field deeper.
278
- *
279
- * SAID PER TEAM AND ONLY WHEN THERE IS SOMETHING TO SAY. A one-member durable
280
- * team gets no grant and no line.
281
- */
282
- export declare function grantHints(t: GrantBearingTeam): string[];
283
- /** The shape `triggerHints` reads — a printed team, narrowed to what it needs. */
284
- export interface TriggerBearingTeam {
285
- name: string;
286
- triggers?: AppliedTrigger[];
287
- triggers_unscheduled?: string[];
288
- schedules_retained?: string[];
289
- }
290
- /**
291
- * One hint line per declared trigger, one per trigger this apply cancelled, and
292
- * ONE RETAINED LINE for standing schedules this config did not author.
293
- *
294
- * A sibling of {@link loopHints} rather than a branch inside it, printed
295
- * immediately after it, and the split is not cosmetic: a trigger has no ROLE.
296
- * `agent({ loop })` reserves every firing to the member that declared it and
297
- * every loop line says `team/role`; `team({ on })` fires UNRESERVED and the
298
- * board hands the card to whoever is next. A line that named a role would name
299
- * one that does not exist.
300
- *
301
- * 🔴 THE RETAINED LINE IS THE HALF THAT WOULD OTHERWISE BE INVISIBLE, and it is
302
- * the reason this function exists at all. `registerTeamTriggers` refuses to
303
- * cancel a schedule it cannot prove it wrote — the one destructive failure that
304
- * cannot be undone by re-running anything — and then says nothing about it. A
305
- * correct decision nobody is told about is the same defect one level up: the
306
- * operator still has a timer spending on a cadence no config declares, and now
307
- * also has no evidence it exists. The sentence is copied in shape from the
308
- * brains one this file already prints, down to "remove one deliberately", so an
309
- * operator meets one vocabulary for drift rather than two.
310
- *
311
- * 🔴 AND WHERE A FIRING WILL NOT SHOW UP, said once per team that declares any.
312
- * A durable schedule's firing reaches NEITHER existing observability surface:
313
- * `GET /v1/triggers/ledger` reads the `events` table, whose sources are
314
- * `email|objective|cron|task|approval|company_channel` and which a durable alarm
315
- * never writes, and `routeEvent` writes `trigger_deliveries` over a disjoint
316
- * vocabulary it also never writes. The board is the only place the work appears.
317
- * Naming that here is the cheap mitigation; reconciling the two ledgers is its
318
- * own piece of work.
319
- */
320
- export declare function triggerHints(t: TriggerBearingTeam): string[];
321
- /** What the plan reports per declared team, whichever runtime it asked for. */
322
- interface TeamPlanEntry {
323
- name: string;
324
- runtime: string;
325
- roles?: string[];
326
- lead_role?: string;
327
- /** Role → runtime, present only for a MIXED team. See `role_runtimes` on the API. */
328
- role_runtimes?: Record<string, string>;
329
- placement?: {
330
- status: string;
331
- code?: string;
332
- message?: string;
333
- };
334
- /** Keys this team declared that NOTHING on the control plane reads. */
335
- unconsumed?: string[];
336
- }
337
- /**
338
- * The per-team accept-and-drop warning, one line per team that declared any.
339
- *
340
- * The data has been on the wire the whole time (`plan.teams[].unconsumed`,
341
- * computed by `unconsumedTeamKeys` in packages/api) and `naive up` printed none
342
- * of it — `team({ governance: {…} })` applied green and enforced nothing, with
343
- * nothing anywhere for the author to notice. Printed on the PLAN and on the
344
- * APPLY, because a report only the dry run shows is a report most operators
345
- * never see.
346
- */
347
- export declare function unconsumedWarnings(teams: readonly TeamPlanEntry[]): string[];
348
- /**
349
- * ONE deprecation line when the config still uses the legacy ECS surface —
350
- * `runtime.pool()` declarations, an agent-level `runtime: "<pool>"` string, or
351
- * `systems:`. All three keep working indefinitely; the line names what was
352
- * found and where new configs should author instead.
353
- */
354
- export declare function legacyDeprecationNotice(config: Record<string, unknown>): string | null;
355
- /**
356
- * ONE rename line when the config declares `agents:`. Separate from the legacy
357
- * line above on purpose: `runtime.pool()` / `systems:` are a deprecated
358
- * SURFACE, while `agents:` is a deprecated SPELLING — the block compiles to
359
- * byte-for-byte what `kits:` compiles to, so the honest notice is "rename",
360
- * not "migrate". A notice, never a refusal, on both entrypoints.
361
- */
362
- export declare function agentsRenameNotice(config: Record<string, unknown>): string | null;
363
- /**
364
- * The operator credential the DURABLE RUNTIME issued, read from the ENVIRONMENT.
365
- *
366
- * Never from `naive.config.ts`, and that is the whole point rather than a style
367
- * choice. The config is committed, so a credential in it is a credential in git —
368
- * and, more importantly, the config is the one thing that must not by itself be
369
- * able to change where a tenant runs. Pointing a tenant at the durable runtime
370
- * overwrites its `sidecar_url` and `container_auth_token` and nulls its
371
- * `instance_id`, none of which is stashed anywhere. Requiring a second, separate
372
- * act means an edit alone can never do it.
373
- *
374
- * `NAIVE_DURABLE_CREDENTIAL_<TEAM>` names one team; `NAIVE_DURABLE_CREDENTIAL`
375
- * covers them all. Neither is ever printed, and the API never echoes it back.
376
- */
377
- export declare function durableCredentialEnvVar(team: string): string;
378
- /**
379
- * The recovery for ONE refused team — a command that EXISTS, or none.
380
- *
381
- * 🔴 `naive runtime migrate` IS NOT A COMMAND, AND THIS USED TO PRINT IT.
382
- * Every refusal here used to emit
383
- * `naive runtime migrate --tenant … --to durable --credential-from <file>`.
384
- * Measured on the built CLI: `naive runtime migrate --tenant <id> --to hermes`
385
- * answers
386
- * `{"code":"cli_outdated","message":"Unknown command 'runtime'. Your naive CLI
387
- * is v0.12.4; this command may exist in a newer version."}` — and it exists in
388
- * NO version: `packages/cli/src/index.ts` registers no `runtime` group at all.
389
- * So an operator whose apply was refused was handed a command that tells them to
390
- * upgrade, forever. A next_step that cannot be run is worse than none, because it
391
- * ends the search.
392
- *
393
- * The two cases are genuinely different and are answered differently:
394
- *
395
- * · `runtime_credential_required` — there IS a procedure, it works today, and
396
- * it is the one this command already implements: put the operator credential
397
- * the durable runtime issued in the environment and re-run. Never in
398
- * `naive.config.ts`, which is committed.
399
- * · everything else (`runtime_migration_requires_explicit_opt_in`,
400
- * `runtime_claim_in_flight`, `runtime_placement_lost_race`,
401
- * `runtime_not_configured`, `runtime_state_unknown`) — there is NO self-serve
402
- * command on this build. Moving an existing tenant between runtimes
403
- * overwrites `sidecar_url` and `container_auth_token` and nulls `instance_id`
404
- * with nothing stashed, so the control plane refuses it and no client can do
405
- * it either. Say that, and print the server's own message, rather than
406
- * inventing a command to carry the blame.
407
- *
408
- * The API writes the same vapour into `details.migrate_command`
409
- * (packages/api/src/services/placement.ts MIGRATE_COMMAND). That string is not
410
- * this package's to change and is reported as a follow-up; this function is why
411
- * `naive up` no longer repeats it.
412
- */
413
- export declare function refusalNextStep(t: {
414
- name: string;
415
- placement?: {
416
- code?: string;
417
- };
418
- }): NextStep | null;
419
- /**
420
- * The `manifest` half of one team's report line, from the API's own team row.
421
- *
422
- * A SIBLING OF `placement`, NEVER NESTED INSIDE IT. The API's comment on the
423
- * field this reads is explicit about why: "the tenant routes to the durable
424
- * runtime" and "the runtime enforces what the config declared" are different
425
- * facts, and a placed team with a refused manifest is exactly the state that
426
- * must not read as success. Nesting one inside the other would collapse a
427
- * distinction the API deliberately kept, and would make the refusal look like a
428
- * detail of a successful placement.
429
- *
430
- * Absent when the API reported nothing — a hermes team has no manifest at all,
431
- * and an older server does not send the field. An empty object rather than
432
- * `{ manifest: undefined }`, so the printed envelope has no key for a fact
433
- * nobody stated.
434
- */
435
- export declare function projectManifest(durable?: Pick<DurableTeamResult, "manifest">): {
436
- manifest?: {
437
- status: string;
438
- digest?: string;
439
- code?: string;
440
- error?: string;
441
- };
442
- };
443
- /** One line of `naive up`'s team report, as far as the manifest half cares. */
444
- interface TeamManifestLine {
445
- name: string;
446
- /** The team's OWN tenant subject. Not the caller's — see `manifestReport`. */
447
- subject?: {
448
- tenant_user_id?: string;
449
- };
450
- manifest?: {
451
- status: string;
452
- digest?: string;
453
- code?: string;
454
- error?: string;
455
- };
456
- }
457
- /**
458
- * WHAT `naive up` SAYS ABOUT MANIFEST DELIVERY, AND WHETHER IT MAY STILL EXIT 0.
459
- *
460
- * Extracted for the same reason `brainReport` is: the claim — "a refused
461
- * manifest is reported in the runtime's own words and the apply exits
462
- * non-zero" — is otherwise only assertable against a live API.
463
- *
464
- * Delivering the manifest is the step that turns a placed tenant into a working
465
- * one. Before this existed the CLI decoded the placement and dropped the
466
- * delivery, so a team that routed correctly and enforced NOTHING printed
467
- * exactly like one that worked: `placement: { status: "placed" }`, `applied:
468
- * true`, exit 0.
469
- *
470
- * 🔴 A `next_step` IS NOW OFFERED FOR `delivered_not_applied`, AND FOR NOTHING
471
- * ELSE. This block previously offered none at all, under this reasoning:
472
- *
473
- * The obvious candidate is `naive teams apply <team> --expected-digest
474
- * <digest>` and it is wrong TWICE on this build: `teamsCmd` registers no
475
- * `apply` subcommand, and the control plane routes `POST …/apply` through
476
- * `REFUSED_WRITES` to a 501.
477
- *
478
- * Both halves are now false, and the FIRST ONE WAS NEVER TRUE. `teams.ts`
479
- * declares no subcommands at all — it walks `lib/teams-catalog.ts` — and that
480
- * catalog has carried an `apply` row, with a REQUIRED `--expected-digest` that
481
- * defaults to nothing, since before this branch was written. Verified by
482
- * running the built CLI rather than by reading for it:
483
- *
484
- * $ naive teams --help
485
- * apply [options] <team> Record that an operator applied this exact
486
- * manifest digest. Refuses a stale one
487
- *
488
- * The second half is false as of this change: `POST …/apply` is a
489
- * `DURABLE_WRITES` row and reaches the runtime's own `apply` verb. So the
490
- * command exists, the route exists, and the digest is already in hand — which
491
- * is exactly the condition {@link refusalNextStep} sets for emitting one.
492
- *
493
- * `--tenant` IS SPELLED OUT, AND IT IS NOT OPTIONAL. `naive teams` requires it
494
- * on every subcommand and has NO default, deliberately: "a command that guesses
495
- * the tenant is a command that acts on the wrong tenant exactly once". A durable
496
- * team's subject is its OWN — `ensureTeamSubject` mints one per declared team —
497
- * so `--tenant @self` would address the operator's subject and bind a digest on
498
- * a tenant that is not this team. The apply response carries the right id on
499
- * `subject.tenant_user_id` and that is what is printed. If it is somehow absent
500
- * the next_step is WITHHELD rather than emitted with a placeholder, because a
501
- * command an operator has to guess a field in is the same dead end as a command
502
- * that 501s.
503
- *
504
- * STILL NO next_step FOR `refused` OR `unreachable`, and the distinction is the
505
- * point. `delivered_not_applied` means the record IS stored and only the bind
506
- * failed — a retryable act with a known digest. `refused` means the runtime
507
- * would not take the record at all, so there is nothing to apply and the fix is
508
- * in the config; `unreachable` means nothing was attempted. Offering an apply
509
- * for either would send an operator to run a command that cannot succeed.
510
- */
511
- export declare function manifestReport(teams: ReadonlyArray<TeamManifestLine>): {
512
- unbound: TeamManifestLine[];
513
- hints: string[];
514
- nextSteps: NextStep[];
515
- };
516
- /**
517
- * THE ONE PARAGRAPH SAID ABOUT UNBOUND MANIFESTS AS A GROUP, RATHER THAN PER
518
- * TEAM — and it is emitted only for the teams {@link manifestReport} could NOT
519
- * hand a repair command to.
520
- *
521
- * 🔴 IT USED TO CONTRADICT THE NEXT_STEP PRINTED THREE LINES ABOVE IT. Written
522
- * inline in the command's action closure by parity 0, it read:
523
- *
524
- * No `naive` command binds a manifest on this build: `naive teams`
525
- * registers no `apply` subcommand, and the control plane answers
526
- * `POST /v1/teams/.../apply` with 501.
527
- *
528
- * Both halves are false at HEAD and the first was never true — the full
529
- * accounting is in {@link manifestReport}'s own comment, which emits
530
- * `naive teams apply <team> --tenant … --expected-digest …` for
531
- * `delivered_not_applied`. That is the SAME status that put a team in
532
- * `unbound`, so an operator was handed a command and then told, one line later,
533
- * that no such command exists. It survived because it was a string inside a
534
- * 500-line closure that nothing imports and nothing could call.
535
- *
536
- * So it is a function now, for the reason `manifestReport` is one: a claim that
537
- * cannot be called cannot be tested, and this one was wrong for two commits.
538
- *
539
- * WHAT IT SAYS NOW is the fact that is actually true of the teams it fires for:
540
- * `naive teams apply` binds a digest the runtime has ALREADY STORED, so it can
541
- * repair `delivered_not_applied` and nothing else. `refused` means the record
542
- * was never taken; `unreachable` means it was never delivered. For both, the
543
- * runtime's own sentence is printed above and re-running `naive up` re-delivers.
544
- *
545
- * The condition is "an unbound team that got no next_step", not "any unbound
546
- * team": a team whose repair is printed does not need to be told there is none.
547
- */
548
- export declare function unbindableNote(report: Pick<ReturnType<typeof manifestReport>, "unbound" | "nextSteps">): string[];
549
- export declare const upCmd: Command;
550
- export declare const downCmd: Command;
551
- export {};