Commit Graph

501 Commits

Author SHA1 Message Date
Michael Chihlas
6efabff090 docs: add Design System v4 migration implementation plan
9 tasks: CSS foundation, icon rail sidebar, component sweep
(~200 files across 6 directory-group commits), landing page,
cleanup. Plan reviewed and all issues addressed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 00:01:33 -04:00
Michael Chihlas
1de0b50ce4 docs: add Design System v4 migration spec
Flat dark theme migration plan: CSS foundation, icon rail sidebar,
~130 file component sweep, landing page updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 23:50:59 -04:00
Michael Chihlas
6ff793bf45 docs: swap to Design System v4 — flat dark theme, no glass morphism
- Add DESIGN-SYSTEM.md as single source of truth for all design decisions
- Update CLAUDE.md branding and design system sections to reference new system
- Archive UI-DESIGN-SYSTEM.md to docs/archive/design-docs/
- Update tech stack styling line and quick reference table

The new design system moves from glassmorphism/gradients to a flat,
high-contrast dark theme inspired by Sentry/PostHog. Light mode planned.
CSS implementation to follow in a separate branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 22:36:03 -04:00
chihlasm
bcf4c80f14 Merge pull request #118 from patherly/feat/flowpilot-message-bar-and-script-builder
feat: FlowPilot message bar + AI Script Builder + Library reorg
2026-03-21 22:07:27 -04:00
Michael Chihlas
58750c17ef chore: update CHANGELOG for v0.10.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:48:20 -04:00
Michael Chihlas
b801f6cac5 refactor: normalize script_builder_messages into separate table
Extract JSONB messages array from script_builder_sessions into a proper
script_builder_messages table with individual columns for role, content,
script, tokens, etc. Migration handles data migration from JSONB to rows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:06:58 -04:00
Michael Chihlas
0b261ee21a test: add edge case tests for script builder (max sessions, max messages, slug collision, filters)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:04:33 -04:00
Michael Chihlas
5000e49cea refactor: add typed content helpers for FlowPilot step card actions
Replace unsafe `as string` casts with type guard functions
(isScriptGenerationAction, isScriptBuilderAction, getActionType)
for compile-time safety on step content parsing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:02:12 -04:00
Michael Chihlas
ed82c000f6 docs: add lessons 83-87 to CLAUDE.md (session learnings)
Fixed positioning, abandon session, date filters, Script Builder,
FlowPilot GUI vs script preference.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 19:10:53 -04:00
Michael Chihlas
3d584902ef fix(sessions): date filter end date includes full day
Date range filters were sending midnight (start of day) for the end
date, excluding sessions created later that day. Now sends 23:59:59.999
for both flow sessions and AI sessions date filters.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:59:04 -04:00
Michael Chihlas
9b87e4dcc8 fix: add missing useNavigate import for abandon redirect
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:45:21 -04:00
Michael Chihlas
fb32f817fa refactor(sessions): merge Flow and AI sessions into unified view
Remove the Flow/AI session type toggle tabs. Both session types now
display on a single page — FlowPilot sessions at top, flow sessions
below, each with their own filters.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:42:16 -04:00
Michael Chihlas
229ecd4985 fix(flowpilot): redirect to Active Sessions after closing session
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:33:58 -04:00
Michael Chihlas
6ecb5a9bbd fix(flowpilot): widen message bar, add close/abandon session support
- Message bar now fixed-positioned above action bar with full-width
  layout (respects both app sidebar and session sidebar)
- Added abandon_session endpoint (POST /ai-sessions/{id}/abandon)
- Added "Close" button to FlowPilot action bar with confirmation dialog
- Session can now be closed without resolving or escalating

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:20:34 -04:00
Michael Chihlas
74bc5a532d fix(flowpilot): fix message bar hidden behind fixed action bar
The message bar was in normal document flow but the action bar uses
position:fixed at bottom:0, covering it. Now the message bar is also
fixed-positioned at bottom:60px (above the action bar), matching the
same left offset pattern. Added extra bottom padding to the
conversation column for clearance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:49:49 -04:00
Michael Chihlas
928a22112a fix(flowpilot): ask user preference before suggesting scripts
FlowPilot was jumping straight to script generation without asking if
the user preferred GUI guidance. Now it asks "GUI or script?" first
when a task can be done either way.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:37:52 -04:00
Michael Chihlas
535284c4ce feat: add My Scripts/Team Scripts tabs and Build button to Script Library
- Add language field to ScriptTemplateListItem frontend type
- Add mine/shared params to scriptsApi.getTemplates
- Update scriptGeneratorStore.loadTemplates to accept filter params
- Reorganize ScriptLibraryPage with tab bar (My Scripts / Team Scripts)
- Add "Build a New Script" button linking to /script-builder

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:17:47 -04:00
Michael Chihlas
628761473f feat: add language column, AI Generated category, and mine/shared filters
- Add language column (powershell/bash/python) to script_templates model and schemas
- Seed 'AI Generated' script category via migration 063
- Add mine and shared query params to list_templates endpoint

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:17:41 -04:00
Michael Chihlas
25d7191575 feat: connect FlowPilot to Script Builder with handoff action
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:15:15 -04:00
Michael Chihlas
689776afd9 feat: add Script Builder page with chat UI, code blocks, preview modal, and save dialog
- ScriptCodeBlock: collapsed code preview with syntax highlighting (first 5 lines)
- ScriptBuilderInput: auto-resize chat input with Enter-to-send
- ScriptBuilderChat: message list with markdown rendering and code blocks
- ScriptPreviewModal: fullscreen script viewer with line numbers
- SaveToLibraryDialog: save script with name, description, category, team sharing
- ScriptBuilderPage: language selector, session management, FlowPilot handoff
- Added route, sidebar nav item (fuchsia), and mobile nav entry

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:11:32 -04:00
Michael Chihlas
77cee8f6f3 test: add Script Builder API tests
Also fix bug in save_to_library: remove invalid 'language' kwarg
passed to ScriptTemplate constructor (column doesn't exist on model).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:03:44 -04:00
Michael Chihlas
ec245c9fef feat: add Script Builder frontend types and API client
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:00:41 -04:00
Michael Chihlas
28f8200b36 feat: add Script Builder service and API endpoints
- Script Builder service with language-specific system prompts (PowerShell, Bash, Python)
- AI-powered script generation with code block extraction and filename detection
- Context window management (last 20 messages) and session message limits
- REST API: CRUD sessions, send messages, save to Script Library
- Rate limiting on message endpoint (10/min), max 5 concurrent sessions per user
- Registered script_build action in AI model tier routing (standard tier)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:58:26 -04:00
Michael Chihlas
35c0c67da3 feat: add ScriptBuilderSession model, migration, and schemas
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:55:08 -04:00
Michael Chihlas
ec7df50064 feat(flowpilot): add always-visible message bar, remove hidden free text escape hatch
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:52:17 -04:00
Michael Chihlas
ad64f26883 docs: add spec and implementation plan for FlowPilot message bar and Script Builder
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:46:26 -04:00
a9717951f0 docs: rewrite README and add CHANGELOG
README: updated to reflect current product (FlowPilot, PSA integration,
Knowledge Flywheel), fixed stale roadmap references to closed issues,
corrected Tailwind version (v3→v4), added Quick Start section, linked
all documentation.

CHANGELOG: organized by version from v0.1.0 (Jan 2026) through v0.9.0
(current), covering all major features across 9 releases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:26:52 +00:00
8e2332bc51 docs: update CLAUDE.md with lessons 78-82 and current state
- Update phase to Go-to-Market Validation (Pre-PMF)
- Update in-progress and recently completed sections
- Lesson 78: Landing page subtitle branding
- Lesson 79: Custom modal mobile-responsive pattern
- Lesson 80: TopBar search collapses to icon on mobile
- Lesson 81: No transition: all in CSS
- Lesson 82: Bun PATH setup on devserver01

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:50:55 +00:00
a955888acf chore: clean up root directory — archive completed docs, add marketing assets
Move 9 completed/historical docs from root to docs/archive/:
- ARCHITECTURE.md, BACKLOG.md, CLAUDE-SETUP.md, MICHAEL-NOTES.md
- IMPLEMENTATION-SUMMARY-ISSUE-34.md, PHASE-2.5-PERSONAL-BRANCHING.md
- REBRAND-IMPLEMENTATION-GUIDE.md, TS-EXAMPLES.md, WORKSPACE-REMOVAL-PLAN.md

Move QUICK-START.md to docs/

Add previously untracked files:
- DEV-ENV.md (devserver01 setup guide)
- docs/marketing/ (one-pager HTML + PDF)
- docs/ResolutionFlow_Pivot_Architecture.docx

Update CLAUDE.md rebrand guide reference path.

Deleted temp files: .temp_fixed.py, .temp_fixed2.py, ai_provider_*.py,
ai_provider.patch, test_write.txt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:12:07 +00:00
chihlasm
0c51198556 fix(landing): design audit fixes — hamburger menu, dead links, branding, spacing (#117)
* fix(landing): design audit fixes — hamburger menu, dead links, branding, spacing

- Add mobile hamburger menu with animated open/close and click-outside dismiss
- Create Privacy and Terms pages (footer links were dead # anchors)
- Change "Decision Tree Platform" to "AI-Powered Troubleshooting for MSPs" on login, register, and HTML title
- Fix register page icon color (was red/coral via CSS invert, now uses BrandLogo directly)
- Replace "0 Ticket Notes Written by Hand" stat with "100% Auto-Generated Documentation"
- Increase nav link touch targets to 44px minimum
- Fix heading hierarchy: section titles are now <h2>, standardize H3 to 1.25rem
- Tighten section spacing (6rem → 4rem padding, remove extra 5rem spacer)
- Add color-scheme: dark to HTML element
- Replace all transition: all with specific properties (10 occurrences)
- Fix loading ellipsis (... → …)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(mobile): responsive modals + landing preview overflow

- PrepareSessionModal: bottom-sheet on mobile, centered on desktop
- IntakeFormModal: bottom-sheet on mobile, responsive padding
- ShareTreeModal: bottom-sheet on mobile, full-width on small screens
- Landing preview: hide URL bar and window controls on mobile (<900px)
  to prevent 189px horizontal overflow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(mobile): collapse search bar to icon on mobile

On mobile (<640px), the full search bar with placeholder text and ⌘K
badge was taking too much space in the topbar. Now shows just a
magnifying glass icon that opens the same command palette on tap.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: chihlasm <michael@resolutionflow.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 09:55:37 -04:00
9298f5a272 docs: add gstack section to CLAUDE.md
Use /browse for all web browsing, lists available gstack skills.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 05:47:11 +00:00
chihlasm
976cf04365 Merge pull request #116 from patherly/feat/flowpilot-ai-session
feat: FlowPilot AI — Phases 4 & 5 (Gallery, Export, Responsive, Enterprise, Analytics)
2026-03-21 01:15:51 -04:00
ba4be31786 docs: update CLAUDE.md with lessons 72-77 and dashboard patterns
Added lessons for varchar(30) status column, get_db rollback, action
bar height chain, dashboard prefill auto-submit, navigation guard,
and manual Alembic migration preference. Updated project structure
and frontend patterns for new dashboard cockpit and sidebar sections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 05:15:44 +00:00
a7b916116d fix(escalations): fall back to account_id when team_id is null
Users without team_id (solo accounts, pro plans) couldn't see
escalations because the query filtered by team_id which was NULL.
Now falls back to account_id scoping for both the escalation queue
endpoint and the sidebar badge count.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 05:04:47 +00:00
cf23107735 fix(escalations): add sidebar badge count + show all team escalations
- Add escalation_count to sidebar stats (team-wide requesting_escalation)
- Show badge on Escalations nav item in sidebar
- Remove user_id filter from escalation queue — show all team escalations
  including your own (needed for solo users and visibility)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 04:41:27 +00:00
79358be90f fix(escalation): use User.name not display_name — attribute doesn't exist
User model has 'name', not 'display_name'. Fixed in flowpilot_engine
(escalate notify + pickup briefing) and psa_documentation_service
(engineer name in exported docs).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 04:09:54 +00:00
10cf5f45eb refactor: consolidate LLM JSON parsing into shared llm_utils module
Extracted duplicate _strip_markdown_fences / _parse_llm_json functions
from 7 files into app/services/llm_utils.py. Two shared functions:
- strip_markdown_fences(): fence stripping only
- parse_llm_json(): fence stripping + JSON parse + error logging

Files updated: flowpilot_engine, knowledge_flywheel, session_to_flow_service,
ai_tree_generator_service, ai_fix_service, ai_chat_service, kb_conversion_service

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 03:25:25 +00:00
0a77215fac fix(db): widen ai_sessions.status column from varchar(20) to varchar(30)
'requesting_escalation' is 23 characters, exceeding the varchar(20)
limit. This caused a StringDataRightTruncationError 500 on escalate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 01:23:33 +00:00
60334cde93 fix(db): add rollback on exception in get_db dependency
Prevents InFailedSQLTransaction cascade — when a request fails mid-
transaction, the connection is rolled back before being returned to
the pool, so subsequent requests on the same connection don't inherit
a poisoned transaction state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 01:10:07 +00:00
7c3be84b52 feat(flowpilot): add navigation guard for active sessions
Shows a confirmation modal when user tries to navigate away during an
active troubleshooting session. Options: "Stay in Session" or "Pause &
Leave" which auto-pauses the session before navigating.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 00:44:48 +00:00
60b380ae1e fix(dashboard): auto-submit FlowPilot session when prefill from dashboard
When user types a problem on the dashboard and hits Enter, skip the
intake form and start the session immediately — no double-enter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 00:18:43 +00:00
3d911d2dc9 feat(dashboard): FlowPilot cockpit dashboard + sidebar redesign
- Replace QuickStartPage with FlowPilot-centric dashboard
- Add StartSessionInput with Guided/Chat mode toggle
- Add PendingEscalations, ActiveFlowPilotSessions, PerformanceCards
- Add KnowledgeBaseCards, TeamSummary, RecentFlowPilotSessions
- Every number/card is a portal to its detail page
- Restructure sidebar: Resolve/Knowledge/Insights sections
- Remove redundant nav items (FlowPilot, Flow Editor, Flow Assist, etc.)
- Wire prefill from dashboard input to FlowPilot intake
- Update mobile nav to match new sidebar structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 14:22:50 +00:00
6122dda71d fix(flowpilot): extract _build_session_detail helper, fix link_ticket 500
The same model_validate bug existed in link_ticket endpoint (line 467).
Extracted the manual AISessionDetail construction into a shared helper
_build_session_detail() used by both get_session and link_ticket.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 06:28:11 +00:00
0118b80b63 fix(flowpilot): fix session detail 500 — build AISessionDetail manually
Root cause: AISessionDetail.model_validate(session) tried to validate the
ORM relationship 'steps' which has field 'id', but AISessionStepResponse
expects 'step_id'. This caused a Pydantic ValidationError on every session
detail load.

Fix: Construct AISessionDetail manually from ORM fields, passing the
already-built step_responses list directly instead of relying on
model_validate to serialize the ORM steps relationship.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 06:25:57 +00:00
5eeff0c83a debug: add detailed error reporting for session detail serialization
Temporary debug commit — surfaces the actual exception when GET /ai-sessions/{id}
fails with 500, instead of generic "Internal server error" from middleware.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 06:20:27 +00:00
7518fe643b fix(cors): return proper responses from middleware instead of re-raising
Root cause: Both RequestLoggingMiddleware and ErrorLoggingMiddleware used
BaseHTTPMiddleware and re-raised exceptions. When an exception (like a 401
from auth) was re-raised, the response never flowed back through
CORSMiddleware, so browsers received error responses without CORS headers.
This made 401 errors appear as CORS errors, breaking session resume and
other operations after token expiry.

Fix: Both middlewares now catch exceptions and return JSONResponse objects
(with correct status codes from HTTPException) instead of re-raising. This
ensures responses always flow through CORSMiddleware and receive proper
Access-Control-Allow-Origin headers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 06:05:20 +00:00
9d202c67f2 fix(flowpilot): make action bar fixed to viewport bottom
Previous approach tried to fix the flex height chain, but it proved fragile
across grid → main → outlet → page transitions. New approach: action bar is
position:fixed at the bottom of the viewport, offset by sidebar width via
CSS variable --sidebar-w. Conversation area has pb-20 for clearance.

This works regardless of the height chain, email verification banner,
or any other variable-height elements above the session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 06:00:11 +00:00
09a42a943a fix(flowpilot): use calc(100vh-56px) for session page height — matches tree editor pattern
The flex height chain through grid → main → outlet → page doesn't reliably
constrain height, causing the action bar to overflow below viewport. The tree
editor already solves this with h-[calc(100vh-56px)] (subtracting the topbar).
Apply the same proven pattern to FlowPilotSessionPage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 05:50:49 +00:00
d3211c3d24 fix(layout): add min-h-0 to main-content — prevents grid overflow
Root cause found via DOM inspection: main-content (a CSS grid item) had
default min-height:auto, which prevented the grid from constraining it
below its content height. Content grew to 994px in a 975px viewport,
pushing the FlowPilot action bar (Resolve/Escalate/Pause) 75px below
the visible area. overflow:hidden on the grid clipped it invisibly.

Fix: min-h-0 on main-content allows the grid to shrink it to fit,
completing the height chain all the way down to the action bar.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 05:37:16 +00:00
5fa9c57c17 fix(layout): add flex flex-col to ViewTransitionOutlet — fixes action bar visibility
Root cause: ViewTransitionOutlet wrapping <Outlet> had flex-1 min-h-0 but
display:block (no flex flex-col). Child pages using h-full flex-col couldn't
resolve height against a block parent, so content overflowed and the
FlowPilot action bar (Resolve/Escalate/Pause) rendered below the viewport.

Fix: Add flex flex-col to the outlet wrapper so the full flex height chain
works: app-shell grid → main flex-col → outlet flex-col → page flex-col.

Also removed the h-0 workaround from FlowPilotSessionPage since this
addresses the actual root cause.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 05:29:33 +00:00