aui-agent-builder 0.4.0-alpha.0 → 0.4.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 (314) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +608 -114
  3. package/dist/api-client/apollo-client.d.ts +427 -0
  4. package/dist/api-client/apollo-client.d.ts.map +1 -0
  5. package/dist/api-client/apollo-client.js +347 -0
  6. package/dist/api-client/apollo-client.js.map +1 -0
  7. package/dist/api-client/index.d.ts +541 -21
  8. package/dist/api-client/index.d.ts.map +1 -1
  9. package/dist/api-client/index.js +956 -50
  10. package/dist/api-client/index.js.map +1 -1
  11. package/dist/api-client/kb-view-client.d.ts +94 -19
  12. package/dist/api-client/kb-view-client.d.ts.map +1 -1
  13. package/dist/api-client/kb-view-client.js +332 -35
  14. package/dist/api-client/kb-view-client.js.map +1 -1
  15. package/dist/api-client/rag-client.d.ts +28 -60
  16. package/dist/api-client/rag-client.d.ts.map +1 -1
  17. package/dist/api-client/rag-client.js +46 -42
  18. package/dist/api-client/rag-client.js.map +1 -1
  19. package/dist/commands/account.d.ts +11 -4
  20. package/dist/commands/account.d.ts.map +1 -1
  21. package/dist/commands/account.js +76 -59
  22. package/dist/commands/account.js.map +1 -1
  23. package/dist/commands/agents.d.ts +66 -2
  24. package/dist/commands/agents.d.ts.map +1 -1
  25. package/dist/commands/agents.js +706 -92
  26. package/dist/commands/agents.js.map +1 -1
  27. package/dist/commands/apollo.d.ts +185 -0
  28. package/dist/commands/apollo.d.ts.map +1 -0
  29. package/dist/commands/apollo.js +682 -0
  30. package/dist/commands/apollo.js.map +1 -0
  31. package/dist/commands/env.js +1 -1
  32. package/dist/commands/env.js.map +1 -1
  33. package/dist/commands/import-agent.d.ts +31 -0
  34. package/dist/commands/import-agent.d.ts.map +1 -1
  35. package/dist/commands/import-agent.js +1068 -283
  36. package/dist/commands/import-agent.js.map +1 -1
  37. package/dist/commands/index.d.ts +3 -3
  38. package/dist/commands/index.d.ts.map +1 -1
  39. package/dist/commands/index.js +3 -3
  40. package/dist/commands/index.js.map +1 -1
  41. package/dist/commands/init.d.ts.map +1 -1
  42. package/dist/commands/init.js +403 -94
  43. package/dist/commands/init.js.map +1 -1
  44. package/dist/commands/integration-mcp-test.d.ts +68 -0
  45. package/dist/commands/integration-mcp-test.d.ts.map +1 -0
  46. package/dist/commands/integration-mcp-test.js +885 -0
  47. package/dist/commands/integration-mcp-test.js.map +1 -0
  48. package/dist/commands/integration-mcp-url.d.ts +40 -0
  49. package/dist/commands/integration-mcp-url.d.ts.map +1 -0
  50. package/dist/commands/integration-mcp-url.js +162 -0
  51. package/dist/commands/integration-mcp-url.js.map +1 -0
  52. package/dist/commands/integration-test.d.ts +108 -0
  53. package/dist/commands/integration-test.d.ts.map +1 -0
  54. package/dist/commands/integration-test.js +251 -0
  55. package/dist/commands/integration-test.js.map +1 -0
  56. package/dist/commands/integration-toolkits.d.ts +35 -0
  57. package/dist/commands/integration-toolkits.d.ts.map +1 -0
  58. package/dist/commands/integration-toolkits.js +101 -0
  59. package/dist/commands/integration-toolkits.js.map +1 -0
  60. package/dist/commands/integration-tools.d.ts +34 -0
  61. package/dist/commands/integration-tools.d.ts.map +1 -0
  62. package/dist/commands/integration-tools.js +108 -0
  63. package/dist/commands/integration-tools.js.map +1 -0
  64. package/dist/commands/integration.d.ts +83 -9
  65. package/dist/commands/integration.d.ts.map +1 -1
  66. package/dist/commands/integration.js +700 -252
  67. package/dist/commands/integration.js.map +1 -1
  68. package/dist/commands/legacy/push-records-mode.d.ts +166 -0
  69. package/dist/commands/legacy/push-records-mode.d.ts.map +1 -0
  70. package/dist/commands/legacy/push-records-mode.js +2621 -0
  71. package/dist/commands/legacy/push-records-mode.js.map +1 -0
  72. package/dist/commands/login.d.ts.map +1 -1
  73. package/dist/commands/login.js +34 -5
  74. package/dist/commands/login.js.map +1 -1
  75. package/dist/commands/pull-agent.d.ts +10 -0
  76. package/dist/commands/pull-agent.d.ts.map +1 -1
  77. package/dist/commands/pull-agent.js +713 -178
  78. package/dist/commands/pull-agent.js.map +1 -1
  79. package/dist/commands/push.d.ts +91 -6
  80. package/dist/commands/push.d.ts.map +1 -1
  81. package/dist/commands/push.js +1514 -1144
  82. package/dist/commands/push.js.map +1 -1
  83. package/dist/commands/rag.d.ts +1 -0
  84. package/dist/commands/rag.d.ts.map +1 -1
  85. package/dist/commands/rag.js +92 -36
  86. package/dist/commands/rag.js.map +1 -1
  87. package/dist/commands/report.d.ts +138 -0
  88. package/dist/commands/report.d.ts.map +1 -0
  89. package/dist/commands/report.js +205 -0
  90. package/dist/commands/report.js.map +1 -0
  91. package/dist/commands/serve.d.ts.map +1 -1
  92. package/dist/commands/serve.js +1 -4
  93. package/dist/commands/serve.js.map +1 -1
  94. package/dist/commands/sync-session.d.ts +13 -0
  95. package/dist/commands/sync-session.d.ts.map +1 -0
  96. package/dist/commands/sync-session.js +56 -0
  97. package/dist/commands/sync-session.js.map +1 -0
  98. package/dist/commands/upgrade.d.ts.map +1 -1
  99. package/dist/commands/upgrade.js +1 -1
  100. package/dist/commands/upgrade.js.map +1 -1
  101. package/dist/commands/util/agent-mode.d.ts +69 -0
  102. package/dist/commands/util/agent-mode.d.ts.map +1 -0
  103. package/dist/commands/util/agent-mode.js +159 -0
  104. package/dist/commands/util/agent-mode.js.map +1 -0
  105. package/dist/commands/util/agent-resolve.d.ts +102 -0
  106. package/dist/commands/util/agent-resolve.d.ts.map +1 -0
  107. package/dist/commands/util/agent-resolve.js +148 -0
  108. package/dist/commands/util/agent-resolve.js.map +1 -0
  109. package/dist/commands/util/apollo-agent.d.ts +70 -0
  110. package/dist/commands/util/apollo-agent.d.ts.map +1 -0
  111. package/dist/commands/util/apollo-agent.js +100 -0
  112. package/dist/commands/util/apollo-agent.js.map +1 -0
  113. package/dist/commands/validate.d.ts +129 -9
  114. package/dist/commands/validate.d.ts.map +1 -1
  115. package/dist/commands/validate.js +666 -804
  116. package/dist/commands/validate.js.map +1 -1
  117. package/dist/commands/version-snapshot.d.ts +21 -0
  118. package/dist/commands/version-snapshot.d.ts.map +1 -0
  119. package/dist/commands/version-snapshot.js +948 -0
  120. package/dist/commands/version-snapshot.js.map +1 -0
  121. package/dist/commands/version.d.ts +15 -2
  122. package/dist/commands/version.d.ts.map +1 -1
  123. package/dist/commands/version.js +439 -206
  124. package/dist/commands/version.js.map +1 -1
  125. package/dist/config/index.d.ts +96 -5
  126. package/dist/config/index.d.ts.map +1 -1
  127. package/dist/config/index.js +97 -59
  128. package/dist/config/index.js.map +1 -1
  129. package/dist/errors/index.d.ts +1 -12
  130. package/dist/errors/index.d.ts.map +1 -1
  131. package/dist/errors/index.js +90 -8
  132. package/dist/errors/index.js.map +1 -1
  133. package/dist/index.d.ts +2 -1
  134. package/dist/index.d.ts.map +1 -1
  135. package/dist/index.js +1066 -174
  136. package/dist/index.js.map +1 -1
  137. package/dist/services/account.service.js +1 -1
  138. package/dist/services/account.service.js.map +1 -1
  139. package/dist/services/agents.service.d.ts.map +1 -1
  140. package/dist/services/agents.service.js +11 -5
  141. package/dist/services/agents.service.js.map +1 -1
  142. package/dist/services/auth.service.d.ts +78 -0
  143. package/dist/services/auth.service.d.ts.map +1 -1
  144. package/dist/services/auth.service.js +290 -16
  145. package/dist/services/auth.service.js.map +1 -1
  146. package/dist/services/integration.service.d.ts +374 -22
  147. package/dist/services/integration.service.d.ts.map +1 -1
  148. package/dist/services/integration.service.js +643 -95
  149. package/dist/services/integration.service.js.map +1 -1
  150. package/dist/services/kb-view.service.d.ts +17 -30
  151. package/dist/services/kb-view.service.d.ts.map +1 -1
  152. package/dist/services/kb-view.service.js +191 -118
  153. package/dist/services/kb-view.service.js.map +1 -1
  154. package/dist/services/list-agents.service.d.ts +10 -0
  155. package/dist/services/list-agents.service.d.ts.map +1 -1
  156. package/dist/services/list-agents.service.js +16 -21
  157. package/dist/services/list-agents.service.js.map +1 -1
  158. package/dist/services/pull-schema.service.d.ts +20 -1
  159. package/dist/services/pull-schema.service.d.ts.map +1 -1
  160. package/dist/services/pull-schema.service.js +313 -121
  161. package/dist/services/pull-schema.service.js.map +1 -1
  162. package/dist/services/rag.service.d.ts +21 -8
  163. package/dist/services/rag.service.d.ts.map +1 -1
  164. package/dist/services/rag.service.js +43 -16
  165. package/dist/services/rag.service.js.map +1 -1
  166. package/dist/services/status.service.d.ts +8 -0
  167. package/dist/services/status.service.d.ts.map +1 -1
  168. package/dist/services/status.service.js +16 -1
  169. package/dist/services/status.service.js.map +1 -1
  170. package/dist/services/sync-session.service.d.ts +38 -0
  171. package/dist/services/sync-session.service.d.ts.map +1 -0
  172. package/dist/services/sync-session.service.js +93 -0
  173. package/dist/services/sync-session.service.js.map +1 -0
  174. package/dist/telemetry.d.ts +169 -2
  175. package/dist/telemetry.d.ts.map +1 -1
  176. package/dist/telemetry.js +878 -4
  177. package/dist/telemetry.js.map +1 -1
  178. package/dist/types/entity.d.ts +21 -0
  179. package/dist/types/entity.d.ts.map +1 -1
  180. package/dist/ui/components/Banner.js +1 -1
  181. package/dist/ui/components/Banner.js.map +1 -1
  182. package/dist/ui/components/EnvironmentBadge.d.ts +8 -0
  183. package/dist/ui/components/EnvironmentBadge.d.ts.map +1 -0
  184. package/dist/ui/components/EnvironmentBadge.js +11 -0
  185. package/dist/ui/components/EnvironmentBadge.js.map +1 -0
  186. package/dist/ui/components/index.d.ts +1 -0
  187. package/dist/ui/components/index.d.ts.map +1 -1
  188. package/dist/ui/components/index.js +1 -0
  189. package/dist/ui/components/index.js.map +1 -1
  190. package/dist/ui/theme.d.ts +13 -0
  191. package/dist/ui/theme.d.ts.map +1 -1
  192. package/dist/ui/theme.js +12 -0
  193. package/dist/ui/theme.js.map +1 -1
  194. package/dist/ui/views/AccountView.js +1 -1
  195. package/dist/ui/views/AccountView.js.map +1 -1
  196. package/dist/ui/views/EnvView.d.ts.map +1 -1
  197. package/dist/ui/views/EnvView.js +2 -2
  198. package/dist/ui/views/EnvView.js.map +1 -1
  199. package/dist/ui/views/ImportAgentView.d.ts +15 -0
  200. package/dist/ui/views/ImportAgentView.d.ts.map +1 -1
  201. package/dist/ui/views/ImportAgentView.js +8 -3
  202. package/dist/ui/views/ImportAgentView.js.map +1 -1
  203. package/dist/ui/views/IntegrationView.d.ts +3 -1
  204. package/dist/ui/views/IntegrationView.d.ts.map +1 -1
  205. package/dist/ui/views/IntegrationView.js +2 -2
  206. package/dist/ui/views/IntegrationView.js.map +1 -1
  207. package/dist/ui/views/LoginView.d.ts +2 -1
  208. package/dist/ui/views/LoginView.d.ts.map +1 -1
  209. package/dist/ui/views/LoginView.js +20 -14
  210. package/dist/ui/views/LoginView.js.map +1 -1
  211. package/dist/ui/views/PushView.d.ts +3 -1
  212. package/dist/ui/views/PushView.d.ts.map +1 -1
  213. package/dist/ui/views/PushView.js +8 -2
  214. package/dist/ui/views/PushView.js.map +1 -1
  215. package/dist/ui/views/RagView.d.ts +6 -1
  216. package/dist/ui/views/RagView.d.ts.map +1 -1
  217. package/dist/ui/views/RagView.js +23 -0
  218. package/dist/ui/views/RagView.js.map +1 -1
  219. package/dist/ui/views/StatusView.js +4 -4
  220. package/dist/ui/views/StatusView.js.map +1 -1
  221. package/dist/ui/views/SyncSessionView.d.ts +7 -0
  222. package/dist/ui/views/SyncSessionView.d.ts.map +1 -0
  223. package/dist/ui/views/SyncSessionView.js +10 -0
  224. package/dist/ui/views/SyncSessionView.js.map +1 -0
  225. package/dist/utils/agent-injection.d.ts +49 -0
  226. package/dist/utils/agent-injection.d.ts.map +1 -0
  227. package/dist/utils/agent-injection.js +83 -0
  228. package/dist/utils/agent-injection.js.map +1 -0
  229. package/dist/utils/fetch-with-timeout.d.ts +57 -0
  230. package/dist/utils/fetch-with-timeout.d.ts.map +1 -0
  231. package/dist/utils/fetch-with-timeout.js +125 -0
  232. package/dist/utils/fetch-with-timeout.js.map +1 -0
  233. package/dist/utils/help-json.d.ts +44 -0
  234. package/dist/utils/help-json.d.ts.map +1 -0
  235. package/dist/utils/help-json.js +62 -0
  236. package/dist/utils/help-json.js.map +1 -0
  237. package/dist/utils/index.d.ts +82 -18
  238. package/dist/utils/index.d.ts.map +1 -1
  239. package/dist/utils/index.js +387 -80
  240. package/dist/utils/index.js.map +1 -1
  241. package/dist/utils/json-output.d.ts +10 -0
  242. package/dist/utils/json-output.d.ts.map +1 -1
  243. package/dist/utils/json-output.js +14 -0
  244. package/dist/utils/json-output.js.map +1 -1
  245. package/dist/utils/payload-store.d.ts +40 -0
  246. package/dist/utils/payload-store.d.ts.map +1 -0
  247. package/dist/utils/payload-store.js +82 -0
  248. package/dist/utils/payload-store.js.map +1 -0
  249. package/dist/utils/request-capture.d.ts +26 -0
  250. package/dist/utils/request-capture.d.ts.map +1 -1
  251. package/dist/utils/request-capture.js +67 -0
  252. package/dist/utils/request-capture.js.map +1 -1
  253. package/dist/utils/select-prompt.d.ts +32 -0
  254. package/dist/utils/select-prompt.d.ts.map +1 -0
  255. package/dist/utils/select-prompt.js +71 -0
  256. package/dist/utils/select-prompt.js.map +1 -0
  257. package/dist/utils/update-notifier.d.ts.map +1 -1
  258. package/dist/utils/update-notifier.js +30 -3
  259. package/dist/utils/update-notifier.js.map +1 -1
  260. package/dist/web/assets/{index-DSg2xrPw.js → index-n4de71HW.js} +1 -1
  261. package/dist/web/index.html +1 -1
  262. package/package.json +10 -6
  263. package/dist/commands/add-integration.d.ts +0 -20
  264. package/dist/commands/add-integration.d.ts.map +0 -1
  265. package/dist/commands/add-integration.js +0 -385
  266. package/dist/commands/add-integration.js.map +0 -1
  267. package/dist/commands/add-tool.d.ts +0 -17
  268. package/dist/commands/add-tool.d.ts.map +0 -1
  269. package/dist/commands/add-tool.js +0 -225
  270. package/dist/commands/add-tool.js.map +0 -1
  271. package/dist/commands/chat.d.ts +0 -20
  272. package/dist/commands/chat.d.ts.map +0 -1
  273. package/dist/commands/chat.js +0 -545
  274. package/dist/commands/chat.js.map +0 -1
  275. package/dist/commands/create-agent.d.ts +0 -17
  276. package/dist/commands/create-agent.d.ts.map +0 -1
  277. package/dist/commands/create-agent.js +0 -18
  278. package/dist/commands/create-agent.js.map +0 -1
  279. package/dist/commands/lsp.d.ts +0 -13
  280. package/dist/commands/lsp.d.ts.map +0 -1
  281. package/dist/commands/lsp.js +0 -17
  282. package/dist/commands/lsp.js.map +0 -1
  283. package/dist/commands/widget.d.ts +0 -18
  284. package/dist/commands/widget.d.ts.map +0 -1
  285. package/dist/commands/widget.js +0 -153
  286. package/dist/commands/widget.js.map +0 -1
  287. package/dist/lsp/cross-refs.d.ts +0 -53
  288. package/dist/lsp/cross-refs.d.ts.map +0 -1
  289. package/dist/lsp/cross-refs.js +0 -330
  290. package/dist/lsp/cross-refs.js.map +0 -1
  291. package/dist/lsp/cross-refs.test.d.ts +0 -2
  292. package/dist/lsp/cross-refs.test.d.ts.map +0 -1
  293. package/dist/lsp/cross-refs.test.js +0 -130
  294. package/dist/lsp/cross-refs.test.js.map +0 -1
  295. package/dist/lsp/schemas.d.ts +0 -57
  296. package/dist/lsp/schemas.d.ts.map +0 -1
  297. package/dist/lsp/schemas.js +0 -126
  298. package/dist/lsp/schemas.js.map +0 -1
  299. package/dist/lsp/schemas.test.d.ts +0 -2
  300. package/dist/lsp/schemas.test.d.ts.map +0 -1
  301. package/dist/lsp/schemas.test.js +0 -74
  302. package/dist/lsp/schemas.test.js.map +0 -1
  303. package/dist/lsp/server.d.ts +0 -11
  304. package/dist/lsp/server.d.ts.map +0 -1
  305. package/dist/lsp/server.js +0 -205
  306. package/dist/lsp/server.js.map +0 -1
  307. package/dist/ui/views/ChatView.d.ts +0 -26
  308. package/dist/ui/views/ChatView.d.ts.map +0 -1
  309. package/dist/ui/views/ChatView.js +0 -96
  310. package/dist/ui/views/ChatView.js.map +0 -1
  311. package/dist/ui/views/__tests__/StatusView.test.d.ts +0 -2
  312. package/dist/ui/views/__tests__/StatusView.test.d.ts.map +0 -1
  313. package/dist/ui/views/__tests__/StatusView.test.js +0 -158
  314. package/dist/ui/views/__tests__/StatusView.test.js.map +0 -1
package/README.md CHANGED
@@ -132,25 +132,68 @@ draft ──→ published ──→ active
132
132
 
133
133
  ## Commands Reference
134
134
 
135
+ ### Discovering commands
136
+
137
+ ```bash
138
+ aui --help # Human-readable command overview
139
+ aui <command> --help # Options for any command (e.g. aui integration test --help)
140
+ aui --help --json # Full command tree as a JSON envelope (for tooling / coding agents)
141
+ aui <command> --help --json # JSON help scoped to a single command/subcommand
142
+ ```
143
+
144
+ `aui --help --json` emits `{ "success": true, "data": { name, version, command } }`,
145
+ where `command` recursively lists every subcommand with its `description`,
146
+ `arguments`, and `options` (each option carries `flags`, `description`,
147
+ `default`, and `takesRequiredValue` / `takesOptionalValue`).
148
+
135
149
  ### Authentication
136
150
 
137
151
  ```bash
138
- aui login # Open browser for authentication
139
- aui login --environment staging # Login to a specific environment
140
- aui login --token <jwt> # Login with a JWT token (for CI/CD)
141
- aui logout # Clear session and credentials
152
+ aui login # Open browser for authentication (defaults to the production environment)
153
+ aui login --email <email> # Login with email (OTP)
154
+ aui login --environment staging # Login to a specific environment (staging | custom | production | eu-production)
155
+ aui login --token <jwt> # Login with a JWT token (for CI/CD)
156
+ aui login --token <jwt> --refresh-token <jwt> # Token + refresh token (auto-renewal in automated pipelines)
157
+ aui login --account-id <id> # Skip account selection
158
+ aui login --api-key <key> # Store an Agent Settings API key for import/push
159
+ aui login --url <url> # Override the default login/playground URL
160
+ aui logout # Clear local session and credentials
142
161
  ```
143
162
 
144
163
  ### Agent Management
145
164
 
146
165
  ```bash
147
166
  aui agents # Interactive menu: list, create, switch, import, delete
148
- aui agents --list # List all agents in the current account
149
- aui agents --create # Interactive creation (org account name)
150
- aui agents --switch # Switch the active agent in your session
167
+ aui agents --list # List agents (scope: --account-id, else the project's .auirc account)
168
+ aui agents --create # Create, then auto-import into ./<agent-name> and drop you in
169
+ aui agents --create --template --category <id> # Create a clone-source template at category scope
170
+ aui agents --switch # Switch the SESSION's current agent + version (interactive picker)
171
+ aui agents --versions [agentId] # List versions for an agent (accepts an agent-management OR network id)
172
+ aui agents --use <agentId> # Select an agent directly by ID
151
173
  aui agents --delete # Interactive: org → account → agent → choose scope (whole / one version / all versions)
152
174
  ```
153
175
 
176
+ **`aui agents --create` is end-to-end.** It creates the agent + its first
177
+ version, **auto-imports the editable draft into a new `./<agent-name>` folder**
178
+ (use `--dir <path>` to override), and **drops you into that folder via an
179
+ interactive subshell** so you can start editing immediately — run `exit` to
180
+ return. The creation **mode follows your environment**: `staging` / `custom` →
181
+ bundle mode, `production` / `eu-production` → records mode. Override with
182
+ `--bundle-mode` / `--records-mode`.
183
+
184
+ In **bundle mode**, the Apollo endpoint provisions everything server-side
185
+ (network → agent → version → publish → activate) **and creates a draft for
186
+ editing**; the CLI imports **that draft** (resolved via `GET .../versions`),
187
+ not the published active version — you can only `aui push` into a draft. It
188
+ never creates a draft itself (falls back to the active version only if none is
189
+ found). In **records mode**, the create flow snapshots a v1.0 draft and imports
190
+ it. **Non-interactive creation is create-only:** `--json`, piped output, CI,
191
+ and the agent-builder-bff sandbox skip BOTH the auto-import and the subshell and
192
+ behave like a plain create (set `AUI_AUTO_IMPORT=1` to force the import in
193
+ automation; `AUI_AUTO_IMPORT=0` to disable it in a terminal). A child process
194
+ can't change the parent shell's cwd, which is why the interactive case opens a
195
+ nested shell.
196
+
154
197
  **Non-interactive creation:**
155
198
 
156
199
  ```bash
@@ -163,8 +206,12 @@ aui agents --create --name "My Agent" --account-id <id>
163
206
  # With a specific category (e.g. Amazon, Google Flights)
164
207
  aui agents --create --name "My Agent" --account-id <id> --category Amazon
165
208
 
166
- # Create + v1.0 draft (ready to import, edit, and push)
167
- aui agents --create --name "My Agent" --account-id <id> --draft
209
+ # Import the new agent into a specific folder instead of ./<agent-name>
210
+ aui agents --create --name "My Agent" --account-id <id> --dir ./my-agent
211
+
212
+ # Force a creation mode regardless of environment
213
+ aui agents --create --name "My Agent" --account-id <id> --records-mode
214
+ aui agents --create --name "My Agent" --account-id <id> --bundle-mode
168
215
 
169
216
  # One-step: create + version + publish + activate
170
217
  aui agents --create --name "My Agent" --account-id <id> --full
@@ -211,77 +258,135 @@ aui agents --delete --network-id <network-id> --yes --json
211
258
  ### Import & Pull
212
259
 
213
260
  ```bash
214
- aui import-agent # Interactive: select org → account → agent
215
- aui import-agent <agent-id> # Import by network ID
216
- aui import-agent --version <id> # Import a specific version
217
- aui import-agent --scope-level category # Import at category scope
218
- aui import-agent --dir ./my-folder # Output to a specific directory
219
- aui import-agent --skip-kb-files # Skip knowledge base file downloads
220
- aui import-agent --skills claude,cursor # Generate AI coding skills
221
- aui import-agent --no-skills # Skip skill generation
222
- aui import-agent --include-evaluate # Include test_questions schema
261
+ aui import-agent # Interactive: select org → account → agent
262
+ aui import-agent <agent-id> # Import by network ID
263
+ aui import-agent --version <id> # Import a specific version
264
+ aui import-agent --tag <vX.Y> # Pull a specific revision tag (e.g. v3.2)
265
+ aui import-agent --scope-level category # Import at category scope
266
+ aui import-agent --dir ./my-folder # Output to a specific directory
267
+ aui import-agent --templates # Pick from category-scoped template agents (kind=template)
268
+ aui import-agent --templates --category <id> # Restrict the template picker to one category
269
+ aui import-agent --with-kb-files # Also download original KB binaries (skipped by default)
270
+ aui import-agent --skip-kb-files # Skip the knowledge-base-files schema fetch
271
+ aui import-agent --skills claude,cursor,opencode # Generate AI coding skills
272
+ aui import-agent --no-skills # Skip skill generation
273
+ aui import-agent --exclude-skills # Write .claude/.cursor/.opencode to the CWD instead of --dir
274
+ aui import-agent --skills-env <env> # Override env for Notion skill/doc pages
275
+ aui import-agent --include-evaluate # Include the evaluate (test_questions) schema
276
+ aui import-agent --reset-git # On re-import, wipe local git history and start a fresh baseline
277
+ aui import-agent --api-key <key> # Use a specific Agent Settings API key
223
278
  ```
224
279
 
280
+ > [!IMPORTANT]
281
+ > **`aui import-agent` defaults to the *active* version.** With no `--version` (or `--tag`), you silently get whatever is **live** in the backend — not the version you think you're editing. The version that's active can change out from under you (someone else activates a new one, a rollback happens, etc.).
282
+ >
283
+ > **Always pass `--version <id>` (or `--tag <vX.Y>`) to pin exactly what you import**, and then **fingerprint-check the result** before you start editing — confirm you got the right version by spot-checking something cheap and deterministic, e.g. the parameter count, the number of tools/rules, or the version tag printed in the import summary. If the fingerprint doesn't match what you expect, you imported the wrong version — re-import with the correct `--version`.
284
+
225
285
  ```bash
226
- aui pull # Pull latest into existing project
286
+ aui pull # Pull latest into existing project (defaults to the active version)
227
287
  aui pull --force # Skip overwrite confirmation
288
+ aui pull --version <id> # Pull a specific agent version by ID
289
+ aui pull --tag <vX.Y> # Pull a specific revision tag (e.g. v3.2)
228
290
  aui pull --scope-level <level> # Pull at a specific scope level
291
+ aui pull --with-kb-files # Also download original KB binaries
292
+ aui pull --skip-kb-files # Skip the knowledge-base-files schema fetch
293
+ aui pull --skills claude,cursor,opencode # Regenerate AI coding skills
294
+ aui pull --no-skills # Skip skill generation
295
+ aui pull --include-evaluate # Include the evaluate (test_questions) schema
296
+ aui pull --api-key <key> # Use a specific Agent Settings API key
229
297
  ```
230
298
 
231
299
  ### Push
232
300
 
301
+ Push is only allowed to draft versions. If no draft exists, the CLI will reject the push and guide you to create one first.
302
+
233
303
  ```bash
234
- aui push # Push changes (auto-creates version draft)
304
+ aui push # Push changes into the current draft version
235
305
  aui push --dry-run # Preview without pushing
236
306
  aui push --scope-level category # Push at a specific scope level
237
- aui push --version-id <id> # Push into a specific draft
238
- aui push --force # Push even with validation errors
239
- aui push --skip-validation # Skip validation step
240
- aui push --api-key <key> # Use a specific API key
307
+ aui push --agent-id <id> # Override agent target (agent_management_id or network_id; defaults to .auirc)
308
+ aui push --version-id <id> # Push into a specific draft (must be a draft)
309
+ aui push --commit-message "<msg>" # Save note attached to the new revision (≤ 4000 chars)
310
+ aui push --caller <agent_builder|ui|cli> # Multipart "caller" field for the /push endpoint (default: cli)
311
+ aui push --api-key <key> # Use a specific Agent Settings API key
312
+ aui push --force # Accepted for back-compat (no-op under the current endpoint)
313
+ aui push --skip-validation # Accepted for back-compat (no-op under the current endpoint)
241
314
  ```
242
315
 
316
+ If push fails partially, re-run `aui push` to retry the failed changes.
317
+
243
318
  ### Version Management
244
319
 
245
320
  ```bash
246
321
  aui version # Interactive version menu
247
322
  aui version list # List all versions
248
- aui version list --base-only # List base versions only (no revisions)
249
- aui version list --version-number 3 # List all revisions of v3
250
-
251
- # Create
252
- aui version create # Interactive
253
- aui version create --source agent-scope # Major version from live (v2.0)
254
- aui version create --source version --from <id> # Revision (v1.0 v1.1)
255
- aui version create --source version --from <id> --bump version_number # Major from clone
256
-
257
- # Lifecycle
258
- aui version publish # Interactiveselect draft to publish
259
- aui version publish <id> # Publish a specific draft
260
- aui version activate # Interactive select version to activate
261
- aui version activate <id> # Activate a specific version
262
- aui version archive <id> # Archive (cannot be re-activated)
323
+ aui version list --json # Machine-readable: full (untruncated) IDs + stats
324
+
325
+ # Create — single step, NO prompts (always bumps version number: v1, v2, v3, ...)
326
+ aui version create # Auto: picks source by agent mode
327
+ aui version create --source agent-scope # Override: new version from live scope
328
+ aui version create --source version --from <id> # Override: clone from a specific version
329
+ aui version create --source template --from-template <id> # Override: clone from a template agent's bundle
330
+ aui version create --agent-id <agent-management-id> # Target a specific agent explicitly
331
+ aui version create --label "Release 2" --tags "prod" --notes "..." # Optional metadata
332
+
333
+ # Lifecycle (no promptsresolve agent + version from .auirc, or pass them explicitly)
334
+ aui version publish # Publish the .auirc draft
335
+ aui version publish <id> # Publish a specific draft (overrides .auirc)
336
+ aui version activate # Activate the .auirc version as live
337
+ aui version activate <id> # Activate a specific version (overrides .auirc)
338
+ aui version archive <id> # Archive a published version (cannot be re-activated)
263
339
 
264
340
  # Metadata
265
341
  aui version get <id> # View full version details
266
342
  aui version update <id> --label "Release 2" --tags "prod,stable" --notes "Bug fixes"
267
343
  ```
268
344
 
345
+ > **Which agent does `aui version *` target?** Resolution order: `--agent-id`
346
+ > (explicit) → the project's `.auirc` (`agent_management_id`, then `agent_id`)
347
+ > → the active session's agent. Inside a project, the CLI resolves the
348
+ > **project's own** agent; if its `.auirc` ids don't resolve it now errors
349
+ > instead of silently falling back to your session's "current" agent. This is
350
+ > the same resolver `aui push` uses, so `version` and `push` always target the
351
+ > same agent.
352
+ >
353
+ > **`version create` is single-step and never prompts.** It inspects the
354
+ > agent's storage mode (the same `detectAgentBundleMode` switch `push` / `pull`
355
+ > / `import` use — honours `AUI_FORCE_AGENT_MODE`, defaults to records on older
356
+ > backends) and creates the draft directly:
357
+ >
358
+ > | Agent mode | Request body |
359
+ > |------------|--------------|
360
+ > | bundle (`bundle_mode=true`) | `source: "version"`, `from_version: <active version>` (override with `--from`) |
361
+ > | records (`bundle_mode=false` / missing) | `source: "agent-scope"` |
362
+ >
363
+ > `--source` / `--from` / `--from-template` / `--label` / `--tags` / `--notes`
364
+ > all override; with no flags it "just works" for the agent's mode. Because it
365
+ > never prompts, it's safe for Claude Code, CI, and `agent-builder-bff`
366
+ > sandboxes.
367
+ >
368
+ > **Non-interactive / automation for other `version` subcommands.** `list`,
369
+ > `get`, etc. run without prompts in `--json` mode or when stdin/stdout isn't a
370
+ > TTY. When several agents could match and none is selected, pass `--agent-id`
371
+ > rather than relying on the picker. For programmatic consumers, always read
372
+ > IDs and stats from `--json` — the human table abbreviates IDs to fit the
373
+ > terminal.
374
+
269
375
  ### Knowledge Bases & Documents
270
376
 
271
- ```bash
272
- # RAG management
273
- aui rag # Interactive KB menu
274
- aui rag --list # List all knowledge bases
275
- aui rag --export # Export KBs to knowledge-hubs/
276
- aui rag --import # Import KBs from knowledge-hubs/
377
+ All knowledge-base work goes through `aui rag`. The bare command opens an
378
+ interactive menu (list KBs, upload files, upload URLs, export, import); the
379
+ flags jump straight to a specific action.
277
380
 
278
- # Document upload
279
- aui document report.pdf data.csv --kb "Policies" # Upload files
280
- aui document --url "https://docs.example.com" --kb "Docs" # Scrape URLs
281
- aui document status # Recent upload status
282
- aui document status --hours 24 --kb "Policies" # Filtered status
381
+ ```bash
382
+ aui rag # Interactive menu: list, upload files, upload URLs, export, import
383
+ aui rag --add-file # Jump straight to the upload flow (files or URLs)
384
+ aui rag --status # Per-resource indexing status (completed / failed / in-progress) for each KB
283
385
  ```
284
386
 
387
+ > The standalone `aui document …` command has been folded into `aui rag` —
388
+ > uploads and indexing status now live under the single `rag` command.
389
+
285
390
  ### Development Tools
286
391
 
287
392
  ```bash
@@ -298,27 +403,54 @@ aui revert # Discard local changes
298
403
 
299
404
  ```bash
300
405
  aui integration # Interactive menu — Create or Discover
301
- aui integration create # Guided flow — org, account, agent, Manual or Native MCP
406
+ aui integration create # Guided flow — org, account, agent, Manual or Native MCP (add --full for non-interactive)
302
407
  aui integration discover # Guided MCP tool discovery
408
+ aui integration toolkits # List native (Composio) toolkits (non-interactive, --json)
409
+ aui integration tools --slugs ... # Fetch Composio tool descriptors by slug (non-interactive, --json)
410
+ aui integration mcp-url --toolkit <slug> # Provision (or reuse) a Composio MCP server → { server_id, server_url }
411
+ aui integration test --params ... # Live-call an HTTP endpoint, return raw + parsed response (always JSON)
412
+ aui integration mcp-test ... # Execute an MCP tool directly (Composio or Direct) and return the raw response (always JSON)
303
413
  ```
304
414
 
305
- **Non-interactive — Manual MCP:**
415
+ **Discovery (fully non-interactive, `--json`):**
306
416
 
307
417
  ```bash
308
- aui integration create --name "My MCP" --url <url> --all-tools
309
- aui integration create --name "My MCP" --url <url> --tools tool1,tool2
310
- aui integration create --name "My MCP" --url <url> --all-tools --auth-type token --auth-token <token>
418
+ aui integration toolkits --all --json # every native toolkit
419
+ aui integration toolkits --search notion --json # filter the directory
420
+ aui integration tools --slugs GMAIL_SEND_EMAIL,GMAIL_CREATE_EMAIL_DRAFT --json
421
+ aui integration discover --url <mcp-url> --json # tools from a manual MCP server
422
+ aui integration mcp-url --toolkit gmail --all-tools --json # provision/reuse a Composio MCP server
423
+ ```
424
+
425
+ **Non-interactive — Manual MCP** (add `--full` to skip every prompt):
426
+
427
+ ```bash
428
+ aui integration create --full --name "My MCP" --url <url> --all-tools
429
+ aui integration create --full --name "My MCP" --url <url> --tools tool1,tool2
430
+ aui integration create --full --name "My MCP" --url <url> --all-tools --auth-type token --auth-token <token>
311
431
  aui integration discover --url <url>
312
432
  aui integration discover --url <url> --auth-type token --auth-token <token>
433
+ aui integration discover --url <url> --auth-type api_key --auth-token <key> --auth-header-name X-API-Key
313
434
  ```
314
435
 
315
- **Non-interactive — Native MCP:**
436
+ **Non-interactive — Native MCP** (add `--full` to skip every prompt):
316
437
 
317
438
  ```bash
318
- aui integration create --toolkit notion --name "Notion" --all-tools
319
- aui integration create --toolkit github --name "GitHub" --tools GITHUB_CREATE_ISSUE,GITHUB_GET_ISSUE
439
+ aui integration create --full --toolkit notion --name "Notion" --all-tools
440
+ aui integration create --full --toolkit github --name "GitHub" --tools GITHUB_CREATE_ISSUE,GITHUB_GET_ISSUE
320
441
  ```
321
442
 
443
+ **MCP authentication (`--auth-type`).** Manual MCP, `discover`, and `mcp-test`
444
+ share the same canonical auth surface (the CLI alias `token` maps to
445
+ `bearer_token` before anything is sent to the wire):
446
+
447
+ | Auth type | Flags |
448
+ |-----------|-------|
449
+ | `none` | _(default)_ |
450
+ | `bearer_token` (alias `token`) | `--auth-type bearer_token --auth-token <tok>` |
451
+ | `api_key` | `--auth-type api_key --auth-token <key> --auth-header-name <Header>` |
452
+ | `oauth_client_credentials` | `--auth-type oauth_client_credentials --oauth-url <token-endpoint> --oauth-client-id <id> --oauth-client-secret <secret>` `[--oauth-method GET\|POST]` `[--oauth-grant-type <grant>]` |
453
+
322
454
  **Shared flags (both Manual & Native):**
323
455
 
324
456
  | Flag | Description |
@@ -330,28 +462,245 @@ aui integration create --toolkit github --name "GitHub" --tools GITHUB_CREATE_IS
330
462
  | `--config-method <manual\|native>` | Force config method |
331
463
  | `--json` | Machine-readable JSON output |
332
464
 
465
+ **Test an integration endpoint (`aui integration test`):**
466
+
467
+ Live-call an integration endpoint and get back the **raw** response
468
+ (`test_data`), what the `response_parser` extracts (`parsed_test_response`),
469
+ and — on the default path — `mapped_entities` (how the response maps onto
470
+ the agent's entities). The programmatic replacement for hand-running `curl`.
471
+ Always emits a JSON envelope and is fully non-interactive.
472
+
473
+ `--raw` vs. the default differ only in what is **sent**:
474
+
475
+ - **`--raw`** → calls the endpoint **without** `bundle_mapping` (plain
476
+ integration test; no `mapped_entities`).
477
+ - **default** → also sends `bundle_mapping` (`response_mapping` +
478
+ `parameters` + `scope_entities`), so the endpoint **also returns
479
+ `mapped_entities`**. This is the path the LLM uses while building an agent.
480
+
481
+ ```bash
482
+ # Default — full simulation incl. entity mapping
483
+ aui integration test --params '{
484
+ "url": "https://www.themealdb.com/api/json/v1/1/search.php",
485
+ "method": "GET",
486
+ "query_params": { "s": "pasta" },
487
+ "bundle_mapping": {
488
+ "response_mapping": { "entities": [ { "code": "Meal", "identifier": "meal-id", "paths": ["meals"], "mappings": [ { "key": "idMeal", "param": "meal-id" }, { "key": "strMeal", "param": "meal-name" } ] } ] },
489
+ "parameters": [ { "code": "meal-id", "type": "string" }, { "code": "meal-name", "type": "string" } ],
490
+ "scope_entities": [ { "name": "Meal", "identifier": "meal-id", "reference": "meal-name", "parameters": ["meal-id","meal-name"] } ]
491
+ }
492
+ }'
493
+
494
+ # Raw — no bundle_mapping / mapped_entities
495
+ aui integration test --raw --url https://www.themealdb.com/api/json/v1/1/search.php --query-params '{"s":"pasta"}'
496
+ ```
497
+
498
+ | Flag | Description |
499
+ |------|-------------|
500
+ | `--params <json>` | Full request body (see fields below) |
501
+ | `--params-file <path>` | Read the request body JSON from a file |
502
+ | `--url <url>` | Endpoint URL (overrides `params.url`) |
503
+ | `--method <method>` | HTTP method (default `GET`) |
504
+ | `--request-body <json>` | Request body JSON |
505
+ | `--query-params <json>` | Query params JSON |
506
+ | `--headers <json>` | Extra request headers JSON |
507
+ | `--auth-type <type>` | `BEARER_TOKEN`, `API_KEY`, `BASIC`, `NONE` |
508
+ | `--auth-token <token>` | Auth token used with `--auth-type` |
509
+ | `--response-parser <js>` | JS snippet run against `response` |
510
+ | `--bundle-mapping <json>` | Full `bundle_mapping` (`response_mapping`, `parameters`, `scope_entities`) |
511
+ | `--response-mapping <json>` | `bundle_mapping.response_mapping` (from `integrations.aui.json` → `settings.response_mapping`) |
512
+ | `--parameters <json>` | `bundle_mapping.parameters` (from `parameters.aui.json` → `parameters`) |
513
+ | `--scope-entities <json>` | `bundle_mapping.scope_entities` (from `entities.aui.json` → `entities`) |
514
+ | `--raw` | Plain call **without** `bundle_mapping` (no `mapped_entities`) |
515
+
516
+ > **`authentication` is a discriminated union** keyed on `type`
517
+ > (`BEARER_TOKEN`, `API_KEY`, `BASIC`, …). An empty `{}` or one without a
518
+ > `type` is treated as "no auth" and dropped automatically (it would
519
+ > otherwise 422), so you can paste an integration config verbatim.
520
+
521
+ Output: `{ "success": true, "data": { url, method, raw, bundle_mapping_sent, test_data, parsed_test_response, mapped_entities } }`.
522
+
523
+ **Execute an MCP tool (`aui integration mcp-test`):**
524
+
525
+ Live-execute a single MCP tool — either a Composio (native) tool or a tool on a
526
+ Direct (manual) MCP server — and get the raw tool response back. Like
527
+ `integration test`, it returns `mapped_entities` when a `bundle_mapping` is
528
+ sent. Always emits a JSON envelope; non-interactive when `--toolkit`+`--tool`
529
+ or `--url`+`--tool` are provided.
530
+
531
+ ```bash
532
+ # Composio — send an email
533
+ aui integration mcp-test --type composio --toolkit gmail --tool GMAIL_SEND_EMAIL \
534
+ --arguments '{"to":"user@example.com","subject":"Hi","body":"Test"}'
535
+
536
+ # Direct MCP server — bearer token (raw, no mapping)
537
+ aui integration mcp-test --type direct --url https://my-mcp.example.com/mcp \
538
+ --transport-type STREAMABLE_HTTP \
539
+ --auth-type bearer_token --auth-token <token> \
540
+ --tool <tool-name> --arguments '{}' --raw
541
+
542
+ # Direct MCP server — API key in a custom header
543
+ aui integration mcp-test --type direct --url https://my-mcp.example.com/mcp \
544
+ --auth-type api_key --auth-token <key> --auth-header-name X-API-Key \
545
+ --tool <tool-name> --arguments '{}' --raw
546
+ ```
547
+
548
+ Output: `{ "success": true, "data": { type, tool, raw, bundle_mapping_sent, response, mapping_data, status, elapsed_sec } }`.
549
+
550
+ **Provision a Composio MCP server (`aui integration mcp-url`):**
551
+
552
+ ```bash
553
+ aui integration mcp-url --toolkit gmail --all-tools --json # → { server_id, server_url }
554
+ aui integration mcp-url --toolkit notion --tools NOTION_CREATE_PAGE --server-id <existing-id> --json
555
+ ```
556
+
333
557
  ### Chat & Testing
334
558
 
335
559
  ```bash
336
- aui chat # Interactive conversation with agent
337
- aui chat --api-key <key> # Chat with a specific API key
338
- aui chat --rest # REST API only (no streaming)
339
560
  aui serve # Web chat playground (localhost:3141)
340
561
  aui serve --port 8080 # Custom port
341
562
  ```
342
563
 
564
+ ### Runtime Messaging — Apollo
565
+
566
+ Drive an agent at runtime through the Apollo messaging API. These four
567
+ commands are **fully non-interactive**, **output JSON by default** (pass
568
+ `--pretty` for the human view on all but `trace`), and work for **any
569
+ agent** (bundle-mode or records-mode). The target agent is resolved from
570
+ `--agent-id` or `.auirc.agent_management_id`, and authentication uses your
571
+ normal CLI session (`Authorization: Bearer` — the gateway forwards Apollo's
572
+ service auth for you).
573
+
574
+ ```bash
575
+ # Start a conversation thread (alias: create-task) — JSON output by default
576
+ aui apollo create-thread # uses .auirc agent + logged-in user
577
+ aui apollo create-thread --agent-id <id> --user-id <id> --task-origin-type web-widget
578
+ aui apollo create-thread --active # run against the agent's live version
579
+ aui apollo create-thread --pretty # human terminal view instead of JSON
580
+
581
+ # Send a message. It validates + forwards your local .aui.json edits, so the
582
+ # reply reflects them; the returned `id` IS the interaction id.
583
+ aui apollo send-message --task-id <id> --text "Hello" # trace_info always included
584
+ # Seed caller-known session facts (pre-populates the task; not raw LLM input):
585
+ aui apollo send-message --task-id <id> --text "show my orders" \
586
+ --agent-context '{"agent_variables":{"user_id":"u_123","locale":"en-US"},"context":{"url":"https://example.com"}}'
587
+
588
+ # Regenerate a thread from an interaction and replay a message (bundle + trace always sent)
589
+ aui apollo rerun --task-id <id> --interaction-id <iid> --text "Edited"
590
+ aui apollo rerun --task-id <id> --interaction-id <iid> --text "Edited" --version-id <vid>
591
+ aui apollo rerun --task-id <id> --interaction-id <iid> --text "Edited" --active # vs the live version
592
+
593
+ # Inspect the agent's reasoning (trace) — always JSON
594
+ aui apollo trace --task-id <id> # all interaction traces
595
+ aui apollo trace --task-id <id> --interaction-id <iid> # a single interaction's trace
596
+ ```
597
+
598
+ **Flags by command**
599
+
600
+ | Command | Required | Optional |
601
+ |---|---|---|
602
+ | `create-thread` (alias `create-task`) | — | `--agent-id`, `--user-id`, `--task-origin-type`, `--version-id`, `--version-tag`, `--active`, `--pretty` |
603
+ | `send-message` | `--task-id`, `--text` | `--agent-id`, `--agent-context`, `--path`, `--pretty` |
604
+ | `rerun` | `--task-id`, `--interaction-id`, `--text` | `--version-id`, `--version-tag`, `--active`, `--agent-id`, `--path`, `--pretty` |
605
+ | `trace` | `--task-id` | `--interaction-id`, `--agent-id` (always JSON) |
606
+
607
+ > **JSON by default:** `create-thread`, `send-message`, and `rerun` emit the
608
+ > JSON envelope by default; pass `--pretty` for the human Ink view. `trace` is
609
+ > always JSON.
610
+
611
+ > **`--active` (create-thread, rerun):** run against the agent's currently
612
+ > active (live) version instead of the local draft / passed version. Resolves
613
+ > the agent's `active_version_id` from agent-management. Mutually exclusive with
614
+ > `--version-id` / `--version-tag`.
615
+
616
+ > **`--agent-context` (send-message):** a JSON object
617
+ > `{"agent_variables":{…},"context":{…}}` of caller-known session facts.
618
+ > `agent_variables` are consumed by the runtime as the agent's `agent_context`
619
+ > config to pre-populate the task (not sent to the LLM as raw text); `context`
620
+ > is optional extra per-message fields (`url`, `welcome_message`, …).
621
+
622
+ > **Bundle always sent:** both `send-message` and `rerun` validate + forward
623
+ > your local agent files (so the reply reflects your edits). Run these inside an
624
+ > imported agent folder (or pass `--path <dir>`).
625
+
626
+ > **Interaction IDs:** the `id` returned by `aui apollo send-message` is the
627
+ > interaction id — pass it to `rerun --interaction-id` and `trace
628
+ > --interaction-id`.
629
+
630
+ > **Validate-before-send:** by default `send-message` / `rerun` run the remote
631
+ > validator on your local files first and abort if they're invalid — a broken
632
+ > config never reaches the runtime. Run `aui validate` to see specific errors.
633
+
343
634
  ### Configuration & Utilities
344
635
 
345
636
  ```bash
346
637
  aui account # Manage accounts (list, create, switch)
347
638
  aui env # Show current environment
348
- aui env staging # Switch environment
639
+ aui env staging # Switch environment (staging | custom | production | eu-production)
349
640
  aui pull-schema # Fetch domain schemas from backend
350
- aui add-integration # Add API / RAG / MCP integration (legacy)
641
+ aui pull-schema --improved # Apply coding-agent-friendly schema improvements
642
+ aui sync-session # Re-scope your session (org/account/token) to this project's .auirc
351
643
  aui integration create # Create MCP integration (Manual or Native)
352
- aui upgrade # Update to latest version
644
+ aui curl # Show the last command's HTTP requests as curl commands
645
+ aui report "<message>" # BETA: report a CLI/agent issue or learning
646
+ aui upgrade # Update to the latest version
647
+ ```
648
+
649
+ ### Session Sync
650
+
651
+ `aui login` issues a token scoped to your **default** organization. If you
652
+ import an agent that lives in a different org, `push` / `pull` / `apollo` calls
653
+ return `403` or `404 ("Agent not found")` until the session is re-scoped.
654
+ `aui sync-session` reconciles your local session (`~/.aui/session.json`) with
655
+ this project's `.auirc` — organization, account, and the token's org claim — so
656
+ every command targets the right org.
657
+
658
+ ```bash
659
+ aui sync-session # Reconcile the session with the nearest .auirc
660
+ aui sync-session --path ./my-agent # Point at a specific project directory
661
+ aui sync-session --json # Machine-readable (for scripts / the BFF)
662
+ aui update-session # Alias for sync-session
353
663
  ```
354
664
 
665
+ > **Behavior:** no-op (zero network) when already in sync. Cross-org → mints and
666
+ > persists an org-scoped token. Cross-env (the `.auirc` env differs from the
667
+ > session env) → a token can't be re-scoped across environments, so it switches
668
+ > the env and exits non-zero asking you to `aui login` on that env. Fully
669
+ > non-interactive — safe to run from `agent-builder-bff` in the sandbox.
670
+
671
+ ### Inspecting HTTP requests — `aui curl`
672
+
673
+ Every command's HTTP calls are captured and can be replayed as `curl`
674
+ commands for debugging.
675
+
676
+ ```bash
677
+ aui curl # All requests from the last command
678
+ aui curl --failed # Only failed requests
679
+ aui curl --last <n> # Only the last N requests
680
+ aui curl --method PATCH # Filter by HTTP method
681
+ aui curl --search <term> # Filter by URL or label substring
682
+ ```
683
+
684
+ ### Reporting issues — `aui report` (BETA)
685
+
686
+ Report a CLI or agent issue, a learning, or a suggestion. Coding agents are
687
+ expected to use this to surface problems they hit.
688
+
689
+ ```bash
690
+ aui report "Push failed with a confusing 422" # type defaults to "issue"
691
+ aui report -t learning -m "PATCH is idempotent on retry"
692
+ aui report --dry-run "..." # Print the payload without sending
693
+ ```
694
+
695
+ | Flag | Description |
696
+ |------|-------------|
697
+ | `-t, --type <type>` | `issue` (default), `learning`, or `suggestion` |
698
+ | `-m, --message <msg>` | Report message (alternative to the positional argument) |
699
+ | `--agent <name>` | Override the detected coding agent (`claude` / `cursor` / `opencode`) |
700
+ | `--context <json>` | Extra context — raw text or a JSON string |
701
+ | `--dry-run` | Print the payload without sending it |
702
+ | `--task-id` / `--session-id` / `--interaction-id <id>` | Associate the report with a task / session / interaction |
703
+
355
704
  ### Command Aliases
356
705
 
357
706
  | Alias | Equivalent |
@@ -362,6 +711,9 @@ aui upgrade # Update to latest version
362
711
  | `aui ls` | `aui list-agents` |
363
712
  | `aui versions` | `aui version` |
364
713
  | `aui integrations` | `aui integration` |
714
+ | `aui update-session` | `aui sync-session` |
715
+ | `aui apollo create-task` | `aui apollo create-thread` |
716
+ | `aui version snapshots` | `aui version snapshot` |
365
717
 
366
718
  ---
367
719
 
@@ -370,34 +722,33 @@ aui upgrade # Update to latest version
370
722
  ### Create and Deploy a New Agent
371
723
 
372
724
  ```bash
373
- # Step 1: Create the agent (with a v1.0 draft ready to edit)
374
- aui agents --create --name "Support Agent" --account-id <id> --draft
375
-
376
- # Step 2: Import as local files
377
- aui import-agent
725
+ # Step 1: Create the agent. This also auto-imports it into ./support-agent
726
+ # and drops you into that folder via an interactive subshell — no separate
727
+ # `aui import-agent` needed. (Use --dir to choose a different folder.)
728
+ aui agents --create --name "Support Agent" --account-id <id>
378
729
 
379
- # Step 3: Edit configuration in your editor
380
- cd ./support-agent
730
+ # Step 2: Edit configuration in your editor (you're already in the folder)
381
731
  # → Edit agent.aui.json, tools/*.aui.json, parameters.aui.json, etc.
382
732
 
383
- # Step 4: Validate and push
733
+ # Step 3: Validate and push
384
734
  aui validate
385
735
  aui push
386
736
 
387
- # Step 5: Publish and activate
737
+ # Step 4: Publish and activate
388
738
  aui version publish
389
739
  aui version activate
390
740
  ```
391
741
 
392
- **Three creation modes:**
742
+ > Prefer the classic two-step flow? It still works: create with `--json`
743
+ > (which skips the auto-import/subshell), then run `aui import-agent` yourself.
744
+
745
+ **Creation modes:**
393
746
 
394
747
  ```bash
395
- # Agent only (no version) create version manually later
748
+ # Default creates the agent + a v1.0 draft version (ready to import & edit).
749
+ # A draft is always created; there is no flag to skip it.
396
750
  aui agents --create --name "Support Agent" --account-id <id>
397
751
 
398
- # Agent + v1.0 draft — ready to import, edit, and push
399
- aui agents --create --name "Support Agent" --account-id <id> --draft
400
-
401
752
  # Agent + v1.0 + publish + activate — fully deployed in one step (CI/CD)
402
753
  aui agents --create --name "Support Agent" --account-id <id> --full
403
754
  ```
@@ -405,15 +756,24 @@ aui agents --create --name "Support Agent" --account-id <id> --full
405
756
  ### Edit → Push → Deploy Cycle
406
757
 
407
758
  ```bash
408
- aui import-agent # Downloads active version as .aui.json files
759
+ # 1. Create a draft version first
760
+ aui version create # Creates draft v2
761
+
762
+ # 2. Import the draft as local files
763
+ aui import-agent --version <draft-id>
409
764
  cd ./my-agent
410
765
 
411
- # Make changes to any .aui.json file...
766
+ # 3. Make changes to any .aui.json file...
412
767
 
768
+ # 4. Validate and push
413
769
  aui diff # See what changed
414
770
  aui validate # Validate against schemas
415
- aui push # Push changes into a new draft
771
+ aui push # Push changes into the draft
772
+
773
+ # 5. If push fails partially, re-run to retry
774
+ aui push # Retries only failed changes
416
775
 
776
+ # 6. Publish and go live
417
777
  aui version publish # Lock the draft
418
778
  aui version activate # Make it live
419
779
  ```
@@ -421,10 +781,10 @@ aui version activate # Make it live
421
781
  ### Version Branching
422
782
 
423
783
  ```bash
424
- # Create a revision from v1.0 (→ v1.1)
425
- aui version create --source version --from <v1.0-id>
784
+ # Clone from an existing version (→ v3)
785
+ aui version create --source version --from <v2-id>
426
786
 
427
- # Or create a new major version from live scope (→ v2.0)
787
+ # New version from live scope (→ v3)
428
788
  aui version create --source agent-scope
429
789
 
430
790
  # Import a specific version for editing
@@ -475,9 +835,8 @@ my-agent/
475
835
 
476
836
  ├── GUIDE.md # Getting started guide
477
837
  ├── AGENTS.md # Agent documentation
478
- ├── BEST_PRACTICES.md # Configuration best practices
479
838
 
480
- ├── .cursor/rules/ # Cursor AI rules per config type
839
+ ├── .cursor/skills/ # Cursor skills per config type
481
840
  ├── .claude/skills/ # Claude Code skills per config type
482
841
  └── .opencode/skills/ # OpenCode skills per config type
483
842
  ```
@@ -581,54 +940,89 @@ Card templates with JSX and field mappings:
581
940
 
582
941
  ### How Versioning Works
583
942
 
584
- 1. **Import** downloads the active version's configuration as local files
585
- 2. **Push** auto-creates a draft version and pushes changes into it
586
- 3. **Publish** locks the draft permanently
587
- 4. **Activate** makes the published version the live configuration
943
+ Pushing is only allowed to **draft versions**. The CLI will never auto-create drafts during push — you must create one explicitly first.
944
+
945
+ 1. **Create a draft version** using `aui version create`
946
+ 2. **Import** the draft to get local files: `aui import-agent --version <draft-id>`
947
+ 3. **Edit** the local `.aui.json` files
948
+ 4. **Push** changes into the draft (the CLI validates the target is a draft)
949
+ 5. **Publish** to lock the draft permanently
950
+ 6. **Activate** to make it the live configuration
588
951
 
589
952
  ```bash
590
- aui import-agent # Get active version (e.g. v1.0)
953
+ aui version create # Create draft v2 (always bumps version number)
954
+ aui import-agent --version <draft-id> # Get the draft as local files
591
955
  # Edit files...
592
- aui push # Creates draft v1.1, pushes changes
593
- aui version publish # Locks v1.1
594
- aui version activate # v1.1 is now live
956
+ aui push # Pushes into the draft (rejects if not a draft)
957
+ aui version publish # Locks v2
958
+ aui version activate # v2 is now live
595
959
  ```
596
960
 
961
+ ### Push Flow (detailed)
962
+
963
+ When you run `aui push`, the following happens:
964
+
965
+ 1. **Draft validation** — The CLI checks that the target version is a draft. If the version in `.auirc` or `--version-id` is not a draft (e.g. published, archived), push is rejected with a descriptive error and next steps.
966
+
967
+ 2. **Entity push** (Step A) — The CLI pushes individual entity changes (parameters, tools, integrations, etc.) to the agent-settings API. Each task is tracked with success/failure, and the flow continues even when some entities fail.
968
+
969
+ 3. **Snapshot push** (Step B — last step) — After entity push completes, the CLI uploads the local file state as a snapshot to the server. This **always runs** regardless of entity-push outcomes, because **files are the source of truth** — the snapshot preserves your local state even if some DB updates failed. Version tag is bumped automatically on the server when the snapshot succeeds (e.g. `v3.2 → v3.3`).
970
+
971
+ 4. **Baseline update** — Local git baseline is committed only if the snapshot succeeded. Within that, only files whose entity-push succeeded are added to the baseline.
972
+
973
+ #### Why snapshot-last?
974
+
975
+ The snapshot is meant to reflect what's actually been applied to the agent. Putting it after the entity push means:
976
+
977
+ - **Snapshot ≈ DB state** — the IA/AI tooling can rely on the snapshot files as the source of truth without ever hitting the entity DB
978
+ - **Auto-bump represents real updates** — `v{N}.X` only increments when a push attempt actually completed
979
+ - **File-level rejections are caught locally** by `aui validate` (schema + cross-ref checks) before push, so server-side snapshot validation rarely fails
980
+ - **Partial DB failures are tolerable** — the snapshot still uploads, preserving file history. Re-running `aui push` retries the failed entities (PATCHes are idempotent)
981
+
982
+ #### Failure scenarios
983
+
984
+ | What failed | What happens | Next step |
985
+ |-------------|--------------|-----------|
986
+ | Entity push partial | Snapshot still uploads (captures file state). Baseline committed only for succeeded files. | Re-run `aui push` to retry failed entity updates. |
987
+ | Snapshot fails after entity push succeeded | Baseline is **not** updated. Entity changes already in DB. | Re-run `aui push`. Entities will re-PATCH (idempotent), then snapshot retries. |
988
+ | Both fail | Baseline unchanged. | Fix issues from error output, re-run `aui push`. |
989
+
990
+ If push partially fails, it's the user's responsibility to re-run `aui push` to retry. The CLI shows descriptive errors with "What to do next" guidance for every failure mode.
991
+
597
992
  ### Version Numbering
598
993
 
599
- - **Revisions** increment the minor number: v1.0 v1.1 v1.2
600
- - **Major versions** increment the major number: v1.x → v2.0
601
- - Use `--source version --from <id>` for revisions
602
- - Use `--source agent-scope` for new major versions
994
+ Versions use simple incrementing numbers: v1, v2, v3, etc. There are no revision/minor numbers.
995
+
996
+ - Use `--source version --from <id>` to clone from an existing version
997
+ - Use `--source agent-scope` for a new version from the current live scope
603
998
 
604
999
 
605
1000
  ---
606
1001
 
607
1002
  ## Knowledge Bases
608
1003
 
609
- ### Upload Documents
1004
+ Everything below runs through the single `aui rag` command — either via its
1005
+ interactive menu (`aui rag`) or the action flags.
610
1006
 
611
- ```bash
612
- # Upload files
613
- aui document report.pdf handbook.docx --kb "Company Policies"
1007
+ ### Upload Documents & URLs
614
1008
 
615
- # Scrape web pages
616
- aui document --url "https://docs.example.com/faq" --kb "FAQ"
1009
+ ```bash
1010
+ aui rag --add-file # Pick a KB, then upload local files or scrape web pages
1011
+ aui rag # Or use the menu → "Upload files…" / "Upload URLs…"
617
1012
  ```
618
1013
 
619
- ### Check Upload Status
1014
+ ### Check Indexing Status
620
1015
 
621
1016
  ```bash
622
- aui document status # Last 6 hours
623
- aui document status --hours 24 # Last 24 hours
624
- aui document status --kb "Company Policies" # Filter by KB
1017
+ aui rag --status # Per-resource status (completed / failed / in-progress) for each KB
625
1018
  ```
626
1019
 
627
- ### Export & Import
1020
+ ### List, Export & Import
628
1021
 
629
1022
  ```bash
630
- aui rag --export # Save all KB metadata and files to knowledge-hubs/
631
- aui rag --import # Restore KBs from knowledge-hubs/
1023
+ aui rag # Menu "List knowledge bases"
1024
+ aui rag # Menu "Export to knowledge-hubs/" (saves KB metadata + files locally)
1025
+ aui rag # Menu → "Import from knowledge-hubs/" (restores KBs from the local folder)
632
1026
  ```
633
1027
 
634
1028
  ---
@@ -669,13 +1063,21 @@ aui version activate
669
1063
  |----------|-------------|
670
1064
  | `AUI_AUTH_TOKEN` | Auth token (skip interactive login) |
671
1065
  | `AUI_API_URL` | Override API base URL |
672
- | `AUI_ENVIRONMENT` | `staging`, `custom`, or `production` |
1066
+ | `AUI_ENVIRONMENT` | `staging`, `custom`, `production`, or `eu-production` |
673
1067
  | `AUI_ACCOUNT_ID` | Account ID |
674
1068
  | `AUI_ORGANIZATION_ID` | Organization ID |
675
1069
  | `AUI_KBM_API_KEY` | RAG API key |
676
1070
  | `AUI_AGENT_TOOLS_API_KEY` | Agent Settings API key |
677
1071
  | `AUI_API_WORKFLOW_KEY` | API Workflow key |
1072
+ | `AUI_AGENT_CODE` | Override the agent code resolved from `.auirc` |
678
1073
  | `AUI_DEBUG` | Enable verbose debug logging (`AUI_DEBUG=1`) |
1074
+ | `AUI_AUTO_IMPORT` | Force (`1`) or disable (`0`) the auto-import + subshell after `aui agents --create` |
1075
+ | `AUI_FORCE_AGENT_MODE` | Force storage mode for push/pull/import/version (`bundle` or `records`) |
1076
+ | `AUI_FETCH_TIMEOUT_MS` | Per-request fetch timeout in ms (default 60000; `0` disables) |
1077
+ | `AUI_NO_UPDATE_CHECK` | Disable the background update-check / notification banner |
1078
+ | `AUI_DISABLE_TELEMETRY` / `AUI_TELEMETRY=0` | Opt out of OpenTelemetry tracing |
1079
+ | `AUI_NO_AGENT_INJECTION` | Suppress the "For Coding Agents" guidance block |
1080
+ | `AUI_HOME` | Override the config directory (default `~/.aui`) |
679
1081
 
680
1082
  ---
681
1083
 
@@ -715,6 +1117,7 @@ aui env # Show current
715
1117
  aui env staging # Switch to staging
716
1118
  aui env custom # Switch to custom (v3 endpoints)
717
1119
  aui env production # Switch to production
1120
+ aui env eu-production # Switch to EU production
718
1121
  aui login --environment staging # Set during login
719
1122
  ```
720
1123
 
@@ -738,6 +1141,10 @@ Debug mode logs every API request URL, response status, and body.
738
1141
  | `Not logged in` | Run `aui login` |
739
1142
  | `Missing network_category_id` | Re-import the agent: `aui import-agent` |
740
1143
  | `Version not found` | Run `aui version list` to see available versions |
1144
+ | `Version not found` (id looks truncated) | The human `version list` table abbreviates IDs. Scrape IDs from `aui version list --json` |
1145
+ | `Could not resolve the agent for this project (.auirc)` | Pass `aui version … --agent-id <agent-management-id>`, or re-run `aui import` / `aui pull` to refresh `.auirc` |
1146
+ | `version create` made a draft on the wrong agent | Fixed — `version` now targets the project's `.auirc` agent (or `--agent-id`), not the session's "current" agent |
1147
+ | `422` with no detail | The CLI now surfaces the API's validation detail in the error message. Re-run; for full bodies use `AUI_DEBUG=1` |
741
1148
  | `422 on push` | Check `aui validate --strict` for schema errors. Review `.aui/push-logs/` for API details |
742
1149
  | `No changes detected` | The push baseline matches your files. Make an edit and try again |
743
1150
  | Agent settings 401/403 | Provide an API key: `aui push --api-key <key>` |
@@ -787,13 +1194,100 @@ npm test # Run tests
787
1194
  ```bash
788
1195
  aui upgrade # Auto-detect npm or Homebrew
789
1196
  npm install -g aui-agent-builder # Manual npm
790
- brew upgrade aui # Manual Homebrew
1197
+ brew update ; brew upgrade aui-io/homebrew-tap/aui # Manual Homebrew
791
1198
  ```
792
1199
 
793
1200
  The CLI checks for updates every 24 hours and shows a notification banner when a new version is available.
794
1201
 
795
1202
  ---
796
1203
 
1204
+ ## Architecture & Developer Context
1205
+
1206
+ This section provides context for developers (and AI assistants) working on the CLI codebase.
1207
+
1208
+ ### Project Structure (source)
1209
+
1210
+ ```
1211
+ aui-agent-builder/
1212
+ ├── bin/aui.js # Executable shim → dist/index.js
1213
+ ├── src/
1214
+ │ ├── index.ts # CLI entry — Commander program, all command wiring
1215
+ │ ├── telemetry.ts # OpenTelemetry tracing (Logfire)
1216
+ │ ├── commands/ # One file per command
1217
+ │ │ ├── push.tsx # Push flow (snapshot → entity push → bump)
1218
+ │ │ ├── version.tsx # Version lifecycle (create, publish, activate, archive)
1219
+ │ │ ├── agents.tsx # Agent management (create, list, switch, import)
1220
+ │ │ ├── import-agent.tsx # Import agent as local .aui.json files
1221
+ │ │ ├── pull-agent.tsx # Pull latest from backend
1222
+ │ │ ├── login.tsx # Authentication flow
1223
+ │ │ └── ... # Other commands
1224
+ │ ├── api-client/
1225
+ │ │ ├── index.ts # AUIClient — all HTTP calls to backend
1226
+ │ │ ├── kb-view-client.ts # Knowledge base API client
1227
+ │ │ └── rag-client.ts # RAG API client
1228
+ │ ├── config/
1229
+ │ │ └── index.ts # Config resolution (env → .auirc → session → defaults)
1230
+ │ ├── errors/
1231
+ │ │ └── index.ts # Structured error types (AuthError, ConfigError, etc.)
1232
+ │ ├── services/ # Business logic services
1233
+ │ ├── types/ # TypeScript interfaces for local agent files
1234
+ │ ├── ui/ # Ink components and views
1235
+ │ │ ├── components/ # Reusable UI atoms (Spinner, StatusLine, etc.)
1236
+ │ │ ├── views/ # Command-specific views (PushView, etc.)
1237
+ │ │ └── theme.ts # Colors, icons, labels
1238
+ │ └── utils/ # Git, JSON output, schema improvements
1239
+ └── package.json
1240
+ ```
1241
+
1242
+ ### Key Patterns
1243
+
1244
+ - **Commander** for CLI argument parsing, **Ink + React** for terminal UI
1245
+ - **AUIClient** in `api-client/index.ts` is the single HTTP layer; all API calls go through it
1246
+ - Two API surfaces: **Agent Management** (versions lifecycle) and **Agent Settings** (entity CRUD for push)
1247
+ - **Config resolution**: `getConfig()` merges env vars → `.auirc` → `~/.aui/session.json` → defaults
1248
+ - **Git baseline**: Push uses an internal git repo to track diffs between pushes
1249
+
1250
+ ### Push Flow (current implementation)
1251
+
1252
+ 1. Validate auth and project config
1253
+ 2. Read local `.aui.json` files
1254
+ 3. Git diff to detect changes since last push
1255
+ 4. **Draft validation**: Verify the target version is a draft (reject otherwise)
1256
+ 5. **Entity push**: PATCH/POST/DELETE individual entities (parameters, tools, integrations, rules, etc.) — track per-task success, continue on failures
1257
+ 6. **Snapshot push** (last step): Multipart POST of all local files to `/v1/agents/{agentId}/versions/{versionId}/snapshot`
1258
+ - Uses JWT auth (Bearer token)
1259
+ - Runs regardless of entity-push outcomes (files = source of truth, DB = best effort)
1260
+ - Version tag is bumped automatically on snapshot success (no separate bump endpoint)
1261
+ - Snapshot tags follow the pattern `v{N}.0`, `v{N}.1`, `v{N}.2`, ... where `N` is the version number; the first push to a version creates `.0`
1262
+ - Implemented in: `pushSnapshot()` in `src/commands/push.tsx` + `client.agentManagement.pushSnapshot()` in `src/api-client/index.ts`
1263
+ 7. **Baseline update**: Git baseline is committed only when the snapshot succeeded. Within that, only files whose entity-push succeeded are added.
1264
+
1265
+ ### Snapshot Endpoints
1266
+
1267
+ - **POST** `/v1/agents/{agentId}/versions/{versionId}/snapshot` — Upload local files as multipart form data. Version tag bumps automatically on success.
1268
+ - **GET** `/v1/agents/{agentId}/versions/{versionId}/snapshot?version_tag=v1.0&expires_in=15` — Retrieve a specific snapshot's manifest + signed download URLs (15-minute expiry).
1269
+
1270
+ ### Snapshot Browsing (CLI)
1271
+
1272
+ | Command | Purpose |
1273
+ |---------|---------|
1274
+ | `aui version snapshot` | Interactive menu (list / get / diff) |
1275
+ | `aui version snapshot list` | List all snapshots for the current version |
1276
+ | `aui version snapshot get <tag>` | Show snapshot manifest + signed URLs |
1277
+ | `aui version snapshot diff <a> <b>` | File-level diff (SHA-256 + size) |
1278
+ | `aui version snapshot diff <a> <b> --full` | Field-level JSON diff (downloads files) |
1279
+
1280
+ All snapshot commands support `--agent-id`, `--version-id`, and `--json` for scripting.
1281
+
1282
+ ### Version Numbering
1283
+
1284
+ Versions use simple incrementing numbers (v1, v2, v3). No revision/minor numbers.
1285
+ The `bump_mode` parameter in `CreateDraftRequest` is always set to `"version_number"`.
1286
+
1287
+ ---
1288
+
797
1289
  ## License
798
1290
 
799
- Proprietary Copyright (c) 2026 AUI. All rights reserved. See [LICENSE](./LICENSE).
1291
+ © Augmented intelligence (AUI) Inc. All rights reserved. Use is subject to the
1292
+ Terms outlined here:
1293
+ [https://www.aui.io/api-and-developer-package-terms-of-service/](https://www.aui.io/api-and-developer-package-terms-of-service/).