2026-03-13 21:30:48 -05:00
|
|
|
import type {
|
|
|
|
|
Approval,
|
|
|
|
|
DocumentRevision,
|
|
|
|
|
Issue,
|
|
|
|
|
IssueAttachment,
|
|
|
|
|
IssueComment,
|
|
|
|
|
IssueDocument,
|
|
|
|
|
IssueLabel,
|
2026-03-14 12:24:40 -05:00
|
|
|
IssueWorkProduct,
|
2026-03-13 21:30:48 -05:00
|
|
|
UpsertIssueDocument,
|
|
|
|
|
} from "@paperclipai/shared";
|
2026-02-16 13:32:04 -06:00
|
|
|
import { api } from "./client";
|
|
|
|
|
|
|
|
|
|
export const issuesApi = {
|
2026-02-26 16:33:39 -06:00
|
|
|
list: (
|
|
|
|
|
companyId: string,
|
|
|
|
|
filters?: {
|
|
|
|
|
status?: string;
|
|
|
|
|
projectId?: string;
|
|
|
|
|
assigneeAgentId?: string;
|
2026-03-21 12:20:48 -05:00
|
|
|
participantAgentId?: string;
|
2026-02-26 16:33:39 -06:00
|
|
|
assigneeUserId?: string;
|
2026-03-06 08:21:03 -06:00
|
|
|
touchedByUserId?: string;
|
|
|
|
|
unreadForUserId?: string;
|
2026-02-26 16:33:39 -06:00
|
|
|
labelId?: string;
|
2026-03-19 08:39:24 -05:00
|
|
|
originKind?: string;
|
|
|
|
|
originId?: string;
|
|
|
|
|
includeRoutineExecutions?: boolean;
|
2026-02-26 16:33:39 -06:00
|
|
|
q?: string;
|
|
|
|
|
},
|
|
|
|
|
) => {
|
2026-02-23 14:41:21 -06:00
|
|
|
const params = new URLSearchParams();
|
2026-02-26 16:33:39 -06:00
|
|
|
if (filters?.status) params.set("status", filters.status);
|
2026-02-23 14:41:21 -06:00
|
|
|
if (filters?.projectId) params.set("projectId", filters.projectId);
|
2026-02-26 16:33:39 -06:00
|
|
|
if (filters?.assigneeAgentId) params.set("assigneeAgentId", filters.assigneeAgentId);
|
2026-03-21 12:20:48 -05:00
|
|
|
if (filters?.participantAgentId) params.set("participantAgentId", filters.participantAgentId);
|
2026-02-26 16:33:39 -06:00
|
|
|
if (filters?.assigneeUserId) params.set("assigneeUserId", filters.assigneeUserId);
|
2026-03-06 08:21:03 -06:00
|
|
|
if (filters?.touchedByUserId) params.set("touchedByUserId", filters.touchedByUserId);
|
|
|
|
|
if (filters?.unreadForUserId) params.set("unreadForUserId", filters.unreadForUserId);
|
2026-02-26 16:33:39 -06:00
|
|
|
if (filters?.labelId) params.set("labelId", filters.labelId);
|
2026-03-19 08:39:24 -05:00
|
|
|
if (filters?.originKind) params.set("originKind", filters.originKind);
|
|
|
|
|
if (filters?.originId) params.set("originId", filters.originId);
|
|
|
|
|
if (filters?.includeRoutineExecutions) params.set("includeRoutineExecutions", "true");
|
2026-02-26 16:33:39 -06:00
|
|
|
if (filters?.q) params.set("q", filters.q);
|
2026-02-23 14:41:21 -06:00
|
|
|
const qs = params.toString();
|
|
|
|
|
return api.get<Issue[]>(`/companies/${companyId}/issues${qs ? `?${qs}` : ""}`);
|
|
|
|
|
},
|
2026-02-25 08:38:37 -06:00
|
|
|
listLabels: (companyId: string) => api.get<IssueLabel[]>(`/companies/${companyId}/labels`),
|
|
|
|
|
createLabel: (companyId: string, data: { name: string; color: string }) =>
|
|
|
|
|
api.post<IssueLabel>(`/companies/${companyId}/labels`, data),
|
|
|
|
|
deleteLabel: (id: string) => api.delete<IssueLabel>(`/labels/${id}`),
|
2026-02-16 13:32:04 -06:00
|
|
|
get: (id: string) => api.get<Issue>(`/issues/${id}`),
|
2026-03-06 08:34:19 -06:00
|
|
|
markRead: (id: string) => api.post<{ id: string; lastReadAt: Date }>(`/issues/${id}/read`, {}),
|
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`),
|
2026-03-02 16:44:03 -06:00
|
|
|
addComment: (id: string, body: string, reopen?: boolean, interrupt?: boolean) =>
|
|
|
|
|
api.post<IssueComment>(
|
|
|
|
|
`/issues/${id}/comments`,
|
|
|
|
|
{
|
|
|
|
|
body,
|
|
|
|
|
...(reopen === undefined ? {} : { reopen }),
|
|
|
|
|
...(interrupt === undefined ? {} : { interrupt }),
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-03-13 21:30:48 -05:00
|
|
|
listDocuments: (id: string) => api.get<IssueDocument[]>(`/issues/${id}/documents`),
|
|
|
|
|
getDocument: (id: string, key: string) => api.get<IssueDocument>(`/issues/${id}/documents/${encodeURIComponent(key)}`),
|
|
|
|
|
upsertDocument: (id: string, key: string, data: UpsertIssueDocument) =>
|
|
|
|
|
api.put<IssueDocument>(`/issues/${id}/documents/${encodeURIComponent(key)}`, data),
|
|
|
|
|
listDocumentRevisions: (id: string, key: string) =>
|
|
|
|
|
api.get<DocumentRevision[]>(`/issues/${id}/documents/${encodeURIComponent(key)}/revisions`),
|
|
|
|
|
deleteDocument: (id: string, key: string) =>
|
|
|
|
|
api.delete<{ ok: true }>(`/issues/${id}/documents/${encodeURIComponent(key)}`),
|
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-03-13 17:12:25 -05:00
|
|
|
listWorkProducts: (id: string) => api.get<IssueWorkProduct[]>(`/issues/${id}/work-products`),
|
|
|
|
|
createWorkProduct: (id: string, data: Record<string, unknown>) =>
|
|
|
|
|
api.post<IssueWorkProduct>(`/issues/${id}/work-products`, data),
|
|
|
|
|
updateWorkProduct: (id: string, data: Record<string, unknown>) =>
|
|
|
|
|
api.patch<IssueWorkProduct>(`/work-products/${id}`, data),
|
|
|
|
|
deleteWorkProduct: (id: string) => api.delete<IssueWorkProduct>(`/work-products/${id}`),
|
2026-02-16 13:32:04 -06:00
|
|
|
};
|