Skip to content

SEP Phase 4 (spec + SDK): commands, flags, shortcuts, session#151

Merged
brentrager merged 1 commit into
mainfrom
th-045f70-phase4
Jul 3, 2026
Merged

SEP Phase 4 (spec + SDK): commands, flags, shortcuts, session#151
brentrager merged 1 commit into
mainfrom
th-045f70-phase4

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

Phase 4 of the Smooth Extension Protocol adds the command surface (slash commands + autocomplete + flags + shortcuts) and session-mutating actions to the spec, the TS SDK, and a flagship demo that exercises phases 2–4 together.

Solution

Spec (spec/extension/):

  • New command-complete.schema.json for argument autocomplete.
  • session.schema.json now carries the dispatch context on every params object — the wire form of the command-tier + epoch guard the host enforces — and adds send_user_message (deliver_as steer/follow_up/next_turn).
  • initialize.schema.json gains a flags delivery map (params) and a shortcuts list + ShortcutRegistration (registrations).
  • New fixtures for command/complete, session send_user_message/append_entry, shortcuts, flag delivery; new $invalid cases (session context required, completion value required). echo.mjs registers a command + shortcut and answers command/execute + command/complete.

SDK (typescript/extension-sdk/):

  • smooth.registerCommand (optional complete completer), registerFlag (+ getFlag), registerShortcut.
  • Command handlers get a CommandContext bound to their command-tier context: session.sendMessage/sendUserMessage/appendEntry, ui, hasUI, args.
  • createTestHost: runCommand, completeCommand, and a session/* service enforcing the same command-tier guard the engine does (event-tier → -32003), recording every session call. runConformance replays command/execute + command/complete.

Demo: plan-mode — flag --plan + command /plan toggle plan mode; a tool_call intercept blocks write/edit/apply_patch/bash while on; each toggle pushes a set_widget render block and persists an LLM-invisible appendEntry (survives a hot reload — the flag re-seeds state, the transcript keeps history).

Verification

typecheck + test green across @smooai/smooth-operator (35, incl. the fixture-driven extension-conformance), @smooai/smooth-operator-server (132), and @smooai/smooth-extension-sdk (35, incl. the new command-path suite and the live-subprocess runConformance). The Rust engine host that consumes this spec lands in smooth-operator-core#29.

🤖 Generated with Claude Code

Spec: command-complete schema, context on session params (+ send_user_message
deliver_as), flags delivery + shortcuts in initialize, new fixtures + $invalid
cases, echo.mjs command support. SDK: registerCommand/registerFlag/
registerShortcut, CommandContext with bound session (sendMessage/
sendUserMessage/appendEntry), createTestHost runCommand/completeCommand +
tier-guarded session service, runConformance command steps. Demo: plan-mode
(flag + command + tool_call intercept + widget + appendEntry across reload).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e859bc4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@smooai/smooth-extension-sdk Minor
@smooai/smooth-operator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager brentrager merged commit 0953584 into main Jul 3, 2026
6 checks passed
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