mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-07 16:11:46 +02:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The execution workspace subsystem powers project and workspace views by listing runtime state, branch metadata, issue links, and status summaries. > - The existing workspace views relied on broad list data that can grow expensive as a company accumulates many workspaces and linked issues. > - That makes the Workspaces page and project workspace cards slower than necessary because the UI does not always need the full workspace detail payload up front. > - This pull request adds a bounded overview contract for workspace listings and moves the relevant UI surfaces to that cheaper path. > - The benefit is faster workspace loading while preserving detail fetches for pages that actually need full workspace data. ## Linked Issues or Issue Description No public GitHub issue exists for this change. Inline bug report follows the repository bug template. ### What happened? Workspace index-style screens can load too much execution workspace detail before the user asks for it. Several UI surfaces used fuller workspace data paths for summary displays, which can make workspace loading slower as workspace history grows. ### Expected behavior Overview screens should request a bounded summary payload, while detail screens should keep using the full workspace detail endpoint. ### Steps to reproduce 1. Run Paperclip from source with enough execution workspace history to make workspace lists non-trivial. 2. Open the Workspaces page or a project workspace summary card. 3. Observe that summary UI needs only bounded workspace metadata but can depend on broader workspace payloads. ### Paperclip version or commit `master` at the time this branch was prepared. ### Deployment mode Local dev (`pnpm dev`) ## What Changed - Added shared types, validators, and path constants for bounded execution workspace overviews. - Added server service and route support for overview queries with bounded linked issue/runtime metadata. - Updated workspace overview UI API calls, query keys, breadcrumbs, quicklooks, close dialogs, project summaries, and detail links to consume the cheaper overview shape where appropriate. - Added regression coverage for the new server route/service behavior and the UI overview consumers. - Registered the new workspace overview route in the generated OpenAPI spec. - Kept overview totals aligned with the project join and preserved project slug links in workspace headers. ## Verification - `pnpm exec vitest run server/src/__tests__/execution-workspaces-service.test.ts server/src/__tests__/execution-workspaces-routes.test.ts ui/src/api/execution-workspaces.test.ts ui/src/components/ProjectWorkspaceSummaryCard.test.tsx ui/src/pages/Workspaces.test.tsx` - `pnpm --filter @paperclipai/shared typecheck && pnpm --filter @paperclipai/server typecheck && pnpm --filter @paperclipai/ui typecheck` - `pnpm exec vitest run server/src/__tests__/openapi-routes.test.ts server/src/__tests__/execution-workspaces-routes.test.ts server/src/__tests__/execution-workspaces-service.test.ts` - `pnpm test:run:serialized -- --shard-index 1 --shard-count 4` ## Risks Low to medium risk. The change introduces a new overview contract across shared/server/ui layers, so the main risk is a mismatch between summary and detail payload expectations. The added route/service/UI tests cover the intended split, and full detail pages continue using the detail path. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used OpenAI Codex, GPT-5-based coding agent with repository tool use and local command execution. Exact served model identifier and context window were not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
276 lines
15 KiB
TypeScript
276 lines
15 KiB
TypeScript
export const queryKeys = {
|
|
companies: {
|
|
all: ["companies"] as const,
|
|
detail: (id: string) => ["companies", id] as const,
|
|
stats: ["companies", "stats"] as const,
|
|
},
|
|
companySkills: {
|
|
list: (companyId: string) => ["company-skills", companyId] as const,
|
|
detail: (companyId: string, skillId: string) => ["company-skills", companyId, skillId] as const,
|
|
versions: (companyId: string, skillId: string) => ["company-skills", companyId, skillId, "versions"] as const,
|
|
comments: (companyId: string, skillId: string) => ["company-skills", companyId, skillId, "comments"] as const,
|
|
updateStatus: (companyId: string, skillId: string) =>
|
|
["company-skills", companyId, skillId, "update-status"] as const,
|
|
file: (companyId: string, skillId: string, relativePath: string) =>
|
|
["company-skills", companyId, skillId, "file", relativePath] as const,
|
|
catalog: (filters: { kind?: string; category?: string; q?: string } = {}) =>
|
|
["company-skills", "catalog", filters.kind ?? "__all-kinds__", filters.category ?? "__all-categories__", filters.q ?? ""] as const,
|
|
catalogDetail: (catalogRef: string) => ["company-skills", "catalog", "detail", catalogRef] as const,
|
|
catalogFile: (catalogRef: string, relativePath: string) =>
|
|
["company-skills", "catalog", "file", catalogRef, relativePath] as const,
|
|
},
|
|
teamCatalog: {
|
|
catalog: (filters: { kind?: string; category?: string; q?: string } = {}) =>
|
|
["team-catalog", "catalog", filters.kind ?? "__all-kinds__", filters.category ?? "__all-categories__", filters.q ?? ""] as const,
|
|
catalogDetail: (catalogRef: string) => ["team-catalog", "catalog", "detail", catalogRef] as const,
|
|
catalogFile: (catalogRef: string, relativePath: string) =>
|
|
["team-catalog", "catalog", "file", catalogRef, relativePath] as const,
|
|
installed: (companyId: string) => ["team-catalog", "installed", companyId] as const,
|
|
},
|
|
agents: {
|
|
list: (companyId: string) => ["agents", companyId] as const,
|
|
detail: (id: string) => ["agents", "detail", id] as const,
|
|
runtimeState: (id: string) => ["agents", "runtime-state", id] as const,
|
|
taskSessions: (id: string) => ["agents", "task-sessions", id] as const,
|
|
skills: (id: string) => ["agents", "skills", id] as const,
|
|
instructionsBundle: (id: string) => ["agents", "instructions-bundle", id] as const,
|
|
instructionsFile: (id: string, relativePath: string) =>
|
|
["agents", "instructions-bundle", id, "file", relativePath] as const,
|
|
keys: (agentId: string) => ["agents", "keys", agentId] as const,
|
|
configRevisions: (agentId: string) => ["agents", "config-revisions", agentId] as const,
|
|
adapterModels: (companyId: string, adapterType: string, environmentId?: string | null) =>
|
|
["agents", companyId, "adapter-models", adapterType, environmentId ?? null] as const,
|
|
adapterModelProfiles: (companyId: string, adapterType: string) =>
|
|
["agents", companyId, "adapter-model-profiles", adapterType] as const,
|
|
detectModel: (companyId: string, adapterType: string) =>
|
|
["agents", companyId, "detect-model", adapterType] as const,
|
|
},
|
|
issues: {
|
|
list: (companyId: string) => ["issues", companyId] as const,
|
|
mentionPool: (companyId: string) => ["issues", companyId, "mention-pool"] as const,
|
|
search: (companyId: string, q: string, projectId?: string, limit?: number) =>
|
|
["issues", companyId, "search", q, projectId ?? "__all-projects__", limit ?? "__no-limit__"] as const,
|
|
listAssignedToMe: (companyId: string) => ["issues", companyId, "assigned-to-me"] as const,
|
|
listMineByMe: (companyId: string) => ["issues", companyId, "mine-by-me"] as const,
|
|
listTouchedByMe: (companyId: string) => ["issues", companyId, "touched-by-me"] as const,
|
|
listUnreadTouchedByMe: (companyId: string) => ["issues", companyId, "unread-touched-by-me"] as const,
|
|
listBlockedAttention: (companyId: string) => ["issues", companyId, "blocked-attention"] as const,
|
|
countBlockedAttention: (companyId: string) => ["issues", companyId, "blocked-attention", "count"] as const,
|
|
labels: (companyId: string) => ["issues", companyId, "labels"] as const,
|
|
listByProject: (companyId: string, projectId: string) =>
|
|
["issues", companyId, "project", projectId] as const,
|
|
listPluginOperationsByProject: (companyId: string, projectId: string, originKindPrefix: string) =>
|
|
["issues", companyId, "project", projectId, "plugin-operations", originKindPrefix] as const,
|
|
listByParent: (companyId: string, parentId: string) =>
|
|
["issues", companyId, "parent", parentId] as const,
|
|
listByDescendantRoot: (companyId: string, rootIssueId: string) =>
|
|
["issues", companyId, "descendants", rootIssueId] as const,
|
|
listByExecutionWorkspace: (companyId: string, executionWorkspaceId: string) =>
|
|
["issues", companyId, "execution-workspace", executionWorkspaceId] as const,
|
|
detail: (id: string) => ["issues", "detail", id] as const,
|
|
comments: (issueId: string) => ["issues", "comments", issueId] as const,
|
|
interactions: (issueId: string) => ["issues", "interactions", issueId] as const,
|
|
acceptedPlanDecompositions: (issueId: string) =>
|
|
["issues", "accepted-plan-decompositions", issueId] as const,
|
|
feedbackVotes: (issueId: string) => ["issues", "feedback-votes", issueId] as const,
|
|
costSummary: (issueId: string, options: { excludeRoot?: boolean } = {}) =>
|
|
options.excludeRoot
|
|
? (["issues", "cost-summary", issueId, "exclude-root"] as const)
|
|
: (["issues", "cost-summary", issueId] as const),
|
|
attachments: (issueId: string) => ["issues", "attachments", issueId] as const,
|
|
attachmentPreview: (attachmentId: string) => ["issues", "attachment-preview", attachmentId] as const,
|
|
documents: (issueId: string) => ["issues", "documents", issueId] as const,
|
|
document: (issueId: string, key: string) => ["issues", "document", issueId, key] as const,
|
|
documentRevisions: (issueId: string, key: string) => ["issues", "document-revisions", issueId, key] as const,
|
|
documentAnnotations: (issueId: string, key: string, status: "open" | "resolved" | "all" = "all") =>
|
|
["issues", "document-annotations", issueId, key, status] as const,
|
|
activity: (issueId: string) => ["issues", "activity", issueId] as const,
|
|
runs: (issueId: string) => ["issues", "runs", issueId] as const,
|
|
approvals: (issueId: string) => ["issues", "approvals", issueId] as const,
|
|
liveRuns: (issueId: string) => ["issues", "live-runs", issueId] as const,
|
|
activeRun: (issueId: string) => ["issues", "active-run", issueId] as const,
|
|
workProducts: (issueId: string) => ["issues", "work-products", issueId] as const,
|
|
fileResources: (
|
|
issueId: string,
|
|
options: {
|
|
workspace?: string;
|
|
projectId?: string | null;
|
|
workspaceId?: string | null;
|
|
path?: string | null;
|
|
mode?: string;
|
|
q?: string | null;
|
|
limit?: number;
|
|
offset?: number;
|
|
} = {},
|
|
) =>
|
|
["issues", "file-resources", issueId, "list", options] as const,
|
|
fileResource: (
|
|
issueId: string,
|
|
query: { path: string; workspace?: string; projectId?: string | null; workspaceId?: string | null },
|
|
) =>
|
|
["issues", "file-resources", issueId, "resolve", query] as const,
|
|
fileResourceContent: (
|
|
issueId: string,
|
|
query: { path: string; workspace?: string; projectId?: string | null; workspaceId?: string | null },
|
|
) =>
|
|
["issues", "file-resources", issueId, "content", query] as const,
|
|
},
|
|
routines: {
|
|
list: (companyId: string, filters?: { projectId?: string | null }) =>
|
|
["routines", companyId, filters?.projectId ?? "__all-projects__"] as const,
|
|
detail: (id: string) => ["routines", "detail", id] as const,
|
|
runs: (id: string) => ["routines", "runs", id] as const,
|
|
revisions: (id: string) => ["routines", "revisions", id] as const,
|
|
activity: (companyId: string, id: string) => ["routines", "activity", companyId, id] as const,
|
|
documentAnnotations: (routineId: string, key: "description", status: "open" | "resolved" | "all" = "all") =>
|
|
["routines", "document-annotations", routineId, key, status] as const,
|
|
},
|
|
executionWorkspaces: {
|
|
list: (companyId: string, filters?: Record<string, string | boolean | undefined>) =>
|
|
["execution-workspaces", companyId, filters ?? {}] as const,
|
|
summaryList: (companyId: string, filters?: Record<string, string | boolean | undefined>) =>
|
|
["execution-workspaces", companyId, "summary", filters ?? {}] as const,
|
|
overview: (companyId: string, filters?: Record<string, string | number | boolean | undefined>) =>
|
|
["execution-workspaces", companyId, "overview", filters ?? {}] as const,
|
|
detail: (id: string) => ["execution-workspaces", "detail", id] as const,
|
|
closeReadiness: (id: string) => ["execution-workspaces", "close-readiness", id] as const,
|
|
workspaceOperations: (id: string) => ["execution-workspaces", "workspace-operations", id] as const,
|
|
},
|
|
environments: {
|
|
list: (companyId: string) => ["environments", companyId] as const,
|
|
},
|
|
projects: {
|
|
list: (companyId: string) => ["projects", companyId] as const,
|
|
detail: (id: string) => ["projects", "detail", id] as const,
|
|
},
|
|
externalObjects: {
|
|
byIssue: (issueId: string) => ["external-objects", "by-issue", issueId] as const,
|
|
issueSummary: (issueId: string) => ["external-objects", "issue-summary", issueId] as const,
|
|
issueSummaries: (companyId: string, issueIds: readonly string[]) =>
|
|
["external-objects", "issue-summaries", companyId, issueIds] as const,
|
|
projectSummary: (projectId: string) => ["external-objects", "project-summary", projectId] as const,
|
|
},
|
|
goals: {
|
|
list: (companyId: string) => ["goals", companyId] as const,
|
|
detail: (id: string) => ["goals", "detail", id] as const,
|
|
},
|
|
artifacts: {
|
|
list: (
|
|
companyId: string,
|
|
kind?: string,
|
|
q?: string,
|
|
groupBy?: string,
|
|
groupIssueId?: string,
|
|
) =>
|
|
[
|
|
"artifacts",
|
|
companyId,
|
|
kind ?? "all",
|
|
q ?? "",
|
|
groupBy ?? "none",
|
|
groupIssueId ?? "",
|
|
] as const,
|
|
},
|
|
budgets: {
|
|
overview: (companyId: string) => ["budgets", "overview", companyId] as const,
|
|
},
|
|
approvals: {
|
|
list: (companyId: string, status?: string) =>
|
|
["approvals", companyId, status] as const,
|
|
detail: (approvalId: string) => ["approvals", "detail", approvalId] as const,
|
|
comments: (approvalId: string) => ["approvals", "comments", approvalId] as const,
|
|
issues: (approvalId: string) => ["approvals", "issues", approvalId] as const,
|
|
},
|
|
access: {
|
|
invites: (companyId: string, state: string = "all", limit: number = 20) =>
|
|
["access", "invites", "paginated-v1", companyId, state, limit] as const,
|
|
joinRequests: (companyId: string, status: string = "pending_approval") =>
|
|
["access", "join-requests", companyId, status] as const,
|
|
companyMembers: (companyId: string) => ["access", "company-members", companyId] as const,
|
|
companyUserDirectory: (companyId: string) => ["access", "company-user-directory", companyId] as const,
|
|
adminUsers: (query: string) => ["access", "admin-users", query] as const,
|
|
userCompanyAccess: (userId: string) => ["access", "user-company-access", userId] as const,
|
|
invite: (token: string) => ["access", "invite", token] as const,
|
|
currentBoardAccess: ["access", "current-board-access"] as const,
|
|
},
|
|
auth: {
|
|
session: ["auth", "session"] as const,
|
|
},
|
|
sidebarPreferences: {
|
|
companyOrder: (userId: string) => ["sidebar-preferences", "company-order", userId] as const,
|
|
projectOrder: (companyId: string, userId: string) =>
|
|
["sidebar-preferences", "project-order", companyId, userId] as const,
|
|
},
|
|
resourceMemberships: {
|
|
mine: (companyId: string) => ["resource-memberships", companyId, "me"] as const,
|
|
},
|
|
instance: {
|
|
settings: ["instance", "settings"] as const,
|
|
generalSettings: ["instance", "general-settings"] as const,
|
|
schedulerHeartbeats: ["instance", "scheduler-heartbeats"] as const,
|
|
experimentalSettings: ["instance", "experimental-settings"] as const,
|
|
},
|
|
cloudUpstreams: (companyId: string) => ["cloud-upstreams", companyId] as const,
|
|
health: ["health"] as const,
|
|
secrets: {
|
|
list: (companyId: string) => ["secrets", companyId] as const,
|
|
providers: (companyId: string) => ["secret-providers", companyId] as const,
|
|
providerConfigs: (companyId: string) => ["secret-provider-configs", companyId] as const,
|
|
usage: (secretId: string) => ["secrets", "usage", secretId] as const,
|
|
accessEvents: (secretId: string) => ["secrets", "access-events", secretId] as const,
|
|
},
|
|
companySearch: {
|
|
search: (companyId: string, q: string, scope: string, limit: number, offset: number) =>
|
|
["company-search", companyId, q, scope, limit, offset] as const,
|
|
},
|
|
dashboard: (companyId: string) => ["dashboard", companyId] as const,
|
|
userProfile: (companyId: string, userSlug: string) =>
|
|
["user-profile", companyId, userSlug] as const,
|
|
sidebarBadges: (companyId: string) => ["sidebar-badges", companyId] as const,
|
|
inboxDismissals: (companyId: string) => ["inbox-dismissals", companyId] as const,
|
|
activity: (companyId: string) => ["activity", companyId] as const,
|
|
costs: (companyId: string, from?: string, to?: string) =>
|
|
["costs", companyId, from, to] as const,
|
|
usageByProvider: (companyId: string, from?: string, to?: string) =>
|
|
["usage-by-provider", companyId, from, to] as const,
|
|
usageByBiller: (companyId: string, from?: string, to?: string) =>
|
|
["usage-by-biller", companyId, from, to] as const,
|
|
financeSummary: (companyId: string, from?: string, to?: string) =>
|
|
["finance-summary", companyId, from, to] as const,
|
|
financeByBiller: (companyId: string, from?: string, to?: string) =>
|
|
["finance-by-biller", companyId, from, to] as const,
|
|
financeByKind: (companyId: string, from?: string, to?: string) =>
|
|
["finance-by-kind", companyId, from, to] as const,
|
|
financeEvents: (companyId: string, from?: string, to?: string, limit: number = 100) =>
|
|
["finance-events", companyId, from, to, limit] as const,
|
|
usageWindowSpend: (companyId: string) =>
|
|
["usage-window-spend", companyId] as const,
|
|
usageQuotaWindows: (companyId: string) =>
|
|
["usage-quota-windows", companyId] as const,
|
|
heartbeats: (companyId: string, agentId?: string) =>
|
|
["heartbeats", companyId, agentId] as const,
|
|
runDetail: (runId: string) => ["heartbeat-run", runId] as const,
|
|
runWorkspaceOperations: (runId: string) => ["heartbeat-run", runId, "workspace-operations"] as const,
|
|
liveRuns: (companyId: string) => ["live-runs", companyId] as const,
|
|
runIssues: (runId: string) => ["run-issues", runId] as const,
|
|
org: (companyId: string) => ["org", companyId] as const,
|
|
skills: {
|
|
available: ["skills", "available"] as const,
|
|
},
|
|
plugins: {
|
|
all: ["plugins"] as const,
|
|
examples: ["plugins", "examples"] as const,
|
|
detail: (pluginId: string) => ["plugins", pluginId] as const,
|
|
health: (pluginId: string) => ["plugins", pluginId, "health"] as const,
|
|
uiContributions: ["plugins", "ui-contributions"] as const,
|
|
config: (pluginId: string) => ["plugins", pluginId, "config"] as const,
|
|
localFolders: (pluginId: string, companyId: string) =>
|
|
["plugins", pluginId, "companies", companyId, "local-folders"] as const,
|
|
dashboard: (pluginId: string) => ["plugins", pluginId, "dashboard"] as const,
|
|
logs: (pluginId: string) => ["plugins", pluginId, "logs"] as const,
|
|
},
|
|
adapters: {
|
|
all: ["adapters"] as const,
|
|
},
|
|
};
|