mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 01:50:39 +09:00
## Thinking Path > - Paperclip is a control plane for autonomous AI companies, where adapters are the boundary between the board, agents, and execution runtimes. > - Local adapters currently expose a primary runtime configuration, but operators often need a cheaper model lane for routine or low-risk work. > - That cheap lane has to stay adapter-owned: runtime profile settings should not mutate the primary adapter config or bypass existing auth/secret mediation. > - Issue creation also needs an ergonomic way to request primary, cheap, or custom model behavior for a selected assignee. > - This pull request adds a first-class `cheap` model profile contract across adapter capabilities, heartbeat config resolution, agent configuration, and issue creation. > - The benefit is cheaper task execution can be configured and requested explicitly while preserving adapter boundaries, secret handling, and audit visibility. ## What Changed - Added adapter model-profile capability metadata and a `cheap` profile contract for supported local adapters. - Applied `runtimeConfig.modelProfiles.cheap.adapterConfig` during heartbeat config resolution, including requested/applied/fallback run metadata. - Added agent configuration UI for cheap model profile settings without writing those settings into primary `adapterConfig`. - Added New Issue assignee model lane controls for Primary / Cheap / Custom and request payload handling. - Added run ledger profile badges and Storybook stories for the new cheap-lane UI states. - Added tests for validators, heartbeat model profile application, permission/secret mediation, UI payload helpers, and run ledger rendering. - Added committed UI verification screenshots under `docs/pr-screenshots/pap-2837/`. - Addressed Greptile review feedback around cheap-profile defaults, shared profile types, and fallback test data. ## Verification Local: - `pnpm exec vitest run packages/shared/src/validators/issue.test.ts server/src/__tests__/adapter-registry.test.ts server/src/__tests__/agent-permissions-routes.test.ts server/src/__tests__/heartbeat-model-profile.test.ts ui/src/components/IssueRunLedger.test.tsx ui/src/lib/agent-config-patch.test.ts ui/src/lib/issue-assignee-overrides.test.ts ui/src/lib/new-agent-runtime-config.test.ts` — passed, 8 files / 103 tests. - `pnpm exec vitest run ui/src/lib/new-agent-runtime-config.test.ts ui/src/components/IssueRunLedger.test.tsx` — passed after Greptile/rebase follow-up, 2 files / 17 tests. - `pnpm --filter @paperclipai/ui typecheck` — passed after Greptile/rebase follow-up. - `pnpm -r typecheck` — passed. - `pnpm build` — passed. - `pnpm test:run` — did not complete successfully in this local worktree: it stopped in pre-existing `@paperclipai/adapter-utils` sandbox/SSH fixture suites outside this PR diff. Failures were 5s local timeouts plus `git init -b` unsupported by this machine's Git 2.21.0. The branch-specific targeted suites above passed. - Branch was fetched/rebased onto `public-gh/master`; `git rev-list --left-right --count public-gh/master...HEAD` reports `0 9`. Remote PR checks on latest head `e30bf399146451c86cee98ed528d51d33fa5af5a`: - `policy` — passed. - `verify` — passed. - `e2e` — passed. - `Greptile Review` — passed, confidence score 5/5; Greptile review threads resolved. - `security/snyk (cryppadotta)` — passed. Screenshots: - [New issue cheap lane desktop](https://github.com/paperclipai/paperclip/blob/PAP-2837-plan-cheap-model-for-adapters-that-can-support-it/docs/pr-screenshots/pap-2837/newissue-cheap-desktop.png) - [New issue custom lane desktop](https://github.com/paperclipai/paperclip/blob/PAP-2837-plan-cheap-model-for-adapters-that-can-support-it/docs/pr-screenshots/pap-2837/newissue-custom-desktop.png) - [New issue unsupported adapter desktop](https://github.com/paperclipai/paperclip/blob/PAP-2837-plan-cheap-model-for-adapters-that-can-support-it/docs/pr-screenshots/pap-2837/newissue-unsupported-desktop.png) - [Run ledger model profile badges desktop](https://github.com/paperclipai/paperclip/blob/PAP-2837-plan-cheap-model-for-adapters-that-can-support-it/docs/pr-screenshots/pap-2837/runledger-profile-badges-desktop.png) - Mobile variants are also in `docs/pr-screenshots/pap-2837/`. ## Risks - Medium: heartbeat config mediation now merges runtime model profiles into adapter configs, so adapter secret normalization and host-command restrictions must keep covering nested config paths. - Medium: the UI adds another issue creation choice; unsupported adapters must keep hiding the cheap lane and preserve primary behavior. - Low migration risk: no database migration is included. > 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 coding agent using GPT-5-class reasoning with repo tool use and command execution. Exact served model/context window was not exposed by the runtime. ## 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 - [ ] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
179 lines
10 KiB
TypeScript
179 lines
10 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,
|
|
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,
|
|
},
|
|
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) =>
|
|
["agents", companyId, "adapter-models", adapterType] 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,
|
|
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,
|
|
labels: (companyId: string) => ["issues", companyId, "labels"] as const,
|
|
listByProject: (companyId: string, projectId: string) =>
|
|
["issues", companyId, "project", projectId] 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,
|
|
feedbackVotes: (issueId: string) => ["issues", "feedback-votes", issueId] as const,
|
|
costSummary: (issueId: string) => ["issues", "cost-summary", issueId] as const,
|
|
attachments: (issueId: string) => ["issues", "attachments", issueId] 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,
|
|
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,
|
|
},
|
|
routines: {
|
|
list: (companyId: string) => ["routines", companyId] as const,
|
|
detail: (id: string) => ["routines", "detail", id] as const,
|
|
runs: (id: string) => ["routines", "runs", id] as const,
|
|
activity: (companyId: string, id: string) => ["routines", "activity", companyId, id] 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,
|
|
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,
|
|
},
|
|
goals: {
|
|
list: (companyId: string) => ["goals", companyId] as const,
|
|
detail: (id: string) => ["goals", "detail", id] 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,
|
|
},
|
|
instance: {
|
|
generalSettings: ["instance", "general-settings"] as const,
|
|
schedulerHeartbeats: ["instance", "scheduler-heartbeats"] as const,
|
|
experimentalSettings: ["instance", "experimental-settings"] as const,
|
|
},
|
|
health: ["health"] as const,
|
|
secrets: {
|
|
list: (companyId: string) => ["secrets", companyId] as const,
|
|
providers: (companyId: string) => ["secret-providers", companyId] 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,
|
|
dashboard: (pluginId: string) => ["plugins", pluginId, "dashboard"] as const,
|
|
logs: (pluginId: string) => ["plugins", pluginId, "logs"] as const,
|
|
},
|
|
adapters: {
|
|
all: ["adapters"] as const,
|
|
},
|
|
};
|