Skip to content

refactor: v2 - ai assistant - split editor and view agent implementations#2356

Merged
maxy-shpfy merged 1 commit into
masterfrom
06-02-refactor_v2_-_ai_assistant_-_split_editor_and_view_agent_implementations
Jun 11, 2026
Merged

refactor: v2 - ai assistant - split editor and view agent implementations#2356
maxy-shpfy merged 1 commit into
masterfrom
06-02-refactor_v2_-_ai_assistant_-_split_editor_and_view_agent_implementations

Conversation

@maxy-shpfy

@maxy-shpfy maxy-shpfy commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Introduces a dedicated Run View AI assistant worker alongside the existing Editor worker, splitting what was a single monolithic worker.ts into a shared factory (createWorkerApi) and two page-specific entry points (editorWorker.ts, runViewWorker.ts).

The core dispatcher logic is extracted into dispatcherRuntime.ts so both the Editor and Run View dispatchers share the same MemorySession management and invoke loop. The Editor dispatcher (editorDispatcher.ts) retains the full set of specialist sub-agents (general help, pipeline repair, pipeline architect, debug assistant), while the new Run View dispatcher (runViewDispatcher.ts) is intentionally read-only, exposing only general help and debug assistant.

An AgentContext discriminated union ({ mode: "editor" } | { mode: "runView"; runId; subgraphExecutionId? }) is introduced and threaded from the page through AiChatStoreProviderAiChatStoreAgentThreadAgentClientworker.init(). The Run View dispatcher uses this context to inject the active run id directly into its system prompt, so the agent is immediately aware of which run it is inspecting without requiring the user to restate it.

AiChatStoreProvider now accepts a createWorker factory prop so each page (Editor, Run View) owns spawning its own worker with a statically analyzable URL for Vite's worker bundling.

A new system prompt (runViewDispatcher.md) defines the Run View assistant's read-only persona, routing rules, and style guidelines.

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)

Demo of AI - run view dedicated.mov (uploaded via Graphite)

Test Instructions

  1. Open the pipeline Editor and open the AI chat panel. Confirm the assistant responds as before with the full set of capabilities (pipeline repair, architect, debug, general help).
  2. Open a completed pipeline Run View and open the AI chat panel. Confirm the assistant is aware of the active run id without being told, and that it refuses mutation requests (edit, rerun) with an appropriate read-only message.
  3. Ask the Run View assistant to explain the current run — confirm it routes to the debug assistant and returns run-specific information.
  4. Verify that opening both the Editor and Run View simultaneously spawns two separate workers (tangle-editor-agent and tangle-run-view-agent) visible in browser DevTools.

Additional Comments

The knip.json entry points are updated to reflect the two new worker entry files, replacing the old single worker.ts entry.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 06-02-refactor_v2_-_ai_assistant_-_split_editor_and_view_agent_implementations/ba6f227

maxy-shpfy commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

@maxy-shpfy maxy-shpfy force-pushed the 06-02-refactor_v2_-_ai_assistant_-_introduce_agentthread_primitive branch from e8e1dc3 to 2a72379 Compare June 11, 2026 06:01
@maxy-shpfy maxy-shpfy force-pushed the 06-02-refactor_v2_-_ai_assistant_-_split_editor_and_view_agent_implementations branch from 0aa2788 to 0261b2a Compare June 11, 2026 06:01
@maxy-shpfy maxy-shpfy changed the base branch from 06-02-refactor_v2_-_ai_assistant_-_introduce_agentthread_primitive to graphite-base/2356 June 11, 2026 06:12
@maxy-shpfy maxy-shpfy changed the base branch from graphite-base/2356 to master June 11, 2026 06:16
@maxy-shpfy maxy-shpfy force-pushed the 06-02-refactor_v2_-_ai_assistant_-_split_editor_and_view_agent_implementations branch from 0261b2a to ba6f227 Compare June 11, 2026 06:17
@maxy-shpfy maxy-shpfy merged commit 3ffa687 into master Jun 11, 2026
17 checks passed
@maxy-shpfy maxy-shpfy deleted the 06-02-refactor_v2_-_ai_assistant_-_split_editor_and_view_agent_implementations branch June 11, 2026 06:21
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.

3 participants