Skip to content

fix(agent): strip ReAct trace from CrewAI Manager result, chain task context - #666

Merged
Rod-Christensen merged 4 commits into
feat/base-uifrom
fix/crewai-manager-result-extraction
Apr 14, 2026
Merged

Rod-Christensen merged 4 commits into
feat/base-uifrom
fix/crewai-manager-result-extraction

Conversation

@ryan-t-christensen

@ryan-t-christensen ryan-t-christensen commented Apr 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add _strip_react_preamble() to clean up hierarchical CrewAI task outputs — strips Thought/Action/Observation chains, extracts content after Final Answer: or the last JSON block (guarded by trailing }/] check to avoid extracting intermediate observations), returns '' for unrecoverable traces
  • Leave context=[] on each Task — insertion order is not reliable data-flow order, and hierarchical mode is intentionally non-linear; the manager LLM decides what to forward via its delegation messages
  • Update result extraction to iterate tasks_output in reverse, skipping candidates where stripping produces empty string, falling back to result.raw

Summary by CodeRabbit

  • Bug Fixes
    • Improved agent output processing to extract cleaner final results by removing intermediate reasoning artifacts.
    • Ensured tasks no longer inherit unintended inter-task context, preventing accidental cross-talk.
    • Enhanced result selection to prioritize the most relevant outputs from multi-task runs, with robust fallback handling.

…context

Three fixes for hierarchical CrewAI result quality:

1. Add _strip_react_preamble() — in hierarchical mode result.raw and
   tasks_output[-1].raw often contain the full manager delegation trace
   (Thought/Action/Observation chain) rather than just the final answer.
   Strips to the last "Final Answer:" marker, or the last JSON block if
   the text looks like a ReAct trace, or returns '' for inline traces so
   garbage doesn't leak to the user.

2. Add context=list(sub_tasks) to each Task — without this, downstream
   sub-agents (word analyst, chart renderer) had no access to prior task
   outputs (e.g. the fetched Wikipedia text). CrewAI requires explicit
   context wiring for inter-task data flow.

3. Update result extraction to iterate tasks_output in reverse and take
   the first clean result, falling back to result.raw with the same
   stripping. Avoids returning the manager's full delegation trace.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • develop
  • release/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f4f1e4c2-2f9f-4e8c-9797-60978dd1b595

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added post-processing logic to extract clean payloads from ReAct traces in CrewAI agent outputs, modified task construction to isolate context between sub-agents, and reworked result extraction to prioritize non-empty task outputs with fallback handling.

Changes

Cohort / File(s) Summary
CrewAI Result Processing
nodes/src/nodes/agent_crewai/crewai_manager/manager.py
Added _strip_react_preamble() utility to extract clean text from ReAct traces (preferring "Final Answer:" content, then JSON blocks, with fallback logic). Modified task construction to set context=[] for context isolation. Reworked result extraction after crew.akickoff() to iterate backwards through result.tasks_output, prioritize non-empty task_out.raw, and apply ReAct stripping with fallback to aggregate results.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • jmaionchi
  • stepmikhaylov

Poem

🐰 A rabbit hops through ReAct's trace,
Finding answers in their rightful place,
Stripping preambles with care and skill,
Tasks now isolated, context still,
Clean payloads dance at journey's end! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses both main changes: stripping ReAct traces from CrewAI Manager output and handling task context chaining, which align with the core modifications in the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/crewai-manager-result-extraction

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added the module:nodes Python pipeline nodes label Apr 13, 2026
@ryan-t-christensen

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@nodes/src/nodes/agent_crewai/crewai_manager/manager.py`:
- Around line 69-84: The current logic in manager.py (react_markers / tail /
last_json) uses max(text.rfind('\n{'), text.rfind('\n[')) which may pick the
start of an inner pretty-printed JSON block and truncate the true outer JSON;
instead, locate the correct JSON start by finding all candidate positions of
'\n{' and '\n[' (or scanning backwards from the end) and for each candidate
attempt to parse text[candidate:].strip() as JSON until one succeeds, or
implement a backward brace/bracket matching routine that walks from the last
non-whitespace char and finds the matching opening '{' or '[' by counting
nesting; replace the last_json calculation with this robust selection so the
returned substring is the full balanced JSON payload.
- Around line 289-306: The code currently prefers per-task outputs
(tasks_output) over the manager's synthesized output (CrewOutput.raw), reversing
the intended contract; change the extraction order in the method that builds
final_text so it first inspects the manager-level output via getattr(result,
'raw', None) (and fallback chain using getattr(result, 'result', None) and
_safe_str) and applies _strip_react_preamble to that, and only if that yields no
stripped text iterate reversed(tasks_out) (using getattr(task_out, 'raw', None)
+ _safe_str) to find the last non-empty task result; keep using _safe_str and
_strip_react_preamble and preserve the existing fallback behavior but with
manager output prioritized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d08cf9c2-d9bd-4156-98ab-05b93640a243

📥 Commits

Reviewing files that changed from the base of the PR and between 35369b3 and 161d1d3.

📒 Files selected for processing (1)
  • nodes/src/nodes/agent_crewai/crewai_manager/manager.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@nodes/src/nodes/agent_crewai/crewai_manager/manager.py`:
- Around line 53-63: The docstring for the ReAct preamble-stripping helper in
manager.py is out of sync: it claims step 3 returns the original text unchanged
but the implementation (the empty-string fallback code path) returns '' on
unrecoverable traces. Update the helper's docstring (the function that "Strip
the ReAct Thought/Action/Action Input preamble from a task output") to reflect
the real behavior—replace step 3 to state that when no Final Answer or JSON
block can be extracted the function returns an empty string—and ensure any
examples or wording mention the empty-string fallback instead of returning the
original text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: caa5cebd-d2ed-45db-8e7c-8ddbdc7073a0

📥 Commits

Reviewing files that changed from the base of the PR and between 161d1d3 and 9259b72.

📒 Files selected for processing (1)
  • nodes/src/nodes/agent_crewai/crewai_manager/manager.py

@dylan-savage
dylan-savage self-requested a review April 14, 2026 01:00
@Rod-Christensen
Rod-Christensen merged commit 2de2b78 into feat/base-ui Apr 14, 2026
8 checks passed
@Rod-Christensen
Rod-Christensen deleted the fix/crewai-manager-result-extraction branch April 14, 2026 01:20
Rod-Christensen pushed a commit that referenced this pull request Apr 14, 2026
…context (#666)

* fix(agent): strip ReAct trace from CrewAI Manager result, chain task context

Three fixes for hierarchical CrewAI result quality:

1. Add _strip_react_preamble() — in hierarchical mode result.raw and
   tasks_output[-1].raw often contain the full manager delegation trace
   (Thought/Action/Observation chain) rather than just the final answer.
   Strips to the last "Final Answer:" marker, or the last JSON block if
   the text looks like a ReAct trace, or returns '' for inline traces so
   garbage doesn't leak to the user.

2. Add context=list(sub_tasks) to each Task — without this, downstream
   sub-agents (word analyst, chart renderer) had no access to prior task
   outputs (e.g. the fetched Wikipedia text). CrewAI requires explicit
   context wiring for inter-task data flow.

3. Update result extraction to iterate tasks_output in reverse and take
   the first clean result, falling back to result.raw with the same
   stripping. Avoids returning the manager's full delegation trace.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* harden ReAct stripping, remove fragile context chaining

* address CR comment

* update doc string

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
jmaionchi pushed a commit that referenced this pull request Apr 14, 2026
…overhaul (#670)

* feat(shared-ui): persist canvas state, add isFlowReady, and centralize node loading

Previously, viewport (zoom/pan), lock state, snap-to-grid, and editor mode
were either not persisted at all or stored only in local preferences. On
reload the canvas always reset to fitView at default zoom, losing the user's
position. Additionally, ReactFlow timing was managed through scattered
setTimeout/requestAnimationFrame workarounds with no unified signal for when
nodes were measured and the canvas was ready for viewport operations.

PipelineConfig schema (TypeScript + Python SDKs):
- Added docRevision, isLocked, snapToGrid, snapGridSize, and editorMode to
  PipelineConfig so these fields travel with the .pipe file across all
  consumers. IProject now inherits them instead of declaring docRevision
  separately.

isFlowReady state (FlowGraphContext):
- Added an isFlowReady boolean state that tracks whether all nodes have been
  rendered and measured by ReactFlow. Transitions false→true when every node
  has measured.width, and true→false when unmeasured nodes appear (new node
  added, template instantiated, project loaded).
- All effects that need measured nodes (viewport restoration, fitView,
  template post-processing) now depend on isFlowReady instead of using
  setTimeout(0) or requestAnimationFrame.

loadCanvas centralization (FlowGraphContext):
- Extracted a loadCanvas(nodes, edges) function that sets isLoadingRef,
  resets isFlowReady, and calls setNodes/setEdges. This is the single
  entry point for structural canvas changes.
- loadData (project load) now delegates to loadCanvas for the node/edge
  work, then handles layout preference sync and viewport queueing.
- addNode now uses loadCanvas instead of calling setNodes directly, so
  single-node additions get the same isFlowReady cycle and isLoadingRef
  guard as bulk loads.

Viewport save/restore:
- onToolchainUpdated now includes isLocked, snapToGrid, and snapGridSize
  from projectLayoutRef in the saved project, so layout prefs persist with
  the document.
- onMoveEnd handler added to ReactFlow so viewport-only changes (zoom/pan
  without node edits) trigger a save via onToolchainUpdated.
- On load, viewport is restored from project.viewport via a useEffect that
  fires when isFlowReady transitions to true. Falls back to fitView if no
  saved viewport exists.
- Removed the fitView prop from ReactFlow — viewport is now always managed
  programmatically through the isFlowReady cycle.

FlowPreferencesContext:
- isLocked is now derived from projectLayout state instead of a separate
  useState, eliminating dual-state sync issues when loadData pushes layout
  prefs from the project document.

useTemplateInstantiator simplification:
- Replaced the two-phase measurement polling (pendingIds + needsFit +
  doneRef) with a single useEffect gated on isFlowReady. When isFlowReady
  becomes true and pendingIds exist, it updates internals, notifies the
  host, and calls fitView.
- Template instantiation now uses loadCanvas instead of calling
  setNodes/setEdges directly, getting the same isLoadingRef guard and
  isFlowReady cycle.

addNode positioning:
- When no position is specified (accordion/create panel), addNode now finds
  a non-overlapping spot by starting at viewport center and shifting down
  until clear of existing nodes, matching the quick-add popup behavior.

EmptyCanvasPrompt:
- Only shown when nodes.length === 0 AND isFlowReady is true, preventing
  the brief flash of the "Select your starting point" dialog while a
  project's components are still loading into nodes.
- Fixed React style warnings by replacing border shorthand with longhand
  properties (borderWidth/borderStyle/borderColor) in item and templateItem
  styles to avoid conflicts with conditional borderColor overrides.

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

* fix(shared-ui): use spiral search for non-overlapping node placement

Replace the downward-only linear search with a spiral pattern that
searches outward from the viewport center, finding the nearest
available slot in all directions.

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

* feat(shared-ui): decompose monolithic flow module into modular ProjectView architecture

Restructure the shared-ui package from a single monolithic `modules/flow/`
canvas module into a composable, multi-view project architecture. The canvas
editor is relocated, five new standalone view components are introduced, and
a new ProjectView orchestration module ties them together behind a redesigned
TabPanel.

=== CANVAS RELOCATION ===

Move the entire ReactFlow-based pipeline canvas editor from
`modules/flow/` to `components/canvas/`. The internal directory structure
is preserved verbatim (components/, context/, hooks/, templates/, util/,
types.ts, theme.ts). The barrel export in `src/index.tsx` is updated to
re-export `Canvas` and `IFlowProps` from the new path. No functional
changes to the canvas itself.

Files moved (92 files):
  modules/flow/**  →  components/canvas/**

=== NEW MODULE: ProjectView (modules/project/) ===

Add a top-level orchestration component that composes the canvas editor
and all runtime views (Status, Tokens, Flow, Trace, Errors) into a
unified project frame with a shared TabPanel.

- ProjectView.tsx (229 lines): Wires up lazy-loaded tab content via
  React.lazy + Suspense, manages active tab state, and delegates
  host↔view communication through typed callback props.

- types.ts (131 lines): Defines the complete message protocol for
  host↔view communication, split into per-component message pairs:
    • CanvasIncoming / CanvasOutgoing
    • StatusIncoming / StatusOutgoing
    • TraceIncoming / TraceOutgoing
  Composed into aggregate types:
    • ProjectViewIncoming — all messages the host can send
    • ProjectViewOutgoing — all messages the view can emit
  Also defines ProjectViewMode, IProjectViewProps, and IViewProps.

- hooks/useTraceState.ts (274 lines): Incrementally processes an array
  of TraceEvent objects (begin/enter/leave/end ops) into a flat list of
  TraceRow objects for the trace viewer. Maintains document map, slot
  bindings, and pending call stacks via refs. Supports reset detection
  when the event array shrinks. Caps retained documents at 64.

- hooks/useElapsedTimer.ts (85 lines): Returns a live-updating
  elapsed-seconds counter while a pipeline task is in the RUNNING state.
  Starts a 1-second interval on RUNNING, clears on completion/cancel/
  unmount.

=== NEW VIEW COMPONENTS ===

All five new view components follow the established shared-ui conventions:
plain React, inline CSSProperties style objects, --rr-* CSS custom
property tokens, section divider comments, no MUI dependencies.

1. components/status/ (5 files, ~1,210 lines total)
   - Status.tsx: Completions chart and stats for a running pipeline.
     1-second sampling interval, 600 data points (10 min history),
     automatic reset detection on pipeline restart.
   - StatusHeader.tsx: Header bar with pipeline state display and
     run/stop/restart action buttons.
   - StatusFooter.tsx: Footer with summary statistics row.
   - CompletionsChart.tsx: Canvas-based time-series chart rendering
     completions data with configurable time ranges.
   - types.ts: ChartStats, StatusDataPoint, TimeRange interfaces.

2. components/tokens/ (2 files, ~160 lines)
   - Tokens.tsx: Token consumption metrics display with breakdown by
     resource type (CPU Usage, CPU Memory, GPU Memory), progress bars,
     and total count.

3. components/flow/ (2 files, ~217 lines)
   - Flow.tsx: Pipeline flow visualization with list/graph view toggle.
     Renders pipeline stage progression.

4. components/trace/ (3 files, ~1,514 lines)
   - Trace.tsx (1,255 lines): Pipeline call-tree viewer. Builds a tree
     from TraceRow data, groups by document/object, renders expandable
     tree nodes with elapsed time, status indicators (in-flight, error,
     completed), and a detail panel showing entry/exit data.
   - JsonTree.tsx (259 lines): Recursive JSON viewer for the trace
     detail panel. Supports configurable default expansion depth,
     collapsible object/array nodes, and syntax-colored primitives.

5. components/errors/ (2 files, ~234 lines)
   - Errors.tsx: Structured error/warning message parser and display.
     Parses "ErrorType*`message`*filepath:linenumber" format with
     graceful fallback for unstructured messages.

=== TABPANEL REDESIGN ===

Rewrite the TabPanel component with a new visual design and mounting
strategy.

Visual changes:
  - Tab bar: sliding underline indicator → centered pill-style
    segmented control with rounded container and brand-colored
    active segment.
  - Removed resize/scroll event listeners (indicator tracking no
    longer needed).

API changes:
  - Removed: `children` prop, `contentClassName` prop.
  - Added: `panels: Record<string, React.ReactNode>` prop — maps
    tab IDs to their content elements.

Mount strategy change:
  - Old: Single `children` slot rendered unconditionally.
  - New: Panels render on first activation and stay mounted, with
    visibility toggled via `display: none`. This avoids re-mounting
    components like ReactFlow that require measured containers for
    correct initialization, while preventing premature mounting of
    panels that have never been visited.
  - Internal `activated` Set tracks which tabs have been shown at
    least once.

Style migration:
  - Deleted tab-panel.css (85 lines of class-based styles).
  - All styles moved to inline CSSProperties objects in TabPanel.tsx,
    consistent with the shared-ui convention.

=== BARREL EXPORT UPDATES (src/index.tsx) ===

- Canvas/IFlowProps: re-export path updated from `./modules/flow`
  to `./components/canvas`.
- Added exports: ProjectView, IProjectViewProps, IViewProps,
  ProjectViewMode, ProjectViewIncoming, ProjectViewOutgoing,
  TaskStatus, TraceEvent.

=== DEPENDENCY ADDITIONS ===

- lucide-react ^0.540.0: Icon library added to shared-ui
  (pnpm-lock.yaml updated).

=== DELETIONS ===

- modules/flow/ (92 files, ~14,058 lines): Entire legacy module
  removed. All canvas functionality is preserved in components/canvas/.
  The MUI-dependent top-level Flow.tsx wrapper in modules/flow/ is
  superseded by the new components/canvas/Canvas.tsx (which retains MUI
  for the ReactFlow integration) and by ProjectView (which is MUI-free).
- components/tab-panel/tab-panel.css (85 lines): Superseded by inline
  styles in the rewritten TabPanel.tsx.

Net change: 98 files changed, ~101 insertions, ~14,159 deletions
(large deletion count reflects the modules/flow/ removal; equivalent
code exists in the new components/canvas/ untracked directory).

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

* feat(shared-ui): unify tab bars, add StatusHeader with Run/Stop, remove vscode.css from components

Rework shared-ui tab bars, status header, and theme CSS loading:

- TabPanel: simplify to mount-only-active-panel (unmounts on tab switch),
  remove activated-set tracking and display:none toggling, add pill-style
  badge support with active/inactive styling via color-mix tokens

- StatusHeader: consolidate into a full two-column header bar with state
  indicator (dot + Running/Offline/etc), status subtitle, Run/Stop button
  with state-aware variants (run/stop/disabled), and elapsed timer —
  all self-contained with no layout responsibility on the parent

- Status: integrate StatusHeader directly, accept onPipelineAction prop,
  remove need for parent to compose header layout

- ServerMonitor: replace custom CSS tab bar and header with shared
  TabPanel component, remove sm-header/sm-tab-bar/sm-tab CSS classes

- ProjectView: remove lazy loading and Suspense wrappers (panels now
  mount/unmount with tab switches), remove redundant layout styles
  and control button logic (now in StatusHeader), add empty state
  for Tokens panel

- Theme: remove rocketride-vscode.css imports from ProjectView,
  ServerMonitor, and FlowCanvas (web app uses rocketride-default.css
  + JSON themes via applyTheme, VS Code extension loads vscode.css
  separately). Add fallback values to rocketride-vscode.css for
  --rr-bg-button, --rr-fg-button, --rr-font-family, --rr-font-family-widget

- Barrel exports: add DashboardResponse, ActivityEvent and related
  dashboard types to shared-ui index.tsx

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

* feat: unify VSCode + shared-ui architecture with ref-based ProjectView

- Merge PageEditorProvider + PageStatusProvider into PageProjectProvider
- ProjectView owns all state via useImperativeHandle ref API
- Stateless message bridges in both VSCode and rocket-ui
- Multi-source status panes (one per source, sorted A-Z)
- Canvas toolbar via context (CanvasToolbarContext)
- Rename PageDashboard -> PageMonitor across VSCode extension
- Inline styles with --rr-* tokens, delete all per-view CSS files
- Add tabContent common style, readTheme utility
- Add chart.js as shared-ui peer dependency
- Remove applyDefaults from shared-ui components (theme owned by host)
- Fix ActivityBar theme message type mismatch for iframes

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

* feat(shared-ui): cache theme tokens, notify host on canvas content change

Cache applied theme tokens in applyTheme.ts for reliable readTheme(),
update ProjectView to sync project state on content changes, and notify
host immediately when nodes are added via FlowGraphContext.

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

* feat(shared-ui): overlay tab bar, floating canvas toolbar, workspace state persistence

- TabPanel: absolute-positioned transparent overlay with centered pills,
  pointer-events passthrough so canvas is interactive underneath
- FloatingToolbar: restored as draggable bar on canvas, switches between
  horizontal/vertical based on cursor proximity to parent edges
- ProjectView: wire getPreference/setPreference to workspace state for
  toolbar position persistence, restore state on initialState arrival
- Remove CanvasToolbarContext (dead code — toolbar no longer in tab bar)
- Default node name from service catalog title on addNode
- tabContent padding clears the overlay tab bar

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

* feat: migrate DAP to SDK, strongly type APIs, document/view/prefs state model

SDK changes (TypeScript + Python):
- Add ServiceDefinition, ServicesResponse, ValidationResult, ValidationError types
- Strongly type getDashboard() → DashboardResponse, getServices() → ServicesResponse,
  getService() → ServiceDefinition, validate() → ValidationResult
- Add name parameter to use(), add restart() and getTaskToken() methods
- Add setEnv()/set_env() for runtime env variable updates
- Add addMonitor/removeMonitor with reference counting and auto-resubscribe

VS Code extension:
- Replace all raw DAP commands with SDK methods (use, terminate, getTaskToken,
  getDashboard, getServices, restart, connect+ping for test connections)
- Remove ConnectionManager.request() and monitor-manager.ts
- Remove substituteEnvVariables — SDK handles env substitution via setEnv()
- Pass env to client at creation, sync on onEnvVarsChanged
- Split project:stateChange into project:viewStateChange + project:prefsChange
- Send project:initialState + project:initialPrefs before canvas:update on ready

shared-ui:
- Split ProjectView state into viewState (mode, flowViewMode) and prefs (toolbar etc.)
- Gate rendering on viewState and prefs being received (eliminates flash)
- Export ViewState type from project module
- FloatingToolbar: use visibility:hidden when parent has 0 dimensions
- FloatingToolbar: skip ResizeObserver callbacks for hidden parents

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

* feat: project:load atomic message, viewport/layout state, dark mode fixes, dirty tracking

State architecture:
- Add project:load message — sends project, viewState, prefs, services,
  isConnected, and statuses in one atomic message (eliminates flash)
- Add ViewState.viewport — viewport persisted per-view, not in pipeline
- Add layouts (per-document defaults) — new views inherit from last layout
- VS Code: use webview getState()/setState() for per-document state,
  rocketride.layouts in workspaceState for defaults
- Add onViewportChange callback threaded through Canvas → FlowProvider →
  FlowProjectContext → FlowCanvas (replaces prefs-based viewport storage)

Dirty tracking fixes:
- Strip ui.measured from getComponentFromNode — computed field no longer
  dirties document on initial render
- Remove viewport from onContentUpdated/addNode project output — viewport
  is view state, not document content
- Remove onMoveEnd → onContentUpdated — panning/zooming no longer dirties
- Fix template instantiation: call onContentChanged directly instead of
  onContentUpdated (was blocked by isLoadingRef race condition)

Canvas improvements:
- Rename onToolchainUpdated → onContentUpdated across all canvas files
- Dark mode: detect via data-vscode-theme-kind body attribute in getMuiTheme
- Dark mode: sync --icon-filter on body when theme changes
- Dark mode: CSS-only --icon-filter rules for vscode-dark/high-contrast
- Dark mode: theme-aware edge stroke colors via --xy-edge-stroke
- Dark mode: icon filter on create-node panel sidebar icons
- Fix gear icon fill override in NodeHeader (conditional spread)
- Fix MoreMenu icon color (explicit --rr-text-secondary)
- Edge delete button: use --rr-bg-paper background with --rr-text-secondary

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

* fix(shared-ui): remove debug component log from ProjectView

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

* feat(shared-ui): stop icon Square, PipelineActions on Status tab, remove metrics bg

- RunButton: swap StopCircle for Square icon with transparent fill
- StatusHeader: add extraActions slot, render PipelineActions (Chat now / Endpoint Info)
- Status: remove background from Performance Metrics header
- ProjectView: pass taskStatuses to Canvas, import PipelineActions for SourceStatusPane

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

* feat: wire onOpenLink end-to-end, serverHost, fix EndpointInfoModal tabs

- ProjectView: add handleOpenLink callback, pass onOpenLink + serverHost
  to Canvas and SourceStatusPane PipelineActions
- types: add project:openLink to ProjectViewOutgoing, serverHost to load msg
- PageProjectProvider: handle project:openLink with full WebviewPanel bridge
  (theme, clipboard, drag-drop), send serverHost in project:load
- EndpointInfoModal: replace overlay TabPanel with inline toggleButtons

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

* feat(shared-ui): per-source Flow panes, parsed error messages in NodeStatus

- Flow: extract SourceFlowContent for single-source rendering
- ProjectView: render per-source SourceFlowPane (matches Tokens pattern),
  remove pickActiveStatus, clean up unused imports
- NodeStatus: parse structured error format (Type*message*path), wrap
  instead of truncate, bold error type

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

* refactor: simplify project API — plain name string, strongly typed PipelineConfig

Client SDK project methods now take a plain file name string instead of
an options object, and use PipelineConfig types instead of Record<string, any>.

TypeScript:
  - saveProject(name, pipeline: PipelineConfig)
  - getProject(name): PipelineConfig
  - deleteProject(name)

Python:
  - save_project(name, pipeline: PipelineConfig)
  - get_project(name) -> PipelineConfig
  - delete_project(name)

The name parameter is the file name on disk (e.g. "my-chat"), not the
pipeline's UUID. The UUID (project_id) lives inside the pipeline JSON
and is used for identity tracking, not file storage.

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

* chore(shared-ui): remove duplicate theme JSON files

Theme JSON files are served from rocket-ui's public/themes/ at runtime.
The shared-ui copies were unused — fetchAndApplyTheme() fetches from the
host's /themes/ endpoint, not from the shared-ui package.

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

* fix(shared-ui): stop viewport/source leaking into pipeline, simplify RunButton

Root cause: ProjectView injected viewState.viewport into the project
object before passing to Canvas. This caused viewport and source to
leak through onContentChanged, marking documents dirty on every
pan/zoom or Play click.

Fixes:
  - Pass viewport as separate initialViewport prop through Canvas →
    FlowContainer → FlowProvider → FlowProjectContext → FlowGraphContext
  - Remove viewport injection hack from ProjectView
  - RunButton: remove source injection from project (source passed
    separately via status:pipelineAction message)
  - handleRunPipeline: stop sending canvas:contentChanged on Play
    (pressing Play doesn't edit content)
  - RunButton: remove isPending state entirely (host may cancel via
    save dialog; pending spinner would get stuck)
  - RunButton: remove label spans, icon-only (Run/Stop/Stopping)
  - Run and Stop buttons now same hover width (3.5rem)

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

* feat: per-source trace panes, flow event types, UI style consolidation

Wire source field through flow events end-to-end (task engine → vscode
provider → shared-ui) so trace and flow tabs can show per-source panes.
Add TaskEventFlow / TASK_EVENT_FLOW types to TS and Python SDKs, remove
unused EVENT_STATUS_UPDATE export. Move useTraceState processing into
useEffect for React 18 Strict Mode compatibility. Consolidate card/header
styles via commonStyles, simplify node header CSS to use surface-alt
tokens, and add rocketride theme.

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

* feat(shared-ui): collapsible trace call tree with lane-typed renderers

Major refactor of the Trace component for the pipeline trace viewer.

Call tree structure:
  - Each enter/leave pair renders as a single collapsible row (▸/▾)
  - Expanded: Input data box → children → Output data box (no ENTER/LEAVE rows)
  - Structural nesting via CSS margin-left + border-left
  - Batching of identical consecutive siblings with "N more..." progressive reveal
  - Inline detail panel under expanded nodes (not side panel)

Lane-typed renderers (new renderers/ directory):
  - render_question: displays question text, history, instructions, examples, goals
  - render_answer: displays answer text with word count, token usage cards
  - render_document: displays content, metadata (source, objectId, chunk)
  - render_text: displays text with char/word count
  - render_video: displays action (Begin/Write/End), buffer size, mimeType
  - render_audio: displays format, duration, sample rate, channels (or stream action)
  - render_image: displays format, dimensions, file size (or stream action)
  - render_table: parses markdown tables and renders as HTML table
  - Each renderer has: TypeScript type guard (isX), summary function, render function
  - Dispatch by lane name, validated by type guard

Data view modes: [Tree] [JSON] [Raw] toggle buttons
  - Tree: lane-typed renderer (falls back to JSON if no renderer matches)
  - JSON: JsonTree with defaultExpanded=2
  - Raw: JSON.stringify compact string

Other changes:
  - Removed side detail panel and resize handle
  - Removed "Trace" header and Clear button (handled by parent)
  - Lane colors for all lanes including image, table
  - Lane display names: tags→data, closing→flush
  - Explicit rgba backgrounds for lane badges (no color-mix)
  - useTraceState moved to useEffect (fixes React 18 Strict Mode)
  - Flow events forwarded with source field for per-source filtering
  - Removed unused helpers (findNodeById, collectVisibleNodes, etc.)

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

* fix(shared-ui): restore titleBar colors for node headers, cardHeader consistency

- Node headers: restore --rr-bg-titleBar-inactive/active with
  hover/selected transitions (was incorrectly changed to surface-alt
  which had insufficient contrast in dark themes)
- cardHeader: use --rr-bg-titleBar-inactive instead of --rr-bg-surface-alt
  for consistency with canvas node headers across all panel headers

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

* feat(shared-ui): trace viewer theme cleanup, UX polish, component name resolution

- Replace all made-up CSS variables (--rr-font-mono, --rr-border-subtle,
  --rr-bg-surface, etc.) with declared --rr-* tokens from theme files
- Add --rr-chart-* lane colours and --rr-annotation-bg-default to
  rocketride-vscode.css
- Remove ~30 unused styles, dead selection state, and stale props
- Resolve component IDs to display names via pipeline lookup map
- Show recursive call counts on every level including object groups
- Muted styling for empty pass-through nodes
- Smart Data/JSON/Raw toggle: default to Data when a typed renderer
  exists, hide Data option otherwise
- Move result status to output box with collapsed/expanded display
- Square left corners on inline data boxes
- Fix documents renderer to handle arrays, not just single objects
- Remove redundant Node/Called by/Lane fields from input box
- Add left/right padding to rendered data content

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

* feat(shared-ui, rocketlib): invoke lane renderer + IInvoke computed type field

Add @computed_field `type` to IInvoke so trace events carry the Python
class name (IInvokeLLM, IInvokeTool, etc.) for dispatch.  New invoke
lane renderer handles LLM asks, tool discovery/invoke/validate with
type-specific detail views.

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

* feat(rocketlib, shared-ui): invoke type hierarchy refactor, IInvokeOp, IInvokeMemory

Python (rocketlib):
- Add IInvokeOp base class with computed type via __qualname__
  (e.g. "IInvokeLLM.Ask") and lane field for routing
- IInvokeLLM: pure namespace with nested Ask, GetContextLength,
  GetOutputLength, GetTokenCounter operation classes
- IInvokeTool: migrate nested classes to IInvokeOp, add lane
- IInvokeMemory: new type deriving from IInvokeTool with Put, Get,
  List, Clear operations backed by tool dispatch
- IInvoke: remove computed_field type (envelope only)
- instance.invoke(): takes single param, reads param.lane for routing,
  component_id replaces classType+nodeId
- Driver control(): unpacks control.param instead of *control.args

Callers (host.py, 12 node files):
- IInvokeLLM(op='ask', question=q) → IInvokeLLM.Ask(question=q)
- instance.invoke('llm', param, nodeId=x) → instance.invoke(param, component_id=x)
- Memory class uses IInvokeMemory.Put/Get/List/Clear

Frontend (shared-ui):
- Invoke renderer dispatches on param.type split ("IInvokeLLM.Ask"
  → category + operation) via lookup tables
- Add IInvokeMemory renderer
- Remove redundant input/output/result from tool/memory Data views
- Add RS.sectionContent for consistent label→content indentation
- Apply sectionContent to question and invoke renderers

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

* feat(shared-ui): split trace renderers into input/output, diff view, collapsible sections

- Split InlineDataBox into InputDataBox and OutputDataBox
  - InputDataBox: call info, typed Data renderer per lane
  - OutputDataBox: DiffView by default, invoke-specific overrides
  - When entryData === exitData: single "Data" box, no Output
- New utils.ts: traceDataEqual, diffObjects (10-entry cap, shallow
  per change), DiffView component, CollapsibleSection component
- Split index.tsx: renderTraceInput/Output, summaryTraceInput/Output
  - Default output renderer: DiffView showing adds/changes/deletes
  - Invoke output: table-driven dispatch (LLM Ask shows Answer)
- Invoke renderer improvements:
  - LLM Ask input: Goal, Question always visible; Instructions,
    Context, History collapsed by default via CollapsibleSection
  - LLM Ask output: renders Answer (string or JSON) from result
  - Memory input: shows Operation, Key, Value
  - Memory output: shows Status, Key, returned Value
  - Remove OP_LABELS map, show raw op values
  - Remove renderExtras, unknown types get JSON/Raw only
  - Instruction text blocks get yellow left border
  - Goal before Question in field order
- Consistent RS.sectionContent indentation across all renderers
  (answer, text, document, invoke)

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

* feat(shared-ui): shared question/answer formatters, result footer, robust trace stack

- Extract format_question/format_answer so render_question, render_answer and render_invoke (LLM Ask) share one renderer
- Add ResultFooter showing OK/Error/Skip/PreventDefault at the bottom of each expanded call
- Shift/Ctrl-click a call header to expand or collapse the whole subtree
- IInvokeCrew renderer + summarizer; Tool Query output lists discovered tools
- useElapsedTimer now ticks during INITIALIZING as well as RUNNING
- useTraceState recovers from missing enter/leave events by aligning the pending stack and marking orphaned frames as errors

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

* feat(agent): refactor AgentBase to AgentContext seam, split CrewAI, fix DAP cross-client seq collision

AGENT BASE REFACTOR — AgentContext + call_llm/call_tool adapters
----------------------------------------------------------------
Replace the old host: AgentHost + _bind_framework_* callback API with a
clean AgentContext dataclass and three host adapters on AgentBase:
call_llm, call_llm_json, call_tool. The driver _run signature changes
from (agent_input, host, ctx) to (*, context, question). AgentInput is
deleted; its run metadata moves onto AgentContext and the Question travels
alongside as a separate parameter. The two abstract _bind_framework_llm /
_bind_framework_tools methods are removed — each driver now defines plain
module-level builder functions (e.g. _build_langchain_llm(agent_base, context),
_build_deepagent_tools(agent_base, context, descriptors)) that close over
agent_base and context directly. _internal/agent_tool.py is removed
entirely; agent-as-tool is now declared per IInstance as a @tool_function def
run_agent(self, input_obj) using the shared AGENT_TOOL_INPUT_SCHEMA /
AGENT_TOOL_OUTPUT_SCHEMA exported from ai.common.agent.types.

AgentBase.run_agent now lazy-builds AgentHostServices once per IInstance
and caches it on iInstance._agent_host. Tool discovery (one engine invoke
per connected tool node) happens once at first question instead of on every
question. A new REQUIRES_MEMORY class flag lets drivers declare a memory
dependency that run_agent enforces at first question.

sendSSE now takes context as an explicit parameter and reads the invoker
from there instead of from self._invoker. The _invoker and _host
instance attributes on AgentBase are gone.

All engine envelope construction (IInvokeLLM.Ask(...)) lives inside
call_llm / call_llm_json. Drivers never touch IInvokeLLM directly.
call_llm accepts a polymorphic prompt that is either a pre-built
Question (used by drivers like rocketride that build structured prompts)
or framework-native messages that get flattened to a transcript.

AgentHostServices.Tools exposes a prepared flat list: List[ToolDescriptor]
built once at construction. Drivers read context.tools.list directly and the
old discover_tools helper is gone. The class also drops the leaky
class-level _tool_nodes / _tool_list attributes that would have been
shared across instances and silently leaked descriptors between concurrent
agent runs. Tools.invoke(tool_name, args) is renamed from (tool_name, input)
to make it explicit that it takes a clean dict — framework-shape conversion
is the driver wrapper's job, not the host's.

Why: the old _bind_framework_* methods existed only to receive callbacks
(call_llm, invoke_tool, log_tool_call) that the driver would then capture
in its inner LangChain / CrewAI subclasses. Every driver wrote the same
closure boilerplate around the same shims. Passing agent_base and
context directly to module-level builder functions lets the inner classes
close over them naturally — the entire indirection layer disappears, and
the resulting drivers are dramatically smaller (deepagent loses ~280 lines).

AgentInput was a half-honest wrapper: it carried a Question plus run
metadata, but the question and the metadata have completely different
lifecycles. Run metadata is per-call scaffolding (immutable, threadsafe,
shared across reentrant call_llm chains); a question is the actual unit
of work and changes meaning every time a framework loop synthesizes a new
one from messages. Splitting them into AgentContext (frozen dataclass) +
a separate question parameter is structurally honest and makes reentrancy
safe.

self._invoker was a latent concurrency bug. Two concurrent run_agent
calls on the same IInstance would race to set self._invoker, and SSE
events from one call could be routed to the other call's pipe. Reading the
invoker from context instead means each call has its own immutable
binding. Same reasoning for self._host.

Lazy host construction per IInstance fixes a real performance pothole.
Tool discovery does N engine invokes per connected tool node. Rebuilding
the host on every question multiplied that cost by question rate — and
worse, the discovered descriptors were thrown away after each question.
Caching on iInstance._agent_host discovers once and reuses forever.

Centralizing IInvokeLLM construction in call_llm means engine type changes
(like the IInvokeLLM(op=ask,...) to IInvokeLLM.Ask(...) factory pattern)
only need to land in one place. Drivers don't need co-ordinated updates.

Replacing the bespoke agent-as-tool path with @tool_function def run_agent
unifies the surface with the @tool_function decorator pattern from #599.
The old handle_agent_tool_invoke / _AgentAsToolProvider branch was a
parallel system that did the same thing the decorator does — it existed
because @tool_function post-dated the original agent base. Now that the
decorator exists, the parallel system is dead code.

CREWAI SPLIT — three node types out of one package
---------------------------------------------------
The single agent_crewai node becomes three logical nodes, each registered
via its own services.*.json and living in its own sub-package:

  - crewai_agent     — standalone single-agent node, also exposed as a
                       run_agent tool. classType: [agent, tool].
  - crewai_subagent  — managed sub-agent. No questions lane. Can only be
                       wired into a Manager via the crewai lane.
                       classType: [crewai].
  - crewai_manager   — hierarchical multi-agent delegator. Fans out
                       describe on the crewai lane to connected
                       subagents, assembles a Crew, runs CrewAI hierarchical
                       process. classType: [agent, tool].

Shared framework code lives at the package root: crewai_base.py (the
CrewBase(AgentBase) shared base with _build_crew_llm / _build_crew_tools),
crewai_runner.py, crewai_listener.py, plus the shared requirements.txt.
The package no longer exports IInstance / IGlobal; the engine loads each
sub-package via the path field in its services manifest.

The crew control-plane op renames from crewai.describe to bare describe
on lane crewai, and IInvokeCrew.Describe now extends IInvokeOp (with
lane = crewai) instead of plain BaseModel. IInvokeCrew.DescribeResponse
is no longer an IInvokeOp — it is a value object that travels inside a
Describe response, not an op that gets dispatched. The trace renderer
(render_invoke.tsx) is updated to display the new op name.

Why: the original single agent_crewai node tried to be both a standalone
agent and the orchestrator depending on which lanes were connected. There
was no way to validate the combinations: nothing stopped someone from
running a subagent standalone, or wiring a manager without subagents. The
behavior was implicit in connection topology, which means errors only
surfaced at runtime and only with confusing symptoms.

Splitting the role into three explicit node types makes the constraints
declarative in the services manifest. Subagents have no questions lane and
literally cannot be invoked directly. Managers require at least one crewai
lane connection. The engine normal lane validation now catches misuse
before pipeline start.

Cross-Manager nesting (one Crew calling into another Crew as a black box)
still works — but now it is via the tool.run_agent path (the agent-as-tool
surface), not by overloading the crewai lane. That keeps the crewai lane
semantics clean: it is the manager/subagent fan-out channel, nothing else.

The op rename matches the @invoke_function decorator dispatch convention
landed in #599: bare op names route to def describe(self, ...) methods on
the receiving IInstance. Keeping the old crewai.describe form would have
forced a special case in the dispatcher.

DAP CROSS-CLIENT SEQ COLLISION — two clients, one task
-------------------------------------------------------
Task._send_data now constructs a fresh outbound DAP packet via
_data_client.dap_request(command=..., arguments=..., token=...) instead of
forwarding the inbound dict verbatim. DataCommands.handle_data wraps the
subprocess response in a fresh build_response(request, body=...) keyed off
the inbound request. New tests in both RocketRideClient_test.py and
RocketRideClient.test.ts exercise the path: two independent clients sharing
one task via useExisting, sending concurrently.

Why: two independent client connections that share a task (via useExisting)
each have their own DAP seq counter. They can independently issue
overlapping seqs — both clients can reach seq=4 within milliseconds of each
other. Eaas multiplexes both into one outbound _data_client to the
subprocess. If we forwarded the inbound dict verbatim, the colliding seqs
would clobber each other in _data_client._pending_requests: the second
future overwrites the first, the first response gets dropped, and the
originating client hangs forever waiting for a reply that already came back
to the wrong slot.

Building a fresh outbound packet via dap_request allocates a unique seq
from _data_client._next_seq() so each outbound message has its own
correlation slot. Rebuilding the response envelope via build_response
ensures the inbound DAPConn sees its original request_seq so it can
correlate the response back to the originating client.

This bug is invisible with one client because a single client has one
monotonic seq counter — it never collides with itself. The single-client
concurrent test in the same suite does NOT exercise the path. Two independent
clients fanning into one task are the necessary precondition, which is
exactly what the new tests reproduce.

MISTRAL SDK 1.x / 2.x COMPATIBILITY
------------------------------------
llm_mistral/IGlobal.py, llm_mistral/mistral.py, and
llm_vision_mistral/mistral_vision.py try from mistralai.client import Mistral
(2.x layout) and fall back to from mistralai import Mistral (1.x). The
>=2.0.0 constraint is dropped from both requirements.txt. The mistralai SDK
reorganized its package layout between 1.x and 2.x. Pinning to 2.x broke
installs in environments still on 1.x. The shim accepts whichever is
installed without forcing an upgrade.

INCIDENTAL FIT-AND-FINISH
--------------------------
- PageProjectProvider.ts adds a clipboard bridge: webview iframes can post
  {type:requestPaste} / {type:copyText,text} and the extension host
  proxies to vscode.env.clipboard.read/writeText. VSCode intercepts native
  paste at the Electron layer, so embedded iframes cannot read the OS
  clipboard themselves.

- task_engine.py adds debug(output_message) on subprocess output events
  so traces capture the same payload that gets appended to _status_trace.

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

* feat(vscode, shared-ui): persistent client, virtualized managers, disconnect overlay

Refactor ConnectionManager to use a single persistent RocketRideClient
(persist: true) that survives across connect/disconnect cycles. The SDK's
_resubscribeAllMonitors() now correctly replays monitor subscriptions on
every reconnect — fixing the bug where Server Monitor showed 0 MONITORS
after a disconnect/reconnect.

Backend lifecycle virtualized behind BaseManager with two concrete
implementations:
- LocalManager: composes EngineManager, connect with retries for engine
  startup race
- RemoteManager: credential validation + direct connect

Removed CloudManager (no-op stub), all retry/backoff logic from
ConnectionManager (SDK handles it), isMonitoring flag from
PageProjectProvider (SDK tracks via _monitorKeys).

Disconnect overlay added to ProjectView and ServerMonitor — semi-opaque
with blur, showing [ Disconnected ] over the existing content. On
reconnect, statusMap/traceEvents/cachedStatuses are cleared for a fresh
start. Status chart pauses while disconnected and resets on reconnect.

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

* feat(shared-ui, vscode, server, clients): pipeline result display, toolbar orientation context, icon standardization, connect dedup, engine EventEmitter

Pipeline result end-to-end:
- pipe.instance.cpp: gate BEGIN/END debug events on PIPELINE_TRACE_LEVEL::METADATA and
  serialize the pipe response into the END event at SUMMARY level — previously always
  emitted "{}" unconditionally, so the final result never reached the UI
- client-ts/python: add result/pipelineResult field to TaskEventFlow for op === 'end'
- useTraceState: on op === 'end' inject a synthetic __result__ sentinel TraceRow so
  Trace.tsx can render it separately from the call tree
- Trace.tsx: extract __result__ rows in buildObjectGroups, add collapsible ResultRow
  component (green header) rendered after the call tree via renderFinalSections
- render_final.tsx (new): dispatches each result field through the existing per-type
  renderers (renderAnswer, renderDocument, etc.) via result_types map; falls back to
  JsonTree for unknown types
- format_answer.tsx: render structured JSON answers via JsonTree instead of a plain
  text block

Toolbar orientation context:
- FloatingToolbar.tsx: expose ToolbarOrientationContext so toolbar button children can
  read horizontal/vertical orientation via useToolbarOrientation() without prop drilling;
  fix null guard on getRenderedPosition() before writing dragStart
- toolbar/index.tsx: re-export useToolbarOrientation from barrel

Icon standardization:
- FitIcon, LockIcon, NoteIcon, TidyIcon, UnlockIcon, ZoomInIcon, ZoomOutIcon: replace
  verbose per-element SVG markup with compact single-path 24x24 BoxIcons-style paths;
  standardizes icon visual style and halves markup weight
- FlowCanvas.tsx: replace lucide Undo2/Redo2/Move/BoxSelect/PlusSquare imports with
  inline BxIcon helpers using BoxIcons paths, consistent with the icon overhaul

VSCode reliability fixes:
- connection.ts: add connectPromise dedup guard — concurrent connect() calls (e.g.
  racing event handlers at startup) now share one in-flight promise instead of each
  spawning an independent _connect(), preventing double-initialization
- engine-manager.ts: switch from BaseManager to Node.js EventEmitter — was already
  calling this.emit('terminated') but BaseManager didn't extend EventEmitter so events
  were silently dropped; capture child in a local var so exit/error handlers guard
  this.child === child before mutating state, preventing a race where a new start()
  replaces this.child before the old process's exit handler fires
- PageProjectProvider.ts: re-key editorStates from document.uri to WebviewPanel — URI
  was wrong because the same document can open in multiple panels; fan status updates
  out to all panels for a project; filter apaevt_flow trace events by project_id so
  unrelated projects don't receive each other's traces; extract pipelineResult from
  op === 'end' trace body into its own field

Client transport fix (ts + python):
- Clear _transport on disconnect so the next connect() with a new URI always creates a
  fresh transport — reconnecting to a different URI was reusing the stale transport
  with the old URI baked in

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* UI/UX fixes for canvas nodes

* fix rotate on stopping button, fix coloring on stop button (#667)

* fix(vscode): pipeline submenu now opens canvas editor instead of JSON (#669)

The openFile and createNewPipelineFile commands were passing 'rocketride.PageEditor'
as the viewType to vscode.openWith, which is not registered. VSCode fell back to
the default JSON text editor. Fixed both call sites to use the registered
'rocketride.PageProject' viewType.

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* feat(agent_deepagent): port hierarchical subagents to AgentBase/AgentContext (#668)

Splits agent_deepagent into two node types under one parent folder, mirroring
the agent_crewai layout:

  - agent_deepagent             (deepagent_agent/)     flexible: standalone or orchestrator
  - agent_deepagent_subagent    (deepagent_subagent/)  invoke-only, classType ["deepagent"]

Driver changes:
- DeepAgentDriver._collect_subagents fans out `describe` via
  getControllerNodeIds('deepagent') + per-node invoke(component_id=...),
  builds one AgentContext + LLM + tools per subagent, passes SubAgent
  records to create_deep_agent(subagents=...)
- DeepAgentSubagentDriver adds describe() and a _run that raises as
  defense-in-depth (subagent has no questions lane)
- _read_connconfig_values reads connConfig directly so form values the
  UI writes nested under the default-profile key (e.g. {"default": {...}})
  are resolved correctly; Config.getNodeConfig left untouched
- Helpers: _tool_args_schema (real JSON Schema for tool args_schema),
  _extract_first_json_object (tolerant balanced-brace parser),
  _compose_system_prompt (shared manager/subagent prompt composition)

Rocketlib:
- IInvokeDeepagent (Describe + DescribeResponse) alongside IInvokeCrew
- Re-exported from rocketlib/__init__.py

UX:
- Advanced Mode boolean checkbox on both nodes — Normal shows Instructions
  only; Advanced swaps in Agent Description + System Prompt (main) or
  System Prompt (subagent, with Description always visible)
- Subagent has no lanes/input sections, cannot be wired as a top-level
  pipeline agent or as a general tool

Docs:
- Per-subfolder README following agent_crewai convention
- Deepagents library link corrected to github.com/langchain-ai/deepagents

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

* fix(agent): strip ReAct trace from CrewAI Manager result, chain task context (#666)

* fix(agent): strip ReAct trace from CrewAI Manager result, chain task context

Three fixes for hierarchical CrewAI result quality:

1. Add _strip_react_preamble() — in hierarchical mode result.raw and
   tasks_output[-1].raw often contain the full manager delegation trace
   (Thought/Action/Observation chain) rather than just the final answer.
   Strips to the last "Final Answer:" marker, or the last JSON block if
   the text looks like a ReAct trace, or returns '' for inline traces so
   garbage doesn't leak to the user.

2. Add context=list(sub_tasks) to each Task — without this, downstream
   sub-agents (word analyst, chart renderer) had no access to prior task
   outputs (e.g. the fetched Wikipedia text). CrewAI requires explicit
   context wiring for inter-task data flow.

3. Update result extraction to iterate tasks_output in reverse and take
   the first clean result, falling back to result.raw with the same
   stripping. Avoids returning the manager's full delegation trace.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* harden ReAct stripping, remove fragile context chaining

* address CR comment

* update doc string

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Rod.Christensen <rod.christensen@aparavi.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: ryan-t-christensen <ryan.christensen@rocketride.ai>
Co-authored-by: dylan-savage <130109357+dylan-savage@users.noreply.github.com>
AviNormie pushed a commit to AviNormie/rocketride-server that referenced this pull request Nov 9, 2026
…overhaul (rocketride-org#670)

* feat(shared-ui): persist canvas state, add isFlowReady, and centralize node loading

Previously, viewport (zoom/pan), lock state, snap-to-grid, and editor mode
were either not persisted at all or stored only in local preferences. On
reload the canvas always reset to fitView at default zoom, losing the user's
position. Additionally, ReactFlow timing was managed through scattered
setTimeout/requestAnimationFrame workarounds with no unified signal for when
nodes were measured and the canvas was ready for viewport operations.

PipelineConfig schema (TypeScript + Python SDKs):
- Added docRevision, isLocked, snapToGrid, snapGridSize, and editorMode to
  PipelineConfig so these fields travel with the .pipe file across all
  consumers. IProject now inherits them instead of declaring docRevision
  separately.

isFlowReady state (FlowGraphContext):
- Added an isFlowReady boolean state that tracks whether all nodes have been
  rendered and measured by ReactFlow. Transitions false→true when every node
  has measured.width, and true→false when unmeasured nodes appear (new node
  added, template instantiated, project loaded).
- All effects that need measured nodes (viewport restoration, fitView,
  template post-processing) now depend on isFlowReady instead of using
  setTimeout(0) or requestAnimationFrame.

loadCanvas centralization (FlowGraphContext):
- Extracted a loadCanvas(nodes, edges) function that sets isLoadingRef,
  resets isFlowReady, and calls setNodes/setEdges. This is the single
  entry point for structural canvas changes.
- loadData (project load) now delegates to loadCanvas for the node/edge
  work, then handles layout preference sync and viewport queueing.
- addNode now uses loadCanvas instead of calling setNodes directly, so
  single-node additions get the same isFlowReady cycle and isLoadingRef
  guard as bulk loads.

Viewport save/restore:
- onToolchainUpdated now includes isLocked, snapToGrid, and snapGridSize
  from projectLayoutRef in the saved project, so layout prefs persist with
  the document.
- onMoveEnd handler added to ReactFlow so viewport-only changes (zoom/pan
  without node edits) trigger a save via onToolchainUpdated.
- On load, viewport is restored from project.viewport via a useEffect that
  fires when isFlowReady transitions to true. Falls back to fitView if no
  saved viewport exists.
- Removed the fitView prop from ReactFlow — viewport is now always managed
  programmatically through the isFlowReady cycle.

FlowPreferencesContext:
- isLocked is now derived from projectLayout state instead of a separate
  useState, eliminating dual-state sync issues when loadData pushes layout
  prefs from the project document.

useTemplateInstantiator simplification:
- Replaced the two-phase measurement polling (pendingIds + needsFit +
  doneRef) with a single useEffect gated on isFlowReady. When isFlowReady
  becomes true and pendingIds exist, it updates internals, notifies the
  host, and calls fitView.
- Template instantiation now uses loadCanvas instead of calling
  setNodes/setEdges directly, getting the same isLoadingRef guard and
  isFlowReady cycle.

addNode positioning:
- When no position is specified (accordion/create panel), addNode now finds
  a non-overlapping spot by starting at viewport center and shifting down
  until clear of existing nodes, matching the quick-add popup behavior.

EmptyCanvasPrompt:
- Only shown when nodes.length === 0 AND isFlowReady is true, preventing
  the brief flash of the "Select your starting point" dialog while a
  project's components are still loading into nodes.
- Fixed React style warnings by replacing border shorthand with longhand
  properties (borderWidth/borderStyle/borderColor) in item and templateItem
  styles to avoid conflicts with conditional borderColor overrides.

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

* fix(shared-ui): use spiral search for non-overlapping node placement

Replace the downward-only linear search with a spiral pattern that
searches outward from the viewport center, finding the nearest
available slot in all directions.

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

* feat(shared-ui): decompose monolithic flow module into modular ProjectView architecture

Restructure the shared-ui package from a single monolithic `modules/flow/`
canvas module into a composable, multi-view project architecture. The canvas
editor is relocated, five new standalone view components are introduced, and
a new ProjectView orchestration module ties them together behind a redesigned
TabPanel.

=== CANVAS RELOCATION ===

Move the entire ReactFlow-based pipeline canvas editor from
`modules/flow/` to `components/canvas/`. The internal directory structure
is preserved verbatim (components/, context/, hooks/, templates/, util/,
types.ts, theme.ts). The barrel export in `src/index.tsx` is updated to
re-export `Canvas` and `IFlowProps` from the new path. No functional
changes to the canvas itself.

Files moved (92 files):
  modules/flow/**  →  components/canvas/**

=== NEW MODULE: ProjectView (modules/project/) ===

Add a top-level orchestration component that composes the canvas editor
and all runtime views (Status, Tokens, Flow, Trace, Errors) into a
unified project frame with a shared TabPanel.

- ProjectView.tsx (229 lines): Wires up lazy-loaded tab content via
  React.lazy + Suspense, manages active tab state, and delegates
  host↔view communication through typed callback props.

- types.ts (131 lines): Defines the complete message protocol for
  host↔view communication, split into per-component message pairs:
    • CanvasIncoming / CanvasOutgoing
    • StatusIncoming / StatusOutgoing
    • TraceIncoming / TraceOutgoing
  Composed into aggregate types:
    • ProjectViewIncoming — all messages the host can send
    • ProjectViewOutgoing — all messages the view can emit
  Also defines ProjectViewMode, IProjectViewProps, and IViewProps.

- hooks/useTraceState.ts (274 lines): Incrementally processes an array
  of TraceEvent objects (begin/enter/leave/end ops) into a flat list of
  TraceRow objects for the trace viewer. Maintains document map, slot
  bindings, and pending call stacks via refs. Supports reset detection
  when the event array shrinks. Caps retained documents at 64.

- hooks/useElapsedTimer.ts (85 lines): Returns a live-updating
  elapsed-seconds counter while a pipeline task is in the RUNNING state.
  Starts a 1-second interval on RUNNING, clears on completion/cancel/
  unmount.

=== NEW VIEW COMPONENTS ===

All five new view components follow the established shared-ui conventions:
plain React, inline CSSProperties style objects, --rr-* CSS custom
property tokens, section divider comments, no MUI dependencies.

1. components/status/ (5 files, ~1,210 lines total)
   - Status.tsx: Completions chart and stats for a running pipeline.
     1-second sampling interval, 600 data points (10 min history),
     automatic reset detection on pipeline restart.
   - StatusHeader.tsx: Header bar with pipeline state display and
     run/stop/restart action buttons.
   - StatusFooter.tsx: Footer with summary statistics row.
   - CompletionsChart.tsx: Canvas-based time-series chart rendering
     completions data with configurable time ranges.
   - types.ts: ChartStats, StatusDataPoint, TimeRange interfaces.

2. components/tokens/ (2 files, ~160 lines)
   - Tokens.tsx: Token consumption metrics display with breakdown by
     resource type (CPU Usage, CPU Memory, GPU Memory), progress bars,
     and total count.

3. components/flow/ (2 files, ~217 lines)
   - Flow.tsx: Pipeline flow visualization with list/graph view toggle.
     Renders pipeline stage progression.

4. components/trace/ (3 files, ~1,514 lines)
   - Trace.tsx (1,255 lines): Pipeline call-tree viewer. Builds a tree
     from TraceRow data, groups by document/object, renders expandable
     tree nodes with elapsed time, status indicators (in-flight, error,
     completed), and a detail panel showing entry/exit data.
   - JsonTree.tsx (259 lines): Recursive JSON viewer for the trace
     detail panel. Supports configurable default expansion depth,
     collapsible object/array nodes, and syntax-colored primitives.

5. components/errors/ (2 files, ~234 lines)
   - Errors.tsx: Structured error/warning message parser and display.
     Parses "ErrorType*`message`*filepath:linenumber" format with
     graceful fallback for unstructured messages.

=== TABPANEL REDESIGN ===

Rewrite the TabPanel component with a new visual design and mounting
strategy.

Visual changes:
  - Tab bar: sliding underline indicator → centered pill-style
    segmented control with rounded container and brand-colored
    active segment.
  - Removed resize/scroll event listeners (indicator tracking no
    longer needed).

API changes:
  - Removed: `children` prop, `contentClassName` prop.
  - Added: `panels: Record<string, React.ReactNode>` prop — maps
    tab IDs to their content elements.

Mount strategy change:
  - Old: Single `children` slot rendered unconditionally.
  - New: Panels render on first activation and stay mounted, with
    visibility toggled via `display: none`. This avoids re-mounting
    components like ReactFlow that require measured containers for
    correct initialization, while preventing premature mounting of
    panels that have never been visited.
  - Internal `activated` Set tracks which tabs have been shown at
    least once.

Style migration:
  - Deleted tab-panel.css (85 lines of class-based styles).
  - All styles moved to inline CSSProperties objects in TabPanel.tsx,
    consistent with the shared-ui convention.

=== BARREL EXPORT UPDATES (src/index.tsx) ===

- Canvas/IFlowProps: re-export path updated from `./modules/flow`
  to `./components/canvas`.
- Added exports: ProjectView, IProjectViewProps, IViewProps,
  ProjectViewMode, ProjectViewIncoming, ProjectViewOutgoing,
  TaskStatus, TraceEvent.

=== DEPENDENCY ADDITIONS ===

- lucide-react ^0.540.0: Icon library added to shared-ui
  (pnpm-lock.yaml updated).

=== DELETIONS ===

- modules/flow/ (92 files, ~14,058 lines): Entire legacy module
  removed. All canvas functionality is preserved in components/canvas/.
  The MUI-dependent top-level Flow.tsx wrapper in modules/flow/ is
  superseded by the new components/canvas/Canvas.tsx (which retains MUI
  for the ReactFlow integration) and by ProjectView (which is MUI-free).
- components/tab-panel/tab-panel.css (85 lines): Superseded by inline
  styles in the rewritten TabPanel.tsx.

Net change: 98 files changed, ~101 insertions, ~14,159 deletions
(large deletion count reflects the modules/flow/ removal; equivalent
code exists in the new components/canvas/ untracked directory).

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

* feat(shared-ui): unify tab bars, add StatusHeader with Run/Stop, remove vscode.css from components

Rework shared-ui tab bars, status header, and theme CSS loading:

- TabPanel: simplify to mount-only-active-panel (unmounts on tab switch),
  remove activated-set tracking and display:none toggling, add pill-style
  badge support with active/inactive styling via color-mix tokens

- StatusHeader: consolidate into a full two-column header bar with state
  indicator (dot + Running/Offline/etc), status subtitle, Run/Stop button
  with state-aware variants (run/stop/disabled), and elapsed timer —
  all self-contained with no layout responsibility on the parent

- Status: integrate StatusHeader directly, accept onPipelineAction prop,
  remove need for parent to compose header layout

- ServerMonitor: replace custom CSS tab bar and header with shared
  TabPanel component, remove sm-header/sm-tab-bar/sm-tab CSS classes

- ProjectView: remove lazy loading and Suspense wrappers (panels now
  mount/unmount with tab switches), remove redundant layout styles
  and control button logic (now in StatusHeader), add empty state
  for Tokens panel

- Theme: remove rocketride-vscode.css imports from ProjectView,
  ServerMonitor, and FlowCanvas (web app uses rocketride-default.css
  + JSON themes via applyTheme, VS Code extension loads vscode.css
  separately). Add fallback values to rocketride-vscode.css for
  --rr-bg-button, --rr-fg-button, --rr-font-family, --rr-font-family-widget

- Barrel exports: add DashboardResponse, ActivityEvent and related
  dashboard types to shared-ui index.tsx

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

* feat: unify VSCode + shared-ui architecture with ref-based ProjectView

- Merge PageEditorProvider + PageStatusProvider into PageProjectProvider
- ProjectView owns all state via useImperativeHandle ref API
- Stateless message bridges in both VSCode and rocket-ui
- Multi-source status panes (one per source, sorted A-Z)
- Canvas toolbar via context (CanvasToolbarContext)
- Rename PageDashboard -> PageMonitor across VSCode extension
- Inline styles with --rr-* tokens, delete all per-view CSS files
- Add tabContent common style, readTheme utility
- Add chart.js as shared-ui peer dependency
- Remove applyDefaults from shared-ui components (theme owned by host)
- Fix ActivityBar theme message type mismatch for iframes

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

* feat(shared-ui): cache theme tokens, notify host on canvas content change

Cache applied theme tokens in applyTheme.ts for reliable readTheme(),
update ProjectView to sync project state on content changes, and notify
host immediately when nodes are added via FlowGraphContext.

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

* feat(shared-ui): overlay tab bar, floating canvas toolbar, workspace state persistence

- TabPanel: absolute-positioned transparent overlay with centered pills,
  pointer-events passthrough so canvas is interactive underneath
- FloatingToolbar: restored as draggable bar on canvas, switches between
  horizontal/vertical based on cursor proximity to parent edges
- ProjectView: wire getPreference/setPreference to workspace state for
  toolbar position persistence, restore state on initialState arrival
- Remove CanvasToolbarContext (dead code — toolbar no longer in tab bar)
- Default node name from service catalog title on addNode
- tabContent padding clears the overlay tab bar

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

* feat: migrate DAP to SDK, strongly type APIs, document/view/prefs state model

SDK changes (TypeScript + Python):
- Add ServiceDefinition, ServicesResponse, ValidationResult, ValidationError types
- Strongly type getDashboard() → DashboardResponse, getServices() → ServicesResponse,
  getService() → ServiceDefinition, validate() → ValidationResult
- Add name parameter to use(), add restart() and getTaskToken() methods
- Add setEnv()/set_env() for runtime env variable updates
- Add addMonitor/removeMonitor with reference counting and auto-resubscribe

VS Code extension:
- Replace all raw DAP commands with SDK methods (use, terminate, getTaskToken,
  getDashboard, getServices, restart, connect+ping for test connections)
- Remove ConnectionManager.request() and monitor-manager.ts
- Remove substituteEnvVariables — SDK handles env substitution via setEnv()
- Pass env to client at creation, sync on onEnvVarsChanged
- Split project:stateChange into project:viewStateChange + project:prefsChange
- Send project:initialState + project:initialPrefs before canvas:update on ready

shared-ui:
- Split ProjectView state into viewState (mode, flowViewMode) and prefs (toolbar etc.)
- Gate rendering on viewState and prefs being received (eliminates flash)
- Export ViewState type from project module
- FloatingToolbar: use visibility:hidden when parent has 0 dimensions
- FloatingToolbar: skip ResizeObserver callbacks for hidden parents

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

* feat: project:load atomic message, viewport/layout state, dark mode fixes, dirty tracking

State architecture:
- Add project:load message — sends project, viewState, prefs, services,
  isConnected, and statuses in one atomic message (eliminates flash)
- Add ViewState.viewport — viewport persisted per-view, not in pipeline
- Add layouts (per-document defaults) — new views inherit from last layout
- VS Code: use webview getState()/setState() for per-document state,
  rocketride.layouts in workspaceState for defaults
- Add onViewportChange callback threaded through Canvas → FlowProvider →
  FlowProjectContext → FlowCanvas (replaces prefs-based viewport storage)

Dirty tracking fixes:
- Strip ui.measured from getComponentFromNode — computed field no longer
  dirties document on initial render
- Remove viewport from onContentUpdated/addNode project output — viewport
  is view state, not document content
- Remove onMoveEnd → onContentUpdated — panning/zooming no longer dirties
- Fix template instantiation: call onContentChanged directly instead of
  onContentUpdated (was blocked by isLoadingRef race condition)

Canvas improvements:
- Rename onToolchainUpdated → onContentUpdated across all canvas files
- Dark mode: detect via data-vscode-theme-kind body attribute in getMuiTheme
- Dark mode: sync --icon-filter on body when theme changes
- Dark mode: CSS-only --icon-filter rules for vscode-dark/high-contrast
- Dark mode: theme-aware edge stroke colors via --xy-edge-stroke
- Dark mode: icon filter on create-node panel sidebar icons
- Fix gear icon fill override in NodeHeader (conditional spread)
- Fix MoreMenu icon color (explicit --rr-text-secondary)
- Edge delete button: use --rr-bg-paper background with --rr-text-secondary

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

* fix(shared-ui): remove debug component log from ProjectView

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

* feat(shared-ui): stop icon Square, PipelineActions on Status tab, remove metrics bg

- RunButton: swap StopCircle for Square icon with transparent fill
- StatusHeader: add extraActions slot, render PipelineActions (Chat now / Endpoint Info)
- Status: remove background from Performance Metrics header
- ProjectView: pass taskStatuses to Canvas, import PipelineActions for SourceStatusPane

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

* feat: wire onOpenLink end-to-end, serverHost, fix EndpointInfoModal tabs

- ProjectView: add handleOpenLink callback, pass onOpenLink + serverHost
  to Canvas and SourceStatusPane PipelineActions
- types: add project:openLink to ProjectViewOutgoing, serverHost to load msg
- PageProjectProvider: handle project:openLink with full WebviewPanel bridge
  (theme, clipboard, drag-drop), send serverHost in project:load
- EndpointInfoModal: replace overlay TabPanel with inline toggleButtons

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

* feat(shared-ui): per-source Flow panes, parsed error messages in NodeStatus

- Flow: extract SourceFlowContent for single-source rendering
- ProjectView: render per-source SourceFlowPane (matches Tokens pattern),
  remove pickActiveStatus, clean up unused imports
- NodeStatus: parse structured error format (Type*message*path), wrap
  instead of truncate, bold error type

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

* refactor: simplify project API — plain name string, strongly typed PipelineConfig

Client SDK project methods now take a plain file name string instead of
an options object, and use PipelineConfig types instead of Record<string, any>.

TypeScript:
  - saveProject(name, pipeline: PipelineConfig)
  - getProject(name): PipelineConfig
  - deleteProject(name)

Python:
  - save_project(name, pipeline: PipelineConfig)
  - get_project(name) -> PipelineConfig
  - delete_project(name)

The name parameter is the file name on disk (e.g. "my-chat"), not the
pipeline's UUID. The UUID (project_id) lives inside the pipeline JSON
and is used for identity tracking, not file storage.

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

* chore(shared-ui): remove duplicate theme JSON files

Theme JSON files are served from rocket-ui's public/themes/ at runtime.
The shared-ui copies were unused — fetchAndApplyTheme() fetches from the
host's /themes/ endpoint, not from the shared-ui package.

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

* fix(shared-ui): stop viewport/source leaking into pipeline, simplify RunButton

Root cause: ProjectView injected viewState.viewport into the project
object before passing to Canvas. This caused viewport and source to
leak through onContentChanged, marking documents dirty on every
pan/zoom or Play click.

Fixes:
  - Pass viewport as separate initialViewport prop through Canvas →
    FlowContainer → FlowProvider → FlowProjectContext → FlowGraphContext
  - Remove viewport injection hack from ProjectView
  - RunButton: remove source injection from project (source passed
    separately via status:pipelineAction message)
  - handleRunPipeline: stop sending canvas:contentChanged on Play
    (pressing Play doesn't edit content)
  - RunButton: remove isPending state entirely (host may cancel via
    save dialog; pending spinner would get stuck)
  - RunButton: remove label spans, icon-only (Run/Stop/Stopping)
  - Run and Stop buttons now same hover width (3.5rem)

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

* feat: per-source trace panes, flow event types, UI style consolidation

Wire source field through flow events end-to-end (task engine → vscode
provider → shared-ui) so trace and flow tabs can show per-source panes.
Add TaskEventFlow / TASK_EVENT_FLOW types to TS and Python SDKs, remove
unused EVENT_STATUS_UPDATE export. Move useTraceState processing into
useEffect for React 18 Strict Mode compatibility. Consolidate card/header
styles via commonStyles, simplify node header CSS to use surface-alt
tokens, and add rocketride theme.

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

* feat(shared-ui): collapsible trace call tree with lane-typed renderers

Major refactor of the Trace component for the pipeline trace viewer.

Call tree structure:
  - Each enter/leave pair renders as a single collapsible row (▸/▾)
  - Expanded: Input data box → children → Output data box (no ENTER/LEAVE rows)
  - Structural nesting via CSS margin-left + border-left
  - Batching of identical consecutive siblings with "N more..." progressive reveal
  - Inline detail panel under expanded nodes (not side panel)

Lane-typed renderers (new renderers/ directory):
  - render_question: displays question text, history, instructions, examples, goals
  - render_answer: displays answer text with word count, token usage cards
  - render_document: displays content, metadata (source, objectId, chunk)
  - render_text: displays text with char/word count
  - render_video: displays action (Begin/Write/End), buffer size, mimeType
  - render_audio: displays format, duration, sample rate, channels (or stream action)
  - render_image: displays format, dimensions, file size (or stream action)
  - render_table: parses markdown tables and renders as HTML table
  - Each renderer has: TypeScript type guard (isX), summary function, render function
  - Dispatch by lane name, validated by type guard

Data view modes: [Tree] [JSON] [Raw] toggle buttons
  - Tree: lane-typed renderer (falls back to JSON if no renderer matches)
  - JSON: JsonTree with defaultExpanded=2
  - Raw: JSON.stringify compact string

Other changes:
  - Removed side detail panel and resize handle
  - Removed "Trace" header and Clear button (handled by parent)
  - Lane colors for all lanes including image, table
  - Lane display names: tags→data, closing→flush
  - Explicit rgba backgrounds for lane badges (no color-mix)
  - useTraceState moved to useEffect (fixes React 18 Strict Mode)
  - Flow events forwarded with source field for per-source filtering
  - Removed unused helpers (findNodeById, collectVisibleNodes, etc.)

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

* fix(shared-ui): restore titleBar colors for node headers, cardHeader consistency

- Node headers: restore --rr-bg-titleBar-inactive/active with
  hover/selected transitions (was incorrectly changed to surface-alt
  which had insufficient contrast in dark themes)
- cardHeader: use --rr-bg-titleBar-inactive instead of --rr-bg-surface-alt
  for consistency with canvas node headers across all panel headers

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

* feat(shared-ui): trace viewer theme cleanup, UX polish, component name resolution

- Replace all made-up CSS variables (--rr-font-mono, --rr-border-subtle,
  --rr-bg-surface, etc.) with declared --rr-* tokens from theme files
- Add --rr-chart-* lane colours and --rr-annotation-bg-default to
  rocketride-vscode.css
- Remove ~30 unused styles, dead selection state, and stale props
- Resolve component IDs to display names via pipeline lookup map
- Show recursive call counts on every level including object groups
- Muted styling for empty pass-through nodes
- Smart Data/JSON/Raw toggle: default to Data when a typed renderer
  exists, hide Data option otherwise
- Move result status to output box with collapsed/expanded display
- Square left corners on inline data boxes
- Fix documents renderer to handle arrays, not just single objects
- Remove redundant Node/Called by/Lane fields from input box
- Add left/right padding to rendered data content

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

* feat(shared-ui, rocketlib): invoke lane renderer + IInvoke computed type field

Add @computed_field `type` to IInvoke so trace events carry the Python
class name (IInvokeLLM, IInvokeTool, etc.) for dispatch.  New invoke
lane renderer handles LLM asks, tool discovery/invoke/validate with
type-specific detail views.

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

* feat(rocketlib, shared-ui): invoke type hierarchy refactor, IInvokeOp, IInvokeMemory

Python (rocketlib):
- Add IInvokeOp base class with computed type via __qualname__
  (e.g. "IInvokeLLM.Ask") and lane field for routing
- IInvokeLLM: pure namespace with nested Ask, GetContextLength,
  GetOutputLength, GetTokenCounter operation classes
- IInvokeTool: migrate nested classes to IInvokeOp, add lane
- IInvokeMemory: new type deriving from IInvokeTool with Put, Get,
  List, Clear operations backed by tool dispatch
- IInvoke: remove computed_field type (envelope only)
- instance.invoke(): takes single param, reads param.lane for routing,
  component_id replaces classType+nodeId
- Driver control(): unpacks control.param instead of *control.args

Callers (host.py, 12 node files):
- IInvokeLLM(op='ask', question=q) → IInvokeLLM.Ask(question=q)
- instance.invoke('llm', param, nodeId=x) → instance.invoke(param, component_id=x)
- Memory class uses IInvokeMemory.Put/Get/List/Clear

Frontend (shared-ui):
- Invoke renderer dispatches on param.type split ("IInvokeLLM.Ask"
  → category + operation) via lookup tables
- Add IInvokeMemory renderer
- Remove redundant input/output/result from tool/memory Data views
- Add RS.sectionContent for consistent label→content indentation
- Apply sectionContent to question and invoke renderers

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

* feat(shared-ui): split trace renderers into input/output, diff view, collapsible sections

- Split InlineDataBox into InputDataBox and OutputDataBox
  - InputDataBox: call info, typed Data renderer per lane
  - OutputDataBox: DiffView by default, invoke-specific overrides
  - When entryData === exitData: single "Data" box, no Output
- New utils.ts: traceDataEqual, diffObjects (10-entry cap, shallow
  per change), DiffView component, CollapsibleSection component
- Split index.tsx: renderTraceInput/Output, summaryTraceInput/Output
  - Default output renderer: DiffView showing adds/changes/deletes
  - Invoke output: table-driven dispatch (LLM Ask shows Answer)
- Invoke renderer improvements:
  - LLM Ask input: Goal, Question always visible; Instructions,
    Context, History collapsed by default via CollapsibleSection
  - LLM Ask output: renders Answer (string or JSON) from result
  - Memory input: shows Operation, Key, Value
  - Memory output: shows Status, Key, returned Value
  - Remove OP_LABELS map, show raw op values
  - Remove renderExtras, unknown types get JSON/Raw only
  - Instruction text blocks get yellow left border
  - Goal before Question in field order
- Consistent RS.sectionContent indentation across all renderers
  (answer, text, document, invoke)

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

* feat(shared-ui): shared question/answer formatters, result footer, robust trace stack

- Extract format_question/format_answer so render_question, render_answer and render_invoke (LLM Ask) share one renderer
- Add ResultFooter showing OK/Error/Skip/PreventDefault at the bottom of each expanded call
- Shift/Ctrl-click a call header to expand or collapse the whole subtree
- IInvokeCrew renderer + summarizer; Tool Query output lists discovered tools
- useElapsedTimer now ticks during INITIALIZING as well as RUNNING
- useTraceState recovers from missing enter/leave events by aligning the pending stack and marking orphaned frames as errors

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

* feat(agent): refactor AgentBase to AgentContext seam, split CrewAI, fix DAP cross-client seq collision

AGENT BASE REFACTOR — AgentContext + call_llm/call_tool adapters
----------------------------------------------------------------
Replace the old host: AgentHost + _bind_framework_* callback API with a
clean AgentContext dataclass and three host adapters on AgentBase:
call_llm, call_llm_json, call_tool. The driver _run signature changes
from (agent_input, host, ctx) to (*, context, question). AgentInput is
deleted; its run metadata moves onto AgentContext and the Question travels
alongside as a separate parameter. The two abstract _bind_framework_llm /
_bind_framework_tools methods are removed — each driver now defines plain
module-level builder functions (e.g. _build_langchain_llm(agent_base, context),
_build_deepagent_tools(agent_base, context, descriptors)) that close over
agent_base and context directly. _internal/agent_tool.py is removed
entirely; agent-as-tool is now declared per IInstance as a @tool_function def
run_agent(self, input_obj) using the shared AGENT_TOOL_INPUT_SCHEMA /
AGENT_TOOL_OUTPUT_SCHEMA exported from ai.common.agent.types.

AgentBase.run_agent now lazy-builds AgentHostServices once per IInstance
and caches it on iInstance._agent_host. Tool discovery (one engine invoke
per connected tool node) happens once at first question instead of on every
question. A new REQUIRES_MEMORY class flag lets drivers declare a memory
dependency that run_agent enforces at first question.

sendSSE now takes context as an explicit parameter and reads the invoker
from there instead of from self._invoker. The _invoker and _host
instance attributes on AgentBase are gone.

All engine envelope construction (IInvokeLLM.Ask(...)) lives inside
call_llm / call_llm_json. Drivers never touch IInvokeLLM directly.
call_llm accepts a polymorphic prompt that is either a pre-built
Question (used by drivers like rocketride that build structured prompts)
or framework-native messages that get flattened to a transcript.

AgentHostServices.Tools exposes a prepared flat list: List[ToolDescriptor]
built once at construction. Drivers read context.tools.list directly and the
old discover_tools helper is gone. The class also drops the leaky
class-level _tool_nodes / _tool_list attributes that would have been
shared across instances and silently leaked descriptors between concurrent
agent runs. Tools.invoke(tool_name, args) is renamed from (tool_name, input)
to make it explicit that it takes a clean dict — framework-shape conversion
is the driver wrapper's job, not the host's.

Why: the old _bind_framework_* methods existed only to receive callbacks
(call_llm, invoke_tool, log_tool_call) that the driver would then capture
in its inner LangChain / CrewAI subclasses. Every driver wrote the same
closure boilerplate around the same shims. Passing agent_base and
context directly to module-level builder functions lets the inner classes
close over them naturally — the entire indirection layer disappears, and
the resulting drivers are dramatically smaller (deepagent loses ~280 lines).

AgentInput was a half-honest wrapper: it carried a Question plus run
metadata, but the question and the metadata have completely different
lifecycles. Run metadata is per-call scaffolding (immutable, threadsafe,
shared across reentrant call_llm chains); a question is the actual unit
of work and changes meaning every time a framework loop synthesizes a new
one from messages. Splitting them into AgentContext (frozen dataclass) +
a separate question parameter is structurally honest and makes reentrancy
safe.

self._invoker was a latent concurrency bug. Two concurrent run_agent
calls on the same IInstance would race to set self._invoker, and SSE
events from one call could be routed to the other call's pipe. Reading the
invoker from context instead means each call has its own immutable
binding. Same reasoning for self._host.

Lazy host construction per IInstance fixes a real performance pothole.
Tool discovery does N engine invokes per connected tool node. Rebuilding
the host on every question multiplied that cost by question rate — and
worse, the discovered descriptors were thrown away after each question.
Caching on iInstance._agent_host discovers once and reuses forever.

Centralizing IInvokeLLM construction in call_llm means engine type changes
(like the IInvokeLLM(op=ask,...) to IInvokeLLM.Ask(...) factory pattern)
only need to land in one place. Drivers don't need co-ordinated updates.

Replacing the bespoke agent-as-tool path with @tool_function def run_agent
unifies the surface with the @tool_function decorator pattern from rocketride-org#599.
The old handle_agent_tool_invoke / _AgentAsToolProvider branch was a
parallel system that did the same thing the decorator does — it existed
because @tool_function post-dated the original agent base. Now that the
decorator exists, the parallel system is dead code.

CREWAI SPLIT — three node types out of one package
---------------------------------------------------
The single agent_crewai node becomes three logical nodes, each registered
via its own services.*.json and living in its own sub-package:

  - crewai_agent     — standalone single-agent node, also exposed as a
                       run_agent tool. classType: [agent, tool].
  - crewai_subagent  — managed sub-agent. No questions lane. Can only be
                       wired into a Manager via the crewai lane.
                       classType: [crewai].
  - crewai_manager   — hierarchical multi-agent delegator. Fans out
                       describe on the crewai lane to connected
                       subagents, assembles a Crew, runs CrewAI hierarchical
                       process. classType: [agent, tool].

Shared framework code lives at the package root: crewai_base.py (the
CrewBase(AgentBase) shared base with _build_crew_llm / _build_crew_tools),
crewai_runner.py, crewai_listener.py, plus the shared requirements.txt.
The package no longer exports IInstance / IGlobal; the engine loads each
sub-package via the path field in its services manifest.

The crew control-plane op renames from crewai.describe to bare describe
on lane crewai, and IInvokeCrew.Describe now extends IInvokeOp (with
lane = crewai) instead of plain BaseModel. IInvokeCrew.DescribeResponse
is no longer an IInvokeOp — it is a value object that travels inside a
Describe response, not an op that gets dispatched. The trace renderer
(render_invoke.tsx) is updated to display the new op name.

Why: the original single agent_crewai node tried to be both a standalone
agent and the orchestrator depending on which lanes were connected. There
was no way to validate the combinations: nothing stopped someone from
running a subagent standalone, or wiring a manager without subagents. The
behavior was implicit in connection topology, which means errors only
surfaced at runtime and only with confusing symptoms.

Splitting the role into three explicit node types makes the constraints
declarative in the services manifest. Subagents have no questions lane and
literally cannot be invoked directly. Managers require at least one crewai
lane connection. The engine normal lane validation now catches misuse
before pipeline start.

Cross-Manager nesting (one Crew calling into another Crew as a black box)
still works — but now it is via the tool.run_agent path (the agent-as-tool
surface), not by overloading the crewai lane. That keeps the crewai lane
semantics clean: it is the manager/subagent fan-out channel, nothing else.

The op rename matches the @invoke_function decorator dispatch convention
landed in rocketride-org#599: bare op names route to def describe(self, ...) methods on
the receiving IInstance. Keeping the old crewai.describe form would have
forced a special case in the dispatcher.

DAP CROSS-CLIENT SEQ COLLISION — two clients, one task
-------------------------------------------------------
Task._send_data now constructs a fresh outbound DAP packet via
_data_client.dap_request(command=..., arguments=..., token=...) instead of
forwarding the inbound dict verbatim. DataCommands.handle_data wraps the
subprocess response in a fresh build_response(request, body=...) keyed off
the inbound request. New tests in both RocketRideClient_test.py and
RocketRideClient.test.ts exercise the path: two independent clients sharing
one task via useExisting, sending concurrently.

Why: two independent client connections that share a task (via useExisting)
each have their own DAP seq counter. They can independently issue
overlapping seqs — both clients can reach seq=4 within milliseconds of each
other. Eaas multiplexes both into one outbound _data_client to the
subprocess. If we forwarded the inbound dict verbatim, the colliding seqs
would clobber each other in _data_client._pending_requests: the second
future overwrites the first, the first response gets dropped, and the
originating client hangs forever waiting for a reply that already came back
to the wrong slot.

Building a fresh outbound packet via dap_request allocates a unique seq
from _data_client._next_seq() so each outbound message has its own
correlation slot. Rebuilding the response envelope via build_response
ensures the inbound DAPConn sees its original request_seq so it can
correlate the response back to the originating client.

This bug is invisible with one client because a single client has one
monotonic seq counter — it never collides with itself. The single-client
concurrent test in the same suite does NOT exercise the path. Two independent
clients fanning into one task are the necessary precondition, which is
exactly what the new tests reproduce.

MISTRAL SDK 1.x / 2.x COMPATIBILITY
------------------------------------
llm_mistral/IGlobal.py, llm_mistral/mistral.py, and
llm_vision_mistral/mistral_vision.py try from mistralai.client import Mistral
(2.x layout) and fall back to from mistralai import Mistral (1.x). The
>=2.0.0 constraint is dropped from both requirements.txt. The mistralai SDK
reorganized its package layout between 1.x and 2.x. Pinning to 2.x broke
installs in environments still on 1.x. The shim accepts whichever is
installed without forcing an upgrade.

INCIDENTAL FIT-AND-FINISH
--------------------------
- PageProjectProvider.ts adds a clipboard bridge: webview iframes can post
  {type:requestPaste} / {type:copyText,text} and the extension host
  proxies to vscode.env.clipboard.read/writeText. VSCode intercepts native
  paste at the Electron layer, so embedded iframes cannot read the OS
  clipboard themselves.

- task_engine.py adds debug(output_message) on subprocess output events
  so traces capture the same payload that gets appended to _status_trace.

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

* feat(vscode, shared-ui): persistent client, virtualized managers, disconnect overlay

Refactor ConnectionManager to use a single persistent RocketRideClient
(persist: true) that survives across connect/disconnect cycles. The SDK's
_resubscribeAllMonitors() now correctly replays monitor subscriptions on
every reconnect — fixing the bug where Server Monitor showed 0 MONITORS
after a disconnect/reconnect.

Backend lifecycle virtualized behind BaseManager with two concrete
implementations:
- LocalManager: composes EngineManager, connect with retries for engine
  startup race
- RemoteManager: credential validation + direct connect

Removed CloudManager (no-op stub), all retry/backoff logic from
ConnectionManager (SDK handles it), isMonitoring flag from
PageProjectProvider (SDK tracks via _monitorKeys).

Disconnect overlay added to ProjectView and ServerMonitor — semi-opaque
with blur, showing [ Disconnected ] over the existing content. On
reconnect, statusMap/traceEvents/cachedStatuses are cleared for a fresh
start. Status chart pauses while disconnected and resets on reconnect.

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

* feat(shared-ui, vscode, server, clients): pipeline result display, toolbar orientation context, icon standardization, connect dedup, engine EventEmitter

Pipeline result end-to-end:
- pipe.instance.cpp: gate BEGIN/END debug events on PIPELINE_TRACE_LEVEL::METADATA and
  serialize the pipe response into the END event at SUMMARY level — previously always
  emitted "{}" unconditionally, so the final result never reached the UI
- client-ts/python: add result/pipelineResult field to TaskEventFlow for op === 'end'
- useTraceState: on op === 'end' inject a synthetic __result__ sentinel TraceRow so
  Trace.tsx can render it separately from the call tree
- Trace.tsx: extract __result__ rows in buildObjectGroups, add collapsible ResultRow
  component (green header) rendered after the call tree via renderFinalSections
- render_final.tsx (new): dispatches each result field through the existing per-type
  renderers (renderAnswer, renderDocument, etc.) via result_types map; falls back to
  JsonTree for unknown types
- format_answer.tsx: render structured JSON answers via JsonTree instead of a plain
  text block

Toolbar orientation context:
- FloatingToolbar.tsx: expose ToolbarOrientationContext so toolbar button children can
  read horizontal/vertical orientation via useToolbarOrientation() without prop drilling;
  fix null guard on getRenderedPosition() before writing dragStart
- toolbar/index.tsx: re-export useToolbarOrientation from barrel

Icon standardization:
- FitIcon, LockIcon, NoteIcon, TidyIcon, UnlockIcon, ZoomInIcon, ZoomOutIcon: replace
  verbose per-element SVG markup with compact single-path 24x24 BoxIcons-style paths;
  standardizes icon visual style and halves markup weight
- FlowCanvas.tsx: replace lucide Undo2/Redo2/Move/BoxSelect/PlusSquare imports with
  inline BxIcon helpers using BoxIcons paths, consistent with the icon overhaul

VSCode reliability fixes:
- connection.ts: add connectPromise dedup guard — concurrent connect() calls (e.g.
  racing event handlers at startup) now share one in-flight promise instead of each
  spawning an independent _connect(), preventing double-initialization
- engine-manager.ts: switch from BaseManager to Node.js EventEmitter — was already
  calling this.emit('terminated') but BaseManager didn't extend EventEmitter so events
  were silently dropped; capture child in a local var so exit/error handlers guard
  this.child === child before mutating state, preventing a race where a new start()
  replaces this.child before the old process's exit handler fires
- PageProjectProvider.ts: re-key editorStates from document.uri to WebviewPanel — URI
  was wrong because the same document can open in multiple panels; fan status updates
  out to all panels for a project; filter apaevt_flow trace events by project_id so
  unrelated projects don't receive each other's traces; extract pipelineResult from
  op === 'end' trace body into its own field

Client transport fix (ts + python):
- Clear _transport on disconnect so the next connect() with a new URI always creates a
  fresh transport — reconnecting to a different URI was reusing the stale transport
  with the old URI baked in

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* UI/UX fixes for canvas nodes

* fix rotate on stopping button, fix coloring on stop button (rocketride-org#667)

* fix(vscode): pipeline submenu now opens canvas editor instead of JSON (rocketride-org#669)

The openFile and createNewPipelineFile commands were passing 'rocketride.PageEditor'
as the viewType to vscode.openWith, which is not registered. VSCode fell back to
the default JSON text editor. Fixed both call sites to use the registered
'rocketride.PageProject' viewType.

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* feat(agent_deepagent): port hierarchical subagents to AgentBase/AgentContext (rocketride-org#668)

Splits agent_deepagent into two node types under one parent folder, mirroring
the agent_crewai layout:

  - agent_deepagent             (deepagent_agent/)     flexible: standalone or orchestrator
  - agent_deepagent_subagent    (deepagent_subagent/)  invoke-only, classType ["deepagent"]

Driver changes:
- DeepAgentDriver._collect_subagents fans out `describe` via
  getControllerNodeIds('deepagent') + per-node invoke(component_id=...),
  builds one AgentContext + LLM + tools per subagent, passes SubAgent
  records to create_deep_agent(subagents=...)
- DeepAgentSubagentDriver adds describe() and a _run that raises as
  defense-in-depth (subagent has no questions lane)
- _read_connconfig_values reads connConfig directly so form values the
  UI writes nested under the default-profile key (e.g. {"default": {...}})
  are resolved correctly; Config.getNodeConfig left untouched
- Helpers: _tool_args_schema (real JSON Schema for tool args_schema),
  _extract_first_json_object (tolerant balanced-brace parser),
  _compose_system_prompt (shared manager/subagent prompt composition)

Rocketlib:
- IInvokeDeepagent (Describe + DescribeResponse) alongside IInvokeCrew
- Re-exported from rocketlib/__init__.py

UX:
- Advanced Mode boolean checkbox on both nodes — Normal shows Instructions
  only; Advanced swaps in Agent Description + System Prompt (main) or
  System Prompt (subagent, with Description always visible)
- Subagent has no lanes/input sections, cannot be wired as a top-level
  pipeline agent or as a general tool

Docs:
- Per-subfolder README following agent_crewai convention
- Deepagents library link corrected to github.com/langchain-ai/deepagents

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

* fix(agent): strip ReAct trace from CrewAI Manager result, chain task context (rocketride-org#666)

* fix(agent): strip ReAct trace from CrewAI Manager result, chain task context

Three fixes for hierarchical CrewAI result quality:

1. Add _strip_react_preamble() — in hierarchical mode result.raw and
   tasks_output[-1].raw often contain the full manager delegation trace
   (Thought/Action/Observation chain) rather than just the final answer.
   Strips to the last "Final Answer:" marker, or the last JSON block if
   the text looks like a ReAct trace, or returns '' for inline traces so
   garbage doesn't leak to the user.

2. Add context=list(sub_tasks) to each Task — without this, downstream
   sub-agents (word analyst, chart renderer) had no access to prior task
   outputs (e.g. the fetched Wikipedia text). CrewAI requires explicit
   context wiring for inter-task data flow.

3. Update result extraction to iterate tasks_output in reverse and take
   the first clean result, falling back to result.raw with the same
   stripping. Avoids returning the manager's full delegation trace.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* harden ReAct stripping, remove fragile context chaining

* address CR comment

* update doc string

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Rod.Christensen <rod.christensen@aparavi.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: ryan-t-christensen <ryan.christensen@rocketride.ai>
Co-authored-by: dylan-savage <130109357+dylan-savage@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:nodes Python pipeline nodes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants