Fix CLI progress line deduping for Studio Code#3286
Merged
youknowriad merged 2 commits intotrunkfrom Apr 29, 2026
Merged
Conversation
Collaborator
📊 Performance Test ResultsComparing da3403b vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
youknowriad
added a commit
that referenced
this pull request
May 4, 2026
Brings in 53 commits since the last merge. Conflict resolution + ports: - `apps/cli/ai/agent.ts`: kept the dual-runtime dispatch from this branch; absorbed trunk's drop of `maxTurns` (no longer destructured, no longer threaded to runtimes). Body contention with #3272's inline `query()` changes (mcpServers, remoteSession, STUDIO_REMOTE_SESSION env detection) was resolved by deferring those to the Anthropic runtime layer where the `query()` call now lives. - `apps/cli/ai/runtimes/anthropic/index.ts`: ported #3272's improvements — `STUDIO_REMOTE_SESSION` env → `remoteSession` flag → systemPromptOptions (the Telegram bridge sets this when it spawns `studio code --json`). Dropped maxTurns from query() options to match trunk. - `apps/cli/ai/runtimes/types.ts`, `apps/cli/ai/runtimes/openai/index.ts`, tests: dropped maxTurns from `AgentRuntimeConfig` and all callers. - `apps/cli/ai/tools.ts` deleted on our side, modified on trunk: deleted in resolution. Trunk's #3272 additions were ported into our split-tools layout: - `apps/cli/ai/tools/screenshot-helpers.ts` (new): shared `captureScreenshotPng` + viewport constants. - `apps/cli/ai/tools/share-screenshot.ts` (new): the `share_screenshot` tool that emits a `media.share` event for the remote-session bridge. - `apps/cli/ai/tools/take-screenshot.ts`: refactored onto the shared helper; updated description to point at share_screenshot. - `apps/cli/ai/tools/index.ts`: registry includes shareScreenshotTool; `resolveStudioToolDefinitions` now uses an exclusion-set model so both preview-steering and (when not enabled) share_screenshot get filtered consistently. `createRemoteSiteTools` includes shareScreenshotTool when `isRemoteSessionEnabled()`. - `apps/cli/ai/tools/utils.ts`: ported #3286's progress-update coalescing — `update: true` now overwrites the last progress message in `captureCommandOutput` instead of appending. - `apps/cli/ai/tools/wp-cli.ts`: ported #3264's smarter `--post_content=` quote handling (flags after a quoted post_content are now parsed correctly) and the typographic-dash rejection that catches `‐porcelain` / `–color` etc. before they hit WP-CLI as silent garbage. - `apps/ui/src/components/session-view/composer/index.tsx`: trunk converted Composer to `forwardRef` with a `ComposerHandle.appendDraft` imperative method (used by trunk's annotate-toolbar hand-off). Merged the forwardRef structure with our composer-owned cross-family swap state, dialog, and hooks. Kept trunk's Escape-to-interrupt keydown handler and the textareaRef. - `apps/ui/src/components/session-view/index.tsx`: absorbed trunk's annotation handler (`handleAnnotationsDone`), the Annotation type import, and the SitePreview `onAnnotationsDone` prop. Dropped the unused-by-the-merged-body `useConnector` import. Verified: typecheck has only the pre-existing #3320 (`@wp-playground` bump) error in `apply-blueprint-form-values.ts` that's also present on plain trunk; 1532 tests pass; lint clean; CLI builds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
youknowriad
added a commit
that referenced
this pull request
May 4, 2026
Brings in 53 commits since the last merge. Conflict resolution + ports: - `apps/cli/ai/agent.ts`: kept the dual-runtime dispatch from this branch; absorbed trunk's drop of `maxTurns` (no longer destructured, no longer threaded to runtimes). Body contention with #3272's inline `query()` changes (mcpServers, remoteSession, STUDIO_REMOTE_SESSION env detection) was resolved by deferring those to the Anthropic runtime layer where the `query()` call now lives. - `apps/cli/ai/runtimes/anthropic/index.ts`: ported #3272's improvements — `STUDIO_REMOTE_SESSION` env → `remoteSession` flag → systemPromptOptions (the Telegram bridge sets this when it spawns `studio code --json`). Dropped maxTurns from query() options to match trunk. - `apps/cli/ai/runtimes/types.ts`, `apps/cli/ai/runtimes/openai/index.ts`, tests: dropped maxTurns from `AgentRuntimeConfig` and all callers. - `apps/cli/ai/tools.ts` deleted on our side, modified on trunk: deleted in resolution. Trunk's #3272 additions ported into our split-tools layout: - `apps/cli/ai/tools/screenshot-helpers.ts` (new): shared `captureScreenshotPng` + viewport constants. - `apps/cli/ai/tools/share-screenshot.ts` (new): the `share_screenshot` tool that emits a `media.share` event for the remote-session bridge. - `apps/cli/ai/tools/take-screenshot.ts`: refactored onto the shared helper; updated description to point at share_screenshot. - `apps/cli/ai/tools/index.ts`: registry includes shareScreenshotTool; `resolveStudioToolDefinitions` now uses an exclusion-set model so both preview-steering and (when not enabled) share_screenshot get filtered consistently. `createRemoteSiteTools` includes shareScreenshotTool when `isRemoteSessionEnabled()`. - `apps/cli/ai/tools/utils.ts`: ported #3286's progress-update coalescing — `update: true` now overwrites the last progress message in `captureCommandOutput` instead of appending. - `apps/cli/ai/tools/wp-cli.ts`: ported #3264's smarter `--post_content=` quote handling (flags after a quoted post_content are now parsed correctly) and the typographic-dash rejection that catches `‐porcelain` / `–color` etc. before they hit WP-CLI as silent garbage. - `apps/ui/src/components/session-view/composer/index.tsx`: trunk converted Composer to `forwardRef` with a `ComposerHandle.appendDraft` imperative method (used by trunk's annotate-toolbar hand-off). Merged the forwardRef structure with our composer-owned cross-family swap state, dialog, and hooks. Kept trunk's Escape-to-interrupt keydown handler and the textareaRef. - `apps/ui/src/components/session-view/index.tsx`: absorbed trunk's annotation handler (`handleAnnotationsDone`), the Annotation type import, and the SitePreview `onAnnotationsDone` prop. Dropped the unused-by-the-merged-body `useConnector` import. Verified: typecheck has only the pre-existing #3320 (`@wp-playground` bump) error in `apply-blueprint-form-values.ts` that's also present on plain trunk; 1532 tests pass; lint clean; CLI builds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateflag from CLI logger callbacks so Studio Code updates the previous loader line instead of appending duplicatescaptureCommandOutputTesting
npm test -- apps/cli/ai/tests/tools.test.ts apps/cli/commands/ai/tests/ai.test.ts