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,889 @@
|
|
|
1
|
+
import { startTransition, useEffect, useMemo, useState, useCallback, useRef } from "react";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { pickTextColorForPillBg } from "@/lib/color-contrast";
|
|
4
|
+
import { useDialog } from "../context/DialogContext";
|
|
5
|
+
import { useCompany } from "../context/CompanyContext";
|
|
6
|
+
import { issuesApi } from "../api/issues";
|
|
7
|
+
import { authApi } from "../api/auth";
|
|
8
|
+
import { queryKeys } from "../lib/queryKeys";
|
|
9
|
+
import { formatAssigneeUserLabel } from "../lib/assignees";
|
|
10
|
+
import { groupBy } from "../lib/groupBy";
|
|
11
|
+
import { formatDate, cn } from "../lib/utils";
|
|
12
|
+
import { timeAgo } from "../lib/timeAgo";
|
|
13
|
+
import { StatusIcon } from "./StatusIcon";
|
|
14
|
+
import { PriorityIcon } from "./PriorityIcon";
|
|
15
|
+
import { EmptyState } from "./EmptyState";
|
|
16
|
+
import { Identity } from "./Identity";
|
|
17
|
+
import { IssueRow } from "./IssueRow";
|
|
18
|
+
import { PageSkeleton } from "./PageSkeleton";
|
|
19
|
+
import { Button } from "@/components/ui/button";
|
|
20
|
+
import { Input } from "@/components/ui/input";
|
|
21
|
+
import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover";
|
|
22
|
+
import { Checkbox } from "@/components/ui/checkbox";
|
|
23
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "@/components/ui/collapsible";
|
|
24
|
+
import { CircleDot, Plus, Filter, ArrowUpDown, Layers, Check, X, ChevronRight, List, Columns3, User, Search } from "lucide-react";
|
|
25
|
+
import { KanbanBoard } from "./KanbanBoard";
|
|
26
|
+
import type { Issue } from "@corporateai/shared";
|
|
27
|
+
|
|
28
|
+
/* ── Helpers ── */
|
|
29
|
+
|
|
30
|
+
const statusOrder = ["in_progress", "todo", "backlog", "in_review", "blocked", "done", "cancelled"];
|
|
31
|
+
const priorityOrder = ["critical", "high", "medium", "low"];
|
|
32
|
+
|
|
33
|
+
function statusLabel(status: string): string {
|
|
34
|
+
return status.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ── View state ── */
|
|
38
|
+
|
|
39
|
+
export type IssueViewState = {
|
|
40
|
+
statuses: string[];
|
|
41
|
+
priorities: string[];
|
|
42
|
+
assignees: string[];
|
|
43
|
+
labels: string[];
|
|
44
|
+
projects: string[];
|
|
45
|
+
sortField: "status" | "priority" | "title" | "created" | "updated";
|
|
46
|
+
sortDir: "asc" | "desc";
|
|
47
|
+
groupBy: "status" | "priority" | "assignee" | "none";
|
|
48
|
+
viewMode: "list" | "board";
|
|
49
|
+
collapsedGroups: string[];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const defaultViewState: IssueViewState = {
|
|
53
|
+
statuses: [],
|
|
54
|
+
priorities: [],
|
|
55
|
+
assignees: [],
|
|
56
|
+
labels: [],
|
|
57
|
+
projects: [],
|
|
58
|
+
sortField: "updated",
|
|
59
|
+
sortDir: "desc",
|
|
60
|
+
groupBy: "none",
|
|
61
|
+
viewMode: "list",
|
|
62
|
+
collapsedGroups: [],
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const quickFilterPresets = [
|
|
66
|
+
{ label: "All", statuses: [] as string[] },
|
|
67
|
+
{ label: "Active", statuses: ["todo", "in_progress", "in_review", "blocked"] },
|
|
68
|
+
{ label: "Backlog", statuses: ["backlog"] },
|
|
69
|
+
{ label: "Done", statuses: ["done", "cancelled"] },
|
|
70
|
+
];
|
|
71
|
+
const ISSUE_SEARCH_COMMIT_DELAY_MS = 150;
|
|
72
|
+
|
|
73
|
+
function getViewState(key: string): IssueViewState {
|
|
74
|
+
try {
|
|
75
|
+
const raw = localStorage.getItem(key);
|
|
76
|
+
if (raw) return { ...defaultViewState, ...JSON.parse(raw) };
|
|
77
|
+
} catch { /* ignore */ }
|
|
78
|
+
return { ...defaultViewState };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function saveViewState(key: string, state: IssueViewState) {
|
|
82
|
+
localStorage.setItem(key, JSON.stringify(state));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function arraysEqual(a: string[], b: string[]): boolean {
|
|
86
|
+
if (a.length !== b.length) return false;
|
|
87
|
+
const sa = [...a].sort();
|
|
88
|
+
const sb = [...b].sort();
|
|
89
|
+
return sa.every((v, i) => v === sb[i]);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function toggleInArray(arr: string[], value: string): string[] {
|
|
93
|
+
return arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function applyFilters(issues: Issue[], state: IssueViewState, currentUserId?: string | null): Issue[] {
|
|
97
|
+
let result = issues;
|
|
98
|
+
if (state.statuses.length > 0) result = result.filter((i) => state.statuses.includes(i.status));
|
|
99
|
+
if (state.priorities.length > 0) result = result.filter((i) => state.priorities.includes(i.priority));
|
|
100
|
+
if (state.assignees.length > 0) {
|
|
101
|
+
result = result.filter((issue) => {
|
|
102
|
+
for (const assignee of state.assignees) {
|
|
103
|
+
if (assignee === "__unassigned" && !issue.assigneeAgentId && !issue.assigneeUserId) return true;
|
|
104
|
+
if (assignee === "__me" && currentUserId && issue.assigneeUserId === currentUserId) return true;
|
|
105
|
+
if (issue.assigneeAgentId === assignee) return true;
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (state.labels.length > 0) result = result.filter((i) => (i.labelIds ?? []).some((id) => state.labels.includes(id)));
|
|
111
|
+
if (state.projects.length > 0) result = result.filter((i) => i.projectId != null && state.projects.includes(i.projectId));
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function sortIssues(issues: Issue[], state: IssueViewState): Issue[] {
|
|
116
|
+
const sorted = [...issues];
|
|
117
|
+
const dir = state.sortDir === "asc" ? 1 : -1;
|
|
118
|
+
sorted.sort((a, b) => {
|
|
119
|
+
switch (state.sortField) {
|
|
120
|
+
case "status":
|
|
121
|
+
return dir * (statusOrder.indexOf(a.status) - statusOrder.indexOf(b.status));
|
|
122
|
+
case "priority":
|
|
123
|
+
return dir * (priorityOrder.indexOf(a.priority) - priorityOrder.indexOf(b.priority));
|
|
124
|
+
case "title":
|
|
125
|
+
return dir * a.title.localeCompare(b.title);
|
|
126
|
+
case "created":
|
|
127
|
+
return dir * (new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
|
|
128
|
+
case "updated":
|
|
129
|
+
return dir * (new Date(a.updatedAt).getTime() - new Date(b.updatedAt).getTime());
|
|
130
|
+
default:
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return sorted;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function countActiveFilters(state: IssueViewState): number {
|
|
138
|
+
let count = 0;
|
|
139
|
+
if (state.statuses.length > 0) count++;
|
|
140
|
+
if (state.priorities.length > 0) count++;
|
|
141
|
+
if (state.assignees.length > 0) count++;
|
|
142
|
+
if (state.labels.length > 0) count++;
|
|
143
|
+
if (state.projects.length > 0) count++;
|
|
144
|
+
return count;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* ── Component ── */
|
|
148
|
+
|
|
149
|
+
interface Agent {
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
interface ProjectOption {
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
interface IssuesListProps {
|
|
160
|
+
issues: Issue[];
|
|
161
|
+
isLoading?: boolean;
|
|
162
|
+
error?: Error | null;
|
|
163
|
+
agents?: Agent[];
|
|
164
|
+
projects?: ProjectOption[];
|
|
165
|
+
liveIssueIds?: Set<string>;
|
|
166
|
+
projectId?: string;
|
|
167
|
+
viewStateKey: string;
|
|
168
|
+
issueLinkState?: unknown;
|
|
169
|
+
initialAssignees?: string[];
|
|
170
|
+
initialSearch?: string;
|
|
171
|
+
searchFilters?: {
|
|
172
|
+
participantAgentId?: string;
|
|
173
|
+
};
|
|
174
|
+
onSearchChange?: (search: string) => void;
|
|
175
|
+
onUpdateIssue: (id: string, data: Record<string, unknown>) => void;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface IssuesSearchInputProps {
|
|
179
|
+
initialValue: string;
|
|
180
|
+
onValueCommitted: (value: string) => void;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function IssuesSearchInput({ initialValue, onValueCommitted }: IssuesSearchInputProps) {
|
|
184
|
+
const [value, setValue] = useState(initialValue);
|
|
185
|
+
const onValueCommittedRef = useRef(onValueCommitted);
|
|
186
|
+
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
setValue(initialValue);
|
|
189
|
+
}, [initialValue]);
|
|
190
|
+
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
onValueCommittedRef.current = onValueCommitted;
|
|
193
|
+
}, [onValueCommitted]);
|
|
194
|
+
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
const timeoutId = window.setTimeout(() => {
|
|
197
|
+
onValueCommittedRef.current(value);
|
|
198
|
+
}, ISSUE_SEARCH_COMMIT_DELAY_MS);
|
|
199
|
+
return () => window.clearTimeout(timeoutId);
|
|
200
|
+
}, [value]);
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<div className="relative w-48 sm:w-64 md:w-80">
|
|
204
|
+
<Search className="pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
|
|
205
|
+
<Input
|
|
206
|
+
value={value}
|
|
207
|
+
onChange={(e) => setValue(e.target.value)}
|
|
208
|
+
placeholder="Search issues..."
|
|
209
|
+
className="pl-7 text-xs sm:text-sm"
|
|
210
|
+
aria-label="Search issues"
|
|
211
|
+
/>
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function IssuesList({
|
|
217
|
+
issues,
|
|
218
|
+
isLoading,
|
|
219
|
+
error,
|
|
220
|
+
agents,
|
|
221
|
+
projects,
|
|
222
|
+
liveIssueIds,
|
|
223
|
+
projectId,
|
|
224
|
+
viewStateKey,
|
|
225
|
+
issueLinkState,
|
|
226
|
+
initialAssignees,
|
|
227
|
+
initialSearch,
|
|
228
|
+
searchFilters,
|
|
229
|
+
onSearchChange,
|
|
230
|
+
onUpdateIssue,
|
|
231
|
+
}: IssuesListProps) {
|
|
232
|
+
const { selectedCompanyId } = useCompany();
|
|
233
|
+
const { openNewIssue } = useDialog();
|
|
234
|
+
const { data: session } = useQuery({
|
|
235
|
+
queryKey: queryKeys.auth.session,
|
|
236
|
+
queryFn: () => authApi.getSession(),
|
|
237
|
+
});
|
|
238
|
+
const currentUserId = session?.user?.id ?? session?.session?.userId ?? null;
|
|
239
|
+
|
|
240
|
+
// Scope the storage key per company so folding/view state is independent across companies.
|
|
241
|
+
const scopedKey = selectedCompanyId ? `${viewStateKey}:${selectedCompanyId}` : viewStateKey;
|
|
242
|
+
|
|
243
|
+
const [viewState, setViewState] = useState<IssueViewState>(() => {
|
|
244
|
+
if (initialAssignees) {
|
|
245
|
+
return { ...defaultViewState, assignees: initialAssignees, statuses: [] };
|
|
246
|
+
}
|
|
247
|
+
return getViewState(scopedKey);
|
|
248
|
+
});
|
|
249
|
+
const [assigneePickerIssueId, setAssigneePickerIssueId] = useState<string | null>(null);
|
|
250
|
+
const [assigneeSearch, setAssigneeSearch] = useState("");
|
|
251
|
+
const [issueSearch, setIssueSearch] = useState(initialSearch ?? "");
|
|
252
|
+
const normalizedIssueSearch = issueSearch.trim();
|
|
253
|
+
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
setIssueSearch(initialSearch ?? "");
|
|
256
|
+
}, [initialSearch]);
|
|
257
|
+
|
|
258
|
+
// Reload view state from localStorage when company changes (scopedKey changes).
|
|
259
|
+
const prevScopedKey = useRef(scopedKey);
|
|
260
|
+
useEffect(() => {
|
|
261
|
+
if (prevScopedKey.current !== scopedKey) {
|
|
262
|
+
prevScopedKey.current = scopedKey;
|
|
263
|
+
setViewState(initialAssignees
|
|
264
|
+
? { ...defaultViewState, assignees: initialAssignees, statuses: [] }
|
|
265
|
+
: getViewState(scopedKey));
|
|
266
|
+
}
|
|
267
|
+
}, [scopedKey, initialAssignees]);
|
|
268
|
+
|
|
269
|
+
const handleIssueSearchCommit = useCallback((nextSearch: string) => {
|
|
270
|
+
startTransition(() => {
|
|
271
|
+
setIssueSearch(nextSearch);
|
|
272
|
+
});
|
|
273
|
+
onSearchChange?.(nextSearch);
|
|
274
|
+
}, [onSearchChange]);
|
|
275
|
+
|
|
276
|
+
const updateView = useCallback((patch: Partial<IssueViewState>) => {
|
|
277
|
+
setViewState((prev) => {
|
|
278
|
+
const next = { ...prev, ...patch };
|
|
279
|
+
saveViewState(scopedKey, next);
|
|
280
|
+
return next;
|
|
281
|
+
});
|
|
282
|
+
}, [scopedKey]);
|
|
283
|
+
|
|
284
|
+
const { data: searchedIssues = [] } = useQuery({
|
|
285
|
+
queryKey: [
|
|
286
|
+
...queryKeys.issues.search(selectedCompanyId!, normalizedIssueSearch, projectId),
|
|
287
|
+
searchFilters ?? {},
|
|
288
|
+
],
|
|
289
|
+
queryFn: () => issuesApi.list(selectedCompanyId!, { q: normalizedIssueSearch, projectId, ...searchFilters }),
|
|
290
|
+
enabled: !!selectedCompanyId && normalizedIssueSearch.length > 0,
|
|
291
|
+
placeholderData: (previousData) => previousData,
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
const agentName = useCallback((id: string | null) => {
|
|
295
|
+
if (!id || !agents) return null;
|
|
296
|
+
return agents.find((a) => a.id === id)?.name ?? null;
|
|
297
|
+
}, [agents]);
|
|
298
|
+
|
|
299
|
+
const filtered = useMemo(() => {
|
|
300
|
+
const sourceIssues = normalizedIssueSearch.length > 0 ? searchedIssues : issues;
|
|
301
|
+
const filteredByControls = applyFilters(sourceIssues, viewState, currentUserId);
|
|
302
|
+
return sortIssues(filteredByControls, viewState);
|
|
303
|
+
}, [issues, searchedIssues, viewState, normalizedIssueSearch, currentUserId]);
|
|
304
|
+
|
|
305
|
+
const { data: labels } = useQuery({
|
|
306
|
+
queryKey: queryKeys.issues.labels(selectedCompanyId!),
|
|
307
|
+
queryFn: () => issuesApi.listLabels(selectedCompanyId!),
|
|
308
|
+
enabled: !!selectedCompanyId,
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
const activeFilterCount = countActiveFilters(viewState);
|
|
312
|
+
|
|
313
|
+
const groupedContent = useMemo(() => {
|
|
314
|
+
if (viewState.groupBy === "none") {
|
|
315
|
+
return [{ key: "__all", label: null as string | null, items: filtered }];
|
|
316
|
+
}
|
|
317
|
+
if (viewState.groupBy === "status") {
|
|
318
|
+
const groups = groupBy(filtered, (i) => i.status);
|
|
319
|
+
return statusOrder
|
|
320
|
+
.filter((s) => groups[s]?.length)
|
|
321
|
+
.map((s) => ({ key: s, label: statusLabel(s), items: groups[s]! }));
|
|
322
|
+
}
|
|
323
|
+
if (viewState.groupBy === "priority") {
|
|
324
|
+
const groups = groupBy(filtered, (i) => i.priority);
|
|
325
|
+
return priorityOrder
|
|
326
|
+
.filter((p) => groups[p]?.length)
|
|
327
|
+
.map((p) => ({ key: p, label: statusLabel(p), items: groups[p]! }));
|
|
328
|
+
}
|
|
329
|
+
// assignee
|
|
330
|
+
const groups = groupBy(
|
|
331
|
+
filtered,
|
|
332
|
+
(issue) => issue.assigneeAgentId ?? (issue.assigneeUserId ? `__user:${issue.assigneeUserId}` : "__unassigned"),
|
|
333
|
+
);
|
|
334
|
+
return Object.keys(groups).map((key) => ({
|
|
335
|
+
key,
|
|
336
|
+
label:
|
|
337
|
+
key === "__unassigned"
|
|
338
|
+
? "Unassigned"
|
|
339
|
+
: key.startsWith("__user:")
|
|
340
|
+
? (formatAssigneeUserLabel(key.slice("__user:".length), currentUserId) ?? "User")
|
|
341
|
+
: (agentName(key) ?? key.slice(0, 8)),
|
|
342
|
+
items: groups[key]!,
|
|
343
|
+
}));
|
|
344
|
+
}, [filtered, viewState.groupBy, agents, agentName, currentUserId]);
|
|
345
|
+
|
|
346
|
+
const newIssueDefaults = (groupKey?: string) => {
|
|
347
|
+
const defaults: Record<string, string> = {};
|
|
348
|
+
if (projectId) defaults.projectId = projectId;
|
|
349
|
+
if (groupKey) {
|
|
350
|
+
if (viewState.groupBy === "status") defaults.status = groupKey;
|
|
351
|
+
else if (viewState.groupBy === "priority") defaults.priority = groupKey;
|
|
352
|
+
else if (viewState.groupBy === "assignee" && groupKey !== "__unassigned") {
|
|
353
|
+
if (groupKey.startsWith("__user:")) defaults.assigneeUserId = groupKey.slice("__user:".length);
|
|
354
|
+
else defaults.assigneeAgentId = groupKey;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return defaults;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
const assignIssue = (issueId: string, assigneeAgentId: string | null, assigneeUserId: string | null = null) => {
|
|
361
|
+
onUpdateIssue(issueId, { assigneeAgentId, assigneeUserId });
|
|
362
|
+
setAssigneePickerIssueId(null);
|
|
363
|
+
setAssigneeSearch("");
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
return (
|
|
367
|
+
<div className="space-y-4">
|
|
368
|
+
{/* Toolbar */}
|
|
369
|
+
<div className="flex items-center justify-between gap-2 sm:gap-3">
|
|
370
|
+
<div className="flex min-w-0 items-center gap-2 sm:gap-3">
|
|
371
|
+
<Button size="sm" variant="outline" onClick={() => openNewIssue(newIssueDefaults())}>
|
|
372
|
+
<Plus className="h-4 w-4 sm:mr-1" />
|
|
373
|
+
<span className="hidden sm:inline">New Issue</span>
|
|
374
|
+
</Button>
|
|
375
|
+
<IssuesSearchInput
|
|
376
|
+
initialValue={initialSearch ?? ""}
|
|
377
|
+
onValueCommitted={handleIssueSearchCommit}
|
|
378
|
+
/>
|
|
379
|
+
</div>
|
|
380
|
+
|
|
381
|
+
<div className="flex items-center gap-0.5 sm:gap-1 shrink-0">
|
|
382
|
+
{/* View mode toggle */}
|
|
383
|
+
<div className="flex items-center border border-border rounded-md overflow-hidden mr-1">
|
|
384
|
+
<button
|
|
385
|
+
className={`p-1.5 transition-colors ${viewState.viewMode === "list" ? "bg-accent text-foreground" : "text-muted-foreground hover:text-foreground"}`}
|
|
386
|
+
onClick={() => updateView({ viewMode: "list" })}
|
|
387
|
+
title="List view"
|
|
388
|
+
>
|
|
389
|
+
<List className="h-3.5 w-3.5" />
|
|
390
|
+
</button>
|
|
391
|
+
<button
|
|
392
|
+
className={`p-1.5 transition-colors ${viewState.viewMode === "board" ? "bg-accent text-foreground" : "text-muted-foreground hover:text-foreground"}`}
|
|
393
|
+
onClick={() => updateView({ viewMode: "board" })}
|
|
394
|
+
title="Board view"
|
|
395
|
+
>
|
|
396
|
+
<Columns3 className="h-3.5 w-3.5" />
|
|
397
|
+
</button>
|
|
398
|
+
</div>
|
|
399
|
+
|
|
400
|
+
{/* Filter */}
|
|
401
|
+
<Popover>
|
|
402
|
+
<PopoverTrigger asChild>
|
|
403
|
+
<Button variant="ghost" size="sm" className={`text-xs ${activeFilterCount > 0 ? "text-blue-600 dark:text-blue-400" : ""}`}>
|
|
404
|
+
<Filter className="h-3.5 w-3.5 sm:h-3 sm:w-3 sm:mr-1" />
|
|
405
|
+
<span className="hidden sm:inline">{activeFilterCount > 0 ? `Filters: ${activeFilterCount}` : "Filter"}</span>
|
|
406
|
+
{activeFilterCount > 0 && (
|
|
407
|
+
<span className="sm:hidden text-[10px] font-medium ml-0.5">{activeFilterCount}</span>
|
|
408
|
+
)}
|
|
409
|
+
{activeFilterCount > 0 && (
|
|
410
|
+
<X
|
|
411
|
+
className="h-3 w-3 ml-1 hidden sm:block"
|
|
412
|
+
onClick={(e) => {
|
|
413
|
+
e.stopPropagation();
|
|
414
|
+
updateView({ statuses: [], priorities: [], assignees: [], labels: [], projects: [] });
|
|
415
|
+
}}
|
|
416
|
+
/>
|
|
417
|
+
)}
|
|
418
|
+
</Button>
|
|
419
|
+
</PopoverTrigger>
|
|
420
|
+
<PopoverContent align="end" className="w-[min(480px,calc(100vw-2rem))] p-0">
|
|
421
|
+
<div className="p-3 space-y-3">
|
|
422
|
+
<div className="flex items-center justify-between">
|
|
423
|
+
<span className="text-sm font-medium">Filters</span>
|
|
424
|
+
{activeFilterCount > 0 && (
|
|
425
|
+
<button
|
|
426
|
+
className="text-xs text-muted-foreground hover:text-foreground"
|
|
427
|
+
onClick={() => updateView({ statuses: [], priorities: [], assignees: [], labels: [] })}
|
|
428
|
+
>
|
|
429
|
+
Clear
|
|
430
|
+
</button>
|
|
431
|
+
)}
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
{/* Quick filters */}
|
|
435
|
+
<div className="space-y-1.5">
|
|
436
|
+
<span className="text-xs text-muted-foreground">Quick filters</span>
|
|
437
|
+
<div className="flex flex-wrap gap-1.5">
|
|
438
|
+
{quickFilterPresets.map((preset) => {
|
|
439
|
+
const isActive = arraysEqual(viewState.statuses, preset.statuses);
|
|
440
|
+
return (
|
|
441
|
+
<button
|
|
442
|
+
key={preset.label}
|
|
443
|
+
className={`px-2.5 py-1 text-xs rounded-full border transition-colors ${
|
|
444
|
+
isActive
|
|
445
|
+
? "bg-primary text-primary-foreground border-primary"
|
|
446
|
+
: "border-border text-muted-foreground hover:text-foreground hover:border-foreground/30"
|
|
447
|
+
}`}
|
|
448
|
+
onClick={() => updateView({ statuses: isActive ? [] : [...preset.statuses] })}
|
|
449
|
+
>
|
|
450
|
+
{preset.label}
|
|
451
|
+
</button>
|
|
452
|
+
);
|
|
453
|
+
})}
|
|
454
|
+
</div>
|
|
455
|
+
</div>
|
|
456
|
+
|
|
457
|
+
<div className="border-t border-border" />
|
|
458
|
+
|
|
459
|
+
{/* Multi-column filter sections */}
|
|
460
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-3">
|
|
461
|
+
{/* Status */}
|
|
462
|
+
<div className="space-y-1">
|
|
463
|
+
<span className="text-xs text-muted-foreground">Status</span>
|
|
464
|
+
<div className="space-y-0.5">
|
|
465
|
+
{statusOrder.map((s) => (
|
|
466
|
+
<label key={s} className="flex items-center gap-2 px-2 py-1 rounded-sm hover:bg-accent/50 cursor-pointer">
|
|
467
|
+
<Checkbox
|
|
468
|
+
checked={viewState.statuses.includes(s)}
|
|
469
|
+
onCheckedChange={() => updateView({ statuses: toggleInArray(viewState.statuses, s) })}
|
|
470
|
+
/>
|
|
471
|
+
<StatusIcon status={s} />
|
|
472
|
+
<span className="text-sm">{statusLabel(s)}</span>
|
|
473
|
+
</label>
|
|
474
|
+
))}
|
|
475
|
+
</div>
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
{/* Priority + Assignee stacked in right column */}
|
|
479
|
+
<div className="space-y-3">
|
|
480
|
+
{/* Priority */}
|
|
481
|
+
<div className="space-y-1">
|
|
482
|
+
<span className="text-xs text-muted-foreground">Priority</span>
|
|
483
|
+
<div className="space-y-0.5">
|
|
484
|
+
{priorityOrder.map((p) => (
|
|
485
|
+
<label key={p} className="flex items-center gap-2 px-2 py-1 rounded-sm hover:bg-accent/50 cursor-pointer">
|
|
486
|
+
<Checkbox
|
|
487
|
+
checked={viewState.priorities.includes(p)}
|
|
488
|
+
onCheckedChange={() => updateView({ priorities: toggleInArray(viewState.priorities, p) })}
|
|
489
|
+
/>
|
|
490
|
+
<PriorityIcon priority={p} />
|
|
491
|
+
<span className="text-sm">{statusLabel(p)}</span>
|
|
492
|
+
</label>
|
|
493
|
+
))}
|
|
494
|
+
</div>
|
|
495
|
+
</div>
|
|
496
|
+
|
|
497
|
+
{/* Assignee */}
|
|
498
|
+
<div className="space-y-1">
|
|
499
|
+
<span className="text-xs text-muted-foreground">Assignee</span>
|
|
500
|
+
<div className="space-y-0.5 max-h-32 overflow-y-auto">
|
|
501
|
+
<label className="flex items-center gap-2 px-2 py-1 rounded-sm hover:bg-accent/50 cursor-pointer">
|
|
502
|
+
<Checkbox
|
|
503
|
+
checked={viewState.assignees.includes("__unassigned")}
|
|
504
|
+
onCheckedChange={() => updateView({ assignees: toggleInArray(viewState.assignees, "__unassigned") })}
|
|
505
|
+
/>
|
|
506
|
+
<span className="text-sm">No assignee</span>
|
|
507
|
+
</label>
|
|
508
|
+
{currentUserId && (
|
|
509
|
+
<label className="flex items-center gap-2 px-2 py-1 rounded-sm hover:bg-accent/50 cursor-pointer">
|
|
510
|
+
<Checkbox
|
|
511
|
+
checked={viewState.assignees.includes("__me")}
|
|
512
|
+
onCheckedChange={() => updateView({ assignees: toggleInArray(viewState.assignees, "__me") })}
|
|
513
|
+
/>
|
|
514
|
+
<User className="h-3.5 w-3.5 text-muted-foreground" />
|
|
515
|
+
<span className="text-sm">Me</span>
|
|
516
|
+
</label>
|
|
517
|
+
)}
|
|
518
|
+
{(agents ?? []).map((agent) => (
|
|
519
|
+
<label key={agent.id} className="flex items-center gap-2 px-2 py-1 rounded-sm hover:bg-accent/50 cursor-pointer">
|
|
520
|
+
<Checkbox
|
|
521
|
+
checked={viewState.assignees.includes(agent.id)}
|
|
522
|
+
onCheckedChange={() => updateView({ assignees: toggleInArray(viewState.assignees, agent.id) })}
|
|
523
|
+
/>
|
|
524
|
+
<span className="text-sm">{agent.name}</span>
|
|
525
|
+
</label>
|
|
526
|
+
))}
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|
|
529
|
+
|
|
530
|
+
{labels && labels.length > 0 && (
|
|
531
|
+
<div className="space-y-1">
|
|
532
|
+
<span className="text-xs text-muted-foreground">Labels</span>
|
|
533
|
+
<div className="space-y-0.5 max-h-32 overflow-y-auto">
|
|
534
|
+
{labels.map((label) => (
|
|
535
|
+
<label key={label.id} className="flex items-center gap-2 px-2 py-1 rounded-sm hover:bg-accent/50 cursor-pointer">
|
|
536
|
+
<Checkbox
|
|
537
|
+
checked={viewState.labels.includes(label.id)}
|
|
538
|
+
onCheckedChange={() => updateView({ labels: toggleInArray(viewState.labels, label.id) })}
|
|
539
|
+
/>
|
|
540
|
+
<span className="h-2.5 w-2.5 rounded-full" style={{ backgroundColor: label.color }} />
|
|
541
|
+
<span className="text-sm">{label.name}</span>
|
|
542
|
+
</label>
|
|
543
|
+
))}
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
)}
|
|
547
|
+
|
|
548
|
+
{projects && projects.length > 0 && (
|
|
549
|
+
<div className="space-y-1">
|
|
550
|
+
<span className="text-xs text-muted-foreground">Project</span>
|
|
551
|
+
<div className="space-y-0.5 max-h-32 overflow-y-auto">
|
|
552
|
+
{projects.map((project) => (
|
|
553
|
+
<label key={project.id} className="flex items-center gap-2 px-2 py-1 rounded-sm hover:bg-accent/50 cursor-pointer">
|
|
554
|
+
<Checkbox
|
|
555
|
+
checked={viewState.projects.includes(project.id)}
|
|
556
|
+
onCheckedChange={() => updateView({ projects: toggleInArray(viewState.projects, project.id) })}
|
|
557
|
+
/>
|
|
558
|
+
<span className="text-sm">{project.name}</span>
|
|
559
|
+
</label>
|
|
560
|
+
))}
|
|
561
|
+
</div>
|
|
562
|
+
</div>
|
|
563
|
+
)}
|
|
564
|
+
</div>
|
|
565
|
+
</div>
|
|
566
|
+
</div>
|
|
567
|
+
</PopoverContent>
|
|
568
|
+
</Popover>
|
|
569
|
+
|
|
570
|
+
{/* Sort (list view only) */}
|
|
571
|
+
{viewState.viewMode === "list" && (
|
|
572
|
+
<Popover>
|
|
573
|
+
<PopoverTrigger asChild>
|
|
574
|
+
<Button variant="ghost" size="sm" className="text-xs">
|
|
575
|
+
<ArrowUpDown className="h-3.5 w-3.5 sm:h-3 sm:w-3 sm:mr-1" />
|
|
576
|
+
<span className="hidden sm:inline">Sort</span>
|
|
577
|
+
</Button>
|
|
578
|
+
</PopoverTrigger>
|
|
579
|
+
<PopoverContent align="end" className="w-48 p-0">
|
|
580
|
+
<div className="p-2 space-y-0.5">
|
|
581
|
+
{([
|
|
582
|
+
["status", "Status"],
|
|
583
|
+
["priority", "Priority"],
|
|
584
|
+
["title", "Title"],
|
|
585
|
+
["created", "Created"],
|
|
586
|
+
["updated", "Updated"],
|
|
587
|
+
] as const).map(([field, label]) => (
|
|
588
|
+
<button
|
|
589
|
+
key={field}
|
|
590
|
+
className={`flex items-center justify-between w-full px-2 py-1.5 text-sm rounded-sm ${
|
|
591
|
+
viewState.sortField === field ? "bg-accent/50 text-foreground" : "hover:bg-accent/50 text-muted-foreground"
|
|
592
|
+
}`}
|
|
593
|
+
onClick={() => {
|
|
594
|
+
if (viewState.sortField === field) {
|
|
595
|
+
updateView({ sortDir: viewState.sortDir === "asc" ? "desc" : "asc" });
|
|
596
|
+
} else {
|
|
597
|
+
updateView({ sortField: field, sortDir: "asc" });
|
|
598
|
+
}
|
|
599
|
+
}}
|
|
600
|
+
>
|
|
601
|
+
<span>{label}</span>
|
|
602
|
+
{viewState.sortField === field && (
|
|
603
|
+
<span className="text-xs text-muted-foreground">
|
|
604
|
+
{viewState.sortDir === "asc" ? "\u2191" : "\u2193"}
|
|
605
|
+
</span>
|
|
606
|
+
)}
|
|
607
|
+
</button>
|
|
608
|
+
))}
|
|
609
|
+
</div>
|
|
610
|
+
</PopoverContent>
|
|
611
|
+
</Popover>
|
|
612
|
+
)}
|
|
613
|
+
|
|
614
|
+
{/* Group (list view only) */}
|
|
615
|
+
{viewState.viewMode === "list" && (
|
|
616
|
+
<Popover>
|
|
617
|
+
<PopoverTrigger asChild>
|
|
618
|
+
<Button variant="ghost" size="sm" className="text-xs">
|
|
619
|
+
<Layers className="h-3.5 w-3.5 sm:h-3 sm:w-3 sm:mr-1" />
|
|
620
|
+
<span className="hidden sm:inline">Group</span>
|
|
621
|
+
</Button>
|
|
622
|
+
</PopoverTrigger>
|
|
623
|
+
<PopoverContent align="end" className="w-44 p-0">
|
|
624
|
+
<div className="p-2 space-y-0.5">
|
|
625
|
+
{([
|
|
626
|
+
["status", "Status"],
|
|
627
|
+
["priority", "Priority"],
|
|
628
|
+
["assignee", "Assignee"],
|
|
629
|
+
["none", "None"],
|
|
630
|
+
] as const).map(([value, label]) => (
|
|
631
|
+
<button
|
|
632
|
+
key={value}
|
|
633
|
+
className={`flex items-center justify-between w-full px-2 py-1.5 text-sm rounded-sm ${
|
|
634
|
+
viewState.groupBy === value ? "bg-accent/50 text-foreground" : "hover:bg-accent/50 text-muted-foreground"
|
|
635
|
+
}`}
|
|
636
|
+
onClick={() => updateView({ groupBy: value })}
|
|
637
|
+
>
|
|
638
|
+
<span>{label}</span>
|
|
639
|
+
{viewState.groupBy === value && <Check className="h-3.5 w-3.5" />}
|
|
640
|
+
</button>
|
|
641
|
+
))}
|
|
642
|
+
</div>
|
|
643
|
+
</PopoverContent>
|
|
644
|
+
</Popover>
|
|
645
|
+
)}
|
|
646
|
+
</div>
|
|
647
|
+
</div>
|
|
648
|
+
|
|
649
|
+
{isLoading && <PageSkeleton variant="issues-list" />}
|
|
650
|
+
{error && <p className="text-sm text-destructive">{error.message}</p>}
|
|
651
|
+
|
|
652
|
+
{!isLoading && filtered.length === 0 && viewState.viewMode === "list" && (
|
|
653
|
+
<EmptyState
|
|
654
|
+
icon={CircleDot}
|
|
655
|
+
message="No issues match the current filters or search."
|
|
656
|
+
action="Create Issue"
|
|
657
|
+
onAction={() => openNewIssue(newIssueDefaults())}
|
|
658
|
+
/>
|
|
659
|
+
)}
|
|
660
|
+
|
|
661
|
+
{viewState.viewMode === "board" ? (
|
|
662
|
+
<KanbanBoard
|
|
663
|
+
issues={filtered}
|
|
664
|
+
agents={agents}
|
|
665
|
+
liveIssueIds={liveIssueIds}
|
|
666
|
+
onUpdateIssue={onUpdateIssue}
|
|
667
|
+
/>
|
|
668
|
+
) : (
|
|
669
|
+
groupedContent.map((group) => (
|
|
670
|
+
<Collapsible
|
|
671
|
+
key={group.key}
|
|
672
|
+
open={!viewState.collapsedGroups.includes(group.key)}
|
|
673
|
+
onOpenChange={(open) => {
|
|
674
|
+
updateView({
|
|
675
|
+
collapsedGroups: open
|
|
676
|
+
? viewState.collapsedGroups.filter((k) => k !== group.key)
|
|
677
|
+
: [...viewState.collapsedGroups, group.key],
|
|
678
|
+
});
|
|
679
|
+
}}
|
|
680
|
+
>
|
|
681
|
+
{group.label && (
|
|
682
|
+
<div className="flex items-center py-1.5 pl-1 pr-3">
|
|
683
|
+
<CollapsibleTrigger className="flex items-center gap-1.5">
|
|
684
|
+
<ChevronRight className="h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform [[data-state=open]>&]:rotate-90" />
|
|
685
|
+
<span className="text-sm font-semibold uppercase tracking-wide">
|
|
686
|
+
{group.label}
|
|
687
|
+
</span>
|
|
688
|
+
</CollapsibleTrigger>
|
|
689
|
+
<Button
|
|
690
|
+
variant="ghost"
|
|
691
|
+
size="icon-xs"
|
|
692
|
+
className="ml-auto text-muted-foreground"
|
|
693
|
+
onClick={() => openNewIssue(newIssueDefaults(group.key))}
|
|
694
|
+
>
|
|
695
|
+
<Plus className="h-3 w-3" />
|
|
696
|
+
</Button>
|
|
697
|
+
</div>
|
|
698
|
+
)}
|
|
699
|
+
<CollapsibleContent>
|
|
700
|
+
{group.items.map((issue) => (
|
|
701
|
+
<IssueRow
|
|
702
|
+
key={issue.id}
|
|
703
|
+
issue={issue}
|
|
704
|
+
issueLinkState={issueLinkState}
|
|
705
|
+
desktopLeadingSpacer
|
|
706
|
+
mobileLeading={(
|
|
707
|
+
<span
|
|
708
|
+
onClick={(e) => {
|
|
709
|
+
e.preventDefault();
|
|
710
|
+
e.stopPropagation();
|
|
711
|
+
}}
|
|
712
|
+
>
|
|
713
|
+
<StatusIcon
|
|
714
|
+
status={issue.status}
|
|
715
|
+
onChange={(s) => onUpdateIssue(issue.id, { status: s })}
|
|
716
|
+
/>
|
|
717
|
+
</span>
|
|
718
|
+
)}
|
|
719
|
+
desktopMetaLeading={(
|
|
720
|
+
<>
|
|
721
|
+
<span
|
|
722
|
+
className="hidden shrink-0 sm:inline-flex"
|
|
723
|
+
onClick={(e) => {
|
|
724
|
+
e.preventDefault();
|
|
725
|
+
e.stopPropagation();
|
|
726
|
+
}}
|
|
727
|
+
>
|
|
728
|
+
<StatusIcon
|
|
729
|
+
status={issue.status}
|
|
730
|
+
onChange={(s) => onUpdateIssue(issue.id, { status: s })}
|
|
731
|
+
/>
|
|
732
|
+
</span>
|
|
733
|
+
<span className="shrink-0 font-mono text-xs text-muted-foreground">
|
|
734
|
+
{issue.identifier ?? issue.id.slice(0, 8)}
|
|
735
|
+
</span>
|
|
736
|
+
{liveIssueIds?.has(issue.id) && (
|
|
737
|
+
<span className="inline-flex items-center gap-1 rounded-full bg-blue-500/10 px-1.5 py-0.5 sm:gap-1.5 sm:px-2">
|
|
738
|
+
<span className="relative flex h-2 w-2">
|
|
739
|
+
<span className="absolute inline-flex h-full w-full animate-pulse rounded-full bg-blue-400 opacity-75" />
|
|
740
|
+
<span className="relative inline-flex h-2 w-2 rounded-full bg-blue-500" />
|
|
741
|
+
</span>
|
|
742
|
+
<span className="hidden text-[11px] font-medium text-blue-600 dark:text-blue-400 sm:inline">
|
|
743
|
+
Live
|
|
744
|
+
</span>
|
|
745
|
+
</span>
|
|
746
|
+
)}
|
|
747
|
+
</>
|
|
748
|
+
)}
|
|
749
|
+
mobileMeta={timeAgo(issue.updatedAt)}
|
|
750
|
+
desktopTrailing={(
|
|
751
|
+
<>
|
|
752
|
+
{(issue.labels ?? []).length > 0 && (
|
|
753
|
+
<span className="hidden items-center gap-1 overflow-hidden md:flex md:max-w-[240px]">
|
|
754
|
+
{(issue.labels ?? []).slice(0, 3).map((label) => (
|
|
755
|
+
<span
|
|
756
|
+
key={label.id}
|
|
757
|
+
className="inline-flex items-center rounded-full border px-1.5 py-0.5 text-[10px] font-medium"
|
|
758
|
+
style={{
|
|
759
|
+
borderColor: label.color,
|
|
760
|
+
color: pickTextColorForPillBg(label.color, 0.12),
|
|
761
|
+
backgroundColor: `${label.color}1f`,
|
|
762
|
+
}}
|
|
763
|
+
>
|
|
764
|
+
{label.name}
|
|
765
|
+
</span>
|
|
766
|
+
))}
|
|
767
|
+
{(issue.labels ?? []).length > 3 && (
|
|
768
|
+
<span className="text-[10px] text-muted-foreground">
|
|
769
|
+
+{(issue.labels ?? []).length - 3}
|
|
770
|
+
</span>
|
|
771
|
+
)}
|
|
772
|
+
</span>
|
|
773
|
+
)}
|
|
774
|
+
<Popover
|
|
775
|
+
open={assigneePickerIssueId === issue.id}
|
|
776
|
+
onOpenChange={(open) => {
|
|
777
|
+
setAssigneePickerIssueId(open ? issue.id : null);
|
|
778
|
+
if (!open) setAssigneeSearch("");
|
|
779
|
+
}}
|
|
780
|
+
>
|
|
781
|
+
<PopoverTrigger asChild>
|
|
782
|
+
<button
|
|
783
|
+
className="flex w-[180px] shrink-0 items-center rounded-md px-2 py-1 transition-colors hover:bg-accent/50"
|
|
784
|
+
onClick={(e) => {
|
|
785
|
+
e.preventDefault();
|
|
786
|
+
e.stopPropagation();
|
|
787
|
+
}}
|
|
788
|
+
>
|
|
789
|
+
{issue.assigneeAgentId && agentName(issue.assigneeAgentId) ? (
|
|
790
|
+
<Identity name={agentName(issue.assigneeAgentId)!} size="sm" />
|
|
791
|
+
) : issue.assigneeUserId ? (
|
|
792
|
+
<span className="inline-flex items-center gap-1.5 text-xs">
|
|
793
|
+
<span className="inline-flex h-5 w-5 items-center justify-center rounded-full border border-dashed border-muted-foreground/35 bg-muted/30">
|
|
794
|
+
<User className="h-3 w-3" />
|
|
795
|
+
</span>
|
|
796
|
+
{formatAssigneeUserLabel(issue.assigneeUserId, currentUserId) ?? "User"}
|
|
797
|
+
</span>
|
|
798
|
+
) : (
|
|
799
|
+
<span className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
|
|
800
|
+
<span className="inline-flex h-5 w-5 items-center justify-center rounded-full border border-dashed border-muted-foreground/35 bg-muted/30">
|
|
801
|
+
<User className="h-3 w-3" />
|
|
802
|
+
</span>
|
|
803
|
+
Assignee
|
|
804
|
+
</span>
|
|
805
|
+
)}
|
|
806
|
+
</button>
|
|
807
|
+
</PopoverTrigger>
|
|
808
|
+
<PopoverContent
|
|
809
|
+
className="w-56 p-1"
|
|
810
|
+
align="end"
|
|
811
|
+
onClick={(e) => e.stopPropagation()}
|
|
812
|
+
onPointerDownOutside={() => setAssigneeSearch("")}
|
|
813
|
+
>
|
|
814
|
+
<input
|
|
815
|
+
className="mb-1 w-full border-b border-border bg-transparent px-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground/50"
|
|
816
|
+
placeholder="Search assignees..."
|
|
817
|
+
value={assigneeSearch}
|
|
818
|
+
onChange={(e) => setAssigneeSearch(e.target.value)}
|
|
819
|
+
autoFocus
|
|
820
|
+
/>
|
|
821
|
+
<div className="max-h-48 overflow-y-auto overscroll-contain">
|
|
822
|
+
<button
|
|
823
|
+
className={cn(
|
|
824
|
+
"flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-accent/50",
|
|
825
|
+
!issue.assigneeAgentId && !issue.assigneeUserId && "bg-accent",
|
|
826
|
+
)}
|
|
827
|
+
onClick={(e) => {
|
|
828
|
+
e.preventDefault();
|
|
829
|
+
e.stopPropagation();
|
|
830
|
+
assignIssue(issue.id, null, null);
|
|
831
|
+
}}
|
|
832
|
+
>
|
|
833
|
+
No assignee
|
|
834
|
+
</button>
|
|
835
|
+
{currentUserId && (
|
|
836
|
+
<button
|
|
837
|
+
className={cn(
|
|
838
|
+
"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",
|
|
839
|
+
issue.assigneeUserId === currentUserId && "bg-accent",
|
|
840
|
+
)}
|
|
841
|
+
onClick={(e) => {
|
|
842
|
+
e.preventDefault();
|
|
843
|
+
e.stopPropagation();
|
|
844
|
+
assignIssue(issue.id, null, currentUserId);
|
|
845
|
+
}}
|
|
846
|
+
>
|
|
847
|
+
<User className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
|
|
848
|
+
<span>Me</span>
|
|
849
|
+
</button>
|
|
850
|
+
)}
|
|
851
|
+
{(agents ?? [])
|
|
852
|
+
.filter((agent) => {
|
|
853
|
+
if (!assigneeSearch.trim()) return true;
|
|
854
|
+
return agent.name
|
|
855
|
+
.toLowerCase()
|
|
856
|
+
.includes(assigneeSearch.toLowerCase());
|
|
857
|
+
})
|
|
858
|
+
.map((agent) => (
|
|
859
|
+
<button
|
|
860
|
+
key={agent.id}
|
|
861
|
+
className={cn(
|
|
862
|
+
"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",
|
|
863
|
+
issue.assigneeAgentId === agent.id && "bg-accent",
|
|
864
|
+
)}
|
|
865
|
+
onClick={(e) => {
|
|
866
|
+
e.preventDefault();
|
|
867
|
+
e.stopPropagation();
|
|
868
|
+
assignIssue(issue.id, agent.id, null);
|
|
869
|
+
}}
|
|
870
|
+
>
|
|
871
|
+
<Identity name={agent.name} size="sm" className="min-w-0" />
|
|
872
|
+
</button>
|
|
873
|
+
))}
|
|
874
|
+
</div>
|
|
875
|
+
</PopoverContent>
|
|
876
|
+
</Popover>
|
|
877
|
+
</>
|
|
878
|
+
)}
|
|
879
|
+
trailingMeta={formatDate(issue.createdAt)}
|
|
880
|
+
/>
|
|
881
|
+
))}
|
|
882
|
+
</CollapsibleContent>
|
|
883
|
+
</Collapsible>
|
|
884
|
+
))
|
|
885
|
+
)}
|
|
886
|
+
</div>
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
|