Skip to content

Add AI chat create_workspace_tab tool and cross-tab source access #110

@knightedcodemonkey

Description

@knightedcodemonkey

Enable AI chat to create new workspace tabs (for example, styles tabs) and support cross-tab workflows where the user references a different tab than the active one.

Problem
Current AI chat flow can update existing tabs via propose_editor_update, but it cannot create tabs.
Requests like “add a new styles tab that colors paragraphs from src/components/status.tsx” are not fully satisfiable unless the target source tab is active or manually pasted into chat.

Goals

  1. Add create_workspace_tab tool support in chat.
  2. Keep propose_editor_update focused on updating existing tab content.
  3. Preserve existing payload size/summarization protections.
  4. Keep behavior mode-aware (DOM/React and style dialect policies already in place).

Non-goals

  1. Multi-tab creation in one call.
  2. Automatic framework/style dialect conversion.
  3. Reworking existing workspace tab architecture.

Proposed Tool Contract
Tool name: create_workspace_tab

Parameters

  1. path (string, required): normalized workspace-relative path for new tab.
  2. language (string, required): tab language/dialect (for example javascript-jsx, css, less, sass, module).
  3. initialContent (string, optional): initial source content.
  4. activate (boolean, optional): whether to switch to new tab immediately.

Validation rules

  1. Reject duplicate path collisions.
  2. Normalize path consistently with existing tab helpers.
  3. Reject unsupported/empty language values.
  4. Return created tab id, name, path, language.

Follow-up for cross-tab context
Implement one of:

  1. Send all tabs option in chat drawer, or
  2. read_workspace_tab tool (id/path based) so model can pull source tab content explicitly.

Acceptance Criteria

  1. AI can create a new styles tab through chat using create_workspace_tab.
  2. Created tab appears in workspace tabs UI and persists via workspace save flow.
  3. Existing propose_editor_update still updates by tab id/path.
  4. No regression in chat payload byte budget and summarization behavior.
  5. DOM mode guidance and style dialect guidance remain intact in system prompt context.
  6. Playwright coverage added for:
  7. Tool-call-driven tab creation success.
  8. Duplicate path rejection handling.
  9. Cross-tab request scenario with either Send all tabs or read_workspace_tab.

Suggested implementation touchpoints

  1. proposals.js
  2. drawer.js
  3. app.js
  4. github-workflows.js
  5. github-workflows-setup.js
  6. github-byot-ai.spec.ts

Risks / considerations

  1. Avoid ambiguous target/path behavior between create and update tools.
  2. Prevent invalid or unsafe paths.
  3. Keep tool semantics simple and explicit (create vs update split).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions