mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-08-20 11:42:23 +02:00
* [eric] ci: gitleaks-ignore the known historical secrets so our branch stops failing on leaks it didnt add * [eric] workflows: restore scheduled-tasks on the workflow line (revert removal, keep windows fixes + 1.1.69) * [eric] workflows: re-apply uncommitted scheduling wip (schedule pill, calendar view, slice) * [eric] ops: gitignore dev-team local state files * [eric] ops: backlog item for download-tracking visibility * [eric] ci: allowlist the cdp-routes redaction-test token in gitleaks * [aidan] feat/scheduled-tasks: keep step labels in sync on edit and show chevron on every step * [aidan] fix: schedule time in chat * [aidan] ux/workflows: add workflow step removal (#91) * [aidan] feat/scheduled-tasks: remember workflow tool permissions across runs * [aidan] feat/task-scheduling: add hourly and minute (15-min minimum) schedule intervals (#93) * [aidan] feat/scheduled-tasks: calendar, rename, and edit workflows (#94) * [aidan] bug: fix schedule button * [aidan] fix/agent-errors: surface provider rate limits * [aidan] ux/cards: click-to-rename for chat and workflow titles Single-click a card's title to enter edit mode inline. Commit on Enter/blur, cancel on Escape. Rename persists via PATCH for workflows and sessions. * [aidan] feat/workflows: seed build prompt for zero-step workflows When a new workflow has no steps, seed the agent with a prompt asking the user to describe what the workflow should do, rather than starting blank. * [aidan] feat/workflows: add-to-schedule popover for unscheduled workflows Clicking the "+" on an unscheduled workflow row opens a popover with two options: - Keep this schedule: enables the workflow's existing cadence and moves it to Scheduled - Change schedule: opens the scheduling editor to pick a different time * [aidan] ux/workflows: wire add-to-schedule popover and simplify New button - Made the "+" icon on unscheduled workflow rows clickable, opening a popover to keep or change the schedule - Removed AddIcon from toolbar "New" button (now reads "New" instead of "+ New") * [aidan] fix/scheduled-tasks: open schedule calendar when Schedule pill clicked Fixed the Schedule pill click being swallowed by the toolbar's dismiss handler. Exempted the toolbar pills via data-toolbar-pills so their click handlers fire. * [aidan] ux/workflows: open New workflow in agent build chat instead of empty card When creating a new workflow from the hub, open it in edit_agent view (with the agent builder chat) instead of a preview card. The workflow is created on the backend first so the embedded session has a real ID. * [aidan] feat/workflow-edit: add draft testing save flow * [aidan] ux/chat: remove continue chat button * [aidan] ux/workflows: polish workflow card interactions * [aidan] fix/workflow-scheduling: save unscheduled workflows as drafts * aidan ui: schedule naming changes * [aidan] ui: tool calling desc/naming * [aidan] ui: calendar sidebar naming * [aidan] ui: fix stop viewing closing chat * [aidan] feat/workflows: auto-name workflows and polish the build flow (#95) * [aidan] feat/workflow-auto-naming: auto-generate workflow titles from steps Generate a title + description from a workflow's steps (one aux call, reused for step labels) whenever it is still auto_named, so a workflow built in the Edit Agent names itself on commit instead of staying "New workflow". A manual rename sets auto_named=False and is never overwritten. Stream the aux call (non-streaming drops content on some 9router lanes) and fall back to a step-derived title when the model is unavailable. * [aidan] feat/workflows: hide unsaved new workflows until first save A brand-new "+ New" workflow is created with unsaved=true and kept out of the hub's scheduled/unscheduled lists while the user is still building it in the Edit Agent. The first commit (Save) clears the flag and the workflow appears. Every other create path stays visible immediately. * [aidan] ux/workflows: remove redundant save workflow button The Edit Agent already has Discard/Save controls in its strip, so the header "Save Workflow" button was a duplicate save path. Remove it and its pulse/edit-session-id wiring; the model/time subtitle stays. * [aidan] ux/workflows: animate title on auto-rename Wrap the workflow card title in the same Typewriter the chat card uses, so when the auto-generated name replaces the placeholder after Save it retypes letter-by-letter. Gated on a real (non-placeholder) title so it never animates on mount or for already-named workflows. * [aidan] ux/workflows: animate sidebar title on auto-rename Wrap the calendar hub's sidebar row title in the same Typewriter the workflow card uses, so a title that auto-renames retypes letter-by-letter in the sidebar too. Extract the placeholder/isRealTitle guard into the shared workflowVisuals so the card and sidebar stay in sync. * [aidan] fix/workflows: connect watch tether, keep watched chat open, wire draft run/history * [aidan] ui: grey out chat pill when not selected * [aidan] ui: fix running agent display * [aidan] feat/history-popover: add chat history and scheduled tasks run log tabs (#96) * [aidan] ux/schedule: toast when calendar view already open on expand * [aidan] ui: fix popover descs * [aidan] feat/workflow-runs: add pause, resume, and stop controls for live runs * [aidan] feat/schedule-calendar: add calendar occurrences endpoint and concrete timezones * [aidan] feat/workflows: require at least one step to save a workflow * [aidan] ux/edit-agent: hide Discard for an unsaved new workflow * [aidan] ux/edit-agent: move fix-prefix card below the step list * [aidan] feat/workflows: toast when an unattended scheduled run starts * [aidan] fix/dashboard-tethers: anchor workflow-sidecar tethers to measured card rects * [aidan] feat/workflows: validate steps before scheduling and keep chat tool memory * [aidan] feat/mcp-suggestions: dismissable integration banner with per-session cooldown * [aidan] feat/workflows: add scheduled-run "running now" toast with click-to-view (#97) * [aidan] ux/workflows: surface paused state on card, sidebar, and calendar; tidy run history * [aidan] feat/mcp-suggestions: suggest both Google and Microsoft when provider is ambiguous * [aidan] fix/agent-tokens: friendly out-of-tokens card across all agent surfaces * [aidan] feat/workflow-model: persist edit-agent model on save with switch notice and fresh drafts * [aidan] fix/workflow-chat: force stop on watched run mirrors workflow card stop * [aidan] fix/workflow-cards: keep watched run tethered on finish to avoid duplicate chat * [aidan] feat/schedule-calendar: mark current time with a now line in week view * [aidan] refactor/private-names: rename error and schedule classifiers from _ to p_ * [aidan] feat/scheduled-tasks: agent workflow scheduling and in-chat convert (#98) * [aidan] feat/workflow-suggest: nudge user to convert repeatable chat to workflow Add SuggestConvertToWorkflow MCP tool that agents call at the end of a task when they've completed something worth repeating (daily report, weekly check, recurring data pull). Frontend detects the tool call and glows the "Convert to workflow" button 3 times to draw the eye. When user clicks it, the suggested cadence (e.g. "every weekday at 9am") is stored in the draft and seeded into the scheduling agent's first prompt, so the agent can act on the suggestion rather than asking the user again. Tool is never auto-called — agents decide when a task is genuinely repeatable (not debugging, creative work, one-off lookup). Tool description emphasizes sparse, high-confidence use only (once per session max). Files changed: - backend/apps/agents/schedule_mcp_server.py: add SuggestConvertToWorkflow tool - frontend/src/shared/mcpToolMeta.ts: add label for new tool - frontend/src/app/pages/Dashboard/cards/AgentCard.tsx: detect suggestion in session messages, show+glow "Convert to workflow" button, pass cadence to draft - frontend/src/shared/state/workflowsSlice.ts: add suggested_cadence field to Workflow interface - frontend/src/app/pages/Workflows/SchedulingView.tsx: seed scheduling agent prompt with suggested cadence hint * [aidan] feat/agent-scheduling: route recurring asks through native workflows, deny claude cron skill * [aidan] feat/workflow-convert: in-chat convert popup and auto-open scheduled workflow card * [aidan] ux/calendar-page: schedule calendar restyle + popover fixes (#99) * [aidan] fix/dashboard-delete: remove workflows calendar panel on delete key * [aidan] ux/workflows-calendar: restyle hub, fix today highlight, add toolbar toggle * [aidan] ux/schedule-popover: compact density, fix sticky header bleed, add header spacing * [aidan] ux/schedule-calendar: hollow ring dot for past fires in month view * [aidan] ux/schedule-calendar: clickable +N more opens day's full run list * [aidan] feat/run-log-filters: add success and skipped pills to scheduled task history * [aidan] fix/convert-button: stop drag capture so convert-to-workflow click fires * [aidan] ux/calendar-card: match border color and radius to chat and workflow cards * [aidan] fix/minimap: render missed-runs card on the minimap * [aidan] ux/run-sparkline: simplify tooltip to plain run tally * [aidan] ux/run-history: collapse expanded run view to one clickable line * [aidan] ux/calendar-card: match corner radius to browser cards * [aidan] feat/workflows: launch-time scheduling UX and workflow-card polish (#101) * [aidan] feat/schedule-list: lazy-load list view via scroll sentinel * [aidan] feat/missed-runs: launch toast with per-workflow counts and pan-to-card * [aidan] fix/dashboard-tethers: keep watching line anchored on canvas zoom * [aidan] feat/scheduled-tasks: review missed runs at launch instead of auto-firing on_missed * [aidan] refactor/workflow-cards: use radius and status design tokens, polish card chrome * [aidan] ux/agent-card: keep convert-to-workflow visible during runs with mid-turn toast * [aidan] ux/mcp-bubble: drop redundant verb label when a workflow label is shown * [aidan] chore/backend: remove stale explanatory comments * [aidan] fix/workflows-hub: load workflows on hub mount so calendar fills at launch * [aidan] feat/workflows: generate title, description, step labels at convert time * [aidan] fix/tidy-layout: include workflows hub in tidy and fit-to-view * [aidan] feat/schedule-list: window long list via measured-height virtualizer * [aidan] ux/workflows-hub: remove time-saved badge from calendar header * [aidan] fix/types: add missing semantic-type labels and drop stray fade arg * [aidan] feat/schedule: pin monthly day-of-month and honor repeat-every intervals * [aidan] feat/schedule: inherit source-session tool surface for scheduled runs * [aidan] ux/calendar: restack hour-cell events as bars with overflow affordance * [aidan] feat/calendar: open the run card when clicking a scheduled occurrence * [aidan] ux/missed-runs: add per-group select-all toggle and rename skip action * [aidan] feat: new scheduled task design ported * [aidan] ui: sidebar reorder, repeat controls on schedule card * [aidan] ui: sidebar, scheduling time * [aidan] feat/schedule: pin monthly last-day-of-month * [aidan] feat/steps: per-step enable toggle * [aidan] feat/workflows: per-workflow color swatch * [aidan] feat/trash: soft-delete workflows with restore and purge * [aidan] feat/run-monitor: live run monitor card on the canvas * [aidan] feat/run-context: attach a run as removable chat context * [aidan] feat/compose: new-workflow landing page and auto-commit build flow * [aidan] ui/workflows: dark mode and design-system cohesion * [aidan] ui/calendar: overflow popover, condensed week view, scroll fix * [aidan] feat/home: ongoing runs, missed review, and accurate Coming-up counts * [aidan] fix/run-status: sync ongoing runs and heal stuck/interrupted runs * [aidan] ux/schedule: last-day-of-month UI, Run-at time typing, interval input * [aidan] ux/workflows: default window size and toolbar icon * [aidan] fix/schedule: measure ran_late from start and anchor recurrences to created_at * [aidan] feat/calendar: render fire times from backend, drop JS recurrence reimpl * [aidan] chore/dashboard: drop dead configure/missed-run cards, refetch on reconnect * [aidan] chore/agent-card: remove unreachable convert-to-workflow action * [aidan] fix/workflows: don't bump updated_at on a no-op draft commit so viewing a workflow doesn't reorder the sidebar * [aidan] feat/schedule: warn when scheduling a workflow that has no steps * [aidan] fix/selection-tool: never select the workflows app, and exit the tool on Escape without dropping selections * [aidan] ux/compose: diversify new-workflow starter prompts across personas * [aidan] ux/run-monitor: spawn the run card a bit farther right of the workflows app * [aidan] fix/schedule: harden run recovery and storage writes against crashes * [aidan] ux/compose: restyle new-workflow starters as a clean pill cluster with rich prompts * [aidan] fix/workflows: optimistically apply edits so the schedule banner updates instantly * [aidan] ui/workflows: three-tone surface depth so the window lifts off the canvas in both themes * [aidan] ui/workflows: close buttons turn red on hover, matching the chat card * [aidan] test/schedule: cover executor pipeline, storage durability, and recurrence gaps * [aidan] fix: remove package-lock json * [aidan] fix/workflows-compose: keep compose view until edit agent replies * [aidan] feat/workflows: auto-generate workflow + step titles with typewriter animation * [eric] deps: restore frontend/package-lock.json (PR #105 deletion broke npm ci) --------- Co-authored-by: Eric <ciregenz@berkeley.edu> Co-authored-by: cire <134991075+ciregenz@users.noreply.github.com>
294 lines
14 KiB
Python
294 lines
14 KiB
Python
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
|
from typing import Optional, Literal, Any
|
|
from datetime import datetime
|
|
from uuid import uuid4
|
|
|
|
|
|
# Each "tier" in the permission chain: notify in app, fall through to text
|
|
# after N minutes if no response, then to call after a further N minutes/hours.
|
|
# Matches images 17 to 19 (Schedule edit). Order in the list = escalation order.
|
|
class PermissionTier(BaseModel):
|
|
kind: Literal["notify", "text", "call"] = "notify"
|
|
after_minutes: int = 0
|
|
phone: Optional[str] = None
|
|
|
|
|
|
class ScheduleConfig(BaseModel):
|
|
enabled: bool = False
|
|
# Bounds keep the scheduler from blowing up on malformed input. The
|
|
# FE clamps these too, but defense-in-depth: a misbehaving agent
|
|
# tool, an old JSON file, or a curl-wielding power user shouldn't
|
|
# be able to crash _next_fire_after by passing hour=99. The per-unit
|
|
# upper bound on repeat_every is clamped (not rejected) in
|
|
# _enforce_interval_bounds below, so only the floor lives on the Field.
|
|
repeat_every: int = Field(default=1, ge=1)
|
|
repeat_unit: Literal["minute", "hour", "day", "week", "month"] = "week"
|
|
on_days: list[int] = Field(default_factory=list)
|
|
hour: int = Field(default=9, ge=0, le=23)
|
|
minute: int = Field(default=0, ge=0, le=59)
|
|
# Monthly schedules can pin a day-of-month explicitly. None preserves the
|
|
# legacy "same day as the current reference" behavior for older records.
|
|
day_of_month: Optional[int] = Field(default=None, ge=1, le=31)
|
|
# When true, monthly schedules fire on the calendar's last day (28-31)
|
|
# regardless of day_of_month, so "end of month" survives short months.
|
|
last_day_of_month: bool = False
|
|
# IANA zone name (e.g. "America/Los_Angeles") or "local" for legacy
|
|
# records that predate explicit tz. storage._load_all_from_disk coerces
|
|
# "local" to the host zone in memory; we leave it on disk until the
|
|
# user's next save so backup/sync tools don't see spurious churn.
|
|
timezone: str = "local"
|
|
# Optional end conditions. None = forever / unbounded. Schedule auto-
|
|
# disables once either is satisfied; scheduler._tick zeroes out
|
|
# next_run_at and flips enabled=False so the UI reflects reality.
|
|
ends_at: Optional[datetime] = None
|
|
max_runs: Optional[int] = Field(default=None, ge=1)
|
|
runs_count: int = Field(default=0, ge=0)
|
|
|
|
@field_validator("on_days")
|
|
@classmethod
|
|
def _clean_on_days(cls, v: list[int]) -> list[int]:
|
|
# Backend uses JS-style weekday (Sun=0..Sat=6). Drop entries
|
|
# outside that range so a malformed PATCH can't trip the
|
|
# scheduler later, and dedupe while preserving order.
|
|
seen: set[int] = set()
|
|
out: list[int] = []
|
|
for d in v or []:
|
|
if isinstance(d, int) and 0 <= d <= 6 and d not in seen:
|
|
seen.add(d)
|
|
out.append(d)
|
|
return out
|
|
|
|
@model_validator(mode="after")
|
|
def _enforce_interval_bounds(self) -> "ScheduleConfig":
|
|
# Per-unit bounds, clamped rather than rejected so a stray value from
|
|
# an agent tool or old record can't crash the scheduler. The minute
|
|
# unit floors at 15 (no once-a-minute token-burning loop) and ceilings
|
|
# at 1440 (24h); every other unit keeps the original 365 ceiling.
|
|
if self.repeat_unit == "minute":
|
|
self.repeat_every = max(15, min(self.repeat_every, 1440))
|
|
else:
|
|
self.repeat_every = min(self.repeat_every, 365)
|
|
return self
|
|
|
|
|
|
class ActionsConfig(BaseModel):
|
|
prevent_unused: bool = False
|
|
freeze: bool = False
|
|
configured_sets: list[str] = Field(default_factory=list)
|
|
|
|
|
|
class WorkflowStep(BaseModel):
|
|
id: str = Field(default_factory=lambda: uuid4().hex)
|
|
text: str = ""
|
|
# 3 to 6 word LLM-generated headline shown in the collapsed step row.
|
|
# The full prompt lives in `text`; this is the "at-a-glance" label.
|
|
label: Optional[str] = None
|
|
# Disabled steps stay in the list but the executor skips them, so a user
|
|
# can mute a step without losing its prompt. Defaults true for old records.
|
|
enabled: bool = True
|
|
|
|
|
|
def _empty_str_default() -> str:
|
|
return ""
|
|
|
|
|
|
class Workflow(BaseModel):
|
|
# validate_assignment is load-bearing for the PATCH /workflows/{id} path
|
|
# (workflows.py:update_workflow setattr's raw dicts from body.model_dump
|
|
# straight onto the cached Workflow). Without coercion the nested
|
|
# schedule/steps/actions/permissions fields become plain dicts in
|
|
# memory, and every downstream call; scheduler tick, executor.execute,
|
|
# subsequent PATCHes; crashes on `.enabled` / `.text`.
|
|
model_config = ConfigDict(validate_assignment=True)
|
|
|
|
id: str = Field(default_factory=lambda: uuid4().hex)
|
|
title: str = "Untitled workflow"
|
|
description: str = ""
|
|
icon: str = ""
|
|
# User-chosen swatch (hex). None falls back to the id-hash color in the UI.
|
|
color: Optional[str] = None
|
|
# Soft-delete tombstone. Set = in Trash (hidden from lists + scheduler);
|
|
# restore nulls it, purge removes the record entirely.
|
|
deleted_at: Optional[datetime] = None
|
|
system_prompt: Optional[str] = None
|
|
use_synced_prompt: bool = True
|
|
steps: list[WorkflowStep] = Field(default_factory=list)
|
|
actions: ActionsConfig = Field(default_factory=ActionsConfig)
|
|
schedule: ScheduleConfig = Field(default_factory=ScheduleConfig)
|
|
permissions: list[PermissionTier] = Field(
|
|
default_factory=lambda: [PermissionTier(kind="notify")]
|
|
)
|
|
source_session_id: Optional[str] = None
|
|
# Tool names observed in the source chat when this workflow was generated.
|
|
# This preserves conversion context without pretending those calls map to
|
|
# generated workflow step ids. Explicit approval decisions still live in
|
|
# remembered_approvals and are the only values reused as permissions.
|
|
source_tools: list[str] = Field(default_factory=list)
|
|
dashboard_id: Optional[str] = None
|
|
model: str = "sonnet"
|
|
mode: str = "agent"
|
|
provider: str = "anthropic"
|
|
created_at: datetime = Field(default_factory=datetime.now)
|
|
updated_at: datetime = Field(default_factory=datetime.now)
|
|
last_run_at: Optional[datetime] = None
|
|
last_run_status: Optional[Literal["success", "failure", "ran_late", "running", "skipped"]] = None
|
|
last_run_id: Optional[str] = None
|
|
next_run_at: Optional[datetime] = None
|
|
cost_cap_usd_monthly: Optional[float] = None
|
|
# Sticky session id for the Edit Agent embedded in the workflow card
|
|
# (Image #38, #48). Optional so older workflows don't fail validation
|
|
# on rehydrate.
|
|
edit_agent_session_id: Optional[str] = None
|
|
# Sticky session id for the embedded scheduling agent (the chat that
|
|
# turns "every Wednesday at 1pm" into a permission-gated tool call).
|
|
schedule_agent_session_id: Optional[str] = None
|
|
# Pending Edit-Agent draft of the steps. None = no draft in flight. Edits
|
|
# stage here and only land on `steps` when the user clicks Save; scheduled
|
|
# runs read `steps`, so a pending draft never affects a fire.
|
|
draft_steps: Optional[list[WorkflowStep]] = None
|
|
# Most recent Test Agent session for this workflow; read by ReadTestTranscript.
|
|
last_test_session_id: Optional[str] = None
|
|
# Tool permissions the user answered once and we reuse on later runs so an
|
|
# unattended scheduled fire doesn't stall waiting for someone to click.
|
|
# tool_name -> decision. Only ordinary "ask" tools land here; sensitive
|
|
# paths keep their own per-pattern trust and never auto-remember.
|
|
remembered_approvals: dict[str, Literal["allow", "deny"]] = Field(default_factory=dict)
|
|
# Behind-the-scenes record of which tools each step touched and whether each
|
|
# was permitted, keyed by stable step id (not index, so reorders don't
|
|
# scramble it). Auto-maintained on runs; enforcement stays workflow-level
|
|
# via remembered_approvals, this is the finer per-step picture.
|
|
step_tool_usage: dict[str, dict[str, bool]] = Field(default_factory=dict)
|
|
# False once the user explicitly sets a title; True means the backend may
|
|
# overwrite the title via auto-naming when steps are added/changed.
|
|
auto_named: bool = False
|
|
# True for a brand-new "+ New" workflow that the user is still building in
|
|
# the Edit Agent and hasn't saved yet. The Workflows hub hides these from
|
|
# the scheduled/unscheduled lists until the first commit clears the flag,
|
|
# so an in-progress build doesn't litter the sidebar.
|
|
unsaved: bool = False
|
|
# Stable signature of the steps last validated by a test run (or seeded at
|
|
# chat conversion). The FE compares it against the current steps before
|
|
# scheduling: a mismatch means "edited since you last approved tools" and
|
|
# triggers the test-first warning. Computed FE-side so there's one algorithm.
|
|
tested_signature: Optional[str] = None
|
|
|
|
|
|
class WorkflowRun(BaseModel):
|
|
id: str = Field(default_factory=lambda: uuid4().hex)
|
|
workflow_id: str
|
|
status: Literal["running", "success", "failure", "ran_late", "skipped"] = "running"
|
|
scheduled_for: Optional[datetime] = None
|
|
started_at: datetime = Field(default_factory=datetime.now)
|
|
finished_at: Optional[datetime] = None
|
|
session_id: Optional[str] = None
|
|
error: Optional[str] = None
|
|
cost_usd: float = 0.0
|
|
triggered_by: Literal["schedule", "manual", "retry"] = "schedule"
|
|
# Last tool-call label observed on the underlying agent session while
|
|
# the workflow is running. Surfaced under the active step in RunningView
|
|
# (Image #40) so the user can tell the run is still making progress.
|
|
last_tool_label: Optional[str] = None
|
|
# Currently-executing step index (0-based). Executor bumps this each
|
|
# time it dispatches a step prompt and broadcasts the run. RunningView
|
|
# uses this for the disc statuses; estimate fallback only when null.
|
|
active_step_idx: Optional[int] = None
|
|
# True while the user has paused the in-flight agent turn (same mechanic
|
|
# as the chat's stop/resume). Rides the workflow:run broadcast so the
|
|
# card shows the paused state even when the live chat isn't open.
|
|
paused: bool = False
|
|
|
|
|
|
class MissedRun(BaseModel):
|
|
# A single scheduled fire that elapsed while OpenSwarm was closed. Captured
|
|
# at startup and surfaced in the launch-time review card; leaves this store
|
|
# only when the user runs it (becomes a ran_late run) or dismisses it
|
|
# (becomes a skipped run). scheduled_for is the instant it should have fired.
|
|
id: str = Field(default_factory=lambda: uuid4().hex)
|
|
workflow_id: str
|
|
scheduled_for: datetime
|
|
created_at: datetime = Field(default_factory=datetime.now)
|
|
|
|
|
|
class WorkflowCreate(BaseModel):
|
|
title: str = "Untitled workflow"
|
|
auto_named: bool = True
|
|
# Only the "+ New" build flow sets this; every other create path is a
|
|
# deliberate save and stays visible immediately.
|
|
unsaved: bool = False
|
|
description: str = ""
|
|
icon: str = ""
|
|
color: Optional[str] = None
|
|
system_prompt: Optional[str] = None
|
|
use_synced_prompt: bool = True
|
|
steps: list[WorkflowStep] = Field(default_factory=list)
|
|
actions: ActionsConfig = Field(default_factory=ActionsConfig)
|
|
schedule: ScheduleConfig = Field(default_factory=ScheduleConfig)
|
|
permissions: Optional[list[PermissionTier]] = None
|
|
source_session_id: Optional[str] = None
|
|
dashboard_id: Optional[str] = None
|
|
model: Optional[str] = None
|
|
mode: Optional[str] = None
|
|
provider: Optional[str] = None
|
|
cost_cap_usd_monthly: Optional[float] = None
|
|
tested_signature: Optional[str] = None
|
|
# The FE already named + described + labeled this at preview time; skip the
|
|
# backend aux call so we don't double-spend or change the title under the user.
|
|
metadata_generated: bool = False
|
|
|
|
|
|
class GenerateMetadataRequest(BaseModel):
|
|
steps: list[WorkflowStep] = Field(default_factory=list)
|
|
model: Optional[str] = None
|
|
|
|
|
|
class GenerateMetadataResponse(BaseModel):
|
|
title: str = ""
|
|
description: str = ""
|
|
step_labels: list[str] = Field(default_factory=list)
|
|
|
|
|
|
class WorkflowUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
auto_named: Optional[bool] = None
|
|
# Revealing a compose draft (Save, or auto on first chat message) flips this
|
|
# to False so the hub stops hiding it. Without it here the PATCH was a no-op.
|
|
unsaved: Optional[bool] = None
|
|
description: Optional[str] = None
|
|
icon: Optional[str] = None
|
|
color: Optional[str] = None
|
|
system_prompt: Optional[str] = None
|
|
use_synced_prompt: Optional[bool] = None
|
|
steps: Optional[list[WorkflowStep]] = None
|
|
actions: Optional[ActionsConfig] = None
|
|
schedule: Optional[ScheduleConfig] = None
|
|
permissions: Optional[list[PermissionTier]] = None
|
|
model: Optional[str] = None
|
|
mode: Optional[str] = None
|
|
provider: Optional[str] = None
|
|
cost_cap_usd_monthly: Optional[float] = None
|
|
remembered_approvals: Optional[dict[str, Literal["allow", "deny"]]] = None
|
|
step_tool_usage: Optional[dict[str, dict[str, bool]]] = None
|
|
|
|
|
|
class MissedRunAction(BaseModel):
|
|
ids: list[str] = Field(default_factory=list)
|
|
|
|
|
|
class AskRunBody(BaseModel):
|
|
# Answer a chat question with a finished run's transcript folded in as context.
|
|
# run_id picks the run's session to pull in; prompt is the user's question.
|
|
run_id: str
|
|
prompt: str
|
|
mode: Optional[str] = None
|
|
model: Optional[str] = None
|
|
|
|
|
|
class DraftCommitBody(BaseModel):
|
|
# The model the user settled on in the Edit Agent picker, applied to the
|
|
# workflow's run model only on Save (save-gated; Discard drops it).
|
|
model: Optional[str] = None
|
|
# Keep the edit-agent session alive across the commit. The build flow
|
|
# auto-commits steps as the agent adds them but must NOT close the chat,
|
|
# the user keeps talking in the same conversation after it becomes saved.
|
|
keep_session: bool = False
|