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,227 @@
1
+ # Security
2
+
3
+ This document reflects the current security model implemented in the codebase.
4
+
5
+ ## Security Overview (why the model is safe)
6
+
7
+ AuraMaxx uses a **three-layer model**:
8
+
9
+ 1. **Profile-based issuance** (how a token is created)
10
+ 2. **Permission-based runtime enforcement** (what a token can do)
11
+ 3. **Granular credential access policy** (which secrets and fields can be touched)
12
+
13
+ The result: tokens are easy to issue, strict to scope, and hard to overscope.
14
+
15
+ ### The model in one pass
16
+
17
+ - Agents usually start with an **agent profile** (`POST /auth`) that defines:
18
+ - base permissions
19
+ - credential read/write scopes (vaults/tags/ids)
20
+ - TTL and read limits
21
+ - field redaction policies
22
+ - Issuance is intentionally **human-approved** and not self-service by default.
23
+ - Every API request is still validated again using runtime permission checks.
24
+ - Secret access is additionally constrained by selector checks and read budgets.
25
+ - Tokens are short-lived and can be revoked proactively.
26
+
27
+ ### What “least privilege” means here
28
+
29
+ - Profiles give sensible defaults, but they are not blanket trust.
30
+ - Every request is still gated by permissions + scope.
31
+ - Agent callers can only operate on explicitly authorized vaults and fields.
32
+ - If a profile must be tighter, overrides must be **tighten-only**.
33
+
34
+ ---
35
+
36
+ ## Core Principles
37
+
38
+ 1. **Memory-rooted auth/session state** — in-memory SIGNING_KEY, sessions, and revocation state drive runtime trust boundaries.
39
+ 2. **Restart invalidates all tokens** — new SIGNING_KEY is generated each restart.
40
+ 3. **Minimal permissions** — tokens carry exactly the permissions needed.
41
+ 4. **Encrypted secrets at rest** — credential fields are encrypted in local DB with vault-derived keys.
42
+ 5. **Encrypted credential transport** — secret reads are encrypted to the caller's RSA pubkey.
43
+ 6. **Human-controlled unlocks** — privileged operations require explicit human action.
44
+ 7. **Scoped ownership** — credential access requires explicit credential selectors + permission checks.
45
+
46
+ ## Current Security Model
47
+
48
+ AuraMaxx is **profile-first** for issuance, but **permission- and scope-enforced at runtime**.
49
+
50
+ - Issuance determines token payload (permissions, TTL, credential selectors, exclusions).
51
+ - Middleware enforces per-route permissions on every call.
52
+ - Credential read/write governance adds extra controls:
53
+ - selector checks
54
+ - per-token read budgets
55
+ - max read/window throttles
56
+ - excluded field minimization
57
+
58
+ Auth/session truth source is still memory-first:
59
+
60
+ - Tokens are signed in memory (`SIGNING_KEY`).
61
+ - Session counters/tracking are memory-backed.
62
+ - Revocations are memory-backed (`revokedTokens`).
63
+ - DB is authoritative for UI/audit views, not for runtime auth decisions.
64
+
65
+ ## Agent Token Paths
66
+
67
+ > For quickstart usage and CLI examples, see [AUTH.md](AUTH.md). This section describes the security enforcement model for each path.
68
+
69
+ ### 1) `POST /auth` (profile-only request + human approval)
70
+
71
+ Standard agent onboarding path.
72
+
73
+ - Required: `agentId`, `profile`, `pubkey`.
74
+ - Rejects raw issuance (`permissions`, `ttl`, `credentialAccess`) on `/auth`.
75
+ - Resolves profile policy and stores approval request in memory.
76
+ - After approval, claim via `GET /auth/:requestId?secret=...`.
77
+
78
+ ### 2) `POST /actions` + `/actions/:id/resolve` (internal — strategy engine only)
79
+
80
+ > **Note**: `/actions` routes are internal. Agents should use `POST /auth` with an optional `action` field for one-off escalation with auto-execute.
81
+
82
+ - Used internally by the strategy engine's `request_human_action` tool.
83
+ - Caller needs `action:create` to submit.
84
+ - Payload is permission-based.
85
+ - Self-escalation is blocked for `admin:*` and `action:create`.
86
+ - Approved request gets a scoped token and escrowed claim path.
87
+
88
+ ### 3) `POST /actions/token` (admin direct issuance)
89
+
90
+ Admin-only endpoint with XOR mode:
91
+
92
+ - `profile` mode: profile + optional tighten-only overrides
93
+ - `permissions` mode: explicit permissions
94
+
95
+ Exactly one mode must be supplied.
96
+
97
+ ### 4) Validation and revocation
98
+
99
+ - `POST /auth/validate` validates token status, expiry, and revocation.
100
+ - `POST /actions/tokens/revoke` forcibly removes active token trust.
101
+
102
+ ## Profile-Based Security (Current)
103
+
104
+ Built-in profile IDs (`v1`): `strict`, `dev`, `admin`.
105
+
106
+ See [AUTH.md — Built-in Profiles](AUTH.md#built-in-profiles-v1) for the full breakdown of permissions, scopes, excluded fields, TTL, and max reads per profile.
107
+
108
+ Profile resolution (`resolveProfileToEffectivePolicy`) produces:
109
+
110
+ - expanded permissions
111
+ - `credentialAccess.read` / `credentialAccess.write`
112
+ - `excludeFields`
113
+ - `ttlSeconds`
114
+ - `maxReads`
115
+ - `effectivePolicyHash`
116
+
117
+ ### Tighten-only overrides
118
+
119
+ Overrides are only allowed to reduce privilege:
120
+
121
+ - shorter TTL / fewer reads
122
+ - narrower permission scope
123
+ - narrower credential selectors
124
+ - stronger field exclusions
125
+
126
+ ## Permission Enforcement (Runtime)
127
+
128
+ Runtime enforcement always applies:
129
+
130
+ - route middleware validates signature, expiry, revocation
131
+ - permission checks (`requirePermission`, `hasAnyPermission`) gate capabilities
132
+ - `admin:*` remains privileged bypass flag where explicitly required
133
+
134
+ Profile is issuance; permission enforcement is the live guardrail.
135
+
136
+ ## Granular credential access controls
137
+
138
+ AuraMaxx supports fine-grained secret governance:
139
+
140
+ - `secret:read` and `secret:write` route gating
141
+ - credential selectors:
142
+ - `vault:agent`, `vault:primary`, `vault:*`, `*`
143
+ - `tag:<label>`
144
+ - `cred-xxxxx`
145
+ - policy TTL and `maxReads`
146
+ - per-credential/minute rate limits
147
+ - field minimization via `excludeFields`
148
+
149
+ This means permissions can say “can read secrets,” and selectors define **where** and **what field-level data** is reachable.
150
+
151
+ ### Recommended mental model
152
+
153
+ - Permissions say **action** (`read`/`write`/`totp`),
154
+ - selectors say **scope** (vault/field scope),
155
+ - TTL/limits say **time/volume**.
156
+
157
+ ## Encrypted transport boundaries
158
+
159
+ - `GET /auth/connect` returns a short-lived server public key.
160
+ - `/setup` and `/unlock` accept encrypted payloads.
161
+ - Agent token claim endpoints return `encryptedToken`.
162
+ - Secret reads return ciphertext suitable to caller key material.
163
+
164
+ This prevents plaintext secrets in transit for normal operations.
165
+
166
+ ## Strict mode and local auto-approve
167
+
168
+ Strict posture is preferred for high-trust environments.
169
+
170
+ Set strict local defaults:
171
+
172
+ - `trust.localProfile = strict`
173
+ - `trust.localAutoApprove = false`
174
+
175
+ Quick commands:
176
+
177
+ ```bash
178
+ curl -sS -X PATCH http://localhost:4242/defaults/trust.localProfile \
179
+ -H "Authorization: Bearer <admin_token>" \
180
+ -H "Content-Type: application/json" \
181
+ -d '{"value":"strict"}'
182
+
183
+ curl -sS -X PATCH http://localhost:4242/defaults/trust.localAutoApprove \
184
+ -H "Authorization: Bearer <admin_token>" \
185
+ -H "Content-Type: application/json" \
186
+ -d '{"value":false}'
187
+ ```
188
+
189
+ ## Profile creation and validation
190
+
191
+ Profiles are derived from built-ins + tighten-only overrides.
192
+
193
+ Supported override keys:
194
+
195
+ - `ttlSeconds`
196
+ - `maxReads`
197
+ - `scope`
198
+ - `readScopes`
199
+ - `writeScopes`
200
+ - `excludeFields`
201
+
202
+ Prefer preview before issuing:
203
+
204
+ - `POST /actions/token/preview`
205
+ - `auramaxx token preview --profile <id> [--profile-version v1] [--overrides '{...}']`
206
+
207
+ ## Endpoint Cheat Sheet
208
+
209
+ | Endpoint | Style | Typical use |
210
+ |---|---|---|
211
+ | `POST /auth` | Profile onboarding | Standard agent setup (human approval) |
212
+ | `GET /auth/:requestId?secret=...` | Profile claim | Agent retrieves encrypted token |
213
+ | `POST /auth/validate` | Validation | Verify token validity before use |
214
+ | `POST /actions` | Internal (strategy engine) | Temporary action request |
215
+ | `POST /actions/:id/resolve` | Internal (approval) | Human approves action request |
216
+ | `POST /actions/token` | Admin direct issue | Admin direct token issuance |
217
+ | `POST /actions/tokens/revoke` | Revocation | Immediate invalidate token |
218
+ | `POST /actions/token/preview` | Preview | Validate effective policy before issue |
219
+ | `POST /unlock` / `POST /setup` | Session bootstrap | Human local admin access |
220
+
221
+ ## Related Docs
222
+
223
+ - [Auth](AUTH.md)
224
+ - [API Authentication](./api/authentication.md)
225
+ - [API System](./api/system.md)
226
+ - [CLI](CLI.md)
227
+ - [Best Practices](./BEST-PRACTICES.md)
@@ -0,0 +1,378 @@
1
+ # Task Lifecycle — Agent PM System
2
+
3
+ Manage the task pipeline. All commands use `$TASKCTL` from the project root.
4
+
5
+ ```bash
6
+ TASKCTL="node --import tsx scripts/taskctl.ts"
7
+ ```
8
+
9
+ ---
10
+
11
+ ## How It Works
12
+
13
+ Agents work in **isolated task folders** — never touching source code directly. Changes flow through automated validation and human approval before landing in the codebase.
14
+
15
+ ```
16
+ QUEUED ──→ IN_PROGRESS ──→ REVIEW ──→ DONE
17
+ │ │
18
+ (gate fail) (reject/test fail)
19
+ │ │
20
+ ▼ ▼
21
+ QUEUED ◄────────────┘ (attempts < 3, retry)
22
+ FROZEN ◄────────────┘ (attempts >= 3, human intervenes)
23
+ ```
24
+
25
+ ### Pipeline Flow
26
+
27
+ 1. **Provision** — Task transitions to IN_PROGRESS, system copies allowed files into `{project_root}/tasks/task-{id}/changes/` and creates `/new/`
28
+ 2. **Agent works** — Modifies files in the task folder only, within spec constraints
29
+ 3. **Gate check** — Validates against allowlists, line limits, forbidden paths, dependency rules
30
+ 4. **Review** — Human reviews via dashboard or CLI preview
31
+ 5. **Swap** — Git savepoint → copy to source → run tests → commit or rollback
32
+ 6. **Conflict resolution** — After swap, other tasks touching same files get invalidated and requeued
33
+
34
+ ---
35
+
36
+ ## Statuses
37
+
38
+ | Status | Meaning |
39
+ |--------|---------|
40
+ | `OPEN` | Created, not yet queued for agents |
41
+ | `QUEUED` | Ready for agent pickup |
42
+ | `IN_PROGRESS` | Agent working in task folder |
43
+ | `REVIEW` | Gate check passed, awaiting human approval |
44
+ | `DONE` | Approved, swapped into source, archived |
45
+ | `FROZEN` | 3+ failures, needs human investigation |
46
+ | `HUMAN` | Reserved for human-only work |
47
+ | `CANCELED` | Abandoned or superseded |
48
+
49
+ ---
50
+
51
+ ## Task Folder Rules
52
+
53
+ ```
54
+ {project_root}/tasks/task-{id}/
55
+ /changes/ ← copies of allowed source files to modify
56
+ /new/ ← new files the agent creates
57
+ ```
58
+
59
+ **Agents MUST:**
60
+ - Only modify files in `changes/` that are listed in `allowed_modify`
61
+ - Only create files in `new/` matching `allowed_create` patterns
62
+ - Stay under `max_lines_changed` (default: 200)
63
+
64
+ **Agents MUST NOT:**
65
+ - Touch source code directly
66
+ - Modify files outside `allowed_modify`
67
+ - Touch `forbidden` paths (global or per-project)
68
+ - Add dependencies unless `can_add_dependencies` is true
69
+
70
+ ### Task Spec Fields
71
+
72
+ | Field | Type | Purpose |
73
+ |-------|------|---------|
74
+ | `allowed_modify` | JSON array | Files the agent may edit |
75
+ | `allowed_create` | JSON array | Glob patterns for new files |
76
+ | `max_lines_changed` | integer | Max total line diff |
77
+ | `can_add_dependencies` | boolean | Allow package.json changes |
78
+ | `module` | string | Module this task touches |
79
+ | `attempts` | integer | Rejection count |
80
+ | `last_error` | string | Last rejection reason |
81
+
82
+ ---
83
+
84
+ ## Gate Check
85
+
86
+ Automated validation that runs before a task reaches REVIEW. **Auto-rejects** if:
87
+
88
+ 1. Modified file not in `allowed_modify`
89
+ 2. Created file not matching `allowed_create` patterns
90
+ 3. File matches `forbidden` globs (global + per-project merged)
91
+ 4. Lines changed exceeds `max_lines_changed`
92
+ 5. package.json/lock file changed and `can_add_dependencies` is false
93
+
94
+ ```bash
95
+ $TASKCTL gate-check --task N [--json] # Exit 0 = pass, Exit 2 = fail
96
+ ```
97
+
98
+ API: `POST /api/tasks/{N}/gate-check` → `{ ok, passed, violations[], filesChanged[], filesCreated[], linesChanged }`
99
+
100
+ ---
101
+
102
+ ## Circuit Breaker
103
+
104
+ On rejection (gate fail, test failure, human reject):
105
+
106
+ - `attempts` increments by 1, `last_error` records reason
107
+ - **attempts < 3** → QUEUED (agent retries)
108
+ - **attempts >= 3** → FROZEN (human must investigate)
109
+
110
+ Frozen tasks require human intervention: rewrite spec + reset attempts, or kill.
111
+
112
+ ---
113
+
114
+ ## Swap
115
+
116
+ Applies an approved REVIEW task into the source tree:
117
+
118
+ 1. Creates git savepoint
119
+ 2. Copies `changes/` files into source
120
+ 3. Copies `new/` files into project
121
+ 4. Runs test command (per-project `test_command` config, 120s timeout)
122
+ 5. **Tests pass** → commit, release file locks, archive task folder → DONE
123
+ 6. **Tests fail** → rollback to savepoint, circuit breaker handles retry/freeze
124
+
125
+ ```bash
126
+ $TASKCTL swap --task N [--json] # Execute swap
127
+ $TASKCTL swap --task N --dry-run [--json] # Preview without committing
128
+ ```
129
+
130
+ API: `POST /api/tasks/{N}/swap` (body: `{ dryRun?: boolean }`) → 200 success, 422 test failure, 409 not in REVIEW
131
+
132
+ ---
133
+
134
+ ## File Locks
135
+
136
+ Tracks file ownership across concurrent tasks. First task to swap wins — conflicting tasks get invalidated and requeued.
137
+
138
+ - **Acquire** — Atomic all-or-nothing; returns conflicts if file already locked
139
+ - **Release** — Marks locks as released after swap
140
+ - **Invalidate** — After swap, other tasks on same files get requeued via circuit breaker
141
+
142
+ ```bash
143
+ $TASKCTL file-locks --task N [--json] # List active locks
144
+ $TASKCTL file-conflicts --task N [--json] # Check for overlapping locks
145
+ ```
146
+
147
+ API: `GET /api/tasks/{N}/file-locks`, `GET /api/tasks/{N}/file-conflicts`
148
+
149
+ ---
150
+
151
+ ## Preview
152
+
153
+ Temporarily copy task files into source for visual review. One preview at a time. No git operations — clean restore guaranteed.
154
+
155
+ ```bash
156
+ $TASKCTL preview-start --task N [--json] # Copy task files to source
157
+ $TASKCTL preview-stop [--json] # Restore source to original state
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Context Builder
163
+
164
+ Assembles the agent prompt when a task starts. Total must stay under 4000 lines.
165
+
166
+ Assembly order:
167
+ 1. **Framing** — Per-project `project_framing` config + task description + allowed files
168
+ 2. **ARCHITECTURE.md** — Truncated to 100 lines
169
+ 3. **Modified files** — Full content from task folder
170
+ 4. **Adjacent interfaces** — Export signatures from related files
171
+ 5. **Similar feature example** — From completed task with same module (optional)
172
+
173
+ Truncation order if over limit: example first, then adjacent interfaces.
174
+
175
+ ---
176
+
177
+ ## Orchestrator
178
+
179
+ Runs the full pipeline loop. Idempotent — safe to run repeatedly.
180
+
181
+ ```bash
182
+ node --import tsx scripts/orchestrate.ts [--dry-run] [--once] [--max-concurrent N]
183
+ ```
184
+
185
+ Loop:
186
+ 1. Picks QUEUED tasks with resolved dependencies (priority-ordered: P0 first)
187
+ 2. Transitions to IN_PROGRESS (provisions task folder)
188
+ 3. Builds agent context
189
+ 4. Gate checks agent-done tasks → REVIEW or reject
190
+ 5. Swaps human-approved tasks → DONE
191
+ 6. Invalidates conflicting file locks
192
+ 7. Sleeps 5s, repeats (unless `--once`)
193
+
194
+ ---
195
+
196
+ ## CLI Reference
197
+
198
+ ### Quick Workflow
199
+
200
+ ```bash
201
+ # Pick next task, claim it, and start
202
+ $TASKCTL pick-and-claim --owner my-agent [--tag TAG] [--json]
203
+ $TASKCTL update-task-status --task N --owner my-agent --status IN_PROGRESS [--json]
204
+
205
+ # Or use the shortcut
206
+ $TASKCTL next --owner my-agent [--json]
207
+
208
+ # When done
209
+ $TASKCTL done --task N --owner my-agent [--json]
210
+
211
+ # On failure
212
+ $TASKCTL fail --task N --owner my-agent --error "reason" [--json]
213
+ ```
214
+
215
+ ### Task Management
216
+
217
+ ```bash
218
+ # List and view
219
+ $TASKCTL list-tasks [--status S] [--tag TAG] [--json]
220
+ $TASKCTL show-task --task N [--json]
221
+ $TASKCTL my-tasks --owner O [--json]
222
+ $TASKCTL stats [--json]
223
+
224
+ # Create and edit
225
+ $TASKCTL create-task --title "..." --slug "..." [--priority P0|P1|P2] [--json]
226
+ $TASKCTL quick-create --title "..." [--json]
227
+ $TASKCTL update-task --task N --title "..." [--json]
228
+
229
+ # Status transitions
230
+ $TASKCTL update-task-status --task N --owner O --status S [--json]
231
+ $TASKCTL pick-task [--tag TAG] [--json]
232
+ $TASKCTL pick-and-claim [--tag TAG] --owner O [--json]
233
+ $TASKCTL claim-lock --task N --owner O [--json]
234
+ $TASKCTL release-lock --task N --owner O [--json]
235
+ $TASKCTL reap-stale-locks [--json]
236
+
237
+ # Tags
238
+ $TASKCTL add-tag --task N --tag T [--json]
239
+ $TASKCTL remove-tag --task N --tag T [--json]
240
+ $TASKCTL list-tags [--task N] [--json]
241
+
242
+ # Dependencies
243
+ $TASKCTL add-dep --task N --depends-on M [--json]
244
+ $TASKCTL remove-dep --task N --depends-on M [--json]
245
+ $TASKCTL list-deps --task N [--json]
246
+
247
+ # Hierarchy
248
+ $TASKCTL set-parent --task N --parent M [--json]
249
+ $TASKCTL remove-parent --task N [--json]
250
+ $TASKCTL list-subtasks --task N [--json]
251
+
252
+ # Comments
253
+ $TASKCTL comment --task N --author A --body "..." [--json]
254
+ $TASKCTL list-comments --task N [--json]
255
+
256
+ # Config (global)
257
+ $TASKCTL config-get --key K [--json]
258
+ $TASKCTL config-set --key K --value V [--json]
259
+ $TASKCTL config-list [--json]
260
+
261
+ # Templates
262
+ $TASKCTL list-templates [--json]
263
+ $TASKCTL show-template --name N [--json]
264
+ ```
265
+
266
+ ### Pipeline Commands
267
+
268
+ ```bash
269
+ # Gate check
270
+ $TASKCTL gate-check --task N [--json]
271
+
272
+ # Swap
273
+ $TASKCTL swap --task N [--dry-run] [--json]
274
+
275
+ # File locks
276
+ $TASKCTL file-locks --task N [--json]
277
+ $TASKCTL file-conflicts --task N [--json]
278
+
279
+ # Preview
280
+ $TASKCTL preview-start --task N [--json]
281
+ $TASKCTL preview-stop [--json]
282
+
283
+ # Backlog
284
+ $TASKCTL backlog-status [--json]
285
+ ```
286
+
287
+ ---
288
+
289
+ ## Config
290
+
291
+ Config is layered: **per-task spec > per-project config > global config**. Per-project can only further restrict, never loosen global rules.
292
+
293
+ ### Global Config
294
+
295
+ Set once, applies to all projects.
296
+
297
+ | Key | Default | Purpose |
298
+ |-----|---------|---------|
299
+ | `global_forbidden` | `["core/*"]` | Glob patterns no agent may touch |
300
+ | `max_concurrent_tasks` | `5` | Max tasks in IN_PROGRESS at once |
301
+ | `default_max_lines_changed` | `200` | Default line limit per task |
302
+ | `default_can_add_dependencies` | `false` | Default dependency policy |
303
+
304
+ ### Per-Project Config
305
+
306
+ Stored in `project_config` table. Overrides global for tasks scoped to that project. Falls back to global when unset.
307
+
308
+ | Key | Purpose |
309
+ |-----|---------|
310
+ | `global_forbidden` | Additional forbidden globs (merged with global) |
311
+ | `test_command` | Test runner command (e.g. `npx vitest run`, `npm test`, `pytest`) |
312
+ | `project_framing` | Context builder framing text for this project |
313
+ | `source_dir` | Source directory name (default: `src`) |
314
+ | `dashboard_port` | Dev server port for preview |
315
+
316
+ ```bash
317
+ # Set per-project config
318
+ $TASKCTL config-set --project P --key test_command --value "npm test"
319
+ $TASKCTL config-set --project P --key global_forbidden --value '["core/*","migrations/*"]'
320
+
321
+ # View merged config for a project
322
+ $TASKCTL config-list --project P
323
+ ```
324
+
325
+ ### Adding a New Project
326
+
327
+ ```bash
328
+ # Register project
329
+ $TASKCTL create-project --name "my-app" --root /path/to/my-app
330
+
331
+ # Set project-specific config
332
+ $TASKCTL config-set --project 1 --key test_command --value "npm test"
333
+ $TASKCTL config-set --project 1 --key global_forbidden --value '["core/*","db/migrations/*"]'
334
+ $TASKCTL config-set --project 1 --key project_framing --value "You are modifying a React dashboard app."
335
+ ```
336
+
337
+ ---
338
+
339
+ ## API Endpoints
340
+
341
+ | Method | Endpoint | Purpose |
342
+ |--------|----------|---------|
343
+ | GET | `/api/tasks` | List tasks (query: `status`, `q`, `limit`, `offset`) |
344
+ | GET | `/api/tasks/pick` | Pick next queued task |
345
+ | POST | `/api/tasks/create` | Create task |
346
+ | GET | `/api/tasks/{N}` | Task detail |
347
+ | POST | `/api/tasks/{N}/claim` | Acquire lock |
348
+ | POST | `/api/tasks/{N}/release` | Release lock |
349
+ | POST | `/api/tasks/{N}/transition` | Transition status |
350
+ | POST | `/api/tasks/{N}/gate-check` | Run gate check |
351
+ | POST | `/api/tasks/{N}/swap` | Execute swap |
352
+ | GET | `/api/tasks/{N}/file-locks` | List active file locks |
353
+ | GET | `/api/tasks/{N}/file-conflicts` | Check file conflicts |
354
+ | POST | `/api/tasks/{N}/tags` | Add tag |
355
+ | DELETE | `/api/tasks/{N}/tags` | Remove tag |
356
+ | GET | `/api/tasks/{N}/comments` | List comments |
357
+ | POST | `/api/tasks/{N}/comments` | Add comment |
358
+ | GET | `/api/config` | List global config |
359
+ | POST | `/api/config` | Set global config |
360
+
361
+ ---
362
+
363
+ ## Services Reference
364
+
365
+ | Service | File | Function |
366
+ |---------|------|----------|
367
+ | Task Folder | `src/core/task-folder-service.ts` | `provisionTaskFolder(dbFile, taskNum)` |
368
+ | Gate Check | `src/core/gate-check-service.ts` | `runGateCheck(dbFile, taskNum)` |
369
+ | Circuit Breaker | `src/core/circuit-breaker.ts` | `handleRejection(dbFile, taskNum, reason)` |
370
+ | Swap | `src/core/swap-service.ts` | `swapTaskIntoSrc(dbFile, taskNum, opts?)` |
371
+ | File Locks | `src/core/file-lock-service.ts` | `acquireFileLocks()`, `releaseFileLocks()`, `invalidateConflicts()` |
372
+ | Preview | `src/core/preview-service.ts` | `startPreview(dbFile, taskNum)`, `stopPreview(dbFile)` |
373
+ | Context Builder | `src/core/context-builder.ts` | `buildAgentContext(dbFile, taskNum)` |
374
+ | Orchestrator | `src/core/agent-orchestrator.ts` | `runOrchestrationLoop(dbFile, opts?)` |
375
+ | Global Config | `src/core/global-config-service.ts` | `getConfig()`, `setConfig()`, `listConfig()` |
376
+ | Project Config | `src/core/project-service.ts` | `getProjectConfig()`, `setProjectConfig()`, `listProjectConfig()` |
377
+
378
+ Full spec: `public/agent-project-management.md`
@@ -0,0 +1,36 @@
1
+ import { redirect } from 'next/navigation';
2
+ import { ApiReferencePageContent } from '../page';
3
+ import { getApiDocHref, parseApiDocFilenameFromRouteSegments } from '@/lib/api-docs';
4
+
5
+ interface ApiByPathPageProps {
6
+ params: Promise<{ doc: string[] }>;
7
+ searchParams?: Promise<{ query?: string | string[]; q?: string | string[] }>;
8
+ }
9
+
10
+ const resolveQueryParam = (value?: string | string[]) => {
11
+ if (!value) return '';
12
+ const resolved = Array.isArray(value) ? value[0] : value;
13
+ return resolved.trim();
14
+ };
15
+
16
+ const appendSearchQuery = (href: string, searchQuery: string) => {
17
+ const normalized = searchQuery.trim();
18
+ if (!normalized) return href;
19
+ const params = new URLSearchParams({ query: normalized });
20
+ return `${href}?${params.toString()}`;
21
+ };
22
+
23
+ export default async function ApiByPathPage({ params, searchParams }: ApiByPathPageProps) {
24
+ const resolvedParams = await params;
25
+ const resolvedSearchParams = searchParams ? await searchParams : undefined;
26
+ const searchQuery = resolveQueryParam(resolvedSearchParams?.query) || resolveQueryParam(resolvedSearchParams?.q);
27
+ const selectedFilename = parseApiDocFilenameFromRouteSegments(resolvedParams.doc ?? []);
28
+ const canonicalHref = getApiDocHref(selectedFilename);
29
+ const currentHref = `/api/${(resolvedParams.doc ?? []).map((segment) => encodeURIComponent(segment)).join('/')}`;
30
+
31
+ if (canonicalHref !== currentHref) {
32
+ redirect(appendSearchQuery(canonicalHref, searchQuery));
33
+ }
34
+
35
+ return <ApiReferencePageContent selectedFilename={selectedFilename} searchQuery={searchQuery} />;
36
+ }
@@ -0,0 +1,30 @@
1
+ import { NextResponse } from 'next/server';
2
+
3
+ const EXPRESS_URL = process.env.WALLET_SERVER_URL || 'http://localhost:4242';
4
+
5
+ /**
6
+ * GET /api/agent-requests
7
+ * Proxy to Express /dashboard endpoint for agent actions and tokens
8
+ * No authentication required - returns pending actions, recent history, and tokens
9
+ */
10
+ export async function GET() {
11
+ try {
12
+ const response = await fetch(`${EXPRESS_URL}/dashboard`);
13
+ const data = await response.json();
14
+
15
+ if (!response.ok) {
16
+ return NextResponse.json(
17
+ { success: false, error: data.error || 'Failed to fetch agent requests' },
18
+ { status: response.status }
19
+ );
20
+ }
21
+
22
+ return NextResponse.json(data);
23
+ } catch (error) {
24
+ console.error('[AgentDashboard] Error fetching from Express:', error);
25
+ return NextResponse.json(
26
+ { success: false, error: 'Failed to fetch agent requests' },
27
+ { status: 500 }
28
+ );
29
+ }
30
+ }