Skip to content

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

Merged
maxy-shpfy merged 1 commit into
masterfrom
05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges
Jun 2, 2026
Merged

refactor: v2 - ai assistant - split tools bridges#2333
maxy-shpfy merged 1 commit into
masterfrom
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.

@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/51a1c12

@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 2 times, most recently 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
@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch from 7688762 to c2bd0c1 Compare June 1, 2026 16:41
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch 2 times, most recently from 3ac1d65 to c0a50da Compare June 1, 2026 16:53
@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch 2 times, most recently from 95746f5 to d9d21ad Compare June 1, 2026 17:07
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from c0a50da to 8875597 Compare June 1, 2026 17:07
Comment thread src/routes/v2/pages/Editor/components/AiChat/toolBridge/index.ts
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from 8875597 to 8a028cf Compare June 2, 2026 01:50
@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch from d9d21ad to 6e69a55 Compare June 2, 2026 01:50
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from 8a028cf to d9d69ee Compare June 2, 2026 01:57
@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch from 6e69a55 to 4530361 Compare June 2, 2026 01:57
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from d9d69ee to 8e06b51 Compare June 2, 2026 04:30
@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch from 4530361 to 6e06f1c Compare June 2, 2026 04:30
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from 8e06b51 to 99d6601 Compare June 2, 2026 05:24
@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch 2 times, most recently from 9833d39 to cf07a14 Compare June 2, 2026 18:18
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch 2 times, most recently from c6d9c82 to 8a6c76d Compare June 2, 2026 18:50
@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_debug_agent branch 2 times, most recently from 33c4324 to 58296c7 Compare June 2, 2026 19:26
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from 8a6c76d to 1b20590 Compare June 2, 2026 19:26
Copy link
Copy Markdown
Collaborator Author

maxy-shpfy commented Jun 2, 2026

Merge activity

  • Jun 2, 7:53 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 2, 8:16 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 2, 8:19 PM UTC: @maxy-shpfy merged this pull request with Graphite.

@maxy-shpfy maxy-shpfy changed the base branch from 05-27-feat_v2_-_ai_assistent_-_debug_agent to graphite-base/2333 June 2, 2026 20:11
@maxy-shpfy maxy-shpfy changed the base branch from graphite-base/2333 to master June 2, 2026 20:14
@maxy-shpfy maxy-shpfy force-pushed the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch from 1b20590 to 51a1c12 Compare June 2, 2026 20:15
@maxy-shpfy maxy-shpfy merged commit 010f1c7 into master Jun 2, 2026
17 checks passed
@maxy-shpfy maxy-shpfy deleted the 05-27-refactor_v2_-_ai_assistant_-_split_tools_bridges branch June 2, 2026 20:19
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.

2 participants