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.
- package/.dockerignore +10 -0
- package/.env.example +3 -0
- package/.github/workflows/publish-cli.yml +49 -0
- package/.mailmap +1 -0
- package/AGENTS.md +148 -0
- package/CONTRIBUTING.md +75 -0
- package/Dockerfile +59 -0
- package/Dockerfile.onboard-smoke +42 -0
- package/LICENSE +21 -0
- package/README.md +93 -0
- package/cli/esbuild.config.mjs +11 -0
- package/cli/package.json +24 -0
- package/cli/scripts/build-cli.mjs +5 -0
- package/cli/src/index.ts +27 -0
- package/docker-compose.quickstart.yml +18 -0
- package/docker-compose.untrusted-review.yml +33 -0
- package/docker-compose.yml +38 -0
- package/package.json +56 -0
- package/patches/embedded-postgres@18.1.0-beta.16.patch +0 -0
- package/pnpm-workspace.yaml +4 -0
- package/releases/.gitkeep +0 -0
- package/releases/v0.0.1.md +36 -0
- package/releases/v0.2.7.md +15 -0
- package/releases/v0.3.0.md +54 -0
- package/releases/v0.3.1.md +55 -0
- package/releases/v2026.318.0.md +66 -0
- package/releases/v2026.325.0.md +78 -0
- package/report/2026-03-13-08-46-token-optimization-implementation.md +48 -0
- package/scripts/backup-db.sh +17 -0
- package/scripts/build-npm.sh +80 -0
- package/scripts/check-forbidden-tokens.mjs +115 -0
- package/scripts/clean-onboard-git.sh +14 -0
- package/scripts/clean-onboard-npm.sh +13 -0
- package/scripts/clean-onboard-ref.sh +86 -0
- package/scripts/create-github-release.sh +99 -0
- package/scripts/dev-runner-paths.mjs +38 -0
- package/scripts/dev-runner.mjs +606 -0
- package/scripts/docker-onboard-smoke.sh +306 -0
- package/scripts/ensure-plugin-build-deps.mjs +47 -0
- package/scripts/generate-company-assets.ts +365 -0
- package/scripts/generate-npm-package-json.mjs +113 -0
- package/scripts/generate-org-chart-images.ts +694 -0
- package/scripts/generate-org-chart-satori-comparison.ts +225 -0
- package/scripts/generate-ui-package-json.mjs +31 -0
- package/scripts/kill-dev.sh +71 -0
- package/scripts/migrate-inline-env-secrets.ts +126 -0
- package/scripts/prepare-server-ui-dist.sh +22 -0
- package/scripts/provision-worktree.sh +333 -0
- package/scripts/release-lib.sh +306 -0
- package/scripts/release-package-map.mjs +169 -0
- package/scripts/release.sh +312 -0
- package/scripts/rollback-latest.sh +111 -0
- package/scripts/smoke/openclaw-docker-ui.sh +329 -0
- package/scripts/smoke/openclaw-gateway-e2e.sh +954 -0
- package/scripts/smoke/openclaw-join.sh +295 -0
- package/scripts/smoke/openclaw-sse-standalone.sh +146 -0
- package/scripts/workspace-compat.mjs +60 -0
- package/server/CHANGELOG.md +130 -0
- package/server/package.json +96 -0
- package/server/scripts/copy-onboarding-assets.mjs +10 -0
- package/server/scripts/dev-watch.ts +33 -0
- package/server/src/__tests__/activity-routes.test.ts +70 -0
- package/server/src/__tests__/adapter-models.test.ts +105 -0
- package/server/src/__tests__/adapter-session-codecs.test.ts +194 -0
- package/server/src/__tests__/agent-auth-jwt.test.ts +79 -0
- package/server/src/__tests__/agent-instructions-routes.test.ts +318 -0
- package/server/src/__tests__/agent-instructions-service.test.ts +361 -0
- package/server/src/__tests__/agent-permissions-routes.test.ts +275 -0
- package/server/src/__tests__/agent-shortname-collision.test.ts +69 -0
- package/server/src/__tests__/agent-skill-contract.test.ts +50 -0
- package/server/src/__tests__/agent-skills-routes.test.ts +462 -0
- package/server/src/__tests__/app-hmr-port.test.ts +19 -0
- package/server/src/__tests__/approval-routes-idempotency.test.ts +110 -0
- package/server/src/__tests__/approvals-service.test.ts +107 -0
- package/server/src/__tests__/assets.test.ts +250 -0
- package/server/src/__tests__/attachment-types.test.ts +97 -0
- package/server/src/__tests__/board-mutation-guard.test.ts +105 -0
- package/server/src/__tests__/budgets-service.test.ts +311 -0
- package/server/src/__tests__/claude-local-adapter-environment.test.ts +92 -0
- package/server/src/__tests__/claude-local-adapter.test.ts +31 -0
- package/server/src/__tests__/claude-local-skill-sync.test.ts +111 -0
- package/server/src/__tests__/cli-auth-routes.test.ts +230 -0
- package/server/src/__tests__/codex-local-adapter-environment.test.ts +143 -0
- package/server/src/__tests__/codex-local-adapter.test.ts +253 -0
- package/server/src/__tests__/codex-local-execute.test.ts +391 -0
- package/server/src/__tests__/codex-local-skill-injection.test.ts +175 -0
- package/server/src/__tests__/codex-local-skill-sync.test.ts +123 -0
- package/server/src/__tests__/companies-route-path-guard.test.ts +56 -0
- package/server/src/__tests__/company-branding-route.test.ts +196 -0
- package/server/src/__tests__/company-portability-routes.test.ts +175 -0
- package/server/src/__tests__/company-portability.test.ts +2186 -0
- package/server/src/__tests__/company-skills-routes.test.ts +113 -0
- package/server/src/__tests__/company-skills.test.ts +229 -0
- package/server/src/__tests__/costs-service.test.ts +226 -0
- package/server/src/__tests__/cursor-local-adapter-environment.test.ts +196 -0
- package/server/src/__tests__/cursor-local-adapter.test.ts +406 -0
- package/server/src/__tests__/cursor-local-execute.test.ts +263 -0
- package/server/src/__tests__/cursor-local-skill-injection.test.ts +104 -0
- package/server/src/__tests__/cursor-local-skill-sync.test.ts +145 -0
- package/server/src/__tests__/dev-runner-paths.test.ts +25 -0
- package/server/src/__tests__/dev-server-status.test.ts +66 -0
- package/server/src/__tests__/dev-watch-ignore.test.ts +42 -0
- package/server/src/__tests__/documents.test.ts +29 -0
- package/server/src/__tests__/error-handler.test.ts +53 -0
- package/server/src/__tests__/execution-workspace-policy.test.ts +170 -0
- package/server/src/__tests__/forbidden-tokens.test.ts +77 -0
- package/server/src/__tests__/gemini-local-adapter-environment.test.ts +135 -0
- package/server/src/__tests__/gemini-local-adapter.test.ts +190 -0
- package/server/src/__tests__/gemini-local-execute.test.ts +172 -0
- package/server/src/__tests__/gemini-local-skill-sync.test.ts +90 -0
- package/server/src/__tests__/health.test.ts +16 -0
- package/server/src/__tests__/heartbeat-process-recovery.test.ts +256 -0
- package/server/src/__tests__/heartbeat-run-summary.test.ts +33 -0
- package/server/src/__tests__/heartbeat-workspace-session.test.ts +334 -0
- package/server/src/__tests__/helpers/embedded-postgres.ts +7 -0
- package/server/src/__tests__/hire-hook.test.ts +181 -0
- package/server/src/__tests__/instance-settings-routes.test.ts +156 -0
- package/server/src/__tests__/invite-accept-gateway-defaults.test.ts +119 -0
- package/server/src/__tests__/invite-accept-replay.test.ts +92 -0
- package/server/src/__tests__/invite-expiry.test.ts +10 -0
- package/server/src/__tests__/invite-join-grants.test.ts +57 -0
- package/server/src/__tests__/invite-join-manager.test.ts +33 -0
- package/server/src/__tests__/invite-onboarding-text.test.ts +116 -0
- package/server/src/__tests__/issue-comment-reopen-routes.test.ts +146 -0
- package/server/src/__tests__/issue-goal-fallback.test.ts +99 -0
- package/server/src/__tests__/issues-checkout-wakeup.test.ts +48 -0
- package/server/src/__tests__/issues-goal-context-routes.test.ts +187 -0
- package/server/src/__tests__/issues-service.test.ts +317 -0
- package/server/src/__tests__/issues-user-context.test.ts +113 -0
- package/server/src/__tests__/log-redaction.test.ts +74 -0
- package/server/src/__tests__/monthly-spend-service.test.ts +90 -0
- package/server/src/__tests__/normalize-agent-mention-token.test.ts +41 -0
- package/server/src/__tests__/openclaw-gateway-adapter.test.ts +626 -0
- package/server/src/__tests__/openclaw-invite-prompt-route.test.ts +192 -0
- package/server/src/__tests__/opencode-local-adapter-environment.test.ts +97 -0
- package/server/src/__tests__/opencode-local-adapter.test.ts +226 -0
- package/server/src/__tests__/opencode-local-skill-sync.test.ts +91 -0
- package/server/src/__tests__/paperclip-env.test.ts +58 -0
- package/server/src/__tests__/paperclip-skill-utils.test.ts +63 -0
- package/server/src/__tests__/pi-local-adapter-environment.test.ts +102 -0
- package/server/src/__tests__/pi-local-skill-sync.test.ts +95 -0
- package/server/src/__tests__/plugin-dev-watcher.test.ts +68 -0
- package/server/src/__tests__/plugin-worker-manager.test.ts +43 -0
- package/server/src/__tests__/private-hostname-guard.test.ts +56 -0
- package/server/src/__tests__/project-shortname-resolution.test.ts +45 -0
- package/server/src/__tests__/quota-windows-service.test.ts +56 -0
- package/server/src/__tests__/quota-windows.test.ts +1109 -0
- package/server/src/__tests__/redaction.test.ts +66 -0
- package/server/src/__tests__/routines-e2e.test.ts +276 -0
- package/server/src/__tests__/routines-routes.test.ts +271 -0
- package/server/src/__tests__/routines-service.test.ts +424 -0
- package/server/src/__tests__/storage-local-provider.test.ts +78 -0
- package/server/src/__tests__/ui-branding.test.ts +82 -0
- package/server/src/__tests__/work-products.test.ts +95 -0
- package/server/src/__tests__/workspace-runtime.test.ts +1131 -0
- package/server/src/__tests__/worktree-config.test.ts +426 -0
- package/server/src/adapters/codex-models.ts +105 -0
- package/server/src/adapters/cursor-models.ts +171 -0
- package/server/src/adapters/http/execute.ts +42 -0
- package/server/src/adapters/http/index.ts +21 -0
- package/server/src/adapters/http/test.ts +116 -0
- package/server/src/adapters/index.ts +18 -0
- package/server/src/adapters/process/execute.ts +77 -0
- package/server/src/adapters/process/index.ts +24 -0
- package/server/src/adapters/process/test.ts +89 -0
- package/server/src/adapters/registry.ts +225 -0
- package/server/src/adapters/server-utils-compat.ts +57 -0
- package/server/src/adapters/types.ts +30 -0
- package/server/src/adapters/utils.ts +48 -0
- package/server/src/agent-auth-jwt.ts +141 -0
- package/server/src/app.ts +321 -0
- package/server/src/attachment-types.ts +74 -0
- package/server/src/auth/better-auth.ts +148 -0
- package/server/src/board-claim.ts +150 -0
- package/server/src/config-file.ts +17 -0
- package/server/src/config.ts +260 -0
- package/server/src/dev-server-status.ts +103 -0
- package/server/src/dev-watch-ignore.ts +36 -0
- package/server/src/errors.ts +34 -0
- package/server/src/home-paths.ts +95 -0
- package/server/src/index.ts +799 -0
- package/server/src/log-redaction.ts +146 -0
- package/server/src/middleware/auth.ts +178 -0
- package/server/src/middleware/board-mutation-guard.ts +66 -0
- package/server/src/middleware/error-handler.ts +71 -0
- package/server/src/middleware/index.ts +3 -0
- package/server/src/middleware/logger.ts +90 -0
- package/server/src/middleware/private-hostname-guard.ts +92 -0
- package/server/src/middleware/validate.ts +9 -0
- package/server/src/onboarding-assets/ceo/AGENTS.md +54 -0
- package/server/src/onboarding-assets/ceo/HEARTBEAT.md +72 -0
- package/server/src/onboarding-assets/ceo/SOUL.md +33 -0
- package/server/src/onboarding-assets/ceo/TOOLS.md +3 -0
- package/server/src/onboarding-assets/default/AGENTS.md +3 -0
- package/server/src/paths.ts +34 -0
- package/server/src/realtime/live-events-ws.ts +274 -0
- package/server/src/redaction.ts +59 -0
- package/server/src/routes/access.ts +2888 -0
- package/server/src/routes/activity.ts +89 -0
- package/server/src/routes/agents.ts +2313 -0
- package/server/src/routes/approvals.ts +346 -0
- package/server/src/routes/assets.ts +341 -0
- package/server/src/routes/authz.ts +52 -0
- package/server/src/routes/companies.ts +343 -0
- package/server/src/routes/company-skills.ts +300 -0
- package/server/src/routes/costs.ts +335 -0
- package/server/src/routes/dashboard.ts +19 -0
- package/server/src/routes/execution-workspaces.ts +182 -0
- package/server/src/routes/goals.ts +107 -0
- package/server/src/routes/health.ts +94 -0
- package/server/src/routes/index.ts +17 -0
- package/server/src/routes/instance-settings.ts +95 -0
- package/server/src/routes/issues-checkout-wakeup.ts +14 -0
- package/server/src/routes/issues.ts +1680 -0
- package/server/src/routes/llms.ts +86 -0
- package/server/src/routes/org-chart-svg.ts +777 -0
- package/server/src/routes/plugin-ui-static.ts +497 -0
- package/server/src/routes/plugins.ts +2220 -0
- package/server/src/routes/projects.ts +295 -0
- package/server/src/routes/routines.ts +300 -0
- package/server/src/routes/secrets.ts +166 -0
- package/server/src/routes/sidebar-badges.ts +52 -0
- package/server/src/secrets/external-stub-providers.ts +32 -0
- package/server/src/secrets/local-encrypted-provider.ts +135 -0
- package/server/src/secrets/provider-registry.ts +31 -0
- package/server/src/secrets/types.ts +23 -0
- package/server/src/services/access.ts +381 -0
- package/server/src/services/activity-log.ts +95 -0
- package/server/src/services/activity.ts +164 -0
- package/server/src/services/agent-instructions.ts +735 -0
- package/server/src/services/agent-permissions.ts +27 -0
- package/server/src/services/agents.ts +694 -0
- package/server/src/services/approvals.ts +273 -0
- package/server/src/services/assets.ts +23 -0
- package/server/src/services/board-auth.ts +355 -0
- package/server/src/services/budgets.ts +959 -0
- package/server/src/services/companies.ts +313 -0
- package/server/src/services/company-export-readme.ts +173 -0
- package/server/src/services/company-portability.ts +4263 -0
- package/server/src/services/company-skills.ts +2356 -0
- package/server/src/services/costs.ts +365 -0
- package/server/src/services/cron.ts +373 -0
- package/server/src/services/dashboard.ts +110 -0
- package/server/src/services/default-agent-instructions.ts +27 -0
- package/server/src/services/documents.ts +434 -0
- package/server/src/services/execution-workspace-policy.ts +210 -0
- package/server/src/services/execution-workspaces.ts +100 -0
- package/server/src/services/finance.ts +135 -0
- package/server/src/services/goals.ts +81 -0
- package/server/src/services/heartbeat-run-summary.ts +35 -0
- package/server/src/services/heartbeat.ts +3863 -0
- package/server/src/services/hire-hook.ts +114 -0
- package/server/src/services/index.ts +32 -0
- package/server/src/services/instance-settings.ts +138 -0
- package/server/src/services/issue-approvals.ts +175 -0
- package/server/src/services/issue-assignment-wakeup.ts +48 -0
- package/server/src/services/issue-goal-fallback.ts +56 -0
- package/server/src/services/issues.ts +1828 -0
- package/server/src/services/live-events.ts +55 -0
- package/server/src/services/plugin-capability-validator.ts +450 -0
- package/server/src/services/plugin-config-validator.ts +55 -0
- package/server/src/services/plugin-dev-watcher.ts +339 -0
- package/server/src/services/plugin-event-bus.ts +413 -0
- package/server/src/services/plugin-host-service-cleanup.ts +59 -0
- package/server/src/services/plugin-host-services.ts +1132 -0
- package/server/src/services/plugin-job-coordinator.ts +261 -0
- package/server/src/services/plugin-job-scheduler.ts +753 -0
- package/server/src/services/plugin-job-store.ts +466 -0
- package/server/src/services/plugin-lifecycle.ts +822 -0
- package/server/src/services/plugin-loader.ts +1955 -0
- package/server/src/services/plugin-log-retention.ts +87 -0
- package/server/src/services/plugin-manifest-validator.ts +164 -0
- package/server/src/services/plugin-registry.ts +683 -0
- package/server/src/services/plugin-runtime-sandbox.ts +222 -0
- package/server/src/services/plugin-secrets-handler.ts +355 -0
- package/server/src/services/plugin-state-store.ts +238 -0
- package/server/src/services/plugin-stream-bus.ts +81 -0
- package/server/src/services/plugin-tool-dispatcher.ts +449 -0
- package/server/src/services/plugin-tool-registry.ts +450 -0
- package/server/src/services/plugin-worker-manager.ts +1343 -0
- package/server/src/services/projects.ts +860 -0
- package/server/src/services/quota-windows.ts +65 -0
- package/server/src/services/routines.ts +1269 -0
- package/server/src/services/run-log-store.ts +156 -0
- package/server/src/services/secrets.ts +370 -0
- package/server/src/services/sidebar-badges.ts +56 -0
- package/server/src/services/work-products.ts +124 -0
- package/server/src/services/workspace-operation-log-store.ts +156 -0
- package/server/src/services/workspace-operations.ts +262 -0
- package/server/src/services/workspace-runtime.ts +1565 -0
- package/server/src/startup-banner.ts +176 -0
- package/server/src/storage/index.ts +35 -0
- package/server/src/storage/local-disk-provider.ts +89 -0
- package/server/src/storage/provider-registry.ts +18 -0
- package/server/src/storage/s3-provider.ts +153 -0
- package/server/src/storage/service.ts +131 -0
- package/server/src/storage/types.ts +63 -0
- package/server/src/ui-branding.ts +217 -0
- package/server/src/version.ts +10 -0
- package/server/src/worktree-config.ts +468 -0
- package/server/tsconfig.json +9 -0
- package/server/vitest.config.ts +7 -0
- package/skills/paperclip/SKILL.md +365 -0
- package/skills/paperclip/references/api-reference.md +647 -0
- package/skills/paperclip/references/company-skills.md +193 -0
- package/skills/paperclip-create-agent/SKILL.md +142 -0
- package/skills/paperclip-create-agent/references/api-reference.md +105 -0
- package/skills/paperclip-create-plugin/SKILL.md +102 -0
- package/skills/para-memory-files/SKILL.md +104 -0
- package/skills/para-memory-files/references/schemas.md +35 -0
- package/tests/e2e/onboarding.spec.ts +142 -0
- package/tests/e2e/playwright.config.ts +35 -0
- package/tests/release-smoke/docker-auth-onboarding.spec.ts +141 -0
- package/tests/release-smoke/playwright.config.ts +28 -0
- package/tsconfig.base.json +18 -0
- package/tsconfig.json +18 -0
- package/ui/README.md +12 -0
- package/ui/components.json +21 -0
- package/ui/index.html +47 -0
- package/ui/package.json +73 -0
- package/ui/public/android-chrome-192x192.png +0 -0
- package/ui/public/android-chrome-512x512.png +0 -0
- package/ui/public/apple-touch-icon.png +0 -0
- package/ui/public/brands/opencode-logo-dark-square.svg +18 -0
- package/ui/public/brands/opencode-logo-light-square.svg +18 -0
- package/ui/public/favicon-16x16.png +0 -0
- package/ui/public/favicon-32x32.png +0 -0
- package/ui/public/favicon.ico +0 -0
- package/ui/public/favicon.svg +9 -0
- package/ui/public/site.webmanifest +30 -0
- package/ui/public/sprites/1-D-1.png +0 -0
- package/ui/public/sprites/1-D-2.png +0 -0
- package/ui/public/sprites/1-D-3.png +0 -0
- package/ui/public/sprites/1-L-1.png +0 -0
- package/ui/public/sprites/1-R-1.png +0 -0
- package/ui/public/sprites/10-D-1.png +0 -0
- package/ui/public/sprites/10-D-2.png +0 -0
- package/ui/public/sprites/10-D-3.png +0 -0
- package/ui/public/sprites/10-L-1.png +0 -0
- package/ui/public/sprites/10-R-1.png +0 -0
- package/ui/public/sprites/11-D-1.png +0 -0
- package/ui/public/sprites/11-D-2.png +0 -0
- package/ui/public/sprites/11-D-3.png +0 -0
- package/ui/public/sprites/11-L-1.png +0 -0
- package/ui/public/sprites/11-R-1.png +0 -0
- package/ui/public/sprites/12-D-1.png +0 -0
- package/ui/public/sprites/12-D-2.png +0 -0
- package/ui/public/sprites/12-D-3.png +0 -0
- package/ui/public/sprites/12-L-1.png +0 -0
- package/ui/public/sprites/12-R-1.png +0 -0
- package/ui/public/sprites/13-D-1.png +0 -0
- package/ui/public/sprites/13-D-2.png +0 -0
- package/ui/public/sprites/13-D-3.png +0 -0
- package/ui/public/sprites/13-L-1.png +0 -0
- package/ui/public/sprites/13-R-1.png +0 -0
- package/ui/public/sprites/14-D-1.png +0 -0
- package/ui/public/sprites/14-D-2.png +0 -0
- package/ui/public/sprites/14-D-3.png +0 -0
- package/ui/public/sprites/14-L-1.png +0 -0
- package/ui/public/sprites/14-R-1.png +0 -0
- package/ui/public/sprites/2-D-1.png +0 -0
- package/ui/public/sprites/2-D-2.png +0 -0
- package/ui/public/sprites/2-D-3.png +0 -0
- package/ui/public/sprites/2-L-1.png +0 -0
- package/ui/public/sprites/2-R-1.png +0 -0
- package/ui/public/sprites/3-D-1.png +0 -0
- package/ui/public/sprites/3-D-2.png +0 -0
- package/ui/public/sprites/3-D-3.png +0 -0
- package/ui/public/sprites/3-L-1.png +0 -0
- package/ui/public/sprites/3-R-1.png +0 -0
- package/ui/public/sprites/4-D-1.png +0 -0
- package/ui/public/sprites/4-D-2.png +0 -0
- package/ui/public/sprites/4-D-3.png +0 -0
- package/ui/public/sprites/4-L-1.png +0 -0
- package/ui/public/sprites/4-R-1.png +0 -0
- package/ui/public/sprites/5-D-1.png +0 -0
- package/ui/public/sprites/5-D-2.png +0 -0
- package/ui/public/sprites/5-D-3.png +0 -0
- package/ui/public/sprites/5-L-1.png +0 -0
- package/ui/public/sprites/5-R-1.png +0 -0
- package/ui/public/sprites/6-D-1.png +0 -0
- package/ui/public/sprites/6-D-2.png +0 -0
- package/ui/public/sprites/6-D-3.png +0 -0
- package/ui/public/sprites/6-L-1.png +0 -0
- package/ui/public/sprites/6-R-1.png +0 -0
- package/ui/public/sprites/7-D-1.png +0 -0
- package/ui/public/sprites/7-D-2.png +0 -0
- package/ui/public/sprites/7-D-3.png +0 -0
- package/ui/public/sprites/7-L-1.png +0 -0
- package/ui/public/sprites/7-R-1.png +0 -0
- package/ui/public/sprites/8-D-1.png +0 -0
- package/ui/public/sprites/8-D-2.png +0 -0
- package/ui/public/sprites/8-D-3.png +0 -0
- package/ui/public/sprites/8-L-1.png +0 -0
- package/ui/public/sprites/8-R-1.png +0 -0
- package/ui/public/sprites/9-D-1.png +0 -0
- package/ui/public/sprites/9-D-2.png +0 -0
- package/ui/public/sprites/9-D-3.png +0 -0
- package/ui/public/sprites/9-L-1.png +0 -0
- package/ui/public/sprites/9-R-1.png +0 -0
- package/ui/public/sprites/ceo-lobster.png +0 -0
- package/ui/public/sw.js +42 -0
- package/ui/public/worktree-favicon-16x16.png +0 -0
- package/ui/public/worktree-favicon-32x32.png +0 -0
- package/ui/public/worktree-favicon.ico +0 -0
- package/ui/public/worktree-favicon.svg +9 -0
- package/ui/src/App.tsx +354 -0
- package/ui/src/adapters/claude-local/config-fields.tsx +138 -0
- package/ui/src/adapters/claude-local/index.ts +13 -0
- package/ui/src/adapters/codex-local/config-fields.tsx +104 -0
- package/ui/src/adapters/codex-local/index.ts +13 -0
- package/ui/src/adapters/cursor/config-fields.tsx +49 -0
- package/ui/src/adapters/cursor/index.ts +13 -0
- package/ui/src/adapters/gemini-local/config-fields.tsx +51 -0
- package/ui/src/adapters/gemini-local/index.ts +13 -0
- package/ui/src/adapters/http/build-config.ts +9 -0
- package/ui/src/adapters/http/config-fields.tsx +38 -0
- package/ui/src/adapters/http/index.ts +12 -0
- package/ui/src/adapters/http/parse-stdout.ts +5 -0
- package/ui/src/adapters/index.ts +9 -0
- package/ui/src/adapters/local-workspace-runtime-fields.tsx +5 -0
- package/ui/src/adapters/openclaw-gateway/config-fields.tsx +237 -0
- package/ui/src/adapters/openclaw-gateway/index.ts +13 -0
- package/ui/src/adapters/opencode-local/config-fields.tsx +72 -0
- package/ui/src/adapters/opencode-local/index.ts +13 -0
- package/ui/src/adapters/pi-local/config-fields.tsx +49 -0
- package/ui/src/adapters/pi-local/index.ts +13 -0
- package/ui/src/adapters/process/build-config.ts +18 -0
- package/ui/src/adapters/process/config-fields.tsx +77 -0
- package/ui/src/adapters/process/index.ts +12 -0
- package/ui/src/adapters/process/parse-stdout.ts +5 -0
- package/ui/src/adapters/registry.ts +34 -0
- package/ui/src/adapters/runtime-json-fields.tsx +122 -0
- package/ui/src/adapters/transcript.test.ts +30 -0
- package/ui/src/adapters/transcript.ts +62 -0
- package/ui/src/adapters/types.ts +34 -0
- package/ui/src/api/access.ts +160 -0
- package/ui/src/api/activity.ts +37 -0
- package/ui/src/api/agents.ts +194 -0
- package/ui/src/api/approvals.ts +25 -0
- package/ui/src/api/assets.ts +30 -0
- package/ui/src/api/auth.ts +74 -0
- package/ui/src/api/budgets.ts +21 -0
- package/ui/src/api/client.ts +50 -0
- package/ui/src/api/companies.ts +59 -0
- package/ui/src/api/companySkills.ts +55 -0
- package/ui/src/api/costs.ts +60 -0
- package/ui/src/api/dashboard.ts +7 -0
- package/ui/src/api/execution-workspaces.ts +27 -0
- package/ui/src/api/goals.ts +12 -0
- package/ui/src/api/health.ts +41 -0
- package/ui/src/api/heartbeats.ts +62 -0
- package/ui/src/api/index.ts +18 -0
- package/ui/src/api/instanceSettings.ts +19 -0
- package/ui/src/api/issues.ts +115 -0
- package/ui/src/api/plugins.ts +424 -0
- package/ui/src/api/projects.ts +34 -0
- package/ui/src/api/routines.ts +59 -0
- package/ui/src/api/secrets.ts +26 -0
- package/ui/src/api/sidebarBadges.ts +7 -0
- package/ui/src/components/AccountingModelCard.tsx +69 -0
- package/ui/src/components/ActiveAgentsPanel.tsx +157 -0
- package/ui/src/components/ActivityCharts.tsx +264 -0
- package/ui/src/components/ActivityRow.tsx +147 -0
- package/ui/src/components/AgentActionButtons.tsx +51 -0
- package/ui/src/components/AgentConfigForm.tsx +1468 -0
- package/ui/src/components/AgentIconPicker.tsx +81 -0
- package/ui/src/components/AgentProperties.tsx +107 -0
- package/ui/src/components/ApprovalCard.tsx +107 -0
- package/ui/src/components/ApprovalPayload.tsx +134 -0
- package/ui/src/components/AsciiArtAnimation.tsx +355 -0
- package/ui/src/components/BillerSpendCard.tsx +146 -0
- package/ui/src/components/BreadcrumbBar.tsx +113 -0
- package/ui/src/components/BudgetIncidentCard.tsx +101 -0
- package/ui/src/components/BudgetPolicyCard.tsx +220 -0
- package/ui/src/components/BudgetSidebarMarker.tsx +13 -0
- package/ui/src/components/ClaudeSubscriptionPanel.tsx +141 -0
- package/ui/src/components/CodexSubscriptionPanel.tsx +158 -0
- package/ui/src/components/CommandPalette.tsx +239 -0
- package/ui/src/components/CommentThread.tsx +503 -0
- package/ui/src/components/CompanyPatternIcon.tsx +212 -0
- package/ui/src/components/CompanyRail.tsx +329 -0
- package/ui/src/components/CompanySwitcher.tsx +81 -0
- package/ui/src/components/CopyText.tsx +56 -0
- package/ui/src/components/DevRestartBanner.tsx +89 -0
- package/ui/src/components/EmptyState.tsx +27 -0
- package/ui/src/components/EntityRow.tsx +69 -0
- package/ui/src/components/FilterBar.tsx +39 -0
- package/ui/src/components/FinanceBillerCard.tsx +45 -0
- package/ui/src/components/FinanceKindCard.tsx +44 -0
- package/ui/src/components/FinanceTimelineCard.tsx +72 -0
- package/ui/src/components/GoalProperties.tsx +165 -0
- package/ui/src/components/GoalTree.tsx +118 -0
- package/ui/src/components/Identity.tsx +39 -0
- package/ui/src/components/InlineEditor.tsx +248 -0
- package/ui/src/components/InlineEntitySelector.tsx +206 -0
- package/ui/src/components/InstanceSidebar.tsx +53 -0
- package/ui/src/components/IssueDocumentsSection.tsx +892 -0
- package/ui/src/components/IssueProperties.tsx +621 -0
- package/ui/src/components/IssueRow.tsx +149 -0
- package/ui/src/components/IssueWorkspaceCard.tsx +404 -0
- package/ui/src/components/IssuesList.tsx +889 -0
- package/ui/src/components/JsonSchemaForm.tsx +1048 -0
- package/ui/src/components/KanbanBoard.tsx +275 -0
- package/ui/src/components/Layout.tsx +441 -0
- package/ui/src/components/LiveRunWidget.tsx +160 -0
- package/ui/src/components/MarkdownBody.test.tsx +50 -0
- package/ui/src/components/MarkdownBody.tsx +152 -0
- package/ui/src/components/MarkdownEditor.tsx +622 -0
- package/ui/src/components/MetricCard.tsx +53 -0
- package/ui/src/components/MobileBottomNav.tsx +123 -0
- package/ui/src/components/NewAgentDialog.tsx +223 -0
- package/ui/src/components/NewGoalDialog.tsx +283 -0
- package/ui/src/components/NewIssueDialog.tsx +1473 -0
- package/ui/src/components/NewProjectDialog.tsx +451 -0
- package/ui/src/components/OnboardingWizard.tsx +1392 -0
- package/ui/src/components/OpenCodeLogoIcon.tsx +22 -0
- package/ui/src/components/PackageFileTree.tsx +318 -0
- package/ui/src/components/PageSkeleton.tsx +180 -0
- package/ui/src/components/PageTabBar.tsx +45 -0
- package/ui/src/components/PathInstructionsModal.tsx +143 -0
- package/ui/src/components/PriorityIcon.tsx +77 -0
- package/ui/src/components/ProjectProperties.tsx +1127 -0
- package/ui/src/components/PropertiesPanel.tsx +29 -0
- package/ui/src/components/ProviderQuotaCard.tsx +417 -0
- package/ui/src/components/QuotaBar.tsx +65 -0
- package/ui/src/components/ReportsToPicker.tsx +127 -0
- package/ui/src/components/ScheduleEditor.tsx +344 -0
- package/ui/src/components/ScrollToBottom.tsx +79 -0
- package/ui/src/components/Sidebar.tsx +130 -0
- package/ui/src/components/SidebarAgents.tsx +146 -0
- package/ui/src/components/SidebarNavItem.tsx +92 -0
- package/ui/src/components/SidebarProjects.tsx +234 -0
- package/ui/src/components/SidebarSection.tsx +17 -0
- package/ui/src/components/StatusBadge.tsx +15 -0
- package/ui/src/components/StatusIcon.tsx +71 -0
- package/ui/src/components/SwipeToArchive.tsx +152 -0
- package/ui/src/components/ToastViewport.tsx +99 -0
- package/ui/src/components/WorktreeBanner.tsx +25 -0
- package/ui/src/components/agent-config-defaults.ts +31 -0
- package/ui/src/components/agent-config-primitives.tsx +476 -0
- package/ui/src/components/transcript/RunTranscriptView.test.tsx +84 -0
- package/ui/src/components/transcript/RunTranscriptView.tsx +1015 -0
- package/ui/src/components/transcript/useLiveRunTranscripts.ts +297 -0
- package/ui/src/components/ui/avatar.tsx +107 -0
- package/ui/src/components/ui/badge.tsx +48 -0
- package/ui/src/components/ui/breadcrumb.tsx +109 -0
- package/ui/src/components/ui/button.tsx +64 -0
- package/ui/src/components/ui/card.tsx +92 -0
- package/ui/src/components/ui/checkbox.tsx +32 -0
- package/ui/src/components/ui/collapsible.tsx +33 -0
- package/ui/src/components/ui/command.tsx +194 -0
- package/ui/src/components/ui/dialog.tsx +156 -0
- package/ui/src/components/ui/dropdown-menu.tsx +257 -0
- package/ui/src/components/ui/input.tsx +21 -0
- package/ui/src/components/ui/label.tsx +22 -0
- package/ui/src/components/ui/popover.tsx +88 -0
- package/ui/src/components/ui/scroll-area.tsx +56 -0
- package/ui/src/components/ui/select.tsx +188 -0
- package/ui/src/components/ui/separator.tsx +28 -0
- package/ui/src/components/ui/sheet.tsx +143 -0
- package/ui/src/components/ui/skeleton.tsx +13 -0
- package/ui/src/components/ui/tabs.tsx +89 -0
- package/ui/src/components/ui/textarea.tsx +18 -0
- package/ui/src/components/ui/tooltip.tsx +57 -0
- package/ui/src/components/visual-office/AgentAvatar.tsx +99 -0
- package/ui/src/components/visual-office/OfficeViewExact.tsx +417 -0
- package/ui/src/components/visual-office/i18n.ts +52 -0
- package/ui/src/components/visual-office/office-view/CliUsagePanel.tsx +240 -0
- package/ui/src/components/visual-office/office-view/VirtualPadOverlay.tsx +104 -0
- package/ui/src/components/visual-office/office-view/buildScene-break-room.ts +248 -0
- package/ui/src/components/visual-office/office-view/buildScene-ceo-hallway.ts +345 -0
- package/ui/src/components/visual-office/office-view/buildScene-department-agent.ts +242 -0
- package/ui/src/components/visual-office/office-view/buildScene-departments.ts +360 -0
- package/ui/src/components/visual-office/office-view/buildScene-final-layers.ts +113 -0
- package/ui/src/components/visual-office/office-view/buildScene-types.ts +91 -0
- package/ui/src/components/visual-office/office-view/buildScene.ts +232 -0
- package/ui/src/components/visual-office/office-view/drawing-core.ts +374 -0
- package/ui/src/components/visual-office/office-view/drawing-furniture-a.ts +338 -0
- package/ui/src/components/visual-office/office-view/drawing-furniture-b.ts +241 -0
- package/ui/src/components/visual-office/office-view/model.ts +301 -0
- package/ui/src/components/visual-office/office-view/officeTicker.ts +455 -0
- package/ui/src/components/visual-office/office-view/officeTickerRoomAndDelivery.ts +133 -0
- package/ui/src/components/visual-office/office-view/themes-locale.ts +460 -0
- package/ui/src/components/visual-office/office-view/useCliUsage.ts +37 -0
- package/ui/src/components/visual-office/office-view/useOfficeDeliveryEffects.ts +465 -0
- package/ui/src/components/visual-office/office-view/useOfficePixiRuntime.ts +282 -0
- package/ui/src/components/visual-office/types.ts +123 -0
- package/ui/src/context/BreadcrumbContext.tsx +44 -0
- package/ui/src/context/CompanyContext.tsx +151 -0
- package/ui/src/context/DialogContext.tsx +135 -0
- package/ui/src/context/LiveUpdatesProvider.test.ts +119 -0
- package/ui/src/context/LiveUpdatesProvider.tsx +760 -0
- package/ui/src/context/PanelContext.tsx +73 -0
- package/ui/src/context/SidebarContext.tsx +43 -0
- package/ui/src/context/ThemeContext.tsx +83 -0
- package/ui/src/context/ToastContext.tsx +172 -0
- package/ui/src/fixtures/runTranscriptFixtures.ts +226 -0
- package/ui/src/hooks/useAgentOrder.ts +105 -0
- package/ui/src/hooks/useAutosaveIndicator.ts +72 -0
- package/ui/src/hooks/useCompanyPageMemory.test.ts +90 -0
- package/ui/src/hooks/useCompanyPageMemory.ts +79 -0
- package/ui/src/hooks/useDateRange.ts +120 -0
- package/ui/src/hooks/useInboxBadge.ts +132 -0
- package/ui/src/hooks/useKeyboardShortcuts.ts +40 -0
- package/ui/src/hooks/useProjectOrder.ts +106 -0
- package/ui/src/index.css +770 -0
- package/ui/src/lib/agent-icons.ts +99 -0
- package/ui/src/lib/agent-order.ts +107 -0
- package/ui/src/lib/agent-skills-state.test.ts +90 -0
- package/ui/src/lib/agent-skills-state.ts +41 -0
- package/ui/src/lib/assignees.test.ts +92 -0
- package/ui/src/lib/assignees.ts +82 -0
- package/ui/src/lib/color-contrast.ts +107 -0
- package/ui/src/lib/company-export-selection.test.ts +41 -0
- package/ui/src/lib/company-export-selection.ts +57 -0
- package/ui/src/lib/company-page-memory.ts +65 -0
- package/ui/src/lib/company-portability-sidebar.test.ts +101 -0
- package/ui/src/lib/company-portability-sidebar.ts +62 -0
- package/ui/src/lib/company-routes.ts +88 -0
- package/ui/src/lib/company-selection.test.ts +34 -0
- package/ui/src/lib/company-selection.ts +18 -0
- package/ui/src/lib/groupBy.ts +11 -0
- package/ui/src/lib/inbox.test.ts +404 -0
- package/ui/src/lib/inbox.ts +292 -0
- package/ui/src/lib/instance-settings.test.ts +26 -0
- package/ui/src/lib/instance-settings.ts +25 -0
- package/ui/src/lib/issueDetailBreadcrumb.ts +24 -0
- package/ui/src/lib/legacy-agent-config.test.ts +40 -0
- package/ui/src/lib/legacy-agent-config.ts +17 -0
- package/ui/src/lib/mention-aware-link-node.test.ts +50 -0
- package/ui/src/lib/mention-aware-link-node.ts +67 -0
- package/ui/src/lib/mention-chips.ts +168 -0
- package/ui/src/lib/mention-deletion.test.ts +87 -0
- package/ui/src/lib/mention-deletion.ts +143 -0
- package/ui/src/lib/model-utils.ts +16 -0
- package/ui/src/lib/onboarding-goal.test.ts +22 -0
- package/ui/src/lib/onboarding-goal.ts +18 -0
- package/ui/src/lib/onboarding-launch.test.ts +131 -0
- package/ui/src/lib/onboarding-launch.ts +54 -0
- package/ui/src/lib/onboarding-route.test.ts +80 -0
- package/ui/src/lib/onboarding-route.ts +51 -0
- package/ui/src/lib/portable-files.ts +42 -0
- package/ui/src/lib/project-order.ts +71 -0
- package/ui/src/lib/queryKeys.ts +140 -0
- package/ui/src/lib/recent-assignees.ts +36 -0
- package/ui/src/lib/router.tsx +76 -0
- package/ui/src/lib/routine-trigger-patch.test.ts +72 -0
- package/ui/src/lib/routine-trigger-patch.ts +31 -0
- package/ui/src/lib/status-colors.ts +108 -0
- package/ui/src/lib/timeAgo.ts +31 -0
- package/ui/src/lib/utils.ts +168 -0
- package/ui/src/lib/worktree-branding.ts +65 -0
- package/ui/src/lib/zip.test.ts +289 -0
- package/ui/src/lib/zip.ts +284 -0
- package/ui/src/main.tsx +67 -0
- package/ui/src/pages/Activity.tsx +141 -0
- package/ui/src/pages/AgentDetail.tsx +4053 -0
- package/ui/src/pages/Agents.tsx +415 -0
- package/ui/src/pages/ApprovalDetail.tsx +369 -0
- package/ui/src/pages/Approvals.tsx +132 -0
- package/ui/src/pages/Auth.tsx +180 -0
- package/ui/src/pages/BoardClaim.tsx +125 -0
- package/ui/src/pages/CliAuth.tsx +184 -0
- package/ui/src/pages/Companies.tsx +297 -0
- package/ui/src/pages/CompanyExport.tsx +1019 -0
- package/ui/src/pages/CompanyImport.tsx +1355 -0
- package/ui/src/pages/CompanySettings.tsx +661 -0
- package/ui/src/pages/CompanySkills.tsx +1171 -0
- package/ui/src/pages/Costs.tsx +1103 -0
- package/ui/src/pages/Dashboard.tsx +388 -0
- package/ui/src/pages/DesignGuide.tsx +1330 -0
- package/ui/src/pages/ExecutionWorkspaceDetail.tsx +82 -0
- package/ui/src/pages/GoalDetail.tsx +197 -0
- package/ui/src/pages/Goals.tsx +63 -0
- package/ui/src/pages/Inbox.tsx +1291 -0
- package/ui/src/pages/InstanceExperimentalSettings.tsx +139 -0
- package/ui/src/pages/InstanceGeneralSettings.tsx +104 -0
- package/ui/src/pages/InstanceSettings.tsx +284 -0
- package/ui/src/pages/InviteLanding.tsx +320 -0
- package/ui/src/pages/IssueDetail.tsx +1201 -0
- package/ui/src/pages/Issues.tsx +116 -0
- package/ui/src/pages/MyIssues.tsx +72 -0
- package/ui/src/pages/NewAgent.tsx +353 -0
- package/ui/src/pages/NotFound.tsx +66 -0
- package/ui/src/pages/Org.tsx +132 -0
- package/ui/src/pages/OrgChart.tsx +447 -0
- package/ui/src/pages/PluginManager.tsx +510 -0
- package/ui/src/pages/PluginPage.tsx +156 -0
- package/ui/src/pages/PluginSettings.tsx +836 -0
- package/ui/src/pages/ProjectDetail.tsx +633 -0
- package/ui/src/pages/Projects.tsx +87 -0
- package/ui/src/pages/RoutineDetail.tsx +1022 -0
- package/ui/src/pages/Routines.tsx +661 -0
- package/ui/src/pages/RunTranscriptUxLab.tsx +334 -0
- package/ui/src/pages/VisualOffice.tsx +243 -0
- package/ui/src/plugins/bridge-init.ts +69 -0
- package/ui/src/plugins/bridge.ts +476 -0
- package/ui/src/plugins/launchers.tsx +834 -0
- package/ui/src/plugins/slots.tsx +855 -0
- package/ui/tsconfig.json +21 -0
- package/ui/vite.config.ts +23 -0
- package/ui/vitest.config.ts +14 -0
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState, useRef } from "react";
|
|
2
|
+
import { useParams, useNavigate, useLocation, Navigate } from "@/lib/router";
|
|
3
|
+
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { PROJECT_COLORS, isUuidLike, type BudgetPolicySummary } from "@corporateai/shared";
|
|
5
|
+
import { budgetsApi } from "../api/budgets";
|
|
6
|
+
import { projectsApi } from "../api/projects";
|
|
7
|
+
import { issuesApi } from "../api/issues";
|
|
8
|
+
import { agentsApi } from "../api/agents";
|
|
9
|
+
import { heartbeatsApi } from "../api/heartbeats";
|
|
10
|
+
import { assetsApi } from "../api/assets";
|
|
11
|
+
import { usePanel } from "../context/PanelContext";
|
|
12
|
+
import { useCompany } from "../context/CompanyContext";
|
|
13
|
+
import { useToast } from "../context/ToastContext";
|
|
14
|
+
import { useBreadcrumbs } from "../context/BreadcrumbContext";
|
|
15
|
+
import { queryKeys } from "../lib/queryKeys";
|
|
16
|
+
import { ProjectProperties, type ProjectConfigFieldKey, type ProjectFieldSaveState } from "../components/ProjectProperties";
|
|
17
|
+
import { InlineEditor } from "../components/InlineEditor";
|
|
18
|
+
import { StatusBadge } from "../components/StatusBadge";
|
|
19
|
+
import { BudgetPolicyCard } from "../components/BudgetPolicyCard";
|
|
20
|
+
import { IssuesList } from "../components/IssuesList";
|
|
21
|
+
import { PageSkeleton } from "../components/PageSkeleton";
|
|
22
|
+
import { PageTabBar } from "../components/PageTabBar";
|
|
23
|
+
import { projectRouteRef, cn } from "../lib/utils";
|
|
24
|
+
import { Tabs } from "@/components/ui/tabs";
|
|
25
|
+
import { PluginLauncherOutlet } from "@/plugins/launchers";
|
|
26
|
+
import { PluginSlotMount, PluginSlotOutlet, usePluginSlots } from "@/plugins/slots";
|
|
27
|
+
|
|
28
|
+
/* ── Top-level tab types ── */
|
|
29
|
+
|
|
30
|
+
type ProjectBaseTab = "overview" | "list" | "configuration" | "budget";
|
|
31
|
+
type ProjectPluginTab = `plugin:${string}`;
|
|
32
|
+
type ProjectTab = ProjectBaseTab | ProjectPluginTab;
|
|
33
|
+
|
|
34
|
+
function isProjectPluginTab(value: string | null): value is ProjectPluginTab {
|
|
35
|
+
return typeof value === "string" && value.startsWith("plugin:");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function resolveProjectTab(pathname: string, projectId: string): ProjectTab | null {
|
|
39
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
40
|
+
const projectsIdx = segments.indexOf("projects");
|
|
41
|
+
if (projectsIdx === -1 || segments[projectsIdx + 1] !== projectId) return null;
|
|
42
|
+
const tab = segments[projectsIdx + 2];
|
|
43
|
+
if (tab === "overview") return "overview";
|
|
44
|
+
if (tab === "configuration") return "configuration";
|
|
45
|
+
if (tab === "budget") return "budget";
|
|
46
|
+
if (tab === "issues") return "list";
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ── Overview tab content ── */
|
|
51
|
+
|
|
52
|
+
function OverviewContent({
|
|
53
|
+
project,
|
|
54
|
+
onUpdate,
|
|
55
|
+
imageUploadHandler,
|
|
56
|
+
}: {
|
|
57
|
+
project: { description: string | null; status: string; targetDate: string | null };
|
|
58
|
+
onUpdate: (data: Record<string, unknown>) => void;
|
|
59
|
+
imageUploadHandler?: (file: File) => Promise<string>;
|
|
60
|
+
}) {
|
|
61
|
+
return (
|
|
62
|
+
<div className="space-y-6">
|
|
63
|
+
<InlineEditor
|
|
64
|
+
value={project.description ?? ""}
|
|
65
|
+
onSave={(description) => onUpdate({ description })}
|
|
66
|
+
as="p"
|
|
67
|
+
className="text-sm text-muted-foreground"
|
|
68
|
+
placeholder="Add a description..."
|
|
69
|
+
multiline
|
|
70
|
+
imageUploadHandler={imageUploadHandler}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm">
|
|
74
|
+
<div>
|
|
75
|
+
<span className="text-muted-foreground">Status</span>
|
|
76
|
+
<div className="mt-1">
|
|
77
|
+
<StatusBadge status={project.status} />
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
{project.targetDate && (
|
|
81
|
+
<div>
|
|
82
|
+
<span className="text-muted-foreground">Target Date</span>
|
|
83
|
+
<p>{project.targetDate}</p>
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* ── Color picker popover ── */
|
|
92
|
+
|
|
93
|
+
function ColorPicker({
|
|
94
|
+
currentColor,
|
|
95
|
+
onSelect,
|
|
96
|
+
}: {
|
|
97
|
+
currentColor: string;
|
|
98
|
+
onSelect: (color: string) => void;
|
|
99
|
+
}) {
|
|
100
|
+
const [open, setOpen] = useState(false);
|
|
101
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
102
|
+
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!open) return;
|
|
105
|
+
function handleClick(e: MouseEvent) {
|
|
106
|
+
if (ref.current && !ref.current.contains(e.target as Node)) {
|
|
107
|
+
setOpen(false);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
document.addEventListener("mousedown", handleClick);
|
|
111
|
+
return () => document.removeEventListener("mousedown", handleClick);
|
|
112
|
+
}, [open]);
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<div className="relative" ref={ref}>
|
|
116
|
+
<button
|
|
117
|
+
onClick={() => setOpen(!open)}
|
|
118
|
+
className="shrink-0 h-5 w-5 rounded-md cursor-pointer hover:ring-2 hover:ring-foreground/20 transition-[box-shadow]"
|
|
119
|
+
style={{ backgroundColor: currentColor }}
|
|
120
|
+
aria-label="Change project color"
|
|
121
|
+
/>
|
|
122
|
+
{open && (
|
|
123
|
+
<div className="absolute top-full left-0 mt-2 p-2 bg-popover border border-border rounded-lg shadow-lg z-50 w-max">
|
|
124
|
+
<div className="grid grid-cols-5 gap-1.5">
|
|
125
|
+
{PROJECT_COLORS.map((color) => (
|
|
126
|
+
<button
|
|
127
|
+
key={color}
|
|
128
|
+
onClick={() => {
|
|
129
|
+
onSelect(color);
|
|
130
|
+
setOpen(false);
|
|
131
|
+
}}
|
|
132
|
+
className={`h-6 w-6 rounded-md cursor-pointer transition-[transform,box-shadow] duration-150 hover:scale-110 ${
|
|
133
|
+
color === currentColor
|
|
134
|
+
? "ring-2 ring-foreground ring-offset-1 ring-offset-background"
|
|
135
|
+
: "hover:ring-2 hover:ring-foreground/30"
|
|
136
|
+
}`}
|
|
137
|
+
style={{ backgroundColor: color }}
|
|
138
|
+
aria-label={`Select color ${color}`}
|
|
139
|
+
/>
|
|
140
|
+
))}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* ── List (issues) tab content ── */
|
|
149
|
+
|
|
150
|
+
function ProjectIssuesList({ projectId, companyId }: { projectId: string; companyId: string }) {
|
|
151
|
+
const queryClient = useQueryClient();
|
|
152
|
+
|
|
153
|
+
const { data: agents } = useQuery({
|
|
154
|
+
queryKey: queryKeys.agents.list(companyId),
|
|
155
|
+
queryFn: () => agentsApi.list(companyId),
|
|
156
|
+
enabled: !!companyId,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const { data: liveRuns } = useQuery({
|
|
160
|
+
queryKey: queryKeys.liveRuns(companyId),
|
|
161
|
+
queryFn: () => heartbeatsApi.liveRunsForCompany(companyId),
|
|
162
|
+
enabled: !!companyId,
|
|
163
|
+
refetchInterval: 5000,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const liveIssueIds = useMemo(() => {
|
|
167
|
+
const ids = new Set<string>();
|
|
168
|
+
for (const run of liveRuns ?? []) {
|
|
169
|
+
if (run.issueId) ids.add(run.issueId);
|
|
170
|
+
}
|
|
171
|
+
return ids;
|
|
172
|
+
}, [liveRuns]);
|
|
173
|
+
|
|
174
|
+
const { data: issues, isLoading, error } = useQuery({
|
|
175
|
+
queryKey: queryKeys.issues.listByProject(companyId, projectId),
|
|
176
|
+
queryFn: () => issuesApi.list(companyId, { projectId }),
|
|
177
|
+
enabled: !!companyId,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const updateIssue = useMutation({
|
|
181
|
+
mutationFn: ({ id, data }: { id: string; data: Record<string, unknown> }) =>
|
|
182
|
+
issuesApi.update(id, data),
|
|
183
|
+
onSuccess: () => {
|
|
184
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.issues.listByProject(companyId, projectId) });
|
|
185
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.issues.list(companyId) });
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<IssuesList
|
|
191
|
+
issues={issues ?? []}
|
|
192
|
+
isLoading={isLoading}
|
|
193
|
+
error={error as Error | null}
|
|
194
|
+
agents={agents}
|
|
195
|
+
liveIssueIds={liveIssueIds}
|
|
196
|
+
projectId={projectId}
|
|
197
|
+
viewStateKey={`paperclip:project-view:${projectId}`}
|
|
198
|
+
onUpdateIssue={(id, data) => updateIssue.mutate({ id, data })}
|
|
199
|
+
/>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* ── Main project page ── */
|
|
204
|
+
|
|
205
|
+
export function ProjectDetail() {
|
|
206
|
+
const { companyPrefix, projectId, filter } = useParams<{
|
|
207
|
+
companyPrefix?: string;
|
|
208
|
+
projectId: string;
|
|
209
|
+
filter?: string;
|
|
210
|
+
}>();
|
|
211
|
+
const { companies, selectedCompanyId, setSelectedCompanyId } = useCompany();
|
|
212
|
+
const { closePanel } = usePanel();
|
|
213
|
+
const { setBreadcrumbs } = useBreadcrumbs();
|
|
214
|
+
const { pushToast } = useToast();
|
|
215
|
+
const queryClient = useQueryClient();
|
|
216
|
+
const navigate = useNavigate();
|
|
217
|
+
const location = useLocation();
|
|
218
|
+
const [fieldSaveStates, setFieldSaveStates] = useState<Partial<Record<ProjectConfigFieldKey, ProjectFieldSaveState>>>({});
|
|
219
|
+
const fieldSaveRequestIds = useRef<Partial<Record<ProjectConfigFieldKey, number>>>({});
|
|
220
|
+
const fieldSaveTimers = useRef<Partial<Record<ProjectConfigFieldKey, ReturnType<typeof setTimeout>>>>({});
|
|
221
|
+
const routeProjectRef = projectId ?? "";
|
|
222
|
+
const routeCompanyId = useMemo(() => {
|
|
223
|
+
if (!companyPrefix) return null;
|
|
224
|
+
const requestedPrefix = companyPrefix.toUpperCase();
|
|
225
|
+
return companies.find((company) => company.issuePrefix.toUpperCase() === requestedPrefix)?.id ?? null;
|
|
226
|
+
}, [companies, companyPrefix]);
|
|
227
|
+
const lookupCompanyId = routeCompanyId ?? selectedCompanyId ?? undefined;
|
|
228
|
+
const canFetchProject = routeProjectRef.length > 0 && (isUuidLike(routeProjectRef) || Boolean(lookupCompanyId));
|
|
229
|
+
const activeRouteTab = routeProjectRef ? resolveProjectTab(location.pathname, routeProjectRef) : null;
|
|
230
|
+
const pluginTabFromSearch = useMemo(() => {
|
|
231
|
+
const tab = new URLSearchParams(location.search).get("tab");
|
|
232
|
+
return isProjectPluginTab(tab) ? tab : null;
|
|
233
|
+
}, [location.search]);
|
|
234
|
+
const activeTab = activeRouteTab ?? pluginTabFromSearch;
|
|
235
|
+
|
|
236
|
+
const { data: project, isLoading, error } = useQuery({
|
|
237
|
+
queryKey: [...queryKeys.projects.detail(routeProjectRef), lookupCompanyId ?? null],
|
|
238
|
+
queryFn: () => projectsApi.get(routeProjectRef, lookupCompanyId),
|
|
239
|
+
enabled: canFetchProject,
|
|
240
|
+
});
|
|
241
|
+
const canonicalProjectRef = project ? projectRouteRef(project) : routeProjectRef;
|
|
242
|
+
const projectLookupRef = project?.id ?? routeProjectRef;
|
|
243
|
+
const resolvedCompanyId = project?.companyId ?? selectedCompanyId;
|
|
244
|
+
const {
|
|
245
|
+
slots: pluginDetailSlots,
|
|
246
|
+
isLoading: pluginDetailSlotsLoading,
|
|
247
|
+
} = usePluginSlots({
|
|
248
|
+
slotTypes: ["detailTab"],
|
|
249
|
+
entityType: "project",
|
|
250
|
+
companyId: resolvedCompanyId,
|
|
251
|
+
enabled: !!resolvedCompanyId,
|
|
252
|
+
});
|
|
253
|
+
const pluginTabItems = useMemo(
|
|
254
|
+
() => pluginDetailSlots.map((slot) => ({
|
|
255
|
+
value: `plugin:${slot.pluginKey}:${slot.id}` as ProjectPluginTab,
|
|
256
|
+
label: slot.displayName,
|
|
257
|
+
slot,
|
|
258
|
+
})),
|
|
259
|
+
[pluginDetailSlots],
|
|
260
|
+
);
|
|
261
|
+
const activePluginTab = pluginTabItems.find((item) => item.value === activeTab) ?? null;
|
|
262
|
+
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (!project?.companyId || project.companyId === selectedCompanyId) return;
|
|
265
|
+
setSelectedCompanyId(project.companyId, { source: "route_sync" });
|
|
266
|
+
}, [project?.companyId, selectedCompanyId, setSelectedCompanyId]);
|
|
267
|
+
|
|
268
|
+
const invalidateProject = () => {
|
|
269
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.projects.detail(routeProjectRef) });
|
|
270
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.projects.detail(projectLookupRef) });
|
|
271
|
+
if (resolvedCompanyId) {
|
|
272
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.projects.list(resolvedCompanyId) });
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const updateProject = useMutation({
|
|
277
|
+
mutationFn: (data: Record<string, unknown>) =>
|
|
278
|
+
projectsApi.update(projectLookupRef, data, resolvedCompanyId ?? lookupCompanyId),
|
|
279
|
+
onSuccess: invalidateProject,
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
const archiveProject = useMutation({
|
|
283
|
+
mutationFn: (archived: boolean) =>
|
|
284
|
+
projectsApi.update(
|
|
285
|
+
projectLookupRef,
|
|
286
|
+
{ archivedAt: archived ? new Date().toISOString() : null },
|
|
287
|
+
resolvedCompanyId ?? lookupCompanyId,
|
|
288
|
+
),
|
|
289
|
+
onSuccess: (updatedProject, archived) => {
|
|
290
|
+
invalidateProject();
|
|
291
|
+
const name = updatedProject?.name ?? project?.name ?? "Project";
|
|
292
|
+
if (archived) {
|
|
293
|
+
pushToast({ title: `"${name}" has been archived`, tone: "success" });
|
|
294
|
+
navigate("/dashboard");
|
|
295
|
+
} else {
|
|
296
|
+
pushToast({ title: `"${name}" has been unarchived`, tone: "success" });
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
onError: (_, archived) => {
|
|
300
|
+
pushToast({
|
|
301
|
+
title: archived ? "Failed to archive project" : "Failed to unarchive project",
|
|
302
|
+
tone: "error",
|
|
303
|
+
});
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
const uploadImage = useMutation({
|
|
308
|
+
mutationFn: async (file: File) => {
|
|
309
|
+
if (!resolvedCompanyId) throw new Error("No company selected");
|
|
310
|
+
return assetsApi.uploadImage(resolvedCompanyId, file, `projects/${projectLookupRef || "draft"}`);
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
const { data: budgetOverview } = useQuery({
|
|
315
|
+
queryKey: queryKeys.budgets.overview(resolvedCompanyId ?? "__none__"),
|
|
316
|
+
queryFn: () => budgetsApi.overview(resolvedCompanyId!),
|
|
317
|
+
enabled: !!resolvedCompanyId,
|
|
318
|
+
refetchInterval: 30_000,
|
|
319
|
+
staleTime: 5_000,
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
useEffect(() => {
|
|
323
|
+
setBreadcrumbs([
|
|
324
|
+
{ label: "Projects", href: "/projects" },
|
|
325
|
+
{ label: project?.name ?? routeProjectRef ?? "Project" },
|
|
326
|
+
]);
|
|
327
|
+
}, [setBreadcrumbs, project, routeProjectRef]);
|
|
328
|
+
|
|
329
|
+
useEffect(() => {
|
|
330
|
+
if (!project) return;
|
|
331
|
+
if (routeProjectRef === canonicalProjectRef) return;
|
|
332
|
+
if (isProjectPluginTab(activeTab)) {
|
|
333
|
+
navigate(`/projects/${canonicalProjectRef}?tab=${encodeURIComponent(activeTab)}`, { replace: true });
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (activeTab === "overview") {
|
|
337
|
+
navigate(`/projects/${canonicalProjectRef}/overview`, { replace: true });
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (activeTab === "configuration") {
|
|
341
|
+
navigate(`/projects/${canonicalProjectRef}/configuration`, { replace: true });
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (activeTab === "budget") {
|
|
345
|
+
navigate(`/projects/${canonicalProjectRef}/budget`, { replace: true });
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (activeTab === "list") {
|
|
349
|
+
if (filter) {
|
|
350
|
+
navigate(`/projects/${canonicalProjectRef}/issues/${filter}`, { replace: true });
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
navigate(`/projects/${canonicalProjectRef}/issues`, { replace: true });
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
navigate(`/projects/${canonicalProjectRef}`, { replace: true });
|
|
357
|
+
}, [project, routeProjectRef, canonicalProjectRef, activeTab, filter, navigate]);
|
|
358
|
+
|
|
359
|
+
useEffect(() => {
|
|
360
|
+
closePanel();
|
|
361
|
+
return () => closePanel();
|
|
362
|
+
}, [closePanel]);
|
|
363
|
+
|
|
364
|
+
useEffect(() => {
|
|
365
|
+
return () => {
|
|
366
|
+
Object.values(fieldSaveTimers.current).forEach((timer) => {
|
|
367
|
+
if (timer) clearTimeout(timer);
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
}, []);
|
|
371
|
+
|
|
372
|
+
const setFieldState = useCallback((field: ProjectConfigFieldKey, state: ProjectFieldSaveState) => {
|
|
373
|
+
setFieldSaveStates((current) => ({ ...current, [field]: state }));
|
|
374
|
+
}, []);
|
|
375
|
+
|
|
376
|
+
const scheduleFieldReset = useCallback((field: ProjectConfigFieldKey, delayMs: number) => {
|
|
377
|
+
const existing = fieldSaveTimers.current[field];
|
|
378
|
+
if (existing) clearTimeout(existing);
|
|
379
|
+
fieldSaveTimers.current[field] = setTimeout(() => {
|
|
380
|
+
setFieldSaveStates((current) => {
|
|
381
|
+
const next = { ...current };
|
|
382
|
+
delete next[field];
|
|
383
|
+
return next;
|
|
384
|
+
});
|
|
385
|
+
delete fieldSaveTimers.current[field];
|
|
386
|
+
}, delayMs);
|
|
387
|
+
}, []);
|
|
388
|
+
|
|
389
|
+
const updateProjectField = useCallback(async (field: ProjectConfigFieldKey, data: Record<string, unknown>) => {
|
|
390
|
+
const requestId = (fieldSaveRequestIds.current[field] ?? 0) + 1;
|
|
391
|
+
fieldSaveRequestIds.current[field] = requestId;
|
|
392
|
+
setFieldState(field, "saving");
|
|
393
|
+
try {
|
|
394
|
+
await projectsApi.update(projectLookupRef, data, resolvedCompanyId ?? lookupCompanyId);
|
|
395
|
+
invalidateProject();
|
|
396
|
+
if (fieldSaveRequestIds.current[field] !== requestId) return;
|
|
397
|
+
setFieldState(field, "saved");
|
|
398
|
+
scheduleFieldReset(field, 1800);
|
|
399
|
+
} catch (error) {
|
|
400
|
+
if (fieldSaveRequestIds.current[field] !== requestId) return;
|
|
401
|
+
setFieldState(field, "error");
|
|
402
|
+
scheduleFieldReset(field, 3000);
|
|
403
|
+
throw error;
|
|
404
|
+
}
|
|
405
|
+
}, [invalidateProject, lookupCompanyId, projectLookupRef, resolvedCompanyId, scheduleFieldReset, setFieldState]);
|
|
406
|
+
|
|
407
|
+
const projectBudgetSummary = useMemo(() => {
|
|
408
|
+
const matched = budgetOverview?.policies.find(
|
|
409
|
+
(policy) => policy.scopeType === "project" && policy.scopeId === (project?.id ?? routeProjectRef),
|
|
410
|
+
);
|
|
411
|
+
if (matched) return matched;
|
|
412
|
+
return {
|
|
413
|
+
policyId: "",
|
|
414
|
+
companyId: resolvedCompanyId ?? "",
|
|
415
|
+
scopeType: "project",
|
|
416
|
+
scopeId: project?.id ?? routeProjectRef,
|
|
417
|
+
scopeName: project?.name ?? "Project",
|
|
418
|
+
metric: "billed_cents",
|
|
419
|
+
windowKind: "lifetime",
|
|
420
|
+
amount: 0,
|
|
421
|
+
observedAmount: 0,
|
|
422
|
+
remainingAmount: 0,
|
|
423
|
+
utilizationPercent: 0,
|
|
424
|
+
warnPercent: 80,
|
|
425
|
+
hardStopEnabled: true,
|
|
426
|
+
notifyEnabled: true,
|
|
427
|
+
isActive: false,
|
|
428
|
+
status: "ok",
|
|
429
|
+
paused: Boolean(project?.pausedAt),
|
|
430
|
+
pauseReason: project?.pauseReason ?? null,
|
|
431
|
+
windowStart: new Date(),
|
|
432
|
+
windowEnd: new Date(),
|
|
433
|
+
} satisfies BudgetPolicySummary;
|
|
434
|
+
}, [budgetOverview?.policies, project, resolvedCompanyId, routeProjectRef]);
|
|
435
|
+
|
|
436
|
+
const budgetMutation = useMutation({
|
|
437
|
+
mutationFn: (amount: number) =>
|
|
438
|
+
budgetsApi.upsertPolicy(resolvedCompanyId!, {
|
|
439
|
+
scopeType: "project",
|
|
440
|
+
scopeId: project?.id ?? routeProjectRef,
|
|
441
|
+
amount,
|
|
442
|
+
windowKind: "lifetime",
|
|
443
|
+
}),
|
|
444
|
+
onSuccess: () => {
|
|
445
|
+
if (!resolvedCompanyId) return;
|
|
446
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.budgets.overview(resolvedCompanyId) });
|
|
447
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.projects.detail(routeProjectRef) });
|
|
448
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.projects.detail(projectLookupRef) });
|
|
449
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.projects.list(resolvedCompanyId) });
|
|
450
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.dashboard(resolvedCompanyId) });
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
if (pluginTabFromSearch && !pluginDetailSlotsLoading && !activePluginTab) {
|
|
455
|
+
return <Navigate to={`/projects/${canonicalProjectRef}/issues`} replace />;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Redirect bare /projects/:id to cached tab or default /issues
|
|
459
|
+
if (routeProjectRef && activeTab === null) {
|
|
460
|
+
let cachedTab: string | null = null;
|
|
461
|
+
if (project?.id) {
|
|
462
|
+
try { cachedTab = localStorage.getItem(`paperclip:project-tab:${project.id}`); } catch {}
|
|
463
|
+
}
|
|
464
|
+
if (cachedTab === "overview") {
|
|
465
|
+
return <Navigate to={`/projects/${canonicalProjectRef}/overview`} replace />;
|
|
466
|
+
}
|
|
467
|
+
if (cachedTab === "configuration") {
|
|
468
|
+
return <Navigate to={`/projects/${canonicalProjectRef}/configuration`} replace />;
|
|
469
|
+
}
|
|
470
|
+
if (cachedTab === "budget") {
|
|
471
|
+
return <Navigate to={`/projects/${canonicalProjectRef}/budget`} replace />;
|
|
472
|
+
}
|
|
473
|
+
if (isProjectPluginTab(cachedTab)) {
|
|
474
|
+
return <Navigate to={`/projects/${canonicalProjectRef}?tab=${encodeURIComponent(cachedTab)}`} replace />;
|
|
475
|
+
}
|
|
476
|
+
return <Navigate to={`/projects/${canonicalProjectRef}/issues`} replace />;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
if (isLoading) return <PageSkeleton variant="detail" />;
|
|
480
|
+
if (error) return <p className="text-sm text-destructive">{error.message}</p>;
|
|
481
|
+
if (!project) return null;
|
|
482
|
+
|
|
483
|
+
const handleTabChange = (tab: ProjectTab) => {
|
|
484
|
+
// Cache the active tab per project
|
|
485
|
+
if (project?.id) {
|
|
486
|
+
try { localStorage.setItem(`paperclip:project-tab:${project.id}`, tab); } catch {}
|
|
487
|
+
}
|
|
488
|
+
if (isProjectPluginTab(tab)) {
|
|
489
|
+
navigate(`/projects/${canonicalProjectRef}?tab=${encodeURIComponent(tab)}`);
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
if (tab === "overview") {
|
|
493
|
+
navigate(`/projects/${canonicalProjectRef}/overview`);
|
|
494
|
+
} else if (tab === "budget") {
|
|
495
|
+
navigate(`/projects/${canonicalProjectRef}/budget`);
|
|
496
|
+
} else if (tab === "configuration") {
|
|
497
|
+
navigate(`/projects/${canonicalProjectRef}/configuration`);
|
|
498
|
+
} else {
|
|
499
|
+
navigate(`/projects/${canonicalProjectRef}/issues`);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
return (
|
|
504
|
+
<div className="space-y-6">
|
|
505
|
+
<div className="flex items-start gap-3">
|
|
506
|
+
<div className="h-7 flex items-center">
|
|
507
|
+
<ColorPicker
|
|
508
|
+
currentColor={project.color ?? "#6366f1"}
|
|
509
|
+
onSelect={(color) => updateProject.mutate({ color })}
|
|
510
|
+
/>
|
|
511
|
+
</div>
|
|
512
|
+
<div className="min-w-0 space-y-2">
|
|
513
|
+
<InlineEditor
|
|
514
|
+
value={project.name}
|
|
515
|
+
onSave={(name) => updateProject.mutate({ name })}
|
|
516
|
+
as="h2"
|
|
517
|
+
className="text-xl font-bold"
|
|
518
|
+
/>
|
|
519
|
+
{project.pauseReason === "budget" ? (
|
|
520
|
+
<div className="inline-flex items-center gap-2 rounded-full border border-red-500/30 bg-red-500/10 px-3 py-1 text-[11px] font-medium uppercase tracking-[0.18em] text-red-200">
|
|
521
|
+
<span className="h-2 w-2 rounded-full bg-red-400" />
|
|
522
|
+
Paused by budget hard stop
|
|
523
|
+
</div>
|
|
524
|
+
) : null}
|
|
525
|
+
</div>
|
|
526
|
+
</div>
|
|
527
|
+
|
|
528
|
+
<PluginSlotOutlet
|
|
529
|
+
slotTypes={["toolbarButton", "contextMenuItem"]}
|
|
530
|
+
entityType="project"
|
|
531
|
+
context={{
|
|
532
|
+
companyId: resolvedCompanyId ?? null,
|
|
533
|
+
companyPrefix: companyPrefix ?? null,
|
|
534
|
+
projectId: project.id,
|
|
535
|
+
projectRef: canonicalProjectRef,
|
|
536
|
+
entityId: project.id,
|
|
537
|
+
entityType: "project",
|
|
538
|
+
}}
|
|
539
|
+
className="flex flex-wrap gap-2"
|
|
540
|
+
itemClassName="inline-flex"
|
|
541
|
+
missingBehavior="placeholder"
|
|
542
|
+
/>
|
|
543
|
+
|
|
544
|
+
<PluginLauncherOutlet
|
|
545
|
+
placementZones={["toolbarButton"]}
|
|
546
|
+
entityType="project"
|
|
547
|
+
context={{
|
|
548
|
+
companyId: resolvedCompanyId ?? null,
|
|
549
|
+
companyPrefix: companyPrefix ?? null,
|
|
550
|
+
projectId: project.id,
|
|
551
|
+
projectRef: canonicalProjectRef,
|
|
552
|
+
entityId: project.id,
|
|
553
|
+
entityType: "project",
|
|
554
|
+
}}
|
|
555
|
+
className="flex flex-wrap gap-2"
|
|
556
|
+
itemClassName="inline-flex"
|
|
557
|
+
/>
|
|
558
|
+
|
|
559
|
+
<Tabs value={activeTab ?? "list"} onValueChange={(value) => handleTabChange(value as ProjectTab)}>
|
|
560
|
+
<PageTabBar
|
|
561
|
+
items={[
|
|
562
|
+
{ value: "list", label: "Issues" },
|
|
563
|
+
{ value: "overview", label: "Overview" },
|
|
564
|
+
{ value: "configuration", label: "Configuration" },
|
|
565
|
+
{ value: "budget", label: "Budget" },
|
|
566
|
+
...pluginTabItems.map((item) => ({
|
|
567
|
+
value: item.value,
|
|
568
|
+
label: item.label,
|
|
569
|
+
})),
|
|
570
|
+
]}
|
|
571
|
+
align="start"
|
|
572
|
+
value={activeTab ?? "list"}
|
|
573
|
+
onValueChange={(value) => handleTabChange(value as ProjectTab)}
|
|
574
|
+
/>
|
|
575
|
+
</Tabs>
|
|
576
|
+
|
|
577
|
+
{activeTab === "overview" && (
|
|
578
|
+
<OverviewContent
|
|
579
|
+
project={project}
|
|
580
|
+
onUpdate={(data) => updateProject.mutate(data)}
|
|
581
|
+
imageUploadHandler={async (file) => {
|
|
582
|
+
const asset = await uploadImage.mutateAsync(file);
|
|
583
|
+
return asset.contentPath;
|
|
584
|
+
}}
|
|
585
|
+
/>
|
|
586
|
+
)}
|
|
587
|
+
|
|
588
|
+
{activeTab === "list" && project?.id && resolvedCompanyId && (
|
|
589
|
+
<ProjectIssuesList projectId={project.id} companyId={resolvedCompanyId} />
|
|
590
|
+
)}
|
|
591
|
+
|
|
592
|
+
{activeTab === "configuration" && (
|
|
593
|
+
<div className="max-w-4xl">
|
|
594
|
+
<ProjectProperties
|
|
595
|
+
project={project}
|
|
596
|
+
onUpdate={(data) => updateProject.mutate(data)}
|
|
597
|
+
onFieldUpdate={updateProjectField}
|
|
598
|
+
getFieldSaveState={(field) => fieldSaveStates[field] ?? "idle"}
|
|
599
|
+
onArchive={(archived) => archiveProject.mutate(archived)}
|
|
600
|
+
archivePending={archiveProject.isPending}
|
|
601
|
+
/>
|
|
602
|
+
</div>
|
|
603
|
+
)}
|
|
604
|
+
|
|
605
|
+
{activeTab === "budget" && resolvedCompanyId ? (
|
|
606
|
+
<div className="max-w-3xl">
|
|
607
|
+
<BudgetPolicyCard
|
|
608
|
+
summary={projectBudgetSummary}
|
|
609
|
+
variant="plain"
|
|
610
|
+
isSaving={budgetMutation.isPending}
|
|
611
|
+
onSave={(amount) => budgetMutation.mutate(amount)}
|
|
612
|
+
/>
|
|
613
|
+
</div>
|
|
614
|
+
) : null}
|
|
615
|
+
|
|
616
|
+
{activePluginTab && (
|
|
617
|
+
<PluginSlotMount
|
|
618
|
+
slot={activePluginTab.slot}
|
|
619
|
+
context={{
|
|
620
|
+
companyId: resolvedCompanyId,
|
|
621
|
+
companyPrefix: companyPrefix ?? null,
|
|
622
|
+
projectId: project.id,
|
|
623
|
+
projectRef: canonicalProjectRef,
|
|
624
|
+
entityId: project.id,
|
|
625
|
+
entityType: "project",
|
|
626
|
+
}}
|
|
627
|
+
missingBehavior="placeholder"
|
|
628
|
+
/>
|
|
629
|
+
)}
|
|
630
|
+
</div>
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
|