stagent 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -2
- package/dist/cli.js +226 -1
- package/docs/.coverage-gaps.json +66 -16
- package/docs/.last-generated +1 -1
- package/docs/features/dashboard-kanban.md +13 -7
- package/docs/features/settings.md +15 -3
- package/docs/features/tables.md +122 -0
- package/docs/index.md +3 -2
- package/docs/journeys/developer.md +26 -16
- package/docs/journeys/personal-use.md +23 -9
- package/docs/journeys/power-user.md +40 -14
- package/docs/journeys/work-use.md +43 -15
- package/docs/manifest.json +27 -17
- package/package.json +3 -1
- package/src/app/api/chat/entities/search/route.ts +12 -3
- package/src/app/api/projects/[id]/route.ts +37 -0
- package/src/app/api/projects/__tests__/delete-project.test.ts +12 -0
- package/src/app/api/snapshots/[id]/restore/route.ts +62 -0
- package/src/app/api/snapshots/[id]/route.ts +44 -0
- package/src/app/api/snapshots/route.ts +54 -0
- package/src/app/api/snapshots/settings/route.ts +67 -0
- package/src/app/api/tables/[id]/charts/[chartId]/route.ts +89 -0
- package/src/app/api/tables/[id]/charts/route.ts +72 -0
- package/src/app/api/tables/[id]/columns/route.ts +70 -0
- package/src/app/api/tables/[id]/export/route.ts +94 -0
- package/src/app/api/tables/[id]/history/route.ts +15 -0
- package/src/app/api/tables/[id]/import/route.ts +111 -0
- package/src/app/api/tables/[id]/route.ts +86 -0
- package/src/app/api/tables/[id]/rows/[rowId]/history/route.ts +32 -0
- package/src/app/api/tables/[id]/rows/[rowId]/route.ts +51 -0
- package/src/app/api/tables/[id]/rows/route.ts +101 -0
- package/src/app/api/tables/[id]/triggers/[triggerId]/route.ts +65 -0
- package/src/app/api/tables/[id]/triggers/route.ts +122 -0
- package/src/app/api/tables/route.ts +65 -0
- package/src/app/api/tables/templates/route.ts +92 -0
- package/src/app/settings/page.tsx +2 -0
- package/src/app/tables/[id]/page.tsx +67 -0
- package/src/app/tables/page.tsx +21 -0
- package/src/app/tables/templates/page.tsx +19 -0
- package/src/components/chat/chat-table-result.tsx +139 -0
- package/src/components/documents/document-browser.tsx +1 -1
- package/src/components/projects/project-form-sheet.tsx +3 -27
- package/src/components/schedules/schedule-form.tsx +5 -27
- package/src/components/settings/data-management-section.tsx +17 -12
- package/src/components/settings/database-snapshots-section.tsx +469 -0
- package/src/components/shared/app-sidebar.tsx +2 -0
- package/src/components/shared/document-picker-sheet.tsx +214 -11
- package/src/components/tables/table-browser.tsx +234 -0
- package/src/components/tables/table-cell-editor.tsx +226 -0
- package/src/components/tables/table-chart-builder.tsx +288 -0
- package/src/components/tables/table-chart-view.tsx +146 -0
- package/src/components/tables/table-column-header.tsx +103 -0
- package/src/components/tables/table-column-sheet.tsx +331 -0
- package/src/components/tables/table-create-sheet.tsx +240 -0
- package/src/components/tables/table-detail-sheet.tsx +144 -0
- package/src/components/tables/table-detail-tabs.tsx +278 -0
- package/src/components/tables/table-grid.tsx +61 -0
- package/src/components/tables/table-history-tab.tsx +148 -0
- package/src/components/tables/table-import-wizard.tsx +542 -0
- package/src/components/tables/table-list-table.tsx +95 -0
- package/src/components/tables/table-relation-combobox.tsx +217 -0
- package/src/components/tables/table-spreadsheet.tsx +499 -0
- package/src/components/tables/table-template-gallery.tsx +162 -0
- package/src/components/tables/table-template-preview.tsx +219 -0
- package/src/components/tables/table-toolbar.tsx +79 -0
- package/src/components/tables/table-triggers-tab.tsx +446 -0
- package/src/components/tables/types.ts +6 -0
- package/src/components/tables/use-spreadsheet-keys.ts +171 -0
- package/src/components/tables/utils.ts +29 -0
- package/src/components/tasks/task-create-panel.tsx +5 -31
- package/src/components/tasks/task-edit-dialog.tsx +5 -27
- package/src/components/workflows/workflow-form-view.tsx +5 -29
- package/src/components/workflows/workflow-status-view.tsx +1 -1
- package/src/instrumentation.ts +3 -0
- package/src/lib/agents/__tests__/claude-agent.test.ts +5 -1
- package/src/lib/agents/claude-agent.ts +3 -1
- package/src/lib/agents/runtime/anthropic-direct.ts +29 -0
- package/src/lib/agents/runtime/openai-direct.ts +29 -0
- package/src/lib/chat/stagent-tools.ts +2 -0
- package/src/lib/chat/tool-catalog.ts +34 -0
- package/src/lib/chat/tools/table-tools.ts +955 -0
- package/src/lib/constants/table-status.ts +68 -0
- package/src/lib/data/__tests__/clear.test.ts +1 -1
- package/src/lib/data/clear.ts +45 -0
- package/src/lib/data/seed-data/__tests__/profiles.test.ts +28 -23
- package/src/lib/data/seed-data/conversations.ts +350 -42
- package/src/lib/data/seed-data/documents.ts +564 -591
- package/src/lib/data/seed-data/learned-context.ts +101 -22
- package/src/lib/data/seed-data/notifications.ts +344 -70
- package/src/lib/data/seed-data/profile-test-results.ts +92 -11
- package/src/lib/data/seed-data/profiles.ts +144 -46
- package/src/lib/data/seed-data/projects.ts +50 -18
- package/src/lib/data/seed-data/repo-imports.ts +28 -13
- package/src/lib/data/seed-data/schedules.ts +208 -41
- package/src/lib/data/seed-data/table-templates.ts +234 -0
- package/src/lib/data/seed-data/tasks.ts +614 -116
- package/src/lib/data/seed-data/usage-ledger.ts +182 -103
- package/src/lib/data/seed-data/user-tables.ts +203 -0
- package/src/lib/data/seed-data/views.ts +52 -7
- package/src/lib/data/seed-data/workflows.ts +231 -84
- package/src/lib/data/seed.ts +55 -14
- package/src/lib/data/tables.ts +417 -0
- package/src/lib/db/bootstrap.ts +227 -0
- package/src/lib/db/index.ts +9 -0
- package/src/lib/db/migrations/0019_add_tables_feature.sql +160 -0
- package/src/lib/db/migrations/0020_add_table_triggers.sql +19 -0
- package/src/lib/db/migrations/0021_add_row_history.sql +15 -0
- package/src/lib/db/schema.ts +368 -0
- package/src/lib/snapshots/auto-backup.ts +132 -0
- package/src/lib/snapshots/retention.ts +64 -0
- package/src/lib/snapshots/snapshot-manager.ts +429 -0
- package/src/lib/tables/computed.ts +61 -0
- package/src/lib/tables/context-builder.ts +139 -0
- package/src/lib/tables/formula-engine.ts +415 -0
- package/src/lib/tables/history.ts +115 -0
- package/src/lib/tables/import.ts +343 -0
- package/src/lib/tables/query-builder.ts +152 -0
- package/src/lib/tables/trigger-evaluator.ts +146 -0
- package/src/lib/tables/types.ts +141 -0
- package/src/lib/tables/validation.ts +119 -0
- package/src/lib/utils/stagent-paths.ts +20 -0
- package/tsconfig.json +3 -1
- /package/docs/features/{playbook.md → user-guide.md} +0 -0
|
@@ -5,7 +5,7 @@ export interface WorkflowSeed {
|
|
|
5
5
|
projectId: string;
|
|
6
6
|
name: string;
|
|
7
7
|
definition: string;
|
|
8
|
-
status: "draft" | "active" | "paused" | "completed";
|
|
8
|
+
status: "draft" | "active" | "paused" | "completed" | "failed";
|
|
9
9
|
createdAt: Date;
|
|
10
10
|
updatedAt: Date;
|
|
11
11
|
}
|
|
@@ -13,152 +13,272 @@ export interface WorkflowSeed {
|
|
|
13
13
|
export function createWorkflows(projectIds: string[]): WorkflowSeed[] {
|
|
14
14
|
const now = Date.now();
|
|
15
15
|
const DAY = 86_400_000;
|
|
16
|
-
const [p1, p2, p3, p4, p5] = projectIds;
|
|
16
|
+
const [p1, p2, p3, p4, p5, p6, p7, p8] = projectIds;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// P1: Product Launch Pipeline
|
|
19
|
+
const launchPipeline: WorkflowDefinition = {
|
|
20
|
+
pattern: "checkpoint",
|
|
21
|
+
steps: [
|
|
22
|
+
{
|
|
23
|
+
id: "research",
|
|
24
|
+
name: "Competitive & audience research",
|
|
25
|
+
prompt:
|
|
26
|
+
"Analyze 5 competing AI copilot products (Cursor, Windsurf, Cody, Tabnine, Copilot). Document positioning, pricing, feature gaps, and messaging angles we can own. Output a competitive matrix.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "copy",
|
|
30
|
+
name: "Write launch copy variants",
|
|
31
|
+
prompt:
|
|
32
|
+
"Using competitive insights, write 3 hero headline variants, email subject lines for the 3-touch launch sequence, and a 280-char social post per channel (LinkedIn, Twitter). Follow the brand voice guide.",
|
|
33
|
+
requiresApproval: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "build",
|
|
37
|
+
name: "Build launch landing page",
|
|
38
|
+
prompt:
|
|
39
|
+
"Implement the approved hero section and feature grid as responsive React components using Tailwind CSS. Include OG meta tags, structured data, and conversion tracking pixels.",
|
|
40
|
+
requiresApproval: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "test",
|
|
44
|
+
name: "Configure A/B tests",
|
|
45
|
+
prompt:
|
|
46
|
+
"Set up A/B test for the top 2 hero variants. Configure event tracking for CTA clicks, scroll depth, time on page, and email signup conversion. Define a 7-day test window with 95% confidence threshold.",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// P2: Weekly Content Cycle
|
|
52
|
+
const contentCycle: WorkflowDefinition = {
|
|
19
53
|
pattern: "sequence",
|
|
20
54
|
steps: [
|
|
21
55
|
{
|
|
22
|
-
id: "
|
|
23
|
-
name: "
|
|
56
|
+
id: "research",
|
|
57
|
+
name: "Keyword & topic research",
|
|
58
|
+
prompt:
|
|
59
|
+
"Pull this week's target keyword cluster from the editorial calendar. Research search volume, competition score, and top-ranking content. Identify 3 content gaps we can fill.",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "outline",
|
|
63
|
+
name: "Create article outline",
|
|
64
|
+
prompt:
|
|
65
|
+
"Build a structured outline: H1, 5-7 H2 sections, target 1,800 words, 3 internal link opportunities, and a CTA placement plan. Include the primary and 2 secondary keywords.",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "draft",
|
|
69
|
+
name: "Write first draft",
|
|
24
70
|
prompt:
|
|
25
|
-
"
|
|
71
|
+
"Write the full article following the approved outline. Use clear topic sentences, include 2-3 data points per section, and end with a compelling CTA. Maintain a Flesch-Kincaid score under 45.",
|
|
26
72
|
},
|
|
27
73
|
{
|
|
28
|
-
id: "
|
|
29
|
-
name: "
|
|
74
|
+
id: "edit",
|
|
75
|
+
name: "Editorial review & polish",
|
|
30
76
|
prompt:
|
|
31
|
-
"
|
|
77
|
+
"Review the draft for factual accuracy, brand voice consistency, SEO optimization (keyword density 1-2%), and readability. Fix any issues and prepare the final version with meta description and alt text.",
|
|
32
78
|
},
|
|
33
79
|
{
|
|
34
|
-
id: "
|
|
35
|
-
name: "
|
|
80
|
+
id: "distribute",
|
|
81
|
+
name: "Prepare distribution assets",
|
|
36
82
|
prompt:
|
|
37
|
-
"
|
|
83
|
+
"Create a LinkedIn post (hook + 3 key takeaways), a newsletter intro paragraph, and a Twitter thread (5 tweets). Schedule all pieces in the content calendar.",
|
|
38
84
|
},
|
|
39
85
|
],
|
|
40
86
|
};
|
|
41
87
|
|
|
42
|
-
|
|
88
|
+
// P3: Customer Onboarding Flow
|
|
89
|
+
const onboardingFlow: WorkflowDefinition = {
|
|
43
90
|
pattern: "checkpoint",
|
|
44
91
|
steps: [
|
|
45
92
|
{
|
|
46
|
-
id: "
|
|
47
|
-
name: "
|
|
93
|
+
id: "welcome",
|
|
94
|
+
name: "Send welcome sequence",
|
|
48
95
|
prompt:
|
|
49
|
-
"
|
|
96
|
+
"Trigger the 3-email welcome sequence: Day 0 welcome + quick start guide, Day 2 feature spotlight, Day 5 'how are things going?' check-in. Personalize with company name and plan tier.",
|
|
50
97
|
},
|
|
51
98
|
{
|
|
52
|
-
id: "
|
|
53
|
-
name: "
|
|
99
|
+
id: "setup",
|
|
100
|
+
name: "Verify account setup",
|
|
54
101
|
prompt:
|
|
55
|
-
"
|
|
102
|
+
"Check that the customer has completed key setup milestones: API key configured, first project created, first agent run completed. Flag any incomplete steps.",
|
|
56
103
|
requiresApproval: true,
|
|
57
104
|
},
|
|
58
105
|
{
|
|
59
|
-
id: "
|
|
60
|
-
name: "
|
|
106
|
+
id: "training",
|
|
107
|
+
name: "Schedule training session",
|
|
61
108
|
prompt:
|
|
62
|
-
"
|
|
63
|
-
requiresApproval: true,
|
|
109
|
+
"Based on the customer's plan tier and team size, recommend a training path: self-serve docs for Starter, live walkthrough for Pro, dedicated onboarding call for Team. Book the session if applicable.",
|
|
64
110
|
},
|
|
65
111
|
{
|
|
66
|
-
id: "
|
|
67
|
-
name: "
|
|
112
|
+
id: "review",
|
|
113
|
+
name: "14-day health check",
|
|
68
114
|
prompt:
|
|
69
|
-
"
|
|
115
|
+
"At day 14, assess: login frequency, feature adoption depth, support tickets filed. Score as green/yellow/red and recommend next touchpoint. Escalate red accounts to CS manager.",
|
|
116
|
+
requiresApproval: true,
|
|
70
117
|
},
|
|
71
118
|
],
|
|
72
119
|
};
|
|
73
120
|
|
|
74
|
-
|
|
121
|
+
// P4: Due Diligence Workflow
|
|
122
|
+
const dueDiligence: WorkflowDefinition = {
|
|
75
123
|
pattern: "planner-executor",
|
|
76
124
|
steps: [
|
|
77
125
|
{
|
|
78
|
-
id: "
|
|
79
|
-
name: "
|
|
126
|
+
id: "scope",
|
|
127
|
+
name: "Define analysis scope",
|
|
80
128
|
prompt:
|
|
81
|
-
"
|
|
129
|
+
"Review the investment memo and define the DD scope: financial analysis depth, market sizing approach, competitive landscape breadth, and key risk factors to investigate. Output a scoping document.",
|
|
82
130
|
},
|
|
83
131
|
{
|
|
84
|
-
id: "
|
|
85
|
-
name: "
|
|
132
|
+
id: "financials",
|
|
133
|
+
name: "Financial deep dive",
|
|
86
134
|
prompt:
|
|
87
|
-
"
|
|
135
|
+
"Analyze 3 years of financials: ARR growth, gross margins, net retention, burn rate, and runway. Model 3 scenarios (base, upside, downside) with key assumptions. Flag any accounting irregularities.",
|
|
88
136
|
},
|
|
89
137
|
{
|
|
90
|
-
id: "
|
|
91
|
-
name: "
|
|
138
|
+
id: "market",
|
|
139
|
+
name: "Market & TAM analysis",
|
|
92
140
|
prompt:
|
|
93
|
-
"
|
|
141
|
+
"Size the total addressable market using top-down and bottom-up approaches. Map the competitive landscape with positioning matrix. Identify market tailwinds and headwinds.",
|
|
94
142
|
},
|
|
95
143
|
{
|
|
96
|
-
id: "
|
|
97
|
-
name: "
|
|
144
|
+
id: "competitive",
|
|
145
|
+
name: "Competitive positioning",
|
|
98
146
|
prompt:
|
|
99
|
-
"
|
|
147
|
+
"Deep-dive into 4-5 direct competitors: product comparison, pricing analysis, customer reviews, team strength, and funding history. Identify sustainable competitive advantages.",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: "synthesis",
|
|
151
|
+
name: "Write DD memo",
|
|
152
|
+
prompt:
|
|
153
|
+
"Synthesize all findings into a structured DD memo: executive summary, investment thesis, financial highlights, market opportunity, competitive position, top risks with mitigants, and go/no-go recommendation.",
|
|
100
154
|
},
|
|
101
155
|
],
|
|
102
156
|
};
|
|
103
157
|
|
|
104
|
-
|
|
158
|
+
// P5: Product Listing Optimizer
|
|
159
|
+
const listingOptimizer: WorkflowDefinition = {
|
|
105
160
|
pattern: "sequence",
|
|
106
161
|
steps: [
|
|
107
162
|
{
|
|
108
|
-
id: "
|
|
109
|
-
name: "
|
|
163
|
+
id: "scrape",
|
|
164
|
+
name: "Scrape current listings",
|
|
110
165
|
prompt:
|
|
111
|
-
"
|
|
166
|
+
"Pull the current product listings for the top 20 SKUs by revenue. Capture title, description, bullet points, images count, price, and review score. Store as structured data.",
|
|
112
167
|
},
|
|
113
168
|
{
|
|
114
|
-
id: "
|
|
115
|
-
name: "
|
|
169
|
+
id: "analyze",
|
|
170
|
+
name: "Analyze listing performance",
|
|
116
171
|
prompt:
|
|
117
|
-
"
|
|
172
|
+
"Compare listing quality against top 3 competitors per SKU. Score each listing on: keyword coverage (title + bullets), image count, review volume, and A+ content presence. Rank by optimization opportunity.",
|
|
118
173
|
},
|
|
119
174
|
{
|
|
120
|
-
id: "
|
|
121
|
-
name: "
|
|
175
|
+
id: "rewrite",
|
|
176
|
+
name: "Generate optimized copy",
|
|
122
177
|
prompt:
|
|
123
|
-
"
|
|
178
|
+
"For the top 10 opportunity SKUs, rewrite titles (under 200 chars), 5 bullet points (keyword-rich), and product descriptions. Maintain brand voice while improving keyword density. A/B test the top 3.",
|
|
124
179
|
},
|
|
125
180
|
{
|
|
126
|
-
id: "
|
|
127
|
-
name: "
|
|
181
|
+
id: "deploy",
|
|
182
|
+
name: "Stage updates for review",
|
|
128
183
|
prompt:
|
|
129
|
-
"
|
|
184
|
+
"Prepare a change log with before/after for each listing update. Stage the changes in the CMS draft queue and notify the client for approval before going live.",
|
|
130
185
|
},
|
|
131
186
|
],
|
|
132
187
|
};
|
|
133
188
|
|
|
134
|
-
|
|
189
|
+
// P6: HIPAA Content Review
|
|
190
|
+
const hipaaReview: WorkflowDefinition = {
|
|
135
191
|
pattern: "checkpoint",
|
|
136
192
|
steps: [
|
|
137
193
|
{
|
|
138
|
-
id: "
|
|
139
|
-
name: "
|
|
194
|
+
id: "draft",
|
|
195
|
+
name: "Draft marketing content",
|
|
140
196
|
prompt:
|
|
141
|
-
"
|
|
197
|
+
"Write the campaign content: referral program landing page copy, 2 email templates for provider outreach, and 3 social media posts. Follow healthcare marketing guidelines — no unsubstantiated claims.",
|
|
198
|
+
requiresApproval: true,
|
|
142
199
|
},
|
|
143
200
|
{
|
|
144
|
-
id: "
|
|
145
|
-
name: "
|
|
201
|
+
id: "compliance",
|
|
202
|
+
name: "HIPAA compliance check",
|
|
146
203
|
prompt:
|
|
147
|
-
"
|
|
204
|
+
"Scan all content for PHI references, testimonial compliance, disclaimer requirements, and FDA marketing restrictions. Flag any language that could violate HIPAA, FTC, or state healthcare marketing laws.",
|
|
148
205
|
requiresApproval: true,
|
|
149
206
|
},
|
|
150
207
|
{
|
|
151
|
-
id: "
|
|
152
|
-
name: "
|
|
208
|
+
id: "legal",
|
|
209
|
+
name: "Legal counsel review",
|
|
153
210
|
prompt:
|
|
154
|
-
"
|
|
211
|
+
"Prepare the legal review package: all content pieces with compliance annotations, risk flags, and recommended disclaimer language. Route to legal@medreach.health for sign-off.",
|
|
155
212
|
requiresApproval: true,
|
|
156
213
|
},
|
|
157
214
|
{
|
|
158
|
-
id: "
|
|
159
|
-
name: "
|
|
215
|
+
id: "publish",
|
|
216
|
+
name: "Publish approved content",
|
|
160
217
|
prompt:
|
|
161
|
-
"
|
|
218
|
+
"After legal approval, schedule publication: landing page goes live immediately, emails queued for Tuesday 10am send, social posts staggered across the week. Update the compliance audit log.",
|
|
219
|
+
requiresApproval: true,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// P7: Weekly Deal Review
|
|
225
|
+
const dealReview: WorkflowDefinition = {
|
|
226
|
+
pattern: "sequence",
|
|
227
|
+
steps: [
|
|
228
|
+
{
|
|
229
|
+
id: "pull",
|
|
230
|
+
name: "Pull pipeline data",
|
|
231
|
+
prompt:
|
|
232
|
+
"Export this week's pipeline snapshot: all deals in stages 2-5, new opportunities, stage changes, and closed-won/lost. Include deal owner, amount, close date, and days in stage.",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "risk",
|
|
236
|
+
name: "Score deal risk",
|
|
237
|
+
prompt:
|
|
238
|
+
"For each open deal, calculate a risk score based on: days in current stage (>5 = elevated), champion engagement (email opens, meeting frequency), competitive mentions, and budget confirmation status.",
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
id: "coaching",
|
|
242
|
+
name: "Generate coaching notes",
|
|
243
|
+
prompt:
|
|
244
|
+
"For each rep, identify 1-2 coaching opportunities based on their deals: stalled deals needing executive sponsorship, missing next steps, or pricing objections that need a value sell approach.",
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
id: "summary",
|
|
248
|
+
name: "Write executive summary",
|
|
249
|
+
prompt:
|
|
250
|
+
"Compile the weekly operating note: pipeline created vs target, forecast by confidence bucket (committed/best-case/upside), top risks, and the 3 highest-leverage actions for leadership.",
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// P8: Monthly Compliance Audit
|
|
256
|
+
const complianceAudit: WorkflowDefinition = {
|
|
257
|
+
pattern: "planner-executor",
|
|
258
|
+
steps: [
|
|
259
|
+
{
|
|
260
|
+
id: "gather",
|
|
261
|
+
name: "Gather audit evidence",
|
|
262
|
+
prompt:
|
|
263
|
+
"Collect all governed execution logs, permission decisions, agent tool usage, and data access patterns for the audit period. Cross-reference against the SOC 2 control framework.",
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: "analyze",
|
|
267
|
+
name: "Analyze compliance gaps",
|
|
268
|
+
prompt:
|
|
269
|
+
"Compare execution logs against defined policies: tool approval rates, auto-approve bypass patterns, sensitive data access, and budget adherence. Identify gaps and rate severity (critical/high/medium/low).",
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
id: "report",
|
|
273
|
+
name: "Generate compliance report",
|
|
274
|
+
prompt:
|
|
275
|
+
"Write the monthly compliance report: executive summary, control effectiveness by category, gap analysis with remediation timelines, and trend analysis vs prior month. Include evidence references.",
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: "brief",
|
|
279
|
+
name: "Executive briefing",
|
|
280
|
+
prompt:
|
|
281
|
+
"Prepare a 1-page executive brief: overall compliance posture (green/yellow/red), top 3 findings, remediation progress on prior findings, and recommended policy updates.",
|
|
162
282
|
},
|
|
163
283
|
],
|
|
164
284
|
};
|
|
@@ -167,47 +287,74 @@ export function createWorkflows(projectIds: string[]): WorkflowSeed[] {
|
|
|
167
287
|
{
|
|
168
288
|
id: crypto.randomUUID(),
|
|
169
289
|
projectId: p1,
|
|
170
|
-
name: "
|
|
171
|
-
definition: JSON.stringify(
|
|
172
|
-
status: "
|
|
173
|
-
createdAt: new Date(now -
|
|
174
|
-
updatedAt: new Date(now -
|
|
290
|
+
name: "Product Launch Pipeline",
|
|
291
|
+
definition: JSON.stringify(launchPipeline),
|
|
292
|
+
status: "active",
|
|
293
|
+
createdAt: new Date(now - 20 * DAY),
|
|
294
|
+
updatedAt: new Date(now - 1 * DAY),
|
|
175
295
|
},
|
|
176
296
|
{
|
|
177
297
|
id: crypto.randomUUID(),
|
|
178
298
|
projectId: p2,
|
|
179
|
-
name: "
|
|
180
|
-
definition: JSON.stringify(
|
|
299
|
+
name: "Weekly Content Cycle",
|
|
300
|
+
definition: JSON.stringify(contentCycle),
|
|
181
301
|
status: "active",
|
|
182
|
-
createdAt: new Date(now -
|
|
302
|
+
createdAt: new Date(now - 17 * DAY),
|
|
183
303
|
updatedAt: new Date(now - 1 * DAY),
|
|
184
304
|
},
|
|
185
305
|
{
|
|
186
306
|
id: crypto.randomUUID(),
|
|
187
307
|
projectId: p3,
|
|
188
|
-
name: "
|
|
189
|
-
definition: JSON.stringify(
|
|
190
|
-
status: "
|
|
191
|
-
createdAt: new Date(now -
|
|
192
|
-
updatedAt: new Date(now -
|
|
308
|
+
name: "Customer Onboarding Flow",
|
|
309
|
+
definition: JSON.stringify(onboardingFlow),
|
|
310
|
+
status: "active",
|
|
311
|
+
createdAt: new Date(now - 15 * DAY),
|
|
312
|
+
updatedAt: new Date(now - 2 * DAY),
|
|
193
313
|
},
|
|
194
314
|
{
|
|
195
315
|
id: crypto.randomUUID(),
|
|
196
316
|
projectId: p4,
|
|
197
|
-
name: "
|
|
198
|
-
definition: JSON.stringify(
|
|
317
|
+
name: "Due Diligence Workflow",
|
|
318
|
+
definition: JSON.stringify(dueDiligence),
|
|
199
319
|
status: "completed",
|
|
200
|
-
createdAt: new Date(now -
|
|
320
|
+
createdAt: new Date(now - 13 * DAY),
|
|
201
321
|
updatedAt: new Date(now - 3 * DAY),
|
|
202
322
|
},
|
|
203
323
|
{
|
|
204
324
|
id: crypto.randomUUID(),
|
|
205
325
|
projectId: p5,
|
|
206
|
-
name: "
|
|
207
|
-
definition: JSON.stringify(
|
|
326
|
+
name: "Product Listing Optimizer",
|
|
327
|
+
definition: JSON.stringify(listingOptimizer),
|
|
208
328
|
status: "active",
|
|
209
|
-
createdAt: new Date(now -
|
|
329
|
+
createdAt: new Date(now - 11 * DAY),
|
|
330
|
+
updatedAt: new Date(now - 2 * DAY),
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: crypto.randomUUID(),
|
|
334
|
+
projectId: p6,
|
|
335
|
+
name: "HIPAA Content Review",
|
|
336
|
+
definition: JSON.stringify(hipaaReview),
|
|
337
|
+
status: "paused",
|
|
338
|
+
createdAt: new Date(now - 9 * DAY),
|
|
339
|
+
updatedAt: new Date(now - 4 * DAY),
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: crypto.randomUUID(),
|
|
343
|
+
projectId: p7,
|
|
344
|
+
name: "Weekly Deal Review",
|
|
345
|
+
definition: JSON.stringify(dealReview),
|
|
346
|
+
status: "draft",
|
|
347
|
+
createdAt: new Date(now - 7 * DAY),
|
|
210
348
|
updatedAt: new Date(now - 1 * DAY),
|
|
211
349
|
},
|
|
350
|
+
{
|
|
351
|
+
id: crypto.randomUUID(),
|
|
352
|
+
projectId: p8,
|
|
353
|
+
name: "Monthly Compliance Audit",
|
|
354
|
+
definition: JSON.stringify(complianceAudit),
|
|
355
|
+
status: "completed",
|
|
356
|
+
createdAt: new Date(now - 5 * DAY),
|
|
357
|
+
updatedAt: new Date(now - 3 * DAY),
|
|
358
|
+
},
|
|
212
359
|
];
|
|
213
360
|
}
|
package/src/lib/data/seed.ts
CHANGED
|
@@ -31,6 +31,8 @@ import { createLearnedContext } from "./seed-data/learned-context";
|
|
|
31
31
|
import { createViews } from "./seed-data/views";
|
|
32
32
|
import { createProfileTestResults } from "./seed-data/profile-test-results";
|
|
33
33
|
import { createRepoImports } from "./seed-data/repo-imports";
|
|
34
|
+
import { createUserTables } from "./seed-data/user-tables";
|
|
35
|
+
import { createTable, addRows } from "@/lib/data/tables";
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* Clear all data, then seed with realistic sample data.
|
|
@@ -50,8 +52,22 @@ export async function seedSampleData() {
|
|
|
50
52
|
}
|
|
51
53
|
const projectIds = projectSeeds.map((p) => p.id);
|
|
52
54
|
|
|
53
|
-
// 4. Insert tasks
|
|
54
|
-
const
|
|
55
|
+
// 4. Insert workflows BEFORE tasks (tasks reference workflowId)
|
|
56
|
+
const workflowSeeds = createWorkflows(projectIds);
|
|
57
|
+
for (const w of workflowSeeds) {
|
|
58
|
+
db.insert(workflows).values(w).run();
|
|
59
|
+
}
|
|
60
|
+
const workflowIds = workflowSeeds.map((w) => w.id);
|
|
61
|
+
|
|
62
|
+
// 5. Insert schedules BEFORE tasks (tasks reference scheduleId)
|
|
63
|
+
const scheduleSeeds = createSchedules(projectIds);
|
|
64
|
+
for (const schedule of scheduleSeeds) {
|
|
65
|
+
db.insert(schedules).values(schedule).run();
|
|
66
|
+
}
|
|
67
|
+
const scheduleIds = scheduleSeeds.map((s) => s.id);
|
|
68
|
+
|
|
69
|
+
// 6. Insert tasks (with workflow/schedule/profile references)
|
|
70
|
+
const taskSeeds = createTasks(projectIds, workflowIds, scheduleIds);
|
|
55
71
|
for (const t of taskSeeds) {
|
|
56
72
|
db.insert(tasks)
|
|
57
73
|
.values({
|
|
@@ -62,6 +78,10 @@ export async function seedSampleData() {
|
|
|
62
78
|
status: t.status,
|
|
63
79
|
priority: t.priority,
|
|
64
80
|
result: t.result,
|
|
81
|
+
agentProfile: t.agentProfile,
|
|
82
|
+
sourceType: t.sourceType,
|
|
83
|
+
workflowId: t.workflowId,
|
|
84
|
+
scheduleId: t.scheduleId,
|
|
65
85
|
createdAt: t.createdAt,
|
|
66
86
|
updatedAt: t.updatedAt,
|
|
67
87
|
})
|
|
@@ -69,18 +89,6 @@ export async function seedSampleData() {
|
|
|
69
89
|
}
|
|
70
90
|
const taskIds = taskSeeds.map((t) => t.id);
|
|
71
91
|
|
|
72
|
-
// 5. Insert workflows (one per project)
|
|
73
|
-
const workflowSeeds = createWorkflows(projectIds);
|
|
74
|
-
for (const w of workflowSeeds) {
|
|
75
|
-
db.insert(workflows).values(w).run();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// 6. Insert schedules for recently added automation surfaces
|
|
79
|
-
const scheduleSeeds = createSchedules(projectIds);
|
|
80
|
-
for (const schedule of scheduleSeeds) {
|
|
81
|
-
db.insert(schedules).values(schedule).run();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
92
|
// 7. Write document files + insert records
|
|
85
93
|
const docSeeds = await createDocuments(projectIds, taskIds);
|
|
86
94
|
for (const d of docSeeds) {
|
|
@@ -160,6 +168,37 @@ export async function seedSampleData() {
|
|
|
160
168
|
db.insert(repoImports).values(ri).run();
|
|
161
169
|
}
|
|
162
170
|
|
|
171
|
+
// 17. Insert user-created tables with columns and rows
|
|
172
|
+
const userTableSeeds = createUserTables(projectIds);
|
|
173
|
+
let totalTableRows = 0;
|
|
174
|
+
for (const tableSeed of userTableSeeds) {
|
|
175
|
+
await createTable({
|
|
176
|
+
name: tableSeed.name,
|
|
177
|
+
description: tableSeed.description,
|
|
178
|
+
projectId: tableSeed.projectId,
|
|
179
|
+
source: tableSeed.source,
|
|
180
|
+
columns: tableSeed.columns.map((col, i) => ({
|
|
181
|
+
name: col.name,
|
|
182
|
+
displayName: col.displayName,
|
|
183
|
+
dataType: col.dataType,
|
|
184
|
+
position: i,
|
|
185
|
+
required: col.required ?? false,
|
|
186
|
+
config: col.config ?? undefined,
|
|
187
|
+
})),
|
|
188
|
+
});
|
|
189
|
+
// createTable generates its own ID; retrieve it by name+project
|
|
190
|
+
const { listTables } = await import("@/lib/data/tables");
|
|
191
|
+
const tables = await listTables({ projectId: tableSeed.projectId });
|
|
192
|
+
const created = tables.find((t) => t.name === tableSeed.name);
|
|
193
|
+
if (created && tableSeed.rows.length > 0) {
|
|
194
|
+
await addRows(
|
|
195
|
+
created.id,
|
|
196
|
+
tableSeed.rows.map((data) => ({ data }))
|
|
197
|
+
);
|
|
198
|
+
totalTableRows += tableSeed.rows.length;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
163
202
|
return {
|
|
164
203
|
profiles: profileCount,
|
|
165
204
|
projects: projectSeeds.length,
|
|
@@ -176,5 +215,7 @@ export async function seedSampleData() {
|
|
|
176
215
|
views: viewSeeds.length,
|
|
177
216
|
profileTestResults: testResultSeeds.length,
|
|
178
217
|
repoImports: repoImportSeeds.length,
|
|
218
|
+
userTables: userTableSeeds.length,
|
|
219
|
+
userTableRows: totalTableRows,
|
|
179
220
|
};
|
|
180
221
|
}
|