The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(workflow-copilot): register copilot thread with assistant-ui runtime
Steven Enamakel551d6058436f
diff --git a/app/src/components/flows/WorkflowCopilotPanel.tsx b/app/src/components/flows/WorkflowCopilotPanel.tsxindex eec26e5fde..098ef139a9 100644--- a/app/src/components/flows/WorkflowCopilotPanel.tsx+++ b/app/src/components/flows/WorkflowCopilotPanel.tsx@@ -31,10 +31,12 @@ import createDebug from 'debug';import { useCallback, useEffect, useRef, useState } from 'react';import { ChatThreadView } from '../../features/conversations/components/ChatThreadView';+import { useChatSurfaceRegistration } from '../../features/conversations/hooks/useChatSurfaceRegistration';import { useWorkflowBuilderChat } from '../../hooks/useWorkflowBuilderChat';import { diffGraphs } from '../../lib/flows/graphDiff';import type { WorkflowGraph } from '../../lib/flows/types';import { useT } from '../../lib/i18n/I18nContext';+import { AssistantUiRuntimeProvider } from '../../providers/AssistantUiRuntimeProvider';import type { WorkflowProposal } from '../../store/chatRuntimeSlice';import ApprovalRequestCard from '../chat/ApprovalRequestCard';import ChatComposer from '../chat/ChatComposer';@@ -358,6 +360,35 @@ export default function WorkflowCopilotPanel({[text, sending, send, graph, flowId, updatePendingAsk]);+ // Claim this thread's write path for assistant-ui's runtime.+ //+ // Step-4 decision (how the copilot's richer transport is bridged): NO+ // widening of `ChatSurfaceHandlers` was needed, and no signal is discarded.+ // The seam's `send` is not "the transport" — it is "whatever the surface's+ // composer does", which for this panel is `submit` above. `submit` already+ // has the exact `(text?: string) => Promise<void>` shape, and it is the ONLY+ // place that may legitimately construct a `WorkflowBuilderSendParams`: the+ // build mode is derived there from live panel state (a one-shot prefill+ // `build`/`create`, else `revise`) together with the current `graph` ++ // `flowId`, and the returned `WorkflowBuilderSendResult` is consumed there by+ // `updatePendingAsk`, which is what keeps an unanswered clarifying question+ // alive across turns. Handing the runtime a narrower `send` that rebuilt+ // those params itself would be the fork this registry exists to prevent, and+ // a widened seam that returned the raw result to the runtime would leave+ // `pendingAskRef` unset — the copilot's actual carry-forward logic — so+ // routing through `submit` is both the smaller and the correct change.+ //+ // The auto-send retry paths (`buildSeed` / `repairSeed`, which branch on+ // `outcome === 'skipped'` vs `'failed'`) are deliberately NOT reachable from+ // the runtime: they are seeded, once-per-mount effects rather than composer+ // sends, and they keep calling `send` directly with their full structured+ // request and their own outcome handling.+ const submitRef = useRef<((text?: string) => Promise<void>) | null>(null);+ submitRef.current = submit;+ const stopRef = useRef<(() => void) | null>(null);+ stopRef.current = stop;+ useChatSurfaceRegistration(threadId, submitRef, stopRef);+// (B34) One-click resume for a turn that hit the agent's tool-call budget// (`capped`, see `useWorkflowBuilderChat`'s doc) with no proposal yet.// Routes through the SAME `submit` path a typed follow-up would — the@@ -489,19 +520,27 @@ export default function WorkflowCopilotPanel({copilot now reads like the real chat instead of a bespoke transcript.The empty hint, proposal preview, and capped card are the copilot'sown authoring affordances, kept in the footer below. */}- <ChatThreadView- threadId={threadId}- variant="sidebar"- scrollResetKey="workflow-copilot"- shareAgentName={t('flows.copilot.title')}- emptyContent={- <div className="flex h-full items-center justify-center px-3">- <p className="text-xs text-content-muted" data-testid="workflow-copilot-empty">- {t('flows.copilot.emptyState')}- </p>- </div>- }- />+ {/* A SECOND assistant-ui runtime, scoped to this copilot's dedicated+ builder thread. The app-wide instance in `ChatRuntimeProvider`+ follows `selectedThreadId`, which is the home chat's thread and never+ this one; leaving the transcript under it would make every+ assistant-ui primitive inside `ChatThreadView` render the home chat's+ messages here. Nesting overrides the context for this subtree only. */}+ <AssistantUiRuntimeProvider threadId={threadId}>+ <ChatThreadView+ threadId={threadId}+ variant="sidebar"+ scrollResetKey="workflow-copilot"+ shareAgentName={t('flows.copilot.title')}+ emptyContent={+ <div className="flex h-full items-center justify-center px-3">+ <p className="text-xs text-content-muted" data-testid="workflow-copilot-empty">+ {t('flows.copilot.emptyState')}+ </p>+ </div>+ }+ />+ </AssistantUiRuntimeProvider><div className="space-y-3 border-t border-line px-3 py-2.5">{error && (diff --git a/app/src/index.css b/app/src/index.cssindex f8d7868b06..5be5fe261f 100644--- a/app/src/index.css+++ b/app/src/index.css@@ -281,113 +281,6 @@.scrollbar-hide::-webkit-scrollbar {display: none;}-- /* Animation utilities */- .animate-fade-in-up {- animation: fadeInUp 0.5s ease-out forwards;- }-- @keyframes fadeInUp {- from {- opacity: 0;- transform: translateY(20px);- }- to {- opacity: 1;- transform: translateY(0);- }- }-- /* Modal animations */- .animate-fade-in {- animation: fadeIn 0.2s ease-out forwards;- }-- .animate-slide-up {- animation: slideUp 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;- }-- @keyframes fadeIn {- from {- opacity: 0;- }- to {- opacity: 1;- }- }-- @keyframes slideUp {- from {- opacity: 0;- transform: translateY(20px);- }- to {- opacity: 1;- transform: translateY(0);- }- }-- /* Safe area padding for mobile devices */- .safe-area-padding {- padding-top: env(safe-area-inset-top);- padding-bottom: env(safe-area-inset-bottom);- padding-left: env(safe-area-inset-left);- padding-right: env(safe-area-inset-right);- }-- /* Skills table container */- .skills-table-container {- position: relative;- max-height: calc(3 * 2.5rem + 2.5rem + 1px); /* Header + 3 rows + border */- overflow: hidden;- display: flex;- flex-direction: column;- }-- .skills-table-scroll {- overflow-y: auto;- overflow-x: hidden;- max-height: calc(3 * 2.5rem + 2.5rem + 1px);- }-- .skills-table-header {- position: sticky;- top: 0;- z-index: 10;- background: rgba(255, 255, 255, 0.9);- backdrop-filter: blur(8px);- }-- :root.dark .skills-table-header {- background: rgba(23, 23, 23, 0.9);- }-- /* Gradient fade overlay at bottom */- .skills-table-container::after {- content: '';- position: absolute;- bottom: 0;- left: 0;- right: 0;- height: 50px;- background: linear-gradient(to bottom, transparent, rgba(245, 245, 245, 0.9));- pointer-events: none;- z-index: 10;- }-- :root.dark .skills-table-container::after {- background: linear-gradient(to bottom, transparent, rgba(10, 10, 10, 0.9));- }-- /* Hover overlay */- .skills-table-overlay {- z-index: 20;- }-- .skills-table-container:hover .skills-table-overlay {- opacity: 1;- pointer-events: auto;- }}/* Light mode (default) */@@ -422,13 +315,3 @@--cmd-overlay: rgb(var(--surface-overlay) / 0.7);--cmd-shadow-palette: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.25);}--@media (prefers-reduced-motion: reduce) {- .cmd-palette-enter,- .cmd-palette-exit,- .cmd-help-enter,- .cmd-help-exit {- animation: none !important;- transition: none !important;- }-}