2026-03-13 21:30:48 -05:00
|
|
|
import type {
|
|
|
|
|
Approval,
|
|
|
|
|
DocumentRevision,
|
2026-04-02 09:11:49 -05:00
|
|
|
FeedbackTargetType,
|
|
|
|
|
FeedbackTrace,
|
|
|
|
|
FeedbackVote,
|
2026-03-13 21:30:48 -05:00
|
|
|
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";
|
|
|
|
|
|
2026-03-28 09:46:34 -05:00
|
|
|
export type IssueUpdateResponse = Issue & {
|
|
|
|
|
comment?: IssueComment | null;
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-16 13:32:04 -06:00
|
|
|
export const issuesApi = {
|
2026-02-26 16:33:39 -06:00
|
|
|
list: (
|
|
|
|
|
companyId: string,
|
|
|
|
|
filters?: {
|
|
|
|
|
status?: string;
|
|
|
|
|
projectId?: string;
|
2026-04-08 16:56:59 -05:00
|
|
|
parentId?: string;
|
2026-02-26 16:33:39 -06:00
|
|
|
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;
|
2026-03-26 08:19:16 -05:00
|
|
|
inboxArchivedByUserId?: string;
|
2026-03-06 08:21:03 -06:00
|
|
|
unreadForUserId?: string;
|
2026-02-26 16:33:39 -06:00
|
|
|
labelId?: string;
|
2026-03-28 22:21:24 -05:00
|
|
|
executionWorkspaceId?: 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-04-06 20:30:50 -05:00
|
|
|
limit?: number;
|
2026-02-26 16:33:39 -06:00
|
|
|
},
|
|
|
|
|
) => {
|
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-04-08 16:56:59 -05:00
|
|
|
if (filters?.parentId) params.set("parentId", filters.parentId);
|
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);
|
2026-03-26 08:19:16 -05:00
|
|
|
if (filters?.inboxArchivedByUserId) params.set("inboxArchivedByUserId", filters.inboxArchivedByUserId);
|
2026-03-06 08:21:03 -06:00
|
|
|
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-28 22:21:24 -05:00
|
|
|
if (filters?.executionWorkspaceId) params.set("executionWorkspaceId", filters.executionWorkspaceId);
|
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-04-06 20:30:50 -05:00
|
|
|
if (filters?.limit) params.set("limit", String(filters.limit));
|
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`, {}),
|
2026-03-26 16:49:11 -05:00
|
|
|
markUnread: (id: string) => api.delete<{ id: string; removed: boolean }>(`/issues/${id}/read`),
|
2026-03-26 08:19:16 -05:00
|
|
|
archiveFromInbox: (id: string) =>
|
|
|
|
|
api.post<{ id: string; archivedAt: Date }>(`/issues/${id}/inbox-archive`, {}),
|
|
|
|
|
unarchiveFromInbox: (id: string) =>
|
|
|
|
|
api.delete<{ id: string; archivedAt: Date } | { ok: true }>(`/issues/${id}/inbox-archive`),
|
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),
|
2026-03-28 09:46:34 -05:00
|
|
|
update: (id: string, data: Record<string, unknown>) =>
|
|
|
|
|
api.patch<IssueUpdateResponse>(`/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,
|
2026-04-04 11:20:29 -07:00
|
|
|
expectedStatuses: ["todo", "backlog", "blocked", "in_review"],
|
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
|
|
|
}),
|
|
|
|
|
release: (id: string) => api.post<Issue>(`/issues/${id}/release`, {}),
|
2026-04-08 17:22:52 -05:00
|
|
|
listComments: (
|
|
|
|
|
id: string,
|
|
|
|
|
filters?: {
|
|
|
|
|
after?: string;
|
|
|
|
|
order?: "asc" | "desc";
|
|
|
|
|
limit?: number;
|
|
|
|
|
},
|
|
|
|
|
) => {
|
|
|
|
|
const params = new URLSearchParams();
|
|
|
|
|
if (filters?.after) params.set("after", filters.after);
|
|
|
|
|
if (filters?.order) params.set("order", filters.order);
|
|
|
|
|
if (filters?.limit) params.set("limit", String(filters.limit));
|
|
|
|
|
const qs = params.toString();
|
|
|
|
|
return api.get<IssueComment[]>(`/issues/${id}/comments${qs ? `?${qs}` : ""}`);
|
|
|
|
|
},
|
[codex] Improve issue detail and issue-list UX (#3678)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - A core part of that is the operator experience around reading issue
state, agent chat, and sub-task structure
> - The current branch had a long run of issue-detail and issue-list UX
fixes that all improve how humans follow and steer active work
> - Those changes mostly live in the UI/chat surface and should be
reviewed together instead of mixed with workspace/runtime work
> - This pull request packages the issue-detail, chat, markdown, and
sub-issue list improvements into one standalone change
> - The benefit is a cleaner, less jumpy, more reliable issue workflow
on desktop and mobile without coupling it to unrelated server/runtime
refactors
## What Changed
- Stabilized issue chat runtime wiring, optimistic comment handling,
queued-comment cancellation, and composer anchoring during live updates
- Fixed several issue-detail rendering and navigation regressions
including placeholder bleed, local polling scope, mobile inbox-to-issue
transitions, and visible refresh resets
- Improved markdown and rich-content handling with advisory image
normalization, editor fallback behavior, touch mention recovery, and
`issue:` quicklook links
- Refined sub-issue behavior with parent-derived defaults, current-user
inheritance fixes, empty-state cleanup, and a reusable issue-list
presentation for sub-issues
- Added targeted UI tests for the new issue-detail, chat scroll/message,
placeholder-data, markdown, and issue-list behaviors
## Verification
- `pnpm vitest run ui/src/components/IssueChatThread.test.tsx
ui/src/components/MarkdownEditor.test.tsx
ui/src/components/IssuesList.test.tsx
ui/src/context/LiveUpdatesProvider.test.tsx
ui/src/lib/issue-chat-messages.test.ts
ui/src/lib/issue-chat-scroll.test.ts
ui/src/lib/issue-detail-subissues.test.ts
ui/src/lib/query-placeholder-data.test.tsx
ui/src/hooks/usePaperclipIssueRuntime.test.tsx`
## Risks
- Medium: this branch touches the highest-traffic issue-detail UI paths,
so regressions would show up as chat/thread or sub-issue UX glitches
- The changes are UI-heavy and would benefit from reviewer screenshots
or a quick manual browser pass before merge
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots
- [ ] 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>
2026-04-14 12:50:48 -05:00
|
|
|
getComment: (id: string, commentId: string) =>
|
|
|
|
|
api.get<IssueComment>(`/issues/${id}/comments/${commentId}`),
|
2026-04-02 09:11:49 -05:00
|
|
|
listFeedbackVotes: (id: string) => api.get<FeedbackVote[]>(`/issues/${id}/feedback-votes`),
|
|
|
|
|
listFeedbackTraces: (id: string, filters?: Record<string, string | boolean | undefined>) => {
|
|
|
|
|
const params = new URLSearchParams();
|
|
|
|
|
for (const [key, value] of Object.entries(filters ?? {})) {
|
|
|
|
|
if (value === undefined) continue;
|
|
|
|
|
params.set(key, String(value));
|
|
|
|
|
}
|
|
|
|
|
const qs = params.toString();
|
|
|
|
|
return api.get<FeedbackTrace[]>(`/issues/${id}/feedback-traces${qs ? `?${qs}` : ""}`);
|
|
|
|
|
},
|
|
|
|
|
upsertFeedbackVote: (
|
|
|
|
|
id: string,
|
|
|
|
|
data: {
|
|
|
|
|
targetType: FeedbackTargetType;
|
|
|
|
|
targetId: string;
|
|
|
|
|
vote: "up" | "down";
|
|
|
|
|
reason?: string;
|
|
|
|
|
allowSharing?: boolean;
|
|
|
|
|
},
|
|
|
|
|
) => api.post<FeedbackVote>(`/issues/${id}/feedback-votes`, data),
|
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 }),
|
|
|
|
|
},
|
|
|
|
|
),
|
[codex] Improve issue detail and issue-list UX (#3678)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - A core part of that is the operator experience around reading issue
state, agent chat, and sub-task structure
> - The current branch had a long run of issue-detail and issue-list UX
fixes that all improve how humans follow and steer active work
> - Those changes mostly live in the UI/chat surface and should be
reviewed together instead of mixed with workspace/runtime work
> - This pull request packages the issue-detail, chat, markdown, and
sub-issue list improvements into one standalone change
> - The benefit is a cleaner, less jumpy, more reliable issue workflow
on desktop and mobile without coupling it to unrelated server/runtime
refactors
## What Changed
- Stabilized issue chat runtime wiring, optimistic comment handling,
queued-comment cancellation, and composer anchoring during live updates
- Fixed several issue-detail rendering and navigation regressions
including placeholder bleed, local polling scope, mobile inbox-to-issue
transitions, and visible refresh resets
- Improved markdown and rich-content handling with advisory image
normalization, editor fallback behavior, touch mention recovery, and
`issue:` quicklook links
- Refined sub-issue behavior with parent-derived defaults, current-user
inheritance fixes, empty-state cleanup, and a reusable issue-list
presentation for sub-issues
- Added targeted UI tests for the new issue-detail, chat scroll/message,
placeholder-data, markdown, and issue-list behaviors
## Verification
- `pnpm vitest run ui/src/components/IssueChatThread.test.tsx
ui/src/components/MarkdownEditor.test.tsx
ui/src/components/IssuesList.test.tsx
ui/src/context/LiveUpdatesProvider.test.tsx
ui/src/lib/issue-chat-messages.test.ts
ui/src/lib/issue-chat-scroll.test.ts
ui/src/lib/issue-detail-subissues.test.ts
ui/src/lib/query-placeholder-data.test.tsx
ui/src/hooks/usePaperclipIssueRuntime.test.tsx`
## Risks
- Medium: this branch touches the highest-traffic issue-detail UI paths,
so regressions would show up as chat/thread or sub-issue UX glitches
- The changes are UI-heavy and would benefit from reviewer screenshots
or a quick manual browser pass before merge
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots
- [ ] 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>
2026-04-14 12:50:48 -05:00
|
|
|
cancelComment: (id: string, commentId: string) =>
|
|
|
|
|
api.delete<IssueComment>(`/issues/${id}/comments/${commentId}`),
|
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`),
|
2026-03-26 08:24:57 -05:00
|
|
|
restoreDocumentRevision: (id: string, key: string, revisionId: string) =>
|
|
|
|
|
api.post<IssueDocument>(`/issues/${id}/documents/${encodeURIComponent(key)}/revisions/${revisionId}/restore`, {}),
|
2026-03-13 21:30:48 -05:00
|
|
|
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
|
|
|
};
|