stagent 0.1.9 → 0.1.10

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 (44) hide show
  1. package/README.md +129 -47
  2. package/package.json +1 -1
  3. package/public/readme/cost-usage-list.png +0 -0
  4. package/public/readme/dashboard-bulk-select.png +0 -0
  5. package/public/readme/dashboard-card-edit.png +0 -0
  6. package/public/readme/dashboard-create-form-ai-applied.png +0 -0
  7. package/public/readme/dashboard-create-form-ai-assist.png +0 -0
  8. package/public/readme/dashboard-create-form-empty.png +0 -0
  9. package/public/readme/dashboard-create-form-filled.png +0 -0
  10. package/public/readme/dashboard-filtered.png +0 -0
  11. package/public/readme/dashboard-list.png +0 -0
  12. package/public/readme/dashboard-sorted.png +0 -0
  13. package/public/readme/dashboard-workflow-confirm.png +0 -0
  14. package/public/readme/documents-grid.png +0 -0
  15. package/public/readme/documents-list.png +0 -0
  16. package/public/readme/home-below-fold.png +0 -0
  17. package/public/readme/home-list.png +0 -0
  18. package/public/readme/inbox-list.png +0 -0
  19. package/public/readme/monitor-list.png +0 -0
  20. package/public/readme/profiles-list.png +0 -0
  21. package/public/readme/projects-detail.png +0 -0
  22. package/public/readme/projects-list.png +0 -0
  23. package/public/readme/schedules-list.png +0 -0
  24. package/public/readme/settings-list.png +0 -0
  25. package/public/readme/workflows-list.png +0 -0
  26. package/src/app/api/workflows/from-assist/route.ts +143 -0
  27. package/src/app/dashboard/page.tsx +24 -2
  28. package/src/app/workflows/from-assist/page.tsx +35 -0
  29. package/src/components/projects/project-card.tsx +47 -35
  30. package/src/components/tasks/ai-assist-panel.tsx +31 -10
  31. package/src/components/tasks/task-card.tsx +16 -1
  32. package/src/components/tasks/task-create-panel.tsx +39 -0
  33. package/src/components/workflows/workflow-confirmation-view.tsx +447 -0
  34. package/src/lib/agents/profiles/__tests__/suggest.test.ts +67 -0
  35. package/src/lib/agents/profiles/suggest.ts +36 -0
  36. package/src/lib/agents/runtime/claude.ts +36 -6
  37. package/src/lib/agents/runtime/task-assist-types.ts +12 -2
  38. package/src/lib/data/__tests__/clear.test.ts +42 -0
  39. package/src/lib/data/clear.ts +3 -0
  40. package/src/lib/notifications/permissions.ts +6 -2
  41. package/src/lib/workflows/__tests__/assist-builder.test.ts +255 -0
  42. package/src/lib/workflows/assist-builder.ts +248 -0
  43. package/src/lib/workflows/assist-session.ts +78 -0
  44. package/src/lib/workflows/engine.ts +46 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ Open [localhost:3000](http://localhost:3000).
14
14
 
15
15
  **Profiles & Policies** · **Blueprints & Schedules** · **Open Source**
16
16
 
17
- <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/home-workspace.png" alt="Stagent home workspace" width="1200" />
17
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/home-list.png" alt="Stagent home workspace" width="1200" />
18
18
 
19
19
  | Home Workspace | Reusable Profiles | Workflow Blueprints | Governed Execution |
20
20
  |:-:|:-:|:-:|:-:|
@@ -53,6 +53,8 @@ Stagent ships a shared runtime registry that routes tasks, schedules, and workfl
53
53
  | 💸 | **[Cost & Usage](#cost--usage)** | Provider-aware metering, budgets, and spend visibility for governed runs |
54
54
  | 🚨 | **[Ambient Approvals](#ambient-approvals)** | Shell-level approval prompts that keep Inbox as the durable supervision queue |
55
55
  | 🔒 | **[Tool Permissions](#tool-permission-persistence)** | Trusted-tool policies with explicit "Always Allow" rules |
56
+ | 📋 | **[Kanban Board](#kanban-board-operations)** | Inline editing, bulk operations, and persistent board state |
57
+ | 🤖 | **[AI Assist → Workflows](#ai-assist--workflow-creation)** | Bridge task assist recommendations into governed workflow execution *(in progress)* |
56
58
 
57
59
  ---
58
60
 
@@ -82,9 +84,19 @@ Workspace-level briefing with active work, pending review, failed items, project
82
84
  #### Task Execution
83
85
  Status-driven execution board with five columns: Planned → Queued → Running → Completed → Failed. Filter across projects, create tasks inline, and open task detail to inspect status, description, and runtime state without leaving the board.
84
86
 
87
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/dashboard-list.png" alt="Stagent kanban board" width="1200" />
88
+
89
+ | Filtered by Project | Inline Card Editing | Bulk Select Mode |
90
+ |:-:|:-:|:-:|
91
+ | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/dashboard-filtered.png" alt="Dashboard filtered by project" width="380" /> | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/dashboard-card-edit.png" alt="Inline task editing dialog" width="380" /> | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/dashboard-bulk-select.png" alt="Bulk select mode with actions" width="380" /> |
92
+
85
93
  #### Projects
86
94
  Create and organize projects as containers for related tasks. Each project can specify a working directory — agent tasks resolve `cwd` from the project's path, enabling agents to operate on external codebases. Server-rendered project cards with task counts, status badges, and a detail view at `/projects/[id]`.
87
95
 
96
+ | Project Cards | Project Detail |
97
+ |:-:|:-:|
98
+ | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/projects-list.png" alt="Project cards overview" width="580" /> | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/projects-detail.png" alt="Project detail view" width="580" /> |
99
+
88
100
  ### Agent
89
101
 
90
102
  #### Provider Runtimes
@@ -103,11 +115,16 @@ OpenAI Codex App Server is integrated as Stagent's second governed runtime. Code
103
115
  #### Agent Profiles
104
116
  Profile-backed execution with specialist definitions for different job types. Each profile packages instructions, allowed tools, runtime tuning, and MCP server configuration so teams can reuse behavior intentionally instead of relying on ad hoc prompts. Workflow steps and schedules can reference profiles directly, and runtimes can be selected independently when provider support differs.
105
117
 
118
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/profiles-list.png" alt="Stagent agent profiles" width="1200" />
119
+
106
120
  #### Workflows
107
- Multi-step task orchestration with three patterns:
121
+ Multi-step task orchestration with six patterns:
108
122
  - **Sequence** — Steps execute in order
109
123
  - **Planner→Executor** — One agent plans, another executes each step
110
124
  - **Human-in-the-Loop Checkpoint** — Pauses for human approval between steps
125
+ - **Parallel** — Concurrent branch execution with fork/join synthesis
126
+ - **Loop** — Iterative agent execution with configurable stop conditions
127
+ - **Swarm** — Mayor/workers/refinery multi-agent orchestration
111
128
 
112
129
  State machine engine with step-level retry, project association, and real-time status visualization.
113
130
 
@@ -121,6 +138,15 @@ Both patterns preserve the same governed task model, runtime selection, monitori
121
138
  #### AI Task Assist
122
139
  AI-powered task creation: generate improved descriptions, break tasks into sub-tasks, recommend workflow patterns, and estimate complexity through the shared runtime task-assist layer. Claude and OpenAI task assist now both route through the provider runtime abstraction.
123
140
 
141
+ | Task Creation Form | AI Suggestions | AI Applied |
142
+ |:-:|:-:|:-:|
143
+ | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/dashboard-create-form-empty.png" alt="Empty task creation form" width="380" /> | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/dashboard-create-form-ai-assist.png" alt="AI Assist suggestions panel" width="380" /> | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/dashboard-create-form-ai-applied.png" alt="AI suggestions applied to form" width="380" /> |
144
+
145
+ #### AI Assist → Workflow Creation
146
+ *(In progress)* Bridge from AI task assist to workflow engine: when task assist recommends a multi-step plan, a "Create as Workflow" button converts the recommendation into a validated workflow definition with per-step profile assignments, dependency ordering, and pattern selection across all six workflow types. The `WorkflowConfirmationSheet` lets operators review and edit steps, profiles, and configuration before creating the workflow. A keyword-based profile suggestion fallback ensures steps get reasonable profile assignments even without the AI classifier.
147
+
148
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/dashboard-workflow-confirm.png" alt="Workflow creation from AI Assist" width="1200" />
149
+
124
150
  #### Session Management
125
151
  Resume failed or cancelled agent tasks with one click. Tracks retry counts (limit: 3), detects expired sessions, and provides atomic claim to prevent duplicate runs.
126
152
 
@@ -133,13 +159,17 @@ Curated agent profiles across work and personal domains, built as portable Claud
133
159
  #### Workflow Blueprints
134
160
  Pre-configured workflow templates across work and personal domains. Browse blueprints in a gallery with filtering and search, preview steps and required variables, fill in a dynamic form, and create draft workflows with resolved prompts and profile assignments. Create custom blueprints via YAML or import from GitHub URLs. Lineage tracking connects workflows back to their source blueprint.
135
161
 
136
- <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/workflow-blueprints.png" alt="Stagent workflow blueprint gallery" width="1200" />
162
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/workflows-list.png" alt="Stagent workflow management" width="1200" />
137
163
 
138
164
  ### Documents
139
165
 
140
166
  #### Document Management
141
167
  Full document browser at `/documents` with table and grid views. Upload files with drag-and-drop, preview images/PDFs/markdown/code inline, search by filename and extracted text, and filter by processing status or project. Bulk delete, link/unlink to projects and tasks.
142
168
 
169
+ | Table View | Grid View |
170
+ |:-:|:-:|
171
+ | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/documents-list.png" alt="Documents table view" width="580" /> | <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/documents-grid.png" alt="Documents grid view" width="580" /> |
172
+
143
173
  #### Document Preprocessing
144
174
  Automatic text extraction on upload for five file types: text, PDF (pdf-parse), images (image-size), Office documents (mammoth/jszip), and spreadsheets (xlsx). Extracted text, processed paths, and processing errors are tracked per document.
145
175
 
@@ -157,22 +187,28 @@ Pending permission requests now surface through a shell-level approval presenter
157
187
  #### Schedules
158
188
  Time-based scheduling for agent tasks with human-friendly intervals (`5m`, `2h`, `1d`) and raw 5-field cron expressions. One-shot and recurring modes with pause/resume lifecycle, expiry limits, and max firings. Each firing creates a child task through the shared execution pipeline, and schedules can now target a runtime explicitly. Scheduler runs as a poll-based engine started via Next.js instrumentation hook.
159
189
 
190
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/schedules-list.png" alt="Stagent schedules" width="1200" />
191
+
160
192
  #### Micro-Visualizations
161
193
  Pure SVG chart primitives (Sparkline, MiniBar, DonutRing) with zero charting dependencies. Integrated into: homepage stats cards (7-day trends), activity feed (24h bar chart), project cards (completion donuts), monitor overview (success rate), and project detail (stacked status + 14-day sparkline). Full accessibility with `role="img"` and `aria-label`.
162
194
 
163
195
  #### Cost & Usage
164
196
  Provider-normalized metering tracks token and spend activity across tasks, resumes, workflow child tasks, schedules, task assist, and profile tests. The dedicated `Cost & Usage` surface adds summary cards, trend views, provider/model breakdowns, and budget-aware audit visibility on top of the usage ledger.
165
197
 
198
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/cost-usage-list.png" alt="Stagent cost and usage dashboard" width="1200" />
199
+
166
200
  ### UI & DevEx
167
201
 
168
202
  #### Inbox & Human-in-the-Loop
169
203
  When an agent needs approval or input, a notification appears in your inbox. Review tool permission requests with "Allow Once" / "Always Allow" / "Deny" buttons, answer agent questions, and see task completion summaries. Supports bulk dismiss and 10s polling.
170
204
 
171
- <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/inbox-approvals.png" alt="Stagent inbox approval flow" width="1200" />
205
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/inbox-list.png" alt="Stagent inbox approval flow" width="1200" />
172
206
 
173
207
  #### Monitoring
174
208
  Real-time agent log streaming via Server-Sent Events. Filter by task or event type, click entries to jump to task details, and auto-pause polling when the tab is hidden (Page Visibility API).
175
209
 
210
+ <img src="https://raw.githubusercontent.com/navam-io/stagent/main/public/readme/monitor-list.png" alt="Stagent monitoring dashboard" width="1200" />
211
+
176
212
  #### Content Handling
177
213
  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.
178
214
 
@@ -254,34 +290,58 @@ src/
254
290
  └── utils/ # Shared helpers
255
291
  ```
256
292
 
257
- ### API Endpoints
258
-
259
- | Endpoint | Method | Purpose |
260
- |----------|--------|---------|
261
- | `/api/projects/[id]` | GET/PUT/DELETE | Project CRUD |
262
- | `/api/tasks/[id]/execute` | POST | Fire-and-forget task dispatch (202) |
263
- | `/api/tasks/[id]/resume` | POST | Resume failed/cancelled task |
264
- | `/api/tasks/[id]/respond` | POST | Human response to agent prompt |
265
- | `/api/tasks/[id]/logs` | GET | Task log history |
266
- | `/api/logs/stream` | GET | SSE agent log stream |
267
- | `/api/notifications` | GET/POST | Notification management |
268
- | `/api/workflows` | POST | Create workflow |
269
- | `/api/workflows/[id]/execute` | POST | Execute workflow |
270
- | `/api/documents` | GET | List documents with joins |
271
- | `/api/documents/[id]` | PATCH/DELETE | Document metadata + deletion |
272
- | `/api/uploads` | POST | File upload |
273
- | `/api/schedules` | GET/POST | Schedule CRUD |
274
- | `/api/schedules/[id]` | GET/PATCH/DELETE | Schedule detail + updates |
275
- | `/api/permissions` | GET/POST/DELETE | Tool permission patterns |
276
- | `/api/settings/openai` | GET/POST | OpenAI Codex runtime settings |
277
- | `/api/settings/test` | POST | Provider-aware runtime connectivity test |
278
- | `/api/profiles` | GET | List agent profiles |
279
- | `/api/profiles/[id]/test` | POST | Run behavioral tests on a profile |
280
- | `/api/profiles/import` | POST | Import profile from GitHub URL |
281
- | `/api/blueprints` | GET/POST | List and create blueprints |
282
- | `/api/blueprints/[id]` | GET/DELETE | Blueprint detail and deletion |
283
- | `/api/blueprints/[id]/instantiate` | POST | Create workflow from blueprint |
284
- | `/api/blueprints/import` | POST | Import blueprint from GitHub URL |
293
+ ### API Endpoints (48 routes)
294
+
295
+ | Domain | Endpoint | Method | Purpose |
296
+ |--------|----------|--------|---------|
297
+ | **Projects** | `/api/projects` | GET/POST | List and create projects |
298
+ | | `/api/projects/[id]` | GET/PUT/DELETE | Project CRUD |
299
+ | **Tasks** | `/api/tasks` | GET/POST | List and create tasks |
300
+ | | `/api/tasks/[id]` | GET/PATCH/DELETE | Task detail, update, delete |
301
+ | | `/api/tasks/[id]/execute` | POST | Fire-and-forget task dispatch (202) |
302
+ | | `/api/tasks/[id]/resume` | POST | Resume failed/cancelled task |
303
+ | | `/api/tasks/[id]/cancel` | POST | Cancel running task |
304
+ | | `/api/tasks/[id]/respond` | POST | Human response to agent prompt |
305
+ | | `/api/tasks/[id]/output` | GET | Task execution output |
306
+ | | `/api/tasks/[id]/logs` | GET | Task log history |
307
+ | | `/api/tasks/assist` | POST | AI task assist (description, subtasks, workflow recommendation) |
308
+ | **Workflows** | `/api/workflows` | GET/POST | List and create workflows |
309
+ | | `/api/workflows/[id]` | GET/PATCH/DELETE | Workflow detail, update, delete |
310
+ | | `/api/workflows/[id]/execute` | POST | Execute workflow |
311
+ | | `/api/workflows/[id]/status` | GET | Workflow execution status |
312
+ | | `/api/workflows/[id]/steps/[stepId]/retry` | POST | Retry failed workflow step |
313
+ | | `/api/workflows/from-assist` | POST | Create workflow from AI assist recommendation |
314
+ | **Blueprints** | `/api/blueprints` | GET/POST | List and create blueprints |
315
+ | | `/api/blueprints/[id]` | GET/DELETE | Blueprint detail and deletion |
316
+ | | `/api/blueprints/[id]/instantiate` | POST | Create workflow from blueprint |
317
+ | | `/api/blueprints/import` | POST | Import blueprint from GitHub URL |
318
+ | **Documents** | `/api/documents` | GET | List documents with joins |
319
+ | | `/api/documents/[id]` | GET/PATCH/DELETE | Document detail, metadata, deletion |
320
+ | | `/api/documents/[id]/file` | GET | Download document file |
321
+ | **Uploads** | `/api/uploads` | POST | File upload |
322
+ | | `/api/uploads/[id]` | GET/DELETE | Upload detail and deletion |
323
+ | | `/api/uploads/cleanup` | POST | Clean up orphaned uploads |
324
+ | **Profiles** | `/api/profiles` | GET | List agent profiles |
325
+ | | `/api/profiles/[id]` | GET/PUT/DELETE | Profile CRUD |
326
+ | | `/api/profiles/[id]/test` | POST | Run behavioral tests on a profile |
327
+ | | `/api/profiles/[id]/context` | GET | Profile context for agent execution |
328
+ | | `/api/profiles/import` | POST | Import profile from GitHub URL |
329
+ | **Notifications** | `/api/notifications` | GET/POST | List and create notifications |
330
+ | | `/api/notifications/[id]` | PATCH/DELETE | Update and delete notification |
331
+ | | `/api/notifications/mark-all-read` | POST | Mark all notifications as read |
332
+ | | `/api/notifications/pending-approvals` | GET | Pending approval notifications |
333
+ | | `/api/notifications/pending-approvals/stream` | GET | SSE stream for pending approvals |
334
+ | **Schedules** | `/api/schedules` | GET/POST | Schedule CRUD |
335
+ | | `/api/schedules/[id]` | GET/PATCH/DELETE | Schedule detail + updates |
336
+ | **Settings** | `/api/settings` | GET/POST | General settings |
337
+ | | `/api/settings/openai` | GET/POST | OpenAI Codex runtime settings |
338
+ | | `/api/settings/test` | POST | Provider-aware runtime connectivity test |
339
+ | | `/api/settings/budgets` | GET/POST | Budget configuration |
340
+ | | `/api/permissions` | GET/POST/DELETE | Tool permission patterns |
341
+ | **Monitoring** | `/api/logs/stream` | GET | SSE agent log stream |
342
+ | **Platform** | `/api/command-palette/recent` | GET | Recent command palette items |
343
+ | | `/api/data/clear` | POST | Clear all data |
344
+ | | `/api/data/seed` | POST | Seed sample data |
285
345
 
286
346
  ---
287
347
 
@@ -297,29 +357,51 @@ All 14 features shipped across three layers:
297
357
  | **Core** | Project management, task board, agent integration, inbox notifications, monitoring dashboard |
298
358
  | **Polish** | Homepage dashboard, UX fixes, workflow engine, AI task assist, content handling, session management |
299
359
 
300
- ### Post-MVP — Complete
360
+ ### Post-MVP — Complete (25 features)
361
+
362
+ | Category | Feature | What shipped |
363
+ |----------|---------|-------------|
364
+ | **Documents** | File Attachments | Upload data layer with project/task linking |
365
+ | | Document Preprocessing | Text extraction for 5 formats (text, PDF, images, Office, spreadsheets) |
366
+ | | Agent Document Context | Automatic document injection into agent prompts |
367
+ | | Document Browser | Table/grid views, search, filters, bulk operations at `/documents` |
368
+ | | Document Output Generation | Agent-generated documents as deliverables |
369
+ | **Agent Intelligence** | Multi-Agent Routing | Profile registry (4 profiles), task classifier, per-step profile assignment |
370
+ | | Autonomous Loop Execution | 4 stop conditions, iteration context chaining, pause/resume, loop status view |
371
+ | | Multi-Agent Swarm | Mayor → worker pool → refinery orchestration with retryable stages |
372
+ | **Agent Profiles** | Agent Profile Catalog | 13 domain-specific profiles, GitHub import, behavioral testing, MCP passthrough |
373
+ | | Workflow Blueprints | 8 templates, gallery, YAML editor, dynamic forms, GitHub import, lineage tracking |
374
+ | **UI Enhancement** | Ambient Approvals | Shell-level approval presenter on any route for fast supervision |
375
+ | | Micro-Visualizations | Sparklines, mini bars, donut rings — zero-dependency SVG charts |
376
+ | | Command Palette | ⌘K palette with navigation, create actions, recent items, theme toggle |
377
+ | | Operational Surface | Cross-route composition with consistent layout, density, and interaction patterns |
378
+ | | Profile Surface | Profile gallery stability, detail views, and behavioral testing UI |
379
+ | | Accessibility | ARIA labels, keyboard navigation, focus management, screen reader support |
380
+ | | UI Density Refinement | Tightened spacing, typography, and visual hierarchy across all routes |
381
+ | | Kanban Board Operations | Inline editing, bulk operations, card animations, edit dialog |
382
+ | | Board Context Persistence | Persisted filters, sort order, and project selection across sessions |
383
+ | **Platform** | Scheduled Prompt Loops | Cron + human-friendly intervals, one-shot/recurring, pause/resume lifecycle |
384
+ | | Tool Permission Persistence | "Always Allow" patterns, pre-check bypass, Settings management |
385
+ | | Provider Runtimes | Shared runtime registry with Claude Code and OpenAI Codex App Server adapters |
386
+ | | OpenAI Codex Runtime | Codex App Server integration with inbox approvals, logs, and thread resumption |
387
+ | | npm Publish Readiness | `npx stagent` distribution channel with CLI bundling and package config |
388
+ | | Cross-Provider Profiles | Profile compatibility layer ensuring profiles work across Claude and Codex runtimes |
389
+ | | Parallel Fork/Join | 2-5 concurrent research branches with synthesis step |
390
+ | **Governance** | Usage Metering Ledger | Provider-normalized token and spend tracking across all execution paths |
391
+ | | Spend Budget Guardrails | Per-project and global budgets with enforcement and alerts |
392
+ | | Cost & Usage Dashboard | Summary cards, trend views, provider/model breakdowns, budget audit visibility |
393
+
394
+ ### In Progress
301
395
 
302
- | Feature | What shipped |
396
+ | Feature | Description |
303
397
  |---------|-------------|
304
- | **Document Management** | File attachments, preprocessing (5 formats), agent document context, document browser UI |
305
- | **Multi-Agent Routing** | Profile registry (4 profiles), task classifier, per-step profile assignment |
306
- | **Agent Profile Catalog** | 13 domain-specific profiles, GitHub import, behavioral testing, MCP server passthrough |
307
- | **Micro-Visualizations** | Sparklines, mini bars, donut rings — zero-dependency SVG charts |
308
- | **Tool Permission Persistence** | "Always Allow" patterns, pre-check bypass, Settings management |
309
- | **Scheduled Prompt Loops** | Cron + human-friendly intervals, one-shot/recurring, pause/resume lifecycle |
310
- | **Provider Runtimes** | Shared runtime registry with Claude Code and OpenAI Codex App Server adapters |
311
- | **Autonomous Loop Execution** | 4 stop conditions, iteration context chaining, pause/resume, loop status view |
312
- | **Workflow Blueprints** | 8 templates, gallery, YAML editor, dynamic forms, GitHub import, lineage tracking |
313
- | **Command Palette** | ⌘K palette with navigation, create actions, recent items, theme toggle |
398
+ | **AI Assist → Workflow Creation** | Bridge AI task assist recommendations into the workflow engine with profile assignment and pattern selection |
314
399
 
315
400
  ### Planned
316
401
 
317
402
  | Feature | Description |
318
403
  |---------|-------------|
319
- | **Multi-Agent Swarm** | Multi-agent orchestration with Mayor/Workers/Refinery roles |
320
404
  | **Agent Self-Improvement** | Agents learn patterns and update context with human approval |
321
- | **Document Output Generation** | Agent-generated documents as deliverables |
322
- | **Parallel Workflows** | Concurrent step execution within workflows |
323
405
 
324
406
  ---
325
407
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stagent",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Governed AI agent workspace for supervised local execution, workflows, documents, and provider runtimes.",
5
5
  "keywords": [
6
6
  "ai",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,143 @@
1
+ import { NextRequest, NextResponse } from "next/server";
2
+ import { db } from "@/lib/db";
3
+ import { workflows, tasks } from "@/lib/db/schema";
4
+ import { eq } from "drizzle-orm";
5
+ import type { WorkflowDefinition } from "@/lib/workflows/types";
6
+ import { validateWorkflowDefinition } from "@/lib/workflows/definition-validation";
7
+ import { validateWorkflowDefinitionAssignments } from "@/lib/agents/profiles/assignment-validation";
8
+ import { executeWorkflow } from "@/lib/workflows/engine";
9
+
10
+ interface FromAssistBody {
11
+ name?: string;
12
+ projectId?: string;
13
+ definition?: WorkflowDefinition;
14
+ priority?: number;
15
+ assignedAgent?: string;
16
+ executeImmediately?: boolean;
17
+ parentTask?: {
18
+ title: string;
19
+ description: string;
20
+ agentProfile?: string;
21
+ };
22
+ }
23
+
24
+ export async function POST(req: NextRequest) {
25
+ const body = (await req.json()) as FromAssistBody;
26
+ const { name, projectId, definition, priority, assignedAgent, executeImmediately, parentTask } = body;
27
+
28
+ if (!name?.trim()) {
29
+ return NextResponse.json({ error: "Name is required" }, { status: 400 });
30
+ }
31
+
32
+ if (!definition) {
33
+ return NextResponse.json(
34
+ { error: "Definition must include pattern and at least one step" },
35
+ { status: 400 }
36
+ );
37
+ }
38
+
39
+ const definitionError = validateWorkflowDefinition(definition);
40
+ if (definitionError) {
41
+ return NextResponse.json({ error: definitionError }, { status: 400 });
42
+ }
43
+
44
+ const compatibilityError = validateWorkflowDefinitionAssignments(definition);
45
+ if (compatibilityError) {
46
+ return NextResponse.json({ error: compatibilityError }, { status: 400 });
47
+ }
48
+
49
+ // Transaction: create workflow + tasks + optional parent task atomically
50
+ const workflowId = crypto.randomUUID();
51
+ const now = new Date();
52
+ const taskIds: string[] = [];
53
+ let parentTaskId: string | null = null;
54
+
55
+ try {
56
+ db.transaction((tx) => {
57
+ // Create parent task (no workflowId — visible on dashboard)
58
+ if (parentTask?.title) {
59
+ parentTaskId = crypto.randomUUID();
60
+ tx.insert(tasks)
61
+ .values({
62
+ id: parentTaskId,
63
+ title: parentTask.title,
64
+ description: parentTask.description || null,
65
+ projectId: projectId || null,
66
+ workflowId: null,
67
+ status: executeImmediately ? "running" : "planned",
68
+ assignedAgent: assignedAgent ?? null,
69
+ agentProfile: parentTask.agentProfile ?? null,
70
+ priority: priority ?? 2,
71
+ createdAt: now,
72
+ updatedAt: now,
73
+ })
74
+ .run();
75
+ }
76
+
77
+ // Store sourceTaskId in definition for parent↔workflow linkage
78
+ const defToStore = parentTaskId
79
+ ? { ...definition, sourceTaskId: parentTaskId }
80
+ : definition;
81
+
82
+ // Create workflow
83
+ tx.insert(workflows)
84
+ .values({
85
+ id: workflowId,
86
+ name: name.trim(),
87
+ projectId: projectId || null,
88
+ definition: JSON.stringify(defToStore),
89
+ status: executeImmediately ? "active" : "draft",
90
+ createdAt: now,
91
+ updatedAt: now,
92
+ })
93
+ .run();
94
+
95
+ // Create tasks for each step (with workflowId — hidden from dashboard)
96
+ for (const step of definition.steps) {
97
+ const taskId = crypto.randomUUID();
98
+ taskIds.push(taskId);
99
+
100
+ tx.insert(tasks)
101
+ .values({
102
+ id: taskId,
103
+ title: step.name,
104
+ description: step.prompt,
105
+ projectId: projectId || null,
106
+ workflowId,
107
+ status: "planned",
108
+ assignedAgent: step.assignedAgent ?? assignedAgent ?? null,
109
+ agentProfile: step.agentProfile ?? null,
110
+ priority: priority ?? 2,
111
+ createdAt: now,
112
+ updatedAt: now,
113
+ })
114
+ .run();
115
+ }
116
+ });
117
+ } catch (error) {
118
+ console.error("Failed to create workflow from assist:", error);
119
+ return NextResponse.json(
120
+ { error: "Failed to create workflow and tasks" },
121
+ { status: 500 }
122
+ );
123
+ }
124
+
125
+ // Fire-and-forget execution if requested
126
+ if (executeImmediately) {
127
+ executeWorkflow(workflowId).catch((error) => {
128
+ console.error(`Workflow ${workflowId} execution failed:`, error);
129
+ });
130
+ }
131
+
132
+ const [created] = await db.select().from(workflows).where(eq(workflows.id, workflowId));
133
+
134
+ return NextResponse.json(
135
+ {
136
+ workflow: created,
137
+ taskIds,
138
+ parentTaskId,
139
+ status: executeImmediately ? "started" : "created",
140
+ },
141
+ { status: 201 }
142
+ );
143
+ }
@@ -1,7 +1,7 @@
1
1
  import { Suspense } from "react";
2
2
  import { db } from "@/lib/db";
3
- import { tasks, projects } from "@/lib/db/schema";
4
- import { desc } from "drizzle-orm";
3
+ import { tasks, projects, workflows } from "@/lib/db/schema";
4
+ import { desc, isNull } from "drizzle-orm";
5
5
  import { KanbanBoard } from "@/components/tasks/kanban-board";
6
6
  import { SkeletonBoard } from "@/components/tasks/skeleton-board";
7
7
  import type { TaskItem } from "@/components/tasks/task-card";
@@ -9,9 +9,11 @@ import type { TaskItem } from "@/components/tasks/task-card";
9
9
  export const dynamic = "force-dynamic";
10
10
 
11
11
  async function BoardContent() {
12
+ // Only show parent/standalone tasks — hide workflow step tasks
12
13
  const allTasks = await db
13
14
  .select()
14
15
  .from(tasks)
16
+ .where(isNull(tasks.workflowId))
15
17
  .orderBy(tasks.priority, desc(tasks.createdAt));
16
18
 
17
19
  const allProjects = await db
@@ -22,10 +24,30 @@ async function BoardContent() {
22
24
  // Build project name lookup for task cards
23
25
  const projectMap = new Map(allProjects.map((p) => [p.id, p.name]));
24
26
 
27
+ // Look up linked workflows for parent tasks (via sourceTaskId in definition JSON)
28
+ const allWorkflows = await db
29
+ .select({ id: workflows.id, definition: workflows.definition, status: workflows.status })
30
+ .from(workflows);
31
+
32
+ const linkedWorkflowMap = new Map<string, { workflowId: string; workflowStatus: string }>();
33
+ for (const w of allWorkflows) {
34
+ try {
35
+ const def = JSON.parse(w.definition);
36
+ if (def.sourceTaskId) {
37
+ linkedWorkflowMap.set(def.sourceTaskId, {
38
+ workflowId: w.id,
39
+ workflowStatus: w.status,
40
+ });
41
+ }
42
+ } catch { /* skip invalid JSON */ }
43
+ }
44
+
25
45
  // Serialize Date objects for client component consumption
26
46
  const serializedTasks: TaskItem[] = allTasks.map((t) => ({
27
47
  ...t,
28
48
  projectName: t.projectId ? projectMap.get(t.projectId) ?? undefined : undefined,
49
+ linkedWorkflowId: linkedWorkflowMap.get(t.id)?.workflowId,
50
+ linkedWorkflowStatus: linkedWorkflowMap.get(t.id)?.workflowStatus,
29
51
  createdAt: t.createdAt.toISOString(),
30
52
  updatedAt: t.updatedAt.toISOString(),
31
53
  }));
@@ -0,0 +1,35 @@
1
+ import Link from "next/link";
2
+ import { db } from "@/lib/db";
3
+ import { projects } from "@/lib/db/schema";
4
+ import { Button } from "@/components/ui/button";
5
+ import { ArrowLeft } from "lucide-react";
6
+ import { WorkflowConfirmationView } from "@/components/workflows/workflow-confirmation-view";
7
+ import { listProfiles } from "@/lib/agents/profiles/registry";
8
+
9
+ export const dynamic = "force-dynamic";
10
+
11
+ export default async function WorkflowFromAssistPage() {
12
+ const allProjects = await db
13
+ .select({ id: projects.id, name: projects.name })
14
+ .from(projects)
15
+ .orderBy(projects.name);
16
+
17
+ const profiles = listProfiles().map((p) => ({
18
+ id: p.id,
19
+ name: p.name,
20
+ }));
21
+
22
+ return (
23
+ <div className="gradient-ocean-mist min-h-screen p-6">
24
+ <div>
25
+ <Link href="/tasks/new?restore=1">
26
+ <Button variant="ghost" size="sm" className="mb-4">
27
+ <ArrowLeft className="h-4 w-4 mr-1" />
28
+ Back to Task
29
+ </Button>
30
+ </Link>
31
+ <WorkflowConfirmationView projects={allProjects} profiles={profiles} />
32
+ </div>
33
+ </div>
34
+ );
35
+ }