Skip to content

refactor: v2 - ai assistant - split tools bridges#2333

Open
maxy-shpfy wants to merge 1 commit into
05-27-feat_v2_-_ai_assistent_-_debug_agentfrom
05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges
Open

refactor: v2 - ai assistant - split tools bridges#2333
maxy-shpfy wants to merge 1 commit into
05-27-feat_v2_-_ai_assistent_-_debug_agentfrom
05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges

Conversation

@maxy-shpfy
Copy link
Copy Markdown
Collaborator

@maxy-shpfy maxy-shpfy commented May 28, 2026

Description

The monolithic toolBridge.ts file has been split into focused, single-responsibility modules under a new toolBridge/ directory. The three handler slices are:

  • csomBridge.ts — spec-mutation handlers (add/delete/rename tasks, inputs, outputs, connections, subgraphs, validation)
  • runBridge.ts — run lifecycle handlers (submitPipelineRun, getRunDetails, debugPipelineRun)
  • debugBridge.ts — fine-grained read-only execution/container fetch handlers
  • utils.ts — shared BridgeDeps interface, requireSpec, requireBackendUrl, errorMessage, and computeNextPosition
  • index.ts — composes the three slices into the full ToolBridgeApi via spread

Truncation logic (log text, container state, execution details) that was duplicated between debugTools.ts and toolBridge.ts has been extracted into a single shared module at src/agent/util/truncate.ts. Both the worker-side per-tool path and the main-thread composite debugPipelineRun path now import from this one location, ensuring identical truncation caps regardless of which entry point the model uses.

The deepClone call on the serialized spec before pipeline submission has been removed since serializeComponentSpec already produces a plain object.

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Test Instructions

  1. Open a pipeline in the editor and confirm the AI chat agent can still read pipeline state, add/remove tasks and connections, and validate the pipeline.
  2. Submit a pipeline run via the agent and verify the run appears in the runs list and the query cache is invalidated.
  3. Trigger debugPipelineRun on a run with failed children and confirm truncated logs and container state are returned correctly.
  4. Call getContainerLog, getExecutionDetails, and getContainerState directly through the debug assistant and verify raw payloads are returned without truncation at the bridge layer.
  5. Confirm that truncation applied by debugTools.ts (worker side) and runBridge.ts (main thread) produces identical output for the same input by comparing results from both paths.

Additional Comments

The BridgeDeps type is re-exported from toolBridge/index.ts so call sites that previously imported from toolBridge.ts require only a path update with no interface changes.

Copy link
Copy Markdown
Collaborator Author

maxy-shpfy commented May 28, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

🎩 Preview

A preview build has been created at: 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges/e44dba3

@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch from 7cec3fc to 7dc9561 Compare May 28, 2026 05:42
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from 7555123 to 3cdccfe Compare May 28, 2026 05:42
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from 3cdccfe to e44dba3 Compare May 28, 2026 06:12
@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch from 7dc9561 to 7688762 Compare May 28, 2026 06:12
@maxy-shpfy maxy-shpfy marked this pull request as ready for review May 28, 2026 06:18
@maxy-shpfy maxy-shpfy requested a review from a team as a code owner May 28, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant