feat(documents): surface filesystem work-products in Document Center

The Document Center only read the `documents` table, which is prose
content POSTed via /api/documents. Everything the agents wrote via
`bash` / `write` / `edit` — the bulk of their output on a real
project — landed in `work_products` and never appeared on the page.
Operators saw "0 items" after a full night's run.

Lift work_products into the same UI:

  - `listWorkProductsForCompany` returns a newest-first slice with a
    500-row cap so the snapshot stays bounded.
  - `ProfileSnapshot.workProducts` flows through `useCompanyData` as
    `companyWorkProducts`, filtered to the current company.
  - `DocumentCenter` renders two labelled sections in order — prose
    documents (editable) on top, files & deliverables below. Each
    work-product row opens the underlying URL or filesystem path
    when clickable, so the agent's bash-generated markdown, PRs,
    and artifacts are one click away.

`WorkProductRecord` lifts into `@shared/types/records-extended` so
the renderer, snapshot, and database shells all reference the same
shape. The store-test fixture learns about the new field.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-19 13:24:50 -04:00
1 parent 734a2b04e0
commit 22ba7a9004
15 files changed
+890 -158

No files matched your search

+20
View File
@@ -97,6 +97,26 @@ export interface DocumentRecord {
updatedAt: string;
}
export interface WorkProductRecord {
id: string;
companyId: string;
projectId: string | null;
taskId: string | null;
type: string;
provider: string;
externalId: string | null;
title: string;
url: string | null;
status: string;
reviewState: string;
isPrimary: boolean;
summary: string | null;
metadataJson: string | null;
createdByRunId: string | null;
createdAt: string;
updatedAt: string;
}
export interface KnowledgeEntryRecord {
id: string;
companyId: string;
+3
View File
@@ -22,6 +22,7 @@ import type {
AutomationRuleRecord,
AgentMessageRecord,
WorkflowPipelineRecord,
WorkProductRecord,
} from "./records-extended";
export interface ProfileSnapshot {
@@ -51,6 +52,7 @@ export interface ProfileSnapshot {
socialAccounts: SocialAccountRecord[];
meetings: MeetingRecord[];
documents: DocumentRecord[];
workProducts: WorkProductRecord[];
knowledgeBase: KnowledgeEntryRecord[];
sprints: SprintRecord[];
automationRules: AutomationRuleRecord[];
@@ -86,6 +88,7 @@ export const COMPANY_SCOPED_KEYS = [
"socialAccounts",
"meetings",
"documents",
"workProducts",
"knowledgeBase",
"sprints",
"automationRules",