2026-02-20 10:33:10 -06:00
|
|
|
import type { Approval, Issue, IssueAttachment, IssueComment } from "@paperclip/shared";
|
2026-02-16 13:32:04 -06:00
|
|
|
import { api } from "./client";
|
|
|
|
|
|
|
|
|
|
export const issuesApi = {
|
2026-02-23 14:41:21 -06:00
|
|
|
list: (companyId: string, filters?: { projectId?: string }) => {
|
|
|
|
|
const params = new URLSearchParams();
|
|
|
|
|
if (filters?.projectId) params.set("projectId", filters.projectId);
|
|
|
|
|
const qs = params.toString();
|
|
|
|
|
return api.get<Issue[]>(`/companies/${companyId}/issues${qs ? `?${qs}` : ""}`);
|
|
|
|
|
},
|
2026-02-16 13:32:04 -06:00
|
|
|
get: (id: string) => api.get<Issue>(`/issues/${id}`),
|
Overhaul UI with shadcn components and new pages
Add shadcn/ui components (badge, button, card, input, select,
separator). Add company context provider. New pages: Activity,
Approvals, Companies, Costs, Org chart. Restyle existing pages
(Dashboard, Agents, Issues, Goals, Projects) with shadcn components
and dark theme. Update layout, sidebar navigation, and routing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:32 -06:00
|
|
|
create: (companyId: string, data: Record<string, unknown>) =>
|
|
|
|
|
api.post<Issue>(`/companies/${companyId}/issues`, data),
|
|
|
|
|
update: (id: string, data: Record<string, unknown>) => api.patch<Issue>(`/issues/${id}`, data),
|
2026-02-16 13:32:04 -06:00
|
|
|
remove: (id: string) => api.delete<Issue>(`/issues/${id}`),
|
Overhaul UI with shadcn components and new pages
Add shadcn/ui components (badge, button, card, input, select,
separator). Add company context provider. New pages: Activity,
Approvals, Companies, Costs, Org chart. Restyle existing pages
(Dashboard, Agents, Issues, Goals, Projects) with shadcn components
and dark theme. Update layout, sidebar navigation, and routing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:32 -06:00
|
|
|
checkout: (id: string, agentId: string) =>
|
|
|
|
|
api.post<Issue>(`/issues/${id}/checkout`, {
|
|
|
|
|
agentId,
|
|
|
|
|
expectedStatuses: ["todo", "backlog", "blocked"],
|
|
|
|
|
}),
|
|
|
|
|
release: (id: string) => api.post<Issue>(`/issues/${id}/release`, {}),
|
|
|
|
|
listComments: (id: string) => api.get<IssueComment[]>(`/issues/${id}/comments`),
|
UI: Identity component, LiveRunWidget, issue identifiers, and UX improvements
Add Identity component (avatar + name) used across agent/issue displays. Add
LiveRunWidget for real-time streaming of active heartbeat runs on issue detail
pages via WebSocket. Display issue identifiers (PAP-42) instead of UUID
fragments throughout Issues, Inbox, CommandPalette, and detail pages.
Enhance CommentThread with re-open checkbox, Cmd+Enter submit, sorted display,
and run linking. Improve Activity page with richer formatting and filtering.
Update Dashboard with live metrics. Add reports-to agent link in AgentProperties.
Various small fixes: StatusIcon centering, CopyText ref init, agent detail
run-issue cross-links.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:10:07 -06:00
|
|
|
addComment: (id: string, body: string, reopen?: boolean) =>
|
|
|
|
|
api.post<IssueComment>(`/issues/${id}/comments`, reopen === undefined ? { body } : { body, reopen }),
|
2026-02-20 10:33:10 -06:00
|
|
|
listAttachments: (id: string) => api.get<IssueAttachment[]>(`/issues/${id}/attachments`),
|
|
|
|
|
uploadAttachment: (
|
|
|
|
|
companyId: string,
|
|
|
|
|
issueId: string,
|
|
|
|
|
file: File,
|
|
|
|
|
issueCommentId?: string | null,
|
|
|
|
|
) => {
|
|
|
|
|
const form = new FormData();
|
|
|
|
|
form.append("file", file);
|
|
|
|
|
if (issueCommentId) {
|
|
|
|
|
form.append("issueCommentId", issueCommentId);
|
|
|
|
|
}
|
|
|
|
|
return api.postForm<IssueAttachment>(`/companies/${companyId}/issues/${issueId}/attachments`, form);
|
|
|
|
|
},
|
|
|
|
|
deleteAttachment: (id: string) => api.delete<{ ok: true }>(`/attachments/${id}`),
|
UI: approval detail page, agent hiring UX, costs breakdown, sidebar badges, and dashboard improvements
Add ApprovalDetail page with comment thread, revision request/resubmit flow,
and ApprovalPayload component for structured payload display. Extend AgentDetail
with permissions management, config revision history, and duplicate action.
Add agent hire dialog with permission-gated access. Rework Costs page with
per-agent breakdown table and period filtering. Add sidebar badge counts for
pending approvals and inbox items. Enhance Dashboard with live metrics and
sparkline trends. Extend Agents list with pending_approval status and bulk
actions. Update IssueDetail with approval linking. Various component improvements
to MetricCard, InlineEditor, CommentThread, and StatusBadge.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:03:08 -06:00
|
|
|
listApprovals: (id: string) => api.get<Approval[]>(`/issues/${id}/approvals`),
|
|
|
|
|
linkApproval: (id: string, approvalId: string) =>
|
|
|
|
|
api.post<Approval[]>(`/issues/${id}/approvals`, { approvalId }),
|
|
|
|
|
unlinkApproval: (id: string, approvalId: string) =>
|
|
|
|
|
api.delete<{ ok: true }>(`/issues/${id}/approvals/${approvalId}`),
|
2026-02-16 13:32:04 -06:00
|
|
|
};
|