stagent 0.6.2 → 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 +272 -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 -2
- package/src/app/api/chat/entities/search/route.ts +12 -3
- package/src/app/api/documents/[id]/route.ts +5 -1
- package/src/app/api/documents/[id]/versions/route.ts +53 -0
- package/src/app/api/documents/route.ts +5 -1
- package/src/app/api/projects/[id]/documents/route.ts +124 -0
- package/src/app/api/projects/[id]/route.ts +72 -3
- package/src/app/api/projects/__tests__/delete-project.test.ts +13 -0
- package/src/app/api/schedules/route.ts +19 -1
- 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/api/tasks/[id]/route.ts +37 -2
- package/src/app/api/tasks/[id]/siblings/route.ts +48 -0
- package/src/app/api/tasks/route.ts +8 -9
- package/src/app/api/workflows/[id]/documents/route.ts +209 -0
- package/src/app/api/workflows/[id]/execute/route.ts +6 -2
- package/src/app/api/workflows/[id]/route.ts +16 -3
- package/src/app/api/workflows/[id]/status/route.ts +18 -2
- package/src/app/api/workflows/route.ts +13 -2
- package/src/app/documents/page.tsx +5 -1
- package/src/app/layout.tsx +0 -1
- package/src/app/manifest.ts +3 -3
- package/src/app/projects/[id]/page.tsx +62 -2
- 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/documents/document-chip-bar.tsx +17 -1
- package/src/components/documents/document-detail-view.tsx +51 -0
- package/src/components/documents/document-grid.tsx +5 -0
- package/src/components/documents/document-table.tsx +4 -0
- package/src/components/documents/types.ts +3 -0
- package/src/components/projects/project-form-sheet.tsx +109 -2
- package/src/components/schedules/schedule-form.tsx +91 -1
- 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 +486 -0
- 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-card.tsx +8 -1
- package/src/components/tasks/task-create-panel.tsx +111 -14
- package/src/components/tasks/task-detail-view.tsx +47 -0
- package/src/components/tasks/task-edit-dialog.tsx +103 -2
- package/src/components/workflows/workflow-form-view.tsx +207 -7
- package/src/components/workflows/workflow-kanban-card.tsx +8 -1
- package/src/components/workflows/workflow-list.tsx +90 -45
- package/src/components/workflows/workflow-status-view.tsx +168 -23
- package/src/instrumentation.ts +3 -0
- package/src/lib/__tests__/npx-process-cwd.test.ts +17 -2
- package/src/lib/agents/__tests__/claude-agent.test.ts +5 -1
- package/src/lib/agents/claude-agent.ts +3 -1
- package/src/lib/agents/profiles/registry.ts +6 -3
- package/src/lib/agents/runtime/anthropic-direct.ts +29 -0
- package/src/lib/agents/runtime/openai-direct.ts +29 -0
- package/src/lib/book/__tests__/chapter-slugs.test.ts +80 -0
- package/src/lib/book/chapter-generator.ts +4 -19
- package/src/lib/book/chapter-mapping.ts +17 -0
- package/src/lib/book/content.ts +5 -16
- package/src/lib/book/update-detector.ts +3 -16
- package/src/lib/chat/engine.ts +1 -0
- package/src/lib/chat/stagent-tools.ts +2 -0
- package/src/lib/chat/system-prompt.ts +9 -1
- package/src/lib/chat/tool-catalog.ts +35 -0
- package/src/lib/chat/tools/settings-tools.ts +109 -0
- package/src/lib/chat/tools/table-tools.ts +955 -0
- package/src/lib/chat/tools/workflow-tools.ts +145 -2
- 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 +57 -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 +275 -0
- package/src/lib/db/index.ts +9 -0
- package/src/lib/db/migrations/0016_add_workflow_document_inputs.sql +13 -0
- package/src/lib/db/migrations/0017_add_document_picker_tables.sql +25 -0
- package/src/lib/db/migrations/0018_add_workflow_run_number.sql +2 -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 +445 -0
- package/src/lib/docs/reader.ts +2 -3
- package/src/lib/documents/context-builder.ts +75 -2
- package/src/lib/documents/document-resolver.ts +119 -0
- package/src/lib/documents/processors/spreadsheet.ts +2 -1
- package/src/lib/schedules/scheduler.ts +31 -1
- 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/app-root.ts +20 -0
- package/src/lib/utils/stagent-paths.ts +20 -0
- package/src/lib/validators/__tests__/task.test.ts +43 -10
- package/src/lib/validators/task.ts +7 -1
- package/src/lib/workflows/blueprints/registry.ts +3 -3
- package/src/lib/workflows/engine.ts +24 -8
- package/src/lib/workflows/types.ts +14 -0
- package/tsconfig.json +3 -1
- package/public/icon.svg +0 -13
- package/src/components/tasks/file-upload.tsx +0 -120
- /package/docs/features/{playbook.md → user-guide.md} +0 -0
|
@@ -14,6 +14,20 @@ export interface WorkflowStep {
|
|
|
14
14
|
dependsOn?: string[];
|
|
15
15
|
assignedAgent?: string;
|
|
16
16
|
agentProfile?: string;
|
|
17
|
+
/** Document IDs from the project pool to inject as context for this step */
|
|
18
|
+
documentIds?: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Selector for auto-discovering documents from the project pool */
|
|
22
|
+
export interface DocumentSelector {
|
|
23
|
+
fromWorkflowId?: string;
|
|
24
|
+
fromWorkflowName?: string;
|
|
25
|
+
category?: string;
|
|
26
|
+
direction?: "input" | "output";
|
|
27
|
+
mimeType?: string;
|
|
28
|
+
namePattern?: string;
|
|
29
|
+
/** Take only the N most recent matching documents */
|
|
30
|
+
latest?: number;
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
export interface LoopConfig {
|
package/tsconfig.json
CHANGED
package/public/icon.svg
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<rect width="512" height="512" rx="112" fill="#0f172a"/>
|
|
3
|
-
<defs>
|
|
4
|
-
<linearGradient id="s-grad" x1="150" y1="80" x2="362" y2="432" gradientUnits="userSpaceOnUse">
|
|
5
|
-
<stop offset="0%" stop-color="#22d3ee"/>
|
|
6
|
-
<stop offset="50%" stop-color="#3b82f6"/>
|
|
7
|
-
<stop offset="100%" stop-color="#2563eb"/>
|
|
8
|
-
</linearGradient>
|
|
9
|
-
</defs>
|
|
10
|
-
<path d="M340 130c0 0-60-10-110 30s-50 90-10 115c40 25 70 30 70 30s50 15 30 65c-20 50-80 40-80 40" stroke="url(#s-grad)" stroke-width="56" stroke-linecap="round" fill="none"/>
|
|
11
|
-
<circle cx="340" cy="130" r="36" fill="#22d3ee"/>
|
|
12
|
-
<circle cx="240" cy="410" r="36" fill="#2563eb"/>
|
|
13
|
-
</svg>
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useState, useRef } from "react";
|
|
4
|
-
import { Button } from "@/components/ui/button";
|
|
5
|
-
import { Upload, X, FileText, Image, FileCode } from "lucide-react";
|
|
6
|
-
|
|
7
|
-
interface UploadedFile {
|
|
8
|
-
id: string;
|
|
9
|
-
filename: string;
|
|
10
|
-
originalName: string;
|
|
11
|
-
size: number;
|
|
12
|
-
type: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface FileUploadProps {
|
|
16
|
-
onUploaded: (file: UploadedFile) => void;
|
|
17
|
-
uploads: UploadedFile[];
|
|
18
|
-
onRemove: (id: string) => void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function formatSize(bytes: number): string {
|
|
22
|
-
if (bytes < 1024) return `${bytes} B`;
|
|
23
|
-
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
24
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function getFileIcon(type: string) {
|
|
28
|
-
if (type.startsWith("image/")) return Image;
|
|
29
|
-
if (type.includes("pdf") || type.includes("document") || type.includes("text")) return FileText;
|
|
30
|
-
if (type.includes("javascript") || type.includes("typescript") || type.includes("json") || type.includes("xml")) return FileCode;
|
|
31
|
-
return FileText;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function FileUpload({ onUploaded, uploads, onRemove }: FileUploadProps) {
|
|
35
|
-
const [uploading, setUploading] = useState(false);
|
|
36
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
37
|
-
|
|
38
|
-
async function handleFile(file: File) {
|
|
39
|
-
setUploading(true);
|
|
40
|
-
try {
|
|
41
|
-
const formData = new FormData();
|
|
42
|
-
formData.append("file", file);
|
|
43
|
-
|
|
44
|
-
const res = await fetch("/api/uploads", {
|
|
45
|
-
method: "POST",
|
|
46
|
-
body: formData,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (res.ok) {
|
|
50
|
-
const data = await res.json();
|
|
51
|
-
onUploaded(data);
|
|
52
|
-
}
|
|
53
|
-
} finally {
|
|
54
|
-
setUploading(false);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function handleChange(e: React.ChangeEvent<HTMLInputElement>) {
|
|
59
|
-
const file = e.target.files?.[0];
|
|
60
|
-
if (file) handleFile(file);
|
|
61
|
-
e.target.value = "";
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function handleDrop(e: React.DragEvent) {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
const file = e.dataTransfer.files?.[0];
|
|
67
|
-
if (file) handleFile(file);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<div className="space-y-2">
|
|
72
|
-
<div
|
|
73
|
-
role="button"
|
|
74
|
-
tabIndex={0}
|
|
75
|
-
aria-label="Upload a file — click or drag and drop"
|
|
76
|
-
className="border-2 border-dashed rounded-lg p-4 text-center cursor-pointer hover:bg-accent/50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
77
|
-
onClick={() => inputRef.current?.click()}
|
|
78
|
-
onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); inputRef.current?.click(); } }}
|
|
79
|
-
onDrop={handleDrop}
|
|
80
|
-
onDragOver={(e) => e.preventDefault()}
|
|
81
|
-
>
|
|
82
|
-
<Upload className="h-5 w-5 mx-auto text-muted-foreground mb-1" />
|
|
83
|
-
<p className="text-xs text-muted-foreground">
|
|
84
|
-
{uploading ? "Uploading..." : "Click or drop a file"}
|
|
85
|
-
</p>
|
|
86
|
-
<p className="text-xs text-muted-foreground mt-0.5">Max 50MB per file</p>
|
|
87
|
-
<input
|
|
88
|
-
ref={inputRef}
|
|
89
|
-
type="file"
|
|
90
|
-
className="hidden"
|
|
91
|
-
onChange={handleChange}
|
|
92
|
-
/>
|
|
93
|
-
</div>
|
|
94
|
-
{uploads.length > 0 && (
|
|
95
|
-
<div className="space-y-1">
|
|
96
|
-
{uploads.map((f) => {
|
|
97
|
-
const Icon = getFileIcon(f.type);
|
|
98
|
-
return (
|
|
99
|
-
<div key={f.id} className="flex items-center gap-2 text-sm">
|
|
100
|
-
<Icon className="h-3 w-3 text-muted-foreground" />
|
|
101
|
-
<span className="flex-1 truncate">{f.originalName}</span>
|
|
102
|
-
<span className="text-xs text-muted-foreground">{formatSize(f.size)}</span>
|
|
103
|
-
<Button
|
|
104
|
-
type="button"
|
|
105
|
-
variant="ghost"
|
|
106
|
-
size="icon"
|
|
107
|
-
className="h-5 w-5"
|
|
108
|
-
onClick={() => onRemove(f.id)}
|
|
109
|
-
aria-label={`Remove ${f.originalName}`}
|
|
110
|
-
>
|
|
111
|
-
<X className="h-3 w-3" />
|
|
112
|
-
</Button>
|
|
113
|
-
</div>
|
|
114
|
-
);
|
|
115
|
-
})}
|
|
116
|
-
</div>
|
|
117
|
-
)}
|
|
118
|
-
</div>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
File without changes
|