@aion0/forge 0.5.26 โ†’ 0.5.28

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 (255) hide show
  1. package/.forge/worktrees/pipeline-4dd8dc2d/CLAUDE.md +86 -0
  2. package/.forge/worktrees/pipeline-4dd8dc2d/README.md +136 -0
  3. package/.forge/worktrees/pipeline-4dd8dc2d/RELEASE_NOTES.md +36 -0
  4. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/agents/route.ts +17 -0
  5. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/auth/[...nextauth]/route.ts +3 -0
  6. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/auth/verify/route.ts +46 -0
  7. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/claude/[id]/route.ts +31 -0
  8. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/claude/[id]/stream/route.ts +63 -0
  9. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/claude/route.ts +28 -0
  10. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/claude-sessions/[projectName]/entries/route.ts +23 -0
  11. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/claude-sessions/[projectName]/live/route.ts +72 -0
  12. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/claude-sessions/[projectName]/route.ts +37 -0
  13. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/claude-sessions/sync/route.ts +17 -0
  14. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/claude-templates/route.ts +145 -0
  15. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/code/route.ts +299 -0
  16. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/delivery/[id]/route.ts +62 -0
  17. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/delivery/route.ts +40 -0
  18. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/detect-cli/route.ts +46 -0
  19. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/docs/route.ts +176 -0
  20. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/docs/sessions/route.ts +54 -0
  21. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/favorites/route.ts +26 -0
  22. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/flows/route.ts +6 -0
  23. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/flows/run/route.ts +19 -0
  24. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/git/route.ts +149 -0
  25. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/help/route.ts +84 -0
  26. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/issue-scanner/route.ts +116 -0
  27. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/logs/route.ts +100 -0
  28. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/mobile-chat/route.ts +115 -0
  29. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/monitor/route.ts +74 -0
  30. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/notifications/route.ts +42 -0
  31. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/notify/test/route.ts +33 -0
  32. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/online/route.ts +40 -0
  33. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/pipelines/[id]/route.ts +41 -0
  34. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/pipelines/route.ts +90 -0
  35. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/plugins/route.ts +75 -0
  36. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/preview/[...path]/route.ts +64 -0
  37. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/preview/route.ts +156 -0
  38. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/project-pipelines/route.ts +91 -0
  39. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/project-sessions/route.ts +61 -0
  40. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/projects/route.ts +26 -0
  41. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/sessions/[id]/chat/route.ts +64 -0
  42. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/sessions/[id]/messages/route.ts +9 -0
  43. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/sessions/[id]/route.ts +17 -0
  44. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/sessions/route.ts +20 -0
  45. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/settings/route.ts +64 -0
  46. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/skills/local/route.ts +228 -0
  47. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/skills/route.ts +182 -0
  48. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/smith-templates/route.ts +81 -0
  49. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/status/route.ts +12 -0
  50. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/tabs/route.ts +25 -0
  51. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/tasks/[id]/route.ts +51 -0
  52. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/tasks/[id]/stream/route.ts +77 -0
  53. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/tasks/link/route.ts +37 -0
  54. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/tasks/route.ts +44 -0
  55. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/tasks/session/route.ts +14 -0
  56. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/telegram/route.ts +23 -0
  57. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/templates/route.ts +6 -0
  58. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/terminal-bell/route.ts +39 -0
  59. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/terminal-cwd/route.ts +19 -0
  60. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/terminal-state/route.ts +15 -0
  61. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/tunnel/route.ts +26 -0
  62. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/upgrade/route.ts +43 -0
  63. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/usage/route.ts +20 -0
  64. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/version/route.ts +78 -0
  65. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/watchers/route.ts +33 -0
  66. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/workspace/[id]/agents/route.ts +35 -0
  67. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/workspace/[id]/memory/route.ts +23 -0
  68. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/workspace/[id]/smith/route.ts +22 -0
  69. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/workspace/[id]/stream/route.ts +31 -0
  70. package/.forge/worktrees/pipeline-4dd8dc2d/app/api/workspace/route.ts +79 -0
  71. package/.forge/worktrees/pipeline-4dd8dc2d/app/global-error.tsx +21 -0
  72. package/.forge/worktrees/pipeline-4dd8dc2d/app/globals.css +52 -0
  73. package/.forge/worktrees/pipeline-4dd8dc2d/app/icon.ico +0 -0
  74. package/.forge/worktrees/pipeline-4dd8dc2d/app/icon.png +0 -0
  75. package/.forge/worktrees/pipeline-4dd8dc2d/app/icon.svg +106 -0
  76. package/.forge/worktrees/pipeline-4dd8dc2d/app/layout.tsx +17 -0
  77. package/.forge/worktrees/pipeline-4dd8dc2d/app/login/LoginForm.tsx +96 -0
  78. package/.forge/worktrees/pipeline-4dd8dc2d/app/login/page.tsx +10 -0
  79. package/.forge/worktrees/pipeline-4dd8dc2d/app/mobile/page.tsx +10 -0
  80. package/.forge/worktrees/pipeline-4dd8dc2d/app/page.tsx +22 -0
  81. package/.forge/worktrees/pipeline-4dd8dc2d/bin/forge-server.mjs +484 -0
  82. package/.forge/worktrees/pipeline-4dd8dc2d/check-forge-status.sh +71 -0
  83. package/.forge/worktrees/pipeline-4dd8dc2d/cli/mw.ts +579 -0
  84. package/.forge/worktrees/pipeline-4dd8dc2d/components/BrowserPanel.tsx +175 -0
  85. package/.forge/worktrees/pipeline-4dd8dc2d/components/ChatPanel.tsx +191 -0
  86. package/.forge/worktrees/pipeline-4dd8dc2d/components/ClaudeTerminal.tsx +267 -0
  87. package/.forge/worktrees/pipeline-4dd8dc2d/components/CodeViewer.tsx +787 -0
  88. package/.forge/worktrees/pipeline-4dd8dc2d/components/ConversationEditor.tsx +411 -0
  89. package/.forge/worktrees/pipeline-4dd8dc2d/components/ConversationGraphView.tsx +347 -0
  90. package/.forge/worktrees/pipeline-4dd8dc2d/components/ConversationTerminalView.tsx +303 -0
  91. package/.forge/worktrees/pipeline-4dd8dc2d/components/Dashboard.tsx +807 -0
  92. package/.forge/worktrees/pipeline-4dd8dc2d/components/DashboardWrapper.tsx +9 -0
  93. package/.forge/worktrees/pipeline-4dd8dc2d/components/DeliveryFlowEditor.tsx +491 -0
  94. package/.forge/worktrees/pipeline-4dd8dc2d/components/DeliveryList.tsx +230 -0
  95. package/.forge/worktrees/pipeline-4dd8dc2d/components/DeliveryWorkspace.tsx +589 -0
  96. package/.forge/worktrees/pipeline-4dd8dc2d/components/DocTerminal.tsx +187 -0
  97. package/.forge/worktrees/pipeline-4dd8dc2d/components/DocsViewer.tsx +574 -0
  98. package/.forge/worktrees/pipeline-4dd8dc2d/components/HelpDialog.tsx +169 -0
  99. package/.forge/worktrees/pipeline-4dd8dc2d/components/HelpTerminal.tsx +141 -0
  100. package/.forge/worktrees/pipeline-4dd8dc2d/components/InlinePipelineView.tsx +111 -0
  101. package/.forge/worktrees/pipeline-4dd8dc2d/components/LogViewer.tsx +194 -0
  102. package/.forge/worktrees/pipeline-4dd8dc2d/components/MarkdownContent.tsx +73 -0
  103. package/.forge/worktrees/pipeline-4dd8dc2d/components/MobileView.tsx +385 -0
  104. package/.forge/worktrees/pipeline-4dd8dc2d/components/MonitorPanel.tsx +122 -0
  105. package/.forge/worktrees/pipeline-4dd8dc2d/components/NewSessionModal.tsx +93 -0
  106. package/.forge/worktrees/pipeline-4dd8dc2d/components/NewTaskModal.tsx +492 -0
  107. package/.forge/worktrees/pipeline-4dd8dc2d/components/PipelineEditor.tsx +570 -0
  108. package/.forge/worktrees/pipeline-4dd8dc2d/components/PipelineView.tsx +1018 -0
  109. package/.forge/worktrees/pipeline-4dd8dc2d/components/PluginsPanel.tsx +472 -0
  110. package/.forge/worktrees/pipeline-4dd8dc2d/components/ProjectDetail.tsx +1618 -0
  111. package/.forge/worktrees/pipeline-4dd8dc2d/components/ProjectList.tsx +108 -0
  112. package/.forge/worktrees/pipeline-4dd8dc2d/components/ProjectManager.tsx +401 -0
  113. package/.forge/worktrees/pipeline-4dd8dc2d/components/SessionList.tsx +74 -0
  114. package/.forge/worktrees/pipeline-4dd8dc2d/components/SessionView.tsx +726 -0
  115. package/.forge/worktrees/pipeline-4dd8dc2d/components/SettingsModal.tsx +1647 -0
  116. package/.forge/worktrees/pipeline-4dd8dc2d/components/SkillsPanel.tsx +969 -0
  117. package/.forge/worktrees/pipeline-4dd8dc2d/components/StatusBar.tsx +99 -0
  118. package/.forge/worktrees/pipeline-4dd8dc2d/components/TabBar.tsx +46 -0
  119. package/.forge/worktrees/pipeline-4dd8dc2d/components/TaskBoard.tsx +113 -0
  120. package/.forge/worktrees/pipeline-4dd8dc2d/components/TaskDetail.tsx +372 -0
  121. package/.forge/worktrees/pipeline-4dd8dc2d/components/TerminalLauncher.tsx +398 -0
  122. package/.forge/worktrees/pipeline-4dd8dc2d/components/TunnelToggle.tsx +206 -0
  123. package/.forge/worktrees/pipeline-4dd8dc2d/components/UsagePanel.tsx +207 -0
  124. package/.forge/worktrees/pipeline-4dd8dc2d/components/WebTerminal.tsx +1743 -0
  125. package/.forge/worktrees/pipeline-4dd8dc2d/components/WorkspaceTree.tsx +221 -0
  126. package/.forge/worktrees/pipeline-4dd8dc2d/components/WorkspaceView.tsx +4048 -0
  127. package/.forge/worktrees/pipeline-4dd8dc2d/dev-test.sh +5 -0
  128. package/.forge/worktrees/pipeline-4dd8dc2d/docs/Forge_Memory_Layer_Design.docx +0 -0
  129. package/.forge/worktrees/pipeline-4dd8dc2d/docs/Forge_Strategy_Research_2026.docx +0 -0
  130. package/.forge/worktrees/pipeline-4dd8dc2d/docs/LOCAL-DEPLOY.md +144 -0
  131. package/.forge/worktrees/pipeline-4dd8dc2d/docs/roadmap-multi-agent-workflow.md +330 -0
  132. package/.forge/worktrees/pipeline-4dd8dc2d/forge-logo.png +0 -0
  133. package/.forge/worktrees/pipeline-4dd8dc2d/forge-logo.svg +106 -0
  134. package/.forge/worktrees/pipeline-4dd8dc2d/hooks/useSidebarResize.ts +52 -0
  135. package/.forge/worktrees/pipeline-4dd8dc2d/install.sh +29 -0
  136. package/.forge/worktrees/pipeline-4dd8dc2d/instrumentation.ts +35 -0
  137. package/.forge/worktrees/pipeline-4dd8dc2d/lib/agents/claude-adapter.ts +104 -0
  138. package/.forge/worktrees/pipeline-4dd8dc2d/lib/agents/generic-adapter.ts +64 -0
  139. package/.forge/worktrees/pipeline-4dd8dc2d/lib/agents/index.ts +245 -0
  140. package/.forge/worktrees/pipeline-4dd8dc2d/lib/agents/types.ts +70 -0
  141. package/.forge/worktrees/pipeline-4dd8dc2d/lib/artifacts.ts +106 -0
  142. package/.forge/worktrees/pipeline-4dd8dc2d/lib/auth.ts +62 -0
  143. package/.forge/worktrees/pipeline-4dd8dc2d/lib/builtin-plugins/docker.yaml +70 -0
  144. package/.forge/worktrees/pipeline-4dd8dc2d/lib/builtin-plugins/http.yaml +66 -0
  145. package/.forge/worktrees/pipeline-4dd8dc2d/lib/builtin-plugins/jenkins.yaml +92 -0
  146. package/.forge/worktrees/pipeline-4dd8dc2d/lib/builtin-plugins/llm-vision.yaml +85 -0
  147. package/.forge/worktrees/pipeline-4dd8dc2d/lib/builtin-plugins/playwright.yaml +111 -0
  148. package/.forge/worktrees/pipeline-4dd8dc2d/lib/builtin-plugins/shell-command.yaml +60 -0
  149. package/.forge/worktrees/pipeline-4dd8dc2d/lib/builtin-plugins/slack.yaml +48 -0
  150. package/.forge/worktrees/pipeline-4dd8dc2d/lib/builtin-plugins/webhook.yaml +56 -0
  151. package/.forge/worktrees/pipeline-4dd8dc2d/lib/claude-process.ts +361 -0
  152. package/.forge/worktrees/pipeline-4dd8dc2d/lib/claude-sessions.ts +266 -0
  153. package/.forge/worktrees/pipeline-4dd8dc2d/lib/claude-templates.ts +227 -0
  154. package/.forge/worktrees/pipeline-4dd8dc2d/lib/cloudflared.ts +424 -0
  155. package/.forge/worktrees/pipeline-4dd8dc2d/lib/crypto.ts +67 -0
  156. package/.forge/worktrees/pipeline-4dd8dc2d/lib/delivery.ts +787 -0
  157. package/.forge/worktrees/pipeline-4dd8dc2d/lib/dirs.ts +99 -0
  158. package/.forge/worktrees/pipeline-4dd8dc2d/lib/flows.ts +86 -0
  159. package/.forge/worktrees/pipeline-4dd8dc2d/lib/forge-mcp-server.ts +732 -0
  160. package/.forge/worktrees/pipeline-4dd8dc2d/lib/forge-skills/forge-inbox.md +38 -0
  161. package/.forge/worktrees/pipeline-4dd8dc2d/lib/forge-skills/forge-send.md +47 -0
  162. package/.forge/worktrees/pipeline-4dd8dc2d/lib/forge-skills/forge-status.md +32 -0
  163. package/.forge/worktrees/pipeline-4dd8dc2d/lib/forge-skills/forge-workspace-sync.md +37 -0
  164. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/00-overview.md +40 -0
  165. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/01-settings.md +194 -0
  166. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/02-telegram.md +41 -0
  167. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/03-tunnel.md +31 -0
  168. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/04-tasks.md +52 -0
  169. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/05-pipelines.md +460 -0
  170. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/06-skills.md +43 -0
  171. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/07-projects.md +73 -0
  172. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/08-rules.md +53 -0
  173. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/09-issue-autofix.md +55 -0
  174. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/10-troubleshooting.md +89 -0
  175. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/11-workspace.md +810 -0
  176. package/.forge/worktrees/pipeline-4dd8dc2d/lib/help-docs/CLAUDE.md +62 -0
  177. package/.forge/worktrees/pipeline-4dd8dc2d/lib/init.ts +266 -0
  178. package/.forge/worktrees/pipeline-4dd8dc2d/lib/issue-scanner.ts +298 -0
  179. package/.forge/worktrees/pipeline-4dd8dc2d/lib/logger.ts +79 -0
  180. package/.forge/worktrees/pipeline-4dd8dc2d/lib/notifications.ts +75 -0
  181. package/.forge/worktrees/pipeline-4dd8dc2d/lib/notify.ts +108 -0
  182. package/.forge/worktrees/pipeline-4dd8dc2d/lib/password.ts +97 -0
  183. package/.forge/worktrees/pipeline-4dd8dc2d/lib/pipeline-scheduler.ts +373 -0
  184. package/.forge/worktrees/pipeline-4dd8dc2d/lib/pipeline.ts +1565 -0
  185. package/.forge/worktrees/pipeline-4dd8dc2d/lib/plugins/executor.ts +347 -0
  186. package/.forge/worktrees/pipeline-4dd8dc2d/lib/plugins/registry.ts +228 -0
  187. package/.forge/worktrees/pipeline-4dd8dc2d/lib/plugins/types.ts +103 -0
  188. package/.forge/worktrees/pipeline-4dd8dc2d/lib/project-sessions.ts +53 -0
  189. package/.forge/worktrees/pipeline-4dd8dc2d/lib/projects.ts +86 -0
  190. package/.forge/worktrees/pipeline-4dd8dc2d/lib/session-manager.ts +156 -0
  191. package/.forge/worktrees/pipeline-4dd8dc2d/lib/session-utils.ts +53 -0
  192. package/.forge/worktrees/pipeline-4dd8dc2d/lib/session-watcher.ts +345 -0
  193. package/.forge/worktrees/pipeline-4dd8dc2d/lib/settings.ts +195 -0
  194. package/.forge/worktrees/pipeline-4dd8dc2d/lib/skills.ts +458 -0
  195. package/.forge/worktrees/pipeline-4dd8dc2d/lib/task-manager.ts +951 -0
  196. package/.forge/worktrees/pipeline-4dd8dc2d/lib/telegram-bot.ts +1477 -0
  197. package/.forge/worktrees/pipeline-4dd8dc2d/lib/telegram-standalone.ts +83 -0
  198. package/.forge/worktrees/pipeline-4dd8dc2d/lib/terminal-server.ts +70 -0
  199. package/.forge/worktrees/pipeline-4dd8dc2d/lib/terminal-standalone.ts +438 -0
  200. package/.forge/worktrees/pipeline-4dd8dc2d/lib/usage-scanner.ts +249 -0
  201. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/__tests__/state-machine.test.ts +388 -0
  202. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/__tests__/workspace.test.ts +311 -0
  203. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/agent-bus.ts +416 -0
  204. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/agent-worker.ts +655 -0
  205. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/backends/api-backend.ts +262 -0
  206. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/backends/cli-backend.ts +491 -0
  207. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/index.ts +84 -0
  208. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/manager.ts +136 -0
  209. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/orchestrator.ts +3415 -0
  210. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/persistence.ts +309 -0
  211. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/presets.ts +649 -0
  212. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/requests.ts +287 -0
  213. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/session-monitor.ts +240 -0
  214. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/skill-installer.ts +275 -0
  215. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/smith-memory.ts +498 -0
  216. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/types.ts +241 -0
  217. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace/watch-manager.ts +560 -0
  218. package/.forge/worktrees/pipeline-4dd8dc2d/lib/workspace-standalone.ts +978 -0
  219. package/.forge/worktrees/pipeline-4dd8dc2d/middleware.ts +51 -0
  220. package/.forge/worktrees/pipeline-4dd8dc2d/next.config.ts +26 -0
  221. package/.forge/worktrees/pipeline-4dd8dc2d/package.json +74 -0
  222. package/.forge/worktrees/pipeline-4dd8dc2d/pnpm-lock.yaml +3719 -0
  223. package/.forge/worktrees/pipeline-4dd8dc2d/pnpm-workspace.yaml +1 -0
  224. package/.forge/worktrees/pipeline-4dd8dc2d/postcss.config.mjs +7 -0
  225. package/.forge/worktrees/pipeline-4dd8dc2d/publish.sh +133 -0
  226. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/README.md +66 -0
  227. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/results/.gitignore +2 -0
  228. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/run.ts +635 -0
  229. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/tasks/01-text-utils/task.md +26 -0
  230. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/tasks/01-text-utils/validator.sh +46 -0
  231. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/tasks/02-pagination/setup.sh +19 -0
  232. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/tasks/02-pagination/task.md +48 -0
  233. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/tasks/02-pagination/validator.sh +69 -0
  234. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/tasks/03-bug-fix/setup.sh +82 -0
  235. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/tasks/03-bug-fix/task.md +30 -0
  236. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/bench/tasks/03-bug-fix/validator.sh +29 -0
  237. package/.forge/worktrees/pipeline-4dd8dc2d/scripts/verify-usage.ts +178 -0
  238. package/.forge/worktrees/pipeline-4dd8dc2d/src/config/index.ts +129 -0
  239. package/.forge/worktrees/pipeline-4dd8dc2d/src/core/db/database.ts +259 -0
  240. package/.forge/worktrees/pipeline-4dd8dc2d/src/core/memory/strategy.ts +32 -0
  241. package/.forge/worktrees/pipeline-4dd8dc2d/src/core/providers/chat.ts +65 -0
  242. package/.forge/worktrees/pipeline-4dd8dc2d/src/core/providers/registry.ts +60 -0
  243. package/.forge/worktrees/pipeline-4dd8dc2d/src/core/session/manager.ts +190 -0
  244. package/.forge/worktrees/pipeline-4dd8dc2d/src/types/index.ts +129 -0
  245. package/.forge/worktrees/pipeline-4dd8dc2d/start.sh +32 -0
  246. package/.forge/worktrees/pipeline-4dd8dc2d/templates/smith-lead.json +45 -0
  247. package/.forge/worktrees/pipeline-4dd8dc2d/tsconfig.json +42 -0
  248. package/RELEASE_NOTES.md +10 -29
  249. package/app/api/terminal-bell/route.ts +6 -2
  250. package/app/api/terminal-cwd/route.ts +7 -4
  251. package/components/CodeViewer.tsx +3 -31
  252. package/components/Dashboard.tsx +34 -20
  253. package/components/WebTerminal.tsx +36 -2
  254. package/lib/terminal-standalone.ts +19 -2
  255. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+
3
+ import dynamic from 'next/dynamic';
4
+
5
+ const Dashboard = dynamic(() => import('./Dashboard'), { ssr: false });
6
+
7
+ export default function DashboardWrapper({ user }: { user: any }) {
8
+ return <Dashboard user={user} />;
9
+ }
@@ -0,0 +1,491 @@
1
+ 'use client';
2
+
3
+ import { useState, useCallback, useEffect, useRef } from 'react';
4
+ import {
5
+ ReactFlow,
6
+ Background,
7
+ Controls,
8
+ addEdge,
9
+ useNodesState,
10
+ useEdgesState,
11
+ Handle,
12
+ Position,
13
+ type Node,
14
+ type Edge,
15
+ type Connection,
16
+ type NodeProps,
17
+ MarkerType,
18
+ } from '@xyflow/react';
19
+ import '@xyflow/react/dist/style.css';
20
+
21
+ // โ”€โ”€โ”€ Types โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
22
+
23
+ interface RolePreset {
24
+ id: string;
25
+ label: string;
26
+ icon: string;
27
+ role: string;
28
+ inputArtifactTypes: string[];
29
+ outputArtifactName: string;
30
+ outputArtifactType: string;
31
+ waitForHuman?: boolean;
32
+ }
33
+
34
+ export interface PhaseOutput {
35
+ name: string;
36
+ label: string;
37
+ icon: string;
38
+ role: string;
39
+ agentId: string;
40
+ inputArtifactTypes: string[];
41
+ outputArtifactName: string;
42
+ outputArtifactType: string;
43
+ waitForHuman: boolean;
44
+ dependsOn: string[];
45
+ requires: string[]; // artifact names needed before starting
46
+ produces: string[]; // artifact names this phase outputs
47
+ }
48
+
49
+ // โ”€โ”€โ”€ Colors โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
50
+
51
+ const ROLE_COLORS: Record<string, { bg: string; border: string; accent: string }> = {
52
+ pm: { bg: '#1a2a1a', border: '#22c55e', accent: '#4ade80' },
53
+ engineer: { bg: '#1e2a4a', border: '#3b82f6', accent: '#60a5fa' },
54
+ qa: { bg: '#2a1e4a', border: '#8b5cf6', accent: '#a78bfa' },
55
+ reviewer: { bg: '#3a2a1e', border: '#f97316', accent: '#fb923c' },
56
+ devops: { bg: '#1e3a3a', border: '#06b6d4', accent: '#22d3ee' },
57
+ security: { bg: '#3a1e2a', border: '#ec4899', accent: '#f472b6' },
58
+ docs: { bg: '#2a2a1e', border: '#eab308', accent: '#facc15' },
59
+ custom: { bg: '#1a1a2a', border: '#6b7280', accent: '#9ca3af' },
60
+ };
61
+
62
+ function getColor(presetId: string) {
63
+ return ROLE_COLORS[presetId] || ROLE_COLORS.custom;
64
+ }
65
+
66
+ // โ”€โ”€โ”€ Custom Node โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
67
+
68
+ interface RoleNodeData {
69
+ label: string;
70
+ icon: string;
71
+ presetId: string;
72
+ agentId: string;
73
+ role: string;
74
+ waitForHuman: boolean;
75
+ outputArtifactName: string;
76
+ onEdit: (id: string) => void;
77
+ onDelete: (id: string) => void;
78
+ [key: string]: unknown;
79
+ }
80
+
81
+ function RoleNode({ id, data }: NodeProps<Node<RoleNodeData>>) {
82
+ const c = getColor(data.presetId);
83
+ // inputArtifacts comes from edges (resolved in parent), stored in data
84
+ const inputs: string[] = (data as any).inputArtifacts || [];
85
+
86
+ return (
87
+ <div className="rounded-xl shadow-lg" style={{ background: c.bg, border: `2px solid ${c.border}`, minWidth: 220 }}>
88
+ {/* Input handle + input artifacts */}
89
+ <Handle type="target" position={Position.Top} className="!w-3 !h-3" style={{ background: c.accent }} />
90
+ {inputs.length > 0 && (
91
+ <div className="px-3 pt-1 flex flex-wrap gap-1">
92
+ {inputs.map((name, i) => (
93
+ <span key={i} className="text-[7px] px-1 py-0.5 rounded bg-white/5 text-gray-400">โฌ‡ {name}</span>
94
+ ))}
95
+ </div>
96
+ )}
97
+
98
+ {/* Header */}
99
+ <div className="px-3 py-1.5 flex items-center gap-2" style={{ borderBottom: `1px solid ${c.border}40` }}>
100
+ <span className="text-sm">{data.icon}</span>
101
+ <span className="text-[11px] font-bold text-white">{data.label}</span>
102
+ <span className="text-[8px] px-1 py-0.5 rounded" style={{ background: c.accent + '30', color: c.accent }}>{data.agentId}</span>
103
+ {data.waitForHuman && <span className="text-[7px] px-1 py-0.5 rounded bg-yellow-500/20 text-yellow-400">โธ approval</span>}
104
+ <div className="ml-auto flex gap-1">
105
+ <button onClick={() => data.onEdit(id)} className="text-[9px] hover:text-white" style={{ color: c.accent }}>edit</button>
106
+ <button onClick={() => data.onDelete(id)} className="text-[9px] text-red-400 hover:text-red-300">ร—</button>
107
+ </div>
108
+ </div>
109
+
110
+ {/* Role description */}
111
+ <div className="px-3 py-1">
112
+ <div className="text-[8px] text-gray-500 line-clamp-2">{data.role.slice(0, 80)}{data.role.length > 80 ? '...' : ''}</div>
113
+ </div>
114
+
115
+ {/* Output artifact */}
116
+ <div className="px-3 pb-1.5">
117
+ <div className="text-[7px] px-1.5 py-0.5 rounded inline-flex items-center gap-1" style={{ background: c.accent + '15', color: c.accent, border: `1px solid ${c.accent}30` }}>
118
+ โฌ† {data.outputArtifactName || 'output.md'}
119
+ </div>
120
+ </div>
121
+
122
+ <Handle type="source" position={Position.Bottom} className="!w-3 !h-3" style={{ background: c.accent }} />
123
+ </div>
124
+ );
125
+ }
126
+
127
+ const nodeTypes = { role: RoleNode };
128
+
129
+ // โ”€โ”€โ”€ Edit Modal โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
130
+
131
+ function EditModal({ node, agents, onSave, onClose }: {
132
+ node: { id: string; label: string; icon: string; presetId: string; agentId: string; role: string; waitForHuman: boolean; outputArtifactName: string };
133
+ agents: { id: string; name: string }[];
134
+ onSave: (data: typeof node) => void;
135
+ onClose: () => void;
136
+ }) {
137
+ const [form, setForm] = useState({ ...node });
138
+
139
+ return (
140
+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60" onClick={onClose}>
141
+ <div className="bg-[#1a1a2a] border border-[#3a3a5a] rounded-xl p-4 w-[420px] space-y-3" onClick={e => e.stopPropagation()}>
142
+ <div className="text-sm font-bold text-white flex items-center gap-2">
143
+ <span>{form.icon}</span> Edit Role
144
+ </div>
145
+
146
+ <div className="grid grid-cols-2 gap-2">
147
+ <div>
148
+ <label className="text-[9px] text-gray-400">Label</label>
149
+ <input value={form.label} onChange={e => setForm(f => ({ ...f, label: e.target.value }))}
150
+ className="w-full text-xs bg-[#0d1117] border border-[#30363d] rounded px-2 py-1.5 text-white" />
151
+ </div>
152
+ <div>
153
+ <label className="text-[9px] text-gray-400">Agent</label>
154
+ <select value={form.agentId} onChange={e => setForm(f => ({ ...f, agentId: e.target.value }))}
155
+ className="w-full text-xs bg-[#0d1117] border border-[#30363d] rounded px-2 py-1.5 text-white">
156
+ {agents.map(a => <option key={a.id} value={a.id}>{a.name || a.id}</option>)}
157
+ </select>
158
+ </div>
159
+ </div>
160
+
161
+ <div>
162
+ <label className="text-[9px] text-gray-400">Role Description (system prompt)</label>
163
+ <textarea value={form.role} onChange={e => setForm(f => ({ ...f, role: e.target.value }))}
164
+ className="w-full text-xs bg-[#0d1117] border border-[#30363d] rounded px-2 py-1.5 text-gray-300 resize-none"
165
+ rows={4} />
166
+ </div>
167
+
168
+ <div className="grid grid-cols-2 gap-2">
169
+ <div>
170
+ <label className="text-[9px] text-gray-400">Output artifact</label>
171
+ <input value={form.outputArtifactName} onChange={e => setForm(f => ({ ...f, outputArtifactName: e.target.value }))}
172
+ className="w-full text-xs bg-[#0d1117] border border-[#30363d] rounded px-2 py-1.5 text-gray-300" />
173
+ </div>
174
+ <div className="flex items-end pb-1">
175
+ <label className="flex items-center gap-1.5 text-[10px] text-gray-400 cursor-pointer">
176
+ <input type="checkbox" checked={form.waitForHuman} onChange={e => setForm(f => ({ ...f, waitForHuman: e.target.checked }))}
177
+ className="accent-yellow-500" />
178
+ Require approval
179
+ </label>
180
+ </div>
181
+ </div>
182
+
183
+ <div className="flex justify-end gap-2 pt-1">
184
+ <button onClick={onClose} className="text-xs px-3 py-1 text-gray-400 hover:text-white">Cancel</button>
185
+ <button onClick={() => onSave(form)} className="text-xs px-3 py-1 bg-green-600 text-white rounded hover:opacity-90">Save</button>
186
+ </div>
187
+ </div>
188
+ </div>
189
+ );
190
+ }
191
+
192
+ // โ”€โ”€โ”€ Main Component โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
193
+
194
+ export default function DeliveryFlowEditor({ presets, agents, initialPhases, onChange }: {
195
+ presets: RolePreset[];
196
+ agents: { id: string; name: string }[];
197
+ initialPhases?: PhaseOutput[];
198
+ onChange: (phases: PhaseOutput[]) => void;
199
+ }) {
200
+ const [nodes, setNodes, onNodesChange] = useNodesState<Node<RoleNodeData>>([]);
201
+ const [edges, setEdges, onEdgesChange] = useEdgesState<Edge>([]);
202
+ const [editing, setEditing] = useState<string | null>(null);
203
+ const nextId = useRef(1);
204
+
205
+ // Initialize with defaults
206
+ useEffect(() => {
207
+ if (nodes.length > 0) return;
208
+ const defaults = initialPhases || presets.filter(p => ['pm', 'engineer', 'qa', 'reviewer'].includes(p.id));
209
+ const initNodes: Node<RoleNodeData>[] = defaults.map((p, i) => {
210
+ const preset = 'presetId' in p ? p : presets.find(pr => pr.id === (p as any).name) || p;
211
+ const presetId = (preset as any).presetId || (preset as any).id || 'custom';
212
+ return {
213
+ id: `role-${i}`,
214
+ type: 'role',
215
+ position: { x: 100 + (i % 2) * 280, y: 50 + Math.floor(i / 2) * 180 },
216
+ data: {
217
+ label: (preset as any).label || (preset as any).name || `Role ${i}`,
218
+ icon: (preset as any).icon || 'โš™',
219
+ presetId,
220
+ agentId: (p as any).agentId || 'claude',
221
+ role: (preset as any).role || '',
222
+ waitForHuman: (preset as any).waitForHuman || false,
223
+ outputArtifactName: (preset as any).outputArtifactName || 'output.md',
224
+ onEdit: (id: string) => setEditing(id),
225
+ onDelete: (id: string) => handleDelete(id),
226
+ },
227
+ };
228
+ });
229
+
230
+ // Auto-connect sequentially with artifact labels
231
+ const initEdges: Edge[] = [];
232
+ for (let i = 0; i < initNodes.length - 1; i++) {
233
+ const c = getColor(initNodes[i].data.presetId);
234
+ const artifactName = initNodes[i].data.outputArtifactName || 'output';
235
+ initEdges.push({
236
+ id: `${initNodes[i].id}-${initNodes[i + 1].id}`,
237
+ source: initNodes[i].id,
238
+ target: initNodes[i + 1].id,
239
+ markerEnd: { type: MarkerType.ArrowClosed, color: c.accent },
240
+ style: { stroke: c.accent, strokeWidth: 2 },
241
+ animated: true,
242
+ label: `๐Ÿ“„ ${artifactName}`,
243
+ labelStyle: { fill: c.accent, fontSize: 9, fontWeight: 500 },
244
+ labelBgStyle: { fill: '#0a0a1a', fillOpacity: 0.8 },
245
+ labelBgPadding: [4, 2] as [number, number],
246
+ });
247
+ }
248
+
249
+ nextId.current = initNodes.length;
250
+ setNodes(initNodes);
251
+ setEdges(initEdges);
252
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
253
+
254
+ // Resolve input artifacts from edges and update node data
255
+ useEffect(() => {
256
+ if (nodes.length === 0) return;
257
+
258
+ // Build input map: nodeId โ†’ [artifact names from source nodes]
259
+ const inputMap = new Map<string, string[]>();
260
+ for (const edge of edges) {
261
+ const sourceNode = nodes.find(n => n.id === edge.source);
262
+ if (!sourceNode) continue;
263
+ const existing = inputMap.get(edge.target) || [];
264
+ existing.push(sourceNode.data.outputArtifactName || 'output.md');
265
+ inputMap.set(edge.target, existing);
266
+ }
267
+
268
+ // Update nodes with resolved inputArtifacts
269
+ let changed = false;
270
+ const updated = nodes.map(n => {
271
+ const inputs = inputMap.get(n.id) || [];
272
+ const current = (n.data as any).inputArtifacts || [];
273
+ if (JSON.stringify(inputs) !== JSON.stringify(current)) {
274
+ changed = true;
275
+ return { ...n, data: { ...n.data, inputArtifacts: inputs } };
276
+ }
277
+ return n;
278
+ });
279
+ if (changed) setNodes(updated);
280
+
281
+ // Emit phases to parent
282
+ const output = buildOutput(nodes, edges);
283
+ onChange(output);
284
+ }, [nodes, edges]); // eslint-disable-line react-hooks/exhaustive-deps
285
+
286
+ const onConnect = useCallback((params: Connection) => {
287
+ const sourceNode = nodes.find(n => n.id === params.source);
288
+ const c = sourceNode ? getColor(sourceNode.data.presetId) : ROLE_COLORS.custom;
289
+ const artifactName = sourceNode?.data.outputArtifactName || 'output';
290
+ setEdges(eds => addEdge({
291
+ ...params,
292
+ markerEnd: { type: MarkerType.ArrowClosed, color: c.accent },
293
+ style: { stroke: c.accent, strokeWidth: 2 },
294
+ animated: true,
295
+ label: `๐Ÿ“„ ${artifactName}`,
296
+ labelStyle: { fill: c.accent, fontSize: 9, fontWeight: 500 },
297
+ labelBgStyle: { fill: '#0a0a1a', fillOpacity: 0.8 },
298
+ labelBgPadding: [4, 2] as [number, number],
299
+ }, eds));
300
+ }, [nodes, setEdges]);
301
+
302
+ const handleAddPreset = (preset: RolePreset) => {
303
+ const id = `role-${nextId.current++}`;
304
+ const c = getColor(preset.id);
305
+ setNodes(nds => [...nds, {
306
+ id,
307
+ type: 'role',
308
+ position: { x: 100 + (nds.length % 3) * 240, y: 50 + Math.floor(nds.length / 3) * 180 },
309
+ data: {
310
+ label: preset.label,
311
+ icon: preset.icon,
312
+ presetId: preset.id,
313
+ agentId: 'claude',
314
+ role: preset.role,
315
+ waitForHuman: preset.waitForHuman || false,
316
+ outputArtifactName: preset.outputArtifactName,
317
+ onEdit: (nid: string) => setEditing(nid),
318
+ onDelete: (nid: string) => handleDelete(nid),
319
+ },
320
+ }]);
321
+ };
322
+
323
+ const handleAddCustom = () => {
324
+ const id = `role-${nextId.current++}`;
325
+ setNodes(nds => [...nds, {
326
+ id,
327
+ type: 'role',
328
+ position: { x: 100 + (nds.length % 3) * 240, y: 50 + Math.floor(nds.length / 3) * 180 },
329
+ data: {
330
+ label: 'Custom Agent',
331
+ icon: 'โš™',
332
+ presetId: 'custom',
333
+ agentId: 'claude',
334
+ role: '',
335
+ waitForHuman: false,
336
+ outputArtifactName: 'output.md',
337
+ onEdit: (nid: string) => setEditing(nid),
338
+ onDelete: (nid: string) => handleDelete(nid),
339
+ },
340
+ }]);
341
+ setEditing(id);
342
+ };
343
+
344
+ const handleDelete = useCallback((id: string) => {
345
+ setNodes(nds => nds.filter(n => n.id !== id));
346
+ setEdges(eds => eds.filter(e => e.source !== id && e.target !== id));
347
+ }, [setNodes, setEdges]);
348
+
349
+ const handleSaveEdit = (data: { id: string; label: string; icon: string; presetId: string; agentId: string; role: string; waitForHuman: boolean; outputArtifactName: string }) => {
350
+ setNodes(nds => nds.map(n => {
351
+ if (n.id !== data.id) return n;
352
+ return { ...n, data: { ...n.data, ...data } };
353
+ }));
354
+ // Update edge labels if output artifact changed
355
+ setEdges(eds => eds.map(e => {
356
+ if (e.source !== data.id) return e;
357
+ const c = getColor(data.presetId);
358
+ return {
359
+ ...e,
360
+ label: `๐Ÿ“„ ${data.outputArtifactName || 'output'}`,
361
+ labelStyle: { fill: c.accent, fontSize: 9, fontWeight: 500 },
362
+ };
363
+ }));
364
+ setEditing(null);
365
+ };
366
+
367
+ const editingNode = editing ? nodes.find(n => n.id === editing) : null;
368
+
369
+ return (
370
+ <div className="flex flex-col" style={{ height: 350 }}>
371
+ {/* Toolbar: add from presets */}
372
+ <div className="flex items-center gap-1 px-2 py-1.5 border-b border-[#30363d] bg-[#0d1117] shrink-0 flex-wrap">
373
+ <span className="text-[9px] text-gray-500 mr-1">Add:</span>
374
+ {presets.map(p => (
375
+ <button key={p.id} onClick={() => handleAddPreset(p)}
376
+ className="text-[8px] px-1.5 py-0.5 rounded border border-[#30363d] text-gray-400 hover:text-white hover:border-[var(--accent)] flex items-center gap-0.5">
377
+ <span>{p.icon}</span> {p.label}
378
+ </button>
379
+ ))}
380
+ <button onClick={handleAddCustom}
381
+ className="text-[8px] px-1.5 py-0.5 rounded border border-dashed border-[#30363d] text-gray-500 hover:text-white hover:border-[var(--accent)]">
382
+ + Custom
383
+ </button>
384
+ <span className="text-[7px] text-gray-600 ml-auto">Drag to connect ยท Click edit to configure</span>
385
+ </div>
386
+
387
+ {/* ReactFlow canvas */}
388
+ <div className="flex-1">
389
+ <ReactFlow
390
+ nodes={nodes}
391
+ edges={edges}
392
+ onNodesChange={onNodesChange}
393
+ onEdgesChange={onEdgesChange}
394
+ onConnect={onConnect}
395
+ nodeTypes={nodeTypes}
396
+ fitView
397
+ fitViewOptions={{ padding: 0.3 }}
398
+ deleteKeyCode="Delete"
399
+ style={{ background: '#0a0a1a' }}
400
+ minZoom={0.4}
401
+ maxZoom={2}
402
+ >
403
+ <Background color="#1a1a3a" gap={20} />
404
+ <Controls />
405
+ </ReactFlow>
406
+ </div>
407
+
408
+ {/* Edit modal */}
409
+ {editingNode && (
410
+ <EditModal
411
+ node={{
412
+ id: editingNode.id,
413
+ label: editingNode.data.label,
414
+ icon: editingNode.data.icon,
415
+ presetId: editingNode.data.presetId,
416
+ agentId: editingNode.data.agentId,
417
+ role: editingNode.data.role,
418
+ waitForHuman: editingNode.data.waitForHuman,
419
+ outputArtifactName: editingNode.data.outputArtifactName,
420
+ }}
421
+ agents={agents}
422
+ onSave={handleSaveEdit}
423
+ onClose={() => setEditing(null)}
424
+ />
425
+ )}
426
+ </div>
427
+ );
428
+ }
429
+
430
+ // โ”€โ”€โ”€ Build output from graph โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
431
+
432
+ function buildOutput(nodes: Node<RoleNodeData>[], edges: Edge[]): PhaseOutput[] {
433
+ // Topological sort by edges
434
+ const adjList = new Map<string, string[]>();
435
+ const inDegree = new Map<string, number>();
436
+
437
+ for (const n of nodes) {
438
+ adjList.set(n.id, []);
439
+ inDegree.set(n.id, 0);
440
+ }
441
+ for (const e of edges) {
442
+ adjList.get(e.source)?.push(e.target);
443
+ inDegree.set(e.target, (inDegree.get(e.target) || 0) + 1);
444
+ }
445
+
446
+ const sorted: string[] = [];
447
+ const queue = [...nodes.filter(n => (inDegree.get(n.id) || 0) === 0).map(n => n.id)];
448
+ while (queue.length > 0) {
449
+ const id = queue.shift()!;
450
+ sorted.push(id);
451
+ for (const next of adjList.get(id) || []) {
452
+ const deg = (inDegree.get(next) || 1) - 1;
453
+ inDegree.set(next, deg);
454
+ if (deg === 0) queue.push(next);
455
+ }
456
+ }
457
+ // Add any remaining (disconnected)
458
+ for (const n of nodes) {
459
+ if (!sorted.includes(n.id)) sorted.push(n.id);
460
+ }
461
+
462
+ return sorted.map(id => {
463
+ const node = nodes.find(n => n.id === id)!;
464
+
465
+ // Derive requires: artifact names from source nodes via edges
466
+ const requires = edges
467
+ .filter(e => e.target === id)
468
+ .map(e => {
469
+ const src = nodes.find(n => n.id === e.source);
470
+ return src?.data.outputArtifactName || 'output.md';
471
+ });
472
+
473
+ // Produces: this node's output artifact
474
+ const produces = [node.data.outputArtifactName || 'output.md'];
475
+
476
+ return {
477
+ name: node.data.presetId === 'custom' ? `custom-${id}` : node.data.presetId,
478
+ label: node.data.label,
479
+ icon: node.data.icon,
480
+ role: node.data.role,
481
+ agentId: node.data.agentId,
482
+ inputArtifactTypes: [],
483
+ outputArtifactName: node.data.outputArtifactName,
484
+ outputArtifactType: 'custom',
485
+ waitForHuman: node.data.waitForHuman,
486
+ dependsOn: [],
487
+ requires,
488
+ produces,
489
+ };
490
+ });
491
+ }