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.
Files changed (176) hide show
  1. package/README.md +21 -2
  2. package/dist/cli.js +272 -1
  3. package/docs/.coverage-gaps.json +66 -16
  4. package/docs/.last-generated +1 -1
  5. package/docs/features/dashboard-kanban.md +13 -7
  6. package/docs/features/settings.md +15 -3
  7. package/docs/features/tables.md +122 -0
  8. package/docs/index.md +3 -2
  9. package/docs/journeys/developer.md +26 -16
  10. package/docs/journeys/personal-use.md +23 -9
  11. package/docs/journeys/power-user.md +40 -14
  12. package/docs/journeys/work-use.md +43 -15
  13. package/docs/manifest.json +27 -17
  14. package/package.json +3 -2
  15. package/src/app/api/chat/entities/search/route.ts +12 -3
  16. package/src/app/api/documents/[id]/route.ts +5 -1
  17. package/src/app/api/documents/[id]/versions/route.ts +53 -0
  18. package/src/app/api/documents/route.ts +5 -1
  19. package/src/app/api/projects/[id]/documents/route.ts +124 -0
  20. package/src/app/api/projects/[id]/route.ts +72 -3
  21. package/src/app/api/projects/__tests__/delete-project.test.ts +13 -0
  22. package/src/app/api/schedules/route.ts +19 -1
  23. package/src/app/api/snapshots/[id]/restore/route.ts +62 -0
  24. package/src/app/api/snapshots/[id]/route.ts +44 -0
  25. package/src/app/api/snapshots/route.ts +54 -0
  26. package/src/app/api/snapshots/settings/route.ts +67 -0
  27. package/src/app/api/tables/[id]/charts/[chartId]/route.ts +89 -0
  28. package/src/app/api/tables/[id]/charts/route.ts +72 -0
  29. package/src/app/api/tables/[id]/columns/route.ts +70 -0
  30. package/src/app/api/tables/[id]/export/route.ts +94 -0
  31. package/src/app/api/tables/[id]/history/route.ts +15 -0
  32. package/src/app/api/tables/[id]/import/route.ts +111 -0
  33. package/src/app/api/tables/[id]/route.ts +86 -0
  34. package/src/app/api/tables/[id]/rows/[rowId]/history/route.ts +32 -0
  35. package/src/app/api/tables/[id]/rows/[rowId]/route.ts +51 -0
  36. package/src/app/api/tables/[id]/rows/route.ts +101 -0
  37. package/src/app/api/tables/[id]/triggers/[triggerId]/route.ts +65 -0
  38. package/src/app/api/tables/[id]/triggers/route.ts +122 -0
  39. package/src/app/api/tables/route.ts +65 -0
  40. package/src/app/api/tables/templates/route.ts +92 -0
  41. package/src/app/api/tasks/[id]/route.ts +37 -2
  42. package/src/app/api/tasks/[id]/siblings/route.ts +48 -0
  43. package/src/app/api/tasks/route.ts +8 -9
  44. package/src/app/api/workflows/[id]/documents/route.ts +209 -0
  45. package/src/app/api/workflows/[id]/execute/route.ts +6 -2
  46. package/src/app/api/workflows/[id]/route.ts +16 -3
  47. package/src/app/api/workflows/[id]/status/route.ts +18 -2
  48. package/src/app/api/workflows/route.ts +13 -2
  49. package/src/app/documents/page.tsx +5 -1
  50. package/src/app/layout.tsx +0 -1
  51. package/src/app/manifest.ts +3 -3
  52. package/src/app/projects/[id]/page.tsx +62 -2
  53. package/src/app/settings/page.tsx +2 -0
  54. package/src/app/tables/[id]/page.tsx +67 -0
  55. package/src/app/tables/page.tsx +21 -0
  56. package/src/app/tables/templates/page.tsx +19 -0
  57. package/src/components/chat/chat-table-result.tsx +139 -0
  58. package/src/components/documents/document-browser.tsx +1 -1
  59. package/src/components/documents/document-chip-bar.tsx +17 -1
  60. package/src/components/documents/document-detail-view.tsx +51 -0
  61. package/src/components/documents/document-grid.tsx +5 -0
  62. package/src/components/documents/document-table.tsx +4 -0
  63. package/src/components/documents/types.ts +3 -0
  64. package/src/components/projects/project-form-sheet.tsx +109 -2
  65. package/src/components/schedules/schedule-form.tsx +91 -1
  66. package/src/components/settings/data-management-section.tsx +17 -12
  67. package/src/components/settings/database-snapshots-section.tsx +469 -0
  68. package/src/components/shared/app-sidebar.tsx +2 -0
  69. package/src/components/shared/document-picker-sheet.tsx +486 -0
  70. package/src/components/tables/table-browser.tsx +234 -0
  71. package/src/components/tables/table-cell-editor.tsx +226 -0
  72. package/src/components/tables/table-chart-builder.tsx +288 -0
  73. package/src/components/tables/table-chart-view.tsx +146 -0
  74. package/src/components/tables/table-column-header.tsx +103 -0
  75. package/src/components/tables/table-column-sheet.tsx +331 -0
  76. package/src/components/tables/table-create-sheet.tsx +240 -0
  77. package/src/components/tables/table-detail-sheet.tsx +144 -0
  78. package/src/components/tables/table-detail-tabs.tsx +278 -0
  79. package/src/components/tables/table-grid.tsx +61 -0
  80. package/src/components/tables/table-history-tab.tsx +148 -0
  81. package/src/components/tables/table-import-wizard.tsx +542 -0
  82. package/src/components/tables/table-list-table.tsx +95 -0
  83. package/src/components/tables/table-relation-combobox.tsx +217 -0
  84. package/src/components/tables/table-spreadsheet.tsx +499 -0
  85. package/src/components/tables/table-template-gallery.tsx +162 -0
  86. package/src/components/tables/table-template-preview.tsx +219 -0
  87. package/src/components/tables/table-toolbar.tsx +79 -0
  88. package/src/components/tables/table-triggers-tab.tsx +446 -0
  89. package/src/components/tables/types.ts +6 -0
  90. package/src/components/tables/use-spreadsheet-keys.ts +171 -0
  91. package/src/components/tables/utils.ts +29 -0
  92. package/src/components/tasks/task-card.tsx +8 -1
  93. package/src/components/tasks/task-create-panel.tsx +111 -14
  94. package/src/components/tasks/task-detail-view.tsx +47 -0
  95. package/src/components/tasks/task-edit-dialog.tsx +103 -2
  96. package/src/components/workflows/workflow-form-view.tsx +207 -7
  97. package/src/components/workflows/workflow-kanban-card.tsx +8 -1
  98. package/src/components/workflows/workflow-list.tsx +90 -45
  99. package/src/components/workflows/workflow-status-view.tsx +168 -23
  100. package/src/instrumentation.ts +3 -0
  101. package/src/lib/__tests__/npx-process-cwd.test.ts +17 -2
  102. package/src/lib/agents/__tests__/claude-agent.test.ts +5 -1
  103. package/src/lib/agents/claude-agent.ts +3 -1
  104. package/src/lib/agents/profiles/registry.ts +6 -3
  105. package/src/lib/agents/runtime/anthropic-direct.ts +29 -0
  106. package/src/lib/agents/runtime/openai-direct.ts +29 -0
  107. package/src/lib/book/__tests__/chapter-slugs.test.ts +80 -0
  108. package/src/lib/book/chapter-generator.ts +4 -19
  109. package/src/lib/book/chapter-mapping.ts +17 -0
  110. package/src/lib/book/content.ts +5 -16
  111. package/src/lib/book/update-detector.ts +3 -16
  112. package/src/lib/chat/engine.ts +1 -0
  113. package/src/lib/chat/stagent-tools.ts +2 -0
  114. package/src/lib/chat/system-prompt.ts +9 -1
  115. package/src/lib/chat/tool-catalog.ts +35 -0
  116. package/src/lib/chat/tools/settings-tools.ts +109 -0
  117. package/src/lib/chat/tools/table-tools.ts +955 -0
  118. package/src/lib/chat/tools/workflow-tools.ts +145 -2
  119. package/src/lib/constants/table-status.ts +68 -0
  120. package/src/lib/data/__tests__/clear.test.ts +1 -1
  121. package/src/lib/data/clear.ts +57 -0
  122. package/src/lib/data/seed-data/__tests__/profiles.test.ts +28 -23
  123. package/src/lib/data/seed-data/conversations.ts +350 -42
  124. package/src/lib/data/seed-data/documents.ts +564 -591
  125. package/src/lib/data/seed-data/learned-context.ts +101 -22
  126. package/src/lib/data/seed-data/notifications.ts +344 -70
  127. package/src/lib/data/seed-data/profile-test-results.ts +92 -11
  128. package/src/lib/data/seed-data/profiles.ts +144 -46
  129. package/src/lib/data/seed-data/projects.ts +50 -18
  130. package/src/lib/data/seed-data/repo-imports.ts +28 -13
  131. package/src/lib/data/seed-data/schedules.ts +208 -41
  132. package/src/lib/data/seed-data/table-templates.ts +234 -0
  133. package/src/lib/data/seed-data/tasks.ts +614 -116
  134. package/src/lib/data/seed-data/usage-ledger.ts +182 -103
  135. package/src/lib/data/seed-data/user-tables.ts +203 -0
  136. package/src/lib/data/seed-data/views.ts +52 -7
  137. package/src/lib/data/seed-data/workflows.ts +231 -84
  138. package/src/lib/data/seed.ts +55 -14
  139. package/src/lib/data/tables.ts +417 -0
  140. package/src/lib/db/bootstrap.ts +275 -0
  141. package/src/lib/db/index.ts +9 -0
  142. package/src/lib/db/migrations/0016_add_workflow_document_inputs.sql +13 -0
  143. package/src/lib/db/migrations/0017_add_document_picker_tables.sql +25 -0
  144. package/src/lib/db/migrations/0018_add_workflow_run_number.sql +2 -0
  145. package/src/lib/db/migrations/0019_add_tables_feature.sql +160 -0
  146. package/src/lib/db/migrations/0020_add_table_triggers.sql +19 -0
  147. package/src/lib/db/migrations/0021_add_row_history.sql +15 -0
  148. package/src/lib/db/schema.ts +445 -0
  149. package/src/lib/docs/reader.ts +2 -3
  150. package/src/lib/documents/context-builder.ts +75 -2
  151. package/src/lib/documents/document-resolver.ts +119 -0
  152. package/src/lib/documents/processors/spreadsheet.ts +2 -1
  153. package/src/lib/schedules/scheduler.ts +31 -1
  154. package/src/lib/snapshots/auto-backup.ts +132 -0
  155. package/src/lib/snapshots/retention.ts +64 -0
  156. package/src/lib/snapshots/snapshot-manager.ts +429 -0
  157. package/src/lib/tables/computed.ts +61 -0
  158. package/src/lib/tables/context-builder.ts +139 -0
  159. package/src/lib/tables/formula-engine.ts +415 -0
  160. package/src/lib/tables/history.ts +115 -0
  161. package/src/lib/tables/import.ts +343 -0
  162. package/src/lib/tables/query-builder.ts +152 -0
  163. package/src/lib/tables/trigger-evaluator.ts +146 -0
  164. package/src/lib/tables/types.ts +141 -0
  165. package/src/lib/tables/validation.ts +119 -0
  166. package/src/lib/utils/app-root.ts +20 -0
  167. package/src/lib/utils/stagent-paths.ts +20 -0
  168. package/src/lib/validators/__tests__/task.test.ts +43 -10
  169. package/src/lib/validators/task.ts +7 -1
  170. package/src/lib/workflows/blueprints/registry.ts +3 -3
  171. package/src/lib/workflows/engine.ts +24 -8
  172. package/src/lib/workflows/types.ts +14 -0
  173. package/tsconfig.json +3 -1
  174. package/public/icon.svg +0 -13
  175. package/src/components/tasks/file-upload.tsx +0 -120
  176. /package/docs/features/{playbook.md → user-guide.md} +0 -0
package/README.md CHANGED
@@ -57,6 +57,7 @@ Run the same business process on different AI providers without changing a line
57
57
  | 🧠 | **[Agent Profiles](#agent-profiles)** | Reusable specialist definitions with prompts, tool policy, and runtime tuning |
58
58
  | ⏰ | **[Schedules](#schedules)** | Recurring and one-shot automations with cadence, expiry, and firing controls |
59
59
  | 📄 | **[Documents](#document-management)** | Upload, preprocess, inspect, and link files to tasks and projects |
60
+ | 📊 | **[Tables](#tables)** | Airtable-like structured data with spreadsheet editing, charts, triggers, and agent tools |
60
61
  | 📥 | **[Human-in-the-Loop Inbox](#inbox--human-in-the-loop)** | Approve tool use, answer questions, and review results from one queue |
61
62
  | 💬 | **[Chat](#chat)** | Tool catalog with model selection, @ mentions, slash commands, and browser automation |
62
63
  | 👀 | **[Monitoring](#monitoring)** | Live runtime visibility with log streaming, filters, and health signals |
@@ -203,6 +204,24 @@ Automatic text extraction on upload for five file types: text, PDF (pdf-parse),
203
204
  #### Agent Document Context
204
205
  Documents linked to a task are automatically injected into the agent's prompt as context. The context builder aggregates extracted text from all linked documents, giving agents access to uploaded reference material without manual copy-paste.
205
206
 
207
+ #### Tables
208
+ Airtable-like structured data system at `/tables` with 14 features. Create tables from scratch, import from CSV/XLSX documents, or use one of 12 built-in templates across 5 categories. Each table includes an inline spreadsheet editor with keyboard navigation, type-aware cell renderers, computed columns with formula support (12 functions including sum, avg, if, daysBetween), and optimistic saves.
209
+
210
+ | Table List | Spreadsheet Editor |
211
+ |:-:|:-:|
212
+ | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/tables-list.png" alt="Tables list view" width="580" /> | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/tables-detail.png" alt="Table spreadsheet editor" width="580" /> |
213
+
214
+ | Charts | Template Gallery |
215
+ |:-:|:-:|
216
+ | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/tables-detail-charts.png" alt="Table charts tab" width="580" /> | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/tables-templates.png" alt="Table template gallery" width="580" /> |
217
+
218
+ - **Charts** — Bar, line, pie, and scatter charts with configurable X/Y axes and aggregation
219
+ - **Workflow triggers** — Automated actions fired when row data matches conditions
220
+ - **12 agent tools** — Agents can list, query, aggregate, search, add/update/delete rows, and create tables
221
+ - **Cross-table relations** — Link rows across tables with searchable relation combobox
222
+ - **Export** — CSV, XLSX, and JSON export for any table
223
+ - **Row versioning** — History tab with snapshot-before-mutation and rollback to previous versions
224
+
206
225
  ### Knowledge
207
226
 
208
227
  #### Playbook
@@ -295,7 +314,7 @@ Real-time agent log streaming via Server-Sent Events. Filter by task or event ty
295
314
  File upload with drag-and-drop in task creation. Type-aware content preview for text, markdown (via react-markdown), code, and JSON. Copy-to-clipboard and download-as-file for task outputs.
296
315
 
297
316
  #### Settings
298
- Configuration hub with provider-aware sections: Claude authentication (API key or OAuth), OpenAI Codex runtime API-key management, chat defaults (model selection), **browser tools** (Chrome DevTools and Playwright MCP toggles), runtime configuration (SDK timeout and max turns), tool permissions (saved "Always Allow" patterns with revoke), permission presets, budget guardrails, and data management.
317
+ Configuration hub with provider-aware sections: Claude authentication (API key or OAuth), OpenAI Codex runtime API-key management, chat defaults (model selection), **browser tools** (Chrome DevTools and Playwright MCP toggles), runtime configuration (SDK timeout and max turns), tool permissions (saved "Always Allow" patterns with revoke), permission presets, budget guardrails, **database snapshots** (automatic backups with configurable retention and one-click restore), and data management.
299
318
 
300
319
  <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/settings-list.png" alt="Stagent settings" width="1200" />
301
320
 
@@ -307,7 +326,7 @@ Configuration hub with provider-aware sections: Claude authentication (API key o
307
326
  The `npx stagent` entry point boots a Next.js server from the published npm package. It is built from `bin/cli.ts` into `dist/cli.js` using tsup, and serves as the primary distribution channel — no clone required.
308
327
 
309
328
  #### Database
310
- SQLite with WAL mode via better-sqlite3 + Drizzle ORM. Fourteen tables: `projects`, `tasks`, `workflows`, `agent_logs`, `notifications`, `documents`, `schedules`, `settings`, `learned_context`, `usage_ledger`, `conversations`, `chat_messages`, `environments`, `environment_configs`. Self-healing bootstrap — tables are created on startup if missing.
329
+ SQLite with WAL mode via better-sqlite3 + Drizzle ORM. 27+ tables including core tables: `projects`, `tasks`, `workflows`, `agent_logs`, `notifications`, `documents`, `schedules`, `settings`, `learned_context`, `usage_ledger`, `conversations`, `chat_messages`, `environments`, `environment_configs`. Self-healing bootstrap — tables are created on startup if missing.
311
330
 
312
331
  #### Command Palette
313
332
  Global `⌘K` command palette for fast navigation and search across tasks, projects, workflows, and settings. Recent items, fuzzy search, and keyboard-driven navigation.
package/dist/cli.js CHANGED
@@ -112,7 +112,24 @@ var STAGENT_TABLES = [
112
112
  "agent_memory",
113
113
  "channel_configs",
114
114
  "channel_bindings",
115
- "agent_messages"
115
+ "agent_messages",
116
+ "workflow_document_inputs",
117
+ "schedule_document_inputs",
118
+ "project_document_defaults",
119
+ "user_tables",
120
+ "user_table_columns",
121
+ "user_table_rows",
122
+ "user_table_views",
123
+ "user_table_relationships",
124
+ "user_table_templates",
125
+ "user_table_imports",
126
+ "table_document_inputs",
127
+ "task_table_inputs",
128
+ "workflow_table_inputs",
129
+ "schedule_table_inputs",
130
+ "user_table_triggers",
131
+ "user_table_row_history",
132
+ "snapshots"
116
133
  ];
117
134
  function bootstrapStagentDatabase(sqlite2) {
118
135
  sqlite2.exec(`
@@ -139,6 +156,7 @@ function bootstrapStagentDatabase(sqlite2) {
139
156
  result TEXT,
140
157
  session_id TEXT,
141
158
  resume_count INTEGER DEFAULT 0 NOT NULL,
159
+ workflow_run_number INTEGER,
142
160
  created_at INTEGER NOT NULL,
143
161
  updated_at INTEGER NOT NULL,
144
162
  FOREIGN KEY (project_id) REFERENCES projects(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
@@ -152,6 +170,7 @@ function bootstrapStagentDatabase(sqlite2) {
152
170
  name TEXT NOT NULL,
153
171
  definition TEXT NOT NULL,
154
172
  status TEXT DEFAULT 'draft' NOT NULL,
173
+ run_number INTEGER DEFAULT 0 NOT NULL,
155
174
  created_at INTEGER NOT NULL,
156
175
  updated_at INTEGER NOT NULL,
157
176
  FOREIGN KEY (project_id) REFERENCES projects(id) ON UPDATE NO ACTION ON DELETE NO ACTION
@@ -347,6 +366,8 @@ function bootstrapStagentDatabase(sqlite2) {
347
366
  addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN heartbeat_spent_today INTEGER DEFAULT 0 NOT NULL;`);
348
367
  addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN heartbeat_budget_reset_at INTEGER;`);
349
368
  addColumnIfMissing(`ALTER TABLE tasks ADD COLUMN source_type TEXT;`);
369
+ addColumnIfMissing(`ALTER TABLE workflows ADD COLUMN run_number INTEGER DEFAULT 0 NOT NULL;`);
370
+ addColumnIfMissing(`ALTER TABLE tasks ADD COLUMN workflow_run_number INTEGER;`);
350
371
  addColumnIfMissing(`ALTER TABLE documents ADD COLUMN version INTEGER NOT NULL DEFAULT 1;`);
351
372
  addColumnIfMissing(`ALTER TABLE documents ADD COLUMN source TEXT DEFAULT 'upload';`);
352
373
  addColumnIfMissing(`ALTER TABLE documents ADD COLUMN conversation_id TEXT REFERENCES conversations(id);`);
@@ -619,6 +640,256 @@ function bootstrapStagentDatabase(sqlite2) {
619
640
  CREATE INDEX IF NOT EXISTS idx_agent_messages_to_status ON agent_messages(to_profile_id, status);
620
641
  CREATE INDEX IF NOT EXISTS idx_agent_messages_task ON agent_messages(task_id);
621
642
  `);
643
+ sqlite2.exec(`
644
+ CREATE TABLE IF NOT EXISTS workflow_document_inputs (
645
+ id TEXT PRIMARY KEY NOT NULL,
646
+ workflow_id TEXT NOT NULL,
647
+ document_id TEXT NOT NULL,
648
+ step_id TEXT,
649
+ created_at INTEGER NOT NULL,
650
+ FOREIGN KEY (workflow_id) REFERENCES workflows(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
651
+ FOREIGN KEY (document_id) REFERENCES documents(id) ON UPDATE NO ACTION ON DELETE NO ACTION
652
+ );
653
+
654
+ CREATE INDEX IF NOT EXISTS idx_wdi_workflow ON workflow_document_inputs(workflow_id);
655
+ CREATE INDEX IF NOT EXISTS idx_wdi_document ON workflow_document_inputs(document_id);
656
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_wdi_workflow_doc_step ON workflow_document_inputs(workflow_id, document_id, step_id);
657
+
658
+ CREATE TABLE IF NOT EXISTS schedule_document_inputs (
659
+ id TEXT PRIMARY KEY NOT NULL,
660
+ schedule_id TEXT NOT NULL,
661
+ document_id TEXT NOT NULL,
662
+ created_at INTEGER NOT NULL,
663
+ FOREIGN KEY (schedule_id) REFERENCES schedules(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
664
+ FOREIGN KEY (document_id) REFERENCES documents(id) ON UPDATE NO ACTION ON DELETE NO ACTION
665
+ );
666
+
667
+ CREATE INDEX IF NOT EXISTS idx_sdi_schedule ON schedule_document_inputs(schedule_id);
668
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_sdi_schedule_doc ON schedule_document_inputs(schedule_id, document_id);
669
+
670
+ CREATE TABLE IF NOT EXISTS project_document_defaults (
671
+ id TEXT PRIMARY KEY NOT NULL,
672
+ project_id TEXT NOT NULL,
673
+ document_id TEXT NOT NULL,
674
+ created_at INTEGER NOT NULL,
675
+ FOREIGN KEY (project_id) REFERENCES projects(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
676
+ FOREIGN KEY (document_id) REFERENCES documents(id) ON UPDATE NO ACTION ON DELETE NO ACTION
677
+ );
678
+
679
+ CREATE INDEX IF NOT EXISTS idx_pdd_project ON project_document_defaults(project_id);
680
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_pdd_project_doc ON project_document_defaults(project_id, document_id);
681
+ `);
682
+ sqlite2.exec(`
683
+ CREATE TABLE IF NOT EXISTS user_tables (
684
+ id TEXT PRIMARY KEY NOT NULL,
685
+ project_id TEXT,
686
+ name TEXT NOT NULL,
687
+ description TEXT,
688
+ column_schema TEXT NOT NULL DEFAULT '[]',
689
+ row_count INTEGER DEFAULT 0 NOT NULL,
690
+ source TEXT DEFAULT 'manual' NOT NULL,
691
+ template_id TEXT,
692
+ created_at INTEGER NOT NULL,
693
+ updated_at INTEGER NOT NULL,
694
+ FOREIGN KEY (project_id) REFERENCES projects(id) ON UPDATE NO ACTION ON DELETE NO ACTION
695
+ );
696
+
697
+ CREATE INDEX IF NOT EXISTS idx_user_tables_project_id ON user_tables(project_id);
698
+ CREATE INDEX IF NOT EXISTS idx_user_tables_source ON user_tables(source);
699
+
700
+ CREATE TABLE IF NOT EXISTS user_table_columns (
701
+ id TEXT PRIMARY KEY NOT NULL,
702
+ table_id TEXT NOT NULL,
703
+ name TEXT NOT NULL,
704
+ display_name TEXT NOT NULL,
705
+ data_type TEXT NOT NULL,
706
+ position INTEGER NOT NULL,
707
+ required INTEGER DEFAULT 0 NOT NULL,
708
+ default_value TEXT,
709
+ config TEXT,
710
+ created_at INTEGER NOT NULL,
711
+ updated_at INTEGER NOT NULL,
712
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
713
+ );
714
+
715
+ CREATE INDEX IF NOT EXISTS idx_user_table_columns_table_id ON user_table_columns(table_id);
716
+ CREATE INDEX IF NOT EXISTS idx_user_table_columns_position ON user_table_columns(table_id, position);
717
+
718
+ CREATE TABLE IF NOT EXISTS user_table_rows (
719
+ id TEXT PRIMARY KEY NOT NULL,
720
+ table_id TEXT NOT NULL,
721
+ data TEXT NOT NULL DEFAULT '{}',
722
+ position INTEGER NOT NULL,
723
+ created_by TEXT DEFAULT 'user',
724
+ created_at INTEGER NOT NULL,
725
+ updated_at INTEGER NOT NULL,
726
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
727
+ );
728
+
729
+ CREATE INDEX IF NOT EXISTS idx_user_table_rows_table_id ON user_table_rows(table_id);
730
+ CREATE INDEX IF NOT EXISTS idx_user_table_rows_position ON user_table_rows(table_id, position);
731
+
732
+ CREATE TABLE IF NOT EXISTS user_table_views (
733
+ id TEXT PRIMARY KEY NOT NULL,
734
+ table_id TEXT NOT NULL,
735
+ name TEXT NOT NULL,
736
+ type TEXT DEFAULT 'grid' NOT NULL,
737
+ config TEXT,
738
+ is_default INTEGER DEFAULT 0 NOT NULL,
739
+ created_at INTEGER NOT NULL,
740
+ updated_at INTEGER NOT NULL,
741
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
742
+ );
743
+
744
+ CREATE INDEX IF NOT EXISTS idx_user_table_views_table_id ON user_table_views(table_id);
745
+
746
+ CREATE TABLE IF NOT EXISTS user_table_relationships (
747
+ id TEXT PRIMARY KEY NOT NULL,
748
+ from_table_id TEXT NOT NULL,
749
+ from_column TEXT NOT NULL,
750
+ to_table_id TEXT NOT NULL,
751
+ to_column TEXT NOT NULL,
752
+ relationship_type TEXT NOT NULL,
753
+ config TEXT,
754
+ created_at INTEGER NOT NULL,
755
+ FOREIGN KEY (from_table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
756
+ FOREIGN KEY (to_table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
757
+ );
758
+
759
+ CREATE INDEX IF NOT EXISTS idx_user_table_rels_from ON user_table_relationships(from_table_id);
760
+ CREATE INDEX IF NOT EXISTS idx_user_table_rels_to ON user_table_relationships(to_table_id);
761
+
762
+ CREATE TABLE IF NOT EXISTS user_table_templates (
763
+ id TEXT PRIMARY KEY NOT NULL,
764
+ name TEXT NOT NULL,
765
+ description TEXT,
766
+ category TEXT NOT NULL,
767
+ column_schema TEXT NOT NULL,
768
+ sample_data TEXT,
769
+ scope TEXT DEFAULT 'system' NOT NULL,
770
+ icon TEXT,
771
+ created_at INTEGER NOT NULL,
772
+ updated_at INTEGER NOT NULL
773
+ );
774
+
775
+ CREATE INDEX IF NOT EXISTS idx_user_table_templates_category ON user_table_templates(category);
776
+ CREATE INDEX IF NOT EXISTS idx_user_table_templates_scope ON user_table_templates(scope);
777
+
778
+ CREATE TABLE IF NOT EXISTS user_table_imports (
779
+ id TEXT PRIMARY KEY NOT NULL,
780
+ table_id TEXT NOT NULL,
781
+ document_id TEXT,
782
+ row_count INTEGER DEFAULT 0 NOT NULL,
783
+ error_count INTEGER DEFAULT 0 NOT NULL,
784
+ errors TEXT,
785
+ status TEXT DEFAULT 'pending' NOT NULL,
786
+ created_at INTEGER NOT NULL,
787
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
788
+ FOREIGN KEY (document_id) REFERENCES documents(id) ON UPDATE NO ACTION ON DELETE NO ACTION
789
+ );
790
+
791
+ CREATE INDEX IF NOT EXISTS idx_user_table_imports_table_id ON user_table_imports(table_id);
792
+
793
+ CREATE TABLE IF NOT EXISTS table_document_inputs (
794
+ id TEXT PRIMARY KEY NOT NULL,
795
+ table_id TEXT NOT NULL,
796
+ document_id TEXT NOT NULL,
797
+ created_at INTEGER NOT NULL,
798
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
799
+ FOREIGN KEY (document_id) REFERENCES documents(id) ON UPDATE NO ACTION ON DELETE NO ACTION
800
+ );
801
+
802
+ CREATE INDEX IF NOT EXISTS idx_tdi_table ON table_document_inputs(table_id);
803
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_tdi_table_doc ON table_document_inputs(table_id, document_id);
804
+
805
+ CREATE TABLE IF NOT EXISTS task_table_inputs (
806
+ id TEXT PRIMARY KEY NOT NULL,
807
+ task_id TEXT NOT NULL,
808
+ table_id TEXT NOT NULL,
809
+ created_at INTEGER NOT NULL,
810
+ FOREIGN KEY (task_id) REFERENCES tasks(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
811
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
812
+ );
813
+
814
+ CREATE INDEX IF NOT EXISTS idx_tti_task ON task_table_inputs(task_id);
815
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_tti_task_table ON task_table_inputs(task_id, table_id);
816
+
817
+ CREATE TABLE IF NOT EXISTS workflow_table_inputs (
818
+ id TEXT PRIMARY KEY NOT NULL,
819
+ workflow_id TEXT NOT NULL,
820
+ table_id TEXT NOT NULL,
821
+ step_id TEXT,
822
+ created_at INTEGER NOT NULL,
823
+ FOREIGN KEY (workflow_id) REFERENCES workflows(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
824
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
825
+ );
826
+
827
+ CREATE INDEX IF NOT EXISTS idx_wti_workflow ON workflow_table_inputs(workflow_id);
828
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_wti_workflow_table_step ON workflow_table_inputs(workflow_id, table_id, step_id);
829
+
830
+ CREATE TABLE IF NOT EXISTS schedule_table_inputs (
831
+ id TEXT PRIMARY KEY NOT NULL,
832
+ schedule_id TEXT NOT NULL,
833
+ table_id TEXT NOT NULL,
834
+ created_at INTEGER NOT NULL,
835
+ FOREIGN KEY (schedule_id) REFERENCES schedules(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
836
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
837
+ );
838
+
839
+ CREATE INDEX IF NOT EXISTS idx_sti_schedule ON schedule_table_inputs(schedule_id);
840
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_sti_schedule_table ON schedule_table_inputs(schedule_id, table_id);
841
+
842
+ CREATE TABLE IF NOT EXISTS user_table_triggers (
843
+ id TEXT PRIMARY KEY NOT NULL,
844
+ table_id TEXT NOT NULL,
845
+ name TEXT NOT NULL,
846
+ trigger_event TEXT NOT NULL,
847
+ condition TEXT,
848
+ action_type TEXT NOT NULL,
849
+ action_config TEXT NOT NULL,
850
+ status TEXT DEFAULT 'active' NOT NULL,
851
+ fire_count INTEGER DEFAULT 0 NOT NULL,
852
+ last_fired_at INTEGER,
853
+ created_at INTEGER NOT NULL,
854
+ updated_at INTEGER NOT NULL,
855
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
856
+ );
857
+
858
+ CREATE INDEX IF NOT EXISTS idx_user_table_triggers_table_id ON user_table_triggers(table_id);
859
+ CREATE INDEX IF NOT EXISTS idx_user_table_triggers_status ON user_table_triggers(status);
860
+
861
+ CREATE TABLE IF NOT EXISTS user_table_row_history (
862
+ id TEXT PRIMARY KEY NOT NULL,
863
+ row_id TEXT NOT NULL,
864
+ table_id TEXT NOT NULL,
865
+ previous_data TEXT NOT NULL,
866
+ changed_by TEXT DEFAULT 'user',
867
+ change_type TEXT NOT NULL,
868
+ created_at INTEGER NOT NULL,
869
+ FOREIGN KEY (table_id) REFERENCES user_tables(id) ON UPDATE NO ACTION ON DELETE NO ACTION
870
+ );
871
+
872
+ CREATE INDEX IF NOT EXISTS idx_row_history_row_id ON user_table_row_history(row_id);
873
+ CREATE INDEX IF NOT EXISTS idx_row_history_table_id ON user_table_row_history(table_id);
874
+ CREATE INDEX IF NOT EXISTS idx_row_history_created_at ON user_table_row_history(created_at);
875
+
876
+ CREATE TABLE IF NOT EXISTS snapshots (
877
+ id TEXT PRIMARY KEY NOT NULL,
878
+ label TEXT NOT NULL,
879
+ type TEXT DEFAULT 'manual' NOT NULL,
880
+ status TEXT DEFAULT 'in_progress' NOT NULL,
881
+ file_path TEXT NOT NULL,
882
+ size_bytes INTEGER DEFAULT 0 NOT NULL,
883
+ db_size_bytes INTEGER DEFAULT 0 NOT NULL,
884
+ files_size_bytes INTEGER DEFAULT 0 NOT NULL,
885
+ file_count INTEGER DEFAULT 0 NOT NULL,
886
+ error TEXT,
887
+ created_at INTEGER NOT NULL
888
+ );
889
+
890
+ CREATE INDEX IF NOT EXISTS idx_snapshots_type ON snapshots(type);
891
+ CREATE INDEX IF NOT EXISTS idx_snapshots_created_at ON snapshots(created_at);
892
+ `);
622
893
  }
623
894
  function hasLegacyStagentTables(sqlite2) {
624
895
  const placeholders = STAGENT_TABLES.map(() => "?").join(", ");
@@ -1,21 +1,71 @@
1
1
  {
2
- "generated": "2026-03-31T21:00:00Z",
3
- "totalFeatures": 31,
4
- "coveredFeatures": 28,
5
- "uncoveredFeatures": 3,
6
- "coveragePercent": 90.3,
7
- "gaps": {
8
- "book-content-merge": {
9
- "availableScreenshots": ["book-reader.png"],
10
- "note": "Book reader screenshot exists but not referenced in any journey doc"
2
+ "generated": "2026-04-03T23:30:00Z",
3
+ "summary": {
4
+ "totalFeatures": 82,
5
+ "coveredFeatures": 78,
6
+ "gapCount": 4,
7
+ "unusedScreenshotCount": 0,
8
+ "brokenReferences": 0,
9
+ "orphanedImages": 14
10
+ },
11
+ "gaps": [
12
+ {
13
+ "feature": "book-content-merge",
14
+ "category": "Living Book",
15
+ "screenshots": ["book-list.png"],
16
+ "journeyCoverage": [],
17
+ "suggestedPersona": "personal",
18
+ "note": "Book reader captured but not referenced in any journey"
11
19
  },
12
- "book-reading-paths": {
13
- "availableScreenshots": ["book-reader.png", "book-chapter-nav.png"],
14
- "note": "Book navigation screenshots exist but not referenced in any journey doc"
20
+ {
21
+ "feature": "book-reading-paths",
22
+ "category": "Living Book",
23
+ "screenshots": ["book-list.png"],
24
+ "journeyCoverage": [],
25
+ "suggestedPersona": "personal",
26
+ "note": "Book navigation not in any journey"
15
27
  },
16
- "browser-tool-orchestration": {
17
- "availableScreenshots": ["settings-browser-tools.png"],
18
- "note": "Browser tools settings screenshot exists but not referenced in any journey doc"
28
+ {
29
+ "feature": "tables-document-import",
30
+ "category": "Structured Data",
31
+ "screenshots": [],
32
+ "journeyCoverage": ["work-use"],
33
+ "suggestedPersona": "work",
34
+ "note": "Import wizard not captured (no dedicated screenshot) but tables mentioned in Work journey"
35
+ },
36
+ {
37
+ "feature": "database-snapshot-backup",
38
+ "category": "Platform",
39
+ "screenshots": ["settings-snapshots.png"],
40
+ "journeyCoverage": [],
41
+ "suggestedPersona": "developer",
42
+ "note": "New feature - settings snapshot card captured, not yet in any journey"
19
43
  }
20
- }
44
+ ],
45
+ "brokenReferences": [
46
+ { "file": "developer.md", "screenshot": "settings-ollama-connected.png", "status": "STALE", "note": "Old screenshot in public/readme/, not in current screengrabs/" },
47
+ { "file": "developer.md", "screenshot": "settings-channels-add-form.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
48
+ { "file": "developer.md", "screenshot": "settings-channels-telegram-form.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
49
+ { "file": "developer.md", "screenshot": "settings-channels-webhook-form.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
50
+ { "file": "developer.md", "screenshot": "chat-conversation.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
51
+ { "file": "developer.md", "screenshot": "schedules-detail.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
52
+ { "file": "personal-use.md", "screenshot": "dashboard-card-detail.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
53
+ { "file": "personal-use.md", "screenshot": "settings-channels.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
54
+ { "file": "power-user.md", "screenshot": "settings-ollama-connected.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
55
+ { "file": "power-user.md", "screenshot": "chat-model-selector.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
56
+ { "file": "power-user.md", "screenshot": "schedules-detail.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
57
+ { "file": "power-user.md", "screenshot": "chat-create-tab.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
58
+ { "file": "work-use.md", "screenshot": "chat-conversation.png", "status": "STALE", "note": "Old screenshot in public/readme/" },
59
+ { "file": "work-use.md", "screenshot": "settings-channels.png", "status": "STALE", "note": "Old screenshot in public/readme/" }
60
+ ],
61
+ "orphanedImages": [
62
+ "book-chapter-header.png", "book-chapter-nav.png", "book-reader.png",
63
+ "book-settings.png", "book-toc.png", "book-try-it-now.png",
64
+ "chat-conversation.png", "chat-create-tab.png", "chat-model-selector.png",
65
+ "chat-quick-access.png", "dashboard-card-detail.png", "playbook-list.png",
66
+ "schedules-detail.png", "schedules-edit-form.png", "settings-browser-tools.png",
67
+ "settings-channels-add-form.png", "settings-channels-telegram-form.png",
68
+ "settings-channels-webhook-form.png", "settings-channels.png",
69
+ "settings-ollama-connected.png"
70
+ ]
21
71
  }
@@ -1 +1 @@
1
- 2026-04-01T05:15:01Z
1
+ 2026-04-03T23:43:05Z
@@ -5,31 +5,37 @@ section: "dashboard-kanban"
5
5
  route: "/dashboard"
6
6
  tags: [tasks, kanban, board, table, filter, create, ai-assist, drag-and-drop, bulk-operations, heartbeat]
7
7
  features: ["task-board", "kanban-board-operations", "micro-visualizations", "task-definition-ai", "detail-view-redesign", "ui-density-refinement", "heartbeat-scheduler"]
8
- screengrabCount: 5
9
- lastUpdated: "2026-03-31"
8
+ screengrabCount: 7
9
+ lastUpdated: "2026-04-03"
10
10
  ---
11
11
 
12
12
  # Dashboard Kanban
13
13
 
14
- The Dashboard is your primary task management surface. It presents all tasks as a Kanban board with drag-and-drop columns, or as a sortable table -- whichever fits your workflow. A powerful filter bar, AI-assisted task creation, bulk operations, and inline editing let you manage agent work without switching context.
14
+ The Dashboard is your primary task management surface. It presents all tasks as a Kanban board with drag-and-drop columns, or as a sortable table -- whichever fits your workflow. A powerful filter bar, AI-assisted task creation, bulk operations, and inline editing let you manage agent work without switching context. The default seed data populates the board with business-relevant tasks across three personas -- product launch, content engine, and customer success -- giving you a realistic starting point to explore the interface.
15
15
 
16
16
  ## Screenshots
17
17
 
18
18
  ![Dashboard board view](../screengrabs/dashboard-list.png)
19
- *Kanban board with columns for Planned, Queued, Running, Completed, and Failed tasks*
19
+ *Kanban board with columns for Planned, Queued, Running, Completed, and Failed tasks showing business-relevant tasks across product launch, content engine, and customer success personas*
20
+
21
+ ![Dashboard below the fold](../screengrabs/dashboard-below-fold.png)
22
+ *Below-the-fold view of the kanban board with additional task cards and columns*
20
23
 
21
24
  ![Dashboard table view](../screengrabs/dashboard-table.png)
22
25
  *Table view with sortable columns for title, status, priority, project, and timestamps*
23
26
 
24
- ![Task detail sheet](../screengrabs/dashboard-card-detail.png)
25
- *Task detail sheet showing task properties, description, and execution history*
26
-
27
27
  ![Task edit dialog](../screengrabs/dashboard-card-edit.png)
28
28
  *Task edit dialog for updating task details from the kanban board*
29
29
 
30
30
  ![Bulk select mode](../screengrabs/dashboard-bulk-select.png)
31
31
  *Kanban board in select mode with checked cards and bulk action toolbar*
32
32
 
33
+ ![Create task form empty](../screengrabs/dashboard-create-form-empty.png)
34
+ *Empty task creation form with fields for title, description, project, priority, runtime, and agent profile*
35
+
36
+ ![Create task form filled](../screengrabs/dashboard-create-form-filled.png)
37
+ *Task creation form filled with business-relevant task details and AI-assisted description*
38
+
33
39
  ## Key Features
34
40
 
35
41
  ### Kanban Board
@@ -4,9 +4,9 @@ category: "feature-reference"
4
4
  section: "settings"
5
5
  route: "/settings"
6
6
  tags: ["settings", "configuration", "auth", "runtime", "browser-tools", "permissions", "budget", "ollama", "channels"]
7
- features: ["session-management", "tool-permission-persistence", "tool-permission-presets", "browser-use", "spend-budget-guardrails", "settings-interactive-controls", "ollama-runtime-provider", "multi-channel-delivery", "bidirectional-channel-chat"]
8
- screengrabCount: 9
9
- lastUpdated: "2026-03-31"
7
+ features: ["session-management", "tool-permission-persistence", "tool-permission-presets", "browser-use", "spend-budget-guardrails", "settings-interactive-controls", "ollama-runtime-provider", "multi-channel-delivery", "bidirectional-channel-chat", "database-snapshot-backup"]
8
+ screengrabCount: 10
9
+ lastUpdated: "2026-04-03"
10
10
  ---
11
11
 
12
12
  # Settings
@@ -42,6 +42,9 @@ The Settings page is the central configuration hub for Stagent. From a single sc
42
42
  ![Data management section with clear and populate options](../screengrabs/settings-data.png)
43
43
  *Data Management section for resetting or populating workspace data.*
44
44
 
45
+ ![Database Snapshots settings](../screengrabs/settings-snapshots.png)
46
+ *Database Snapshots section with automatic backup configuration, retention settings, and snapshot list with restore/delete actions.*
47
+
45
48
  ## Key Features
46
49
 
47
50
  ### Authentication
@@ -122,6 +125,15 @@ Two operations for managing workspace content:
122
125
  - **Clear Data** -- removes tasks, logs, documents, schedules, and other workspace content. Settings and permissions are preserved.
123
126
  - **Populate Sample Data** -- seeds the workspace with example projects, tasks, and documents.
124
127
 
128
+ ### Database Snapshots
129
+
130
+ Protect your workspace with automatic and manual database backups:
131
+
132
+ - **Automatic backup** -- enable scheduled backups with a configurable cron interval (e.g., every 6 hours, daily). Snapshots are created in the background without interrupting your workflow.
133
+ - **Retention settings** -- control how many snapshots to keep with a maximum count and a maximum age in weeks. Older snapshots beyond the retention limits are pruned automatically.
134
+ - **Snapshot list** -- view all existing snapshots with timestamps and sizes. Each snapshot has **Restore** and **Delete** action buttons for quick management.
135
+ - **Pre-restore safety snapshot** -- before restoring an older snapshot, Stagent automatically creates a safety snapshot of the current database state so you can roll back if needed.
136
+
125
137
  ## How To
126
138
 
127
139
  ### Connect Ollama for Local Models