Skip to content

feat(playground): Studio chat builds sequence diagrams - #377

Merged
graphite-app[bot] merged 1 commit into
mainfrom
feat/sequence-studio-chat
Oct 11, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
feat/sequence-studio-chat

Conversation

@anandpant

@anandpant anandpant commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

  • Studio chat (/api/chat, the playground home) exposes a build_sequence_diagram tool next to build_flowchart. Its input is the new BuildSequenceDiagramToolInputSchema (sequence spec without style or artifact options). Its output is the canonical BuildSequenceDiagramResult. It runs on the shared Code Mode buildSequenceDiagram vertical.
  • Both tools share a per-turn executor, makeStudioBuildToolExecutor: a three-attempt budget per tool, host-injected artifact options, reuse of the accepted result, and optional grounding (flowchart logo placement stays as is). MAX_FLOWCHART_BUILD_ATTEMPTS is now MAX_DIAGRAM_BUILD_ATTEMPTS.
  • The agent system prompt picks the family: sequence for time-ordered interactions, and always when a sequence diagram is asked for. It adds sequence craft rules: participants, chronological messages, and returns that close calls (which draws activation bars).
  • The playground UI reads either tool part for progress titles ("Drawing your sequence diagram"), participant ghost labels while drawing, result details, failure copy (invalid_sequence), the stage, and downloads. One starter now asks for a sequence diagram.
  • The chat repair retry metric and log are renamed to sketchi_chat_build_retries and "Retrying Studio diagram repair", with an operation label. The telemetry log allowlist is updated to match.

Why

#280 asks that natural-language generation in Studio chat handle sequence explicitly. Before this, the only thing Studio could build was a flowchart.

Verification

  • pnpm nx affected -t typecheck,test --base=origin/main (18 projects)
  • New tests: sequence tool contracts, build with host options and accepted-result reuse against the real Code Mode runtime, repair issues and attempt cap, policy routing, and UI selectors for sequence tool parts
  • The live Studio flow in Chrome is checked at the end of the stack, with real model calls.

Refs #280

Review follow-ups

  • One budget per turn: both tools share one StudioBuildTurn, with one attempt counter (three total), one accepted artifact, and one build at a time. A call to the other tool after acceptance returns a rejection without building. Tests: a flowchart is accepted, then a sequence call causes 0 new writes; a mixed retry sequence caps at three attempts.
  • Routing: a type the user names wins over the topic in both directions ("a flowchart of an OAuth handshake is still a flowchart"); with no type named, content decides. pnpm eval:studio-routing (tools/studio-routing-eval.ts) runs four maintained cases (named or unnamed type × either family) against a live playground's /api/chat and scores the first build tool called. Its stream parsing and case coverage are unit-tested.
  • Size limits: SEQUENCE_MAX_PARTICIPANTS = 12 and SEQUENCE_MAX_MESSAGES = 40 in core validation, reported as Code Mode sequence_too_large (registered as a post-baseline code in the compatibility corpus). The issue list is capped at 20. The limits sit above the prompt's craft targets (2–8 participants, ≤30 messages) so Code Mode and MCP callers keep headroom: 12 columns are about 3,800px wide and stay well under canvas element limits. The prompts now state both the target and the limit.
  • Stopped calls: a tool call left in an input state when its run is no longer active shows "Stopped drawing your …" with a Stopped badge, for both families (diagramToolCardStatus, tested).

anandpant commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge - adds this PR to the back of the merge queue
  • fast - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@anandpant
anandpant force-pushed the feat/sequence-studio-chat branch from 08de351 to 7317dda Compare October 10, 2026 22:11
@anandpant
anandpant force-pushed the feat/sequence-activations branch from be34ec4 to 664fc62 Compare October 10, 2026 22:11
@anandpant
anandpant marked this pull request as ready for review October 10, 2026 22:12
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@graphite-app

graphite-app Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Merge activity

@graphite-app
graphite-app Bot force-pushed the feat/sequence-activations branch from de73f7e to 49c0292 Compare October 11, 2026 01:49
graphite-app Bot pushed a commit that referenced this pull request Oct 11, 2026
## What changed

- Studio chat (`/api/chat`, the playground home) exposes a `build_sequence_diagram` tool next to `build_flowchart`. Its input is the new `BuildSequenceDiagramToolInputSchema` (sequence spec without style or artifact options). Its output is the canonical `BuildSequenceDiagramResult`. It runs on the shared Code Mode `buildSequenceDiagram` vertical.
- Both tools share a per-turn executor, `makeStudioBuildToolExecutor`: a three-attempt budget per tool, host-injected artifact options, reuse of the accepted result, and optional grounding (flowchart logo placement stays as is). `MAX_FLOWCHART_BUILD_ATTEMPTS` is now `MAX_DIAGRAM_BUILD_ATTEMPTS`.
- The agent system prompt picks the family: sequence for time-ordered interactions, and always when a sequence diagram is asked for. It adds sequence craft rules: participants, chronological messages, and returns that close calls (which draws activation bars).
- The playground UI reads either tool part for progress titles ("Drawing your sequence diagram"), participant ghost labels while drawing, result details, failure copy (`invalid_sequence`), the stage, and downloads. One starter now asks for a sequence diagram.
- The chat repair retry metric and log are renamed to `sketchi_chat_build_retries` and "Retrying Studio diagram repair", with an `operation` label. The telemetry log allowlist is updated to match.

## Why

#280 asks that natural-language generation in Studio chat handle sequence explicitly. Before this, the only thing Studio could build was a flowchart.

## Verification

- `pnpm nx affected -t typecheck,test --base=origin/main` (18 projects)
- New tests: sequence tool contracts, build with host options and accepted-result reuse against the real Code Mode runtime, repair issues and attempt cap, policy routing, and UI selectors for sequence tool parts
- The live Studio flow in Chrome is checked at the end of the stack, with real model calls.

Refs #280

## Review follow-ups

- **One budget per turn:** both tools share one `StudioBuildTurn`, with one attempt counter (three total), one accepted artifact, and one build at a time. A call to the other tool after acceptance returns a rejection without building. Tests: a flowchart is accepted, then a sequence call causes 0 new writes; a mixed retry sequence caps at three attempts.
- **Routing:** a type the user names wins over the topic in both directions ("a flowchart of an OAuth handshake is still a flowchart"); with no type named, content decides. `pnpm eval:studio-routing` (`tools/studio-routing-eval.ts`) runs four maintained cases (named or unnamed type × either family) against a live playground's `/api/chat` and scores the first build tool called. Its stream parsing and case coverage are unit-tested.
- **Size limits:** `SEQUENCE_MAX_PARTICIPANTS = 12` and `SEQUENCE_MAX_MESSAGES = 40` in core validation, reported as Code Mode `sequence_too_large` (registered as a post-baseline code in the compatibility corpus). The issue list is capped at 20. The limits sit above the prompt's craft targets (2–8 participants, ≤30 messages) so Code Mode and MCP callers keep headroom: 12 columns are about 3,800px wide and stay well under canvas element limits. The prompts now state both the target and the limit.
- **Stopped calls:** a tool call left in an input state when its run is no longer active shows "Stopped drawing your …" with a Stopped badge, for both families (`diagramToolCardStatus`, tested).
@graphite-app
graphite-app Bot force-pushed the feat/sequence-studio-chat branch from f931d5f to 11e5330 Compare October 11, 2026 01:49
Base automatically changed from feat/sequence-activations to main October 11, 2026 01:53
## What changed

- Studio chat (`/api/chat`, the playground home) exposes a `build_sequence_diagram` tool next to `build_flowchart`. Its input is the new `BuildSequenceDiagramToolInputSchema` (sequence spec without style or artifact options). Its output is the canonical `BuildSequenceDiagramResult`. It runs on the shared Code Mode `buildSequenceDiagram` vertical.
- Both tools share a per-turn executor, `makeStudioBuildToolExecutor`: a three-attempt budget per tool, host-injected artifact options, reuse of the accepted result, and optional grounding (flowchart logo placement stays as is). `MAX_FLOWCHART_BUILD_ATTEMPTS` is now `MAX_DIAGRAM_BUILD_ATTEMPTS`.
- The agent system prompt picks the family: sequence for time-ordered interactions, and always when a sequence diagram is asked for. It adds sequence craft rules: participants, chronological messages, and returns that close calls (which draws activation bars).
- The playground UI reads either tool part for progress titles ("Drawing your sequence diagram"), participant ghost labels while drawing, result details, failure copy (`invalid_sequence`), the stage, and downloads. One starter now asks for a sequence diagram.
- The chat repair retry metric and log are renamed to `sketchi_chat_build_retries` and "Retrying Studio diagram repair", with an `operation` label. The telemetry log allowlist is updated to match.

## Why

#280 asks that natural-language generation in Studio chat handle sequence explicitly. Before this, the only thing Studio could build was a flowchart.

## Verification

- `pnpm nx affected -t typecheck,test --base=origin/main` (18 projects)
- New tests: sequence tool contracts, build with host options and accepted-result reuse against the real Code Mode runtime, repair issues and attempt cap, policy routing, and UI selectors for sequence tool parts
- The live Studio flow in Chrome is checked at the end of the stack, with real model calls.

Refs #280

## Review follow-ups

- **One budget per turn:** both tools share one `StudioBuildTurn`, with one attempt counter (three total), one accepted artifact, and one build at a time. A call to the other tool after acceptance returns a rejection without building. Tests: a flowchart is accepted, then a sequence call causes 0 new writes; a mixed retry sequence caps at three attempts.
- **Routing:** a type the user names wins over the topic in both directions ("a flowchart of an OAuth handshake is still a flowchart"); with no type named, content decides. `pnpm eval:studio-routing` (`tools/studio-routing-eval.ts`) runs four maintained cases (named or unnamed type × either family) against a live playground's `/api/chat` and scores the first build tool called. Its stream parsing and case coverage are unit-tested.
- **Size limits:** `SEQUENCE_MAX_PARTICIPANTS = 12` and `SEQUENCE_MAX_MESSAGES = 40` in core validation, reported as Code Mode `sequence_too_large` (registered as a post-baseline code in the compatibility corpus). The issue list is capped at 20. The limits sit above the prompt's craft targets (2–8 participants, ≤30 messages) so Code Mode and MCP callers keep headroom: 12 columns are about 3,800px wide and stay well under canvas element limits. The prompts now state both the target and the limit.
- **Stopped calls:** a tool call left in an input state when its run is no longer active shows "Stopped drawing your …" with a Stopped badge, for both families (`diagramToolCardStatus`, tested).
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Web Preview

Status: deletion-pending

Deletion pending: Cloudflare deleted this Preview, but its URL is still reachable and serves this PR's code (cloudflare/workers-sdk#15945). The cleanup job failed so this stays visible.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Icons Preview

Status: deleted

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Eval Harness Preview

Status: deleted

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Excalidraw Workspace Preview

Status: deleted

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Playground / Studio Preview

Status: deleted

@graphite-app
graphite-app Bot merged commit 8e18e19 into main Oct 11, 2026
11 checks passed
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:58 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:58 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:58 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:58 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:58 Active
@graphite-app
graphite-app Bot deleted the feat/sequence-studio-chat branch October 11, 2026 01:58

This branch was successfully deployed

2 active deployments
staging — 8e18e197 Deployed Oct 11, 2026 by graphite-app[bot] via cleanup-preview (playground) #446
production — 8e18e197 Deployed Oct 11, 2026 by graphite-app[bot] via deploy (icons) #123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant