feat(my-deepagent): v0.4 — workflow generator UI + hot-reload + UX polish

브라우저에서 YAML 안 쓰고도 새 워크플로우 템플릿 만들기 + 즉시 등록.
+ /new.html / index.html / new-workflow.html / runs.html / conversation.html
의 nav·copy·empty-state 정비.

A. /new.html UX:
- 제목 "새 Run" → "워크플로우 실행 (고급)"
- 상단 info-box: "자유 대화는 여기가 아닙니다 → 메인 페이지"
- 모든 필드에 한 줄 hint
- Persona 오버라이드 <details> 접힘

B. Nav 재정렬 (5 페이지):
- "대화" nav-primary, 나머지 nav-secondary (작고 dim)

C. 메인 안내 + CSS:
- 메인 / 에 "👋 my-deepagent" info-box 추가
- .info-box / .nav-primary / .nav-secondary / .wf-* 신규 스타일

D. Workflow hot-reload:
- api/deps.py get_workflows 가 매 요청 mtime 튜플 검사 후 변경 시 reload
- lifespan 도 user dir 포함하도록 _load_workflows_combined

E. Workflow generator:
- POST /api/workflows: CreateWorkflowRequest → WorkflowTemplate validate →
  <data_dir>/workflows/<name>@<version>.yaml 저장.  중복 409, validation 422.
- static/new-workflow.html: 기본 정보 / Roles / Phases / YAML preview
- app.js bootstrapWorkflowGenerator: capability chip 토글, role select 동적,
  실시간 YAML preview, XSS 정책 유지

테스트 (test_workflow_generator.py, 7 신규):
- 페이지 200 + 마크업
- POST happy / 422 (empty roles) / 422 (unknown role) / 409 (dup)
- GET hot-reload after POST
- GET hot-reload after external file drop

게이트:
- ruff / format / mypy: PASS (142 source files)
- pytest -q --ignore=tests/integration/test_e2e_workflow.py
  --ignore=tests/integration/test_openrouter_smoke.py: 709 passed (+7 신규)
- 라이브 smoke: / / new.html / new-workflow.html 모두 200, screenshot OK

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
chungyeong
2026-05-18 00:38:46 +09:00
parent 40ef833ad3
commit 6d371afadd
14 changed files with 1007 additions and 52 deletions

View File

@@ -128,6 +128,60 @@ class WorkflowSummary(_Strict):
phases: list[WorkflowPhaseSummary]
# v0.4 — workflow generator UI (POST /api/workflows)
class WorkflowRoleSpec(_Strict):
"""Input shape for one role inside a CreateWorkflowRequest."""
id: str = Field(min_length=1, pattern=r"^[a-z][a-z0-9_]*$")
required_capabilities: list[str] = Field(min_length=1)
preferred_backends: list[str] = Field(default_factory=list)
fallback_personas: list[str] = Field(default_factory=list)
class WorkflowArtifactSpec(_Strict):
"""Input shape for one phase's expected_artifact (optional)."""
path: str = Field(min_length=1)
# YAML key is `schema`; pydantic attribute aliased to avoid BaseModel.schema clash
schema_id: str = Field(min_length=1, alias="schema")
class WorkflowPhaseSpec(_Strict):
"""Input shape for one phase inside a CreateWorkflowRequest."""
key: str = Field(min_length=1, pattern=r"^[a-z][a-z0-9_]*$")
title: str = Field(min_length=1)
risk: str = Field(min_length=1) # low|medium|high — validated by WorkflowTemplate
role: str = Field(min_length=1)
instructions: str = Field(min_length=10)
expected_artifact: WorkflowArtifactSpec | None = None
gates: list[str] = Field(default_factory=list)
timeout_seconds: int | None = Field(default=None, ge=1)
max_budget_usd: float | None = Field(default=None, ge=0)
class CreateWorkflowRequest(_Strict):
"""Body for POST /api/workflows — saves a new template YAML on disk."""
name: str = Field(min_length=1)
version: int = Field(ge=1)
description: str | None = None
roles: list[WorkflowRoleSpec] = Field(min_length=1)
phases: list[WorkflowPhaseSpec] = Field(min_length=1)
default_gates: list[str] = Field(default_factory=list)
max_total_budget_usd: float | None = Field(default=None, ge=0)
class CreateWorkflowResponse(_Strict):
"""Returned by POST /api/workflows."""
path: str # absolute path of the saved YAML
name: str
version: int
# ---------------------------------------------------------------------------
# /api/budget
# ---------------------------------------------------------------------------