corporateai 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 (704) hide show
  1. package/.dockerignore +10 -0
  2. package/.env.example +3 -0
  3. package/.github/workflows/publish-cli.yml +49 -0
  4. package/.mailmap +1 -0
  5. package/AGENTS.md +148 -0
  6. package/CONTRIBUTING.md +75 -0
  7. package/Dockerfile +59 -0
  8. package/Dockerfile.onboard-smoke +42 -0
  9. package/LICENSE +21 -0
  10. package/README.md +93 -0
  11. package/cli/esbuild.config.mjs +11 -0
  12. package/cli/package.json +24 -0
  13. package/cli/scripts/build-cli.mjs +5 -0
  14. package/cli/src/index.ts +27 -0
  15. package/docker-compose.quickstart.yml +18 -0
  16. package/docker-compose.untrusted-review.yml +33 -0
  17. package/docker-compose.yml +38 -0
  18. package/package.json +56 -0
  19. package/patches/embedded-postgres@18.1.0-beta.16.patch +0 -0
  20. package/pnpm-workspace.yaml +4 -0
  21. package/releases/.gitkeep +0 -0
  22. package/releases/v0.0.1.md +36 -0
  23. package/releases/v0.2.7.md +15 -0
  24. package/releases/v0.3.0.md +54 -0
  25. package/releases/v0.3.1.md +55 -0
  26. package/releases/v2026.318.0.md +66 -0
  27. package/releases/v2026.325.0.md +78 -0
  28. package/report/2026-03-13-08-46-token-optimization-implementation.md +48 -0
  29. package/scripts/backup-db.sh +17 -0
  30. package/scripts/build-npm.sh +80 -0
  31. package/scripts/check-forbidden-tokens.mjs +115 -0
  32. package/scripts/clean-onboard-git.sh +14 -0
  33. package/scripts/clean-onboard-npm.sh +13 -0
  34. package/scripts/clean-onboard-ref.sh +86 -0
  35. package/scripts/create-github-release.sh +99 -0
  36. package/scripts/dev-runner-paths.mjs +38 -0
  37. package/scripts/dev-runner.mjs +606 -0
  38. package/scripts/docker-onboard-smoke.sh +306 -0
  39. package/scripts/ensure-plugin-build-deps.mjs +47 -0
  40. package/scripts/generate-company-assets.ts +365 -0
  41. package/scripts/generate-npm-package-json.mjs +113 -0
  42. package/scripts/generate-org-chart-images.ts +694 -0
  43. package/scripts/generate-org-chart-satori-comparison.ts +225 -0
  44. package/scripts/generate-ui-package-json.mjs +31 -0
  45. package/scripts/kill-dev.sh +71 -0
  46. package/scripts/migrate-inline-env-secrets.ts +126 -0
  47. package/scripts/prepare-server-ui-dist.sh +22 -0
  48. package/scripts/provision-worktree.sh +333 -0
  49. package/scripts/release-lib.sh +306 -0
  50. package/scripts/release-package-map.mjs +169 -0
  51. package/scripts/release.sh +312 -0
  52. package/scripts/rollback-latest.sh +111 -0
  53. package/scripts/smoke/openclaw-docker-ui.sh +329 -0
  54. package/scripts/smoke/openclaw-gateway-e2e.sh +954 -0
  55. package/scripts/smoke/openclaw-join.sh +295 -0
  56. package/scripts/smoke/openclaw-sse-standalone.sh +146 -0
  57. package/scripts/workspace-compat.mjs +60 -0
  58. package/server/CHANGELOG.md +130 -0
  59. package/server/package.json +96 -0
  60. package/server/scripts/copy-onboarding-assets.mjs +10 -0
  61. package/server/scripts/dev-watch.ts +33 -0
  62. package/server/src/__tests__/activity-routes.test.ts +70 -0
  63. package/server/src/__tests__/adapter-models.test.ts +105 -0
  64. package/server/src/__tests__/adapter-session-codecs.test.ts +194 -0
  65. package/server/src/__tests__/agent-auth-jwt.test.ts +79 -0
  66. package/server/src/__tests__/agent-instructions-routes.test.ts +318 -0
  67. package/server/src/__tests__/agent-instructions-service.test.ts +361 -0
  68. package/server/src/__tests__/agent-permissions-routes.test.ts +275 -0
  69. package/server/src/__tests__/agent-shortname-collision.test.ts +69 -0
  70. package/server/src/__tests__/agent-skill-contract.test.ts +50 -0
  71. package/server/src/__tests__/agent-skills-routes.test.ts +462 -0
  72. package/server/src/__tests__/app-hmr-port.test.ts +19 -0
  73. package/server/src/__tests__/approval-routes-idempotency.test.ts +110 -0
  74. package/server/src/__tests__/approvals-service.test.ts +107 -0
  75. package/server/src/__tests__/assets.test.ts +250 -0
  76. package/server/src/__tests__/attachment-types.test.ts +97 -0
  77. package/server/src/__tests__/board-mutation-guard.test.ts +105 -0
  78. package/server/src/__tests__/budgets-service.test.ts +311 -0
  79. package/server/src/__tests__/claude-local-adapter-environment.test.ts +92 -0
  80. package/server/src/__tests__/claude-local-adapter.test.ts +31 -0
  81. package/server/src/__tests__/claude-local-skill-sync.test.ts +111 -0
  82. package/server/src/__tests__/cli-auth-routes.test.ts +230 -0
  83. package/server/src/__tests__/codex-local-adapter-environment.test.ts +143 -0
  84. package/server/src/__tests__/codex-local-adapter.test.ts +253 -0
  85. package/server/src/__tests__/codex-local-execute.test.ts +391 -0
  86. package/server/src/__tests__/codex-local-skill-injection.test.ts +175 -0
  87. package/server/src/__tests__/codex-local-skill-sync.test.ts +123 -0
  88. package/server/src/__tests__/companies-route-path-guard.test.ts +56 -0
  89. package/server/src/__tests__/company-branding-route.test.ts +196 -0
  90. package/server/src/__tests__/company-portability-routes.test.ts +175 -0
  91. package/server/src/__tests__/company-portability.test.ts +2186 -0
  92. package/server/src/__tests__/company-skills-routes.test.ts +113 -0
  93. package/server/src/__tests__/company-skills.test.ts +229 -0
  94. package/server/src/__tests__/costs-service.test.ts +226 -0
  95. package/server/src/__tests__/cursor-local-adapter-environment.test.ts +196 -0
  96. package/server/src/__tests__/cursor-local-adapter.test.ts +406 -0
  97. package/server/src/__tests__/cursor-local-execute.test.ts +263 -0
  98. package/server/src/__tests__/cursor-local-skill-injection.test.ts +104 -0
  99. package/server/src/__tests__/cursor-local-skill-sync.test.ts +145 -0
  100. package/server/src/__tests__/dev-runner-paths.test.ts +25 -0
  101. package/server/src/__tests__/dev-server-status.test.ts +66 -0
  102. package/server/src/__tests__/dev-watch-ignore.test.ts +42 -0
  103. package/server/src/__tests__/documents.test.ts +29 -0
  104. package/server/src/__tests__/error-handler.test.ts +53 -0
  105. package/server/src/__tests__/execution-workspace-policy.test.ts +170 -0
  106. package/server/src/__tests__/forbidden-tokens.test.ts +77 -0
  107. package/server/src/__tests__/gemini-local-adapter-environment.test.ts +135 -0
  108. package/server/src/__tests__/gemini-local-adapter.test.ts +190 -0
  109. package/server/src/__tests__/gemini-local-execute.test.ts +172 -0
  110. package/server/src/__tests__/gemini-local-skill-sync.test.ts +90 -0
  111. package/server/src/__tests__/health.test.ts +16 -0
  112. package/server/src/__tests__/heartbeat-process-recovery.test.ts +256 -0
  113. package/server/src/__tests__/heartbeat-run-summary.test.ts +33 -0
  114. package/server/src/__tests__/heartbeat-workspace-session.test.ts +334 -0
  115. package/server/src/__tests__/helpers/embedded-postgres.ts +7 -0
  116. package/server/src/__tests__/hire-hook.test.ts +181 -0
  117. package/server/src/__tests__/instance-settings-routes.test.ts +156 -0
  118. package/server/src/__tests__/invite-accept-gateway-defaults.test.ts +119 -0
  119. package/server/src/__tests__/invite-accept-replay.test.ts +92 -0
  120. package/server/src/__tests__/invite-expiry.test.ts +10 -0
  121. package/server/src/__tests__/invite-join-grants.test.ts +57 -0
  122. package/server/src/__tests__/invite-join-manager.test.ts +33 -0
  123. package/server/src/__tests__/invite-onboarding-text.test.ts +116 -0
  124. package/server/src/__tests__/issue-comment-reopen-routes.test.ts +146 -0
  125. package/server/src/__tests__/issue-goal-fallback.test.ts +99 -0
  126. package/server/src/__tests__/issues-checkout-wakeup.test.ts +48 -0
  127. package/server/src/__tests__/issues-goal-context-routes.test.ts +187 -0
  128. package/server/src/__tests__/issues-service.test.ts +317 -0
  129. package/server/src/__tests__/issues-user-context.test.ts +113 -0
  130. package/server/src/__tests__/log-redaction.test.ts +74 -0
  131. package/server/src/__tests__/monthly-spend-service.test.ts +90 -0
  132. package/server/src/__tests__/normalize-agent-mention-token.test.ts +41 -0
  133. package/server/src/__tests__/openclaw-gateway-adapter.test.ts +626 -0
  134. package/server/src/__tests__/openclaw-invite-prompt-route.test.ts +192 -0
  135. package/server/src/__tests__/opencode-local-adapter-environment.test.ts +97 -0
  136. package/server/src/__tests__/opencode-local-adapter.test.ts +226 -0
  137. package/server/src/__tests__/opencode-local-skill-sync.test.ts +91 -0
  138. package/server/src/__tests__/paperclip-env.test.ts +58 -0
  139. package/server/src/__tests__/paperclip-skill-utils.test.ts +63 -0
  140. package/server/src/__tests__/pi-local-adapter-environment.test.ts +102 -0
  141. package/server/src/__tests__/pi-local-skill-sync.test.ts +95 -0
  142. package/server/src/__tests__/plugin-dev-watcher.test.ts +68 -0
  143. package/server/src/__tests__/plugin-worker-manager.test.ts +43 -0
  144. package/server/src/__tests__/private-hostname-guard.test.ts +56 -0
  145. package/server/src/__tests__/project-shortname-resolution.test.ts +45 -0
  146. package/server/src/__tests__/quota-windows-service.test.ts +56 -0
  147. package/server/src/__tests__/quota-windows.test.ts +1109 -0
  148. package/server/src/__tests__/redaction.test.ts +66 -0
  149. package/server/src/__tests__/routines-e2e.test.ts +276 -0
  150. package/server/src/__tests__/routines-routes.test.ts +271 -0
  151. package/server/src/__tests__/routines-service.test.ts +424 -0
  152. package/server/src/__tests__/storage-local-provider.test.ts +78 -0
  153. package/server/src/__tests__/ui-branding.test.ts +82 -0
  154. package/server/src/__tests__/work-products.test.ts +95 -0
  155. package/server/src/__tests__/workspace-runtime.test.ts +1131 -0
  156. package/server/src/__tests__/worktree-config.test.ts +426 -0
  157. package/server/src/adapters/codex-models.ts +105 -0
  158. package/server/src/adapters/cursor-models.ts +171 -0
  159. package/server/src/adapters/http/execute.ts +42 -0
  160. package/server/src/adapters/http/index.ts +21 -0
  161. package/server/src/adapters/http/test.ts +116 -0
  162. package/server/src/adapters/index.ts +18 -0
  163. package/server/src/adapters/process/execute.ts +77 -0
  164. package/server/src/adapters/process/index.ts +24 -0
  165. package/server/src/adapters/process/test.ts +89 -0
  166. package/server/src/adapters/registry.ts +225 -0
  167. package/server/src/adapters/server-utils-compat.ts +57 -0
  168. package/server/src/adapters/types.ts +30 -0
  169. package/server/src/adapters/utils.ts +48 -0
  170. package/server/src/agent-auth-jwt.ts +141 -0
  171. package/server/src/app.ts +321 -0
  172. package/server/src/attachment-types.ts +74 -0
  173. package/server/src/auth/better-auth.ts +148 -0
  174. package/server/src/board-claim.ts +150 -0
  175. package/server/src/config-file.ts +17 -0
  176. package/server/src/config.ts +260 -0
  177. package/server/src/dev-server-status.ts +103 -0
  178. package/server/src/dev-watch-ignore.ts +36 -0
  179. package/server/src/errors.ts +34 -0
  180. package/server/src/home-paths.ts +95 -0
  181. package/server/src/index.ts +799 -0
  182. package/server/src/log-redaction.ts +146 -0
  183. package/server/src/middleware/auth.ts +178 -0
  184. package/server/src/middleware/board-mutation-guard.ts +66 -0
  185. package/server/src/middleware/error-handler.ts +71 -0
  186. package/server/src/middleware/index.ts +3 -0
  187. package/server/src/middleware/logger.ts +90 -0
  188. package/server/src/middleware/private-hostname-guard.ts +92 -0
  189. package/server/src/middleware/validate.ts +9 -0
  190. package/server/src/onboarding-assets/ceo/AGENTS.md +54 -0
  191. package/server/src/onboarding-assets/ceo/HEARTBEAT.md +72 -0
  192. package/server/src/onboarding-assets/ceo/SOUL.md +33 -0
  193. package/server/src/onboarding-assets/ceo/TOOLS.md +3 -0
  194. package/server/src/onboarding-assets/default/AGENTS.md +3 -0
  195. package/server/src/paths.ts +34 -0
  196. package/server/src/realtime/live-events-ws.ts +274 -0
  197. package/server/src/redaction.ts +59 -0
  198. package/server/src/routes/access.ts +2888 -0
  199. package/server/src/routes/activity.ts +89 -0
  200. package/server/src/routes/agents.ts +2313 -0
  201. package/server/src/routes/approvals.ts +346 -0
  202. package/server/src/routes/assets.ts +341 -0
  203. package/server/src/routes/authz.ts +52 -0
  204. package/server/src/routes/companies.ts +343 -0
  205. package/server/src/routes/company-skills.ts +300 -0
  206. package/server/src/routes/costs.ts +335 -0
  207. package/server/src/routes/dashboard.ts +19 -0
  208. package/server/src/routes/execution-workspaces.ts +182 -0
  209. package/server/src/routes/goals.ts +107 -0
  210. package/server/src/routes/health.ts +94 -0
  211. package/server/src/routes/index.ts +17 -0
  212. package/server/src/routes/instance-settings.ts +95 -0
  213. package/server/src/routes/issues-checkout-wakeup.ts +14 -0
  214. package/server/src/routes/issues.ts +1680 -0
  215. package/server/src/routes/llms.ts +86 -0
  216. package/server/src/routes/org-chart-svg.ts +777 -0
  217. package/server/src/routes/plugin-ui-static.ts +497 -0
  218. package/server/src/routes/plugins.ts +2220 -0
  219. package/server/src/routes/projects.ts +295 -0
  220. package/server/src/routes/routines.ts +300 -0
  221. package/server/src/routes/secrets.ts +166 -0
  222. package/server/src/routes/sidebar-badges.ts +52 -0
  223. package/server/src/secrets/external-stub-providers.ts +32 -0
  224. package/server/src/secrets/local-encrypted-provider.ts +135 -0
  225. package/server/src/secrets/provider-registry.ts +31 -0
  226. package/server/src/secrets/types.ts +23 -0
  227. package/server/src/services/access.ts +381 -0
  228. package/server/src/services/activity-log.ts +95 -0
  229. package/server/src/services/activity.ts +164 -0
  230. package/server/src/services/agent-instructions.ts +735 -0
  231. package/server/src/services/agent-permissions.ts +27 -0
  232. package/server/src/services/agents.ts +694 -0
  233. package/server/src/services/approvals.ts +273 -0
  234. package/server/src/services/assets.ts +23 -0
  235. package/server/src/services/board-auth.ts +355 -0
  236. package/server/src/services/budgets.ts +959 -0
  237. package/server/src/services/companies.ts +313 -0
  238. package/server/src/services/company-export-readme.ts +173 -0
  239. package/server/src/services/company-portability.ts +4263 -0
  240. package/server/src/services/company-skills.ts +2356 -0
  241. package/server/src/services/costs.ts +365 -0
  242. package/server/src/services/cron.ts +373 -0
  243. package/server/src/services/dashboard.ts +110 -0
  244. package/server/src/services/default-agent-instructions.ts +27 -0
  245. package/server/src/services/documents.ts +434 -0
  246. package/server/src/services/execution-workspace-policy.ts +210 -0
  247. package/server/src/services/execution-workspaces.ts +100 -0
  248. package/server/src/services/finance.ts +135 -0
  249. package/server/src/services/goals.ts +81 -0
  250. package/server/src/services/heartbeat-run-summary.ts +35 -0
  251. package/server/src/services/heartbeat.ts +3863 -0
  252. package/server/src/services/hire-hook.ts +114 -0
  253. package/server/src/services/index.ts +32 -0
  254. package/server/src/services/instance-settings.ts +138 -0
  255. package/server/src/services/issue-approvals.ts +175 -0
  256. package/server/src/services/issue-assignment-wakeup.ts +48 -0
  257. package/server/src/services/issue-goal-fallback.ts +56 -0
  258. package/server/src/services/issues.ts +1828 -0
  259. package/server/src/services/live-events.ts +55 -0
  260. package/server/src/services/plugin-capability-validator.ts +450 -0
  261. package/server/src/services/plugin-config-validator.ts +55 -0
  262. package/server/src/services/plugin-dev-watcher.ts +339 -0
  263. package/server/src/services/plugin-event-bus.ts +413 -0
  264. package/server/src/services/plugin-host-service-cleanup.ts +59 -0
  265. package/server/src/services/plugin-host-services.ts +1132 -0
  266. package/server/src/services/plugin-job-coordinator.ts +261 -0
  267. package/server/src/services/plugin-job-scheduler.ts +753 -0
  268. package/server/src/services/plugin-job-store.ts +466 -0
  269. package/server/src/services/plugin-lifecycle.ts +822 -0
  270. package/server/src/services/plugin-loader.ts +1955 -0
  271. package/server/src/services/plugin-log-retention.ts +87 -0
  272. package/server/src/services/plugin-manifest-validator.ts +164 -0
  273. package/server/src/services/plugin-registry.ts +683 -0
  274. package/server/src/services/plugin-runtime-sandbox.ts +222 -0
  275. package/server/src/services/plugin-secrets-handler.ts +355 -0
  276. package/server/src/services/plugin-state-store.ts +238 -0
  277. package/server/src/services/plugin-stream-bus.ts +81 -0
  278. package/server/src/services/plugin-tool-dispatcher.ts +449 -0
  279. package/server/src/services/plugin-tool-registry.ts +450 -0
  280. package/server/src/services/plugin-worker-manager.ts +1343 -0
  281. package/server/src/services/projects.ts +860 -0
  282. package/server/src/services/quota-windows.ts +65 -0
  283. package/server/src/services/routines.ts +1269 -0
  284. package/server/src/services/run-log-store.ts +156 -0
  285. package/server/src/services/secrets.ts +370 -0
  286. package/server/src/services/sidebar-badges.ts +56 -0
  287. package/server/src/services/work-products.ts +124 -0
  288. package/server/src/services/workspace-operation-log-store.ts +156 -0
  289. package/server/src/services/workspace-operations.ts +262 -0
  290. package/server/src/services/workspace-runtime.ts +1565 -0
  291. package/server/src/startup-banner.ts +176 -0
  292. package/server/src/storage/index.ts +35 -0
  293. package/server/src/storage/local-disk-provider.ts +89 -0
  294. package/server/src/storage/provider-registry.ts +18 -0
  295. package/server/src/storage/s3-provider.ts +153 -0
  296. package/server/src/storage/service.ts +131 -0
  297. package/server/src/storage/types.ts +63 -0
  298. package/server/src/ui-branding.ts +217 -0
  299. package/server/src/version.ts +10 -0
  300. package/server/src/worktree-config.ts +468 -0
  301. package/server/tsconfig.json +9 -0
  302. package/server/vitest.config.ts +7 -0
  303. package/skills/paperclip/SKILL.md +365 -0
  304. package/skills/paperclip/references/api-reference.md +647 -0
  305. package/skills/paperclip/references/company-skills.md +193 -0
  306. package/skills/paperclip-create-agent/SKILL.md +142 -0
  307. package/skills/paperclip-create-agent/references/api-reference.md +105 -0
  308. package/skills/paperclip-create-plugin/SKILL.md +102 -0
  309. package/skills/para-memory-files/SKILL.md +104 -0
  310. package/skills/para-memory-files/references/schemas.md +35 -0
  311. package/tests/e2e/onboarding.spec.ts +142 -0
  312. package/tests/e2e/playwright.config.ts +35 -0
  313. package/tests/release-smoke/docker-auth-onboarding.spec.ts +141 -0
  314. package/tests/release-smoke/playwright.config.ts +28 -0
  315. package/tsconfig.base.json +18 -0
  316. package/tsconfig.json +18 -0
  317. package/ui/README.md +12 -0
  318. package/ui/components.json +21 -0
  319. package/ui/index.html +47 -0
  320. package/ui/package.json +73 -0
  321. package/ui/public/android-chrome-192x192.png +0 -0
  322. package/ui/public/android-chrome-512x512.png +0 -0
  323. package/ui/public/apple-touch-icon.png +0 -0
  324. package/ui/public/brands/opencode-logo-dark-square.svg +18 -0
  325. package/ui/public/brands/opencode-logo-light-square.svg +18 -0
  326. package/ui/public/favicon-16x16.png +0 -0
  327. package/ui/public/favicon-32x32.png +0 -0
  328. package/ui/public/favicon.ico +0 -0
  329. package/ui/public/favicon.svg +9 -0
  330. package/ui/public/site.webmanifest +30 -0
  331. package/ui/public/sprites/1-D-1.png +0 -0
  332. package/ui/public/sprites/1-D-2.png +0 -0
  333. package/ui/public/sprites/1-D-3.png +0 -0
  334. package/ui/public/sprites/1-L-1.png +0 -0
  335. package/ui/public/sprites/1-R-1.png +0 -0
  336. package/ui/public/sprites/10-D-1.png +0 -0
  337. package/ui/public/sprites/10-D-2.png +0 -0
  338. package/ui/public/sprites/10-D-3.png +0 -0
  339. package/ui/public/sprites/10-L-1.png +0 -0
  340. package/ui/public/sprites/10-R-1.png +0 -0
  341. package/ui/public/sprites/11-D-1.png +0 -0
  342. package/ui/public/sprites/11-D-2.png +0 -0
  343. package/ui/public/sprites/11-D-3.png +0 -0
  344. package/ui/public/sprites/11-L-1.png +0 -0
  345. package/ui/public/sprites/11-R-1.png +0 -0
  346. package/ui/public/sprites/12-D-1.png +0 -0
  347. package/ui/public/sprites/12-D-2.png +0 -0
  348. package/ui/public/sprites/12-D-3.png +0 -0
  349. package/ui/public/sprites/12-L-1.png +0 -0
  350. package/ui/public/sprites/12-R-1.png +0 -0
  351. package/ui/public/sprites/13-D-1.png +0 -0
  352. package/ui/public/sprites/13-D-2.png +0 -0
  353. package/ui/public/sprites/13-D-3.png +0 -0
  354. package/ui/public/sprites/13-L-1.png +0 -0
  355. package/ui/public/sprites/13-R-1.png +0 -0
  356. package/ui/public/sprites/14-D-1.png +0 -0
  357. package/ui/public/sprites/14-D-2.png +0 -0
  358. package/ui/public/sprites/14-D-3.png +0 -0
  359. package/ui/public/sprites/14-L-1.png +0 -0
  360. package/ui/public/sprites/14-R-1.png +0 -0
  361. package/ui/public/sprites/2-D-1.png +0 -0
  362. package/ui/public/sprites/2-D-2.png +0 -0
  363. package/ui/public/sprites/2-D-3.png +0 -0
  364. package/ui/public/sprites/2-L-1.png +0 -0
  365. package/ui/public/sprites/2-R-1.png +0 -0
  366. package/ui/public/sprites/3-D-1.png +0 -0
  367. package/ui/public/sprites/3-D-2.png +0 -0
  368. package/ui/public/sprites/3-D-3.png +0 -0
  369. package/ui/public/sprites/3-L-1.png +0 -0
  370. package/ui/public/sprites/3-R-1.png +0 -0
  371. package/ui/public/sprites/4-D-1.png +0 -0
  372. package/ui/public/sprites/4-D-2.png +0 -0
  373. package/ui/public/sprites/4-D-3.png +0 -0
  374. package/ui/public/sprites/4-L-1.png +0 -0
  375. package/ui/public/sprites/4-R-1.png +0 -0
  376. package/ui/public/sprites/5-D-1.png +0 -0
  377. package/ui/public/sprites/5-D-2.png +0 -0
  378. package/ui/public/sprites/5-D-3.png +0 -0
  379. package/ui/public/sprites/5-L-1.png +0 -0
  380. package/ui/public/sprites/5-R-1.png +0 -0
  381. package/ui/public/sprites/6-D-1.png +0 -0
  382. package/ui/public/sprites/6-D-2.png +0 -0
  383. package/ui/public/sprites/6-D-3.png +0 -0
  384. package/ui/public/sprites/6-L-1.png +0 -0
  385. package/ui/public/sprites/6-R-1.png +0 -0
  386. package/ui/public/sprites/7-D-1.png +0 -0
  387. package/ui/public/sprites/7-D-2.png +0 -0
  388. package/ui/public/sprites/7-D-3.png +0 -0
  389. package/ui/public/sprites/7-L-1.png +0 -0
  390. package/ui/public/sprites/7-R-1.png +0 -0
  391. package/ui/public/sprites/8-D-1.png +0 -0
  392. package/ui/public/sprites/8-D-2.png +0 -0
  393. package/ui/public/sprites/8-D-3.png +0 -0
  394. package/ui/public/sprites/8-L-1.png +0 -0
  395. package/ui/public/sprites/8-R-1.png +0 -0
  396. package/ui/public/sprites/9-D-1.png +0 -0
  397. package/ui/public/sprites/9-D-2.png +0 -0
  398. package/ui/public/sprites/9-D-3.png +0 -0
  399. package/ui/public/sprites/9-L-1.png +0 -0
  400. package/ui/public/sprites/9-R-1.png +0 -0
  401. package/ui/public/sprites/ceo-lobster.png +0 -0
  402. package/ui/public/sw.js +42 -0
  403. package/ui/public/worktree-favicon-16x16.png +0 -0
  404. package/ui/public/worktree-favicon-32x32.png +0 -0
  405. package/ui/public/worktree-favicon.ico +0 -0
  406. package/ui/public/worktree-favicon.svg +9 -0
  407. package/ui/src/App.tsx +354 -0
  408. package/ui/src/adapters/claude-local/config-fields.tsx +138 -0
  409. package/ui/src/adapters/claude-local/index.ts +13 -0
  410. package/ui/src/adapters/codex-local/config-fields.tsx +104 -0
  411. package/ui/src/adapters/codex-local/index.ts +13 -0
  412. package/ui/src/adapters/cursor/config-fields.tsx +49 -0
  413. package/ui/src/adapters/cursor/index.ts +13 -0
  414. package/ui/src/adapters/gemini-local/config-fields.tsx +51 -0
  415. package/ui/src/adapters/gemini-local/index.ts +13 -0
  416. package/ui/src/adapters/http/build-config.ts +9 -0
  417. package/ui/src/adapters/http/config-fields.tsx +38 -0
  418. package/ui/src/adapters/http/index.ts +12 -0
  419. package/ui/src/adapters/http/parse-stdout.ts +5 -0
  420. package/ui/src/adapters/index.ts +9 -0
  421. package/ui/src/adapters/local-workspace-runtime-fields.tsx +5 -0
  422. package/ui/src/adapters/openclaw-gateway/config-fields.tsx +237 -0
  423. package/ui/src/adapters/openclaw-gateway/index.ts +13 -0
  424. package/ui/src/adapters/opencode-local/config-fields.tsx +72 -0
  425. package/ui/src/adapters/opencode-local/index.ts +13 -0
  426. package/ui/src/adapters/pi-local/config-fields.tsx +49 -0
  427. package/ui/src/adapters/pi-local/index.ts +13 -0
  428. package/ui/src/adapters/process/build-config.ts +18 -0
  429. package/ui/src/adapters/process/config-fields.tsx +77 -0
  430. package/ui/src/adapters/process/index.ts +12 -0
  431. package/ui/src/adapters/process/parse-stdout.ts +5 -0
  432. package/ui/src/adapters/registry.ts +34 -0
  433. package/ui/src/adapters/runtime-json-fields.tsx +122 -0
  434. package/ui/src/adapters/transcript.test.ts +30 -0
  435. package/ui/src/adapters/transcript.ts +62 -0
  436. package/ui/src/adapters/types.ts +34 -0
  437. package/ui/src/api/access.ts +160 -0
  438. package/ui/src/api/activity.ts +37 -0
  439. package/ui/src/api/agents.ts +194 -0
  440. package/ui/src/api/approvals.ts +25 -0
  441. package/ui/src/api/assets.ts +30 -0
  442. package/ui/src/api/auth.ts +74 -0
  443. package/ui/src/api/budgets.ts +21 -0
  444. package/ui/src/api/client.ts +50 -0
  445. package/ui/src/api/companies.ts +59 -0
  446. package/ui/src/api/companySkills.ts +55 -0
  447. package/ui/src/api/costs.ts +60 -0
  448. package/ui/src/api/dashboard.ts +7 -0
  449. package/ui/src/api/execution-workspaces.ts +27 -0
  450. package/ui/src/api/goals.ts +12 -0
  451. package/ui/src/api/health.ts +41 -0
  452. package/ui/src/api/heartbeats.ts +62 -0
  453. package/ui/src/api/index.ts +18 -0
  454. package/ui/src/api/instanceSettings.ts +19 -0
  455. package/ui/src/api/issues.ts +115 -0
  456. package/ui/src/api/plugins.ts +424 -0
  457. package/ui/src/api/projects.ts +34 -0
  458. package/ui/src/api/routines.ts +59 -0
  459. package/ui/src/api/secrets.ts +26 -0
  460. package/ui/src/api/sidebarBadges.ts +7 -0
  461. package/ui/src/components/AccountingModelCard.tsx +69 -0
  462. package/ui/src/components/ActiveAgentsPanel.tsx +157 -0
  463. package/ui/src/components/ActivityCharts.tsx +264 -0
  464. package/ui/src/components/ActivityRow.tsx +147 -0
  465. package/ui/src/components/AgentActionButtons.tsx +51 -0
  466. package/ui/src/components/AgentConfigForm.tsx +1468 -0
  467. package/ui/src/components/AgentIconPicker.tsx +81 -0
  468. package/ui/src/components/AgentProperties.tsx +107 -0
  469. package/ui/src/components/ApprovalCard.tsx +107 -0
  470. package/ui/src/components/ApprovalPayload.tsx +134 -0
  471. package/ui/src/components/AsciiArtAnimation.tsx +355 -0
  472. package/ui/src/components/BillerSpendCard.tsx +146 -0
  473. package/ui/src/components/BreadcrumbBar.tsx +113 -0
  474. package/ui/src/components/BudgetIncidentCard.tsx +101 -0
  475. package/ui/src/components/BudgetPolicyCard.tsx +220 -0
  476. package/ui/src/components/BudgetSidebarMarker.tsx +13 -0
  477. package/ui/src/components/ClaudeSubscriptionPanel.tsx +141 -0
  478. package/ui/src/components/CodexSubscriptionPanel.tsx +158 -0
  479. package/ui/src/components/CommandPalette.tsx +239 -0
  480. package/ui/src/components/CommentThread.tsx +503 -0
  481. package/ui/src/components/CompanyPatternIcon.tsx +212 -0
  482. package/ui/src/components/CompanyRail.tsx +329 -0
  483. package/ui/src/components/CompanySwitcher.tsx +81 -0
  484. package/ui/src/components/CopyText.tsx +56 -0
  485. package/ui/src/components/DevRestartBanner.tsx +89 -0
  486. package/ui/src/components/EmptyState.tsx +27 -0
  487. package/ui/src/components/EntityRow.tsx +69 -0
  488. package/ui/src/components/FilterBar.tsx +39 -0
  489. package/ui/src/components/FinanceBillerCard.tsx +45 -0
  490. package/ui/src/components/FinanceKindCard.tsx +44 -0
  491. package/ui/src/components/FinanceTimelineCard.tsx +72 -0
  492. package/ui/src/components/GoalProperties.tsx +165 -0
  493. package/ui/src/components/GoalTree.tsx +118 -0
  494. package/ui/src/components/Identity.tsx +39 -0
  495. package/ui/src/components/InlineEditor.tsx +248 -0
  496. package/ui/src/components/InlineEntitySelector.tsx +206 -0
  497. package/ui/src/components/InstanceSidebar.tsx +53 -0
  498. package/ui/src/components/IssueDocumentsSection.tsx +892 -0
  499. package/ui/src/components/IssueProperties.tsx +621 -0
  500. package/ui/src/components/IssueRow.tsx +149 -0
  501. package/ui/src/components/IssueWorkspaceCard.tsx +404 -0
  502. package/ui/src/components/IssuesList.tsx +889 -0
  503. package/ui/src/components/JsonSchemaForm.tsx +1048 -0
  504. package/ui/src/components/KanbanBoard.tsx +275 -0
  505. package/ui/src/components/Layout.tsx +441 -0
  506. package/ui/src/components/LiveRunWidget.tsx +160 -0
  507. package/ui/src/components/MarkdownBody.test.tsx +50 -0
  508. package/ui/src/components/MarkdownBody.tsx +152 -0
  509. package/ui/src/components/MarkdownEditor.tsx +622 -0
  510. package/ui/src/components/MetricCard.tsx +53 -0
  511. package/ui/src/components/MobileBottomNav.tsx +123 -0
  512. package/ui/src/components/NewAgentDialog.tsx +223 -0
  513. package/ui/src/components/NewGoalDialog.tsx +283 -0
  514. package/ui/src/components/NewIssueDialog.tsx +1473 -0
  515. package/ui/src/components/NewProjectDialog.tsx +451 -0
  516. package/ui/src/components/OnboardingWizard.tsx +1392 -0
  517. package/ui/src/components/OpenCodeLogoIcon.tsx +22 -0
  518. package/ui/src/components/PackageFileTree.tsx +318 -0
  519. package/ui/src/components/PageSkeleton.tsx +180 -0
  520. package/ui/src/components/PageTabBar.tsx +45 -0
  521. package/ui/src/components/PathInstructionsModal.tsx +143 -0
  522. package/ui/src/components/PriorityIcon.tsx +77 -0
  523. package/ui/src/components/ProjectProperties.tsx +1127 -0
  524. package/ui/src/components/PropertiesPanel.tsx +29 -0
  525. package/ui/src/components/ProviderQuotaCard.tsx +417 -0
  526. package/ui/src/components/QuotaBar.tsx +65 -0
  527. package/ui/src/components/ReportsToPicker.tsx +127 -0
  528. package/ui/src/components/ScheduleEditor.tsx +344 -0
  529. package/ui/src/components/ScrollToBottom.tsx +79 -0
  530. package/ui/src/components/Sidebar.tsx +130 -0
  531. package/ui/src/components/SidebarAgents.tsx +146 -0
  532. package/ui/src/components/SidebarNavItem.tsx +92 -0
  533. package/ui/src/components/SidebarProjects.tsx +234 -0
  534. package/ui/src/components/SidebarSection.tsx +17 -0
  535. package/ui/src/components/StatusBadge.tsx +15 -0
  536. package/ui/src/components/StatusIcon.tsx +71 -0
  537. package/ui/src/components/SwipeToArchive.tsx +152 -0
  538. package/ui/src/components/ToastViewport.tsx +99 -0
  539. package/ui/src/components/WorktreeBanner.tsx +25 -0
  540. package/ui/src/components/agent-config-defaults.ts +31 -0
  541. package/ui/src/components/agent-config-primitives.tsx +476 -0
  542. package/ui/src/components/transcript/RunTranscriptView.test.tsx +84 -0
  543. package/ui/src/components/transcript/RunTranscriptView.tsx +1015 -0
  544. package/ui/src/components/transcript/useLiveRunTranscripts.ts +297 -0
  545. package/ui/src/components/ui/avatar.tsx +107 -0
  546. package/ui/src/components/ui/badge.tsx +48 -0
  547. package/ui/src/components/ui/breadcrumb.tsx +109 -0
  548. package/ui/src/components/ui/button.tsx +64 -0
  549. package/ui/src/components/ui/card.tsx +92 -0
  550. package/ui/src/components/ui/checkbox.tsx +32 -0
  551. package/ui/src/components/ui/collapsible.tsx +33 -0
  552. package/ui/src/components/ui/command.tsx +194 -0
  553. package/ui/src/components/ui/dialog.tsx +156 -0
  554. package/ui/src/components/ui/dropdown-menu.tsx +257 -0
  555. package/ui/src/components/ui/input.tsx +21 -0
  556. package/ui/src/components/ui/label.tsx +22 -0
  557. package/ui/src/components/ui/popover.tsx +88 -0
  558. package/ui/src/components/ui/scroll-area.tsx +56 -0
  559. package/ui/src/components/ui/select.tsx +188 -0
  560. package/ui/src/components/ui/separator.tsx +28 -0
  561. package/ui/src/components/ui/sheet.tsx +143 -0
  562. package/ui/src/components/ui/skeleton.tsx +13 -0
  563. package/ui/src/components/ui/tabs.tsx +89 -0
  564. package/ui/src/components/ui/textarea.tsx +18 -0
  565. package/ui/src/components/ui/tooltip.tsx +57 -0
  566. package/ui/src/components/visual-office/AgentAvatar.tsx +99 -0
  567. package/ui/src/components/visual-office/OfficeViewExact.tsx +417 -0
  568. package/ui/src/components/visual-office/i18n.ts +52 -0
  569. package/ui/src/components/visual-office/office-view/CliUsagePanel.tsx +240 -0
  570. package/ui/src/components/visual-office/office-view/VirtualPadOverlay.tsx +104 -0
  571. package/ui/src/components/visual-office/office-view/buildScene-break-room.ts +248 -0
  572. package/ui/src/components/visual-office/office-view/buildScene-ceo-hallway.ts +345 -0
  573. package/ui/src/components/visual-office/office-view/buildScene-department-agent.ts +242 -0
  574. package/ui/src/components/visual-office/office-view/buildScene-departments.ts +360 -0
  575. package/ui/src/components/visual-office/office-view/buildScene-final-layers.ts +113 -0
  576. package/ui/src/components/visual-office/office-view/buildScene-types.ts +91 -0
  577. package/ui/src/components/visual-office/office-view/buildScene.ts +232 -0
  578. package/ui/src/components/visual-office/office-view/drawing-core.ts +374 -0
  579. package/ui/src/components/visual-office/office-view/drawing-furniture-a.ts +338 -0
  580. package/ui/src/components/visual-office/office-view/drawing-furniture-b.ts +241 -0
  581. package/ui/src/components/visual-office/office-view/model.ts +301 -0
  582. package/ui/src/components/visual-office/office-view/officeTicker.ts +455 -0
  583. package/ui/src/components/visual-office/office-view/officeTickerRoomAndDelivery.ts +133 -0
  584. package/ui/src/components/visual-office/office-view/themes-locale.ts +460 -0
  585. package/ui/src/components/visual-office/office-view/useCliUsage.ts +37 -0
  586. package/ui/src/components/visual-office/office-view/useOfficeDeliveryEffects.ts +465 -0
  587. package/ui/src/components/visual-office/office-view/useOfficePixiRuntime.ts +282 -0
  588. package/ui/src/components/visual-office/types.ts +123 -0
  589. package/ui/src/context/BreadcrumbContext.tsx +44 -0
  590. package/ui/src/context/CompanyContext.tsx +151 -0
  591. package/ui/src/context/DialogContext.tsx +135 -0
  592. package/ui/src/context/LiveUpdatesProvider.test.ts +119 -0
  593. package/ui/src/context/LiveUpdatesProvider.tsx +760 -0
  594. package/ui/src/context/PanelContext.tsx +73 -0
  595. package/ui/src/context/SidebarContext.tsx +43 -0
  596. package/ui/src/context/ThemeContext.tsx +83 -0
  597. package/ui/src/context/ToastContext.tsx +172 -0
  598. package/ui/src/fixtures/runTranscriptFixtures.ts +226 -0
  599. package/ui/src/hooks/useAgentOrder.ts +105 -0
  600. package/ui/src/hooks/useAutosaveIndicator.ts +72 -0
  601. package/ui/src/hooks/useCompanyPageMemory.test.ts +90 -0
  602. package/ui/src/hooks/useCompanyPageMemory.ts +79 -0
  603. package/ui/src/hooks/useDateRange.ts +120 -0
  604. package/ui/src/hooks/useInboxBadge.ts +132 -0
  605. package/ui/src/hooks/useKeyboardShortcuts.ts +40 -0
  606. package/ui/src/hooks/useProjectOrder.ts +106 -0
  607. package/ui/src/index.css +770 -0
  608. package/ui/src/lib/agent-icons.ts +99 -0
  609. package/ui/src/lib/agent-order.ts +107 -0
  610. package/ui/src/lib/agent-skills-state.test.ts +90 -0
  611. package/ui/src/lib/agent-skills-state.ts +41 -0
  612. package/ui/src/lib/assignees.test.ts +92 -0
  613. package/ui/src/lib/assignees.ts +82 -0
  614. package/ui/src/lib/color-contrast.ts +107 -0
  615. package/ui/src/lib/company-export-selection.test.ts +41 -0
  616. package/ui/src/lib/company-export-selection.ts +57 -0
  617. package/ui/src/lib/company-page-memory.ts +65 -0
  618. package/ui/src/lib/company-portability-sidebar.test.ts +101 -0
  619. package/ui/src/lib/company-portability-sidebar.ts +62 -0
  620. package/ui/src/lib/company-routes.ts +88 -0
  621. package/ui/src/lib/company-selection.test.ts +34 -0
  622. package/ui/src/lib/company-selection.ts +18 -0
  623. package/ui/src/lib/groupBy.ts +11 -0
  624. package/ui/src/lib/inbox.test.ts +404 -0
  625. package/ui/src/lib/inbox.ts +292 -0
  626. package/ui/src/lib/instance-settings.test.ts +26 -0
  627. package/ui/src/lib/instance-settings.ts +25 -0
  628. package/ui/src/lib/issueDetailBreadcrumb.ts +24 -0
  629. package/ui/src/lib/legacy-agent-config.test.ts +40 -0
  630. package/ui/src/lib/legacy-agent-config.ts +17 -0
  631. package/ui/src/lib/mention-aware-link-node.test.ts +50 -0
  632. package/ui/src/lib/mention-aware-link-node.ts +67 -0
  633. package/ui/src/lib/mention-chips.ts +168 -0
  634. package/ui/src/lib/mention-deletion.test.ts +87 -0
  635. package/ui/src/lib/mention-deletion.ts +143 -0
  636. package/ui/src/lib/model-utils.ts +16 -0
  637. package/ui/src/lib/onboarding-goal.test.ts +22 -0
  638. package/ui/src/lib/onboarding-goal.ts +18 -0
  639. package/ui/src/lib/onboarding-launch.test.ts +131 -0
  640. package/ui/src/lib/onboarding-launch.ts +54 -0
  641. package/ui/src/lib/onboarding-route.test.ts +80 -0
  642. package/ui/src/lib/onboarding-route.ts +51 -0
  643. package/ui/src/lib/portable-files.ts +42 -0
  644. package/ui/src/lib/project-order.ts +71 -0
  645. package/ui/src/lib/queryKeys.ts +140 -0
  646. package/ui/src/lib/recent-assignees.ts +36 -0
  647. package/ui/src/lib/router.tsx +76 -0
  648. package/ui/src/lib/routine-trigger-patch.test.ts +72 -0
  649. package/ui/src/lib/routine-trigger-patch.ts +31 -0
  650. package/ui/src/lib/status-colors.ts +108 -0
  651. package/ui/src/lib/timeAgo.ts +31 -0
  652. package/ui/src/lib/utils.ts +168 -0
  653. package/ui/src/lib/worktree-branding.ts +65 -0
  654. package/ui/src/lib/zip.test.ts +289 -0
  655. package/ui/src/lib/zip.ts +284 -0
  656. package/ui/src/main.tsx +67 -0
  657. package/ui/src/pages/Activity.tsx +141 -0
  658. package/ui/src/pages/AgentDetail.tsx +4053 -0
  659. package/ui/src/pages/Agents.tsx +415 -0
  660. package/ui/src/pages/ApprovalDetail.tsx +369 -0
  661. package/ui/src/pages/Approvals.tsx +132 -0
  662. package/ui/src/pages/Auth.tsx +180 -0
  663. package/ui/src/pages/BoardClaim.tsx +125 -0
  664. package/ui/src/pages/CliAuth.tsx +184 -0
  665. package/ui/src/pages/Companies.tsx +297 -0
  666. package/ui/src/pages/CompanyExport.tsx +1019 -0
  667. package/ui/src/pages/CompanyImport.tsx +1355 -0
  668. package/ui/src/pages/CompanySettings.tsx +661 -0
  669. package/ui/src/pages/CompanySkills.tsx +1171 -0
  670. package/ui/src/pages/Costs.tsx +1103 -0
  671. package/ui/src/pages/Dashboard.tsx +388 -0
  672. package/ui/src/pages/DesignGuide.tsx +1330 -0
  673. package/ui/src/pages/ExecutionWorkspaceDetail.tsx +82 -0
  674. package/ui/src/pages/GoalDetail.tsx +197 -0
  675. package/ui/src/pages/Goals.tsx +63 -0
  676. package/ui/src/pages/Inbox.tsx +1291 -0
  677. package/ui/src/pages/InstanceExperimentalSettings.tsx +139 -0
  678. package/ui/src/pages/InstanceGeneralSettings.tsx +104 -0
  679. package/ui/src/pages/InstanceSettings.tsx +284 -0
  680. package/ui/src/pages/InviteLanding.tsx +320 -0
  681. package/ui/src/pages/IssueDetail.tsx +1201 -0
  682. package/ui/src/pages/Issues.tsx +116 -0
  683. package/ui/src/pages/MyIssues.tsx +72 -0
  684. package/ui/src/pages/NewAgent.tsx +353 -0
  685. package/ui/src/pages/NotFound.tsx +66 -0
  686. package/ui/src/pages/Org.tsx +132 -0
  687. package/ui/src/pages/OrgChart.tsx +447 -0
  688. package/ui/src/pages/PluginManager.tsx +510 -0
  689. package/ui/src/pages/PluginPage.tsx +156 -0
  690. package/ui/src/pages/PluginSettings.tsx +836 -0
  691. package/ui/src/pages/ProjectDetail.tsx +633 -0
  692. package/ui/src/pages/Projects.tsx +87 -0
  693. package/ui/src/pages/RoutineDetail.tsx +1022 -0
  694. package/ui/src/pages/Routines.tsx +661 -0
  695. package/ui/src/pages/RunTranscriptUxLab.tsx +334 -0
  696. package/ui/src/pages/VisualOffice.tsx +243 -0
  697. package/ui/src/plugins/bridge-init.ts +69 -0
  698. package/ui/src/plugins/bridge.ts +476 -0
  699. package/ui/src/plugins/launchers.tsx +834 -0
  700. package/ui/src/plugins/slots.tsx +855 -0
  701. package/ui/tsconfig.json +21 -0
  702. package/ui/vite.config.ts +23 -0
  703. package/ui/vitest.config.ts +14 -0
  704. package/vitest.config.ts +11 -0
@@ -0,0 +1,424 @@
1
+ /**
2
+ * @fileoverview Frontend API client for the Paperclip plugin system.
3
+ *
4
+ * All functions in `pluginsApi` map 1:1 to REST endpoints on
5
+ * `server/src/routes/plugins.ts`. Call sites should consume these functions
6
+ * through React Query hooks (`useQuery` / `useMutation`) and reference cache
7
+ * keys from `queryKeys.plugins.*`.
8
+ *
9
+ * @see ui/src/lib/queryKeys.ts for cache key definitions.
10
+ * @see server/src/routes/plugins.ts for endpoint implementation details.
11
+ */
12
+
13
+ import type {
14
+ PluginLauncherDeclaration,
15
+ PluginLauncherRenderContextSnapshot,
16
+ PluginUiSlotDeclaration,
17
+ PluginRecord,
18
+ PluginConfig,
19
+ PluginStatus,
20
+ } from "@corporateai/shared";
21
+ import { api } from "./client";
22
+
23
+ /**
24
+ * Normalized UI contribution record returned by `GET /api/plugins/ui-contributions`.
25
+ *
26
+ * Only populated for plugins in `ready` state that declare at least one UI slot
27
+ * or launcher. The `slots` array is sourced from `manifest.ui.slots`. The
28
+ * `launchers` array aggregates both legacy `manifest.launchers` and
29
+ * `manifest.ui.launchers`.
30
+ */
31
+ export type PluginUiContribution = {
32
+ pluginId: string;
33
+ pluginKey: string;
34
+ displayName: string;
35
+ version: string;
36
+ updatedAt?: string;
37
+ /**
38
+ * Relative filename of the UI entry module within the plugin's UI directory.
39
+ * The host constructs the full import URL as
40
+ * `/_plugins/${pluginId}/ui/${uiEntryFile}`.
41
+ */
42
+ uiEntryFile: string;
43
+ slots: PluginUiSlotDeclaration[];
44
+ launchers: PluginLauncherDeclaration[];
45
+ };
46
+
47
+ /**
48
+ * Health check result returned by `GET /api/plugins/:pluginId/health`.
49
+ *
50
+ * The `healthy` flag summarises whether all checks passed. Individual check
51
+ * results are available in `checks` for detailed diagnostics display.
52
+ */
53
+ export interface PluginHealthCheckResult {
54
+ pluginId: string;
55
+ /** The plugin's current lifecycle status at time of check. */
56
+ status: string;
57
+ /** True if all health checks passed. */
58
+ healthy: boolean;
59
+ /** Individual diagnostic check results. */
60
+ checks: Array<{
61
+ name: string;
62
+ passed: boolean;
63
+ /** Human-readable description of a failure, if any. */
64
+ message?: string;
65
+ }>;
66
+ /** The most recent error message if the plugin is in `error` state. */
67
+ lastError?: string;
68
+ }
69
+
70
+ /**
71
+ * Worker diagnostics returned as part of the dashboard response.
72
+ */
73
+ export interface PluginWorkerDiagnostics {
74
+ status: string;
75
+ pid: number | null;
76
+ uptime: number | null;
77
+ consecutiveCrashes: number;
78
+ totalCrashes: number;
79
+ pendingRequests: number;
80
+ lastCrashAt: number | null;
81
+ nextRestartAt: number | null;
82
+ }
83
+
84
+ /**
85
+ * A recent job run entry returned in the dashboard response.
86
+ */
87
+ export interface PluginDashboardJobRun {
88
+ id: string;
89
+ jobId: string;
90
+ jobKey?: string;
91
+ trigger: string;
92
+ status: string;
93
+ durationMs: number | null;
94
+ error: string | null;
95
+ startedAt: string | null;
96
+ finishedAt: string | null;
97
+ createdAt: string;
98
+ }
99
+
100
+ /**
101
+ * A recent webhook delivery entry returned in the dashboard response.
102
+ */
103
+ export interface PluginDashboardWebhookDelivery {
104
+ id: string;
105
+ webhookKey: string;
106
+ status: string;
107
+ durationMs: number | null;
108
+ error: string | null;
109
+ startedAt: string | null;
110
+ finishedAt: string | null;
111
+ createdAt: string;
112
+ }
113
+
114
+ /**
115
+ * Aggregated health dashboard data returned by `GET /api/plugins/:pluginId/dashboard`.
116
+ *
117
+ * Contains worker diagnostics, recent job runs, recent webhook deliveries,
118
+ * and the current health check result — all in a single response.
119
+ */
120
+ export interface PluginDashboardData {
121
+ pluginId: string;
122
+ /** Worker process diagnostics, or null if no worker is registered. */
123
+ worker: PluginWorkerDiagnostics | null;
124
+ /** Recent job execution history (newest first, max 10). */
125
+ recentJobRuns: PluginDashboardJobRun[];
126
+ /** Recent inbound webhook deliveries (newest first, max 10). */
127
+ recentWebhookDeliveries: PluginDashboardWebhookDelivery[];
128
+ /** Current health check results. */
129
+ health: PluginHealthCheckResult;
130
+ /** ISO 8601 timestamp when the dashboard data was generated. */
131
+ checkedAt: string;
132
+ }
133
+
134
+ export interface AvailablePluginExample {
135
+ packageName: string;
136
+ pluginKey: string;
137
+ displayName: string;
138
+ description: string;
139
+ localPath: string;
140
+ tag: "example";
141
+ }
142
+
143
+ /**
144
+ * Plugin management API client.
145
+ *
146
+ * All methods are thin wrappers around the `api` base client. They return
147
+ * promises that resolve to typed JSON responses or throw on HTTP errors.
148
+ *
149
+ * @example
150
+ * ```tsx
151
+ * // In a component:
152
+ * const { data: plugins } = useQuery({
153
+ * queryKey: queryKeys.plugins.all,
154
+ * queryFn: () => pluginsApi.list(),
155
+ * });
156
+ * ```
157
+ */
158
+ export const pluginsApi = {
159
+ /**
160
+ * List all installed plugins, optionally filtered by lifecycle status.
161
+ *
162
+ * @param status - Optional filter; must be a valid `PluginStatus` value.
163
+ * Invalid values are rejected by the server with HTTP 400.
164
+ */
165
+ list: (status?: PluginStatus) =>
166
+ api.get<PluginRecord[]>(`/plugins${status ? `?status=${status}` : ""}`),
167
+
168
+ /**
169
+ * List bundled example plugins available from the current repo checkout.
170
+ */
171
+ listExamples: () =>
172
+ api.get<AvailablePluginExample[]>("/plugins/examples"),
173
+
174
+ /**
175
+ * Fetch a single plugin record by its UUID or plugin key.
176
+ *
177
+ * @param pluginId - The plugin's UUID (from `PluginRecord.id`) or plugin key.
178
+ */
179
+ get: (pluginId: string) =>
180
+ api.get<PluginRecord>(`/plugins/${pluginId}`),
181
+
182
+ /**
183
+ * Install a plugin from npm or a local path.
184
+ *
185
+ * On success, the plugin is registered in the database and transitioned to
186
+ * `ready` state. The response is the newly created `PluginRecord`.
187
+ *
188
+ * @param params.packageName - npm package name (e.g. `@paperclip/plugin-linear`)
189
+ * or a filesystem path when `isLocalPath` is `true`.
190
+ * @param params.version - Target npm version tag/range (optional; defaults to latest).
191
+ * @param params.isLocalPath - Set to `true` when `packageName` is a local path.
192
+ */
193
+ install: (params: { packageName: string; version?: string; isLocalPath?: boolean }) =>
194
+ api.post<PluginRecord>("/plugins/install", params),
195
+
196
+ /**
197
+ * Uninstall a plugin.
198
+ *
199
+ * @param pluginId - UUID of the plugin to remove.
200
+ * @param purge - If `true`, permanently delete all plugin data (hard delete).
201
+ * Otherwise the plugin is soft-deleted with a 30-day data retention window.
202
+ */
203
+ uninstall: (pluginId: string, purge?: boolean) =>
204
+ api.delete<{ ok: boolean }>(`/plugins/${pluginId}${purge ? "?purge=true" : ""}`),
205
+
206
+ /**
207
+ * Transition a plugin from `error` state back to `ready`.
208
+ * No-ops if the plugin is already enabled.
209
+ *
210
+ * @param pluginId - UUID of the plugin to enable.
211
+ */
212
+ enable: (pluginId: string) =>
213
+ api.post<{ ok: boolean }>(`/plugins/${pluginId}/enable`, {}),
214
+
215
+ /**
216
+ * Disable a plugin (transition to `error` state with an operator sentinel).
217
+ * The plugin's worker is stopped; it will not process events until re-enabled.
218
+ *
219
+ * @param pluginId - UUID of the plugin to disable.
220
+ * @param reason - Optional human-readable reason stored in `lastError`.
221
+ */
222
+ disable: (pluginId: string, reason?: string) =>
223
+ api.post<{ ok: boolean }>(`/plugins/${pluginId}/disable`, reason ? { reason } : {}),
224
+
225
+ /**
226
+ * Run health diagnostics for a plugin.
227
+ *
228
+ * Only meaningful for plugins in `ready` state. Returns the result of all
229
+ * registered health checks. Called on a 30-second polling interval by
230
+ * {@link PluginSettings}.
231
+ *
232
+ * @param pluginId - UUID of the plugin to health-check.
233
+ */
234
+ health: (pluginId: string) =>
235
+ api.get<PluginHealthCheckResult>(`/plugins/${pluginId}/health`),
236
+
237
+ /**
238
+ * Fetch aggregated health dashboard data for a plugin.
239
+ *
240
+ * Returns worker diagnostics, recent job runs, recent webhook deliveries,
241
+ * and the current health check result in a single request. Used by the
242
+ * {@link PluginSettings} page to render the runtime dashboard section.
243
+ *
244
+ * @param pluginId - UUID of the plugin.
245
+ */
246
+ dashboard: (pluginId: string) =>
247
+ api.get<PluginDashboardData>(`/plugins/${pluginId}/dashboard`),
248
+
249
+ /**
250
+ * Fetch recent log entries for a plugin.
251
+ *
252
+ * @param pluginId - UUID of the plugin.
253
+ * @param options - Optional filters: limit, level, since.
254
+ */
255
+ logs: (pluginId: string, options?: { limit?: number; level?: string; since?: string }) => {
256
+ const params = new URLSearchParams();
257
+ if (options?.limit) params.set("limit", String(options.limit));
258
+ if (options?.level) params.set("level", options.level);
259
+ if (options?.since) params.set("since", options.since);
260
+ const qs = params.toString();
261
+ return api.get<Array<{ id: string; pluginId: string; level: string; message: string; meta: Record<string, unknown> | null; createdAt: string }>>(
262
+ `/plugins/${pluginId}/logs${qs ? `?${qs}` : ""}`,
263
+ );
264
+ },
265
+
266
+ /**
267
+ * Upgrade a plugin to a newer version.
268
+ *
269
+ * If the new version declares additional capabilities, the plugin is
270
+ * transitioned to `upgrade_pending` state awaiting operator approval.
271
+ *
272
+ * @param pluginId - UUID of the plugin to upgrade.
273
+ * @param version - Target version (optional; defaults to latest published).
274
+ */
275
+ upgrade: (pluginId: string, version?: string) =>
276
+ api.post<{ ok: boolean }>(`/plugins/${pluginId}/upgrade`, version ? { version } : {}),
277
+
278
+ /**
279
+ * Returns normalized UI contribution declarations for ready plugins.
280
+ * Used by the slot host runtime and launcher discovery surfaces.
281
+ *
282
+ * Response shape:
283
+ * - `slots`: concrete React mount declarations from `manifest.ui.slots`
284
+ * - `launchers`: host-owned entry points from `manifest.ui.launchers` plus
285
+ * the legacy top-level `manifest.launchers`
286
+ *
287
+ * @example
288
+ * ```ts
289
+ * const rows = await pluginsApi.listUiContributions();
290
+ * const toolbarLaunchers = rows.flatMap((row) =>
291
+ * row.launchers.filter((launcher) => launcher.placementZone === "toolbarButton"),
292
+ * );
293
+ * ```
294
+ */
295
+ listUiContributions: () =>
296
+ api.get<PluginUiContribution[]>("/plugins/ui-contributions"),
297
+
298
+ // ===========================================================================
299
+ // Plugin configuration endpoints
300
+ // ===========================================================================
301
+
302
+ /**
303
+ * Fetch the current configuration for a plugin.
304
+ *
305
+ * Returns the `PluginConfig` record if one exists, or `null` if the plugin
306
+ * has not yet been configured.
307
+ *
308
+ * @param pluginId - UUID of the plugin.
309
+ */
310
+ getConfig: (pluginId: string) =>
311
+ api.get<PluginConfig | null>(`/plugins/${pluginId}/config`),
312
+
313
+ /**
314
+ * Save (create or update) the configuration for a plugin.
315
+ *
316
+ * The server validates `configJson` against the plugin's `instanceConfigSchema`
317
+ * and returns the persisted `PluginConfig` record on success.
318
+ *
319
+ * @param pluginId - UUID of the plugin.
320
+ * @param configJson - Configuration values matching the plugin's `instanceConfigSchema`.
321
+ */
322
+ saveConfig: (pluginId: string, configJson: Record<string, unknown>) =>
323
+ api.post<PluginConfig>(`/plugins/${pluginId}/config`, { configJson }),
324
+
325
+ /**
326
+ * Call the plugin's `validateConfig` RPC method to test the configuration
327
+ * without persisting it.
328
+ *
329
+ * Returns `{ valid: true }` on success, or `{ valid: false, message: string }`
330
+ * when the plugin reports a validation failure.
331
+ *
332
+ * Only available when the plugin declares a `validateConfig` RPC handler.
333
+ *
334
+ * @param pluginId - UUID of the plugin.
335
+ * @param configJson - Configuration values to validate.
336
+ */
337
+ testConfig: (pluginId: string, configJson: Record<string, unknown>) =>
338
+ api.post<{ valid: boolean; message?: string }>(`/plugins/${pluginId}/config/test`, { configJson }),
339
+
340
+ // ===========================================================================
341
+ // Bridge proxy endpoints — used by the plugin UI bridge runtime
342
+ // ===========================================================================
343
+
344
+ /**
345
+ * Proxy a `getData` call from a plugin UI component to its worker backend.
346
+ *
347
+ * This is the HTTP transport for `usePluginData(key, params)`. The bridge
348
+ * runtime calls this method and maps the response into `PluginDataResult<T>`.
349
+ *
350
+ * On success, the response is `{ data: T }`.
351
+ * On failure, the response body is a `PluginBridgeError`-shaped object
352
+ * with `code`, `message`, and optional `details`.
353
+ *
354
+ * @param pluginId - UUID of the plugin whose worker should handle the request
355
+ * @param key - Plugin-defined data key (e.g. `"sync-health"`)
356
+ * @param params - Optional query parameters forwarded to the worker handler
357
+ * @param companyId - Optional company scope used for board/company access checks.
358
+ * @param renderEnvironment - Optional launcher/page snapshot forwarded for
359
+ * launcher-backed UI so workers can distinguish modal, drawer, popover, and
360
+ * page execution.
361
+ *
362
+ * Error responses:
363
+ * - `401`/`403` when auth or company access checks fail
364
+ * - `404` when the plugin or handler key does not exist
365
+ * - `409` when the plugin is not in a callable runtime state
366
+ * - `5xx` with a `PluginBridgeError`-shaped body when the worker throws
367
+ *
368
+ * @see PLUGIN_SPEC.md §13.8 — `getData`
369
+ * @see PLUGIN_SPEC.md §19.7 — Error Propagation Through The Bridge
370
+ */
371
+ bridgeGetData: (
372
+ pluginId: string,
373
+ key: string,
374
+ params?: Record<string, unknown>,
375
+ companyId?: string | null,
376
+ renderEnvironment?: PluginLauncherRenderContextSnapshot | null,
377
+ ) =>
378
+ api.post<{ data: unknown }>(`/plugins/${pluginId}/data/${encodeURIComponent(key)}`, {
379
+ companyId: companyId ?? undefined,
380
+ params,
381
+ renderEnvironment: renderEnvironment ?? undefined,
382
+ }),
383
+
384
+ /**
385
+ * Proxy a `performAction` call from a plugin UI component to its worker backend.
386
+ *
387
+ * This is the HTTP transport for `usePluginAction(key)`. The bridge runtime
388
+ * calls this method when the action function is invoked.
389
+ *
390
+ * On success, the response is `{ data: T }`.
391
+ * On failure, the response body is a `PluginBridgeError`-shaped object
392
+ * with `code`, `message`, and optional `details`.
393
+ *
394
+ * @param pluginId - UUID of the plugin whose worker should handle the request
395
+ * @param key - Plugin-defined action key (e.g. `"resync"`)
396
+ * @param params - Optional parameters forwarded to the worker handler
397
+ * @param companyId - Optional company scope used for board/company access checks.
398
+ * @param renderEnvironment - Optional launcher/page snapshot forwarded for
399
+ * launcher-backed UI so workers can distinguish modal, drawer, popover, and
400
+ * page execution.
401
+ *
402
+ * Error responses:
403
+ * - `401`/`403` when auth or company access checks fail
404
+ * - `404` when the plugin or handler key does not exist
405
+ * - `409` when the plugin is not in a callable runtime state
406
+ * - `5xx` with a `PluginBridgeError`-shaped body when the worker throws
407
+ *
408
+ * @see PLUGIN_SPEC.md §13.9 — `performAction`
409
+ * @see PLUGIN_SPEC.md §19.7 — Error Propagation Through The Bridge
410
+ */
411
+ bridgePerformAction: (
412
+ pluginId: string,
413
+ key: string,
414
+ params?: Record<string, unknown>,
415
+ companyId?: string | null,
416
+ renderEnvironment?: PluginLauncherRenderContextSnapshot | null,
417
+ ) =>
418
+ api.post<{ data: unknown }>(`/plugins/${pluginId}/actions/${encodeURIComponent(key)}`, {
419
+ companyId: companyId ?? undefined,
420
+ params,
421
+ renderEnvironment: renderEnvironment ?? undefined,
422
+ }),
423
+ };
424
+
@@ -0,0 +1,34 @@
1
+ import type { Project, ProjectWorkspace } from "@corporateai/shared";
2
+ import { api } from "./client";
3
+
4
+ function withCompanyScope(path: string, companyId?: string) {
5
+ if (!companyId) return path;
6
+ const separator = path.includes("?") ? "&" : "?";
7
+ return `${path}${separator}companyId=${encodeURIComponent(companyId)}`;
8
+ }
9
+
10
+ function projectPath(id: string, companyId?: string, suffix = "") {
11
+ return withCompanyScope(`/projects/${encodeURIComponent(id)}${suffix}`, companyId);
12
+ }
13
+
14
+ export const projectsApi = {
15
+ list: (companyId: string) => api.get<Project[]>(`/companies/${companyId}/projects`),
16
+ get: (id: string, companyId?: string) => api.get<Project>(projectPath(id, companyId)),
17
+ create: (companyId: string, data: Record<string, unknown>) =>
18
+ api.post<Project>(`/companies/${companyId}/projects`, data),
19
+ update: (id: string, data: Record<string, unknown>, companyId?: string) =>
20
+ api.patch<Project>(projectPath(id, companyId), data),
21
+ listWorkspaces: (projectId: string, companyId?: string) =>
22
+ api.get<ProjectWorkspace[]>(projectPath(projectId, companyId, "/workspaces")),
23
+ createWorkspace: (projectId: string, data: Record<string, unknown>, companyId?: string) =>
24
+ api.post<ProjectWorkspace>(projectPath(projectId, companyId, "/workspaces"), data),
25
+ updateWorkspace: (projectId: string, workspaceId: string, data: Record<string, unknown>, companyId?: string) =>
26
+ api.patch<ProjectWorkspace>(
27
+ projectPath(projectId, companyId, `/workspaces/${encodeURIComponent(workspaceId)}`),
28
+ data,
29
+ ),
30
+ removeWorkspace: (projectId: string, workspaceId: string, companyId?: string) =>
31
+ api.delete<ProjectWorkspace>(projectPath(projectId, companyId, `/workspaces/${encodeURIComponent(workspaceId)}`)),
32
+ remove: (id: string, companyId?: string) => api.delete<Project>(projectPath(id, companyId)),
33
+ };
34
+
@@ -0,0 +1,59 @@
1
+ import type {
2
+ ActivityEvent,
3
+ Routine,
4
+ RoutineDetail,
5
+ RoutineListItem,
6
+ RoutineRun,
7
+ RoutineRunSummary,
8
+ RoutineTrigger,
9
+ RoutineTriggerSecretMaterial,
10
+ } from "@corporateai/shared";
11
+ import { activityApi } from "./activity";
12
+ import { api } from "./client";
13
+
14
+ export interface RoutineTriggerResponse {
15
+ trigger: RoutineTrigger;
16
+ secretMaterial: RoutineTriggerSecretMaterial | null;
17
+ }
18
+
19
+ export interface RotateRoutineTriggerResponse {
20
+ trigger: RoutineTrigger;
21
+ secretMaterial: RoutineTriggerSecretMaterial;
22
+ }
23
+
24
+ export const routinesApi = {
25
+ list: (companyId: string) => api.get<RoutineListItem[]>(`/companies/${companyId}/routines`),
26
+ create: (companyId: string, data: Record<string, unknown>) =>
27
+ api.post<Routine>(`/companies/${companyId}/routines`, data),
28
+ get: (id: string) => api.get<RoutineDetail>(`/routines/${id}`),
29
+ update: (id: string, data: Record<string, unknown>) => api.patch<Routine>(`/routines/${id}`, data),
30
+ listRuns: (id: string, limit: number = 50) => api.get<RoutineRunSummary[]>(`/routines/${id}/runs?limit=${limit}`),
31
+ createTrigger: (id: string, data: Record<string, unknown>) =>
32
+ api.post<RoutineTriggerResponse>(`/routines/${id}/triggers`, data),
33
+ updateTrigger: (id: string, data: Record<string, unknown>) =>
34
+ api.patch<RoutineTrigger>(`/routine-triggers/${id}`, data),
35
+ deleteTrigger: (id: string) => api.delete<void>(`/routine-triggers/${id}`),
36
+ rotateTriggerSecret: (id: string) =>
37
+ api.post<RotateRoutineTriggerResponse>(`/routine-triggers/${id}/rotate-secret`, {}),
38
+ run: (id: string, data?: Record<string, unknown>) =>
39
+ api.post<RoutineRun>(`/routines/${id}/run`, data ?? {}),
40
+ activity: async (
41
+ companyId: string,
42
+ routineId: string,
43
+ related?: { triggerIds?: string[]; runIds?: string[] },
44
+ ) => {
45
+ const requests = [
46
+ activityApi.list(companyId, { entityType: "routine", entityId: routineId }),
47
+ ...(related?.triggerIds ?? []).map((triggerId) =>
48
+ activityApi.list(companyId, { entityType: "routine_trigger", entityId: triggerId })),
49
+ ...(related?.runIds ?? []).map((runId) =>
50
+ activityApi.list(companyId, { entityType: "routine_run", entityId: runId })),
51
+ ];
52
+ const events = (await Promise.all(requests)).flat();
53
+ const deduped = new Map(events.map((event) => [event.id, event]));
54
+ return [...deduped.values()].sort(
55
+ (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),
56
+ );
57
+ },
58
+ };
59
+
@@ -0,0 +1,26 @@
1
+ import type { CompanySecret, SecretProviderDescriptor, SecretProvider } from "@corporateai/shared";
2
+ import { api } from "./client";
3
+
4
+ export const secretsApi = {
5
+ list: (companyId: string) => api.get<CompanySecret[]>(`/companies/${companyId}/secrets`),
6
+ providers: (companyId: string) =>
7
+ api.get<SecretProviderDescriptor[]>(`/companies/${companyId}/secret-providers`),
8
+ create: (
9
+ companyId: string,
10
+ data: {
11
+ name: string;
12
+ value: string;
13
+ provider?: SecretProvider;
14
+ description?: string | null;
15
+ externalRef?: string | null;
16
+ },
17
+ ) => api.post<CompanySecret>(`/companies/${companyId}/secrets`, data),
18
+ rotate: (id: string, data: { value: string; externalRef?: string | null }) =>
19
+ api.post<CompanySecret>(`/secrets/${id}/rotate`, data),
20
+ update: (
21
+ id: string,
22
+ data: { name?: string; description?: string | null; externalRef?: string | null },
23
+ ) => api.patch<CompanySecret>(`/secrets/${id}`, data),
24
+ remove: (id: string) => api.delete<{ ok: true }>(`/secrets/${id}`),
25
+ };
26
+
@@ -0,0 +1,7 @@
1
+ import type { SidebarBadges } from "@corporateai/shared";
2
+ import { api } from "./client";
3
+
4
+ export const sidebarBadgesApi = {
5
+ get: (companyId: string) => api.get<SidebarBadges>(`/companies/${companyId}/sidebar-badges`),
6
+ };
7
+
@@ -0,0 +1,69 @@
1
+ import { Database, Gauge, ReceiptText } from "lucide-react";
2
+ import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
3
+
4
+ const SURFACES = [
5
+ {
6
+ title: "Inference ledger",
7
+ description: "Request-scoped usage and billed runs from cost_events.",
8
+ icon: Database,
9
+ points: ["tokens + billed dollars", "provider, biller, model", "subscription and overage aware"],
10
+ tone: "from-sky-500/12 via-sky-500/6 to-transparent",
11
+ },
12
+ {
13
+ title: "Finance ledger",
14
+ description: "Account-level charges that are not one prompt-response pair.",
15
+ icon: ReceiptText,
16
+ points: ["top-ups, refunds, fees", "Bedrock provisioned or training charges", "credit expiries and adjustments"],
17
+ tone: "from-amber-500/14 via-amber-500/6 to-transparent",
18
+ },
19
+ {
20
+ title: "Live quotas",
21
+ description: "Provider or biller windows that can stop traffic in real time.",
22
+ icon: Gauge,
23
+ points: ["provider quota windows", "biller credit systems", "errors surfaced directly"],
24
+ tone: "from-emerald-500/14 via-emerald-500/6 to-transparent",
25
+ },
26
+ ] as const;
27
+
28
+ export function AccountingModelCard() {
29
+ return (
30
+ <Card className="relative overflow-hidden border-border/70">
31
+ <div className="absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(244,114,182,0.08),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(56,189,248,0.1),transparent_32%)]" />
32
+ <CardHeader className="relative px-5 pt-5 pb-2">
33
+ <CardTitle className="text-sm font-semibold uppercase tracking-[0.22em] text-muted-foreground">
34
+ Accounting model
35
+ </CardTitle>
36
+ <CardDescription className="max-w-2xl text-sm leading-6">
37
+ Corporate now separates request-level inference usage from account-level finance events.
38
+ That keeps provider reporting honest when the biller is OpenRouter, Cloudflare, Bedrock, or another intermediary.
39
+ </CardDescription>
40
+ </CardHeader>
41
+ <CardContent className="relative grid gap-3 px-5 pb-5 md:grid-cols-3">
42
+ {SURFACES.map((surface) => {
43
+ const Icon = surface.icon;
44
+ return (
45
+ <div
46
+ key={surface.title}
47
+ className={`rounded-2xl border border-border/70 bg-gradient-to-br ${surface.tone} p-4 shadow-sm`}
48
+ >
49
+ <div className="mb-3 flex items-center gap-3">
50
+ <div className="flex h-10 w-10 items-center justify-center rounded-full border border-border/70 bg-background/80">
51
+ <Icon className="h-4 w-4 text-foreground" />
52
+ </div>
53
+ <div>
54
+ <div className="text-sm font-semibold">{surface.title}</div>
55
+ <div className="text-xs text-muted-foreground">{surface.description}</div>
56
+ </div>
57
+ </div>
58
+ <div className="space-y-1.5 text-xs text-muted-foreground">
59
+ {surface.points.map((point) => (
60
+ <div key={point}>{point}</div>
61
+ ))}
62
+ </div>
63
+ </div>
64
+ );
65
+ })}
66
+ </CardContent>
67
+ </Card>
68
+ );
69
+ }