stagent 0.5.0 → 0.6.1
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 +8 -8
- package/dist/cli.js +146 -2
- package/docs/.coverage-gaps.json +21 -0
- package/docs/.last-generated +1 -1
- package/docs/features/agent-intelligence.md +36 -14
- package/docs/features/chat.md +33 -56
- package/docs/features/cost-usage.md +14 -10
- package/docs/features/dashboard-kanban.md +30 -13
- package/docs/features/delivery-channels.md +198 -0
- package/docs/features/design-system.md +10 -10
- package/docs/features/documents.md +8 -8
- package/docs/features/home-workspace.md +20 -15
- package/docs/features/inbox-notifications.md +22 -10
- package/docs/features/keyboard-navigation.md +11 -11
- package/docs/features/monitoring.md +1 -1
- package/docs/features/playbook.md +30 -32
- package/docs/features/profiles.md +33 -11
- package/docs/features/projects.md +2 -2
- package/docs/features/provider-runtimes.md +58 -14
- package/docs/features/schedules.md +70 -40
- package/docs/features/settings.md +74 -46
- package/docs/features/shared-components.md +7 -15
- package/docs/features/tool-permissions.md +9 -9
- package/docs/features/workflows.md +32 -21
- package/docs/getting-started.md +33 -9
- package/docs/index.md +25 -16
- package/docs/journeys/developer.md +124 -207
- package/docs/journeys/personal-use.md +70 -79
- package/docs/journeys/power-user.md +107 -151
- package/docs/journeys/work-use.md +81 -113
- package/docs/manifest.json +77 -45
- package/docs/superpowers/plans/2026-03-30-finish-in-progress-features.md +547 -0
- package/docs/use-cases/agency-operator.md +84 -0
- package/docs/use-cases/solo-founder.md +75 -0
- package/docs/why-stagent.md +59 -0
- package/package.json +10 -3
- package/src/app/api/channels/[id]/route.ts +104 -0
- package/src/app/api/channels/[id]/test/route.ts +52 -0
- package/src/app/api/channels/inbound/slack/route.ts +116 -0
- package/src/app/api/channels/inbound/telegram/poll/route.ts +140 -0
- package/src/app/api/channels/inbound/telegram/route.ts +87 -0
- package/src/app/api/channels/route.ts +72 -0
- package/src/app/api/chat/conversations/route.ts +15 -0
- package/src/app/api/chat/entities/search/route.ts +46 -31
- package/src/app/api/data/clear/route.ts +4 -0
- package/src/app/api/data/seed/route.ts +4 -0
- package/src/app/api/documents/route.ts +36 -6
- package/src/app/api/environment/profiles/suggest/route.ts +19 -3
- package/src/app/api/environment/scan/route.ts +8 -1
- package/src/app/api/handoffs/[id]/route.ts +76 -0
- package/src/app/api/handoffs/route.ts +89 -0
- package/src/app/api/memory/route.ts +181 -0
- package/src/app/api/profiles/[id]/route.ts +16 -1
- package/src/app/api/profiles/[id]/test/route.ts +4 -0
- package/src/app/api/profiles/[id]/test-results/route.ts +22 -0
- package/src/app/api/profiles/[id]/test-single/route.ts +64 -0
- package/src/app/api/profiles/assist/route.ts +35 -0
- package/src/app/api/profiles/import-repo/apply-updates/route.ts +123 -0
- package/src/app/api/profiles/import-repo/check-updates/route.ts +163 -0
- package/src/app/api/profiles/import-repo/confirm/route.ts +118 -0
- package/src/app/api/profiles/import-repo/preview/route.ts +107 -0
- package/src/app/api/profiles/import-repo/route.ts +29 -0
- package/src/app/api/profiles/import-repo/scan/route.ts +25 -0
- package/src/app/api/profiles/route.ts +73 -22
- package/src/app/api/runtimes/ollama/route.ts +86 -0
- package/src/app/api/runtimes/suggest/route.ts +29 -0
- package/src/app/api/schedules/[id]/heartbeat-history/route.ts +77 -0
- package/src/app/api/schedules/[id]/route.ts +41 -3
- package/src/app/api/schedules/parse/route.ts +66 -0
- package/src/app/api/schedules/route.ts +71 -12
- package/src/app/api/settings/author-default/route.ts +7 -0
- package/src/app/api/settings/learning/route.ts +41 -0
- package/src/app/api/settings/ollama/route.ts +34 -0
- package/src/app/api/settings/providers/route.ts +57 -0
- package/src/app/api/settings/routing/route.ts +24 -0
- package/src/app/api/settings/web-search/route.ts +28 -0
- package/src/app/api/tasks/[id]/execute/route.ts +13 -1
- package/src/app/api/tasks/[id]/respond/route.ts +23 -1
- package/src/app/documents/page.tsx +3 -0
- package/src/app/environment/page.tsx +8 -1
- package/src/app/settings/page.tsx +10 -4
- package/src/app/workflows/[id]/edit/page.tsx +2 -0
- package/src/app/workflows/new/page.tsx +2 -0
- package/src/components/chat/chat-command-popover.tsx +22 -19
- package/src/components/chat/chat-input.tsx +5 -0
- package/src/components/chat/chat-model-selector.tsx +42 -1
- package/src/components/chat/chat-shell.tsx +2 -0
- package/src/components/dashboard/welcome-landing.tsx +9 -9
- package/src/components/environment/artifact-card.tsx +27 -1
- package/src/components/environment/environment-dashboard.tsx +50 -2
- package/src/components/environment/environment-summary-card.tsx +5 -2
- package/src/components/environment/suggested-profiles.tsx +117 -52
- package/src/components/handoffs/handoff-approval-card.tsx +159 -0
- package/src/components/memory/memory-browser.tsx +315 -0
- package/src/components/profiles/learned-context-panel.tsx +4 -4
- package/src/components/profiles/profile-assist-panel.tsx +512 -0
- package/src/components/profiles/profile-browser.tsx +109 -8
- package/src/components/profiles/profile-card.tsx +29 -1
- package/src/components/profiles/profile-detail-view.tsx +200 -28
- package/src/components/profiles/profile-form-view.tsx +220 -82
- package/src/components/profiles/repo-import-wizard.tsx +648 -0
- package/src/components/profiles/smoke-test-editor.tsx +106 -0
- package/src/components/schedules/schedule-create-sheet.tsx +9 -1
- package/src/components/schedules/schedule-form.tsx +348 -9
- package/src/components/schedules/schedule-list.tsx +15 -2
- package/src/components/settings/auth-method-selector.tsx +7 -1
- package/src/components/settings/budget-guardrails-section.tsx +111 -48
- package/src/components/settings/channels-section.tsx +526 -0
- package/src/components/settings/chat-settings-section.tsx +27 -1
- package/src/components/settings/data-management-section.tsx +8 -6
- package/src/components/settings/learning-context-section.tsx +124 -0
- package/src/components/settings/ollama-section.tsx +270 -0
- package/src/components/settings/providers-runtimes-section.tsx +499 -0
- package/src/components/settings/web-search-section.tsx +101 -0
- package/src/components/shared/tag-input.tsx +156 -0
- package/src/components/tasks/kanban-board.tsx +32 -0
- package/src/components/tasks/kanban-column.tsx +4 -2
- package/src/components/tasks/task-card.tsx +1 -0
- package/src/components/tasks/task-chip-bar.tsx +6 -1
- package/src/components/tasks/task-create-panel.tsx +55 -5
- package/src/components/workflows/workflow-form-view.tsx +38 -3
- package/src/hooks/use-chat-autocomplete.ts +24 -26
- package/src/hooks/use-project-skills.ts +66 -0
- package/src/hooks/use-tag-suggestions.ts +31 -0
- package/src/instrumentation.ts +4 -1
- package/src/lib/agents/__tests__/claude-agent.test.ts +3 -0
- package/src/lib/agents/__tests__/learned-context.test.ts +10 -0
- package/src/lib/agents/agentic-loop.ts +235 -0
- package/src/lib/agents/browser-mcp.ts +59 -4
- package/src/lib/agents/claude-agent.ts +27 -200
- package/src/lib/agents/handoff/bus.ts +164 -0
- package/src/lib/agents/handoff/governance.ts +47 -0
- package/src/lib/agents/handoff/types.ts +16 -0
- package/src/lib/agents/learned-context.ts +27 -7
- package/src/lib/agents/memory/decay.ts +61 -0
- package/src/lib/agents/memory/extractor.ts +181 -0
- package/src/lib/agents/memory/retrieval.ts +96 -0
- package/src/lib/agents/memory/types.ts +6 -0
- package/src/lib/agents/profiles/__tests__/project-profiles.test.ts +119 -0
- package/src/lib/agents/profiles/__tests__/registry.test.ts +11 -3
- package/src/lib/agents/profiles/builtins/code-reviewer/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/content-creator/SKILL.md +19 -0
- package/src/lib/agents/profiles/builtins/content-creator/profile.yaml +27 -0
- package/src/lib/agents/profiles/builtins/customer-support-agent/SKILL.md +19 -0
- package/src/lib/agents/profiles/builtins/customer-support-agent/profile.yaml +26 -0
- package/src/lib/agents/profiles/builtins/data-analyst/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/devops-engineer/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/document-writer/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/financial-analyst/SKILL.md +19 -0
- package/src/lib/agents/profiles/builtins/financial-analyst/profile.yaml +24 -0
- package/src/lib/agents/profiles/builtins/general/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/health-fitness-coach/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/learning-coach/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/marketing-strategist/SKILL.md +19 -0
- package/src/lib/agents/profiles/builtins/marketing-strategist/profile.yaml +27 -0
- package/src/lib/agents/profiles/builtins/operations-coordinator/SKILL.md +19 -0
- package/src/lib/agents/profiles/builtins/operations-coordinator/profile.yaml +26 -0
- package/src/lib/agents/profiles/builtins/project-manager/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/researcher/SKILL.md +1 -0
- package/src/lib/agents/profiles/builtins/researcher/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/sales-researcher/SKILL.md +19 -0
- package/src/lib/agents/profiles/builtins/sales-researcher/profile.yaml +26 -0
- package/src/lib/agents/profiles/builtins/shopping-assistant/SKILL.md +1 -0
- package/src/lib/agents/profiles/builtins/shopping-assistant/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/sweep/profile.yaml +1 -1
- package/src/lib/agents/profiles/builtins/technical-writer/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/travel-planner/SKILL.md +2 -0
- package/src/lib/agents/profiles/builtins/travel-planner/profile.yaml +2 -2
- package/src/lib/agents/profiles/builtins/wealth-manager/SKILL.md +2 -0
- package/src/lib/agents/profiles/builtins/wealth-manager/profile.yaml +2 -2
- package/src/lib/agents/profiles/project-profiles.ts +193 -0
- package/src/lib/agents/profiles/registry.ts +130 -6
- package/src/lib/agents/profiles/types.ts +28 -0
- package/src/lib/agents/router.ts +174 -2
- package/src/lib/agents/runtime/__tests__/catalog.test.ts +15 -4
- package/src/lib/agents/runtime/anthropic-direct.ts +644 -0
- package/src/lib/agents/runtime/catalog.ts +57 -2
- package/src/lib/agents/runtime/claude.ts +205 -1
- package/src/lib/agents/runtime/index.ts +22 -0
- package/src/lib/agents/runtime/ollama-adapter.ts +409 -0
- package/src/lib/agents/runtime/openai-direct.ts +514 -0
- package/src/lib/agents/runtime/profile-assist-types.ts +30 -0
- package/src/lib/agents/runtime/types.ts +2 -0
- package/src/lib/agents/tool-permissions.ts +203 -0
- package/src/lib/channels/gateway.ts +321 -0
- package/src/lib/channels/poller.ts +268 -0
- package/src/lib/channels/registry.ts +90 -0
- package/src/lib/channels/slack-adapter.ts +188 -0
- package/src/lib/channels/telegram-adapter.ts +218 -0
- package/src/lib/channels/types.ts +75 -0
- package/src/lib/channels/webhook-adapter.ts +74 -0
- package/src/lib/chat/context-builder.ts +22 -2
- package/src/lib/chat/engine.ts +95 -13
- package/src/lib/chat/ollama-engine.ts +198 -0
- package/src/lib/chat/stagent-tools.ts +106 -20
- package/src/lib/chat/tool-catalog.ts +24 -0
- package/src/lib/chat/tool-registry.ts +90 -0
- package/src/lib/chat/tools/chat-history-tools.ts +4 -4
- package/src/lib/chat/tools/document-tools.ts +7 -7
- package/src/lib/chat/tools/handoff-tools.ts +70 -0
- package/src/lib/chat/tools/notification-tools.ts +4 -4
- package/src/lib/chat/tools/profile-tools.ts +3 -3
- package/src/lib/chat/tools/project-tools.ts +3 -3
- package/src/lib/chat/tools/schedule-tools.ts +29 -13
- package/src/lib/chat/tools/settings-tools.ts +2 -2
- package/src/lib/chat/tools/task-tools.ts +66 -11
- package/src/lib/chat/tools/usage-tools.ts +2 -2
- package/src/lib/chat/tools/workflow-tools.ts +8 -8
- package/src/lib/chat/types.ts +11 -5
- package/src/lib/constants/known-tools.ts +19 -0
- package/src/lib/constants/prose-styles.ts +1 -1
- package/src/lib/constants/settings.ts +7 -0
- package/src/lib/data/channel-bindings.ts +85 -0
- package/src/lib/data/clear.ts +22 -0
- package/src/lib/data/profile-test-results.ts +48 -0
- package/src/lib/data/seed-data/conversations.ts +196 -0
- package/src/lib/data/seed-data/learned-context.ts +99 -0
- package/src/lib/data/seed-data/notifications.ts +54 -1
- package/src/lib/data/seed-data/profile-test-results.ts +96 -0
- package/src/lib/data/seed-data/repo-imports.ts +51 -0
- package/src/lib/data/seed-data/views.ts +60 -0
- package/src/lib/data/seed.ts +51 -0
- package/src/lib/db/bootstrap.ts +162 -0
- package/src/lib/db/migrations/0013_add_repo_imports.sql +15 -0
- package/src/lib/db/migrations/0014_add_linked_profile_id.sql +3 -0
- package/src/lib/db/migrations/0015_add_channel_bindings.sql +23 -0
- package/src/lib/db/schema.ts +190 -1
- package/src/lib/environment/__tests__/auto-scan.test.ts +86 -0
- package/src/lib/environment/__tests__/profile-linker.test.ts +187 -0
- package/src/lib/environment/auto-scan.ts +48 -0
- package/src/lib/environment/data.ts +25 -0
- package/src/lib/environment/profile-generator.ts +40 -10
- package/src/lib/environment/profile-linker.ts +143 -0
- package/src/lib/environment/profile-rules.ts +96 -0
- package/src/lib/import/dedup.ts +149 -0
- package/src/lib/import/format-adapter.ts +631 -0
- package/src/lib/import/github-api.ts +219 -0
- package/src/lib/import/repo-scanner.ts +251 -0
- package/src/lib/schedules/__tests__/nlp-parser.test.ts +330 -0
- package/src/lib/schedules/active-hours.ts +120 -0
- package/src/lib/schedules/heartbeat-parser.ts +224 -0
- package/src/lib/schedules/heartbeat-prompt.ts +153 -0
- package/src/lib/schedules/nlp-parser.ts +357 -0
- package/src/lib/schedules/scheduler.ts +218 -3
- package/src/lib/settings/__tests__/budget-guardrails.test.ts +39 -1
- package/src/lib/settings/helpers.ts +6 -0
- package/src/lib/settings/routing.ts +24 -0
- package/src/lib/settings/runtime-setup.ts +28 -1
- package/src/lib/usage/ledger.ts +2 -1
- package/src/lib/validators/__tests__/settings.test.ts +9 -0
- package/src/lib/validators/profile.ts +39 -0
- package/src/lib/workflows/blueprints/builtins/business-daily-briefing.yaml +102 -0
- package/src/lib/workflows/blueprints/builtins/content-marketing-pipeline.yaml +90 -0
- package/src/lib/workflows/blueprints/builtins/customer-support-triage.yaml +107 -0
- package/src/lib/workflows/blueprints/builtins/financial-reporting.yaml +104 -0
- package/src/lib/workflows/blueprints/builtins/lead-research-pipeline.yaml +82 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { db } from "@/lib/db";
|
|
2
|
+
import { profileTestResults } from "@/lib/db/schema";
|
|
3
|
+
import { eq, and } from "drizzle-orm";
|
|
4
|
+
import type { ProfileTestReport } from "@/lib/agents/profiles/test-types";
|
|
5
|
+
import { randomUUID } from "crypto";
|
|
6
|
+
|
|
7
|
+
export function saveProfileTestReport(report: ProfileTestReport): void {
|
|
8
|
+
// Upsert: delete old result for same profile+runtime, then insert
|
|
9
|
+
db.delete(profileTestResults)
|
|
10
|
+
.where(
|
|
11
|
+
and(
|
|
12
|
+
eq(profileTestResults.profileId, report.profileId),
|
|
13
|
+
eq(profileTestResults.runtimeId, report.runtimeId)
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
.run();
|
|
17
|
+
|
|
18
|
+
db.insert(profileTestResults)
|
|
19
|
+
.values({
|
|
20
|
+
id: randomUUID(),
|
|
21
|
+
profileId: report.profileId,
|
|
22
|
+
runtimeId: report.runtimeId,
|
|
23
|
+
reportJson: JSON.stringify(report),
|
|
24
|
+
totalPassed: report.totalPassed,
|
|
25
|
+
totalFailed: report.totalFailed,
|
|
26
|
+
createdAt: new Date(),
|
|
27
|
+
})
|
|
28
|
+
.run();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getLatestProfileTestReport(
|
|
32
|
+
profileId: string,
|
|
33
|
+
runtimeId: string
|
|
34
|
+
): ProfileTestReport | null {
|
|
35
|
+
const row = db
|
|
36
|
+
.select()
|
|
37
|
+
.from(profileTestResults)
|
|
38
|
+
.where(
|
|
39
|
+
and(
|
|
40
|
+
eq(profileTestResults.profileId, profileId),
|
|
41
|
+
eq(profileTestResults.runtimeId, runtimeId)
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
.get();
|
|
45
|
+
|
|
46
|
+
if (!row) return null;
|
|
47
|
+
return JSON.parse(row.reportJson) as ProfileTestReport;
|
|
48
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export interface ConversationSeed {
|
|
2
|
+
id: string;
|
|
3
|
+
projectId: string;
|
|
4
|
+
title: string;
|
|
5
|
+
runtimeId: string;
|
|
6
|
+
modelId: string;
|
|
7
|
+
status: "active" | "archived";
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ChatMessageSeed {
|
|
13
|
+
id: string;
|
|
14
|
+
conversationId: string;
|
|
15
|
+
role: "user" | "assistant" | "system";
|
|
16
|
+
content: string;
|
|
17
|
+
status: "complete";
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ConversationsResult {
|
|
22
|
+
conversations: ConversationSeed[];
|
|
23
|
+
messages: ChatMessageSeed[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function createConversations(
|
|
27
|
+
projectIds: string[]
|
|
28
|
+
): ConversationsResult {
|
|
29
|
+
const now = Date.now();
|
|
30
|
+
const DAY = 86_400_000;
|
|
31
|
+
const HOUR = 3_600_000;
|
|
32
|
+
const MIN = 60_000;
|
|
33
|
+
|
|
34
|
+
const [investmentProject, launchProject, leadGenProject] = projectIds;
|
|
35
|
+
|
|
36
|
+
const conv1Id = crypto.randomUUID();
|
|
37
|
+
const conv2Id = crypto.randomUUID();
|
|
38
|
+
const conv3Id = crypto.randomUUID();
|
|
39
|
+
|
|
40
|
+
const conversations: ConversationSeed[] = [
|
|
41
|
+
{
|
|
42
|
+
id: conv1Id,
|
|
43
|
+
projectId: investmentProject,
|
|
44
|
+
title: "Portfolio rebalancing strategy",
|
|
45
|
+
runtimeId: "claude-agent-sdk",
|
|
46
|
+
modelId: "claude-sonnet-4-5-20250514",
|
|
47
|
+
status: "active",
|
|
48
|
+
createdAt: new Date(now - 3 * DAY),
|
|
49
|
+
updatedAt: new Date(now - 3 * DAY + 20 * MIN),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: conv2Id,
|
|
53
|
+
projectId: launchProject,
|
|
54
|
+
title: "Landing page headline options",
|
|
55
|
+
runtimeId: "claude-agent-sdk",
|
|
56
|
+
modelId: "claude-sonnet-4-5-20250514",
|
|
57
|
+
status: "active",
|
|
58
|
+
createdAt: new Date(now - 1 * DAY),
|
|
59
|
+
updatedAt: new Date(now - 1 * DAY + 15 * MIN),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: conv3Id,
|
|
63
|
+
projectId: leadGenProject,
|
|
64
|
+
title: "Outreach sequence review",
|
|
65
|
+
runtimeId: "claude-agent-sdk",
|
|
66
|
+
modelId: "claude-sonnet-4-5-20250514",
|
|
67
|
+
status: "archived",
|
|
68
|
+
createdAt: new Date(now - 7 * DAY),
|
|
69
|
+
updatedAt: new Date(now - 6 * DAY),
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
const messages: ChatMessageSeed[] = [
|
|
74
|
+
// Conversation 1: Portfolio rebalancing
|
|
75
|
+
{
|
|
76
|
+
id: crypto.randomUUID(),
|
|
77
|
+
conversationId: conv1Id,
|
|
78
|
+
role: "user",
|
|
79
|
+
content:
|
|
80
|
+
"My tech allocation is at 42% after the recent rally. What's a sensible rebalancing target?",
|
|
81
|
+
status: "complete",
|
|
82
|
+
createdAt: new Date(now - 3 * DAY),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: crypto.randomUUID(),
|
|
86
|
+
conversationId: conv1Id,
|
|
87
|
+
role: "assistant",
|
|
88
|
+
content:
|
|
89
|
+
"A 42% tech concentration is elevated. For a growth-oriented portfolio, 30-35% is a common target. I'd suggest trimming in two tranches over the next month to reduce timing risk, starting with your most appreciated positions.",
|
|
90
|
+
status: "complete",
|
|
91
|
+
createdAt: new Date(now - 3 * DAY + 2 * MIN),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: crypto.randomUUID(),
|
|
95
|
+
conversationId: conv1Id,
|
|
96
|
+
role: "user",
|
|
97
|
+
content: "What sectors should I rotate into?",
|
|
98
|
+
status: "complete",
|
|
99
|
+
createdAt: new Date(now - 3 * DAY + 10 * MIN),
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: crypto.randomUUID(),
|
|
103
|
+
conversationId: conv1Id,
|
|
104
|
+
role: "assistant",
|
|
105
|
+
content:
|
|
106
|
+
"Given your current underweight in healthcare (8%) and industrials (5%), those are natural recipients. Healthcare offers defensive characteristics while industrials give you cyclical upside. A 5% shift into each would bring you to a more balanced allocation.",
|
|
107
|
+
status: "complete",
|
|
108
|
+
createdAt: new Date(now - 3 * DAY + 12 * MIN),
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: crypto.randomUUID(),
|
|
112
|
+
conversationId: conv1Id,
|
|
113
|
+
role: "user",
|
|
114
|
+
content: "Makes sense. Draft a rebalancing plan I can review this weekend.",
|
|
115
|
+
status: "complete",
|
|
116
|
+
createdAt: new Date(now - 3 * DAY + 20 * MIN),
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// Conversation 2: Landing page headlines
|
|
120
|
+
{
|
|
121
|
+
id: crypto.randomUUID(),
|
|
122
|
+
conversationId: conv2Id,
|
|
123
|
+
role: "user",
|
|
124
|
+
content:
|
|
125
|
+
"We need three headline variants for the SaaS launch page. Target audience is mid-market ops teams.",
|
|
126
|
+
status: "complete",
|
|
127
|
+
createdAt: new Date(now - 1 * DAY),
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: crypto.randomUUID(),
|
|
131
|
+
conversationId: conv2Id,
|
|
132
|
+
role: "assistant",
|
|
133
|
+
content:
|
|
134
|
+
'Here are three angles:\n\n1. **Pain-led:** "Stop losing 12 hours a week to manual handoffs"\n2. **Outcome-led:** "Ship ops workflows in minutes, not sprints"\n3. **Social proof:** "Join 400+ ops teams that automated their first workflow in under a day"\n\nI\'d recommend A/B testing #1 vs #2 first — pain-led headlines typically outperform on cold traffic.',
|
|
135
|
+
status: "complete",
|
|
136
|
+
createdAt: new Date(now - 1 * DAY + 3 * MIN),
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: crypto.randomUUID(),
|
|
140
|
+
conversationId: conv2Id,
|
|
141
|
+
role: "user",
|
|
142
|
+
content:
|
|
143
|
+
"I like #1 and #2. Can you write the supporting subheadline for each?",
|
|
144
|
+
status: "complete",
|
|
145
|
+
createdAt: new Date(now - 1 * DAY + 8 * MIN),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: crypto.randomUUID(),
|
|
149
|
+
conversationId: conv2Id,
|
|
150
|
+
role: "assistant",
|
|
151
|
+
content:
|
|
152
|
+
'For #1: "Automate approvals, routing, and status updates across your stack — no code required."\n\nFor #2: "Drag-and-drop workflow builder with 50+ integrations. Your team ships faster from day one."',
|
|
153
|
+
status: "complete",
|
|
154
|
+
createdAt: new Date(now - 1 * DAY + 10 * MIN),
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
// Conversation 3: Outreach sequence (archived)
|
|
158
|
+
{
|
|
159
|
+
id: crypto.randomUUID(),
|
|
160
|
+
conversationId: conv3Id,
|
|
161
|
+
role: "user",
|
|
162
|
+
content:
|
|
163
|
+
"Review our 5-step outreach sequence. Open rates are good but reply rates dropped below 3%.",
|
|
164
|
+
status: "complete",
|
|
165
|
+
createdAt: new Date(now - 7 * DAY),
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: crypto.randomUUID(),
|
|
169
|
+
conversationId: conv3Id,
|
|
170
|
+
role: "assistant",
|
|
171
|
+
content:
|
|
172
|
+
"The main issue is steps 3-5 — they repeat the value prop without adding new information. Each follow-up should introduce a distinct proof point: a case study, a metric, or a relevant trigger event. I'd also shorten step 4 to under 50 words — brevity drives replies in later sequence steps.",
|
|
173
|
+
status: "complete",
|
|
174
|
+
createdAt: new Date(now - 7 * DAY + 4 * MIN),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: crypto.randomUUID(),
|
|
178
|
+
conversationId: conv3Id,
|
|
179
|
+
role: "user",
|
|
180
|
+
content: "Rewrite steps 3-5 with that approach.",
|
|
181
|
+
status: "complete",
|
|
182
|
+
createdAt: new Date(now - 7 * DAY + 12 * MIN),
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: crypto.randomUUID(),
|
|
186
|
+
conversationId: conv3Id,
|
|
187
|
+
role: "assistant",
|
|
188
|
+
content:
|
|
189
|
+
'**Step 3 (Day 5):** "Quick note — [Company] cut their approval cycle from 3 days to 4 hours with our workflow builder. Worth a 15-min look?"\n\n**Step 4 (Day 8):** "Saw your team just posted a RevOps role. Happy to share how others automated that work instead."\n\n**Step 5 (Day 12):** "Last reach-out — here\'s a 2-min demo showing the exact workflow your peers use. [link]"',
|
|
190
|
+
status: "complete",
|
|
191
|
+
createdAt: new Date(now - 7 * DAY + 15 * MIN),
|
|
192
|
+
},
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
return { conversations, messages };
|
|
196
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export interface LearnedContextSeed {
|
|
2
|
+
id: string;
|
|
3
|
+
profileId: string;
|
|
4
|
+
version: number;
|
|
5
|
+
content: string | null;
|
|
6
|
+
diff: string | null;
|
|
7
|
+
changeType: "proposal" | "approved" | "rejected" | "rollback" | "summarization";
|
|
8
|
+
sourceTaskId: string | null;
|
|
9
|
+
proposalNotificationId: string | null;
|
|
10
|
+
proposedAdditions: string | null;
|
|
11
|
+
approvedBy: string | null;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function createLearnedContext(
|
|
16
|
+
completedTaskIds: string[]
|
|
17
|
+
): LearnedContextSeed[] {
|
|
18
|
+
const now = Date.now();
|
|
19
|
+
const DAY = 86_400_000;
|
|
20
|
+
const HOUR = 3_600_000;
|
|
21
|
+
|
|
22
|
+
const sourceTask1 = completedTaskIds[0] ?? null;
|
|
23
|
+
const sourceTask2 = completedTaskIds[1] ?? null;
|
|
24
|
+
|
|
25
|
+
return [
|
|
26
|
+
// General profile: proposal → approved lifecycle
|
|
27
|
+
{
|
|
28
|
+
id: crypto.randomUUID(),
|
|
29
|
+
profileId: "general",
|
|
30
|
+
version: 1,
|
|
31
|
+
content: null,
|
|
32
|
+
diff: null,
|
|
33
|
+
changeType: "proposal",
|
|
34
|
+
sourceTaskId: sourceTask1,
|
|
35
|
+
proposalNotificationId: null,
|
|
36
|
+
proposedAdditions:
|
|
37
|
+
"User prefers concise bullet-point summaries over paragraph-style output. When multiple options exist, present a ranked list with trade-offs rather than a single recommendation.",
|
|
38
|
+
approvedBy: null,
|
|
39
|
+
createdAt: new Date(now - 5 * DAY),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: crypto.randomUUID(),
|
|
43
|
+
profileId: "general",
|
|
44
|
+
version: 2,
|
|
45
|
+
content:
|
|
46
|
+
"User prefers concise bullet-point summaries over paragraph-style output. When multiple options exist, present a ranked list with trade-offs rather than a single recommendation.",
|
|
47
|
+
diff: "+ User prefers concise bullet-point summaries over paragraph-style output.\n+ When multiple options exist, present a ranked list with trade-offs rather than a single recommendation.",
|
|
48
|
+
changeType: "approved",
|
|
49
|
+
sourceTaskId: sourceTask1,
|
|
50
|
+
proposalNotificationId: null,
|
|
51
|
+
proposedAdditions: null,
|
|
52
|
+
approvedBy: "user",
|
|
53
|
+
createdAt: new Date(now - 5 * DAY + 2 * HOUR),
|
|
54
|
+
},
|
|
55
|
+
// Researcher profile: proposal → rejected
|
|
56
|
+
{
|
|
57
|
+
id: crypto.randomUUID(),
|
|
58
|
+
profileId: "researcher",
|
|
59
|
+
version: 1,
|
|
60
|
+
content: null,
|
|
61
|
+
diff: null,
|
|
62
|
+
changeType: "proposal",
|
|
63
|
+
sourceTaskId: sourceTask2,
|
|
64
|
+
proposalNotificationId: null,
|
|
65
|
+
proposedAdditions:
|
|
66
|
+
"Always include academic citation format (APA) for sources. Limit research scope to peer-reviewed journals only.",
|
|
67
|
+
approvedBy: null,
|
|
68
|
+
createdAt: new Date(now - 3 * DAY),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: crypto.randomUUID(),
|
|
72
|
+
profileId: "researcher",
|
|
73
|
+
version: 2,
|
|
74
|
+
content: null,
|
|
75
|
+
diff: null,
|
|
76
|
+
changeType: "rejected",
|
|
77
|
+
sourceTaskId: sourceTask2,
|
|
78
|
+
proposalNotificationId: null,
|
|
79
|
+
proposedAdditions: null,
|
|
80
|
+
approvedBy: null,
|
|
81
|
+
createdAt: new Date(now - 3 * DAY + 1 * HOUR),
|
|
82
|
+
},
|
|
83
|
+
// General profile: second proposal (summarization)
|
|
84
|
+
{
|
|
85
|
+
id: crypto.randomUUID(),
|
|
86
|
+
profileId: "general",
|
|
87
|
+
version: 3,
|
|
88
|
+
content:
|
|
89
|
+
"User prefers concise bullet-point summaries over paragraph-style output. When multiple options exist, present a ranked list with trade-offs rather than a single recommendation.",
|
|
90
|
+
diff: null,
|
|
91
|
+
changeType: "summarization",
|
|
92
|
+
sourceTaskId: null,
|
|
93
|
+
proposalNotificationId: null,
|
|
94
|
+
proposedAdditions: null,
|
|
95
|
+
approvedBy: null,
|
|
96
|
+
createdAt: new Date(now - 1 * DAY),
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface NotificationSeed {
|
|
2
2
|
id: string;
|
|
3
3
|
taskId: string;
|
|
4
|
-
type: "task_completed" | "task_failed" | "permission_required" | "agent_message";
|
|
4
|
+
type: "task_completed" | "task_failed" | "permission_required" | "agent_message" | "budget_alert" | "context_proposal" | "context_proposal_batch";
|
|
5
5
|
title: string;
|
|
6
6
|
body: string;
|
|
7
7
|
read: boolean;
|
|
@@ -137,5 +137,58 @@ export function createNotifications(taskIds: string[]): NotificationSeed[] {
|
|
|
137
137
|
respondedAt: null,
|
|
138
138
|
createdAt: new Date(now - 30 * 60_000),
|
|
139
139
|
},
|
|
140
|
+
// Budget alert — unread, needs attention
|
|
141
|
+
{
|
|
142
|
+
id: crypto.randomUUID(),
|
|
143
|
+
taskId: taskIds[2], // Compare dividend yield — running
|
|
144
|
+
type: "budget_alert",
|
|
145
|
+
title: "Daily budget 80% consumed",
|
|
146
|
+
body: "Agent tasks have used $4.02 of your $5.00 daily budget. 2 running tasks may exceed the limit. Consider pausing non-critical tasks or increasing the daily cap in Settings → Budget Guardrails.",
|
|
147
|
+
read: false,
|
|
148
|
+
toolName: null,
|
|
149
|
+
toolInput: null,
|
|
150
|
+
response: null,
|
|
151
|
+
respondedAt: null,
|
|
152
|
+
createdAt: new Date(now - 2 * HOUR),
|
|
153
|
+
},
|
|
154
|
+
// Context proposal — unread, needs attention (agent learned something)
|
|
155
|
+
{
|
|
156
|
+
id: crypto.randomUUID(),
|
|
157
|
+
taskId: taskIds[0], // Analyze portfolio — completed
|
|
158
|
+
type: "context_proposal",
|
|
159
|
+
title: "Learned: Portfolio rebalancing threshold",
|
|
160
|
+
body: "From the portfolio analysis task, I learned that your preferred sector concentration limit is 35%. I'd like to remember this for future investment analysis tasks so I can flag overweight positions automatically.",
|
|
161
|
+
read: false,
|
|
162
|
+
toolName: null,
|
|
163
|
+
toolInput: JSON.stringify({
|
|
164
|
+
pattern: "sector_concentration_limit",
|
|
165
|
+
value: "35%",
|
|
166
|
+
confidence: 0.92,
|
|
167
|
+
}),
|
|
168
|
+
response: null,
|
|
169
|
+
respondedAt: null,
|
|
170
|
+
createdAt: new Date(now - 5 * HOUR),
|
|
171
|
+
},
|
|
172
|
+
// Context proposal batch — read, already responded
|
|
173
|
+
{
|
|
174
|
+
id: crypto.randomUUID(),
|
|
175
|
+
taskId: taskIds[5], // Audit competitors — completed
|
|
176
|
+
type: "context_proposal_batch",
|
|
177
|
+
title: "3 patterns learned from competitor audit",
|
|
178
|
+
body: "After completing the competitor landing page audit, I identified 3 reusable patterns:\n\n1. **Social proof placement** — above the fold, not below\n2. **CTA limit** — max 3 CTAs per page for focus\n3. **Hero personalization** — dynamic content based on referral source\n\nShall I remember these for future marketing tasks?",
|
|
179
|
+
read: true,
|
|
180
|
+
toolName: null,
|
|
181
|
+
toolInput: JSON.stringify({
|
|
182
|
+
patterns: [
|
|
183
|
+
{ key: "social_proof_placement", value: "above_fold" },
|
|
184
|
+
{ key: "cta_limit", value: 3 },
|
|
185
|
+
{ key: "hero_personalization", value: "referral_based" },
|
|
186
|
+
],
|
|
187
|
+
confidence: 0.88,
|
|
188
|
+
}),
|
|
189
|
+
response: "approved",
|
|
190
|
+
respondedAt: new Date(now - 8 * HOUR),
|
|
191
|
+
createdAt: new Date(now - 10 * HOUR),
|
|
192
|
+
},
|
|
140
193
|
];
|
|
141
194
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export interface ProfileTestResultSeed {
|
|
2
|
+
id: string;
|
|
3
|
+
profileId: string;
|
|
4
|
+
runtimeId: string;
|
|
5
|
+
reportJson: string;
|
|
6
|
+
totalPassed: number;
|
|
7
|
+
totalFailed: number;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function createProfileTestResults(): ProfileTestResultSeed[] {
|
|
12
|
+
const now = Date.now();
|
|
13
|
+
const DAY = 86_400_000;
|
|
14
|
+
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
id: crypto.randomUUID(),
|
|
18
|
+
profileId: "general",
|
|
19
|
+
runtimeId: "claude-agent-sdk",
|
|
20
|
+
reportJson: JSON.stringify({
|
|
21
|
+
profileId: "general",
|
|
22
|
+
runtimeId: "claude-agent-sdk",
|
|
23
|
+
results: [
|
|
24
|
+
{
|
|
25
|
+
task: "Summarize a short article into three key takeaways",
|
|
26
|
+
passed: true,
|
|
27
|
+
matchedKeywords: ["takeaway", "summary", "key"],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
task: "Draft a project status update from raw task data",
|
|
31
|
+
passed: true,
|
|
32
|
+
matchedKeywords: ["status", "progress", "next steps"],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
task: "Compare two approaches and recommend one",
|
|
36
|
+
passed: true,
|
|
37
|
+
matchedKeywords: ["trade-off", "recommend", "approach"],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
task: "Create a checklist from unstructured meeting notes",
|
|
41
|
+
passed: true,
|
|
42
|
+
matchedKeywords: ["checklist", "action", "owner"],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
task: "Explain a technical concept for a non-technical audience",
|
|
46
|
+
passed: true,
|
|
47
|
+
matchedKeywords: ["analogy", "plain language"],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
task: "Generate a risk assessment for a proposed change",
|
|
51
|
+
passed: false,
|
|
52
|
+
matchedKeywords: ["risk"],
|
|
53
|
+
missingKeywords: ["mitigation", "likelihood"],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
}),
|
|
57
|
+
totalPassed: 5,
|
|
58
|
+
totalFailed: 1,
|
|
59
|
+
createdAt: new Date(now - 4 * DAY),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: crypto.randomUUID(),
|
|
63
|
+
profileId: "researcher",
|
|
64
|
+
runtimeId: "claude-agent-sdk",
|
|
65
|
+
reportJson: JSON.stringify({
|
|
66
|
+
profileId: "researcher",
|
|
67
|
+
runtimeId: "claude-agent-sdk",
|
|
68
|
+
results: [
|
|
69
|
+
{
|
|
70
|
+
task: "Research recent developments in battery technology",
|
|
71
|
+
passed: true,
|
|
72
|
+
matchedKeywords: ["source", "findings", "citation"],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
task: "Compare three competing frameworks with citations",
|
|
76
|
+
passed: true,
|
|
77
|
+
matchedKeywords: ["comparison", "source", "framework"],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
task: "Fact-check a set of claims and provide references",
|
|
81
|
+
passed: true,
|
|
82
|
+
matchedKeywords: ["verified", "reference", "claim"],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
task: "Synthesize findings from multiple sources into a brief",
|
|
86
|
+
passed: true,
|
|
87
|
+
matchedKeywords: ["synthesis", "sources", "brief"],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
}),
|
|
91
|
+
totalPassed: 4,
|
|
92
|
+
totalFailed: 0,
|
|
93
|
+
createdAt: new Date(now - 2 * DAY),
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface RepoImportSeed {
|
|
2
|
+
id: string;
|
|
3
|
+
repoUrl: string;
|
|
4
|
+
repoOwner: string;
|
|
5
|
+
repoName: string;
|
|
6
|
+
branch: string;
|
|
7
|
+
commitSha: string;
|
|
8
|
+
profileIds: string;
|
|
9
|
+
skillCount: number;
|
|
10
|
+
lastCheckedAt: Date | null;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function createRepoImports(): RepoImportSeed[] {
|
|
15
|
+
const now = Date.now();
|
|
16
|
+
const DAY = 86_400_000;
|
|
17
|
+
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
id: crypto.randomUUID(),
|
|
21
|
+
repoUrl: "https://github.com/example/agent-skills-library",
|
|
22
|
+
repoOwner: "example",
|
|
23
|
+
repoName: "agent-skills-library",
|
|
24
|
+
branch: "main",
|
|
25
|
+
commitSha: "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
|
|
26
|
+
profileIds: JSON.stringify([
|
|
27
|
+
"ext-data-pipeline-analyst",
|
|
28
|
+
"ext-customer-success-agent",
|
|
29
|
+
"ext-incident-responder",
|
|
30
|
+
]),
|
|
31
|
+
skillCount: 3,
|
|
32
|
+
lastCheckedAt: new Date(now - 2 * DAY),
|
|
33
|
+
createdAt: new Date(now - 14 * DAY),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: crypto.randomUUID(),
|
|
37
|
+
repoUrl: "https://github.com/example/marketing-agents",
|
|
38
|
+
repoOwner: "example",
|
|
39
|
+
repoName: "marketing-agents",
|
|
40
|
+
branch: "main",
|
|
41
|
+
commitSha: "f6e5d4c3b2a1f6e5d4c3b2a1f6e5d4c3b2a1f6e5",
|
|
42
|
+
profileIds: JSON.stringify([
|
|
43
|
+
"ext-seo-content-writer",
|
|
44
|
+
"ext-social-media-scheduler",
|
|
45
|
+
]),
|
|
46
|
+
skillCount: 2,
|
|
47
|
+
lastCheckedAt: new Date(now - 5 * DAY),
|
|
48
|
+
createdAt: new Date(now - 21 * DAY),
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export interface ViewSeed {
|
|
2
|
+
id: string;
|
|
3
|
+
surface: string;
|
|
4
|
+
name: string;
|
|
5
|
+
filters: string | null;
|
|
6
|
+
sorting: string | null;
|
|
7
|
+
columns: string | null;
|
|
8
|
+
density: "compact" | "comfortable" | "spacious";
|
|
9
|
+
isDefault: boolean;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function createViews(): ViewSeed[] {
|
|
15
|
+
const now = Date.now();
|
|
16
|
+
const DAY = 86_400_000;
|
|
17
|
+
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
id: crypto.randomUUID(),
|
|
21
|
+
surface: "tasks",
|
|
22
|
+
name: "High Priority",
|
|
23
|
+
filters: JSON.stringify([
|
|
24
|
+
{ column: "priority", operator: "lte", value: 1 },
|
|
25
|
+
]),
|
|
26
|
+
sorting: JSON.stringify([{ id: "priority", desc: false }]),
|
|
27
|
+
columns: null,
|
|
28
|
+
density: "comfortable",
|
|
29
|
+
isDefault: false,
|
|
30
|
+
createdAt: new Date(now - 7 * DAY),
|
|
31
|
+
updatedAt: new Date(now - 2 * DAY),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: crypto.randomUUID(),
|
|
35
|
+
surface: "documents",
|
|
36
|
+
name: "Ready Documents",
|
|
37
|
+
filters: JSON.stringify([
|
|
38
|
+
{ column: "status", operator: "eq", value: "ready" },
|
|
39
|
+
]),
|
|
40
|
+
sorting: JSON.stringify([{ id: "updatedAt", desc: true }]),
|
|
41
|
+
columns: null,
|
|
42
|
+
density: "comfortable",
|
|
43
|
+
isDefault: false,
|
|
44
|
+
createdAt: new Date(now - 5 * DAY),
|
|
45
|
+
updatedAt: new Date(now - 1 * DAY),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: crypto.randomUUID(),
|
|
49
|
+
surface: "workflows",
|
|
50
|
+
name: "All Workflows",
|
|
51
|
+
filters: null,
|
|
52
|
+
sorting: JSON.stringify([{ id: "updatedAt", desc: true }]),
|
|
53
|
+
columns: null,
|
|
54
|
+
density: "compact",
|
|
55
|
+
isDefault: true,
|
|
56
|
+
createdAt: new Date(now - 10 * DAY),
|
|
57
|
+
updatedAt: new Date(now - 3 * DAY),
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
}
|
package/src/lib/data/seed.ts
CHANGED
|
@@ -7,6 +7,12 @@ import {
|
|
|
7
7
|
agentLogs,
|
|
8
8
|
notifications,
|
|
9
9
|
schedules,
|
|
10
|
+
conversations,
|
|
11
|
+
chatMessages,
|
|
12
|
+
learnedContext,
|
|
13
|
+
views,
|
|
14
|
+
profileTestResults,
|
|
15
|
+
repoImports,
|
|
10
16
|
} from "@/lib/db/schema";
|
|
11
17
|
import { clearAllData } from "./clear";
|
|
12
18
|
import { createProjects } from "./seed-data/projects";
|
|
@@ -20,6 +26,11 @@ import { upsertSampleProfiles } from "./seed-data/profiles";
|
|
|
20
26
|
import { processDocument } from "@/lib/documents/processor";
|
|
21
27
|
import { createUsageLedgerSeeds } from "./seed-data/usage-ledger";
|
|
22
28
|
import { recordUsageLedgerEntry } from "@/lib/usage/ledger";
|
|
29
|
+
import { createConversations } from "./seed-data/conversations";
|
|
30
|
+
import { createLearnedContext } from "./seed-data/learned-context";
|
|
31
|
+
import { createViews } from "./seed-data/views";
|
|
32
|
+
import { createProfileTestResults } from "./seed-data/profile-test-results";
|
|
33
|
+
import { createRepoImports } from "./seed-data/repo-imports";
|
|
23
34
|
|
|
24
35
|
/**
|
|
25
36
|
* Clear all data, then seed with realistic sample data.
|
|
@@ -115,6 +126,40 @@ export async function seedSampleData() {
|
|
|
115
126
|
await recordUsageLedgerEntry(seed);
|
|
116
127
|
}
|
|
117
128
|
|
|
129
|
+
// 12. Insert conversations and chat messages
|
|
130
|
+
const { conversations: convSeeds, messages: msgSeeds } =
|
|
131
|
+
createConversations(projectIds);
|
|
132
|
+
for (const c of convSeeds) {
|
|
133
|
+
db.insert(conversations).values(c).run();
|
|
134
|
+
}
|
|
135
|
+
for (const m of msgSeeds) {
|
|
136
|
+
db.insert(chatMessages).values(m).run();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 13. Insert learned context entries
|
|
140
|
+
const learnedContextSeeds = createLearnedContext(completedTaskIds);
|
|
141
|
+
for (const lc of learnedContextSeeds) {
|
|
142
|
+
db.insert(learnedContext).values(lc).run();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 14. Insert saved views
|
|
146
|
+
const viewSeeds = createViews();
|
|
147
|
+
for (const v of viewSeeds) {
|
|
148
|
+
db.insert(views).values(v).run();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 15. Insert profile test results
|
|
152
|
+
const testResultSeeds = createProfileTestResults();
|
|
153
|
+
for (const tr of testResultSeeds) {
|
|
154
|
+
db.insert(profileTestResults).values(tr).run();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 16. Insert repo import records
|
|
158
|
+
const repoImportSeeds = createRepoImports();
|
|
159
|
+
for (const ri of repoImportSeeds) {
|
|
160
|
+
db.insert(repoImports).values(ri).run();
|
|
161
|
+
}
|
|
162
|
+
|
|
118
163
|
return {
|
|
119
164
|
profiles: profileCount,
|
|
120
165
|
projects: projectSeeds.length,
|
|
@@ -125,5 +170,11 @@ export async function seedSampleData() {
|
|
|
125
170
|
agentLogs: logSeeds.length,
|
|
126
171
|
notifications: notifSeeds.length,
|
|
127
172
|
usageLedger: usageSeeds.length,
|
|
173
|
+
conversations: convSeeds.length,
|
|
174
|
+
chatMessages: msgSeeds.length,
|
|
175
|
+
learnedContext: learnedContextSeeds.length,
|
|
176
|
+
views: viewSeeds.length,
|
|
177
|
+
profileTestResults: testResultSeeds.length,
|
|
178
|
+
repoImports: repoImportSeeds.length,
|
|
128
179
|
};
|
|
129
180
|
}
|