auramaxx 0.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 (418) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +77 -0
  3. package/apps/desktop-electron/main.js +428 -0
  4. package/bin/auramaxx.js +1063 -0
  5. package/docs/ADAPTERS.md +466 -0
  6. package/docs/AGENT_SETUP.md +159 -0
  7. package/docs/API.md +127 -0
  8. package/docs/APPS.md +199 -0
  9. package/docs/ARCHITECTURE.md +235 -0
  10. package/docs/AUTH.md +318 -0
  11. package/docs/BEST-PRACTICES.md +82 -0
  12. package/docs/CLI.md +141 -0
  13. package/docs/DESKTOP_ELECTRON.md +26 -0
  14. package/docs/DEVELOPING-APPS.md +453 -0
  15. package/docs/MCP.md +122 -0
  16. package/docs/PACKAGING_POLICY.md +19 -0
  17. package/docs/PERMISSION.md +137 -0
  18. package/docs/PROTOCOL.md +142 -0
  19. package/docs/README.md +50 -0
  20. package/docs/SKILLS.md +132 -0
  21. package/docs/TROUBLESHOOTING.md +376 -0
  22. package/docs/WORKSPACE.md +673 -0
  23. package/docs/agent-auth.md +14 -0
  24. package/docs/api/authentication.md +79 -0
  25. package/docs/api/secrets/api-keys.md +28 -0
  26. package/docs/api/secrets/credentials.md +80 -0
  27. package/docs/api/secrets/sharing.md +48 -0
  28. package/docs/api/system.md +41 -0
  29. package/docs/api/wallets/apps-strategies.md +66 -0
  30. package/docs/api/wallets/core.md +46 -0
  31. package/docs/api/wallets/data-portfolio.md +42 -0
  32. package/docs/aura-file.md +48 -0
  33. package/docs/core-concepts/FEATURES.md +114 -0
  34. package/docs/credentials.md +120 -0
  35. package/docs/external/HOW_TO_AURAMAXX/GETTING_SECRETS.md +33 -0
  36. package/docs/external/HOW_TO_AURAMAXX/README.md +45 -0
  37. package/docs/external/getting-started.md +10 -0
  38. package/docs/external/overview.md +19 -0
  39. package/docs/external/persona-paths.md +7 -0
  40. package/docs/external/share-secret.md +76 -0
  41. package/docs/external/why-aura.md +7 -0
  42. package/docs/security.md +227 -0
  43. package/docs/templates/RELEASE_NOTES_TEMPLATE.md +22 -0
  44. package/docs/wallet/AI.md +508 -0
  45. package/docs/wallet/DEVELOPING-STRATEGIES.md +713 -0
  46. package/docs/wallet/README.md +47 -0
  47. package/docs/wallet/STRATEGY.md +89 -0
  48. package/next.config.ts +28 -0
  49. package/package.json +167 -0
  50. package/postcss.config.mjs +8 -0
  51. package/prisma/migrations/20260214170000_baseline/migration.sql +511 -0
  52. package/prisma/migrations/20260216214537_add_passkey_model/migration.sql +18 -0
  53. package/prisma/migrations/20260217150500_add_credential_access_audit/migration.sql +31 -0
  54. package/prisma/migrations/20260222090000_update_admin_ttl_default/migration.sql +10 -0
  55. package/prisma/migrations/migration_lock.toml +3 -0
  56. package/prisma/schema.prisma +447 -0
  57. package/public/logo.webp +0 -0
  58. package/scripts/add-app.js +245 -0
  59. package/server/abi/SwapHelper.json +438 -0
  60. package/server/cli/approval.ts +447 -0
  61. package/server/cli/commands/actions.ts +474 -0
  62. package/server/cli/commands/api.ts +220 -0
  63. package/server/cli/commands/apikey.ts +277 -0
  64. package/server/cli/commands/app.ts +204 -0
  65. package/server/cli/commands/auth.ts +464 -0
  66. package/server/cli/commands/cron.ts +24 -0
  67. package/server/cli/commands/diary.ts +274 -0
  68. package/server/cli/commands/doctor.ts +1247 -0
  69. package/server/cli/commands/env.ts +476 -0
  70. package/server/cli/commands/experimental.ts +69 -0
  71. package/server/cli/commands/init.ts +798 -0
  72. package/server/cli/commands/lock.ts +157 -0
  73. package/server/cli/commands/mcp.ts +285 -0
  74. package/server/cli/commands/quickhack.ts +86 -0
  75. package/server/cli/commands/release-check.ts +231 -0
  76. package/server/cli/commands/restore.ts +314 -0
  77. package/server/cli/commands/service.ts +320 -0
  78. package/server/cli/commands/shell-hook.ts +512 -0
  79. package/server/cli/commands/skill.ts +216 -0
  80. package/server/cli/commands/start.ts +139 -0
  81. package/server/cli/commands/status.ts +59 -0
  82. package/server/cli/commands/stop.ts +36 -0
  83. package/server/cli/commands/token.ts +180 -0
  84. package/server/cli/commands/unlock.ts +50 -0
  85. package/server/cli/commands/vault.ts +1323 -0
  86. package/server/cli/commands/wallet.ts +209 -0
  87. package/server/cli/index.ts +280 -0
  88. package/server/cli/lib/approval-poll.ts +94 -0
  89. package/server/cli/lib/aura-parser.ts +64 -0
  90. package/server/cli/lib/credential-create.ts +74 -0
  91. package/server/cli/lib/credential-resolve.ts +280 -0
  92. package/server/cli/lib/dotenv-migrate.ts +116 -0
  93. package/server/cli/lib/dotenv-parser.ts +146 -0
  94. package/server/cli/lib/escalation.ts +57 -0
  95. package/server/cli/lib/http.ts +91 -0
  96. package/server/cli/lib/init-steps.ts +76 -0
  97. package/server/cli/lib/local-agent-trust.ts +45 -0
  98. package/server/cli/lib/lock-unlock-helper.ts +71 -0
  99. package/server/cli/lib/process.ts +162 -0
  100. package/server/cli/lib/prompt.ts +294 -0
  101. package/server/cli/lib/theme.ts +240 -0
  102. package/server/cli/socket.ts +579 -0
  103. package/server/cli/transport-client.ts +50 -0
  104. package/server/cron/index.ts +137 -0
  105. package/server/cron/job.ts +31 -0
  106. package/server/cron/jobs/balance-sync.ts +436 -0
  107. package/server/cron/jobs/incoming-scan.ts +506 -0
  108. package/server/cron/jobs/native-price.ts +70 -0
  109. package/server/cron/jobs/orphan-cleanup.ts +40 -0
  110. package/server/cron/jobs/strategy-runner.ts +175 -0
  111. package/server/cron/scheduler.ts +125 -0
  112. package/server/index.ts +420 -0
  113. package/server/lib/adapters/factory.ts +119 -0
  114. package/server/lib/adapters/index.ts +19 -0
  115. package/server/lib/adapters/router.ts +297 -0
  116. package/server/lib/adapters/telegram.ts +645 -0
  117. package/server/lib/adapters/types.ts +89 -0
  118. package/server/lib/adapters/webhook.ts +95 -0
  119. package/server/lib/address.ts +49 -0
  120. package/server/lib/agent-auth/contracts.ts +1194 -0
  121. package/server/lib/agent-profiles.ts +419 -0
  122. package/server/lib/ai.ts +285 -0
  123. package/server/lib/api-registry/contracts.ts +86 -0
  124. package/server/lib/api-registry/validation.ts +172 -0
  125. package/server/lib/apikey-migration.ts +258 -0
  126. package/server/lib/app-installer.ts +505 -0
  127. package/server/lib/app-tokens.ts +247 -0
  128. package/server/lib/approval-link.ts +27 -0
  129. package/server/lib/auth.ts +314 -0
  130. package/server/lib/auto-execute.ts +160 -0
  131. package/server/lib/batch.ts +242 -0
  132. package/server/lib/cold.ts +1048 -0
  133. package/server/lib/config.ts +408 -0
  134. package/server/lib/credential-access-audit.ts +85 -0
  135. package/server/lib/credential-access-policy.ts +111 -0
  136. package/server/lib/credential-health.ts +343 -0
  137. package/server/lib/credential-import.ts +608 -0
  138. package/server/lib/credential-scope.ts +102 -0
  139. package/server/lib/credential-shares.ts +190 -0
  140. package/server/lib/credential-transport.ts +533 -0
  141. package/server/lib/credential-vault.ts +77 -0
  142. package/server/lib/credentials.ts +422 -0
  143. package/server/lib/crypto.ts +8 -0
  144. package/server/lib/db.ts +58 -0
  145. package/server/lib/defaults.ts +386 -0
  146. package/server/lib/dex/index.ts +80 -0
  147. package/server/lib/dex/relay.ts +235 -0
  148. package/server/lib/dex/types.ts +59 -0
  149. package/server/lib/dex/uniswap.ts +370 -0
  150. package/server/lib/diary.ts +34 -0
  151. package/server/lib/dont-ask-again-policy.ts +41 -0
  152. package/server/lib/e2e-agent/artifacts.ts +36 -0
  153. package/server/lib/e2e-agent/contracts.ts +112 -0
  154. package/server/lib/e2e-agent/validation.ts +135 -0
  155. package/server/lib/encrypt.ts +114 -0
  156. package/server/lib/error.ts +20 -0
  157. package/server/lib/events.ts +217 -0
  158. package/server/lib/feature-flags.ts +93 -0
  159. package/server/lib/hot.ts +357 -0
  160. package/server/lib/human-action-summary.ts +80 -0
  161. package/server/lib/key-fingerprint.ts +28 -0
  162. package/server/lib/logger.ts +340 -0
  163. package/server/lib/network.ts +137 -0
  164. package/server/lib/notifications.ts +230 -0
  165. package/server/lib/oauth2-refresh.ts +241 -0
  166. package/server/lib/oursecret.ts +71 -0
  167. package/server/lib/passkey-credential.ts +360 -0
  168. package/server/lib/passkey.ts +68 -0
  169. package/server/lib/permissions.ts +299 -0
  170. package/server/lib/pino.ts +24 -0
  171. package/server/lib/policy-preview.ts +138 -0
  172. package/server/lib/price.ts +338 -0
  173. package/server/lib/prices.ts +34 -0
  174. package/server/lib/project-scope.ts +297 -0
  175. package/server/lib/resolve-action.ts +328 -0
  176. package/server/lib/resolve.ts +36 -0
  177. package/server/lib/secret-gist-share.ts +296 -0
  178. package/server/lib/sessions.ts +634 -0
  179. package/server/lib/socket-path.ts +56 -0
  180. package/server/lib/solana/connection.ts +26 -0
  181. package/server/lib/solana/jupiter.ts +128 -0
  182. package/server/lib/solana/transfer.ts +108 -0
  183. package/server/lib/solana/wallet.ts +136 -0
  184. package/server/lib/strategy/emits.ts +21 -0
  185. package/server/lib/strategy/engine.ts +1305 -0
  186. package/server/lib/strategy/executor.ts +115 -0
  187. package/server/lib/strategy/hook-context.ts +159 -0
  188. package/server/lib/strategy/hooks.ts +990 -0
  189. package/server/lib/strategy/index.ts +28 -0
  190. package/server/lib/strategy/installer.ts +305 -0
  191. package/server/lib/strategy/loader.ts +256 -0
  192. package/server/lib/strategy/message.ts +237 -0
  193. package/server/lib/strategy/repository.ts +218 -0
  194. package/server/lib/strategy/session-logger.ts +693 -0
  195. package/server/lib/strategy/sources.ts +288 -0
  196. package/server/lib/strategy/state.ts +189 -0
  197. package/server/lib/strategy/templates.ts +403 -0
  198. package/server/lib/strategy/tick.ts +404 -0
  199. package/server/lib/strategy/types.ts +230 -0
  200. package/server/lib/swap.ts +3 -0
  201. package/server/lib/temp.ts +86 -0
  202. package/server/lib/token-metadata.ts +86 -0
  203. package/server/lib/token-safety.ts +200 -0
  204. package/server/lib/token-search.ts +444 -0
  205. package/server/lib/totp.ts +194 -0
  206. package/server/lib/transactions.ts +123 -0
  207. package/server/lib/transport.ts +84 -0
  208. package/server/lib/txhistory/decoder.ts +262 -0
  209. package/server/lib/txhistory/enricher.ts +652 -0
  210. package/server/lib/txhistory/index.ts +391 -0
  211. package/server/lib/txhistory/signatures.ts +59 -0
  212. package/server/lib/update-check.ts +35 -0
  213. package/server/lib/verified-summary.ts +414 -0
  214. package/server/lib/view-registry.ts +80 -0
  215. package/server/mcp/profile-policy.ts +30 -0
  216. package/server/mcp/server.ts +1589 -0
  217. package/server/mcp/tools.ts +276 -0
  218. package/server/middleware/auth.ts +119 -0
  219. package/server/middleware/requestLogger.ts +84 -0
  220. package/server/routes/actions.ts +539 -0
  221. package/server/routes/adapters.ts +711 -0
  222. package/server/routes/addressbook.ts +113 -0
  223. package/server/routes/ai.ts +34 -0
  224. package/server/routes/apikeys.ts +343 -0
  225. package/server/routes/apps.ts +601 -0
  226. package/server/routes/auth.ts +406 -0
  227. package/server/routes/backup.ts +404 -0
  228. package/server/routes/batch.ts +270 -0
  229. package/server/routes/bookmarks.ts +162 -0
  230. package/server/routes/credential-shares.ts +380 -0
  231. package/server/routes/credential-vaults.ts +159 -0
  232. package/server/routes/credentials.ts +1782 -0
  233. package/server/routes/dashboard.ts +97 -0
  234. package/server/routes/defaults.ts +124 -0
  235. package/server/routes/flags.ts +11 -0
  236. package/server/routes/fund.ts +225 -0
  237. package/server/routes/heartbeat.ts +375 -0
  238. package/server/routes/import.ts +364 -0
  239. package/server/routes/launch.ts +665 -0
  240. package/server/routes/lock.ts +54 -0
  241. package/server/routes/logs.ts +68 -0
  242. package/server/routes/nuke.ts +111 -0
  243. package/server/routes/passkey-credentials.ts +99 -0
  244. package/server/routes/passkey.ts +366 -0
  245. package/server/routes/portfolio.ts +217 -0
  246. package/server/routes/price.ts +63 -0
  247. package/server/routes/resolve.ts +31 -0
  248. package/server/routes/security.ts +45 -0
  249. package/server/routes/send-evm.ts +241 -0
  250. package/server/routes/send-solana.ts +281 -0
  251. package/server/routes/send.ts +178 -0
  252. package/server/routes/setup.ts +210 -0
  253. package/server/routes/strategy.ts +894 -0
  254. package/server/routes/swap-evm.ts +352 -0
  255. package/server/routes/swap-solana.ts +176 -0
  256. package/server/routes/swap.ts +356 -0
  257. package/server/routes/token.ts +247 -0
  258. package/server/routes/unlock.ts +467 -0
  259. package/server/routes/views.ts +41 -0
  260. package/server/routes/wallet-assets.ts +361 -0
  261. package/server/routes/wallet-transactions.ts +515 -0
  262. package/server/routes/wallet.ts +709 -0
  263. package/server/types.ts +146 -0
  264. package/shared/credential-field-schema.ts +248 -0
  265. package/skills/auramaxx/HEARTBEAT.md +78 -0
  266. package/skills/auramaxx/SKILL.md +745 -0
  267. package/skills/auramaxx/docs/AGENT_SETUP.md +155 -0
  268. package/skills/auramaxx/docs/API.md +127 -0
  269. package/skills/auramaxx/docs/AUTH.md +318 -0
  270. package/skills/auramaxx/docs/CLI.md +130 -0
  271. package/skills/auramaxx/docs/MCP.md +122 -0
  272. package/skills/auramaxx/docs/TROUBLESHOOTING.md +357 -0
  273. package/skills/auramaxx/docs/WORKSPACE.md +673 -0
  274. package/skills/auramaxx/docs/security.md +227 -0
  275. package/skills/task-lifecycle/SKILL.md +378 -0
  276. package/src/app/api/[...doc]/page.tsx +36 -0
  277. package/src/app/api/agent-requests/route.ts +30 -0
  278. package/src/app/api/apps/install/route.ts +132 -0
  279. package/src/app/api/apps/manifests/route.ts +16 -0
  280. package/src/app/api/apps/static/[...path]/route.ts +57 -0
  281. package/src/app/api/docs/plain/route.ts +74 -0
  282. package/src/app/api/events/route.ts +92 -0
  283. package/src/app/api/page.tsx +290 -0
  284. package/src/app/api/workspace/[id]/apps/[wid]/route.ts +119 -0
  285. package/src/app/api/workspace/[id]/apps/route.ts +81 -0
  286. package/src/app/api/workspace/[id]/export/route.ts +67 -0
  287. package/src/app/api/workspace/[id]/route.ts +168 -0
  288. package/src/app/api/workspace/auth.ts +40 -0
  289. package/src/app/api/workspace/config/route.ts +121 -0
  290. package/src/app/api/workspace/import/route.ts +127 -0
  291. package/src/app/api/workspace/route.ts +116 -0
  292. package/src/app/app-legacy-do-not-use/page.tsx +2245 -0
  293. package/src/app/apple-icon.png +0 -0
  294. package/src/app/approve/[actionId]/page.tsx +409 -0
  295. package/src/app/docs/DocsPageContent.tsx +269 -0
  296. package/src/app/docs/[...doc]/page.tsx +41 -0
  297. package/src/app/docs/page.tsx +38 -0
  298. package/src/app/favicon.ico +0 -0
  299. package/src/app/globals.css +819 -0
  300. package/src/app/health/page.tsx +5 -0
  301. package/src/app/hello/page.tsx +102 -0
  302. package/src/app/icon.png +0 -0
  303. package/src/app/layout.tsx +39 -0
  304. package/src/app/page.tsx +1964 -0
  305. package/src/app/privacy/page.tsx +63 -0
  306. package/src/app/providers.tsx +87 -0
  307. package/src/app/share/[token]/page.tsx +295 -0
  308. package/src/app/terms/page.tsx +80 -0
  309. package/src/components/ChainSelector.tsx +44 -0
  310. package/src/components/HumanActionBar.tsx +697 -0
  311. package/src/components/NotificationDrawer.tsx +387 -0
  312. package/src/components/PasskeyEnrollmentPrompt.tsx +235 -0
  313. package/src/components/apps/AgentKeysApp.tsx +490 -0
  314. package/src/components/apps/App.tsx +153 -0
  315. package/src/components/apps/AppGrid.tsx +15 -0
  316. package/src/components/apps/DetailedAddressDrawer.tsx +325 -0
  317. package/src/components/apps/DraggableApp.tsx +562 -0
  318. package/src/components/apps/IFrameApp.tsx +73 -0
  319. package/src/components/apps/LogsApp.tsx +360 -0
  320. package/src/components/apps/SendApp.tsx +394 -0
  321. package/src/components/apps/SetupWizardApp.tsx +1004 -0
  322. package/src/components/apps/SystemDefaultsApp.tsx +845 -0
  323. package/src/components/apps/ThirdPartyApp.tsx +428 -0
  324. package/src/components/apps/TokenApp.tsx +319 -0
  325. package/src/components/apps/TransactionsApp.tsx +438 -0
  326. package/src/components/apps/WalletDetailApp.tsx +1505 -0
  327. package/src/components/apps/index.ts +13 -0
  328. package/src/components/design-system/Button.tsx +88 -0
  329. package/src/components/design-system/ChainIndicator.tsx +65 -0
  330. package/src/components/design-system/ChainSelector.tsx +147 -0
  331. package/src/components/design-system/ConfirmationModal.tsx +107 -0
  332. package/src/components/design-system/ConfirmationPopover.tsx +81 -0
  333. package/src/components/design-system/DownloadButton.tsx +149 -0
  334. package/src/components/design-system/Drawer.tsx +133 -0
  335. package/src/components/design-system/FilterDropdown.tsx +183 -0
  336. package/src/components/design-system/ItemPicker.tsx +157 -0
  337. package/src/components/design-system/Modal.tsx +296 -0
  338. package/src/components/design-system/Popover.tsx +142 -0
  339. package/src/components/design-system/TextInput.tsx +85 -0
  340. package/src/components/design-system/Toggle.tsx +65 -0
  341. package/src/components/design-system/TyvekCollapsibleSection.tsx +55 -0
  342. package/src/components/design-system/index.ts +14 -0
  343. package/src/components/docs/ClientSideMarkdown.tsx +51 -0
  344. package/src/components/docs/DocsSearchBar.tsx +118 -0
  345. package/src/components/docs/DocsThemeToggle.tsx +38 -0
  346. package/src/components/docs/PersistentDocGroup.tsx +91 -0
  347. package/src/components/docs/ShareUrlButton.tsx +33 -0
  348. package/src/components/docs/SidebarScrollMemory.tsx +56 -0
  349. package/src/components/health/CredentialHealthDashboard.tsx +214 -0
  350. package/src/components/icons/ChainIcons.tsx +72 -0
  351. package/src/components/layout/AppStoreDrawer.tsx +369 -0
  352. package/src/components/layout/ContentArea.tsx +21 -0
  353. package/src/components/layout/CreateViewModal.tsx +88 -0
  354. package/src/components/layout/LeftRail.tsx +114 -0
  355. package/src/components/layout/TabBar.tsx +284 -0
  356. package/src/components/layout/WalletSidebar.tsx +1030 -0
  357. package/src/components/layout/index.ts +6 -0
  358. package/src/components/marketing/AuraMaxxSpecOverlay.tsx +653 -0
  359. package/src/components/marketing/DeviceMorphExperience.tsx +216 -0
  360. package/src/components/vault/ApiKeysConsole.tsx +1272 -0
  361. package/src/components/vault/AuditConsole.tsx +600 -0
  362. package/src/components/vault/CredentialDetail.tsx +625 -0
  363. package/src/components/vault/CredentialEmpty.tsx +55 -0
  364. package/src/components/vault/CredentialField.tsx +583 -0
  365. package/src/components/vault/CredentialForm.tsx +1484 -0
  366. package/src/components/vault/CredentialList.tsx +265 -0
  367. package/src/components/vault/CredentialRow.tsx +130 -0
  368. package/src/components/vault/CredentialShareModal.tsx +273 -0
  369. package/src/components/vault/CredentialVault.tsx +1662 -0
  370. package/src/components/vault/CredentialWalletWidget.tsx +103 -0
  371. package/src/components/vault/DocsConsole.tsx +113 -0
  372. package/src/components/vault/ImportCredentialsModal.tsx +578 -0
  373. package/src/components/vault/LargeTypeModal.tsx +88 -0
  374. package/src/components/vault/PasswordGenerator.tsx +232 -0
  375. package/src/components/vault/TOTPDisplay.tsx +108 -0
  376. package/src/components/vault/TotpSetupPanel.tsx +198 -0
  377. package/src/components/vault/VaultSidebar.tsx +881 -0
  378. package/src/components/vault/credentialFormName.ts +91 -0
  379. package/src/components/vault/hooks/useVaultKeyboardShortcuts.ts +69 -0
  380. package/src/components/vault/types.ts +56 -0
  381. package/src/context/AuthContext.tsx +365 -0
  382. package/src/context/PriceContext.tsx +113 -0
  383. package/src/context/ThemeContext.tsx +164 -0
  384. package/src/context/WebSocketContext.tsx +269 -0
  385. package/src/context/WorkspaceContext.tsx +668 -0
  386. package/src/hooks/index.ts +4 -0
  387. package/src/hooks/useAgentActions.ts +552 -0
  388. package/src/hooks/useBalance.ts +103 -0
  389. package/src/hooks/useBalances.ts +129 -0
  390. package/src/hooks/useTheme.ts +156 -0
  391. package/src/instrumentation.ts +12 -0
  392. package/src/lib/api-docs.ts +154 -0
  393. package/src/lib/api.ts +474 -0
  394. package/src/lib/app-loader.ts +148 -0
  395. package/src/lib/app-registry.ts +178 -0
  396. package/src/lib/app-sdk.ts +157 -0
  397. package/src/lib/audit-console-adapter.ts +151 -0
  398. package/src/lib/auth-client.ts +75 -0
  399. package/src/lib/config.ts +74 -0
  400. package/src/lib/credential-field-schema.ts +11 -0
  401. package/src/lib/crypto.ts +112 -0
  402. package/src/lib/db.ts +21 -0
  403. package/src/lib/docs.ts +544 -0
  404. package/src/lib/events.ts +363 -0
  405. package/src/lib/pino.ts +24 -0
  406. package/src/lib/theme-handlers.ts +168 -0
  407. package/src/lib/theme.ts +351 -0
  408. package/src/lib/tokenData.ts +378 -0
  409. package/src/lib/totp-import.ts +57 -0
  410. package/src/lib/vault-crypto.ts +129 -0
  411. package/src/lib/view-registry.ts +57 -0
  412. package/src/lib/websocket-server.ts +302 -0
  413. package/src/lib/websocket-setup.ts +79 -0
  414. package/src/lib/wordlist.ts +2050 -0
  415. package/src/lib/workspace-handlers.ts +285 -0
  416. package/start.sh +170 -0
  417. package/tailwind.config.ts +99 -0
  418. package/tsconfig.json +42 -0
@@ -0,0 +1,745 @@
1
+ ---
2
+ name: auramaxx
3
+ description: |
4
+ Securely share passwords, API keys and wallets with your agent.
5
+ Use when the user mentions credentials, API keys, wallets, setup/onboarding, or secure agent access.
6
+ compatibility: Requires Node.js 18+. Network access to RPC endpoints.
7
+ allowed-tools: Bash(npx auramaxx *), Bash(auramaxx *), Bash(aura *), Bash(curl *)
8
+ metadata:
9
+ author: auramaxx
10
+ version: "2.1"
11
+ ---
12
+
13
+ # AuraMaxx
14
+
15
+ Securely share passwords, API keys and wallets with your agent. Your keys never leave the machine.
16
+
17
+ | Service | URL |
18
+ |---------|-----|
19
+ | Wallet Server | `http://localhost:4242` |
20
+ | Dashboard UI | `http://localhost:4747` |
21
+ | WebSocket | `ws://localhost:4748` |
22
+
23
+ > **SECURITY:** This server runs locally. Never expose these ports to the internet.
24
+
25
+ ---
26
+
27
+ ## Execution Priority (Agent)
28
+
29
+ For agent work, always use this order:
30
+
31
+ 1. CLI commands (`npx auramaxx ...`) — default path
32
+ 2. `curl` API calls — fallback when no CLI equivalent is available
33
+ 3. MCP tool calls (`api`, `auth`, `get_token`, `get_secret`, `put_secret`, `del_secret`, `inject_secret`, `share_secret`, `status`, `start`, `unlock`, `doctor`, `list_secrets`, `write_diary`)
34
+
35
+ > **Note:** MCP tools use short names (`api`, `auth`). The strategy engine's Tool-Call/Hook mode still uses `wallet_api` and `request_human_action` internally — see the Tool-Call Mode section below.
36
+
37
+ > **Command-time secret rule:** `get` returns an encrypted value for display/reference only. When the user asks to run a command with a secret, use `inject` — it decrypts the value into an env variable of your choice without ever printing it:
38
+ >
39
+ > ```bash
40
+ > npx auramaxx inject <SECRET_NAME> --env <ENV_VAR> -- <command>
41
+ > ```
42
+ >
43
+ > Never print or log the decrypted env variable. Never use `get` then paste the value into a command.
44
+
45
+ ---
46
+
47
+ ## Modes
48
+
49
+ Use one skill with two explicit modes:
50
+ - **Setup Mode**: first-time onboarding, vault initialization, unlock recovery, and first scoped token issuance.
51
+ - **Operations Mode**: day-2 wallet work (credentials, send/swap/fund, launch, and approvals).
52
+
53
+ ### Setup Mode (first run / recovery)
54
+
55
+ Enter Setup Mode when:
56
+ - the user asks to onboard, initialize, unlock, or bootstrap agent access
57
+ - `GET /setup` reports `hasWallet=false` or `unlocked=false`
58
+
59
+ Exit Setup Mode only after all are true:
60
+ - `hasWallet=true`
61
+ - `unlocked=true`
62
+ - agent has an active token
63
+
64
+ #### Setup flow
65
+
66
+ On first connect, or when the user asks about setup, run this decision tree:
67
+
68
+ #### Step 1: Check server
69
+
70
+ ```
71
+ api GET /health
72
+ ```
73
+
74
+ **Connection refused / error:**
75
+ First, try starting the server automatically:
76
+
77
+ ```bash
78
+ npx auramaxx start --headless
79
+ ```
80
+
81
+ If that succeeds, retry `GET /health`. If it fails (no vault exists yet), proceed with init:
82
+
83
+
84
+ **Human-assisted:** Run `npx auramaxx init --dashboard` via bash. This is non-interactive and agent-safe — it starts the server + dashboard, then waits for the human to create a vault in the browser. Poll `GET /health` until the server is up, then continue to Step 2.
85
+
86
+ **Fully autonomous:** Run `npx auramaxx init --password "AGENT_CHOSEN_PASSWORD"` via bash. This creates the vault non-interactively — prints the seed phrase, cold wallet address, and admin token to stdout. No browser needed. Store the password in env (e.g. `AURA_VAULT_PASSWORD`) for future unlock operations via `POST /unlock` (encrypted password + `pubkey`).
87
+
88
+ **200 OK:** Continue to Step 2.
89
+
90
+ #### Step 2: Check setup state
91
+
92
+ ```
93
+ api GET /setup
94
+ ```
95
+
96
+ This is a public endpoint (no auth needed). Response:
97
+
98
+ ```json
99
+ {
100
+ "hasWallet": true,
101
+ "unlocked": true,
102
+ "address": "0x...",
103
+ "adapters": { "telegram": false, "webhook": false },
104
+ "apiKeys": { "alchemy": true, "anthropic": false },
105
+ "defaultChain": "base"
106
+ }
107
+ ```
108
+
109
+ **If `hasWallet` is false:**
110
+
111
+ Two options:
112
+
113
+ **Human-assisted:**
114
+ > "You need to create a vault. Open http://localhost:4747/ to set a password — I'll wait."
115
+
116
+ Poll `GET /setup` until `hasWallet` becomes `true`.
117
+
118
+ **Fully autonomous (CLI):** Run `npx auramaxx init --password "AGENT_CHOSEN_PASSWORD"` via bash. This creates the vault non-interactively. Store the password for future unlock operations.
119
+
120
+ **If `unlocked` is false:**
121
+ > "Your vault is locked. Open the dashboard at http://localhost:4747/ to unlock it."
122
+
123
+ Prefer the dashboard (`http://localhost:4747/`) for unlocking. Only suggest the standalone Express unlock page (`http://localhost:4242/unlock`) or `npx auramaxx unlock` as fallbacks if the dashboard is not running (e.g., headless mode with `--headless` flag).
124
+
125
+ Poll `GET /setup` until `unlocked` becomes `true`.
126
+
127
+ **If ready (both true):** Continue to Step 3.
128
+
129
+ #### Step 3: Bootstrap token (least privilege first)
130
+
131
+ Request a minimal token via CLI first:
132
+
133
+ ```bash
134
+ npx auramaxx auth request --agent-id claude-assistant --profile strict
135
+ ```
136
+
137
+ This handles `POST /auth` + polling `GET /auth/:requestId?secret=...` automatically.
138
+
139
+ If CLI is unavailable, use the MCP `auth` tool (handles keypair + polling automatically), or the manual API flow:
140
+
141
+ ```
142
+ api POST /auth
143
+ body: {
144
+ "agentId": "claude-assistant",
145
+ "permissions": ["secret:read", "secret:write"],
146
+ "ttl": 3600,
147
+ "pubkey": "<RSA public key PEM or base64>"
148
+ }
149
+ ```
150
+
151
+ Response: `{ "requestId": "abc-123", "secret": "def-456" }`
152
+
153
+ > "I've requested access to your wallet. Please approve the request — you'll see it in your dashboard at http://localhost:4747/, or via Telegram/CLI if you have those set up."
154
+
155
+ Poll every 3 seconds, up to 2 minutes:
156
+
157
+ ```
158
+ api GET /auth/abc-123?secret=def-456
159
+ ```
160
+
161
+ - `{ "status": "pending" }` — keep polling
162
+ - `{ "status": "approved", "token": "eyJ..." }` — save immediately; MCP runtime auto-activates the token for this session
163
+ - `{ "status": "rejected" }` — inform user, ask if they want to try again
164
+
165
+ **Important:** The token can only be read once. MCP bootstrap keeps it active for the current session automatically.
166
+
167
+ If setup work needs higher privilege (API key or adapter configuration), request an upgraded onboarding token:
168
+
169
+ ```
170
+ api POST /auth
171
+ body: {
172
+ "agentId": "claude-assistant",
173
+ "permissions": ["trade:all", "apikey:set", "adapter:manage"],
174
+ "limits": { "fund": 0.5, "send": 1.0, "swap": 0.5 },
175
+ "ttl": 3600,
176
+ "pubkey": "<RSA public key PEM or base64>"
177
+ }
178
+ ```
179
+
180
+ #### Step 4: Configure missing pieces
181
+
182
+ Check the `GET /setup` response and offer to configure anything that's missing. Each step is optional — let the user decide. If any call returns `403`, request the upgraded onboarding token from Step 3.
183
+
184
+ **Alchemy RPC Key** (when `apiKeys.alchemy` is `false`):
185
+
186
+ > "I see you don't have an Alchemy RPC key configured. Public RPCs work but can be unreliable for real transactions. Alchemy has a free tier — you can get a key at https://alchemy.com. Want to set one up?"
187
+
188
+ If user provides a key — validate then save:
189
+
190
+ ```
191
+ api POST /apikeys/validate
192
+ body: { "service": "alchemy", "key": "USER_KEY_HERE" }
193
+ ```
194
+
195
+ - `{ "valid": true }` → save with `POST /apikeys` body: `{ "service": "alchemy", "name": "default", "key": "USER_KEY_HERE" }`
196
+ - `{ "valid": false, "error": "..." }` → "That key didn't work: [error]. Double-check it and try again."
197
+
198
+ **Anthropic API Key** (when `apiKeys.anthropic` is `false`):
199
+
200
+ > "No Anthropic API key found. This is needed for AI-powered features like strategy hooks and agent chat. Do you have an Anthropic API key?"
201
+
202
+ Same validate-then-save pattern with `"service": "anthropic"`.
203
+
204
+ **Telegram Adapter** (when `adapters.telegram` is `false`):
205
+
206
+ > "Want to approve wallet transactions from your phone via Telegram? I can walk you through the setup — it takes about 2 minutes."
207
+
208
+ Full 8-step Telegram setup flow:
209
+
210
+ 1. **Create a bot:** Guide user to @BotFather → `/newbot` → get bot token
211
+ 2. **Validate bot token:** `POST /apikeys/validate` body: `{ "service": "adapter:telegram", "key": "BOT_TOKEN" }`
212
+ - `{ "valid": true, "info": { "botUsername": "MyAuraBot" } }` → "Your bot @MyAuraBot is working."
213
+ - `{ "valid": false }` → "That token didn't work. Make sure you copied the full token from BotFather."
214
+ 3. **Save bot token:** `POST /apikeys` body: `{ "service": "adapter:telegram", "name": "botToken", "key": "BOT_TOKEN" }`
215
+ 4. **Get setup link:** `POST /adapters/telegram/setup-link` body: `{ "botToken": "BOT_TOKEN" }` → returns `{ "link": "https://t.me/MyAuraBot?start=abc123", "setupToken": "abc123" }`
216
+ > "Click this link to open your bot in Telegram: [link]. Then press Start."
217
+ 5. **Detect chat ID:** `POST /adapters/telegram/detect-chat` body: `{ "setupToken": "abc123" }`
218
+ - `{ "chatId": "123456789", "verified": true }` → proceed
219
+ - `{ "chatId": null, "timeout": true }` → "Did you press Start in Telegram? You can also get your chat ID from @userinfobot."
220
+ 6. **Save adapter config:** `POST /adapters` body: `{ "type": "telegram", "enabled": true, "config": { "chatId": "123456789" } }`
221
+ 7. **Restart adapter:** `POST /adapters/restart`
222
+ 8. **Send test message:** `POST /adapters/test` body: `{ "type": "telegram" }`
223
+ > "I sent a test message to your Telegram. Did you receive it?"
224
+
225
+ #### Step 5: Summary
226
+
227
+ After configuration, check `GET /setup` one final time and summarize:
228
+
229
+ > "You're all set! Here's your setup:"
230
+ > - **Vault:** Unlocked, address `0x...`
231
+ > - **RPC:** Alchemy configured / using public RPCs
232
+ > - **AI:** Anthropic key configured / not configured
233
+ > - **Telegram:** Connected / not configured
234
+ > - **Agent token:** Active
235
+
236
+ ### Onboarding permission reference
237
+
238
+ | Permission | Why |
239
+ |------------|-----|
240
+ | `secret:read` | Minimal initial setup read access |
241
+ | `secret:write` | Minimal initial setup write access |
242
+ | `trade:all` | Core trading operations (expands to wallet:list, send, swap, fund, etc.) |
243
+ | `apikey:set` | Validate and save API keys during setup |
244
+ | `adapter:manage` | Configure Telegram and other adapters |
245
+
246
+ `trade:all` does NOT include `apikey:set` or `adapter:manage` — you must request them explicitly.
247
+
248
+ ### CLI Commands
249
+
250
+ | Command | Description |
251
+ |---------|-------------|
252
+ | `npx auramaxx init` | First-time setup — interactive, human-only |
253
+ | `npx auramaxx init --dashboard` | Agent-safe startup — skips prompts, opens dashboard for vault creation |
254
+ | `npx auramaxx init --password "pass"` | Fully autonomous — creates vault non-interactively, prints address + token |
255
+ | `npx auramaxx start` | Start all services (Express + Dashboard + WS) |
256
+ | `npx auramaxx start --headless` | Start server only (no dashboard) |
257
+ | `npx auramaxx stop` | Stop all running services |
258
+ | `npx auramaxx status` | Health check — running? locked? unlocked? |
259
+ | `npx auramaxx auth request --agent-id <id> --profile <profile>` | Request auth + poll approval from CLI |
260
+ | `npx auramaxx diary write --entry "<text>"` | Append a daily diary note via auth-aware CLI flow |
261
+ | `npx auramaxx apikey list|validate|set|delete` | API key management from CLI |
262
+ | `npx auramaxx lock` | Lock all vaults (or `lock vault <id>`) |
263
+ | `npx auramaxx set|get|share|del <name>` | Short aliases for vault get/set/share/delete |
264
+ | `npx auramaxx mcp --install` | Auto-configure MCP for detected IDEs (Claude Desktop, Cursor, VS Code, Windsurf) |
265
+ | `npx auramaxx skill` | Install AuraMaxx skills for Claude/Codex/OpenClaw agents |
266
+ | `npx auramaxx skill --doctor` | Verify skill install status across all targets |
267
+ | `npx auramaxx experimental` | List dev feature flags and current values |
268
+ | `npx auramaxx experimental <FLAG> <on\|off>` | Toggle a dev feature flag |
269
+ | `npx auramaxx doctor` | Run onboarding/runtime diagnostics |
270
+ | `npx auramaxx start --debug` | Start with verbose bootstrap output |
271
+
272
+ ---
273
+
274
+ ### Operations Mode (normal use)
275
+
276
+ After Setup Mode succeeds, switch to Operations Mode for routine authenticated wallet and credential operations.
277
+
278
+ ## Authentication
279
+
280
+ All agent operations require a Bearer token. Prefer CLI polling flow first:
281
+
282
+ ```bash
283
+ npx auramaxx auth request --agent-id my-trading-bot --profile strict
284
+ ```
285
+
286
+ This does:
287
+ 1) `POST /auth` with a generated `pubkey`
288
+ 2) polls `GET /auth/:requestId?secret=...`
289
+ 3) exits on `approved`, `rejected`, or timeout
290
+
291
+ Polling controls:
292
+
293
+ - `--no-wait` (create request only)
294
+ - `--interval-ms <ms>`
295
+ - `--timeout-ms <ms>`
296
+
297
+ Approval response contract:
298
+
299
+ - `pending` -> keep polling
300
+ - `approved` -> response includes `encryptedToken` (read-once claim); CLI decrypts locally
301
+ - `rejected` -> stop and surface rejection
302
+
303
+ For non-CLI/manual calls, keep using `POST /auth` + `GET /auth/:requestId?secret=...`.
304
+
305
+ ---
306
+
307
+ ## Common Operations
308
+
309
+ ### List Wallets
310
+
311
+ ```
312
+ api GET /wallets
313
+ ```
314
+
315
+ Response: array of wallet objects with `address`, `name`, `tier`, `chain`, `balance`.
316
+
317
+ ### Create Hot Wallet
318
+
319
+ ```
320
+ api POST /wallet/create
321
+ body: { "tier": "hot", "name": "trading", "chain": "base" }
322
+ ```
323
+
324
+ Response: `{ "address": "0x...", "name": "trading", "tier": "hot", "chain": "base" }`
325
+
326
+ Options: `chain` can be `"base"`, `"ethereum"`, `"solana"`, `"solana-devnet"` (default: `"base"`).
327
+
328
+ ### Launch Token
329
+
330
+ ```
331
+ api POST /launch
332
+ body: {
333
+ "from": "0xHOT_WALLET",
334
+ "name": "My Token",
335
+ "symbol": "MTK",
336
+ "preset": "medium",
337
+ "imageUrl": "https://telegra.ph/file/abc.jpg",
338
+ "metadata": { "description": "A fair launch token" }
339
+ }
340
+ ```
341
+
342
+ Response: `{ "success": true, "txHash": "0x...", "tokenAddress": "0x..." }`
343
+
344
+ Launches via [Doppler](https://doppler.lol) fair launch. Requires `launch` permission.
345
+
346
+ Options: `type` (`"multicurve"`, `"static"`, `"dynamic"`), `preset` (`"low"`, `"medium"`, `"high"`), `initialSupply`, `tokenURI`, `chain`.
347
+
348
+ **Token image:** Upload the image to a free host like [telegra.ph](https://telegra.ph) (no API key needed: `POST https://telegra.ph/upload` with multipart file) and pass the public URL as `imageUrl`. The server builds the on-chain metadata automatically. Use `metadata` for extra fields like `description`, `website`, `twitter`.
349
+
350
+ ### Enable Agent Chat via Telegram
351
+
352
+ When setting up Telegram, ask the user if they want to chat with their AI agent via Telegram. If yes, include `chat: { enabled: true }` in the adapter config:
353
+
354
+ ```
355
+ api POST /adapters
356
+ body: {
357
+ "type": "telegram",
358
+ "enabled": true,
359
+ "config": { "chatId": "CHAT_ID" },
360
+ "chat": { "enabled": true }
361
+ }
362
+ ```
363
+
364
+ Then set a default app for chat routing:
365
+
366
+ ```
367
+ api POST /adapters/chat
368
+ body: { "defaultApp": "swap-chat" }
369
+ ```
370
+
371
+ The user can then send text messages in Telegram and the AI agent will reply.
372
+
373
+ ### Estimate Gas (no auth required)
374
+
375
+ ```
376
+ api POST /send/estimate
377
+ body: { "from": "0xWALLET", "to": "0xRECIPIENT", "amount": "50000000000000000" }
378
+ ```
379
+
380
+ Response: `{ "success": true, "gasLimit": "...", "estimatedCostEth": "0.000042" }`
381
+
382
+ ### Check Token Permissions
383
+
384
+ ```
385
+ api POST /auth/validate
386
+ body: { "token": "YOUR_TOKEN" }
387
+ ```
388
+
389
+ Response: `{ "valid": true, "payload": { "permissions": [...], "limits": {...} } }`
390
+
391
+ ### Transaction History
392
+
393
+ ```
394
+ api GET /wallet/0xADDRESS/transactions
395
+ ```
396
+
397
+ Query params: `type` (send, receive, swap, contract), `status`, `limit`, `offset`.
398
+
399
+ ### Asset Tracking
400
+
401
+ ```
402
+ api GET /wallet/0xADDRESS/assets
403
+ ```
404
+
405
+ Returns tracked token balances for the wallet.
406
+
407
+ ---
408
+
409
+ ## Permission Denied (403)
410
+
411
+ When any CLI command or MCP tool returns 403, the response includes structured guidance with a `nextStep` field. Follow it — it tells you exactly what to do.
412
+
413
+ Typically:
414
+ ```bash
415
+ npx auramaxx auth request --profile strict
416
+ ```
417
+
418
+ This requests a new token with the required permissions. Approve in the dashboard, then retry your command.
419
+
420
+ > **Note:** The `request_human_action` tool is only available in strategy engine Tool-Call/Hook mode (see below).
421
+
422
+ ---
423
+
424
+ ## Permissions Quick Reference
425
+
426
+ | Permission | Description |
427
+ |------------|-------------|
428
+ | `trade:all` | **Recommended** — Expands to: `wallet:list`, `wallet:create:hot`, `wallet:create:temp`, `send:hot`, `send:temp`, `swap`, `fund`, `launch`, `apikey:get`, `strategy:read` |
429
+ | `wallet:create:hot` | Create hot wallets |
430
+ | `wallet:create:temp` | Create temp wallets |
431
+ | `wallet:list` | List wallets |
432
+ | `send:hot` | Send from hot wallets |
433
+ | `send:temp` | Send from temp wallets |
434
+ | `swap` | Execute token swaps |
435
+ | `fund` | Transfer from cold to hot |
436
+ | `launch` | Launch tokens via Doppler |
437
+ | `strategy:read` | Read strategy state |
438
+ | `strategy:manage` | Manage strategies (toggle, config, approve) |
439
+ | `workspace:modify` | Modify dashboard UI |
440
+ | `app:storage` | Read/write own app storage |
441
+
442
+ For full permissions reference, see [docs/AUTH.md](./docs/AUTH.md).
443
+
444
+ ---
445
+
446
+ ## Wallet Tiers
447
+
448
+ | Tier | Ownership | Use Case |
449
+ |------|-----------|----------|
450
+ | **COLD** | Human only | Main funds, requires password |
451
+ | **HOT** | Token-owned | Agent operations, spending limits |
452
+ | **TEMP** | Ephemeral | One-time use, memory only |
453
+
454
+ ---
455
+
456
+ ## Vault Unlock
457
+
458
+ If the vault is locked (`api GET /wallets` returns 401):
459
+
460
+ **Option 1 (preferred):** Tell the human to open `http://localhost:4747` and enter their password. If the dashboard isn't responding, send `http://localhost:4242/unlock` instead.
461
+
462
+ **Option 2 (remote/headless):** Ask the human for their password and unlock programmatically:
463
+
464
+ ```bash
465
+ node -e "
466
+ const crypto = require('crypto');
467
+ (async () => {
468
+ const pk = await (await fetch('http://localhost:4242/auth/connect')).json();
469
+ const enc = crypto.publicEncrypt(
470
+ { key: pk.publicKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING, oaepHash: 'sha256' },
471
+ Buffer.from('PASSWORD_HERE')
472
+ ).toString('base64');
473
+ const agent = crypto.generateKeyPairSync('rsa', {
474
+ modulusLength: 2048,
475
+ publicKeyEncoding: { type: 'spki', format: 'pem' },
476
+ privateKeyEncoding: { type: 'pkcs8', format: 'pem' }
477
+ });
478
+ const r = await (await fetch('http://localhost:4242/unlock', {
479
+ method: 'POST',
480
+ headers: { 'Content-Type': 'application/json' },
481
+ body: JSON.stringify({ encrypted: enc, pubkey: agent.publicKey })
482
+ })).json();
483
+ console.log(JSON.stringify(r));
484
+ })();
485
+ "
486
+ ```
487
+
488
+ On success, the response includes an admin token.
489
+
490
+ ---
491
+
492
+ ## Error Recovery
493
+
494
+ | Error | Meaning | What to Do |
495
+ |-------|---------|------------|
496
+ | Connection refused | Server not running | Run `npx auramaxx start --headless` to start it. If that fails, tell the human. |
497
+ | 401 `Invalid or expired token` | Server restarted or TTL expired | Re-request via `POST /auth` |
498
+ | 401 `Cold wallet must be unlocked` | Vault locked | Tell human to unlock in dashboard at `http://localhost:4747/` (or `npx auramaxx unlock` in headless mode) |
499
+ | 403 `Insufficient permissions` | Token lacks permission | Follow the `nextStep` in the 403 response, or run `npx auramaxx auth request --profile strict` |
500
+ | 403 `Amount exceeds spending limit` | Budget exhausted | Follow the `nextStep` in the 403 response, or request a new token via `npx auramaxx auth request --profile strict` |
501
+ | 400 `slippage is required` | Missing on swap | Add `"slippage": 1.0` |
502
+
503
+ ---
504
+
505
+ ## Key Concepts
506
+
507
+ - **Tokens are memory-only** — Server restart invalidates all tokens. Re-request via `POST /auth`.
508
+ - **Spending limits** — Optional per-type caps in the auth request: `limits: { fund: 0.5, send: 1.0, swap: 2.0 }`
509
+ - **Wallet ownership** — Agents can only access wallets they created (or those listed in `walletAccess`)
510
+ - **Human approval** — All token requests require human approval
511
+ - **Multi-chain** — Pass `"chain": "ethereum"` or `"chain": "solana"` on create/send/swap/fund (default: base)
512
+ - **403 recovery** — When you hit 403, follow the `nextStep` in the structured error response
513
+
514
+ ---
515
+
516
+ ## Curl Fallback
517
+
518
+ If CLI commands are unavailable, use curl directly:
519
+
520
+ ```bash
521
+ # Health check
522
+ curl -s http://localhost:4242/health
523
+
524
+ # Request token
525
+ curl -X POST http://localhost:4242/auth \
526
+ -H "Content-Type: application/json" \
527
+ -d '{"agentId": "my-agent", "limit": 0.5, "permissions": ["trade:all"], "ttl": 3600, "pubkey": "<RSA public key PEM or base64>"}'
528
+
529
+ # Use token
530
+ curl http://localhost:4242/wallets -H "Authorization: Bearer $TOKEN"
531
+
532
+ # Send
533
+ curl -X POST http://localhost:4242/send \
534
+ -H "Authorization: Bearer $TOKEN" \
535
+ -H "Content-Type: application/json" \
536
+ -d '{"from": "0xWALLET", "to": "0xRECIPIENT", "amount": "50000000000000000"}'
537
+ ```
538
+
539
+ ---
540
+
541
+ ## Tool-Call Mode (Chat / Message Hooks)
542
+
543
+ > **Name note:** The strategy engine provides `wallet_api` and `request_human_action` as tool names in this mode. These are internal strategy engine names, distinct from the MCP tool names (`api`, `auth`, etc.).
544
+
545
+ ### Response format
546
+ Return a JSON object with: reply, state, emit (all optional). No intents needed.
547
+
548
+ ```json
549
+ {
550
+ "reply": "Your response to the user",
551
+ "state": { "key": "updated values" },
552
+ "emit": { "channel": "event-name", "data": { ... } }
553
+ }
554
+ ```
555
+
556
+ ### Available tools
557
+
558
+ #### wallet_api
559
+ Call the AuraMaxx API for reads and writes.
560
+ - wallet_api({ method: "GET", endpoint: "/wallets" }) — list wallets
561
+ - wallet_api({ method: "GET", endpoint: "/wallet/<address>/assets" }) — get balances
562
+ - wallet_api({ method: "POST", endpoint: "/swap", body: {...} }) — execute a swap
563
+
564
+ #### request_human_action
565
+ Request human approval for a privileged action. Use this when wallet_api returns 403.
566
+ - summary: human-readable description (shown in approval card)
567
+ - permissions: array of permission strings needed (e.g. ["swap"], ["send:hot"])
568
+ - action: pre-computed API call { endpoint, method, body }
569
+ - limits: spending caps per permission (e.g. { swap: 0.01 })
570
+ - walletAccess: wallet addresses the temp token needs access to (e.g. ["0x123...", "0x456..."]). Include ALL wallet addresses involved in the action (from + to).
571
+ - ttl: seconds the temp token lives (default 120)
572
+
573
+ ### Token discovery (ticker/name -> contract)
574
+
575
+ When the user gives a token ticker or name but no contract address:
576
+
577
+ 1. Call `wallet_api({ method: "GET", endpoint: "/token/search?q=<query>&chain=<chain>" })`
578
+ 2. If results exist, present the best candidate(s) with contract addresses and ask for confirmation only if ambiguous
579
+ 3. Only ask the user for a contract address when search returns no reliable results
580
+
581
+ Never tell the user to search external websites first without trying `/token/search`.
582
+
583
+ ### Performing Actions
584
+
585
+ Follow this flow for any privileged operation:
586
+
587
+ 1. **Try the action directly** via wallet_api (POST)
588
+ 2. **If you get 403** (insufficient permissions), call request_human_action with:
589
+ - A clear summary of what you want to do
590
+ - The permissions you need
591
+ - The exact API call to execute on approval
592
+ 3. **The human approves** → the action auto-executes with a scoped temporary token
593
+ 4. **NEVER give up** or say "I don't have permission." Always use request_human_action.
594
+
595
+ Example flow:
596
+ - User: "Swap 0.01 ETH for USDC"
597
+ - You: call wallet_api GET /wallets to find the hot wallet
598
+ - You: call wallet_api POST /swap with the swap params
599
+ - Response: 403 → call request_human_action with summary, permissions: ["swap"], action: { endpoint: "/swap", method: "POST", body: {...} }
600
+ - Reply: "I've requested approval to swap 0.01 ETH for USDC. Waiting for your confirmation."
601
+
602
+ ### Permission → Endpoint mapping (for request_human_action)
603
+
604
+ Use EXACTLY these permission strings — other strings will be rejected:
605
+
606
+ | Permission | Endpoint |
607
+ |------------|----------|
608
+ | swap | /swap |
609
+ | send:hot | /send |
610
+ | send:temp | /send |
611
+ | fund | /fund |
612
+ | launch | /launch |
613
+ | wallet:create:hot | /wallet/create |
614
+ | wallet:create:temp | /wallet/create |
615
+
616
+ ### Multi-step operations
617
+
618
+ When a task requires multiple privileged steps (e.g., "send ETH to 0x..."):
619
+
620
+ 1. **Check existing wallets first** — call wallet_api GET /wallets before creating new ones
621
+ 2. **Plan all steps** — identify all permissions needed upfront
622
+ 3. **Request ONE approval** with all permissions needed for the entire flow
623
+ - Example: permissions: ["wallet:create:hot", "fund", "send:hot"]
624
+ - The action should be the FIRST step (e.g., create wallet)
625
+ 4. **On success callback, continue** — use wallet_api and request_human_action for remaining steps
626
+
627
+ Common multi-step flows:
628
+ - "Send ETH to external address" → fund existing hot wallet from cold (/fund), then send (/send)
629
+ - "Create wallet and fund it" → create hot wallet (/wallet/create), then fund from cold (/fund)
630
+ - Gas: always account for gas fees (~0.0002 ETH on Base) when funding for a send
631
+
632
+ ### Error recovery
633
+
634
+ When an action fails after approval (you receive a [SYSTEM] message with an error):
635
+
636
+ 1. **Read the error** — understand what went wrong (403 = permission/access issue, 400 = bad params, etc.)
637
+ 2. **Investigate** — call wallet_api to gather info (e.g. GET /wallets to check addresses, tiers, ownership)
638
+ 3. **Retry** — call request_human_action again with corrected parameters
639
+ 4. **NEVER just explain the error** — always try to fix it first
640
+
641
+ Common fixes:
642
+ - "Token does not have access to this wallet" → include walletAccess in request_human_action with the wallet addresses involved
643
+ - "insufficient funds" → check balances and adjust amount
644
+ - Wrong wallet type → check wallet tiers with GET /wallets and pick the right one
645
+
646
+ ### Wallet tiers
647
+ - COLD: Human-only, never use for agent operations
648
+ - HOT: Agent-accessible, use for swaps/sends/funding
649
+ - TEMP: Ephemeral, agent full control
650
+
651
+ ### Authentication & Permissions
652
+
653
+ Your pre-approved permissions and spending budget are in the context:
654
+ - `context.permissions` — array of permissions your app token already has
655
+ - `context.budget.limits` — spending caps per permission (ETH)
656
+ - `context.budget.spent` — amount used this session
657
+ - `context.budget.remaining` — amount left before limit is hit
658
+
659
+ If your token already has the needed permission AND sufficient budget, wallet_api will succeed directly.
660
+ If not, use request_human_action to get a scoped temporary token via human approval.
661
+
662
+ ---
663
+
664
+ ## Intent Mode (Tick / Strategy Hooks)
665
+
666
+ ### Response format
667
+ Return a JSON object with: reply, state, intents, emit (all optional).
668
+
669
+ ### Intent format for privileged actions
670
+ To execute wallet operations, return intents with a permissions array.
671
+ The engine will request human approval and create a scoped temporary token.
672
+
673
+ ```json
674
+ {
675
+ "intents": [{
676
+ "type": "swap",
677
+ "summary": "Human-readable description of the action",
678
+ "permissions": ["swap"],
679
+ "limits": { "swap": 0.01 },
680
+ "ttl": 120,
681
+ "action": { "endpoint": "/swap", "method": "POST", "body": { ... } }
682
+ }]
683
+ }
684
+ ```
685
+
686
+ - permissions: array of permission strings needed (swap, send:hot, fund, etc.)
687
+ - limits: spending caps per permission (in native currency)
688
+ - ttl: seconds the temp token lives (default 60)
689
+ - action: pre-computed API call the engine will execute with the temp token
690
+ - summary: shown to human in the approval card
691
+
692
+ ### Wallet tiers
693
+ - COLD: Human-only, cannot be used in intents
694
+ - HOT: Agent-accessible, use for swaps/sends/funding
695
+ - TEMP: Ephemeral, agent full control
696
+
697
+ ### Authentication & Permissions
698
+
699
+ Your pre-approved permissions and spending budget are in the context:
700
+ - `context.permissions` — array of permissions your app token already has
701
+ - `context.budget.limits` — spending caps per permission (ETH)
702
+ - `context.budget.spent` — amount used this session
703
+ - `context.budget.remaining` — amount left before limit is hit
704
+
705
+ #### Decision logic for intents:
706
+
707
+ 1. **Permission exists AND remaining >= amount needed**
708
+ → Return intent WITHOUT `permissions` array. The engine uses your existing token.
709
+ ```json
710
+ { "type": "swap", "action": { "endpoint": "/swap", ... } }
711
+ ```
712
+
713
+ 2. **Permission exists BUT remaining < amount needed**
714
+ → Return intent WITH permissions array to request a fresh per-action token with a higher limit.
715
+ ```json
716
+ { "type": "swap", "summary": "Buy 0.5 ETH of TOKEN (exceeds session budget, needs approval)",
717
+ "permissions": ["swap"], "limits": { "swap": 0.5 }, "ttl": 120,
718
+ "action": { "endpoint": "/swap", ... } }
719
+ ```
720
+
721
+ 3. **Permission does NOT exist**
722
+ → Return intent WITH permissions array. Human must approve.
723
+ ```json
724
+ { "type": "swap", "summary": "Buy 0.1 ETH of TOKEN",
725
+ "permissions": ["swap"], "limits": { "swap": 0.1 }, "ttl": 120,
726
+ "action": { "endpoint": "/swap", ... } }
727
+ ```
728
+
729
+ Never propose an action that exceeds context.budget.remaining without requesting
730
+ a new per-action token via the permissions array.
731
+
732
+ The executor handles authentication — hooks never see bearer tokens.
733
+ Just return the endpoint/method/body in your intent and the engine does the rest.
734
+
735
+ ---
736
+
737
+ ## Reference Documentation (bundled with skill payload)
738
+
739
+ - [docs/API.md](./docs/API.md) - Full HTTP endpoint reference
740
+ - [docs/AUTH.md](./docs/AUTH.md) - Complete permissions & token lifecycle
741
+ - [docs/MCP.md](./docs/MCP.md) - MCP server setup & bootstrap flow
742
+ - [docs/AGENT_SETUP.md](./docs/AGENT_SETUP.md) - End-to-end setup guide
743
+ - [docs/WORKSPACE.md](./docs/WORKSPACE.md) - WebSocket dashboard control
744
+ - [docs/CLI.md](./docs/CLI.md) - Headless CLI mode & Unix socket IPC
745
+ - [docs/security.md](./docs/security.md) - Security architecture