Skip to content

feat: add poly wren command for AI-assisted editing - #228

Draft
Ruari-Phipps wants to merge 4 commits into
mainfrom
ruari/assistant-command
Draft

feat: add poly wren command for AI-assisted editing#228
Ruari-Phipps wants to merge 4 commits into
mainfrom
ruari/assistant-command

Conversation

@Ruari-Phipps

@Ruari-Phipps Ruari-Phipps commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds poly wren — an interactive chat CLI against the Wren SSE developer endpoint. Wren works remotely on a branch; the CLI streams its work live, switches the local project to wren-created branches, and pulls applied changes automatically.

Motivation

The platform now exposes a PAT-authenticated SSE endpoint for Wren (POST /v1/studio-assistant/turn). This brings AI-assisted agent editing into the ADK workflow: describe a change in natural language, watch wren plan/build/test it remotely, and end up with the result pulled into the local workspace.

Changes

  • poly wren interactive REPL: multiline prompt (Enter sends, Ctrl+J newline), live-rendered markdown replies, spinner narration from tool ui_descriptions, header panel, session resume via --session-id
  • SSE client (handlers/wren_api.py) follows the full run chain — mid-chain suspended completes, subagent frames, and auto-answered input gates don't end the turn
  • Branch handling: refuses to start with local uncommitted changes (--force to override); switches the local project when wren creates/switches branches (name + ID shown)
  • Pull policy: pulls after turns where wren applied changes (✔ Applied N changes…), once more at exit if needed; --no-pull disables
  • Plan and final-report cards render as markdown panels; mermaid blocks get clickable mermaid.live links
  • Auto-mode gates display the question + auto-chosen answer; genuine gates prompt via questionary
  • --json -m single-shot mode emitting one machine-readable object
  • Hidden --replay <conv.json> dev harness: renders downloaded conversation exports through the real renderer for offline UX iteration
  • Hidden poly glot alias
  • Busy-retry: a new prompt sent while a suspended run is still working waits (409 retry loop, up to ~10 min)

Test strategy

  • Added/updated unit tests (46 new tests: event rendering, SSE terminal semantics, apply parsing, replay adapter, retry loop, mermaid links)
  • Manual CLI testing (poly wren, poly wren --replay)
  • Tested against a live Agent Studio project (multi-turn build session on ruari-ws)

Checklist

  • ruff check . and ruff format --check . pass
  • pytest passes (827 passed)
  • No breaking changes to the poly CLI interface (or migration path documented)
  • Commit messages follow conventional commits

Screenshots / Logs

╭──────────── Wren ─────────────╮
│  Workspace  ruari-ws          │
│  Project    PROJECT-F9T2XAXJ  │
│  Branch     ADK-40881-ae45    │
╰────────────────────────────────╯
  Enter send · Ctrl+J newline · /exit quit

You: I want to build 10 faqs for a general hotel agent
  ? Should I create 10 common hotel FAQs (check-in/out times, parking, …)?
  → auto-answered: Yes, those topics sound good
⠋ Planning 10 hotel FAQ topics…
╭─ Plan: Hotel FAQ Topics ──────────────────────────╮
│ …rendered markdown plan…                          │
╰───────────────────────────────────────────────────╯
✔ Applied 23 changes to the branch (23 modified)
  Pulling changes to local workspace… done.

🤖 Generated with Claude Code

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

Ruari-Phipps and others added 2 commits August 6, 2026 12:51
…ssistant

Adds an interactive chat CLI against the glot SSE developer endpoint:
streams runs as live-rendered markdown, follows suspended run chains,
switches to assistant-created branches, and pulls applied changes
locally. Includes a --json single-shot mode, a hidden replay harness
for offline UX iteration on downloaded conversations, plan/report
panels, ui_description spinner narration, and mermaid.live diagram
links.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The inline on_changes_applied callback triggers _pull_local right when
the apply/push tool_execution_end arrives in the event stream, so the
local workspace reflects changes while the assistant continues
testing/reporting. Previously the pull only ran after the entire turn's
event stream completed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Ruari-Phipps
Ruari-Phipps force-pushed the ruari/assistant-command branch from 4db443b to 44d4215 Compare August 6, 2026 11:51
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

The feature has been officially named "wren". Renames the command,
class, module files, and user-facing strings; the poly assistant
command is removed (poly glot remains as a hidden alias). The backend
SSE route path is left unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Ruari-Phipps Ruari-Phipps changed the title feat: add poly assistant command for AI-assisted editing feat: add poly wren command for AI-assisted editing Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Base (main) PR Change
73.0% 71.8% -1.2% ⚠️

Changed file coverage

File Coverage Change
poly/cli.py 78.8% +0.3% ✅

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